@ebowwa/stack 0.1.3 → 0.1.4

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 CHANGED
@@ -57488,8 +57488,19 @@ class Stack {
57488
57488
  const channel = channelId.platform;
57489
57489
  const text = message.text;
57490
57490
  console.log(`[${channel}] ${text.slice(0, 50)}...`);
57491
+ const telegramChannel = this.channels.get("telegram");
57492
+ const chatId = channelId.metadata?.chatId;
57493
+ if (channel === "telegram" && telegramChannel?.startTypingIndicator && chatId) {
57494
+ telegramChannel.startTypingIndicator(chatId);
57495
+ }
57496
+ const stopTyping = () => {
57497
+ if (channel === "telegram" && telegramChannel?.stopTypingIndicator && chatId) {
57498
+ telegramChannel.stopTypingIndicator(chatId);
57499
+ }
57500
+ };
57491
57501
  const cmdResult = parseMemoryCommand(this.memory, channel, text);
57492
57502
  if (cmdResult.handled) {
57503
+ stopTyping();
57493
57504
  return {
57494
57505
  content: { text: cmdResult.response || "Done" },
57495
57506
  replyTo: { messageId: message.messageId, channelId: message.channelId }
@@ -57497,6 +57508,7 @@ class Stack {
57497
57508
  }
57498
57509
  const ralphResult = await this.handleRalphCommand(channel, text);
57499
57510
  if (ralphResult) {
57511
+ stopTyping();
57500
57512
  return {
57501
57513
  content: { text: ralphResult },
57502
57514
  replyTo: { messageId: message.messageId, channelId: message.channelId }
@@ -57512,12 +57524,14 @@ class Stack {
57512
57524
  maxTokens: this.config.ai.maxTokens
57513
57525
  });
57514
57526
  this.memory.addMessage(channel, { role: "assistant", content: result.content });
57527
+ stopTyping();
57515
57528
  return {
57516
57529
  content: { text: result.content },
57517
57530
  replyTo: { messageId: message.messageId, channelId: message.channelId }
57518
57531
  };
57519
57532
  } catch (error) {
57520
57533
  const errorMsg = error instanceof Error ? error.message : String(error);
57534
+ stopTyping();
57521
57535
  return {
57522
57536
  content: { text: `Error: ${errorMsg}` },
57523
57537
  replyTo: { messageId: message.messageId, channelId: message.channelId }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebowwa/stack",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Full-stack daemon orchestrator combining unified-router (cross-channel) and node-agent (Ralph orchestration)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -213,9 +213,23 @@ export class Stack {
213
213
 
214
214
  console.log(`[${channel}] ${text.slice(0, 50)}...`);
215
215
 
216
+ // Start typing indicator for Telegram
217
+ const telegramChannel = this.channels.get("telegram") as { startTypingIndicator?: (chatId: string) => void; stopTypingIndicator?: (chatId: string) => void } | undefined;
218
+ const chatId = channelId.metadata?.chatId as string | undefined;
219
+ if (channel === "telegram" && telegramChannel?.startTypingIndicator && chatId) {
220
+ telegramChannel.startTypingIndicator(chatId);
221
+ }
222
+
223
+ const stopTyping = () => {
224
+ if (channel === "telegram" && telegramChannel?.stopTypingIndicator && chatId) {
225
+ telegramChannel.stopTypingIndicator(chatId);
226
+ }
227
+ };
228
+
216
229
  // Check for memory commands
217
230
  const cmdResult = parseMemoryCommand(this.memory, channel, text);
218
231
  if (cmdResult.handled) {
232
+ stopTyping();
219
233
  return {
220
234
  content: { text: cmdResult.response || "Done" },
221
235
  replyTo: { messageId: message.messageId, channelId: message.channelId },
@@ -225,6 +239,7 @@ export class Stack {
225
239
  // Check for Ralph commands
226
240
  const ralphResult = await this.handleRalphCommand(channel, text);
227
241
  if (ralphResult) {
242
+ stopTyping();
228
243
  return {
229
244
  content: { text: ralphResult },
230
245
  replyTo: { messageId: message.messageId, channelId: message.channelId },
@@ -252,6 +267,7 @@ export class Stack {
252
267
  });
253
268
 
254
269
  this.memory.addMessage(channel, { role: "assistant", content: result.content });
270
+ stopTyping();
255
271
 
256
272
  return {
257
273
  content: { text: result.content },
@@ -259,6 +275,7 @@ export class Stack {
259
275
  };
260
276
  } catch (error) {
261
277
  const errorMsg = error instanceof Error ? error.message : String(error);
278
+ stopTyping();
262
279
  return {
263
280
  content: { text: `Error: ${errorMsg}` },
264
281
  replyTo: { messageId: message.messageId, channelId: message.channelId },