@carrierllc/mcp 0.10.5 → 0.10.6
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/{chunk-IV65LEJY.js → chunk-DQHSDVIJ.js} +161 -16
- package/dist/chunk-DQHSDVIJ.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +75 -41
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-IV65LEJY.js.map +0 -1
|
@@ -1792,7 +1792,7 @@ function storefrontScreen(input) {
|
|
|
1792
1792
|
// package.json
|
|
1793
1793
|
var package_default = {
|
|
1794
1794
|
name: "@carrierllc/mcp",
|
|
1795
|
-
version: "0.10.
|
|
1795
|
+
version: "0.10.6",
|
|
1796
1796
|
description: "Carrier MCP \u2014 natural-language control of MVNO/eSIM fleets via eSIMVault 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).",
|
|
1797
1797
|
license: "MIT",
|
|
1798
1798
|
author: "Carrier (Lifecycle Innovations Limited)",
|
|
@@ -1844,7 +1844,7 @@ var package_default = {
|
|
|
1844
1844
|
"@types/node": "^26.1.2",
|
|
1845
1845
|
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
1846
1846
|
"@typescript-eslint/parser": "^8.67.0",
|
|
1847
|
-
eslint: "^9.
|
|
1847
|
+
eslint: "^10.9.1",
|
|
1848
1848
|
tsup: "^8.5.1",
|
|
1849
1849
|
typescript: "^5.9.3",
|
|
1850
1850
|
"@carrier/ai": "workspace:*",
|
|
@@ -1876,17 +1876,19 @@ var package_default = {
|
|
|
1876
1876
|
// src/version.ts
|
|
1877
1877
|
var CARRIER_VERSION = package_default.version;
|
|
1878
1878
|
|
|
1879
|
-
// ../../packages/ocs-client/dist/chunk-
|
|
1879
|
+
// ../../packages/ocs-client/dist/chunk-6C2DHWD4.js
|
|
1880
1880
|
import { z } from "zod";
|
|
1881
1881
|
var OCS_V1_METHODS = /* @__PURE__ */ new Set([
|
|
1882
1882
|
"getResellerInfo",
|
|
1883
1883
|
"listResellerAccount",
|
|
1884
1884
|
"listPrepaidPackageTemplate",
|
|
1885
|
+
"listSubscriberPrepaidPackages",
|
|
1885
1886
|
"listSubscriber",
|
|
1886
1887
|
"getSingleSubscriber",
|
|
1887
1888
|
"getSimProviderStatus",
|
|
1888
1889
|
"getSubscriberLocation",
|
|
1889
1890
|
"getSubscriberLocationByCellId",
|
|
1891
|
+
"esimStatusPerAccount",
|
|
1890
1892
|
"subscriberUsageOverPeriod",
|
|
1891
1893
|
"affectRecurringPackageToSubscriber",
|
|
1892
1894
|
"deleteSubscriberPackage",
|
|
@@ -1930,7 +1932,9 @@ var GetResellerInfoResponse = z.object({
|
|
|
1930
1932
|
name: z.string(),
|
|
1931
1933
|
parentId: z.number(),
|
|
1932
1934
|
parentName: z.string(),
|
|
1933
|
-
|
|
1935
|
+
// Production eSIMVault returns decimal money as a JSON string ("495.52").
|
|
1936
|
+
// Staging fixtures used a number, so accept both exact provider variants.
|
|
1937
|
+
balance: z.union([z.number(), z.string().regex(/^-?\d+(?:\.\d+)?$/)]),
|
|
1934
1938
|
cdrFolder: z.string().optional(),
|
|
1935
1939
|
trafficInfo: z.object({}).passthrough().optional(),
|
|
1936
1940
|
chargingInfo: z.object({}).passthrough().optional(),
|
|
@@ -2215,7 +2219,7 @@ async function runWithBudget(method, attempt, budget = ocsBudgetFor(method)) {
|
|
|
2215
2219
|
throw lastTimeout ?? new OcsTimeoutError(method, budget.attemptMs, budget.totalMs, Math.max(attempts, 1));
|
|
2216
2220
|
}
|
|
2217
2221
|
|
|
2218
|
-
// ../../packages/ocs-client/dist/chunk-
|
|
2222
|
+
// ../../packages/ocs-client/dist/chunk-CKDDVZ7A.js
|
|
2219
2223
|
var RATE_LIMIT = 10;
|
|
2220
2224
|
var WINDOW_MS = 1e3;
|
|
2221
2225
|
var windows = /* @__PURE__ */ new Map();
|
|
@@ -2296,7 +2300,7 @@ function resellerKeyHash(resellerKey) {
|
|
|
2296
2300
|
function emitMetric(endpoint, resellerKey, callsInWindow, limitPerMin) {
|
|
2297
2301
|
const pct2 = Math.round(callsInWindow / limitPerMin * 100);
|
|
2298
2302
|
const reseller_hash = resellerKeyHash(resellerKey);
|
|
2299
|
-
console.
|
|
2303
|
+
console.error(
|
|
2300
2304
|
JSON.stringify({
|
|
2301
2305
|
metric: "carrier_ocs_calls_per_min",
|
|
2302
2306
|
endpoint,
|
|
@@ -3071,15 +3075,19 @@ function extractSubscriberStatus(row) {
|
|
|
3071
3075
|
if (row === null || typeof row !== "object") return null;
|
|
3072
3076
|
const raw = row.status;
|
|
3073
3077
|
if (typeof raw === "string" && raw.length > 0) return raw;
|
|
3074
|
-
if (Array.isArray(raw))
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3078
|
+
if (!Array.isArray(raw)) return null;
|
|
3079
|
+
let fallback = null;
|
|
3080
|
+
for (const entry of raw) {
|
|
3081
|
+
if (!entry || typeof entry !== "object") continue;
|
|
3082
|
+
const rec = entry;
|
|
3083
|
+
const name = rec.status;
|
|
3084
|
+
if (typeof name !== "string" || name.length === 0) continue;
|
|
3085
|
+
const endDate = rec.endDate;
|
|
3086
|
+
const open = endDate === void 0 || endDate === null || endDate === "";
|
|
3087
|
+
if (open) return name;
|
|
3088
|
+
if (fallback === null) fallback = name;
|
|
3081
3089
|
}
|
|
3082
|
-
return
|
|
3090
|
+
return fallback;
|
|
3083
3091
|
}
|
|
3084
3092
|
function unwrapSubscriberList(raw) {
|
|
3085
3093
|
if (Array.isArray(raw)) return { rows: raw, envelope: null };
|
|
@@ -3173,7 +3181,7 @@ var OCS_LIST_KEYS = {
|
|
|
3173
3181
|
templates: ["template", "prepaidPackageTemplate"],
|
|
3174
3182
|
zones: ["listDetailedLocationZone", "locationZone", "zone", "zones"],
|
|
3175
3183
|
resellers: ["reseller"],
|
|
3176
|
-
packages: ["prepaidPackage", "package"]
|
|
3184
|
+
packages: ["prepaidPackage", "package", "packages"]
|
|
3177
3185
|
};
|
|
3178
3186
|
function ocsArray(data, keys) {
|
|
3179
3187
|
if (Array.isArray(data)) return data;
|
|
@@ -3357,6 +3365,132 @@ function subscriberRows(raw) {
|
|
|
3357
3365
|
const list = raw?.subscriberList;
|
|
3358
3366
|
return Array.isArray(list) ? list : [];
|
|
3359
3367
|
}
|
|
3368
|
+
function extractResellerBalance(raw) {
|
|
3369
|
+
const direct = raw;
|
|
3370
|
+
const enveloped = raw;
|
|
3371
|
+
const value = direct?.balance ?? enveloped?.getResellerInfo?.balance;
|
|
3372
|
+
if (value === void 0 || value === null || value === "") return null;
|
|
3373
|
+
const parsed = Number(value);
|
|
3374
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
3375
|
+
}
|
|
3376
|
+
var PREPAID_PACKAGE_KEYS = ["prepaidPackage", "packages", "package"];
|
|
3377
|
+
var NETWORK_EVENT_KEYS = [
|
|
3378
|
+
"s6aAnswer",
|
|
3379
|
+
"gyAnswer",
|
|
3380
|
+
"mapAnswer",
|
|
3381
|
+
"camelAnswer",
|
|
3382
|
+
"mocAnswer",
|
|
3383
|
+
"mtcAnswer"
|
|
3384
|
+
];
|
|
3385
|
+
function subscriberSimId(record) {
|
|
3386
|
+
if (!record || typeof record !== "object") return void 0;
|
|
3387
|
+
const rec = record;
|
|
3388
|
+
const sim = rec.sim;
|
|
3389
|
+
if (sim && typeof sim === "object") {
|
|
3390
|
+
const id = sim.id;
|
|
3391
|
+
if (typeof id === "number" && Number.isFinite(id)) return id;
|
|
3392
|
+
if (typeof id === "string" && id.trim() !== "" && Number.isFinite(Number(id))) return Number(id);
|
|
3393
|
+
}
|
|
3394
|
+
for (const key of ["simId", "sim_id"]) {
|
|
3395
|
+
const v = rec[key];
|
|
3396
|
+
if (typeof v === "number" && Number.isFinite(v)) return v;
|
|
3397
|
+
if (typeof v === "string" && v.trim() !== "" && Number.isFinite(Number(v))) return Number(v);
|
|
3398
|
+
}
|
|
3399
|
+
return void 0;
|
|
3400
|
+
}
|
|
3401
|
+
function prepaidPackageRows(data) {
|
|
3402
|
+
return ocsArray(data, PREPAID_PACKAGE_KEYS);
|
|
3403
|
+
}
|
|
3404
|
+
function isActivePackage(pkg) {
|
|
3405
|
+
if (typeof pkg.active === "boolean") return pkg.active;
|
|
3406
|
+
const status = pkg.status;
|
|
3407
|
+
if (typeof status === "string") return status.toUpperCase() === "ACTIVE";
|
|
3408
|
+
return false;
|
|
3409
|
+
}
|
|
3410
|
+
function firstNumber(pkg, keys) {
|
|
3411
|
+
for (const key of keys) {
|
|
3412
|
+
const v = pkg[key];
|
|
3413
|
+
if (typeof v === "number" && Number.isFinite(v)) return v;
|
|
3414
|
+
if (typeof v === "string" && v.trim() !== "" && Number.isFinite(Number(v))) return Number(v);
|
|
3415
|
+
}
|
|
3416
|
+
return 0;
|
|
3417
|
+
}
|
|
3418
|
+
function packageDataUsed(pkg) {
|
|
3419
|
+
return firstNumber(pkg, ["useddatabyte", "dataUsed", "dataConsumed"]);
|
|
3420
|
+
}
|
|
3421
|
+
function packageDataLimit(pkg) {
|
|
3422
|
+
return firstNumber(pkg, ["pckdatabyte", "dataLimit", "dataAllowance"]);
|
|
3423
|
+
}
|
|
3424
|
+
function packageExpiry(pkg) {
|
|
3425
|
+
for (const key of ["tsexpirationutc", "expirationDate", "endDate"]) {
|
|
3426
|
+
const v = pkg[key];
|
|
3427
|
+
if (typeof v === "string" && v.trim() !== "") return v;
|
|
3428
|
+
}
|
|
3429
|
+
return "";
|
|
3430
|
+
}
|
|
3431
|
+
function packageName(pkg) {
|
|
3432
|
+
if (typeof pkg.name === "string" && pkg.name !== "") return pkg.name;
|
|
3433
|
+
const tpl = pkg.packageTemplate;
|
|
3434
|
+
if (tpl && typeof tpl === "object") {
|
|
3435
|
+
const tplName = tpl.prepaidpackagetemplatename;
|
|
3436
|
+
if (typeof tplName === "string" && tplName !== "") return tplName;
|
|
3437
|
+
}
|
|
3438
|
+
for (const key of ["templateId", "packageTemplateId", "subscriberprepaidpackageid"]) {
|
|
3439
|
+
const v = pkg[key];
|
|
3440
|
+
if (v !== void 0 && v !== null) return String(v);
|
|
3441
|
+
}
|
|
3442
|
+
return "unknown";
|
|
3443
|
+
}
|
|
3444
|
+
function networkEventRows(data) {
|
|
3445
|
+
if (Array.isArray(data)) return data;
|
|
3446
|
+
if (!data || typeof data !== "object") return [];
|
|
3447
|
+
const obj = data;
|
|
3448
|
+
const rows = [];
|
|
3449
|
+
for (const key of NETWORK_EVENT_KEYS) {
|
|
3450
|
+
for (const entry of ocsArray(obj[key], [])) {
|
|
3451
|
+
if (Array.isArray(entry)) {
|
|
3452
|
+
for (const inner of entry) {
|
|
3453
|
+
if (inner && typeof inner === "object") rows.push(inner);
|
|
3454
|
+
}
|
|
3455
|
+
} else if (entry && typeof entry === "object") {
|
|
3456
|
+
rows.push(entry);
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
return rows;
|
|
3461
|
+
}
|
|
3462
|
+
function eventTime(row) {
|
|
3463
|
+
for (const key of ["eventTime", "timestamp", "date"]) {
|
|
3464
|
+
const v = row[key];
|
|
3465
|
+
if (typeof v === "string" && v !== "") return v;
|
|
3466
|
+
}
|
|
3467
|
+
return "";
|
|
3468
|
+
}
|
|
3469
|
+
function summarizeNetworkEvents(rows) {
|
|
3470
|
+
const operators = /* @__PURE__ */ new Set();
|
|
3471
|
+
let creditLimitReached = 0;
|
|
3472
|
+
let roamingNotAllowed = 0;
|
|
3473
|
+
let mapTimeouts = 0;
|
|
3474
|
+
let lastEventTime = "";
|
|
3475
|
+
for (const row of rows) {
|
|
3476
|
+
const operator = row.operator;
|
|
3477
|
+
if (typeof operator === "string" && operator !== "" && operator !== "N/A") operators.add(operator);
|
|
3478
|
+
const rre = row.rreResponse;
|
|
3479
|
+
if (typeof rre === "string" && rre.includes("CreditLimitReached")) creditLimitReached++;
|
|
3480
|
+
if (String(row.code ?? "") === "5004") roamingNotAllowed++;
|
|
3481
|
+
if (row.protocol === "MAP" && String(row.result ?? "").toLowerCase().includes("timeout")) mapTimeouts++;
|
|
3482
|
+
const t = eventTime(row);
|
|
3483
|
+
if (t > lastEventTime) lastEventTime = t;
|
|
3484
|
+
}
|
|
3485
|
+
return {
|
|
3486
|
+
total: rows.length,
|
|
3487
|
+
creditLimitReached,
|
|
3488
|
+
roamingNotAllowed,
|
|
3489
|
+
mapTimeouts,
|
|
3490
|
+
operators: [...operators].sort(),
|
|
3491
|
+
lastEventTime
|
|
3492
|
+
};
|
|
3493
|
+
}
|
|
3360
3494
|
|
|
3361
3495
|
// src/lib/storefront-logo.ts
|
|
3362
3496
|
var OPENAI_KEY_NAMES = [
|
|
@@ -3502,6 +3636,7 @@ export {
|
|
|
3502
3636
|
normalizePackageTemplate,
|
|
3503
3637
|
normalizePackageTemplateChanges,
|
|
3504
3638
|
buildListSubscriberParams,
|
|
3639
|
+
extractSubscriberStatus,
|
|
3505
3640
|
applySubscriberFilters,
|
|
3506
3641
|
recordToolDescription,
|
|
3507
3642
|
buildRouterCatalog,
|
|
@@ -3512,6 +3647,16 @@ export {
|
|
|
3512
3647
|
formatBytes,
|
|
3513
3648
|
filterActiveSubscribers,
|
|
3514
3649
|
subscriberRows,
|
|
3650
|
+
extractResellerBalance,
|
|
3651
|
+
subscriberSimId,
|
|
3652
|
+
prepaidPackageRows,
|
|
3653
|
+
isActivePackage,
|
|
3654
|
+
packageDataUsed,
|
|
3655
|
+
packageDataLimit,
|
|
3656
|
+
packageExpiry,
|
|
3657
|
+
packageName,
|
|
3658
|
+
networkEventRows,
|
|
3659
|
+
summarizeNetworkEvents,
|
|
3515
3660
|
generateStorefrontLogo,
|
|
3516
3661
|
run,
|
|
3517
3662
|
which,
|
|
@@ -3550,4 +3695,4 @@ export {
|
|
|
3550
3695
|
storefrontScreen,
|
|
3551
3696
|
CARRIER_VERSION
|
|
3552
3697
|
};
|
|
3553
|
-
//# sourceMappingURL=chunk-
|
|
3698
|
+
//# sourceMappingURL=chunk-DQHSDVIJ.js.map
|