@celljs/ta 4.12.0 → 4.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/dist/cli.mjs +1006 -164
- package/dist/gateway.mjs +182 -2
- package/dist/pi/CHANGELOG.md +15 -0
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-agents/README.en.md +1 -1
- package/dist/pi/packages/ta-agents/README.md +1 -1
- package/dist/pi/packages/ta-agents/extension/index.mjs +75 -11
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +2 -2
- package/dist/pi/packages/ta-agents/lib/acp-protocol.js +5 -2
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +6 -4
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +7 -5
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +2 -0
- package/dist/pi/packages/ta-agents/lib/agent-session.js +7 -0
- package/dist/pi/packages/ta-agents/lib/agent-tool.d.ts +2 -0
- package/dist/pi/packages/ta-agents/lib/agent-tool.js +44 -3
- package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +12 -2
- package/dist/pi/packages/ta-agents/lib/agent-turn.js +29 -4
- package/dist/pi/packages/ta-agents/package.json +1 -1
- package/dist/pi/packages/ta-bots/extension/index.mjs +72 -0
- package/dist/pi/packages/ta-bots/host/index.mjs +178 -0
- package/dist/pi/packages/ta-bots/package.json +7 -2
- package/dist/pi/packages/ta-changes/extension/index.mjs +72 -0
- package/dist/pi/packages/ta-changes/package.json +8 -2
- package/dist/pi/packages/ta-channels/README.en.md +3 -1
- package/dist/pi/packages/ta-channels/README.md +3 -1
- package/dist/pi/packages/ta-channels/extension/index.mjs +78 -4
- package/dist/pi/packages/ta-channels/host/index.mjs +289 -8
- package/dist/pi/packages/ta-channels/lib/channels-model.d.ts +25 -0
- package/dist/pi/packages/ta-channels/lib/channels-util.js +8 -2
- package/dist/pi/packages/ta-channels/lib/extension.js +2 -2
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts +1 -0
- package/dist/pi/packages/ta-channels/lib/i18n.js +2 -0
- package/dist/pi/packages/ta-channels/lib/room.d.ts +0 -4
- package/dist/pi/packages/ta-channels/lib/room.js +31 -5
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +7 -13
- package/dist/pi/packages/ta-channels/lib/team-view.d.ts +19 -0
- package/dist/pi/packages/ta-channels/lib/team-view.js +45 -0
- package/dist/pi/packages/ta-channels/lib/team.d.ts +20 -4
- package/dist/pi/packages/ta-channels/lib/team.js +87 -6
- package/dist/pi/packages/ta-channels/package.json +26 -2
- package/dist/pi/packages/ta-channels/web/index.js +137 -27
- package/dist/pi/packages/ta-computer-use/package.json +1 -1
- package/dist/pi/packages/ta-cron/README.en.md +2 -2
- package/dist/pi/packages/ta-cron/README.md +2 -2
- package/dist/pi/packages/ta-cron/extension/index.mjs +113 -258
- package/dist/pi/packages/ta-cron/host/index.mjs +9 -0
- package/dist/pi/packages/ta-cron/lib/chat-task.d.ts +16 -15
- package/dist/pi/packages/ta-cron/lib/chat-task.js +45 -36
- package/dist/pi/packages/ta-cron/lib/extension.js +12 -8
- package/dist/pi/packages/ta-cron/lib/i18n.d.ts +5 -7
- package/dist/pi/packages/ta-cron/lib/i18n.js +10 -14
- package/dist/pi/packages/ta-cron/lib/index.js +0 -2
- package/dist/pi/packages/ta-cron/lib/page.d.ts +5 -0
- package/dist/pi/packages/ta-cron/lib/page.js +24 -0
- package/dist/pi/packages/ta-cron/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-cron/lib/style.js +8 -0
- package/dist/pi/packages/ta-cron/lib/task-change.d.ts +11 -0
- package/dist/pi/packages/ta-cron/lib/task-change.js +43 -0
- package/dist/pi/packages/ta-cron/lib/task-extension.d.ts +3 -0
- package/dist/pi/packages/ta-cron/lib/task-extension.js +2 -0
- package/dist/pi/packages/ta-cron/lib/task-util.d.ts +5 -0
- package/dist/pi/packages/ta-cron/lib/task-util.js +13 -0
- package/dist/pi/packages/ta-cron/lib/tasks-view.js +26 -2
- package/dist/pi/packages/ta-cron/package.json +10 -2
- package/dist/pi/packages/ta-cron/web/index.js +607 -784
- package/dist/pi/packages/ta-extensions/README.en.md +1 -2
- package/dist/pi/packages/ta-extensions/README.md +1 -2
- package/dist/pi/packages/ta-extensions/lib/i18n.d.ts +0 -4
- package/dist/pi/packages/ta-extensions/lib/i18n.js +2 -10
- package/dist/pi/packages/ta-extensions/lib/index.js +0 -2
- package/dist/pi/packages/ta-extensions/package.json +10 -2
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +15 -11
- package/dist/pi/packages/ta-extensions/web/index.js +197 -97
- package/dist/pi/packages/ta-games/package.json +8 -2
- package/dist/pi/packages/ta-glance/README.en.md +1 -0
- package/dist/pi/packages/ta-glance/README.md +1 -0
- package/dist/pi/packages/ta-glance/extension/index.mjs +446 -3
- package/dist/pi/packages/ta-glance/lib/card.js +38 -12
- package/dist/pi/packages/ta-glance/lib/extension.d.ts +3 -0
- package/dist/pi/packages/ta-glance/lib/extension.js +10 -0
- package/dist/pi/packages/ta-glance/lib/glance-ask.d.ts +15 -0
- package/dist/pi/packages/ta-glance/lib/glance-ask.js +97 -0
- package/dist/pi/packages/ta-glance/lib/glance-prompt.d.ts +1 -1
- package/dist/pi/packages/ta-glance/lib/glance-prompt.js +3 -3
- package/dist/pi/packages/ta-glance/lib/glance-protocol.d.ts +2 -0
- package/dist/pi/packages/ta-glance/lib/glance-protocol.js +3 -1
- package/dist/pi/packages/ta-glance/lib/glance-spec.d.ts +6 -1
- package/dist/pi/packages/ta-glance/lib/glance-spec.js +41 -7
- package/dist/pi/packages/ta-glance/lib/i18n.d.ts +5 -0
- package/dist/pi/packages/ta-glance/lib/i18n.js +9 -0
- package/dist/pi/packages/ta-glance/lib/index.js +4 -1
- package/dist/pi/packages/ta-glance/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-glance/lib/style.js +9 -1
- package/dist/pi/packages/ta-glance/package.json +1 -1
- package/dist/pi/packages/ta-glance/web/index.js +87 -19
- package/dist/pi/packages/ta-initiative/README.en.md +66 -0
- package/dist/pi/packages/ta-initiative/README.md +66 -0
- package/dist/pi/packages/ta-initiative/extension/index.mjs +741 -0
- package/dist/pi/packages/ta-initiative/host/index.mjs +1169 -0
- package/dist/pi/packages/ta-initiative/lib/chat-kinds.d.ts +4 -0
- package/dist/pi/packages/ta-initiative/lib/chat-kinds.js +17 -0
- package/dist/pi/packages/ta-initiative/lib/chat-proposals.d.ts +28 -0
- package/dist/pi/packages/ta-initiative/lib/chat-proposals.js +79 -0
- package/dist/pi/packages/ta-initiative/lib/conversation.d.ts +4 -0
- package/dist/pi/packages/ta-initiative/lib/conversation.js +27 -0
- package/dist/pi/packages/ta-initiative/lib/cron-proposals.d.ts +23 -0
- package/dist/pi/packages/ta-initiative/lib/cron-proposals.js +94 -0
- package/dist/pi/packages/ta-initiative/lib/event-proposals.d.ts +13 -0
- package/dist/pi/packages/ta-initiative/lib/event-proposals.js +76 -0
- package/dist/pi/packages/ta-initiative/lib/extension.d.ts +30 -0
- package/dist/pi/packages/ta-initiative/lib/extension.js +237 -0
- package/dist/pi/packages/ta-initiative/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-initiative/lib/host.js +11 -0
- package/dist/pi/packages/ta-initiative/lib/i18n.d.ts +79 -0
- package/dist/pi/packages/ta-initiative/lib/i18n.js +159 -0
- package/dist/pi/packages/ta-initiative/lib/inbox-util.d.ts +19 -0
- package/dist/pi/packages/ta-initiative/lib/inbox-util.js +45 -0
- package/dist/pi/packages/ta-initiative/lib/inbox.d.ts +23 -0
- package/dist/pi/packages/ta-initiative/lib/inbox.js +142 -0
- package/dist/pi/packages/ta-initiative/lib/index.d.ts +10 -0
- package/dist/pi/packages/ta-initiative/lib/index.js +121 -0
- package/dist/pi/packages/ta-initiative/lib/initiative-protocol.d.ts +320 -0
- package/dist/pi/packages/ta-initiative/lib/initiative-protocol.js +96 -0
- package/dist/pi/packages/ta-initiative/lib/initiative-service.d.ts +37 -0
- package/dist/pi/packages/ta-initiative/lib/initiative-service.js +104 -0
- package/dist/pi/packages/ta-initiative/lib/initiative-store.d.ts +44 -0
- package/dist/pi/packages/ta-initiative/lib/initiative-store.js +112 -0
- package/dist/pi/packages/ta-initiative/lib/level-util.d.ts +22 -0
- package/dist/pi/packages/ta-initiative/lib/level-util.js +86 -0
- package/dist/pi/packages/ta-initiative/lib/material-util.d.ts +34 -0
- package/dist/pi/packages/ta-initiative/lib/material-util.js +155 -0
- package/dist/pi/packages/ta-initiative/lib/notices.d.ts +13 -0
- package/dist/pi/packages/ta-initiative/lib/notices.js +65 -0
- package/dist/pi/packages/ta-initiative/lib/notify-util.d.ts +25 -0
- package/dist/pi/packages/ta-initiative/lib/notify-util.js +60 -0
- package/dist/pi/packages/ta-initiative/lib/pace-util.d.ts +21 -0
- package/dist/pi/packages/ta-initiative/lib/pace-util.js +60 -0
- package/dist/pi/packages/ta-initiative/lib/page-initiative.d.ts +9 -0
- package/dist/pi/packages/ta-initiative/lib/page-initiative.js +40 -0
- package/dist/pi/packages/ta-initiative/lib/proposal-book.d.ts +61 -0
- package/dist/pi/packages/ta-initiative/lib/proposal-book.js +397 -0
- package/dist/pi/packages/ta-initiative/lib/react.d.ts +11 -0
- package/dist/pi/packages/ta-initiative/lib/react.js +16 -0
- package/dist/pi/packages/ta-initiative/lib/review-service.d.ts +32 -0
- package/dist/pi/packages/ta-initiative/lib/review-service.js +155 -0
- package/dist/pi/packages/ta-initiative/lib/server-texts.d.ts +7 -0
- package/dist/pi/packages/ta-initiative/lib/server-texts.js +17 -0
- package/dist/pi/packages/ta-initiative/lib/settings.d.ts +10 -0
- package/dist/pi/packages/ta-initiative/lib/settings.js +226 -0
- package/dist/pi/packages/ta-initiative/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-initiative/lib/style.js +56 -0
- package/dist/pi/packages/ta-initiative/lib/tool.d.ts +106 -0
- package/dist/pi/packages/ta-initiative/lib/tool.js +98 -0
- package/dist/pi/packages/ta-initiative/package.json +63 -0
- package/dist/pi/packages/ta-initiative/web/index.js +1226 -0
- package/dist/pi/packages/ta-launcher/README.en.md +2 -1
- package/dist/pi/packages/ta-launcher/README.md +2 -1
- package/dist/pi/packages/ta-launcher/lib/i18n.d.ts +2 -0
- package/dist/pi/packages/ta-launcher/lib/i18n.js +4 -0
- package/dist/pi/packages/ta-launcher/lib/launcher-view.js +32 -0
- package/dist/pi/packages/ta-launcher/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-launcher/lib/style.js +11 -0
- package/dist/pi/packages/ta-launcher/package.json +1 -1
- package/dist/pi/packages/ta-launcher/web/index.js +58 -1
- package/dist/pi/packages/ta-manual/lib/pictures-b.js +29 -0
- package/dist/pi/packages/ta-manual/lib/pictures-c.js +109 -2
- package/dist/pi/packages/ta-manual/lib/topics.d.ts +4 -0
- package/dist/pi/packages/ta-manual/lib/topics.js +123 -11
- package/dist/pi/packages/ta-manual/package.json +1 -1
- package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +45 -10
- package/dist/pi/packages/ta-manual/web/index.js +567 -12
- package/dist/pi/packages/ta-moments/README.en.md +29 -0
- package/dist/pi/packages/ta-moments/README.md +29 -0
- package/dist/pi/packages/ta-moments/extension/index.mjs +1787 -0
- package/dist/pi/packages/ta-moments/host/index.mjs +2415 -0
- package/dist/pi/packages/ta-moments/lib/brief-util.d.ts +30 -0
- package/dist/pi/packages/ta-moments/lib/brief-util.js +92 -0
- package/dist/pi/packages/ta-moments/lib/context.d.ts +18 -0
- package/dist/pi/packages/ta-moments/lib/context.js +35 -0
- package/dist/pi/packages/ta-moments/lib/draft-card.d.ts +6 -0
- package/dist/pi/packages/ta-moments/lib/draft-card.js +60 -0
- package/dist/pi/packages/ta-moments/lib/editor.d.ts +16 -0
- package/dist/pi/packages/ta-moments/lib/editor.js +126 -0
- package/dist/pi/packages/ta-moments/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-moments/lib/extension.js +136 -0
- package/dist/pi/packages/ta-moments/lib/friends.d.ts +13 -0
- package/dist/pi/packages/ta-moments/lib/friends.js +27 -0
- package/dist/pi/packages/ta-moments/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-moments/lib/host.js +11 -0
- package/dist/pi/packages/ta-moments/lib/i18n.d.ts +92 -0
- package/dist/pi/packages/ta-moments/lib/i18n.js +201 -0
- package/dist/pi/packages/ta-moments/lib/image-util.d.ts +18 -0
- package/dist/pi/packages/ta-moments/lib/image-util.js +71 -0
- package/dist/pi/packages/ta-moments/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-moments/lib/index.js +50 -0
- package/dist/pi/packages/ta-moments/lib/moments-host.d.ts +133 -0
- package/dist/pi/packages/ta-moments/lib/moments-host.js +821 -0
- package/dist/pi/packages/ta-moments/lib/moments-protocol.d.ts +334 -0
- package/dist/pi/packages/ta-moments/lib/moments-protocol.js +99 -0
- package/dist/pi/packages/ta-moments/lib/page.d.ts +7 -0
- package/dist/pi/packages/ta-moments/lib/page.js +307 -0
- package/dist/pi/packages/ta-moments/lib/post-util.d.ts +31 -0
- package/dist/pi/packages/ta-moments/lib/post-util.js +205 -0
- package/dist/pi/packages/ta-moments/lib/server-texts.d.ts +29 -0
- package/dist/pi/packages/ta-moments/lib/server-texts.js +104 -0
- package/dist/pi/packages/ta-moments/lib/store.d.ts +33 -0
- package/dist/pi/packages/ta-moments/lib/store.js +108 -0
- package/dist/pi/packages/ta-moments/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-moments/lib/style.js +155 -0
- package/dist/pi/packages/ta-moments/lib/talk-host.d.ts +112 -0
- package/dist/pi/packages/ta-moments/lib/talk-host.js +582 -0
- package/dist/pi/packages/ta-moments/lib/talk-util.d.ts +26 -0
- package/dist/pi/packages/ta-moments/lib/talk-util.js +145 -0
- package/dist/pi/packages/ta-moments/lib/tool.d.ts +48 -0
- package/dist/pi/packages/ta-moments/lib/tool.js +56 -0
- package/dist/pi/packages/ta-moments/package.json +61 -0
- package/dist/pi/packages/ta-moments/web/index.js +2008 -0
- package/dist/pi/packages/ta-nearby/README.en.md +33 -0
- package/dist/pi/packages/ta-nearby/README.md +33 -0
- package/dist/pi/packages/ta-nearby/extension/index.mjs +410 -0
- package/dist/pi/packages/ta-nearby/host/index.mjs +1859 -0
- package/dist/pi/packages/ta-nearby/lib/extension.d.ts +27 -0
- package/dist/pi/packages/ta-nearby/lib/extension.js +190 -0
- package/dist/pi/packages/ta-nearby/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-nearby/lib/host.js +20 -0
- package/dist/pi/packages/ta-nearby/lib/i18n.d.ts +92 -0
- package/dist/pi/packages/ta-nearby/lib/i18n.js +183 -0
- package/dist/pi/packages/ta-nearby/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-nearby/lib/index.js +38 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-crypto.d.ts +31 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-crypto.js +59 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-meet.d.ts +35 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-meet.js +93 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-net.d.ts +59 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-net.js +253 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-protocol.d.ts +274 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-protocol.js +31 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-service.d.ts +199 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-service.js +1012 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-spot.d.ts +50 -0
- package/dist/pi/packages/ta-nearby/lib/nearby-spot.js +167 -0
- package/dist/pi/packages/ta-nearby/lib/page.d.ts +52 -0
- package/dist/pi/packages/ta-nearby/lib/page.js +588 -0
- package/dist/pi/packages/ta-nearby/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-nearby/lib/react.js +8 -0
- package/dist/pi/packages/ta-nearby/lib/server-texts.d.ts +45 -0
- package/dist/pi/packages/ta-nearby/lib/server-texts.js +148 -0
- package/dist/pi/packages/ta-nearby/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-nearby/lib/style.js +92 -0
- package/dist/pi/packages/ta-nearby/package.json +65 -0
- package/dist/pi/packages/ta-nearby/web/index.js +1055 -0
- package/dist/pi/packages/ta-notify/README.en.md +3 -1
- package/dist/pi/packages/ta-notify/README.md +3 -1
- package/dist/pi/packages/ta-notify/extension/index.mjs +85 -0
- package/dist/pi/packages/ta-notify/host/index.mjs +24 -1
- package/dist/pi/packages/ta-notify/lib/extension.d.ts +4 -1
- package/dist/pi/packages/ta-notify/lib/extension.js +20 -1
- package/dist/pi/packages/ta-notify/lib/notify-protocol.d.ts +23 -3
- package/dist/pi/packages/ta-notify/lib/notify-service.d.ts +4 -2
- package/dist/pi/packages/ta-notify/lib/notify-service.js +27 -2
- package/dist/pi/packages/ta-notify/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-notify/lib/style.js +1 -1
- package/dist/pi/packages/ta-notify/lib/watcher.js +2 -1
- package/dist/pi/packages/ta-notify/package.json +7 -2
- package/dist/pi/packages/ta-notify/web/index.js +3 -2
- package/dist/pi/packages/ta-recall/README.en.md +15 -6
- package/dist/pi/packages/ta-recall/README.md +15 -6
- package/dist/pi/packages/ta-recall/extension/index.mjs +311 -134
- package/dist/pi/packages/ta-recall/host/index.mjs +472 -116
- package/dist/pi/packages/ta-recall/lib/block-util.d.ts +11 -0
- package/dist/pi/packages/ta-recall/lib/block-util.js +43 -0
- package/dist/pi/packages/ta-recall/lib/brief-util.d.ts +25 -0
- package/dist/pi/packages/ta-recall/lib/brief-util.js +38 -1
- package/dist/pi/packages/ta-recall/lib/composer.d.ts +3 -2
- package/dist/pi/packages/ta-recall/lib/composer.js +9 -8
- package/dist/pi/packages/ta-recall/lib/extension-util.d.ts +21 -0
- package/dist/pi/packages/ta-recall/lib/extension-util.js +104 -0
- package/dist/pi/packages/ta-recall/lib/extension.d.ts +3 -3
- package/dist/pi/packages/ta-recall/lib/extension.js +31 -23
- package/dist/pi/packages/ta-recall/lib/i18n.d.ts +18 -10
- package/dist/pi/packages/ta-recall/lib/i18n.js +40 -24
- package/dist/pi/packages/ta-recall/lib/index.d.ts +2 -2
- package/dist/pi/packages/ta-recall/lib/index.js +5 -4
- package/dist/pi/packages/ta-recall/lib/keep-card.d.ts +10 -0
- package/dist/pi/packages/ta-recall/lib/keep-card.js +83 -0
- package/dist/pi/packages/ta-recall/lib/keep-util.d.ts +15 -0
- package/dist/pi/packages/ta-recall/lib/keep-util.js +55 -0
- package/dist/pi/packages/ta-recall/lib/recall-protocol.d.ts +92 -18
- package/dist/pi/packages/ta-recall/lib/recall-protocol.js +19 -9
- package/dist/pi/packages/ta-recall/lib/recall-service.d.ts +16 -6
- package/dist/pi/packages/ta-recall/lib/recall-service.js +101 -11
- package/dist/pi/packages/ta-recall/lib/requests-util.d.ts +6 -0
- package/dist/pi/packages/ta-recall/lib/requests-util.js +37 -0
- package/dist/pi/packages/ta-recall/lib/server-texts.d.ts +2 -0
- package/dist/pi/packages/ta-recall/lib/server-texts.js +5 -0
- package/dist/pi/packages/ta-recall/lib/settings.d.ts +1 -1
- package/dist/pi/packages/ta-recall/lib/settings.js +1 -1
- package/dist/pi/packages/ta-recall/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-recall/lib/style.js +2 -2
- package/dist/pi/packages/ta-recall/lib/tool-line.d.ts +2 -2
- package/dist/pi/packages/ta-recall/lib/tool-line.js +10 -5
- package/dist/pi/packages/ta-recall/lib/tool.d.ts +14 -5
- package/dist/pi/packages/ta-recall/lib/tool.js +29 -17
- package/dist/pi/packages/ta-recall/package.json +13 -5
- package/dist/pi/packages/ta-recall/web/index.js +414 -153
- package/dist/pi/packages/ta-rooms/README.en.md +6 -3
- package/dist/pi/packages/ta-rooms/README.md +6 -3
- package/dist/pi/packages/ta-rooms/extension/index.mjs +194 -9
- package/dist/pi/packages/ta-rooms/host/index.mjs +1023 -234
- package/dist/pi/packages/ta-rooms/lib/dialogs.js +5 -0
- package/dist/pi/packages/ta-rooms/lib/double-agents.d.ts +26 -0
- package/dist/pi/packages/ta-rooms/lib/double-agents.js +84 -0
- package/dist/pi/packages/ta-rooms/lib/double-grants.d.ts +22 -0
- package/dist/pi/packages/ta-rooms/lib/double-grants.js +140 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.d.ts +43 -40
- package/dist/pi/packages/ta-rooms/lib/double-host.js +142 -311
- package/dist/pi/packages/ta-rooms/lib/double-i18n.d.ts +20 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.js +40 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.d.ts +96 -3
- package/dist/pi/packages/ta-rooms/lib/double-protocol.js +58 -3
- package/dist/pi/packages/ta-rooms/lib/double-tasks.d.ts +82 -0
- package/dist/pi/packages/ta-rooms/lib/double-tasks.js +527 -0
- package/dist/pi/packages/ta-rooms/lib/double-user.d.ts +19 -0
- package/dist/pi/packages/ta-rooms/lib/double-user.js +124 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.d.ts +34 -2
- package/dist/pi/packages/ta-rooms/lib/double-util.js +60 -2
- package/dist/pi/packages/ta-rooms/lib/doubles-store.d.ts +4 -1
- package/dist/pi/packages/ta-rooms/lib/doubles-store.js +8 -2
- package/dist/pi/packages/ta-rooms/lib/doubles-view.js +7 -2
- package/dist/pi/packages/ta-rooms/lib/extension.d.ts +9 -0
- package/dist/pi/packages/ta-rooms/lib/extension.js +35 -8
- package/dist/pi/packages/ta-rooms/lib/friend-notices.d.ts +12 -0
- package/dist/pi/packages/ta-rooms/lib/friend-notices.js +47 -0
- package/dist/pi/packages/ta-rooms/lib/friends-view.d.ts +20 -0
- package/dist/pi/packages/ta-rooms/lib/friends-view.js +224 -0
- package/dist/pi/packages/ta-rooms/lib/host.d.ts +2 -1
- package/dist/pi/packages/ta-rooms/lib/host.js +9 -2
- package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +23 -2
- package/dist/pi/packages/ta-rooms/lib/i18n.js +60 -18
- package/dist/pi/packages/ta-rooms/lib/index.js +18 -1
- package/dist/pi/packages/ta-rooms/lib/members-view.js +12 -1
- package/dist/pi/packages/ta-rooms/lib/page.d.ts +42 -4
- package/dist/pi/packages/ta-rooms/lib/page.js +108 -24
- package/dist/pi/packages/ta-rooms/lib/room-view.js +7 -3
- package/dist/pi/packages/ta-rooms/lib/rooms-page.js +6 -17
- package/dist/pi/packages/ta-rooms/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-rooms/lib/style.js +31 -6
- package/dist/pi/packages/ta-rooms/lib/tasks-view.d.ts +41 -0
- package/dist/pi/packages/ta-rooms/lib/tasks-view.js +228 -0
- package/dist/pi/packages/ta-rooms/package.json +11 -2
- package/dist/pi/packages/ta-rooms/web/index.js +1633 -751
- package/dist/pi/packages/ta-share/README.en.md +1 -1
- package/dist/pi/packages/ta-share/README.md +1 -1
- package/dist/pi/packages/ta-share/extension/index.mjs +72 -0
- package/dist/pi/packages/ta-share/lib/i18n.js +6 -6
- package/dist/pi/packages/ta-share/lib/share-dialog.js +1 -1
- package/dist/pi/packages/ta-share/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-share/lib/style.js +4 -6
- package/dist/pi/packages/ta-share/package.json +10 -2
- package/dist/pi/packages/ta-share/web/index.js +12 -14
- package/dist/pi/packages/ta-sync/README.en.md +55 -0
- package/dist/pi/packages/ta-sync/README.md +55 -0
- package/dist/pi/packages/ta-sync/host/index.mjs +3763 -0
- package/dist/pi/packages/ta-sync/lib/host.d.ts +10 -0
- package/dist/pi/packages/ta-sync/lib/host.js +94 -0
- package/dist/pi/packages/ta-sync/lib/i18n.d.ts +98 -0
- package/dist/pi/packages/ta-sync/lib/i18n.js +202 -0
- package/dist/pi/packages/ta-sync/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-sync/lib/index.js +115 -0
- package/dist/pi/packages/ta-sync/lib/migrate-archive.d.ts +88 -0
- package/dist/pi/packages/ta-sync/lib/migrate-archive.js +439 -0
- package/dist/pi/packages/ta-sync/lib/migrate-frames.d.ts +77 -0
- package/dist/pi/packages/ta-sync/lib/migrate-frames.js +210 -0
- package/dist/pi/packages/ta-sync/lib/migrate-i18n.d.ts +99 -0
- package/dist/pi/packages/ta-sync/lib/migrate-i18n.js +210 -0
- package/dist/pi/packages/ta-sync/lib/migrate-net.d.ts +51 -0
- package/dist/pi/packages/ta-sync/lib/migrate-net.js +170 -0
- package/dist/pi/packages/ta-sync/lib/migrate-protocol.d.ts +126 -0
- package/dist/pi/packages/ta-sync/lib/migrate-protocol.js +43 -0
- package/dist/pi/packages/ta-sync/lib/migrate-service.d.ts +86 -0
- package/dist/pi/packages/ta-sync/lib/migrate-service.js +521 -0
- package/dist/pi/packages/ta-sync/lib/move-panel.d.ts +16 -0
- package/dist/pi/packages/ta-sync/lib/move-panel.js +320 -0
- package/dist/pi/packages/ta-sync/lib/move-store.d.ts +15 -0
- package/dist/pi/packages/ta-sync/lib/move-store.js +42 -0
- package/dist/pi/packages/ta-sync/lib/panel.d.ts +28 -0
- package/dist/pi/packages/ta-sync/lib/panel.js +305 -0
- package/dist/pi/packages/ta-sync/lib/pictures.d.ts +22 -0
- package/dist/pi/packages/ta-sync/lib/pictures.js +92 -0
- package/dist/pi/packages/ta-sync/lib/react.d.ts +11 -0
- package/dist/pi/packages/ta-sync/lib/react.js +16 -0
- package/dist/pi/packages/ta-sync/lib/server-texts.d.ts +29 -0
- package/dist/pi/packages/ta-sync/lib/server-texts.js +111 -0
- package/dist/pi/packages/ta-sync/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-sync/lib/style.js +108 -0
- package/dist/pi/packages/ta-sync/lib/sync-codec.d.ts +16 -0
- package/dist/pi/packages/ta-sync/lib/sync-codec.js +61 -0
- package/dist/pi/packages/ta-sync/lib/sync-engine.d.ts +57 -0
- package/dist/pi/packages/ta-sync/lib/sync-engine.js +203 -0
- package/dist/pi/packages/ta-sync/lib/sync-folder.d.ts +156 -0
- package/dist/pi/packages/ta-sync/lib/sync-folder.js +385 -0
- package/dist/pi/packages/ta-sync/lib/sync-identity.d.ts +60 -0
- package/dist/pi/packages/ta-sync/lib/sync-identity.js +201 -0
- package/dist/pi/packages/ta-sync/lib/sync-items.d.ts +104 -0
- package/dist/pi/packages/ta-sync/lib/sync-items.js +426 -0
- package/dist/pi/packages/ta-sync/lib/sync-merge.d.ts +42 -0
- package/dist/pi/packages/ta-sync/lib/sync-merge.js +109 -0
- package/dist/pi/packages/ta-sync/lib/sync-protocol.d.ts +134 -0
- package/dist/pi/packages/ta-sync/lib/sync-protocol.js +72 -0
- package/dist/pi/packages/ta-sync/lib/sync-service.d.ts +128 -0
- package/dist/pi/packages/ta-sync/lib/sync-service.js +679 -0
- package/dist/pi/packages/ta-sync/lib/sync-store.d.ts +15 -0
- package/dist/pi/packages/ta-sync/lib/sync-store.js +41 -0
- package/dist/pi/packages/ta-sync/package.json +57 -0
- package/dist/pi/packages/ta-sync/web/index.js +2018 -0
- package/dist/pi/packages/ta-sync-cloud/README.en.md +31 -0
- package/dist/pi/packages/ta-sync-cloud/README.md +31 -0
- package/dist/pi/packages/ta-sync-cloud/host/index.mjs +810 -0
- package/dist/pi/packages/ta-sync-cloud/lib/git-store.d.ts +90 -0
- package/dist/pi/packages/ta-sync-cloud/lib/git-store.js +393 -0
- package/dist/pi/packages/ta-sync-cloud/lib/host.d.ts +13 -0
- package/dist/pi/packages/ta-sync-cloud/lib/host.js +112 -0
- package/dist/pi/packages/ta-sync-cloud/lib/s3-store.d.ts +72 -0
- package/dist/pi/packages/ta-sync-cloud/lib/s3-store.js +206 -0
- package/dist/pi/packages/ta-sync-cloud/lib/store-util.d.ts +17 -0
- package/dist/pi/packages/ta-sync-cloud/lib/store-util.js +69 -0
- package/dist/pi/packages/ta-sync-cloud/lib/webdav-store.d.ts +40 -0
- package/dist/pi/packages/ta-sync-cloud/lib/webdav-store.js +144 -0
- package/dist/pi/packages/ta-sync-cloud/package.json +63 -0
- package/dist/pi/packages/ta-team/README.en.md +28 -0
- package/dist/pi/packages/ta-team/README.md +28 -0
- package/dist/pi/packages/ta-team/extension/index.mjs +285 -0
- package/dist/pi/packages/ta-team/host/index.mjs +2121 -0
- package/dist/pi/packages/ta-team/lib/dialogs.d.ts +13 -0
- package/dist/pi/packages/ta-team/lib/dialogs.js +335 -0
- package/dist/pi/packages/ta-team/lib/extension.d.ts +21 -0
- package/dist/pi/packages/ta-team/lib/extension.js +123 -0
- package/dist/pi/packages/ta-team/lib/host.d.ts +13 -0
- package/dist/pi/packages/ta-team/lib/host.js +45 -0
- package/dist/pi/packages/ta-team/lib/i18n.d.ts +200 -0
- package/dist/pi/packages/ta-team/lib/i18n.js +401 -0
- package/dist/pi/packages/ta-team/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-team/lib/index.js +67 -0
- package/dist/pi/packages/ta-team/lib/join.d.ts +28 -0
- package/dist/pi/packages/ta-team/lib/join.js +48 -0
- package/dist/pi/packages/ta-team/lib/member-dialog.d.ts +2 -0
- package/dist/pi/packages/ta-team/lib/member-dialog.js +121 -0
- package/dist/pi/packages/ta-team/lib/members-tab.d.ts +11 -0
- package/dist/pi/packages/ta-team/lib/members-tab.js +133 -0
- package/dist/pi/packages/ta-team/lib/page.d.ts +42 -0
- package/dist/pi/packages/ta-team/lib/page.js +142 -0
- package/dist/pi/packages/ta-team/lib/parts.d.ts +39 -0
- package/dist/pi/packages/ta-team/lib/parts.js +47 -0
- package/dist/pi/packages/ta-team/lib/policy.d.ts +37 -0
- package/dist/pi/packages/ta-team/lib/policy.js +215 -0
- package/dist/pi/packages/ta-team/lib/protocol.d.ts +285 -0
- package/dist/pi/packages/ta-team/lib/protocol.js +119 -0
- package/dist/pi/packages/ta-team/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-team/lib/react.js +8 -0
- package/dist/pi/packages/ta-team/lib/record-tab.d.ts +8 -0
- package/dist/pi/packages/ta-team/lib/record-tab.js +90 -0
- package/dist/pi/packages/ta-team/lib/remote.d.ts +31 -0
- package/dist/pi/packages/ta-team/lib/remote.js +128 -0
- package/dist/pi/packages/ta-team/lib/roles-tab.d.ts +9 -0
- package/dist/pi/packages/ta-team/lib/roles-tab.js +76 -0
- package/dist/pi/packages/ta-team/lib/seal.d.ts +28 -0
- package/dist/pi/packages/ta-team/lib/seal.js +75 -0
- package/dist/pi/packages/ta-team/lib/shared-home.d.ts +23 -0
- package/dist/pi/packages/ta-team/lib/shared-home.js +123 -0
- package/dist/pi/packages/ta-team/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-team/lib/style.js +99 -0
- package/dist/pi/packages/ta-team/lib/team-admin.d.ts +31 -0
- package/dist/pi/packages/ta-team/lib/team-admin.js +140 -0
- package/dist/pi/packages/ta-team/lib/team-audit.d.ts +35 -0
- package/dist/pi/packages/ta-team/lib/team-audit.js +152 -0
- package/dist/pi/packages/ta-team/lib/team-core.d.ts +58 -0
- package/dist/pi/packages/ta-team/lib/team-core.js +115 -0
- package/dist/pi/packages/ta-team/lib/team-error.d.ts +4 -0
- package/dist/pi/packages/ta-team/lib/team-error.js +8 -0
- package/dist/pi/packages/ta-team/lib/team-expiry.d.ts +15 -0
- package/dist/pi/packages/ta-team/lib/team-expiry.js +67 -0
- package/dist/pi/packages/ta-team/lib/team-files.d.ts +21 -0
- package/dist/pi/packages/ta-team/lib/team-files.js +119 -0
- package/dist/pi/packages/ta-team/lib/team-inbox.d.ts +8 -0
- package/dist/pi/packages/ta-team/lib/team-inbox.js +32 -0
- package/dist/pi/packages/ta-team/lib/team-invites.d.ts +46 -0
- package/dist/pi/packages/ta-team/lib/team-invites.js +204 -0
- package/dist/pi/packages/ta-team/lib/team-page.d.ts +6 -0
- package/dist/pi/packages/ta-team/lib/team-page.js +41 -0
- package/dist/pi/packages/ta-team/lib/team-paths.d.ts +15 -0
- package/dist/pi/packages/ta-team/lib/team-paths.js +70 -0
- package/dist/pi/packages/ta-team/lib/team-people.d.ts +28 -0
- package/dist/pi/packages/ta-team/lib/team-people.js +106 -0
- package/dist/pi/packages/ta-team/lib/team-requests.d.ts +24 -0
- package/dist/pi/packages/ta-team/lib/team-requests.js +126 -0
- package/dist/pi/packages/ta-team/lib/team-runs.d.ts +38 -0
- package/dist/pi/packages/ta-team/lib/team-runs.js +136 -0
- package/dist/pi/packages/ta-team/lib/team-service.d.ts +32 -0
- package/dist/pi/packages/ta-team/lib/team-service.js +58 -0
- package/dist/pi/packages/ta-team/lib/team-shares.d.ts +52 -0
- package/dist/pi/packages/ta-team/lib/team-shares.js +145 -0
- package/dist/pi/packages/ta-team/lib/team-waits.d.ts +8 -0
- package/dist/pi/packages/ta-team/lib/team-waits.js +42 -0
- package/dist/pi/packages/ta-team/lib/team-watch.d.ts +28 -0
- package/dist/pi/packages/ta-team/lib/team-watch.js +136 -0
- package/dist/pi/packages/ta-team/package.json +68 -0
- package/dist/pi/packages/ta-team/web/index.js +2741 -0
- package/dist/pi/packages/ta-workspace/package.json +1 -1
- package/dist/pi/packages/ta-workspace/web/index.js +178 -0
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-BnqtcbpZ.js → abnfDiagram-S7VZAUFO-C30pzFN3.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-BzPq1Ioe.js → architecture-WOLXFQ4H-wfYFQl2u.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW-BsquO3a7.js → architectureDiagram-YGSQEFNW-B05zgxyT.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-BQNYOEP4.js → blockDiagram-APKKGZFW-BhN8Bsu0.js} +1 -1
- package/dist/public/assets/{browser-DS711n7Y.js → browser-DteLjv_-.js} +1 -1
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-D6e79Ycq.js → c4Diagram-KJ2TOQU5-DvdF3qCV.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-B-sgaPoU.js → chunk-6MUBBAK2-DNavkrnr.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-D8pJKIg2.js → chunk-AXFCVDMN-DplVEqp_.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-86TL-vCz.js → chunk-BG4553SI-BazOaHvw.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-CfUVuGjc.js → chunk-DQASFODM-DmoQWa8b.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-Drm0FEYk.js → chunk-HFQBQIA3-Cj1m9ccz.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-BVFRADlC.js → chunk-KQLB2F66-_jbilrLX.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-DfyALEmP.js → chunk-KS47KZWR-CWU16Lut.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-DtJVzk2c.js → chunk-LEVMRMFU-wsbxWEZE.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-DTy27PHQ.js → chunk-M57EVK23-BGvmwwTv.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-nSgn7jZg.js → chunk-OY52VR5R-Bp3hJ4kT.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-CkSxO_X6.js → chunk-QB3YPZ4I-C1rQVxsJ.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-Ck6iAjAL.js → chunk-R3KSYZAL-CEy0dKWn.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-DQPHdSTh.js → chunk-STOXU5M4-akqvafwH.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-Bc2AbV2Y.js → chunk-TU62E6Q5-CVXAS4DS.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-Cgpm0IXm.js → chunk-X4PVCEUW-DT_bEMvQ.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-CGE4eLpg.js → chunk-XXDRQBXY-Bgv_n5Qh.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-4eQuDPEo.js → classDiagram-v2-L25IHNXF-BtjQChpS.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-tDLCWq07.js → cose-bilkent-JH36ORCC-DSrOY8Uk.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-DYlwwGUb.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-ByqcZ8x9.js → cynefinDiagram-L36ESFBY-DTy7FNFS.js} +1 -1
- package/dist/public/assets/{d3-selection-Bgn1374-.js → d3-selection-ip6rDUzY.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-mCgr71mV.js → dagre-SPEB5RXH-CHrks7Jb.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-DpYSwpQ0.js → diagram-3B7GL73J-eUJ7STAr.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-DMozUQzi.js → diagram-DNEMPZML-B_fptNkg.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-Bk5Uf8PD.js → diagram-L3MUGCDN-C15owCSG.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-DFt5cPVK.js → diagram-LA4NIPWU-Bfa1qEgY.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-BkZZcKqK.js → diagram-MHCOC4E2-Bwxsih_Q.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-HEY6kyyN.js → diagram-XPFHEONP-DKZ_lwah.js} +1 -1
- package/dist/public/assets/{dist-Bj2CrKn7.js → dist-VHGBaby6.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-D4JvYyVb.js → ebnfDiagram-UZSYDL2S-CCkttvYi.js} +1 -1
- package/dist/public/assets/{editor.api-BpJFzYbl.js → editor.api-a2gC0dVD.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-CT6qLJkF.js → elk-XV6XMXQE-DcikW39e.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-BGng1goR.js → erDiagram-EYBAPDEH-BE3TV5lU.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-Tt8O-Q1Z.js → eventmodeling-K75KTNOO-C2s1kutf.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-Bufgn1OL.js +1 -0
- package/dist/public/assets/{freemarker2-Dd5ksoRn.js → freemarker2-2e8pZojb.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-Jl8VO_g2.js → ganttDiagram-23REXITY-rGnJptii.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-D_tzR9z9.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-Be4qXALb.js → gitGraphDiagram-STJD7YCW-CNnsDjQA.js} +1 -1
- package/dist/public/assets/{handlebars-4xabgUi4.js → handlebars-CMKN6E37.js} +1 -1
- package/dist/public/assets/{html-Dk3kt2w_.js → html-0AjXQhkQ.js} +1 -1
- package/dist/public/assets/{index-Bx0c7eoh.js → index-TUtoc8CW.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-C5Pwv-6e.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-Coc0tdwb.js → infoDiagram-KBXO4MBG-DMKs8cuE.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-CE_1VQCg.js → ishikawaDiagram-M35NCXHK-Dg_IbA0G.js} +1 -1
- package/dist/public/assets/{javascript-DKLGqy6v.js → javascript-CqYOqPjw.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-CrolRZ_7.js → journeyDiagram-OPLOXDXO-ohAOfoEY.js} +1 -1
- package/dist/public/assets/{jsonMode-Chcs19_y.js → jsonMode-D-gI-S5H.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-CjJj47De.js → kanban-definition-BZKZHSQY-w-aKZS_U.js} +1 -1
- package/dist/public/assets/{liquid-jff3p-Ji.js → liquid-oBN7c8NZ.js} +1 -1
- package/dist/public/assets/{mdx-DW4uRDfJ.js → mdx-CnwhgGjX.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-XhQj6FvH.js → mermaid-parser.core-CfFkSR0t.js} +3 -3
- package/dist/public/assets/{mermaid.core-OD4Atimg.js → mermaid.core-apiVCSBY.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-DpGelVY7.js → mindmap-definition-I2QAS2VK-E7vqVWB0.js} +1 -1
- package/dist/public/assets/module-C2jtFD0v.js +2365 -0
- package/dist/public/assets/module-xT4L5yYw.js +1 -0
- package/dist/public/assets/{monaco-BTVZP-tU.js → monaco-C0ByxW3l.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-xozI7a9T.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-CqcBmPfB.js → pegDiagram-FD4XPPHP--RpwCE7x.js} +1 -1
- package/dist/public/assets/pie-XZMESJXO-BkHXIzDi.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-CRir3beB.js → pieDiagram-J4AKIIQI-DxSbPaRZ.js} +1 -1
- package/dist/public/assets/{python-BwW_0207.js → python-vNPe_Fao.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-DIY6gdcf.js → quadrantDiagram-XTYBLID2-CR_eeYXi.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-CaUh9zV3.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-DckPvlDe.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-XWNOzunl.js → railroad-abnf-LNEFI6M7-D6I2HxIC.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-CI0-j1Jz.js → railroad-ebnf-DWYD2UWJ-BuhDRGo3.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-BVB_IaIG.js → railroad-peg-JR7BVNR7-n15PB7Sb.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-CudwT6q2.js → railroadDiagram-MRQ6NCDL-Bbe5bNap.js} +1 -1
- package/dist/public/assets/{razor-DrjCyQqB.js → razor-CnKbF0Yz.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-CvRMeRqj.js → requirementDiagram-Y7LWUY3S-Beuygh9j.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-adxYCJKr.js → sankeyDiagram-WGJFYUXA-jwWPgnrS.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-lCRsoLUp.js → sequenceDiagram-5NDRBG5M-CmU-HYQI.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-DNst1BLg.js → stateDiagram-v2-FJ4FJNEA-Bo7BEi-m.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-S_omrdvA.js → swimlanes-UMQ2AFYF-PSKyZN_b.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-z_0ABNQq.js +8 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-_pMGrTE-.js → timeline-definition-SEUHKTQE-BuRxLScZ.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-BN38Jg9j.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-CKdz7u7W.js +1 -0
- package/dist/public/assets/{typescript-0-z_OYCU.js → typescript-C00ztMLg.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-B2oJKi5Q.js → usecaseDiagram-AFA6YXN4-Dlvyos8r.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-inPs2Kkr.js → vennDiagram-NNMJR3RB-CuLZubJH.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-B0cvM1zV.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-DNhNHM7b.js → wardleyDiagram-S7YFUSEH-WOGGTs4y.js} +1 -1
- package/dist/public/assets/{xml-BXPxQzKF.js → xml-CHBFuf5n.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-DJc93dNT.js → xychartDiagram-GGNKY7IX-DwW9eifP.js} +1 -1
- package/dist/public/assets/{yaml-CGmD9Rya.js → yaml-C4qkqzcL.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/serve/index.mjs +7738 -3839
- package/package.json +37 -31
- package/dist/pi/packages/ta-cron/lib/composer.d.ts +0 -11
- package/dist/pi/packages/ta-cron/lib/composer.js +0 -58
- package/dist/pi/packages/ta-extensions/lib/composer.d.ts +0 -17
- package/dist/pi/packages/ta-extensions/lib/composer.js +0 -84
- package/dist/pi/packages/ta-recall/lib/skill-card.d.ts +0 -9
- package/dist/pi/packages/ta-recall/lib/skill-card.js +0 -51
- package/dist/pi/packages/ta-recall/lib/skill-util.d.ts +0 -19
- package/dist/pi/packages/ta-recall/lib/skill-util.js +0 -110
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dd40W2Jh.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-uFzenfA3.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-D28I_jUc.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-5vIGEIq7.js +0 -1
- package/dist/public/assets/module-CrD0OHQp.js +0 -1
- package/dist/public/assets/module-DEBMgdtf.js +0 -2273
- package/dist/public/assets/packet-JDAUHWVQ-CBxQ5Mzy.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-DT5V3581.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-BAOovYEa.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-RZ2Rnwzh.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-By5lnz4u.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-Cyb9N8KY.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-BkMo57pG.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-CSt-uQ-Y.js +0 -1
|
@@ -174,9 +174,16 @@ var RelayHubUtil;
|
|
|
174
174
|
(function(RelayHubUtil2) {
|
|
175
175
|
function link(link2) {
|
|
176
176
|
const fragment = new URLSearchParams({ v: "1", r: link2.room, i: link2.invite, o: link2.owner, n: link2.title, by: link2.by });
|
|
177
|
+
if (link2.kind) {
|
|
178
|
+
fragment.set("c", link2.kind);
|
|
179
|
+
}
|
|
177
180
|
return `${link2.relay}${RELAY_ROOM_PATH}#${fragment}`;
|
|
178
181
|
}
|
|
179
182
|
RelayHubUtil2.link = link;
|
|
183
|
+
function withKind(text, kind) {
|
|
184
|
+
return link({ ...parse(text), kind });
|
|
185
|
+
}
|
|
186
|
+
RelayHubUtil2.withKind = withKind;
|
|
180
187
|
function is(text) {
|
|
181
188
|
try {
|
|
182
189
|
parse(text);
|
|
@@ -187,7 +194,7 @@ var RelayHubUtil;
|
|
|
187
194
|
}
|
|
188
195
|
RelayHubUtil2.is = is;
|
|
189
196
|
function parse(text) {
|
|
190
|
-
var _a, _b;
|
|
197
|
+
var _a, _b, _c;
|
|
191
198
|
const url = new URL(text.trim());
|
|
192
199
|
const fragment = new URLSearchParams(url.hash.slice(1));
|
|
193
200
|
const [room, invite, owner] = ["r", "i", "o"].map((name) => {
|
|
@@ -197,7 +204,16 @@ var RelayHubUtil;
|
|
|
197
204
|
if (!/^https?:$/.test(url.protocol) || url.pathname !== RELAY_ROOM_PATH || fragment.get("v") !== "1" || !RELAY_ID.test(room) || !/^[A-Za-z0-9_-]{43}$/.test(invite) || !/^[A-Za-z0-9_-]{22}$/.test(owner)) {
|
|
198
205
|
throw new Error("Not a link inviting into a room of Ta.");
|
|
199
206
|
}
|
|
200
|
-
|
|
207
|
+
const kind = (_a = fragment.get("c")) !== null && _a !== undefined ? _a : "";
|
|
208
|
+
return {
|
|
209
|
+
relay: url.origin,
|
|
210
|
+
room,
|
|
211
|
+
invite,
|
|
212
|
+
owner,
|
|
213
|
+
title: ((_b = fragment.get("n")) !== null && _b !== undefined ? _b : "").slice(0, 200),
|
|
214
|
+
by: ((_c = fragment.get("by")) !== null && _c !== undefined ? _c : "").slice(0, 100),
|
|
215
|
+
.../^[a-z0-9-]{1,40}$/.test(kind) ? { kind } : {}
|
|
216
|
+
};
|
|
201
217
|
}
|
|
202
218
|
RelayHubUtil2.parse = parse;
|
|
203
219
|
function randomId() {
|
|
@@ -306,6 +322,100 @@ ${d}`, s)) {
|
|
|
306
322
|
RelayHubUtil2.openAnswer = openAnswer;
|
|
307
323
|
})(RelayHubUtil || (RelayHubUtil = {}));
|
|
308
324
|
|
|
325
|
+
// ../ta-relay/esm/common/relay-friends.js
|
|
326
|
+
var RELAY_FRIENDS_KIND = "ta-friends";
|
|
327
|
+
var LEGACY_KINDS = new Set(["ta-moments"]);
|
|
328
|
+
var DAY_MS = 24 * 60 * 60 * 1000;
|
|
329
|
+
var RelayFriendsUtil;
|
|
330
|
+
(function(RelayFriendsUtil2) {
|
|
331
|
+
function isKind(kind) {
|
|
332
|
+
return kind === RELAY_FRIENDS_KIND || !!kind && LEGACY_KINDS.has(kind);
|
|
333
|
+
}
|
|
334
|
+
RelayFriendsUtil2.isKind = isKind;
|
|
335
|
+
function kindOf(kind) {
|
|
336
|
+
return LEGACY_KINDS.has(kind) ? RELAY_FRIENDS_KIND : kind;
|
|
337
|
+
}
|
|
338
|
+
RelayFriendsUtil2.kindOf = kindOf;
|
|
339
|
+
function isFriend(friend) {
|
|
340
|
+
const value = friend;
|
|
341
|
+
return !!value && typeof value.id === "string" && typeof value.name === "string" && typeof value.metAt === "number" && typeof value.seenAt === "number";
|
|
342
|
+
}
|
|
343
|
+
RelayFriendsUtil2.isFriend = isFriend;
|
|
344
|
+
function clean(friend) {
|
|
345
|
+
var _a;
|
|
346
|
+
return {
|
|
347
|
+
id: friend.id,
|
|
348
|
+
name: String((_a = friend.name) !== null && _a !== undefined ? _a : "").slice(0, 40),
|
|
349
|
+
...typeof friend.sign === "string" ? { sign: friend.sign } : {},
|
|
350
|
+
...typeof friend.box === "string" ? { box: friend.box } : {},
|
|
351
|
+
metAt: friend.metAt,
|
|
352
|
+
seenAt: friend.seenAt
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
RelayFriendsUtil2.clean = clean;
|
|
356
|
+
function mergeFriend(local, other) {
|
|
357
|
+
var _a, _b;
|
|
358
|
+
const later = other.seenAt > local.seenAt ? other : local;
|
|
359
|
+
const earlier = later === local ? other : local;
|
|
360
|
+
return clean({
|
|
361
|
+
...earlier,
|
|
362
|
+
...later,
|
|
363
|
+
sign: (_a = later.sign) !== null && _a !== undefined ? _a : earlier.sign,
|
|
364
|
+
box: (_b = later.box) !== null && _b !== undefined ? _b : earlier.box,
|
|
365
|
+
metAt: Math.min(local.metAt, other.metAt),
|
|
366
|
+
seenAt: Math.max(local.seenAt, other.seenAt)
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
RelayFriendsUtil2.mergeFriend = mergeFriend;
|
|
370
|
+
function requestOf(offer) {
|
|
371
|
+
return { id: offer.id, name: offer.name, at: offer.at, via: "room", room: offer.room };
|
|
372
|
+
}
|
|
373
|
+
RelayFriendsUtil2.requestOf = requestOf;
|
|
374
|
+
function book(value) {
|
|
375
|
+
const read = value !== null && value !== undefined ? value : {};
|
|
376
|
+
if (read.v !== 2) {
|
|
377
|
+
return { v: 2, friends: [], offers: [] };
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
v: 2,
|
|
381
|
+
friends: Array.isArray(read.friends) ? read.friends.filter(isFriend) : [],
|
|
382
|
+
offers: Array.isArray(read.offers) ? read.offers.filter((offer) => !!offer && typeof offer.id === "string" && typeof offer.link === "string") : []
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
RelayFriendsUtil2.book = book;
|
|
386
|
+
function migrate(records, stored) {
|
|
387
|
+
const read = stored !== null && stored !== undefined ? stored : {};
|
|
388
|
+
const legacy = records.some((record) => LEGACY_KINDS.has(record.kind));
|
|
389
|
+
if (read.v === 2 && !legacy) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const next = records.map((record) => LEGACY_KINDS.has(record.kind) ? { ...record, kind: RELAY_FRIENDS_KIND } : record);
|
|
393
|
+
if (read.v === 2) {
|
|
394
|
+
return { records: next, book: book(stored) };
|
|
395
|
+
}
|
|
396
|
+
const before = Array.isArray(read.friends) ? read.friends : [];
|
|
397
|
+
const now = Date.now();
|
|
398
|
+
const friends = [];
|
|
399
|
+
for (const record of next) {
|
|
400
|
+
if (record.own || record.kind !== RELAY_FRIENDS_KIND || record.status !== "member" && record.status !== "waiting") {
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
const known = before.find((friend) => (friend === null || friend === undefined ? undefined : friend.id) === record.owner.id);
|
|
404
|
+
if (!friends.some((friend) => friend.id === record.owner.id)) {
|
|
405
|
+
friends.push(clean({
|
|
406
|
+
...known !== null && known !== undefined ? known : {},
|
|
407
|
+
...record.owner,
|
|
408
|
+
name: record.owner.name || (known === null || known === undefined ? undefined : known.name) || "",
|
|
409
|
+
metAt: typeof (known === null || known === undefined ? undefined : known.metAt) === "number" ? known.metAt : now,
|
|
410
|
+
seenAt: typeof (known === null || known === undefined ? undefined : known.seenAt) === "number" ? known.seenAt : now
|
|
411
|
+
}));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return { records: next, book: { v: 2, friends, offers: [] } };
|
|
415
|
+
}
|
|
416
|
+
RelayFriendsUtil2.migrate = migrate;
|
|
417
|
+
})(RelayFriendsUtil || (RelayFriendsUtil = {}));
|
|
418
|
+
|
|
309
419
|
// ../ta-relay/esm/common/relay-room-chat.js
|
|
310
420
|
var RELAY_CHAT_KEY = "chat:";
|
|
311
421
|
var RELAY_CHAT_PART_BYTES = 8 * 1024;
|
|
@@ -343,7 +453,8 @@ var RelayRoomChatUtil;
|
|
|
343
453
|
...line.double === true ? { double: true } : {},
|
|
344
454
|
...agent && typeof agent.id === "string" && agent.id && typeof agent.name === "string" && line.double !== true ? { agent: { id: agent.id.slice(0, 64), name: agent.name.slice(0, 64) } } : {},
|
|
345
455
|
...to.length ? { to } : {},
|
|
346
|
-
...typeof line.re === "string" ? { re: line.re } : {}
|
|
456
|
+
...typeof line.re === "string" ? { re: line.re } : {},
|
|
457
|
+
...line.task === true && to.length ? { task: true } : {}
|
|
347
458
|
};
|
|
348
459
|
}
|
|
349
460
|
RelayRoomChatUtil2.extra = extra;
|
|
@@ -502,6 +613,47 @@ var RoomAgentsUtil;
|
|
|
502
613
|
}
|
|
503
614
|
RoomAgentsUtil.of = of;
|
|
504
615
|
})(RoomAgentsUtil ||= {});
|
|
616
|
+
var TASK_STATUSES = ["queued", "running", "permission", "done", "failed", "stopped", "declined"];
|
|
617
|
+
var ROOM_TASKS_KEY = "tasks:";
|
|
618
|
+
var ROOM_CANCEL_KEY = "cancel:";
|
|
619
|
+
var ROOM_TASKS_SHOWN = 30;
|
|
620
|
+
var RoomTasksUtil;
|
|
621
|
+
((RoomTasksUtil) => {
|
|
622
|
+
function key(member) {
|
|
623
|
+
return `${ROOM_TASKS_KEY}${member}`;
|
|
624
|
+
}
|
|
625
|
+
RoomTasksUtil.key = key;
|
|
626
|
+
function cancelKey(member) {
|
|
627
|
+
return `${ROOM_CANCEL_KEY}${member}`;
|
|
628
|
+
}
|
|
629
|
+
RoomTasksUtil.cancelKey = cancelKey;
|
|
630
|
+
function ended(status) {
|
|
631
|
+
return status === "done" || status === "failed" || status === "stopped" || status === "declined";
|
|
632
|
+
}
|
|
633
|
+
RoomTasksUtil.ended = ended;
|
|
634
|
+
function of(member, value, by) {
|
|
635
|
+
if (by !== member || !value || typeof value !== "object" || Array.isArray(value)) {
|
|
636
|
+
return {};
|
|
637
|
+
}
|
|
638
|
+
const tasks = {};
|
|
639
|
+
for (const [id, task] of Object.entries(value).slice(-ROOM_TASKS_SHOWN)) {
|
|
640
|
+
if (task && TASK_STATUSES.includes(task.status) && typeof task.at === "number") {
|
|
641
|
+
tasks[id] = {
|
|
642
|
+
status: task.status,
|
|
643
|
+
at: task.at,
|
|
644
|
+
...typeof task.detail === "string" && task.detail ? { detail: task.detail.slice(0, 200) } : {}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return tasks;
|
|
649
|
+
}
|
|
650
|
+
RoomTasksUtil.of = of;
|
|
651
|
+
function cancelled(member, value, by) {
|
|
652
|
+
return by === member && Array.isArray(value) ? value.filter((id) => typeof id === "string").slice(-ROOM_TASKS_SHOWN) : [];
|
|
653
|
+
}
|
|
654
|
+
RoomTasksUtil.cancelled = cancelled;
|
|
655
|
+
})(RoomTasksUtil ||= {});
|
|
656
|
+
var TASK_MESSAGE_TYPE = "ta-rooms:task";
|
|
505
657
|
var ROOM_CAPABILITIES = ["files", "commands"];
|
|
506
658
|
var DoubleKeys;
|
|
507
659
|
((DoubleKeys) => {
|
|
@@ -511,6 +663,9 @@ var DoubleKeys;
|
|
|
511
663
|
DoubleKeys.LOG = "doubles.log";
|
|
512
664
|
DoubleKeys.SESSIONS = "doubles.sessions";
|
|
513
665
|
DoubleKeys.READ = "doubles.read";
|
|
666
|
+
DoubleKeys.TASKS = "doubles.tasks";
|
|
667
|
+
DoubleKeys.HANDED = "doubles.handed";
|
|
668
|
+
DoubleKeys.DEVICE = "doubles.device";
|
|
514
669
|
})(DoubleKeys ||= {});
|
|
515
670
|
var GRANT_HOURS = [1, 24, 24 * 7];
|
|
516
671
|
|
|
@@ -524,16 +679,16 @@ var EN = {
|
|
|
524
679
|
renamePlaceholder: "What others see",
|
|
525
680
|
requests: "Asking to join",
|
|
526
681
|
requestLine: "wants to join “{title}”",
|
|
527
|
-
friendTag: "
|
|
682
|
+
friendTag: "Friend",
|
|
528
683
|
newTag: "New",
|
|
529
684
|
guestTag: "Web guest",
|
|
530
|
-
requestGuest: "They ask from a browser, without Ta: let in, they only chat
|
|
685
|
+
requestGuest: "They ask from a browser, without Ta: let in, they only chat.",
|
|
531
686
|
accept: "Let in",
|
|
532
687
|
refuse: "Refuse",
|
|
533
688
|
requestBody: "{name} wants to join your room “{title}”.",
|
|
534
689
|
requestsBody: "{n} people ask to join your rooms.",
|
|
535
|
-
requestFriend: "
|
|
536
|
-
requestNew: "
|
|
690
|
+
requestFriend: "They are your friend.",
|
|
691
|
+
requestNew: "They are not your friend: let in only someone you know.",
|
|
537
692
|
requestWhat: "Once in, they see the messages and the shared state of the room: in a game, where everyone is and what is built.",
|
|
538
693
|
later: "Later",
|
|
539
694
|
ownRoom: "Your room",
|
|
@@ -579,13 +734,34 @@ var EN = {
|
|
|
579
734
|
closeTitle: "Close “{title}” for everyone?",
|
|
580
735
|
closeHint: "Everyone is taken out, and the relay deletes all the room kept.",
|
|
581
736
|
forget: "Remove",
|
|
582
|
-
friends: "
|
|
583
|
-
|
|
737
|
+
friends: "Friends",
|
|
738
|
+
friendsCount: "{n}",
|
|
739
|
+
friendsNone: "Add one",
|
|
740
|
+
friendAdding: "Waiting for them to agree",
|
|
584
741
|
removeFriend: "Remove",
|
|
585
|
-
removeFriendTitle: "Remove {name} from your
|
|
586
|
-
removeFriendHint: "The rooms you share stay as they are.",
|
|
742
|
+
removeFriendTitle: "Remove {name} from your friends?",
|
|
743
|
+
removeFriendHint: "You are no longer friends on both sides: neither sees the other’s posts, nor what is shared with friends. The rooms you share stay as they are.",
|
|
744
|
+
addFriend: "Add friend",
|
|
745
|
+
addFriendHint: "Let them scan this code, or send them the link. Once you both agree, you are friends: you see each other’s posts and may share with each other.",
|
|
746
|
+
addFriendExpires: "Works for {days} more days",
|
|
747
|
+
addFriendAction: "Add as friend",
|
|
748
|
+
addFriendBody: "Ask {name} to be your friend? They see your name and answer in their Ta. Once both agree, you see each other’s posts and may share with each other.",
|
|
749
|
+
addFriendOwn: "This is your own code.",
|
|
750
|
+
addFriendKnown: "{name} is already your friend.",
|
|
751
|
+
addFriendAsked: "Asked {name}: you are friends once they agree",
|
|
752
|
+
friendOffer: "Add friend",
|
|
753
|
+
friendOffered: "Asked {name} to be friends",
|
|
754
|
+
friendRequestsTitle: "New friends",
|
|
755
|
+
friendRequestLink: "Wants to be your friend",
|
|
756
|
+
friendRequestRoom: "Asks in “{room}” to be your friend",
|
|
757
|
+
friendAccept: "Agree",
|
|
758
|
+
friendRequestNote: "Once friends, you see each other’s posts, and they may share with you. Agree only to someone you know.",
|
|
759
|
+
friendsEmpty: "No friends yet",
|
|
760
|
+
friendsEmptyHint: "Add a friend by a code or a link, or from the members of a room you are both in.",
|
|
761
|
+
scanFriend: "Scan",
|
|
762
|
+
pasteFriend: "Paste a link",
|
|
587
763
|
emptyTitle: "No rooms yet",
|
|
588
|
-
|
|
764
|
+
emptyListHint: "Make one with +, or open a link of invitation",
|
|
589
765
|
pickRoom: "Pick a room to chat in",
|
|
590
766
|
joinTitle: "Join “{title}”?",
|
|
591
767
|
joinBody: "A room of {by}. They let you in first, and your name “{name}” goes to them.",
|
|
@@ -622,16 +798,16 @@ var ZH = {
|
|
|
622
798
|
renamePlaceholder: "别人看到的名字",
|
|
623
799
|
requests: "加入申请",
|
|
624
800
|
requestLine: "想加入「{title}」",
|
|
625
|
-
friendTag: "
|
|
801
|
+
friendTag: "好友",
|
|
626
802
|
newTag: "新朋友",
|
|
627
803
|
guestTag: "网页访客",
|
|
628
|
-
requestGuest: "对方是用浏览器申请的,没有装 Ta
|
|
804
|
+
requestGuest: "对方是用浏览器申请的,没有装 Ta:进来后只能聊天。",
|
|
629
805
|
accept: "同意",
|
|
630
806
|
refuse: "拒绝",
|
|
631
807
|
requestBody: "「{name}」想加入你的房间「{title}」。",
|
|
632
808
|
requestsBody: "有 {n} 人申请加入你的房间。",
|
|
633
|
-
requestFriend: "
|
|
634
|
-
requestNew: "
|
|
809
|
+
requestFriend: "对方是你的好友。",
|
|
810
|
+
requestNew: "对方不是你的好友:只让认识的人进来。",
|
|
635
811
|
requestWhat: "进来后,对方能看到房间里的消息和共享的内容;在游戏里就是大家的位置和搭的东西。",
|
|
636
812
|
later: "稍后",
|
|
637
813
|
ownRoom: "我建的房间",
|
|
@@ -677,13 +853,34 @@ var ZH = {
|
|
|
677
853
|
closeTitle: "解散「{title}」?",
|
|
678
854
|
closeHint: "所有人都会被移出,中继会删除房间保存的全部内容。",
|
|
679
855
|
forget: "删除",
|
|
680
|
-
friends: "
|
|
681
|
-
|
|
856
|
+
friends: "好友",
|
|
857
|
+
friendsCount: "{n} 位",
|
|
858
|
+
friendsNone: "去添加",
|
|
859
|
+
friendAdding: "等对方同意",
|
|
682
860
|
removeFriend: "删除",
|
|
683
|
-
removeFriendTitle: "
|
|
684
|
-
removeFriendHint: "
|
|
861
|
+
removeFriendTitle: "删除好友「{name}」?",
|
|
862
|
+
removeFriendHint: "两边同时不再是好友:互相看不到动态,也收不到只给好友的分享。一起所在的房间不受影响。",
|
|
863
|
+
addFriend: "加好友",
|
|
864
|
+
addFriendHint: "让对方扫这个码,或把链接发给对方。双方都同意后就是好友:互相看到动态,也能互相分享。",
|
|
865
|
+
addFriendExpires: "还能用 {days} 天",
|
|
866
|
+
addFriendAction: "加为好友",
|
|
867
|
+
addFriendBody: "请「{name}」加你为好友?对方会看到你的名字,在自己的 Ta 里同意。双方同意后互相看到动态,也能互相分享。",
|
|
868
|
+
addFriendOwn: "这是你自己的二维码。",
|
|
869
|
+
addFriendKnown: "「{name}」已经是你的好友。",
|
|
870
|
+
addFriendAsked: "已向「{name}」发出申请,对方同意后就是好友",
|
|
871
|
+
friendOffer: "加好友",
|
|
872
|
+
friendOffered: "已请「{name}」加你为好友",
|
|
873
|
+
friendRequestsTitle: "新的好友",
|
|
874
|
+
friendRequestLink: "想加你为好友",
|
|
875
|
+
friendRequestRoom: "在「{room}」里想加你为好友",
|
|
876
|
+
friendAccept: "同意",
|
|
877
|
+
friendRequestNote: "成为好友后互相看到动态,对方也能给你分享东西。只同意认识的人。",
|
|
878
|
+
friendsEmpty: "还没有好友",
|
|
879
|
+
friendsEmptyHint: "用二维码或链接加好友,也可以在一起所在房间的成员里加。",
|
|
880
|
+
scanFriend: "扫一扫",
|
|
881
|
+
pasteFriend: "粘贴链接",
|
|
685
882
|
emptyTitle: "还没有房间",
|
|
686
|
-
|
|
883
|
+
emptyListHint: "点 + 新建一个,或打开别人发来的邀请链接",
|
|
687
884
|
pickRoom: "选一个房间开始聊天",
|
|
688
885
|
joinTitle: "加入「{title}」?",
|
|
689
886
|
joinBody: "这是{by}的房间。房主同意后你才能进去,你的名字「{name}」会发给对方。",
|
|
@@ -732,8 +929,9 @@ function bind(react) {
|
|
|
732
929
|
// web-src/page.tsx
|
|
733
930
|
var ROOMS_KIND = "ta-rooms";
|
|
734
931
|
var ROOMS_VIEW = "@celljs/ta-rooms/rooms";
|
|
932
|
+
var FRIENDS_VIEW = "@celljs/ta-rooms/friends";
|
|
735
933
|
var MEMBERS_VIEW = "@celljs/ta-rooms/members";
|
|
736
|
-
var CHAT_STATE = ["chat:", ROOM_AGENTS_KEY];
|
|
934
|
+
var CHAT_STATE = ["chat:", ROOM_AGENTS_KEY, ROOM_TASKS_KEY];
|
|
737
935
|
var SEEN_KEY = "seen";
|
|
738
936
|
var pi;
|
|
739
937
|
function bindPage(api) {
|
|
@@ -753,11 +951,13 @@ function rooms() {
|
|
|
753
951
|
}
|
|
754
952
|
|
|
755
953
|
class RoomBook {
|
|
756
|
-
state = { requests: [], seen: {} };
|
|
954
|
+
state = { requests: [], friendRequests: [], seen: {} };
|
|
757
955
|
listeners = new Set;
|
|
758
956
|
chats = new Map;
|
|
759
957
|
agentStates = new Map;
|
|
760
958
|
agentLists = new Map;
|
|
959
|
+
taskStates = new Map;
|
|
960
|
+
taskLists = new Map;
|
|
761
961
|
joiningLists = new Map;
|
|
762
962
|
timer;
|
|
763
963
|
loading;
|
|
@@ -778,16 +978,23 @@ class RoomBook {
|
|
|
778
978
|
}
|
|
779
979
|
const server = rooms();
|
|
780
980
|
if (!server) {
|
|
781
|
-
this.set({ rooms: [], friends: [] });
|
|
981
|
+
this.set({ rooms: [], friends: [], friendRequests: [] });
|
|
782
982
|
return Promise.resolve();
|
|
783
983
|
}
|
|
784
984
|
this.readSeen();
|
|
785
985
|
this.loading = Promise.all([
|
|
786
986
|
server.getIdentity().catch(() => this.state.identity),
|
|
787
|
-
server.listRooms().catch(() =>
|
|
987
|
+
server.listRooms().catch(() => {
|
|
988
|
+
return;
|
|
989
|
+
}),
|
|
788
990
|
server.listRequests().catch(() => this.state.requests),
|
|
789
|
-
server.listFriends().catch(() => this.state.friends ?? [])
|
|
790
|
-
|
|
991
|
+
server.listFriends().catch(() => this.state.friends ?? []),
|
|
992
|
+
server.listFriendRequests ? server.listFriendRequests().catch(() => this.state.friendRequests) : Promise.resolve([])
|
|
993
|
+
]).then(([identity, all, requests, friends, friendRequests]) => {
|
|
994
|
+
const unlisted = new Set((all ?? []).filter((room) => room.unlisted).map((room) => room.id));
|
|
995
|
+
const list = all ? all.filter((room) => !unlisted.has(room.id)) : this.state.rooms ?? [];
|
|
996
|
+
this.read({ ...this.state, identity, rooms: list, requests: requests.filter((request) => !unlisted.has(request.room)), friends, friendRequests });
|
|
997
|
+
}).finally(() => {
|
|
791
998
|
this.loading = undefined;
|
|
792
999
|
if (this.again) {
|
|
793
1000
|
this.again = false;
|
|
@@ -808,6 +1015,9 @@ class RoomBook {
|
|
|
808
1015
|
for (const room of this.agentStates.keys()) {
|
|
809
1016
|
this.readAgents(room);
|
|
810
1017
|
}
|
|
1018
|
+
for (const room of this.taskStates.keys()) {
|
|
1019
|
+
this.readTasks(room);
|
|
1020
|
+
}
|
|
811
1021
|
}, 300);
|
|
812
1022
|
}
|
|
813
1023
|
set(partial) {
|
|
@@ -838,6 +1048,13 @@ class RoomBook {
|
|
|
838
1048
|
}
|
|
839
1049
|
return this.agentLists.get(room) ?? NO_AGENTS;
|
|
840
1050
|
}
|
|
1051
|
+
tasks(room) {
|
|
1052
|
+
if (!this.taskStates.has(room)) {
|
|
1053
|
+
this.taskStates.set(room, {});
|
|
1054
|
+
this.readTasks(room);
|
|
1055
|
+
}
|
|
1056
|
+
return this.taskLists.get(room) ?? NO_TASKS;
|
|
1057
|
+
}
|
|
841
1058
|
joining(room) {
|
|
842
1059
|
return this.joiningLists.get(room) ?? NO_JOINING;
|
|
843
1060
|
}
|
|
@@ -863,6 +1080,27 @@ class RoomBook {
|
|
|
863
1080
|
if (known && event.key.startsWith(ROOM_AGENTS_KEY) && (known[event.key]?.version ?? 0) < event.version) {
|
|
864
1081
|
this.putAgents(event.room, { ...known, [event.key]: event });
|
|
865
1082
|
}
|
|
1083
|
+
const tasks = this.taskStates.get(event.room);
|
|
1084
|
+
if (tasks && event.key.startsWith(ROOM_TASKS_KEY) && (tasks[event.key]?.version ?? 0) < event.version) {
|
|
1085
|
+
this.putTasks(event.room, { ...tasks, [event.key]: event });
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
readTasks(room) {
|
|
1089
|
+
rooms()?.getState(room, ROOM_TASKS_KEY).then((state) => this.putTasks(room, state)).catch(() => {
|
|
1090
|
+
return;
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
putTasks(room, state) {
|
|
1094
|
+
this.taskStates.set(room, state);
|
|
1095
|
+
const lines = {};
|
|
1096
|
+
for (const [key, value] of Object.entries(state)) {
|
|
1097
|
+
const member = key.slice(ROOM_TASKS_KEY.length);
|
|
1098
|
+
for (const [id, task] of Object.entries(RoomTasksUtil.of(member, value.value, value.by))) {
|
|
1099
|
+
lines[id] = [...lines[id] ?? [], { ...task, member }];
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
this.taskLists.set(room, lines);
|
|
1103
|
+
this.set({});
|
|
866
1104
|
}
|
|
867
1105
|
readAgents(room) {
|
|
868
1106
|
rooms()?.getState(room, ROOM_AGENTS_KEY).then((state) => this.putAgents(room, state)).catch(() => {
|
|
@@ -878,24 +1116,33 @@ class RoomBook {
|
|
|
878
1116
|
if ((this.state.seen[room] ?? 0) >= at) {
|
|
879
1117
|
return;
|
|
880
1118
|
}
|
|
881
|
-
|
|
882
|
-
this.
|
|
883
|
-
|
|
1119
|
+
this.set({ seen: { ...this.state.seen, [room]: at } });
|
|
1120
|
+
this.keepSeen();
|
|
1121
|
+
}
|
|
1122
|
+
async keepSeen() {
|
|
1123
|
+
const storage = pi.storage;
|
|
1124
|
+
if (!storage) {
|
|
884
1125
|
return;
|
|
885
|
-
}
|
|
1126
|
+
}
|
|
1127
|
+
try {
|
|
1128
|
+
const kept = RoomSeenUtil.parse(await storage.get(SEEN_KEY));
|
|
1129
|
+
const local = this.state.seen;
|
|
1130
|
+
const seen = RoomSeenUtil.merge(local, kept);
|
|
1131
|
+
if (seen !== local) {
|
|
1132
|
+
this.set({ seen });
|
|
1133
|
+
}
|
|
1134
|
+
if (RoomSeenUtil.merge(kept, local) !== kept) {
|
|
1135
|
+
await storage.set(SEEN_KEY, seen);
|
|
1136
|
+
}
|
|
1137
|
+
} catch {}
|
|
886
1138
|
}
|
|
887
1139
|
readSeen() {
|
|
888
1140
|
if (this.seenRead || !pi.storage) {
|
|
889
1141
|
return;
|
|
890
1142
|
}
|
|
891
1143
|
this.seenRead = true;
|
|
892
|
-
pi.storage.
|
|
893
|
-
|
|
894
|
-
this.set({ seen: { ...seen, ...this.state.seen } });
|
|
895
|
-
}
|
|
896
|
-
}).catch(() => {
|
|
897
|
-
return;
|
|
898
|
-
});
|
|
1144
|
+
pi.storage.onChange((keys) => keys.includes(SEEN_KEY) && void this.keepSeen());
|
|
1145
|
+
this.keepSeen();
|
|
899
1146
|
}
|
|
900
1147
|
read(next) {
|
|
901
1148
|
const before = new Map((this.state.rooms ?? []).map((room) => [room.id, room]));
|
|
@@ -918,6 +1165,7 @@ function useBook() {
|
|
|
918
1165
|
var NO_LINES = [];
|
|
919
1166
|
var NO_AGENTS = [];
|
|
920
1167
|
var NO_JOINING = [];
|
|
1168
|
+
var NO_TASKS = {};
|
|
921
1169
|
var NO_STOP = () => {
|
|
922
1170
|
return;
|
|
923
1171
|
};
|
|
@@ -925,6 +1173,10 @@ function useLines(room) {
|
|
|
925
1173
|
const chat = room.status === "member" ? book.chat(room.id) : undefined;
|
|
926
1174
|
return React.useSyncExternalStore((listener) => chat?.subscribe(listener) ?? NO_STOP, () => chat?.lines ?? NO_LINES);
|
|
927
1175
|
}
|
|
1176
|
+
function useTaskStates(room) {
|
|
1177
|
+
const member = room.status === "member";
|
|
1178
|
+
return React.useSyncExternalStore((listener) => book.subscribe(listener), () => member ? book.tasks(room.id) : NO_TASKS);
|
|
1179
|
+
}
|
|
928
1180
|
function useAgents(room) {
|
|
929
1181
|
const member = room.status === "member";
|
|
930
1182
|
return React.useSyncExternalStore((listener) => book.subscribe(listener), () => member ? book.agents(room.id) : NO_AGENTS);
|
|
@@ -932,6 +1184,18 @@ function useAgents(room) {
|
|
|
932
1184
|
function useJoining(room) {
|
|
933
1185
|
return React.useSyncExternalStore((listener) => book.subscribe(listener), () => book.joining(room.id));
|
|
934
1186
|
}
|
|
1187
|
+
var RoomSeenUtil;
|
|
1188
|
+
((RoomSeenUtil) => {
|
|
1189
|
+
function parse(value) {
|
|
1190
|
+
return value && typeof value === "object" ? Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "number")) : {};
|
|
1191
|
+
}
|
|
1192
|
+
RoomSeenUtil.parse = parse;
|
|
1193
|
+
function merge(a, b) {
|
|
1194
|
+
const later = Object.entries(b).filter(([room, at]) => at > (a[room] ?? 0));
|
|
1195
|
+
return later.length ? { ...a, ...Object.fromEntries(later) } : a;
|
|
1196
|
+
}
|
|
1197
|
+
RoomSeenUtil.merge = merge;
|
|
1198
|
+
})(RoomSeenUtil ||= {});
|
|
935
1199
|
function unseen(room, lines, seen) {
|
|
936
1200
|
const self = room.members.find((member) => member.self)?.member;
|
|
937
1201
|
const since = seen[room.id] ?? room.joinedAt ?? room.createdAt;
|
|
@@ -1073,463 +1337,234 @@ function MemberFaces({ room, onClick, shown }) {
|
|
|
1073
1337
|
}, "+", members.length - 5));
|
|
1074
1338
|
}
|
|
1075
1339
|
|
|
1076
|
-
// web-src/
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1340
|
+
// web-src/double-i18n.ts
|
|
1341
|
+
var EN2 = {
|
|
1342
|
+
doubleOf: "{name}'s double",
|
|
1343
|
+
myDouble: "Your double",
|
|
1344
|
+
doubleTag: "Double",
|
|
1345
|
+
mentionLabel: "Ask a double",
|
|
1346
|
+
mentionDetail: "Ask their double",
|
|
1347
|
+
answersHere: "Your double answers here",
|
|
1348
|
+
answersHint: "When someone asks it with @, your double answers in this room. It only chats and reads the room, unless you let it do more for someone.",
|
|
1349
|
+
permissions: "Let the double work for them",
|
|
1350
|
+
grantTitle: "Let your double work for {name}",
|
|
1351
|
+
grantLead: "When {name} asks your double in a room, it may also do this on your computer:",
|
|
1352
|
+
files: "Read and change files",
|
|
1353
|
+
filesHint: "Only inside the directory below.",
|
|
1354
|
+
commands: "Run commands",
|
|
1355
|
+
commandsHint: "In that directory, though a command can reach beyond it: only for someone you trust.",
|
|
1356
|
+
directory: "Directory",
|
|
1357
|
+
pick: "Choose",
|
|
1358
|
+
duration: "For",
|
|
1359
|
+
hours1: "1 hour",
|
|
1360
|
+
hours24: "1 day",
|
|
1361
|
+
hours168: "7 days",
|
|
1362
|
+
allow: "Allow",
|
|
1363
|
+
cancel: "Cancel",
|
|
1364
|
+
refuse: "Refuse",
|
|
1365
|
+
later: "Later",
|
|
1366
|
+
grantNote: "You can take it back at any time, and all your double does for them is logged.",
|
|
1367
|
+
asksTitle: "Your double asks",
|
|
1368
|
+
askLine: "{name} in “{title}”: {reason}",
|
|
1369
|
+
askLead: "{name} asked your double for something in “{title}”:",
|
|
1370
|
+
review: "Review",
|
|
1371
|
+
askWants: "For it, your double needs to {what} on your computer.",
|
|
1372
|
+
wantsFiles: "read and change files",
|
|
1373
|
+
wantsCommands: "run commands",
|
|
1374
|
+
may: "Your double may {what} · {left} left",
|
|
1375
|
+
mayFiles: "files",
|
|
1376
|
+
mayCommands: "commands",
|
|
1377
|
+
left: "{n} h",
|
|
1378
|
+
leftMinutes: "{n} min",
|
|
1379
|
+
leftDays: "{n} d",
|
|
1380
|
+
revoke: "Take back",
|
|
1381
|
+
revokeAll: "Stop all for {name}",
|
|
1382
|
+
revokeAllTitle: "Stop all your double does for {name}?",
|
|
1383
|
+
revokeAllHint: "The permissions and the asks of {name} go, and what your double does for them now stops.",
|
|
1384
|
+
stop: "Stop",
|
|
1385
|
+
logTitle: "What your double did",
|
|
1386
|
+
logEmpty: "Nothing yet",
|
|
1387
|
+
logEmptyHint: "What your double does for others in rooms is listed here",
|
|
1388
|
+
asked: "{name} asked",
|
|
1389
|
+
answered: "Answered",
|
|
1390
|
+
failed: "Failed",
|
|
1391
|
+
limited: "Skipped: too many this hour",
|
|
1392
|
+
tools: "{n} tool calls",
|
|
1393
|
+
clearLog: "Clear",
|
|
1394
|
+
grants: "Permissions",
|
|
1395
|
+
noGrants: "Your double only chats for others",
|
|
1396
|
+
log: "What your double did",
|
|
1397
|
+
noPermission: "Not yet set",
|
|
1398
|
+
oldServer: "Update Ta on the computer to use doubles in rooms.",
|
|
1399
|
+
agentTag: "Agent",
|
|
1400
|
+
myAgent: "Your agent",
|
|
1401
|
+
agentOf: "{name}'s agent",
|
|
1402
|
+
agentsTitle: "Agents",
|
|
1403
|
+
inviteAgent: "Invite an agent",
|
|
1404
|
+
inviteAgentLine: "One of your agents helps in the room",
|
|
1405
|
+
pickAgentTitle: "Invite an agent to “{title}”",
|
|
1406
|
+
pickAgentLead: "Anyone in the room asks it with @. When you ask, it works for you as usual, with its tools in its directory; when others ask, it only chats, as your double, unless you let it do more for them.",
|
|
1407
|
+
noAgents: "No agents yet",
|
|
1408
|
+
noAgentsHint: "Make one in the side bar of your double first.",
|
|
1409
|
+
inRoom: "In the room",
|
|
1410
|
+
joining: "Joining…",
|
|
1411
|
+
joiningRoom: "{name} is joining the room…",
|
|
1412
|
+
inviteFailed: "Could not invite {name}: {error}",
|
|
1413
|
+
dismiss: "Ask to leave",
|
|
1414
|
+
dismissTitle: "Ask {name} to leave “{title}”?",
|
|
1415
|
+
dismissHint: "It says goodbye in the room and answers nothing there any more.",
|
|
1416
|
+
tryAlone: "Invite one of your agents: you can try the room on your own.",
|
|
1417
|
+
agentAsked: "{name} asked {agent}",
|
|
1418
|
+
taskTag: "Task",
|
|
1419
|
+
taskSent: "Handed",
|
|
1420
|
+
taskQueued: "Queued",
|
|
1421
|
+
taskRunning: "Working on it",
|
|
1422
|
+
taskPermission: "Waiting for a permission",
|
|
1423
|
+
taskDone: "Done",
|
|
1424
|
+
taskFailed: "Not done",
|
|
1425
|
+
taskStopped: "Stopped",
|
|
1426
|
+
taskDeclined: "Not taken",
|
|
1427
|
+
taskFor: "For {name}: {text}",
|
|
1428
|
+
taskTo: "{name}'s double: {text}",
|
|
1429
|
+
taskNeedsYou: "Your double asks you to allow it",
|
|
1430
|
+
taskWaitsFor: "Waiting for {name} to allow it",
|
|
1431
|
+
stopTask: "Stop the task",
|
|
1432
|
+
cancelTask: "Call it off",
|
|
1433
|
+
openTaskRoom: "Open the room",
|
|
1434
|
+
forgetTask: "Delete",
|
|
1435
|
+
forgetTaskHint: "Only the entry goes: what was said in the room stays.",
|
|
1436
|
+
taskResult: "A task for {name}'s double",
|
|
1437
|
+
taskLog: "{name} handed a task"
|
|
1438
|
+
};
|
|
1439
|
+
var ZH2 = {
|
|
1440
|
+
doubleOf: "{name}的分身",
|
|
1441
|
+
myDouble: "我的分身",
|
|
1442
|
+
doubleTag: "分身",
|
|
1443
|
+
mentionLabel: "问分身",
|
|
1444
|
+
mentionDetail: "问 TA 的分身",
|
|
1445
|
+
answersHere: "我的分身在这里回答",
|
|
1446
|
+
answersHint: "有人 @ 你的分身时,它会在这个房间里回答。默认只能聊天和读房间里的内容,你允许后才能替某人做更多事。",
|
|
1447
|
+
permissions: "授权分身替 TA 做事",
|
|
1448
|
+
grantTitle: "让分身替{name}做事",
|
|
1449
|
+
grantLead: "{name}在房间里问你的分身时,它还可以在你的电脑上:",
|
|
1450
|
+
files: "读写文件",
|
|
1451
|
+
filesHint: "只限下面这个目录。",
|
|
1452
|
+
commands: "运行命令",
|
|
1453
|
+
commandsHint: "在这个目录里运行,但命令本身能碰到目录之外:只给信任的人。",
|
|
1454
|
+
directory: "目录",
|
|
1455
|
+
pick: "选择",
|
|
1456
|
+
duration: "有效期",
|
|
1457
|
+
hours1: "1 小时",
|
|
1458
|
+
hours24: "1 天",
|
|
1459
|
+
hours168: "7 天",
|
|
1460
|
+
allow: "允许",
|
|
1461
|
+
cancel: "取消",
|
|
1462
|
+
refuse: "拒绝",
|
|
1463
|
+
later: "稍后",
|
|
1464
|
+
grantNote: "可以随时收回;分身替对方做的每件事都有记录。",
|
|
1465
|
+
asksTitle: "分身请你授权",
|
|
1466
|
+
askLine: "{name}在「{title}」里:{reason}",
|
|
1467
|
+
askLead: "{name}在「{title}」里请你的分身帮忙:",
|
|
1468
|
+
review: "处理",
|
|
1469
|
+
askWants: "分身需要在你的电脑上{what}。",
|
|
1470
|
+
wantsFiles: "读写文件",
|
|
1471
|
+
wantsCommands: "运行命令",
|
|
1472
|
+
may: "分身可以{what} · 还剩 {left}",
|
|
1473
|
+
mayFiles: "读写文件",
|
|
1474
|
+
mayCommands: "运行命令",
|
|
1475
|
+
left: "{n} 小时",
|
|
1476
|
+
leftMinutes: "{n} 分钟",
|
|
1477
|
+
leftDays: "{n} 天",
|
|
1478
|
+
revoke: "收回",
|
|
1479
|
+
revokeAll: "停掉{name}的全部授权",
|
|
1480
|
+
revokeAllTitle: "停掉分身为{name}做的一切?",
|
|
1481
|
+
revokeAllHint: "{name}的授权和待处理的请求都会删除,分身正在替 TA 做的事也会停下。",
|
|
1482
|
+
stop: "停掉",
|
|
1483
|
+
logTitle: "分身记录",
|
|
1484
|
+
logEmpty: "还没有记录",
|
|
1485
|
+
logEmptyHint: "分身在房间里替别人做的事会列在这里",
|
|
1486
|
+
asked: "{name}问",
|
|
1487
|
+
answered: "已回答",
|
|
1488
|
+
failed: "失败",
|
|
1489
|
+
limited: "跳过:这一小时回答太多",
|
|
1490
|
+
tools: "用了 {n} 次工具",
|
|
1491
|
+
clearLog: "清空",
|
|
1492
|
+
grants: "授权",
|
|
1493
|
+
noGrants: "分身只替别人聊天",
|
|
1494
|
+
log: "分身记录",
|
|
1495
|
+
noPermission: "还没有授权",
|
|
1496
|
+
oldServer: "请先更新电脑上的 Ta,再在房间里使用分身。",
|
|
1497
|
+
agentTag: "智能体",
|
|
1498
|
+
myAgent: "我的智能体",
|
|
1499
|
+
agentOf: "{name}的智能体",
|
|
1500
|
+
agentsTitle: "智能体",
|
|
1501
|
+
inviteAgent: "邀请智能体",
|
|
1502
|
+
inviteAgentLine: "让你的智能体在房间里帮忙",
|
|
1503
|
+
pickAgentTitle: "邀请智能体进「{title}」",
|
|
1504
|
+
pickAgentLead: "房间里的人 @ 它就能找它帮忙。你自己问它时,它像平常一样在自己的目录里用工具做事;别人问它时,和分身一样只能聊天,除非你授权。",
|
|
1505
|
+
noAgents: "还没有智能体",
|
|
1506
|
+
noAgentsHint: "先在分身侧栏新建一个智能体。",
|
|
1507
|
+
inRoom: "已在房间里",
|
|
1508
|
+
joining: "正在加入…",
|
|
1509
|
+
joiningRoom: "{name}正在加入房间…",
|
|
1510
|
+
inviteFailed: "没能邀请{name}:{error}",
|
|
1511
|
+
dismiss: "请出房间",
|
|
1512
|
+
dismissTitle: "让{name}离开「{title}」?",
|
|
1513
|
+
dismissHint: "它会在房间里道别,之后不再回答这里的问题。",
|
|
1514
|
+
tryAlone: "邀请一个你的智能体进来,一个人也能试试房间。",
|
|
1515
|
+
agentAsked: "{name}问{agent}",
|
|
1516
|
+
taskTag: "任务",
|
|
1517
|
+
taskSent: "已交出",
|
|
1518
|
+
taskQueued: "排队中",
|
|
1519
|
+
taskRunning: "进行中",
|
|
1520
|
+
taskPermission: "等待授权",
|
|
1521
|
+
taskDone: "已完成",
|
|
1522
|
+
taskFailed: "没能完成",
|
|
1523
|
+
taskStopped: "已停止",
|
|
1524
|
+
taskDeclined: "没有接受",
|
|
1525
|
+
taskFor: "替{name}:{text}",
|
|
1526
|
+
taskTo: "交给{name}的分身:{text}",
|
|
1527
|
+
taskNeedsYou: "分身在等你授权",
|
|
1528
|
+
taskWaitsFor: "等{name}授权",
|
|
1529
|
+
stopTask: "停止任务",
|
|
1530
|
+
cancelTask: "取消任务",
|
|
1531
|
+
openTaskRoom: "打开房间",
|
|
1532
|
+
forgetTask: "删除",
|
|
1533
|
+
forgetTaskHint: "只删除这条记录,房间里说过的话还在。",
|
|
1534
|
+
taskResult: "交给{name}的分身的任务",
|
|
1535
|
+
taskLog: "{name}交来任务"
|
|
1536
|
+
};
|
|
1537
|
+
var DoubleWordsUtil;
|
|
1538
|
+
((DoubleWordsUtil) => {
|
|
1539
|
+
function of(language) {
|
|
1540
|
+
return language === "zh-CN" ? ZH2 : EN2;
|
|
1081
1541
|
}
|
|
1082
|
-
|
|
1542
|
+
DoubleWordsUtil.of = of;
|
|
1543
|
+
})(DoubleWordsUtil ||= {});
|
|
1544
|
+
function dt(key, values = {}) {
|
|
1545
|
+
return DoubleWordsUtil.of(pi.ui.language)[key].replace(/\{(\w+)\}/g, (whole, name) => (name in values) ? String(values[name]) : whole);
|
|
1083
1546
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
}, request.guest ? t("guestTag") : request.friend ? t("friendTag") : t("newTag"))), /* @__PURE__ */ React.createElement("span", {
|
|
1106
|
-
className: "trm-row-line"
|
|
1107
|
-
}, t("requestLine", { title: request.title }))), /* @__PURE__ */ React.createElement("div", {
|
|
1108
|
-
className: "trm-answers"
|
|
1109
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
1110
|
-
type: "button",
|
|
1111
|
-
className: "ta-button",
|
|
1112
|
-
disabled: busy,
|
|
1113
|
-
onClick: () => answer(false)
|
|
1114
|
-
}, t("refuse")), /* @__PURE__ */ React.createElement("button", {
|
|
1115
|
-
type: "button",
|
|
1116
|
-
className: "ta-button ta-primary",
|
|
1117
|
-
disabled: busy,
|
|
1118
|
-
onClick: () => answer(true)
|
|
1119
|
-
}, t("accept"))));
|
|
1120
|
-
}
|
|
1121
|
-
function RequestsDialog({ close }) {
|
|
1122
|
-
const { requests } = useBook();
|
|
1123
|
-
const seen = React.useRef(false);
|
|
1124
|
-
React.useEffect(() => {
|
|
1125
|
-
if (requests.length) {
|
|
1126
|
-
seen.current = true;
|
|
1127
|
-
} else if (seen.current) {
|
|
1128
|
-
close();
|
|
1129
|
-
}
|
|
1130
|
-
}, [requests.length, close]);
|
|
1131
|
-
const first = requests[0];
|
|
1132
|
-
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1133
|
-
title: t("requests"),
|
|
1134
|
-
onClose: close
|
|
1135
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
1136
|
-
className: "trm-dialog"
|
|
1137
|
-
}, first && /* @__PURE__ */ React.createElement("p", {
|
|
1138
|
-
className: "trm-lead"
|
|
1139
|
-
}, requests.length === 1 ? t("requestBody", { name: first.name, title: first.title }) : t("requestsBody", { n: requests.length })), /* @__PURE__ */ React.createElement("ul", {
|
|
1140
|
-
className: "trm-rows"
|
|
1141
|
-
}, requests.map((request) => /* @__PURE__ */ React.createElement(RequestRow, {
|
|
1142
|
-
key: `${request.room}:${request.ask}`,
|
|
1143
|
-
request
|
|
1144
|
-
}))), /* @__PURE__ */ React.createElement("p", {
|
|
1145
|
-
className: "trm-note"
|
|
1146
|
-
}, [
|
|
1147
|
-
requests.some((request) => !request.friend) ? t("requestNew") : requests.length ? t("requestFriend") : "",
|
|
1148
|
-
requests.some((request) => request.guest) ? t("requestGuest") : "",
|
|
1149
|
-
t("requestWhat")
|
|
1150
|
-
].filter(Boolean).join(pi.ui.language === "zh-CN" ? "" : " ")), /* @__PURE__ */ React.createElement("div", {
|
|
1151
|
-
className: "trm-actions"
|
|
1152
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
1153
|
-
type: "button",
|
|
1154
|
-
className: "ta-button",
|
|
1155
|
-
onClick: close
|
|
1156
|
-
}, t("later")))));
|
|
1157
|
-
}
|
|
1158
|
-
var requestsOpen;
|
|
1159
|
-
function openRequests() {
|
|
1160
|
-
if (requestsOpen) {
|
|
1161
|
-
return;
|
|
1162
|
-
}
|
|
1163
|
-
const close = show(({ close: close2 }) => /* @__PURE__ */ React.createElement(RequestsDialog, {
|
|
1164
|
-
close: () => {
|
|
1165
|
-
requestsOpen = undefined;
|
|
1166
|
-
close2();
|
|
1167
|
-
}
|
|
1168
|
-
}));
|
|
1169
|
-
requestsOpen = close;
|
|
1170
|
-
}
|
|
1171
|
-
function JoinDialog({ link, text, close }) {
|
|
1172
|
-
const { identity } = useBook();
|
|
1173
|
-
const [busy, setBusy] = React.useState(false);
|
|
1174
|
-
const [error, setError] = React.useState();
|
|
1175
|
-
const join = async () => {
|
|
1176
|
-
setBusy(true);
|
|
1177
|
-
setError(undefined);
|
|
1178
|
-
try {
|
|
1179
|
-
const room = await rooms()?.join(text);
|
|
1180
|
-
await book.load();
|
|
1181
|
-
close();
|
|
1182
|
-
if (room?.status === "member") {
|
|
1183
|
-
if (room.view) {
|
|
1184
|
-
pi.ui.showView(room.view);
|
|
1185
|
-
} else {
|
|
1186
|
-
openRoom(room.id);
|
|
1187
|
-
}
|
|
1188
|
-
} else {
|
|
1189
|
-
pi.ui.notify(t("asked", { by: link.by || "…" }));
|
|
1190
|
-
}
|
|
1191
|
-
} catch (failure) {
|
|
1192
|
-
setError(message(failure));
|
|
1193
|
-
setBusy(false);
|
|
1194
|
-
}
|
|
1195
|
-
};
|
|
1196
|
-
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1197
|
-
title: t("joinTitle", { title: link.title || t("room") }),
|
|
1198
|
-
onClose: close
|
|
1199
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
1200
|
-
className: "trm-dialog"
|
|
1201
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
1202
|
-
className: "trm-join"
|
|
1203
|
-
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1204
|
-
id: link.owner,
|
|
1205
|
-
name: link.by || "?",
|
|
1206
|
-
size: 44
|
|
1207
|
-
}), /* @__PURE__ */ React.createElement("p", {
|
|
1208
|
-
className: "trm-lead"
|
|
1209
|
-
}, t("joinBody", { by: link.by || "…", name: identity?.name ?? "…" }))), error && /* @__PURE__ */ React.createElement("p", {
|
|
1210
|
-
className: "trm-error"
|
|
1211
|
-
}, error), /* @__PURE__ */ React.createElement("div", {
|
|
1212
|
-
className: "trm-actions"
|
|
1213
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
1214
|
-
type: "button",
|
|
1215
|
-
className: "ta-button",
|
|
1216
|
-
onClick: close
|
|
1217
|
-
}, t("later")), /* @__PURE__ */ React.createElement("button", {
|
|
1218
|
-
type: "button",
|
|
1219
|
-
className: `ta-button ta-primary${busy ? " ta-busy" : ""}`,
|
|
1220
|
-
disabled: busy,
|
|
1221
|
-
onClick: () => void join()
|
|
1222
|
-
}, t("joinAction")))));
|
|
1223
|
-
}
|
|
1224
|
-
function InviteDialog({ room, close }) {
|
|
1225
|
-
const [link, setLink] = React.useState();
|
|
1226
|
-
const [error, setError] = React.useState();
|
|
1227
|
-
const [copied, setCopied] = React.useState(false);
|
|
1228
|
-
const make = React.useCallback((renew) => {
|
|
1229
|
-
setError(undefined);
|
|
1230
|
-
setCopied(false);
|
|
1231
|
-
rooms()?.invite(room.id, renew ? { renew } : undefined).then((made) => setLink(made.link)).catch((failure) => setError(message(failure)));
|
|
1232
|
-
}, [room.id]);
|
|
1233
|
-
React.useEffect(() => make(false), [make]);
|
|
1234
|
-
const canSend = typeof navigator !== "undefined" && typeof navigator.share === "function";
|
|
1235
|
-
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1236
|
-
title: t("inviteTitle", { title: room.title }),
|
|
1237
|
-
onClose: close
|
|
1238
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
1239
|
-
className: "trm-dialog trm-invite"
|
|
1240
|
-
}, link ? /* @__PURE__ */ React.createElement(React.Fragment, null, pi.ui.QrCode && /* @__PURE__ */ React.createElement("div", {
|
|
1241
|
-
className: "trm-qr"
|
|
1242
|
-
}, /* @__PURE__ */ React.createElement(pi.ui.QrCode, {
|
|
1243
|
-
text: link,
|
|
1244
|
-
label: t("qr")
|
|
1245
|
-
})), /* @__PURE__ */ React.createElement("p", {
|
|
1246
|
-
className: "trm-hint"
|
|
1247
|
-
}, t("inviteHint")), /* @__PURE__ */ React.createElement("div", {
|
|
1248
|
-
className: "trm-link-box"
|
|
1249
|
-
}, link), /* @__PURE__ */ React.createElement("div", {
|
|
1250
|
-
className: "trm-actions trm-center"
|
|
1251
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
1252
|
-
type: "button",
|
|
1253
|
-
className: "ta-button ta-primary",
|
|
1254
|
-
onClick: () => void navigator.clipboard?.writeText(link).then(() => setCopied(true))
|
|
1255
|
-
}, copied ? t("copied") : t("copy")), canSend && /* @__PURE__ */ React.createElement("button", {
|
|
1256
|
-
type: "button",
|
|
1257
|
-
className: "ta-button",
|
|
1258
|
-
onClick: () => void navigator.share({ title: room.title, url: link }).catch(() => {
|
|
1259
|
-
return;
|
|
1260
|
-
})
|
|
1261
|
-
}, t("send")), /* @__PURE__ */ React.createElement("button", {
|
|
1262
|
-
type: "button",
|
|
1263
|
-
className: "ta-button",
|
|
1264
|
-
onClick: () => make(true)
|
|
1265
|
-
}, t("newLink")))) : error ? /* @__PURE__ */ React.createElement("p", {
|
|
1266
|
-
className: "trm-error"
|
|
1267
|
-
}, error) : /* @__PURE__ */ React.createElement("p", {
|
|
1268
|
-
className: "trm-hint"
|
|
1269
|
-
}, t("making"))));
|
|
1270
|
-
}
|
|
1271
|
-
function openInvite(room) {
|
|
1272
|
-
show(({ close }) => /* @__PURE__ */ React.createElement(InviteDialog, {
|
|
1273
|
-
room,
|
|
1274
|
-
close
|
|
1275
|
-
}));
|
|
1276
|
-
}
|
|
1277
|
-
function openJoin(text) {
|
|
1278
|
-
const link = RelayHubUtil.parse(text);
|
|
1279
|
-
const known = book.get().rooms?.find((room) => room.id === link.room && room.status === "member");
|
|
1280
|
-
if (known) {
|
|
1281
|
-
if (known.view) {
|
|
1282
|
-
pi.ui.showView(known.view);
|
|
1283
|
-
} else {
|
|
1284
|
-
openRoom(known.id);
|
|
1285
|
-
}
|
|
1286
|
-
return;
|
|
1287
|
-
}
|
|
1288
|
-
show(({ close }) => /* @__PURE__ */ React.createElement(JoinDialog, {
|
|
1289
|
-
link,
|
|
1290
|
-
text,
|
|
1291
|
-
close
|
|
1292
|
-
}));
|
|
1293
|
-
}
|
|
1294
|
-
async function createRoom() {
|
|
1295
|
-
const name = book.get().identity?.name;
|
|
1296
|
-
const title = await pi.ui.input(t("newRoom"), t("newRoomPlaceholder"), { value: name ? t("roomOfName", { name }) : "" });
|
|
1297
|
-
if (!title?.trim()) {
|
|
1298
|
-
return;
|
|
1299
|
-
}
|
|
1300
|
-
try {
|
|
1301
|
-
const room = await rooms()?.createRoom({ kind: ROOMS_KIND, title: title.trim() });
|
|
1302
|
-
if (room) {
|
|
1303
|
-
await book.load();
|
|
1304
|
-
openRoom(room.id);
|
|
1305
|
-
openInvite(room);
|
|
1306
|
-
}
|
|
1307
|
-
} catch (error) {
|
|
1308
|
-
pi.ui.notify(message(error), "error");
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
async function pasteLink() {
|
|
1312
|
-
const text = (await pi.ui.input(t("joinByLink"), t("joinByLinkPlaceholder")))?.trim();
|
|
1313
|
-
if (!text) {
|
|
1314
|
-
return;
|
|
1315
|
-
}
|
|
1316
|
-
if (!RelayHubUtil.is(text)) {
|
|
1317
|
-
pi.ui.notify(t("notInvite"), "warning");
|
|
1318
|
-
return;
|
|
1319
|
-
}
|
|
1320
|
-
openJoin(text);
|
|
1321
|
-
}
|
|
1322
|
-
async function scanLink() {
|
|
1323
|
-
const text = (await pi.ui.scanCode?.(t("scanHint")))?.trim();
|
|
1324
|
-
if (!text) {
|
|
1325
|
-
return;
|
|
1326
|
-
}
|
|
1327
|
-
if (!RelayHubUtil.is(text)) {
|
|
1328
|
-
pi.ui.notify(t("notInvite"), "warning");
|
|
1329
|
-
return;
|
|
1330
|
-
}
|
|
1331
|
-
openJoin(text);
|
|
1332
|
-
}
|
|
1333
|
-
async function rename() {
|
|
1334
|
-
const identity = book.get().identity;
|
|
1335
|
-
const name = await pi.ui.input(t("me"), t("renamePlaceholder"), { value: identity?.name ?? "" });
|
|
1336
|
-
if (name?.trim() && name.trim() !== identity?.name) {
|
|
1337
|
-
try {
|
|
1338
|
-
book.set({ identity: await rooms()?.setName(name.trim()) });
|
|
1339
|
-
} catch (error) {
|
|
1340
|
-
pi.ui.notify(message(error), "error");
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
// web-src/double-i18n.ts
|
|
1346
|
-
var EN2 = {
|
|
1347
|
-
doubleOf: "{name}'s double",
|
|
1348
|
-
myDouble: "Your double",
|
|
1349
|
-
doubleTag: "Double",
|
|
1350
|
-
mentionLabel: "Ask a double",
|
|
1351
|
-
mentionDetail: "Ask their double",
|
|
1352
|
-
answersHere: "Your double answers here",
|
|
1353
|
-
answersHint: "When someone asks it with @, your double answers in this room. It only chats and reads the room, unless you let it do more for someone.",
|
|
1354
|
-
permissions: "Let the double work for them",
|
|
1355
|
-
grantTitle: "Let your double work for {name}",
|
|
1356
|
-
grantLead: "When {name} asks your double in a room, it may also do this on your computer:",
|
|
1357
|
-
files: "Read and change files",
|
|
1358
|
-
filesHint: "Only inside the directory below.",
|
|
1359
|
-
commands: "Run commands",
|
|
1360
|
-
commandsHint: "In that directory, though a command can reach beyond it: only for someone you trust.",
|
|
1361
|
-
directory: "Directory",
|
|
1362
|
-
pick: "Choose",
|
|
1363
|
-
duration: "For",
|
|
1364
|
-
hours1: "1 hour",
|
|
1365
|
-
hours24: "1 day",
|
|
1366
|
-
hours168: "7 days",
|
|
1367
|
-
allow: "Allow",
|
|
1368
|
-
cancel: "Cancel",
|
|
1369
|
-
refuse: "Refuse",
|
|
1370
|
-
later: "Later",
|
|
1371
|
-
grantNote: "You can take it back at any time, and all your double does for them is logged.",
|
|
1372
|
-
asksTitle: "Your double asks",
|
|
1373
|
-
askLine: "{name} in “{title}”: {reason}",
|
|
1374
|
-
askLead: "{name} asked your double for something in “{title}”:",
|
|
1375
|
-
review: "Review",
|
|
1376
|
-
askWants: "For it, your double needs to {what} on your computer.",
|
|
1377
|
-
wantsFiles: "read and change files",
|
|
1378
|
-
wantsCommands: "run commands",
|
|
1379
|
-
may: "Your double may {what} · {left} left",
|
|
1380
|
-
mayFiles: "files",
|
|
1381
|
-
mayCommands: "commands",
|
|
1382
|
-
left: "{n} h",
|
|
1383
|
-
leftMinutes: "{n} min",
|
|
1384
|
-
leftDays: "{n} d",
|
|
1385
|
-
revoke: "Take back",
|
|
1386
|
-
revokeAll: "Stop all for {name}",
|
|
1387
|
-
revokeAllTitle: "Stop all your double does for {name}?",
|
|
1388
|
-
revokeAllHint: "The permissions and the asks of {name} go, and what your double does for them now stops.",
|
|
1389
|
-
stop: "Stop",
|
|
1390
|
-
logTitle: "What your double did",
|
|
1391
|
-
logEmpty: "Nothing yet",
|
|
1392
|
-
logEmptyHint: "What your double does for others in rooms is listed here",
|
|
1393
|
-
asked: "{name} asked",
|
|
1394
|
-
answered: "Answered",
|
|
1395
|
-
failed: "Failed",
|
|
1396
|
-
limited: "Skipped: too many this hour",
|
|
1397
|
-
tools: "{n} tool calls",
|
|
1398
|
-
clearLog: "Clear",
|
|
1399
|
-
grants: "Permissions",
|
|
1400
|
-
noGrants: "Your double only chats for others",
|
|
1401
|
-
log: "What your double did",
|
|
1402
|
-
noPermission: "Not yet set",
|
|
1403
|
-
oldServer: "Update Ta on the computer to use doubles in rooms.",
|
|
1404
|
-
agentTag: "Agent",
|
|
1405
|
-
myAgent: "Your agent",
|
|
1406
|
-
agentOf: "{name}'s agent",
|
|
1407
|
-
agentsTitle: "Agents",
|
|
1408
|
-
inviteAgent: "Invite an agent",
|
|
1409
|
-
inviteAgentLine: "One of your agents helps in the room",
|
|
1410
|
-
pickAgentTitle: "Invite an agent to “{title}”",
|
|
1411
|
-
pickAgentLead: "Anyone in the room asks it with @. When you ask, it works for you as usual, with its tools in its directory; when others ask, it only chats, as your double, unless you let it do more for them.",
|
|
1412
|
-
noAgents: "No agents yet",
|
|
1413
|
-
noAgentsHint: "Make one in the side bar of your double first.",
|
|
1414
|
-
inRoom: "In the room",
|
|
1415
|
-
joining: "Joining…",
|
|
1416
|
-
joiningRoom: "{name} is joining the room…",
|
|
1417
|
-
inviteFailed: "Could not invite {name}: {error}",
|
|
1418
|
-
dismiss: "Ask to leave",
|
|
1419
|
-
dismissTitle: "Ask {name} to leave “{title}”?",
|
|
1420
|
-
dismissHint: "It says goodbye in the room and answers nothing there any more.",
|
|
1421
|
-
tryAlone: "Invite one of your agents: you can try the room on your own.",
|
|
1422
|
-
agentAsked: "{name} asked {agent}"
|
|
1423
|
-
};
|
|
1424
|
-
var ZH2 = {
|
|
1425
|
-
doubleOf: "{name}的分身",
|
|
1426
|
-
myDouble: "我的分身",
|
|
1427
|
-
doubleTag: "分身",
|
|
1428
|
-
mentionLabel: "问分身",
|
|
1429
|
-
mentionDetail: "问 TA 的分身",
|
|
1430
|
-
answersHere: "我的分身在这里回答",
|
|
1431
|
-
answersHint: "有人 @ 你的分身时,它会在这个房间里回答。默认只能聊天和读房间里的内容,你允许后才能替某人做更多事。",
|
|
1432
|
-
permissions: "授权分身替 TA 做事",
|
|
1433
|
-
grantTitle: "让分身替{name}做事",
|
|
1434
|
-
grantLead: "{name}在房间里问你的分身时,它还可以在你的电脑上:",
|
|
1435
|
-
files: "读写文件",
|
|
1436
|
-
filesHint: "只限下面这个目录。",
|
|
1437
|
-
commands: "运行命令",
|
|
1438
|
-
commandsHint: "在这个目录里运行,但命令本身能碰到目录之外:只给信任的人。",
|
|
1439
|
-
directory: "目录",
|
|
1440
|
-
pick: "选择",
|
|
1441
|
-
duration: "有效期",
|
|
1442
|
-
hours1: "1 小时",
|
|
1443
|
-
hours24: "1 天",
|
|
1444
|
-
hours168: "7 天",
|
|
1445
|
-
allow: "允许",
|
|
1446
|
-
cancel: "取消",
|
|
1447
|
-
refuse: "拒绝",
|
|
1448
|
-
later: "稍后",
|
|
1449
|
-
grantNote: "可以随时收回;分身替对方做的每件事都有记录。",
|
|
1450
|
-
asksTitle: "分身请你授权",
|
|
1451
|
-
askLine: "{name}在「{title}」里:{reason}",
|
|
1452
|
-
askLead: "{name}在「{title}」里请你的分身帮忙:",
|
|
1453
|
-
review: "处理",
|
|
1454
|
-
askWants: "分身需要在你的电脑上{what}。",
|
|
1455
|
-
wantsFiles: "读写文件",
|
|
1456
|
-
wantsCommands: "运行命令",
|
|
1457
|
-
may: "分身可以{what} · 还剩 {left}",
|
|
1458
|
-
mayFiles: "读写文件",
|
|
1459
|
-
mayCommands: "运行命令",
|
|
1460
|
-
left: "{n} 小时",
|
|
1461
|
-
leftMinutes: "{n} 分钟",
|
|
1462
|
-
leftDays: "{n} 天",
|
|
1463
|
-
revoke: "收回",
|
|
1464
|
-
revokeAll: "停掉{name}的全部授权",
|
|
1465
|
-
revokeAllTitle: "停掉分身为{name}做的一切?",
|
|
1466
|
-
revokeAllHint: "{name}的授权和待处理的请求都会删除,分身正在替 TA 做的事也会停下。",
|
|
1467
|
-
stop: "停掉",
|
|
1468
|
-
logTitle: "分身记录",
|
|
1469
|
-
logEmpty: "还没有记录",
|
|
1470
|
-
logEmptyHint: "分身在房间里替别人做的事会列在这里",
|
|
1471
|
-
asked: "{name}问",
|
|
1472
|
-
answered: "已回答",
|
|
1473
|
-
failed: "失败",
|
|
1474
|
-
limited: "跳过:这一小时回答太多",
|
|
1475
|
-
tools: "用了 {n} 次工具",
|
|
1476
|
-
clearLog: "清空",
|
|
1477
|
-
grants: "授权",
|
|
1478
|
-
noGrants: "分身只替别人聊天",
|
|
1479
|
-
log: "分身记录",
|
|
1480
|
-
noPermission: "还没有授权",
|
|
1481
|
-
oldServer: "请先更新电脑上的 Ta,再在房间里使用分身。",
|
|
1482
|
-
agentTag: "智能体",
|
|
1483
|
-
myAgent: "我的智能体",
|
|
1484
|
-
agentOf: "{name}的智能体",
|
|
1485
|
-
agentsTitle: "智能体",
|
|
1486
|
-
inviteAgent: "邀请智能体",
|
|
1487
|
-
inviteAgentLine: "让你的智能体在房间里帮忙",
|
|
1488
|
-
pickAgentTitle: "邀请智能体进「{title}」",
|
|
1489
|
-
pickAgentLead: "房间里的人 @ 它就能找它帮忙。你自己问它时,它像平常一样在自己的目录里用工具做事;别人问它时,和分身一样只能聊天,除非你授权。",
|
|
1490
|
-
noAgents: "还没有智能体",
|
|
1491
|
-
noAgentsHint: "先在分身侧栏新建一个智能体。",
|
|
1492
|
-
inRoom: "已在房间里",
|
|
1493
|
-
joining: "正在加入…",
|
|
1494
|
-
joiningRoom: "{name}正在加入房间…",
|
|
1495
|
-
inviteFailed: "没能邀请{name}:{error}",
|
|
1496
|
-
dismiss: "请出房间",
|
|
1497
|
-
dismissTitle: "让{name}离开「{title}」?",
|
|
1498
|
-
dismissHint: "它会在房间里道别,之后不再回答这里的问题。",
|
|
1499
|
-
tryAlone: "邀请一个你的智能体进来,一个人也能试试房间。",
|
|
1500
|
-
agentAsked: "{name}问{agent}"
|
|
1501
|
-
};
|
|
1502
|
-
var DoubleWordsUtil;
|
|
1503
|
-
((DoubleWordsUtil) => {
|
|
1504
|
-
function of(language) {
|
|
1505
|
-
return language === "zh-CN" ? ZH2 : EN2;
|
|
1506
|
-
}
|
|
1507
|
-
DoubleWordsUtil.of = of;
|
|
1508
|
-
})(DoubleWordsUtil ||= {});
|
|
1509
|
-
function dt(key, values = {}) {
|
|
1510
|
-
return DoubleWordsUtil.of(pi.ui.language)[key].replace(/\{(\w+)\}/g, (whole, name) => (name in values) ? String(values[name]) : whole);
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
// web-src/doubles-store.ts
|
|
1514
|
-
var KEYS = [DoubleKeys.QUIET, DoubleKeys.GRANTS, DoubleKeys.ASKS, DoubleKeys.LOG];
|
|
1515
|
-
|
|
1516
|
-
class DoublesStore {
|
|
1517
|
-
state = { quiet: {}, grants: [], asks: [], log: [] };
|
|
1518
|
-
listeners = new Set;
|
|
1519
|
-
started = false;
|
|
1520
|
-
onAsk;
|
|
1521
|
-
get() {
|
|
1522
|
-
return this.state;
|
|
1523
|
-
}
|
|
1524
|
-
subscribe(listener) {
|
|
1525
|
-
this.listeners.add(listener);
|
|
1526
|
-
return () => this.listeners.delete(listener);
|
|
1527
|
-
}
|
|
1528
|
-
start() {
|
|
1529
|
-
if (this.started || !pi.storage) {
|
|
1530
|
-
return () => {
|
|
1531
|
-
return;
|
|
1532
|
-
};
|
|
1547
|
+
|
|
1548
|
+
// web-src/doubles-store.ts
|
|
1549
|
+
var KEYS = [DoubleKeys.QUIET, DoubleKeys.GRANTS, DoubleKeys.ASKS, DoubleKeys.LOG, DoubleKeys.TASKS, DoubleKeys.HANDED];
|
|
1550
|
+
|
|
1551
|
+
class DoublesStore {
|
|
1552
|
+
state = { quiet: {}, grants: [], asks: [], log: [], tasks: [], handed: [] };
|
|
1553
|
+
listeners = new Set;
|
|
1554
|
+
started = false;
|
|
1555
|
+
onAsk;
|
|
1556
|
+
get() {
|
|
1557
|
+
return this.state;
|
|
1558
|
+
}
|
|
1559
|
+
subscribe(listener) {
|
|
1560
|
+
this.listeners.add(listener);
|
|
1561
|
+
return () => this.listeners.delete(listener);
|
|
1562
|
+
}
|
|
1563
|
+
start() {
|
|
1564
|
+
if (this.started || !pi.storage) {
|
|
1565
|
+
return () => {
|
|
1566
|
+
return;
|
|
1567
|
+
};
|
|
1533
1568
|
}
|
|
1534
1569
|
this.started = true;
|
|
1535
1570
|
const stop = pi.storage.onChange((keys) => {
|
|
@@ -1559,6 +1594,10 @@ class DoublesStore {
|
|
|
1559
1594
|
next.asks = Array.isArray(value) ? value : [];
|
|
1560
1595
|
} else if (key === DoubleKeys.LOG) {
|
|
1561
1596
|
next.log = Array.isArray(value) ? value : [];
|
|
1597
|
+
} else if (key === DoubleKeys.TASKS) {
|
|
1598
|
+
next.tasks = Array.isArray(value) ? value : [];
|
|
1599
|
+
} else if (key === DoubleKeys.HANDED) {
|
|
1600
|
+
next.handed = Array.isArray(value) ? value : [];
|
|
1562
1601
|
}
|
|
1563
1602
|
});
|
|
1564
1603
|
const known = new Set(this.state.asks.map((ask) => ask.id));
|
|
@@ -1622,6 +1661,162 @@ function mayLine(grants) {
|
|
|
1622
1661
|
return dt("may", { what: what.join(pi.ui.language === "zh-CN" ? "、" : ", "), left: left(Math.min(...grants.map((grant) => grant.expiresAt))) });
|
|
1623
1662
|
}
|
|
1624
1663
|
|
|
1664
|
+
// web-src/agents-view.tsx
|
|
1665
|
+
function agentOwner(room, agent) {
|
|
1666
|
+
const owner = room.members.find((member) => member.member === agent.member);
|
|
1667
|
+
return owner?.self ? dt("myAgent") : dt("agentOf", { name: owner?.name ?? "" });
|
|
1668
|
+
}
|
|
1669
|
+
function agentMentions(room, agents) {
|
|
1670
|
+
return agents.map((agent) => ({ name: agent.name, detail: agentOwner(room, agent) }));
|
|
1671
|
+
}
|
|
1672
|
+
function inviteAgent(room, agent) {
|
|
1673
|
+
const self = room.members.find((member) => member.self)?.member;
|
|
1674
|
+
const joining = { id: agent.id, name: agent.name, ...typeof agent.face === "number" ? { face: agent.face } : {} };
|
|
1675
|
+
const chat = book.chat(room.id);
|
|
1676
|
+
const before = new Set(chat?.lines.map((line) => line.id));
|
|
1677
|
+
book.setJoining(room.id, joining, true);
|
|
1678
|
+
callDoubles({ kind: "invite", room: room.id, agent: agent.id }).then(async (list) => {
|
|
1679
|
+
if (self && Array.isArray(list)) {
|
|
1680
|
+
book.putMine(room.id, self, list);
|
|
1681
|
+
}
|
|
1682
|
+
if (chat) {
|
|
1683
|
+
await saidHello(chat, (line) => !before.has(line.id) && line.agent?.id === agent.id && line.from === self);
|
|
1684
|
+
}
|
|
1685
|
+
}).catch((failure) => pi.ui.notify(dt("inviteFailed", { name: agent.name, error: message(failure) }), "error")).finally(() => book.setJoining(room.id, joining, false));
|
|
1686
|
+
}
|
|
1687
|
+
var HELLO_MS = 1e4;
|
|
1688
|
+
function saidHello(chat, hello) {
|
|
1689
|
+
return new Promise((resolve) => {
|
|
1690
|
+
const check = () => {
|
|
1691
|
+
if (chat.lines.some(hello)) {
|
|
1692
|
+
done();
|
|
1693
|
+
}
|
|
1694
|
+
};
|
|
1695
|
+
const stop = chat.subscribe(check);
|
|
1696
|
+
const timer = setTimeout(() => done(), HELLO_MS);
|
|
1697
|
+
const done = () => {
|
|
1698
|
+
stop();
|
|
1699
|
+
clearTimeout(timer);
|
|
1700
|
+
resolve();
|
|
1701
|
+
};
|
|
1702
|
+
check();
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
function AgentPicker({ room, close }) {
|
|
1706
|
+
const [agents, setAgents] = React.useState();
|
|
1707
|
+
const [error, setError] = React.useState();
|
|
1708
|
+
const inRoom = useAgents(room);
|
|
1709
|
+
const joining = useJoining(room);
|
|
1710
|
+
const self = room.members.find((member) => member.self)?.member;
|
|
1711
|
+
React.useEffect(() => {
|
|
1712
|
+
callDoubles({ kind: "agents" }).then((list) => setAgents(Array.isArray(list) ? list : []), (failure) => setError(message(failure)));
|
|
1713
|
+
}, []);
|
|
1714
|
+
const invite = (agent) => {
|
|
1715
|
+
inviteAgent(room, agent);
|
|
1716
|
+
close();
|
|
1717
|
+
};
|
|
1718
|
+
const Plus = icon("Plus");
|
|
1719
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1720
|
+
title: dt("pickAgentTitle", { title: room.title }),
|
|
1721
|
+
onClose: close
|
|
1722
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1723
|
+
className: "trm-dialog"
|
|
1724
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
1725
|
+
className: "trm-note"
|
|
1726
|
+
}, dt("pickAgentLead")), !agents && !error && pi.ui.Skeleton && /* @__PURE__ */ React.createElement(pi.ui.Skeleton, {
|
|
1727
|
+
rows: 3
|
|
1728
|
+
}), agents?.length === 0 && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
1729
|
+
title: dt("noAgents"),
|
|
1730
|
+
hint: dt("noAgentsHint"),
|
|
1731
|
+
compact: true
|
|
1732
|
+
}), agents && agents.length > 0 && /* @__PURE__ */ React.createElement("ul", {
|
|
1733
|
+
className: "trm-rows trm-agent-pick"
|
|
1734
|
+
}, agents.map((agent) => {
|
|
1735
|
+
const joined = inRoom.some((each) => each.id === agent.id && each.member === self);
|
|
1736
|
+
const coming = joining.some((each) => each.id === agent.id);
|
|
1737
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
1738
|
+
key: agent.id
|
|
1739
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1740
|
+
type: "button",
|
|
1741
|
+
className: "trm-member",
|
|
1742
|
+
disabled: joined || coming,
|
|
1743
|
+
onClick: () => invite(agent)
|
|
1744
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1745
|
+
id: agent.id,
|
|
1746
|
+
name: agent.name,
|
|
1747
|
+
face: agent.face,
|
|
1748
|
+
size: 34
|
|
1749
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
1750
|
+
className: "trm-member-text"
|
|
1751
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1752
|
+
className: "trm-member-name trm-ellipsis"
|
|
1753
|
+
}, agent.name), /* @__PURE__ */ React.createElement("span", {
|
|
1754
|
+
className: "trm-member-detail trm-ellipsis"
|
|
1755
|
+
}, joined ? dt("inRoom") : coming ? dt("joining") : agent.role)), coming ? /* @__PURE__ */ React.createElement("span", {
|
|
1756
|
+
className: "ta-spinner"
|
|
1757
|
+
}) : !joined && /* @__PURE__ */ React.createElement(Plus, {
|
|
1758
|
+
size: 16
|
|
1759
|
+
})));
|
|
1760
|
+
})), error && /* @__PURE__ */ React.createElement("p", {
|
|
1761
|
+
className: "trm-error"
|
|
1762
|
+
}, error)));
|
|
1763
|
+
}
|
|
1764
|
+
function openAgentPicker(room) {
|
|
1765
|
+
show(({ close }) => /* @__PURE__ */ React.createElement(AgentPicker, {
|
|
1766
|
+
room,
|
|
1767
|
+
close
|
|
1768
|
+
}));
|
|
1769
|
+
}
|
|
1770
|
+
function JoiningRow({ agent }) {
|
|
1771
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
1772
|
+
className: "trm-member",
|
|
1773
|
+
"aria-busy": "true"
|
|
1774
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1775
|
+
id: agent.id,
|
|
1776
|
+
name: agent.name,
|
|
1777
|
+
face: agent.face,
|
|
1778
|
+
size: 34
|
|
1779
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
1780
|
+
className: "trm-member-text"
|
|
1781
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1782
|
+
className: "trm-member-name trm-ellipsis"
|
|
1783
|
+
}, agent.name), /* @__PURE__ */ React.createElement("span", {
|
|
1784
|
+
className: "trm-member-detail trm-ellipsis"
|
|
1785
|
+
}, dt("joining"))), /* @__PURE__ */ React.createElement("span", {
|
|
1786
|
+
className: "ta-spinner trm-member-action"
|
|
1787
|
+
}));
|
|
1788
|
+
}
|
|
1789
|
+
function AgentRow({ room, agent }) {
|
|
1790
|
+
const Remove = icon("X");
|
|
1791
|
+
const mine = room.members.find((member) => member.self)?.member === agent.member;
|
|
1792
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
1793
|
+
className: "trm-member"
|
|
1794
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
1795
|
+
id: agent.id,
|
|
1796
|
+
name: agent.name,
|
|
1797
|
+
face: agent.face,
|
|
1798
|
+
size: 34
|
|
1799
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
1800
|
+
className: "trm-member-text"
|
|
1801
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1802
|
+
className: "trm-member-name"
|
|
1803
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1804
|
+
className: "trm-ellipsis"
|
|
1805
|
+
}, agent.name), /* @__PURE__ */ React.createElement("span", {
|
|
1806
|
+
className: "trm-tag trm-tag-agent"
|
|
1807
|
+
}, agentOwner(room, agent))), agent.role && /* @__PURE__ */ React.createElement("span", {
|
|
1808
|
+
className: "trm-member-detail trm-ellipsis"
|
|
1809
|
+
}, agent.role)), mine && /* @__PURE__ */ React.createElement("button", {
|
|
1810
|
+
type: "button",
|
|
1811
|
+
className: "trm-icon trm-danger trm-member-action",
|
|
1812
|
+
title: dt("dismiss"),
|
|
1813
|
+
"aria-label": dt("dismiss"),
|
|
1814
|
+
onClick: () => void confirmThen(dt("dismissTitle", { name: agent.name, title: room.title }), dt("dismissHint"), dt("dismiss"), () => callDoubles({ kind: "dismiss", room: room.id, agent: agent.id })).then(() => book.agents(room.id))
|
|
1815
|
+
}, /* @__PURE__ */ React.createElement(Remove, {
|
|
1816
|
+
size: 15
|
|
1817
|
+
})));
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1625
1820
|
// web-src/doubles-view.tsx
|
|
1626
1821
|
var DOUBLES_VIEW = "@celljs/ta-rooms/doubles";
|
|
1627
1822
|
function useBusy() {
|
|
@@ -1860,7 +2055,7 @@ function LogRow({ entry }) {
|
|
|
1860
2055
|
size: 22
|
|
1861
2056
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
1862
2057
|
className: "trm-log-who trm-ellipsis"
|
|
1863
|
-
}, entry.agent ? dt("agentAsked", { name: entry.name, agent: entry.agent }) : dt("asked", { name: entry.name }), " · ", entry.title), /* @__PURE__ */ React.createElement("span", {
|
|
2058
|
+
}, entry.agent ? dt("agentAsked", { name: entry.name, agent: entry.agent }) : entry.task ? dt("taskLog", { name: entry.name }) : dt("asked", { name: entry.name }), " ", "· ", entry.title), /* @__PURE__ */ React.createElement("span", {
|
|
1864
2059
|
className: "trm-log-time"
|
|
1865
2060
|
}, when(entry.at))), /* @__PURE__ */ React.createElement("div", {
|
|
1866
2061
|
className: "trm-log-asked"
|
|
@@ -1925,18 +2120,232 @@ function DoublesView() {
|
|
|
1925
2120
|
entry
|
|
1926
2121
|
})))));
|
|
1927
2122
|
}
|
|
1928
|
-
function listenAsks() {
|
|
1929
|
-
doubles.onAsk = (asks) => {
|
|
1930
|
-
const latest = asks[asks.length - 1];
|
|
1931
|
-
if (latest) {
|
|
1932
|
-
openAsk(latest);
|
|
1933
|
-
}
|
|
1934
|
-
};
|
|
1935
|
-
const stop = doubles.start();
|
|
1936
|
-
return () => {
|
|
1937
|
-
doubles.onAsk = undefined;
|
|
1938
|
-
stop();
|
|
1939
|
-
};
|
|
2123
|
+
function listenAsks() {
|
|
2124
|
+
doubles.onAsk = (asks) => {
|
|
2125
|
+
const latest = asks[asks.length - 1];
|
|
2126
|
+
if (latest) {
|
|
2127
|
+
openAsk(latest);
|
|
2128
|
+
}
|
|
2129
|
+
};
|
|
2130
|
+
const stop = doubles.start();
|
|
2131
|
+
return () => {
|
|
2132
|
+
doubles.onAsk = undefined;
|
|
2133
|
+
stop();
|
|
2134
|
+
};
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
// web-src/tasks-view.tsx
|
|
2138
|
+
function taskStatusWord(status) {
|
|
2139
|
+
switch (status) {
|
|
2140
|
+
case "sent":
|
|
2141
|
+
return dt("taskSent");
|
|
2142
|
+
case "queued":
|
|
2143
|
+
return dt("taskQueued");
|
|
2144
|
+
case "running":
|
|
2145
|
+
return dt("taskRunning");
|
|
2146
|
+
case "permission":
|
|
2147
|
+
return dt("taskPermission");
|
|
2148
|
+
case "done":
|
|
2149
|
+
return dt("taskDone");
|
|
2150
|
+
case "failed":
|
|
2151
|
+
return dt("taskFailed");
|
|
2152
|
+
case "stopped":
|
|
2153
|
+
return dt("taskStopped");
|
|
2154
|
+
default:
|
|
2155
|
+
return dt("taskDeclined");
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
function oneLine(text) {
|
|
2159
|
+
const lines = text.split(`
|
|
2160
|
+
`).map((line) => line.trim());
|
|
2161
|
+
const first = lines.find((line) => line && !line.startsWith("|") && !line.startsWith("```")) ?? lines.find(Boolean) ?? "";
|
|
2162
|
+
return first.replace(/^#+\s*|^[-*]\s+|\*\*|__|`/g, "").trim();
|
|
2163
|
+
}
|
|
2164
|
+
function listed(status, mine) {
|
|
2165
|
+
if (!RoomTasksUtil.ended(status)) {
|
|
2166
|
+
return mine && status === "permission" ? "waiting" : "running";
|
|
2167
|
+
}
|
|
2168
|
+
return status === "done" ? "done" : status === "stopped" ? "stopped" : "failed";
|
|
2169
|
+
}
|
|
2170
|
+
function act(run) {
|
|
2171
|
+
return () => void run().catch((error) => pi.ui.notify(message(error), "error"));
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
class RoomTaskSource {
|
|
2175
|
+
list = [];
|
|
2176
|
+
shown = new Map;
|
|
2177
|
+
listeners = new Set;
|
|
2178
|
+
stop;
|
|
2179
|
+
tasks() {
|
|
2180
|
+
return this.list;
|
|
2181
|
+
}
|
|
2182
|
+
subscribe(listener) {
|
|
2183
|
+
if (this.listeners.size === 0) {
|
|
2184
|
+
const unsubscribe = doubles.subscribe(() => this.build(doubles.get()));
|
|
2185
|
+
const stopStore = doubles.start();
|
|
2186
|
+
this.stop = () => {
|
|
2187
|
+
unsubscribe();
|
|
2188
|
+
stopStore();
|
|
2189
|
+
};
|
|
2190
|
+
this.build(doubles.get());
|
|
2191
|
+
}
|
|
2192
|
+
this.listeners.add(listener);
|
|
2193
|
+
return () => {
|
|
2194
|
+
this.listeners.delete(listener);
|
|
2195
|
+
if (this.listeners.size === 0) {
|
|
2196
|
+
this.stop?.();
|
|
2197
|
+
this.stop = undefined;
|
|
2198
|
+
}
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2201
|
+
build(state) {
|
|
2202
|
+
const next = [
|
|
2203
|
+
...state.tasks.map((task) => this.reuse(`for:${task.id}`, task, () => this.forTask(task, state))),
|
|
2204
|
+
...state.handed.map((task) => this.reuse(`to:${task.id}`, task, () => this.toTask(task)))
|
|
2205
|
+
];
|
|
2206
|
+
if (next.length === this.list.length && next.every((entry, index) => entry === this.list[index])) {
|
|
2207
|
+
return;
|
|
2208
|
+
}
|
|
2209
|
+
const ids = new Set(next.map((entry) => entry.id));
|
|
2210
|
+
for (const id of [...this.shown.keys()]) {
|
|
2211
|
+
if (!ids.has(id)) {
|
|
2212
|
+
this.shown.delete(id);
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
this.list = next;
|
|
2216
|
+
for (const listener of this.listeners) {
|
|
2217
|
+
listener();
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
reuse(id, task, make) {
|
|
2221
|
+
const signature = `${pi.ui.language}:${JSON.stringify(task)}`;
|
|
2222
|
+
const before = this.shown.get(id);
|
|
2223
|
+
if (before?.signature === signature) {
|
|
2224
|
+
return before.entry;
|
|
2225
|
+
}
|
|
2226
|
+
const entry = make();
|
|
2227
|
+
this.shown.set(id, { signature, entry });
|
|
2228
|
+
return entry;
|
|
2229
|
+
}
|
|
2230
|
+
forTask(task, state) {
|
|
2231
|
+
const open = !RoomTasksUtil.ended(task.status);
|
|
2232
|
+
const remove = async () => {
|
|
2233
|
+
if (open) {
|
|
2234
|
+
await callDoubles({ kind: "stopTask", task: task.id });
|
|
2235
|
+
}
|
|
2236
|
+
await callDoubles({ kind: "forgetTask", task: task.id });
|
|
2237
|
+
};
|
|
2238
|
+
return {
|
|
2239
|
+
id: `for:${task.id}`,
|
|
2240
|
+
title: dt("taskFor", { name: task.name, text: task.text }),
|
|
2241
|
+
status: listed(task.status, true),
|
|
2242
|
+
detail: task.status === "permission" ? dt("taskNeedsYou") : open ? taskStatusWord(task.status) : oneLine(task.answer ?? task.detail ?? taskStatusWord(task.status)),
|
|
2243
|
+
startedAt: task.at,
|
|
2244
|
+
...task.endedAt && !open ? { endedAt: task.endedAt } : {},
|
|
2245
|
+
icon: ({ size }) => /* @__PURE__ */ React.createElement(Face, {
|
|
2246
|
+
id: task.friend,
|
|
2247
|
+
name: task.name,
|
|
2248
|
+
size
|
|
2249
|
+
}),
|
|
2250
|
+
open: () => {
|
|
2251
|
+
const ask = state.asks.find((each) => each.friend === task.friend);
|
|
2252
|
+
if (task.status === "permission" && ask) {
|
|
2253
|
+
openAsk(ask);
|
|
2254
|
+
} else {
|
|
2255
|
+
openRoom(task.room, true);
|
|
2256
|
+
}
|
|
2257
|
+
},
|
|
2258
|
+
menu: () => this.menu(task.room, open ? { label: dt("stopTask"), run: () => callDoubles({ kind: "stopTask", task: task.id }) } : undefined, remove),
|
|
2259
|
+
remove,
|
|
2260
|
+
removeHint: dt("forgetTaskHint")
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
toTask(task) {
|
|
2264
|
+
const open = !RoomTasksUtil.ended(task.status);
|
|
2265
|
+
const remove = async () => {
|
|
2266
|
+
if (open) {
|
|
2267
|
+
await callDoubles({ kind: "stopTask", task: task.id, handed: true });
|
|
2268
|
+
}
|
|
2269
|
+
await callDoubles({ kind: "forgetTask", task: task.id, handed: true });
|
|
2270
|
+
};
|
|
2271
|
+
return {
|
|
2272
|
+
id: `to:${task.id}`,
|
|
2273
|
+
title: dt("taskTo", { name: task.toName, text: task.text }),
|
|
2274
|
+
status: listed(task.status, false),
|
|
2275
|
+
detail: task.status === "permission" ? dt("taskWaitsFor", { name: task.toName }) : open ? taskStatusWord(task.status) : oneLine(task.answer ?? task.detail ?? taskStatusWord(task.status)),
|
|
2276
|
+
startedAt: task.at,
|
|
2277
|
+
...task.endedAt && !open ? { endedAt: task.endedAt } : {},
|
|
2278
|
+
...task.origin ? { origin: task.origin } : {},
|
|
2279
|
+
icon: ({ size }) => /* @__PURE__ */ React.createElement(Face, {
|
|
2280
|
+
id: task.friend,
|
|
2281
|
+
name: task.toName,
|
|
2282
|
+
size
|
|
2283
|
+
}),
|
|
2284
|
+
open: () => openRoom(task.room, true),
|
|
2285
|
+
menu: () => this.menu(task.room, open ? { label: dt("cancelTask"), run: () => callDoubles({ kind: "stopTask", task: task.id, handed: true }) } : undefined, remove),
|
|
2286
|
+
remove,
|
|
2287
|
+
removeHint: dt("forgetTaskHint")
|
|
2288
|
+
};
|
|
2289
|
+
}
|
|
2290
|
+
menu(room, stop, remove) {
|
|
2291
|
+
return [
|
|
2292
|
+
stop ? [{ key: "stop", label: stop.label, icon: icon("Square"), run: act(stop.run) }] : [],
|
|
2293
|
+
[{ key: "room", label: dt("openTaskRoom"), icon: icon("Users"), run: () => openRoom(room, true) }],
|
|
2294
|
+
[
|
|
2295
|
+
{
|
|
2296
|
+
key: "delete",
|
|
2297
|
+
label: dt("forgetTask"),
|
|
2298
|
+
icon: icon("Trash2"),
|
|
2299
|
+
danger: true,
|
|
2300
|
+
run: act(() => pi.ui.removeTasks([{ title: dt("forgetTask"), remove, removeHint: dt("forgetTaskHint") }]))
|
|
2301
|
+
}
|
|
2302
|
+
]
|
|
2303
|
+
];
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
function TaskMessage({ message: shown }) {
|
|
2307
|
+
const task = shown.details;
|
|
2308
|
+
if (!task || typeof task.id !== "string") {
|
|
2309
|
+
return null;
|
|
2310
|
+
}
|
|
2311
|
+
const Open = icon("ChevronRight");
|
|
2312
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2313
|
+
className: `trm-task-card trm-task-${task.status}`
|
|
2314
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2315
|
+
type: "button",
|
|
2316
|
+
className: "trm-task-card-head",
|
|
2317
|
+
onClick: () => openRoom(task.room, true)
|
|
2318
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
2319
|
+
id: task.friend,
|
|
2320
|
+
name: task.toName,
|
|
2321
|
+
size: 22
|
|
2322
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2323
|
+
className: "trm-task-card-title trm-ellipsis"
|
|
2324
|
+
}, dt("taskResult", { name: task.toName })), /* @__PURE__ */ React.createElement("span", {
|
|
2325
|
+
className: "trm-task-chip"
|
|
2326
|
+
}, taskStatusWord(task.status)), /* @__PURE__ */ React.createElement(Open, {
|
|
2327
|
+
size: 14
|
|
2328
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
2329
|
+
className: "trm-task-card-text"
|
|
2330
|
+
}, task.text), task.answer ? /* @__PURE__ */ React.createElement("div", {
|
|
2331
|
+
className: "trm-task-card-answer"
|
|
2332
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
2333
|
+
text: task.answer
|
|
2334
|
+
})) : task.detail && /* @__PURE__ */ React.createElement("div", {
|
|
2335
|
+
className: "trm-task-card-answer trm-quiet"
|
|
2336
|
+
}, task.detail));
|
|
2337
|
+
}
|
|
2338
|
+
function TaskLine({ statuses }) {
|
|
2339
|
+
const status = statuses[0] ?? "sent";
|
|
2340
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2341
|
+
className: `trm-task-line trm-task-${status}`
|
|
2342
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2343
|
+
className: "trm-task-dot"
|
|
2344
|
+
}), taskStatusWord(status));
|
|
2345
|
+
}
|
|
2346
|
+
function registerTasks() {
|
|
2347
|
+
pi.registerTasks?.(new RoomTaskSource);
|
|
2348
|
+
pi.registerMessageRenderer?.(TASK_MESSAGE_TYPE, TaskMessage);
|
|
1940
2349
|
}
|
|
1941
2350
|
|
|
1942
2351
|
// web-src/room-view.tsx
|
|
@@ -2018,6 +2427,7 @@ function RoomView({ room, head, onBack }) {
|
|
|
2018
2427
|
const lines = useLines(room);
|
|
2019
2428
|
const agents = useAgents(room);
|
|
2020
2429
|
const joining = useJoining(room);
|
|
2430
|
+
const tasks = useTaskStates(room);
|
|
2021
2431
|
const list = React.useRef(null);
|
|
2022
2432
|
const stuck = React.useRef(true);
|
|
2023
2433
|
const self = room.members.find((member) => member.self);
|
|
@@ -2075,225 +2485,675 @@ function RoomView({ room, head, onBack }) {
|
|
|
2075
2485
|
stuck.current = element.scrollHeight - element.scrollTop - element.clientHeight < 48;
|
|
2076
2486
|
}
|
|
2077
2487
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2078
|
-
className: "trm-chat-col"
|
|
2079
|
-
}, lines.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
2080
|
-
className: "trm-chat-empty"
|
|
2081
|
-
}, /* @__PURE__ */ React.createElement(RoomFace, {
|
|
2082
|
-
room,
|
|
2083
|
-
size: 56
|
|
2084
|
-
}), /* @__PURE__ */ React.createElement("strong", null, room.title), /* @__PURE__ */ React.createElement("span", null, room.owner ? t("ownRoom") : t("roomOf", { name: room.ownerName })), /* @__PURE__ */ React.createElement("span", {
|
|
2085
|
-
className: "trm-chat-hint"
|
|
2086
|
-
}, t("chatEmpty")), agents.length === 0 && joining.length === 0 && room.members.length < 2 && /* @__PURE__ */ React.createElement("button", {
|
|
2488
|
+
className: "trm-chat-col"
|
|
2489
|
+
}, lines.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
2490
|
+
className: "trm-chat-empty"
|
|
2491
|
+
}, /* @__PURE__ */ React.createElement(RoomFace, {
|
|
2492
|
+
room,
|
|
2493
|
+
size: 56
|
|
2494
|
+
}), /* @__PURE__ */ React.createElement("strong", null, room.title), /* @__PURE__ */ React.createElement("span", null, room.owner ? t("ownRoom") : t("roomOf", { name: room.ownerName })), /* @__PURE__ */ React.createElement("span", {
|
|
2495
|
+
className: "trm-chat-hint"
|
|
2496
|
+
}, t("chatEmpty")), agents.length === 0 && joining.length === 0 && room.members.length < 2 && /* @__PURE__ */ React.createElement("button", {
|
|
2497
|
+
type: "button",
|
|
2498
|
+
className: "ta-button trm-try-alone",
|
|
2499
|
+
onClick: () => openAgentPicker(room)
|
|
2500
|
+
}, dt("inviteAgent"))), lines.map((line, index) => {
|
|
2501
|
+
const before = lines[index - 1];
|
|
2502
|
+
const separator = !before || line.at - before.at > PAUSE_MS;
|
|
2503
|
+
const first = separator || speaker(before) !== speaker(line) || line.at - before.at > RUN_MS;
|
|
2504
|
+
const other = room.members.find((member) => member.member === line.from);
|
|
2505
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
2506
|
+
key: line.id
|
|
2507
|
+
}, separator && /* @__PURE__ */ React.createElement("div", {
|
|
2508
|
+
className: "trm-chat-time"
|
|
2509
|
+
}, time(line.at)), line.from === self?.member && !line.double && !line.agent ? /* @__PURE__ */ React.createElement("div", {
|
|
2510
|
+
className: "ta-message ta-user trm-mine",
|
|
2511
|
+
title: time(line.at)
|
|
2512
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2513
|
+
className: "ta-bubble"
|
|
2514
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
2515
|
+
text: line.text
|
|
2516
|
+
}))) : /* @__PURE__ */ React.createElement("div", {
|
|
2517
|
+
className: `trm-msg${first ? " trm-first" : ""}${line.double ? " trm-double" : ""}${line.agent ? " trm-agent" : ""}`
|
|
2518
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2519
|
+
className: "trm-msg-face"
|
|
2520
|
+
}, first && /* @__PURE__ */ React.createElement(Face, {
|
|
2521
|
+
id: line.agent?.id ?? other?.id ?? line.from,
|
|
2522
|
+
name: nameOf(line),
|
|
2523
|
+
face: line.agent && agents.find((agent) => agent.id === line.agent?.id && agent.member === line.from)?.face,
|
|
2524
|
+
size: 28
|
|
2525
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
2526
|
+
className: "trm-msg-col"
|
|
2527
|
+
}, first && /* @__PURE__ */ React.createElement("div", {
|
|
2528
|
+
className: "trm-msg-name"
|
|
2529
|
+
}, nameOf(line), tagOf(line) && /* @__PURE__ */ React.createElement("span", {
|
|
2530
|
+
className: `trm-tag ${line.agent ? "trm-tag-agent" : "trm-tag-double"}`
|
|
2531
|
+
}, tagOf(line)), line.task && /* @__PURE__ */ React.createElement("span", {
|
|
2532
|
+
className: "trm-tag trm-tag-task"
|
|
2533
|
+
}, dt("taskTag"))), /* @__PURE__ */ React.createElement("div", {
|
|
2534
|
+
className: "trm-msg-bubble",
|
|
2535
|
+
title: time(line.at)
|
|
2536
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
2537
|
+
text: line.text
|
|
2538
|
+
})), line.task && /* @__PURE__ */ React.createElement(TaskLine, {
|
|
2539
|
+
statuses: (tasks[line.id] ?? []).filter((each) => line.to?.includes(each.member)).map((each) => each.status)
|
|
2540
|
+
}))));
|
|
2541
|
+
}), joining.map((agent) => /* @__PURE__ */ React.createElement("div", {
|
|
2542
|
+
key: agent.id,
|
|
2543
|
+
className: "trm-chat-joining",
|
|
2544
|
+
role: "status"
|
|
2545
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2546
|
+
className: "ta-spinner"
|
|
2547
|
+
}), dt("joiningRoom", { name: agent.name }))))), /* @__PURE__ */ React.createElement("div", {
|
|
2548
|
+
className: "trm-chat-bottom"
|
|
2549
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Composer, {
|
|
2550
|
+
placeholder: t("chatPlaceholder"),
|
|
2551
|
+
onSend: say,
|
|
2552
|
+
mentions,
|
|
2553
|
+
mentionLabel: dt("mentionLabel")
|
|
2554
|
+
})));
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
// web-src/friends-view.tsx
|
|
2558
|
+
function isFriendLink(text) {
|
|
2559
|
+
return RelayHubUtil.is(text) && RelayFriendsUtil.isKind(RelayHubUtil.parse(text).kind);
|
|
2560
|
+
}
|
|
2561
|
+
function useRun() {
|
|
2562
|
+
const [busy, setBusy] = React.useState(false);
|
|
2563
|
+
const run = React.useCallback(async (action) => {
|
|
2564
|
+
setBusy(true);
|
|
2565
|
+
try {
|
|
2566
|
+
await action();
|
|
2567
|
+
} catch (error) {
|
|
2568
|
+
pi.ui.notify(message(error), "error");
|
|
2569
|
+
} finally {
|
|
2570
|
+
setBusy(false);
|
|
2571
|
+
}
|
|
2572
|
+
}, []);
|
|
2573
|
+
return [busy, run];
|
|
2574
|
+
}
|
|
2575
|
+
function FriendRequestRow({ request }) {
|
|
2576
|
+
const [busy, run] = useRun();
|
|
2577
|
+
const answer = (accept) => void run(async () => {
|
|
2578
|
+
await rooms()?.answerFriend(request.id, accept);
|
|
2579
|
+
await book.load();
|
|
2580
|
+
});
|
|
2581
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
2582
|
+
className: `trm-row${busy ? " ta-pending" : ""}`
|
|
2583
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
2584
|
+
id: request.id,
|
|
2585
|
+
name: request.name
|
|
2586
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
2587
|
+
className: "trm-row-text"
|
|
2588
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2589
|
+
className: "trm-row-title"
|
|
2590
|
+
}, request.name), /* @__PURE__ */ React.createElement("span", {
|
|
2591
|
+
className: "trm-row-line"
|
|
2592
|
+
}, request.via === "room" && request.room ? t("friendRequestRoom", { room: request.room }) : t("friendRequestLink"))), /* @__PURE__ */ React.createElement("div", {
|
|
2593
|
+
className: "trm-answers"
|
|
2594
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2595
|
+
type: "button",
|
|
2596
|
+
className: "ta-button",
|
|
2597
|
+
disabled: busy,
|
|
2598
|
+
onClick: () => answer(false)
|
|
2599
|
+
}, t("refuse")), /* @__PURE__ */ React.createElement("button", {
|
|
2600
|
+
type: "button",
|
|
2601
|
+
className: "ta-button ta-primary",
|
|
2602
|
+
disabled: busy,
|
|
2603
|
+
onClick: () => answer(true)
|
|
2604
|
+
}, t("friendAccept"))));
|
|
2605
|
+
}
|
|
2606
|
+
function FriendRow({ friend }) {
|
|
2607
|
+
const Remove = icon("Trash2");
|
|
2608
|
+
const remove = () => void confirmThen(t("removeFriendTitle", { name: friend.name }), t("removeFriendHint"), t("removeFriend"), async () => {
|
|
2609
|
+
await rooms()?.removeFriend(friend.id);
|
|
2610
|
+
await book.load();
|
|
2611
|
+
});
|
|
2612
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
2613
|
+
className: "trm-friend"
|
|
2614
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
2615
|
+
id: friend.id,
|
|
2616
|
+
name: friend.name,
|
|
2617
|
+
size: 38,
|
|
2618
|
+
online: friend.status === "friend" ? friend.online : undefined
|
|
2619
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2620
|
+
className: "trm-room-text"
|
|
2621
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2622
|
+
className: "trm-room-name trm-ellipsis"
|
|
2623
|
+
}, friend.name), friend.status === "adding" && /* @__PURE__ */ React.createElement("span", {
|
|
2624
|
+
className: "trm-room-preview trm-ellipsis"
|
|
2625
|
+
}, t("friendAdding"))), /* @__PURE__ */ React.createElement("button", {
|
|
2626
|
+
type: "button",
|
|
2627
|
+
className: "trm-icon trm-danger",
|
|
2628
|
+
title: t("removeFriend"),
|
|
2629
|
+
"aria-label": `${t("removeFriend")} · ${friend.name}`,
|
|
2630
|
+
onClick: remove
|
|
2631
|
+
}, /* @__PURE__ */ React.createElement(Remove, {
|
|
2632
|
+
size: 15
|
|
2633
|
+
})));
|
|
2634
|
+
}
|
|
2635
|
+
function FriendsPage() {
|
|
2636
|
+
const { friends, friendRequests } = useBook();
|
|
2637
|
+
const Add = icon("UserPlus");
|
|
2638
|
+
if (!rooms()) {
|
|
2639
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
2640
|
+
title: t("oldApp")
|
|
2641
|
+
});
|
|
2642
|
+
}
|
|
2643
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2644
|
+
className: "trm-list trm-friends-page"
|
|
2645
|
+
}, friendRequests.length > 0 && /* @__PURE__ */ React.createElement("section", {
|
|
2646
|
+
className: "trm-section"
|
|
2647
|
+
}, /* @__PURE__ */ React.createElement("h3", null, t("friendRequestsTitle")), /* @__PURE__ */ React.createElement("ul", {
|
|
2648
|
+
className: "trm-card"
|
|
2649
|
+
}, friendRequests.map((request) => /* @__PURE__ */ React.createElement(FriendRequestRow, {
|
|
2650
|
+
key: request.id,
|
|
2651
|
+
request
|
|
2652
|
+
})))), /* @__PURE__ */ React.createElement("section", {
|
|
2653
|
+
className: "trm-section"
|
|
2654
|
+
}, !!friends?.length && /* @__PURE__ */ React.createElement("h3", null, `${t("friends")} · ${friends.length}`), friends === undefined ? pi.ui.Skeleton ? /* @__PURE__ */ React.createElement(pi.ui.Skeleton, {
|
|
2655
|
+
rows: 3
|
|
2656
|
+
}) : null : friends.length === 0 ? /* @__PURE__ */ React.createElement("div", {
|
|
2657
|
+
className: "trm-friends-empty"
|
|
2658
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
2659
|
+
compact: true,
|
|
2660
|
+
title: t("friendsEmpty"),
|
|
2661
|
+
hint: t("friendsEmptyHint")
|
|
2662
|
+
}), /* @__PURE__ */ React.createElement("button", {
|
|
2663
|
+
type: "button",
|
|
2664
|
+
className: "ta-button ta-primary",
|
|
2665
|
+
onClick: openAddFriend
|
|
2666
|
+
}, /* @__PURE__ */ React.createElement(Add, {
|
|
2667
|
+
size: 14
|
|
2668
|
+
}), " ", t("addFriend"))) : /* @__PURE__ */ React.createElement("ul", {
|
|
2669
|
+
className: "trm-rooms"
|
|
2670
|
+
}, friends.map((friend) => /* @__PURE__ */ React.createElement(FriendRow, {
|
|
2671
|
+
key: friend.id,
|
|
2672
|
+
friend
|
|
2673
|
+
})))));
|
|
2674
|
+
}
|
|
2675
|
+
function FriendsHead() {
|
|
2676
|
+
const Add = icon("UserPlus");
|
|
2677
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2678
|
+
className: "trm-head trm-head-center"
|
|
2679
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2680
|
+
className: "trm-head-title"
|
|
2681
|
+
}, t("friends")), /* @__PURE__ */ React.createElement("span", {
|
|
2682
|
+
className: "trm-head-end"
|
|
2683
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2684
|
+
type: "button",
|
|
2685
|
+
className: "trm-icon",
|
|
2686
|
+
title: t("addFriend"),
|
|
2687
|
+
"aria-label": t("addFriend"),
|
|
2688
|
+
onClick: openAddFriend
|
|
2689
|
+
}, /* @__PURE__ */ React.createElement(Add, {
|
|
2690
|
+
size: 18
|
|
2691
|
+
}))));
|
|
2692
|
+
}
|
|
2693
|
+
function FriendsEntry() {
|
|
2694
|
+
const { friends, friendRequests } = useBook();
|
|
2695
|
+
const Chevron = icon("ChevronRight");
|
|
2696
|
+
const list = (friends ?? []).filter((friend) => friend.status === "friend");
|
|
2697
|
+
return /* @__PURE__ */ React.createElement("button", {
|
|
2698
|
+
type: "button",
|
|
2699
|
+
className: "trm-friends-entry",
|
|
2700
|
+
onClick: () => void pi.ui.showView(FRIENDS_VIEW)
|
|
2701
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2702
|
+
className: "trm-friends-entry-label"
|
|
2703
|
+
}, t("friends")), friendRequests.length > 0 && /* @__PURE__ */ React.createElement("span", {
|
|
2704
|
+
className: "trm-dot"
|
|
2705
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2706
|
+
className: "trm-grow"
|
|
2707
|
+
}), list.length > 0 && pi.ui.GroupFace && /* @__PURE__ */ React.createElement(pi.ui.GroupFace, {
|
|
2708
|
+
members: list.slice(0, 4).map((friend) => ({ seed: friend.id })),
|
|
2709
|
+
size: 24
|
|
2710
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2711
|
+
className: "trm-quiet"
|
|
2712
|
+
}, list.length ? t("friendsCount", { n: list.length }) : t("friendsNone")), /* @__PURE__ */ React.createElement(Chevron, {
|
|
2713
|
+
size: 16
|
|
2714
|
+
}));
|
|
2715
|
+
}
|
|
2716
|
+
function AddFriendDialog({ close }) {
|
|
2717
|
+
const [link, setLink] = React.useState();
|
|
2718
|
+
const [error, setError] = React.useState();
|
|
2719
|
+
const [copied, setCopied] = React.useState(false);
|
|
2720
|
+
const make = React.useCallback((renew) => {
|
|
2721
|
+
setError(undefined);
|
|
2722
|
+
setCopied(false);
|
|
2723
|
+
rooms()?.friendLink(renew).then(setLink).catch((failure) => setError(message(failure)));
|
|
2724
|
+
}, []);
|
|
2725
|
+
React.useEffect(() => make(false), [make]);
|
|
2726
|
+
const canSend = typeof navigator !== "undefined" && typeof navigator.share === "function";
|
|
2727
|
+
const days = link ? Math.max(1, Math.round((link.expiresAt - Date.now()) / 86400000)) : 0;
|
|
2728
|
+
const other = (read) => () => {
|
|
2729
|
+
close();
|
|
2730
|
+
read().then((text) => text && openFriendLink(text));
|
|
2731
|
+
};
|
|
2732
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2733
|
+
title: t("addFriend"),
|
|
2734
|
+
onClose: close
|
|
2735
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2736
|
+
className: "trm-dialog trm-invite"
|
|
2737
|
+
}, link ? /* @__PURE__ */ React.createElement(React.Fragment, null, pi.ui.QrCode && /* @__PURE__ */ React.createElement("div", {
|
|
2738
|
+
className: "trm-qr"
|
|
2739
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.QrCode, {
|
|
2740
|
+
text: link.link,
|
|
2741
|
+
label: t("qr")
|
|
2742
|
+
})), /* @__PURE__ */ React.createElement("p", {
|
|
2743
|
+
className: "trm-hint"
|
|
2744
|
+
}, t("addFriendHint")), /* @__PURE__ */ React.createElement("p", {
|
|
2745
|
+
className: "trm-hint trm-quiet"
|
|
2746
|
+
}, t("addFriendExpires", { days })), /* @__PURE__ */ React.createElement("div", {
|
|
2747
|
+
className: "trm-actions trm-center"
|
|
2748
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2749
|
+
type: "button",
|
|
2750
|
+
className: "ta-button ta-primary",
|
|
2751
|
+
onClick: () => void navigator.clipboard?.writeText(link.link).then(() => setCopied(true))
|
|
2752
|
+
}, copied ? t("copied") : t("copy")), canSend && /* @__PURE__ */ React.createElement("button", {
|
|
2753
|
+
type: "button",
|
|
2754
|
+
className: "ta-button",
|
|
2755
|
+
onClick: () => void navigator.share({ title: t("addFriend"), url: link.link }).catch(() => {
|
|
2756
|
+
return;
|
|
2757
|
+
})
|
|
2758
|
+
}, t("send")), /* @__PURE__ */ React.createElement("button", {
|
|
2759
|
+
type: "button",
|
|
2760
|
+
className: "ta-button",
|
|
2761
|
+
onClick: () => make(true)
|
|
2762
|
+
}, t("newLink")))) : error ? /* @__PURE__ */ React.createElement("p", {
|
|
2763
|
+
className: "trm-error"
|
|
2764
|
+
}, error) : /* @__PURE__ */ React.createElement("p", {
|
|
2765
|
+
className: "trm-hint"
|
|
2766
|
+
}, t("making")), /* @__PURE__ */ React.createElement("div", {
|
|
2767
|
+
className: "trm-actions trm-center trm-friends-other"
|
|
2768
|
+
}, pi.ui.scanCode && /* @__PURE__ */ React.createElement("button", {
|
|
2769
|
+
type: "button",
|
|
2770
|
+
className: "trm-link",
|
|
2771
|
+
onClick: other(async () => (await pi.ui.scanCode?.(t("scanHint")))?.trim())
|
|
2772
|
+
}, t("scanFriend")), /* @__PURE__ */ React.createElement("button", {
|
|
2773
|
+
type: "button",
|
|
2774
|
+
className: "trm-link",
|
|
2775
|
+
onClick: other(async () => (await pi.ui.input(t("pasteFriend"), t("joinByLinkPlaceholder")))?.trim())
|
|
2776
|
+
}, t("pasteFriend")))));
|
|
2777
|
+
}
|
|
2778
|
+
function openAddFriend() {
|
|
2779
|
+
show(AddFriendDialog);
|
|
2780
|
+
}
|
|
2781
|
+
function FriendLinkDialog({ text, close }) {
|
|
2782
|
+
const link = RelayHubUtil.parse(text);
|
|
2783
|
+
const { identity, friends } = useBook();
|
|
2784
|
+
const [busy, run] = useRun();
|
|
2785
|
+
const known = friends?.find((friend) => friend.id === link.owner && friend.status === "friend");
|
|
2786
|
+
const own = identity?.id === link.owner;
|
|
2787
|
+
const add = () => void run(async () => {
|
|
2788
|
+
await rooms()?.addFriend(text);
|
|
2789
|
+
pi.ui.notify(t("addFriendAsked", { name: link.by || "…" }));
|
|
2790
|
+
close();
|
|
2791
|
+
await book.load();
|
|
2792
|
+
});
|
|
2793
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2794
|
+
title: t("addFriend"),
|
|
2795
|
+
onClose: close
|
|
2796
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2797
|
+
className: "trm-dialog"
|
|
2798
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2799
|
+
className: "trm-join"
|
|
2800
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
2801
|
+
id: link.owner,
|
|
2802
|
+
name: link.by || "?",
|
|
2803
|
+
size: 56
|
|
2804
|
+
}), /* @__PURE__ */ React.createElement("strong", {
|
|
2805
|
+
className: "trm-join-name"
|
|
2806
|
+
}, link.by || "…"), /* @__PURE__ */ React.createElement("p", {
|
|
2807
|
+
className: "trm-lead"
|
|
2808
|
+
}, own ? t("addFriendOwn") : known ? t("addFriendKnown", { name: link.by }) : t("addFriendBody", { name: link.by || "…" }))), /* @__PURE__ */ React.createElement("div", {
|
|
2809
|
+
className: "trm-actions"
|
|
2810
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2811
|
+
type: "button",
|
|
2812
|
+
className: "ta-button",
|
|
2813
|
+
onClick: close
|
|
2814
|
+
}, t("later")), !own && !known && /* @__PURE__ */ React.createElement("button", {
|
|
2815
|
+
type: "button",
|
|
2816
|
+
className: `ta-button ta-primary${busy ? " ta-busy" : ""}`,
|
|
2817
|
+
disabled: busy,
|
|
2818
|
+
onClick: add
|
|
2819
|
+
}, t("addFriendAction")))));
|
|
2820
|
+
}
|
|
2821
|
+
function openFriendLink(text) {
|
|
2822
|
+
if (!isFriendLink(text)) {
|
|
2823
|
+
if (!RelayHubUtil.is(text)) {
|
|
2824
|
+
pi.ui.notify(t("notInvite"), "warning");
|
|
2825
|
+
}
|
|
2826
|
+
return false;
|
|
2827
|
+
}
|
|
2828
|
+
show(({ close }) => /* @__PURE__ */ React.createElement(FriendLinkDialog, {
|
|
2829
|
+
text,
|
|
2830
|
+
close
|
|
2831
|
+
}));
|
|
2832
|
+
return true;
|
|
2833
|
+
}
|
|
2834
|
+
function FriendRequestsDialog({ close }) {
|
|
2835
|
+
const { friendRequests } = useBook();
|
|
2836
|
+
const seen = React.useRef(false);
|
|
2837
|
+
React.useEffect(() => {
|
|
2838
|
+
if (friendRequests.length) {
|
|
2839
|
+
seen.current = true;
|
|
2840
|
+
} else if (seen.current) {
|
|
2841
|
+
close();
|
|
2842
|
+
}
|
|
2843
|
+
}, [friendRequests.length, close]);
|
|
2844
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2845
|
+
title: t("friendRequestsTitle"),
|
|
2846
|
+
onClose: close
|
|
2847
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2848
|
+
className: "trm-dialog"
|
|
2849
|
+
}, /* @__PURE__ */ React.createElement("ul", {
|
|
2850
|
+
className: "trm-rows"
|
|
2851
|
+
}, friendRequests.map((request) => /* @__PURE__ */ React.createElement(FriendRequestRow, {
|
|
2852
|
+
key: request.id,
|
|
2853
|
+
request
|
|
2854
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
2855
|
+
className: "trm-note"
|
|
2856
|
+
}, t("friendRequestNote")), /* @__PURE__ */ React.createElement("div", {
|
|
2857
|
+
className: "trm-actions"
|
|
2858
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2087
2859
|
type: "button",
|
|
2088
|
-
className: "ta-button
|
|
2089
|
-
onClick:
|
|
2090
|
-
},
|
|
2091
|
-
const before = lines[index - 1];
|
|
2092
|
-
const separator = !before || line.at - before.at > PAUSE_MS;
|
|
2093
|
-
const first = separator || speaker(before) !== speaker(line) || line.at - before.at > RUN_MS;
|
|
2094
|
-
const other = room.members.find((member) => member.member === line.from);
|
|
2095
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
2096
|
-
key: line.id
|
|
2097
|
-
}, separator && /* @__PURE__ */ React.createElement("div", {
|
|
2098
|
-
className: "trm-chat-time"
|
|
2099
|
-
}, time(line.at)), line.from === self?.member && !line.double && !line.agent ? /* @__PURE__ */ React.createElement("div", {
|
|
2100
|
-
className: "ta-message ta-user trm-mine",
|
|
2101
|
-
title: time(line.at)
|
|
2102
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
2103
|
-
className: "ta-bubble"
|
|
2104
|
-
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
2105
|
-
text: line.text
|
|
2106
|
-
}))) : /* @__PURE__ */ React.createElement("div", {
|
|
2107
|
-
className: `trm-msg${first ? " trm-first" : ""}${line.double ? " trm-double" : ""}${line.agent ? " trm-agent" : ""}`
|
|
2108
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
2109
|
-
className: "trm-msg-face"
|
|
2110
|
-
}, first && /* @__PURE__ */ React.createElement(Face, {
|
|
2111
|
-
id: line.agent?.id ?? other?.id ?? line.from,
|
|
2112
|
-
name: nameOf(line),
|
|
2113
|
-
face: line.agent && agents.find((agent) => agent.id === line.agent?.id && agent.member === line.from)?.face,
|
|
2114
|
-
size: 28
|
|
2115
|
-
})), /* @__PURE__ */ React.createElement("div", {
|
|
2116
|
-
className: "trm-msg-col"
|
|
2117
|
-
}, first && /* @__PURE__ */ React.createElement("div", {
|
|
2118
|
-
className: "trm-msg-name"
|
|
2119
|
-
}, nameOf(line), tagOf(line) && /* @__PURE__ */ React.createElement("span", {
|
|
2120
|
-
className: `trm-tag ${line.agent ? "trm-tag-agent" : "trm-tag-double"}`
|
|
2121
|
-
}, tagOf(line))), /* @__PURE__ */ React.createElement("div", {
|
|
2122
|
-
className: "trm-msg-bubble",
|
|
2123
|
-
title: time(line.at)
|
|
2124
|
-
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
2125
|
-
text: line.text
|
|
2126
|
-
})))));
|
|
2127
|
-
}), joining.map((agent) => /* @__PURE__ */ React.createElement("div", {
|
|
2128
|
-
key: agent.id,
|
|
2129
|
-
className: "trm-chat-joining",
|
|
2130
|
-
role: "status"
|
|
2131
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2132
|
-
className: "ta-spinner"
|
|
2133
|
-
}), dt("joiningRoom", { name: agent.name }))))), /* @__PURE__ */ React.createElement("div", {
|
|
2134
|
-
className: "trm-chat-bottom"
|
|
2135
|
-
}, /* @__PURE__ */ React.createElement(pi.ui.Composer, {
|
|
2136
|
-
placeholder: t("chatPlaceholder"),
|
|
2137
|
-
onSend: say,
|
|
2138
|
-
mentions,
|
|
2139
|
-
mentionLabel: dt("mentionLabel")
|
|
2140
|
-
})));
|
|
2860
|
+
className: "ta-button",
|
|
2861
|
+
onClick: close
|
|
2862
|
+
}, t("later")))));
|
|
2141
2863
|
}
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2864
|
+
var requestsOpen;
|
|
2865
|
+
function openFriendRequests() {
|
|
2866
|
+
if (requestsOpen) {
|
|
2867
|
+
return;
|
|
2868
|
+
}
|
|
2869
|
+
requestsOpen = show(({ close }) => /* @__PURE__ */ React.createElement(FriendRequestsDialog, {
|
|
2870
|
+
close: () => {
|
|
2871
|
+
requestsOpen = undefined;
|
|
2872
|
+
close();
|
|
2873
|
+
}
|
|
2874
|
+
}));
|
|
2147
2875
|
}
|
|
2148
|
-
function
|
|
2149
|
-
|
|
2876
|
+
async function offerFriend(room, member, name) {
|
|
2877
|
+
try {
|
|
2878
|
+
await rooms()?.offerFriend(room, member);
|
|
2879
|
+
pi.ui.notify(t("friendOffered", { name }));
|
|
2880
|
+
await book.load();
|
|
2881
|
+
} catch (error) {
|
|
2882
|
+
pi.ui.notify(message(error), "error");
|
|
2883
|
+
}
|
|
2150
2884
|
}
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2885
|
+
|
|
2886
|
+
// web-src/dialogs.tsx
|
|
2887
|
+
function show(component) {
|
|
2888
|
+
if (!pi.ui.custom) {
|
|
2889
|
+
pi.ui.notify(t("oldApp"), "warning");
|
|
2890
|
+
return;
|
|
2891
|
+
}
|
|
2892
|
+
return pi.ui.custom(component);
|
|
2893
|
+
}
|
|
2894
|
+
function RequestRow({ request }) {
|
|
2895
|
+
const [busy, run] = (pi.ui.useBusy ?? (() => [false, async (action) => action()]))();
|
|
2896
|
+
const answer = (accept) => void run(async () => {
|
|
2897
|
+
try {
|
|
2898
|
+
await rooms()?.answer(request.room, request.ask, accept);
|
|
2899
|
+
} catch (error) {
|
|
2900
|
+
pi.ui.notify(message(error), "error");
|
|
2160
2901
|
}
|
|
2161
|
-
|
|
2162
|
-
|
|
2902
|
+
await book.load();
|
|
2903
|
+
});
|
|
2904
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
2905
|
+
className: `trm-row${busy ? " ta-pending" : ""}`
|
|
2906
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
2907
|
+
id: request.id,
|
|
2908
|
+
name: request.name
|
|
2909
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
2910
|
+
className: "trm-row-text"
|
|
2911
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
2912
|
+
className: "trm-row-title"
|
|
2913
|
+
}, request.name, /* @__PURE__ */ React.createElement("span", {
|
|
2914
|
+
className: `trm-tag${request.friend ? " trm-tag-friend" : ""}`
|
|
2915
|
+
}, request.guest ? t("guestTag") : request.friend ? t("friendTag") : t("newTag"))), /* @__PURE__ */ React.createElement("span", {
|
|
2916
|
+
className: "trm-row-line"
|
|
2917
|
+
}, t("requestLine", { title: request.title }))), /* @__PURE__ */ React.createElement("div", {
|
|
2918
|
+
className: "trm-answers"
|
|
2919
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2920
|
+
type: "button",
|
|
2921
|
+
className: "ta-button",
|
|
2922
|
+
disabled: busy,
|
|
2923
|
+
onClick: () => answer(false)
|
|
2924
|
+
}, t("refuse")), /* @__PURE__ */ React.createElement("button", {
|
|
2925
|
+
type: "button",
|
|
2926
|
+
className: "ta-button ta-primary",
|
|
2927
|
+
disabled: busy,
|
|
2928
|
+
onClick: () => answer(true)
|
|
2929
|
+
}, t("accept"))));
|
|
2930
|
+
}
|
|
2931
|
+
function RequestsDialog({ close }) {
|
|
2932
|
+
const { requests } = useBook();
|
|
2933
|
+
const seen = React.useRef(false);
|
|
2934
|
+
React.useEffect(() => {
|
|
2935
|
+
if (requests.length) {
|
|
2936
|
+
seen.current = true;
|
|
2937
|
+
} else if (seen.current) {
|
|
2938
|
+
close();
|
|
2163
2939
|
}
|
|
2164
|
-
}
|
|
2940
|
+
}, [requests.length, close]);
|
|
2941
|
+
const first = requests[0];
|
|
2942
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2943
|
+
title: t("requests"),
|
|
2944
|
+
onClose: close
|
|
2945
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2946
|
+
className: "trm-dialog"
|
|
2947
|
+
}, first && /* @__PURE__ */ React.createElement("p", {
|
|
2948
|
+
className: "trm-lead"
|
|
2949
|
+
}, requests.length === 1 ? t("requestBody", { name: first.name, title: first.title }) : t("requestsBody", { n: requests.length })), /* @__PURE__ */ React.createElement("ul", {
|
|
2950
|
+
className: "trm-rows"
|
|
2951
|
+
}, requests.map((request) => /* @__PURE__ */ React.createElement(RequestRow, {
|
|
2952
|
+
key: `${request.room}:${request.ask}`,
|
|
2953
|
+
request
|
|
2954
|
+
}))), /* @__PURE__ */ React.createElement("p", {
|
|
2955
|
+
className: "trm-note"
|
|
2956
|
+
}, [
|
|
2957
|
+
requests.some((request) => !request.friend) ? t("requestNew") : requests.length ? t("requestFriend") : "",
|
|
2958
|
+
requests.some((request) => request.guest) ? t("requestGuest") : "",
|
|
2959
|
+
t("requestWhat")
|
|
2960
|
+
].filter(Boolean).join(pi.ui.language === "zh-CN" ? "" : " ")), /* @__PURE__ */ React.createElement("div", {
|
|
2961
|
+
className: "trm-actions"
|
|
2962
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
2963
|
+
type: "button",
|
|
2964
|
+
className: "ta-button",
|
|
2965
|
+
onClick: close
|
|
2966
|
+
}, t("later")))));
|
|
2165
2967
|
}
|
|
2166
|
-
var
|
|
2167
|
-
function
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
clearTimeout(timer);
|
|
2179
|
-
resolve();
|
|
2180
|
-
};
|
|
2181
|
-
check();
|
|
2182
|
-
});
|
|
2968
|
+
var requestsOpen2;
|
|
2969
|
+
function openRequests() {
|
|
2970
|
+
if (requestsOpen2) {
|
|
2971
|
+
return;
|
|
2972
|
+
}
|
|
2973
|
+
const close = show(({ close: close2 }) => /* @__PURE__ */ React.createElement(RequestsDialog, {
|
|
2974
|
+
close: () => {
|
|
2975
|
+
requestsOpen2 = undefined;
|
|
2976
|
+
close2();
|
|
2977
|
+
}
|
|
2978
|
+
}));
|
|
2979
|
+
requestsOpen2 = close;
|
|
2183
2980
|
}
|
|
2184
|
-
function
|
|
2185
|
-
const
|
|
2981
|
+
function JoinDialog({ link, text, close }) {
|
|
2982
|
+
const { identity } = useBook();
|
|
2983
|
+
const [busy, setBusy] = React.useState(false);
|
|
2186
2984
|
const [error, setError] = React.useState();
|
|
2187
|
-
const
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2985
|
+
const join = async () => {
|
|
2986
|
+
setBusy(true);
|
|
2987
|
+
setError(undefined);
|
|
2988
|
+
try {
|
|
2989
|
+
const room = await rooms()?.join(text);
|
|
2990
|
+
await book.load();
|
|
2991
|
+
close();
|
|
2992
|
+
if (room?.status === "member") {
|
|
2993
|
+
if (room.view) {
|
|
2994
|
+
pi.ui.showView(room.view);
|
|
2995
|
+
} else {
|
|
2996
|
+
openRoom(room.id);
|
|
2997
|
+
}
|
|
2998
|
+
} else {
|
|
2999
|
+
pi.ui.notify(t("asked", { by: link.by || "…" }));
|
|
3000
|
+
}
|
|
3001
|
+
} catch (failure) {
|
|
3002
|
+
setError(message(failure));
|
|
3003
|
+
setBusy(false);
|
|
3004
|
+
}
|
|
2196
3005
|
};
|
|
2197
|
-
const Plus = icon("Plus");
|
|
2198
3006
|
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
2199
|
-
title:
|
|
3007
|
+
title: t("joinTitle", { title: link.title || t("room") }),
|
|
2200
3008
|
onClose: close
|
|
2201
3009
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2202
3010
|
className: "trm-dialog"
|
|
2203
|
-
}, /* @__PURE__ */ React.createElement("
|
|
2204
|
-
className: "trm-
|
|
2205
|
-
},
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
}
|
|
2212
|
-
className: "trm-rows trm-agent-pick"
|
|
2213
|
-
}, agents.map((agent) => {
|
|
2214
|
-
const joined = inRoom.some((each) => each.id === agent.id && each.member === self);
|
|
2215
|
-
const coming = joining.some((each) => each.id === agent.id);
|
|
2216
|
-
return /* @__PURE__ */ React.createElement("li", {
|
|
2217
|
-
key: agent.id
|
|
2218
|
-
}, /* @__PURE__ */ React.createElement("button", {
|
|
2219
|
-
type: "button",
|
|
2220
|
-
className: "trm-member",
|
|
2221
|
-
disabled: joined || coming,
|
|
2222
|
-
onClick: () => invite(agent)
|
|
2223
|
-
}, /* @__PURE__ */ React.createElement(Face, {
|
|
2224
|
-
id: agent.id,
|
|
2225
|
-
name: agent.name,
|
|
2226
|
-
face: agent.face,
|
|
2227
|
-
size: 34
|
|
2228
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
2229
|
-
className: "trm-member-text"
|
|
2230
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2231
|
-
className: "trm-member-name trm-ellipsis"
|
|
2232
|
-
}, agent.name), /* @__PURE__ */ React.createElement("span", {
|
|
2233
|
-
className: "trm-member-detail trm-ellipsis"
|
|
2234
|
-
}, joined ? dt("inRoom") : coming ? dt("joining") : agent.role)), coming ? /* @__PURE__ */ React.createElement("span", {
|
|
2235
|
-
className: "ta-spinner"
|
|
2236
|
-
}) : !joined && /* @__PURE__ */ React.createElement(Plus, {
|
|
2237
|
-
size: 16
|
|
2238
|
-
})));
|
|
2239
|
-
})), error && /* @__PURE__ */ React.createElement("p", {
|
|
3011
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3012
|
+
className: "trm-join"
|
|
3013
|
+
}, /* @__PURE__ */ React.createElement(Face, {
|
|
3014
|
+
id: link.owner,
|
|
3015
|
+
name: link.by || "?",
|
|
3016
|
+
size: 44
|
|
3017
|
+
}), /* @__PURE__ */ React.createElement("p", {
|
|
3018
|
+
className: "trm-lead"
|
|
3019
|
+
}, t("joinBody", { by: link.by || "…", name: identity?.name ?? "…" }))), error && /* @__PURE__ */ React.createElement("p", {
|
|
2240
3020
|
className: "trm-error"
|
|
2241
|
-
}, error)
|
|
3021
|
+
}, error), /* @__PURE__ */ React.createElement("div", {
|
|
3022
|
+
className: "trm-actions"
|
|
3023
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
3024
|
+
type: "button",
|
|
3025
|
+
className: "ta-button",
|
|
3026
|
+
onClick: close
|
|
3027
|
+
}, t("later")), /* @__PURE__ */ React.createElement("button", {
|
|
3028
|
+
type: "button",
|
|
3029
|
+
className: `ta-button ta-primary${busy ? " ta-busy" : ""}`,
|
|
3030
|
+
disabled: busy,
|
|
3031
|
+
onClick: () => void join()
|
|
3032
|
+
}, t("joinAction")))));
|
|
2242
3033
|
}
|
|
2243
|
-
function
|
|
2244
|
-
|
|
3034
|
+
function InviteDialog({ room, close }) {
|
|
3035
|
+
const [link, setLink] = React.useState();
|
|
3036
|
+
const [error, setError] = React.useState();
|
|
3037
|
+
const [copied, setCopied] = React.useState(false);
|
|
3038
|
+
const make = React.useCallback((renew) => {
|
|
3039
|
+
setError(undefined);
|
|
3040
|
+
setCopied(false);
|
|
3041
|
+
rooms()?.invite(room.id, renew ? { renew } : undefined).then((made) => setLink(made.link)).catch((failure) => setError(message(failure)));
|
|
3042
|
+
}, [room.id]);
|
|
3043
|
+
React.useEffect(() => make(false), [make]);
|
|
3044
|
+
const canSend = typeof navigator !== "undefined" && typeof navigator.share === "function";
|
|
3045
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
3046
|
+
title: t("inviteTitle", { title: room.title }),
|
|
3047
|
+
onClose: close
|
|
3048
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3049
|
+
className: "trm-dialog trm-invite"
|
|
3050
|
+
}, link ? /* @__PURE__ */ React.createElement(React.Fragment, null, pi.ui.QrCode && /* @__PURE__ */ React.createElement("div", {
|
|
3051
|
+
className: "trm-qr"
|
|
3052
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.QrCode, {
|
|
3053
|
+
text: link,
|
|
3054
|
+
label: t("qr")
|
|
3055
|
+
})), /* @__PURE__ */ React.createElement("p", {
|
|
3056
|
+
className: "trm-hint"
|
|
3057
|
+
}, t("inviteHint")), /* @__PURE__ */ React.createElement("div", {
|
|
3058
|
+
className: "trm-link-box"
|
|
3059
|
+
}, link), /* @__PURE__ */ React.createElement("div", {
|
|
3060
|
+
className: "trm-actions trm-center"
|
|
3061
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
3062
|
+
type: "button",
|
|
3063
|
+
className: "ta-button ta-primary",
|
|
3064
|
+
onClick: () => void navigator.clipboard?.writeText(link).then(() => setCopied(true))
|
|
3065
|
+
}, copied ? t("copied") : t("copy")), canSend && /* @__PURE__ */ React.createElement("button", {
|
|
3066
|
+
type: "button",
|
|
3067
|
+
className: "ta-button",
|
|
3068
|
+
onClick: () => void navigator.share({ title: room.title, url: link }).catch(() => {
|
|
3069
|
+
return;
|
|
3070
|
+
})
|
|
3071
|
+
}, t("send")), /* @__PURE__ */ React.createElement("button", {
|
|
3072
|
+
type: "button",
|
|
3073
|
+
className: "ta-button",
|
|
3074
|
+
onClick: () => make(true)
|
|
3075
|
+
}, t("newLink")))) : error ? /* @__PURE__ */ React.createElement("p", {
|
|
3076
|
+
className: "trm-error"
|
|
3077
|
+
}, error) : /* @__PURE__ */ React.createElement("p", {
|
|
3078
|
+
className: "trm-hint"
|
|
3079
|
+
}, t("making"))));
|
|
3080
|
+
}
|
|
3081
|
+
function openInvite(room) {
|
|
3082
|
+
show(({ close }) => /* @__PURE__ */ React.createElement(InviteDialog, {
|
|
2245
3083
|
room,
|
|
2246
3084
|
close
|
|
2247
3085
|
}));
|
|
2248
3086
|
}
|
|
2249
|
-
function
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
}
|
|
2265
|
-
|
|
3087
|
+
function openJoin(text) {
|
|
3088
|
+
if (isFriendLink(text)) {
|
|
3089
|
+
openFriendLink(text);
|
|
3090
|
+
return;
|
|
3091
|
+
}
|
|
3092
|
+
const link = RelayHubUtil.parse(text);
|
|
3093
|
+
const known = book.get().rooms?.find((room) => room.id === link.room && room.status === "member");
|
|
3094
|
+
if (known) {
|
|
3095
|
+
if (known.view) {
|
|
3096
|
+
pi.ui.showView(known.view);
|
|
3097
|
+
} else {
|
|
3098
|
+
openRoom(known.id);
|
|
3099
|
+
}
|
|
3100
|
+
return;
|
|
3101
|
+
}
|
|
3102
|
+
show(({ close }) => /* @__PURE__ */ React.createElement(JoinDialog, {
|
|
3103
|
+
link,
|
|
3104
|
+
text,
|
|
3105
|
+
close
|
|
2266
3106
|
}));
|
|
2267
3107
|
}
|
|
2268
|
-
function
|
|
2269
|
-
const
|
|
2270
|
-
const
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
}
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
3108
|
+
async function createRoom() {
|
|
3109
|
+
const name = book.get().identity?.name;
|
|
3110
|
+
const title = await pi.ui.input(t("newRoom"), t("newRoomPlaceholder"), { value: name ? t("roomOfName", { name }) : "" });
|
|
3111
|
+
if (!title?.trim()) {
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
try {
|
|
3115
|
+
const room = await rooms()?.createRoom({ kind: ROOMS_KIND, title: title.trim() });
|
|
3116
|
+
if (room) {
|
|
3117
|
+
await book.load();
|
|
3118
|
+
openRoom(room.id);
|
|
3119
|
+
openInvite(room);
|
|
3120
|
+
}
|
|
3121
|
+
} catch (error) {
|
|
3122
|
+
pi.ui.notify(message(error), "error");
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
async function pasteLink() {
|
|
3126
|
+
const text = (await pi.ui.input(t("joinByLink"), t("joinByLinkPlaceholder")))?.trim();
|
|
3127
|
+
if (!text) {
|
|
3128
|
+
return;
|
|
3129
|
+
}
|
|
3130
|
+
if (!RelayHubUtil.is(text)) {
|
|
3131
|
+
pi.ui.notify(t("notInvite"), "warning");
|
|
3132
|
+
return;
|
|
3133
|
+
}
|
|
3134
|
+
openJoin(text);
|
|
3135
|
+
}
|
|
3136
|
+
async function scanLink() {
|
|
3137
|
+
const text = (await pi.ui.scanCode?.(t("scanHint")))?.trim();
|
|
3138
|
+
if (!text) {
|
|
3139
|
+
return;
|
|
3140
|
+
}
|
|
3141
|
+
if (!RelayHubUtil.is(text)) {
|
|
3142
|
+
pi.ui.notify(t("notInvite"), "warning");
|
|
3143
|
+
return;
|
|
3144
|
+
}
|
|
3145
|
+
openJoin(text);
|
|
3146
|
+
}
|
|
3147
|
+
async function rename() {
|
|
3148
|
+
const identity = book.get().identity;
|
|
3149
|
+
const name = await pi.ui.input(t("me"), t("renamePlaceholder"), { value: identity?.name ?? "" });
|
|
3150
|
+
if (name?.trim() && name.trim() !== identity?.name) {
|
|
3151
|
+
try {
|
|
3152
|
+
book.set({ identity: await rooms()?.setName(name.trim()) });
|
|
3153
|
+
} catch (error) {
|
|
3154
|
+
pi.ui.notify(message(error), "error");
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
2297
3157
|
}
|
|
2298
3158
|
|
|
2299
3159
|
// web-src/members-view.tsx
|
|
@@ -2301,7 +3161,15 @@ function MemberRow({ room, member }) {
|
|
|
2301
3161
|
const Remove = icon("X");
|
|
2302
3162
|
const Key = pi.ui.icons.KeyRound ?? icon("Bot");
|
|
2303
3163
|
const may = useMayLine(member);
|
|
2304
|
-
const
|
|
3164
|
+
const { friends } = useBook();
|
|
3165
|
+
const friend = friends?.find((each) => each.id === member.id);
|
|
3166
|
+
const Add = icon("UserPlus");
|
|
3167
|
+
const tags = [
|
|
3168
|
+
member.self ? t("you") : "",
|
|
3169
|
+
member.owner ? t("owner") : "",
|
|
3170
|
+
member.guest ? t("guestTag") : "",
|
|
3171
|
+
friend?.status === "friend" ? t("friendTag") : ""
|
|
3172
|
+
].filter(Boolean);
|
|
2305
3173
|
return /* @__PURE__ */ React.createElement("li", {
|
|
2306
3174
|
className: "trm-member"
|
|
2307
3175
|
}, /* @__PURE__ */ React.createElement(Face, {
|
|
@@ -2322,7 +3190,15 @@ function MemberRow({ room, member }) {
|
|
|
2322
3190
|
className: `trm-member-detail${member.online ? " trm-live" : ""}`
|
|
2323
3191
|
}, member.online ? t("online") : t("offline")), may && /* @__PURE__ */ React.createElement("span", {
|
|
2324
3192
|
className: "trm-member-detail trm-member-may trm-ellipsis"
|
|
2325
|
-
}, may)), !member.self && !member.guest && /* @__PURE__ */ React.createElement("button", {
|
|
3193
|
+
}, may)), !member.self && !member.guest && !friend && /* @__PURE__ */ React.createElement("button", {
|
|
3194
|
+
type: "button",
|
|
3195
|
+
className: "trm-icon trm-member-action",
|
|
3196
|
+
title: t("friendOffer"),
|
|
3197
|
+
"aria-label": `${t("friendOffer")} · ${member.name}`,
|
|
3198
|
+
onClick: () => void offerFriend(room.id, member.member, member.name)
|
|
3199
|
+
}, /* @__PURE__ */ React.createElement(Add, {
|
|
3200
|
+
size: 15
|
|
3201
|
+
})), !member.self && !member.guest && /* @__PURE__ */ React.createElement("button", {
|
|
2326
3202
|
type: "button",
|
|
2327
3203
|
className: `trm-icon trm-member-action${may ? " trm-on-icon" : ""}`,
|
|
2328
3204
|
title: dt("permissions"),
|
|
@@ -2531,34 +3407,8 @@ function RoomRow({ room, active, seen, openMenu }) {
|
|
|
2531
3407
|
className: `trm-room-preview trm-ellipsis${member ? "" : " trm-quiet"}`
|
|
2532
3408
|
}, preview))));
|
|
2533
3409
|
}
|
|
2534
|
-
function FriendRow({ friend, openMenu }) {
|
|
2535
|
-
const Remove = icon("Trash2");
|
|
2536
|
-
const remove = () => void confirmThen(t("removeFriendTitle", { name: friend.name }), t("removeFriendHint"), t("removeFriend"), async () => rooms()?.removeFriend(friend.id));
|
|
2537
|
-
return /* @__PURE__ */ React.createElement("li", {
|
|
2538
|
-
className: "trm-friend",
|
|
2539
|
-
onContextMenu: (event) => openMenu(event, [[{ key: "remove", label: t("removeFriend"), icon: Remove, danger: true, run: remove }]])
|
|
2540
|
-
}, /* @__PURE__ */ React.createElement(Face, {
|
|
2541
|
-
id: friend.id,
|
|
2542
|
-
name: friend.name,
|
|
2543
|
-
size: 38
|
|
2544
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
2545
|
-
className: "trm-room-text"
|
|
2546
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
2547
|
-
className: "trm-room-name trm-ellipsis"
|
|
2548
|
-
}, friend.name), /* @__PURE__ */ React.createElement("span", {
|
|
2549
|
-
className: "trm-room-preview trm-ellipsis"
|
|
2550
|
-
}, t("friendLine", { rooms: friend.rooms.slice(-3).reverse().join("、") }))), /* @__PURE__ */ React.createElement("button", {
|
|
2551
|
-
type: "button",
|
|
2552
|
-
className: "trm-icon trm-danger trm-hover-only",
|
|
2553
|
-
title: t("removeFriend"),
|
|
2554
|
-
"aria-label": t("removeFriend"),
|
|
2555
|
-
onClick: remove
|
|
2556
|
-
}, /* @__PURE__ */ React.createElement(Remove, {
|
|
2557
|
-
size: 15
|
|
2558
|
-
})));
|
|
2559
|
-
}
|
|
2560
3410
|
function RoomList({ openMenu }) {
|
|
2561
|
-
const { identity, rooms: list, requests,
|
|
3411
|
+
const { identity, rooms: list, requests, opened, seen } = useBook();
|
|
2562
3412
|
const { asks } = useDoubles();
|
|
2563
3413
|
const sorted = useSorted(list ?? []);
|
|
2564
3414
|
return /* @__PURE__ */ React.createElement("div", {
|
|
@@ -2581,9 +3431,11 @@ function RoomList({ openMenu }) {
|
|
|
2581
3431
|
className: "trm-section"
|
|
2582
3432
|
}, /* @__PURE__ */ React.createElement("h3", null, t("roomsTitle")), list === undefined ? pi.ui.Skeleton ? /* @__PURE__ */ React.createElement(pi.ui.Skeleton, {
|
|
2583
3433
|
rows: 3
|
|
2584
|
-
}) : null : sorted.length === 0 ? /* @__PURE__ */ React.createElement(
|
|
2585
|
-
|
|
2586
|
-
|
|
3434
|
+
}) : null : sorted.length === 0 ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
3435
|
+
compact: true,
|
|
3436
|
+
title: t("emptyTitle"),
|
|
3437
|
+
hint: t("emptyListHint")
|
|
3438
|
+
}) : /* @__PURE__ */ React.createElement("ul", {
|
|
2587
3439
|
className: "trm-rooms"
|
|
2588
3440
|
}, sorted.map((room) => /* @__PURE__ */ React.createElement(RoomRow, {
|
|
2589
3441
|
key: room.id,
|
|
@@ -2591,15 +3443,7 @@ function RoomList({ openMenu }) {
|
|
|
2591
3443
|
active: room.id === opened,
|
|
2592
3444
|
seen,
|
|
2593
3445
|
openMenu
|
|
2594
|
-
})))),
|
|
2595
|
-
className: "trm-section"
|
|
2596
|
-
}, /* @__PURE__ */ React.createElement("h3", null, t("friends")), /* @__PURE__ */ React.createElement("ul", {
|
|
2597
|
-
className: "trm-rooms"
|
|
2598
|
-
}, friends.map((friend) => /* @__PURE__ */ React.createElement(FriendRow, {
|
|
2599
|
-
key: friend.id,
|
|
2600
|
-
friend,
|
|
2601
|
-
openMenu
|
|
2602
|
-
})))), identity && /* @__PURE__ */ React.createElement("p", {
|
|
3446
|
+
})))), /* @__PURE__ */ React.createElement(FriendsEntry, null), identity && /* @__PURE__ */ React.createElement("p", {
|
|
2603
3447
|
className: "trm-me"
|
|
2604
3448
|
}, t("meLine", { name: identity.name }), /* @__PURE__ */ React.createElement("button", {
|
|
2605
3449
|
type: "button",
|
|
@@ -2614,6 +3458,7 @@ function addMenu() {
|
|
|
2614
3458
|
{ key: "link", label: t("joinByLink"), icon: icon("Link"), run: () => void pasteLink() },
|
|
2615
3459
|
...pi.ui.scanCode ? [{ key: "scan", label: t("scan"), icon: icon("ScanLine"), run: () => void scanLink() }] : []
|
|
2616
3460
|
],
|
|
3461
|
+
[{ key: "friend", label: t("addFriend"), icon: icon("UserPlus"), run: openAddFriend }],
|
|
2617
3462
|
[
|
|
2618
3463
|
{ key: "name", label: t("me"), icon: icon("Pencil"), run: () => void rename() },
|
|
2619
3464
|
{ key: "doubles", label: dt("log"), icon: icon("Bot"), run: () => void pi.ui.showView(DOUBLES_VIEW) }
|
|
@@ -2899,7 +3744,6 @@ var STYLE = `
|
|
|
2899
3744
|
.trm-page > .trm-list { max-width: 720px; margin: 0 auto; }
|
|
2900
3745
|
.trm-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 10px calc(24px + env(safe-area-inset-bottom)); box-sizing: border-box; }
|
|
2901
3746
|
.trm-section h3 { display: flex; align-items: center; height: 30px; margin: 0; padding: 0 10px; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; letter-spacing: 0.02em; color: var(--ta-muted); }
|
|
2902
|
-
.trm-empty { margin: 4px 10px 8px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); line-height: 1.6; }
|
|
2903
3747
|
.trm-card { margin: 0; padding: 2px 6px; list-style: none; border-radius: 14px; background: var(--ta-raised); }
|
|
2904
3748
|
.trm-card .trm-row { padding: 10px 4px; }
|
|
2905
3749
|
.trm-rooms { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
|
|
@@ -3021,6 +3865,17 @@ button.trm-member { cursor: pointer; }
|
|
|
3021
3865
|
.trm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
|
|
3022
3866
|
.trm-center { justify-content: center; }
|
|
3023
3867
|
.trm-join { display: flex; align-items: center; gap: 12px; }
|
|
3868
|
+
.trm-friends-page { max-width: 720px; margin: 0 auto; width: 100%; overflow-y: auto; height: 100%; }
|
|
3869
|
+
.trm-friends-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 0 20px; }
|
|
3870
|
+
.trm-friends-other { gap: 18px; padding-top: 4px; }
|
|
3871
|
+
.trm-friends-entry { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--ta-surface, transparent); color: inherit; font: inherit; cursor: pointer; text-align: left; }
|
|
3872
|
+
@media (hover: hover) { .trm-friends-entry:hover { background: var(--ta-hover); } }
|
|
3873
|
+
.trm-friends-entry-label { font-weight: 500; }
|
|
3874
|
+
.trm-grow { flex: 1; }
|
|
3875
|
+
.trm-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ta-amber, #f5a524); }
|
|
3876
|
+
.trm-join-name { font-size: calc(15px * var(--ta-font-scale)); }
|
|
3877
|
+
.trm-dialog .trm-join:has(.trm-join-name) { flex-direction: column; text-align: center; gap: 8px; }
|
|
3878
|
+
.trm-member-friend { color: var(--ta-muted); }
|
|
3024
3879
|
.trm-invite { align-items: stretch; }
|
|
3025
3880
|
.trm-qr { align-self: center; width: 188px; padding: 10px; border-radius: 14px; background: #fff; border: 1px solid var(--ta-border-muted); }
|
|
3026
3881
|
.trm-qr svg { display: block; width: 100%; height: auto; }
|
|
@@ -3031,6 +3886,23 @@ button.trm-member { cursor: pointer; }
|
|
|
3031
3886
|
.trm-double .trm-msg-bubble { border-style: dashed; background: var(--ta-main); }
|
|
3032
3887
|
.trm-tag-agent { margin-left: 6px; background: var(--ta-tint-5); color: var(--ta-tint-ink-5); }
|
|
3033
3888
|
.trm-member-name .trm-tag-agent { margin-left: 0; }
|
|
3889
|
+
.trm-tag-task { margin-left: 6px; background: var(--ta-tint-0); color: var(--ta-tint-ink-0); }
|
|
3890
|
+
.trm-task-line { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); }
|
|
3891
|
+
.trm-task-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ta-secondary); flex: none; }
|
|
3892
|
+
.trm-task-running .trm-task-dot, .trm-task-queued .trm-task-dot, .trm-task-sent .trm-task-dot { background: var(--ta-green); animation: trm-breathe 1.6s ease-in-out infinite; }
|
|
3893
|
+
.trm-task-permission .trm-task-dot { background: var(--ta-yellow); }
|
|
3894
|
+
.trm-task-done .trm-task-dot { background: var(--ta-green); }
|
|
3895
|
+
.trm-task-failed .trm-task-dot, .trm-task-declined .trm-task-dot { background: var(--ta-red); }
|
|
3896
|
+
@keyframes trm-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
|
|
3897
|
+
.trm-task-card { margin: 4px 0; border: 1px solid var(--ta-border); border-radius: 12px; background: var(--ta-card); overflow: hidden; max-width: 560px; }
|
|
3898
|
+
.trm-task-card-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
3899
|
+
.trm-task-card-head:hover { background: var(--ta-hover); }
|
|
3900
|
+
.trm-task-card-title { flex: 1; min-width: 0; font-weight: 500; }
|
|
3901
|
+
.trm-task-chip { flex: none; padding: 0 7px; border-radius: 6px; background: var(--ta-chip, var(--ta-hover)); color: var(--ta-secondary); font-size: calc(11px * var(--ta-font-scale)); line-height: calc(18px * var(--ta-font-scale)); }
|
|
3902
|
+
.trm-task-done .trm-task-chip { background: color-mix(in srgb, var(--ta-green) 14%, transparent); color: var(--ta-green); }
|
|
3903
|
+
.trm-task-failed .trm-task-chip, .trm-task-declined .trm-task-chip { background: color-mix(in srgb, var(--ta-red) 12%, transparent); color: var(--ta-red); }
|
|
3904
|
+
.trm-task-card-text { padding: 0 12px 8px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
|
|
3905
|
+
.trm-task-card-answer { padding: 8px 12px; border-top: 1px solid var(--ta-border); }
|
|
3034
3906
|
.trm-try-alone { margin-top: 12px; }
|
|
3035
3907
|
.trm-chat-joining { display: inline-flex; align-self: center; align-items: center; gap: 8px; margin: 10px 0 4px; padding: 6px 12px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
|
|
3036
3908
|
.trm-agent-pick .trm-member:disabled { cursor: default; opacity: 1; }
|
|
@@ -3065,11 +3937,9 @@ button.trm-member { cursor: pointer; }
|
|
|
3065
3937
|
.trm-log-empty { display: flex; flex-direction: column; padding: 12px 0; }
|
|
3066
3938
|
[data-layout='compact'] .trm-room-head-sub { display: none; }
|
|
3067
3939
|
[data-layout='compact'] .trm-faces.trm-on-icon, [data-layout='compact'] .trm-faces.trm-on-icon .trm-faces-one { background: none; }
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
.trm-page-line { width: calc(100% - 24px); }
|
|
3072
|
-
}
|
|
3940
|
+
[data-layout='compact'] .trm-chat-col, [data-layout='compact'] .trm-chat-bottom { padding-left: 12px; padding-right: 12px; }
|
|
3941
|
+
[data-layout='compact'] .trm-msg-col { max-width: calc(100% - 40px); }
|
|
3942
|
+
[data-layout='compact'] .trm-page-line { width: calc(100% - 24px); }
|
|
3073
3943
|
@media (max-width: 480px) { .trm-answers .ta-button { padding-left: 10px; padding-right: 10px; } }
|
|
3074
3944
|
@media (prefers-reduced-motion: reduce) { .trm-room, .trm-page-line { transition: none; } }
|
|
3075
3945
|
`;
|
|
@@ -3109,6 +3979,7 @@ function activate(pi2) {
|
|
|
3109
3979
|
bindPage(pi2);
|
|
3110
3980
|
const removeStyle = injectStyle();
|
|
3111
3981
|
pi2.registerView("rooms", { title: () => t("roomsTitle"), icon: icon("Users"), render: RoomsPage, head: RoomsHead, discover: true, order: 81 });
|
|
3982
|
+
pi2.registerView("friends", { title: () => t("friends"), icon: icon("Contact"), render: FriendsPage, head: FriendsHead, discover: true, order: 79 });
|
|
3112
3983
|
pi2.registerView("members", { title: () => t("membersTitle"), icon: icon("Users"), render: MembersView, location: "panel", order: 90 });
|
|
3113
3984
|
pi2.registerView(DOUBLES_VIEW.slice(DOUBLES_VIEW.lastIndexOf("/") + 1), {
|
|
3114
3985
|
title: () => dt("logTitle"),
|
|
@@ -3128,16 +3999,27 @@ function activate(pi2) {
|
|
|
3128
3999
|
const stopAsks = pi2.rooms ? listenAsks() : () => {
|
|
3129
4000
|
return;
|
|
3130
4001
|
};
|
|
4002
|
+
if (pi2.rooms) {
|
|
4003
|
+
registerTasks();
|
|
4004
|
+
}
|
|
3131
4005
|
pi2.registerOpener((link) => {
|
|
3132
4006
|
if (link.type !== "url" || !RelayHubUtil.is(link.url)) {
|
|
3133
4007
|
return false;
|
|
3134
4008
|
}
|
|
4009
|
+
if (isFriendLink(link.url)) {
|
|
4010
|
+
return openFriendLink(link.url);
|
|
4011
|
+
}
|
|
4012
|
+
if (RelayHubUtil.parse(link.url).kind) {
|
|
4013
|
+
return false;
|
|
4014
|
+
}
|
|
3135
4015
|
openJoin(link.url);
|
|
3136
4016
|
return true;
|
|
3137
4017
|
}, { specific: true });
|
|
3138
4018
|
const stop = pi2.onRoomEvent?.((event) => {
|
|
3139
4019
|
if (event.type === "request") {
|
|
3140
|
-
book.load().then(() => openRequests());
|
|
4020
|
+
book.load().then(() => book.get().requests.length && openRequests());
|
|
4021
|
+
} else if (event.type === "friend") {
|
|
4022
|
+
book.load().then(() => book.get().friendRequests.length && openFriendRequests());
|
|
3141
4023
|
} else if (event.type === "rooms") {
|
|
3142
4024
|
book.reload();
|
|
3143
4025
|
} else {
|