@celljs/ta 4.5.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -23
- package/dist/cli.mjs +1634 -50
- package/dist/pi/CHANGELOG.md +22 -0
- package/dist/pi/dist/bundle/chunks/chunk-44DLKSKE.js +14 -14
- package/dist/pi/dist/bundle/chunks/openai-chatgpt.js +1 -1
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-channels/README.md +48 -0
- package/dist/pi/packages/ta-channels/extension/index.mjs +651 -0
- package/dist/pi/packages/ta-channels/host/index.mjs +921 -0
- package/dist/pi/packages/ta-channels/lib/agent-menu.d.ts +13 -0
- package/dist/pi/packages/ta-channels/lib/agent-menu.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/agent-menu.js +177 -0
- package/dist/pi/packages/ta-channels/lib/agent-menu.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/channel-menu.d.ts +12 -0
- package/dist/pi/packages/ta-channels/lib/channel-menu.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/channel-menu.js +93 -0
- package/dist/pi/packages/ta-channels/lib/channel-menu.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/channels-model.d.ts +192 -0
- package/dist/pi/packages/ta-channels/lib/channels-model.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/channels-model.js +49 -0
- package/dist/pi/packages/ta-channels/lib/channels-model.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/channels-util.d.ts +149 -0
- package/dist/pi/packages/ta-channels/lib/channels-util.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/channels-util.js +544 -0
- package/dist/pi/packages/ta-channels/lib/channels-util.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/channels.d.ts +81 -0
- package/dist/pi/packages/ta-channels/lib/channels.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/channels.js +181 -0
- package/dist/pi/packages/ta-channels/lib/channels.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/create.d.ts +19 -0
- package/dist/pi/packages/ta-channels/lib/create.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/create.js +182 -0
- package/dist/pi/packages/ta-channels/lib/create.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/extension.d.ts +19 -0
- package/dist/pi/packages/ta-channels/lib/extension.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/extension.js +77 -0
- package/dist/pi/packages/ta-channels/lib/extension.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/faces.d.ts +17 -0
- package/dist/pi/packages/ta-channels/lib/faces.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/faces.js +169 -0
- package/dist/pi/packages/ta-channels/lib/faces.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-channels/lib/host.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/host.js +14 -0
- package/dist/pi/packages/ta-channels/lib/host.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts +113 -0
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/i18n.js +223 -0
- package/dist/pi/packages/ta-channels/lib/i18n.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-channels/lib/index.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/index.js +84 -0
- package/dist/pi/packages/ta-channels/lib/index.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/members.d.ts +9 -0
- package/dist/pi/packages/ta-channels/lib/members.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/members.js +150 -0
- package/dist/pi/packages/ta-channels/lib/members.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/more-menu.d.ts +19 -0
- package/dist/pi/packages/ta-channels/lib/more-menu.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/more-menu.js +79 -0
- package/dist/pi/packages/ta-channels/lib/more-menu.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-channels/lib/react.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/react.js +8 -0
- package/dist/pi/packages/ta-channels/lib/react.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/room.d.ts +22 -0
- package/dist/pi/packages/ta-channels/lib/room.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/room.js +133 -0
- package/dist/pi/packages/ta-channels/lib/room.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/sidebar.d.ts +10 -0
- package/dist/pi/packages/ta-channels/lib/sidebar.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/sidebar.js +162 -0
- package/dist/pi/packages/ta-channels/lib/sidebar.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/style.d.ts +5 -0
- package/dist/pi/packages/ta-channels/lib/style.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/style.js +252 -0
- package/dist/pi/packages/ta-channels/lib/style.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/team-tools.d.ts +15 -0
- package/dist/pi/packages/ta-channels/lib/team-tools.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/team-tools.js +92 -0
- package/dist/pi/packages/ta-channels/lib/team-tools.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/team.d.ts +134 -0
- package/dist/pi/packages/ta-channels/lib/team.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/team.js +469 -0
- package/dist/pi/packages/ta-channels/lib/team.js.map +1 -0
- package/dist/pi/packages/ta-channels/lib/views.d.ts +93 -0
- package/dist/pi/packages/ta-channels/lib/views.d.ts.map +1 -0
- package/dist/pi/packages/ta-channels/lib/views.js +188 -0
- package/dist/pi/packages/ta-channels/lib/views.js.map +1 -0
- package/dist/pi/packages/ta-channels/package.json +46 -0
- package/dist/pi/packages/ta-channels/web/index.js +3144 -0
- package/dist/pi/packages/ta-extensions/README.md +20 -0
- package/dist/pi/packages/ta-extensions/host/index.mjs +271 -0
- package/dist/pi/packages/ta-extensions/lib/actions.d.ts +42 -0
- package/dist/pi/packages/ta-extensions/lib/actions.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/actions.js +168 -0
- package/dist/pi/packages/ta-extensions/lib/actions.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/archive.d.ts +30 -0
- package/dist/pi/packages/ta-extensions/lib/archive.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/archive.js +213 -0
- package/dist/pi/packages/ta-extensions/lib/archive.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/extensions-util.d.ts +14 -0
- package/dist/pi/packages/ta-extensions/lib/extensions-util.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/extensions-util.js +38 -0
- package/dist/pi/packages/ta-extensions/lib/extensions-util.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/host.d.ts +36 -0
- package/dist/pi/packages/ta-extensions/lib/host.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/host.js +94 -0
- package/dist/pi/packages/ta-extensions/lib/host.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/i18n.d.ts +64 -0
- package/dist/pi/packages/ta-extensions/lib/i18n.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/i18n.js +148 -0
- package/dist/pi/packages/ta-extensions/lib/i18n.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/import-dialog.d.ts +10 -0
- package/dist/pi/packages/ta-extensions/lib/import-dialog.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/import-dialog.js +56 -0
- package/dist/pi/packages/ta-extensions/lib/import-dialog.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-extensions/lib/index.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/index.js +49 -0
- package/dist/pi/packages/ta-extensions/lib/index.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/page.d.ts +22 -0
- package/dist/pi/packages/ta-extensions/lib/page.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/page.js +143 -0
- package/dist/pi/packages/ta-extensions/lib/page.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/pictures.d.ts +6 -0
- package/dist/pi/packages/ta-extensions/lib/pictures.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/pictures.js +62 -0
- package/dist/pi/packages/ta-extensions/lib/pictures.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-extensions/lib/react.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/react.js +8 -0
- package/dist/pi/packages/ta-extensions/lib/react.js.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-extensions/lib/style.d.ts.map +1 -0
- package/dist/pi/packages/ta-extensions/lib/style.js +94 -0
- package/dist/pi/packages/ta-extensions/lib/style.js.map +1 -0
- package/dist/pi/packages/ta-extensions/package.json +46 -0
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +90 -0
- package/dist/pi/packages/ta-extensions/web/index.js +941 -0
- package/dist/pi/packages/ta-workspace/README.md +29 -0
- package/dist/pi/packages/ta-workspace/lib/browser.d.ts +9 -0
- package/dist/pi/packages/ta-workspace/lib/browser.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/browser.js +162 -0
- package/dist/pi/packages/ta-workspace/lib/browser.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/common.d.ts +63 -0
- package/dist/pi/packages/ta-workspace/lib/common.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/common.js +180 -0
- package/dist/pi/packages/ta-workspace/lib/common.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/editors.d.ts +47 -0
- package/dist/pi/packages/ta-workspace/lib/editors.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/editors.js +353 -0
- package/dist/pi/packages/ta-workspace/lib/editors.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/explorer.d.ts +11 -0
- package/dist/pi/packages/ta-workspace/lib/explorer.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/explorer.js +388 -0
- package/dist/pi/packages/ta-workspace/lib/explorer.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/file-icon.d.ts +9 -0
- package/dist/pi/packages/ta-workspace/lib/file-icon.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/file-icon.js +19 -0
- package/dist/pi/packages/ta-workspace/lib/file-icon.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/host.d.ts +41 -0
- package/dist/pi/packages/ta-workspace/lib/host.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/host.js +117 -0
- package/dist/pi/packages/ta-workspace/lib/host.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +158 -0
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/i18n.js +319 -0
- package/dist/pi/packages/ta-workspace/lib/i18n.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-workspace/lib/index.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/index.js +64 -0
- package/dist/pi/packages/ta-workspace/lib/index.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/open-files.d.ts +3 -0
- package/dist/pi/packages/ta-workspace/lib/open-files.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/open-files.js +59 -0
- package/dist/pi/packages/ta-workspace/lib/open-files.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/preview.d.ts +16 -0
- package/dist/pi/packages/ta-workspace/lib/preview.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/preview.js +116 -0
- package/dist/pi/packages/ta-workspace/lib/preview.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/react.d.ts +5 -0
- package/dist/pi/packages/ta-workspace/lib/react.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/react.js +8 -0
- package/dist/pi/packages/ta-workspace/lib/react.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/scm.d.ts +3 -0
- package/dist/pi/packages/ta-workspace/lib/scm.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/scm.js +262 -0
- package/dist/pi/packages/ta-workspace/lib/scm.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/search.d.ts +9 -0
- package/dist/pi/packages/ta-workspace/lib/search.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/search.js +286 -0
- package/dist/pi/packages/ta-workspace/lib/search.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/style.d.ts +5 -0
- package/dist/pi/packages/ta-workspace/lib/style.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/style.js +228 -0
- package/dist/pi/packages/ta-workspace/lib/style.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/terminal.d.ts +24 -0
- package/dist/pi/packages/ta-workspace/lib/terminal.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/terminal.js +283 -0
- package/dist/pi/packages/ta-workspace/lib/terminal.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/ansi.d.ts +72 -0
- package/dist/pi/packages/ta-workspace/lib/util/ansi.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/ansi.js +434 -0
- package/dist/pi/packages/ta-workspace/lib/util/ansi.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/file-icon.d.ts +10 -0
- package/dist/pi/packages/ta-workspace/lib/util/file-icon.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/file-icon.js +28 -0
- package/dist/pi/packages/ta-workspace/lib/util/file-icon.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/git.d.ts +69 -0
- package/dist/pi/packages/ta-workspace/lib/util/git.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/git.js +173 -0
- package/dist/pi/packages/ta-workspace/lib/util/git.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts +14 -0
- package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/keys.js +52 -0
- package/dist/pi/packages/ta-workspace/lib/util/keys.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/preview.d.ts +18 -0
- package/dist/pi/packages/ta-workspace/lib/util/preview.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/preview.js +92 -0
- package/dist/pi/packages/ta-workspace/lib/util/preview.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/search.d.ts +86 -0
- package/dist/pi/packages/ta-workspace/lib/util/search.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/search.js +243 -0
- package/dist/pi/packages/ta-workspace/lib/util/search.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/seti-font.d.ts +3 -0
- package/dist/pi/packages/ta-workspace/lib/util/seti-font.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/seti-font.js +8 -0
- package/dist/pi/packages/ta-workspace/lib/util/seti-font.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/seti.d.ts +10 -0
- package/dist/pi/packages/ta-workspace/lib/util/seti.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/seti.js +758 -0
- package/dist/pi/packages/ta-workspace/lib/util/seti.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/workspace.d.ts +109 -0
- package/dist/pi/packages/ta-workspace/lib/util/workspace.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/util/workspace.js +294 -0
- package/dist/pi/packages/ta-workspace/lib/util/workspace.js.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/workspace-client.d.ts +22 -0
- package/dist/pi/packages/ta-workspace/lib/workspace-client.d.ts.map +1 -0
- package/dist/pi/packages/ta-workspace/lib/workspace-client.js +118 -0
- package/dist/pi/packages/ta-workspace/lib/workspace-client.js.map +1 -0
- package/dist/pi/packages/ta-workspace/package.json +41 -0
- package/dist/pi/packages/ta-workspace/scripts/seti.ts +173 -0
- package/dist/pi/packages/ta-workspace/web/index.js +7289 -0
- package/dist/public/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/public/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/public/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/public/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/public/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/public/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/public/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/public/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/public/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/public/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/public/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/public/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/public/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/public/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/public/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/public/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/public/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/public/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/public/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/public/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/public/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/public/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/public/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/public/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/public/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/public/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/public/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/public/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/public/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/public/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/public/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/public/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/public/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/public/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/public/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/public/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/public/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/public/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/public/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/public/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/public/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/public/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/public/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/public/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/public/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/public/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/public/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/public/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/public/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/public/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/public/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/public/assets/abap-08VXUWAP.js +1 -0
- package/dist/public/assets/abnfDiagram-S7VZAUFO-3_0FZVeo.js +1 -0
- package/dist/public/assets/apex-BWPQTe0t.js +1 -0
- package/dist/public/assets/architecture-WOLXFQ4H-BX-N-_gd.js +1 -0
- package/dist/public/assets/architectureDiagram-YGSQEFNW-Daeu1xjI.js +36 -0
- package/dist/public/assets/azcli-Bc_sGQ0U.js +1 -0
- package/dist/public/assets/bat-i0X4ZdIN.js +1 -0
- package/dist/public/assets/bicep-B5-_aFwp.js +2 -0
- package/dist/public/assets/blockDiagram-APKKGZFW-DjJS8902.js +140 -0
- package/dist/public/assets/bpmnIcons-APHXDYXF-C0jbCElo.js +1 -0
- package/dist/public/assets/browser-D2CY3Lfb.js +1 -0
- package/dist/public/assets/browser-DZ1aJcgd.js +12 -0
- package/dist/public/assets/c4Diagram-KJ2TOQU5-mKfHFqh9.js +38 -0
- package/dist/public/assets/cameligo-DMUM7wLl.js +1 -0
- package/dist/public/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/public/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/public/assets/chunk-6MUBBAK2-Cnx7dsB1.js +2 -0
- package/dist/public/assets/chunk-AXFCVDMN-g4Y7Pg2t.js +62 -0
- package/dist/public/assets/chunk-BG4553SI-QNE6A_Vg.js +129 -0
- package/dist/public/assets/chunk-DQASFODM-DPHr08r0.js +10 -0
- package/dist/public/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
- package/dist/public/assets/chunk-HFQBQIA3-CenkxHlV.js +1 -0
- package/dist/public/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
- package/dist/public/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/public/assets/chunk-KQLB2F66-C3Z8V8R_.js +2 -0
- package/dist/public/assets/chunk-KS47KZWR-BbUyxMWY.js +1 -0
- package/dist/public/assets/chunk-LEVMRMFU-CKECy4cp.js +1 -0
- package/dist/public/assets/chunk-M57EVK23-DuZd8RGI.js +1 -0
- package/dist/public/assets/chunk-NGNAAXSQ-Bxuf9Ivc.js +136 -0
- package/dist/public/assets/chunk-OY52VR5R-DatO2fu-.js +88 -0
- package/dist/public/assets/chunk-QB3YPZ4I-11782Ox2.js +213 -0
- package/dist/public/assets/chunk-R3KSYZAL-CCTi2rHV.js +1 -0
- package/dist/public/assets/chunk-STOXU5M4-DU6EHCIH.js +72 -0
- package/dist/public/assets/chunk-TU62E6Q5-BtgGljqq.js +1 -0
- package/dist/public/assets/chunk-X4PVCEUW-Dd_Qy0Gx.js +1 -0
- package/dist/public/assets/chunk-XXDRQBXY-DjOrWHxV.js +1 -0
- package/dist/public/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/public/assets/classDiagram-v2-L25IHNXF-KfN1--CA.js +217 -0
- package/dist/public/assets/client-sUFoEC5s.js +1 -0
- package/dist/public/assets/clojure-Cm7r79vr.js +1 -0
- package/dist/public/assets/codicon-DF1abBS2.ttf +0 -0
- package/dist/public/assets/coffee-Ba7i2nA0.js +1 -0
- package/dist/public/assets/common-CGQN5htF.js +4 -0
- package/dist/public/assets/cose-bilkent-JH36ORCC-BuWVQ5UC.js +1 -0
- package/dist/public/assets/cpp-C7h46wYY.js +1 -0
- package/dist/public/assets/csharp-BKxtCVv1.js +1 -0
- package/dist/public/assets/csp-bTuwJoIa.js +1 -0
- package/dist/public/assets/css-DIMkf-bt.js +3 -0
- package/dist/public/assets/cynefin-EF2NZ3EQ-D_GZWaFs.js +1 -0
- package/dist/public/assets/cynefinDiagram-L36ESFBY-BKljxAVP.js +62 -0
- package/dist/public/assets/cypher-CVaqCwHa.js +1 -0
- package/dist/public/assets/cytoscape.esm-DpEiRCgp.js +321 -0
- package/dist/public/assets/d3-scale-CElPUUud.js +1 -0
- package/dist/public/assets/d3-selection-CtCbiJ-r.js +1 -0
- package/dist/public/assets/dagre-SPEB5RXH-nD3f86OL.js +4 -0
- package/dist/public/assets/dart-onAF5SnQ.js +1 -0
- package/dist/public/assets/diagram-3B7GL73J-wSVpHF4f.js +200 -0
- package/dist/public/assets/diagram-DNEMPZML-BOkeaSpr.js +24 -0
- package/dist/public/assets/diagram-L3MUGCDN-CRCErdiz.js +41 -0
- package/dist/public/assets/diagram-LA4NIPWU-y5kaOsii.js +24 -0
- package/dist/public/assets/diagram-MHCOC4E2-D7l7ybij.js +3 -0
- package/dist/public/assets/diagram-XPFHEONP-kHzV_Ibv.js +30 -0
- package/dist/public/assets/dist-B-aKVhGg.js +1 -0
- package/dist/public/assets/dockerfile-DZFCIeNp.js +1 -0
- package/dist/public/assets/ebnfDiagram-UZSYDL2S-BX_-WdHG.js +1 -0
- package/dist/public/assets/ecl-94qehhXe.js +1 -0
- package/dist/public/assets/editor-DjpsE8to.css +1 -0
- package/dist/public/assets/editor.api-Dwz0wCaW.js +908 -0
- package/dist/public/assets/editor.worker-CRz__AKW.js +33 -0
- package/dist/public/assets/elixir-6RTg0lbw.js +1 -0
- package/dist/public/assets/elk-XV6XMXQE-YaOVo5bZ.js +27 -0
- package/dist/public/assets/erDiagram-EYBAPDEH-BXQPjKDV.js +99 -0
- package/dist/public/assets/eventmodeling-K75KTNOO-SiGVyftr.js +1 -0
- package/dist/public/assets/flow9-C5_-GSwl.js +1 -0
- package/dist/public/assets/flowDiagram-MALGAFMO-BHpEyQnS.js +1 -0
- package/dist/public/assets/freemarker2-DmbpSxx5.js +3 -0
- package/dist/public/assets/fsharp-C8Ef5oNN.js +1 -0
- package/dist/public/assets/ganttDiagram-23REXITY-B_i7AN7O.js +292 -0
- package/dist/public/assets/gitGraph-VSP46ZUC-CSv9x0vY.js +1 -0
- package/dist/public/assets/gitGraphDiagram-STJD7YCW-BMA1YavS.js +106 -0
- package/dist/public/assets/go-C-y9NEjX.js +1 -0
- package/dist/public/assets/graphlib-DoDw2DoG.js +1 -0
- package/dist/public/assets/graphql-fmXr3nnJ.js +1 -0
- package/dist/public/assets/handlebars-BVNKBeJT.js +1 -0
- package/dist/public/assets/hcl-CpzslTdj.js +1 -0
- package/dist/public/assets/html-BHaxuuAl.js +1 -0
- package/dist/public/assets/index-DtU34jhH.js +2 -0
- package/dist/public/assets/info-OHQRW6UA-Bx2U6fFU.js +1 -0
- package/dist/public/assets/infoDiagram-KBXO4MBG-BkNpfsDm.js +2 -0
- package/dist/public/assets/ini-sBoK_t0W.js +1 -0
- package/dist/public/assets/ishikawaDiagram-M35NCXHK-xTM6C-Kn.js +70 -0
- package/dist/public/assets/java-BEtHBSE6.js +1 -0
- package/dist/public/assets/javascript-C5dXKvxq.js +1 -0
- package/dist/public/assets/journeyDiagram-OPLOXDXO-C6iaT7vL.js +139 -0
- package/dist/public/assets/json.worker-CV9fqkUp.js +65 -0
- package/dist/public/assets/jsonMode-BD64T5vA.css +1 -0
- package/dist/public/assets/jsonMode-Ia_aRv-z.js +29 -0
- package/dist/public/assets/julia-Bri6UV-V.js +1 -0
- package/dist/public/assets/kanban-definition-BZKZHSQY-MobAdBhz.js +89 -0
- package/dist/public/assets/katex-B9z73Mgk.js +257 -0
- package/dist/public/assets/katex-BydxR-ky.css +1 -0
- package/dist/public/assets/kotlin-BOotOW0E.js +1 -0
- package/dist/public/assets/less-B9JPFI3C.js +2 -0
- package/dist/public/assets/lexon-CfSJPG6W.js +1 -0
- package/dist/public/assets/liquid-CIbIBxiN.js +1 -0
- package/dist/public/assets/lua-CsQS60Ue.js +1 -0
- package/dist/public/assets/m3-D-oSqn_W.js +1 -0
- package/dist/public/assets/markdown-Cimd5fb3.js +1 -0
- package/dist/public/assets/mdx-BqruHcEe.js +1 -0
- package/dist/public/assets/mermaid-parser.core-kBQmxOUn.js +7 -0
- package/dist/public/assets/mermaid.core-BFkQwIYu.js +44 -0
- package/dist/public/assets/mindmap-definition-I2QAS2VK-DxpTmvUG.js +98 -0
- package/dist/public/assets/mips-CIPQ_RoX.js +1 -0
- package/dist/public/assets/module-B8jze-Tx.js +5 -0
- package/dist/public/assets/module-Blc8dqbf.js +1 -0
- package/dist/public/assets/module-C1y_4M09.js +1061 -0
- package/dist/public/assets/module-C9WFrzAc.js +1 -0
- package/dist/public/assets/module-CouMtASh.js +1 -0
- package/dist/public/assets/module-DYWqfyIP.js +1 -0
- package/dist/public/assets/module-EGdAhoOx.js +1 -0
- package/dist/public/assets/module-EeaigZHL.js +1 -0
- package/dist/public/assets/module-ZhkaqrNe.js +1 -0
- package/dist/public/assets/monaco-BRwac88s.js +35 -0
- package/dist/public/assets/monaco-BlFvoJcU.css +1 -0
- package/dist/public/assets/msdax-DauUninz.js +1 -0
- package/dist/public/assets/mysql-SOo6toE5.js +1 -0
- package/dist/public/assets/objective-c-FvmIjYaQ.js +1 -0
- package/dist/public/assets/packet-JDAUHWVQ-Dy7GyfNz.js +1 -0
- package/dist/public/assets/pascal-DrH0SRf2.js +1 -0
- package/dist/public/assets/pascaligo-D-ptJ9y-.js +1 -0
- package/dist/public/assets/pegDiagram-FD4XPPHP-B3bIVo4u.js +1 -0
- package/dist/public/assets/perl-oz_6vUea.js +1 -0
- package/dist/public/assets/pgsql-DTj74zXo.js +1 -0
- package/dist/public/assets/php-nr791fC2.js +1 -0
- package/dist/public/assets/pie-XZMESJXO-B4D2CjUH.js +1 -0
- package/dist/public/assets/pieDiagram-J4AKIIQI-CgnbwU0I.js +39 -0
- package/dist/public/assets/pla-CopQ2nXW.js +1 -0
- package/dist/public/assets/postiats-43DmfD33.js +1 -0
- package/dist/public/assets/powerquery-D3hlyOfw.js +1 -0
- package/dist/public/assets/powershell-DmHpPYUd.js +1 -0
- package/dist/public/assets/protobuf-C531GsRP.js +2 -0
- package/dist/public/assets/pug-Z5eAx3Zn.js +1 -0
- package/dist/public/assets/python-Cwjb3hEe.js +1 -0
- package/dist/public/assets/qsharp-DkqhCAOL.js +1 -0
- package/dist/public/assets/quadrantDiagram-XTYBLID2-DWx4wRau.js +7 -0
- package/dist/public/assets/r-BwWrilGY.js +1 -0
- package/dist/public/assets/radar-ABXABTNO-Dtf3tObc.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-DKGa9xBx.js +1 -0
- package/dist/public/assets/railroad-abnf-LNEFI6M7-CyjF4cc_.js +1 -0
- package/dist/public/assets/railroad-ebnf-DWYD2UWJ-D2ypsr5c.js +1 -0
- package/dist/public/assets/railroad-peg-JR7BVNR7-Cy6Mde1c.js +1 -0
- package/dist/public/assets/railroadDiagram-MRQ6NCDL-B6ya_k_l.js +1 -0
- package/dist/public/assets/razor-D_ClW9Lh.js +1 -0
- package/dist/public/assets/redis-ClamHrr6.js +1 -0
- package/dist/public/assets/redshift-DT7zqm-g.js +1 -0
- package/dist/public/assets/requirementDiagram-Y7LWUY3S-Brg8B8VS.js +84 -0
- package/dist/public/assets/resolver-B7c_-amj.js +1 -0
- package/dist/public/assets/restructuredtext-BYgofb2h.js +1 -0
- package/dist/public/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dist/public/assets/ruby-DezsRK8O.js +1 -0
- package/dist/public/assets/rust-DdL9SqIa.js +1 -0
- package/dist/public/assets/sankeyDiagram-WGJFYUXA-DbzPDfky.js +40 -0
- package/dist/public/assets/sb-CcwsVR0C.js +1 -0
- package/dist/public/assets/scala-DHpiXF5c.js +1 -0
- package/dist/public/assets/scheme-BeGwcela.js +1 -0
- package/dist/public/assets/scss-gp-XZpBa.js +3 -0
- package/dist/public/assets/sequenceDiagram-5NDRBG5M-BuN84drT.js +169 -0
- package/dist/public/assets/shell-CC2rA5mh.js +1 -0
- package/dist/public/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
- package/dist/public/assets/solidity-BEEn4gHE.js +1 -0
- package/dist/public/assets/sophia-CRfGWb83.js +1 -0
- package/dist/public/assets/sparql-D_Lu-MrJ.js +1 -0
- package/dist/public/assets/sql-NEE52Syq.js +1 -0
- package/dist/public/assets/st-DbInun42.js +1 -0
- package/dist/public/assets/stateDiagram-v2-FJ4FJNEA-C_CTpHMj.js +291 -0
- package/dist/public/assets/swift-Bxkupp3x.js +1 -0
- package/dist/public/assets/swimlanes-UMQ2AFYF-BvD4v9jw.js +1 -0
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-CMvLg13v.js +8 -0
- package/dist/public/assets/systemverilog-Bz4Y3fRF.js +1 -0
- package/dist/public/assets/tcl-DISqw1ZD.js +1 -0
- package/dist/public/assets/timeline-definition-SEUHKTQE-VE2xWGk8.js +120 -0
- package/dist/public/assets/treeView-D4JQ5SDB-ETecwv1j.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-er6ceAYK.js +1 -0
- package/dist/public/assets/twig-De2hgUGE.js +1 -0
- package/dist/public/assets/typescript-upeNz2VW.js +1 -0
- package/dist/public/assets/typespec-B8J7ngcE.js +1 -0
- package/dist/public/assets/usecaseDiagram-AFA6YXN4-ZtyyvKye.js +328 -0
- package/dist/public/assets/vb-DV3o63ZY.js +1 -0
- package/dist/public/assets/vennDiagram-NNMJR3RB-BTEvzrNd.js +34 -0
- package/dist/public/assets/wardley-7MLQ67FV-CzrxsjBc.js +1 -0
- package/dist/public/assets/wardleyDiagram-S7YFUSEH-CF8wIUhx.js +78 -0
- package/dist/public/assets/wgsl-DpFanUEy.js +298 -0
- package/dist/public/assets/xml-Cki0HxGb.js +1 -0
- package/dist/public/assets/xychartDiagram-GGNKY7IX-DcDpoJ4n.js +7 -0
- package/dist/public/assets/yaml-YIY66l1U.js +1 -0
- package/dist/public/assets/zh-cn-Bhwk8qWJ.js +12 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/icons/apple-touch-icon.png +0 -0
- package/dist/public/icons/icon-192.png +0 -0
- package/dist/public/icons/icon-512.png +0 -0
- package/dist/public/icons/icon.svg +1 -0
- package/dist/public/icons/maskable-512.png +0 -0
- package/dist/public/index.html +18 -0
- package/dist/public/manifest.webmanifest +40 -0
- package/dist/public/sw.js +78 -0
- package/dist/serve/index.mjs +8234 -2690
- package/package.json +20 -14
|
@@ -0,0 +1,3144 @@
|
|
|
1
|
+
// web-src/channels-model.ts
|
|
2
|
+
var NAME = "@celljs/ta-channels";
|
|
3
|
+
var AGENT_MARK = "one of the agents of Ta";
|
|
4
|
+
var MEMBER_CHANGES = ["lead", "remove", "mute", "unmute"];
|
|
5
|
+
var Keys;
|
|
6
|
+
((Keys) => {
|
|
7
|
+
Keys.TEAM = "team";
|
|
8
|
+
Keys.QUEUE = "queue";
|
|
9
|
+
Keys.WORKING = "working";
|
|
10
|
+
Keys.FOCUS = "focus";
|
|
11
|
+
Keys.REQUESTS = "requests/";
|
|
12
|
+
Keys.RESULTS = "results/";
|
|
13
|
+
Keys.MESSAGES = "messages/";
|
|
14
|
+
Keys.messages = (channelId) => `${Keys.MESSAGES}${channelId}`;
|
|
15
|
+
Keys.request = (id) => `${Keys.REQUESTS}${id}`;
|
|
16
|
+
Keys.result = (id) => `${Keys.RESULTS}${id}`;
|
|
17
|
+
})(Keys ||= {});
|
|
18
|
+
var USER = "user";
|
|
19
|
+
var TA = "ta";
|
|
20
|
+
var SYSTEM = "system";
|
|
21
|
+
var MAX_HOPS = 3;
|
|
22
|
+
var MAX_REPLIES = 8;
|
|
23
|
+
var MAX_AGENT_REPLIES = 2;
|
|
24
|
+
var MAX_MESSAGES = 200;
|
|
25
|
+
var FACES = 16;
|
|
26
|
+
var MAX_MEMBERS = 12;
|
|
27
|
+
var DEFAULT_ROLE = "You help the user with what they ask, as a colleague who takes on the work and does it.";
|
|
28
|
+
var CONTEXT_MESSAGES = 12;
|
|
29
|
+
var MAX_NAME = 32;
|
|
30
|
+
|
|
31
|
+
// web-src/channels-util.ts
|
|
32
|
+
var ChannelsUtil;
|
|
33
|
+
((ChannelsUtil) => {
|
|
34
|
+
function newRound() {
|
|
35
|
+
return { total: 0, byAgent: {}, stopped: false };
|
|
36
|
+
}
|
|
37
|
+
ChannelsUtil.newRound = newRound;
|
|
38
|
+
function limit(round, targets2, hops) {
|
|
39
|
+
const allowed = [];
|
|
40
|
+
const byAgent = { ...round.byAgent };
|
|
41
|
+
let total = round.total;
|
|
42
|
+
for (const id of targets2) {
|
|
43
|
+
if (hops < MAX_HOPS && total < MAX_REPLIES && (byAgent[id] ?? 0) < MAX_AGENT_REPLIES) {
|
|
44
|
+
allowed.push(id);
|
|
45
|
+
byAgent[id] = (byAgent[id] ?? 0) + 1;
|
|
46
|
+
total++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const cut = allowed.length < targets2.length;
|
|
50
|
+
const note = cut && !round.stopped;
|
|
51
|
+
return { allowed, round: { total, byAgent, stopped: round.stopped || cut }, cut, note };
|
|
52
|
+
}
|
|
53
|
+
ChannelsUtil.limit = limit;
|
|
54
|
+
function emptyTeam() {
|
|
55
|
+
return { agents: [], channels: [] };
|
|
56
|
+
}
|
|
57
|
+
ChannelsUtil.emptyTeam = emptyTeam;
|
|
58
|
+
function newId(prefix) {
|
|
59
|
+
return `${prefix}-${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
60
|
+
}
|
|
61
|
+
ChannelsUtil.newId = newId;
|
|
62
|
+
function checkName(value, what) {
|
|
63
|
+
const name = typeof value === "string" ? value.trim().replace(/^[@#]+/, "").replace(/\s+/g, "-") : "";
|
|
64
|
+
if (!name || name.length > MAX_NAME || /[@#,]/.test(name)) {
|
|
65
|
+
throw new Error(`The name of the ${what} must be 1 to ${MAX_NAME} characters, without @, # or commas.`);
|
|
66
|
+
}
|
|
67
|
+
return name;
|
|
68
|
+
}
|
|
69
|
+
ChannelsUtil.checkName = checkName;
|
|
70
|
+
function mark(name) {
|
|
71
|
+
const first = Array.from(name)[0] ?? "?";
|
|
72
|
+
if (!/[A-Za-z0-9]/.test(first)) {
|
|
73
|
+
return first;
|
|
74
|
+
}
|
|
75
|
+
const words = name.split(/[-_.\s]+|(?<=[a-z])(?=[A-Z])/).filter(Boolean);
|
|
76
|
+
return words.length > 1 ? (words[0][0] + words[1][0]).toUpperCase() : first.toUpperCase();
|
|
77
|
+
}
|
|
78
|
+
ChannelsUtil.mark = mark;
|
|
79
|
+
function faces(agents) {
|
|
80
|
+
const result = new Map;
|
|
81
|
+
const taken = new Set;
|
|
82
|
+
for (const agent of agents) {
|
|
83
|
+
if (isFace(agent.face)) {
|
|
84
|
+
result.set(agent.id, agent.face);
|
|
85
|
+
taken.add(agent.face);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const agent of agents) {
|
|
89
|
+
if (!result.has(agent.id)) {
|
|
90
|
+
const face = freeFace(hash(agent.id), taken);
|
|
91
|
+
result.set(agent.id, face);
|
|
92
|
+
taken.add(face);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
ChannelsUtil.faces = faces;
|
|
98
|
+
function isFace(face) {
|
|
99
|
+
return typeof face === "number" && Number.isInteger(face) && face >= 0 && face < FACES;
|
|
100
|
+
}
|
|
101
|
+
ChannelsUtil.isFace = isFace;
|
|
102
|
+
function freeFaceFor(agents, seed) {
|
|
103
|
+
return freeFace(hash(seed), new Set(faces(agents).values()));
|
|
104
|
+
}
|
|
105
|
+
ChannelsUtil.freeFaceFor = freeFaceFor;
|
|
106
|
+
function freeName(team, base) {
|
|
107
|
+
let name = base;
|
|
108
|
+
for (let count = 2;findAgent(team, name); count++) {
|
|
109
|
+
name = `${base}-${count}`;
|
|
110
|
+
}
|
|
111
|
+
return name;
|
|
112
|
+
}
|
|
113
|
+
ChannelsUtil.freeName = freeName;
|
|
114
|
+
function freeFace(start, taken) {
|
|
115
|
+
for (let step = 0;step < FACES; step++) {
|
|
116
|
+
const face = (start + step) % FACES;
|
|
117
|
+
if (!taken.has(face)) {
|
|
118
|
+
return face;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return start % FACES;
|
|
122
|
+
}
|
|
123
|
+
function hash(text) {
|
|
124
|
+
let value = 2166136261;
|
|
125
|
+
for (let index = 0;index < text.length; index++) {
|
|
126
|
+
value = Math.imul(value ^ text.charCodeAt(index), 16777619);
|
|
127
|
+
}
|
|
128
|
+
return value >>> 0;
|
|
129
|
+
}
|
|
130
|
+
ChannelsUtil.hash = hash;
|
|
131
|
+
function findAgent(team, ref) {
|
|
132
|
+
const key = ref.trim().replace(/^@/, "").toLowerCase();
|
|
133
|
+
return team.agents.find((agent) => agent.id === ref || agent.name.toLowerCase() === key);
|
|
134
|
+
}
|
|
135
|
+
ChannelsUtil.findAgent = findAgent;
|
|
136
|
+
function findChannel(team, ref) {
|
|
137
|
+
const key = ref.trim().replace(/^#/, "").toLowerCase();
|
|
138
|
+
return team.channels.find((channel) => channel.id === ref || channel.name.toLowerCase() === key);
|
|
139
|
+
}
|
|
140
|
+
ChannelsUtil.findChannel = findChannel;
|
|
141
|
+
function addAgent(team, input) {
|
|
142
|
+
const name = checkName(input.name, "agent");
|
|
143
|
+
if (findAgent(team, name)) {
|
|
144
|
+
throw new Error(`There is an agent named ${name} already.`);
|
|
145
|
+
}
|
|
146
|
+
const role = typeof input.role === "string" ? input.role.trim() : "";
|
|
147
|
+
if (!role) {
|
|
148
|
+
throw new Error(`Say what ${name} does: its role.`);
|
|
149
|
+
}
|
|
150
|
+
const cwd = typeof input.cwd === "string" && input.cwd.trim() ? input.cwd.trim() : undefined;
|
|
151
|
+
const id = newId("agent");
|
|
152
|
+
const face = isFace(input.face) ? input.face : freeFace(hash(id), new Set(faces(team.agents).values()));
|
|
153
|
+
const agent = { id, name, role, mark: mark(name), face, cwd, createdAt: Date.now() };
|
|
154
|
+
return { team: { ...team, agents: [...team.agents, agent] }, agent };
|
|
155
|
+
}
|
|
156
|
+
ChannelsUtil.addAgent = addAgent;
|
|
157
|
+
function addChannel(team, input) {
|
|
158
|
+
const name = checkName(input.name, "channel");
|
|
159
|
+
if (findChannel(team, name)) {
|
|
160
|
+
throw new Error(`There is a channel named ${name} already.`);
|
|
161
|
+
}
|
|
162
|
+
const members = agentIds(team, input.members);
|
|
163
|
+
if (members.length === 0) {
|
|
164
|
+
throw new Error("A channel needs at least one agent.");
|
|
165
|
+
}
|
|
166
|
+
if (members.length > MAX_MEMBERS) {
|
|
167
|
+
throw new Error(`A channel holds at most ${MAX_MEMBERS} agents.`);
|
|
168
|
+
}
|
|
169
|
+
const topic = typeof input.topic === "string" && input.topic.trim() ? input.topic.trim() : undefined;
|
|
170
|
+
const channel = { id: newId("channel"), name, topic, members, createdAt: Date.now() };
|
|
171
|
+
return { team: { ...team, channels: [...team.channels, channel] }, channel };
|
|
172
|
+
}
|
|
173
|
+
ChannelsUtil.addChannel = addChannel;
|
|
174
|
+
function addMembers(team, input) {
|
|
175
|
+
const found = channelOf(team, input.channel);
|
|
176
|
+
const ids = agentIds(team, input.members);
|
|
177
|
+
if (ids.length === 0) {
|
|
178
|
+
throw new Error("Name at least one agent to add.");
|
|
179
|
+
}
|
|
180
|
+
const added = ids.filter((id) => !found.members.includes(id)).map((id) => team.agents.find((agent) => agent.id === id));
|
|
181
|
+
if (found.members.length + added.length > MAX_MEMBERS) {
|
|
182
|
+
throw new Error(`A channel holds at most ${MAX_MEMBERS} agents; #${found.name} has ${found.members.length}.`);
|
|
183
|
+
}
|
|
184
|
+
const channel = { ...found, members: [...found.members, ...added.map((agent) => agent.id)] };
|
|
185
|
+
return { team: { ...team, channels: team.channels.map((other) => other.id === channel.id ? channel : other) }, channel, added };
|
|
186
|
+
}
|
|
187
|
+
ChannelsUtil.addMembers = addMembers;
|
|
188
|
+
function channelOf(team, ref) {
|
|
189
|
+
const key = typeof ref === "string" ? ref : "";
|
|
190
|
+
const found = findChannel(team, key);
|
|
191
|
+
if (!found) {
|
|
192
|
+
const known = team.channels.map((other) => `#${other.name}`).join(", ") || "none yet";
|
|
193
|
+
throw new Error(`No channel is named ${key}. The channels: ${known}.`);
|
|
194
|
+
}
|
|
195
|
+
return found;
|
|
196
|
+
}
|
|
197
|
+
ChannelsUtil.channelOf = channelOf;
|
|
198
|
+
function changeMember(team, input) {
|
|
199
|
+
const found = channelOf(team, input.channel);
|
|
200
|
+
const agent = findAgent(team, typeof input.agent === "string" ? input.agent : "");
|
|
201
|
+
if (!agent || !found.members.includes(agent.id)) {
|
|
202
|
+
throw new Error(`${agent?.name ?? String(input.agent)} is not a member of #${found.name}.`);
|
|
203
|
+
}
|
|
204
|
+
if (typeof input.change !== "string" || !MEMBER_CHANGES.includes(input.change)) {
|
|
205
|
+
throw new Error(`A member is changed with one of ${MEMBER_CHANGES.join(", ")}.`);
|
|
206
|
+
}
|
|
207
|
+
const others = found.members.filter((id) => id !== agent.id);
|
|
208
|
+
const muted = (found.muted ?? []).filter((id) => id !== agent.id);
|
|
209
|
+
let channel;
|
|
210
|
+
switch (input.change) {
|
|
211
|
+
case "lead":
|
|
212
|
+
channel = { ...found, members: [agent.id, ...others] };
|
|
213
|
+
break;
|
|
214
|
+
case "remove":
|
|
215
|
+
if (others.length === 0) {
|
|
216
|
+
throw new Error(`${agent.name} is the only member of #${found.name}: delete the channel instead.`);
|
|
217
|
+
}
|
|
218
|
+
channel = { ...found, members: others, muted };
|
|
219
|
+
break;
|
|
220
|
+
case "mute":
|
|
221
|
+
channel = { ...found, muted: [...muted, agent.id] };
|
|
222
|
+
break;
|
|
223
|
+
default:
|
|
224
|
+
channel = { ...found, muted };
|
|
225
|
+
}
|
|
226
|
+
if (channel.muted?.length === 0) {
|
|
227
|
+
delete channel.muted;
|
|
228
|
+
}
|
|
229
|
+
return { team: { ...team, channels: team.channels.map((other) => other.id === channel.id ? channel : other) }, channel };
|
|
230
|
+
}
|
|
231
|
+
ChannelsUtil.changeMember = changeMember;
|
|
232
|
+
function updateChannel(team, input) {
|
|
233
|
+
const before = channelOf(team, input.channel);
|
|
234
|
+
const channel = { ...before };
|
|
235
|
+
if (input.name !== undefined) {
|
|
236
|
+
const name = checkName(input.name, "channel");
|
|
237
|
+
const other = findChannel(team, name);
|
|
238
|
+
if (other && other.id !== channel.id) {
|
|
239
|
+
throw new Error(`There is a channel named ${name} already.`);
|
|
240
|
+
}
|
|
241
|
+
channel.name = name;
|
|
242
|
+
}
|
|
243
|
+
if (input.topic !== undefined) {
|
|
244
|
+
const topic = typeof input.topic === "string" ? input.topic.trim() : "";
|
|
245
|
+
if (topic) {
|
|
246
|
+
channel.topic = topic;
|
|
247
|
+
} else {
|
|
248
|
+
delete channel.topic;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (input.pinned !== undefined) {
|
|
252
|
+
if (input.pinned === true) {
|
|
253
|
+
channel.pinned = true;
|
|
254
|
+
} else {
|
|
255
|
+
delete channel.pinned;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return { team: { ...team, channels: team.channels.map((other) => other.id === channel.id ? channel : other) }, channel, before };
|
|
259
|
+
}
|
|
260
|
+
ChannelsUtil.updateChannel = updateChannel;
|
|
261
|
+
function pinnedFirst(channels) {
|
|
262
|
+
return [...channels.filter((channel) => channel.pinned), ...channels.filter((channel) => !channel.pinned)];
|
|
263
|
+
}
|
|
264
|
+
ChannelsUtil.pinnedFirst = pinnedFirst;
|
|
265
|
+
function removeChannel(team, ref) {
|
|
266
|
+
const channel = channelOf(team, ref);
|
|
267
|
+
return { team: { ...team, channels: team.channels.filter((other) => other.id !== channel.id) }, channel };
|
|
268
|
+
}
|
|
269
|
+
ChannelsUtil.removeChannel = removeChannel;
|
|
270
|
+
function resetAgent(team, ref) {
|
|
271
|
+
const found = findAgent(team, typeof ref === "string" ? ref : "");
|
|
272
|
+
if (!found) {
|
|
273
|
+
throw new Error(`No agent is ${String(ref)}.`);
|
|
274
|
+
}
|
|
275
|
+
const { sessionFile: _gone, ...agent } = found;
|
|
276
|
+
return { team: { ...team, agents: team.agents.map((other) => other.id === agent.id ? agent : other) }, agent };
|
|
277
|
+
}
|
|
278
|
+
ChannelsUtil.resetAgent = resetAgent;
|
|
279
|
+
function updateAgent(team, input) {
|
|
280
|
+
const before = findAgent(team, typeof input.agent === "string" ? input.agent : "");
|
|
281
|
+
if (!before) {
|
|
282
|
+
throw new Error(`No agent is ${String(input.agent)}.`);
|
|
283
|
+
}
|
|
284
|
+
const agent = { ...before };
|
|
285
|
+
if (input.name !== undefined) {
|
|
286
|
+
const name = checkName(input.name, "agent");
|
|
287
|
+
const other = findAgent(team, name);
|
|
288
|
+
if (other && other.id !== agent.id) {
|
|
289
|
+
throw new Error(`There is an agent named ${name} already.`);
|
|
290
|
+
}
|
|
291
|
+
agent.name = name;
|
|
292
|
+
agent.mark = mark(name);
|
|
293
|
+
}
|
|
294
|
+
if (input.role !== undefined) {
|
|
295
|
+
const role = typeof input.role === "string" ? input.role.trim() : "";
|
|
296
|
+
if (!role) {
|
|
297
|
+
throw new Error(`Say what ${agent.name} does: its role.`);
|
|
298
|
+
}
|
|
299
|
+
agent.role = role;
|
|
300
|
+
}
|
|
301
|
+
if (input.face !== undefined) {
|
|
302
|
+
if (!isFace(input.face)) {
|
|
303
|
+
throw new Error(`A face is a number from 0 to ${FACES - 1}.`);
|
|
304
|
+
}
|
|
305
|
+
agent.face = input.face;
|
|
306
|
+
}
|
|
307
|
+
if (input.cwd !== undefined) {
|
|
308
|
+
const cwd = typeof input.cwd === "string" && input.cwd.trim() ? input.cwd.trim() : undefined;
|
|
309
|
+
if (cwd !== before.cwd) {
|
|
310
|
+
agent.cwd = cwd;
|
|
311
|
+
delete agent.sessionFile;
|
|
312
|
+
}
|
|
313
|
+
if (!cwd) {
|
|
314
|
+
delete agent.cwd;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return { team: { ...team, agents: team.agents.map((other) => other.id === agent.id ? agent : other) }, agent, before };
|
|
318
|
+
}
|
|
319
|
+
ChannelsUtil.updateAgent = updateAgent;
|
|
320
|
+
function removeAgent(team, ref) {
|
|
321
|
+
const agent = findAgent(team, typeof ref === "string" ? ref : "");
|
|
322
|
+
if (!agent) {
|
|
323
|
+
throw new Error(`No agent is ${String(ref)}.`);
|
|
324
|
+
}
|
|
325
|
+
const gone = [];
|
|
326
|
+
const channels = [];
|
|
327
|
+
for (const channel of team.channels) {
|
|
328
|
+
if (!channel.members.includes(agent.id)) {
|
|
329
|
+
channels.push(channel);
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
const members = channel.members.filter((id) => id !== agent.id);
|
|
333
|
+
if (members.length === 0) {
|
|
334
|
+
gone.push(channel);
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
const muted = channel.muted?.filter((id) => id !== agent.id);
|
|
338
|
+
const next = { ...channel, members, muted };
|
|
339
|
+
if (!muted?.length) {
|
|
340
|
+
delete next.muted;
|
|
341
|
+
}
|
|
342
|
+
channels.push(next);
|
|
343
|
+
}
|
|
344
|
+
return { team: { agents: team.agents.filter((other) => other.id !== agent.id), channels }, agent, channels: gone };
|
|
345
|
+
}
|
|
346
|
+
ChannelsUtil.removeAgent = removeAgent;
|
|
347
|
+
function agentIds(team, refs) {
|
|
348
|
+
const ids = [];
|
|
349
|
+
for (const ref of Array.isArray(refs) ? refs.filter((item) => typeof item === "string") : []) {
|
|
350
|
+
const agent = findAgent(team, ref);
|
|
351
|
+
if (!agent) {
|
|
352
|
+
const known = team.agents.map((other) => other.name).join(", ") || "none yet";
|
|
353
|
+
throw new Error(`No agent is named ${ref}. The agents: ${known}.`);
|
|
354
|
+
}
|
|
355
|
+
if (!ids.includes(agent.id)) {
|
|
356
|
+
ids.push(agent.id);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return ids;
|
|
360
|
+
}
|
|
361
|
+
function markMentions(text, agents) {
|
|
362
|
+
if (agents.length === 0) {
|
|
363
|
+
return text;
|
|
364
|
+
}
|
|
365
|
+
const names = [...agents].sort((a, b) => b.name.length - a.name.length).map((agent) => agent.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
366
|
+
const pattern = new RegExp(`(?<![*A-Za-z0-9_])@(${names.join("|")})(?![A-Za-z0-9_-])`, "gi");
|
|
367
|
+
return text.split(/(```[\s\S]*?(?:```|$)|`[^`\n]*`)/).map((part, index) => index % 2 === 1 ? part : part.replace(pattern, "**$&**")).join("");
|
|
368
|
+
}
|
|
369
|
+
ChannelsUtil.markMentions = markMentions;
|
|
370
|
+
function mentions(text, agents) {
|
|
371
|
+
if (agents.length === 0) {
|
|
372
|
+
return [];
|
|
373
|
+
}
|
|
374
|
+
const names = [...agents].sort((a, b) => b.name.length - a.name.length).map((agent) => agent.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
375
|
+
const pattern = new RegExp(`@(${names.join("|")})(?![A-Za-z0-9_-])`, "gi");
|
|
376
|
+
const found = [];
|
|
377
|
+
for (const match of text.matchAll(pattern)) {
|
|
378
|
+
const agent = agents.find((candidate) => candidate.name.toLowerCase() === match[1].toLowerCase());
|
|
379
|
+
if (agent && !found.includes(agent.id)) {
|
|
380
|
+
found.push(agent.id);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return found;
|
|
384
|
+
}
|
|
385
|
+
ChannelsUtil.mentions = mentions;
|
|
386
|
+
function targets(team, channel, message) {
|
|
387
|
+
const muted = channel.muted ?? [];
|
|
388
|
+
const members = channel.members.filter((id) => !muted.includes(id)).map((id) => team.agents.find((agent) => agent.id === id)).filter((agent) => !!agent);
|
|
389
|
+
const named = mentions(message.text, members).filter((id) => id !== message.author);
|
|
390
|
+
if (message.author === SYSTEM) {
|
|
391
|
+
return [];
|
|
392
|
+
}
|
|
393
|
+
if (named.length > 0 || message.author !== USER && message.author !== TA) {
|
|
394
|
+
return named;
|
|
395
|
+
}
|
|
396
|
+
return members.length > 0 ? [members[0].id] : [];
|
|
397
|
+
}
|
|
398
|
+
ChannelsUtil.targets = targets;
|
|
399
|
+
function authorName(team, author, labels) {
|
|
400
|
+
if (author === SYSTEM) {
|
|
401
|
+
return "channel";
|
|
402
|
+
}
|
|
403
|
+
if (author === USER) {
|
|
404
|
+
return labels.user;
|
|
405
|
+
}
|
|
406
|
+
if (author === TA) {
|
|
407
|
+
return labels.ta;
|
|
408
|
+
}
|
|
409
|
+
return team.agents.find((agent) => agent.id === author)?.name ?? author;
|
|
410
|
+
}
|
|
411
|
+
ChannelsUtil.authorName = authorName;
|
|
412
|
+
function systemPrompt(agent) {
|
|
413
|
+
return [
|
|
414
|
+
`You are ${agent.name}, ${AGENT_MARK}. Your role: ${agent.role}`,
|
|
415
|
+
"You work with the user, Ta and other agents in channels. A message for you starts with a <context> block: the channel, its members, the recent messages and who speaks to you; answer what follows the block.",
|
|
416
|
+
"Do the part of the work your role covers with your tools, then answer in a few sentences: your answer is posted to the channel as it is.",
|
|
417
|
+
"To hand work to another member, write @ and their name in your answer; name nobody when the work is done or you need the user."
|
|
418
|
+
].join(`
|
|
419
|
+
`);
|
|
420
|
+
}
|
|
421
|
+
ChannelsUtil.systemPrompt = systemPrompt;
|
|
422
|
+
function prompt(team, channel, history, message, agent) {
|
|
423
|
+
const labels = { user: "user", ta: "Ta" };
|
|
424
|
+
const members = channel.members.map((id) => team.agents.find((other) => other.id === id)).filter((other) => !!other).map((other) => `@${other.name}${other.id === agent.id ? " (you)" : ""}: ${firstLine(other.role)}`);
|
|
425
|
+
const before = history.filter((item) => item.id !== message.id && !item.failed).slice(-CONTEXT_MESSAGES);
|
|
426
|
+
const lines = [`[#${channel.name}]${channel.topic ? ` ${channel.topic}` : ""}`, "Members:", ...members.map((line) => `- ${line}`)];
|
|
427
|
+
if (before.length > 0) {
|
|
428
|
+
lines.push("", "Recent messages:", ...before.map((item) => `${authorName(team, item.author, labels)}: ${item.text}`));
|
|
429
|
+
}
|
|
430
|
+
lines.push("", `${authorName(team, message.author, labels)} to you:`);
|
|
431
|
+
return `<context>
|
|
432
|
+
${lines.join(`
|
|
433
|
+
`)}
|
|
434
|
+
</context>
|
|
435
|
+
${message.text}`;
|
|
436
|
+
}
|
|
437
|
+
ChannelsUtil.prompt = prompt;
|
|
438
|
+
function append(messages, message) {
|
|
439
|
+
const next = [...messages, message];
|
|
440
|
+
return next.length > MAX_MESSAGES ? next.slice(next.length - MAX_MESSAGES) : next;
|
|
441
|
+
}
|
|
442
|
+
ChannelsUtil.append = append;
|
|
443
|
+
function summary(team) {
|
|
444
|
+
if (team.agents.length === 0) {
|
|
445
|
+
return "No agents and no channels yet.";
|
|
446
|
+
}
|
|
447
|
+
const name = (id) => team.agents.find((agent) => agent.id === id)?.name ?? id;
|
|
448
|
+
const agents = team.agents.map((agent) => `- @${agent.name}: ${firstLine(agent.role)}`);
|
|
449
|
+
const channels = team.channels.map((channel) => `- #${channel.name}${channel.topic ? ` (${channel.topic})` : ""}: ${channel.members.map((id) => `@${name(id)}`).join(", ")}${channel.muted?.length ? `; muted by the user, answering nothing: ${channel.muted.map((id) => `@${name(id)}`).join(", ")}` : ""}`);
|
|
450
|
+
return ["Agents:", ...agents, "", "Channels:", ...channels.length > 0 ? channels : ["none yet"]].join(`
|
|
451
|
+
`);
|
|
452
|
+
}
|
|
453
|
+
ChannelsUtil.summary = summary;
|
|
454
|
+
function transcript(team, messages) {
|
|
455
|
+
const labels = { user: "user", ta: "Ta" };
|
|
456
|
+
return messages.map((item) => `${authorName(team, item.author, labels)}${item.failed ? " (failed)" : ""}: ${item.text}`).join(`
|
|
457
|
+
|
|
458
|
+
`);
|
|
459
|
+
}
|
|
460
|
+
ChannelsUtil.transcript = transcript;
|
|
461
|
+
function markdown(agent, messages, labels) {
|
|
462
|
+
const parts = [`# ${agent.name}`, "", `> ${firstLine(agent.role)}`];
|
|
463
|
+
for (const message of messages) {
|
|
464
|
+
const { role, content } = message ?? {};
|
|
465
|
+
if (role !== "user" && role !== "assistant") {
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
const text = (typeof content === "string" ? content : Array.isArray(content) ? content.map((block) => block?.type === "text" ? String(block.text ?? "") : "").join("") : "").replace(/^<context>\n?[\s\S]*?\n?<\/context>\n?/, "").trim();
|
|
469
|
+
if (text) {
|
|
470
|
+
parts.push("", `## ${role === "user" ? labels.user : agent.name}`, "", text);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
return `${parts.join(`
|
|
474
|
+
`)}
|
|
475
|
+
`;
|
|
476
|
+
}
|
|
477
|
+
ChannelsUtil.markdown = markdown;
|
|
478
|
+
function channelMarkdown(team, channel, messages, labels) {
|
|
479
|
+
const parts = [`# #${channel.name}`];
|
|
480
|
+
if (channel.topic) {
|
|
481
|
+
parts.push("", `> ${firstLine(channel.topic)}`);
|
|
482
|
+
}
|
|
483
|
+
for (const message of messages) {
|
|
484
|
+
const text = message.text.trim();
|
|
485
|
+
if (text && message.author !== SYSTEM) {
|
|
486
|
+
parts.push("", `## ${authorName(team, message.author, labels)}${message.failed ? " (failed)" : ""}`, "", text);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return `${parts.join(`
|
|
490
|
+
`)}
|
|
491
|
+
`;
|
|
492
|
+
}
|
|
493
|
+
ChannelsUtil.channelMarkdown = channelMarkdown;
|
|
494
|
+
function firstLine(text) {
|
|
495
|
+
return text.split(`
|
|
496
|
+
`)[0];
|
|
497
|
+
}
|
|
498
|
+
})(ChannelsUtil ||= {});
|
|
499
|
+
|
|
500
|
+
// web-src/channels.ts
|
|
501
|
+
class ChannelsClient {
|
|
502
|
+
storage;
|
|
503
|
+
current = { team: ChannelsUtil.emptyTeam(), messages: {}, working: {}, loaded: false };
|
|
504
|
+
listeners = new Set;
|
|
505
|
+
focusListeners = new Set;
|
|
506
|
+
pending = new Map;
|
|
507
|
+
loading;
|
|
508
|
+
options;
|
|
509
|
+
unlisten;
|
|
510
|
+
constructor(storage, options = {}) {
|
|
511
|
+
this.storage = storage;
|
|
512
|
+
this.options = { timeoutMs: 30000, ...options };
|
|
513
|
+
this.unlisten = storage.onChange((keys) => void this.changed(keys));
|
|
514
|
+
}
|
|
515
|
+
get state() {
|
|
516
|
+
return this.current;
|
|
517
|
+
}
|
|
518
|
+
subscribe(listener) {
|
|
519
|
+
this.listeners.add(listener);
|
|
520
|
+
return () => this.listeners.delete(listener);
|
|
521
|
+
}
|
|
522
|
+
onFocus(listener) {
|
|
523
|
+
this.focusListeners.add(listener);
|
|
524
|
+
return () => this.focusListeners.delete(listener);
|
|
525
|
+
}
|
|
526
|
+
dispose() {
|
|
527
|
+
this.unlisten();
|
|
528
|
+
for (const [id, pending] of this.pending) {
|
|
529
|
+
clearTimeout(pending.timer);
|
|
530
|
+
this.pending.delete(id);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
load(again = false) {
|
|
534
|
+
if (!this.loading || again) {
|
|
535
|
+
this.loading = Promise.all([this.storage.get(Keys.TEAM), this.storage.get(Keys.WORKING)]).then(([team, working]) => this.update({ team: team ?? ChannelsUtil.emptyTeam(), working: working ?? {}, loaded: true }));
|
|
536
|
+
}
|
|
537
|
+
return this.loading;
|
|
538
|
+
}
|
|
539
|
+
async messages(channelId, again = false) {
|
|
540
|
+
const known = this.current.messages[channelId];
|
|
541
|
+
if (known && !again) {
|
|
542
|
+
return known;
|
|
543
|
+
}
|
|
544
|
+
const messages = await this.storage.get(Keys.messages(channelId)) ?? [];
|
|
545
|
+
this.update({ messages: { ...this.current.messages, [channelId]: messages } });
|
|
546
|
+
return messages;
|
|
547
|
+
}
|
|
548
|
+
async createAgent(input) {
|
|
549
|
+
const agent = await this.request({ kind: "createAgent", ...input });
|
|
550
|
+
await this.load(true);
|
|
551
|
+
return agent;
|
|
552
|
+
}
|
|
553
|
+
async createChannel(input) {
|
|
554
|
+
const channel = await this.request({ kind: "createChannel", ...input });
|
|
555
|
+
await this.load(true);
|
|
556
|
+
return channel;
|
|
557
|
+
}
|
|
558
|
+
async addMembers(channelId, members) {
|
|
559
|
+
const channel = await this.request({ kind: "addMembers", channel: channelId, members });
|
|
560
|
+
await this.load(true);
|
|
561
|
+
return channel;
|
|
562
|
+
}
|
|
563
|
+
async changeMember(channelId, agentId, change) {
|
|
564
|
+
const channel = await this.request({ kind: "changeMember", channel: channelId, agent: agentId, change });
|
|
565
|
+
await this.load(true);
|
|
566
|
+
return channel;
|
|
567
|
+
}
|
|
568
|
+
async updateChannel(channelId, change) {
|
|
569
|
+
const channel = await this.request({ kind: "updateChannel", channel: channelId, ...change });
|
|
570
|
+
await this.load(true);
|
|
571
|
+
return channel;
|
|
572
|
+
}
|
|
573
|
+
async deleteChannel(channelId) {
|
|
574
|
+
await this.request({ kind: "deleteChannel", channel: channelId });
|
|
575
|
+
const { [channelId]: _gone, ...messages } = this.current.messages;
|
|
576
|
+
this.update({ messages });
|
|
577
|
+
await this.load(true);
|
|
578
|
+
}
|
|
579
|
+
async resetAgent(agentId) {
|
|
580
|
+
const agent = await this.request({ kind: "resetAgent", agent: agentId });
|
|
581
|
+
await this.load(true);
|
|
582
|
+
return agent;
|
|
583
|
+
}
|
|
584
|
+
async updateAgent(agentId, change) {
|
|
585
|
+
const agent = await this.request({ kind: "updateAgent", agent: agentId, ...change });
|
|
586
|
+
await this.load(true);
|
|
587
|
+
return agent;
|
|
588
|
+
}
|
|
589
|
+
async deleteAgent(agentId) {
|
|
590
|
+
await this.request({ kind: "deleteAgent", agent: agentId });
|
|
591
|
+
await this.load(true);
|
|
592
|
+
}
|
|
593
|
+
async openAgent(agentId) {
|
|
594
|
+
const { sessionId } = await this.request({ kind: "openAgent", agent: agentId });
|
|
595
|
+
return sessionId;
|
|
596
|
+
}
|
|
597
|
+
async post(channelId, text) {
|
|
598
|
+
await this.request({ kind: "post", channel: channelId, text });
|
|
599
|
+
}
|
|
600
|
+
request(request) {
|
|
601
|
+
const id = ChannelsUtil.newId("request");
|
|
602
|
+
const result = new Promise((resolve, reject) => {
|
|
603
|
+
const timer = setTimeout(() => {
|
|
604
|
+
this.pending.delete(id);
|
|
605
|
+
reject(new Error("ta serve did not answer: the package may be off, or the server still starting."));
|
|
606
|
+
}, this.options.timeoutMs);
|
|
607
|
+
this.pending.set(id, { resolve, reject, timer });
|
|
608
|
+
});
|
|
609
|
+
return this.storage.set(Keys.request(id), request).then(() => {
|
|
610
|
+
this.take(id);
|
|
611
|
+
return result;
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
async take(id) {
|
|
615
|
+
if (!this.pending.has(id)) {
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
const result = await this.storage.get(Keys.result(id));
|
|
619
|
+
const pending = this.pending.get(id);
|
|
620
|
+
if (!result || !pending) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
this.pending.delete(id);
|
|
624
|
+
clearTimeout(pending.timer);
|
|
625
|
+
this.storage.set(Keys.result(id), null).catch(() => {
|
|
626
|
+
return;
|
|
627
|
+
});
|
|
628
|
+
if (result.ok) {
|
|
629
|
+
pending.resolve(result.value);
|
|
630
|
+
} else {
|
|
631
|
+
pending.reject(new Error(result.error));
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
async changed(keys) {
|
|
635
|
+
const reads = [];
|
|
636
|
+
for (const key of keys) {
|
|
637
|
+
if (key === Keys.TEAM || key === Keys.WORKING) {
|
|
638
|
+
reads.push(this.load(true));
|
|
639
|
+
} else if (key.startsWith(Keys.MESSAGES)) {
|
|
640
|
+
const channelId = key.slice(Keys.MESSAGES.length);
|
|
641
|
+
if (this.current.messages[channelId]) {
|
|
642
|
+
reads.push(this.messages(channelId, true));
|
|
643
|
+
}
|
|
644
|
+
} else if (key.startsWith(Keys.RESULTS)) {
|
|
645
|
+
reads.push(this.take(key.slice(Keys.RESULTS.length)));
|
|
646
|
+
} else if (key === Keys.FOCUS) {
|
|
647
|
+
reads.push(this.storage.get(Keys.FOCUS).then(async (focus) => {
|
|
648
|
+
if (focus) {
|
|
649
|
+
await this.load(true);
|
|
650
|
+
for (const listener of this.focusListeners) {
|
|
651
|
+
listener(focus.channelId);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}));
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
await Promise.all(reads).catch((error) => console.error(error));
|
|
658
|
+
}
|
|
659
|
+
update(change) {
|
|
660
|
+
this.current = { ...this.current, ...change };
|
|
661
|
+
for (const listener of this.listeners) {
|
|
662
|
+
listener(this.current);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// web-src/react.ts
|
|
668
|
+
var React;
|
|
669
|
+
function bind(react) {
|
|
670
|
+
React = react;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// web-src/faces.tsx
|
|
674
|
+
var BLUE = "#4285F4";
|
|
675
|
+
var RED = "#EA4335";
|
|
676
|
+
var YELLOW = "#FBBC05";
|
|
677
|
+
var GREEN = "#34A853";
|
|
678
|
+
var MINT = "#5CC27F";
|
|
679
|
+
var ORANGE = "#EE7B3B";
|
|
680
|
+
var VIOLET = "#8C5CF0";
|
|
681
|
+
var CREAM = "#F1DFC0";
|
|
682
|
+
var TEAL = "#26B0A9";
|
|
683
|
+
var PINK = "#F27BA6";
|
|
684
|
+
var LILAC = "#B49CF5";
|
|
685
|
+
var SKY = "#45B5E8";
|
|
686
|
+
var INDIGO = "#5C6BC0";
|
|
687
|
+
var MIST = "#DCE3F0";
|
|
688
|
+
var INK = "#202124";
|
|
689
|
+
var WHITE = "#FFFFFF";
|
|
690
|
+
var CHEEK = "rgba(255, 160, 185, 0.55)";
|
|
691
|
+
var EDGE = "rgba(0, 0, 0, 0.14)";
|
|
692
|
+
var CHEEK_DEEP = "rgba(120, 10, 30, 0.35)";
|
|
693
|
+
var CHEEK_WARM = "rgba(234, 67, 53, 0.4)";
|
|
694
|
+
var LOOKS = [
|
|
695
|
+
{ color: MINT, eye: "#1D3B27", cheek: CHEEK, eyeY: 21, gap: 8 },
|
|
696
|
+
{ color: BLUE, eye: WHITE, cheek: CHEEK, eyeY: 23, gap: 8 },
|
|
697
|
+
{ color: RED, eye: WHITE, cheek: CHEEK_DEEP, eyeY: 22, gap: 8 },
|
|
698
|
+
{ color: CREAM, eye: "#4A3420", cheek: "rgba(240, 120, 120, 0.5)", accent: "#DDBF8E", eyeY: 22, gap: 7.6 },
|
|
699
|
+
{ color: GREEN, eye: WHITE, cheek: CHEEK, eyeY: 19, gap: 7.2 },
|
|
700
|
+
{ color: INDIGO, eye: WHITE, cheek: CHEEK, eyeY: 20, gap: 7.4 },
|
|
701
|
+
{ color: YELLOW, eye: INK, cheek: CHEEK_WARM, accent: "#F29900", eyeY: 24, gap: 8.4 },
|
|
702
|
+
{ color: VIOLET, eye: "#22134A", cheek: CHEEK, eyeY: 20, gap: 8 },
|
|
703
|
+
{ color: MIST, eye: "#2B3245", cheek: CHEEK, eyeY: 19, gap: 7.6 },
|
|
704
|
+
{ color: SKY, eye: WHITE, cheek: CHEEK, eyeY: 21, gap: 6.4 },
|
|
705
|
+
{ color: ORANGE, eye: "#3D1C08", cheek: CHEEK, accent: GREEN, eyeY: 22, gap: 8.6, brows: true },
|
|
706
|
+
{ color: WHITE, eye: WHITE, cheek: CHEEK, accent: INK, mouth: INK, eyeY: 22, gap: 10 },
|
|
707
|
+
{ color: TEAL, eye: WHITE, cheek: CHEEK, accent: "#1B8A84", eyeY: 22.5, gap: 8.4 },
|
|
708
|
+
{ color: PINK, eye: "#4A1428", cheek: "rgba(160, 20, 70, 0.3)", eyeY: 24, gap: 7.4 },
|
|
709
|
+
{ color: LILAC, eye: "#2A1A5E", cheek: CHEEK, eyeY: 25, gap: 8 },
|
|
710
|
+
{ color: YELLOW, eye: INK, cheek: CHEEK_WARM, eyeY: 25, gap: 7.4 }
|
|
711
|
+
];
|
|
712
|
+
function corners(count, radius, cx, cy, inner) {
|
|
713
|
+
const points = [];
|
|
714
|
+
const steps = inner ? count * 2 : count;
|
|
715
|
+
for (let index = 0;index < steps; index++) {
|
|
716
|
+
const r = inner && index % 2 === 1 ? inner : radius;
|
|
717
|
+
const angle = -Math.PI / 2 + index * 2 * Math.PI / steps;
|
|
718
|
+
points.push(`${(cx + r * Math.cos(angle)).toFixed(2)},${(cy + r * Math.sin(angle)).toFixed(2)}`);
|
|
719
|
+
}
|
|
720
|
+
return points.join(" ");
|
|
721
|
+
}
|
|
722
|
+
var PENTAGON = corners(5, 13.5, 20, 21.5);
|
|
723
|
+
var HEXAGON = corners(6, 14, 20, 20);
|
|
724
|
+
var STAR = corners(5, 15.5, 20, 21.5, 8.6);
|
|
725
|
+
function Rounded({ points, color, width = 5 }) {
|
|
726
|
+
return /* @__PURE__ */ React.createElement("polygon", {
|
|
727
|
+
points,
|
|
728
|
+
fill: color,
|
|
729
|
+
stroke: color,
|
|
730
|
+
strokeWidth: width,
|
|
731
|
+
strokeLinejoin: "round"
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
function shape(face, look) {
|
|
735
|
+
const { color, accent = color } = look;
|
|
736
|
+
switch (face) {
|
|
737
|
+
case 1:
|
|
738
|
+
return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement(Rounded, {
|
|
739
|
+
points: "7.5,6.5 17,12 8.5,18",
|
|
740
|
+
color,
|
|
741
|
+
width: 4
|
|
742
|
+
}), /* @__PURE__ */ React.createElement(Rounded, {
|
|
743
|
+
points: "32.5,6.5 23,12 31.5,18",
|
|
744
|
+
color,
|
|
745
|
+
width: 4
|
|
746
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
747
|
+
cx: "20",
|
|
748
|
+
cy: "23",
|
|
749
|
+
rx: "14.5",
|
|
750
|
+
ry: "12.5",
|
|
751
|
+
fill: color
|
|
752
|
+
}));
|
|
753
|
+
case 2:
|
|
754
|
+
return /* @__PURE__ */ React.createElement(Rounded, {
|
|
755
|
+
points: PENTAGON,
|
|
756
|
+
color
|
|
757
|
+
});
|
|
758
|
+
case 3:
|
|
759
|
+
return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("circle", {
|
|
760
|
+
cx: "9.5",
|
|
761
|
+
cy: "10.5",
|
|
762
|
+
r: "5.5",
|
|
763
|
+
fill: color
|
|
764
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
765
|
+
cx: "30.5",
|
|
766
|
+
cy: "10.5",
|
|
767
|
+
r: "5.5",
|
|
768
|
+
fill: color
|
|
769
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
770
|
+
cx: "9.5",
|
|
771
|
+
cy: "10.5",
|
|
772
|
+
r: "2.6",
|
|
773
|
+
fill: accent
|
|
774
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
775
|
+
cx: "30.5",
|
|
776
|
+
cy: "10.5",
|
|
777
|
+
r: "2.6",
|
|
778
|
+
fill: accent
|
|
779
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
780
|
+
cx: "20",
|
|
781
|
+
cy: "22.5",
|
|
782
|
+
rx: "14.5",
|
|
783
|
+
ry: "13",
|
|
784
|
+
fill: color
|
|
785
|
+
}));
|
|
786
|
+
case 4:
|
|
787
|
+
return /* @__PURE__ */ React.createElement("rect", {
|
|
788
|
+
x: "8.5",
|
|
789
|
+
y: "4",
|
|
790
|
+
width: "23",
|
|
791
|
+
height: "32",
|
|
792
|
+
rx: "11.5",
|
|
793
|
+
fill: color
|
|
794
|
+
});
|
|
795
|
+
case 5:
|
|
796
|
+
return /* @__PURE__ */ React.createElement(Rounded, {
|
|
797
|
+
points: "20,5.5 34.5,20 20,34.5 5.5,20",
|
|
798
|
+
color,
|
|
799
|
+
width: 5.5
|
|
800
|
+
});
|
|
801
|
+
case 6:
|
|
802
|
+
return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("ellipse", {
|
|
803
|
+
cx: "20",
|
|
804
|
+
cy: "11",
|
|
805
|
+
rx: "3.2",
|
|
806
|
+
ry: "3.6",
|
|
807
|
+
fill: accent
|
|
808
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
809
|
+
d: "M20 12.5c9.2 0 15.5 5.6 15.5 12.4 0 6.4-6.9 10.1-15.5 10.1S4.5 31.3 4.5 24.9C4.5 18.1 10.8 12.5 20 12.5Z",
|
|
810
|
+
fill: color
|
|
811
|
+
}));
|
|
812
|
+
case 7:
|
|
813
|
+
return /* @__PURE__ */ React.createElement(Rounded, {
|
|
814
|
+
points: HEXAGON,
|
|
815
|
+
color
|
|
816
|
+
});
|
|
817
|
+
case 8:
|
|
818
|
+
return /* @__PURE__ */ React.createElement("path", {
|
|
819
|
+
d: "M8 19a12 12 0 0 1 24 0v14l-4-3-4 3-4-3-4 3-4-3-4 3Z",
|
|
820
|
+
fill: color,
|
|
821
|
+
stroke: EDGE,
|
|
822
|
+
strokeWidth: "0.8",
|
|
823
|
+
strokeLinejoin: "round"
|
|
824
|
+
});
|
|
825
|
+
case 9:
|
|
826
|
+
return /* @__PURE__ */ React.createElement(Rounded, {
|
|
827
|
+
points: STAR,
|
|
828
|
+
color,
|
|
829
|
+
width: 4.5
|
|
830
|
+
});
|
|
831
|
+
case 10:
|
|
832
|
+
return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("rect", {
|
|
833
|
+
x: "18.6",
|
|
834
|
+
y: "4.5",
|
|
835
|
+
width: "2.8",
|
|
836
|
+
height: "7",
|
|
837
|
+
rx: "1.4",
|
|
838
|
+
fill: accent
|
|
839
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
840
|
+
cx: "12.5",
|
|
841
|
+
cy: "23",
|
|
842
|
+
rx: "8.5",
|
|
843
|
+
ry: "11",
|
|
844
|
+
fill: color
|
|
845
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
846
|
+
cx: "27.5",
|
|
847
|
+
cy: "23",
|
|
848
|
+
rx: "8.5",
|
|
849
|
+
ry: "11",
|
|
850
|
+
fill: color
|
|
851
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
852
|
+
cx: "20",
|
|
853
|
+
cy: "22.5",
|
|
854
|
+
rx: "9.5",
|
|
855
|
+
ry: "12",
|
|
856
|
+
fill: color
|
|
857
|
+
}));
|
|
858
|
+
case 11:
|
|
859
|
+
return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("circle", {
|
|
860
|
+
cx: "9.5",
|
|
861
|
+
cy: "10",
|
|
862
|
+
r: "5",
|
|
863
|
+
fill: accent
|
|
864
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
865
|
+
cx: "30.5",
|
|
866
|
+
cy: "10",
|
|
867
|
+
r: "5",
|
|
868
|
+
fill: accent
|
|
869
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
870
|
+
cx: "20",
|
|
871
|
+
cy: "22.5",
|
|
872
|
+
rx: "14.5",
|
|
873
|
+
ry: "13",
|
|
874
|
+
fill: color,
|
|
875
|
+
stroke: EDGE,
|
|
876
|
+
strokeWidth: "0.8"
|
|
877
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
878
|
+
cx: "14.6",
|
|
879
|
+
cy: "22",
|
|
880
|
+
rx: "3.6",
|
|
881
|
+
ry: "4.4",
|
|
882
|
+
transform: "rotate(20 14.6 22)",
|
|
883
|
+
fill: accent
|
|
884
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
885
|
+
cx: "25.4",
|
|
886
|
+
cy: "22",
|
|
887
|
+
rx: "3.6",
|
|
888
|
+
ry: "4.4",
|
|
889
|
+
transform: "rotate(-20 25.4 22)",
|
|
890
|
+
fill: accent
|
|
891
|
+
}));
|
|
892
|
+
case 12:
|
|
893
|
+
return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("rect", {
|
|
894
|
+
x: "19.1",
|
|
895
|
+
y: "6",
|
|
896
|
+
width: "1.8",
|
|
897
|
+
height: "7",
|
|
898
|
+
fill: accent
|
|
899
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
900
|
+
cx: "20",
|
|
901
|
+
cy: "5",
|
|
902
|
+
r: "2.2",
|
|
903
|
+
fill: accent
|
|
904
|
+
}), /* @__PURE__ */ React.createElement("rect", {
|
|
905
|
+
x: "5.5",
|
|
906
|
+
y: "12",
|
|
907
|
+
width: "29",
|
|
908
|
+
height: "22.5",
|
|
909
|
+
rx: "6.5",
|
|
910
|
+
fill: color
|
|
911
|
+
}));
|
|
912
|
+
case 13:
|
|
913
|
+
return /* @__PURE__ */ React.createElement("path", {
|
|
914
|
+
d: "M20 4.5c2 0 13 11.6 13 20.2 0 6.4-5.8 10.8-13 10.8S7 31.1 7 24.7C7 16.1 18 4.5 20 4.5Z",
|
|
915
|
+
fill: color
|
|
916
|
+
});
|
|
917
|
+
case 14:
|
|
918
|
+
return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("ellipse", {
|
|
919
|
+
cx: "14",
|
|
920
|
+
cy: "10.5",
|
|
921
|
+
rx: "3.6",
|
|
922
|
+
ry: "8",
|
|
923
|
+
transform: "rotate(-8 14 10.5)",
|
|
924
|
+
fill: color
|
|
925
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
926
|
+
cx: "26",
|
|
927
|
+
cy: "10.5",
|
|
928
|
+
rx: "3.6",
|
|
929
|
+
ry: "8",
|
|
930
|
+
transform: "rotate(8 26 10.5)",
|
|
931
|
+
fill: color
|
|
932
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
933
|
+
cx: "20",
|
|
934
|
+
cy: "25",
|
|
935
|
+
rx: "14",
|
|
936
|
+
ry: "11",
|
|
937
|
+
fill: color
|
|
938
|
+
}));
|
|
939
|
+
case 15:
|
|
940
|
+
return /* @__PURE__ */ React.createElement(Rounded, {
|
|
941
|
+
points: "20,7 35,33 5,33",
|
|
942
|
+
color,
|
|
943
|
+
width: 6
|
|
944
|
+
});
|
|
945
|
+
default:
|
|
946
|
+
return /* @__PURE__ */ React.createElement("circle", {
|
|
947
|
+
cx: "20",
|
|
948
|
+
cy: "21",
|
|
949
|
+
r: "14.5",
|
|
950
|
+
fill: color
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
function Face({ face, size, working }) {
|
|
955
|
+
const look = LOOKS[face] ?? LOOKS[0];
|
|
956
|
+
const half = look.gap / 2;
|
|
957
|
+
const eyeW = 4.1;
|
|
958
|
+
const eyeH = 4.9;
|
|
959
|
+
const top = look.eyeY - eyeH / 2;
|
|
960
|
+
const cheekY = look.eyeY + 3.6;
|
|
961
|
+
const cheekX = half + 2.2;
|
|
962
|
+
const mouthY = look.eyeY + 3.4;
|
|
963
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
964
|
+
className: `tac-face${working ? " tac-face-working" : ""}`,
|
|
965
|
+
style: { width: size, height: size },
|
|
966
|
+
"data-face": face,
|
|
967
|
+
"aria-hidden": "true"
|
|
968
|
+
}, /* @__PURE__ */ React.createElement("svg", {
|
|
969
|
+
viewBox: "0 0 40 40",
|
|
970
|
+
width: size,
|
|
971
|
+
height: size,
|
|
972
|
+
focusable: "false",
|
|
973
|
+
"aria-hidden": "true"
|
|
974
|
+
}, /* @__PURE__ */ React.createElement("g", {
|
|
975
|
+
className: "tac-face-body"
|
|
976
|
+
}, shape(face, look), /* @__PURE__ */ React.createElement("g", {
|
|
977
|
+
className: "tac-face-look"
|
|
978
|
+
}, /* @__PURE__ */ React.createElement("g", {
|
|
979
|
+
fill: look.cheek
|
|
980
|
+
}, /* @__PURE__ */ React.createElement("ellipse", {
|
|
981
|
+
cx: 20 - cheekX,
|
|
982
|
+
cy: cheekY,
|
|
983
|
+
rx: "2.2",
|
|
984
|
+
ry: "1.25"
|
|
985
|
+
}), /* @__PURE__ */ React.createElement("ellipse", {
|
|
986
|
+
cx: 20 + cheekX,
|
|
987
|
+
cy: cheekY,
|
|
988
|
+
rx: "2.2",
|
|
989
|
+
ry: "1.25"
|
|
990
|
+
})), look.brows && /* @__PURE__ */ React.createElement("path", {
|
|
991
|
+
d: `M${20 - half - 3.4} ${top - 2.6}l3.6 1.6M${20 + half + 3.4} ${top - 2.6}l-3.6 1.6`,
|
|
992
|
+
stroke: look.eye,
|
|
993
|
+
strokeWidth: "1.4",
|
|
994
|
+
strokeLinecap: "round",
|
|
995
|
+
fill: "none"
|
|
996
|
+
}), /* @__PURE__ */ React.createElement("g", {
|
|
997
|
+
className: "tac-face-eyes",
|
|
998
|
+
fill: look.eye
|
|
999
|
+
}, /* @__PURE__ */ React.createElement("rect", {
|
|
1000
|
+
x: 20 - half - eyeW / 2,
|
|
1001
|
+
y: top,
|
|
1002
|
+
width: eyeW,
|
|
1003
|
+
height: eyeH,
|
|
1004
|
+
rx: eyeW / 2
|
|
1005
|
+
}), /* @__PURE__ */ React.createElement("rect", {
|
|
1006
|
+
x: 20 + half - eyeW / 2,
|
|
1007
|
+
y: top,
|
|
1008
|
+
width: eyeW,
|
|
1009
|
+
height: eyeH,
|
|
1010
|
+
rx: eyeW / 2
|
|
1011
|
+
})), /* @__PURE__ */ React.createElement("path", {
|
|
1012
|
+
d: `M18.1 ${mouthY}q.95 1.25 1.9 0q.95 1.25 1.9 0`,
|
|
1013
|
+
fill: "none",
|
|
1014
|
+
stroke: look.mouth ?? look.eye,
|
|
1015
|
+
strokeWidth: "1.1",
|
|
1016
|
+
strokeLinecap: "round",
|
|
1017
|
+
strokeLinejoin: "round"
|
|
1018
|
+
})))));
|
|
1019
|
+
}
|
|
1020
|
+
function RoomFace({ members, faces, size, working }) {
|
|
1021
|
+
const [lead, next] = members;
|
|
1022
|
+
if (!lead) {
|
|
1023
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
1024
|
+
className: "tac-room",
|
|
1025
|
+
style: { width: size, height: size }
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
if (!next) {
|
|
1029
|
+
return /* @__PURE__ */ React.createElement(Face, {
|
|
1030
|
+
face: faces.get(lead.id) ?? 0,
|
|
1031
|
+
size,
|
|
1032
|
+
working: working.includes(lead.id)
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
const small = Math.round(size * 0.72);
|
|
1036
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
1037
|
+
className: "tac-room",
|
|
1038
|
+
style: { width: size, height: size },
|
|
1039
|
+
"aria-hidden": "true"
|
|
1040
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1041
|
+
className: "tac-room-back"
|
|
1042
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1043
|
+
face: faces.get(next.id) ?? 0,
|
|
1044
|
+
size: small,
|
|
1045
|
+
working: working.includes(next.id)
|
|
1046
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
1047
|
+
className: "tac-room-front"
|
|
1048
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1049
|
+
face: faces.get(lead.id) ?? 0,
|
|
1050
|
+
size: small,
|
|
1051
|
+
working: working.includes(lead.id)
|
|
1052
|
+
})));
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// web-src/i18n.ts
|
|
1056
|
+
var EN = {
|
|
1057
|
+
title: "Agents",
|
|
1058
|
+
channels: "Channels",
|
|
1059
|
+
agents: "Agents",
|
|
1060
|
+
newChannel: "New channel",
|
|
1061
|
+
newAgent: "New agent",
|
|
1062
|
+
name: "Name",
|
|
1063
|
+
role: "Role",
|
|
1064
|
+
rolePlaceholder: "What it does and how, as instructions to it",
|
|
1065
|
+
topic: "Topic",
|
|
1066
|
+
members: "Members",
|
|
1067
|
+
addMembers: "Add members",
|
|
1068
|
+
add: "Add",
|
|
1069
|
+
allMembers: "Every agent is in this channel already; create another one.",
|
|
1070
|
+
membersHint: "The first one you pick leads: it answers what names nobody.",
|
|
1071
|
+
create: "Create",
|
|
1072
|
+
cancel: "Cancel",
|
|
1073
|
+
back: "Back",
|
|
1074
|
+
send: "Send",
|
|
1075
|
+
you: "You",
|
|
1076
|
+
ta: "Ta",
|
|
1077
|
+
lead: "Lead",
|
|
1078
|
+
empty: 'No channels yet. Ask Ta for a team, for example: "Make a channel where a designer and an engineer review this page", or create one here.',
|
|
1079
|
+
noAgents: "Create an agent first: a channel is made of agents.",
|
|
1080
|
+
pick: "Pick a channel.",
|
|
1081
|
+
quiet: "Nothing said yet. Mention a member with @, or the lead answers.",
|
|
1082
|
+
placeholder: "Message {channel}; @ names a member",
|
|
1083
|
+
answering: "{name} is answering",
|
|
1084
|
+
failed: "did not answer",
|
|
1085
|
+
mention: "Mention {name}",
|
|
1086
|
+
stopped: "The agents stopped at the limit of a round; it is your turn.",
|
|
1087
|
+
search: "Search",
|
|
1088
|
+
clear: "Clear",
|
|
1089
|
+
new: "New",
|
|
1090
|
+
idle: "Idle",
|
|
1091
|
+
answeringIn: "Answering in #{channel}",
|
|
1092
|
+
answeringNow: "{name} is answering…",
|
|
1093
|
+
noMatch: "No agent or channel matches.",
|
|
1094
|
+
noMessages: "No messages yet",
|
|
1095
|
+
leadOf: "Lead: {name}",
|
|
1096
|
+
noAgentsYet: "No agents yet. Ask Ta for a team, or create one with +.",
|
|
1097
|
+
myDouble: "My double",
|
|
1098
|
+
memberCount: "{count} members",
|
|
1099
|
+
channel: "Channel",
|
|
1100
|
+
newAgentName: "new-agent",
|
|
1101
|
+
notStarted: "Not started yet",
|
|
1102
|
+
editAgent: "Change the name and the avatar",
|
|
1103
|
+
avatar: "Avatar",
|
|
1104
|
+
newAgentHint: "Pick a name and an avatar above, then tell it what to do first: your first message makes it.",
|
|
1105
|
+
agentPlaceholder: "Message {name}",
|
|
1106
|
+
channelNamePlaceholder: "For example: Project Falcon",
|
|
1107
|
+
addAgents: "Add agents",
|
|
1108
|
+
searchAgents: "Search agents, pick 1 to {max}",
|
|
1109
|
+
showMembers: "Members",
|
|
1110
|
+
canAdd: "{count} agents can join",
|
|
1111
|
+
findAgent: "Search agents",
|
|
1112
|
+
addCount: "Add {count}",
|
|
1113
|
+
makeLead: "Make lead",
|
|
1114
|
+
leadHint: "Answers what names nobody",
|
|
1115
|
+
mute: "Mute: answers nothing here",
|
|
1116
|
+
unmute: "Let it answer again",
|
|
1117
|
+
muted: "Muted",
|
|
1118
|
+
replying: "Answering…",
|
|
1119
|
+
reset: "New session: it forgets what it was told",
|
|
1120
|
+
resetDone: "{name} starts a new session the next time it answers.",
|
|
1121
|
+
remove: "Remove from the channel",
|
|
1122
|
+
onlyMember: "A channel keeps at least one member",
|
|
1123
|
+
open: "Open its session",
|
|
1124
|
+
deleteChannel: "Delete channel",
|
|
1125
|
+
confirmDelete: "Delete #{channel} and its messages?",
|
|
1126
|
+
delete: "Delete",
|
|
1127
|
+
noChannel: "Open a channel to see its members.",
|
|
1128
|
+
more: "More",
|
|
1129
|
+
stop: "Stop",
|
|
1130
|
+
stoppedAgent: "Stopped {name}.",
|
|
1131
|
+
restart: "Restart",
|
|
1132
|
+
restartHint: "A new session: it forgets what it was told",
|
|
1133
|
+
rename: "Rename",
|
|
1134
|
+
editRole: "Role",
|
|
1135
|
+
roleHint: "What it reads first, before anything else: who it is and how it works. It takes effect from its next session; Restart to use it now.",
|
|
1136
|
+
save: "Save",
|
|
1137
|
+
moveTo: "Move to…",
|
|
1138
|
+
moveHint: "Works in another directory, in a new session there",
|
|
1139
|
+
copyCwd: "Copy directory",
|
|
1140
|
+
copied: "Copied {path}",
|
|
1141
|
+
exportChat: "Export conversation (Markdown)",
|
|
1142
|
+
nothingToExport: "{name} has said nothing yet.",
|
|
1143
|
+
joinChannel: "Add to channel",
|
|
1144
|
+
noChannelToJoin: "It is in every channel already.",
|
|
1145
|
+
joined: "{name} joined #{channel}.",
|
|
1146
|
+
deleteAgent: "Delete",
|
|
1147
|
+
confirmDeleteAgent: "Delete {name}? It leaves its channels, and channels with no one else go too; its session file stays.",
|
|
1148
|
+
pin: "Pin",
|
|
1149
|
+
unpin: "Unpin",
|
|
1150
|
+
pinned: "Pinned",
|
|
1151
|
+
markUnread: "Mark as unread",
|
|
1152
|
+
markRead: "Mark as read",
|
|
1153
|
+
editTopic: "Topic",
|
|
1154
|
+
topicPlaceholder: "What the channel is for",
|
|
1155
|
+
renameChannel: "Rename #{channel}",
|
|
1156
|
+
stopAnswering: "Stop answering",
|
|
1157
|
+
stoppedChannel: "Stopped the members answering in #{channel}.",
|
|
1158
|
+
noMessagesToExport: "#{channel} has no messages yet."
|
|
1159
|
+
};
|
|
1160
|
+
var ZH = {
|
|
1161
|
+
title: "智能体",
|
|
1162
|
+
channels: "频道",
|
|
1163
|
+
agents: "智能体",
|
|
1164
|
+
newChannel: "新建频道",
|
|
1165
|
+
newAgent: "新建智能体",
|
|
1166
|
+
name: "名字",
|
|
1167
|
+
role: "职责",
|
|
1168
|
+
rolePlaceholder: "它做什么、怎么做,写成给它的指示",
|
|
1169
|
+
topic: "主题",
|
|
1170
|
+
members: "成员",
|
|
1171
|
+
addMembers: "添加成员",
|
|
1172
|
+
add: "添加",
|
|
1173
|
+
allMembers: "所有智能体都已在这个频道里,可以再新建一个。",
|
|
1174
|
+
membersHint: "先选的成员是负责人:没人被 @ 的消息由它回答。",
|
|
1175
|
+
create: "创建",
|
|
1176
|
+
cancel: "取消",
|
|
1177
|
+
back: "返回",
|
|
1178
|
+
send: "发送",
|
|
1179
|
+
you: "你",
|
|
1180
|
+
ta: "Ta",
|
|
1181
|
+
lead: "负责人",
|
|
1182
|
+
empty: "还没有频道。可以让 Ta 组个团队,比如“建个频道,让设计师和工程师一起评审这个页面”,也可以在这里自己建。",
|
|
1183
|
+
noAgents: "先建一个智能体:频道由智能体组成。",
|
|
1184
|
+
pick: "选一个频道。",
|
|
1185
|
+
quiet: "还没有消息。用 @ 点名成员,不点名就由负责人回答。",
|
|
1186
|
+
placeholder: "发到 {channel};@ 点名成员",
|
|
1187
|
+
answering: "{name} 正在回答",
|
|
1188
|
+
failed: "没有回答",
|
|
1189
|
+
mention: "@{name}",
|
|
1190
|
+
stopped: "已到交接上限,等你继续。",
|
|
1191
|
+
search: "搜索智能体",
|
|
1192
|
+
clear: "清除",
|
|
1193
|
+
new: "新建",
|
|
1194
|
+
idle: "空闲",
|
|
1195
|
+
answeringIn: "正在 #{channel} 回答",
|
|
1196
|
+
answeringNow: "{name} 正在回答…",
|
|
1197
|
+
noMatch: "没有匹配的智能体或频道。",
|
|
1198
|
+
noMessages: "还没有消息",
|
|
1199
|
+
leadOf: "负责人:{name}",
|
|
1200
|
+
noAgentsYet: "还没有智能体。可以让 Ta 组个团队,也可以点 + 新建。",
|
|
1201
|
+
myDouble: "我的分身",
|
|
1202
|
+
memberCount: "{count} 位成员",
|
|
1203
|
+
channel: "频道",
|
|
1204
|
+
newAgentName: "新智能体",
|
|
1205
|
+
notStarted: "还没开工",
|
|
1206
|
+
editAgent: "修改名字和头像",
|
|
1207
|
+
avatar: "头像",
|
|
1208
|
+
newAgentHint: "在上面起个名字、挑个头像,再告诉它先做什么:发出第一条消息就建好了。",
|
|
1209
|
+
agentPlaceholder: "给 {name} 发消息",
|
|
1210
|
+
channelNamePlaceholder: "例如:官网改版",
|
|
1211
|
+
addAgents: "添加智能体",
|
|
1212
|
+
searchAgents: "搜索智能体,选择 1–{max} 个",
|
|
1213
|
+
showMembers: "频道成员",
|
|
1214
|
+
canAdd: "还能添加 {count} 个智能体",
|
|
1215
|
+
findAgent: "搜索智能体",
|
|
1216
|
+
addCount: "添加 {count} 位",
|
|
1217
|
+
makeLead: "设为负责人",
|
|
1218
|
+
leadHint: "回答没有 @ 任何人的消息",
|
|
1219
|
+
mute: "免打扰:不回答这个频道的消息",
|
|
1220
|
+
unmute: "取消免打扰",
|
|
1221
|
+
muted: "免打扰",
|
|
1222
|
+
replying: "正在回答…",
|
|
1223
|
+
reset: "重开会话:忘掉之前的对话",
|
|
1224
|
+
resetDone: "{name} 下次回答时会从新会话开始。",
|
|
1225
|
+
remove: "移出频道",
|
|
1226
|
+
onlyMember: "频道至少要留一位成员",
|
|
1227
|
+
open: "打开它的会话",
|
|
1228
|
+
deleteChannel: "删除频道",
|
|
1229
|
+
confirmDelete: "删除 #{channel} 和它的全部消息?",
|
|
1230
|
+
delete: "删除",
|
|
1231
|
+
noChannel: "打开一个频道,这里显示它的成员。",
|
|
1232
|
+
more: "更多",
|
|
1233
|
+
stop: "停止",
|
|
1234
|
+
stoppedAgent: "已停止 {name}。",
|
|
1235
|
+
restart: "重新开始",
|
|
1236
|
+
restartHint: "开一个新会话:忘掉之前的对话",
|
|
1237
|
+
rename: "重命名",
|
|
1238
|
+
editRole: "职责",
|
|
1239
|
+
roleHint: "它最先读到的指示:它是谁、怎么做事。从下一个会话开始生效;想立刻生效可以“重新开始”。",
|
|
1240
|
+
save: "保存",
|
|
1241
|
+
moveTo: "移至…",
|
|
1242
|
+
moveHint: "换一个目录工作,会在那里开新会话",
|
|
1243
|
+
copyCwd: "复制工作目录",
|
|
1244
|
+
copied: "已复制 {path}",
|
|
1245
|
+
exportChat: "导出对话(Markdown)",
|
|
1246
|
+
nothingToExport: "{name} 还没有说过话。",
|
|
1247
|
+
joinChannel: "加入频道",
|
|
1248
|
+
noChannelToJoin: "它已经在所有频道里了。",
|
|
1249
|
+
joined: "{name} 已加入 #{channel}。",
|
|
1250
|
+
deleteAgent: "删除",
|
|
1251
|
+
confirmDeleteAgent: "删除 {name}?它会退出所在的频道,只剩它一个成员的频道也会一起删除;会话文件会保留。",
|
|
1252
|
+
pin: "置顶",
|
|
1253
|
+
unpin: "取消置顶",
|
|
1254
|
+
pinned: "已置顶",
|
|
1255
|
+
markUnread: "标为未读",
|
|
1256
|
+
markRead: "标为已读",
|
|
1257
|
+
editTopic: "修改主题",
|
|
1258
|
+
topicPlaceholder: "这个频道是做什么的",
|
|
1259
|
+
renameChannel: "重命名 #{channel}",
|
|
1260
|
+
stopAnswering: "停止回答",
|
|
1261
|
+
stoppedChannel: "已让 #{channel} 里正在回答的成员停下。",
|
|
1262
|
+
noMessagesToExport: "#{channel} 还没有消息。"
|
|
1263
|
+
};
|
|
1264
|
+
var ChannelWords;
|
|
1265
|
+
((ChannelWords) => {
|
|
1266
|
+
function of(language) {
|
|
1267
|
+
return language === "zh-CN" ? ZH : EN;
|
|
1268
|
+
}
|
|
1269
|
+
ChannelWords.of = of;
|
|
1270
|
+
function format(text, values) {
|
|
1271
|
+
return text.replace(/\{(\w+)\}/g, (whole, key) => values[key] ?? whole);
|
|
1272
|
+
}
|
|
1273
|
+
ChannelWords.format = format;
|
|
1274
|
+
})(ChannelWords ||= {});
|
|
1275
|
+
|
|
1276
|
+
// web-src/views.tsx
|
|
1277
|
+
var DOUBLE_PAGE = "assistant/assistant";
|
|
1278
|
+
var CHANNEL_PAGE = `${NAME}/channel`;
|
|
1279
|
+
var MEMBERS_VIEW = `${NAME}/members`;
|
|
1280
|
+
var CHANNEL_KEY = "ta-channels.channel";
|
|
1281
|
+
|
|
1282
|
+
class ChannelsUiStore {
|
|
1283
|
+
current = {
|
|
1284
|
+
query: "",
|
|
1285
|
+
fresh: [],
|
|
1286
|
+
adding: false,
|
|
1287
|
+
editing: false,
|
|
1288
|
+
creating: false,
|
|
1289
|
+
channelId: (typeof sessionStorage === "undefined" ? undefined : sessionStorage.getItem(CHANNEL_KEY)) ?? undefined
|
|
1290
|
+
};
|
|
1291
|
+
listeners = new Set;
|
|
1292
|
+
get state() {
|
|
1293
|
+
return this.current;
|
|
1294
|
+
}
|
|
1295
|
+
subscribe(listener) {
|
|
1296
|
+
this.listeners.add(listener);
|
|
1297
|
+
return () => this.listeners.delete(listener);
|
|
1298
|
+
}
|
|
1299
|
+
set(change) {
|
|
1300
|
+
this.current = { ...this.current, ...change };
|
|
1301
|
+
if (change.channelId && typeof sessionStorage !== "undefined") {
|
|
1302
|
+
sessionStorage.setItem(CHANNEL_KEY, change.channelId);
|
|
1303
|
+
}
|
|
1304
|
+
for (const listener of this.listeners) {
|
|
1305
|
+
listener();
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
var ChannelViews;
|
|
1310
|
+
((ChannelViews) => {
|
|
1311
|
+
function words(pi) {
|
|
1312
|
+
return ChannelWords.of(pi.ui.language);
|
|
1313
|
+
}
|
|
1314
|
+
ChannelViews.words = words;
|
|
1315
|
+
function icon(pi, name) {
|
|
1316
|
+
return pi.ui.icons[name] ?? (() => null);
|
|
1317
|
+
}
|
|
1318
|
+
ChannelViews.icon = icon;
|
|
1319
|
+
function maybeIcon(pi, name, fallback, size) {
|
|
1320
|
+
const Icon = pi.ui.icons[name];
|
|
1321
|
+
return Icon ? /* @__PURE__ */ React.createElement(Icon, {
|
|
1322
|
+
size
|
|
1323
|
+
}) : fallback;
|
|
1324
|
+
}
|
|
1325
|
+
ChannelViews.maybeIcon = maybeIcon;
|
|
1326
|
+
function message(error) {
|
|
1327
|
+
return error instanceof Error ? error.message : String(error);
|
|
1328
|
+
}
|
|
1329
|
+
ChannelViews.message = message;
|
|
1330
|
+
async function openAgent(context, agentId) {
|
|
1331
|
+
const sessionId = await context.service.openAgent(agentId);
|
|
1332
|
+
context.sessions.set(agentId, sessionId);
|
|
1333
|
+
await context.pi.switchSession(sessionId);
|
|
1334
|
+
}
|
|
1335
|
+
ChannelViews.openAgent = openAgent;
|
|
1336
|
+
})(ChannelViews ||= {});
|
|
1337
|
+
function useChannels(service) {
|
|
1338
|
+
const state = React.useSyncExternalStore((listener) => service.subscribe(listener), () => service.state);
|
|
1339
|
+
React.useEffect(() => {
|
|
1340
|
+
service.load(true);
|
|
1341
|
+
}, [service]);
|
|
1342
|
+
return state;
|
|
1343
|
+
}
|
|
1344
|
+
function useUi(ui) {
|
|
1345
|
+
return React.useSyncExternalStore((listener) => ui.subscribe(listener), () => ui.state);
|
|
1346
|
+
}
|
|
1347
|
+
function AgentAvatar({ agent, faces, size, working }) {
|
|
1348
|
+
return /* @__PURE__ */ React.createElement(Face, {
|
|
1349
|
+
face: agent ? faces.get(agent.id) ?? 0 : 0,
|
|
1350
|
+
size,
|
|
1351
|
+
working
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
function SessionAvatar({ context, session, mood, size }) {
|
|
1355
|
+
const { team } = React.useSyncExternalStore((listener) => context.service.subscribe(listener), () => context.service.state);
|
|
1356
|
+
const faces = useFaces(team);
|
|
1357
|
+
const agent = team.agents.find((candidate) => !!session.sessionFile && candidate.sessionFile === session.sessionFile || context.sessions.get(candidate.id) === session.sessionId);
|
|
1358
|
+
if (!agent) {
|
|
1359
|
+
const Avatar = context.pi.ui.Avatar;
|
|
1360
|
+
return /* @__PURE__ */ React.createElement(Avatar, {
|
|
1361
|
+
mood,
|
|
1362
|
+
size
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
return /* @__PURE__ */ React.createElement(AgentAvatar, {
|
|
1366
|
+
agent,
|
|
1367
|
+
faces,
|
|
1368
|
+
size,
|
|
1369
|
+
working: mood === "thinking" || mood === "working"
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
function useFaces(team) {
|
|
1373
|
+
return React.useMemo(() => ChannelsUtil.faces(team.agents), [team.agents]);
|
|
1374
|
+
}
|
|
1375
|
+
function membersOf(team, channel) {
|
|
1376
|
+
return channel.members.map((id) => team.agents.find((agent) => agent.id === id)).filter((agent) => !!agent);
|
|
1377
|
+
}
|
|
1378
|
+
function useServerCwd(pi) {
|
|
1379
|
+
const [cwd, setCwd] = React.useState();
|
|
1380
|
+
React.useEffect(() => {
|
|
1381
|
+
let live = true;
|
|
1382
|
+
pi.server.getServerInfo().then((info) => live && setCwd(info.cwd), () => {
|
|
1383
|
+
return;
|
|
1384
|
+
});
|
|
1385
|
+
return () => {
|
|
1386
|
+
live = false;
|
|
1387
|
+
};
|
|
1388
|
+
}, [pi]);
|
|
1389
|
+
return cwd;
|
|
1390
|
+
}
|
|
1391
|
+
var SidebarUtil;
|
|
1392
|
+
((SidebarUtil) => {
|
|
1393
|
+
function time(at, language, now = new Date) {
|
|
1394
|
+
if (!at) {
|
|
1395
|
+
return "";
|
|
1396
|
+
}
|
|
1397
|
+
const date = new Date(at);
|
|
1398
|
+
if (date.toDateString() === now.toDateString()) {
|
|
1399
|
+
return date.toLocaleTimeString(language, { hour: "2-digit", minute: "2-digit", hour12: false });
|
|
1400
|
+
}
|
|
1401
|
+
if (date.getFullYear() === now.getFullYear()) {
|
|
1402
|
+
return date.toLocaleDateString(language, { month: "numeric", day: "numeric" });
|
|
1403
|
+
}
|
|
1404
|
+
return date.toLocaleDateString(language, { year: "2-digit", month: "numeric", day: "numeric" });
|
|
1405
|
+
}
|
|
1406
|
+
SidebarUtil.time = time;
|
|
1407
|
+
function folder(cwd) {
|
|
1408
|
+
const parts = cwd.split(/[\\/]+/).filter(Boolean);
|
|
1409
|
+
return parts[parts.length - 1] ?? cwd;
|
|
1410
|
+
}
|
|
1411
|
+
SidebarUtil.folder = folder;
|
|
1412
|
+
function matches(query, ...texts) {
|
|
1413
|
+
const key = query.trim().toLowerCase();
|
|
1414
|
+
return !key || texts.some((text) => text?.toLowerCase().includes(key));
|
|
1415
|
+
}
|
|
1416
|
+
SidebarUtil.matches = matches;
|
|
1417
|
+
function byDirectory(agents, serverCwd) {
|
|
1418
|
+
const groups = new Map;
|
|
1419
|
+
for (const agent of agents) {
|
|
1420
|
+
const cwd = agent.cwd ?? serverCwd;
|
|
1421
|
+
groups.set(cwd, [...groups.get(cwd) ?? [], agent]);
|
|
1422
|
+
}
|
|
1423
|
+
return [...groups].map(([cwd, list]) => ({ cwd, agents: list }));
|
|
1424
|
+
}
|
|
1425
|
+
SidebarUtil.byDirectory = byDirectory;
|
|
1426
|
+
})(SidebarUtil ||= {});
|
|
1427
|
+
function useSubmit(action, onDone) {
|
|
1428
|
+
const [busy, setBusy] = React.useState(false);
|
|
1429
|
+
const [error, setError] = React.useState();
|
|
1430
|
+
return {
|
|
1431
|
+
busy,
|
|
1432
|
+
error,
|
|
1433
|
+
submit: (event) => {
|
|
1434
|
+
event?.preventDefault();
|
|
1435
|
+
setBusy(true);
|
|
1436
|
+
setError(undefined);
|
|
1437
|
+
action().then(() => {
|
|
1438
|
+
setBusy(false);
|
|
1439
|
+
onDone();
|
|
1440
|
+
}, (failure) => {
|
|
1441
|
+
setBusy(false);
|
|
1442
|
+
setError(ChannelViews.message(failure));
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
// web-src/create.tsx
|
|
1449
|
+
var AGENT_PAGE = `${NAME}/agent`;
|
|
1450
|
+
function newAgent(context) {
|
|
1451
|
+
const { pi, service, ui } = context;
|
|
1452
|
+
if (!ui.state.draft) {
|
|
1453
|
+
const team = service.state.team;
|
|
1454
|
+
const name = ChannelsUtil.freeName(team, ChannelViews.words(pi).newAgentName);
|
|
1455
|
+
ui.set({ draft: { name, face: ChannelsUtil.freeFaceFor(team.agents, ChannelsUtil.newId("draft")) } });
|
|
1456
|
+
}
|
|
1457
|
+
pi.ui.showView(AGENT_PAGE);
|
|
1458
|
+
}
|
|
1459
|
+
function Identity({ context, onClose }) {
|
|
1460
|
+
const { pi, ui } = context;
|
|
1461
|
+
const { draft } = useUi(ui);
|
|
1462
|
+
const w = ChannelViews.words(pi);
|
|
1463
|
+
const ref = React.useRef(null);
|
|
1464
|
+
const name = React.useRef(null);
|
|
1465
|
+
React.useEffect(() => name.current?.select(), []);
|
|
1466
|
+
React.useEffect(() => {
|
|
1467
|
+
const close = (event) => {
|
|
1468
|
+
const target = event.target;
|
|
1469
|
+
if (!ref.current?.contains(target) && !target.closest?.(".tac-identity-open")) {
|
|
1470
|
+
onClose();
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
const onKey = (event) => event.key === "Escape" && onClose();
|
|
1474
|
+
document.addEventListener("pointerdown", close);
|
|
1475
|
+
document.addEventListener("keydown", onKey);
|
|
1476
|
+
return () => {
|
|
1477
|
+
document.removeEventListener("pointerdown", close);
|
|
1478
|
+
document.removeEventListener("keydown", onKey);
|
|
1479
|
+
};
|
|
1480
|
+
}, [onClose]);
|
|
1481
|
+
if (!draft) {
|
|
1482
|
+
return null;
|
|
1483
|
+
}
|
|
1484
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1485
|
+
className: "tac-identity",
|
|
1486
|
+
ref,
|
|
1487
|
+
role: "dialog",
|
|
1488
|
+
"aria-label": w.editAgent
|
|
1489
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
1490
|
+
className: "tac-identity-label"
|
|
1491
|
+
}, w.name, /* @__PURE__ */ React.createElement("input", {
|
|
1492
|
+
className: "tac-input",
|
|
1493
|
+
value: draft.name,
|
|
1494
|
+
maxLength: 40,
|
|
1495
|
+
ref: name,
|
|
1496
|
+
onChange: (event) => ui.set({ draft: { ...draft, name: event.target.value } }),
|
|
1497
|
+
onKeyDown: (event) => event.key === "Enter" && onClose()
|
|
1498
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1499
|
+
className: "tac-identity-label"
|
|
1500
|
+
}, w.avatar), /* @__PURE__ */ React.createElement("div", {
|
|
1501
|
+
className: "tac-faces"
|
|
1502
|
+
}, Array.from({ length: FACES }, (_, face) => /* @__PURE__ */ React.createElement("button", {
|
|
1503
|
+
key: face,
|
|
1504
|
+
type: "button",
|
|
1505
|
+
"aria-pressed": draft.face === face,
|
|
1506
|
+
className: `tac-face-pick${draft.face === face ? " tac-on" : ""}`,
|
|
1507
|
+
onClick: () => ui.set({ draft: { ...draft, face } })
|
|
1508
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1509
|
+
face,
|
|
1510
|
+
size: 30
|
|
1511
|
+
})))));
|
|
1512
|
+
}
|
|
1513
|
+
function NewAgentHead({ context }) {
|
|
1514
|
+
const { pi, ui } = context;
|
|
1515
|
+
const { draft, editing } = useUi(ui);
|
|
1516
|
+
const w = ChannelViews.words(pi);
|
|
1517
|
+
const Down = ChannelViews.icon(pi, "ChevronDown");
|
|
1518
|
+
if (!draft) {
|
|
1519
|
+
return null;
|
|
1520
|
+
}
|
|
1521
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1522
|
+
className: "tac-new-head"
|
|
1523
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1524
|
+
className: "tac-new-title"
|
|
1525
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1526
|
+
type: "button",
|
|
1527
|
+
className: "tac-new-trigger tac-identity-open",
|
|
1528
|
+
"aria-expanded": editing,
|
|
1529
|
+
title: w.editAgent,
|
|
1530
|
+
onClick: () => ui.set({ editing: !editing })
|
|
1531
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1532
|
+
face: draft.face,
|
|
1533
|
+
size: 20
|
|
1534
|
+
}), /* @__PURE__ */ React.createElement("span", null, draft.name || w.newAgentName), /* @__PURE__ */ React.createElement(Down, {
|
|
1535
|
+
size: 14
|
|
1536
|
+
})), editing && /* @__PURE__ */ React.createElement(Identity, {
|
|
1537
|
+
context,
|
|
1538
|
+
onClose: () => ui.set({ editing: false })
|
|
1539
|
+
})), /* @__PURE__ */ React.createElement("button", {
|
|
1540
|
+
type: "button",
|
|
1541
|
+
className: "tac-button tac-quiet",
|
|
1542
|
+
onClick: () => {
|
|
1543
|
+
ui.set({ draft: undefined, editing: false });
|
|
1544
|
+
pi.ui.showView("");
|
|
1545
|
+
}
|
|
1546
|
+
}, w.cancel));
|
|
1547
|
+
}
|
|
1548
|
+
function NewAgentPage({ context }) {
|
|
1549
|
+
const { pi, service, ui } = context;
|
|
1550
|
+
const { draft } = useUi(ui);
|
|
1551
|
+
const w = ChannelViews.words(pi);
|
|
1552
|
+
const Pencil = ChannelViews.icon(pi, "Pencil");
|
|
1553
|
+
const Composer = pi.ui.Composer;
|
|
1554
|
+
React.useEffect(() => {
|
|
1555
|
+
if (!draft) {
|
|
1556
|
+
newAgent(context);
|
|
1557
|
+
}
|
|
1558
|
+
}, [draft, context]);
|
|
1559
|
+
if (!draft) {
|
|
1560
|
+
return null;
|
|
1561
|
+
}
|
|
1562
|
+
const send = async (text) => {
|
|
1563
|
+
const agent = await service.createAgent({ name: draft.name, role: DEFAULT_ROLE, face: draft.face, cwd: draft.cwd });
|
|
1564
|
+
ui.set({ draft: undefined, editing: false });
|
|
1565
|
+
try {
|
|
1566
|
+
const sessionId = await service.openAgent(agent.id);
|
|
1567
|
+
context.sessions.set(agent.id, sessionId);
|
|
1568
|
+
await pi.switchSession(sessionId);
|
|
1569
|
+
await pi.sendUserMessage(text);
|
|
1570
|
+
} catch (error) {
|
|
1571
|
+
pi.ui.notify(ChannelViews.message(error), "error");
|
|
1572
|
+
}
|
|
1573
|
+
};
|
|
1574
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1575
|
+
className: "tac-new-page"
|
|
1576
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1577
|
+
className: "tac-new-col"
|
|
1578
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1579
|
+
face: draft.face,
|
|
1580
|
+
size: 88
|
|
1581
|
+
}), /* @__PURE__ */ React.createElement("h2", {
|
|
1582
|
+
className: "tac-new-name"
|
|
1583
|
+
}, /* @__PURE__ */ React.createElement("span", null, draft.name || w.newAgentName), /* @__PURE__ */ React.createElement("button", {
|
|
1584
|
+
type: "button",
|
|
1585
|
+
className: "tac-action tac-identity-open",
|
|
1586
|
+
title: w.editAgent,
|
|
1587
|
+
"aria-label": w.editAgent,
|
|
1588
|
+
onClick: () => ui.set({ editing: !ui.state.editing })
|
|
1589
|
+
}, /* @__PURE__ */ React.createElement(Pencil, {
|
|
1590
|
+
size: 14
|
|
1591
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
1592
|
+
className: "tac-new-hint"
|
|
1593
|
+
}, w.newAgentHint), /* @__PURE__ */ React.createElement("div", {
|
|
1594
|
+
className: "tac-new-box"
|
|
1595
|
+
}, /* @__PURE__ */ React.createElement(Composer, {
|
|
1596
|
+
placeholder: ChannelWords.format(w.agentPlaceholder, { name: draft.name || w.newAgentName }),
|
|
1597
|
+
onSend: send,
|
|
1598
|
+
cwd: draft.cwd,
|
|
1599
|
+
onPickCwd: (cwd) => ui.set({ draft: { ...draft, cwd } })
|
|
1600
|
+
}))));
|
|
1601
|
+
}
|
|
1602
|
+
function NewChannelDialog({ context, onClose }) {
|
|
1603
|
+
const { pi, service } = context;
|
|
1604
|
+
const { team } = useChannels(service);
|
|
1605
|
+
const faces = useFaces(team);
|
|
1606
|
+
const w = ChannelViews.words(pi);
|
|
1607
|
+
const Search = ChannelViews.icon(pi, "Search");
|
|
1608
|
+
const Check = ChannelViews.icon(pi, "Check");
|
|
1609
|
+
const [name, setName] = React.useState("");
|
|
1610
|
+
const [query, setQuery] = React.useState("");
|
|
1611
|
+
const [picked, setPicked] = React.useState([]);
|
|
1612
|
+
const [busy, setBusy] = React.useState(false);
|
|
1613
|
+
const [error, setError] = React.useState();
|
|
1614
|
+
const Dialog = pi.ui.Dialog;
|
|
1615
|
+
const shown = team.agents.filter((agent) => SidebarUtil.matches(query, agent.name, agent.role));
|
|
1616
|
+
const full = picked.length >= MAX_MEMBERS;
|
|
1617
|
+
const toggle = (agent) => setPicked(picked.includes(agent.id) ? picked.filter((id) => id !== agent.id) : full ? picked : [...picked, agent.id]);
|
|
1618
|
+
const create = (event) => {
|
|
1619
|
+
event.preventDefault();
|
|
1620
|
+
setBusy(true);
|
|
1621
|
+
setError(undefined);
|
|
1622
|
+
service.createChannel({ name, members: picked }).then((channel) => {
|
|
1623
|
+
onClose();
|
|
1624
|
+
context.showChannel(channel.id);
|
|
1625
|
+
}, (failure) => {
|
|
1626
|
+
setBusy(false);
|
|
1627
|
+
setError(ChannelViews.message(failure));
|
|
1628
|
+
});
|
|
1629
|
+
};
|
|
1630
|
+
return /* @__PURE__ */ React.createElement(Dialog, {
|
|
1631
|
+
title: w.newChannel,
|
|
1632
|
+
onClose
|
|
1633
|
+
}, /* @__PURE__ */ React.createElement("form", {
|
|
1634
|
+
className: "tac-dialog",
|
|
1635
|
+
onSubmit: create
|
|
1636
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
1637
|
+
className: "tac-dialog-label"
|
|
1638
|
+
}, w.name, /* @__PURE__ */ React.createElement("input", {
|
|
1639
|
+
className: "tac-input tac-dialog-input",
|
|
1640
|
+
value: name,
|
|
1641
|
+
placeholder: w.channelNamePlaceholder,
|
|
1642
|
+
maxLength: 40,
|
|
1643
|
+
autoFocus: true,
|
|
1644
|
+
onChange: (event) => setName(event.target.value)
|
|
1645
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1646
|
+
className: "tac-dialog-label"
|
|
1647
|
+
}, /* @__PURE__ */ React.createElement("span", null, w.addAgents), /* @__PURE__ */ React.createElement("span", {
|
|
1648
|
+
className: "tac-dialog-count"
|
|
1649
|
+
}, picked.length, "/", MAX_MEMBERS)), /* @__PURE__ */ React.createElement("label", {
|
|
1650
|
+
className: "tac-dialog-search"
|
|
1651
|
+
}, /* @__PURE__ */ React.createElement(Search, {
|
|
1652
|
+
size: 15
|
|
1653
|
+
}), /* @__PURE__ */ React.createElement("input", {
|
|
1654
|
+
value: query,
|
|
1655
|
+
placeholder: ChannelWords.format(w.searchAgents, { max: String(MAX_MEMBERS) }),
|
|
1656
|
+
"aria-label": w.search,
|
|
1657
|
+
onChange: (event) => setQuery(event.target.value)
|
|
1658
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1659
|
+
className: "tac-pick-list"
|
|
1660
|
+
}, team.agents.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
1661
|
+
className: "tac-empty"
|
|
1662
|
+
}, w.noAgents), team.agents.length > 0 && shown.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
1663
|
+
className: "tac-empty"
|
|
1664
|
+
}, w.noMatch), shown.map((agent) => {
|
|
1665
|
+
const on = picked.includes(agent.id);
|
|
1666
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
1667
|
+
key: agent.id,
|
|
1668
|
+
type: "button",
|
|
1669
|
+
"aria-pressed": on,
|
|
1670
|
+
disabled: !on && full,
|
|
1671
|
+
className: `tac-pick${on ? " tac-on" : ""}`,
|
|
1672
|
+
onClick: () => toggle(agent)
|
|
1673
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1674
|
+
className: "tac-check"
|
|
1675
|
+
}, on && /* @__PURE__ */ React.createElement(Check, {
|
|
1676
|
+
size: 13,
|
|
1677
|
+
strokeWidth: 3
|
|
1678
|
+
})), /* @__PURE__ */ React.createElement(AgentAvatar, {
|
|
1679
|
+
agent,
|
|
1680
|
+
faces,
|
|
1681
|
+
size: 30
|
|
1682
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
1683
|
+
className: "tac-pick-text"
|
|
1684
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1685
|
+
className: "tac-pick-name"
|
|
1686
|
+
}, agent.name, picked[0] === agent.id && /* @__PURE__ */ React.createElement("span", {
|
|
1687
|
+
className: "tac-msg-lead"
|
|
1688
|
+
}, w.lead)), /* @__PURE__ */ React.createElement("span", {
|
|
1689
|
+
className: "tac-pick-role"
|
|
1690
|
+
}, agent.role.split(`
|
|
1691
|
+
`)[0])));
|
|
1692
|
+
})), picked.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
1693
|
+
className: "tac-dialog-note"
|
|
1694
|
+
}, w.membersHint), error && /* @__PURE__ */ React.createElement("div", {
|
|
1695
|
+
className: "tac-empty tac-error"
|
|
1696
|
+
}, error), /* @__PURE__ */ React.createElement("div", {
|
|
1697
|
+
className: "tac-dialog-actions"
|
|
1698
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1699
|
+
type: "submit",
|
|
1700
|
+
className: "tac-button tac-primary",
|
|
1701
|
+
disabled: busy || !name.trim() || picked.length === 0
|
|
1702
|
+
}, w.create))));
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
// web-src/members.tsx
|
|
1706
|
+
function MembersView({ context }) {
|
|
1707
|
+
const { pi, service, ui } = context;
|
|
1708
|
+
const state = useChannels(service);
|
|
1709
|
+
const { channelId, adding } = useUi(ui);
|
|
1710
|
+
const faces = useFaces(state.team);
|
|
1711
|
+
const w = ChannelViews.words(pi);
|
|
1712
|
+
const channel = state.team.channels.find((candidate) => candidate.id === channelId);
|
|
1713
|
+
if (!channel) {
|
|
1714
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1715
|
+
className: "tac-view tac-members"
|
|
1716
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1717
|
+
className: "tac-members-none"
|
|
1718
|
+
}, state.loaded ? w.noChannel : ""));
|
|
1719
|
+
}
|
|
1720
|
+
return adding ? /* @__PURE__ */ React.createElement(MemberPicker, {
|
|
1721
|
+
key: channel.id,
|
|
1722
|
+
context,
|
|
1723
|
+
team: state.team,
|
|
1724
|
+
channel,
|
|
1725
|
+
faces
|
|
1726
|
+
}) : /* @__PURE__ */ React.createElement(MemberList, {
|
|
1727
|
+
key: channel.id,
|
|
1728
|
+
context,
|
|
1729
|
+
team: state.team,
|
|
1730
|
+
channel,
|
|
1731
|
+
faces,
|
|
1732
|
+
working: state.working[channel.id] ?? []
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
function MemberList({ context, team, channel, faces, working }) {
|
|
1736
|
+
const { pi, service, ui } = context;
|
|
1737
|
+
const w = ChannelViews.words(pi);
|
|
1738
|
+
const [busy, setBusy] = React.useState();
|
|
1739
|
+
const [confirming, setConfirming] = React.useState(false);
|
|
1740
|
+
const UserPlus = ChannelViews.icon(pi, "UserPlus");
|
|
1741
|
+
const Crown = ChannelViews.icon(pi, "Crown");
|
|
1742
|
+
const BellOff = ChannelViews.icon(pi, "BellOff");
|
|
1743
|
+
const RotateCcw = ChannelViews.icon(pi, "RotateCcw");
|
|
1744
|
+
const X = ChannelViews.icon(pi, "X");
|
|
1745
|
+
const Trash = ChannelViews.icon(pi, "Trash2");
|
|
1746
|
+
const members = membersOf(team, channel);
|
|
1747
|
+
const muted = channel.muted ?? [];
|
|
1748
|
+
const run = (key, action) => {
|
|
1749
|
+
setBusy(key);
|
|
1750
|
+
action().catch((error) => pi.ui.notify(ChannelViews.message(error), "error")).finally(() => setBusy(undefined));
|
|
1751
|
+
};
|
|
1752
|
+
const change = (agent, kind) => run(`${kind}:${agent.id}`, () => service.changeMember(channel.id, agent.id, kind));
|
|
1753
|
+
const reset = (agent) => run(`reset:${agent.id}`, async () => {
|
|
1754
|
+
await service.resetAgent(agent.id);
|
|
1755
|
+
context.sessions.delete(agent.id);
|
|
1756
|
+
pi.ui.notify(ChannelWords.format(w.resetDone, { name: agent.name }), "info");
|
|
1757
|
+
});
|
|
1758
|
+
const remove = () => run("delete", () => service.deleteChannel(channel.id));
|
|
1759
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1760
|
+
className: "tac-view tac-members"
|
|
1761
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1762
|
+
className: "tac-members-scroll"
|
|
1763
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1764
|
+
className: "tac-members-top"
|
|
1765
|
+
}, /* @__PURE__ */ React.createElement(RoomFace, {
|
|
1766
|
+
members,
|
|
1767
|
+
faces,
|
|
1768
|
+
size: 44,
|
|
1769
|
+
working
|
|
1770
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
1771
|
+
className: "tac-members-title"
|
|
1772
|
+
}, /* @__PURE__ */ React.createElement("strong", null, channel.name), /* @__PURE__ */ React.createElement("span", null, channel.topic ?? ChannelWords.format(w.memberCount, { count: String(members.length) })))), /* @__PURE__ */ React.createElement("div", {
|
|
1773
|
+
className: "tac-members-label"
|
|
1774
|
+
}, w.members, " · ", members.length), /* @__PURE__ */ React.createElement("button", {
|
|
1775
|
+
type: "button",
|
|
1776
|
+
className: "tac-member-main",
|
|
1777
|
+
onClick: () => ui.set({ adding: true })
|
|
1778
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1779
|
+
className: "tac-member-plus"
|
|
1780
|
+
}, /* @__PURE__ */ React.createElement(UserPlus, {
|
|
1781
|
+
size: 16
|
|
1782
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
1783
|
+
className: "tac-member-text"
|
|
1784
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1785
|
+
className: "tac-member-name"
|
|
1786
|
+
}, w.addMembers))), members.map((agent, index) => {
|
|
1787
|
+
const lead = index === 0;
|
|
1788
|
+
const off = muted.includes(agent.id);
|
|
1789
|
+
const answering = working.includes(agent.id);
|
|
1790
|
+
const detail = answering ? w.replying : off ? w.muted : agent.role.split(`
|
|
1791
|
+
`)[0] ?? "";
|
|
1792
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1793
|
+
key: agent.id,
|
|
1794
|
+
className: `tac-member${off ? " tac-muted" : ""}`
|
|
1795
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1796
|
+
type: "button",
|
|
1797
|
+
className: "tac-member-main",
|
|
1798
|
+
title: `${w.open}
|
|
1799
|
+
${agent.role}`,
|
|
1800
|
+
onClick: () => ChannelViews.openAgent(context, agent.id).catch((error) => pi.ui.notify(ChannelViews.message(error), "error"))
|
|
1801
|
+
}, /* @__PURE__ */ React.createElement(AgentAvatar, {
|
|
1802
|
+
agent,
|
|
1803
|
+
faces,
|
|
1804
|
+
size: 32,
|
|
1805
|
+
working: answering
|
|
1806
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
1807
|
+
className: "tac-member-text"
|
|
1808
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1809
|
+
className: "tac-member-name"
|
|
1810
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1811
|
+
className: "tac-member-label"
|
|
1812
|
+
}, agent.name), lead && /* @__PURE__ */ React.createElement("span", {
|
|
1813
|
+
className: "tac-lead",
|
|
1814
|
+
title: w.leadHint
|
|
1815
|
+
}, /* @__PURE__ */ React.createElement(Crown, {
|
|
1816
|
+
size: 11
|
|
1817
|
+
}), /* @__PURE__ */ React.createElement("span", null, w.lead))), /* @__PURE__ */ React.createElement("span", {
|
|
1818
|
+
className: `tac-member-detail${answering ? " tac-live" : ""}`
|
|
1819
|
+
}, detail))), /* @__PURE__ */ React.createElement("span", {
|
|
1820
|
+
className: "tac-member-actions"
|
|
1821
|
+
}, !lead && /* @__PURE__ */ React.createElement("button", {
|
|
1822
|
+
type: "button",
|
|
1823
|
+
className: "tac-action",
|
|
1824
|
+
title: w.makeLead,
|
|
1825
|
+
"aria-label": w.makeLead,
|
|
1826
|
+
disabled: !!busy,
|
|
1827
|
+
onClick: () => change(agent, "lead")
|
|
1828
|
+
}, /* @__PURE__ */ React.createElement(Crown, {
|
|
1829
|
+
size: 15
|
|
1830
|
+
})), /* @__PURE__ */ React.createElement("button", {
|
|
1831
|
+
type: "button",
|
|
1832
|
+
className: `tac-action${off ? " tac-on" : ""}`,
|
|
1833
|
+
title: off ? w.unmute : w.mute,
|
|
1834
|
+
"aria-label": off ? w.unmute : w.mute,
|
|
1835
|
+
"aria-pressed": off,
|
|
1836
|
+
disabled: !!busy,
|
|
1837
|
+
onClick: () => change(agent, off ? "unmute" : "mute")
|
|
1838
|
+
}, /* @__PURE__ */ React.createElement(BellOff, {
|
|
1839
|
+
size: 15
|
|
1840
|
+
})), /* @__PURE__ */ React.createElement("button", {
|
|
1841
|
+
type: "button",
|
|
1842
|
+
className: "tac-action",
|
|
1843
|
+
title: w.reset,
|
|
1844
|
+
"aria-label": w.reset,
|
|
1845
|
+
disabled: !!busy,
|
|
1846
|
+
onClick: () => reset(agent)
|
|
1847
|
+
}, /* @__PURE__ */ React.createElement(RotateCcw, {
|
|
1848
|
+
size: 15
|
|
1849
|
+
})), /* @__PURE__ */ React.createElement("button", {
|
|
1850
|
+
type: "button",
|
|
1851
|
+
className: "tac-action",
|
|
1852
|
+
title: members.length === 1 ? w.onlyMember : w.remove,
|
|
1853
|
+
"aria-label": w.remove,
|
|
1854
|
+
disabled: !!busy || members.length === 1,
|
|
1855
|
+
onClick: () => change(agent, "remove")
|
|
1856
|
+
}, /* @__PURE__ */ React.createElement(X, {
|
|
1857
|
+
size: 15
|
|
1858
|
+
}))));
|
|
1859
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1860
|
+
className: "tac-members-foot"
|
|
1861
|
+
}, confirming ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
|
|
1862
|
+
className: "tac-members-ask"
|
|
1863
|
+
}, ChannelWords.format(w.confirmDelete, { channel: channel.name })), /* @__PURE__ */ React.createElement("button", {
|
|
1864
|
+
type: "button",
|
|
1865
|
+
className: "tac-button",
|
|
1866
|
+
onClick: () => setConfirming(false)
|
|
1867
|
+
}, w.cancel), /* @__PURE__ */ React.createElement("button", {
|
|
1868
|
+
type: "button",
|
|
1869
|
+
className: "tac-button tac-danger",
|
|
1870
|
+
disabled: !!busy,
|
|
1871
|
+
onClick: remove
|
|
1872
|
+
}, w.delete)) : /* @__PURE__ */ React.createElement("button", {
|
|
1873
|
+
type: "button",
|
|
1874
|
+
className: "tac-link tac-danger",
|
|
1875
|
+
onClick: () => setConfirming(true)
|
|
1876
|
+
}, /* @__PURE__ */ React.createElement(Trash, {
|
|
1877
|
+
size: 14
|
|
1878
|
+
}), w.deleteChannel)));
|
|
1879
|
+
}
|
|
1880
|
+
function MemberPicker({ context, team, channel, faces }) {
|
|
1881
|
+
const { pi, service, ui } = context;
|
|
1882
|
+
const w = ChannelViews.words(pi);
|
|
1883
|
+
const [query, setQuery] = React.useState("");
|
|
1884
|
+
const [picked, setPicked] = React.useState([]);
|
|
1885
|
+
const ArrowLeft = ChannelViews.icon(pi, "ArrowLeft");
|
|
1886
|
+
const Search = ChannelViews.icon(pi, "Search");
|
|
1887
|
+
const Check = ChannelViews.icon(pi, "Check");
|
|
1888
|
+
const UserPlus = ChannelViews.icon(pi, "UserPlus");
|
|
1889
|
+
const back = () => ui.set({ adding: false });
|
|
1890
|
+
const { busy, error, submit } = useSubmit(() => service.addMembers(channel.id, picked), back);
|
|
1891
|
+
const others = team.agents.filter((agent) => !channel.members.includes(agent.id));
|
|
1892
|
+
const shown = others.filter((agent) => SidebarUtil.matches(query, agent.name, agent.role));
|
|
1893
|
+
const toggle = (id) => setPicked(picked.includes(id) ? picked.filter((other) => other !== id) : [...picked, id]);
|
|
1894
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1895
|
+
className: "tac-view tac-members"
|
|
1896
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1897
|
+
className: "tac-members-head"
|
|
1898
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1899
|
+
type: "button",
|
|
1900
|
+
className: "tac-action",
|
|
1901
|
+
title: w.back,
|
|
1902
|
+
"aria-label": w.back,
|
|
1903
|
+
onClick: back
|
|
1904
|
+
}, /* @__PURE__ */ React.createElement(ArrowLeft, {
|
|
1905
|
+
size: 16
|
|
1906
|
+
})), /* @__PURE__ */ React.createElement("strong", null, w.addMembers)), /* @__PURE__ */ React.createElement("label", {
|
|
1907
|
+
className: "tac-search tac-members-search"
|
|
1908
|
+
}, /* @__PURE__ */ React.createElement(Search, {
|
|
1909
|
+
size: 14
|
|
1910
|
+
}), /* @__PURE__ */ React.createElement("input", {
|
|
1911
|
+
value: query,
|
|
1912
|
+
placeholder: w.findAgent,
|
|
1913
|
+
"aria-label": w.findAgent,
|
|
1914
|
+
onChange: (event) => setQuery(event.target.value)
|
|
1915
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1916
|
+
className: "tac-members-scroll"
|
|
1917
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1918
|
+
className: "tac-members-label"
|
|
1919
|
+
}, ChannelWords.format(w.canAdd, { count: String(others.length) })), others.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
1920
|
+
className: "tac-empty"
|
|
1921
|
+
}, w.allMembers), others.length > 0 && shown.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
1922
|
+
className: "tac-empty"
|
|
1923
|
+
}, w.noMatch), shown.map((agent) => {
|
|
1924
|
+
const on = picked.includes(agent.id);
|
|
1925
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
1926
|
+
key: agent.id,
|
|
1927
|
+
type: "button",
|
|
1928
|
+
className: `tac-member-main tac-pick${on ? " tac-on" : ""}`,
|
|
1929
|
+
"aria-pressed": on,
|
|
1930
|
+
title: agent.role,
|
|
1931
|
+
onClick: () => toggle(agent.id)
|
|
1932
|
+
}, /* @__PURE__ */ React.createElement(AgentAvatar, {
|
|
1933
|
+
agent,
|
|
1934
|
+
faces,
|
|
1935
|
+
size: 32
|
|
1936
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
1937
|
+
className: "tac-member-text"
|
|
1938
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1939
|
+
className: "tac-member-name"
|
|
1940
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1941
|
+
className: "tac-member-label"
|
|
1942
|
+
}, agent.name)), /* @__PURE__ */ React.createElement("span", {
|
|
1943
|
+
className: "tac-member-detail"
|
|
1944
|
+
}, agent.role.split(`
|
|
1945
|
+
`)[0])), /* @__PURE__ */ React.createElement("span", {
|
|
1946
|
+
className: "tac-check"
|
|
1947
|
+
}, on && /* @__PURE__ */ React.createElement(Check, {
|
|
1948
|
+
size: 12,
|
|
1949
|
+
strokeWidth: 3
|
|
1950
|
+
})));
|
|
1951
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1952
|
+
className: "tac-members-sep"
|
|
1953
|
+
}), /* @__PURE__ */ React.createElement("button", {
|
|
1954
|
+
type: "button",
|
|
1955
|
+
className: "tac-member-main",
|
|
1956
|
+
onClick: () => newAgent(context)
|
|
1957
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1958
|
+
className: "tac-member-plus"
|
|
1959
|
+
}, /* @__PURE__ */ React.createElement(UserPlus, {
|
|
1960
|
+
size: 16
|
|
1961
|
+
})), /* @__PURE__ */ React.createElement("span", {
|
|
1962
|
+
className: "tac-member-text"
|
|
1963
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1964
|
+
className: "tac-member-name"
|
|
1965
|
+
}, w.newAgent)))), error && /* @__PURE__ */ React.createElement("div", {
|
|
1966
|
+
className: "tac-empty tac-error"
|
|
1967
|
+
}, error), /* @__PURE__ */ React.createElement("div", {
|
|
1968
|
+
className: "tac-members-foot"
|
|
1969
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1970
|
+
type: "button",
|
|
1971
|
+
className: "tac-button tac-primary tac-wide",
|
|
1972
|
+
disabled: busy || picked.length === 0,
|
|
1973
|
+
onClick: submit
|
|
1974
|
+
}, picked.length > 0 ? ChannelWords.format(w.addCount, { count: String(picked.length) }) : w.add)));
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
// web-src/room.tsx
|
|
1978
|
+
var RUN_MS = 5 * 60 * 1000;
|
|
1979
|
+
var PAUSE_MS = 15 * 60 * 1000;
|
|
1980
|
+
var RoomUtil;
|
|
1981
|
+
((RoomUtil) => {
|
|
1982
|
+
function rows(messages) {
|
|
1983
|
+
return messages.map((message, index) => {
|
|
1984
|
+
const before = messages[index - 1];
|
|
1985
|
+
const separator = !before || message.at - before.at > PAUSE_MS;
|
|
1986
|
+
const first = separator || before.author !== message.author || before.author === SYSTEM || message.at - before.at > RUN_MS;
|
|
1987
|
+
return { message, first, separator };
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
RoomUtil.rows = rows;
|
|
1991
|
+
})(RoomUtil ||= {});
|
|
1992
|
+
function Mentions({ text, agents }) {
|
|
1993
|
+
const names = new Set(agents.map((agent) => agent.name.toLowerCase()));
|
|
1994
|
+
const parts = text.split(/(@[^\s@#,,。::]+)/);
|
|
1995
|
+
return /* @__PURE__ */ React.createElement("span", null, parts.map((part, index) => part.startsWith("@") && names.has(part.slice(1).toLowerCase()) ? /* @__PURE__ */ React.createElement("span", {
|
|
1996
|
+
key: index,
|
|
1997
|
+
className: "tac-mention"
|
|
1998
|
+
}, part) : part));
|
|
1999
|
+
}
|
|
2000
|
+
function ChannelHead({ context }) {
|
|
2001
|
+
const { pi, service, ui } = context;
|
|
2002
|
+
const state = useChannels(service);
|
|
2003
|
+
const { channelId } = useUi(ui);
|
|
2004
|
+
const faces = useFaces(state.team);
|
|
2005
|
+
const w = ChannelViews.words(pi);
|
|
2006
|
+
const shown = !!pi.ui.useView(MEMBERS_VIEW)?.shown;
|
|
2007
|
+
const channel = state.team.channels.find((candidate) => candidate.id === channelId);
|
|
2008
|
+
if (!channel) {
|
|
2009
|
+
return null;
|
|
2010
|
+
}
|
|
2011
|
+
const members = membersOf(state.team, channel);
|
|
2012
|
+
const working = state.working[channel.id] ?? [];
|
|
2013
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2014
|
+
className: "tac-head"
|
|
2015
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2016
|
+
className: "tac-head-title"
|
|
2017
|
+
}, /* @__PURE__ */ React.createElement("strong", null, channel.name), /* @__PURE__ */ React.createElement("span", {
|
|
2018
|
+
className: "tac-head-count"
|
|
2019
|
+
}, ChannelWords.format(w.memberCount, { count: String(members.length) })), channel.topic && /* @__PURE__ */ React.createElement("span", {
|
|
2020
|
+
className: "tac-head-topic"
|
|
2021
|
+
}, channel.topic)), /* @__PURE__ */ React.createElement("button", {
|
|
2022
|
+
type: "button",
|
|
2023
|
+
className: `tac-head-members${shown ? " tac-on" : ""}`,
|
|
2024
|
+
title: w.showMembers,
|
|
2025
|
+
"aria-label": w.showMembers,
|
|
2026
|
+
"aria-pressed": shown,
|
|
2027
|
+
onClick: () => context.showMembers()
|
|
2028
|
+
}, members.slice(0, 5).map((agent) => /* @__PURE__ */ React.createElement("span", {
|
|
2029
|
+
key: agent.id,
|
|
2030
|
+
className: "tac-head-face"
|
|
2031
|
+
}, /* @__PURE__ */ React.createElement(AgentAvatar, {
|
|
2032
|
+
agent,
|
|
2033
|
+
faces,
|
|
2034
|
+
size: 24,
|
|
2035
|
+
working: working.includes(agent.id)
|
|
2036
|
+
}))), members.length > 5 && /* @__PURE__ */ React.createElement("span", {
|
|
2037
|
+
className: "tac-head-more"
|
|
2038
|
+
}, "+", members.length - 5)));
|
|
2039
|
+
}
|
|
2040
|
+
function ChannelRoom({ context }) {
|
|
2041
|
+
const { pi, service, ui } = context;
|
|
2042
|
+
const state = useChannels(service);
|
|
2043
|
+
const { channelId } = useUi(ui);
|
|
2044
|
+
const faces = useFaces(state.team);
|
|
2045
|
+
const w = ChannelViews.words(pi);
|
|
2046
|
+
const list = React.useRef(null);
|
|
2047
|
+
const channel = state.team.channels.find((candidate) => candidate.id === channelId);
|
|
2048
|
+
const messages = channel ? state.messages[channel.id] : undefined;
|
|
2049
|
+
const working = channel ? state.working[channel.id] ?? [] : [];
|
|
2050
|
+
React.useEffect(() => {
|
|
2051
|
+
if (channelId) {
|
|
2052
|
+
service.messages(channelId);
|
|
2053
|
+
}
|
|
2054
|
+
}, [service, channelId]);
|
|
2055
|
+
React.useLayoutEffect(() => {
|
|
2056
|
+
const element = list.current;
|
|
2057
|
+
if (element) {
|
|
2058
|
+
element.scrollTop = element.scrollHeight;
|
|
2059
|
+
}
|
|
2060
|
+
}, [channelId, messages?.length, working.length]);
|
|
2061
|
+
const Markdown = pi.ui.Markdown;
|
|
2062
|
+
const Composer = pi.ui.Composer;
|
|
2063
|
+
const Avatar = pi.ui.Avatar;
|
|
2064
|
+
if (!channel) {
|
|
2065
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2066
|
+
className: "tac-room-none"
|
|
2067
|
+
}, state.loaded ? w.pick : "");
|
|
2068
|
+
}
|
|
2069
|
+
const members = membersOf(state.team, channel);
|
|
2070
|
+
const agentOf = (id) => state.team.agents.find((agent) => agent.id === id);
|
|
2071
|
+
const name = (id) => ChannelsUtil.authorName(state.team, id, { user: w.you, ta: w.ta });
|
|
2072
|
+
const time = (at) => SidebarUtil.time(at, pi.ui.language);
|
|
2073
|
+
const mention = (agent) => ({
|
|
2074
|
+
key: agent.id,
|
|
2075
|
+
label: agent.name,
|
|
2076
|
+
icon: /* @__PURE__ */ React.createElement(AgentAvatar, {
|
|
2077
|
+
agent,
|
|
2078
|
+
faces,
|
|
2079
|
+
size: 20
|
|
2080
|
+
}),
|
|
2081
|
+
detail: agent.id === channel.members[0] ? w.lead : undefined,
|
|
2082
|
+
insert: `@${agent.name} `
|
|
2083
|
+
});
|
|
2084
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2085
|
+
className: "tac-room-page"
|
|
2086
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2087
|
+
className: "tac-chat",
|
|
2088
|
+
ref: list
|
|
2089
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2090
|
+
className: "tac-chat-col"
|
|
2091
|
+
}, messages && messages.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
2092
|
+
className: "tac-chat-empty"
|
|
2093
|
+
}, /* @__PURE__ */ React.createElement(RoomFace, {
|
|
2094
|
+
members,
|
|
2095
|
+
faces,
|
|
2096
|
+
size: 56,
|
|
2097
|
+
working
|
|
2098
|
+
}), /* @__PURE__ */ React.createElement("strong", null, channel.name), channel.topic && /* @__PURE__ */ React.createElement("span", null, channel.topic), /* @__PURE__ */ React.createElement("span", {
|
|
2099
|
+
className: "tac-chat-hint"
|
|
2100
|
+
}, w.quiet)), messages && RoomUtil.rows(messages).map(({ message, first, separator }) => /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
2101
|
+
key: message.id
|
|
2102
|
+
}, separator && /* @__PURE__ */ React.createElement("div", {
|
|
2103
|
+
className: "tac-chat-time"
|
|
2104
|
+
}, time(message.at)), message.author === SYSTEM ? /* @__PURE__ */ React.createElement("div", {
|
|
2105
|
+
className: "tac-notice",
|
|
2106
|
+
role: "note"
|
|
2107
|
+
}, w.stopped) : message.author === USER ? /* @__PURE__ */ React.createElement("div", {
|
|
2108
|
+
className: "ta-message ta-user tac-mine"
|
|
2109
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2110
|
+
className: "ta-bubble"
|
|
2111
|
+
}, /* @__PURE__ */ React.createElement(Mentions, {
|
|
2112
|
+
text: message.text,
|
|
2113
|
+
agents: state.team.agents
|
|
2114
|
+
}))) : /* @__PURE__ */ React.createElement("div", {
|
|
2115
|
+
className: `tac-msg${first ? " tac-first" : ""}`
|
|
2116
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2117
|
+
className: "tac-msg-face"
|
|
2118
|
+
}, first && (message.author === TA ? /* @__PURE__ */ React.createElement(Avatar, {
|
|
2119
|
+
size: 28
|
|
2120
|
+
}) : /* @__PURE__ */ React.createElement(AgentAvatar, {
|
|
2121
|
+
agent: agentOf(message.author),
|
|
2122
|
+
faces,
|
|
2123
|
+
size: 28,
|
|
2124
|
+
working: working.includes(message.author)
|
|
2125
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
2126
|
+
className: "tac-msg-col"
|
|
2127
|
+
}, first && /* @__PURE__ */ React.createElement("div", {
|
|
2128
|
+
className: "tac-msg-name"
|
|
2129
|
+
}, name(message.author), message.author === channel.members[0] && /* @__PURE__ */ React.createElement("span", {
|
|
2130
|
+
className: "tac-msg-lead"
|
|
2131
|
+
}, w.lead)), /* @__PURE__ */ React.createElement("div", {
|
|
2132
|
+
className: `tac-msg-bubble${message.failed ? " tac-failed" : ""}`,
|
|
2133
|
+
title: time(message.at)
|
|
2134
|
+
}, message.failed && /* @__PURE__ */ React.createElement("div", {
|
|
2135
|
+
className: "tac-msg-failed"
|
|
2136
|
+
}, w.failed), /* @__PURE__ */ React.createElement(Markdown, {
|
|
2137
|
+
text: ChannelsUtil.markMentions(message.text, state.team.agents)
|
|
2138
|
+
})))))), working.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
2139
|
+
className: "tac-live",
|
|
2140
|
+
role: "status"
|
|
2141
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2142
|
+
className: "tac-live-faces"
|
|
2143
|
+
}, working.map((id) => /* @__PURE__ */ React.createElement(Face, {
|
|
2144
|
+
key: id,
|
|
2145
|
+
face: faces.get(id) ?? 0,
|
|
2146
|
+
size: 18,
|
|
2147
|
+
working: true
|
|
2148
|
+
}))), ChannelWords.format(w.answeringNow, { name: working.map(name).join("、") })))), /* @__PURE__ */ React.createElement("div", {
|
|
2149
|
+
className: "tac-chat-bottom"
|
|
2150
|
+
}, /* @__PURE__ */ React.createElement(Composer, {
|
|
2151
|
+
placeholder: ChannelWords.format(w.placeholder, { channel: channel.name }),
|
|
2152
|
+
mentions: members.map((agent) => ({ name: agent.name, detail: agent.role.split(`
|
|
2153
|
+
`)[0] })),
|
|
2154
|
+
actions: [
|
|
2155
|
+
members.map(mention),
|
|
2156
|
+
[{ key: "add", label: w.addMembers, icon: ChannelViews.maybeIcon(pi, "UserPlus", null, 16), run: () => context.showMembers(true) }]
|
|
2157
|
+
],
|
|
2158
|
+
onSend: (text) => service.post(channel.id, text)
|
|
2159
|
+
})));
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
// web-src/more-menu.tsx
|
|
2163
|
+
var MENU_HEIGHT = 440;
|
|
2164
|
+
function MoreMenu({ pi, label, items }) {
|
|
2165
|
+
const w = ChannelViews.words(pi);
|
|
2166
|
+
const [open, setOpen] = React.useState(false);
|
|
2167
|
+
const [up, setUp] = React.useState(false);
|
|
2168
|
+
const root = React.useRef(null);
|
|
2169
|
+
const Ellipsis = ChannelViews.icon(pi, "Ellipsis");
|
|
2170
|
+
const show = React.useCallback((button) => {
|
|
2171
|
+
setUp(window.innerHeight - button.getBoundingClientRect().bottom < MENU_HEIGHT);
|
|
2172
|
+
setOpen(true);
|
|
2173
|
+
}, []);
|
|
2174
|
+
React.useEffect(() => {
|
|
2175
|
+
const row = root.current?.parentElement;
|
|
2176
|
+
const button = root.current?.querySelector(".tac-action");
|
|
2177
|
+
if (!row || !button) {
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
const onContextMenu = (event) => {
|
|
2181
|
+
event.preventDefault();
|
|
2182
|
+
show(button);
|
|
2183
|
+
};
|
|
2184
|
+
row.addEventListener("contextmenu", onContextMenu);
|
|
2185
|
+
return () => row.removeEventListener("contextmenu", onContextMenu);
|
|
2186
|
+
}, [show]);
|
|
2187
|
+
React.useEffect(() => {
|
|
2188
|
+
if (!open) {
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
const close = (event) => {
|
|
2192
|
+
if (!root.current?.contains(event.target)) {
|
|
2193
|
+
setOpen(false);
|
|
2194
|
+
}
|
|
2195
|
+
};
|
|
2196
|
+
const onKey = (event) => {
|
|
2197
|
+
if (event.key === "Escape") {
|
|
2198
|
+
setOpen(false);
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
document.addEventListener("pointerdown", close);
|
|
2202
|
+
document.addEventListener("keydown", onKey);
|
|
2203
|
+
return () => {
|
|
2204
|
+
document.removeEventListener("pointerdown", close);
|
|
2205
|
+
document.removeEventListener("keydown", onKey);
|
|
2206
|
+
};
|
|
2207
|
+
}, [open]);
|
|
2208
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2209
|
+
className: "tac-item-more",
|
|
2210
|
+
ref: root
|
|
2211
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2212
|
+
type: "button",
|
|
2213
|
+
className: `tac-action${open ? " tac-on" : ""}`,
|
|
2214
|
+
title: w.more,
|
|
2215
|
+
"aria-label": w.more,
|
|
2216
|
+
"aria-haspopup": "menu",
|
|
2217
|
+
"aria-expanded": open,
|
|
2218
|
+
onClick: (event) => {
|
|
2219
|
+
event.stopPropagation();
|
|
2220
|
+
if (open) {
|
|
2221
|
+
setOpen(false);
|
|
2222
|
+
} else {
|
|
2223
|
+
show(event.currentTarget);
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
}, /* @__PURE__ */ React.createElement(Ellipsis, {
|
|
2227
|
+
size: 15
|
|
2228
|
+
})), open && /* @__PURE__ */ React.createElement("div", {
|
|
2229
|
+
className: `tac-menu tac-agent-menu${up ? " tac-up" : ""}`,
|
|
2230
|
+
role: "menu",
|
|
2231
|
+
"aria-label": label
|
|
2232
|
+
}, items().map((section, index) => /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
2233
|
+
key: section[0]?.key ?? index
|
|
2234
|
+
}, index > 0 && /* @__PURE__ */ React.createElement("hr", {
|
|
2235
|
+
className: "tac-menu-line"
|
|
2236
|
+
}), section.map((item) => /* @__PURE__ */ React.createElement("button", {
|
|
2237
|
+
key: item.key,
|
|
2238
|
+
type: "button",
|
|
2239
|
+
role: "menuitem",
|
|
2240
|
+
className: item.danger ? "tac-danger" : undefined,
|
|
2241
|
+
disabled: item.disabled,
|
|
2242
|
+
onClick: () => {
|
|
2243
|
+
setOpen(false);
|
|
2244
|
+
item.run();
|
|
2245
|
+
}
|
|
2246
|
+
}, item.icon, /* @__PURE__ */ React.createElement("span", {
|
|
2247
|
+
className: "tac-menu-label"
|
|
2248
|
+
}, item.label)))))));
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
// web-src/agent-menu.tsx
|
|
2252
|
+
async function copy(text) {
|
|
2253
|
+
try {
|
|
2254
|
+
await navigator.clipboard.writeText(text);
|
|
2255
|
+
return true;
|
|
2256
|
+
} catch {
|
|
2257
|
+
return false;
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
function download(name, text) {
|
|
2261
|
+
const url = URL.createObjectURL(new Blob([text], { type: "text/markdown;charset=utf-8" }));
|
|
2262
|
+
const link = document.createElement("a");
|
|
2263
|
+
link.href = url;
|
|
2264
|
+
link.download = name;
|
|
2265
|
+
link.click();
|
|
2266
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
2267
|
+
}
|
|
2268
|
+
function AgentMenu({ context, agent, cwd, working }) {
|
|
2269
|
+
const { pi, service } = context;
|
|
2270
|
+
const w = ChannelViews.words(pi);
|
|
2271
|
+
const [dialog, setDialog] = React.useState();
|
|
2272
|
+
const icon = (name) => ChannelViews.maybeIcon(pi, name, null, 15);
|
|
2273
|
+
const fail = (error) => pi.ui.notify(ChannelViews.message(error), "error");
|
|
2274
|
+
const act = (action) => () => {
|
|
2275
|
+
Promise.resolve().then(action).catch(fail);
|
|
2276
|
+
};
|
|
2277
|
+
const openSession = async () => {
|
|
2278
|
+
if (!agent.sessionFile) {
|
|
2279
|
+
return;
|
|
2280
|
+
}
|
|
2281
|
+
return (await pi.server.listSessions()).find((session) => session.sessionFile === agent.sessionFile);
|
|
2282
|
+
};
|
|
2283
|
+
const stop = act(async () => {
|
|
2284
|
+
const session = await openSession();
|
|
2285
|
+
if (session) {
|
|
2286
|
+
await pi.server.abort(session.sessionId);
|
|
2287
|
+
}
|
|
2288
|
+
pi.ui.notify(ChannelWords.format(w.stoppedAgent, { name: agent.name }), "info");
|
|
2289
|
+
});
|
|
2290
|
+
const restart = act(async () => {
|
|
2291
|
+
await service.resetAgent(agent.id);
|
|
2292
|
+
context.sessions.delete(agent.id);
|
|
2293
|
+
pi.ui.notify(ChannelWords.format(w.resetDone, { name: agent.name }), "info");
|
|
2294
|
+
});
|
|
2295
|
+
const copyCwd = act(async () => {
|
|
2296
|
+
if (await copy(cwd)) {
|
|
2297
|
+
pi.ui.notify(ChannelWords.format(w.copied, { path: cwd }), "info");
|
|
2298
|
+
}
|
|
2299
|
+
});
|
|
2300
|
+
const exportMarkdown = act(async () => {
|
|
2301
|
+
const session = await openSession();
|
|
2302
|
+
const sessionId = session?.sessionId ?? (agent.sessionFile ? await service.openAgent(agent.id) : undefined);
|
|
2303
|
+
const { messages } = sessionId ? await pi.server.getMessages(sessionId) : { messages: [] };
|
|
2304
|
+
if (!messages.some((message) => message.role === "assistant")) {
|
|
2305
|
+
pi.ui.notify(ChannelWords.format(w.nothingToExport, { name: agent.name }), "info");
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
download(`${agent.name}.md`, ChannelsUtil.markdown(agent, messages, { user: w.you }));
|
|
2309
|
+
});
|
|
2310
|
+
const remove = act(async () => {
|
|
2311
|
+
if (window.confirm(ChannelWords.format(w.confirmDeleteAgent, { name: agent.name }))) {
|
|
2312
|
+
await service.deleteAgent(agent.id);
|
|
2313
|
+
context.sessions.delete(agent.id);
|
|
2314
|
+
}
|
|
2315
|
+
});
|
|
2316
|
+
const show = (next) => () => setDialog(next);
|
|
2317
|
+
const item = (key, label, glyph, run, options = {}) => ({
|
|
2318
|
+
key,
|
|
2319
|
+
label,
|
|
2320
|
+
icon: icon(glyph),
|
|
2321
|
+
run,
|
|
2322
|
+
...options
|
|
2323
|
+
});
|
|
2324
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(MoreMenu, {
|
|
2325
|
+
pi,
|
|
2326
|
+
label: agent.name,
|
|
2327
|
+
items: () => [
|
|
2328
|
+
[item("stop", w.stop, "Square", stop, { disabled: !working && !agent.sessionFile }), item("restart", w.restart, "RotateCcw", restart)],
|
|
2329
|
+
[
|
|
2330
|
+
item("rename", w.rename, "Pencil", show("rename")),
|
|
2331
|
+
item("role", w.editRole, "ScrollText", show("role")),
|
|
2332
|
+
item("move", w.moveTo, "FolderInput", show("move")),
|
|
2333
|
+
item("copy", w.copyCwd, "Copy", copyCwd)
|
|
2334
|
+
],
|
|
2335
|
+
[item("export", w.exportChat, "Download", exportMarkdown), item("join", w.joinChannel, "UserPlus", show("join"))],
|
|
2336
|
+
[item("delete", w.deleteAgent, "Trash2", remove, { danger: true })]
|
|
2337
|
+
]
|
|
2338
|
+
}), dialog === "rename" && /* @__PURE__ */ React.createElement(RenameDialog, {
|
|
2339
|
+
context,
|
|
2340
|
+
agent,
|
|
2341
|
+
onClose: () => setDialog(undefined)
|
|
2342
|
+
}), dialog === "role" && /* @__PURE__ */ React.createElement(RoleDialog, {
|
|
2343
|
+
context,
|
|
2344
|
+
agent,
|
|
2345
|
+
onClose: () => setDialog(undefined)
|
|
2346
|
+
}), dialog === "join" && /* @__PURE__ */ React.createElement(JoinDialog, {
|
|
2347
|
+
context,
|
|
2348
|
+
agent,
|
|
2349
|
+
onClose: () => setDialog(undefined)
|
|
2350
|
+
}), dialog === "move" && /* @__PURE__ */ React.createElement(pi.ui.FolderPicker, {
|
|
2351
|
+
initial: cwd,
|
|
2352
|
+
onClose: () => setDialog(undefined),
|
|
2353
|
+
onPick: async (path) => {
|
|
2354
|
+
setDialog(undefined);
|
|
2355
|
+
if (path !== cwd) {
|
|
2356
|
+
await service.updateAgent(agent.id, { cwd: path }).catch(fail);
|
|
2357
|
+
context.sessions.delete(agent.id);
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
}));
|
|
2361
|
+
}
|
|
2362
|
+
function useSave(action, onClose) {
|
|
2363
|
+
const [busy, setBusy] = React.useState(false);
|
|
2364
|
+
const [error, setError] = React.useState();
|
|
2365
|
+
const submit = (event) => {
|
|
2366
|
+
event.preventDefault();
|
|
2367
|
+
setBusy(true);
|
|
2368
|
+
setError(undefined);
|
|
2369
|
+
action().then(onClose, (failure) => {
|
|
2370
|
+
setBusy(false);
|
|
2371
|
+
setError(ChannelViews.message(failure));
|
|
2372
|
+
});
|
|
2373
|
+
};
|
|
2374
|
+
return { busy, error, submit };
|
|
2375
|
+
}
|
|
2376
|
+
function RenameDialog({ context, agent, onClose }) {
|
|
2377
|
+
const { pi, service } = context;
|
|
2378
|
+
const w = ChannelViews.words(pi);
|
|
2379
|
+
const [name, setName] = React.useState(agent.name);
|
|
2380
|
+
const { busy, error, submit } = useSave(() => service.updateAgent(agent.id, { name }), onClose);
|
|
2381
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2382
|
+
title: w.rename,
|
|
2383
|
+
onClose
|
|
2384
|
+
}, /* @__PURE__ */ React.createElement("form", {
|
|
2385
|
+
className: "tac-dialog",
|
|
2386
|
+
onSubmit: submit
|
|
2387
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
2388
|
+
className: "tac-dialog-label"
|
|
2389
|
+
}, w.name, /* @__PURE__ */ React.createElement("input", {
|
|
2390
|
+
className: "tac-input tac-dialog-input",
|
|
2391
|
+
value: name,
|
|
2392
|
+
maxLength: 32,
|
|
2393
|
+
autoFocus: true,
|
|
2394
|
+
onChange: (event) => setName(event.target.value)
|
|
2395
|
+
})), error && /* @__PURE__ */ React.createElement("div", {
|
|
2396
|
+
className: "tac-error"
|
|
2397
|
+
}, error), /* @__PURE__ */ React.createElement("div", {
|
|
2398
|
+
className: "tac-dialog-actions"
|
|
2399
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2400
|
+
type: "submit",
|
|
2401
|
+
className: "tac-button tac-primary",
|
|
2402
|
+
disabled: busy || !name.trim() || name.trim() === agent.name
|
|
2403
|
+
}, w.save))));
|
|
2404
|
+
}
|
|
2405
|
+
function RoleDialog({ context, agent, onClose }) {
|
|
2406
|
+
const { pi, service } = context;
|
|
2407
|
+
const w = ChannelViews.words(pi);
|
|
2408
|
+
const [role, setRole] = React.useState(agent.role);
|
|
2409
|
+
const { busy, error, submit } = useSave(() => service.updateAgent(agent.id, { role }), onClose);
|
|
2410
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2411
|
+
title: `${w.editRole} · ${agent.name}`,
|
|
2412
|
+
onClose
|
|
2413
|
+
}, /* @__PURE__ */ React.createElement("form", {
|
|
2414
|
+
className: "tac-dialog",
|
|
2415
|
+
onSubmit: submit
|
|
2416
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
2417
|
+
className: "tac-dialog-note"
|
|
2418
|
+
}, w.roleHint), /* @__PURE__ */ React.createElement("textarea", {
|
|
2419
|
+
className: "tac-input tac-role-input",
|
|
2420
|
+
value: role,
|
|
2421
|
+
placeholder: w.rolePlaceholder,
|
|
2422
|
+
"aria-label": w.editRole,
|
|
2423
|
+
autoFocus: true,
|
|
2424
|
+
onChange: (event) => setRole(event.target.value)
|
|
2425
|
+
}), error && /* @__PURE__ */ React.createElement("div", {
|
|
2426
|
+
className: "tac-error"
|
|
2427
|
+
}, error), /* @__PURE__ */ React.createElement("div", {
|
|
2428
|
+
className: "tac-dialog-actions"
|
|
2429
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2430
|
+
type: "submit",
|
|
2431
|
+
className: "tac-button tac-primary",
|
|
2432
|
+
disabled: busy || !role.trim() || role.trim() === agent.role
|
|
2433
|
+
}, w.save))));
|
|
2434
|
+
}
|
|
2435
|
+
function JoinDialog({ context, agent, onClose }) {
|
|
2436
|
+
const { pi, service } = context;
|
|
2437
|
+
const { team } = useChannels(service);
|
|
2438
|
+
const w = ChannelViews.words(pi);
|
|
2439
|
+
const Hash = ChannelViews.icon(pi, "Hash");
|
|
2440
|
+
const [error, setError] = React.useState();
|
|
2441
|
+
const open = team.channels.filter((channel) => !channel.members.includes(agent.id));
|
|
2442
|
+
const join = (channelId, name) => {
|
|
2443
|
+
service.addMembers(channelId, [agent.id]).then(() => {
|
|
2444
|
+
onClose();
|
|
2445
|
+
pi.ui.notify(ChannelWords.format(w.joined, { name: agent.name, channel: name }), "info");
|
|
2446
|
+
}, (failure) => setError(ChannelViews.message(failure)));
|
|
2447
|
+
};
|
|
2448
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2449
|
+
title: `${w.joinChannel} · ${agent.name}`,
|
|
2450
|
+
onClose
|
|
2451
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2452
|
+
className: "tac-dialog"
|
|
2453
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2454
|
+
className: "tac-pick-list"
|
|
2455
|
+
}, open.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
2456
|
+
className: "tac-empty"
|
|
2457
|
+
}, w.noChannelToJoin), open.map((channel) => /* @__PURE__ */ React.createElement("button", {
|
|
2458
|
+
key: channel.id,
|
|
2459
|
+
type: "button",
|
|
2460
|
+
className: "tac-pick",
|
|
2461
|
+
disabled: channel.members.length >= MAX_MEMBERS,
|
|
2462
|
+
onClick: () => join(channel.id, channel.name)
|
|
2463
|
+
}, /* @__PURE__ */ React.createElement(Hash, {
|
|
2464
|
+
size: 16
|
|
2465
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2466
|
+
className: "tac-pick-text"
|
|
2467
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2468
|
+
className: "tac-pick-name"
|
|
2469
|
+
}, channel.name), /* @__PURE__ */ React.createElement("span", {
|
|
2470
|
+
className: "tac-pick-role"
|
|
2471
|
+
}, channel.topic ?? ChannelWords.format(w.memberCount, { count: String(channel.members.length) })))))), error && /* @__PURE__ */ React.createElement("div", {
|
|
2472
|
+
className: "tac-error"
|
|
2473
|
+
}, error)));
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
// web-src/channel-menu.tsx
|
|
2477
|
+
function download2(name, text) {
|
|
2478
|
+
const url = URL.createObjectURL(new Blob([text], { type: "text/markdown;charset=utf-8" }));
|
|
2479
|
+
const link = document.createElement("a");
|
|
2480
|
+
link.href = url;
|
|
2481
|
+
link.download = name;
|
|
2482
|
+
link.click();
|
|
2483
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
2484
|
+
}
|
|
2485
|
+
function ChannelMenu({ context, channel, working }) {
|
|
2486
|
+
const { pi, service, ui } = context;
|
|
2487
|
+
const { fresh } = useUi(ui);
|
|
2488
|
+
const w = ChannelViews.words(pi);
|
|
2489
|
+
const icon = (name) => ChannelViews.maybeIcon(pi, name, null, 15);
|
|
2490
|
+
const act = (action) => () => {
|
|
2491
|
+
Promise.resolve().then(action).catch((error) => pi.ui.notify(ChannelViews.message(error), "error"));
|
|
2492
|
+
};
|
|
2493
|
+
const unread = fresh.includes(channel.id);
|
|
2494
|
+
const pin = act(() => service.updateChannel(channel.id, { pinned: !channel.pinned }));
|
|
2495
|
+
const markRead = act(() => ui.set({ fresh: unread ? fresh.filter((id) => id !== channel.id) : [...fresh, channel.id] }));
|
|
2496
|
+
const rename = act(async () => {
|
|
2497
|
+
const name = await pi.ui.input(ChannelWords.format(w.renameChannel, { channel: channel.name }), w.channelNamePlaceholder, { value: channel.name });
|
|
2498
|
+
if (name !== undefined && name.trim() !== channel.name) {
|
|
2499
|
+
await service.updateChannel(channel.id, { name });
|
|
2500
|
+
}
|
|
2501
|
+
});
|
|
2502
|
+
const editTopic = act(async () => {
|
|
2503
|
+
const topic = await pi.ui.input(w.editTopic, w.topicPlaceholder, { value: channel.topic ?? "" });
|
|
2504
|
+
if (topic !== undefined && topic.trim() !== (channel.topic ?? "")) {
|
|
2505
|
+
await service.updateChannel(channel.id, { topic });
|
|
2506
|
+
}
|
|
2507
|
+
});
|
|
2508
|
+
const members = act(() => {
|
|
2509
|
+
context.showChannel(channel.id);
|
|
2510
|
+
context.showMembers();
|
|
2511
|
+
});
|
|
2512
|
+
const stop = act(async () => {
|
|
2513
|
+
const files = new Set(service.state.team.agents.filter((agent) => working.includes(agent.id) && agent.sessionFile).map((agent) => agent.sessionFile));
|
|
2514
|
+
const sessions = (await pi.server.listSessions()).filter((session) => session.sessionFile && files.has(session.sessionFile));
|
|
2515
|
+
await Promise.all(sessions.map((session) => pi.server.abort(session.sessionId)));
|
|
2516
|
+
pi.ui.notify(ChannelWords.format(w.stoppedChannel, { channel: channel.name }), "info");
|
|
2517
|
+
});
|
|
2518
|
+
const exportMarkdown = act(async () => {
|
|
2519
|
+
const messages = await service.messages(channel.id);
|
|
2520
|
+
if (!messages.some((message) => message.text.trim())) {
|
|
2521
|
+
pi.ui.notify(ChannelWords.format(w.noMessagesToExport, { channel: channel.name }), "info");
|
|
2522
|
+
return;
|
|
2523
|
+
}
|
|
2524
|
+
download2(`${channel.name}.md`, ChannelsUtil.channelMarkdown(service.state.team, channel, messages, { user: w.you, ta: w.ta }));
|
|
2525
|
+
});
|
|
2526
|
+
const remove = act(async () => {
|
|
2527
|
+
const sure = await pi.ui.confirm(ChannelWords.format(w.confirmDelete, { channel: channel.name }), undefined, {
|
|
2528
|
+
confirmLabel: w.delete,
|
|
2529
|
+
danger: true
|
|
2530
|
+
});
|
|
2531
|
+
if (sure) {
|
|
2532
|
+
await service.deleteChannel(channel.id);
|
|
2533
|
+
}
|
|
2534
|
+
});
|
|
2535
|
+
const item = (key, label, glyph, run, options = {}) => ({
|
|
2536
|
+
key,
|
|
2537
|
+
label,
|
|
2538
|
+
icon: icon(glyph),
|
|
2539
|
+
run,
|
|
2540
|
+
...options
|
|
2541
|
+
});
|
|
2542
|
+
return /* @__PURE__ */ React.createElement(MoreMenu, {
|
|
2543
|
+
pi,
|
|
2544
|
+
label: channel.name,
|
|
2545
|
+
items: () => [
|
|
2546
|
+
[
|
|
2547
|
+
item("pin", channel.pinned ? w.unpin : w.pin, channel.pinned ? "PinOff" : "Pin", pin),
|
|
2548
|
+
item("read", unread ? w.markRead : w.markUnread, unread ? "MessageSquareText" : "MessageSquareDot", markRead)
|
|
2549
|
+
],
|
|
2550
|
+
[item("rename", w.rename, "Pencil", rename), item("topic", w.editTopic, "Text", editTopic), item("members", w.showMembers, "Users", members)],
|
|
2551
|
+
[item("stop", w.stopAnswering, "Square", stop, { disabled: working.length === 0 }), item("export", w.exportChat, "Download", exportMarkdown)],
|
|
2552
|
+
[item("delete", w.deleteChannel, "Trash2", remove, { danger: true })]
|
|
2553
|
+
]
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
// web-src/sidebar.tsx
|
|
2558
|
+
function Row({ avatar, title, badge, preview, live, time, fresh, hint, selected, onSelect, more }) {
|
|
2559
|
+
const row = /* @__PURE__ */ React.createElement("button", {
|
|
2560
|
+
type: "button",
|
|
2561
|
+
className: `tac-item${selected ? " tac-selected" : ""}`,
|
|
2562
|
+
"aria-current": selected || undefined,
|
|
2563
|
+
title: hint,
|
|
2564
|
+
onClick: onSelect
|
|
2565
|
+
}, avatar, /* @__PURE__ */ React.createElement("span", {
|
|
2566
|
+
className: "tac-item-text"
|
|
2567
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2568
|
+
className: "tac-item-top"
|
|
2569
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2570
|
+
className: "tac-item-title"
|
|
2571
|
+
}, title), badge, /* @__PURE__ */ React.createElement("span", {
|
|
2572
|
+
className: "tac-item-time"
|
|
2573
|
+
}, time)), /* @__PURE__ */ React.createElement("span", {
|
|
2574
|
+
className: "tac-item-bottom"
|
|
2575
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2576
|
+
className: `tac-item-preview${live ? " tac-live" : ""}`
|
|
2577
|
+
}, preview), fresh && /* @__PURE__ */ React.createElement("span", {
|
|
2578
|
+
className: "tac-fresh"
|
|
2579
|
+
}))));
|
|
2580
|
+
return more ? /* @__PURE__ */ React.createElement("div", {
|
|
2581
|
+
className: `tac-item-row${selected ? " tac-selected" : ""}`
|
|
2582
|
+
}, row, more) : row;
|
|
2583
|
+
}
|
|
2584
|
+
function SidebarHead({ context }) {
|
|
2585
|
+
const { pi, ui } = context;
|
|
2586
|
+
const { query, creating } = useUi(ui);
|
|
2587
|
+
const w = ChannelViews.words(pi);
|
|
2588
|
+
const [menu, setMenu] = React.useState(false);
|
|
2589
|
+
const menuRef = React.useRef(null);
|
|
2590
|
+
const Plus = ChannelViews.icon(pi, "Plus");
|
|
2591
|
+
const Search = ChannelViews.icon(pi, "Search");
|
|
2592
|
+
const X = ChannelViews.icon(pi, "X");
|
|
2593
|
+
const Hash = ChannelViews.icon(pi, "Hash");
|
|
2594
|
+
const Bot = ChannelViews.icon(pi, "Bot");
|
|
2595
|
+
React.useEffect(() => {
|
|
2596
|
+
if (!menu) {
|
|
2597
|
+
return;
|
|
2598
|
+
}
|
|
2599
|
+
const close = (event) => {
|
|
2600
|
+
if (!menuRef.current?.contains(event.target)) {
|
|
2601
|
+
setMenu(false);
|
|
2602
|
+
}
|
|
2603
|
+
};
|
|
2604
|
+
document.addEventListener("pointerdown", close);
|
|
2605
|
+
return () => document.removeEventListener("pointerdown", close);
|
|
2606
|
+
}, [menu]);
|
|
2607
|
+
const begin = (kind) => {
|
|
2608
|
+
setMenu(false);
|
|
2609
|
+
if (kind === "agent") {
|
|
2610
|
+
newAgent(context);
|
|
2611
|
+
} else {
|
|
2612
|
+
ui.set({ creating: true });
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2616
|
+
className: "tac-toolbar"
|
|
2617
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
2618
|
+
className: "tac-search"
|
|
2619
|
+
}, /* @__PURE__ */ React.createElement(Search, {
|
|
2620
|
+
size: 14
|
|
2621
|
+
}), /* @__PURE__ */ React.createElement("input", {
|
|
2622
|
+
value: query,
|
|
2623
|
+
placeholder: w.search,
|
|
2624
|
+
"aria-label": w.search,
|
|
2625
|
+
onChange: (event) => ui.set({ query: event.target.value })
|
|
2626
|
+
}), query && /* @__PURE__ */ React.createElement("button", {
|
|
2627
|
+
type: "button",
|
|
2628
|
+
className: "tac-action",
|
|
2629
|
+
title: w.clear,
|
|
2630
|
+
"aria-label": w.clear,
|
|
2631
|
+
onClick: () => ui.set({ query: "" })
|
|
2632
|
+
}, /* @__PURE__ */ React.createElement(X, {
|
|
2633
|
+
size: 12
|
|
2634
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
2635
|
+
className: "tac-menu-anchor",
|
|
2636
|
+
ref: menuRef
|
|
2637
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2638
|
+
type: "button",
|
|
2639
|
+
className: "tac-add",
|
|
2640
|
+
title: w.new,
|
|
2641
|
+
"aria-label": w.new,
|
|
2642
|
+
"aria-haspopup": "menu",
|
|
2643
|
+
"aria-expanded": menu,
|
|
2644
|
+
onClick: () => setMenu(!menu)
|
|
2645
|
+
}, /* @__PURE__ */ React.createElement(Plus, {
|
|
2646
|
+
size: 16
|
|
2647
|
+
})), menu && /* @__PURE__ */ React.createElement("div", {
|
|
2648
|
+
className: "tac-menu",
|
|
2649
|
+
role: "menu"
|
|
2650
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2651
|
+
type: "button",
|
|
2652
|
+
role: "menuitem",
|
|
2653
|
+
onClick: () => begin("agent")
|
|
2654
|
+
}, /* @__PURE__ */ React.createElement(Bot, {
|
|
2655
|
+
size: 14
|
|
2656
|
+
}), w.newAgent), /* @__PURE__ */ React.createElement("button", {
|
|
2657
|
+
type: "button",
|
|
2658
|
+
role: "menuitem",
|
|
2659
|
+
onClick: () => begin("channel")
|
|
2660
|
+
}, /* @__PURE__ */ React.createElement(Hash, {
|
|
2661
|
+
size: 14
|
|
2662
|
+
}), w.newChannel))), creating && /* @__PURE__ */ React.createElement(NewChannelDialog, {
|
|
2663
|
+
context,
|
|
2664
|
+
onClose: () => ui.set({ creating: false })
|
|
2665
|
+
}));
|
|
2666
|
+
}
|
|
2667
|
+
function AgentsSidebar({ context }) {
|
|
2668
|
+
const { pi, service, ui } = context;
|
|
2669
|
+
const state = useChannels(service);
|
|
2670
|
+
const { query, draft, channelId, fresh } = useUi(ui);
|
|
2671
|
+
const w = ChannelViews.words(pi);
|
|
2672
|
+
const faces = useFaces(state.team);
|
|
2673
|
+
const serverCwd = useServerCwd(pi) ?? "";
|
|
2674
|
+
const shownSession = pi.ui.useSessionId();
|
|
2675
|
+
const double = pi.ui.useView(DOUBLE_PAGE);
|
|
2676
|
+
const channelPage = pi.ui.useView(CHANNEL_PAGE);
|
|
2677
|
+
const agentPage = pi.ui.useView(AGENT_PAGE);
|
|
2678
|
+
const [opening, setOpening] = React.useState();
|
|
2679
|
+
const Folder = ChannelViews.icon(pi, "Folder");
|
|
2680
|
+
const Avatar = pi.ui.Avatar;
|
|
2681
|
+
const { team, working } = state;
|
|
2682
|
+
React.useEffect(() => {
|
|
2683
|
+
for (const channel of team.channels) {
|
|
2684
|
+
service.messages(channel.id).catch(() => {
|
|
2685
|
+
return;
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2688
|
+
}, [service, team.channels]);
|
|
2689
|
+
const name = (id) => ChannelsUtil.authorName(team, id, { user: w.you, ta: w.ta });
|
|
2690
|
+
const lastSaid = new Map;
|
|
2691
|
+
for (const messages of Object.values(state.messages)) {
|
|
2692
|
+
for (const message of messages) {
|
|
2693
|
+
lastSaid.set(message.author, Math.max(lastSaid.get(message.author) ?? 0, message.at));
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
const channels = ChannelsUtil.pinnedFirst(team.channels).filter((channel) => SidebarUtil.matches(query, channel.name, channel.topic, ...membersOf(team, channel).map((agent) => agent.name)));
|
|
2697
|
+
const agents = team.agents.filter((agent) => SidebarUtil.matches(query, agent.name, agent.role));
|
|
2698
|
+
const pageShown = !!double?.shown || !!channelPage?.shown || !!agentPage?.shown;
|
|
2699
|
+
const openAgent = (agent) => {
|
|
2700
|
+
setOpening(agent.id);
|
|
2701
|
+
ChannelViews.openAgent(context, agent.id).catch((error) => pi.ui.notify(ChannelViews.message(error), "error")).finally(() => setOpening(undefined));
|
|
2702
|
+
};
|
|
2703
|
+
const agentSelected = (agent) => {
|
|
2704
|
+
const sessionId = context.sessions.get(agent.id);
|
|
2705
|
+
return opening === agent.id || !pageShown && !!sessionId && sessionId === shownSession;
|
|
2706
|
+
};
|
|
2707
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2708
|
+
className: "tac-view"
|
|
2709
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2710
|
+
className: "tac-list"
|
|
2711
|
+
}, double && SidebarUtil.matches(query, double.title, w.myDouble) && /* @__PURE__ */ React.createElement("div", {
|
|
2712
|
+
className: "tac-double-row"
|
|
2713
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2714
|
+
type: "button",
|
|
2715
|
+
className: `tac-double${double.shown ? " tac-selected" : ""}`,
|
|
2716
|
+
"aria-current": double.shown || undefined,
|
|
2717
|
+
onClick: () => pi.ui.showView(DOUBLE_PAGE)
|
|
2718
|
+
}, /* @__PURE__ */ React.createElement(Avatar, {
|
|
2719
|
+
size: 44
|
|
2720
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2721
|
+
className: "tac-double-name"
|
|
2722
|
+
}, double.title)), double.menu && /* @__PURE__ */ React.createElement(MoreMenu, {
|
|
2723
|
+
pi,
|
|
2724
|
+
label: double.title,
|
|
2725
|
+
items: () => (double.menu?.() ?? []).map((section) => section.map(({ icon: Icon, ...item }) => ({ ...item, icon: Icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
2726
|
+
size: 15
|
|
2727
|
+
}) })))
|
|
2728
|
+
})), draft && /* @__PURE__ */ React.createElement(Row, {
|
|
2729
|
+
avatar: /* @__PURE__ */ React.createElement(Face, {
|
|
2730
|
+
face: draft.face,
|
|
2731
|
+
size: 36
|
|
2732
|
+
}),
|
|
2733
|
+
title: draft.name || w.newAgentName,
|
|
2734
|
+
preview: w.notStarted,
|
|
2735
|
+
time: "",
|
|
2736
|
+
selected: !!agentPage?.shown,
|
|
2737
|
+
onSelect: () => pi.ui.showView(AGENT_PAGE)
|
|
2738
|
+
}), state.loaded && team.agents.length === 0 && !draft && /* @__PURE__ */ React.createElement("div", {
|
|
2739
|
+
className: "tac-empty"
|
|
2740
|
+
}, w.noAgentsYet), state.loaded && team.agents.length > 0 && team.channels.length === 0 && !query && !draft && /* @__PURE__ */ React.createElement("div", {
|
|
2741
|
+
className: "tac-empty"
|
|
2742
|
+
}, w.empty), query && channels.length === 0 && agents.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
2743
|
+
className: "tac-empty"
|
|
2744
|
+
}, w.noMatch), channels.map((channel) => {
|
|
2745
|
+
const members = membersOf(team, channel);
|
|
2746
|
+
const busy = working[channel.id] ?? [];
|
|
2747
|
+
const last = state.messages[channel.id]?.filter((message) => message.author !== SYSTEM).at(-1);
|
|
2748
|
+
const preview = busy.length > 0 ? ChannelWords.format(w.answeringNow, { name: busy.map(name).join("、") }) : last ? `${name(last.author)}:${last.text.replace(/\s+/g, " ")}` : channel.topic ?? w.noMessages;
|
|
2749
|
+
return /* @__PURE__ */ React.createElement(Row, {
|
|
2750
|
+
key: channel.id,
|
|
2751
|
+
avatar: /* @__PURE__ */ React.createElement(RoomFace, {
|
|
2752
|
+
members,
|
|
2753
|
+
faces,
|
|
2754
|
+
size: 36,
|
|
2755
|
+
working: busy
|
|
2756
|
+
}),
|
|
2757
|
+
title: channel.name,
|
|
2758
|
+
badge: /* @__PURE__ */ React.createElement(React.Fragment, null, members[0] && /* @__PURE__ */ React.createElement("span", {
|
|
2759
|
+
className: "tac-lead",
|
|
2760
|
+
title: ChannelWords.format(w.leadOf, { name: members[0].name })
|
|
2761
|
+
}, ChannelViews.maybeIcon(pi, "Crown", null, 11), /* @__PURE__ */ React.createElement("span", null, w.lead)), channel.pinned && /* @__PURE__ */ React.createElement("span", {
|
|
2762
|
+
className: "tac-pinned",
|
|
2763
|
+
title: w.pinned,
|
|
2764
|
+
role: "img",
|
|
2765
|
+
"aria-label": w.pinned
|
|
2766
|
+
}, ChannelViews.maybeIcon(pi, "Pin", null, 12))),
|
|
2767
|
+
preview,
|
|
2768
|
+
live: busy.length > 0,
|
|
2769
|
+
time: SidebarUtil.time(last?.at ?? channel.createdAt, pi.ui.language),
|
|
2770
|
+
fresh: fresh.includes(channel.id),
|
|
2771
|
+
hint: channel.topic ? `#${channel.name} · ${channel.topic}` : `#${channel.name}`,
|
|
2772
|
+
selected: !!channelPage?.shown && channelId === channel.id,
|
|
2773
|
+
onSelect: () => context.showChannel(channel.id),
|
|
2774
|
+
more: /* @__PURE__ */ React.createElement(ChannelMenu, {
|
|
2775
|
+
context,
|
|
2776
|
+
channel,
|
|
2777
|
+
working: busy
|
|
2778
|
+
})
|
|
2779
|
+
});
|
|
2780
|
+
}), SidebarUtil.byDirectory(agents, serverCwd).map((group) => /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
2781
|
+
key: group.cwd
|
|
2782
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2783
|
+
className: "tac-folder",
|
|
2784
|
+
title: group.cwd
|
|
2785
|
+
}, /* @__PURE__ */ React.createElement(Folder, {
|
|
2786
|
+
size: 12
|
|
2787
|
+
}), /* @__PURE__ */ React.createElement("span", null, SidebarUtil.folder(group.cwd))), group.agents.map((agent) => {
|
|
2788
|
+
const where = team.channels.find((channel) => working[channel.id]?.includes(agent.id));
|
|
2789
|
+
return /* @__PURE__ */ React.createElement(Row, {
|
|
2790
|
+
key: agent.id,
|
|
2791
|
+
avatar: /* @__PURE__ */ React.createElement(AgentAvatar, {
|
|
2792
|
+
agent,
|
|
2793
|
+
faces,
|
|
2794
|
+
size: 36,
|
|
2795
|
+
working: !!where
|
|
2796
|
+
}),
|
|
2797
|
+
title: agent.name,
|
|
2798
|
+
preview: where ? ChannelWords.format(w.answeringIn, { channel: where.name }) : w.idle,
|
|
2799
|
+
live: !!where,
|
|
2800
|
+
time: SidebarUtil.time(lastSaid.get(agent.id) ?? agent.createdAt, pi.ui.language),
|
|
2801
|
+
hint: `@${agent.name} · ${agent.role}`,
|
|
2802
|
+
selected: agentSelected(agent),
|
|
2803
|
+
onSelect: () => openAgent(agent),
|
|
2804
|
+
more: /* @__PURE__ */ React.createElement(AgentMenu, {
|
|
2805
|
+
context,
|
|
2806
|
+
agent,
|
|
2807
|
+
cwd: agent.cwd ?? serverCwd,
|
|
2808
|
+
working: !!where
|
|
2809
|
+
})
|
|
2810
|
+
});
|
|
2811
|
+
})))));
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
// web-src/style.ts
|
|
2815
|
+
var STYLE = `
|
|
2816
|
+
.tac-view { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: 13px; }
|
|
2817
|
+
.tac-action { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ta-muted); cursor: pointer; }
|
|
2818
|
+
.tac-action:hover { background: var(--ta-hover); color: var(--ta-text); }
|
|
2819
|
+
.tac-toolbar { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
|
|
2820
|
+
.tac-search { position: relative; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 36px; padding: 0 6px 0 11px; border: 1px solid transparent; border-radius: 10px; background: var(--ta-raised); color: var(--ta-muted); transition: border-color 120ms, background 120ms; box-sizing: border-box; }
|
|
2821
|
+
.tac-search:focus-within { border-color: var(--ta-border-field); background: var(--ta-input); }
|
|
2822
|
+
.tac-search input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; outline: none; }
|
|
2823
|
+
.tac-search input::placeholder { color: var(--ta-muted); }
|
|
2824
|
+
.tac-search .tac-action { width: 20px; height: 20px; }
|
|
2825
|
+
.tac-menu-anchor { position: relative; flex: none; }
|
|
2826
|
+
.tac-add { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: var(--ta-raised); color: var(--ta-secondary); cursor: pointer; transition: background 120ms, color 120ms; }
|
|
2827
|
+
.tac-add:hover, .tac-add[aria-expanded="true"] { background: var(--ta-hover); color: var(--ta-text); }
|
|
2828
|
+
.tac-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 160px; padding: 4px; border: 1px solid var(--ta-border-muted); border-radius: 10px; background: var(--ta-raised); box-shadow: var(--ta-shadow-pop); }
|
|
2829
|
+
.tac-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--ta-body); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
|
|
2830
|
+
.tac-menu button:hover { background: var(--ta-hover); color: var(--ta-text); }
|
|
2831
|
+
.tac-menu button svg { color: var(--ta-muted); }
|
|
2832
|
+
.tac-list { flex: 1; min-height: 0; overflow: auto; padding: 2px 0 12px; }
|
|
2833
|
+
.tac-list > .tac-view > .tac-form { margin: 2px 10px 8px; }
|
|
2834
|
+
.tac-double { display: flex; flex-direction: column; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 6px 8px 10px; padding: 14px 10px 12px; border: 0; border-radius: 14px; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background 120ms; }
|
|
2835
|
+
.tac-double:hover { background: var(--ta-hover); }
|
|
2836
|
+
.tac-double.tac-selected { background: var(--ta-hover-strong); }
|
|
2837
|
+
.tac-double-row { position: relative; }
|
|
2838
|
+
.tac-pinned { display: inline-flex; flex: none; color: var(--ta-muted); }
|
|
2839
|
+
.tac-double-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2840
|
+
.tac-double-row > .tac-item-more { top: 14px; right: 16px; transform: none; }
|
|
2841
|
+
.tac-double-row:hover .tac-item-more > .tac-action { opacity: 1; }
|
|
2842
|
+
.tac-item-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
2843
|
+
.tac-item-bottom .tac-item-preview { flex: 1; min-width: 0; }
|
|
2844
|
+
.tac-fresh { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ta-green); }
|
|
2845
|
+
.tac-head { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding-left: 8px; }
|
|
2846
|
+
.tac-head-title { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; white-space: nowrap; }
|
|
2847
|
+
.tac-head-title strong { overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; font-weight: 600; }
|
|
2848
|
+
.tac-head-count { flex: none; color: var(--ta-muted); font-size: 12px; }
|
|
2849
|
+
.tac-head-topic { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ta-muted); font-size: 12.5px; }
|
|
2850
|
+
.tac-head-members { display: flex; align-items: center; flex: none; height: 32px; padding: 0 6px 0 10px; border: 0; border-radius: 999px; background: none; color: inherit; font: inherit; cursor: pointer; transition: background 120ms; }
|
|
2851
|
+
.tac-head-members:hover, .tac-head-members.tac-on { background: var(--ta-hover); }
|
|
2852
|
+
.tac-head-members:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
2853
|
+
.tac-head-face { display: inline-flex; margin-left: -4px; padding: 1px; border-radius: 50%; background: var(--ta-main); }
|
|
2854
|
+
.tac-head-members:hover .tac-head-face, .tac-head-members.tac-on .tac-head-face { background: var(--ta-hover); }
|
|
2855
|
+
.tac-head-more { margin-left: 4px; color: var(--ta-muted); font-size: 11.5px; }
|
|
2856
|
+
.tac-action.tac-on { background: var(--ta-hover-strong); color: var(--ta-text); }
|
|
2857
|
+
.tac-room-page { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--ta-main); color: var(--ta-text); }
|
|
2858
|
+
.tac-room-none { display: grid; place-items: center; flex: 1; color: var(--ta-muted); font-size: 13px; }
|
|
2859
|
+
.tac-chat { flex: 1; min-height: 0; overflow-y: auto; }
|
|
2860
|
+
.tac-chat-col { display: flex; flex-direction: column; gap: 4px; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 20px 24px 12px; box-sizing: border-box; }
|
|
2861
|
+
.tac-chat-time { align-self: center; margin: 14px 0 6px; color: var(--ta-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
|
|
2862
|
+
.tac-chat-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 12vh auto 0; max-width: 360px; color: var(--ta-muted); font-size: 13px; text-align: center; }
|
|
2863
|
+
.tac-chat-empty strong { margin-top: 6px; color: var(--ta-text); font-size: 16px; }
|
|
2864
|
+
.tac-chat-hint { margin-top: 4px; font-size: 12px; }
|
|
2865
|
+
.tac-mine { margin: 6px 0 2px; }
|
|
2866
|
+
.tac-msg { display: flex; align-items: flex-start; gap: 10px; }
|
|
2867
|
+
.tac-msg.tac-first { margin-top: 10px; }
|
|
2868
|
+
.tac-msg-face { display: flex; justify-content: center; width: 28px; flex: none; }
|
|
2869
|
+
.tac-msg-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(84%, var(--ta-col)); }
|
|
2870
|
+
.tac-msg-name { display: flex; align-items: center; gap: 6px; margin: 0 2px 4px; color: var(--ta-muted); font-size: 12px; line-height: 16px; }
|
|
2871
|
+
.tac-msg-lead { padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--ta-green) 12%, transparent); color: var(--ta-green); font-size: 10.5px; font-weight: 600; line-height: 15px; }
|
|
2872
|
+
.tac-msg-bubble { min-width: 0; max-width: 100%; padding: 9px 14px; border: 1px solid var(--ta-border-muted); border-radius: 5px 16px 16px 16px; background: var(--ta-side); color: var(--ta-body); line-height: 1.6; overflow-wrap: anywhere; }
|
|
2873
|
+
.tac-msg-bubble.tac-failed { border-color: color-mix(in srgb, var(--ta-red) 35%, transparent); }
|
|
2874
|
+
.tac-msg-failed { margin-bottom: 4px; color: var(--ta-red); font-size: 12px; }
|
|
2875
|
+
.tac-msg-bubble pre { max-width: 100%; overflow-x: auto; }
|
|
2876
|
+
.tac-mention { color: var(--ta-link); }
|
|
2877
|
+
.tac-notice { align-self: center; margin: 10px 0; padding: 3px 10px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-muted); font-size: 12px; }
|
|
2878
|
+
.tac-live { display: flex; align-items: center; gap: 8px; align-self: flex-start; margin: 10px 0 0 38px; padding: 5px 12px 5px 8px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-secondary); font-size: 12.5px; }
|
|
2879
|
+
.tac-live-faces { display: inline-flex; }
|
|
2880
|
+
.tac-live-faces > * + * { margin-left: -4px; }
|
|
2881
|
+
.tac-chat-bottom { width: 100%; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 8px 24px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; flex: none; display: flex; flex-direction: column; gap: 8px; }
|
|
2882
|
+
@media (max-width: 720px) {
|
|
2883
|
+
.tac-head-topic, .tac-head-face:nth-child(n + 4), .tac-head-more { display: none; }
|
|
2884
|
+
.tac-chat-col, .tac-chat-bottom { padding-left: 14px; padding-right: 14px; }
|
|
2885
|
+
.tac-msg-col { max-width: calc(100% - 38px); }
|
|
2886
|
+
}
|
|
2887
|
+
.tac-new-head { position: relative; display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; height: 100%; }
|
|
2888
|
+
.tac-new-title { position: relative; display: flex; justify-content: center; min-width: 0; }
|
|
2889
|
+
.tac-new-head > .tac-button { position: absolute; right: 0; }
|
|
2890
|
+
.tac-new-trigger { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
|
|
2891
|
+
.tac-new-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2892
|
+
.tac-new-trigger:hover, .tac-new-trigger[aria-expanded="true"] { background: var(--ta-hover); }
|
|
2893
|
+
.tac-new-trigger svg { flex: none; color: var(--ta-muted); }
|
|
2894
|
+
.tac-identity { position: absolute; top: calc(100% + 8px); left: 50%; z-index: 30; width: 300px; max-width: calc(100vw - 24px); padding: 12px; border: 1px solid var(--ta-border); border-radius: 14px; background: var(--ta-side); box-shadow: var(--ta-shadow-pop); transform: translateX(-50%); animation: tac-pop 140ms ease-out; box-sizing: border-box; }
|
|
2895
|
+
.tac-identity-label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; color: var(--ta-muted); font-size: 12px; }
|
|
2896
|
+
.tac-identity-label .tac-input { height: 36px; font-size: 13.5px; }
|
|
2897
|
+
.tac-faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
|
|
2898
|
+
.tac-face-pick { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 12px; background: none; cursor: pointer; transition: background 120ms, border-color 120ms; }
|
|
2899
|
+
.tac-face-pick:hover { background: var(--ta-hover); }
|
|
2900
|
+
.tac-face-pick.tac-on { border-color: var(--ta-border-focus); background: var(--ta-hover); }
|
|
2901
|
+
@keyframes tac-pop { from { opacity: 0; transform: translate(-50%, -4px); } to { opacity: 1; transform: translate(-50%, 0); } }
|
|
2902
|
+
.tac-button.tac-quiet { border-color: transparent; background: none; color: var(--ta-secondary); }
|
|
2903
|
+
.tac-button.tac-quiet:hover { background: var(--ta-hover); color: var(--ta-text); }
|
|
2904
|
+
.tac-new-page { display: flex; flex: 1; min-height: 0; overflow-y: auto; background: var(--ta-main); color: var(--ta-text); }
|
|
2905
|
+
.tac-new-col { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: calc(var(--ta-col) + 48px); margin: auto; padding: 24px 24px calc(28px + env(safe-area-inset-bottom)); box-sizing: border-box; }
|
|
2906
|
+
.tac-new-name { display: flex; align-items: center; gap: 4px; margin: 16px 0 6px; font-size: 22px; font-weight: 700; }
|
|
2907
|
+
.tac-new-name .tac-action { color: var(--ta-muted); }
|
|
2908
|
+
.tac-new-hint { margin: 0 0 22px; max-width: 460px; color: var(--ta-muted); font-size: 13px; line-height: 1.6; text-align: center; }
|
|
2909
|
+
.tac-new-box { width: 100%; display: flex; flex-direction: column; gap: 8px; }
|
|
2910
|
+
.tac-dialog { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
|
|
2911
|
+
.tac-dialog-label { display: flex; flex-direction: column; gap: 8px; color: var(--ta-secondary); font-size: 13px; }
|
|
2912
|
+
div.tac-dialog-label { flex-direction: row; justify-content: space-between; margin-top: 6px; }
|
|
2913
|
+
.tac-dialog-count { color: var(--ta-muted); font-variant-numeric: tabular-nums; }
|
|
2914
|
+
.tac-dialog-input { height: 40px; font-size: 14px; }
|
|
2915
|
+
.tac-dialog-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--ta-border-field); border-radius: 10px; background: var(--ta-input); color: var(--ta-muted); box-sizing: border-box; }
|
|
2916
|
+
.tac-dialog-search:focus-within { border-color: var(--ta-border-focus); }
|
|
2917
|
+
.tac-dialog-search input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; outline: none; }
|
|
2918
|
+
.tac-pick-list { display: flex; flex-direction: column; max-height: min(320px, 40vh); overflow-y: auto; padding: 4px; border: 1px solid var(--ta-border-muted); border-radius: 12px; }
|
|
2919
|
+
.tac-pick-list > .tac-empty { padding: 14px 10px; }
|
|
2920
|
+
.tac-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; }
|
|
2921
|
+
.tac-pick:hover:not(:disabled) { background: var(--ta-hover); }
|
|
2922
|
+
.tac-pick:disabled { opacity: 0.45; cursor: default; }
|
|
2923
|
+
.tac-check { display: grid; place-items: center; width: 18px; height: 18px; flex: none; border: 1.5px solid var(--ta-border-field); border-radius: 5px; color: var(--ta-main); box-sizing: border-box; }
|
|
2924
|
+
.tac-pick.tac-on .tac-check { border-color: var(--ta-text); background: var(--ta-text); }
|
|
2925
|
+
.tac-pick-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
|
|
2926
|
+
.tac-pick-name { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }
|
|
2927
|
+
.tac-pick-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
|
|
2928
|
+
.tac-dialog-note { color: var(--ta-muted); font-size: 12px; }
|
|
2929
|
+
.tac-dialog-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
|
|
2930
|
+
.tac-dialog-actions .tac-button { height: 36px; padding: 0 18px; font-size: 13.5px; }
|
|
2931
|
+
@media (max-width: 720px) {
|
|
2932
|
+
.tac-new-head > .tac-button { position: static; margin-left: auto; }
|
|
2933
|
+
.tac-new-head { justify-content: flex-start; }
|
|
2934
|
+
.tac-identity { position: fixed; top: calc(60px + env(safe-area-inset-top) + var(--ta-titlebar, 0px)); left: 12px; right: 12px; width: auto; max-width: none; transform: none; animation: none; }
|
|
2935
|
+
}
|
|
2936
|
+
.tac-empty { padding: 8px 18px; }
|
|
2937
|
+
.tac-item { position: relative; display: flex; align-items: center; gap: 10px; width: calc(100% - 16px); margin: 4px 8px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; transition: background 120ms; }
|
|
2938
|
+
.tac-item:hover { background: var(--ta-hover); }
|
|
2939
|
+
.tac-item.tac-selected { background: var(--ta-hover-strong); }
|
|
2940
|
+
.tac-item.tac-selected::before { content: ''; position: absolute; left: 2px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--ta-green); }
|
|
2941
|
+
.tac-item-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
|
|
2942
|
+
.tac-item-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
2943
|
+
.tac-item-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 500; line-height: 18px; }
|
|
2944
|
+
.tac-item-time { flex: none; margin-left: auto; padding-left: 4px; color: var(--ta-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
|
|
2945
|
+
.tac-item-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; line-height: 17px; }
|
|
2946
|
+
.tac-item-preview.tac-live { color: var(--ta-green); }
|
|
2947
|
+
.tac-lead { display: inline-flex; align-items: center; gap: 3px; flex: none; max-width: 96px; overflow: hidden; padding: 0 6px; border: 1px solid color-mix(in srgb, var(--ta-green) 35%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--ta-green) 10%, transparent); color: var(--ta-green); font-size: 10.5px; font-weight: 600; line-height: 16px; white-space: nowrap; }
|
|
2948
|
+
.tac-lead span { overflow: hidden; text-overflow: ellipsis; }
|
|
2949
|
+
.tac-lead svg { flex: none; }
|
|
2950
|
+
.tac-folder { display: flex; align-items: center; gap: 5px; margin: 12px 18px 4px; color: var(--ta-muted); font-size: 11.5px; line-height: 16px; }
|
|
2951
|
+
.tac-folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2952
|
+
.tac-face { display: inline-flex; flex: none; }
|
|
2953
|
+
.tac-face svg { display: block; overflow: visible; }
|
|
2954
|
+
.tac-face-eyes { transform-box: fill-box; transform-origin: center; animation: tac-blink 5.2s infinite; }
|
|
2955
|
+
.tac-face[data-face="1"] .tac-face-eyes, .tac-face[data-face="5"] .tac-face-eyes, .tac-face[data-face="9"] .tac-face-eyes, .tac-face[data-face="13"] .tac-face-eyes { animation-delay: -1.7s; }
|
|
2956
|
+
.tac-face[data-face="2"] .tac-face-eyes, .tac-face[data-face="6"] .tac-face-eyes, .tac-face[data-face="10"] .tac-face-eyes, .tac-face[data-face="14"] .tac-face-eyes { animation-delay: -3.1s; }
|
|
2957
|
+
.tac-face[data-face="3"] .tac-face-eyes, .tac-face[data-face="7"] .tac-face-eyes, .tac-face[data-face="11"] .tac-face-eyes, .tac-face[data-face="15"] .tac-face-eyes { animation-delay: -4.4s; }
|
|
2958
|
+
.tac-face-working .tac-face-look { animation: tac-look 2.4s ease-in-out infinite; }
|
|
2959
|
+
.tac-face-working .tac-face-body { transform-box: fill-box; transform-origin: 50% 100%; animation: tac-bob 1.2s ease-in-out infinite; }
|
|
2960
|
+
@keyframes tac-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
|
|
2961
|
+
@keyframes tac-look { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.4px); } 70% { transform: translateX(1.4px); } }
|
|
2962
|
+
@keyframes tac-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.2px); } }
|
|
2963
|
+
@media (prefers-reduced-motion: reduce) { .tac-face * { animation: none !important; } }
|
|
2964
|
+
.tac-room { position: relative; display: inline-flex; flex: none; }
|
|
2965
|
+
.tac-room-back { position: absolute; right: 0; top: 0; }
|
|
2966
|
+
.tac-room-front { position: absolute; left: 0; bottom: 0; z-index: 1; }
|
|
2967
|
+
.tac-empty { padding: 8px; color: var(--ta-muted); font-size: 12px; line-height: 1.6; }
|
|
2968
|
+
.tac-error { color: var(--ta-red); }
|
|
2969
|
+
.tac-form { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; padding: 8px; border: 1px solid var(--ta-border-muted); border-radius: 8px; background: var(--ta-card); }
|
|
2970
|
+
.tac-form label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ta-secondary); }
|
|
2971
|
+
.tac-input { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid var(--ta-border-field); border-radius: 8px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: 13px; }
|
|
2972
|
+
.tac-input:focus { outline: none; border-color: var(--ta-border-focus); }
|
|
2973
|
+
textarea.tac-input { resize: vertical; min-height: 56px; line-height: 1.5; }
|
|
2974
|
+
.tac-chips { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
2975
|
+
.tac-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: none; color: var(--ta-body); font: inherit; font-size: 12px; cursor: pointer; }
|
|
2976
|
+
.tac-chip.tac-on { border-color: var(--ta-accent); color: var(--ta-text); background: var(--ta-selected); }
|
|
2977
|
+
.tac-chip small { color: var(--ta-muted); }
|
|
2978
|
+
.tac-buttons { display: flex; justify-content: flex-end; gap: 6px; }
|
|
2979
|
+
.tac-button { padding: 4px 12px; border: 1px solid var(--ta-border); border-radius: 8px; background: var(--ta-raised); color: var(--ta-text); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
2980
|
+
.tac-button.tac-primary { border-color: transparent; background: var(--ta-text); color: var(--ta-main); }
|
|
2981
|
+
.tac-button:disabled { opacity: 0.5; cursor: default; }
|
|
2982
|
+
.tac-button.tac-danger { border-color: transparent; background: var(--ta-red); color: #fff; }
|
|
2983
|
+
.tac-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--ta-secondary); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
2984
|
+
.tac-link:hover { background: var(--ta-hover); }
|
|
2985
|
+
.tac-link.tac-danger { color: var(--ta-red); }
|
|
2986
|
+
.tac-members { background: var(--ta-main); }
|
|
2987
|
+
.tac-members-none { display: grid; place-items: center; flex: 1; padding: 24px; color: var(--ta-muted); text-align: center; }
|
|
2988
|
+
.tac-members-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
|
|
2989
|
+
.tac-members-top { display: flex; align-items: center; gap: 12px; padding: 14px 10px 12px; }
|
|
2990
|
+
.tac-members-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
2991
|
+
.tac-members-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
|
|
2992
|
+
.tac-members-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
|
|
2993
|
+
.tac-members-label { padding: 10px 10px 6px; color: var(--ta-muted); font-size: 12px; }
|
|
2994
|
+
.tac-members-head { display: flex; align-items: center; gap: 6px; flex: none; padding: 10px 12px 4px 8px; font-size: 13.5px; }
|
|
2995
|
+
.tac-members-search { flex: none; margin: 6px 16px 2px; }
|
|
2996
|
+
.tac-members-sep { height: 1px; margin: 6px 10px; background: var(--ta-border-muted); }
|
|
2997
|
+
.tac-member { position: relative; display: flex; align-items: center; border-radius: 12px; transition: background 120ms; }
|
|
2998
|
+
.tac-member:hover, .tac-member:focus-within { background: var(--ta-hover); }
|
|
2999
|
+
.tac-member-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; }
|
|
3000
|
+
.tac-members-scroll > .tac-member-main:hover { background: var(--ta-hover); }
|
|
3001
|
+
.tac-member .tac-member-main:focus-visible, .tac-members-scroll > .tac-member-main:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
3002
|
+
.tac-member-plus { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--ta-hover); color: var(--ta-secondary); }
|
|
3003
|
+
.tac-member-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
|
|
3004
|
+
.tac-member-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; font-weight: 500; line-height: 18px; }
|
|
3005
|
+
.tac-member-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3006
|
+
.tac-member-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; line-height: 17px; }
|
|
3007
|
+
.tac-member-detail.tac-live { color: var(--ta-green); }
|
|
3008
|
+
.tac-member.tac-muted .tac-member-main > :first-child { opacity: 0.5; }
|
|
3009
|
+
.tac-member-actions { display: flex; align-items: center; gap: 2px; flex: none; padding-right: 8px; opacity: 0; transition: opacity 120ms; }
|
|
3010
|
+
.tac-member:hover .tac-member-actions, .tac-member:focus-within .tac-member-actions, .tac-member.tac-muted .tac-member-actions { opacity: 1; }
|
|
3011
|
+
.tac-member.tac-muted:not(:hover):not(:focus-within) .tac-member-actions > :not(.tac-on) { visibility: hidden; }
|
|
3012
|
+
.tac-member-actions .tac-action { width: 28px; height: 28px; border-radius: 8px; }
|
|
3013
|
+
.tac-member-actions .tac-action:disabled { opacity: 0.35; cursor: default; background: none; }
|
|
3014
|
+
.tac-member:hover .tac-action:not(:disabled):hover { background: var(--ta-hover-strong); }
|
|
3015
|
+
.tac-pick.tac-on { background: var(--ta-hover); }
|
|
3016
|
+
.tac-members-scroll > .tac-pick { margin: 1px 0; }
|
|
3017
|
+
.tac-check { display: grid; place-items: center; width: 18px; height: 18px; flex: none; box-sizing: border-box; border: 1.5px solid var(--ta-border-field); border-radius: 50%; color: var(--ta-main); }
|
|
3018
|
+
.tac-pick.tac-on .tac-check { border-color: var(--ta-green); background: var(--ta-green); }
|
|
3019
|
+
.tac-members-foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex: none; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ta-border-muted); }
|
|
3020
|
+
.tac-members-ask { flex: 1; min-width: 0; color: var(--ta-body); font-size: 12.5px; }
|
|
3021
|
+
.tac-button.tac-wide { flex: 1; height: 36px; border-radius: 10px; font-size: 13.5px; }
|
|
3022
|
+
@media (hover: none) {
|
|
3023
|
+
.tac-member-actions { opacity: 1; }
|
|
3024
|
+
.tac-member.tac-muted .tac-member-actions > :not(.tac-on) { visibility: visible; }
|
|
3025
|
+
}
|
|
3026
|
+
.tac-action:focus-visible, .tac-item:focus-visible, .tac-add:focus-visible, .tac-menu button:focus-visible, .tac-chip:focus-visible, .tac-button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
3027
|
+
.tac-mention { color: var(--ta-link); }
|
|
3028
|
+
@media (pointer: coarse) {
|
|
3029
|
+
.tac-item { padding: 10px; }
|
|
3030
|
+
.tac-action { width: 32px; height: 32px; }
|
|
3031
|
+
.tac-input { font-size: 16px; }
|
|
3032
|
+
}
|
|
3033
|
+
/* The … of an agent: over the time while its row is hovered, focused or its menu open */
|
|
3034
|
+
.tac-item-row { position: relative; }
|
|
3035
|
+
.tac-item-row > .tac-item { width: calc(100% - 16px); }
|
|
3036
|
+
.tac-item-more { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); z-index: 2; }
|
|
3037
|
+
.tac-item-more > .tac-action { width: 26px; height: 26px; background: var(--ta-hover-strong); color: var(--ta-secondary); opacity: 0; transition: opacity 120ms; }
|
|
3038
|
+
.tac-item-row:hover .tac-item-more > .tac-action, .tac-item-more > .tac-action:focus-visible, .tac-item-more > .tac-action[aria-expanded="true"] { opacity: 1; }
|
|
3039
|
+
.tac-item-row:hover .tac-item-time, .tac-item-row:has(.tac-item-more [aria-expanded="true"]) .tac-item-time { visibility: hidden; }
|
|
3040
|
+
.tac-agent-menu { top: calc(100% + 4px); width: 210px; padding: 5px; border-color: var(--ta-border); background: var(--ta-side); }
|
|
3041
|
+
.tac-agent-menu.tac-up { top: auto; bottom: calc(100% + 4px); }
|
|
3042
|
+
.tac-agent-menu button { gap: 10px; height: 32px; padding: 0 9px; border-radius: 7px; }
|
|
3043
|
+
.tac-agent-menu button:disabled { opacity: 0.4; cursor: default; background: none; }
|
|
3044
|
+
.tac-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3045
|
+
.tac-menu-line { height: 1px; margin: 4px 2px; border: 0; background: var(--ta-border-muted); }
|
|
3046
|
+
.tac-menu button.tac-danger, .tac-menu button.tac-danger svg { color: var(--ta-red); }
|
|
3047
|
+
textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: 13px; line-height: 1.6; }
|
|
3048
|
+
@media (max-width: 720px), (pointer: coarse) {
|
|
3049
|
+
.tac-item-more > .tac-action { opacity: 1; background: none; }
|
|
3050
|
+
.tac-item-row .tac-item-time { visibility: hidden; }
|
|
3051
|
+
}
|
|
3052
|
+
`;
|
|
3053
|
+
function injectStyle() {
|
|
3054
|
+
const element = document.createElement("style");
|
|
3055
|
+
element.dataset.taPackage = "ta-channels";
|
|
3056
|
+
element.textContent = STYLE;
|
|
3057
|
+
document.head.appendChild(element);
|
|
3058
|
+
return () => element.remove();
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
// web-src/index.tsx
|
|
3062
|
+
function activate(pi) {
|
|
3063
|
+
bind(pi.React);
|
|
3064
|
+
const removeStyle = injectStyle();
|
|
3065
|
+
const service = new ChannelsClient(pi.storage);
|
|
3066
|
+
const ui = new ChannelsUiStore;
|
|
3067
|
+
const context = {
|
|
3068
|
+
pi,
|
|
3069
|
+
service,
|
|
3070
|
+
ui,
|
|
3071
|
+
sessions: new Map,
|
|
3072
|
+
showChannel: (channelId) => {
|
|
3073
|
+
ui.set({ channelId, adding: false, fresh: ui.state.fresh.filter((id) => id !== channelId) });
|
|
3074
|
+
pi.ui.showView(CHANNEL_PAGE);
|
|
3075
|
+
},
|
|
3076
|
+
showMembers: (adding = false) => {
|
|
3077
|
+
ui.set({ adding });
|
|
3078
|
+
pi.ui.showView(MEMBERS_VIEW);
|
|
3079
|
+
}
|
|
3080
|
+
};
|
|
3081
|
+
pi.registerView("channels", {
|
|
3082
|
+
title: () => ChannelWords.of(pi.ui.language).title,
|
|
3083
|
+
icon: ChannelViews.icon(pi, "Bot"),
|
|
3084
|
+
head: () => /* @__PURE__ */ React.createElement(SidebarHead, {
|
|
3085
|
+
context
|
|
3086
|
+
}),
|
|
3087
|
+
render: () => /* @__PURE__ */ React.createElement(AgentsSidebar, {
|
|
3088
|
+
context
|
|
3089
|
+
}),
|
|
3090
|
+
location: "sidebar",
|
|
3091
|
+
pages: [DOUBLE_PAGE, CHANNEL_PAGE, AGENT_PAGE],
|
|
3092
|
+
order: 80
|
|
3093
|
+
});
|
|
3094
|
+
pi.registerView("channel", {
|
|
3095
|
+
title: () => {
|
|
3096
|
+
const channel = service.state.team.channels.find((candidate) => candidate.id === ui.state.channelId);
|
|
3097
|
+
return channel ? channel.name : ChannelWords.of(pi.ui.language).channel;
|
|
3098
|
+
},
|
|
3099
|
+
icon: ChannelViews.icon(pi, "Hash"),
|
|
3100
|
+
head: () => /* @__PURE__ */ React.createElement(ChannelHead, {
|
|
3101
|
+
context
|
|
3102
|
+
}),
|
|
3103
|
+
render: () => /* @__PURE__ */ React.createElement(ChannelRoom, {
|
|
3104
|
+
context
|
|
3105
|
+
})
|
|
3106
|
+
});
|
|
3107
|
+
pi.registerView("agent", {
|
|
3108
|
+
title: () => ui.state.draft?.name || ChannelWords.of(pi.ui.language).newAgentName,
|
|
3109
|
+
icon: ChannelViews.icon(pi, "Bot"),
|
|
3110
|
+
head: () => /* @__PURE__ */ React.createElement(NewAgentHead, {
|
|
3111
|
+
context
|
|
3112
|
+
}),
|
|
3113
|
+
render: () => /* @__PURE__ */ React.createElement(NewAgentPage, {
|
|
3114
|
+
context
|
|
3115
|
+
})
|
|
3116
|
+
});
|
|
3117
|
+
pi.registerView("members", {
|
|
3118
|
+
title: () => ChannelWords.of(pi.ui.language).showMembers,
|
|
3119
|
+
icon: ChannelViews.icon(pi, "Users"),
|
|
3120
|
+
render: () => /* @__PURE__ */ React.createElement(MembersView, {
|
|
3121
|
+
context
|
|
3122
|
+
}),
|
|
3123
|
+
location: "panel",
|
|
3124
|
+
order: 60
|
|
3125
|
+
});
|
|
3126
|
+
pi.registerAvatar((props) => /* @__PURE__ */ React.createElement(SessionAvatar, {
|
|
3127
|
+
context,
|
|
3128
|
+
...props
|
|
3129
|
+
}));
|
|
3130
|
+
const stopFocus = service.onFocus((channelId) => {
|
|
3131
|
+
if (!ui.state.fresh.includes(channelId)) {
|
|
3132
|
+
ui.set({ fresh: [...ui.state.fresh, channelId] });
|
|
3133
|
+
}
|
|
3134
|
+
});
|
|
3135
|
+
service.load();
|
|
3136
|
+
return () => {
|
|
3137
|
+
stopFocus();
|
|
3138
|
+
service.dispose();
|
|
3139
|
+
removeStyle();
|
|
3140
|
+
};
|
|
3141
|
+
}
|
|
3142
|
+
export {
|
|
3143
|
+
activate as default
|
|
3144
|
+
};
|