@nomac/cli 0.18.0 → 0.20.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 +4 -4
- package/src/cli.mjs +1 -1
- package/src/hosted-sessions.mjs +8 -5
- package/src/mac-credits.mjs +5 -3
- package/src/mac-tools.mjs +3 -3
- package/src/mcp.mjs +1 -1
- package/src/phone-tools.json +10 -0
- package/src/phone-tools.mjs +5 -4
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.20.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
|
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
|
@@ -87,8 +87,8 @@ const HELP = `Nomac cloud Mac sessions
|
|
|
87
87
|
|
|
88
88
|
Login once with nomac login. The CLI creates a local SSH key; it sends only the
|
|
89
89
|
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,
|
|
90
|
+
Credit is used per minute at the hourly price nomac credits shows, while the VM
|
|
91
|
+
is ready, including between commands. Sessions run 2 hours by default (--max-duration,
|
|
92
92
|
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
93
|
A wait timeout leaves the session attached: inspect status or run stop.
|
|
94
94
|
Use nomac start --host user@mac to connect an existing Mac instead.`;
|
|
@@ -315,7 +315,10 @@ export function tailAfter(part) {
|
|
|
315
315
|
const shellWords = words => words.map(w => /^[A-Za-z0-9_\/.:=@%+,-]+$/.test(w) ? w : `'${w.replaceAll("'", "'\\''")}'`).join(" ");
|
|
316
316
|
/** Errors after which the command may or may not have started on the Mac. */
|
|
317
317
|
const uncertainOutcome = error => !Number.isInteger(error?.status) || error.status >= 500 || ["outcome_unknown", "operation_pending"].includes(error?.code);
|
|
318
|
-
|
|
318
|
+
/** Dollars to the cent, half a cent up, in integers (toFixed rounds an exact half cent down). */
|
|
319
|
+
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")}`; };
|
|
320
|
+
/** A session's own hourly price (the one it started at), from its offer: "$0.90/hour, ". */
|
|
321
|
+
const perHour = session => session?.offer?.rate_microunits_per_hour ? `${usd(session.offer.rate_microunits_per_hour)}/hour, ` : "";
|
|
319
322
|
const clockUtc = ms => new Date(ms).toISOString().slice(11, 16) + " UTC";
|
|
320
323
|
/** One readable paragraph for nomac status. */
|
|
321
324
|
/** "Project: ~/drive/src/app, on your drive: the next session continues from it." */
|
|
@@ -335,7 +338,7 @@ export function macLine(image) {
|
|
|
335
338
|
export function statusSummary(session, image) {
|
|
336
339
|
const lines = [`${session.id}: ${session.state}`];
|
|
337
340
|
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)} ($
|
|
341
|
+
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
342
|
const a = session.activity ?? {};
|
|
340
343
|
if (session.state === "ready") {
|
|
341
344
|
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);
|
|
@@ -378,7 +381,7 @@ export async function hostedSessionCommand(command, argv, { store = sessionStore
|
|
|
378
381
|
const billing = result.session?.billing;
|
|
379
382
|
const usage = billing?.mode === "weekly_included"
|
|
380
383
|
? `Included time used: ${billing.used_seconds} seconds. No extra charge.`
|
|
381
|
-
: `Cost so far:
|
|
384
|
+
: `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
385
|
const next = result.session.state === "ready" ? `${result.project ? `${projectLine(result.project)}\n` : ""}Next: nomac sync . → nomac ssh`
|
|
383
386
|
: 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
387
|
: result.session.state === "queued" ? "Waiting for a free Mac (waiting is free). Check again: nomac start"
|
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,7 +17,7 @@ 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.",
|
package/src/phone-tools.json
CHANGED
|
@@ -119,6 +119,11 @@
|
|
|
119
119
|
"type": "string",
|
|
120
120
|
"pattern": "^[A-Z_][A-Z0-9_]{0,63}$"
|
|
121
121
|
},
|
|
122
|
+
"token": {
|
|
123
|
+
"description": "With git, instead of secret: a token you already hold for the private repository, used for this fetch only and never kept (github.com, gitlab.com or bitbucket.org). Never ask a person to paste one in the chat: use secret",
|
|
124
|
+
"type": "string",
|
|
125
|
+
"pattern": "^[\\x21-\\x7e]{1,4096}$"
|
|
126
|
+
},
|
|
122
127
|
"upload": {
|
|
123
128
|
"description": "Instead of git: the upload phone_upload_link answered (a folder or archive sent to its link), unpacked into the phone's workspace (only what changed)",
|
|
124
129
|
"type": "string",
|
|
@@ -365,6 +370,11 @@
|
|
|
365
370
|
"type": "string",
|
|
366
371
|
"pattern": "^[A-Z_][A-Z0-9_]{0,63}$"
|
|
367
372
|
},
|
|
373
|
+
"token": {
|
|
374
|
+
"description": "With git, instead of secret: a token you already hold for the private repository, used for this fetch only and never kept (github.com, gitlab.com or bitbucket.org). Never ask a person to paste one in the chat: use secret",
|
|
375
|
+
"type": "string",
|
|
376
|
+
"pattern": "^[\\x21-\\x7e]{1,4096}$"
|
|
377
|
+
},
|
|
368
378
|
"upload": {
|
|
369
379
|
"description": "Instead of git: the upload phone_upload_link answered (a folder or archive sent to its link), unpacked into the phone's workspace (only what changed)",
|
|
370
380
|
"type": "string",
|
package/src/phone-tools.mjs
CHANGED
|
@@ -98,9 +98,9 @@ async function keepFiles(reply) {
|
|
|
98
98
|
|
|
99
99
|
/** Fetches a git repository or unpacks an upload into the phone's workspace, as the hosted tools do before a run. */
|
|
100
100
|
async function place(phone, input, args, tool, key, fits) {
|
|
101
|
-
const { git, ref, secret, upload, name } = input;
|
|
101
|
+
const { git, ref, secret, token, upload, name } = input;
|
|
102
102
|
if (git) {
|
|
103
|
-
const body = { url: git, ...(ref ? { ref } : {}), ...(secret ? { secret } : {}) };
|
|
103
|
+
const body = { url: git, ...(ref ? { ref } : {}), ...(secret ? { secret } : {}), ...(token ? { token } : {}) };
|
|
104
104
|
let cloned = await api("POST", `${phones}/${phone}/sync/git`, { body, idempotencyKey: `${key}-git` });
|
|
105
105
|
for (let i = 0; cloned.state === "running" && i < 3 && fits(2); i++) cloned = await api("POST", `${phones}/${phone}/sync/git`, { body, idempotencyKey: `${key}-git` });
|
|
106
106
|
if (cloned.state !== "done") return asText(cloned.state === "running" ? { state: "running", next: `The repository is still being fetched. Call ${tool} again with the same request_key.`, request_key: key } : { error: { code: String(cloned.error ?? "clone_failed"), message: String(cloned.message ?? "The repository could not be fetched.") } });
|
|
@@ -123,7 +123,8 @@ async function place(phone, input, args, tool, key, fits) {
|
|
|
123
123
|
|
|
124
124
|
/** One of simulator-use's tools on the account's phone. */
|
|
125
125
|
const simulatorTool = (listed, bare) => async input => {
|
|
126
|
-
|
|
126
|
+
// The repository's token (secret or token) goes only to the fetch, never into the tool's own arguments.
|
|
127
|
+
const { session_id, request_key, git, ref, secret, token, upload, name, local_path, ...args } = input;
|
|
127
128
|
if (local_path !== undefined && (git || upload)) return error("invalid_request", `local_path, git and upload each say where the project comes from: pass one. Nothing was sent; call ${listed} again.`);
|
|
128
129
|
if (local_path !== undefined && listed === "phone_app_control" && args.action !== "install") return error("invalid_request", "local_path is for install: the .app to send from this machine. Nothing was sent.");
|
|
129
130
|
const phone = session_id ?? await runningPhone();
|
|
@@ -141,7 +142,7 @@ const simulatorTool = (listed, bare) => async input => {
|
|
|
141
142
|
else args.path = synced.inside ? `${synced.root}/${synced.inside}` : synced.root;
|
|
142
143
|
sent = synced.sent ? `Sent ${synced.sent} of ${synced.files} files (${Math.max(1, Math.round(synced.bytes / 1024))} KB) in ${(synced.ms / 1000).toFixed(1)} s.` : `Sent nothing: the phone has all ${synced.files} files.`;
|
|
143
144
|
}
|
|
144
|
-
const placed = await place(phone, { git, ref, secret, upload, name }, args, listed, key, fits);
|
|
145
|
+
const placed = await place(phone, { git, ref, secret, token, upload, name }, args, listed, key, fits);
|
|
145
146
|
if (placed) return placed;
|
|
146
147
|
if ((git || upload || sent) && !fits(1)) return asText({ state: "running", request_key: key, ...(sent ? { sent } : {}), next: `The project is on the phone. Call ${listed} again with the same arguments and request_key ${key} to run it${sent ? " (only what changed is sent again)" : ""}.` });
|
|
147
148
|
let reply = phoneReply(await api("POST", `${phones}/${phone}/tools/${bare}`, { body: args, idempotencyKey: key }), listed, key);
|