opencode-plugin-teleprompt 0.1.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -0
  3. package/dist/config.d.ts +2 -0
  4. package/dist/config.js +40 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/index.d.ts +7 -0
  7. package/dist/index.js +8 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/opencode/binding.d.ts +2 -0
  10. package/dist/opencode/binding.js +12 -0
  11. package/dist/opencode/binding.js.map +1 -0
  12. package/dist/opencode/events.d.ts +31 -0
  13. package/dist/opencode/events.js +74 -0
  14. package/dist/opencode/events.js.map +1 -0
  15. package/dist/opencode/permissions.d.ts +4 -0
  16. package/dist/opencode/permissions.js +66 -0
  17. package/dist/opencode/permissions.js.map +1 -0
  18. package/dist/opencode/submit.d.ts +7 -0
  19. package/dist/opencode/submit.js +14 -0
  20. package/dist/opencode/submit.js.map +1 -0
  21. package/dist/runtime/controller.d.ts +78 -0
  22. package/dist/runtime/controller.js +1180 -0
  23. package/dist/runtime/controller.js.map +1 -0
  24. package/dist/runtime/shutdown.d.ts +1 -0
  25. package/dist/runtime/shutdown.js +10 -0
  26. package/dist/runtime/shutdown.js.map +1 -0
  27. package/dist/state/lease.d.ts +12 -0
  28. package/dist/state/lease.js +56 -0
  29. package/dist/state/lease.js.map +1 -0
  30. package/dist/state/store.d.ts +9 -0
  31. package/dist/state/store.js +59 -0
  32. package/dist/state/store.js.map +1 -0
  33. package/dist/summary/format.d.ts +2 -0
  34. package/dist/summary/format.js +23 -0
  35. package/dist/summary/format.js.map +1 -0
  36. package/dist/telegram/api.d.ts +16 -0
  37. package/dist/telegram/api.js +78 -0
  38. package/dist/telegram/api.js.map +1 -0
  39. package/dist/telegram/parser.d.ts +3 -0
  40. package/dist/telegram/parser.js +267 -0
  41. package/dist/telegram/parser.js.map +1 -0
  42. package/dist/telegram/poller.d.ts +18 -0
  43. package/dist/telegram/poller.js +50 -0
  44. package/dist/telegram/poller.js.map +1 -0
  45. package/dist/tui-types.d.ts +55 -0
  46. package/dist/tui-types.js +2 -0
  47. package/dist/tui-types.js.map +1 -0
  48. package/dist/tui.d.ts +2 -0
  49. package/dist/tui.js +98 -0
  50. package/dist/tui.js.map +1 -0
  51. package/dist/types.d.ts +167 -0
  52. package/dist/types.js +2 -0
  53. package/dist/types.js.map +1 -0
  54. package/package.json +55 -0
@@ -0,0 +1,167 @@
1
+ export type BridgeConfig = {
2
+ botToken: string;
3
+ channelID: string;
4
+ prefix: string;
5
+ pollTimeoutSec: number;
6
+ heartbeatMs: number;
7
+ leaseTtlMs: number;
8
+ summaryMaxChars: number;
9
+ onlineNotice: boolean;
10
+ offlineNotice: boolean;
11
+ };
12
+ export type BridgeStatus = "offline" | "online";
13
+ export type LeaseRecord = {
14
+ ownerInstanceID: string;
15
+ ownerHeartbeatAt: number;
16
+ };
17
+ export type BoundState = {
18
+ sessionID?: string;
19
+ channelID: string;
20
+ status: BridgeStatus;
21
+ model?: {
22
+ providerID: string;
23
+ modelID: string;
24
+ };
25
+ };
26
+ export type PromptJob = {
27
+ telegramUpdateID: number;
28
+ telegramMessageID: number;
29
+ telegramChannelID: string;
30
+ prompt: string;
31
+ userMessageID: string;
32
+ createdAt: number;
33
+ startedAt?: number;
34
+ };
35
+ export type PendingPermission = {
36
+ requestID: string;
37
+ sessionID: string;
38
+ permission: string;
39
+ patterns: string[];
40
+ metadata: Record<string, unknown>;
41
+ announcedAt: number;
42
+ };
43
+ export type PromptHistoryItem = {
44
+ jobID: string;
45
+ prompt: string;
46
+ summary: string;
47
+ changedFiles: string[];
48
+ status: "completed" | "failed" | "interrupted";
49
+ at: number;
50
+ };
51
+ export type BridgeStoreData = {
52
+ version: 1;
53
+ pollingOffset: number;
54
+ lease?: LeaseRecord;
55
+ bound: BoundState;
56
+ promptQueue: PromptJob[];
57
+ activePrompt?: PromptJob;
58
+ pendingPermissions: Record<string, PendingPermission>;
59
+ promptHistory: PromptHistoryItem[];
60
+ recentPrompts: Array<{
61
+ jobID: string;
62
+ prompt: string;
63
+ at: number;
64
+ }>;
65
+ updatedAt: number;
66
+ };
67
+ export type TelegramUpdate = {
68
+ update_id: number;
69
+ channel_post?: TelegramChannelPost;
70
+ };
71
+ export type TelegramChannelPost = {
72
+ message_id: number;
73
+ date: number;
74
+ chat: {
75
+ id: number | string;
76
+ type: string;
77
+ title?: string;
78
+ };
79
+ text?: string;
80
+ };
81
+ export type TelegramCommandPrompt = {
82
+ kind: "prompt";
83
+ prompt: string;
84
+ };
85
+ export type TelegramCommandPermission = {
86
+ kind: "permission";
87
+ action: "once" | "always" | "reject";
88
+ requestID: string;
89
+ };
90
+ export type TelegramCommandStatus = {
91
+ kind: "status";
92
+ };
93
+ export type TelegramCommandDisconnect = {
94
+ kind: "disconnect";
95
+ };
96
+ export type TelegramCommandInterrupt = {
97
+ kind: "interrupt";
98
+ };
99
+ export type TelegramCommandQueue = {
100
+ kind: "queue";
101
+ };
102
+ export type TelegramCommandCancel = {
103
+ kind: "cancel";
104
+ target: string;
105
+ };
106
+ export type TelegramCommandRetry = {
107
+ kind: "retry";
108
+ };
109
+ export type TelegramCommandContext = {
110
+ kind: "context";
111
+ };
112
+ export type TelegramCommandCompact = {
113
+ kind: "compact";
114
+ };
115
+ export type TelegramCommandNewSession = {
116
+ kind: "newsession";
117
+ };
118
+ export type TelegramCommandResetContext = {
119
+ kind: "reset-context";
120
+ };
121
+ export type TelegramCommandWho = {
122
+ kind: "who";
123
+ };
124
+ export type TelegramCommandHealth = {
125
+ kind: "health";
126
+ };
127
+ export type TelegramCommandReclaim = {
128
+ kind: "reclaim";
129
+ };
130
+ export type TelegramCommandHistory = {
131
+ kind: "history";
132
+ };
133
+ export type TelegramCommandLastError = {
134
+ kind: "last-error";
135
+ };
136
+ export type TelegramCommandModel = {
137
+ kind: "model";
138
+ target?: {
139
+ providerID: string;
140
+ modelID: string;
141
+ };
142
+ preset?: "fast" | "smart" | "max";
143
+ };
144
+ export type TelegramCommand = TelegramCommandPrompt | TelegramCommandPermission | TelegramCommandStatus | TelegramCommandDisconnect | TelegramCommandInterrupt | TelegramCommandQueue | TelegramCommandCancel | TelegramCommandRetry | TelegramCommandContext | TelegramCommandCompact | TelegramCommandNewSession | TelegramCommandResetContext | TelegramCommandWho | TelegramCommandHealth | TelegramCommandReclaim | TelegramCommandHistory | TelegramCommandLastError | TelegramCommandModel;
145
+ export type ParsedTelegramCommand = {
146
+ updateID: number;
147
+ messageID: number;
148
+ channelID: string;
149
+ rawText: string;
150
+ command: TelegramCommand;
151
+ };
152
+ export type SummaryPayload = {
153
+ text: string;
154
+ changedFiles: string[];
155
+ hadError?: boolean;
156
+ };
157
+ export type RuntimeDeps = {
158
+ now: () => number;
159
+ randomID: () => string;
160
+ };
161
+ export type PermissionAskInput = {
162
+ id: string;
163
+ sessionID: string;
164
+ permission: string;
165
+ patterns: string[];
166
+ metadata: Record<string, unknown>;
167
+ };
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "opencode-plugin-teleprompt",
3
+ "version": "0.1.0",
4
+ "description": "OpenCode TUI plugin to bridge a Telegram channel with the active session",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/bcanozgur/opencode-plugin-teleprompt.git"
11
+ },
12
+ "homepage": "https://github.com/bcanozgur/opencode-plugin-teleprompt#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/bcanozgur/opencode-plugin-teleprompt/issues"
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "import": "./dist/index.js",
19
+ "types": "./dist/index.d.ts"
20
+ }
21
+ },
22
+ "keywords": [
23
+ "opencode",
24
+ "opencode-plugin",
25
+ "telegram",
26
+ "tui"
27
+ ],
28
+ "license": "MIT",
29
+ "engines": {
30
+ "node": ">=20"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md",
38
+ "LICENSE"
39
+ ],
40
+ "scripts": {
41
+ "build": "tsc -p tsconfig.json",
42
+ "typecheck": "tsc --noEmit -p tsconfig.json",
43
+ "verify:release": "npm run typecheck && npm run build && npm pack --dry-run",
44
+ "prepublishOnly": "npm run verify:release"
45
+ },
46
+ "dependencies": {
47
+ "@opencode-ai/plugin": "^0.6.0",
48
+ "@opencode-ai/sdk": "^0.6.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/node": "^22.15.0",
52
+ "opencode-plugin-teleprompt": "file:",
53
+ "typescript": "^5.8.3"
54
+ }
55
+ }