@gemies/sdk 9.2.0 → 10.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 +103 -0
- package/README.md +9 -6
- package/package.json +4 -11
- package/src/accounts.ts +7 -1
- package/src/ask-eager.ts +0 -2
- package/src/ask-text.ts +0 -1
- package/src/ask.ts +0 -1
- package/src/components/AmbientField.tsx +13 -2
- package/src/components/ComposerDropZone.tsx +20 -4
- package/src/components/ComposerSuggestions.tsx +9 -2
- package/src/components/GemieActivityLine.tsx +11 -5
- package/src/components/GemieBetweenGemies.tsx +23 -10
- package/src/components/GemieChatContent.tsx +46 -23
- package/src/components/GemieChatScreen.tsx +7 -4
- package/src/components/GemieChatSheet.tsx +6 -2
- package/src/components/GemieComposer.tsx +17 -7
- package/src/components/GemieGroupWelcome.tsx +16 -2
- package/src/components/GemieRecentConversations.tsx +13 -10
- package/src/components/GemieSharedConversation.tsx +38 -6
- package/src/components/GemieWelcomeMessage.tsx +23 -7
- package/src/components/IdentityMark.tsx +6 -12
- package/src/components/PlanPreviewCard.tsx +18 -7
- package/src/components/QuestionCard.tsx +6 -2
- package/src/components/ReplyMarkdown.tsx +32 -6
- package/src/components/RichBlocks.tsx +20 -15
- package/src/components/accounts/GemieAccountGrants.tsx +27 -10
- package/src/components/accounts/GemieConnectedAccounts.tsx +87 -51
- package/src/components/canvas/CanvasComponent.tsx +6 -2
- package/src/components/canvas/DashboardRenderer.tsx +25 -8
- package/src/components/canvas/DeckRenderer.tsx +23 -6
- package/src/components/canvas/FormRenderer.tsx +8 -3
- package/src/components/connectors/ConnectorLogo.tsx +15 -9
- package/src/components/connectors/GemieConnectedConnectors.tsx +51 -25
- package/src/components/connectors/GemieConnectorsStore.tsx +99 -41
- package/src/components/connectors/GrantSwitchRow.tsx +18 -5
- package/src/components/thought/ThoughtPanel.tsx +26 -12
- package/src/components/thought/ToolStep.tsx +14 -6
- package/src/components/thread/AgentResultCard.tsx +10 -4
- package/src/components/thread/AgentTaskCard.tsx +8 -3
- package/src/components/thread/ApprovalCard.tsx +6 -2
- package/src/components/thread/ChatBubble.tsx +66 -25
- package/src/components/thread/GemieThread.tsx +32 -10
- package/src/components/thread/ThreadRow.tsx +20 -15
- package/src/components/thread/ThreadSearch.tsx +27 -10
- package/src/components/thread/ThreadSkeleton.tsx +12 -6
- package/src/components/thread/ToolResultCard.tsx +10 -4
- package/src/components/thread/TurnAttachments.tsx +17 -8
- package/src/components/voice/VoiceControls.tsx +9 -6
- package/src/connectors.ts +15 -2
- package/src/hooks/useAgentRunFailureToast.ts +34 -0
- package/src/hooks/useChatVoice.ts +2 -10
- package/src/hooks/useMessageReactions.ts +5 -5
- package/src/hooks/useThoughtScope.ts +9 -8
- package/src/index.ts +2 -3
- package/src/lib/tool-call-status.ts +1 -1
- package/src/lib/utils.ts +1 -8
- package/src/realtime/react.tsx +9 -9
- package/src/realtime/reread.ts +28 -0
- package/src/realtime/store.ts +123 -0
- package/src/runtime/agents.ts +46 -27
- package/src/runtime/collections.ts +35 -136
- package/src/runtime/connected-accounts.ts +175 -88
- package/src/runtime/connectors.ts +244 -127
- package/src/runtime/conversations.ts +181 -607
- package/src/runtime/data/answer.ts +76 -0
- package/src/runtime/data/collections.ts +168 -0
- package/src/runtime/data/conversations.ts +626 -0
- package/src/runtime/data/reactions.ts +29 -0
- package/src/runtime/data/read.ts +37 -0
- package/src/runtime/data/threads.ts +149 -0
- package/src/runtime/index.ts +72 -8
- package/src/runtime/model.ts +0 -2
- package/src/runtime/routes.ts +2 -2
- package/src/runtime/sharing.ts +69 -56
- package/src/runtime/types.ts +8 -16
- package/src/runtime/use-bound-action.ts +27 -0
- package/src/runtime/use-conversation-stream.ts +8 -31
- package/src/runtime/use-conversation-thread.ts +40 -51
- package/src/runtime/use-gemie-thread.ts +32 -43
- package/src/runtime/use-start-conversation.ts +14 -15
- package/src/runtime/use-thread-history.ts +26 -36
- package/src/runtime/use-thread-search.ts +29 -76
- package/src/text.ts +0 -1
- package/src/voice.ts +0 -1
- package/src/components/Image.tsx +0 -12
- package/src/realtime/cache.ts +0 -257
- package/src/runtime/conversation-dates.ts +0 -31
- package/src/runtime/query-keys.ts +0 -66
- package/src/runtime/reaction-cache.ts +0 -45
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
# @gemies/sdk
|
|
2
2
|
|
|
3
|
+
## 10.0.0
|
|
4
|
+
|
|
5
|
+
Built on `@oxy.so/services` 15. The runtime's own data moved off React Query onto
|
|
6
|
+
`@oxy.so/bloom-data`, in the store Services' `OxyProvider` opens for the signed-in account: an
|
|
7
|
+
account switch never shows the previous account's conversations, collections, threads or
|
|
8
|
+
connections, and an answer that lands for an account that was left is dropped. The SDK has no React
|
|
9
|
+
Query left.
|
|
10
|
+
|
|
11
|
+
It also takes Bloom 23 and leaves NativeWind: the chat's components style through React Native
|
|
12
|
+
styles and Bloom's colour tokens (`createTokenStyles` from `@oxy.so/bloom/theme`) and pass no
|
|
13
|
+
`className`, which Bloom 23 no longer takes. They draw as on Bloom 22: each converted element was
|
|
14
|
+
rendered before and after, light and dark, native and web. An app needs no NativeWind,
|
|
15
|
+
react-native-css or Tailwind for the SDK.
|
|
16
|
+
|
|
17
|
+
It carries 9.2.0's thread work too: a coding CLI's permission request is answered from the
|
|
18
|
+
conversation: the thread draws the question and the host answers it through `onApprovalDecision`
|
|
19
|
+
(Gemies ADR 0043 §5).
|
|
20
|
+
|
|
21
|
+
### Peers
|
|
22
|
+
|
|
23
|
+
- **Breaking:** `@oxy.so/services` `>=15.0.0 <16`; Services 14 is no longer supported.
|
|
24
|
+
- **Breaking:** `@oxy.so/bloom` `>=23.0.0`.
|
|
25
|
+
- **Removed:** `nativewind` (optional) and `react-native-css`, and the `clsx` and `tailwind-merge`
|
|
26
|
+
dependencies.
|
|
27
|
+
- **Added:** `@oxy.so/bloom-data` `>=0.1.0` (Services 15 requires it too).
|
|
28
|
+
- **Removed:** `@tanstack/react-query`. An app that uses React Query itself declares it itself.
|
|
29
|
+
|
|
30
|
+
### The account's data (`@gemies/sdk/runtime`)
|
|
31
|
+
|
|
32
|
+
- **Records and lists:** `Conversations` (a conversation's row), `ConversationMessages` (its
|
|
33
|
+
messages, once it was read, with its row as a ref; `heldConversation(id)` joins the two),
|
|
34
|
+
`ConversationList` (one per filter, `conversationsKey(filter)`, `filterOfKey`), `ThreadMessages`,
|
|
35
|
+
`ThreadHistory`, `ThreadWindow`. They are copied to the account's durable copy where the app
|
|
36
|
+
persisted them before (conversations, their lists, the collections, an agent's profile, a
|
|
37
|
+
thread), with the bound the app's cache had: the messages of the
|
|
38
|
+
`MAX_PERSISTED_CONVERSATIONS` (20) conversations written last, each its last
|
|
39
|
+
`MAX_PERSISTED_MESSAGES` (40) finished messages, text only, at most `MAX_PERSISTED_BYTES`
|
|
40
|
+
(150 KB), never a turn still streaming or not yet stored (`trimConversationMessages`). Memory
|
|
41
|
+
keeps everything.
|
|
42
|
+
- **Sources** (each takes the provider's client first): `conversationList`, `conversation`,
|
|
43
|
+
`conversationCollections`, `agentProfile`, `agentFeatures`, `gemieThread`, `threadHistorySource`,
|
|
44
|
+
`threadWindow`, `threadSearch`, `sharedConversation`; `@gemies/sdk/accounts` adds
|
|
45
|
+
`connectedAccounts`, `connectedAccountQr`, `connectedAccountChats`; `@gemies/sdk/connectors`
|
|
46
|
+
adds `connections`, `connectorStore` (`ConnectorStoreList`, `ConnectorEntries`).
|
|
47
|
+
- **Actions** (optimistic: a change shows at once and comes back exactly as it was when the server
|
|
48
|
+
refuses): `markConversationRead`, `saveConversation`, `renameConversation`,
|
|
49
|
+
`deleteConversation`, `clearConversation`, `createConversation`, `createCollection`,
|
|
50
|
+
`updateCollection`, `deleteCollection`, `setCollectionMember`, `setConversationPinned`,
|
|
51
|
+
`setConversationFavorite`, `importCollections`, `shareConversation`,
|
|
52
|
+
`revokeConversationShare`; `updateAccount`, `grantAccount`, `removeAccount`, `connectAccount`;
|
|
53
|
+
`renameConnector`, `disconnectConnector`, `connectConnector`, `addCustomConnector`,
|
|
54
|
+
`reconnectConnector`, `completeConnectorSignIn`. None is durable: nothing the runtime writes
|
|
55
|
+
was replayed after a restart.
|
|
56
|
+
- **Helpers:** `useConversationsClient`, `useRefreshConversation`, `useRefreshGemieThread`,
|
|
57
|
+
`placeConversation`, `forgetConversation`, `messagesRecord`, `refreshConversationLists`, `storeCollections`, `answerSource`, `useAnswer`,
|
|
58
|
+
`gemieRead` (the read rules every source shares), `ACCOUNT`. An app keeps its own account
|
|
59
|
+
data the same way: `answerSource(type, { persist: { version } })` copies its answers to the
|
|
60
|
+
account's durable store and drops them when `version` changes.
|
|
61
|
+
- **Removed:** `gemieQueryKeys`, `connectorQueryKeys`, `reviveConversationDates`, the
|
|
62
|
+
`ConversationsPage` and `ConversationsInfiniteData` types, and `importCollections(api, local)`'s
|
|
63
|
+
plain function (it is the action of that name).
|
|
64
|
+
|
|
65
|
+
### Styles
|
|
66
|
+
|
|
67
|
+
- `IdentityMark` takes `style` in place of `className`; `GemieActivityLine` takes `style`, laid over
|
|
68
|
+
its own small primary line, in place of a `className` that replaced it.
|
|
69
|
+
- `cn` (the class-name merger) is gone with NativeWind.
|
|
70
|
+
- Classes that resolved to no style drew nothing and are gone. The connect-failure note, whose
|
|
71
|
+
`text-error-primary` class drew it in no colour, is drawn in Bloom's error role.
|
|
72
|
+
|
|
73
|
+
### Hooks
|
|
74
|
+
|
|
75
|
+
- **Breaking — reads return bloom-data views.** `useConversation`, `useAgentProfile`,
|
|
76
|
+
`useAgentFeatures`, `useGemieThread`, `useThreadSearch`, `useSharedConversation`,
|
|
77
|
+
`useConnections`, `useConnectedAccounts`, `useConnectedAccountQr` and
|
|
78
|
+
`useConnectedAccountChats` return a `RecordView` (`value`, was `data`; `refresh()`, was
|
|
79
|
+
`refetch()`; `status === 'error'`, was `isError`). `useConversations` returns a `ListView` with
|
|
80
|
+
its rows as `conversations` (was `data.pages[n].conversations`; `more()` was `fetchNextPage()`).
|
|
81
|
+
`useConnectorStore` returns `entries`, `total`, `categories`, `isLoading`, `isError`, `hasMore`,
|
|
82
|
+
`isLoadingMore`, `more` and `refresh`, and keeps the previous search's results on screen until a
|
|
83
|
+
new search answers.
|
|
84
|
+
- **Breaking — writes return `ActionView`** (`run`, `isPending`, `error`, `data`, `reset`; `run`
|
|
85
|
+
was `mutateAsync`, there is no `mutate`): `useSaveConversation`, `useDeleteConversation`,
|
|
86
|
+
`useClearConversation`, `useCreateConversation`, `useRenameConversation` (`run(id, title)`, was
|
|
87
|
+
`mutateAsync({ id, title })`), `useConnectedAccountMutations` (`update.run(accountId, patch)`,
|
|
88
|
+
`grant.run(accountId, gemieId, granted)`) and `useConnectorActions`
|
|
89
|
+
(`rename.run(id, accountLabel)`).
|
|
90
|
+
- `useConversation(id, { onReload })` hears a conversation rewritten on another device once it is
|
|
91
|
+
read again. A row the sidebar holds shows at once, without messages, while the conversation is
|
|
92
|
+
read.
|
|
93
|
+
- Every private read waits for `useOxy().canUsePrivateApi` (no more `isAccountCacheReady`, which
|
|
94
|
+
Services 15 removed); `useSharedConversation` needs no session.
|
|
95
|
+
- A realtime reset makes the lists, the conversations, the collections, the connected accounts
|
|
96
|
+
and the connections stale (`invalidateAll`): what is on screen is read again at once, the rest
|
|
97
|
+
when it is next shown, however fresh it was. A `connections` event does the same for the
|
|
98
|
+
connected accounts and the connections, and a message appended to a conversation for the threads.
|
|
99
|
+
|
|
100
|
+
### Records
|
|
101
|
+
|
|
102
|
+
- **Breaking:** `Conversation.createdAt` and `updatedAt` are ISO strings (a record is JSON, as the
|
|
103
|
+
durable copy keeps it), and `Conversation.messages` is optional: a list row or a realtime event
|
|
104
|
+
carries none, and leaves the held ones in place.
|
|
105
|
+
|
|
3
106
|
## 9.1.0
|
|
4
107
|
|
|
5
108
|
Conversation lists, search results and file/source rows now use Bloom's shared ListItem. Group
|
package/README.md
CHANGED
|
@@ -23,15 +23,18 @@ mapping is in [`CHANGELOG.md`](./CHANGELOG.md) under 1.0.0.
|
|
|
23
23
|
bun add @gemies/sdk
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
`react`, `react-native`, `@oxy.so/core`, `@oxy.so/services
|
|
27
|
-
(the conversation runtime's
|
|
28
|
-
|
|
26
|
+
`react`, `react-native`, `@oxy.so/core`, `@oxy.so/services` (15 or later), `@oxy.so/bloom-data`
|
|
27
|
+
(the conversation runtime's data lives in the signed-in account's store, the one `OxyProvider`
|
|
28
|
+
opens with the session, so an account switch never shows the previous account's) and the Expo
|
|
29
|
+
modules listed under `peerDependencies` in
|
|
29
30
|
`package.json` — among them `expo-clipboard` and `expo-web-browser`, which the thread's copy
|
|
30
31
|
button and its sources use — are yours to install. Metro
|
|
31
32
|
must resolve package `exports` (`resolver.unstable_enablePackageExports = true`,
|
|
32
33
|
the default in Expo SDK 53+), because every icon import is a subpath.
|
|
33
34
|
|
|
34
|
-
The chat is built from Bloom (`@oxy.so/bloom
|
|
35
|
+
The chat is built from Bloom (`@oxy.so/bloom` 23 or later, a peer dependency) and styled with
|
|
36
|
+
React Native styles over Bloom's tokens: the SDK needs no NativeWind, react-native-css or Tailwind,
|
|
37
|
+
and its components take `style`, never `className`. Mount Bloom's
|
|
35
38
|
`BloomProvider` above it, with the one `KeyboardProvider` your app already has.
|
|
36
39
|
The main and conversation sheets use Bloom's default content sizing: they grow and
|
|
37
40
|
shrink with the chat up to the shared viewport limit. Bloom coordinates the Screen
|
|
@@ -350,7 +353,7 @@ Everything that is a conversation lives in `src/runtime`, in layers that depend
|
|
|
350
353
|
| Layer | What | Public names |
|
|
351
354
|
| --- | --- | --- |
|
|
352
355
|
| Transport | Alia's REST API over the signed-in person's Oxy client (token, refresh and the single 401 replay are Oxy's); the turn's SSE stream | `useGemieApi`, `GemieApiError` |
|
|
353
|
-
| Model and state | the records
|
|
356
|
+
| Model and state | the records and their lists in the account's `@oxy.so/bloom-data` store (entities, sources and actions); zustand stores for the composer drafts and the hand-off of a first message | `Message`, `Conversation`, `Conversations`, `ConversationList`, `conversationList`, `conversationCollections`, `useComposerDraftStore`, `useConversationStore` |
|
|
354
357
|
| Hooks | `useConversations` (the list, paginated), `useConversation` (one, with its history), `useCreateConversation`, `useRenameConversation`, `useDeleteConversation`, `useClearConversation`, and `useConversationThread`: the live thread of one conversation — messages, `sendMessage`, `createNewConversation`, `editMessage`, `regenerateMessage`, `retryFailedTurn`, `stopGeneration`, `clearConversation`, `startOver`, `ensureConversation` | `use…` |
|
|
355
358
|
| UI | `GemieChatContent` (the conversation screen), `GemieChatScreen`, `GemieChatSheet`, `GemieThread`, `ThoughtPanel` | components |
|
|
356
359
|
|
|
@@ -448,7 +451,7 @@ The sheet and the Alia app differ ONLY in what they put there:
|
|
|
448
451
|
renderUsageLimit={({ error, dismiss }) => <UsageLimitDialog error={error} onDismiss={dismiss} />}
|
|
449
452
|
/>
|
|
450
453
|
function Sidebar() {
|
|
451
|
-
const {
|
|
454
|
+
const { conversations, more } = useConversations(); // the very list the thread keeps up to date
|
|
452
455
|
…
|
|
453
456
|
}
|
|
454
457
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gemies/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.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",
|
|
@@ -51,19 +51,17 @@
|
|
|
51
51
|
"check:entry-types": "node scripts/check-entry-types.mjs"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"clsx": "^2.1.1",
|
|
55
54
|
"socket.io-client": "^4.8.3",
|
|
56
|
-
"tailwind-merge": "^3.7.0",
|
|
57
55
|
"zustand": "^5.0.15"
|
|
58
56
|
},
|
|
59
57
|
"peerDependencies": {
|
|
60
58
|
"react": "^19.2.3",
|
|
61
59
|
"react-native": "^0.86.0 || ^0.88.0",
|
|
62
60
|
"@expo/vector-icons": "^15.1.1",
|
|
63
|
-
"@oxy.so/bloom": ">=
|
|
61
|
+
"@oxy.so/bloom": ">=23.0.0",
|
|
62
|
+
"@oxy.so/bloom-data": ">=0.1.0",
|
|
64
63
|
"@oxy.so/core": ">=7.1.0 <8",
|
|
65
|
-
"@oxy.so/services": ">=
|
|
66
|
-
"@tanstack/react-query": "^5.101",
|
|
64
|
+
"@oxy.so/services": ">=15.0.0 <16",
|
|
67
65
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
68
66
|
"expo-blur": "^57.0.0 || ^58.0.0",
|
|
69
67
|
"react-native-reanimated": "^4.5.0",
|
|
@@ -76,18 +74,13 @@
|
|
|
76
74
|
"expo-image-picker": "^57.0.2 || ^58.0.0",
|
|
77
75
|
"expo-document-picker": "^57.0.0 || ^58.0.0",
|
|
78
76
|
"expo-haptics": "^57.0.0 || ^58.0.0",
|
|
79
|
-
"nativewind": "^5.0.0-preview.3",
|
|
80
77
|
"expo-clipboard": "^57.0.0 || ^58.0.0",
|
|
81
78
|
"expo-file-system": "^57.0.0 || ^58.0.0",
|
|
82
79
|
"expo-web-browser": "^57.0.0 || ^58.0.0",
|
|
83
|
-
"react-native-css": "^3.0.7",
|
|
84
80
|
"react-native-audio-api": "^0.13.6",
|
|
85
81
|
"react-native-qrcode-svg": "^6.3.21"
|
|
86
82
|
},
|
|
87
83
|
"peerDependenciesMeta": {
|
|
88
|
-
"nativewind": {
|
|
89
|
-
"optional": true
|
|
90
|
-
},
|
|
91
84
|
"expo-clipboard": {
|
|
92
85
|
"optional": true
|
|
93
86
|
}
|
package/src/accounts.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="nativewind/types" />
|
|
2
1
|
/**
|
|
3
2
|
* The connected-accounts leaf entry (ADR 0035 as amended): the WhatsApp and Telegram accounts a
|
|
4
3
|
* person connects once and grants to their gemies. `GemieConnectedAccounts` is Settings ›
|
|
@@ -14,6 +13,13 @@ export {
|
|
|
14
13
|
GEMIE_ACCOUNT_PLATFORMS,
|
|
15
14
|
GEMIE_ACCOUNT_REPLIES,
|
|
16
15
|
GEMIE_ACCOUNT_STATUSES,
|
|
16
|
+
connectAccount,
|
|
17
|
+
connectedAccountChats,
|
|
18
|
+
connectedAccountQr,
|
|
19
|
+
connectedAccounts,
|
|
20
|
+
grantAccount,
|
|
21
|
+
removeAccount,
|
|
22
|
+
updateAccount,
|
|
17
23
|
useConnectedAccountChats,
|
|
18
24
|
useConnectedAccountMutations,
|
|
19
25
|
useConnectedAccountQr,
|
package/src/ask-eager.ts
CHANGED
package/src/ask-text.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="nativewind/types" />
|
|
2
1
|
// @gemies/sdk/ask/text — `@gemies/sdk/ask` without the voice call, and without bundling it
|
|
3
2
|
// The provider and its hook; the sheet loads with the first `ask`, and neither reaches the call's
|
|
4
3
|
// modules. `useAskGemie` is the same hook as `@gemies/sdk/ask`'s.
|
package/src/ask.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="nativewind/types" />
|
|
2
1
|
// @gemies/sdk/ask — the app's one Alia sheet, without the chat in the entry bundle
|
|
3
2
|
// `GemieAskProvider` and `useAskGemie` alone: the sheet they open is loaded with the first `ask`.
|
|
4
3
|
// An app mounts the provider at its root from here rather than from the root entry, which
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { memo, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AppState,
|
|
4
|
+
Platform,
|
|
5
|
+
View,
|
|
6
|
+
type LayoutChangeEvent,
|
|
7
|
+
type ViewStyle,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
import Animated, {
|
|
4
11
|
cancelAnimation,
|
|
5
12
|
Easing,
|
|
@@ -513,7 +520,7 @@ export const AmbientField = memo(function AmbientField({
|
|
|
513
520
|
|
|
514
521
|
return (
|
|
515
522
|
<View
|
|
516
|
-
|
|
523
|
+
style={styles.field}
|
|
517
524
|
pointerEvents="none"
|
|
518
525
|
// One prop for every platform: react-native-web writes `aria-hidden`, and
|
|
519
526
|
// React Native turns it into `accessibilityElementsHidden` (iOS) and
|
|
@@ -578,3 +585,7 @@ export const AmbientField = memo(function AmbientField({
|
|
|
578
585
|
});
|
|
579
586
|
|
|
580
587
|
export { PARALLAX_DURATION, PARALLAX_EASE };
|
|
588
|
+
|
|
589
|
+
const styles = StyleSheet.create({
|
|
590
|
+
field: { position: 'absolute', inset: 0 },
|
|
591
|
+
});
|
|
@@ -3,6 +3,7 @@ import { useLabels } from '../lib/labels';
|
|
|
3
3
|
import { Text } from '@oxy.so/bloom/typography';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Platform, View } from 'react-native';
|
|
6
|
+
import { createTokenStyles, tokenAlpha } from '@oxy.so/bloom/theme';
|
|
6
7
|
/**
|
|
7
8
|
* Dropping files onto the composer, on web, where such a gesture exists.
|
|
8
9
|
*
|
|
@@ -141,6 +142,7 @@ export function useComposerDropTarget({
|
|
|
141
142
|
* with people who do both.
|
|
142
143
|
*/
|
|
143
144
|
export function ComposerDropOverlay({ visible, enabled }: { visible: boolean; enabled: boolean }) {
|
|
145
|
+
const styles = useStyles();
|
|
144
146
|
const labels = useLabels();
|
|
145
147
|
if (!visible) return null;
|
|
146
148
|
return (
|
|
@@ -149,11 +151,9 @@ export function ComposerDropOverlay({ visible, enabled }: { visible: boolean; en
|
|
|
149
151
|
accessibilityRole="alert"
|
|
150
152
|
accessibilityLiveRegion="polite"
|
|
151
153
|
// 26: the corner Bloom's composer pill wears at one line and past it.
|
|
152
|
-
|
|
154
|
+
style={styles.dropZone}
|
|
153
155
|
>
|
|
154
|
-
<Text
|
|
155
|
-
{enabled ? labels.dropHint : labels.dropUnavailable}
|
|
156
|
-
</Text>
|
|
156
|
+
<Text style={styles.hint}>{enabled ? labels.dropHint : labels.dropUnavailable}</Text>
|
|
157
157
|
</View>
|
|
158
158
|
);
|
|
159
159
|
}
|
|
@@ -233,3 +233,19 @@ export function useComposerPasteTarget({
|
|
|
233
233
|
return () => document.removeEventListener('paste', onPaste);
|
|
234
234
|
}, [elementId]);
|
|
235
235
|
}
|
|
236
|
+
|
|
237
|
+
const useStyles = createTokenStyles((t) => ({
|
|
238
|
+
dropZone: {
|
|
239
|
+
position: 'absolute',
|
|
240
|
+
inset: 0,
|
|
241
|
+
zIndex: 20,
|
|
242
|
+
alignItems: 'center',
|
|
243
|
+
justifyContent: 'center',
|
|
244
|
+
borderRadius: 26,
|
|
245
|
+
borderStyle: 'dashed',
|
|
246
|
+
borderWidth: 2,
|
|
247
|
+
borderColor: t.primary,
|
|
248
|
+
backgroundColor: tokenAlpha(t.background, 0.9),
|
|
249
|
+
},
|
|
250
|
+
hint: { fontSize: 14, fontWeight: 500, color: t.foreground, lineHeight: 20 },
|
|
251
|
+
}));
|
|
@@ -3,6 +3,7 @@ import { Text } from '@oxy.so/bloom/typography';
|
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import type { Completion } from '../lib/suggestions';
|
|
5
5
|
import type { GemieSuggestion } from '../types';
|
|
6
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Suggestions over the composer, one line each, the typed part highlighted and the row the
|
|
@@ -17,9 +18,10 @@ export function ComposerSuggestions<T extends GemieSuggestion>({
|
|
|
17
18
|
selected: number;
|
|
18
19
|
onPick: (suggestion: T) => void;
|
|
19
20
|
}) {
|
|
21
|
+
const styles = useStyles();
|
|
20
22
|
if (completions.length === 0) return null;
|
|
21
23
|
return (
|
|
22
|
-
<View accessibilityRole="list"
|
|
24
|
+
<View accessibilityRole="list" style={styles.list}>
|
|
23
25
|
{completions.map(({ suggestion, matchStart, matchEnd }, index) => {
|
|
24
26
|
const { text } = suggestion;
|
|
25
27
|
return (
|
|
@@ -32,7 +34,7 @@ export function ComposerSuggestions<T extends GemieSuggestion>({
|
|
|
32
34
|
title={
|
|
33
35
|
<Text numberOfLines={1}>
|
|
34
36
|
{text.slice(0, matchStart)}
|
|
35
|
-
<Text
|
|
37
|
+
<Text style={styles.match}>{text.slice(matchStart, matchEnd)}</Text>
|
|
36
38
|
{text.slice(matchEnd)}
|
|
37
39
|
</Text>
|
|
38
40
|
}
|
|
@@ -42,3 +44,8 @@ export function ComposerSuggestions<T extends GemieSuggestion>({
|
|
|
42
44
|
</View>
|
|
43
45
|
);
|
|
44
46
|
}
|
|
47
|
+
|
|
48
|
+
const useStyles = createTokenStyles((t) => ({
|
|
49
|
+
list: { width: '100%', maxWidth: 768, alignSelf: 'center' },
|
|
50
|
+
match: { fontWeight: 500, color: t.primary },
|
|
51
|
+
}));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
1
2
|
import { memo } from 'react';
|
|
2
|
-
import { Text } from 'react-native';
|
|
3
|
+
import { type StyleProp, Text, type TextStyle } from 'react-native';
|
|
3
4
|
import { useConversationActivityText } from '../realtime/activity-text';
|
|
4
5
|
|
|
5
6
|
export { activityText, useConversationActivityText } from '../realtime/activity-text';
|
|
6
7
|
|
|
7
8
|
export interface GemieActivityLineProps {
|
|
8
9
|
conversationId: string | null | undefined;
|
|
9
|
-
/**
|
|
10
|
-
|
|
10
|
+
/** Laid over the line's own look: small text in the theme's primary. */
|
|
11
|
+
style?: StyleProp<TextStyle>;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -16,13 +17,18 @@ export interface GemieActivityLineProps {
|
|
|
16
17
|
*/
|
|
17
18
|
export const GemieActivityLine = memo(function GemieActivityLine({
|
|
18
19
|
conversationId,
|
|
19
|
-
|
|
20
|
+
style,
|
|
20
21
|
}: GemieActivityLineProps) {
|
|
22
|
+
const styles = useStyles();
|
|
21
23
|
const text = useConversationActivityText(conversationId);
|
|
22
24
|
if (!text) return null;
|
|
23
25
|
return (
|
|
24
|
-
<Text
|
|
26
|
+
<Text style={[styles.line, style]} numberOfLines={1} accessibilityLiveRegion="polite">
|
|
25
27
|
{text}
|
|
26
28
|
</Text>
|
|
27
29
|
);
|
|
28
30
|
});
|
|
31
|
+
|
|
32
|
+
const useStyles = createTokenStyles((t) => ({
|
|
33
|
+
line: { fontSize: 12, lineHeight: 16, color: t.primary },
|
|
34
|
+
}));
|
|
@@ -15,6 +15,7 @@ import type { Message } from '../runtime/types';
|
|
|
15
15
|
import { useRoomEvents } from '../runtime/use-room-events';
|
|
16
16
|
import { GemieParticipants } from './GemieParticipants';
|
|
17
17
|
import { GemieThread } from './thread/GemieThread';
|
|
18
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
18
19
|
|
|
19
20
|
export interface GemieBetweenGemiesProps {
|
|
20
21
|
/** A conversation between gemies (`kind: 'gemies'`, ADR 0042). */
|
|
@@ -53,20 +54,22 @@ export function GemieBetweenGemies(props: GemieBetweenGemiesProps) {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
function ConversationBetweenGemies({ conversationId, onBack }: GemieBetweenGemiesProps) {
|
|
57
|
+
const styles = useStyles();
|
|
56
58
|
const { t, back } = useLabels();
|
|
57
59
|
const threadRef = useRef<AiChatThreadHandle | null>(null);
|
|
58
|
-
const { data,
|
|
60
|
+
const { value: data, isLoading, isFetching, refresh } = useConversation(conversationId);
|
|
59
61
|
const [messages, setMessages] = useState<Message[]>([]);
|
|
60
62
|
// Which live reply each room event draws, for as long as this conversation is open.
|
|
61
63
|
const [ledger] = useState(createRoomLedger);
|
|
62
64
|
|
|
63
65
|
// Opened, it is read fresh: the gemies may have said more since it was last loaded.
|
|
64
66
|
useEffect(() => {
|
|
65
|
-
void
|
|
66
|
-
}, [
|
|
67
|
+
void refresh();
|
|
68
|
+
}, [refresh]);
|
|
69
|
+
const read = data?.messages;
|
|
67
70
|
useEffect(() => {
|
|
68
|
-
if (
|
|
69
|
-
}, [
|
|
71
|
+
if (read) setMessages(read);
|
|
72
|
+
}, [read]);
|
|
70
73
|
useRoomEvents(conversationId, ledger, setMessages);
|
|
71
74
|
|
|
72
75
|
const participants = useMemo<GemieChatParticipants | null>(() => {
|
|
@@ -77,7 +80,7 @@ function ConversationBetweenGemies({ conversationId, onBack }: GemieBetweenGemie
|
|
|
77
80
|
}, [data?.members, messages]);
|
|
78
81
|
|
|
79
82
|
return (
|
|
80
|
-
<View
|
|
83
|
+
<View style={styles.screen} testID="gemie-conversation">
|
|
81
84
|
<PageHeader
|
|
82
85
|
leading={
|
|
83
86
|
<Button.Group accessibilityLabel={back}>
|
|
@@ -95,16 +98,14 @@ function ConversationBetweenGemies({ conversationId, onBack }: GemieBetweenGemie
|
|
|
95
98
|
sticky={false}
|
|
96
99
|
safeArea={false}
|
|
97
100
|
/>
|
|
98
|
-
<Text
|
|
99
|
-
{t('chat.betweenGemiesNotice')}
|
|
100
|
-
</Text>
|
|
101
|
+
<Text style={styles.footnote}>{t('chat.betweenGemiesNotice')}</Text>
|
|
101
102
|
<AgentAvatarProvider>
|
|
102
103
|
<BubblesProvider value>
|
|
103
104
|
<GemieThread
|
|
104
105
|
messages={messages}
|
|
105
106
|
conversationId={conversationId}
|
|
106
107
|
isLoading={false}
|
|
107
|
-
conversationLoading={
|
|
108
|
+
conversationLoading={isLoading || (isFetching && read === undefined)}
|
|
108
109
|
threadRef={threadRef}
|
|
109
110
|
readOnly
|
|
110
111
|
/>
|
|
@@ -113,3 +114,15 @@ function ConversationBetweenGemies({ conversationId, onBack }: GemieBetweenGemie
|
|
|
113
114
|
</View>
|
|
114
115
|
);
|
|
115
116
|
}
|
|
117
|
+
|
|
118
|
+
const useStyles = createTokenStyles((t) => ({
|
|
119
|
+
screen: { flexGrow: 1, flexShrink: 1, flexBasis: '0%', backgroundColor: t.background },
|
|
120
|
+
footnote: {
|
|
121
|
+
paddingHorizontal: 16,
|
|
122
|
+
paddingBottom: 8,
|
|
123
|
+
textAlign: 'center',
|
|
124
|
+
fontSize: 12,
|
|
125
|
+
color: t.mutedForeground,
|
|
126
|
+
lineHeight: 16,
|
|
127
|
+
},
|
|
128
|
+
}));
|
|
@@ -30,7 +30,6 @@ import { ScrollToBottomButton } from '@oxy.so/bloom/chat-screen';
|
|
|
30
30
|
import { RiEditLine } from '@oxy.so/bloom/icons/RiEditLine';
|
|
31
31
|
import { toast } from '@oxy.so/bloom/toast';
|
|
32
32
|
import { Text } from '@oxy.so/bloom/typography';
|
|
33
|
-
import { useQueryClient } from '@tanstack/react-query';
|
|
34
33
|
import {
|
|
35
34
|
type ReactNode,
|
|
36
35
|
useCallback,
|
|
@@ -68,8 +67,8 @@ import { GEMIE_FEATURES, featureOffer, useAgentFeatures, useAgentProfile } from
|
|
|
68
67
|
import { type GemieRuntimeHost, GemieRuntimeProvider, useGemieRuntime } from '../runtime/config';
|
|
69
68
|
import { type GemieHostTools, APP_SLUG } from '../runtime/host-tools';
|
|
70
69
|
import { useCreateConversation } from '../runtime/conversations';
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
70
|
+
import { useRefreshGemieThread } from '../runtime/use-gemie-thread';
|
|
71
|
+
import type { GemieThreadAddress } from '../runtime/routes';
|
|
73
72
|
import type { Message } from '../runtime/types';
|
|
74
73
|
import { useAgentActivity } from '../runtime/use-agent-activity';
|
|
75
74
|
import { useConversationThread } from '../runtime/use-conversation-thread';
|
|
@@ -86,6 +85,7 @@ import { GemieThread } from './thread/GemieThread';
|
|
|
86
85
|
import { ThreadSearch } from './thread/ThreadSearch';
|
|
87
86
|
import { VoiceModeIcon } from './VoiceModeIcon';
|
|
88
87
|
import { VoiceCallContext } from './voice/VoiceCallContext';
|
|
88
|
+
import { createTokenStyles } from '@oxy.so/bloom/theme';
|
|
89
89
|
|
|
90
90
|
/** The agent a chat is opened on: its lead instead of Alia. */
|
|
91
91
|
export interface GemieChatAgentRef {
|
|
@@ -358,22 +358,22 @@ function GemieConversationView({
|
|
|
358
358
|
onStopReady,
|
|
359
359
|
onDetachReady,
|
|
360
360
|
}: ConversationViewProps) {
|
|
361
|
+
const styles = useStyles();
|
|
361
362
|
const ownFlights = useAvatarFlights();
|
|
362
363
|
const flights = sharedFlights ?? ownFlights;
|
|
363
364
|
const labels = useLabels();
|
|
364
365
|
const { t } = labels;
|
|
365
366
|
const runtime = useGemieRuntime();
|
|
366
|
-
const queryClient = useQueryClient();
|
|
367
367
|
const { user, isAuthenticated } = useOxy();
|
|
368
368
|
const agentId = agent?.id;
|
|
369
369
|
|
|
370
370
|
// ── Who leads: the agent the chat was opened on, or Alia ──
|
|
371
|
-
const {
|
|
371
|
+
const { value: profile, isLoading: profileLoading } = useAgentProfile(agentId);
|
|
372
372
|
const lead = useMemo(
|
|
373
373
|
() => (group === undefined ? leadOf(profile) : groupParticipants(group).lead),
|
|
374
374
|
[group, profile],
|
|
375
375
|
);
|
|
376
|
-
const {
|
|
376
|
+
const { value: features } = useAgentFeatures(agentId);
|
|
377
377
|
|
|
378
378
|
// A failure reaches the host's handler when it has one, and Bloom's toast otherwise.
|
|
379
379
|
const reportError = useCallback(
|
|
@@ -581,7 +581,7 @@ function GemieConversationView({
|
|
|
581
581
|
const welcome = useMemo(
|
|
582
582
|
() =>
|
|
583
583
|
profileLoading ? null : (
|
|
584
|
-
<View
|
|
584
|
+
<View style={styles.welcome}>
|
|
585
585
|
{group === undefined ? (
|
|
586
586
|
<GemieWelcomeMessage greeting={greeting} subtitle={welcomeSubtitle} lead={lead} />
|
|
587
587
|
) : (
|
|
@@ -590,11 +590,12 @@ function GemieConversationView({
|
|
|
590
590
|
{welcomeAccessory}
|
|
591
591
|
</View>
|
|
592
592
|
),
|
|
593
|
-
[profileLoading, greeting, welcomeSubtitle, lead, group, welcomeAccessory],
|
|
593
|
+
[profileLoading, greeting, welcomeSubtitle, lead, group, welcomeAccessory, styles],
|
|
594
594
|
);
|
|
595
595
|
|
|
596
596
|
// ── The agent's offer to start the next stretch fresh ──
|
|
597
|
-
const createConversation = useCreateConversation();
|
|
597
|
+
const { run: createConversation } = useCreateConversation();
|
|
598
|
+
const refreshThread = useRefreshGemieThread();
|
|
598
599
|
/**
|
|
599
600
|
* Take the agent up on its offer: start the next stretch of this thread.
|
|
600
601
|
*
|
|
@@ -616,21 +617,17 @@ function GemieConversationView({
|
|
|
616
617
|
void startOver();
|
|
617
618
|
return;
|
|
618
619
|
}
|
|
619
|
-
|
|
620
|
-
createConversation.
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
// one is active, and the pages held were fetched before its last turns existed.
|
|
625
|
-
void queryClient.invalidateQueries({ queryKey: gemieQueryKeys.threads.messages(key) });
|
|
626
|
-
},
|
|
627
|
-
});
|
|
620
|
+
// Created, the thread is read again and moves onto it; a refusal was already told.
|
|
621
|
+
createConversation(next).then(
|
|
622
|
+
() => refreshThread(threadAddress),
|
|
623
|
+
() => undefined,
|
|
624
|
+
);
|
|
628
625
|
}, [
|
|
629
626
|
agentId,
|
|
630
627
|
threadAddress,
|
|
631
628
|
threadRowId,
|
|
632
629
|
createConversation,
|
|
633
|
-
|
|
630
|
+
refreshThread,
|
|
634
631
|
dismissSuggestedNewConversation,
|
|
635
632
|
startOver,
|
|
636
633
|
]);
|
|
@@ -707,9 +704,9 @@ function GemieConversationView({
|
|
|
707
704
|
// What is happening while a question is rewritten, and the way out of it. Drawn as the
|
|
708
705
|
// status tab it replaces: the thread scrolls behind the composer, and a strip without the
|
|
709
706
|
// tab's surface printed its words over the transcript's.
|
|
710
|
-
<View
|
|
707
|
+
<View style={styles.editingBar}>
|
|
711
708
|
<RiEditLine size="sm" />
|
|
712
|
-
<Text
|
|
709
|
+
<Text style={styles.editingLabel} numberOfLines={1}>
|
|
713
710
|
{t('composer.editingMessage')}
|
|
714
711
|
</Text>
|
|
715
712
|
<Button appearance="subtle" tone="accent" size="xs" onPress={edit.cancel}>
|
|
@@ -830,7 +827,7 @@ function GemieConversationView({
|
|
|
830
827
|
</GemieConversationOpenerProvider>
|
|
831
828
|
</BubblesProvider>
|
|
832
829
|
{!showsPast ? null : (
|
|
833
|
-
<View
|
|
830
|
+
<View style={styles.backToLatest} pointerEvents="box-none">
|
|
834
831
|
<Button appearance="outline" tone="neutral" size="sm" onPress={view.backToLatest}>
|
|
835
832
|
{t('chat.backToLatest')}
|
|
836
833
|
</Button>
|
|
@@ -842,7 +839,7 @@ function GemieConversationView({
|
|
|
842
839
|
</AiChatContainer>
|
|
843
840
|
</InertWhen>
|
|
844
841
|
{betweenGemies === null ? null : (
|
|
845
|
-
<View
|
|
842
|
+
<View style={styles.betweenGemies}>
|
|
846
843
|
<GemieBetweenGemies conversationId={betweenGemies} onBack={closeBetweenGemies} />
|
|
847
844
|
</View>
|
|
848
845
|
)}
|
|
@@ -915,3 +912,29 @@ export function GemieChatContent({
|
|
|
915
912
|
</GemieChatLabelsProvider>
|
|
916
913
|
);
|
|
917
914
|
}
|
|
915
|
+
|
|
916
|
+
const useStyles = createTokenStyles((t) => ({
|
|
917
|
+
welcome: { alignItems: 'center', gap: 32 },
|
|
918
|
+
editingBar: {
|
|
919
|
+
marginHorizontal: 28,
|
|
920
|
+
height: 34,
|
|
921
|
+
flexDirection: 'row',
|
|
922
|
+
alignItems: 'center',
|
|
923
|
+
gap: 8,
|
|
924
|
+
borderTopLeftRadius: 16,
|
|
925
|
+
borderTopRightRadius: 16,
|
|
926
|
+
backgroundColor: t.popover,
|
|
927
|
+
paddingHorizontal: 8,
|
|
928
|
+
paddingVertical: 4,
|
|
929
|
+
},
|
|
930
|
+
editingLabel: {
|
|
931
|
+
flexGrow: 1,
|
|
932
|
+
flexShrink: 1,
|
|
933
|
+
flexBasis: '0%',
|
|
934
|
+
fontSize: 12,
|
|
935
|
+
color: t.mutedForeground,
|
|
936
|
+
lineHeight: 16,
|
|
937
|
+
},
|
|
938
|
+
backToLatest: { position: 'absolute', insetInline: 0, top: 64, zIndex: 10, alignItems: 'center' },
|
|
939
|
+
betweenGemies: { position: 'absolute', inset: 0, zIndex: 20 },
|
|
940
|
+
}));
|