@jmfederico/pi-web 1.202606.1 → 1.202606.2
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/README.md +4 -2
- package/dist/client/assets/{CodeViewer-BcQUZop_.js → CodeViewer-iYSv2-dg.js} +1 -1
- package/dist/client/assets/{TerminalPanel-1o4j3QP_.js → TerminalPanel-BpFW6j27.js} +1 -1
- package/dist/client/assets/index-D4dbiKXF.js +2210 -0
- package/dist/client/index.html +1 -1
- package/dist/pi-web-plugins/updates/package.json +1 -1
- package/dist/server/app.js +11 -4
- package/dist/server/app.js.map +1 -1
- package/dist/server/machines/machinePluginProxyRoutes.js +8 -0
- package/dist/server/machines/machinePluginProxyRoutes.js.map +1 -1
- package/dist/server/machines/machineRoutes.js +6 -0
- package/dist/server/machines/machineRoutes.js.map +1 -1
- package/dist/server/machines/machineService.js +97 -5
- package/dist/server/machines/machineService.js.map +1 -1
- package/dist/server/piWebPluginService.js +24 -4
- package/dist/server/piWebPluginService.js.map +1 -1
- package/dist/server/piWebStatus.js +127 -36
- package/dist/server/piWebStatus.js.map +1 -1
- package/dist/server/piWebStatusCache.js +32 -0
- package/dist/server/piWebStatusCache.js.map +1 -0
- package/dist/server/sessiond/sessionProxyRoutes.js +2 -1
- package/dist/server/sessiond/sessionProxyRoutes.js.map +1 -1
- package/dist/server/sessiond.js +18 -7
- package/dist/server/sessiond.js.map +1 -1
- package/dist/server/sessions/piSessionManagerGateway.js +87 -0
- package/dist/server/sessions/piSessionManagerGateway.js.map +1 -0
- package/dist/server/sessions/piSessionService.js +128 -61
- package/dist/server/sessions/piSessionService.js.map +1 -1
- package/dist/server/sessions/sessionArchiveStore.js +12 -0
- package/dist/server/sessions/sessionArchiveStore.js.map +1 -1
- package/dist/server/sessions/sessionRoutes.js +126 -43
- package/dist/server/sessions/sessionRoutes.js.map +1 -1
- package/dist/server/workspaces/fileSuggestions.js +96 -16
- package/dist/server/workspaces/fileSuggestions.js.map +1 -1
- package/dist/shared/apiTypes.d.ts +36 -2
- package/dist/shared/apiTypes.js +3 -1
- package/dist/shared/apiTypes.js.map +1 -1
- package/dist/shared/capabilities.js +25 -0
- package/dist/shared/capabilities.js.map +1 -0
- package/dist/shared/federatedRoutes.js +2 -0
- package/dist/shared/federatedRoutes.js.map +1 -1
- package/dist/shared/piWebStatusParsing.js +43 -0
- package/dist/shared/piWebStatusParsing.js.map +1 -1
- package/docs/plugins.md +22 -26
- package/package.json +1 -1
- package/dist/client/assets/index-CM8WX5nf.js +0 -1994
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export type MachineKind = "local" | "remote";
|
|
2
2
|
export type MachineStatus = "unknown" | "online" | "offline" | "error";
|
|
3
|
+
export declare const PI_WEB_CAPABILITIES: {
|
|
4
|
+
readonly sessionsDeleteArchived: "sessions.deleteArchived";
|
|
5
|
+
};
|
|
6
|
+
export type PiWebCapability = typeof PI_WEB_CAPABILITIES[keyof typeof PI_WEB_CAPABILITIES];
|
|
3
7
|
export interface Machine {
|
|
4
8
|
id: string;
|
|
5
9
|
name: string;
|
|
@@ -19,6 +23,16 @@ export interface MachineHealth {
|
|
|
19
23
|
sessiond?: PiWebComponentStatus;
|
|
20
24
|
error?: string;
|
|
21
25
|
}
|
|
26
|
+
export interface MachineRuntime {
|
|
27
|
+
machineId: string;
|
|
28
|
+
ok: boolean;
|
|
29
|
+
checkedAt: string;
|
|
30
|
+
packageName?: string;
|
|
31
|
+
generatedAt?: string;
|
|
32
|
+
components?: PiWebRuntimeResponse["components"];
|
|
33
|
+
capabilities?: PiWebCapability[];
|
|
34
|
+
error?: string;
|
|
35
|
+
}
|
|
22
36
|
export type PiWebShortcutConfig = Record<string, string | null>;
|
|
23
37
|
export type PiWebPluginSettings = Record<string, unknown>;
|
|
24
38
|
export type PiWebPluginConfigMap = Record<string, PiWebPluginConfig>;
|
|
@@ -40,6 +54,7 @@ export interface PiWebPluginInfo {
|
|
|
40
54
|
module: string;
|
|
41
55
|
source: string;
|
|
42
56
|
scope: PiWebPluginScope;
|
|
57
|
+
machineSpecific: boolean;
|
|
43
58
|
enabled: boolean;
|
|
44
59
|
}
|
|
45
60
|
export interface PiWebPluginsResponse {
|
|
@@ -73,10 +88,12 @@ export interface Workspace {
|
|
|
73
88
|
isGitRepo: boolean;
|
|
74
89
|
isGitWorktree: boolean;
|
|
75
90
|
}
|
|
76
|
-
export interface
|
|
91
|
+
export interface SessionRef {
|
|
77
92
|
id: string;
|
|
78
|
-
path: string;
|
|
79
93
|
cwd: string;
|
|
94
|
+
}
|
|
95
|
+
export interface SessionInfo extends SessionRef {
|
|
96
|
+
path: string;
|
|
80
97
|
name?: string;
|
|
81
98
|
created: string;
|
|
82
99
|
modified: string;
|
|
@@ -312,6 +329,14 @@ export interface PiWebComponentStatus {
|
|
|
312
329
|
installation?: PiWebInstallationInfo;
|
|
313
330
|
error?: string;
|
|
314
331
|
}
|
|
332
|
+
export interface PiWebRuntimeComponent {
|
|
333
|
+
component: PiWebServiceComponent;
|
|
334
|
+
label: string;
|
|
335
|
+
runtimeVersion?: string;
|
|
336
|
+
available: boolean;
|
|
337
|
+
capabilities: PiWebCapability[];
|
|
338
|
+
error?: string;
|
|
339
|
+
}
|
|
315
340
|
export interface PiWebReleaseStatus {
|
|
316
341
|
packageName: string;
|
|
317
342
|
latestVersion?: string;
|
|
@@ -335,6 +360,15 @@ export interface PiWebVersionResponse {
|
|
|
335
360
|
sessiond: PiWebComponentStatus;
|
|
336
361
|
};
|
|
337
362
|
}
|
|
363
|
+
export interface PiWebRuntimeResponse {
|
|
364
|
+
packageName: string;
|
|
365
|
+
generatedAt: string;
|
|
366
|
+
components: {
|
|
367
|
+
web: PiWebRuntimeComponent;
|
|
368
|
+
sessiond: PiWebRuntimeComponent;
|
|
369
|
+
};
|
|
370
|
+
capabilities: PiWebCapability[];
|
|
371
|
+
}
|
|
338
372
|
export interface PiWebStatusResponse extends PiWebVersionResponse {
|
|
339
373
|
release: PiWebReleaseStatus;
|
|
340
374
|
commands: {
|
package/dist/shared/apiTypes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiTypes.js","sourceRoot":"","sources":["../../src/shared/apiTypes.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"apiTypes.js","sourceRoot":"","sources":["../../src/shared/apiTypes.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,sBAAsB,EAAE,yBAAyB;CACzC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PI_WEB_CAPABILITIES } from "./apiTypes.js";
|
|
2
|
+
export { PI_WEB_CAPABILITIES };
|
|
3
|
+
export const KNOWN_PI_WEB_CAPABILITIES = Object.values(PI_WEB_CAPABILITIES);
|
|
4
|
+
const knownPiWebCapabilities = new Set(KNOWN_PI_WEB_CAPABILITIES);
|
|
5
|
+
export const WEB_RUNTIME_CAPABILITIES = [PI_WEB_CAPABILITIES.sessionsDeleteArchived];
|
|
6
|
+
export const SESSIOND_RUNTIME_CAPABILITIES = [PI_WEB_CAPABILITIES.sessionsDeleteArchived];
|
|
7
|
+
const EFFECTIVE_CAPABILITY_REQUIREMENTS = {
|
|
8
|
+
[PI_WEB_CAPABILITIES.sessionsDeleteArchived]: ["web", "sessiond"],
|
|
9
|
+
};
|
|
10
|
+
export function isPiWebCapability(value) {
|
|
11
|
+
return typeof value === "string" && knownPiWebCapabilities.has(value);
|
|
12
|
+
}
|
|
13
|
+
export function supportsPiWebCapability(source, capability) {
|
|
14
|
+
return source?.capabilities?.includes(capability) === true;
|
|
15
|
+
}
|
|
16
|
+
export function effectivePiWebCapabilities(components) {
|
|
17
|
+
return KNOWN_PI_WEB_CAPABILITIES.filter((capability) => {
|
|
18
|
+
const requiredComponents = EFFECTIVE_CAPABILITY_REQUIREMENTS[capability];
|
|
19
|
+
return requiredComponents.every((component) => {
|
|
20
|
+
const runtime = components[component];
|
|
21
|
+
return runtime?.available === true && supportsPiWebCapability(runtime, capability);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/shared/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAgF,MAAM,eAAe,CAAC;AAElI,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAG/B,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAC5E,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAEvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,mBAAmB,CAAC,sBAAsB,CAA+C,CAAC;AACnI,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,mBAAmB,CAAC,sBAAsB,CAA+C,CAAC;AAExI,MAAM,iCAAiC,GAAG;IACxC,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC;CACW,CAAC;AAE/E,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,MAAiE,EAAE,UAA2B;IACpI,OAAO,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,UAA6G;IACtJ,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QACrD,MAAM,kBAAkB,GAAG,iCAAiC,CAAC,UAAU,CAAC,CAAC;QACzE,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE;YAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;YACtC,OAAO,OAAO,EAAE,SAAS,KAAK,IAAI,IAAI,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const FEDERATED_HTTP_ROUTES = [
|
|
2
|
+
{ method: "GET", path: "/pi-web/status" },
|
|
2
3
|
{ method: "GET", path: "/projects" },
|
|
3
4
|
{ method: "POST", path: "/projects" },
|
|
4
5
|
{ method: "DELETE", path: "/projects/:projectId" },
|
|
@@ -41,6 +42,7 @@ export const FEDERATED_HTTP_ROUTES = [
|
|
|
41
42
|
{ method: "POST", path: "/sessions/:sessionId/archive" },
|
|
42
43
|
{ method: "POST", path: "/sessions/:sessionId/archive-tree" },
|
|
43
44
|
{ method: "POST", path: "/sessions/:sessionId/restore" },
|
|
45
|
+
{ method: "DELETE", path: "/sessions/:sessionId" },
|
|
44
46
|
{ method: "POST", path: "/sessions/:sessionId/detach-parent" },
|
|
45
47
|
{ method: "GET", path: "/auth/providers" },
|
|
46
48
|
{ method: "POST", path: "/auth/api-key" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"federatedRoutes.js","sourceRoot":"","sources":["../../src/shared/federatedRoutes.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE;IACpC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE;IACrC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,sBAAsB,EAAE;IAClD,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE;IAC/C,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,iCAAiC,EAAE;IAC1D,EA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AAI,EAAE,qBAAqB,EAAE;IAC9C,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,6BAA6B,EAAE;IACvD,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,4BAA4B,EAAE;CACF,CAAC;AAEvD,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,SAAS;IACT,kBAAkB;IAClB,6BAA6B;IAC7B,2EAA2E;CACvC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isPiWebCapability } from "./capabilities.js";
|
|
1
2
|
export function parsePiWebVersionResponse(value) {
|
|
2
3
|
if (!isRecord(value))
|
|
3
4
|
return undefined;
|
|
@@ -12,6 +13,43 @@ export function parsePiWebVersionResponse(value) {
|
|
|
12
13
|
return undefined;
|
|
13
14
|
return { packageName, generatedAt, components: { web, sessiond } };
|
|
14
15
|
}
|
|
16
|
+
export function parsePiWebRuntimeResponse(value) {
|
|
17
|
+
if (!isRecord(value))
|
|
18
|
+
return undefined;
|
|
19
|
+
const packageName = value["packageName"];
|
|
20
|
+
const generatedAt = value["generatedAt"];
|
|
21
|
+
const components = value["components"];
|
|
22
|
+
if (typeof packageName !== "string" || packageName === "" || typeof generatedAt !== "string" || generatedAt === "" || !isRecord(components))
|
|
23
|
+
return undefined;
|
|
24
|
+
const web = parsePiWebRuntimeComponent(components["web"]);
|
|
25
|
+
const sessiond = parsePiWebRuntimeComponent(components["sessiond"]);
|
|
26
|
+
const capabilities = parsePiWebCapabilities(value["capabilities"]);
|
|
27
|
+
if (web === undefined || sessiond === undefined || capabilities === undefined)
|
|
28
|
+
return undefined;
|
|
29
|
+
return { packageName, generatedAt, components: { web, sessiond }, capabilities };
|
|
30
|
+
}
|
|
31
|
+
export function parsePiWebRuntimeComponent(value) {
|
|
32
|
+
if (!isRecord(value))
|
|
33
|
+
return undefined;
|
|
34
|
+
const component = value["component"];
|
|
35
|
+
const label = value["label"];
|
|
36
|
+
const runtimeVersion = value["runtimeVersion"];
|
|
37
|
+
const available = value["available"];
|
|
38
|
+
const capabilities = parsePiWebCapabilities(value["capabilities"]);
|
|
39
|
+
const error = value["error"];
|
|
40
|
+
if (component !== "web" && component !== "sessiond")
|
|
41
|
+
return undefined;
|
|
42
|
+
if (typeof label !== "string" || label === "" || typeof available !== "boolean" || capabilities === undefined)
|
|
43
|
+
return undefined;
|
|
44
|
+
return {
|
|
45
|
+
component,
|
|
46
|
+
label,
|
|
47
|
+
...(typeof runtimeVersion === "string" ? { runtimeVersion } : {}),
|
|
48
|
+
available,
|
|
49
|
+
capabilities,
|
|
50
|
+
...(typeof error === "string" ? { error } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
15
53
|
export function parsePiWebComponentStatus(value) {
|
|
16
54
|
if (!isRecord(value))
|
|
17
55
|
return undefined;
|
|
@@ -38,6 +76,11 @@ export function parsePiWebComponentStatus(value) {
|
|
|
38
76
|
...(typeof error === "string" ? { error } : {}),
|
|
39
77
|
};
|
|
40
78
|
}
|
|
79
|
+
function parsePiWebCapabilities(value) {
|
|
80
|
+
if (!Array.isArray(value) || !value.every(isPiWebCapability))
|
|
81
|
+
return undefined;
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
41
84
|
export function parsePiWebInstallationInfo(value) {
|
|
42
85
|
if (!isRecord(value))
|
|
43
86
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piWebStatusParsing.js","sourceRoot":"","sources":["../../src/shared/piWebStatusParsing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"piWebStatusParsing.js","sourceRoot":"","sources":["../../src/shared/piWebStatusParsing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACvC,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAA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AQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/docs/plugins.md
CHANGED
|
@@ -22,7 +22,7 @@ Plugins run as JavaScript in the browser app. Treat them as trusted code:
|
|
|
22
22
|
- they can render arbitrary Lit templates/custom elements in plugin contribution areas;
|
|
23
23
|
- they should not be installed from untrusted sources.
|
|
24
24
|
|
|
25
|
-
PI WEB's `/api/...` HTTP and WebSocket endpoints are internal implementation details. Plugin code should
|
|
25
|
+
PI WEB's `/api/...` HTTP and WebSocket endpoints are internal implementation details. Plugin code should use the documented context helpers instead. Daring plugins can still reach private routes or runtime objects because they run in the browser, but those private surfaces are experimental: they may graduate into stable helpers, change shape, or disappear.
|
|
26
26
|
|
|
27
27
|
## What to ask AI to build
|
|
28
28
|
|
|
@@ -131,17 +131,22 @@ Reload the PI WEB browser tab. PI WEB serves plugin modules with an mtime-based
|
|
|
131
131
|
|
|
132
132
|
## Remote machine plugins
|
|
133
133
|
|
|
134
|
-
When machine federation is enabled, PI WEB also loads discovered plugins from the selected remote machine. Remote plugins are trusted browser-side code like local plugins, but their contributions are machine-scoped:
|
|
134
|
+
When [machine federation](https://pi-web.dev/machines.html) is enabled, PI WEB also loads discovered plugins from the selected remote machine. Remote plugins are trusted browser-side code like local plugins, but their contributions are machine-scoped:
|
|
135
135
|
|
|
136
136
|
- actions, workspace panels, and workspace labels only appear while that machine is selected;
|
|
137
137
|
- plugin file and terminal helpers run against that machine;
|
|
138
138
|
- plugin code is loaded best-effort through the current gateway and cached for the browser page lifetime;
|
|
139
|
-
- if the gateway
|
|
139
|
+
- if the gateway and remote machine both have an enabled plugin with the same original id, `machineSpecific` metadata decides whether the gateway copy is reused or only the selected machine's copy can appear;
|
|
140
140
|
- remote theme contributions are ignored for now because themes are app-wide;
|
|
141
141
|
- mixed PI WEB versions across federated machines are best-effort and not guaranteed compatible.
|
|
142
142
|
|
|
143
143
|
Remote plugin enablement is controlled by the remote machine's PI WEB plugin config. To edit or disable a remote machine plugin, open that machine directly or update its config file.
|
|
144
144
|
|
|
145
|
+
Plugin package metadata may set `machineSpecific: true` when the plugin's meaning is tied to the selected PI WEB machine:
|
|
146
|
+
|
|
147
|
+
- Omitted or `false`: use the gateway copy when the same plugin id is also present on a remote machine. This is best for portable UI plugins whose helpers already route through the selected machine.
|
|
148
|
+
- `true`: the gateway copy only appears for the local machine. When a remote machine is selected, only that remote machine's copy can appear; if the remote machine does not expose the plugin, the plugin is hidden. This is best for plugins that report machine-local PI WEB status or depend on machine-local plugin code.
|
|
149
|
+
|
|
145
150
|
For portable plugin assets, prefer URLs relative to the plugin module, for example:
|
|
146
151
|
|
|
147
152
|
```js
|
|
@@ -185,7 +190,7 @@ Built-in plugins can be managed from **Settings → Plugins** or with the top-le
|
|
|
185
190
|
**Plugin id:** `updates`
|
|
186
191
|
**What it does:** adds a conditional **Updates** workspace tab with PI WEB update, restart, and installed-service guidance.
|
|
187
192
|
|
|
188
|
-
Updates is enabled by default. To hide it, disable `updates` in **Settings → Plugins** or set:
|
|
193
|
+
Updates is enabled by default. It declares `machineSpecific: true` so the gateway Updates tab only appears for the local machine; while a remote machine is selected, that remote machine's Updates plugin is used if available. To hide it, disable `updates` in **Settings → Plugins** or set:
|
|
189
194
|
|
|
190
195
|
```json
|
|
191
196
|
{
|
|
@@ -286,7 +291,7 @@ A package can expose one or more PI WEB plugin modules. There is exactly one sup
|
|
|
286
291
|
"piWeb": {
|
|
287
292
|
"plugins": [
|
|
288
293
|
{ "id": "review", "module": "dist/review.js" },
|
|
289
|
-
{ "id": "dashboard", "module": "dist/dashboard.js" }
|
|
294
|
+
{ "id": "dashboard", "module": "dist/dashboard.js", "machineSpecific": true }
|
|
290
295
|
]
|
|
291
296
|
}
|
|
292
297
|
}
|
|
@@ -298,6 +303,7 @@ Rules:
|
|
|
298
303
|
- Each entry must have an explicit `id` and `module`.
|
|
299
304
|
- `id` must match `^[a-z][a-z0-9.-]*$`.
|
|
300
305
|
- `module` must be a safe relative path inside the plugin package root.
|
|
306
|
+
- `machineSpecific` is optional and must be a boolean; omit it for the default portable gateway behavior.
|
|
301
307
|
- Duplicate plugin ids are not auto-renamed; later duplicates are skipped.
|
|
302
308
|
- Legacy shortcuts such as `piWeb.plugin`, string entries in `piWeb.plugins`, `piWeb.id` fallback ids, and no-`package.json` fallbacks are not supported.
|
|
303
309
|
|
|
@@ -312,13 +318,14 @@ The manifest contains each discovered plugin module:
|
|
|
312
318
|
"id": "my-plugin",
|
|
313
319
|
"module": "/pi-web-plugins/my-plugin/pi-web-plugin.js?v=1234567890",
|
|
314
320
|
"source": "local",
|
|
315
|
-
"scope": "local"
|
|
321
|
+
"scope": "local",
|
|
322
|
+
"machineSpecific": false
|
|
316
323
|
}
|
|
317
324
|
]
|
|
318
325
|
}
|
|
319
326
|
```
|
|
320
327
|
|
|
321
|
-
`source` describes where the plugin came from (`bundled`, `local`, or the Pi package source). `scope` is `bundled`, `local`, `user`, or `project`.
|
|
328
|
+
`source` describes where the plugin came from (`bundled`, `local`, or the Pi package source). `scope` is `bundled`, `local`, `user`, or `project`. `machineSpecific` controls whether the gateway copy is valid for remote machines or only each selected machine's own copy can appear.
|
|
322
329
|
|
|
323
330
|
A plugin can fetch its own static assets with URLs under:
|
|
324
331
|
|
|
@@ -450,12 +457,12 @@ interface PluginRuntimeContext {
|
|
|
450
457
|
Notes:
|
|
451
458
|
|
|
452
459
|
- `state` is a snapshot of current UI state when actions are built.
|
|
453
|
-
- The stable state fields are `state.selectedWorkspace`, `state.selectedSession`, and `state.piWebStatus`.
|
|
454
|
-
- Other `state` fields may exist at runtime, but they are PI WEB internals
|
|
460
|
+
- The stable state fields are `state.selectedWorkspace`, `state.selectedSession`, and `state.piWebStatus`. `state.piWebStatus` describes the currently selected machine's PI WEB runtime, or the gateway/local runtime when the local machine is selected.
|
|
461
|
+
- Other `state` fields may exist at runtime, but they are private PI WEB internals that may graduate into stable helpers, change shape, or disappear.
|
|
455
462
|
- `enabled` is evaluated when the action palette asks for actions.
|
|
456
463
|
- `selectWorkspaceTool()` expects a qualified panel id such as `my-plugin:workspace.info`.
|
|
457
464
|
- `openTerminal()` switches to the built-in terminal panel. Pass `{ terminalId }` to deep-link to a specific terminal.
|
|
458
|
-
- Only fields documented here and declared in `plugin-api.d.ts` are stable public plugin API.
|
|
465
|
+
- Only fields documented here and declared in `plugin-api.d.ts` are stable public plugin API. Anything else is experimental: it may become public API later, change shape, or disappear.
|
|
459
466
|
|
|
460
467
|
#### Keyboard shortcuts
|
|
461
468
|
|
|
@@ -763,22 +770,11 @@ render: ({ terminal }) => html`
|
|
|
763
770
|
|
|
764
771
|
Review command strings carefully. They are trusted shell commands executed in the workspace terminal.
|
|
765
772
|
|
|
766
|
-
##
|
|
767
|
-
|
|
768
|
-
PI WEB's `/api/...` HTTP and WebSocket routes are private implementation details. Plugin code should not fetch PI WEB API endpoints directly because those URLs, response shapes, and machine-federation routing rules can change.
|
|
769
|
-
|
|
770
|
-
If a plugin author deliberately chooses to depend on an unstable runtime field while a public helper is still being designed, make that decision explicit in code with a type-only unstable import and a local type assertion:
|
|
773
|
+
## Private and experimental PI WEB APIs
|
|
771
774
|
|
|
772
|
-
|
|
773
|
-
import type { WorkspacePanelContext } from "@jmfederico/pi-web/plugin-api";
|
|
774
|
-
import type { UnstableWorkspacePanelContext } from "@jmfederico/pi-web/plugin-api/unstable";
|
|
775
|
-
|
|
776
|
-
function unstableContext(context: WorkspacePanelContext) {
|
|
777
|
-
return context as WorkspacePanelContext & UnstableWorkspacePanelContext;
|
|
778
|
-
}
|
|
779
|
-
```
|
|
775
|
+
PI WEB's `/api/...` HTTP and WebSocket routes and runtime-only fields are private implementation details. They exist because plugins are trusted browser code, and because some capabilities may be evaluated there before they are designed as stable helpers.
|
|
780
776
|
|
|
781
|
-
|
|
777
|
+
That is allowed, but outside the v1 compatibility promise: URLs, response shapes, runtime fields, and machine-federation routing may graduate into stable APIs, change shape, or disappear. The stable public plugin API is only the documented helpers and declarations in `plugin-api.d.ts`. Prefer those whenever they exist; if you rely on private surfaces, keep the dependency local to the plugin and expect to revisit it after PI WEB upgrades.
|
|
782
778
|
|
|
783
779
|
## Async data and caching
|
|
784
780
|
|
|
@@ -795,7 +791,7 @@ PI WEB does not provide a plugin cache/invalidation framework. Keep host callbac
|
|
|
795
791
|
If you are an AI agent building or editing a PI WEB plugin, follow this checklist:
|
|
796
792
|
|
|
797
793
|
1. Create or update a plugin folder with `package.json` and a JavaScript module such as `pi-web-plugin.js`.
|
|
798
|
-
2. Use the single supported package metadata shape: `piWeb.plugins` array with `{ id, module }` entries.
|
|
794
|
+
2. Use the single supported package metadata shape: `piWeb.plugins` array with `{ id, module, machineSpecific? }` entries.
|
|
799
795
|
3. Default-export `{ apiVersion: 1, name, activate }` from the module.
|
|
800
796
|
4. Return `{ contributions: { actions, workspacePanels, workspaceLabels } }` from `activate()`.
|
|
801
797
|
5. Use ids matching `^[a-z][a-z0-9.-]*$`.
|
|
@@ -806,7 +802,7 @@ If you are an AI agent building or editing a PI WEB plugin, follow this checklis
|
|
|
806
802
|
10. Add workspace labels for compact inline metadata.
|
|
807
803
|
11. Return arrays from workspace label `items()`; return an empty array to render nothing.
|
|
808
804
|
12. Use documented context helpers first: `files`, `terminal`, `host.requestRender`, `workspace`, `machine`, `state.selectedWorkspace`, `state.selectedSession`, and `state.piWebStatus`.
|
|
809
|
-
13. Do not fetch PI WEB `/api/...` endpoints directly
|
|
805
|
+
13. Do not fetch PI WEB `/api/...` endpoints directly unless you intentionally accept private API churn; prefer documented helpers.
|
|
810
806
|
14. Treat plugins as trusted code and avoid reading or displaying secrets unless intentional.
|
|
811
807
|
15. After local edits, tell the user to hard reload the browser and check the console for plugin errors.
|
|
812
808
|
|
package/package.json
CHANGED