дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
feat(plugins): generic streaming log editor tab for plugin web views (#2043)
A plugin web view can open a read-only editor tab that streams a process's output, with plugin-defined toggles, Find, wrap, zoom and Clear. The process is authorised in the backend against the exact granted `process:<program>` and its pinned executable, output is bounded, and the stream survives tab switches but ends when the tab closes, the plugin is disabled or the window closes. Adds a web-log test fixture and docs. Verified on macOS; Windows/Linux not run. Co-authored-by: dengliu <[email protected]>
Цей коміт міститься в:
1 джерело
292ddc4d2a
коміт
fbf57bed23
24 files changed
+1509
-27
No files matched your search
@@ -1001,6 +1001,54 @@ web page: start bash without the optional grant to see refusal, grant
|
||||
`process:bash` in Settings → Plugins, then send commands and resize or stop it.
|
||||
This API is a web bridge extension; existing WIT signatures are unchanged.
|
||||
|
||||
### Streaming log editor tabs (API 1.3)
|
||||
|
||||
A web view can open a read-only editor tab backed by an authorized process:
|
||||
|
||||
```js
|
||||
openidea.postMessage(JSON.stringify({
|
||||
op: "open-log-tab",
|
||||
key: "server-output",
|
||||
title: "Server logs",
|
||||
program: "my-server",
|
||||
baseArgs: ["logs"],
|
||||
toggles: [{ id: "verbose", label: "Verbose", args: ["--verbose"] }],
|
||||
}));
|
||||
```
|
||||
|
||||
Declare `engines.openidea = "^1.3"` and `process:my-server` in the manifest.
|
||||
The install permission prompt and exact pinned executable, trusted project cwd,
|
||||
session caps and lifecycle rules are the same as for web frame PTYs. The tab
|
||||
uses the backend PTY API, never a shell fallback. It supplies no environment
|
||||
overrides; the environment is inherited. A shell requires its own explicit grant.
|
||||
|
||||
`program` is required. `baseArgs` and `toggles` default to empty arrays; `title`
|
||||
defaults to the program. Each toggle has a unique `id`, a plugin-localized
|
||||
`label`, and `args` appended after `baseArgs` in declaration order. Changing a
|
||||
toggle terminates the previous process and replaces the stream. `key` defaults
|
||||
to the title and is scoped to the calling plugin and view; reopening the same
|
||||
key focuses its existing tab. Titles are at most 256 characters, keys 128,
|
||||
and at most 32 toggles have ids of 64 and labels of 128 characters. The combined
|
||||
arguments must fit the PTY limits above. `cwd` and `env` are refused. Invalid or
|
||||
ungranted requests send `log-error { error }` through `openidea.onMessage`;
|
||||
backend start errors appear in the tab.
|
||||
|
||||
The viewer supports selection/copy, soft wrap, Find, font zoom and Clear. It
|
||||
retains at most 5,000 lines and 1 Mi UTF-16 code units, including partial lines.
|
||||
Output is acknowledged only after rendering; the PTY bridge's 256 Ki pending
|
||||
output cap also applies. Tabs are read-only, never dirty and not restored on
|
||||
restart. Recently used tabs keep streaming while hidden under the editor's
|
||||
five-tab retention limit; evicting a hidden tab stops its process. Closing the
|
||||
tab, disabling/updating the plugin, changing grants, switching projects or
|
||||
closing the window stops it, including a pending spawn.
|
||||
|
||||
The built fixture `crates/ide-plugin/tests/fixtures/web-log` exercises permission
|
||||
refusal, continuous Unicode output and a plugin-defined Verbose toggle. On Unix,
|
||||
grant its optional `process:bash` permission and use its Log Probe tool window.
|
||||
Its `Log Probe: Open Stream` and `Log Probe: Try Undeclared Program` commands
|
||||
also ask the sandboxed page to open a tab, exercising the Wasm-to-page bridge.
|
||||
This extends the web bridge without changing released WIT signatures.
|
||||
|
||||
### Translations
|
||||
|
||||
A package translates its own text with `locales/<tag>.json`, one file per language
|
||||
|
||||
Reference in new issue
Заблокувати користувача