dante-watch 0.1.2 → 0.1.3
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/README.md +56 -23
- package/package.json +1 -1
- package/src/bib/answers.mjs +2 -2
- package/src/bib/bib.json +1 -1
- package/src/bib/ear.mjs +19 -18
- package/src/bib/net.json +1 -1
- package/src/bib/net.mjs +7 -9
- package/src/bib/probe.mjs +7 -8
- package/src/bib/pruef.json +1 -0
- package/src/bib/router.mjs +16 -19
- package/src/bib/system.mjs +14 -15
- package/src/bib/wash.mjs +5 -13
- package/src/checks/battery.mjs +15 -10
- package/src/checks/common.mjs +5 -5
- package/src/checks/demo.mjs +2 -2
- package/src/checks/formats.mjs +221 -0
- package/src/checks/hf.mjs +252 -0
- package/src/checks/loc.mjs +2 -4
- package/src/checks/php2shell.mjs +8 -9
- package/src/checks/rechte.mjs +2 -3
- package/src/checks/secrets.mjs +2 -4
- package/src/checks/sshd.mjs +3 -5
- package/src/checks/webshell.mjs +3 -5
- package/src/cli.mjs +15 -10
- package/src/core/check.mjs +4 -8
- package/src/core/consent.mjs +7 -7
- package/src/core/render.mjs +2 -2
- package/src/core/sh.mjs +12 -7
- package/src/i18n-checks.mjs +2 -3
- package/src/i18n.mjs +54 -14
- package/src/mascot.mjs +3 -5
- package/src/me/deep.mjs +37 -0
- package/src/me/diary.mjs +51 -0
- package/src/me/home.mjs +10 -0
- package/src/me/lock.mjs +41 -0
- package/src/me/nudge.mjs +52 -0
- package/src/me/onboard.mjs +102 -0
- package/src/me/overview.mjs +10 -0
- package/src/me/patrol.mjs +43 -0
- package/src/me/pick.mjs +64 -0
- package/src/me/pool.mjs +15 -0
- package/src/me/recon.mjs +94 -0
- package/src/me/refresh.mjs +70 -0
- package/src/me/schedule-deep.mjs +86 -0
- package/src/me/schedule.mjs +120 -0
- package/src/me/texts.mjs +291 -0
- package/src/me/user.mjs +67 -0
- package/src/pack/builtin.mjs +67 -4
- package/src/pack/ere.mjs +87 -0
- package/src/pack/install.mjs +6 -8
- package/src/pack/key.mjs +2 -3
- package/src/pack/know.mjs +4 -5
- package/src/pack/pack.mjs +14 -10
- package/src/pack/rules.mjs +109 -1
- package/src/pack/texts.mjs +8 -7
- package/src/session.mjs +199 -37
- package/src/ticker.mjs +10 -9
- package/src/ui/footer.mjs +3 -5
- package/src/ui/job-worker.mjs +3 -3
- package/src/ui/job.mjs +7 -6
- package/src/ui/quips.mjs +1 -2
- package/src/ui/wait.mjs +3 -4
- package/src/version.mjs +11 -0
package/src/bib/ear.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// category-first passed every category mix-up on (5 wrong instead of 2).
|
|
7
|
-
// Lines were written by DeepSeek playing real users, seeded by washed real goals; the real
|
|
8
|
-
// goals themselves are not in here.
|
|
1
|
+
// Builds the classifiers ("ears") from the language library shipped as src/bib/bib.json:
|
|
2
|
+
// category -> intent -> [line, level, language]. Levels: G bulk run, E1 general phrasing, E2 personal
|
|
3
|
+
// phrasing, E3 a user line with personal values replaced by placeholders.
|
|
4
|
+
// Intents are ranked across all categories at once; a category-first pass confused more lines in tests.
|
|
5
|
+
// The example lines are generated; no real user input is stored here.
|
|
9
6
|
import { readFileSync } from "node:fs";
|
|
10
7
|
import { train, classify, tokens, sureFor, KNOWN } from "./router.mjs";
|
|
11
8
|
import { wash } from "./wash.mjs";
|
|
@@ -19,18 +16,18 @@ export const rowsOf = (cats) => cats.flatMap((c) => Object.entries(load().cats[c
|
|
|
19
16
|
export const bibDate = () => load().date;
|
|
20
17
|
// Three neurons: the counting ear (bayes), the net, and the combiner (bayes^a · net^b, fitted on
|
|
21
18
|
// lines neither saw). WAY decides who may act:
|
|
22
|
-
// bayes
|
|
23
|
-
// einig
|
|
24
|
-
// kombi
|
|
25
|
-
// The ranked list a human sees ("Meinst du
|
|
19
|
+
// bayes - the counting ear alone
|
|
20
|
+
// einig - act only when both ears are sure on their own and say the same; else ask back
|
|
21
|
+
// kombi - the combiner's joint probability decides
|
|
22
|
+
// The ranked list a human sees ("Meinst du ...?") always comes from the joint probability.
|
|
26
23
|
// Measured per ear (25.10.): ohr bayes 131/138 · 1 wrong · einig 130 · 0 wrong · kombi 131 · 3 wrong
|
|
27
24
|
// janein bayes 30/33 · einig 30/33 · kombi 33/33 (it can never say yes)
|
|
28
25
|
const WAYS = { ohr: "einig", janein: "kombi", system: "einig", muster: "einig", wissen: "einig" };
|
|
29
26
|
export const setWay = (w) => { WAYS.ohr = WAYS.janein = WAYS.system = WAYS.muster = WAYS.wissen = w; };
|
|
30
27
|
const ears = {};
|
|
31
28
|
let nets = null;
|
|
32
|
-
// Exact memory
|
|
33
|
-
// "server root@1.2.3.4" meets "server {ZIEL}"
|
|
29
|
+
// Exact memory: a line that stands 1:1 in the bib - washed, so
|
|
30
|
+
// "server root@1.2.3.4" meets "server {ZIEL}" - is known, no probability in between. This is what
|
|
34
31
|
// makes E3 work: the trust rule keeps one line from deciding for OTHER lines, not for itself.
|
|
35
32
|
const exactKey = (t) => tokens(wash(t).text).join(" ");
|
|
36
33
|
// The domain ears (system, muster, wissen) sit behind the main ear's gap. Each also learns the lines of
|
|
@@ -69,15 +66,19 @@ export const hearMain = (line) => hear("ohr", ["befehle", "fragen", "smalltalk",
|
|
|
69
66
|
export const hearConsent = (line) => hear("janein", ["fixgespraech"], [], line);
|
|
70
67
|
// The third ear: only system knowledge (the sixth bib). The main ear decides it is a system job
|
|
71
68
|
// (pruef/server), THEN this ear picks the move: fingerabdruck / finde_php / pruef_php2shell / beleg /
|
|
72
|
-
// fix_php2shell. Kept apart from the five language bibs on purpose
|
|
69
|
+
// fix_php2shell. Kept apart from the five language bibs on purpose - no E1/E2/E3, family is a slot.
|
|
73
70
|
export const hearSystem = (line) => hear("system", ["systemwissen"], SYS_PROBE, line);
|
|
74
|
-
// The fourth ear: the Muster-Bib
|
|
71
|
+
// The fourth ear: the Muster-Bib - the watchman's "go and look for what's wrong" moves. Also sits
|
|
75
72
|
// behind the main ear's gap; conservative (einig) so plain talk is never pulled into a patrol.
|
|
76
73
|
export const hearMuster = (line) => hear("muster", ["muster"], MUSTER_PROBE, line);
|
|
77
|
-
// The fifth ear: the Fachwissen-Bib
|
|
74
|
+
// The fifth ear: the Fachwissen-Bib - when a person asks Dante to EXPLAIN (what he watches, one topic,
|
|
78
75
|
// what stands out, what is normal). It learns the way of asking; the topic comes from the cards.
|
|
79
76
|
export const hearWissen = (line) => hear("wissen", ["wissen"], WISSEN_PROBE, line);
|
|
80
77
|
|
|
78
|
+
// Words that are about Dante's own schedule. A line with one of them is never "end the session", whatever the
|
|
79
|
+
// main ear heard ("schalt dich scharf" sounds like "schalt dich aus" to it): a hard bolt, no probability.
|
|
80
|
+
export const SETUP_WORDS = /\b(scharf\w*|arm yourself|armed|armar|disarm\w*|desarm\w*|patrouill\w*|patrol\w*|patrull\w*|zeitplan\w*|schedul\w*|horario|automatisch\w*|automatic\w*|automátic\w*|von selbst|on your own|por tu cuenta)\b/i;
|
|
81
|
+
|
|
81
82
|
// The domain ears behind the main ear's gap, in the order they are asked. Each knows what is not its
|
|
82
83
|
// own (the negative class), so the first one that speaks is the right one. null = none of them.
|
|
83
84
|
export function hearDomain(line) {
|
|
@@ -94,7 +95,7 @@ const TELL = {
|
|
|
94
95
|
en: /\b(the|is|my|what|how|why|you|are|did|do|does|this|that|it|i|me|can|someone|safe|hacked|anywhere|even|wont)\b/gi,
|
|
95
96
|
de: /\b(der|die|das|ist|mein|meine|was|wie|warum|du|bin|ich|mir|kann|jemand|sicher|gehackt|nicht|und|heißt|überhaupt)\b/gi,
|
|
96
97
|
};
|
|
97
|
-
// No telling word at all ("fix", "demo")
|
|
98
|
+
// No telling word at all ("fix", "demo") -> the fallback, so one bare command does not flip him.
|
|
98
99
|
export const langOf = (line, fallback = "de") => {
|
|
99
100
|
let best = fallback, n = 0;
|
|
100
101
|
for (const [k, re] of Object.entries(TELL)) { const c = (String(line).match(re) || []).length; if (c > n) { n = c; best = k; } }
|