@johpaz/hive-sdk 0.0.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.
package/README.md ADDED
@@ -0,0 +1,538 @@
1
+ # @johpaz/hive-sdk
2
+
3
+ SDK oficial para construir sobre [Hive](https://github.com/johpaz/hive) — el runtime de agentes IA local-first multi-canal.
4
+
5
+ Expone toda la funcionalidad interna de Hive como una API organizada por módulos, pensada para integraciones enterprise, extensiones personalizadas y proyectos que necesitan construir sobre el núcleo de Hive.
6
+
7
+ ## Instalación
8
+
9
+ ```bash
10
+ npm install @johpaz/hive-sdk
11
+ # o
12
+ bun add @johpaz/hive-sdk
13
+ ```
14
+
15
+ > **Requisito:** Hive debe estar inicializado en el sistema (base de datos, onboarding). El SDK opera sobre la instalación existente de Hive.
16
+
17
+ ---
18
+
19
+ ## Módulos
20
+
21
+ El SDK está dividido en módulos independientes que se pueden importar por separado:
22
+
23
+ | Módulo | Import | Descripción |
24
+ |---|---|---|
25
+ | [agents](#agents) | `@johpaz/hive-sdk/agents` | Ejecución de agentes, loop nativo, LLM |
26
+ | [tools](#tools) | `@johpaz/hive-sdk/tools` | Todas las herramientas nativas por categoría |
27
+ | [channels](#channels) | `@johpaz/hive-sdk/channels` | Adaptadores de canales (Telegram, Discord…) |
28
+ | [database](#database) | `@johpaz/hive-sdk/database` | Acceso a SQLite, esquemas, crypto |
29
+ | [mcp](#mcp) | `@johpaz/hive-sdk/mcp` | Cliente MCP (Model Context Protocol) |
30
+ | [skills](#skills) | `@johpaz/hive-sdk/skills` | Carga y gestión de skills |
31
+ | [cron](#cron) | `@johpaz/hive-sdk/cron` | Scheduler de tareas programadas |
32
+ | [ethics](#ethics) | `@johpaz/hive-sdk/ethics` | Sistema de ética constitucional |
33
+ | [types](#types) | `@johpaz/hive-sdk/types` | Todos los tipos TypeScript |
34
+
35
+ También puedes importar todo de una vez:
36
+
37
+ ```ts
38
+ import * as HiveSDK from "@johpaz/hive-sdk";
39
+ ```
40
+
41
+ ---
42
+
43
+ ## agents
44
+
45
+ ```ts
46
+ import {
47
+ runAgent,
48
+ runAgentIsolated,
49
+ AgentService,
50
+ compileContext,
51
+ callLLM,
52
+ } from "@johpaz/hive-sdk/agents";
53
+ ```
54
+
55
+ ### Ejecutar un agente
56
+
57
+ ```ts
58
+ import { runAgent } from "@johpaz/hive-sdk/agents";
59
+
60
+ const response = await runAgent({
61
+ agentId: "main", // ID del agente en la DB
62
+ message: "Hola, agente",
63
+ threadId: "thread-abc", // sesión de conversación
64
+ });
65
+
66
+ console.log(response.text);
67
+ ```
68
+
69
+ ### Ejecutar un agente aislado (worker)
70
+
71
+ Corre el agente en un worker separado sin acceso al estado del coordinador:
72
+
73
+ ```ts
74
+ import { runAgentIsolated } from "@johpaz/hive-sdk/agents";
75
+
76
+ const result = await runAgentIsolated({
77
+ agentId: "researcher",
78
+ message: "Investiga X y devuelve un resumen",
79
+ threadId: "isolated-thread",
80
+ });
81
+ ```
82
+
83
+ ### Llamar al LLM directamente
84
+
85
+ ```ts
86
+ import { callLLM, resolveProviderConfig } from "@johpaz/hive-sdk/agents";
87
+ import type { LLMMessage } from "@johpaz/hive-sdk/agents";
88
+
89
+ const messages: LLMMessage[] = [
90
+ { role: "user", content: "¿Cuál es la capital de Colombia?" },
91
+ ];
92
+
93
+ const config = await resolveProviderConfig(agentId);
94
+ const response = await callLLM({ messages, ...config });
95
+
96
+ console.log(response.content);
97
+ ```
98
+
99
+ ### Historial de conversación
100
+
101
+ ```ts
102
+ import {
103
+ addMessage,
104
+ getHistory,
105
+ getRecentMessages,
106
+ } from "@johpaz/hive-sdk/agents";
107
+
108
+ // Agregar mensaje
109
+ await addMessage("thread-abc", "user", "Hola");
110
+
111
+ // Leer historial completo
112
+ const history = await getHistory("thread-abc");
113
+
114
+ // Leer los últimos N mensajes
115
+ const recent = await getRecentMessages("thread-abc", 10);
116
+ ```
117
+
118
+ ### Compilar contexto del sistema
119
+
120
+ ```ts
121
+ import { compileContext } from "@johpaz/hive-sdk/agents";
122
+
123
+ const { systemPrompt, tools } = await compileContext({
124
+ agentId: "main",
125
+ userId: "user-1",
126
+ threadId: "thread-abc",
127
+ });
128
+ ```
129
+
130
+ ### Gestión de AgentService
131
+
132
+ ```ts
133
+ import { createAgentService, getAgentService } from "@johpaz/hive-sdk/agents";
134
+
135
+ const service = await createAgentService({ agentId: "main" });
136
+ // o
137
+ const existing = getAgentService("main");
138
+ ```
139
+
140
+ ---
141
+
142
+ ## tools
143
+
144
+ ```ts
145
+ import { createAllTools, createToolsByCategory } from "@johpaz/hive-sdk/tools";
146
+ ```
147
+
148
+ ### Crear todas las herramientas
149
+
150
+ ```ts
151
+ import { createAllTools } from "@johpaz/hive-sdk/tools";
152
+
153
+ const tools = createAllTools({ userId: "user-1", agentId: "main" });
154
+ ```
155
+
156
+ ### Por categoría
157
+
158
+ ```ts
159
+ import { createToolsByCategory } from "@johpaz/hive-sdk/tools";
160
+
161
+ const fsTools = createToolsByCategory("filesystem", config);
162
+ const webTools = createToolsByCategory("web", config);
163
+ ```
164
+
165
+ ### Herramientas disponibles
166
+
167
+ **Filesystem**
168
+ ```ts
169
+ import { fsReadTool, fsWriteTool, fsEditTool, fsDeleteTool, fsListTool, fsGlobTool, fsExistsTool } from "@johpaz/hive-sdk/tools";
170
+ ```
171
+
172
+ **Web**
173
+ ```ts
174
+ import { webSearchTool, webFetchTool, browserNavigateTool, browserScreenshotTool, browserClickTool, browserTypeTool } from "@johpaz/hive-sdk/tools";
175
+ ```
176
+
177
+ **Proyectos y tareas**
178
+ ```ts
179
+ import { projectCreateTool, projectListTool, projectUpdateTool, projectDoneTool, projectFailTool, taskCreateTool, taskUpdateTool, taskEvaluateTool } from "@johpaz/hive-sdk/tools";
180
+ ```
181
+
182
+ **Agentes y memoria**
183
+ ```ts
184
+ import { agentCreateTool, agentFindTool, agentArchiveTool, taskDelegateTool, taskDelegateCodeTool, taskStatusTool, memoryWriteTool, memoryReadTool, memoryListTool, memorySearchTool, memoryDeleteTool, busPublishTool, busReadTool, projectUpdatesTool } from "@johpaz/hive-sdk/tools";
185
+ ```
186
+
187
+ **Canvas (UI)**
188
+ ```ts
189
+ import { canvasRenderTool, canvasAskTool, canvasConfirmTool, canvasShowCardTool, canvasShowProgressTool, canvasShowListTool, canvasClearTool } from "@johpaz/hive-sdk/tools";
190
+ ```
191
+
192
+ **Code Bridge**
193
+ ```ts
194
+ import { codebridgeLaunchTool, codebridgeStatusTool, codebridgeCancelTool } from "@johpaz/hive-sdk/tools";
195
+ ```
196
+
197
+ **Voz**
198
+ ```ts
199
+ import { voiceTranscribeTool, voiceSpeakTool } from "@johpaz/hive-sdk/tools";
200
+ ```
201
+
202
+ **Core**
203
+ ```ts
204
+ import { searchKnowledgeTool, notifyTool, saveNoteTool, reportProgressTool } from "@johpaz/hive-sdk/tools";
205
+ ```
206
+
207
+ **Cron**
208
+ ```ts
209
+ import { cronAddTool, cronListTool, cronEditTool, cronRemoveTool } from "@johpaz/hive-sdk/tools";
210
+ ```
211
+
212
+ **CLI**
213
+ ```ts
214
+ import { cliExecTool } from "@johpaz/hive-sdk/tools";
215
+ ```
216
+
217
+ ---
218
+
219
+ ## channels
220
+
221
+ ```ts
222
+ import { ChannelManager, TelegramChannel, DiscordChannel } from "@johpaz/hive-sdk/channels";
223
+ ```
224
+
225
+ ### Registrar un canal personalizado
226
+
227
+ ```ts
228
+ import { ChannelManager } from "@johpaz/hive-sdk/channels";
229
+ import type { IncomingMessage, MessageHandler } from "@johpaz/hive-sdk/channels";
230
+
231
+ const manager = new ChannelManager(config);
232
+
233
+ manager.onMessage(async (msg: IncomingMessage) => {
234
+ console.log("Mensaje recibido:", msg.text);
235
+ });
236
+
237
+ await manager.startAll();
238
+ ```
239
+
240
+ ### Canales disponibles
241
+
242
+ ```ts
243
+ import {
244
+ TelegramChannel, // Bot de Telegram (grammy)
245
+ DiscordChannel, // Bot de Discord
246
+ WhatsAppChannel, // WhatsApp (Baileys)
247
+ SlackChannel, // Slack (Bolt)
248
+ WebChatChannel, // WebChat HTTP/WS
249
+ } from "@johpaz/hive-sdk/channels";
250
+ ```
251
+
252
+ ---
253
+
254
+ ## database
255
+
256
+ ```ts
257
+ import { getDb, initializeDatabase, dbService } from "@johpaz/hive-sdk/database";
258
+ ```
259
+
260
+ ### Acceder a la base de datos
261
+
262
+ ```ts
263
+ import { getDb, initializeDatabase } from "@johpaz/hive-sdk/database";
264
+
265
+ // Inicializar (crear tablas si no existen)
266
+ initializeDatabase();
267
+
268
+ // Instancia raw de bun:sqlite
269
+ const db = getDb();
270
+ const rows = db.query("SELECT * FROM agents").all();
271
+ ```
272
+
273
+ ### Usar el servicio de DB
274
+
275
+ ```ts
276
+ import { dbService } from "@johpaz/hive-sdk/database";
277
+
278
+ const agents = dbService.getUserAgents(userId);
279
+ const project = dbService.getProjectWithTasks(projectId);
280
+ ```
281
+
282
+ ### Queries de onboarding
283
+
284
+ ```ts
285
+ import {
286
+ getAllProviders,
287
+ getAllModels,
288
+ getAllChannels,
289
+ getAllMcpServers,
290
+ getActiveTools,
291
+ getUserAgents,
292
+ getCoordinatorAgentId,
293
+ resolveUserId,
294
+ resolveAgentId,
295
+ } from "@johpaz/hive-sdk/database";
296
+
297
+ const providers = getAllProviders();
298
+ const agentId = await resolveAgentId("main");
299
+ ```
300
+
301
+ ### Crypto
302
+
303
+ ```ts
304
+ import { encryptApiKey, decryptApiKey, hashPassword, verifyPassword } from "@johpaz/hive-sdk/database";
305
+
306
+ const encrypted = encryptApiKey("sk-...");
307
+ const decrypted = decryptApiKey(encrypted);
308
+
309
+ const hash = hashPassword("secret");
310
+ const valid = verifyPassword("secret", hash);
311
+ ```
312
+
313
+ ### Seed / Reset
314
+
315
+ ```ts
316
+ import { seedAllData, seedToolsAndSkills } from "@johpaz/hive-sdk/database";
317
+
318
+ // Poblar la DB con datos iniciales (idempotente)
319
+ await seedAllData();
320
+
321
+ // Solo tools y skills
322
+ await seedToolsAndSkills();
323
+ ```
324
+
325
+ ---
326
+
327
+ ## mcp
328
+
329
+ ```ts
330
+ import { MCPClientManager } from "@johpaz/hive-sdk/mcp";
331
+ import type { MCPConfig } from "@johpaz/hive-sdk/mcp";
332
+ ```
333
+
334
+ ### Conectar a un servidor MCP
335
+
336
+ ```ts
337
+ import { MCPClientManager } from "@johpaz/hive-sdk/mcp";
338
+
339
+ const manager = new MCPClientManager({
340
+ servers: {
341
+ filesystem: {
342
+ command: "npx",
343
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
344
+ },
345
+ },
346
+ });
347
+
348
+ await manager.connect();
349
+
350
+ const tools = manager.getTools(); // herramientas del servidor
351
+ const resources = manager.getResources(); // recursos disponibles
352
+ ```
353
+
354
+ ---
355
+
356
+ ## skills
357
+
358
+ ```ts
359
+ import { SkillLoader, createSkillLoader } from "@johpaz/hive-sdk/skills";
360
+ ```
361
+
362
+ ### Cargar skills
363
+
364
+ ```ts
365
+ import { createSkillLoader } from "@johpaz/hive-sdk/skills";
366
+
367
+ const loader = createSkillLoader({
368
+ workspacePath: "/path/to/workspace",
369
+ });
370
+
371
+ const skills = await loader.loadAll();
372
+
373
+ for (const skill of skills) {
374
+ console.log(skill.name, skill.description);
375
+ }
376
+ ```
377
+
378
+ ### Ejecutar un skill
379
+
380
+ ```ts
381
+ const result = await loader.run("my-skill", {
382
+ input: "contexto del agente",
383
+ });
384
+ ```
385
+
386
+ ---
387
+
388
+ ## cron
389
+
390
+ ```ts
391
+ import { initCronScheduler, resolveBestChannel, createCronTools } from "@johpaz/hive-sdk/cron";
392
+ ```
393
+
394
+ ### Inicializar el scheduler
395
+
396
+ ```ts
397
+ import { initCronScheduler } from "@johpaz/hive-sdk/cron";
398
+
399
+ initCronScheduler(async (job) => {
400
+ // Se ejecuta cuando vence un cron job
401
+ console.log("Ejecutando job:", job.name);
402
+ await runAgent({ agentId: job.agentId, message: job.prompt, threadId: job.id });
403
+ });
404
+ ```
405
+
406
+ ### Herramientas de cron
407
+
408
+ ```ts
409
+ import { cronAddTool, cronListTool, cronEditTool, cronRemoveTool } from "@johpaz/hive-sdk/cron";
410
+ ```
411
+
412
+ ---
413
+
414
+ ## ethics
415
+
416
+ ```ts
417
+ import { getAllEthics, activateEthics } from "@johpaz/hive-sdk/ethics";
418
+ ```
419
+
420
+ ### Gestionar reglas éticas
421
+
422
+ ```ts
423
+ import { getAllEthics, activateEthics } from "@johpaz/hive-sdk/ethics";
424
+
425
+ // Leer todas las reglas
426
+ const rules = getAllEthics();
427
+
428
+ // Activar/desactivar un conjunto de reglas
429
+ activateEthics("default");
430
+ ```
431
+
432
+ ---
433
+
434
+ ## types
435
+
436
+ Importa cualquier tipo de TypeScript sin traer código de ejecución:
437
+
438
+ ```ts
439
+ import type {
440
+ // Agentes
441
+ AgentDBRecord,
442
+ AgentServiceConfig,
443
+ AgentLoopOptions,
444
+ StepEvent,
445
+ StreamChunk,
446
+
447
+ // LLM
448
+ LLMMessage,
449
+ LLMResponse,
450
+ LLMCallOptions,
451
+ LLMToolCall,
452
+
453
+ // Canales
454
+ IncomingMessage,
455
+ OutboundMessage,
456
+ ChannelConfig,
457
+ IChannel,
458
+
459
+ // MCP
460
+ MCPTool,
461
+ MCPResource,
462
+ MCPPrompt,
463
+ MCPConfig,
464
+ MCPServerConfig,
465
+
466
+ // Skills
467
+ Skill,
468
+ SkillMetadata,
469
+ SkillStep,
470
+ SkillExample,
471
+ SkillsConfig,
472
+
473
+ // Conversación
474
+ StoredMessage,
475
+ } from "@johpaz/hive-sdk/types";
476
+ ```
477
+
478
+ ---
479
+
480
+ ## Ejemplo completo
481
+
482
+ Agente personalizado que escucha en Telegram y responde usando el loop nativo:
483
+
484
+ ```ts
485
+ import { initializeDatabase } from "@johpaz/hive-sdk/database";
486
+ import { TelegramChannel } from "@johpaz/hive-sdk/channels";
487
+ import { runAgent } from "@johpaz/hive-sdk/agents";
488
+
489
+ // 1. Inicializar DB
490
+ initializeDatabase();
491
+
492
+ // 2. Crear canal
493
+ const telegram = new TelegramChannel({
494
+ token: process.env.TELEGRAM_BOT_TOKEN!,
495
+ });
496
+
497
+ // 3. Manejar mensajes
498
+ telegram.onMessage(async (msg) => {
499
+ const response = await runAgent({
500
+ agentId: "main",
501
+ message: msg.text,
502
+ threadId: `telegram:${msg.chatId}`,
503
+ });
504
+
505
+ await telegram.send({ chatId: msg.chatId, text: response.text });
506
+ });
507
+
508
+ await telegram.start();
509
+ console.log("Bot activo");
510
+ ```
511
+
512
+ ---
513
+
514
+ ## Publicación
515
+
516
+ ```bash
517
+ # Publicar la versión actual
518
+ bun run publish:sdk
519
+
520
+ # Bump y publicar
521
+ bun run publish:sdk patch
522
+ bun run publish:sdk minor
523
+ bun run publish:sdk major
524
+
525
+ # Versión explícita
526
+ bun run publish:sdk 2.0.0
527
+
528
+ # Simular sin publicar
529
+ bun run publish:sdk patch --dry-run
530
+ ```
531
+
532
+ El script (`scripts/publish-sdk.ts`) ejecuta typecheck, actualiza `package.json`, verifica la sesión npm, publica y crea un git tag `sdk-vX.Y.Z` automáticamente.
533
+
534
+ ---
535
+
536
+ ## Licencia
537
+
538
+ MIT — construido desde Colombia para el mundo.
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@johpaz/hive-sdk",
3
+ "version": "0.0.1",
4
+ "description": "Hive SDK - Build on top of Hive for enterprise and custom integrations",
5
+ "private": false,
6
+ "main": "./src/index.ts",
7
+ "module": "./src/index.ts",
8
+ "types": "./src/index.ts",
9
+ "license": "MIT",
10
+ "files": [
11
+ "src/"
12
+ ],
13
+ "type": "module",
14
+ "scripts": {
15
+ "test": "bun test",
16
+ "typecheck": "tsc --noEmit",
17
+ "lint": "tsc --noEmit"
18
+ },
19
+ "peerDependencies": {
20
+ "@johpaz/hive-agents": "^0.0.1",
21
+ "typescript": ">=6.0.0"
22
+ },
23
+ "dependencies": {
24
+ "zod": "latest"
25
+ },
26
+ "devDependencies": {
27
+ "@types/bun": "latest",
28
+ "typescript": "6.0.1-rc"
29
+ },
30
+ "exports": {
31
+ ".": "./src/index.ts",
32
+ "./agents": "./src/agents/index.ts",
33
+ "./tools": "./src/tools/index.ts",
34
+ "./skills": "./src/skills/index.ts",
35
+ "./mcp": "./src/mcp/index.ts",
36
+ "./channels": "./src/channels/index.ts",
37
+ "./cron": "./src/cron/index.ts",
38
+ "./ethics": "./src/ethics/index.ts",
39
+ "./database": "./src/database/index.ts",
40
+ "./types": "./src/types/index.ts"
41
+ },
42
+ "keywords": [
43
+ "hive",
44
+ "sdk",
45
+ "agents",
46
+ "ai",
47
+ "llm",
48
+ "enterprise",
49
+ "integration"
50
+ ],
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/johpaz/hive.git"
54
+ }
55
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Hive SDK - Agents Module
3
+ *
4
+ * Exposes agent execution, context compilation, and agent loop functionality.
5
+ *
6
+ * @example
7
+ * import { runAgent, AgentService, compileContext } from "@johpaz/hive-agents-sdk/agents";
8
+ *
9
+ * // Run an agent with a message
10
+ * const response = await runAgent({
11
+ * agentId: "main",
12
+ * message: "Hello, agent!",
13
+ * threadId: "thread-123"
14
+ * });
15
+ */
16
+
17
+ export { AgentService, getAgentService, createAgentService } from "@johpaz/hive-agents/agent/service";
18
+
19
+ export type { AgentServiceConfig, AgentDBRecord } from "@johpaz/hive-agents/agent/service";
20
+
21
+ export { runAgent, runAgentIsolated, rebuildAgentLoop, getAgentLoop } from "@johpaz/hive-agents/agent/agent-loop";
22
+
23
+ export type { AgentLoopOptions, StepEvent, StreamChunk } from "@johpaz/hive-agents/agent/agent-loop";
24
+
25
+ export { compileContext } from "@johpaz/hive-agents/agent/context-compiler";
26
+
27
+ export { buildSystemPromptWithProjects } from "@johpaz/hive-agents/agent/prompt-builder";
28
+
29
+ export { addMessage, getHistory, getRecentMessages, getMessageCount, getTotalTokens, getMessagesAfter } from "@johpaz/hive-agents/agent/conversation-store";
30
+
31
+ export type { StoredMessage } from "@johpaz/hive-agents/agent/conversation-store";
32
+
33
+ export { selectTools } from "@johpaz/hive-agents/agent/tool-selector";
34
+
35
+ export { selectSkills } from "@johpaz/hive-agents/agent/skill-selector";
36
+
37
+ export { selectPlaybookRules } from "@johpaz/hive-agents/agent/playbook-selector";
38
+
39
+ export { callLLM, resolveProviderConfig } from "@johpaz/hive-agents/agent/llm-client";
40
+
41
+ export type { LLMMessage, LLMResponse, LLMCallOptions, LLMToolCall } from "@johpaz/hive-agents/agent/llm-client";
42
+
43
+ export { resolveAgentId, resolveUserId } from "@johpaz/hive-agents/storage/onboarding";
44
+
45
+ export {
46
+ memoryWriteTool,
47
+ memoryReadTool,
48
+ memoryListTool,
49
+ memorySearchTool,
50
+ memoryDeleteTool,
51
+ agentCreateTool,
52
+ agentFindTool,
53
+ agentArchiveTool,
54
+ taskDelegateTool,
55
+ taskDelegateCodeTool,
56
+ taskStatusTool,
57
+ busPublishTool,
58
+ busReadTool,
59
+ projectUpdatesTool,
60
+ createTools as createAgentTools,
61
+ } from "@johpaz/hive-agents/tools/agents/index";
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Hive SDK - Channels Module
3
+ *
4
+ * Exposes all channel adapters and channel management.
5
+ *
6
+ * @example
7
+ * import { ChannelManager, TelegramChannel, DiscordChannel } from "@johpaz/hive-agents-sdk/channels";
8
+ *
9
+ * // Get channel manager
10
+ * const manager = new ChannelManager(config);
11
+ */
12
+
13
+ export { ChannelManager } from "@johpaz/hive-agents/channels/manager";
14
+
15
+ export type {
16
+ OutboundMessage,
17
+ IncomingMessage,
18
+ ChannelConfig,
19
+ IChannel,
20
+ MessageHandler,
21
+ } from "@johpaz/hive-agents/channels/base";
22
+
23
+ export { TelegramChannel, type TelegramConfig } from "@johpaz/hive-agents/channels/telegram";
24
+
25
+ export { DiscordChannel, type DiscordConfig } from "@johpaz/hive-agents/channels/discord";
26
+
27
+ export { WhatsAppChannel, type WhatsAppConfig, type WhatsAppConnectionState } from "@johpaz/hive-agents/channels/whatsapp";
28
+
29
+ export { SlackChannel, type SlackConfig, type SlackConnectionState } from "@johpaz/hive-agents/channels/slack";
30
+
31
+ export { WebChatChannel, type WebChatConfig } from "@johpaz/hive-agents/channels/webchat";
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Hive SDK - Cron Module
3
+ *
4
+ * Exposes the scheduler and cron job management functions.
5
+ * Includes both legacy cron tools and new Croner-based schedule tools.
6
+ *
7
+ * @example
8
+ * import {
9
+ * scheduleCreateTool,
10
+ * scheduleListTool,
11
+ * initCronScheduler,
12
+ * } from "@johpaz/hive-agents-sdk/cron";
13
+ */
14
+
15
+ // New schedule tools (scheduled_tasks table - Croner-based)
16
+ export {
17
+ scheduleCreateTool,
18
+ scheduleListTool,
19
+ schedulePauseTool,
20
+ scheduleResumeTool,
21
+ scheduleDeleteTool,
22
+ scheduleTriggerTool,
23
+ scheduleHistoryTool,
24
+ createTools as createScheduleTools,
25
+ setSchedulerInstance,
26
+ } from "@johpaz/hive-agents/tools/schedule";
27
+
28
+ // Legacy cron tools (cron_jobs table) - re-export for backward compatibility
29
+ export {
30
+ cronAddTool,
31
+ cronListTool,
32
+ cronEditTool,
33
+ cronRemoveTool,
34
+ createTools as createCronTools,
35
+ initCronScheduler,
36
+ resolveBestChannel,
37
+ } from "@johpaz/hive-agents/tools/cron";
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Hive SDK - Database Module
3
+ *
4
+ * Exposes database access, schema, and crypto utilities.
5
+ *
6
+ * @example
7
+ * import { getDb, initDatabase, SCHEMA } from "@johpaz/hive-agents-sdk/database";
8
+ *
9
+ * // Initialize database
10
+ * initDatabase();
11
+ *
12
+ * // Get database instance
13
+ * const db = getDb();
14
+ */
15
+
16
+ export { getDb, initializeDatabase, getDbPathLazy, dbService } from "@johpaz/hive-agents/storage/sqlite";
17
+
18
+ export { SCHEMA, PROJECTS_SCHEMA, CONTEXT_ENGINE_SCHEMA } from "@johpaz/hive-agents/storage/schema";
19
+
20
+ export { seedAllData, seedToolsAndSkills, getAllElements, getActiveElements } from "@johpaz/hive-agents/storage/seed";
21
+
22
+ export { encrypt, decrypt, encryptApiKey, decryptApiKey, encryptConfig, decryptConfig, hashPassword, verifyPassword, maskApiKey } from "@johpaz/hive-agents/storage/crypto";
23
+
24
+ export {
25
+ getAllProviders,
26
+ getAllModels,
27
+ getAllEthics,
28
+ getAllCodeBridge,
29
+ getAllSkills,
30
+ getAllDbTools,
31
+ getAllMcpServers,
32
+ getAllChannels,
33
+ getActiveTools,
34
+ getUserAgents,
35
+ resolveUserId,
36
+ resolveAgentId,
37
+ getSingleUserId,
38
+ getCoordinatorAgentId,
39
+ getDefaultAgentId,
40
+ getAgentConfig,
41
+ } from "@johpaz/hive-agents/storage/onboarding";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Hive SDK - Ethics Module
3
+ *
4
+ * Exposes the constitutional ethics system and ethics rule management.
5
+ *
6
+ * @example
7
+ * import { getAllEthics, activateEthics } from "@johpaz/hive-agents-sdk/ethics";
8
+ *
9
+ * // Get all ethics rules
10
+ * const rules = getAllEthics();
11
+ */
12
+
13
+ export {
14
+ getAllEthics,
15
+ activateEthics,
16
+ } from "@johpaz/hive-agents/storage/onboarding";
package/src/index.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @johpaz/hive-agents-sdk
3
+ *
4
+ * Hive SDK - Build on top of Hive for enterprise and custom integrations.
5
+ *
6
+ * This package exposes all internal Hive functionality as a clean, organized API
7
+ * for developers who want to build on top of Hive, including hive-cloud Enterprise.
8
+ *
9
+ * @example
10
+ * import { runAgent, AgentService } from "@johpaz/hive-agents-sdk/agents";
11
+ * import { createAllTools } from "@johpaz/hive-agents-sdk/tools";
12
+ * import { SkillLoader } from "@johpaz/hive-agents-sdk/skills";
13
+ * import { MCPClientManager } from "@johpaz/hive-agents-sdk/mcp";
14
+ * import { ChannelManager } from "@johpaz/hive-agents-sdk/channels";
15
+ * import { getDb, initDatabase } from "@johpaz/hive-agents-sdk/database";
16
+ *
17
+ * // Or import everything
18
+ * import * as HiveSDK from "@johpaz/hive-agents-sdk";
19
+ */
20
+
21
+ export * from "./agents/index";
22
+ export * from "./tools/index";
23
+ export * from "./skills/index";
24
+ export * from "./mcp/index";
25
+ export * from "./channels/index";
26
+ export * from "./cron/index";
27
+ export * from "./ethics/index";
28
+ export * from "./database/index";
29
+ export * from "./types/index";
30
+
31
+ export const SDK_VERSION = "1.0.0";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Hive SDK - MCP Module
3
+ *
4
+ * Exposes the MCP adapter and server connection functions.
5
+ *
6
+ * @example
7
+ * import { MCPClientManager } from "@johpaz/hive-agents-sdk/mcp";
8
+ *
9
+ * // Connect to an MCP server
10
+ * const manager = new MCPClientManager({ servers: {} });
11
+ */
12
+
13
+ export { MCPClientManager, type MCPTool, type MCPResource, type MCPPrompt } from "@johpaz/hive-agents/mcp/manager";
14
+
15
+ export type { MCPConfig, MCPServerConfig } from "@johpaz/hive-agents/mcp/config";
16
+
17
+ export { logger } from "@johpaz/hive-agents/mcp/logger";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Hive SDK - Skills Module
3
+ *
4
+ * Exposes the skill registry, base skills, and skill loader.
5
+ *
6
+ * @example
7
+ * import { SkillLoader, createSkillLoader } from "@johpaz/hive-agents-sdk/skills";
8
+ *
9
+ * // Create a skill loader
10
+ * const loader = createSkillLoader({ workspacePath: "/path/to/workspace" });
11
+ */
12
+
13
+ export {
14
+ SkillLoader,
15
+ createSkillLoader,
16
+ type SkillsConfig,
17
+ type Config,
18
+ type SkillStep,
19
+ type OutputFormat,
20
+ type SkillExample,
21
+ type SkillMetadata,
22
+ type Skill,
23
+ } from "@johpaz/hive-agents/skills/loader";
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Hive SDK - Tools Module
3
+ *
4
+ * Exposes the tool registry, all seed tools, and tool creation utilities.
5
+ *
6
+ * @example
7
+ * import { createAllTools, ToolRegistry } from "@johpaz/hive-agents-sdk/tools";
8
+ *
9
+ * // Create all 52 tools
10
+ * const tools = createAllTools(config);
11
+ *
12
+ * // Or by category
13
+ * const fsTools = createToolsByCategory("filesystem", config);
14
+ */
15
+
16
+ export {
17
+ createAllTools,
18
+ createToolsByCategory,
19
+ type Tool,
20
+ type ToolResult,
21
+ } from "@johpaz/hive-agents/tools/index";
22
+
23
+ export {
24
+ fsEditTool,
25
+ fsReadTool,
26
+ fsWriteTool,
27
+ fsDeleteTool,
28
+ fsListTool,
29
+ fsGlobTool,
30
+ fsExistsTool,
31
+ } from "@johpaz/hive-agents/tools/filesystem/index";
32
+
33
+ export {
34
+ webSearchTool,
35
+ webFetchTool,
36
+ browserNavigateTool,
37
+ browserScreenshotTool,
38
+ browserClickTool,
39
+ browserTypeTool,
40
+ } from "@johpaz/hive-agents/tools/web/index";
41
+
42
+ export {
43
+ projectCreateTool,
44
+ projectListTool,
45
+ projectUpdateTool,
46
+ projectDoneTool,
47
+ projectFailTool,
48
+ taskCreateTool,
49
+ taskUpdateTool,
50
+ taskEvaluateTool,
51
+ } from "@johpaz/hive-agents/tools/projects/index";
52
+
53
+ export {
54
+ cronAddTool,
55
+ cronListTool,
56
+ cronEditTool,
57
+ cronRemoveTool,
58
+ initCronScheduler,
59
+ resolveBestChannel,
60
+ } from "@johpaz/hive-agents/tools/cron/index";
61
+
62
+ export { cliExecTool } from "@johpaz/hive-agents/tools/cli/index";
63
+
64
+ export {
65
+ memoryWriteTool,
66
+ memoryReadTool,
67
+ memoryListTool,
68
+ memorySearchTool,
69
+ memoryDeleteTool,
70
+ agentCreateTool,
71
+ agentFindTool,
72
+ agentArchiveTool,
73
+ taskDelegateTool,
74
+ taskDelegateCodeTool,
75
+ taskStatusTool,
76
+ busPublishTool,
77
+ busReadTool,
78
+ projectUpdatesTool,
79
+ } from "@johpaz/hive-agents/tools/agents/index";
80
+
81
+ export {
82
+ canvasRenderTool,
83
+ canvasAskTool,
84
+ canvasConfirmTool,
85
+ canvasShowCardTool,
86
+ canvasShowProgressTool,
87
+ canvasShowListTool,
88
+ canvasClearTool,
89
+ } from "@johpaz/hive-agents/tools/canvas/index";
90
+
91
+ export {
92
+ codebridgeLaunchTool,
93
+ codebridgeStatusTool,
94
+ codebridgeCancelTool,
95
+ } from "@johpaz/hive-agents/tools/codebridge/index";
96
+
97
+ export {
98
+ voiceTranscribeTool,
99
+ voiceSpeakTool,
100
+ } from "@johpaz/hive-agents/tools/voice/index";
101
+
102
+ export {
103
+ searchKnowledgeTool,
104
+ notifyTool,
105
+ saveNoteTool,
106
+ reportProgressTool,
107
+ } from "@johpaz/hive-agents/tools/core/index";
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Hive SDK - Types Module
3
+ *
4
+ * Exposes all TypeScript types from the Hive system.
5
+ * Use this for complete type support when building on Hive.
6
+ *
7
+ * @example
8
+ * import type { StoredMessage, LLMMessage } from "@johpaz/hive-agents-sdk/types";
9
+ */
10
+
11
+ export type {
12
+ AgentDBRecord,
13
+ AgentServiceConfig,
14
+ } from "@johpaz/hive-agents/agent/service";
15
+
16
+ export type {
17
+ AgentLoopOptions,
18
+ StepEvent,
19
+ StreamChunk,
20
+ } from "@johpaz/hive-agents/agent/agent-loop";
21
+
22
+ export type {
23
+ LLMMessage,
24
+ LLMResponse,
25
+ LLMCallOptions,
26
+ LLMToolCall,
27
+ } from "@johpaz/hive-agents/agent/llm-client";
28
+
29
+ export type {
30
+ OutboundMessage,
31
+ IncomingMessage,
32
+ ChannelConfig,
33
+ IChannel,
34
+ } from "@johpaz/hive-agents/channels/base";
35
+
36
+ export type {
37
+ MCPTool,
38
+ MCPResource,
39
+ MCPPrompt,
40
+ } from "@johpaz/hive-agents/mcp/manager";
41
+
42
+ export type {
43
+ MCPConfig,
44
+ MCPServerConfig,
45
+ } from "@johpaz/hive-agents/mcp/config";
46
+
47
+ export type {
48
+ Skill,
49
+ SkillMetadata,
50
+ SkillStep,
51
+ SkillExample,
52
+ OutputFormat,
53
+ SkillsConfig,
54
+ } from "@johpaz/hive-agents/skills/loader";
55
+
56
+ export type {
57
+ StoredMessage,
58
+ } from "@johpaz/hive-agents/agent/conversation-store";