@carrierllc/mcp 0.13.39 → 0.13.41

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/cli.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  verifyStorefront,
45
45
  walletScreen,
46
46
  which
47
- } from "./chunk-I3Z5WYDG.js";
47
+ } from "./chunk-6OAZJBLA.js";
48
48
  import {
49
49
  copyTree,
50
50
  exists,
@@ -1575,6 +1575,13 @@ async function callMcpTool(tool, args, opts = {}) {
1575
1575
  }, timeoutMs);
1576
1576
  });
1577
1577
  const signal = controller.signal;
1578
+ const inventory = tool === "assign_package" && !(typeof args.iccid === "string" && args.iccid.trim());
1579
+ let inventoryDispatched = false;
1580
+ const unknownInventory = () => ({ ok: false, text: JSON.stringify({
1581
+ code: "OUTCOME_UNKNOWN",
1582
+ request_key: args.request_key,
1583
+ message: "Inventory issuance outcome is unknown. Preserve this key for reconciliation; do not issue with a new key."
1584
+ }) });
1578
1585
  try {
1579
1586
  const result = await Promise.race([
1580
1587
  (async () => {
@@ -1637,6 +1644,7 @@ async function callMcpTool(tool, args, opts = {}) {
1637
1644
  signal,
1638
1645
  body: JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })
1639
1646
  }).catch(() => void 0);
1647
+ inventoryDispatched = inventory;
1640
1648
  const res = await fetch(mcpUrl, {
1641
1649
  method: "POST",
1642
1650
  headers: sessionHeaders,
@@ -1649,6 +1657,7 @@ async function callMcpTool(tool, args, opts = {}) {
1649
1657
  })
1650
1658
  });
1651
1659
  if (!res.ok) {
1660
+ if (inventoryDispatched) return unknownInventory();
1652
1661
  const snippet = (await res.text().catch(() => "")).slice(0, 240);
1653
1662
  return {
1654
1663
  ok: false,
@@ -1660,11 +1669,13 @@ async function callMcpTool(tool, args, opts = {}) {
1660
1669
  }
1661
1670
  const json = parseRpcBody(await res.text());
1662
1671
  if (json.error?.message) {
1672
+ if (inventoryDispatched) return unknownInventory();
1663
1673
  return {
1664
1674
  ok: false,
1665
1675
  text: withNextStep(json.error.message, opts.errorHints ?? DEFAULT_ERROR_HINTS)
1666
1676
  };
1667
1677
  }
1678
+ if (inventoryDispatched && !Array.isArray(json.result?.content)) return unknownInventory();
1668
1679
  const parts = json.result?.content ?? [];
1669
1680
  const text3 = parts.map((p4) => p4.text).filter(Boolean).join("\n").trim() || JSON.stringify(json.result ?? json, null, 2);
1670
1681
  return {
@@ -1677,6 +1688,7 @@ async function callMcpTool(tool, args, opts = {}) {
1677
1688
  ]);
1678
1689
  return redactCredential(result, token);
1679
1690
  } catch (e) {
1691
+ if (inventoryDispatched) return unknownInventory();
1680
1692
  if (isTimeoutish(e)) {
1681
1693
  const secs = Math.round(timeoutMs / 1e3);
1682
1694
  return {
@@ -3883,10 +3895,23 @@ var CLI_DOMAINS = [
3883
3895
  },
3884
3896
  {
3885
3897
  flags: "--account-id <id>",
3886
- description: "Auto-pick a free eSIM from this account instead of using --iccid",
3898
+ description: "Issue from inventory through the authenticated Carrier API; requires --request-key; preserve it after unknown outcomes",
3887
3899
  arg: "account_for_subs",
3888
3900
  type: "number"
3889
- }
3901
+ },
3902
+ {
3903
+ flags: "--request-key <key>",
3904
+ description: "Required stable inventory key (1\u2013200 safe characters); preserved after unknown outcomes",
3905
+ arg: "request_key",
3906
+ type: "string"
3907
+ },
3908
+ { flags: "--start-date <date>", description: "Inventory package start date", arg: "startDate", type: "string" },
3909
+ { flags: "--end-date <date>", description: "Inventory package end date", arg: "endDate", type: "string" },
3910
+ { flags: "--validity-period <days>", description: "Inventory package validity period", arg: "validityPeriod", type: "number" },
3911
+ { flags: "--business-kind <kind>", description: "Authorized reference kind: storefront_order", arg: "business_reference.kind", type: "string" },
3912
+ { flags: "--business-id <id>", description: "Existing API-authorized order ID", arg: "business_reference.id", type: "string" },
3913
+ { flags: "--business-line <line>", description: "Authorized reference line: esim", arg: "business_reference.line", type: "string" },
3914
+ { flags: "--business-verb <verb>", description: "Authorized reference verb: issue", arg: "business_reference.verb", type: "string" }
3890
3915
  ],
3891
3916
  write: true,
3892
3917
  requireOneOf: ["iccid", "account_for_subs"]
@@ -4952,7 +4977,7 @@ var CLI_DOMAINS = [
4952
4977
  options: [
4953
4978
  {
4954
4979
  flags: "--pack <pack>",
4955
- description: "Pack id (pack_500/pack_1000/pack_2500/pack_5000) or exact EUR-cents amount.",
4980
+ description: "Pack id (pack_25/pack_50/pack_100/pack_500/pack_1000/pack_2500/pack_5000) or exact EUR-cents amount.",
4956
4981
  arg: "pack",
4957
4982
  type: "string"
4958
4983
  }