blun-king-cli 2.2.1 → 2.3.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/bin/blun.js +52 -1
- package/package.json +1 -1
package/bin/blun.js
CHANGED
|
@@ -2394,6 +2394,48 @@ async function main() {
|
|
|
2394
2394
|
refreshUI();
|
|
2395
2395
|
}
|
|
2396
2396
|
|
|
2397
|
+
// Intent detection: natural language → slash command
|
|
2398
|
+
var INTENTS = [
|
|
2399
|
+
{ patterns: ["verbinde.*telegram", "connect.*telegram", "telegram.*verbind", "telegram.*setup", "telegram.*einricht"], cmd: "/plugin telegram" },
|
|
2400
|
+
{ patterns: ["verbinde.*github", "connect.*github", "github.*setup"], cmd: "/plugin github" },
|
|
2401
|
+
{ patterns: ["verbinde.*slack", "connect.*slack", "slack.*setup"], cmd: "/plugin slack" },
|
|
2402
|
+
{ patterns: ["verbinde.*docker", "connect.*docker", "docker.*setup"], cmd: "/plugin docker" },
|
|
2403
|
+
{ patterns: ["plugin.*install", "plugin.*hinzuf", "erweiterung"], cmd: "/plugin" },
|
|
2404
|
+
{ patterns: ["mcp.*server", "mcp.*install", "mcp.*einricht"], cmd: "/mcp" },
|
|
2405
|
+
{ patterns: ["welches model", "which model", "modell.*wechsel", "model.*switch", "anderes.*model"], cmd: "/model" },
|
|
2406
|
+
{ patterns: ["permission", "berechtigung", "zugriff", "erlaubnis"], cmd: "/permissions" },
|
|
2407
|
+
{ patterns: ["einstellung", "setting", "config", "konfigur"], cmd: "/config" },
|
|
2408
|
+
{ patterns: ["health.*check", "gesundheit", "status.*check", "alles.*ok", "laeuft.*alles"], cmd: "/health" },
|
|
2409
|
+
{ patterns: ["zeig.*skills", "was kannst", "show.*skills", "faehigkeit"], cmd: "/skills" },
|
|
2410
|
+
{ patterns: ["zeig.*agent", "list.*agent", "welche.*agent"], cmd: "/agents" },
|
|
2411
|
+
{ patterns: ["screenshot.*mach", "screenshot.*von", "take.*screenshot"], cmd: null, extract: function(t) { var m = t.match(/(?:screenshot|bildschirmfoto).*?(https?:\/\/\S+)/i); return m ? "/screenshot " + m[1] : "/screenshot"; } },
|
|
2412
|
+
{ patterns: ["hilfe", "help", "was geht", "befehle"], cmd: "/help" },
|
|
2413
|
+
{ patterns: ["doctor", "diagnose", "problem.*check"], cmd: "/doctor" },
|
|
2414
|
+
{ patterns: ["login", "anmeld", "einlogg"], cmd: "/login" },
|
|
2415
|
+
{ patterns: ["logout", "abmeld", "auslogg"], cmd: "/logout" },
|
|
2416
|
+
{ patterns: ["komprimier", "compact", "zusammenfass"], cmd: "/compact" },
|
|
2417
|
+
{ patterns: ["kosten", "verbrauch", "cost", "tokens.*used"], cmd: "/cost" },
|
|
2418
|
+
{ patterns: ["update.*check", "neue.*version", "aktualisier"], cmd: "/versions" },
|
|
2419
|
+
{ patterns: ["speicher", "memory.*show", "was weisst.*du", "erinnerung"], cmd: "/memory" },
|
|
2420
|
+
{ patterns: ["hook", "webhook"], cmd: "/hooks" },
|
|
2421
|
+
];
|
|
2422
|
+
|
|
2423
|
+
function detectIntent(text) {
|
|
2424
|
+
var lower = text.toLowerCase();
|
|
2425
|
+
// Skip if text is long (probably a real chat message)
|
|
2426
|
+
if (text.length > 120) return null;
|
|
2427
|
+
for (var i = 0; i < INTENTS.length; i++) {
|
|
2428
|
+
var intent = INTENTS[i];
|
|
2429
|
+
for (var j = 0; j < intent.patterns.length; j++) {
|
|
2430
|
+
if (new RegExp(intent.patterns[j], "i").test(lower)) {
|
|
2431
|
+
if (intent.extract) return intent.extract(text);
|
|
2432
|
+
return intent.cmd;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
return null;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2397
2439
|
async function processInput(input) {
|
|
2398
2440
|
processing = true;
|
|
2399
2441
|
eraseUI();
|
|
@@ -2416,7 +2458,16 @@ async function main() {
|
|
|
2416
2458
|
await handleCommand(input);
|
|
2417
2459
|
runHook("post", input.split(/\s+/)[0].slice(1));
|
|
2418
2460
|
} else {
|
|
2419
|
-
|
|
2461
|
+
// Intent detection — natural language → command
|
|
2462
|
+
var detected = detectIntent(input);
|
|
2463
|
+
if (detected) {
|
|
2464
|
+
printInfo("→ " + detected);
|
|
2465
|
+
runHook("pre", detected.split(/\s+/)[0].slice(1));
|
|
2466
|
+
await handleCommand(detected);
|
|
2467
|
+
runHook("post", detected.split(/\s+/)[0].slice(1));
|
|
2468
|
+
} else {
|
|
2469
|
+
await sendChat(input);
|
|
2470
|
+
}
|
|
2420
2471
|
}
|
|
2421
2472
|
|
|
2422
2473
|
inputBuffer = "";
|