@nomac/cli 0.18.0 → 0.19.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/package.json +1 -1
- package/src/phone-tools.json +10 -0
- package/src/phone-tools.mjs +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomac/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.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/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);
|