@gravity-rail/cli 3.1.0 → 4.0.0

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/lib.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GravityRailClient, OutboundCallReceipt, PhoneCall } from '@gravity-rail/sdk';
2
2
  import { EnvironmentConfig, CredentialsManager, CLICredentials } from './cli-utils.js';
3
- export { b as ConciergeAppContextPayload, j as buildCliConciergeAppContext } from './cli-client-context-NJgZhyfd.js';
3
+ export { b as ConciergeAppContextPayload, j as buildCliConciergeAppContext } from './cli-client-context-BVZdWMkY.js';
4
4
 
5
5
  /** Metadata extracted from a paginated API response */
6
6
  interface PaginationMeta {
package/dist/lib.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  startAccountPhoneVerify,
34
34
  stderr,
35
35
  unwrapItems
36
- } from "./chunk-UHBWPJJT.js";
36
+ } from "./chunk-JOXB4Y4Q.js";
37
37
  import {
38
38
  AGUIClient,
39
39
  formatTimestamp,
@@ -42,7 +42,7 @@ import {
42
42
  isRecord,
43
43
  performOAuthFlow,
44
44
  selectFromList
45
- } from "./chunk-HR255AEX.js";
45
+ } from "./chunk-KDWGBYCM.js";
46
46
  import {
47
47
  AuthRequiredError,
48
48
  CLIError,
@@ -1302,7 +1302,7 @@ var agentTasksDomain = {
1302
1302
  args: [
1303
1303
  {
1304
1304
  name: "status",
1305
- description: "Filter by A2A state (submitted|working|input-required|completed|failed|canceled|rejected|auth-required)",
1305
+ description: "Filter by canonical A2A state, e.g. TASK_STATE_WORKING or TASK_STATE_COMPLETED",
1306
1306
  required: false
1307
1307
  },
1308
1308
  {
@@ -1312,7 +1312,7 @@ var agentTasksDomain = {
1312
1312
  },
1313
1313
  {
1314
1314
  name: "parent-task",
1315
- description: "Filter by parent agent task uuid (not supported server-side yet \u2014 filters by id)",
1315
+ description: "Filter by parent AgentTask integer ID",
1316
1316
  required: false
1317
1317
  },
1318
1318
  {
@@ -3415,6 +3415,17 @@ var workflowsDomain = {
3415
3415
  archiveMethod: "archiveWorkflow",
3416
3416
  unarchiveMethod: "unarchiveWorkflow",
3417
3417
  columns: COLUMNS5,
3418
+ // The list hides archived Workflows by default. `--archived` uses the
3419
+ // API's existing `archived` filter so an operator can find a row that
3420
+ // still blocks a phone/inbox archive but no longer appears in the
3421
+ // default listing (#27586). Default listing behavior is unchanged.
3422
+ listArgs: [
3423
+ {
3424
+ name: "archived",
3425
+ description: "List archived workflows instead of active ones",
3426
+ isFlag: true
3427
+ }
3428
+ ],
3418
3429
  // `GET /workflows` is a `PaginatedResponse` (pageSize default 100, max
3419
3430
  // 500 — lib/routes/workspace/workflows/list.py). Without this opt-in the
3420
3431
  // command exposes no `--page` / `--all`, so a caller reading the list
@@ -4190,10 +4201,10 @@ function parseBindingsFile(payload) {
4190
4201
  }
4191
4202
  const record2 = entry;
4192
4203
  const value = record2.value;
4193
- if (typeof value !== "string" && typeof value !== "boolean") {
4194
- throw new CLIError(`${where}: "value" must be a string or a boolean.`);
4204
+ if (typeof value !== "string") {
4205
+ throw new CLIError(`${where}: "value" must be a string.`);
4195
4206
  }
4196
- if (typeof value === "string" && value.length === 0) {
4207
+ if (value.length === 0) {
4197
4208
  throw new CLIError(`${where}: "value" must not be empty.`);
4198
4209
  }
4199
4210
  const binding = {
@@ -5062,18 +5073,12 @@ Provisioning started. Watch it come up with:
5062
5073
  name: "create-all",
5063
5074
  description: "Auto-generate createNew entries for all entities in the export data. Use when importing into a fresh workspace.",
5064
5075
  isFlag: true
5065
- },
5066
- {
5067
- name: "activate-webhooks",
5068
- description: "Keep imported webhook:send EventRules at their exported active state. Safety default: OFF \u2014 without this flag, an exported-active webhook rule is force-disabled on import so a cloned workspace never calls the source workspace's webhook URLs. An exported-inactive rule stays inactive either way. Only pass this once you have verified the destination should own those webhook calls.",
5069
- isFlag: true
5070
5076
  }
5071
5077
  ],
5072
5078
  examples: [
5073
5079
  "yarn gr workspaces import -w $UUID --env dev --file export.json --create-all",
5074
5080
  "yarn gr workspaces import -w $UUID --env dev --file export.zip --create-all",
5075
- `yarn gr workspaces import -w $UUID --env dev --data '{"exportData": ..., "createNew": ..., "importMappings": {}}'`,
5076
- "yarn gr workspaces import -w $UUID --env dev --file export.json --create-all --activate-webhooks"
5081
+ `yarn gr workspaces import -w $UUID --env dev --data '{"exportData": ..., "createNew": ..., "importMappings": {}}'`
5077
5082
  ],
5078
5083
  handler: async ({ ctx, workspace, data, args }) => {
5079
5084
  if (!data) throw new CLIError("JSON or ZIP data required (--data, --file, or stdin)");
@@ -5092,7 +5097,6 @@ Provisioning started. Watch it come up with:
5092
5097
  payload = data;
5093
5098
  }
5094
5099
  const createAll = args["create-all"] === true;
5095
- const activateWebhooks = args["activate-webhooks"] === true;
5096
5100
  const parsed = parseImportPayload(payload);
5097
5101
  const { exportData, importMappings } = parsed;
5098
5102
  const createNew = createAll ? deriveCreateNew(exportData, parsed.createNew) : parsed.createNew;
@@ -5102,7 +5106,6 @@ Provisioning started. Watch it come up with:
5102
5106
  importMappings,
5103
5107
  createNew,
5104
5108
  archive,
5105
- activateWebhooks,
5106
5109
  // Forwarded as parsed: present when the payload carried it,
5107
5110
  // absent otherwise. The server reads presence (see
5108
5111
  // `ParsedImportPayload`), so this is the operator's choice of
@@ -5256,7 +5259,7 @@ Provisioning started. Watch it come up with:
5256
5259
  },
5257
5260
  {
5258
5261
  name: "bindings-file",
5259
- description: "Local JSON keyed by target workspace UUID, supplying that target's phone / inbox / Member / webhook endpoint / signing secret / active state. Values are sent in the request body and never printed."
5262
+ description: "Local JSON keyed by target workspace UUID, supplying that target's phone / inbox / Member / Routine audience. Values are sent in the request body and never printed."
5260
5263
  },
5261
5264
  {
5262
5265
  name: "yes",
@@ -6473,15 +6476,6 @@ var ACTION_PARAM_HINTS = {
6473
6476
  "Template vars such as {{member}} describe the event, whoever receives it."
6474
6477
  ]
6475
6478
  },
6476
- "webhook:send": {
6477
- summary: "legacy: existing rules only \u2014 POST the event payload to a URL",
6478
- shape: ['{"webhookUrl":"https://example.com/hook"}'],
6479
- notes: [
6480
- "New webhook:send rules are refused; set up new integrations under Organization \u2192 Webhooks.",
6481
- "This shape is for updating an existing rule: webhookUrl must be https in production,",
6482
- "and an update that omits signingSecret keeps the stored secret."
6483
- ]
6484
- },
6485
6479
  "assistant:message": {
6486
6480
  summary: "inject an assistant message into the chat",
6487
6481
  shape: [
@@ -6791,8 +6785,8 @@ ${EVENT_RULE_FIELD_REFERENCE}`,
6791
6785
  "Common actionTypes: member:label, member:notify, email:send, sms:send,",
6792
6786
  " chat:create, member:upsert",
6793
6787
  "",
6794
- "New webhook:send rules are refused: set up outbound webhooks under",
6795
- "Organization \u2192 Webhooks. Existing webhook:send rules can still be updated or disabled.",
6788
+ "Event rules have no webhook action. To send events to an external URL, use",
6789
+ "organization webhooks (Organization \u2192 Webhooks).",
6796
6790
  "",
6797
6791
  'member:label actionParams: {"addLabelIds":["uuid"],"removeLabelIds":["uuid"]}'
6798
6792
  ]
@@ -13598,7 +13592,7 @@ var SUBSCRIPTION_COLUMNS = [
13598
13592
  { header: "PERIOD", getValue: (s) => String(s.planPeriod ?? "") },
13599
13593
  {
13600
13594
  header: "ORG",
13601
- getValue: (s) => String(s.customerOrganizationUuid ?? s.organizationUuid ?? "")
13595
+ getValue: (s) => String(s.organizationUuid ?? "")
13602
13596
  }
13603
13597
  ];
13604
13598
  var CONTRACT_BEARING_STATUSES = /* @__PURE__ */ new Set([
@@ -13733,9 +13727,7 @@ Then check it landed:
13733
13727
  ]);
13734
13728
  return;
13735
13729
  }
13736
- const orgUuid = String(
13737
- contract.organizationUuid ?? contract.customerOrganizationUuid ?? "<org-uuid>"
13738
- );
13730
+ const orgUuid = String(contract.organizationUuid ?? "<org-uuid>");
13739
13731
  hint(ctx, [
13740
13732
  "You have an active subscription. Add a workspace:",
13741
13733
  ` gr workspaces create --org ${orgUuid} --name "My Workspace"`
@@ -13767,48 +13759,48 @@ var INVOICE_COLUMNS = [
13767
13759
  ];
13768
13760
  var commands = [
13769
13761
  {
13770
- path: ["billing", "customers"],
13771
- description: "List your customer accounts",
13762
+ path: ["billing", "organizations"],
13763
+ description: "List Organizations where you have billing access",
13772
13764
  requiresWorkspace: false,
13773
13765
  handler: async (hctx) => {
13774
- const result = await requireAuth(hctx.ctx).apiClient.getMyCustomers();
13766
+ const result = await requireAuth(hctx.ctx).apiClient.getBillingOrganizations();
13775
13767
  outputData(listResult(result, false), hctx.ctx);
13776
13768
  }
13777
13769
  },
13778
13770
  {
13779
- path: ["billing", "customer"],
13780
- description: "Get a customer by UUID",
13781
- args: [{ name: "uuid", description: "Customer UUID", required: true }],
13771
+ path: ["org", "billing", "profile"],
13772
+ description: "Get this Organization\u2019s billing profile",
13773
+ args: [ORG_UUID_ARG],
13782
13774
  requiresWorkspace: false,
13783
13775
  handler: async (hctx) => {
13784
- const uuid = hctx.args.uuid;
13785
- const result = await requireAuth(hctx.ctx).apiClient.getMyCustomer(uuid);
13776
+ const uuid = requireOrgRef(hctx.args);
13777
+ const result = await requireAuth(hctx.ctx).apiClient.getOrganizationBilling(uuid);
13786
13778
  outputSingle(result, hctx.ctx);
13787
13779
  }
13788
13780
  },
13789
13781
  {
13790
- path: ["billing", "update-customer"],
13791
- description: "Update a customer record (billing owner only)",
13782
+ path: ["org", "billing", "update-profile"],
13783
+ description: "Update this Organization\u2019s invoice details and billing email",
13792
13784
  mutates: true,
13793
13785
  args: [
13794
- { name: "uuid", description: "Customer UUID", required: true },
13795
- { name: "name", description: "Customer name" },
13786
+ ORG_UUID_ARG,
13787
+ { name: "name", description: "Invoice name" },
13796
13788
  { name: "email", description: "Billing email" },
13797
13789
  { name: "phone", description: "Phone number" },
13798
13790
  { name: "description", description: "Description / notes" }
13799
13791
  ],
13800
13792
  requiresWorkspace: false,
13801
13793
  handler: async (hctx) => {
13802
- const uuid = hctx.args.uuid;
13794
+ const uuid = requireOrgRef(hctx.args);
13803
13795
  const data = {};
13804
13796
  if (hctx.args.name) data.name = hctx.args.name;
13805
- if (hctx.args.email) data.email = hctx.args.email;
13797
+ if (hctx.args.email) data.billingEmail = hctx.args.email;
13806
13798
  if (hctx.args.phone) data.phone = hctx.args.phone;
13807
13799
  if (hctx.args.description) data.description = hctx.args.description;
13808
13800
  if (Object.keys(data).length === 0 && !hctx.data) {
13809
13801
  throw new CLIError("Provide --name, --email, --phone, --description, or JSON data");
13810
13802
  }
13811
- const result = await requireAuth(hctx.ctx).apiClient.updateMyCustomer(
13803
+ const result = await requireAuth(hctx.ctx).apiClient.updateOrganizationBilling(
13812
13804
  uuid,
13813
13805
  hctx.data ? hctx.data : data
13814
13806
  );
@@ -13816,31 +13808,33 @@ var commands = [
13816
13808
  }
13817
13809
  },
13818
13810
  {
13819
- path: ["billing", "invoices"],
13820
- description: "List invoices for a customer",
13821
- args: [{ name: "uuid", description: "Customer UUID", required: true }],
13811
+ path: ["org", "billing", "invoices"],
13812
+ description: "List this Organization\u2019s invoices",
13813
+ args: [ORG_UUID_ARG],
13822
13814
  requiresWorkspace: false,
13823
13815
  handler: async (hctx) => {
13824
- const uuid = hctx.args.uuid;
13825
- const result = await requireAuth(hctx.ctx).apiClient.getMyCustomerInvoices(uuid);
13816
+ const uuid = requireOrgRef(hctx.args);
13817
+ const result = await requireAuth(hctx.ctx).apiClient.getOrganizationInvoices(uuid);
13826
13818
  outputData(listResult(result, false), hctx.ctx, INVOICE_COLUMNS);
13827
13819
  }
13828
13820
  },
13829
13821
  {
13830
- path: ["billing", "subscriptions"],
13831
- description: "List subscriptions for a customer",
13832
- args: [{ name: "uuid", description: "Customer UUID", required: true }],
13822
+ path: ["org", "billing", "subscriptions"],
13823
+ description: "List this Organization\u2019s subscriptions",
13824
+ args: [ORG_UUID_ARG],
13833
13825
  requiresWorkspace: false,
13834
13826
  handler: async (hctx) => {
13835
- const uuid = hctx.args.uuid;
13836
- const result = await requireAuth(hctx.ctx).apiClient.getMyCustomerSubscriptions(uuid);
13827
+ const uuid = requireOrgRef(hctx.args);
13828
+ const result = await requireAuth(hctx.ctx).apiClient.getOrganizationBillingSubscriptions(
13829
+ uuid
13830
+ );
13837
13831
  outputData(listResult(result, false), hctx.ctx);
13838
13832
  }
13839
13833
  }
13840
13834
  ];
13841
13835
  var billingPortalDomain = {
13842
13836
  name: "billing",
13843
- description: "Billing portal (customer invoices, subscriptions)",
13837
+ description: "Organization billing, invoices and subscriptions",
13844
13838
  commands
13845
13839
  };
13846
13840
 
@@ -14553,11 +14547,11 @@ var operatorGroupsDomain = {
14553
14547
  // src/domains/org-billing.ts
14554
14548
  async function subject(hctx) {
14555
14549
  const auth = requireAuth(hctx.ctx);
14556
- const billing = await auth.apiClient.getOrgBillingCustomer(requireOrgRef(hctx.args));
14557
- if (!billing.hasAccess || !billing.customerUuid || !billing.subscriptionId) {
14558
- throw new CLIError("A billing role on this organization\u2019s billing customer is required");
14550
+ const billing = await auth.apiClient.getOrgBillingAccess(requireOrgRef(hctx.args));
14551
+ if (!billing.hasAccess) {
14552
+ throw new CLIError("Billing access on this organization is required");
14559
14553
  }
14560
- return { auth, billing };
14554
+ return { auth, billing, orgUuid: requireOrgRef(hctx.args) };
14561
14555
  }
14562
14556
  var orgBillingCommands = [
14563
14557
  {
@@ -14565,14 +14559,8 @@ var orgBillingCommands = [
14565
14559
  description: "Read only this organization\u2019s billable subscription",
14566
14560
  args: [ORG_UUID_ARG],
14567
14561
  handler: async (hctx) => {
14568
- const { auth, billing } = await subject(hctx);
14569
- outputSingle(
14570
- await auth.apiClient.getMyCustomerSubscriptions(billing.customerUuid, {
14571
- subscriptionId: billing.subscriptionId,
14572
- pageSize: 1
14573
- }),
14574
- hctx.ctx
14575
- );
14562
+ const { auth, orgUuid } = await subject(hctx);
14563
+ outputSingle(await auth.apiClient.getOrganizationSubscription(orgUuid), hctx.ctx);
14576
14564
  }
14577
14565
  },
14578
14566
  {
@@ -14582,18 +14570,18 @@ var orgBillingCommands = [
14582
14570
  mutates: true,
14583
14571
  acceptsJsonInput: true,
14584
14572
  handler: async (hctx) => {
14585
- const { auth, billing } = await subject(hctx);
14573
+ const { auth, orgUuid } = await subject(hctx);
14586
14574
  if (!hctx.data || typeof hctx.data !== "object" || Array.isArray(hctx.data))
14587
14575
  throw new CLIError("Provide credit settings as a JSON object with --data");
14588
14576
  outputSingle(
14589
- await auth.apiClient.updateSubscription(billing.subscriptionId, hctx.data),
14577
+ await auth.apiClient.updateOrganizationCreditSettings(orgUuid, hctx.data),
14590
14578
  hctx.ctx
14591
14579
  );
14592
14580
  }
14593
14581
  },
14594
14582
  {
14595
14583
  path: ["org", "billing", "purchase-credits"],
14596
- description: "Purchase extra credits for this organization (charges the billing owner\u2019s payment method)",
14584
+ description: "Purchase extra credits for this organization (charges the Organization\u2019s payment method)",
14597
14585
  args: [
14598
14586
  ORG_UUID_ARG,
14599
14587
  { name: "amount-cents", description: "Amount to charge in cents", required: true },
@@ -14604,13 +14592,13 @@ var orgBillingCommands = [
14604
14592
  ],
14605
14593
  mutates: true,
14606
14594
  handler: async (hctx) => {
14607
- const { auth, billing } = await subject(hctx);
14595
+ const { auth, orgUuid } = await subject(hctx);
14608
14596
  const amount = Number(hctx.args["amount-cents"]);
14609
14597
  if (!Number.isInteger(amount) || amount < 100 || amount > 1e7)
14610
14598
  throw new CLIError("Use an integer amount between 100 and 10000000 cents");
14611
14599
  outputSingle(
14612
- await auth.apiClient.purchaseCredits(
14613
- billing.subscriptionId,
14600
+ await auth.apiClient.purchaseOrganizationCredits(
14601
+ orgUuid,
14614
14602
  amount,
14615
14603
  hctx.args["idempotency-key"]
14616
14604
  ),
@@ -19855,6 +19843,58 @@ var hubspotDomain = {
19855
19843
  name: "hubspot",
19856
19844
  description: "HubSpot CRM integration",
19857
19845
  commands: [
19846
+ {
19847
+ path: ["hubspot", "calendar", "bind"],
19848
+ description: "Link a native calendar to a HubSpot scheduling link",
19849
+ requiresWorkspace: true,
19850
+ mutates: true,
19851
+ args: [
19852
+ { name: "calendar-id", description: "Native Calendar ID", required: true },
19853
+ { name: "link-id", description: "HubSpot scheduling link ID", required: true }
19854
+ ],
19855
+ handler: async ({ ctx, workspace, args }) => {
19856
+ await requireAuth(ctx).apiClient.bindHubspotCalendar(
19857
+ workspace,
19858
+ requireNumber(args, "calendar-id"),
19859
+ requireString(args, "link-id")
19860
+ );
19861
+ outputSingle({ status: "linked" }, ctx);
19862
+ }
19863
+ },
19864
+ {
19865
+ path: ["hubspot", "calendar", "unlink"],
19866
+ description: "Unlink a native calendar from HubSpot",
19867
+ requiresWorkspace: true,
19868
+ mutates: true,
19869
+ args: [{ name: "calendar-id", description: "Native Calendar ID", required: true }],
19870
+ handler: async ({ ctx, workspace, args }) => {
19871
+ await requireAuth(ctx).apiClient.unlinkHubspotCalendar(
19872
+ workspace,
19873
+ requireNumber(args, "calendar-id")
19874
+ );
19875
+ outputSingle({ status: "unlinked" }, ctx);
19876
+ }
19877
+ },
19878
+ {
19879
+ path: ["hubspot", "calendar", "import"],
19880
+ description: "Import one page of bookings into native CalendarEvents; repeat while complete is false. Sends no invitations.",
19881
+ requiresWorkspace: true,
19882
+ mutates: true,
19883
+ args: [
19884
+ { name: "calendar-id", description: "Native Calendar ID", required: true },
19885
+ { name: "event-type-id", description: "Native CalendarEventType ID", required: true }
19886
+ ],
19887
+ handler: async ({ ctx, workspace, args }) => {
19888
+ outputSingle(
19889
+ await requireAuth(ctx).apiClient.importHubspotCalendarEvents(
19890
+ workspace,
19891
+ requireNumber(args, "calendar-id"),
19892
+ requireNumber(args, "event-type-id")
19893
+ ),
19894
+ ctx
19895
+ );
19896
+ }
19897
+ },
19858
19898
  {
19859
19899
  path: ["hubspot", "booking-deals", "receipt"],
19860
19900
  description: "Inspect a booking receipt before operator recovery",
@@ -25683,7 +25723,7 @@ var topLevelCommands = [
25683
25723
  mutates: true,
25684
25724
  args: [{ name: "phone", description: "E.164 phone number (optional; prompts if omitted)" }],
25685
25725
  handler: async (hctx) => {
25686
- const { accountVerifyPhoneCommand } = await import("./account-verify-phone-YIIEU6X2.js");
25726
+ const { accountVerifyPhoneCommand } = await import("./account-verify-phone-VZYUPN64.js");
25687
25727
  await accountVerifyPhoneCommand(hctx);
25688
25728
  }
25689
25729
  },