@miosa/cli 1.0.91 → 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.
Files changed (63) hide show
  1. package/CHANGELOG.md +12 -4
  2. package/README.md +23 -60
  3. package/dist/app-advisor.js +6 -6
  4. package/dist/app-advisor.js.map +1 -1
  5. package/dist/bin/miosa.js +2 -4
  6. package/dist/bin/miosa.js.map +1 -1
  7. package/dist/client.d.ts +1 -1
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +22 -3
  10. package/dist/client.js.map +1 -1
  11. package/dist/commands/agent.d.ts +10 -10
  12. package/dist/commands/agent.js +47 -47
  13. package/dist/commands/agent.js.map +1 -1
  14. package/dist/commands/app.js +1 -1
  15. package/dist/commands/app.js.map +1 -1
  16. package/dist/commands/capabilities.d.ts.map +1 -1
  17. package/dist/commands/capabilities.js +71 -98
  18. package/dist/commands/capabilities.js.map +1 -1
  19. package/dist/commands/completion.d.ts.map +1 -1
  20. package/dist/commands/completion.js +1 -12
  21. package/dist/commands/completion.js.map +1 -1
  22. package/dist/commands/computers.d.ts.map +1 -1
  23. package/dist/commands/computers.js +95 -44
  24. package/dist/commands/computers.js.map +1 -1
  25. package/dist/commands/connectors.d.ts.map +1 -1
  26. package/dist/commands/connectors.js +1 -509
  27. package/dist/commands/connectors.js.map +1 -1
  28. package/dist/commands/deploy.d.ts.map +1 -1
  29. package/dist/commands/deploy.js +196 -150
  30. package/dist/commands/deploy.js.map +1 -1
  31. package/dist/commands/devices.d.ts.map +1 -1
  32. package/dist/commands/devices.js +53 -428
  33. package/dist/commands/devices.js.map +1 -1
  34. package/dist/commands/docker-deploy.d.ts.map +1 -1
  35. package/dist/commands/docker-deploy.js +58 -22
  36. package/dist/commands/docker-deploy.js.map +1 -1
  37. package/dist/commands/doctor.d.ts +0 -7
  38. package/dist/commands/doctor.d.ts.map +1 -1
  39. package/dist/commands/doctor.js +23 -28
  40. package/dist/commands/doctor.js.map +1 -1
  41. package/dist/commands/mcp.d.ts.map +1 -1
  42. package/dist/commands/mcp.js +8 -106
  43. package/dist/commands/mcp.js.map +1 -1
  44. package/dist/commands/run-groups.d.ts +3 -0
  45. package/dist/commands/run-groups.d.ts.map +1 -0
  46. package/dist/commands/run-groups.js +364 -0
  47. package/dist/commands/run-groups.js.map +1 -0
  48. package/dist/commands/runs.d.ts +3 -0
  49. package/dist/commands/runs.d.ts.map +1 -0
  50. package/dist/commands/runs.js +365 -0
  51. package/dist/commands/runs.js.map +1 -0
  52. package/dist/commands/sandbox.d.ts.map +1 -1
  53. package/dist/commands/sandbox.js +63 -199
  54. package/dist/commands/sandbox.js.map +1 -1
  55. package/dist/commands/status.js +1 -1
  56. package/dist/commands/status.js.map +1 -1
  57. package/dist/commands/workspaces.d.ts.map +1 -1
  58. package/dist/commands/workspaces.js +0 -47
  59. package/dist/commands/workspaces.js.map +1 -1
  60. package/dist/types.d.ts +11 -0
  61. package/dist/types.d.ts.map +1 -1
  62. package/dist/types.js.map +1 -1
  63. package/package.json +1 -1
@@ -1799,13 +1799,8 @@ async function dispatchTool(client, name, args) {
1799
1799
  if (name === "computer_screenshot") {
1800
1800
  if (!cid)
1801
1801
  return err("computer_id is required");
1802
- const result = await client.apiGet(`/api/v1/computers/${encodeURIComponent(cid)}/desktop/screenshot`);
1803
- // The API returns { data: { image: "<base64>", format: "png" } }
1804
- const data = unwrapData(result);
1805
- const b64 = typeof data["image"] === "string" ? data["image"] : null;
1806
- if (!b64)
1807
- return err("Screenshot API returned no image data");
1808
- return image(Buffer.from(b64, "base64"));
1802
+ const png = await client.apiGetBinary(`/api/v1/computers/${encodeURIComponent(cid)}/desktop/screenshot`);
1803
+ return image(png);
1809
1804
  }
1810
1805
  // ── Pointer ───────────────────────────────────────────────────────────
1811
1806
  if (name === "computer_click") {
@@ -2677,15 +2672,7 @@ async function dispatchTool(client, name, args) {
2677
2672
  const result = await client.apiPost(`/api/v1/sandboxes/${encodeURIComponent(sid)}/expose`, body);
2678
2673
  const data = unwrapData(result);
2679
2674
  const url = data["url"] ?? data["preview_url"] ?? "";
2680
- const urlClass = data["url_class"] ?? data["class"] ?? "temporary_preview";
2681
- const stable = data["stable_for_embedding"] === true;
2682
- const nextAction = data["recommended_next_action"] ?? "create_alias_or_publish";
2683
- return ok([
2684
- `preview_url: ${url}`,
2685
- `url_class: ${urlClass}`,
2686
- `stable_for_embedding: ${stable}`,
2687
- `recommended_next_action: ${nextAction}`,
2688
- ].join("\n"));
2675
+ return ok(`Preview URL: ${url}`);
2689
2676
  }
2690
2677
  // ── Sandbox deploy ────────────────────────────────────────────────────
2691
2678
  if (name === "sandbox_deploy") {
@@ -2705,16 +2692,7 @@ async function dispatchTool(client, name, args) {
2705
2692
  const data = unwrapData(result);
2706
2693
  const deployId = data["id"] ?? data["deployment_id"] ?? "unknown";
2707
2694
  const url = data["url"] ?? data["preview_url"] ?? "";
2708
- const urlClass = data["url_class"] ?? data["class"] ?? "durable_deployment";
2709
- const stable = data["stable_for_embedding"] !== false;
2710
- const nextAction = data["recommended_next_action"] ?? "attach_custom_domain";
2711
- return ok([
2712
- `deployment_id: ${deployId}`,
2713
- `url: ${url}`,
2714
- `url_class: ${urlClass}`,
2715
- `stable_for_embedding: ${stable}`,
2716
- `recommended_next_action: ${nextAction}`,
2717
- ].join("\n"));
2695
+ return ok(`Deployed sandbox ${sid} (deployment id=${deployId}, url=${url}).`);
2718
2696
  }
2719
2697
  // ── Sandbox templates ─────────────────────────────────────────────────
2720
2698
  if (name === "sandbox_template_list") {
@@ -3316,51 +3294,6 @@ function wireClaudeCode(apiKey, remoteUrl, scope) {
3316
3294
  }
3317
3295
  return { ok: true };
3318
3296
  }
3319
- function wireClaudeCodeLocal(scope) {
3320
- // `claude mcp remove` first so re-running install replaces cleanly.
3321
- spawnSync("claude", ["mcp", "remove", MCP_SERVER_NAME, "--scope", scope], {
3322
- stdio: "ignore",
3323
- });
3324
- const result = spawnSync("claude", ["mcp", "add", "--scope", scope, MCP_SERVER_NAME, "miosa", "mcp", "serve"], { stdio: "pipe", encoding: "utf8" });
3325
- if (result.error) {
3326
- return {
3327
- ok: false,
3328
- reason: `Could not run \`claude\` CLI: ${result.error.message}`,
3329
- };
3330
- }
3331
- if (typeof result.status === "number" && result.status !== 0) {
3332
- return {
3333
- ok: false,
3334
- reason: result.stderr?.trim() || `claude mcp add exited ${result.status}`,
3335
- };
3336
- }
3337
- return { ok: true };
3338
- }
3339
- function printLocalSnippet(client) {
3340
- console.log();
3341
- console.log(chalk.bold("Manual local MCP install snippet"));
3342
- console.log(chalk.dim(" Requires `miosa login` or MIOSA_API_KEY in the MCP environment."));
3343
- console.log();
3344
- if (client === "cursor") {
3345
- console.log(chalk.dim(" Add to ~/.cursor/mcp.json:"));
3346
- console.log();
3347
- console.log(JSON.stringify({
3348
- mcpServers: {
3349
- miosa: {
3350
- command: "miosa",
3351
- args: ["mcp", "serve"],
3352
- },
3353
- },
3354
- }, null, 2));
3355
- return;
3356
- }
3357
- if (client === "gemini") {
3358
- console.log(` ${chalk.cyan(`gemini mcp add ${MCP_SERVER_NAME} miosa mcp serve`)}`);
3359
- return;
3360
- }
3361
- // claude / manual
3362
- console.log(` ${chalk.cyan(`claude mcp add --scope user ${MCP_SERVER_NAME} miosa mcp serve`)}`);
3363
- }
3364
3297
  function printManualSnippet(client, apiKey, remoteUrl) {
3365
3298
  const masked = apiKey.length > 12
3366
3299
  ? apiKey.slice(0, 6) + "…" + apiKey.slice(-4)
@@ -3396,32 +3329,7 @@ function printManualSnippet(client, apiKey, remoteUrl) {
3396
3329
  async function runInstall(opts) {
3397
3330
  const config = loadConfig();
3398
3331
  const clientName = `MIOSA MCP (${opts.client === "manual" ? "manual" : opts.client})`;
3399
- console.log(chalk.bold("MIOSA MCP installer"), chalk.dim(opts.mode === "local"
3400
- ? `— wiring ${opts.client} → local miosa mcp serve`
3401
- : `— wiring ${opts.client} → ${opts.remoteUrl}`));
3402
- if (opts.mode === "local") {
3403
- if (opts.client === "claude") {
3404
- const wired = wireClaudeCodeLocal(opts.scope);
3405
- if (wired.ok) {
3406
- console.log();
3407
- console.log(chalk.green("✓"), `MCP server '${MCP_SERVER_NAME}' added to Claude Code (${opts.scope} scope).`);
3408
- console.log();
3409
- console.log(chalk.dim("Verify:"));
3410
- console.log(` ${chalk.cyan("claude mcp list")}`);
3411
- console.log();
3412
- console.log(chalk.dim("Try in a fresh Claude Code session:"));
3413
- console.log(chalk.dim(` "Create a MIOSA sandbox, run \`python -c 'print(2+2)'\`, then destroy it."`));
3414
- return;
3415
- }
3416
- console.log();
3417
- console.log(chalk.yellow("!"), `Could not auto-wire Claude Code: ${wired.reason}`);
3418
- console.log(chalk.yellow(" Falling back to manual snippet:"));
3419
- printLocalSnippet("claude");
3420
- return;
3421
- }
3422
- printLocalSnippet(opts.client);
3423
- return;
3424
- }
3332
+ console.log(chalk.bold("MIOSA MCP installer"), chalk.dim(`— wiring ${opts.client} ${opts.remoteUrl}`));
3425
3333
  const apiKey = await runDeviceFlow(config.endpoint, clientName);
3426
3334
  if (opts.client === "claude") {
3427
3335
  const wired = wireClaudeCode(apiKey, opts.remoteUrl, opts.scope);
@@ -3462,23 +3370,17 @@ export function register(program) {
3462
3370
  });
3463
3371
  mcp
3464
3372
  .command("install")
3465
- .description("Install MIOSA MCP into your AI client. Defaults to the local `miosa mcp serve` stdio server.")
3373
+ .description("Install the hosted MIOSA MCP server (https://api.miosa.ai/api/v1/mcp) into your AI client. Opens a browser to log in and wire your account.")
3466
3374
  .option("-c, --client <client>", "Which AI client to wire: claude (default), cursor, gemini, manual", "claude")
3467
3375
  .option("-s, --scope <scope>", "Claude Code config scope: local, user (default), or project", "user")
3468
- .option("--url <url>", "Hosted MCP URL used with --remote (default: https://api.miosa.ai/api/v1/mcp)", MCP_REMOTE_URL)
3469
- .option("--remote", "Install the hosted HTTP MCP server instead of the local stdio server", false)
3376
+ .option("--url <url>", "Override the hosted MCP URL (default: https://api.miosa.ai/api/v1/mcp)", MCP_REMOTE_URL)
3470
3377
  .action(async (opts) => {
3471
3378
  const client = (["claude", "cursor", "gemini", "manual"].includes(opts.client)
3472
3379
  ? opts.client
3473
3380
  : "claude");
3474
3381
  const scope = (["local", "user", "project"].includes(opts.scope) ? opts.scope : "user");
3475
3382
  try {
3476
- await runInstall({
3477
- client,
3478
- scope,
3479
- mode: opts.remote ? "remote" : "local",
3480
- remoteUrl: opts.url,
3481
- });
3383
+ await runInstall({ client, scope, remoteUrl: opts.url });
3482
3384
  }
3483
3385
  catch (e) {
3484
3386
  const msg = e instanceof Error ? e.message : String(e);