@agimon-ai/po-native 0.0.1-alpha.42 → 0.0.1-alpha.44

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-native",
3
- "version": "0.0.1-alpha.42",
3
+ "version": "0.0.1-alpha.44",
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.162",
33
- "@agimon-ai/po-expo-signing": "0.0.1-alpha.42",
34
- "@agimon-ai/po-identity": "0.0.2-alpha.109",
35
- "@agimon-ai/po-native-components": "0.0.0-alpha.162",
36
- "@agimon-ai/po-native-dashboard": "0.0.0-alpha.34",
37
- "@agimon-ai/po-template-advanced": "0.0.0-alpha.162",
38
- "@agimon-ai/po-template-elegant": "0.0.0-alpha.162",
39
- "@agimon-ai/po-voice": "0.0.0-alpha.162",
40
- "@agimon-ai/po-web-components": "0.0.0-alpha.162",
41
- "@agimon-ai/po-web-dashboard": "0.0.0-alpha.162",
42
- "@agimon-ai/po-web-security": "0.0.0-alpha.162",
32
+ "@agimon-ai/po-core": "0.0.0-alpha.164",
33
+ "@agimon-ai/po-expo-signing": "0.0.1-alpha.44",
34
+ "@agimon-ai/po-identity": "0.0.2-alpha.111",
35
+ "@agimon-ai/po-native-components": "0.0.0-alpha.164",
36
+ "@agimon-ai/po-native-dashboard": "0.0.0-alpha.36",
37
+ "@agimon-ai/po-template-advanced": "0.0.0-alpha.164",
38
+ "@agimon-ai/po-template-elegant": "0.0.0-alpha.164",
39
+ "@agimon-ai/po-voice": "0.0.0-alpha.164",
40
+ "@agimon-ai/po-web-components": "0.0.0-alpha.164",
41
+ "@agimon-ai/po-web-dashboard": "0.0.0-alpha.164",
42
+ "@agimon-ai/po-web-security": "0.0.0-alpha.164",
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
@@ -24,11 +24,13 @@ import {
24
24
  LiveDuration,
25
25
  PoNativeProvider,
26
26
  PlusIcon,
27
+ RailItem,
27
28
  Sheet,
28
29
  SheetContent,
29
30
  SheetHeader,
30
31
  SheetTitle,
31
32
  SheetBody,
33
+ UsersIcon,
32
34
  yieldSheets,
33
35
  } from '@agimon-ai/po-native-components';
34
36
  import {
@@ -77,7 +79,7 @@ import {
77
79
  resolveSessionReference,
78
80
  activityWaitingCount,
79
81
  sessionStoreFor,
80
- sessionMinorModes,
82
+ sessionModes,
81
83
  sessionToolRenderer,
82
84
  submitMessage,
83
85
  fileTabForPath,
@@ -275,6 +277,7 @@ import {
275
277
  } from './nativeTemplate';
276
278
  import { loadOtherWorkspacesOpen, otherWorkspacesOpenStore, setOtherWorkspacesOpen } from './otherWorkspaces';
277
279
  import { useRailWorkspaces } from './railWorkspaces';
280
+ import { SessionSharingRoute, type SharingTarget } from './SessionSharingRoute';
278
281
  import { loadSessionView, sessionViewStore, setSessionView } from './sessionView';
279
282
  import { TeamRoute } from './TeamRoute';
280
283
  import { useHome, useHomes } from './useHome';
@@ -409,8 +412,15 @@ function TabPage({
409
412
  /** The host drawer over every tab; each host counts its own sessions waiting for the person. */
410
413
  function HostDrawerRoute({
411
414
  hostStates,
415
+ onOpenPage,
416
+ onOpenTeam,
412
417
  ...props
413
- }: Omit<React.ComponentProps<typeof HostDrawer>, 'hosts'> & { hostStates: readonly HostRuntimeState[] }) {
418
+ }: Omit<React.ComponentProps<typeof HostDrawer>, 'hosts' | 'menu'> & {
419
+ hostStates: readonly HostRuntimeState[];
420
+ onOpenPage: (route: { pageId: string; title: string }) => void;
421
+ onOpenTeam: () => void;
422
+ }) {
423
+ useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
414
424
  const waiting = useStore(sessionsStore, (value) =>
415
425
  Object.entries(value.byId)
416
426
  .filter(
@@ -421,9 +431,56 @@ function HostDrawerRoute({
421
431
  .join(','),
422
432
  );
423
433
  const owners = waiting.split(',');
434
+ const team = useCachedRequest(HOSTED_TEAM_KEY, async () => (await hostedTeam())?.name);
435
+ const reloadTeam = team.reload;
436
+ useEffect(() => {
437
+ if (props.open) void reloadTeam();
438
+ }, [props.open, reloadTeam]);
439
+ // The web rail's plugin rows, once per plugin even when several computers serve it; the first computer opens it.
440
+ const seen = new Set<string>();
441
+ const rows = hostStates.flatMap(({ host }) =>
442
+ webPluginRegistryForHost(host.id)
443
+ .hostSlotFills(HOST_SLOTS.rail)
444
+ .flatMap((fill) => {
445
+ const key = JSON.stringify([splitHostId(fill.pluginId)?.localId ?? fill.pluginId, fill.id]);
446
+ if (fill.component === undefined || seen.has(key)) return [];
447
+ seen.add(key);
448
+ const itemProps = {
449
+ ...nativeSlotProps(null, {}, () => undefined),
450
+ openPage: (pageId: string) => {
451
+ props.onClose();
452
+ onOpenPage(homePageRoute(host.id, pageId));
453
+ },
454
+ };
455
+ const Item = fill.component as ComponentType<typeof itemProps>;
456
+ return [
457
+ <ToolRendererBoundary key={key} toolName={fill.id}>
458
+ {(failed) => (failed ? null : <Item {...itemProps} />)}
459
+ </ToolRendererBoundary>,
460
+ ];
461
+ }),
462
+ );
463
+ const menu =
464
+ rows.length > 0 || team.data ? (
465
+ <>
466
+ {rows}
467
+ {team.data ? (
468
+ <RailItem
469
+ icon={UsersIcon}
470
+ label="Team"
471
+ testID="team-open"
472
+ onPress={() => {
473
+ props.onClose();
474
+ onOpenTeam();
475
+ }}
476
+ />
477
+ ) : null}
478
+ </>
479
+ ) : undefined;
424
480
  return (
425
481
  <HostDrawer
426
482
  {...props}
483
+ {...(menu ? { menu } : {})}
427
484
  hosts={hostStates.map(({ host, status }) => ({
428
485
  id: host.id,
429
486
  label: hostDisplayName(host),
@@ -523,7 +580,7 @@ function LiveSessionScreen({
523
580
  const focused = useIsFocused();
524
581
  const TemplateSession = useNativeTemplateScreen('session', phoneTemplate, splitHostId(sessionId)?.hostId);
525
582
  const BundledSession = bundledNativeTemplateScreen('session');
526
- const askId = focused ? ownDialog?.id : undefined;
583
+ const askId = focused && !props.readOnly ? ownDialog?.id : undefined;
527
584
  // A prompt for this screen clears the sheets over it, whether it just arrived or was waiting when the
528
585
  // screen came back into focus. A dialog an options sheet claimed is that sheet's own step.
529
586
  useEffect(() => {
@@ -538,7 +595,7 @@ function LiveSessionScreen({
538
595
  const [unsent, setUnsent] = useState<string>();
539
596
  const reply = (askId: string, run: () => void) => setUnsent(whenConnected(sessionId, run) ? undefined : askId);
540
597
  const ask =
541
- ownDialog === null
598
+ ownDialog === null || props.readOnly
542
599
  ? undefined
543
600
  : {
544
601
  id: ownDialog.id,
@@ -769,7 +826,7 @@ function SessionRoute({
769
826
  const statuses = useStore(store, (state) => state.statuses);
770
827
  const [, modesChanged] = useState(0);
771
828
  // active() returns a fresh array, not a stable external-store snapshot.
772
- useEffect(() => sessionMinorModes.subscribe(sessionId, () => modesChanged((value) => value + 1)), [sessionId]);
829
+ useEffect(() => sessionModes.subscribe(sessionId, () => modesChanged((value) => value + 1)), [sessionId]);
773
830
  const wake = () => {
774
831
  setWaking(true);
775
832
  setWakeError(undefined);
@@ -962,7 +1019,10 @@ function SessionRoute({
962
1019
  <LiveSessionScreen
963
1020
  // Only the conversation is the template's; Activity detail pages stay the app's own.
964
1021
  {...(tab ? {} : { templated: true, phoneTemplate, header, setHeader: setTemplateHeader })}
965
- readOnly={Boolean(tab && (!tab.retainComposer || (tab.targetSessionId && summary?.dormant)))}
1022
+ readOnly={
1023
+ entry?.canInteract !== true ||
1024
+ Boolean(tab && (!tab.retainComposer || (tab.targetSessionId && summary?.dormant)))
1025
+ }
966
1026
  slotProps={slotProps}
967
1027
  markdown={markdown}
968
1028
  // Captures show as thumbnails in the composer, so only text context gets a chip.
@@ -1138,7 +1198,9 @@ function SessionRoute({
1138
1198
  load={activityLoad}
1139
1199
  onRetry={() => onRetryActivity(sessionId)}
1140
1200
  />
1141
- <SessionOptionsSheet sessionId={sessionId} open={optionsOpen} onOpenChange={setOptionsOpen} />
1201
+ {entry?.canInteract === true ? (
1202
+ <SessionOptionsSheet sessionId={sessionId} open={optionsOpen} onOpenChange={setOptionsOpen} />
1203
+ ) : null}
1142
1204
  </View>
1143
1205
  );
1144
1206
  }
@@ -1777,6 +1839,7 @@ function SessionsRoute({
1777
1839
  const sessionView = useStore(sessionViewStore, (view) => view);
1778
1840
  const [newSession, setNewSession] = useState<NewSessionTarget | null>(null);
1779
1841
  const creations = useRef(new WeakMap<NewSessionTarget, { pending: boolean; sessionId?: string }>());
1842
+ const [sharing, setSharing] = useState<SharingTarget | null>(null);
1780
1843
  const [choosingGeneralHost, setChoosingGeneralHost] = useState(false);
1781
1844
  const [resume, setResume] = useState<ResumeSource | null>(null);
1782
1845
  const [coordinatorTarget, setCoordinatorTarget] = useState<{
@@ -1922,8 +1985,32 @@ function SessionsRoute({
1922
1985
  });
1923
1986
  return allowGlobalActions ? run() : Promise.resolve({ error: HOST_OWNERSHIP_PENDING });
1924
1987
  };
1988
+ const sharingAvailable =
1989
+ sharing !== null &&
1990
+ canMutate(sharing.sessionId) &&
1991
+ hostStates.some(({ host, status }) => host.id === sharing.hostId && status === 'connected');
1992
+ useEffect(() => {
1993
+ if (sharing && !sharingAvailable) setSharing(null);
1994
+ }, [sharing, sharingAvailable]);
1925
1995
  const actions: NativeTemplateSessionsActions = {
1926
1996
  openSession: onOpen,
1997
+ openSessionSharing(sessionId) {
1998
+ if (!canMutate(sessionId)) return;
1999
+ const summary = sessionsStore.state.byId[sessionId]?.summary;
2000
+ const hostId = splitHostId(sessionId)?.hostId ?? actionHostId;
2001
+ if (!summary?.workspaceId || !hostId) {
2002
+ Alert.alert('Sharing unavailable', 'This session has no workspace or connected computer.');
2003
+ return;
2004
+ }
2005
+ const host = hostStates.find((entry) => entry.host.id === hostId)?.host;
2006
+ setSharing({
2007
+ sessionId,
2008
+ workspaceId: summary.workspaceId,
2009
+ hostId,
2010
+ name: summary.name || 'Untitled',
2011
+ hostName: host?.displayName ?? 'This computer',
2012
+ });
2013
+ },
1927
2014
  renameSession(sessionId, name) {
1928
2015
  if (!canMutate(sessionId)) return;
1929
2016
  const trimmed = name.trim();
@@ -2181,6 +2268,13 @@ function SessionsRoute({
2181
2268
  <TemplateSessions {...templateProps} />
2182
2269
  </NativeTemplateBoundary>
2183
2270
  )}
2271
+ {sharing && sharingAvailable ? (
2272
+ <SessionSharingRoute
2273
+ key={`${sharing.hostId}/${sharing.sessionId}`}
2274
+ target={sharing}
2275
+ onClose={() => setSharing(null)}
2276
+ />
2277
+ ) : null}
2184
2278
  <Sheet open={choosingGeneralHost} onOpenChange={setChoosingGeneralHost}>
2185
2279
  <SheetContent>
2186
2280
  <SheetHeader>
@@ -3593,6 +3687,8 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
3593
3687
  onScope={setHostChoice}
3594
3688
  onAdd={() => navigation.navigate('AddHost')}
3595
3689
  onManage={() => navigation.navigate('Hosts')}
3690
+ onOpenPage={(route) => navigation.navigate('Page', route)}
3691
+ onOpenTeam={() => navigation.navigate('SettingsTeam')}
3596
3692
  />
3597
3693
  </HostPluginProviders>
3598
3694
  </NavigationContainer>
@@ -0,0 +1,192 @@
1
+ import { teamRequestOver } from '@agimon-ai/po-identity/team';
2
+ import { fetch as nativeFetch } from 'expo/fetch';
3
+ import { useEffect, useRef, useState } from 'react';
4
+
5
+ import { SessionSharingView, type Permission, type SharingPerson } from '../screens/SessionSharingView';
6
+ import { hostedAccount, identityCookie } from '../services/accountClient';
7
+ import { apiTransportForHost } from '../services/apiTransport';
8
+
9
+ export interface SharingAccess {
10
+ visibility: 'private' | 'team';
11
+ view?: string[];
12
+ interact: string[];
13
+ level: 'none' | 'view' | 'interact' | 'own';
14
+ owner?: { issuer: string; subject: string; org?: string };
15
+ inheritedFrom?: { sessionId: string; workspaceId: string; name: string };
16
+ }
17
+
18
+ export function sharingGrants(access: SharingAccess): Record<string, Permission> {
19
+ return Object.fromEntries([
20
+ ...(access.view ?? []).map((id) => [id, 'view']),
21
+ ...access.interact.map((id) => [id, 'interact']),
22
+ ]);
23
+ }
24
+
25
+ export function sharingBody(visibility: 'private' | 'team', grants: Record<string, Permission>) {
26
+ return {
27
+ visibility,
28
+ view: Object.keys(grants).filter((id) => grants[id] === 'view'),
29
+ interact: Object.keys(grants).filter((id) => grants[id] === 'interact'),
30
+ };
31
+ }
32
+
33
+ const record = (value: unknown): value is Record<string, unknown> =>
34
+ value !== null && typeof value === 'object' && !Array.isArray(value);
35
+
36
+ /** Fail closed: an active Cloud team is not evidence of a paired session's team. */
37
+ export function sharingRoster(access: SharingAccess, issuer: string, team: unknown) {
38
+ if (!access.owner?.org || access.owner.issuer !== issuer || !record(team) || access.owner.org !== team.id)
39
+ throw new Error('Sign in to the team that owns this session to read its people.');
40
+ if (typeof team.name !== 'string' || !team.name.trim() || !Array.isArray(team.members))
41
+ throw new Error('The session team returned an invalid roster.');
42
+ const people: SharingPerson[] = team.members.map((member: unknown) => {
43
+ if (
44
+ !record(member) ||
45
+ typeof member.userId !== 'string' ||
46
+ !member.userId ||
47
+ !record(member.user) ||
48
+ typeof member.user.email !== 'string' ||
49
+ !member.user.email
50
+ )
51
+ throw new Error('The session team returned an invalid person.');
52
+ return {
53
+ id: member.userId,
54
+ name: typeof member.user.name === 'string' && member.user.name ? member.user.name : member.user.email,
55
+ email: member.user.email,
56
+ };
57
+ });
58
+ if (new Set(people.map((person) => person.id)).size !== people.length)
59
+ throw new Error('The session team returned an invalid roster.');
60
+ if (!people.some((person) => person.id === access.owner?.subject))
61
+ throw new Error('The session owner is not in this team roster.');
62
+ return { name: team.name, people };
63
+ }
64
+
65
+ async function readRoster(access: SharingAccess): Promise<{ name: string; people: SharingPerson[] }> {
66
+ const owner = access.owner;
67
+ if (!owner?.org) return { name: 'No team', people: [] };
68
+ // Both are existing account stores. Neither issues a new grant or changes the active team.
69
+ const cookie = (await hostedAccount.cookie(owner.issuer)) ?? (await identityCookie(owner.issuer));
70
+ if (!cookie) throw new Error('Sign in to the team that owns this session to read its people.');
71
+ const request = teamRequestOver(nativeFetch, owner.issuer, { cookie, origin: 'po://' });
72
+ // Joining in another client need not select an active team on this phone. This read never switches it.
73
+ const team = await request({
74
+ method: 'GET',
75
+ path: `/api/auth/organization/get-full-organization?organizationId=${encodeURIComponent(owner.org)}`,
76
+ });
77
+ return sharingRoster(access, owner.issuer, team);
78
+ }
79
+
80
+ export interface SharingTarget {
81
+ sessionId: string;
82
+ workspaceId: string;
83
+ hostId: string;
84
+ name: string;
85
+ hostName: string;
86
+ }
87
+
88
+ export function SessionSharingRoute({ target, onClose }: { target: SharingTarget; onClose: () => void }) {
89
+ const [access, setAccess] = useState<SharingAccess>();
90
+ const [roster, setRoster] = useState<{ name: string; people: SharingPerson[] }>();
91
+ const [visibility, setVisibility] = useState<'private' | 'team'>('private');
92
+ const [grants, setGrants] = useState<Record<string, Permission>>({});
93
+ const [loading, setLoading] = useState(true);
94
+ const [saving, setSaving] = useState(false);
95
+ const [error, setError] = useState('');
96
+ const [revision, setRevision] = useState(0);
97
+ const lifetime = useRef<AbortController | undefined>(undefined);
98
+ const pending = useRef(false);
99
+ const request = apiTransportForHost(target.hostId);
100
+ const path = `/api/workspaces/${encodeURIComponent(target.workspaceId)}/sessions/${encodeURIComponent(target.sessionId)}/access`;
101
+ const exchange = async (init: RequestInit, signal: AbortSignal): Promise<SharingAccess> => {
102
+ const response = await request(path, { ...init, signal });
103
+ const value = await response.json();
104
+ if (!response.ok) throw new Error(value.error ?? `Could not read sharing (${response.status}).`);
105
+ return value;
106
+ };
107
+
108
+ useEffect(() => {
109
+ const controller = new AbortController();
110
+ lifetime.current = controller;
111
+ setLoading(true);
112
+ setError('');
113
+ void (async () => {
114
+ try {
115
+ const found = await exchange({}, controller.signal);
116
+ if (controller.signal.aborted) return;
117
+ setAccess(found);
118
+ setVisibility(found.visibility);
119
+ setGrants(sharingGrants(found));
120
+ const people = await readRoster(found);
121
+ if (!controller.signal.aborted) setRoster(people);
122
+ } catch (cause) {
123
+ if (!controller.signal.aborted) setError(cause instanceof Error ? cause.message : 'Could not read sharing.');
124
+ } finally {
125
+ if (!controller.signal.aborted) setLoading(false);
126
+ }
127
+ })();
128
+ return () => controller.abort();
129
+ // The keyed owner mounts a new editor for each host/session. Retry intentionally rereads authority.
130
+ }, [target.sessionId, target.workspaceId, target.hostId, revision]);
131
+
132
+ const canSave = access?.level === 'own' && !access.inheritedFrom && roster !== undefined && !loading;
133
+ const save = async () => {
134
+ const controller = lifetime.current;
135
+ if (!canSave || pending.current || !controller || controller.signal.aborted) return;
136
+ pending.current = true;
137
+ setSaving(true);
138
+ setError('');
139
+ try {
140
+ await exchange(
141
+ {
142
+ method: 'PUT',
143
+ headers: { 'content-type': 'application/json' },
144
+ body: JSON.stringify(sharingBody(visibility, grants)),
145
+ },
146
+ controller.signal,
147
+ );
148
+ if (!controller.signal.aborted) onClose();
149
+ } catch (cause) {
150
+ if (!controller.signal.aborted)
151
+ setError(
152
+ `${cause instanceof Error ? cause.message : 'Could not confirm these changes.'} Your edits are still here. Try again.`,
153
+ );
154
+ } finally {
155
+ pending.current = false;
156
+ if (!controller.signal.aborted) setSaving(false);
157
+ }
158
+ };
159
+ const people = roster?.people ?? [];
160
+ const owner = people.find((person) => person.id === access?.owner?.subject);
161
+ const teammates = people.filter((person) => person.id !== access?.owner?.subject);
162
+ // Stale grants stay explicit, so revocation is possible without silently dropping other edits.
163
+ for (const id of Object.keys(grants)) {
164
+ if (id !== access?.owner?.subject && !teammates.some((person) => person.id === id))
165
+ teammates.push({ id, name: id, email: 'Not in the current team roster' });
166
+ }
167
+ return (
168
+ <SessionSharingView
169
+ open
170
+ state={
171
+ loading ? 'loading' : access?.inheritedFrom ? 'inherited' : !canSave ? 'viewer' : saving ? 'saving' : 'ready'
172
+ }
173
+ description={`${target.name} · ${target.hostName}`}
174
+ teamName={roster?.name ?? 'Session team'}
175
+ owner={owner ?? { name: access?.owner?.subject ?? 'Session owner', email: '' }}
176
+ inheritedName={access?.inheritedFrom?.name}
177
+ teammates={teammates}
178
+ visibility={visibility}
179
+ grants={grants}
180
+ error={error}
181
+ canSave={canSave && !saving}
182
+ onVisibility={setVisibility}
183
+ onGrant={(id, permission) => setGrants((current) => ({ ...current, [id]: permission }))}
184
+ onSave={() => void save()}
185
+ onClose={() => {
186
+ lifetime.current?.abort();
187
+ onClose();
188
+ }}
189
+ onRetry={!loading && !roster ? () => setRevision((current) => current + 1) : undefined}
190
+ />
191
+ );
192
+ }
@@ -7,6 +7,8 @@ import {
7
7
  } from '@agimon-ai/po-core/protocolTransport';
8
8
  import {
9
9
  applySessionsSnapshot,
10
+ applySessionInteractions,
11
+ watchHubAccess,
10
12
  applyWorkspacesSnapshot,
11
13
  createCloudHub,
12
14
  localHostId,
@@ -307,7 +309,9 @@ export function startCloudRuntime(host: CloudHostRecord, options: CloudRuntimeOp
307
309
  const home = createHomeReader(() => Promise.reject(new Error('Po Cloud has no home summaries yet.')));
308
310
  const owned = (id: string) => splitHostId(id)?.hostId === host.id;
309
311
  let focused: string | null = null;
310
- let binding: { sessionId: string; runtime: SessionRuntime; sockets: Set<CloudSocket> } | undefined;
312
+ let binding:
313
+ | { sessionId: string; runtime: SessionRuntime; sockets: Set<CloudSocket>; stopAccess(): void }
314
+ | undefined;
311
315
  let closed = false;
312
316
 
313
317
  const openLink = async (sessionId: string, sockets: Set<CloudSocket>, reauthenticate: () => void): Promise<Link> => {
@@ -352,6 +356,7 @@ export function startCloudRuntime(host: CloudHostRecord, options: CloudRuntimeOp
352
356
  const previous = binding;
353
357
  binding = undefined;
354
358
  if (!previous) return;
359
+ previous.stopAccess();
355
360
  previous.runtime.stop();
356
361
  for (const socket of previous.sockets) socket.close();
357
362
  };
@@ -367,7 +372,12 @@ export function startCloudRuntime(host: CloudHostRecord, options: CloudRuntimeOp
367
372
  name: 'native-cloud',
368
373
  openLink: () => openLink(sessionId, sockets, reauthenticate),
369
374
  });
370
- binding = { sessionId, sockets, runtime: startSessionRuntime(client, undefined, host.id) };
375
+ binding = {
376
+ sessionId,
377
+ sockets,
378
+ runtime: startSessionRuntime(client, undefined, host.id),
379
+ stopAccess: watchHubAccess(client, (rights) => applySessionInteractions(rights, host.id), host.id),
380
+ };
371
381
  binding.runtime.focus(sessionId);
372
382
  };
373
383
 
@@ -18,6 +18,7 @@ import {
18
18
  bindSessionFileLinkModes,
19
19
  applySessionFrame,
20
20
  applySessionsSnapshot,
21
+ applySessionInteractions,
21
22
  applyWorkspacesSnapshot,
22
23
  claimDialogMenu,
23
24
  clearPendingMenu,
@@ -48,7 +49,7 @@ import {
48
49
  removeSessionWebPlugins,
49
50
  sendFrame,
50
51
  sendHubFrame,
51
- sessionMinorModes,
52
+ sessionModes,
52
53
  sessionStoreFor,
53
54
  sessionsStore,
54
55
  setActiveSession,
@@ -173,7 +174,7 @@ function createHostPlugins(host: HostRecord): HostPlugins {
173
174
  onHubConnected: (listener) =>
174
175
  host.id === undefined ? onHubConnected(listener) : transportForHost(host.id).onHubConnected(listener),
175
176
  acquireModelContext: async () => ({ kind: 'simulator', modelContext }),
176
- minorModes: sessionMinorModes,
177
+ modes: sessionModes,
177
178
  onComposerSubmitted,
178
179
  onCaptureStatus,
179
180
  },
@@ -375,6 +376,7 @@ export function startLiveRuntime(
375
376
  sealed: session.sealed,
376
377
  // React Native's WebSocket takes (url, protocols, { headers }); the DOM lib typing omits the third argument.
377
378
  Socket: WebSocket as unknown as NativeSocketConstructor,
379
+ onAccess: (rights) => applySessionInteractions(rights, host.id),
378
380
  onSessions(sessions) {
379
381
  if (closed) return;
380
382
  clearVoiceReconnect();
@@ -30,7 +30,7 @@ function StoryDockPanel({ appendComposerDraft }: WebPluginSlotProps) {
30
30
 
31
31
  const STORY_PLUGIN = defineNativePlugin({
32
32
  id: 'story-dock',
33
- dockFaces: [{ id: 'overview', label: 'Overview', requiredMinorMode: 'review', panel: StoryDockPanel }],
33
+ dockFaces: [{ id: 'overview', label: 'Overview', requiredMode: 'review', panel: StoryDockPanel }],
34
34
  });
35
35
 
36
36
  function Open({
@@ -47,7 +47,7 @@ function Open({
47
47
  UnistylesRuntime.setTheme(scheme);
48
48
  resetWebPlugins();
49
49
  if (contributed) installWebPlugins([STORY_PLUGIN]);
50
- const slotProps = { ...nativeSlotProps('s1', {}, noop), activeMinorModes: modeActive ? ['review'] : [] };
50
+ const slotProps = { ...nativeSlotProps('s1', {}, noop), activeModes: modeActive ? ['review'] : [] };
51
51
  return (
52
52
  <PoNativeProvider>
53
53
  <View style={{ width: 402, height: 852 }}>
@@ -161,7 +161,7 @@ export interface ActivitySheetProps {
161
161
  export function ActivitySheet({ sessionId, open, onOpenChange, slotProps, load, onRetry, scope }: ActivitySheetProps) {
162
162
  const [face, setFace] = useState('activity');
163
163
  const dockFaces = useDockFaces(sessionId).filter(
164
- (entry) => entry.requiredMinorMode === undefined || slotProps.activeMinorModes?.includes(entry.requiredMinorMode),
164
+ (entry) => entry.requiredMode === undefined || slotProps.activeModes?.includes(entry.requiredMode),
165
165
  );
166
166
  const selectedFace = dockFaces.find((entry) => entry.id === face);
167
167
  const resolvedFace = face === 'activity' || face === 'context' || selectedFace !== undefined ? face : 'activity';
@@ -84,7 +84,7 @@ function Session({
84
84
  entries={ENTRIES}
85
85
  onSend={noop}
86
86
  composer={{
87
- mode: 'copilot',
87
+ preset: 'copilot',
88
88
  completion: SOURCE,
89
89
  ...(draft ? { initialText: draft } : {}),
90
90
  }}
@@ -35,7 +35,7 @@ const GROUPS: ContextGroup[] = [
35
35
  {
36
36
  id: 'copilot',
37
37
  label: 'copilot',
38
- kind: 'major',
38
+ kind: 'preset',
39
39
  detail: '',
40
40
  items: ITEMS,
41
41
  tokens: ITEMS.reduce((sum, entry) => sum + (entry.active ? entry.tokens : 0), 0),
@@ -223,7 +223,7 @@ export function ContextFaceView({
223
223
  <Text style={styles.emptyTitle}>{groups.length === 0 ? 'No composition yet' : 'No matches'}</Text>
224
224
  <Text style={styles.meta}>
225
225
  {groups.length === 0
226
- ? 'The session reports its major mode, minor modes and domains once it has started.'
226
+ ? 'The session reports its preset, modes and domains once it has started.'
227
227
  : 'Try a mode, package, tool or skill name.'}
228
228
  </Text>
229
229
  </View>
@@ -271,7 +271,7 @@ export function ContextFace({
271
271
  }) {
272
272
  const statuses = useStore(sessionStoreFor(sessionId), (state) => state.statuses);
273
273
  const widgets = useStore(sessionStoreFor(sessionId), (state) => state.widgets);
274
- const projection = useStore(sessionStoreFor(sessionId), (state) => state.minorModes);
274
+ const projection = useStore(sessionStoreFor(sessionId), (state) => state.modes);
275
275
  const context = useStore(sessionStoreFor(sessionId), (state) => state.context);
276
276
  const groups = context ? projectedGroups(context) : contextGroups(statuses, widgets, projection);
277
277
  return (
@@ -31,7 +31,7 @@ function Session({ scheme }: { scheme: 'light' | 'dark' }) {
31
31
  return (
32
32
  <PoNativeProvider>
33
33
  <View style={{ width: 402, height: 852 }}>
34
- <SessionScreen sessionId="s1" entries={ENTRIES} onSend={noop} composer={{ mode: 'copilot' }} />
34
+ <SessionScreen sessionId="s1" entries={ENTRIES} onSend={noop} composer={{ preset: 'copilot' }} />
35
35
  <MessageActionsSheet sessionId="s1" message={MESSAGE} actions={ACTIONS} onClose={noop} />
36
36
  </View>
37
37
  </PoNativeProvider>