@agenzo/merchant-cli 0.9.5 → 0.10.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/index.js CHANGED
@@ -910,6 +910,42 @@ function memberIdOf(opts) {
910
910
  return trimmed.length > 0 ? trimmed : void 0;
911
911
  }
912
912
 
913
+ // src/price-annotation.ts
914
+ var ORIGINAL_DESCRIPTION = "Original (pre-discount) price in integer cents. Optional, RECORD-ONLY: stored on our own order / charge record and echoed back in the order detail, never sent to the acquiring gateway and never used to derive or validate the amount charged (that always comes from the order's locked authoritative price).";
915
+ var DISCOUNT_DESCRIPTION = "Discount amount in integer cents. Optional, RECORD-ONLY: same semantics as --original-amount-cents.";
916
+ var PRICE_ANNOTATION_FLAGS = {
917
+ "original-amount-cents": {
918
+ type: "int",
919
+ required: false,
920
+ description: ORIGINAL_DESCRIPTION,
921
+ constraints: "non-negative integer cents"
922
+ },
923
+ "discount-amount-cents": {
924
+ type: "int",
925
+ required: false,
926
+ description: DISCOUNT_DESCRIPTION,
927
+ constraints: "non-negative integer cents"
928
+ }
929
+ };
930
+ function applyPriceAnnotation(body, opts) {
931
+ const mappings = [
932
+ ["--original-amount-cents", "originalAmountCents", "original_amount_cents"],
933
+ ["--discount-amount-cents", "discountAmountCents", "discount_amount_cents"]
934
+ ];
935
+ for (const [flag, optKey, bodyKey] of mappings) {
936
+ const raw = opts[optKey];
937
+ if (raw === void 0) continue;
938
+ const cents = Number(raw);
939
+ if (!Number.isInteger(cents) || cents < 0) {
940
+ throw new CliError(
941
+ "PARAM_INVALID",
942
+ `Invalid ${flag} "${raw}". Expected a non-negative integer number of cents (e.g. 10000 for 100.00).`
943
+ );
944
+ }
945
+ body[bodyKey] = cents;
946
+ }
947
+ }
948
+
913
949
  // src/ride-elife/watch.ts
914
950
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
915
951
  "At destination",
@@ -1250,7 +1286,8 @@ var ridePayOrderSchema = {
1250
1286
  type: "string",
1251
1287
  required: true,
1252
1288
  description: "Unique key (1-128 chars [A-Za-z0-9_-]) forwarded verbatim as the Idempotency-Key header; never auto-generated"
1253
- }
1289
+ },
1290
+ ...PRICE_ANNOTATION_FLAGS
1254
1291
  },
1255
1292
  response: {
1256
1293
  order_id: { type: "string", description: "Authoritative order_ref (rio_\u2026, = order document _id) that was settled" },
@@ -1851,6 +1888,7 @@ var hotelPayOrderSchema = {
1851
1888
  description: "Unique key forwarded verbatim as the Idempotency-Key header; never auto-generated. Derive from business intent (e.g. hash(order_id + attempt)) and reuse the SAME key when retrying the same payment",
1852
1889
  constraints: "1-128 chars [A-Za-z0-9_-]"
1853
1890
  },
1891
+ ...PRICE_ANNOTATION_FLAGS,
1854
1892
  watch: { type: "bool", required: false, default: false, description: "Poll automatically on PAYMENT_NOT_COMPLETED until PAID or timeout. Each iteration emits one NDJSON line" },
1855
1893
  "watch-interval": { type: "int", required: false, default: 5, description: "Seconds between poll attempts in --watch mode" },
1856
1894
  "watch-timeout": { type: "int", required: false, default: 300, description: "Total seconds before giving up in --watch mode" }
@@ -2679,7 +2717,8 @@ var flightPayOrderSchema = flightSchema(
2679
2717
  "return-url": { type: "string", required: false, description: "Optional 3DS/passkey return URL for the network-token authenticate path; falls back to the platform EVO_3DS_RETURN_URL." },
2680
2718
  "authorized-charge-no": { type: "string", required: false, description: "Resume a network-token 3DS challenge: charge_no from a prior AUTHENTICATION_REQUIRED response (settled via resume_token), then triggers ticketing on success." },
2681
2719
  "evo-explicit": { type: "bool", required: false, default: false, description: "[\u65B9\u6848 B/R16] Explicit opt-in to settle this pay_per_call order via the EVO bound-card fallback rail. Set true ONLY when the user explicitly chose EVO; forwarded to the pay body as evo_explicit=true. Without it, a pay_per_call settlement lacking --payment-token-id is hard-gated server-side." },
2682
- "idempotency-key": { type: "string", required: true, description: "Forwarded verbatim as the Idempotency-Key header." }
2720
+ "idempotency-key": { type: "string", required: true, description: "Forwarded verbatim as the Idempotency-Key header." },
2721
+ ...PRICE_ANNOTATION_FLAGS
2683
2722
  },
2684
2723
  { order_no: { type: "string", description: "Our order reference." }, status: { type: "string", description: "PAID on success; AUTHENTICATION_REQUIRED when the card needs 3DS." } },
2685
2724
  { command: "agenzo-merchant-cli flight-flink pay-order --order-no ffo_... --idempotency-key k2", output_summary: "Order becomes PAID; poll get-order until TICKETED." }
@@ -2788,7 +2827,8 @@ var flightChangePaySchema = flightSchema(
2788
2827
  "payment-method-id": { type: "string", required: false, description: "Optional bound-card id (EVO path)." },
2789
2828
  "payment-token-id": { type: "string", required: false, description: "Optional UPI network-token id (unionpay charge path)." },
2790
2829
  "authorized-merchant-trans-id": { type: "string", required: false, description: "Resume a 3DS challenge with the merchant trans id of the already-authorised preauth; the platform reuses and captures it instead of authorizing again." },
2791
- "idempotency-key": { type: "string", required: true, description: "Idempotency-Key header." }
2830
+ "idempotency-key": { type: "string", required: true, description: "Idempotency-Key header." },
2831
+ ...PRICE_ANNOTATION_FLAGS
2792
2832
  },
2793
2833
  {
2794
2834
  change_order_no: { type: "string", description: "Change order number." },
@@ -2833,6 +2873,66 @@ var flightRefundConfirmSchema = flightSchema(
2833
2873
  { status: { type: "int", description: "Refund status after the action." } },
2834
2874
  { command: "agenzo-merchant-cli flight-flink refund-confirm --refund-order-no R1 --confirm 1 --idempotency-key k7", output_summary: "Refund confirmed or cancelled." }
2835
2875
  );
2876
+ var DATA_NOUN = "data-aisa";
2877
+ function dataSchema(spec) {
2878
+ return { cli: CLI_NAME, noun: DATA_NOUN, ...spec };
2879
+ }
2880
+ var dataListCategoriesSchema = dataSchema({
2881
+ verb: "list-categories",
2882
+ description: "List the data categories and how many capabilities each one holds. Free: answered from the bundled index, no upstream call.",
2883
+ flags: {
2884
+ // No flags of its own — authentication rides on the global --api-key.
2885
+ },
2886
+ response: {
2887
+ categories: { type: "array", description: "Categories ordered by size; each item is {category, endpoints}." }
2888
+ },
2889
+ example: { command: "agenzo-merchant-cli data-aisa list-categories", output_summary: 'The data categories with a capability count each \u2014 use it to answer "what can you look up".' }
2890
+ });
2891
+ var dataSearchSchema = dataSchema({
2892
+ verb: "search",
2893
+ description: "Find a data capability by keyword. Free: answered from the bundled index, no upstream call. Returns operationId + method + path + tags + summary + price_usd for each hit.",
2894
+ flags: {
2895
+ keyword: { type: "string", required: false, constraints: "Space- or comma-separated tokens, matched against operationId / path / summary / tags. Omitted returns the first `limit` capabilities as examples.", description: "What to look for, e.g. 'crypto price' or 'reddit'." },
2896
+ limit: { type: "int", required: false, default: 15, constraints: "1..50; defaults to 15.", description: "How many hits to return." }
2897
+ },
2898
+ response: {
2899
+ results: { type: "array", description: "Matching capabilities; each item is {operationId, method, path, tags, summary, price_usd}. Relay operationId VERBATIM into describe / query." }
2900
+ },
2901
+ example: { command: "agenzo-merchant-cli data-aisa search --keyword 'crypto price' --limit 5", output_summary: "Hits with operationId + price_usd; describe the chosen one before running it." }
2902
+ });
2903
+ var dataDescribeSchema = dataSchema({
2904
+ verb: "describe",
2905
+ description: "Read one capability's parameter spec, usage hint and unit price before calling it. Free: answered from the bundled index, no upstream call.",
2906
+ flags: {
2907
+ "operation-id": { type: "string", required: true, constraints: "An operationId returned by search, verbatim.", description: "Which capability to describe." }
2908
+ },
2909
+ response: {
2910
+ operationId: { type: "string", description: "The capability id \u2014 pass it unchanged to query." },
2911
+ method: { type: "string", description: "Upstream HTTP method of the capability." },
2912
+ path: { type: "string", description: "Upstream path of the capability." },
2913
+ params: { type: "array", description: "Declared parameters; each item is {name, in, required, type, desc}. `desc` may be an empty string." },
2914
+ required: { type: "array", description: "Names of the required parameters." },
2915
+ usage: { type: "string", description: "Human-readable call guidance: which params are required, where each one sits, how to assemble --params." },
2916
+ price_usd: { type: "number|null", description: "Unit price of one query call, in USD." },
2917
+ tags: { type: "array", description: "Categories this capability belongs to." },
2918
+ cost_tier: { type: "string|null", description: "Coarse price band of this capability." }
2919
+ },
2920
+ example: { command: "agenzo-merchant-cli data-aisa describe --operation-id get_coingecko_simple_price", output_summary: "Parameter spec + unit price; build --params from params[].name, then query." }
2921
+ });
2922
+ var dataQuerySchema = dataSchema({
2923
+ verb: "query",
2924
+ description: "Run one capability and return its data. Charged per call. READ-ONLY: it fetches data and nothing else.",
2925
+ flags: {
2926
+ "operation-id": { type: "string", required: true, constraints: "An operationId returned by search, verbatim.", description: "Which capability to run." },
2927
+ params: { type: "object", required: false, constraints: "A JSON object keyed by the parameter names from describe. Passed through as a whole; unknown keys are dropped.", description: "The capability's parameters." },
2928
+ "idempotency-key": { type: "string", required: false, constraints: "Optional. [A-Za-z0-9_-]{1,128}. When absent the request is still sent (no prompt, nothing generated) and de-duplication falls back to the result cache.", description: "Caller-supplied de-duplication key, forwarded verbatim as the Idempotency-Key header." }
2929
+ },
2930
+ response: {
2931
+ data: { type: "object", description: "The capability response, verbatim." },
2932
+ cost_usd: { type: "number", description: "What this call cost, in USD." }
2933
+ },
2934
+ example: { command: `agenzo-merchant-cli data-aisa query --operation-id get_coingecko_simple_price --params '{"ids":"bitcoin","vs_currencies":"usd"}'`, output_summary: "Returns data (upstream payload, verbatim) plus cost_usd for this call." }
2935
+ });
2836
2936
 
2837
2937
  // src/ride-elife/quote.ts
2838
2938
  function need(value, flag) {
@@ -3384,6 +3484,12 @@ function registerRidePayOrderCommand(parent, deps) {
3384
3484
  ).option(
3385
3485
  "--idempotency-key <key>",
3386
3486
  "Idempotency key forwarded verbatim as the Idempotency-Key header"
3487
+ ).option(
3488
+ "--original-amount-cents <cents>",
3489
+ PRICE_ANNOTATION_FLAGS["original-amount-cents"].description
3490
+ ).option(
3491
+ "--discount-amount-cents <cents>",
3492
+ PRICE_ANNOTATION_FLAGS["discount-amount-cents"].description
3387
3493
  );
3388
3494
  attachSchemaHelp(cmd, ridePayOrderSchema);
3389
3495
  cmd.action(async () => {
@@ -3411,6 +3517,7 @@ function registerRidePayOrderCommand(parent, deps) {
3411
3517
  if (opts.returnUrl !== void 0) body.return_url = opts.returnUrl;
3412
3518
  if (authorizedChargeNo !== void 0) body.authorized_charge_no = authorizedChargeNo;
3413
3519
  if (opts.evoExplicit) body.evo_explicit = true;
3520
+ applyPriceAnnotation(body, opts);
3414
3521
  if (!isYes) {
3415
3522
  const confirmed = await confirm3({
3416
3523
  message: `Settle ride order ${orderId}? This charges the card and creates the ride (AWAITING_PAYMENT \u2192 PAID).`,
@@ -5408,7 +5515,7 @@ function registerHotelPayOrderCommand(parent, deps) {
5408
5515
  ).option(
5409
5516
  "--idempotency-key <key>",
5410
5517
  "Idempotency key forwarded verbatim as the Idempotency-Key header"
5411
- ).option("--watch", "Poll until PAID or timeout (NDJSON output)", false).option(
5518
+ ).option("--original-amount-cents <cents>", PRICE_ANNOTATION_FLAGS["original-amount-cents"].description).option("--discount-amount-cents <cents>", PRICE_ANNOTATION_FLAGS["discount-amount-cents"].description).option("--watch", "Poll until PAID or timeout (NDJSON output)", false).option(
5412
5519
  "--watch-interval <seconds>",
5413
5520
  "Seconds between polls when --watch is set",
5414
5521
  String(DEFAULT_PAY_WATCH_INTERVAL_SECONDS)
@@ -5449,6 +5556,7 @@ function registerHotelPayOrderCommand(parent, deps) {
5449
5556
  body.authorized_charge_no = opts.authorizedChargeNo;
5450
5557
  }
5451
5558
  if (opts.evoExplicit) body.evo_explicit = true;
5559
+ applyPriceAnnotation(body, opts);
5452
5560
  if (!isYes) {
5453
5561
  const confirmed = await confirm8({
5454
5562
  message: `Settle hotel order ${orderId}? This moves money via the order's configured billing mode (monthly_settlement or pay_per_call).`,
@@ -6865,7 +6973,13 @@ function registerPayOrderCommand(parent, deps) {
6865
6973
  ).option(
6866
6974
  "--evo-explicit",
6867
6975
  "[\u65B9\u6848 B/R16] Explicit opt-in to settle this pay_per_call order via the EVO bound-card fallback rail. Set ONLY when the user explicitly chose EVO; forwarded to the pay body as evo_explicit=true. Without it, a pay_per_call settlement lacking --payment-token-id is hard-gated server-side."
6868
- ).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
6976
+ ).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header").option(
6977
+ "--original-amount-cents <cents>",
6978
+ PRICE_ANNOTATION_FLAGS["original-amount-cents"].description
6979
+ ).option(
6980
+ "--discount-amount-cents <cents>",
6981
+ PRICE_ANNOTATION_FLAGS["discount-amount-cents"].description
6982
+ );
6869
6983
  attachSchemaHelp(cmd, flightPayOrderSchema);
6870
6984
  cmd.action(async () => {
6871
6985
  const opts = cmd.optsWithGlobals();
@@ -6897,6 +7011,7 @@ function registerPayOrderCommand(parent, deps) {
6897
7011
  body.authorized_charge_no = opts.authorizedChargeNo;
6898
7012
  }
6899
7013
  if (opts.evoExplicit) body.evo_explicit = true;
7014
+ applyPriceAnnotation(body, opts);
6900
7015
  const result = await deps.apiClient.post(
6901
7016
  `/flight/${encodeURIComponent(orderNo)}/pay`,
6902
7017
  { type: "api-key", key: apiKey },
@@ -7175,7 +7290,13 @@ function registerChangePayCommand(parent, deps) {
7175
7290
  const cmd = parent.command("change-pay").description("Pay a change request fee (like a normal order) and trigger change ticketing").option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--change-order-no <id>", "Change order number").option("--order-no <id>", "Original order reference (ownership check)").option("--amount <amount>", "Change fee total in decimal units (change-detail price_total)").option("--currency <currency>", "ISO 4217 currency code", "USD").option("--payment-method-id <id>", "Optional bound-card id (EVO path)").option("--payment-token-id <id>", "Optional UPI network-token id (unionpay charge path)").option(
7176
7291
  "--authorized-merchant-trans-id <id>",
7177
7292
  "Resume a 3DS challenge: merchant trans id of the already-authorised preauth"
7178
- ).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header");
7293
+ ).option("--idempotency-key <key>", "Forwarded verbatim as the Idempotency-Key header").option(
7294
+ "--original-amount-cents <cents>",
7295
+ PRICE_ANNOTATION_FLAGS["original-amount-cents"].description
7296
+ ).option(
7297
+ "--discount-amount-cents <cents>",
7298
+ PRICE_ANNOTATION_FLAGS["discount-amount-cents"].description
7299
+ );
7179
7300
  attachSchemaHelp(cmd, flightChangePaySchema);
7180
7301
  cmd.action(async () => {
7181
7302
  const opts = cmd.optsWithGlobals();
@@ -7196,6 +7317,7 @@ function registerChangePayCommand(parent, deps) {
7196
7317
  if (opts.authorizedMerchantTransId !== void 0) {
7197
7318
  body.authorized_merchant_trans_id = opts.authorizedMerchantTransId;
7198
7319
  }
7320
+ applyPriceAnnotation(body, opts);
7199
7321
  if (!isYes) {
7200
7322
  const isResume = opts.authorizedMerchantTransId !== void 0;
7201
7323
  const message = isResume ? `Resume change fee ${amount} ${currency} for change order ${changeOrderNo}? The card is already authorised; this captures it and triggers change ticketing.` : `Pay change fee ${amount} ${currency} for change order ${changeOrderNo}? This charges the customer and triggers change ticketing.`;
@@ -7441,6 +7563,169 @@ function registerFlightSkillCommand(parent) {
7441
7563
  });
7442
7564
  }
7443
7565
 
7566
+ // src/data-aisa/_helpers.ts
7567
+ function need23(value, flag) {
7568
+ if (value === void 0) {
7569
+ throw new CliError("PARAM_INVALID", `Missing required --${flag}.`);
7570
+ }
7571
+ return value;
7572
+ }
7573
+ function num11(value, flag) {
7574
+ const n = Number(need23(value, flag));
7575
+ if (!Number.isFinite(n)) {
7576
+ throw new CliError("PARAM_INVALID", `--${flag} must be a number.`);
7577
+ }
7578
+ return n;
7579
+ }
7580
+ function jsonObject(raw, flag) {
7581
+ let parsed;
7582
+ try {
7583
+ parsed = JSON.parse(raw);
7584
+ } catch {
7585
+ throw new CliError("PARAM_INVALID", `--${flag} must be a JSON object.`);
7586
+ }
7587
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
7588
+ throw new CliError("PARAM_INVALID", `--${flag} must be a JSON object.`);
7589
+ }
7590
+ return parsed;
7591
+ }
7592
+ function verbatimIdempotencyKey(raw, flag) {
7593
+ if (!IDEMPOTENCY_KEY_PATTERN.test(raw)) {
7594
+ throw new CliError(
7595
+ "PARAM_INVALID",
7596
+ `Invalid --${flag}: "${raw}". ${IDEMPOTENCY_KEY_RULE}`
7597
+ );
7598
+ }
7599
+ return raw;
7600
+ }
7601
+ function resolveApiKey2(flag) {
7602
+ return PromptEngine.resolveInput(flag, { message: "API Key:", type: "password" });
7603
+ }
7604
+ async function render4(data, format, text) {
7605
+ const resolved = resolveFormat(format);
7606
+ const result = { data, text: () => text(data) };
7607
+ await renderWithContext(result, { format: resolved }, new ConfigManager());
7608
+ }
7609
+ function kv(data) {
7610
+ const lines = Object.entries(data).map(([k, v]) => [
7611
+ k,
7612
+ typeof v === "object" && v !== null ? JSON.stringify(v) : String(v ?? "-")
7613
+ ]);
7614
+ return Formatter.keyValue(lines);
7615
+ }
7616
+
7617
+ // src/data-aisa/list-categories.ts
7618
+ function registerDataListCategoriesCommand(parent, deps) {
7619
+ const cmd = parent.command("list-categories").description(
7620
+ "List the data categories and how many capabilities each one holds. Free (answered from the bundled index, no upstream call), read-only."
7621
+ ).option("--api-key <key>", "API Key for authentication (X-Api-Key)");
7622
+ attachSchemaHelp(cmd, dataListCategoriesSchema);
7623
+ cmd.action(async () => {
7624
+ const opts = cmd.optsWithGlobals();
7625
+ const format = resolveFormat(opts.format);
7626
+ const apiKey = await resolveApiKey2(opts.apiKey);
7627
+ const spinner = format === "json" ? null : createSpinner("Fetching data categories...");
7628
+ const result = await deps.apiClient.get("/data/categories", {
7629
+ type: "api-key",
7630
+ key: apiKey
7631
+ });
7632
+ spinner?.stop();
7633
+ if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
7634
+ await render4(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
7635
+ });
7636
+ }
7637
+
7638
+ // src/data-aisa/search.ts
7639
+ function registerDataSearchCommand(parent, deps) {
7640
+ const cmd = parent.command("search").description(
7641
+ "Find a data capability by keyword. Free (answered from the bundled index, no upstream call), read-only. Returns operationId + method + path + tags + summary + price_usd for each hit."
7642
+ ).option("--api-key <key>", "API Key for authentication (X-Api-Key)").option(
7643
+ "--keyword <kw>",
7644
+ "What to look for, e.g. 'crypto price' or 'reddit'. Space- or comma-separated tokens; omitted returns the first --limit capabilities as examples."
7645
+ ).option("--limit <n>", "How many hits to return (1-50)", "15");
7646
+ attachSchemaHelp(cmd, dataSearchSchema);
7647
+ cmd.action(async () => {
7648
+ const opts = cmd.optsWithGlobals();
7649
+ const format = resolveFormat(opts.format);
7650
+ const apiKey = await resolveApiKey2(opts.apiKey);
7651
+ const params = {};
7652
+ if (opts.keyword !== void 0) params.keyword = String(opts.keyword);
7653
+ if (opts.limit !== void 0) {
7654
+ params.limit = String(num11(opts.limit, "limit"));
7655
+ }
7656
+ const spinner = format === "json" ? null : createSpinner("Searching data capabilities...");
7657
+ const result = await deps.apiClient.get(
7658
+ "/data/search",
7659
+ { type: "api-key", key: apiKey },
7660
+ params
7661
+ );
7662
+ spinner?.stop();
7663
+ if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
7664
+ await render4(result.data, opts.format, (d) => JSON.stringify(d, null, 2));
7665
+ });
7666
+ }
7667
+
7668
+ // src/data-aisa/describe.ts
7669
+ function registerDataDescribeCommand(parent, deps) {
7670
+ const cmd = parent.command("describe").description(
7671
+ "Read one capability's parameter spec, usage hint and unit price before calling it. Free (answered from the bundled index, no upstream call), read-only."
7672
+ ).option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--operation-id <id>", "Which capability to describe \u2014 an operationId returned by search, verbatim");
7673
+ attachSchemaHelp(cmd, dataDescribeSchema);
7674
+ cmd.action(async () => {
7675
+ const opts = cmd.optsWithGlobals();
7676
+ const format = resolveFormat(opts.format);
7677
+ const operationId = need23(opts.operationId, "operation-id");
7678
+ const apiKey = await resolveApiKey2(opts.apiKey);
7679
+ const spinner = format === "json" ? null : createSpinner("Fetching capability spec...");
7680
+ const result = await deps.apiClient.get(
7681
+ `/data/describe/${encodeURIComponent(operationId)}`,
7682
+ { type: "api-key", key: apiKey }
7683
+ );
7684
+ spinner?.stop();
7685
+ if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
7686
+ await render4(result.data, opts.format, (d) => kv(d));
7687
+ });
7688
+ }
7689
+
7690
+ // src/data-aisa/query.ts
7691
+ function registerDataQueryCommand(parent, deps) {
7692
+ const cmd = parent.command("query").description(
7693
+ "Run one capability and return its data. Charged per call. READ-ONLY: it fetches data and nothing else."
7694
+ ).option("--api-key <key>", "API Key for authentication (X-Api-Key)").option("--operation-id <id>", "Which capability to run \u2014 an operationId returned by search, verbatim").option(
7695
+ "--params <json>",
7696
+ "The capability's parameters as a JSON object keyed by the parameter names from describe. Passed through as a whole; unknown keys are dropped."
7697
+ ).option(
7698
+ "--idempotency-key <key>",
7699
+ "Optional de-duplication key (1-128 chars [A-Za-z0-9_-]) forwarded verbatim as the Idempotency-Key header; never auto-generated, and omitting it is fine"
7700
+ );
7701
+ attachSchemaHelp(cmd, dataQuerySchema);
7702
+ cmd.action(async () => {
7703
+ const opts = cmd.optsWithGlobals();
7704
+ const format = resolveFormat(opts.format);
7705
+ const operationId = need23(opts.operationId, "operation-id");
7706
+ const body = { operation_id: operationId };
7707
+ if (opts.params !== void 0) {
7708
+ body.params = jsonObject(opts.params, "params");
7709
+ }
7710
+ let idempotencyKey;
7711
+ if (opts.idempotencyKey !== void 0) {
7712
+ idempotencyKey = verbatimIdempotencyKey(opts.idempotencyKey, "idempotency-key");
7713
+ }
7714
+ const extraHeaders = idempotencyKey ? { "Idempotency-Key": idempotencyKey } : void 0;
7715
+ const apiKey = await resolveApiKey2(opts.apiKey);
7716
+ const spinner = format === "json" ? null : createSpinner("Fetching data...");
7717
+ const result = await deps.apiClient.post(
7718
+ "/data/query",
7719
+ { type: "api-key", key: apiKey },
7720
+ body,
7721
+ extraHeaders
7722
+ );
7723
+ spinner?.stop();
7724
+ if (!result.success) throw CliError.fromApi(result, { auth: "api-key" });
7725
+ await render4(result.data, opts.format, (d) => kv(d));
7726
+ });
7727
+ }
7728
+
7444
7729
  // src/index.ts
7445
7730
  var programRef;
7446
7731
  async function main() {
@@ -7611,6 +7896,13 @@ Key notes:
7611
7896
  registerRefundDetailCommand(flightCmd, deps);
7612
7897
  registerRefundConfirmCommand(flightCmd, deps);
7613
7898
  registerFlightSkillCommand(flightCmd);
7899
+ const dataCmd = program.command("data-aisa").description(
7900
+ "AIsa read-only information lookup (crypto, markets, web & news, SEO, social, prediction markets, research): list-categories / search / describe / query. Pay-per-call READ-ONLY lookups \u2014 it never places an order and never takes money."
7901
+ );
7902
+ registerDataListCategoriesCommand(dataCmd, deps);
7903
+ registerDataSearchCommand(dataCmd, deps);
7904
+ registerDataDescribeCommand(dataCmd, deps);
7905
+ registerDataQueryCommand(dataCmd, deps);
7614
7906
  await program.parseAsync(process.argv);
7615
7907
  }
7616
7908
  function resolveActiveFormat() {