@agimon-ai/po-native 0.0.1-alpha.20 → 0.0.1-alpha.22
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 +17 -10
- package/src/app/liveRuntime.ts +2 -2
- package/src/app/nativeTemplate.tsx +3 -2
- package/src/app/useHome.ts +2 -2
- package/src/components/homeApps.ts +29 -8
- package/src/screens/AppearanceScreen.tsx +1 -1
- package/src/screens/ContributedSettingsScreen.tsx +5 -5
- package/src/screens/MultiHostDesign.stories.tsx +1 -1
- package/src/screens/PluginsScreen.tsx +1 -1
- package/src/screens/SettingsScreen.stories.tsx +1 -1
- package/src/screens/homeModel.ts +2 -3
- package/src/services/pluginRuntime/index.ts +11 -5
- package/src/services/settingsApi/index.ts +9 -3
- package/src/services/workspaceProviders/index.ts +11 -2
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.22",
|
|
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.142",
|
|
33
|
+
"@agimon-ai/po-expo-signing": "0.0.1-alpha.22",
|
|
34
|
+
"@agimon-ai/po-identity": "0.0.2-alpha.89",
|
|
35
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.142",
|
|
36
|
+
"@agimon-ai/po-native-dashboard": "0.0.0-alpha.14",
|
|
37
|
+
"@agimon-ai/po-template-advanced": "0.0.0-alpha.142",
|
|
38
|
+
"@agimon-ai/po-template-elegant": "0.0.0-alpha.142",
|
|
39
|
+
"@agimon-ai/po-voice": "0.0.0-alpha.142",
|
|
40
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.142",
|
|
41
|
+
"@agimon-ai/po-web-dashboard": "0.0.0-alpha.142",
|
|
42
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.142",
|
|
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
|
@@ -674,7 +674,7 @@ function SessionRoute({
|
|
|
674
674
|
const summary = entry?.summary;
|
|
675
675
|
const activityLoad = useActivityLoad(splitHostId(sessionId)?.hostId, [
|
|
676
676
|
'catalog',
|
|
677
|
-
'
|
|
677
|
+
'host',
|
|
678
678
|
`workspace:${summary?.workspaceId}`,
|
|
679
679
|
`session:${sessionId}`,
|
|
680
680
|
]);
|
|
@@ -1149,7 +1149,7 @@ function SettingsRoute(
|
|
|
1149
1149
|
const refused = chosen && !chosen.online ? `${chosen.label} is offline.` : HOST_OWNERSHIP_PENDING;
|
|
1150
1150
|
const panels = useSettingsPanels(settingsHost);
|
|
1151
1151
|
const panelGroups = useSettingsPanelGroups(props.phoneOnly ? props.computers : undefined);
|
|
1152
|
-
const sections = useSettingsSections('
|
|
1152
|
+
const sections = useSettingsSections('host', settingsHost);
|
|
1153
1153
|
const sectionKeys = sections.flatMap((section) => section.fields.map(settingsKeyOf)).join('\n');
|
|
1154
1154
|
const plugins = (
|
|
1155
1155
|
settingsHost === undefined ? installedWebPlugins() : webPluginRegistryForHost(settingsHost).installedWebPlugins()
|
|
@@ -1399,7 +1399,7 @@ function PluginsRoute({ route }: NativeStackScreenProps<Routes, 'SettingsPlugins
|
|
|
1399
1399
|
|
|
1400
1400
|
function ContributedSectionRoute({ route }: NativeStackScreenProps<Routes, 'SettingsSection'>) {
|
|
1401
1401
|
const { id, hostId, workspace } = route.params;
|
|
1402
|
-
const section = useSettingsSections(workspace ? 'workspace' : '
|
|
1402
|
+
const section = useSettingsSections(workspace ? 'workspace' : 'host', hostId).find(
|
|
1403
1403
|
(candidate) => candidate.id === id,
|
|
1404
1404
|
);
|
|
1405
1405
|
if (!section) return <EmptyState title="This page is not installed" description="Go back to Settings." />;
|
|
@@ -1419,7 +1419,7 @@ function ContributedSection({
|
|
|
1419
1419
|
return (
|
|
1420
1420
|
<ContributedSettingsScreen
|
|
1421
1421
|
section={section}
|
|
1422
|
-
scope={workspace ? 'repository' : '
|
|
1422
|
+
scope={workspace ? 'repository' : 'host'}
|
|
1423
1423
|
repoRoot={workspace?.repoRoot ?? ''}
|
|
1424
1424
|
{...model}
|
|
1425
1425
|
/>
|
|
@@ -1453,7 +1453,7 @@ function AppearanceRoute() {
|
|
|
1453
1453
|
useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision);
|
|
1454
1454
|
const mount =
|
|
1455
1455
|
model.target === 'global'
|
|
1456
|
-
? ({ scope: '
|
|
1456
|
+
? ({ scope: 'host' } as const)
|
|
1457
1457
|
: ({
|
|
1458
1458
|
scope: 'workspace',
|
|
1459
1459
|
workspaceId: hostId === undefined ? model.target : qualifyHostId(hostId, model.target),
|
|
@@ -2286,7 +2286,7 @@ function WorkspaceRoute({ workspaceId, hostStates }: { workspaceId: string; host
|
|
|
2286
2286
|
const host = hostStates.find((state) => state.host.id === owner?.hostId);
|
|
2287
2287
|
const calendarHost = useCalendarHostProps(host ? [host] : [], owner?.hostId);
|
|
2288
2288
|
const openWorkspace = useOpenWorkspace(owner?.hostId);
|
|
2289
|
-
const { loading, error } = useActivityLoad(owner?.hostId, ['catalog', '
|
|
2289
|
+
const { loading, error } = useActivityLoad(owner?.hostId, ['catalog', 'host', `workspace:${workspaceId}`]);
|
|
2290
2290
|
const state = workspacePageState({ hostStatus: host?.status, workspace, loading, error });
|
|
2291
2291
|
if (!owner || state !== 'ready') return <WorkspaceScreen state={owner ? state : 'missing'} error={error} />;
|
|
2292
2292
|
const registry = webPluginRegistryForHost(owner.hostId);
|
|
@@ -2431,17 +2431,17 @@ function useHomeApps(
|
|
|
2431
2431
|
const calendarHost = useCalendarHostProps(hostStates, undefined);
|
|
2432
2432
|
const openWorkspace = useOpenWorkspace();
|
|
2433
2433
|
return homeAppEntries(
|
|
2434
|
-
hostStates.map(({ host }) => host),
|
|
2434
|
+
hostStates.map(({ host, status }) => ({ ...host, connected: status === 'connected' })),
|
|
2435
2435
|
(hostId) => {
|
|
2436
2436
|
const registry = webPluginRegistryForHost(hostId);
|
|
2437
|
-
return [...registry.dashboardTileFills({ scope: '
|
|
2437
|
+
return [...registry.dashboardTileFills({ scope: 'host' }), ...registry.legacyHomeAppFills()].sort(
|
|
2438
2438
|
(left, right) =>
|
|
2439
2439
|
(left.order ?? 1000) - (right.order ?? 1000) ||
|
|
2440
2440
|
left.pluginId.localeCompare(right.pluginId) ||
|
|
2441
2441
|
left.id.localeCompare(right.id),
|
|
2442
2442
|
);
|
|
2443
2443
|
},
|
|
2444
|
-
).flatMap<NativeDashboardTile>(({ hostId, fill, key }) => {
|
|
2444
|
+
).flatMap<NativeDashboardTile>(({ hostId, fill, key, global }) => {
|
|
2445
2445
|
const Card = fill.component;
|
|
2446
2446
|
if (!Card) return [];
|
|
2447
2447
|
const registry = webPluginRegistryForHost(hostId);
|
|
@@ -2460,7 +2460,14 @@ function useHomeApps(
|
|
|
2460
2460
|
sessionId: null,
|
|
2461
2461
|
// The card reads the same computers as the page it opens.
|
|
2462
2462
|
...calendarHost,
|
|
2463
|
-
|
|
2463
|
+
// A global tile reads a shared backend: give it only its serving computer so it calls once.
|
|
2464
|
+
host: {
|
|
2465
|
+
...calendarHost.host,
|
|
2466
|
+
hostId,
|
|
2467
|
+
...(global
|
|
2468
|
+
? { connectedHosts: calendarHost.host.connectedHosts.filter((entry) => entry.hostId === hostId) }
|
|
2469
|
+
: {}),
|
|
2470
|
+
},
|
|
2464
2471
|
openWorkspace: (id: string) => openWorkspace(splitHostId(id) ? id : qualifyHostId(hostId, id)),
|
|
2465
2472
|
openSettings,
|
|
2466
2473
|
openPage: (pageId: string) => {
|
package/src/app/liveRuntime.ts
CHANGED
|
@@ -500,7 +500,7 @@ export function startLiveRuntime(
|
|
|
500
500
|
? `session:${target.sessionId}`
|
|
501
501
|
: target.scope === 'workspace'
|
|
502
502
|
? `workspace:${target.workspaceId}`
|
|
503
|
-
: '
|
|
503
|
+
: 'host';
|
|
504
504
|
if (target.scope === 'session') {
|
|
505
505
|
const previous = selectedSessions.get(target.sessionId);
|
|
506
506
|
if (previous) composition = previous;
|
|
@@ -572,7 +572,7 @@ export function startLiveRuntime(
|
|
|
572
572
|
|
|
573
573
|
const applyCatalog = async (catalog: NativeBundleCatalog) => {
|
|
574
574
|
if (closed) return;
|
|
575
|
-
await mount({ scope: '
|
|
575
|
+
await mount({ scope: 'host' }, catalog.nativeGlobal);
|
|
576
576
|
if (closed) return;
|
|
577
577
|
const present = new Set(
|
|
578
578
|
catalog.workspaces.map((w) => (host.id === undefined ? w.id : qualifyHostId(host.id, w.id))),
|
|
@@ -26,7 +26,7 @@ interface NativeTemplateChoice {
|
|
|
26
26
|
mount: WebPluginMount;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const GLOBAL: NativeTemplateChoice = { mount: { scope: '
|
|
29
|
+
const GLOBAL: NativeTemplateChoice = { mount: { scope: 'host' } };
|
|
30
30
|
|
|
31
31
|
const workspaceOf = (mount: WebPluginMount) => (mount.scope === 'workspace' ? mount.workspaceId : undefined);
|
|
32
32
|
const sameChoice = (left: NativeTemplateChoice, right: NativeTemplateChoice) =>
|
|
@@ -52,7 +52,8 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
52
52
|
|
|
53
53
|
function mountOf(value: unknown): WebPluginMount | undefined {
|
|
54
54
|
if (!isRecord(value)) return undefined;
|
|
55
|
-
|
|
55
|
+
// The po.hub@1 wire spells the host mount 'global'; 'host' is accepted for hosts that already send it.
|
|
56
|
+
if (value.scope === 'global' || value.scope === 'host') return { scope: 'host' };
|
|
56
57
|
if (value.scope === 'workspace' && typeof value.workspaceId === 'string')
|
|
57
58
|
return { scope: 'workspace', workspaceId: value.workspaceId };
|
|
58
59
|
return undefined;
|
package/src/app/useHome.ts
CHANGED
|
@@ -41,7 +41,7 @@ export function useHome(
|
|
|
41
41
|
useEffect(() => subscribeWebPluginRegistry(() => registryChanged((version) => version + 1)), []);
|
|
42
42
|
const contributions = useMemo(() => {
|
|
43
43
|
const entries = [
|
|
44
|
-
...pluginHomeContributions({ scope: '
|
|
44
|
+
...pluginHomeContributions({ scope: 'host' }),
|
|
45
45
|
...workspaces.flatMap((workspace) => pluginHomeContributions({ scope: 'workspace', workspaceId: workspace.id })),
|
|
46
46
|
];
|
|
47
47
|
return [...new Map(entries.map((item) => [JSON.stringify([item.pluginId, item.id, item.mount]), item])).values()];
|
|
@@ -191,7 +191,7 @@ export function useHomes(
|
|
|
191
191
|
const state = reader?.store.state ?? disconnected.state;
|
|
192
192
|
const own = workspaces.filter((workspace) => splitHostId(workspace.id)?.hostId === hostId);
|
|
193
193
|
const contributions = [
|
|
194
|
-
...webPluginRegistryForHost(hostId).pluginHomeContributions({ scope: '
|
|
194
|
+
...webPluginRegistryForHost(hostId).pluginHomeContributions({ scope: 'host' }),
|
|
195
195
|
...own.flatMap((workspace) => pluginHomeContributions({ scope: 'workspace', workspaceId: workspace.id })),
|
|
196
196
|
];
|
|
197
197
|
const sessions =
|
|
@@ -34,28 +34,49 @@ export function placeTiles(sizes: readonly HomeTileSize[], columns: number) {
|
|
|
34
34
|
interface HomeHost {
|
|
35
35
|
id: string;
|
|
36
36
|
person?: { issuer: string; subject: string };
|
|
37
|
+
connected?: boolean;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
type FillScope = { combinesComputers?: unknown; dataScope?: unknown } | undefined;
|
|
41
|
+
|
|
39
42
|
/**
|
|
40
43
|
* One card per computer, except for a plugin whose page joins every computer (its fill sets
|
|
41
44
|
* `data.combinesComputers`, as the calendar does): that one shows once per person. Unlinked
|
|
42
45
|
* computers join the phone's one account, or share a card of their own when it holds several.
|
|
46
|
+
* A fill with `data.dataScope: 'global'` reads a shared backend, so it also shows once per person,
|
|
47
|
+
* from that person's first connected computer, and is marked `global` so it reads only that one.
|
|
43
48
|
*/
|
|
44
49
|
export function homeAppEntries<T extends { pluginId: string; id: string; data?: unknown }>(
|
|
45
50
|
hosts: readonly HomeHost[],
|
|
46
51
|
read: (hostId: string) => readonly T[],
|
|
47
52
|
) {
|
|
48
|
-
const seen = new Set<string>();
|
|
49
53
|
const people = new Set(hosts.flatMap((host) => (host.person ? [JSON.stringify(host.person)] : [])));
|
|
50
54
|
const unlinked = people.size === 1 ? [...people][0]! : 'unlinked';
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const fills = hosts.map((host) => ({ host, fills: read(host.id) }));
|
|
56
|
+
const keyOf = (host: HomeHost, fill: T) => {
|
|
57
|
+
const scope = fill.data as FillScope;
|
|
58
|
+
const perPerson = scope?.combinesComputers === true || scope?.dataScope === 'global';
|
|
59
|
+
const owner = perPerson ? (host.person ? JSON.stringify(host.person) : unlinked) : host.id;
|
|
60
|
+
return JSON.stringify([owner, splitHostId(fill.pluginId)?.localId ?? fill.pluginId, fill.id]);
|
|
61
|
+
};
|
|
62
|
+
// A global fill is served by the first connected computer that has it, else the first one.
|
|
63
|
+
const globalHost = new Map<string, string>();
|
|
64
|
+
for (const connectedPass of [true, false])
|
|
65
|
+
for (const { host, fills: hostFills } of fills)
|
|
66
|
+
if ((host.connected !== false) === connectedPass)
|
|
67
|
+
for (const fill of hostFills)
|
|
68
|
+
if ((fill.data as FillScope)?.dataScope === 'global') {
|
|
69
|
+
const key = keyOf(host, fill);
|
|
70
|
+
if (!globalHost.has(key)) globalHost.set(key, host.id);
|
|
71
|
+
}
|
|
72
|
+
const seen = new Set<string>();
|
|
73
|
+
return fills.flatMap(({ host, fills: hostFills }) =>
|
|
74
|
+
hostFills.flatMap((fill) => {
|
|
75
|
+
const key = keyOf(host, fill);
|
|
76
|
+
const chosen = globalHost.get(key);
|
|
77
|
+
if (seen.has(key) || (chosen !== undefined && chosen !== host.id)) return [];
|
|
57
78
|
seen.add(key);
|
|
58
|
-
return [{ hostId: host.id, fill, key }];
|
|
79
|
+
return [{ hostId: host.id, fill, key, global: chosen !== undefined }];
|
|
59
80
|
}),
|
|
60
81
|
);
|
|
61
82
|
}
|
|
@@ -209,7 +209,7 @@ export function useAppearance(
|
|
|
209
209
|
|
|
210
210
|
const save = (value: string | null) => {
|
|
211
211
|
if (config === undefined || busy) return;
|
|
212
|
-
const scope = workspaceId === undefined ? '
|
|
212
|
+
const scope = workspaceId === undefined ? 'host' : 'repository';
|
|
213
213
|
setBusy(true);
|
|
214
214
|
setSaveError(undefined);
|
|
215
215
|
void writeSettingsValues(
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
ProviderAuthSummary,
|
|
18
18
|
SettingsConfigView,
|
|
19
19
|
SettingsModel,
|
|
20
|
-
|
|
20
|
+
SettingsFileScope,
|
|
21
21
|
SettingsValueView,
|
|
22
22
|
} from '@agimon-ai/po-web-dashboard/types';
|
|
23
23
|
import { Fragment, type ReactNode, useCallback, useEffect, useState } from 'react';
|
|
@@ -46,7 +46,7 @@ import { Group, Row, SectionPage, sentenceCase } from './SettingsScreen';
|
|
|
46
46
|
/** Where a field's value came from, as one badge; silence means the default. */
|
|
47
47
|
export function originOf(
|
|
48
48
|
view: SettingsValueView | undefined,
|
|
49
|
-
scope:
|
|
49
|
+
scope: SettingsFileScope,
|
|
50
50
|
dirty: boolean,
|
|
51
51
|
): 'unsaved' | 'set-here' | 'from-global' | 'overridden' | undefined {
|
|
52
52
|
if (dirty) return 'unsaved';
|
|
@@ -76,7 +76,7 @@ export function sectionSummary(
|
|
|
76
76
|
|
|
77
77
|
export interface ContributedSettingsScreenProps {
|
|
78
78
|
section: SettingsSectionContribution;
|
|
79
|
-
scope:
|
|
79
|
+
scope: SettingsFileScope;
|
|
80
80
|
/** The repository path a workspace page writes to; empty at global scope. */
|
|
81
81
|
repoRoot: string;
|
|
82
82
|
config?: SettingsConfigView;
|
|
@@ -316,7 +316,7 @@ export function ContributedSettingsScreen(props: ContributedSettingsScreenProps)
|
|
|
316
316
|
|
|
317
317
|
/** The sections plugins contribute at one scope, from the named computer's registry; re-read on install. */
|
|
318
318
|
export function useSettingsSections(
|
|
319
|
-
scope: '
|
|
319
|
+
scope: 'host' | 'workspace',
|
|
320
320
|
hostId?: string,
|
|
321
321
|
): readonly SettingsSectionContribution[] {
|
|
322
322
|
const [, setVersion] = useState(0);
|
|
@@ -363,7 +363,7 @@ export function useContributedSettings(
|
|
|
363
363
|
});
|
|
364
364
|
}, [reload, section, hostId]);
|
|
365
365
|
|
|
366
|
-
const scope:
|
|
366
|
+
const scope: SettingsFileScope = workspaceId === undefined ? 'host' : 'repository';
|
|
367
367
|
const save = async () => {
|
|
368
368
|
if (config === undefined) return;
|
|
369
369
|
const edits = plannedSettingsWrites({
|
|
@@ -58,7 +58,7 @@ function MultiHost({
|
|
|
58
58
|
const [firstHostUUID, setFirstHost] = useState(HOSTS[0]!.id);
|
|
59
59
|
const [secondHostUUID, setSecondHost] = useState(HOSTS[1]!.id);
|
|
60
60
|
const [headerAction, setHeaderAction] = useState<ReactNode>(null);
|
|
61
|
-
const Sessions = nativePlugin.
|
|
61
|
+
const Sessions = nativePlugin.host?.nativeTemplates?.[0]?.screens.sessions;
|
|
62
62
|
const source = templateRailStub().rail.workspaces[0]!;
|
|
63
63
|
const workspaces =
|
|
64
64
|
phase === 'empty'
|
|
@@ -16,7 +16,7 @@ import { Group, Row, SectionPage } from './SettingsScreen';
|
|
|
16
16
|
export function contributesSummary(plugin: WebPluginDefinition): string {
|
|
17
17
|
const scopes: readonly WebPluginContributions[] = [
|
|
18
18
|
plugin,
|
|
19
|
-
...[plugin.
|
|
19
|
+
...[plugin.host, plugin.workspace, plugin.session].filter(
|
|
20
20
|
(scope): scope is WebPluginContributions => scope !== undefined,
|
|
21
21
|
),
|
|
22
22
|
];
|
|
@@ -259,7 +259,7 @@ const REPOSITORY: RepositorySettingsView = {
|
|
|
259
259
|
profiles: [{ name: 'ponytail' }, { name: 'reviewer' }],
|
|
260
260
|
},
|
|
261
261
|
selection: {
|
|
262
|
-
majorMode: { effective: 'copilot', origin: '
|
|
262
|
+
majorMode: { effective: 'copilot', origin: 'host' },
|
|
263
263
|
domains: { effective: ['development'], repository: ['development', 'testing'], origin: 'repository' },
|
|
264
264
|
profile: { effective: 'ponytail', origin: 'default' },
|
|
265
265
|
},
|
package/src/screens/homeModel.ts
CHANGED
|
@@ -118,8 +118,7 @@ export function homeOverview(
|
|
|
118
118
|
const snapshot = state.snapshot;
|
|
119
119
|
const contributionFor = (source: string, workspaceId?: string) =>
|
|
120
120
|
contributions.find(
|
|
121
|
-
(item) =>
|
|
122
|
-
item.data.source === source && (item.mount.scope === 'global' || item.mount.workspaceId === workspaceId),
|
|
121
|
+
(item) => item.data.source === source && (item.mount.scope === 'host' || item.mount.workspaceId === workspaceId),
|
|
123
122
|
);
|
|
124
123
|
const rows: HomeAttentionRow[] = [];
|
|
125
124
|
const packageSessions = new Set<string>();
|
|
@@ -192,7 +191,7 @@ export function homeOverview(
|
|
|
192
191
|
!statuses.some(
|
|
193
192
|
(status) =>
|
|
194
193
|
status.source === contribution.data.source &&
|
|
195
|
-
(contribution.mount.scope === '
|
|
194
|
+
(contribution.mount.scope === 'host' || contribution.mount.workspaceId === status.workspaceId),
|
|
196
195
|
),
|
|
197
196
|
).length;
|
|
198
197
|
const dormant = sessions.filter((session) => session.dormant).length;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
normalizeLegacyWebPluginDefinition,
|
|
3
|
+
type WebPluginDefinition,
|
|
4
|
+
type WebPluginMount,
|
|
5
|
+
type WebPluginRuntime,
|
|
6
|
+
} from '@agimon-ai/po-core/web';
|
|
2
7
|
import {
|
|
3
8
|
bindSessionWebWorkspace,
|
|
4
9
|
dispatchChannelFrame,
|
|
@@ -80,7 +85,7 @@ function compatibilityOf(error: unknown, pluginId: string, hostId?: string): Plu
|
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
function mountKey(mount: WebPluginMount): string {
|
|
83
|
-
if (mount.scope === '
|
|
88
|
+
if (mount.scope === 'host') return 'host';
|
|
84
89
|
if (mount.scope === 'workspace') return `workspace:${mount.workspaceId}`;
|
|
85
90
|
return `session:${mount.sessionId}`;
|
|
86
91
|
}
|
|
@@ -137,7 +142,8 @@ function exportedPlugins(
|
|
|
137
142
|
const exports = evaluate(bundle.source, hostModules) as { nativePlugin?: unknown } | null;
|
|
138
143
|
const plugin = typeof exports === 'object' && exports !== null ? exports.nativePlugin : undefined;
|
|
139
144
|
if (typeof plugin !== 'object' || plugin === null) throw new Error('The module exported no nativePlugin.');
|
|
140
|
-
|
|
145
|
+
// A bundle built before the rename keys its host contributions 'global'.
|
|
146
|
+
return [normalizeLegacyWebPluginDefinition(plugin as WebPluginDefinition)];
|
|
141
147
|
} catch (error) {
|
|
142
148
|
console.warn(`native plugin '${pluginId}' failed to load`, error);
|
|
143
149
|
onFailure(pluginId, error);
|
|
@@ -247,7 +253,7 @@ export function createPluginRuntime(options: PluginRuntimeOptions) {
|
|
|
247
253
|
try {
|
|
248
254
|
entry.stop();
|
|
249
255
|
} finally {
|
|
250
|
-
if (entry.mount.scope === '
|
|
256
|
+
if (entry.mount.scope === 'host') {
|
|
251
257
|
if (!preserveGlobal) registry.installGlobalWebPlugins([]);
|
|
252
258
|
} else if (entry.mount.scope === 'workspace') registry.removeWorkspaceWebPlugins(entry.mount.workspaceId);
|
|
253
259
|
else registry.removeSessionWebPlugins(entry.mount.sessionId);
|
|
@@ -291,7 +297,7 @@ export function createPluginRuntime(options: PluginRuntimeOptions) {
|
|
|
291
297
|
return;
|
|
292
298
|
}
|
|
293
299
|
stopMount(owner);
|
|
294
|
-
if (mount.scope === '
|
|
300
|
+
if (mount.scope === 'host') registry.installGlobalWebPlugins(definitions);
|
|
295
301
|
else if (mount.scope === 'workspace') registry.installWorkspaceWebPlugins(mount.workspaceId, definitions);
|
|
296
302
|
else {
|
|
297
303
|
registry.bindSessionWebWorkspace(mount.sessionId, mount.workspaceId);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
repositorySettingsViewFromWire,
|
|
3
|
+
settingsConfigViewFromWire,
|
|
4
|
+
settingsWriteToWire,
|
|
5
|
+
} from '@agimon-ai/po-web-dashboard/core';
|
|
1
6
|
import {
|
|
2
7
|
AUTH_LOGINS_API_ROUTE,
|
|
3
8
|
AUTH_PROVIDERS_API_ROUTE,
|
|
@@ -174,7 +179,7 @@ function workspaceRoute(route: string, workspaceId: string): string {
|
|
|
174
179
|
}
|
|
175
180
|
|
|
176
181
|
const pickConfig = (body: Record<string, unknown>) =>
|
|
177
|
-
isRecord(body.hashes) && isRecord(body.values) ? { config: body
|
|
182
|
+
isRecord(body.hashes) && isRecord(body.values) ? { config: settingsConfigViewFromWire(body) } : undefined;
|
|
178
183
|
|
|
179
184
|
/** The values of `keys` at global scope, or as one workspace's repository reads them. */
|
|
180
185
|
export function readSettingsConfig(
|
|
@@ -204,7 +209,7 @@ export function writeSettingsValues(
|
|
|
204
209
|
write.scope === 'repository' && workspaceId !== undefined
|
|
205
210
|
? workspaceRoute(SETTINGS_VALUE_API_ROUTE, workspaceId)
|
|
206
211
|
: SETTINGS_VALUE_API_ROUTE,
|
|
207
|
-
{ method: 'PUT', headers: JSON_HEADERS, body: JSON.stringify(write) },
|
|
212
|
+
{ method: 'PUT', headers: JSON_HEADERS, body: JSON.stringify(settingsWriteToWire(write)) },
|
|
208
213
|
pickConfig,
|
|
209
214
|
hostId,
|
|
210
215
|
);
|
|
@@ -252,7 +257,7 @@ export function listRepositories(hostId?: string): Promise<Result<{ repositories
|
|
|
252
257
|
|
|
253
258
|
const pickRepository = (body: Record<string, unknown>) =>
|
|
254
259
|
typeof body.hash === 'string' && isRecord(body.selection)
|
|
255
|
-
? { settings: body
|
|
260
|
+
? { settings: repositorySettingsViewFromWire(body) }
|
|
256
261
|
: undefined;
|
|
257
262
|
|
|
258
263
|
export function readRepositorySettings(
|
|
@@ -356,6 +361,7 @@ export function addMcpServer(
|
|
|
356
361
|
trusted: boolean,
|
|
357
362
|
hostId?: string,
|
|
358
363
|
): Promise<Result<{ ok: true }>> {
|
|
364
|
+
// ponytail: the MCP settings wire spells the host tier 'global' until Phase 10, so older hosts still accept it.
|
|
359
365
|
return request(
|
|
360
366
|
MCP_SERVERS_ROUTE,
|
|
361
367
|
{ method: 'POST', headers: JSON_HEADERS, body: JSON.stringify({ scope: 'global', name, entry, trusted }) },
|
|
@@ -33,7 +33,8 @@ function provider(value: unknown): value is FederationProvider {
|
|
|
33
33
|
(op) =>
|
|
34
34
|
record(op) &&
|
|
35
35
|
typeof op.scope === 'string' &&
|
|
36
|
-
|
|
36
|
+
// The hub sends the wire value 'global' for host operations; 'host' is the plugin-scope name.
|
|
37
|
+
['host', 'global', 'workspace', 'session'].includes(op.scope) &&
|
|
37
38
|
names(op.names),
|
|
38
39
|
)
|
|
39
40
|
);
|
|
@@ -43,7 +44,15 @@ function provider(value: unknown): value is FederationProvider {
|
|
|
43
44
|
export function parseWorkspaceProviders(body: unknown, workspaceId: string): FederationProvider[] | undefined {
|
|
44
45
|
if (!record(body) || !Array.isArray(body.workspaces)) return undefined;
|
|
45
46
|
const workspace = body.workspaces.find((item) => record(item) && item.id === workspaceId);
|
|
46
|
-
return record(workspace) && Array.isArray(workspace.providers)
|
|
47
|
+
return record(workspace) && Array.isArray(workspace.providers)
|
|
48
|
+
? workspace.providers.filter(provider).map((item) => ({
|
|
49
|
+
...item,
|
|
50
|
+
operations: item.operations.map((op) => ({
|
|
51
|
+
...op,
|
|
52
|
+
scope: (op.scope as string) === 'global' ? 'host' : op.scope,
|
|
53
|
+
})),
|
|
54
|
+
}))
|
|
55
|
+
: undefined;
|
|
47
56
|
}
|
|
48
57
|
export function parseProviderNetwork(body: unknown): { hostId: string; networkId: string } | undefined {
|
|
49
58
|
if (
|