@usex/mikrotik-mcp 6.16.0 → 6.17.0
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/cli.js +3 -3
- package/dist/index.js +1 -1
- package/dist/shared/{cli-8hn9vb7c.js → cli-87bbe6j5.js} +1 -1
- package/dist/shared/{cli-znnh8xtd.js → cli-a3wbtdan.js} +1 -1
- package/dist/shared/{cli-rs00sr7q.js → cli-fbt00t70.js} +1 -1
- package/dist/shared/{cli-rmtax5nd.js → cli-gjbdvacq.js} +1 -1
- package/dist/shared/{cli-kb8zq3rx.js → cli-p3kz2br3.js} +1 -1
- package/dist/shared/{cli-vf68spka.js → cli-qnd27b4y.js} +115 -12
- package/dist/shared/{cli-p7bt2fa3.js → cli-wzv67n8r.js} +1 -1
- package/dist/shared/{cli-8j89p9xc.js → cli-xbab17xp.js} +1 -1
- package/dist/shared/{library-rc32xwsh.js → library-4esmr0zw.js} +1 -1
- package/dist/shared/{library-rrzzp9qg.js → library-941sa041.js} +115 -12
- package/dist/shared/{library-s31n8vk4.js → library-d3zdg5db.js} +1 -1
- package/dist/shared/{library-m6wrdeqa.js → library-xgfbc20h.js} +1 -1
- package/dist/shared/{library-nbtg49vh.js → library-zntcre28.js} +1 -1
- package/dist/ui/observability.html +140 -140
- package/package.json +1 -1
- package/schemas/devtools-manifest.json +1 -1
- package/schemas/tool-catalog.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -375,7 +375,7 @@ import {
|
|
|
375
375
|
allToolModules2,
|
|
376
376
|
ALWAYS_ON_MODULES2,
|
|
377
377
|
selectToolModules2
|
|
378
|
-
} from "./shared/cli-
|
|
378
|
+
} from "./shared/cli-qnd27b4y.js";
|
|
379
379
|
|
|
380
380
|
// node_modules/ajv/dist/compile/codegen/code.js
|
|
381
381
|
var require_code = __commonJS(function(exports) {
|
|
@@ -21973,7 +21973,7 @@ async function main() {
|
|
|
21973
21973
|
`);
|
|
21974
21974
|
process.exit(2);
|
|
21975
21975
|
}
|
|
21976
|
-
const { runRemoteDashboard } = await import("./shared/cli-
|
|
21976
|
+
const { runRemoteDashboard } = await import("./shared/cli-87bbe6j5.js");
|
|
21977
21977
|
try {
|
|
21978
21978
|
runRemoteDashboard({
|
|
21979
21979
|
server,
|
|
@@ -22024,7 +22024,7 @@ async function main() {
|
|
|
22024
22024
|
logger.info(`Audit export: syslog ${cfg.audit.syslog.protocol}://${cfg.audit.syslog.host}:${cfg.audit.syslog.port}`);
|
|
22025
22025
|
}
|
|
22026
22026
|
if (cfg.mcp.semanticSearch)
|
|
22027
|
-
Promise.all([import("./shared/cli-
|
|
22027
|
+
Promise.all([import("./shared/cli-p3kz2br3.js"), import("./shared/cli-a3wbtdan.js")]).then(async ([gateway, semantic]) => semantic.startSemanticIndex(await gateway.semanticDocs())).catch(() => {});
|
|
22028
22028
|
if (cfg.approvals?.enabled) {
|
|
22029
22029
|
const notify = cfg.approvals.notify;
|
|
22030
22030
|
setApprovalNotifier((request) => {
|
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
updateSummaryLine,
|
|
71
71
|
allToolModules2,
|
|
72
72
|
selectToolModules2
|
|
73
|
-
} from "./shared/library-
|
|
73
|
+
} from "./shared/library-941sa041.js";
|
|
74
74
|
|
|
75
75
|
// node_modules/ajv/dist/compile/codegen/code.js
|
|
76
76
|
var require_code = __commonJS(function(exports) {
|
|
@@ -23086,13 +23086,13 @@ async function undoMigration(id, confirm, selected) {
|
|
|
23086
23086
|
throw new Error("Undo lost Safe Mode or exceeded its time budget.");
|
|
23087
23087
|
await checkedRead(item.undo, createContext(undefined, device));
|
|
23088
23088
|
}
|
|
23089
|
-
const beforeTarget = (await import("./cli-
|
|
23090
|
-
const db = await beforeTarget((await import("./cli-
|
|
23089
|
+
const beforeTarget = (await import("./cli-wzv67n8r.js")).openSnapshotStore;
|
|
23090
|
+
const db = await beforeTarget((await import("./cli-xbab17xp.js")).DEFAULT_SNAPSHOT_DB);
|
|
23091
23091
|
try {
|
|
23092
23092
|
const original = db.get(p.snapshots.target);
|
|
23093
23093
|
if (!original)
|
|
23094
23094
|
throw new Error("Original target snapshot unavailable.");
|
|
23095
|
-
const { normalizeExport } = await import("./cli-
|
|
23095
|
+
const { normalizeExport } = await import("./cli-gjbdvacq.js");
|
|
23096
23096
|
if (normalizeExport((await migrationInventory(device)).export) !== normalizeExport(original.body))
|
|
23097
23097
|
throw new Error("Target differs from its backup. Undo verification failed.");
|
|
23098
23098
|
} finally {
|
|
@@ -36026,6 +36026,7 @@ var SYNONYMS = {
|
|
|
36026
36026
|
edit: ["update", "set", "modify"]
|
|
36027
36027
|
};
|
|
36028
36028
|
var DOMAIN_WORDS = {
|
|
36029
|
+
fw: ["firewall", "filter"],
|
|
36029
36030
|
nameserver: ["dns"],
|
|
36030
36031
|
nameservers: ["dns"],
|
|
36031
36032
|
resolver: ["dns"],
|
|
@@ -36078,16 +36079,97 @@ var DOMAIN_WORDS = {
|
|
|
36078
36079
|
codes: ["vouchers"],
|
|
36079
36080
|
guests: ["hotspot", "vouchers"]
|
|
36080
36081
|
};
|
|
36082
|
+
var own2 = (table, key) => Object.hasOwn(table, key) ? table[key] : [];
|
|
36081
36083
|
function expandQuery(tokens) {
|
|
36082
36084
|
const out = new Set(tokens);
|
|
36083
36085
|
for (const t of tokens) {
|
|
36084
|
-
for (const s of SYNONYMS
|
|
36086
|
+
for (const s of own2(SYNONYMS, t))
|
|
36085
36087
|
out.add(s);
|
|
36086
|
-
for (const s of DOMAIN_WORDS
|
|
36088
|
+
for (const s of own2(DOMAIN_WORDS, t))
|
|
36087
36089
|
out.add(s);
|
|
36088
36090
|
}
|
|
36089
36091
|
return out;
|
|
36090
36092
|
}
|
|
36093
|
+
var FILLER = new Set(("a an the my me i we you your our it its is are was be of for by with and or that this these " + "those there please can could would should will want like need do does did go ahead thank " + "thanks very much every single how what which who why when where whether if then so just " + "also currently now have has had router routers mikrotik routeros").split(" "));
|
|
36094
|
+
var MAX_QUERY_WORDS = 64;
|
|
36095
|
+
function oneEditApart(a, b) {
|
|
36096
|
+
if (Math.abs(a.length - b.length) > 1)
|
|
36097
|
+
return false;
|
|
36098
|
+
let i = 0;
|
|
36099
|
+
while (i < a.length && i < b.length && a[i] === b[i])
|
|
36100
|
+
i++;
|
|
36101
|
+
const rest = (x, y) => a.slice(i + x) === b.slice(i + y);
|
|
36102
|
+
return rest(1, 1) || rest(1, 0) || rest(0, 1) || a[i] === b[i + 1] && a[i + 1] === b[i] && rest(2, 2);
|
|
36103
|
+
}
|
|
36104
|
+
function repairWord(word, df) {
|
|
36105
|
+
const forms = [
|
|
36106
|
+
word.replace(/ing$/, ""),
|
|
36107
|
+
word.replace(/ing$/, "e"),
|
|
36108
|
+
word.replace(/ed$/, ""),
|
|
36109
|
+
word.replace(/d$/, ""),
|
|
36110
|
+
word.replace(/ies$/, "y"),
|
|
36111
|
+
word.replace(/es$/, ""),
|
|
36112
|
+
word.replace(/s$/, ""),
|
|
36113
|
+
word.replace("our", "or")
|
|
36114
|
+
];
|
|
36115
|
+
const form = forms.find((f) => f !== word && df.has(f));
|
|
36116
|
+
if (form)
|
|
36117
|
+
return [form];
|
|
36118
|
+
if (word.length > 30)
|
|
36119
|
+
return [word];
|
|
36120
|
+
for (let cut = Math.floor(word.length / 2), step = 0;step < word.length; step++) {
|
|
36121
|
+
const at = cut + (step % 2 === 0 ? step / 2 : -(step + 1) / 2);
|
|
36122
|
+
if (at < 2 || at > word.length - 2)
|
|
36123
|
+
continue;
|
|
36124
|
+
if (df.has(word.slice(0, at)) && df.has(word.slice(at)))
|
|
36125
|
+
return [word.slice(0, at), word.slice(at)];
|
|
36126
|
+
}
|
|
36127
|
+
if (word.length < 4 || /^\d+$/.test(word))
|
|
36128
|
+
return [word];
|
|
36129
|
+
let best;
|
|
36130
|
+
for (const [known, count] of df) {
|
|
36131
|
+
if (known[0] !== word[0] || known.length < 4 || !oneEditApart(word, known))
|
|
36132
|
+
continue;
|
|
36133
|
+
if (!best || count > df.get(best))
|
|
36134
|
+
best = known;
|
|
36135
|
+
}
|
|
36136
|
+
return [best ?? word];
|
|
36137
|
+
}
|
|
36138
|
+
function queryWords(query, df) {
|
|
36139
|
+
let words = query.split(/[^A-Za-z0-9]+/).filter(Boolean).slice(0, MAX_QUERY_WORDS).flatMap((raw) => {
|
|
36140
|
+
const lower = raw.toLowerCase();
|
|
36141
|
+
if (df.has(lower))
|
|
36142
|
+
return [lower];
|
|
36143
|
+
return raw.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().split(" ");
|
|
36144
|
+
});
|
|
36145
|
+
const verb = ["turn", "power", "switch"].find((v) => words.includes(v));
|
|
36146
|
+
const state = ["off", "down", "on"].find((p) => words.includes(p));
|
|
36147
|
+
if (verb && state && (verb !== "power" || state !== "on")) {
|
|
36148
|
+
const meaning = verb === "power" ? "shutdown" : state === "on" ? "enable" : "disable";
|
|
36149
|
+
if (verb === "power" || state !== "down") {
|
|
36150
|
+
words = words.filter((w) => w !== state);
|
|
36151
|
+
words[words.indexOf(verb)] = meaning;
|
|
36152
|
+
}
|
|
36153
|
+
}
|
|
36154
|
+
for (let i = 0;i < words.length - 1; i++) {
|
|
36155
|
+
const one = words[i] + words[i + 1];
|
|
36156
|
+
if (!df.has(one) || df.has(words[i]) && df.has(words[i + 1]))
|
|
36157
|
+
continue;
|
|
36158
|
+
words.splice(i, 2, one);
|
|
36159
|
+
}
|
|
36160
|
+
const repaired = words.flatMap((w) => df.has(w) || Object.hasOwn(SYNONYMS, w) || Object.hasOwn(DOMAIN_WORDS, w) ? [w] : repairWord(w, df));
|
|
36161
|
+
const meaningful = repaired.filter((w) => !FILLER.has(w));
|
|
36162
|
+
return meaningful.length > 0 ? meaningful : repaired;
|
|
36163
|
+
}
|
|
36164
|
+
function otherNumber(word, df) {
|
|
36165
|
+
return [
|
|
36166
|
+
`${word}s`,
|
|
36167
|
+
`${word}es`,
|
|
36168
|
+
word.replace(/es$/, ""),
|
|
36169
|
+
word.replace(/s$/, ""),
|
|
36170
|
+
word.replace("our", "or")
|
|
36171
|
+
].filter((f) => f !== word && df.has(f));
|
|
36172
|
+
}
|
|
36091
36173
|
function buildToolIndex(tools) {
|
|
36092
36174
|
const entries = tools.map((t) => {
|
|
36093
36175
|
const nameTokens = tokenSet(t.name);
|
|
@@ -36102,7 +36184,8 @@ function buildToolIndex(tools) {
|
|
|
36102
36184
|
for (const tok of e.allTokens)
|
|
36103
36185
|
df.set(tok, (df.get(tok) ?? 0) + 1);
|
|
36104
36186
|
}
|
|
36105
|
-
|
|
36187
|
+
const verbs = new Set(tools.map((t) => tokenize3(t.name)[0] ?? ""));
|
|
36188
|
+
return { entries, df, n: entries.length, verbs };
|
|
36106
36189
|
}
|
|
36107
36190
|
var FIELD_WEIGHT = { name: 6, title: 3.5, module: 3, desc: 1.5 };
|
|
36108
36191
|
function idf(df, n, token) {
|
|
@@ -36125,13 +36208,31 @@ function domainFactor(entry, qTokens) {
|
|
|
36125
36208
|
}
|
|
36126
36209
|
function searchToolIndex(index, query, limit = 8) {
|
|
36127
36210
|
const qRaw = query.trim().toLowerCase();
|
|
36128
|
-
const qList =
|
|
36211
|
+
const qList = queryWords(query, index.df);
|
|
36129
36212
|
if (qList.length === 0)
|
|
36130
36213
|
return [];
|
|
36131
|
-
const
|
|
36132
|
-
const
|
|
36214
|
+
const joined = qList.slice(1).map((t, i) => qList[i] + t).filter((t) => index.df.has(t));
|
|
36215
|
+
const qOriginal = new Set([...qList, ...joined]);
|
|
36216
|
+
const qTokens = expandQuery([...qList, ...joined]);
|
|
36217
|
+
for (const t of qList)
|
|
36218
|
+
for (const f of otherNumber(t, index.df))
|
|
36219
|
+
qTokens.add(f);
|
|
36133
36220
|
const qUnderscored = qRaw.replace(/\s+/g, "_");
|
|
36134
|
-
const nameHasIntent = (entry, t) => entry.nameTokens.has(t) || (SYNONYMS
|
|
36221
|
+
const nameHasIntent = (entry, t) => entry.nameTokens.has(t) || own2(SYNONYMS, t).some((s) => entry.nameTokens.has(s)) || otherNumber(t, index.df).some((s) => entry.nameTokens.has(s));
|
|
36222
|
+
for (const t of qList.slice(0, 1)) {
|
|
36223
|
+
if (index.verbs.has(t))
|
|
36224
|
+
continue;
|
|
36225
|
+
const verb = [
|
|
36226
|
+
t.replace(/ing$/, ""),
|
|
36227
|
+
t.replace(/ing$/, "e"),
|
|
36228
|
+
t.replace(/ed$/, ""),
|
|
36229
|
+
t.replace(/d$/, "")
|
|
36230
|
+
].find((f) => f !== t && index.verbs.has(f));
|
|
36231
|
+
if (verb)
|
|
36232
|
+
for (const v of expandQuery([verb]))
|
|
36233
|
+
qTokens.add(v);
|
|
36234
|
+
}
|
|
36235
|
+
const verbless = qList.length <= 3 && ![...qTokens].some((t) => Object.hasOwn(SYNONYMS, t) || index.verbs.has(t));
|
|
36135
36236
|
const scored = index.entries.map((entry, i) => {
|
|
36136
36237
|
let s = 0;
|
|
36137
36238
|
for (const t of qTokens) {
|
|
@@ -36149,6 +36250,8 @@ function searchToolIndex(index, query, limit = 8) {
|
|
|
36149
36250
|
if (qRaw.length > 2 && entry.title.toLowerCase().includes(qRaw))
|
|
36150
36251
|
s += 3;
|
|
36151
36252
|
s *= domainFactor(entry, qTokens);
|
|
36253
|
+
if (verbless && /^(?:list|show)_/.test(entry.name))
|
|
36254
|
+
s *= 1.25;
|
|
36152
36255
|
return { entry, s, i };
|
|
36153
36256
|
});
|
|
36154
36257
|
return scored.filter((r) => r.s > 0).sort((a, b) => b.s - a.s || a.i - b.i).slice(0, Math.max(1, limit)).map((r) => ({
|
|
@@ -36168,7 +36271,7 @@ var cache3 = null;
|
|
|
36168
36271
|
async function gateway() {
|
|
36169
36272
|
if (cache3)
|
|
36170
36273
|
return cache3;
|
|
36171
|
-
const { moduleCatalog } = await import("./cli-
|
|
36274
|
+
const { moduleCatalog } = await import("./cli-fbt00t70.js");
|
|
36172
36275
|
const forIndex = [];
|
|
36173
36276
|
const byName = new Map;
|
|
36174
36277
|
for (const mod of moduleCatalog) {
|
|
@@ -63393,7 +63496,7 @@ var riskByTool = null;
|
|
|
63393
63496
|
async function riskIndex() {
|
|
63394
63497
|
if (riskByTool)
|
|
63395
63498
|
return riskByTool;
|
|
63396
|
-
const { moduleCatalog } = await import("./cli-
|
|
63499
|
+
const { moduleCatalog } = await import("./cli-fbt00t70.js");
|
|
63397
63500
|
const index = new Map;
|
|
63398
63501
|
for (const mod of moduleCatalog) {
|
|
63399
63502
|
for (const tool of mod.tools)
|
|
@@ -21775,13 +21775,13 @@ async function undoMigration(id, confirm, selected) {
|
|
|
21775
21775
|
throw new Error("Undo lost Safe Mode or exceeded its time budget.");
|
|
21776
21776
|
await checkedRead(item.undo, createContext(undefined, device));
|
|
21777
21777
|
}
|
|
21778
|
-
const beforeTarget = (await import("./library-
|
|
21779
|
-
const db = await beforeTarget((await import("./library-
|
|
21778
|
+
const beforeTarget = (await import("./library-d3zdg5db.js")).openSnapshotStore;
|
|
21779
|
+
const db = await beforeTarget((await import("./library-xgfbc20h.js")).DEFAULT_SNAPSHOT_DB);
|
|
21780
21780
|
try {
|
|
21781
21781
|
const original = db.get(p.snapshots.target);
|
|
21782
21782
|
if (!original)
|
|
21783
21783
|
throw new Error("Original target snapshot unavailable.");
|
|
21784
|
-
const { normalizeExport } = await import("./library-
|
|
21784
|
+
const { normalizeExport } = await import("./library-4esmr0zw.js");
|
|
21785
21785
|
if (normalizeExport((await migrationInventory(device)).export) !== normalizeExport(original.body))
|
|
21786
21786
|
throw new Error("Target differs from its backup. Undo verification failed.");
|
|
21787
21787
|
} finally {
|
|
@@ -35207,6 +35207,7 @@ var SYNONYMS = {
|
|
|
35207
35207
|
edit: ["update", "set", "modify"]
|
|
35208
35208
|
};
|
|
35209
35209
|
var DOMAIN_WORDS = {
|
|
35210
|
+
fw: ["firewall", "filter"],
|
|
35210
35211
|
nameserver: ["dns"],
|
|
35211
35212
|
nameservers: ["dns"],
|
|
35212
35213
|
resolver: ["dns"],
|
|
@@ -35259,16 +35260,97 @@ var DOMAIN_WORDS = {
|
|
|
35259
35260
|
codes: ["vouchers"],
|
|
35260
35261
|
guests: ["hotspot", "vouchers"]
|
|
35261
35262
|
};
|
|
35263
|
+
var own2 = (table, key) => Object.hasOwn(table, key) ? table[key] : [];
|
|
35262
35264
|
function expandQuery(tokens) {
|
|
35263
35265
|
const out = new Set(tokens);
|
|
35264
35266
|
for (const t of tokens) {
|
|
35265
|
-
for (const s of SYNONYMS
|
|
35267
|
+
for (const s of own2(SYNONYMS, t))
|
|
35266
35268
|
out.add(s);
|
|
35267
|
-
for (const s of DOMAIN_WORDS
|
|
35269
|
+
for (const s of own2(DOMAIN_WORDS, t))
|
|
35268
35270
|
out.add(s);
|
|
35269
35271
|
}
|
|
35270
35272
|
return out;
|
|
35271
35273
|
}
|
|
35274
|
+
var FILLER = new Set(("a an the my me i we you your our it its is are was be of for by with and or that this these " + "those there please can could would should will want like need do does did go ahead thank " + "thanks very much every single how what which who why when where whether if then so just " + "also currently now have has had router routers mikrotik routeros").split(" "));
|
|
35275
|
+
var MAX_QUERY_WORDS = 64;
|
|
35276
|
+
function oneEditApart(a, b) {
|
|
35277
|
+
if (Math.abs(a.length - b.length) > 1)
|
|
35278
|
+
return false;
|
|
35279
|
+
let i = 0;
|
|
35280
|
+
while (i < a.length && i < b.length && a[i] === b[i])
|
|
35281
|
+
i++;
|
|
35282
|
+
const rest = (x, y) => a.slice(i + x) === b.slice(i + y);
|
|
35283
|
+
return rest(1, 1) || rest(1, 0) || rest(0, 1) || a[i] === b[i + 1] && a[i + 1] === b[i] && rest(2, 2);
|
|
35284
|
+
}
|
|
35285
|
+
function repairWord(word, df) {
|
|
35286
|
+
const forms = [
|
|
35287
|
+
word.replace(/ing$/, ""),
|
|
35288
|
+
word.replace(/ing$/, "e"),
|
|
35289
|
+
word.replace(/ed$/, ""),
|
|
35290
|
+
word.replace(/d$/, ""),
|
|
35291
|
+
word.replace(/ies$/, "y"),
|
|
35292
|
+
word.replace(/es$/, ""),
|
|
35293
|
+
word.replace(/s$/, ""),
|
|
35294
|
+
word.replace("our", "or")
|
|
35295
|
+
];
|
|
35296
|
+
const form = forms.find((f) => f !== word && df.has(f));
|
|
35297
|
+
if (form)
|
|
35298
|
+
return [form];
|
|
35299
|
+
if (word.length > 30)
|
|
35300
|
+
return [word];
|
|
35301
|
+
for (let cut = Math.floor(word.length / 2), step = 0;step < word.length; step++) {
|
|
35302
|
+
const at = cut + (step % 2 === 0 ? step / 2 : -(step + 1) / 2);
|
|
35303
|
+
if (at < 2 || at > word.length - 2)
|
|
35304
|
+
continue;
|
|
35305
|
+
if (df.has(word.slice(0, at)) && df.has(word.slice(at)))
|
|
35306
|
+
return [word.slice(0, at), word.slice(at)];
|
|
35307
|
+
}
|
|
35308
|
+
if (word.length < 4 || /^\d+$/.test(word))
|
|
35309
|
+
return [word];
|
|
35310
|
+
let best;
|
|
35311
|
+
for (const [known, count] of df) {
|
|
35312
|
+
if (known[0] !== word[0] || known.length < 4 || !oneEditApart(word, known))
|
|
35313
|
+
continue;
|
|
35314
|
+
if (!best || count > df.get(best))
|
|
35315
|
+
best = known;
|
|
35316
|
+
}
|
|
35317
|
+
return [best ?? word];
|
|
35318
|
+
}
|
|
35319
|
+
function queryWords(query, df) {
|
|
35320
|
+
let words = query.split(/[^A-Za-z0-9]+/).filter(Boolean).slice(0, MAX_QUERY_WORDS).flatMap((raw) => {
|
|
35321
|
+
const lower = raw.toLowerCase();
|
|
35322
|
+
if (df.has(lower))
|
|
35323
|
+
return [lower];
|
|
35324
|
+
return raw.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().split(" ");
|
|
35325
|
+
});
|
|
35326
|
+
const verb = ["turn", "power", "switch"].find((v) => words.includes(v));
|
|
35327
|
+
const state = ["off", "down", "on"].find((p) => words.includes(p));
|
|
35328
|
+
if (verb && state && (verb !== "power" || state !== "on")) {
|
|
35329
|
+
const meaning = verb === "power" ? "shutdown" : state === "on" ? "enable" : "disable";
|
|
35330
|
+
if (verb === "power" || state !== "down") {
|
|
35331
|
+
words = words.filter((w) => w !== state);
|
|
35332
|
+
words[words.indexOf(verb)] = meaning;
|
|
35333
|
+
}
|
|
35334
|
+
}
|
|
35335
|
+
for (let i = 0;i < words.length - 1; i++) {
|
|
35336
|
+
const one = words[i] + words[i + 1];
|
|
35337
|
+
if (!df.has(one) || df.has(words[i]) && df.has(words[i + 1]))
|
|
35338
|
+
continue;
|
|
35339
|
+
words.splice(i, 2, one);
|
|
35340
|
+
}
|
|
35341
|
+
const repaired = words.flatMap((w) => df.has(w) || Object.hasOwn(SYNONYMS, w) || Object.hasOwn(DOMAIN_WORDS, w) ? [w] : repairWord(w, df));
|
|
35342
|
+
const meaningful = repaired.filter((w) => !FILLER.has(w));
|
|
35343
|
+
return meaningful.length > 0 ? meaningful : repaired;
|
|
35344
|
+
}
|
|
35345
|
+
function otherNumber(word, df) {
|
|
35346
|
+
return [
|
|
35347
|
+
`${word}s`,
|
|
35348
|
+
`${word}es`,
|
|
35349
|
+
word.replace(/es$/, ""),
|
|
35350
|
+
word.replace(/s$/, ""),
|
|
35351
|
+
word.replace("our", "or")
|
|
35352
|
+
].filter((f) => f !== word && df.has(f));
|
|
35353
|
+
}
|
|
35272
35354
|
function buildToolIndex(tools) {
|
|
35273
35355
|
const entries = tools.map((t) => {
|
|
35274
35356
|
const nameTokens = tokenSet(t.name);
|
|
@@ -35283,7 +35365,8 @@ function buildToolIndex(tools) {
|
|
|
35283
35365
|
for (const tok of e.allTokens)
|
|
35284
35366
|
df.set(tok, (df.get(tok) ?? 0) + 1);
|
|
35285
35367
|
}
|
|
35286
|
-
|
|
35368
|
+
const verbs = new Set(tools.map((t) => tokenize3(t.name)[0] ?? ""));
|
|
35369
|
+
return { entries, df, n: entries.length, verbs };
|
|
35287
35370
|
}
|
|
35288
35371
|
var FIELD_WEIGHT = { name: 6, title: 3.5, module: 3, desc: 1.5 };
|
|
35289
35372
|
function idf(df, n, token) {
|
|
@@ -35306,13 +35389,31 @@ function domainFactor(entry, qTokens) {
|
|
|
35306
35389
|
}
|
|
35307
35390
|
function searchToolIndex(index, query, limit = 8) {
|
|
35308
35391
|
const qRaw = query.trim().toLowerCase();
|
|
35309
|
-
const qList =
|
|
35392
|
+
const qList = queryWords(query, index.df);
|
|
35310
35393
|
if (qList.length === 0)
|
|
35311
35394
|
return [];
|
|
35312
|
-
const
|
|
35313
|
-
const
|
|
35395
|
+
const joined = qList.slice(1).map((t, i) => qList[i] + t).filter((t) => index.df.has(t));
|
|
35396
|
+
const qOriginal = new Set([...qList, ...joined]);
|
|
35397
|
+
const qTokens = expandQuery([...qList, ...joined]);
|
|
35398
|
+
for (const t of qList)
|
|
35399
|
+
for (const f of otherNumber(t, index.df))
|
|
35400
|
+
qTokens.add(f);
|
|
35314
35401
|
const qUnderscored = qRaw.replace(/\s+/g, "_");
|
|
35315
|
-
const nameHasIntent = (entry, t) => entry.nameTokens.has(t) || (SYNONYMS
|
|
35402
|
+
const nameHasIntent = (entry, t) => entry.nameTokens.has(t) || own2(SYNONYMS, t).some((s) => entry.nameTokens.has(s)) || otherNumber(t, index.df).some((s) => entry.nameTokens.has(s));
|
|
35403
|
+
for (const t of qList.slice(0, 1)) {
|
|
35404
|
+
if (index.verbs.has(t))
|
|
35405
|
+
continue;
|
|
35406
|
+
const verb = [
|
|
35407
|
+
t.replace(/ing$/, ""),
|
|
35408
|
+
t.replace(/ing$/, "e"),
|
|
35409
|
+
t.replace(/ed$/, ""),
|
|
35410
|
+
t.replace(/d$/, "")
|
|
35411
|
+
].find((f) => f !== t && index.verbs.has(f));
|
|
35412
|
+
if (verb)
|
|
35413
|
+
for (const v of expandQuery([verb]))
|
|
35414
|
+
qTokens.add(v);
|
|
35415
|
+
}
|
|
35416
|
+
const verbless = qList.length <= 3 && ![...qTokens].some((t) => Object.hasOwn(SYNONYMS, t) || index.verbs.has(t));
|
|
35316
35417
|
const scored = index.entries.map((entry, i) => {
|
|
35317
35418
|
let s = 0;
|
|
35318
35419
|
for (const t of qTokens) {
|
|
@@ -35330,6 +35431,8 @@ function searchToolIndex(index, query, limit = 8) {
|
|
|
35330
35431
|
if (qRaw.length > 2 && entry.title.toLowerCase().includes(qRaw))
|
|
35331
35432
|
s += 3;
|
|
35332
35433
|
s *= domainFactor(entry, qTokens);
|
|
35434
|
+
if (verbless && /^(?:list|show)_/.test(entry.name))
|
|
35435
|
+
s *= 1.25;
|
|
35333
35436
|
return { entry, s, i };
|
|
35334
35437
|
});
|
|
35335
35438
|
return scored.filter((r) => r.s > 0).sort((a, b) => b.s - a.s || a.i - b.i).slice(0, Math.max(1, limit)).map((r) => ({
|
|
@@ -35349,7 +35452,7 @@ var cache3 = null;
|
|
|
35349
35452
|
async function gateway() {
|
|
35350
35453
|
if (cache3)
|
|
35351
35454
|
return cache3;
|
|
35352
|
-
const { moduleCatalog } = await import("./library-
|
|
35455
|
+
const { moduleCatalog } = await import("./library-zntcre28.js");
|
|
35353
35456
|
const forIndex = [];
|
|
35354
35457
|
const byName = new Map;
|
|
35355
35458
|
for (const mod of moduleCatalog) {
|
|
@@ -62265,7 +62368,7 @@ var riskByTool = null;
|
|
|
62265
62368
|
async function riskIndex() {
|
|
62266
62369
|
if (riskByTool)
|
|
62267
62370
|
return riskByTool;
|
|
62268
|
-
const { moduleCatalog } = await import("./library-
|
|
62371
|
+
const { moduleCatalog } = await import("./library-zntcre28.js");
|
|
62269
62372
|
const index = new Map;
|
|
62270
62373
|
for (const mod of moduleCatalog) {
|
|
62271
62374
|
for (const tool of mod.tools)
|