Skip to main content

WIDGET_TOOL

Constant WIDGET_TOOL 

Source
pub(crate) const WIDGET_TOOL: &str = r#"{
  "name": "Widget",
  "description": "AgentMux widgets: custom panes you build for the user. Every call takes an action. list: the widgets installed on this machine: id, name, version, kind (sandboxed or trusted), state (approved, needs_approval, changed, invalid with its error, disabled), permissions, folder and the views each adds; use it to see whether yours installed and which view to open. install: install a package you built (a folder with a widget.json, that widget.json, or a .zip). AgentMux validates and copies it, then files a sensitive request for the super agent (see Sensitive) naming you, the widget, its publisher and every permission it asks for; you can't approve it yourself. If the super agent approves, the person sees a banner with a 30-second countdown and can veto it, and the widget is installed when it ends. It returns at once: requested (with the request's id; you get [AgentMux] notes as it goes, and Widget list shows when it is installed), or the validation error to fix; installed if it already was, or disabled if the user turned it off. Installing again with changes replaces the old version and asks again. open: open a pane of an installed, approved widget next to this conversation, by view (ext:<id>/<pane>, from list); meta sets keys of the pane's own widget state (what the widget reads with meta.get), e.g. {\"repo\": \"owner/name\"}. It fails, saying why, if the widget isn't approved or is turned off; if the widget then shows an error, read it, fix the package and install again.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "action":    { "type": "string", "enum": ["list", "install", "open"], "description": "What to do" },
      "path":      { "type": "string", "description": "install: the package folder, its widget.json, or a .zip; relative paths are in your workspace" },
      "replace":   { "type": "boolean", "description": "install: replace an installed package with the same id (default true)" },
      "wait_secs": { "type": "integer", "description": "install: how long to wait for the user's answer, in seconds (default 300, at most 600)" },
      "view":      { "type": "string", "description": "open: the view, e.g. ext:acme.todo/main" },
      "meta":      { "type": "object", "description": "open: the pane's initial widget state, as the widget's own keys" },
      "split":     { "type": "string", "enum": ["right", "down"], "description": "open: put the pane in a split beside yours (default: a new tab in your own pane group)" },
      "floating":  { "type": "boolean", "description": "open: a floating window over the app instead of a docked split (default false); shows without taking the user's focus; at most 4 floating panes at a time" },
      "width":     { "type": ["number", "string"], "description": "open with floating: the window's width in CSS pixels (900) or a share of the work area (\"60%\"); the default is about half the app window (a browser: 1040)" },
      "height":    { "type": ["number", "string"], "description": "open with floating: the window's height in CSS pixels (900) or a share of the work area (\"60%\"); the default is about 60% of the app window (a browser: 760)" },
      "spot":      { "type": "string", "enum": ["center", "right", "left", "top", "bottom", "top-right", "top-left", "bottom-right", "bottom-left"], "description": "open with floating: a named place in the work area of the monitor the app window is on (a browser: right). Values outside the work area are pulled in, and the answer says so (placed.clamped)" },
      "x":         { "type": "number", "description": "open with floating: the window's left edge in CSS pixels from the work area's left; give y too; wins over spot" },
      "y":         { "type": "number", "description": "open with floating: the window's top edge in CSS pixels from the work area's top; give x too" }
    },
    "required": ["action"]
  }
}"#;
Expand description

Widget: custom panes an agent builds for the user (host agents only).