@johpaz/hive-sdk 0.0.16 → 0.0.18
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 +83 -203
- package/bun.lock +543 -0
- package/bunfig.toml +7 -0
- package/docs/API-TOOLS-SKILLS-CHANNELS.md +61 -1
- package/docs/API-WORKERS-EVENTS.md +3 -3
- package/docs/INDEX.md +2 -2
- package/docs/TEMPLATE-HIVE-APP.md +6 -6
- package/package.json +2 -2
- package/packages/cli/src/index.ts +1 -1
- package/packages/core/src/agent/selectors/ToolSelector.ts +1 -0
- package/packages/core/src/api/createAgent.ts +10 -0
- package/packages/core/src/config/loader.ts +2 -2
- package/packages/core/src/index.ts +13 -0
- package/packages/core/src/skills/bundled-data.generated.ts +50 -0
- package/packages/core/src/skills/skills.test.ts +21 -0
- package/packages/core/src/tools/index.ts +1 -0
- package/packages/core/src/tools/web/api-request.test.ts +170 -0
- package/packages/core/src/tools/web/api-request.ts +239 -0
- package/packages/core/src/tools/web/browser-click.ts +2 -2
- package/packages/core/src/tools/web/browser-extract.ts +22 -6
- package/packages/core/src/tools/web/browser-navigate.ts +34 -18
- package/packages/core/src/tools/web/browser-screenshot.ts +40 -8
- package/packages/core/src/tools/web/browser-script.ts +2 -2
- package/packages/core/src/tools/web/browser-service.test.ts +83 -0
- package/packages/core/src/tools/web/browser-service.ts +290 -341
- package/packages/core/src/tools/web/browser-type.ts +2 -2
- package/packages/core/src/tools/web/browser-wait.ts +2 -2
- package/packages/core/src/tools/web/index.ts +3 -0
- package/CHANGELOG.md +0 -64
- package/docs/README.md +0 -161
- /package/packages/cli/bin/{hive → hives} +0 -0
|
@@ -53,7 +53,7 @@ export const browserTypeTool: Tool = {
|
|
|
53
53
|
log.warn("Browser not available");
|
|
54
54
|
return {
|
|
55
55
|
ok: false,
|
|
56
|
-
error: "Browser automation not available. Install
|
|
56
|
+
error: "Browser automation not available. Install agent-browser.",
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -61,7 +61,7 @@ export const browserTypeTool: Tool = {
|
|
|
61
61
|
|
|
62
62
|
try {
|
|
63
63
|
const view = await browserService.getView();
|
|
64
|
-
if (!view) return { ok: false, error: "Browser automation not available. Install
|
|
64
|
+
if (!view) return { ok: false, error: "Browser automation not available. Install agent-browser." };
|
|
65
65
|
|
|
66
66
|
if (url) {
|
|
67
67
|
await view.navigate(url);
|
|
@@ -54,7 +54,7 @@ export const browserWaitTool: Tool = {
|
|
|
54
54
|
log.warn("Browser not available");
|
|
55
55
|
return {
|
|
56
56
|
ok: false,
|
|
57
|
-
error: "Browser automation not available. Install
|
|
57
|
+
error: "Browser automation not available. Install agent-browser.",
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -69,7 +69,7 @@ export const browserWaitTool: Tool = {
|
|
|
69
69
|
|
|
70
70
|
try {
|
|
71
71
|
const view = await browserService.getView();
|
|
72
|
-
if (!view) return { ok: false, error: "Browser automation not available. Install
|
|
72
|
+
if (!view) return { ok: false, error: "Browser automation not available. Install agent-browser." };
|
|
73
73
|
|
|
74
74
|
if (url) {
|
|
75
75
|
await view.navigate(url);
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { Tool } from "../types.ts";
|
|
8
8
|
import { webSearchTool } from "./web-search.ts";
|
|
9
9
|
import { webFetchTool } from "./web-fetch.ts";
|
|
10
|
+
import { apiRequestTool } from "./api-request.ts";
|
|
10
11
|
import { browserNavigateTool } from "./browser-navigate.ts";
|
|
11
12
|
import { browserScreenshotTool } from "./browser-screenshot.ts";
|
|
12
13
|
import { browserClickTool } from "./browser-click.ts";
|
|
@@ -19,6 +20,7 @@ export function createTools(): Tool[] {
|
|
|
19
20
|
return [
|
|
20
21
|
webSearchTool,
|
|
21
22
|
webFetchTool,
|
|
23
|
+
apiRequestTool,
|
|
22
24
|
browserNavigateTool,
|
|
23
25
|
browserScreenshotTool,
|
|
24
26
|
browserClickTool,
|
|
@@ -31,6 +33,7 @@ export function createTools(): Tool[] {
|
|
|
31
33
|
|
|
32
34
|
export * from "./web-search.ts";
|
|
33
35
|
export * from "./web-fetch.ts";
|
|
36
|
+
export * from "./api-request.ts";
|
|
34
37
|
export * from "./browser-navigate.ts";
|
|
35
38
|
export * from "./browser-screenshot.ts";
|
|
36
39
|
export * from "./browser-click.ts";
|
package/CHANGELOG.md
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [0.0.16] - 2026-05-28
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
- **Bun Workers individuales**: `createWorker()`, `WorkerPool`, `agent.worker.ts`
|
|
12
|
-
- Workers especializados con system prompt propio
|
|
13
|
-
- Ejecución en threads aislados via `Bun.Worker`
|
|
14
|
-
- Comunicación via `postMessage`/`onmessage`
|
|
15
|
-
- **Gateway simplificado**: HTTP/WebSocket server con `Bun.serve()`
|
|
16
|
-
- Endpoints: `/status`, `/chat`, `/ws`
|
|
17
|
-
- Streaming de respuestas en tiempo real
|
|
18
|
-
- **Channels**: Telegram, Discord, WhatsApp, Slack, Webchat
|
|
19
|
-
- **Tool Runtime**: Ejecución paralela de tools via Bun Workers
|
|
20
|
-
- **CLI mejorado**:
|
|
21
|
-
- `hive create-app <name>` — Generar app harness completa
|
|
22
|
-
- `hive add-tool <name>` — Generar boilerplate de tool
|
|
23
|
-
- `hive add-skill <name>` — Generar boilerplate de skill
|
|
24
|
-
- `hive add-worker <name>` — Generar Bun Worker
|
|
25
|
-
- **Template hive-app**: Proyecto harness completo con Docker, config, gateway
|
|
26
|
-
- **Tests del harness**: 39 tests pasando en 12 archivos
|
|
27
|
-
- Workers, Gateway, Channels, Canvas, Scheduler, Storage, Swarm, Tool Runtime
|
|
28
|
-
|
|
29
|
-
### Changed
|
|
30
|
-
- API pública expandida: exports de gateway, channels, canvas, scheduler, tool-runtime, workers
|
|
31
|
-
- `package.json`: versión 0.0.16, descripción actualizada, bin `hive`
|
|
32
|
-
- Documentación actualizada en `docs/`
|
|
33
|
-
|
|
34
|
-
## [0.0.10] - 2026-05-02
|
|
35
|
-
|
|
36
|
-
### Added
|
|
37
|
-
- DAG Scheduler with parallel worker execution
|
|
38
|
-
- Tool selector with FTS5 full-text search
|
|
39
|
-
- Skill selector with semantic triggers
|
|
40
|
-
- Context compiler for agent execution
|
|
41
|
-
- Canvas (ACE) real-time visualization
|
|
42
|
-
- Multi-channel support (Slack, Discord, Telegram, WhatsApp)
|
|
43
|
-
- AgentBus for inter-agent communication
|
|
44
|
-
- SQLite storage with FTS5 built-in
|
|
45
|
-
- 130+ passing tests
|
|
46
|
-
|
|
47
|
-
### Performance
|
|
48
|
-
- 3x faster than LangChain (Bun runtime)
|
|
49
|
-
- Parallel DAG execution (15x faster than sequential)
|
|
50
|
-
- Streaming TTFT benchmarks
|
|
51
|
-
- Worker metrics (12 tasks/sec throughput)
|
|
52
|
-
|
|
53
|
-
### Documentation
|
|
54
|
-
- Complete API documentation in docs/
|
|
55
|
-
- README comparison with LangChain
|
|
56
|
-
- Benchmark documentation
|
|
57
|
-
|
|
58
|
-
## [0.0.9] - 2026-01-01
|
|
59
|
-
|
|
60
|
-
### Added
|
|
61
|
-
- Initial release
|
|
62
|
-
- Agent execution with LLM providers
|
|
63
|
-
- Basic tool and skill system
|
|
64
|
-
- Gateway server
|
package/docs/README.md
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
# Documentación — Hive SDK
|
|
2
|
-
|
|
3
|
-
> **Agent Harness SDK** — Build, deploy, and scale AI agent applications with multi-channel support, Bun Workers, and swarm orchestration.
|
|
4
|
-
|
|
5
|
-
## Documentos
|
|
6
|
-
|
|
7
|
-
| Documento | Descripción |
|
|
8
|
-
|-----------|-------------|
|
|
9
|
-
| [API-AGENTS.md](API-AGENTS.md) | createAgent, AgentLoop, Tool/Skill Selector, LLM Providers |
|
|
10
|
-
| [API-DAG-SCHEDULER.md](API-DAG-SCHEDULER.md) | DAGScheduler, TaskGraph, TaskNode, Estrategias, Presets |
|
|
11
|
-
| [API-WORKERS-EVENTS.md](API-WORKERS-EVENTS.md) | **Bun Workers**, createWorker, WorkerPool, AgentBus, EventBus, Canvas |
|
|
12
|
-
| [API-TOOLS-SKILLS-CHANNELS.md](API-TOOLS-SKILLS-CHANNELS.md) | Tools, Skills, MCP, **Gateway**, **Channels**, **Tool Runtime**, Storage |
|
|
13
|
-
| [API-CONTEXT-COMPILER.md](API-CONTEXT-COMPILER.md) | Context Compiler, Message History, Scratchpad, EthicsGuard, ACE |
|
|
14
|
-
| [TEMPLATE-HIVE-APP.md](TEMPLATE-HIVE-APP.md) | **Template hive-app** — estructura, opciones, personalización |
|
|
15
|
-
| [HIVE-HARNESS.md](../docs/HIVE-HARNESS.md) | Posicionamiento de producto: Hive como Agent Harness |
|
|
16
|
-
|
|
17
|
-
## Instalación
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Instalar globalmente para el CLI
|
|
21
|
-
bun install -g @johpaz/hive-sdk
|
|
22
|
-
|
|
23
|
-
# O en un proyecto
|
|
24
|
-
bun add @johpaz/hive-sdk
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## CLI Commands
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
hive init <name> # Inicializar proyecto agente
|
|
31
|
-
hive create-app <name> # Crear aplicación harness completa
|
|
32
|
-
hive add-tool <name> # Añadir tool
|
|
33
|
-
hive add-skill <name> # Añadir skill
|
|
34
|
-
hive add-worker <name> # Añadir Bun Worker
|
|
35
|
-
hive run # Ejecutar agente
|
|
36
|
-
hive test # Test tools/skills
|
|
37
|
-
hive trace # Ver logs de ejecución
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Inicio Rápido
|
|
41
|
-
|
|
42
|
-
### 1. Crear una app harness completa
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
hive create-app my-hive
|
|
46
|
-
cd my-hive
|
|
47
|
-
bun install
|
|
48
|
-
cp .env.example .env
|
|
49
|
-
bun run dev
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 2. Crear un agente simple
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
import { createAgent, defineTool } from "@johpaz/hive-sdk";
|
|
56
|
-
|
|
57
|
-
const tool = defineTool({
|
|
58
|
-
name: "saludar",
|
|
59
|
-
description: "Saluda a alguien",
|
|
60
|
-
execute: async (args: { nombre: string }) => `¡Hola ${args.nombre}!`,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const agent = await createAgent({
|
|
64
|
-
name: "asistente",
|
|
65
|
-
provider: "openai",
|
|
66
|
-
model: "gpt-4o-mini",
|
|
67
|
-
tools: [tool],
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const respuesta = await agent.run("Saluda a Juan");
|
|
71
|
-
console.log(respuesta);
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### 3. Crear un worker especializado
|
|
75
|
-
|
|
76
|
-
```typescript
|
|
77
|
-
import { createWorker } from "@johpaz/hive-sdk";
|
|
78
|
-
|
|
79
|
-
const researcher = createWorker({
|
|
80
|
-
name: "researcher",
|
|
81
|
-
systemPrompt: "You are a research specialist. Provide concise, factual summaries.",
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const result = await researcher.run("Research quantum computing advances");
|
|
85
|
-
console.log(result);
|
|
86
|
-
researcher.terminate();
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### 4. Ejecutar workers en paralelo
|
|
90
|
-
|
|
91
|
-
```typescript
|
|
92
|
-
import { WorkerPool } from "@johpaz/hive-sdk";
|
|
93
|
-
|
|
94
|
-
const pool = new WorkerPool({ maxWorkers: 4 });
|
|
95
|
-
|
|
96
|
-
const tasks = [
|
|
97
|
-
{ id: "t1", message: "Summarize article A" },
|
|
98
|
-
{ id: "t2", message: "Summarize article B" },
|
|
99
|
-
{ id: "t3", message: "Summarize article C" },
|
|
100
|
-
];
|
|
101
|
-
|
|
102
|
-
const results = await pool.executeBatch(tasks);
|
|
103
|
-
console.log(results);
|
|
104
|
-
pool.shutdown();
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### 5. Gateway HTTP/WebSocket
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
import { startGateway } from "@johpaz/hive-sdk";
|
|
111
|
-
|
|
112
|
-
const server = await startGateway({
|
|
113
|
-
host: "127.0.0.1",
|
|
114
|
-
port: 18790,
|
|
115
|
-
agentId: "coordinator",
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
console.log(`Gateway at http://127.0.0.1:18790`);
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Variables de Entorno
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
HIVE_DATA_DIR=./data # Directorio de datos SQLite
|
|
125
|
-
HIVE_HOST=127.0.0.1 # Gateway host
|
|
126
|
-
HIVE_PORT=18790 # Gateway port
|
|
127
|
-
OPENAI_API_KEY=sk-... # OpenAI
|
|
128
|
-
ANTHROPIC_API_KEY=sk-ant-... # Anthropic
|
|
129
|
-
GOOGLE_API_KEY=... # Gemini
|
|
130
|
-
LOG_LEVEL=info # debug | info | warn | error
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## Tests
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
# Todos los tests (paralelo)
|
|
137
|
-
bun test
|
|
138
|
-
|
|
139
|
-
# Tests con timeout extendido
|
|
140
|
-
bun test --timeout 60000
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Changelog
|
|
144
|
-
|
|
145
|
-
### v0.0.16
|
|
146
|
-
- **Bun Workers individuales**: `createWorker()`, `WorkerPool`, `agent.worker.ts`
|
|
147
|
-
- **Gateway simplificado**: HTTP/WebSocket server con `Bun.serve()`
|
|
148
|
-
- **Channels**: Telegram, Discord, WhatsApp, Slack, Webchat
|
|
149
|
-
- **Tool Runtime**: Ejecución paralela de tools vía Bun Workers
|
|
150
|
-
- **CLI mejorado**: `hive create-app`, `hive add-tool`, `hive add-skill`, `hive add-worker`
|
|
151
|
-
- **Template hive-app**: Proyecto harness completo con Docker
|
|
152
|
-
- **39 tests pasando** en 12 archivos
|
|
153
|
-
|
|
154
|
-
### v0.0.15
|
|
155
|
-
- Core de agentes con Context Engineering, FTS5, ACE
|
|
156
|
-
- DAGScheduler con ejecución paralela
|
|
157
|
-
- API pública: `createAgent`, `defineTool`, `defineSkill`
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
*Documentación Hive SDK v0.0.16*
|
|
File without changes
|