@agimon-ai/po-native 0.0.1-alpha.49 → 0.0.1-alpha.50

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.49",
3
+ "version": "0.0.1-alpha.50",
4
4
  "description": "Po for iOS and Android",
5
5
  "homepage": "https://agimon.ai",
6
6
  "bugs": {
@@ -29,20 +29,20 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@agimon-ai/po-core": "0.0.0-alpha.169",
33
- "@agimon-ai/po-expo-signing": "0.0.1-alpha.49",
34
- "@agimon-ai/po-identity": "0.0.2-alpha.116",
35
- "@agimon-ai/po-native-components": "0.0.0-alpha.169",
36
- "@agimon-ai/po-native-dashboard": "0.0.0-alpha.41",
37
- "@agimon-ai/po-template-advanced": "0.0.0-alpha.169",
38
- "@agimon-ai/po-template-elegant": "0.0.0-alpha.169",
39
- "@agimon-ai/po-voice": "0.0.0-alpha.169",
40
- "@agimon-ai/po-web-components": "0.0.0-alpha.169",
41
- "@agimon-ai/po-web-dashboard": "0.0.0-alpha.169",
42
- "@agimon-ai/po-web-security": "0.0.0-alpha.169",
32
+ "@agimon-ai/po-core": "0.0.0-alpha.170",
33
+ "@agimon-ai/po-expo-signing": "0.0.1-alpha.50",
34
+ "@agimon-ai/po-identity": "0.0.2-alpha.117",
35
+ "@agimon-ai/po-native-components": "0.0.0-alpha.170",
36
+ "@agimon-ai/po-native-dashboard": "0.0.0-alpha.42",
37
+ "@agimon-ai/po-template-advanced": "0.0.0-alpha.170",
38
+ "@agimon-ai/po-template-elegant": "0.0.0-alpha.170",
39
+ "@agimon-ai/po-voice": "0.0.0-alpha.170",
40
+ "@agimon-ai/po-web-components": "0.0.0-alpha.170",
41
+ "@agimon-ai/po-web-dashboard": "0.0.0-alpha.170",
42
+ "@agimon-ai/po-web-security": "0.0.0-alpha.170",
43
43
  "@better-auth/expo": "1.7.12",
44
44
  "@config-plugins/react-native-webrtc": "15.0.2",
45
- "@earendil-works/chord": "1.5.1",
45
+ "@earendil-works/chord": "1.5.2",
46
46
  "@expo/vector-icons": "15.1.1",
47
47
  "@gorhom/bottom-sheet": "5.2.14",
48
48
  "@native-html/render": "1.0.4",
package/src/app/App.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { NativeTemplateSessionsActions, NativeTemplateSessionsProps } from '@agimon-ai/po-core/native';
2
+ import { NATIVE_PAIRING_LINK_PREFIX } from '@agimon-ai/po-core/remoteContract';
2
3
  import type {
3
4
  ComposerCapture,
4
5
  TabHeader,
@@ -107,8 +108,9 @@ import {
107
108
  homeActivity,
108
109
  filterEntries,
109
110
  botCoordinatorBlocked,
111
+ sessionSetupActionFor,
110
112
  } from '@agimon-ai/po-web-dashboard/core';
111
- import { NATIVE_PAIRING_LINK_PREFIX, type SettingsRepository } from '@agimon-ai/po-web-dashboard/types';
113
+ import type { SettingsRepository } from '@agimon-ai/po-web-dashboard/types';
112
114
  import { type BottomTabBarProps, createBottomTabNavigator } from '@react-navigation/bottom-tabs';
113
115
  import { useHeaderHeight } from '@react-navigation/elements';
114
116
  import {
@@ -189,7 +191,7 @@ import { PluginDetailScreen } from '../screens/PluginDetailScreen';
189
191
  import { PluginOnboardingScreen } from '../screens/PluginOnboardingScreen';
190
192
  import { PresetsScreen } from '../screens/PresetsScreen';
191
193
  import { providersSummary, ProvidersScreen, useProviders } from '../screens/ProvidersScreen';
192
- import { type McpSession, RemoteControlScreen, useRemoteControl } from '../screens/RemoteControlScreen';
194
+ import { RemoteControlScreen, useRemoteControl } from '../screens/RemoteControlScreen';
193
195
  import { type SessionSummary, SessionListScreen } from '../screens/SessionListScreen';
194
196
  import { StateRow } from '../screens/SettingsFields';
195
197
  import {
@@ -226,7 +228,6 @@ import {
226
228
  deleteSessionGroup,
227
229
  listDirectory,
228
230
  loadSessionImage,
229
- removeSessionMcpSetup,
230
231
  removeWorkspace,
231
232
  renameSessionGroup,
232
233
  requestWithStepUp,
@@ -1453,6 +1454,7 @@ function SettingsPanelRoute({ route }: NativeStackScreenProps<Routes, 'SettingsP
1453
1454
  <Panel
1454
1455
  request={request}
1455
1456
  requestWithStepUp={request}
1457
+ listSessions={() => settingsPanelSessions(hostId)}
1456
1458
  // Only the sections this app has a screen for; others are ignored, as the panel contract allows.
1457
1459
  openSettings={(section) => {
1458
1460
  if (section === 'providers')
@@ -1463,6 +1465,17 @@ function SettingsPanelRoute({ route }: NativeStackScreenProps<Routes, 'SettingsP
1463
1465
  );
1464
1466
  }
1465
1467
 
1468
+ /**
1469
+ * The live sessions a settings panel may address: the named computer's, or with none named every
1470
+ * computer's, since the unnamed transport routes a qualified workspace path to its owner.
1471
+ */
1472
+ function settingsPanelSessions(hostId: string | undefined) {
1473
+ const now = Date.now();
1474
+ const hosts =
1475
+ hostId === undefined ? [...new Set(sessionsStore.state.order.map((id) => splitHostId(id)?.hostId))] : [hostId];
1476
+ return hosts.flatMap((host) => liveSessionOptions(sessionsStore.state, workspacesStore.state.byId, null, host, now));
1477
+ }
1478
+
1466
1479
  function DevicesRoute({ route }: NativeStackScreenProps<Routes, 'SettingsDevices'>) {
1467
1480
  const hostId = route.params?.hostId;
1468
1481
  const [label, setLabel] = useState('this Po host');
@@ -1774,20 +1787,7 @@ function AppearanceRoute() {
1774
1787
  }
1775
1788
 
1776
1789
  function RemoteControlRoute({ route }: NativeStackScreenProps<Routes, 'SettingsRemote'>) {
1777
- const hostId = route.params?.hostId;
1778
- // ponytail: a snapshot of the live sessions on open; a session started while the screen is up shows on the next visit.
1779
- const [sessions] = useState<McpSession[]>(() =>
1780
- sessionsStore.state.order.flatMap((id) => {
1781
- // Only the chosen computer's sessions: their MCP clients live on that computer.
1782
- if (hostId !== undefined && splitHostId(id)?.hostId !== hostId) return [];
1783
- const summary = sessionsStore.state.byId[id]?.summary;
1784
- // A sleeping session has no MCP endpoint until it wakes; the host answers 404 for it, as on the web.
1785
- return summary?.workspaceId && !summary.dormant
1786
- ? [{ id, workspaceId: summary.workspaceId, name: summary.name || 'Session' }]
1787
- : [];
1788
- }),
1789
- );
1790
- return <RemoteControlScreen {...useRemoteControl(sessions, hostId)} />;
1790
+ return <RemoteControlScreen {...useRemoteControl(route.params?.hostId)} />;
1791
1791
  }
1792
1792
 
1793
1793
  /** The selected `native.template` session list, or the built-in one when none is chosen, installed, or healthy. */
@@ -2192,9 +2192,27 @@ function SessionsRoute({
2192
2192
  deleteGroup: (name) => onGroupComputer(name, (hostId) => deleteSessionGroup(name, hostId)),
2193
2193
  async removePendingSetup(sessionId, setupId) {
2194
2194
  if (!canMutate(sessionId)) return unavailable;
2195
- const workspaceId = sessionsStore.state.byId[sessionId]?.summary.workspaceId;
2196
- if (workspaceId === undefined) return { error: 'This session belongs to no workspace.' };
2197
- return removeSessionMcpSetup(workspaceId, sessionId, setupId);
2195
+ const summary = sessionsStore.state.byId[sessionId]?.summary;
2196
+ if (summary?.workspaceId === undefined) return { error: 'This session belongs to no workspace.' };
2197
+ const setup = summary.pendingSetups?.find((entry) => entry.id === setupId);
2198
+ // The package that reserved the setup owns its route; the owning computer's registry and transport carry it.
2199
+ const owner = splitHostId(sessionId)?.hostId;
2200
+ const fills =
2201
+ owner === undefined
2202
+ ? hostSlotFills(HOST_SLOTS.sessionSetupActions)
2203
+ : webPluginRegistryForHost(owner).hostSlotFills(HOST_SLOTS.sessionSetupActions);
2204
+ const action =
2205
+ setup === undefined
2206
+ ? undefined
2207
+ : sessionSetupActionFor(
2208
+ fills.map((fill) => fill.data),
2209
+ setup,
2210
+ );
2211
+ if (action === undefined) return { error: 'No installed package can remove this setup.' };
2212
+ return action.remove(
2213
+ { workspaceId: summary.workspaceId, sessionId, setupId },
2214
+ owner === undefined ? requestWithStepUp : apiTransportForHost(owner),
2215
+ );
2198
2216
  },
2199
2217
  };
2200
2218
 
@@ -3122,7 +3140,11 @@ export function App({ nativeHost }: { nativeHost?: (sessionId: string) => Native
3122
3140
  }),
3123
3141
  ]);
3124
3142
  if (!mounted) return;
3125
- for (const host of cloud) void manager.connect(host).catch(() => undefined);
3143
+ for (const host of cloud)
3144
+ void manager.connect(host).catch((error: unknown) => {
3145
+ // One Po Cloud host failing must not stop the others or the paired computers.
3146
+ console.warn('Po Cloud host did not connect:', messageOf(error, 'unreachable'));
3147
+ });
3126
3148
  // Start every host independently. One failure must not prevent a sibling from hydrating.
3127
3149
  const connecting = saved.map((host) => manager.connect(host));
3128
3150
  const cached = manager.snapshot().flatMap(({ runtime }) => (runtime?.cached ? [runtime.cached] : []));
@@ -11,7 +11,7 @@ import {
11
11
  SectionLabel,
12
12
  } from '@agimon-ai/po-native-components';
13
13
  import { NATIVE_THEMES } from '@agimon-ai/po-web-components/nativeTheme';
14
- import { qrMatrix } from '@agimon-ai/po-web-dashboard/core';
14
+ import { qrMatrix } from '@agimon-ai/po-web-components/text';
15
15
  import * as AppleAuthentication from 'expo-apple-authentication';
16
16
  import { Image, ScrollView, Text, View } from 'react-native';
17
17
  import { StyleSheet, useUnistyles } from 'react-native-unistyles';
@@ -1,41 +1,20 @@
1
+ import type { RemoteAccessStateView, TunnelConfig } from '@agimon-ai/po-core/remoteContract';
1
2
  import { Badge, Button, Dot, fontOf, Spinner } from '@agimon-ai/po-native-components';
2
- import type { RemoteAccessStateView, SessionMcpClient, TunnelConfig } from '@agimon-ai/po-web-dashboard/types';
3
3
  import { useCallback, useEffect, useState } from 'react';
4
4
  import { Alert, ScrollView, Text } from 'react-native';
5
5
  import { StyleSheet } from 'react-native-unistyles';
6
6
 
7
- import {
8
- disableRemote,
9
- listMcpClients,
10
- readRemote,
11
- revokeMcpClient,
12
- revokeTrustedDevice,
13
- } from '../services/settingsApi';
7
+ import { disableRemote, readRemote, revokeTrustedDevice } from '../services/settingsApi';
14
8
  import { ErrorLine, Group, OnComputer, remoteSummary, Row } from './SettingsScreen';
15
9
 
16
10
  /*
17
11
  * Remote control at web parity, minus what stays on the computer: turning access on, tunnel settings and
18
- * pairing codes. The phone may turn access off (the panic button), revoke devices, and revoke Session MCP clients.
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 are po-session-mcp's own panel.
19
14
  */
20
15
 
21
- export interface McpSession {
22
- id: string;
23
- workspaceId: string;
24
- name: string;
25
- }
26
-
27
- export interface McpClientView extends SessionMcpClient {
28
- session: McpSession;
29
- }
30
-
31
- const AUTH_LABEL: Readonly<Record<SessionMcpClient['tokenEndpointAuthMethod'], string>> = {
32
- url_token: 'Signed URL',
33
- api_key: 'API key',
34
- client_secret_post: 'OAuth',
35
- };
36
16
  const MINUTE = 60_000;
37
17
  const HOUR = 60 * MINUTE;
38
-
39
18
  /** "just now", "5 min ago", "3 h ago", "yesterday", or the date; an unparsable value is shown as sent. */
40
19
  export function lastSeen(iso: string, now = Date.now()): string {
41
20
  const time = Date.parse(iso);
@@ -55,18 +34,15 @@ function tunnelLabel(tunnel: TunnelConfig): string {
55
34
 
56
35
  export interface RemoteControlModel {
57
36
  remote?: RemoteAccessStateView;
58
- clients?: McpClientView[];
59
37
  error: string;
60
38
  busy: boolean;
61
39
  turnOff: () => void;
62
40
  revokeDevice: (deviceId: string) => void;
63
- revokeClient: (client: McpClientView) => void;
64
41
  }
65
42
 
66
- /** Reads the remote state and every live session's MCP clients; each write re-reads what it changed. */
67
- export function useRemoteControl(sessions: readonly McpSession[], hostId?: string): RemoteControlModel {
43
+ /** Reads the remote state; each write re-reads it. */
44
+ export function useRemoteControl(hostId?: string): RemoteControlModel {
68
45
  const [remote, setRemote] = useState<RemoteAccessStateView>();
69
- const [clients, setClients] = useState<McpClientView[]>();
70
46
  const [error, setError] = useState('');
71
47
  const [busy, setBusy] = useState(false);
72
48
 
@@ -76,61 +52,36 @@ export function useRemoteControl(sessions: readonly McpSession[], hostId?: strin
76
52
  else setError(result.error);
77
53
  }, [hostId]);
78
54
 
79
- const loadClients = useCallback(async () => {
80
- const next: McpClientView[] = [];
81
- // The sealed transport serializes requests already. Avoid queueing every session at once.
82
- for (const session of sessions) {
83
- const result = await listMcpClients(session.workspaceId, session.id);
84
- if ('error' in result) setError(result.error);
85
- else next.push(...result.clients.map((client) => ({ ...client, session })));
86
- }
87
- setClients(next);
88
- }, [sessions]);
89
-
90
55
  useEffect(() => {
91
56
  void loadRemote();
92
57
  }, [loadRemote]);
93
- useEffect(() => {
94
- void loadClients();
95
- }, [loadClients]);
96
58
 
97
- const run = (work: () => Promise<{ error: string } | { ok: true }>, after: () => Promise<void>) => {
59
+ const run = (work: () => Promise<{ error: string } | { ok: true }>) => {
98
60
  if (busy) return;
99
61
  setBusy(true);
100
62
  setError('');
101
63
  void work()
102
64
  .then(async (result) => {
103
65
  if ('error' in result) setError(result.error);
104
- else await after();
66
+ else await loadRemote();
105
67
  })
106
68
  .finally(() => setBusy(false));
107
69
  };
108
70
 
109
71
  return {
110
72
  ...(remote ? { remote } : {}),
111
- ...(clients ? { clients } : {}),
112
73
  error,
113
74
  busy,
114
75
  turnOff: () =>
115
76
  Alert.alert('Turn off remote access?', 'This phone disconnects right away. Turn it back on from your computer.', [
116
77
  { text: 'Cancel', style: 'cancel' },
117
- { text: 'Turn off', style: 'destructive', onPress: () => run(() => disableRemote(hostId), loadRemote) },
78
+ { text: 'Turn off', style: 'destructive', onPress: () => run(() => disableRemote(hostId)) },
118
79
  ]),
119
- revokeDevice: (deviceId) => run(() => revokeTrustedDevice(deviceId, hostId), loadRemote),
120
- revokeClient: (client) =>
121
- run(() => revokeMcpClient(client.session.workspaceId, client.session.id, client.clientId), loadClients),
80
+ revokeDevice: (deviceId) => run(() => revokeTrustedDevice(deviceId, hostId)),
122
81
  };
123
82
  }
124
83
 
125
- export function RemoteControlScreen({
126
- remote,
127
- clients,
128
- error,
129
- busy,
130
- turnOff,
131
- revokeDevice,
132
- revokeClient,
133
- }: RemoteControlModel) {
84
+ export function RemoteControlScreen({ remote, error, busy, turnOff, revokeDevice }: RemoteControlModel) {
134
85
  const summary = remote ? remoteSummary(remote) : undefined;
135
86
  return (
136
87
  <ScrollView contentContainerStyle={styles.content}>
@@ -181,30 +132,6 @@ export function RemoteControlScreen({
181
132
  ) : error ? null : (
182
133
  <Spinner color="green" label="Reading remote access" />
183
134
  )}
184
-
185
- <Group label="Session MCP" hint="Let ChatGPT or another MCP client work inside one live Po session.">
186
- {clients === undefined ? <Spinner color="green" label="Reading MCP clients" /> : null}
187
- {clients?.length === 0 ? <Row title="No clients connected." last /> : null}
188
- {clients?.map((client, index) => (
189
- <Row
190
- key={`${client.session.id}:${client.clientId}`}
191
- title={client.name}
192
- description={`${AUTH_LABEL[client.tokenEndpointAuthMethod]} · ${client.session.name}`}
193
- last={index === clients.length - 1}
194
- >
195
- <Button
196
- variant="danger-outline"
197
- size="sm"
198
- disabled={busy}
199
- onPress={() => revokeClient(client)}
200
- accessibilityLabel={`Revoke ${client.name}`}
201
- >
202
- Revoke
203
- </Button>
204
- </Row>
205
- ))}
206
- </Group>
207
- <OnComputer>Connect new clients on your computer for now.</OnComputer>
208
135
  </ScrollView>
209
136
  );
210
137
  }
@@ -1,8 +1,8 @@
1
+ import type { RemoteAccessStateView } from '@agimon-ai/po-core/remoteContract';
1
2
  import { PoNativeProvider, Select } from '@agimon-ai/po-native-components';
2
3
  import type {
3
4
  LoginFlowSnapshot,
4
5
  ProviderAuthSummary,
5
- RemoteAccessStateView,
6
6
  RepositorySettingsView,
7
7
  SettingsRepository,
8
8
  } from '@agimon-ai/po-web-dashboard/types';
@@ -13,7 +13,7 @@ import { StyleSheet, UnistylesRuntime } from 'react-native-unistyles';
13
13
  import type { Appearance } from '../app/appearance';
14
14
  import { AppearanceScreen } from './AppearanceScreen';
15
15
  import { ProvidersScreen } from './ProvidersScreen';
16
- import { type McpClientView, RemoteControlScreen } from './RemoteControlScreen';
16
+ import { RemoteControlScreen } from './RemoteControlScreen';
17
17
  import { CardBody, GlobalSettingsView, Group, SettingsScreen } from './SettingsScreen';
18
18
  import { WorkspaceDefaultsScreen, WorkspaceHubView } from './WorkspaceSettingsScreen';
19
19
 
@@ -42,22 +42,6 @@ const REMOTE = {
42
42
  settings: { tunnel: { kind: 'named', hostname: HOSTNAME, name: 'po' } },
43
43
  } as unknown as RemoteAccessStateView;
44
44
 
45
- const CLIENTS = [
46
- {
47
- clientId: 'c1',
48
- name: 'ChatGPT',
49
- redirectUri: '',
50
- tokenEndpointAuthMethod: 'url_token',
51
- createdAt: 0,
52
- scope: 'session',
53
- routing: 'conversation',
54
- tools: [],
55
- skills: [],
56
- audience: '',
57
- session: { id: 's1', workspaceId: 'w1', name: 'Refactor billing' },
58
- },
59
- ] satisfies McpClientView[];
60
-
61
45
  const PROVIDERS: ProviderAuthSummary[] = [
62
46
  {
63
47
  id: 'po-openai',
@@ -140,15 +124,7 @@ export const SignIn = {
140
124
  export const RemoteControl = {
141
125
  render: () => (
142
126
  <PoNativeProvider>
143
- <RemoteControlScreen
144
- remote={REMOTE}
145
- clients={CLIENTS}
146
- error=""
147
- busy={false}
148
- turnOff={noop}
149
- revokeDevice={noop}
150
- revokeClient={noop}
151
- />
127
+ <RemoteControlScreen remote={REMOTE} error="" busy={false} turnOff={noop} revokeDevice={noop} />
152
128
  </PoNativeProvider>
153
129
  ),
154
130
  };
@@ -1,3 +1,4 @@
1
+ import type { RemoteAccessStateView } from '@agimon-ai/po-core/remoteContract';
1
2
  import {
2
3
  ActivityIcon,
3
4
  Button,
@@ -21,7 +22,6 @@ import {
21
22
  UsersIcon,
22
23
  WrenchIcon,
23
24
  } from '@agimon-ai/po-native-components';
24
- import type { RemoteAccessStateView } from '@agimon-ai/po-web-dashboard/types';
25
25
  import type { ComponentType, ReactNode } from 'react';
26
26
  import { Pressable, ScrollView, Text, View } from 'react-native';
27
27
  import { StyleSheet } from 'react-native-unistyles';
@@ -322,18 +322,6 @@ export function deleteSessionGroup(name: string, hostId?: string): Promise<{ err
322
322
  return rootFailure(`/api/session-groups/${encodeURIComponent(name)}`, { method: 'DELETE' }, hostId);
323
323
  }
324
324
 
325
- /** Drops a pending MCP setup from a session, as the cockpit's setup panel does. */
326
- export function removeSessionMcpSetup(
327
- workspaceId: string,
328
- sessionId: string,
329
- setupId: string,
330
- ): Promise<{ error: string } | undefined> {
331
- const route = `/api/workspaces/${encodeURIComponent(workspaceId)}/sessions/${encodeURIComponent(sessionId)}/mcp`;
332
- return rootFailure(`${route}/conversations/${encodeURIComponent(setupId)}`, {
333
- method: 'DELETE',
334
- headers: { ...JSON_BODY, 'X-Po-Mcp-Csrf': '1' },
335
- });
336
- }
337
325
  /** Admits a folder, or with a name alone creates `~/.po/workspace/<name>` on the computer. */
338
326
  export async function admitWorkspace(
339
327
  input: { root?: string; name?: string; instructions?: string; declaration?: string },
@@ -1,5 +1,5 @@
1
+ import { NATIVE_PAIRING_LINK_PREFIX } from '@agimon-ai/po-core/remoteContract';
1
2
  import type { AccountRecord } from '@agimon-ai/po-identity/account';
2
- import { NATIVE_PAIRING_LINK_PREFIX } from '@agimon-ai/po-web-dashboard/types';
3
3
  import { createSealedTransport } from '@agimon-ai/po-web-security/browser';
4
4
 
5
5
  import { createRemoteHttp, type RemoteHttp } from '../../adapters/remoteHttp';
@@ -1,3 +1,4 @@
1
+ import { REMOTE_API_ROUTE, type RemoteAccessStateView, TRUSTED_DEVICES_ROUTE } from '@agimon-ai/po-core/remoteContract';
1
2
  import {
2
3
  repositorySettingsViewFromWire,
3
4
  settingsConfigViewFromWire,
@@ -12,20 +13,14 @@ import {
12
13
  type InstallOperation,
13
14
  type LoginFlowSnapshot,
14
15
  type ProviderAuthSummary,
15
- REMOTE_API_ROUTE,
16
- type RemoteAccessStateView,
17
16
  type PresetCreateRequest,
18
17
  type PresetLayerRequest,
19
18
  type PresetScope,
20
19
  type PresetWriteRequest,
21
20
  SETTINGS_PRESETS_API_ROUTE,
22
21
  type SettingsPresetsView,
23
- type CreatedSessionMcpClient,
24
- type CreateSessionMcpClientInput,
25
22
  type RepositorySelectionWriteRequest,
26
23
  type RepositorySettingsView,
27
- type SessionMcpClient,
28
- type SessionMcpConfig,
29
24
  SETTINGS_CONFIG_API_ROUTE,
30
25
  SETTINGS_IMAGES_API_ROUTE,
31
26
  SETTINGS_MODELS_API_ROUTE,
@@ -39,7 +34,6 @@ import {
39
34
  type SettingsImagesWriteRequest,
40
35
  type SettingsModel,
41
36
  type SettingsRepository,
42
- TRUSTED_DEVICES_ROUTE,
43
37
  } from '@agimon-ai/po-web-dashboard/types';
44
38
 
45
39
  // The shell's own transport: Settings reaches `/api/remote`, which compositions may not.
@@ -376,56 +370,6 @@ export function editPreset(
376
370
  );
377
371
  }
378
372
 
379
- function mcpRoute(workspaceId: string, sessionId: string): string {
380
- return `/api/workspaces/${encodeURIComponent(workspaceId)}/sessions/${encodeURIComponent(sessionId)}/mcp`;
381
- }
382
-
383
- export function listMcpClients(
384
- workspaceId: string,
385
- sessionId: string,
386
- ): Promise<Result<{ clients: SessionMcpClient[] }>> {
387
- return request(`${mcpRoute(workspaceId, sessionId)}/clients`, undefined, (body) =>
388
- Array.isArray(body.clients) ? { clients: body.clients as SessionMcpClient[] } : undefined,
389
- );
390
- }
391
-
392
- export function revokeMcpClient(
393
- workspaceId: string,
394
- sessionId: string,
395
- clientId: string,
396
- ): Promise<Result<{ ok: true }>> {
397
- return request(
398
- `${mcpRoute(workspaceId, sessionId)}/clients/${encodeURIComponent(clientId)}`,
399
- { method: 'DELETE' },
400
- ok,
401
- );
402
- }
403
-
404
- export function readMcpConfig(workspaceId: string, sessionId: string): Promise<Result<{ config: SessionMcpConfig }>> {
405
- return request(`${mcpRoute(workspaceId, sessionId)}/config`, undefined, (body) =>
406
- typeof body.mcpUrl === 'string' ? { config: body as unknown as SessionMcpConfig } : undefined,
407
- );
408
- }
409
-
410
- /** The reply carries the one-time secret or signed URLs; the host never shows them again. */
411
- export async function createMcpClient(
412
- workspaceId: string,
413
- sessionId: string,
414
- input: CreateSessionMcpClientInput,
415
- ): Promise<Result<{ client: CreatedSessionMcpClient }>> {
416
- const result = await request(
417
- `${mcpRoute(workspaceId, sessionId)}/clients`,
418
- { method: 'POST', headers: JSON_HEADERS, body: JSON.stringify(input) },
419
- (body) =>
420
- isRecord(body.client) && typeof body.client.clientId === 'string'
421
- ? { client: body.client as unknown as CreatedSessionMcpClient }
422
- : undefined,
423
- );
424
- if ('client' in result && result.client.routing !== 'conversation')
425
- return { error: 'Po on your computer needs an update before it can connect this client.' };
426
- return result;
427
- }
428
-
429
373
  /*
430
374
  * The person's own MCP servers, as the web's Settings, MCP servers page reads and writes them. Global
431
375
  * scope: the phone has no repository settings, so a server added here is available in every repository.