@nomac/cli 0.19.0 → 0.21.0
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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +11 -7
- package/src/cli.mjs +1 -1
- package/src/hosted-sessions.mjs +50 -8
- package/src/mac-credits.mjs +5 -3
- package/src/mac-tools.mjs +3 -3
- package/src/mcp.mjs +2 -2
- package/src/phone-tools.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @nomac/cli
|
|
2
2
|
|
|
3
|
-
A real cloud Mac for AI agents and for you: macOS on Apple silicon with Xcode and the iOS Simulator, administrator access and nothing blocked, billed from prepaid credit
|
|
3
|
+
A real cloud Mac for AI agents and for you: macOS on Apple silicon with Xcode and the iOS Simulator, administrator access and nothing blocked, billed per minute from prepaid credit. Build, run and test iOS and macOS apps from Linux, Windows or a cloud sandbox, then sign, send to TestFlight and publish.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
npm install -g @nomac/cli
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomac/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "A real cloud Mac for AI agents: Xcode, the iOS Simulator, signing, TestFlight and App Store publishing, by the minute, over MCP, SSH and HTTPS.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
package/skill/SKILL.md
CHANGED
|
@@ -3,8 +3,8 @@ name: nomac
|
|
|
3
3
|
description: >
|
|
4
4
|
A real cloud Mac for agents on Linux, Windows or a sandbox: build, run and
|
|
5
5
|
test iOS and macOS apps with Xcode and the iOS Simulator (simulator-use),
|
|
6
|
-
sign, send to TestFlight and publish. Fully enabled for the agent,
|
|
7
|
-
|
|
6
|
+
sign, send to TestFlight and publish. Fully enabled for the agent, billed per
|
|
7
|
+
minute from prepaid credit, over SSH, HTTPS or MCP.
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# nomac: a Mac for your agent
|
|
@@ -30,8 +30,8 @@ Store screenshots start the phone with `device: "iphone-pro-max"` (6.9-inch,
|
|
|
30
30
|
## Cloud Mac setup and workflow
|
|
31
31
|
|
|
32
32
|
1. Check credit with `nomac credits --json` or `get_mac_credits`. Mac time is
|
|
33
|
-
|
|
34
|
-
expires. Too little? Run `nomac credits buy --packs N --open` or call
|
|
33
|
+
billed per minute; `nomac credits` shows the hourly price and the time left;
|
|
34
|
+
credit never expires. Too little? Run `nomac credits buy --packs N --open` or call
|
|
35
35
|
`get_mac_checkout` (packs 1-10). Tell the human a payment page opened, or
|
|
36
36
|
give them the printed link, and ask them to pay. Never enter payment
|
|
37
37
|
details yourself. Poll credits until the balance appears; a checkout URL is
|
|
@@ -47,7 +47,8 @@ Store screenshots start the phone with `device: "iphone-pro-max"` (6.9-inch,
|
|
|
47
47
|
Run commands with `nomac exec -- COMMAND`: it prints the output as it
|
|
48
48
|
arrives and exits with the command's code, waiting at most 30 s (or the
|
|
49
49
|
`--timeout` given, up to 600 s). For builds and tests use
|
|
50
|
-
`nomac exec --wait 600 -- COMMAND`.
|
|
50
|
+
`nomac exec --wait 600 -- COMMAND`. What is piped in is the command's stdin
|
|
51
|
+
(`cat build.sh | nomac exec -- bash -s`). Exit code 75 means still running: wait
|
|
51
52
|
with `nomac job JOB_ID --wait 600`, never rerun. In scripts add
|
|
52
53
|
`--request-key stable-key-0001`. A command may run an hour (`--timeout
|
|
53
54
|
3600`); longer, use `nomac ssh -- COMMAND`. A command ends with everything
|
|
@@ -104,14 +105,17 @@ keyboard and mouse, also on the lock screen and in password dialogs, use
|
|
|
104
105
|
`mac_input`): each answers with a screenshot. Drive the Simulator with
|
|
105
106
|
simulator-use, preinstalled: `simulator-use look` reads the screen as text,
|
|
106
107
|
`simulator-use act 'tap "Sign In"'` taps and types by label, `simulator-use run`
|
|
107
|
-
builds, installs and launches (simctl works too)
|
|
108
|
+
builds, installs and launches (simctl works too), and `simulator-use app
|
|
109
|
+
storekit Products.storekit --app ID` tests in-app purchases from the app's
|
|
110
|
+
`.storekit` file (the App Store's sandbox cannot buy in a Simulator). Give the human
|
|
108
111
|
`open_mac_desktop` when they want to see the screen.
|
|
109
112
|
`get_mac_session` (and `nomac status --json`) lists what
|
|
110
113
|
is installed: Node, Python, uv, nvm, Ruby with CocoaPods, xcbeautify, xcodegen,
|
|
111
114
|
gh, Git LFS, jq and simulator-use.
|
|
112
115
|
Pipe xcodebuild through `xcbeautify`. Simulator devices share names across iOS
|
|
113
116
|
runtimes: pick one by ID (`xcrun simctl list devices available`) or with
|
|
114
|
-
`OS=27.0` in `-destination
|
|
117
|
+
`OS=27.0` in `-destination`; an older iOS downloads in about 6 minutes
|
|
118
|
+
(`xcodebuild -downloadPlatform iOS -buildVersion 26.5`). Apple Intelligence cannot generate on a virtual
|
|
115
119
|
Mac, in the Simulator either: test it on a device.
|
|
116
120
|
Report failures using `report_issue` with `session_id`, optional `job_id` and
|
|
117
121
|
a description without secrets. Read https://nomac.app/llms.txt for full limits.
|
package/src/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { api, CliError } from "./api.mjs";
|
|
2
2
|
import { saveApiKey } from "./config.mjs";
|
|
3
3
|
|
|
4
|
-
const HELP = `nomac: a cloud Mac for you and your agents (
|
|
4
|
+
const HELP = `nomac: a cloud Mac for you and your agents (billed per minute from prepaid credit)
|
|
5
5
|
|
|
6
6
|
Start:
|
|
7
7
|
nomac login connect this device (approve in the browser)
|
package/src/hosted-sessions.mjs
CHANGED
|
@@ -60,7 +60,8 @@ const HELP = `Nomac cloud Mac sessions
|
|
|
60
60
|
grant permissions on this Mac at start
|
|
61
61
|
nomac exec [--wait 30] -- command args
|
|
62
62
|
runs it, prints its output as it arrives,
|
|
63
|
-
exits with its code.
|
|
63
|
+
exits with its code. What is piped in is its
|
|
64
|
+
stdin (cat build.sh | nomac exec -- bash -s).
|
|
64
65
|
Waits up to 30 s, or with --timeout N up to N s
|
|
65
66
|
(at most 600); for builds and tests use --wait 600.
|
|
66
67
|
Exit code 75 means still running: see nomac job.
|
|
@@ -87,8 +88,8 @@ const HELP = `Nomac cloud Mac sessions
|
|
|
87
88
|
|
|
88
89
|
Login once with nomac login. The CLI creates a local SSH key; it sends only the
|
|
89
90
|
public key. Sessions use the port-443 gateway and verified guest host keys.
|
|
90
|
-
Credit is used at
|
|
91
|
-
including between commands. Sessions run 2 hours by default (--max-duration,
|
|
91
|
+
Credit is used per minute at the hourly price nomac credits shows, while the VM
|
|
92
|
+
is ready, including between commands. Sessions run 2 hours by default (--max-duration,
|
|
92
93
|
up to 8 hours) and spend at most $5 (--max-cost). No credit? nomac credits buy. Stop removes the VM and every file outside ~/drive.
|
|
93
94
|
A wait timeout leaves the session attached: inspect status or run stop.
|
|
94
95
|
Use nomac start --host user@mac to connect an existing Mac instead.`;
|
|
@@ -189,6 +190,40 @@ export async function sessionAccess(id, request = api) {
|
|
|
189
190
|
transportOptions({ gateway: access.gateway, token: access.token });
|
|
190
191
|
return access;
|
|
191
192
|
}
|
|
193
|
+
/** A command's whole request, what it reads on stdin included: the gateway takes 64 KiB. */
|
|
194
|
+
const JOB_BYTES = 63 * 1024;
|
|
195
|
+
/**
|
|
196
|
+
* What is piped into nomac exec (cat build.sh | nomac exec -- bash -s, or < build.sh), for the command on the Mac.
|
|
197
|
+
* A terminal, /dev/null, and a pipe that sends nothing in its first second (an agent's shell that keeps stdin open
|
|
198
|
+
* and never writes) give nothing, so a command never waits for input nobody sends. More than fits in a command is
|
|
199
|
+
* refused, never cut.
|
|
200
|
+
*/
|
|
201
|
+
export function pipedInput(input = process.stdin, { firstByteMs = 1000, limit = JOB_BYTES } = {}) {
|
|
202
|
+
if (!input || input.isTTY) return Promise.resolve(null);
|
|
203
|
+
return new Promise((resolve, reject) => {
|
|
204
|
+
const chunks = []; let size = 0, done = false;
|
|
205
|
+
const finish = (error, value) => {
|
|
206
|
+
if (done) return; done = true; clearTimeout(silent);
|
|
207
|
+
input.off("data", onData); input.off("end", onEnd); input.off("error", onEnd);
|
|
208
|
+
// Nothing else reads stdin: let go of it, so a pipe that never ends cannot keep this process alive.
|
|
209
|
+
if (error || value === null) input.destroy?.(); else input.pause?.();
|
|
210
|
+
if (error) reject(error); else resolve(value);
|
|
211
|
+
};
|
|
212
|
+
const onData = chunk => {
|
|
213
|
+
size += chunk.length;
|
|
214
|
+
if (size > limit) finish(new CliError(`What is piped into nomac exec goes with the command, which can be ${limit / 1024} KiB in all; this is more. Copy a larger file to the Mac (nomac sync, then run it there).`));
|
|
215
|
+
else chunks.push(chunk);
|
|
216
|
+
};
|
|
217
|
+
const onEnd = () => finish(null, size ? Buffer.concat(chunks) : null);
|
|
218
|
+
const silent = setTimeout(() => { if (!size) finish(null, null); }, firstByteMs);
|
|
219
|
+
silent.unref?.();
|
|
220
|
+
input.on("data", onData); input.on("end", onEnd); input.on("error", onEnd);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/** The command on the Mac reading input on its stdin: carried in the request as base64, decoded into a pipe. */
|
|
224
|
+
export function withInput(command, input) {
|
|
225
|
+
return ["/bin/bash", "-c", 'data=$1; shift; printf %s "$data" | /usr/bin/base64 -D | "$@"', "nomac-stdin", input.toString("base64"), ...command];
|
|
226
|
+
}
|
|
192
227
|
/** nomac exec's exit code for a command still running when the wait ends (EX_TEMPFAIL). */
|
|
193
228
|
export const STILL_RUNNING = 75;
|
|
194
229
|
/** Quick commands are checked early; after that, once a second. */
|
|
@@ -315,7 +350,10 @@ export function tailAfter(part) {
|
|
|
315
350
|
const shellWords = words => words.map(w => /^[A-Za-z0-9_\/.:=@%+,-]+$/.test(w) ? w : `'${w.replaceAll("'", "'\\''")}'`).join(" ");
|
|
316
351
|
/** Errors after which the command may or may not have started on the Mac. */
|
|
317
352
|
const uncertainOutcome = error => !Number.isInteger(error?.status) || error.status >= 500 || ["outcome_unknown", "operation_pending"].includes(error?.code);
|
|
318
|
-
|
|
353
|
+
/** Dollars to the cent, half a cent up, in integers (toFixed rounds an exact half cent down). */
|
|
354
|
+
const usd = microunits => { const m = BigInt(microunits ?? 0), negative = m < 0n, cents = ((negative ? -m : m) + 5_000n) / 10_000n; return `${negative ? "-" : ""}$${cents / 100n}.${String(cents % 100n).padStart(2, "0")}`; };
|
|
355
|
+
/** A session's own hourly price (the one it started at), from its offer: "$0.90/hour, ". */
|
|
356
|
+
const perHour = session => session?.offer?.rate_microunits_per_hour ? `${usd(session.offer.rate_microunits_per_hour)}/hour, ` : "";
|
|
319
357
|
const clockUtc = ms => new Date(ms).toISOString().slice(11, 16) + " UTC";
|
|
320
358
|
/** One readable paragraph for nomac status. */
|
|
321
359
|
/** "Project: ~/drive/src/app, on your drive: the next session continues from it." */
|
|
@@ -335,7 +373,7 @@ export function macLine(image) {
|
|
|
335
373
|
export function statusSummary(session, image) {
|
|
336
374
|
const lines = [`${session.id}: ${session.state}`];
|
|
337
375
|
if (macLine(image)) lines.push(macLine(image));
|
|
338
|
-
if (["ready", "provisioning", "queued"].includes(session.state)) lines.push(`Cost so far: ${usd(session.cost?.accrued_microunits)} ($
|
|
376
|
+
if (["ready", "provisioning", "queued"].includes(session.state)) lines.push(`Cost so far: ${usd(session.cost?.accrued_microunits)} (${perHour(session)}billed per minute while ready). Credit left: nomac credits`);
|
|
339
377
|
const a = session.activity ?? {};
|
|
340
378
|
if (session.state === "ready") {
|
|
341
379
|
const stops = [a.idle_deadline_at ? `when idle, at ${clockUtc(a.idle_deadline_at)}` : null, a.hard_deadline_at ? `at ${clockUtc(a.hard_deadline_at)} at the latest` : null].filter(Boolean);
|
|
@@ -362,7 +400,7 @@ export async function hostedRequest(id, method, path, params = {}, { request = a
|
|
|
362
400
|
return transport(method, path, { ...params, gateway: access.gateway, token: access.token });
|
|
363
401
|
}
|
|
364
402
|
export async function hostedSessionCommand(command, argv, { store = sessionStore(), request = api, transport = macRequest, run = runProcess, print = console.log, sleep = ms => new Promise(r => setTimeout(r, ms)), now = Date.now,
|
|
365
|
-
stdout = data => process.stdout.write(data), stderr = data => process.stderr.write(data), exitWith = code => { process.exitCode = code; } , watch = watchFolder, stopWatching = undefined, debounceMs = 600} = {}) {
|
|
403
|
+
stdout = data => process.stdout.write(data), stderr = data => process.stderr.write(data), exitWith = code => { process.exitCode = code; } , watch = watchFolder, stopWatching = undefined, debounceMs = 600, readInput = pipedInput} = {}) {
|
|
366
404
|
let parsed;
|
|
367
405
|
try { parsed = parseArgs({ args: argv, options, allowPositionals: true }); }
|
|
368
406
|
catch (error) { throw new CliError(error.message); }
|
|
@@ -378,7 +416,7 @@ export async function hostedSessionCommand(command, argv, { store = sessionStore
|
|
|
378
416
|
const billing = result.session?.billing;
|
|
379
417
|
const usage = billing?.mode === "weekly_included"
|
|
380
418
|
? `Included time used: ${billing.used_seconds} seconds. No extra charge.`
|
|
381
|
-
: `Cost so far:
|
|
419
|
+
: `Cost so far: ${usd(result.session?.cost?.accrued_microunits)} (${perHour(result.session)}billed per minute while the Mac is ready). Credit left: nomac credits`;
|
|
382
420
|
const next = result.session.state === "ready" ? `${result.project ? `${projectLine(result.project)}\n` : ""}Next: nomac sync . → nomac ssh`
|
|
383
421
|
: result.session.failure_code === "capacity_unavailable" ? "No Mac was free within 5 minutes; nothing was charged. Run nomac start again in a few minutes."
|
|
384
422
|
: result.session.state === "queued" ? "Waiting for a free Mac (waiting is free). Check again: nomac start"
|
|
@@ -565,9 +603,13 @@ export async function hostedSessionCommand(command, argv, { store = sessionStore
|
|
|
565
603
|
const waitFor = waitSeconds = integer(values.wait, given === null ? 30 : Math.min(given, 600), 0, 3600);
|
|
566
604
|
const timeout = given ?? (values["request-key"] === undefined ? Math.max(300, waitFor) : 600);
|
|
567
605
|
const line = isShellLine(positionals), dir = local.workspaceOnDrive ? local.workspace : null;
|
|
568
|
-
const
|
|
606
|
+
const onMac = dir ? (line ? ["/bin/bash", "-lc", `cd ${shellQuote(dir)} && ${positionals[0]}`] : ["/bin/bash", "-lc", `cd ${shellQuote(dir)} && exec "$@"`, "nomac", ...positionals])
|
|
569
607
|
: line ? ["/bin/bash", "-lc", positionals[0]] : positionals;
|
|
608
|
+
const input = await readInput();
|
|
609
|
+
const remote = input?.length ? withInput(onMac, input) : onMac;
|
|
570
610
|
method = "POST"; path = `${base}/jobs`; params = { requestKey: values["request-key"] ?? `cli-${randomUUID()}`, body: { argv: remote, timeout_seconds: timeout } };
|
|
611
|
+
const size = Buffer.byteLength(JSON.stringify(params.body));
|
|
612
|
+
if (input?.length && size > JOB_BYTES) throw new CliError(`What is piped into nomac exec goes with the command, which can be ${JOB_BYTES / 1024} KiB in all; this is ${Math.ceil(size / 1024)} KiB. Copy a larger file to the Mac (nomac sync, then run it there).`);
|
|
571
613
|
} else {
|
|
572
614
|
if (positionals.length !== 1 || !/^job_[a-f0-9]{40}$/.test(positionals[0])) throw new CliError("Supply the existing job ID.");
|
|
573
615
|
path = `${base}/jobs/${positionals[0]}`;
|
package/src/mac-credits.mjs
CHANGED
|
@@ -8,7 +8,7 @@ const HELP = `nomac credits [--json]
|
|
|
8
8
|
|
|
9
9
|
nomac credits buy [--packs N] [--open] [--request-key KEY] [--json]
|
|
10
10
|
Get a payment link for the human. $10 packs, 1 to 10 per purchase;
|
|
11
|
-
|
|
11
|
+
billed per minute at the hourly price nomac credits shows; credit never expires.
|
|
12
12
|
A first purchase of 1 pack ($10) is recommended and enough to get started.
|
|
13
13
|
Bigger purchases earn bonus credit: +5% from $30, +10% from $50, +20% at $100.
|
|
14
14
|
--open opens the link in this machine's browser (default when run by a person).
|
|
@@ -18,7 +18,8 @@ Agents: run \`nomac credits buy --packs N --open\`, tell the human to pay in the
|
|
|
18
18
|
browser tab that opened (or give them the printed link), then poll
|
|
19
19
|
\`nomac credits --json\` until spendable_seconds covers the work.`;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
/** Dollars to the cent, half a cent up, in integers (toFixed rounds an exact half cent down). */
|
|
22
|
+
const usd = microunits => { const m = BigInt(microunits ?? 0), negative = m < 0n, cents = ((negative ? -m : m) + 5_000n) / 10_000n; return `${negative ? "-" : ""}$${cents / 100n}.${String(cents % 100n).padStart(2, "0")}`; };
|
|
22
23
|
const money = dollars => `$${Number.isInteger(dollars) ? dollars : dollars.toFixed(2)}`;
|
|
23
24
|
const hours = value => `${Number(Number(value).toFixed(1))} hours`;
|
|
24
25
|
const clock = seconds => {
|
|
@@ -51,7 +52,8 @@ export async function creditsCommand(argv, { request = api, print = console.log,
|
|
|
51
52
|
if (!buying) {
|
|
52
53
|
const { credits, purchases } = await request("GET", "/api/v1/mac/credits");
|
|
53
54
|
if (values.json) return print(JSON.stringify({ credits, purchases }, null, 2));
|
|
54
|
-
const
|
|
55
|
+
const rate = credits.pricing?.rate_cents_per_hour;
|
|
56
|
+
const lines = [`Mac credit: ${usd(credits.spendable_microunits)} (${clock(credits.spendable_seconds)} of Mac time${rate ? ` at ${usd(rate * 10_000)}/hour` : ""}, billed per minute)`];
|
|
55
57
|
if (BigInt(credits.reserved_microunits) > 0n) lines.push(`Held for a running session: ${usd(credits.reserved_microunits)}`);
|
|
56
58
|
if (credits.spending_blocked) lines.push("Mac usage is paused. Contact support@nomac.app.");
|
|
57
59
|
else if (credits.spendable_seconds < 60) lines.push("No credit left. Buy some: nomac credits buy --packs 1");
|
package/src/mac-tools.mjs
CHANGED
|
@@ -14,18 +14,18 @@ const key = { type: "string", pattern: "^[A-Za-z0-9_.:-]{8,128}$" };
|
|
|
14
14
|
const schema = (properties, required = []) => ({ type: "object", properties, required, additionalProperties: false });
|
|
15
15
|
const base = args => `/api/v1/mac/sessions/${encodeURIComponent(args.session_id)}`;
|
|
16
16
|
export const MAC_TOOLS = [
|
|
17
|
-
{ name: "get_mac_checkout", description: "Get a payment link for Mac credit and open it in the human's browser on this machine. Credit is
|
|
17
|
+
{ name: "get_mac_checkout", description: "Get a payment link for Mac credit and open it in the human's browser on this machine. Credit is billed per minute at the hourly price get_mac_credits shows, sold in $10 packs, 1 to 10 packs per purchase, and never expires. Bigger purchases earn bonus credit: +5% from 3 packs ($30), +10% from 5 ($50), +20% at 10 ($100 buys $120). For a first purchase (get_mac_credits shows first_purchase: true), recommend 1 pack: $10 is enough to get started. For a refill, suggest 3 packs ($30, +5%) or more, and let them decide. Call this when get_mac_credits shows too little credit or start_mac returns insufficient_credit. Then tell the human a payment page opened (or give them the returned url if opened_in_browser is false) and ask them to pay. Never enter payment details yourself. Poll get_mac_credits until the balance appears, then start the Mac. Reuse request_key after a lost response; a new key is a new purchase.", inputSchema: schema({ packs: { type: "integer", minimum: 1, maximum: 10, default: 1, description: "Number of $10 packs, 1-10. Pick from the human's budget or expected hours; 3+ packs earn bonus credit." }, open: { type: "boolean", default: true, description: "Open the link in this machine's browser." }, request_key: key }, ["request_key"]), handler: async ({ packs = 1, open = true, request_key }) => {
|
|
18
18
|
const result = await api("POST", "/api/v1/mac/credits/checkout", { body: { packs }, idempotencyKey: request_key });
|
|
19
19
|
const opened = open && result.action === "open_checkout_url" && result.url ? openUrl(result.url) : false;
|
|
20
20
|
return text({ ...result, opened_in_browser: opened });
|
|
21
21
|
} },
|
|
22
22
|
{ name: "get_mac_credits", description: "Read the prepaid Mac credit balance: spendable dollars, spendable_seconds (how long a Mac can run on it), amounts held by a running session, pricing (including bonus_tiers for bigger purchases), recent purchases and first_purchase (true until the first paid top-up). Credit never expires. If spendable_seconds is below what the task needs, call get_mac_checkout.", inputSchema: schema({}), handler: async () => text(await api("GET", "/api/v1/mac/credits")) },
|
|
23
|
-
{ name: "start_mac", description: "Allocate a full cloud Mac VM, billed from prepaid credit
|
|
23
|
+
{ name: "start_mac", description: "Allocate a full cloud Mac VM, billed per minute from prepaid credit; its answer states its price. If it returns insufficient_credit, call get_mac_checkout, have the human pay, then retry with the same request_key. Supply a stable request_key; SSH public_key is optional for HTTPS-only agents; reuse both after a lost response. Inspect the returned offer and limits. Poll get_mac_session until ready. No project pipeline is imposed; stop_mac deletes the VM and files. The Mac is fully enabled for you: macOS asks for no administrator password, and the Mac's login password is in $NOMAC_MAC_PASSWORD on it; the answer's warning says so. Every Mac has the account's persistent drive at ~/drive, kept between sessions (get_mac_drive). access opts out: prompts ask keeps macOS's usual prompts; drive none starts without the drive.", inputSchema: schema({ public_key: { type: "string" }, request_key: key, limits: { type: "object", properties: { max_duration_seconds: { type: "integer", minimum: 60, maximum: 28800 }, idle_timeout_seconds: { type: "integer", minimum: 60, maximum: 3600 }, spend_cap_microunits: { type: "string", pattern: "^[1-9][0-9]{0,17}$" } }, additionalProperties: false }, parallel: { type: "boolean", description: "true starts a second Mac beside the account's running one (accounts that bought credit, while NoMac has a Mac to spare); it runs without the account's drive. Without it, a start while a Mac runs answers session_limit_reached with that Mac's id, to use." },
|
|
24
24
|
access: { type: "object", properties: { prompts: { type: "string", enum: ["auto", "ask"] }, gatekeeper: { type: "string", enum: ["off", "on"] }, drive: { type: "string", enum: ["account", "none"] },
|
|
25
25
|
permissions: { type: "object", description: "By bundle ID: a list of permissions (camera, microphone, contacts, calendars, reminders, photos, desktop, documents, downloads and more) or \"all\"", additionalProperties: { anyOf: [{ type: "string", enum: ["all"] }, { type: "array", items: { type: "string" }, minItems: 1 }] } } }, additionalProperties: false } }, ["request_key"]), handler: async ({ request_key, ...body }) => text(await api("POST", "/api/v1/mac/sessions", { body, idempotencyKey: request_key })) },
|
|
26
26
|
{ name: "list_mac_sessions", description: "Find existing Mac sessions, including after losing a response. Shows state, cost, limits and cleanup.", inputSchema: schema({}), handler: async () => text(await api("GET", "/api/v1/mac/sessions")) },
|
|
27
27
|
{ name: "get_mac_session", description: "Read live Mac allocation state, cost, funded time and cleanup confirmation, and once ready the credentials installed on it (secrets, signing identities and profiles, by name and path, never values) and account: the Mac's user, whether its login password is set (in $NOMAC_MAC_PASSWORD on the Mac), the access choices, and how to type and click (mac_input). queued/provisioning means wait; stopping is not yet confirmed cleanup.", inputSchema: schema({ session_id: session }, ["session_id"]), handler: async args => text(await api("GET", base(args))) },
|
|
28
|
-
{ name: "extend_mac", description: "Keep a running Mac going longer: raises its time limit by minutes (default 60), up to 8 hours since it started, and its spend cap with it. Call it when an answer's stop_notice says the Mac stops soon at its time limit or spend cap, or before a build or test that would not finish in time. It adds no credit: when stop_notice's reason is credit, the human adds some (get_mac_checkout). The Mac still bills
|
|
28
|
+
{ name: "extend_mac", description: "Keep a running Mac going longer: raises its time limit by minutes (default 60), up to 8 hours since it started, and its spend cap with it. Call it when an answer's stop_notice says the Mac stops soon at its time limit or spend cap, or before a build or test that would not finish in time. It adds no credit: when stop_notice's reason is credit, the human adds some (get_mac_checkout). The Mac still bills at its hourly price while it runs.", inputSchema: schema({ session_id: session, minutes: { type: "integer", minimum: 1, maximum: 480, default: 60, description: "Minutes to add to the time limit, 1-480. Default 60." } }, ["session_id"]), handler: async ({ session_id, minutes = 60 }) => text(await api("POST", `${base({ session_id })}/extend`, { body: { minutes } })) },
|
|
29
29
|
{ name: "get_mac_drive", description: "Read the account's persistent drive: a disk kept between sessions and mounted at ~/drive on every Mac (20 GB). What is there stays for the next session: keep projects in ~/drive/src for incremental builds; package and build caches (DerivedData, Swift packages, CocoaPods, npm) are kept there already. NoMac saves it when a Mac stops, with nothing to call. Shows the space used, the newest saved version, a save still in progress, recent versions, and the date it is deleted after 90 days without a Mac.", inputSchema: schema({}), handler: async () => text(await api("GET", "/api/v1/mac/drive")) },
|
|
30
30
|
{ name: "reset_mac_drive", description: "Empty the account's persistent drive: the next Mac starts with a new, empty ~/drive, and everything on the old drive is deleted, with no way back. Stop any running session first (stop_mac). For a single Mac without the drive, start_mac with access drive none instead.", inputSchema: schema({}), handler: async () => text(await api("DELETE", "/api/v1/mac/drive")) },
|
|
31
31
|
{ name: "list_secrets", description: "List the account's secrets by name: variables (set in every shell and command on the Mac) and files (with their path on the Mac), whether every Mac receives them or only when asked, sizes, and secrets an agent asked for that the person has not entered yet. Values are never returned.", inputSchema: schema({}), handler: async () => text(await api("GET", "/api/v1/secrets")) },
|
package/src/mcp.mjs
CHANGED
|
@@ -17,12 +17,12 @@ import { PHONE_ALIASES, PHONE_TOOLS } from "./phone-tools.mjs";
|
|
|
17
17
|
const PROTOCOL_FALLBACK = "2025-06-18";
|
|
18
18
|
/** How the tools fit together, sent once at initialize (the hosted server sends the same kind of text), within the 4,096 characters Claude Code keeps. */
|
|
19
19
|
const INSTRUCTIONS = [
|
|
20
|
-
"NoMac gives you a cloud iPhone and a cloud Mac with Xcode, billed from prepaid credit
|
|
20
|
+
"NoMac gives you a cloud iPhone and a cloud Mac with Xcode, billed per minute from prepaid credit.",
|
|
21
21
|
"The cloud iPhone (the phone tools: phone and phone_*) builds, runs and tests an iOS app, ready in seconds, no shell: phone with action start (its answer has links.view for the person); phone_app_run with local_path (a folder here, only changes sent) or git (an https repository link) builds and runs the app, incrementally; phone_ui_look reads the screen as text, phone_ui_act taps and types by label; phone_app_logs, phone_tests_run; a long build answers with a job for phone_job_status; phone with action stop when done. The Mac (start_mac and the Mac tools) does the rest.",
|
|
22
22
|
"Use it when work needs macOS this machine lacks (Windows, Linux, a cloud sandbox): an iOS, iPadOS, watchOS, visionOS or macOS app (Swift, SwiftUI, React Native, Expo, Flutter, Capacitor), Xcode, signing, TestFlight or the App Store.",
|
|
23
23
|
"Typical flow: get_mac_credits, start_mac, poll get_mac_session until ready, put code there (exec_mac with git clone into ~/drive/src, write_mac_file, fetch_to_mac, create_mac_upload_link), run exec_mac, get results with read_mac_file or create_mac_download_link, then stop_mac.",
|
|
24
24
|
"The account's drive at ~/drive (20 GB) is on every Mac and kept between sessions; everything outside it is deleted at stop. Clone and build in ~/drive/src/<repo> so the next session rebuilds only what changed; keep it under 10 GB (nomac-drive shows what takes the space, nomac-drive clean deletes stale build products).",
|
|
25
|
-
"The Mac's own Simulator: simulator-use is on it (run it with exec_mac): simulator-use look reads the screen as text, simulator-use act 'tap \"Sign In\"' taps by label, simulator-use run builds and launches
|
|
25
|
+
"The Mac's own Simulator: simulator-use is on it (run it with exec_mac): simulator-use look reads the screen as text, simulator-use act 'tap \"Sign In\"' taps by label, simulator-use run builds and launches it, app storekit tests purchases; ~/NOMAC.md has the rest.",
|
|
26
26
|
"When an answer says low_credit (under an hour left), tell the human before a long build and offer its buy_url: a Mac stops when the credit runs out. For a refill, suggest 3 packs ($30, +5%).",
|
|
27
27
|
"One Mac per account at a time: start_mac while one runs answers session_limit_reached with its id, to use; parallel: true starts a second (accounts that bought credit, while NoMac has one to spare), without the drive.",
|
|
28
28
|
"exec_mac returns a quick command's output in the same call; pass wait_seconds: 40 for builds and tests (a call answers within 45 s). A command still running comes back as a job: poll get_mac_job with its job_id, then read_mac_output.",
|
package/src/phone-tools.json
CHANGED
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
224
|
"name": "phone_app_control",
|
|
225
|
-
"description": "Cloud iPhone: Launch, install, stop or remove an app
|
|
225
|
+
"description": "Cloud iPhone: Launch, install, stop or remove an app; open a URL or deep link; grant, revoke or reset a permission; set the location; send a push; test purchases (.storekit); set the phone's appearance, locale, time zone, text size or a clean status bar. launch answers with its first screen; app defaults to the last launched.",
|
|
226
226
|
"inputSchema": {
|
|
227
227
|
"type": "object",
|
|
228
228
|
"properties": {
|
|
@@ -239,6 +239,7 @@
|
|
|
239
239
|
"reset_permissions",
|
|
240
240
|
"location",
|
|
241
241
|
"push",
|
|
242
|
+
"storekit",
|
|
242
243
|
"appearance",
|
|
243
244
|
"locale",
|
|
244
245
|
"timezone",
|