@ebowwa/channel-telegram 1.16.0 → 1.17.0
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
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command index - Single source of truth for commands
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* and
|
|
4
|
+
* All commands are now channel-agnostic from @ebowwa/channel-command
|
|
5
|
+
* and adapted for Telegram via command-adapter.
|
|
6
6
|
*/
|
|
7
7
|
import type TelegramBot from 'node-telegram-bot-api';
|
|
8
|
-
import
|
|
9
|
-
import type { ConversationMemory } from '../conversation-memory';
|
|
10
|
-
import type { Tool } from '../types';
|
|
11
|
-
|
|
12
|
-
import { registerDopplerCommand } from './doppler';
|
|
13
|
-
import { registerLogsCommand } from './logs';
|
|
14
|
-
import { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
15
|
-
import { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
16
|
-
import { registerResumeCommand } from './resume';
|
|
17
|
-
import { registerQuietCommand } from './quiet';
|
|
18
|
-
import { isQuiet, clearQuiet } from '@ebowwa/channel-core';
|
|
19
|
-
import { registerVerboseCommand } from './verbose';
|
|
20
|
-
import { register as registerRestartCommand } from './restart';
|
|
21
|
-
import { registerResourcesCommand } from './resources';
|
|
22
|
-
import { registerPromptCommand } from './prompt';
|
|
23
|
-
declare const registerSettingsCommand: CommandRegistrar;
|
|
24
|
-
export type { CommandDefinition, CommandRegistrar, CommandContext } from './types';
|
|
25
|
-
export { registerGitCommand, registerDopplerCommand, registerLogsCommand, registerResourcesCommand, registerCancelCommand, registerPauseCommand, registerResumeCommand, registerQuietCommand, registerVerboseCommand, registerRestartCommand, registerPromptCommand, registerSettingsCommand, isCancelled, clearCancel, isPaused, waitWhilePaused, clearPause, isQuiet, clearQuiet, };
|
|
8
|
+
import { isCancelled, clearCancel, isPaused, waitWhilePaused, clearPause, isQuiet, clearQuiet } from '@ebowwa/channel-command';
|
|
9
|
+
import type { ConversationMemory } from '../conversation-memory.js';
|
|
10
|
+
import type { Tool } from '../types.js';
|
|
11
|
+
export { isCancelled, clearCancel, isPaused, waitWhilePaused, clearPause, isQuiet, clearQuiet, };
|
|
26
12
|
/**
|
|
27
13
|
* Register all command handlers with the bot
|
|
28
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAGL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,OAAO,EACP,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,OAAO,EACP,UAAU,GACX,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,IAAI,EAAE,GACZ,IAAI,CAGN;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAQhF"}
|
package/dist/commands/index.js
CHANGED
|
@@ -1,73 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command index - Single source of truth for commands
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* and
|
|
4
|
+
* All commands are now channel-agnostic from @ebowwa/channel-command
|
|
5
|
+
* and adapted for Telegram via command-adapter.
|
|
6
6
|
*/
|
|
7
|
-
import { BUILTIN_COMMANDS, } from '@ebowwa/channel-command';
|
|
8
|
-
import { registerChannelCommands } from '../command-adapter';
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
import { registerDopplerCommand } from './doppler';
|
|
12
|
-
import { registerLogsCommand } from './logs';
|
|
13
|
-
import { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
14
|
-
import { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
15
|
-
import { registerResumeCommand } from './resume';
|
|
16
|
-
import { registerQuietCommand } from './quiet';
|
|
17
|
-
import { isQuiet, clearQuiet } from '@ebowwa/channel-core';
|
|
18
|
-
import { registerVerboseCommand } from './verbose';
|
|
19
|
-
import { register as registerRestartCommand } from './restart';
|
|
20
|
-
import { resourcesCommand, registerResourcesCommand } from './resources';
|
|
21
|
-
import { registerPromptCommand } from './prompt';
|
|
22
|
-
import { register as registerSettingsCmd } from './settings';
|
|
23
|
-
const registerSettingsCommand = (bot, _memory, tools) => registerSettingsCmd(bot, tools);
|
|
24
|
-
// Export legacy functions for backwards compatibility
|
|
25
|
-
export { registerGitCommand, registerDopplerCommand, registerLogsCommand, registerResourcesCommand, registerCancelCommand, registerPauseCommand, registerResumeCommand, registerQuietCommand, registerVerboseCommand, registerRestartCommand, registerPromptCommand, registerSettingsCommand, isCancelled, clearCancel, isPaused, waitWhilePaused, clearPause, isQuiet, clearQuiet, };
|
|
26
|
-
// Command definitions with descriptions (for menu)
|
|
27
|
-
const COMMAND_DEFS = [
|
|
28
|
-
// Telegram-specific commands (not yet migrated)
|
|
29
|
-
{ command: 'git', description: 'Check git status', register: registerGitCommand },
|
|
30
|
-
{ command: 'doppler', description: 'Check Doppler secrets', register: registerDopplerCommand },
|
|
31
|
-
{ command: 'logs', description: 'View recent logs', register: registerLogsCommand },
|
|
32
|
-
{ command: 'cancel', description: 'Stop current task', register: registerCancelCommand },
|
|
33
|
-
{ command: 'pause', description: 'Pause execution', register: registerPauseCommand },
|
|
34
|
-
{ command: 'resume', description: 'Resume execution', register: registerResumeCommand },
|
|
35
|
-
{ command: 'quiet', description: 'Hide tool logging', register: registerQuietCommand },
|
|
36
|
-
{ command: 'verbose', description: 'Show tool logging', register: registerVerboseCommand },
|
|
37
|
-
{ command: 'restart', description: 'Restart the bot service', register: registerRestartCommand },
|
|
38
|
-
resourcesCommand,
|
|
39
|
-
{ command: 'prompt', description: 'Manage system prompt', register: registerPromptCommand },
|
|
40
|
-
{ command: 'settings', description: 'Show bot configuration', register: registerSettingsCommand },
|
|
41
|
-
];
|
|
7
|
+
import { BUILTIN_COMMANDS, isCancelled, clearCancel, isPaused, waitWhilePaused, clearPause, isQuiet, clearQuiet, } from '@ebowwa/channel-command';
|
|
8
|
+
import { registerChannelCommands } from '../command-adapter.js';
|
|
9
|
+
// Re-export utilities for backwards compatibility
|
|
10
|
+
export { isCancelled, clearCancel, isPaused, waitWhilePaused, clearPause, isQuiet, clearQuiet, };
|
|
42
11
|
/**
|
|
43
12
|
* Register all command handlers with the bot
|
|
44
13
|
*/
|
|
45
14
|
export function registerAllCommands(bot, memory, tools) {
|
|
46
|
-
// Register channel-agnostic commands from @ebowwa/channel-command
|
|
15
|
+
// Register all channel-agnostic commands from @ebowwa/channel-command
|
|
47
16
|
registerChannelCommands(bot, BUILTIN_COMMANDS, memory, tools);
|
|
48
|
-
// Register Telegram-specific commands
|
|
49
|
-
for (const def of COMMAND_DEFS) {
|
|
50
|
-
def.register(bot, memory, tools);
|
|
51
|
-
}
|
|
52
17
|
}
|
|
53
18
|
/**
|
|
54
19
|
* Get menu entries for Telegram's command suggestions
|
|
55
20
|
*/
|
|
56
21
|
export function getCommandMenu() {
|
|
57
|
-
|
|
58
|
-
const channelMenu = BUILTIN_COMMANDS
|
|
22
|
+
return BUILTIN_COMMANDS
|
|
59
23
|
.filter(cmd => cmd.channels.includes('telegram'))
|
|
60
24
|
.map(cmd => {
|
|
61
25
|
const telegramAlias = cmd.aliases.find(a => a.channel === 'telegram');
|
|
62
26
|
const command = telegramAlias?.alias.replace(/^\//, '') || cmd.id.name;
|
|
63
27
|
return { command, description: cmd.description };
|
|
64
28
|
});
|
|
65
|
-
const localMenu = COMMAND_DEFS.map(({ command, description }) => ({ command, description }));
|
|
66
|
-
// Merge and dedupe
|
|
67
|
-
const menuMap = new Map();
|
|
68
|
-
for (const item of [...channelMenu, ...localMenu]) {
|
|
69
|
-
menuMap.set(item.command, item);
|
|
70
|
-
}
|
|
71
|
-
return Array.from(menuMap.values());
|
|
72
29
|
}
|
|
73
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,gBAAgB,EAEhB,WAAW,EACX,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,OAAO,EACP,UAAU,GACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAIhE,kDAAkD;AAClD,OAAO,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,OAAO,EACP,UAAU,GACX,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,GAAgB,EAChB,MAA0B,EAC1B,KAAa;IAEb,sEAAsE;IACtE,uBAAuB,CAAC,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,gBAAgB;SACpB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAChD,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;QACvE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC;IACnD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebowwa/channel-telegram",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "Pure Telegram protocol adapter implementing ChannelConnector",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"url": "https://github.com/ebowwa/codespaces/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@ebowwa/channel-command": "
|
|
43
|
+
"@ebowwa/channel-command": "1.2.0",
|
|
44
44
|
"@ebowwa/channel-core": "^1.15.0",
|
|
45
45
|
"@ebowwa/channel-types": "^0.2.3",
|
|
46
46
|
"node-telegram-bot-api": "^0.66.0"
|
package/src/commands/index.ts
CHANGED
|
@@ -1,53 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command index - Single source of truth for commands
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* and
|
|
4
|
+
* All commands are now channel-agnostic from @ebowwa/channel-command
|
|
5
|
+
* and adapted for Telegram via command-adapter.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type TelegramBot from 'node-telegram-bot-api';
|
|
9
9
|
import {
|
|
10
10
|
BUILTIN_COMMANDS,
|
|
11
11
|
registerBuiltinCommands as registerChannelBuiltinCommands,
|
|
12
|
+
isCancelled,
|
|
13
|
+
clearCancel,
|
|
14
|
+
isPaused,
|
|
15
|
+
waitWhilePaused,
|
|
16
|
+
clearPause,
|
|
17
|
+
isQuiet,
|
|
18
|
+
clearQuiet,
|
|
12
19
|
} from '@ebowwa/channel-command';
|
|
13
|
-
import { registerChannelCommands } from '../command-adapter';
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type { Tool } from '../types';
|
|
20
|
+
import { registerChannelCommands } from '../command-adapter.js';
|
|
21
|
+
import type { ConversationMemory } from '../conversation-memory.js';
|
|
22
|
+
import type { Tool } from '../types.js';
|
|
17
23
|
|
|
18
|
-
//
|
|
19
|
-
import { registerGitCommand } from './git';
|
|
20
|
-
import { registerDopplerCommand } from './doppler';
|
|
21
|
-
import { registerLogsCommand } from './logs';
|
|
22
|
-
import { registerCancelCommand, isCancelled, clearCancel } from './cancel';
|
|
23
|
-
import { registerPauseCommand, isPaused, waitWhilePaused, clearPause } from './pause';
|
|
24
|
-
import { registerResumeCommand } from './resume';
|
|
25
|
-
import { registerQuietCommand } from './quiet';
|
|
26
|
-
import { isQuiet, clearQuiet } from '@ebowwa/channel-core';
|
|
27
|
-
import { registerVerboseCommand } from './verbose';
|
|
28
|
-
import { register as registerRestartCommand } from './restart';
|
|
29
|
-
import { resourcesCommand, registerResourcesCommand } from './resources';
|
|
30
|
-
import { registerPromptCommand } from './prompt';
|
|
31
|
-
import { register as registerSettingsCmd } from './settings';
|
|
32
|
-
const registerSettingsCommand: CommandRegistrar = (bot, _memory, tools) => registerSettingsCmd(bot, tools);
|
|
33
|
-
|
|
34
|
-
// Export types
|
|
35
|
-
export type { CommandDefinition, CommandRegistrar, CommandContext } from './types';
|
|
36
|
-
|
|
37
|
-
// Export legacy functions for backwards compatibility
|
|
24
|
+
// Re-export utilities for backwards compatibility
|
|
38
25
|
export {
|
|
39
|
-
registerGitCommand,
|
|
40
|
-
registerDopplerCommand,
|
|
41
|
-
registerLogsCommand,
|
|
42
|
-
registerResourcesCommand,
|
|
43
|
-
registerCancelCommand,
|
|
44
|
-
registerPauseCommand,
|
|
45
|
-
registerResumeCommand,
|
|
46
|
-
registerQuietCommand,
|
|
47
|
-
registerVerboseCommand,
|
|
48
|
-
registerRestartCommand,
|
|
49
|
-
registerPromptCommand,
|
|
50
|
-
registerSettingsCommand,
|
|
51
26
|
isCancelled,
|
|
52
27
|
clearCancel,
|
|
53
28
|
isPaused,
|
|
@@ -57,23 +32,6 @@ export {
|
|
|
57
32
|
clearQuiet,
|
|
58
33
|
};
|
|
59
34
|
|
|
60
|
-
// Command definitions with descriptions (for menu)
|
|
61
|
-
const COMMAND_DEFS: CommandDefinition[] = [
|
|
62
|
-
// Telegram-specific commands (not yet migrated)
|
|
63
|
-
{ command: 'git', description: 'Check git status', register: registerGitCommand },
|
|
64
|
-
{ command: 'doppler', description: 'Check Doppler secrets', register: registerDopplerCommand },
|
|
65
|
-
{ command: 'logs', description: 'View recent logs', register: registerLogsCommand },
|
|
66
|
-
{ command: 'cancel', description: 'Stop current task', register: registerCancelCommand },
|
|
67
|
-
{ command: 'pause', description: 'Pause execution', register: registerPauseCommand },
|
|
68
|
-
{ command: 'resume', description: 'Resume execution', register: registerResumeCommand },
|
|
69
|
-
{ command: 'quiet', description: 'Hide tool logging', register: registerQuietCommand },
|
|
70
|
-
{ command: 'verbose', description: 'Show tool logging', register: registerVerboseCommand },
|
|
71
|
-
{ command: 'restart', description: 'Restart the bot service', register: registerRestartCommand },
|
|
72
|
-
resourcesCommand,
|
|
73
|
-
{ command: 'prompt', description: 'Manage system prompt', register: registerPromptCommand },
|
|
74
|
-
{ command: 'settings', description: 'Show bot configuration', register: registerSettingsCommand },
|
|
75
|
-
];
|
|
76
|
-
|
|
77
35
|
/**
|
|
78
36
|
* Register all command handlers with the bot
|
|
79
37
|
*/
|
|
@@ -82,35 +40,19 @@ export function registerAllCommands(
|
|
|
82
40
|
memory: ConversationMemory,
|
|
83
41
|
tools: Tool[]
|
|
84
42
|
): void {
|
|
85
|
-
// Register channel-agnostic commands from @ebowwa/channel-command
|
|
43
|
+
// Register all channel-agnostic commands from @ebowwa/channel-command
|
|
86
44
|
registerChannelCommands(bot, BUILTIN_COMMANDS, memory, tools);
|
|
87
|
-
|
|
88
|
-
// Register Telegram-specific commands
|
|
89
|
-
for (const def of COMMAND_DEFS) {
|
|
90
|
-
def.register(bot, memory, tools);
|
|
91
|
-
}
|
|
92
45
|
}
|
|
93
46
|
|
|
94
47
|
/**
|
|
95
48
|
* Get menu entries for Telegram's command suggestions
|
|
96
49
|
*/
|
|
97
50
|
export function getCommandMenu(): Array<{ command: string; description: string }> {
|
|
98
|
-
|
|
99
|
-
const channelMenu = BUILTIN_COMMANDS
|
|
51
|
+
return BUILTIN_COMMANDS
|
|
100
52
|
.filter(cmd => cmd.channels.includes('telegram'))
|
|
101
53
|
.map(cmd => {
|
|
102
54
|
const telegramAlias = cmd.aliases.find(a => a.channel === 'telegram');
|
|
103
55
|
const command = telegramAlias?.alias.replace(/^\//, '') || cmd.id.name;
|
|
104
56
|
return { command, description: cmd.description };
|
|
105
57
|
});
|
|
106
|
-
|
|
107
|
-
const localMenu = COMMAND_DEFS.map(({ command, description }) => ({ command, description }));
|
|
108
|
-
|
|
109
|
-
// Merge and dedupe
|
|
110
|
-
const menuMap = new Map<string, { command: string; description: string }>();
|
|
111
|
-
for (const item of [...channelMenu, ...localMenu]) {
|
|
112
|
-
menuMap.set(item.command, item);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return Array.from(menuMap.values());
|
|
116
58
|
}
|