@gemies/sdk 2.0.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @gemies/sdk
2
2
 
3
+ ## 3.0.1
4
+
5
+ - **A gemie's account colour may be any hex, not only a Bloom preset key.** `readAgentCharacter`
6
+ paints either through Bloom's `avatarCharacterInColor`; the docs said "a preset key". The gemie
7
+ editor's picker is free again (Bloom 21), and Oxy stores the colour it writes as a hex.
8
+
9
+ ## 3.0.0
10
+
11
+ - **Breaking: a gemie is painted in its Oxy account's colour, and nothing else.**
12
+ `readAgentCharacter(character, color)` takes the gemie's `color` (its account's `User.color`, a
13
+ Bloom preset key, which every response that carries a `character` carries beside it) and paints
14
+ the character in it through Bloom's `avatarCharacterInColor`; a paint the character may still
15
+ carry is never drawn. A gemie whose account colour is not known is drawn in one neutral preset
16
+ (`gray`). Every surface the SDK draws a gemie on (the chat's lead and participants, a consulted
17
+ agent's reply, the exchange view) paints it this way, so the avatar, the chat and the other apps
18
+ agree with the account.
19
+ - **New: `readAgentLook(character)`**, the stored look without a colour (its shape and features),
20
+ for an editor that saves it back: the API refuses a character that carries a paint.
21
+ - **Breaking: `DEFAULT_AGENT_CHARACTER` has no paint**, like every gemie's character.
22
+ - **Breaking: the Bloom peer is `>=20.0.0`**, the first Bloom with `avatarCharacterInColor`.
23
+ - Alia keeps her orchid until her gemie has an Oxy account (Gemies ADR 0034 phase 2); then she
24
+ is painted in its colour like every gemie.
25
+
3
26
  ## 2.0.1
4
27
 
5
28
  - **`GemieAccounts` says when the API does not answer**, with a Retry (`gemie.accounts.retry`), and
package/README.md CHANGED
@@ -208,8 +208,9 @@ loads with the first `ask` (fetched in the background once the person is signed
208
208
  stays out of the app's entry bundle. The root entry exports the same two, with the whole chat
209
209
  (its provider imports the sheet statically).
210
210
  For hosts that need that exact eager behavior without the root barrel, import the provider and
211
- hook from `@gemies/sdk/ask/eager`. The character entry exports `readAgentCharacter`,
212
- and `DEFAULT_AGENT_CHARACTER` without the chat.
211
+ hook from `@gemies/sdk/ask/eager`. The character entry exports `readAgentCharacter`
212
+ (a gemie's stored character painted in its account's `color`), `readAgentLook` (the stored
213
+ character without a colour, for an editor) and `DEFAULT_AGENT_CHARACTER` without the chat.
213
214
 
214
215
  **On web, load the chat through ONE async boundary.** Expo's Metro serializer hoists every module
215
216
  two async chunks share into `__common.js`, which loads at first paint. The SDK draws no async chunk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gemies/sdk",
3
- "version": "2.0.1",
3
+ "version": "3.0.1",
4
4
  "description": "The Gemies SDK: the conversation runtime, chat UI, voice calls and dictation for Oxy apps that talk to a gemie",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -58,7 +58,7 @@
58
58
  "react": "^19.2.3",
59
59
  "react-native": "^0.86.0 || ^0.88.0",
60
60
  "@expo/vector-icons": "^15.1.1",
61
- "@oxy.so/bloom": ">=17.41.0",
61
+ "@oxy.so/bloom": ">=20.0.0",
62
62
  "@oxy.so/core": ">=7.1.0 <8",
63
63
  "@oxy.so/services": ">=14.19.1 <15",
64
64
  "@tanstack/react-query": "^5.101",
package/src/character.ts CHANGED
@@ -1 +1 @@
1
- export { DEFAULT_AGENT_CHARACTER, readAgentCharacter } from './lib/agent-character';
1
+ export { DEFAULT_AGENT_CHARACTER, readAgentCharacter, readAgentLook } from './lib/agent-character';
@@ -23,6 +23,8 @@ export function GemieGroupWelcome({ members }: { members: readonly GemieParticip
23
23
  label: '',
24
24
  description: '',
25
25
  avatar: member.character,
26
+ // Already painted in it; a colour the member does not have leaves that paint.
27
+ color: member.color ?? '',
26
28
  })),
27
29
  [members],
28
30
  );
@@ -475,7 +475,7 @@ function ReplyTurn({
475
475
  {agent && agentAnchor ? (
476
476
  <View className="mb-0.5">
477
477
  <AgentReplyIdentity
478
- character={readAgentCharacter(agent.character)}
478
+ character={readAgentCharacter(agent.character, agent.color)}
479
479
  name={agent.name}
480
480
  thinking={agentLive && text.length === 0}
481
481
  workingKey={agent.id}
package/src/index.ts CHANGED
@@ -48,7 +48,7 @@ export { VoiceModeIcon } from './components/VoiceModeIcon';
48
48
  export { AmbientField, PARALLAX_DURATION, PARALLAX_EASE } from './components/AmbientField';
49
49
  export type { AmbientFieldProps } from './components/AmbientField';
50
50
  export { ALIA_AVATAR, GemieAvatar } from './components/GemieAvatar';
51
- export { DEFAULT_AGENT_CHARACTER, readAgentCharacter } from './lib/agent-character';
51
+ export { DEFAULT_AGENT_CHARACTER, readAgentCharacter, readAgentLook } from './lib/agent-character';
52
52
  export type { GemieAvatarProps, GemieAvatarState } from './components/GemieAvatar';
53
53
  export { GemieAvatarIcon } from './components/GemieAvatarIcon';
54
54
  export { useGemieActivity } from './hooks/useGemieActivity';
@@ -1,28 +1,64 @@
1
- import { parseAvatarCharacter, type AvatarCharacter } from '@oxy.so/bloom/agent-avatar';
1
+ import {
2
+ avatarCharacterInColor,
3
+ parseAvatarCharacter,
4
+ type AvatarCharacter,
5
+ } from '@oxy.so/bloom/agent-avatar';
6
+
7
+ /**
8
+ * The colour a gemie is painted in when its account's is not known: an account Oxy did not resolve,
9
+ * an agent that has since been deleted. A Bloom colour preset key; an account colour may also be a hex.
10
+ */
11
+ export const DEFAULT_AGENT_COLOR = 'gray';
2
12
 
3
13
  /**
4
14
  * The look of an agent whose own is not known: a server that does not send one yet, an agent that
5
15
  * has since been deleted, a stored character this Bloom cannot draw. One neutral character, the same
6
16
  * everywhere, so an unknown look is recognisably "not chosen" and never one that belongs to somebody.
17
+ * Like every gemie's, it has no colour of its own.
7
18
  */
8
19
  export const DEFAULT_AGENT_CHARACTER: AvatarCharacter = {
9
20
  shape: 'rounded_cube',
10
21
  eyes: 'oval',
11
22
  eyewear: 'none',
12
23
  accessory: 'none',
13
- color: 'violet',
14
24
  };
15
25
 
26
+ /** A character painted in an account's colour, or in the default one when that is not known. */
27
+ function painted(character: AvatarCharacter, color: string | null | undefined): AvatarCharacter {
28
+ // Bloom leaves a character as it is for a colour it cannot resolve: the default goes on first and
29
+ // the account's colour over it, so a character is always painted, and never in a stored paint.
30
+ return avatarCharacterInColor(avatarCharacterInColor(character, DEFAULT_AGENT_COLOR), color);
31
+ }
32
+
16
33
  /**
17
- * The character an agent is drawn as, from the JSON the server stores for it
18
- * (`agents.character`): Bloom's own parser decides what it can draw, and anything else is the
19
- * default look rather than an avatar that fails to render.
34
+ * The look the server stores for a gemie (`agents.character`), as Bloom can draw it: its shape and
35
+ * features, without a colour. What the agent editor edits and saves back. Bloom's own parser decides
36
+ * what it can draw, and anything else is the default look.
20
37
  */
21
- export function readAgentCharacter(value: unknown): AvatarCharacter {
22
- if (value === null || value === undefined) return DEFAULT_AGENT_CHARACTER;
38
+ export function readAgentLook(value: unknown): AvatarCharacter {
39
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
40
+ return DEFAULT_AGENT_CHARACTER;
41
+ }
23
42
  try {
24
- return parseAvatarCharacter(value);
43
+ const {
44
+ color: _color,
45
+ bodyColor: _bodyColor,
46
+ ...look
47
+ } = parseAvatarCharacter(painted(value as AvatarCharacter, null));
48
+ return look;
25
49
  } catch {
26
50
  return DEFAULT_AGENT_CHARACTER;
27
51
  }
28
52
  }
53
+
54
+ /**
55
+ * The character a gemie is drawn as: its look (`readAgentLook`) painted in its account's colour
56
+ * (`color`, `User.color`, a Bloom preset key or any hex). A gemie's colour is its Oxy account's and nothing
57
+ * else, so `color` is required: every surface that draws a gemie has it beside the character.
58
+ */
59
+ export function readAgentCharacter(
60
+ value: unknown,
61
+ color: string | null | undefined,
62
+ ): AvatarCharacter {
63
+ return painted(readAgentLook(value), color);
64
+ }
@@ -5,6 +5,11 @@ import type { AvatarCharacter } from '@oxy.so/bloom/agent-avatar';
5
5
  * eyes, nothing on its head. It is `blue_beret` with the hat taken off and the paint changed,
6
6
  * so Bloom retargets that preset's animation onto it; change it here and nowhere else.
7
7
  *
8
+ * Every other gemie is painted in its Oxy account's colour and carries no paint of its own
9
+ * (`readAgentCharacter`). Alia is the one exception, and only because her gemie has no Oxy account
10
+ * yet (`agents.oxy_account_id` is `pending-oxy-account:alia` until Oxy gives her one, ADR 0034
11
+ * phase 2): when it exists, her colour is its `color` and the paint here goes.
12
+ *
8
13
  * A module of its own, without React.
9
14
  */
10
15
  export const ALIA_AVATAR: AvatarCharacter = {
@@ -9,8 +9,9 @@ export interface GemieParticipant {
9
9
  id: string;
10
10
  name: string;
11
11
  handle?: string;
12
- /** The 3D character it is drawn as. */
12
+ /** The character it is drawn as, painted in its colour. */
13
13
  character: AvatarCharacter;
14
+ /** Its colour: its Oxy account's (`User.color`, a Bloom preset key or any hex). */
14
15
  color?: string;
15
16
  }
16
17
 
@@ -59,7 +60,7 @@ export function leadOf(profile: GemieAgentProfile | null | undefined): GemieLead
59
60
  id: profile.id,
60
61
  name: profile.name,
61
62
  handle: profile.handle,
62
- character: readAgentCharacter(profile.character),
63
+ character: readAgentCharacter(profile.character, profile.color),
63
64
  color: profile.color,
64
65
  isAlia: false,
65
66
  greeting: profile.greeting,
@@ -73,7 +74,7 @@ export function participantOf(agentInfo: NonNullable<Message['agentInfo']>): Gem
73
74
  id: agentInfo.id,
74
75
  name: agentInfo.name,
75
76
  handle: agentInfo.handle,
76
- character: readAgentCharacter(agentInfo.character),
77
+ character: readAgentCharacter(agentInfo.character, agentInfo.color),
77
78
  color: agentInfo.color,
78
79
  };
79
80
  }