@asteroidai/cli 1.9.219 → 1.9.231

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
@@ -374,7 +374,7 @@ var COMMANDS = [
374
374
  command: "catalog get",
375
375
  tool: "catalog_get",
376
376
  title: "Get catalog",
377
- description: "The organization's agent catalog: categories, portals and every live template. `accessLevel` is `granted` (can instantiate a `runnable` template) or `viewable` (locked). A template the organization has not added is `viewable`; `catalog_template_add` grants it. Portals whose `portalType` is `mock` are stand-in sites with sample data that Asteroid hosts: their templates are `granted` to every organization, need no credentials and touch nothing real. Offer them for a demo or when the user has no access to the real portal yet, and prefer a real portal's template otherwise. `organizationId` defaults to the caller's one organization. Template definitions are omitted; read one with `catalog_template_get`.",
377
+ description: "The organization's agent catalog: categories, portals and every runnable template, with its category and portal by name. `accessLevel` is `granted` (can instantiate) or `viewable` (locked). A template the organization has not added is `viewable`; `catalog_template_add` grants it. Templates on a portal whose `portalType` is `mock` run against stand-in sites with sample data that Asteroid hosts: they are `granted` to every organization, need no credentials and touch nothing real. Offer them for a demo or when the user has no access to the real portal yet, and prefer a real portal's template otherwise. `organizationId` defaults to the caller's one organization. Template definitions are omitted; read one with `catalog_template_get`.",
378
378
  method: "GET",
379
379
  path: "/agents/v2/catalog",
380
380
  args: [],
@@ -407,7 +407,7 @@ var COMMANDS = [
407
407
  command: "catalog template get",
408
408
  tool: "catalog_template_get",
409
409
  title: "Get catalog template",
410
- description: "One live catalog template, with `runnable`, its `inputs`, the portal's credential fields and the organization's `accessLevel`. A template the organization has not added is `viewable`. Set `includeWorkflowDefinition` to also get the template's rules, nodes and transitions as a read-only reference when building or editing a workflow; on an organization-scoped read it needs `accessLevel` `granted`. To get an editable copy, use `catalog_template_instantiate`. `organizationId` defaults to the caller's one organization.",
410
+ description: "One catalog template with a source workflow, with its current `runnable` state, its `inputs`, the portal's credential fields and the organization's `accessLevel`. A template the organization has not added is `viewable`. Set `includeWorkflowDefinition` to also get the template's rules, nodes and transitions as a read-only reference when building or editing a workflow; on an organization-scoped read it needs `accessLevel` `granted`. To get an editable copy, use `catalog_template_instantiate`. A template with no source workflow returns 404. `organizationId` defaults to the caller's one organization.",
411
411
  method: "GET",
412
412
  path: "/agents/v2/catalog/templates/{templateId}",
413
413
  args: [
@@ -6777,6 +6777,7 @@ function columns(rows, options) {
6777
6777
  scalarKeys.push(key);
6778
6778
  }
6779
6779
  }
6780
+ if (options.curated) return scalarKeys;
6780
6781
  const ordered = [
6781
6782
  ...PREFERRED.filter((key) => scalarKeys.includes(key)),
6782
6783
  ...scalarKeys.filter((key) => !PREFERRED.includes(key))
@@ -6801,22 +6802,22 @@ function flatten(row) {
6801
6802
  function table(input, options = {}) {
6802
6803
  if (input.length === 0) return "No results.";
6803
6804
  const rows = input.map(flatten);
6804
- const keys = columns(rows, options);
6805
- if (keys.length === 0) return rows.map((row) => text(row)).join("\n");
6806
- const cells = rows.map((row) => keys.map((key) => cell(row[key], options)));
6805
+ const keys2 = columns(rows, options);
6806
+ if (keys2.length === 0) return rows.map((row) => text(row)).join("\n");
6807
+ const cells = rows.map((row) => keys2.map((key) => cell(row[key], options)));
6807
6808
  if (options.styled) {
6808
6809
  const grid = new Table({
6809
- head: keys.map((key) => style("bold", key, options)),
6810
+ head: keys2.map((key) => style("bold", key, options)),
6810
6811
  style: { head: [], border: [] }
6811
6812
  });
6812
6813
  grid.push(...cells);
6813
6814
  return grid.toString();
6814
6815
  }
6815
- const widths = keys.map(
6816
+ const widths = keys2.map(
6816
6817
  (key, i) => Math.max(key.length, ...cells.map((r) => r[i].length))
6817
6818
  );
6818
6819
  const line2 = (values) => values.map((v, i) => v.padEnd(widths[i])).join(" ").trimEnd();
6819
- return [line2(keys.map((k) => k.toUpperCase())), ...cells.map(line2)].join(
6820
+ return [line2(keys2.map((k) => k.toUpperCase())), ...cells.map(line2)].join(
6820
6821
  "\n"
6821
6822
  );
6822
6823
  }
@@ -7735,7 +7736,7 @@ var ApiError = class extends Error {
7735
7736
  status;
7736
7737
  body;
7737
7738
  };
7738
- var VERSION = "1.9.219";
7739
+ var VERSION = "1.9.231";
7739
7740
  function problem(status, body, fallback) {
7740
7741
  if (body && typeof body === "object") {
7741
7742
  const record2 = body;
@@ -8019,8 +8020,8 @@ function servedDigests(row, skipped) {
8019
8020
  }
8020
8021
  function sameDigests(a, b) {
8021
8022
  if (!a) return false;
8022
- const keys = Object.keys(a);
8023
- return keys.length === Object.keys(b).length && keys.every((path) => a[path] === b[path]);
8023
+ const keys2 = Object.keys(a);
8024
+ return keys2.length === Object.keys(b).length && keys2.every((path) => a[path] === b[path]);
8024
8025
  }
8025
8026
  function removeEmptyDirs(from, upTo) {
8026
8027
  let dir = from;
@@ -8398,8 +8399,8 @@ async function orgs(deps, flagOrg, json) {
8398
8399
  return 0;
8399
8400
  }
8400
8401
  function timeLeft(expiresAt) {
8401
- const minutes = Math.max(0, Math.round((expiresAt - Date.now()) / 6e4));
8402
- return minutes >= 60 ? `${Math.floor(minutes / 60)}h${String(minutes % 60).padStart(2, "0")}m` : `${minutes}m`;
8402
+ const minutes2 = Math.max(0, Math.round((expiresAt - Date.now()) / 6e4));
8403
+ return minutes2 >= 60 ? `${Math.floor(minutes2 / 60)}h${String(minutes2 % 60).padStart(2, "0")}m` : `${minutes2}m`;
8403
8404
  }
8404
8405
  function isMember(config, org) {
8405
8406
  return (config.orgs ?? []).some((o) => o.workosId === org.workosId);
@@ -8637,10 +8638,10 @@ async function whoami(deps, flagOrg, json) {
8637
8638
  deps.fetch
8638
8639
  );
8639
8640
  const body = response.json ?? {};
8640
- const minutes = auth.expiresAt ? Math.max(0, Math.round((auth.expiresAt - Date.now()) / 6e4)) : void 0;
8641
+ const minutes2 = auth.expiresAt ? Math.max(0, Math.round((auth.expiresAt - Date.now()) / 6e4)) : void 0;
8641
8642
  if (json) {
8642
8643
  deps.stdout(
8643
- `${JSON.stringify({ ...body, organizationName: auth.org?.name, tokenExpiresInMinutes: minutes }, null, 2)}
8644
+ `${JSON.stringify({ ...body, organizationName: auth.org?.name, tokenExpiresInMinutes: minutes2 }, null, 2)}
8644
8645
  `
8645
8646
  );
8646
8647
  return 0;
@@ -9804,6 +9805,44 @@ async function runSync(command, parsed, deps) {
9804
9805
  return 0;
9805
9806
  }
9806
9807
 
9808
+ // src/views.ts
9809
+ function minutes(timestamp) {
9810
+ if (typeof timestamp !== "string") return timestamp;
9811
+ return `${timestamp.slice(0, 10)} ${timestamp.slice(11, 16)}`;
9812
+ }
9813
+ function keys(fields) {
9814
+ if (!Array.isArray(fields)) return fields;
9815
+ return fields.map((field) => field.key).join(", ");
9816
+ }
9817
+ function catalog({ categories, portals, templates }) {
9818
+ return {
9819
+ categories: categories.map(({ id, name, description }) => ({
9820
+ id,
9821
+ name,
9822
+ description
9823
+ })),
9824
+ portals: portals.map(({ id, name, portalType, credentials }) => ({
9825
+ id,
9826
+ name,
9827
+ portalType,
9828
+ credentials: keys(credentials)
9829
+ })),
9830
+ templates: templates.map((template) => ({
9831
+ id: template.id,
9832
+ templateName: template.templateName,
9833
+ categoryName: template.categoryName,
9834
+ portalName: template.portalName,
9835
+ accessMethod: template.accessMethod,
9836
+ portalOperation: template.portalOperation,
9837
+ shortDescription: template.shortDescription,
9838
+ updatedAt: minutes(template.updatedAt)
9839
+ }))
9840
+ };
9841
+ }
9842
+ var VIEWS = {
9843
+ catalog_get: (json) => catalog(json)
9844
+ };
9845
+
9807
9846
  // src/run.ts
9808
9847
  function rejectOrgWithApiKey(deps, flagOrg) {
9809
9848
  if (deps.env.apiKey && (flagOrg || deps.env.org)) {
@@ -9903,10 +9942,12 @@ async function runCommand(command, parsed, deps) {
9903
9942
  return 0;
9904
9943
  }
9905
9944
  if (response.json !== void 0) {
9945
+ const view = VIEWS[command.tool];
9906
9946
  deps.stdout(
9907
- `${parsed.json ? JSON.stringify(response.json, null, 2) : render(response.json, {
9947
+ `${parsed.json ? JSON.stringify(response.json, null, 2) : render(view ? view(response.json) : response.json, {
9908
9948
  styled: deps.styled,
9909
- full: !deps.stdoutIsTTY
9949
+ full: !deps.stdoutIsTTY,
9950
+ curated: view !== void 0
9910
9951
  })}
9911
9952
  `
9912
9953
  );
package/dist/core.js CHANGED
@@ -395,7 +395,7 @@ var COMMANDS = [
395
395
  command: "catalog get",
396
396
  tool: "catalog_get",
397
397
  title: "Get catalog",
398
- description: "The organization's agent catalog: categories, portals and every live template. `accessLevel` is `granted` (can instantiate a `runnable` template) or `viewable` (locked). A template the organization has not added is `viewable`; `catalog_template_add` grants it. Portals whose `portalType` is `mock` are stand-in sites with sample data that Asteroid hosts: their templates are `granted` to every organization, need no credentials and touch nothing real. Offer them for a demo or when the user has no access to the real portal yet, and prefer a real portal's template otherwise. `organizationId` defaults to the caller's one organization. Template definitions are omitted; read one with `catalog_template_get`.",
398
+ description: "The organization's agent catalog: categories, portals and every runnable template, with its category and portal by name. `accessLevel` is `granted` (can instantiate) or `viewable` (locked). A template the organization has not added is `viewable`; `catalog_template_add` grants it. Templates on a portal whose `portalType` is `mock` run against stand-in sites with sample data that Asteroid hosts: they are `granted` to every organization, need no credentials and touch nothing real. Offer them for a demo or when the user has no access to the real portal yet, and prefer a real portal's template otherwise. `organizationId` defaults to the caller's one organization. Template definitions are omitted; read one with `catalog_template_get`.",
399
399
  method: "GET",
400
400
  path: "/agents/v2/catalog",
401
401
  args: [],
@@ -428,7 +428,7 @@ var COMMANDS = [
428
428
  command: "catalog template get",
429
429
  tool: "catalog_template_get",
430
430
  title: "Get catalog template",
431
- description: "One live catalog template, with `runnable`, its `inputs`, the portal's credential fields and the organization's `accessLevel`. A template the organization has not added is `viewable`. Set `includeWorkflowDefinition` to also get the template's rules, nodes and transitions as a read-only reference when building or editing a workflow; on an organization-scoped read it needs `accessLevel` `granted`. To get an editable copy, use `catalog_template_instantiate`. `organizationId` defaults to the caller's one organization.",
431
+ description: "One catalog template with a source workflow, with its current `runnable` state, its `inputs`, the portal's credential fields and the organization's `accessLevel`. A template the organization has not added is `viewable`. Set `includeWorkflowDefinition` to also get the template's rules, nodes and transitions as a read-only reference when building or editing a workflow; on an organization-scoped read it needs `accessLevel` `granted`. To get an editable copy, use `catalog_template_instantiate`. A template with no source workflow returns 404. `organizationId` defaults to the caller's one organization.",
432
432
  method: "GET",
433
433
  path: "/agents/v2/catalog/templates/{templateId}",
434
434
  args: [
@@ -6619,6 +6619,7 @@ function columns(rows, options) {
6619
6619
  scalarKeys.push(key);
6620
6620
  }
6621
6621
  }
6622
+ if (options.curated) return scalarKeys;
6622
6623
  const ordered = [
6623
6624
  ...PREFERRED.filter((key) => scalarKeys.includes(key)),
6624
6625
  ...scalarKeys.filter((key) => !PREFERRED.includes(key))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteroidai/cli",
3
- "version": "1.9.219",
3
+ "version": "1.9.231",
4
4
  "description": "The asteroid command-line interface for the Asteroid platform.",
5
5
  "type": "module",
6
6
  "license": "MIT",