paseo-plugin-zcode-provider 0.1.0 → 0.3.0
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/NOTICE.md +2 -2
- package/README.md +28 -14
- package/client/account.tsx +827 -0
- package/client/diagnostics.tsx +2 -20
- package/client/{setup.tsx → runtime.tsx} +4 -55
- package/client/settings.tsx +84 -0
- package/client/value.tsx +20 -0
- package/index.client.tsx +7 -7
- package/index.server.ts +20 -2
- package/package.json +9 -6
- package/server/account.ts +781 -0
- package/server/build-info.ts +1 -1
- package/server/diagnostics.ts +17 -0
- package/server/discovery/discover.ts +1 -1
- package/server/discovery/manifest.ts +1 -1
- package/server/host/bridge.ts +51 -22
- package/server/presentation.ts +48 -6
- package/server/provider-status.ts +81 -0
- package/server/provider.ts +10 -3
- package/server/runtime/pins.ts +6 -4
- package/server/runtime-setup.ts +4 -29
- package/server/session.ts +2 -0
- package/server/unsupported-capabilities.ts +18 -0
- package/server/usage.ts +362 -0
- package/shared/account.ts +201 -0
- package/shared/runtime-setup.ts +0 -2
package/client/diagnostics.tsx
CHANGED
|
@@ -11,25 +11,7 @@ import {
|
|
|
11
11
|
zcodeDiagnostics,
|
|
12
12
|
type DiagnosticsResult,
|
|
13
13
|
} from "../shared/diagnostics";
|
|
14
|
-
|
|
15
|
-
function Value({
|
|
16
|
-
children,
|
|
17
|
-
color,
|
|
18
|
-
compact,
|
|
19
|
-
}: {
|
|
20
|
-
children: string;
|
|
21
|
-
color: string;
|
|
22
|
-
compact: boolean;
|
|
23
|
-
}) {
|
|
24
|
-
return (
|
|
25
|
-
<Text
|
|
26
|
-
selectable
|
|
27
|
-
style={{ color, fontSize: compact ? 13 : 14, lineHeight: 20 }}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</Text>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
14
|
+
import { Value } from "./value";
|
|
33
15
|
|
|
34
16
|
function Installation({ result, theme, compact }: SectionProps) {
|
|
35
17
|
return (
|
|
@@ -39,7 +21,7 @@ function Installation({ result, theme, compact }: SectionProps) {
|
|
|
39
21
|
label="Install root"
|
|
40
22
|
hint={
|
|
41
23
|
result.source === "managed"
|
|
42
|
-
? "Managed runtime installed from the
|
|
24
|
+
? "Managed runtime installed from the Settings screen"
|
|
43
25
|
: "PASEO_ZCODE_RUNTIME"
|
|
44
26
|
}
|
|
45
27
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Text, View } from "react-native";
|
|
3
3
|
import { type PluginSurfaceProps, useRpc } from "@getpaseo/plugin/client";
|
|
4
4
|
import {
|
|
5
5
|
SettingsAction,
|
|
@@ -13,29 +13,11 @@ import {
|
|
|
13
13
|
zcodeRuntimeStatus,
|
|
14
14
|
type RuntimeSetupStatus,
|
|
15
15
|
} from "../shared/runtime-setup";
|
|
16
|
+
import { Value } from "./value";
|
|
16
17
|
|
|
17
18
|
type Theme = PluginSurfaceProps["theme"];
|
|
18
19
|
type Job = RuntimeSetupStatus["job"];
|
|
19
20
|
|
|
20
|
-
function Value({
|
|
21
|
-
children,
|
|
22
|
-
color,
|
|
23
|
-
compact,
|
|
24
|
-
}: {
|
|
25
|
-
children: string;
|
|
26
|
-
color: string;
|
|
27
|
-
compact: boolean;
|
|
28
|
-
}) {
|
|
29
|
-
return (
|
|
30
|
-
<Text
|
|
31
|
-
selectable
|
|
32
|
-
style={{ color, fontSize: compact ? 13 : 14, lineHeight: 20 }}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
</Text>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
21
|
const megabytes = (bytes: number) => `${(bytes / 1_000_000).toFixed(1)} MB`;
|
|
40
22
|
|
|
41
23
|
function jobLabel(job: Job): string {
|
|
@@ -109,7 +91,7 @@ function Components({
|
|
|
109
91
|
);
|
|
110
92
|
}
|
|
111
93
|
|
|
112
|
-
export function
|
|
94
|
+
export function RuntimeTab({ theme, layout }: PluginSurfaceProps) {
|
|
113
95
|
const fetchStatus = useRpc(zcodeRuntimeStatus);
|
|
114
96
|
const install = useRpc(zcodeRuntimeInstall);
|
|
115
97
|
const remove = useRpc(zcodeRuntimeRemove);
|
|
@@ -191,7 +173,7 @@ export function SetupScreen({ theme, layout }: PluginSurfaceProps) {
|
|
|
191
173
|
</SettingsRow>
|
|
192
174
|
<SettingsRow
|
|
193
175
|
label="ZCode build"
|
|
194
|
-
hint="ZCode does not publish its CLI; CI builds the
|
|
176
|
+
hint="ZCode does not publish its CLI; CI builds the public source with this plugin's published patches."
|
|
195
177
|
>
|
|
196
178
|
<Value color={theme.colors.foreground} compact={compact}>
|
|
197
179
|
Unofficial, not endorsed by ZCode or Z.ai
|
|
@@ -270,39 +252,6 @@ export function SetupScreen({ theme, layout }: PluginSurfaceProps) {
|
|
|
270
252
|
) : null}
|
|
271
253
|
</SettingsSection>
|
|
272
254
|
<Components status={status} theme={theme} compact={compact} />
|
|
273
|
-
{status.loginCommand === undefined ? null : (
|
|
274
|
-
<SettingsSection title="Sign in to ZCode">
|
|
275
|
-
<SettingsCard>
|
|
276
|
-
<SettingsRow label="Run it">
|
|
277
|
-
<Value color={theme.colors.foreground} compact={compact}>
|
|
278
|
-
In a terminal on the daemon machine
|
|
279
|
-
</Value>
|
|
280
|
-
</SettingsRow>
|
|
281
|
-
<SettingsRow label="Authorization">
|
|
282
|
-
<Value color={theme.colors.foreground} compact={compact}>
|
|
283
|
-
Opens a browser; add --no-browser to print the URL
|
|
284
|
-
</Value>
|
|
285
|
-
</SettingsRow>
|
|
286
|
-
{/* A full-width block: a row value would squeeze the label column. */}
|
|
287
|
-
<View style={{ padding: compact ? 12 : 16 }}>
|
|
288
|
-
<Text
|
|
289
|
-
selectable
|
|
290
|
-
style={{
|
|
291
|
-
color: theme.colors.foreground,
|
|
292
|
-
fontFamily: Platform.select({
|
|
293
|
-
ios: "Menlo",
|
|
294
|
-
default: "monospace",
|
|
295
|
-
}),
|
|
296
|
-
fontSize: compact ? 12 : 13,
|
|
297
|
-
lineHeight: 20,
|
|
298
|
-
}}
|
|
299
|
-
>
|
|
300
|
-
{status.loginCommand}
|
|
301
|
-
</Text>
|
|
302
|
-
</View>
|
|
303
|
-
</SettingsCard>
|
|
304
|
-
</SettingsSection>
|
|
305
|
-
)}
|
|
306
255
|
<SettingsSection title="Remove">
|
|
307
256
|
<SettingsAction
|
|
308
257
|
label="Managed runtime"
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import type { PluginSurfaceProps } from "@getpaseo/plugin/client";
|
|
4
|
+
import { AccountTab } from "./account";
|
|
5
|
+
import { RuntimeTab } from "./runtime";
|
|
6
|
+
|
|
7
|
+
const TABS = [
|
|
8
|
+
{ id: "runtime", label: "Runtime" },
|
|
9
|
+
{ id: "account", label: "Account" },
|
|
10
|
+
] as const;
|
|
11
|
+
type Tab = (typeof TABS)[number]["id"];
|
|
12
|
+
|
|
13
|
+
// Plugin settings screens have no host tab control; this follows the look of
|
|
14
|
+
// the host's small segmented control.
|
|
15
|
+
function Tabs({
|
|
16
|
+
value,
|
|
17
|
+
onChange,
|
|
18
|
+
theme,
|
|
19
|
+
}: {
|
|
20
|
+
value: Tab;
|
|
21
|
+
onChange: (tab: Tab) => void;
|
|
22
|
+
theme: PluginSurfaceProps["theme"];
|
|
23
|
+
}) {
|
|
24
|
+
return (
|
|
25
|
+
<View
|
|
26
|
+
accessibilityRole="tablist"
|
|
27
|
+
style={{
|
|
28
|
+
flexDirection: "row",
|
|
29
|
+
alignSelf: "flex-start",
|
|
30
|
+
gap: 4,
|
|
31
|
+
padding: 2,
|
|
32
|
+
borderRadius: 12,
|
|
33
|
+
borderWidth: 1,
|
|
34
|
+
borderColor: theme.colors.border,
|
|
35
|
+
backgroundColor: theme.colors.surface1,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
{TABS.map((tab) => {
|
|
39
|
+
const selected = tab.id === value;
|
|
40
|
+
return (
|
|
41
|
+
<Pressable
|
|
42
|
+
key={tab.id}
|
|
43
|
+
accessibilityRole="tab"
|
|
44
|
+
accessibilityState={{ selected }}
|
|
45
|
+
onPress={() => onChange(tab.id)}
|
|
46
|
+
style={({ pressed }) => ({
|
|
47
|
+
minHeight: 28,
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
paddingHorizontal: 12,
|
|
50
|
+
borderRadius: 10,
|
|
51
|
+
backgroundColor:
|
|
52
|
+
selected || pressed ? theme.colors.surface2 : "transparent",
|
|
53
|
+
})}
|
|
54
|
+
>
|
|
55
|
+
<Text
|
|
56
|
+
style={{
|
|
57
|
+
color: selected
|
|
58
|
+
? theme.colors.foreground
|
|
59
|
+
: theme.colors.foregroundMuted,
|
|
60
|
+
fontSize: 14,
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
{tab.label}
|
|
64
|
+
</Text>
|
|
65
|
+
</Pressable>
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
68
|
+
</View>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function SettingsScreen(props: PluginSurfaceProps) {
|
|
73
|
+
const [tab, setTab] = useState<Tab>("runtime");
|
|
74
|
+
return (
|
|
75
|
+
<View style={{ gap: props.layout.compact ? 16 : 24 }}>
|
|
76
|
+
<Tabs value={tab} onChange={setTab} theme={props.theme} />
|
|
77
|
+
{tab === "runtime" ? (
|
|
78
|
+
<RuntimeTab {...props} />
|
|
79
|
+
) : (
|
|
80
|
+
<AccountTab {...props} onOpenRuntime={() => setTab("runtime")} />
|
|
81
|
+
)}
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
}
|
package/client/value.tsx
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Text } from "react-native";
|
|
2
|
+
|
|
3
|
+
export function Value({
|
|
4
|
+
children,
|
|
5
|
+
color,
|
|
6
|
+
compact,
|
|
7
|
+
}: {
|
|
8
|
+
children: string;
|
|
9
|
+
color: string;
|
|
10
|
+
compact: boolean;
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<Text
|
|
14
|
+
selectable
|
|
15
|
+
style={{ color, fontSize: compact ? 13 : 14, lineHeight: 20 }}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</Text>
|
|
19
|
+
);
|
|
20
|
+
}
|
package/index.client.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
2
|
import { DiagnosticsScreen } from "./client/diagnostics";
|
|
3
|
-
import {
|
|
3
|
+
import { SettingsScreen } from "./client/settings";
|
|
4
4
|
|
|
5
5
|
export default function contribute(client: PluginClientContext): () => void {
|
|
6
|
-
const
|
|
7
|
-
id: "
|
|
8
|
-
title: "
|
|
9
|
-
icon: "
|
|
10
|
-
Component:
|
|
6
|
+
const removeSettings = client.addSettingsScreen({
|
|
7
|
+
id: "settings",
|
|
8
|
+
title: "Settings",
|
|
9
|
+
icon: "Settings",
|
|
10
|
+
Component: SettingsScreen,
|
|
11
11
|
});
|
|
12
12
|
const removeDiagnostics = client.addSettingsScreen({
|
|
13
13
|
id: "diagnostics",
|
|
@@ -16,7 +16,7 @@ export default function contribute(client: PluginClientContext): () => void {
|
|
|
16
16
|
Component: DiagnosticsScreen,
|
|
17
17
|
});
|
|
18
18
|
return () => {
|
|
19
|
-
|
|
19
|
+
removeSettings();
|
|
20
20
|
removeDiagnostics();
|
|
21
21
|
};
|
|
22
22
|
}
|
package/index.server.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
1
2
|
import type { PluginServerContext } from "@getpaseo/plugin/server";
|
|
2
|
-
import {
|
|
3
|
+
import { AccountService } from "./server/account.js";
|
|
4
|
+
import { createHost, createZCodeProvider } from "./server/provider.js";
|
|
3
5
|
import { ManagedRuntimeInstaller } from "./server/runtime/managed.js";
|
|
4
6
|
import { createRuntimeSetupHandlers } from "./server/runtime-setup.js";
|
|
5
7
|
import { createDiagnosticsHandler } from "./server/status.js";
|
|
8
|
+
import { createUsageSource } from "./server/usage.js";
|
|
9
|
+
import { zcodeAccountChange, zcodeAccountView } from "./shared/account.js";
|
|
6
10
|
import { zcodeDiagnostics } from "./shared/diagnostics.js";
|
|
7
11
|
import {
|
|
8
12
|
zcodeRuntimeInstall,
|
|
@@ -17,5 +21,19 @@ export default function contribute(server: PluginServerContext): () => void {
|
|
|
17
21
|
server.handle(zcodeRuntimeStatus, setup.status);
|
|
18
22
|
server.handle(zcodeRuntimeInstall, setup.install);
|
|
19
23
|
server.handle(zcodeRuntimeRemove, setup.remove);
|
|
20
|
-
|
|
24
|
+
const abort = new AbortController();
|
|
25
|
+
const account = new AccountService(() =>
|
|
26
|
+
createHost({}, abort.signal, homedir()),
|
|
27
|
+
);
|
|
28
|
+
server.handle(zcodeAccountView, () => account.view());
|
|
29
|
+
server.handle(zcodeAccountChange, (input) => account.change(input));
|
|
30
|
+
// Usage sources arrived in Paseo 0.11; older daemons do not offer them.
|
|
31
|
+
const usage = createUsageSource(account);
|
|
32
|
+
if (typeof server.registerUsageSource === "function")
|
|
33
|
+
server.registerUsageSource(usage.source);
|
|
34
|
+
return () => {
|
|
35
|
+
usage.dispose();
|
|
36
|
+
abort.abort();
|
|
37
|
+
void account.close();
|
|
38
|
+
};
|
|
21
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-plugin-zcode-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Unofficial Paseo provider plugin for ZCode, using the official stdio Services Server of the integrated ZCode CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"paseo",
|
|
@@ -37,10 +37,11 @@
|
|
|
37
37
|
"test": "vitest run",
|
|
38
38
|
"test:upstream": "node scripts/check-upstream.mjs",
|
|
39
39
|
"test:runtime": "node scripts/check-runtime.mjs",
|
|
40
|
+
"test:usage-runtime": "node scripts/check-usage-runtime.mjs",
|
|
40
41
|
"test:steering-runtime": "node scripts/check-steering-runtime.mjs",
|
|
41
42
|
"build": "node scripts/build.mjs",
|
|
42
|
-
"format": "prettier --write index.client.tsx index.server.ts client server shared scripts test docs README.md NOTICE.md package.json tsconfig.json tsconfig.client.json vitest.config.ts paseo-plugin.json .github/workflows",
|
|
43
|
-
"format:check": "prettier --check index.client.tsx index.server.ts client server shared scripts test docs README.md NOTICE.md package.json tsconfig.json tsconfig.client.json vitest.config.ts paseo-plugin.json .github/workflows",
|
|
43
|
+
"format": "prettier --write index.client.tsx index.server.ts client server shared scripts test docs README.md NOTICE.md package.json tsconfig.json tsconfig.client.json vitest.config.ts paseo-plugin.json .github/workflows .github/actions",
|
|
44
|
+
"format:check": "prettier --check index.client.tsx index.server.ts client server shared scripts test docs README.md NOTICE.md package.json tsconfig.json tsconfig.client.json vitest.config.ts paseo-plugin.json .github/workflows .github/actions",
|
|
44
45
|
"check:zcode-releases": "node scripts/check-zcode-releases.mjs",
|
|
45
46
|
"check:paseo-releases": "node scripts/check-paseo-releases.mjs",
|
|
46
47
|
"prepare": "node scripts/generate-build-info.mjs",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"test:model-plan-runtime": "node scripts/check-model-plan-runtime.mjs",
|
|
49
50
|
"test:e2e": "node scripts/check-e2e.mjs",
|
|
50
51
|
"check:zcode-source": "node scripts/sync-zcode-source.mjs",
|
|
52
|
+
"check:zcode-patches": "node scripts/apply-zcode-patches.mjs check --source",
|
|
51
53
|
"test:stdio-runtime": "node scripts/check-stdio-runtime.mjs",
|
|
52
54
|
"test:native-restore": "node scripts/check-stdio-runtime.mjs --check-native-restore",
|
|
53
55
|
"setup:managed-runtime": "node scripts/install-managed-runtime.mjs",
|
|
@@ -58,9 +60,9 @@
|
|
|
58
60
|
"semver": "7.8.5"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
|
-
"@getpaseo/client": "0.
|
|
62
|
-
"@getpaseo/plugin": "0.
|
|
63
|
-
"@getpaseo/protocol": "0.
|
|
63
|
+
"@getpaseo/client": "0.11.0-beta.5",
|
|
64
|
+
"@getpaseo/plugin": "0.11.0-beta.5",
|
|
65
|
+
"@getpaseo/protocol": "0.11.0-beta.5",
|
|
64
66
|
"@types/node": "22.18.3",
|
|
65
67
|
"@types/react": "~19.2.0",
|
|
66
68
|
"@types/semver": "7.8.0",
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
"turndown": "7.2.4",
|
|
73
75
|
"typescript": "5.9.2",
|
|
74
76
|
"vitest": "3.2.7",
|
|
77
|
+
"which": "5.0.0",
|
|
75
78
|
"zod": "4.4.3"
|
|
76
79
|
}
|
|
77
80
|
}
|