MCPcopy Create free account
hub / github.com/MagicCube/agentara / Kernel

Class Kernel

src/kernel/kernel.ts:26–260  ·  view source on GitHub ↗

* The kernel is the main entry point for the agentara application. * Lazy-creation singleton: the instance is created on first `getInstance()`.

Source from the content-addressed store, hash-verified

24 * Lazy-creation singleton: the instance is created on first `getInstance()`.
25 */
26class Kernel {
27 private _logger = createLogger("kernel");
28 private _database!: DataConnection;
29 private _sessionManager!: SessionManager;
30 private _taskDispatcher!: TaskDispatcher;
31 private _messageGateway!: MultiChannelMessageGateway;
32 private _honoServer!: HonoServer;
33
34 constructor() {
35 this._initDatabase();
36 this._initSessionManager();
37 this._initTaskDispatcher();
38 this._initMessageGateway();
39 this._initServer();
40 }
41
42 get database(): DataConnection {
43 return this._database;
44 }
45
46 get sessionManager(): SessionManager {
47 return this._sessionManager;
48 }
49
50 get taskDispatcher(): TaskDispatcher {
51 return this._taskDispatcher;
52 }
53
54 get messageGateway(): MultiChannelMessageGateway {
55 return this._messageGateway;
56 }
57
58 get honoServer(): HonoServer {
59 return this._honoServer;
60 }
61
62 private _initDatabase(): void {
63 this._database = new DataConnection({
64 ...taskingSchema,
65 ...sessioningSchema,
66 ...feishuMessagingSchema,
67 });
68 }
69
70 private _initSessionManager(): void {
71 this._sessionManager = new SessionManager(this._database.db);
72 }
73
74 private _initServer(): void {
75 this._honoServer = new HonoServer();
76 }
77
78 private _initTaskDispatcher(): void {
79 this._taskDispatcher = new TaskDispatcher({
80 db: this._database.db,
81 });
82 this._taskDispatcher.route(
83 "inbound_message",

Callers

nothing calls this directly

Calls 13

createLoggerFunction · 0.90
extractTextContentFunction · 0.90
uuidFunction · 0.90
dispatchMethod · 0.80
deleteTaskMethod · 0.80
getTaskByMessageIdMethod · 0.80
resolveSessionMethod · 0.80
runMethod · 0.80
replyMessageMethod · 0.65
streamMethod · 0.65
updateMessageContentMethod · 0.65

Tested by

no test coverage detected