Merge nms+common into ops so login questions load execManagedNe.

One capability group now ships netx-ops (alarms + managed CLI + paths); keep tools-nms/common as aliases.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-06 02:11:02 +08:00
parent 6e591be2b5
commit 63f88bdf6c
33 changed files with 2133 additions and 446 deletions

View file

@ -1,11 +1,10 @@
// src/netx/capability-groups.ts
var DEFAULT_CAPABILITY_GROUPS = Object.freeze({
nms: Object.freeze({ inPreset: true, public: false }),
common: Object.freeze({ inPreset: true, public: false }),
ops: Object.freeze({ inPreset: true, public: false }),
topology: Object.freeze({ inPreset: false, public: false })
});
var TOOLS_BY_GROUP = Object.freeze({
nms: Object.freeze([
ops: Object.freeze([
"netx__queryNmsAlarms",
"netx__aggregateNmsAlarms",
"netx__runNmsDiagnostics",
@ -14,9 +13,7 @@ var TOOLS_BY_GROUP = Object.freeze({
"netx__queryNmsAlarmsRaw",
"netx__aggregateNmsAlarmsRaw",
"netx__listNmsAlarmFields",
"netx__sqlQueryNms"
]),
common: Object.freeze([
"netx__sqlQueryNms",
"netx__listManagedNe",
"netx__getManagedNe",
"netx__execManagedNe",
@ -43,13 +40,11 @@ var TOOLS_BY_GROUP = Object.freeze({
])
});
var SKILL_DIR_BY_GROUP = Object.freeze({
nms: "nms",
common: "common",
ops: "ops",
topology: "topology"
});
var CAPABILITY_GROUP_IDS = Object.freeze([
"nms",
"common",
"ops",
"topology"
]);
function groupsForPlane(groups, plane, only) {
@ -61,7 +56,8 @@ function groupsForPlane(groups, plane, only) {
return enabled.filter((id) => allow.has(id));
}
function groupsForced(only) {
return CAPABILITY_GROUP_IDS.filter((id) => only.includes(id));
const normalized = only.map((id) => id === "nms" || id === "common" ? "ops" : id);
return CAPABILITY_GROUP_IDS.filter((id) => normalized.includes(id));
}
function toolNamesForGroups(groupIds) {
const names = new Set;
@ -1792,7 +1788,7 @@ function applyGroupToolsPlugin(ctx, options) {
var name = "netxops-tools-common";
var inject = ["tools"];
function apply(ctx) {
applyGroupToolsPlugin(ctx, { name, mode: "forced", only: ["common"] });
applyGroupToolsPlugin(ctx, { name, mode: "forced", only: ["ops"] });
}
export {
name,

View file

@ -1,11 +1,10 @@
// src/netx/capability-groups.ts
var DEFAULT_CAPABILITY_GROUPS = Object.freeze({
nms: Object.freeze({ inPreset: true, public: false }),
common: Object.freeze({ inPreset: true, public: false }),
ops: Object.freeze({ inPreset: true, public: false }),
topology: Object.freeze({ inPreset: false, public: false })
});
var TOOLS_BY_GROUP = Object.freeze({
nms: Object.freeze([
ops: Object.freeze([
"netx__queryNmsAlarms",
"netx__aggregateNmsAlarms",
"netx__runNmsDiagnostics",
@ -14,9 +13,7 @@ var TOOLS_BY_GROUP = Object.freeze({
"netx__queryNmsAlarmsRaw",
"netx__aggregateNmsAlarmsRaw",
"netx__listNmsAlarmFields",
"netx__sqlQueryNms"
]),
common: Object.freeze([
"netx__sqlQueryNms",
"netx__listManagedNe",
"netx__getManagedNe",
"netx__execManagedNe",
@ -43,13 +40,11 @@ var TOOLS_BY_GROUP = Object.freeze({
])
});
var SKILL_DIR_BY_GROUP = Object.freeze({
nms: "nms",
common: "common",
ops: "ops",
topology: "topology"
});
var CAPABILITY_GROUP_IDS = Object.freeze([
"nms",
"common",
"ops",
"topology"
]);
function groupsForPlane(groups, plane, only) {
@ -61,7 +56,8 @@ function groupsForPlane(groups, plane, only) {
return enabled.filter((id) => allow.has(id));
}
function groupsForced(only) {
return CAPABILITY_GROUP_IDS.filter((id) => only.includes(id));
const normalized = only.map((id) => id === "nms" || id === "common" ? "ops" : id);
return CAPABILITY_GROUP_IDS.filter((id) => normalized.includes(id));
}
function toolNamesForGroups(groupIds) {
const names = new Set;
@ -1792,7 +1788,7 @@ function applyGroupToolsPlugin(ctx, options) {
var name = "netxops-tools-nms";
var inject = ["tools"];
function apply(ctx) {
applyGroupToolsPlugin(ctx, { name, mode: "forced", only: ["nms"] });
applyGroupToolsPlugin(ctx, { name, mode: "forced", only: ["ops"] });
}
export {
name,

1797
lib/agent-tools-ops.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,10 @@
// src/netx/capability-groups.ts
var DEFAULT_CAPABILITY_GROUPS = Object.freeze({
nms: Object.freeze({ inPreset: true, public: false }),
common: Object.freeze({ inPreset: true, public: false }),
ops: Object.freeze({ inPreset: true, public: false }),
topology: Object.freeze({ inPreset: false, public: false })
});
var TOOLS_BY_GROUP = Object.freeze({
nms: Object.freeze([
ops: Object.freeze([
"netx__queryNmsAlarms",
"netx__aggregateNmsAlarms",
"netx__runNmsDiagnostics",
@ -14,9 +13,7 @@ var TOOLS_BY_GROUP = Object.freeze({
"netx__queryNmsAlarmsRaw",
"netx__aggregateNmsAlarmsRaw",
"netx__listNmsAlarmFields",
"netx__sqlQueryNms"
]),
common: Object.freeze([
"netx__sqlQueryNms",
"netx__listManagedNe",
"netx__getManagedNe",
"netx__execManagedNe",
@ -43,13 +40,11 @@ var TOOLS_BY_GROUP = Object.freeze({
])
});
var SKILL_DIR_BY_GROUP = Object.freeze({
nms: "nms",
common: "common",
ops: "ops",
topology: "topology"
});
var CAPABILITY_GROUP_IDS = Object.freeze([
"nms",
"common",
"ops",
"topology"
]);
function groupsForPlane(groups, plane, only) {
@ -61,7 +56,8 @@ function groupsForPlane(groups, plane, only) {
return enabled.filter((id) => allow.has(id));
}
function groupsForced(only) {
return CAPABILITY_GROUP_IDS.filter((id) => only.includes(id));
const normalized = only.map((id) => id === "nms" || id === "common" ? "ops" : id);
return CAPABILITY_GROUP_IDS.filter((id) => normalized.includes(id));
}
function toolNamesForGroups(groupIds) {
const names = new Set;

View file

@ -1,11 +1,10 @@
// src/netx/capability-groups.ts
var DEFAULT_CAPABILITY_GROUPS = Object.freeze({
nms: Object.freeze({ inPreset: true, public: false }),
common: Object.freeze({ inPreset: true, public: false }),
ops: Object.freeze({ inPreset: true, public: false }),
topology: Object.freeze({ inPreset: false, public: false })
});
var TOOLS_BY_GROUP = Object.freeze({
nms: Object.freeze([
ops: Object.freeze([
"netx__queryNmsAlarms",
"netx__aggregateNmsAlarms",
"netx__runNmsDiagnostics",
@ -14,9 +13,7 @@ var TOOLS_BY_GROUP = Object.freeze({
"netx__queryNmsAlarmsRaw",
"netx__aggregateNmsAlarmsRaw",
"netx__listNmsAlarmFields",
"netx__sqlQueryNms"
]),
common: Object.freeze([
"netx__sqlQueryNms",
"netx__listManagedNe",
"netx__getManagedNe",
"netx__execManagedNe",
@ -43,13 +40,11 @@ var TOOLS_BY_GROUP = Object.freeze({
])
});
var SKILL_DIR_BY_GROUP = Object.freeze({
nms: "nms",
common: "common",
ops: "ops",
topology: "topology"
});
var CAPABILITY_GROUP_IDS = Object.freeze([
"nms",
"common",
"ops",
"topology"
]);
function groupsForPlane(groups, plane, only) {
@ -61,7 +56,8 @@ function groupsForPlane(groups, plane, only) {
return enabled.filter((id) => allow.has(id));
}
function groupsForced(only) {
return CAPABILITY_GROUP_IDS.filter((id) => only.includes(id));
const normalized = only.map((id) => id === "nms" || id === "common" ? "ops" : id);
return CAPABILITY_GROUP_IDS.filter((id) => normalized.includes(id));
}
function toolNamesForGroups(groupIds) {
const names = new Set;

View file

@ -630,31 +630,17 @@ function NetxopsCard(props) {
children: t("capabilityGroupsHint")
}),
/* @__PURE__ */ jsx_runtime.jsx(CapabilityGroupBlock, {
title: t("groupNms"),
title: t("groupOps"),
inPresetLabel: t("groupInPreset"),
publicLabel: t("groupPublic"),
inPreset: state.groupNmsInPreset,
published: state.groupNmsPublic,
inPreset: state.groupOpsInPreset,
published: state.groupOpsPublic,
disabled,
onEditInPreset: (checked) => {
props.edit("groupNmsInPreset", checked ? "true" : "false");
props.edit("groupOpsInPreset", checked ? "true" : "false");
},
onEditPublic: (checked) => {
props.edit("groupNmsPublic", checked ? "true" : "false");
}
}),
/* @__PURE__ */ jsx_runtime.jsx(CapabilityGroupBlock, {
title: t("groupCommon"),
inPresetLabel: t("groupInPreset"),
publicLabel: t("groupPublic"),
inPreset: state.groupCommonInPreset,
published: state.groupCommonPublic,
disabled,
onEditInPreset: (checked) => {
props.edit("groupCommonInPreset", checked ? "true" : "false");
},
onEditPublic: (checked) => {
props.edit("groupCommonPublic", checked ? "true" : "false");
props.edit("groupOpsPublic", checked ? "true" : "false");
}
}),
/* @__PURE__ */ jsx_runtime.jsx(CapabilityGroupBlock, {
@ -1162,10 +1148,8 @@ class NetxopsCardController {
textField("apiUrl"),
textField("lang"),
textField("nmsProvider"),
booleanFieldPersistFalse("groupNmsInPreset"),
booleanField("groupNmsPublic"),
booleanFieldPersistFalse("groupCommonInPreset"),
booleanField("groupCommonPublic"),
booleanFieldPersistFalse("groupOpsInPreset"),
booleanField("groupOpsPublic"),
booleanField("groupTopologyInPreset"),
booleanField("groupTopologyPublic"),
booleanField("alarmPushEnabled"),
@ -1269,10 +1253,8 @@ class NetxopsCardController {
apiUrl: this.form.field("apiUrl"),
lang: this.form.field("lang"),
nmsProvider: this.form.field("nmsProvider"),
groupNmsInPreset: this.form.field("groupNmsInPreset"),
groupNmsPublic: this.form.field("groupNmsPublic"),
groupCommonInPreset: this.form.field("groupCommonInPreset"),
groupCommonPublic: this.form.field("groupCommonPublic"),
groupOpsInPreset: this.form.field("groupOpsInPreset"),
groupOpsPublic: this.form.field("groupOpsPublic"),
groupTopologyInPreset: this.form.field("groupTopologyInPreset"),
groupTopologyPublic: this.form.field("groupTopologyPublic"),
alarmPushEnabled: this.form.field("alarmPushEnabled"),
@ -1350,17 +1332,16 @@ function refOf(snapshot) {
// src/client/locales.ts
var en = {
title: "Netx Ops",
description: "netx API, bearer token, and capability groups (nms / common / topology).",
description: "netx API, bearer token, and capability groups (ops / topology).",
apiUrl: "API URL",
apiUrlHint: "netx REST root, e.g. http://127.0.0.1:8890 (also used for alarm subscribe)",
lang: "Language",
langHint: "Response language hint (zh / en).",
capabilityGroups: "Capability groups",
capabilityGroupsHint: "One group ↔ one skill (netx-nms / netx-common / netx-topology). Defaults: nms + common in preset; topology and all public off. Save, then open a new session. Other agents can mount dsh-netxops/tools-nms|common|topology.",
capabilityGroupsHint: "One group ↔ one skill. ops = netx-ops (alarms + CLI login + paths); topology = netx-topology. Defaults: ops on; topology and public off. New sessions after save. Other agents: dsh-netxops/tools-ops|topology.",
nmsProvider: "nms provider",
nmsProviderHint: "Vendor adapter id. Supported today: zte-ume (REST still /v1/ume/*; model tools are netx__*Nms*).",
groupNms: "nms — skill netx-nms (alarms / inventory / SQL)",
groupCommon: "common — skill netx-common (managed CLI + findTopologyPaths)",
groupOps: "ops — skill netx-ops (NMS alarms/inventory + managed CLI login + paths)",
groupTopology: "topology — skill netx-topology (canvas / fabric / dual_unit)",
groupInPreset: "In Netx Ops preset",
groupPublic: "Publish to other presets",
@ -1406,17 +1387,16 @@ var en = {
};
var zh = {
title: "Netx Ops",
description: "netx API、Bearer Token,以及能力组(nms / common / topology)。",
description: "netx API、Bearer Token,以及能力组(ops / topology)。",
apiUrl: "API 地址",
apiUrlHint: "netx REST 根地址,例如 http://127.0.0.1:8890(告警订阅复用同一地址)",
lang: "语言",
langHint: "响应语言提示(zh / en)。",
capabilityGroups: "能力组",
capabilityGroupsHint: "一组一个 skill(netx-nms / netx-common / netx-topology)。默认:nms + common 进入预设;topology 与全部公开关闭。保存后请新开会话。其他 Agent 可挂 dsh-netxops/tools-nms|common|topology。",
capabilityGroupsHint: "一组一个 skill。ops = netx-ops(告警 + 纳管登录 + 路径);topology = netx-topology。默认 ops 开;topology / 公开关。保存后新会话生效。其他 Agent:dsh-netxops/tools-ops|topology。",
nmsProvider: "nms provider",
nmsProviderHint: "厂商适配器 id。当前支持:zte-ume(REST 仍为 /v1/ume/*;模型工具名为 netx__*Nms*)。",
groupNms: "nms — skill netx-nms(告警 / 库存 / SQL)",
groupCommon: "common — skill netx-common(纳管 CLI + findTopologyPaths)",
groupOps: "ops — skill netx-ops(NMS 告警/库存 + 纳管 CLI 登录 + 路径)",
groupTopology: "topology — skill netx-topology(画布 / Fabric / dual_unit)",
groupInPreset: "在 Netx Ops 预设中启用",
groupPublic: "对其他预设公开",

View file

@ -395,12 +395,11 @@ function resetAlarmSession() {
// src/netx/capability-groups.ts
var DEFAULT_CAPABILITY_GROUPS = Object.freeze({
nms: Object.freeze({ inPreset: true, public: false }),
common: Object.freeze({ inPreset: true, public: false }),
ops: Object.freeze({ inPreset: true, public: false }),
topology: Object.freeze({ inPreset: false, public: false })
});
var TOOLS_BY_GROUP = Object.freeze({
nms: Object.freeze([
ops: Object.freeze([
"netx__queryNmsAlarms",
"netx__aggregateNmsAlarms",
"netx__runNmsDiagnostics",
@ -409,9 +408,7 @@ var TOOLS_BY_GROUP = Object.freeze({
"netx__queryNmsAlarmsRaw",
"netx__aggregateNmsAlarmsRaw",
"netx__listNmsAlarmFields",
"netx__sqlQueryNms"
]),
common: Object.freeze([
"netx__sqlQueryNms",
"netx__listManagedNe",
"netx__getManagedNe",
"netx__execManagedNe",
@ -438,27 +435,32 @@ var TOOLS_BY_GROUP = Object.freeze({
])
});
var SKILL_DIR_BY_GROUP = Object.freeze({
nms: "nms",
common: "common",
ops: "ops",
topology: "topology"
});
var CAPABILITY_GROUP_IDS = Object.freeze([
"nms",
"common",
"ops",
"topology"
]);
function capabilityGroupsFromSettings(fields) {
const src = fields ?? {};
const commonInPreset = src.groupCommonInPreset !== undefined ? src.groupCommonInPreset !== false : src.groupManagedNeInPreset !== false;
const commonPublic = src.groupCommonPublic === true || src.groupManagedNePublic === true;
let opsInPreset = true;
if (src.groupOpsInPreset !== undefined) {
opsInPreset = src.groupOpsInPreset !== false;
} else {
const legacy = [
src.groupNmsInPreset,
src.groupCommonInPreset,
src.groupManagedNeInPreset
].filter((v) => v !== undefined);
if (legacy.length > 0) {
opsInPreset = legacy.some((v) => v === true);
}
}
return {
nms: {
inPreset: src.groupNmsInPreset !== false,
public: src.groupNmsPublic === true
},
common: {
inPreset: commonInPreset,
public: commonPublic
ops: {
inPreset: opsInPreset,
public: src.groupOpsPublic === true || src.groupNmsPublic === true || src.groupCommonPublic === true || src.groupManagedNePublic === true
},
topology: {
inPreset: src.groupTopologyInPreset === true || src.groupTopologyLayoutInPreset === true,
@ -2152,10 +2154,8 @@ var Config = z.object({
imBotId: z.string().default(""),
imTargetId: z.string().default(""),
nmsProvider: z.string().default("zte-ume"),
groupNmsInPreset: z.boolean().default(true),
groupNmsPublic: z.boolean().default(false),
groupCommonInPreset: z.boolean().default(true),
groupCommonPublic: z.boolean().default(false),
groupOpsInPreset: z.boolean().default(true),
groupOpsPublic: z.boolean().default(false),
groupTopologyInPreset: z.boolean().default(false),
groupTopologyPublic: z.boolean().default(false)
});