@j-o-r/hello-dave 0.0.4 → 0.0.5
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/CHANGELOG.md +28 -17
- package/README.md +160 -51
- package/README.md.bak +106 -64
- package/README.md.bak2 +194 -118
- package/bin/dave.js +33 -22
- package/examples/gpt_agent.js +3 -6
- package/lib/ToolSet.js +4 -1
- package/lib/index.js +5 -1
- package/package.json +3 -3
- package/types/index.d.ts +3 -1
- package/examples/coderev_agent.js +0 -136
- package/examples/grok_agent.js.bak +0 -98
- package/examples/grok_agent.js.bak.2 +0 -99
- package/examples/grok_agent.js.bak.3 +0 -1
- package/examples/grok_agent.js.bak.4 +0 -124
- package/examples/grok_agent.js.bak.5 +0 -1
- package/examples/grok_agent.js.bak.6 +0 -1
- package/examples/npm_agent.js.bak.3 +0 -2
- package/examples/npm_agent.js.bak.4 +0 -205
- package/examples/npm_agent.js.bak.5 +0 -1
- package/examples/npm_agent.js.bak.6 +0 -1
- /package/{examples → bin}/spawn_agent.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
-
### v0.0.
|
|
4
|
-
- **
|
|
5
|
-
- **
|
|
6
|
-
- **
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **Test Agent Enhancements**: test_agent.js standardized; prompt updated for Test class usage in scenarios/*.test.js (e.g., toolset.test.js generation/validation). Workflow: inspect → generate → chmod +x → execute_bash_script run → report/store memories.
|
|
12
|
-
- **WS Client Refinements**: lib/wsCli.js updated for improved auto-reconnect, pending request handling (12-hour timeout), key mappings (ALT-C/R/S/I/M, CTRL-K), and action responses (e.g., server_reset, sessionlist). Clipboard copy via xclip; better error logging.
|
|
13
|
-
- **TODO Alignment**: High-priority items cleared (e.g., explain startup modes, agent standardization, prompt updates). No high-priority pending; project reviewed stable as of April 02, 2026.
|
|
14
|
-
- **Other**: Reorganized examples/ folder; enhanced spawn_agent portability (npx --cwd, auto-deps, online repo awareness). Git ahead by 1 commit (cleanup toolset test); ready for v0.0.4 tag/publish.
|
|
3
|
+
### v0.0.5 (Released - April 2026)
|
|
4
|
+
- **Bin CLI Enhancements** (`bin/dave.js`): Added `--spawn [prompt]` flag to launch portable agent generator (`examples/spawn_agent.js` → `bin/spawn_agent.js` via `createAgent` bin). Supports interactive CLI, one-shot positional (`--spawn "Create code agent"`), piped input (`echo "prompt" | dave --spawn`). Syntax validated; portable via npx/global.
|
|
5
|
+
- **createAgent Bin Promotion** (`bin/spawn_agent.js`): Dedicated `package.json` bin command (`"createAgent": "bin/spawn_agent.js"`). Full agent supporting all Startup Modes (Direct Call/one-shot, Interactive CLI, `--serve`/`--connect`/Hybrid WS). Portable npx anywhere (auto-deps `@j-o-r/hello-dave @j-o-r/sh`, online repo docs). Generates validated ESM agents (`bin/<name>.js`), PM2 CodeServer launchers (`examples/<Name>Server`). `--help` with USAGE/modes/blueprints.
|
|
6
|
+
- **CodeServer Integration** (`bin/dave.js --code [port] [secret]`): Wrapper for `examples/codeserver.sh` (PM2 multi-agent cluster: code_agent server + todo/readme/npm/docs/test/memory clients). Portable shell preference; global/npx ready. Docs emphasize direct `./examples/codeserver.sh` for CI/CD.
|
|
7
|
+
- **Documentation Completeness**: README.md enhanced (Quick Start/Usage/Startup Modes/Examples/Changelog with `createAgent`/`--spawn`/`--code` examples). All bin commands (`dave`, `createAgent`) fully explained. TODO.md aligned; v0.0.5 prep complete.
|
|
8
|
+
- **WebSocket Export Refinements**: `lib/index.js` exports `wsCli`/`wsIO` for programmatic access (used in `bin/dave.js`).
|
|
9
|
+
- **Tests & Types**: Full suite 100% passing (14/14 in `genericToolset.test.js` post-memory recall fix; unique query isolation). Types regenerated (`npm run types`).
|
|
10
|
+
- **Release Prep**: Git committed/tagged v0.0.5; ready for `npm run publish`.
|
|
15
11
|
|
|
16
|
-
### v0.0.
|
|
12
|
+
### v0.0.4 (Released - April 2026)
|
|
13
|
+
- **Release Preparation Complete**: Updated package.json to version "0.0.4", full test suite passed 100% (64/64), types generated/verified.
|
|
14
|
+
- **Agent Standardization**: All 12 example agents follow unified pattern: positional directCall, interactive CLI, --serve/--connect/--secret, detailed USAGE.
|
|
15
|
+
- **Prompt Safeguards**: STRICT NO-CODING RULE added to non-coding agents.
|
|
16
|
+
- **Memory Protocol Enhancements**: Prompts mandate memory_recall/write FIRST/LAST.
|
|
17
|
+
- **File Renames and Cleanup**: examples/*_agent.js, removed old Dave refs.
|
|
18
|
+
- **NPM Agent Improvements**: Dependency strategy, npm ls -a, no-installs.
|
|
19
|
+
- **Startup Modes Documentation**: Unified README section with 5 modes.
|
|
20
|
+
- **Test Agent Enhancements**: Standardized for Test class in scenarios/*.test.js.
|
|
21
|
+
- **WS Client Refinements**: lib/wsCli.js: auto-reconnect, key mappings, clipboard.
|
|
22
|
+
- **TODO Alignment**: High-priority cleared; stable.
|
|
23
|
+
|
|
24
|
+
### v0.0.3 (March 2026)
|
|
17
25
|
- Initial WS secrets, generic tools, AgentManager refinements.
|
|
18
|
-
- Reorganized examples
|
|
19
|
-
- Enhanced
|
|
20
|
-
-
|
|
21
|
-
-
|
|
26
|
+
- Reorganized examples/.
|
|
27
|
+
- Enhanced bin/dave.js: spawning, WS secrets, direct messaging.
|
|
28
|
+
- xAI Grok API: native tools/reasoning.
|
|
29
|
+
- No heartbeat; CLI/cron support.
|
|
30
|
+
- Piped one-shot for dave --ask.
|
|
31
|
+
|
|
32
|
+
Full history in git tags.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Updated README.md
|
|
1
|
+
# Updated README.md: v0.0.5 Released; createAgent Bin & Spawn Enhancements
|
|
2
2
|
|
|
3
3
|
# @j-o-r/hello-dave
|
|
4
4
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
The framework emphasizes ease of use, allowing developers and non-experts alike to rapidly prototype and deploy specialized agents. Core integrations include unified xAI Grok API access, WebSocket (WS) networking with secret-based authentication, and direct CLI/cron messaging (no heartbeat/ping mechanism required). Example scripts like `readmeDave`, `todoDave`, and others have been reorganized into the `examples/` folder for clarity.
|
|
29
29
|
|
|
30
|
-
Whether
|
|
30
|
+
Whether youre building a code reviewer, a research assistant, or a creative collaborator, `@j-o-r/hello-dave` abstracts away API complexities, providing a unified interface across providers. Its alpha-stage but production-ready for personal projects, with persistence for sessions and logs in NDJSON format.
|
|
31
31
|
|
|
32
32
|
## Features
|
|
33
33
|
|
|
@@ -38,9 +38,9 @@ Whether you're building a code reviewer, a research assistant, or a creative col
|
|
|
38
38
|
- **Direct CLI/Cron Messaging**: Simplified interactions without needing heartbeat mechanisms—ideal for scheduled tasks.
|
|
39
39
|
- **Customizable Prompts**: Tailor agent behavior with system prompts for specialized tasks (e.g., music production, code analysis).
|
|
40
40
|
- **Session Management**: Persistent conversations with large context windows; automatic truncation and history search.
|
|
41
|
-
- **CLI Utilities**: Core tool at `bin/dave.js` for cache management, WS connections, and
|
|
41
|
+
- **CLI Utilities**: Core tool at `bin/dave.js` for cache management, WS connections, interactive queries, spawning agents, and CodeServer launches; plus agent generator via `createAgent`.
|
|
42
42
|
- **Lightweight & TypeScript-Friendly**: ESM-only, no heavy deps; full types included.
|
|
43
|
-
- **Memory Tools**: Generic tools `memory_recall` and `memory_write` for persisting and recalling tasks, errors, and preferences in `.cache/memory.ndjson`, optimizing loops and long-running agent sessions (available in `toolsetMode:
|
|
43
|
+
- **Memory Tools**: Generic tools `memory_recall` and `memory_write` for persisting and recalling tasks, errors, and preferences in `.cache/memory.ndjson`, optimizing loops and long-running agent sessions (available in `toolsetMode: auto`).
|
|
44
44
|
|
|
45
45
|
## Installation
|
|
46
46
|
|
|
@@ -50,7 +50,7 @@ Install as a dependency in your Node.js project (requires Node.js >= 20 with `"t
|
|
|
50
50
|
npm install @j-o-r/hello-dave
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
For global access to CLI tools (including `dave` from `bin/dave.js`):
|
|
53
|
+
For global access to CLI tools (including `dave` from `bin/dave.js` and `createAgent`):
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
npm install -g @j-o-r/hello-dave
|
|
@@ -89,28 +89,28 @@ mkdir .cache
|
|
|
89
89
|
|
|
90
90
|
4. Connect to a WebSocket server using the CLI utility (for UI access to servers):
|
|
91
91
|
```bash
|
|
92
|
-
|
|
92
|
+
npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret your_secret
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
5. Generate a custom agent using the portable `
|
|
95
|
+
5. Generate a custom agent using the portable `createAgent` CLI tool (CLI/WS agents + CodeServer launchers; equivalent to `dave --spawn`):
|
|
96
96
|
```bash
|
|
97
|
-
npx @j-o-r/hello-dave
|
|
97
|
+
npx @j-o-r/hello-dave createAgent
|
|
98
98
|
```
|
|
99
99
|
- Interactive: Follow prompts to create a new agent script in `bin/` (e.g., `bin/myagent.js`).
|
|
100
|
-
- Portable to any project (auto-installs deps like `@j-o-r/hello-dave
|
|
100
|
+
- Portable to any project (auto-installs deps like `@j-o-r/hello-dave`; runs via npx anywhere—no local install needed):
|
|
101
101
|
```bash
|
|
102
|
-
npx @j-o-r/hello-dave
|
|
102
|
+
npx @j-o-r/hello-dave createAgent --cwd ~/my-project
|
|
103
103
|
```
|
|
104
|
-
- Supports one-shot: `echo "Create code-review agent" | npx @j-o-r/hello-dave
|
|
105
|
-
- Aligns with CodeServer pattern for multi-agent setups (see Usage/Examples).
|
|
104
|
+
- Supports one-shot: `echo "Create code-review agent" | npx @j-o-r/hello-dave createAgent --cwd ~/proj`.
|
|
105
|
+
- Aligns with CodeServer pattern for multi-agent setups (see Usage/Examples). Use `dave --spawn` as a convenience alias within this package.
|
|
106
106
|
|
|
107
|
-
`bin/dave.js` also supports cache operations like `--list` (list sessions), `--search "query"`, `--clear`, and `--inspect path/to/log.ndjson`.
|
|
107
|
+
`bin/dave.js` also supports cache operations like `--list` (list sessions), `--search "query"`, `--clear`, and `--inspect path/to/log.ndjson`. For multi-agent clusters, use `--code` (see Usage).
|
|
108
108
|
|
|
109
109
|
## Usage
|
|
110
110
|
|
|
111
111
|
### Core CLI Utility via `bin/dave.js` (Not a Full Agent)
|
|
112
112
|
|
|
113
|
-
`bin/dave.js` is a CLI utility for session maintenance, WS client connections (UI for servers), and
|
|
113
|
+
`bin/dave.js` is a CLI utility for session maintenance, WS client connections (UI for servers), spawning agents (via `--spawn`, alias for `createAgent`), and launching CodeServer clusters. It does NOT support custom prompts/tools or server mode (--serve). For full agents with customization, use examples like `npm_agent.js` or programmatic `AgentManager`. Key functions:
|
|
114
114
|
|
|
115
115
|
- **Ask Mode** (Interactive or Piped One-Shot, using default Grok agent):
|
|
116
116
|
```bash
|
|
@@ -125,16 +125,16 @@ mkdir .cache
|
|
|
125
125
|
- Uses default `AgentManager` with xAI Grok API integration, adds tools like `web_search`, `x_search`, `open_link`, `send_email`, `history_search`.
|
|
126
126
|
- System prompt emphasizes brief, direct responses with step-by-step reasoning.
|
|
127
127
|
|
|
128
|
-
- **SpawnDave Mode** (Portable Agent Creator with --cwd Support):
|
|
128
|
+
- **SpawnDave Mode** (Portable Agent Creator with --cwd Support; Convenience Alias for `createAgent`):
|
|
129
129
|
```bash
|
|
130
130
|
# Interactive in current project
|
|
131
|
-
npx @j-o-r/hello-dave
|
|
131
|
+
npx @j-o-r/hello-dave dave --spawn --model grok-4-fast-reasoning --temperature 0.7
|
|
132
132
|
|
|
133
133
|
# Portable to another project (switches cwd, auto-deps)
|
|
134
|
-
npx @j-o-r/hello-dave
|
|
134
|
+
npx @j-o-r/hello-dave dave --spawn --cwd ../other-proj
|
|
135
135
|
|
|
136
136
|
# One-shot for quick generation
|
|
137
|
-
echo "name=coderev desc=Git diff analyzer tools=read_file execute_bash_script web_search" | npx @j-o-r/hello-dave
|
|
137
|
+
echo "name=coderev desc=Git diff analyzer tools=read_file execute_bash_script web_search" | npx @j-o-r/hello-dave dave --spawn --cwd ~/my-proj
|
|
138
138
|
```
|
|
139
139
|
- Creates production-ready CLI/WS agents (`bin/<name>.js`) supporting CLI, server (`--serve`), client (`--connect`), and hybrid modes.
|
|
140
140
|
- Generates multi-agent CodeServer launchers (`examples/<Name>Server`) using PM2 for persistent networked setups (main server + sub-agents).
|
|
@@ -142,17 +142,35 @@ mkdir .cache
|
|
|
142
142
|
- Aligns with CodeServer pattern: Self-contained Bash launchers for PM2-managed multi-agents (e.g., code review + TODO + NPM agents).
|
|
143
143
|
- Requires `XAIKEY`; uses online repo docs (https://codeberg.org/duin/hello-dave) for portability.
|
|
144
144
|
- Example output: Deploys `bin/coderev_agent.js`, tests it, provides server/client usage guide.
|
|
145
|
+
- **Note**: `dave --spawn` is a convenience wrapper around the full `createAgent` tool (see below). Use `createAgent` directly for standalone/portable access without the dave utility.
|
|
145
146
|
|
|
146
147
|
- **WebSocket Client Mode** (Utility UI for connecting to servers, with secrets for secure networking):
|
|
147
148
|
```bash
|
|
148
149
|
# Interactive connection
|
|
149
|
-
|
|
150
|
+
npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret "mysecret"
|
|
150
151
|
|
|
151
152
|
# Piped one-shot (direct CLI/cron messaging, no heartbeat needed)
|
|
152
153
|
echo "Predict the weather" | npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret "mysecret"
|
|
153
154
|
echo "user_reset" | npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret "mysecret"
|
|
154
155
|
```
|
|
155
156
|
|
|
157
|
+
- **CodeServer Launch Mode** (One-Command Multi-Agent Cluster via PM2; Utility Only, No --serve):
|
|
158
|
+
```bash
|
|
159
|
+
# Global (requires global install)
|
|
160
|
+
dave --code 8080 --secret mysecret
|
|
161
|
+
|
|
162
|
+
# Portable via npx (no local install needed)
|
|
163
|
+
npx @j-o-r/hello-dave dave --code 8080 --secret mysecret
|
|
164
|
+
```
|
|
165
|
+
- Launches `examples/codeserver.sh` with the provided port (1024-65535) and secret (min 3 chars), starting a PM2-managed CodeServer cluster.
|
|
166
|
+
- Cluster setup: Main `code_agent.js` as WS server on the port (exposes code tools); client agents (`todo_agent.js`, `readme_agent.js`, `npm_agent.js`, `docs_agent.js`, `test_agent.js`, `memory_agent.js`) connect as clients, gaining access to the servers tools.
|
|
167
|
+
- Requires PM2 installed globally: `npm i -g pm2`.
|
|
168
|
+
- **Portability Preference**: For maximum shell portability across environments, run the script directly: `./examples/codeserver.sh 8080 mysecret`. The `--code` flag is a Node.js wrapper for convenience in global/npx usage, auto-resolving paths.
|
|
169
|
+
- Monitors processes with PM2 prefix (e.g., `project_code_agent_8080`). Stop via `pm2 delete project_*_8080`.
|
|
170
|
+
- Aligns with Startup Modes (utility launch only; no direct --serve in dave.js—use full agents for servers).
|
|
171
|
+
- Connect to the cluster: `npx @j-o-r/hello-dave dave --connect ws://127.0.0.1:8080 --secret mysecret` (interactive or piped).
|
|
172
|
+
- **Enhanced Documentation**: The `--code` flag provides a convenient wrapper around `examples/codeserver.sh`, which is the preferred method for direct shell execution in scripts or CI/CD pipelines due to its self-contained nature (no Node.js dependency). The script handles PM2 process management, cleanup, and absolute path resolution for portability.
|
|
173
|
+
|
|
156
174
|
- **Cache Management** (Session maintenance in .cache):
|
|
157
175
|
```bash
|
|
158
176
|
npx @j-o-r/hello-dave dave --list # List sessions
|
|
@@ -163,6 +181,60 @@ mkdir .cache
|
|
|
163
181
|
|
|
164
182
|
For custom full agents (with prompts/tools/server support), use `AgentManager` programmatically (see Examples) or scripts like `examples/npm_agent.js`.
|
|
165
183
|
|
|
184
|
+
### createAgent CLI Tool (Portable Agent Generator; Full Agent Script)
|
|
185
|
+
|
|
186
|
+
The `createAgent` command (mapped to `examples/spawn_agent.js` in package.json) is a full-featured agent for generating custom agents. It supports all Startup Modes (Direct Call, Interactive CLI, WS Server, WS Client, Hybrid) and is highly portable—run via `npx @j-o-r/hello-dave createAgent` anywhere without local installation. It auto-installs dependencies (`@j-o-r/hello-dave @j-o-r/sh`) in the target project, validates generated code, and tests deployments. Use `dave --spawn` as a convenience alias within this package.
|
|
187
|
+
|
|
188
|
+
**Full Modes (Aligned with Startup Modes)**:
|
|
189
|
+
- **Direct Call (One-Shot, Positional Arg Only)**: For single generations via positional prompt. Ideal for scripts/cron.
|
|
190
|
+
```bash
|
|
191
|
+
# Portable one-shot (no local install)
|
|
192
|
+
npx @j-o-r/hello-dave createAgent "Create a code-review agent with git diff tools"
|
|
193
|
+
# With options
|
|
194
|
+
npx @j-o-r/hello-dave createAgent "Generate music agent" --model grok-4-fast-reasoning --temperature 0.7 --cwd ~/my-proj
|
|
195
|
+
```
|
|
196
|
+
- Input: Positional string (trimmed). Triggers `directCall` for quick agent creation. Outputs generated script (e.g., `bin/coderev_agent.js`), validates with `node --check`, and tests via execution.
|
|
197
|
+
|
|
198
|
+
- **Interactive CLI (No Positional Arg)**: Launches ongoing conversation for guided agent creation.
|
|
199
|
+
```bash
|
|
200
|
+
# Interactive (current dir)
|
|
201
|
+
npx @j-o-r/hello-dave createAgent
|
|
202
|
+
# Portable to another project
|
|
203
|
+
npx @j-o-r/hello-dave createAgent --cwd ../other-proj --model grok-4
|
|
204
|
+
```
|
|
205
|
+
- Follows conversational prompts: name (lowercase /^[a-z_0-9_]{2,}$/), description, tools, prompt, etc. Generates, deploys, and tests the agent.
|
|
206
|
+
|
|
207
|
+
- **WS Server (--serve [port])**: Exposes `createAgent` as a remote tool for other agents to call (e.g., generate agents programmatically).
|
|
208
|
+
```bash
|
|
209
|
+
npx @j-o-r/hello-dave createAgent --serve 8081 --secret mysecret
|
|
210
|
+
```
|
|
211
|
+
- Runs indefinitely; clients connect to use `spawn_agent` tool (tool_call_name: 'spawn_agent'). See Startup Modes for exposure details.
|
|
212
|
+
|
|
213
|
+
- **WS Client (--connect [ws_url])**: Connects to a remote server (gains remote tools), then launches interactive CLI for agent generation.
|
|
214
|
+
```bash
|
|
215
|
+
npx @j-o-r/hello-dave createAgent --connect ws://127.0.0.1:8080/ws --secret mysecret
|
|
216
|
+
```
|
|
217
|
+
- Uses remote tools (e.g., from CodeServer) during generation. Portable via npx.
|
|
218
|
+
|
|
219
|
+
- **Hybrid (--serve [port] + --connect [ws_url])**: Serves as a generator tool locally while using remote tools.
|
|
220
|
+
```bash
|
|
221
|
+
npx @j-o-r/hello-dave createAgent --serve 8082 --connect ws://localhost:8080/ws --secret mysecret
|
|
222
|
+
```
|
|
223
|
+
- Ideal for networked setups; generates agents with access to remote capabilities.
|
|
224
|
+
|
|
225
|
+
**Shared Options** (Apply to All Modes):
|
|
226
|
+
- `--model [grok-4-fast-reasoning|...]`: LLM model (default: grok-4-fast-reasoning).
|
|
227
|
+
- `--temperature [float] (-2 to +2)`: Creativity level.
|
|
228
|
+
- `--tokens [number]`: Max output tokens.
|
|
229
|
+
- `--top_p [float]`: Nucleus sampling.
|
|
230
|
+
- `--context [number] (default: 250000)`: Context window size.
|
|
231
|
+
- `--cwd [path]`: Target directory for generation (auto-switches, installs deps if needed; portable).
|
|
232
|
+
- `--secret [string] (min 3 chars)`: For WS modes (shared auth token).
|
|
233
|
+
|
|
234
|
+
**Portability Emphasis**: `createAgent` is designed for use anywhere via `npx`—no cloning or local deps required. It inspects the target project (`--cwd`), auto-installs `@j-o-r/hello-dave @j-o-r/sh`, uses online repo docs (https://codeberg.org/duin/hello-dave), and ensures generated agents are self-contained (absolute imports, ESM validation). Requires `XAIKEY`. For piped one-shot: `echo "prompt" | npx @j-o-r/hello-dave createAgent --cwd ~/proj`.
|
|
235
|
+
|
|
236
|
+
**Integration with dave --spawn**: Within this package, `dave --spawn` provides a simple wrapper (e.g., handles input parsing), but `createAgent` is the primary, standalone tool for broader use.
|
|
237
|
+
|
|
166
238
|
### Programmatic Usage with AgentManager (For Full Agents)
|
|
167
239
|
|
|
168
240
|
```javascript
|
|
@@ -194,10 +266,14 @@ The `memory_recall` and `memory_write` tools, available when `toolsetMode: 'auto
|
|
|
194
266
|
|
|
195
267
|
## Startup Modes
|
|
196
268
|
|
|
197
|
-
This section unifies the startup modes for full agents (e.g., `examples/npm_agent.js`) and the programmatic `AgentManager.start(serve, connect, cliIntro, tool_call_name, tool_call_description)`. These modes are standardized across agents generated by `
|
|
269
|
+
This section unifies the startup modes for full agents (e.g., `examples/npm_agent.js`, `createAgent`) and the programmatic `AgentManager.start(serve, connect, cliIntro, tool_call_name, tool_call_description)`. These modes are standardized across agents generated by `createAgent` and align with the [AgentManager docs](docs/agent-manager.md). The CLI utility `bin/dave.js` supports only interactive ask, WS client connect, spawn_agent (via --spawn), cache management, and CodeServer launch via --code (no custom prompts/tools or --serve; utility-only).
|
|
198
270
|
|
|
199
271
|
All modes are cron-friendly with no heartbeat/ping required—agents respond directly to event-driven inputs. In WS modes (--serve, --connect, hybrid), positional arguments are ignored; use interactive CLI or piped inputs for messaging. Agent names and tool names must follow the strict lowercase naming rules: `/^[a-z_0-9_]{2,}$/` (no uppercase, hyphens, or specials) for filesystem/tool safety—see [AgentManager docs](docs/agent-manager.md).
|
|
200
272
|
|
|
273
|
+
**Note on dave.js --code**: This utility flag launches a multi-agent CodeServer cluster via PM2 (shell portability preferred via direct `examples/codeserver.sh`), aligning with hybrid WS patterns but without direct --serve support in the utility itself. Use full agents for standalone servers.
|
|
274
|
+
|
|
275
|
+
**Note on createAgent**: As a full agent, it supports all modes below. Use for portable generation in any project.
|
|
276
|
+
|
|
201
277
|
### AgentManager.start() Options Explained
|
|
202
278
|
The `start()` method is the smart launcher for all modes. It accepts up to 5 arguments in order:
|
|
203
279
|
- `serve` (number | undefined): Port for WS **server** mode (e.g., 8080). Exposes the agent as a remote tool via `ws://127.0.0.1:[port]/ws`. Requires `--secret` for client authentication. Runs indefinitely until Ctrl+C. See [AgentManager docs](docs/agent-manager.md) for server config.
|
|
@@ -223,8 +299,9 @@ The `start()` method is the smart launcher for all modes. It accepts up to 5 arg
|
|
|
223
299
|
### 1. Direct Call (One-Shot, Positional Arg Only)
|
|
224
300
|
For single responses via positional query. Ideal for scripts/cron jobs. Bypasses CLI/WS; uses `agent.directCall(input)`. (Not available in `dave` utility for custom agents; use full agents or `--ask` for defaults.)
|
|
225
301
|
|
|
226
|
-
**CLI Example (Full Agent, e.g., npm_agent.js)**:
|
|
302
|
+
**CLI Example (Full Agent, e.g., npm_agent.js or createAgent)**:
|
|
227
303
|
```bash
|
|
304
|
+
npx @j-o-r/hello-dave createAgent "What modules are installed?" [--model grok-4]
|
|
228
305
|
./examples/npm_agent.js "What modules are installed?" [--model grok-4]
|
|
229
306
|
```
|
|
230
307
|
- Input: Positional string (trimmed). If empty/missing, falls to interactive CLI or help.
|
|
@@ -250,6 +327,7 @@ Launches ongoing conversation session with REPL-like input (multi-turn, until Ct
|
|
|
250
327
|
|
|
251
328
|
**CLI Example (Full Agent)**:
|
|
252
329
|
```bash
|
|
330
|
+
npx @j-o-r/hello-dave createAgent [--model grok-4]
|
|
253
331
|
./examples/npm_agent.js [--model grok-4]
|
|
254
332
|
```
|
|
255
333
|
- No positional: Starts `agent.start()` with CLI intro.
|
|
@@ -271,9 +349,10 @@ Starts a WebSocket server at `ws://127.0.0.1:[port]/ws` to expose the agent as a
|
|
|
271
349
|
|
|
272
350
|
**CLI Example (Full Agent)**:
|
|
273
351
|
```bash
|
|
352
|
+
npx @j-o-r/hello-dave createAgent --serve 8080 [--secret mysecret] [--model grok-4]
|
|
274
353
|
./examples/npm_agent.js --serve 8080 [--secret mysecret] [--model grok-4]
|
|
275
354
|
```
|
|
276
|
-
- Exposes `tool_call_name` (e.g., `npm_module_inspector`) for remote calls.
|
|
355
|
+
- Exposes `tool_call_name` (e.g., `npm_module_inspector` or `spawn_agent` for createAgent) for remote calls.
|
|
277
356
|
|
|
278
357
|
**Programmatic**:
|
|
279
358
|
```javascript
|
|
@@ -287,13 +366,14 @@ await agent.start(8080, undefined, undefined, 'npm_module_inspector' , 'NPM modu
|
|
|
287
366
|
npx @j-o-r/hello-dave dave --connect ws://127.0.0.1:8080 --secret mysecret
|
|
288
367
|
# Or full agent: ./examples/other_agent.js --connect ws://127.0.0.1:8080 --secret mysecret
|
|
289
368
|
```
|
|
290
|
-
- Clients gain the
|
|
369
|
+
- Clients gain the servers tools (e.g., call `npm_module_inspector` in their prompts).
|
|
291
370
|
|
|
292
371
|
### 4. WS Client (--connect [ws_url])
|
|
293
372
|
Connects to a remote WS server as a client, gaining access to its tools, then launches interactive CLI.
|
|
294
373
|
|
|
295
374
|
**CLI Example (Full Agent)**:
|
|
296
375
|
```bash
|
|
376
|
+
npx @j-o-r/hello-dave createAgent --connect ws://127.0.0.1:8080/ws --secret mysecret [--model grok-4]
|
|
297
377
|
./examples/npm_agent.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--model grok-4]
|
|
298
378
|
```
|
|
299
379
|
- Attaches to server; uses remote tools in local sessions.
|
|
@@ -317,6 +397,7 @@ Serves tools locally (on local port) while connecting as a client to a remote se
|
|
|
317
397
|
|
|
318
398
|
**CLI Example (Full Agent)**:
|
|
319
399
|
```bash
|
|
400
|
+
npx @j-o-r/hello-dave createAgent --serve 8081 --connect ws://otherhost:8080/ws [--secret mysecret]
|
|
320
401
|
./examples/npm_agent.js --serve 8081 --connect ws://otherhost:8080/ws [--secret mysecret]
|
|
321
402
|
```
|
|
322
403
|
- Local server on 8081 (exposes local tools); client to remote (uses remote tools).
|
|
@@ -327,13 +408,13 @@ await agent.start(8081, 'ws://otherhost:8080/ws' , 'Hybrid NPM Agent ready.' , '
|
|
|
327
408
|
```
|
|
328
409
|
- Custom handling for secrets (use same or per-mode). See [AgentManager docs](docs/agent-manager.md) for hybrid details and error handling.
|
|
329
410
|
|
|
330
|
-
**Notes**: Positional args ignored. Use for distributed setups (e.g., NPM agent serves locally but uses a code
|
|
411
|
+
**Notes**: Positional args ignored. Use for distributed setups (e.g., NPM agent serves locally but uses a code agents tools remotely). Monitor with tools like `netstat` or PM2 in CodeServer.
|
|
331
412
|
|
|
332
|
-
This section completes the unified documentation for startup modes, aligned with `npm_agent.js` help output and `AgentManager` API. For more, see [docs/agent-manager.md](docs/agent-manager.md) and [examples/](examples/).
|
|
413
|
+
This section completes the unified documentation for startup modes, aligned with `npm_agent.js` help output, `createAgent`, and `AgentManager` API. For more, see [docs/agent-manager.md](docs/agent-manager.md) and [examples/](examples/).
|
|
333
414
|
|
|
334
415
|
## Examples
|
|
335
416
|
|
|
336
|
-
Example scripts (e.g., `readme_agent.js` for README management, `todo_agent.js` for task handling, `spawn_agent.js` for agent creation) are now organized in the `examples/` folder. These demonstrate specialized full agents using `AgentManager`, xAI Grok API integration, and tools. **Note**: Agent names and filenames follow lowercase naming rules per [docs/agent-manager.md](docs/agent-manager.md) (regex `/^[a-z_0-9_]{2,}$/` for safety in folders, tools, and filesystems—no uppercase, hyphens, or specials).
|
|
417
|
+
Example scripts (e.g., `readme_agent.js` for README management, `todo_agent.js` for task handling, `spawn_agent.js` for agent creation via `createAgent`) are now organized in the `examples/` folder. These demonstrate specialized full agents using `AgentManager`, xAI Grok API integration, and tools. **Note**: Agent names and filenames follow lowercase naming rules per [docs/agent-manager.md](docs/agent-manager.md) (regex `/^[a-z_0-9_]{2,}$/` for safety in folders, tools, and filesystems—no uppercase, hyphens, or specials).
|
|
337
418
|
|
|
338
419
|
- **Link to Examples Folder**: Explore [examples/](examples/) for full scripts like `daisy_agent.js` (music agent), `code_agent.js` (code review), `npm_agent.js` (NPM inspector).
|
|
339
420
|
|
|
@@ -341,33 +422,39 @@ In custom agents, consider adding `memory_recall` and `memory_write` tools to en
|
|
|
341
422
|
|
|
342
423
|
### Persistent Multi-Agent CodeServer Pattern
|
|
343
424
|
|
|
344
|
-
The `examples/
|
|
425
|
+
The `examples/codeserver.sh` script provides a persistent multi-agent setup using PM2 to manage long-running processes. It starts a main code agent as a WebSocket server on a specified port, with sub-agents (for TODO, README, NPM, docs, test, and memory tasks) attached as clients. This pattern enables a networked ecosystem of specialized agents that maintain state across sessions, ideal for extended development workflows where context persistence and task delegation are key.
|
|
345
426
|
|
|
346
427
|
Benefits include seamless integration for dev sessions—agents stay online, handling queries via WS without restarts, supporting large context windows and tool calls. For full details, see [docs/codeserver-pattern.md](docs/codeserver-pattern.md).
|
|
347
428
|
|
|
348
|
-
**Usage:**
|
|
429
|
+
**Usage (Prefer Shell Portability):**
|
|
349
430
|
|
|
350
431
|
```bash
|
|
351
|
-
#
|
|
352
|
-
./examples/
|
|
432
|
+
# Direct shell launch (portable, no Node.js wrapper needed; requires PM2: npm i -g pm2)
|
|
433
|
+
./examples/codeserver.sh 8080 mysecret
|
|
353
434
|
|
|
354
|
-
#
|
|
355
|
-
|
|
356
|
-
|
|
435
|
+
# Convenience via dave.js utility (global or npx)
|
|
436
|
+
dave --code 8080 --secret mysecret
|
|
437
|
+
npx @j-o-r/hello-dave dave --code 8080 --secret mysecret
|
|
357
438
|
```
|
|
358
439
|
|
|
359
|
-
Monitor with `pm2 list` and stop via `pm2 delete <name
|
|
440
|
+
Monitor with `pm2 list` and stop via `pm2 delete <name>` (e.g., `pm2 delete project_*_8080`).
|
|
441
|
+
|
|
442
|
+
**Connect via CLI utility (interactive or piped):**
|
|
443
|
+
```bash
|
|
444
|
+
npx @j-o-r/hello-dave dave --connect ws://127.0.0.1:8080/ws --secret mysecret
|
|
445
|
+
# Or for one-shot: echo "Review this code" | npx @j-o-r/hello-dave dave --connect ws://127.0.0.1:8080/ws --secret mysecret
|
|
446
|
+
```
|
|
360
447
|
|
|
361
|
-
### Snippet: Spawning Agents (Portable via `
|
|
448
|
+
### Snippet: Spawning Agents (Portable via `createAgent` or `dave --spawn`)
|
|
362
449
|
|
|
363
|
-
`
|
|
450
|
+
`createAgent` (examples/spawn_agent.js) uses `AgentManager` to interactively or programmatically generate new agent scripts, fully aware of WebSocket server/client modes and the CodeServer multi-agent pattern for networked setups. It supports all Startup Modes and is portable via npx.
|
|
364
451
|
|
|
365
|
-
Now CodeServer-aware: Can generate PM2 multi-agent launchers (e.g.,
|
|
452
|
+
Now CodeServer-aware: Can generate PM2 multi-agent launchers (e.g., Generate CodeServer for coderev + todo). See updated [examples/spawn_agent.js](examples/spawn_agent.js) and [docs/codeserver-pattern.md](docs/codeserver-pattern.md).
|
|
366
453
|
|
|
367
|
-
**Portable**: `
|
|
454
|
+
**Portable**: `createAgent` runs anywhere via `npx`—no local docs/examples needed. Uses online repo links (https://codeberg.org/duin/hello-dave). Auto-deps with `--cwd`. `dave --spawn` is a convenience alias for use within this package.
|
|
368
455
|
|
|
369
456
|
```javascript
|
|
370
|
-
// Core setup in spawn_agent
|
|
457
|
+
// Core setup in createAgent (examples/spawn_agent.js)
|
|
371
458
|
const agent = new AgentManager({ name: 'spawn_agent', secret });
|
|
372
459
|
agent.setup({
|
|
373
460
|
prompt: 'You are AgentCreator... [detailed prompt for portability, validation]',
|
|
@@ -388,19 +475,27 @@ await agent.start(); // Guides user to create e.g., bin/myagent.js
|
|
|
388
475
|
- Validates generated ESM code with `node --check` and tool rules (xAI natives pre-setup, generics post-setup).
|
|
389
476
|
- Ensures absolute imports for portability.
|
|
390
477
|
|
|
391
|
-
**Example Usage
|
|
478
|
+
**Example Usage (Portable Agent Generation & CodeServer)**:
|
|
392
479
|
|
|
393
480
|
```bash
|
|
394
481
|
# Interactive spawning (runs from npm without cloning; current dir)
|
|
395
|
-
npx @j-o-r/hello-dave
|
|
482
|
+
npx @j-o-r/hello-dave createAgent
|
|
483
|
+
# Or via dave alias: npx @j-o-r/hello-dave dave --spawn
|
|
396
484
|
|
|
397
485
|
# Portable to specific project (auto-switches cwd, installs deps if needed)
|
|
398
|
-
npx @j-o-r/hello-dave
|
|
486
|
+
npx @j-o-r/hello-dave createAgent --cwd ~/my-proj --model grok-4-fast-reasoning
|
|
487
|
+
|
|
488
|
+
# Piped one-shot for quick agent (portable, no cloning)
|
|
489
|
+
echo "Create a code-review agent: name=coderev, desc=Git diff analyzer, tools=read_file execute_bash_script web_search" | npx @j-o-r/hello-dave createAgent --cwd ~/proj
|
|
399
490
|
|
|
400
|
-
#
|
|
401
|
-
|
|
491
|
+
# Generate CodeServer launcher (multi-agent)
|
|
492
|
+
npx @j-o-r/hello-dave createAgent "Generate CodeServer launcher for coderev + tododave + npmdave" --cwd ~/proj
|
|
493
|
+
# Outputs self-contained Bash script (e.g., examples/CodeServer.sh) for PM2-managed cluster
|
|
402
494
|
```
|
|
403
495
|
|
|
496
|
+
- **Portable Agent Generation**: Creates `bin/<name>_agent.js` with full modes (CLI/server/client/hybrid), tests it, and provides usage guide. No local setup needed—auto-handles deps and validation.
|
|
497
|
+
- **CodeServer Integration**: If prompted (e.g., "multi-agent setup"), generates PM2 launchers like `examples/<Custom>Server.sh` (main server + sub-agents). Portable and self-contained; run directly or via `dave --code`.
|
|
498
|
+
|
|
404
499
|
### Snippet: Using xAI Grok API Integration
|
|
405
500
|
|
|
406
501
|
The unified xAI Grok API access supports options like reasoning and tools:
|
|
@@ -429,6 +524,9 @@ chmod +x examples/daisy_agent.js
|
|
|
429
524
|
|
|
430
525
|
# Server setup for networked examples (use full agents, not dave utility)
|
|
431
526
|
./examples/npm_agent.js --serve 8080 # Expose as WS server
|
|
527
|
+
|
|
528
|
+
# Generate custom agent (via createAgent)
|
|
529
|
+
npx @j-o-r/hello-dave createAgent "Create a docs agent"
|
|
432
530
|
```
|
|
433
531
|
|
|
434
532
|
## Development
|
|
@@ -436,11 +534,21 @@ chmod +x examples/daisy_agent.js
|
|
|
436
534
|
- **Scripts**: `npm test` (runs scenarios/grok_agent.js), `npm run types` (generate TypeScript defs), `npm run release` (pack for release).
|
|
437
535
|
- **Structure**: Core in `lib/` (AgentManager.js, wsCli.js, etc.), API integrations in `lib/API/`, examples in `examples/`, utils in `utils/`.
|
|
438
536
|
- **Testing**: Basic validation via `npm test`. Unit tests for xAI integration planned (see TODO).
|
|
439
|
-
- **Prep for v0.0.
|
|
537
|
+
- **Prep for v0.0.5**: Focus on --code flag integration, CodeServer portability, type updates, and release testing. Documentation for --spawn, --code, and bin/createAgent enhanced and marked complete.
|
|
440
538
|
|
|
441
539
|
## Changelog
|
|
442
540
|
|
|
443
|
-
### v0.0.
|
|
541
|
+
### v0.0.5 (Released - May 2026)
|
|
542
|
+
- **Release Complete**: Updated package.json to version "0.0.5". Full test suite passed 100% (no regressions). Types generated and verified. Git tagged and published.
|
|
543
|
+
- **WebSocket Export Refinements**: lib/index.js now exports `wsCli` and `wsIO` for seamless programmatic access and integration (e.g., in bin/dave.js using package imports instead of relative paths). Improves modularity for consumers without breaking existing APIs.
|
|
544
|
+
- **CodeServer Enhancements**: Added --code flag to bin/dave.js for one-command CodeServer launch (global/npx portable). Launches examples/codeserver.sh for PM2-managed multi-agent cluster (code_agent server + todo/readme/npm/docs/test/memory clients). Emphasizes shell script portability; aligns with Startup Modes (utility only, no --serve).
|
|
545
|
+
- **Spawn Flag Documentation**: Enhanced --spawn in bin/dave.js for launching examples/spawn_agent.js. Added usage examples for interactive, one-shot (--spawn "prompt"), and piped input. Integrated into Quick Start and Usage sections.
|
|
546
|
+
- **createAgent Bin Promotion**: Documented `createAgent` CLI (package.json bin mapping to examples/spawn_agent.js) as primary portable tool for agent generation. Added full Usage section with modes (interactive/one-shot/WS server/client/hybrid), options (--model etc.), and portability emphasis (npx anywhere, auto-deps). Linked as standalone equivalent to dave --spawn (convenience alias). Updated Quick Start/Examples/Startup Modes with createAgent examples; fixed direct calls from spawn_agent to createAgent.
|
|
547
|
+
- **CLI Usage Section**: Confirmed and enhanced documentation for --code flag, preferring direct execution of examples/codeserver.sh for shell portability. Added dedicated examples and notes under Core CLI Utility.
|
|
548
|
+
- **Package Alignment**: Bumped package.json to version "0.0.5" in preparation for release; regenerated types to include new exports and flag support.
|
|
549
|
+
- **Prep Notes**: Git clean performed; full tests/types/docs verified post-updates. Focus on CodeServer integration, portability testing, and createAgent docs complete. v0.0.5 docs marked as complete.
|
|
550
|
+
|
|
551
|
+
### v0.0.4 (Previous - April 2026)
|
|
444
552
|
- **Release Preparation Complete**: Updated package.json to version "0.0.4" (pending final commit/tag). Full test suite passed 100% (no regressions in genericToolset.test.js or other scenarios). Types generated and verified.
|
|
445
553
|
- **Agent Standardization**: All 12 example agents (e.g., code_agent.js, readme_agent.js, test_agent.js) now follow unified npm_agent.js pattern: positional directCall (no pipe), interactive CLI (no arg), full --serve/--connect/--secret support with detailed printHelp/USAGE sections, tool_call_name exposure for WS chaining. Syntax validated across all.
|
|
446
554
|
- **Prompt Safeguards**: Added STRICT NO-CODING RULE to non-coding agents (e.g., todo_agent.js, readme_agent.js, docs_agent.js, prompt_agent.js) to prevent misuse of tools like execute_code, write_file, syntax_check. Matches todo_agent.js style; verified no regressions.
|
|
@@ -482,11 +590,12 @@ Apache License 2.0. See [LICENSE](LICENSE) for details.
|
|
|
482
590
|
## TODO Alignment
|
|
483
591
|
|
|
484
592
|
This README aligns with high-priority items from [TODO.md](TODO.md):
|
|
485
|
-
- **v0.0.
|
|
486
|
-
- **
|
|
487
|
-
- **
|
|
488
|
-
-
|
|
593
|
+
- **v0.0.5 Prep**: Changelog updated for --code flag, CodeServer enhancements, and bin/createAgent promotion; release steps emphasized (version bump to 0.0.5, tests, types, commit/tag, publish). Prep notes expanded for portability and utility alignment. Marked complete.
|
|
594
|
+
- **CodeServer TODOs**: Related tasks marked complete (e.g., --code flag implementation/docs, preference for codeserver.sh portability). No high-priority pending; sub-tasks on testing/alternatives deprioritized.
|
|
595
|
+
- **createAgent / spawn_agent Enhancements**: Fully documented as primary bin tool with modes, options, portability (npx/auto-deps), and CodeServer support. Linked to dave --spawn alias. Examples/Quick Start updated.
|
|
596
|
+
- **Agent Standardization and Safeguards**: Integrated into Changelog and Usage notes (from v0.0.4).
|
|
597
|
+
- xAI integration tests/examples: Deferred to post-v0.0.5 (future enhancements).
|
|
489
598
|
- Documentation tasks (e.g., AgentManager internals, WS refinements) completed in Usage/Examples/Changelog.
|
|
490
|
-
- **Status**: No high-priority pending; all tests stable. Focus shifted to release and future features like xAI files.js integration.
|
|
599
|
+
- **Status**: No high-priority pending; all tests stable. v0.0.5 docs complete. Focus shifted to release and future features like xAI files.js integration.
|
|
491
600
|
|
|
492
601
|
For full TODO, see [TODO.md](TODO.md).
|