Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/desktop/src/plugin_host/bridge/console.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Desktop Studio console adapter over `opencode_plugin_runtime::console`.

pub use opencode_plugin_runtime::console::{clear, eval_here, push, reloaded, version};
pub use opencode_plugin_runtime::console::{Line, clear, clear_for, eval_here, lines_for, push, reloaded, version};

use rune_psychoscript::Data;

Expand Down
17 changes: 16 additions & 1 deletion apps/desktop/src/plugin_host/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ impl opencode_kernel::Feature<App> for PluginHostFeature {
builder.register_slot(&services::ui::LAYOUT_SCROLL);
builder.register_slot(&crate::popup::context::MESSAGE_MENU_SNAPSHOT);
builder.register_slot(&ui::prompt_dialog::PROMPT_DIALOG);
builder.register_slot(&ui::inspector::PLUGIN_INSPECTOR);
builder.add_setup("plugin_host.inspector", ui::inspector::on_setup);
builder
.schedule(crate::tick::stage::REACT_PANELS, "plugin_host.inspector.poll", ui::inspector::poll)
.after("panels.poll");
builder.register_slot(&services::app_meta::WINDOW_VISIBILITY);
builder.register_slot(&runtime::lifecycle::WINDOW_DISPOSE);
builder.register_slot(&services::timeline::TIMELINE_NAV);
Expand Down Expand Up @@ -145,13 +150,23 @@ impl opencode_kernel::Feature<App> for PluginHostFeature {
})
.above(crate::mcp::SIGN_IN_OVERLAY_ID),
);
builder.register_overlay(
opencode_kernel::OverlayRegistration::<App>::new(ui::inspector::OVERLAY_ID)
.with_render(crate::overlays::layer::ELEVATED_DIALOG, |s, cx| {
let p = crate::palette::pal(s.dark(cx));
ui::inspector::view(s, p, cx)
})
.above("dialog.move_recovery")
.with_key(ui::inspector::key)
.with_dismiss(ui::inspector::dismiss),
);
builder.register_overlay(
opencode_kernel::OverlayRegistration::<App>::new("plugin.dialog")
.with_render(crate::overlays::layer::ELEVATED_DIALOG, |s, cx| {
let p = crate::palette::pal(s.dark(cx));
dialog_view_in(s, p, cx, opencode_plugin_spec::DialogLayer::Elevated)
})
.above("dialog.move_recovery")
.above(ui::inspector::OVERLAY_ID)
.with_key(dialog_key)
.after_key(ui::prompt_dialog::OVERLAY_ID)
.with_dismiss(requests::dismiss_dialog),
Expand Down
12 changes: 9 additions & 3 deletions apps/desktop/src/plugin_host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,21 @@ impl Plugin {
self.life.script()
}

/// Live VM heap usage in bytes across this plugin's window half and app half (`0` when neither
/// half has a running script).
pub fn memory_bytes(&self) -> usize {
/// Live VM heap usage in bytes split as `(window_half, app_half)`.
pub fn memory_bytes_split(&self) -> (usize, usize) {
let window = self.script().map_or(0, Script::memory);
let app: usize = runtime::app_half::each(|a| {
(&*a.half.id == self.manifest.id.as_str()).then(|| a.script.memory())
})
.into_iter()
.sum();
(window, app)
}

/// Live VM heap usage in bytes across this plugin's window half and app half (`0` when neither
/// half has a running script).
pub fn memory_bytes(&self) -> usize {
let (window, app) = self.memory_bytes_split();
window + app
}

Expand Down
Loading
Loading