Update core/system_bus.js
Browse files- core/system_bus.js +17 -39
core/system_bus.js
CHANGED
|
@@ -1,49 +1,27 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
export function emit(eventType, payload) {
|
| 4 |
-
return route(eventType, payload);
|
| 5 |
-
}
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
|
| 11 |
-
|
| 12 |
-
return handleUserInput(payload);
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
default:
|
| 21 |
-
return {
|
| 22 |
-
status: "unknown_event",
|
| 23 |
-
payload
|
| 24 |
-
};
|
| 25 |
}
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
// PLACEHOLDERS (werden später verbunden)
|
| 29 |
-
function handleUserInput(data) {
|
| 30 |
-
return { next: "AI_CLASSIFICATION", data };
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
function handleIntent(data) {
|
| 34 |
-
return { next: "CORE_DECISION", data };
|
| 35 |
-
}
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
}
|
| 40 |
-
function normalize(eventType) {
|
| 41 |
-
|
| 42 |
-
const map = {
|
| 43 |
-
"FLOW": "system_flow",
|
| 44 |
-
"flow": "system_flow",
|
| 45 |
-
"Flow": "system_flow"
|
| 46 |
};
|
| 47 |
-
|
| 48 |
-
return map[eventType] || "unknown";
|
| 49 |
}
|
|
|
|
| 1 |
+
import { classify } from "../ai/classifier.js";
|
| 2 |
+
import { decide } from "./decision_engine.js";
|
| 3 |
+
import { saveEvent } from "./memory.js";
|
| 4 |
|
| 5 |
+
export async function emit(eventType, payload) {
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
if (eventType === "USER_INPUT") {
|
| 8 |
|
| 9 |
+
const classification = classify(payload.text);
|
| 10 |
|
| 11 |
+
const decision = decide(classification);
|
|
|
|
| 12 |
|
| 13 |
+
saveEvent({
|
| 14 |
+
input: payload.text,
|
| 15 |
+
classification,
|
| 16 |
+
decision
|
| 17 |
+
});
|
| 18 |
|
| 19 |
+
return {
|
| 20 |
+
message: decision.message
|
| 21 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
return {
|
| 25 |
+
message: "Unknown event"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
};
|
|
|
|
|
|
|
| 27 |
}
|