@gravity-rail/cli 3.2.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-WBFYLV7Q.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-INGVO35B.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
  {
@@ -4201,10 +4201,10 @@ function parseBindingsFile(payload) {
4201
4201
  }
4202
4202
  const record2 = entry;
4203
4203
  const value = record2.value;
4204
- if (typeof value !== "string" && typeof value !== "boolean") {
4205
- 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.`);
4206
4206
  }
4207
- if (typeof value === "string" && value.length === 0) {
4207
+ if (value.length === 0) {
4208
4208
  throw new CLIError(`${where}: "value" must not be empty.`);
4209
4209
  }
4210
4210
  const binding = {
@@ -5073,18 +5073,12 @@ Provisioning started. Watch it come up with:
5073
5073
  name: "create-all",
5074
5074
  description: "Auto-generate createNew entries for all entities in the export data. Use when importing into a fresh workspace.",
5075
5075
  isFlag: true
5076
- },
5077
- {
5078
- name: "activate-webhooks",
5079
- 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.",
5080
- isFlag: true
5081
5076
  }
5082
5077
  ],
5083
5078
  examples: [
5084
5079
  "yarn gr workspaces import -w $UUID --env dev --file export.json --create-all",
5085
5080
  "yarn gr workspaces import -w $UUID --env dev --file export.zip --create-all",
5086
- `yarn gr workspaces import -w $UUID --env dev --data '{"exportData": ..., "createNew": ..., "importMappings": {}}'`,
5087
- "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": {}}'`
5088
5082
  ],
5089
5083
  handler: async ({ ctx, workspace, data, args }) => {
5090
5084
  if (!data) throw new CLIError("JSON or ZIP data required (--data, --file, or stdin)");
@@ -5103,7 +5097,6 @@ Provisioning started. Watch it come up with:
5103
5097
  payload = data;
5104
5098
  }
5105
5099
  const createAll = args["create-all"] === true;
5106
- const activateWebhooks = args["activate-webhooks"] === true;
5107
5100
  const parsed = parseImportPayload(payload);
5108
5101
  const { exportData, importMappings } = parsed;
5109
5102
  const createNew = createAll ? deriveCreateNew(exportData, parsed.createNew) : parsed.createNew;
@@ -5113,7 +5106,6 @@ Provisioning started. Watch it come up with:
5113
5106
  importMappings,
5114
5107
  createNew,
5115
5108
  archive,
5116
- activateWebhooks,
5117
5109
  // Forwarded as parsed: present when the payload carried it,
5118
5110
  // absent otherwise. The server reads presence (see
5119
5111
  // `ParsedImportPayload`), so this is the operator's choice of
@@ -5267,7 +5259,7 @@ Provisioning started. Watch it come up with:
5267
5259
  },
5268
5260
  {
5269
5261
  name: "bindings-file",
5270
- 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."
5271
5263
  },
5272
5264
  {
5273
5265
  name: "yes",
@@ -6484,15 +6476,6 @@ var ACTION_PARAM_HINTS = {
6484
6476
  "Template vars such as {{member}} describe the event, whoever receives it."
6485
6477
  ]
6486
6478
  },
6487
- "webhook:send": {
6488
- summary: "legacy: existing rules only \u2014 POST the event payload to a URL",
6489
- shape: ['{"webhookUrl":"https://example.com/hook"}'],
6490
- notes: [
6491
- "New webhook:send rules are refused; set up new integrations under Organization \u2192 Webhooks.",
6492
- "This shape is for updating an existing rule: webhookUrl must be https in production,",
6493
- "and an update that omits signingSecret keeps the stored secret."
6494
- ]
6495
- },
6496
6479
  "assistant:message": {
6497
6480
  summary: "inject an assistant message into the chat",
6498
6481
  shape: [
@@ -6802,8 +6785,8 @@ ${EVENT_RULE_FIELD_REFERENCE}`,
6802
6785
  "Common actionTypes: member:label, member:notify, email:send, sms:send,",
6803
6786
  " chat:create, member:upsert",
6804
6787
  "",
6805
- "New webhook:send rules are refused: set up outbound webhooks under",
6806
- "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).",
6807
6790
  "",
6808
6791
  'member:label actionParams: {"addLabelIds":["uuid"],"removeLabelIds":["uuid"]}'
6809
6792
  ]
@@ -13609,7 +13592,7 @@ var SUBSCRIPTION_COLUMNS = [
13609
13592
  { header: "PERIOD", getValue: (s) => String(s.planPeriod ?? "") },
13610
13593
  {
13611
13594
  header: "ORG",
13612
- getValue: (s) => String(s.customerOrganizationUuid ?? s.organizationUuid ?? "")
13595
+ getValue: (s) => String(s.organizationUuid ?? "")
13613
13596
  }
13614
13597
  ];
13615
13598
  var CONTRACT_BEARING_STATUSES = /* @__PURE__ */ new Set([
@@ -13744,9 +13727,7 @@ Then check it landed:
13744
13727
  ]);
13745
13728
  return;
13746
13729
  }
13747
- const orgUuid = String(
13748
- contract.organizationUuid ?? contract.customerOrganizationUuid ?? "<org-uuid>"
13749
- );
13730
+ const orgUuid = String(contract.organizationUuid ?? "<org-uuid>");
13750
13731
  hint(ctx, [
13751
13732
  "You have an active subscription. Add a workspace:",
13752
13733
  ` gr workspaces create --org ${orgUuid} --name "My Workspace"`
@@ -13778,48 +13759,48 @@ var INVOICE_COLUMNS = [
13778
13759
  ];
13779
13760
  var commands = [
13780
13761
  {
13781
- path: ["billing", "customers"],
13782
- description: "List your customer accounts",
13762
+ path: ["billing", "organizations"],
13763
+ description: "List Organizations where you have billing access",
13783
13764
  requiresWorkspace: false,
13784
13765
  handler: async (hctx) => {
13785
- const result = await requireAuth(hctx.ctx).apiClient.getMyCustomers();
13766
+ const result = await requireAuth(hctx.ctx).apiClient.getBillingOrganizations();
13786
13767
  outputData(listResult(result, false), hctx.ctx);
13787
13768
  }
13788
13769
  },
13789
13770
  {
13790
- path: ["billing", "customer"],
13791
- description: "Get a customer by UUID",
13792
- 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],
13793
13774
  requiresWorkspace: false,
13794
13775
  handler: async (hctx) => {
13795
- const uuid = hctx.args.uuid;
13796
- 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);
13797
13778
  outputSingle(result, hctx.ctx);
13798
13779
  }
13799
13780
  },
13800
13781
  {
13801
- path: ["billing", "update-customer"],
13802
- 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",
13803
13784
  mutates: true,
13804
13785
  args: [
13805
- { name: "uuid", description: "Customer UUID", required: true },
13806
- { name: "name", description: "Customer name" },
13786
+ ORG_UUID_ARG,
13787
+ { name: "name", description: "Invoice name" },
13807
13788
  { name: "email", description: "Billing email" },
13808
13789
  { name: "phone", description: "Phone number" },
13809
13790
  { name: "description", description: "Description / notes" }
13810
13791
  ],
13811
13792
  requiresWorkspace: false,
13812
13793
  handler: async (hctx) => {
13813
- const uuid = hctx.args.uuid;
13794
+ const uuid = requireOrgRef(hctx.args);
13814
13795
  const data = {};
13815
13796
  if (hctx.args.name) data.name = hctx.args.name;
13816
- if (hctx.args.email) data.email = hctx.args.email;
13797
+ if (hctx.args.email) data.billingEmail = hctx.args.email;
13817
13798
  if (hctx.args.phone) data.phone = hctx.args.phone;
13818
13799
  if (hctx.args.description) data.description = hctx.args.description;
13819
13800
  if (Object.keys(data).length === 0 && !hctx.data) {
13820
13801
  throw new CLIError("Provide --name, --email, --phone, --description, or JSON data");
13821
13802
  }
13822
- const result = await requireAuth(hctx.ctx).apiClient.updateMyCustomer(
13803
+ const result = await requireAuth(hctx.ctx).apiClient.updateOrganizationBilling(
13823
13804
  uuid,
13824
13805
  hctx.data ? hctx.data : data
13825
13806
  );
@@ -13827,31 +13808,33 @@ var commands = [
13827
13808
  }
13828
13809
  },
13829
13810
  {
13830
- path: ["billing", "invoices"],
13831
- description: "List invoices for a customer",
13832
- 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],
13833
13814
  requiresWorkspace: false,
13834
13815
  handler: async (hctx) => {
13835
- const uuid = hctx.args.uuid;
13836
- 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);
13837
13818
  outputData(listResult(result, false), hctx.ctx, INVOICE_COLUMNS);
13838
13819
  }
13839
13820
  },
13840
13821
  {
13841
- path: ["billing", "subscriptions"],
13842
- description: "List subscriptions for a customer",
13843
- 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],
13844
13825
  requiresWorkspace: false,
13845
13826
  handler: async (hctx) => {
13846
- const uuid = hctx.args.uuid;
13847
- 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
+ );
13848
13831
  outputData(listResult(result, false), hctx.ctx);
13849
13832
  }
13850
13833
  }
13851
13834
  ];
13852
13835
  var billingPortalDomain = {
13853
13836
  name: "billing",
13854
- description: "Billing portal (customer invoices, subscriptions)",
13837
+ description: "Organization billing, invoices and subscriptions",
13855
13838
  commands
13856
13839
  };
13857
13840
 
@@ -14564,11 +14547,11 @@ var operatorGroupsDomain = {
14564
14547
  // src/domains/org-billing.ts
14565
14548
  async function subject(hctx) {
14566
14549
  const auth = requireAuth(hctx.ctx);
14567
- const billing = await auth.apiClient.getOrgBillingCustomer(requireOrgRef(hctx.args));
14568
- if (!billing.hasAccess || !billing.customerUuid || !billing.subscriptionId) {
14569
- 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");
14570
14553
  }
14571
- return { auth, billing };
14554
+ return { auth, billing, orgUuid: requireOrgRef(hctx.args) };
14572
14555
  }
14573
14556
  var orgBillingCommands = [
14574
14557
  {
@@ -14576,14 +14559,8 @@ var orgBillingCommands = [
14576
14559
  description: "Read only this organization\u2019s billable subscription",
14577
14560
  args: [ORG_UUID_ARG],
14578
14561
  handler: async (hctx) => {
14579
- const { auth, billing } = await subject(hctx);
14580
- outputSingle(
14581
- await auth.apiClient.getMyCustomerSubscriptions(billing.customerUuid, {
14582
- subscriptionId: billing.subscriptionId,
14583
- pageSize: 1
14584
- }),
14585
- hctx.ctx
14586
- );
14562
+ const { auth, orgUuid } = await subject(hctx);
14563
+ outputSingle(await auth.apiClient.getOrganizationSubscription(orgUuid), hctx.ctx);
14587
14564
  }
14588
14565
  },
14589
14566
  {
@@ -14593,18 +14570,18 @@ var orgBillingCommands = [
14593
14570
  mutates: true,
14594
14571
  acceptsJsonInput: true,
14595
14572
  handler: async (hctx) => {
14596
- const { auth, billing } = await subject(hctx);
14573
+ const { auth, orgUuid } = await subject(hctx);
14597
14574
  if (!hctx.data || typeof hctx.data !== "object" || Array.isArray(hctx.data))
14598
14575
  throw new CLIError("Provide credit settings as a JSON object with --data");
14599
14576
  outputSingle(
14600
- await auth.apiClient.updateSubscription(billing.subscriptionId, hctx.data),
14577
+ await auth.apiClient.updateOrganizationCreditSettings(orgUuid, hctx.data),
14601
14578
  hctx.ctx
14602
14579
  );
14603
14580
  }
14604
14581
  },
14605
14582
  {
14606
14583
  path: ["org", "billing", "purchase-credits"],
14607
- 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)",
14608
14585
  args: [
14609
14586
  ORG_UUID_ARG,
14610
14587
  { name: "amount-cents", description: "Amount to charge in cents", required: true },
@@ -14615,13 +14592,13 @@ var orgBillingCommands = [
14615
14592
  ],
14616
14593
  mutates: true,
14617
14594
  handler: async (hctx) => {
14618
- const { auth, billing } = await subject(hctx);
14595
+ const { auth, orgUuid } = await subject(hctx);
14619
14596
  const amount = Number(hctx.args["amount-cents"]);
14620
14597
  if (!Number.isInteger(amount) || amount < 100 || amount > 1e7)
14621
14598
  throw new CLIError("Use an integer amount between 100 and 10000000 cents");
14622
14599
  outputSingle(
14623
- await auth.apiClient.purchaseCredits(
14624
- billing.subscriptionId,
14600
+ await auth.apiClient.purchaseOrganizationCredits(
14601
+ orgUuid,
14625
14602
  amount,
14626
14603
  hctx.args["idempotency-key"]
14627
14604
  ),
@@ -19866,6 +19843,58 @@ var hubspotDomain = {
19866
19843
  name: "hubspot",
19867
19844
  description: "HubSpot CRM integration",
19868
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
+ },
19869
19898
  {
19870
19899
  path: ["hubspot", "booking-deals", "receipt"],
19871
19900
  description: "Inspect a booking receipt before operator recovery",
@@ -25694,7 +25723,7 @@ var topLevelCommands = [
25694
25723
  mutates: true,
25695
25724
  args: [{ name: "phone", description: "E.164 phone number (optional; prompts if omitted)" }],
25696
25725
  handler: async (hctx) => {
25697
- const { accountVerifyPhoneCommand } = await import("./account-verify-phone-KOK7STAQ.js");
25726
+ const { accountVerifyPhoneCommand } = await import("./account-verify-phone-VZYUPN64.js");
25698
25727
  await accountVerifyPhoneCommand(hctx);
25699
25728
  }
25700
25729
  },