Add Tool For VM Support

Nucleic-Session: 44060009-FEE4-4E88-AD0B-F92AF480125C
Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
2026-07-08 04:59:05 -07:00
co-authored by nucleic
parent 8bb8b08967
commit a3df90ed99
@@ -1092,6 +1092,50 @@ public actor MCPApprovalServer {
]),
]))
}
// Only advertise mac_vm_request_operator when this session opted into VM computer-use.
if macVMOperatorHandlers[token] != nil {
tools.append(
.object([
"name": .string(Self.macVMOperatorToolName),
"description": .string(
"Ask the Nucleic USER to take the wheel and operate this session's macOS VM "
+ "by hand — a LAST-RESORT hand-off for the rare step you cannot do "
+ "yourself with `mac_vm_computer`, because it genuinely requires a human: "
+ "solving a CAPTCHA, completing a login / two-factor prompt, accepting a "
+ "one-time interactive OS dialog. Do NOT use it for ordinary GUI work you "
+ "can drive yourself (clicking, typing, launching apps) — that is what "
+ "`mac_vm_computer` is for; use this ONLY when a real person is required. "
+ "When you call it, Nucleic shows the user a request card, and if they "
+ "accept, opens an interactive viewer of the VM they can click and type "
+ "into, with your `instructions` shown alongside. The call BLOCKS until "
+ "the user finishes or declines. Pass `instructions`: exactly what the "
+ "user should do in the VM, specific and self-contained (name the window "
+ "/ page and the concrete action). Pass `reason`: why a human is required "
+ "rather than you doing it. Returns {completed, note}: `completed` is "
+ "whether the user says they did it, `note` is any message they left — "
+ "read both, then continue (re-screenshot the VM to confirm state). Every "
+ "call needs explicit user consent and is NEVER auto-approved."),
"inputSchema": .object([
"type": .string("object"),
"properties": .object([
"instructions": .object([
"type": .string("string"),
"description": .string(
"What the user should do in the VM, concretely and "
+ "self-contained (e.g. \"solve the CAPTCHA in the Safari "
+ "window, then click Continue\"). Required."),
]),
"reason": .object([
"type": .string("string"),
"description": .string(
"Why this step needs a human rather than you driving the VM "
+ "yourself. Required; empty or vague reasons are rejected."),
]),
]),
"required": .array([.string("instructions"), .string("reason")]),
]),
]))
}
return rpcResult(id: id, result: .object(["tools": .array(tools)]))
case "tools/call":