@ebowwa/channel-telegram 1.14.7 → 1.14.8
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/commands/index.d.ts +32 -18
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +45 -36
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/quiet.d.ts +0 -8
- package/dist/commands/quiet.d.ts.map +1 -1
- package/dist/commands/quiet.js +2 -24
- package/dist/commands/quiet.js.map +1 -1
- package/dist/commands/resources.d.ts +2 -1
- package/dist/commands/resources.d.ts.map +1 -1
- package/dist/commands/resources.js +8 -1
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/restart.d.ts +2 -1
- package/dist/commands/restart.d.ts.map +1 -1
- package/dist/commands/restart.js +1 -1
- package/dist/commands/restart.js.map +1 -1
- package/dist/commands/types.d.ts +18 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/verbose.d.ts.map +1 -1
- package/dist/commands/verbose.js +2 -5
- package/dist/commands/verbose.js.map +1 -1
- package/package.json +10 -2
- package/src/commands/index.ts +77 -39
- package/src/commands/quiet.ts +2 -28
- package/src/commands/resources.ts +11 -2
- package/src/commands/restart.ts +2 -1
- package/src/commands/types.ts +20 -0
- package/src/commands/verbose.ts +2 -6
package/dist/commands/index.d.ts
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Command index -
|
|
2
|
+
* Command index - Single source of truth for commands
|
|
3
|
+
*
|
|
4
|
+
* Each command exports a CommandDefinition with:
|
|
5
|
+
* - command: name (without /)
|
|
6
|
+
* - description: for Telegram menu
|
|
7
|
+
* - register: function to set up handler
|
|
3
8
|
*/
|
|
4
|
-
export { registerStartCommand } from './start';
|
|
5
|
-
export { registerStatusCommand } from './status';
|
|
6
|
-
export { registerHelpCommand } from './help';
|
|
7
|
-
export { registerGitCommand } from './git';
|
|
8
|
-
export { registerDopplerCommand } from './doppler';
|
|
9
|
-
export { registerLogsCommand } from './logs';
|
|
10
|
-
export { registerClearCommand } from './clear';
|
|
11
|
-
export { registerToolsCommand } from './tools';
|
|
12
|
-
export { registerResourcesCommand } from './resources';
|
|
13
|
-
export { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
14
|
-
export { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
15
|
-
export { registerResumeCommand } from './resume';
|
|
16
|
-
export { registerQuietCommand, isQuiet, clearQuiet } from './quiet';
|
|
17
|
-
export { registerVerboseCommand } from './verbose';
|
|
18
|
-
export { register as registerRestartCommand } from './restart';
|
|
19
|
-
export type { CommandRegistrar, CommandContext } from './types';
|
|
20
9
|
import type TelegramBot from 'node-telegram-bot-api';
|
|
10
|
+
import { registerResourcesCommand } from './resources';
|
|
11
|
+
import { registerStartCommand } from './start';
|
|
12
|
+
import { registerStatusCommand } from './status';
|
|
13
|
+
import { registerHelpCommand } from './help';
|
|
14
|
+
import { registerGitCommand } from './git';
|
|
15
|
+
import { registerDopplerCommand } from './doppler';
|
|
16
|
+
import { registerLogsCommand } from './logs';
|
|
17
|
+
import { registerClearCommand } from './clear';
|
|
18
|
+
import { registerToolsCommand } from './tools';
|
|
19
|
+
import { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
20
|
+
import { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
21
|
+
import { registerResumeCommand } from './resume';
|
|
22
|
+
import { registerQuietCommand } from './quiet';
|
|
23
|
+
import { isQuiet, clearQuiet } from '@ebowwa/channel-core';
|
|
24
|
+
import { registerVerboseCommand } from './verbose';
|
|
25
|
+
import { register as registerRestartCommand } from './restart';
|
|
26
|
+
export type { CommandDefinition, CommandRegistrar, CommandContext } from './types';
|
|
27
|
+
export { registerStartCommand, registerStatusCommand, registerHelpCommand, registerGitCommand, registerDopplerCommand, registerLogsCommand, registerClearCommand, registerToolsCommand, registerResourcesCommand, registerCancelCommand, registerPauseCommand, registerResumeCommand, registerQuietCommand, registerVerboseCommand, registerRestartCommand, isCancelled, clearCancel, isPaused, waitWhilePaused, clearPause, isQuiet, clearQuiet, };
|
|
21
28
|
/**
|
|
22
|
-
* Register all
|
|
29
|
+
* Register all command handlers with the bot
|
|
23
30
|
*/
|
|
24
31
|
export declare function registerAllCommands(bot: TelegramBot, memory: import('../conversation-memory').ConversationMemory, tools: import('../index').Tool[]): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get menu entries for Telegram's command suggestions
|
|
34
|
+
*/
|
|
35
|
+
export declare function getCommandMenu(): Array<{
|
|
36
|
+
command: string;
|
|
37
|
+
description: string;
|
|
38
|
+
}>;
|
|
25
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;AAIrD,OAAO,EAAoB,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,QAAQ,IAAI,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAG/D,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGnF,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,OAAO,EACP,UAAU,GACX,CAAC;AAwBF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,OAAO,wBAAwB,EAAE,kBAAkB,EAC3D,KAAK,EAAE,OAAO,UAAU,EAAE,IAAI,EAAE,GAC/B,IAAI,CAIN;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAEhF"}
|
package/dist/commands/index.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Command index -
|
|
2
|
+
* Command index - Single source of truth for commands
|
|
3
|
+
*
|
|
4
|
+
* Each command exports a CommandDefinition with:
|
|
5
|
+
* - command: name (without /)
|
|
6
|
+
* - description: for Telegram menu
|
|
7
|
+
* - register: function to set up handler
|
|
3
8
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { registerGitCommand } from './git';
|
|
8
|
-
export { registerDopplerCommand } from './doppler';
|
|
9
|
-
export { registerLogsCommand } from './logs';
|
|
10
|
-
export { registerClearCommand } from './clear';
|
|
11
|
-
export { registerToolsCommand } from './tools';
|
|
12
|
-
export { registerResourcesCommand } from './resources';
|
|
13
|
-
export { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
14
|
-
export { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
15
|
-
export { registerResumeCommand } from './resume';
|
|
16
|
-
export { registerQuietCommand, isQuiet, clearQuiet } from './quiet';
|
|
17
|
-
export { registerVerboseCommand } from './verbose';
|
|
18
|
-
export { register as registerRestartCommand } from './restart';
|
|
19
|
-
import { register as importedRegisterRestart } from './restart';
|
|
9
|
+
// Import command definitions
|
|
10
|
+
import { resourcesCommand, registerResourcesCommand } from './resources';
|
|
11
|
+
// Legacy imports (to be migrated)
|
|
20
12
|
import { registerStartCommand } from './start';
|
|
21
13
|
import { registerStatusCommand } from './status';
|
|
22
14
|
import { registerHelpCommand } from './help';
|
|
@@ -25,30 +17,47 @@ import { registerDopplerCommand } from './doppler';
|
|
|
25
17
|
import { registerLogsCommand } from './logs';
|
|
26
18
|
import { registerClearCommand } from './clear';
|
|
27
19
|
import { registerToolsCommand } from './tools';
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { registerPauseCommand } from './pause';
|
|
20
|
+
import { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
21
|
+
import { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
31
22
|
import { registerResumeCommand } from './resume';
|
|
32
23
|
import { registerQuietCommand } from './quiet';
|
|
24
|
+
import { isQuiet, clearQuiet } from '@ebowwa/channel-core';
|
|
33
25
|
import { registerVerboseCommand } from './verbose';
|
|
26
|
+
import { register as registerRestartCommand } from './restart';
|
|
27
|
+
// Export legacy functions for backwards compatibility
|
|
28
|
+
export { registerStartCommand, registerStatusCommand, registerHelpCommand, registerGitCommand, registerDopplerCommand, registerLogsCommand, registerClearCommand, registerToolsCommand, registerResourcesCommand, registerCancelCommand, registerPauseCommand, registerResumeCommand, registerQuietCommand, registerVerboseCommand, registerRestartCommand, isCancelled, clearCancel, isPaused, waitWhilePaused, clearPause, isQuiet, clearQuiet, };
|
|
29
|
+
// Command definitions with descriptions (for menu)
|
|
30
|
+
const COMMAND_DEFS = [
|
|
31
|
+
// Migrated to CommandDefinition pattern
|
|
32
|
+
resourcesCommand,
|
|
33
|
+
// TODO: Migrate these to CommandDefinition pattern
|
|
34
|
+
{ command: 'start', description: 'Start the bot', register: registerStartCommand },
|
|
35
|
+
{ command: 'help', description: 'Show available commands', register: registerHelpCommand },
|
|
36
|
+
{ command: 'status', description: 'Check bot status', register: registerStatusCommand },
|
|
37
|
+
{ command: 'git', description: 'Check git status', register: registerGitCommand },
|
|
38
|
+
{ command: 'doppler', description: 'Check Doppler secrets', register: registerDopplerCommand },
|
|
39
|
+
{ command: 'logs', description: 'View recent logs', register: registerLogsCommand },
|
|
40
|
+
{ command: 'clear', description: 'Clear conversation history', register: registerClearCommand },
|
|
41
|
+
{ command: 'tools', description: 'List available tools', register: registerToolsCommand },
|
|
42
|
+
{ command: 'cancel', description: 'Stop current task', register: registerCancelCommand },
|
|
43
|
+
{ command: 'pause', description: 'Pause execution', register: registerPauseCommand },
|
|
44
|
+
{ command: 'resume', description: 'Resume execution', register: registerResumeCommand },
|
|
45
|
+
{ command: 'quiet', description: 'Hide tool logging', register: registerQuietCommand },
|
|
46
|
+
{ command: 'verbose', description: 'Show tool logging', register: registerVerboseCommand },
|
|
47
|
+
{ command: 'restart', description: 'Restart the bot service', register: registerRestartCommand },
|
|
48
|
+
];
|
|
34
49
|
/**
|
|
35
|
-
* Register all
|
|
50
|
+
* Register all command handlers with the bot
|
|
36
51
|
*/
|
|
37
52
|
export function registerAllCommands(bot, memory, tools) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
registerCancelCommand(bot, memory, tools);
|
|
48
|
-
registerPauseCommand(bot, memory, tools);
|
|
49
|
-
registerResumeCommand(bot, memory, tools);
|
|
50
|
-
registerQuietCommand(bot, memory, tools);
|
|
51
|
-
registerVerboseCommand(bot, memory, tools);
|
|
52
|
-
importedRegisterRestart(bot, tools);
|
|
53
|
+
for (const def of COMMAND_DEFS) {
|
|
54
|
+
def.register(bot, memory, tools);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get menu entries for Telegram's command suggestions
|
|
59
|
+
*/
|
|
60
|
+
export function getCommandMenu() {
|
|
61
|
+
return COMMAND_DEFS.map(({ command, description }) => ({ command, description }));
|
|
53
62
|
}
|
|
54
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,6BAA6B;AAC7B,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEzE,kCAAkC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAA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AE,KAAK,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;AACpF,CAAC"}
|
package/dist/commands/quiet.d.ts
CHANGED
|
@@ -5,12 +5,4 @@ import TelegramBot from 'node-telegram-bot-api';
|
|
|
5
5
|
import { ConversationMemory } from '../conversation-memory';
|
|
6
6
|
import type { Tool } from '../types';
|
|
7
7
|
export declare function registerQuietCommand(bot: TelegramBot, _memory: ConversationMemory, _tools: Tool[]): void;
|
|
8
|
-
/**
|
|
9
|
-
* Check if quiet mode is enabled
|
|
10
|
-
*/
|
|
11
|
-
export declare function isQuiet(): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Clear quiet flag
|
|
14
|
-
*/
|
|
15
|
-
export declare function clearQuiet(): void;
|
|
16
8
|
//# sourceMappingURL=quiet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quiet.d.ts","sourceRoot":"","sources":["../../src/commands/quiet.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"quiet.d.ts","sourceRoot":"","sources":["../../src/commands/quiet.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrC,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,IAAI,EAAE,GACb,IAAI,CA0BN"}
|
package/dist/commands/quiet.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* /quiet command - Toggle tool logging off
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
const STATE_DIR = '/root/seed/state';
|
|
6
|
-
const QUIET_FLAG = `${STATE_DIR}/.quiet`;
|
|
4
|
+
import { setQuiet } from '@ebowwa/channel-core';
|
|
7
5
|
export function registerQuietCommand(bot, _memory, _tools) {
|
|
8
6
|
bot.onText(/\/quiet/, async (msg) => {
|
|
9
7
|
const chatId = msg.chat.id;
|
|
10
8
|
try {
|
|
11
|
-
|
|
12
|
-
if (!existsSync(STATE_DIR)) {
|
|
13
|
-
mkdirSync(STATE_DIR, { recursive: true });
|
|
14
|
-
}
|
|
15
|
-
// Set quiet flag
|
|
16
|
-
writeFileSync(QUIET_FLAG, Date.now().toString());
|
|
9
|
+
setQuiet();
|
|
17
10
|
await bot.sendMessage(chatId, `🔇 *QUIET MODE*\n\n` +
|
|
18
11
|
`Tool logging disabled.\n` +
|
|
19
12
|
`The AI will still use tools but won't show the calls.\n` +
|
|
@@ -25,19 +18,4 @@ export function registerQuietCommand(bot, _memory, _tools) {
|
|
|
25
18
|
}
|
|
26
19
|
});
|
|
27
20
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Check if quiet mode is enabled
|
|
30
|
-
*/
|
|
31
|
-
export function isQuiet() {
|
|
32
|
-
return existsSync(QUIET_FLAG);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Clear quiet flag
|
|
36
|
-
*/
|
|
37
|
-
export function clearQuiet() {
|
|
38
|
-
if (existsSync(QUIET_FLAG)) {
|
|
39
|
-
const { unlinkSync } = require('fs');
|
|
40
|
-
unlinkSync(QUIET_FLAG);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
21
|
//# sourceMappingURL=quiet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quiet.js","sourceRoot":"","sources":["../../src/commands/quiet.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"quiet.js","sourceRoot":"","sources":["../../src/commands/quiet.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,UAAU,oBAAoB,CAClC,GAAgB,EAChB,OAA2B,EAC3B,MAAc;IAEd,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,GAAwB,EAAE,EAAE;QACvD,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAE3B,IAAI,CAAC;YACH,QAAQ,EAAE,CAAC;YAEX,MAAM,GAAG,CAAC,WAAW,CACnB,MAAM,EACN,qBAAqB;gBACrB,0BAA0B;gBAC1B,yDAAyD;gBACzD,4BAA4B,EAC5B,EAAE,UAAU,EAAE,UAAU,EAAE,CAC3B,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,sCAAsC,MAAM,EAAE,CAAC,CAAC;QAE9D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,CAAC,WAAW,CACnB,MAAM,EACN,YAAY,KAAK,EAAE,EACnB,EAAE,UAAU,EAAE,UAAU,EAAE,CAC3B,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* /resources command - Show system resources
|
|
3
3
|
*/
|
|
4
|
-
import type { CommandRegistrar } from './types';
|
|
4
|
+
import type { CommandDefinition, CommandRegistrar } from './types';
|
|
5
|
+
export declare const resourcesCommand: CommandDefinition;
|
|
5
6
|
export declare const registerResourcesCommand: CommandRegistrar;
|
|
6
7
|
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/commands/resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/commands/resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAwCnE,eAAO,MAAM,gBAAgB,EAAE,iBAI9B,CAAC;AAGF,eAAO,MAAM,wBAAwB,kBAAW,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* /resources command - Show system resources
|
|
3
3
|
*/
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
|
-
|
|
5
|
+
const register = (bot) => {
|
|
6
6
|
bot.onText(/\/resources/, async (msg) => {
|
|
7
7
|
const chatId = msg.chat.id;
|
|
8
8
|
try {
|
|
@@ -31,4 +31,11 @@ export const registerResourcesCommand = (bot) => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
+
export const resourcesCommand = {
|
|
35
|
+
command: 'resources',
|
|
36
|
+
description: 'Show system resources',
|
|
37
|
+
register,
|
|
38
|
+
};
|
|
39
|
+
// Legacy export for backwards compatibility
|
|
40
|
+
export const registerResourcesCommand = register;
|
|
34
41
|
//# sourceMappingURL=resources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/commands/resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/commands/resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG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T,CAAC;AAEF,4CAA4C;AAC5C,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAQ,CAAC"}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import TelegramBot from "node-telegram-bot-api";
|
|
5
5
|
import type { Tool } from "../index.js";
|
|
6
|
-
|
|
6
|
+
import type { ConversationMemory } from "../conversation-memory.js";
|
|
7
|
+
export declare function register(bot: TelegramBot, _memory: ConversationMemory, _tools: Tool[]): void;
|
|
7
8
|
//# sourceMappingURL=restart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restart.d.ts","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"restart.d.ts","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAgC5F"}
|
package/dist/commands/restart.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* /restart command - Restart the Telegram bot systemd service
|
|
3
3
|
*/
|
|
4
4
|
import { execSync } from "child_process";
|
|
5
|
-
export function register(bot,
|
|
5
|
+
export function register(bot, _memory, _tools) {
|
|
6
6
|
bot.onText(/\/restart(?:@[\w]+)?(?:\s+(.+))?/, async (msg, match) => {
|
|
7
7
|
const chatId = msg.chat.id;
|
|
8
8
|
const serviceName = match?.[1]?.trim() || "telegram-bot";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restart.js","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"restart.js","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,MAAM,UAAU,QAAQ,CAAC,GAAgB,EAAE,OAA2B,EAAE,MAAc;IACpF,GAAG,CAAC,MAAM,CAAC,kCAAkC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAClE,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC;QAEzD,IAAI,CAAC;YACH,8BAA8B;YAC9B,QAAQ,CAAC,0BAA0B,WAAW,EAAE,EAAE;gBAChD,OAAO,EAAE,KAAK;gBACd,QAAQ,EAAE,OAAO;aAClB,CAAC,CAAC;YAEH,MAAM,GAAG,CAAC,WAAW,CACnB,MAAM,EACN,cAAc,WAAW,iBAAiB;gBAC1C,0EAA0E,CAC3E,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,8BAA8B,CAAC,EAAE,CAAC;gBAC5D,MAAM,GAAG,CAAC,WAAW,CACnB,MAAM,EACN,4DAA4D;oBAC5D,mDAAmD,CACpD,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,CAAC,WAAW,CACnB,MAAM,EACN,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAC9C,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import TelegramBot from 'node-telegram-bot-api';
|
|
5
5
|
import { ConversationMemory } from '../conversation-memory';
|
|
6
|
+
/**
|
|
7
|
+
* Menu entry for Telegram's command suggestions
|
|
8
|
+
*/
|
|
9
|
+
export interface CommandMenuEntry {
|
|
10
|
+
command: string;
|
|
11
|
+
description: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Command definition - handler + menu entry together
|
|
15
|
+
*/
|
|
16
|
+
export interface CommandDefinition {
|
|
17
|
+
/** Command name without / (e.g., "start", "help") */
|
|
18
|
+
command: string;
|
|
19
|
+
/** Description for Telegram's command menu */
|
|
20
|
+
description: string;
|
|
21
|
+
/** Registration function that sets up the handler */
|
|
22
|
+
register: CommandRegistrar;
|
|
23
|
+
}
|
|
6
24
|
/**
|
|
7
25
|
* Command registration function signature
|
|
8
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,OAAO,UAAU,EAAE,IAAI,EAAE,KAC7B,IAAI,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,WAAW,CAAC;IACjB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,OAAO,UAAU,EAAE,IAAI,EAAE,CAAC;CAClC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,OAAO,UAAU,EAAE,IAAI,EAAE,KAC7B,IAAI,CAAC;AAEV;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,WAAW,CAAC;IACjB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,OAAO,UAAU,EAAE,IAAI,EAAE,CAAC;CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verbose.d.ts","sourceRoot":"","sources":["../../src/commands/verbose.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"verbose.d.ts","sourceRoot":"","sources":["../../src/commands/verbose.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrC,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,IAAI,EAAE,GACb,IAAI,CA+BN"}
|
package/dist/commands/verbose.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* /verbose command - Toggle tool logging on
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { clearQuiet } from './quiet';
|
|
6
|
-
const STATE_DIR = '/root/seed/state';
|
|
7
|
-
const QUIET_FLAG = `${STATE_DIR}/.quiet`;
|
|
4
|
+
import { isQuiet, clearQuiet } from '@ebowwa/channel-core';
|
|
8
5
|
export function registerVerboseCommand(bot, _memory, _tools) {
|
|
9
6
|
bot.onText(/\/verbose/, async (msg) => {
|
|
10
7
|
const chatId = msg.chat.id;
|
|
11
8
|
try {
|
|
12
|
-
const wasQuiet =
|
|
9
|
+
const wasQuiet = isQuiet();
|
|
13
10
|
clearQuiet();
|
|
14
11
|
let status = '';
|
|
15
12
|
if (wasQuiet) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verbose.js","sourceRoot":"","sources":["../../src/commands/verbose.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"verbose.js","sourceRoot":"","sources":["../../src/commands/verbose.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,UAAU,sBAAsB,CACpC,GAAgB,EAChB,OAA2B,EAC3B,MAAc;IAEd,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,GAAwB,EAAE,EAAE;QACzD,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAE3B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC;YAC3B,UAAU,EAAE,CAAC;YAEb,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,GAAG,wEAAwE,CAAC;YACpF,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,uDAAuD,CAAC;YACnE,CAAC;YAED,MAAM,GAAG,CAAC,WAAW,CACnB,MAAM,EACN,MAAM,EACN,EAAE,UAAU,EAAE,UAAU,EAAE,CAC3B,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,0CAA0C,MAAM,EAAE,CAAC,CAAC;QAElE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,CAAC,WAAW,CACnB,MAAM,EACN,YAAY,KAAK,EAAE,EACnB,EAAE,UAAU,EAAE,UAAU,EAAE,CAC3B,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebowwa/channel-telegram",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.8",
|
|
4
4
|
"description": "Pure Telegram protocol adapter implementing ChannelConnector",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"url": "https://github.com/ebowwa/codespaces/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@ebowwa/channel-
|
|
43
|
+
"@ebowwa/channel-core": "^1.4.3",
|
|
44
|
+
"@ebowwa/channel-types": "^0.2.1",
|
|
44
45
|
"node-telegram-bot-api": "^0.66.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
@@ -48,5 +49,12 @@
|
|
|
48
49
|
"@types/node": "^22.19.11",
|
|
49
50
|
"@types/node-telegram-bot-api": "^0.64.13",
|
|
50
51
|
"typescript": "^5.9.3"
|
|
52
|
+
},
|
|
53
|
+
"ownership": {
|
|
54
|
+
"domain": "channels",
|
|
55
|
+
"responsibilities": [
|
|
56
|
+
"telegram-channel",
|
|
57
|
+
"bot-messaging"
|
|
58
|
+
]
|
|
51
59
|
}
|
|
52
60
|
}
|
package/src/commands/index.ts
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Command index -
|
|
2
|
+
* Command index - Single source of truth for commands
|
|
3
|
+
*
|
|
4
|
+
* Each command exports a CommandDefinition with:
|
|
5
|
+
* - command: name (without /)
|
|
6
|
+
* - description: for Telegram menu
|
|
7
|
+
* - register: function to set up handler
|
|
3
8
|
*/
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { registerHelpCommand } from './help';
|
|
8
|
-
export { registerGitCommand } from './git';
|
|
9
|
-
export { registerDopplerCommand } from './doppler';
|
|
10
|
-
export { registerLogsCommand } from './logs';
|
|
11
|
-
export { registerClearCommand } from './clear';
|
|
12
|
-
export { registerToolsCommand } from './tools';
|
|
13
|
-
export { registerResourcesCommand } from './resources';
|
|
14
|
-
export { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
15
|
-
export { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
16
|
-
export { registerResumeCommand } from './resume';
|
|
17
|
-
export { registerQuietCommand, isQuiet, clearQuiet } from './quiet';
|
|
18
|
-
export { registerVerboseCommand } from './verbose';
|
|
19
|
-
export { register as registerRestartCommand } from './restart';
|
|
20
|
-
import { register as importedRegisterRestart } from './restart';
|
|
10
|
+
import type TelegramBot from 'node-telegram-bot-api';
|
|
11
|
+
import type { CommandDefinition, CommandRegistrar } from './types';
|
|
21
12
|
|
|
22
|
-
|
|
13
|
+
// Import command definitions
|
|
14
|
+
import { resourcesCommand, registerResourcesCommand } from './resources';
|
|
23
15
|
|
|
24
|
-
|
|
25
|
-
import type { CommandRegistrar } from './types';
|
|
16
|
+
// Legacy imports (to be migrated)
|
|
26
17
|
import { registerStartCommand } from './start';
|
|
27
18
|
import { registerStatusCommand } from './status';
|
|
28
19
|
import { registerHelpCommand } from './help';
|
|
@@ -31,34 +22,81 @@ import { registerDopplerCommand } from './doppler';
|
|
|
31
22
|
import { registerLogsCommand } from './logs';
|
|
32
23
|
import { registerClearCommand } from './clear';
|
|
33
24
|
import { registerToolsCommand } from './tools';
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import { registerPauseCommand } from './pause';
|
|
25
|
+
import { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
26
|
+
import { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
37
27
|
import { registerResumeCommand } from './resume';
|
|
38
28
|
import { registerQuietCommand } from './quiet';
|
|
29
|
+
import { isQuiet, clearQuiet } from '@ebowwa/channel-core';
|
|
39
30
|
import { registerVerboseCommand } from './verbose';
|
|
31
|
+
import { register as registerRestartCommand } from './restart';
|
|
32
|
+
|
|
33
|
+
// Export types
|
|
34
|
+
export type { CommandDefinition, CommandRegistrar, CommandContext } from './types';
|
|
35
|
+
|
|
36
|
+
// Export legacy functions for backwards compatibility
|
|
37
|
+
export {
|
|
38
|
+
registerStartCommand,
|
|
39
|
+
registerStatusCommand,
|
|
40
|
+
registerHelpCommand,
|
|
41
|
+
registerGitCommand,
|
|
42
|
+
registerDopplerCommand,
|
|
43
|
+
registerLogsCommand,
|
|
44
|
+
registerClearCommand,
|
|
45
|
+
registerToolsCommand,
|
|
46
|
+
registerResourcesCommand,
|
|
47
|
+
registerCancelCommand,
|
|
48
|
+
registerPauseCommand,
|
|
49
|
+
registerResumeCommand,
|
|
50
|
+
registerQuietCommand,
|
|
51
|
+
registerVerboseCommand,
|
|
52
|
+
registerRestartCommand,
|
|
53
|
+
isCancelled,
|
|
54
|
+
clearCancel,
|
|
55
|
+
isPaused,
|
|
56
|
+
waitWhilePaused,
|
|
57
|
+
clearPause,
|
|
58
|
+
isQuiet,
|
|
59
|
+
clearQuiet,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// Command definitions with descriptions (for menu)
|
|
63
|
+
const COMMAND_DEFS: CommandDefinition[] = [
|
|
64
|
+
// Migrated to CommandDefinition pattern
|
|
65
|
+
resourcesCommand,
|
|
66
|
+
|
|
67
|
+
// TODO: Migrate these to CommandDefinition pattern
|
|
68
|
+
{ command: 'start', description: 'Start the bot', register: registerStartCommand },
|
|
69
|
+
{ command: 'help', description: 'Show available commands', register: registerHelpCommand },
|
|
70
|
+
{ command: 'status', description: 'Check bot status', register: registerStatusCommand },
|
|
71
|
+
{ command: 'git', description: 'Check git status', register: registerGitCommand },
|
|
72
|
+
{ command: 'doppler', description: 'Check Doppler secrets', register: registerDopplerCommand },
|
|
73
|
+
{ command: 'logs', description: 'View recent logs', register: registerLogsCommand },
|
|
74
|
+
{ command: 'clear', description: 'Clear conversation history', register: registerClearCommand },
|
|
75
|
+
{ command: 'tools', description: 'List available tools', register: registerToolsCommand },
|
|
76
|
+
{ command: 'cancel', description: 'Stop current task', register: registerCancelCommand },
|
|
77
|
+
{ command: 'pause', description: 'Pause execution', register: registerPauseCommand },
|
|
78
|
+
{ command: 'resume', description: 'Resume execution', register: registerResumeCommand },
|
|
79
|
+
{ command: 'quiet', description: 'Hide tool logging', register: registerQuietCommand },
|
|
80
|
+
{ command: 'verbose', description: 'Show tool logging', register: registerVerboseCommand },
|
|
81
|
+
{ command: 'restart', description: 'Restart the bot service', register: registerRestartCommand },
|
|
82
|
+
];
|
|
40
83
|
|
|
41
84
|
/**
|
|
42
|
-
* Register all
|
|
85
|
+
* Register all command handlers with the bot
|
|
43
86
|
*/
|
|
44
87
|
export function registerAllCommands(
|
|
45
88
|
bot: TelegramBot,
|
|
46
89
|
memory: import('../conversation-memory').ConversationMemory,
|
|
47
90
|
tools: import('../index').Tool[]
|
|
48
91
|
): void {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
registerPauseCommand(bot, memory, tools);
|
|
60
|
-
registerResumeCommand(bot, memory, tools);
|
|
61
|
-
registerQuietCommand(bot, memory, tools);
|
|
62
|
-
registerVerboseCommand(bot, memory, tools);
|
|
63
|
-
importedRegisterRestart(bot, tools);
|
|
92
|
+
for (const def of COMMAND_DEFS) {
|
|
93
|
+
def.register(bot, memory, tools);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get menu entries for Telegram's command suggestions
|
|
99
|
+
*/
|
|
100
|
+
export function getCommandMenu(): Array<{ command: string; description: string }> {
|
|
101
|
+
return COMMAND_DEFS.map(({ command, description }) => ({ command, description }));
|
|
64
102
|
}
|
package/src/commands/quiet.ts
CHANGED
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
import TelegramBot from 'node-telegram-bot-api';
|
|
6
6
|
import { ConversationMemory } from '../conversation-memory';
|
|
7
7
|
import type { Tool } from '../types';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
const STATE_DIR = '/root/seed/state';
|
|
11
|
-
const QUIET_FLAG = `${STATE_DIR}/.quiet`;
|
|
8
|
+
import { setQuiet } from '@ebowwa/channel-core';
|
|
12
9
|
|
|
13
10
|
export function registerQuietCommand(
|
|
14
11
|
bot: TelegramBot,
|
|
@@ -19,13 +16,7 @@ export function registerQuietCommand(
|
|
|
19
16
|
const chatId = msg.chat.id;
|
|
20
17
|
|
|
21
18
|
try {
|
|
22
|
-
|
|
23
|
-
if (!existsSync(STATE_DIR)) {
|
|
24
|
-
mkdirSync(STATE_DIR, { recursive: true });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Set quiet flag
|
|
28
|
-
writeFileSync(QUIET_FLAG, Date.now().toString());
|
|
19
|
+
setQuiet();
|
|
29
20
|
|
|
30
21
|
await bot.sendMessage(
|
|
31
22
|
chatId,
|
|
@@ -47,20 +38,3 @@ export function registerQuietCommand(
|
|
|
47
38
|
}
|
|
48
39
|
});
|
|
49
40
|
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Check if quiet mode is enabled
|
|
53
|
-
*/
|
|
54
|
-
export function isQuiet(): boolean {
|
|
55
|
-
return existsSync(QUIET_FLAG);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Clear quiet flag
|
|
60
|
-
*/
|
|
61
|
-
export function clearQuiet(): void {
|
|
62
|
-
if (existsSync(QUIET_FLAG)) {
|
|
63
|
-
const { unlinkSync } = require('fs');
|
|
64
|
-
unlinkSync(QUIET_FLAG);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
|
-
import type { CommandRegistrar } from './types';
|
|
6
|
+
import type { CommandDefinition, CommandRegistrar } from './types';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const register: CommandRegistrar = (bot) => {
|
|
9
9
|
bot.onText(/\/resources/, async (msg) => {
|
|
10
10
|
const chatId = msg.chat.id;
|
|
11
11
|
|
|
@@ -42,3 +42,12 @@ export const registerResourcesCommand: CommandRegistrar = (bot) => {
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
+
|
|
46
|
+
export const resourcesCommand: CommandDefinition = {
|
|
47
|
+
command: 'resources',
|
|
48
|
+
description: 'Show system resources',
|
|
49
|
+
register,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Legacy export for backwards compatibility
|
|
53
|
+
export const registerResourcesCommand = register;
|
package/src/commands/restart.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import TelegramBot from "node-telegram-bot-api";
|
|
6
6
|
import { execSync } from "child_process";
|
|
7
7
|
import type { Tool } from "../index.js";
|
|
8
|
+
import type { ConversationMemory } from "../conversation-memory.js";
|
|
8
9
|
|
|
9
|
-
export function register(bot: TelegramBot,
|
|
10
|
+
export function register(bot: TelegramBot, _memory: ConversationMemory, _tools: Tool[]): void {
|
|
10
11
|
bot.onText(/\/restart(?:@[\w]+)?(?:\s+(.+))?/, async (msg, match) => {
|
|
11
12
|
const chatId = msg.chat.id;
|
|
12
13
|
const serviceName = match?.[1]?.trim() || "telegram-bot";
|
package/src/commands/types.ts
CHANGED
|
@@ -5,6 +5,26 @@
|
|
|
5
5
|
import TelegramBot from 'node-telegram-bot-api';
|
|
6
6
|
import { ConversationMemory } from '../conversation-memory';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Menu entry for Telegram's command suggestions
|
|
10
|
+
*/
|
|
11
|
+
export interface CommandMenuEntry {
|
|
12
|
+
command: string;
|
|
13
|
+
description: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Command definition - handler + menu entry together
|
|
18
|
+
*/
|
|
19
|
+
export interface CommandDefinition {
|
|
20
|
+
/** Command name without / (e.g., "start", "help") */
|
|
21
|
+
command: string;
|
|
22
|
+
/** Description for Telegram's command menu */
|
|
23
|
+
description: string;
|
|
24
|
+
/** Registration function that sets up the handler */
|
|
25
|
+
register: CommandRegistrar;
|
|
26
|
+
}
|
|
27
|
+
|
|
8
28
|
/**
|
|
9
29
|
* Command registration function signature
|
|
10
30
|
*/
|
package/src/commands/verbose.ts
CHANGED
|
@@ -5,11 +5,7 @@
|
|
|
5
5
|
import TelegramBot from 'node-telegram-bot-api';
|
|
6
6
|
import { ConversationMemory } from '../conversation-memory';
|
|
7
7
|
import type { Tool } from '../types';
|
|
8
|
-
import {
|
|
9
|
-
import { clearQuiet } from './quiet';
|
|
10
|
-
|
|
11
|
-
const STATE_DIR = '/root/seed/state';
|
|
12
|
-
const QUIET_FLAG = `${STATE_DIR}/.quiet`;
|
|
8
|
+
import { isQuiet, clearQuiet } from '@ebowwa/channel-core';
|
|
13
9
|
|
|
14
10
|
export function registerVerboseCommand(
|
|
15
11
|
bot: TelegramBot,
|
|
@@ -20,7 +16,7 @@ export function registerVerboseCommand(
|
|
|
20
16
|
const chatId = msg.chat.id;
|
|
21
17
|
|
|
22
18
|
try {
|
|
23
|
-
const wasQuiet =
|
|
19
|
+
const wasQuiet = isQuiet();
|
|
24
20
|
clearQuiet();
|
|
25
21
|
|
|
26
22
|
let status = '';
|