@johpaz/hive-sdk 0.0.17 → 0.1.3
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 +833 -0
- package/bunfig.toml +7 -0
- package/docs/API-TOOLS-SKILLS-CHANNELS.md +60 -0
- package/docs/HIVE-HARNESS.md +113 -0
- package/package.json +36 -2
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +13 -2
- package/packages/core/src/ace/Tracer.ts +1 -1
- package/packages/core/src/agent/AgentRunner.ts +12 -0
- package/packages/core/src/agent/ContextCompiler.ts +4 -4
- package/packages/core/src/agent/ConversationStore.ts +30 -20
- package/packages/core/src/agent/selectors/PlaybookSelector.ts +50 -76
- package/packages/core/src/agent/selectors/SkillSelector.ts +106 -262
- package/packages/core/src/agent/selectors/ToolSelector.ts +54 -89
- package/packages/core/src/api/createAgent.ts +10 -0
- package/packages/core/src/auth/auth.ts +36 -23
- package/packages/core/src/config/loader.ts +2 -2
- package/packages/core/src/harness/boot-id.ts +20 -0
- package/packages/core/src/harness/collections.ts +98 -0
- package/packages/core/src/harness/db-helpers.ts +87 -0
- package/packages/core/src/harness/durable-queue.ts +337 -0
- package/packages/core/src/harness/goal-verifier.ts +141 -0
- package/packages/core/src/harness/harness.test.ts +236 -0
- package/packages/core/src/harness/index.ts +34 -0
- package/packages/core/src/harness/job-store.ts +399 -0
- package/packages/core/src/harness/proof-packet.ts +69 -0
- package/packages/core/src/harness/reconcile.ts +149 -0
- package/packages/core/src/harness/run-epoch.ts +32 -0
- package/packages/core/src/harness/run-store.ts +334 -0
- package/packages/core/src/index.ts +19 -0
- package/packages/core/src/memory/Scratchpad.test.ts +23 -21
- package/packages/core/src/memory/Scratchpad.ts +41 -24
- 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/storage/HiveDBStorage.ts +64 -0
- package/packages/core/src/storage/SQLiteStorage.ts +7 -0
- package/packages/core/src/storage/hiveSeed.ts +308 -0
- package/packages/core/src/storage/hiveStorage.test.ts +38 -0
- package/packages/core/src/storage/index.ts +10 -0
- package/packages/core/src/storage/seed.ts +5 -1
- package/packages/core/src/storage/usage.ts +106 -167
- package/packages/core/src/tool-runtime/tool-runtime.test.ts +11 -3
- package/packages/core/src/tools/agents/get-available-models.ts +52 -56
- package/packages/core/src/tools/agents/index.ts +77 -60
- package/packages/core/src/tools/core/index.ts +106 -291
- package/packages/core/src/tools/index.ts +1 -0
- package/packages/core/src/tools/meeting/index.ts +83 -93
- 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/packages/core/src/utils/toon.ts +4 -4
- package/CHANGELOG.md +0 -72
- package/docs/README.md +0 -161
|
@@ -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";
|
|
@@ -113,7 +113,7 @@ export function formatToolResult(data: any, model?: string): string {
|
|
|
113
113
|
const result = stringify(data, model)
|
|
114
114
|
|
|
115
115
|
if (result.tokensSaved > 0 && model) {
|
|
116
|
-
recordToonSavings({
|
|
116
|
+
void recordToonSavings({
|
|
117
117
|
jsonBytes: result.jsonBytes,
|
|
118
118
|
toonBytes: result.toonBytes,
|
|
119
119
|
savedBytes: result.savedBytes,
|
|
@@ -135,7 +135,7 @@ export function formatMCPResponse(data: any, model?: string): string {
|
|
|
135
135
|
const result = stringify(data, model)
|
|
136
136
|
|
|
137
137
|
if (result.tokensSaved > 0 && model) {
|
|
138
|
-
recordToonSavings({
|
|
138
|
+
void recordToonSavings({
|
|
139
139
|
jsonBytes: result.jsonBytes,
|
|
140
140
|
toonBytes: result.toonBytes,
|
|
141
141
|
savedBytes: result.savedBytes,
|
|
@@ -157,7 +157,7 @@ export function formatSkillOutput(data: any, model?: string): string {
|
|
|
157
157
|
const result = stringify(data, model)
|
|
158
158
|
|
|
159
159
|
if (result.tokensSaved > 0 && model) {
|
|
160
|
-
recordToonSavings({
|
|
160
|
+
void recordToonSavings({
|
|
161
161
|
jsonBytes: result.jsonBytes,
|
|
162
162
|
toonBytes: result.toonBytes,
|
|
163
163
|
savedBytes: result.savedBytes,
|
|
@@ -179,7 +179,7 @@ export function formatContext(data: any, model?: string): string {
|
|
|
179
179
|
const result = stringify(data, model)
|
|
180
180
|
|
|
181
181
|
if (result.tokensSaved > 0 && model) {
|
|
182
|
-
recordToonSavings({
|
|
182
|
+
void recordToonSavings({
|
|
183
183
|
jsonBytes: result.jsonBytes,
|
|
184
184
|
toonBytes: result.toonBytes,
|
|
185
185
|
savedBytes: result.savedBytes,
|
package/CHANGELOG.md
DELETED
|
@@ -1,72 +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.17] - 2026-05-28
|
|
9
|
-
|
|
10
|
-
### Changed
|
|
11
|
-
- **CLI bin renombrado**: `hive` → `hives` para evitar conflicto con `@johpaz/hive-agents` (harness original)
|
|
12
|
-
- Marca actualizada: removidas referencias a "Anomaly Co." — ahora consistente con `johpaz` / `tuprofedeia`
|
|
13
|
-
- `.npmignore` creado para paquete limpio
|
|
14
|
-
- `.github/CODEOWNERS` actualizado
|
|
15
|
-
|
|
16
|
-
## [0.0.16] - 2026-05-28
|
|
17
|
-
|
|
18
|
-
### Added
|
|
19
|
-
- **Bun Workers individuales**: `createWorker()`, `WorkerPool`, `agent.worker.ts`
|
|
20
|
-
- Workers especializados con system prompt propio
|
|
21
|
-
- Ejecución en threads aislados via `Bun.Worker`
|
|
22
|
-
- Comunicación via `postMessage`/`onmessage`
|
|
23
|
-
- **Gateway simplificado**: HTTP/WebSocket server con `Bun.serve()`
|
|
24
|
-
- Endpoints: `/status`, `/chat`, `/ws`
|
|
25
|
-
- Streaming de respuestas en tiempo real
|
|
26
|
-
- **Channels**: Telegram, Discord, WhatsApp, Slack, Webchat
|
|
27
|
-
- **Tool Runtime**: Ejecución paralela de tools via Bun Workers
|
|
28
|
-
- **CLI mejorado**:
|
|
29
|
-
- `hive create-app <name>` — Generar app harness completa
|
|
30
|
-
- `hive add-tool <name>` — Generar boilerplate de tool
|
|
31
|
-
- `hive add-skill <name>` — Generar boilerplate de skill
|
|
32
|
-
- `hive add-worker <name>` — Generar Bun Worker
|
|
33
|
-
- **Template hive-app**: Proyecto harness completo con Docker, config, gateway
|
|
34
|
-
- **Tests del harness**: 39 tests pasando en 12 archivos
|
|
35
|
-
- Workers, Gateway, Channels, Canvas, Scheduler, Storage, Swarm, Tool Runtime
|
|
36
|
-
|
|
37
|
-
### Changed
|
|
38
|
-
- API pública expandida: exports de gateway, channels, canvas, scheduler, tool-runtime, workers
|
|
39
|
-
- `package.json`: versión 0.0.16, descripción actualizada, bin `hive`
|
|
40
|
-
- Documentación actualizada en `docs/`
|
|
41
|
-
|
|
42
|
-
## [0.0.10] - 2026-05-02
|
|
43
|
-
|
|
44
|
-
### Added
|
|
45
|
-
- DAG Scheduler with parallel worker execution
|
|
46
|
-
- Tool selector with FTS5 full-text search
|
|
47
|
-
- Skill selector with semantic triggers
|
|
48
|
-
- Context compiler for agent execution
|
|
49
|
-
- Canvas (ACE) real-time visualization
|
|
50
|
-
- Multi-channel support (Slack, Discord, Telegram, WhatsApp)
|
|
51
|
-
- AgentBus for inter-agent communication
|
|
52
|
-
- SQLite storage with FTS5 built-in
|
|
53
|
-
- 130+ passing tests
|
|
54
|
-
|
|
55
|
-
### Performance
|
|
56
|
-
- 3x faster than LangChain (Bun runtime)
|
|
57
|
-
- Parallel DAG execution (15x faster than sequential)
|
|
58
|
-
- Streaming TTFT benchmarks
|
|
59
|
-
- Worker metrics (12 tasks/sec throughput)
|
|
60
|
-
|
|
61
|
-
### Documentation
|
|
62
|
-
- Complete API documentation in docs/
|
|
63
|
-
- README comparison with LangChain
|
|
64
|
-
- Benchmark documentation
|
|
65
|
-
|
|
66
|
-
## [0.0.9] - 2026-01-01
|
|
67
|
-
|
|
68
|
-
### Added
|
|
69
|
-
- Initial release
|
|
70
|
-
- Agent execution with LLM providers
|
|
71
|
-
- Basic tool and skill system
|
|
72
|
-
- 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
|
-
hives init <name> # Inicializar proyecto agente
|
|
31
|
-
hives create-app <name> # Crear aplicación harness completa
|
|
32
|
-
hives add-tool <name> # Añadir tool
|
|
33
|
-
hives add-skill <name> # Añadir skill
|
|
34
|
-
hives add-worker <name> # Añadir Bun Worker
|
|
35
|
-
hives run # Ejecutar agente
|
|
36
|
-
hives test # Test tools/skills
|
|
37
|
-
hives trace # Ver logs de ejecución
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Inicio Rápido
|
|
41
|
-
|
|
42
|
-
### 1. Crear una app harness completa
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
hives 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.17
|
|
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**: `hives create-app`, `hives add-tool`, `hives add-skill`, `hives 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.17*
|