@oxy.so/bloom 7.0.1 → 7.1.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/assets/character-runtime/README.md +55 -0
- package/assets/character-runtime/appearance-codec.mjs +149 -0
- package/assets/character-runtime/integrity.json +6 -0
- package/assets/character-runtime/legacy-engine.mjs +105 -0
- package/assets/character-runtime/legacy-geometry.mjs +166 -0
- package/assets/character-runtime/legacy-worker.mjs +85 -0
- package/assets/character-runtime/orbit-characters.data +0 -0
- package/assets/character-runtime/orbit-characters.mjs +30 -0
- package/assets/character-runtime/orbit-characters.wasm +0 -0
- package/assets/character-runtime/preparation-worker.mjs +19 -0
- package/assets/character-runtime/runtime.mjs +820 -0
- package/assets/character-runtime/thumbnails/eyes/crescent_inset.png +0 -0
- package/assets/character-runtime/thumbnails/eyes/dots.png +0 -0
- package/assets/character-runtime/thumbnails/eyes/double_highlights.png +0 -0
- package/assets/character-runtime/thumbnails/eyes/highlight_capsules.png +0 -0
- package/assets/character-runtime/thumbnails/eyes/oval.png +0 -0
- package/assets/character-runtime/thumbnails/eyes/round_inset.png +0 -0
- package/assets/character-runtime/thumbnails/eyes/sleepy_lids.png +0 -0
- package/assets/character-runtime/thumbnails/eyes/sparkle_capsules.png +0 -0
- package/assets/character-runtime/thumbnails/eyes/swept_lids.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/capsule.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/circle.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/circle_two_ears.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/four_lobed_butterfly.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/heart.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/rounded_cube.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/rounded_diamond.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/rounded_head_two_ears.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/rounded_triangle.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/six_lobed_flower.png +0 -0
- package/assets/character-runtime/thumbnails/shapes/twelve_scalloped_rosette.png +0 -0
- package/docs/adoption-matrix.mdx +9 -9
- package/docs/agent-avatar.mdx +35 -10
- package/docs/agent-creator.mdx +12 -4
- package/docs/multi-agent-chat.mdx +12 -0
- package/docs/project-board.mdx +3 -3
- package/lib/commonjs/agent-avatar/AgentAvatar.js +15 -203
- package/lib/commonjs/agent-avatar/AgentAvatar.js.map +1 -1
- package/lib/commonjs/agent-avatar/AgentAvatarProvider.js +64 -0
- package/lib/commonjs/agent-avatar/AgentAvatarProvider.js.map +1 -0
- package/lib/commonjs/agent-avatar/CharacterAvatar.js +211 -0
- package/lib/commonjs/agent-avatar/CharacterAvatar.js.map +1 -0
- package/lib/commonjs/agent-avatar/ProceduralAvatar.js +216 -0
- package/lib/commonjs/agent-avatar/ProceduralAvatar.js.map +1 -0
- package/lib/commonjs/agent-avatar/artwork.js +4 -3
- package/lib/commonjs/agent-avatar/artwork.js.map +1 -1
- package/lib/commonjs/agent-avatar/avatar-color.js +16 -0
- package/lib/commonjs/agent-avatar/avatar-color.js.map +1 -0
- package/lib/commonjs/agent-avatar/character-html.js +25 -0
- package/lib/commonjs/agent-avatar/character-html.js.map +1 -0
- package/lib/commonjs/agent-avatar/character-runtime-module.js +39 -0
- package/lib/commonjs/agent-avatar/character-runtime-module.js.map +1 -0
- package/lib/commonjs/agent-avatar/character-webview.js +18 -0
- package/lib/commonjs/agent-avatar/character-webview.js.map +1 -0
- package/lib/commonjs/agent-avatar/config-character.js +36 -0
- package/lib/commonjs/agent-avatar/config-character.js.map +1 -0
- package/lib/commonjs/agent-avatar/context.js +3 -1
- package/lib/commonjs/agent-avatar/context.js.map +1 -1
- package/lib/commonjs/agent-avatar/index.js +7 -0
- package/lib/commonjs/agent-avatar/index.js.map +1 -1
- package/lib/commonjs/agent-avatar/legacy-contours.js +57 -0
- package/lib/commonjs/agent-avatar/legacy-contours.js.map +1 -0
- package/lib/commonjs/agent-avatar/legacy-recipe.js +112 -0
- package/lib/commonjs/agent-avatar/legacy-recipe.js.map +1 -0
- package/lib/commonjs/agent-avatar/messages.js +2 -1
- package/lib/commonjs/agent-avatar/messages.js.map +1 -1
- package/lib/commonjs/agent-avatar/model.js +2 -0
- package/lib/commonjs/agent-avatar/model.js.map +1 -1
- package/lib/commonjs/agent-creator/AgentCreatorBase.js +245 -21
- package/lib/commonjs/agent-creator/AgentCreatorBase.js.map +1 -1
- package/lib/commonjs/agent-creator/CharacterControls.js +113 -0
- package/lib/commonjs/agent-creator/CharacterControls.js.map +1 -0
- package/lib/commonjs/agent-creator/EmotionPicker.js +51 -18
- package/lib/commonjs/agent-creator/EmotionPicker.js.map +1 -1
- package/lib/commonjs/agent-creator/ShapeArc.js +56 -26
- package/lib/commonjs/agent-creator/ShapeArc.js.map +1 -1
- package/lib/commonjs/agent-creator/ShapeSilhouette.js +62 -0
- package/lib/commonjs/agent-creator/ShapeSilhouette.js.map +1 -0
- package/lib/commonjs/agent-creator/constants.js +48 -1
- package/lib/commonjs/agent-creator/constants.js.map +1 -1
- package/lib/commonjs/agent-creator/messages.js +9 -0
- package/lib/commonjs/agent-creator/messages.js.map +1 -1
- package/lib/commonjs/agent-creator/shared.js +7 -10
- package/lib/commonjs/agent-creator/shared.js.map +1 -1
- package/lib/commonjs/agent-thinking/AgentThinking.js +4 -62
- package/lib/commonjs/agent-thinking/AgentThinking.js.map +1 -1
- package/lib/commonjs/agent-thinking/ThinkingLabel.js +77 -0
- package/lib/commonjs/agent-thinking/ThinkingLabel.js.map +1 -0
- package/lib/commonjs/chart-cards/TokensChartCard.js +20 -5
- package/lib/commonjs/chart-cards/TokensChartCard.js.map +1 -1
- package/lib/commonjs/locale/translations/ar.js +11 -1
- package/lib/commonjs/locale/translations/ar.js.map +1 -1
- package/lib/commonjs/locale/translations/bn.js +11 -1
- package/lib/commonjs/locale/translations/bn.js.map +1 -1
- package/lib/commonjs/locale/translations/ca.js +11 -1
- package/lib/commonjs/locale/translations/ca.js.map +1 -1
- package/lib/commonjs/locale/translations/de.js +11 -1
- package/lib/commonjs/locale/translations/de.js.map +1 -1
- package/lib/commonjs/locale/translations/es.js +11 -1
- package/lib/commonjs/locale/translations/es.js.map +1 -1
- package/lib/commonjs/locale/translations/fr.js +11 -1
- package/lib/commonjs/locale/translations/fr.js.map +1 -1
- package/lib/commonjs/locale/translations/hi.js +11 -1
- package/lib/commonjs/locale/translations/hi.js.map +1 -1
- package/lib/commonjs/locale/translations/id.js +11 -1
- package/lib/commonjs/locale/translations/id.js.map +1 -1
- package/lib/commonjs/locale/translations/it.js +11 -1
- package/lib/commonjs/locale/translations/it.js.map +1 -1
- package/lib/commonjs/locale/translations/ja.js +11 -1
- package/lib/commonjs/locale/translations/ja.js.map +1 -1
- package/lib/commonjs/locale/translations/pt.js +11 -1
- package/lib/commonjs/locale/translations/pt.js.map +1 -1
- package/lib/commonjs/locale/translations/ru.js +11 -1
- package/lib/commonjs/locale/translations/ru.js.map +1 -1
- package/lib/commonjs/locale/translations/tr.js +11 -1
- package/lib/commonjs/locale/translations/tr.js.map +1 -1
- package/lib/commonjs/locale/translations/zh.js +11 -1
- package/lib/commonjs/locale/translations/zh.js.map +1 -1
- package/lib/commonjs/multi-agent-chat/AvatarHandoff.js +2 -4
- package/lib/commonjs/multi-agent-chat/AvatarHandoff.js.map +1 -1
- package/lib/commonjs/multi-agent-chat/ChatAgentProfile.js +97 -0
- package/lib/commonjs/multi-agent-chat/ChatAgentProfile.js.map +1 -0
- package/lib/commonjs/multi-agent-chat/EditorRail.js +4 -0
- package/lib/commonjs/multi-agent-chat/EditorRail.js.map +1 -1
- package/lib/commonjs/multi-agent-chat/MultiAgentChatBase.js +89 -126
- package/lib/commonjs/multi-agent-chat/MultiAgentChatBase.js.map +1 -1
- package/lib/commonjs/multi-agent-chat/ReplyRow.js +8 -11
- package/lib/commonjs/multi-agent-chat/ReplyRow.js.map +1 -1
- package/lib/commonjs/multi-agent-chat/handoff.js +5 -5
- package/lib/commonjs/multi-agent-chat/handoff.js.map +1 -1
- package/lib/commonjs/project-board/CreateTicketDialog.js +33 -2
- package/lib/commonjs/project-board/CreateTicketDialog.js.map +1 -1
- package/lib/commonjs/project-board/ProjectBoardBase.js +137 -38
- package/lib/commonjs/project-board/ProjectBoardBase.js.map +1 -1
- package/lib/commonjs/project-board/TicketCornerGenieSurface.web.js +34 -28
- package/lib/commonjs/project-board/TicketCornerGenieSurface.web.js.map +1 -1
- package/lib/commonjs/project-board/TicketDetailDialog.js +6 -3
- package/lib/commonjs/project-board/TicketDetailDialog.js.map +1 -1
- package/lib/commonjs/project-board/TicketGenieSurface.js +17 -7
- package/lib/commonjs/project-board/TicketGenieSurface.js.map +1 -1
- package/lib/commonjs/project-board/TicketGenieSurface.web.js +1 -1
- package/lib/commonjs/project-board/TicketGenieSurface.web.js.map +1 -1
- package/lib/commonjs/project-board/TicketPresence.js +125 -0
- package/lib/commonjs/project-board/TicketPresence.js.map +1 -0
- package/lib/commonjs/project-board/TicketTokenChart.js +23 -0
- package/lib/commonjs/project-board/TicketTokenChart.js.map +1 -0
- package/lib/commonjs/project-board/context.js +3 -1
- package/lib/commonjs/project-board/context.js.map +1 -1
- package/lib/commonjs/search/Search.js +12 -3
- package/lib/commonjs/search/Search.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarToolbar.js +28 -14
- package/lib/commonjs/sidebar/SidebarToolbar.js.map +1 -1
- package/lib/commonjs/text-field/TextField.js +13 -7
- package/lib/commonjs/text-field/TextField.js.map +1 -1
- package/lib/module/agent-avatar/AgentAvatar.js +16 -204
- package/lib/module/agent-avatar/AgentAvatar.js.map +1 -1
- package/lib/module/agent-avatar/AgentAvatarProvider.js +60 -0
- package/lib/module/agent-avatar/AgentAvatarProvider.js.map +1 -0
- package/lib/module/agent-avatar/CharacterAvatar.js +207 -0
- package/lib/module/agent-avatar/CharacterAvatar.js.map +1 -0
- package/lib/module/agent-avatar/ProceduralAvatar.js +212 -0
- package/lib/module/agent-avatar/ProceduralAvatar.js.map +1 -0
- package/lib/module/agent-avatar/artwork.js +3 -3
- package/lib/module/agent-avatar/artwork.js.map +1 -1
- package/lib/module/agent-avatar/avatar-color.js +12 -0
- package/lib/module/agent-avatar/avatar-color.js.map +1 -0
- package/lib/module/agent-avatar/character-html.js +19 -0
- package/lib/module/agent-avatar/character-html.js.map +1 -0
- package/lib/module/agent-avatar/character-runtime-module.js +35 -0
- package/lib/module/agent-avatar/character-runtime-module.js.map +1 -0
- package/lib/module/agent-avatar/character-webview.js +14 -0
- package/lib/module/agent-avatar/character-webview.js.map +1 -0
- package/lib/module/agent-avatar/config-character.js +32 -0
- package/lib/module/agent-avatar/config-character.js.map +1 -0
- package/lib/module/agent-avatar/context.js +2 -0
- package/lib/module/agent-avatar/context.js.map +1 -1
- package/lib/module/agent-avatar/index.js +1 -0
- package/lib/module/agent-avatar/index.js.map +1 -1
- package/lib/module/agent-avatar/legacy-contours.js +53 -0
- package/lib/module/agent-avatar/legacy-contours.js.map +1 -0
- package/lib/module/agent-avatar/legacy-recipe.js +104 -0
- package/lib/module/agent-avatar/legacy-recipe.js.map +1 -0
- package/lib/module/agent-avatar/messages.js +2 -1
- package/lib/module/agent-avatar/messages.js.map +1 -1
- package/lib/module/agent-avatar/model.js +2 -0
- package/lib/module/agent-avatar/model.js.map +1 -1
- package/lib/module/agent-creator/AgentCreatorBase.js +242 -18
- package/lib/module/agent-creator/AgentCreatorBase.js.map +1 -1
- package/lib/module/agent-creator/CharacterControls.js +110 -0
- package/lib/module/agent-creator/CharacterControls.js.map +1 -0
- package/lib/module/agent-creator/EmotionPicker.js +52 -19
- package/lib/module/agent-creator/EmotionPicker.js.map +1 -1
- package/lib/module/agent-creator/ShapeArc.js +58 -28
- package/lib/module/agent-creator/ShapeArc.js.map +1 -1
- package/lib/module/agent-creator/ShapeSilhouette.js +57 -0
- package/lib/module/agent-creator/ShapeSilhouette.js.map +1 -0
- package/lib/module/agent-creator/constants.js +47 -0
- package/lib/module/agent-creator/constants.js.map +1 -1
- package/lib/module/agent-creator/messages.js +9 -0
- package/lib/module/agent-creator/messages.js.map +1 -1
- package/lib/module/agent-creator/shared.js +1 -9
- package/lib/module/agent-creator/shared.js.map +1 -1
- package/lib/module/agent-thinking/AgentThinking.js +5 -63
- package/lib/module/agent-thinking/AgentThinking.js.map +1 -1
- package/lib/module/agent-thinking/ThinkingLabel.js +73 -0
- package/lib/module/agent-thinking/ThinkingLabel.js.map +1 -0
- package/lib/module/chart-cards/TokensChartCard.js +20 -5
- package/lib/module/chart-cards/TokensChartCard.js.map +1 -1
- package/lib/module/locale/translations/ar.js +11 -1
- package/lib/module/locale/translations/ar.js.map +1 -1
- package/lib/module/locale/translations/bn.js +11 -1
- package/lib/module/locale/translations/bn.js.map +1 -1
- package/lib/module/locale/translations/ca.js +11 -1
- package/lib/module/locale/translations/ca.js.map +1 -1
- package/lib/module/locale/translations/de.js +11 -1
- package/lib/module/locale/translations/de.js.map +1 -1
- package/lib/module/locale/translations/es.js +11 -1
- package/lib/module/locale/translations/es.js.map +1 -1
- package/lib/module/locale/translations/fr.js +11 -1
- package/lib/module/locale/translations/fr.js.map +1 -1
- package/lib/module/locale/translations/hi.js +11 -1
- package/lib/module/locale/translations/hi.js.map +1 -1
- package/lib/module/locale/translations/id.js +11 -1
- package/lib/module/locale/translations/id.js.map +1 -1
- package/lib/module/locale/translations/it.js +11 -1
- package/lib/module/locale/translations/it.js.map +1 -1
- package/lib/module/locale/translations/ja.js +11 -1
- package/lib/module/locale/translations/ja.js.map +1 -1
- package/lib/module/locale/translations/pt.js +11 -1
- package/lib/module/locale/translations/pt.js.map +1 -1
- package/lib/module/locale/translations/ru.js +11 -1
- package/lib/module/locale/translations/ru.js.map +1 -1
- package/lib/module/locale/translations/tr.js +11 -1
- package/lib/module/locale/translations/tr.js.map +1 -1
- package/lib/module/locale/translations/zh.js +11 -1
- package/lib/module/locale/translations/zh.js.map +1 -1
- package/lib/module/multi-agent-chat/AvatarHandoff.js +3 -5
- package/lib/module/multi-agent-chat/AvatarHandoff.js.map +1 -1
- package/lib/module/multi-agent-chat/ChatAgentProfile.js +94 -0
- package/lib/module/multi-agent-chat/ChatAgentProfile.js.map +1 -0
- package/lib/module/multi-agent-chat/EditorRail.js +4 -0
- package/lib/module/multi-agent-chat/EditorRail.js.map +1 -1
- package/lib/module/multi-agent-chat/MultiAgentChatBase.js +89 -126
- package/lib/module/multi-agent-chat/MultiAgentChatBase.js.map +1 -1
- package/lib/module/multi-agent-chat/ReplyRow.js +9 -12
- package/lib/module/multi-agent-chat/ReplyRow.js.map +1 -1
- package/lib/module/multi-agent-chat/handoff.js +4 -4
- package/lib/module/multi-agent-chat/handoff.js.map +1 -1
- package/lib/module/project-board/CreateTicketDialog.js +33 -2
- package/lib/module/project-board/CreateTicketDialog.js.map +1 -1
- package/lib/module/project-board/ProjectBoardBase.js +138 -39
- package/lib/module/project-board/ProjectBoardBase.js.map +1 -1
- package/lib/module/project-board/TicketCornerGenieSurface.web.js +35 -29
- package/lib/module/project-board/TicketCornerGenieSurface.web.js.map +1 -1
- package/lib/module/project-board/TicketDetailDialog.js +7 -4
- package/lib/module/project-board/TicketDetailDialog.js.map +1 -1
- package/lib/module/project-board/TicketGenieSurface.js +17 -7
- package/lib/module/project-board/TicketGenieSurface.js.map +1 -1
- package/lib/module/project-board/TicketGenieSurface.web.js +1 -1
- package/lib/module/project-board/TicketGenieSurface.web.js.map +1 -1
- package/lib/module/project-board/TicketPresence.js +119 -0
- package/lib/module/project-board/TicketPresence.js.map +1 -0
- package/lib/module/project-board/TicketTokenChart.js +20 -0
- package/lib/module/project-board/TicketTokenChart.js.map +1 -0
- package/lib/module/project-board/context.js +2 -0
- package/lib/module/project-board/context.js.map +1 -1
- package/lib/module/search/Search.js +12 -3
- package/lib/module/search/Search.js.map +1 -1
- package/lib/module/sidebar/SidebarToolbar.js +29 -15
- package/lib/module/sidebar/SidebarToolbar.js.map +1 -1
- package/lib/module/text-field/TextField.js +13 -7
- package/lib/module/text-field/TextField.js.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/AgentAvatar.d.ts +2 -2
- package/lib/typescript/commonjs/agent-avatar/AgentAvatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/AgentAvatarProvider.d.ts +4 -0
- package/lib/typescript/commonjs/agent-avatar/AgentAvatarProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/CharacterAvatar.d.ts +4 -0
- package/lib/typescript/commonjs/agent-avatar/CharacterAvatar.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/ProceduralAvatar.d.ts +6 -0
- package/lib/typescript/commonjs/agent-avatar/ProceduralAvatar.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/artwork.d.ts +2 -1
- package/lib/typescript/commonjs/agent-avatar/artwork.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/avatar-color.d.ts +3 -0
- package/lib/typescript/commonjs/agent-avatar/avatar-color.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/character-html.d.ts +4 -0
- package/lib/typescript/commonjs/agent-avatar/character-html.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/character-runtime-module.d.ts +2 -0
- package/lib/typescript/commonjs/agent-avatar/character-runtime-module.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/character-webview.d.ts +24 -0
- package/lib/typescript/commonjs/agent-avatar/character-webview.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/config-character.d.ts +11 -0
- package/lib/typescript/commonjs/agent-avatar/config-character.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/context.d.ts +12 -0
- package/lib/typescript/commonjs/agent-avatar/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/index.d.ts +3 -1
- package/lib/typescript/commonjs/agent-avatar/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/legacy-contours.d.ts +5 -0
- package/lib/typescript/commonjs/agent-avatar/legacy-contours.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/legacy-recipe.d.ts +40 -0
- package/lib/typescript/commonjs/agent-avatar/legacy-recipe.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-avatar/messages.d.ts +1 -0
- package/lib/typescript/commonjs/agent-avatar/messages.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/model.d.ts +3 -0
- package/lib/typescript/commonjs/agent-avatar/model.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-avatar/types.d.ts +10 -1
- package/lib/typescript/commonjs/agent-avatar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/AgentCreatorBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/CharacterControls.d.ts +8 -0
- package/lib/typescript/commonjs/agent-creator/CharacterControls.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-creator/EmotionPicker.d.ts +12 -1
- package/lib/typescript/commonjs/agent-creator/EmotionPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/ShapeArc.d.ts +11 -2
- package/lib/typescript/commonjs/agent-creator/ShapeArc.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/ShapeSilhouette.d.ts +6 -0
- package/lib/typescript/commonjs/agent-creator/ShapeSilhouette.d.ts.map +1 -0
- package/lib/typescript/commonjs/agent-creator/constants.d.ts +44 -0
- package/lib/typescript/commonjs/agent-creator/constants.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/context.d.ts +9 -0
- package/lib/typescript/commonjs/agent-creator/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/messages.d.ts +10 -0
- package/lib/typescript/commonjs/agent-creator/messages.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-creator/shared.d.ts +1 -1
- package/lib/typescript/commonjs/agent-creator/shared.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-thinking/AgentThinking.d.ts.map +1 -1
- package/lib/typescript/commonjs/agent-thinking/ThinkingLabel.d.ts +7 -0
- package/lib/typescript/commonjs/agent-thinking/ThinkingLabel.d.ts.map +1 -0
- package/lib/typescript/commonjs/chart-cards/TokensChartCard.d.ts +3 -1
- package/lib/typescript/commonjs/chart-cards/TokensChartCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/ar.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/bn.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/ca.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/de.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/es.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/fr.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/hi.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/id.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/it.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/ja.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/pt.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/ru.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/tr.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/zh.d.ts.map +1 -1
- package/lib/typescript/commonjs/multi-agent-chat/AvatarHandoff.d.ts.map +1 -1
- package/lib/typescript/commonjs/multi-agent-chat/ChatAgentProfile.d.ts +11 -0
- package/lib/typescript/commonjs/multi-agent-chat/ChatAgentProfile.d.ts.map +1 -0
- package/lib/typescript/commonjs/multi-agent-chat/EditorRail.d.ts.map +1 -1
- package/lib/typescript/commonjs/multi-agent-chat/MultiAgentChatBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/multi-agent-chat/ReplyRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/multi-agent-chat/handoff.d.ts +2 -2
- package/lib/typescript/commonjs/multi-agent-chat/handoff.d.ts.map +1 -1
- package/lib/typescript/commonjs/project-board/CreateTicketDialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/project-board/ProjectBoardBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/project-board/TicketCornerGenieSurface.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/project-board/TicketDetailDialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/project-board/TicketGenieSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/project-board/TicketPresence.d.ts +17 -0
- package/lib/typescript/commonjs/project-board/TicketPresence.d.ts.map +1 -0
- package/lib/typescript/commonjs/project-board/TicketTokenChart.d.ts +5 -0
- package/lib/typescript/commonjs/project-board/TicketTokenChart.d.ts.map +1 -0
- package/lib/typescript/commonjs/project-board/context.d.ts +2 -0
- package/lib/typescript/commonjs/project-board/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/search/Search.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarToolbar.d.ts.map +1 -1
- package/lib/typescript/commonjs/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/AgentAvatar.d.ts +2 -2
- package/lib/typescript/module/agent-avatar/AgentAvatar.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/AgentAvatarProvider.d.ts +4 -0
- package/lib/typescript/module/agent-avatar/AgentAvatarProvider.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/CharacterAvatar.d.ts +4 -0
- package/lib/typescript/module/agent-avatar/CharacterAvatar.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/ProceduralAvatar.d.ts +6 -0
- package/lib/typescript/module/agent-avatar/ProceduralAvatar.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/artwork.d.ts +2 -1
- package/lib/typescript/module/agent-avatar/artwork.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/avatar-color.d.ts +3 -0
- package/lib/typescript/module/agent-avatar/avatar-color.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/character-html.d.ts +4 -0
- package/lib/typescript/module/agent-avatar/character-html.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/character-runtime-module.d.ts +2 -0
- package/lib/typescript/module/agent-avatar/character-runtime-module.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/character-webview.d.ts +24 -0
- package/lib/typescript/module/agent-avatar/character-webview.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/config-character.d.ts +11 -0
- package/lib/typescript/module/agent-avatar/config-character.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/context.d.ts +12 -0
- package/lib/typescript/module/agent-avatar/context.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/index.d.ts +3 -1
- package/lib/typescript/module/agent-avatar/index.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/legacy-contours.d.ts +5 -0
- package/lib/typescript/module/agent-avatar/legacy-contours.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/legacy-recipe.d.ts +40 -0
- package/lib/typescript/module/agent-avatar/legacy-recipe.d.ts.map +1 -0
- package/lib/typescript/module/agent-avatar/messages.d.ts +1 -0
- package/lib/typescript/module/agent-avatar/messages.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/model.d.ts +3 -0
- package/lib/typescript/module/agent-avatar/model.d.ts.map +1 -1
- package/lib/typescript/module/agent-avatar/types.d.ts +10 -1
- package/lib/typescript/module/agent-avatar/types.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/AgentCreatorBase.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/CharacterControls.d.ts +8 -0
- package/lib/typescript/module/agent-creator/CharacterControls.d.ts.map +1 -0
- package/lib/typescript/module/agent-creator/EmotionPicker.d.ts +12 -1
- package/lib/typescript/module/agent-creator/EmotionPicker.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/ShapeArc.d.ts +11 -2
- package/lib/typescript/module/agent-creator/ShapeArc.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/ShapeSilhouette.d.ts +6 -0
- package/lib/typescript/module/agent-creator/ShapeSilhouette.d.ts.map +1 -0
- package/lib/typescript/module/agent-creator/constants.d.ts +44 -0
- package/lib/typescript/module/agent-creator/constants.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/context.d.ts +9 -0
- package/lib/typescript/module/agent-creator/context.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/messages.d.ts +10 -0
- package/lib/typescript/module/agent-creator/messages.d.ts.map +1 -1
- package/lib/typescript/module/agent-creator/shared.d.ts +1 -1
- package/lib/typescript/module/agent-creator/shared.d.ts.map +1 -1
- package/lib/typescript/module/agent-thinking/AgentThinking.d.ts.map +1 -1
- package/lib/typescript/module/agent-thinking/ThinkingLabel.d.ts +7 -0
- package/lib/typescript/module/agent-thinking/ThinkingLabel.d.ts.map +1 -0
- package/lib/typescript/module/chart-cards/TokensChartCard.d.ts +3 -1
- package/lib/typescript/module/chart-cards/TokensChartCard.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/ar.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/bn.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/ca.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/de.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/es.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/fr.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/hi.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/id.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/it.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/ja.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/pt.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/ru.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/tr.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/zh.d.ts.map +1 -1
- package/lib/typescript/module/multi-agent-chat/AvatarHandoff.d.ts.map +1 -1
- package/lib/typescript/module/multi-agent-chat/ChatAgentProfile.d.ts +11 -0
- package/lib/typescript/module/multi-agent-chat/ChatAgentProfile.d.ts.map +1 -0
- package/lib/typescript/module/multi-agent-chat/EditorRail.d.ts.map +1 -1
- package/lib/typescript/module/multi-agent-chat/MultiAgentChatBase.d.ts.map +1 -1
- package/lib/typescript/module/multi-agent-chat/ReplyRow.d.ts.map +1 -1
- package/lib/typescript/module/multi-agent-chat/handoff.d.ts +2 -2
- package/lib/typescript/module/multi-agent-chat/handoff.d.ts.map +1 -1
- package/lib/typescript/module/project-board/CreateTicketDialog.d.ts.map +1 -1
- package/lib/typescript/module/project-board/ProjectBoardBase.d.ts.map +1 -1
- package/lib/typescript/module/project-board/TicketCornerGenieSurface.web.d.ts.map +1 -1
- package/lib/typescript/module/project-board/TicketDetailDialog.d.ts.map +1 -1
- package/lib/typescript/module/project-board/TicketGenieSurface.d.ts.map +1 -1
- package/lib/typescript/module/project-board/TicketPresence.d.ts +17 -0
- package/lib/typescript/module/project-board/TicketPresence.d.ts.map +1 -0
- package/lib/typescript/module/project-board/TicketTokenChart.d.ts +5 -0
- package/lib/typescript/module/project-board/TicketTokenChart.d.ts.map +1 -0
- package/lib/typescript/module/project-board/context.d.ts +2 -0
- package/lib/typescript/module/project-board/context.d.ts.map +1 -1
- package/lib/typescript/module/search/Search.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarToolbar.d.ts.map +1 -1
- package/lib/typescript/module/text-field/TextField.d.ts.map +1 -1
- package/package.json +8 -3
- package/src/agent-avatar/AgentAvatar.tsx +16 -296
- package/src/agent-avatar/AgentAvatarProvider.tsx +72 -0
- package/src/agent-avatar/CharacterAvatar.tsx +255 -0
- package/src/agent-avatar/ProceduralAvatar.tsx +303 -0
- package/src/agent-avatar/artwork.ts +3 -3
- package/src/agent-avatar/avatar-color.ts +17 -0
- package/src/agent-avatar/character-html.ts +21 -0
- package/src/agent-avatar/character-runtime-module.ts +37 -0
- package/src/agent-avatar/character-webview.ts +24 -0
- package/src/agent-avatar/config-character.ts +40 -0
- package/src/agent-avatar/context.ts +13 -0
- package/src/agent-avatar/index.ts +4 -1
- package/src/agent-avatar/legacy-contours.ts +76 -0
- package/src/agent-avatar/legacy-recipe.ts +123 -0
- package/src/agent-avatar/messages.ts +1 -0
- package/src/agent-avatar/model.ts +5 -0
- package/src/agent-avatar/types.ts +12 -1
- package/src/agent-creator/AgentCreatorBase.tsx +329 -38
- package/src/agent-creator/CharacterControls.tsx +146 -0
- package/src/agent-creator/EmotionPicker.tsx +43 -21
- package/src/agent-creator/ShapeArc.tsx +83 -29
- package/src/agent-creator/ShapeSilhouette.tsx +65 -0
- package/src/agent-creator/constants.ts +30 -0
- package/src/agent-creator/messages.ts +19 -0
- package/src/agent-creator/shared.ts +1 -15
- package/src/agent-thinking/AgentThinking.tsx +7 -70
- package/src/agent-thinking/ThinkingLabel.tsx +74 -0
- package/src/chart-cards/TokensChartCard.tsx +10 -6
- package/src/locale/translations/ar.ts +10 -1
- package/src/locale/translations/bn.ts +10 -1
- package/src/locale/translations/ca.ts +10 -1
- package/src/locale/translations/de.ts +10 -1
- package/src/locale/translations/es.ts +10 -1
- package/src/locale/translations/fr.ts +10 -1
- package/src/locale/translations/hi.ts +10 -1
- package/src/locale/translations/id.ts +10 -1
- package/src/locale/translations/it.ts +10 -1
- package/src/locale/translations/ja.ts +10 -1
- package/src/locale/translations/pt.ts +10 -1
- package/src/locale/translations/ru.ts +10 -1
- package/src/locale/translations/tr.ts +10 -1
- package/src/locale/translations/zh.ts +10 -1
- package/src/multi-agent-chat/AvatarHandoff.tsx +2 -5
- package/src/multi-agent-chat/ChatAgentProfile.tsx +116 -0
- package/src/multi-agent-chat/EditorRail.tsx +2 -0
- package/src/multi-agent-chat/MultiAgentChatBase.tsx +123 -175
- package/src/multi-agent-chat/ReplyRow.tsx +10 -9
- package/src/multi-agent-chat/handoff.ts +4 -4
- package/src/project-board/CreateTicketDialog.tsx +28 -4
- package/src/project-board/ProjectBoardBase.tsx +115 -21
- package/src/project-board/TicketCornerGenieSurface.web.tsx +11 -6
- package/src/project-board/TicketDetailDialog.tsx +5 -4
- package/src/project-board/TicketGenieSurface.tsx +9 -0
- package/src/project-board/TicketGenieSurface.web.tsx +1 -1
- package/src/project-board/TicketPresence.tsx +137 -0
- package/src/project-board/TicketTokenChart.tsx +14 -0
- package/src/project-board/context.ts +2 -0
- package/src/search/Search.tsx +6 -5
- package/src/sidebar/SidebarToolbar.tsx +27 -15
- package/src/text-field/TextField.tsx +12 -7
|
@@ -1,299 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
useState,
|
|
7
|
-
} from 'react';
|
|
8
|
-
import {
|
|
9
|
-
AccessibilityInfo,
|
|
10
|
-
AppState,
|
|
11
|
-
PixelRatio,
|
|
12
|
-
Platform,
|
|
13
|
-
type View,
|
|
14
|
-
} from 'react-native';
|
|
15
|
-
import { useReducedMotion } from 'react-native-reanimated';
|
|
16
|
-
import { useMessages } from '../locale/messages';
|
|
17
|
-
import { StyledView } from '../styles/styled-primitives';
|
|
18
|
-
import { drawAvatar } from './artwork';
|
|
19
|
-
import { advanceAttention, createAttention } from './attention';
|
|
20
|
-
import { advanceBlink, createBlink } from './blink';
|
|
21
|
-
import { AvatarDrawingObserver } from './context';
|
|
22
|
-
import { DrawingContext } from './drawing';
|
|
23
|
-
import { ENTRANCE_SECONDS } from './entrance';
|
|
24
|
-
import {
|
|
25
|
-
easeFace,
|
|
26
|
-
expressionRig,
|
|
27
|
-
faceAtSize,
|
|
28
|
-
gazeAngles,
|
|
29
|
-
type FaceRig,
|
|
30
|
-
} from './face';
|
|
31
|
-
import { AGENT_AVATAR_MESSAGES } from './messages';
|
|
32
|
-
import type { ShapeMorph } from './shape-morph';
|
|
33
|
-
import { Drawing } from './SvgDrawing';
|
|
1
|
+
import { memo, useContext } from 'react';
|
|
2
|
+
import { CharacterAvatar } from './CharacterAvatar';
|
|
3
|
+
import { ProceduralAvatar } from './ProceduralAvatar';
|
|
4
|
+
import { CharacterRuntimeContext } from './context';
|
|
5
|
+
import { legacyRecipeUnsupported } from './legacy-recipe';
|
|
34
6
|
import type { AgentAvatarProps } from './types';
|
|
35
|
-
import { advanceWander, createWander } from './wander';
|
|
36
|
-
import { WORKING_SECONDS } from './working';
|
|
37
7
|
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
size = 64,
|
|
49
|
-
paused = false,
|
|
50
|
-
label,
|
|
51
|
-
locale,
|
|
52
|
-
entranceKey,
|
|
53
|
-
workingKey,
|
|
54
|
-
workingCycles = 1,
|
|
55
|
-
className,
|
|
56
|
-
style,
|
|
57
|
-
accessibilityLabel,
|
|
58
|
-
testID,
|
|
59
|
-
}: AgentAvatarProps) {
|
|
60
|
-
const { messages } = useMessages(AGENT_AVATAR_MESSAGES, locale);
|
|
61
|
-
const initialReduced = useReducedMotion();
|
|
62
|
-
const [reduced, setReduced] = useState(initialReduced);
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
const subscription = AccessibilityInfo.addEventListener(
|
|
65
|
-
'reduceMotionChanged',
|
|
66
|
-
setReduced,
|
|
67
|
-
);
|
|
68
|
-
const media =
|
|
69
|
-
Platform.OS === 'web' && typeof matchMedia !== 'undefined'
|
|
70
|
-
? matchMedia('(prefers-reduced-motion: reduce)')
|
|
71
|
-
: undefined;
|
|
72
|
-
const change = () => setReduced(media!.matches);
|
|
73
|
-
media?.addEventListener('change', change);
|
|
74
|
-
if (media) change();
|
|
75
|
-
return () => {
|
|
76
|
-
subscription?.remove?.();
|
|
77
|
-
media?.removeEventListener('change', change);
|
|
78
|
-
};
|
|
79
|
-
}, []);
|
|
80
|
-
const backingSize = Math.round(size * Math.min(PixelRatio.get() || 1, 2));
|
|
81
|
-
const root = useRef<View>(null);
|
|
82
|
-
const randomized = useRef(false);
|
|
83
|
-
const state = useRef<{
|
|
84
|
-
phase: number;
|
|
85
|
-
blink: ReturnType<typeof createBlink>;
|
|
86
|
-
wander: ReturnType<typeof createWander>;
|
|
87
|
-
attention: ReturnType<typeof createAttention>;
|
|
88
|
-
shapeMorph: ShapeMorph;
|
|
89
|
-
expression?: FaceRig;
|
|
90
|
-
face?: FaceRig;
|
|
91
|
-
velocity: Partial<FaceRig>;
|
|
92
|
-
gaze?: [number, number];
|
|
93
|
-
entrance: { key?: number; elapsed: number };
|
|
94
|
-
working: { key?: number; elapsed: number };
|
|
95
|
-
} | null>(null);
|
|
96
|
-
if (!state.current) {
|
|
97
|
-
const seed = config.seed >>> 0;
|
|
98
|
-
state.current = {
|
|
99
|
-
phase: (seed / 4294967296) * TAU,
|
|
100
|
-
blink: createBlink(seed),
|
|
101
|
-
wander: createWander(seed ^ config.seed, config.family === 'fold'),
|
|
102
|
-
attention: createAttention(seed ^ config.seed),
|
|
103
|
-
shapeMorph: { started: 0, active: false },
|
|
104
|
-
velocity: {},
|
|
105
|
-
entrance: { elapsed: ENTRANCE_SECONDS },
|
|
106
|
-
working: { elapsed: WORKING_SECONDS },
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
const renderDrawing = () => {
|
|
110
|
-
const context = new DrawingContext(),
|
|
111
|
-
s = state.current!;
|
|
112
|
-
const appearance = faceAtSize(config, size),
|
|
113
|
-
target = expressionRig(appearance);
|
|
114
|
-
drawAvatar(
|
|
115
|
-
context,
|
|
116
|
-
appearance,
|
|
117
|
-
s.phase,
|
|
118
|
-
s.face ?? target,
|
|
119
|
-
s.gaze ?? gazeAngles(appearance, s.phase, target),
|
|
120
|
-
size,
|
|
121
|
-
s.entrance.elapsed,
|
|
122
|
-
s.working.elapsed,
|
|
123
|
-
undefined,
|
|
124
|
-
Math.max(1, Math.floor(workingCycles)),
|
|
125
|
-
backingSize,
|
|
126
|
-
);
|
|
127
|
-
return context;
|
|
128
|
-
};
|
|
129
|
-
const [drawing, setDrawing] = useState(renderDrawing);
|
|
130
|
-
const observeDrawing = useContext(AvatarDrawingObserver);
|
|
131
|
-
useLayoutEffect(() => {
|
|
132
|
-
observeDrawing?.(drawing);
|
|
133
|
-
}, [observeDrawing, drawing]);
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
const s = state.current!,
|
|
136
|
-
cycles = Math.max(1, Math.floor(workingCycles));
|
|
137
|
-
if (!randomized.current) {
|
|
138
|
-
s.wander = createWander(
|
|
139
|
-
randomSeed() ^ config.seed,
|
|
140
|
-
config.family === 'fold',
|
|
141
|
-
);
|
|
142
|
-
const seed = randomSeed();
|
|
143
|
-
s.phase = (seed / 4294967296) * TAU;
|
|
144
|
-
s.blink = createBlink(seed);
|
|
145
|
-
s.attention = createAttention(randomSeed() ^ config.seed);
|
|
146
|
-
randomized.current = true;
|
|
147
|
-
}
|
|
148
|
-
const duration = WORKING_SECONDS * cycles,
|
|
149
|
-
appearance = faceAtSize(config, size),
|
|
150
|
-
target = expressionRig(appearance);
|
|
151
|
-
if (s.entrance.key !== entranceKey)
|
|
152
|
-
s.entrance = {
|
|
153
|
-
key: entranceKey,
|
|
154
|
-
elapsed: entranceKey === undefined || paused ? ENTRANCE_SECONDS : 0,
|
|
155
|
-
};
|
|
156
|
-
if (s.working.key !== workingKey) {
|
|
157
|
-
s.working = {
|
|
158
|
-
key: workingKey,
|
|
159
|
-
elapsed: workingKey === undefined || paused ? duration : 0,
|
|
160
|
-
};
|
|
161
|
-
if (workingKey !== undefined) s.entrance.elapsed = ENTRANCE_SECONDS;
|
|
162
|
-
}
|
|
163
|
-
if (config.idle || workingKey === undefined) s.working.elapsed = duration;
|
|
164
|
-
s.expression ??= s.face ?? target;
|
|
165
|
-
s.face ??= target;
|
|
166
|
-
s.gaze ??= gazeAngles(appearance, s.phase, target, s.wander.point);
|
|
167
|
-
const frozen = paused || reduced || config.motion === 0;
|
|
168
|
-
if (reduced || config.motion === 0) {
|
|
169
|
-
s.entrance.elapsed = ENTRANCE_SECONDS;
|
|
170
|
-
s.working.elapsed = duration;
|
|
171
|
-
}
|
|
172
|
-
if (frozen) {
|
|
173
|
-
s.shapeMorph = { started: 0, active: false };
|
|
174
|
-
s.face = target;
|
|
175
|
-
s.expression = target;
|
|
176
|
-
s.velocity = {};
|
|
177
|
-
if (!paused || config.lookAt !== 'wander')
|
|
178
|
-
s.gaze = gazeAngles(appearance, s.phase, target, s.wander.point);
|
|
179
|
-
}
|
|
180
|
-
const draw = () => {
|
|
181
|
-
const context = new DrawingContext();
|
|
182
|
-
drawAvatar(
|
|
183
|
-
context,
|
|
184
|
-
appearance,
|
|
185
|
-
s.phase,
|
|
186
|
-
s.face!,
|
|
187
|
-
s.gaze!,
|
|
188
|
-
size,
|
|
189
|
-
s.entrance.elapsed,
|
|
190
|
-
s.working.elapsed,
|
|
191
|
-
frozen ? undefined : s.shapeMorph,
|
|
192
|
-
cycles,
|
|
193
|
-
backingSize,
|
|
194
|
-
);
|
|
195
|
-
setDrawing(context);
|
|
196
|
-
};
|
|
197
|
-
let frame = 0,
|
|
198
|
-
last = 0,
|
|
199
|
-
visible = true,
|
|
200
|
-
active = AppState.currentState !== 'background',
|
|
201
|
-
transitioning = true;
|
|
202
|
-
const tick = (now: number) => {
|
|
203
|
-
if (!last) last = now;
|
|
204
|
-
if (now - last >= (transitioning ? 16 : 32)) {
|
|
205
|
-
if (visible && active) {
|
|
206
|
-
const milliseconds = Math.min(now - last, 64),
|
|
207
|
-
seconds = milliseconds / 1000;
|
|
208
|
-
s.entrance.elapsed = Math.min(
|
|
209
|
-
ENTRANCE_SECONDS,
|
|
210
|
-
s.entrance.elapsed + seconds,
|
|
211
|
-
);
|
|
212
|
-
s.working.elapsed = Math.min(duration, s.working.elapsed + seconds);
|
|
213
|
-
const base = easeFace(
|
|
214
|
-
s.expression ?? target,
|
|
215
|
-
target,
|
|
216
|
-
s.velocity,
|
|
217
|
-
seconds,
|
|
218
|
-
);
|
|
219
|
-
s.expression = base;
|
|
220
|
-
transitioning =
|
|
221
|
-
(Object.keys(target) as (keyof FaceRig)[]).some(
|
|
222
|
-
(key) => base[key] !== target[key],
|
|
223
|
-
) || s.shapeMorph.active;
|
|
224
|
-
s.face =
|
|
225
|
-
config.family === 'fold' || base.smile > 0.2
|
|
226
|
-
? advanceAttention(
|
|
227
|
-
s.attention,
|
|
228
|
-
(seconds * 8) / config.duration,
|
|
229
|
-
base,
|
|
230
|
-
appearance,
|
|
231
|
-
)
|
|
232
|
-
: base;
|
|
233
|
-
s.face.blink = config.idle ? 1 : advanceBlink(s.blink, seconds);
|
|
234
|
-
transitioning ||= s.blink.blinking;
|
|
235
|
-
s.phase = (s.phase + (seconds * TAU) / config.duration) % TAU;
|
|
236
|
-
if (!config.idle && config.lookAt === 'wander')
|
|
237
|
-
advanceWander(
|
|
238
|
-
s.wander,
|
|
239
|
-
(seconds * 8) / config.duration,
|
|
240
|
-
config.family === 'fold',
|
|
241
|
-
);
|
|
242
|
-
const aim = gazeAngles(appearance, s.phase, s.face, s.wander.point),
|
|
243
|
-
ease = 1 - Math.exp(-milliseconds / 85);
|
|
244
|
-
s.gaze = [
|
|
245
|
-
s.gaze![0] + (aim[0] - s.gaze![0]) * ease,
|
|
246
|
-
s.gaze![1] + (aim[1] - s.gaze![1]) * ease,
|
|
247
|
-
];
|
|
248
|
-
draw();
|
|
249
|
-
}
|
|
250
|
-
last = now;
|
|
251
|
-
}
|
|
252
|
-
frame = requestAnimationFrame(tick);
|
|
253
|
-
};
|
|
254
|
-
const subscription = AppState.addEventListener('change', (next) => {
|
|
255
|
-
active = next === 'active';
|
|
256
|
-
last = 0;
|
|
257
|
-
});
|
|
258
|
-
let observer: IntersectionObserver | undefined;
|
|
259
|
-
if (
|
|
260
|
-
Platform.OS === 'web' &&
|
|
261
|
-
typeof IntersectionObserver !== 'undefined' &&
|
|
262
|
-
root.current instanceof Element
|
|
263
|
-
) {
|
|
264
|
-
observer = new IntersectionObserver((entries) => {
|
|
265
|
-
visible = entries[0]?.isIntersecting ?? true;
|
|
266
|
-
});
|
|
267
|
-
observer.observe(root.current);
|
|
268
|
-
}
|
|
269
|
-
draw();
|
|
270
|
-
if (!frozen) frame = requestAnimationFrame(tick);
|
|
271
|
-
return () => {
|
|
272
|
-
cancelAnimationFrame(frame);
|
|
273
|
-
subscription?.remove?.();
|
|
274
|
-
observer?.disconnect();
|
|
275
|
-
};
|
|
276
|
-
}, [
|
|
277
|
-
config,
|
|
278
|
-
size,
|
|
279
|
-
backingSize,
|
|
280
|
-
paused,
|
|
281
|
-
reduced,
|
|
282
|
-
entranceKey,
|
|
283
|
-
workingKey,
|
|
284
|
-
workingCycles,
|
|
285
|
-
]);
|
|
286
|
-
return (
|
|
287
|
-
<StyledView
|
|
288
|
-
ref={root}
|
|
289
|
-
className={className}
|
|
290
|
-
style={[{ width: size, height: size, maxWidth: '100%' }, style]}
|
|
291
|
-
accessible
|
|
292
|
-
accessibilityRole="image"
|
|
293
|
-
accessibilityLabel={accessibilityLabel ?? label ?? messages.label}
|
|
294
|
-
testID={testID}
|
|
295
|
-
>
|
|
296
|
-
<Drawing context={drawing} size={size} />
|
|
297
|
-
</StyledView>
|
|
8
|
+
/** Both catalogs use the recovered engine when their recipe is supported. */
|
|
9
|
+
export const AgentAvatar = memo(function AgentAvatar(props: AgentAvatarProps) {
|
|
10
|
+
const { runtimeUrl } = useContext(CharacterRuntimeContext);
|
|
11
|
+
const beta =
|
|
12
|
+
props.config.character && props.config.character.preset !== 'bloom';
|
|
13
|
+
const legacy = runtimeUrl && !legacyRecipeUnsupported(props.config);
|
|
14
|
+
return beta || legacy ? (
|
|
15
|
+
<CharacterAvatar key={beta ? 'character' : 'legacy'} {...props} />
|
|
16
|
+
) : (
|
|
17
|
+
<ProceduralAvatar {...props} />
|
|
298
18
|
);
|
|
299
|
-
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useMemo, useState, useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import type { AgentAvatarProviderProps } from './types';
|
|
3
|
+
import { type CharacterCapabilities, CharacterRuntimeContext } from './context';
|
|
4
|
+
|
|
5
|
+
const EMPTY_CAPABILITIES: ReadonlyMap<string, CharacterCapabilities> =
|
|
6
|
+
new Map();
|
|
7
|
+
function sameRecord<T>(left: Record<string, T>, right: Record<string, T>) {
|
|
8
|
+
const keys = Object.keys(left);
|
|
9
|
+
return (
|
|
10
|
+
keys.length === Object.keys(right).length &&
|
|
11
|
+
keys.every((key) => left[key] === right[key])
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Enables the optional character engine without fetching it until an avatar needs it. */
|
|
16
|
+
export function AgentAvatarProvider({
|
|
17
|
+
runtimeUrl,
|
|
18
|
+
children,
|
|
19
|
+
}: AgentAvatarProviderProps) {
|
|
20
|
+
const [cache, setCapabilities] = useState(() => ({
|
|
21
|
+
runtimeUrl,
|
|
22
|
+
entries: EMPTY_CAPABILITIES,
|
|
23
|
+
}));
|
|
24
|
+
const activeRuntime = useRef(runtimeUrl);
|
|
25
|
+
activeRuntime.current = runtimeUrl;
|
|
26
|
+
// An old module's catalog cannot describe the newly selected runtime, even
|
|
27
|
+
// for the same saved recipe. Hide its cache during the first changed render.
|
|
28
|
+
const capabilitiesByKey =
|
|
29
|
+
cache.runtimeUrl === runtimeUrl ? cache.entries : EMPTY_CAPABILITIES;
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setCapabilities((previous) =>
|
|
32
|
+
previous.runtimeUrl === runtimeUrl
|
|
33
|
+
? previous
|
|
34
|
+
: { runtimeUrl, entries: EMPTY_CAPABILITIES },
|
|
35
|
+
);
|
|
36
|
+
}, [runtimeUrl]);
|
|
37
|
+
const reportCapabilities = useCallback(
|
|
38
|
+
(next: CharacterCapabilities) => {
|
|
39
|
+
// A disposed renderer can finish preparing after its runtime was replaced.
|
|
40
|
+
if (activeRuntime.current !== runtimeUrl) return;
|
|
41
|
+
setCapabilities((previous) => {
|
|
42
|
+
if (activeRuntime.current !== runtimeUrl) return previous;
|
|
43
|
+
const prior =
|
|
44
|
+
previous.runtimeUrl === runtimeUrl
|
|
45
|
+
? previous.entries
|
|
46
|
+
: EMPTY_CAPABILITIES;
|
|
47
|
+
const known = prior.get(next.key);
|
|
48
|
+
if (
|
|
49
|
+
known &&
|
|
50
|
+
sameRecord(known.available, next.available) &&
|
|
51
|
+
sameRecord(known.selected, next.selected)
|
|
52
|
+
)
|
|
53
|
+
return previous;
|
|
54
|
+
const entries = new Map(prior);
|
|
55
|
+
entries.delete(next.key);
|
|
56
|
+
entries.set(next.key, next);
|
|
57
|
+
if (entries.size > 64) entries.delete(entries.keys().next().value!);
|
|
58
|
+
return { runtimeUrl, entries };
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
[runtimeUrl],
|
|
62
|
+
);
|
|
63
|
+
const value = useMemo(
|
|
64
|
+
() => ({ runtimeUrl, capabilitiesByKey, reportCapabilities }),
|
|
65
|
+
[runtimeUrl, capabilitiesByKey, reportCapabilities],
|
|
66
|
+
);
|
|
67
|
+
return (
|
|
68
|
+
<CharacterRuntimeContext.Provider value={value}>
|
|
69
|
+
{children}
|
|
70
|
+
</CharacterRuntimeContext.Provider>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { AccessibilityInfo, AppState, Platform, type View } from 'react-native';
|
|
3
|
+
import { useReducedMotion } from 'react-native-reanimated';
|
|
4
|
+
import { useMessages } from '../locale/messages';
|
|
5
|
+
import { StyledView } from '../styles/styled-primitives';
|
|
6
|
+
import { Text } from '../typography';
|
|
7
|
+
import { type CharacterCapabilities, CharacterRuntimeContext } from './context';
|
|
8
|
+
import { characterHtml, scriptJson } from './character-html';
|
|
9
|
+
import { loadCharacterRuntime } from './character-runtime-module';
|
|
10
|
+
import {
|
|
11
|
+
characterWebView,
|
|
12
|
+
type CharacterWebViewHandle,
|
|
13
|
+
} from './character-webview';
|
|
14
|
+
import { legacyRecipe } from './legacy-recipe';
|
|
15
|
+
import { AGENT_AVATAR_MESSAGES } from './messages';
|
|
16
|
+
import type { AgentAvatarProps } from './types';
|
|
17
|
+
|
|
18
|
+
type RenderProps = Pick<
|
|
19
|
+
AgentAvatarProps,
|
|
20
|
+
| 'config'
|
|
21
|
+
| 'paused'
|
|
22
|
+
| 'portrait'
|
|
23
|
+
| 'workingKey'
|
|
24
|
+
| 'workingCycles'
|
|
25
|
+
| 'interactive'
|
|
26
|
+
| 'reactionKey'
|
|
27
|
+
| 'entranceKey'
|
|
28
|
+
> & { reduced: boolean; legacy?: ReturnType<typeof legacyRecipe> };
|
|
29
|
+
type Controller = { update(props: RenderProps): void; dispose(): void };
|
|
30
|
+
type RuntimeModule = {
|
|
31
|
+
createAvatar(
|
|
32
|
+
canvas: HTMLCanvasElement,
|
|
33
|
+
props: RenderProps,
|
|
34
|
+
callbacks: {
|
|
35
|
+
onError(): void;
|
|
36
|
+
onCapabilities?(value: CharacterCapabilities): void;
|
|
37
|
+
},
|
|
38
|
+
): Promise<Controller>;
|
|
39
|
+
};
|
|
40
|
+
function WebCharacter({
|
|
41
|
+
runtimeUrl,
|
|
42
|
+
value,
|
|
43
|
+
onError,
|
|
44
|
+
}: {
|
|
45
|
+
runtimeUrl: string;
|
|
46
|
+
value: RenderProps;
|
|
47
|
+
onError(): void;
|
|
48
|
+
}) {
|
|
49
|
+
const { reportCapabilities } = useContext(CharacterRuntimeContext);
|
|
50
|
+
const report = useRef(reportCapabilities);
|
|
51
|
+
report.current = reportCapabilities;
|
|
52
|
+
const host = useRef<View>(null),
|
|
53
|
+
controller = useRef<Controller | null>(null);
|
|
54
|
+
const latest = useRef(value);
|
|
55
|
+
latest.current = value;
|
|
56
|
+
const fail = useRef(onError);
|
|
57
|
+
fail.current = onError;
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const element = host.current as unknown as HTMLElement;
|
|
60
|
+
if (!element || typeof document === 'undefined') return;
|
|
61
|
+
let stopped = false,
|
|
62
|
+
started = false;
|
|
63
|
+
const canvas = document.createElement('canvas');
|
|
64
|
+
canvas.setAttribute('aria-hidden', 'true');
|
|
65
|
+
Object.assign(canvas.style, {
|
|
66
|
+
width: '100%',
|
|
67
|
+
height: '100%',
|
|
68
|
+
display: 'block',
|
|
69
|
+
touchAction: 'none',
|
|
70
|
+
});
|
|
71
|
+
element.appendChild(canvas);
|
|
72
|
+
const start = async () => {
|
|
73
|
+
if (started || stopped) return;
|
|
74
|
+
started = true;
|
|
75
|
+
try {
|
|
76
|
+
const module = await loadCharacterRuntime<RuntimeModule>(runtimeUrl);
|
|
77
|
+
if (stopped) return;
|
|
78
|
+
const instance = await module.createAvatar(canvas, latest.current, {
|
|
79
|
+
onError: () => fail.current(),
|
|
80
|
+
onCapabilities: (info) => report.current?.(info),
|
|
81
|
+
});
|
|
82
|
+
if (stopped) instance.dispose();
|
|
83
|
+
else {
|
|
84
|
+
controller.current = instance;
|
|
85
|
+
instance.update(latest.current);
|
|
86
|
+
}
|
|
87
|
+
} catch {
|
|
88
|
+
if (!stopped) fail.current();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const observer = new IntersectionObserver((entries) => {
|
|
92
|
+
if (entries.some((entry) => entry.isIntersecting)) void start();
|
|
93
|
+
});
|
|
94
|
+
observer.observe(element);
|
|
95
|
+
return () => {
|
|
96
|
+
stopped = true;
|
|
97
|
+
observer.disconnect();
|
|
98
|
+
controller.current?.dispose();
|
|
99
|
+
controller.current = null;
|
|
100
|
+
canvas.remove();
|
|
101
|
+
};
|
|
102
|
+
}, [runtimeUrl]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
try {
|
|
105
|
+
controller.current?.update(value);
|
|
106
|
+
} catch {
|
|
107
|
+
onError();
|
|
108
|
+
}
|
|
109
|
+
}, [value, onError]);
|
|
110
|
+
return <StyledView ref={host} style={{ flex: 1 }} />;
|
|
111
|
+
}
|
|
112
|
+
function NativeCharacter({
|
|
113
|
+
runtimeUrl,
|
|
114
|
+
value,
|
|
115
|
+
onError,
|
|
116
|
+
}: {
|
|
117
|
+
runtimeUrl: string;
|
|
118
|
+
value: RenderProps;
|
|
119
|
+
onError(): void;
|
|
120
|
+
}) {
|
|
121
|
+
const { reportCapabilities } = useContext(CharacterRuntimeContext);
|
|
122
|
+
const WebView = characterWebView();
|
|
123
|
+
const ref = useRef<CharacterWebViewHandle>(null);
|
|
124
|
+
const initial = useRef(value);
|
|
125
|
+
const source = useMemo(
|
|
126
|
+
() => ({
|
|
127
|
+
html: characterHtml(runtimeUrl, initial.current),
|
|
128
|
+
baseUrl: runtimeUrl,
|
|
129
|
+
}),
|
|
130
|
+
[runtimeUrl],
|
|
131
|
+
);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (!WebView) onError();
|
|
134
|
+
}, [WebView, onError]);
|
|
135
|
+
const send = () =>
|
|
136
|
+
ref.current?.injectJavaScript(
|
|
137
|
+
`window.updateCharacter?.(${scriptJson(value)}); true;`,
|
|
138
|
+
);
|
|
139
|
+
useEffect(send, [value]);
|
|
140
|
+
if (!WebView) return null;
|
|
141
|
+
return (
|
|
142
|
+
<WebView
|
|
143
|
+
ref={ref}
|
|
144
|
+
source={source}
|
|
145
|
+
style={{ flex: 1, backgroundColor: 'transparent' }}
|
|
146
|
+
scrollEnabled={false}
|
|
147
|
+
javaScriptEnabled
|
|
148
|
+
originWhitelist={['*']}
|
|
149
|
+
onMessage={(event) => {
|
|
150
|
+
if (event.nativeEvent.data.startsWith('capabilities:')) {
|
|
151
|
+
try {
|
|
152
|
+
reportCapabilities?.(JSON.parse(event.nativeEvent.data.slice(13)));
|
|
153
|
+
} catch {
|
|
154
|
+
onError();
|
|
155
|
+
}
|
|
156
|
+
} else if (event.nativeEvent.data === 'error') onError();
|
|
157
|
+
else if (event.nativeEvent.data === 'loaded') send();
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Optional binary-backed renderer; the application supplies the hosted runtime URL. */
|
|
164
|
+
export function CharacterAvatar(props: AgentAvatarProps) {
|
|
165
|
+
const { runtimeUrl } = useContext(CharacterRuntimeContext);
|
|
166
|
+
const { messages } = useMessages(AGENT_AVATAR_MESSAGES, props.locale);
|
|
167
|
+
const initialReduced = useReducedMotion();
|
|
168
|
+
const [reduced, setReduced] = useState(initialReduced);
|
|
169
|
+
const [active, setActive] = useState(AppState.currentState !== 'background');
|
|
170
|
+
const [failed, setFailed] = useState(false);
|
|
171
|
+
const {
|
|
172
|
+
config,
|
|
173
|
+
paused,
|
|
174
|
+
portrait,
|
|
175
|
+
workingKey,
|
|
176
|
+
reactionKey,
|
|
177
|
+
entranceKey,
|
|
178
|
+
workingCycles,
|
|
179
|
+
interactive,
|
|
180
|
+
size = 64,
|
|
181
|
+
} = props;
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
const motion = AccessibilityInfo.addEventListener(
|
|
184
|
+
'reduceMotionChanged',
|
|
185
|
+
setReduced,
|
|
186
|
+
);
|
|
187
|
+
const state = AppState.addEventListener('change', (next) =>
|
|
188
|
+
setActive(next === 'active'),
|
|
189
|
+
);
|
|
190
|
+
const media =
|
|
191
|
+
Platform.OS === 'web'
|
|
192
|
+
? window.matchMedia('(prefers-reduced-motion: reduce)')
|
|
193
|
+
: undefined;
|
|
194
|
+
const change = () => setReduced(media!.matches);
|
|
195
|
+
media?.addEventListener('change', change);
|
|
196
|
+
if (media) change();
|
|
197
|
+
return () => {
|
|
198
|
+
motion?.remove?.();
|
|
199
|
+
state?.remove?.();
|
|
200
|
+
media?.removeEventListener('change', change);
|
|
201
|
+
};
|
|
202
|
+
}, []);
|
|
203
|
+
useEffect(() => setFailed(false), [runtimeUrl, config.character]);
|
|
204
|
+
const value = useMemo(
|
|
205
|
+
() => ({
|
|
206
|
+
config,
|
|
207
|
+
legacy:
|
|
208
|
+
!config.character || config.character.preset === 'bloom'
|
|
209
|
+
? legacyRecipe(config)
|
|
210
|
+
: undefined,
|
|
211
|
+
paused: paused || !active,
|
|
212
|
+
portrait,
|
|
213
|
+
workingKey,
|
|
214
|
+
reactionKey,
|
|
215
|
+
entranceKey,
|
|
216
|
+
workingCycles,
|
|
217
|
+
interactive,
|
|
218
|
+
reduced,
|
|
219
|
+
}),
|
|
220
|
+
[
|
|
221
|
+
config,
|
|
222
|
+
paused,
|
|
223
|
+
portrait,
|
|
224
|
+
active,
|
|
225
|
+
workingKey,
|
|
226
|
+
reactionKey,
|
|
227
|
+
entranceKey,
|
|
228
|
+
workingCycles,
|
|
229
|
+
interactive,
|
|
230
|
+
reduced,
|
|
231
|
+
],
|
|
232
|
+
);
|
|
233
|
+
const fail = useMemo(() => () => setFailed(true), []);
|
|
234
|
+
const Renderer = Platform.OS === 'web' ? WebCharacter : NativeCharacter;
|
|
235
|
+
return (
|
|
236
|
+
<StyledView
|
|
237
|
+
className={props.className}
|
|
238
|
+
style={[{ width: size, height: size }, props.style]}
|
|
239
|
+
accessible
|
|
240
|
+
accessibilityRole="image"
|
|
241
|
+
accessibilityLabel={
|
|
242
|
+
props.accessibilityLabel ?? props.label ?? messages.label
|
|
243
|
+
}
|
|
244
|
+
testID={props.testID}
|
|
245
|
+
>
|
|
246
|
+
{runtimeUrl && !failed ? (
|
|
247
|
+
<Renderer runtimeUrl={runtimeUrl} value={value} onError={fail} />
|
|
248
|
+
) : (
|
|
249
|
+
<Text numberOfLines={2} style={{ fontSize: 10 }}>
|
|
250
|
+
{messages.unavailable}
|
|
251
|
+
</Text>
|
|
252
|
+
)}
|
|
253
|
+
</StyledView>
|
|
254
|
+
);
|
|
255
|
+
}
|