Skip to content

feat(core): machine.list tool in Code Mode - #65349

Merged
kitlangton merged 1 commit into
devfrom
machine-tools
Nov 21, 2026
Merged

kitlangton merged 1 commit into
devfrom
machine-tools

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

A script in Code Mode can now ask which machines exist.
Until now the model knew machine names only from a note, so a script could not pick a machine by what it is or run something on several at once.

🚦 Flag: machines. With the flag off nothing is registered.

🔧 What it adds

await tools.machine.list()
// { machines: [{ id: "gpu", online: true, paired: true, os: "linux", arch: "x64" }] }

// which makes this possible
const { machines } = await tools.machine.list()
const linux = machines.filter((machine) => machine.online && machine.os === "linux")
await Promise.all(linux.map((machine) => tools.shell({ workdir: `${machine.id}:~/app`, command: "bun test" })))

One tool group, machine, with one tool. It follows automation.ts, and the output is core's Machines.Info, the same record the machine routes return, so it carries no keys or join strings.

Case Behaviour
Flag off Nothing registered
Flag on, no machines Registered, returns an empty list, so adding the first machine does not change the tool list
A session where execute is not available The existing behaviour for Code Mode tools applies: it appears as a direct tool, machine_list

The registry is the process-wide one (Machines.node is a global node), the same instance the routes and the file tools read.

📊 Proof

Check Result
Flag off registers nothing; no machines gives an empty list; a connected and a waiting machine are listed (tool-machine.test.ts ×5) ✅ 15 pass
bun typecheck in packages/core, oxlint, prettier ✅
Independent review on another model family No findings

👀 Read: packages/core/src/tool/plugin/machine.ts (36 lines).

Follows #65347

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sound. bun test test/tool-machine.test.ts (3/3, run through the real Code Mode execute path), bun test test/plugin (666/666) and tsc -b in packages/core all pass. The flag-gate pattern matches the other flagged tool plugins. Machines.node is global, so the tool reads the same registry the machine routes use.

Public API: the HTTP API, SDK and config are unchanged. It adds one built-in Code Mode tool, machine.list (machine_list as a direct tool), only when the machines flag is on. Nothing existing changes.

No blocking concerns.

@kitlangton
kitlangton merged commit 5ca87b9 into dev Nov 21, 2026
40 of 41 checks passed
@kitlangton
kitlangton deleted the machine-tools branch November 21, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant