@agimon-ai/po-native 0.0.1-alpha.44 → 0.0.1-alpha.45
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 +64 -11
- package/src/app/railWorkspaces.ts +5 -4
- package/src/app/sessionAvatars.ts +52 -0
- package/src/screens/Grants.stories.tsx +177 -1
- package/src/screens/HomeScreen.tsx +42 -20
- package/src/services/hostActions/index.ts +21 -8
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.45",
|
|
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.165",
|
|
33
|
+
"@agimon-ai/po-expo-signing": "0.0.1-alpha.45",
|
|
34
|
+
"@agimon-ai/po-identity": "0.0.2-alpha.112",
|
|
35
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.165",
|
|
36
|
+
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.37",
|
|
37
|
+
"@agimon-ai/po-template-advanced": "0.0.0-alpha.165",
|
|
38
|
+
"@agimon-ai/po-template-elegant": "0.0.0-alpha.165",
|
|
39
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.165",
|
|
40
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.165",
|
|
41
|
+
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.165",
|
|
42
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.165",
|
|
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.1",
|
package/src/app/App.tsx
CHANGED
|
@@ -72,6 +72,7 @@ import {
|
|
|
72
72
|
workspacesStore,
|
|
73
73
|
useRailEntries,
|
|
74
74
|
useRailEntry,
|
|
75
|
+
personaInitials,
|
|
75
76
|
railSessionStatus,
|
|
76
77
|
liveSessionOptions,
|
|
77
78
|
mentionableSessions,
|
|
@@ -140,7 +141,7 @@ import {
|
|
|
140
141
|
useState,
|
|
141
142
|
useSyncExternalStore,
|
|
142
143
|
} from 'react';
|
|
143
|
-
import { Alert, AppState, Keyboard, Linking, Text, View } from 'react-native';
|
|
144
|
+
import { Alert, AppState, Image, Keyboard, Linking, Text, View } from 'react-native';
|
|
144
145
|
import { KeyboardAvoidingView, KeyboardProvider } from 'react-native-keyboard-controller';
|
|
145
146
|
import { randomBytes } from 'react-native-quick-crypto';
|
|
146
147
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
@@ -277,6 +278,7 @@ import {
|
|
|
277
278
|
} from './nativeTemplate';
|
|
278
279
|
import { loadOtherWorkspacesOpen, otherWorkspacesOpenStore, setOtherWorkspacesOpen } from './otherWorkspaces';
|
|
279
280
|
import { useRailWorkspaces } from './railWorkspaces';
|
|
281
|
+
import { useSessionAvatars } from './sessionAvatars';
|
|
280
282
|
import { SessionSharingRoute, type SharingTarget } from './SessionSharingRoute';
|
|
281
283
|
import { loadSessionView, sessionViewStore, setSessionView } from './sessionView';
|
|
282
284
|
import { TeamRoute } from './TeamRoute';
|
|
@@ -755,6 +757,9 @@ function SessionRoute({
|
|
|
755
757
|
const entry = useRailEntry(sessionId);
|
|
756
758
|
const card = useMemo(() => (entry === undefined ? undefined : railSessionStatus(entry, Date.now())), [entry]);
|
|
757
759
|
const summary = entry?.summary;
|
|
760
|
+
// Who is on the session, as its card in the list says it: the profile's face and name.
|
|
761
|
+
const agent = summary?.profile === undefined ? undefined : (summary.profile.displayName ?? summary.profile.name);
|
|
762
|
+
const avatarUrl = useSessionAvatars([sessionId], entry === undefined ? {} : { [sessionId]: entry })[sessionId];
|
|
758
763
|
const activityLoad = useActivityLoad(splitHostId(sessionId)?.hostId, [
|
|
759
764
|
'catalog',
|
|
760
765
|
'host',
|
|
@@ -781,16 +786,38 @@ function SessionRoute({
|
|
|
781
786
|
headerTitle: () =>
|
|
782
787
|
templateHeader?.title ?? (
|
|
783
788
|
<View style={styles.headerTitle}>
|
|
784
|
-
<
|
|
785
|
-
{
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
789
|
+
<View style={styles.headerRow}>
|
|
790
|
+
{agent === undefined ? null : (
|
|
791
|
+
<View
|
|
792
|
+
style={styles.headerAvatar}
|
|
793
|
+
importantForAccessibility="no-hide-descendants"
|
|
794
|
+
accessibilityElementsHidden
|
|
795
|
+
>
|
|
796
|
+
{avatarUrl === undefined ? (
|
|
797
|
+
<Text style={styles.headerInitials}>{personaInitials(agent)}</Text>
|
|
798
|
+
) : (
|
|
799
|
+
<Image source={{ uri: avatarUrl }} style={styles.headerAvatarImage} />
|
|
800
|
+
)}
|
|
801
|
+
</View>
|
|
802
|
+
)}
|
|
803
|
+
<Text style={styles.headerName} numberOfLines={1}>
|
|
804
|
+
{route.params.title}
|
|
792
805
|
</Text>
|
|
793
|
-
|
|
806
|
+
</View>
|
|
807
|
+
<View style={styles.headerRow}>
|
|
808
|
+
{agent === undefined ? null : (
|
|
809
|
+
<Text style={styles.headerAgent} numberOfLines={1}>
|
|
810
|
+
{status ? `${agent} ·` : agent}
|
|
811
|
+
</Text>
|
|
812
|
+
)}
|
|
813
|
+
{card?.clock ? (
|
|
814
|
+
<LiveDuration style={styles.headerStatus(tone)} label={card.clock.label} since={card.clock.since} />
|
|
815
|
+
) : status ? (
|
|
816
|
+
<Text style={styles.headerStatus(tone)} numberOfLines={1}>
|
|
817
|
+
{status}
|
|
818
|
+
</Text>
|
|
819
|
+
) : null}
|
|
820
|
+
</View>
|
|
794
821
|
</View>
|
|
795
822
|
),
|
|
796
823
|
headerRight: () =>
|
|
@@ -814,7 +841,7 @@ function SessionRoute({
|
|
|
814
841
|
</Button>
|
|
815
842
|
),
|
|
816
843
|
}),
|
|
817
|
-
[busy, waiting, status, tone, card?.clock, route.params.title, templateHeader],
|
|
844
|
+
[busy, waiting, status, tone, card?.clock, route.params.title, templateHeader, agent, avatarUrl],
|
|
818
845
|
);
|
|
819
846
|
useFocusEffect(
|
|
820
847
|
useCallback(() => {
|
|
@@ -3704,18 +3731,44 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
3704
3731
|
backChevron: { transform: [{ rotate: '180deg' }] },
|
|
3705
3732
|
// On the Activity icon's top-right, ringed in the header's background.
|
|
3706
3733
|
activityBadge: { position: 'absolute', top: -6, right: -8, borderColor: theme.colors.bg },
|
|
3734
|
+
headerRow: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(1.5), maxWidth: '100%' },
|
|
3735
|
+
headerAvatar: {
|
|
3736
|
+
width: 20,
|
|
3737
|
+
height: 20,
|
|
3738
|
+
borderRadius: theme.borderRadius.full,
|
|
3739
|
+
alignItems: 'center',
|
|
3740
|
+
justifyContent: 'center',
|
|
3741
|
+
overflow: 'hidden',
|
|
3742
|
+
backgroundColor: theme.colors['tint-green'],
|
|
3743
|
+
},
|
|
3744
|
+
headerAvatarImage: { width: '100%', height: '100%' },
|
|
3745
|
+
headerInitials: {
|
|
3746
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
3747
|
+
fontSize: 9,
|
|
3748
|
+
fontWeight: theme.fontWeight.semibold,
|
|
3749
|
+
color: theme.colors.green,
|
|
3750
|
+
},
|
|
3707
3751
|
headerName: {
|
|
3708
3752
|
fontFamily: fontOf(theme.fontFamily.sans),
|
|
3709
3753
|
fontSize: theme.fontSize.lg,
|
|
3710
3754
|
lineHeight: theme.lineHeight.lg,
|
|
3711
3755
|
fontWeight: theme.fontWeight.semibold,
|
|
3712
3756
|
color: theme.colors.hi,
|
|
3757
|
+
flexShrink: 1,
|
|
3758
|
+
},
|
|
3759
|
+
headerAgent: {
|
|
3760
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
3761
|
+
fontSize: theme.fontSize.sm,
|
|
3762
|
+
lineHeight: theme.lineHeight.sm,
|
|
3763
|
+
color: theme.colors.hi,
|
|
3764
|
+
flexShrink: 1,
|
|
3713
3765
|
},
|
|
3714
3766
|
headerStatus: (tone: 'running' | 'failed' | 'quiet') => ({
|
|
3715
3767
|
fontFamily: fontOf(theme.fontFamily.sans),
|
|
3716
3768
|
fontSize: theme.fontSize.sm,
|
|
3717
3769
|
lineHeight: theme.lineHeight.sm,
|
|
3718
3770
|
color: tone === 'running' ? theme.colors.yellow : tone === 'failed' ? theme.colors.red : theme.colors.dim,
|
|
3771
|
+
flexShrink: 1,
|
|
3719
3772
|
}),
|
|
3720
3773
|
// The session list sits on the rail surface, like the cockpit rail it mirrors.
|
|
3721
3774
|
tabPage: (rail: boolean) => ({
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { useStore } from '@tanstack/react-store';
|
|
11
11
|
import { useMemo } from 'react';
|
|
12
12
|
|
|
13
|
+
import { useSessionAvatars } from './sessionAvatars';
|
|
13
14
|
const NO_RESTARTS = {};
|
|
14
15
|
const NO_HOSTS: readonly { host: { id: string }; status: string }[] = [];
|
|
15
16
|
|
|
@@ -18,8 +19,7 @@ const NO_HOSTS: readonly { host: { id: string }; status: string }[] = [];
|
|
|
18
19
|
*
|
|
19
20
|
* Built once per change that the cards show; each card's LiveDuration ages its own clock.
|
|
20
21
|
*
|
|
21
|
-
* ponytail: no
|
|
22
|
-
* initials) and no restart state, since the phone cannot restart a session yet. Add both with those features.
|
|
22
|
+
* ponytail: no restart state, since the phone cannot restart a session yet. Add it with that feature.
|
|
23
23
|
*/
|
|
24
24
|
export function useRailWorkspaces(
|
|
25
25
|
hosts: readonly { host: { id: string }; status: string }[] = NO_HOSTS,
|
|
@@ -29,6 +29,7 @@ export function useRailWorkspaces(
|
|
|
29
29
|
const activeId = useStore(sessionsStore, (state) => state.activeId);
|
|
30
30
|
const workspaceOrder = useStore(workspacesStore, (state) => state.order);
|
|
31
31
|
const workspacesById = useStore(workspacesStore, (state) => state.byId);
|
|
32
|
+
const avatarUrls = useSessionAvatars(order, byId);
|
|
32
33
|
|
|
33
34
|
return useMemo(
|
|
34
35
|
() =>
|
|
@@ -42,11 +43,11 @@ export function useRailWorkspaces(
|
|
|
42
43
|
nested: railParentIds(byId, order),
|
|
43
44
|
now: Date.now(),
|
|
44
45
|
restarts: NO_RESTARTS,
|
|
45
|
-
avatarUrls
|
|
46
|
+
avatarUrls,
|
|
46
47
|
}),
|
|
47
48
|
hosts,
|
|
48
49
|
),
|
|
49
|
-
[order, byId, activeId, workspaceOrder, workspacesById, hosts],
|
|
50
|
+
[order, byId, activeId, workspaceOrder, workspacesById, hosts, avatarUrls],
|
|
50
51
|
);
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { useRailEntries } from '@agimon-ai/po-web-dashboard/core';
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { loadSessionAvatar } from '../services/hostActions';
|
|
5
|
+
|
|
6
|
+
// Shared by every rail on screen, so sessions and rails showing one persona fetch its image once.
|
|
7
|
+
// ponytail: never evicted. Avatars are small and few; add eviction if profiles ever churn at scale.
|
|
8
|
+
const loads = new Map<string, Promise<string | undefined>>();
|
|
9
|
+
|
|
10
|
+
/** Each session's profile avatar as a data URI, keyed by session id. The web twin is po-web-dashboard's hook. */
|
|
11
|
+
export function useSessionAvatars(
|
|
12
|
+
order: readonly string[],
|
|
13
|
+
byId: ReturnType<typeof useRailEntries>,
|
|
14
|
+
): Readonly<Record<string, string>> {
|
|
15
|
+
const wanted = order.flatMap((id) => {
|
|
16
|
+
const profile = byId[id]?.summary.profile;
|
|
17
|
+
return profile?.iconVersion === undefined
|
|
18
|
+
? []
|
|
19
|
+
: [{ id, key: `${profile.name}:${profile.iconVersion}`, version: profile.iconVersion }];
|
|
20
|
+
});
|
|
21
|
+
const wantedKey = wanted.map(({ id, key }) => `${id}=${key}`).join('\n');
|
|
22
|
+
const [loaded, setLoaded] = useState<Readonly<Record<string, string>>>({});
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
let live = true;
|
|
26
|
+
for (const { id, key, version } of wanted) {
|
|
27
|
+
let load = loads.get(key);
|
|
28
|
+
if (load === undefined) {
|
|
29
|
+
// A failed load leaves the initials in place and is forgotten, so the next rail change retries.
|
|
30
|
+
load = loadSessionAvatar(id, version).catch(() => {
|
|
31
|
+
loads.delete(key);
|
|
32
|
+
return undefined;
|
|
33
|
+
});
|
|
34
|
+
loads.set(key, load);
|
|
35
|
+
}
|
|
36
|
+
void load.then((url) => {
|
|
37
|
+
if (live && url !== undefined)
|
|
38
|
+
setLoaded((previous) => (previous[key] === url ? previous : { ...previous, [key]: url }));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return () => {
|
|
42
|
+
live = false;
|
|
43
|
+
};
|
|
44
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- `wanted` is rebuilt each render; `wantedKey` tracks its content.
|
|
45
|
+
}, [wantedKey]);
|
|
46
|
+
|
|
47
|
+
return useMemo(
|
|
48
|
+
() => Object.fromEntries(wanted.flatMap(({ id, key }) => (loaded[key] === undefined ? [] : [[id, loaded[key]]]))),
|
|
49
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- as above.
|
|
50
|
+
[wantedKey, loaded],
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Button, fontOf, GlobeIcon, LockIcon, MonitorIcon, Panel, SectionLabel } from '@agimon-ai/po-native-components';
|
|
2
|
+
import { type ReactNode, useState } from 'react';
|
|
3
|
+
import { Text, View } from 'react-native';
|
|
4
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
5
|
|
|
3
6
|
import { GrantNotice, SignInAsk } from '../components/GrantNotice';
|
|
4
7
|
import { PhoneFrame } from './designFrame';
|
|
@@ -64,3 +67,176 @@ export const SignInAskDark = {
|
|
|
64
67
|
</PhoneFrame>
|
|
65
68
|
),
|
|
66
69
|
};
|
|
70
|
+
|
|
71
|
+
// Additive preview targets. Runtime notices and the earlier fixtures are unchanged.
|
|
72
|
+
const RENEWING_PERMISSION = 'Renewing permission';
|
|
73
|
+
const signInTarget = {
|
|
74
|
+
icon: <GlobeIcon size={20} color="magenta" />,
|
|
75
|
+
title: 'Keep your sessions close',
|
|
76
|
+
description: 'Sign in with Po. Your paired computers keep working.',
|
|
77
|
+
action: 'Sign in with Po',
|
|
78
|
+
};
|
|
79
|
+
const permissionTarget = {
|
|
80
|
+
icon: <LockIcon size={20} color="magenta" />,
|
|
81
|
+
title: 'Pick up shared work',
|
|
82
|
+
description: 'Renew permission for the part on another host. Work here can continue.',
|
|
83
|
+
action: 'Renew permission',
|
|
84
|
+
};
|
|
85
|
+
const connectionTarget = {
|
|
86
|
+
icon: <MonitorIcon size={20} color="magenta" />,
|
|
87
|
+
title: 'Reconnect to Studio Mac',
|
|
88
|
+
description: 'This phone is still paired. Restore the connection when you are ready.',
|
|
89
|
+
action: 'Restore connection',
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
function ReminderTarget({
|
|
93
|
+
icon,
|
|
94
|
+
title,
|
|
95
|
+
description,
|
|
96
|
+
action,
|
|
97
|
+
busy = false,
|
|
98
|
+
notice,
|
|
99
|
+
onAction = noop,
|
|
100
|
+
}: {
|
|
101
|
+
icon: ReactNode;
|
|
102
|
+
title: string;
|
|
103
|
+
description: string;
|
|
104
|
+
action: string;
|
|
105
|
+
busy?: boolean;
|
|
106
|
+
notice?: string;
|
|
107
|
+
onAction?: () => void;
|
|
108
|
+
}) {
|
|
109
|
+
return (
|
|
110
|
+
<Panel style={reminderStyles.card}>
|
|
111
|
+
<View style={reminderStyles.header}>
|
|
112
|
+
<View style={reminderStyles.icon} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
113
|
+
{icon}
|
|
114
|
+
</View>
|
|
115
|
+
<View style={reminderStyles.copy}>
|
|
116
|
+
<Text accessibilityRole="header" style={reminderStyles.title}>
|
|
117
|
+
{title}
|
|
118
|
+
</Text>
|
|
119
|
+
<Text style={reminderStyles.body}>{description}</Text>
|
|
120
|
+
</View>
|
|
121
|
+
</View>
|
|
122
|
+
{notice ? (
|
|
123
|
+
<Text accessibilityRole="alert" accessibilityLiveRegion="polite" style={reminderStyles.error}>
|
|
124
|
+
{notice}
|
|
125
|
+
</Text>
|
|
126
|
+
) : null}
|
|
127
|
+
<Button
|
|
128
|
+
variant="success"
|
|
129
|
+
size="lg"
|
|
130
|
+
loading={busy}
|
|
131
|
+
loadingLabel={RENEWING_PERMISSION}
|
|
132
|
+
style={reminderStyles.action}
|
|
133
|
+
onPress={onAction}
|
|
134
|
+
>
|
|
135
|
+
{busy ? RENEWING_PERMISSION : action}
|
|
136
|
+
</Button>
|
|
137
|
+
</Panel>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function ReminderPreview({ scheme = 'light' }: { scheme?: 'light' | 'dark' }) {
|
|
142
|
+
return (
|
|
143
|
+
<PhoneFrame scheme={scheme}>
|
|
144
|
+
<View style={reminderStyles.screen}>
|
|
145
|
+
<SectionLabel>Alternative reminder states</SectionLabel>
|
|
146
|
+
<ReminderTarget {...signInTarget} />
|
|
147
|
+
<ReminderTarget {...permissionTarget} />
|
|
148
|
+
<ReminderTarget {...connectionTarget} />
|
|
149
|
+
</View>
|
|
150
|
+
</PhoneFrame>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const ReminderFamily = { render: () => <ReminderPreview /> };
|
|
155
|
+
export const ReminderFamilyDark = { render: () => <ReminderPreview scheme="dark" /> };
|
|
156
|
+
export const ReminderRenewing = {
|
|
157
|
+
render: () => (
|
|
158
|
+
<PhoneFrame scheme="light">
|
|
159
|
+
<View style={reminderStyles.screen}>
|
|
160
|
+
<ReminderTarget {...permissionTarget} busy />
|
|
161
|
+
</View>
|
|
162
|
+
</PhoneFrame>
|
|
163
|
+
),
|
|
164
|
+
};
|
|
165
|
+
export const ReminderRetry = {
|
|
166
|
+
render: () => (
|
|
167
|
+
<PhoneFrame scheme="light">
|
|
168
|
+
<View style={reminderStyles.screen}>
|
|
169
|
+
<ReminderTarget {...permissionTarget} notice="Permission could not be renewed. Try again when you are ready." />
|
|
170
|
+
</View>
|
|
171
|
+
</PhoneFrame>
|
|
172
|
+
),
|
|
173
|
+
};
|
|
174
|
+
export const ReminderLongContent = {
|
|
175
|
+
render: () => (
|
|
176
|
+
<PhoneFrame scheme="light" width={320}>
|
|
177
|
+
<View style={reminderStyles.screen}>
|
|
178
|
+
<ReminderTarget
|
|
179
|
+
{...connectionTarget}
|
|
180
|
+
title="Reconnect to Studio Mac in the shared research workspace"
|
|
181
|
+
description="This phone is still paired with your computer. Restore the connection whenever you are ready; the work on your other connected computers can continue."
|
|
182
|
+
/>
|
|
183
|
+
</View>
|
|
184
|
+
</PhoneFrame>
|
|
185
|
+
),
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
function InteractiveReminder() {
|
|
189
|
+
const [presses, setPresses] = useState(0);
|
|
190
|
+
return (
|
|
191
|
+
<PhoneFrame scheme="light">
|
|
192
|
+
<View style={reminderStyles.screen}>
|
|
193
|
+
<ReminderTarget {...permissionTarget} onAction={() => setPresses((value) => value + 1)} />
|
|
194
|
+
<Text accessibilityLiveRegion="polite" style={reminderStyles.body}>
|
|
195
|
+
Preview action count: {presses}. No permission is changed.
|
|
196
|
+
</Text>
|
|
197
|
+
</View>
|
|
198
|
+
</PhoneFrame>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export const ReminderInteractive = { render: () => <InteractiveReminder /> };
|
|
203
|
+
|
|
204
|
+
const reminderStyles = StyleSheet.create((theme) => ({
|
|
205
|
+
screen: { flex: 1, gap: theme.spacing(4), padding: theme.spacing(4), backgroundColor: theme.colors.bg },
|
|
206
|
+
card: {
|
|
207
|
+
gap: theme.spacing(4),
|
|
208
|
+
padding: theme.spacing(5),
|
|
209
|
+
borderRadius: theme.borderRadius.lg,
|
|
210
|
+
borderColor: theme.colors['border-soft'],
|
|
211
|
+
},
|
|
212
|
+
header: { flexDirection: 'row', alignItems: 'flex-start', gap: theme.spacing(3) },
|
|
213
|
+
icon: {
|
|
214
|
+
width: theme.spacing(10),
|
|
215
|
+
height: theme.spacing(10),
|
|
216
|
+
borderRadius: theme.borderRadius.lg,
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
justifyContent: 'center',
|
|
219
|
+
backgroundColor: theme.colors['tint-magenta'],
|
|
220
|
+
},
|
|
221
|
+
copy: { flex: 1, gap: theme.spacing(2) },
|
|
222
|
+
title: {
|
|
223
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
224
|
+
fontSize: theme.fontSize.base,
|
|
225
|
+
lineHeight: theme.lineHeight.base,
|
|
226
|
+
fontWeight: theme.fontWeight.semibold,
|
|
227
|
+
color: theme.colors.hi,
|
|
228
|
+
},
|
|
229
|
+
body: {
|
|
230
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
231
|
+
fontSize: theme.fontSize.base,
|
|
232
|
+
lineHeight: theme.lineHeightRelaxed.base,
|
|
233
|
+
color: theme.colors.dim,
|
|
234
|
+
},
|
|
235
|
+
action: { alignSelf: 'stretch', minHeight: theme.spacing(11) },
|
|
236
|
+
error: {
|
|
237
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
238
|
+
fontSize: theme.fontSize.base,
|
|
239
|
+
lineHeight: theme.lineHeightRelaxed.base,
|
|
240
|
+
color: theme.colors.red,
|
|
241
|
+
},
|
|
242
|
+
}));
|
|
@@ -322,7 +322,7 @@ const HomeToday = memo(function HomeToday({
|
|
|
322
322
|
) : rows.length === 0 ? (
|
|
323
323
|
<EmptyState title="Nothing yet today" description="What Po works on shows up here as it happens." />
|
|
324
324
|
) : (
|
|
325
|
-
shown.map((row) => <TimelineRow key={row.id} row={row} onOpen={onOpen} />)
|
|
325
|
+
shown.map((row, index) => <TimelineRow key={row.id} row={row} divided={index > 0} onOpen={onOpen} />)
|
|
326
326
|
)}
|
|
327
327
|
{!loading && (pages > 1 || showEarlier) ? (
|
|
328
328
|
<View style={styles.pager}>
|
|
@@ -365,31 +365,44 @@ const HomeToday = memo(function HomeToday({
|
|
|
365
365
|
);
|
|
366
366
|
});
|
|
367
367
|
|
|
368
|
-
/** One timeline row: the time
|
|
369
|
-
function TimelineRow({
|
|
368
|
+
/** One timeline row: the time, a status dot and who worked lead in a fixed column, then what happened and where. */
|
|
369
|
+
function TimelineRow({
|
|
370
|
+
row,
|
|
371
|
+
divided,
|
|
372
|
+
onOpen,
|
|
373
|
+
}: {
|
|
374
|
+
row: HomeActivityItem;
|
|
375
|
+
divided: boolean;
|
|
376
|
+
onOpen: (target: HomeTarget) => void;
|
|
377
|
+
}) {
|
|
370
378
|
// Each host passes its own icon component through the shared model; the phone's are native icons.
|
|
371
379
|
const Icon = row.icon as unknown as ComponentType<IconProps> | undefined;
|
|
372
380
|
return (
|
|
373
381
|
<ListRow
|
|
382
|
+
style={divided && styles.divided}
|
|
374
383
|
leading={
|
|
375
384
|
<View style={styles.lead}>
|
|
376
385
|
<Text style={styles.time}>{row.at}</Text>
|
|
377
386
|
<Dot tone={row.tone} />
|
|
378
|
-
{
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
387
|
+
{/* The slot stays when empty, so every title starts at the same indent. */}
|
|
388
|
+
<View style={styles.dotWell}>
|
|
389
|
+
{row.actor !== undefined ? (
|
|
390
|
+
<AgentAvatar name={row.actor.name} size="sm" />
|
|
391
|
+
) : Icon ? (
|
|
382
392
|
<Icon size={14} color="dim" />
|
|
383
|
-
|
|
384
|
-
|
|
393
|
+
) : null}
|
|
394
|
+
</View>
|
|
385
395
|
</View>
|
|
386
396
|
}
|
|
387
397
|
title={row.name}
|
|
388
398
|
description={
|
|
389
|
-
<View style={styles.
|
|
390
|
-
<Text style={styles.
|
|
391
|
-
|
|
392
|
-
|
|
399
|
+
<View style={styles.meta}>
|
|
400
|
+
<Text numberOfLines={2} style={styles.metaText}>
|
|
401
|
+
<Text style={styles.outcome(row.tone === 'red')}>{row.outcome}</Text>
|
|
402
|
+
{row.branch !== undefined ? ' · ' : null}
|
|
403
|
+
{row.branch !== undefined ? <Text style={styles.branch}>{row.branch}</Text> : null}
|
|
404
|
+
{row.source !== undefined ? ` · ${row.source}` : null}
|
|
405
|
+
</Text>
|
|
393
406
|
{row.host !== undefined ? <HostTag label={row.host} /> : null}
|
|
394
407
|
</View>
|
|
395
408
|
}
|
|
@@ -611,16 +624,25 @@ const styles = StyleSheet.create((theme, rt) => {
|
|
|
611
624
|
paddingBottom: rt.insets.bottom + TAB_BAR_CLEARANCE,
|
|
612
625
|
},
|
|
613
626
|
overviewDetail: { ...small, color: theme.colors.dim },
|
|
614
|
-
|
|
627
|
+
// Pinned to the title's line, so the time reads beside the title however tall the row grows.
|
|
628
|
+
lead: {
|
|
629
|
+
flexDirection: 'row',
|
|
630
|
+
alignItems: 'center',
|
|
631
|
+
alignSelf: 'flex-start',
|
|
632
|
+
gap: theme.spacing(2),
|
|
633
|
+
minHeight: theme.lineHeight.base,
|
|
634
|
+
},
|
|
615
635
|
time: { ...small, width: 40, color: theme.colors.dim, fontVariant: ['tabular-nums'] },
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
636
|
+
divided: { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: theme.colors['border-soft'] },
|
|
637
|
+
// The computer's tag sits beside a short status and drops to its own line under a long one.
|
|
638
|
+
meta: {
|
|
639
|
+
flexDirection: 'row',
|
|
640
|
+
flexWrap: 'wrap',
|
|
620
641
|
alignItems: 'center',
|
|
621
|
-
|
|
622
|
-
|
|
642
|
+
columnGap: theme.spacing(2),
|
|
643
|
+
rowGap: theme.spacing(0.5),
|
|
623
644
|
},
|
|
645
|
+
metaText: { ...small, maxWidth: '100%', color: theme.colors.dim },
|
|
624
646
|
dotWell: { width: 24, height: 24, alignItems: 'center', justifyContent: 'center' },
|
|
625
647
|
detail: { gap: theme.spacing(0.5), alignItems: 'flex-start' },
|
|
626
648
|
outcome: (failed: boolean) => ({ ...small, color: failed ? theme.colors.red : theme.colors.text }),
|
|
@@ -175,18 +175,31 @@ export async function createGeneralSession(
|
|
|
175
175
|
return { sessionId: body.sessionId, ...(workspace ? { workspace } : {}), ...(session ? { session } : {}) };
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
/** 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. */
|
|
179
|
+
async function imageDataUri(response: Response, what: string): Promise<string> {
|
|
180
|
+
if (!response.ok) throw new Error(`The ${what} could not be loaded (${String(response.status)}).`);
|
|
181
|
+
const type = response.headers.get('content-type')?.split(';', 1)[0]?.trim().toLowerCase() ?? '';
|
|
182
|
+
if (!type.startsWith('image/')) throw new Error(`The ${what} is not an image.`);
|
|
183
|
+
return `data:${type};base64,${encodeBase64(new Uint8Array(await response.arrayBuffer()))}`;
|
|
184
|
+
}
|
|
185
|
+
|
|
178
186
|
/**
|
|
179
|
-
* One image a reply names by file or artifact reference, read from its guarded session route
|
|
180
|
-
*
|
|
187
|
+
* One image a reply names by file or artifact reference, read from its guarded session route.
|
|
188
|
+
* The owning route enforces its filesystem boundary.
|
|
181
189
|
*/
|
|
182
190
|
export async function loadSessionImage(sessionId: string, path: string): Promise<{ url: string; dispose(): void }> {
|
|
183
191
|
const response = await nativeApiTransport(sessionFileUrl(sessionId, path), { cache: 'no-store' });
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
192
|
+
return { url: await imageDataUri(response, 'session file'), dispose: () => {} };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** A session's profile avatar. SVG is refused, since React Native's Image cannot draw it; the card keeps its initials. */
|
|
196
|
+
export async function loadSessionAvatar(sessionId: string, iconVersion: string): Promise<string> {
|
|
197
|
+
const url = await imageDataUri(
|
|
198
|
+
await nativeApiTransport(`${sessionApiPath(sessionId)}/avatar?v=${encodeURIComponent(iconVersion)}`),
|
|
199
|
+
'session avatar',
|
|
200
|
+
);
|
|
201
|
+
if (url.startsWith('data:image/svg')) throw new Error('The session avatar is an SVG.');
|
|
202
|
+
return url;
|
|
190
203
|
}
|
|
191
204
|
|
|
192
205
|
/** Stores one picked file on the host, as the web composer does, so a tool can be handed its path. */
|