Plugins can add pages to the sidebar, VM tabs, Settings and dialogs. Their pages can now use host forms and navigation, VM and settings access, authorized file I/O, task progress, controlled HTTP requests, events and private storage. Plugin pages cannot change allow_ai_access, which stays the user's per-VM consent. Closing a page cancels its unfinished tasks, and running plugin tasks no longer block changing the data folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package app
|
|
|
|
import (
|
|
"github.com/Nwflower/reims-go/internal/driver"
|
|
"github.com/Nwflower/reims-go/internal/plugin"
|
|
)
|
|
|
|
func panelVMView(vm driver.VMInfo) map[string]any {
|
|
return map[string]any{
|
|
"vm": vm.Ref().Key(),
|
|
"name": vm.Name,
|
|
"driver_id": vm.DriverID,
|
|
"driver_name": vm.DriverName,
|
|
"state": vm.State,
|
|
"phase": computerUseVMPhase(vm),
|
|
"cpus": vm.CPUs,
|
|
"memory": vm.Memory,
|
|
"disk_summary": vm.DiskSummary,
|
|
"network": vm.Network,
|
|
"capabilities": vm.Capabilities,
|
|
"driver_unavailable": vm.DriverUnavailable,
|
|
}
|
|
}
|
|
|
|
func (a *App) panelVMGet(mgr *plugin.Manager, pluginID string, params map[string]any) (any, error) {
|
|
if err := mgr.Broker().Authorize(pluginID, "vm:read"); err != nil {
|
|
return nil, err
|
|
}
|
|
ref, err := panelTextParam(params, "vm", true, 200, false)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
vm, err := a.resolveComputerUseVMInfo(ref)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return panelVMView(vm), nil
|
|
}
|