@carrierllc/mcp 0.13.72 → 0.13.74

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
@@ -91,7 +91,7 @@ import {
91
91
  verifyStorefront,
92
92
  withOcsListSummary,
93
93
  withTemplateResellerId
94
- } from "./chunk-NGNLWI7W.js";
94
+ } from "./chunk-X7U4FBUH.js";
95
95
  import "./chunk-SHKKVIIA.js";
96
96
 
97
97
  // src/index.ts
@@ -354,6 +354,7 @@ function createAiCreditBilling(env) {
354
354
  }
355
355
  };
356
356
  }
357
+ var MIN_AI_TOPUP_CENTS = 1e3;
357
358
  var AI_TIER_POLICY = {
358
359
  free: { limit: 5, window: "day" },
359
360
  pro: { limit: 1e3, window: "month" },
@@ -1370,22 +1371,22 @@ function boundZonesResult(raw, opts = {}) {
1370
1371
  const { verbose = false, resellerId } = opts;
1371
1372
  const maxZones = opts.maxZones ?? ZONES_MAX_ZONES;
1372
1373
  const maxOperators = opts.maxOperators ?? (verbose ? ZONES_VERBOSE_MAX_OPERATORS : ZONES_MAX_OPERATORS);
1373
- const totalOperators = all.reduce((n, z29) => n + (z29.operators?.length ?? 0), 0);
1374
+ const totalOperators = all.reduce((n, z30) => n + (z30.operators?.length ?? 0), 0);
1374
1375
  const keptZones = all.slice(0, maxZones);
1375
1376
  let budget = maxOperators;
1376
1377
  let returnedOperators = 0;
1377
- const zones = keptZones.map((z29) => {
1378
- const ops = z29.operators ?? [];
1378
+ const zones = keptZones.map((z30) => {
1379
+ const ops = z30.operators ?? [];
1379
1380
  const take = Math.max(0, Math.min(ops.length, budget));
1380
1381
  budget -= take;
1381
1382
  returnedOperators += take;
1382
1383
  const sliced = ops.slice(0, take);
1383
1384
  if (verbose) {
1384
- return { ...z29, operators: sliced, operatorCount: ops.length };
1385
+ return { ...z30, operators: sliced, operatorCount: ops.length };
1385
1386
  }
1386
1387
  return {
1387
- zoneId: z29.zoneId,
1388
- zoneName: z29.zoneName,
1388
+ zoneId: z30.zoneId,
1389
+ zoneName: z30.zoneName,
1389
1390
  operatorCount: ops.length,
1390
1391
  operators: sliced.map((o) => ({
1391
1392
  net: o.networkId,
@@ -5451,7 +5452,7 @@ function registerAllBacklogTools(server2, ctx) {
5451
5452
  }
5452
5453
 
5453
5454
  // src/tools-carrier-ask.ts
5454
- import { z as z17 } from "zod";
5455
+ import { z as z18 } from "zod";
5455
5456
 
5456
5457
  // src/tools-ui-agent.ts
5457
5458
  import { z as z5 } from "zod";
@@ -7512,8 +7513,76 @@ function registerWalletTools(server2, ctx) {
7512
7513
  );
7513
7514
  }
7514
7515
 
7515
- // src/stripe-connect-tools.ts
7516
+ // src/ai-wallet-tools.ts
7516
7517
  import { z as z10 } from "zod";
7518
+ var AI_WALLET_TOOL_SCOPES = {
7519
+ ai_wallet_auto_topup: "write"
7520
+ };
7521
+ async function aiWallet(env, orgId, method, body2) {
7522
+ const response = await fetch(
7523
+ `${env.ATLAS_BASE_URL ?? "https://atlas.carrier.llc"}/internal/ai-topup/${encodeURIComponent(orgId)}`,
7524
+ {
7525
+ method,
7526
+ headers: {
7527
+ "Content-Type": "application/json",
7528
+ "X-Carrier-Internal-Key": env.CARRIER_INTERNAL_API_KEY ?? ""
7529
+ },
7530
+ ...body2 === void 0 ? {} : { body: JSON.stringify(body2) }
7531
+ }
7532
+ );
7533
+ if (!response.ok) throw new Error(`AI wallet request failed (${response.status})`);
7534
+ return response.json();
7535
+ }
7536
+ function registerAiWalletTools(server2, ctx) {
7537
+ const orgId = ctx.props.org_id ?? ctx.props.sub;
7538
+ server2.registerTool(
7539
+ "ai_wallet_auto_topup",
7540
+ {
7541
+ title: "AI Wallet Auto Top-up Settings",
7542
+ description: "Read or change automatic EUR replenishment for the separate AI-credit wallet. This does not charge a card and does not change the eSIM connectivity wallet. Params: enabled (optional boolean), amount_cents (optional integer nominal EUR cents, minimum 1000). Omitting both reads the current setting. Omitting amount while disabling preserves the saved amount. Sending only an amount changes the amount and keeps the current on/off setting.",
7543
+ inputSchema: {
7544
+ enabled: z10.boolean().optional(),
7545
+ amount_cents: z10.number().int().min(MIN_AI_TOPUP_CENTS).optional()
7546
+ },
7547
+ outputSchema: {
7548
+ org_id: z10.string(),
7549
+ balance_eur_micros: z10.number().int(),
7550
+ auto_topup_enabled: z10.boolean(),
7551
+ auto_topup_amount_cents: z10.number().int()
7552
+ },
7553
+ // Changes a setting only, never charges, and repeating a call is harmless.
7554
+ annotations: annotationsFor("ai_wallet_auto_topup", "write", { idempotentHint: true })
7555
+ },
7556
+ async ({ enabled, amount_cents }) => {
7557
+ const denied = denyUnlessScoped(ctx.props, "ai_wallet_auto_topup", AI_WALLET_TOOL_SCOPES);
7558
+ if (denied) return denied;
7559
+ if (ctx.env.CARRIER_AI_AUTO_TOPUP_ENABLED !== "true") {
7560
+ return {
7561
+ isError: true,
7562
+ content: [{ type: "text", text: "AI auto top-up is not available on this deployment." }]
7563
+ };
7564
+ }
7565
+ try {
7566
+ const state = enabled === void 0 && amount_cents === void 0 ? await aiWallet(ctx.env, orgId, "GET") : await aiWallet(ctx.env, orgId, "PUT", {
7567
+ ...enabled === void 0 ? {} : { enabled },
7568
+ ...amount_cents === void 0 ? {} : { amount_cents }
7569
+ });
7570
+ return {
7571
+ content: [{ type: "text", text: JSON.stringify(state) }],
7572
+ structuredContent: { ...state }
7573
+ };
7574
+ } catch (error) {
7575
+ return {
7576
+ isError: true,
7577
+ content: [{ type: "text", text: error instanceof Error ? error.message : "AI wallet unavailable" }]
7578
+ };
7579
+ }
7580
+ }
7581
+ );
7582
+ }
7583
+
7584
+ // src/stripe-connect-tools.ts
7585
+ import { z as z11 } from "zod";
7517
7586
  import * as Sentry3 from "@sentry/cloudflare";
7518
7587
 
7519
7588
  // src/binding-unavailable.ts
@@ -7669,7 +7738,7 @@ function registerStripeConnectTools(server2, ctx) {
7669
7738
  title: "Stripe Connect Status",
7670
7739
  description: "Read-only: returns the Stripe Connect account status, capabilities, and requirements for the authenticated operator.",
7671
7740
  inputSchema: {
7672
- operator_id: z10.string().optional().describe("Override operator_id (admin use). Defaults to caller's org/user.")
7741
+ operator_id: z11.string().optional().describe("Override operator_id (admin use). Defaults to caller's org/user.")
7673
7742
  },
7674
7743
  annotations: annotationsFor("stripe_connect_status", "read")
7675
7744
  },
@@ -7730,8 +7799,8 @@ function registerStripeConnectTools(server2, ctx) {
7730
7799
  title: "List Stripe Payouts",
7731
7800
  description: "List money Stripe has already sent from the operator's connected account to their bank, newest first. Read-only. Params: `limit` (1-50, default 10), `status` (optional Stripe payout status, e.g. 'paid', 'pending', 'failed'). Returns: { payouts: [{ id, amount, currency, status, arrival_date, automatic, created }], has_more } \u2014 amount in the currency's smallest unit. Do NOT use this for money still sitting at Stripe and not yet paid out \u2014 use `stripe_connect_balance`.",
7732
7801
  inputSchema: {
7733
- limit: z10.number().int().min(1).max(50).default(10).describe("Number of payouts to return."),
7734
- status: z10.enum(["pending", "paid", "failed", "canceled", "in_transit"]).optional().describe("Filter by payout status.")
7802
+ limit: z11.number().int().min(1).max(50).default(10).describe("Number of payouts to return."),
7803
+ status: z11.enum(["pending", "paid", "failed", "canceled", "in_transit"]).optional().describe("Filter by payout status.")
7735
7804
  },
7736
7805
  annotations: annotationsFor("stripe_connect_payouts", "read")
7737
7806
  },
@@ -7770,8 +7839,8 @@ function registerStripeConnectTools(server2, ctx) {
7770
7839
  title: "Stripe Connect Charges",
7771
7840
  description: "List recent payments (charges) on the operator's connected Stripe account, e.g. storefront purchases. Read-only. Params: limit (1-100), starting_after (charge id for paging). Returns: { charges: [{ id, amount, amount_refunded, currency, status, paid, captured, refunded, created, payment_intent, payment_method_type, metadata }], has_more }. Do NOT use this for payouts to the bank \u2014 use `stripe_connect_payouts`.",
7772
7841
  inputSchema: {
7773
- limit: z10.number().int().min(1).max(100).default(20).describe("Number of charges to return."),
7774
- starting_after: z10.string().regex(/^(ch|py)_[A-Za-z0-9]+$/).optional().describe("Charge id to page after.")
7842
+ limit: z11.number().int().min(1).max(100).default(20).describe("Number of charges to return."),
7843
+ starting_after: z11.string().regex(/^(ch|py)_[A-Za-z0-9]+$/).optional().describe("Charge id to page after.")
7775
7844
  },
7776
7845
  annotations: annotationsFor("stripe_connect_charges_list", "read")
7777
7846
  },
@@ -7867,10 +7936,10 @@ function registerStripeConnectTools(server2, ctx) {
7867
7936
  title: "Refund a Charge (moves real money)",
7868
7937
  description: "Refund money to a customer on one charge in the operator's connected Stripe account. This returns real funds and Stripe cannot reverse a refund once issued. Two-step by design: call without `confirm_token` to get a token and a summary of what would be refunded, then call again with that token to execute. The token expires in 5 minutes. Params: `charge_id` (Stripe charge id, `ch_...`), `amount_cents` (optional integer in the charge's smallest currency unit \u2014 omit for a full refund), `reason` ('duplicate' | 'fraudulent' | 'requested_by_customer', optional), `confirm_token`. Returns: the refund id and status. Requires `write` scope. Do NOT use this on a payment that was authorized but not captured \u2014 cancel its PaymentIntent instead (Stripe POST /v1/payment_intents/:id/cancel). Do NOT use this to contest a chargeback \u2014 read the case with `stripe_connect_dispute_list` first, since refunding a disputed charge can cost the operator twice.",
7869
7938
  inputSchema: {
7870
- charge_id: z10.string().min(1).describe("Stripe charge ID (ch_...)."),
7871
- amount_cents: z10.number().int().min(1).optional().describe("Partial refund amount in cents. Omit for full refund."),
7872
- reason: z10.enum(["duplicate", "fraudulent", "requested_by_customer"]).optional(),
7873
- confirm_token: z10.string().optional().describe("Confirmation token from previous call. Required to execute.")
7939
+ charge_id: z11.string().min(1).describe("Stripe charge ID (ch_...)."),
7940
+ amount_cents: z11.number().int().min(1).optional().describe("Partial refund amount in cents. Omit for full refund."),
7941
+ reason: z11.enum(["duplicate", "fraudulent", "requested_by_customer"]).optional(),
7942
+ confirm_token: z11.string().optional().describe("Confirmation token from previous call. Required to execute.")
7874
7943
  },
7875
7944
  annotations: annotationsFor("stripe_connect_refund", "write")
7876
7945
  },
@@ -7929,8 +7998,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7929
7998
  title: "List Chargeback Disputes",
7930
7999
  description: "List chargebacks customers have raised with their bank against the operator's connected Stripe account. Read-only \u2014 responding to one is Dashboard work. Params: `limit` (1-50, default 10), `status` (optional Stripe dispute status, e.g. 'needs_response', 'under_review'). Returns: { disputes: [{ id, charge, amount, currency, status, reason, evidence_details.due_by }], has_more } \u2014 amount in the currency's smallest unit, `due_by` a Unix timestamp or null. Do NOT use this for charges Stripe is holding for fraud review before they settle \u2014 those are `radar_review_list`. Check this before refunding: refunding a disputed charge can cost the operator the amount twice.",
7931
8000
  inputSchema: {
7932
- limit: z10.number().int().min(1).max(50).default(10),
7933
- status: z10.string().optional().describe("Filter by dispute status (e.g. needs_response, under_review).")
8001
+ limit: z11.number().int().min(1).max(50).default(10),
8002
+ status: z11.string().optional().describe("Filter by dispute status (e.g. needs_response, under_review).")
7934
8003
  },
7935
8004
  annotations: annotationsFor("stripe_connect_dispute_list", "read")
7936
8005
  },
@@ -7969,8 +8038,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
7969
8038
  title: "List Radar Fraud Reviews",
7970
8039
  description: "List the Stripe Radar fraud reviews waiting on a manual approve/decline decision, newest first. Reads only \u2014 deciding a review is a separate call. Params: `open_only` (boolean, default true; Stripe lists open reviews only, so false returns the same set), `limit` (1-50, default 10). Returns: { reviews: [{ id (`prv_...`), charge, reason, opened_reason, closed_reason, created, closed }], has_more }. Call this first to get the `review_id` that `radar_review_approve` and `radar_review_decline` require. Do NOT use this for chargebacks the customer has already raised with their bank \u2014 use `stripe_connect_dispute_list`.",
7971
8040
  inputSchema: {
7972
- open_only: z10.boolean().default(true).describe("Stripe lists only open (undecided) reviews; kept for compatibility."),
7973
- limit: z10.number().int().min(1).max(50).default(10)
8041
+ open_only: z11.boolean().default(true).describe("Stripe lists only open (undecided) reviews; kept for compatibility."),
8042
+ limit: z11.number().int().min(1).max(50).default(10)
7974
8043
  },
7975
8044
  annotations: annotationsFor("radar_review_list", "read")
7976
8045
  },
@@ -8012,8 +8081,8 @@ Call again with confirm_token="${token2}" to execute. Token expires in 5 minutes
8012
8081
  title: "Approve Radar Review (captures charge)",
8013
8082
  description: "Clear a Stripe Radar fraud review so the held charge is captured and the money is taken. Approving overrides Radar's fraud signal, so a genuinely fraudulent charge approved here usually returns later as a chargeback plus a fee. Two-step by design: call without `confirm_token` to get a token, then call again with it to execute. Params: `review_id` (`prv_...`, from `radar_review_list`), `confirm_token`. Requires `admin` scope. Do NOT call this to turn a suspicious charge away \u2014 Stripe has no review decline; refund the charge (`stripe_connect_refund`) or cancel an uncaptured PaymentIntent. Do NOT call this to return money on a charge that already went through \u2014 that is `stripe_connect_refund`.",
8014
8083
  inputSchema: {
8015
- review_id: z10.string().min(1).describe("Stripe Radar review ID (prv_...)."),
8016
- confirm_token: z10.string().optional()
8084
+ review_id: z11.string().min(1).describe("Stripe Radar review ID (prv_...)."),
8085
+ confirm_token: z11.string().optional()
8017
8086
  },
8018
8087
  annotations: annotationsFor("radar_review_approve", "admin")
8019
8088
  },
@@ -8069,8 +8138,8 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
8069
8138
  title: "Decline Radar Review (not supported by Stripe)",
8070
8139
  description: "Always refuses and calls nothing: Stripe has no endpoint to decline a Radar review (its Reviews API only lists, retrieves and approves). Payments in review have usually already been processed. To turn one away, refund the charge on Carrier's platform account in Stripe itself (Dashboard, or platform-scoped POST /v1/refunds with no Stripe-Account header): `stripe_connect_refund` always acts as the operator's connected account, so it will NOT find a platform charge from this review list. or, for a payment authorized but not captured, cancel its PaymentIntent (Stripe POST /v1/payment_intents/:id/cancel); either closes the review. Params: `review_id` (`prv_...`), `confirm_token` (ignored). Requires `admin` scope. Do NOT call this expecting a charge to be blocked; nothing happens.",
8071
8140
  inputSchema: {
8072
- review_id: z10.string().min(1),
8073
- confirm_token: z10.string().optional()
8141
+ review_id: z11.string().min(1),
8142
+ confirm_token: z11.string().optional()
8074
8143
  },
8075
8144
  annotations: annotationsFor("radar_review_decline", "admin")
8076
8145
  },
@@ -8091,9 +8160,9 @@ Call again with confirm_token="${token2}" to execute. Expires in 5 minutes.`
8091
8160
  title: "Add Value to Radar List",
8092
8161
  description: "Add one value to an existing Stripe Radar value list, changing how every future charge is scored. Whether the value ends up blocked or allowed depends entirely on which list you name in `value_list_id` \u2014 this tool does not choose, and putting a value on the allow list when you meant the block list silently lets fraud through. Confirm the list's purpose before calling. Two-step by design: call without `confirm_token` to get a token, then call again with it to execute. Params: `value_list_id` (`rsl_...`, an existing list), `value` (one email, IP address, card fingerprint, or ISO country code \u2014 one item per call), `confirm_token`. Requires `admin` scope. Do NOT use this to decide a single charge that is already under review \u2014 use `radar_review_approve` or `radar_review_decline`. Do NOT use this to create a list or a rule: only `value` is added, and rules cannot be edited through this API at all (see `radar_rule_toggle`).",
8093
8162
  inputSchema: {
8094
- value_list_id: z10.string().min(1).describe("Stripe Radar value list ID (rsl_...)."),
8095
- value: z10.string().min(1).describe("The value to add (email, IP address, country code, etc.)."),
8096
- confirm_token: z10.string().optional()
8163
+ value_list_id: z11.string().min(1).describe("Stripe Radar value list ID (rsl_...)."),
8164
+ value: z11.string().min(1).describe("The value to add (email, IP address, country code, etc.)."),
8165
+ confirm_token: z11.string().optional()
8097
8166
  },
8098
8167
  annotations: annotationsFor("radar_value_list_add", "admin")
8099
8168
  },
@@ -8148,8 +8217,8 @@ Expires in 5 minutes.`
8148
8217
  title: "Radar Rule Toggle (instructions only)",
8149
8218
  description: "Return the Stripe Dashboard steps for enabling or disabling a Radar rule. This tool changes nothing: Stripe has no public API for rule state, so the call always succeeds and the rule stays exactly as it was. Never report the rule as toggled. Params: `rule_id` (Stripe Radar rule id), `enabled` (true for the enable instructions, false for disable). Returns: the Dashboard URL and steps for a human to follow. Requires `admin` scope. Do NOT use this when a change must actually take effect from an agent \u2014 the only Radar state reachable through this API is value-list membership, via `radar_value_list_add`.",
8150
8219
  inputSchema: {
8151
- rule_id: z10.string().min(1).describe("Stripe Radar rule ID."),
8152
- enabled: z10.boolean().describe("true = enable, false = disable.")
8220
+ rule_id: z11.string().min(1).describe("Stripe Radar rule ID."),
8221
+ enabled: z11.boolean().describe("true = enable, false = disable.")
8153
8222
  },
8154
8223
  annotations: annotationsFor("radar_rule_toggle", "admin")
8155
8224
  },
@@ -8174,7 +8243,7 @@ Note: If you need this automated, use the Radar for Platforms beta \u2014 contac
8174
8243
  }
8175
8244
 
8176
8245
  // src/tools-storefront-logo.ts
8177
- import { z as z11 } from "zod";
8246
+ import { z as z12 } from "zod";
8178
8247
  var STOREFRONT_LOGO_TOOL_SCOPES = {
8179
8248
  generate_storefront_logo: "read"
8180
8249
  };
@@ -8187,9 +8256,9 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
8187
8256
  title: "Generate Storefront Logo",
8188
8257
  description: "Generate a storefront logo (SVG always; PNG when an image key is configured on the Carrier worker). Works for any authenticated Carrier MCP user \u2014 no local image-API key required. Write the SVG to public/brand/logo.svg in the storefront.",
8189
8258
  inputSchema: {
8190
- name: z11.string().min(1).describe("Brand / shop name, e.g. Bananas"),
8191
- accent: z11.string().regex(/^#?[0-9A-Fa-f]{6}$/).optional().describe("Accent hex, e.g. #FF8A00"),
8192
- tagline: z11.string().optional().describe("Optional tagline for AI-enhanced marks")
8259
+ name: z12.string().min(1).describe("Brand / shop name, e.g. Bananas"),
8260
+ accent: z12.string().regex(/^#?[0-9A-Fa-f]{6}$/).optional().describe("Accent hex, e.g. #FF8A00"),
8261
+ tagline: z12.string().optional().describe("Optional tagline for AI-enhanced marks")
8193
8262
  },
8194
8263
  annotations: annotationsFor("generate_storefront_logo", "read")
8195
8264
  },
@@ -8223,7 +8292,7 @@ function registerStorefrontLogoTools(server2, env = {}, props2) {
8223
8292
  }
8224
8293
 
8225
8294
  // src/tools-storefront-deploy.ts
8226
- import { z as z12 } from "zod";
8295
+ import { z as z13 } from "zod";
8227
8296
  var STOREFRONT_DEPLOY_TOOL_SCOPES = {
8228
8297
  list_deploy_targets: "read",
8229
8298
  deploy_storefront: "write",
@@ -8240,7 +8309,7 @@ function registerStorefrontDeployTools(server2, props2) {
8240
8309
  title: "List Deploy Targets",
8241
8310
  description: "Report which storefront deploy hosts (Cloudflare, Vercel, Netlify, Fly) are installed, logged in, and ready on this machine, and which one a deploy would pick.",
8242
8311
  inputSchema: {
8243
- dir: z12.string().min(1).describe("Path to the scaffolded storefront directory")
8312
+ dir: z13.string().min(1).describe("Path to the scaffolded storefront directory")
8244
8313
  },
8245
8314
  annotations: annotationsFor("list_deploy_targets", "read")
8246
8315
  },
@@ -8266,17 +8335,17 @@ function registerStorefrontDeployTools(server2, props2) {
8266
8335
  title: "Deploy Storefront",
8267
8336
  description: "Build and deploy a scaffolded storefront to whichever host is available on this machine, then push its runtime secrets (CARRIER_API_KEY, CLERK_SECRET_KEY) to that host.",
8268
8337
  inputSchema: {
8269
- dir: z12.string().min(1).describe("Path to the scaffolded storefront directory"),
8270
- target: z12.enum(TARGET_IDS).optional().describe("Force a host instead of auto-detecting"),
8271
- name: z12.string().optional().describe("Project/worker name (defaults from brand)"),
8272
- force: z12.boolean().optional().describe(
8338
+ dir: z13.string().min(1).describe("Path to the scaffolded storefront directory"),
8339
+ target: z13.enum(TARGET_IDS).optional().describe("Force a host instead of auto-detecting"),
8340
+ name: z13.string().optional().describe("Project/worker name (defaults from brand)"),
8341
+ force: z13.boolean().optional().describe(
8273
8342
  'Acknowledge the scaffold-default-name risk: required when the resolved name is the scaffold default "storefront"'
8274
8343
  ),
8275
- skip_build: z12.boolean().optional().describe("Deploy the existing build without rebuilding"),
8276
- push_secrets: z12.boolean().optional().describe("Stage runtime secrets on the host before deploy (default true)"),
8277
- provision_clerk: z12.boolean().optional().default(true).describe("Provision and configure Clerk automatically (default true)"),
8278
- verify: z12.boolean().optional().describe("Probe the deployed URL and report whether it actually serves (default true)"),
8279
- domain: z12.boolean().optional().describe("Route the brand domain to the deployment (Cloudflare provisions DNS + cert)")
8344
+ skip_build: z13.boolean().optional().describe("Deploy the existing build without rebuilding"),
8345
+ push_secrets: z13.boolean().optional().describe("Stage runtime secrets on the host before deploy (default true)"),
8346
+ provision_clerk: z13.boolean().optional().default(true).describe("Provision and configure Clerk automatically (default true)"),
8347
+ verify: z13.boolean().optional().describe("Probe the deployed URL and report whether it actually serves (default true)"),
8348
+ domain: z13.boolean().optional().describe("Route the brand domain to the deployment (Cloudflare provisions DNS + cert)")
8280
8349
  },
8281
8350
  annotations: annotationsFor("deploy_storefront", "write")
8282
8351
  },
@@ -8396,11 +8465,11 @@ function registerStorefrontDeployTools(server2, props2) {
8396
8465
  title: "Provision Storefront Clerk App",
8397
8466
  description: "Create a Clerk application (Platform API) or reuse Clerk keys already on this machine, write them into the storefront .env.local, and configure allowed origins and redirect URLs on the instance.",
8398
8467
  inputSchema: {
8399
- dir: z12.string().min(1).describe("Path to the scaffolded storefront directory"),
8400
- name: z12.string().optional().describe("Clerk application name (defaults from brand)"),
8401
- production: z12.boolean().optional().describe("Also create a production instance (Platform API only)"),
8402
- no_create: z12.boolean().optional().describe("Never create a new application; only reuse existing keys"),
8403
- url: z12.string().optional().describe("Deployed URL to whitelist as origin and redirect")
8468
+ dir: z13.string().min(1).describe("Path to the scaffolded storefront directory"),
8469
+ name: z13.string().optional().describe("Clerk application name (defaults from brand)"),
8470
+ production: z13.boolean().optional().describe("Also create a production instance (Platform API only)"),
8471
+ no_create: z13.boolean().optional().describe("Never create a new application; only reuse existing keys"),
8472
+ url: z13.string().optional().describe("Deployed URL to whitelist as origin and redirect")
8404
8473
  },
8405
8474
  annotations: annotationsFor("provision_storefront_clerk", "write")
8406
8475
  },
@@ -8456,7 +8525,7 @@ function registerStorefrontDeployTools(server2, props2) {
8456
8525
  }
8457
8526
 
8458
8527
  // src/tools-storefront-plan.ts
8459
- import { z as z13 } from "zod";
8528
+ import { z as z14 } from "zod";
8460
8529
 
8461
8530
  // src/lib/storefront-plan-update.ts
8462
8531
  var STRIPE_PRICE_ID_RE = /^price_[A-Za-z0-9_]+$/;
@@ -8562,7 +8631,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8562
8631
  server2.registerTool(name, {
8563
8632
  title: name === "list_storefronts" ? "List Storefronts" : "Get Storefront",
8564
8633
  description: "Read hosted storefront plans including stored OCS account ids and account_status.",
8565
- inputSchema: name === "get_storefront" ? { storefront_id: z13.string().min(1) } : {},
8634
+ inputSchema: name === "get_storefront" ? { storefront_id: z14.string().min(1) } : {},
8566
8635
  annotations: annotationsFor(name, "read")
8567
8636
  }, async (args) => {
8568
8637
  const denied = denyUnlessScoped(props2, name, STOREFRONT_PLAN_TOOL_SCOPES);
@@ -8581,14 +8650,14 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8581
8650
  title: "Update Storefront Plan",
8582
8651
  description: "Change the retail price, whether a plan is for sale, its OCS account, its display order, or the stored Stripe Price on the caller's own hosted storefront. The plan must already exist. A price of zero or less is refused. stripe_price_id and stripe_price_mode are set together; null clears both. The id must look like price_\u2026 and be 1-255 characters. A plan on another storefront is not found and is left unchanged. The Price is stored, not yet charged. This does not create a Stripe Price, and a buyer cannot set one. The later checkout must verify the Price on the connected account.",
8583
8652
  inputSchema: {
8584
- ocs_account_id: z13.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
8585
- storefront_id: z13.string().min(1).describe("Id of the hosted storefront"),
8586
- slug: z13.string().min(1).describe("Plan slug, such as eu-1gb"),
8587
- price_cents: z13.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
8588
- active: z13.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
8589
- sort_order: z13.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it."),
8590
- stripe_price_id: z13.string().regex(/^price_[A-Za-z0-9_]+$/).max(255).nullable().optional().describe("Existing Stripe Price id (price_\u2026, 1-255 characters), stored, not yet charged. Set with stripe_price_mode. Null clears both. Omit to leave them."),
8591
- stripe_price_mode: z13.enum(["test", "live"]).nullable().optional().describe("test or live. Set with stripe_price_id. Null clears both. Omit to leave them.")
8653
+ ocs_account_id: z14.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
8654
+ storefront_id: z14.string().min(1).describe("Id of the hosted storefront"),
8655
+ slug: z14.string().min(1).describe("Plan slug, such as eu-1gb"),
8656
+ price_cents: z14.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
8657
+ active: z14.boolean().optional().describe("Whether the plan is for sale. Omit to leave it."),
8658
+ sort_order: z14.number().int().nonnegative().optional().describe("Display order, lowest first. Omit to leave it."),
8659
+ stripe_price_id: z14.string().regex(/^price_[A-Za-z0-9_]+$/).max(255).nullable().optional().describe("Existing Stripe Price id (price_\u2026, 1-255 characters), stored, not yet charged. Set with stripe_price_mode. Null clears both. Omit to leave them."),
8660
+ stripe_price_mode: z14.enum(["test", "live"]).nullable().optional().describe("test or live. Set with stripe_price_id. Null clears both. Omit to leave them.")
8592
8661
  },
8593
8662
  annotations: annotationsFor("update_storefront_plan", "write")
8594
8663
  },
@@ -8616,7 +8685,7 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
8616
8685
  }
8617
8686
 
8618
8687
  // src/tools-atlas.ts
8619
- import { z as z14 } from "zod";
8688
+ import { z as z15 } from "zod";
8620
8689
 
8621
8690
  // src/atlas-public.ts
8622
8691
  var ATLAS_PUBLIC_BASE_URL = "https://atlas.carrier.llc";
@@ -8674,13 +8743,13 @@ var ATLAS_TOOL_SCOPES = {
8674
8743
  get_atlas_network_status: "read"
8675
8744
  };
8676
8745
  var coverageSchema = {
8677
- country: z14.string().regex(/^[A-Za-z]{2}$/, "country must be a 2-letter ISO code").describe("ISO 3166-1 alpha-2 country code, for example JP or NL"),
8678
- status: z14.enum(["up", "degraded", "down", "unknown"]).optional().describe("Keep only networks whose latest probe has this status"),
8679
- technology: z14.enum(["2G", "3G", "4G", "5G"]).optional().describe("Keep only networks of this radio generation")
8746
+ country: z15.string().regex(/^[A-Za-z]{2}$/, "country must be a 2-letter ISO code").describe("ISO 3166-1 alpha-2 country code, for example JP or NL"),
8747
+ status: z15.enum(["up", "degraded", "down", "unknown"]).optional().describe("Keep only networks whose latest probe has this status"),
8748
+ technology: z15.enum(["2G", "3G", "4G", "5G"]).optional().describe("Keep only networks of this radio generation")
8680
8749
  };
8681
8750
  var networkSchema = {
8682
- mcc: z14.string().regex(/^\d{3}$/, "mcc must be 3 digits").describe("Mobile Country Code"),
8683
- mnc: z14.string().regex(/^\d{2,3}$/, "mnc must be 2 or 3 digits").describe("Mobile Network Code")
8751
+ mcc: z15.string().regex(/^\d{3}$/, "mcc must be 3 digits").describe("Mobile Country Code"),
8752
+ mnc: z15.string().regex(/^\d{2,3}$/, "mnc must be 2 or 3 digits").describe("Mobile Network Code")
8684
8753
  };
8685
8754
  function jsonResult3(body2) {
8686
8755
  return {
@@ -8735,15 +8804,15 @@ function registerAtlasTools(server2, ctx) {
8735
8804
  }
8736
8805
 
8737
8806
  // src/tools-network-default.ts
8738
- import { z as z15 } from "zod";
8807
+ import { z as z16 } from "zod";
8739
8808
  var NETWORK_DEFAULT_TOOL_SCOPES = {
8740
8809
  get_network_default: "read",
8741
8810
  set_network_default: "write",
8742
8811
  plan_network_default: "read"
8743
8812
  };
8744
- var choiceShape = z15.object({
8745
- mode: z15.enum(NETWORK_DEFAULT_MODES),
8746
- steeringListId: z15.number().int().positive().optional()
8813
+ var choiceShape = z16.object({
8814
+ mode: z16.enum(NETWORK_DEFAULT_MODES),
8815
+ steeringListId: z16.number().int().positive().optional()
8747
8816
  }).describe("`cheapest_available`, `all`, or `custom` with a steeringListId from list_steering_lists");
8748
8817
  function ioFor(ctx, token2) {
8749
8818
  const kv = ctx.env.CARRIER_USERS;
@@ -8798,9 +8867,9 @@ function registerNetworkDefaultTools(server2, ctx) {
8798
8867
  title: "Set Network Default",
8799
8868
  description: "Use this to set the organisation's network default to `cheapest_available`, `all`, or `custom` (a steering list id from `list_steering_lists`, which must exist). This only stores the setting. It changes no SIM, writes nothing to OCS and does not migrate existing customers: it applies to NEW assignments. A single assignment can still override it with `plan_network_default`'s `simOverride`. Params: `mode` (required), `steeringListId` (required when mode is `custom`), `dry_run` (preview only). Do NOT use this to assign a list to one SIM \u2014 use `modify_subscriber_steering_list`.",
8800
8869
  inputSchema: {
8801
- mode: z15.enum(NETWORK_DEFAULT_MODES).describe("cheapest_available | all | custom"),
8802
- steeringListId: z15.number().int().positive().optional().describe("Required when mode is custom"),
8803
- dry_run: z15.boolean().optional().describe("If true, validate and return what would be stored; store nothing")
8870
+ mode: z16.enum(NETWORK_DEFAULT_MODES).describe("cheapest_available | all | custom"),
8871
+ steeringListId: z16.number().int().positive().optional().describe("Required when mode is custom"),
8872
+ dry_run: z16.boolean().optional().describe("If true, validate and return what would be stored; store nothing")
8804
8873
  },
8805
8874
  annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: false }
8806
8875
  },
@@ -8829,10 +8898,10 @@ function registerNetworkDefaultTools(server2, ctx) {
8829
8898
  title: "Plan Network Default",
8830
8899
  description: "Use this to see which networks a SIM would be given in one or more countries, before anything is assigned. By default that is the cheapest available network per country (lowest data rate above zero, among rules really in force). Precedence: `simOverride`, then `packageOverride`, then the org default, then `cheapest_available`. Read only: `applied` is always false. If the tariff is missing or cannot be compared it falls back to ALL networks and says so in `warnings` and `summary` (`fellBackToAll: true`); never present that as a cheapest choice. The price basis is the wholesale data rate per MB, not the end price. Creating a steering list has no OCS REST method, so when no existing list matches the result is `needs_list`, not a created list. Params: `countries` (ISO-3166 alpha-2 codes, required), `simOverride`, `packageOverride`, `resellerId` (optional).",
8831
8900
  inputSchema: {
8832
- countries: z15.array(z15.string().length(2)).min(1).describe('ISO-3166 alpha-2 codes, e.g. ["CA"]'),
8901
+ countries: z16.array(z16.string().length(2)).min(1).describe('ISO-3166 alpha-2 codes, e.g. ["CA"]'),
8833
8902
  simOverride: choiceShape.optional(),
8834
8903
  packageOverride: choiceShape.optional(),
8835
- resellerId: z15.number().int().positive().optional().describe("Omit to use the token owner's reseller")
8904
+ resellerId: z16.number().int().positive().optional().describe("Omit to use the token owner's reseller")
8836
8905
  },
8837
8906
  annotations: { readOnlyHint: true }
8838
8907
  },
@@ -8847,7 +8916,7 @@ function registerNetworkDefaultTools(server2, ctx) {
8847
8916
  }
8848
8917
 
8849
8918
  // src/affiliate-tools.ts
8850
- import { z as z16 } from "zod";
8919
+ import { z as z17 } from "zod";
8851
8920
  var AFFILIATE_TOOL_SCOPES = {
8852
8921
  affiliate_status: "read",
8853
8922
  affiliate_commissions: "read",
@@ -8918,7 +8987,7 @@ function registerAffiliateTools(server2, ctx) {
8918
8987
  title: "Affiliate Commissions",
8919
8988
  description: "Read-only: returns the list of commission records for the authenticated operator.",
8920
8989
  inputSchema: {
8921
- limit: z16.number().int().min(1).max(200).optional().default(50).describe("Maximum number of commission records to return (1-200, default: 50).")
8990
+ limit: z17.number().int().min(1).max(200).optional().default(50).describe("Maximum number of commission records to return (1-200, default: 50).")
8922
8991
  },
8923
8992
  annotations: annotationsFor("affiliate_commissions", "read")
8924
8993
  },
@@ -10408,6 +10477,7 @@ var ALL_TOOL_SCOPES = Object.freeze({
10408
10477
  ...UI_AGENT_SCHEDULE_TOOL_SCOPES,
10409
10478
  ...UI_AGENT_GENERIC_TOOL_SCOPES,
10410
10479
  ...WALLET_TOOL_SCOPES,
10480
+ ...AI_WALLET_TOOL_SCOPES,
10411
10481
  ...STRIPE_CONNECT_TOOL_SCOPES,
10412
10482
  ...GREENZONE_TOOL_SCOPES,
10413
10483
  ...CARRIER_ASK_TOOL_SCOPES,
@@ -11098,15 +11168,15 @@ function registerAllCarrierAskTools(server2, ctx) {
11098
11168
  title: "Natural Language Carrier Tool Router",
11099
11169
  description: "Use this when you want to perform a carrier operation but don't know which specific tool to call. Describe your intent in plain language and carrier_ask will identify the correct tool(s) and suggest the required parameters. For simple read intents, it executes directly and returns results. For destructive operations it returns a confirm_token that you must pass in a second call. Params: `intent` (string \u2014 natural language description of what you want to do), `context` (optional: iccid, account_id, reseller_id if already known). Returns: RouteResult \u2014 confirmed | pending_confirm | ambiguous | none. Do NOT use this when you know the right tool \u2014 direct calls are faster and cheaper.",
11100
11170
  inputSchema: {
11101
- intent: z17.string().min(3).describe(
11171
+ intent: z18.string().min(3).describe(
11102
11172
  "Natural-language description of the operation to perform (e.g. 'suspend ICCID 89316 until next month', 'show fleet health', 'assign Europe 5GB package to subscriber 89316...')"
11103
11173
  ),
11104
- context: z17.object({
11105
- iccid: z17.string().optional().describe("Subscriber ICCID if already known"),
11106
- account_id: z17.number().optional().describe("Account ID if already known"),
11107
- reseller_id: z17.number().optional().describe("Reseller ID if already known")
11174
+ context: z18.object({
11175
+ iccid: z18.string().optional().describe("Subscriber ICCID if already known"),
11176
+ account_id: z18.number().optional().describe("Account ID if already known"),
11177
+ reseller_id: z18.number().optional().describe("Reseller ID if already known")
11108
11178
  }).optional().describe("Optional pre-resolved context to improve routing accuracy"),
11109
- confirm_token: z17.string().optional().describe(
11179
+ confirm_token: z18.string().optional().describe(
11110
11180
  "One-time token from a previous carrier_ask call with confirm_required=true. Providing this executes the previously staged destructive operation."
11111
11181
  )
11112
11182
  }
@@ -11310,7 +11380,7 @@ function registerAllCarrierAskTools(server2, ctx) {
11310
11380
  title: "Describe a Carrier Tool",
11311
11381
  description: "Get full documentation for any registered Carrier MCP tool: description, parameters, 2-3 example invocations, required scope, destructive flag, and guidance. Params: `tool_name` (exact MCP tool name, e.g. 'assign_package'). Returns: structured tool metadata. Does NOT execute the tool.",
11312
11382
  inputSchema: {
11313
- tool_name: z17.string().describe("The exact MCP tool name to describe (e.g. 'assign_package', 'hlr_set_bitrate')")
11383
+ tool_name: z18.string().describe("The exact MCP tool name to describe (e.g. 'assign_package', 'hlr_set_bitrate')")
11314
11384
  }
11315
11385
  },
11316
11386
  wrapHandler(
@@ -11403,7 +11473,7 @@ function buildExamples(toolName) {
11403
11473
  }
11404
11474
 
11405
11475
  // src/list-recent-ocs-events.ts
11406
- import { z as z18 } from "zod";
11476
+ import { z as z19 } from "zod";
11407
11477
 
11408
11478
  // ../../packages/ocs-spec/src/ocs-event-buffer-read.ts
11409
11479
  var LIFECYCLE_RESELLER_ID2 = 1170;
@@ -11532,10 +11602,10 @@ var ALLOWED_EVENT_TYPES = [
11532
11602
  "usage.anomaly"
11533
11603
  ];
11534
11604
  var listRecentOcsEventsSchema = {
11535
- iccid: z18.string().regex(/^\d{19,20}$/).describe("ICCID, 19 or 20 digits, ITU-T E.118 format"),
11536
- limit: z18.number().int().min(1).max(50).default(20).describe("Max events to return, newest first"),
11537
- event_types: z18.array(z18.enum(ALLOWED_EVENT_TYPES)).optional().describe("Filter to specific event types"),
11538
- since: z18.string().datetime().optional().describe("ISO-8601 timestamp; only events after this point")
11605
+ iccid: z19.string().regex(/^\d{19,20}$/).describe("ICCID, 19 or 20 digits, ITU-T E.118 format"),
11606
+ limit: z19.number().int().min(1).max(50).default(20).describe("Max events to return, newest first"),
11607
+ event_types: z19.array(z19.enum(ALLOWED_EVENT_TYPES)).optional().describe("Filter to specific event types"),
11608
+ since: z19.string().datetime().optional().describe("ISO-8601 timestamp; only events after this point")
11539
11609
  };
11540
11610
  async function listRecentOcsEvents2(iccid, limit, eventTypes, since, kv) {
11541
11611
  return listRecentOcsEvents(iccid, limit, eventTypes, since, kv);
@@ -11598,7 +11668,7 @@ function registerListRecentOcsEventsTool(server2, ctx) {
11598
11668
  }
11599
11669
 
11600
11670
  // src/tools-rate-governor.ts
11601
- import { z as z19 } from "zod";
11671
+ import { z as z20 } from "zod";
11602
11672
  var MONITORED_ENDPOINTS = [
11603
11673
  "subscriberNetworkEventsOverPeriod",
11604
11674
  // 30/min
@@ -11630,7 +11700,7 @@ function registerRateLimitStatusTool(server2, ctx) {
11630
11700
  title: "API Rate-Limit Governor Status",
11631
11701
  description: "Inspect Bridge4IP OCS rate-limit governor state \u2014 bucket fill levels, per-endpoint limits, and 80% alert thresholds. Use this to answer: 'are we rate limited', 'check ocs quota', 'how full is the rate limit bucket', 'rate limit status'. Params: `endpoint` (optional \u2014 OCS camelCase method name to inspect a single bucket, e.g. 'subscriberUsageOverPeriod'; omit for all monitored endpoints). Returns: per-endpoint { limit_per_min, batch_cap_per_min, calls_in_window, batch_calls_in_window, utilisation_pct, alert (true when \u226580% of limit) }. Note: counts come from the in-process sliding-window log (same key as OCS calls: API token + endpoint) \u2014 they reset when the Worker isolate recycles. Use as a relative signal, not an exact counter. Do NOT use this to adjust limits \u2014 limits are set by Bridge4IP contract and cannot be changed via MCP.",
11632
11702
  inputSchema: {
11633
- endpoint: z19.string().optional().describe(
11703
+ endpoint: z20.string().optional().describe(
11634
11704
  "OCS method name in camelCase (e.g. 'subscriberUsageOverPeriod'). Omit to return status for all monitored endpoints."
11635
11705
  )
11636
11706
  },
@@ -11686,7 +11756,7 @@ function registerRateLimitStatusTool(server2, ctx) {
11686
11756
  }
11687
11757
 
11688
11758
  // src/tools-depletion-events.ts
11689
- import { z as z20 } from "zod";
11759
+ import { z as z21 } from "zod";
11690
11760
  function ok6(payload) {
11691
11761
  return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
11692
11762
  }
@@ -11714,10 +11784,10 @@ function registerDepletionEventsTool(server2, ctx) {
11714
11784
  title: "Subscriber Bundle Depletion Events",
11715
11785
  description: "Look up bundle depletion events for a subscriber (or list recent fleet-wide depletions). Returns the most recent bundle.depleted event stored when the prepaid usage webhook received a last_slice notification. Events are retained for 7 days. Use subscriberId to check a specific subscriber, or omit to list the 20 most recent fleet-wide depletions. Requires 'read' scope.",
11716
11786
  inputSchema: {
11717
- subscriberId: z20.string().optional().describe(
11787
+ subscriberId: z21.string().optional().describe(
11718
11788
  "OCS subscriber ID to look up. Omit to list the 20 most recent fleet-wide depletions."
11719
11789
  ),
11720
- since: z20.string().optional().describe(
11790
+ since: z21.string().optional().describe(
11721
11791
  "ISO-8601 timestamp \u2014 only return events at or after this time (for single-subscriber lookup)."
11722
11792
  )
11723
11793
  },
@@ -11832,7 +11902,7 @@ function registerDepletionEventsTool(server2, ctx) {
11832
11902
  }
11833
11903
 
11834
11904
  // src/tools-country-history.ts
11835
- import { z as z21 } from "zod";
11905
+ import { z as z22 } from "zod";
11836
11906
  function isoDate(now, daysAgo = 0) {
11837
11907
  const d = new Date(now.getTime() - daysAgo * 864e5);
11838
11908
  return d.toISOString().slice(0, 10);
@@ -11855,10 +11925,10 @@ function registerCountryHistoryTool(server2, ctx) {
11855
11925
  title: "Subscriber Country History",
11856
11926
  description: "Return cross-border movement history for a subscriber, reconstructed from OCS Gy charging events. Reads `gyAnswer.events` from `subscriberNetworkEventsOverPeriod` \u2014 every Gy record carries its own country, operator and MCC \u2014 and collapses consecutive same-country records into stays with first-seen and last-seen timestamps. This needs no webhook: it works with Relay LU and Relay Gy off. Relay `country.entered` events from the 24h ring-buffer are merged in as a supplement when present. Use this to answer: 'where has subscriber X traveled', 'show country history for ICCID', 'border crossings for this SIM'. Params: `subscriberId` (ICCID, 19\u201320 digits), `startDate`/`endDate` (YYYY-MM-DD, max 7 days apart, default the last 7 days), `limit` (1\u201350, default 20, newest first). Returns: `stays` ({ country, country_name, first_seen, last_seen, operators, mccs, event_count, used_bytes }), `transitions` ({ from, to, at }), and `country_events` in the legacy flat shape. `used_bytes` already handles the string-typed `usedUnits` and its 'N/A' values. Do NOT use this for raw per-session records \u2014 use `subscriber_network_events` for those.",
11857
11927
  inputSchema: {
11858
- subscriberId: z21.string().regex(/^\d{19,20}$/, "subscriberId must be a 19\u201320 digit ICCID").describe("Subscriber ICCID (19\u201320 digits, ITU-T E.118)"),
11859
- startDate: z21.string().regex(/^\d{4}-\d{2}-\d{2}$/, "startDate must be YYYY-MM-DD").optional().describe("Start of the period, YYYY-MM-DD inclusive (default: 7 days ago)"),
11860
- endDate: z21.string().regex(/^\d{4}-\d{2}-\d{2}$/, "endDate must be YYYY-MM-DD").optional().describe("End of the period, YYYY-MM-DD inclusive, max 7 days from start (default: today)"),
11861
- limit: z21.number().int().min(1).max(50).default(20).optional().describe("Maximum number of country_events to return, newest first (default 20, max 50)")
11928
+ subscriberId: z22.string().regex(/^\d{19,20}$/, "subscriberId must be a 19\u201320 digit ICCID").describe("Subscriber ICCID (19\u201320 digits, ITU-T E.118)"),
11929
+ startDate: z22.string().regex(/^\d{4}-\d{2}-\d{2}$/, "startDate must be YYYY-MM-DD").optional().describe("Start of the period, YYYY-MM-DD inclusive (default: 7 days ago)"),
11930
+ endDate: z22.string().regex(/^\d{4}-\d{2}-\d{2}$/, "endDate must be YYYY-MM-DD").optional().describe("End of the period, YYYY-MM-DD inclusive, max 7 days from start (default: today)"),
11931
+ limit: z22.number().int().min(1).max(50).default(20).optional().describe("Maximum number of country_events to return, newest first (default 20, max 50)")
11862
11932
  },
11863
11933
  annotations: { readOnlyHint: true, idempotentHint: true }
11864
11934
  },
@@ -11966,7 +12036,7 @@ function registerCountryHistoryTool(server2, ctx) {
11966
12036
  }
11967
12037
 
11968
12038
  // src/apps/fleet-health-app.ts
11969
- import { z as z22 } from "zod";
12039
+ import { z as z23 } from "zod";
11970
12040
  import {
11971
12041
  registerAppTool,
11972
12042
  registerAppResource,
@@ -12082,7 +12152,7 @@ function registerFleetHealthApp(server2, ctx) {
12082
12152
  title: "Fleet Health Dashboard",
12083
12153
  description: "Draw the fleet overview as an interactive panel: eSIM status, per-account breakdown and low-balance alerts. Returns structuredContent for the panel, so it only helps a client that can render MCP UI resources. Do NOT use this when the answer has to be readable text, or in any headless or scripted context \u2014 `fleet_health` returns the same data as prose.",
12084
12154
  inputSchema: {
12085
- accountId: z22.number().optional().describe("Filter to a specific account (omit for all)")
12155
+ accountId: z23.number().optional().describe("Filter to a specific account (omit for all)")
12086
12156
  },
12087
12157
  annotations: { readOnlyHint: true },
12088
12158
  _meta: {
@@ -12125,7 +12195,7 @@ function registerFleetHealthApp(server2, ctx) {
12125
12195
  }
12126
12196
 
12127
12197
  // src/apps/provisioning-wizard.ts
12128
- import { z as z23 } from "zod";
12198
+ import { z as z24 } from "zod";
12129
12199
  import {
12130
12200
  registerAppTool as registerAppTool2,
12131
12201
  registerAppResource as registerAppResource2,
@@ -12230,10 +12300,10 @@ function registerProvisioningWizard(server2, ctx) {
12230
12300
  title: "eSIM Provisioning Wizard",
12231
12301
  description: "Interactive 3-step wizard to provision an eSIM: select subscriber, choose package template, preview (dry_run) and confirm execution.",
12232
12302
  inputSchema: {
12233
- step: z23.enum(["init", "select-package", "preview", "confirm"]).describe("Current wizard step"),
12234
- wizardId: z23.string().optional().describe("Wizard session ID (absent on init)"),
12235
- subscriber_iccid: z23.string().optional().describe("Subscriber ICCID (required for select-package)"),
12236
- package_template_id: z23.number().optional().describe("Package template ID (required for preview)")
12303
+ step: z24.enum(["init", "select-package", "preview", "confirm"]).describe("Current wizard step"),
12304
+ wizardId: z24.string().optional().describe("Wizard session ID (absent on init)"),
12305
+ subscriber_iccid: z24.string().optional().describe("Subscriber ICCID (required for select-package)"),
12306
+ package_template_id: z24.number().optional().describe("Package template ID (required for preview)")
12237
12307
  },
12238
12308
  _meta: {
12239
12309
  ui: {
@@ -12503,7 +12573,7 @@ function registerProvisioningWizard(server2, ctx) {
12503
12573
  }
12504
12574
 
12505
12575
  // src/apps/balance-topup.ts
12506
- import { z as z24 } from "zod";
12576
+ import { z as z25 } from "zod";
12507
12577
  import {
12508
12578
  registerAppTool as registerAppTool3,
12509
12579
  registerAppResource as registerAppResource3,
@@ -12556,9 +12626,9 @@ function registerBalanceTopupApp(server2, ctx) {
12556
12626
  title: "Balance Top-up Form",
12557
12627
  description: "Adjust the OCS reseller-account balance behind one subscriber, through a form panel the user can review before it commits. Defaults to preview: a call that omits `preview` returns a projection and writes nothing. Only `preview: false` performs the OCS write. Params: `iccid` (subscriber identifier used to find the account), `delta` (amount to add when positive, deduct when negative), `preview` (boolean, default true). Requires `admin` scope plus recent MFA, and a client that can render UI panels. Do NOT use this in a headless or scripted context \u2014 call `modify_account_balance` directly, which takes an `accountId` and needs no panel. Do NOT use this for a subscriber's own balance \u2014 the `iccid` here only locates the account; per-subscriber money is `modify_subscriber_balance`. Do NOT use this for the Carrier prepaid wallet or MCP credits \u2014 see `wallet_topup_checkout` and `credit_balance`.",
12558
12628
  inputSchema: {
12559
- iccid: z24.string().describe("The subscriber ICCID for the account lookup"),
12560
- delta: z24.number().describe("Amount to add (positive) or deduct (negative) from the account balance"),
12561
- preview: z24.boolean().default(true).describe("If true, return preview without writing. If false, execute the balance change.")
12629
+ iccid: z25.string().describe("The subscriber ICCID for the account lookup"),
12630
+ delta: z25.number().describe("Amount to add (positive) or deduct (negative) from the account balance"),
12631
+ preview: z25.boolean().default(true).describe("If true, return preview without writing. If false, execute the balance change.")
12562
12632
  },
12563
12633
  annotations: { destructiveHint: true },
12564
12634
  _meta: {
@@ -12641,7 +12711,7 @@ function registerAllApps(server2, ctx) {
12641
12711
  }
12642
12712
 
12643
12713
  // src/prompts.ts
12644
- import { z as z25 } from "zod";
12714
+ import { z as z26 } from "zod";
12645
12715
  function registerAllPrompts(server2) {
12646
12716
  server2.registerPrompt(
12647
12717
  "fleet_health_report",
@@ -12677,7 +12747,7 @@ Format as a structured report with sections, tables, and actionable recommendati
12677
12747
  {
12678
12748
  title: "Subscriber Deep Dive",
12679
12749
  description: "Comprehensive analysis of a single subscriber: profile, packages, usage patterns, location history, recommendations.",
12680
- argsSchema: { iccid: z25.string().describe("The subscriber ICCID to analyse") }
12750
+ argsSchema: { iccid: z26.string().describe("The subscriber ICCID to analyse") }
12681
12751
  },
12682
12752
  async ({ iccid }) => ({
12683
12753
  messages: [
@@ -12776,7 +12846,7 @@ Analyze and present:
12776
12846
  {
12777
12847
  title: "Bulk Operations Planner",
12778
12848
  description: "Plan bulk operations safely: mass package assignments, account migrations, balance adjustments, or status changes.",
12779
- argsSchema: { operation: z25.string().describe("Describe the bulk operation you want to perform") }
12849
+ argsSchema: { operation: z26.string().describe("Describe the bulk operation you want to perform") }
12780
12850
  },
12781
12851
  async ({ operation }) => ({
12782
12852
  messages: [
@@ -12809,7 +12879,7 @@ NEVER execute destructive operations without confirmation.`
12809
12879
  }
12810
12880
 
12811
12881
  // src/tools-pricing.ts
12812
- import { z as z26 } from "zod";
12882
+ import { z as z27 } from "zod";
12813
12883
  function registerAllPricingTools(server2, ctx) {
12814
12884
  const allTools = [...PRICING_TOOLS, ...PROJECTS_TOOLS];
12815
12885
  for (const tool of allTools) {
@@ -12916,19 +12986,19 @@ function buildZodSchema(schema) {
12916
12986
  for (const [key, prop] of Object.entries(properties)) {
12917
12987
  let field;
12918
12988
  if (prop.enum) {
12919
- field = z26.enum(prop.enum);
12989
+ field = z27.enum(prop.enum);
12920
12990
  } else if (prop.type === "number") {
12921
- field = z26.number();
12991
+ field = z27.number();
12922
12992
  } else if (prop.type === "boolean") {
12923
- field = z26.boolean();
12993
+ field = z27.boolean();
12924
12994
  } else if (prop.type === "array") {
12925
12995
  if (prop.items?.type === "number") {
12926
- field = z26.array(z26.number());
12996
+ field = z27.array(z27.number());
12927
12997
  } else {
12928
- field = z26.array(z26.string());
12998
+ field = z27.array(z27.string());
12929
12999
  }
12930
13000
  } else {
12931
- field = z26.string();
13001
+ field = z27.string();
12932
13002
  }
12933
13003
  const required = schema.required ?? [];
12934
13004
  if (!required.includes(key)) {
@@ -12943,7 +13013,7 @@ function buildZodSchema(schema) {
12943
13013
  }
12944
13014
 
12945
13015
  // src/tools-greenzone.ts
12946
- import { z as z27 } from "zod";
13016
+ import { z as z28 } from "zod";
12947
13017
 
12948
13018
  // src/greenzone-whitelist.ts
12949
13019
  var STATE_KEY = "greenzone:state";
@@ -13234,9 +13304,9 @@ function registerGreenzoneTools(server2, ctx) {
13234
13304
  title: "Greenzone Whitelist \u2014 Add",
13235
13305
  description: "Add a hostname and/or IP address to the Bridge4IP Greenzone whitelist. The Greenzone whitelist controls which hosts/IPs are exempt from data charging after a subscriber's bundle is depleted. This operates via browser automation (Kapture) against the OCS portal \u2014 no REST API exists for this surface. Provide `host` (e.g. 'example.com') and/or `ip` (e.g. '203.0.113.0/24'). At least one of host or ip must be provided. Returns Kapture step sequence for Claude Code to execute. Requires 'write' scope and Kapture running in Sam's Chrome.",
13236
13306
  inputSchema: {
13237
- host: z27.string().optional().describe("Hostname to whitelist (e.g. 'example.com')"),
13238
- ip: z27.string().optional().describe("IP address or CIDR to whitelist (e.g. '203.0.113.0/24')"),
13239
- dry_run: z27.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
13307
+ host: z28.string().optional().describe("Hostname to whitelist (e.g. 'example.com')"),
13308
+ ip: z28.string().optional().describe("IP address or CIDR to whitelist (e.g. '203.0.113.0/24')"),
13309
+ dry_run: z28.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
13240
13310
  },
13241
13311
  annotations: { destructiveHint: true }
13242
13312
  },
@@ -13295,9 +13365,9 @@ function registerGreenzoneTools(server2, ctx) {
13295
13365
  title: "Greenzone Whitelist \u2014 Remove",
13296
13366
  description: "Remove a hostname and/or IP address from the Bridge4IP Greenzone whitelist. This operates via browser automation (Kapture) against the OCS portal. Provide `host` and/or `ip` to remove \u2014 at least one required. Returns Kapture step sequence for Claude Code to execute. Requires 'write' scope and Kapture running in Sam's Chrome.",
13297
13367
  inputSchema: {
13298
- host: z27.string().optional().describe("Hostname to remove from whitelist"),
13299
- ip: z27.string().optional().describe("IP address or CIDR to remove from whitelist"),
13300
- dry_run: z27.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
13368
+ host: z28.string().optional().describe("Hostname to remove from whitelist"),
13369
+ ip: z28.string().optional().describe("IP address or CIDR to remove from whitelist"),
13370
+ dry_run: z28.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
13301
13371
  },
13302
13372
  annotations: { destructiveHint: true }
13303
13373
  },
@@ -13356,7 +13426,7 @@ function registerGreenzoneTools(server2, ctx) {
13356
13426
  title: "Greenzone Whitelist \u2014 List",
13357
13427
  description: "List current Greenzone whitelist entries from the KV cache. Returns all whitelisted hosts and IPs, when the state was last synced, and whether the last hourly reconciliation detected drift from the portal. This is a fast read from KV \u2014 no browser automation required. Use `from_portal: true` to trigger a live portal read via Kapture instead of KV. Requires 'read' scope.",
13358
13428
  inputSchema: {
13359
- from_portal: z27.boolean().optional().describe(
13429
+ from_portal: z28.boolean().optional().describe(
13360
13430
  "When true, return Kapture steps to read live portal state instead of KV cache"
13361
13431
  )
13362
13432
  },
@@ -13408,7 +13478,7 @@ function registerGreenzoneTools(server2, ctx) {
13408
13478
  }
13409
13479
 
13410
13480
  // src/tools-ui-agent-generic.ts
13411
- import { z as z28 } from "zod";
13481
+ import { z as z29 } from "zod";
13412
13482
  var COST_PER_STEP_USD = 0.014;
13413
13483
  var SESSION_OVERHEAD_USD = 5e-3;
13414
13484
  function estimateCostUsd2(steps) {
@@ -13450,13 +13520,13 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
13450
13520
  title: "Dispatch Generic Browsing Agent",
13451
13521
  description: "Send a plain-language task to a hosted browsing agent, which drives a real browser on the open web \u2014 navigating pages, searching, extracting content, filling forms outside the OCS portal. Each run costs roughly $0.20-1.00 in model spend against your own BROWSER_USE_API_KEY, so treat it as the expensive last resort, not a lookup. Limited to CARRIER_BROWSER_USE_MAX_RUNS runs per CLI session (default 10). Params: `prompt` (1-4000 chars \u2014 name the target URL and the exact data or action), `max_steps` (1-30, default 15; prices the dry-run estimate only), `dry_run` (true returns only `estimated_cost_usd` and creates no session). Returns the finished result: unlike the hosted Worker, a local CLI has no background runtime, so this call blocks for the length of the run. Requires `write` scope. Do NOT use this to work out which Carrier tool answers a request \u2014 that is `carrier_ask`, which costs nothing. Do NOT use this for anything the OCS API already covers; every other tool here is faster, free, and audited.",
13452
13522
  inputSchema: {
13453
- prompt: z28.string().min(1).max(4e3).describe(
13523
+ prompt: z29.string().min(1).max(4e3).describe(
13454
13524
  "Natural-language task description for the browsing agent. Be specific: include target URLs, data to extract, or actions to perform."
13455
13525
  ),
13456
- max_steps: z28.number().int().min(1).max(30).optional().describe(
13526
+ max_steps: z29.number().int().min(1).max(30).optional().describe(
13457
13527
  "Advisory step budget (1\u201330, default 15). Prices the dry-run estimate; the hosted agent sets its own depth."
13458
13528
  ),
13459
- dry_run: z28.boolean().optional().describe(
13529
+ dry_run: z29.boolean().optional().describe(
13460
13530
  "Preview cost estimate without dispatching. Returns estimated_cost_usd only \u2014 no browser session is created."
13461
13531
  )
13462
13532
  }
@@ -13593,7 +13663,7 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
13593
13663
  title: "Poll Browsing Agent Task Status",
13594
13664
  description: "Returns the current state of a browsing-agent task by `task_id`, including its result once finished. In the local CLI, ui_agent_ask already returns the finished result, so this is mainly for re-reading a task within the same session. Task records do not survive the CLI process exiting. Requires `read` scope.",
13595
13665
  inputSchema: {
13596
- task_id: z28.string().describe("Task ID returned by ui_agent_ask")
13666
+ task_id: z29.string().describe("Task ID returned by ui_agent_ask")
13597
13667
  }
13598
13668
  },
13599
13669
  async (args) => {
@@ -13646,6 +13716,7 @@ if (!token && !process.env.CARRIER_API_TOKEN) {
13646
13716
  var stdioEnv = {
13647
13717
  CARRIER_API_TOKEN: process.env.CARRIER_API_TOKEN,
13648
13718
  CARRIER_AI_CREDITS_ENABLED: process.env.CARRIER_AI_CREDITS_ENABLED,
13719
+ CARRIER_AI_AUTO_TOPUP_ENABLED: process.env.CARRIER_AI_AUTO_TOPUP_ENABLED,
13649
13720
  AI_CREDIT_PRICING_JSON: process.env.AI_CREDIT_PRICING_JSON,
13650
13721
  CARRIER_API_BASE_URL: process.env.CARRIER_API_BASE_URL ?? "https://api.carrier.llc",
13651
13722
  CARRIER_OCS_BASE_URL: baseUrl,
@@ -13755,6 +13826,7 @@ registerStripeConnectTools(server, { env: stdioEnv, props });
13755
13826
  registerAffiliateTools(server, { env: stdioEnv, props });
13756
13827
  registerCarrierApiTools(server, toolCtx);
13757
13828
  registerWalletTools(server, { env: stdioEnv, props });
13829
+ registerAiWalletTools(server, { env: stdioEnv, props });
13758
13830
  registerGreenzoneTools(server, toolCtx);
13759
13831
  registerUiAgentGenericTools(server, toolCtx, uiAgentRuntime);
13760
13832
  registerStorefrontLogoTools(