@indigoai-us/hq-cli 5.345.143 → 5.345.145

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 (69) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/command-catalog.generated.d.ts +286 -6
  3. package/dist/command-catalog.generated.js +351 -6
  4. package/dist/command-registration-plan.d.ts +6 -0
  5. package/dist/command-registration-plan.js +1 -0
  6. package/dist/commands/agent-enroll.d.ts +1 -0
  7. package/dist/commands/agent-enroll.js +7 -0
  8. package/dist/commands/agents.d.ts +25 -3
  9. package/dist/commands/agents.js +57 -4
  10. package/dist/commands/api-keys.js +66 -8
  11. package/dist/commands/billing-sponsor.d.ts +4 -0
  12. package/dist/commands/billing-sponsor.js +48 -5
  13. package/dist/commands/billing-usage.d.ts +59 -0
  14. package/dist/commands/billing-usage.js +162 -0
  15. package/dist/commands/billing.d.ts +9 -0
  16. package/dist/commands/billing.js +29 -2
  17. package/dist/commands/core-checkpoint-native.d.ts +30 -0
  18. package/dist/commands/core-checkpoint-native.js +167 -10
  19. package/dist/commands/core-job-notify-native.js +53 -3
  20. package/dist/commands/core-jobs-native.d.ts +8 -0
  21. package/dist/commands/core-jobs-native.js +34 -2
  22. package/dist/commands/core-policy.js +76 -13
  23. package/dist/commands/library-add.d.ts +120 -0
  24. package/dist/commands/library-add.js +434 -0
  25. package/dist/commands/library-caption.d.ts +112 -0
  26. package/dist/commands/library-caption.js +393 -0
  27. package/dist/commands/library-link.d.ts +32 -0
  28. package/dist/commands/library-link.js +95 -0
  29. package/dist/commands/library.d.ts +72 -0
  30. package/dist/commands/library.js +527 -0
  31. package/dist/commands/meetings.d.ts +8 -0
  32. package/dist/commands/meetings.js +25 -2
  33. package/dist/commands/members.d.ts +20 -0
  34. package/dist/commands/members.js +51 -2
  35. package/dist/commands/storage-offload.d.ts +16 -2
  36. package/dist/commands/storage-offload.js +55 -4
  37. package/dist/commands/storage.d.ts +8 -1
  38. package/dist/commands/storage.js +6 -2
  39. package/dist/commands/whoami.js +9 -0
  40. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +2410 -2063
  41. package/dist/hq-cloud-sync-runner/package.json +1 -1
  42. package/dist/lib/billing/plan-lock.d.ts +15 -1
  43. package/dist/lib/billing/plan-lock.js +45 -5
  44. package/dist/lib/billing/usage-card.d.ts +82 -0
  45. package/dist/lib/billing/usage-card.js +198 -0
  46. package/dist/lib/billing/usage-cost.d.ts +214 -0
  47. package/dist/lib/billing/usage-cost.js +440 -0
  48. package/dist/lib/billing/usage-only.d.ts +87 -0
  49. package/dist/lib/billing/usage-only.js +262 -0
  50. package/dist/lib/billing/usage-rate-card.d.ts +51 -0
  51. package/dist/lib/billing/usage-rate-card.js +62 -0
  52. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  53. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  54. package/dist/lib/plan-limit-nag.d.ts +4 -6
  55. package/dist/lib/plan-limit-nag.js +19 -1
  56. package/dist/lib/provider-launcher.d.ts +22 -0
  57. package/dist/lib/provider-launcher.js +65 -0
  58. package/dist/lib/search-index/index.d.ts +2 -0
  59. package/dist/lib/search-index/index.js +34 -0
  60. package/dist/lib/search-index/max-doc-bytes.d.ts +2 -1
  61. package/dist/lib/search-index/max-doc-bytes.js +2 -1
  62. package/dist/main.d.ts +9 -0
  63. package/dist/main.js +20 -3
  64. package/dist/utils/billing-gate.d.ts +19 -4
  65. package/dist/utils/billing-gate.js +25 -4
  66. package/dist/utils/plan-gate-error.d.ts +10 -0
  67. package/dist/utils/plan-gate-error.js +54 -0
  68. package/dist/utils/vault-api.js +4 -1
  69. package/package.json +2 -2
@@ -2902,6 +2902,16 @@ export const COMMAND_CATALOG = [
2902
2902
  "flags": "--expires <ISO8601>",
2903
2903
  "description": "Optional ISO-8601 expiry timestamp",
2904
2904
  "hidden": false
2905
+ },
2906
+ {
2907
+ "flags": "--preset <name>",
2908
+ "description": "Grant a fixed capability bundle: library-agent (library-agent = search:query, files:read)",
2909
+ "hidden": false
2910
+ },
2911
+ {
2912
+ "flags": "--allow-upload",
2913
+ "description": "With --preset library-agent, also grant files:write (hq library add)",
2914
+ "hidden": false
2905
2915
  }
2906
2916
  ],
2907
2917
  "subcommands": []
@@ -4323,6 +4333,16 @@ export const COMMAND_CATALOG = [
4323
4333
  "flags": "--pending",
4324
4334
  "description": "List pending invites instead of active members",
4325
4335
  "hidden": false
4336
+ },
4337
+ {
4338
+ "flags": "--ids",
4339
+ "description": "Add a PERSON_ID column (the prs_ id used in grants and membership keys)",
4340
+ "hidden": false
4341
+ },
4342
+ {
4343
+ "flags": "--json",
4344
+ "description": "Print machine-readable JSON, including each person id",
4345
+ "hidden": false
4326
4346
  }
4327
4347
  ],
4328
4348
  "subcommands": []
@@ -7811,7 +7831,7 @@ export const COMMAND_CATALOG = [
7811
7831
  },
7812
7832
  {
7813
7833
  "flags": "--size <size>",
7814
- "description": "Agent box size: basic | power | dev (omitted keeps the current default)",
7834
+ "description": "Agent box size: small | medium | large | xlarge, or basic | power | dev (on usage pricing these map to small | medium | large); omitted keeps the current default",
7815
7835
  "hidden": false
7816
7836
  },
7817
7837
  {
@@ -9008,7 +9028,7 @@ export const COMMAND_CATALOG = [
9008
9028
  },
9009
9029
  {
9010
9030
  "flags": "--cron <expr>",
9011
- "description": "Recurring schedule, such as rate(1 day) or a cron expression",
9031
+ "description": "Recurring schedule: rate(N minutes|hours|days), a five-field cron with * for day of month and month (such as \"*/15 * * * *\"; translated to the AWS form), or cron(MIN HOUR ? * DOW *)",
9012
9032
  "hidden": false
9013
9033
  },
9014
9034
  {
@@ -9265,6 +9285,11 @@ export const COMMAND_CATALOG = [
9265
9285
  "description": "Outpost id (defaults to your primary box)",
9266
9286
  "hidden": false
9267
9287
  },
9288
+ {
9289
+ "flags": "--company <slug>",
9290
+ "description": "Request a new sign-in link for the company's Outpost (owner or admin)",
9291
+ "hidden": false
9292
+ },
9268
9293
  {
9269
9294
  "flags": "--json",
9270
9295
  "description": "Emit raw JSON",
@@ -9296,6 +9321,11 @@ export const COMMAND_CATALOG = [
9296
9321
  "description": "Outpost id (defaults to your primary box)",
9297
9322
  "hidden": false
9298
9323
  },
9324
+ {
9325
+ "flags": "--company <slug>",
9326
+ "description": "Sign in the company's Outpost (owner or admin)",
9327
+ "hidden": false
9328
+ },
9299
9329
  {
9300
9330
  "flags": "--json",
9301
9331
  "description": "Emit raw JSON",
@@ -9403,7 +9433,7 @@ export const COMMAND_CATALOG = [
9403
9433
  },
9404
9434
  {
9405
9435
  "name": "upgrade",
9406
- "description": "Open Stripe Checkout to upgrade this company to HQ Workforce ($500/mo)",
9436
+ "description": "Open Stripe Checkout to upgrade a company on an earlier plan (usage-pricing companies have no plan to upgrade)",
9407
9437
  "aliases": [],
9408
9438
  "hidden": false,
9409
9439
  "helpOption": true,
@@ -9432,7 +9462,7 @@ export const COMMAND_CATALOG = [
9432
9462
  },
9433
9463
  {
9434
9464
  "name": "sponsor",
9435
- "description": "Ask a company to cover your $50 plan, or answer a request",
9465
+ "description": "Ask a company to cover your personal HQ plan, or answer a request",
9436
9466
  "aliases": [],
9437
9467
  "hidden": false,
9438
9468
  "helpOption": true,
@@ -9444,7 +9474,7 @@ export const COMMAND_CATALOG = [
9444
9474
  "subcommands": [
9445
9475
  {
9446
9476
  "name": "request",
9447
- "description": "Ask a company to cover your $50 HQ plan",
9477
+ "description": "Ask a company to cover your personal HQ plan",
9448
9478
  "aliases": [],
9449
9479
  "hidden": false,
9450
9480
  "helpOption": true,
@@ -9494,7 +9524,7 @@ export const COMMAND_CATALOG = [
9494
9524
  },
9495
9525
  {
9496
9526
  "name": "approve",
9497
- "description": "Say yes — put someone's $50 plan on the company bill",
9527
+ "description": "Say yes — put someone's personal plan on the company bill",
9498
9528
  "aliases": [],
9499
9529
  "hidden": false,
9500
9530
  "helpOption": true,
@@ -9597,6 +9627,50 @@ export const COMMAND_CATALOG = [
9597
9627
  "subcommands": []
9598
9628
  }
9599
9629
  ]
9630
+ },
9631
+ {
9632
+ "name": "usage",
9633
+ "description": "Show this month's usage, projected bill, included usage left and what drives it (read-only)",
9634
+ "aliases": [],
9635
+ "hidden": false,
9636
+ "helpOption": true,
9637
+ "helpCommand": false,
9638
+ "usage": "[options]",
9639
+ "helpText": [],
9640
+ "arguments": [],
9641
+ "options": [
9642
+ {
9643
+ "flags": "--company <slug>",
9644
+ "description": "One of your companies (default: your only company)",
9645
+ "hidden": false
9646
+ },
9647
+ {
9648
+ "flags": "--personal",
9649
+ "description": "Your personal HQ instead of a company",
9650
+ "hidden": false
9651
+ },
9652
+ {
9653
+ "flags": "--no-storage-scan",
9654
+ "description": "Skip listing cloud file versions (faster; no old-versions split)",
9655
+ "hidden": false
9656
+ },
9657
+ {
9658
+ "flags": "--fresh",
9659
+ "description": "List cloud file versions live instead of using figures from the last 15 minutes",
9660
+ "hidden": false
9661
+ },
9662
+ {
9663
+ "flags": "--card",
9664
+ "description": "Print the usage price card (meters, included usage, trial, boxes, domains) and exit",
9665
+ "hidden": false
9666
+ },
9667
+ {
9668
+ "flags": "--json",
9669
+ "description": "Print JSON",
9670
+ "hidden": false
9671
+ }
9672
+ ],
9673
+ "subcommands": []
9600
9674
  }
9601
9675
  ]
9602
9676
  },
@@ -12013,6 +12087,277 @@ export const COMMAND_CATALOG = [
12013
12087
  }
12014
12088
  ]
12015
12089
  },
12090
+ {
12091
+ "name": "library",
12092
+ "description": "Company media library (.hqcloud asset placeholders)",
12093
+ "aliases": [],
12094
+ "hidden": false,
12095
+ "helpOption": true,
12096
+ "helpCommand": true,
12097
+ "usage": "[options] [command]",
12098
+ "helpText": [],
12099
+ "arguments": [],
12100
+ "options": [],
12101
+ "subcommands": [
12102
+ {
12103
+ "name": "search",
12104
+ "description": "Search library assets in the cloud, falling back to the local index when offline",
12105
+ "aliases": [],
12106
+ "hidden": false,
12107
+ "helpOption": true,
12108
+ "helpCommand": false,
12109
+ "usage": "[options] [query...]",
12110
+ "helpText": [],
12111
+ "arguments": [
12112
+ {
12113
+ "name": "query",
12114
+ "required": false,
12115
+ "variadic": true,
12116
+ "description": "Query terms (joined with spaces)"
12117
+ }
12118
+ ],
12119
+ "options": [
12120
+ {
12121
+ "flags": "--tag <tag>",
12122
+ "description": "Require a tag (repeatable or comma-separated)",
12123
+ "hidden": false,
12124
+ "defaultValue": []
12125
+ },
12126
+ {
12127
+ "flags": "--company <slug>",
12128
+ "description": "Restrict to one company",
12129
+ "hidden": false
12130
+ },
12131
+ {
12132
+ "flags": "-n, --count <count>",
12133
+ "description": "Maximum result count",
12134
+ "hidden": false
12135
+ },
12136
+ {
12137
+ "flags": "--json",
12138
+ "description": "Print machine-readable JSON",
12139
+ "hidden": false
12140
+ }
12141
+ ],
12142
+ "subcommands": []
12143
+ },
12144
+ {
12145
+ "name": "add",
12146
+ "description": "Upload files or URLs to the company vault and add .hqcloud placeholders to the library",
12147
+ "aliases": [],
12148
+ "hidden": false,
12149
+ "helpOption": true,
12150
+ "helpCommand": false,
12151
+ "usage": "[options] <sources...>",
12152
+ "helpText": [],
12153
+ "arguments": [
12154
+ {
12155
+ "name": "sources",
12156
+ "required": true,
12157
+ "variadic": true,
12158
+ "description": "Local files or http(s) URLs"
12159
+ }
12160
+ ],
12161
+ "options": [
12162
+ {
12163
+ "flags": "--to <dir>",
12164
+ "description": "Library folder inside companies/<co>/ (default companies/<co>/library)",
12165
+ "hidden": false
12166
+ },
12167
+ {
12168
+ "flags": "--tags <tags>",
12169
+ "description": "Tags (comma-separated, repeatable)",
12170
+ "hidden": false,
12171
+ "defaultValue": []
12172
+ },
12173
+ {
12174
+ "flags": "--title <title>",
12175
+ "description": "Asset title (default: the file name)",
12176
+ "hidden": false
12177
+ },
12178
+ {
12179
+ "flags": "--note <text>",
12180
+ "description": "Asset description",
12181
+ "hidden": false
12182
+ },
12183
+ {
12184
+ "flags": "--company <slug>",
12185
+ "description": "Company whose vault receives the files",
12186
+ "hidden": false
12187
+ },
12188
+ {
12189
+ "flags": "--no-caption",
12190
+ "description": "Skip the AI description and suggested tags for images and videos",
12191
+ "hidden": false
12192
+ },
12193
+ {
12194
+ "flags": "--json",
12195
+ "description": "Print machine-readable JSON",
12196
+ "hidden": false
12197
+ }
12198
+ ],
12199
+ "subcommands": []
12200
+ },
12201
+ {
12202
+ "name": "tag",
12203
+ "description": "Add or remove tags on a library placeholder",
12204
+ "aliases": [],
12205
+ "hidden": false,
12206
+ "helpOption": true,
12207
+ "helpCommand": false,
12208
+ "usage": "[options] <placeholder>",
12209
+ "helpText": [],
12210
+ "arguments": [
12211
+ {
12212
+ "name": "placeholder",
12213
+ "required": true,
12214
+ "variadic": false,
12215
+ "description": "A .hqcloud placeholder (or the original path)"
12216
+ }
12217
+ ],
12218
+ "options": [
12219
+ {
12220
+ "flags": "--add <tags>",
12221
+ "description": "Tags to add (comma-separated, repeatable)",
12222
+ "hidden": false,
12223
+ "defaultValue": []
12224
+ },
12225
+ {
12226
+ "flags": "--remove <tags>",
12227
+ "description": "Tags to remove (comma-separated, repeatable)",
12228
+ "hidden": false,
12229
+ "defaultValue": []
12230
+ },
12231
+ {
12232
+ "flags": "--json",
12233
+ "description": "Print machine-readable JSON",
12234
+ "hidden": false
12235
+ }
12236
+ ],
12237
+ "subcommands": []
12238
+ },
12239
+ {
12240
+ "name": "ls",
12241
+ "description": "List library placeholders in a folder (default: companies/)",
12242
+ "aliases": [],
12243
+ "hidden": false,
12244
+ "helpOption": true,
12245
+ "helpCommand": false,
12246
+ "usage": "[options] [dir]",
12247
+ "helpText": [],
12248
+ "arguments": [
12249
+ {
12250
+ "name": "dir",
12251
+ "required": false,
12252
+ "variadic": false,
12253
+ "description": "Folder to list, relative to HQ"
12254
+ }
12255
+ ],
12256
+ "options": [
12257
+ {
12258
+ "flags": "--tag <tag>",
12259
+ "description": "Require a tag (repeatable or comma-separated)",
12260
+ "hidden": false,
12261
+ "defaultValue": []
12262
+ },
12263
+ {
12264
+ "flags": "--json",
12265
+ "description": "Print machine-readable JSON",
12266
+ "hidden": false
12267
+ }
12268
+ ],
12269
+ "subcommands": []
12270
+ },
12271
+ {
12272
+ "name": "describe",
12273
+ "description": "Re-run the AI description and suggested tags for a library image or video",
12274
+ "aliases": [],
12275
+ "hidden": false,
12276
+ "helpOption": true,
12277
+ "helpCommand": false,
12278
+ "usage": "[options] <placeholder>",
12279
+ "helpText": [],
12280
+ "arguments": [
12281
+ {
12282
+ "name": "placeholder",
12283
+ "required": true,
12284
+ "variadic": false,
12285
+ "description": "A .hqcloud placeholder (or the original path)"
12286
+ }
12287
+ ],
12288
+ "options": [
12289
+ {
12290
+ "flags": "--json",
12291
+ "description": "Print machine-readable JSON",
12292
+ "hidden": false
12293
+ }
12294
+ ],
12295
+ "subcommands": []
12296
+ },
12297
+ {
12298
+ "name": "fetch",
12299
+ "description": "Download a library asset next to its placeholder (wraps hq storage fetch)",
12300
+ "aliases": [],
12301
+ "hidden": false,
12302
+ "helpOption": true,
12303
+ "helpCommand": false,
12304
+ "usage": "[options] <placeholder>",
12305
+ "helpText": [],
12306
+ "arguments": [
12307
+ {
12308
+ "name": "placeholder",
12309
+ "required": true,
12310
+ "variadic": false,
12311
+ "description": "A .hqcloud placeholder (or the original path)"
12312
+ }
12313
+ ],
12314
+ "options": [
12315
+ {
12316
+ "flags": "--json",
12317
+ "description": "Print machine-readable JSON",
12318
+ "hidden": false
12319
+ }
12320
+ ],
12321
+ "subcommands": []
12322
+ },
12323
+ {
12324
+ "name": "link",
12325
+ "description": "Mint a short-lived download URL for a library asset (needs files:read)",
12326
+ "aliases": [],
12327
+ "hidden": false,
12328
+ "helpOption": true,
12329
+ "helpCommand": false,
12330
+ "usage": "[options] <target>",
12331
+ "helpText": [],
12332
+ "arguments": [
12333
+ {
12334
+ "name": "target",
12335
+ "required": true,
12336
+ "variadic": false,
12337
+ "description": "A .hqcloud placeholder, its original path, or a vault key (.hq-offload/…)"
12338
+ }
12339
+ ],
12340
+ "options": [
12341
+ {
12342
+ "flags": "--company <company>",
12343
+ "description": "Company uid (cmp_…), or a slug on a session; default: the placeholder's company or the key's",
12344
+ "hidden": false
12345
+ },
12346
+ {
12347
+ "flags": "--expires <minutes>",
12348
+ "description": "Link lifetime in minutes, 1-60 (default 15)",
12349
+ "hidden": false
12350
+ },
12351
+ {
12352
+ "flags": "--json",
12353
+ "description": "Print machine-readable JSON",
12354
+ "hidden": false
12355
+ }
12356
+ ],
12357
+ "subcommands": []
12358
+ }
12359
+ ]
12360
+ },
12016
12361
  {
12017
12362
  "name": "index",
12018
12363
  "description": "Manage the local HQ search index",
@@ -448,6 +448,12 @@ export declare const REGISTRATION_PLAN: readonly [{
448
448
  readonly parent: "program";
449
449
  readonly module: "./commands/search.js";
450
450
  readonly exportName: "registerSearchCommand";
451
+ }, {
452
+ readonly type: "registrar";
453
+ readonly root: "library";
454
+ readonly parent: "program";
455
+ readonly module: "./commands/library.js";
456
+ readonly exportName: "registerLibraryCommand";
451
457
  }, {
452
458
  readonly type: "registrar";
453
459
  readonly root: "index";
@@ -77,6 +77,7 @@ export const REGISTRATION_PLAN = [
77
77
  { type: "registrar", root: "vault", parent: "program", module: "./commands/vault-retention.js", exportName: "registerVaultRetentionCommand" },
78
78
  { type: "registrar", root: "core", parent: "program", module: "./commands/core.js", exportName: "registerCoreCommands" },
79
79
  { type: "registrar", root: "search", parent: "program", module: "./commands/search.js", exportName: "registerSearchCommand" },
80
+ { type: "registrar", root: "library", parent: "program", module: "./commands/library.js", exportName: "registerLibraryCommand" },
80
81
  { type: "registrar", root: "index", parent: "program", module: "./commands/index-cmd.js", exportName: "registerIndexCommand" },
81
82
  { type: "registrar", root: "capacity", parent: "program", module: "./commands/capacity.js", exportName: "registerCapacityCommand" },
82
83
  { type: "registrar", root: "doctor", parent: "program", module: "./commands/doctor.js", exportName: "registerDoctorCommand" },
@@ -59,6 +59,7 @@ export declare function mapEnrollFailure(status: number, body: {
59
59
  message?: unknown;
60
60
  attemptsRemaining?: unknown;
61
61
  upgradeUrl?: unknown;
62
+ pricingPlan?: unknown;
62
63
  }, headers?: {
63
64
  retryAfter?: string | null;
64
65
  }): EnrollError;
@@ -20,6 +20,7 @@ import * as os from "node:os";
20
20
  import { CLI_VERSION } from "../cli-version.js";
21
21
  import { DEFAULT_VAULT_API_URL, personTokenCacheFile, } from "../utils/cognito-session.js";
22
22
  import { HQ_CLIENT_NAME } from "../utils/vault-api.js";
23
+ import { isUsageOnly, pricingPlanFromBody, usageOnlyCardRequiredLines, } from "../lib/billing/usage-only.js";
23
24
  import { queueCliLimitNoticeEngagement, queueCliLimitNoticeExposure, } from "../utils/cli-telemetry.js";
24
25
  import { networkTransportErrorCode } from "../utils/network-transport-error.js";
25
26
  import { canOfferTeamUpgrade, formatUpgradeRefusal, isPlanGateError, offerUpgradeLink, planGateErrorFromPayload, } from "../utils/plan-gate-error.js";
@@ -135,6 +136,12 @@ export function mapEnrollFailure(status, body, headers) {
135
136
  return new EnrollError(`This agent was revoked; its enrollment code no longer works. An admin must ` +
136
137
  `create a new external agent or rotate this one.${suffix}`, status, code);
137
138
  }
139
+ if ((status === 402 || code === "billing_required") &&
140
+ isUsageOnly(pricingPlanFromBody(body))) {
141
+ // Usage pricing (US-012): no paid plan to upgrade to. A company admin adds
142
+ // a card; the agent then bills per use.
143
+ return new EnrollError(usageOnlyCardRequiredLines("An external agent").join(" ") + suffix, status, code);
144
+ }
138
145
  if (status === 402 || code === "billing_required") {
139
146
  return new EnrollError(`External agents are available on paid HQ plans only. A company admin must ` +
140
147
  `upgrade the plan (\`hq billing\` or the console billing page) before enrolling.${suffix}`, status, code, typeof body.upgradeUrl === "string" ? body.upgradeUrl : undefined);
@@ -31,6 +31,8 @@ import { Command } from "commander";
31
31
  import { type ResidentCommandLeaseOptions } from "../utils/resident-package-preload.js";
32
32
  import { type TerminalSessionPayload } from "@indigoai-us/hq-cloud/outposts/node";
33
33
  import { type AgentModelProvider, type AgentModelCatalog } from "../lib/agents/model-catalog.js";
34
+ import { type PricingPlan } from "../lib/billing/usage-only.js";
35
+ import { type UsageCard } from "../lib/billing/usage-card.js";
34
36
  import { type BillingErrorPayload } from "../utils/billing-gate.js";
35
37
  /** Reasoning-effort values hq-pro accepts on `runtime-config`. */
36
38
  export declare const VALID_EFFORTS: Set<string>;
@@ -40,7 +42,14 @@ export declare const VALID_TIERS: Set<string>;
40
42
  export declare const VALID_PROVIDERS: Set<string>;
41
43
  /** Auth modes hq-pro accepts on `POST /v1/agents` (`CodexAuthMode`). */
42
44
  export declare const VALID_AUTH_MODES: Set<string>;
43
- /** Customer-facing agent size keys served by hq-pro's authoritative catalog. */
45
+ /**
46
+ * Customer-facing agent size keys served by hq-pro's authoritative catalog.
47
+ * basic / power / dev are the legacy ladder; small / medium / large / xlarge
48
+ * are the usage-pricing ladder (US-012). hq-pro returns the ladder that
49
+ * applies to the company, and a key it does not quote is refused with
50
+ * "did not return a quote".
51
+ */
52
+ export type AgentSizeKey = "basic" | "power" | "dev" | "small" | "medium" | "large" | "xlarge";
44
53
  export declare const VALID_AGENT_SIZE_KEYS: Set<string>;
45
54
  /**
46
55
  * `hq agents create` exits with this distinct status when payment is required.
@@ -64,6 +73,8 @@ export declare function agentCreatePlanLimitFromPayload(status: number, body: un
64
73
  export declare function surfaceAgentCreatePlanLimit(planLimit: AgentCreatePlanLimit, opts?: {
65
74
  json?: boolean;
66
75
  companyUid?: string;
76
+ pricingPlan?: PricingPlan | null;
77
+ usageCard?: UsageCard;
67
78
  }): Promise<void>;
68
79
  /**
69
80
  * Resolve a closed-set option value, or exit(1) with a message naming the
@@ -223,7 +234,7 @@ export declare function resolveProvisionSlackTokens(options: ProvisionSlackToken
223
234
  export declare const CLI_AGENT_CREATE_SURFACE: "cli_agents_create";
224
235
  export type AgentCreateSurface = typeof CLI_AGENT_CREATE_SURFACE;
225
236
  export interface AgentCreateSizeOption {
226
- key: "basic" | "power" | "dev";
237
+ key: AgentSizeKey;
227
238
  productName: string;
228
239
  instanceType: string;
229
240
  listCents: number;
@@ -247,8 +258,19 @@ export type QuotedAgentCreateSizeOption = AgentCreateSizeOption & {
247
258
  };
248
259
  /** Read hq-pro's company-specific creation prices and capacities. */
249
260
  export declare function getAgentCreateOptions(token: string, companyUid: string, idempotencyKey?: string): Promise<AgentCreateOptionsView>;
261
+ /**
262
+ * Legacy size names on the usage-pricing (v2) box ladder, owner decision
263
+ * 2026-10-16: basic -> small, power -> medium, dev -> large.
264
+ */
265
+ export declare const LEGACY_TO_V2_AGENT_SIZE: Readonly<Record<string, AgentSizeKey>>;
266
+ /**
267
+ * The size key to look up in the server's options. A key the server offers is
268
+ * used as is. A legacy key (basic, power, dev) against a v2 catalog maps to its
269
+ * v2 size. Anything else is returned unchanged and refused by the caller.
270
+ */
271
+ export declare function resolveAgentSizeKey(view: AgentCreateOptionsView, sizeKey: string): string;
250
272
  /** Resolve a requested size from the server response, never from local prices. */
251
- export declare function requireQuotedCreateSize(view: AgentCreateOptionsView, sizeKey: string): QuotedAgentCreateSizeOption;
273
+ export declare function requireQuotedCreateSize(view: AgentCreateOptionsView, requestedKey: string): QuotedAgentCreateSizeOption;
252
274
  /** Resolve hq-pro's default quote while leaving the POST default implicit. */
253
275
  export declare function requireDefaultAgentCreateSize(view: AgentCreateOptionsView): QuotedAgentCreateSizeOption;
254
276
  /** Human-facing quote summary sourced entirely from hq-pro. */
@@ -44,6 +44,8 @@ import { peekIdToken } from "../utils/id-token.js";
44
44
  import { canOfferTeamUpgrade, formatUpgradeRefusal, isPlanGateError, offerUpgradeLink, } from "../utils/plan-gate-error.js";
45
45
  import { AGENT_UID_PATTERN, isAgentUid } from "../lib/notify-recipient.js";
46
46
  import { AGENT_MODEL_PROVIDERS, modelSelectionErrorMessage, readAgentModelCatalog, validateAgentModelSelection, } from "../lib/agents/model-catalog.js";
47
+ import { fetchCompanyPricingPlan, isUsageOnly, usageOnlyBoxSentence, usageOnlyCardRequiredLines, } from "../lib/billing/usage-only.js";
48
+ import { BUNDLED_USAGE_CARD, fetchUsageCard, } from "../lib/billing/usage-card.js";
47
49
  import { confirmChargeOrExit, formatUsd, parseBillingPayload, surfaceBillingBlocked, } from "../utils/billing-gate.js";
48
50
  /** Reasoning-effort values hq-pro accepts on `runtime-config`. */
49
51
  export const VALID_EFFORTS = new Set([
@@ -59,8 +61,15 @@ export const VALID_TIERS = new Set(["default", "priority"]);
59
61
  export const VALID_PROVIDERS = new Set(["codex", "grok", "claude", "agents-v2"]);
60
62
  /** Auth modes hq-pro accepts on `POST /v1/agents` (`CodexAuthMode`). */
61
63
  export const VALID_AUTH_MODES = new Set(["subscription", "apiKey"]);
62
- /** Customer-facing agent size keys served by hq-pro's authoritative catalog. */
63
- export const VALID_AGENT_SIZE_KEYS = new Set(["basic", "power", "dev"]);
64
+ export const VALID_AGENT_SIZE_KEYS = new Set([
65
+ "basic",
66
+ "power",
67
+ "dev",
68
+ "small",
69
+ "medium",
70
+ "large",
71
+ "xlarge",
72
+ ]);
64
73
  // Keep cloud agent create slugs aligned with hq-pro-agents POST /v1/agents.
65
74
  const AGENT_SLUG_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/;
66
75
  const CLAUDE_PROVISION_COMMAND = "hq agents provision <name> --provider agents-v2 --model <model-id>";
@@ -146,6 +155,17 @@ async function offerAgentCheckout(url) {
146
155
  }
147
156
  /** Print a server-priced plan block without minting or rewriting its URL. */
148
157
  export async function surfaceAgentCreatePlanLimit(planLimit, opts = {}) {
158
+ if (isUsageOnly(opts.pricingPlan)) {
159
+ // Usage pricing (US-012): no Workforce plan to buy. The company adds a
160
+ // card and each agent box bills by size from the usage card.
161
+ const card = opts.usageCard ?? BUNDLED_USAGE_CARD;
162
+ for (const line of usageOnlyCardRequiredLines("An agent box", card)) {
163
+ console.error(line);
164
+ }
165
+ console.error(usageOnlyBoxSentence(card));
166
+ queueCliLimitNoticeExposure("agents", "refusal", opts.companyUid);
167
+ return;
168
+ }
149
169
  const price = `${formatServerPrice(planLimit.amountMinor, planLimit.currency)}/month`;
150
170
  const reason = `HQ Workforce plan required to create an agent (${price}).`;
151
171
  const argv = opts.json ? [...process.argv, "--json"] : process.argv;
@@ -351,8 +371,31 @@ export async function getAgentCreateOptions(token, companyUid, idempotencyKey) {
351
371
  }
352
372
  return view;
353
373
  }
374
+ /**
375
+ * Legacy size names on the usage-pricing (v2) box ladder, owner decision
376
+ * 2026-10-16: basic -> small, power -> medium, dev -> large.
377
+ */
378
+ export const LEGACY_TO_V2_AGENT_SIZE = {
379
+ basic: "small",
380
+ power: "medium",
381
+ dev: "large",
382
+ };
383
+ /**
384
+ * The size key to look up in the server's options. A key the server offers is
385
+ * used as is. A legacy key (basic, power, dev) against a v2 catalog maps to its
386
+ * v2 size. Anything else is returned unchanged and refused by the caller.
387
+ */
388
+ export function resolveAgentSizeKey(view, sizeKey) {
389
+ if (view.options.some((candidate) => candidate.key === sizeKey))
390
+ return sizeKey;
391
+ const v2 = LEGACY_TO_V2_AGENT_SIZE[sizeKey];
392
+ if (v2 && view.options.some((candidate) => candidate.key === v2))
393
+ return v2;
394
+ return sizeKey;
395
+ }
354
396
  /** Resolve a requested size from the server response, never from local prices. */
355
- export function requireQuotedCreateSize(view, sizeKey) {
397
+ export function requireQuotedCreateSize(view, requestedKey) {
398
+ const sizeKey = resolveAgentSizeKey(view, requestedKey);
356
399
  const option = view.options.find((candidate) => candidate.key === sizeKey);
357
400
  if (!option) {
358
401
  throw new Error(`HQ Pro did not return a quote for agent size ${sizeKey}.`);
@@ -1460,7 +1503,7 @@ export function registerAgentsCommand(program) {
1460
1503
  .option("--slack-tokens-stdin", "Read the bot token and optional app token from one or two stdin lines")
1461
1504
  .option("--title <title>", "Org-chart job title")
1462
1505
  .option("--description <text>", "Short description / bio")
1463
- .option("--size <size>", "Agent box size: basic | power | dev (omitted keeps the current default)")
1506
+ .option("--size <size>", "Agent box size: small | medium | large | xlarge, or basic | power | dev (on usage pricing these map to small | medium | large); omitted keeps the current default")
1464
1507
  .option("--yes", "Confirm the quoted monthly cost and provision the agent")
1465
1508
  .option("--json", "Emit machine-readable output and never open a browser")
1466
1509
  .addHelpText("after", `\n${claudeProvisionGuidance()}\n`)
@@ -1626,9 +1669,19 @@ export function registerAgentsCommand(program) {
1626
1669
  if (!err.agentCreatePlanLimit) {
1627
1670
  throw new Error("HQ Pro returned an unrecognized agent payment-required response.");
1628
1671
  }
1672
+ // Bounded: an unreachable API leaves the plan unknown (legacy copy)
1673
+ // within 3 s instead of holding the refusal.
1674
+ const pricingPlan = await fetchCompanyPricingPlan(token, companyUid, {
1675
+ timeoutMs: 2000,
1676
+ deadlineMs: 3000,
1677
+ }).catch(() => null);
1629
1678
  await surfaceAgentCreatePlanLimit(err.agentCreatePlanLimit, {
1630
1679
  ...opts,
1631
1680
  companyUid,
1681
+ pricingPlan,
1682
+ ...(isUsageOnly(pricingPlan)
1683
+ ? { usageCard: (await fetchUsageCard()).card }
1684
+ : {}),
1632
1685
  });
1633
1686
  // Keep the payment-required status through normal CLI teardown.
1634
1687
  // Unlike process.exit(), this is testable and cannot be caught by