@agimon-ai/po-native 0.0.1-alpha.37 → 0.0.1-alpha.39
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/adapters/remoteSocket.ts +4 -2
- package/src/app/AccountRoute.tsx +4 -2
- package/src/app/App.tsx +29 -4
- package/src/app/TeamRoute.tsx +98 -0
- package/src/app/cloudRuntime.ts +32 -1
- package/src/app/hostRuntimes.ts +4 -1
- package/src/screens/AccountOnboarding.stories.tsx +12 -1
- package/src/screens/AccountScreen.tsx +61 -39
- package/src/screens/GlobalSettings.tsx +10 -8
- package/src/screens/SettingsScreen.stories.tsx +38 -3
- package/src/screens/SettingsScreen.tsx +43 -22
- package/src/screens/Team.stories.tsx +56 -0
- package/src/screens/TeamView.tsx +306 -0
- package/src/services/accountClient/index.ts +19 -0
- package/src/services/apiTransport/index.ts +32 -5
- package/src/services/logExport/index.ts +4 -1
- package/src/services/pairing/index.ts +8 -3
- package/src/services/settingsApi/index.ts +4 -0
|
@@ -127,7 +127,10 @@ export async function flushNativeLogs(): Promise<boolean> {
|
|
|
127
127
|
],
|
|
128
128
|
});
|
|
129
129
|
try {
|
|
130
|
-
|
|
130
|
+
const response = await send(LOGS_ROUTE, body);
|
|
131
|
+
// A computer that refuses this phone's logs is not asked again on this connection.
|
|
132
|
+
if (response.status === 401 || response.status === 403) senders.delete(target!);
|
|
133
|
+
return response.ok;
|
|
131
134
|
} catch {
|
|
132
135
|
// ponytail: no retry. Add a bounded one if hosts often drop sends mid-flight.
|
|
133
136
|
return false;
|
|
@@ -172,7 +172,7 @@ export async function pairDevice(scanned: string, fetcher: typeof fetch, signal?
|
|
|
172
172
|
const auth = await account.createAccountClient(issuer);
|
|
173
173
|
const { claimPairedHub } = await import('@agimon-ai/po-identity/account');
|
|
174
174
|
const keys = await import('../../../modules/po-device-key');
|
|
175
|
-
await claimPairedHub(
|
|
175
|
+
const claimed = await claimPairedHub(
|
|
176
176
|
{
|
|
177
177
|
keys,
|
|
178
178
|
now: Date.now,
|
|
@@ -202,8 +202,13 @@ export async function pairDevice(scanned: string, fetcher: typeof fetch, signal?
|
|
|
202
202
|
},
|
|
203
203
|
{ pairingId, pairedAt },
|
|
204
204
|
);
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
// A teammate's pairing is not theirs to unlink, so it is not tied to the account on this phone.
|
|
206
|
+
if (claimed) linkedRecord = record;
|
|
207
|
+
account.accountLinkNotice.setState(() =>
|
|
208
|
+
claimed
|
|
209
|
+
? 'Your hub is linked to your account. Local data stays on the hub.'
|
|
210
|
+
: 'You joined this team’s host. Your sessions here are private until you share them.',
|
|
211
|
+
);
|
|
207
212
|
}
|
|
208
213
|
} catch (error) {
|
|
209
214
|
// A cancelled pairing has nothing to report about linking.
|
|
@@ -164,12 +164,16 @@ export function logoutProvider(providerId: string, hostId?: string): Promise<Res
|
|
|
164
164
|
return request(`${AUTH_PROVIDERS_API_ROUTE}/${encodeURIComponent(providerId)}`, { method: 'DELETE' }, ok, hostId);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
/** What `readRemote` answers for a host with no remote access of its own, such as Po Cloud. Not a failure. */
|
|
168
|
+
export const NO_REMOTE_ACCESS = 'This host has no remote access settings.';
|
|
169
|
+
|
|
167
170
|
export function readRemote(hostId?: string): Promise<Result<{ state: RemoteAccessStateView }>> {
|
|
168
171
|
return request(
|
|
169
172
|
REMOTE_API_ROUTE,
|
|
170
173
|
undefined,
|
|
171
174
|
(body) => (isRecord(body.state) ? { state: body.state as unknown as RemoteAccessStateView } : undefined),
|
|
172
175
|
hostId,
|
|
176
|
+
NO_REMOTE_ACCESS,
|
|
173
177
|
);
|
|
174
178
|
}
|
|
175
179
|
|