@miosa/cli 1.0.5 → 1.0.7

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 (66) hide show
  1. package/dist/bin/miosa.js +8 -0
  2. package/dist/bin/miosa.js.map +1 -1
  3. package/dist/commands/checkpoints.d.ts.map +1 -1
  4. package/dist/commands/checkpoints.js +166 -6
  5. package/dist/commands/checkpoints.js.map +1 -1
  6. package/dist/commands/computers.d.ts.map +1 -1
  7. package/dist/commands/computers.js +166 -5
  8. package/dist/commands/computers.js.map +1 -1
  9. package/dist/commands/dashboard.d.ts +13 -0
  10. package/dist/commands/dashboard.d.ts.map +1 -0
  11. package/dist/commands/dashboard.js +54 -0
  12. package/dist/commands/dashboard.js.map +1 -0
  13. package/dist/commands/deploy.d.ts.map +1 -1
  14. package/dist/commands/deploy.js +134 -2
  15. package/dist/commands/deploy.js.map +1 -1
  16. package/dist/commands/doctor.d.ts.map +1 -1
  17. package/dist/commands/doctor.js +69 -25
  18. package/dist/commands/doctor.js.map +1 -1
  19. package/dist/commands/domains.d.ts.map +1 -1
  20. package/dist/commands/domains.js +118 -9
  21. package/dist/commands/domains.js.map +1 -1
  22. package/dist/commands/enterprise-util.d.ts.map +1 -1
  23. package/dist/commands/enterprise-util.js +14 -10
  24. package/dist/commands/enterprise-util.js.map +1 -1
  25. package/dist/commands/login.d.ts.map +1 -1
  26. package/dist/commands/login.js +89 -21
  27. package/dist/commands/login.js.map +1 -1
  28. package/dist/commands/logout.d.ts.map +1 -1
  29. package/dist/commands/logout.js +27 -4
  30. package/dist/commands/logout.js.map +1 -1
  31. package/dist/commands/logs.d.ts.map +1 -1
  32. package/dist/commands/logs.js +59 -1
  33. package/dist/commands/logs.js.map +1 -1
  34. package/dist/commands/mcp.d.ts.map +1 -1
  35. package/dist/commands/mcp.js +228 -1380
  36. package/dist/commands/mcp.js.map +1 -1
  37. package/dist/commands/menu.d.ts +16 -0
  38. package/dist/commands/menu.d.ts.map +1 -0
  39. package/dist/commands/menu.js +113 -0
  40. package/dist/commands/menu.js.map +1 -0
  41. package/dist/commands/network-policy.d.ts.map +1 -1
  42. package/dist/commands/network-policy.js +120 -5
  43. package/dist/commands/network-policy.js.map +1 -1
  44. package/dist/commands/sandbox.d.ts.map +1 -1
  45. package/dist/commands/sandbox.js +157 -5
  46. package/dist/commands/sandbox.js.map +1 -1
  47. package/dist/commands/whoami.d.ts.map +1 -1
  48. package/dist/commands/whoami.js +76 -19
  49. package/dist/commands/whoami.js.map +1 -1
  50. package/dist/tui/dashboard.d.ts +35 -0
  51. package/dist/tui/dashboard.d.ts.map +1 -0
  52. package/dist/tui/dashboard.js +191 -0
  53. package/dist/tui/dashboard.js.map +1 -0
  54. package/dist/tui/logs.d.ts +26 -0
  55. package/dist/tui/logs.d.ts.map +1 -0
  56. package/dist/tui/logs.js +276 -0
  57. package/dist/tui/logs.js.map +1 -0
  58. package/dist/ui/picker.d.ts +41 -0
  59. package/dist/ui/picker.d.ts.map +1 -0
  60. package/dist/ui/picker.js +77 -0
  61. package/dist/ui/picker.js.map +1 -0
  62. package/dist/ui/render.d.ts +91 -0
  63. package/dist/ui/render.d.ts.map +1 -0
  64. package/dist/ui/render.js +138 -0
  65. package/dist/ui/render.js.map +1 -0
  66. package/package.json +4 -1
@@ -58,15 +58,6 @@ const TOOL_LIST = [
58
58
  type: "string",
59
59
  description: "Your internal project ID for attribution (optional)",
60
60
  },
61
- gpu_model: {
62
- type: "string",
63
- description: "GPU model to attach (e.g. 'nvidia-a10g', 'nvidia-t4'). Omit for CPU-only.",
64
- },
65
- gpu_count: {
66
- type: "integer",
67
- description: "Number of GPUs to attach (default: 1 when gpu_model is set).",
68
- default: 1,
69
- },
70
61
  },
71
62
  required: ["name"],
72
63
  },
@@ -1316,971 +1307,368 @@ const TOOL_LIST = [
1316
1307
  },
1317
1308
  // Deployments
1318
1309
  {
1319
- name: "deployment_list",
1320
- description: "List all deployments in the tenant.",
1321
- inputSchema: { type: "object", properties: {} },
1322
- },
1323
- {
1324
- name: "deployment_get",
1325
- description: "Get details of a specific deployment.",
1326
- inputSchema: {
1327
- type: "object",
1328
- properties: {
1329
- deployment_id: { type: "string", description: "Deployment ID" },
1330
- },
1331
- required: ["deployment_id"],
1332
- },
1333
- },
1334
- {
1335
- name: "deployment_create",
1336
- description: "Create a new deployment.",
1337
- inputSchema: {
1338
- type: "object",
1339
- properties: {
1340
- name: { type: "string", description: "Deployment name" },
1341
- type: {
1342
- type: "string",
1343
- description: "Deployment type (e.g. web, worker)",
1344
- },
1345
- source: { type: "object", description: "Source configuration" },
1346
- env_vars: {
1347
- type: "object",
1348
- description: "Environment variables as key-value pairs",
1349
- },
1350
- region: { type: "string", description: "Deployment region (optional)" },
1351
- },
1352
- required: ["name"],
1353
- },
1310
+ name: 'deployment_list',
1311
+ description: 'List all deployments in the tenant.',
1312
+ inputSchema: { type: 'object', properties: {} },
1354
1313
  },
1355
1314
  {
1356
- name: "deployment_delete",
1357
- description: "Delete a deployment permanently.",
1315
+ name: 'deployment_get',
1316
+ description: 'Get details of a specific deployment.',
1358
1317
  inputSchema: {
1359
- type: "object",
1318
+ type: 'object',
1360
1319
  properties: {
1361
- deployment_id: {
1362
- type: "string",
1363
- description: "Deployment ID to delete",
1364
- },
1320
+ deployment_id: { type: 'string', description: 'Deployment ID' },
1365
1321
  },
1366
- required: ["deployment_id"],
1322
+ required: ['deployment_id'],
1367
1323
  },
1368
1324
  },
1369
1325
  {
1370
- name: "deployment_publish",
1371
- description: "Publish a new version of a deployment.",
1326
+ name: 'deployment_create',
1327
+ description: 'Create a new deployment.',
1372
1328
  inputSchema: {
1373
- type: "object",
1329
+ type: 'object',
1374
1330
  properties: {
1375
- deployment_id: { type: "string", description: "Deployment ID" },
1376
- source: {
1377
- type: "object",
1378
- description: "Source configuration for the new version",
1379
- },
1331
+ name: { type: 'string', description: 'Deployment name' },
1332
+ type: { type: 'string', description: 'Deployment type (e.g. web, worker)' },
1333
+ source: { type: 'object', description: 'Source configuration' },
1334
+ env_vars: { type: 'object', description: 'Environment variables as key-value pairs' },
1335
+ region: { type: 'string', description: 'Deployment region (optional)' },
1380
1336
  },
1381
- required: ["deployment_id"],
1337
+ required: ['name'],
1382
1338
  },
1383
1339
  },
1384
1340
  {
1385
- name: "deployment_rollback",
1386
- description: "Rollback a deployment to a previous version.",
1341
+ name: 'deployment_delete',
1342
+ description: 'Delete a deployment permanently.',
1387
1343
  inputSchema: {
1388
- type: "object",
1344
+ type: 'object',
1389
1345
  properties: {
1390
- deployment_id: { type: "string", description: "Deployment ID" },
1391
- version_id: {
1392
- type: "string",
1393
- description: "Version ID to roll back to",
1394
- },
1346
+ deployment_id: { type: 'string', description: 'Deployment ID to delete' },
1395
1347
  },
1396
- required: ["deployment_id", "version_id"],
1348
+ required: ['deployment_id'],
1397
1349
  },
1398
1350
  },
1399
1351
  {
1400
- name: "deployment_env_list",
1401
- description: "List environment variables for a deployment.",
1352
+ name: 'deployment_publish',
1353
+ description: 'Publish a new version of a deployment.',
1402
1354
  inputSchema: {
1403
- type: "object",
1355
+ type: 'object',
1404
1356
  properties: {
1405
- deployment_id: { type: "string", description: "Deployment ID" },
1357
+ deployment_id: { type: 'string', description: 'Deployment ID' },
1358
+ source: { type: 'object', description: 'Source configuration for the new version' },
1406
1359
  },
1407
- required: ["deployment_id"],
1360
+ required: ['deployment_id'],
1408
1361
  },
1409
1362
  },
1410
1363
  {
1411
- name: "deployment_env_set",
1412
- description: "Set (create or update) an environment variable for a deployment.",
1364
+ name: 'deployment_rollback',
1365
+ description: 'Rollback a deployment to a previous version.',
1413
1366
  inputSchema: {
1414
- type: "object",
1367
+ type: 'object',
1415
1368
  properties: {
1416
- deployment_id: { type: "string", description: "Deployment ID" },
1417
- key: { type: "string", description: "Environment variable name" },
1418
- value: { type: "string", description: "Environment variable value" },
1369
+ deployment_id: { type: 'string', description: 'Deployment ID' },
1370
+ version_id: { type: 'string', description: 'Version ID to roll back to' },
1419
1371
  },
1420
- required: ["deployment_id", "key", "value"],
1372
+ required: ['deployment_id', 'version_id'],
1421
1373
  },
1422
1374
  },
1423
1375
  {
1424
- name: "deployment_logs",
1425
- description: "Get logs for a deployment.",
1376
+ name: 'deployment_env_list',
1377
+ description: 'List environment variables for a deployment.',
1426
1378
  inputSchema: {
1427
- type: "object",
1379
+ type: 'object',
1428
1380
  properties: {
1429
- deployment_id: { type: "string", description: "Deployment ID" },
1430
- lines: {
1431
- type: "integer",
1432
- description: "Number of log lines to return (default: 100)",
1433
- default: 100,
1434
- },
1435
- since: {
1436
- type: "string",
1437
- description: "ISO 8601 timestamp to fetch logs from (optional)",
1438
- },
1439
- },
1440
- required: ["deployment_id"],
1441
- },
1442
- },
1443
- {
1444
- name: "deployment_version_list",
1445
- description: "List all versions of a deployment.",
1446
- inputSchema: {
1447
- type: "object",
1448
- properties: {
1449
- deployment_id: { type: "string", description: "Deployment ID" },
1450
- },
1451
- required: ["deployment_id"],
1452
- },
1453
- },
1454
- {
1455
- name: "deployment_version_promote",
1456
- description: "Promote a specific version to be the active deployment.",
1457
- inputSchema: {
1458
- type: "object",
1459
- properties: {
1460
- deployment_id: { type: "string", description: "Deployment ID" },
1461
- version_id: { type: "string", description: "Version ID to promote" },
1462
- },
1463
- required: ["deployment_id", "version_id"],
1464
- },
1465
- },
1466
- // Storage
1467
- {
1468
- name: "storage_bucket_list",
1469
- description: "List all storage buckets in the tenant.",
1470
- inputSchema: { type: "object", properties: {} },
1471
- },
1472
- {
1473
- name: "storage_bucket_create",
1474
- description: "Create a new storage bucket.",
1475
- inputSchema: {
1476
- type: "object",
1477
- properties: {
1478
- name: { type: "string", description: "Bucket name" },
1479
- region: { type: "string", description: "Bucket region (optional)" },
1480
- public: {
1481
- type: "boolean",
1482
- description: "Whether the bucket is publicly readable (default: false)",
1483
- default: false,
1484
- },
1485
- },
1486
- required: ["name"],
1487
- },
1488
- },
1489
- {
1490
- name: "storage_bucket_delete",
1491
- description: "Delete a storage bucket.",
1492
- inputSchema: {
1493
- type: "object",
1494
- properties: {
1495
- bucket_id: {
1496
- type: "string",
1497
- description: "Bucket ID or name to delete",
1498
- },
1499
- },
1500
- required: ["bucket_id"],
1501
- },
1502
- },
1503
- {
1504
- name: "storage_object_list",
1505
- description: "List objects in a storage bucket, optionally filtered by prefix.",
1506
- inputSchema: {
1507
- type: "object",
1508
- properties: {
1509
- bucket_id: { type: "string", description: "Bucket ID or name" },
1510
- prefix: {
1511
- type: "string",
1512
- description: "Key prefix to filter by (optional)",
1513
- },
1381
+ deployment_id: { type: 'string', description: 'Deployment ID' },
1514
1382
  },
1515
- required: ["bucket_id"],
1383
+ required: ['deployment_id'],
1516
1384
  },
1517
1385
  },
1518
1386
  {
1519
- name: "storage_object_upload",
1520
- description: "Upload an object to a storage bucket.",
1387
+ name: 'deployment_env_set',
1388
+ description: 'Set (create or update) an environment variable for a deployment.',
1521
1389
  inputSchema: {
1522
- type: "object",
1523
- properties: {
1524
- bucket_id: { type: "string", description: "Bucket ID or name" },
1525
- key: { type: "string", description: "Object key (path within bucket)" },
1526
- content: {
1527
- type: "string",
1528
- description: "Object content (text or base64-encoded binary)",
1529
- },
1530
- content_type: {
1531
- type: "string",
1532
- description: "MIME type of the object (optional)",
1533
- },
1534
- },
1535
- required: ["bucket_id", "key", "content"],
1536
- },
1537
- },
1538
- {
1539
- name: "storage_object_download",
1540
- description: "Download an object from a storage bucket.",
1541
- inputSchema: {
1542
- type: "object",
1543
- properties: {
1544
- bucket_id: { type: "string", description: "Bucket ID or name" },
1545
- key: { type: "string", description: "Object key to download" },
1546
- },
1547
- required: ["bucket_id", "key"],
1548
- },
1549
- },
1550
- {
1551
- name: "storage_object_delete",
1552
- description: "Delete an object from a storage bucket.",
1553
- inputSchema: {
1554
- type: "object",
1555
- properties: {
1556
- bucket_id: { type: "string", description: "Bucket ID or name" },
1557
- key: { type: "string", description: "Object key to delete" },
1558
- },
1559
- required: ["bucket_id", "key"],
1560
- },
1561
- },
1562
- {
1563
- name: "storage_presign",
1564
- description: "Get a presigned URL for temporary access to a storage object.",
1565
- inputSchema: {
1566
- type: "object",
1567
- properties: {
1568
- bucket_id: { type: "string", description: "Bucket ID or name" },
1569
- key: { type: "string", description: "Object key" },
1570
- expires_in: {
1571
- type: "integer",
1572
- description: "URL expiry in seconds (default: 3600)",
1573
- default: 3600,
1574
- },
1575
- method: {
1576
- type: "string",
1577
- enum: ["GET", "PUT"],
1578
- description: "HTTP method (default: GET)",
1579
- default: "GET",
1580
- },
1581
- },
1582
- required: ["bucket_id", "key"],
1583
- },
1584
- },
1585
- // Databases
1586
- {
1587
- name: "database_list",
1588
- description: "List all managed databases in the tenant.",
1589
- inputSchema: { type: "object", properties: {} },
1590
- },
1591
- {
1592
- name: "database_create",
1593
- description: "Create a new managed database.",
1594
- inputSchema: {
1595
- type: "object",
1596
- properties: {
1597
- name: { type: "string", description: "Database name" },
1598
- engine: {
1599
- type: "string",
1600
- enum: ["postgres", "mysql", "redis"],
1601
- description: "Database engine",
1602
- },
1603
- version: { type: "string", description: "Engine version (optional)" },
1604
- size: { type: "string", description: "Database size/tier (optional)" },
1605
- region: { type: "string", description: "Region (optional)" },
1606
- },
1607
- required: ["name", "engine"],
1608
- },
1609
- },
1610
- {
1611
- name: "database_get",
1612
- description: "Get details of a specific database.",
1613
- inputSchema: {
1614
- type: "object",
1615
- properties: {
1616
- database_id: { type: "string", description: "Database ID" },
1617
- },
1618
- required: ["database_id"],
1619
- },
1620
- },
1621
- {
1622
- name: "database_delete",
1623
- description: "Delete a managed database permanently.",
1624
- inputSchema: {
1625
- type: "object",
1626
- properties: {
1627
- database_id: { type: "string", description: "Database ID to delete" },
1628
- },
1629
- required: ["database_id"],
1630
- },
1631
- },
1632
- {
1633
- name: "database_credentials",
1634
- description: "Get the connection string and credentials for a database.",
1635
- inputSchema: {
1636
- type: "object",
1637
- properties: {
1638
- database_id: { type: "string", description: "Database ID" },
1639
- },
1640
- required: ["database_id"],
1641
- },
1642
- },
1643
- {
1644
- name: "database_logs",
1645
- description: "Get logs for a managed database.",
1646
- inputSchema: {
1647
- type: "object",
1648
- properties: {
1649
- database_id: { type: "string", description: "Database ID" },
1650
- lines: {
1651
- type: "integer",
1652
- description: "Number of log lines to return (default: 100)",
1653
- default: 100,
1654
- },
1655
- since: {
1656
- type: "string",
1657
- description: "ISO 8601 timestamp to fetch logs from (optional)",
1658
- },
1659
- },
1660
- required: ["database_id"],
1661
- },
1662
- },
1663
- // Workspaces
1664
- {
1665
- name: "workspace_list",
1666
- description: "List all workspaces in the tenant.",
1667
- inputSchema: { type: "object", properties: {} },
1668
- },
1669
- {
1670
- name: "workspace_create",
1671
- description: "Create a new workspace.",
1672
- inputSchema: {
1673
- type: "object",
1674
- properties: {
1675
- name: { type: "string", description: "Workspace name" },
1676
- description: {
1677
- type: "string",
1678
- description: "Workspace description (optional)",
1679
- },
1680
- },
1681
- required: ["name"],
1682
- },
1683
- },
1684
- {
1685
- name: "workspace_get",
1686
- description: "Get details of a specific workspace.",
1687
- inputSchema: {
1688
- type: "object",
1689
- properties: {
1690
- workspace_id: { type: "string", description: "Workspace ID" },
1691
- },
1692
- required: ["workspace_id"],
1693
- },
1694
- },
1695
- {
1696
- name: "workspace_update",
1697
- description: "Update a workspace's name or description.",
1698
- inputSchema: {
1699
- type: "object",
1700
- properties: {
1701
- workspace_id: { type: "string", description: "Workspace ID" },
1702
- name: { type: "string", description: "New workspace name (optional)" },
1703
- description: {
1704
- type: "string",
1705
- description: "New description (optional)",
1706
- },
1707
- },
1708
- required: ["workspace_id"],
1709
- },
1710
- },
1711
- {
1712
- name: "workspace_stats",
1713
- description: "Get resource statistics for a workspace (computers, sandboxes, databases, etc.).",
1714
- inputSchema: {
1715
- type: "object",
1716
- properties: {
1717
- workspace_id: { type: "string", description: "Workspace ID" },
1718
- },
1719
- required: ["workspace_id"],
1720
- },
1721
- },
1722
- {
1723
- name: "workspace_usage",
1724
- description: "Get usage data (compute hours, storage, bandwidth) for a workspace.",
1725
- inputSchema: {
1726
- type: "object",
1727
- properties: {
1728
- workspace_id: { type: "string", description: "Workspace ID" },
1729
- period: {
1730
- type: "string",
1731
- description: "Billing period (e.g. '2026-05'). Defaults to current month.",
1732
- },
1733
- },
1734
- required: ["workspace_id"],
1735
- },
1736
- },
1737
- // Billing
1738
- {
1739
- name: "billing_usage",
1740
- description: "Get current billing period usage for the tenant.",
1741
- inputSchema: { type: "object", properties: {} },
1742
- },
1743
- {
1744
- name: "billing_plan",
1745
- description: "Get the current billing plan details for the tenant.",
1746
- inputSchema: { type: "object", properties: {} },
1747
- },
1748
- // Tunnels / Port forwarding
1749
- {
1750
- name: "computer_expose_port",
1751
- description: "Expose a port on the computer and return the public URL. The URL follows the pattern https://{port}-{slug}.computer.miosa.ai.",
1752
- inputSchema: {
1753
- type: "object",
1754
- properties: {
1755
- computer_id: { type: "string", description: "Computer ID." },
1756
- port: { type: "integer", description: "Port number to expose" },
1757
- protocol: {
1758
- type: "string",
1759
- enum: ["http", "https", "tcp"],
1760
- description: "Protocol (default: http)",
1761
- },
1762
- },
1763
- required: ["computer_id", "port"],
1764
- },
1765
- },
1766
- {
1767
- name: "computer_list_ports",
1768
- description: "List all currently exposed ports on the computer.",
1769
- inputSchema: {
1770
- type: "object",
1771
- properties: {
1772
- computer_id: { type: "string", description: "Computer ID." },
1773
- },
1774
- required: ["computer_id"],
1775
- },
1776
- },
1777
- {
1778
- name: "computer_preview_url",
1779
- description: "Return the public preview URL for a given port on the computer. Format: https://{port}-{slug}.computer.miosa.ai",
1780
- inputSchema: {
1781
- type: "object",
1782
- properties: {
1783
- computer_id: { type: "string", description: "Computer ID." },
1784
- port: { type: "integer", description: "Port number" },
1785
- },
1786
- required: ["computer_id", "port"],
1787
- },
1788
- },
1789
- // Network policy
1790
- {
1791
- name: "computer_network_policy_get",
1792
- description: "Get the current network policy (firewall rules) for the computer.",
1793
- inputSchema: {
1794
- type: "object",
1795
- properties: {
1796
- computer_id: { type: "string", description: "Computer ID." },
1797
- },
1798
- required: ["computer_id"],
1799
- },
1800
- },
1801
- {
1802
- name: "computer_network_policy_set",
1803
- description: "Set the network policy (firewall rules) for the computer.",
1804
- inputSchema: {
1805
- type: "object",
1806
- properties: {
1807
- computer_id: { type: "string", description: "Computer ID." },
1808
- rules: {
1809
- type: "array",
1810
- items: { type: "object" },
1811
- description: "List of firewall rule objects (e.g. {direction, protocol, port, action})",
1812
- },
1813
- default_effect: {
1814
- type: "string",
1815
- enum: ["allow", "deny"],
1816
- description: "Default action when no rule matches (default: allow)",
1817
- },
1818
- },
1819
- required: ["computer_id", "rules"],
1820
- },
1821
- },
1822
- {
1823
- name: "computer_network_policy_reset",
1824
- description: "Reset the network policy for the computer to the platform default (allow all).",
1825
- inputSchema: {
1826
- type: "object",
1827
- properties: {
1828
- computer_id: { type: "string", description: "Computer ID." },
1829
- },
1830
- required: ["computer_id"],
1831
- },
1832
- },
1833
- // Webhooks
1834
- {
1835
- name: "webhook_list",
1836
- description: "List all webhooks registered in the tenant.",
1837
- inputSchema: { type: "object", properties: {} },
1838
- },
1839
- {
1840
- name: "webhook_create",
1841
- description: "Create a new webhook endpoint.",
1842
- inputSchema: {
1843
- type: "object",
1844
- properties: {
1845
- url: {
1846
- type: "string",
1847
- description: "HTTPS URL to deliver webhook events to",
1848
- },
1849
- events: {
1850
- type: "array",
1851
- items: { type: "string" },
1852
- description: "List of event types to subscribe to (e.g. ['computer.started', 'computer.stopped'])",
1853
- },
1854
- },
1855
- required: ["url", "events"],
1856
- },
1857
- },
1858
- {
1859
- name: "webhook_delete",
1860
- description: "Delete a webhook.",
1861
- inputSchema: {
1862
- type: "object",
1863
- properties: {
1864
- webhook_id: { type: "string", description: "Webhook ID to delete" },
1865
- },
1866
- required: ["webhook_id"],
1867
- },
1868
- },
1869
- {
1870
- name: "webhook_test",
1871
- description: "Send a test event delivery to a webhook endpoint.",
1872
- inputSchema: {
1873
- type: "object",
1874
- properties: {
1875
- webhook_id: { type: "string", description: "Webhook ID to test" },
1876
- },
1877
- required: ["webhook_id"],
1878
- },
1879
- },
1880
- // Functions
1881
- {
1882
- name: "function_list",
1883
- description: "List all serverless functions in the tenant.",
1884
- inputSchema: { type: "object", properties: {} },
1885
- },
1886
- {
1887
- name: "function_create",
1888
- description: "Create a new serverless function.",
1889
- inputSchema: {
1890
- type: "object",
1891
- properties: {
1892
- name: { type: "string", description: "Function name" },
1893
- runtime: {
1894
- type: "string",
1895
- description: "Runtime identifier (e.g. 'node20', 'python311', 'go122')",
1896
- },
1897
- code: {
1898
- type: "string",
1899
- description: "Inline function source code (optional)",
1900
- },
1901
- },
1902
- required: ["name", "runtime"],
1903
- },
1904
- },
1905
- {
1906
- name: "function_invoke",
1907
- description: "Invoke a serverless function and return its response.",
1908
- inputSchema: {
1909
- type: "object",
1910
- properties: {
1911
- function_id: { type: "string", description: "Function ID to invoke" },
1912
- payload: {
1913
- type: "object",
1914
- description: "JSON payload to pass to the function (optional)",
1915
- },
1916
- },
1917
- required: ["function_id"],
1918
- },
1919
- },
1920
- {
1921
- name: "function_delete",
1922
- description: "Delete a serverless function permanently.",
1923
- inputSchema: {
1924
- type: "object",
1925
- properties: {
1926
- function_id: { type: "string", description: "Function ID to delete" },
1927
- },
1928
- required: ["function_id"],
1929
- },
1930
- },
1931
- // API Keys
1932
- {
1933
- name: "api_key_list",
1934
- description: "List all API keys for the tenant.",
1935
- inputSchema: { type: "object", properties: {} },
1936
- },
1937
- {
1938
- name: "api_key_create",
1939
- description: "Create a new API key.",
1940
- inputSchema: {
1941
- type: "object",
1942
- properties: {
1943
- name: {
1944
- type: "string",
1945
- description: "Human-readable label for the key",
1946
- },
1947
- scopes: {
1948
- type: "array",
1949
- items: { type: "string" },
1950
- description: "Permission scopes for the key (optional; defaults to full access)",
1951
- },
1952
- },
1953
- required: ["name"],
1954
- },
1955
- },
1956
- {
1957
- name: "api_key_delete",
1958
- description: "Revoke and delete an API key.",
1959
- inputSchema: {
1960
- type: "object",
1961
- properties: {
1962
- key_id: { type: "string", description: "API key ID to delete" },
1963
- },
1964
- required: ["key_id"],
1965
- },
1966
- },
1967
- // Regions
1968
- {
1969
- name: "region_list",
1970
- description: "List available regions and their GPU availability.",
1971
- inputSchema: { type: "object", properties: {} },
1972
- },
1973
- {
1974
- name: "computer_list_regions",
1975
- description: "List available compute regions with GPU availability details.",
1976
- inputSchema: { type: "object", properties: {} },
1390
+ type: 'object',
1391
+ properties: {
1392
+ deployment_id: { type: 'string', description: 'Deployment ID' },
1393
+ key: { type: 'string', description: 'Environment variable name' },
1394
+ value: { type: 'string', description: 'Environment variable value' },
1395
+ },
1396
+ required: ['deployment_id', 'key', 'value'],
1397
+ },
1977
1398
  },
1978
- // Computer templates
1979
1399
  {
1980
- name: "computer_template_list",
1981
- description: "List computer templates available in a workspace.",
1400
+ name: 'deployment_logs',
1401
+ description: 'Get logs for a deployment.',
1982
1402
  inputSchema: {
1983
- type: "object",
1403
+ type: 'object',
1984
1404
  properties: {
1985
- workspace_id: {
1986
- type: "string",
1987
- description: "Workspace ID to list templates for",
1988
- },
1405
+ deployment_id: { type: 'string', description: 'Deployment ID' },
1406
+ lines: { type: 'integer', description: 'Number of log lines to return (default: 100)', default: 100 },
1407
+ since: { type: 'string', description: 'ISO 8601 timestamp to fetch logs from (optional)' },
1989
1408
  },
1990
- required: ["workspace_id"],
1409
+ required: ['deployment_id'],
1991
1410
  },
1992
1411
  },
1993
1412
  {
1994
- name: "computer_template_create",
1995
- description: "Create a new computer template in a workspace.",
1413
+ name: 'deployment_version_list',
1414
+ description: 'List all versions of a deployment.',
1996
1415
  inputSchema: {
1997
- type: "object",
1416
+ type: 'object',
1998
1417
  properties: {
1999
- workspace_id: {
2000
- type: "string",
2001
- description: "Workspace ID to create the template in",
2002
- },
2003
- name: {
2004
- type: "string",
2005
- description: "Human-readable name for the template",
2006
- },
2007
- template_type: {
2008
- type: "string",
2009
- description: "Base template type (e.g. miosa-desktop)",
2010
- },
2011
- size: {
2012
- type: "string",
2013
- enum: ["small", "medium", "large", "xl"],
2014
- description: "VM size for the template",
2015
- },
2016
- selected_apps: {
2017
- type: "array",
2018
- items: { type: "string" },
2019
- description: "List of app identifiers to pre-install",
2020
- },
2021
- settings: {
2022
- type: "object",
2023
- description: "Additional template settings (key-value pairs)",
2024
- },
1418
+ deployment_id: { type: 'string', description: 'Deployment ID' },
2025
1419
  },
2026
- required: ["workspace_id", "name"],
1420
+ required: ['deployment_id'],
2027
1421
  },
2028
1422
  },
2029
- // Settings
2030
1423
  {
2031
- name: "settings_get",
2032
- description: "Get all tenant-level settings.",
2033
- inputSchema: { type: "object", properties: {} },
1424
+ name: 'deployment_version_promote',
1425
+ description: 'Promote a specific version to be the active deployment.',
1426
+ inputSchema: {
1427
+ type: 'object',
1428
+ properties: {
1429
+ deployment_id: { type: 'string', description: 'Deployment ID' },
1430
+ version_id: { type: 'string', description: 'Version ID to promote' },
1431
+ },
1432
+ required: ['deployment_id', 'version_id'],
1433
+ },
2034
1434
  },
1435
+ // Storage
2035
1436
  {
2036
- name: "settings_get_branding",
2037
- description: "Get tenant branding settings (logo, wallpaper, colours).",
2038
- inputSchema: { type: "object", properties: {} },
1437
+ name: 'storage_bucket_list',
1438
+ description: 'List all storage buckets in the tenant.',
1439
+ inputSchema: { type: 'object', properties: {} },
2039
1440
  },
2040
1441
  {
2041
- name: "settings_update_branding",
2042
- description: "Update tenant branding settings.",
1442
+ name: 'storage_bucket_create',
1443
+ description: 'Create a new storage bucket.',
2043
1444
  inputSchema: {
2044
- type: "object",
1445
+ type: 'object',
2045
1446
  properties: {
2046
- desktop_wallpaper_url: {
2047
- type: "string",
2048
- description: "HTTPS URL for the default desktop wallpaper (optional)",
2049
- },
2050
- logo_url: {
2051
- type: "string",
2052
- description: "HTTPS URL for the tenant logo (optional)",
2053
- },
1447
+ name: { type: 'string', description: 'Bucket name' },
1448
+ region: { type: 'string', description: 'Bucket region (optional)' },
1449
+ public: { type: 'boolean', description: 'Whether the bucket is publicly readable (default: false)', default: false },
2054
1450
  },
1451
+ required: ['name'],
2055
1452
  },
2056
1453
  },
2057
1454
  {
2058
- name: "settings_compute_pricing",
2059
- description: "Get compute pricing information for available sizes and GPU types.",
2060
- inputSchema: { type: "object", properties: {} },
1455
+ name: 'storage_bucket_delete',
1456
+ description: 'Delete a storage bucket.',
1457
+ inputSchema: {
1458
+ type: 'object',
1459
+ properties: {
1460
+ bucket_id: { type: 'string', description: 'Bucket ID or name to delete' },
1461
+ },
1462
+ required: ['bucket_id'],
1463
+ },
2061
1464
  },
2062
- // Sandbox template extensions
2063
1465
  {
2064
- name: "sandbox_template_get",
2065
- description: "Get details of a specific sandbox template.",
1466
+ name: 'storage_object_list',
1467
+ description: 'List objects in a storage bucket, optionally filtered by prefix.',
2066
1468
  inputSchema: {
2067
- type: "object",
1469
+ type: 'object',
2068
1470
  properties: {
2069
- template_id: {
2070
- type: "string",
2071
- description: "Sandbox template ID or slug",
2072
- },
1471
+ bucket_id: { type: 'string', description: 'Bucket ID or name' },
1472
+ prefix: { type: 'string', description: 'Key prefix to filter by (optional)' },
2073
1473
  },
2074
- required: ["template_id"],
1474
+ required: ['bucket_id'],
2075
1475
  },
2076
1476
  },
2077
1477
  {
2078
- name: "sandbox_template_builds",
2079
- description: "List builds for a sandbox template.",
1478
+ name: 'storage_object_upload',
1479
+ description: 'Upload an object to a storage bucket.',
2080
1480
  inputSchema: {
2081
- type: "object",
1481
+ type: 'object',
2082
1482
  properties: {
2083
- template_id: {
2084
- type: "string",
2085
- description: "Sandbox template ID or slug",
2086
- },
1483
+ bucket_id: { type: 'string', description: 'Bucket ID or name' },
1484
+ key: { type: 'string', description: 'Object key (path within bucket)' },
1485
+ content: { type: 'string', description: 'Object content (text or base64-encoded binary)' },
1486
+ content_type: { type: 'string', description: 'MIME type of the object (optional)' },
2087
1487
  },
2088
- required: ["template_id"],
1488
+ required: ['bucket_id', 'key', 'content'],
2089
1489
  },
2090
1490
  },
2091
- // Cron jobs
2092
1491
  {
2093
- name: "cron_list",
2094
- description: "List all cron jobs in the tenant, optionally filtered by computer.",
1492
+ name: 'storage_object_download',
1493
+ description: 'Download an object from a storage bucket.',
2095
1494
  inputSchema: {
2096
- type: "object",
1495
+ type: 'object',
2097
1496
  properties: {
2098
- computer_id: {
2099
- type: "string",
2100
- description: "Filter cron jobs by computer ID (optional)",
2101
- },
1497
+ bucket_id: { type: 'string', description: 'Bucket ID or name' },
1498
+ key: { type: 'string', description: 'Object key to download' },
2102
1499
  },
1500
+ required: ['bucket_id', 'key'],
2103
1501
  },
2104
1502
  },
2105
1503
  {
2106
- name: "cron_create",
2107
- description: "Create a new cron job that runs a command on a schedule.",
1504
+ name: 'storage_object_delete',
1505
+ description: 'Delete an object from a storage bucket.',
2108
1506
  inputSchema: {
2109
- type: "object",
1507
+ type: 'object',
2110
1508
  properties: {
2111
- computer_id: {
2112
- type: "string",
2113
- description: "ID of the computer to run the cron job on",
2114
- },
2115
- schedule: {
2116
- type: "string",
2117
- description: "Cron schedule expression (e.g. '0 * * * *' for hourly)",
2118
- },
2119
- command: {
2120
- type: "string",
2121
- description: "Shell command to execute",
2122
- },
2123
- name: {
2124
- type: "string",
2125
- description: "Human-readable name for the cron job (optional)",
2126
- },
1509
+ bucket_id: { type: 'string', description: 'Bucket ID or name' },
1510
+ key: { type: 'string', description: 'Object key to delete' },
2127
1511
  },
2128
- required: ["computer_id", "schedule", "command"],
1512
+ required: ['bucket_id', 'key'],
2129
1513
  },
2130
1514
  },
2131
1515
  {
2132
- name: "cron_get",
2133
- description: "Get details of a specific cron job.",
1516
+ name: 'storage_presign',
1517
+ description: 'Get a presigned URL for temporary access to a storage object.',
2134
1518
  inputSchema: {
2135
- type: "object",
1519
+ type: 'object',
2136
1520
  properties: {
2137
- cron_id: { type: "string", description: "Cron job ID" },
1521
+ bucket_id: { type: 'string', description: 'Bucket ID or name' },
1522
+ key: { type: 'string', description: 'Object key' },
1523
+ expires_in: { type: 'integer', description: 'URL expiry in seconds (default: 3600)', default: 3600 },
1524
+ method: { type: 'string', enum: ['GET', 'PUT'], description: 'HTTP method (default: GET)', default: 'GET' },
2138
1525
  },
2139
- required: ["cron_id"],
1526
+ required: ['bucket_id', 'key'],
2140
1527
  },
2141
1528
  },
1529
+ // Databases
1530
+ {
1531
+ name: 'database_list',
1532
+ description: 'List all managed databases in the tenant.',
1533
+ inputSchema: { type: 'object', properties: {} },
1534
+ },
2142
1535
  {
2143
- name: "cron_delete",
2144
- description: "Delete a cron job permanently.",
1536
+ name: 'database_create',
1537
+ description: 'Create a new managed database.',
2145
1538
  inputSchema: {
2146
- type: "object",
1539
+ type: 'object',
2147
1540
  properties: {
2148
- cron_id: { type: "string", description: "Cron job ID to delete" },
1541
+ name: { type: 'string', description: 'Database name' },
1542
+ engine: { type: 'string', enum: ['postgres', 'mysql', 'redis'], description: 'Database engine' },
1543
+ version: { type: 'string', description: 'Engine version (optional)' },
1544
+ size: { type: 'string', description: 'Database size/tier (optional)' },
1545
+ region: { type: 'string', description: 'Region (optional)' },
2149
1546
  },
2150
- required: ["cron_id"],
1547
+ required: ['name', 'engine'],
2151
1548
  },
2152
1549
  },
2153
1550
  {
2154
- name: "cron_pause",
2155
- description: "Pause a cron job so it stops running on schedule.",
1551
+ name: 'database_get',
1552
+ description: 'Get details of a specific database.',
2156
1553
  inputSchema: {
2157
- type: "object",
1554
+ type: 'object',
2158
1555
  properties: {
2159
- cron_id: { type: "string", description: "Cron job ID to pause" },
1556
+ database_id: { type: 'string', description: 'Database ID' },
2160
1557
  },
2161
- required: ["cron_id"],
1558
+ required: ['database_id'],
2162
1559
  },
2163
1560
  },
2164
1561
  {
2165
- name: "cron_resume",
2166
- description: "Resume a paused cron job.",
1562
+ name: 'database_delete',
1563
+ description: 'Delete a managed database permanently.',
2167
1564
  inputSchema: {
2168
- type: "object",
1565
+ type: 'object',
2169
1566
  properties: {
2170
- cron_id: { type: "string", description: "Cron job ID to resume" },
1567
+ database_id: { type: 'string', description: 'Database ID to delete' },
2171
1568
  },
2172
- required: ["cron_id"],
1569
+ required: ['database_id'],
2173
1570
  },
2174
1571
  },
2175
1572
  {
2176
- name: "cron_run_now",
2177
- description: "Trigger an immediate one-off execution of a cron job outside its schedule.",
1573
+ name: 'database_credentials',
1574
+ description: 'Get the connection string and credentials for a database.',
2178
1575
  inputSchema: {
2179
- type: "object",
1576
+ type: 'object',
2180
1577
  properties: {
2181
- cron_id: {
2182
- type: "string",
2183
- description: "Cron job ID to run immediately",
2184
- },
1578
+ database_id: { type: 'string', description: 'Database ID' },
2185
1579
  },
2186
- required: ["cron_id"],
1580
+ required: ['database_id'],
2187
1581
  },
2188
1582
  },
2189
1583
  {
2190
- name: "cron_executions",
2191
- description: "List recent execution history for a cron job.",
1584
+ name: 'database_logs',
1585
+ description: 'Get logs for a managed database.',
2192
1586
  inputSchema: {
2193
- type: "object",
1587
+ type: 'object',
2194
1588
  properties: {
2195
- cron_id: { type: "string", description: "Cron job ID" },
1589
+ database_id: { type: 'string', description: 'Database ID' },
1590
+ lines: { type: 'integer', description: 'Number of log lines to return (default: 100)', default: 100 },
1591
+ since: { type: 'string', description: 'ISO 8601 timestamp to fetch logs from (optional)' },
2196
1592
  },
2197
- required: ["cron_id"],
1593
+ required: ['database_id'],
2198
1594
  },
2199
1595
  },
2200
- // Volumes
1596
+ // Workspaces
2201
1597
  {
2202
- name: "volume_list",
2203
- description: "List all volumes in the tenant.",
2204
- inputSchema: { type: "object", properties: {} },
1598
+ name: 'workspace_list',
1599
+ description: 'List all workspaces in the tenant.',
1600
+ inputSchema: { type: 'object', properties: {} },
2205
1601
  },
2206
1602
  {
2207
- name: "volume_create",
2208
- description: "Create a new persistent volume.",
1603
+ name: 'workspace_create',
1604
+ description: 'Create a new workspace.',
2209
1605
  inputSchema: {
2210
- type: "object",
1606
+ type: 'object',
2211
1607
  properties: {
2212
- name: {
2213
- type: "string",
2214
- description: "Human-readable name for the volume",
2215
- },
2216
- size_gb: {
2217
- type: "integer",
2218
- description: "Size of the volume in GB (optional)",
2219
- },
2220
- region: {
2221
- type: "string",
2222
- description: "Region to create the volume in (optional)",
2223
- },
1608
+ name: { type: 'string', description: 'Workspace name' },
1609
+ description: { type: 'string', description: 'Workspace description (optional)' },
2224
1610
  },
2225
- required: ["name"],
1611
+ required: ['name'],
2226
1612
  },
2227
1613
  },
2228
1614
  {
2229
- name: "volume_get",
2230
- description: "Get details of a specific volume.",
1615
+ name: 'workspace_get',
1616
+ description: 'Get details of a specific workspace.',
2231
1617
  inputSchema: {
2232
- type: "object",
1618
+ type: 'object',
2233
1619
  properties: {
2234
- volume_id: { type: "string", description: "Volume ID" },
1620
+ workspace_id: { type: 'string', description: 'Workspace ID' },
2235
1621
  },
2236
- required: ["volume_id"],
1622
+ required: ['workspace_id'],
2237
1623
  },
2238
1624
  },
2239
1625
  {
2240
- name: "volume_delete",
2241
- description: "Delete a volume permanently.",
1626
+ name: 'workspace_update',
1627
+ description: "Update a workspace's name or description.",
2242
1628
  inputSchema: {
2243
- type: "object",
1629
+ type: 'object',
2244
1630
  properties: {
2245
- volume_id: { type: "string", description: "Volume ID to delete" },
1631
+ workspace_id: { type: 'string', description: 'Workspace ID' },
1632
+ name: { type: 'string', description: 'New workspace name (optional)' },
1633
+ description: { type: 'string', description: 'New description (optional)' },
2246
1634
  },
2247
- required: ["volume_id"],
1635
+ required: ['workspace_id'],
2248
1636
  },
2249
1637
  },
2250
1638
  {
2251
- name: "volume_attach",
2252
- description: "Attach a volume to a computer at a given mount path.",
1639
+ name: 'workspace_stats',
1640
+ description: 'Get resource statistics for a workspace (computers, sandboxes, databases, etc.).',
2253
1641
  inputSchema: {
2254
- type: "object",
1642
+ type: 'object',
2255
1643
  properties: {
2256
- computer_id: {
2257
- type: "string",
2258
- description: "Computer ID to attach the volume to",
2259
- },
2260
- volume_id: { type: "string", description: "Volume ID to attach" },
2261
- mount_path: {
2262
- type: "string",
2263
- description: "Path inside the VM to mount the volume (optional)",
2264
- },
1644
+ workspace_id: { type: 'string', description: 'Workspace ID' },
2265
1645
  },
2266
- required: ["computer_id", "volume_id"],
1646
+ required: ['workspace_id'],
2267
1647
  },
2268
1648
  },
2269
1649
  {
2270
- name: "volume_detach",
2271
- description: "Detach a volume attachment from a computer.",
1650
+ name: 'workspace_usage',
1651
+ description: 'Get usage data (compute hours, storage, bandwidth) for a workspace.',
2272
1652
  inputSchema: {
2273
- type: "object",
1653
+ type: 'object',
2274
1654
  properties: {
2275
- computer_id: { type: "string", description: "Computer ID" },
2276
- attachment_id: {
2277
- type: "string",
2278
- description: "Attachment ID to remove",
2279
- },
1655
+ workspace_id: { type: 'string', description: 'Workspace ID' },
1656
+ period: { type: 'string', description: "Billing period (e.g. '2026-05'). Defaults to current month." },
2280
1657
  },
2281
- required: ["computer_id", "attachment_id"],
1658
+ required: ['workspace_id'],
2282
1659
  },
2283
1660
  },
1661
+ // Billing
1662
+ {
1663
+ name: 'billing_usage',
1664
+ description: 'Get current billing period usage for the tenant.',
1665
+ inputSchema: { type: 'object', properties: {} },
1666
+ },
1667
+ {
1668
+ name: 'billing_plan',
1669
+ description: 'Get the current billing plan details for the tenant.',
1670
+ inputSchema: { type: 'object', properties: {} },
1671
+ },
2284
1672
  ];
2285
1673
  // ── Wire helpers ─────────────────────────────────────────────────────────────
2286
1674
  function ok(text) {
@@ -2320,10 +1708,6 @@ async function dispatchTool(client, name, args) {
2320
1708
  body["external_workspace_id"] = args["external_workspace_id"];
2321
1709
  if (args["external_project_id"])
2322
1710
  body["external_project_id"] = args["external_project_id"];
2323
- if (args["gpu_model"]) {
2324
- body["gpu_model"] = args["gpu_model"];
2325
- body["gpu_count"] = args["gpu_count"] ?? 1;
2326
- }
2327
1711
  const computer = await client.apiPost("/api/v1/computers", body);
2328
1712
  const data = unwrapData(computer);
2329
1713
  const id = String(data["id"] ?? "");
@@ -3354,12 +2738,7 @@ async function dispatchTool(client, name, args) {
3354
2738
  const lines = ["Deployments:"];
3355
2739
  for (const d of items) {
3356
2740
  const r = d;
3357
- lines.push(" " +
3358
- r["id"] +
3359
- " " +
3360
- r["name"] +
3361
- " " +
3362
- (r["status"] ?? r["state"] ?? ""));
2741
+ lines.push(" " + r["id"] + " " + r["name"] + " " + (r["status"] ?? r["state"] ?? ""));
3363
2742
  }
3364
2743
  return ok(lines.join("\n"));
3365
2744
  }
@@ -3382,11 +2761,7 @@ async function dispatchTool(client, name, args) {
3382
2761
  body["region"] = args["region"];
3383
2762
  const result = await client.apiPost("/api/v1/deployments", body);
3384
2763
  const data = unwrapData(result);
3385
- return ok("Created deployment '" +
3386
- String(data["name"] ?? args["name"]) +
3387
- "' (id=" +
3388
- data["id"] +
3389
- ")");
2764
+ return ok("Created deployment '" + String(data["name"] ?? args["name"]) + "' (id=" + data["id"] + ")");
3390
2765
  }
3391
2766
  if (name === "deployment_delete") {
3392
2767
  const did = String(args["deployment_id"] ?? "");
@@ -3404,11 +2779,7 @@ async function dispatchTool(client, name, args) {
3404
2779
  body["source"] = args["source"];
3405
2780
  const result = await client.apiPost("/api/v1/deployments/" + encodeURIComponent(did) + "/publish", body);
3406
2781
  const data = unwrapData(result);
3407
- return ok("Published deployment " +
3408
- did +
3409
- " (version id=" +
3410
- (data["id"] ?? "unknown") +
3411
- ")");
2782
+ return ok("Published deployment " + did + " (version id=" + (data["id"] ?? "unknown") + ")");
3412
2783
  }
3413
2784
  if (name === "deployment_rollback") {
3414
2785
  const did = String(args["deployment_id"] ?? "");
@@ -3426,8 +2797,7 @@ async function dispatchTool(client, name, args) {
3426
2797
  return err("deployment_id is required");
3427
2798
  const result = await client.apiGet("/api/v1/deployments/" + encodeURIComponent(did) + "/env");
3428
2799
  const envVars = unwrapData(result);
3429
- if (!envVars ||
3430
- (Array.isArray(envVars) && envVars.length === 0))
2800
+ if (!envVars || (Array.isArray(envVars) && envVars.length === 0))
3431
2801
  return ok("No environment variables set.");
3432
2802
  const lines = ["Environment variables:"];
3433
2803
  if (typeof envVars === "object" && !Array.isArray(envVars)) {
@@ -3453,20 +2823,13 @@ async function dispatchTool(client, name, args) {
3453
2823
  const did = String(args["deployment_id"] ?? "");
3454
2824
  if (!did)
3455
2825
  return err("deployment_id is required");
3456
- const params = new URLSearchParams({
3457
- lines: String(args["lines"] ?? 100),
3458
- });
2826
+ const params = new URLSearchParams({ lines: String(args["lines"] ?? 100) });
3459
2827
  if (args["since"])
3460
2828
  params.set("since", String(args["since"]));
3461
- const result = await client.apiGet("/api/v1/deployments/" +
3462
- encodeURIComponent(did) +
3463
- "/logs?" +
3464
- params.toString());
2829
+ const result = await client.apiGet("/api/v1/deployments/" + encodeURIComponent(did) + "/logs?" + params.toString());
3465
2830
  const logs = unwrapData(result);
3466
2831
  if (Array.isArray(logs))
3467
- return ok(logs.length
3468
- ? logs.map(String).join("\n")
3469
- : "No logs.");
2832
+ return ok(logs.length ? logs.map(String).join("\n") : "No logs.");
3470
2833
  return ok(String(logs));
3471
2834
  }
3472
2835
  if (name === "deployment_version_list") {
@@ -3480,12 +2843,7 @@ async function dispatchTool(client, name, args) {
3480
2843
  const lines = ["Versions:"];
3481
2844
  for (const v of versions) {
3482
2845
  const r = v;
3483
- lines.push(" " +
3484
- r["id"] +
3485
- " " +
3486
- (r["created_at"] ?? "") +
3487
- " " +
3488
- (r["status"] ?? ""));
2846
+ lines.push(" " + r["id"] + " " + (r["created_at"] ?? "") + " " + (r["status"] ?? ""));
3489
2847
  }
3490
2848
  return ok(lines.join("\n"));
3491
2849
  }
@@ -3496,11 +2854,7 @@ async function dispatchTool(client, name, args) {
3496
2854
  return err("deployment_id is required");
3497
2855
  if (!vid)
3498
2856
  return err("version_id is required");
3499
- await client.apiPost("/api/v1/deployments/" +
3500
- encodeURIComponent(did) +
3501
- "/versions/" +
3502
- encodeURIComponent(vid) +
3503
- "/promote", {});
2857
+ await client.apiPost("/api/v1/deployments/" + encodeURIComponent(did) + "/versions/" + encodeURIComponent(vid) + "/promote", {});
3504
2858
  return ok("Version " + vid + " promoted on deployment " + did + ".");
3505
2859
  }
3506
2860
  // ── Storage ───────────────────────────────────────────────────────────
@@ -3524,11 +2878,7 @@ async function dispatchTool(client, name, args) {
3524
2878
  body["public"] = args["public"];
3525
2879
  const result = await client.apiPost("/api/v1/storage/buckets", body);
3526
2880
  const data = unwrapData(result);
3527
- return ok("Created bucket '" +
3528
- String(data["name"] ?? args["name"]) +
3529
- "' (id=" +
3530
- data["id"] +
3531
- ")");
2881
+ return ok("Created bucket '" + String(data["name"] ?? args["name"]) + "' (id=" + data["id"] + ")");
3532
2882
  }
3533
2883
  if (name === "storage_bucket_delete") {
3534
2884
  const bid = String(args["bucket_id"] ?? "");
@@ -3552,12 +2902,7 @@ async function dispatchTool(client, name, args) {
3552
2902
  const lines = ["Objects:"];
3553
2903
  for (const o of items) {
3554
2904
  const r = o;
3555
- lines.push(" " +
3556
- r["key"] +
3557
- " " +
3558
- (r["size"] ?? "") +
3559
- " " +
3560
- (r["last_modified"] ?? ""));
2905
+ lines.push(" " + r["key"] + " " + (r["size"] ?? "") + " " + (r["last_modified"] ?? ""));
3561
2906
  }
3562
2907
  return ok(lines.join("\n"));
3563
2908
  }
@@ -3576,10 +2921,7 @@ async function dispatchTool(client, name, args) {
3576
2921
  const bid = String(args["bucket_id"] ?? "");
3577
2922
  if (!bid)
3578
2923
  return err("bucket_id is required");
3579
- const result = await client.apiGet("/api/v1/storage/buckets/" +
3580
- encodeURIComponent(bid) +
3581
- "/objects/" +
3582
- encodeURIComponent(String(args["key"] ?? "")));
2924
+ const result = await client.apiGet("/api/v1/storage/buckets/" + encodeURIComponent(bid) + "/objects/" + encodeURIComponent(String(args["key"] ?? "")));
3583
2925
  const data = unwrapData(result);
3584
2926
  const content = typeof data["content"] === "string"
3585
2927
  ? Buffer.from(data["content"], "base64").toString("utf8")
@@ -3592,10 +2934,7 @@ async function dispatchTool(client, name, args) {
3592
2934
  const bid = String(args["bucket_id"] ?? "");
3593
2935
  if (!bid)
3594
2936
  return err("bucket_id is required");
3595
- await client.apiDelete("/api/v1/storage/buckets/" +
3596
- encodeURIComponent(bid) +
3597
- "/objects/" +
3598
- encodeURIComponent(String(args["key"] ?? "")));
2937
+ await client.apiDelete("/api/v1/storage/buckets/" + encodeURIComponent(bid) + "/objects/" + encodeURIComponent(String(args["key"] ?? "")));
3599
2938
  return ok("Deleted " + String(args["key"]) + " from bucket " + bid + ".");
3600
2939
  }
3601
2940
  if (name === "storage_presign") {
@@ -3619,33 +2958,19 @@ async function dispatchTool(client, name, args) {
3619
2958
  const lines = ["Databases:"];
3620
2959
  for (const d of items) {
3621
2960
  const r = d;
3622
- lines.push(" " +
3623
- r["id"] +
3624
- " " +
3625
- r["name"] +
3626
- " " +
3627
- (r["engine"] ?? "") +
3628
- " " +
3629
- (r["status"] ?? ""));
2961
+ lines.push(" " + r["id"] + " " + r["name"] + " " + (r["engine"] ?? "") + " " + (r["status"] ?? ""));
3630
2962
  }
3631
2963
  return ok(lines.join("\n"));
3632
2964
  }
3633
2965
  if (name === "database_create") {
3634
- const body = {
3635
- name: args["name"],
3636
- engine: args["engine"],
3637
- };
2966
+ const body = { name: args["name"], engine: args["engine"] };
3638
2967
  for (const key of ["version", "size", "region"]) {
3639
2968
  if (args[key])
3640
2969
  body[key] = args[key];
3641
2970
  }
3642
2971
  const result = await client.apiPost("/api/v1/databases", body);
3643
2972
  const data = unwrapData(result);
3644
- return ok("Created database '" +
3645
- String(data["name"] ?? args["name"]) +
3646
- "' (id=" +
3647
- data["id"] +
3648
- ")");
2973
+ return ok("Created database '" + String(data["name"] ?? args["name"]) + "' (id=" + data["id"] + ")");
3649
2974
  }
3650
2975
  if (name === "database_get") {
3651
2976
  const dbid = String(args["database_id"] ?? "");
@@ -3668,14 +2993,7 @@ async function dispatchTool(client, name, args) {
3668
2993
  const result = await client.apiGet("/api/v1/databases/" + encodeURIComponent(dbid) + "/credentials");
3669
2994
  const data = unwrapData(result);
3670
2995
  const lines = ["Database credentials:"];
3671
- for (const field of [
3672
- "connection_string",
3673
- "host",
3674
- "port",
3675
- "database",
3676
- "username",
3677
- "password",
3678
- ]) {
2996
+ for (const field of ["connection_string", "host", "port", "database", "username", "password"]) {
3679
2997
  if (data[field])
3680
2998
  lines.push(" " + field + ": " + data[field]);
3681
2999
  }
@@ -3685,20 +3003,13 @@ async function dispatchTool(client, name, args) {
3685
3003
  const dbid = String(args["database_id"] ?? "");
3686
3004
  if (!dbid)
3687
3005
  return err("database_id is required");
3688
- const params = new URLSearchParams({
3689
- lines: String(args["lines"] ?? 100),
3690
- });
3006
+ const params = new URLSearchParams({ lines: String(args["lines"] ?? 100) });
3691
3007
  if (args["since"])
3692
3008
  params.set("since", String(args["since"]));
3693
- const result = await client.apiGet("/api/v1/databases/" +
3694
- encodeURIComponent(dbid) +
3695
- "/logs?" +
3696
- params.toString());
3009
+ const result = await client.apiGet("/api/v1/databases/" + encodeURIComponent(dbid) + "/logs?" + params.toString());
3697
3010
  const logs = unwrapData(result);
3698
3011
  if (Array.isArray(logs))
3699
- return ok(logs.length
3700
- ? logs.map(String).join("\n")
3701
- : "No logs.");
3012
+ return ok(logs.length ? logs.map(String).join("\n") : "No logs.");
3702
3013
  return ok(String(logs));
3703
3014
  }
3704
3015
  // ── Workspaces ────────────────────────────────────────────────────────
@@ -3720,11 +3031,7 @@ async function dispatchTool(client, name, args) {
3720
3031
  body["description"] = args["description"];
3721
3032
  const result = await client.apiPost("/api/v1/workspaces", body);
3722
3033
  const data = unwrapData(result);
3723
- return ok("Created workspace '" +
3724
- String(data["name"] ?? args["name"]) +
3725
- "' (id=" +
3726
- data["id"] +
3727
- ")");
3034
+ return ok("Created workspace '" + String(data["name"] ?? args["name"]) + "' (id=" + data["id"] + ")");
3728
3035
  }
3729
3036
  if (name === "workspace_get") {
3730
3037
  const wid = String(args["workspace_id"] ?? "");
@@ -3772,425 +3079,6 @@ async function dispatchTool(client, name, args) {
3772
3079
  const result = await client.apiGet("/api/v1/billing/plan");
3773
3080
  return ok(JSON.stringify(unwrapData(result), null, 2));
3774
3081
  }
3775
- // ── Tunnels / Port forwarding ─────────────────────────────────────────
3776
- if (name === "computer_expose_port") {
3777
- if (!cid)
3778
- return err("computer_id is required");
3779
- const body = { port: args["port"] };
3780
- if (args["protocol"])
3781
- body["protocol"] = args["protocol"];
3782
- const result = await client.apiPost(`/api/v1/computers/${encodeURIComponent(cid)}/ports`, body);
3783
- const data = unwrapData(result);
3784
- const url = String(data["url"] ?? data["public_url"] ?? "");
3785
- return ok(`Port ${args["port"]} exposed. URL: ${url}`);
3786
- }
3787
- if (name === "computer_list_ports") {
3788
- if (!cid)
3789
- return err("computer_id is required");
3790
- const result = await client.apiGet(`/api/v1/computers/${encodeURIComponent(cid)}/ports`);
3791
- const items = listOf(result);
3792
- if (items.length === 0)
3793
- return ok("No ports currently exposed.");
3794
- const lines = ["Exposed ports:"];
3795
- for (const p of items) {
3796
- const r = p;
3797
- lines.push(` port=${r["port"]} protocol=${r["protocol"] ?? "http"} url=${r["url"] ?? r["public_url"] ?? ""}`);
3798
- }
3799
- return ok(lines.join("\n"));
3800
- }
3801
- if (name === "computer_preview_url") {
3802
- if (!cid)
3803
- return err("computer_id is required");
3804
- const port = args["port"];
3805
- const result = await client.apiGet(`/api/v1/computers/${encodeURIComponent(cid)}/ports/${encodeURIComponent(String(port))}/url`);
3806
- const data = unwrapData(result);
3807
- const url = String(data["url"] ?? data["public_url"] ?? "") ||
3808
- `https://${port}-${cid}.computer.miosa.ai`;
3809
- return ok(`Preview URL: ${url}`);
3810
- }
3811
- // ── Network policy ────────────────────────────────────────────────────
3812
- if (name === "computer_network_policy_get") {
3813
- if (!cid)
3814
- return err("computer_id is required");
3815
- const result = await client.apiGet(`/api/v1/computers/${encodeURIComponent(cid)}/network-policy`);
3816
- return ok(JSON.stringify(unwrapData(result), null, 2));
3817
- }
3818
- if (name === "computer_network_policy_set") {
3819
- if (!cid)
3820
- return err("computer_id is required");
3821
- const body = { rules: args["rules"] };
3822
- if (args["default_effect"])
3823
- body["default_effect"] = args["default_effect"];
3824
- await client.apiPut(`/api/v1/computers/${encodeURIComponent(cid)}/network-policy`, body);
3825
- return ok(`Network policy updated for computer ${cid}.`);
3826
- }
3827
- if (name === "computer_network_policy_reset") {
3828
- if (!cid)
3829
- return err("computer_id is required");
3830
- await client.apiDelete(`/api/v1/computers/${encodeURIComponent(cid)}/network-policy`);
3831
- return ok(`Network policy reset to default for computer ${cid}.`);
3832
- }
3833
- // ── Webhooks ──────────────────────────────────────────────────────────
3834
- if (name === "webhook_list") {
3835
- const result = await client.apiGet("/api/v1/webhooks");
3836
- const items = listOf(result);
3837
- if (items.length === 0)
3838
- return ok("No webhooks found.");
3839
- const lines = ["Webhooks:"];
3840
- for (const w of items) {
3841
- const r = w;
3842
- lines.push(` ${r["id"]} ${r["url"]} events=${JSON.stringify(r["events"] ?? [])}`);
3843
- }
3844
- return ok(lines.join("\n"));
3845
- }
3846
- if (name === "webhook_create") {
3847
- const result = await client.apiPost("/api/v1/webhooks", {
3848
- url: args["url"],
3849
- events: args["events"],
3850
- });
3851
- const data = unwrapData(result);
3852
- return ok(`Created webhook (id=${data["id"] ?? "?"}).`);
3853
- }
3854
- if (name === "webhook_delete") {
3855
- const whId = String(args["webhook_id"] ?? "");
3856
- if (!whId)
3857
- return err("webhook_id is required");
3858
- await client.apiDelete(`/api/v1/webhooks/${encodeURIComponent(whId)}`);
3859
- return ok(`Webhook ${whId} deleted.`);
3860
- }
3861
- if (name === "webhook_test") {
3862
- const whId = String(args["webhook_id"] ?? "");
3863
- if (!whId)
3864
- return err("webhook_id is required");
3865
- const result = await client.apiPost(`/api/v1/webhooks/${encodeURIComponent(whId)}/test`, {});
3866
- const data = unwrapData(result);
3867
- const status = String(data["status"] ?? "delivered");
3868
- return ok(`Test event sent to webhook ${whId} (status=${status}).`);
3869
- }
3870
- // ── Functions ─────────────────────────────────────────────────────────
3871
- if (name === "function_list") {
3872
- const result = await client.apiGet("/api/v1/functions");
3873
- const items = listOf(result);
3874
- if (items.length === 0)
3875
- return ok("No functions found.");
3876
- const lines = ["Functions:"];
3877
- for (const f of items) {
3878
- const r = f;
3879
- lines.push(` ${r["id"]} ${r["name"]} runtime=${r["runtime"] ?? ""}`);
3880
- }
3881
- return ok(lines.join("\n"));
3882
- }
3883
- if (name === "function_create") {
3884
- const body = {
3885
- name: args["name"],
3886
- runtime: args["runtime"],
3887
- };
3888
- if (args["code"])
3889
- body["code"] = args["code"];
3890
- const result = await client.apiPost("/api/v1/functions", body);
3891
- const data = unwrapData(result);
3892
- return ok(`Created function '${data["name"] ?? args["name"]}' (id=${data["id"]}).`);
3893
- }
3894
- if (name === "function_invoke") {
3895
- const fnId = String(args["function_id"] ?? "");
3896
- if (!fnId)
3897
- return err("function_id is required");
3898
- const body = {};
3899
- if (args["payload"] !== undefined)
3900
- body["payload"] = args["payload"];
3901
- const result = await client.apiPost(`/api/v1/functions/${encodeURIComponent(fnId)}/invoke`, body);
3902
- return ok(JSON.stringify(unwrapData(result), null, 2));
3903
- }
3904
- if (name === "function_delete") {
3905
- const fnId = String(args["function_id"] ?? "");
3906
- if (!fnId)
3907
- return err("function_id is required");
3908
- await client.apiDelete(`/api/v1/functions/${encodeURIComponent(fnId)}`);
3909
- return ok(`Function ${fnId} deleted.`);
3910
- }
3911
- // ── API Keys ──────────────────────────────────────────────────────────
3912
- if (name === "api_key_list") {
3913
- const result = await client.apiGet("/api/v1/api-keys");
3914
- const items = listOf(result);
3915
- if (items.length === 0)
3916
- return ok("No API keys found.");
3917
- const lines = ["API keys:"];
3918
- for (const k of items) {
3919
- const r = k;
3920
- const scopes = Array.isArray(r["scopes"])
3921
- ? r["scopes"].join(", ")
3922
- : String(r["scopes"] ?? "");
3923
- lines.push(` ${r["id"]} ${r["name"]} scopes=[${scopes}]`);
3924
- }
3925
- return ok(lines.join("\n"));
3926
- }
3927
- if (name === "api_key_create") {
3928
- const body = { name: args["name"] };
3929
- if (args["scopes"])
3930
- body["scopes"] = args["scopes"];
3931
- const result = await client.apiPost("/api/v1/api-keys", body);
3932
- const data = unwrapData(result);
3933
- const keyId = String(data["id"] ?? "?");
3934
- const keyValue = String(data["key"] ?? data["token"] ?? data["secret"] ?? "");
3935
- let msg = `Created API key '${args["name"]}' (id=${keyId}).`;
3936
- if (keyValue)
3937
- msg += `\nKey value (shown once): ${keyValue}`;
3938
- return ok(msg);
3939
- }
3940
- if (name === "api_key_delete") {
3941
- const keyId = String(args["key_id"] ?? "");
3942
- if (!keyId)
3943
- return err("key_id is required");
3944
- await client.apiDelete(`/api/v1/api-keys/${encodeURIComponent(keyId)}`);
3945
- return ok(`API key ${keyId} deleted.`);
3946
- }
3947
- // ── Cron jobs ─────────────────────────────────────────────────────────
3948
- if (name === "cron_list") {
3949
- const params = new URLSearchParams();
3950
- if (args["computer_id"])
3951
- params.set("computer_id", String(args["computer_id"]));
3952
- const qs = params.toString() ? `?${params.toString()}` : "";
3953
- const result = await client.apiGet(`/api/v1/cron-jobs${qs}`);
3954
- const items = listOf(result);
3955
- if (items.length === 0)
3956
- return ok("No cron jobs found.");
3957
- const lines = ["Cron jobs:"];
3958
- for (const j of items) {
3959
- const r = j;
3960
- lines.push(` ${r["id"]} ${r["name"] ?? ""} ${r["schedule"] ?? ""} status=${r["status"] ?? r["state"] ?? ""}`);
3961
- }
3962
- return ok(lines.join("\n"));
3963
- }
3964
- if (name === "cron_create") {
3965
- const body = {
3966
- computer_id: args["computer_id"],
3967
- schedule: args["schedule"],
3968
- command: args["command"],
3969
- };
3970
- if (args["name"])
3971
- body["name"] = args["name"];
3972
- const result = await client.apiPost("/api/v1/cron-jobs", body);
3973
- const data = unwrapData(result);
3974
- return ok(`Created cron job '${data["name"] ?? args["name"] ?? ""}' (id=${data["id"]}).`);
3975
- }
3976
- if (name === "cron_get") {
3977
- const cronId = String(args["cron_id"] ?? "");
3978
- if (!cronId)
3979
- return err("cron_id is required");
3980
- const result = await client.apiGet(`/api/v1/cron-jobs/${encodeURIComponent(cronId)}`);
3981
- return ok(JSON.stringify(unwrapData(result), null, 2));
3982
- }
3983
- if (name === "cron_delete") {
3984
- const cronId = String(args["cron_id"] ?? "");
3985
- if (!cronId)
3986
- return err("cron_id is required");
3987
- await client.apiDelete(`/api/v1/cron-jobs/${encodeURIComponent(cronId)}`);
3988
- return ok(`Cron job ${cronId} deleted.`);
3989
- }
3990
- if (name === "cron_pause") {
3991
- const cronId = String(args["cron_id"] ?? "");
3992
- if (!cronId)
3993
- return err("cron_id is required");
3994
- await client.apiPost(`/api/v1/cron-jobs/${encodeURIComponent(cronId)}/pause`, {});
3995
- return ok(`Cron job ${cronId} paused.`);
3996
- }
3997
- if (name === "cron_resume") {
3998
- const cronId = String(args["cron_id"] ?? "");
3999
- if (!cronId)
4000
- return err("cron_id is required");
4001
- await client.apiPost(`/api/v1/cron-jobs/${encodeURIComponent(cronId)}/resume`, {});
4002
- return ok(`Cron job ${cronId} resumed.`);
4003
- }
4004
- if (name === "cron_run_now") {
4005
- const cronId = String(args["cron_id"] ?? "");
4006
- if (!cronId)
4007
- return err("cron_id is required");
4008
- const result = await client.apiPost(`/api/v1/cron-jobs/${encodeURIComponent(cronId)}/run-now`, {});
4009
- const data = unwrapData(result);
4010
- const execId = data["id"] ?? data["execution_id"];
4011
- return ok(`Cron job ${cronId} triggered.${execId ? ` Execution id=${execId}.` : ""}`);
4012
- }
4013
- if (name === "cron_executions") {
4014
- const cronId = String(args["cron_id"] ?? "");
4015
- if (!cronId)
4016
- return err("cron_id is required");
4017
- const result = await client.apiGet(`/api/v1/cron-jobs/${encodeURIComponent(cronId)}/executions`);
4018
- const items = listOf(result);
4019
- if (items.length === 0)
4020
- return ok("No executions found.");
4021
- const lines = ["Executions:"];
4022
- for (const e of items) {
4023
- const r = e;
4024
- lines.push(` ${r["id"]} ${r["started_at"] ?? r["created_at"] ?? ""} status=${r["status"] ?? ""} exit_code=${r["exit_code"] ?? ""}`);
4025
- }
4026
- return ok(lines.join("\n"));
4027
- }
4028
- // ── Regions ────────────────────────────────────────────────────────────
4029
- if (name === "region_list" || name === "computer_list_regions") {
4030
- const result = await client.apiGet("/api/v1/regions");
4031
- const regions = (() => {
4032
- const d = unwrapData(result);
4033
- if (Array.isArray(d))
4034
- return d;
4035
- const r = d;
4036
- for (const key of ["regions", "data", "items"]) {
4037
- if (Array.isArray(r[key]))
4038
- return r[key];
4039
- }
4040
- return Object.values(r);
4041
- })();
4042
- if (regions.length === 0)
4043
- return ok("No regions found.");
4044
- const lines = ["Regions:"];
4045
- for (const region of regions) {
4046
- const r = region;
4047
- const gpuTypes = r["gpu_types"] ?? r["gpus"] ?? [];
4048
- const gpuInfo = Array.isArray(gpuTypes) && gpuTypes.length > 0
4049
- ? ` gpus=${JSON.stringify(gpuTypes)}`
4050
- : "";
4051
- lines.push(` ${r["id"] ?? r["slug"] ?? ""} ${r["name"] ?? ""} status=${r["status"] ?? "available"}${gpuInfo}`);
4052
- }
4053
- return ok(lines.join("\n"));
4054
- }
4055
- // ── Computer templates ─────────────────────────────────────────────────
4056
- if (name === "computer_template_list") {
4057
- const wid = String(args["workspace_id"] ?? "");
4058
- if (!wid)
4059
- return err("workspace_id is required");
4060
- const result = await client.apiGet(`/api/v1/workspaces/${encodeURIComponent(wid)}/computer-templates`);
4061
- const items = listOf(result);
4062
- if (items.length === 0)
4063
- return ok("No computer templates found.");
4064
- const lines = ["Computer templates:"];
4065
- for (const t of items) {
4066
- const r = t;
4067
- lines.push(` ${r["id"]} ${r["name"]} type=${r["template_type"] ?? ""} size=${r["size"] ?? ""}`);
4068
- }
4069
- return ok(lines.join("\n"));
4070
- }
4071
- if (name === "computer_template_create") {
4072
- const wid = String(args["workspace_id"] ?? "");
4073
- if (!wid)
4074
- return err("workspace_id is required");
4075
- const body = { name: args["name"] };
4076
- if (args["template_type"])
4077
- body["template_type"] = args["template_type"];
4078
- if (args["size"])
4079
- body["size"] = args["size"];
4080
- if (args["selected_apps"])
4081
- body["selected_apps"] = args["selected_apps"];
4082
- if (args["settings"])
4083
- body["settings"] = args["settings"];
4084
- const result = await client.apiPost(`/api/v1/workspaces/${encodeURIComponent(wid)}/computer-templates`, body);
4085
- const data = unwrapData(result);
4086
- return ok(`Created computer template '${data["name"] ?? args["name"]}' (id=${data["id"]}).`);
4087
- }
4088
- // ── Settings ───────────────────────────────────────────────────────────
4089
- if (name === "settings_get") {
4090
- const result = await client.apiGet("/api/v1/settings");
4091
- return ok(JSON.stringify(unwrapData(result), null, 2));
4092
- }
4093
- if (name === "settings_get_branding") {
4094
- const result = await client.apiGet("/api/v1/settings/branding");
4095
- return ok(JSON.stringify(unwrapData(result), null, 2));
4096
- }
4097
- if (name === "settings_update_branding") {
4098
- const body = {};
4099
- if (args["desktop_wallpaper_url"])
4100
- body["desktop_wallpaper_url"] = args["desktop_wallpaper_url"];
4101
- if (args["logo_url"])
4102
- body["logo_url"] = args["logo_url"];
4103
- const result = await client.apiPut("/api/v1/settings/branding", body);
4104
- return ok(`Branding updated: ${JSON.stringify(unwrapData(result), null, 2)}`);
4105
- }
4106
- if (name === "settings_compute_pricing") {
4107
- const result = await client.apiGet("/api/v1/settings/compute-pricing");
4108
- return ok(JSON.stringify(unwrapData(result), null, 2));
4109
- }
4110
- // ── Sandbox template extensions ────────────────────────────────────────
4111
- if (name === "sandbox_template_get") {
4112
- const tid = String(args["template_id"] ?? "");
4113
- if (!tid)
4114
- return err("template_id is required");
4115
- const result = await client.apiGet(`/api/v1/sandbox-templates/${encodeURIComponent(tid)}`);
4116
- return ok(JSON.stringify(unwrapData(result), null, 2));
4117
- }
4118
- if (name === "sandbox_template_builds") {
4119
- const tid = String(args["template_id"] ?? "");
4120
- if (!tid)
4121
- return err("template_id is required");
4122
- const result = await client.apiGet(`/api/v1/sandbox-templates/${encodeURIComponent(tid)}/builds`);
4123
- const items = listOf(result);
4124
- if (items.length === 0)
4125
- return ok("No builds found.");
4126
- const lines = ["Builds:"];
4127
- for (const b of items) {
4128
- const r = b;
4129
- lines.push(` ${r["id"]} ${r["status"] ?? ""} created_at=${r["created_at"] ?? ""}`);
4130
- }
4131
- return ok(lines.join("\n"));
4132
- }
4133
- // ── Volumes ───────────────────────────────────────────────────────────
4134
- if (name === "volume_list") {
4135
- const result = await client.apiGet("/api/v1/volumes");
4136
- const items = listOf(result);
4137
- if (items.length === 0)
4138
- return ok("No volumes found.");
4139
- const lines = ["Volumes:"];
4140
- for (const v of items) {
4141
- const r = v;
4142
- lines.push(` ${r["id"]} ${r["name"]} size_gb=${r["size_gb"] ?? ""} region=${r["region"] ?? ""} status=${r["status"] ?? ""}`);
4143
- }
4144
- return ok(lines.join("\n"));
4145
- }
4146
- if (name === "volume_create") {
4147
- const body = { name: args["name"] };
4148
- if (args["size_gb"] !== undefined)
4149
- body["size_gb"] = args["size_gb"];
4150
- if (args["region"])
4151
- body["region"] = args["region"];
4152
- const result = await client.apiPost("/api/v1/volumes", body);
4153
- const data = unwrapData(result);
4154
- return ok(`Created volume '${data["name"] ?? args["name"]}' (id=${data["id"]}).`);
4155
- }
4156
- if (name === "volume_get") {
4157
- const vid = String(args["volume_id"] ?? "");
4158
- if (!vid)
4159
- return err("volume_id is required");
4160
- const result = await client.apiGet(`/api/v1/volumes/${encodeURIComponent(vid)}`);
4161
- const data = unwrapData(result);
4162
- return ok(`id=${data["id"]} name=${JSON.stringify(data["name"])} size_gb=${data["size_gb"] ?? ""} region=${data["region"] ?? ""} status=${data["status"] ?? ""}`);
4163
- }
4164
- if (name === "volume_delete") {
4165
- const vid = String(args["volume_id"] ?? "");
4166
- if (!vid)
4167
- return err("volume_id is required");
4168
- await client.apiDelete(`/api/v1/volumes/${encodeURIComponent(vid)}`);
4169
- return ok(`Volume ${vid} deleted.`);
4170
- }
4171
- if (name === "volume_attach") {
4172
- const attachCid = String(args["computer_id"] ?? "");
4173
- if (!attachCid)
4174
- return err("computer_id is required");
4175
- const attachBody = {
4176
- volume_id: args["volume_id"],
4177
- };
4178
- if (args["mount_path"])
4179
- attachBody["mount_path"] = args["mount_path"];
4180
- const result = await client.apiPost(`/api/v1/computers/${encodeURIComponent(attachCid)}/volumes`, attachBody);
4181
- const data = unwrapData(result);
4182
- return ok(`Volume ${args["volume_id"]} attached to computer ${attachCid} (attachment id=${data["id"] ?? "?"}).`);
4183
- }
4184
- if (name === "volume_detach") {
4185
- const detachCid = String(args["computer_id"] ?? "");
4186
- if (!detachCid)
4187
- return err("computer_id is required");
4188
- const attId = String(args["attachment_id"] ?? "");
4189
- if (!attId)
4190
- return err("attachment_id is required");
4191
- await client.apiDelete(`/api/v1/computers/${encodeURIComponent(detachCid)}/volumes/${encodeURIComponent(attId)}`);
4192
- return ok(`Attachment ${attId} removed from computer ${detachCid}.`);
4193
- }
4194
3082
  return err(`Unknown tool: ${name}`);
4195
3083
  }
4196
3084
  catch (e) {
@@ -4255,47 +3143,7 @@ async function runServer() {
4255
3143
  result: {
4256
3144
  protocolVersion: "2024-11-05",
4257
3145
  capabilities: { tools: {} },
4258
- serverInfo: { name: "miosa-mcp", version: "0.1.2" },
4259
- instructions: [
4260
- "MIOSA cloud infrastructure — Firecracker microVMs you control via API.",
4261
- "",
4262
- "## Concepts",
4263
- "- **Computer**: full Linux desktop VM (GUI, browser, apps). Use for visual tasks, browser automation, desktop control.",
4264
- "- **Sandbox**: headless Linux VM. Use for code execution, builds, CI, scripts. No desktop.",
4265
- "- **Deployment**: git-based app hosting with builds, releases, domains.",
4266
- "- **Storage**: S3-compatible object storage (buckets + objects).",
4267
- "- **Database**: managed Postgres, MySQL, or Redis.",
4268
- "- **Volume**: persistent block storage, attachable to computers.",
4269
- "",
4270
- "## Core workflows",
4271
- "",
4272
- "### Run code (sandbox)",
4273
- "create_sandbox → exec (or exec_python) → read output → destroy_sandbox",
4274
- "",
4275
- "### Desktop automation (computer)",
4276
- "computer_create → computer_screenshot → computer_click/type/key → computer_screenshot → repeat",
4277
- "",
4278
- "### Deploy an app",
4279
- "deployment_create(repo_url) → deployment_publish → custom_domain_add (optional)",
4280
- "",
4281
- "### Store files",
4282
- "storage_bucket_create → storage_object_upload → storage_object_presign (for public URL)",
4283
- "",
4284
- "### Provision a database",
4285
- 'database_create(engine="postgres") → database_credentials → use connection string',
4286
- "",
4287
- "## Conventions",
4288
- "- IDs: pass computer_id or sandbox_id to every tool that operates on a resource.",
4289
- "- Sizes: xs (1cpu/2GB), small (2cpu/4GB), medium (4cpu/8GB), large (8cpu/16GB), xl (16cpu/32GB).",
4290
- '- Status: "running" = ready. Poll with get/list until status is "running".',
4291
- "- File paths inside VMs: /workspace is the default working directory. /home/user also writable.",
4292
- "- exec timeout: default 30s. For installs (npm/pip), set timeout_ms=120000.",
4293
- "- Screenshots: PNG bytes, 1024x768 default. Coordinates are absolute pixels from top-left (0,0).",
4294
- "",
4295
- "## Tool naming",
4296
- "{resource}_{action} — e.g. computer_create, sandbox_exec, storage_bucket_list.",
4297
- "Desktop tools: computer_screenshot, computer_click, computer_type, computer_key, computer_scroll.",
4298
- ].join("\n"),
3146
+ serverInfo: { name: "miosa-mcp", version: "0.1.1" },
4299
3147
  },
4300
3148
  });
4301
3149
  break;