@oxy.so/bloom 21.0.0 → 21.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/docs/adoption-matrix.mdx +1 -1
  2. package/docs/agent-avatar.mdx +4 -1
  3. package/docs/multi-agent-chat.mdx +5 -1
  4. package/docs/public-parts.mdx +2 -2
  5. package/docs/task-catalog.json +1 -1
  6. package/docs/task-catalog.mdx +1 -1
  7. package/lib/commonjs/agent-avatar/VectorCharacterAvatar.js +16 -11
  8. package/lib/commonjs/agent-avatar/VectorCharacterAvatar.js.map +1 -1
  9. package/lib/commonjs/agent-avatar/use-static-portraits.js +51 -0
  10. package/lib/commonjs/agent-avatar/use-static-portraits.js.map +1 -0
  11. package/lib/commonjs/agent-creator/ShapeSilhouette.js +4 -3
  12. package/lib/commonjs/agent-creator/ShapeSilhouette.js.map +1 -1
  13. package/lib/commonjs/agent-creator/rainbow-artwork.js +12 -3
  14. package/lib/commonjs/agent-creator/rainbow-artwork.js.map +1 -1
  15. package/lib/commonjs/multi-agent-chat/selected-agent-preview.js +19 -0
  16. package/lib/commonjs/multi-agent-chat/selected-agent-preview.js.map +1 -0
  17. package/lib/module/agent-avatar/VectorCharacterAvatar.js +16 -11
  18. package/lib/module/agent-avatar/VectorCharacterAvatar.js.map +1 -1
  19. package/lib/module/agent-avatar/use-static-portraits.js +44 -0
  20. package/lib/module/agent-avatar/use-static-portraits.js.map +1 -0
  21. package/lib/module/agent-creator/ShapeSilhouette.js +4 -3
  22. package/lib/module/agent-creator/ShapeSilhouette.js.map +1 -1
  23. package/lib/module/agent-creator/rainbow-artwork.js +12 -3
  24. package/lib/module/agent-creator/rainbow-artwork.js.map +1 -1
  25. package/lib/module/multi-agent-chat/selected-agent-preview.js +9 -0
  26. package/lib/module/multi-agent-chat/selected-agent-preview.js.map +1 -0
  27. package/lib/typescript/commonjs/agent-avatar/VectorCharacterAvatar.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/agent-avatar/use-static-portraits.d.ts +16 -0
  29. package/lib/typescript/commonjs/agent-avatar/use-static-portraits.d.ts.map +1 -0
  30. package/lib/typescript/commonjs/agent-creator/ShapeSilhouette.d.ts +1 -1
  31. package/lib/typescript/commonjs/agent-creator/ShapeSilhouette.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/agent-creator/rainbow-artwork.d.ts +12 -2
  33. package/lib/typescript/commonjs/agent-creator/rainbow-artwork.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/multi-agent-chat/selected-agent-preview.d.ts +7 -0
  35. package/lib/typescript/commonjs/multi-agent-chat/selected-agent-preview.d.ts.map +1 -0
  36. package/lib/typescript/module/agent-avatar/VectorCharacterAvatar.d.ts.map +1 -1
  37. package/lib/typescript/module/agent-avatar/use-static-portraits.d.ts +16 -0
  38. package/lib/typescript/module/agent-avatar/use-static-portraits.d.ts.map +1 -0
  39. package/lib/typescript/module/agent-creator/ShapeSilhouette.d.ts +1 -1
  40. package/lib/typescript/module/agent-creator/ShapeSilhouette.d.ts.map +1 -1
  41. package/lib/typescript/module/agent-creator/rainbow-artwork.d.ts +12 -2
  42. package/lib/typescript/module/agent-creator/rainbow-artwork.d.ts.map +1 -1
  43. package/lib/typescript/module/multi-agent-chat/selected-agent-preview.d.ts +7 -0
  44. package/lib/typescript/module/multi-agent-chat/selected-agent-preview.d.ts.map +1 -0
  45. package/package.json +18 -1
  46. package/src/agent-avatar/VectorCharacterAvatar.tsx +19 -16
  47. package/src/agent-avatar/use-static-portraits.ts +50 -0
  48. package/src/agent-creator/ShapeSilhouette.tsx +4 -3
  49. package/src/agent-creator/rainbow-artwork.ts +13 -3
  50. package/src/multi-agent-chat/selected-agent-preview.ts +6 -0
@@ -1 +1 @@
1
- {"version":3,"file":"rainbow-artwork.d.ts","sourceRoot":"","sources":["../../../../src/agent-creator/rainbow-artwork.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,+m6MACol6M,CAAC;AAC/m6M,eAAO,MAAM,YAAY,m8pIACy6pI,CAAC"}
1
+ {"version":3,"file":"rainbow-artwork.d.ts","sourceRoot":"","sources":["../../../../src/agent-creator/rainbow-artwork.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,23KACg2K,CAAC;AAE33K,eAAO,MAAM,YAAY,upKAC6nK,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A focused entry for the selected-agents preview alone: the `multi-agent-chat` barrel is the whole
3
+ * multi-agent template (its chat, sidebar, marketplace, agent creator and settings pages), which an
4
+ * app that only shows who is in a group should not link.
5
+ */
6
+ export { previewAvatarGeometry, SelectedAgentPreview } from './SelectedAgentPreview.js';
7
+ //# sourceMappingURL=selected-agent-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selected-agent-preview.d.ts","sourceRoot":"","sources":["../../../../src/multi-agent-chat/selected-agent-preview.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,2BAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/bloom",
3
- "version": "21.0.0",
3
+ "version": "21.1.1",
4
4
  "packageManager": "bun@1.4.3",
5
5
  "description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
6
6
  "main": "lib/commonjs/index.js",
@@ -762,6 +762,20 @@
762
762
  "default": "./lib/commonjs/multi-agent-chat/index.js"
763
763
  }
764
764
  },
765
+ "./multi-agent-chat/selected-agent-preview": {
766
+ "react-native": {
767
+ "types": "./lib/typescript/module/multi-agent-chat/selected-agent-preview.d.ts",
768
+ "default": "./src/multi-agent-chat/selected-agent-preview.ts"
769
+ },
770
+ "import": {
771
+ "types": "./lib/typescript/module/multi-agent-chat/selected-agent-preview.d.ts",
772
+ "default": "./lib/module/multi-agent-chat/selected-agent-preview.js"
773
+ },
774
+ "require": {
775
+ "types": "./lib/typescript/commonjs/multi-agent-chat/selected-agent-preview.d.ts",
776
+ "default": "./lib/commonjs/multi-agent-chat/selected-agent-preview.js"
777
+ }
778
+ },
765
779
  "./agent-limits-card": {
766
780
  "react-native": {
767
781
  "types": "./lib/typescript/module/agent-limits-card/index.d.ts",
@@ -4837,6 +4851,9 @@
4837
4851
  "multi-agent-chat": [
4838
4852
  "./lib/typescript/module/multi-agent-chat/index.d.ts"
4839
4853
  ],
4854
+ "multi-agent-chat/selected-agent-preview": [
4855
+ "./lib/typescript/module/multi-agent-chat/selected-agent-preview.d.ts"
4856
+ ],
4840
4857
  "agent-limits-card": [
4841
4858
  "./lib/typescript/module/agent-limits-card/index.d.ts"
4842
4859
  ],
@@ -53,7 +53,7 @@ import { AvatarSnapshotObserver, CharacterRuntimeContext } from './context';
53
53
  import { AGENT_AVATAR_MESSAGES } from './messages';
54
54
  import type { AgentAvatarProps } from './types';
55
55
  import { VectorStaticPortrait } from './VectorStaticPortrait';
56
- import { vectorEyePortraits } from './vector-static';
56
+ import { useStaticPortraits } from './use-static-portraits';
57
57
  import { useVectorAssetLoader } from './default-catalog';
58
58
  import { loadVectorGeometry, paintVectorCharacter, vectorGeometryKey } from './vector-compose';
59
59
  import { renderVectorFrame } from './vector-frame';
@@ -73,23 +73,26 @@ type Display = {
73
73
  };
74
74
  /** Shared browser/native SVG host; loading, composition and projection never start the 3D runtime. */
75
75
  export function VectorCharacterAvatar(props: Props) {
76
- if (props.previewPart === 'eyes') {
77
- const resolved = resolveAvatarCharacter(props.character),
78
- eyes = resolved.eyes;
79
- const frame = eyes === 'none' ? undefined : vectorEyePortraits[eyes];
80
- const paint =
81
- 'bodyColor' in resolved.paint
82
- ? resolved.paint.bodyColor
83
- : CHARACTER_COLORS[resolved.paint.color];
84
- return (
85
- <VectorStaticPortrait
86
- {...props}
87
- frame={frame ? paintVectorEyeFrame(frame, paint, eyes) : frame}
88
- />
89
- );
90
- }
76
+ if (props.previewPart === 'eyes') return <VectorEyePreview {...props} />;
91
77
  return <AnimatedVectorCharacterAvatar {...props} />;
92
78
  }
79
+ /** The eye picker's still eyes, from the offline portraits (loaded on first use). */
80
+ function VectorEyePreview(props: Props) {
81
+ const portraits = useStaticPortraits();
82
+ const resolved = resolveAvatarCharacter(props.character),
83
+ eyes = resolved.eyes;
84
+ const frame = eyes === 'none' ? undefined : portraits?.vectorEyePortraits[eyes];
85
+ const paint =
86
+ 'bodyColor' in resolved.paint
87
+ ? resolved.paint.bodyColor
88
+ : CHARACTER_COLORS[resolved.paint.color];
89
+ return (
90
+ <VectorStaticPortrait
91
+ {...props}
92
+ frame={frame ? paintVectorEyeFrame(frame, paint, eyes) : frame}
93
+ />
94
+ );
95
+ }
93
96
  function AnimatedVectorCharacterAvatar(props: Props) {
94
97
  const { character, size = 64, paused, portrait, interactive, previewPart, mood } = props;
95
98
  const { messages } = useMessages(AGENT_AVATAR_MESSAGES, props.locale);
@@ -0,0 +1,50 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ type StaticPortraits = typeof import('./vector-static');
4
+
5
+ let loaded: StaticPortraits | undefined;
6
+ let pending: Promise<StaticPortraits> | undefined;
7
+
8
+ /**
9
+ * The offline shape and eye portraits (`vector-static`, ~310 KB of paths), loaded on first use.
10
+ *
11
+ * Only the agent creator draws them (its shape arc and its eye picker); an avatar never does. Linked
12
+ * statically from the avatar renderer, they were in every app's first paint. Every caller goes
13
+ * through this one `import()`, so no route links them eagerly and the module is fetched once.
14
+ */
15
+ export function loadStaticPortraits(): Promise<StaticPortraits> {
16
+ pending ??= import('./vector-static').then(
17
+ (module) => {
18
+ loaded = module;
19
+ return module;
20
+ },
21
+ (error: unknown) => {
22
+ // Forget a failed fetch so the next render asks again.
23
+ pending = undefined;
24
+ throw error;
25
+ },
26
+ );
27
+ return pending;
28
+ }
29
+
30
+ /**
31
+ * The portraits, or `undefined` until they arrive. The portrait keeps its size meanwhile (an empty
32
+ * box, as for no eyes), so nothing moves when it fills in; after the first load it is synchronous.
33
+ */
34
+ export function useStaticPortraits(): StaticPortraits | undefined {
35
+ const [portraits, setPortraits] = useState(loaded);
36
+ useEffect(() => {
37
+ if (portraits) return;
38
+ let live = true;
39
+ loadStaticPortraits().then(
40
+ (module) => {
41
+ if (live) setPortraits(module);
42
+ },
43
+ () => {},
44
+ );
45
+ return () => {
46
+ live = false;
47
+ };
48
+ }, [portraits]);
49
+ return portraits;
50
+ }
@@ -2,14 +2,15 @@ import { memo } from 'react';
2
2
  import { type AvatarCharacter, resolveAvatarCharacter } from '../agent-avatar/character';
3
3
  import { CHARACTER_COLORS } from '../agent-avatar/character-colors';
4
4
  import { VectorStaticPortrait } from '../agent-avatar/VectorStaticPortrait';
5
- import { vectorShapePortraits } from '../agent-avatar/vector-static';
5
+ import { useStaticPortraits } from '../agent-avatar/use-static-portraits';
6
6
 
7
- /** Body contours are static: browsing shapes never downloads animation clips. */
7
+ /** Body contours are static: browsing shapes never downloads animation clips (`use-static-portraits`). */
8
8
  export const ShapeSilhouette = memo(function ShapeSilhouette({
9
9
  character,
10
10
  }: {
11
11
  character: AvatarCharacter;
12
12
  }) {
13
+ const portraits = useStaticPortraits();
13
14
  const resolved = resolveAvatarCharacter(character);
14
15
  const bodyColor =
15
16
  'bodyColor' in resolved.paint
@@ -17,7 +18,7 @@ export const ShapeSilhouette = memo(function ShapeSilhouette({
17
18
  : CHARACTER_COLORS[resolved.paint.color];
18
19
  return (
19
20
  <VectorStaticPortrait
20
- frame={vectorShapePortraits[resolved.shape]!}
21
+ frame={portraits?.vectorShapePortraits[resolved.shape]}
21
22
  size={56}
22
23
  bodyColor={bodyColor}
23
24
  />