@asteroidai/cli 1.9.565 → 1.9.572

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/dist/asteroid.js CHANGED
@@ -1330,6 +1330,318 @@ var COMMANDS = [
1330
1330
  credentialOrganization: false
1331
1331
  }
1332
1332
  },
1333
+ {
1334
+ command: "dashboard create",
1335
+ tool: "dashboard_create",
1336
+ title: "Create dashboard",
1337
+ description: "Create a dashboard. The `spec` names the workflows to read (`sources`), how their execution results group into records (`records`: every item in `lists` with the same value at `key` is one record, `fields` are computed per record with `latest`, `first`, `count`, `countDistinct`, `collect`, `countBy` or `maxCount`, and `timeline` keeps each record's history), and the widgets (`view`: `stat`, `breakdown`, `segments`, `activity`, `table`). A table needs `columns` and takes `tabs`, `sort`, `limit` and `detail`, and a row opens the record's detail and history. A widget's `field` and `where` use names from `records.fields` or the built-ins `key`, `firstSeenAt`, `lastSeenAt`, `executions`, `current`, `lastList`. A spec that does not validate returns 400 with the path of each fault. Read the dashboard's data after to check the records. The response's `id` opens at /dashboards/<id>. Staff only.",
1338
+ method: "POST",
1339
+ path: "/agents/v2/dashboards",
1340
+ args: [],
1341
+ query: [],
1342
+ binary: false,
1343
+ readOnly: false,
1344
+ destructive: false,
1345
+ body: {
1346
+ required: true,
1347
+ contentType: "application/json",
1348
+ fields: [
1349
+ {
1350
+ name: "name",
1351
+ flag: "name",
1352
+ type: "string",
1353
+ required: true
1354
+ },
1355
+ {
1356
+ name: "spec",
1357
+ flag: "spec",
1358
+ type: "json",
1359
+ required: true,
1360
+ description: "What a dashboard reads, how it groups the results into records, and what it shows.",
1361
+ fields: [
1362
+ {
1363
+ name: "sources",
1364
+ flag: "sources",
1365
+ type: "json",
1366
+ required: false
1367
+ },
1368
+ {
1369
+ name: "records",
1370
+ flag: "records",
1371
+ type: "json",
1372
+ required: false,
1373
+ description: "How execution results group into records. Every item in `lists` that carries the same value at `key` belongs to one record.",
1374
+ fields: [
1375
+ {
1376
+ name: "key",
1377
+ flag: "key",
1378
+ type: "string",
1379
+ required: false,
1380
+ description: "Dot path on each item to the value that identifies the record, such as `referral_id`. An item without it is skipped."
1381
+ },
1382
+ {
1383
+ name: "lists",
1384
+ flag: "lists",
1385
+ type: "json",
1386
+ required: false
1387
+ },
1388
+ {
1389
+ name: "fields",
1390
+ flag: "fields",
1391
+ type: "json",
1392
+ required: false
1393
+ },
1394
+ {
1395
+ name: "timeline",
1396
+ flag: "timeline",
1397
+ type: "json",
1398
+ required: false,
1399
+ description: "Keeps each record's mentions, so a table row can show its history.",
1400
+ fields: [
1401
+ {
1402
+ name: "lists",
1403
+ flag: "lists",
1404
+ type: "string[]",
1405
+ required: false,
1406
+ description: "Keep only the items of these lists. Without it, the items of every list."
1407
+ },
1408
+ {
1409
+ name: "fields",
1410
+ flag: "fields",
1411
+ type: "json",
1412
+ required: false
1413
+ }
1414
+ ]
1415
+ }
1416
+ ]
1417
+ },
1418
+ {
1419
+ name: "view",
1420
+ flag: "view",
1421
+ type: "json",
1422
+ required: false,
1423
+ description: "The widgets, top to bottom. Stats that follow each other share a row."
1424
+ }
1425
+ ]
1426
+ }
1427
+ ],
1428
+ files: [],
1429
+ credentialOrganization: false
1430
+ },
1431
+ hidden: true
1432
+ },
1433
+ {
1434
+ command: "dashboard data",
1435
+ tool: "dashboard_data_get",
1436
+ title: "Get dashboard data",
1437
+ description: "Group the execution results of a dashboard's workflows into records over a time window (`window`, such as `24h` or `7d`, default `7d`). Returns one row per record with its field values, when it was first and last seen, how many executions mention it, and whether the latest execution still does. One read takes the 2,000 most recent executions of the window, and `truncated` says when older ones were left out. Use it to check a spec after you save it. Staff only.",
1438
+ method: "GET",
1439
+ path: "/agents/v2/dashboards/{dashboardId}/data",
1440
+ args: [
1441
+ {
1442
+ name: "dashboardId",
1443
+ flag: "dashboard-id",
1444
+ type: "string",
1445
+ required: true
1446
+ }
1447
+ ],
1448
+ query: [
1449
+ {
1450
+ name: "window",
1451
+ flag: "window",
1452
+ type: "string",
1453
+ required: false,
1454
+ description: "How far back to read, such as `24h` or `7d`. At most 31 days."
1455
+ }
1456
+ ],
1457
+ binary: false,
1458
+ readOnly: true,
1459
+ destructive: false,
1460
+ hidden: true
1461
+ },
1462
+ {
1463
+ command: "dashboard delete",
1464
+ tool: "dashboard_delete",
1465
+ title: "Delete dashboard",
1466
+ description: "Delete a dashboard. The executions it reads stay. Staff only.",
1467
+ method: "DELETE",
1468
+ path: "/agents/v2/dashboards/{dashboardId}",
1469
+ args: [
1470
+ {
1471
+ name: "dashboardId",
1472
+ flag: "dashboard-id",
1473
+ type: "string",
1474
+ required: true
1475
+ }
1476
+ ],
1477
+ query: [],
1478
+ binary: false,
1479
+ readOnly: false,
1480
+ destructive: true,
1481
+ hidden: true
1482
+ },
1483
+ {
1484
+ command: "dashboard get",
1485
+ tool: "dashboard_get",
1486
+ title: "Get dashboard",
1487
+ description: "Get one dashboard with its spec. Staff only.",
1488
+ method: "GET",
1489
+ path: "/agents/v2/dashboards/{dashboardId}",
1490
+ args: [
1491
+ {
1492
+ name: "dashboardId",
1493
+ flag: "dashboard-id",
1494
+ type: "string",
1495
+ required: true
1496
+ }
1497
+ ],
1498
+ query: [],
1499
+ binary: false,
1500
+ readOnly: true,
1501
+ destructive: false,
1502
+ hidden: true
1503
+ },
1504
+ {
1505
+ command: "dashboard list",
1506
+ tool: "dashboards_list",
1507
+ title: "List dashboards",
1508
+ description: "List an organization's dashboards, most recently updated first. A dashboard is a page of widgets over the records one or more workflows produce, such as referrals. Filter to the dashboards that read one workflow with `workflowId`. Staff only.",
1509
+ method: "GET",
1510
+ path: "/agents/v2/dashboards",
1511
+ args: [],
1512
+ query: [
1513
+ {
1514
+ name: "workflowId",
1515
+ flag: "workflow-id",
1516
+ type: "string",
1517
+ required: false,
1518
+ description: "Only dashboards that read this workflow."
1519
+ },
1520
+ {
1521
+ name: "pageSize",
1522
+ flag: "page-size",
1523
+ type: "integer",
1524
+ required: false
1525
+ },
1526
+ {
1527
+ name: "page",
1528
+ flag: "page",
1529
+ type: "integer",
1530
+ required: false
1531
+ }
1532
+ ],
1533
+ binary: false,
1534
+ readOnly: true,
1535
+ destructive: false,
1536
+ hidden: true
1537
+ },
1538
+ {
1539
+ command: "dashboard update",
1540
+ tool: "dashboard_update",
1541
+ title: "Update dashboard",
1542
+ description: "Replace a dashboard's name and spec. Send the whole spec: get the dashboard, change its spec, and send it back. The `spec` names the workflows to read (`sources`), how their execution results group into records (`records`: every item in `lists` with the same value at `key` is one record, `fields` are computed per record with `latest`, `first`, `count`, `countDistinct`, `collect`, `countBy` or `maxCount`, and `timeline` keeps each record's history), and the widgets (`view`: `stat`, `breakdown`, `segments`, `activity`, `table`). A table needs `columns` and takes `tabs`, `sort`, `limit` and `detail`, and a row opens the record's detail and history. A widget's `field` and `where` use names from `records.fields` or the built-ins `key`, `firstSeenAt`, `lastSeenAt`, `executions`, `current`, `lastList`. A spec that does not validate returns 400 with the path of each fault. Staff only.",
1543
+ method: "PUT",
1544
+ path: "/agents/v2/dashboards/{dashboardId}",
1545
+ args: [
1546
+ {
1547
+ name: "dashboardId",
1548
+ flag: "dashboard-id",
1549
+ type: "string",
1550
+ required: true
1551
+ }
1552
+ ],
1553
+ query: [],
1554
+ binary: false,
1555
+ readOnly: false,
1556
+ destructive: false,
1557
+ body: {
1558
+ required: true,
1559
+ contentType: "application/json",
1560
+ fields: [
1561
+ {
1562
+ name: "name",
1563
+ flag: "name",
1564
+ type: "string",
1565
+ required: true
1566
+ },
1567
+ {
1568
+ name: "spec",
1569
+ flag: "spec",
1570
+ type: "json",
1571
+ required: true,
1572
+ description: "What a dashboard reads, how it groups the results into records, and what it shows.",
1573
+ fields: [
1574
+ {
1575
+ name: "sources",
1576
+ flag: "sources",
1577
+ type: "json",
1578
+ required: false
1579
+ },
1580
+ {
1581
+ name: "records",
1582
+ flag: "records",
1583
+ type: "json",
1584
+ required: false,
1585
+ description: "How execution results group into records. Every item in `lists` that carries the same value at `key` belongs to one record.",
1586
+ fields: [
1587
+ {
1588
+ name: "key",
1589
+ flag: "key",
1590
+ type: "string",
1591
+ required: false,
1592
+ description: "Dot path on each item to the value that identifies the record, such as `referral_id`. An item without it is skipped."
1593
+ },
1594
+ {
1595
+ name: "lists",
1596
+ flag: "lists",
1597
+ type: "json",
1598
+ required: false
1599
+ },
1600
+ {
1601
+ name: "fields",
1602
+ flag: "fields",
1603
+ type: "json",
1604
+ required: false
1605
+ },
1606
+ {
1607
+ name: "timeline",
1608
+ flag: "timeline",
1609
+ type: "json",
1610
+ required: false,
1611
+ description: "Keeps each record's mentions, so a table row can show its history.",
1612
+ fields: [
1613
+ {
1614
+ name: "lists",
1615
+ flag: "lists",
1616
+ type: "string[]",
1617
+ required: false,
1618
+ description: "Keep only the items of these lists. Without it, the items of every list."
1619
+ },
1620
+ {
1621
+ name: "fields",
1622
+ flag: "fields",
1623
+ type: "json",
1624
+ required: false
1625
+ }
1626
+ ]
1627
+ }
1628
+ ]
1629
+ },
1630
+ {
1631
+ name: "view",
1632
+ flag: "view",
1633
+ type: "json",
1634
+ required: false,
1635
+ description: "The widgets, top to bottom. Stats that follow each other share a row."
1636
+ }
1637
+ ]
1638
+ }
1639
+ ],
1640
+ files: [],
1641
+ credentialOrganization: false
1642
+ },
1643
+ hidden: true
1644
+ },
1333
1645
  {
1334
1646
  command: "docs search",
1335
1647
  tool: "search_docs",
@@ -1365,6 +1677,26 @@ var COMMANDS = [
1365
1677
  credentialOrganization: false
1366
1678
  }
1367
1679
  },
1680
+ {
1681
+ command: "environment current-snapshot",
1682
+ tool: "environment_current_snapshot",
1683
+ title: "Get an environment's current snapshot",
1684
+ description: "Read the snapshot version a live environment's machine holds, with its changelog and, when one is on record and the snapshot is not shared, its recipe, before you capture it again. Edit that recipe for the next capture rather than writing it again. No `recipe` means none is on record or the snapshot is shared: the next capture must send a full recipe. When `newerVersion` is set, the snapshot has a version newer than this machine's, and a capture from this machine would drop that version's changes: boot the newer version first. 404 when the machine holds an image the registry does not know.",
1685
+ method: "GET",
1686
+ path: "/agents/v2/environments/{environmentId}/current-snapshot",
1687
+ args: [
1688
+ {
1689
+ name: "environmentId",
1690
+ flag: "environment-id",
1691
+ type: "string",
1692
+ required: true
1693
+ }
1694
+ ],
1695
+ query: [],
1696
+ binary: false,
1697
+ readOnly: true,
1698
+ destructive: false
1699
+ },
1368
1700
  {
1369
1701
  command: "environment get",
1370
1702
  tool: "environment_get",
@@ -1414,6 +1746,75 @@ var COMMANDS = [
1414
1746
  readOnly: true,
1415
1747
  destructive: false
1416
1748
  },
1749
+ {
1750
+ command: "environment snapshot",
1751
+ tool: "environment_snapshot",
1752
+ title: "Snapshot live environment",
1753
+ description: "Capture a live OS environment into a reusable snapshot of your organization, and wait for it to finish. The environment must be ready. A browser environment cannot be captured. Capturing under a `displayName` your organization already uses adds the next version to that snapshot. Windows is imaged with its memory and keeps running. Linux and Citrix are stopped, imaged and started again, which ends the session: `restarted` says so, and the screen is back to its boot state. Takes minutes. Call it once and never retry: a second call captures again and adds another version. If the request gives up or times out, the capture still completes: find its version with `environment_snapshot_get` or `environment_snapshots_list`. Build every snapshot on a base: the shared Windows, Linux or Citrix image, such as `linux-base`. For a new snapshot, boot the base's newest version. To change a snapshot, boot its newest version and capture under the same `displayName`. Never start a new snapshot from another snapshot, your own or shared: its recipe would then depend on that snapshot. Read `environment_current_snapshot` first and edit its recipe. `recipe` is markdown that lets a session with no other context rebuild this exact image on a fresh base: a `## Install` section with the scripted steps as code blocks and any GUI steps as prose, in order, a `## Boot state` section with what is open, signed in and on screen at boot, and optionally `## Notes`. It replaces the old recipe, so cover what the booted image already had. Never write a password, token or other secret in it. `changelog` says in a sentence or two what this capture changed. To boot from the snapshot, set its `name` as `snapshotName` on a custom environment's OS base and bind the workflow to that environment. Set `propose` to store it as a pre-release such as `1.4.0-rc.1` instead of the next version: pin that to test it, then accept or dismiss it with `environment_snapshot_proposal_accept` or `environment_snapshot_proposal_dismiss`. `public` is for Asteroid staff only. Needs a plan that includes building snapshots and the environment's operating system.",
1754
+ method: "POST",
1755
+ path: "/agents/v2/environments/{environmentId}/snapshot",
1756
+ args: [
1757
+ {
1758
+ name: "environmentId",
1759
+ flag: "environment-id",
1760
+ type: "string",
1761
+ required: true
1762
+ }
1763
+ ],
1764
+ query: [],
1765
+ binary: false,
1766
+ readOnly: false,
1767
+ destructive: false,
1768
+ body: {
1769
+ required: true,
1770
+ contentType: "application/json",
1771
+ fields: [
1772
+ {
1773
+ name: "displayName",
1774
+ flag: "display-name",
1775
+ type: "string",
1776
+ required: true,
1777
+ description: "Display name for the snapshot. Capturing under a name the organisation already uses adds the next version to it."
1778
+ },
1779
+ {
1780
+ name: "description",
1781
+ flag: "description",
1782
+ type: "string",
1783
+ required: false
1784
+ },
1785
+ {
1786
+ name: "public",
1787
+ flag: "public",
1788
+ type: "boolean",
1789
+ required: false,
1790
+ description: "Publish the snapshot to every organisation instead of keeping it to the caller's. A published snapshot is owned by nobody, and its image is named without an organisation prefix, so this cannot be decided after the capture. Asteroid staff only, and rejected on the internal surface."
1791
+ },
1792
+ {
1793
+ name: "propose",
1794
+ flag: "propose",
1795
+ type: "boolean",
1796
+ required: false,
1797
+ description: "Store the capture as a proposal, not as the next version. It takes a pre-release such as `1.4.0-rc.1`, which only an exact pin boots. Test it by that pin, then accept or dismiss it. It changes the version the machine booted, which must be the latest. A proposal for a shared snapshot is Asteroid staff only. Rejected on the internal surface."
1798
+ },
1799
+ {
1800
+ name: "recipe",
1801
+ flag: "recipe",
1802
+ type: "string",
1803
+ required: false,
1804
+ description: "Markdown that lets a session rebuild this image on a fresh base. It must have a `## Install` and a `## Boot state` section, each with a body, and may have `## Notes`. No frontmatter. Omit it to keep the recipe of the version the machine booted, when that version is of the same snapshot."
1805
+ },
1806
+ {
1807
+ name: "changelog",
1808
+ flag: "changelog",
1809
+ type: "string",
1810
+ required: false,
1811
+ description: "What this capture changed, for the version list."
1812
+ }
1813
+ ],
1814
+ files: [],
1815
+ credentialOrganization: false
1816
+ }
1817
+ },
1417
1818
  {
1418
1819
  command: "environment start",
1419
1820
  tool: "environment_start",
@@ -1533,6 +1934,100 @@ var COMMANDS = [
1533
1934
  credentialOrganization: false
1534
1935
  }
1535
1936
  },
1937
+ {
1938
+ command: "environment-snapshot get",
1939
+ tool: "environment_snapshot_get",
1940
+ title: "Get snapshot",
1941
+ description: "Read one snapshot by ID with its versions, newest first: each version's changelog, its recipe unless the snapshot is shared, and the profile the captured machine ran with. Use it to find the version a capture landed as.",
1942
+ method: "GET",
1943
+ path: "/agents/v2/environment-snapshots/{snapshotId}",
1944
+ args: [
1945
+ {
1946
+ name: "snapshotId",
1947
+ flag: "snapshot-id",
1948
+ type: "string",
1949
+ required: true
1950
+ }
1951
+ ],
1952
+ query: [],
1953
+ binary: false,
1954
+ readOnly: true,
1955
+ destructive: false
1956
+ },
1957
+ {
1958
+ command: "environment-snapshot list",
1959
+ tool: "environment_snapshots_list",
1960
+ title: "List snapshots",
1961
+ description: "List the snapshots your organization can boot an environment from: its own, then the shared ones, each with its versions newest first. A version carries its changelog, and its recipe unless the snapshot is shared. Only operating systems your plan includes are listed. Narrow with `osType`. Boot one by setting its `name` as `snapshotName` on a custom environment's OS base: a bare `name` boots the newest version, `name:1.2` the newest 1.2 patch, `name:1.2.0` that version.",
1962
+ method: "GET",
1963
+ path: "/agents/v2/environment-snapshots",
1964
+ args: [],
1965
+ query: [
1966
+ {
1967
+ name: "osType",
1968
+ flag: "os-type",
1969
+ type: "string",
1970
+ required: false,
1971
+ description: "Only snapshots that boot this operating system. Omit for every operating system.",
1972
+ enum: ["linux", "windows", "citrix"]
1973
+ }
1974
+ ],
1975
+ binary: false,
1976
+ readOnly: true,
1977
+ destructive: false
1978
+ },
1979
+ {
1980
+ command: "environment-snapshot proposal accept",
1981
+ tool: "environment_snapshot_proposal_accept",
1982
+ title: "Accept snapshot proposal",
1983
+ description: "Release a proposed snapshot version, so `1.4.0-rc.1` becomes `1.4.0`. Workflows that boot the snapshot by bare name, or by a minor pin such as `name:1.4`, boot it from then on; an exact pin such as `name:1.3.0` does not move. Test the proposal first by pinning its pre-release. Find proposals in `environment_snapshot_get`. Only your organization's own snapshots.",
1984
+ method: "POST",
1985
+ path: "/agents/v2/environment-snapshots/{snapshotId}/proposals/{proposalId}/accept",
1986
+ args: [
1987
+ {
1988
+ name: "snapshotId",
1989
+ flag: "snapshot-id",
1990
+ type: "string",
1991
+ required: true
1992
+ },
1993
+ {
1994
+ name: "proposalId",
1995
+ flag: "proposal-id",
1996
+ type: "string",
1997
+ required: true
1998
+ }
1999
+ ],
2000
+ query: [],
2001
+ binary: false,
2002
+ readOnly: false,
2003
+ destructive: false
2004
+ },
2005
+ {
2006
+ command: "environment-snapshot proposal dismiss",
2007
+ tool: "environment_snapshot_proposal_dismiss",
2008
+ title: "Dismiss snapshot proposal",
2009
+ description: "Close a proposed snapshot version without releasing it. Its pre-release pin stops being offered. Only your organization's own snapshots.",
2010
+ method: "POST",
2011
+ path: "/agents/v2/environment-snapshots/{snapshotId}/proposals/{proposalId}/dismiss",
2012
+ args: [
2013
+ {
2014
+ name: "snapshotId",
2015
+ flag: "snapshot-id",
2016
+ type: "string",
2017
+ required: true
2018
+ },
2019
+ {
2020
+ name: "proposalId",
2021
+ flag: "proposal-id",
2022
+ type: "string",
2023
+ required: true
2024
+ }
2025
+ ],
2026
+ query: [],
2027
+ binary: false,
2028
+ readOnly: false,
2029
+ destructive: false
2030
+ },
1536
2031
  {
1537
2032
  command: "event-type list",
1538
2033
  tool: "event_types_list",
@@ -8252,10 +8747,10 @@ function splitDotted(argv2) {
8252
8747
  }
8253
8748
  return { argv: rest, dotted: dotted2 };
8254
8749
  }
8255
- function group(parent, name, groups, path) {
8750
+ function group(parent, name, groups, path, hidden = false) {
8256
8751
  const existing = groups.get(path);
8257
8752
  if (existing) return existing;
8258
- const created = parent.command(name).description(`${name} commands`).helpCommand(false);
8753
+ const created = parent.command(name, { hidden }).description(`${name} commands`).helpCommand(false);
8259
8754
  groups.set(path, created);
8260
8755
  return created;
8261
8756
  }
@@ -8362,14 +8857,21 @@ function defineCommands(root, options, dotted2 = /* @__PURE__ */ new Map(), onIn
8362
8857
  });
8363
8858
  }
8364
8859
  const reserved = new Set((options.builtins ?? []).map((b) => b.command));
8860
+ const shown = new Set(
8861
+ options.commands.filter((command) => !command.hidden).flatMap((command) => {
8862
+ const words = command.command.split(" ");
8863
+ return words.slice(1).map((_, i) => words.slice(0, i + 1).join(" "));
8864
+ })
8865
+ );
8365
8866
  for (const command of options.commands) {
8366
8867
  if (reserved.has(command.command)) continue;
8367
8868
  const words = command.command.split(" ");
8368
8869
  let parent = root;
8369
8870
  for (let i = 0; i < words.length - 1; i++) {
8370
- parent = group(parent, words[i], groups, words.slice(0, i + 1).join(" "));
8871
+ const path = words.slice(0, i + 1).join(" ");
8872
+ parent = group(parent, words[i], groups, path, !shown.has(path));
8371
8873
  }
8372
- const leaf = parent.command(words.at(-1)).description(command.description).summary(command.title);
8874
+ const leaf = parent.command(words.at(-1), { hidden: command.hidden }).description(command.description).summary(command.title);
8373
8875
  const defaults = command.args.map(
8374
8876
  (arg) => options.defaultArg?.(command, arg)
8375
8877
  );
@@ -8926,7 +9428,7 @@ var ApiError = class extends Error {
8926
9428
  status;
8927
9429
  body;
8928
9430
  };
8929
- var VERSION = "1.9.565";
9431
+ var VERSION = "1.9.572";
8930
9432
  function problem(status, body, fallback) {
8931
9433
  if (body && typeof body === "object") {
8932
9434
  const record2 = body;
package/dist/core.js CHANGED
@@ -1351,6 +1351,318 @@ var COMMANDS = [
1351
1351
  credentialOrganization: false
1352
1352
  }
1353
1353
  },
1354
+ {
1355
+ command: "dashboard create",
1356
+ tool: "dashboard_create",
1357
+ title: "Create dashboard",
1358
+ description: "Create a dashboard. The `spec` names the workflows to read (`sources`), how their execution results group into records (`records`: every item in `lists` with the same value at `key` is one record, `fields` are computed per record with `latest`, `first`, `count`, `countDistinct`, `collect`, `countBy` or `maxCount`, and `timeline` keeps each record's history), and the widgets (`view`: `stat`, `breakdown`, `segments`, `activity`, `table`). A table needs `columns` and takes `tabs`, `sort`, `limit` and `detail`, and a row opens the record's detail and history. A widget's `field` and `where` use names from `records.fields` or the built-ins `key`, `firstSeenAt`, `lastSeenAt`, `executions`, `current`, `lastList`. A spec that does not validate returns 400 with the path of each fault. Read the dashboard's data after to check the records. The response's `id` opens at /dashboards/<id>. Staff only.",
1359
+ method: "POST",
1360
+ path: "/agents/v2/dashboards",
1361
+ args: [],
1362
+ query: [],
1363
+ binary: false,
1364
+ readOnly: false,
1365
+ destructive: false,
1366
+ body: {
1367
+ required: true,
1368
+ contentType: "application/json",
1369
+ fields: [
1370
+ {
1371
+ name: "name",
1372
+ flag: "name",
1373
+ type: "string",
1374
+ required: true
1375
+ },
1376
+ {
1377
+ name: "spec",
1378
+ flag: "spec",
1379
+ type: "json",
1380
+ required: true,
1381
+ description: "What a dashboard reads, how it groups the results into records, and what it shows.",
1382
+ fields: [
1383
+ {
1384
+ name: "sources",
1385
+ flag: "sources",
1386
+ type: "json",
1387
+ required: false
1388
+ },
1389
+ {
1390
+ name: "records",
1391
+ flag: "records",
1392
+ type: "json",
1393
+ required: false,
1394
+ description: "How execution results group into records. Every item in `lists` that carries the same value at `key` belongs to one record.",
1395
+ fields: [
1396
+ {
1397
+ name: "key",
1398
+ flag: "key",
1399
+ type: "string",
1400
+ required: false,
1401
+ description: "Dot path on each item to the value that identifies the record, such as `referral_id`. An item without it is skipped."
1402
+ },
1403
+ {
1404
+ name: "lists",
1405
+ flag: "lists",
1406
+ type: "json",
1407
+ required: false
1408
+ },
1409
+ {
1410
+ name: "fields",
1411
+ flag: "fields",
1412
+ type: "json",
1413
+ required: false
1414
+ },
1415
+ {
1416
+ name: "timeline",
1417
+ flag: "timeline",
1418
+ type: "json",
1419
+ required: false,
1420
+ description: "Keeps each record's mentions, so a table row can show its history.",
1421
+ fields: [
1422
+ {
1423
+ name: "lists",
1424
+ flag: "lists",
1425
+ type: "string[]",
1426
+ required: false,
1427
+ description: "Keep only the items of these lists. Without it, the items of every list."
1428
+ },
1429
+ {
1430
+ name: "fields",
1431
+ flag: "fields",
1432
+ type: "json",
1433
+ required: false
1434
+ }
1435
+ ]
1436
+ }
1437
+ ]
1438
+ },
1439
+ {
1440
+ name: "view",
1441
+ flag: "view",
1442
+ type: "json",
1443
+ required: false,
1444
+ description: "The widgets, top to bottom. Stats that follow each other share a row."
1445
+ }
1446
+ ]
1447
+ }
1448
+ ],
1449
+ files: [],
1450
+ credentialOrganization: false
1451
+ },
1452
+ hidden: true
1453
+ },
1454
+ {
1455
+ command: "dashboard data",
1456
+ tool: "dashboard_data_get",
1457
+ title: "Get dashboard data",
1458
+ description: "Group the execution results of a dashboard's workflows into records over a time window (`window`, such as `24h` or `7d`, default `7d`). Returns one row per record with its field values, when it was first and last seen, how many executions mention it, and whether the latest execution still does. One read takes the 2,000 most recent executions of the window, and `truncated` says when older ones were left out. Use it to check a spec after you save it. Staff only.",
1459
+ method: "GET",
1460
+ path: "/agents/v2/dashboards/{dashboardId}/data",
1461
+ args: [
1462
+ {
1463
+ name: "dashboardId",
1464
+ flag: "dashboard-id",
1465
+ type: "string",
1466
+ required: true
1467
+ }
1468
+ ],
1469
+ query: [
1470
+ {
1471
+ name: "window",
1472
+ flag: "window",
1473
+ type: "string",
1474
+ required: false,
1475
+ description: "How far back to read, such as `24h` or `7d`. At most 31 days."
1476
+ }
1477
+ ],
1478
+ binary: false,
1479
+ readOnly: true,
1480
+ destructive: false,
1481
+ hidden: true
1482
+ },
1483
+ {
1484
+ command: "dashboard delete",
1485
+ tool: "dashboard_delete",
1486
+ title: "Delete dashboard",
1487
+ description: "Delete a dashboard. The executions it reads stay. Staff only.",
1488
+ method: "DELETE",
1489
+ path: "/agents/v2/dashboards/{dashboardId}",
1490
+ args: [
1491
+ {
1492
+ name: "dashboardId",
1493
+ flag: "dashboard-id",
1494
+ type: "string",
1495
+ required: true
1496
+ }
1497
+ ],
1498
+ query: [],
1499
+ binary: false,
1500
+ readOnly: false,
1501
+ destructive: true,
1502
+ hidden: true
1503
+ },
1504
+ {
1505
+ command: "dashboard get",
1506
+ tool: "dashboard_get",
1507
+ title: "Get dashboard",
1508
+ description: "Get one dashboard with its spec. Staff only.",
1509
+ method: "GET",
1510
+ path: "/agents/v2/dashboards/{dashboardId}",
1511
+ args: [
1512
+ {
1513
+ name: "dashboardId",
1514
+ flag: "dashboard-id",
1515
+ type: "string",
1516
+ required: true
1517
+ }
1518
+ ],
1519
+ query: [],
1520
+ binary: false,
1521
+ readOnly: true,
1522
+ destructive: false,
1523
+ hidden: true
1524
+ },
1525
+ {
1526
+ command: "dashboard list",
1527
+ tool: "dashboards_list",
1528
+ title: "List dashboards",
1529
+ description: "List an organization's dashboards, most recently updated first. A dashboard is a page of widgets over the records one or more workflows produce, such as referrals. Filter to the dashboards that read one workflow with `workflowId`. Staff only.",
1530
+ method: "GET",
1531
+ path: "/agents/v2/dashboards",
1532
+ args: [],
1533
+ query: [
1534
+ {
1535
+ name: "workflowId",
1536
+ flag: "workflow-id",
1537
+ type: "string",
1538
+ required: false,
1539
+ description: "Only dashboards that read this workflow."
1540
+ },
1541
+ {
1542
+ name: "pageSize",
1543
+ flag: "page-size",
1544
+ type: "integer",
1545
+ required: false
1546
+ },
1547
+ {
1548
+ name: "page",
1549
+ flag: "page",
1550
+ type: "integer",
1551
+ required: false
1552
+ }
1553
+ ],
1554
+ binary: false,
1555
+ readOnly: true,
1556
+ destructive: false,
1557
+ hidden: true
1558
+ },
1559
+ {
1560
+ command: "dashboard update",
1561
+ tool: "dashboard_update",
1562
+ title: "Update dashboard",
1563
+ description: "Replace a dashboard's name and spec. Send the whole spec: get the dashboard, change its spec, and send it back. The `spec` names the workflows to read (`sources`), how their execution results group into records (`records`: every item in `lists` with the same value at `key` is one record, `fields` are computed per record with `latest`, `first`, `count`, `countDistinct`, `collect`, `countBy` or `maxCount`, and `timeline` keeps each record's history), and the widgets (`view`: `stat`, `breakdown`, `segments`, `activity`, `table`). A table needs `columns` and takes `tabs`, `sort`, `limit` and `detail`, and a row opens the record's detail and history. A widget's `field` and `where` use names from `records.fields` or the built-ins `key`, `firstSeenAt`, `lastSeenAt`, `executions`, `current`, `lastList`. A spec that does not validate returns 400 with the path of each fault. Staff only.",
1564
+ method: "PUT",
1565
+ path: "/agents/v2/dashboards/{dashboardId}",
1566
+ args: [
1567
+ {
1568
+ name: "dashboardId",
1569
+ flag: "dashboard-id",
1570
+ type: "string",
1571
+ required: true
1572
+ }
1573
+ ],
1574
+ query: [],
1575
+ binary: false,
1576
+ readOnly: false,
1577
+ destructive: false,
1578
+ body: {
1579
+ required: true,
1580
+ contentType: "application/json",
1581
+ fields: [
1582
+ {
1583
+ name: "name",
1584
+ flag: "name",
1585
+ type: "string",
1586
+ required: true
1587
+ },
1588
+ {
1589
+ name: "spec",
1590
+ flag: "spec",
1591
+ type: "json",
1592
+ required: true,
1593
+ description: "What a dashboard reads, how it groups the results into records, and what it shows.",
1594
+ fields: [
1595
+ {
1596
+ name: "sources",
1597
+ flag: "sources",
1598
+ type: "json",
1599
+ required: false
1600
+ },
1601
+ {
1602
+ name: "records",
1603
+ flag: "records",
1604
+ type: "json",
1605
+ required: false,
1606
+ description: "How execution results group into records. Every item in `lists` that carries the same value at `key` belongs to one record.",
1607
+ fields: [
1608
+ {
1609
+ name: "key",
1610
+ flag: "key",
1611
+ type: "string",
1612
+ required: false,
1613
+ description: "Dot path on each item to the value that identifies the record, such as `referral_id`. An item without it is skipped."
1614
+ },
1615
+ {
1616
+ name: "lists",
1617
+ flag: "lists",
1618
+ type: "json",
1619
+ required: false
1620
+ },
1621
+ {
1622
+ name: "fields",
1623
+ flag: "fields",
1624
+ type: "json",
1625
+ required: false
1626
+ },
1627
+ {
1628
+ name: "timeline",
1629
+ flag: "timeline",
1630
+ type: "json",
1631
+ required: false,
1632
+ description: "Keeps each record's mentions, so a table row can show its history.",
1633
+ fields: [
1634
+ {
1635
+ name: "lists",
1636
+ flag: "lists",
1637
+ type: "string[]",
1638
+ required: false,
1639
+ description: "Keep only the items of these lists. Without it, the items of every list."
1640
+ },
1641
+ {
1642
+ name: "fields",
1643
+ flag: "fields",
1644
+ type: "json",
1645
+ required: false
1646
+ }
1647
+ ]
1648
+ }
1649
+ ]
1650
+ },
1651
+ {
1652
+ name: "view",
1653
+ flag: "view",
1654
+ type: "json",
1655
+ required: false,
1656
+ description: "The widgets, top to bottom. Stats that follow each other share a row."
1657
+ }
1658
+ ]
1659
+ }
1660
+ ],
1661
+ files: [],
1662
+ credentialOrganization: false
1663
+ },
1664
+ hidden: true
1665
+ },
1354
1666
  {
1355
1667
  command: "docs search",
1356
1668
  tool: "search_docs",
@@ -1386,6 +1698,26 @@ var COMMANDS = [
1386
1698
  credentialOrganization: false
1387
1699
  }
1388
1700
  },
1701
+ {
1702
+ command: "environment current-snapshot",
1703
+ tool: "environment_current_snapshot",
1704
+ title: "Get an environment's current snapshot",
1705
+ description: "Read the snapshot version a live environment's machine holds, with its changelog and, when one is on record and the snapshot is not shared, its recipe, before you capture it again. Edit that recipe for the next capture rather than writing it again. No `recipe` means none is on record or the snapshot is shared: the next capture must send a full recipe. When `newerVersion` is set, the snapshot has a version newer than this machine's, and a capture from this machine would drop that version's changes: boot the newer version first. 404 when the machine holds an image the registry does not know.",
1706
+ method: "GET",
1707
+ path: "/agents/v2/environments/{environmentId}/current-snapshot",
1708
+ args: [
1709
+ {
1710
+ name: "environmentId",
1711
+ flag: "environment-id",
1712
+ type: "string",
1713
+ required: true
1714
+ }
1715
+ ],
1716
+ query: [],
1717
+ binary: false,
1718
+ readOnly: true,
1719
+ destructive: false
1720
+ },
1389
1721
  {
1390
1722
  command: "environment get",
1391
1723
  tool: "environment_get",
@@ -1435,6 +1767,75 @@ var COMMANDS = [
1435
1767
  readOnly: true,
1436
1768
  destructive: false
1437
1769
  },
1770
+ {
1771
+ command: "environment snapshot",
1772
+ tool: "environment_snapshot",
1773
+ title: "Snapshot live environment",
1774
+ description: "Capture a live OS environment into a reusable snapshot of your organization, and wait for it to finish. The environment must be ready. A browser environment cannot be captured. Capturing under a `displayName` your organization already uses adds the next version to that snapshot. Windows is imaged with its memory and keeps running. Linux and Citrix are stopped, imaged and started again, which ends the session: `restarted` says so, and the screen is back to its boot state. Takes minutes. Call it once and never retry: a second call captures again and adds another version. If the request gives up or times out, the capture still completes: find its version with `environment_snapshot_get` or `environment_snapshots_list`. Build every snapshot on a base: the shared Windows, Linux or Citrix image, such as `linux-base`. For a new snapshot, boot the base's newest version. To change a snapshot, boot its newest version and capture under the same `displayName`. Never start a new snapshot from another snapshot, your own or shared: its recipe would then depend on that snapshot. Read `environment_current_snapshot` first and edit its recipe. `recipe` is markdown that lets a session with no other context rebuild this exact image on a fresh base: a `## Install` section with the scripted steps as code blocks and any GUI steps as prose, in order, a `## Boot state` section with what is open, signed in and on screen at boot, and optionally `## Notes`. It replaces the old recipe, so cover what the booted image already had. Never write a password, token or other secret in it. `changelog` says in a sentence or two what this capture changed. To boot from the snapshot, set its `name` as `snapshotName` on a custom environment's OS base and bind the workflow to that environment. Set `propose` to store it as a pre-release such as `1.4.0-rc.1` instead of the next version: pin that to test it, then accept or dismiss it with `environment_snapshot_proposal_accept` or `environment_snapshot_proposal_dismiss`. `public` is for Asteroid staff only. Needs a plan that includes building snapshots and the environment's operating system.",
1775
+ method: "POST",
1776
+ path: "/agents/v2/environments/{environmentId}/snapshot",
1777
+ args: [
1778
+ {
1779
+ name: "environmentId",
1780
+ flag: "environment-id",
1781
+ type: "string",
1782
+ required: true
1783
+ }
1784
+ ],
1785
+ query: [],
1786
+ binary: false,
1787
+ readOnly: false,
1788
+ destructive: false,
1789
+ body: {
1790
+ required: true,
1791
+ contentType: "application/json",
1792
+ fields: [
1793
+ {
1794
+ name: "displayName",
1795
+ flag: "display-name",
1796
+ type: "string",
1797
+ required: true,
1798
+ description: "Display name for the snapshot. Capturing under a name the organisation already uses adds the next version to it."
1799
+ },
1800
+ {
1801
+ name: "description",
1802
+ flag: "description",
1803
+ type: "string",
1804
+ required: false
1805
+ },
1806
+ {
1807
+ name: "public",
1808
+ flag: "public",
1809
+ type: "boolean",
1810
+ required: false,
1811
+ description: "Publish the snapshot to every organisation instead of keeping it to the caller's. A published snapshot is owned by nobody, and its image is named without an organisation prefix, so this cannot be decided after the capture. Asteroid staff only, and rejected on the internal surface."
1812
+ },
1813
+ {
1814
+ name: "propose",
1815
+ flag: "propose",
1816
+ type: "boolean",
1817
+ required: false,
1818
+ description: "Store the capture as a proposal, not as the next version. It takes a pre-release such as `1.4.0-rc.1`, which only an exact pin boots. Test it by that pin, then accept or dismiss it. It changes the version the machine booted, which must be the latest. A proposal for a shared snapshot is Asteroid staff only. Rejected on the internal surface."
1819
+ },
1820
+ {
1821
+ name: "recipe",
1822
+ flag: "recipe",
1823
+ type: "string",
1824
+ required: false,
1825
+ description: "Markdown that lets a session rebuild this image on a fresh base. It must have a `## Install` and a `## Boot state` section, each with a body, and may have `## Notes`. No frontmatter. Omit it to keep the recipe of the version the machine booted, when that version is of the same snapshot."
1826
+ },
1827
+ {
1828
+ name: "changelog",
1829
+ flag: "changelog",
1830
+ type: "string",
1831
+ required: false,
1832
+ description: "What this capture changed, for the version list."
1833
+ }
1834
+ ],
1835
+ files: [],
1836
+ credentialOrganization: false
1837
+ }
1838
+ },
1438
1839
  {
1439
1840
  command: "environment start",
1440
1841
  tool: "environment_start",
@@ -1554,6 +1955,100 @@ var COMMANDS = [
1554
1955
  credentialOrganization: false
1555
1956
  }
1556
1957
  },
1958
+ {
1959
+ command: "environment-snapshot get",
1960
+ tool: "environment_snapshot_get",
1961
+ title: "Get snapshot",
1962
+ description: "Read one snapshot by ID with its versions, newest first: each version's changelog, its recipe unless the snapshot is shared, and the profile the captured machine ran with. Use it to find the version a capture landed as.",
1963
+ method: "GET",
1964
+ path: "/agents/v2/environment-snapshots/{snapshotId}",
1965
+ args: [
1966
+ {
1967
+ name: "snapshotId",
1968
+ flag: "snapshot-id",
1969
+ type: "string",
1970
+ required: true
1971
+ }
1972
+ ],
1973
+ query: [],
1974
+ binary: false,
1975
+ readOnly: true,
1976
+ destructive: false
1977
+ },
1978
+ {
1979
+ command: "environment-snapshot list",
1980
+ tool: "environment_snapshots_list",
1981
+ title: "List snapshots",
1982
+ description: "List the snapshots your organization can boot an environment from: its own, then the shared ones, each with its versions newest first. A version carries its changelog, and its recipe unless the snapshot is shared. Only operating systems your plan includes are listed. Narrow with `osType`. Boot one by setting its `name` as `snapshotName` on a custom environment's OS base: a bare `name` boots the newest version, `name:1.2` the newest 1.2 patch, `name:1.2.0` that version.",
1983
+ method: "GET",
1984
+ path: "/agents/v2/environment-snapshots",
1985
+ args: [],
1986
+ query: [
1987
+ {
1988
+ name: "osType",
1989
+ flag: "os-type",
1990
+ type: "string",
1991
+ required: false,
1992
+ description: "Only snapshots that boot this operating system. Omit for every operating system.",
1993
+ enum: ["linux", "windows", "citrix"]
1994
+ }
1995
+ ],
1996
+ binary: false,
1997
+ readOnly: true,
1998
+ destructive: false
1999
+ },
2000
+ {
2001
+ command: "environment-snapshot proposal accept",
2002
+ tool: "environment_snapshot_proposal_accept",
2003
+ title: "Accept snapshot proposal",
2004
+ description: "Release a proposed snapshot version, so `1.4.0-rc.1` becomes `1.4.0`. Workflows that boot the snapshot by bare name, or by a minor pin such as `name:1.4`, boot it from then on; an exact pin such as `name:1.3.0` does not move. Test the proposal first by pinning its pre-release. Find proposals in `environment_snapshot_get`. Only your organization's own snapshots.",
2005
+ method: "POST",
2006
+ path: "/agents/v2/environment-snapshots/{snapshotId}/proposals/{proposalId}/accept",
2007
+ args: [
2008
+ {
2009
+ name: "snapshotId",
2010
+ flag: "snapshot-id",
2011
+ type: "string",
2012
+ required: true
2013
+ },
2014
+ {
2015
+ name: "proposalId",
2016
+ flag: "proposal-id",
2017
+ type: "string",
2018
+ required: true
2019
+ }
2020
+ ],
2021
+ query: [],
2022
+ binary: false,
2023
+ readOnly: false,
2024
+ destructive: false
2025
+ },
2026
+ {
2027
+ command: "environment-snapshot proposal dismiss",
2028
+ tool: "environment_snapshot_proposal_dismiss",
2029
+ title: "Dismiss snapshot proposal",
2030
+ description: "Close a proposed snapshot version without releasing it. Its pre-release pin stops being offered. Only your organization's own snapshots.",
2031
+ method: "POST",
2032
+ path: "/agents/v2/environment-snapshots/{snapshotId}/proposals/{proposalId}/dismiss",
2033
+ args: [
2034
+ {
2035
+ name: "snapshotId",
2036
+ flag: "snapshot-id",
2037
+ type: "string",
2038
+ required: true
2039
+ },
2040
+ {
2041
+ name: "proposalId",
2042
+ flag: "proposal-id",
2043
+ type: "string",
2044
+ required: true
2045
+ }
2046
+ ],
2047
+ query: [],
2048
+ binary: false,
2049
+ readOnly: false,
2050
+ destructive: false
2051
+ },
1557
2052
  {
1558
2053
  command: "event-type list",
1559
2054
  tool: "event_types_list",
@@ -8013,10 +8508,10 @@ function splitDotted(argv) {
8013
8508
  }
8014
8509
  return { argv: rest, dotted: dotted2 };
8015
8510
  }
8016
- function group(parent, name, groups, path) {
8511
+ function group(parent, name, groups, path, hidden = false) {
8017
8512
  const existing = groups.get(path);
8018
8513
  if (existing) return existing;
8019
- const created = parent.command(name).description(`${name} commands`).helpCommand(false);
8514
+ const created = parent.command(name, { hidden }).description(`${name} commands`).helpCommand(false);
8020
8515
  groups.set(path, created);
8021
8516
  return created;
8022
8517
  }
@@ -8123,14 +8618,21 @@ function defineCommands(root, options, dotted2 = /* @__PURE__ */ new Map(), onIn
8123
8618
  });
8124
8619
  }
8125
8620
  const reserved = new Set((options.builtins ?? []).map((b) => b.command));
8621
+ const shown = new Set(
8622
+ options.commands.filter((command) => !command.hidden).flatMap((command) => {
8623
+ const words = command.command.split(" ");
8624
+ return words.slice(1).map((_, i) => words.slice(0, i + 1).join(" "));
8625
+ })
8626
+ );
8126
8627
  for (const command of options.commands) {
8127
8628
  if (reserved.has(command.command)) continue;
8128
8629
  const words = command.command.split(" ");
8129
8630
  let parent = root;
8130
8631
  for (let i = 0; i < words.length - 1; i++) {
8131
- parent = group(parent, words[i], groups, words.slice(0, i + 1).join(" "));
8632
+ const path = words.slice(0, i + 1).join(" ");
8633
+ parent = group(parent, words[i], groups, path, !shown.has(path));
8132
8634
  }
8133
- const leaf = parent.command(words.at(-1)).description(command.description).summary(command.title);
8635
+ const leaf = parent.command(words.at(-1), { hidden: command.hidden }).description(command.description).summary(command.title);
8134
8636
  const defaults = command.args.map(
8135
8637
  (arg) => options.defaultArg?.(command, arg)
8136
8638
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteroidai/cli",
3
- "version": "1.9.565",
3
+ "version": "1.9.572",
4
4
  "description": "The asteroid command-line interface for the Asteroid platform.",
5
5
  "type": "module",
6
6
  "license": "MIT",