@carrierllc/mcp 0.13.70 → 0.13.72

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.
@@ -1915,7 +1915,7 @@ function storefrontScreen(input) {
1915
1915
  // package.json
1916
1916
  var package_default = {
1917
1917
  name: "@carrierllc/mcp",
1918
- version: "0.13.70",
1918
+ version: "0.13.72",
1919
1919
  description: "Carrier MCP \u2014 natural-language control of MVNO/eSIM fleets via the network OCS. Stdio mode for direct integration with Claude Desktop, Cursor, Windsurf, and MCP-compatible clients. Ships the `carrier` CLI (plugin install + white-label eSIM storefront scaffold).",
1920
1920
  license: "MIT",
1921
1921
  author: "Carrier (Lifecycle Innovations Limited)",
@@ -3186,7 +3186,7 @@ async function runWithBudget(method, attempt, budget = ocsBudgetFor(method)) {
3186
3186
  throw lastTimeout ?? new OcsTimeoutError(method, budget.attemptMs, budget.totalMs, Math.max(attempts, 1));
3187
3187
  }
3188
3188
 
3189
- // ../../packages/ocs-client/dist/chunk-ZGPZMTHL.js
3189
+ // ../../packages/ocs-client/dist/chunk-STAIW6BD.js
3190
3190
  var RATE_LIMIT = 10;
3191
3191
  var WINDOW_MS = 1e3;
3192
3192
  var windows = /* @__PURE__ */ new Map();
@@ -3636,6 +3636,8 @@ var OcsClient = class {
3636
3636
  this._strictMethods = options.strictMethods ?? false;
3637
3637
  this._validateResponses = options.validateResponses ?? true;
3638
3638
  this._strictValidation = options.strictValidation ?? false;
3639
+ this._customFetch = options.fetch;
3640
+ this._tapeReplay = options.tapeReplay;
3639
3641
  const envConfig = options.env ? fixedEgressFromEnv(options.env) : configuredFixedEgress ?? (typeof process !== "undefined" && process?.env ? fixedEgressFromEnv(process.env) : void 0);
3640
3642
  const optConfig = options.fixedEgress ?? {
3641
3643
  proxyUrl: options.fixedEgressProxyUrl,
@@ -3684,6 +3686,8 @@ var OcsClient = class {
3684
3686
  _validateResponses;
3685
3687
  _strictValidation;
3686
3688
  _fixedEgress;
3689
+ _customFetch;
3690
+ _tapeReplay;
3687
3691
  // Per-instance (NOT static): a static set would dedup across requests in a
3688
3692
  // reused Worker isolate and silently swallow recurring contract-drift warnings.
3689
3693
  _warnedMethods = /* @__PURE__ */ new Set();
@@ -3691,6 +3695,27 @@ var OcsClient = class {
3691
3695
  get fixedEgress() {
3692
3696
  return this._fixedEgress;
3693
3697
  }
3698
+ _validatePayload(method, payload) {
3699
+ if (this._validateResponses) {
3700
+ const schema = RESPONSE_SCHEMAS[method];
3701
+ if (schema) {
3702
+ const parsed = schema.safeParse(payload);
3703
+ if (!parsed.success) {
3704
+ const issues = parsed.error.issues.map((i) => ({
3705
+ path: i.path.join(".") || "<root>",
3706
+ message: i.message
3707
+ }));
3708
+ if (this._strictValidation) {
3709
+ throw new OcsContractError(method, issues, payload);
3710
+ }
3711
+ if (!this._warnedValidation.has(method)) {
3712
+ this._warnedValidation.add(method);
3713
+ console.warn(`[ocs-client] ${new OcsContractError(method, issues, payload).message}`);
3714
+ }
3715
+ }
3716
+ }
3717
+ }
3718
+ }
3694
3719
  async call(method, params = {}, token) {
3695
3720
  if (OCS_FORBIDDEN_METHODS.has(method)) {
3696
3721
  throw new OcsUnknownMethodError(method);
@@ -3721,12 +3746,18 @@ var OcsClient = class {
3721
3746
  assertBareIntParam(method, params);
3722
3747
  const wireParams = applyParamRenames(method, params);
3723
3748
  const shapedParams = nestsSubscriberId(method) ? nestSubscriberIdParam(wireParams) : wireParams;
3749
+ if (this._tapeReplay) {
3750
+ const payload = await this._tapeReplay.play(method, shapedParams);
3751
+ this._validatePayload(method, payload);
3752
+ return payload;
3753
+ }
3724
3754
  const body = JSON.stringify({ [method]: shapedParams });
3725
3755
  const singleAttempt = SINGLE_ATTEMPT_METHODS.has(method);
3726
3756
  const directFallback = !this._fixedEgress?.requireFixedEgress && this._fixedEgress?.fallbackMode === "fallback" && !singleAttempt;
3727
3757
  const send = async () => {
3728
3758
  await acquireToken(tok);
3729
3759
  await acquireEndpointSlot(tok, method, this._priority);
3760
+ const fetchFn = this._customFetch ?? globalThis.fetch;
3730
3761
  return runWithBudget(method, async (signal, attemptMs) => {
3731
3762
  let res;
3732
3763
  if (useProxy) {
@@ -3741,7 +3772,7 @@ var OcsClient = class {
3741
3772
  proxyHeaders["X-Carrier-Proxy-Secret"] = this._fixedEgress.proxySecret;
3742
3773
  }
3743
3774
  try {
3744
- res = await fetch(url, {
3775
+ res = await fetchFn(url, {
3745
3776
  method: "POST",
3746
3777
  headers: proxyHeaders,
3747
3778
  body,
@@ -3756,7 +3787,7 @@ var OcsClient = class {
3756
3787
  `[ocs-client] fixed-egress proxy network failure (${err instanceof Error ? err.message : String(err)}), falling back to direct OCS call`
3757
3788
  );
3758
3789
  try {
3759
- res = await fetch(directUrl, {
3790
+ res = await fetchFn(directUrl, {
3760
3791
  method: "POST",
3761
3792
  headers: { "Content-Type": "application/json" },
3762
3793
  body,
@@ -3781,7 +3812,7 @@ var OcsClient = class {
3781
3812
  `[ocs-client] fixed-egress proxy returned HTTP ${res.status}, falling back to direct OCS call`
3782
3813
  );
3783
3814
  try {
3784
- res = await fetch(directUrl, {
3815
+ res = await fetchFn(directUrl, {
3785
3816
  method: "POST",
3786
3817
  headers: { "Content-Type": "application/json" },
3787
3818
  body,
@@ -3799,7 +3830,7 @@ var OcsClient = class {
3799
3830
  }
3800
3831
  } else {
3801
3832
  try {
3802
- res = await fetch(directUrl, {
3833
+ res = await fetchFn(directUrl, {
3803
3834
  method: "POST",
3804
3835
  headers: { "Content-Type": "application/json" },
3805
3836
  body,
@@ -3861,25 +3892,7 @@ var OcsClient = class {
3861
3892
  payload = null;
3862
3893
  }
3863
3894
  payload = normaliseAbsentOcsPayload(method, payload, shapedParams);
3864
- if (this._validateResponses) {
3865
- const schema = RESPONSE_SCHEMAS[method];
3866
- if (schema) {
3867
- const parsed = schema.safeParse(payload);
3868
- if (!parsed.success) {
3869
- const issues = parsed.error.issues.map((i) => ({
3870
- path: i.path.join(".") || "<root>",
3871
- message: i.message
3872
- }));
3873
- if (this._strictValidation) {
3874
- throw new OcsContractError(method, issues, payload);
3875
- }
3876
- if (!this._warnedValidation.has(method)) {
3877
- this._warnedValidation.add(method);
3878
- console.warn(`[ocs-client] ${new OcsContractError(method, issues, payload).message}`);
3879
- }
3880
- }
3881
- }
3882
- }
3895
+ this._validatePayload(method, payload);
3883
3896
  return payload;
3884
3897
  }, singleAttempt ? { ...ocsBudgetFor(method), maxAttempts: 1 } : void 0);
3885
3898
  };
@@ -6148,4 +6161,4 @@ export {
6148
6161
  package_default,
6149
6162
  CARRIER_VERSION
6150
6163
  };
6151
- //# sourceMappingURL=chunk-2SCQOXDB.js.map
6164
+ //# sourceMappingURL=chunk-NGNLWI7W.js.map