@celljs/ta 4.11.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/dist/cli.mjs +1006 -164
- package/dist/gateway.mjs +161 -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 +266 -25
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +7 -2
- package/dist/pi/packages/ta-agents/lib/acp-protocol.js +5 -2
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +8 -3
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +12 -4
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +72 -2
- package/dist/pi/packages/ta-agents/lib/agent-session.js +183 -18
- package/dist/pi/packages/ta-agents/lib/agent-streamer.js +16 -2
- package/dist/pi/packages/ta-agents/lib/agent-tool.d.ts +2 -0
- package/dist/pi/packages/ta-agents/lib/agent-tool.js +45 -4
- package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +17 -1
- package/dist/pi/packages/ta-agents/lib/agent-turn.js +51 -3
- package/dist/pi/packages/ta-agents/lib/extension.js +7 -0
- package/dist/pi/packages/ta-agents/lib/texts.d.ts +12 -0
- package/dist/pi/packages/ta-agents/lib/texts.js +12 -0
- package/dist/pi/packages/ta-agents/package.json +1 -1
- package/dist/pi/packages/ta-bots/extension/index.mjs +51 -0
- package/dist/pi/packages/ta-bots/host/index.mjs +157 -0
- package/dist/pi/packages/ta-bots/package.json +7 -2
- package/dist/pi/packages/ta-changes/extension/index.mjs +51 -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 +55 -2
- package/dist/pi/packages/ta-channels/host/index.mjs +268 -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/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/sidebar.js +31 -13
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +10 -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/lib/views.d.ts +12 -0
- package/dist/pi/packages/ta-channels/lib/views.js +19 -0
- package/dist/pi/packages/ta-channels/package.json +26 -2
- package/dist/pi/packages/ta-channels/web/index.js +191 -36
- 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 +91 -257
- 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 +11 -7
- 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 +16 -11
- package/dist/pi/packages/ta-extensions/web/index.js +176 -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 +425 -3
- package/dist/pi/packages/ta-glance/lib/card.js +42 -15
- 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 +7 -1
- package/dist/pi/packages/ta-glance/lib/glance-spec.js +45 -9
- 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 +187 -102
- package/dist/pi/packages/ta-glance/package.json +1 -1
- package/dist/pi/packages/ta-glance/web/index.js +272 -124
- 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 +720 -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 +238 -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.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-c.js +160 -0
- package/dist/pi/packages/ta-manual/lib/pictures.js +2 -1
- package/dist/pi/packages/ta-manual/lib/topics.d.ts +5 -0
- package/dist/pi/packages/ta-manual/lib/topics.js +155 -9
- package/dist/pi/packages/ta-manual/package.json +1 -1
- package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +54 -8
- package/dist/pi/packages/ta-manual/web/index.js +750 -10
- 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 +1766 -0
- package/dist/pi/packages/ta-moments/host/index.mjs +2394 -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 +1987 -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 +389 -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 +64 -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 +291 -134
- package/dist/pi/packages/ta-recall/host/index.mjs +451 -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/conversations.js +6 -0
- 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 +35 -26
- 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 +397 -153
- package/dist/pi/packages/ta-rooms/README.en.md +14 -5
- package/dist/pi/packages/ta-rooms/README.md +14 -5
- package/dist/pi/packages/ta-rooms/extension/index.mjs +526 -0
- package/dist/pi/packages/ta-rooms/host/index.mjs +1734 -0
- package/dist/pi/packages/ta-rooms/lib/agents-view.d.ts +25 -0
- package/dist/pi/packages/ta-rooms/lib/agents-view.js +128 -0
- 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 +117 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.js +476 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.d.ts +105 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.js +212 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.d.ts +258 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.js +128 -0
- 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 +131 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.js +238 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.d.ts +48 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.js +151 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.d.ts +34 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.js +228 -0
- package/dist/pi/packages/ta-rooms/lib/extension.d.ts +33 -0
- package/dist/pi/packages/ta-rooms/lib/extension.js +203 -0
- 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 +8 -0
- package/dist/pi/packages/ta-rooms/lib/host.js +25 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +27 -2
- package/dist/pi/packages/ta-rooms/lib/i18n.js +68 -18
- package/dist/pi/packages/ta-rooms/lib/index.js +41 -3
- package/dist/pi/packages/ta-rooms/lib/members-view.js +44 -3
- package/dist/pi/packages/ta-rooms/lib/page.d.ts +97 -10
- package/dist/pi/packages/ta-rooms/lib/page.js +223 -45
- package/dist/pi/packages/ta-rooms/lib/room-view.d.ts +2 -4
- package/dist/pi/packages/ta-rooms/lib/room-view.js +57 -35
- package/dist/pi/packages/ta-rooms/lib/rooms-home.d.ts +32 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-home.js +141 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-page.d.ts +8 -2
- package/dist/pi/packages/ta-rooms/lib/rooms-page.js +68 -36
- package/dist/pi/packages/ta-rooms/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-rooms/lib/style.js +126 -50
- 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 +19 -4
- package/dist/pi/packages/ta-rooms/web/index.js +2585 -470
- 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 +51 -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/shares-page.js +35 -11
- package/dist/pi/packages/ta-share/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-share/lib/style.js +14 -10
- package/dist/pi/packages/ta-share/package.json +10 -2
- package/dist/pi/packages/ta-share/web/index.js +56 -31
- 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 +264 -0
- package/dist/pi/packages/ta-team/host/index.mjs +2100 -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 +157 -0
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-D9uU0Tx2.js → abnfDiagram-S7VZAUFO-DJMZKA5d.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-f7Nm7EIo.js → architecture-WOLXFQ4H-DwZ8A2Bp.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW-DSAqlcms.js → architectureDiagram-YGSQEFNW-DPezb7-w.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-C0lPIW9g.js → blockDiagram-APKKGZFW-SrFYBlSp.js} +1 -1
- package/dist/public/assets/{browser-WLpgVYno.js → browser-CljOqDFz.js} +1 -1
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-CDcZ7mJq.js → c4Diagram-KJ2TOQU5-COCMkiJ6.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-CXPuyqPL.js → chunk-6MUBBAK2-CWRxZCiu.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-Du6JRX1x.js → chunk-AXFCVDMN-Dgn3RHlx.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-D592E55X.js → chunk-BG4553SI-BDnAChfb.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-BW2r2SL4.js → chunk-DQASFODM-DSgprMfc.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-C3yoe54R.js → chunk-HFQBQIA3-ChtjyKjP.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-DF8gfYCy.js → chunk-KQLB2F66-B2o0ufJC.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-C8CRMTv1.js → chunk-KS47KZWR-C4qJvDaX.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-BDcMKiwj.js → chunk-LEVMRMFU-2jTGUstS.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-CKJPBygc.js → chunk-M57EVK23-CKAWW7fj.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-B3ZWH07L.js → chunk-OY52VR5R-B5TUKZAt.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-DI-z4UPL.js → chunk-QB3YPZ4I-CyQFTqwG.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-Bg4-haAc.js → chunk-R3KSYZAL-C6git_yh.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-l_SHib3p.js → chunk-STOXU5M4-AwEqcNnS.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-BINu9tIm.js → chunk-TU62E6Q5-GKcRDmvw.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-BQn-mvV5.js → chunk-X4PVCEUW-CMG5EfZ9.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-uvpAu0Ys.js → chunk-XXDRQBXY-BHd-dKtZ.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-BIowooW1.js → classDiagram-v2-L25IHNXF-HaRsBCG9.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-BTyx1Mh2.js → cose-bilkent-JH36ORCC-BPBTCfj3.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-DyqqRII3.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-D64EU9I0.js → cynefinDiagram-L36ESFBY-dAmWDtva.js} +1 -1
- package/dist/public/assets/{d3-selection-CN9k6_B9.js → d3-selection-BhemR5ul.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-FCbz2-Kk.js → dagre-SPEB5RXH-D93g6hNI.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-OhHUSI7j.js → diagram-3B7GL73J-FJBKgG3X.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-Be4xMtp6.js → diagram-DNEMPZML-BP22T976.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-CmKSs3aG.js → diagram-L3MUGCDN-DcrCJXRt.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-D1C32rMN.js → diagram-LA4NIPWU-DUgd3PHQ.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-BjoE6JXs.js → diagram-MHCOC4E2-ejTInqzQ.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-B22k4v8R.js → diagram-XPFHEONP-BLjkgho1.js} +1 -1
- package/dist/public/assets/{dist-DcBP8Cf6.js → dist-C9xqTt0E.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-Tn-K8-X7.js → ebnfDiagram-UZSYDL2S-CB1QQ4_T.js} +1 -1
- package/dist/public/assets/{editor.api-Bz4sjRz_.js → editor.api-lz6I1oVk.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-COnQsWlN.js → elk-XV6XMXQE-CLBx1s2b.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-c53dJilq.js → erDiagram-EYBAPDEH-Dsj6RYi5.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-DaFpPPks.js → eventmodeling-K75KTNOO-smOORsSG.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-DFmQPJ7B.js +1 -0
- package/dist/public/assets/{freemarker2-BLxfRHsw.js → freemarker2-DrLPw7Mc.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-Md-SavIS.js → ganttDiagram-23REXITY-BV9WK0rK.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-ybrJCK6u.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-CMSwTghO.js → gitGraphDiagram-STJD7YCW-CsSpSQ0T.js} +1 -1
- package/dist/public/assets/{handlebars-sNpu01kP.js → handlebars-CLx5-csF.js} +1 -1
- package/dist/public/assets/{html-C_tKd-uP.js → html-C9LmGm46.js} +1 -1
- package/dist/public/assets/{index-Bn86rI4n.js → index-CLWW0mVu.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-n41_wZE4.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-CwgNj-7i.js → infoDiagram-KBXO4MBG-wm5AnXDz.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-BSlzQNMN.js → ishikawaDiagram-M35NCXHK-BLUBDeS3.js} +1 -1
- package/dist/public/assets/{javascript-l3qKw0L-.js → javascript-C4S1eQb7.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-B09LPEnF.js → journeyDiagram-OPLOXDXO-DXc7-I_g.js} +1 -1
- package/dist/public/assets/{jsonMode-5SQQn1EX.js → jsonMode-lLJKR2M6.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-BiW4aJ29.js → kanban-definition-BZKZHSQY-D5Ra4L_5.js} +1 -1
- package/dist/public/assets/{liquid-BGyTIIUt.js → liquid-DRlm-XZd.js} +1 -1
- package/dist/public/assets/{mdx-8tGjz4em.js → mdx-CzIqeqPy.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-CctN5b0z.js → mermaid-parser.core-BIPB1BgS.js} +3 -3
- package/dist/public/assets/{mermaid.core-7ERSdZ4-.js → mermaid.core-DxBlQ6oF.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-D-GOUwW1.js → mindmap-definition-I2QAS2VK-BdupvuYr.js} +1 -1
- package/dist/public/assets/module-BPxWyxwR.js +2362 -0
- package/dist/public/assets/module-C_MSCGQC.js +1 -0
- package/dist/public/assets/{monaco-B_9hlk78.js → monaco-ChpJIYsY.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-BjrqMgis.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-Dmy1fWB3.js → pegDiagram-FD4XPPHP-C_GF7Fng.js} +1 -1
- package/dist/public/assets/pie-XZMESJXO-CJSA88kr.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-CXFHLYTg.js → pieDiagram-J4AKIIQI-WlpNP-IM.js} +1 -1
- package/dist/public/assets/{python-e-JK0s5M.js → python-BJgFCfc8.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-RQvEpGWO.js → quadrantDiagram-XTYBLID2-CkCL5rJY.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-4nLUXAkG.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-BD2LqZSr.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-CDOSPZwX.js → railroad-abnf-LNEFI6M7-DZZKUytl.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-BTrNQ0DX.js → railroad-ebnf-DWYD2UWJ-CS7KsJdb.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-B7NtVofS.js → railroad-peg-JR7BVNR7-CiukTZVd.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-DsDrT0Jf.js → railroadDiagram-MRQ6NCDL-BS0R_H3-.js} +1 -1
- package/dist/public/assets/{razor-DtSPwumi.js → razor-jcBIjr45.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-BQh0hFuA.js → requirementDiagram-Y7LWUY3S-C0_T9jgl.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-BUXNAQEF.js → sankeyDiagram-WGJFYUXA-DF15sUfS.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-05f-N5V_.js → sequenceDiagram-5NDRBG5M-7AkTLleX.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-D6V1fGWV.js → stateDiagram-v2-FJ4FJNEA-CU3i-U9q.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-DWhlPvKs.js → swimlanes-UMQ2AFYF-CR-ieLeo.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-COK2pFDF.js +8 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-CMdocOui.js → timeline-definition-SEUHKTQE-DeM0Uekm.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-BL13z_2J.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-Lx2qjQpO.js +1 -0
- package/dist/public/assets/{typescript-65jNyipU.js → typescript-B7zp7QPf.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-BQTHUX1f.js → usecaseDiagram-AFA6YXN4-D6rDIgdU.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-BULkVTfA.js → vennDiagram-NNMJR3RB-CncVDcMl.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-B4j5rilS.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-Cek6l8lz.js → wardleyDiagram-S7YFUSEH-DKPAMfTE.js} +1 -1
- package/dist/public/assets/{xml-DWBejfu-.js → xml-BJIgLD52.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-ujnZQTWA.js → xychartDiagram-GGNKY7IX-DmmXGebm.js} +1 -1
- package/dist/public/assets/{yaml-CwRCT7q1.js → yaml-Dxb2gmP5.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/serve/index.mjs +7767 -3392
- 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-Dg54eFzZ.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-V5qkYWIO.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-1q8ldRXU.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-Crere6sx.js +0 -1
- package/dist/public/assets/module-DEqsdd00.js +0 -1
- package/dist/public/assets/module-TWc52XwT.js +0 -2244
- package/dist/public/assets/packet-JDAUHWVQ-qMf5LkHT.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-BjqLn4qm.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-DWO6t_4C.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-D1XOJPWy.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-CRn5uHsY.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-D09wHNzT.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-ChxAT7Fq.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-DfSjKzbJ.js +0 -1
|
@@ -0,0 +1,821 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MomentsHost = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const promises_1 = require("node:fs/promises");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const package_protocol_1 = require("@celljs/ta-protocol/lib/common/package-protocol");
|
|
8
|
+
const ta_extension_host_1 = require("@celljs/ta-protocol/lib/common/ta-extension-host");
|
|
9
|
+
const relay_protocol_1 = require("@celljs/ta-relay/lib/common/relay-protocol");
|
|
10
|
+
const brief_util_1 = require("./brief-util");
|
|
11
|
+
const moments_protocol_1 = require("./moments-protocol");
|
|
12
|
+
const post_util_1 = require("./post-util");
|
|
13
|
+
const server_texts_1 = require("./server-texts");
|
|
14
|
+
const talk_host_1 = require("./talk-host");
|
|
15
|
+
const talk_util_1 = require("./talk-util");
|
|
16
|
+
const NOTIFY = '@celljs/ta-notify';
|
|
17
|
+
const INITIATIVE = '@celljs/ta-initiative';
|
|
18
|
+
/** Offering to post what the user made is a kind of initiative; a post others saw cannot be taken back, so it only asks. */
|
|
19
|
+
const KIND_OF_POST = {
|
|
20
|
+
id: moments_protocol_1.POST_KIND,
|
|
21
|
+
owner: moments_protocol_1.NAME,
|
|
22
|
+
title: { en: 'Offer to post what you made to Moments', zh: '提议把做出来的东西发到动态' },
|
|
23
|
+
reversible: false,
|
|
24
|
+
level: 'ask',
|
|
25
|
+
};
|
|
26
|
+
const DAY_MS = 86400000;
|
|
27
|
+
const SWEEP_MS = 60 * 60 * 1000;
|
|
28
|
+
const SETTLE_MS = 400;
|
|
29
|
+
const DRAFT_DAYS = 7;
|
|
30
|
+
/** What the relay generates for a room: the name of a directory of its pictures here. */
|
|
31
|
+
const ROOM_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
32
|
+
/** Parts of a picture coming that stopped coming are let go of. */
|
|
33
|
+
const INCOMING_MS = 5 * 60000;
|
|
34
|
+
/** Packs a directory as a .tgz, its directory at the top, without what is installed or of Git. */
|
|
35
|
+
function pack(root) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
(0, node_child_process_1.execFile)('tar', ['-czf', '-', '--exclude=node_modules', '--exclude=.git', '-C', (0, node_path_1.dirname)(root), (0, node_path_1.basename)(root)], { encoding: 'buffer', maxBuffer: 16 * 1024 * 1024 }, (error, stdout) => (error ? reject(error) : resolve(new Uint8Array(stdout))));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function record(value) {
|
|
41
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
42
|
+
}
|
|
43
|
+
function strings(value) {
|
|
44
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === 'string') : [];
|
|
45
|
+
}
|
|
46
|
+
/** A source to take a package from without this computer: a registry or a repository. */
|
|
47
|
+
function published(source) {
|
|
48
|
+
return /^(npm:|git:|git\+|https?:\/\/|github:)/.test(source);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The host of Moments in the Ta service (docs/design/ta-moments.md): the only writer of the posts in this Ta's room of
|
|
52
|
+
* friends (TaRooms.friendRoom; the friends are Ta's, docs/design/ta-link.md 3.1). The room is a directory on the relay (words, thumbnails, what a post holds);
|
|
53
|
+
* the pictures stay here (`ta-moments/posts/`), and those of friends' posts are kept here once their author's Ta sent
|
|
54
|
+
* them (`ta-moments/cache/`), each deleted as its post goes (docs/design/ta-moments.md 9).
|
|
55
|
+
*/
|
|
56
|
+
class MomentsHost {
|
|
57
|
+
constructor(host, now = Date.now) {
|
|
58
|
+
this.host = host;
|
|
59
|
+
this.now = now;
|
|
60
|
+
this.queue = Promise.resolve();
|
|
61
|
+
this.timers = [];
|
|
62
|
+
this.defined = false;
|
|
63
|
+
/** Pictures asked of their author, by `room:post:index`: when. */
|
|
64
|
+
this.asked = new Map();
|
|
65
|
+
/** Parts of pictures coming from their author, by `room:post:index`. */
|
|
66
|
+
this.incoming = new Map();
|
|
67
|
+
/** Pictures sent to friends, one after another, paced for the relay. */
|
|
68
|
+
this.serving = Promise.resolve();
|
|
69
|
+
/** Between the parts sent: the relay takes 40 messages a second of a connection. */
|
|
70
|
+
this.pace = 60;
|
|
71
|
+
this.talk = new talk_host_1.MomentsTalk(host, { post: id => this.postDir(id), cache: (room, id) => this.cacheDir(room, id) }, () => this.changed(), now);
|
|
72
|
+
}
|
|
73
|
+
start() {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
this.listen();
|
|
76
|
+
const first = setTimeout(() => {
|
|
77
|
+
this.fetchSoon();
|
|
78
|
+
// Knows from now on who liked what: told only of who comes after.
|
|
79
|
+
this.tellSoon();
|
|
80
|
+
void this.sweep();
|
|
81
|
+
}, 3000);
|
|
82
|
+
const every = setInterval(() => void this.sweep(), SWEEP_MS);
|
|
83
|
+
(_a = first.unref) === null || _a === void 0 ? void 0 : _a.call(first);
|
|
84
|
+
(_b = every.unref) === null || _b === void 0 ? void 0 : _b.call(every);
|
|
85
|
+
this.timers.push(first, every);
|
|
86
|
+
}
|
|
87
|
+
/** What happens in the rooms: friends coming and going, posts changing, pictures asked for and coming. */
|
|
88
|
+
listen() {
|
|
89
|
+
this.stopEvents = this.host.rooms.onEvent(event => {
|
|
90
|
+
if (event.type === 'rooms' || event.type === 'friend') {
|
|
91
|
+
// A friend's computer came online, or a friend came or went: what is not here yet comes now.
|
|
92
|
+
this.fetchSoon();
|
|
93
|
+
this.changed();
|
|
94
|
+
}
|
|
95
|
+
else if (event.type === 'message') {
|
|
96
|
+
void this.heard(event).catch(error => console.error('ta-moments:', error));
|
|
97
|
+
}
|
|
98
|
+
else if (event.type === 'state' && /^(post|like|took):/.test(event.key)) {
|
|
99
|
+
if (/^(like|took):/.test(event.key)) {
|
|
100
|
+
this.tellSoon();
|
|
101
|
+
}
|
|
102
|
+
if (event.key.startsWith(moments_protocol_1.StateKeys.POST)) {
|
|
103
|
+
void this.postChanged(event.room, event.key.slice(moments_protocol_1.StateKeys.POST.length), event.value);
|
|
104
|
+
}
|
|
105
|
+
this.changed();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
dispose() {
|
|
110
|
+
var _a;
|
|
111
|
+
(_a = this.stopEvents) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
112
|
+
for (const timer of [...this.timers, this.settle, this.bump, this.fetching, this.telling]) {
|
|
113
|
+
clearTimeout(timer);
|
|
114
|
+
clearInterval(timer);
|
|
115
|
+
}
|
|
116
|
+
this.timers = [];
|
|
117
|
+
}
|
|
118
|
+
async state() {
|
|
119
|
+
var _a;
|
|
120
|
+
const [me, rooms, friendList, requests] = await Promise.all([
|
|
121
|
+
this.host.rooms.getIdentity(),
|
|
122
|
+
this.host.rooms.listRooms(),
|
|
123
|
+
this.host.rooms.listFriends().catch(() => []),
|
|
124
|
+
this.host.rooms.listFriendRequests().catch(() => []),
|
|
125
|
+
]);
|
|
126
|
+
const mine = this.mine(rooms);
|
|
127
|
+
const friends = friendList.filter(friend => friend.status === 'friend');
|
|
128
|
+
const friendIds = new Set(friends.map(friend => friend.id));
|
|
129
|
+
const followed = rooms.filter(room => !room.owner && room.kind === moments_protocol_1.KIND && room.status === 'member');
|
|
130
|
+
const now = this.now();
|
|
131
|
+
const picked = record(await this.read(moments_protocol_1.Keys.PICKED));
|
|
132
|
+
const posts = [];
|
|
133
|
+
for (const room of [...(mine ? [mine] : []), ...followed]) {
|
|
134
|
+
const state = await this.posts(room.id);
|
|
135
|
+
for (const post of post_util_1.PostUtil.feed({ room, state, me: me.id, friends: friendIds, now })) {
|
|
136
|
+
const why = (_a = picked[`${room.id}:${post.id}`]) === null || _a === void 0 ? void 0 : _a.why;
|
|
137
|
+
const talk = await this.talk.views(room, post.id, me);
|
|
138
|
+
posts.push({ ...post, talk, ...(typeof why === 'string' && why ? { why } : {}) });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
me,
|
|
143
|
+
friends: friends.map(({ id, name }) => ({ id, name })),
|
|
144
|
+
asking: requests.length,
|
|
145
|
+
posts: posts.sort((a, b) => b.at - a.at),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
async images(room, post) {
|
|
149
|
+
var _a;
|
|
150
|
+
const info = (await this.host.rooms.listRooms()).find(item => item.id === room);
|
|
151
|
+
const owner = info === null || info === void 0 ? void 0 : info.members.find(member => member.owner);
|
|
152
|
+
if (!info || !owner || !post_util_1.PostUtil.isId(post)) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
const value = (await this.host.rooms.getState(room, `${moments_protocol_1.StateKeys.POST}${post}`))[`${moments_protocol_1.StateKeys.POST}${post}`];
|
|
156
|
+
const checked = (value === null || value === void 0 ? void 0 : value.by) === owner.member ? post_util_1.PostUtil.check(value.value) : undefined;
|
|
157
|
+
if (!checked) {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
const dir = info.owner ? this.postDir(post) : this.cacheDir(room, post);
|
|
161
|
+
const found = await Promise.all(((_a = checked.images) !== null && _a !== void 0 ? _a : []).map((_, index) => this.readPicture(dir, index)));
|
|
162
|
+
if (!info.owner) {
|
|
163
|
+
await this.want(info, post, found.flatMap((data, index) => (data ? [] : [index])));
|
|
164
|
+
}
|
|
165
|
+
return found;
|
|
166
|
+
}
|
|
167
|
+
publish(input) {
|
|
168
|
+
return this.serial(async () => {
|
|
169
|
+
const text = typeof (input === null || input === void 0 ? void 0 : input.text) === 'string' ? input.text.trim().slice(0, moments_protocol_1.Limits.TEXT) : '';
|
|
170
|
+
const images = (Array.isArray(input === null || input === void 0 ? void 0 : input.images) ? input.images : [])
|
|
171
|
+
.slice(0, moments_protocol_1.Limits.IMAGES)
|
|
172
|
+
.filter(image => post_util_1.PostUtil.isPicture(image === null || image === void 0 ? void 0 : image.data) &&
|
|
173
|
+
post_util_1.PostUtil.isPicture(image.thumb, moments_protocol_1.Limits.THUMB_CHARS) &&
|
|
174
|
+
Number.isInteger(image.w) &&
|
|
175
|
+
Number.isInteger(image.h) &&
|
|
176
|
+
image.w > 0 &&
|
|
177
|
+
image.h > 0);
|
|
178
|
+
const id = post_util_1.PostUtil.newId();
|
|
179
|
+
const attach = (input === null || input === void 0 ? void 0 : input.attach) ? await this.attach(input.attach, id) : undefined;
|
|
180
|
+
if (!text && !images.length && !attach) {
|
|
181
|
+
throw new Error(server_texts_1.MomentsServerTexts.zh() ? '写点什么再发' : 'Write something first');
|
|
182
|
+
}
|
|
183
|
+
const days = moments_protocol_1.Limits.DAYS.includes(input.days) ? input.days : moments_protocol_1.Limits.DEFAULT_DAYS;
|
|
184
|
+
const now = this.now();
|
|
185
|
+
const room = await this.host.rooms.friendRoom();
|
|
186
|
+
const post = {
|
|
187
|
+
v: 1,
|
|
188
|
+
at: now,
|
|
189
|
+
...(days ? { until: now + days * DAY_MS } : {}),
|
|
190
|
+
text,
|
|
191
|
+
...(images.length ? { images: images.map(image => ({ w: image.w, h: image.h, thumb: image.thumb })) } : {}),
|
|
192
|
+
...(attach ? { attach } : {}),
|
|
193
|
+
...(input.ask ? { ask: true } : {}),
|
|
194
|
+
};
|
|
195
|
+
// How it was made, for the double's answers: on this computer alone.
|
|
196
|
+
const notes = input.ask ? await this.notes(input) : '';
|
|
197
|
+
if (notes) {
|
|
198
|
+
await (0, promises_1.mkdir)(this.postDir(id), { recursive: true });
|
|
199
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(this.postDir(id), 'notes.txt'), notes);
|
|
200
|
+
}
|
|
201
|
+
// The pictures stay on this computer; the room has the directory only.
|
|
202
|
+
for (const [index, image] of images.entries()) {
|
|
203
|
+
await this.writePicture(this.postDir(id), index, image.data);
|
|
204
|
+
}
|
|
205
|
+
await this.room(room.id, async () => {
|
|
206
|
+
await this.host.rooms.setState(room.id, `${moments_protocol_1.StateKeys.POST}${id}`, post);
|
|
207
|
+
});
|
|
208
|
+
await this.trim(room.id);
|
|
209
|
+
if (typeof input.key === 'string' && input.key) {
|
|
210
|
+
await this.decide(input.key, { posted: id });
|
|
211
|
+
await this.initiative('record', { kind: moments_protocol_1.POST_KIND, title: text.slice(0, 120) || (attach === null || attach === void 0 ? void 0 : attach.title) || id, why: '', outcome: 'accepted' });
|
|
212
|
+
}
|
|
213
|
+
this.changed();
|
|
214
|
+
return id;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
remove(post) {
|
|
218
|
+
return this.serial(async () => {
|
|
219
|
+
const room = this.mine(await this.host.rooms.listRooms());
|
|
220
|
+
if (room && post_util_1.PostUtil.isId(post)) {
|
|
221
|
+
await this.drop(room.id, post);
|
|
222
|
+
this.changed();
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
async say(room, post, text, options) {
|
|
227
|
+
await this.talk.say(await this.roomOf(room), post, text, options !== null && options !== void 0 ? options : {});
|
|
228
|
+
}
|
|
229
|
+
async unsay(room, post, id) {
|
|
230
|
+
await this.talk.unsay(await this.roomOf(room), post, id);
|
|
231
|
+
}
|
|
232
|
+
answering(sessionFile) {
|
|
233
|
+
return this.talk.answers(typeof sessionFile === 'string' ? sessionFile : undefined);
|
|
234
|
+
}
|
|
235
|
+
/** A room of posts the user is in. */
|
|
236
|
+
async roomOf(id) {
|
|
237
|
+
const room = (await this.host.rooms.listRooms()).find(item => item.id === id && item.status === 'member' && item.kind === moments_protocol_1.KIND);
|
|
238
|
+
if (!room) {
|
|
239
|
+
throw new Error(server_texts_1.MomentsServerTexts.notFound());
|
|
240
|
+
}
|
|
241
|
+
return room;
|
|
242
|
+
}
|
|
243
|
+
/** What the double knows of how a post was made: what Ta wrote of it, and the README of the extension it holds. */
|
|
244
|
+
async notes(input) {
|
|
245
|
+
var _a;
|
|
246
|
+
const parts = [typeof input.notes === 'string' ? input.notes.trim() : ''];
|
|
247
|
+
if (((_a = input.attach) === null || _a === void 0 ? void 0 : _a.kind) === 'package') {
|
|
248
|
+
const info = await this.packageOf(input.attach.name);
|
|
249
|
+
const readme = info ? await (0, promises_1.readFile)((0, node_path_1.join)(info.root, 'README.md'), 'utf8').catch(() => '') : '';
|
|
250
|
+
if (readme.trim()) {
|
|
251
|
+
parts.push(`README of the extension:\n${readme.trim()}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return parts.filter(Boolean).join('\n\n').slice(0, moments_protocol_1.Limits.NOTES);
|
|
255
|
+
}
|
|
256
|
+
async like(room, post, on) {
|
|
257
|
+
await this.mark(room, post, moments_protocol_1.StateKeys.LIKE, on);
|
|
258
|
+
}
|
|
259
|
+
async took(room, post) {
|
|
260
|
+
await this.mark(room, post, moments_protocol_1.StateKeys.TOOK, true);
|
|
261
|
+
}
|
|
262
|
+
async take(room, post) {
|
|
263
|
+
var _a;
|
|
264
|
+
var _b;
|
|
265
|
+
const found = (await this.state()).posts.find(item => item.room === room && item.id === post);
|
|
266
|
+
const attach = found === null || found === void 0 ? void 0 : found.attach;
|
|
267
|
+
if (!found || (attach === null || attach === void 0 ? void 0 : attach.kind) !== 'package') {
|
|
268
|
+
throw new Error(server_texts_1.MomentsServerTexts.notFound());
|
|
269
|
+
}
|
|
270
|
+
let file;
|
|
271
|
+
if (attach.link) {
|
|
272
|
+
// Its files come from the author's computer, while it runs Ta.
|
|
273
|
+
if (!found.online) {
|
|
274
|
+
throw new Error(server_texts_1.MomentsServerTexts.offline(found.author.name));
|
|
275
|
+
}
|
|
276
|
+
const content = await this.host.shares.open(attach.link).catch((error) => {
|
|
277
|
+
throw (error === null || error === void 0 ? void 0 : error.reason) === 'offline' ? new Error(server_texts_1.MomentsServerTexts.offline(found.author.name)) : error;
|
|
278
|
+
});
|
|
279
|
+
const dir = (0, node_path_1.join)(this.host.agentDir, 'ta-moments', 'taken');
|
|
280
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
281
|
+
file = (0, node_path_1.join)(dir, `${attach.name.replace(/[^a-z0-9._-]+/gi, '-')}-${post}.tgz`);
|
|
282
|
+
await (0, promises_1.writeFile)(file, content.data);
|
|
283
|
+
}
|
|
284
|
+
else if (!attach.source) {
|
|
285
|
+
throw new Error(server_texts_1.MomentsServerTexts.expired());
|
|
286
|
+
}
|
|
287
|
+
const session = await this.host.openSession({ cwd: (await this.host.getServerInfo()).cwd });
|
|
288
|
+
await this.host.setSessionName(session.sessionId, server_texts_1.MomentsServerTexts.takeTitle(attach.title)).catch(() => undefined);
|
|
289
|
+
await this.host.prompt(session.sessionId, {
|
|
290
|
+
clientMessageId: `ta-moments:take:${post}`,
|
|
291
|
+
message: server_texts_1.MomentsServerTexts.take({
|
|
292
|
+
from: found.author.name,
|
|
293
|
+
title: attach.title,
|
|
294
|
+
summary: attach.summary,
|
|
295
|
+
file,
|
|
296
|
+
source: attach.source,
|
|
297
|
+
agentDir: this.host.agentDir,
|
|
298
|
+
}),
|
|
299
|
+
});
|
|
300
|
+
await this.mark(room, post, moments_protocol_1.StateKeys.TOOK, true).catch(() => undefined);
|
|
301
|
+
const sessionFile = (_b = session.sessionFile) !== null && _b !== void 0 ? _b : (_a = (await this.host.listSessions()).find(info => info.sessionId === session.sessionId)) === null || _a === void 0 ? void 0 : _a.sessionFile;
|
|
302
|
+
return sessionFile ? { sessionFile } : {};
|
|
303
|
+
}
|
|
304
|
+
async draftImage(key, index) {
|
|
305
|
+
const dir = this.draftDir(key);
|
|
306
|
+
if (!dir || !Number.isInteger(index) || index < 0) {
|
|
307
|
+
return undefined;
|
|
308
|
+
}
|
|
309
|
+
const name = (await (0, promises_1.readdir)(dir).catch(() => [])).find(file => file.startsWith(`${index}.`));
|
|
310
|
+
if (!name) {
|
|
311
|
+
return undefined;
|
|
312
|
+
}
|
|
313
|
+
const type = name.slice(name.indexOf('.') + 1).replace('-', '/');
|
|
314
|
+
return `data:${type};base64,${(await (0, promises_1.readFile)((0, node_path_1.join)(dir, name))).toString('base64')}`;
|
|
315
|
+
}
|
|
316
|
+
async stash(key, images) {
|
|
317
|
+
const dir = this.draftDir(key);
|
|
318
|
+
if (!dir) {
|
|
319
|
+
throw new Error('A draft has a key of letters, digits and dashes.');
|
|
320
|
+
}
|
|
321
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
322
|
+
let count = 0;
|
|
323
|
+
for (const image of images.slice(0, moments_protocol_1.Limits.IMAGES)) {
|
|
324
|
+
if (!/^image\/(png|jpeg|gif|webp)$/.test(image.mimeType) || image.data.byteLength > moments_protocol_1.Limits.DRAFT_IMAGE_BYTES) {
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(dir, `${count}.${image.mimeType.replace('/', '-')}`), image.data);
|
|
328
|
+
count++;
|
|
329
|
+
}
|
|
330
|
+
return count;
|
|
331
|
+
}
|
|
332
|
+
decline(key) {
|
|
333
|
+
return this.serial(async () => {
|
|
334
|
+
await this.decide(key, { declined: true });
|
|
335
|
+
await this.initiative('record', { kind: moments_protocol_1.POST_KIND, title: key, why: '', outcome: 'declined' });
|
|
336
|
+
this.changed();
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
async packageTitle(name) {
|
|
340
|
+
const info = typeof name === 'string' ? await this.packageOf(name) : undefined;
|
|
341
|
+
return info && (package_protocol_1.TaPackageTextUtil.pick(info.title, server_texts_1.MomentsServerTexts.zh() ? 'zh-CN' : 'en') || info.name);
|
|
342
|
+
}
|
|
343
|
+
picked(picks) {
|
|
344
|
+
return this.serial(async () => {
|
|
345
|
+
const kept = record(await this.read(moments_protocol_1.Keys.PICKED));
|
|
346
|
+
const now = this.now();
|
|
347
|
+
for (const pick of Array.isArray(picks) ? picks.slice(0, 3) : []) {
|
|
348
|
+
if (pick && typeof pick.room === 'string' && post_util_1.PostUtil.isId(String(pick.post)) && typeof pick.why === 'string') {
|
|
349
|
+
kept[`${pick.room}:${pick.post}`] = { why: pick.why.slice(0, 160), at: now };
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const latest = Object.entries(kept)
|
|
353
|
+
.sort((a, b) => a[1].at - b[1].at)
|
|
354
|
+
.slice(-brief_util_1.PICKS);
|
|
355
|
+
await this.write(moments_protocol_1.Keys.PICKED, Object.fromEntries(latest));
|
|
356
|
+
this.changed();
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
/** What the daily brief of ta-recall is given (TA_BRIEF_SOURCE): friends' latest posts, written when they change. */
|
|
360
|
+
async writeBrief() {
|
|
361
|
+
const rooms = await this.host.rooms.listRooms();
|
|
362
|
+
const relays = new Map(rooms.map(room => { var _a; return [room.id, (_a = room.relay) !== null && _a !== void 0 ? _a : relay_protocol_1.RELAY_DEFAULT_URL]; }));
|
|
363
|
+
const { posts } = await this.state();
|
|
364
|
+
const source = brief_util_1.MomentsBrief.source(posts, room => { var _a; return (_a = relays.get(room)) !== null && _a !== void 0 ? _a : relay_protocol_1.RELAY_DEFAULT_URL; });
|
|
365
|
+
const text = JSON.stringify(source);
|
|
366
|
+
if (text !== this.briefed) {
|
|
367
|
+
this.briefed = text;
|
|
368
|
+
await this.write(ta_extension_host_1.TA_BRIEF_SOURCE, source);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
/** Tells the user who liked or took a post of theirs, once each, a moment after it happened. */
|
|
372
|
+
tellSoon() {
|
|
373
|
+
var _a, _b;
|
|
374
|
+
clearTimeout(this.telling);
|
|
375
|
+
this.telling = setTimeout(() => void this.serial(() => this.tell()).catch(error => console.error('ta-moments:', error)), 2000);
|
|
376
|
+
(_b = (_a = this.telling).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
377
|
+
}
|
|
378
|
+
async tell() {
|
|
379
|
+
var _a, _b;
|
|
380
|
+
var _c, _d;
|
|
381
|
+
const room = this.mine(await this.host.rooms.listRooms());
|
|
382
|
+
if (!room) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const [posts, marks] = await Promise.all([
|
|
386
|
+
this.host.rooms.getState(room.id, moments_protocol_1.StateKeys.POST),
|
|
387
|
+
Promise.all([moments_protocol_1.StateKeys.LIKE, moments_protocol_1.StateKeys.TOOK].map(prefix => this.host.rooms.getState(room.id, prefix))).then(([likes, took]) => ({
|
|
388
|
+
...likes,
|
|
389
|
+
...took,
|
|
390
|
+
})),
|
|
391
|
+
]);
|
|
392
|
+
const byMember = new Map(room.members.filter(member => !member.owner && !member.guest).map(member => [member.member, member]));
|
|
393
|
+
const now = {};
|
|
394
|
+
for (const [key, value] of Object.entries(marks)) {
|
|
395
|
+
const [kind, post, member] = key.split(':');
|
|
396
|
+
const who = byMember.get(member);
|
|
397
|
+
if (who && value.by === member && value.value && posts[`${moments_protocol_1.StateKeys.POST}${post}`]) {
|
|
398
|
+
const key = `${kind}:${post}`;
|
|
399
|
+
now[key] = [...((_c = now[key]) !== null && _c !== void 0 ? _c : []), who.id];
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
const stored = await this.read(moments_protocol_1.Keys.TOLD);
|
|
403
|
+
// The first time: what was there before is not news.
|
|
404
|
+
if (stored === undefined) {
|
|
405
|
+
await this.write(moments_protocol_1.Keys.TOLD, now);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const told = record(stored);
|
|
409
|
+
for (const [key, ids] of Object.entries(now)) {
|
|
410
|
+
const before = new Set(strings(told[key]));
|
|
411
|
+
if (!ids.some(id => !before.has(id))) {
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
const [kind, post] = key.split(':');
|
|
415
|
+
const value = post_util_1.PostUtil.check((_a = posts[`${moments_protocol_1.StateKeys.POST}${post}`]) === null || _a === void 0 ? void 0 : _a.value);
|
|
416
|
+
const names = ids.map(id => { var _a; return ((_a = room.members.find(member => member.id === id)) === null || _a === void 0 ? void 0 : _a.name) || '?'; });
|
|
417
|
+
const what = ((_b = value === null || value === void 0 ? void 0 : value.attach) === null || _b === void 0 ? void 0 : _b.kind) === 'package' && kind === 'took' ? value.attach.title : ((_d = value === null || value === void 0 ? void 0 : value.text) !== null && _d !== void 0 ? _d : '');
|
|
418
|
+
await this.host
|
|
419
|
+
.callPackageHost(NOTIFY, 'notify', [
|
|
420
|
+
{ from: moments_protocol_1.NAME, id: key, level: 'done', title: server_texts_1.MomentsServerTexts.roomTitle(), text: server_texts_1.MomentsServerTexts.response(kind === 'took', names, what), view: moments_protocol_1.VIEW },
|
|
421
|
+
])
|
|
422
|
+
.catch(() => undefined);
|
|
423
|
+
}
|
|
424
|
+
await this.write(moments_protocol_1.Keys.TOLD, now);
|
|
425
|
+
}
|
|
426
|
+
async level() {
|
|
427
|
+
const level = await this.initiative('level', moments_protocol_1.POST_KIND);
|
|
428
|
+
return typeof level === 'string' ? level : 'ask';
|
|
429
|
+
}
|
|
430
|
+
/** What a post takes along: a package of the user, by its source or as a share of the relay; a link as it is. */
|
|
431
|
+
async attach(attach, post) {
|
|
432
|
+
if (attach.kind === 'link') {
|
|
433
|
+
return post_util_1.PostUtil.attach({ kind: 'link', link: attach.link, title: attach.title });
|
|
434
|
+
}
|
|
435
|
+
const info = await this.packageOf(attach.name);
|
|
436
|
+
if (!info) {
|
|
437
|
+
throw new Error(server_texts_1.MomentsServerTexts.noPackage(attach.name));
|
|
438
|
+
}
|
|
439
|
+
const language = server_texts_1.MomentsServerTexts.zh() ? 'zh-CN' : 'en';
|
|
440
|
+
const title = package_protocol_1.TaPackageTextUtil.pick(info.title, language) || info.name;
|
|
441
|
+
const summary = package_protocol_1.TaPackageTextUtil.pick(info.summary, language) || info.description;
|
|
442
|
+
if (published(info.source)) {
|
|
443
|
+
return post_util_1.PostUtil.attach({ kind: 'package', name: info.name, title, summary, source: info.source });
|
|
444
|
+
}
|
|
445
|
+
// From this computer while it runs Ta, until the post goes: nothing kept on the relay.
|
|
446
|
+
const share = await this.host.shares.create({ kind: moments_protocol_1.PACKAGE_SHARE, title, type: 'application/gzip', data: await pack(info.root), access: 'link' });
|
|
447
|
+
const shares = record(await this.read(moments_protocol_1.Keys.SHARES));
|
|
448
|
+
shares[post] = share.id;
|
|
449
|
+
await this.write(moments_protocol_1.Keys.SHARES, shares);
|
|
450
|
+
return post_util_1.PostUtil.attach({ kind: 'package', name: info.name, title, summary, link: share.link });
|
|
451
|
+
}
|
|
452
|
+
async packageOf(name) {
|
|
453
|
+
var _a;
|
|
454
|
+
const packages = (await this.host.listPackages()).filter(info => info.origin !== 'builtin' && info.origin !== 'temporary');
|
|
455
|
+
return (_a = packages.find(info => info.name === name)) !== null && _a !== void 0 ? _a : packages.find(info => (0, node_path_1.basename)(info.root) === name);
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Takes away what went: the user's posts past their time (their pictures here too), the pictures kept of friends'
|
|
459
|
+
* posts that went or of friends no longer followed, the oldest of those past Limits.CACHE_BYTES, old drafts.
|
|
460
|
+
*/
|
|
461
|
+
sweep() {
|
|
462
|
+
return this.serial(async () => {
|
|
463
|
+
const rooms = await this.host.rooms.listRooms();
|
|
464
|
+
const room = this.mine(rooms);
|
|
465
|
+
const now = this.now();
|
|
466
|
+
if (room === null || room === void 0 ? void 0 : room.connected) {
|
|
467
|
+
const state = await this.host.rooms.getState(room.id, moments_protocol_1.StateKeys.POST);
|
|
468
|
+
for (const [key, value] of Object.entries(state)) {
|
|
469
|
+
const post = post_util_1.PostUtil.check(value.value);
|
|
470
|
+
if (!post || (post.until !== undefined && post.until <= now)) {
|
|
471
|
+
await this.drop(room.id, key.slice(moments_protocol_1.StateKeys.POST.length));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
// Pictures kept on the relay before.
|
|
475
|
+
for (const key of Object.keys(await this.host.rooms.getState(room.id, moments_protocol_1.StateKeys.IMG))) {
|
|
476
|
+
await this.host.rooms.setState(room.id, key, null).catch(() => undefined);
|
|
477
|
+
}
|
|
478
|
+
const kept = new Set(Object.keys(await this.host.rooms.getState(room.id, moments_protocol_1.StateKeys.POST)).map(key => key.slice(moments_protocol_1.StateKeys.POST.length)));
|
|
479
|
+
for (const post of await (0, promises_1.readdir)(this.postsRoot()).catch(() => [])) {
|
|
480
|
+
if (!kept.has(post)) {
|
|
481
|
+
await (0, promises_1.rm)((0, node_path_1.join)(this.postsRoot(), post), { recursive: true, force: true });
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
await this.sweepCache(rooms);
|
|
486
|
+
await this.sweepDrafts();
|
|
487
|
+
if (room === null || room === void 0 ? void 0 : room.connected) {
|
|
488
|
+
const kept = new Set(Object.keys(await this.host.rooms.getState(room.id, moments_protocol_1.StateKeys.POST)).map(key => key.slice(moments_protocol_1.StateKeys.POST.length)));
|
|
489
|
+
await this.talk.sweep(kept, new Set(rooms.filter(item => !item.owner && item.status !== 'gone' && item.status !== 'refused').map(item => item.id)));
|
|
490
|
+
}
|
|
491
|
+
this.changed();
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
/** Pictures of friends' posts: only of rooms followed, only of posts still there, the newest within Limits.CACHE_BYTES. */
|
|
495
|
+
async sweepCache(rooms) {
|
|
496
|
+
var _a, _b;
|
|
497
|
+
const root = this.cacheRoot();
|
|
498
|
+
const now = this.now();
|
|
499
|
+
const followed = new Map(rooms.filter(room => !room.owner && room.status === 'member').map(room => [room.id, room]));
|
|
500
|
+
const kept = [];
|
|
501
|
+
for (const id of await (0, promises_1.readdir)(root).catch(() => [])) {
|
|
502
|
+
const room = followed.get(id);
|
|
503
|
+
if (!room) {
|
|
504
|
+
await (0, promises_1.rm)((0, node_path_1.join)(root, id), { recursive: true, force: true });
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
// Only once the room said what it holds: a room not connected yet would seem empty.
|
|
508
|
+
const there = room.connected
|
|
509
|
+
? new Set(post_util_1.PostUtil.feed({ room, state: await this.host.rooms.getState(id, moments_protocol_1.StateKeys.POST), me: '', friends: new Set(), now }).map(post => post.id))
|
|
510
|
+
: undefined;
|
|
511
|
+
for (const post of await (0, promises_1.readdir)((0, node_path_1.join)(root, id)).catch(() => [])) {
|
|
512
|
+
const dir = (0, node_path_1.join)(root, id, post);
|
|
513
|
+
if (there && !there.has(post)) {
|
|
514
|
+
await (0, promises_1.rm)(dir, { recursive: true, force: true });
|
|
515
|
+
continue;
|
|
516
|
+
}
|
|
517
|
+
let size = 0;
|
|
518
|
+
let at = 0;
|
|
519
|
+
for (const file of await (0, promises_1.readdir)(dir).catch(() => [])) {
|
|
520
|
+
const info = await (0, promises_1.stat)((0, node_path_1.join)(dir, file)).catch(() => undefined);
|
|
521
|
+
size += (_a = info === null || info === void 0 ? void 0 : info.size) !== null && _a !== void 0 ? _a : 0;
|
|
522
|
+
at = Math.max(at, (_b = info === null || info === void 0 ? void 0 : info.mtimeMs) !== null && _b !== void 0 ? _b : 0);
|
|
523
|
+
}
|
|
524
|
+
kept.push({ dir, at, size });
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
let total = kept.reduce((sum, item) => sum + item.size, 0);
|
|
528
|
+
for (const item of kept.sort((x, y) => x.at - y.at)) {
|
|
529
|
+
if (total <= moments_protocol_1.Limits.CACHE_BYTES) {
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
await (0, promises_1.rm)(item.dir, { recursive: true, force: true });
|
|
533
|
+
total -= item.size;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
async sweepDrafts() {
|
|
537
|
+
const dir = (0, node_path_1.join)(this.host.agentDir, 'ta-moments', 'drafts');
|
|
538
|
+
for (const name of await (0, promises_1.readdir)(dir).catch(() => [])) {
|
|
539
|
+
const info = await (0, promises_1.stat)((0, node_path_1.join)(dir, name)).catch(() => undefined);
|
|
540
|
+
if (info && this.now() - info.mtimeMs > DRAFT_DAYS * DAY_MS) {
|
|
541
|
+
await (0, promises_1.rm)((0, node_path_1.join)(dir, name), { recursive: true, force: true });
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
/** Keeps at most Limits.POSTS posts. */
|
|
546
|
+
async trim(room) {
|
|
547
|
+
const posts = Object.entries(await this.host.rooms.getState(room, moments_protocol_1.StateKeys.POST))
|
|
548
|
+
.map(([key, value]) => { var _a; var _b; return ({ id: key.slice(moments_protocol_1.StateKeys.POST.length), at: (_b = (_a = post_util_1.PostUtil.check(value.value)) === null || _a === void 0 ? void 0 : _a.at) !== null && _b !== void 0 ? _b : 0 }); })
|
|
549
|
+
.sort((a, b) => b.at - a.at);
|
|
550
|
+
for (const post of posts.slice(moments_protocol_1.Limits.POSTS)) {
|
|
551
|
+
await this.drop(room, post.id);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
/** Writes into the room; when it is full, the oldest posts go first, one by one. */
|
|
555
|
+
async room(room, write) {
|
|
556
|
+
for (let attempt = 0;; attempt++) {
|
|
557
|
+
try {
|
|
558
|
+
await write();
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
catch (error) {
|
|
562
|
+
const full = error instanceof Error && /full/.test(error.message);
|
|
563
|
+
const posts = Object.entries(await this.host.rooms.getState(room, moments_protocol_1.StateKeys.POST)).sort((a, b) => { var _a, _b; var _c, _d; return ((_c = (_a = post_util_1.PostUtil.check(a[1].value)) === null || _a === void 0 ? void 0 : _a.at) !== null && _c !== void 0 ? _c : 0) - ((_d = (_b = post_util_1.PostUtil.check(b[1].value)) === null || _b === void 0 ? void 0 : _b.at) !== null && _d !== void 0 ? _d : 0); });
|
|
564
|
+
if (!full || attempt >= 10 || !posts.length) {
|
|
565
|
+
throw error;
|
|
566
|
+
}
|
|
567
|
+
await this.drop(room, posts[0][0].slice(moments_protocol_1.StateKeys.POST.length));
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
async drop(room, post) {
|
|
572
|
+
const keys = post_util_1.PostUtil.keysOf(post, Object.keys(await this.host.rooms.getState(room)));
|
|
573
|
+
for (const key of keys) {
|
|
574
|
+
await this.host.rooms.setState(room, key, null).catch(() => undefined);
|
|
575
|
+
}
|
|
576
|
+
if (post_util_1.PostUtil.isId(post)) {
|
|
577
|
+
await (0, promises_1.rm)(this.postDir(post), { recursive: true, force: true });
|
|
578
|
+
}
|
|
579
|
+
const shares = record(await this.read(moments_protocol_1.Keys.SHARES));
|
|
580
|
+
if (shares[post]) {
|
|
581
|
+
await this.host.shares.remove(shares[post]).catch(() => undefined);
|
|
582
|
+
delete shares[post];
|
|
583
|
+
await this.write(moments_protocol_1.Keys.SHARES, shares);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
async mark(room, post, prefix, on) {
|
|
587
|
+
const info = (await this.host.rooms.listRooms()).find(item => item.id === room && item.status === 'member');
|
|
588
|
+
const self = info === null || info === void 0 ? void 0 : info.members.find(member => member.self);
|
|
589
|
+
if (!info || !self || !post_util_1.PostUtil.isId(post)) {
|
|
590
|
+
throw new Error(server_texts_1.MomentsServerTexts.notFound());
|
|
591
|
+
}
|
|
592
|
+
await this.host.rooms.setState(room, `${prefix}${post}:${self.member}`, on ? 1 : null);
|
|
593
|
+
this.changed();
|
|
594
|
+
}
|
|
595
|
+
/** A post of a friend changed: gone, its pictures here go; new, they are asked of its author. */
|
|
596
|
+
async postChanged(room, post, value) {
|
|
597
|
+
const info = (await this.host.rooms.listRooms()).find(item => item.id === room);
|
|
598
|
+
if (!info || info.owner || !post_util_1.PostUtil.isId(post) || !ROOM_ID.test(room)) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
if (value === null) {
|
|
602
|
+
await (0, promises_1.rm)(this.cacheDir(room, post), { recursive: true, force: true });
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
this.fetchSoon();
|
|
606
|
+
}
|
|
607
|
+
/** Asks the authors online for the pictures of their posts this computer has not got, once things settle. */
|
|
608
|
+
fetchSoon() {
|
|
609
|
+
var _a, _b;
|
|
610
|
+
clearTimeout(this.fetching);
|
|
611
|
+
this.fetching = setTimeout(() => {
|
|
612
|
+
void this.forgetGone().catch(error => console.error('ta-moments:', error));
|
|
613
|
+
void this.fetchMissing().catch(error => console.error('ta-moments:', error));
|
|
614
|
+
void this.host.rooms
|
|
615
|
+
.listRooms()
|
|
616
|
+
.then(rooms => this.talk.sync(rooms))
|
|
617
|
+
.catch(error => console.error('ta-moments:', error));
|
|
618
|
+
}, 1000);
|
|
619
|
+
(_b = (_a = this.fetching).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
620
|
+
}
|
|
621
|
+
async fetchMissing() {
|
|
622
|
+
const now = this.now();
|
|
623
|
+
for (const room of (await this.host.rooms.listRooms()).filter(item => !item.owner && item.status === 'member' && item.connected)) {
|
|
624
|
+
const owner = room.members.find(member => member.owner);
|
|
625
|
+
if (!(owner === null || owner === void 0 ? void 0 : owner.online) || !ROOM_ID.test(room.id)) {
|
|
626
|
+
continue;
|
|
627
|
+
}
|
|
628
|
+
for (const post of post_util_1.PostUtil.feed({ room, state: await this.host.rooms.getState(room.id, moments_protocol_1.StateKeys.POST), me: '', friends: new Set(), now })) {
|
|
629
|
+
const dir = this.cacheDir(room.id, post.id);
|
|
630
|
+
const missing = [];
|
|
631
|
+
for (const index of post.images.keys()) {
|
|
632
|
+
if (!(await this.readPicture(dir, index))) {
|
|
633
|
+
missing.push(index);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
await this.want(room, post.id, missing);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/** Asks the author of a post for pictures, to this computer alone, unless asked a moment ago or it is offline. */
|
|
641
|
+
async want(room, post, indexes) {
|
|
642
|
+
var _a;
|
|
643
|
+
const owner = room.members.find(member => member.owner);
|
|
644
|
+
if (!(owner === null || owner === void 0 ? void 0 : owner.online) || room.status !== 'member') {
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
const now = this.now();
|
|
648
|
+
for (const index of indexes) {
|
|
649
|
+
const key = `${room.id}:${post}:${index}`;
|
|
650
|
+
if (now - ((_a = this.asked.get(key)) !== null && _a !== void 0 ? _a : 0) < moments_protocol_1.Limits.ASK_AGAIN_MS) {
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
this.asked.set(key, now);
|
|
654
|
+
await this.host.rooms.send(room.id, { t: 'ta-moments:want', post, index }, owner.member).catch(() => undefined);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
/** A message of a room of posts: a friend asking for a picture of the user's, or a picture of a friend's coming. */
|
|
658
|
+
async heard(event) {
|
|
659
|
+
var _a;
|
|
660
|
+
var _b, _c;
|
|
661
|
+
const words = talk_util_1.TalkUtil.message(event.data);
|
|
662
|
+
const message = words ? undefined : post_util_1.PostUtil.message(event.data);
|
|
663
|
+
if (!message && !words) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
const room = (await this.host.rooms.listRooms()).find(item => item.id === event.room && item.status === 'member' && item.kind === moments_protocol_1.KIND);
|
|
667
|
+
const sender = room === null || room === void 0 ? void 0 : room.members.find(member => member.member === event.from);
|
|
668
|
+
if (!room || !sender || sender.self || sender.guest) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
if (words) {
|
|
672
|
+
await this.talk.heard(room, sender, words);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
if (!message) {
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
if (message.t === 'ta-moments:want') {
|
|
679
|
+
if (room.owner) {
|
|
680
|
+
this.serve(room.id, event.from, message.post, message.index);
|
|
681
|
+
}
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
// Only from the author, into the directory of a post that is there.
|
|
685
|
+
if (room.owner || !sender.owner || !ROOM_ID.test(room.id)) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
const key = `${room.id}:${message.post}:${message.index}`;
|
|
689
|
+
const now = this.now();
|
|
690
|
+
for (const [other, coming] of this.incoming) {
|
|
691
|
+
if (now - coming.at > INCOMING_MS) {
|
|
692
|
+
this.incoming.delete(other);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
const coming = (_b = this.incoming.get(key)) !== null && _b !== void 0 ? _b : { parts: [], at: now };
|
|
696
|
+
if (coming.parts.length !== message.parts) {
|
|
697
|
+
coming.parts = new Array(message.parts).fill('');
|
|
698
|
+
}
|
|
699
|
+
coming.parts[message.part] = message.d;
|
|
700
|
+
coming.at = now;
|
|
701
|
+
this.incoming.set(key, coming);
|
|
702
|
+
if (coming.parts.some(part => !part)) {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
this.incoming.delete(key);
|
|
706
|
+
const data = coming.parts.join('');
|
|
707
|
+
const value = (await this.host.rooms.getState(room.id, `${moments_protocol_1.StateKeys.POST}${message.post}`))[`${moments_protocol_1.StateKeys.POST}${message.post}`];
|
|
708
|
+
const post = (value === null || value === void 0 ? void 0 : value.by) === sender.member ? post_util_1.PostUtil.check(value.value) : undefined;
|
|
709
|
+
if (!post_util_1.PostUtil.isPicture(data) || !post || message.index >= ((_c = (_a = post.images) === null || _a === void 0 ? void 0 : _a.length) !== null && _c !== void 0 ? _c : 0)) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
await this.writePicture(this.cacheDir(room.id, message.post), message.index, data);
|
|
713
|
+
this.asked.delete(key);
|
|
714
|
+
this.changed();
|
|
715
|
+
}
|
|
716
|
+
/** Sends a picture of the user's post to the friend who asked, in parts, one after another. */
|
|
717
|
+
serve(room, to, post, index) {
|
|
718
|
+
this.serving = this.serving
|
|
719
|
+
.then(async () => {
|
|
720
|
+
const data = await this.readPicture(this.postDir(post), index);
|
|
721
|
+
if (!data) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const parts = post_util_1.PostUtil.parts(data);
|
|
725
|
+
for (const [part, d] of parts.entries()) {
|
|
726
|
+
await this.host.rooms.send(room, { t: 'ta-moments:img', post, index, part, parts: parts.length, d }, to);
|
|
727
|
+
if (this.pace) {
|
|
728
|
+
await new Promise(resolve => setTimeout(resolve, this.pace));
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
})
|
|
732
|
+
.catch(error => console.error('ta-moments could not send a picture:', error));
|
|
733
|
+
}
|
|
734
|
+
/** The pictures of friends' posts of a room this computer no longer follows. */
|
|
735
|
+
/** What was kept of the posts of one no longer a friend: the room of theirs is gone (left, or let go of). */
|
|
736
|
+
async forgetGone() {
|
|
737
|
+
const followed = new Set((await this.host.rooms.listRooms()).filter(room => !room.owner && room.status === 'member').map(room => room.id));
|
|
738
|
+
for (const id of await (0, promises_1.readdir)(this.cacheRoot()).catch(() => [])) {
|
|
739
|
+
if (!followed.has(id)) {
|
|
740
|
+
await this.forget(id);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
async forget(room) {
|
|
745
|
+
if (ROOM_ID.test(room)) {
|
|
746
|
+
await (0, promises_1.rm)((0, node_path_1.join)(this.cacheRoot(), room), { recursive: true, force: true });
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
postsRoot() {
|
|
750
|
+
return (0, node_path_1.join)(this.host.agentDir, 'ta-moments', 'posts');
|
|
751
|
+
}
|
|
752
|
+
postDir(post) {
|
|
753
|
+
return (0, node_path_1.join)(this.postsRoot(), post);
|
|
754
|
+
}
|
|
755
|
+
cacheRoot() {
|
|
756
|
+
return (0, node_path_1.join)(this.host.agentDir, 'ta-moments', 'cache');
|
|
757
|
+
}
|
|
758
|
+
cacheDir(room, post) {
|
|
759
|
+
return (0, node_path_1.join)(this.cacheRoot(), room, post);
|
|
760
|
+
}
|
|
761
|
+
async readPicture(dir, index) {
|
|
762
|
+
const data = await (0, promises_1.readFile)((0, node_path_1.join)(dir, `${index}.txt`), 'utf8').catch(() => '');
|
|
763
|
+
return post_util_1.PostUtil.isPicture(data) ? data : '';
|
|
764
|
+
}
|
|
765
|
+
async writePicture(dir, index, data) {
|
|
766
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
767
|
+
await (0, promises_1.writeFile)((0, node_path_1.join)(dir, `${index}.txt`), data);
|
|
768
|
+
}
|
|
769
|
+
mine(rooms) {
|
|
770
|
+
return rooms.find(room => room.kind === moments_protocol_1.KIND && room.owner && room.status === 'member');
|
|
771
|
+
}
|
|
772
|
+
async posts(room) {
|
|
773
|
+
const [posts, likes, took] = await Promise.all([moments_protocol_1.StateKeys.POST, moments_protocol_1.StateKeys.LIKE, moments_protocol_1.StateKeys.TOOK].map(prefix => this.host.rooms.getState(room, prefix).catch(() => ({}))));
|
|
774
|
+
return { ...posts, ...likes, ...took };
|
|
775
|
+
}
|
|
776
|
+
draftDir(key) {
|
|
777
|
+
return typeof key === 'string' && /^[A-Za-z0-9-]{1,80}$/.test(key) ? (0, node_path_1.join)(this.host.agentDir, 'ta-moments', 'drafts', key) : undefined;
|
|
778
|
+
}
|
|
779
|
+
async decide(key, decision) {
|
|
780
|
+
const decided = record(await this.read(moments_protocol_1.Keys.DECIDED));
|
|
781
|
+
decided[key] = decision;
|
|
782
|
+
// The latest 200: a card of before shows what was decided.
|
|
783
|
+
await this.write(moments_protocol_1.Keys.DECIDED, Object.fromEntries(Object.entries(decided).slice(-200)));
|
|
784
|
+
}
|
|
785
|
+
/** Pages read the state again, once the changes of a moment are done. */
|
|
786
|
+
changed() {
|
|
787
|
+
var _a, _b;
|
|
788
|
+
clearTimeout(this.bump);
|
|
789
|
+
this.bump = setTimeout(() => {
|
|
790
|
+
void this.write(moments_protocol_1.Keys.REV, this.now()).catch(() => undefined);
|
|
791
|
+
void this.writeBrief().catch(error => console.error('ta-moments could not tell the brief:', error));
|
|
792
|
+
}, SETTLE_MS);
|
|
793
|
+
(_b = (_a = this.bump).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
794
|
+
}
|
|
795
|
+
read(key) {
|
|
796
|
+
return this.host.getExtensionData(moments_protocol_1.NAME, key);
|
|
797
|
+
}
|
|
798
|
+
write(key, value) {
|
|
799
|
+
return this.host.setExtensionData(moments_protocol_1.NAME, key, value);
|
|
800
|
+
}
|
|
801
|
+
/** A call of the host of ta-initiative, which defines the kind first; undefined when it is not there. */
|
|
802
|
+
async initiative(method, ...params) {
|
|
803
|
+
try {
|
|
804
|
+
if (!this.defined) {
|
|
805
|
+
await this.host.callPackageHost(INITIATIVE, 'defineKind', [KIND_OF_POST]);
|
|
806
|
+
this.defined = true;
|
|
807
|
+
}
|
|
808
|
+
return await this.host.callPackageHost(INITIATIVE, method, params);
|
|
809
|
+
}
|
|
810
|
+
catch (_a) {
|
|
811
|
+
return undefined;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
serial(work) {
|
|
815
|
+
const next = this.queue.then(work, work);
|
|
816
|
+
this.queue = next.catch(() => undefined);
|
|
817
|
+
return next;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
exports.MomentsHost = MomentsHost;
|
|
821
|
+
//# sourceMappingURL=moments-host.js.map
|