@0perator/operator 0.1.349 → 0.1.350

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ // `operator toolchain …` — the Operator toolchain CLI (the repo's toolchain/toolchain.py: install, activate, rollback,
2
+ // which, verify, status, migrate, smoke, gate, manifest check). The package ships it in dist/toolchain/ beside the
3
+ // manifest it was released with (scripts/copy-toolchain.mjs); a checkout runs the repo's copy. Either way it runs under
4
+ // /usr/bin/python3 -I, like the fleet's toolchain/bin/toolchain shim, so Homebrew's python and PYTHON* never reach it.
5
+ import { spawnSync } from "node:child_process";
6
+ import { existsSync } from "node:fs";
7
+ import { dirname, join } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ export const SYSTEM_PYTHON = "/usr/bin/python3";
10
+ /** The toolchain.py this install runs: the packaged copy (dist/toolchain/), else the checkout's (../../toolchain/). */
11
+ export function toolchainScript(here = dirname(fileURLToPath(import.meta.url))) {
12
+ return [join(here, "toolchain", "toolchain.py"), join(here, "..", "..", "toolchain", "toolchain.py")].find((p) => existsSync(p));
13
+ }
14
+ export function runToolchain(args, here) {
15
+ const script = toolchainScript(here);
16
+ if (!script) {
17
+ process.stderr.write("operator toolchain: toolchain.py is not in this install (reinstall with `operator update`)\n");
18
+ return 1;
19
+ }
20
+ const r = spawnSync(SYSTEM_PYTHON, ["-I", script, ...args], { stdio: "inherit" });
21
+ if (r.error) {
22
+ process.stderr.write(`operator toolchain: ${SYSTEM_PYTHON}: ${r.error.message}\n`);
23
+ return 1;
24
+ }
25
+ return r.status ?? 1;
26
+ }
@@ -221,48 +221,56 @@ async function doctor(_args) {
221
221
  export const COMPUTER_TOOLS = [
222
222
  {
223
223
  name: "app_open",
224
+ contract: { v: 1, effects: ["exec", "device"], bins: ["open"] },
224
225
  description: "Open or bring a macOS application to the front by name (e.g. Safari, Notes, Finder). Launches it if not running.",
225
226
  parameters: { type: "object", properties: { app: { type: "string", description: "Application name, e.g. \"Safari\"" } }, required: ["app"] },
226
227
  run: appOpen,
227
228
  },
228
229
  {
229
230
  name: "app_activate",
231
+ contract: { v: 1, effects: ["exec", "device"], bins: ["osascript"] },
230
232
  description: "Focus/activate an already-running macOS app so keystrokes go to it.",
231
233
  parameters: { type: "object", properties: { app: { type: "string" } }, required: ["app"] },
232
234
  run: appActivate,
233
235
  },
234
236
  {
235
237
  name: "computer_applescript",
238
+ contract: { v: 1, effects: ["exec", "device"], bins: ["osascript"] },
236
239
  description: "Run an arbitrary AppleScript via osascript — the general escape hatch for controlling any scriptable macOS app (open a URL in Safari, compose Mail, read Notes, control Music, etc.). Returns the script's result.",
237
240
  parameters: { type: "object", properties: { script: { type: "string", description: "AppleScript source" }, timeout_ms: { type: "number" } }, required: ["script"] },
238
241
  run: runAppleScript,
239
242
  },
240
243
  {
241
244
  name: "computer_type",
245
+ contract: { v: 1, effects: ["device"], bins: ["osascript"] },
242
246
  description: "Type text into the frontmost app (or a named app) as if typed on the keyboard. Requires macOS Accessibility permission.",
243
247
  parameters: { type: "object", properties: { text: { type: "string" }, app: { type: "string", description: "optional: activate this app first" } }, required: ["text"] },
244
248
  run: typeText,
245
249
  },
246
250
  {
247
251
  name: "computer_key",
252
+ contract: { v: 1, effects: ["device"], bins: ["osascript"] },
248
253
  description: "Press a key or key-combo (e.g. { key: \"return\" }, { key: \"s\", modifiers: [\"command\"] }, { key: \"tab\" }). Requires Accessibility.",
249
254
  parameters: { type: "object", properties: { key: { type: "string", description: "return|tab|space|escape|delete|up|down|left|right|home|end|f1..f12, or a single character" }, modifiers: { type: "array", items: { type: "string", enum: ["command", "control", "option", "shift"] } }, app: { type: "string" } }, required: ["key"] },
250
255
  run: pressKey,
251
256
  },
252
257
  {
253
258
  name: "computer_click",
259
+ contract: { v: 1, effects: ["device"], bins: ["cliclick", "osascript"] },
254
260
  description: "Click the mouse at absolute screen coordinates (x, y). Uses cliclick if installed, else System Events. Requires Accessibility.",
255
261
  parameters: { type: "object", properties: { x: { type: "number" }, y: { type: "number" } }, required: ["x", "y"] },
256
262
  run: click,
257
263
  },
258
264
  {
259
265
  name: "computer_screenshot",
266
+ contract: { v: 1, effects: ["device", "write"], bins: ["screencapture"] },
260
267
  description: "Capture the screen to a PNG file and return its path. Requires Screen Recording permission. (Note: the model cannot read the image back yet — vision input is pending.)",
261
268
  parameters: { type: "object", properties: { path: { type: "string", description: "optional output path; defaults to a temp file" } } },
262
269
  run: screenshot,
263
270
  },
264
271
  {
265
272
  name: "computer_doctor",
273
+ contract: { v: 1, effects: ["read", "device"], bins: ["osascript", "screencapture", "cliclick"] },
266
274
  description: "Preflight check: report which macOS permissions (Accessibility, Screen Recording, Automation) and helper binaries are wired for computer control, and exactly what to grant.",
267
275
  parameters: { type: "object", properties: {} },
268
276
  run: doctor,
@@ -0,0 +1,9 @@
1
+ // Per-tool contract: what a tool does to the world and which binaries it spawns, declared inline on the Tool
2
+ // beside `safe`. Phase 1 is declarations only — nothing at runtime reads a contract, toSchemas never sends one
3
+ // (the tools array is the cached prompt prefix), and `safe` stays authoritative. scripts/tool-catalog.mts
4
+ // publishes every contract to toolchain/tools/catalog.json; test/tool-contract.test.mts and
5
+ // test/tool-bins.test.mts hold the gaps to toolchain/tools/baseline.json, whose lists may only shrink.
6
+ // A DEPENDENCY-FREE leaf like mutating.ts: registry.ts reaches it from the neutral bundle.
7
+ export const EFFECTS = ["read", "fetch", "state", "write", "egress", "exec", "destructive", "device"];
8
+ /** What `safe` should mean once contracts drive it: every declared effect is a read. */
9
+ export const isReadOnly = (c) => c.effects.every((e) => e === "read" || e === "fetch");
@@ -80,6 +80,7 @@ export async function gitPr(args) {
80
80
  export const GIT_PR_TOOLS = [
81
81
  {
82
82
  name: "git_pr", safe: false,
83
+ contract: { v: 1, effects: ["read", "fetch", "egress"], bins: ["git", "gh"] },
83
84
  description: "Open, check status of, or list pull requests via the gh CLI — open pushes the current " +
84
85
  "branch and creates a real PR, so it needs approval like any other write.",
85
86
  parameters: { type: "object", properties: {
@@ -269,6 +269,7 @@ export const MONITORING_TOOLS = [
269
269
  },
270
270
  {
271
271
  name: "log_tail", safe: true,
272
+ contract: { v: 1, effects: ["read"] },
272
273
  description: "Read the last N lines of a log file (default 80, hard cap 500). Path is realpath'd and must stay " +
273
274
  "under $HOME (or cwd), or under the powertools root or the Operator home when set. No shell. Sensitive system paths refused.",
274
275
  parameters: {
@@ -283,6 +284,7 @@ export const MONITORING_TOOLS = [
283
284
  },
284
285
  {
285
286
  name: "process_snapshot", safe: true,
287
+ contract: { v: 1, effects: ["read"], bins: ["ps"] },
286
288
  description: "Process table snapshot via ps with fixed columns (pid,ppid,user,pcpu,pmem,state,comm). " +
287
289
  "Optional case-insensitive name substring filter applied in-process. max_results default 50 (hard 200). " +
288
290
  "Native — works without the powertools MCP.",
@@ -297,6 +299,7 @@ export const MONITORING_TOOLS = [
297
299
  },
298
300
  {
299
301
  name: "notify_local", safe: false,
302
+ contract: { v: 1, effects: ["device", "state"], bins: ["osascript"] },
300
303
  description: "Local notification — macOS Notification Center via osascript, or append to operator notifications.log. " +
301
304
  "Title/body length capped. Gated (safe:false).",
302
305
  parameters: {
@@ -2234,6 +2234,7 @@ async function voiceTranscribe(args) {
2234
2234
  const TOOLS = [
2235
2235
  {
2236
2236
  name: "bash", safe: false,
2237
+ contract: { v: 1, effects: ["exec"], bins: ["bash", "sandbox-exec", "bwrap", "ps", "lsof"] },
2237
2238
  description: "Run a command in a PERSISTENT bash session: `cd`, exported variables, an activated venv and functions carry over — set up once, don't re-`cd` or re-activate every call. stdout+stderr merged, with the exit code; pipelines run with `set -o pipefail`. Anything that may run over ~2 minutes (server, build, watcher, full test suite) goes to shell_background, not a bigger timeout_ms; ctrl+b moves a running command to the background and you are told when it ends — don't poll. Prefer SINGLE quotes for patterns and paths: a raw double-quote can break tool-call serialization.",
2238
2239
  parameters: { type: "object", properties: {
2239
2240
  command: { type: "string", description: "the command to run" },
@@ -2246,6 +2247,7 @@ const TOOLS = [
2246
2247
  {
2247
2248
  // Back-compat alias: older prompts/skills call `shell_exec`. Same persistent-session engine as `bash`.
2248
2249
  name: "shell_exec", safe: false,
2250
+ contract: { v: 1, effects: ["exec"], bins: ["bash", "sandbox-exec", "bwrap", "ps", "lsof"] },
2249
2251
  description: "Alias of `bash` — runs a command in the same persistent shell session (state persists across calls).",
2250
2252
  parameters: { type: "object", properties: {
2251
2253
  command: { type: "string" }, description: { type: "string" }, cwd: { type: "string" }, timeout_ms: { type: "number" },
@@ -2254,12 +2256,14 @@ const TOOLS = [
2254
2256
  },
2255
2257
  {
2256
2258
  name: "shell_background", safe: false,
2259
+ contract: { v: 1, effects: ["exec"], bins: ["bash", "sandbox-exec", "bwrap"] },
2257
2260
  description: "Start a long-running command DETACHED and get a job id at once. Use it from the start for servers, builds, watchers and full test suites — anything over ~2 minutes, which bash's timeout would kill. You are notified when it ends (don't poll); bash_output reads its output, bash_kill stops it.",
2258
2261
  parameters: { type: "object", properties: { command: { type: "string" }, description: { type: "string" }, cwd: { type: "string" } }, required: ["command"] },
2259
2262
  run: shellBackground,
2260
2263
  },
2261
2264
  {
2262
2265
  name: "download_file", safe: false,
2266
+ contract: { v: 1, effects: ["fetch", "write"] },
2263
2267
  description: "Download a URL to disk — use this instead of curl/wget in bash. Fails loudly on HTTP errors, resumes, retries, refuses an HTML page standing in for the file, and verifies size and (with sha256) the hash before renaming onto dest. Runs in the BACKGROUND by default; the completion notice gives the final size + sha256 or the exact error — start downloads one at a time and never report one as done until that notice arrives. background:false waits (small files only).",
2264
2268
  parameters: { type: "object", properties: {
2265
2269
  url: { type: "string", description: "http(s) URL" },
@@ -2287,6 +2291,7 @@ const TOOLS = [
2287
2291
  },
2288
2292
  {
2289
2293
  name: "verify_pipeline", safe: false,
2294
+ contract: { v: 1, effects: ["exec"], bins: ["bash", "sandbox-exec", "bwrap", "ps", "lsof"] },
2290
2295
  description: "Run labeled verification stages in order (e.g. build → serve → test → screenshot); aborts at the first failing stage and reports pass/fail per stage.",
2291
2296
  parameters: { type: "object", properties: {
2292
2297
  stages: {
@@ -2339,6 +2344,7 @@ const TOOLS = [
2339
2344
  },
2340
2345
  {
2341
2346
  name: "file_read", safe: true,
2347
+ contract: { v: 1, effects: ["read"], bins: ["osascript", "textutil", "unzip"] },
2342
2348
  description: "Read a file, optionally a line range, with line numbers. Without offset/limit, only the first 2000 lines are returned — pass offset/limit to page through a larger file.",
2343
2349
  parameters: { type: "object", properties: {
2344
2350
  path: { type: "string" }, offset: { type: "number" }, limit: { type: "number" },
@@ -2347,6 +2353,7 @@ const TOOLS = [
2347
2353
  },
2348
2354
  {
2349
2355
  name: "read_files", safe: true,
2356
+ contract: { v: 1, effects: ["read"], bins: ["osascript", "textutil", "unzip"] },
2350
2357
  description: "Read several files in ONE call (parallel I/O) — far faster than serial file_read calls. Entries may carry offset/limit; results come back under per-file headers.",
2351
2358
  parameters: { type: "object", properties: {
2352
2359
  paths: {
@@ -2399,6 +2406,7 @@ const TOOLS = [
2399
2406
  },
2400
2407
  {
2401
2408
  name: "grep_search", safe: true,
2409
+ contract: { v: 1, effects: ["read"], bins: ["grep"] },
2402
2410
  description: "Plain recursive grep for a regex under a path. Prefer `search` (ripgrep: faster, .gitignore-aware) unless you need grep semantics.",
2403
2411
  parameters: { type: "object", properties: {
2404
2412
  pattern: { type: "string" }, path: { type: "string" }, glob: { type: "string" },
@@ -2407,6 +2415,7 @@ const TOOLS = [
2407
2415
  },
2408
2416
  {
2409
2417
  name: "search", safe: true,
2418
+ contract: { v: 1, effects: ["read"], bins: ["rg", "grep"] },
2410
2419
  description: "Fast content search (ripgrep: parallel, .gitignore-aware, skips binaries) — prefer it over `find … | grep`. Scope with `path` (default: current dir). HARD REFUSAL: path may not be $HOME, /, /Users or another machine-wide root (they hang for minutes) — use find_files for names, a narrow subtree for content. `glob` filters filenames; files_with_matches returns just the paths (locate before you read).",
2411
2420
  parameters: { type: "object", properties: {
2412
2421
  pattern: { type: "string", description: "regex" },
@@ -2418,6 +2427,7 @@ const TOOLS = [
2418
2427
  },
2419
2428
  {
2420
2429
  name: "find_files", safe: true,
2430
+ contract: { v: 1, effects: ["read"], bins: ["mdfind", "mdutil", "rg", "es.exe", "powershell", "tracker3", "plocate", "locate"] },
2421
2431
  description: "Find files anywhere by NAME or METADATA (kind, date, size, extension, author, tags) through the OS search index (Spotlight / Windows Search / locate) — instant, the whole home directory by default. For \"where is the file\"; use `search` for exact content/regex within a scoped directory. Absolute paths, newest first. If the index is unavailable it scans ONE directory (`path`, else the current dir) and says so on its first line.",
2422
2432
  parameters: { type: "object", properties: {
2423
2433
  query: { type: "string", description: "words or a filename fragment" },
@@ -2445,12 +2455,14 @@ const TOOLS = [
2445
2455
  },
2446
2456
  {
2447
2457
  name: "git_status", safe: true,
2458
+ contract: { v: 1, effects: ["read"], bins: ["git"] },
2448
2459
  description: "Structured git state in one read: branch, ahead/behind, staged/unstaged/untracked ('nothing to commit' when clean). Use it instead of parsing `git status` in a loop.",
2449
2460
  parameters: { type: "object", properties: { cwd: { type: "string" } } },
2450
2461
  run: gitStatus,
2451
2462
  },
2452
2463
  {
2453
2464
  name: "git_command", safe: false,
2465
+ contract: { v: 1, effects: ["read", "write", "destructive", "fetch", "egress", "exec"], bins: ["git"] },
2454
2466
  description: "Run an arbitrary git subcommand (args as an argv array, no shell).",
2455
2467
  parameters: { type: "object", properties: {
2456
2468
  args: { type: "array", items: { type: "string" } }, cwd: { type: "string" },
@@ -2459,6 +2471,7 @@ const TOOLS = [
2459
2471
  },
2460
2472
  {
2461
2473
  name: "checkpoint", safe: false,
2474
+ contract: { v: 1, effects: ["write", "state", "egress"], bins: ["git"] },
2462
2475
  description: "Git add+commit a workspace and leave a memory note in one call. Stages only the workspace's own subtree; `paths` stages just those.",
2463
2476
  parameters: { type: "object", properties: {
2464
2477
  summary: { type: "string" }, workspace: { type: "string" }, push: { type: "boolean" },
@@ -2485,6 +2498,7 @@ const TOOLS = [
2485
2498
  },
2486
2499
  {
2487
2500
  name: "web_fetch", safe: true,
2501
+ contract: { v: 1, effects: ["fetch"] },
2488
2502
  description: "Fetch an http(s) URL as plain text (HTML stripped, capped at max_chars). Read-only.",
2489
2503
  parameters: { type: "object", properties: {
2490
2504
  url: { type: "string", description: "http(s) URL" },
@@ -2510,6 +2524,7 @@ const TOOLS = [
2510
2524
  },
2511
2525
  {
2512
2526
  name: "file_upload", safe: false,
2527
+ contract: { v: 1, effects: ["read", "egress"] },
2513
2528
  description: "Upload a local file: POST multipart/form-data (default; `field` names the form field) or PUT raw bytes (presigned-PUT style), with the same auth/headers as http_request. It sends the file to an external service — confirm the destination.",
2514
2529
  parameters: { type: "object", properties: {
2515
2530
  path: { type: "string", description: "local file" },
@@ -2523,6 +2538,7 @@ const TOOLS = [
2523
2538
  },
2524
2539
  {
2525
2540
  name: "web_search", safe: true,
2541
+ contract: { v: 1, effects: ["fetch"], bins: ["docker"] },
2526
2542
  description: "Search the web (a local SearXNG, falling back to the AXE autopilot SERP) → ranked title/url/snippet results. Read-only; follow up with web_fetch.",
2527
2543
  parameters: { type: "object", properties: {
2528
2544
  query: { type: "string", description: "the search query" },
@@ -2555,6 +2571,7 @@ const TOOLS = [
2555
2571
  },
2556
2572
  {
2557
2573
  name: "email_send", safe: false,
2574
+ contract: { v: 1, effects: ["egress"] },
2558
2575
  description: "Send an email (AXE Quill SMTP). `to` defaults to the signed-in owner, so \"email me …\" just works; plain text, `html` optional. It really sends, so the permission policy gates it. Errors clearly when no Quill key is configured.",
2559
2576
  parameters: { type: "object", properties: {
2560
2577
  to: { type: "string", description: "recipient; omit for the owner" },
@@ -2599,6 +2616,7 @@ const TOOLS = [
2599
2616
  },
2600
2617
  {
2601
2618
  name: "image_analyze", safe: true,
2619
+ contract: { v: 1, effects: ["read"], bins: ["osascript", "textutil", "unzip", "qlmanage", "sips", "ffmpeg"] },
2602
2620
  description: "SEE an image with real vision (the gateway's `vision` route): a local path or http(s) url + an optional question → the model's answer. Use it on a reference, screenshot or generated image before acting — never guess content from file size or pixel stats. A DOCUMENT (PDF, DOCX, XLSX, PPTX, RTF, HTML) returns its extracted TEXT, every page; only an image-only document is rendered (first page). as_image: true looks at a document's first page as a picture.",
2603
2621
  parameters: { type: "object", properties: {
2604
2622
  image: { type: "string", description: "local path or http(s) url — an image, or a document (returned as text)" },
@@ -2611,6 +2629,7 @@ const TOOLS = [
2611
2629
  },
2612
2630
  {
2613
2631
  name: "image_inspect", safe: true,
2632
+ contract: { v: 1, effects: ["read", "fetch"], bins: ["python3"] },
2614
2633
  description: "Image FACTS without a model — dimensions, format, megapixels, aspect, file size, dominant colors, frames, EXIF — instant, on the CPU. For measurements/metadata; image_analyze is for meaning.",
2615
2634
  parameters: { type: "object", properties: {
2616
2635
  image: { type: "string", description: "local path or http(s) url" },
@@ -2619,6 +2638,7 @@ const TOOLS = [
2619
2638
  },
2620
2639
  {
2621
2640
  name: "video_analyze", safe: true,
2641
+ contract: { v: 1, effects: ["read", "fetch"], bins: ["ffprobe", "ffmpeg"] },
2622
2642
  description: "SEE a video: frames sampled evenly across it are described by the VL model (the gateway's `vision` route). A local path or http(s) url + an optional question. Never guess a video's content from the file.",
2623
2643
  parameters: { type: "object", properties: {
2624
2644
  video: { type: "string", description: "local path or http(s) url" },
@@ -2631,6 +2651,7 @@ const TOOLS = [
2631
2651
  },
2632
2652
  {
2633
2653
  name: "voice_speak", safe: false,
2654
+ contract: { v: 1, effects: ["write", "device"], bins: ["afplay"] },
2634
2655
  description: "Say text ALOUD in Operator's own voice (Kokoro TTS) on the owner's machine — a spoken status or answer, not just printed text. Saves the WAV and returns its path; a headless box saves without playing.",
2635
2656
  parameters: { type: "object", properties: {
2636
2657
  text: { type: "string", description: "what to say" },
@@ -2652,6 +2673,7 @@ const TOOLS = [
2652
2673
  },
2653
2674
  {
2654
2675
  name: "image_recreate",
2676
+ contract: { v: 1, effects: ["read", "write"], bins: ["osascript", "textutil", "unzip", "qlmanage", "sips", "ffmpeg"] },
2655
2677
  description: "Recreate a REFERENCE image in one call: vision extracts a faithful prompt, then a matching image is generated (subject, style, composition, lighting — not pixel-exact). Returns the image + what it understood.",
2656
2678
  parameters: { type: "object", properties: {
2657
2679
  reference: { type: "string", description: "image path or http(s) url" },
@@ -2784,6 +2806,7 @@ const TOOLS = [
2784
2806
  },
2785
2807
  {
2786
2808
  name: "delegate_to_agent", safe: false,
2809
+ contract: { v: 1, effects: ["exec", "egress"], bins: ["cursor-agent", "claude", "codex"] },
2787
2810
  description: agentCliToolDescription(),
2788
2811
  parameters: { type: "object", properties: {
2789
2812
  task: { type: "string", description: "the complete, self-contained task — the CLI sees only this" },
@@ -2794,6 +2817,7 @@ const TOOLS = [
2794
2817
  },
2795
2818
  {
2796
2819
  name: "browser", safe: false,
2820
+ contract: { v: 1, effects: ["fetch", "egress", "exec", "write"], bins: ["chrome"] },
2797
2821
  description: "Drive a REAL headless browser (Chrome over CDP); state persists across calls — JS pages, logins, forms, clicks. Prefer browser_read for content. Actions: open/navigate(url) reload back forward click(selector) fill(selector, text) submit(selector) eval(js, awaits promises) screenshot → png path, tab_select/tab_close(index) close. http/https/about/data URLs only. Login wall: NEVER guess credentials — ask the owner.",
2798
2822
  parameters: { type: "object", properties: {
2799
2823
  action: { type: "string", enum: ["open", "navigate", "reload", "back", "forward", "click", "fill", "submit", "eval", "screenshot", "tab_select", "tab_close", "close"], description: "the browser action" },
@@ -2809,6 +2833,7 @@ const TOOLS = [
2809
2833
  },
2810
2834
  {
2811
2835
  name: "browser_read", safe: true,
2836
+ contract: { v: 1, effects: ["read"], bins: ["chrome"] },
2812
2837
  description: "Read the active page of the `browser` session without changing it: info (title/url/readyState), text (innerText), tab_list. Open a page with browser first.",
2813
2838
  parameters: { type: "object", properties: {
2814
2839
  action: { type: "string", enum: ["info", "text", "tab_list"], description: "what to read" },
@@ -2845,6 +2870,7 @@ const TOOLS = [
2845
2870
  // ── Chauffeur native tools (gated on binary availability) ──
2846
2871
  {
2847
2872
  name: "desktop_screenshot", safe: true,
2873
+ contract: { v: 1, effects: ["device"], bins: ["chauffeur-local", "chauffeur", "sh"] },
2848
2874
  description: "Screenshot the desktop or one window via Chauffeur (text + image).",
2849
2875
  parameters: { type: "object", properties: {
2850
2876
  pid: { type: "number", description: "optional target process" },
@@ -2854,6 +2880,7 @@ const TOOLS = [
2854
2880
  },
2855
2881
  {
2856
2882
  name: "desktop_click", safe: false,
2883
+ contract: { v: 1, effects: ["device"], bins: ["chauffeur-local", "chauffeur", "sh"] },
2857
2884
  description: "Click on the desktop via Chauffeur by coordinates (x, y), an accessibility element, or both; verifies the click landed.",
2858
2885
  parameters: { type: "object", properties: {
2859
2886
  description: { type: "string", description: "what you're clicking and why" },
@@ -2866,6 +2893,7 @@ const TOOLS = [
2866
2893
  },
2867
2894
  {
2868
2895
  name: "desktop_read", safe: true,
2896
+ contract: { v: 1, effects: ["device"], bins: ["chauffeur-local", "chauffeur", "sh"] },
2869
2897
  description: "Read the accessibility tree / window state of a running application via Chauffeur.",
2870
2898
  parameters: { type: "object", properties: {
2871
2899
  pid: { type: "number" }, window_id: { type: "number" },
@@ -2874,6 +2902,7 @@ const TOOLS = [
2874
2902
  },
2875
2903
  {
2876
2904
  name: "app_interact", safe: false,
2905
+ contract: { v: 1, effects: ["exec", "device"], bins: ["chauffeur-local", "chauffeur", "sh"] },
2877
2906
  description: "High-level app control via Chauffeur: launch an app, or find / click / type into / read an element.",
2878
2907
  parameters: { type: "object", properties: {
2879
2908
  app: { type: "string", description: "app name, e.g. 'Safari'" },
@@ -2885,6 +2914,7 @@ const TOOLS = [
2885
2914
  },
2886
2915
  {
2887
2916
  name: "capture_permalink", safe: false,
2917
+ contract: { v: 1, effects: ["exec", "device"], bins: ["chauffeur-local", "chauffeur", "sh"] },
2888
2918
  description: "Capture a permalink from an app (e.g. Slack message link) by right-clicking an element and reading the clipboard.",
2889
2919
  parameters: { type: "object", properties: {
2890
2920
  app: { type: "string", description: "application to target" },
@@ -2894,6 +2924,7 @@ const TOOLS = [
2894
2924
  },
2895
2925
  {
2896
2926
  name: "live_drive", safe: false,
2927
+ contract: { v: 1, effects: ["fetch", "device"], bins: ["chauffeur-local", "chauffeur", "sh"] },
2897
2928
  description: "Live UI verification in the browser: open `url` and run labeled checks (screenshot, find, click, text); pass/fail per check.",
2898
2929
  parameters: { type: "object", properties: {
2899
2930
  url: { type: "string", description: "URL to open" },
@@ -3078,6 +3109,7 @@ const CLOUD_HOSTED_NOTE = "Runs in an ISOLATED DOCKER CONTAINER on a configured
3078
3109
  export const CLOUD_AGENT_TOOLS = [
3079
3110
  {
3080
3111
  name: "spawn_cloud_agent", safe: false,
3112
+ contract: { v: 1, effects: ["exec", "egress"], bins: ["docker", "ssh"] },
3081
3113
  description: `Spawn an autonomous "cloud agent". ${CLOUD_HOSTED_NOTE} MUTATES a repo: it creates and pushes a new branch \`cloud/<id>\` and opens a PR against \`base_branch\`. Pick \`host\` from settings.cloudAgents.hosts (defaults to settings.cloudAgents.defaultHost) and \`agent\` from the agent-CLI registry (cursor-agent / claude / codex / operator). Secrets (git creds, agent API keys) are passed to the container at runtime from the environment — never baked in or logged. Returns a tracked id; follow it with cloud_agent_status / list_cloud_agents and stop it with stop_cloud_agent.`,
3082
3114
  parameters: { type: "object", properties: {
3083
3115
  task: { type: "string", description: "the complete, self-contained task the container's agent runs autonomously (it has no memory of this conversation)" },
@@ -3097,6 +3129,7 @@ export const CLOUD_AGENT_TOOLS = [
3097
3129
  },
3098
3130
  {
3099
3131
  name: "cloud_agent_status", safe: false,
3132
+ contract: { v: 1, effects: ["fetch", "state"], bins: ["docker", "ssh"] },
3100
3133
  description: `Check one cloud agent by id: docker-inspects its container on its host, tails the container log, and reports status + branch + PR. ${CLOUD_HOSTED_NOTE}`,
3101
3134
  parameters: { type: "object", properties: {
3102
3135
  id: { type: "string", description: "the cloud-agent id (from spawn_cloud_agent / list_cloud_agents)" },
@@ -3105,6 +3138,7 @@ export const CLOUD_AGENT_TOOLS = [
3105
3138
  },
3106
3139
  {
3107
3140
  name: "stop_cloud_agent", safe: false,
3141
+ contract: { v: 1, effects: ["destructive", "state"], bins: ["docker", "ssh"] },
3108
3142
  description: `Stop and remove a cloud agent's container by id and mark it stopped. ${CLOUD_HOSTED_NOTE} Use when a run is wrong or no longer needed; already-pushed commits/PR are NOT deleted.`,
3109
3143
  parameters: { type: "object", properties: {
3110
3144
  id: { type: "string", description: "the cloud-agent id (from spawn_cloud_agent / list_cloud_agents)" },
@@ -462,6 +462,7 @@ export const WAVE_TOOLS = [
462
462
  },
463
463
  {
464
464
  name: "pkg_install", safe: false,
465
+ contract: { v: 1, effects: ["fetch", "write", "exec"], bins: ["npm", "yarn", "pnpm", "cargo", "pip"] },
465
466
  description: "Install packages. Auto-detects package manager from lockfile (npm/yarn/pnpm/cargo/pip).",
466
467
  parameters: { type: "object", properties: {
467
468
  packages: { type: "array", items: { type: "string" }, description: "package names to install" },
@@ -472,6 +473,7 @@ export const WAVE_TOOLS = [
472
473
  },
473
474
  {
474
475
  name: "pkg_remove", safe: false,
476
+ contract: { v: 1, effects: ["write", "destructive", "exec"], bins: ["npm", "yarn", "pnpm", "cargo", "pip"] },
475
477
  description: "Remove/uninstall packages. Auto-detects package manager.",
476
478
  parameters: { type: "object", properties: {
477
479
  packages: { type: "array", items: { type: "string" } },
@@ -482,6 +484,7 @@ export const WAVE_TOOLS = [
482
484
  },
483
485
  {
484
486
  name: "validate", safe: true,
487
+ contract: { v: 1, effects: ["exec"], bins: ["sh"] },
485
488
  description: "Run the project's registered validation command (see validate_register) and return PASS/FAIL + output. Registering or changing the command requires approval; this tool never runs an ad-hoc command.",
486
489
  parameters: { type: "object", properties: {} },
487
490
  run: validateRun,
@@ -519,6 +522,7 @@ export const WAVE_TOOLS = [
519
522
  },
520
523
  {
521
524
  name: "lsp_diag", safe: true,
525
+ contract: { v: 1, effects: ["read", "write", "fetch", "exec"], bins: ["npx", "python3", "node"] },
522
526
  description: "Get linter/compiler diagnostics for a file. Supports .ts/.tsx (tsc), .py (py_compile), .js/.mjs/.cjs (node --check).",
523
527
  parameters: { type: "object", properties: {
524
528
  path: { type: "string", description: "file to check" },
@@ -330,6 +330,7 @@ async function securityScanRun(args) {
330
330
  export const WAVE2_TOOLS = [
331
331
  {
332
332
  name: "shell_task_start", safe: false,
333
+ contract: { v: 1, effects: ["exec"], bins: ["bash"] },
333
334
  description: "Start a long-running background shell task with a deadline. Returns a task id for monitoring.",
334
335
  parameters: { type: "object", properties: {
335
336
  command: { type: "string" },
@@ -340,6 +341,7 @@ export const WAVE2_TOOLS = [
340
341
  },
341
342
  {
342
343
  name: "shell_task_status", safe: true,
344
+ contract: { v: 1, effects: ["read", "destructive"] },
343
345
  description: "Check a background task's status and tail its log. Optionally match a regex in recent output.",
344
346
  parameters: { type: "object", properties: {
345
347
  id: { type: "string" },
@@ -349,12 +351,14 @@ export const WAVE2_TOOLS = [
349
351
  },
350
352
  {
351
353
  name: "shell_task_list", safe: true,
354
+ contract: { v: 1, effects: ["read", "destructive"] },
352
355
  description: "List background shell tasks and their status (running/stopped).",
353
356
  parameters: { type: "object", properties: {} },
354
357
  run: shellTaskListRun,
355
358
  },
356
359
  {
357
360
  name: "shell_task_kill", safe: false,
361
+ contract: { v: 1, effects: ["destructive"] },
358
362
  description: "Terminate a background shell task (and its process group) by id.",
359
363
  parameters: { type: "object", properties: {
360
364
  id: { type: "string" },
@@ -363,6 +367,7 @@ export const WAVE2_TOOLS = [
363
367
  },
364
368
  {
365
369
  name: "sql_exec", safe: false,
370
+ contract: { v: 1, effects: ["read", "write", "destructive", "exec"], bins: ["sqlite3", "psql"] },
366
371
  description: "Execute SQL against a database. Engines: sqlite (default; database = file path) and psql (database = connection string).",
367
372
  parameters: { type: "object", properties: {
368
373
  query: { type: "string", description: "SQL to execute" },
@@ -383,6 +388,7 @@ export const WAVE2_TOOLS = [
383
388
  },
384
389
  {
385
390
  name: "deploy_logs", safe: false,
391
+ contract: { v: 1, effects: ["fetch"], bins: ["ssh"] },
386
392
  description: "Fetch service logs from the deploy target over ssh (journalctl).",
387
393
  parameters: { type: "object", properties: {
388
394
  target: { type: "string", description: "ssh host or alias (default: the stored deploy target)" },
@@ -393,6 +399,7 @@ export const WAVE2_TOOLS = [
393
399
  },
394
400
  {
395
401
  name: "peer_exchange", safe: false,
402
+ contract: { v: 1, effects: ["egress"], bins: ["switch"] },
396
403
  description: "Send a message to a peer agent on the messaging bus.",
397
404
  parameters: { type: "object", properties: {
398
405
  to: { type: "string", description: "recipient agent name" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.349",
3
+ "version": "0.1.350",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "operator": "dist/cli.js",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "scripts": {
19
19
  "dev": "tsx src/cli.tsx",
20
- "build": "tsc -p tsconfig.json",
20
+ "build": "tsc -p tsconfig.json && node scripts/copy-toolchain.mjs",
21
21
  "start": "node dist/cli.js",
22
22
  "typecheck": "tsc --noEmit",
23
23
  "lint": "biome check src test",