opensentinel 2.1.1

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +283 -0
  3. package/dist/bot-KJ26BG56.js +15 -0
  4. package/dist/bot-KJ26BG56.js.map +1 -0
  5. package/dist/charts-MMXM6BWW.js +241 -0
  6. package/dist/charts-MMXM6BWW.js.map +1 -0
  7. package/dist/chunk-4LVWXUNC.js +1079 -0
  8. package/dist/chunk-4LVWXUNC.js.map +1 -0
  9. package/dist/chunk-4TG2IG5K.js +5249 -0
  10. package/dist/chunk-4TG2IG5K.js.map +1 -0
  11. package/dist/chunk-6DRDKB45.js +251 -0
  12. package/dist/chunk-6DRDKB45.js.map +1 -0
  13. package/dist/chunk-6SNHU3CY.js +123 -0
  14. package/dist/chunk-6SNHU3CY.js.map +1 -0
  15. package/dist/chunk-CI6Q63MM.js +1613 -0
  16. package/dist/chunk-CI6Q63MM.js.map +1 -0
  17. package/dist/chunk-CQ4JURG7.js +57 -0
  18. package/dist/chunk-CQ4JURG7.js.map +1 -0
  19. package/dist/chunk-F6QUZQGI.js +51 -0
  20. package/dist/chunk-F6QUZQGI.js.map +1 -0
  21. package/dist/chunk-GK3E2I7A.js +216 -0
  22. package/dist/chunk-GK3E2I7A.js.map +1 -0
  23. package/dist/chunk-GUBEEYDW.js +211 -0
  24. package/dist/chunk-GUBEEYDW.js.map +1 -0
  25. package/dist/chunk-GVJVEWHI.js +29 -0
  26. package/dist/chunk-GVJVEWHI.js.map +1 -0
  27. package/dist/chunk-HH2HBTQM.js +806 -0
  28. package/dist/chunk-HH2HBTQM.js.map +1 -0
  29. package/dist/chunk-JXUP2X7V.js +129 -0
  30. package/dist/chunk-JXUP2X7V.js.map +1 -0
  31. package/dist/chunk-KHNYJY2Z.js +178 -0
  32. package/dist/chunk-KHNYJY2Z.js.map +1 -0
  33. package/dist/chunk-L3F43VPB.js +652 -0
  34. package/dist/chunk-L3F43VPB.js.map +1 -0
  35. package/dist/chunk-L3PDU3XN.js +803 -0
  36. package/dist/chunk-L3PDU3XN.js.map +1 -0
  37. package/dist/chunk-NSBPE2FW.js +17 -0
  38. package/dist/chunk-NSBPE2FW.js.map +1 -0
  39. package/dist/cli.d.ts +1 -0
  40. package/dist/cli.js +52 -0
  41. package/dist/cli.js.map +1 -0
  42. package/dist/commands/setup.d.ts +9 -0
  43. package/dist/commands/setup.js +374 -0
  44. package/dist/commands/setup.js.map +1 -0
  45. package/dist/commands/start.d.ts +8 -0
  46. package/dist/commands/start.js +27 -0
  47. package/dist/commands/start.js.map +1 -0
  48. package/dist/commands/status.d.ts +8 -0
  49. package/dist/commands/status.js +57 -0
  50. package/dist/commands/status.js.map +1 -0
  51. package/dist/commands/stop.d.ts +8 -0
  52. package/dist/commands/stop.js +37 -0
  53. package/dist/commands/stop.js.map +1 -0
  54. package/dist/commands/utils.d.ts +50 -0
  55. package/dist/commands/utils.js +36 -0
  56. package/dist/commands/utils.js.map +1 -0
  57. package/dist/discord-ZOJFTVTB.js +49 -0
  58. package/dist/discord-ZOJFTVTB.js.map +1 -0
  59. package/dist/imessage-JFRB6EJ7.js +14 -0
  60. package/dist/imessage-JFRB6EJ7.js.map +1 -0
  61. package/dist/lib.d.ts +855 -0
  62. package/dist/lib.js +274 -0
  63. package/dist/lib.js.map +1 -0
  64. package/dist/mcp-LS7Q3Z5W.js +30 -0
  65. package/dist/mcp-LS7Q3Z5W.js.map +1 -0
  66. package/dist/scheduler-EZ7CZMCS.js +42 -0
  67. package/dist/scheduler-EZ7CZMCS.js.map +1 -0
  68. package/dist/signal-T3MCSULM.js +14 -0
  69. package/dist/signal-T3MCSULM.js.map +1 -0
  70. package/dist/slack-N2M4FHAJ.js +54 -0
  71. package/dist/slack-N2M4FHAJ.js.map +1 -0
  72. package/dist/src-K7GASHRH.js +430 -0
  73. package/dist/src-K7GASHRH.js.map +1 -0
  74. package/dist/tools-24GZHYRF.js +16 -0
  75. package/dist/tools-24GZHYRF.js.map +1 -0
  76. package/dist/whatsapp-VCRUPAO5.js +14 -0
  77. package/dist/whatsapp-VCRUPAO5.js.map +1 -0
  78. package/drizzle/0000_chilly_shinobi_shaw.sql +75 -0
  79. package/drizzle/0001_freezing_shape.sql +274 -0
  80. package/drizzle/meta/0000_snapshot.json +529 -0
  81. package/drizzle/meta/0001_snapshot.json +2576 -0
  82. package/drizzle/meta/_journal.json +20 -0
  83. package/package.json +98 -0
package/dist/lib.d.ts ADDED
@@ -0,0 +1,855 @@
1
+ import { z } from 'zod';
2
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
3
+ import { Tool } from '@anthropic-ai/sdk/resources/messages';
4
+ import * as hono_types from 'hono/types';
5
+ import { Hono } from 'hono';
6
+ import * as grammy from 'grammy';
7
+ import { Bot, Context } from 'grammy';
8
+ import { Client } from 'discord.js';
9
+ import * as _slack_bolt from '@slack/bolt';
10
+ import * as _slack_web_api from '@slack/web-api';
11
+ import { drizzle } from 'drizzle-orm/postgres-js';
12
+
13
+ declare const envSchema: z.ZodObject<{
14
+ CLAUDE_API_KEY: z.ZodString;
15
+ TELEGRAM_BOT_TOKEN: z.ZodDefault<z.ZodOptional<z.ZodString>>;
16
+ TELEGRAM_CHAT_ID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
17
+ OPENAI_API_KEY: z.ZodDefault<z.ZodOptional<z.ZodString>>;
18
+ ELEVENLABS_API_KEY: z.ZodDefault<z.ZodOptional<z.ZodString>>;
19
+ ELEVENLABS_VOICE_ID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
20
+ DATABASE_URL: z.ZodDefault<z.ZodString>;
21
+ REDIS_URL: z.ZodDefault<z.ZodString>;
22
+ DISCORD_BOT_TOKEN: z.ZodOptional<z.ZodString>;
23
+ DISCORD_CLIENT_ID: z.ZodOptional<z.ZodString>;
24
+ DISCORD_GUILD_ID: z.ZodOptional<z.ZodString>;
25
+ DISCORD_ALLOWED_USER_IDS: z.ZodOptional<z.ZodString>;
26
+ DISCORD_ALLOWED_ROLE_IDS: z.ZodOptional<z.ZodString>;
27
+ SLACK_BOT_TOKEN: z.ZodOptional<z.ZodString>;
28
+ SLACK_SIGNING_SECRET: z.ZodOptional<z.ZodString>;
29
+ SLACK_APP_TOKEN: z.ZodOptional<z.ZodString>;
30
+ SLACK_SOCKET_MODE: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
31
+ SLACK_PORT: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
32
+ SLACK_ALLOWED_USER_IDS: z.ZodOptional<z.ZodString>;
33
+ SLACK_ALLOWED_CHANNEL_IDS: z.ZodOptional<z.ZodString>;
34
+ NOTION_API_KEY: z.ZodOptional<z.ZodString>;
35
+ NOTION_ROOT_PAGE_ID: z.ZodOptional<z.ZodString>;
36
+ EMAIL_IMAP_HOST: z.ZodOptional<z.ZodString>;
37
+ EMAIL_IMAP_PORT: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
38
+ EMAIL_IMAP_SECURE: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
39
+ EMAIL_SMTP_HOST: z.ZodOptional<z.ZodString>;
40
+ EMAIL_SMTP_PORT: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
41
+ EMAIL_SMTP_SECURE: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
42
+ EMAIL_USER: z.ZodOptional<z.ZodString>;
43
+ EMAIL_PASSWORD: z.ZodOptional<z.ZodString>;
44
+ EMAIL_PROVIDER: z.ZodOptional<z.ZodEnum<["gmail", "outlook", "yahoo", "custom"]>>;
45
+ GITHUB_TOKEN: z.ZodOptional<z.ZodString>;
46
+ GITHUB_WEBHOOK_SECRET: z.ZodOptional<z.ZodString>;
47
+ GOOGLE_DRIVE_CLIENT_ID: z.ZodOptional<z.ZodString>;
48
+ GOOGLE_DRIVE_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
49
+ GOOGLE_DRIVE_REDIRECT_URI: z.ZodOptional<z.ZodString>;
50
+ GOOGLE_DRIVE_REFRESH_TOKEN: z.ZodOptional<z.ZodString>;
51
+ DROPBOX_APP_KEY: z.ZodOptional<z.ZodString>;
52
+ DROPBOX_APP_SECRET: z.ZodOptional<z.ZodString>;
53
+ DROPBOX_ACCESS_TOKEN: z.ZodOptional<z.ZodString>;
54
+ DROPBOX_REFRESH_TOKEN: z.ZodOptional<z.ZodString>;
55
+ ALPHA_VANTAGE_API_KEY: z.ZodOptional<z.ZodString>;
56
+ HUGGINGFACE_ACCESS_TOKEN: z.ZodOptional<z.ZodString>;
57
+ TWILIO_ACCOUNT_SID: z.ZodOptional<z.ZodString>;
58
+ TWILIO_AUTH_TOKEN: z.ZodOptional<z.ZodString>;
59
+ TWILIO_PHONE_NUMBER: z.ZodOptional<z.ZodString>;
60
+ HOME_ASSISTANT_URL: z.ZodOptional<z.ZodString>;
61
+ HOME_ASSISTANT_TOKEN: z.ZodOptional<z.ZodString>;
62
+ SPOTIFY_CLIENT_ID: z.ZodOptional<z.ZodString>;
63
+ SPOTIFY_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
64
+ SPOTIFY_REDIRECT_URI: z.ZodOptional<z.ZodString>;
65
+ MCP_ENABLED: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
66
+ MCP_CONFIG_PATH: z.ZodDefault<z.ZodOptional<z.ZodString>>;
67
+ WHATSAPP_ENABLED: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
68
+ WHATSAPP_AUTH_DIR: z.ZodDefault<z.ZodOptional<z.ZodString>>;
69
+ WHATSAPP_ALLOWED_NUMBERS: z.ZodOptional<z.ZodString>;
70
+ SIGNAL_ENABLED: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
71
+ SIGNAL_PHONE_NUMBER: z.ZodOptional<z.ZodString>;
72
+ SIGNAL_CLI_PATH: z.ZodDefault<z.ZodOptional<z.ZodString>>;
73
+ SIGNAL_ALLOWED_NUMBERS: z.ZodOptional<z.ZodString>;
74
+ IMESSAGE_ENABLED: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
75
+ IMESSAGE_MODE: z.ZodDefault<z.ZodOptional<z.ZodEnum<["bluebubbles", "applescript"]>>>;
76
+ IMESSAGE_BLUEBUBBLES_URL: z.ZodOptional<z.ZodString>;
77
+ IMESSAGE_BLUEBUBBLES_PASSWORD: z.ZodOptional<z.ZodString>;
78
+ IMESSAGE_ALLOWED_NUMBERS: z.ZodOptional<z.ZodString>;
79
+ PORT: z.ZodDefault<z.ZodNumber>;
80
+ NODE_ENV: z.ZodDefault<z.ZodEnum<["development", "production", "test"]>>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ CLAUDE_API_KEY: string;
83
+ TELEGRAM_BOT_TOKEN: string;
84
+ TELEGRAM_CHAT_ID: string;
85
+ OPENAI_API_KEY: string;
86
+ ELEVENLABS_API_KEY: string;
87
+ ELEVENLABS_VOICE_ID: string;
88
+ DATABASE_URL: string;
89
+ REDIS_URL: string;
90
+ SLACK_SOCKET_MODE: boolean;
91
+ SLACK_PORT: number;
92
+ EMAIL_IMAP_PORT: number;
93
+ EMAIL_IMAP_SECURE: boolean;
94
+ EMAIL_SMTP_PORT: number;
95
+ EMAIL_SMTP_SECURE: boolean;
96
+ MCP_ENABLED: boolean;
97
+ MCP_CONFIG_PATH: string;
98
+ WHATSAPP_ENABLED: boolean;
99
+ WHATSAPP_AUTH_DIR: string;
100
+ SIGNAL_ENABLED: boolean;
101
+ SIGNAL_CLI_PATH: string;
102
+ IMESSAGE_ENABLED: boolean;
103
+ IMESSAGE_MODE: "bluebubbles" | "applescript";
104
+ PORT: number;
105
+ NODE_ENV: "development" | "production" | "test";
106
+ DISCORD_BOT_TOKEN?: string | undefined;
107
+ DISCORD_CLIENT_ID?: string | undefined;
108
+ DISCORD_GUILD_ID?: string | undefined;
109
+ DISCORD_ALLOWED_USER_IDS?: string | undefined;
110
+ DISCORD_ALLOWED_ROLE_IDS?: string | undefined;
111
+ SLACK_BOT_TOKEN?: string | undefined;
112
+ SLACK_SIGNING_SECRET?: string | undefined;
113
+ SLACK_APP_TOKEN?: string | undefined;
114
+ SLACK_ALLOWED_USER_IDS?: string | undefined;
115
+ SLACK_ALLOWED_CHANNEL_IDS?: string | undefined;
116
+ NOTION_API_KEY?: string | undefined;
117
+ NOTION_ROOT_PAGE_ID?: string | undefined;
118
+ EMAIL_IMAP_HOST?: string | undefined;
119
+ EMAIL_SMTP_HOST?: string | undefined;
120
+ EMAIL_USER?: string | undefined;
121
+ EMAIL_PASSWORD?: string | undefined;
122
+ EMAIL_PROVIDER?: "gmail" | "outlook" | "yahoo" | "custom" | undefined;
123
+ GITHUB_TOKEN?: string | undefined;
124
+ GITHUB_WEBHOOK_SECRET?: string | undefined;
125
+ GOOGLE_DRIVE_CLIENT_ID?: string | undefined;
126
+ GOOGLE_DRIVE_CLIENT_SECRET?: string | undefined;
127
+ GOOGLE_DRIVE_REDIRECT_URI?: string | undefined;
128
+ GOOGLE_DRIVE_REFRESH_TOKEN?: string | undefined;
129
+ DROPBOX_APP_KEY?: string | undefined;
130
+ DROPBOX_APP_SECRET?: string | undefined;
131
+ DROPBOX_ACCESS_TOKEN?: string | undefined;
132
+ DROPBOX_REFRESH_TOKEN?: string | undefined;
133
+ ALPHA_VANTAGE_API_KEY?: string | undefined;
134
+ HUGGINGFACE_ACCESS_TOKEN?: string | undefined;
135
+ TWILIO_ACCOUNT_SID?: string | undefined;
136
+ TWILIO_AUTH_TOKEN?: string | undefined;
137
+ TWILIO_PHONE_NUMBER?: string | undefined;
138
+ HOME_ASSISTANT_URL?: string | undefined;
139
+ HOME_ASSISTANT_TOKEN?: string | undefined;
140
+ SPOTIFY_CLIENT_ID?: string | undefined;
141
+ SPOTIFY_CLIENT_SECRET?: string | undefined;
142
+ SPOTIFY_REDIRECT_URI?: string | undefined;
143
+ WHATSAPP_ALLOWED_NUMBERS?: string | undefined;
144
+ SIGNAL_PHONE_NUMBER?: string | undefined;
145
+ SIGNAL_ALLOWED_NUMBERS?: string | undefined;
146
+ IMESSAGE_BLUEBUBBLES_URL?: string | undefined;
147
+ IMESSAGE_BLUEBUBBLES_PASSWORD?: string | undefined;
148
+ IMESSAGE_ALLOWED_NUMBERS?: string | undefined;
149
+ }, {
150
+ CLAUDE_API_KEY: string;
151
+ TELEGRAM_BOT_TOKEN?: string | undefined;
152
+ TELEGRAM_CHAT_ID?: string | undefined;
153
+ OPENAI_API_KEY?: string | undefined;
154
+ ELEVENLABS_API_KEY?: string | undefined;
155
+ ELEVENLABS_VOICE_ID?: string | undefined;
156
+ DATABASE_URL?: string | undefined;
157
+ REDIS_URL?: string | undefined;
158
+ DISCORD_BOT_TOKEN?: string | undefined;
159
+ DISCORD_CLIENT_ID?: string | undefined;
160
+ DISCORD_GUILD_ID?: string | undefined;
161
+ DISCORD_ALLOWED_USER_IDS?: string | undefined;
162
+ DISCORD_ALLOWED_ROLE_IDS?: string | undefined;
163
+ SLACK_BOT_TOKEN?: string | undefined;
164
+ SLACK_SIGNING_SECRET?: string | undefined;
165
+ SLACK_APP_TOKEN?: string | undefined;
166
+ SLACK_SOCKET_MODE?: boolean | undefined;
167
+ SLACK_PORT?: number | undefined;
168
+ SLACK_ALLOWED_USER_IDS?: string | undefined;
169
+ SLACK_ALLOWED_CHANNEL_IDS?: string | undefined;
170
+ NOTION_API_KEY?: string | undefined;
171
+ NOTION_ROOT_PAGE_ID?: string | undefined;
172
+ EMAIL_IMAP_HOST?: string | undefined;
173
+ EMAIL_IMAP_PORT?: number | undefined;
174
+ EMAIL_IMAP_SECURE?: boolean | undefined;
175
+ EMAIL_SMTP_HOST?: string | undefined;
176
+ EMAIL_SMTP_PORT?: number | undefined;
177
+ EMAIL_SMTP_SECURE?: boolean | undefined;
178
+ EMAIL_USER?: string | undefined;
179
+ EMAIL_PASSWORD?: string | undefined;
180
+ EMAIL_PROVIDER?: "gmail" | "outlook" | "yahoo" | "custom" | undefined;
181
+ GITHUB_TOKEN?: string | undefined;
182
+ GITHUB_WEBHOOK_SECRET?: string | undefined;
183
+ GOOGLE_DRIVE_CLIENT_ID?: string | undefined;
184
+ GOOGLE_DRIVE_CLIENT_SECRET?: string | undefined;
185
+ GOOGLE_DRIVE_REDIRECT_URI?: string | undefined;
186
+ GOOGLE_DRIVE_REFRESH_TOKEN?: string | undefined;
187
+ DROPBOX_APP_KEY?: string | undefined;
188
+ DROPBOX_APP_SECRET?: string | undefined;
189
+ DROPBOX_ACCESS_TOKEN?: string | undefined;
190
+ DROPBOX_REFRESH_TOKEN?: string | undefined;
191
+ ALPHA_VANTAGE_API_KEY?: string | undefined;
192
+ HUGGINGFACE_ACCESS_TOKEN?: string | undefined;
193
+ TWILIO_ACCOUNT_SID?: string | undefined;
194
+ TWILIO_AUTH_TOKEN?: string | undefined;
195
+ TWILIO_PHONE_NUMBER?: string | undefined;
196
+ HOME_ASSISTANT_URL?: string | undefined;
197
+ HOME_ASSISTANT_TOKEN?: string | undefined;
198
+ SPOTIFY_CLIENT_ID?: string | undefined;
199
+ SPOTIFY_CLIENT_SECRET?: string | undefined;
200
+ SPOTIFY_REDIRECT_URI?: string | undefined;
201
+ MCP_ENABLED?: boolean | undefined;
202
+ MCP_CONFIG_PATH?: string | undefined;
203
+ WHATSAPP_ENABLED?: boolean | undefined;
204
+ WHATSAPP_AUTH_DIR?: string | undefined;
205
+ WHATSAPP_ALLOWED_NUMBERS?: string | undefined;
206
+ SIGNAL_ENABLED?: boolean | undefined;
207
+ SIGNAL_PHONE_NUMBER?: string | undefined;
208
+ SIGNAL_CLI_PATH?: string | undefined;
209
+ SIGNAL_ALLOWED_NUMBERS?: string | undefined;
210
+ IMESSAGE_ENABLED?: boolean | undefined;
211
+ IMESSAGE_MODE?: "bluebubbles" | "applescript" | undefined;
212
+ IMESSAGE_BLUEBUBBLES_URL?: string | undefined;
213
+ IMESSAGE_BLUEBUBBLES_PASSWORD?: string | undefined;
214
+ IMESSAGE_ALLOWED_NUMBERS?: string | undefined;
215
+ PORT?: number | undefined;
216
+ NODE_ENV?: "development" | "production" | "test" | undefined;
217
+ }>;
218
+ type Env = z.infer<typeof envSchema>;
219
+ /**
220
+ * Programmatic configuration for library use.
221
+ * Call this before any module accesses `env`.
222
+ * Config values are merged with process.env (config takes precedence).
223
+ */
224
+ declare function configure(config: Partial<Env> & {
225
+ CLAUDE_API_KEY: string;
226
+ }): Env;
227
+ /**
228
+ * The env accessor. Lazy — loads from process.env on first access
229
+ * if configure() was not called first.
230
+ *
231
+ * All 37+ consumer files keep using `env.SOME_PROP` unchanged.
232
+ */
233
+ declare const env: Env;
234
+
235
+ declare const SYSTEM_PROMPT = "You are OpenSentinel, a personal AI assistant with a JARVIS-like personality. You are helpful, efficient, and have a subtle sense of humor. You speak in a professional yet friendly manner.\n\nYou have access to various tools and capabilities:\n- Execute shell commands on the user's system\n- Manage files (read, write, search)\n- Browse the web and search for information\n- Remember important facts about the user and their preferences\n- Spawn background agents for complex tasks\n- Generate documents, spreadsheets, charts, and diagrams\n- Analyze images and extract text with OCR\n- Take and analyze screenshots\n\nAlways be concise but thorough. When executing tasks, explain what you're doing briefly. If you encounter errors, suggest solutions.\n\nThe user is your principal. Assist them with whatever they need while being mindful of security and privacy.";
236
+ interface Message {
237
+ role: "user" | "assistant";
238
+ content: string;
239
+ }
240
+ interface BrainResponse {
241
+ content: string;
242
+ inputTokens: number;
243
+ outputTokens: number;
244
+ toolsUsed?: string[];
245
+ }
246
+ declare function chat(messages: Message[], systemPrompt?: string): Promise<BrainResponse>;
247
+ declare function chatWithTools(messages: Message[], userId?: string, onToolUse?: (toolName: string, input: unknown) => void): Promise<BrainResponse>;
248
+ declare function streamChat(messages: Message[], systemPrompt?: string, onChunk?: (text: string) => void): Promise<BrainResponse>;
249
+ interface StreamEvent {
250
+ type: "chunk" | "tool_start" | "tool_result" | "complete" | "error";
251
+ data: {
252
+ text?: string;
253
+ toolName?: string;
254
+ toolInput?: unknown;
255
+ toolResult?: unknown;
256
+ content?: string;
257
+ inputTokens?: number;
258
+ outputTokens?: number;
259
+ toolsUsed?: string[];
260
+ error?: string;
261
+ };
262
+ }
263
+ declare function streamChatWithTools(messages: Message[], userId?: string): AsyncGenerator<StreamEvent, BrainResponse, undefined>;
264
+
265
+ /**
266
+ * OpenSentinel - Programmatic API
267
+ *
268
+ * Usage:
269
+ * import { OpenSentinel } from 'opensentinel';
270
+ *
271
+ * const sentinel = new OpenSentinel({
272
+ * claudeApiKey: 'sk-ant-...',
273
+ * env: { DATABASE_URL: 'postgresql://...', TELEGRAM_BOT_TOKEN: '...' },
274
+ * services: { telegram: true, api: true },
275
+ * });
276
+ *
277
+ * await sentinel.start();
278
+ */
279
+
280
+ interface OpenSentinelConfig {
281
+ /** Required: your Claude API key */
282
+ claudeApiKey: string;
283
+ /** All other env vars as optional overrides */
284
+ env?: Partial<Env>;
285
+ /** Which services to start (all default to false except api) */
286
+ services?: {
287
+ telegram?: boolean;
288
+ discord?: boolean;
289
+ slack?: boolean;
290
+ whatsapp?: boolean;
291
+ signal?: boolean;
292
+ imessage?: boolean;
293
+ api?: boolean;
294
+ scheduler?: boolean;
295
+ mcp?: boolean;
296
+ websocket?: boolean;
297
+ };
298
+ }
299
+ declare class OpenSentinel {
300
+ private config;
301
+ private _running;
302
+ private _services;
303
+ constructor(config: OpenSentinelConfig);
304
+ start(): Promise<void>;
305
+ stop(): Promise<void>;
306
+ /** Send a simple chat message (no tools) */
307
+ chat(messages: Message[], systemPrompt?: string): Promise<BrainResponse>;
308
+ /** Send a chat message with tool execution */
309
+ chatWithTools(messages: Message[], userId?: string, onToolUse?: (toolName: string, input: unknown) => void): Promise<BrainResponse>;
310
+ get running(): boolean;
311
+ get services(): {
312
+ telegramBot?: any;
313
+ discordBot?: any;
314
+ slackBot?: any;
315
+ whatsappBot?: any;
316
+ signalBot?: any;
317
+ imessageBot?: any;
318
+ mcpRegistry?: any;
319
+ server?: any;
320
+ };
321
+ }
322
+
323
+ declare const memories: drizzle_orm_pg_core.PgTableWithColumns<{
324
+ name: "memories";
325
+ schema: undefined;
326
+ columns: {
327
+ id: drizzle_orm_pg_core.PgColumn<{
328
+ name: "id";
329
+ tableName: "memories";
330
+ dataType: "string";
331
+ columnType: "PgUUID";
332
+ data: string;
333
+ driverParam: string;
334
+ notNull: true;
335
+ hasDefault: true;
336
+ isPrimaryKey: true;
337
+ isAutoincrement: false;
338
+ hasRuntimeDefault: false;
339
+ enumValues: undefined;
340
+ baseColumn: never;
341
+ identity: undefined;
342
+ generated: undefined;
343
+ }, {}, {}>;
344
+ userId: drizzle_orm_pg_core.PgColumn<{
345
+ name: "user_id";
346
+ tableName: "memories";
347
+ dataType: "string";
348
+ columnType: "PgUUID";
349
+ data: string;
350
+ driverParam: string;
351
+ notNull: false;
352
+ hasDefault: false;
353
+ isPrimaryKey: false;
354
+ isAutoincrement: false;
355
+ hasRuntimeDefault: false;
356
+ enumValues: undefined;
357
+ baseColumn: never;
358
+ identity: undefined;
359
+ generated: undefined;
360
+ }, {}, {}>;
361
+ type: drizzle_orm_pg_core.PgColumn<{
362
+ name: "type";
363
+ tableName: "memories";
364
+ dataType: "string";
365
+ columnType: "PgText";
366
+ data: "episodic" | "semantic" | "procedural";
367
+ driverParam: string;
368
+ notNull: true;
369
+ hasDefault: false;
370
+ isPrimaryKey: false;
371
+ isAutoincrement: false;
372
+ hasRuntimeDefault: false;
373
+ enumValues: [string, ...string[]];
374
+ baseColumn: never;
375
+ identity: undefined;
376
+ generated: undefined;
377
+ }, {}, {
378
+ $type: "episodic" | "semantic" | "procedural";
379
+ }>;
380
+ content: drizzle_orm_pg_core.PgColumn<{
381
+ name: "content";
382
+ tableName: "memories";
383
+ dataType: "string";
384
+ columnType: "PgText";
385
+ data: string;
386
+ driverParam: string;
387
+ notNull: true;
388
+ hasDefault: false;
389
+ isPrimaryKey: false;
390
+ isAutoincrement: false;
391
+ hasRuntimeDefault: false;
392
+ enumValues: [string, ...string[]];
393
+ baseColumn: never;
394
+ identity: undefined;
395
+ generated: undefined;
396
+ }, {}, {}>;
397
+ embedding: drizzle_orm_pg_core.PgColumn<{
398
+ name: "embedding";
399
+ tableName: "memories";
400
+ dataType: "array";
401
+ columnType: "PgVector";
402
+ data: number[];
403
+ driverParam: string;
404
+ notNull: false;
405
+ hasDefault: false;
406
+ isPrimaryKey: false;
407
+ isAutoincrement: false;
408
+ hasRuntimeDefault: false;
409
+ enumValues: undefined;
410
+ baseColumn: never;
411
+ identity: undefined;
412
+ generated: undefined;
413
+ }, {}, {
414
+ dimensions: 1536;
415
+ }>;
416
+ importance: drizzle_orm_pg_core.PgColumn<{
417
+ name: "importance";
418
+ tableName: "memories";
419
+ dataType: "number";
420
+ columnType: "PgInteger";
421
+ data: number;
422
+ driverParam: string | number;
423
+ notNull: false;
424
+ hasDefault: true;
425
+ isPrimaryKey: false;
426
+ isAutoincrement: false;
427
+ hasRuntimeDefault: false;
428
+ enumValues: undefined;
429
+ baseColumn: never;
430
+ identity: undefined;
431
+ generated: undefined;
432
+ }, {}, {}>;
433
+ source: drizzle_orm_pg_core.PgColumn<{
434
+ name: "source";
435
+ tableName: "memories";
436
+ dataType: "string";
437
+ columnType: "PgText";
438
+ data: string;
439
+ driverParam: string;
440
+ notNull: false;
441
+ hasDefault: false;
442
+ isPrimaryKey: false;
443
+ isAutoincrement: false;
444
+ hasRuntimeDefault: false;
445
+ enumValues: [string, ...string[]];
446
+ baseColumn: never;
447
+ identity: undefined;
448
+ generated: undefined;
449
+ }, {}, {}>;
450
+ metadata: drizzle_orm_pg_core.PgColumn<{
451
+ name: "metadata";
452
+ tableName: "memories";
453
+ dataType: "json";
454
+ columnType: "PgJsonb";
455
+ data: unknown;
456
+ driverParam: unknown;
457
+ notNull: false;
458
+ hasDefault: false;
459
+ isPrimaryKey: false;
460
+ isAutoincrement: false;
461
+ hasRuntimeDefault: false;
462
+ enumValues: undefined;
463
+ baseColumn: never;
464
+ identity: undefined;
465
+ generated: undefined;
466
+ }, {}, {}>;
467
+ lastAccessed: drizzle_orm_pg_core.PgColumn<{
468
+ name: "last_accessed";
469
+ tableName: "memories";
470
+ dataType: "date";
471
+ columnType: "PgTimestamp";
472
+ data: Date;
473
+ driverParam: string;
474
+ notNull: false;
475
+ hasDefault: true;
476
+ isPrimaryKey: false;
477
+ isAutoincrement: false;
478
+ hasRuntimeDefault: false;
479
+ enumValues: undefined;
480
+ baseColumn: never;
481
+ identity: undefined;
482
+ generated: undefined;
483
+ }, {}, {}>;
484
+ createdAt: drizzle_orm_pg_core.PgColumn<{
485
+ name: "created_at";
486
+ tableName: "memories";
487
+ dataType: "date";
488
+ columnType: "PgTimestamp";
489
+ data: Date;
490
+ driverParam: string;
491
+ notNull: true;
492
+ hasDefault: true;
493
+ isPrimaryKey: false;
494
+ isAutoincrement: false;
495
+ hasRuntimeDefault: false;
496
+ enumValues: undefined;
497
+ baseColumn: never;
498
+ identity: undefined;
499
+ generated: undefined;
500
+ }, {}, {}>;
501
+ };
502
+ dialect: "pg";
503
+ }>;
504
+ type Memory = typeof memories.$inferSelect;
505
+ type NewMemory = typeof memories.$inferInsert;
506
+
507
+ declare const db: ReturnType<typeof drizzle<typeof schema>>;
508
+
509
+ declare function generateEmbedding(text: string): Promise<number[]>;
510
+ declare function storeMemory(memory: Omit<NewMemory, "embedding">): Promise<Memory>;
511
+ declare function searchMemories(query: string, userId?: string, limit?: number): Promise<Memory[]>;
512
+ declare function extractMemories(content: string, userId?: string): Promise<Memory[]>;
513
+ declare function buildMemoryContext(query: string, userId?: string): Promise<string>;
514
+
515
+ declare const TOOLS: Tool[];
516
+ declare function executeTool(name: string, input: Record<string, unknown>): Promise<{
517
+ success: boolean;
518
+ result: unknown;
519
+ error?: string;
520
+ }>;
521
+
522
+ interface ScheduledTask {
523
+ type: "reminder" | "briefing" | "custom" | "calendar_check" | "memory_shed" | "growth_report" | "metrics_flush";
524
+ message?: string;
525
+ userId?: string;
526
+ chatId?: string;
527
+ metadata?: Record<string, unknown>;
528
+ }
529
+ declare function scheduleTask(task: ScheduledTask, delay: number): Promise<string>;
530
+ declare function cancelTask(jobId: string): Promise<boolean>;
531
+ declare function scheduleReminder(message: string, delayMs: number, chatId?: string): Promise<string>;
532
+ declare function generateBriefing(userId?: string): Promise<string>;
533
+
534
+ declare const app: Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
535
+
536
+ interface SessionData {
537
+ messages: Array<{
538
+ role: "user" | "assistant";
539
+ content: string;
540
+ }>;
541
+ }
542
+ type OpenSentinelContext = Context & {
543
+ session: SessionData;
544
+ };
545
+ declare function createBot(): Bot<OpenSentinelContext, grammy.Api<grammy.RawApi>>;
546
+
547
+ /**
548
+ * Discord bot configuration
549
+ */
550
+ interface DiscordBotConfig {
551
+ token: string;
552
+ clientId: string;
553
+ guildId?: string;
554
+ allowedUserIds?: string[];
555
+ allowedRoleIds?: string[];
556
+ allowDMs?: boolean;
557
+ allowChannels?: boolean;
558
+ }
559
+ /**
560
+ * Discord bot class
561
+ */
562
+ declare class DiscordBot {
563
+ private client;
564
+ private config;
565
+ private rest;
566
+ private voiceConnections;
567
+ private commandCollection;
568
+ private isReady;
569
+ constructor(config: DiscordBotConfig);
570
+ /**
571
+ * Set up Discord event handlers
572
+ */
573
+ private setupEventHandlers;
574
+ /**
575
+ * Handle slash command interactions
576
+ */
577
+ private handleInteraction;
578
+ /**
579
+ * Handle voice slash commands
580
+ */
581
+ private handleVoiceCommand;
582
+ /**
583
+ * Join a voice channel
584
+ */
585
+ private joinVoiceChannel;
586
+ /**
587
+ * Leave a voice channel
588
+ */
589
+ private leaveVoiceChannel;
590
+ /**
591
+ * Speak text in a voice channel using TTS
592
+ */
593
+ private speakInVoiceChannel;
594
+ /**
595
+ * Handle incoming messages (DMs and @mentions)
596
+ */
597
+ private handleMessage;
598
+ /**
599
+ * Process message attachments
600
+ */
601
+ private processAttachments;
602
+ /**
603
+ * Handle voice state updates
604
+ */
605
+ private handleVoiceStateUpdate;
606
+ /**
607
+ * Check if a user is authorized to use the bot
608
+ */
609
+ private isUserAuthorized;
610
+ /**
611
+ * Register slash commands with Discord
612
+ */
613
+ registerCommands(): Promise<void>;
614
+ /**
615
+ * Start the Discord bot
616
+ */
617
+ start(): Promise<void>;
618
+ /**
619
+ * Stop the Discord bot
620
+ */
621
+ stop(): Promise<void>;
622
+ /**
623
+ * Get the Discord client
624
+ */
625
+ getClient(): Client;
626
+ /**
627
+ * Check if bot is ready
628
+ */
629
+ ready(): boolean;
630
+ /**
631
+ * Send a message to a channel
632
+ */
633
+ sendMessage(channelId: string, content: string): Promise<void>;
634
+ /**
635
+ * Send a message with an embed
636
+ */
637
+ sendEmbed(channelId: string, title: string, description: string, color?: number): Promise<void>;
638
+ /**
639
+ * Send a file to a channel
640
+ */
641
+ sendFile(channelId: string, buffer: Buffer, filename: string, content?: string): Promise<void>;
642
+ }
643
+
644
+ declare const App: typeof _slack_bolt.App;
645
+ declare const ExpressReceiver: typeof _slack_bolt.ExpressReceiver;
646
+ declare const WebClient: typeof _slack_web_api.WebClient;
647
+ type ChatPostMessageResponse = any;
648
+
649
+ /**
650
+ * Slack bot configuration
651
+ */
652
+ interface SlackBotConfig {
653
+ token: string;
654
+ signingSecret: string;
655
+ appToken?: string;
656
+ socketMode?: boolean;
657
+ port?: number;
658
+ allowedUserIds?: string[];
659
+ allowedChannelIds?: string[];
660
+ allowDMs?: boolean;
661
+ allowMentions?: boolean;
662
+ allowThreadReplies?: boolean;
663
+ }
664
+ /**
665
+ * Slack bot class
666
+ */
667
+ declare class SlackBot {
668
+ private app;
669
+ private config;
670
+ private client;
671
+ private receiver;
672
+ private isRunning;
673
+ constructor(config: SlackBotConfig);
674
+ /**
675
+ * Set up Slack event handlers
676
+ */
677
+ private setupEventHandlers;
678
+ /**
679
+ * Set up slash command handlers
680
+ */
681
+ private setupSlashCommands;
682
+ /**
683
+ * Handle app mentions
684
+ */
685
+ private handleAppMention;
686
+ /**
687
+ * Handle direct messages
688
+ */
689
+ private handleMessage;
690
+ /**
691
+ * Handle file shared events
692
+ */
693
+ private handleFileShared;
694
+ /**
695
+ * Check if a user is authorized to use the bot
696
+ */
697
+ private isUserAuthorized;
698
+ /**
699
+ * Start the Slack bot
700
+ */
701
+ start(): Promise<void>;
702
+ /**
703
+ * Stop the Slack bot
704
+ */
705
+ stop(): Promise<void>;
706
+ /**
707
+ * Get the Slack app instance
708
+ */
709
+ getApp(): InstanceType<typeof App>;
710
+ /**
711
+ * Get the Slack Web API client
712
+ */
713
+ getClient(): InstanceType<typeof WebClient>;
714
+ /**
715
+ * Check if bot is running
716
+ */
717
+ running(): boolean;
718
+ /**
719
+ * Send a message to a channel
720
+ */
721
+ sendMessage(channelId: string, text: string, options?: {
722
+ threadTs?: string;
723
+ mrkdwn?: boolean;
724
+ blocks?: object[];
725
+ }): Promise<ChatPostMessageResponse>;
726
+ /**
727
+ * Send a message with blocks
728
+ */
729
+ sendBlocks(channelId: string, blocks: object[], text?: string, threadTs?: string): Promise<ChatPostMessageResponse>;
730
+ /**
731
+ * Send a file to a channel
732
+ */
733
+ sendFile(channelId: string, content: Buffer | string, filename: string, options?: {
734
+ title?: string;
735
+ initialComment?: string;
736
+ threadTs?: string;
737
+ }): Promise<void>;
738
+ /**
739
+ * Reply to a thread
740
+ */
741
+ replyToThread(channelId: string, threadTs: string, text: string, mrkdwn?: boolean): Promise<ChatPostMessageResponse>;
742
+ /**
743
+ * Add a reaction to a message
744
+ */
745
+ addReaction(channelId: string, timestamp: string, emoji: string): Promise<void>;
746
+ /**
747
+ * Remove a reaction from a message
748
+ */
749
+ removeReaction(channelId: string, timestamp: string, emoji: string): Promise<void>;
750
+ /**
751
+ * Get user info
752
+ */
753
+ getUserInfo(userId: string): Promise<object | undefined>;
754
+ /**
755
+ * Get channel info
756
+ */
757
+ getChannelInfo(channelId: string): Promise<object | undefined>;
758
+ /**
759
+ * Get the Express receiver (for adding custom routes)
760
+ */
761
+ getReceiver(): InstanceType<typeof ExpressReceiver> | undefined;
762
+ }
763
+
764
+ /**
765
+ * WhatsApp Integration using Baileys
766
+ * Connects OpenSentinel to WhatsApp Web
767
+ */
768
+ interface WhatsAppConfig {
769
+ authDir?: string;
770
+ allowedNumbers?: string[];
771
+ printQR?: boolean;
772
+ }
773
+ declare class WhatsAppBot {
774
+ private sock;
775
+ private config;
776
+ private conversations;
777
+ private isConnected;
778
+ constructor(config?: WhatsAppConfig);
779
+ start(): Promise<void>;
780
+ private handleMessage;
781
+ sendMessage(to: string, text: string): Promise<void>;
782
+ stop(): Promise<void>;
783
+ get connected(): boolean;
784
+ }
785
+
786
+ /**
787
+ * Signal Integration using signal-cli
788
+ * Connects OpenSentinel to Signal Messenger
789
+ *
790
+ * Prerequisites:
791
+ * 1. Install signal-cli: https://github.com/AsamK/signal-cli
792
+ * 2. Register/link your phone number with signal-cli
793
+ * 3. Run signal-cli in JSON-RPC mode: signal-cli -u +1234567890 jsonRpc
794
+ */
795
+ interface SignalConfig {
796
+ phoneNumber: string;
797
+ signalCliPath?: string;
798
+ allowedNumbers?: string[];
799
+ configDir?: string;
800
+ }
801
+ declare class SignalBot {
802
+ private config;
803
+ private process;
804
+ private conversations;
805
+ private isRunning;
806
+ constructor(config: SignalConfig);
807
+ start(): Promise<void>;
808
+ private readMessages;
809
+ private readStderr;
810
+ private handleMessage;
811
+ sendMessage(to: string, text: string): Promise<void>;
812
+ stop(): Promise<void>;
813
+ get running(): boolean;
814
+ }
815
+
816
+ /**
817
+ * iMessage Integration
818
+ * Connects OpenSentinel to iMessage (macOS only)
819
+ *
820
+ * Supports two modes:
821
+ * 1. BlueBubbles - Requires BlueBubbles Server running on Mac
822
+ * 2. AppleScript - Direct macOS integration (requires Full Disk Access)
823
+ *
824
+ * BlueBubbles: https://bluebubbles.app/
825
+ */
826
+ interface iMessageConfig {
827
+ mode: "bluebubbles" | "applescript";
828
+ serverUrl?: string;
829
+ password?: string;
830
+ allowedNumbers?: string[];
831
+ pollInterval?: number;
832
+ }
833
+ declare class iMessageBot {
834
+ private config;
835
+ private conversations;
836
+ private isRunning;
837
+ private pollTimer;
838
+ private lastMessageTime;
839
+ private processedGuids;
840
+ constructor(config: iMessageConfig);
841
+ start(): Promise<void>;
842
+ private startBlueBubbles;
843
+ private pollBlueBubbles;
844
+ private sendBlueBubbles;
845
+ private startAppleScript;
846
+ private pollAppleScript;
847
+ private runAppleScript;
848
+ private sendAppleScript;
849
+ private handleMessage;
850
+ sendMessage(to: string, text: string): Promise<void>;
851
+ stop(): Promise<void>;
852
+ get running(): boolean;
853
+ }
854
+
855
+ export { type BrainResponse, DiscordBot, type Env, type Message, OpenSentinel, type OpenSentinelConfig, SYSTEM_PROMPT, SignalBot, SlackBot, type StreamEvent, TOOLS, WhatsAppBot, app as apiApp, buildMemoryContext, cancelTask, chat, chatWithTools, configure, createBot as createTelegramBot, db, env, executeTool, extractMemories, generateBriefing, generateEmbedding, iMessageBot, scheduleReminder, scheduleTask, searchMemories, storeMemory, streamChat, streamChatWithTools };