@agimon-ai/po-native 0.0.1-alpha.6 → 0.0.1-alpha.7
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 +10 -10
- package/src/app/App.tsx +16 -0
- package/src/services/hostActions/index.ts +17 -0
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.7",
|
|
4
4
|
"description": "Po for iOS and Android",
|
|
5
5
|
"homepage": "https://agimon.ai",
|
|
6
6
|
"bugs": {
|
|
@@ -29,15 +29,15 @@
|
|
|
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-template-advanced": "0.0.0-alpha.
|
|
37
|
-
"@agimon-ai/po-voice": "0.0.0-alpha.
|
|
38
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
39
|
-
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.
|
|
40
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.
|
|
32
|
+
"@agimon-ai/po-core": "0.0.0-alpha.127",
|
|
33
|
+
"@agimon-ai/po-expo-signing": "0.0.1-alpha.7",
|
|
34
|
+
"@agimon-ai/po-identity": "0.0.2-alpha.74",
|
|
35
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.127",
|
|
36
|
+
"@agimon-ai/po-template-advanced": "0.0.0-alpha.127",
|
|
37
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.127",
|
|
38
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.127",
|
|
39
|
+
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.127",
|
|
40
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.127",
|
|
41
41
|
"@better-auth/expo": "1.7.12",
|
|
42
42
|
"@config-plugins/react-native-webrtc": "15.0.2",
|
|
43
43
|
"@earendil-works/chord": "1.5.0",
|
package/src/app/App.tsx
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
pluginSettingsPanels,
|
|
45
45
|
applySessionRemoved,
|
|
46
46
|
applySessionUpsert,
|
|
47
|
+
sessionMoveTarget,
|
|
47
48
|
applyWorkspaceRemoved,
|
|
48
49
|
applyWorkspaceUpsert,
|
|
49
50
|
renameSession,
|
|
@@ -205,6 +206,7 @@ import {
|
|
|
205
206
|
renameSessionGroup,
|
|
206
207
|
requestWithStepUp,
|
|
207
208
|
restartSession,
|
|
209
|
+
moveSession,
|
|
208
210
|
type ResumeSource,
|
|
209
211
|
searchDirectories,
|
|
210
212
|
setSessionGroups,
|
|
@@ -1613,6 +1615,20 @@ function SessionsRoute({
|
|
|
1613
1615
|
// the cockpit. Renaming another session needs a hub route; until then it is a no-op there.
|
|
1614
1616
|
whenConnected(sessionId, () => renameSession(trimmed, sessionId));
|
|
1615
1617
|
},
|
|
1618
|
+
async moveSession(sessionId, workspaceId) {
|
|
1619
|
+
if (!canMutate(sessionId) || !canMutate(workspaceId)) return unavailable;
|
|
1620
|
+
const summary = sessionsStore.state.byId[sessionId]?.summary;
|
|
1621
|
+
const target = summary
|
|
1622
|
+
? sessionMoveTarget(summary, workspacesStore.state.byId, workspacesStore.state.order)
|
|
1623
|
+
: undefined;
|
|
1624
|
+
if (!target || target.blocked || !target.destinations.some((workspace) => workspace.id === workspaceId))
|
|
1625
|
+
return { error: 'This session cannot move to that workspace now.' };
|
|
1626
|
+
const result = await moveSession(sessionId, workspaceId);
|
|
1627
|
+
if ('error' in result) return result;
|
|
1628
|
+
if (result.session) applySessionUpsert({ session: result.session }, splitHostId(sessionId)?.hostId);
|
|
1629
|
+
// SessionRuntime rebinds the restarted reference; the hub upsert retains the qualified ID.
|
|
1630
|
+
return undefined;
|
|
1631
|
+
},
|
|
1616
1632
|
restartSession(sessionId) {
|
|
1617
1633
|
if (!canMutate(sessionId)) return;
|
|
1618
1634
|
void restartSession(sessionId);
|
|
@@ -42,6 +42,7 @@ const HOST_ROUTES = defineApiRoutes({
|
|
|
42
42
|
createSession: { method: 'POST', path: '/sessions', host: true, response: apiResponse<unknown>() },
|
|
43
43
|
sessionDetail: { method: 'GET', path: '/sessions/:sessionId', host: true, response: apiResponse<unknown>() },
|
|
44
44
|
restart: { method: 'POST', path: '/restart', host: true },
|
|
45
|
+
move: { method: 'POST', path: '/move', host: true },
|
|
45
46
|
role: { method: 'POST', path: '/role', host: true },
|
|
46
47
|
history: { method: 'GET', path: '/history', host: true, response: apiResponse<unknown>() },
|
|
47
48
|
resume: { method: 'POST', path: '/resume', host: true, response: apiResponse<unknown>() },
|
|
@@ -97,6 +98,22 @@ export async function restartSession(sessionId: string): Promise<{ error: string
|
|
|
97
98
|
return failureOf(await host.session(sessionId).restart());
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
/** Re-read destination metadata after restart, closing a missed hub-upsert race. */
|
|
102
|
+
export async function moveSession(
|
|
103
|
+
sessionId: string,
|
|
104
|
+
workspaceId: string,
|
|
105
|
+
): Promise<Result<{ session?: SessionSummary }>> {
|
|
106
|
+
const owner = splitHostId(sessionId);
|
|
107
|
+
if (owner?.hostId !== splitHostId(workspaceId)?.hostId) return { error: 'Choose a workspace on the same computer.' };
|
|
108
|
+
const result = await host
|
|
109
|
+
.session(sessionId)
|
|
110
|
+
.move({ body: { workspaceId: splitHostId(workspaceId)?.localId ?? workspaceId } });
|
|
111
|
+
const failure = failureOf(result);
|
|
112
|
+
if (failure) return failure;
|
|
113
|
+
const session = await sessionDetail(workspaceId, owner?.localId ?? sessionId);
|
|
114
|
+
return session ? { session } : {};
|
|
115
|
+
}
|
|
116
|
+
|
|
100
117
|
export async function removeWorkspace(workspaceId: string): Promise<{ error: string } | undefined> {
|
|
101
118
|
return failureOf(await host.workspace(workspaceId).remove({ query: { removeSessions: true } }));
|
|
102
119
|
}
|