@miosa/cli 1.0.92 → 1.0.93
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 +3 -3
- package/dist/app-advisor.js +6 -6
- package/dist/app-advisor.js.map +1 -1
- package/dist/bin/miosa.js +2 -2
- package/dist/bin/miosa.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/commands/agent.d.ts +10 -10
- package/dist/commands/agent.js +47 -47
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/app.js +1 -1
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/capabilities.js +22 -22
- package/dist/commands/capabilities.js.map +1 -1
- package/dist/commands/computers.js +20 -20
- package/dist/commands/computers.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +196 -3
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/devices.js +12 -12
- package/dist/commands/devices.js.map +1 -1
- package/dist/commands/docker-deploy.d.ts.map +1 -1
- package/dist/commands/docker-deploy.js +58 -22
- package/dist/commands/docker-deploy.js.map +1 -1
- package/dist/commands/run-groups.d.ts +3 -0
- package/dist/commands/run-groups.d.ts.map +1 -0
- package/dist/commands/run-groups.js +364 -0
- package/dist/commands/run-groups.js.map +1 -0
- package/dist/commands/runs.d.ts +3 -0
- package/dist/commands/runs.d.ts.map +1 -0
- package/dist/commands/runs.js +365 -0
- package/dist/commands/runs.js.map +1 -0
- package/dist/commands/sandbox.js +26 -26
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { apiPath, client, enc, runAction, unwrap, } from "./enterprise-util.js";
|
|
4
|
+
import { parseSse } from "../client.js";
|
|
5
|
+
import { isJsonMode } from "../cli-env.js";
|
|
6
|
+
import { renderTable } from "../ui/table.js";
|
|
7
|
+
function rows(raw) {
|
|
8
|
+
if (Array.isArray(raw))
|
|
9
|
+
return raw;
|
|
10
|
+
if (raw && typeof raw === "object") {
|
|
11
|
+
const value = raw;
|
|
12
|
+
for (const key of ["data", "runs", "items"]) {
|
|
13
|
+
if (Array.isArray(value[key]))
|
|
14
|
+
return value[key];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
function eventRows(raw) {
|
|
20
|
+
if (Array.isArray(raw))
|
|
21
|
+
return raw;
|
|
22
|
+
if (raw && typeof raw === "object") {
|
|
23
|
+
const value = raw;
|
|
24
|
+
for (const key of ["data", "activity", "items"]) {
|
|
25
|
+
if (Array.isArray(value[key]))
|
|
26
|
+
return value[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
function fileRows(raw) {
|
|
32
|
+
if (Array.isArray(raw))
|
|
33
|
+
return raw;
|
|
34
|
+
if (raw && typeof raw === "object") {
|
|
35
|
+
const value = raw;
|
|
36
|
+
for (const key of ["data", "files", "items"]) {
|
|
37
|
+
if (Array.isArray(value[key]))
|
|
38
|
+
return value[key];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
function colorStatus(status) {
|
|
44
|
+
switch ((status ?? "").toLowerCase()) {
|
|
45
|
+
case "running":
|
|
46
|
+
return chalk.green(status);
|
|
47
|
+
case "succeeded":
|
|
48
|
+
return chalk.dim(status);
|
|
49
|
+
case "failed":
|
|
50
|
+
case "canceled":
|
|
51
|
+
case "cancelled":
|
|
52
|
+
return chalk.red(status);
|
|
53
|
+
default:
|
|
54
|
+
return chalk.dim(status ?? "-");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function str(value) {
|
|
58
|
+
if (typeof value === "string")
|
|
59
|
+
return value;
|
|
60
|
+
if (value == null)
|
|
61
|
+
return "";
|
|
62
|
+
return String(value);
|
|
63
|
+
}
|
|
64
|
+
function activityData(event) {
|
|
65
|
+
if (!event || typeof event !== "object")
|
|
66
|
+
return {};
|
|
67
|
+
const value = event;
|
|
68
|
+
if (value["type"] === "unknown" && typeof value["raw"] === "string") {
|
|
69
|
+
try {
|
|
70
|
+
return JSON.parse(value["raw"]);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return { type: "unknown", message: value["raw"] };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (value["data"] && typeof value["data"] === "object") {
|
|
77
|
+
return value["data"];
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
function isTerminalStatus(status) {
|
|
82
|
+
return (typeof status === "string" &&
|
|
83
|
+
["succeeded", "failed", "canceled", "cancelled"].includes(status.toLowerCase()));
|
|
84
|
+
}
|
|
85
|
+
function sleep(ms) {
|
|
86
|
+
if (ms <= 0)
|
|
87
|
+
return Promise.resolve();
|
|
88
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
89
|
+
}
|
|
90
|
+
async function waitForRun(id, timeoutSec) {
|
|
91
|
+
const deadline = Date.now() + timeoutSec * 1000;
|
|
92
|
+
while (true) {
|
|
93
|
+
const data = unwrap(await client().apiGet(`/api/v1/runs/${enc(id)}`));
|
|
94
|
+
if (isTerminalStatus(data.status))
|
|
95
|
+
return data;
|
|
96
|
+
if (Date.now() >= deadline) {
|
|
97
|
+
throw new Error(`Timed out waiting for run ${id}`);
|
|
98
|
+
}
|
|
99
|
+
await sleep(Math.min(2000, Math.max(0, deadline - Date.now())));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export function register(program) {
|
|
103
|
+
const command = program
|
|
104
|
+
.command("runs")
|
|
105
|
+
.description("List, inspect, and cancel runs");
|
|
106
|
+
command
|
|
107
|
+
.command("list")
|
|
108
|
+
.description("List runs")
|
|
109
|
+
.option("--sandbox <id>", "Filter by sandbox ID")
|
|
110
|
+
.option("--computer <id>", "Filter by computer ID")
|
|
111
|
+
.option("--workspace <id>", "Filter by workspace ID")
|
|
112
|
+
.option("--project <id>", "Filter by project ID")
|
|
113
|
+
.option("--external-workspace <id>", "Filter by white-label workspace/customer ID")
|
|
114
|
+
.option("--external-user <id>", "Filter by white-label user ID")
|
|
115
|
+
.option("--external-project <id>", "Filter by white-label project ID")
|
|
116
|
+
.option("--target-kind <kind>", "Filter by target kind")
|
|
117
|
+
.option("--target-id <id>", "Filter by target ID")
|
|
118
|
+
.option("--status <status>", "Filter by run status")
|
|
119
|
+
.option("--limit <n>", "Maximum runs to return")
|
|
120
|
+
.option("--json", "Output as JSON")
|
|
121
|
+
.action((opts) => runAction(async () => {
|
|
122
|
+
if ((opts.sandbox || opts.computer) && (opts.targetKind || opts.targetId)) {
|
|
123
|
+
throw new Error("Use either --sandbox/--computer or --target-kind/--target-id, not both.");
|
|
124
|
+
}
|
|
125
|
+
if (opts.sandbox && opts.computer) {
|
|
126
|
+
throw new Error("Use only one of --sandbox or --computer.");
|
|
127
|
+
}
|
|
128
|
+
const query = new URLSearchParams();
|
|
129
|
+
if (opts.workspace)
|
|
130
|
+
query.set("workspace_id", opts.workspace);
|
|
131
|
+
if (opts.project)
|
|
132
|
+
query.set("project_id", opts.project);
|
|
133
|
+
if (opts.externalWorkspace)
|
|
134
|
+
query.set("external_workspace_id", opts.externalWorkspace);
|
|
135
|
+
if (opts.externalUser)
|
|
136
|
+
query.set("external_user_id", opts.externalUser);
|
|
137
|
+
if (opts.externalProject)
|
|
138
|
+
query.set("external_project_id", opts.externalProject);
|
|
139
|
+
if (opts.sandbox) {
|
|
140
|
+
query.set("target_kind", "sandbox");
|
|
141
|
+
query.set("target_id", opts.sandbox);
|
|
142
|
+
}
|
|
143
|
+
if (opts.computer) {
|
|
144
|
+
query.set("target_kind", "computer");
|
|
145
|
+
query.set("target_id", opts.computer);
|
|
146
|
+
}
|
|
147
|
+
if (opts.targetKind)
|
|
148
|
+
query.set("target_kind", opts.targetKind);
|
|
149
|
+
if (opts.targetId)
|
|
150
|
+
query.set("target_id", opts.targetId);
|
|
151
|
+
if (opts.status)
|
|
152
|
+
query.set("status", opts.status);
|
|
153
|
+
if (opts.limit)
|
|
154
|
+
query.set("limit", opts.limit);
|
|
155
|
+
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
156
|
+
const data = rows(unwrap(await client().apiGet(`/api/v1/runs${suffix}`)));
|
|
157
|
+
if (isJsonMode(opts)) {
|
|
158
|
+
console.log(JSON.stringify(data, null, 2));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (data.length === 0) {
|
|
162
|
+
console.log(chalk.dim("No runs found."));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
renderTable(data, [
|
|
166
|
+
{ header: "ID", key: "id", width: 18 },
|
|
167
|
+
{ header: "TARGET", key: (row) => `${str(row.target_kind)} ${str(row.target_id)}`, width: 28 },
|
|
168
|
+
{
|
|
169
|
+
header: "EXTERNAL",
|
|
170
|
+
key: (row) => [
|
|
171
|
+
str(row.external_workspace_id),
|
|
172
|
+
str(row.external_user_id),
|
|
173
|
+
str(row.external_project_id),
|
|
174
|
+
]
|
|
175
|
+
.filter(Boolean)
|
|
176
|
+
.join(" / "),
|
|
177
|
+
width: 30,
|
|
178
|
+
},
|
|
179
|
+
{ header: "RUNNER", key: "runner", width: 12 },
|
|
180
|
+
{ header: "STATUS", key: (row) => colorStatus(row.status), width: 12 },
|
|
181
|
+
{ header: "INSTRUCTION", key: (row) => str(row.instruction), width: 44 },
|
|
182
|
+
]);
|
|
183
|
+
}));
|
|
184
|
+
command
|
|
185
|
+
.command("show <id>")
|
|
186
|
+
.description("Show one run")
|
|
187
|
+
.option("--json", "Output as JSON")
|
|
188
|
+
.action((id, opts) => runAction(async () => {
|
|
189
|
+
const data = unwrap(await client().apiGet(`/api/v1/runs/${enc(id)}`));
|
|
190
|
+
console.log(JSON.stringify(data, null, 2));
|
|
191
|
+
}));
|
|
192
|
+
command
|
|
193
|
+
.command("outputs <id>")
|
|
194
|
+
.description("Show all outputs for a run")
|
|
195
|
+
.option("--json", "Output as JSON")
|
|
196
|
+
.action((id, _opts) => runAction(async () => {
|
|
197
|
+
const data = unwrap(await client().apiGet(`/api/v1/runs/${enc(id)}/outputs`));
|
|
198
|
+
console.log(JSON.stringify(data, null, 2));
|
|
199
|
+
}));
|
|
200
|
+
command
|
|
201
|
+
.command("files <id>")
|
|
202
|
+
.description("List files produced by a run")
|
|
203
|
+
.option("--json", "Output as JSON")
|
|
204
|
+
.action((id, opts) => runAction(async () => {
|
|
205
|
+
const data = fileRows(unwrap(await client().apiGet(`/api/v1/runs/${enc(id)}/files`)));
|
|
206
|
+
if (isJsonMode(opts)) {
|
|
207
|
+
console.log(JSON.stringify(data, null, 2));
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (data.length === 0) {
|
|
211
|
+
console.log(chalk.dim("No files found."));
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
renderTable(data, [
|
|
215
|
+
{ header: "ID", key: "id", width: 18 },
|
|
216
|
+
{ header: "KIND", key: "kind", width: 10 },
|
|
217
|
+
{ header: "MIME", key: "mime_type", width: 24 },
|
|
218
|
+
{ header: "SIZE", key: (row) => str(row.size_bytes ?? "-"), width: 10 },
|
|
219
|
+
{ header: "PATH", key: (row) => str(row.path), width: 56 },
|
|
220
|
+
]);
|
|
221
|
+
}));
|
|
222
|
+
command
|
|
223
|
+
.command("activity <id>")
|
|
224
|
+
.description("Show or stream run activity")
|
|
225
|
+
.option("--stream", "Keep the connection open and stream new events")
|
|
226
|
+
.option("--limit <n>", "Stop after N streamed events")
|
|
227
|
+
.option("--json", "Output as JSON")
|
|
228
|
+
.action((id, opts) => runAction(async () => {
|
|
229
|
+
const path = `/api/v1/runs/${enc(id)}/activity`;
|
|
230
|
+
if (opts.stream) {
|
|
231
|
+
const limit = opts.limit ? Number(opts.limit) : undefined;
|
|
232
|
+
let seen = 0;
|
|
233
|
+
const res = await client().apiStream(path);
|
|
234
|
+
for await (const event of parseSse(res.body)) {
|
|
235
|
+
seen += 1;
|
|
236
|
+
const data = activityData(event);
|
|
237
|
+
if (isJsonMode(opts)) {
|
|
238
|
+
console.log(JSON.stringify(data, null, 2));
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
console.log([
|
|
242
|
+
chalk.dim(str(data.sequence ?? seen)),
|
|
243
|
+
colorStatus(data.type),
|
|
244
|
+
str(data.run_id ?? id),
|
|
245
|
+
str(data.message),
|
|
246
|
+
]
|
|
247
|
+
.filter(Boolean)
|
|
248
|
+
.join(" "));
|
|
249
|
+
}
|
|
250
|
+
if (limit && seen >= limit)
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const data = eventRows(unwrap(await client().apiGet(path)));
|
|
256
|
+
if (isJsonMode(opts)) {
|
|
257
|
+
console.log(JSON.stringify(data, null, 2));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (data.length === 0) {
|
|
261
|
+
console.log(chalk.dim("No run activity found."));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
renderTable(data, [
|
|
265
|
+
{ header: "SEQ", key: (row) => str(row.sequence ?? "-"), width: 8 },
|
|
266
|
+
{ header: "TYPE", key: (row) => colorStatus(row.type), width: 18 },
|
|
267
|
+
{ header: "MESSAGE", key: (row) => str(row.message ?? ""), width: 56 },
|
|
268
|
+
]);
|
|
269
|
+
}));
|
|
270
|
+
command
|
|
271
|
+
.command("messages <id>")
|
|
272
|
+
.description("Show run messages")
|
|
273
|
+
.option("--json", "Output as JSON")
|
|
274
|
+
.action((id, _opts) => runAction(async () => {
|
|
275
|
+
const data = unwrap(await client().apiGet(`/api/v1/runs/${enc(id)}/messages`));
|
|
276
|
+
console.log(JSON.stringify(data, null, 2));
|
|
277
|
+
}));
|
|
278
|
+
command
|
|
279
|
+
.command("command-output <id>")
|
|
280
|
+
.description("Show run command output")
|
|
281
|
+
.option("--json", "Output as JSON")
|
|
282
|
+
.action((id, _opts) => runAction(async () => {
|
|
283
|
+
const data = unwrap(await client().apiGet(`/api/v1/runs/${enc(id)}/command-output`));
|
|
284
|
+
console.log(JSON.stringify(data, null, 2));
|
|
285
|
+
}));
|
|
286
|
+
command
|
|
287
|
+
.command("previews <id>")
|
|
288
|
+
.description("Show run previews")
|
|
289
|
+
.option("--json", "Output as JSON")
|
|
290
|
+
.action((id, _opts) => runAction(async () => {
|
|
291
|
+
const data = unwrap(await client().apiGet(`/api/v1/runs/${enc(id)}/previews`));
|
|
292
|
+
console.log(JSON.stringify(data, null, 2));
|
|
293
|
+
}));
|
|
294
|
+
command
|
|
295
|
+
.command("diagnostics <id>")
|
|
296
|
+
.description("Show run diagnostics")
|
|
297
|
+
.option("--json", "Output as JSON")
|
|
298
|
+
.action((id, _opts) => runAction(async () => {
|
|
299
|
+
const data = unwrap(await client().apiGet(`/api/v1/runs/${enc(id)}/diagnostics`));
|
|
300
|
+
console.log(JSON.stringify(data, null, 2));
|
|
301
|
+
}));
|
|
302
|
+
command
|
|
303
|
+
.command("wait <id>")
|
|
304
|
+
.description("Wait for a run to reach a terminal state")
|
|
305
|
+
.option("--timeout <seconds>", "Maximum seconds to wait", "900")
|
|
306
|
+
.option("--json", "Output as JSON")
|
|
307
|
+
.action((id, opts) => runAction(async () => {
|
|
308
|
+
const data = await waitForRun(id, Number(opts.timeout ?? 900));
|
|
309
|
+
if (isJsonMode(opts)) {
|
|
310
|
+
console.log(JSON.stringify(data, null, 2));
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
console.log(`${chalk.green("Run finished")} ${id} ${colorStatus(data.status)}`);
|
|
314
|
+
}));
|
|
315
|
+
command
|
|
316
|
+
.command("download-file <id> <file-id>")
|
|
317
|
+
.description("Download a run file to a local file or stdout")
|
|
318
|
+
.option("--output <file>", "Write to this local file instead of stdout")
|
|
319
|
+
.option("--inline", "Ask the API for inline disposition metadata")
|
|
320
|
+
.option("--json", "Output as JSON metadata")
|
|
321
|
+
.action((id, fileId, opts) => runAction(async () => {
|
|
322
|
+
const query = new URLSearchParams();
|
|
323
|
+
if (opts.inline)
|
|
324
|
+
query.set("disposition", "inline");
|
|
325
|
+
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
326
|
+
const bytes = await client().apiGetBinary(apiPath(`/runs/${enc(id)}/files/${enc(fileId)}/download${suffix}`));
|
|
327
|
+
if (opts.output) {
|
|
328
|
+
fs.writeFileSync(opts.output, bytes);
|
|
329
|
+
if (isJsonMode(opts)) {
|
|
330
|
+
console.log(JSON.stringify({
|
|
331
|
+
run_id: id,
|
|
332
|
+
file_id: fileId,
|
|
333
|
+
output: opts.output,
|
|
334
|
+
bytes: bytes.length,
|
|
335
|
+
}, null, 2));
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
console.log(chalk.green(`Downloaded file ${fileId} → ${opts.output}`));
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (isJsonMode(opts)) {
|
|
342
|
+
console.log(JSON.stringify({
|
|
343
|
+
run_id: id,
|
|
344
|
+
file_id: fileId,
|
|
345
|
+
bytes: bytes.length,
|
|
346
|
+
content_base64: bytes.toString("base64"),
|
|
347
|
+
}, null, 2));
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
process.stdout.write(bytes);
|
|
351
|
+
}));
|
|
352
|
+
command
|
|
353
|
+
.command("cancel <id>")
|
|
354
|
+
.description("Cancel a run")
|
|
355
|
+
.option("--json", "Output as JSON")
|
|
356
|
+
.action((id, opts) => runAction(async () => {
|
|
357
|
+
const data = unwrap(await client().apiPost(`/api/v1/runs/${enc(id)}/cancel`, {}));
|
|
358
|
+
if (isJsonMode(opts)) {
|
|
359
|
+
console.log(JSON.stringify(data, null, 2));
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
console.log(chalk.green(`Canceled run ${id}`));
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
365
|
+
//# sourceMappingURL=runs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../src/commands/runs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,OAAO,EACP,MAAM,EACN,GAAG,EACH,SAAS,EACT,MAAM,GAEP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAoC7C,SAAS,IAAI,CAAC,GAAY;IACxB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAY,CAAC;IAC5C,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,GAA8B,CAAC;QAC7C,KAAK,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YAC5C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC,GAAG,CAAU,CAAC;QAC5D,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,SAAS,CAAC,GAAY;IAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAoB,CAAC;IACpD,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,GAA8B,CAAC;QAC7C,K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AAE,CAAC;YACrB,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CACZ;gBACE,MAAM,EAAE,EAAE;gBACV,OAAO,EAAE,MAAM;gBACf,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;aACzC,EACD,IAAI,EACJ,CAAC,CACF,CACF,CAAC;YACF,OAAO;QACT,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CACL,CAAC;IAEJ,OAAO;SACJ,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,cAAc,CAAC;SAC3B,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,CAAC,EAAU,EAAE,IAAiB,EAAE,EAAE,CACxC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,IAAI,GAAG,MAAM,CACjB,MAAM,MAAM,EAAE,CAAC,OAAO,CACpB,gBAAgB,GAAG,CAAC,EAAE,CAAC,SAAS,EAChC,EAAE,CACH,CACF,CAAC;QACF,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
package/dist/commands/sandbox.js
CHANGED
|
@@ -373,19 +373,19 @@ export function register(program) {
|
|
|
373
373
|
}
|
|
374
374
|
}));
|
|
375
375
|
registerSandboxConnectorCommands(sandbox);
|
|
376
|
-
//
|
|
377
|
-
// Implemented through
|
|
376
|
+
// run-agent - invoke an in-Sandbox AI runner CLI.
|
|
377
|
+
// Implemented through Runs so callers get a stable run response while
|
|
378
378
|
// execution still happens inside the remote filesystem.
|
|
379
379
|
sandbox
|
|
380
|
-
.command("
|
|
380
|
+
.command("run-agent <sandbox-id> <instruction...>")
|
|
381
381
|
.description("Run an in-Sandbox AI agent runtime with the given instruction")
|
|
382
|
-
.option("--
|
|
383
|
-
.option("--runtime-command <command>", "Executable command for --
|
|
382
|
+
.option("--runner <name>", "Runner: claude (default), claude-code, codex, pi, hermes, osa, custom")
|
|
383
|
+
.option("--runtime-command <command>", "Executable command for --runner custom, e.g. 'hermes-agent run'")
|
|
384
384
|
.option("--model <name>", "Provider-specific model name")
|
|
385
385
|
.option("--connector <uid>", "MIOSA Connect connector UID to preflight before running the agent")
|
|
386
386
|
.option("--preflight", "Verify the Sandbox has the requested provider connector before exec")
|
|
387
387
|
.option("--cwd <path>", "Working directory inside the Sandbox")
|
|
388
|
-
.option("--env <KEY=VALUE>", "Environment variable for the
|
|
388
|
+
.option("--env <KEY=VALUE>", "Environment variable for the run. Repeatable.", collectOption, [])
|
|
389
389
|
.option("--agent-profile <id>", "Agent runtime profile ID")
|
|
390
390
|
.option("--skip-agent-profile", "Do not apply the default agent runtime profile")
|
|
391
391
|
.option("--external-workspace <id>", "White-label workspace/customer ID for billing attribution")
|
|
@@ -394,17 +394,17 @@ export function register(program) {
|
|
|
394
394
|
.option("--timeout <sec>", "Exec timeout in seconds", parseIntegerOption)
|
|
395
395
|
.option("--json", "Output as JSON")
|
|
396
396
|
.action((id, words, opts) => runAction(async () => {
|
|
397
|
-
const
|
|
398
|
-
if (!
|
|
399
|
-
const
|
|
400
|
-
throw new Error(`Unsupported
|
|
397
|
+
const runner = opts.runner ?? "claude";
|
|
398
|
+
if (!isSupportedRunAgentRunner(runner)) {
|
|
399
|
+
const allowedRunners = supportedRunAgentRunners();
|
|
400
|
+
throw new Error(`Unsupported runner "${runner}". Use: ${allowedRunners.join(", ")}`);
|
|
401
401
|
}
|
|
402
|
-
if (opts.runtimeCommand &&
|
|
403
|
-
throw new Error("--runtime-command can only be used with --
|
|
402
|
+
if (opts.runtimeCommand && runner !== "custom") {
|
|
403
|
+
throw new Error("--runtime-command can only be used with --runner custom");
|
|
404
404
|
}
|
|
405
405
|
if (opts.connector || opts.preflight) {
|
|
406
406
|
await preflightSandboxConnector(id, {
|
|
407
|
-
provider,
|
|
407
|
+
provider: runner,
|
|
408
408
|
connector: opts.connector,
|
|
409
409
|
model: opts.model,
|
|
410
410
|
cwd: opts.cwd,
|
|
@@ -414,8 +414,8 @@ export function register(program) {
|
|
|
414
414
|
const body = {
|
|
415
415
|
target_kind: "sandbox",
|
|
416
416
|
target_id: id,
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
runner,
|
|
418
|
+
instruction,
|
|
419
419
|
};
|
|
420
420
|
if (opts.runtimeCommand)
|
|
421
421
|
body["command"] = opts.runtimeCommand;
|
|
@@ -443,7 +443,7 @@ export function register(program) {
|
|
|
443
443
|
}
|
|
444
444
|
if (opts.timeout != null)
|
|
445
445
|
body["timeout"] = opts.timeout;
|
|
446
|
-
const run = unwrap(await client().apiPost(apiPath("/
|
|
446
|
+
const run = unwrap(await client().apiPost(apiPath("/runs"), body));
|
|
447
447
|
if (isJsonMode(opts)) {
|
|
448
448
|
console.log(JSON.stringify(run, null, 2));
|
|
449
449
|
return;
|
|
@@ -452,7 +452,7 @@ export function register(program) {
|
|
|
452
452
|
console.log(kvPanel([
|
|
453
453
|
{ label: "Run", value: chalk.bold(str(run["id"])) },
|
|
454
454
|
{ label: "Target", value: `${str(run["target_kind"])} ${id}` },
|
|
455
|
-
{ label: "
|
|
455
|
+
{ label: "Runner", value: str(run["runner"]) },
|
|
456
456
|
{ label: "Status", value: statusColor(str(run["status"])) },
|
|
457
457
|
{ label: "Exit", value: str(run["exit_code"]) },
|
|
458
458
|
]));
|
|
@@ -780,7 +780,7 @@ export function register(program) {
|
|
|
780
780
|
.option("--environment <name>", "Target environment label", "production")
|
|
781
781
|
.option("--build-command <cmd>", "Build command to run before publishing")
|
|
782
782
|
.option("--run-command <cmd>", "Run command for dynamic/server deployments")
|
|
783
|
-
.option("--docker-deploy", "Publish onto the workspace
|
|
783
|
+
.option("--docker-deploy", "Publish onto the workspace App Engine runtime instead of standard app hosting")
|
|
784
784
|
.option("--domain <domain>", "Custom domain to attach")
|
|
785
785
|
.option("--deployment-type <type>", "Deployment runtime type: miosa_deploy, docker_deploy, dynamic, static")
|
|
786
786
|
.option("--database <mode>", "none, create:postgres, postgres, or existing:<db-id>")
|
|
@@ -3202,7 +3202,7 @@ function commandInCwd(command, cwd) {
|
|
|
3202
3202
|
return command;
|
|
3203
3203
|
return `cd ${shellQuote(cwd)} && ${command}`;
|
|
3204
3204
|
}
|
|
3205
|
-
function
|
|
3205
|
+
function supportedRunAgentRunners() {
|
|
3206
3206
|
return [
|
|
3207
3207
|
"claude",
|
|
3208
3208
|
"claude-code",
|
|
@@ -3213,11 +3213,11 @@ function supportedPromptProviders() {
|
|
|
3213
3213
|
"custom",
|
|
3214
3214
|
];
|
|
3215
3215
|
}
|
|
3216
|
-
function
|
|
3217
|
-
const normalized =
|
|
3216
|
+
function runtimeCommandForRunner(runner, runtimeCommand) {
|
|
3217
|
+
const normalized = runner.trim().toLowerCase();
|
|
3218
3218
|
if (normalized === "custom") {
|
|
3219
3219
|
if (!runtimeCommand?.trim()) {
|
|
3220
|
-
throw new Error("--
|
|
3220
|
+
throw new Error("--runner custom requires --runtime-command, e.g. --runtime-command 'hermes-agent run'");
|
|
3221
3221
|
}
|
|
3222
3222
|
return runtimeCommand.trim();
|
|
3223
3223
|
}
|
|
@@ -3231,8 +3231,8 @@ function runtimeCommandForProvider(provider, runtimeCommand) {
|
|
|
3231
3231
|
};
|
|
3232
3232
|
return builtIns[normalized] ?? null;
|
|
3233
3233
|
}
|
|
3234
|
-
function
|
|
3235
|
-
return
|
|
3234
|
+
function isSupportedRunAgentRunner(runner) {
|
|
3235
|
+
return supportedRunAgentRunners().includes(runner.trim().toLowerCase());
|
|
3236
3236
|
}
|
|
3237
3237
|
function backgroundCommand(command) {
|
|
3238
3238
|
if (!command.trim())
|
|
@@ -3375,11 +3375,11 @@ function openUrl(url) {
|
|
|
3375
3375
|
const child = spawn(command, args, { detached: true, stdio: "ignore" });
|
|
3376
3376
|
child.unref();
|
|
3377
3377
|
}
|
|
3378
|
-
//
|
|
3378
|
+
// Sandbox render helpers
|
|
3379
3379
|
/** Coerce an unknown API field to a display string. */
|
|
3380
3380
|
function str(v) {
|
|
3381
3381
|
if (v === null || v === undefined)
|
|
3382
|
-
return chalk.dim("
|
|
3382
|
+
return chalk.dim("-");
|
|
3383
3383
|
return String(v);
|
|
3384
3384
|
}
|
|
3385
3385
|
function stringOrNull(v) {
|