opencode-plugin-teleprompt 0.2.0 → 0.2.2

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.
@@ -1,4 +1,5 @@
1
- import type { BridgeConfig, BridgeStoreData, ParsedTelegramCommand, RuntimeDeps } from "../types.js";
1
+ import type { BridgeConfig, BridgeStoreData, ParsedCallbackQuery, ParsedTelegramCommand, RuntimeDeps } from "../types.js";
2
+ import { TelegramApi } from "../telegram/api.js";
2
3
  import type { TuiPluginApi } from "../tui-types.js";
3
4
  type SessionCredentials = {
4
5
  botToken: string;
@@ -20,27 +21,43 @@ export declare class BridgeController {
20
21
  private pollTask?;
21
22
  private eventStream?;
22
23
  private eventRestartTimer?;
24
+ private streamedText;
23
25
  private readonly shutdownOnce;
24
26
  private processingQueue;
25
27
  private lastEscAt;
26
28
  private sessionCredentials?;
27
29
  private activePromptCheckInFlight;
28
30
  private completionInFlight;
29
- constructor(api: TuiPluginApi, config: BridgeConfig, storePath: string, deps?: Partial<RuntimeDeps>);
31
+ constructor(api: TuiPluginApi, config: BridgeConfig, storePath: string, deps?: Partial<RuntimeDeps>, telegram?: TelegramApi);
30
32
  private log;
33
+ private safeSendTelegram;
31
34
  init(): Promise<void>;
32
35
  bindCurrent(credentials?: SessionCredentials): Promise<string>;
33
36
  unbind(): Promise<void>;
37
+ private handleDiag;
34
38
  statusLine(): Promise<string>;
35
- handleTelegramCommand(command: ParsedTelegramCommand): Promise<void>;
39
+ handleTelegramCommand(command: ParsedTelegramCommand | ParsedCallbackQuery): Promise<void>;
40
+ private handleTelegramMessage;
36
41
  shutdown(): Promise<void>;
37
42
  handleLocalTuiCommand(command: string): Promise<void>;
38
43
  private processPromptQueue;
39
44
  private onAssistantCompleted;
40
45
  private completeActivePrompt;
46
+ private onMessagePartUpdated;
41
47
  private onUserMessage;
42
48
  private onPermissionAsked;
49
+ private onPermissionReplied;
43
50
  private handlePermissionReply;
51
+ private handleTelegramCallback;
52
+ private handleCallbackQuestion;
53
+ private handleQuestionToggle;
54
+ private handleQuestionConfirm;
55
+ private handleQuestionCommand;
56
+ private handleQuestionReply;
57
+ private handleQuestionReject;
58
+ private onQuestionAsked;
59
+ private onQuestionReplied;
60
+ private onQuestionRejected;
44
61
  private handleModelCommand;
45
62
  private fetchAvailableModels;
46
63
  private buildSummary;
@@ -87,5 +104,23 @@ export declare class BridgeController {
87
104
  private reconcileActivePrompt;
88
105
  private clearTuiPrompt;
89
106
  private waitForPromptCompletion;
107
+ /**
108
+ * Test-only hooks. Exposed as a single object so production code never
109
+ * reaches for these methods and tests can drive the controller
110
+ * deterministically without spinning up the full TUI lifecycle.
111
+ */
112
+ get __test(): {
113
+ onPermissionAsked: BridgeController["onPermissionAsked"];
114
+ onQuestionAsked: BridgeController["onQuestionAsked"];
115
+ onQuestionReplied: BridgeController["onQuestionReplied"];
116
+ onQuestionRejected: BridgeController["onQuestionRejected"];
117
+ handleTelegramCallback: BridgeController["handleTelegramCallback"];
118
+ handleTelegramMessage: BridgeController["handleTelegramMessage"];
119
+ handleQuestionToggle: BridgeController["handleQuestionToggle"];
120
+ startEventStream: (sessionID: string) => Promise<void>;
121
+ setState: (next: BridgeStoreData) => Promise<void>;
122
+ syncState: () => Promise<BridgeStoreData>;
123
+ getStorePath: () => string;
124
+ };
90
125
  }
91
126
  export {};