@ebowwa/stack 0.3.1 → 0.4.1
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/index.js +1877 -61879
- package/package.json +11 -7
- package/src/index.ts +12 -81
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebowwa/stack",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Cross-channel AI stack
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Cross-channel AI stack (SSH + Telegram + GLM)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -25,9 +25,7 @@
|
|
|
25
25
|
"ssh",
|
|
26
26
|
"ai",
|
|
27
27
|
"cross-channel",
|
|
28
|
-
"memory"
|
|
29
|
-
"ralph",
|
|
30
|
-
"node-agent"
|
|
28
|
+
"memory"
|
|
31
29
|
],
|
|
32
30
|
"author": "Ebowwa Labs <labs@ebowwa.com>",
|
|
33
31
|
"license": "MIT",
|
|
@@ -42,10 +40,16 @@
|
|
|
42
40
|
"@ebowwa/channel-ssh": "^2.1.1",
|
|
43
41
|
"@ebowwa/channel-telegram": "^1.14.2",
|
|
44
42
|
"@ebowwa/channel-types": "^0.2.1",
|
|
45
|
-
"@ebowwa/codespaces-types": "^1.6.1"
|
|
46
|
-
"@ebowwa/node-agent": "^0.6.5"
|
|
43
|
+
"@ebowwa/codespaces-types": "^1.6.1"
|
|
47
44
|
},
|
|
48
45
|
"devDependencies": {
|
|
49
46
|
"@types/bun": "latest"
|
|
47
|
+
},
|
|
48
|
+
"ownership": {
|
|
49
|
+
"domain": "state",
|
|
50
|
+
"responsibilities": [
|
|
51
|
+
"stack-operations",
|
|
52
|
+
"execution-context"
|
|
53
|
+
]
|
|
50
54
|
}
|
|
51
55
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
/**
|
|
3
|
-
* @ebowwa/stack - Cross-Channel AI Stack
|
|
3
|
+
* @ebowwa/stack - Cross-Channel AI Stack
|
|
4
4
|
*
|
|
5
5
|
* Features:
|
|
6
|
-
* -
|
|
6
|
+
* - Cross-channel communication (SSH + Telegram)
|
|
7
7
|
* - Cross-channel memory with permission controls
|
|
8
|
-
* - AI-powered message handling
|
|
9
|
-
* -
|
|
8
|
+
* - AI-powered message handling (GLM)
|
|
9
|
+
* - HTTP API for status/health
|
|
10
10
|
*
|
|
11
11
|
* Architecture:
|
|
12
12
|
* ┌──────────────────────────────────────────────────────────────┐
|
|
@@ -23,13 +23,10 @@
|
|
|
23
23
|
* │ │ (Cross-Context) │ │
|
|
24
24
|
* │ └─────────┬─────────┘ │
|
|
25
25
|
* │ │ │
|
|
26
|
-
* │
|
|
27
|
-
* │
|
|
28
|
-
* │
|
|
29
|
-
* │
|
|
30
|
-
* │ │ (GLM) │ │ (Ralph/Git/...) │ │
|
|
31
|
-
* │ └───────────────┘ │ [DISABLED] │ │
|
|
32
|
-
* │ └──────────────────┘ │
|
|
26
|
+
* │ ┌─────────▼─────────┐ │
|
|
27
|
+
* │ │ AI Brain │ │
|
|
28
|
+
* │ │ (GLM) │ │
|
|
29
|
+
* │ └───────────────────┘ │
|
|
33
30
|
* └──────────────────────────────────────────────────────────────┘
|
|
34
31
|
*/
|
|
35
32
|
|
|
@@ -38,11 +35,6 @@ import type { ChannelConnector, ChannelMessage, ChannelResponse, ChannelId } fro
|
|
|
38
35
|
import { GLMClient } from "@ebowwa/ai";
|
|
39
36
|
import { ToolExecutor, BUILTIN_TOOLS } from "@ebowwa/ai/tools";
|
|
40
37
|
|
|
41
|
-
// Node Agent types (lazy import to avoid bundling issues)
|
|
42
|
-
type RalphServiceType = InstanceType<typeof import("@ebowwa/node-agent/lib").RalphService>;
|
|
43
|
-
type GitServiceType = InstanceType<typeof import("@ebowwa/node-agent/lib").GitService>;
|
|
44
|
-
type ConsoleLoggerServiceType = InstanceType<typeof import("@ebowwa/node-agent/lib").ConsoleLoggerService>;
|
|
45
|
-
|
|
46
38
|
// ============================================================
|
|
47
39
|
// Types
|
|
48
40
|
// ============================================================
|
|
@@ -74,8 +66,6 @@ export interface StackConfig {
|
|
|
74
66
|
name: string;
|
|
75
67
|
hostname?: string;
|
|
76
68
|
};
|
|
77
|
-
/** Enable Node Agent features (Ralph, Git, etc.) */
|
|
78
|
-
enableNodeAgent?: boolean;
|
|
79
69
|
}
|
|
80
70
|
|
|
81
71
|
export interface StackState {
|
|
@@ -88,9 +78,6 @@ export interface StackState {
|
|
|
88
78
|
enabled: boolean;
|
|
89
79
|
port?: number;
|
|
90
80
|
};
|
|
91
|
-
nodeAgent: {
|
|
92
|
-
enabled: boolean;
|
|
93
|
-
};
|
|
94
81
|
}
|
|
95
82
|
|
|
96
83
|
// ============================================================
|
|
@@ -107,11 +94,6 @@ export class Stack {
|
|
|
107
94
|
private channels: Map<string, ChannelConnector> = new Map();
|
|
108
95
|
private abortController: AbortController | null = null;
|
|
109
96
|
|
|
110
|
-
// Node Agent services (lazy loaded to avoid bundling issues)
|
|
111
|
-
private ralphService: RalphServiceType | null = null;
|
|
112
|
-
private gitService: GitServiceType | null = null;
|
|
113
|
-
private consoleLogger: ConsoleLoggerServiceType | null = null;
|
|
114
|
-
|
|
115
97
|
constructor(config: StackConfig) {
|
|
116
98
|
this.config = {
|
|
117
99
|
...config,
|
|
@@ -124,10 +106,9 @@ export class Stack {
|
|
|
124
106
|
started: new Date(),
|
|
125
107
|
channels: { ssh: false, telegram: false },
|
|
126
108
|
api: { enabled: !!this.config.api, port: this.config.api?.port },
|
|
127
|
-
nodeAgent: { enabled: false },
|
|
128
109
|
};
|
|
129
110
|
|
|
130
|
-
// Build memory channels dynamically
|
|
111
|
+
// Build memory channels dynamically from enabled channels
|
|
131
112
|
const memoryChannels: Record<string, { memoryFile: string; maxMessages: number }> = {};
|
|
132
113
|
const permissions: Record<string, { canRead: string[] }> = {};
|
|
133
114
|
const enabledChannels: string[] = [];
|
|
@@ -155,14 +136,12 @@ export class Stack {
|
|
|
155
136
|
serverName: this.config.node.name,
|
|
156
137
|
hostname: this.config.node.hostname,
|
|
157
138
|
packageName: "@ebowwa/stack",
|
|
158
|
-
version: "0.
|
|
139
|
+
version: "0.4.0",
|
|
159
140
|
},
|
|
160
141
|
});
|
|
161
142
|
|
|
162
143
|
this.client = new GLMClient();
|
|
163
144
|
this.executor = new ToolExecutor(this.client, [...BUILTIN_TOOLS]);
|
|
164
|
-
|
|
165
|
-
// Node Agent services initialized lazily in initializeNodeAgent()
|
|
166
145
|
}
|
|
167
146
|
|
|
168
147
|
// ============================================================
|
|
@@ -202,38 +181,6 @@ export class Stack {
|
|
|
202
181
|
console.log("[Stack] Telegram registered");
|
|
203
182
|
}
|
|
204
183
|
|
|
205
|
-
// ============================================================
|
|
206
|
-
// Node Agent Initialization
|
|
207
|
-
// ============================================================
|
|
208
|
-
|
|
209
|
-
private async initializeNodeAgent(): Promise<void> {
|
|
210
|
-
console.log("[Stack] Initializing Node Agent services...");
|
|
211
|
-
|
|
212
|
-
// Lazy import to avoid bundling issues with node-agent
|
|
213
|
-
try {
|
|
214
|
-
const nodeAgent = await import("@ebowwa/node-agent/lib");
|
|
215
|
-
|
|
216
|
-
// Initialize services (features disabled for now)
|
|
217
|
-
this.ralphService = new nodeAgent.RalphService();
|
|
218
|
-
this.gitService = new nodeAgent.GitService();
|
|
219
|
-
this.consoleLogger = new nodeAgent.ConsoleLoggerService();
|
|
220
|
-
|
|
221
|
-
// Initialize state service
|
|
222
|
-
await nodeAgent.initializeStateService();
|
|
223
|
-
console.log("[Stack] State service initialized");
|
|
224
|
-
|
|
225
|
-
// TODO: Enable Ralph/Git when ready
|
|
226
|
-
// this.ralphService?.startMonitoring();
|
|
227
|
-
// this.gitService?.initialize();
|
|
228
|
-
|
|
229
|
-
this.state.nodeAgent.enabled = true;
|
|
230
|
-
console.log("[Stack] Node Agent services ready (Ralph/Git DISABLED)");
|
|
231
|
-
} catch (error) {
|
|
232
|
-
console.warn("[Stack] Node Agent initialization failed (non-critical):", error);
|
|
233
|
-
console.warn("[Stack] Continuing without Node Agent services");
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
184
|
// ============================================================
|
|
238
185
|
// Message Handler
|
|
239
186
|
// ============================================================
|
|
@@ -277,15 +224,6 @@ export class Stack {
|
|
|
277
224
|
};
|
|
278
225
|
}
|
|
279
226
|
|
|
280
|
-
// Ralph commands (DISABLED for now)
|
|
281
|
-
// if (text.startsWith("/ralph")) {
|
|
282
|
-
// stopTyping();
|
|
283
|
-
// return {
|
|
284
|
-
// content: { text: await this.handleRalphCommand(text) },
|
|
285
|
-
// replyTo: { messageId: message.messageId, channelId: message.channelId },
|
|
286
|
-
// };
|
|
287
|
-
// }
|
|
288
|
-
|
|
289
227
|
// Add to memory
|
|
290
228
|
this.memory.addMessage(channel, { role: "user", content: text });
|
|
291
229
|
|
|
@@ -334,7 +272,6 @@ export class Stack {
|
|
|
334
272
|
## Capabilities
|
|
335
273
|
- Cross-channel memory (shared context between channels)
|
|
336
274
|
- Tool execution via MCP
|
|
337
|
-
- Node monitoring and management
|
|
338
275
|
|
|
339
276
|
## Commands
|
|
340
277
|
- \`/status\` — Node status
|
|
@@ -343,7 +280,6 @@ export class Stack {
|
|
|
343
280
|
## Info
|
|
344
281
|
- Node: ${this.config.node.name}
|
|
345
282
|
- Channels: ${channelList}
|
|
346
|
-
- Node Agent: ${this.state.nodeAgent.enabled ? "ready (Ralph/Git disabled)" : "off"}
|
|
347
283
|
- API: :${this.config.api?.port ?? 8911}`;
|
|
348
284
|
}
|
|
349
285
|
|
|
@@ -351,7 +287,6 @@ export class Stack {
|
|
|
351
287
|
const lines = [
|
|
352
288
|
`**${this.config.node.name} Status**`,
|
|
353
289
|
`Channels: SSH=${this.state.channels.ssh}, Telegram=${this.state.channels.telegram}`,
|
|
354
|
-
`Node Agent: ${this.state.nodeAgent.enabled ? "ready (Ralph/Git disabled)" : "off"}`,
|
|
355
290
|
`Uptime: ${Math.floor((Date.now() - this.state.started.getTime()) / 1000)}s`,
|
|
356
291
|
];
|
|
357
292
|
return lines.join("\n");
|
|
@@ -384,15 +319,16 @@ export class Stack {
|
|
|
384
319
|
return new Response(null, { headers: corsHeaders });
|
|
385
320
|
}
|
|
386
321
|
|
|
322
|
+
// Stack status
|
|
387
323
|
if (path === "/api/status" && req.method === "GET") {
|
|
388
324
|
return Response.json({
|
|
389
325
|
node: this.config.node.name,
|
|
390
326
|
channels: this.state.channels,
|
|
391
|
-
nodeAgent: this.state.nodeAgent,
|
|
392
327
|
uptime: Math.floor((Date.now() - this.state.started.getTime()) / 1000),
|
|
393
328
|
}, { headers: corsHeaders });
|
|
394
329
|
}
|
|
395
330
|
|
|
331
|
+
// Health check
|
|
396
332
|
if (path === "/health") {
|
|
397
333
|
return Response.json({ status: "ok" }, { headers: corsHeaders });
|
|
398
334
|
}
|
|
@@ -413,9 +349,6 @@ export class Stack {
|
|
|
413
349
|
|
|
414
350
|
this.abortController = new AbortController();
|
|
415
351
|
|
|
416
|
-
// Initialize Node Agent (services ready but features disabled)
|
|
417
|
-
await this.initializeNodeAgent();
|
|
418
|
-
|
|
419
352
|
// Register channels
|
|
420
353
|
await this.registerSSH();
|
|
421
354
|
await this.registerTelegram();
|
|
@@ -435,7 +368,6 @@ export class Stack {
|
|
|
435
368
|
if (this.state.api.enabled) {
|
|
436
369
|
console.log(` - API: :${this.state.api.port}`);
|
|
437
370
|
}
|
|
438
|
-
console.log(" - Node Agent: ready (Ralph/Git disabled)");
|
|
439
371
|
console.log(" - Commands: /status, /memory <cmd>");
|
|
440
372
|
|
|
441
373
|
await new Promise(() => {});
|
|
@@ -481,7 +413,6 @@ async function main() {
|
|
|
481
413
|
name: process.env.NODE_NAME || "stack",
|
|
482
414
|
hostname: process.env.HOSTNAME || "localhost",
|
|
483
415
|
},
|
|
484
|
-
enableNodeAgent: process.env.ENABLE_NODE_AGENT !== "false",
|
|
485
416
|
};
|
|
486
417
|
|
|
487
418
|
const stack = new Stack(config);
|