@indigoai-us/hq-cloud 6.18.107 → 6.18.109

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 (118) hide show
  1. package/dist/bin/sync-runner-company.d.ts +1 -0
  2. package/dist/bin/sync-runner-company.d.ts.map +1 -1
  3. package/dist/bin/sync-runner-company.js +29 -8
  4. package/dist/bin/sync-runner-company.js.map +1 -1
  5. package/dist/bin/sync-runner-manifest.d.ts +27 -0
  6. package/dist/bin/sync-runner-manifest.d.ts.map +1 -1
  7. package/dist/bin/sync-runner-manifest.js +104 -0
  8. package/dist/bin/sync-runner-manifest.js.map +1 -1
  9. package/dist/bin/sync-runner-planning.d.ts +48 -0
  10. package/dist/bin/sync-runner-planning.d.ts.map +1 -1
  11. package/dist/bin/sync-runner-planning.js +140 -0
  12. package/dist/bin/sync-runner-planning.js.map +1 -1
  13. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  14. package/dist/bin/sync-runner-watch-loop.js +8 -2
  15. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  16. package/dist/bin/sync-runner.d.ts +1 -0
  17. package/dist/bin/sync-runner.d.ts.map +1 -1
  18. package/dist/bin/sync-runner.js +24 -1
  19. package/dist/bin/sync-runner.js.map +1 -1
  20. package/dist/cli/rescue-core.d.ts +64 -1
  21. package/dist/cli/rescue-core.d.ts.map +1 -1
  22. package/dist/cli/rescue-core.js +272 -125
  23. package/dist/cli/rescue-core.js.map +1 -1
  24. package/dist/cli/rescue-git.d.ts +47 -0
  25. package/dist/cli/rescue-git.d.ts.map +1 -0
  26. package/dist/cli/rescue-git.js +126 -0
  27. package/dist/cli/rescue-git.js.map +1 -0
  28. package/dist/cli/rescue-native-copy.d.ts +88 -0
  29. package/dist/cli/rescue-native-copy.d.ts.map +1 -0
  30. package/dist/cli/rescue-native-copy.js +823 -0
  31. package/dist/cli/rescue-native-copy.js.map +1 -0
  32. package/dist/cli/rescue-snapshot.d.ts +22 -0
  33. package/dist/cli/rescue-snapshot.d.ts.map +1 -1
  34. package/dist/cli/rescue-snapshot.js +27 -0
  35. package/dist/cli/rescue-snapshot.js.map +1 -1
  36. package/dist/cli/rescue.d.ts +21 -1
  37. package/dist/cli/rescue.d.ts.map +1 -1
  38. package/dist/cli/rescue.js +68 -2
  39. package/dist/cli/rescue.js.map +1 -1
  40. package/dist/cli/share.d.ts +14 -0
  41. package/dist/cli/share.d.ts.map +1 -1
  42. package/dist/cli/share.js +19 -8
  43. package/dist/cli/share.js.map +1 -1
  44. package/dist/cli/sync.d.ts +8 -0
  45. package/dist/cli/sync.d.ts.map +1 -1
  46. package/dist/cli/sync.js +5 -5
  47. package/dist/cli/sync.js.map +1 -1
  48. package/dist/cognito-auth.d.ts +57 -0
  49. package/dist/cognito-auth.d.ts.map +1 -1
  50. package/dist/cognito-auth.js +182 -3
  51. package/dist/cognito-auth.js.map +1 -1
  52. package/dist/ignore.d.ts +5 -1
  53. package/dist/ignore.d.ts.map +1 -1
  54. package/dist/ignore.js +32 -2
  55. package/dist/ignore.js.map +1 -1
  56. package/dist/index.d.ts +3 -2
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +6 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/manifest/leg-skip-store.d.ts +59 -0
  61. package/dist/manifest/leg-skip-store.d.ts.map +1 -0
  62. package/dist/manifest/leg-skip-store.js +140 -0
  63. package/dist/manifest/leg-skip-store.js.map +1 -0
  64. package/dist/manifest/upload-manifest.d.ts +11 -0
  65. package/dist/manifest/upload-manifest.d.ts.map +1 -1
  66. package/dist/manifest/upload-manifest.js +30 -1
  67. package/dist/manifest/upload-manifest.js.map +1 -1
  68. package/dist/manifest-folder-alias.d.ts +70 -0
  69. package/dist/manifest-folder-alias.d.ts.map +1 -0
  70. package/dist/manifest-folder-alias.js +139 -0
  71. package/dist/manifest-folder-alias.js.map +1 -0
  72. package/dist/manifest-reconcile.d.ts +5 -0
  73. package/dist/manifest-reconcile.d.ts.map +1 -1
  74. package/dist/manifest-reconcile.js +14 -2
  75. package/dist/manifest-reconcile.js.map +1 -1
  76. package/dist/outposts/billing.d.ts +0 -2
  77. package/dist/outposts/billing.d.ts.map +1 -1
  78. package/dist/outposts/billing.js +0 -2
  79. package/dist/outposts/billing.js.map +1 -1
  80. package/dist/outposts/cli-billing.d.ts +8 -2
  81. package/dist/outposts/cli-billing.d.ts.map +1 -1
  82. package/dist/outposts/cli-billing.js +13 -8
  83. package/dist/outposts/cli-billing.js.map +1 -1
  84. package/dist/outposts/client.d.ts +6 -3
  85. package/dist/outposts/client.d.ts.map +1 -1
  86. package/dist/outposts/client.js +12 -8
  87. package/dist/outposts/client.js.map +1 -1
  88. package/dist/outposts/command.d.ts +30 -0
  89. package/dist/outposts/command.d.ts.map +1 -1
  90. package/dist/outposts/command.js +79 -13
  91. package/dist/outposts/command.js.map +1 -1
  92. package/dist/outposts/company-outposts.d.ts +2 -2
  93. package/dist/outposts/company-outposts.d.ts.map +1 -1
  94. package/dist/outposts/company-outposts.js +5 -4
  95. package/dist/outposts/company-outposts.js.map +1 -1
  96. package/dist/outposts/hq-pro-routes.d.ts +15 -0
  97. package/dist/outposts/hq-pro-routes.d.ts.map +1 -0
  98. package/dist/outposts/hq-pro-routes.js +21 -0
  99. package/dist/outposts/hq-pro-routes.js.map +1 -0
  100. package/dist/outposts/index.d.ts +3 -1
  101. package/dist/outposts/index.d.ts.map +1 -1
  102. package/dist/outposts/index.js +2 -1
  103. package/dist/outposts/index.js.map +1 -1
  104. package/dist/outposts/sizes.d.ts +56 -0
  105. package/dist/outposts/sizes.d.ts.map +1 -0
  106. package/dist/outposts/sizes.js +120 -0
  107. package/dist/outposts/sizes.js.map +1 -0
  108. package/dist/outposts/types.d.ts +3 -0
  109. package/dist/outposts/types.d.ts.map +1 -1
  110. package/dist/outposts/types.js +0 -11
  111. package/dist/outposts/types.js.map +1 -1
  112. package/dist/sync/pull-scope.d.ts +1 -1
  113. package/dist/sync/pull-scope.d.ts.map +1 -1
  114. package/dist/sync/pull-scope.js +8 -3
  115. package/dist/sync/pull-scope.js.map +1 -1
  116. package/dist/types.d.ts +7 -0
  117. package/dist/types.d.ts.map +1 -1
  118. package/package.json +1 -1
@@ -41,6 +41,7 @@
41
41
  * routes that exist. Renaming an Outpost is not a backend capability.
42
42
  */
43
43
  import { Command } from "commander";
44
+ import { type OutpostPricing, type OutpostSize } from "./sizes.js";
44
45
  import { type OutpostTokenSource } from "./client.js";
45
46
  import { type ReplicaSyncDependencies } from "./host-deps.js";
46
47
  import type { OutpostTransport } from "./transport.js";
@@ -76,6 +77,12 @@ export interface OutpostsCommandDeps {
76
77
  defaultApiBaseUrl: string;
77
78
  /** Origin override applied to every control-plane call. */
78
79
  baseUrl?: string;
80
+ /**
81
+ * Fetch the public price list (`GET /v1/pricing`). Defaults to the
82
+ * control-plane call; tests replace it. Any failure falls back to the
83
+ * bundled prices.
84
+ */
85
+ loadPricing?: () => Promise<unknown>;
79
86
  /** Override the `provision --company` wait (tests). */
80
87
  companyProvisionWait?: CompanyProvisionWaitOptions;
81
88
  /** Override the `destroy --company` wait (tests). */
@@ -83,6 +90,29 @@ export interface OutpostsCommandDeps {
83
90
  /** Override host-environment probes — used by `self-deploy`/`replica-sync` tests. */
84
91
  host?: Partial<ReplicaSyncDependencies>;
85
92
  }
93
+ /** Where `chooseOutpostSize` gets prices. */
94
+ export interface OutpostPricingSource {
95
+ load: () => Promise<unknown>;
96
+ }
97
+ /** A chosen Outpost size and the prices it was chosen from. */
98
+ export interface OutpostSizeChoice {
99
+ /** Undefined means the default: no `size` is sent and the server bills the small tier price. */
100
+ size?: OutpostSize;
101
+ pricing: OutpostPricing;
102
+ /** Monthly price, in cents. */
103
+ priceCents: number;
104
+ }
105
+ /**
106
+ * Settle the Outpost size before anything is created or billed.
107
+ *
108
+ * `--size` wins. Without it, an interactive terminal gets a menu of the four
109
+ * sizes with their prices; Enter takes the default. A script with no
110
+ * terminal, or any `--json` run, takes the default. The default sends no
111
+ * `size`: the server keeps today's box and bills the small tier's price.
112
+ * Prices come from `/v1/pricing`, or the bundled copy when that call fails.
113
+ * The menu goes to stderr so `--json` stdout stays one object.
114
+ */
115
+ export declare function chooseOutpostSize(source: OutpostPricingSource, host: ReplicaSyncDependencies, flag: string | undefined, json?: boolean): Promise<OutpostSizeChoice>;
86
116
  /** How long `provision --company` waits for the box, and how often it checks. */
87
117
  export interface CompanyProvisionWaitOptions {
88
118
  pollMs?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/outposts/command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmDpC,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAKrB,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,gBAAgB,CAAC;AAWxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,SAAS,EAAE,gBAAgB,CAAC;IAC5B,yDAAyD;IACzD,QAAQ,EAAE,kBAAkB,CAAC;IAC7B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C;;;OAGG;IACH,gBAAgB,EAAE,MAAM;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAC9D,uEAAuE;IACvE,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChF,0EAA0E;IAC1E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,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CAAC;CACpB;AAslCD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,mBAAmB,GACxB,IAAI,CAmvCN"}
@@ -42,7 +42,7 @@
42
42
  */
43
43
  import chalk from "chalk";
44
44
  import * as fs from "node:fs";
45
- import { OUTPOST_PRICE_CENTS } from "./billing.js";
45
+ import { invalidSizeMessage, isOutpostSize, loadOutpostPricing, outpostMonthlyCents, outpostSizeMenu, outpostSizePrompt, readSizeChoice, } from "./sizes.js";
46
46
  import { OutpostPullError, pullOutpostFile } from "./pull.js";
47
47
  import { buildCompanyJobDefinition, mergeCompanyJobEdit, companyPayerLabel, companyProvisionProgress, CompanyTargetError, JobDefinitionError, describeCompanySignIn, explainCompanyFailure, FAILED_CLEANED_UP, failedCleanedUpLine, isCompanySlug, isFailedCleanedUpRecord, provisionRetryCommand, parseCompanySignIn, companyCreateContinues, isProvisionOutcomeUnknown, mergeCompanyJobs, provisionErrorSkipsStatusRead, } from "./company.js";
48
48
  import { companyOutpostChargeLine, companyOutpostsUnreadableLine, CompanyOutpostSelectError, explainCompanyOutpostCreateFailure, explainCompanyOutpostSelect, isCompanyOutpostId, isOutpostName, LEGACY_OUTPOST_NAME, safeLifecycle, selectCompanyOutpost, } from "./company-outposts.js";
@@ -213,7 +213,51 @@ async function listCompanyOutpostsCommand(client, slug, asJson) {
213
213
  console.log(chalk.yellow(`${unreadable} more Outpost row(s) could not be read and are not shown.`));
214
214
  }
215
215
  }
216
- async function createCompanyOutpostCommand(client, host, opts, wait = {}) {
216
+ const SIZE_PROMPT_ATTEMPTS = 3;
217
+ /**
218
+ * Settle the Outpost size before anything is created or billed.
219
+ *
220
+ * `--size` wins. Without it, an interactive terminal gets a menu of the four
221
+ * sizes with their prices; Enter takes the default. A script with no
222
+ * terminal, or any `--json` run, takes the default. The default sends no
223
+ * `size`: the server keeps today's box and bills the small tier's price.
224
+ * Prices come from `/v1/pricing`, or the bundled copy when that call fails.
225
+ * The menu goes to stderr so `--json` stdout stays one object.
226
+ */
227
+ export async function chooseOutpostSize(source, host, flag, json = false) {
228
+ const pricing = await loadOutpostPricing(source.load);
229
+ let size;
230
+ if (flag !== undefined) {
231
+ // Validated by the caller before any request; checked again for safety.
232
+ if (!isOutpostSize(flag)) {
233
+ console.error(chalk.red(invalidSizeMessage(flag)));
234
+ process.exit(1);
235
+ }
236
+ size = flag;
237
+ }
238
+ else if (!json && host.isStdinTty() && host.readAnswer) {
239
+ console.error("Choose an Outpost size:");
240
+ for (const line of outpostSizeMenu(pricing))
241
+ console.error(line);
242
+ if (pricing.source === "bundled") {
243
+ console.error(chalk.dim("Prices could not be fetched, so these are the prices this CLI shipped with."));
244
+ }
245
+ let answer;
246
+ for (let attempt = 0; attempt < SIZE_PROMPT_ATTEMPTS && !answer; attempt++) {
247
+ process.stderr.write(outpostSizePrompt(pricing));
248
+ answer = readSizeChoice(await host.readAnswer());
249
+ if (!answer)
250
+ console.error(chalk.yellow("Pick 1 to 4, or one of small, medium, large, xlarge."));
251
+ }
252
+ if (!answer) {
253
+ console.error("No size was chosen, so nothing was created or billed. Next: re-run with --size <small|medium|large|xlarge>.");
254
+ process.exit(1);
255
+ }
256
+ size = answer === "default" ? undefined : answer;
257
+ }
258
+ return { ...(size ? { size } : {}), pricing, priceCents: outpostMonthlyCents(pricing, size) };
259
+ }
260
+ async function createCompanyOutpostCommand(client, host, loadPricing, opts, wait = {}) {
217
261
  const json = opts.json === true;
218
262
  const name = opts.name?.trim() ?? "";
219
263
  if (!isOutpostName(name)) {
@@ -233,7 +277,8 @@ async function createCompanyOutpostCommand(client, host, opts, wait = {}) {
233
277
  failedBeforeCreate.add(err);
234
278
  throw err;
235
279
  }
236
- const charge = companyOutpostChargeLine(companyPayerLabel(company));
280
+ const choice = await chooseOutpostSize(loadPricing, host, opts.size, json);
281
+ const charge = companyOutpostChargeLine(companyPayerLabel(company), choice.priceCents, choice.size);
237
282
  const unnamed = `The name ${name} is not sent. This server creates the company's main Outpost.`;
238
283
  if (!opts.yes) {
239
284
  if (!host.isStdinTty()) {
@@ -276,8 +321,9 @@ async function createCompanyOutpostCommand(client, host, opts, wait = {}) {
276
321
  }
277
322
  await startCompanyOutpost(client, company, wait, {
278
323
  json,
324
+ size: choice.size,
279
325
  explainRefusal: (err) => explainCompanyOutpostCreateFailure(company.slug, err),
280
- retryCommand: `hq outposts create --company ${company.slug} --name ${name} --yes`,
326
+ retryCommand: `hq outposts create --company ${company.slug} --name ${name}${choice.size ? ` --size ${choice.size}` : ""} --yes`,
281
327
  });
282
328
  }
283
329
  function printCompanyJobs(companySlug, jobs, healthAvailable) {
@@ -371,7 +417,7 @@ function correlationFrom(outpost, err) {
371
417
  ...(operationId ? { operationId } : {}),
372
418
  };
373
419
  }
374
- async function provisionCompanyOutpost(client, slug, yes, wait = {}, json = false) {
420
+ async function provisionCompanyOutpost(client, host, loadPricing, slug, yes, wait = {}, json = false, sizeFlag) {
375
421
  let company;
376
422
  try {
377
423
  company = await requireCompany(client, slug);
@@ -381,13 +427,20 @@ async function provisionCompanyOutpost(client, slug, yes, wait = {}, json = fals
381
427
  failedBeforeCreate.add(err);
382
428
  throw err;
383
429
  }
430
+ const choice = await chooseOutpostSize(loadPricing, host, sizeFlag, json);
384
431
  confirmCompanyOutpostChargeOrExit({
385
432
  slug: company.slug,
386
433
  payerLabel: companyPayerLabel(company),
434
+ priceCents: choice.priceCents,
435
+ ...(choice.size ? { size: choice.size } : {}),
387
436
  yes,
388
437
  json,
389
438
  });
390
- await startCompanyOutpost(client, company, wait, { json, retryCommand: provisionRetryCommand(company.slug) });
439
+ await startCompanyOutpost(client, company, wait, {
440
+ json,
441
+ size: choice.size,
442
+ retryCommand: `${provisionRetryCommand(company.slug)}${choice.size ? ` --size ${choice.size}` : ""}`,
443
+ });
391
444
  }
392
445
  /**
393
446
  * Send the create, then report what status shows. `provision --company` and
@@ -410,7 +463,7 @@ async function startCompanyOutpost(client, company, wait, opts = {}) {
410
463
  let outpost;
411
464
  let provisionError;
412
465
  try {
413
- outpost = (await client.provisionCompany(company.uid)).outpost;
466
+ outpost = (await client.provisionCompany(company.uid, opts.size)).outpost;
414
467
  }
415
468
  catch (err) {
416
469
  if (err instanceof OutpostHttpError && err.code === FAILED_CLEANED_UP) {
@@ -1203,6 +1256,9 @@ export function registerOutpostsCommand(program, deps) {
1203
1256
  token: deps.getToken,
1204
1257
  ...(deps.baseUrl ? { baseUrl: deps.baseUrl } : {}),
1205
1258
  });
1259
+ const loadPricing = {
1260
+ load: deps.loadPricing ?? (() => client.pricing()),
1261
+ };
1206
1262
  const billingContext = {
1207
1263
  transport: deps.transport,
1208
1264
  token: deps.getToken,
@@ -1256,16 +1312,21 @@ export function registerOutpostsCommand(program, deps) {
1256
1312
  outposts
1257
1313
  .command("provision")
1258
1314
  .alias("create")
1259
- .description("Provision a new Outpost ($80/month — requires --yes)")
1315
+ .description("Provision a new Outpost (priced by size: small, medium, large or xlarge; requires --yes)")
1316
+ .option("--size <size>", "Outpost size: small | medium | large | xlarge. Without it, a terminal shows a menu with prices; the default is $100/month")
1260
1317
  .option("--runtime <runtime>", "Agent runtime: claude | codex (default claude). Personal boxes only.")
1261
1318
  .option("--disk <gb>", "Root disk size in GB (EC2 only). Personal boxes only.")
1262
1319
  .option("--client-ip <ip>", "Your public IP for the box's SSH ingress (optional; server derives it otherwise). Personal boxes only.")
1263
1320
  .option("--company <slug>", "Provision the company's Outpost instead of your personal box")
1264
1321
  .option("--name <name>", "With --company: not sent. This server creates the company's main Outpost and does not take a name yet")
1265
- .option("--yes", "Confirm the monthly charge (required to provision or create)")
1322
+ .option("--yes", "Confirm the monthly charge for the chosen size (required to provision or create)")
1266
1323
  .option("--json", "With --company, emit one JSON object. Progress goes to stderr.")
1267
1324
  .action(async function (opts) {
1268
1325
  try {
1326
+ if (opts.size !== undefined && !isOutpostSize(opts.size)) {
1327
+ console.error(chalk.red(invalidSizeMessage(opts.size)));
1328
+ process.exit(1);
1329
+ }
1269
1330
  if (opts.name !== undefined && opts.company === undefined) {
1270
1331
  console.error("--name names a company Outpost. Next: re-run with --company <slug> --name <name>.");
1271
1332
  process.exit(1);
@@ -1276,11 +1337,12 @@ export function registerOutpostsCommand(program, deps) {
1276
1337
  process.exit(1);
1277
1338
  }
1278
1339
  try {
1279
- await createCompanyOutpostCommand(client, host, {
1340
+ await createCompanyOutpostCommand(client, host, loadPricing, {
1280
1341
  company: opts.company,
1281
1342
  name: opts.name,
1282
1343
  ...(opts.yes !== undefined ? { yes: opts.yes } : {}),
1283
1344
  ...(opts.json ? { json: true } : {}),
1345
+ ...(opts.size !== undefined ? { size: opts.size } : {}),
1284
1346
  }, deps.companyProvisionWait);
1285
1347
  }
1286
1348
  catch (err) {
@@ -1301,7 +1363,7 @@ export function registerOutpostsCommand(program, deps) {
1301
1363
  process.exit(1);
1302
1364
  }
1303
1365
  try {
1304
- await provisionCompanyOutpost(client, opts.company, opts.yes, deps.companyProvisionWait, Boolean(opts.json));
1366
+ await provisionCompanyOutpost(client, host, loadPricing, opts.company, opts.yes, deps.companyProvisionWait, Boolean(opts.json), opts.size);
1305
1367
  }
1306
1368
  catch (err) {
1307
1369
  // The charge gate already reported this and called process.exit.
@@ -1340,10 +1402,13 @@ export function registerOutpostsCommand(program, deps) {
1340
1402
  process.exit(1);
1341
1403
  }
1342
1404
  }
1343
- // Paid gate: print the monthly cost and require --yes before any call.
1405
+ // Paid gate: settle the size, print its monthly cost, and require
1406
+ // --yes before the create call.
1407
+ const choice = await chooseOutpostSize(loadPricing, host, opts.size);
1344
1408
  confirmChargeOrExit({
1345
1409
  resource: "Outpost",
1346
- unitCents: OUTPOST_PRICE_CENTS,
1410
+ unitCents: choice.priceCents,
1411
+ ...(choice.size ? { detail: `${choice.size} Outpost` } : {}),
1347
1412
  yes: opts.yes,
1348
1413
  });
1349
1414
  // The box authenticates AS the caller using the cached refresh token —
@@ -1359,6 +1424,7 @@ export function registerOutpostsCommand(program, deps) {
1359
1424
  ...(opts.clientIp ? { clientIp: opts.clientIp } : {}),
1360
1425
  ...(diskSizeGb ? { diskSizeGb } : {}),
1361
1426
  ...(agentRuntime ? { agentRuntime } : {}),
1427
+ ...(choice.size ? { size: choice.size } : {}),
1362
1428
  });
1363
1429
  console.log(chalk.green("Provisioning started for your Outpost."));
1364
1430
  console.log(chalk.dim("Track it: hq outposts status"));