@celljs/ta 4.9.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +69 -15
- package/dist/gateway.mjs +170 -28
- package/dist/pi/CHANGELOG.md +11 -0
- package/dist/pi/dist/bundle/chunks/anthropic-messages-CA3HHOL3.js +6 -0
- package/dist/pi/dist/bundle/chunks/{azure-openai-responses-FSC6BAW3.js → azure-openai-responses-76TWS6DT.js} +1 -1
- package/dist/pi/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
- package/dist/pi/dist/bundle/chunks/chunk-4KSTFUIK.js +19 -0
- package/dist/pi/dist/bundle/chunks/chunk-4UNPP53I.js +55 -0
- package/dist/pi/dist/bundle/chunks/chunk-AUUCDC7R.js +4 -0
- package/dist/pi/dist/bundle/chunks/{chunk-V6KH5QG4.js → chunk-BAC3QPNW.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{chunk-4EYXVSA5.js → chunk-FF6XOTWB.js} +9 -9
- package/dist/pi/dist/bundle/chunks/chunk-FMPAMX2W.js +82 -0
- package/dist/pi/dist/bundle/chunks/chunk-GFUN2N5K.js +2 -0
- package/dist/pi/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
- package/dist/pi/dist/bundle/chunks/{chunk-C2WU32PX.js → chunk-IQUU5XIT.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{chunk-EBFHJFEE.js → chunk-LQLJ7CDW.js} +1 -1
- package/dist/pi/dist/bundle/chunks/chunk-MMDXLZVS.js +30 -0
- package/dist/pi/dist/bundle/chunks/{chunk-GN3QYODH.js → chunk-QN4TOIZN.js} +1 -1
- package/dist/pi/dist/bundle/chunks/chunk-RKNK4Y6L.js +2 -0
- package/dist/pi/dist/bundle/chunks/{chunk-B46VJEHW.js → chunk-V7SLUK6A.js} +1 -1
- package/dist/pi/dist/bundle/chunks/chunk-VEJDBY3O.js +1237 -0
- package/dist/pi/dist/bundle/chunks/chunk-VKJQ6CME.js +8 -0
- package/dist/pi/dist/bundle/chunks/{chunk-3TGLJEWK.js → chunk-WL4TUXY7.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{chunk-YZKQS34S.js → chunk-Y55SJART.js} +5 -1
- package/dist/pi/dist/bundle/chunks/{chunk-EOO47QGR.js → chunk-ZBIZYD6W.js} +1 -1
- package/dist/pi/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/dist/pi/dist/bundle/chunks/chunk-ZGYS4UTC.js +2 -0
- package/dist/pi/dist/bundle/chunks/{cli-MCOUW5WS.js → cli-7RHMDOHL.js} +7 -7
- package/dist/pi/dist/bundle/chunks/{cloudflare-workers-ai-system-one-WLAFJSP6.js → cloudflare-workers-ai-system-one-U4J7D646.js} +1 -1
- package/dist/pi/dist/bundle/chunks/codemode-worker.js +2 -0
- package/dist/pi/dist/bundle/chunks/{easter-egg-3d-WMBNSJ4M.js → easter-egg-3d-GEVPKQF6.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{execute-4CEBORGZ.js → execute-L2EEDV3L.js} +5 -3
- package/dist/pi/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/pi/dist/bundle/chunks/{google-generative-ai-INGKNW72.js → google-generative-ai-D5B6W47J.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{google-vertex-IBTX6MBF.js → google-vertex-U4H5YDEW.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{llama-cpp-classify-V5U3QKXI.js → llama-cpp-classify-EJXCQRUQ.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{mistral-conversations-S4OWXIXQ.js → mistral-conversations-S277EKLB.js} +1 -1
- package/dist/pi/dist/bundle/chunks/openai-codex-responses-TEQRB65N.js +10 -0
- package/dist/pi/dist/bundle/chunks/{openai-completions-EJNYB6IX.js → openai-completions-HRZOSLBO.js} +3 -3
- package/dist/pi/dist/bundle/chunks/{openai-decisions-IXI34BYG.js → openai-decisions-F66BDLOM.js} +1 -1
- package/dist/pi/dist/bundle/chunks/openai-responses-BAKFWTGE.js +4 -0
- package/dist/pi/dist/bundle/chunks/{openrouter-images-PISKSFMS.js → openrouter-images-VXF5TVIK.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{pi-messages-NORUKF4E.js → pi-messages-UBJKNDRN.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{runtime-FQB7RU7U.js → runtime-J5ZSBGTX.js} +1 -1
- package/dist/pi/dist/bundle/chunks/{typesafe-system-one-CHVC2UUI.js → typesafe-system-one-56TEMIHL.js} +1 -1
- package/dist/pi/dist/bundle/chunks/virtual-modules-KITQRTYM.js +2 -0
- package/dist/pi/dist/bundle/cli-runtime.js +1 -1
- package/dist/pi/dist/bundle/index.js +1 -1
- package/dist/pi/dist/bundle/rpc-entry.js +1 -1
- package/dist/pi/docs/cli.md +14 -1
- package/dist/pi/docs/extensions.md +27 -7
- package/dist/pi/docs/keybindings.md +1 -1
- package/dist/pi/docs/llama-cpp.md +5 -8
- package/dist/pi/docs/models-configuration.md +6 -1
- package/dist/pi/docs/models.md +2 -1
- package/dist/pi/docs/prompt-templates.md +1 -1
- package/dist/pi/docs/providers.md +1 -1
- package/dist/pi/docs/rpc.md +4 -2
- package/dist/pi/docs/sessions.md +7 -1
- package/dist/pi/docs/settings.md +1 -1
- package/dist/pi/docs/tui.md +1 -1
- package/dist/pi/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/dist/pi/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/dist/pi/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/dist/pi/examples/extensions/gondolin/package-lock.json +2 -2
- package/dist/pi/examples/extensions/gondolin/package.json +1 -1
- package/dist/pi/examples/extensions/plan-mode/index.ts +23 -13
- package/dist/pi/examples/extensions/plan-mode/utils.ts +42 -16
- package/dist/pi/examples/extensions/subagent/README.md +14 -11
- package/dist/pi/examples/extensions/subagent/index.ts +392 -171
- package/dist/pi/examples/extensions/with-deps/package-lock.json +2 -2
- package/dist/pi/examples/extensions/with-deps/package.json +1 -1
- package/dist/pi/examples/tsconfig.json +63 -35
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-agents/README.en.md +2 -2
- package/dist/pi/packages/ta-agents/README.md +2 -2
- package/dist/pi/packages/ta-agents/extension/index.mjs +69 -13
- package/dist/pi/packages/ta-agents/lib/agent-bindings.d.ts +19 -4
- package/dist/pi/packages/ta-agents/lib/agent-bindings.js +43 -9
- package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts +2 -0
- package/dist/pi/packages/ta-agents/lib/agent-catalog.js +3 -0
- package/dist/pi/packages/ta-agents/lib/extension.d.ts +2 -1
- package/dist/pi/packages/ta-agents/lib/extension.js +26 -4
- package/dist/pi/packages/ta-agents/lib/json-rpc.js +7 -1
- package/dist/pi/packages/ta-agents/lib/texts.d.ts +4 -0
- package/dist/pi/packages/ta-agents/lib/texts.js +4 -0
- package/dist/pi/packages/ta-agents/package.json +3 -3
- package/dist/pi/packages/ta-bots/extension/index.mjs +46 -0
- package/dist/pi/packages/ta-bots/host/index.mjs +46 -0
- package/dist/pi/packages/ta-bots/package.json +1 -1
- package/dist/pi/packages/ta-changes/package.json +1 -1
- package/dist/pi/packages/ta-channels/README.en.md +2 -2
- package/dist/pi/packages/ta-channels/README.md +2 -2
- package/dist/pi/packages/ta-channels/host/index.mjs +50 -0
- package/dist/pi/packages/ta-channels/lib/create.js +11 -3
- package/dist/pi/packages/ta-channels/lib/faces.js +1 -1
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts +6 -9
- package/dist/pi/packages/ta-channels/lib/i18n.js +12 -18
- package/dist/pi/packages/ta-channels/lib/more-menu.d.ts +3 -2
- package/dist/pi/packages/ta-channels/lib/more-menu.js +21 -29
- package/dist/pi/packages/ta-channels/lib/room.js +13 -8
- package/dist/pi/packages/ta-channels/lib/sidebar.js +241 -79
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +83 -37
- package/dist/pi/packages/ta-channels/lib/tasks.d.ts +2 -0
- package/dist/pi/packages/ta-channels/lib/tasks.js +22 -12
- package/dist/pi/packages/ta-channels/lib/views.d.ts +49 -1
- package/dist/pi/packages/ta-channels/lib/views.js +100 -1
- package/dist/pi/packages/ta-channels/package.json +1 -1
- package/dist/pi/packages/ta-channels/web/index.js +482 -259
- package/dist/pi/packages/ta-computer-use/package.json +2 -2
- package/dist/pi/packages/ta-cron/README.en.md +2 -2
- package/dist/pi/packages/ta-cron/README.md +2 -2
- package/dist/pi/packages/ta-cron/host/index.mjs +6 -0
- package/dist/pi/packages/ta-cron/lib/editor.js +60 -27
- package/dist/pi/packages/ta-cron/lib/i18n.d.ts +12 -1
- package/dist/pi/packages/ta-cron/lib/i18n.js +24 -2
- package/dist/pi/packages/ta-cron/lib/page.d.ts +33 -3
- package/dist/pi/packages/ta-cron/lib/page.js +119 -4
- package/dist/pi/packages/ta-cron/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-cron/lib/style.js +166 -46
- package/dist/pi/packages/ta-cron/lib/task-extension.d.ts +15 -0
- package/dist/pi/packages/ta-cron/lib/task-extension.js +56 -0
- package/dist/pi/packages/ta-cron/lib/task-util.d.ts +2 -0
- package/dist/pi/packages/ta-cron/lib/task-util.js +11 -0
- package/dist/pi/packages/ta-cron/lib/tasks-view.d.ts +4 -1
- package/dist/pi/packages/ta-cron/lib/tasks-view.js +102 -66
- package/dist/pi/packages/ta-cron/package.json +1 -1
- package/dist/pi/packages/ta-cron/web/index.js +928 -404
- package/dist/pi/packages/ta-extensions/README.en.md +3 -1
- package/dist/pi/packages/ta-extensions/README.md +3 -1
- package/dist/pi/packages/ta-extensions/lib/actions.js +3 -1
- package/dist/pi/packages/ta-extensions/lib/composer.d.ts +17 -0
- package/dist/pi/packages/ta-extensions/lib/composer.js +84 -0
- package/dist/pi/packages/ta-extensions/lib/i18n.d.ts +9 -0
- package/dist/pi/packages/ta-extensions/lib/i18n.js +18 -0
- package/dist/pi/packages/ta-extensions/lib/index.js +4 -0
- package/dist/pi/packages/ta-extensions/lib/make-model.d.ts +20 -0
- package/dist/pi/packages/ta-extensions/lib/make-model.js +43 -0
- package/dist/pi/packages/ta-extensions/lib/page.js +42 -18
- package/dist/pi/packages/ta-extensions/lib/settings.d.ts +4 -0
- package/dist/pi/packages/ta-extensions/lib/settings.js +44 -0
- package/dist/pi/packages/ta-extensions/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-extensions/lib/style.js +10 -4
- package/dist/pi/packages/ta-extensions/package.json +1 -1
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +7 -3
- package/dist/pi/packages/ta-extensions/web/index.js +269 -26
- package/dist/pi/packages/ta-launcher/package.json +1 -1
- package/dist/pi/packages/ta-workspace/README.md +1 -1
- package/dist/pi/packages/ta-workspace/README.zh-cn.md +1 -1
- package/dist/pi/packages/ta-workspace/lib/bytes.d.ts +11 -0
- package/dist/pi/packages/ta-workspace/lib/bytes.js +40 -0
- package/dist/pi/packages/ta-workspace/lib/common.d.ts +2 -1
- package/dist/pi/packages/ta-workspace/lib/common.js +15 -37
- package/dist/pi/packages/ta-workspace/lib/editors.js +12 -3
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +1 -2
- package/dist/pi/packages/ta-workspace/lib/i18n.js +2 -4
- package/dist/pi/packages/ta-workspace/lib/index.js +17 -1
- package/dist/pi/packages/ta-workspace/lib/launcher.d.ts +9 -0
- package/dist/pi/packages/ta-workspace/lib/launcher.js +39 -0
- package/dist/pi/packages/ta-workspace/lib/preview.d.ts +13 -3
- package/dist/pi/packages/ta-workspace/lib/preview.js +17 -14
- package/dist/pi/packages/ta-workspace/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-workspace/lib/style.js +20 -7
- package/dist/pi/packages/ta-workspace/lib/terminal-sessions.d.ts +51 -0
- package/dist/pi/packages/ta-workspace/lib/terminal-sessions.js +226 -0
- package/dist/pi/packages/ta-workspace/lib/terminal.d.ts +0 -39
- package/dist/pi/packages/ta-workspace/lib/terminal.js +28 -240
- package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts +18 -0
- package/dist/pi/packages/ta-workspace/lib/util/keys.js +23 -0
- package/dist/pi/packages/ta-workspace/lib/util/preview.d.ts +19 -0
- package/dist/pi/packages/ta-workspace/lib/util/preview.js +32 -1
- package/dist/pi/packages/ta-workspace/package.json +1 -1
- package/dist/pi/packages/ta-workspace/web/index.js +238 -68
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-C1tb6dM5.js → abnfDiagram-S7VZAUFO-BmIko5tV.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-DN1Va8BF.js → architecture-WOLXFQ4H-XgsdQ7ul.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW-BmK2SYtQ.js → architectureDiagram-YGSQEFNW--sVhMS03.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-DvLrLzTm.js → blockDiagram-APKKGZFW-8f9b-9k2.js} +1 -1
- package/dist/public/assets/browser-DOHZ0JCf.js +12 -0
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-CrQlWwrG.js → c4Diagram-KJ2TOQU5-CwYQ0Jfy.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-CHKMsuY_.js → chunk-6MUBBAK2-7Y9ezehi.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-CWJ7Np6s.js → chunk-AXFCVDMN-CZIH4pWz.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-3v5XbQGM.js → chunk-BG4553SI-DsNATY2m.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-2CC-yiCz.js → chunk-DQASFODM-CoXkfYE-.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-D2hzQPAy.js → chunk-HFQBQIA3-C5OLqki8.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-SifAZs2r.js → chunk-KQLB2F66-DMHuYGEF.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-BP0C0VCC.js → chunk-KS47KZWR-BKeOttO1.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-B1f5vw5b.js → chunk-LEVMRMFU-D6zCwkk7.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-B2MCJt7Y.js → chunk-M57EVK23-B5-QqcZg.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-cDpZJMk4.js → chunk-OY52VR5R-DQrq3n0T.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-BE0we2xc.js → chunk-QB3YPZ4I-j6ZT7EDR.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-D9wOfqqH.js → chunk-R3KSYZAL-D5MXUO36.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-BIaVsc0K.js → chunk-STOXU5M4-DaBkw4dD.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-BZc0OZEM.js → chunk-TU62E6Q5-vXcRfGci.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-Bngfwwzm.js → chunk-X4PVCEUW-CIh6H4Y2.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-C5FQ6XHK.js → chunk-XXDRQBXY-C_Vwv1FM.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-_om54nmt.js → classDiagram-v2-L25IHNXF-DccDWEJn.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-Dwpeee_6.js → cose-bilkent-JH36ORCC-BX47lumZ.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-MaI-3dMQ.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-DP5_y9Dq.js → cynefinDiagram-L36ESFBY-BE6WOGxW.js} +1 -1
- package/dist/public/assets/{d3-selection-DFiMlEmn.js → d3-selection-ZcE6yRN5.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-DYwsk6gk.js → dagre-SPEB5RXH-CE6SOOcN.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-Dq_nT3AZ.js → diagram-3B7GL73J-xC8VtiYL.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-ChURW6y9.js → diagram-DNEMPZML-4dmcBbjL.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-CgVp4Rto.js → diagram-L3MUGCDN-D14Yn3sQ.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-vrqLMDby.js → diagram-LA4NIPWU-GxSXIhsK.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-lvfOr5ij.js → diagram-MHCOC4E2-Cm7Prlpc.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-oQ18TeVp.js → diagram-XPFHEONP-mkUnnKFu.js} +1 -1
- package/dist/public/assets/{dist-BOxxmveI.js → dist-acJS-BlA.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-C7_tlZCS.js → ebnfDiagram-UZSYDL2S-m77ua3UQ.js} +1 -1
- package/dist/public/assets/{editor.api-CoZ8MEuz.js → editor.api-CljTm-EQ.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-Dkt5-ikg.js → elk-XV6XMXQE-DsQY1hw9.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-27kh3zlx.js → erDiagram-EYBAPDEH-CV8gJM0P.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-CxVEejjN.js → eventmodeling-K75KTNOO-C1pymbUr.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-shBnAQFk.js +1 -0
- package/dist/public/assets/{freemarker2-D6CwPIXh.js → freemarker2-DYJXaMHN.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-C-amlwpX.js → ganttDiagram-23REXITY-CppxOWRh.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-BtQWboBz.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-DKhzI0Xz.js → gitGraphDiagram-STJD7YCW-CrQrZhcP.js} +1 -1
- package/dist/public/assets/{handlebars-mxNr68Gm.js → handlebars-DZCnH9e2.js} +1 -1
- package/dist/public/assets/{html-Bze6s9R9.js → html-DuzouNES.js} +1 -1
- package/dist/public/assets/{index-BhQUc9PU.js → index-B7OYKvCE.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-CDSLjba_.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-WHuWjEDO.js → infoDiagram-KBXO4MBG-6pby19tQ.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-DFHUwD0J.js → ishikawaDiagram-M35NCXHK-Duf8c8rQ.js} +1 -1
- package/dist/public/assets/{javascript-4NMPu7y1.js → javascript-2d_L6cVd.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-C7gV6zEr.js → journeyDiagram-OPLOXDXO-Dvv-xzNo.js} +1 -1
- package/dist/public/assets/{jsonMode-B1JEHPMp.js → jsonMode-CFadYXyI.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-DlRu_d2Q.js → kanban-definition-BZKZHSQY-Dsk6F-TT.js} +1 -1
- package/dist/public/assets/{liquid-B7sIf4NX.js → liquid-Din4CF34.js} +1 -1
- package/dist/public/assets/{mdx-CAN0qez6.js → mdx-DivDuCWI.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-BGmotBhf.js → mermaid-parser.core-BfCv4CYZ.js} +3 -3
- package/dist/public/assets/{mermaid.core-Cl6SS3cM.js → mermaid.core-DC20ZwJj.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-DiQ8Feqr.js → mindmap-definition-I2QAS2VK-DRZRrJU_.js} +1 -1
- package/dist/public/assets/module-BAQaY56j.js +1 -0
- package/dist/public/assets/module-DxRGg3ED.js +1947 -0
- package/dist/public/assets/{monaco-CwCjTWAO.js → monaco-D1d6MOPe.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-dYb4P9eU.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-XhCpv6BX.js → pegDiagram-FD4XPPHP-DcGr3Tbk.js} +1 -1
- package/dist/public/assets/pie-XZMESJXO-CIompBnc.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-DUVzuXUd.js → pieDiagram-J4AKIIQI-GF7pu6ch.js} +1 -1
- package/dist/public/assets/{python-DsoF66Sp.js → python-BQbTTTT5.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-Ddobf0z0.js → quadrantDiagram-XTYBLID2-D-bcu7Ey.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-DiJl7BtK.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-B5cRBukM.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-DkrNo-Gf.js → railroad-abnf-LNEFI6M7-BiBHsI-K.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-DaB7gY8P.js → railroad-ebnf-DWYD2UWJ-zKjrfkHs.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-D_QG87QV.js → railroad-peg-JR7BVNR7-DKuVn0GT.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-x-nUoBjv.js → railroadDiagram-MRQ6NCDL-Cyn-16mJ.js} +1 -1
- package/dist/public/assets/{razor-DSrcJyQe.js → razor-DiLk54O0.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-kNNcbsty.js → requirementDiagram-Y7LWUY3S-CwU2EBkW.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-ClC12Odk.js → sankeyDiagram-WGJFYUXA-ajf00HyW.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-DDQITP2g.js → sequenceDiagram-5NDRBG5M-DiX_OIAw.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-N1t_36oh.js → stateDiagram-v2-FJ4FJNEA-CV5bRqB7.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-DSt9fFYE.js → swimlanes-UMQ2AFYF-BGQKSlj7.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-DxXlavVT.js +8 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-CfymOw_s.js → timeline-definition-SEUHKTQE-DhQoApff.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-BOP6mkZC.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-BJxuPMz3.js +1 -0
- package/dist/public/assets/{typescript-J7rF-zX8.js → typescript-COQ1g-up.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-CK_mRc2_.js → usecaseDiagram-AFA6YXN4-CmLFzjie.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-DW8xR6IJ.js → vennDiagram-NNMJR3RB-DOa6JR5K.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-jqlowjVL.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-Css55Zq5.js → wardleyDiagram-S7YFUSEH-BV7EEShp.js} +1 -1
- package/dist/public/assets/{xml-CJeviG_a.js → xml-BbvtjuaG.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-BnhK9cFS.js → xychartDiagram-GGNKY7IX-DtMpPbsq.js} +1 -1
- package/dist/public/assets/{yaml-Gw3uo6rF.js → yaml-Bw8NFga9.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/launch.svg +46 -42
- package/dist/serve/index.mjs +1367 -560
- package/package.json +25 -25
- package/dist/pi/dist/bundle/chunks/anthropic-messages-BWGCKOF4.js +0 -6
- package/dist/pi/dist/bundle/chunks/chunk-44DLKSKE.js +0 -1232
- package/dist/pi/dist/bundle/chunks/chunk-62VOPMLK.js +0 -65
- package/dist/pi/dist/bundle/chunks/chunk-7O7QKK6A.js +0 -2
- package/dist/pi/dist/bundle/chunks/chunk-CHWNPHIS.js +0 -82
- package/dist/pi/dist/bundle/chunks/chunk-NL4X6LBY.js +0 -4
- package/dist/pi/dist/bundle/chunks/chunk-NZY7EIPA.js +0 -4
- package/dist/pi/dist/bundle/chunks/chunk-R2EGYMOO.js +0 -7
- package/dist/pi/dist/bundle/chunks/chunk-UKVNB6C4.js +0 -2
- package/dist/pi/dist/bundle/chunks/chunk-USJZMAIR.js +0 -2
- package/dist/pi/dist/bundle/chunks/chunk-VOLAXWGI.js +0 -2
- package/dist/pi/dist/bundle/chunks/openai-codex-responses-QAWLOQSN.js +0 -10
- package/dist/pi/dist/bundle/chunks/openai-responses-MD3562FB.js +0 -4
- package/dist/pi/dist/bundle/chunks/virtual-modules-O76XM3OB.js +0 -2
- package/dist/public/assets/browser-DAv3ly6M.js +0 -12
- package/dist/public/assets/cynefin-EF2NZ3EQ-CW_93VVD.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-BRowRdve.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-BGmojXlx.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-CRRVgGj2.js +0 -1
- package/dist/public/assets/module-1nDbf1AK.js +0 -1761
- package/dist/public/assets/module-BkKfSTDV.js +0 -1
- package/dist/public/assets/packet-JDAUHWVQ-DUlqTCWQ.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-2RgP4ScO.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-Dap8k-yH.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-Ds10NBze.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-BHAN4SQO.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-f1hLUBjI.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-_NPRpuUC.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-CLBqtefx.js +0 -1
|
@@ -40,6 +40,14 @@ var EN = {
|
|
|
40
40
|
placeholder: "Describe the extension, for example: a pomodoro timer beside the conversation",
|
|
41
41
|
makePrompt: "Make an extension: {text}",
|
|
42
42
|
changePrompt: "Change the extension {name} (in {root}): {text}",
|
|
43
|
+
fromChat: "Make an extension",
|
|
44
|
+
fromChatDetail: "Of what this conversation did",
|
|
45
|
+
fromChatAsk: "Make what this conversation did an extension, to do it again in a click",
|
|
46
|
+
fromChatModel: "In a new conversation, on {model}",
|
|
47
|
+
settingsTitle: "Making extensions",
|
|
48
|
+
modelLabel: "Model",
|
|
49
|
+
modelHint: "The new conversations that make or change an extension use it (the Extensions page, Make an extension of a scheduled task, and of a conversation, which then goes on in a copy of it); unset, the default model",
|
|
50
|
+
modelFailed: "The model for making extensions ({model}) cannot be used, so the default one is: {message}",
|
|
43
51
|
changeTitle: "Change {name}",
|
|
44
52
|
changePlaceholder: "What should it do differently?",
|
|
45
53
|
mine: "Yours",
|
|
@@ -89,6 +97,7 @@ var EN = {
|
|
|
89
97
|
change: "Change",
|
|
90
98
|
remove: "Remove",
|
|
91
99
|
copySource: "Copy the source",
|
|
100
|
+
more: "More",
|
|
92
101
|
copied: "Copied {source}",
|
|
93
102
|
removeTitle: "Remove {name}?",
|
|
94
103
|
removeDetail: "Its pages, cards and commands go with it.",
|
|
@@ -160,6 +169,14 @@ var ZH = {
|
|
|
160
169
|
placeholder: "描述你想要的扩展,例如:在对话旁放一个番茄钟",
|
|
161
170
|
makePrompt: "做一个扩展:{text}",
|
|
162
171
|
changePrompt: "修改扩展 {name}(在 {root}):{text}",
|
|
172
|
+
fromChat: "做成扩展",
|
|
173
|
+
fromChatDetail: "把这次对话做成工具",
|
|
174
|
+
fromChatAsk: "把这次对话做的事做成扩展,以后一键就能再用",
|
|
175
|
+
fromChatModel: "用 {model} 在新对话里做",
|
|
176
|
+
settingsTitle: "做扩展",
|
|
177
|
+
modelLabel: "模型",
|
|
178
|
+
modelHint: "扩展页和各处“做成扩展”开的对话用这个模型;不选就跟随默认模型",
|
|
179
|
+
modelFailed: "做扩展的模型({model})现在用不了,已改用默认模型:{message}",
|
|
163
180
|
changeTitle: "修改 {name}",
|
|
164
181
|
changePlaceholder: "想让它有什么不同?",
|
|
165
182
|
mine: "我的扩展",
|
|
@@ -209,6 +226,7 @@ var ZH = {
|
|
|
209
226
|
change: "修改",
|
|
210
227
|
remove: "移除",
|
|
211
228
|
copySource: "复制来源",
|
|
229
|
+
more: "更多",
|
|
212
230
|
copied: "已复制 {source}",
|
|
213
231
|
removeTitle: "移除扩展 {name}?",
|
|
214
232
|
removeDetail: "它的页面、卡片和命令也会一起移除。",
|
|
@@ -270,6 +288,36 @@ var ExtensionWords;
|
|
|
270
288
|
ExtensionWords.fill = fill;
|
|
271
289
|
})(ExtensionWords ||= {});
|
|
272
290
|
|
|
291
|
+
// web-src/make-model.ts
|
|
292
|
+
var MAKE_MODEL_KEY = "makeModel";
|
|
293
|
+
var MakeModel;
|
|
294
|
+
((MakeModel) => {
|
|
295
|
+
async function get(pi) {
|
|
296
|
+
const value = await pi.storage.get(MAKE_MODEL_KEY).catch(() => {
|
|
297
|
+
return;
|
|
298
|
+
});
|
|
299
|
+
return typeof value === "string" && value ? value : undefined;
|
|
300
|
+
}
|
|
301
|
+
MakeModel.get = get;
|
|
302
|
+
function set(pi, model) {
|
|
303
|
+
return pi.storage.set(MAKE_MODEL_KEY, model || null);
|
|
304
|
+
}
|
|
305
|
+
MakeModel.set = set;
|
|
306
|
+
async function open(pi, options) {
|
|
307
|
+
const model = await get(pi);
|
|
308
|
+
if (model) {
|
|
309
|
+
try {
|
|
310
|
+
return (await pi.server.openSession({ ...options, model })).sessionId;
|
|
311
|
+
} catch (error) {
|
|
312
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
313
|
+
pi.ui.notify(ExtensionWords.fill(ExtensionWords.of(pi.ui.language).modelFailed, { model, message }), "warning");
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return (await pi.server.openSession(options)).sessionId;
|
|
317
|
+
}
|
|
318
|
+
MakeModel.open = open;
|
|
319
|
+
})(MakeModel ||= {});
|
|
320
|
+
|
|
273
321
|
// web-src/actions.ts
|
|
274
322
|
class PackagesStore {
|
|
275
323
|
pi;
|
|
@@ -434,7 +482,7 @@ class ExtensionActions {
|
|
|
434
482
|
async converse(text) {
|
|
435
483
|
await this.guard(async () => {
|
|
436
484
|
const { cwd } = await this.pi.server.getServerInfo();
|
|
437
|
-
const
|
|
485
|
+
const sessionId = await MakeModel.open(this.pi, { cwd });
|
|
438
486
|
await this.pi.switchSession(sessionId);
|
|
439
487
|
await this.pi.sendUserMessage(text);
|
|
440
488
|
});
|
|
@@ -450,6 +498,86 @@ class ExtensionActions {
|
|
|
450
498
|
}
|
|
451
499
|
}
|
|
452
500
|
|
|
501
|
+
// web-src/context.ts
|
|
502
|
+
function icon(pi, name, fallback = "Square") {
|
|
503
|
+
return pi.ui.icons[name] ?? pi.ui.icons[fallback] ?? (() => null);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// web-src/react.ts
|
|
507
|
+
var React;
|
|
508
|
+
function bind(react) {
|
|
509
|
+
React = react;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// web-src/composer.tsx
|
|
513
|
+
var ConversationExtension;
|
|
514
|
+
((ConversationExtension) => {
|
|
515
|
+
ConversationExtension.CONTEXT = [
|
|
516
|
+
"The user wants what was done in this conversation made into an extension of Ta, with the ta-package skill, kept in extensions/: a tool that does it again without it being explained again.",
|
|
517
|
+
"- Look back over the conversation for what is worth keeping: the task, the steps that worked, the inputs that change from one time to the next, and what came out.",
|
|
518
|
+
"- The inputs become a form or a few buttons, the steps a command or a tool of its pi extension (or a prompt it sends), and the results a view that suits them: a page, a card of the board, or the view of a message, rather than plain text.",
|
|
519
|
+
"- Leave out what was only tried and dropped. When the conversation holds nothing to make a tool of, say so and ask what the extension should do."
|
|
520
|
+
].join(`
|
|
521
|
+
`);
|
|
522
|
+
function message(language) {
|
|
523
|
+
return `<context>
|
|
524
|
+
${ConversationExtension.CONTEXT}
|
|
525
|
+
</context>
|
|
526
|
+
${ExtensionWords.of(language).fromChatAsk}`;
|
|
527
|
+
}
|
|
528
|
+
ConversationExtension.message = message;
|
|
529
|
+
})(ConversationExtension ||= {});
|
|
530
|
+
function composerAddon(pi) {
|
|
531
|
+
let model;
|
|
532
|
+
const listeners = new Set;
|
|
533
|
+
const read = () => void MakeModel.get(pi).then((next) => {
|
|
534
|
+
if (next !== model) {
|
|
535
|
+
model = next;
|
|
536
|
+
for (const listener of listeners) {
|
|
537
|
+
listener();
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
read();
|
|
542
|
+
pi.storage.onChange((keys) => keys.includes(MAKE_MODEL_KEY) && read());
|
|
543
|
+
const failed = (error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
544
|
+
const ask = () => ({ clientMessageId: `ta-extensions:conversation:${Date.now()}`, message: ConversationExtension.message(pi.ui.language) });
|
|
545
|
+
const send = async (conversation) => {
|
|
546
|
+
if (!await MakeModel.get(pi)) {
|
|
547
|
+
await pi.server.prompt(conversation.sessionId, { ...ask(), streamingBehavior: "followUp" });
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
const cwd = conversation.cwd ?? (await pi.server.getServerInfo()).cwd;
|
|
551
|
+
const { entries } = await pi.server.getEntries(conversation.sessionId);
|
|
552
|
+
const last = entries.at(-1)?.id;
|
|
553
|
+
const { sessionFile } = last ? await pi.server.forkToFile(conversation.sessionId, last, "at") : { sessionFile: undefined };
|
|
554
|
+
const sessionId = MakeModel.open(pi, { cwd, sessionFile });
|
|
555
|
+
await pi.switchSession(sessionId, { title: ExtensionWords.of(pi.ui.language).fromChat, cwd });
|
|
556
|
+
await pi.server.prompt(await sessionId, ask());
|
|
557
|
+
};
|
|
558
|
+
return {
|
|
559
|
+
subscribe: (listener) => {
|
|
560
|
+
listeners.add(listener);
|
|
561
|
+
return () => listeners.delete(listener);
|
|
562
|
+
},
|
|
563
|
+
actions: (conversation) => {
|
|
564
|
+
const words = ExtensionWords.of(pi.ui.language);
|
|
565
|
+
const Sparkles = icon(pi, "Sparkles");
|
|
566
|
+
return [
|
|
567
|
+
{
|
|
568
|
+
key: "make-extension",
|
|
569
|
+
label: words.fromChat,
|
|
570
|
+
detail: model ? ExtensionWords.fill(words.fromChatModel, { model: model.slice(model.indexOf("/") + 1) }) : words.fromChatDetail,
|
|
571
|
+
icon: /* @__PURE__ */ React.createElement(Sparkles, {
|
|
572
|
+
size: 16
|
|
573
|
+
}),
|
|
574
|
+
run: () => void send(conversation).catch(failed)
|
|
575
|
+
}
|
|
576
|
+
];
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
|
|
453
581
|
// web-src/market-store.ts
|
|
454
582
|
class MarketStore {
|
|
455
583
|
pi;
|
|
@@ -672,6 +800,21 @@ var TaLocation;
|
|
|
672
800
|
return name || (remote === null || remote === undefined ? undefined : remote.host) || location;
|
|
673
801
|
}
|
|
674
802
|
TaLocation2.basename = basename;
|
|
803
|
+
function homeRelative(location) {
|
|
804
|
+
var _a;
|
|
805
|
+
const remote = parse(location);
|
|
806
|
+
const path2 = remote ? remote.path ? remote.path.slice(1) : "~" : location;
|
|
807
|
+
const match = /^~(?:[\\/]+(.*))?$/.exec(path2);
|
|
808
|
+
return match ? ((_a = match[1]) !== null && _a !== undefined ? _a : "").replace(/[\\/]+$/, "") : undefined;
|
|
809
|
+
}
|
|
810
|
+
TaLocation2.homeRelative = homeRelative;
|
|
811
|
+
function isAbsolute(location) {
|
|
812
|
+
if (homeRelative(location) !== undefined) {
|
|
813
|
+
return false;
|
|
814
|
+
}
|
|
815
|
+
return isRemote(location) || /^([\\/]|[A-Za-z]:)/.test(location);
|
|
816
|
+
}
|
|
817
|
+
TaLocation2.isAbsolute = isAbsolute;
|
|
675
818
|
function parentPath(path2) {
|
|
676
819
|
const trimmed = path2.replace(/[\\/]+$/, "");
|
|
677
820
|
const at = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
|
|
@@ -738,6 +881,37 @@ ${message}`;
|
|
|
738
881
|
}
|
|
739
882
|
TaMessageContext2.strip = strip;
|
|
740
883
|
})(TaMessageContext || (TaMessageContext = {}));
|
|
884
|
+
var TaImageNote;
|
|
885
|
+
(function(TaImageNote2) {
|
|
886
|
+
const NOTE = /^\[Image: original \d+x\d+, displayed at \d+x\d+\. Multiply coordinates by [\d.]+ to map to original image\.\]$|^\[Image converted from [^\]]+ to [^\]]+\.\]$/;
|
|
887
|
+
function strip(text) {
|
|
888
|
+
const lines = text.split(`
|
|
889
|
+
`);
|
|
890
|
+
const kept = lines.filter((line) => !NOTE.test(line.trim()));
|
|
891
|
+
if (kept.length === lines.length) {
|
|
892
|
+
return text;
|
|
893
|
+
}
|
|
894
|
+
return kept.join(`
|
|
895
|
+
`).replace(/\n+$/, "").replace(/^\n+/, "");
|
|
896
|
+
}
|
|
897
|
+
TaImageNote2.strip = strip;
|
|
898
|
+
})(TaImageNote || (TaImageNote = {}));
|
|
899
|
+
var TaAgentSummary;
|
|
900
|
+
(function(TaAgentSummary2) {
|
|
901
|
+
const START = /^\s*<conversation_history_summary>/;
|
|
902
|
+
const BLOCK = /^\s*<conversation_history_summary>[\s\S]*?(?:<\/conversation_history_summary>\s*|$)/;
|
|
903
|
+
function read(text) {
|
|
904
|
+
if (!START.test(text)) {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
return text.replace(/<\/?(?:conversation_history_summary|summary)>/g, "").replace(/<\/?\w*$/, "").trim();
|
|
908
|
+
}
|
|
909
|
+
TaAgentSummary2.read = read;
|
|
910
|
+
function strip(text) {
|
|
911
|
+
return text.replace(BLOCK, "");
|
|
912
|
+
}
|
|
913
|
+
TaAgentSummary2.strip = strip;
|
|
914
|
+
})(TaAgentSummary || (TaAgentSummary = {}));
|
|
741
915
|
var TaSkillUse;
|
|
742
916
|
(function(TaSkillUse2) {
|
|
743
917
|
const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
|
|
@@ -771,17 +945,6 @@ var TaExcludedFiles;
|
|
|
771
945
|
TaExcludedFiles2.filter = filter;
|
|
772
946
|
})(TaExcludedFiles || (TaExcludedFiles = {}));
|
|
773
947
|
var TA_UPLOAD_PART_BYTES = 4 * 1024 * 1024;
|
|
774
|
-
// web-src/context.ts
|
|
775
|
-
function icon(pi, name, fallback = "Square") {
|
|
776
|
-
return pi.ui.icons[name] ?? pi.ui.icons[fallback] ?? (() => null);
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
// web-src/react.ts
|
|
780
|
-
var React;
|
|
781
|
-
function bind(react) {
|
|
782
|
-
React = react;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
948
|
// web-src/import-dialog.tsx
|
|
786
949
|
function ImportDialog({ pi, actions, onClose }) {
|
|
787
950
|
const words = actions.words;
|
|
@@ -1792,24 +1955,46 @@ function ShareSteps({ pi, actions }) {
|
|
|
1792
1955
|
}
|
|
1793
1956
|
function PackageRow({ pi, actions, pkg }) {
|
|
1794
1957
|
const words = actions.words;
|
|
1958
|
+
const { touch, handheld } = pi.ui.useDevice();
|
|
1959
|
+
const [menu, openMenu] = pi.ui.useContextMenu();
|
|
1795
1960
|
const mine = pkg.origin === "directory";
|
|
1796
1961
|
const Icon = icon(pi, pkg.icon ?? (mine ? "Puzzle" : "PackageOpen"), mine ? "Puzzle" : "PackageOpen");
|
|
1962
|
+
const More = icon(pi, "Ellipsis");
|
|
1797
1963
|
const title = TaPackageTextUtil.pick(pkg.title, pi.ui.language) ?? pkg.name;
|
|
1798
1964
|
const summary = TaPackageTextUtil.pick(pkg.summary, pi.ui.language) ?? pkg.description;
|
|
1799
1965
|
const tags = [...pkg.resources.map((type) => words.kinds[type]), ...pkg.scope === "project" ? [words.project] : []];
|
|
1800
1966
|
const share = () => pi.ui.shareExtension({ title, source: mine ? undefined : pkg.source, packageId: pkg.id });
|
|
1967
|
+
const remove = { key: "remove", label: words.remove, icon: "Trash2", danger: true, run: () => actions.remove(pkg) };
|
|
1801
1968
|
const buttons = mine ? [
|
|
1802
1969
|
{ key: "change", label: words.change, icon: "Pencil", run: () => actions.change(pkg) },
|
|
1803
1970
|
{ key: "export", label: words.export, icon: "Download", run: () => actions.exportPackage(pkg) },
|
|
1804
1971
|
{ key: "share", label: words.share, icon: "QrCode", run: async () => share() },
|
|
1805
|
-
|
|
1972
|
+
remove
|
|
1806
1973
|
] : [
|
|
1807
1974
|
{ key: "copy", label: words.copySource, icon: "Copy", run: () => actions.copySource(pkg) },
|
|
1808
1975
|
{ key: "share", label: words.share, icon: "QrCode", run: async () => share() },
|
|
1809
|
-
|
|
1976
|
+
remove
|
|
1810
1977
|
];
|
|
1811
|
-
|
|
1812
|
-
|
|
1978
|
+
const item = (button) => ({
|
|
1979
|
+
key: button.key,
|
|
1980
|
+
label: button.label,
|
|
1981
|
+
icon: icon(pi, button.icon),
|
|
1982
|
+
danger: button.danger,
|
|
1983
|
+
run: () => void button.run()
|
|
1984
|
+
});
|
|
1985
|
+
const items = [buttons.filter((button) => button !== remove).map(item), [item(remove)]];
|
|
1986
|
+
const tagList = tags.map((tag) => /* @__PURE__ */ React.createElement("span", {
|
|
1987
|
+
key: tag,
|
|
1988
|
+
className: "tax-tag"
|
|
1989
|
+
}, tag));
|
|
1990
|
+
const description = summary || (mine ? undefined : pkg.source);
|
|
1991
|
+
const SwipeRow = pi.ui.SwipeRow;
|
|
1992
|
+
return /* @__PURE__ */ React.createElement(SwipeRow, {
|
|
1993
|
+
className: "tax-item",
|
|
1994
|
+
actions: [{ key: "remove", label: words.remove, danger: true, run: () => void remove.run() }]
|
|
1995
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1996
|
+
className: `tax-row${pkg.enabled ? "" : " tax-off"}`,
|
|
1997
|
+
onContextMenu: (event) => openMenu(event, items)
|
|
1813
1998
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
1814
1999
|
className: "tax-icon"
|
|
1815
2000
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
@@ -1822,12 +2007,20 @@ function PackageRow({ pi, actions, pkg }) {
|
|
|
1822
2007
|
title: title === pkg.name ? undefined : pkg.name
|
|
1823
2008
|
}, title), pkg.version && /* @__PURE__ */ React.createElement("span", {
|
|
1824
2009
|
className: "tax-version"
|
|
1825
|
-
}, pkg.version), tags.
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
}, tag))), (summary || !mine) && /* @__PURE__ */ React.createElement("div", {
|
|
2010
|
+
}, pkg.version), !handheld && tagList), (description || handheld && tags.length > 0) && /* @__PURE__ */ React.createElement("div", {
|
|
2011
|
+
className: "tax-meta"
|
|
2012
|
+
}, handheld && tagList, description && /* @__PURE__ */ React.createElement("span", {
|
|
1829
2013
|
className: "tax-description"
|
|
1830
|
-
},
|
|
2014
|
+
}, description))), touch ? /* @__PURE__ */ React.createElement("button", {
|
|
2015
|
+
type: "button",
|
|
2016
|
+
className: "tax-action tax-more",
|
|
2017
|
+
title: words.more,
|
|
2018
|
+
"aria-label": words.more,
|
|
2019
|
+
"aria-haspopup": "menu",
|
|
2020
|
+
onClick: (event) => openMenu(event, items)
|
|
2021
|
+
}, /* @__PURE__ */ React.createElement(More, {
|
|
2022
|
+
size: 17
|
|
2023
|
+
})) : /* @__PURE__ */ React.createElement("div", {
|
|
1831
2024
|
className: "tax-actions"
|
|
1832
2025
|
}, buttons.map((button) => {
|
|
1833
2026
|
const ButtonIcon = icon(pi, button.icon);
|
|
@@ -1849,7 +2042,7 @@ function PackageRow({ pi, actions, pkg }) {
|
|
|
1849
2042
|
"aria-checked": pkg.enabled,
|
|
1850
2043
|
checked: pkg.enabled,
|
|
1851
2044
|
onChange: (event) => void actions.setEnabled(pkg, event.target.checked)
|
|
1852
|
-
}));
|
|
2045
|
+
})), menu);
|
|
1853
2046
|
}
|
|
1854
2047
|
|
|
1855
2048
|
// web-src/search.ts
|
|
@@ -1957,6 +2150,48 @@ function registerSearches(context) {
|
|
|
1957
2150
|
});
|
|
1958
2151
|
}
|
|
1959
2152
|
|
|
2153
|
+
// web-src/settings.tsx
|
|
2154
|
+
function ModelSetting({ pi }) {
|
|
2155
|
+
const [value, setValue] = React.useState("");
|
|
2156
|
+
React.useEffect(() => {
|
|
2157
|
+
let live = true;
|
|
2158
|
+
const read = () => void MakeModel.get(pi).then((model) => live && setValue(model ?? ""));
|
|
2159
|
+
read();
|
|
2160
|
+
const stop = pi.storage.onChange((keys) => keys.includes(MAKE_MODEL_KEY) && read());
|
|
2161
|
+
return () => {
|
|
2162
|
+
live = false;
|
|
2163
|
+
stop();
|
|
2164
|
+
};
|
|
2165
|
+
}, [pi]);
|
|
2166
|
+
const ModelPicker = pi.ui.ModelPicker;
|
|
2167
|
+
return /* @__PURE__ */ React.createElement(ModelPicker, {
|
|
2168
|
+
value,
|
|
2169
|
+
label: ExtensionWords.of(pi.ui.language).modelLabel,
|
|
2170
|
+
onChange: (model) => {
|
|
2171
|
+
setValue(model);
|
|
2172
|
+
MakeModel.set(pi, model).catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error"));
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
function makeSettings(pi) {
|
|
2177
|
+
const words = () => ExtensionWords.of(pi.ui.language);
|
|
2178
|
+
return {
|
|
2179
|
+
title: () => words().settingsTitle,
|
|
2180
|
+
icon: icon(pi, "Sparkles", "Puzzle"),
|
|
2181
|
+
rows: [
|
|
2182
|
+
{
|
|
2183
|
+
key: "model",
|
|
2184
|
+
label: () => words().modelLabel,
|
|
2185
|
+
description: () => words().modelHint,
|
|
2186
|
+
stacked: true,
|
|
2187
|
+
render: () => /* @__PURE__ */ React.createElement(ModelSetting, {
|
|
2188
|
+
pi
|
|
2189
|
+
})
|
|
2190
|
+
}
|
|
2191
|
+
]
|
|
2192
|
+
};
|
|
2193
|
+
}
|
|
2194
|
+
|
|
1960
2195
|
// web-src/signal.ts
|
|
1961
2196
|
class Signal {
|
|
1962
2197
|
value;
|
|
@@ -2095,9 +2330,9 @@ var STYLE = `
|
|
|
2095
2330
|
.tax-button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--ta-border-muted); border-radius: 8px; background: var(--ta-raised); color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); cursor: pointer; transition: background 120ms, border-color 120ms; }
|
|
2096
2331
|
.tax-button:hover { background: var(--ta-hover); border-color: var(--ta-border); }
|
|
2097
2332
|
.tax-button:disabled { opacity: .55; cursor: default; }
|
|
2098
|
-
.tax-list { border: 1px solid var(--ta-border-muted); border-radius: 12px; overflow: hidden; }
|
|
2333
|
+
.tax-list { --ta-swipe-bg: var(--ta-main); border: 1px solid var(--ta-border-muted); border-radius: 12px; overflow: hidden; }
|
|
2099
2334
|
.tax-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
|
|
2100
|
-
.tax-
|
|
2335
|
+
.tax-item + .tax-item { border-top: 1px solid var(--ta-border-muted); }
|
|
2101
2336
|
.tax-row:hover { background: var(--ta-hover); }
|
|
2102
2337
|
.tax-row:hover .tax-icon, .tax-row:hover .tax-tag { background: var(--ta-hover-strong); }
|
|
2103
2338
|
.tax-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--ta-chip); color: var(--tax-accent); transition: color 160ms; }
|
|
@@ -2105,16 +2340,22 @@ var STYLE = `
|
|
|
2105
2340
|
.tax-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
|
|
2106
2341
|
.tax-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2107
2342
|
.tax-version { flex: none; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); font-weight: 400; }
|
|
2108
|
-
.tax-
|
|
2343
|
+
.tax-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
2344
|
+
.tax-description { flex: 1; min-width: 0; overflow: hidden; color: var(--ta-secondary); font-size: calc(12.5px * var(--ta-font-scale)); text-overflow: ellipsis; white-space: nowrap; }
|
|
2109
2345
|
.tax-tag { flex: none; padding: 0 6px; border-radius: 5px; background: var(--ta-chip); color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); font-weight: 400; line-height: calc(17px * var(--ta-font-scale)); }
|
|
2110
2346
|
.tax-off .tax-main { opacity: .5; }
|
|
2111
2347
|
.tax-off .tax-icon { color: var(--ta-muted); }
|
|
2112
2348
|
.tax-actions { display: flex; gap: 2px; flex: none; opacity: 0; transition: opacity 120ms; }
|
|
2113
2349
|
.tax-row:hover .tax-actions, .tax-row:focus-within .tax-actions { opacity: 1; }
|
|
2114
|
-
@media (hover: none) { .tax-actions { opacity: 1; } }
|
|
2115
2350
|
.tax-action { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--ta-muted); cursor: pointer; }
|
|
2116
2351
|
.tax-action:hover { background: var(--ta-hover-strong); color: var(--ta-text); }
|
|
2117
2352
|
.tax-action.tax-danger:hover { color: var(--ta-red); }
|
|
2353
|
+
/* A finger: one … for the menu instead of a row of icons, and a target of a finger's size */
|
|
2354
|
+
.tax-more { flex: none; width: 36px; height: 36px; margin-right: -4px; }
|
|
2355
|
+
:root[data-handheld] .tax-body { gap: 24px; padding: 16px 12px 40px; }
|
|
2356
|
+
:root[data-handheld] .tax-row { gap: 10px; padding: 10px 12px; }
|
|
2357
|
+
:root[data-handheld] .tax-steps { gap: 4px; }
|
|
2358
|
+
:root[data-handheld] .tax-step { flex: 1; width: auto; min-width: 0; }
|
|
2118
2359
|
.tax-switch { appearance: none; -webkit-appearance: none; position: relative; width: 36px; height: 20px; flex: none; margin: 0 0 0 4px; border-radius: 10px; background: var(--ta-hover-strong); cursor: pointer; transition: background 160ms; }
|
|
2119
2360
|
.tax-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform 180ms var(--ta-ease); }
|
|
2120
2361
|
.tax-switch:checked { background: var(--ta-green); }
|
|
@@ -2184,6 +2425,8 @@ function activate(pi) {
|
|
|
2184
2425
|
order: 90
|
|
2185
2426
|
});
|
|
2186
2427
|
registerSearches(context);
|
|
2428
|
+
pi.registerComposerAddon(composerAddon(pi));
|
|
2429
|
+
pi.registerSettings(makeSettings(pi));
|
|
2187
2430
|
pi.on("agent_end", () => void store.load());
|
|
2188
2431
|
return removeStyle;
|
|
2189
2432
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-launcher",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "A pi package for Ta: what a phone pulls down over its first tab (a button of the rail elsewhere), the pages used lately and those kept in Mine, opened without installing too",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -13,7 +13,7 @@ A pi package that comes with Ta: the workspace of the conversation shown, in the
|
|
|
13
13
|
|
|
14
14
|
Each view is a `panel` view of its web extension, opened from the `+` of the workbench or its empty state (`pi.web` of `package.json`); the work runs on the server through `pi.workspace` (`listDirectory`, `readFile`, `writeFile`, `uploadFile`, `fileUrl`, `runCommand`, …) and `pi.terminals`, in the execution environment of the directory, so a remote `ta exec-server` works the same. Search, source control and the changes to files are this package's: it runs `rg` (or `git grep`, or `grep`), `git`, `mkdir`, `mv -n` and `rm` with `runCommand` and reads their output; paths go to git as `:(literal)` pathspecs. Paths may not leave the directory. What the agent changes with its tools shows at once.
|
|
15
15
|
|
|
16
|
-
Files open in Monaco, which the page brings (`pi.ui.CodeEditor`, bundled with Ta, no network); Markdown, HTML, SVG open as a preview first, with Edit beside Preview. Previews load the file from `TaWorkspaceServer.fileUrl`: a page runs sandboxed in an origin of its own, Markdown (rendered with marked, bundled in) runs no scripts, and both load the files beside them with relative URLs. Diffs open in Monaco's diff editor (`pi.ui.DiffEditor`), terminals are xterm.js, as in VS Code (`pi.ui.createTerminal`: drawn with WebGL, in the theme of the page; Cmd or Ctrl + click opens the URLs and the paths of files they print, at the line a compiler or grep names). The file icons are the Seti icons VS Code shows by default (font and map from `extensions/theme-seti` of microsoft/vscode, MIT; `bun scripts/seti.ts` writes them again into `web-src/util/seti*.ts`). With `script` on the server a shell gets a pseudo-terminal; without it, it runs on pipes and the server echoes and edits the line.
|
|
16
|
+
Files open in Monaco, which the page brings (`pi.ui.CodeEditor`, bundled with Ta, no network); Markdown, HTML, SVG open as a preview first, with Edit beside Preview. Previews load the file from `TaWorkspaceServer.fileUrl`: a page runs sandboxed in an origin of its own (`PAGE_SANDBOX`, never `allow-same-origin`), Markdown (rendered with marked, bundled in) runs no scripts, and both load the files beside them with relative URLs. Where the page is not served by ta serve — the app on a phone, a page through a relay — that URL is not there to load: pictures, videos, sounds and PDFs come as the bytes of `pi.files` in a `blob:` URL, and an HTML page is shown from the text of the file in a frame under a policy that reaches nothing (`PAGE_CSP`), so the css, js and pictures it loads by relative path do not come and a self-contained report shows as it is. Diffs open in Monaco's diff editor (`pi.ui.DiffEditor`), terminals are xterm.js, as in VS Code (`pi.ui.createTerminal`: drawn with WebGL, in the theme of the page; Cmd or Ctrl + click opens the URLs and the paths of files they print, at the line a compiler or grep names). The file icons are the Seti icons VS Code shows by default (font and map from `extensions/theme-seti` of microsoft/vscode, MIT; `bun scripts/seti.ts` writes them again into `web-src/util/seti*.ts`). With `script` on the server a shell gets a pseudo-terminal; without it, it runs on pipes and the server echoes and edits the line.
|
|
17
17
|
|
|
18
18
|
Links of replies open here (`pi.registerOpener`): a file as its tab, with the lines the link names selected (`src/a.ts#L10-L20`, `src/a.ts:10:5`), even a file open with changes, which keeps them; a directory in the explorer, which switches to it; a page in the browser. Cmd or Ctrl + click opens a page in the browser of the system instead, which Ta does itself.
|
|
19
19
|
|
|
@@ -13,7 +13,7 @@ Ta 自带的 pi 包:`ta serve` 的 web 客户端中会话的工作区,以 ID
|
|
|
13
13
|
|
|
14
14
|
每个视图是其 web 扩展的 `panel` 视图,从工作台的 `+` 或其空状态打开(`pi.web` 的 `package.json`);工作通过 `pi.workspace`(`listDirectory`、`readFile`、`writeFile`、`uploadFile`、`fileUrl`、`runCommand` 等)和 `pi.terminals` 在目录的执行环境上运行,所以远程 `ta exec-server` 一样工作。搜索、源代码管理和对文件的更改是此包的:它用 `runCommand` 运行 `rg`(或 `git grep`,或 `grep`)、`git`、`mkdir`、`mv -n` 和 `rm` 并读取其输出;路径作为 `:(literal)` pathspec 传递给 git。路径不能离开目录。agent 用其工具所做的更改立即显示。
|
|
15
15
|
|
|
16
|
-
文件在 Monaco 中打开,页面带来(`pi.ui.CodeEditor`,与 Ta 打包,无网络);Markdown、HTML、SVG 首先作为预览打开,旁边有编辑。预览从 `TaWorkspaceServer.fileUrl`
|
|
16
|
+
文件在 Monaco 中打开,页面带来(`pi.ui.CodeEditor`,与 Ta 打包,无网络);Markdown、HTML、SVG 首先作为预览打开,旁边有编辑。预览从 `TaWorkspaceServer.fileUrl` 加载文件:页面在自己的源里沙箱化(`PAGE_SANDBOX`,绝不含 `allow-same-origin`),Markdown(用 marked 呈现,打包在)不运行脚本,两个都用相对 URL 加载其旁边的文件。页面不是由 ta serve 提供时——手机应用、经中继打开的页面——这个地址在页面里加载不到:图片、视频、声音和 PDF 用 `pi.files` 取字节做成 `blob:` 地址,HTML 页面按文件文本放进一个够不到任何东西的沙框里显示(`PAGE_CSP`),所以用相对路径加载的 css、js、图片不会来,自包含的报告页照原样显示。Diff 在 Monaco 的 diff 编辑器中打开(`pi.ui.DiffEditor`),终端是 xterm.js,与 VS Code 相同(`pi.ui.createTerminal`:WebGL 绘制,跟随页面主题;输出里的 URL 和文件路径按 Cmd 或 Ctrl + 点击打开,定位到编译器或 grep 给出的行)。文件图标是 VS Code 默认显示的 Seti 图标(字体和地图来自 microsoft/vscode 的 `extensions/theme-seti`,MIT;`bun scripts/seti.ts` 将它们再次写入 `web-src/util/seti*.ts`)。在服务器上用 `script` 时,shell 获得伪终端;没有它,它在管道上运行,服务器回显并编辑线。
|
|
17
17
|
|
|
18
18
|
回复的链接在这里打开(`pi.registerOpener`):文件作为其标签页,链接名称选中的行(`src/a.ts#L10-L20`、`src/a.ts:10:5`),甚至文件打开有更改,这保留它们;资源管理器中的目录,切换到它;浏览器中的页面。Cmd 或 Ctrl + 单击在系统的浏览器中打开页面,Ta 自己做。
|
|
19
19
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bytes of a file of the workspace as a URL the page can load, for what a page cannot load by its own
|
|
3
|
+
* URL: over a relay, and in the app on a phone, only the calls on the WebSocket reach ta serve (pi.files).
|
|
4
|
+
* The URL is made again when the file may have changed, and let go of when it is not shown.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFileBytesUrl(url: string | undefined, version: number): {
|
|
7
|
+
url?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
error?: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFileBytesUrl = useFileBytesUrl;
|
|
4
|
+
const host_1 = require("./host");
|
|
5
|
+
const react_1 = require("./react");
|
|
6
|
+
/**
|
|
7
|
+
* The bytes of a file of the workspace as a URL the page can load, for what a page cannot load by its own
|
|
8
|
+
* URL: over a relay, and in the app on a phone, only the calls on the WebSocket reach ta serve (pi.files).
|
|
9
|
+
* The URL is made again when the file may have changed, and let go of when it is not shown.
|
|
10
|
+
*/
|
|
11
|
+
function useFileBytesUrl(url, version) {
|
|
12
|
+
const [state, setState] = react_1.React.useState({});
|
|
13
|
+
react_1.React.useEffect(() => {
|
|
14
|
+
if (!url) {
|
|
15
|
+
setState({});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let live = true;
|
|
19
|
+
let made;
|
|
20
|
+
host_1.pi.files.read(url).then(file => {
|
|
21
|
+
if (!live) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
made = URL.createObjectURL(new Blob([file.data], { type: file.type }));
|
|
25
|
+
setState({ url: made, size: file.size });
|
|
26
|
+
}, error => {
|
|
27
|
+
if (live) {
|
|
28
|
+
setState({ error: host_1.Host.message(error) });
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
live = false;
|
|
33
|
+
if (made) {
|
|
34
|
+
URL.revokeObjectURL(made);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, [url, version]);
|
|
38
|
+
return state;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -34,7 +34,8 @@ export type MenuItem = '-' | {
|
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* A context menu at the pointer, as an IDE's: arrows move, Enter runs, Escape or a click elsewhere
|
|
37
|
-
* closes. `open` takes the event of a right click (or of a button that opens it) and the entries.
|
|
37
|
+
* closes. `open` takes the event of a right click (or of a button that opens it) and the entries. Under a
|
|
38
|
+
* finger it goes and takes the finger as the menus of the page do (ui.attachMenu).
|
|
38
39
|
*/
|
|
39
40
|
export declare function useContextMenu(): [React.ReactNode, (event: React.MouseEvent | React.KeyboardEvent, items: MenuItem[]) => void];
|
|
40
41
|
/**
|
|
@@ -69,7 +69,8 @@ function useKept(store, key, initial) {
|
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* A context menu at the pointer, as an IDE's: arrows move, Enter runs, Escape or a click elsewhere
|
|
72
|
-
* closes. `open` takes the event of a right click (or of a button that opens it) and the entries.
|
|
72
|
+
* closes. `open` takes the event of a right click (or of a button that opens it) and the entries. Under a
|
|
73
|
+
* finger it goes and takes the finger as the menus of the page do (ui.attachMenu).
|
|
73
74
|
*/
|
|
74
75
|
function useContextMenu() {
|
|
75
76
|
const [menu, setMenu] = react_1.React.useState();
|
|
@@ -79,48 +80,25 @@ function useContextMenu() {
|
|
|
79
80
|
const target = event.currentTarget;
|
|
80
81
|
const box = target.getBoundingClientRect();
|
|
81
82
|
const pointer = 'clientX' in event && (event.clientX || event.clientY);
|
|
82
|
-
setMenu({ x:
|
|
83
|
+
setMenu(pointer ? { x: event.clientX, y: event.clientY, around: { top: box.top, bottom: box.bottom }, items } : { x: box.left + 16, y: box.bottom, items });
|
|
83
84
|
}, []);
|
|
84
|
-
const
|
|
85
|
+
const close = react_1.React.useCallback(() => setMenu(undefined), []);
|
|
86
|
+
const element = menu ? react_1.React.createElement(ContextMenu, { ...menu, onClose: close }) : null;
|
|
85
87
|
return [element, open];
|
|
86
88
|
}
|
|
87
|
-
|
|
88
|
-
function safeAreaTop(element) {
|
|
89
|
-
const probe = document.createElement('div');
|
|
90
|
-
probe.style.cssText = 'position:fixed;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top)';
|
|
91
|
-
element.appendChild(probe);
|
|
92
|
-
const top = Number.parseFloat(getComputedStyle(probe).paddingTop) || 0;
|
|
93
|
-
probe.remove();
|
|
94
|
-
return top;
|
|
95
|
-
}
|
|
96
|
-
function ContextMenu({ x, y, items, onClose }) {
|
|
89
|
+
function ContextMenu({ x, y, around, items, onClose }) {
|
|
97
90
|
const root = react_1.React.useRef(null);
|
|
98
|
-
// Measured where it has the whole width, not squeezed against the edge it may open by; then placed.
|
|
99
|
-
const [place, setPlace] = react_1.React.useState({ left: 0, top: 0, ready: false });
|
|
100
91
|
react_1.React.useLayoutEffect(() => {
|
|
101
|
-
var _a
|
|
92
|
+
var _a;
|
|
102
93
|
const element = root.current;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (box) {
|
|
106
|
-
const clamp = (value, max) => Math.max(4, Math.min(value, max - 4));
|
|
107
|
-
// A finger (the page's data-touch): above it and centred, so that it does not cover the menu it opened.
|
|
108
|
-
const touch = document.documentElement.dataset.touch !== undefined;
|
|
109
|
-
// Not under the status bar of a phone (env(safe-area-inset-top), read through the menu's own padding).
|
|
110
|
-
const safeTop = touch ? safeAreaTop(element) : 0;
|
|
111
|
-
const above = y - 14 - box.height;
|
|
112
|
-
const left = touch ? clamp(x - box.width / 2, window.innerWidth - box.width) : clamp(x, window.innerWidth - box.width);
|
|
113
|
-
const top = touch
|
|
114
|
-
? above >= safeTop + 4
|
|
115
|
-
? above
|
|
116
|
-
: clamp(y + 14, window.innerHeight - box.height)
|
|
117
|
-
: y + box.height > window.innerHeight - 4
|
|
118
|
-
? Math.max(4, y - box.height)
|
|
119
|
-
: y;
|
|
120
|
-
setPlace({ left, top, ready: true });
|
|
94
|
+
if (!element) {
|
|
95
|
+
return;
|
|
121
96
|
}
|
|
122
|
-
|
|
123
|
-
|
|
97
|
+
// Measured where it has the whole width (at 0, 0), not squeezed against the edge it may open by; then placed.
|
|
98
|
+
const stop = host_1.pi.ui.attachMenu(element, { x, y, around }, onClose);
|
|
99
|
+
(_a = element.querySelector('button:not(:disabled)')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
100
|
+
return stop;
|
|
101
|
+
}, [x, y, around, onClose]);
|
|
124
102
|
react_1.React.useEffect(() => {
|
|
125
103
|
const close = (event) => {
|
|
126
104
|
var _a;
|
|
@@ -151,7 +129,7 @@ function ContextMenu({ x, y, items, onClose }) {
|
|
|
151
129
|
const at = buttons.indexOf(document.activeElement);
|
|
152
130
|
(_b = buttons[(at + (event.key === 'ArrowDown' ? 1 : buttons.length - 1)) % buttons.length]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
153
131
|
};
|
|
154
|
-
return (react_1.React.createElement("div", { ref: root, className: "taw-menu", role: "menu",
|
|
132
|
+
return (react_1.React.createElement("div", { ref: root, className: "taw-menu", role: "menu", onKeyDown: onKeyDown, onContextMenu: event => event.preventDefault() }, items.map((item, index) => item === '-' ? (react_1.React.createElement("hr", { key: `-${index}`, className: "taw-menu-line" })) : (react_1.React.createElement("button", { key: item.label, type: "button", role: "menuitem", className: "taw-menu-item", disabled: item.disabled, onClick: () => {
|
|
155
133
|
onClose();
|
|
156
134
|
item.run();
|
|
157
135
|
} },
|