@indigoai-us/hq-cli 5.345.159 → 5.345.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/command-catalog.generated.d.ts +4 -4
  3. package/dist/command-catalog.generated.js +4 -4
  4. package/dist/commands/access.d.ts +6 -0
  5. package/dist/commands/access.js +18 -1
  6. package/dist/commands/acl-lock.d.ts +41 -0
  7. package/dist/commands/acl-lock.js +28 -0
  8. package/dist/commands/agent-enroll.d.ts +2 -0
  9. package/dist/commands/agent-enroll.js +9 -4
  10. package/dist/commands/agents.js +5 -11
  11. package/dist/commands/billing-sponsor.d.ts +4 -4
  12. package/dist/commands/billing-sponsor.js +11 -11
  13. package/dist/commands/billing-usage.d.ts +22 -8
  14. package/dist/commands/billing-usage.js +57 -22
  15. package/dist/commands/billing.d.ts +7 -7
  16. package/dist/commands/billing.js +13 -13
  17. package/dist/commands/cloud-provision.js +2 -2
  18. package/dist/commands/cloud.js +7 -7
  19. package/dist/commands/db-remote-deps.js +12 -1
  20. package/dist/commands/files.js +19 -7
  21. package/dist/commands/meetings.d.ts +4 -4
  22. package/dist/commands/meetings.js +17 -8
  23. package/dist/commands/skill.js +6 -6
  24. package/dist/commands/whoami.js +1 -1
  25. package/dist/hook-engine-path.js +13 -2
  26. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +982 -426
  27. package/dist/hq-cloud-sync-runner/package.json +1 -1
  28. package/dist/lib/billing/plan-limit-refusals.d.ts +13 -3
  29. package/dist/lib/billing/plan-limit-refusals.js +26 -3
  30. package/dist/lib/billing/plan-limit-upgrade-url.d.ts +8 -0
  31. package/dist/lib/billing/plan-limit-upgrade-url.js +18 -0
  32. package/dist/lib/billing/plan-lock.d.ts +22 -6
  33. package/dist/lib/billing/plan-lock.js +58 -30
  34. package/dist/lib/billing/usage-cost.d.ts +24 -2
  35. package/dist/lib/billing/usage-cost.js +103 -3
  36. package/dist/lib/billing/usage-only.d.ts +37 -1
  37. package/dist/lib/billing/usage-only.js +89 -4
  38. package/dist/lib/billing/usage-pause.d.ts +27 -0
  39. package/dist/lib/billing/usage-pause.js +50 -0
  40. package/dist/lib/db/control-plane.d.ts +5 -0
  41. package/dist/lib/db/control-plane.js +10 -0
  42. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  43. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  44. package/dist/lib/hook-engine/resolve.d.ts +14 -0
  45. package/dist/lib/hook-engine/resolve.js +55 -1
  46. package/dist/lib/plan-limit-nag.d.ts +0 -16
  47. package/dist/lib/plan-limit-nag.js +17 -18
  48. package/dist/main.d.ts +0 -2
  49. package/dist/main.js +19 -57
  50. package/dist/utils/plan-gate-error.d.ts +30 -14
  51. package/dist/utils/plan-gate-error.js +60 -46
  52. package/dist/utils/team-upgrade.d.ts +19 -6
  53. package/dist/utils/team-upgrade.js +37 -39
  54. package/package.json +8 -8
@@ -1,58 +1,56 @@
1
1
  import { isHeadless } from "./headless.js";
2
2
  import open from "open";
3
- import { ensureCognitoToken } from "./cognito-session.js";
4
- import { getCompanyUid, vaultApiFetch } from "./vault-api.js";
5
- const CHECKOUT_SUCCESS_URL = "https://hq.computer/billing?checkout=success";
6
- const CHECKOUT_CANCEL_URL = "https://hq.computer/billing?checkout=cancel";
7
- function ownerUpgradeError() {
8
- return Object.assign(new Error("Only a company owner can upgrade. Ask a company owner to upgrade."), { expected: true });
3
+ import { usageSwitchPageUrl } from "../lib/billing/plan-limit-upgrade-url.js";
4
+ import { resolveProcessFlagCompanyContext } from "../lib/process-flag-company-context.js";
5
+ /** The lines printed before the switch page link. Names no plan. */
6
+ export function usageSwitchLines(url) {
7
+ return [
8
+ "The flat plans are closed to new subscribers. To move this company onto usage pricing, switch from its Billing page.",
9
+ "Usage pricing has no plan fee: you pay for what you use.",
10
+ "Add a card first with `hq billing checkout`, then switch here (company owners only):",
11
+ url,
12
+ ];
9
13
  }
14
+ /** The fallback sentence when no console origin can be derived. */
15
+ export const USAGE_SWITCH_NO_URL_MESSAGE = "Switch this company to usage pricing from its Billing page in the HQ Console.";
10
16
  /**
11
- * Start the owner-gated HQ Workforce Checkout flow. Stripe collects payment details
12
- * in its hosted browser page; the CLI never receives card data.
17
+ * Print (and open, unless told not to) the company's usage-pricing switch
18
+ * page. Returns the URL, or null when none could be built.
13
19
  */
14
- export async function upgradeToTeam(opts = {}) {
15
- const token = await ensureCognitoToken();
16
- const companyUid = opts.companyUid ?? await getCompanyUid(token, opts.company);
17
- const response = await vaultApiFetch({
18
- token,
19
- path: "/v1/billing/checkout/team",
20
- method: "POST",
21
- body: {
22
- companyUid,
23
- entrySurface: "cli_limit",
24
- successUrl: CHECKOUT_SUCCESS_URL,
25
- cancelUrl: CHECKOUT_CANCEL_URL,
26
- },
27
- });
28
- if (!response.ok) {
29
- const body = (await response.json().catch(() => ({})));
30
- if (response.status === 403 || /owner/i.test(`${body.error ?? ""} ${body.message ?? ""}`)) {
31
- throw ownerUpgradeError();
20
+ export async function openUsageSwitch(opts = {}) {
21
+ const write = opts.write ?? ((text) => process.stdout.write(text));
22
+ const slug = opts.companySlug?.trim() || resolveProcessFlagCompanyContext().companySlug || undefined;
23
+ const url = usageSwitchPageUrl(slug);
24
+ if (!url) {
25
+ if (opts.json) {
26
+ write(`${JSON.stringify({ url: null, message: USAGE_SWITCH_NO_URL_MESSAGE })}\n`);
32
27
  }
33
- throw Object.assign(new Error(`Could not start HQ Workforce checkout: ${body.error ?? body.message ?? response.statusText}`), { expected: true });
34
- }
35
- const { url } = (await response.json());
36
- if (typeof url !== "string" || !url) {
37
- throw new Error("Checkout response did not include a hosted checkout URL.");
28
+ else {
29
+ write(`${USAGE_SWITCH_NO_URL_MESSAGE}\n`);
30
+ }
31
+ return null;
38
32
  }
39
- const write = opts.write ?? ((text) => process.stdout.write(text));
40
33
  if (opts.json) {
41
- write(`${JSON.stringify({ url })}\n`);
34
+ write(`${JSON.stringify({
35
+ url,
36
+ legacyPlansClosed: true,
37
+ message: usageSwitchLines(url).slice(0, 3).join(" "),
38
+ })}\n`);
42
39
  return url;
43
40
  }
44
- write("Opening HQ Workforce checkout ($500/mo) in your browser — finish there and you're upgraded.\n");
41
+ for (const line of usageSwitchLines(url))
42
+ write(`${line}\n`);
45
43
  const skipBrowser = opts.noBrowser || (opts.headless ?? isHeadless());
46
- if (skipBrowser) {
47
- write(`Open this URL to continue: ${url}\n`);
48
- return url;
49
- }
44
+ if (!skipBrowser)
45
+ await openInBrowser(url, opts);
46
+ return url;
47
+ }
48
+ async function openInBrowser(url, opts) {
50
49
  try {
51
50
  await (opts.openUrl ?? open)(url);
52
51
  }
53
52
  catch (err) {
54
53
  (opts.error ?? ((text) => process.stderr.write(text)))(`Couldn't launch your browser (${err instanceof Error ? err.message : String(err)}). Open this URL to continue: ${url}\n`);
55
54
  }
56
- return url;
57
55
  }
58
56
  //# sourceMappingURL=team-upgrade.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.159",
3
+ "version": "5.345.160",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -52,7 +52,7 @@
52
52
  "@aws-sdk/client-iot-data-plane": "^3.1096.0",
53
53
  "@aws-sdk/client-s3": "^3.1049.0",
54
54
  "@aws-sdk/dsql-signer": "^3.1146.0",
55
- "@indigoai-us/hq-cloud": "6.18.97",
55
+ "@indigoai-us/hq-cloud": "6.18.98",
56
56
  "@indigoai-us/hq-flags-client": "^0.1.2",
57
57
  "@modelcontextprotocol/sdk": "1.29.0",
58
58
  "@sentry/node": "^10.49.0",
@@ -114,11 +114,11 @@
114
114
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
115
115
  },
116
116
  "optionalDependencies": {
117
- "@indigoai-us/hq-hook-win32-x64": "5.345.159",
118
- "@indigoai-us/hq-hook-win32-arm64": "5.345.159",
119
- "@indigoai-us/hq-hook-darwin-x64": "5.345.159",
120
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.159",
121
- "@indigoai-us/hq-hook-linux-x64": "5.345.159",
122
- "@indigoai-us/hq-hook-linux-arm64": "5.345.159"
117
+ "@indigoai-us/hq-hook-win32-x64": "5.345.160",
118
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.160",
119
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.160",
120
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.160",
121
+ "@indigoai-us/hq-hook-linux-x64": "5.345.160",
122
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.160"
123
123
  }
124
124
  }