agentgram 2.0.0 → 2.0.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.d.ts CHANGED
@@ -44,12 +44,12 @@ interface ServiceStatus {
44
44
  installed: boolean;
45
45
  running: boolean;
46
46
  system: string;
47
- path?: string;
47
+ path?: string | undefined;
48
48
  }
49
49
  interface InlineKeyboardButton {
50
50
  text: string;
51
- callback_data?: string;
52
- url?: string;
51
+ callback_data?: string | undefined;
52
+ url?: string | undefined;
53
53
  }
54
54
  interface InlineKeyboardMarkup {
55
55
  inline_keyboard: InlineKeyboardButton[][];
@@ -110,7 +110,7 @@ interface OpenCodeRun {
110
110
  model: string;
111
111
  mode: ExecutionMode;
112
112
  startedAt: number;
113
- userMsgId?: number;
113
+ userMsgId?: number | undefined;
114
114
  userMessages: Set<string>;
115
115
  text: Record<string, string>;
116
116
  textOrder: string[];
@@ -121,7 +121,7 @@ interface OpenCodeRun {
121
121
  cmds: number;
122
122
  busy: boolean;
123
123
  done: boolean;
124
- error?: string | null;
124
+ error?: string | null | undefined;
125
125
  }
126
126
  interface OpenCodePermissionRequest {
127
127
  id: string;
@@ -210,6 +210,7 @@ declare class ConfigManager {
210
210
  saveGlobal(): void;
211
211
  saveProject(): void;
212
212
  addWorkspace(newWorkspace: string): boolean;
213
+ removeWorkspace(workspace: string): boolean;
213
214
  validate(): string[];
214
215
  }
215
216
 
@@ -220,17 +221,17 @@ declare class ConfigManager {
220
221
  */
221
222
  interface ChannelButton {
222
223
  text: string;
223
- callbackData?: string;
224
- url?: string;
224
+ callbackData?: string | undefined;
225
+ url?: string | undefined;
225
226
  }
226
227
  interface ChannelKeyboard {
227
228
  rows: ChannelButton[][];
228
229
  }
229
230
  interface ChannelSendOptions {
230
- replyMarkup?: ChannelKeyboard;
231
- replyToMessageId?: string | number;
232
- parseMode?: 'HTML' | 'Markdown' | 'None';
233
- disableWebPagePreview?: boolean;
231
+ replyMarkup?: ChannelKeyboard | undefined;
232
+ replyToMessageId?: string | number | undefined;
233
+ parseMode?: 'HTML' | 'Markdown' | 'None' | undefined;
234
+ disableWebPagePreview?: boolean | undefined;
234
235
  }
235
236
  interface ChannelMessageResult {
236
237
  messageId: string | number;
@@ -243,7 +244,7 @@ interface IncomingChannelMessage {
243
244
  chatId: string;
244
245
  text: string;
245
246
  timestamp: number;
246
- replyToMessageId?: string | number;
247
+ replyToMessageId?: string | number | undefined;
247
248
  raw?: unknown;
248
249
  }
249
250
  interface IncomingChannelAction {
@@ -251,7 +252,7 @@ interface IncomingChannelAction {
251
252
  senderId: string;
252
253
  chatId: string;
253
254
  actionData: string;
254
- messageId?: string | number;
255
+ messageId?: string | number | undefined;
255
256
  raw?: unknown;
256
257
  }
257
258
  interface ChannelUpdateHandler {
@@ -285,9 +286,9 @@ interface IChannelAdapter {
285
286
  }
286
287
 
287
288
  interface SendMessageOptions {
288
- replyMarkup?: InlineKeyboardMarkup;
289
- replyToMessageId?: number;
290
- disableWebPagePreview?: boolean;
289
+ replyMarkup?: InlineKeyboardMarkup | undefined;
290
+ replyToMessageId?: number | undefined;
291
+ disableWebPagePreview?: boolean | undefined;
291
292
  }
292
293
  declare function escapeHtml(text: string): string;
293
294
  declare class TelegramClient {
@@ -344,7 +345,7 @@ declare class ConsoleChannelAdapter implements IChannelAdapter {
344
345
  startListening(handler: ChannelUpdateHandler): Promise<void>;
345
346
  stopListening(): void;
346
347
  sendMessage(recipientId: string, text: string, options?: ChannelSendOptions): Promise<ChannelMessageResult>;
347
- editMessage(recipientId: string, messageId: string | number, text: string, options?: ChannelSendOptions): Promise<void>;
348
+ editMessage(_recipientId: string, messageId: string | number, text: string, options?: ChannelSendOptions): Promise<void>;
348
349
  answerAction(_actionId: string, text?: string): Promise<void>;
349
350
  private renderKeyboard;
350
351
  }
@@ -372,13 +373,13 @@ declare class ChannelRegistry {
372
373
  interface AgentSession {
373
374
  id: string;
374
375
  workspaceDir: string;
375
- title?: string;
376
+ title?: string | undefined;
376
377
  }
377
378
  interface AgentSessionOptions {
378
- workspaceDir?: string;
379
- title?: string;
380
- agent?: string;
381
- model?: string;
379
+ workspaceDir?: string | undefined;
380
+ title?: string | undefined;
381
+ agent?: string | undefined;
382
+ model?: string | undefined;
382
383
  }
383
384
  interface AgentEngineToolCall {
384
385
  id: string;
@@ -429,6 +430,20 @@ interface IAgentEngine extends EventEmitter {
429
430
  * Switch the active working directory / workspace.
430
431
  */
431
432
  setWorkspace(directory: string): Promise<void> | void;
433
+ /**
434
+ * List available models from the engine.
435
+ */
436
+ listModels?(): Promise<Array<{
437
+ id: string;
438
+ name?: string;
439
+ }>>;
440
+ /**
441
+ * List available agents from the engine.
442
+ */
443
+ listAgents?(): Promise<Array<{
444
+ name: string;
445
+ description?: string;
446
+ }>>;
432
447
  }
433
448
 
434
449
  declare function getFreePort(): Promise<number>;
@@ -471,6 +486,7 @@ declare class OpenCodeClient extends EventEmitter {
471
486
  }>>;
472
487
  createSession(title?: string): Promise<{
473
488
  id: string;
489
+ title?: string;
474
490
  }>;
475
491
  /**
476
492
  * Spawns an OpenCode server process locally on loopback.
@@ -504,6 +520,14 @@ declare class OpenCodeAdapter extends EventEmitter implements IAgentEngine {
504
520
  replyPermission(permissionId: string, decision: 'allow' | 'reject'): Promise<void>;
505
521
  getDiff(): Promise<string>;
506
522
  setWorkspace(directory: string): void;
523
+ listModels(): Promise<Array<{
524
+ id: string;
525
+ name?: string;
526
+ }>>;
527
+ listAgents(): Promise<Array<{
528
+ name: string;
529
+ description?: string;
530
+ }>>;
507
531
  }
508
532
 
509
533
  interface ShellEngineOptions {
@@ -519,7 +543,7 @@ declare class ShellEngineAdapter extends EventEmitter implements IAgentEngine {
519
543
  private readonly cliCommand;
520
544
  private readonly defaultArgs;
521
545
  private activeProcess?;
522
- private activeSessionId?;
546
+ activeSessionId?: string | undefined;
523
547
  constructor(options?: ShellEngineOptions);
524
548
  connect(): Promise<void>;
525
549
  disconnect(): void;
@@ -576,7 +600,8 @@ declare class ControlRoom {
576
600
  private alwaysAllowedPerms;
577
601
  private missionCardMsgId;
578
602
  private updateTimer;
579
- private isListening;
603
+ private activeSkill;
604
+ isListening: boolean;
580
605
  constructor(options: ControlRoomOptions);
581
606
  constructor(tg: TelegramClient, oc: OpenCodeClient, cfgManager: ConfigManager);
582
607
  get tg(): TelegramClient;
@@ -592,8 +617,21 @@ declare class ControlRoom {
592
617
  private startMissionCardTicker;
593
618
  private renderMissionCardText;
594
619
  private updateMissionCard;
620
+ /**
621
+ * The complete, feature-rich 5-row interactive home keyboard with all 14 buttons.
622
+ */
595
623
  getMainKeyboard(): ChannelKeyboard & InlineKeyboardMarkup;
624
+ private wrapKeyboard;
625
+ private sendAgentsMenu;
626
+ sendModelsMenu(page?: number): Promise<void>;
596
627
  private sendModeMenu;
628
+ private sendSessionsMenu;
629
+ private sendStatusReport;
630
+ private getAllAvailableSkills;
631
+ sendSkillsMenu(page?: number): Promise<void>;
632
+ private sendUsageReport;
633
+ private sendLanguageMenu;
634
+ private sendHandoffReport;
597
635
  private sendWorkspaceMenu;
598
636
  switchWorkspace(newPath: string): Promise<void>;
599
637
  sendDiff(): Promise<void>;
@@ -635,6 +673,10 @@ declare const TRANSLATIONS: {
635
673
  readonly btn_handoff: "🔁 Handoff";
636
674
  readonly btn_help: "❓ Help";
637
675
  readonly btn_language: "🌐 Language";
676
+ readonly btn_back: "⬅️ Back";
677
+ readonly btn_all_models: "➡️ All Models";
678
+ readonly btn_favorites: "⭐ Favorites";
679
+ readonly btn_next: "➡️ Next";
638
680
  readonly perm_allow_once: "✅ Allow Once";
639
681
  readonly perm_always_allow: "♾️ Always Allow";
640
682
  readonly perm_reject: "⛔ Reject";
@@ -676,6 +718,10 @@ declare const TRANSLATIONS: {
676
718
  readonly btn_handoff: "🔁 تسليم";
677
719
  readonly btn_help: "❓ مساعدة";
678
720
  readonly btn_language: "🌐 اللغة";
721
+ readonly btn_back: "⬅️ رجوع";
722
+ readonly btn_all_models: "➡️ المزيد";
723
+ readonly btn_favorites: "⭐ المفضلة";
724
+ readonly btn_next: "➡️ التالي";
679
725
  readonly perm_allow_once: "✅ مرة واحدة";
680
726
  readonly perm_always_allow: "♾️ سماح دائماً";
681
727
  readonly perm_reject: "⛔ رفض";
@@ -707,11 +753,10 @@ type Language = 'en' | 'ar';
707
753
  type TranslationKey = keyof typeof TRANSLATIONS.en;
708
754
  declare function t(key: TranslationKey, lang?: Language, params?: Record<string, string | number>): string;
709
755
 
710
- declare const VERSION = "2.0.0";
756
+ declare const VERSION = "2.0.4";
711
757
  /**
712
758
  * Main entry point for CLI execution.
713
759
  */
714
760
  declare function runCli(argv?: string[]): Promise<void>;
715
761
 
716
- export { AGENTGRAM_CONFIG_DIR, ChannelRegistry, ConfigManager, ConsoleChannelAdapter, ControlRoom, DEFAULT_DENY_PATTERNS, EngineRegistry, LEGACY_CONFIG_DIR, LINUX_SERVICE_NAME, MACOS_PLIST_NAME, OpenCodeAdapter, OpenCodeClient, PromptInjectionGuard, SYSTEM_HEADER, SecurityPolicy, ServiceManager, ShellEngineAdapter, TRANSLATIONS, TelegramChannelAdapter, TelegramClient, VERSION, computeWorkspaceId, decidePermission, ensureConfigDirs, escapeHtml, fromTelegramMarkup, getEntryPoint, getFreePort, getGlobalConfigDir, parseCallback, permissionKeyboard, runCli, t, toTelegramMarkup, TRANSLATIONS as translations };
717
- export type { AgentEngineEvent, AgentEngineToolCall, AgentSession, AgentSessionOptions, AgentgramConfig, CallbackQuery, ChannelButton, ChannelFactory, ChannelKeyboard, ChannelMessageResult, ChannelSendOptions, ChannelUpdateHandler, EngineFactory, ExecutionMode, IAgentEngine, IChannelAdapter, IncomingChannelAction, IncomingChannelMessage, InlineKeyboardButton, InlineKeyboardMarkup, Language, OpenCodeEvent, OpenCodePermissionRequest, OpenCodeQuestionOption, OpenCodeQuestionRequest, OpenCodeRun, OpenCodeToolCall, PathCheckResult, PermissionDecision, PromptCategory, PromptDetectionResult, QuarantineResult, ServiceStatus, ShellEngineOptions, TelegramChat, TelegramMessage, TelegramPhotoSize, TelegramUpdate, TelegramUser, TranslationKey };
762
+ export { AGENTGRAM_CONFIG_DIR, type AgentEngineEvent, type AgentEngineToolCall, type AgentSession, type AgentSessionOptions, type AgentgramConfig, type CallbackQuery, type ChannelButton, type ChannelFactory, type ChannelKeyboard, type ChannelMessageResult, ChannelRegistry, type ChannelSendOptions, type ChannelUpdateHandler, ConfigManager, ConsoleChannelAdapter, ControlRoom, DEFAULT_DENY_PATTERNS, type EngineFactory, EngineRegistry, type ExecutionMode, type IAgentEngine, type IChannelAdapter, type IncomingChannelAction, type IncomingChannelMessage, type InlineKeyboardButton, type InlineKeyboardMarkup, LEGACY_CONFIG_DIR, LINUX_SERVICE_NAME, type Language, MACOS_PLIST_NAME, OpenCodeAdapter, OpenCodeClient, type OpenCodeEvent, type OpenCodePermissionRequest, type OpenCodeQuestionOption, type OpenCodeQuestionRequest, type OpenCodeRun, type OpenCodeToolCall, type PathCheckResult, type PermissionDecision, type PromptCategory, type PromptDetectionResult, PromptInjectionGuard, type QuarantineResult, SYSTEM_HEADER, SecurityPolicy, ServiceManager, type ServiceStatus, ShellEngineAdapter, type ShellEngineOptions, TRANSLATIONS, TelegramChannelAdapter, type TelegramChat, TelegramClient, type TelegramMessage, type TelegramPhotoSize, type TelegramUpdate, type TelegramUser, type TranslationKey, VERSION, computeWorkspaceId, decidePermission, ensureConfigDirs, escapeHtml, fromTelegramMarkup, getEntryPoint, getFreePort, getGlobalConfigDir, parseCallback, permissionKeyboard, runCli, t, toTelegramMarkup, TRANSLATIONS as translations };