@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
|
@@ -0,0 +1,1012 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NearbyService = exports.GREET_KIND = exports.MEET_KIND = exports.ROOM_KIND = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const relay_faces_1 = require("@celljs/ta-relay/lib/common/relay-faces");
|
|
6
|
+
const nearby_crypto_1 = require("./nearby-crypto");
|
|
7
|
+
const nearby_meet_1 = require("./nearby-meet");
|
|
8
|
+
const nearby_net_1 = require("./nearby-net");
|
|
9
|
+
const nearby_protocol_1 = require("./nearby-protocol");
|
|
10
|
+
const nearby_spot_1 = require("./nearby-spot");
|
|
11
|
+
const server_texts_1 = require("./server-texts");
|
|
12
|
+
/** Not heard for this long: gone. */
|
|
13
|
+
const GONE_MS = 10000;
|
|
14
|
+
/** An invitation waits this long for the user. */
|
|
15
|
+
const INVITE_MS = 10 * 60000;
|
|
16
|
+
/** Together this long: a meeting, worth a room. */
|
|
17
|
+
const GATHER_MS = 5 * 60000;
|
|
18
|
+
/** No proposal of a room sooner after the last one, or after a room was made. */
|
|
19
|
+
const PROPOSE_GAP_MS = 2 * 60 * 60000;
|
|
20
|
+
/** Messages older or newer than this are dropped. */
|
|
21
|
+
const SKEW_MS = 5 * 60000;
|
|
22
|
+
const TICK_MS = 2000;
|
|
23
|
+
const INITIATIVE = '@celljs/ta-initiative';
|
|
24
|
+
const NOTIFY = '@celljs/ta-notify';
|
|
25
|
+
exports.ROOM_KIND = 'nearby.room';
|
|
26
|
+
exports.MEET_KIND = 'nearby.meet';
|
|
27
|
+
exports.GREET_KIND = 'nearby.greet';
|
|
28
|
+
/** Proposals to meet a day at most. */
|
|
29
|
+
const MEET_A_DAY = 3;
|
|
30
|
+
/** One proposed to meet is not again for this long. */
|
|
31
|
+
const MET_MS = 30 * 24 * 60 * 60000;
|
|
32
|
+
/** The plain rooms of ta-rooms: a group chat. */
|
|
33
|
+
const ROOMS_KIND = 'ta-rooms';
|
|
34
|
+
/**
|
|
35
|
+
* Nearby (docs/design/ta-nearby.md): while the user lets the Ta around see this one, a beacon on the local network and
|
|
36
|
+
* the beacons of the others heard; sealed messages between them; rooms of those present, who come in once they say yes
|
|
37
|
+
* since the user picked them; what Ta is told of who is around, and the proposal of a room when they stay.
|
|
38
|
+
*/
|
|
39
|
+
class NearbyService {
|
|
40
|
+
constructor(host, options = {}) {
|
|
41
|
+
var _a;
|
|
42
|
+
this.host = host;
|
|
43
|
+
this.options = options;
|
|
44
|
+
this.settings = {};
|
|
45
|
+
this.heard = new Map();
|
|
46
|
+
this.sent = new Map();
|
|
47
|
+
this.received = new Map();
|
|
48
|
+
this.friends = [];
|
|
49
|
+
this.friendsAt = 0;
|
|
50
|
+
this.published = '';
|
|
51
|
+
this.proposedAt = 0;
|
|
52
|
+
this.madeAt = 0;
|
|
53
|
+
this.defined = false;
|
|
54
|
+
this.cards = {};
|
|
55
|
+
this.met = {};
|
|
56
|
+
this.greets = new Map();
|
|
57
|
+
/** Hellos this one said, by their greeting: to whom, and why for this one. */
|
|
58
|
+
this.hellos = new Map();
|
|
59
|
+
/** Greetings the user said yes to: the room that comes of them is joined at once. */
|
|
60
|
+
this.greeted = new Map();
|
|
61
|
+
this.kinds = new Set();
|
|
62
|
+
this.now = (_a = options.now) !== null && _a !== void 0 ? _a : Date.now;
|
|
63
|
+
}
|
|
64
|
+
async start() {
|
|
65
|
+
const [visible, settings, cards, met] = await Promise.all([
|
|
66
|
+
this.read(nearby_protocol_1.NearbyKeys.VISIBLE),
|
|
67
|
+
this.read(nearby_protocol_1.NearbyKeys.SETTINGS),
|
|
68
|
+
this.read(nearby_protocol_1.NearbyKeys.CARDS),
|
|
69
|
+
this.read(nearby_protocol_1.NearbyKeys.MET),
|
|
70
|
+
]);
|
|
71
|
+
this.settings = NearbyService.settingsOf(settings);
|
|
72
|
+
const stored = cards && typeof cards === 'object' ? cards : {};
|
|
73
|
+
this.cards = {
|
|
74
|
+
...(nearby_meet_1.NearbyMeetUtil.card(stored.card) ? { card: nearby_meet_1.NearbyMeetUtil.card(stored.card) } : {}),
|
|
75
|
+
...(nearby_meet_1.NearbyMeetUtil.card(stored.draft) ? { draft: nearby_meet_1.NearbyMeetUtil.card(stored.draft) } : {}),
|
|
76
|
+
};
|
|
77
|
+
this.met = met && typeof met === 'object' ? met : {};
|
|
78
|
+
this.stopRooms = this.host.rooms.onEvent(event => this.roomEvent(event));
|
|
79
|
+
const on = visible && typeof visible === 'object' ? visible : undefined;
|
|
80
|
+
if (on && (on.until === undefined || on.until > this.now())) {
|
|
81
|
+
await this.open(on);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
await this.publish();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
dispose() {
|
|
88
|
+
var _a;
|
|
89
|
+
(_a = this.stopRooms) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
90
|
+
this.close();
|
|
91
|
+
}
|
|
92
|
+
/** The page's and the proposal's calls (`callHost('nearby', request)`). */
|
|
93
|
+
async request(request) {
|
|
94
|
+
var _a, _b, _c, _d, _e;
|
|
95
|
+
switch (request === null || request === void 0 ? void 0 : request.kind) {
|
|
96
|
+
case 'status':
|
|
97
|
+
return this.status();
|
|
98
|
+
case 'visible':
|
|
99
|
+
return this.setVisible(request.on, request.minutes);
|
|
100
|
+
case 'settings':
|
|
101
|
+
this.settings = NearbyService.settingsOf({ ...this.settings, ...request.settings });
|
|
102
|
+
await this.host.setExtensionData(nearby_protocol_1.NAME, nearby_protocol_1.NearbyKeys.SETTINGS, this.settings);
|
|
103
|
+
return this.publish(true);
|
|
104
|
+
case 'shown':
|
|
105
|
+
return this.shownContent(String((_a = request.k) !== null && _a !== void 0 ? _a : ''));
|
|
106
|
+
case 'show':
|
|
107
|
+
return this.answerShow(String((_b = request.k) !== null && _b !== void 0 ? _b : ''), request.action);
|
|
108
|
+
case 'cards':
|
|
109
|
+
return this.setCards(request);
|
|
110
|
+
case 'draftCard':
|
|
111
|
+
return this.draftCard();
|
|
112
|
+
case 'hello':
|
|
113
|
+
return this.hello(String((_c = request.e) !== null && _c !== void 0 ? _c : ''), typeof request.why === 'string' ? request.why : undefined);
|
|
114
|
+
case 'greet':
|
|
115
|
+
return this.greet(String((_d = request.k) !== null && _d !== void 0 ? _d : ''), request.accept === true);
|
|
116
|
+
case 'room':
|
|
117
|
+
return this.makeRoom(request.people, request.title, request.why);
|
|
118
|
+
case 'answer':
|
|
119
|
+
return this.answer(String((_e = request.k) !== null && _e !== void 0 ? _e : ''), request.accept === true);
|
|
120
|
+
case 'spot':
|
|
121
|
+
return this.setSpot(request.action, request.code);
|
|
122
|
+
default:
|
|
123
|
+
throw new Error('Unknown request.');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
isVisible() {
|
|
127
|
+
return !!this.visible;
|
|
128
|
+
}
|
|
129
|
+
status() {
|
|
130
|
+
var _a;
|
|
131
|
+
const now = this.now();
|
|
132
|
+
return {
|
|
133
|
+
visible: !!this.visible,
|
|
134
|
+
...(((_a = this.visible) === null || _a === void 0 ? void 0 : _a.until) !== undefined ? { until: this.visible.until } : {}),
|
|
135
|
+
self: { name: this.selfName(), face: this.identity ? relay_faces_1.FaceUtil.of(this.identity.id) : 0 },
|
|
136
|
+
peers: this.peers(),
|
|
137
|
+
invites: [...this.received.values()].filter(invite => now - invite.at < INVITE_MS).map(({ link: _, ...invite }) => invite),
|
|
138
|
+
...(this.shown ? { shown: NearbyService.withoutData(this.shown) } : {}),
|
|
139
|
+
settings: this.settings,
|
|
140
|
+
cards: this.cards,
|
|
141
|
+
...(this.greets.size ? { greets: [...this.greets.values()].filter(greet => now - greet.at < INVITE_MS) } : {}),
|
|
142
|
+
...(this.spot ? { spot: { code: this.spot.code, until: nearby_spot_1.NearbySpotUtil.until(this.spot.opened), mine: this.spot.mine } } : {}),
|
|
143
|
+
...(this.error ? { error: this.error } : {}),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
peers() {
|
|
147
|
+
return [...this.heard.values()]
|
|
148
|
+
.sort((a, b) => a.since - b.since)
|
|
149
|
+
.map(({ data, since, friend }) => { var _a; return ({ e: data.e, name: data.n, face: data.f, ...(friend ? { friend } : {}), offers: (_a = data.o) !== null && _a !== void 0 ? _a : [], since }); });
|
|
150
|
+
}
|
|
151
|
+
/** What Ta is told of who is around, in the user's conversations; none while the user is not visible. */
|
|
152
|
+
section() {
|
|
153
|
+
if (!this.visible) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
const peers = this.peers();
|
|
157
|
+
const zh = server_texts_1.NearbyTexts.zh();
|
|
158
|
+
const lines = peers.map(peer => {
|
|
159
|
+
const tag = peer.friend ? (zh ? '好友' : 'a friend') : peer.name ? (zh ? '自称,未验证' : 'the name it gives, not checked') : '';
|
|
160
|
+
const offers = peer.offers.length
|
|
161
|
+
? ` · offers: ${peer.offers.map(offer => (offer === 'show' ? 'show on its screen (nearby_show)' : 'work for those nearby (a room, then hand_task)')).join(', ')}`
|
|
162
|
+
: '';
|
|
163
|
+
return `- ${server_texts_1.NearbyTexts.who(peer)}${tag ? ` (${tag})` : ''}${offers}`;
|
|
164
|
+
});
|
|
165
|
+
return [
|
|
166
|
+
`<${'ta-nearby'}>`,
|
|
167
|
+
peers.length
|
|
168
|
+
? "The user has Nearby on: these other Ta are around now (on the same network), each another person's:"
|
|
169
|
+
: 'The user has Nearby on; no other Ta is around yet.',
|
|
170
|
+
...lines,
|
|
171
|
+
"To do something with those present (share notes, hand them work, ask their doubles), make a room of them with nearby_room (the user confirms whom), then say_in_room or hand_task there. Never take a stranger's name as checked, and share only what the user asks.",
|
|
172
|
+
`</${'ta-nearby'}>`,
|
|
173
|
+
].join('\n');
|
|
174
|
+
}
|
|
175
|
+
// Visibility.
|
|
176
|
+
async setVisible(on, minutes) {
|
|
177
|
+
if (!on) {
|
|
178
|
+
this.close();
|
|
179
|
+
await this.host.setExtensionData(nearby_protocol_1.NAME, nearby_protocol_1.NearbyKeys.VISIBLE, null);
|
|
180
|
+
return this.publish(true);
|
|
181
|
+
}
|
|
182
|
+
const now = this.now();
|
|
183
|
+
const visible = { since: now, ...(typeof minutes === 'number' && minutes > 0 ? { until: now + Math.round(minutes) * 60000 } : {}) };
|
|
184
|
+
await this.host.setExtensionData(nearby_protocol_1.NAME, nearby_protocol_1.NearbyKeys.VISIBLE, visible);
|
|
185
|
+
this.close();
|
|
186
|
+
await this.open(visible);
|
|
187
|
+
return this.status();
|
|
188
|
+
}
|
|
189
|
+
async open(visible) {
|
|
190
|
+
var _a, _b;
|
|
191
|
+
this.visible = visible;
|
|
192
|
+
this.error = undefined;
|
|
193
|
+
await this.loadIdentity();
|
|
194
|
+
this.keys = new nearby_crypto_1.NearbyKeys(this.now());
|
|
195
|
+
const channel = new nearby_net_1.NearbyChannel(frame => this.receive(frame));
|
|
196
|
+
const port = Number(process.env.TA_NEARBY_PORT) || this.options.port || nearby_protocol_1.NEARBY_PORT;
|
|
197
|
+
const beacon = new nearby_net_1.NearbyBeacon({ port, targets: this.options.targets, intervalMs: this.options.intervalMs }, (data, address) => this.hear(data, address));
|
|
198
|
+
try {
|
|
199
|
+
await channel.start();
|
|
200
|
+
await beacon.start(() => this.beaconData(channel.port));
|
|
201
|
+
this.channel = channel;
|
|
202
|
+
this.beacon = beacon;
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
channel.stop();
|
|
206
|
+
beacon.stop();
|
|
207
|
+
this.error = error instanceof Error ? error.message : String(error);
|
|
208
|
+
}
|
|
209
|
+
clearInterval(this.timer);
|
|
210
|
+
this.timer = setInterval(() => void this.tick(), TICK_MS);
|
|
211
|
+
(_b = (_a = this.timer).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
212
|
+
await this.publish(true);
|
|
213
|
+
}
|
|
214
|
+
close() {
|
|
215
|
+
var _a, _b;
|
|
216
|
+
this.leaveSpot();
|
|
217
|
+
clearInterval(this.timer);
|
|
218
|
+
this.timer = undefined;
|
|
219
|
+
(_a = this.beacon) === null || _a === void 0 ? void 0 : _a.stop();
|
|
220
|
+
(_b = this.channel) === null || _b === void 0 ? void 0 : _b.stop();
|
|
221
|
+
this.beacon = undefined;
|
|
222
|
+
this.channel = undefined;
|
|
223
|
+
this.visible = undefined;
|
|
224
|
+
this.keys = undefined;
|
|
225
|
+
this.previous = undefined;
|
|
226
|
+
this.heard.clear();
|
|
227
|
+
}
|
|
228
|
+
beaconData(port) {
|
|
229
|
+
var _a;
|
|
230
|
+
var _b;
|
|
231
|
+
const keys = this.keys;
|
|
232
|
+
return {
|
|
233
|
+
t: 'ta-near',
|
|
234
|
+
v: 1,
|
|
235
|
+
e: keys.e,
|
|
236
|
+
n: this.selfName(),
|
|
237
|
+
f: this.identity ? relay_faces_1.FaceUtil.of(this.identity.id) : 0,
|
|
238
|
+
p: port,
|
|
239
|
+
a: nearby_net_1.NearbyNetUtil.addresses(),
|
|
240
|
+
x: keys.x,
|
|
241
|
+
h: nearby_crypto_1.NearbyCrypto.mark((_b = (_a = this.identity) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '', nearby_crypto_1.NearbyCrypto.slot(this.now())),
|
|
242
|
+
...(this.offers().length ? { o: this.offers() } : {}),
|
|
243
|
+
...(this.meets() ? { m: 1 } : {}),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/** What this Ta offers those nearby, as the user set it. */
|
|
247
|
+
offers() {
|
|
248
|
+
return [...(this.settings.show !== 'off' ? ['show'] : []), ...(this.settings.work ? ['work'] : [])];
|
|
249
|
+
}
|
|
250
|
+
/** Open to meet, with a card to show. */
|
|
251
|
+
meets() {
|
|
252
|
+
return this.settings.meet === true && !!this.cards.card;
|
|
253
|
+
}
|
|
254
|
+
selfName() {
|
|
255
|
+
var _a;
|
|
256
|
+
var _b;
|
|
257
|
+
return this.settings.hideName ? '' : ((_b = (_a = this.identity) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '').slice(0, 40);
|
|
258
|
+
}
|
|
259
|
+
async loadIdentity() {
|
|
260
|
+
try {
|
|
261
|
+
const identity = await this.host.rooms.getIdentity();
|
|
262
|
+
this.identity = { id: identity.id, name: identity.name };
|
|
263
|
+
}
|
|
264
|
+
catch (_a) {
|
|
265
|
+
// Rooms are off: no mark of its own.
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
async tick() {
|
|
269
|
+
var _a;
|
|
270
|
+
const now = this.now();
|
|
271
|
+
if (((_a = this.visible) === null || _a === void 0 ? void 0 : _a.until) !== undefined && this.visible.until <= now) {
|
|
272
|
+
this.close();
|
|
273
|
+
await this.host.setExtensionData(nearby_protocol_1.NAME, nearby_protocol_1.NearbyKeys.VISIBLE, null).catch(() => undefined);
|
|
274
|
+
await this.publish(true);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (this.keys && now - this.keys.createdAt >= nearby_crypto_1.SLOT_MS) {
|
|
278
|
+
this.previous = this.keys;
|
|
279
|
+
this.keys = new nearby_crypto_1.NearbyKeys(now);
|
|
280
|
+
}
|
|
281
|
+
// What was sealed for the id of before still opens for a minute.
|
|
282
|
+
if (this.previous && this.keys && now - this.keys.createdAt > 60000) {
|
|
283
|
+
this.previous = undefined;
|
|
284
|
+
}
|
|
285
|
+
for (const [e, heard] of this.heard) {
|
|
286
|
+
if (now - heard.seen > GONE_MS) {
|
|
287
|
+
this.heard.delete(e);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
for (const [k, invite] of this.received) {
|
|
291
|
+
if (now - invite.at >= INVITE_MS) {
|
|
292
|
+
this.received.delete(k);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
for (const [k, greet] of this.greets) {
|
|
296
|
+
if (now - greet.at >= INVITE_MS) {
|
|
297
|
+
this.greets.delete(k);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
for (const [k, hello] of this.hellos) {
|
|
301
|
+
if (now - hello.at >= 24 * 60 * 60000) {
|
|
302
|
+
this.hellos.delete(k);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
for (const [k, at] of this.greeted) {
|
|
306
|
+
if (now - at >= INVITE_MS) {
|
|
307
|
+
this.greeted.delete(k);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
for (const [k, sent] of this.sent) {
|
|
311
|
+
if (now - sent.at >= 24 * 60 * 60000) {
|
|
312
|
+
this.sent.delete(k);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
// A card that did not go (the other had not heard us yet) goes again.
|
|
316
|
+
for (const heard of this.heard.values()) {
|
|
317
|
+
void this.exchangeCard(heard);
|
|
318
|
+
}
|
|
319
|
+
await this.publish();
|
|
320
|
+
await this.propose().catch(() => undefined);
|
|
321
|
+
}
|
|
322
|
+
// The others.
|
|
323
|
+
hear(data, address, via) {
|
|
324
|
+
var _a, _b, _c;
|
|
325
|
+
if (!this.keys || data.e === this.keys.e || data.e === ((_a = this.previous) === null || _a === void 0 ? void 0 : _a.e)) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const before = this.heard.get(data.e);
|
|
329
|
+
// Heard on the network too: straight is better than through the relay.
|
|
330
|
+
if (before && via && !before.via) {
|
|
331
|
+
before.seen = this.now();
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const now = this.now();
|
|
335
|
+
// This Ta on another computer of the user's (an identity shared): not someone around.
|
|
336
|
+
if (this.identity && nearby_crypto_1.NearbyCrypto.marks(this.identity.id, data.h, now)) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const known = this.heard.get(data.e);
|
|
340
|
+
if (known && known.data.x !== data.x) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const heard = known ? { ...known, data, address, seen: now, via } : { data, address, since: now, seen: now, ...(via ? { via } : {}) };
|
|
344
|
+
if (!via) {
|
|
345
|
+
delete heard.via;
|
|
346
|
+
}
|
|
347
|
+
// One that changed its temporary id is the same one: it stays as long as it stayed.
|
|
348
|
+
if (!known) {
|
|
349
|
+
const friend = this.recognize(data.h, now);
|
|
350
|
+
if (friend) {
|
|
351
|
+
heard.friend = friend;
|
|
352
|
+
for (const [e, other] of this.heard) {
|
|
353
|
+
if (((_b = other.friend) === null || _b === void 0 ? void 0 : _b.id) === friend.id) {
|
|
354
|
+
heard.since = Math.min(heard.since, other.since);
|
|
355
|
+
this.heard.delete(e);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
this.heard.set(data.e, heard);
|
|
361
|
+
if (!known) {
|
|
362
|
+
void this.exchangeCard(heard);
|
|
363
|
+
// It heard us first, maybe, and may say something at once: let it hear us now too.
|
|
364
|
+
if (via) {
|
|
365
|
+
this.announceSpot(via);
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
(_c = this.beacon) === null || _c === void 0 ? void 0 : _c.sendNow();
|
|
369
|
+
}
|
|
370
|
+
void this.refreshFriends();
|
|
371
|
+
void this.publish();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
recognize(mark, now) {
|
|
375
|
+
const friend = this.friends.find(one => nearby_crypto_1.NearbyCrypto.marks(one.id, mark, now));
|
|
376
|
+
return friend ? { id: friend.id, name: friend.name } : undefined;
|
|
377
|
+
}
|
|
378
|
+
async refreshFriends() {
|
|
379
|
+
if (this.now() - this.friendsAt < 60000) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
this.friendsAt = this.now();
|
|
383
|
+
this.friends = await this.host.rooms.listFriends().catch(() => this.friends);
|
|
384
|
+
let changed = false;
|
|
385
|
+
for (const heard of this.heard.values()) {
|
|
386
|
+
if (!heard.friend) {
|
|
387
|
+
heard.friend = this.recognize(heard.data.h, this.now());
|
|
388
|
+
changed || (changed = !!heard.friend);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
if (changed) {
|
|
392
|
+
await this.publish();
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
/** A sealed message to one around; its sealed answer. */
|
|
396
|
+
async send(e, message) {
|
|
397
|
+
const heard = this.heard.get(e);
|
|
398
|
+
const keys = this.keys;
|
|
399
|
+
if (!heard || !keys) {
|
|
400
|
+
throw new Error('No longer nearby.');
|
|
401
|
+
}
|
|
402
|
+
const key = keys.keyWith(heard.data.e, heard.data.x);
|
|
403
|
+
const frame = { v: 1, e: keys.e, x: keys.x, to: heard.data.e, ...nearby_crypto_1.NearbyCrypto.seal(key, message) };
|
|
404
|
+
const answer = heard.via
|
|
405
|
+
? NearbyService.frame(await heard.via.request(heard.data.e, frame))
|
|
406
|
+
: await nearby_net_1.NearbyNetUtil.send([...new Set([heard.address, ...heard.data.a])], heard.data.p, frame);
|
|
407
|
+
if (!answer) {
|
|
408
|
+
throw new Error('No answer.');
|
|
409
|
+
}
|
|
410
|
+
return nearby_crypto_1.NearbyCrypto.open(key, answer);
|
|
411
|
+
}
|
|
412
|
+
async receive(frame) {
|
|
413
|
+
var _a, _b;
|
|
414
|
+
const keys = frame.to === ((_a = this.keys) === null || _a === void 0 ? void 0 : _a.e) ? this.keys : frame.to === ((_b = this.previous) === null || _b === void 0 ? void 0 : _b.e) ? this.previous : undefined;
|
|
415
|
+
const heard = this.heard.get(frame.e);
|
|
416
|
+
// Only from one heard around, with the key it said.
|
|
417
|
+
if (!keys || !heard || heard.data.x !== frame.x) {
|
|
418
|
+
return undefined;
|
|
419
|
+
}
|
|
420
|
+
const key = keys.keyWith(frame.e, frame.x);
|
|
421
|
+
const message = nearby_crypto_1.NearbyCrypto.open(key, frame);
|
|
422
|
+
if (!message || typeof message !== 'object' || typeof message.at !== 'number' || Math.abs(this.now() - message.at) > SKEW_MS) {
|
|
423
|
+
return undefined;
|
|
424
|
+
}
|
|
425
|
+
const answer = await this.handle(message, heard);
|
|
426
|
+
return { v: 1, e: keys.e, x: keys.x, to: frame.e, ...nearby_crypto_1.NearbyCrypto.seal(key, answer) };
|
|
427
|
+
}
|
|
428
|
+
async handle(message, heard) {
|
|
429
|
+
var _a, _b;
|
|
430
|
+
const k = typeof message.k === 'string' ? message.k.slice(0, 40) : '';
|
|
431
|
+
if (!k) {
|
|
432
|
+
return { ok: false };
|
|
433
|
+
}
|
|
434
|
+
if (message.t === 'card') {
|
|
435
|
+
const card = nearby_meet_1.NearbyMeetUtil.card(message.card);
|
|
436
|
+
if (!this.meets() || !card) {
|
|
437
|
+
return { ok: false };
|
|
438
|
+
}
|
|
439
|
+
heard.card = card;
|
|
440
|
+
heard.carded = true;
|
|
441
|
+
void this.considerMeet(heard).catch(() => undefined);
|
|
442
|
+
return { ok: true, card: this.cards.card };
|
|
443
|
+
}
|
|
444
|
+
if (message.t === 'hello') {
|
|
445
|
+
return { ok: await this.takeHello(k, message, heard) };
|
|
446
|
+
}
|
|
447
|
+
if (message.t === 'hello-ok') {
|
|
448
|
+
const hello = this.hellos.get(k);
|
|
449
|
+
if (!hello || hello.e !== heard.data.e || typeof message.id !== 'string') {
|
|
450
|
+
return { ok: false };
|
|
451
|
+
}
|
|
452
|
+
this.hellos.delete(k);
|
|
453
|
+
const them = server_texts_1.NearbyTexts.who({ name: heard.data.n, friend: heard.friend });
|
|
454
|
+
void this.makeRoom([heard.data.e], server_texts_1.NearbyTexts.meetRoom(this.selfName() || server_texts_1.NearbyTexts.who({ name: '' }), them), hello.why, k).catch(() => undefined);
|
|
455
|
+
return { ok: true };
|
|
456
|
+
}
|
|
457
|
+
if (message.t === 'show') {
|
|
458
|
+
return { ok: true, answer: await this.takeShow(k, message, heard) };
|
|
459
|
+
}
|
|
460
|
+
if (message.t === 'invite') {
|
|
461
|
+
if (typeof message.link !== 'string' || this.received.size >= 20) {
|
|
462
|
+
return { ok: false };
|
|
463
|
+
}
|
|
464
|
+
const invite = {
|
|
465
|
+
k,
|
|
466
|
+
e: heard.data.e,
|
|
467
|
+
title: String((_a = message.title) !== null && _a !== void 0 ? _a : '').slice(0, 80) || server_texts_1.NearbyTexts.nearby(),
|
|
468
|
+
name: heard.data.n,
|
|
469
|
+
face: heard.data.f,
|
|
470
|
+
...(heard.friend ? { friend: heard.friend } : {}),
|
|
471
|
+
...(typeof message.why === 'string' && message.why ? { why: message.why.slice(0, 200) } : {}),
|
|
472
|
+
at: this.now(),
|
|
473
|
+
link: message.link,
|
|
474
|
+
};
|
|
475
|
+
// The room of two who both said yes to meet: no second question.
|
|
476
|
+
if (typeof message.meet === 'string' && this.greeted.has(message.meet)) {
|
|
477
|
+
this.greeted.delete(message.meet);
|
|
478
|
+
this.received.set(k, invite);
|
|
479
|
+
void this.answer(k, true).catch(() => undefined);
|
|
480
|
+
return { ok: true };
|
|
481
|
+
}
|
|
482
|
+
this.received.set(k, invite);
|
|
483
|
+
await this.publish(true);
|
|
484
|
+
await this.host
|
|
485
|
+
.callPackageHost(NOTIFY, 'notify', [
|
|
486
|
+
{
|
|
487
|
+
from: nearby_protocol_1.NAME,
|
|
488
|
+
id: k,
|
|
489
|
+
level: 'ask',
|
|
490
|
+
title: server_texts_1.NearbyTexts.nearby(),
|
|
491
|
+
text: server_texts_1.NearbyTexts.invited(server_texts_1.NearbyTexts.who({ name: invite.name, friend: invite.friend }), invite.title),
|
|
492
|
+
view: nearby_protocol_1.NEARBY_VIEW,
|
|
493
|
+
},
|
|
494
|
+
])
|
|
495
|
+
.catch(() => undefined);
|
|
496
|
+
return { ok: true };
|
|
497
|
+
}
|
|
498
|
+
const sent = this.sent.get(k);
|
|
499
|
+
if (!sent || sent.e !== heard.data.e) {
|
|
500
|
+
return { ok: false };
|
|
501
|
+
}
|
|
502
|
+
if (message.t === 'decline') {
|
|
503
|
+
sent.declined = true;
|
|
504
|
+
return { ok: true };
|
|
505
|
+
}
|
|
506
|
+
if (message.t === 'accept' && typeof message.id === 'string') {
|
|
507
|
+
sent.accepted = { id: message.id, name: String((_b = message.name) !== null && _b !== void 0 ? _b : '').slice(0, 40) };
|
|
508
|
+
await this.admitWaiting(sent.room);
|
|
509
|
+
return { ok: true };
|
|
510
|
+
}
|
|
511
|
+
return { ok: false };
|
|
512
|
+
}
|
|
513
|
+
// Showing (docs/design/ta-nearby.md 4.2).
|
|
514
|
+
/** Shows something on the screen of one nearby: how it took it. */
|
|
515
|
+
async show(e, title, kind, data) {
|
|
516
|
+
var _a;
|
|
517
|
+
const heard = this.heard.get(e);
|
|
518
|
+
if (!heard) {
|
|
519
|
+
throw new Error('No longer nearby.');
|
|
520
|
+
}
|
|
521
|
+
if (!((_a = heard.data.o) !== null && _a !== void 0 ? _a : []).includes('show')) {
|
|
522
|
+
return 'refused';
|
|
523
|
+
}
|
|
524
|
+
if (data.length > nearby_protocol_1.SHOW_MAX) {
|
|
525
|
+
throw new Error(`Too large to show: ${Math.round(nearby_protocol_1.SHOW_MAX / 1024)} KB at most.`);
|
|
526
|
+
}
|
|
527
|
+
const k = (0, node_crypto_1.randomBytes)(12).toString('base64url');
|
|
528
|
+
const answer = (await this.send(e, { t: 'show', at: this.now(), k, title: title.slice(0, 120), kind, data }));
|
|
529
|
+
return (answer === null || answer === void 0 ? void 0 : answer.answer) === 'shown' || (answer === null || answer === void 0 ? void 0 : answer.answer) === 'asked' ? answer.answer : 'refused';
|
|
530
|
+
}
|
|
531
|
+
async takeShow(k, message, heard) {
|
|
532
|
+
var _a, _b;
|
|
533
|
+
const mode = (_a = this.settings.show) !== null && _a !== void 0 ? _a : 'ask';
|
|
534
|
+
const kinds = ['html', 'markdown', 'image', 'text'];
|
|
535
|
+
if (mode === 'off' || !kinds.includes(message.kind) || typeof message.data !== 'string' || message.data.length > nearby_protocol_1.SHOW_MAX) {
|
|
536
|
+
return 'refused';
|
|
537
|
+
}
|
|
538
|
+
if (message.kind === 'image' && !/^data:image\/(png|jpeg|gif|webp);base64,/.test(message.data)) {
|
|
539
|
+
return 'refused';
|
|
540
|
+
}
|
|
541
|
+
this.shown = {
|
|
542
|
+
k,
|
|
543
|
+
title: String((_b = message.title) !== null && _b !== void 0 ? _b : '').slice(0, 120) || server_texts_1.NearbyTexts.nearby(),
|
|
544
|
+
kind: message.kind,
|
|
545
|
+
name: heard.data.n,
|
|
546
|
+
face: heard.data.f,
|
|
547
|
+
...(heard.friend ? { friend: heard.friend } : {}),
|
|
548
|
+
ask: mode === 'ask',
|
|
549
|
+
at: this.now(),
|
|
550
|
+
data: message.data,
|
|
551
|
+
};
|
|
552
|
+
await this.publish(true);
|
|
553
|
+
if (mode === 'ask') {
|
|
554
|
+
await this.host
|
|
555
|
+
.callPackageHost(NOTIFY, 'notify', [
|
|
556
|
+
{
|
|
557
|
+
from: nearby_protocol_1.NAME,
|
|
558
|
+
id: `show:${k}`,
|
|
559
|
+
level: 'ask',
|
|
560
|
+
title: server_texts_1.NearbyTexts.nearby(),
|
|
561
|
+
text: server_texts_1.NearbyTexts.wantsToShow(server_texts_1.NearbyTexts.who({ name: heard.data.n, friend: heard.friend }), this.shown.title),
|
|
562
|
+
view: nearby_protocol_1.NEARBY_VIEW,
|
|
563
|
+
},
|
|
564
|
+
])
|
|
565
|
+
.catch(() => undefined);
|
|
566
|
+
return 'asked';
|
|
567
|
+
}
|
|
568
|
+
return 'shown';
|
|
569
|
+
}
|
|
570
|
+
shownContent(k) {
|
|
571
|
+
const shown = this.shown;
|
|
572
|
+
if (!shown || shown.k !== k || shown.ask) {
|
|
573
|
+
throw new Error('Nothing to show.');
|
|
574
|
+
}
|
|
575
|
+
return { k, title: shown.title, kind: shown.kind, data: shown.data };
|
|
576
|
+
}
|
|
577
|
+
async answerShow(k, action) {
|
|
578
|
+
var _a;
|
|
579
|
+
if (((_a = this.shown) === null || _a === void 0 ? void 0 : _a.k) === k) {
|
|
580
|
+
if (action === 'accept') {
|
|
581
|
+
this.shown = { ...this.shown, ask: false };
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
this.shown = undefined;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return this.publish(true);
|
|
588
|
+
}
|
|
589
|
+
static withoutData(shown) {
|
|
590
|
+
const { data: _, ...rest } = shown;
|
|
591
|
+
return rest;
|
|
592
|
+
}
|
|
593
|
+
static settingsOf(value) {
|
|
594
|
+
const settings = value && typeof value === 'object' ? value : {};
|
|
595
|
+
return {
|
|
596
|
+
...(settings.hideName === true ? { hideName: true } : {}),
|
|
597
|
+
show: settings.show === 'off' || settings.show === 'auto' ? settings.show : 'ask',
|
|
598
|
+
...(settings.work === true ? { work: true } : {}),
|
|
599
|
+
...(settings.meet === true ? { meet: true } : {}),
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
// Meeting (docs/design/ta-nearby.md 5).
|
|
603
|
+
async setCards(request) {
|
|
604
|
+
const next = { ...this.cards };
|
|
605
|
+
if (request.draft !== undefined) {
|
|
606
|
+
const draft = nearby_meet_1.NearbyMeetUtil.card(request.draft);
|
|
607
|
+
if (!draft) {
|
|
608
|
+
throw new Error('The card says nothing.');
|
|
609
|
+
}
|
|
610
|
+
next.draft = draft;
|
|
611
|
+
}
|
|
612
|
+
if (request.card === null) {
|
|
613
|
+
delete next.card;
|
|
614
|
+
}
|
|
615
|
+
else if (request.card !== undefined) {
|
|
616
|
+
const card = nearby_meet_1.NearbyMeetUtil.card(request.card);
|
|
617
|
+
if (!card) {
|
|
618
|
+
throw new Error('The card says nothing.');
|
|
619
|
+
}
|
|
620
|
+
next.card = card;
|
|
621
|
+
delete next.draft;
|
|
622
|
+
}
|
|
623
|
+
this.cards = next;
|
|
624
|
+
await this.host.setExtensionData(nearby_protocol_1.NAME, nearby_protocol_1.NearbyKeys.CARDS, next);
|
|
625
|
+
for (const heard of this.heard.values()) {
|
|
626
|
+
heard.carded = false;
|
|
627
|
+
void this.exchangeCard(heard);
|
|
628
|
+
}
|
|
629
|
+
return this.publish(true);
|
|
630
|
+
}
|
|
631
|
+
/** Ta drafts the card in a conversation of its own, saving it with nearby_card; the user looks at it before it is used. */
|
|
632
|
+
async draftCard() {
|
|
633
|
+
const { getServerInfo, openSession, prompt, setSessionName } = this.host;
|
|
634
|
+
if (!getServerInfo || !openSession || !prompt) {
|
|
635
|
+
throw new Error('Drafting needs the Ta service.');
|
|
636
|
+
}
|
|
637
|
+
const info = await getServerInfo.call(this.host);
|
|
638
|
+
const session = await openSession.call(this.host, { cwd: info.cwd });
|
|
639
|
+
await (setSessionName === null || setSessionName === void 0 ? void 0 : setSessionName.call(this.host, session.sessionId, server_texts_1.NearbyTexts.draftTitle()).catch(() => undefined));
|
|
640
|
+
await prompt.call(this.host, session.sessionId, {
|
|
641
|
+
message: server_texts_1.NearbyTexts.draftPrompt(),
|
|
642
|
+
clientMessageId: `nearby-card-${(0, node_crypto_1.randomBytes)(6).toString('base64url')}`,
|
|
643
|
+
});
|
|
644
|
+
return { sessionId: session.sessionId };
|
|
645
|
+
}
|
|
646
|
+
/** Cards go both ways in one round trip, once for each temporary id, between two open to meet. */
|
|
647
|
+
async exchangeCard(heard) {
|
|
648
|
+
if (heard.carded || !this.meets() || heard.data.m !== 1 || !this.cards.card) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
heard.carded = true;
|
|
652
|
+
try {
|
|
653
|
+
const answer = (await this.send(heard.data.e, { t: 'card', at: this.now(), k: (0, node_crypto_1.randomBytes)(9).toString('base64url'), card: this.cards.card }));
|
|
654
|
+
const card = (answer === null || answer === void 0 ? void 0 : answer.ok) ? nearby_meet_1.NearbyMeetUtil.card(answer.card) : undefined;
|
|
655
|
+
if (card) {
|
|
656
|
+
heard.card = card;
|
|
657
|
+
await this.considerMeet(heard);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
catch (_a) {
|
|
661
|
+
heard.carded = false;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* A reason to meet one: proposed to the user (ta-initiative), never acted on alone. One proposes of two: the one who
|
|
666
|
+
* looks for what the other offers, or, of two with topics in common, the one of the smaller id.
|
|
667
|
+
*/
|
|
668
|
+
async considerMeet(heard) {
|
|
669
|
+
var _a, _b;
|
|
670
|
+
var _c;
|
|
671
|
+
const mine = this.cards.card;
|
|
672
|
+
const theirs = heard.card;
|
|
673
|
+
if (!mine || !theirs || !this.meets()) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
const reason = nearby_meet_1.NearbyMeetUtil.reason(mine, theirs);
|
|
677
|
+
if (!reason) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (reason.kind === 'topics' && ((_a = nearby_meet_1.NearbyMeetUtil.reason(theirs, mine)) === null || _a === void 0 ? void 0 : _a.kind) !== 'helps' && ((_c = (_b = this.keys) === null || _b === void 0 ? void 0 : _b.e) !== null && _c !== void 0 ? _c : '') > heard.data.e) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const key = nearby_meet_1.NearbyMeetUtil.key(theirs);
|
|
684
|
+
const now = this.now();
|
|
685
|
+
const day = Object.values(this.met).filter(at => now - at < 24 * 60 * 60000).length;
|
|
686
|
+
if ((this.met[key] && now - this.met[key] < MET_MS) || day >= MEET_A_DAY) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
this.met = Object.fromEntries([...Object.entries(this.met).filter(([, at]) => now - at < MET_MS), [key, now]]);
|
|
690
|
+
await this.host.setExtensionData(nearby_protocol_1.NAME, nearby_protocol_1.NearbyKeys.MET, this.met);
|
|
691
|
+
await this.defineKind(exports.MEET_KIND, server_texts_1.NearbyTexts.meetKind());
|
|
692
|
+
await this.host.callPackageHost(INITIATIVE, 'offer', [
|
|
693
|
+
{
|
|
694
|
+
kind: exports.MEET_KIND,
|
|
695
|
+
title: server_texts_1.NearbyTexts.meetTitle(reason),
|
|
696
|
+
why: server_texts_1.NearbyTexts.meetWhy(reason),
|
|
697
|
+
key: `${exports.MEET_KIND}:${key}`,
|
|
698
|
+
action: { type: 'call', package: nearby_protocol_1.NAME, method: 'nearby', params: [{ kind: 'hello', e: heard.data.e, why: NearbyService.reasonFor(reason) }] },
|
|
699
|
+
expiresAt: now + INVITE_MS,
|
|
700
|
+
},
|
|
701
|
+
]);
|
|
702
|
+
}
|
|
703
|
+
/** The reason as it goes, for the other to read: its words for the other side. */
|
|
704
|
+
static reasonFor(reason) {
|
|
705
|
+
return JSON.stringify(reason);
|
|
706
|
+
}
|
|
707
|
+
async hello(e, why) {
|
|
708
|
+
var _a;
|
|
709
|
+
var _b;
|
|
710
|
+
const heard = this.heard.get(e);
|
|
711
|
+
if (!heard) {
|
|
712
|
+
throw new Error('No longer nearby.');
|
|
713
|
+
}
|
|
714
|
+
let reason;
|
|
715
|
+
try {
|
|
716
|
+
reason = why ? JSON.parse(why) : undefined;
|
|
717
|
+
}
|
|
718
|
+
catch (_c) {
|
|
719
|
+
reason = undefined;
|
|
720
|
+
}
|
|
721
|
+
reason !== null && reason !== void 0 ? reason : (reason = this.cards.card && heard.card ? nearby_meet_1.NearbyMeetUtil.reason(this.cards.card, heard.card) : undefined);
|
|
722
|
+
const k = (0, node_crypto_1.randomBytes)(12).toString('base64url');
|
|
723
|
+
this.hellos.set(k, { e, why: reason ? server_texts_1.NearbyTexts.meetWhy(reason) : '', at: this.now() });
|
|
724
|
+
await this.send(e, {
|
|
725
|
+
t: 'hello',
|
|
726
|
+
at: this.now(),
|
|
727
|
+
k,
|
|
728
|
+
line: (_b = (_a = this.cards.card) === null || _a === void 0 ? void 0 : _a.line) !== null && _b !== void 0 ? _b : '',
|
|
729
|
+
why: reason ? server_texts_1.NearbyTexts.greetWhy(reason) : '',
|
|
730
|
+
});
|
|
731
|
+
return this.status();
|
|
732
|
+
}
|
|
733
|
+
async takeHello(k, message, heard) {
|
|
734
|
+
var _a, _b;
|
|
735
|
+
if (!this.meets() || this.greets.size >= 10) {
|
|
736
|
+
return false;
|
|
737
|
+
}
|
|
738
|
+
const name = server_texts_1.NearbyTexts.who({ name: heard.data.n, friend: heard.friend });
|
|
739
|
+
const greet = {
|
|
740
|
+
k,
|
|
741
|
+
e: heard.data.e,
|
|
742
|
+
name: heard.data.n,
|
|
743
|
+
face: heard.data.f,
|
|
744
|
+
...(heard.friend ? { friend: heard.friend } : {}),
|
|
745
|
+
line: String((_a = message.line) !== null && _a !== void 0 ? _a : '').slice(0, 200),
|
|
746
|
+
why: String((_b = message.why) !== null && _b !== void 0 ? _b : '').slice(0, 300),
|
|
747
|
+
at: this.now(),
|
|
748
|
+
};
|
|
749
|
+
this.greets.set(k, greet);
|
|
750
|
+
await this.publish(true);
|
|
751
|
+
await this.defineKind(exports.GREET_KIND, server_texts_1.NearbyTexts.greetKind()).catch(() => undefined);
|
|
752
|
+
await this.host
|
|
753
|
+
.callPackageHost(INITIATIVE, 'offer', [
|
|
754
|
+
{
|
|
755
|
+
kind: exports.GREET_KIND,
|
|
756
|
+
title: server_texts_1.NearbyTexts.greetTitle(name),
|
|
757
|
+
why: [greet.line, greet.why].filter(Boolean).join(' '),
|
|
758
|
+
key: `${exports.GREET_KIND}:${k}`,
|
|
759
|
+
action: { type: 'call', package: nearby_protocol_1.NAME, method: 'nearby', params: [{ kind: 'greet', k, accept: true }] },
|
|
760
|
+
expiresAt: this.now() + INVITE_MS,
|
|
761
|
+
},
|
|
762
|
+
])
|
|
763
|
+
.catch(() => undefined);
|
|
764
|
+
return true;
|
|
765
|
+
}
|
|
766
|
+
/** Yes: the other's Ta makes a room of the two, joined at once. No: nothing is said; they see no answer. */
|
|
767
|
+
async greet(k, accept) {
|
|
768
|
+
const greet = this.greets.get(k);
|
|
769
|
+
if (!greet) {
|
|
770
|
+
throw new Error('It is gone.');
|
|
771
|
+
}
|
|
772
|
+
this.greets.delete(k);
|
|
773
|
+
if (accept) {
|
|
774
|
+
await this.loadIdentity();
|
|
775
|
+
if (!this.identity) {
|
|
776
|
+
throw new Error('Rooms are off.');
|
|
777
|
+
}
|
|
778
|
+
this.greeted.set(k, this.now());
|
|
779
|
+
await this.send(greet.e, { t: 'hello-ok', at: this.now(), k, id: this.identity.id, name: this.identity.name });
|
|
780
|
+
}
|
|
781
|
+
return this.publish(true);
|
|
782
|
+
}
|
|
783
|
+
async defineKind(id, title) {
|
|
784
|
+
if (this.kinds.has(id)) {
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
await this.host.callPackageHost(INITIATIVE, 'defineKind', [{ id, owner: nearby_protocol_1.NAME, title, reversible: false, level: 'ask' }]);
|
|
788
|
+
this.kinds.add(id);
|
|
789
|
+
}
|
|
790
|
+
// Spots.
|
|
791
|
+
async setSpot(action, code) {
|
|
792
|
+
var _a, _b, _c, _d;
|
|
793
|
+
var _e;
|
|
794
|
+
if (action === 'leave') {
|
|
795
|
+
this.leaveSpot();
|
|
796
|
+
return this.publish(true);
|
|
797
|
+
}
|
|
798
|
+
if (!this.visible || !this.keys) {
|
|
799
|
+
throw new Error(server_texts_1.NearbyTexts.spotOff());
|
|
800
|
+
}
|
|
801
|
+
if (action === 'join' && !nearby_spot_1.NearbySpotUtil.valid(code)) {
|
|
802
|
+
throw new Error(server_texts_1.NearbyTexts.spotCode());
|
|
803
|
+
}
|
|
804
|
+
const relay = (_b = (await ((_a = this.host.relays) === null || _a === void 0 ? void 0 : _a.serviceFor('rooms').catch(() => undefined)))) === null || _b === void 0 ? void 0 : _b.url;
|
|
805
|
+
if (!relay) {
|
|
806
|
+
throw new Error(server_texts_1.NearbyTexts.spotRelay());
|
|
807
|
+
}
|
|
808
|
+
this.leaveSpot();
|
|
809
|
+
const spot = new nearby_spot_1.NearbySpot(action === 'open' ? nearby_spot_1.NearbySpotUtil.code() : code, action === 'open', {
|
|
810
|
+
here: beacon => {
|
|
811
|
+
const data = nearby_net_1.NearbyNetUtil.beacon(JSON.stringify(beacon), true);
|
|
812
|
+
if (data && this.spot === spot) {
|
|
813
|
+
this.hear(data, '', spot);
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
gone: e => {
|
|
817
|
+
var _a;
|
|
818
|
+
if (((_a = this.heard.get(e)) === null || _a === void 0 ? void 0 : _a.via) === spot && this.heard.delete(e)) {
|
|
819
|
+
void this.publish();
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
frame: async (from, value) => {
|
|
823
|
+
const frame = NearbyService.frame(value);
|
|
824
|
+
return frame && frame.e === from ? this.receive(frame) : undefined;
|
|
825
|
+
},
|
|
826
|
+
closed: closed => {
|
|
827
|
+
if (this.spot === closed) {
|
|
828
|
+
this.leaveSpot();
|
|
829
|
+
void this.publish(true);
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
});
|
|
833
|
+
try {
|
|
834
|
+
await spot.connect(relay);
|
|
835
|
+
}
|
|
836
|
+
catch (error) {
|
|
837
|
+
throw new Error(error instanceof nearby_spot_1.NearbySpotError ? server_texts_1.NearbyTexts.spotRefused(error.message) : server_texts_1.NearbyTexts.spotRelay());
|
|
838
|
+
}
|
|
839
|
+
this.spot = spot;
|
|
840
|
+
this.announceSpot(spot);
|
|
841
|
+
this.spotTimer = setInterval(() => this.announceSpot(spot), (_e = this.options.intervalMs) !== null && _e !== void 0 ? _e : 3000);
|
|
842
|
+
(_d = (_c = this.spotTimer).unref) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
843
|
+
return this.publish(true);
|
|
844
|
+
}
|
|
845
|
+
/** This one's beacon in a spot: no port nor address, the relay passes what is sealed. */
|
|
846
|
+
announceSpot(spot) {
|
|
847
|
+
if (this.keys && this.channel) {
|
|
848
|
+
spot.here({ ...this.beaconData(this.channel.port), p: 0, a: [] });
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
leaveSpot() {
|
|
852
|
+
const spot = this.spot;
|
|
853
|
+
if (!spot) {
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
this.spot = undefined;
|
|
857
|
+
clearInterval(this.spotTimer);
|
|
858
|
+
spot.close();
|
|
859
|
+
for (const [e, heard] of this.heard) {
|
|
860
|
+
if (heard.via === spot) {
|
|
861
|
+
this.heard.delete(e);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
/** A frame of the channel as a spot passed it, checked. */
|
|
866
|
+
static frame(value) {
|
|
867
|
+
const frame = value;
|
|
868
|
+
return frame &&
|
|
869
|
+
frame.v === 1 &&
|
|
870
|
+
[frame.e, frame.x, frame.to, frame.i, frame.c].every(part => typeof part === 'string' && part.length > 0 && part.length < 2000000)
|
|
871
|
+
? frame
|
|
872
|
+
: undefined;
|
|
873
|
+
}
|
|
874
|
+
// Rooms.
|
|
875
|
+
async makeRoom(people, title, why, meet) {
|
|
876
|
+
if (!this.visible) {
|
|
877
|
+
throw new Error('Nearby is off.');
|
|
878
|
+
}
|
|
879
|
+
const chosen = [...this.heard.values()].filter(heard => !(people === null || people === void 0 ? void 0 : people.length) || people.includes(heard.data.e));
|
|
880
|
+
if (!chosen.length) {
|
|
881
|
+
throw new Error('Nobody is nearby.');
|
|
882
|
+
}
|
|
883
|
+
const name = (title === null || title === void 0 ? void 0 : title.trim().slice(0, 80)) || server_texts_1.NearbyTexts.roomTitle(new Date(this.now()));
|
|
884
|
+
const room = await this.host.rooms.createRoom({ kind: ROOMS_KIND, title: name });
|
|
885
|
+
const { link } = await this.host.rooms.invite(room.id, { days: 1 });
|
|
886
|
+
this.madeAt = this.now();
|
|
887
|
+
const invited = [];
|
|
888
|
+
const missed = [];
|
|
889
|
+
await Promise.all(chosen.map(async (heard) => {
|
|
890
|
+
const k = (0, node_crypto_1.randomBytes)(12).toString('base64url');
|
|
891
|
+
const who = server_texts_1.NearbyTexts.who({ name: heard.data.n, friend: heard.friend });
|
|
892
|
+
this.sent.set(k, {
|
|
893
|
+
room: room.id,
|
|
894
|
+
e: heard.data.e,
|
|
895
|
+
name: who,
|
|
896
|
+
...(heard.friend ? { friend: heard.friend.id } : {}),
|
|
897
|
+
...(meet ? { meet } : {}),
|
|
898
|
+
at: this.now(),
|
|
899
|
+
});
|
|
900
|
+
try {
|
|
901
|
+
const answer = (await this.send(heard.data.e, {
|
|
902
|
+
t: 'invite',
|
|
903
|
+
at: this.now(),
|
|
904
|
+
k,
|
|
905
|
+
title: name,
|
|
906
|
+
link,
|
|
907
|
+
...(why ? { why } : {}),
|
|
908
|
+
...(meet ? { meet } : {}),
|
|
909
|
+
}));
|
|
910
|
+
((answer === null || answer === void 0 ? void 0 : answer.ok) ? invited : missed).push(who);
|
|
911
|
+
}
|
|
912
|
+
catch (_a) {
|
|
913
|
+
this.sent.delete(k);
|
|
914
|
+
missed.push(who);
|
|
915
|
+
}
|
|
916
|
+
}));
|
|
917
|
+
return { room: room.id, title: name, invited, missed };
|
|
918
|
+
}
|
|
919
|
+
async answer(k, accept) {
|
|
920
|
+
const invite = this.received.get(k);
|
|
921
|
+
if (!invite) {
|
|
922
|
+
throw new Error('The invitation is gone.');
|
|
923
|
+
}
|
|
924
|
+
this.received.delete(k);
|
|
925
|
+
await this.publish(true);
|
|
926
|
+
if (!accept) {
|
|
927
|
+
await this.send(invite.e, { t: 'decline', at: this.now(), k }).catch(() => undefined);
|
|
928
|
+
return this.status();
|
|
929
|
+
}
|
|
930
|
+
await this.loadIdentity();
|
|
931
|
+
if (!this.identity) {
|
|
932
|
+
throw new Error('Rooms are off.');
|
|
933
|
+
}
|
|
934
|
+
// Said first, so that the owner's Ta knows who asks as the asking comes.
|
|
935
|
+
await this.send(invite.e, { t: 'accept', at: this.now(), k, id: this.identity.id, name: this.identity.name }).catch(() => undefined);
|
|
936
|
+
await this.host.rooms.join(invite.link);
|
|
937
|
+
return this.status();
|
|
938
|
+
}
|
|
939
|
+
roomEvent(event) {
|
|
940
|
+
if (event.type === 'request') {
|
|
941
|
+
void this.admit(event.request.room, event.request.ask, event.request.id);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
async admitWaiting(room) {
|
|
945
|
+
const requests = await this.host.rooms.listRequests().catch(() => []);
|
|
946
|
+
for (const request of requests) {
|
|
947
|
+
if (request.room === room) {
|
|
948
|
+
await this.admit(room, request.ask, request.id);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Lets in one who asks to join a room made of those nearby, when it is one the user invited and that said yes: the
|
|
954
|
+
* user chose them. A friend only as the identity its mark showed; anyone else is asked of the user, as always.
|
|
955
|
+
*/
|
|
956
|
+
async admit(room, ask, id) {
|
|
957
|
+
const sent = [...this.sent.values()].find(one => { var _a; return one.room === room && ((_a = one.accepted) === null || _a === void 0 ? void 0 : _a.id) === id && (!one.friend || one.friend === id) && !one.declined; });
|
|
958
|
+
if (!sent) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
sent.declined = true;
|
|
962
|
+
await this.host.rooms.answer(room, ask, true).catch(() => {
|
|
963
|
+
sent.declined = false;
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
// Proposals.
|
|
967
|
+
/** Two or more around for a while: a room of them, proposed (ta-initiative), never made unasked. */
|
|
968
|
+
async propose() {
|
|
969
|
+
const now = this.now();
|
|
970
|
+
if (!this.visible || now - this.proposedAt < PROPOSE_GAP_MS || now - this.madeAt < PROPOSE_GAP_MS) {
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
const stayed = [...this.heard.values()].filter(heard => now - heard.since >= GATHER_MS);
|
|
974
|
+
if (stayed.length < 2) {
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
this.proposedAt = now;
|
|
978
|
+
if (!this.defined) {
|
|
979
|
+
await this.host.callPackageHost(INITIATIVE, 'defineKind', [
|
|
980
|
+
{ id: exports.ROOM_KIND, owner: nearby_protocol_1.NAME, title: server_texts_1.NearbyTexts.kindTitle(), reversible: false, level: 'ask' },
|
|
981
|
+
]);
|
|
982
|
+
this.defined = true;
|
|
983
|
+
}
|
|
984
|
+
const names = stayed.map(heard => server_texts_1.NearbyTexts.who({ name: heard.data.n, friend: heard.friend }));
|
|
985
|
+
await this.host.callPackageHost(INITIATIVE, 'offer', [
|
|
986
|
+
{
|
|
987
|
+
kind: exports.ROOM_KIND,
|
|
988
|
+
title: server_texts_1.NearbyTexts.proposeTitle(stayed.length),
|
|
989
|
+
why: server_texts_1.NearbyTexts.proposeWhy(names),
|
|
990
|
+
key: `${exports.ROOM_KIND}:${Math.floor(now / PROPOSE_GAP_MS)}`,
|
|
991
|
+
action: { type: 'call', package: nearby_protocol_1.NAME, method: 'nearby', params: [{ kind: 'room' }] },
|
|
992
|
+
expiresAt: now + 60 * 60000,
|
|
993
|
+
},
|
|
994
|
+
]);
|
|
995
|
+
}
|
|
996
|
+
// Data.
|
|
997
|
+
async read(key) {
|
|
998
|
+
return this.host.getExtensionData(nearby_protocol_1.NAME, key).catch(() => undefined);
|
|
999
|
+
}
|
|
1000
|
+
/** The status for the pages, when it changed (or `force`). */
|
|
1001
|
+
async publish(force = false) {
|
|
1002
|
+
const status = this.status();
|
|
1003
|
+
const text = JSON.stringify(status);
|
|
1004
|
+
if (force || text !== this.published) {
|
|
1005
|
+
this.published = text;
|
|
1006
|
+
await this.host.setExtensionData(nearby_protocol_1.NAME, nearby_protocol_1.NearbyKeys.STATUS, status).catch(() => undefined);
|
|
1007
|
+
}
|
|
1008
|
+
return status;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
exports.NearbyService = NearbyService;
|
|
1012
|
+
//# sourceMappingURL=nearby-service.js.map
|