@j-o-r/hello-dave 0.0.7 → 0.0.9

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.bak DELETED
@@ -1,218 +0,0 @@
1
- # hello-dave
2
-
3
- [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
- [![Node.js >=20](https://img.shields.io/badge/Node.js-%3E=20-green.svg)](https://nodejs.org/)
5
- [![Version: v0.0.8](https://img.shields.io/badge/Version-v0.0.8-green.svg)](https://codeberg.org/duin/hello-dave)
6
-
7
- ## Table of Contents
8
-
9
- - [Description](#description)
10
- - [Features](#features)
11
- - [Folder Structure](#folder-structure)
12
- - [Installation](#installation)
13
- - [Usage](#usage)
14
- - [Usage Examples](#usage-examples)
15
- - [Development](#development)
16
- - [Contributing](#contributing)
17
- - [License](#license)
18
-
19
- ## Description
20
-
21
- **hello-dave** is an ESM (ECMAScript Modules) toolkit for building AI agents with unified access to endpoints from Grok (xAI), OpenAI, and Anthropic. It provides CLI tools for interacting with agents locally or via WebSocket servers, along with pre-built agent scripts for various tasks like code generation, documentation, testing, and more.
22
-
23
- The project emphasizes modular agent management, tool integration (e.g., web search, file operations), and session handling with memory and caching. With v0.0.8, enhanced portability allows spawning agents in isolated environments like `/tmp` while maintaining tool functionality relative to the current working directory (CWD).
24
-
25
- ## Features
26
-
27
- - **Unified API Access**: Seamless integration with xAI (Grok), OpenAI, and Anthropic models.
28
- - **CLI Tools**: `dave` for querying agents, `agentDave` for spawning servers, `codeDave` for code servers.
29
- - **Agent Scripts**: Specialized agents for code, docs, npm, todo, readme, memory, and more.
30
- - **WebSocket Support**: Connect to remote agent servers for interactive or one-shot interactions.
31
- - **Toolsets**: Built-in tools for search, file I/O, email, and custom toolcalls.
32
- - **Session Management**: Cache history, search sessions, reset, and inspect logs.
33
- - **ESM-First**: Modern Node.js modules with TypeScript definitions.
34
- - **Portable Agent Spawning**: `spawn_agent.js` enables creating and deploying agents anywhere (project dirs or fresh `/tmp`). Supports auto-deploy in existing projects (detects `./agents/*.js`), manual code+bash in isolated setups. Tools adapt to CWD for portability. Hybrid modes combine server/client for chaining. See [docs/prompt/spawn_agent.md](docs/prompt/spawn_agent.md) for blueprint and validation.
35
-
36
- ## Folder Structure
37
-
38
- - **bin/**: Executables for CLI tools.
39
- - `dave.js`: Main CLI for asking agents or connecting to WebSocket servers.
40
- - `spawn_agent.js`: Spawns agent instances (binary: `agentDave`).
41
- - `codeDave`: Launches code servers (via PM2 clusters).
42
-
43
- - **agents/**: Agent scripts (`*_agent.js`) for specific tasks. These can be run directly with `node agents/<script>.js`.
44
- - `ask_agent.js`: General query agent.
45
- - `code_agent.js`: Code generation and execution agent (serves as main server in code clusters).
46
- - `daisy_agent.js`: Specialized agent (details in script).
47
- - `docs_agent.js`: Documentation-focused agent.
48
- - `gpt_agent.js`: OpenAI GPT integration agent.
49
- - `grok_agent.js`: xAI Grok-specific agent.
50
- - `memory_agent.js`: Agent with enhanced memory and context handling.
51
- - `npm_agent.js`: NPM package management agent.
52
- - `prompt_agent.js`: Prompt engineering and testing agent.
53
- - `readme_agent.js`: README.md management agent.
54
- - `spawn_agent.js`: Agent spawner (also in bin/). Creates portable CLI/WS agents + PM2 launchers. Validates/tests/deploys to `./agents/<name>.js`. Supports hybrid server/client modes. Portable to `/tmp` (tools follow CWD). Blueprint: [docs/prompt/spawn_agent.md](docs/prompt/spawn_agent.md).
55
- - `test_agent.js`: Testing and validation agent.
56
- - `todo_agent.js`: TODO list and task management agent.
57
- - `codeserver.sh`: Shell script for launching PM2-based code server clusters (uses agents above).
58
-
59
- - **lib/**: Core library modules (e.g., `index.js`, `wsCli.js`, `wsIO.js`, API integrations).
60
- - **scenarios/**: Test and example scenarios (e.g., toolset tests, integration scripts).
61
- - **types/**: TypeScript definitions.
62
- - **utils/**: Utility scripts (e.g., session management, testing).
63
- - **docs/**: Additional documentation, including agent blueprints (e.g., [prompt/spawn_agent.md](docs/prompt/spawn_agent.md)).
64
- - **release/**: Build artifacts.
65
-
66
- Other files: `package.json`, `CHANGELOG.md`, `TODO.md`, `LICENSE`.
67
-
68
- ## Installation
69
-
70
- 1. **Prerequisites**: Node.js >= 20.
71
-
72
- 2. **Local Development**:
73
- ```bash
74
- git clone https://codeberg.org/duin/hello-dave.git
75
- cd hello-dave
76
- npm install
77
- ```
78
-
79
- 3. **Global CLI Installation** (for `dave`, `agentDave`, `codeDave`):
80
- ```bash
81
- npm install -g .
82
- # Or link for dev: npm run link-self
83
- ```
84
-
85
- 4. **API Keys**: Set environment variables (e.g., `XAIKEY` for xAI, `OPENAI_API_KEY` for OpenAI).
86
-
87
- ## Usage
88
-
89
- ### CLI Tools
90
-
91
- - **dave**: Interact with agents locally or remotely.
92
- - Local query: `dave --ask "Predict the weather"`
93
- - One-shot remote: `echo "Hello" | dave --connect 'ws://127.0.0.1:8080' --secret '123'`
94
- - Interactive remote: `dave --connect 'ws://127.0.0.1:8080' --secret '123'`
95
- - Other: `dave --list` (sessions), `dave --clear` (cache), `dave --help`.
96
-
97
- - **agentDave**: Spawn an agent server (powered by `spawn_agent.js`).
98
- ```bash
99
- agentDave --serve 8080 --secret '123' # Starts WebSocket server
100
- ```
101
-
102
- - **codeDave**: Launch a PM2 code server cluster.
103
- ```bash
104
- codeDave 8080 --secret '123' # Or: dave --code 8080 --secret '123'
105
- ```
106
-
107
- ### Running Agents
108
-
109
- Run agent scripts directly:
110
- ```bash
111
- node agents/spawn_agent.js --serve 8080 --secret '123' # Spawn server
112
- node agents/code_agent.js --connect 'ws://127.0.0.1:8080' --secret '123' # Client mode
113
- ```
114
-
115
- For full options, see script headers or run with `--help`.
116
-
117
- ### Programmatic Usage
118
-
119
- Import and use in your Node.js app:
120
- ```javascript
121
- import { AgentManager } from '@j-o-r/hello-dave';
122
- // Setup and run agent...
123
- ```
124
-
125
- ### spawn_agent.js Specifics (v0.0.8 Portability Ready)
126
-
127
- `spawn_agent.js` (executable as `agentDave`) creates and deploys portable agents in CLI, WebSocket server, client, or **hybrid** modes (server + client for tool chaining). It fetches live prompts from [docs/prompt/spawn_agent.md](docs/prompt/spawn_agent.md) and validates new agents via blueprint (temp files, syntax checks, grep for modes/tools).
128
-
129
- - **Modes**:
130
- - **Direct (One-Shot)**: Positional input, e.g., `node agents/spawn_agent.js "Create a tester"`.
131
- - **Interactive CLI**: No input; runs REPL-like session.
132
- - **Server**: `--serve <port>` – Exposes as remote tool (e.g., for other agents to call `spawn_agent`).
133
- - **Client**: `--connect <ws_url>` – Connects to remote server for tool access.
134
- - **Hybrid**: `--serve <port> --connect <ws_url>` – Serves locally while using remote tools.
135
-
136
- - **Portability**:
137
- - **In Project**: Auto-deploys to `./agents/<name>.js` if `./agents/*.js` exist (uses existing structure).
138
- - **Fresh /tmp**: Manual code generation + bash setup (e.g., `mkdir /tmp/myproj/agents; cd /tmp/myproj; node spawn_agent.js ...`). Tools (e.g., `read_file`) follow CWD, ensuring isolation without fixed paths.
139
- - Works in any dir; no repo deps beyond Node.js + npm installs.
140
-
141
- - **Custom Tools**: Specify in prompt, e.g., "name=coderev, tools=read_file,web_search,execute_bash_script".
142
-
143
- For validation/testing: See blueprint in [docs/prompt/spawn_agent.md](docs/prompt/spawn_agent.md) (includes bash examples like `node agents/NEW_AGENT.js --help` or server connect tests).
144
-
145
- ## Usage Examples
146
-
147
- - **Direct Spawn (Project)**:
148
- ```bash
149
- cd hello-dave # Or any project with ./agents/
150
- node agents/spawn_agent.js "Create code-review agent: name=coderev, desc=Git diff analyzer, tools=read_file,execute_bash_script,web_search"
151
- # Deploys to ./agents/coderev_agent.js; test: node agents/coderev_agent.js "Review this diff"
152
- ```
153
-
154
- - **/tmp Workflow (Portable, Fresh Setup)**:
155
- ```bash
156
- mkdir -p /tmp/myportable/agents
157
- cd /tmp/myportable
158
- # Copy or fetch spawn_agent.js (e.g., curl from repo or npm install @j-o-r/hello-dave)
159
- npm init -y && npm i @j-o-r/hello-dave @j-o-r/sh
160
- node spawn_agent.js "Create todo agent: name=todo, desc=Task manager, tools=read_file,write_file"
161
- # Deploys to ./agents/todo_agent.js; tools use /tmp/myportable as CWD
162
- node agents/todo_agent.js --serve 8081 --secret abc # Test server mode
163
- ```
164
-
165
- - **Hybrid Mode with Custom Tools**:
166
- ```bash
167
- node agents/spawn_agent.js --serve 8081 --connect ws://127.0.0.1:8080/ws --secret abc "Spawn a docs agent with custom email tool"
168
- # Serves on 8081 (exposes new agent), connects to 8080 (gains remote tools like email)
169
- # Test: In another term, node agents/spawn_agent.js --connect ws://127.0.0.1:8081/ws --secret abc "Use the new docs agent"
170
- ```
171
-
172
- - **Spawn a Server**:
173
- ```bash
174
- node agents/spawn_agent.js --serve 8080 --secret '123'
175
- # Then connect: echo "Task" | dave --connect 'ws://127.0.0.1:8080' --secret '123'
176
- ```
177
-
178
- - **Launch Code Cluster** (includes multiple agents):
179
- ```bash
180
- node agents/codeserver.sh 8080 '123' # Or use codeDave
181
- # Connects code_agent, todo_agent, readme_agent, etc., to the server.
182
- ```
183
-
184
- - **Local Agent Query** (no server):
185
- ```bash
186
- dave --ask --model 'grok-4-1-fast-reasoning' "Write a function"
187
- ```
188
-
189
- - **Custom Agent**:
190
- ```bash
191
- node agents/docs_agent.js --connect 'ws://127.0.0.1:8080' --secret '123'
192
- ```
193
-
194
- See `scenarios/` for more test scenarios.
195
-
196
- ## Development
197
-
198
- - **Build Types**: `npm run types`
199
- - **Test**: `npm run tests` (runs `utils/test.sh`)
200
- - **Release**: `npm run release` then `npm run publish`
201
- - **Local Linking**: `npm run link-self` / `npm run unlink-self`
202
-
203
- Use `git status` and `ls` to inspect changes. Ensure ESM compatibility.
204
-
205
- ## Contributing
206
-
207
- Contributions welcome! Fork the repo, create a branch, and submit a pull request to https://codeberg.org/duin/hello-dave.
208
-
209
- - Report bugs: https://codeberg.org/duin/hello-dave/issues
210
- - Follow Apache-2.0 license.
211
-
212
- ## License
213
-
214
- This project is licensed under the Apache-2.0 License - see the [LICENSE](LICENSE) file for details.
215
-
216
- ---
217
- *Repository: https://codeberg.org/duin/hello-dave*
218
- ---