@gemies/sdk 4.1.0 → 6.0.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/CHANGELOG.md +43 -0
- package/README.md +19 -0
- package/package.json +2 -1
- package/src/components/GemieActivityLine.tsx +28 -0
- package/src/components/GemieChatContent.tsx +5 -2
- package/src/components/GemieParticipants.tsx +4 -0
- package/src/components/connectors/GemieConnectorsStore.tsx +208 -78
- package/src/connectors.ts +14 -5
- package/src/hooks/useGemieActivity.ts +28 -23
- package/src/hooks/useMessageReactions.ts +10 -15
- package/src/index.ts +6 -0
- package/src/lib/activity-store.ts +6 -16
- package/src/lib/copy-en.ts +28 -1
- package/src/lib/copy-es.ts +28 -1
- package/src/lib/labels-es.ts +10 -0
- package/src/lib/labels.tsx +11 -0
- package/src/lib/participants.ts +5 -0
- package/src/realtime/activity-text.ts +23 -0
- package/src/realtime/activity.ts +96 -0
- package/src/realtime/cache.ts +244 -0
- package/src/realtime/connection.ts +317 -0
- package/src/realtime/contract.ts +148 -0
- package/src/realtime/index.ts +33 -0
- package/src/realtime/react.tsx +196 -0
- package/src/runtime/config.tsx +8 -26
- package/src/runtime/connectors.ts +101 -17
- package/src/runtime/conversations.ts +55 -3
- package/src/runtime/index.ts +8 -0
- package/src/runtime/routes.ts +2 -0
- package/src/runtime/types.ts +5 -0
- package/src/runtime/use-agent-activity.ts +18 -45
- package/src/runtime/use-conversation-stream.ts +7 -2
- package/src/runtime/use-conversation-thread.ts +61 -26
- package/src/runtime/use-room-events.ts +10 -9
- package/src/lib/activity-socket.ts +0 -137
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @gemies/sdk
|
|
2
2
|
|
|
3
|
+
## 6.0.0
|
|
4
|
+
|
|
5
|
+
- **Breaking: realtime over one socket ([Realtime](../../docs/realtime.mdx), Gemies ADR 0040).**
|
|
6
|
+
`GemieRuntimeProvider` holds the signed-in account's one Socket.IO connection (new entry
|
|
7
|
+
`@gemies/sdk/realtime`): reconnect with backoff, catch-up from the account's event cursor after a
|
|
8
|
+
reconnect (`rt:sync`), topics re-subscribed, every event applied once and in order.
|
|
9
|
+
- The runtime keeps itself live from it: conversation lists (a new message moves its row to the
|
|
10
|
+
top with its preview and `unreadCount`), an open conversation's messages (merged by id, never
|
|
11
|
+
doubled; a rewritten thread is read again), reactions, group rooms and an agent run's panel.
|
|
12
|
+
No list or detail is refetched after a turn any more.
|
|
13
|
+
- `GemieRuntimeHost` loses `subscribeConversationMessages`, `subscribeConversationReactions`
|
|
14
|
+
and `subscribeRoomEvents`: the SDK owns the connection.
|
|
15
|
+
- "Typing…": `GemieParticipants` shows what a gemie is doing in place of its name;
|
|
16
|
+
`GemieActivityLine`, `useConversationActivityText` and `useConversationActivity` draw it
|
|
17
|
+
anywhere. `useGemieActivity` hears the account's activity on the same connection (the
|
|
18
|
+
separate activity socket is gone, and so is `acquireActivitySocket`).
|
|
19
|
+
- `useAgentActivity` follows the run's topic on the shared connection instead of opening a
|
|
20
|
+
socket per run.
|
|
21
|
+
- Unread: `Conversation.unreadCount`; `useMarkConversationRead`, sent by an open conversation
|
|
22
|
+
when something arrives while it is in front.
|
|
23
|
+
- Hooks for a host's own data: `useGemieRealtime`, `useRealtimeEvent`, `useRealtimeReset`,
|
|
24
|
+
`useRealtimeTopic`.
|
|
25
|
+
- Copy: `activity(name, state)` in `GemieChatLabels` (English and Spanish).
|
|
26
|
+
|
|
27
|
+
## 5.0.0
|
|
28
|
+
|
|
29
|
+
- **The connectors store grows to hundreds of servers.** Beside the providers' servers Gemies curates,
|
|
30
|
+
the store lists the remote MCP servers synced from the official MCP Registry once their health check
|
|
31
|
+
passed (Gemies API, `lib/connector-catalogue/`). `GemieConnectorsStore` searches, filters and sorts
|
|
32
|
+
on the API and pages through the results (Show more): categories with their counts, the Official,
|
|
33
|
+
Verified and No sign-in filters, and Featured, Name or Recently updated. Each card carries its badge
|
|
34
|
+
(`official`, `verified`, `community`) and says when it connects without a sign-in.
|
|
35
|
+
- **Breaking:** `useConnectorCatalogue` is replaced by `useConnectorStore(query)`, an infinite query of
|
|
36
|
+
`GET /mcp/registry` pages (`ConnectorStorePage`: `servers`, `total`, `nextOffset`, `categories`).
|
|
37
|
+
`ConnectorEntry` gains `trust`, `source`, `signIn` and `toolCount`, and its `docsUrl` may be `null`.
|
|
38
|
+
`CONNECTOR_CATEGORIES` gains `design`, `finance`, `marketing`, `commerce`, `search` and `other`;
|
|
39
|
+
`CONNECTOR_TRUST`, `CONNECTOR_SORTS`, `CONNECTOR_STORE_PAGE_SIZE` and `connectorStoreParams` are new.
|
|
40
|
+
- `useConnectorActions().connect` resolves with the connection at once for a server that needs no
|
|
41
|
+
sign-in (`POST /mcp/connect` answers `{ server }`), and opens the provider's sign-in otherwise.
|
|
42
|
+
- New copy: `gemie.connectors.trust.*`, `gemie.connectors.category.{design,finance,marketing,commerce,search,other}`,
|
|
43
|
+
`gemie.connectors.store.{allCount,results,more,filters,filter.*,sort,sortBy.*}`; the store's
|
|
44
|
+
description says where its servers come from.
|
|
45
|
+
|
|
3
46
|
## 4.1.0
|
|
4
47
|
|
|
5
48
|
- **The group welcome no longer links Bloom's whole multi-agent template.** `GemieGroupWelcome`
|
package/README.md
CHANGED
|
@@ -359,6 +359,25 @@ transcript in the thread), `useThreadView` (the present or a moment of an agent'
|
|
|
359
359
|
An agent's thread and runs (`useThreadHistory`, `useThreadSearch`, `useThreadWindow`,
|
|
360
360
|
`useAgentActivity`) read the agent routes through the same API and cache.
|
|
361
361
|
|
|
362
|
+
### Realtime: one socket, kept by the provider
|
|
363
|
+
|
|
364
|
+
`GemieRuntimeProvider` holds the signed-in account's ONE Socket.IO connection to `apiUrl`
|
|
365
|
+
(`@gemies/sdk/realtime`, [Realtime](../../docs/realtime.mdx)). It keeps the runtime live by itself:
|
|
366
|
+
the conversation lists (a new message moves its row to the top with its unread count), an open
|
|
367
|
+
conversation's messages (merged by id, so nothing is doubled), reactions, group rooms, an agent
|
|
368
|
+
run's panel and "Pepe is typing…" (`GemieParticipants`, `GemieActivityLine`,
|
|
369
|
+
`useConversationActivity`). After a reconnect it catches up from its cursor; nothing polls.
|
|
370
|
+
|
|
371
|
+
A host listens for what is its own on the same connection:
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
import { useRealtimeEvent, useRealtimeReset } from '@gemies/sdk/runtime';
|
|
375
|
+
|
|
376
|
+
useRealtimeEvent('credits', (frame) => setBalance(frame.data.credits));
|
|
377
|
+
useRealtimeEvent('notification', () => refetchNotifications());
|
|
378
|
+
useRealtimeReset(() => refetchEverythingYouShow()); // too far behind to catch up
|
|
379
|
+
```
|
|
380
|
+
|
|
362
381
|
A turn goes to `POST {apiUrl}/v1/chat/completions`; conversations to `{apiUrl}/v1/conversations`.
|
|
363
382
|
`apiUrl` defaults to `EXPO_PUBLIC_GEMIES_API_URL`, then `https://api.gemies.ai`. A failure to
|
|
364
383
|
answer is a typed error that keeps the person's turn in the thread with a retry (`FailedTurn`),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gemies/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
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",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"./csp": "./src/csp.ts",
|
|
20
20
|
"./dictation": "./src/dictation.ts",
|
|
21
21
|
"./model": "./src/runtime/model.ts",
|
|
22
|
+
"./realtime": "./src/realtime/index.ts",
|
|
22
23
|
"./runtime": "./src/runtime/index.ts",
|
|
23
24
|
"./text": "./src/text.ts",
|
|
24
25
|
"./tools": "./src/tools.ts",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { useConversationActivityText } from '../realtime/activity-text';
|
|
4
|
+
|
|
5
|
+
export { activityText, useConversationActivityText } from '../realtime/activity-text';
|
|
6
|
+
|
|
7
|
+
export interface GemieActivityLineProps {
|
|
8
|
+
conversationId: string | null | undefined;
|
|
9
|
+
/** Classes for the line (NativeWind); a small muted line by default. */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* WhatsApp's line under a chat's name: "Pepe is typing…", "Alia is thinking…", live from the
|
|
15
|
+
* account's realtime connection. Draws nothing while nobody is doing anything.
|
|
16
|
+
*/
|
|
17
|
+
export const GemieActivityLine = memo(function GemieActivityLine({
|
|
18
|
+
conversationId,
|
|
19
|
+
className = 'text-xs text-primary',
|
|
20
|
+
}: GemieActivityLineProps) {
|
|
21
|
+
const text = useConversationActivityText(conversationId);
|
|
22
|
+
if (!text) return null;
|
|
23
|
+
return (
|
|
24
|
+
<Text className={className} numberOfLines={1} accessibilityLiveRegion="polite">
|
|
25
|
+
{text}
|
|
26
|
+
</Text>
|
|
27
|
+
);
|
|
28
|
+
});
|
|
@@ -420,8 +420,11 @@ function GemieConversationView({
|
|
|
420
420
|
[agentId, group],
|
|
421
421
|
);
|
|
422
422
|
const participants = useMemo(
|
|
423
|
-
() => (
|
|
424
|
-
|
|
423
|
+
() => ({
|
|
424
|
+
...(group === undefined ? consulted : groupParticipants(group)),
|
|
425
|
+
...(conversationId === undefined ? {} : { conversationId }),
|
|
426
|
+
}),
|
|
427
|
+
[group, consulted, conversationId],
|
|
425
428
|
);
|
|
426
429
|
const asked = usePendingQuestions(messages, isLoading);
|
|
427
430
|
const gemieId = gemieThread?.gemieId;
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
consultedAgents,
|
|
33
33
|
} from '../lib/participants';
|
|
34
34
|
import type { Message } from '../runtime/types';
|
|
35
|
+
import { useConversationActivityText } from '../realtime/activity-text';
|
|
35
36
|
|
|
36
37
|
export interface UseParticipantsOptions {
|
|
37
38
|
lead: GemieLead;
|
|
@@ -113,6 +114,8 @@ export const GemieParticipants = memo(function GemieParticipants({
|
|
|
113
114
|
onPress,
|
|
114
115
|
}: GemieParticipantsProps) {
|
|
115
116
|
const flights = useGemieFlights();
|
|
117
|
+
// WhatsApp's header: the names give way to what one of them is doing, while they do it.
|
|
118
|
+
const activity = useConversationActivityText(participants.conversationId);
|
|
116
119
|
const agents = useMemo(
|
|
117
120
|
() =>
|
|
118
121
|
[participants.lead, ...participants.joined].map((agent) => ({
|
|
@@ -125,6 +128,7 @@ export const GemieParticipants = memo(function GemieParticipants({
|
|
|
125
128
|
return (
|
|
126
129
|
<AgentProfile
|
|
127
130
|
agents={agents}
|
|
131
|
+
{...(activity === null ? {} : { label: activity })}
|
|
128
132
|
onPress={onPress ?? noop}
|
|
129
133
|
avatarRef={flights?.anchor(ANCHORS.profile)}
|
|
130
134
|
avatarHidden={flights?.isLanding(ANCHORS.profile)}
|
|
@@ -4,26 +4,42 @@ import {
|
|
|
4
4
|
AccordionItem,
|
|
5
5
|
AccordionTrigger,
|
|
6
6
|
} from '@oxy.so/bloom/accordion';
|
|
7
|
+
import { Badge } from '@oxy.so/bloom/badge';
|
|
7
8
|
import { Button } from '@oxy.so/bloom/button';
|
|
8
9
|
import { Chip, ChipRow } from '@oxy.so/bloom/chip';
|
|
9
10
|
import { Dialog } from '@oxy.so/bloom/dialog';
|
|
10
11
|
import { RiAddLine } from '@oxy.so/bloom/icons/RiAddLine';
|
|
12
|
+
import { RiLockUnlockLine } from '@oxy.so/bloom/icons/RiLockUnlockLine';
|
|
13
|
+
import { RiShieldCheckFill } from '@oxy.so/bloom/icons/RiShieldCheckFill';
|
|
14
|
+
import { RiShieldCheckLine } from '@oxy.so/bloom/icons/RiShieldCheckLine';
|
|
15
|
+
import { RiUserCommunityLine } from '@oxy.so/bloom/icons/RiUserCommunityLine';
|
|
11
16
|
import { Search } from '@oxy.so/bloom/search';
|
|
17
|
+
import {
|
|
18
|
+
Select,
|
|
19
|
+
SelectContent,
|
|
20
|
+
SelectIcon,
|
|
21
|
+
SelectItem,
|
|
22
|
+
SelectItemText,
|
|
23
|
+
SelectTrigger,
|
|
24
|
+
SelectValue,
|
|
25
|
+
} from '@oxy.so/bloom/select';
|
|
12
26
|
import * as Skeleton from '@oxy.so/bloom/skeleton';
|
|
13
27
|
import { TextFieldInput, TextFieldLabel } from '@oxy.so/bloom/text-field';
|
|
14
28
|
import { toast } from '@oxy.so/bloom/toast';
|
|
15
29
|
import { Text } from '@oxy.so/bloom/typography';
|
|
16
30
|
import * as WebBrowser from 'expo-web-browser';
|
|
17
|
-
import { useMemo, useState } from 'react';
|
|
31
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
18
32
|
import { Pressable, View } from 'react-native';
|
|
19
33
|
import { englishCopy, type Translate } from '../../lib/copy';
|
|
20
34
|
import {
|
|
21
|
-
|
|
35
|
+
CONNECTOR_SORTS,
|
|
22
36
|
type ConnectorCategory,
|
|
23
37
|
type ConnectorEntry,
|
|
38
|
+
type ConnectorSort,
|
|
39
|
+
type ConnectorTrust,
|
|
24
40
|
useConnections,
|
|
25
41
|
useConnectorActions,
|
|
26
|
-
|
|
42
|
+
useConnectorStore,
|
|
27
43
|
connectorReturnTo,
|
|
28
44
|
signInErrorKey,
|
|
29
45
|
useWebSignInReturn,
|
|
@@ -33,6 +49,9 @@ import { ConnectorLogo } from './ConnectorLogo';
|
|
|
33
49
|
/** This component's own strings. */
|
|
34
50
|
const K = 'gemie.connectors';
|
|
35
51
|
|
|
52
|
+
/** How long typing settles before the store is searched. */
|
|
53
|
+
const SEARCH_DEBOUNCE_MS = 250;
|
|
54
|
+
|
|
36
55
|
export interface GemieConnectorsStoreProps {
|
|
37
56
|
/**
|
|
38
57
|
* The native app's URL scheme (`gemies`, `alia`): a provider's sign-in returns to the store at
|
|
@@ -45,18 +64,56 @@ export interface GemieConnectorsStoreProps {
|
|
|
45
64
|
onConnected?: () => void;
|
|
46
65
|
}
|
|
47
66
|
|
|
67
|
+
const TRUST_ICON = {
|
|
68
|
+
official: RiShieldCheckFill,
|
|
69
|
+
verified: RiShieldCheckLine,
|
|
70
|
+
community: RiUserCommunityLine,
|
|
71
|
+
} as const;
|
|
72
|
+
const TRUST_COLOR = { official: 'primary', verified: 'info', community: 'default' } as const;
|
|
73
|
+
|
|
74
|
+
/** The filters a person can turn on, each a chip. */
|
|
75
|
+
const FILTERS = ['official', 'verified', 'noSignIn'] as const;
|
|
76
|
+
type StoreFilter = (typeof FILTERS)[number];
|
|
77
|
+
|
|
78
|
+
/** The value of `text` once it stopped changing for `ms`. */
|
|
79
|
+
function useSettled(text: string, ms: number): string {
|
|
80
|
+
const [settled, setSettled] = useState(text);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const timer = setTimeout(() => setSettled(text), ms);
|
|
83
|
+
return () => clearTimeout(timer);
|
|
84
|
+
}, [text, ms]);
|
|
85
|
+
return settled;
|
|
86
|
+
}
|
|
87
|
+
|
|
48
88
|
/**
|
|
49
|
-
* The connectors store: every
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
89
|
+
* The connectors store: every remote MCP server this deployment can connect — the providers'
|
|
90
|
+
* servers Gemies curates and the hundreds synced from the official MCP Registry — searched,
|
|
91
|
+
* filtered by category, badge and sign-in, sorted and paged by the API. Each shows its real logo,
|
|
92
|
+
* its badge (official, verified, community), what it does and a Connect button; connecting again
|
|
93
|
+
* adds another account. A person can also add their own MCP server by URL. What the person
|
|
94
|
+
* connected is managed in Settings (`GemieConnectedConnectors`), not here.
|
|
53
95
|
*/
|
|
54
96
|
export function GemieConnectorsStore({
|
|
55
97
|
nativeScheme,
|
|
56
98
|
t = englishCopy,
|
|
57
99
|
onConnected,
|
|
58
100
|
}: GemieConnectorsStoreProps) {
|
|
59
|
-
const
|
|
101
|
+
const [query, setQuery] = useState('');
|
|
102
|
+
const [category, setCategory] = useState<ConnectorCategory | null>(null);
|
|
103
|
+
const [filters, setFilters] = useState<ReadonlySet<StoreFilter>>(new Set());
|
|
104
|
+
const [sort, setSort] = useState<ConnectorSort>('featured');
|
|
105
|
+
const [pending, setPending] = useState<string | null>(null);
|
|
106
|
+
const [customOpen, setCustomOpen] = useState(false);
|
|
107
|
+
const q = useSettled(query.trim(), SEARCH_DEBOUNCE_MS);
|
|
108
|
+
|
|
109
|
+
const trust = (['official', 'verified'] as const).filter((badge) => filters.has(badge));
|
|
110
|
+
const store = useConnectorStore({
|
|
111
|
+
q,
|
|
112
|
+
category: category ?? undefined,
|
|
113
|
+
trust: trust as ConnectorTrust[],
|
|
114
|
+
noSignIn: filters.has('noSignIn'),
|
|
115
|
+
sort,
|
|
116
|
+
});
|
|
60
117
|
const connections = useConnections();
|
|
61
118
|
const actions = useConnectorActions({ returnTo: connectorReturnTo(nativeScheme) });
|
|
62
119
|
useWebSignInReturn((outcome) => {
|
|
@@ -66,10 +123,6 @@ export function GemieConnectorsStore({
|
|
|
66
123
|
toast.error(t(signInErrorKey(outcome.error)));
|
|
67
124
|
}
|
|
68
125
|
});
|
|
69
|
-
const [query, setQuery] = useState('');
|
|
70
|
-
const [category, setCategory] = useState<ConnectorCategory | null>(null);
|
|
71
|
-
const [pending, setPending] = useState<string | null>(null);
|
|
72
|
-
const [customOpen, setCustomOpen] = useState(false);
|
|
73
126
|
|
|
74
127
|
const accountsOf = useMemo(() => {
|
|
75
128
|
const counts = new Map<string, number>();
|
|
@@ -81,23 +134,21 @@ export function GemieConnectorsStore({
|
|
|
81
134
|
return counts;
|
|
82
135
|
}, [connections.data]);
|
|
83
136
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
entry.description.toLowerCase().includes(words)),
|
|
92
|
-
);
|
|
93
|
-
}, [catalogue.data, query, category]);
|
|
137
|
+
const pages = store.data?.pages ?? [];
|
|
138
|
+
const entries = pages.flatMap((page) => page.servers);
|
|
139
|
+
const total = pages[0]?.total ?? 0;
|
|
140
|
+
const categories = pages[0]?.categories ?? [];
|
|
141
|
+
const browsing = !q && category === null && filters.size === 0 && sort === 'featured';
|
|
142
|
+
const featured = browsing ? entries.filter((entry) => entry.featured) : [];
|
|
143
|
+
const rest = browsing ? entries.filter((entry) => !entry.featured) : entries;
|
|
94
144
|
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
145
|
+
const toggle = (filter: StoreFilter) =>
|
|
146
|
+
setFilters((current) => {
|
|
147
|
+
const next = new Set(current);
|
|
148
|
+
if (next.has(filter)) next.delete(filter);
|
|
149
|
+
else next.add(filter);
|
|
150
|
+
return next;
|
|
151
|
+
});
|
|
101
152
|
|
|
102
153
|
const connect = async (entry: ConnectorEntry) => {
|
|
103
154
|
setPending(entry.id);
|
|
@@ -114,6 +165,17 @@ export function GemieConnectorsStore({
|
|
|
114
165
|
}
|
|
115
166
|
};
|
|
116
167
|
|
|
168
|
+
const card = (entry: ConnectorEntry) => (
|
|
169
|
+
<StoreCard
|
|
170
|
+
key={entry.id}
|
|
171
|
+
entry={entry}
|
|
172
|
+
accounts={accountsOf.get(entry.id) ?? 0}
|
|
173
|
+
pending={pending === entry.id}
|
|
174
|
+
onConnect={connect}
|
|
175
|
+
t={t}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
178
|
+
|
|
117
179
|
return (
|
|
118
180
|
<View className="gap-4">
|
|
119
181
|
<Search
|
|
@@ -122,7 +184,7 @@ export function GemieConnectorsStore({
|
|
|
122
184
|
onChangeText={setQuery}
|
|
123
185
|
onClearText={() => setQuery('')}
|
|
124
186
|
/>
|
|
125
|
-
{categories.length > 1 ? (
|
|
187
|
+
{categories.length > 1 || category !== null ? (
|
|
126
188
|
<ChipRow role="radiogroup" accessibilityLabel={t(`${K}.store.categories`)}>
|
|
127
189
|
<Chip
|
|
128
190
|
size="sm"
|
|
@@ -132,68 +194,81 @@ export function GemieConnectorsStore({
|
|
|
132
194
|
>
|
|
133
195
|
{t(`${K}.store.all`)}
|
|
134
196
|
</Chip>
|
|
135
|
-
{categories.map((
|
|
197
|
+
{categories.map(({ id, count }) => (
|
|
136
198
|
<Chip
|
|
137
|
-
key={
|
|
199
|
+
key={id}
|
|
138
200
|
size="sm"
|
|
139
201
|
role="radio"
|
|
140
|
-
selected={category ===
|
|
141
|
-
onPress={() => setCategory(category ===
|
|
202
|
+
selected={category === id}
|
|
203
|
+
onPress={() => setCategory(category === id ? null : id)}
|
|
142
204
|
>
|
|
143
|
-
{t(`${K}.category.${
|
|
205
|
+
{`${t(`${K}.category.${id}`)} ${count}`}
|
|
144
206
|
</Chip>
|
|
145
207
|
))}
|
|
146
208
|
</ChipRow>
|
|
147
209
|
) : null}
|
|
210
|
+
<View className="flex-row flex-wrap items-center justify-between gap-3">
|
|
211
|
+
<ChipRow role="group" accessibilityLabel={t(`${K}.store.filters`)}>
|
|
212
|
+
{FILTERS.map((filter) => (
|
|
213
|
+
<Chip
|
|
214
|
+
key={filter}
|
|
215
|
+
size="sm"
|
|
216
|
+
role="checkbox"
|
|
217
|
+
selected={filters.has(filter)}
|
|
218
|
+
onPress={() => toggle(filter)}
|
|
219
|
+
>
|
|
220
|
+
{t(`${K}.store.filter.${filter}`)}
|
|
221
|
+
</Chip>
|
|
222
|
+
))}
|
|
223
|
+
</ChipRow>
|
|
224
|
+
<SortSelect value={sort} onChange={setSort} t={t} />
|
|
225
|
+
</View>
|
|
148
226
|
|
|
149
|
-
{
|
|
227
|
+
{store.isPending ? (
|
|
150
228
|
<StoreSkeleton />
|
|
151
|
-
) :
|
|
229
|
+
) : store.isError && entries.length === 0 ? (
|
|
152
230
|
<View className="items-start gap-2 py-4">
|
|
153
231
|
<Text variant="body-2-regular" className="text-text-secondary">
|
|
154
232
|
{t(`${K}.store.loadFailed`)}
|
|
155
233
|
</Text>
|
|
156
|
-
<Button size="sm" appearance="outline" tone="neutral" onPress={() =>
|
|
234
|
+
<Button size="sm" appearance="outline" tone="neutral" onPress={() => store.refetch()}>
|
|
157
235
|
{t(`${K}.store.retry`)}
|
|
158
236
|
</Button>
|
|
159
237
|
</View>
|
|
160
238
|
) : (
|
|
161
239
|
<>
|
|
162
240
|
{featured.length > 0 ? (
|
|
163
|
-
<StoreGroup title={t(`${K}.store.featured`)}>
|
|
164
|
-
{featured.map((entry) => (
|
|
165
|
-
<StoreCard
|
|
166
|
-
key={entry.id}
|
|
167
|
-
entry={entry}
|
|
168
|
-
accounts={accountsOf.get(entry.id) ?? 0}
|
|
169
|
-
pending={pending === entry.id}
|
|
170
|
-
onConnect={connect}
|
|
171
|
-
t={t}
|
|
172
|
-
/>
|
|
173
|
-
))}
|
|
174
|
-
</StoreGroup>
|
|
241
|
+
<StoreGroup title={t(`${K}.store.featured`)}>{featured.map(card)}</StoreGroup>
|
|
175
242
|
) : null}
|
|
176
243
|
{rest.length > 0 ? (
|
|
177
|
-
<StoreGroup
|
|
178
|
-
{
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
t={t}
|
|
186
|
-
/>
|
|
187
|
-
))}
|
|
244
|
+
<StoreGroup
|
|
245
|
+
title={
|
|
246
|
+
browsing
|
|
247
|
+
? t(`${K}.store.allCount`, { count: total })
|
|
248
|
+
: t(`${K}.store.results`, { count: total })
|
|
249
|
+
}
|
|
250
|
+
>
|
|
251
|
+
{rest.map(card)}
|
|
188
252
|
</StoreGroup>
|
|
189
253
|
) : null}
|
|
190
|
-
{
|
|
254
|
+
{entries.length === 0 ? (
|
|
191
255
|
<Text variant="body-2-regular" className="py-4 text-text-secondary">
|
|
192
|
-
{query.
|
|
193
|
-
? t(`${K}.store.noResults`, { query: query.trim() })
|
|
194
|
-
: t(`${K}.store.empty`)}
|
|
256
|
+
{q ? t(`${K}.store.noResults`, { query: q }) : t(`${K}.store.empty`)}
|
|
195
257
|
</Text>
|
|
196
258
|
) : null}
|
|
259
|
+
{store.hasNextPage ? (
|
|
260
|
+
<View className="items-center">
|
|
261
|
+
<Button
|
|
262
|
+
size="sm"
|
|
263
|
+
appearance="outline"
|
|
264
|
+
tone="neutral"
|
|
265
|
+
loading={store.isFetchingNextPage}
|
|
266
|
+
onPress={() => void store.fetchNextPage()}
|
|
267
|
+
>
|
|
268
|
+
{t(`${K}.store.more`, { count: total - entries.length })}
|
|
269
|
+
</Button>
|
|
270
|
+
</View>
|
|
271
|
+
) : null}
|
|
197
272
|
</>
|
|
198
273
|
)}
|
|
199
274
|
|
|
@@ -227,6 +302,41 @@ export function GemieConnectorsStore({
|
|
|
227
302
|
);
|
|
228
303
|
}
|
|
229
304
|
|
|
305
|
+
function SortSelect({
|
|
306
|
+
value,
|
|
307
|
+
onChange,
|
|
308
|
+
t,
|
|
309
|
+
}: {
|
|
310
|
+
value: ConnectorSort;
|
|
311
|
+
onChange: (sort: ConnectorSort) => void;
|
|
312
|
+
t: Translate;
|
|
313
|
+
}) {
|
|
314
|
+
const label = t(`${K}.store.sort`);
|
|
315
|
+
const items = CONNECTOR_SORTS.map((sort) => ({
|
|
316
|
+
id: sort,
|
|
317
|
+
label: t(`${K}.store.sortBy.${sort}`),
|
|
318
|
+
}));
|
|
319
|
+
return (
|
|
320
|
+
<Select size="sm" value={value} onValueChange={(next) => onChange(next as ConnectorSort)}>
|
|
321
|
+
<SelectTrigger label={label}>
|
|
322
|
+
<SelectValue placeholder={label} />
|
|
323
|
+
<SelectIcon />
|
|
324
|
+
</SelectTrigger>
|
|
325
|
+
<SelectContent
|
|
326
|
+
label={label}
|
|
327
|
+
items={items}
|
|
328
|
+
width={220}
|
|
329
|
+
valueExtractor={(item) => item.id}
|
|
330
|
+
renderItem={(item) => (
|
|
331
|
+
<SelectItem value={item.id} label={item.label}>
|
|
332
|
+
<SelectItemText>{item.label}</SelectItemText>
|
|
333
|
+
</SelectItem>
|
|
334
|
+
)}
|
|
335
|
+
/>
|
|
336
|
+
</Select>
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
230
340
|
function StoreGroup({ title, children }: { title?: string; children: React.ReactNode }) {
|
|
231
341
|
return (
|
|
232
342
|
<View className="gap-2">
|
|
@@ -253,15 +363,33 @@ function StoreCard({
|
|
|
253
363
|
<View className="min-w-[260px] flex-1 basis-[260px] gap-3 rounded-2xl border border-border p-4">
|
|
254
364
|
<View className="flex-row items-center gap-3">
|
|
255
365
|
<ConnectorLogo name={entry.name} logoUrl={entry.logoUrl} size={40} />
|
|
256
|
-
<View className="flex-1">
|
|
366
|
+
<View className="flex-1 gap-1">
|
|
257
367
|
<Text variant="body-2-semibold" numberOfLines={1}>
|
|
258
368
|
{entry.name}
|
|
259
369
|
</Text>
|
|
260
|
-
<
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
370
|
+
<View className="flex-row flex-wrap items-center gap-1.5">
|
|
371
|
+
<Badge
|
|
372
|
+
size="label-small"
|
|
373
|
+
variant="subtle"
|
|
374
|
+
color={TRUST_COLOR[entry.trust]}
|
|
375
|
+
icon={TRUST_ICON[entry.trust]}
|
|
376
|
+
content={t(`${K}.trust.${entry.trust}`)}
|
|
377
|
+
/>
|
|
378
|
+
{entry.signIn === 'none' ? (
|
|
379
|
+
<Badge
|
|
380
|
+
size="label-small"
|
|
381
|
+
variant="subtle"
|
|
382
|
+
color="success"
|
|
383
|
+
icon={RiLockUnlockLine}
|
|
384
|
+
content={t(`${K}.store.filter.noSignIn`)}
|
|
385
|
+
/>
|
|
386
|
+
) : null}
|
|
387
|
+
<Text variant="body-2-regular" className="text-text-secondary" numberOfLines={1}>
|
|
388
|
+
{accounts > 0
|
|
389
|
+
? t(`${K}.store.connectedCount`, { count: accounts })
|
|
390
|
+
: t(`${K}.category.${entry.category}`)}
|
|
391
|
+
</Text>
|
|
392
|
+
</View>
|
|
265
393
|
</View>
|
|
266
394
|
</View>
|
|
267
395
|
<Text variant="body-2-regular" className="text-text-secondary" numberOfLines={2}>
|
|
@@ -277,14 +405,16 @@ function StoreCard({
|
|
|
277
405
|
>
|
|
278
406
|
{accounts > 0 ? t(`${K}.store.connectAnother`) : t(`${K}.store.connect`)}
|
|
279
407
|
</Button>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
408
|
+
{entry.docsUrl ? (
|
|
409
|
+
<Button
|
|
410
|
+
size="sm"
|
|
411
|
+
appearance="plain"
|
|
412
|
+
tone="neutral"
|
|
413
|
+
onPress={() => void WebBrowser.openBrowserAsync(entry.docsUrl as string)}
|
|
414
|
+
>
|
|
415
|
+
{t(`${K}.store.docs`)}
|
|
416
|
+
</Button>
|
|
417
|
+
) : null}
|
|
288
418
|
</View>
|
|
289
419
|
</View>
|
|
290
420
|
);
|
package/src/connectors.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="nativewind/types" />
|
|
2
2
|
/**
|
|
3
|
-
* The connectors leaf entry: the
|
|
4
|
-
* Linear, Slack…)
|
|
5
|
-
*
|
|
6
|
-
* the
|
|
3
|
+
* The connectors leaf entry: the remote MCP servers a person connects — the providers' own
|
|
4
|
+
* (Notion, Linear, Slack…), the hundreds synced from the official MCP Registry — and their own MCP
|
|
5
|
+
* servers by URL. The store where they are found and connected, the Settings list of what was
|
|
6
|
+
* connected, the one logo every screen draws for a connector, and the switch every list that grants
|
|
7
|
+
* a connected account to a gemie draws (`GrantSwitchRow`).
|
|
7
8
|
* The Gemies and the Alia apps both draw these; neither keeps a copy.
|
|
8
9
|
*/
|
|
9
10
|
export { ConnectorLogo } from './components/connectors/ConnectorLogo';
|
|
@@ -17,16 +18,20 @@ export type { GrantSwitchRowProps } from './components/connectors/GrantSwitchRow
|
|
|
17
18
|
export {
|
|
18
19
|
CONNECTOR_CATEGORIES,
|
|
19
20
|
CONNECTOR_ROUTES,
|
|
21
|
+
CONNECTOR_SORTS,
|
|
22
|
+
CONNECTOR_STORE_PAGE_SIZE,
|
|
23
|
+
CONNECTOR_TRUST,
|
|
20
24
|
CONNECTORS_PATH,
|
|
21
25
|
connectionOfTool,
|
|
22
26
|
connectorQueryKeys,
|
|
23
27
|
connectorReturnTo,
|
|
28
|
+
connectorStoreParams,
|
|
24
29
|
signInResult,
|
|
25
30
|
useConnectionOfTool,
|
|
26
31
|
useConnections,
|
|
27
32
|
useConnectorActions,
|
|
28
|
-
useConnectorCatalogue,
|
|
29
33
|
useConnectorLogoUrl,
|
|
34
|
+
useConnectorStore,
|
|
30
35
|
useWebSignInReturn,
|
|
31
36
|
} from './runtime/connectors';
|
|
32
37
|
export type {
|
|
@@ -34,4 +39,8 @@ export type {
|
|
|
34
39
|
ConnectionStatus,
|
|
35
40
|
ConnectorCategory,
|
|
36
41
|
ConnectorEntry,
|
|
42
|
+
ConnectorSort,
|
|
43
|
+
ConnectorStorePage,
|
|
44
|
+
ConnectorStoreQuery,
|
|
45
|
+
ConnectorTrust,
|
|
37
46
|
} from './runtime/connectors';
|