fix(plugins): preserve deprecated panel terminal alias

This commit is contained in:
Federico Jaramillo Martinez
2026-06-05 14:26:35 +02:00
parent 82ba2e0490
commit 0d9d124237
5 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
"@jmfederico/pi-web": patch "@jmfederico/pi-web": patch
--- ---
Clean up the workspace panel plugin context by removing the legacy `openTerminal` alias and moving render invalidation to `context.host.requestRender()`. Clean up the workspace panel plugin context by moving render invalidation to `context.host.requestRender()` and deprecating the legacy runtime-only `openTerminal` alias in favor of `context.terminal.open()`.
+5 -3
View File
@@ -182,7 +182,7 @@ Built-in plugins can be managed from **Settings → Plugins** or with the top-le
### Updates ### Updates
**Plugin id:** `updates` **Plugin id:** `updates`
**What it does:** adds a conditional **Updates** workspace tab with PI WEB update, restart, and installed-service guidance. **What it does:** adds a conditional **Updates** workspace tab with PI WEB update, restart, and installed-service guidance.
Updates is enabled by default. To hide it, disable `updates` in **Settings → Plugins** or set: Updates is enabled by default. To hide it, disable `updates` in **Settings → Plugins** or set:
@@ -197,8 +197,8 @@ Updates is enabled by default. To hide it, disable `updates` in **Settings → P
### Workspace Tasks ### Workspace Tasks
**Plugin id:** `workspace-tasks` **Plugin id:** `workspace-tasks`
**Config file:** `.pi-web/tasks.json` **Config file:** `.pi-web/tasks.json`
**What it does:** adds a **Tasks** workspace tab for running configured shell commands in dedicated PI WEB terminals. **What it does:** adds a **Tasks** workspace tab for running configured shell commands in dedicated PI WEB terminals.
Workspace Tasks is enabled by default. To hide it, disable `workspace-tasks` in **Settings → Plugins** or set: Workspace Tasks is enabled by default. To hide it, disable `workspace-tasks` in **Settings → Plugins** or set:
@@ -534,6 +534,8 @@ interface WorkspacePanelContext {
`machine`, `workspace`, `files`, `terminal`, and `host` are documented as stable for panel callbacks. Use `terminal.open()` to switch to the built-in terminal panel; pass `{ terminalId }` to deep-link to a specific terminal. Call `host.requestRender()` when async plugin-owned state changes should make PI WEB re-evaluate panel callbacks such as `badge`, `visible`, or `render`. `machine`, `workspace`, `files`, `terminal`, and `host` are documented as stable for panel callbacks. Use `terminal.open()` to switch to the built-in terminal panel; pass `{ terminalId }` to deep-link to a specific terminal. Call `host.requestRender()` when async plugin-owned state changes should make PI WEB re-evaluate panel callbacks such as `badge`, `visible`, or `render`.
For compatibility, PI WEB still provides the old `context.openTerminal()` workspace-panel helper at runtime. It is deprecated, intentionally omitted from the public TypeScript declarations, and planned for removal in v2. Existing JavaScript plugins keep working, while typed plugins should migrate to `context.terminal.open()`.
Useful workspace and machine shapes: Useful workspace and machine shapes:
```ts ```ts
+1
View File
@@ -943,6 +943,7 @@ export class PiWebApp extends LitElement {
open: (options) => { void this.openRuntimeTerminal(machineId, workspace, options); }, open: (options) => { void this.openRuntimeTerminal(machineId, workspace, options); },
runCommand: (input) => terminalCommandRuns.runCommand({ ...input, workspace }), runCommand: (input) => terminalCommandRuns.runCommand({ ...input, workspace }),
}, },
openTerminal: (options) => { void this.openRuntimeTerminal(machineId, workspace, options); },
host: this.createWorkspaceHost(), host: this.createWorkspaceHost(),
piWebUnstable: { terminalCommandRuns }, piWebUnstable: { terminalCommandRuns },
fileTree: this.state.fileTree, fileTree: this.state.fileTree,
+5
View File
@@ -131,6 +131,11 @@ export interface QualifiedPluginAction extends AppAction {
export interface WorkspacePanelContext extends WorkspaceContext { export interface WorkspacePanelContext extends WorkspaceContext {
terminal: WorkspacePanelTerminal; terminal: WorkspacePanelTerminal;
/**
* @deprecated Runtime-only compatibility alias for pre-v2 plugins. Use `terminal.open()` instead.
* This is intentionally not part of the public `@jmfederico/pi-web/plugin-api` declarations.
*/
openTerminal?: (options?: { terminalId?: string | undefined }) => void;
piWebUnstable?: Pick<PiWebUnstableRuntimeContext, "terminalCommandRuns">; piWebUnstable?: Pick<PiWebUnstableRuntimeContext, "terminalCommandRuns">;
fileTree: FileTreeEntry[]; fileTree: FileTreeEntry[];
expandedDirs: Record<string, FileTreeEntry[]>; expandedDirs: Record<string, FileTreeEntry[]>;
-1
View File
@@ -212,4 +212,3 @@ export interface ThemePairContribution {
light: LocalContributionId; light: LocalContributionId;
dark: LocalContributionId; dark: LocalContributionId;
} }