@agimon-ai/po-native 0.0.1-alpha.67 → 0.0.1-alpha.69
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/package.json +12 -12
- package/src/app/App.tsx +166 -50
- package/src/app/cloudRuntime.ts +15 -1
- package/src/app/liveRuntime.ts +2 -0
- package/src/app/pickSettingsAvatar.ts +37 -0
- package/src/screens/GlobalSettings.tsx +4 -3
- package/src/screens/RemoteControlScreen.tsx +1 -1
- package/src/screens/SessionActionsDesign.stories.tsx +2 -3
- package/src/screens/SessionLifecycleDesign.stories.tsx +221 -0
- package/src/screens/SettingsScreen.stories.tsx +26 -3
- package/src/services/connection/index.ts +1 -0
- package/src/services/hostActions/index.ts +21 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-native",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.69",
|
|
4
4
|
"description": "Po for iOS and Android",
|
|
5
5
|
"homepage": "https://agimon.ai",
|
|
6
6
|
"bugs": {
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
33
|
-
"@agimon-ai/po-expo-signing": "0.0.1-alpha.
|
|
34
|
-
"@agimon-ai/po-identity": "0.0.2-alpha.
|
|
35
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
36
|
-
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.
|
|
37
|
-
"@agimon-ai/po-template-advanced": "0.0.0-alpha.
|
|
38
|
-
"@agimon-ai/po-template-elegant": "0.0.0-alpha.
|
|
39
|
-
"@agimon-ai/po-voice": "0.0.0-alpha.
|
|
40
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
41
|
-
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.
|
|
42
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.
|
|
32
|
+
"@agimon-ai/po-core": "0.0.0-alpha.189",
|
|
33
|
+
"@agimon-ai/po-expo-signing": "0.0.1-alpha.69",
|
|
34
|
+
"@agimon-ai/po-identity": "0.0.2-alpha.136",
|
|
35
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.189",
|
|
36
|
+
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.61",
|
|
37
|
+
"@agimon-ai/po-template-advanced": "0.0.0-alpha.189",
|
|
38
|
+
"@agimon-ai/po-template-elegant": "0.0.0-alpha.189",
|
|
39
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.189",
|
|
40
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.189",
|
|
41
|
+
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.189",
|
|
42
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.189",
|
|
43
43
|
"@better-auth/expo": "1.7.12",
|
|
44
44
|
"@config-plugins/react-native-webrtc": "15.0.2",
|
|
45
45
|
"@earendil-works/chord": "1.5.2",
|
package/src/app/App.tsx
CHANGED
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
useState,
|
|
145
145
|
useSyncExternalStore,
|
|
146
146
|
} from 'react';
|
|
147
|
-
import { Alert, AppState, Image, Keyboard, Linking, Text, View } from 'react-native';
|
|
147
|
+
import { Alert, AppState, Image, Keyboard, Linking, Pressable, Text, View } from 'react-native';
|
|
148
148
|
import { KeyboardAvoidingView, KeyboardProvider } from 'react-native-keyboard-controller';
|
|
149
149
|
import { randomBytes } from 'react-native-quick-crypto';
|
|
150
150
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
@@ -197,6 +197,7 @@ import { type SessionSummary, SessionListScreen } from '../screens/SessionListSc
|
|
|
197
197
|
import { StateRow } from '../screens/SettingsFields';
|
|
198
198
|
import {
|
|
199
199
|
Group,
|
|
200
|
+
NavRow,
|
|
200
201
|
SectionPage,
|
|
201
202
|
type SettingsSection,
|
|
202
203
|
SettingsPanelPage,
|
|
@@ -229,6 +230,7 @@ import {
|
|
|
229
230
|
deleteSessionGroup,
|
|
230
231
|
listDirectory,
|
|
231
232
|
loadSessionImage,
|
|
233
|
+
loadParticipantAvatar,
|
|
232
234
|
removeWorkspace,
|
|
233
235
|
renameSessionGroup,
|
|
234
236
|
requestWithStepUp,
|
|
@@ -279,6 +281,7 @@ import {
|
|
|
279
281
|
useNativeTemplateScreen,
|
|
280
282
|
} from './nativeTemplate';
|
|
281
283
|
import { loadOtherWorkspacesOpen, otherWorkspacesOpenStore, setOtherWorkspacesOpen } from './otherWorkspaces';
|
|
284
|
+
import { pickSettingsAvatar } from './pickSettingsAvatar';
|
|
282
285
|
import { useRailWorkspaces } from './railWorkspaces';
|
|
283
286
|
import { useSessionAvatars } from './sessionAvatars';
|
|
284
287
|
import { SessionSharingRoute, type SharingTarget } from './SessionSharingRoute';
|
|
@@ -289,7 +292,7 @@ type Routes = {
|
|
|
289
292
|
Tabs: undefined;
|
|
290
293
|
Session: { sessionId: string; title: string; activity?: string };
|
|
291
294
|
HomeAttention: undefined;
|
|
292
|
-
Page: { pageId: string; title: string; workspaceId?: string };
|
|
295
|
+
Page: { pageId: string; title: string; workspaceId?: string; pageItemId?: string };
|
|
293
296
|
Workspace: { workspaceId: string; title: string };
|
|
294
297
|
CalendarDetail: { pageId: string; eventId: string; workspaceId?: string };
|
|
295
298
|
ProviderApproval: { workspaceId: string; candidate: ProviderCandidate };
|
|
@@ -578,6 +581,10 @@ function LiveSessionScreen({
|
|
|
578
581
|
...props
|
|
579
582
|
}: SessionScreenProps & { templated?: boolean; phoneTemplate?: boolean }) {
|
|
580
583
|
const { sessionId } = props;
|
|
584
|
+
const participantAvatar = useCallback(
|
|
585
|
+
(profileId: string) => loadParticipantAvatar(sessionId, profileId),
|
|
586
|
+
[sessionId],
|
|
587
|
+
);
|
|
581
588
|
const store = sessionStoreFor(sessionId);
|
|
582
589
|
const dialog = useStore(store, (state) => state.dialog);
|
|
583
590
|
const claimed = useStore(menuStore, (state) => state.claimed?.dialogId);
|
|
@@ -618,6 +625,7 @@ function LiveSessionScreen({
|
|
|
618
625
|
};
|
|
619
626
|
const screenProps: SessionScreenProps = {
|
|
620
627
|
...props,
|
|
628
|
+
loadParticipantAvatar: participantAvatar,
|
|
621
629
|
panel: isValidElement<WebPluginSlotProps>(props.panel)
|
|
622
630
|
? cloneElement(props.panel, { surfaceVisible: focused && dialog === null })
|
|
623
631
|
: props.panel,
|
|
@@ -738,7 +746,7 @@ function SessionRoute({
|
|
|
738
746
|
);
|
|
739
747
|
const richRenderers = useMemo(createRichActivityRenderers, []);
|
|
740
748
|
const contexts = useStore(composer.contexts);
|
|
741
|
-
const [, registryChanged] = useState(0);
|
|
749
|
+
const [registryRevision, registryChanged] = useState(0);
|
|
742
750
|
useEffect(() => subscribeWebPluginRegistry(() => registryChanged((value) => value + 1)), []);
|
|
743
751
|
useEffect(() => () => dropTransientTabs(ownerSessionId), [ownerSessionId]);
|
|
744
752
|
// One stable top-bar setter per tab screen, so a panel's header effect never loops on a new identity.
|
|
@@ -771,9 +779,23 @@ function SessionRoute({
|
|
|
771
779
|
const card = useMemo(() => (entry === undefined ? undefined : railSessionStatus(entry, Date.now())), [entry]);
|
|
772
780
|
const summary = entry?.summary;
|
|
773
781
|
// Who is on the session, as its card in the list says it: the profile's face and name.
|
|
774
|
-
const
|
|
782
|
+
const profile = summary?.profile;
|
|
783
|
+
const agent = profile && (profile.displayName ?? profile.name);
|
|
775
784
|
const avatarUrl = useSessionAvatars([sessionId], entry === undefined ? {} : { [sessionId]: entry })[sessionId];
|
|
776
|
-
const
|
|
785
|
+
const hostId = splitHostId(sessionId)?.hostId;
|
|
786
|
+
const workspaceId = summary?.workspaceId;
|
|
787
|
+
const profileName = profile?.name;
|
|
788
|
+
const canOpenProfile =
|
|
789
|
+
hostId !== undefined &&
|
|
790
|
+
Boolean(profileName) &&
|
|
791
|
+
webPluginRegistryForHost(hostId)
|
|
792
|
+
.hostSlotFills(HOST_SLOTS.page)
|
|
793
|
+
.some((fill) => fill.id === 'profiles' && fill.component);
|
|
794
|
+
const openProfile = useCallback(() => {
|
|
795
|
+
if (hostId === undefined || !profileName) return;
|
|
796
|
+
navigation.push('Page', { ...homePageRoute(hostId, 'profiles'), workspaceId, pageItemId: profileName });
|
|
797
|
+
}, [hostId, navigation, profileName, workspaceId]);
|
|
798
|
+
const activityLoad = useActivityLoad(hostId, [
|
|
777
799
|
'catalog',
|
|
778
800
|
'host',
|
|
779
801
|
`workspace:${summary?.workspaceId}`,
|
|
@@ -794,6 +816,16 @@ function SessionRoute({
|
|
|
794
816
|
}),
|
|
795
817
|
[route.params.title, status, card?.clock, waiting, busy],
|
|
796
818
|
);
|
|
819
|
+
// Plugin controls beside Activity get the full slot props of the latest render; the header reads them when it draws.
|
|
820
|
+
const headerSlotProps = useRef<WebPluginSlotProps | null>(null);
|
|
821
|
+
// The session's own computer answers its header controls' requests, as Settings does for that computer.
|
|
822
|
+
const headerApi = useMemo(
|
|
823
|
+
() =>
|
|
824
|
+
hostId === undefined || workspaceId === undefined
|
|
825
|
+
? undefined
|
|
826
|
+
: { key: hostId, workspaceId, request: apiTransportForHost(hostId) },
|
|
827
|
+
[hostId, workspaceId],
|
|
828
|
+
);
|
|
797
829
|
const sessionOptions = useMemo(
|
|
798
830
|
() => ({
|
|
799
831
|
headerTitle: () =>
|
|
@@ -801,17 +833,23 @@ function SessionRoute({
|
|
|
801
833
|
<View style={styles.headerTitle}>
|
|
802
834
|
<View style={styles.headerRow}>
|
|
803
835
|
{agent === undefined ? null : (
|
|
804
|
-
<
|
|
836
|
+
<Pressable
|
|
805
837
|
style={styles.headerAvatar}
|
|
806
|
-
|
|
807
|
-
|
|
838
|
+
accessible={canOpenProfile}
|
|
839
|
+
accessibilityRole={canOpenProfile ? 'button' : undefined}
|
|
840
|
+
accessibilityLabel={canOpenProfile ? `Open profile for ${agent}` : undefined}
|
|
841
|
+
importantForAccessibility={canOpenProfile ? 'auto' : 'no-hide-descendants'}
|
|
842
|
+
accessibilityElementsHidden={!canOpenProfile}
|
|
843
|
+
disabled={!canOpenProfile}
|
|
844
|
+
onPress={openProfile}
|
|
845
|
+
hitSlop={8}
|
|
808
846
|
>
|
|
809
847
|
{avatarUrl === undefined ? (
|
|
810
848
|
<Text style={styles.headerInitials}>{personaInitials(agent)}</Text>
|
|
811
849
|
) : (
|
|
812
850
|
<Image source={{ uri: avatarUrl }} style={styles.headerAvatarImage} />
|
|
813
851
|
)}
|
|
814
|
-
</
|
|
852
|
+
</Pressable>
|
|
815
853
|
)}
|
|
816
854
|
<Text style={styles.headerName} numberOfLines={1}>
|
|
817
855
|
{route.params.title}
|
|
@@ -835,26 +873,57 @@ function SessionRoute({
|
|
|
835
873
|
),
|
|
836
874
|
headerRight: () =>
|
|
837
875
|
templateHeader?.right ?? (
|
|
838
|
-
<
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
876
|
+
<View style={styles.headerRow}>
|
|
877
|
+
{hostId === undefined || headerSlotProps.current === null
|
|
878
|
+
? null
|
|
879
|
+
: webPluginRegistryForHost(hostId)
|
|
880
|
+
.hostSlotFills(HOST_SLOTS.sessionHeaderActions)
|
|
881
|
+
.map(({ pluginId, id, component: Action }) =>
|
|
882
|
+
Action ? (
|
|
883
|
+
<Action
|
|
884
|
+
key={`${pluginId}:${id}`}
|
|
885
|
+
{...headerSlotProps.current!}
|
|
886
|
+
{...(headerApi ? { dashboardApi: headerApi } : {})}
|
|
887
|
+
/>
|
|
888
|
+
) : null,
|
|
889
|
+
)}
|
|
890
|
+
<Button
|
|
891
|
+
variant="ghost"
|
|
892
|
+
size="icon"
|
|
893
|
+
accessibilityLabel={
|
|
894
|
+
waiting > 0
|
|
895
|
+
? `Activity, ${String(waiting)} waiting for you`
|
|
896
|
+
: busy
|
|
897
|
+
? 'Activity, work running'
|
|
898
|
+
: 'Activity'
|
|
899
|
+
}
|
|
900
|
+
onPress={() => setActivityOpen(true)}
|
|
901
|
+
>
|
|
902
|
+
<View>
|
|
903
|
+
<ActivityIcon color={busy ? 'yellow' : 'hi'} />
|
|
904
|
+
<CountBadge count={waiting} style={styles.activityBadge} />
|
|
905
|
+
</View>
|
|
906
|
+
</Button>
|
|
907
|
+
</View>
|
|
855
908
|
),
|
|
856
909
|
}),
|
|
857
|
-
[
|
|
910
|
+
[
|
|
911
|
+
busy,
|
|
912
|
+
waiting,
|
|
913
|
+
status,
|
|
914
|
+
tone,
|
|
915
|
+
card?.clock,
|
|
916
|
+
route.params.title,
|
|
917
|
+
templateHeader,
|
|
918
|
+
agent,
|
|
919
|
+
avatarUrl,
|
|
920
|
+
canOpenProfile,
|
|
921
|
+
openProfile,
|
|
922
|
+
hostId,
|
|
923
|
+
headerApi,
|
|
924
|
+
sessionId,
|
|
925
|
+
registryRevision,
|
|
926
|
+
],
|
|
858
927
|
);
|
|
859
928
|
useFocusEffect(
|
|
860
929
|
useCallback(() => {
|
|
@@ -1083,6 +1152,7 @@ function SessionRoute({
|
|
|
1083
1152
|
})),
|
|
1084
1153
|
},
|
|
1085
1154
|
);
|
|
1155
|
+
headerSlotProps.current = slotProps;
|
|
1086
1156
|
const removeContext = (source: string, id: string) => {
|
|
1087
1157
|
capturesRef.current = capturesRef.current.filter(
|
|
1088
1158
|
(capture) => capture.context.source !== source || capture.context.id !== id,
|
|
@@ -1342,6 +1412,8 @@ function SettingsRoute(
|
|
|
1342
1412
|
const curated = useCuratedPackages(settingsHost);
|
|
1343
1413
|
const listed = (pluginId: string) => !isCuratedPlugin(pluginId, installedPlugins, curated);
|
|
1344
1414
|
const panels = useSettingsPanels(settingsHost).filter((panel) => listed(panel.pluginId));
|
|
1415
|
+
// A page about the person sits in the Global card, not among the computer's features.
|
|
1416
|
+
const globalPanels = props.phoneOnly ? [] : panels.filter((panel) => panel.menuGroup === 'global');
|
|
1345
1417
|
const panelGroups = useSettingsPanelGroups(props.phoneOnly ? props.computers : undefined);
|
|
1346
1418
|
const sections = useSettingsSections('host', settingsHost).filter((section) => listed(section.pluginId));
|
|
1347
1419
|
const sectionKeys = sections.flatMap((section) => section.fields.map(settingsKeyOf)).join('\n');
|
|
@@ -1396,9 +1468,37 @@ function SettingsRoute(
|
|
|
1396
1468
|
);
|
|
1397
1469
|
const appearance = useStore(appearanceStore, (state) => state);
|
|
1398
1470
|
const teamName = hostedTeamName.data;
|
|
1471
|
+
const openPanel = (id: string, owner = settingsHost) => {
|
|
1472
|
+
const computer = props.computers?.find((candidate) => candidate.id === owner);
|
|
1473
|
+
if (owner === undefined ? !allowed : computer?.online === false) {
|
|
1474
|
+
Alert.alert('Settings', computer ? `${computer.label} is offline.` : refused);
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
const panel = (owner === settingsHost ? panels : panelGroups.find((group) => group.hostId === owner)?.panels)?.find(
|
|
1478
|
+
(candidate) => candidate.id === id,
|
|
1479
|
+
);
|
|
1480
|
+
if (panel)
|
|
1481
|
+
navigation.navigate('SettingsPanel', {
|
|
1482
|
+
id,
|
|
1483
|
+
title: panel.label,
|
|
1484
|
+
...(owner === undefined ? {} : { hostId: owner }),
|
|
1485
|
+
});
|
|
1486
|
+
};
|
|
1399
1487
|
return (
|
|
1400
1488
|
<SettingsScreen
|
|
1401
|
-
globalSection={
|
|
1489
|
+
globalSection={
|
|
1490
|
+
<GlobalSettings>
|
|
1491
|
+
{globalPanels.map((panel) => (
|
|
1492
|
+
<NavRow
|
|
1493
|
+
key={panel.id}
|
|
1494
|
+
Icon={panel.icon as ComponentType<IconProps> | undefined}
|
|
1495
|
+
title={panel.label}
|
|
1496
|
+
value={sentenceCase(panel.detail)}
|
|
1497
|
+
onPress={() => openPanel(panel.id)}
|
|
1498
|
+
/>
|
|
1499
|
+
))}
|
|
1500
|
+
</GlobalSettings>
|
|
1501
|
+
}
|
|
1402
1502
|
accountRegion={(entry) =>
|
|
1403
1503
|
renderRegion(
|
|
1404
1504
|
HOST_SLOTS.accountRegion,
|
|
@@ -1444,24 +1544,9 @@ function SettingsRoute(
|
|
|
1444
1544
|
}
|
|
1445
1545
|
navigation.navigate(section, settingsHost === undefined ? undefined : { hostId: settingsHost });
|
|
1446
1546
|
}}
|
|
1447
|
-
panels={panels}
|
|
1547
|
+
panels={panels.filter((panel) => panel.menuGroup !== 'global')}
|
|
1448
1548
|
panelGroups={panelGroups}
|
|
1449
|
-
onOpenPanel={
|
|
1450
|
-
const computer = props.computers?.find((candidate) => candidate.id === owner);
|
|
1451
|
-
if (owner === undefined ? !allowed : computer?.online === false) {
|
|
1452
|
-
Alert.alert('Settings', computer ? `${computer.label} is offline.` : refused);
|
|
1453
|
-
return;
|
|
1454
|
-
}
|
|
1455
|
-
const panel = (
|
|
1456
|
-
owner === settingsHost ? panels : panelGroups.find((group) => group.hostId === owner)?.panels
|
|
1457
|
-
)?.find((candidate) => candidate.id === id);
|
|
1458
|
-
if (panel)
|
|
1459
|
-
navigation.navigate('SettingsPanel', {
|
|
1460
|
-
id,
|
|
1461
|
-
title: panel.label,
|
|
1462
|
-
...(owner === undefined ? {} : { hostId: owner }),
|
|
1463
|
-
});
|
|
1464
|
-
}}
|
|
1549
|
+
onOpenPanel={openPanel}
|
|
1465
1550
|
/>
|
|
1466
1551
|
);
|
|
1467
1552
|
}
|
|
@@ -1504,6 +1589,7 @@ function SettingsPanelRoute({ route }: NativeStackScreenProps<Routes, 'SettingsP
|
|
|
1504
1589
|
<Panel
|
|
1505
1590
|
request={request}
|
|
1506
1591
|
requestWithStepUp={request}
|
|
1592
|
+
pickAvatar={pickSettingsAvatar}
|
|
1507
1593
|
listSessions={() => settingsPanelSessions(hostId)}
|
|
1508
1594
|
// Only the sections this app has a screen for; others are ignored, as the panel contract allows.
|
|
1509
1595
|
openSettings={(section) => {
|
|
@@ -2747,7 +2833,12 @@ function WorkspaceRoute({ workspaceId, hostStates }: { workspaceId: string; host
|
|
|
2747
2833
|
dashboardApi,
|
|
2748
2834
|
...calendarHost,
|
|
2749
2835
|
openWorkspace,
|
|
2750
|
-
openPage: (pageId
|
|
2836
|
+
openPage: (pageId, itemId) =>
|
|
2837
|
+
navigation.navigate('Page', {
|
|
2838
|
+
...homePageRoute(owner.hostId, pageId),
|
|
2839
|
+
workspaceId,
|
|
2840
|
+
...(itemId === undefined ? {} : { pageItemId: itemId }),
|
|
2841
|
+
}),
|
|
2751
2842
|
openSettings: (section) => {
|
|
2752
2843
|
if (section === 'providers') navigation.navigate('SettingsProviders', { hostId: owner.hostId });
|
|
2753
2844
|
else if (section === 'mcp') navigation.navigate('SettingsMcp', { hostId: owner.hostId });
|
|
@@ -2810,17 +2901,19 @@ function WorkspaceRoute({ workspaceId, hostStates }: { workspaceId: string; host
|
|
|
2810
2901
|
return <WorkspaceScreen state="ready" tiles={tiles} />;
|
|
2811
2902
|
}
|
|
2812
2903
|
|
|
2813
|
-
/** A plugin's full page,
|
|
2904
|
+
/** A plugin's full page, opened from Home, a workspace, or a conversation. */
|
|
2814
2905
|
function PluginPageRoute({
|
|
2815
2906
|
pageId,
|
|
2816
2907
|
workspaceId,
|
|
2817
2908
|
hostStates,
|
|
2818
2909
|
detailEventId,
|
|
2910
|
+
pageItemId,
|
|
2819
2911
|
}: {
|
|
2820
2912
|
pageId: string;
|
|
2821
2913
|
workspaceId?: string;
|
|
2822
2914
|
hostStates: readonly HostRuntimeState[];
|
|
2823
2915
|
detailEventId?: string;
|
|
2916
|
+
pageItemId?: string;
|
|
2824
2917
|
}) {
|
|
2825
2918
|
const navigation = useNavigation<NativeStackNavigationProp<Routes>>();
|
|
2826
2919
|
useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
|
|
@@ -2856,7 +2949,25 @@ function PluginPageRoute({
|
|
|
2856
2949
|
...calendarHost,
|
|
2857
2950
|
openWorkspace,
|
|
2858
2951
|
detailEventId,
|
|
2952
|
+
pageItemId,
|
|
2859
2953
|
onPushDetail: (eventId: string) => navigation.push('CalendarDetail', { pageId, eventId, workspaceId }),
|
|
2954
|
+
...(pageHostId === undefined
|
|
2955
|
+
? {}
|
|
2956
|
+
: {
|
|
2957
|
+
startChat: async (profile: string): Promise<string | undefined> => {
|
|
2958
|
+
const result = await createGeneralSession(pageHostId, undefined, profile);
|
|
2959
|
+
if ('error' in result) return result.error;
|
|
2960
|
+
if (result.workspace) applyWorkspaceUpsert({ workspace: result.workspace }, pageHostId);
|
|
2961
|
+
if (result.session) applySessionUpsert({ session: result.session }, pageHostId);
|
|
2962
|
+
const sessionId = qualifyHostId(pageHostId, result.sessionId);
|
|
2963
|
+
if (!(await waitForSession(sessionId))) return NOT_YET_VISIBLE;
|
|
2964
|
+
navigation.navigate('Session', {
|
|
2965
|
+
sessionId,
|
|
2966
|
+
title: sessionsStore.state.byId[sessionId]?.summary.name || 'Session',
|
|
2967
|
+
});
|
|
2968
|
+
return undefined;
|
|
2969
|
+
},
|
|
2970
|
+
}),
|
|
2860
2971
|
onCloseDetail: () => navigation.goBack(),
|
|
2861
2972
|
};
|
|
2862
2973
|
return <Page {...props} />;
|
|
@@ -2924,9 +3035,10 @@ function useHomeApps(
|
|
|
2924
3035
|
},
|
|
2925
3036
|
openWorkspace: (id: string) => openWorkspace(splitHostId(id) ? id : qualifyHostId(hostId, id)),
|
|
2926
3037
|
openSettings,
|
|
2927
|
-
openPage: (pageId: string) => {
|
|
3038
|
+
openPage: (pageId: string, itemId?: string) => {
|
|
2928
3039
|
const route = homePageRoute(hostId, pageId);
|
|
2929
|
-
openPage(route.pageId, route.title);
|
|
3040
|
+
if (itemId === undefined) openPage(route.pageId, route.title);
|
|
3041
|
+
else navigation.navigate('Page', { ...route, pageItemId: itemId });
|
|
2930
3042
|
},
|
|
2931
3043
|
};
|
|
2932
3044
|
if (!data)
|
|
@@ -3618,12 +3730,16 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
|
|
|
3618
3730
|
</Stack.Screen>
|
|
3619
3731
|
<Stack.Screen
|
|
3620
3732
|
name="Page"
|
|
3621
|
-
options={({ route }) => ({
|
|
3733
|
+
options={({ route }) => ({
|
|
3734
|
+
title: route.params.title,
|
|
3735
|
+
headerBackTitle: route.params.pageItemId === undefined ? 'Home' : 'Conversation',
|
|
3736
|
+
})}
|
|
3622
3737
|
>
|
|
3623
3738
|
{({ route }) => (
|
|
3624
3739
|
<PluginPageRoute
|
|
3625
3740
|
pageId={route.params.pageId}
|
|
3626
3741
|
workspaceId={route.params.workspaceId}
|
|
3742
|
+
pageItemId={route.params.pageItemId}
|
|
3627
3743
|
hostStates={hostStates}
|
|
3628
3744
|
/>
|
|
3629
3745
|
)}
|
package/src/app/cloudRuntime.ts
CHANGED
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
applySessionsSnapshot,
|
|
10
10
|
applySessionInteractions,
|
|
11
|
+
applySessionLifecycleSnapshot,
|
|
11
12
|
watchHubAccess,
|
|
13
|
+
watchHubLifecycle,
|
|
12
14
|
applyWorkspacesSnapshot,
|
|
13
15
|
createCloudHub,
|
|
14
16
|
localHostId,
|
|
@@ -389,7 +391,13 @@ export function startCloudRuntime(host: CloudHostRecord, options: CloudRuntimeOp
|
|
|
389
391
|
const owned = (id: string) => splitHostId(id)?.hostId === host.id;
|
|
390
392
|
let focused: string | null = null;
|
|
391
393
|
let binding:
|
|
392
|
-
| {
|
|
394
|
+
| {
|
|
395
|
+
sessionId: string;
|
|
396
|
+
runtime: SessionRuntime;
|
|
397
|
+
sockets: Set<CloudSocket>;
|
|
398
|
+
stopAccess(): void;
|
|
399
|
+
stopLifecycle(): void;
|
|
400
|
+
}
|
|
393
401
|
| undefined;
|
|
394
402
|
let closed = false;
|
|
395
403
|
let online = host.computer === undefined;
|
|
@@ -419,6 +427,7 @@ export function startCloudRuntime(host: CloudHostRecord, options: CloudRuntimeOp
|
|
|
419
427
|
binding = undefined;
|
|
420
428
|
if (!previous) return;
|
|
421
429
|
previous.stopAccess();
|
|
430
|
+
previous.stopLifecycle();
|
|
422
431
|
previous.runtime.stop();
|
|
423
432
|
for (const socket of previous.sockets) socket.close();
|
|
424
433
|
};
|
|
@@ -439,6 +448,11 @@ export function startCloudRuntime(host: CloudHostRecord, options: CloudRuntimeOp
|
|
|
439
448
|
sockets,
|
|
440
449
|
runtime: startSessionRuntime(client, undefined, host.id),
|
|
441
450
|
stopAccess: watchHubAccess(client, (rights) => applySessionInteractions(rights, host.id), host.id),
|
|
451
|
+
stopLifecycle: watchHubLifecycle(
|
|
452
|
+
client,
|
|
453
|
+
(snapshots) => applySessionLifecycleSnapshot(snapshots, host.id),
|
|
454
|
+
host.id,
|
|
455
|
+
),
|
|
442
456
|
};
|
|
443
457
|
binding.runtime.focus(sessionId);
|
|
444
458
|
};
|
package/src/app/liveRuntime.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
applySessionFrame,
|
|
21
21
|
applySessionsSnapshot,
|
|
22
22
|
applySessionInteractions,
|
|
23
|
+
applySessionLifecycleSnapshot,
|
|
23
24
|
applyWorkspacesSnapshot,
|
|
24
25
|
claimDialogMenu,
|
|
25
26
|
clearPendingMenu,
|
|
@@ -401,6 +402,7 @@ export function startLiveRuntime(
|
|
|
401
402
|
}),
|
|
402
403
|
sealed: session.sealed,
|
|
403
404
|
onAccess: (rights) => applySessionInteractions(rights, host.id),
|
|
405
|
+
onLifecycle: (snapshots) => applySessionLifecycleSnapshot(snapshots, host.id),
|
|
404
406
|
onSessions(sessions) {
|
|
405
407
|
if (closed) return;
|
|
406
408
|
clearVoiceReconnect();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PROFILE_ICON_MAX_DATA_URL_LENGTH } from '@agimon-ai/po-core/profileIdentity';
|
|
2
|
+
|
|
3
|
+
/** Device-only selection. The settings panel owns the subsequent host-local upload. */
|
|
4
|
+
export async function pickSettingsAvatar(): Promise<string | null> {
|
|
5
|
+
const { launchImageLibraryAsync } = await import('expo-image-picker');
|
|
6
|
+
const result = await launchImageLibraryAsync({
|
|
7
|
+
mediaTypes: ['images'],
|
|
8
|
+
allowsMultipleSelection: false,
|
|
9
|
+
allowsEditing: true,
|
|
10
|
+
aspect: [1, 1],
|
|
11
|
+
base64: true,
|
|
12
|
+
quality: 0.8,
|
|
13
|
+
});
|
|
14
|
+
if (result.canceled) return null;
|
|
15
|
+
const asset = result.assets[0];
|
|
16
|
+
if (!asset?.base64) throw new Error('Could not read the image. Choose another image.');
|
|
17
|
+
if (asset.base64.length + 'data:image/jpeg;base64,'.length > PROFILE_ICON_MAX_DATA_URL_LENGTH)
|
|
18
|
+
throw new Error('Choose a smaller image. The encoded avatar must be at most 256 KiB.');
|
|
19
|
+
if (!/^[A-Za-z0-9+/]+={0,2}$/u.test(asset.base64)) throw new Error('Could not read the image. Choose another image.');
|
|
20
|
+
// Do not trust a filename or declared MIME type. No SVG or remote URI crosses the panel boundary.
|
|
21
|
+
const prefix = atob(asset.base64.slice(0, 32));
|
|
22
|
+
const starts = (...bytes: number[]) => bytes.every((byte, index) => prefix.charCodeAt(index) === byte);
|
|
23
|
+
const mime = starts(137, 80, 78, 71, 13, 10, 26, 10)
|
|
24
|
+
? 'image/png'
|
|
25
|
+
: starts(255, 216, 255)
|
|
26
|
+
? 'image/jpeg'
|
|
27
|
+
: prefix.startsWith('GIF8')
|
|
28
|
+
? 'image/gif'
|
|
29
|
+
: prefix.startsWith('RIFF') && prefix.slice(8, 12) === 'WEBP'
|
|
30
|
+
? 'image/webp'
|
|
31
|
+
: undefined;
|
|
32
|
+
if (!mime) throw new Error('Choose a PNG, JPEG, GIF or WebP image.');
|
|
33
|
+
const avatar = `data:${mime};base64,${asset.base64}`;
|
|
34
|
+
if (avatar.length > PROFILE_ICON_MAX_DATA_URL_LENGTH)
|
|
35
|
+
throw new Error('Choose a smaller image. The encoded avatar must be at most 256 KiB.');
|
|
36
|
+
return avatar;
|
|
37
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { nonPortableConfigYaml } from '@agimon-ai/po-core/native';
|
|
2
2
|
import { Select } from '@agimon-ai/po-native-components';
|
|
3
3
|
import { useFocusEffect } from '@react-navigation/native';
|
|
4
|
-
import { useCallback, useRef, useState } from 'react';
|
|
4
|
+
import { type ReactNode, useCallback, useRef, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import { createAccountClient, grantGlobalSettings, selectedIdentityIssuer } from '../services/accountClient';
|
|
7
7
|
import { CardBody, GlobalSettingsView, Group, Row } from './SettingsScreen';
|
|
8
8
|
|
|
9
|
-
/** Reads the member tier directly from the signed-in issuer, not the selected computer. */
|
|
10
|
-
export function GlobalSettings() {
|
|
9
|
+
/** Reads the member tier directly from the signed-in issuer, not the selected computer. `children` are rows about the person, such as My profile. */
|
|
10
|
+
export function GlobalSettings({ children }: { children?: ReactNode } = {}) {
|
|
11
11
|
const epoch = useRef(0);
|
|
12
12
|
const [client, setClient] = useState<Awaited<ReturnType<typeof createAccountClient>>>();
|
|
13
13
|
const [organizations, setOrganizations] = useState<{ id: string; name: string }[]>([]);
|
|
@@ -121,6 +121,7 @@ export function GlobalSettings() {
|
|
|
121
121
|
client ? 'Your portable preferences across hosts.' : 'Sign in to edit your portable preferences across hosts.'
|
|
122
122
|
}
|
|
123
123
|
>
|
|
124
|
+
{children}
|
|
124
125
|
{organizations.length ? (
|
|
125
126
|
<CardBody>
|
|
126
127
|
<Select
|
|
@@ -10,7 +10,7 @@ import { ErrorLine, Group, OnComputer, remoteSummary, Row } from './SettingsScre
|
|
|
10
10
|
/*
|
|
11
11
|
* Remote control at web parity, minus what stays on the computer: turning access on, tunnel settings and
|
|
12
12
|
* pairing codes. The phone may turn access off (the panic button) and revoke devices. Device trust stays
|
|
13
|
-
* app-owned: a plugin's transport refuses `/api/remote`. Session MCP clients
|
|
13
|
+
* app-owned: a plugin's transport refuses `/api/remote`. Session MCP clients live in each session's header.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
const MINUTE = 60_000;
|
|
@@ -197,7 +197,7 @@ const steps = (): readonly { title: string; caption: string; screen: ReactNode }
|
|
|
197
197
|
},
|
|
198
198
|
{
|
|
199
199
|
title: "3. A session's ⋮",
|
|
200
|
-
caption: 'Plugin items first, then the cockpit\u2019s: rename,
|
|
200
|
+
caption: 'Plugin items first, then the cockpit\u2019s: rename, restart, remove.',
|
|
201
201
|
screen: (
|
|
202
202
|
<>
|
|
203
203
|
<SessionsList sessionMenuTap dimmed />
|
|
@@ -205,7 +205,6 @@ const steps = (): readonly { title: string; caption: string; screen: ReactNode }
|
|
|
205
205
|
<ActionList
|
|
206
206
|
items={[
|
|
207
207
|
{ label: 'Rename' },
|
|
208
|
-
{ label: 'Resume', hint: 'Open an earlier conversation in this session' },
|
|
209
208
|
{ label: 'Restart', hint: 'Reloads extensions; not while a turn runs' },
|
|
210
209
|
{ label: 'Remove', danger: true },
|
|
211
210
|
]}
|
|
@@ -278,7 +277,7 @@ function Flow({ scheme }: { scheme: Scheme }) {
|
|
|
278
277
|
);
|
|
279
278
|
}
|
|
280
279
|
|
|
281
|
-
const meta = {
|
|
280
|
+
export const meta = {
|
|
282
281
|
title: 'Native/Design/Session actions',
|
|
283
282
|
component: Flow,
|
|
284
283
|
tags: ['style-system', 'mockup', 'native'],
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { railSession } from '@agimon-ai/po-core/webTesting';
|
|
2
|
+
import { Button, fontOf, Input } from '@agimon-ai/po-native-components';
|
|
3
|
+
import { Text, View } from 'react-native';
|
|
4
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
+
|
|
6
|
+
import { type DesignScheme, PhoneFrame } from './designFrame';
|
|
7
|
+
|
|
8
|
+
// Mirrors Web/Session/Lifecycle design. Static targets, not native runtime evidence.
|
|
9
|
+
const meta = { title: 'Native/Design/Session lifecycle', tags: ['style-system', 'mockup', 'native'] };
|
|
10
|
+
export default meta;
|
|
11
|
+
const STATES = [
|
|
12
|
+
{
|
|
13
|
+
id: 'opening',
|
|
14
|
+
label: 'Opening',
|
|
15
|
+
detail: 'Po is opening this session.',
|
|
16
|
+
activity: 'Restoring the session before work resumes.',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: 'waiting',
|
|
20
|
+
label: 'Waiting for profile',
|
|
21
|
+
detail: 'Po is waiting for the saved profile.',
|
|
22
|
+
activity: 'Work will resume after the profile and startup checks are ready.',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'ready',
|
|
26
|
+
label: 'Ready',
|
|
27
|
+
detail: 'Startup checks passed. You can continue.',
|
|
28
|
+
activity: 'Startup checks passed.',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'stopping',
|
|
32
|
+
label: 'Stopping',
|
|
33
|
+
detail: 'Po is stopping this session.',
|
|
34
|
+
activity: 'Waiting for the session to stop.',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'failed',
|
|
38
|
+
label: 'Could not open',
|
|
39
|
+
detail: 'A startup check failed. The conversation is still available.',
|
|
40
|
+
activity: 'Startup stopped before work could resume.',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'paused',
|
|
44
|
+
label: 'Recovery paused',
|
|
45
|
+
detail: 'Automatic recovery paused after repeated failures.',
|
|
46
|
+
activity: 'Po will not keep reopening this session automatically.',
|
|
47
|
+
},
|
|
48
|
+
] as const;
|
|
49
|
+
type State = { id: (typeof STATES)[number]['id']; label: string; detail: string; activity: string };
|
|
50
|
+
|
|
51
|
+
function Status({ state }: { state: State }) {
|
|
52
|
+
const progress = ['opening', 'waiting', 'stopping'].includes(state.id);
|
|
53
|
+
return (
|
|
54
|
+
<View style={styles.status}>
|
|
55
|
+
<View style={[styles.dot, progress ? styles.progress : state.id === 'failed' ? styles.failureDot : null]} />
|
|
56
|
+
<Text style={[styles.secondary, state.id === 'failed' ? styles.failure : null]}>{state.label}</Text>
|
|
57
|
+
</View>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function Session({ state }: { state: State }) {
|
|
62
|
+
return (
|
|
63
|
+
<View style={styles.screen}>
|
|
64
|
+
<View style={styles.header}>
|
|
65
|
+
<Text style={styles.title}>Review component stories</Text>
|
|
66
|
+
<Status state={state} />
|
|
67
|
+
</View>
|
|
68
|
+
<View style={styles.body}>
|
|
69
|
+
<Text style={styles.heading}>Activity</Text>
|
|
70
|
+
<Text style={styles.secondary}>{state.activity}</Text>
|
|
71
|
+
<View style={styles.history}>
|
|
72
|
+
<Text style={styles.bodyText}>Review the component stories before release.</Text>
|
|
73
|
+
<Text style={styles.secondary}>
|
|
74
|
+
The recorded conversation stays available while the session changes state.
|
|
75
|
+
</Text>
|
|
76
|
+
</View>
|
|
77
|
+
<View style={styles.space} />
|
|
78
|
+
{state.id === 'ready' ? (
|
|
79
|
+
<View style={styles.panel}>
|
|
80
|
+
<Input accessibilityLabel="Message" placeholder="Message Po…" />
|
|
81
|
+
<Button variant="primary" disabled>
|
|
82
|
+
Send
|
|
83
|
+
</Button>
|
|
84
|
+
</View>
|
|
85
|
+
) : (
|
|
86
|
+
<View style={styles.panel}>
|
|
87
|
+
<Text style={[styles.heading, state.id === 'failed' ? styles.failure : null]}>{state.label}</Text>
|
|
88
|
+
<Text style={styles.secondary}>{state.detail}</Text>
|
|
89
|
+
{state.id === 'failed' ? <Button variant="primary">Retry opening</Button> : null}
|
|
90
|
+
{state.id === 'paused' ? <Button variant="outline">Wake session</Button> : null}
|
|
91
|
+
</View>
|
|
92
|
+
)}
|
|
93
|
+
</View>
|
|
94
|
+
</View>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function List({ scheme }: { scheme: DesignScheme }) {
|
|
99
|
+
return (
|
|
100
|
+
<PhoneFrame scheme={scheme}>
|
|
101
|
+
<View style={styles.rail}>
|
|
102
|
+
<Text style={styles.title}>Sessions</Text>
|
|
103
|
+
<Text style={styles.secondary}>po / Review component stories</Text>
|
|
104
|
+
{STATES.map((state) => {
|
|
105
|
+
const session = railSession({ id: state.id, name: 'Review component stories', status: state.label });
|
|
106
|
+
return (
|
|
107
|
+
<View key={state.id} style={styles.row}>
|
|
108
|
+
<Text style={styles.heading}>{session.name}</Text>
|
|
109
|
+
<Status state={state} />
|
|
110
|
+
<Text style={styles.secondary}>{state.detail}</Text>
|
|
111
|
+
</View>
|
|
112
|
+
);
|
|
113
|
+
})}
|
|
114
|
+
</View>
|
|
115
|
+
</PhoneFrame>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function Sessions({ scheme }: { scheme: DesignScheme }) {
|
|
120
|
+
return (
|
|
121
|
+
<PhoneFrame scheme={scheme} width={1254} height={1728}>
|
|
122
|
+
<View style={styles.filmstrip}>
|
|
123
|
+
{STATES.map((state) => (
|
|
124
|
+
<View key={state.id} style={styles.phone}>
|
|
125
|
+
<Session state={state} />
|
|
126
|
+
</View>
|
|
127
|
+
))}
|
|
128
|
+
</View>
|
|
129
|
+
</PhoneFrame>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
function Single({ state }: { state: State }) {
|
|
133
|
+
return (
|
|
134
|
+
<PhoneFrame scheme="light">
|
|
135
|
+
<Session state={state} />
|
|
136
|
+
</PhoneFrame>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
export const Playground = { render: () => <List scheme="light" /> };
|
|
140
|
+
export const ListLight = { render: () => <List scheme="light" /> };
|
|
141
|
+
export const ListDark = { render: () => <List scheme="dark" /> };
|
|
142
|
+
export const SessionsLight = { render: () => <Sessions scheme="light" /> };
|
|
143
|
+
export const SessionsDark = { render: () => <Sessions scheme="dark" /> };
|
|
144
|
+
export const Opening = { render: () => <Single state={STATES[0]} /> };
|
|
145
|
+
export const Waiting = { render: () => <Single state={STATES[1]} /> };
|
|
146
|
+
export const Ready = { render: () => <Single state={STATES[2]} /> };
|
|
147
|
+
export const Stopping = { render: () => <Single state={STATES[3]} /> };
|
|
148
|
+
export const Failed = { render: () => <Single state={STATES[4]} /> };
|
|
149
|
+
export const Paused = { render: () => <Single state={STATES[5]} /> };
|
|
150
|
+
export const WaitingProvider = {
|
|
151
|
+
render: () => (
|
|
152
|
+
<Single
|
|
153
|
+
state={{
|
|
154
|
+
...STATES[1],
|
|
155
|
+
label: 'Waiting for provider',
|
|
156
|
+
detail: 'Po is waiting for the model provider to be ready.',
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
),
|
|
160
|
+
};
|
|
161
|
+
export const WaitingPlugin = {
|
|
162
|
+
render: () => (
|
|
163
|
+
<Single
|
|
164
|
+
state={{ ...STATES[1], label: 'Waiting for startup check', detail: 'Po is waiting for a plugin startup check.' }}
|
|
165
|
+
/>
|
|
166
|
+
),
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const styles = StyleSheet.create((theme) => ({
|
|
170
|
+
filmstrip: { flexDirection: 'row', flexWrap: 'wrap', gap: theme.spacing(3), backgroundColor: theme.colors.rail },
|
|
171
|
+
phone: { width: 402, height: 852 },
|
|
172
|
+
screen: { flex: 1, backgroundColor: theme.colors.bg },
|
|
173
|
+
rail: { flex: 1, padding: theme.spacing(4), gap: theme.spacing(3), backgroundColor: theme.colors.rail },
|
|
174
|
+
header: { padding: theme.spacing(4), gap: theme.spacing(2), borderBottomWidth: 1, borderColor: theme.colors.border },
|
|
175
|
+
title: {
|
|
176
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
177
|
+
fontWeight: '600',
|
|
178
|
+
fontSize: theme.fontSize.lg,
|
|
179
|
+
color: theme.colors.hi,
|
|
180
|
+
},
|
|
181
|
+
heading: {
|
|
182
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
183
|
+
fontWeight: '600',
|
|
184
|
+
fontSize: theme.fontSize.base,
|
|
185
|
+
color: theme.colors.hi,
|
|
186
|
+
},
|
|
187
|
+
bodyText: { fontFamily: fontOf(theme.fontFamily.sans), fontSize: theme.fontSize.lg, color: theme.colors.text },
|
|
188
|
+
secondary: {
|
|
189
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
190
|
+
fontSize: theme.fontSize.sm,
|
|
191
|
+
lineHeight: theme.lineHeight.sm,
|
|
192
|
+
color: theme.colors.dim,
|
|
193
|
+
},
|
|
194
|
+
body: { flex: 1, padding: theme.spacing(4), paddingBottom: theme.spacing(10), gap: theme.spacing(3) },
|
|
195
|
+
space: { flex: 1 },
|
|
196
|
+
history: { gap: theme.spacing(4), paddingVertical: theme.spacing(6) },
|
|
197
|
+
panel: {
|
|
198
|
+
borderWidth: 1,
|
|
199
|
+
borderColor: theme.colors.border,
|
|
200
|
+
borderRadius: theme.borderRadius.lg,
|
|
201
|
+
backgroundColor: theme.colors.panel,
|
|
202
|
+
padding: theme.spacing(4),
|
|
203
|
+
gap: theme.spacing(3),
|
|
204
|
+
},
|
|
205
|
+
row: {
|
|
206
|
+
borderBottomWidth: 1,
|
|
207
|
+
borderColor: theme.colors.border,
|
|
208
|
+
paddingVertical: theme.spacing(3),
|
|
209
|
+
gap: theme.spacing(2),
|
|
210
|
+
},
|
|
211
|
+
status: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2) },
|
|
212
|
+
dot: {
|
|
213
|
+
width: theme.spacing(2),
|
|
214
|
+
height: theme.spacing(2),
|
|
215
|
+
borderRadius: theme.borderRadius.full,
|
|
216
|
+
backgroundColor: theme.colors.dim,
|
|
217
|
+
},
|
|
218
|
+
progress: { backgroundColor: theme.colors.green },
|
|
219
|
+
failureDot: { backgroundColor: theme.colors.red },
|
|
220
|
+
failure: { color: theme.colors.red },
|
|
221
|
+
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RemoteAccessStateView } from '@agimon-ai/po-core/remoteContract';
|
|
2
|
-
import { PoNativeProvider, Select } from '@agimon-ai/po-native-components';
|
|
2
|
+
import { IdCardIcon, PoNativeProvider, Select } from '@agimon-ai/po-native-components';
|
|
3
3
|
import type {
|
|
4
4
|
LoginFlowSnapshot,
|
|
5
5
|
ProviderAuthSummary,
|
|
@@ -14,7 +14,7 @@ import type { Appearance } from '../app/appearance';
|
|
|
14
14
|
import { AppearanceScreen } from './AppearanceScreen';
|
|
15
15
|
import { ProvidersScreen } from './ProvidersScreen';
|
|
16
16
|
import { RemoteControlScreen } from './RemoteControlScreen';
|
|
17
|
-
import { CardBody, GlobalSettingsView, Group, SettingsScreen } from './SettingsScreen';
|
|
17
|
+
import { CardBody, GlobalSettingsView, Group, NavRow, SettingsScreen } from './SettingsScreen';
|
|
18
18
|
import { WorkspaceDefaultsScreen, WorkspaceHubView } from './WorkspaceSettingsScreen';
|
|
19
19
|
|
|
20
20
|
/** The runtime Settings screens over fixed data, for comparison with the approved Settings Parity targets. */
|
|
@@ -186,8 +186,12 @@ const PANEL_GROUPS = COMPUTERS.map((host) => ({
|
|
|
186
186
|
panels: [{ id: 'tools', pluginId: 'po-tools', label: 'Tools', detail: 'Which tools Po can use' }],
|
|
187
187
|
}));
|
|
188
188
|
/** The Global group as a signed-in teammate sees it: the team, the editor and its saved notice. */
|
|
189
|
-
const
|
|
189
|
+
const globalSection = (profile = false) => (
|
|
190
190
|
<Group label="Global" hint="Your portable preferences across hosts.">
|
|
191
|
+
{/* My profile is a page about the person, so it heads the Global card with its own mark. */}
|
|
192
|
+
{profile ? (
|
|
193
|
+
<NavRow Icon={IdCardIcon} title="My profile" value="Your profile, visible to agents." onPress={noop} />
|
|
194
|
+
) : null}
|
|
191
195
|
<CardBody>
|
|
192
196
|
<Select
|
|
193
197
|
title="Account network"
|
|
@@ -202,6 +206,7 @@ const GLOBAL_SECTION = (
|
|
|
202
206
|
<GlobalSettingsView yaml={'voice:\n language: de'} onChange={noop} onSave={noop} notice="Global settings saved." />
|
|
203
207
|
</Group>
|
|
204
208
|
);
|
|
209
|
+
const GLOBAL_SECTION = globalSection();
|
|
205
210
|
function AllHostsStory({
|
|
206
211
|
scheme,
|
|
207
212
|
updateRequired = false,
|
|
@@ -245,6 +250,24 @@ export const TeamRowDark = { render: () => <AllHostsStory scheme="dark" team="Ac
|
|
|
245
250
|
/** Global settings on the phone: a card's own controls sit at the inset of its rows. */
|
|
246
251
|
export const GlobalLight = { render: () => <AllHostsStory scheme="light" global /> };
|
|
247
252
|
export const GlobalDark = { render: () => <AllHostsStory scheme="dark" global /> };
|
|
253
|
+
function GlobalProfileStory({ scheme }: { scheme: 'light' | 'dark' }) {
|
|
254
|
+
return (
|
|
255
|
+
<Phone scheme={scheme}>
|
|
256
|
+
<SettingsScreen
|
|
257
|
+
hostAddress="MacBook"
|
|
258
|
+
providers="3 connected"
|
|
259
|
+
appearance="Match iPhone"
|
|
260
|
+
globalSection={globalSection(true)}
|
|
261
|
+
onOpen={noop}
|
|
262
|
+
onOpenPanel={noop}
|
|
263
|
+
onForgetHost={noop}
|
|
264
|
+
/>
|
|
265
|
+
</Phone>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
/** One computer: My profile leaves Features and heads the Global card. */
|
|
269
|
+
export const GlobalProfileLight = { render: () => <GlobalProfileStory scheme="light" /> };
|
|
270
|
+
export const GlobalProfileDark = { render: () => <GlobalProfileStory scheme="dark" /> };
|
|
248
271
|
|
|
249
272
|
export const AppearanceLight = { render: () => <AppearanceStory scheme="light" initial="system" /> };
|
|
250
273
|
export const AppearanceDark = { render: () => <AppearanceStory scheme="dark" initial="dark" /> };
|
|
@@ -63,6 +63,7 @@ export function createConnection(options: ConnectionOptions): Connection {
|
|
|
63
63
|
onSessions: (sessions) => options.onSessions(sessions),
|
|
64
64
|
onWorkspaces: (workspaces) => options.onWorkspaces(workspaces),
|
|
65
65
|
onAccess: (rights) => options.onAccess?.(rights),
|
|
66
|
+
onLifecycle: (snapshots) => options.onLifecycle?.(snapshots),
|
|
66
67
|
onNotice: (sessionId, frame) => options.onNotice(sessionId, frame),
|
|
67
68
|
onChannel: (frame) => options.onChannel(frame),
|
|
68
69
|
onThreadFrame: (sessionId, threadId, frame) => options.onThreadFrame(sessionId, threadId, frame),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { encodeBase64 } from '@agimon-ai/po-core/native';
|
|
2
|
+
import { PROFILE_ICON_MAX_DATA_URL_LENGTH, PROFILE_ICON_MIME_TYPES } from '@agimon-ai/po-core/profileIdentity';
|
|
2
3
|
import {
|
|
3
4
|
type ApiResult,
|
|
4
5
|
type WebTemplateRailWorkspaceDiscovery,
|
|
@@ -182,11 +183,18 @@ export async function createGeneralSession(
|
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
/** An image reply as a data URI, the native stand-in for the web's blob URL; a data URI holds no handle to release. */
|
|
185
|
-
async function imageDataUri(response: Response, what: string): Promise<string> {
|
|
186
|
+
async function imageDataUri(response: Response, what: string, avatar = false): Promise<string> {
|
|
186
187
|
if (!response.ok) throw new Error(`The ${what} could not be loaded (${String(response.status)}).`);
|
|
187
188
|
const type = response.headers.get('content-type')?.split(';', 1)[0]?.trim().toLowerCase() ?? '';
|
|
188
189
|
if (!type.startsWith('image/')) throw new Error(`The ${what} is not an image.`);
|
|
189
|
-
|
|
190
|
+
if (avatar && !PROFILE_ICON_MIME_TYPES.some((mime) => mime === type))
|
|
191
|
+
throw new Error(`The ${what} must be PNG, JPEG, GIF or WebP, not SVG or another image format.`);
|
|
192
|
+
const prefix = `data:${type};base64,`;
|
|
193
|
+
const tooLarge = (bytes: number) => prefix.length + Math.ceil(bytes / 3) * 4 > PROFILE_ICON_MAX_DATA_URL_LENGTH;
|
|
194
|
+
if (avatar && tooLarge(Number(response.headers.get('content-length')))) throw new Error(`The ${what} is too large.`);
|
|
195
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
196
|
+
if (avatar && tooLarge(bytes.byteLength)) throw new Error(`The ${what} is too large.`);
|
|
197
|
+
return `${prefix}${encodeBase64(bytes)}`;
|
|
190
198
|
}
|
|
191
199
|
|
|
192
200
|
/**
|
|
@@ -200,12 +208,20 @@ export async function loadSessionImage(sessionId: string, path: string): Promise
|
|
|
200
208
|
|
|
201
209
|
/** A session's profile avatar. SVG is refused, since React Native's Image cannot draw it; the card keeps its initials. */
|
|
202
210
|
export async function loadSessionAvatar(sessionId: string, iconVersion: string): Promise<string> {
|
|
203
|
-
|
|
211
|
+
return imageDataUri(
|
|
204
212
|
await nativeApiTransport(`${sessionApiPath(sessionId)}/avatar?v=${encodeURIComponent(iconVersion)}`),
|
|
205
213
|
'session avatar',
|
|
214
|
+
true,
|
|
206
215
|
);
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** A recorded participant's avatar on the session's owning host; missing pictures keep the initials. */
|
|
219
|
+
export async function loadParticipantAvatar(sessionId: string, profileId: string): Promise<string | undefined> {
|
|
220
|
+
const response = await nativeApiTransport(
|
|
221
|
+
`${sessionApiPath(sessionId)}/plugins/profile/person/${encodeURIComponent(profileId)}/avatar`,
|
|
222
|
+
);
|
|
223
|
+
if (response.status === 404) return undefined;
|
|
224
|
+
return imageDataUri(response, 'participant avatar', true);
|
|
209
225
|
}
|
|
210
226
|
|
|
211
227
|
/** Stores one picked file on the host, as the web composer does, so a tool can be handed its path. */
|