@celljs/ta 4.10.0 → 4.12.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 +3 -1
- package/README.md +3 -1
- package/dist/cli.mjs +1675 -51
- package/dist/gateway.mjs +167 -5
- package/dist/pi/CHANGELOG.md +27 -0
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-agents/extension/index.mjs +359 -155
- package/dist/pi/packages/ta-agents/lib/acp-agent.js +30 -10
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +5 -0
- package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts +2 -2
- package/dist/pi/packages/ta-agents/lib/agent-catalog.js +4 -4
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +9 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +25 -0
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +71 -1
- package/dist/pi/packages/ta-agents/lib/agent-session.js +177 -17
- package/dist/pi/packages/ta-agents/lib/agent-streamer.js +23 -2
- package/dist/pi/packages/ta-agents/lib/agent-tool.js +4 -3
- package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +7 -1
- package/dist/pi/packages/ta-agents/lib/agent-turn.js +26 -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 +31 -299
- package/dist/pi/packages/ta-bots/host/index.mjs +143 -1
- package/dist/pi/packages/ta-bots/lib/bots-protocol.d.ts +2 -0
- package/dist/pi/packages/ta-bots/lib/bots-protocol.js +3 -1
- package/dist/pi/packages/ta-bots/lib/bots-view.js +24 -12
- package/dist/pi/packages/ta-bots/lib/composer.js +1 -0
- package/dist/pi/packages/ta-bots/lib/extension.js +10 -17
- package/dist/pi/packages/ta-bots/lib/i18n.d.ts +1 -0
- package/dist/pi/packages/ta-bots/lib/i18n.js +2 -0
- package/dist/pi/packages/ta-bots/lib/index.js +2 -0
- package/dist/pi/packages/ta-bots/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-bots/lib/style.js +1 -0
- package/dist/pi/packages/ta-bots/lib/text-util.js +8 -1
- package/dist/pi/packages/ta-bots/lib/tool-line.d.ts +8 -0
- package/dist/pi/packages/ta-bots/lib/tool-line.js +19 -0
- package/dist/pi/packages/ta-bots/package.json +1 -1
- package/dist/pi/packages/ta-bots/web/index.js +47 -16
- package/dist/pi/packages/ta-changes/extension/index.mjs +23 -13
- package/dist/pi/packages/ta-changes/lib/card.js +18 -4
- package/dist/pi/packages/ta-changes/lib/changes-protocol.d.ts +0 -4
- package/dist/pi/packages/ta-changes/lib/changes-protocol.js +1 -5
- package/dist/pi/packages/ta-changes/lib/extension.js +5 -13
- package/dist/pi/packages/ta-changes/package.json +1 -1
- package/dist/pi/packages/ta-changes/web/index.js +16 -3
- package/dist/pi/packages/ta-channels/README.en.md +4 -3
- package/dist/pi/packages/ta-channels/README.md +4 -3
- package/dist/pi/packages/ta-channels/extension/index.mjs +350 -28
- package/dist/pi/packages/ta-channels/host/index.mjs +588 -43
- package/dist/pi/packages/ta-channels/lib/agent-cards.d.ts +19 -0
- package/dist/pi/packages/ta-channels/lib/agent-cards.js +58 -0
- package/dist/pi/packages/ta-channels/lib/agent-menu.d.ts +2 -2
- package/dist/pi/packages/ta-channels/lib/agent-menu.js +20 -6
- package/dist/pi/packages/ta-channels/lib/card.d.ts +27 -0
- package/dist/pi/packages/ta-channels/lib/card.js +178 -0
- package/dist/pi/packages/ta-channels/lib/channels-model.d.ts +65 -13
- package/dist/pi/packages/ta-channels/lib/channels-model.js +15 -6
- package/dist/pi/packages/ta-channels/lib/channels-util.d.ts +31 -2
- package/dist/pi/packages/ta-channels/lib/channels-util.js +100 -6
- package/dist/pi/packages/ta-channels/lib/channels.d.ts +28 -18
- package/dist/pi/packages/ta-channels/lib/channels.js +65 -65
- package/dist/pi/packages/ta-channels/lib/create.js +3 -1
- package/dist/pi/packages/ta-channels/lib/extension.d.ts +8 -0
- package/dist/pi/packages/ta-channels/lib/extension.js +104 -18
- package/dist/pi/packages/ta-channels/lib/faces.d.ts +2 -0
- package/dist/pi/packages/ta-channels/lib/faces.js +6 -0
- package/dist/pi/packages/ta-channels/lib/handoff-view.d.ts +19 -0
- package/dist/pi/packages/ta-channels/lib/handoff-view.js +113 -0
- package/dist/pi/packages/ta-channels/lib/handoff.d.ts +67 -0
- package/dist/pi/packages/ta-channels/lib/handoff.js +114 -0
- package/dist/pi/packages/ta-channels/lib/host.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/host.js +1 -1
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts +45 -0
- package/dist/pi/packages/ta-channels/lib/i18n.js +90 -0
- package/dist/pi/packages/ta-channels/lib/index.js +10 -1
- package/dist/pi/packages/ta-channels/lib/member-tools.d.ts +23 -0
- package/dist/pi/packages/ta-channels/lib/member-tools.js +56 -0
- package/dist/pi/packages/ta-channels/lib/members.js +6 -2
- package/dist/pi/packages/ta-channels/lib/notice.d.ts +25 -0
- package/dist/pi/packages/ta-channels/lib/notice.js +101 -0
- package/dist/pi/packages/ta-channels/lib/room.js +13 -2
- package/dist/pi/packages/ta-channels/lib/sidebar.d.ts +1 -6
- package/dist/pi/packages/ta-channels/lib/sidebar.js +160 -79
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +72 -4
- package/dist/pi/packages/ta-channels/lib/team.d.ts +58 -10
- package/dist/pi/packages/ta-channels/lib/team.js +159 -38
- package/dist/pi/packages/ta-channels/lib/tool-lines.d.ts +22 -0
- package/dist/pi/packages/ta-channels/lib/tool-lines.js +113 -0
- package/dist/pi/packages/ta-channels/lib/views.d.ts +33 -16
- package/dist/pi/packages/ta-channels/lib/views.js +79 -31
- package/dist/pi/packages/ta-channels/package.json +2 -1
- package/dist/pi/packages/ta-channels/web/index.js +1551 -308
- package/dist/pi/packages/ta-computer-use/package.json +6 -1
- package/dist/pi/packages/ta-cron/README.en.md +4 -2
- package/dist/pi/packages/ta-cron/README.md +4 -2
- package/dist/pi/packages/ta-cron/extension/index.mjs +416 -44
- package/dist/pi/packages/ta-cron/host/index.mjs +24 -3
- package/dist/pi/packages/ta-cron/lib/chat-task.d.ts +48 -0
- package/dist/pi/packages/ta-cron/lib/chat-task.js +133 -0
- package/dist/pi/packages/ta-cron/lib/commands.d.ts +2 -1
- package/dist/pi/packages/ta-cron/lib/commands.js +10 -4
- package/dist/pi/packages/ta-cron/lib/composer.d.ts +11 -0
- package/dist/pi/packages/ta-cron/lib/composer.js +58 -0
- package/dist/pi/packages/ta-cron/lib/cron-protocol.d.ts +10 -3
- package/dist/pi/packages/ta-cron/lib/cron-protocol.js +6 -3
- package/dist/pi/packages/ta-cron/lib/editor.js +5 -3
- package/dist/pi/packages/ta-cron/lib/extension.d.ts +2 -0
- package/dist/pi/packages/ta-cron/lib/extension.js +33 -13
- package/dist/pi/packages/ta-cron/lib/i18n.d.ts +18 -0
- package/dist/pi/packages/ta-cron/lib/i18n.js +36 -0
- package/dist/pi/packages/ta-cron/lib/index.js +4 -0
- package/dist/pi/packages/ta-cron/lib/page.d.ts +5 -1
- package/dist/pi/packages/ta-cron/lib/page.js +12 -0
- package/dist/pi/packages/ta-cron/lib/react.d.ts +3 -0
- package/dist/pi/packages/ta-cron/lib/react.js +8 -0
- package/dist/pi/packages/ta-cron/lib/scheduler.js +3 -2
- package/dist/pi/packages/ta-cron/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-cron/lib/style.js +11 -13
- package/dist/pi/packages/ta-cron/lib/task-util.d.ts +2 -0
- package/dist/pi/packages/ta-cron/lib/task-util.js +20 -1
- package/dist/pi/packages/ta-cron/lib/tasks-view.js +6 -2
- package/dist/pi/packages/ta-cron/lib/tool-line.d.ts +9 -0
- package/dist/pi/packages/ta-cron/lib/tool-line.js +40 -0
- package/dist/pi/packages/ta-cron/lib/tool.d.ts +5 -1
- package/dist/pi/packages/ta-cron/lib/tool.js +6 -3
- package/dist/pi/packages/ta-cron/package.json +12 -1
- package/dist/pi/packages/ta-cron/web/index.js +661 -254
- package/dist/pi/packages/ta-extensions/README.en.md +1 -1
- package/dist/pi/packages/ta-extensions/README.md +1 -1
- package/dist/pi/packages/ta-extensions/host/index.mjs +3 -2
- package/dist/pi/packages/ta-extensions/lib/actions.d.ts +4 -0
- package/dist/pi/packages/ta-extensions/lib/actions.js +13 -4
- package/dist/pi/packages/ta-extensions/lib/extensions-util.d.ts +5 -0
- package/dist/pi/packages/ta-extensions/lib/extensions-util.js +10 -0
- package/dist/pi/packages/ta-extensions/lib/market-parts.js +8 -2
- package/dist/pi/packages/ta-extensions/lib/market-style.d.ts +1 -1
- package/dist/pi/packages/ta-extensions/lib/market-style.js +4 -5
- package/dist/pi/packages/ta-extensions/lib/market-util.d.ts +2 -2
- package/dist/pi/packages/ta-extensions/lib/market-util.js +2 -2
- package/dist/pi/packages/ta-extensions/lib/page.js +12 -7
- package/dist/pi/packages/ta-extensions/lib/react.d.ts +3 -0
- package/dist/pi/packages/ta-extensions/lib/react.js +8 -0
- package/dist/pi/packages/ta-extensions/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-extensions/lib/style.js +3 -2
- package/dist/pi/packages/ta-extensions/package.json +6 -1
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +20 -8
- package/dist/pi/packages/ta-extensions/web/index.js +191 -22
- package/dist/pi/packages/ta-games/README.en.md +47 -0
- package/dist/pi/packages/ta-games/README.md +47 -0
- package/dist/pi/packages/ta-games/host/index.mjs +65 -0
- package/dist/pi/packages/ta-games/lib/games-view.d.ts +16 -0
- package/dist/pi/packages/ta-games/lib/games-view.js +77 -0
- package/dist/pi/packages/ta-games/lib/host.d.ts +36 -0
- package/dist/pi/packages/ta-games/lib/host.js +83 -0
- package/dist/pi/packages/ta-games/lib/i18n.d.ts +35 -0
- package/dist/pi/packages/ta-games/lib/i18n.js +71 -0
- package/dist/pi/packages/ta-games/lib/ideas.d.ts +6 -0
- package/dist/pi/packages/ta-games/lib/ideas.js +62 -0
- package/dist/pi/packages/ta-games/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-games/lib/index.js +24 -0
- package/dist/pi/packages/ta-games/lib/make-game.d.ts +23 -0
- package/dist/pi/packages/ta-games/lib/make-game.js +67 -0
- package/dist/pi/packages/ta-games/lib/react.d.ts +11 -0
- package/dist/pi/packages/ta-games/lib/react.js +16 -0
- package/dist/pi/packages/ta-games/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-games/lib/style.js +33 -0
- package/dist/pi/packages/ta-games/package.json +60 -0
- package/dist/pi/packages/ta-games/skills/ta-game/SKILL.md +127 -0
- package/dist/pi/packages/ta-games/skills/ta-game/examples/dino-run/package.json +22 -0
- package/dist/pi/packages/ta-games/skills/ta-game/examples/dino-run/web.js +389 -0
- package/dist/pi/packages/ta-games/skills/ta-game/examples/stack/package.json +22 -0
- package/dist/pi/packages/ta-games/skills/ta-game/examples/stack/web.js +423 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/LICENSE.md +22 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/actions-and-utilities/SKILL.md +343 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/animations/SKILL.md +481 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/audio-and-sound/SKILL.md +453 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/cameras/SKILL.md +497 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/cameras/references/REFERENCE.md +128 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/curves-and-paths/SKILL.md +359 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/data-manager/SKILL.md +406 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/events-system/SKILL.md +497 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/filters-and-postfx/SKILL.md +449 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/game-object-components/SKILL.md +478 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/game-object-components/references/REFERENCE.md +76 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/game-setup-and-config/SKILL.md +485 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/geometry-and-math/SKILL.md +497 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/graphics-and-shapes/SKILL.md +473 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/groups-and-containers/SKILL.md +418 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/input-keyboard-mouse-touch/SKILL.md +500 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/input-keyboard-mouse-touch/references/REFERENCE.md +372 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/loading-assets/SKILL.md +474 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/loading-assets/references/REFERENCE.md +148 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/particles/SKILL.md +499 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/particles/references/REFERENCE.md +17 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/physics-arcade/SKILL.md +468 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/physics-matter/SKILL.md +499 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/render-textures/SKILL.md +441 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/scale-and-responsive/SKILL.md +371 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/scenes/SKILL.md +450 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/scenes/references/REFERENCE.md +78 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/sprites-and-images/SKILL.md +417 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/sprites-and-images/references/REFERENCE.md +160 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/text-and-bitmaptext/SKILL.md +460 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/tilemaps/SKILL.md +440 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/time-and-timers/SKILL.md +496 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/tweens/SKILL.md +414 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/v3-to-v4-migration/SKILL.md +430 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/v4-new-features/SKILL.md +384 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/v4-new-features/references/REFERENCE.md +69 -0
- package/dist/pi/packages/ta-games/web/index.js +431 -0
- package/dist/pi/packages/ta-glance/README.en.md +11 -0
- package/dist/pi/packages/ta-glance/README.md +11 -0
- package/dist/pi/packages/ta-glance/extension/index.mjs +67 -0
- package/dist/pi/packages/ta-glance/lib/card.d.ts +8 -0
- package/dist/pi/packages/ta-glance/lib/card.js +269 -0
- package/dist/pi/packages/ta-glance/lib/extension.d.ts +15 -0
- package/dist/pi/packages/ta-glance/lib/extension.js +24 -0
- package/dist/pi/packages/ta-glance/lib/glance-json.d.ts +9 -0
- package/dist/pi/packages/ta-glance/lib/glance-json.js +85 -0
- package/dist/pi/packages/ta-glance/lib/glance-prompt.d.ts +7 -0
- package/dist/pi/packages/ta-glance/lib/glance-prompt.js +34 -0
- package/dist/pi/packages/ta-glance/lib/glance-protocol.d.ts +98 -0
- package/dist/pi/packages/ta-glance/lib/glance-protocol.js +8 -0
- package/dist/pi/packages/ta-glance/lib/glance-spec.d.ts +7 -0
- package/dist/pi/packages/ta-glance/lib/glance-spec.js +206 -0
- package/dist/pi/packages/ta-glance/lib/glance-util.d.ts +3 -0
- package/dist/pi/packages/ta-glance/lib/glance-util.js +12 -0
- package/dist/pi/packages/ta-glance/lib/i18n.d.ts +22 -0
- package/dist/pi/packages/ta-glance/lib/i18n.js +41 -0
- package/dist/pi/packages/ta-glance/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-glance/lib/index.js +22 -0
- package/dist/pi/packages/ta-glance/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-glance/lib/react.js +8 -0
- package/dist/pi/packages/ta-glance/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-glance/lib/style.js +241 -0
- package/dist/pi/packages/ta-glance/package.json +53 -0
- package/dist/pi/packages/ta-glance/web/index.js +1013 -0
- package/dist/pi/packages/ta-launcher/lib/actions.d.ts +4 -4
- package/dist/pi/packages/ta-launcher/lib/actions.js +7 -3
- package/dist/pi/packages/ta-launcher/lib/launcher-util.d.ts +7 -7
- package/dist/pi/packages/ta-launcher/lib/launcher-util.js +11 -8
- package/dist/pi/packages/ta-launcher/lib/launcher-view.js +13 -7
- package/dist/pi/packages/ta-launcher/lib/react.d.ts +3 -0
- package/dist/pi/packages/ta-launcher/lib/react.js +8 -0
- package/dist/pi/packages/ta-launcher/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-launcher/lib/style.js +6 -4
- package/dist/pi/packages/ta-launcher/package.json +1 -1
- package/dist/pi/packages/ta-launcher/web/index.js +34 -17
- package/dist/pi/packages/ta-manual/README.en.md +10 -0
- package/dist/pi/packages/ta-manual/README.md +10 -0
- package/dist/pi/packages/ta-manual/lib/i18n.d.ts +15 -0
- package/dist/pi/packages/ta-manual/lib/i18n.js +31 -0
- package/dist/pi/packages/ta-manual/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-manual/lib/index.js +24 -0
- package/dist/pi/packages/ta-manual/lib/manual-util.d.ts +18 -0
- package/dist/pi/packages/ta-manual/lib/manual-util.js +40 -0
- package/dist/pi/packages/ta-manual/lib/manual-view.d.ts +9 -0
- package/dist/pi/packages/ta-manual/lib/manual-view.js +81 -0
- package/dist/pi/packages/ta-manual/lib/pictures-a.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-a.js +263 -0
- package/dist/pi/packages/ta-manual/lib/pictures-b.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-b.js +216 -0
- package/dist/pi/packages/ta-manual/lib/pictures-c.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-c.js +53 -0
- package/dist/pi/packages/ta-manual/lib/pictures.d.ts +9 -0
- package/dist/pi/packages/ta-manual/lib/pictures.js +17 -0
- package/dist/pi/packages/ta-manual/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-manual/lib/react.js +8 -0
- package/dist/pi/packages/ta-manual/lib/scene.d.ts +68 -0
- package/dist/pi/packages/ta-manual/lib/scene.js +115 -0
- package/dist/pi/packages/ta-manual/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-manual/lib/style.js +47 -0
- package/dist/pi/packages/ta-manual/lib/topics.d.ts +43 -0
- package/dist/pi/packages/ta-manual/lib/topics.js +388 -0
- package/dist/pi/packages/ta-manual/package.json +54 -0
- package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +130 -0
- package/dist/pi/packages/ta-manual/web/index.js +2408 -0
- package/dist/pi/packages/ta-notify/README.en.md +29 -0
- package/dist/pi/packages/ta-notify/README.md +29 -0
- package/dist/pi/packages/ta-notify/extension/index.mjs +259 -0
- package/dist/pi/packages/ta-notify/host/index.mjs +163 -0
- package/dist/pi/packages/ta-notify/lib/ask-card.d.ts +9 -0
- package/dist/pi/packages/ta-notify/lib/ask-card.js +40 -0
- package/dist/pi/packages/ta-notify/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-notify/lib/extension.js +102 -0
- package/dist/pi/packages/ta-notify/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-notify/lib/host.js +9 -0
- package/dist/pi/packages/ta-notify/lib/i18n.d.ts +31 -0
- package/dist/pi/packages/ta-notify/lib/i18n.js +63 -0
- package/dist/pi/packages/ta-notify/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-notify/lib/index.js +29 -0
- package/dist/pi/packages/ta-notify/lib/notify-protocol.d.ts +74 -0
- package/dist/pi/packages/ta-notify/lib/notify-protocol.js +23 -0
- package/dist/pi/packages/ta-notify/lib/notify-service.d.ts +21 -0
- package/dist/pi/packages/ta-notify/lib/notify-service.js +75 -0
- package/dist/pi/packages/ta-notify/lib/notify-util.d.ts +39 -0
- package/dist/pi/packages/ta-notify/lib/notify-util.js +119 -0
- package/dist/pi/packages/ta-notify/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-notify/lib/react.js +8 -0
- package/dist/pi/packages/ta-notify/lib/server-texts.d.ts +9 -0
- package/dist/pi/packages/ta-notify/lib/server-texts.js +22 -0
- package/dist/pi/packages/ta-notify/lib/settings.d.ts +8 -0
- package/dist/pi/packages/ta-notify/lib/settings.js +85 -0
- package/dist/pi/packages/ta-notify/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-notify/lib/style.js +29 -0
- package/dist/pi/packages/ta-notify/lib/tool-line.d.ts +9 -0
- package/dist/pi/packages/ta-notify/lib/tool-line.js +20 -0
- package/dist/pi/packages/ta-notify/lib/tool.d.ts +37 -0
- package/dist/pi/packages/ta-notify/lib/tool.js +46 -0
- package/dist/pi/packages/ta-notify/lib/watcher.d.ts +15 -0
- package/dist/pi/packages/ta-notify/lib/watcher.js +81 -0
- package/dist/pi/packages/ta-notify/package.json +55 -0
- package/dist/pi/packages/ta-notify/web/index.js +436 -0
- package/dist/pi/packages/ta-recall/README.en.md +19 -0
- package/dist/pi/packages/ta-recall/README.md +19 -0
- package/dist/pi/packages/ta-recall/extension/index.mjs +615 -0
- package/dist/pi/packages/ta-recall/host/index.mjs +820 -0
- package/dist/pi/packages/ta-recall/lib/brief-card.d.ts +21 -0
- package/dist/pi/packages/ta-recall/lib/brief-card.js +67 -0
- package/dist/pi/packages/ta-recall/lib/brief-home.d.ts +49 -0
- package/dist/pi/packages/ta-recall/lib/brief-home.js +143 -0
- package/dist/pi/packages/ta-recall/lib/brief-seen.d.ts +9 -0
- package/dist/pi/packages/ta-recall/lib/brief-seen.js +26 -0
- package/dist/pi/packages/ta-recall/lib/brief-util.d.ts +64 -0
- package/dist/pi/packages/ta-recall/lib/brief-util.js +179 -0
- package/dist/pi/packages/ta-recall/lib/chat-icons.d.ts +8 -0
- package/dist/pi/packages/ta-recall/lib/chat-icons.js +56 -0
- package/dist/pi/packages/ta-recall/lib/composer.d.ts +7 -0
- package/dist/pi/packages/ta-recall/lib/composer.js +38 -0
- package/dist/pi/packages/ta-recall/lib/conversation-index.d.ts +25 -0
- package/dist/pi/packages/ta-recall/lib/conversation-index.js +72 -0
- package/dist/pi/packages/ta-recall/lib/conversation-util.d.ts +16 -0
- package/dist/pi/packages/ta-recall/lib/conversation-util.js +109 -0
- package/dist/pi/packages/ta-recall/lib/conversations.d.ts +11 -0
- package/dist/pi/packages/ta-recall/lib/conversations.js +52 -0
- package/dist/pi/packages/ta-recall/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-recall/lib/extension.js +132 -0
- package/dist/pi/packages/ta-recall/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-recall/lib/host.js +11 -0
- package/dist/pi/packages/ta-recall/lib/i18n.d.ts +41 -0
- package/dist/pi/packages/ta-recall/lib/i18n.js +83 -0
- package/dist/pi/packages/ta-recall/lib/index.d.ts +9 -0
- package/dist/pi/packages/ta-recall/lib/index.js +45 -0
- package/dist/pi/packages/ta-recall/lib/react.d.ts +11 -0
- package/dist/pi/packages/ta-recall/lib/react.js +16 -0
- package/dist/pi/packages/ta-recall/lib/recall-protocol.d.ts +186 -0
- package/dist/pi/packages/ta-recall/lib/recall-protocol.js +60 -0
- package/dist/pi/packages/ta-recall/lib/recall-service.d.ts +42 -0
- package/dist/pi/packages/ta-recall/lib/recall-service.js +241 -0
- package/dist/pi/packages/ta-recall/lib/search-source.d.ts +7 -0
- package/dist/pi/packages/ta-recall/lib/search-source.js +49 -0
- package/dist/pi/packages/ta-recall/lib/search-util.d.ts +30 -0
- package/dist/pi/packages/ta-recall/lib/search-util.js +167 -0
- package/dist/pi/packages/ta-recall/lib/server-texts.d.ts +7 -0
- package/dist/pi/packages/ta-recall/lib/server-texts.js +17 -0
- package/dist/pi/packages/ta-recall/lib/settings.d.ts +4 -0
- package/dist/pi/packages/ta-recall/lib/settings.js +77 -0
- package/dist/pi/packages/ta-recall/lib/skill-card.d.ts +9 -0
- package/dist/pi/packages/ta-recall/lib/skill-card.js +51 -0
- package/dist/pi/packages/ta-recall/lib/skill-util.d.ts +19 -0
- package/dist/pi/packages/ta-recall/lib/skill-util.js +110 -0
- package/dist/pi/packages/ta-recall/lib/stored.d.ts +5 -0
- package/dist/pi/packages/ta-recall/lib/stored.js +28 -0
- package/dist/pi/packages/ta-recall/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-recall/lib/style.js +48 -0
- package/dist/pi/packages/ta-recall/lib/tool-line.d.ts +10 -0
- package/dist/pi/packages/ta-recall/lib/tool-line.js +23 -0
- package/dist/pi/packages/ta-recall/lib/tool.d.ts +63 -0
- package/dist/pi/packages/ta-recall/lib/tool.js +71 -0
- package/dist/pi/packages/ta-recall/package.json +55 -0
- package/dist/pi/packages/ta-recall/web/index.js +1042 -0
- package/dist/pi/packages/ta-rooms/README.en.md +29 -0
- package/dist/pi/packages/ta-rooms/README.md +29 -0
- package/dist/pi/packages/ta-rooms/extension/index.mjs +362 -0
- package/dist/pi/packages/ta-rooms/host/index.mjs +966 -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.d.ts +39 -0
- package/dist/pi/packages/ta-rooms/lib/dialogs.js +235 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.d.ts +114 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.js +645 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.d.ts +85 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.js +172 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.d.ts +165 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.js +73 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.d.ts +99 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.js +180 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.d.ts +45 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.js +145 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.d.ts +34 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.js +223 -0
- package/dist/pi/packages/ta-rooms/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-rooms/lib/extension.js +176 -0
- package/dist/pi/packages/ta-rooms/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-rooms/lib/host.js +18 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +105 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.js +211 -0
- package/dist/pi/packages/ta-rooms/lib/index.d.ts +9 -0
- package/dist/pi/packages/ta-rooms/lib/index.js +106 -0
- package/dist/pi/packages/ta-rooms/lib/members-view.d.ts +3 -0
- package/dist/pi/packages/ta-rooms/lib/members-view.js +94 -0
- package/dist/pi/packages/ta-rooms/lib/page.d.ts +154 -0
- package/dist/pi/packages/ta-rooms/lib/page.js +400 -0
- package/dist/pi/packages/ta-rooms/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-rooms/lib/react.js +8 -0
- package/dist/pi/packages/ta-rooms/lib/room-view.d.ts +15 -0
- package/dist/pi/packages/ta-rooms/lib/room-view.js +168 -0
- 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 +14 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-page.js +217 -0
- package/dist/pi/packages/ta-rooms/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-rooms/lib/style.js +205 -0
- package/dist/pi/packages/ta-rooms/package.json +56 -0
- package/dist/pi/packages/ta-rooms/web/index.js +3165 -0
- package/dist/pi/packages/ta-share/README.en.md +27 -0
- package/dist/pi/packages/ta-share/README.md +27 -0
- package/dist/pi/packages/ta-share/extension/index.mjs +184 -0
- package/dist/pi/packages/ta-share/host/index.mjs +364 -0
- package/dist/pi/packages/ta-share/lib/extension.d.ts +15 -0
- package/dist/pi/packages/ta-share/lib/extension.js +115 -0
- package/dist/pi/packages/ta-share/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-share/lib/host.js +9 -0
- package/dist/pi/packages/ta-share/lib/i18n.d.ts +106 -0
- package/dist/pi/packages/ta-share/lib/i18n.js +213 -0
- package/dist/pi/packages/ta-share/lib/index.d.ts +9 -0
- package/dist/pi/packages/ta-share/lib/index.js +77 -0
- package/dist/pi/packages/ta-share/lib/page.d.ts +48 -0
- package/dist/pi/packages/ta-share/lib/page.js +105 -0
- package/dist/pi/packages/ta-share/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-share/lib/react.js +8 -0
- package/dist/pi/packages/ta-share/lib/server-texts.d.ts +14 -0
- package/dist/pi/packages/ta-share/lib/server-texts.js +52 -0
- package/dist/pi/packages/ta-share/lib/share-dialog.d.ts +18 -0
- package/dist/pi/packages/ta-share/lib/share-dialog.js +233 -0
- package/dist/pi/packages/ta-share/lib/share-protocol.d.ts +86 -0
- package/dist/pi/packages/ta-share/lib/share-protocol.js +30 -0
- package/dist/pi/packages/ta-share/lib/share-service.d.ts +50 -0
- package/dist/pi/packages/ta-share/lib/share-service.js +130 -0
- package/dist/pi/packages/ta-share/lib/shared-view.d.ts +18 -0
- package/dist/pi/packages/ta-share/lib/shared-view.js +225 -0
- package/dist/pi/packages/ta-share/lib/shares-page.d.ts +3 -0
- package/dist/pi/packages/ta-share/lib/shares-page.js +78 -0
- package/dist/pi/packages/ta-share/lib/snapshot.d.ts +30 -0
- package/dist/pi/packages/ta-share/lib/snapshot.js +195 -0
- package/dist/pi/packages/ta-share/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-share/lib/style.js +117 -0
- package/dist/pi/packages/ta-share/package.json +56 -0
- package/dist/pi/packages/ta-share/web/index.js +1224 -0
- package/dist/pi/packages/ta-workspace/README.md +1 -1
- package/dist/pi/packages/ta-workspace/README.zh-cn.md +1 -1
- package/dist/pi/packages/ta-workspace/lib/browser-common.d.ts +1 -1
- package/dist/pi/packages/ta-workspace/lib/browser-common.js +29 -30
- package/dist/pi/packages/ta-workspace/lib/browser-tool-line.d.ts +15 -0
- package/dist/pi/packages/ta-workspace/lib/browser-tool-line.js +70 -0
- package/dist/pi/packages/ta-workspace/lib/editors.js +29 -2
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +13 -2
- package/dist/pi/packages/ta-workspace/lib/i18n.js +29 -7
- package/dist/pi/packages/ta-workspace/lib/index.js +2 -0
- package/dist/pi/packages/ta-workspace/lib/preview.d.ts +10 -1
- package/dist/pi/packages/ta-workspace/lib/preview.js +136 -11
- package/dist/pi/packages/ta-workspace/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-workspace/lib/style.js +56 -40
- package/dist/pi/packages/ta-workspace/lib/terminal-sessions.d.ts +15 -4
- package/dist/pi/packages/ta-workspace/lib/terminal-sessions.js +31 -9
- package/dist/pi/packages/ta-workspace/lib/terminal.d.ts +3 -2
- package/dist/pi/packages/ta-workspace/lib/terminal.js +51 -21
- package/dist/pi/packages/ta-workspace/lib/util/preview.d.ts +27 -0
- package/dist/pi/packages/ta-workspace/lib/util/preview.js +74 -0
- package/dist/pi/packages/ta-workspace/lib/util/terminal.d.ts +5 -0
- package/dist/pi/packages/ta-workspace/lib/util/terminal.js +14 -0
- package/dist/pi/packages/ta-workspace/package.json +1 -1
- package/dist/pi/packages/ta-workspace/web/index.js +823 -341
- package/dist/public/assets/OrbitControls-DVf70a7w.js +1 -0
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-BmIko5tV.js → abnfDiagram-S7VZAUFO-BnqtcbpZ.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-XgsdQ7ul.js → architecture-WOLXFQ4H-BzPq1Ioe.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW--sVhMS03.js → architectureDiagram-YGSQEFNW-BsquO3a7.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-8f9b-9k2.js → blockDiagram-APKKGZFW-BQNYOEP4.js} +1 -1
- package/dist/public/assets/{browser-DOHZ0JCf.js → browser-DS711n7Y.js} +1 -1
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-CwYQ0Jfy.js → c4Diagram-KJ2TOQU5-D6e79Ycq.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-7Y9ezehi.js → chunk-6MUBBAK2-B-sgaPoU.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-CZIH4pWz.js → chunk-AXFCVDMN-D8pJKIg2.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-DsNATY2m.js → chunk-BG4553SI-86TL-vCz.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-CoXkfYE-.js → chunk-DQASFODM-CfUVuGjc.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-C5OLqki8.js → chunk-HFQBQIA3-Drm0FEYk.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-DMHuYGEF.js → chunk-KQLB2F66-BVFRADlC.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-BKeOttO1.js → chunk-KS47KZWR-DfyALEmP.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-D6zCwkk7.js → chunk-LEVMRMFU-DtJVzk2c.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-B5-QqcZg.js → chunk-M57EVK23-DTy27PHQ.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-DQrq3n0T.js → chunk-OY52VR5R-nSgn7jZg.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-j6ZT7EDR.js → chunk-QB3YPZ4I-CkSxO_X6.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-D5MXUO36.js → chunk-R3KSYZAL-Ck6iAjAL.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-DaBkw4dD.js → chunk-STOXU5M4-DQPHdSTh.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-vXcRfGci.js → chunk-TU62E6Q5-Bc2AbV2Y.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-CIh6H4Y2.js → chunk-X4PVCEUW-Cgpm0IXm.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-C_Vwv1FM.js → chunk-XXDRQBXY-CGE4eLpg.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-DccDWEJn.js → classDiagram-v2-L25IHNXF-4eQuDPEo.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-BX47lumZ.js → cose-bilkent-JH36ORCC-tDLCWq07.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dd40W2Jh.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-BE6WOGxW.js → cynefinDiagram-L36ESFBY-ByqcZ8x9.js} +1 -1
- package/dist/public/assets/{d3-selection-ZcE6yRN5.js → d3-selection-Bgn1374-.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-CE6SOOcN.js → dagre-SPEB5RXH-mCgr71mV.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-xC8VtiYL.js → diagram-3B7GL73J-DpYSwpQ0.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-4dmcBbjL.js → diagram-DNEMPZML-DMozUQzi.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-D14Yn3sQ.js → diagram-L3MUGCDN-Bk5Uf8PD.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-GxSXIhsK.js → diagram-LA4NIPWU-DFt5cPVK.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-Cm7Prlpc.js → diagram-MHCOC4E2-BkZZcKqK.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-mkUnnKFu.js → diagram-XPFHEONP-HEY6kyyN.js} +1 -1
- package/dist/public/assets/{dist-acJS-BlA.js → dist-Bj2CrKn7.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-m77ua3UQ.js → ebnfDiagram-UZSYDL2S-D4JvYyVb.js} +1 -1
- package/dist/public/assets/{editor.api-CljTm-EQ.js → editor.api-BpJFzYbl.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-DsQY1hw9.js → elk-XV6XMXQE-CT6qLJkF.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-CV8gJM0P.js → erDiagram-EYBAPDEH-BGng1goR.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-C1pymbUr.js → eventmodeling-K75KTNOO-Tt8O-Q1Z.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-uFzenfA3.js +1 -0
- package/dist/public/assets/{freemarker2-DYJXaMHN.js → freemarker2-Dd5ksoRn.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-CppxOWRh.js → ganttDiagram-23REXITY-Jl8VO_g2.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-D28I_jUc.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-CrQrZhcP.js → gitGraphDiagram-STJD7YCW-Be4qXALb.js} +1 -1
- package/dist/public/assets/{handlebars-DZCnH9e2.js → handlebars-4xabgUi4.js} +1 -1
- package/dist/public/assets/{html-DuzouNES.js → html-Dk3kt2w_.js} +1 -1
- package/dist/public/assets/{index-B7OYKvCE.js → index-Bx0c7eoh.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-5vIGEIq7.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-6pby19tQ.js → infoDiagram-KBXO4MBG-Coc0tdwb.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-Duf8c8rQ.js → ishikawaDiagram-M35NCXHK-CE_1VQCg.js} +1 -1
- package/dist/public/assets/{javascript-2d_L6cVd.js → javascript-DKLGqy6v.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-Dvv-xzNo.js → journeyDiagram-OPLOXDXO-CrolRZ_7.js} +1 -1
- package/dist/public/assets/{jsonMode-CFadYXyI.js → jsonMode-Chcs19_y.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-Dsk6F-TT.js → kanban-definition-BZKZHSQY-CjJj47De.js} +1 -1
- package/dist/public/assets/{liquid-Din4CF34.js → liquid-jff3p-Ji.js} +1 -1
- package/dist/public/assets/{mdx-DivDuCWI.js → mdx-DW4uRDfJ.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-BfCv4CYZ.js → mermaid-parser.core-XhQj6FvH.js} +3 -3
- package/dist/public/assets/{mermaid.core-DC20ZwJj.js → mermaid.core-OD4Atimg.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-DRZRrJU_.js → mindmap-definition-I2QAS2VK-DpGelVY7.js} +1 -1
- package/dist/public/assets/module-CrD0OHQp.js +1 -0
- package/dist/public/assets/module-DEBMgdtf.js +2273 -0
- package/dist/public/assets/{monaco-D1d6MOPe.js → monaco-BTVZP-tU.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-CBxQ5Mzy.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-DcGr3Tbk.js → pegDiagram-FD4XPPHP-CqcBmPfB.js} +1 -1
- package/dist/public/assets/phaser.esm-BxCDEWDb.js +3202 -0
- package/dist/public/assets/pie-XZMESJXO-DT5V3581.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-GF7pu6ch.js → pieDiagram-J4AKIIQI-CRir3beB.js} +1 -1
- package/dist/public/assets/{python-BQbTTTT5.js → python-BwW_0207.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-D-bcu7Ey.js → quadrantDiagram-XTYBLID2-DIY6gdcf.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-BAOovYEa.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-RZ2Rnwzh.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-BiBHsI-K.js → railroad-abnf-LNEFI6M7-XWNOzunl.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-zKjrfkHs.js → railroad-ebnf-DWYD2UWJ-CI0-j1Jz.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-DKuVn0GT.js → railroad-peg-JR7BVNR7-BVB_IaIG.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-Cyn-16mJ.js → railroadDiagram-MRQ6NCDL-CudwT6q2.js} +1 -1
- package/dist/public/assets/{razor-DiLk54O0.js → razor-DrjCyQqB.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-CwU2EBkW.js → requirementDiagram-Y7LWUY3S-CvRMeRqj.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-ajf00HyW.js → sankeyDiagram-WGJFYUXA-adxYCJKr.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-DiX_OIAw.js → sequenceDiagram-5NDRBG5M-lCRsoLUp.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-CV5bRqB7.js → stateDiagram-v2-FJ4FJNEA-DNst1BLg.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-BGQKSlj7.js → swimlanes-UMQ2AFYF-S_omrdvA.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-By5lnz4u.js +8 -0
- package/dist/public/assets/three.module-CeVBJVoU.js +4225 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-DhQoApff.js → timeline-definition-SEUHKTQE-_pMGrTE-.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-Cyb9N8KY.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-BkMo57pG.js +1 -0
- package/dist/public/assets/{typescript-COQ1g-up.js → typescript-0-z_OYCU.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-CmLFzjie.js → usecaseDiagram-AFA6YXN4-B2oJKi5Q.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-DOa6JR5K.js → vennDiagram-NNMJR3RB-inPs2Kkr.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-CSt-uQ-Y.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-BV7EEShp.js → wardleyDiagram-S7YFUSEH-DNhNHM7b.js} +1 -1
- package/dist/public/assets/{xml-BbvtjuaG.js → xml-BXPxQzKF.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-DtMpPbsq.js → xychartDiagram-GGNKY7IX-DJc93dNT.js} +1 -1
- package/dist/public/assets/{yaml-Bw8NFga9.js → yaml-CGmD9Rya.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/serve/index.mjs +6664 -2480
- package/package.json +32 -25
- package/dist/public/assets/cynefin-EF2NZ3EQ-MaI-3dMQ.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-shBnAQFk.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-BtQWboBz.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-CDSLjba_.js +0 -1
- package/dist/public/assets/module-BAQaY56j.js +0 -1
- package/dist/public/assets/module-DxRGg3ED.js +0 -1947
- package/dist/public/assets/packet-JDAUHWVQ-dYb4P9eU.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-CIompBnc.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-DiJl7BtK.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-B5cRBukM.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-DxXlavVT.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-BOP6mkZC.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-BJxuPMz3.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-jqlowjVL.js +0 -1
|
@@ -1,3 +1,88 @@
|
|
|
1
|
+
// ../ta-protocol/esm/common/redactor.js
|
|
2
|
+
var REDACTED = "[redacted]";
|
|
3
|
+
var WHOLE = [
|
|
4
|
+
/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g,
|
|
5
|
+
/\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}/g,
|
|
6
|
+
/\bgh[pousr]_[A-Za-z0-9]{30,}\b/g,
|
|
7
|
+
/\bgithub_pat_[A-Za-z0-9_]{40,}\b/g,
|
|
8
|
+
/\bglpat-[A-Za-z0-9_-]{20,}\b/g,
|
|
9
|
+
/\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g,
|
|
10
|
+
/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,
|
|
11
|
+
/\bAIza[0-9A-Za-z_-]{35}\b/g,
|
|
12
|
+
/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g
|
|
13
|
+
];
|
|
14
|
+
var NAMED = [
|
|
15
|
+
/(\bBearer\s+)[A-Za-z0-9._~+/-]{16,}=*/gi,
|
|
16
|
+
/(\b[A-Za-z0-9_.-]*(?:password|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|private[_-]?key)[A-Za-z0-9_.-]*["']?\s*[:=]\s*["']?)([^\s"'`,;]{6,})/gi,
|
|
17
|
+
/(:\/\/[^\s:/@]+:)([^\s@/]{3,})(@)/g
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
class Redactor {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.count = 0;
|
|
23
|
+
}
|
|
24
|
+
text(text) {
|
|
25
|
+
let out = text;
|
|
26
|
+
for (const pattern of WHOLE) {
|
|
27
|
+
out = out.replace(pattern, () => this.hide());
|
|
28
|
+
}
|
|
29
|
+
out = out.replace(NAMED[0], (_match, before) => before + this.hide());
|
|
30
|
+
out = out.replace(NAMED[1], (match, before, value) => Redactor.placeholder(value) ? match : before + this.hide());
|
|
31
|
+
out = out.replace(NAMED[2], (_match, before, _value, after) => before + this.hide() + after);
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
value(value, max) {
|
|
35
|
+
if (typeof value === "string") {
|
|
36
|
+
return Redactor.cut(this.text(value), max);
|
|
37
|
+
}
|
|
38
|
+
if (Array.isArray(value)) {
|
|
39
|
+
return value.map((item) => this.value(item, max));
|
|
40
|
+
}
|
|
41
|
+
if (value && typeof value === "object") {
|
|
42
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, this.value(item, max)]));
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
static cut(text, max) {
|
|
47
|
+
return text.length > max ? `${text.slice(0, max)}…` : text;
|
|
48
|
+
}
|
|
49
|
+
hide() {
|
|
50
|
+
this.count++;
|
|
51
|
+
return REDACTED;
|
|
52
|
+
}
|
|
53
|
+
static placeholder(value) {
|
|
54
|
+
return /^(?:\$|<|\{|\[redacted|process\.env|os\.environ|xxx|\*{3})/i.test(value) || /^(?:true|false|null|undefined|none|string|number)$/i.test(value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ../ta-relay/esm/common/relay-card.js
|
|
59
|
+
var RELAY_AGENT_KIND = "ta-agent";
|
|
60
|
+
var RelayAgentCards;
|
|
61
|
+
(function(RelayAgentCards2) {
|
|
62
|
+
const MAX_ROLE = 8000;
|
|
63
|
+
function parse(data) {
|
|
64
|
+
try {
|
|
65
|
+
const card = JSON.parse(typeof data === "string" ? data : new TextDecoder().decode(data));
|
|
66
|
+
if ((card === null || card === undefined ? undefined : card.v) !== 1 || typeof card.name !== "string" || !card.name.trim() || typeof card.role !== "string" || !card.role.trim()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const color = typeof card.color === "string" && /^#[0-9a-fA-F]{6}$/.test(card.color) ? card.color : undefined;
|
|
70
|
+
return {
|
|
71
|
+
v: 1,
|
|
72
|
+
name: card.name.trim().slice(0, 32),
|
|
73
|
+
role: card.role.trim().slice(0, MAX_ROLE),
|
|
74
|
+
mark: typeof card.mark === "string" && card.mark.trim() ? card.mark.trim().slice(0, 2) : card.name.trim().slice(0, 1).toUpperCase(),
|
|
75
|
+
...Number.isInteger(card.face) ? { face: card.face } : {},
|
|
76
|
+
...color ? { color } : {},
|
|
77
|
+
...typeof card.redacted === "number" && card.redacted > 0 ? { redacted: card.redacted } : {}
|
|
78
|
+
};
|
|
79
|
+
} catch (_a) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
RelayAgentCards2.parse = parse;
|
|
84
|
+
})(RelayAgentCards || (RelayAgentCards = {}));
|
|
85
|
+
|
|
1
86
|
// web-src/channels-model.ts
|
|
2
87
|
var NAME = "@celljs/ta-channels";
|
|
3
88
|
var AGENT_MARK = "one of the agents of Ta";
|
|
@@ -8,12 +93,10 @@ var Keys;
|
|
|
8
93
|
Keys.QUEUE = "queue";
|
|
9
94
|
Keys.WORKING = "working";
|
|
10
95
|
Keys.FOCUS = "focus";
|
|
11
|
-
Keys.
|
|
12
|
-
Keys.
|
|
96
|
+
Keys.ANSWERED = "answered";
|
|
97
|
+
Keys.CARDS = "cards";
|
|
13
98
|
Keys.MESSAGES = "messages/";
|
|
14
99
|
Keys.messages = (channelId) => `${Keys.MESSAGES}${channelId}`;
|
|
15
|
-
Keys.request = (id) => `${Keys.REQUESTS}${id}`;
|
|
16
|
-
Keys.result = (id) => `${Keys.RESULTS}${id}`;
|
|
17
100
|
})(Keys ||= {});
|
|
18
101
|
var USER = "user";
|
|
19
102
|
var TA = "ta";
|
|
@@ -27,6 +110,8 @@ var MAX_MEMBERS = 12;
|
|
|
27
110
|
var DEFAULT_ROLE = "You help the user with what they ask, as a colleague who takes on the work and does it.";
|
|
28
111
|
var CONTEXT_MESSAGES = 12;
|
|
29
112
|
var MAX_NAME = 32;
|
|
113
|
+
var MAX_NOTICE = 2000;
|
|
114
|
+
var NOTICE_HEADINGS = { zh: ["决定", "约定", "待办"], en: ["Decisions", "Conventions", "To do"] };
|
|
30
115
|
|
|
31
116
|
// web-src/channels-util.ts
|
|
32
117
|
var ChannelsUtil;
|
|
@@ -283,8 +368,8 @@ var ChannelsUtil;
|
|
|
283
368
|
return team.channels.filter((channel) => channel.by !== "ta");
|
|
284
369
|
}
|
|
285
370
|
ChannelsUtil.ownChannels = ownChannels;
|
|
286
|
-
function pinnedFirst(
|
|
287
|
-
return [...
|
|
371
|
+
function pinnedFirst(items) {
|
|
372
|
+
return [...items.filter((item) => item.pinned), ...items.filter((item) => !item.pinned)];
|
|
288
373
|
}
|
|
289
374
|
ChannelsUtil.pinnedFirst = pinnedFirst;
|
|
290
375
|
function removeChannel(team, ref) {
|
|
@@ -332,6 +417,11 @@ var ChannelsUtil;
|
|
|
332
417
|
if (input.keep === true) {
|
|
333
418
|
delete agent.temporary;
|
|
334
419
|
}
|
|
420
|
+
if (input.pinned === true) {
|
|
421
|
+
agent.pinned = true;
|
|
422
|
+
} else if (input.pinned !== undefined) {
|
|
423
|
+
delete agent.pinned;
|
|
424
|
+
}
|
|
335
425
|
if (input.cwd !== undefined) {
|
|
336
426
|
const cwd = typeof input.cwd === "string" && input.cwd.trim() ? input.cwd.trim() : undefined;
|
|
337
427
|
if (cwd !== before.cwd) {
|
|
@@ -442,16 +532,39 @@ var ChannelsUtil;
|
|
|
442
532
|
`You are ${agent.name}, ${AGENT_MARK}. Your role: ${agent.role}`,
|
|
443
533
|
"You work with the user, Ta and other agents in channels. A message for you starts with a <context> block: the channel, its members, the recent messages and who speaks to you; answer what follows the block.",
|
|
444
534
|
"Do the part of the work your role covers with your tools, then answer in a few sentences: your answer is posted to the channel as it is.",
|
|
445
|
-
"To hand work to another member, write @ and their name in your answer; name nobody when the work is done or you need the user."
|
|
535
|
+
"To hand work to another member, write @ and their name in your answer; name nobody when the work is done or you need the user.",
|
|
536
|
+
NOTICE_RULE
|
|
446
537
|
].join(`
|
|
447
538
|
`);
|
|
448
539
|
}
|
|
449
540
|
ChannelsUtil.systemPrompt = systemPrompt;
|
|
541
|
+
function setNotice(team, input) {
|
|
542
|
+
const before = channelOf(team, input.channel);
|
|
543
|
+
const text = typeof input.text === "string" ? input.text.replace(/\r\n/g, `
|
|
544
|
+
`).trim() : "";
|
|
545
|
+
if (text.length > MAX_NOTICE) {
|
|
546
|
+
throw new Error(`The notice is too long (${text.length} characters, ${MAX_NOTICE} at most): keep it short, and drop to-dos done long ago.`);
|
|
547
|
+
}
|
|
548
|
+
if (text === (before.notice?.text ?? "")) {
|
|
549
|
+
return { team, channel: before, before, changed: false };
|
|
550
|
+
}
|
|
551
|
+
const channel = { ...before };
|
|
552
|
+
if (text) {
|
|
553
|
+
channel.notice = { text, at: input.at ?? Date.now(), by: input.by };
|
|
554
|
+
} else {
|
|
555
|
+
delete channel.notice;
|
|
556
|
+
}
|
|
557
|
+
return { team: { ...team, channels: team.channels.map((other) => other.id === channel.id ? channel : other) }, channel, before, changed: true };
|
|
558
|
+
}
|
|
559
|
+
ChannelsUtil.setNotice = setNotice;
|
|
450
560
|
function prompt(team, channel, history, message, agent) {
|
|
451
561
|
const labels = { user: "user", ta: "Ta" };
|
|
452
562
|
const members = channel.members.map((id) => team.agents.find((other) => other.id === id)).filter((other) => !!other).map((other) => `@${other.name}${other.id === agent.id ? " (you)" : ""}: ${firstLine(other.role)}`);
|
|
453
|
-
const before = history.filter((item) => item.id !== message.id && !item.failed).slice(-CONTEXT_MESSAGES);
|
|
563
|
+
const before = history.filter((item) => item.id !== message.id && !item.failed && !item.notice).slice(-CONTEXT_MESSAGES);
|
|
454
564
|
const lines = [`[#${channel.name}]${channel.topic ? ` ${channel.topic}` : ""}`, "Members:", ...members.map((line) => `- ${line}`)];
|
|
565
|
+
if (channel.notice) {
|
|
566
|
+
lines.push("", "Notice of the channel (follow it; keep it with update_channel_notice):", channel.notice.text);
|
|
567
|
+
}
|
|
455
568
|
if (before.length > 0) {
|
|
456
569
|
lines.push("", "Recent messages:", ...before.map((item) => `${authorName(team, item.author, labels)}: ${item.text}`));
|
|
457
570
|
}
|
|
@@ -474,7 +587,8 @@ ${message.text}`;
|
|
|
474
587
|
}
|
|
475
588
|
const name = (id) => team.agents.find((agent) => agent.id === id)?.name ?? id;
|
|
476
589
|
const agents = team.agents.map((agent) => `- @${agent.name}: ${firstLine(agent.role)}`);
|
|
477
|
-
const channels = team.channels.map((channel) => `- #${channel.name}${channel.topic ? ` (${channel.topic})` : ""}: ${channel.members.map((id) => `@${name(id)}`).join(", ")}${channel.muted?.length ? `; muted by the user, answering nothing: ${channel.muted.map((id) => `@${name(id)}`).join(", ")}` : ""}`
|
|
590
|
+
const channels = team.channels.map((channel) => `- #${channel.name}${channel.topic ? ` (${channel.topic})` : ""}: ${channel.members.map((id) => `@${name(id)}`).join(", ")}${channel.muted?.length ? `; muted by the user, answering nothing: ${channel.muted.map((id) => `@${name(id)}`).join(", ")}` : ""}${channel.notice ? `
|
|
591
|
+
notice: ${channel.notice.text.replace(/\s+/g, " ").slice(0, 300)}` : ""}`);
|
|
478
592
|
return ["Agents:", ...agents, "", "Channels:", ...channels.length > 0 ? channels : ["none yet"]].join(`
|
|
479
593
|
`);
|
|
480
594
|
}
|
|
@@ -524,173 +638,105 @@ ${message.text}`;
|
|
|
524
638
|
`)[0];
|
|
525
639
|
}
|
|
526
640
|
})(ChannelsUtil ||= {});
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (!this.loading || again) {
|
|
563
|
-
this.loading = Promise.all([this.storage.get(Keys.TEAM), this.storage.get(Keys.WORKING)]).then(([team, working]) => this.update({ team: team ?? ChannelsUtil.emptyTeam(), working: working ?? {}, loaded: true }));
|
|
641
|
+
var NOTICE_RULE = [
|
|
642
|
+
"A channel may have a notice, in the <context> block: what its members decided, agreed and are to do. Follow it.",
|
|
643
|
+
`When the talk settles a decision or a convention, or adds, assigns or finishes a to-do, update it with update_channel_notice: the whole notice, short, under the headings ### ${NOTICE_HEADINGS.zh.join(" / ")} (### ${NOTICE_HEADINGS.en.join(" / ")} in English), in the language of the channel, to-dos as - [ ] or - [x] with who does them. The lead keeps it most; leave it for small talk.`
|
|
644
|
+
].join(`
|
|
645
|
+
`);
|
|
646
|
+
var NoticeUtil;
|
|
647
|
+
((NoticeUtil) => {
|
|
648
|
+
const PARTS = {
|
|
649
|
+
决定: "decisions",
|
|
650
|
+
decisions: "decisions",
|
|
651
|
+
约定: "conventions",
|
|
652
|
+
conventions: "conventions",
|
|
653
|
+
待办: "todo",
|
|
654
|
+
"to do": "todo",
|
|
655
|
+
todo: "todo",
|
|
656
|
+
"to-do": "todo"
|
|
657
|
+
};
|
|
658
|
+
function counts(text) {
|
|
659
|
+
const counts2 = { decisions: 0, conventions: 0, todo: 0, done: 0 };
|
|
660
|
+
let part;
|
|
661
|
+
for (const line of text.split(/\r?\n/)) {
|
|
662
|
+
const heading = /^\s*#{1,6}\s+(.+?)\s*#*\s*$/.exec(line) ?? /^\s*\*\*(.+?)\*\*\s*[::]?\s*$/.exec(line);
|
|
663
|
+
if (heading) {
|
|
664
|
+
part = PARTS[heading[1].replace(/[::]$/, "").trim().toLowerCase()];
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
const item = /^\s*(?:[-*+]|\d+[.)])\s+(\[( |x|X)\]\s+)?\S/.exec(line);
|
|
668
|
+
if (!part || !item) {
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
if (part === "todo" && item[2] && item[2] !== " ") {
|
|
672
|
+
counts2.done++;
|
|
673
|
+
} else {
|
|
674
|
+
counts2[part]++;
|
|
675
|
+
}
|
|
564
676
|
}
|
|
565
|
-
return
|
|
677
|
+
return counts2;
|
|
566
678
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
679
|
+
NoticeUtil.counts = counts;
|
|
680
|
+
function firstLine(text) {
|
|
681
|
+
for (const line of text.split(/\r?\n/)) {
|
|
682
|
+
const item = /^\s*(?:[-*+]|\d+[.)])\s+(?:\[[ xX]\]\s+)?(.+)$/.exec(line);
|
|
683
|
+
if (item) {
|
|
684
|
+
return item[1].replace(/[*_`~]+/g, "").trim();
|
|
685
|
+
}
|
|
571
686
|
}
|
|
572
|
-
|
|
573
|
-
this.update({ messages: { ...this.current.messages, [channelId]: messages } });
|
|
574
|
-
return messages;
|
|
575
|
-
}
|
|
576
|
-
async createAgent(input) {
|
|
577
|
-
const agent = await this.request({ kind: "createAgent", ...input });
|
|
578
|
-
await this.load(true);
|
|
579
|
-
return agent;
|
|
580
|
-
}
|
|
581
|
-
async createChannel(input) {
|
|
582
|
-
const channel = await this.request({ kind: "createChannel", ...input });
|
|
583
|
-
await this.load(true);
|
|
584
|
-
return channel;
|
|
585
|
-
}
|
|
586
|
-
async addMembers(channelId, members) {
|
|
587
|
-
const channel = await this.request({ kind: "addMembers", channel: channelId, members });
|
|
588
|
-
await this.load(true);
|
|
589
|
-
return channel;
|
|
590
|
-
}
|
|
591
|
-
async changeMember(channelId, agentId, change) {
|
|
592
|
-
const channel = await this.request({ kind: "changeMember", channel: channelId, agent: agentId, change });
|
|
593
|
-
await this.load(true);
|
|
594
|
-
return channel;
|
|
595
|
-
}
|
|
596
|
-
async updateChannel(channelId, change) {
|
|
597
|
-
const channel = await this.request({ kind: "updateChannel", channel: channelId, ...change });
|
|
598
|
-
await this.load(true);
|
|
599
|
-
return channel;
|
|
687
|
+
return text.split(/\r?\n/).find((line) => line.trim() && !/^\s*#/.test(line))?.trim() ?? "";
|
|
600
688
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
async openAgent(agentId) {
|
|
622
|
-
const { sessionId } = await this.request({ kind: "openAgent", agent: agentId });
|
|
623
|
-
return sessionId;
|
|
689
|
+
NoticeUtil.firstLine = firstLine;
|
|
690
|
+
})(NoticeUtil ||= {});
|
|
691
|
+
|
|
692
|
+
// web-src/agent-cards.ts
|
|
693
|
+
var AgentCards;
|
|
694
|
+
((AgentCards) => {
|
|
695
|
+
AgentCards.KIND = RELAY_AGENT_KIND;
|
|
696
|
+
AgentCards.MARK = "[ta-channels:card]";
|
|
697
|
+
function card(agent, color) {
|
|
698
|
+
const redactor = new Redactor;
|
|
699
|
+
const role = redactor.text(agent.role);
|
|
700
|
+
return {
|
|
701
|
+
v: 1,
|
|
702
|
+
name: agent.name,
|
|
703
|
+
role,
|
|
704
|
+
mark: agent.mark,
|
|
705
|
+
...agent.face !== undefined ? { face: agent.face } : {},
|
|
706
|
+
...color && /^#[0-9a-fA-F]{6}$/.test(color) ? { color } : {},
|
|
707
|
+
...redactor.count ? { redacted: redactor.count } : {}
|
|
708
|
+
};
|
|
624
709
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
request(request) {
|
|
629
|
-
const id = ChannelsUtil.newId("request");
|
|
630
|
-
const result = new Promise((resolve, reject) => {
|
|
631
|
-
const timer = setTimeout(() => {
|
|
632
|
-
this.pending.delete(id);
|
|
633
|
-
reject(new Error("The Ta service did not answer: the extension may be off, or the service still starting."));
|
|
634
|
-
}, this.options.timeoutMs);
|
|
635
|
-
this.pending.set(id, { resolve, reject, timer });
|
|
636
|
-
});
|
|
637
|
-
return this.storage.set(Keys.request(id), request).then(() => {
|
|
638
|
-
this.take(id);
|
|
639
|
-
return result;
|
|
640
|
-
});
|
|
710
|
+
AgentCards.card = card;
|
|
711
|
+
function parse(data) {
|
|
712
|
+
return RelayAgentCards.parse(data);
|
|
641
713
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
const pending = this.pending.get(id);
|
|
648
|
-
if (!result || !pending) {
|
|
649
|
-
return;
|
|
714
|
+
AgentCards.parse = parse;
|
|
715
|
+
function freeName(team, name) {
|
|
716
|
+
const base = (name.trim().replace(/\s+/g, "-") || "agent").slice(0, MAX_NAME - 3);
|
|
717
|
+
if (!ChannelsUtil.findAgent(team, base)) {
|
|
718
|
+
return base;
|
|
650
719
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
return;
|
|
655
|
-
});
|
|
656
|
-
if (result.ok) {
|
|
657
|
-
pending.resolve(result.value);
|
|
658
|
-
} else {
|
|
659
|
-
pending.reject(new Error(result.error));
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
async changed(keys) {
|
|
663
|
-
const reads = [];
|
|
664
|
-
for (const key of keys) {
|
|
665
|
-
if (key === Keys.TEAM || key === Keys.WORKING) {
|
|
666
|
-
reads.push(this.load(true));
|
|
667
|
-
} else if (key.startsWith(Keys.MESSAGES)) {
|
|
668
|
-
const channelId = key.slice(Keys.MESSAGES.length);
|
|
669
|
-
if (this.current.messages[channelId]) {
|
|
670
|
-
reads.push(this.messages(channelId, true));
|
|
671
|
-
}
|
|
672
|
-
} else if (key.startsWith(Keys.RESULTS)) {
|
|
673
|
-
reads.push(this.take(key.slice(Keys.RESULTS.length)));
|
|
674
|
-
} else if (key === Keys.FOCUS) {
|
|
675
|
-
reads.push(this.storage.get(Keys.FOCUS).then(async (focus) => {
|
|
676
|
-
if (focus) {
|
|
677
|
-
await this.load(true);
|
|
678
|
-
for (const listener of this.focusListeners) {
|
|
679
|
-
listener(focus.channelId);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}));
|
|
720
|
+
for (let n = 2;; n++) {
|
|
721
|
+
if (!ChannelsUtil.findAgent(team, `${base}-${n}`)) {
|
|
722
|
+
return `${base}-${n}`;
|
|
683
723
|
}
|
|
684
724
|
}
|
|
685
|
-
await Promise.all(reads).catch((error) => console.error(error));
|
|
686
725
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
726
|
+
AgentCards.freeName = freeName;
|
|
727
|
+
function adapt(cwd, zh) {
|
|
728
|
+
const context = [
|
|
729
|
+
AgentCards.MARK,
|
|
730
|
+
`You were just added to this Ta from a card someone shared: the role in your instructions is theirs, written for their own work. Fit it to the project of your directory (${cwd}): look at it first (its README, manifests such as package.json, its layout, how it builds and tests), then rewrite your role for it, keeping what you are for, and save it with update_my_role. Then tell the user in a few sentences, in ${zh ? "Chinese" : "English"}, what you changed and what you can do here. Change no files.`
|
|
731
|
+
].join(`
|
|
732
|
+
`);
|
|
733
|
+
return `<context>
|
|
734
|
+
${context}
|
|
735
|
+
</context>
|
|
736
|
+
${zh ? "看看这个项目,把你的职责调整得贴合这里" : "Look at this project and fit your role to it"}`;
|
|
692
737
|
}
|
|
693
|
-
|
|
738
|
+
AgentCards.adapt = adapt;
|
|
739
|
+
})(AgentCards ||= {});
|
|
694
740
|
|
|
695
741
|
// web-src/react.ts
|
|
696
742
|
var React;
|
|
@@ -979,6 +1025,9 @@ function shape(face, look) {
|
|
|
979
1025
|
});
|
|
980
1026
|
}
|
|
981
1027
|
}
|
|
1028
|
+
function faceColor(face) {
|
|
1029
|
+
return (LOOKS[face] ?? LOOKS[0]).color;
|
|
1030
|
+
}
|
|
982
1031
|
function Face({ face, size, working }) {
|
|
983
1032
|
const look = LOOKS[face] ?? LOOKS[0];
|
|
984
1033
|
const half = look.gap / 2;
|
|
@@ -1087,6 +1136,7 @@ var EN = {
|
|
|
1087
1136
|
agents: "Agents",
|
|
1088
1137
|
newChannel: "New channel",
|
|
1089
1138
|
newAgent: "New agent",
|
|
1139
|
+
scan: "Scan",
|
|
1090
1140
|
name: "Name",
|
|
1091
1141
|
role: "Role",
|
|
1092
1142
|
rolePlaceholder: "What it does and how, as instructions to it",
|
|
@@ -1189,6 +1239,7 @@ var EN = {
|
|
|
1189
1239
|
stoppedChannel: "Stopped the members answering in #{channel}.",
|
|
1190
1240
|
noMessagesToExport: "#{channel} has no messages yet.",
|
|
1191
1241
|
yourTurn: "Your turn",
|
|
1242
|
+
needsYou: "Waiting for you",
|
|
1192
1243
|
building: "Building the team…",
|
|
1193
1244
|
openInMain: "Open in the main area",
|
|
1194
1245
|
openInMainHint: "Talk to the team yourself",
|
|
@@ -1211,7 +1262,57 @@ var EN = {
|
|
|
1211
1262
|
noTasksHere: "What the double hands out, tasks and teams, is listed here",
|
|
1212
1263
|
deleteTask: "Delete the team",
|
|
1213
1264
|
deleteTaskHint: "The messages of #{channel} go with it. Its agents stay, among your members.",
|
|
1214
|
-
selectTasks: "Select"
|
|
1265
|
+
selectTasks: "Select",
|
|
1266
|
+
toolCreateAgent: "Create agent",
|
|
1267
|
+
toolCreateChannel: "Create channel",
|
|
1268
|
+
toolAddToChannel: "Add to channel",
|
|
1269
|
+
toolPostToChannel: "Post to",
|
|
1270
|
+
toolHandOff: "Hand over to",
|
|
1271
|
+
handOff: "Hand over to…",
|
|
1272
|
+
handOffDetail: "An agent or a channel goes on with it",
|
|
1273
|
+
handedTo: "Handed over to {to}",
|
|
1274
|
+
handOffOpen: "Open",
|
|
1275
|
+
toolListChannels: "Look over the team",
|
|
1276
|
+
notice: "Notice",
|
|
1277
|
+
noticeCounts: "{decisions} decided · {conventions} agreed · {todo} to do",
|
|
1278
|
+
noticeEmpty: "No notice yet",
|
|
1279
|
+
noticeBy: "{name} updated it {time}",
|
|
1280
|
+
noticeEdit: "Edit the notice",
|
|
1281
|
+
noticeTemplate: `### Decisions
|
|
1282
|
+
-
|
|
1283
|
+
|
|
1284
|
+
### Conventions
|
|
1285
|
+
-
|
|
1286
|
+
|
|
1287
|
+
### To do
|
|
1288
|
+
- [ ] `,
|
|
1289
|
+
noticeHint: "What this channel decided, agreed and is to do: every member reads it with each message and follows it. Members keep it up to date as the talk settles things.",
|
|
1290
|
+
noticeUpdated: "{name} updated the notice",
|
|
1291
|
+
noticeCleared: "{name} took the notice down",
|
|
1292
|
+
noticeShow: "Show the notice",
|
|
1293
|
+
noticeHide: "Hide the notice",
|
|
1294
|
+
noticeSaved: "Notice saved",
|
|
1295
|
+
toolNotice: "Update the notice",
|
|
1296
|
+
toolRole: "Update its role",
|
|
1297
|
+
shareCard: "Share card…",
|
|
1298
|
+
cardTitle: "{name}'s card",
|
|
1299
|
+
cardKind: "An agent's card",
|
|
1300
|
+
cardMaking: "Making the link…",
|
|
1301
|
+
cardHint: "Whoever opens it in Ta, by scanning or pasting, adds it as an agent of theirs, which first fits its role to their project. Its role goes, with secrets taken out; not its directory nor its conversation. The link works for 30 days, while this computer is off too.",
|
|
1302
|
+
cardRedacted: "{n} places that looked like secrets were taken out.",
|
|
1303
|
+
copyLink: "Copy link",
|
|
1304
|
+
linkCopied: "Copied",
|
|
1305
|
+
sendLink: "Send",
|
|
1306
|
+
stopCard: "Stop sharing",
|
|
1307
|
+
cardStopped: "The link of the card no longer works.",
|
|
1308
|
+
cardOpening: "Opening the card…",
|
|
1309
|
+
cardAddTo: "Works in {dir}",
|
|
1310
|
+
cardChangeDir: "Change",
|
|
1311
|
+
cardAdd: "Add as my agent",
|
|
1312
|
+
cardAddHint: "It looks at the project there first and fits its role to it; you see what it changed in its conversation.",
|
|
1313
|
+
cardAdded: "Added as @{name}",
|
|
1314
|
+
cardOpen: "Open the conversation",
|
|
1315
|
+
cardFailed: "Could not open the card: {message}"
|
|
1215
1316
|
};
|
|
1216
1317
|
var ZH = {
|
|
1217
1318
|
title: "分身",
|
|
@@ -1219,6 +1320,7 @@ var ZH = {
|
|
|
1219
1320
|
agents: "智能体",
|
|
1220
1321
|
newChannel: "新建频道",
|
|
1221
1322
|
newAgent: "新建智能体",
|
|
1323
|
+
scan: "扫一扫",
|
|
1222
1324
|
name: "名字",
|
|
1223
1325
|
role: "职责",
|
|
1224
1326
|
rolePlaceholder: "它做什么、怎么做,写成给它的指示",
|
|
@@ -1321,6 +1423,7 @@ var ZH = {
|
|
|
1321
1423
|
stoppedChannel: "已让 #{channel} 里正在回答的成员停下。",
|
|
1322
1424
|
noMessagesToExport: "#{channel} 还没有消息。",
|
|
1323
1425
|
yourTurn: "轮到你了",
|
|
1426
|
+
needsYou: "等你处理",
|
|
1324
1427
|
building: "正在组建团队…",
|
|
1325
1428
|
openInMain: "在主区打开",
|
|
1326
1429
|
openInMainHint: "亲自和团队对话",
|
|
@@ -1343,7 +1446,57 @@ var ZH = {
|
|
|
1343
1446
|
noTasksHere: "分身交出去的任务和团队会列在这里",
|
|
1344
1447
|
deleteTask: "删除这个团队",
|
|
1345
1448
|
deleteTaskHint: "#{channel} 的消息会一起删除,团队成员会留在你的成员里。",
|
|
1346
|
-
selectTasks: "多选"
|
|
1449
|
+
selectTasks: "多选",
|
|
1450
|
+
toolCreateAgent: "新建智能体",
|
|
1451
|
+
toolCreateChannel: "新建频道",
|
|
1452
|
+
toolAddToChannel: "拉进频道",
|
|
1453
|
+
toolPostToChannel: "发到频道",
|
|
1454
|
+
toolHandOff: "交给",
|
|
1455
|
+
handOff: "交给…",
|
|
1456
|
+
handOffDetail: "让智能体或频道接着做",
|
|
1457
|
+
handedTo: "已交给 {to}",
|
|
1458
|
+
handOffOpen: "打开",
|
|
1459
|
+
toolListChannels: "查看团队",
|
|
1460
|
+
notice: "公告",
|
|
1461
|
+
noticeCounts: "决定 {decisions} · 约定 {conventions} · 待办 {todo}",
|
|
1462
|
+
noticeEmpty: "还没有公告",
|
|
1463
|
+
noticeBy: "{name} {time} 更新",
|
|
1464
|
+
noticeEdit: "编辑公告",
|
|
1465
|
+
noticeTemplate: `### 决定
|
|
1466
|
+
-
|
|
1467
|
+
|
|
1468
|
+
### 约定
|
|
1469
|
+
-
|
|
1470
|
+
|
|
1471
|
+
### 待办
|
|
1472
|
+
- [ ] `,
|
|
1473
|
+
noticeHint: "这个频道定下的事、约定和待办:每个成员每次回答都会读到并照着做,讨论定下新的事时成员会自己更新。",
|
|
1474
|
+
noticeUpdated: "{name} 更新了公告",
|
|
1475
|
+
noticeCleared: "{name} 撤下了公告",
|
|
1476
|
+
noticeShow: "展开公告",
|
|
1477
|
+
noticeHide: "收起公告",
|
|
1478
|
+
noticeSaved: "公告已保存",
|
|
1479
|
+
toolNotice: "更新公告",
|
|
1480
|
+
toolRole: "更新职责",
|
|
1481
|
+
shareCard: "分享名片…",
|
|
1482
|
+
cardTitle: "{name} 的名片",
|
|
1483
|
+
cardKind: "智能体名片",
|
|
1484
|
+
cardMaking: "正在生成链接…",
|
|
1485
|
+
cardHint: "对方在 Ta 里扫码或粘贴链接,就能把它加为自己的智能体,加进来时它会先按对方的项目调整职责。只带上职责(隐去疑似密钥),不带工作目录和对话。链接 30 天内有效,你的电脑关机也能打开。",
|
|
1486
|
+
cardRedacted: "职责里有 {n} 处疑似密钥已隐去。",
|
|
1487
|
+
copyLink: "复制链接",
|
|
1488
|
+
linkCopied: "已复制",
|
|
1489
|
+
sendLink: "发送",
|
|
1490
|
+
stopCard: "停止分享",
|
|
1491
|
+
cardStopped: "名片链接已失效。",
|
|
1492
|
+
cardOpening: "正在打开名片…",
|
|
1493
|
+
cardAddTo: "工作目录:{dir}",
|
|
1494
|
+
cardChangeDir: "更改",
|
|
1495
|
+
cardAdd: "加为我的智能体",
|
|
1496
|
+
cardAddHint: "加进来后它会先看看这个目录下的项目,把职责调整得贴合这里;改了什么会在它的对话里告诉你。",
|
|
1497
|
+
cardAdded: "已添加为 @{name}",
|
|
1498
|
+
cardOpen: "打开对话",
|
|
1499
|
+
cardFailed: "打不开这张名片:{message}"
|
|
1347
1500
|
};
|
|
1348
1501
|
var ChannelWords;
|
|
1349
1502
|
((ChannelWords) => {
|
|
@@ -1491,6 +1644,20 @@ function useServerCwd(pi) {
|
|
|
1491
1644
|
}
|
|
1492
1645
|
var SidebarUtil;
|
|
1493
1646
|
((SidebarUtil) => {
|
|
1647
|
+
function homeSections(items) {
|
|
1648
|
+
const sections = new Map;
|
|
1649
|
+
for (const item of items) {
|
|
1650
|
+
if (!item.section) {
|
|
1651
|
+
continue;
|
|
1652
|
+
}
|
|
1653
|
+
const id = `home:${item.extension ?? ""}:${item.section}`;
|
|
1654
|
+
const section = sections.get(id) ?? { id, title: item.section, items: [] };
|
|
1655
|
+
section.items.push(item);
|
|
1656
|
+
sections.set(id, section);
|
|
1657
|
+
}
|
|
1658
|
+
return [...sections.values()];
|
|
1659
|
+
}
|
|
1660
|
+
SidebarUtil.homeSections = homeSections;
|
|
1494
1661
|
function needsLook(task, seen) {
|
|
1495
1662
|
if (task.status === "waiting") {
|
|
1496
1663
|
return true;
|
|
@@ -1502,42 +1669,66 @@ var SidebarUtil;
|
|
|
1502
1669
|
}
|
|
1503
1670
|
SidebarUtil.needsLook = needsLook;
|
|
1504
1671
|
function answering(agents, sessions, opened) {
|
|
1505
|
-
|
|
1672
|
+
return agentsOf(agents, sessions, opened, (session) => session.isStreaming);
|
|
1673
|
+
}
|
|
1674
|
+
SidebarUtil.answering = answering;
|
|
1675
|
+
function waiting(agents, sessions, opened) {
|
|
1676
|
+
return agentsOf(agents, sessions, opened, (session) => !!session.waiting);
|
|
1677
|
+
}
|
|
1678
|
+
SidebarUtil.waiting = waiting;
|
|
1679
|
+
function agentsOf(agents, sessions, opened, test) {
|
|
1680
|
+
const found = new Set;
|
|
1506
1681
|
for (const session of sessions) {
|
|
1507
|
-
if (!session
|
|
1682
|
+
if (!test(session)) {
|
|
1508
1683
|
continue;
|
|
1509
1684
|
}
|
|
1510
1685
|
const agent = agents.find((candidate) => !!session.sessionFile && candidate.sessionFile === session.sessionFile || opened.get(candidate.id) === session.sessionId);
|
|
1511
1686
|
if (agent) {
|
|
1512
|
-
|
|
1687
|
+
found.add(agent.id);
|
|
1513
1688
|
}
|
|
1514
1689
|
}
|
|
1515
|
-
return
|
|
1690
|
+
return found;
|
|
1516
1691
|
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
function toLook(marks, before, now, shown, at, known) {
|
|
1524
|
-
const next = { ...marks };
|
|
1525
|
-
let changed = false;
|
|
1526
|
-
for (const id of before.own) {
|
|
1527
|
-
if (id !== shown && !now.own.includes(id) && !now.channel.includes(id)) {
|
|
1528
|
-
next[id] = at;
|
|
1529
|
-
changed = true;
|
|
1692
|
+
function mergeSeen(a, b) {
|
|
1693
|
+
const since = a.since && b.since ? Math.max(a.since, b.since) : a.since || b.since;
|
|
1694
|
+
const at = { ...a.at };
|
|
1695
|
+
for (const [key, time2] of Object.entries(b.at)) {
|
|
1696
|
+
if (time2 > (at[key] ?? 0)) {
|
|
1697
|
+
at[key] = time2;
|
|
1530
1698
|
}
|
|
1531
1699
|
}
|
|
1532
|
-
for (const
|
|
1533
|
-
if (
|
|
1534
|
-
delete
|
|
1535
|
-
changed = true;
|
|
1700
|
+
for (const [key, time2] of Object.entries(at)) {
|
|
1701
|
+
if (time2 <= since) {
|
|
1702
|
+
delete at[key];
|
|
1536
1703
|
}
|
|
1537
1704
|
}
|
|
1538
|
-
|
|
1705
|
+
const same = since === a.since && Object.keys(at).length === Object.keys(a.at).length && Object.entries(at).every(([key, time2]) => a.at[key] === time2);
|
|
1706
|
+
return same ? a : { since, at };
|
|
1539
1707
|
}
|
|
1540
|
-
SidebarUtil.
|
|
1708
|
+
SidebarUtil.mergeSeen = mergeSeen;
|
|
1709
|
+
function look(seen, key, at, kept) {
|
|
1710
|
+
if ((seen.at[key] ?? seen.since) >= at) {
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
const others = kept ? Object.entries(seen.at).filter(([other]) => kept(other)) : Object.entries(seen.at);
|
|
1714
|
+
return { since: seen.since, at: { ...Object.fromEntries(others), [key]: at } };
|
|
1715
|
+
}
|
|
1716
|
+
SidebarUtil.look = look;
|
|
1717
|
+
function lastAt(agent, sessions, opened) {
|
|
1718
|
+
let latest;
|
|
1719
|
+
for (const session of sessions) {
|
|
1720
|
+
const its = !!agent.sessionFile && session.sessionFile === agent.sessionFile || !!session.sessionId && opened.get(agent.id) === session.sessionId;
|
|
1721
|
+
if (its && session.updatedAt > (latest ?? 0)) {
|
|
1722
|
+
latest = session.updatedAt;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
return latest;
|
|
1726
|
+
}
|
|
1727
|
+
SidebarUtil.lastAt = lastAt;
|
|
1728
|
+
function unseen(latest, seen, key, inChannel = 0) {
|
|
1729
|
+
return !!seen && seen.since > 0 && latest !== undefined && latest > Math.max(seen.at[key] ?? seen.since, inChannel);
|
|
1730
|
+
}
|
|
1731
|
+
SidebarUtil.unseen = unseen;
|
|
1541
1732
|
function lastLines(agents, messages, sessions) {
|
|
1542
1733
|
const lines = new Map;
|
|
1543
1734
|
const keep = (id, text, at) => {
|
|
@@ -1598,44 +1789,429 @@ var SidebarUtil;
|
|
|
1598
1789
|
ended: tasks.filter((task) => task.status !== "waiting" && task.status !== "running").sort((a, b) => (b.endedAt ?? b.startedAt) - (a.endedAt ?? a.startedAt))
|
|
1599
1790
|
};
|
|
1600
1791
|
}
|
|
1601
|
-
SidebarUtil.taskGroups = taskGroups;
|
|
1602
|
-
function memberGroups(agents, serverCwd, grouped) {
|
|
1603
|
-
return grouped && directories(agents, serverCwd) > 1 ? byDirectory(agents, serverCwd) : [{ agents }];
|
|
1792
|
+
SidebarUtil.taskGroups = taskGroups;
|
|
1793
|
+
function memberGroups(agents, serverCwd, grouped) {
|
|
1794
|
+
return grouped && directories(agents, serverCwd) > 1 ? byDirectory(agents, serverCwd) : [{ agents }];
|
|
1795
|
+
}
|
|
1796
|
+
SidebarUtil.memberGroups = memberGroups;
|
|
1797
|
+
function directories(agents, serverCwd) {
|
|
1798
|
+
return new Set(agents.map((agent) => agent.cwd ?? serverCwd)).size;
|
|
1799
|
+
}
|
|
1800
|
+
SidebarUtil.directories = directories;
|
|
1801
|
+
function byDirectory(agents, serverCwd) {
|
|
1802
|
+
const groups = new Map;
|
|
1803
|
+
for (const agent of agents) {
|
|
1804
|
+
const cwd = agent.cwd ?? serverCwd;
|
|
1805
|
+
groups.set(cwd, [...groups.get(cwd) ?? [], agent]);
|
|
1806
|
+
}
|
|
1807
|
+
return [...groups].map(([cwd, list]) => ({ cwd, agents: list }));
|
|
1808
|
+
}
|
|
1809
|
+
SidebarUtil.byDirectory = byDirectory;
|
|
1810
|
+
})(SidebarUtil ||= {});
|
|
1811
|
+
function useSubmit(action, onDone) {
|
|
1812
|
+
const [busy, setBusy] = React.useState(false);
|
|
1813
|
+
const [error, setError] = React.useState();
|
|
1814
|
+
return {
|
|
1815
|
+
busy,
|
|
1816
|
+
error,
|
|
1817
|
+
submit: (event) => {
|
|
1818
|
+
event?.preventDefault();
|
|
1819
|
+
setBusy(true);
|
|
1820
|
+
setError(undefined);
|
|
1821
|
+
action().then(() => {
|
|
1822
|
+
setBusy(false);
|
|
1823
|
+
onDone();
|
|
1824
|
+
}, (failure) => {
|
|
1825
|
+
setBusy(false);
|
|
1826
|
+
setError(ChannelViews.message(failure));
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
// web-src/card.tsx
|
|
1833
|
+
var CardLink;
|
|
1834
|
+
((CardLink) => {
|
|
1835
|
+
const LINK = /^https?:\/\/[^/\s#?]+\/s#v=1&\S+$/i;
|
|
1836
|
+
function is(text) {
|
|
1837
|
+
const trimmed = text.trim();
|
|
1838
|
+
return LINK.test(trimmed) && new URLSearchParams(trimmed.slice(trimmed.indexOf("#") + 1)).get("c") === AgentCards.KIND;
|
|
1839
|
+
}
|
|
1840
|
+
CardLink.is = is;
|
|
1841
|
+
function id(text) {
|
|
1842
|
+
return new URLSearchParams(text.slice(text.indexOf("#") + 1)).get("s") ?? text;
|
|
1843
|
+
}
|
|
1844
|
+
CardLink.id = id;
|
|
1845
|
+
})(CardLink ||= {});
|
|
1846
|
+
function baseName(path) {
|
|
1847
|
+
return path.replace(/[\\/]+$/, "").split(/[\\/]/).pop() || path;
|
|
1848
|
+
}
|
|
1849
|
+
function CardFace({ pi, card }) {
|
|
1850
|
+
const w = ChannelViews.words(pi);
|
|
1851
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1852
|
+
className: "tac-card-who"
|
|
1853
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1854
|
+
className: "tac-card-face"
|
|
1855
|
+
}, card.face !== undefined ? /* @__PURE__ */ React.createElement(Face, {
|
|
1856
|
+
face: card.face,
|
|
1857
|
+
size: 56
|
|
1858
|
+
}) : /* @__PURE__ */ React.createElement("span", {
|
|
1859
|
+
className: "tac-card-mark"
|
|
1860
|
+
}, card.mark)), /* @__PURE__ */ React.createElement("strong", {
|
|
1861
|
+
className: "tac-card-name"
|
|
1862
|
+
}, "@", card.name), /* @__PURE__ */ React.createElement("span", {
|
|
1863
|
+
className: "tac-card-kind"
|
|
1864
|
+
}, w.cardKind));
|
|
1865
|
+
}
|
|
1866
|
+
function CardDialog({ context, agent, onClose }) {
|
|
1867
|
+
const { pi, service } = context;
|
|
1868
|
+
const w = ChannelViews.words(pi);
|
|
1869
|
+
const [share, setShare] = React.useState();
|
|
1870
|
+
const [error, setError] = React.useState();
|
|
1871
|
+
const [copied, setCopied] = React.useState(false);
|
|
1872
|
+
const [stopping, setStopping] = React.useState(false);
|
|
1873
|
+
const card = React.useMemo(() => AgentCards.card(agent), [agent]);
|
|
1874
|
+
React.useEffect(() => {
|
|
1875
|
+
let live = true;
|
|
1876
|
+
service.shareAgent(agent.id, agent.face !== undefined ? faceColor(agent.face) : undefined).then((made) => live && setShare(made), (failure) => live && setError(ChannelViews.message(failure)));
|
|
1877
|
+
return () => {
|
|
1878
|
+
live = false;
|
|
1879
|
+
};
|
|
1880
|
+
}, [service, agent]);
|
|
1881
|
+
const Copy = ChannelViews.icon(pi, copied ? "Check" : "Copy");
|
|
1882
|
+
const Send = ChannelViews.icon(pi, "Share2");
|
|
1883
|
+
const canSend = typeof navigator !== "undefined" && typeof navigator.share === "function";
|
|
1884
|
+
const copy = () => share && void navigator.clipboard?.writeText(share.link).then(() => setCopied(true));
|
|
1885
|
+
const stop = () => {
|
|
1886
|
+
setStopping(true);
|
|
1887
|
+
service.stopCard(agent.id).then(() => {
|
|
1888
|
+
pi.ui.notify(w.cardStopped, "info");
|
|
1889
|
+
onClose();
|
|
1890
|
+
}, (failure) => {
|
|
1891
|
+
setStopping(false);
|
|
1892
|
+
setError(ChannelViews.message(failure));
|
|
1893
|
+
});
|
|
1894
|
+
};
|
|
1895
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
|
|
1896
|
+
title: ChannelWords.format(w.cardTitle, { name: agent.name }),
|
|
1897
|
+
onClose
|
|
1898
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1899
|
+
className: "tac-dialog tac-card"
|
|
1900
|
+
}, /* @__PURE__ */ React.createElement(CardFace, {
|
|
1901
|
+
pi,
|
|
1902
|
+
card
|
|
1903
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1904
|
+
className: "tac-card-role"
|
|
1905
|
+
}, card.role), card.redacted ? /* @__PURE__ */ React.createElement("p", {
|
|
1906
|
+
className: "tac-dialog-note"
|
|
1907
|
+
}, ChannelWords.format(w.cardRedacted, { n: String(card.redacted) })) : null, share ? /* @__PURE__ */ React.createElement(React.Fragment, null, pi.ui.QrCode && /* @__PURE__ */ React.createElement("div", {
|
|
1908
|
+
className: "tac-card-qr"
|
|
1909
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.QrCode, {
|
|
1910
|
+
text: share.link,
|
|
1911
|
+
label: share.title
|
|
1912
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
1913
|
+
className: "tac-card-link",
|
|
1914
|
+
title: share.link
|
|
1915
|
+
}, share.link), /* @__PURE__ */ React.createElement("div", {
|
|
1916
|
+
className: "tac-card-actions"
|
|
1917
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
1918
|
+
type: "button",
|
|
1919
|
+
className: "tac-button tac-primary",
|
|
1920
|
+
onClick: copy
|
|
1921
|
+
}, /* @__PURE__ */ React.createElement(Copy, {
|
|
1922
|
+
size: 14
|
|
1923
|
+
}), copied ? w.linkCopied : w.copyLink), canSend && /* @__PURE__ */ React.createElement("button", {
|
|
1924
|
+
type: "button",
|
|
1925
|
+
className: "tac-button",
|
|
1926
|
+
onClick: () => void navigator.share({ title: share.title, url: share.link }).catch(() => {
|
|
1927
|
+
return;
|
|
1928
|
+
})
|
|
1929
|
+
}, /* @__PURE__ */ React.createElement(Send, {
|
|
1930
|
+
size: 14
|
|
1931
|
+
}), w.sendLink)), /* @__PURE__ */ React.createElement("p", {
|
|
1932
|
+
className: "tac-dialog-note"
|
|
1933
|
+
}, w.cardHint), /* @__PURE__ */ React.createElement("button", {
|
|
1934
|
+
type: "button",
|
|
1935
|
+
className: "tac-card-stop",
|
|
1936
|
+
disabled: stopping,
|
|
1937
|
+
onClick: stop
|
|
1938
|
+
}, w.stopCard)) : error ? /* @__PURE__ */ React.createElement("div", {
|
|
1939
|
+
className: "tac-error"
|
|
1940
|
+
}, error) : /* @__PURE__ */ React.createElement("div", {
|
|
1941
|
+
className: "tac-card-making"
|
|
1942
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1943
|
+
className: "ta-spinner"
|
|
1944
|
+
}), w.cardMaking)));
|
|
1945
|
+
}
|
|
1946
|
+
function CardView({ context, link }) {
|
|
1947
|
+
const { pi, service } = context;
|
|
1948
|
+
const w = ChannelViews.words(pi);
|
|
1949
|
+
const serverCwd = useServerCwd(pi);
|
|
1950
|
+
const [card, setCard] = React.useState();
|
|
1951
|
+
const [error, setError] = React.useState();
|
|
1952
|
+
const [cwd, setCwd] = React.useState();
|
|
1953
|
+
const [picking, setPicking] = React.useState(false);
|
|
1954
|
+
const [busy, setBusy] = React.useState(false);
|
|
1955
|
+
const [added, setAdded] = React.useState();
|
|
1956
|
+
React.useEffect(() => {
|
|
1957
|
+
let live = true;
|
|
1958
|
+
service.openCard(link).then((opened) => live && setCard(opened), (failure) => live && setError(ChannelViews.message(failure)));
|
|
1959
|
+
return () => {
|
|
1960
|
+
live = false;
|
|
1961
|
+
};
|
|
1962
|
+
}, [service, link]);
|
|
1963
|
+
const dir = cwd ?? serverCwd ?? "";
|
|
1964
|
+
const add = () => {
|
|
1965
|
+
setBusy(true);
|
|
1966
|
+
setError(undefined);
|
|
1967
|
+
service.addFromCard(link, dir).then((result) => {
|
|
1968
|
+
setBusy(false);
|
|
1969
|
+
setAdded(result);
|
|
1970
|
+
context.sessions.set(result.agent.id, result.sessionId);
|
|
1971
|
+
pi.ui.notify(ChannelWords.format(w.cardAdded, { name: result.agent.name }), "info");
|
|
1972
|
+
ChannelViews.openAgent(context, result.agent.id);
|
|
1973
|
+
}, (failure) => {
|
|
1974
|
+
setBusy(false);
|
|
1975
|
+
setError(ChannelViews.message(failure));
|
|
1976
|
+
});
|
|
1977
|
+
};
|
|
1978
|
+
if (!card) {
|
|
1979
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1980
|
+
className: "tac-card-page"
|
|
1981
|
+
}, error ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
1982
|
+
title: ChannelWords.format(w.cardFailed, { message: error })
|
|
1983
|
+
}) : /* @__PURE__ */ React.createElement("div", {
|
|
1984
|
+
className: "tac-card-making"
|
|
1985
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
1986
|
+
className: "ta-spinner"
|
|
1987
|
+
}), w.cardOpening));
|
|
1988
|
+
}
|
|
1989
|
+
const Folder = ChannelViews.icon(pi, "Folder");
|
|
1990
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
1991
|
+
className: "tac-card-page"
|
|
1992
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
1993
|
+
className: "tac-card"
|
|
1994
|
+
}, /* @__PURE__ */ React.createElement(CardFace, {
|
|
1995
|
+
pi,
|
|
1996
|
+
card
|
|
1997
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
1998
|
+
className: "tac-card-role"
|
|
1999
|
+
}, /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
|
|
2000
|
+
text: card.role
|
|
2001
|
+
})), added ? /* @__PURE__ */ React.createElement("div", {
|
|
2002
|
+
className: "tac-card-done"
|
|
2003
|
+
}, /* @__PURE__ */ React.createElement("span", null, ChannelWords.format(w.cardAdded, { name: added.agent.name })), /* @__PURE__ */ React.createElement("button", {
|
|
2004
|
+
type: "button",
|
|
2005
|
+
className: "tac-button",
|
|
2006
|
+
onClick: () => void ChannelViews.openAgent(context, added.agent.id)
|
|
2007
|
+
}, w.cardOpen)) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
2008
|
+
className: "tac-card-dir"
|
|
2009
|
+
}, /* @__PURE__ */ React.createElement(Folder, {
|
|
2010
|
+
size: 14
|
|
2011
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2012
|
+
title: dir
|
|
2013
|
+
}, ChannelWords.format(w.cardAddTo, { dir: baseName(dir) })), pi.ui.FolderPicker && /* @__PURE__ */ React.createElement("button", {
|
|
2014
|
+
type: "button",
|
|
2015
|
+
className: "tac-button tac-quiet",
|
|
2016
|
+
onClick: () => setPicking(true)
|
|
2017
|
+
}, w.cardChangeDir)), /* @__PURE__ */ React.createElement("button", {
|
|
2018
|
+
type: "button",
|
|
2019
|
+
className: busy ? "tac-button tac-primary ta-busy" : "tac-button tac-primary",
|
|
2020
|
+
disabled: busy || !dir,
|
|
2021
|
+
onClick: add
|
|
2022
|
+
}, w.cardAdd, busy && /* @__PURE__ */ React.createElement("span", {
|
|
2023
|
+
className: "ta-spinner ta-busy-mark ta-on-brand"
|
|
2024
|
+
})), /* @__PURE__ */ React.createElement("p", {
|
|
2025
|
+
className: "tac-dialog-note tac-center"
|
|
2026
|
+
}, w.cardAddHint)), error && /* @__PURE__ */ React.createElement("div", {
|
|
2027
|
+
className: "tac-error"
|
|
2028
|
+
}, error)), picking && pi.ui.FolderPicker && /* @__PURE__ */ React.createElement(pi.ui.FolderPicker, {
|
|
2029
|
+
initial: dir,
|
|
2030
|
+
onClose: () => setPicking(false),
|
|
2031
|
+
onPick: (path) => {
|
|
2032
|
+
setPicking(false);
|
|
2033
|
+
setCwd(path);
|
|
2034
|
+
}
|
|
2035
|
+
}));
|
|
2036
|
+
}
|
|
2037
|
+
function registerCardOpener(context) {
|
|
2038
|
+
const { pi } = context;
|
|
2039
|
+
pi.registerOpener((link) => {
|
|
2040
|
+
if (link.type !== "url" || !CardLink.is(link.url)) {
|
|
2041
|
+
return false;
|
|
2042
|
+
}
|
|
2043
|
+
pi.ui.openEditor({
|
|
2044
|
+
id: `ta-channels-card:${CardLink.id(link.url)}`,
|
|
2045
|
+
title: () => ChannelViews.words(pi).cardKind,
|
|
2046
|
+
icon: ChannelViews.icon(pi, "Contact"),
|
|
2047
|
+
render: () => /* @__PURE__ */ React.createElement(CardView, {
|
|
2048
|
+
context,
|
|
2049
|
+
link: link.url
|
|
2050
|
+
})
|
|
2051
|
+
});
|
|
2052
|
+
return true;
|
|
2053
|
+
}, { specific: true });
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
// web-src/channels.ts
|
|
2057
|
+
class ChannelsClient {
|
|
2058
|
+
storage;
|
|
2059
|
+
send;
|
|
2060
|
+
current = { team: ChannelsUtil.emptyTeam(), messages: {}, working: {}, answered: {}, loaded: false, deleting: [] };
|
|
2061
|
+
listeners = new Set;
|
|
2062
|
+
focusListeners = new Set;
|
|
2063
|
+
loading;
|
|
2064
|
+
unlisten;
|
|
2065
|
+
constructor(storage, send) {
|
|
2066
|
+
this.storage = storage;
|
|
2067
|
+
this.send = send;
|
|
2068
|
+
this.unlisten = storage.onChange((keys) => void this.changed(keys));
|
|
2069
|
+
}
|
|
2070
|
+
get state() {
|
|
2071
|
+
return this.current;
|
|
2072
|
+
}
|
|
2073
|
+
subscribe(listener) {
|
|
2074
|
+
this.listeners.add(listener);
|
|
2075
|
+
return () => this.listeners.delete(listener);
|
|
2076
|
+
}
|
|
2077
|
+
onFocus(listener) {
|
|
2078
|
+
this.focusListeners.add(listener);
|
|
2079
|
+
return () => this.focusListeners.delete(listener);
|
|
2080
|
+
}
|
|
2081
|
+
dispose() {
|
|
2082
|
+
this.unlisten();
|
|
2083
|
+
}
|
|
2084
|
+
load(again = false) {
|
|
2085
|
+
if (!this.loading || again) {
|
|
2086
|
+
this.loading = Promise.all([
|
|
2087
|
+
this.storage.get(Keys.TEAM),
|
|
2088
|
+
this.storage.get(Keys.WORKING),
|
|
2089
|
+
this.storage.get(Keys.ANSWERED)
|
|
2090
|
+
]).then(([team, working, answered]) => this.update({ team: team ?? ChannelsUtil.emptyTeam(), working: working ?? {}, answered: answered ?? {}, loaded: true }));
|
|
2091
|
+
}
|
|
2092
|
+
return this.loading;
|
|
2093
|
+
}
|
|
2094
|
+
async messages(channelId, again = false) {
|
|
2095
|
+
const known = this.current.messages[channelId];
|
|
2096
|
+
if (known && !again) {
|
|
2097
|
+
return known;
|
|
2098
|
+
}
|
|
2099
|
+
const messages = await this.storage.get(Keys.messages(channelId)) ?? [];
|
|
2100
|
+
this.update({ messages: { ...this.current.messages, [channelId]: messages } });
|
|
2101
|
+
return messages;
|
|
2102
|
+
}
|
|
2103
|
+
async createAgent(input) {
|
|
2104
|
+
const agent = await this.send({ kind: "createAgent", ...input });
|
|
2105
|
+
await this.load(true);
|
|
2106
|
+
return agent;
|
|
2107
|
+
}
|
|
2108
|
+
async createChannel(input) {
|
|
2109
|
+
const channel = await this.send({ kind: "createChannel", ...input });
|
|
2110
|
+
await this.load(true);
|
|
2111
|
+
return channel;
|
|
2112
|
+
}
|
|
2113
|
+
async addMembers(channelId, members) {
|
|
2114
|
+
const channel = await this.send({ kind: "addMembers", channel: channelId, members });
|
|
2115
|
+
await this.load(true);
|
|
2116
|
+
return channel;
|
|
2117
|
+
}
|
|
2118
|
+
async changeMember(channelId, agentId, change) {
|
|
2119
|
+
const channel = await this.send({ kind: "changeMember", channel: channelId, agent: agentId, change });
|
|
2120
|
+
await this.load(true);
|
|
2121
|
+
return channel;
|
|
2122
|
+
}
|
|
2123
|
+
async updateChannel(channelId, change) {
|
|
2124
|
+
const channel = await this.send({ kind: "updateChannel", channel: channelId, ...change });
|
|
2125
|
+
await this.load(true);
|
|
2126
|
+
return channel;
|
|
2127
|
+
}
|
|
2128
|
+
async deleteChannel(channelId) {
|
|
2129
|
+
await this.deleting(channelId, async () => {
|
|
2130
|
+
await this.send({ kind: "deleteChannel", channel: channelId });
|
|
2131
|
+
const { [channelId]: _gone, ...messages } = this.current.messages;
|
|
2132
|
+
this.update({ messages });
|
|
2133
|
+
await this.load(true);
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
async resetAgent(agentId) {
|
|
2137
|
+
const agent = await this.send({ kind: "resetAgent", agent: agentId });
|
|
2138
|
+
await this.load(true);
|
|
2139
|
+
return agent;
|
|
2140
|
+
}
|
|
2141
|
+
async updateAgent(agentId, change) {
|
|
2142
|
+
const agent = await this.send({ kind: "updateAgent", agent: agentId, ...change });
|
|
2143
|
+
await this.load(true);
|
|
2144
|
+
return agent;
|
|
2145
|
+
}
|
|
2146
|
+
async deleteAgent(agentId) {
|
|
2147
|
+
await this.deleting(agentId, async () => {
|
|
2148
|
+
await this.send({ kind: "deleteAgent", agent: agentId });
|
|
2149
|
+
await this.load(true);
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
async deleting(id, action) {
|
|
2153
|
+
this.update({ deleting: [...this.current.deleting, id] });
|
|
2154
|
+
try {
|
|
2155
|
+
await action();
|
|
2156
|
+
} finally {
|
|
2157
|
+
this.update({ deleting: this.current.deleting.filter((other) => other !== id) });
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
async openAgent(agentId) {
|
|
2161
|
+
const { sessionId } = await this.send({ kind: "openAgent", agent: agentId });
|
|
2162
|
+
return sessionId;
|
|
2163
|
+
}
|
|
2164
|
+
async setNotice(channelId, text) {
|
|
2165
|
+
const channel = await this.send({ kind: "setNotice", channel: channelId, text });
|
|
2166
|
+
await this.load(true);
|
|
2167
|
+
return channel;
|
|
2168
|
+
}
|
|
2169
|
+
shareAgent(agentId, color) {
|
|
2170
|
+
return this.send({ kind: "shareAgent", agent: agentId, ...color ? { color } : {} });
|
|
2171
|
+
}
|
|
2172
|
+
async stopCard(agentId) {
|
|
2173
|
+
return await this.send({ kind: "stopCard", agent: agentId });
|
|
2174
|
+
}
|
|
2175
|
+
openCard(link, password) {
|
|
2176
|
+
return this.send({ kind: "openCard", link, ...password ? { password } : {} });
|
|
1604
2177
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
2178
|
+
async addFromCard(link, cwd, password) {
|
|
2179
|
+
const added = await this.send({ kind: "addFromCard", link, cwd, ...password ? { password } : {} });
|
|
2180
|
+
await this.load(true);
|
|
2181
|
+
return added;
|
|
1608
2182
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
2183
|
+
async post(channelId, text) {
|
|
2184
|
+
await this.send({ kind: "post", channel: channelId, text });
|
|
2185
|
+
}
|
|
2186
|
+
async changed(keys) {
|
|
2187
|
+
const reads = [];
|
|
2188
|
+
for (const key of keys) {
|
|
2189
|
+
if (key === Keys.TEAM || key === Keys.WORKING || key === Keys.ANSWERED) {
|
|
2190
|
+
reads.push(this.load(true));
|
|
2191
|
+
} else if (key.startsWith(Keys.MESSAGES)) {
|
|
2192
|
+
const channelId = key.slice(Keys.MESSAGES.length);
|
|
2193
|
+
if (this.current.messages[channelId]) {
|
|
2194
|
+
reads.push(this.messages(channelId, true));
|
|
2195
|
+
}
|
|
2196
|
+
} else if (key === Keys.FOCUS) {
|
|
2197
|
+
reads.push(this.storage.get(Keys.FOCUS).then(async (focus) => {
|
|
2198
|
+
if (focus) {
|
|
2199
|
+
await this.load(true);
|
|
2200
|
+
for (const listener of this.focusListeners) {
|
|
2201
|
+
listener(focus.channelId);
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
}));
|
|
2205
|
+
}
|
|
1615
2206
|
}
|
|
1616
|
-
|
|
2207
|
+
await Promise.all(reads).catch((error) => console.error(error));
|
|
1617
2208
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
const [error, setError] = React.useState();
|
|
1623
|
-
return {
|
|
1624
|
-
busy,
|
|
1625
|
-
error,
|
|
1626
|
-
submit: (event) => {
|
|
1627
|
-
event?.preventDefault();
|
|
1628
|
-
setBusy(true);
|
|
1629
|
-
setError(undefined);
|
|
1630
|
-
action().then(() => {
|
|
1631
|
-
setBusy(false);
|
|
1632
|
-
onDone();
|
|
1633
|
-
}, (failure) => {
|
|
1634
|
-
setBusy(false);
|
|
1635
|
-
setError(ChannelViews.message(failure));
|
|
1636
|
-
});
|
|
2209
|
+
update(change) {
|
|
2210
|
+
this.current = { ...this.current, ...change };
|
|
2211
|
+
for (const listener of this.listeners) {
|
|
2212
|
+
listener(this.current);
|
|
1637
2213
|
}
|
|
1638
|
-
}
|
|
2214
|
+
}
|
|
1639
2215
|
}
|
|
1640
2216
|
|
|
1641
2217
|
// web-src/create.tsx
|
|
@@ -1899,10 +2475,229 @@ function NewChannelDialog({ context, onClose }) {
|
|
|
1899
2475
|
className: "tac-dialog-actions"
|
|
1900
2476
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
1901
2477
|
type: "submit",
|
|
1902
|
-
className: "tac-button tac-primary",
|
|
2478
|
+
className: busy ? "tac-button tac-primary ta-busy" : "tac-button tac-primary",
|
|
1903
2479
|
disabled: busy || !name.trim() || picked.length === 0
|
|
1904
|
-
}, w.create
|
|
2480
|
+
}, w.create, busy && /* @__PURE__ */ React.createElement("span", {
|
|
2481
|
+
className: "ta-spinner ta-busy-mark ta-on-brand"
|
|
2482
|
+
})))));
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
// web-src/handoff.ts
|
|
2486
|
+
var HandOff;
|
|
2487
|
+
((HandOff) => {
|
|
2488
|
+
HandOff.TOOL = "hand_off";
|
|
2489
|
+
HandOff.CARD = "ta-channels-handoff";
|
|
2490
|
+
HandOff.BLOCK = "ta-handoff";
|
|
2491
|
+
const MARK = /\[ta-handoff:([^\]\s]+)\]/;
|
|
2492
|
+
HandOff.DEFINITION = {
|
|
2493
|
+
name: HandOff.TOOL,
|
|
2494
|
+
label: "Hand off",
|
|
2495
|
+
description: "Hands the work of this conversation over to one of the user's agents (@name) or channels (#name), when the user says so (hand it to, give it to, 交给, 转给). The other side does not see this conversation: write the brief it needs to go on, in the user's language: the goal, what is done and decided, what is left or blocks, the files, branches, commands and links that matter. It works on it in its own conversation, which the user follows; you stop working on it here. list_channels lists the team. After the call, say in one line to whom it went.",
|
|
2496
|
+
promptSnippet: "Hand the work over to one of the user's agents or channels",
|
|
2497
|
+
parameters: {
|
|
2498
|
+
type: "object",
|
|
2499
|
+
properties: {
|
|
2500
|
+
to: { type: "string", description: "@name of an agent or #name of a channel." },
|
|
2501
|
+
brief: { type: "string", description: "Complete in itself: the receiver sees only this." }
|
|
2502
|
+
},
|
|
2503
|
+
required: ["to", "brief"]
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
function ref(target) {
|
|
2507
|
+
return `${target.kind === "agent" ? "@" : "#"}${target.name}`;
|
|
2508
|
+
}
|
|
2509
|
+
HandOff.ref = ref;
|
|
2510
|
+
function ask(language, to) {
|
|
2511
|
+
const fence = "```";
|
|
2512
|
+
const context = [
|
|
2513
|
+
`[ta-handoff:${to}]`,
|
|
2514
|
+
`The user hands the work of this conversation over to ${to}, which does not see this conversation.`,
|
|
2515
|
+
`- Write the brief it needs to go on: the goal, what is done and decided, what is left or blocks, the files, branches, commands and links that matter, in the user's language. Leave out what was only tried and dropped.`,
|
|
2516
|
+
`- With the tool ${HandOff.TOOL}, call it with to "${to}" and the brief, then say in one line that it went.`,
|
|
2517
|
+
`- Without it, say in one line what you hand over, then end your answer with the brief in a fenced block of the language ${HandOff.BLOCK}, which Ta reads to hand it over (a longer fence when the brief has one of its own):`,
|
|
2518
|
+
`${fence}${HandOff.BLOCK}`,
|
|
2519
|
+
"<the brief>",
|
|
2520
|
+
fence,
|
|
2521
|
+
`- When the conversation holds nothing to hand over yet, say so and ask what ${to} should do.`
|
|
2522
|
+
].join(`
|
|
2523
|
+
`);
|
|
2524
|
+
const line = language === "zh-CN" ? `把这件事交给 ${to}` : `Hand this over to ${to}`;
|
|
2525
|
+
return `<context>
|
|
2526
|
+
${context}
|
|
2527
|
+
</context>
|
|
2528
|
+
${line}`;
|
|
2529
|
+
}
|
|
2530
|
+
HandOff.ask = ask;
|
|
2531
|
+
function asked(text) {
|
|
2532
|
+
return MARK.exec(text)?.[1];
|
|
2533
|
+
}
|
|
2534
|
+
HandOff.asked = asked;
|
|
2535
|
+
function find(text) {
|
|
2536
|
+
const lines = text.split(/\r?\n/);
|
|
2537
|
+
let found;
|
|
2538
|
+
for (let index = 0;index < lines.length; index++) {
|
|
2539
|
+
const open = /^\s*(`{3,})\s*([\w-]+)\s*$/.exec(lines[index]);
|
|
2540
|
+
if (open?.[2] !== HandOff.BLOCK) {
|
|
2541
|
+
continue;
|
|
2542
|
+
}
|
|
2543
|
+
const close = new RegExp(`^\\s*${open[1]}\`*\\s*$`);
|
|
2544
|
+
const end = lines.findIndex((line, at) => at > index && close.test(line));
|
|
2545
|
+
found = lines.slice(index + 1, end < 0 ? lines.length : end);
|
|
2546
|
+
index = end < 0 ? lines.length : end;
|
|
2547
|
+
}
|
|
2548
|
+
const brief = found?.join(`
|
|
2549
|
+
`).trim();
|
|
2550
|
+
return brief || undefined;
|
|
2551
|
+
}
|
|
2552
|
+
HandOff.find = find;
|
|
2553
|
+
function message(origin, brief, language) {
|
|
2554
|
+
const title = origin.title?.trim() || (language === "zh-CN" ? "一个对话" : "a conversation");
|
|
2555
|
+
const head = language === "zh-CN" ? `(交接自“${title}”)` : `(Handed over from “${title}”)`;
|
|
2556
|
+
const context = [
|
|
2557
|
+
"The user handed you this work from another conversation of theirs, which you do not see; the brief below is all it says. Go on from there in this conversation, which the user follows; ask them when the brief leaves out something you need.",
|
|
2558
|
+
origin.sessionFile ? `That conversation is pi's session file ${origin.sessionFile}${origin.cwd ? `, working in ${origin.cwd}` : ""}: read it only when the brief is not enough.` : ""
|
|
2559
|
+
].filter(Boolean).join(`
|
|
2560
|
+
`);
|
|
2561
|
+
return `<context>
|
|
2562
|
+
${context}
|
|
2563
|
+
</context>
|
|
2564
|
+
${head}
|
|
2565
|
+
|
|
2566
|
+
${brief.trim()}`;
|
|
2567
|
+
}
|
|
2568
|
+
HandOff.message = message;
|
|
2569
|
+
function channelText(origin, brief, language) {
|
|
2570
|
+
const title = origin.title?.trim() || (language === "zh-CN" ? "一个对话" : "a conversation");
|
|
2571
|
+
return `${language === "zh-CN" ? `(交接自“${title}”)` : `(Handed over from “${title}”)`}
|
|
2572
|
+
|
|
2573
|
+
${brief.trim()}`;
|
|
2574
|
+
}
|
|
2575
|
+
HandOff.channelText = channelText;
|
|
2576
|
+
function serverLanguage(env = typeof process === "undefined" ? {} : process.env) {
|
|
2577
|
+
return /^zh/i.test(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG || "") ? "zh-CN" : "en";
|
|
2578
|
+
}
|
|
2579
|
+
HandOff.serverLanguage = serverLanguage;
|
|
2580
|
+
function result(target) {
|
|
2581
|
+
return `Handed over to ${ref(target)}; it works on it in its own conversation, which the user follows. Do not go on with it here.`;
|
|
2582
|
+
}
|
|
2583
|
+
HandOff.result = result;
|
|
2584
|
+
})(HandOff ||= {});
|
|
2585
|
+
|
|
2586
|
+
// web-src/handoff-view.tsx
|
|
2587
|
+
var HandOffViewUtil;
|
|
2588
|
+
((HandOffViewUtil) => {
|
|
2589
|
+
function members(team, target) {
|
|
2590
|
+
if (target.kind === "agent") {
|
|
2591
|
+
const agent = team.agents.find((candidate) => candidate.id === target.id);
|
|
2592
|
+
return agent ? [agent] : [];
|
|
2593
|
+
}
|
|
2594
|
+
const channel = team.channels.find((candidate) => candidate.id === target.id);
|
|
2595
|
+
return channel ? membersOf(team, channel) : [];
|
|
2596
|
+
}
|
|
2597
|
+
HandOffViewUtil.members = members;
|
|
2598
|
+
})(HandOffViewUtil ||= {});
|
|
2599
|
+
function useTeam(context) {
|
|
2600
|
+
return React.useSyncExternalStore((listener) => context.service.subscribe(listener), () => context.service.state).team;
|
|
2601
|
+
}
|
|
2602
|
+
function HandOffCard({ context, message }) {
|
|
2603
|
+
const card = message.details;
|
|
2604
|
+
const team = useTeam(context);
|
|
2605
|
+
const faces = useFaces(team);
|
|
2606
|
+
if (!card?.target) {
|
|
2607
|
+
return null;
|
|
2608
|
+
}
|
|
2609
|
+
const w = ChannelViews.words(context.pi);
|
|
2610
|
+
const members = HandOffViewUtil.members(team, card.target);
|
|
2611
|
+
const open = () => card.target.kind === "agent" ? void ChannelViews.openAgent(context, card.target.id).catch((error) => context.pi.ui.notify(ChannelViews.message(error), "error")) : context.showChannel(card.target.id);
|
|
2612
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
2613
|
+
className: "tac-handoff"
|
|
2614
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
2615
|
+
className: "tac-handoff-head"
|
|
2616
|
+
}, members.length > 0 && /* @__PURE__ */ React.createElement(RoomFace, {
|
|
2617
|
+
members,
|
|
2618
|
+
faces,
|
|
2619
|
+
size: 20,
|
|
2620
|
+
working: []
|
|
2621
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
2622
|
+
className: "tac-handoff-title"
|
|
2623
|
+
}, w.handedTo.replace("{to}", HandOff.ref(card.target))), members.length > 0 && /* @__PURE__ */ React.createElement("button", {
|
|
2624
|
+
type: "button",
|
|
2625
|
+
className: "tac-link",
|
|
2626
|
+
onClick: open
|
|
2627
|
+
}, w.handOffOpen)), /* @__PURE__ */ React.createElement("div", {
|
|
2628
|
+
className: "tac-handoff-brief"
|
|
2629
|
+
}, card.brief));
|
|
1905
2630
|
}
|
|
2631
|
+
var HandOffView;
|
|
2632
|
+
((HandOffView) => {
|
|
2633
|
+
function card(context) {
|
|
2634
|
+
return ({ message }) => /* @__PURE__ */ React.createElement(HandOffCard, {
|
|
2635
|
+
context,
|
|
2636
|
+
message
|
|
2637
|
+
});
|
|
2638
|
+
}
|
|
2639
|
+
HandOffView.card = card;
|
|
2640
|
+
function icon(context, target, icons) {
|
|
2641
|
+
const key = `${target.kind}:${target.id}`;
|
|
2642
|
+
let node = icons.get(key);
|
|
2643
|
+
if (!node) {
|
|
2644
|
+
const Face2 = () => {
|
|
2645
|
+
const team = useTeam(context);
|
|
2646
|
+
const faces = useFaces(team);
|
|
2647
|
+
const members = HandOffViewUtil.members(team, target);
|
|
2648
|
+
return members.length ? /* @__PURE__ */ React.createElement(RoomFace, {
|
|
2649
|
+
members,
|
|
2650
|
+
faces,
|
|
2651
|
+
size: 16,
|
|
2652
|
+
working: []
|
|
2653
|
+
}) : null;
|
|
2654
|
+
};
|
|
2655
|
+
node = /* @__PURE__ */ React.createElement(Face2, null);
|
|
2656
|
+
icons.set(key, node);
|
|
2657
|
+
}
|
|
2658
|
+
return node;
|
|
2659
|
+
}
|
|
2660
|
+
function composerAddon(context) {
|
|
2661
|
+
const icons = new Map;
|
|
2662
|
+
const send = (conversation, to) => void context.pi.server.prompt(conversation.sessionId, {
|
|
2663
|
+
clientMessageId: ChannelsUtil.newId("handoff-ask"),
|
|
2664
|
+
message: HandOff.ask(context.pi.ui.language, to),
|
|
2665
|
+
streamingBehavior: "followUp"
|
|
2666
|
+
}).catch((error) => context.pi.ui.notify(ChannelViews.message(error), "error"));
|
|
2667
|
+
return {
|
|
2668
|
+
actions: (conversation) => {
|
|
2669
|
+
const { team } = context.service.state;
|
|
2670
|
+
if (conversation.group === NAME || team.agents.length === 0 && team.channels.length === 0) {
|
|
2671
|
+
return [];
|
|
2672
|
+
}
|
|
2673
|
+
const w = ChannelViews.words(context.pi);
|
|
2674
|
+
const Forward = ChannelViews.icon(context.pi, "Forward");
|
|
2675
|
+
const agents = team.agents.filter((agent) => !agent.temporary).map((agent) => ({
|
|
2676
|
+
key: `handoff:agent:${agent.id}`,
|
|
2677
|
+
label: agent.name,
|
|
2678
|
+
detail: agent.role.split(`
|
|
2679
|
+
`)[0],
|
|
2680
|
+
group: w.agents,
|
|
2681
|
+
icon: icon(context, { kind: "agent", id: agent.id }, icons),
|
|
2682
|
+
run: () => send(conversation, `@${agent.name}`)
|
|
2683
|
+
}));
|
|
2684
|
+
const channels = team.channels.map((channel) => ({
|
|
2685
|
+
key: `handoff:channel:${channel.id}`,
|
|
2686
|
+
label: `#${channel.name}`,
|
|
2687
|
+
detail: channel.topic,
|
|
2688
|
+
group: w.channels,
|
|
2689
|
+
icon: icon(context, { kind: "channel", id: channel.id }, icons),
|
|
2690
|
+
run: () => send(conversation, `#${channel.name}`)
|
|
2691
|
+
}));
|
|
2692
|
+
return [{ key: "handoff", label: w.handOff, detail: w.handOffDetail, icon: /* @__PURE__ */ React.createElement(Forward, {
|
|
2693
|
+
size: 16
|
|
2694
|
+
}), items: [...agents, ...channels] }];
|
|
2695
|
+
},
|
|
2696
|
+
subscribe: (listener) => context.service.subscribe(listener)
|
|
2697
|
+
};
|
|
2698
|
+
}
|
|
2699
|
+
HandOffView.composerAddon = composerAddon;
|
|
2700
|
+
})(HandOffView ||= {});
|
|
1906
2701
|
|
|
1907
2702
|
// web-src/members.tsx
|
|
1908
2703
|
function MembersView({ context }) {
|
|
@@ -2080,10 +2875,12 @@ ${agent.role}`,
|
|
|
2080
2875
|
onClick: () => setConfirming(false)
|
|
2081
2876
|
}, w.cancel), /* @__PURE__ */ React.createElement("button", {
|
|
2082
2877
|
type: "button",
|
|
2083
|
-
className: "tac-button tac-danger",
|
|
2878
|
+
className: busy === "delete" ? "tac-button tac-danger ta-busy" : "tac-button tac-danger",
|
|
2084
2879
|
disabled: !!busy,
|
|
2085
2880
|
onClick: remove
|
|
2086
|
-
}, w.delete
|
|
2881
|
+
}, w.delete, busy === "delete" && /* @__PURE__ */ React.createElement("span", {
|
|
2882
|
+
className: "ta-spinner ta-busy-mark"
|
|
2883
|
+
}))) : /* @__PURE__ */ React.createElement("button", {
|
|
2087
2884
|
type: "button",
|
|
2088
2885
|
className: "tac-link tac-danger",
|
|
2089
2886
|
onClick: () => setConfirming(true)
|
|
@@ -2184,10 +2981,131 @@ function MemberPicker({ context, team, channel, faces }) {
|
|
|
2184
2981
|
className: "tac-members-foot"
|
|
2185
2982
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
2186
2983
|
type: "button",
|
|
2187
|
-
className: "tac-button tac-primary tac-wide",
|
|
2984
|
+
className: busy ? "tac-button tac-primary tac-wide ta-busy" : "tac-button tac-primary tac-wide",
|
|
2188
2985
|
disabled: busy || picked.length === 0,
|
|
2189
2986
|
onClick: submit
|
|
2190
|
-
}, picked.length > 0 ? ChannelWords.format(w.addCount, { count: String(picked.length) }) : w.add
|
|
2987
|
+
}, picked.length > 0 ? ChannelWords.format(w.addCount, { count: String(picked.length) }) : w.add, busy && /* @__PURE__ */ React.createElement("span", {
|
|
2988
|
+
className: "ta-spinner ta-busy-mark ta-on-brand"
|
|
2989
|
+
}))));
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
// web-src/notice.tsx
|
|
2993
|
+
var NoticeView;
|
|
2994
|
+
((NoticeView) => {
|
|
2995
|
+
function display(text) {
|
|
2996
|
+
return text.replace(/^(\s*[-*+]\s+)\[ \]\s+/gm, "$1☐ ").replace(/^(\s*[-*+]\s+)\[[xX]\]\s+/gm, "$1☑ ");
|
|
2997
|
+
}
|
|
2998
|
+
NoticeView.display = display;
|
|
2999
|
+
function counts(text, language) {
|
|
3000
|
+
const w = ChannelWords.of(language);
|
|
3001
|
+
const counts2 = NoticeUtil.counts(text);
|
|
3002
|
+
if (counts2.decisions + counts2.conventions + counts2.todo === 0) {
|
|
3003
|
+
return NoticeUtil.firstLine(text);
|
|
3004
|
+
}
|
|
3005
|
+
const values = { decisions: String(counts2.decisions), conventions: String(counts2.conventions), todo: String(counts2.todo) };
|
|
3006
|
+
return ChannelWords.format(w.noticeCounts, values).split(" · ").filter((_, at) => [counts2.decisions, counts2.conventions, counts2.todo][at] > 0).join(" · ");
|
|
3007
|
+
}
|
|
3008
|
+
NoticeView.counts = counts;
|
|
3009
|
+
})(NoticeView ||= {});
|
|
3010
|
+
function NoticeBar({
|
|
3011
|
+
context,
|
|
3012
|
+
channel,
|
|
3013
|
+
state,
|
|
3014
|
+
onState
|
|
3015
|
+
}) {
|
|
3016
|
+
const { pi, service } = context;
|
|
3017
|
+
const { team } = useChannels(service);
|
|
3018
|
+
const w = ChannelViews.words(pi);
|
|
3019
|
+
const notice = channel.notice;
|
|
3020
|
+
const [draft, setDraft] = React.useState("");
|
|
3021
|
+
const [busy, setBusy] = React.useState(false);
|
|
3022
|
+
const [error, setError] = React.useState();
|
|
3023
|
+
React.useEffect(() => {
|
|
3024
|
+
if (state.editing) {
|
|
3025
|
+
setDraft(notice?.text ?? w.noticeTemplate);
|
|
3026
|
+
setError(undefined);
|
|
3027
|
+
}
|
|
3028
|
+
}, [state.editing]);
|
|
3029
|
+
if (!notice && !state.editing) {
|
|
3030
|
+
return null;
|
|
3031
|
+
}
|
|
3032
|
+
const Megaphone = ChannelViews.icon(pi, "Megaphone");
|
|
3033
|
+
const Chevron = ChannelViews.icon(pi, "ChevronDown");
|
|
3034
|
+
const Markdown = pi.ui.Markdown;
|
|
3035
|
+
const save = (event) => {
|
|
3036
|
+
event.preventDefault();
|
|
3037
|
+
setBusy(true);
|
|
3038
|
+
setError(undefined);
|
|
3039
|
+
service.setNotice(channel.id, draft).then(() => {
|
|
3040
|
+
setBusy(false);
|
|
3041
|
+
onState({ open: true, editing: false });
|
|
3042
|
+
}, (failure) => {
|
|
3043
|
+
setBusy(false);
|
|
3044
|
+
setError(ChannelViews.message(failure));
|
|
3045
|
+
});
|
|
3046
|
+
};
|
|
3047
|
+
const open = state.open || state.editing;
|
|
3048
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
3049
|
+
className: "tac-notice-bar",
|
|
3050
|
+
"data-open": open ? "" : undefined
|
|
3051
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
3052
|
+
type: "button",
|
|
3053
|
+
className: "tac-notice-head",
|
|
3054
|
+
"aria-expanded": open,
|
|
3055
|
+
title: open ? w.noticeHide : w.noticeShow,
|
|
3056
|
+
onClick: () => onState({ open: !open, editing: false })
|
|
3057
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
3058
|
+
className: "tac-notice-icon"
|
|
3059
|
+
}, /* @__PURE__ */ React.createElement(Megaphone, {
|
|
3060
|
+
size: 13,
|
|
3061
|
+
strokeWidth: 2
|
|
3062
|
+
})), /* @__PURE__ */ React.createElement("strong", null, w.notice), /* @__PURE__ */ React.createElement("span", {
|
|
3063
|
+
className: "tac-notice-sum"
|
|
3064
|
+
}, notice ? NoticeView.counts(notice.text, pi.ui.language) : w.noticeEmpty), /* @__PURE__ */ React.createElement("span", {
|
|
3065
|
+
className: "tac-notice-chevron"
|
|
3066
|
+
}, /* @__PURE__ */ React.createElement(Chevron, {
|
|
3067
|
+
size: 15
|
|
3068
|
+
}))), open && !state.editing && notice && /* @__PURE__ */ React.createElement("div", {
|
|
3069
|
+
className: "tac-notice-body"
|
|
3070
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
3071
|
+
className: "tac-notice-text"
|
|
3072
|
+
}, /* @__PURE__ */ React.createElement(Markdown, {
|
|
3073
|
+
text: NoticeView.display(notice.text)
|
|
3074
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
3075
|
+
className: "tac-notice-foot"
|
|
3076
|
+
}, /* @__PURE__ */ React.createElement("span", null, ChannelWords.format(w.noticeBy, {
|
|
3077
|
+
name: ChannelsUtil.authorName(team, notice.by, { user: w.you, ta: w.ta }),
|
|
3078
|
+
time: SidebarUtil.time(notice.at, pi.ui.language)
|
|
3079
|
+
})), /* @__PURE__ */ React.createElement("button", {
|
|
3080
|
+
type: "button",
|
|
3081
|
+
className: "tac-button tac-quiet",
|
|
3082
|
+
onClick: () => onState({ open: true, editing: true })
|
|
3083
|
+
}, w.noticeEdit))), state.editing && /* @__PURE__ */ React.createElement("form", {
|
|
3084
|
+
className: "tac-notice-body tac-notice-form",
|
|
3085
|
+
onSubmit: save
|
|
3086
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
3087
|
+
className: "tac-dialog-note"
|
|
3088
|
+
}, w.noticeHint), /* @__PURE__ */ React.createElement("textarea", {
|
|
3089
|
+
className: "tac-input tac-notice-input",
|
|
3090
|
+
value: draft,
|
|
3091
|
+
"aria-label": w.noticeEdit,
|
|
3092
|
+
autoFocus: true,
|
|
3093
|
+
onChange: (event) => setDraft(event.target.value)
|
|
3094
|
+
}), error && /* @__PURE__ */ React.createElement("div", {
|
|
3095
|
+
className: "tac-error"
|
|
3096
|
+
}, error), /* @__PURE__ */ React.createElement("div", {
|
|
3097
|
+
className: "tac-notice-actions"
|
|
3098
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
3099
|
+
type: "button",
|
|
3100
|
+
className: "tac-button tac-quiet",
|
|
3101
|
+
onClick: () => onState({ open: !!notice, editing: false })
|
|
3102
|
+
}, w.cancel), /* @__PURE__ */ React.createElement("button", {
|
|
3103
|
+
type: "submit",
|
|
3104
|
+
className: busy ? "tac-button tac-primary ta-busy" : "tac-button tac-primary",
|
|
3105
|
+
disabled: busy || draft.trim() === (notice?.text ?? "")
|
|
3106
|
+
}, w.save, busy && /* @__PURE__ */ React.createElement("span", {
|
|
3107
|
+
className: "ta-spinner ta-busy-mark ta-on-brand"
|
|
3108
|
+
})))));
|
|
2191
3109
|
}
|
|
2192
3110
|
|
|
2193
3111
|
// web-src/room.tsx
|
|
@@ -2199,7 +3117,7 @@ var RoomUtil;
|
|
|
2199
3117
|
return messages.map((message, index) => {
|
|
2200
3118
|
const before = messages[index - 1];
|
|
2201
3119
|
const separator = !before || message.at - before.at > PAUSE_MS;
|
|
2202
|
-
const first = separator || before.author !== message.author || before.author === SYSTEM || message.at - before.at > RUN_MS;
|
|
3120
|
+
const first = separator || before.author !== message.author || before.author === SYSTEM || !!before.notice || message.at - before.at > RUN_MS;
|
|
2203
3121
|
return { message, first, separator };
|
|
2204
3122
|
});
|
|
2205
3123
|
}
|
|
@@ -2300,6 +3218,8 @@ function ChannelRoom({ context, channelId: fixed }) {
|
|
|
2300
3218
|
}, [service, channelId]);
|
|
2301
3219
|
const sent = React.useMemo(() => messages?.filter((message) => message.author === USER).length ?? 0, [messages]);
|
|
2302
3220
|
const list = pi.ui.useChatScroll(sent, channelId);
|
|
3221
|
+
const [notice, setNotice] = React.useState({ open: false, editing: false });
|
|
3222
|
+
React.useEffect(() => setNotice({ open: false, editing: false }), [channelId]);
|
|
2303
3223
|
const Markdown = pi.ui.Markdown;
|
|
2304
3224
|
const Composer = pi.ui.Composer;
|
|
2305
3225
|
const Avatar = pi.ui.Avatar;
|
|
@@ -2327,7 +3247,12 @@ function ChannelRoom({ context, channelId: fixed }) {
|
|
|
2327
3247
|
});
|
|
2328
3248
|
return /* @__PURE__ */ React.createElement("div", {
|
|
2329
3249
|
className: "tac-room-page"
|
|
2330
|
-
}, /* @__PURE__ */ React.createElement(
|
|
3250
|
+
}, /* @__PURE__ */ React.createElement(NoticeBar, {
|
|
3251
|
+
context,
|
|
3252
|
+
channel,
|
|
3253
|
+
state: notice,
|
|
3254
|
+
onState: setNotice
|
|
3255
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
2331
3256
|
className: "tac-chat ta-conversation",
|
|
2332
3257
|
ref: list
|
|
2333
3258
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -2348,7 +3273,12 @@ function ChannelRoom({ context, channelId: fixed }) {
|
|
|
2348
3273
|
}, time(message.at)), message.author === SYSTEM ? /* @__PURE__ */ React.createElement("div", {
|
|
2349
3274
|
className: "tac-notice",
|
|
2350
3275
|
role: "note"
|
|
2351
|
-
}, w.stopped) : message.
|
|
3276
|
+
}, w.stopped) : message.notice ? /* @__PURE__ */ React.createElement("button", {
|
|
3277
|
+
type: "button",
|
|
3278
|
+
className: "tac-notice tac-notice-line",
|
|
3279
|
+
disabled: !channel.notice,
|
|
3280
|
+
onClick: () => setNotice({ open: true, editing: false })
|
|
3281
|
+
}, ChannelWords.format(message.notice === "cleared" ? w.noticeCleared : w.noticeUpdated, { name: name(message.author) })) : message.author === USER ? /* @__PURE__ */ React.createElement("div", {
|
|
2352
3282
|
className: "ta-message ta-user tac-mine"
|
|
2353
3283
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
2354
3284
|
className: "ta-bubble"
|
|
@@ -2398,6 +3328,12 @@ function ChannelRoom({ context, channelId: fixed }) {
|
|
|
2398
3328
|
actions: [
|
|
2399
3329
|
members.map(mention),
|
|
2400
3330
|
[
|
|
3331
|
+
{
|
|
3332
|
+
key: "notice",
|
|
3333
|
+
label: w.noticeEdit,
|
|
3334
|
+
icon: ChannelViews.maybeIcon(pi, "Megaphone", null, 16),
|
|
3335
|
+
run: () => setNotice({ open: true, editing: true })
|
|
3336
|
+
},
|
|
2401
3337
|
{
|
|
2402
3338
|
key: "add",
|
|
2403
3339
|
label: w.addMembers,
|
|
@@ -2614,6 +3550,7 @@ function AgentMenu({ context, agent, cwd, working }) {
|
|
|
2614
3550
|
download(`${agent.name}.md`, ChannelsUtil.markdown(agent, messages, { user: w.you }));
|
|
2615
3551
|
});
|
|
2616
3552
|
const remove = act(() => deleteAgent(context, agent));
|
|
3553
|
+
const pin = act(() => service.updateAgent(agent.id, { pinned: !agent.pinned }));
|
|
2617
3554
|
const keep = act(async () => {
|
|
2618
3555
|
await service.updateAgent(agent.id, { keep: true });
|
|
2619
3556
|
pi.ui.notify(ChannelWords.format(w.kept, { name: agent.name }), "info");
|
|
@@ -2630,7 +3567,10 @@ function AgentMenu({ context, agent, cwd, working }) {
|
|
|
2630
3567
|
pi,
|
|
2631
3568
|
label: agent.name,
|
|
2632
3569
|
items: () => [
|
|
2633
|
-
|
|
3570
|
+
[
|
|
3571
|
+
...agent.temporary ? [item("keep", w.keep, "UserPlus", keep)] : [],
|
|
3572
|
+
item("pin", agent.pinned ? w.unpin : w.pin, agent.pinned ? "PinOff" : "Pin", pin)
|
|
3573
|
+
],
|
|
2634
3574
|
[item("stop", w.stop, "Square", stop, { disabled: !working && !agent.sessionFile }), item("restart", w.restart, "RotateCcw", restart)],
|
|
2635
3575
|
[
|
|
2636
3576
|
item("rename", w.rename, "Pencil", show("rename")),
|
|
@@ -2638,7 +3578,11 @@ function AgentMenu({ context, agent, cwd, working }) {
|
|
|
2638
3578
|
item("move", w.moveTo, "FolderInput", show("move")),
|
|
2639
3579
|
item("copy", w.copyCwd, "Copy", copyCwd)
|
|
2640
3580
|
],
|
|
2641
|
-
[
|
|
3581
|
+
[
|
|
3582
|
+
item("card", w.shareCard, "Contact", show("card")),
|
|
3583
|
+
item("export", w.exportChat, "Download", exportMarkdown),
|
|
3584
|
+
item("join", w.joinChannel, "UserPlus", show("join"))
|
|
3585
|
+
],
|
|
2642
3586
|
[item("delete", w.deleteAgent, "Trash2", remove, { danger: true })]
|
|
2643
3587
|
]
|
|
2644
3588
|
}), dialog === "rename" && /* @__PURE__ */ React.createElement(RenameDialog, {
|
|
@@ -2653,6 +3597,10 @@ function AgentMenu({ context, agent, cwd, working }) {
|
|
|
2653
3597
|
context,
|
|
2654
3598
|
agent,
|
|
2655
3599
|
onClose: () => setDialog(undefined)
|
|
3600
|
+
}), dialog === "card" && /* @__PURE__ */ React.createElement(CardDialog, {
|
|
3601
|
+
context,
|
|
3602
|
+
agent,
|
|
3603
|
+
onClose: () => setDialog(undefined)
|
|
2656
3604
|
}), dialog === "move" && /* @__PURE__ */ React.createElement(pi.ui.FolderPicker, {
|
|
2657
3605
|
initial: cwd,
|
|
2658
3606
|
onClose: () => setDialog(undefined),
|
|
@@ -2704,9 +3652,11 @@ function RenameDialog({ context, agent, onClose }) {
|
|
|
2704
3652
|
className: "tac-dialog-actions"
|
|
2705
3653
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
2706
3654
|
type: "submit",
|
|
2707
|
-
className: "tac-button tac-primary",
|
|
3655
|
+
className: busy ? "tac-button tac-primary ta-busy" : "tac-button tac-primary",
|
|
2708
3656
|
disabled: busy || !name.trim() || name.trim() === agent.name
|
|
2709
|
-
}, w.save
|
|
3657
|
+
}, w.save, busy && /* @__PURE__ */ React.createElement("span", {
|
|
3658
|
+
className: "ta-spinner ta-busy-mark ta-on-brand"
|
|
3659
|
+
})))));
|
|
2710
3660
|
}
|
|
2711
3661
|
function RoleDialog({ context, agent, onClose }) {
|
|
2712
3662
|
const { pi, service } = context;
|
|
@@ -2734,9 +3684,11 @@ function RoleDialog({ context, agent, onClose }) {
|
|
|
2734
3684
|
className: "tac-dialog-actions"
|
|
2735
3685
|
}, /* @__PURE__ */ React.createElement("button", {
|
|
2736
3686
|
type: "submit",
|
|
2737
|
-
className: "tac-button tac-primary",
|
|
3687
|
+
className: busy ? "tac-button tac-primary ta-busy" : "tac-button tac-primary",
|
|
2738
3688
|
disabled: busy || !role.trim() || role.trim() === agent.role
|
|
2739
|
-
}, w.save
|
|
3689
|
+
}, w.save, busy && /* @__PURE__ */ React.createElement("span", {
|
|
3690
|
+
className: "ta-spinner ta-busy-mark ta-on-brand"
|
|
3691
|
+
})))));
|
|
2740
3692
|
}
|
|
2741
3693
|
function JoinDialog({ context, agent, onClose }) {
|
|
2742
3694
|
const { pi, service } = context;
|
|
@@ -3070,15 +4022,17 @@ function ChannelMenu({ context, channel, working }) {
|
|
|
3070
4022
|
}
|
|
3071
4023
|
|
|
3072
4024
|
// web-src/sidebar.tsx
|
|
3073
|
-
function Row({ pi, avatar, title, badge, preview, live, dot, waiting, fresh, time, hint, selected, onSelect, more, swipe, check, place }) {
|
|
4025
|
+
function Row({ pi, avatar, title, badge, preview, live, dot, waiting, fresh, time, hint, selected, onSelect, more, swipe, check, place, deleting }) {
|
|
3074
4026
|
const single = !preview && !place;
|
|
3075
4027
|
const spinner = dot === "running" && /* @__PURE__ */ React.createElement("span", {
|
|
3076
4028
|
className: "tac-spinner ta-spinner"
|
|
3077
4029
|
});
|
|
3078
4030
|
const row = /* @__PURE__ */ React.createElement("button", {
|
|
3079
4031
|
type: "button",
|
|
3080
|
-
className: `tac-item${selected ? " tac-selected" : ""}${single ? " tac-item-single" : ""}`,
|
|
4032
|
+
className: `tac-item${selected ? " tac-selected" : ""}${single ? " tac-item-single" : ""}${deleting && !(more || swipe) ? " ta-pending" : ""}`,
|
|
3081
4033
|
"aria-current": selected || undefined,
|
|
4034
|
+
"aria-busy": deleting || undefined,
|
|
4035
|
+
"data-unseen": dot === "attention" ? "" : undefined,
|
|
3082
4036
|
title: hint,
|
|
3083
4037
|
onClick: onSelect
|
|
3084
4038
|
}, check, /* @__PURE__ */ React.createElement("span", {
|
|
@@ -3093,13 +4047,15 @@ function Row({ pi, avatar, title, badge, preview, live, dot, waiting, fresh, tim
|
|
|
3093
4047
|
className: "tac-item-title"
|
|
3094
4048
|
}, title), badge, single && spinner, /* @__PURE__ */ React.createElement("span", {
|
|
3095
4049
|
className: "tac-item-time"
|
|
3096
|
-
},
|
|
4050
|
+
}, deleting ? /* @__PURE__ */ React.createElement("span", {
|
|
4051
|
+
className: "tac-spinner ta-spinner ta-later"
|
|
4052
|
+
}) : time)), !single && /* @__PURE__ */ React.createElement("span", {
|
|
3097
4053
|
className: "tac-item-bottom"
|
|
3098
4054
|
}, place, /* @__PURE__ */ React.createElement("span", {
|
|
3099
4055
|
className: `tac-item-preview${live ? " tac-now" : ""}${waiting ? " tac-waiting" : ""}${fresh ? " tac-fresh" : ""}`
|
|
3100
4056
|
}, preview), spinner)));
|
|
3101
4057
|
const SwipeRow = pi.ui.SwipeRow;
|
|
3102
|
-
const className = `tac-item-row${selected ? " tac-selected" : ""}`;
|
|
4058
|
+
const className = `tac-item-row${selected ? " tac-selected" : ""}${deleting ? " ta-pending" : ""}`;
|
|
3103
4059
|
if (SwipeRow && (more || swipe)) {
|
|
3104
4060
|
return /* @__PURE__ */ React.createElement(SwipeRow, {
|
|
3105
4061
|
className,
|
|
@@ -3110,9 +4066,22 @@ function Row({ pi, avatar, title, badge, preview, live, dot, waiting, fresh, tim
|
|
|
3110
4066
|
className
|
|
3111
4067
|
}, row, more) : row;
|
|
3112
4068
|
}
|
|
3113
|
-
function
|
|
4069
|
+
function swipePinDelete(pi, pinned, pin, remove) {
|
|
4070
|
+
const w = ChannelViews.words(pi);
|
|
4071
|
+
const fail = (error) => pi.ui.notify(ChannelViews.message(error), "error");
|
|
4072
|
+
return [
|
|
4073
|
+
{ key: "pin", label: pinned ? w.unpin : w.pin, run: () => void pin(!pinned).catch(fail) },
|
|
4074
|
+
{ key: "delete", label: w.delete, danger: true, run: () => void remove().catch(fail) }
|
|
4075
|
+
];
|
|
4076
|
+
}
|
|
4077
|
+
function PinMark({ pi, pinned }) {
|
|
3114
4078
|
const w = ChannelViews.words(pi);
|
|
3115
|
-
return
|
|
4079
|
+
return pinned ? /* @__PURE__ */ React.createElement("span", {
|
|
4080
|
+
className: "tac-pinned",
|
|
4081
|
+
title: w.pinned,
|
|
4082
|
+
role: "img",
|
|
4083
|
+
"aria-label": w.pinned
|
|
4084
|
+
}, ChannelViews.maybeIcon(pi, "Pin", null, 12)) : null;
|
|
3116
4085
|
}
|
|
3117
4086
|
function SidebarHead({ context }) {
|
|
3118
4087
|
const { pi, ui } = context;
|
|
@@ -3125,6 +4094,8 @@ function SidebarHead({ context }) {
|
|
|
3125
4094
|
const X = ChannelViews.icon(pi, "X");
|
|
3126
4095
|
const Hash = ChannelViews.icon(pi, "Hash");
|
|
3127
4096
|
const Bot = ChannelViews.icon(pi, "Bot");
|
|
4097
|
+
const ScanLine = ChannelViews.icon(pi, "ScanLine");
|
|
4098
|
+
const scan = pi.ui.scan;
|
|
3128
4099
|
React.useEffect(() => {
|
|
3129
4100
|
if (!menu) {
|
|
3130
4101
|
return;
|
|
@@ -3192,7 +4163,16 @@ function SidebarHead({ context }) {
|
|
|
3192
4163
|
onClick: () => begin("channel")
|
|
3193
4164
|
}, /* @__PURE__ */ React.createElement(Hash, {
|
|
3194
4165
|
size: 14
|
|
3195
|
-
}), w.newChannel)
|
|
4166
|
+
}), w.newChannel), scan && /* @__PURE__ */ React.createElement("button", {
|
|
4167
|
+
type: "button",
|
|
4168
|
+
role: "menuitem",
|
|
4169
|
+
onClick: () => {
|
|
4170
|
+
setMenu(false);
|
|
4171
|
+
scan();
|
|
4172
|
+
}
|
|
4173
|
+
}, /* @__PURE__ */ React.createElement(ScanLine, {
|
|
4174
|
+
size: 14
|
|
4175
|
+
}), w.scan))), creating && /* @__PURE__ */ React.createElement(NewChannelDialog, {
|
|
3196
4176
|
context,
|
|
3197
4177
|
onClose: () => ui.set({ creating: false })
|
|
3198
4178
|
}));
|
|
@@ -3263,6 +4243,7 @@ function Section({
|
|
|
3263
4243
|
type: "button",
|
|
3264
4244
|
className: "tac-section-head",
|
|
3265
4245
|
"aria-expanded": !closed,
|
|
4246
|
+
"data-unseen": closed && alert ? "" : undefined,
|
|
3266
4247
|
onClick: () => onFold(id)
|
|
3267
4248
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
3268
4249
|
className: "tac-section-title"
|
|
@@ -3278,18 +4259,23 @@ function Section({
|
|
|
3278
4259
|
}, children));
|
|
3279
4260
|
}
|
|
3280
4261
|
var SEEN_KEY = "ui.seenTasks";
|
|
3281
|
-
|
|
4262
|
+
var AGENTS_SEEN_KEY = "ui.agentsSeen";
|
|
4263
|
+
var DOUBLE_LOOK = "double";
|
|
4264
|
+
function useSeen(storage, key) {
|
|
3282
4265
|
const [seen, setSeen] = React.useState();
|
|
4266
|
+
const latest = React.useRef(undefined);
|
|
3283
4267
|
React.useEffect(() => {
|
|
3284
4268
|
let live = true;
|
|
3285
|
-
const read = () => storage.get(
|
|
4269
|
+
const read = () => storage.get(key).then((kept) => {
|
|
3286
4270
|
if (!live) {
|
|
3287
4271
|
return;
|
|
3288
4272
|
}
|
|
3289
|
-
const
|
|
4273
|
+
const local = latest.current;
|
|
4274
|
+
const next = kept ? local ? SidebarUtil.mergeSeen(local, kept) : kept : local ?? { since: Date.now(), at: {} };
|
|
4275
|
+
latest.current = next;
|
|
3290
4276
|
setSeen(next);
|
|
3291
|
-
if (!kept) {
|
|
3292
|
-
storage.set(
|
|
4277
|
+
if (!kept || next !== kept && JSON.stringify(next) !== JSON.stringify(kept)) {
|
|
4278
|
+
storage.set(key, next).catch(() => {
|
|
3293
4279
|
return;
|
|
3294
4280
|
});
|
|
3295
4281
|
}
|
|
@@ -3297,31 +4283,34 @@ function useSeenTasks(storage, tasks) {
|
|
|
3297
4283
|
return;
|
|
3298
4284
|
});
|
|
3299
4285
|
read();
|
|
3300
|
-
const stop = storage.onChange((keys) => keys.includes(
|
|
4286
|
+
const stop = storage.onChange((keys) => keys.includes(key) && void read());
|
|
3301
4287
|
return () => {
|
|
3302
4288
|
live = false;
|
|
3303
4289
|
stop();
|
|
3304
4290
|
};
|
|
3305
|
-
}, [storage]);
|
|
3306
|
-
const
|
|
3307
|
-
|
|
3308
|
-
if (
|
|
3309
|
-
|
|
3310
|
-
const at = Object.fromEntries(Object.entries(seen.at).filter(([key]) => keys.has(key)));
|
|
3311
|
-
const next = { since: seen.since, at: { ...at, [task.key]: Date.now() } };
|
|
4291
|
+
}, [storage, key]);
|
|
4292
|
+
const look = React.useCallback((id, at, kept) => {
|
|
4293
|
+
const next = latest.current && SidebarUtil.look(latest.current, id, at, kept);
|
|
4294
|
+
if (next) {
|
|
4295
|
+
latest.current = next;
|
|
3312
4296
|
setSeen(next);
|
|
3313
|
-
storage.set(
|
|
4297
|
+
storage.set(key, next).catch(() => {
|
|
3314
4298
|
return;
|
|
3315
4299
|
});
|
|
3316
4300
|
}
|
|
4301
|
+
}, [storage, key]);
|
|
4302
|
+
return { seen, look };
|
|
4303
|
+
}
|
|
4304
|
+
function useSeenTasks(storage, tasks) {
|
|
4305
|
+
const { seen, look } = useSeen(storage, SEEN_KEY);
|
|
4306
|
+
const needsLook = (task) => SidebarUtil.needsLook(task, seen ?? { since: Number.POSITIVE_INFINITY, at: {} });
|
|
4307
|
+
const open = (task) => {
|
|
4308
|
+
const keys = new Set(tasks.map((each) => each.key));
|
|
4309
|
+
look(task.key, Date.now(), (key) => keys.has(key));
|
|
3317
4310
|
task.open();
|
|
3318
4311
|
};
|
|
3319
4312
|
return { needsLook, open };
|
|
3320
4313
|
}
|
|
3321
|
-
var TO_LOOK_KEY = "ui.agentsToLook";
|
|
3322
|
-
var DOUBLE_LOOK = "double";
|
|
3323
|
-
var NO_MARKS = {};
|
|
3324
|
-
var NOBODY = { own: [], channel: [] };
|
|
3325
4314
|
function useVisible() {
|
|
3326
4315
|
const [visible, setVisible] = React.useState(() => document.visibilityState === "visible");
|
|
3327
4316
|
React.useEffect(() => {
|
|
@@ -3331,30 +4320,32 @@ function useVisible() {
|
|
|
3331
4320
|
}, []);
|
|
3332
4321
|
return visible;
|
|
3333
4322
|
}
|
|
3334
|
-
function
|
|
3335
|
-
const
|
|
4323
|
+
function useUnseen(storage, latest, busy, shown, answered, known) {
|
|
4324
|
+
const { seen, look } = useSeen(storage, AGENTS_SEEN_KEY);
|
|
3336
4325
|
const looking = useVisible() ? shown : undefined;
|
|
3337
|
-
const
|
|
3338
|
-
const
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
setRef.current = setMarks;
|
|
3342
|
-
const key = JSON.stringify([answering, inChannel, looking ?? null, known ?? null]);
|
|
4326
|
+
const lookingAt = looking === undefined ? undefined : latest.get(looking);
|
|
4327
|
+
const lookingBusy = looking !== undefined && busy.has(looking);
|
|
4328
|
+
const knownKey = known?.join(`
|
|
4329
|
+
`);
|
|
3343
4330
|
React.useEffect(() => {
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
if (next) {
|
|
3349
|
-
setRef.current(next);
|
|
4331
|
+
if (looking !== undefined && !lookingBusy) {
|
|
4332
|
+
const ids = knownKey === undefined ? undefined : new Set(knownKey.split(`
|
|
4333
|
+
`));
|
|
4334
|
+
look(looking, Math.max(Date.now(), lookingAt ?? 0), ids && ((id) => ids.has(id)));
|
|
3350
4335
|
}
|
|
3351
|
-
}, [
|
|
3352
|
-
return
|
|
4336
|
+
}, [look, looking, lookingBusy, lookingAt, knownKey]);
|
|
4337
|
+
return (id) => id !== looking && !busy.has(id) && SidebarUtil.unseen(latest.get(id), seen, id, answered[id]);
|
|
3353
4338
|
}
|
|
3354
4339
|
function useSessionLines(context, changed) {
|
|
3355
4340
|
const { pi } = context;
|
|
4341
|
+
const listed = pi.ui.useSavedSessions?.();
|
|
4342
|
+
const follows = !!listed;
|
|
3356
4343
|
const [lines, setLines] = React.useState(context.sessionLines);
|
|
4344
|
+
const again = follows ? "" : changed;
|
|
3357
4345
|
React.useEffect(() => {
|
|
4346
|
+
if (follows && context.sessionLines) {
|
|
4347
|
+
return;
|
|
4348
|
+
}
|
|
3358
4349
|
let live = true;
|
|
3359
4350
|
const read = () => Promise.all([pi.server.listSessions().catch(() => []), pi.server.listSavedSessions().catch(() => [])]).then(([open, saved]) => {
|
|
3360
4351
|
context.sessionLines = [...saved, ...open];
|
|
@@ -3363,14 +4354,19 @@ function useSessionLines(context, changed) {
|
|
|
3363
4354
|
}
|
|
3364
4355
|
});
|
|
3365
4356
|
read();
|
|
3366
|
-
|
|
3367
|
-
|
|
4357
|
+
if (follows) {
|
|
4358
|
+
return () => {
|
|
4359
|
+
live = false;
|
|
4360
|
+
};
|
|
4361
|
+
}
|
|
4362
|
+
const onShow = () => document.visibilityState === "visible" && void read();
|
|
4363
|
+
document.addEventListener("visibilitychange", onShow);
|
|
3368
4364
|
return () => {
|
|
3369
4365
|
live = false;
|
|
3370
|
-
document.removeEventListener("visibilitychange",
|
|
4366
|
+
document.removeEventListener("visibilitychange", onShow);
|
|
3371
4367
|
};
|
|
3372
|
-
}, [context, pi,
|
|
3373
|
-
return lines;
|
|
4368
|
+
}, [context, pi, follows, again]);
|
|
4369
|
+
return React.useMemo(() => lines && listed ? [...lines, ...listed] : lines, [lines, listed]);
|
|
3374
4370
|
}
|
|
3375
4371
|
function useTaskSelection(pi, tasks) {
|
|
3376
4372
|
const [chosen, setChosen] = React.useState();
|
|
@@ -3453,6 +4449,37 @@ function TaskItem({ context, task, selection, seen }) {
|
|
|
3453
4449
|
})
|
|
3454
4450
|
});
|
|
3455
4451
|
}
|
|
4452
|
+
var NO_HOME_ITEMS = [];
|
|
4453
|
+
function HomeRow({ pi, item }) {
|
|
4454
|
+
const [opening, setOpening] = React.useState(false);
|
|
4455
|
+
const Glyph = item.icon;
|
|
4456
|
+
const Own = item.face;
|
|
4457
|
+
const open = () => {
|
|
4458
|
+
setOpening(true);
|
|
4459
|
+
Promise.resolve().then(() => item.open()).catch((error) => pi.ui.notify(ChannelViews.message(error), "error")).finally(() => setOpening(false));
|
|
4460
|
+
};
|
|
4461
|
+
return /* @__PURE__ */ React.createElement(Row, {
|
|
4462
|
+
pi,
|
|
4463
|
+
avatar: Own && !opening ? /* @__PURE__ */ React.createElement(Own, {
|
|
4464
|
+
size: 40
|
|
4465
|
+
}) : /* @__PURE__ */ React.createElement("span", {
|
|
4466
|
+
className: "tac-home-icon",
|
|
4467
|
+
style: { background: `var(--ta-tint-${item.tone})`, color: `var(--ta-tint-ink-${item.tone})` }
|
|
4468
|
+
}, opening ? /* @__PURE__ */ React.createElement("span", {
|
|
4469
|
+
className: "ta-spinner"
|
|
4470
|
+
}) : /* @__PURE__ */ React.createElement(Glyph, {
|
|
4471
|
+
size: 19,
|
|
4472
|
+
strokeWidth: 1.8
|
|
4473
|
+
})),
|
|
4474
|
+
title: item.title,
|
|
4475
|
+
preview: item.detail ?? "",
|
|
4476
|
+
fresh: item.unseen,
|
|
4477
|
+
dot: item.unseen ? "attention" : undefined,
|
|
4478
|
+
time: item.at ? SidebarUtil.time(item.at, pi.ui.language) : "",
|
|
4479
|
+
selected: false,
|
|
4480
|
+
onSelect: open
|
|
4481
|
+
});
|
|
4482
|
+
}
|
|
3456
4483
|
function AgentsSidebar({ context }) {
|
|
3457
4484
|
const { pi, service, ui } = context;
|
|
3458
4485
|
const state = useChannels(service);
|
|
@@ -3465,6 +4492,9 @@ function AgentsSidebar({ context }) {
|
|
|
3465
4492
|
const channelPage = pi.ui.useView(CHANNEL_PAGE);
|
|
3466
4493
|
const agentPage = pi.ui.useView(AGENT_PAGE);
|
|
3467
4494
|
const tasks = pi.ui.useTasks();
|
|
4495
|
+
const homeItems = pi.ui.useHomeItems?.() ?? NO_HOME_ITEMS;
|
|
4496
|
+
const homeShown = homeItems.filter((item) => SidebarUtil.matches(query, item.title, item.detail));
|
|
4497
|
+
const homeSections = SidebarUtil.homeSections(homeShown);
|
|
3468
4498
|
const [folded, fold] = useFolded();
|
|
3469
4499
|
const [byDirectory, setByDirectory] = useStored(pi.storage, BY_DIRECTORY_KEY, false);
|
|
3470
4500
|
const language = pi.ui.language;
|
|
@@ -3487,13 +4517,29 @@ function AgentsSidebar({ context }) {
|
|
|
3487
4517
|
const openSessions = pi.ui.useSessions?.() ?? NO_SESSIONS;
|
|
3488
4518
|
const lastLines = React.useMemo(() => sessionLines && SidebarUtil.lastLines(team.agents, state.messages, [...sessionLines, ...openSessions]), [team.agents, state.messages, sessionLines, openSessions]);
|
|
3489
4519
|
const answering = React.useMemo(() => SidebarUtil.answering(team.agents, openSessions, context.sessions), [team.agents, openSessions, context.sessions]);
|
|
4520
|
+
const asking = React.useMemo(() => SidebarUtil.waiting(team.agents, openSessions, context.sessions), [team.agents, openSessions, context.sessions]);
|
|
3490
4521
|
const doubleBusy = !!double?.busy;
|
|
3491
|
-
const inChannel = Object.values(working).flat();
|
|
3492
4522
|
const pageShown = !!double?.shown || !!channelPage?.shown || !!agentPage?.shown;
|
|
3493
4523
|
const shownFile = shownSession ? openSessions.find((session) => session.sessionId === shownSession)?.sessionFile : undefined;
|
|
3494
4524
|
const shownAgent = pageShown ? undefined : team.agents.find((agent) => !!shownSession && context.sessions.get(agent.id) === shownSession || !!shownFile && agent.sessionFile === shownFile)?.id;
|
|
3495
|
-
const
|
|
3496
|
-
const
|
|
4525
|
+
const doubleAt = double?.preview?.at;
|
|
4526
|
+
const latest = React.useMemo(() => {
|
|
4527
|
+
const sessions = [...sessionLines ?? [], ...openSessions];
|
|
4528
|
+
const map = new Map;
|
|
4529
|
+
for (const agent of team.agents) {
|
|
4530
|
+
const at = SidebarUtil.lastAt(agent, sessions, context.sessions);
|
|
4531
|
+
if (at !== undefined) {
|
|
4532
|
+
map.set(agent.id, at);
|
|
4533
|
+
}
|
|
4534
|
+
}
|
|
4535
|
+
if (doubleAt !== undefined) {
|
|
4536
|
+
map.set(DOUBLE_LOOK, doubleAt);
|
|
4537
|
+
}
|
|
4538
|
+
return map;
|
|
4539
|
+
}, [team.agents, sessionLines, openSessions, context.sessions, doubleAt]);
|
|
4540
|
+
const busyNow = React.useMemo(() => new Set([...answering, ...Object.values(working).flat(), ...doubleBusy ? [DOUBLE_LOOK] : []]), [answering, working, doubleBusy]);
|
|
4541
|
+
const needsLook = useUnseen(pi.storage, latest, busyNow, double?.shown ? DOUBLE_LOOK : shownAgent, state.answered, state.loaded ? [DOUBLE_LOOK, ...team.agents.map((agent) => agent.id)] : undefined);
|
|
4542
|
+
const doubleFresh = needsLook(DOUBLE_LOOK);
|
|
3497
4543
|
React.useEffect(() => {
|
|
3498
4544
|
for (const channel of own) {
|
|
3499
4545
|
service.messages(channel.id).catch(() => {
|
|
@@ -3507,7 +4553,7 @@ function AgentsSidebar({ context }) {
|
|
|
3507
4553
|
const selection = useTaskSelection(pi, shownTasks);
|
|
3508
4554
|
const SelectBar = pi.ui.SelectBar;
|
|
3509
4555
|
const channels = ChannelsUtil.pinnedFirst(own).filter((channel) => SidebarUtil.matches(query, channel.name, channel.topic, ...membersOf(team, channel).map((agent) => agent.name)));
|
|
3510
|
-
const agents = ChannelsUtil.standing(team).filter((agent) => SidebarUtil.matches(query, agent.name, agent.role));
|
|
4556
|
+
const agents = ChannelsUtil.pinnedFirst(ChannelsUtil.standing(team)).filter((agent) => SidebarUtil.matches(query, agent.name, agent.role));
|
|
3511
4557
|
const directories = SidebarUtil.directories(agents, serverCwd);
|
|
3512
4558
|
const memberGroups = SidebarUtil.memberGroups(agents, serverCwd, byDirectory && !query.trim());
|
|
3513
4559
|
const openAgent = (agent) => {
|
|
@@ -3519,7 +4565,7 @@ function AgentsSidebar({ context }) {
|
|
|
3519
4565
|
return opening === agent.id || !pageShown && !!sessionId && sessionId === shownSession;
|
|
3520
4566
|
};
|
|
3521
4567
|
const ended = allEnded || selection.selecting ? groups.ended : groups.ended.slice(0, ENDED_SHOWN);
|
|
3522
|
-
const nothing = query && shownTasks.length === 0 && channels.length === 0 && agents.length === 0;
|
|
4568
|
+
const nothing = query && shownTasks.length === 0 && channels.length === 0 && agents.length === 0 && homeShown.length === 0;
|
|
3523
4569
|
const running = tasks.filter((task) => task.status === "running").length;
|
|
3524
4570
|
const waiting = tasks.filter((task) => task.status === "waiting").length;
|
|
3525
4571
|
const fresh = tasks.filter((task) => task.status !== "waiting" && seen.needsLook(task)).length;
|
|
@@ -3538,6 +4584,7 @@ function AgentsSidebar({ context }) {
|
|
|
3538
4584
|
type: "button",
|
|
3539
4585
|
className: `tac-double${double.shown ? " tac-selected" : ""}`,
|
|
3540
4586
|
"aria-current": double.shown || undefined,
|
|
4587
|
+
"data-unseen": waiting > 0 || fresh > 0 || doubleFresh ? "" : undefined,
|
|
3541
4588
|
onClick: () => pi.ui.showView(DOUBLE_PAGE)
|
|
3542
4589
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
3543
4590
|
className: "tac-double-face"
|
|
@@ -3569,6 +4616,10 @@ function AgentsSidebar({ context }) {
|
|
|
3569
4616
|
items: () => (double.menu?.() ?? []).map((section) => section.map(({ icon: Icon, ...item }) => ({ ...item, icon: Icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
3570
4617
|
size: 15
|
|
3571
4618
|
}) })))
|
|
4619
|
+
})), homeShown.filter((item) => !item.section).map((item) => /* @__PURE__ */ React.createElement(HomeRow, {
|
|
4620
|
+
key: item.key,
|
|
4621
|
+
pi,
|
|
4622
|
+
item
|
|
3572
4623
|
})), draft && /* @__PURE__ */ React.createElement(Row, {
|
|
3573
4624
|
pi,
|
|
3574
4625
|
avatar: /* @__PURE__ */ React.createElement(Face, {
|
|
@@ -3613,7 +4664,7 @@ function AgentsSidebar({ context }) {
|
|
|
3613
4664
|
count: agents.length,
|
|
3614
4665
|
folded,
|
|
3615
4666
|
onFold: fold,
|
|
3616
|
-
alert: agents.some((agent) =>
|
|
4667
|
+
alert: agents.some((agent) => needsLook(agent.id)),
|
|
3617
4668
|
action: directories > 1 && /* @__PURE__ */ React.createElement("button", {
|
|
3618
4669
|
type: "button",
|
|
3619
4670
|
className: "tac-section-action",
|
|
@@ -3639,7 +4690,8 @@ function AgentsSidebar({ context }) {
|
|
|
3639
4690
|
const last = lastLines?.get(agent.id);
|
|
3640
4691
|
const line = lastLines ? last?.text ?? w.noMessages : "";
|
|
3641
4692
|
const busy = !!where || answering.has(agent.id);
|
|
3642
|
-
const
|
|
4693
|
+
const needsYou = asking.has(agent.id);
|
|
4694
|
+
const unseen = !busy && needsLook(agent.id);
|
|
3643
4695
|
return /* @__PURE__ */ React.createElement(Row, {
|
|
3644
4696
|
pi,
|
|
3645
4697
|
key: agent.id,
|
|
@@ -3650,16 +4702,22 @@ function AgentsSidebar({ context }) {
|
|
|
3650
4702
|
working: busy
|
|
3651
4703
|
}),
|
|
3652
4704
|
title: agent.name,
|
|
4705
|
+
badge: /* @__PURE__ */ React.createElement(PinMark, {
|
|
4706
|
+
pi,
|
|
4707
|
+
pinned: agent.pinned
|
|
4708
|
+
}),
|
|
3653
4709
|
place: /* @__PURE__ */ React.createElement(HostTag, {
|
|
3654
4710
|
location: cwd
|
|
3655
4711
|
}),
|
|
3656
|
-
preview: where ? ChannelWords.format(w.answeringIn, { channel: where.name }) : line,
|
|
3657
|
-
live: busy,
|
|
4712
|
+
preview: needsYou ? w.needsYou : where ? ChannelWords.format(w.answeringIn, { channel: where.name }) : line,
|
|
4713
|
+
live: busy && !needsYou,
|
|
4714
|
+
waiting: needsYou,
|
|
3658
4715
|
fresh: unseen,
|
|
3659
|
-
dot: busy ? "running" : unseen ? "attention" : undefined,
|
|
4716
|
+
dot: needsYou ? "attention" : busy ? "running" : unseen ? "attention" : undefined,
|
|
3660
4717
|
time: lastLines ? SidebarUtil.time(last?.at ?? agent.createdAt, pi.ui.language) : "",
|
|
3661
4718
|
hint: SidebarUtil.where(cwd),
|
|
3662
4719
|
selected: agentSelected(agent),
|
|
4720
|
+
deleting: state.deleting.includes(agent.id),
|
|
3663
4721
|
onSelect: () => openAgent(agent),
|
|
3664
4722
|
more: /* @__PURE__ */ React.createElement(AgentMenu, {
|
|
3665
4723
|
context,
|
|
@@ -3667,7 +4725,7 @@ function AgentsSidebar({ context }) {
|
|
|
3667
4725
|
cwd,
|
|
3668
4726
|
working: !!where
|
|
3669
4727
|
}),
|
|
3670
|
-
swipe:
|
|
4728
|
+
swipe: swipePinDelete(pi, !!agent.pinned, (pinned) => context.service.updateAgent(agent.id, { pinned }), () => deleteAgent(context, agent))
|
|
3671
4729
|
});
|
|
3672
4730
|
})))), channels.length > 0 && /* @__PURE__ */ React.createElement(Section, {
|
|
3673
4731
|
id: "channels",
|
|
@@ -3691,27 +4749,38 @@ function AgentsSidebar({ context }) {
|
|
|
3691
4749
|
working: busy
|
|
3692
4750
|
}),
|
|
3693
4751
|
title: channel.name,
|
|
3694
|
-
badge:
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
"aria-label": w.pinned
|
|
3699
|
-
}, ChannelViews.maybeIcon(pi, "Pin", null, 12)),
|
|
4752
|
+
badge: /* @__PURE__ */ React.createElement(PinMark, {
|
|
4753
|
+
pi,
|
|
4754
|
+
pinned: channel.pinned
|
|
4755
|
+
}),
|
|
3700
4756
|
preview,
|
|
3701
4757
|
live: busy.length > 0,
|
|
3702
4758
|
dot: busy.length > 0 ? "running" : unread.includes(channel.id) ? "attention" : undefined,
|
|
3703
4759
|
time: SidebarUtil.time(last?.at ?? channel.createdAt, pi.ui.language),
|
|
3704
4760
|
hint: channel.topic ? `#${channel.name} · ${channel.topic}` : `#${channel.name}`,
|
|
3705
4761
|
selected: !!channelPage?.shown && channelId === channel.id,
|
|
4762
|
+
deleting: state.deleting.includes(channel.id),
|
|
3706
4763
|
onSelect: () => context.showChannel(channel.id),
|
|
3707
4764
|
more: /* @__PURE__ */ React.createElement(ChannelMenu, {
|
|
3708
4765
|
context,
|
|
3709
4766
|
channel,
|
|
3710
4767
|
working: busy
|
|
3711
4768
|
}),
|
|
3712
|
-
swipe:
|
|
4769
|
+
swipe: swipePinDelete(pi, !!channel.pinned, (pinned) => context.service.updateChannel(channel.id, { pinned }), () => deleteChannel(context, channel))
|
|
3713
4770
|
});
|
|
3714
|
-
}))
|
|
4771
|
+
})), homeSections.map((section) => /* @__PURE__ */ React.createElement(Section, {
|
|
4772
|
+
key: section.id,
|
|
4773
|
+
id: section.id,
|
|
4774
|
+
title: section.title,
|
|
4775
|
+
count: section.items.length,
|
|
4776
|
+
folded,
|
|
4777
|
+
onFold: fold,
|
|
4778
|
+
alert: section.items.some((item) => item.unseen)
|
|
4779
|
+
}, section.items.map((item) => /* @__PURE__ */ React.createElement(HomeRow, {
|
|
4780
|
+
key: item.key,
|
|
4781
|
+
pi,
|
|
4782
|
+
item
|
|
4783
|
+
}))))), selection.selecting && SelectBar && /* @__PURE__ */ React.createElement(SelectBar, {
|
|
3715
4784
|
count: selection.selected.length,
|
|
3716
4785
|
total: selection.removable.length,
|
|
3717
4786
|
onSelectAll: selection.selectAll,
|
|
@@ -3747,7 +4816,7 @@ var STYLE = `
|
|
|
3747
4816
|
.tac-double:hover { --tac-double-bg: var(--ta-hover); }
|
|
3748
4817
|
.tac-double.tac-selected { --tac-double-edge: color-mix(in srgb, var(--ta-accent) 40%, transparent); }
|
|
3749
4818
|
/* The dinosaur on a disc of its color, as a profile picture. */
|
|
3750
|
-
.tac-double-face { display: inline-grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 50%; background: color-mix(in
|
|
4819
|
+
.tac-double-face { display: inline-grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 50%; background: color-mix(in oklch, var(--ta-accent) 34%, var(--ta-main)); }
|
|
3751
4820
|
.tac-double-text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
|
|
3752
4821
|
/* A finger has no … to hover: the card says it opens, as a profile card does. */
|
|
3753
4822
|
.tac-double-go { display: none; flex: none; margin-right: -2px; color: var(--ta-muted); opacity: 0.7; }
|
|
@@ -3789,10 +4858,64 @@ var STYLE = `
|
|
|
3789
4858
|
.tac-msg-bubble pre { max-width: 100%; overflow-x: auto; }
|
|
3790
4859
|
.tac-mention { color: var(--ta-link); }
|
|
3791
4860
|
.tac-notice { align-self: center; margin: 10px 0; padding: 3px 10px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
4861
|
+
/* The notice of a channel (notice.tsx): a line over the chat, open to read and to write */
|
|
4862
|
+
.tac-notice-bar { flex: none; width: 100%; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 8px 24px 0; box-sizing: border-box; }
|
|
4863
|
+
.tac-notice-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 0 10px 0 8px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: var(--ta-side); color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background 120ms, border-radius 160ms; }
|
|
4864
|
+
.tac-notice-head:hover { background: var(--ta-hover); }
|
|
4865
|
+
.tac-notice-bar[data-open] .tac-notice-head { border-bottom-color: transparent; border-radius: 12px 12px 0 0; }
|
|
4866
|
+
.tac-notice-icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: color-mix(in srgb, var(--ta-yellow) 18%, transparent); color: color-mix(in srgb, var(--ta-yellow) 70%, var(--ta-text)); }
|
|
4867
|
+
.tac-notice-head > strong { flex: none; font-weight: 600; }
|
|
4868
|
+
.tac-notice-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); }
|
|
4869
|
+
.tac-notice-chevron { flex: none; display: grid; color: var(--ta-muted); transition: transform 160ms var(--ta-ease); }
|
|
4870
|
+
.tac-notice-bar[data-open] .tac-notice-chevron { transform: rotate(180deg); }
|
|
4871
|
+
.tac-notice-body { max-height: min(46vh, 420px); overflow-y: auto; padding: 4px 14px 10px; border: 1px solid var(--ta-border-muted); border-top: 0; border-radius: 0 0 12px 12px; background: var(--ta-side); animation: tac-notice-in 160ms var(--ta-ease) both; }
|
|
4872
|
+
.tac-notice-text { color: var(--ta-body); font-size: calc(13.5px * var(--ta-font-scale)); line-height: 1.6; overflow-wrap: anywhere; }
|
|
4873
|
+
.tac-notice-text h3 { margin: 10px 0 4px; font-size: calc(12.5px * var(--ta-font-scale)); color: var(--ta-secondary); }
|
|
4874
|
+
.tac-notice-text ul { margin: 0; padding-left: 1.2em; }
|
|
4875
|
+
.tac-notice-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
4876
|
+
.tac-notice-form { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
|
|
4877
|
+
textarea.tac-notice-input { min-height: 180px; font-family: var(--ta-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: calc(12.5px * var(--ta-font-scale)); }
|
|
4878
|
+
.tac-notice-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
|
4879
|
+
button.tac-notice-line { border: 0; font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; }
|
|
4880
|
+
button.tac-notice-line:hover:not(:disabled) { color: var(--ta-text); }
|
|
4881
|
+
button.tac-notice-line:disabled { cursor: default; }
|
|
4882
|
+
@keyframes tac-notice-in { from { opacity: 0; transform: translateY(-4px); } }
|
|
4883
|
+
@media (max-width: 720px) {
|
|
4884
|
+
.tac-notice-bar { padding: 6px 14px 0; }
|
|
4885
|
+
}
|
|
4886
|
+
|
|
4887
|
+
/* An agent's card (card.tsx): shared from its menu, opened from its link */
|
|
4888
|
+
.tac-card { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
|
|
4889
|
+
.tac-card-who { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 4px; }
|
|
4890
|
+
.tac-card-face { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 6px; }
|
|
4891
|
+
.tac-card-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--ta-hover); font-size: 22px; font-weight: 700; }
|
|
4892
|
+
.tac-card-name { font-size: calc(16px * var(--ta-font-scale)); font-weight: 600; }
|
|
4893
|
+
.tac-card-kind { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
4894
|
+
.tac-card-role { max-height: 160px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: var(--ta-side); color: var(--ta-body); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
4895
|
+
.tac-card-page .tac-card-role { max-height: none; white-space: normal; }
|
|
4896
|
+
.tac-card-qr { display: grid; place-items: center; }
|
|
4897
|
+
.tac-card-qr canvas, .tac-card-qr svg, .tac-card-qr img { width: 168px; height: 168px; }
|
|
4898
|
+
.tac-card-link { padding: 8px 10px; border-radius: 8px; background: var(--ta-hover); color: var(--ta-secondary); font-family: var(--ta-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: calc(11.5px * var(--ta-font-scale)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
4899
|
+
.tac-card-actions { display: flex; justify-content: center; gap: 8px; }
|
|
4900
|
+
.tac-card-actions .tac-button { height: 36px; padding: 0 16px; }
|
|
4901
|
+
.tac-card-stop { align-self: center; padding: 4px 8px; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
|
|
4902
|
+
.tac-card-stop:hover:not(:disabled) { color: var(--ta-red); }
|
|
4903
|
+
.tac-card-making { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 120px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); }
|
|
4904
|
+
.tac-card-page { flex: 1; min-height: 0; height: 100%; overflow-y: auto; padding: 28px 20px 40px; box-sizing: border-box; background: var(--ta-main); color: var(--ta-text); }
|
|
4905
|
+
.tac-card-page > .tac-card { max-width: 520px; margin: 0 auto; }
|
|
4906
|
+
.tac-card-page .tac-button.tac-primary { height: 40px; font-size: calc(14px * var(--ta-font-scale)); }
|
|
4907
|
+
.tac-card-dir { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
|
|
4908
|
+
.tac-card-dir > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
4909
|
+
.tac-card-done { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ta-green) 10%, transparent); color: var(--ta-green); font-size: calc(13.5px * var(--ta-font-scale)); }
|
|
4910
|
+
.tac-center { text-align: center; }
|
|
4911
|
+
|
|
3792
4912
|
.tac-live { display: flex; align-items: center; gap: 8px; align-self: flex-start; margin: 10px 0 0 38px; padding: 5px 12px 5px 8px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-secondary); font-size: calc(12.5px * var(--ta-font-scale)); }
|
|
3793
4913
|
.tac-live-faces { display: inline-flex; }
|
|
3794
4914
|
.tac-live-faces > * + * { margin-left: -4px; }
|
|
3795
4915
|
.tac-chat-bottom { width: 100%; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 8px 24px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; flex: none; display: flex; flex-direction: column; gap: 8px; }
|
|
4916
|
+
/* Above the keyboard the home indicator is not there: no room for it, as under the box of a conversation. */
|
|
4917
|
+
:root[data-keyboard] .tac-chat-bottom { padding-bottom: 8px; }
|
|
4918
|
+
:root[data-keyboard-moving] .tac-chat-bottom { transition: padding-bottom 450ms cubic-bezier(0.15, 0.75, 0.2, 1); }
|
|
3796
4919
|
@media (max-width: 720px) {
|
|
3797
4920
|
.tac-head-topic, .tac-head-face:nth-child(n + 4), .tac-head-more { display: none; }
|
|
3798
4921
|
.tac-chat-col, .tac-chat-bottom { padding-left: 14px; padding-right: 14px; }
|
|
@@ -3900,10 +5023,16 @@ textarea.tac-input { resize: vertical; min-height: 56px; line-height: 1.5; }
|
|
|
3900
5023
|
.tac-chip.tac-on { border-color: var(--ta-accent); color: var(--ta-text); background: var(--ta-selected); }
|
|
3901
5024
|
.tac-chip small { color: var(--ta-muted); }
|
|
3902
5025
|
.tac-buttons { display: flex; justify-content: flex-end; gap: 6px; }
|
|
3903
|
-
|
|
3904
|
-
.tac-button
|
|
3905
|
-
.tac-button:disabled {
|
|
5026
|
+
/* As the buttons of the page (.ta-button). */
|
|
5027
|
+
.tac-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--ta-border); border-radius: 8px; background: transparent; color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); font-weight: 500; white-space: nowrap; cursor: pointer; transition: background 120ms, opacity 120ms; }
|
|
5028
|
+
.tac-button:hover:not(:disabled) { background: var(--ta-hover); }
|
|
5029
|
+
.tac-button.tac-primary { border-color: var(--ta-brand); background: var(--ta-brand); color: var(--ta-brand-text); }
|
|
5030
|
+
.tac-button.tac-primary:hover:not(:disabled) { background: var(--ta-brand); opacity: 0.88; }
|
|
5031
|
+
.tac-button:disabled:not(.ta-busy) { opacity: 0.5; cursor: default; }
|
|
5032
|
+
.tac-button.ta-busy { position: relative; }
|
|
3906
5033
|
.tac-button.tac-danger { border-color: transparent; background: var(--ta-red); color: #fff; }
|
|
5034
|
+
.tac-button.tac-danger > .ta-busy-mark { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
|
|
5035
|
+
.tac-button.tac-danger:hover:not(:disabled) { background: var(--ta-red); opacity: 0.9; }
|
|
3907
5036
|
.tac-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
|
|
3908
5037
|
.tac-link:hover { background: var(--ta-hover); }
|
|
3909
5038
|
.tac-link.tac-danger { color: var(--ta-red); }
|
|
@@ -4021,6 +5150,9 @@ textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: calc(1
|
|
|
4021
5150
|
*/
|
|
4022
5151
|
.tac-dot { position: absolute; right: -2px; bottom: -2px; z-index: 1; width: 12px; height: 12px; box-sizing: border-box; border: 2px solid var(--tac-bg, var(--ta-side)); border-radius: 50%; background: var(--tac-dot); }
|
|
4023
5152
|
.tac-avatar { position: relative; display: inline-flex; flex: none; }
|
|
5153
|
+
/* A row an extension adds under the double (a daily brief): its icon on a tile of its tint, the size of a face. */
|
|
5154
|
+
.tac-home-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
|
|
5155
|
+
.tac-home-icon > .ta-spinner { width: 16px; height: 16px; }
|
|
4024
5156
|
.tac-double-face { position: relative; }
|
|
4025
5157
|
.tac-item:hover { --tac-bg: var(--ta-hover); }
|
|
4026
5158
|
.tac-item.tac-selected { --tac-bg: var(--ta-selected); }
|
|
@@ -4068,6 +5200,11 @@ textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: calc(1
|
|
|
4068
5200
|
/* A finger: no hover to show it; while off it stays away from the list (the choice is the user's on every device), on it shows to turn it off. */
|
|
4069
5201
|
:root[data-touch] .tac-section-action { right: 4px; }
|
|
4070
5202
|
:root[data-touch] .tac-section-action:not([aria-pressed="true"]) { display: none; }
|
|
5203
|
+
/* A hand-off in the conversation it came from */
|
|
5204
|
+
.tac-handoff { margin: 4px 0; padding: 10px 12px; border: 1px solid var(--ta-border-muted); border-radius: 10px; background: var(--ta-card); font-size: calc(13px * var(--ta-font-scale)); }
|
|
5205
|
+
.tac-handoff-head { display: flex; align-items: center; gap: 8px; min-height: 24px; color: var(--ta-secondary); }
|
|
5206
|
+
.tac-handoff-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-text); font-weight: 500; }
|
|
5207
|
+
.tac-handoff-brief { margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; color: var(--ta-secondary); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
4071
5208
|
`;
|
|
4072
5209
|
function injectStyle() {
|
|
4073
5210
|
const element = document.createElement("style");
|
|
@@ -4077,11 +5214,113 @@ function injectStyle() {
|
|
|
4077
5214
|
return () => element.remove();
|
|
4078
5215
|
}
|
|
4079
5216
|
|
|
5217
|
+
// web-src/tool-lines.tsx
|
|
5218
|
+
function text(value) {
|
|
5219
|
+
return typeof value === "string" ? value.trim() : "";
|
|
5220
|
+
}
|
|
5221
|
+
function names(value) {
|
|
5222
|
+
return Array.isArray(value) ? value.map(text).filter(Boolean) : [];
|
|
5223
|
+
}
|
|
5224
|
+
|
|
5225
|
+
class ChannelToolLines {
|
|
5226
|
+
context;
|
|
5227
|
+
icons = new Map;
|
|
5228
|
+
constructor(context) {
|
|
5229
|
+
this.context = context;
|
|
5230
|
+
}
|
|
5231
|
+
renderers() {
|
|
5232
|
+
const w = () => ChannelViews.words(this.context.pi);
|
|
5233
|
+
return {
|
|
5234
|
+
create_agent: {
|
|
5235
|
+
renderCall: (args) => {
|
|
5236
|
+
const name = text(args.name);
|
|
5237
|
+
return { verb: w().toolCreateAgent, target: name, icon: name ? this.faces("agent", [name]) : undefined };
|
|
5238
|
+
}
|
|
5239
|
+
},
|
|
5240
|
+
create_channel: {
|
|
5241
|
+
renderCall: (args) => {
|
|
5242
|
+
const name = text(args.name);
|
|
5243
|
+
const members = names(args.members);
|
|
5244
|
+
return { verb: w().toolCreateChannel, target: name && `#${name}`, icon: members.length ? this.faces("agents", members) : undefined };
|
|
5245
|
+
}
|
|
5246
|
+
},
|
|
5247
|
+
add_to_channel: {
|
|
5248
|
+
renderCall: (args) => {
|
|
5249
|
+
const members = names(args.members);
|
|
5250
|
+
const channel = text(args.channel);
|
|
5251
|
+
return {
|
|
5252
|
+
verb: w().toolAddToChannel,
|
|
5253
|
+
target: [channel && `#${channel}`, members.map((name) => `@${name}`).join(" ")].filter(Boolean).join(" "),
|
|
5254
|
+
icon: members.length ? this.faces("agents", members) : undefined
|
|
5255
|
+
};
|
|
5256
|
+
}
|
|
5257
|
+
},
|
|
5258
|
+
post_to_channel: {
|
|
5259
|
+
renderCall: (args) => {
|
|
5260
|
+
const channel = text(args.channel);
|
|
5261
|
+
return {
|
|
5262
|
+
verb: w().toolPostToChannel,
|
|
5263
|
+
target: [channel && `#${channel}`, text(args.message)].filter(Boolean).join(" "),
|
|
5264
|
+
icon: channel ? this.faces("channel", [channel]) : undefined
|
|
5265
|
+
};
|
|
5266
|
+
}
|
|
5267
|
+
},
|
|
5268
|
+
list_channels: { renderCall: () => ({ verb: w().toolListChannels }) },
|
|
5269
|
+
update_channel_notice: {
|
|
5270
|
+
renderCall: (args) => {
|
|
5271
|
+
const channel = text(args.channel).replace(/^#/, "");
|
|
5272
|
+
return { verb: w().toolNotice, target: channel && `#${channel}`, icon: channel ? this.faces("channel", [channel]) : undefined };
|
|
5273
|
+
}
|
|
5274
|
+
},
|
|
5275
|
+
update_my_role: { renderCall: () => ({ verb: w().toolRole }) },
|
|
5276
|
+
hand_off: {
|
|
5277
|
+
renderCall: (args) => {
|
|
5278
|
+
const to = text(args.to);
|
|
5279
|
+
const channel = to.startsWith("#");
|
|
5280
|
+
const name = to.replace(/^[@#]/, "");
|
|
5281
|
+
return { verb: w().toolHandOff, target: to, icon: name ? this.faces(channel ? "channel" : "agent", [name]) : undefined };
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
};
|
|
5285
|
+
}
|
|
5286
|
+
register() {
|
|
5287
|
+
const renderers = new Map(Object.entries(this.renderers()));
|
|
5288
|
+
this.context.pi.registerToolRenderer?.((name, next) => renderers.get(name) ?? next());
|
|
5289
|
+
}
|
|
5290
|
+
faces(kind, named) {
|
|
5291
|
+
const key = `${kind}:${named.join(",")}`;
|
|
5292
|
+
let icon = this.icons.get(key);
|
|
5293
|
+
if (!icon) {
|
|
5294
|
+
const service = this.context.service;
|
|
5295
|
+
const pick = (team) => {
|
|
5296
|
+
if (kind === "channel") {
|
|
5297
|
+
const channel = team.channels.find((candidate) => candidate.name === named[0]);
|
|
5298
|
+
return channel ? channel.members.map((id) => team.agents.find((agent) => agent.id === id)).filter((agent) => !!agent) : [];
|
|
5299
|
+
}
|
|
5300
|
+
return named.map((name) => team.agents.find((agent) => agent.name === name)).filter((agent) => !!agent);
|
|
5301
|
+
};
|
|
5302
|
+
icon = ({ size }) => {
|
|
5303
|
+
const { team } = React.useSyncExternalStore((listener) => service.subscribe(listener), () => service.state);
|
|
5304
|
+
const faces = useFaces(team);
|
|
5305
|
+
const members = pick(team);
|
|
5306
|
+
return members.length ? /* @__PURE__ */ React.createElement(RoomFace, {
|
|
5307
|
+
members,
|
|
5308
|
+
faces,
|
|
5309
|
+
size,
|
|
5310
|
+
working: []
|
|
5311
|
+
}) : null;
|
|
5312
|
+
};
|
|
5313
|
+
this.icons.set(key, icon);
|
|
5314
|
+
}
|
|
5315
|
+
return icon;
|
|
5316
|
+
}
|
|
5317
|
+
}
|
|
5318
|
+
|
|
4080
5319
|
// web-src/index.tsx
|
|
4081
5320
|
function activate(pi) {
|
|
4082
5321
|
bind(pi.React);
|
|
4083
5322
|
const removeStyle = injectStyle();
|
|
4084
|
-
const service = new ChannelsClient(pi.storage);
|
|
5323
|
+
const service = new ChannelsClient(pi.storage, (request) => pi.callHost("request", request));
|
|
4085
5324
|
const ui = new ChannelsUiStore;
|
|
4086
5325
|
const context = {
|
|
4087
5326
|
pi,
|
|
@@ -4106,6 +5345,9 @@ function activate(pi) {
|
|
|
4106
5345
|
}
|
|
4107
5346
|
};
|
|
4108
5347
|
pi.registerTasks(tasks);
|
|
5348
|
+
new ChannelToolLines(context).register();
|
|
5349
|
+
pi.registerMessageRenderer(HandOff.CARD, HandOffView.card(context));
|
|
5350
|
+
pi.registerComposerAddon(HandOffView.composerAddon(context));
|
|
4109
5351
|
pi.registerView("channels", {
|
|
4110
5352
|
title: () => ChannelWords.of(pi.ui.language).title,
|
|
4111
5353
|
icon: ChannelViews.icon(pi, "Bot"),
|
|
@@ -4151,6 +5393,7 @@ function activate(pi) {
|
|
|
4151
5393
|
location: "panel",
|
|
4152
5394
|
order: 60
|
|
4153
5395
|
});
|
|
5396
|
+
registerCardOpener(context);
|
|
4154
5397
|
pi.registerAvatar((props) => /* @__PURE__ */ React.createElement(SessionAvatar, {
|
|
4155
5398
|
context,
|
|
4156
5399
|
...props
|