дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
feat(plugins): let plugin code open streaming log tabs (#2082)
views.open-log-tab(key, title, process-log) (SDK host::open_log_tab) opens the read-only log tab a web view opens with open-log-tab, from a command or event of a window, reusing the Services pane's process-log. The host checks the process grant and limits when called and remembers what each key runs in that window; the tab starts it by key (plugin_log_tab_spawn) through the web-view PTY checks: pinned program, trusted project, session cap, lifecycle and grant revocation. Remote windows report that these tabs aren't available there yet.
Цей коміт міститься в:
1 джерело
ec171c3188
коміт
2bf412ff0d
92 files changed
+496
-50
No files matched your search
@@ -502,6 +502,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
|
||||
plugin::plugin_service_log,
|
||||
plugin::plugin_web_page,
|
||||
plugin::plugin_web_pty_spawn,
|
||||
plugin::plugin_log_tab_spawn,
|
||||
plugin::plugin_web_save_file,
|
||||
plugin::plugin_web_read_file,
|
||||
plugin::plugin_line_markers,
|
||||
|
||||
@@ -565,6 +565,41 @@ pub async fn plugin_web_pty_spawn(
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?
|
||||
}
|
||||
|
||||
/// Starts the program of a log tab the plugin's code opened in this window,
|
||||
/// with the toggles in `on`.
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn plugin_log_tab_spawn(
|
||||
window: Window,
|
||||
state: State<'_, AppState>,
|
||||
plugin_id: String,
|
||||
key: String,
|
||||
on: Vec<String>,
|
||||
cols: u16,
|
||||
rows: u16,
|
||||
on_output: Channel<String>,
|
||||
) -> IdeResult<ide_terminal::TerminalInfo> {
|
||||
let plugins = state.plugins.clone();
|
||||
let host = state.host.clone();
|
||||
let window = window.label().to_owned();
|
||||
tauri::async_runtime::spawn_blocking(move || {
|
||||
plugins.spawn_log_tab_pty(
|
||||
&host,
|
||||
&plugin_id,
|
||||
&key,
|
||||
&window,
|
||||
&on,
|
||||
(cols, rows),
|
||||
Arc::new(move |chunk| {
|
||||
let _ = on_output.send(chunk);
|
||||
}),
|
||||
)
|
||||
})
|
||||
.await
|
||||
.map_err(|e| IdeError::internal(e.to_string()))?
|
||||
}
|
||||
|
||||
/// Largest file a web view saves or opens (`openidea.saveFile` / `openFile`).
|
||||
const MAX_WEB_VIEW_FILE: u64 = 64 << 20;
|
||||
|
||||
|
||||
Reference in new issue
Заблокувати користувача