mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-11 00:30:46 +08:00
Add bizMonitor host tools for cutover analysis via netx REST (0.1.40).
Expose getBizMonitor* / getBizCollect* on the Ops preset with skill netx-biz-monitor; keep tooling in netxops instead of netx-mcp. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
f7801db296
commit
0934e10409
23 changed files with 1022 additions and 62 deletions
|
|
@ -1,7 +1,8 @@
|
|||
// src/netx/capability-groups.ts
|
||||
var DEFAULT_CAPABILITY_GROUPS = Object.freeze({
|
||||
ops: Object.freeze({ inPreset: true, public: false }),
|
||||
topology: Object.freeze({ inPreset: false, public: false })
|
||||
topology: Object.freeze({ inPreset: false, public: false }),
|
||||
bizMonitor: Object.freeze({ inPreset: true, public: false })
|
||||
});
|
||||
var TOOLS_BY_GROUP = Object.freeze({
|
||||
ops: Object.freeze([
|
||||
|
|
@ -37,15 +38,25 @@ var TOOLS_BY_GROUP = Object.freeze({
|
|||
"netx__suggestSinkHubs",
|
||||
"netx__analyzeTopologyViewLayout",
|
||||
"netx__sinkTopologyDualUnits"
|
||||
]),
|
||||
bizMonitor: Object.freeze([
|
||||
"netx__getBizMonitorContext",
|
||||
"netx__getBizMonitorBoard",
|
||||
"netx__listBizMonitorReds",
|
||||
"netx__getBizMonitorDiffs",
|
||||
"netx__getBizCollectBatch",
|
||||
"netx__getBizCollectCommandRaw"
|
||||
])
|
||||
});
|
||||
var SKILL_DIR_BY_GROUP = Object.freeze({
|
||||
ops: "ops",
|
||||
topology: "topology"
|
||||
topology: "topology",
|
||||
bizMonitor: "biz-monitor"
|
||||
});
|
||||
var CAPABILITY_GROUP_IDS = Object.freeze([
|
||||
"ops",
|
||||
"topology"
|
||||
"topology",
|
||||
"bizMonitor"
|
||||
]);
|
||||
function groupsForPlane(groups, plane, only) {
|
||||
const policy = groups ?? DEFAULT_CAPABILITY_GROUPS;
|
||||
|
|
@ -60,12 +71,12 @@ function groupsForced(only) {
|
|||
return CAPABILITY_GROUP_IDS.filter((id) => normalized.includes(id));
|
||||
}
|
||||
function toolNamesForGroups(groupIds) {
|
||||
const names = new Set;
|
||||
const out = new Set;
|
||||
for (const id of groupIds) {
|
||||
for (const tool of TOOLS_BY_GROUP[id])
|
||||
names.add(tool);
|
||||
for (const name of TOOLS_BY_GROUP[id] ?? [])
|
||||
out.add(name);
|
||||
}
|
||||
return names;
|
||||
return out;
|
||||
}
|
||||
|
||||
// src/netx/group-skills.ts
|
||||
|
|
@ -1458,6 +1469,68 @@ async function findTopologyPaths(client, args, signal) {
|
|||
body.to_managed_ne_id = toMid;
|
||||
return client.post("/v1/topology/fabric/paths", body, signal, 30000);
|
||||
}
|
||||
async function getBizMonitorContext(client, args, signal) {
|
||||
const projectId = str2(args, "project_id").trim();
|
||||
const taskId = str2(args, "task_id").trim();
|
||||
if (!projectId && !taskId) {
|
||||
return { ok: false, error: "project_id_or_task_id_required" };
|
||||
}
|
||||
const params = {};
|
||||
if (projectId)
|
||||
params.project_id = projectId;
|
||||
if (taskId)
|
||||
params.task_id = taskId;
|
||||
return client.get("/v1/biz-migration/monitor-context", params, signal);
|
||||
}
|
||||
async function getBizMonitorBoard(client, args, signal) {
|
||||
const batchId = str2(args, "batch_id").trim();
|
||||
if (!batchId)
|
||||
return { ok: false, error: "batch_id_required" };
|
||||
const params = {};
|
||||
const runId = str2(args, "run_id").trim();
|
||||
if (runId)
|
||||
params.run_id = runId;
|
||||
return client.get(`/v1/biz-migration/batches/${encodeURIComponent(batchId)}/board`, params, signal);
|
||||
}
|
||||
async function listBizMonitorReds(client, args, signal) {
|
||||
const projectId = str2(args, "project_id").trim();
|
||||
if (!projectId)
|
||||
return { ok: false, error: "project_id_required" };
|
||||
const params = {};
|
||||
putStr(params, args, ["status"]);
|
||||
const limit = num2(args, "limit");
|
||||
if (limit !== undefined)
|
||||
params.limit = clampInt(limit, 200, 1, 500);
|
||||
return client.get(`/v1/biz-migration/projects/${encodeURIComponent(projectId)}/red-tickets`, params, signal);
|
||||
}
|
||||
async function getBizMonitorDiffs(client, args, signal) {
|
||||
const runId = str2(args, "run_id").trim();
|
||||
if (!runId)
|
||||
return { ok: false, error: "run_id_required" };
|
||||
const params = {};
|
||||
putStr(params, args, ["metric_id", "sheet_id", "verdict", "color", "q"]);
|
||||
const limit = num2(args, "limit");
|
||||
if (limit !== undefined)
|
||||
params.limit = clampInt(limit, 200, 1, 500);
|
||||
const offset = num2(args, "offset");
|
||||
if (offset !== undefined)
|
||||
params.offset = clampInt(offset, 0, 0, Number.MAX_SAFE_INTEGER);
|
||||
return client.get(`/v1/biz-migration/runs/${encodeURIComponent(runId)}/diffs`, params, signal);
|
||||
}
|
||||
async function getBizCollectBatch(client, args, signal) {
|
||||
const batchId = str2(args, "batch_id").trim();
|
||||
if (!batchId)
|
||||
return { ok: false, error: "batch_id_required" };
|
||||
return client.get(`/v1/biz-state/batches/${encodeURIComponent(batchId)}`, {}, signal);
|
||||
}
|
||||
async function getBizCollectCommandRaw(client, args, signal) {
|
||||
const batchId = str2(args, "batch_id").trim();
|
||||
const commandId = str2(args, "command_id").trim();
|
||||
if (!batchId || !commandId) {
|
||||
return { ok: false, error: "batch_id_and_command_id_required" };
|
||||
}
|
||||
return client.get(`/v1/biz-state/batches/${encodeURIComponent(batchId)}/commands/${encodeURIComponent(commandId)}`, {}, signal);
|
||||
}
|
||||
|
||||
// src/netx/topology-handlers.ts
|
||||
function asRecord2(value) {
|
||||
|
|
@ -2282,6 +2355,36 @@ function registerNetxTools(ctx, connection, options) {
|
|||
layer: str4(),
|
||||
detail: str4("summary | full")
|
||||
}, findTopologyPaths, getClient, t),
|
||||
tool2("netx__getBizMonitorContext", "Biz-monitor definition bundle: cutover project + monitor/compare templates + iface normalize + port mapping + related tasks/commands. Prefer project_id. Display keys are device-raw A/B.", {
|
||||
project_id: str4("Cutover / biz-migration project id"),
|
||||
task_id: str4("biz_state task id (optional if project_id set)")
|
||||
}, getBizMonitorContext, getClient, t),
|
||||
tool2("netx__getBizMonitorBoard", "Cutover batch board: project/batch status, evaluate run summary, sheet cards, verdict counts, metric_batches.", {
|
||||
batch_id: { type: "string", required: true },
|
||||
run_id: str4("Optional evaluate run id")
|
||||
}, getBizMonitorBoard, getClient, t),
|
||||
tool2("netx__listBizMonitorReds", "Open/carried red tickets. Each item has old_key/new_key (raw A/B) and evidence (device, collect time, show command, iface raw→norm→map).", {
|
||||
project_id: { type: "string", required: true },
|
||||
status: str4("open|carried|resolved or empty=all"),
|
||||
limit: num4()
|
||||
}, listBizMonitorReds, getClient, t),
|
||||
tool2("netx__getBizMonitorDiffs", "Paged evaluate diffs. Rows expose old_key/new_key (raw A/B), match_* keys, status, evidence with show commands.", {
|
||||
run_id: { type: "string", required: true },
|
||||
metric_id: str4(),
|
||||
sheet_id: str4(),
|
||||
verdict: str4(),
|
||||
color: str4("e.g. red"),
|
||||
q: str4(),
|
||||
limit: num4(),
|
||||
offset: num4()
|
||||
}, getBizMonitorDiffs, getClient, t),
|
||||
tool2("netx__getBizCollectBatch", "One biz_state collect batch: commands (raw_command, parse_status, preview), parsed metrics.", {
|
||||
batch_id: { type: "string", required: true }
|
||||
}, getBizCollectBatch, getClient, t),
|
||||
tool2("netx__getBizCollectCommandRaw", "Full CLI raw_text for one collect command inside a batch (deep dive).", {
|
||||
batch_id: { type: "string", required: true },
|
||||
command_id: { type: "string", required: true }
|
||||
}, getBizCollectCommandRaw, getClient, t),
|
||||
tool2("netx__getTopologyTree", "Get topology folder tree (nav roots + Root map canvases). Start here before createTopologyFolder.", { compact: bool4(), max_depth: num4() }, getTopologyTree, getClient, t),
|
||||
tool2("netx__getTopologyView", "Get a topology view by view_id. Default detail=summary with sample_nodes + links[].", {
|
||||
view_id: { type: "string", required: true },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue