@carrierllc/mcp 0.13.81 → 0.13.83
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-
|
|
94
|
+
} from "./chunk-MIGP6YJH.js";
|
|
95
95
|
import "./chunk-SHKKVIIA.js";
|
|
96
96
|
|
|
97
97
|
// src/index.ts
|
|
@@ -1469,22 +1469,22 @@ function boundZonesResult(raw, opts = {}) {
|
|
|
1469
1469
|
const { verbose = false, resellerId } = opts;
|
|
1470
1470
|
const maxZones = opts.maxZones ?? ZONES_MAX_ZONES;
|
|
1471
1471
|
const maxOperators = opts.maxOperators ?? (verbose ? ZONES_VERBOSE_MAX_OPERATORS : ZONES_MAX_OPERATORS);
|
|
1472
|
-
const totalOperators = all.reduce((n,
|
|
1472
|
+
const totalOperators = all.reduce((n, z31) => n + (z31.operators?.length ?? 0), 0);
|
|
1473
1473
|
const keptZones = all.slice(0, maxZones);
|
|
1474
1474
|
let budget = maxOperators;
|
|
1475
1475
|
let returnedOperators = 0;
|
|
1476
|
-
const zones = keptZones.map((
|
|
1477
|
-
const ops =
|
|
1476
|
+
const zones = keptZones.map((z31) => {
|
|
1477
|
+
const ops = z31.operators ?? [];
|
|
1478
1478
|
const take = Math.max(0, Math.min(ops.length, budget));
|
|
1479
1479
|
budget -= take;
|
|
1480
1480
|
returnedOperators += take;
|
|
1481
1481
|
const sliced = ops.slice(0, take);
|
|
1482
1482
|
if (verbose) {
|
|
1483
|
-
return { ...
|
|
1483
|
+
return { ...z31, operators: sliced, operatorCount: ops.length };
|
|
1484
1484
|
}
|
|
1485
1485
|
return {
|
|
1486
|
-
zoneId:
|
|
1487
|
-
zoneName:
|
|
1486
|
+
zoneId: z31.zoneId,
|
|
1487
|
+
zoneName: z31.zoneName,
|
|
1488
1488
|
operatorCount: ops.length,
|
|
1489
1489
|
operators: sliced.map((o) => ({
|
|
1490
1490
|
net: o.networkId,
|
|
@@ -5550,7 +5550,7 @@ function registerAllBacklogTools(server2, ctx) {
|
|
|
5550
5550
|
}
|
|
5551
5551
|
|
|
5552
5552
|
// src/tools-carrier-ask.ts
|
|
5553
|
-
import { z as
|
|
5553
|
+
import { z as z19 } from "zod";
|
|
5554
5554
|
|
|
5555
5555
|
// src/tools-ui-agent.ts
|
|
5556
5556
|
import { z as z5 } from "zod";
|
|
@@ -8864,9 +8864,220 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
|
|
|
8864
8864
|
);
|
|
8865
8865
|
}
|
|
8866
8866
|
|
|
8867
|
-
// src/tools-
|
|
8867
|
+
// src/tools-storefront-management.ts
|
|
8868
8868
|
import { z as z15 } from "zod";
|
|
8869
8869
|
|
|
8870
|
+
// ../../packages/sdk/src/storefront-operations.ts
|
|
8871
|
+
var STOREFRONT_OPERATIONS = {
|
|
8872
|
+
list_storefronts: ["GET", "", "read"],
|
|
8873
|
+
get_storefront: ["GET", "/{storefront_id}", "read"],
|
|
8874
|
+
create_storefront: ["POST", "", "write"],
|
|
8875
|
+
update_storefront: ["PATCH", "/{storefront_id}", "write"],
|
|
8876
|
+
upsert_storefront_plan: ["POST", "/{storefront_id}/plans", "write"],
|
|
8877
|
+
update_storefront_plan: ["PATCH", "/{storefront_id}/plans/{slug}", "write"],
|
|
8878
|
+
list_storefront_orders: ["GET", "/orders", "read"],
|
|
8879
|
+
plan_storefront_publish: ["POST", "/{storefront_id}/publish-plan", "read"],
|
|
8880
|
+
publish_storefront: ["POST", "/{storefront_id}/publish", "write"],
|
|
8881
|
+
unpublish_storefront: ["POST", "/{storefront_id}/unpublish", "write"],
|
|
8882
|
+
verify_storefront: ["GET", "/{storefront_id}/readiness", "read"],
|
|
8883
|
+
list_storefront_domains: ["GET", "/{storefront_id}/domains", "read"],
|
|
8884
|
+
plan_storefront_domain: ["POST", "/{storefront_id}/domains/plan", "read"],
|
|
8885
|
+
attach_storefront_domain: ["POST", "/{storefront_id}/domains", "write"],
|
|
8886
|
+
verify_storefront_domain: ["POST", "/{storefront_id}/domains/{hostname}/verify", "write"],
|
|
8887
|
+
detach_storefront_domain: ["DELETE", "/{storefront_id}/domains/{hostname}", "write"],
|
|
8888
|
+
plan_storefront_dns: ["POST", "/{storefront_id}/domains/{hostname}/dns-plan", "read"]
|
|
8889
|
+
};
|
|
8890
|
+
var IDEMPOTENCY_REQUIRED = [
|
|
8891
|
+
"create_storefront",
|
|
8892
|
+
"publish_storefront",
|
|
8893
|
+
"attach_storefront_domain"
|
|
8894
|
+
];
|
|
8895
|
+
var MAX_METADATA_LENGTH = 200;
|
|
8896
|
+
var CONTROL_CHARACTERS = /[\u0000-\u001f\u007f]/;
|
|
8897
|
+
function metadataValue(name, value) {
|
|
8898
|
+
if (value === void 0) return void 0;
|
|
8899
|
+
if (typeof value !== "string" || !value.trim() || value.length > MAX_METADATA_LENGTH) {
|
|
8900
|
+
throw new Error(`${name} must be a non-empty string of at most ${MAX_METADATA_LENGTH} characters`);
|
|
8901
|
+
}
|
|
8902
|
+
if (CONTROL_CHARACTERS.test(value)) throw new Error(`${name} must not contain control characters`);
|
|
8903
|
+
return value;
|
|
8904
|
+
}
|
|
8905
|
+
function storefrontRequest(operation, input) {
|
|
8906
|
+
if (!Object.hasOwn(STOREFRONT_OPERATIONS, operation)) {
|
|
8907
|
+
throw new Error(`Unknown storefront operation: ${String(operation)}`);
|
|
8908
|
+
}
|
|
8909
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) {
|
|
8910
|
+
throw new Error("input must be an object");
|
|
8911
|
+
}
|
|
8912
|
+
const [method, suffix] = STOREFRONT_OPERATIONS[operation];
|
|
8913
|
+
const rest = { ...input };
|
|
8914
|
+
if (IDEMPOTENCY_REQUIRED.includes(operation) && (typeof rest.idempotency_key !== "string" || !rest.idempotency_key.trim())) {
|
|
8915
|
+
throw new Error("idempotency_key_required");
|
|
8916
|
+
}
|
|
8917
|
+
const path = `/v1/storefronts${suffix.replace(/\{(\w+)\}/g, (_match, key) => {
|
|
8918
|
+
const value = rest[key];
|
|
8919
|
+
if (typeof value !== "string" || value.length === 0) throw new Error(`${key} is required`);
|
|
8920
|
+
if (value === "." || value === "..") throw new Error(`${key} must not be a dot segment`);
|
|
8921
|
+
delete rest[key];
|
|
8922
|
+
return encodeURIComponent(value);
|
|
8923
|
+
})}`;
|
|
8924
|
+
const idempotencyKey = metadataValue("idempotency_key", rest.idempotency_key);
|
|
8925
|
+
const confirmToken = metadataValue("confirm_token", rest.confirm_token);
|
|
8926
|
+
delete rest.idempotency_key;
|
|
8927
|
+
delete rest.confirm_token;
|
|
8928
|
+
if (method === "GET") {
|
|
8929
|
+
if (confirmToken !== void 0 || idempotencyKey !== void 0) {
|
|
8930
|
+
throw new Error("Read requests do not accept mutation metadata");
|
|
8931
|
+
}
|
|
8932
|
+
const params = new URLSearchParams();
|
|
8933
|
+
for (const key of Object.keys(rest).sort()) {
|
|
8934
|
+
const value = rest[key];
|
|
8935
|
+
if (value === void 0 || value === null) continue;
|
|
8936
|
+
const valid = typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
|
|
8937
|
+
if (!valid) throw new Error(`${key} must be a scalar query value`);
|
|
8938
|
+
params.set(key, String(value));
|
|
8939
|
+
}
|
|
8940
|
+
const query = params.toString();
|
|
8941
|
+
return { method, path: query ? `${path}?${query}` : path };
|
|
8942
|
+
}
|
|
8943
|
+
if (method === "DELETE" && Object.values(rest).some((value) => value !== void 0)) {
|
|
8944
|
+
throw new Error("DELETE does not accept content fields");
|
|
8945
|
+
}
|
|
8946
|
+
return {
|
|
8947
|
+
method,
|
|
8948
|
+
path,
|
|
8949
|
+
...method !== "DELETE" ? { body: rest } : {},
|
|
8950
|
+
...idempotencyKey !== void 0 ? { idempotencyKey } : {},
|
|
8951
|
+
...confirmToken !== void 0 ? { confirmToken } : {}
|
|
8952
|
+
};
|
|
8953
|
+
}
|
|
8954
|
+
|
|
8955
|
+
// src/tools-storefront-management.ts
|
|
8956
|
+
var OPERATIONS = Object.keys(STOREFRONT_OPERATIONS);
|
|
8957
|
+
var OPERATOR_OPERATIONS = OPERATIONS.filter((operation) => !operation.startsWith("publish_"));
|
|
8958
|
+
var STOREFRONT_MANAGEMENT_TOOL_SCOPES = Object.fromEntries(
|
|
8959
|
+
OPERATOR_OPERATIONS.map((operation) => [operation, STOREFRONT_OPERATIONS[operation][2]])
|
|
8960
|
+
);
|
|
8961
|
+
var IDEMPOTENCY_REQUIRED2 = /* @__PURE__ */ new Set([
|
|
8962
|
+
"create_storefront",
|
|
8963
|
+
"attach_storefront_domain"
|
|
8964
|
+
]);
|
|
8965
|
+
var FORBIDDEN_FIELDS = /* @__PURE__ */ new Set([
|
|
8966
|
+
"org_id",
|
|
8967
|
+
"orgId",
|
|
8968
|
+
"sub",
|
|
8969
|
+
"scope",
|
|
8970
|
+
"scopes",
|
|
8971
|
+
"token",
|
|
8972
|
+
"api_key",
|
|
8973
|
+
"provider_token",
|
|
8974
|
+
"url",
|
|
8975
|
+
"repo_url",
|
|
8976
|
+
"callback_url",
|
|
8977
|
+
"command",
|
|
8978
|
+
"directory",
|
|
8979
|
+
"working_directory",
|
|
8980
|
+
"cwd"
|
|
8981
|
+
]);
|
|
8982
|
+
var ORDER_STATUSES = ["pending", "provisioning", "ready", "failed"];
|
|
8983
|
+
var HOSTNAME_IN_BODY = /* @__PURE__ */ new Set(["plan_storefront_domain", "attach_storefront_domain"]);
|
|
8984
|
+
function pathFields(operation) {
|
|
8985
|
+
return [...STOREFRONT_OPERATIONS[operation][1].matchAll(/\{(\w+)\}/g)].map((match) => match[1]);
|
|
8986
|
+
}
|
|
8987
|
+
function topLevelShape(operation) {
|
|
8988
|
+
const [method] = STOREFRONT_OPERATIONS[operation];
|
|
8989
|
+
const shape = {};
|
|
8990
|
+
for (const field of pathFields(operation)) shape[field] = z15.string().min(1).max(253);
|
|
8991
|
+
if (HOSTNAME_IN_BODY.has(operation)) shape.hostname = z15.string().min(1).max(253);
|
|
8992
|
+
if (operation === "list_storefront_orders") {
|
|
8993
|
+
shape.storefront_id = z15.string().min(1).max(253).optional();
|
|
8994
|
+
shape.status = z15.enum(ORDER_STATUSES).optional();
|
|
8995
|
+
shape.limit = z15.number().int().min(1).max(200).optional();
|
|
8996
|
+
}
|
|
8997
|
+
if (method !== "GET") shape.input = z15.record(z15.string(), z15.unknown()).optional();
|
|
8998
|
+
if (method !== "GET") shape.confirm_token = z15.string().min(1).max(200).optional();
|
|
8999
|
+
if (method === "POST" || method === "PATCH") {
|
|
9000
|
+
shape.idempotency_key = IDEMPOTENCY_REQUIRED2.has(operation) ? z15.string().trim().min(1).max(200) : z15.string().trim().min(1).max(200).optional();
|
|
9001
|
+
}
|
|
9002
|
+
return shape;
|
|
9003
|
+
}
|
|
9004
|
+
var SAFETY_HINTS = {
|
|
9005
|
+
create_storefront: { idempotentHint: true },
|
|
9006
|
+
update_storefront: { idempotentHint: true },
|
|
9007
|
+
upsert_storefront_plan: { idempotentHint: true },
|
|
9008
|
+
update_storefront_plan: { idempotentHint: true },
|
|
9009
|
+
unpublish_storefront: { idempotentHint: true, destructiveHint: true },
|
|
9010
|
+
attach_storefront_domain: { idempotentHint: true },
|
|
9011
|
+
detach_storefront_domain: { idempotentHint: true, destructiveHint: true }
|
|
9012
|
+
};
|
|
9013
|
+
function isConfirmationChallenge(result3) {
|
|
9014
|
+
if (result3.status !== 202 || !isPlainObject(result3.body)) return false;
|
|
9015
|
+
return typeof result3.body.confirm_token === "string" || result3.body.error === "confirmation_required";
|
|
9016
|
+
}
|
|
9017
|
+
function failure(body2) {
|
|
9018
|
+
return { isError: true, content: [{ type: "text", text: JSON.stringify(body2) }] };
|
|
9019
|
+
}
|
|
9020
|
+
function isPlainObject(value) {
|
|
9021
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9022
|
+
}
|
|
9023
|
+
function registerStorefrontManagementTools(server2, props2, call, transportMode = "hosted", options) {
|
|
9024
|
+
for (const operation of OPERATOR_OPERATIONS) {
|
|
9025
|
+
if (options?.exclude?.has(operation)) continue;
|
|
9026
|
+
const shape = topLevelShape(operation);
|
|
9027
|
+
const allowed = new Set(Object.keys(shape));
|
|
9028
|
+
server2.registerTool(
|
|
9029
|
+
operation,
|
|
9030
|
+
{
|
|
9031
|
+
title: operation.replaceAll("_", " "),
|
|
9032
|
+
description: `Call the caller's storefront operation: ${STOREFRONT_OPERATIONS[operation][0]} /v1/storefronts${STOREFRONT_OPERATIONS[operation][1]}. Use input for the full JSON body. Caller identity comes from the session. A pending or queued response is not a finished deployment, and a 202 confirmation challenge applied nothing.`,
|
|
9033
|
+
inputSchema: z15.strictObject(shape),
|
|
9034
|
+
annotations: annotationsFor(operation, STOREFRONT_OPERATIONS[operation][2], SAFETY_HINTS[operation] ?? {})
|
|
9035
|
+
},
|
|
9036
|
+
async (args, extra) => {
|
|
9037
|
+
const denied = denyUnlessScoped(props2, operation, STOREFRONT_MANAGEMENT_TOOL_SCOPES);
|
|
9038
|
+
if (denied) return denied;
|
|
9039
|
+
if (transportMode === "hosted" && !props2.org_id?.trim()) return failure({ error: "org_required" });
|
|
9040
|
+
const { input, ...top } = args;
|
|
9041
|
+
for (const field of Object.keys(top)) {
|
|
9042
|
+
if (FORBIDDEN_FIELDS.has(field) || !allowed.has(field)) return failure({ error: "forbidden_input", field });
|
|
9043
|
+
}
|
|
9044
|
+
if (input !== void 0 && !isPlainObject(input)) return failure({ error: "invalid_input" });
|
|
9045
|
+
const content = input ?? {};
|
|
9046
|
+
if (Object.hasOwn(content, "confirm_token") || Object.hasOwn(content, "idempotency_key")) {
|
|
9047
|
+
return failure({ error: "metadata_must_be_top_level" });
|
|
9048
|
+
}
|
|
9049
|
+
for (const field of Object.keys(content)) {
|
|
9050
|
+
if (FORBIDDEN_FIELDS.has(field)) return failure({ error: "forbidden_input", field });
|
|
9051
|
+
}
|
|
9052
|
+
for (const [field, value] of Object.entries(top)) {
|
|
9053
|
+
if (value === void 0) continue;
|
|
9054
|
+
if (Object.hasOwn(content, field)) return failure({ error: "duplicate_input", field });
|
|
9055
|
+
}
|
|
9056
|
+
let request;
|
|
9057
|
+
try {
|
|
9058
|
+
request = storefrontRequest(operation, { ...content, ...top });
|
|
9059
|
+
} catch (error) {
|
|
9060
|
+
return failure({ error: error instanceof Error ? error.message : "invalid_request" });
|
|
9061
|
+
}
|
|
9062
|
+
let result3;
|
|
9063
|
+
try {
|
|
9064
|
+
result3 = await call(request, extra);
|
|
9065
|
+
} catch {
|
|
9066
|
+
return failure({ error: "storefront_call_failed" });
|
|
9067
|
+
}
|
|
9068
|
+
const succeeded = result3.ok && result3.status >= 200 && result3.status < 300 && !isConfirmationChallenge(result3);
|
|
9069
|
+
return {
|
|
9070
|
+
content: [{ type: "text", text: JSON.stringify({ status: result3.status, body: result3.body }) }],
|
|
9071
|
+
...succeeded ? {} : { isError: true }
|
|
9072
|
+
};
|
|
9073
|
+
}
|
|
9074
|
+
);
|
|
9075
|
+
}
|
|
9076
|
+
}
|
|
9077
|
+
|
|
9078
|
+
// src/tools-atlas.ts
|
|
9079
|
+
import { z as z16 } from "zod";
|
|
9080
|
+
|
|
8870
9081
|
// src/atlas-public.ts
|
|
8871
9082
|
var ATLAS_PUBLIC_BASE_URL = "https://atlas.carrier.llc";
|
|
8872
9083
|
function atlasBaseUrl(env) {
|
|
@@ -8923,13 +9134,13 @@ var ATLAS_TOOL_SCOPES = {
|
|
|
8923
9134
|
get_atlas_network_status: "read"
|
|
8924
9135
|
};
|
|
8925
9136
|
var coverageSchema = {
|
|
8926
|
-
country:
|
|
8927
|
-
status:
|
|
8928
|
-
technology:
|
|
9137
|
+
country: z16.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"),
|
|
9138
|
+
status: z16.enum(["up", "degraded", "down", "unknown"]).optional().describe("Keep only networks whose latest probe has this status"),
|
|
9139
|
+
technology: z16.enum(["2G", "3G", "4G", "5G"]).optional().describe("Keep only networks of this radio generation")
|
|
8929
9140
|
};
|
|
8930
9141
|
var networkSchema = {
|
|
8931
|
-
mcc:
|
|
8932
|
-
mnc:
|
|
9142
|
+
mcc: z16.string().regex(/^\d{3}$/, "mcc must be 3 digits").describe("Mobile Country Code"),
|
|
9143
|
+
mnc: z16.string().regex(/^\d{2,3}$/, "mnc must be 2 or 3 digits").describe("Mobile Network Code")
|
|
8933
9144
|
};
|
|
8934
9145
|
function jsonResult3(body2) {
|
|
8935
9146
|
return {
|
|
@@ -8984,15 +9195,15 @@ function registerAtlasTools(server2, ctx) {
|
|
|
8984
9195
|
}
|
|
8985
9196
|
|
|
8986
9197
|
// src/tools-network-default.ts
|
|
8987
|
-
import { z as
|
|
9198
|
+
import { z as z17 } from "zod";
|
|
8988
9199
|
var NETWORK_DEFAULT_TOOL_SCOPES = {
|
|
8989
9200
|
get_network_default: "read",
|
|
8990
9201
|
set_network_default: "write",
|
|
8991
9202
|
plan_network_default: "read"
|
|
8992
9203
|
};
|
|
8993
|
-
var choiceShape =
|
|
8994
|
-
mode:
|
|
8995
|
-
steeringListId:
|
|
9204
|
+
var choiceShape = z17.object({
|
|
9205
|
+
mode: z17.enum(NETWORK_DEFAULT_MODES),
|
|
9206
|
+
steeringListId: z17.number().int().positive().optional()
|
|
8996
9207
|
}).describe("`cheapest_available`, `all`, or `custom` with a steeringListId from list_steering_lists");
|
|
8997
9208
|
function ioFor(ctx, token2) {
|
|
8998
9209
|
const kv = ctx.env.CARRIER_USERS;
|
|
@@ -9047,9 +9258,9 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
9047
9258
|
title: "Set Network Default",
|
|
9048
9259
|
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`.",
|
|
9049
9260
|
inputSchema: {
|
|
9050
|
-
mode:
|
|
9051
|
-
steeringListId:
|
|
9052
|
-
dry_run:
|
|
9261
|
+
mode: z17.enum(NETWORK_DEFAULT_MODES).describe("cheapest_available | all | custom"),
|
|
9262
|
+
steeringListId: z17.number().int().positive().optional().describe("Required when mode is custom"),
|
|
9263
|
+
dry_run: z17.boolean().optional().describe("If true, validate and return what would be stored; store nothing")
|
|
9053
9264
|
},
|
|
9054
9265
|
annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: false }
|
|
9055
9266
|
},
|
|
@@ -9078,10 +9289,10 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
9078
9289
|
title: "Plan Network Default",
|
|
9079
9290
|
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).",
|
|
9080
9291
|
inputSchema: {
|
|
9081
|
-
countries:
|
|
9292
|
+
countries: z17.array(z17.string().length(2)).min(1).describe('ISO-3166 alpha-2 codes, e.g. ["CA"]'),
|
|
9082
9293
|
simOverride: choiceShape.optional(),
|
|
9083
9294
|
packageOverride: choiceShape.optional(),
|
|
9084
|
-
resellerId:
|
|
9295
|
+
resellerId: z17.number().int().positive().optional().describe("Omit to use the token owner's reseller")
|
|
9085
9296
|
},
|
|
9086
9297
|
annotations: { readOnlyHint: true }
|
|
9087
9298
|
},
|
|
@@ -9096,7 +9307,7 @@ function registerNetworkDefaultTools(server2, ctx) {
|
|
|
9096
9307
|
}
|
|
9097
9308
|
|
|
9098
9309
|
// src/affiliate-tools.ts
|
|
9099
|
-
import { z as
|
|
9310
|
+
import { z as z18 } from "zod";
|
|
9100
9311
|
var AFFILIATE_TOOL_SCOPES = {
|
|
9101
9312
|
affiliate_status: "read",
|
|
9102
9313
|
affiliate_commissions: "read",
|
|
@@ -9167,7 +9378,7 @@ function registerAffiliateTools(server2, ctx) {
|
|
|
9167
9378
|
title: "Affiliate Commissions",
|
|
9168
9379
|
description: "Read-only: returns the list of commission records for the authenticated operator.",
|
|
9169
9380
|
inputSchema: {
|
|
9170
|
-
limit:
|
|
9381
|
+
limit: z18.number().int().min(1).max(200).optional().default(50).describe("Maximum number of commission records to return (1-200, default: 50).")
|
|
9171
9382
|
},
|
|
9172
9383
|
annotations: annotationsFor("affiliate_commissions", "read")
|
|
9173
9384
|
},
|
|
@@ -10666,6 +10877,7 @@ var ALL_TOOL_SCOPES = Object.freeze({
|
|
|
10666
10877
|
// Storefront deploy tools exist only in this package, not in the Worker.
|
|
10667
10878
|
...STOREFRONT_DEPLOY_TOOL_SCOPES,
|
|
10668
10879
|
...STOREFRONT_PLAN_TOOL_SCOPES,
|
|
10880
|
+
...STOREFRONT_MANAGEMENT_TOOL_SCOPES,
|
|
10669
10881
|
...ATLAS_TOOL_SCOPES,
|
|
10670
10882
|
...NETWORK_DEFAULT_TOOL_SCOPES,
|
|
10671
10883
|
...AFFILIATE_TOOL_SCOPES,
|
|
@@ -11348,15 +11560,15 @@ function registerAllCarrierAskTools(server2, ctx) {
|
|
|
11348
11560
|
title: "Natural Language Carrier Tool Router",
|
|
11349
11561
|
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.",
|
|
11350
11562
|
inputSchema: {
|
|
11351
|
-
intent:
|
|
11563
|
+
intent: z19.string().min(3).describe(
|
|
11352
11564
|
"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...')"
|
|
11353
11565
|
),
|
|
11354
|
-
context:
|
|
11355
|
-
iccid:
|
|
11356
|
-
account_id:
|
|
11357
|
-
reseller_id:
|
|
11566
|
+
context: z19.object({
|
|
11567
|
+
iccid: z19.string().optional().describe("Subscriber ICCID if already known"),
|
|
11568
|
+
account_id: z19.number().optional().describe("Account ID if already known"),
|
|
11569
|
+
reseller_id: z19.number().optional().describe("Reseller ID if already known")
|
|
11358
11570
|
}).optional().describe("Optional pre-resolved context to improve routing accuracy"),
|
|
11359
|
-
confirm_token:
|
|
11571
|
+
confirm_token: z19.string().optional().describe(
|
|
11360
11572
|
"One-time token from a previous carrier_ask call with confirm_required=true. Providing this executes the previously staged destructive operation."
|
|
11361
11573
|
)
|
|
11362
11574
|
}
|
|
@@ -11560,7 +11772,7 @@ function registerAllCarrierAskTools(server2, ctx) {
|
|
|
11560
11772
|
title: "Describe a Carrier Tool",
|
|
11561
11773
|
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.",
|
|
11562
11774
|
inputSchema: {
|
|
11563
|
-
tool_name:
|
|
11775
|
+
tool_name: z19.string().describe("The exact MCP tool name to describe (e.g. 'assign_package', 'hlr_set_bitrate')")
|
|
11564
11776
|
}
|
|
11565
11777
|
},
|
|
11566
11778
|
wrapHandler(
|
|
@@ -11653,7 +11865,7 @@ function buildExamples(toolName) {
|
|
|
11653
11865
|
}
|
|
11654
11866
|
|
|
11655
11867
|
// src/list-recent-ocs-events.ts
|
|
11656
|
-
import { z as
|
|
11868
|
+
import { z as z20 } from "zod";
|
|
11657
11869
|
|
|
11658
11870
|
// ../../packages/ocs-spec/src/ocs-event-buffer-read.ts
|
|
11659
11871
|
var LIFECYCLE_RESELLER_ID2 = 1170;
|
|
@@ -11782,10 +11994,10 @@ var ALLOWED_EVENT_TYPES = [
|
|
|
11782
11994
|
"usage.anomaly"
|
|
11783
11995
|
];
|
|
11784
11996
|
var listRecentOcsEventsSchema = {
|
|
11785
|
-
iccid:
|
|
11786
|
-
limit:
|
|
11787
|
-
event_types:
|
|
11788
|
-
since:
|
|
11997
|
+
iccid: z20.string().regex(/^\d{19,20}$/).describe("ICCID, 19 or 20 digits, ITU-T E.118 format"),
|
|
11998
|
+
limit: z20.number().int().min(1).max(50).default(20).describe("Max events to return, newest first"),
|
|
11999
|
+
event_types: z20.array(z20.enum(ALLOWED_EVENT_TYPES)).optional().describe("Filter to specific event types"),
|
|
12000
|
+
since: z20.string().datetime().optional().describe("ISO-8601 timestamp; only events after this point")
|
|
11789
12001
|
};
|
|
11790
12002
|
async function listRecentOcsEvents2(iccid, limit, eventTypes, since, kv) {
|
|
11791
12003
|
return listRecentOcsEvents(iccid, limit, eventTypes, since, kv);
|
|
@@ -11848,7 +12060,7 @@ function registerListRecentOcsEventsTool(server2, ctx) {
|
|
|
11848
12060
|
}
|
|
11849
12061
|
|
|
11850
12062
|
// src/tools-rate-governor.ts
|
|
11851
|
-
import { z as
|
|
12063
|
+
import { z as z21 } from "zod";
|
|
11852
12064
|
var MONITORED_ENDPOINTS = [
|
|
11853
12065
|
"subscriberNetworkEventsOverPeriod",
|
|
11854
12066
|
// 30/min
|
|
@@ -11880,7 +12092,7 @@ function registerRateLimitStatusTool(server2, ctx) {
|
|
|
11880
12092
|
title: "API Rate-Limit Governor Status",
|
|
11881
12093
|
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.",
|
|
11882
12094
|
inputSchema: {
|
|
11883
|
-
endpoint:
|
|
12095
|
+
endpoint: z21.string().optional().describe(
|
|
11884
12096
|
"OCS method name in camelCase (e.g. 'subscriberUsageOverPeriod'). Omit to return status for all monitored endpoints."
|
|
11885
12097
|
)
|
|
11886
12098
|
},
|
|
@@ -11936,7 +12148,7 @@ function registerRateLimitStatusTool(server2, ctx) {
|
|
|
11936
12148
|
}
|
|
11937
12149
|
|
|
11938
12150
|
// src/tools-depletion-events.ts
|
|
11939
|
-
import { z as
|
|
12151
|
+
import { z as z22 } from "zod";
|
|
11940
12152
|
function ok6(payload) {
|
|
11941
12153
|
return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
|
|
11942
12154
|
}
|
|
@@ -11964,10 +12176,10 @@ function registerDepletionEventsTool(server2, ctx) {
|
|
|
11964
12176
|
title: "Subscriber Bundle Depletion Events",
|
|
11965
12177
|
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.",
|
|
11966
12178
|
inputSchema: {
|
|
11967
|
-
subscriberId:
|
|
12179
|
+
subscriberId: z22.string().optional().describe(
|
|
11968
12180
|
"OCS subscriber ID to look up. Omit to list the 20 most recent fleet-wide depletions."
|
|
11969
12181
|
),
|
|
11970
|
-
since:
|
|
12182
|
+
since: z22.string().optional().describe(
|
|
11971
12183
|
"ISO-8601 timestamp \u2014 only return events at or after this time (for single-subscriber lookup)."
|
|
11972
12184
|
)
|
|
11973
12185
|
},
|
|
@@ -12082,7 +12294,7 @@ function registerDepletionEventsTool(server2, ctx) {
|
|
|
12082
12294
|
}
|
|
12083
12295
|
|
|
12084
12296
|
// src/tools-country-history.ts
|
|
12085
|
-
import { z as
|
|
12297
|
+
import { z as z23 } from "zod";
|
|
12086
12298
|
function isoDate(now, daysAgo = 0) {
|
|
12087
12299
|
const d = new Date(now.getTime() - daysAgo * 864e5);
|
|
12088
12300
|
return d.toISOString().slice(0, 10);
|
|
@@ -12105,10 +12317,10 @@ function registerCountryHistoryTool(server2, ctx) {
|
|
|
12105
12317
|
title: "Subscriber Country History",
|
|
12106
12318
|
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.",
|
|
12107
12319
|
inputSchema: {
|
|
12108
|
-
subscriberId:
|
|
12109
|
-
startDate:
|
|
12110
|
-
endDate:
|
|
12111
|
-
limit:
|
|
12320
|
+
subscriberId: z23.string().regex(/^\d{19,20}$/, "subscriberId must be a 19\u201320 digit ICCID").describe("Subscriber ICCID (19\u201320 digits, ITU-T E.118)"),
|
|
12321
|
+
startDate: z23.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)"),
|
|
12322
|
+
endDate: z23.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)"),
|
|
12323
|
+
limit: z23.number().int().min(1).max(50).default(20).optional().describe("Maximum number of country_events to return, newest first (default 20, max 50)")
|
|
12112
12324
|
},
|
|
12113
12325
|
annotations: { readOnlyHint: true, idempotentHint: true }
|
|
12114
12326
|
},
|
|
@@ -12216,7 +12428,7 @@ function registerCountryHistoryTool(server2, ctx) {
|
|
|
12216
12428
|
}
|
|
12217
12429
|
|
|
12218
12430
|
// src/apps/fleet-health-app.ts
|
|
12219
|
-
import { z as
|
|
12431
|
+
import { z as z24 } from "zod";
|
|
12220
12432
|
import {
|
|
12221
12433
|
registerAppTool,
|
|
12222
12434
|
registerAppResource,
|
|
@@ -12332,7 +12544,7 @@ function registerFleetHealthApp(server2, ctx) {
|
|
|
12332
12544
|
title: "Fleet Health Dashboard",
|
|
12333
12545
|
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.",
|
|
12334
12546
|
inputSchema: {
|
|
12335
|
-
accountId:
|
|
12547
|
+
accountId: z24.number().optional().describe("Filter to a specific account (omit for all)")
|
|
12336
12548
|
},
|
|
12337
12549
|
annotations: { readOnlyHint: true },
|
|
12338
12550
|
_meta: {
|
|
@@ -12375,7 +12587,7 @@ function registerFleetHealthApp(server2, ctx) {
|
|
|
12375
12587
|
}
|
|
12376
12588
|
|
|
12377
12589
|
// src/apps/provisioning-wizard.ts
|
|
12378
|
-
import { z as
|
|
12590
|
+
import { z as z25 } from "zod";
|
|
12379
12591
|
import {
|
|
12380
12592
|
registerAppTool as registerAppTool2,
|
|
12381
12593
|
registerAppResource as registerAppResource2,
|
|
@@ -12480,10 +12692,10 @@ function registerProvisioningWizard(server2, ctx) {
|
|
|
12480
12692
|
title: "eSIM Provisioning Wizard",
|
|
12481
12693
|
description: "Interactive 3-step wizard to provision an eSIM: select subscriber, choose package template, preview (dry_run) and confirm execution.",
|
|
12482
12694
|
inputSchema: {
|
|
12483
|
-
step:
|
|
12484
|
-
wizardId:
|
|
12485
|
-
subscriber_iccid:
|
|
12486
|
-
package_template_id:
|
|
12695
|
+
step: z25.enum(["init", "select-package", "preview", "confirm"]).describe("Current wizard step"),
|
|
12696
|
+
wizardId: z25.string().optional().describe("Wizard session ID (absent on init)"),
|
|
12697
|
+
subscriber_iccid: z25.string().optional().describe("Subscriber ICCID (required for select-package)"),
|
|
12698
|
+
package_template_id: z25.number().optional().describe("Package template ID (required for preview)")
|
|
12487
12699
|
},
|
|
12488
12700
|
_meta: {
|
|
12489
12701
|
ui: {
|
|
@@ -12753,7 +12965,7 @@ function registerProvisioningWizard(server2, ctx) {
|
|
|
12753
12965
|
}
|
|
12754
12966
|
|
|
12755
12967
|
// src/apps/balance-topup.ts
|
|
12756
|
-
import { z as
|
|
12968
|
+
import { z as z26 } from "zod";
|
|
12757
12969
|
import {
|
|
12758
12970
|
registerAppTool as registerAppTool3,
|
|
12759
12971
|
registerAppResource as registerAppResource3,
|
|
@@ -12806,9 +13018,9 @@ function registerBalanceTopupApp(server2, ctx) {
|
|
|
12806
13018
|
title: "Balance Top-up Form",
|
|
12807
13019
|
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`.",
|
|
12808
13020
|
inputSchema: {
|
|
12809
|
-
iccid:
|
|
12810
|
-
delta:
|
|
12811
|
-
preview:
|
|
13021
|
+
iccid: z26.string().describe("The subscriber ICCID for the account lookup"),
|
|
13022
|
+
delta: z26.number().describe("Amount to add (positive) or deduct (negative) from the account balance"),
|
|
13023
|
+
preview: z26.boolean().default(true).describe("If true, return preview without writing. If false, execute the balance change.")
|
|
12812
13024
|
},
|
|
12813
13025
|
annotations: { destructiveHint: true },
|
|
12814
13026
|
_meta: {
|
|
@@ -12891,7 +13103,7 @@ function registerAllApps(server2, ctx) {
|
|
|
12891
13103
|
}
|
|
12892
13104
|
|
|
12893
13105
|
// src/prompts.ts
|
|
12894
|
-
import { z as
|
|
13106
|
+
import { z as z27 } from "zod";
|
|
12895
13107
|
function registerAllPrompts(server2) {
|
|
12896
13108
|
server2.registerPrompt(
|
|
12897
13109
|
"fleet_health_report",
|
|
@@ -12927,7 +13139,7 @@ Format as a structured report with sections, tables, and actionable recommendati
|
|
|
12927
13139
|
{
|
|
12928
13140
|
title: "Subscriber Deep Dive",
|
|
12929
13141
|
description: "Comprehensive analysis of a single subscriber: profile, packages, usage patterns, location history, recommendations.",
|
|
12930
|
-
argsSchema: { iccid:
|
|
13142
|
+
argsSchema: { iccid: z27.string().describe("The subscriber ICCID to analyse") }
|
|
12931
13143
|
},
|
|
12932
13144
|
async ({ iccid }) => ({
|
|
12933
13145
|
messages: [
|
|
@@ -13026,7 +13238,7 @@ Analyze and present:
|
|
|
13026
13238
|
{
|
|
13027
13239
|
title: "Bulk Operations Planner",
|
|
13028
13240
|
description: "Plan bulk operations safely: mass package assignments, account migrations, balance adjustments, or status changes.",
|
|
13029
|
-
argsSchema: { operation:
|
|
13241
|
+
argsSchema: { operation: z27.string().describe("Describe the bulk operation you want to perform") }
|
|
13030
13242
|
},
|
|
13031
13243
|
async ({ operation }) => ({
|
|
13032
13244
|
messages: [
|
|
@@ -13059,7 +13271,7 @@ NEVER execute destructive operations without confirmation.`
|
|
|
13059
13271
|
}
|
|
13060
13272
|
|
|
13061
13273
|
// src/tools-pricing.ts
|
|
13062
|
-
import { z as
|
|
13274
|
+
import { z as z28 } from "zod";
|
|
13063
13275
|
function registerAllPricingTools(server2, ctx) {
|
|
13064
13276
|
const allTools = [...PRICING_TOOLS, ...PROJECTS_TOOLS];
|
|
13065
13277
|
for (const tool of allTools) {
|
|
@@ -13166,19 +13378,19 @@ function buildZodSchema(schema) {
|
|
|
13166
13378
|
for (const [key, prop] of Object.entries(properties)) {
|
|
13167
13379
|
let field;
|
|
13168
13380
|
if (prop.enum) {
|
|
13169
|
-
field =
|
|
13381
|
+
field = z28.enum(prop.enum);
|
|
13170
13382
|
} else if (prop.type === "number") {
|
|
13171
|
-
field =
|
|
13383
|
+
field = z28.number();
|
|
13172
13384
|
} else if (prop.type === "boolean") {
|
|
13173
|
-
field =
|
|
13385
|
+
field = z28.boolean();
|
|
13174
13386
|
} else if (prop.type === "array") {
|
|
13175
13387
|
if (prop.items?.type === "number") {
|
|
13176
|
-
field =
|
|
13388
|
+
field = z28.array(z28.number());
|
|
13177
13389
|
} else {
|
|
13178
|
-
field =
|
|
13390
|
+
field = z28.array(z28.string());
|
|
13179
13391
|
}
|
|
13180
13392
|
} else {
|
|
13181
|
-
field =
|
|
13393
|
+
field = z28.string();
|
|
13182
13394
|
}
|
|
13183
13395
|
const required = schema.required ?? [];
|
|
13184
13396
|
if (!required.includes(key)) {
|
|
@@ -13193,7 +13405,7 @@ function buildZodSchema(schema) {
|
|
|
13193
13405
|
}
|
|
13194
13406
|
|
|
13195
13407
|
// src/tools-greenzone.ts
|
|
13196
|
-
import { z as
|
|
13408
|
+
import { z as z29 } from "zod";
|
|
13197
13409
|
|
|
13198
13410
|
// src/greenzone-whitelist.ts
|
|
13199
13411
|
var STATE_KEY = "greenzone:state";
|
|
@@ -13484,9 +13696,9 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
13484
13696
|
title: "Greenzone Whitelist \u2014 Add",
|
|
13485
13697
|
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.",
|
|
13486
13698
|
inputSchema: {
|
|
13487
|
-
host:
|
|
13488
|
-
ip:
|
|
13489
|
-
dry_run:
|
|
13699
|
+
host: z29.string().optional().describe("Hostname to whitelist (e.g. 'example.com')"),
|
|
13700
|
+
ip: z29.string().optional().describe("IP address or CIDR to whitelist (e.g. '203.0.113.0/24')"),
|
|
13701
|
+
dry_run: z29.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
|
|
13490
13702
|
},
|
|
13491
13703
|
annotations: { destructiveHint: true }
|
|
13492
13704
|
},
|
|
@@ -13545,9 +13757,9 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
13545
13757
|
title: "Greenzone Whitelist \u2014 Remove",
|
|
13546
13758
|
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.",
|
|
13547
13759
|
inputSchema: {
|
|
13548
|
-
host:
|
|
13549
|
-
ip:
|
|
13550
|
-
dry_run:
|
|
13760
|
+
host: z29.string().optional().describe("Hostname to remove from whitelist"),
|
|
13761
|
+
ip: z29.string().optional().describe("IP address or CIDR to remove from whitelist"),
|
|
13762
|
+
dry_run: z29.boolean().optional().describe("If true, return the Kapture steps without executing portal automation")
|
|
13551
13763
|
},
|
|
13552
13764
|
annotations: { destructiveHint: true }
|
|
13553
13765
|
},
|
|
@@ -13606,7 +13818,7 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
13606
13818
|
title: "Greenzone Whitelist \u2014 List",
|
|
13607
13819
|
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.",
|
|
13608
13820
|
inputSchema: {
|
|
13609
|
-
from_portal:
|
|
13821
|
+
from_portal: z29.boolean().optional().describe(
|
|
13610
13822
|
"When true, return Kapture steps to read live portal state instead of KV cache"
|
|
13611
13823
|
)
|
|
13612
13824
|
},
|
|
@@ -13658,7 +13870,7 @@ function registerGreenzoneTools(server2, ctx) {
|
|
|
13658
13870
|
}
|
|
13659
13871
|
|
|
13660
13872
|
// src/tools-ui-agent-generic.ts
|
|
13661
|
-
import { z as
|
|
13873
|
+
import { z as z30 } from "zod";
|
|
13662
13874
|
var COST_PER_STEP_USD = 0.014;
|
|
13663
13875
|
var SESSION_OVERHEAD_USD = 5e-3;
|
|
13664
13876
|
function estimateCostUsd2(steps) {
|
|
@@ -13700,13 +13912,13 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
|
|
|
13700
13912
|
title: "Dispatch Generic Browsing Agent",
|
|
13701
13913
|
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.",
|
|
13702
13914
|
inputSchema: {
|
|
13703
|
-
prompt:
|
|
13915
|
+
prompt: z30.string().min(1).max(4e3).describe(
|
|
13704
13916
|
"Natural-language task description for the browsing agent. Be specific: include target URLs, data to extract, or actions to perform."
|
|
13705
13917
|
),
|
|
13706
|
-
max_steps:
|
|
13918
|
+
max_steps: z30.number().int().min(1).max(30).optional().describe(
|
|
13707
13919
|
"Advisory step budget (1\u201330, default 15). Prices the dry-run estimate; the hosted agent sets its own depth."
|
|
13708
13920
|
),
|
|
13709
|
-
dry_run:
|
|
13921
|
+
dry_run: z30.boolean().optional().describe(
|
|
13710
13922
|
"Preview cost estimate without dispatching. Returns estimated_cost_usd only \u2014 no browser session is created."
|
|
13711
13923
|
)
|
|
13712
13924
|
}
|
|
@@ -13843,7 +14055,7 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
|
|
|
13843
14055
|
title: "Poll Browsing Agent Task Status",
|
|
13844
14056
|
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.",
|
|
13845
14057
|
inputSchema: {
|
|
13846
|
-
task_id:
|
|
14058
|
+
task_id: z30.string().describe("Task ID returned by ui_agent_ask")
|
|
13847
14059
|
}
|
|
13848
14060
|
},
|
|
13849
14061
|
async (args) => {
|
|
@@ -13884,6 +14096,53 @@ function registerUiAgentGenericTools(server2, ctx, runtime) {
|
|
|
13884
14096
|
);
|
|
13885
14097
|
}
|
|
13886
14098
|
|
|
14099
|
+
// src/storefront-api-call.ts
|
|
14100
|
+
var STOREFRONT_API_DEFAULT_BASE_URL = "https://api.carrier.llc";
|
|
14101
|
+
var READ_TIMEOUT_MS = 1e4;
|
|
14102
|
+
var WRITE_TIMEOUT_MS2 = 3e4;
|
|
14103
|
+
function createStorefrontApiCall(options) {
|
|
14104
|
+
return async (request, extra) => {
|
|
14105
|
+
const token2 = await options.getToken(extra);
|
|
14106
|
+
if (!token2) {
|
|
14107
|
+
return {
|
|
14108
|
+
ok: false,
|
|
14109
|
+
status: 401,
|
|
14110
|
+
body: {
|
|
14111
|
+
error: "carrier_api_auth_required",
|
|
14112
|
+
message: "No Carrier API credential is available for this session, so the storefront call was not attempted."
|
|
14113
|
+
}
|
|
14114
|
+
};
|
|
14115
|
+
}
|
|
14116
|
+
const base = (options.baseUrl?.trim() || STOREFRONT_API_DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
14117
|
+
const headers = {
|
|
14118
|
+
Authorization: `Bearer ${token2}`,
|
|
14119
|
+
Accept: "application/json"
|
|
14120
|
+
};
|
|
14121
|
+
if (request.body !== void 0) headers["Content-Type"] = "application/json";
|
|
14122
|
+
if (request.idempotencyKey !== void 0) headers["Idempotency-Key"] = request.idempotencyKey;
|
|
14123
|
+
if (request.confirmToken !== void 0) headers["X-Confirm-Token"] = request.confirmToken;
|
|
14124
|
+
const response = await fetch(`${base}${request.path}`, {
|
|
14125
|
+
method: request.method,
|
|
14126
|
+
redirect: "error",
|
|
14127
|
+
headers,
|
|
14128
|
+
...request.body !== void 0 ? { body: JSON.stringify(request.body) } : {},
|
|
14129
|
+
signal: AbortSignal.timeout(request.method === "GET" ? READ_TIMEOUT_MS : WRITE_TIMEOUT_MS2)
|
|
14130
|
+
});
|
|
14131
|
+
const text = await response.text();
|
|
14132
|
+
let body2;
|
|
14133
|
+
if (text.trim() === "") {
|
|
14134
|
+
body2 = {};
|
|
14135
|
+
} else {
|
|
14136
|
+
try {
|
|
14137
|
+
body2 = JSON.parse(text);
|
|
14138
|
+
} catch {
|
|
14139
|
+
body2 = { message: text };
|
|
14140
|
+
}
|
|
14141
|
+
}
|
|
14142
|
+
return { ok: response.ok, status: response.status, body: body2 };
|
|
14143
|
+
};
|
|
14144
|
+
}
|
|
14145
|
+
|
|
13887
14146
|
// src/index.ts
|
|
13888
14147
|
var baseUrl = process.env.CARRIER_OCS_BASE_URL ?? process.env.ESIMVAULT_BASE_URL ?? "https://ocs.esimvault.cloud";
|
|
13889
14148
|
var token = process.env.CARRIER_OCS_API_TOKEN ?? process.env.ESIMVAULT_API_TOKEN;
|
|
@@ -14017,6 +14276,16 @@ registerStorefrontLogoTools(
|
|
|
14017
14276
|
);
|
|
14018
14277
|
registerStorefrontDeployTools(server, props);
|
|
14019
14278
|
registerStorefrontPlanTools(server, props);
|
|
14279
|
+
registerStorefrontManagementTools(
|
|
14280
|
+
server,
|
|
14281
|
+
props,
|
|
14282
|
+
createStorefrontApiCall({
|
|
14283
|
+
baseUrl: process.env.CARRIER_API_URL,
|
|
14284
|
+
getToken: () => process.env.CARRIER_API_KEY?.trim() || process.env.CARRIER_ORG_API_KEY?.trim() || void 0
|
|
14285
|
+
}),
|
|
14286
|
+
"rest",
|
|
14287
|
+
{ exclude: new Set(Object.keys(STOREFRONT_PLAN_TOOL_SCOPES)) }
|
|
14288
|
+
);
|
|
14020
14289
|
registerAtlasTools(server, toolCtx);
|
|
14021
14290
|
registerAllPrompts(server);
|
|
14022
14291
|
var transport = new StdioServerTransport();
|