@j-o-r/hello-dave 0.0.6 → 0.0.8
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 +19 -33
- package/README.md +240 -0
- package/TODO.md +13 -0
- package/{examples → agents}/ask_agent.js +5 -5
- package/{examples → agents}/codeserver.sh +14 -14
- package/{examples → agents}/daisy_agent.js +5 -5
- package/{examples → agents}/docs_agent.js +5 -5
- package/{examples → agents}/gpt_agent.js +5 -5
- package/{examples → agents}/grok_agent.js +5 -5
- package/{examples → agents}/memory_agent.js +5 -5
- package/{examples → agents}/npm_agent.js +5 -5
- package/{examples → agents}/prompt_agent.js +5 -5
- package/agents/spawn_agent.js +137 -0
- package/{examples → agents}/test_agent.js +6 -6
- package/{examples → agents}/todo_agent.js +5 -5
- package/bin/codeDave +58 -0
- package/bin/dave.js +3 -5
- package/docs/agent-manager.md +244 -0
- package/docs/bin-dave.md +62 -0
- package/docs/codeserver-pattern.md +191 -0
- package/docs/generic-toolset.md +326 -0
- package/docs/howtos/agent-networking.md +253 -0
- package/docs/howtos/spawn-agents.md.bak +200 -0
- package/docs/howtos/spawn-agents.md.bak_new +200 -0
- package/docs/jsdoc-best-practices.md +278 -0
- package/docs/multi-agent-clusters.md +265 -0
- package/docs/multi-agent-clusters.md.bak +229 -0
- package/docs/path-resolution-best-practices.md +104 -0
- package/docs/project-overview.md +67 -0
- package/docs/prompt/spawn_agent.md +173 -0
- package/docs/prompt/spawn_agent.md.bak +201 -0
- package/docs/prompt-class.md +141 -0
- package/docs/suggestions.md +38 -0
- package/docs/todo-archive-v0.0.8.md +1 -0
- package/docs/todo-archive.md +44 -0
- package/docs/tools-syntax-validation.md +121 -0
- package/docs/toolset.md +164 -0
- package/docs/xai-responses.md +111 -0
- package/docs/xai_collections.md +106 -0
- package/lib/AgentClient.js +111 -67
- package/lib/AgentManager.js +111 -80
- package/lib/AgentServer.js +144 -104
- package/lib/Cli.js +126 -93
- package/lib/Prompt.js +38 -5
- package/lib/Session.js +102 -79
- package/lib/ToolSet.js +79 -60
- package/lib/fafs.js +54 -19
- package/lib/genericToolset.js +129 -136
- package/lib/wsCli.js +50 -19
- package/lib/wsIO.js +10 -6
- package/package.json +3 -3
- package/types/AgentClient.d.ts +69 -35
- package/types/AgentManager.d.ts +50 -56
- package/types/AgentServer.d.ts +63 -16
- package/types/Cli.d.ts +56 -10
- package/types/Prompt.d.ts +36 -4
- package/types/Session.d.ts +23 -9
- package/types/ToolSet.d.ts +49 -32
- package/types/fafs.d.ts +68 -25
- package/types/wsCli.d.ts +14 -0
- package/types/wsIO.d.ts +9 -5
- package/utils/search_sessions.sh +100 -53
- package/bin/spawn_agent.js +0 -293
- package/lib/genericToolset.js.bak_syntax +0 -402
- /package/{examples → agents}/code_agent.js +0 -0
- /package/{examples → agents}/readme_agent.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,39 +1,25 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
-
### v0.0.
|
|
4
|
-
- **
|
|
5
|
-
- **
|
|
6
|
-
-
|
|
7
|
-
- **
|
|
8
|
-
- **Release Preparation**: Changelog updated with recent fixes and planned enhancements. Git commits for test/CLI/doc updates. Full suite verified; types regenerated. Ready for v0.0.6 tag/publish post-sprint.
|
|
3
|
+
### v0.0.8 (Released - April 15, 2026)
|
|
4
|
+
- **lib/genericToolset.js Timeout Refinements**: Switched `execute_bash_script` to @j-o-r/sh `.options({timeout: ms}).run()` with heredoc delimiter for verbatim multi-line bash_script safety. Default 360s (resets on stdout/stderr output for true idle detection only), SIGTERM on expiry. `execute_remote_script` stdin pipe preserved. Tests: success, sleep timeout (3s<7s), exit1 error, interactive `read -p` no hang.
|
|
5
|
+
- **TODO.md Cleanup**: Archived all completed tasks (timeout refinements, prior v0.0.7 carryovers) to `docs/todo-archive-v0.0.8.md`. Pending changelog task completed here. Clean post-release state.
|
|
6
|
+
- **.npmignore & package-lock.json**: Minor updates for cleaner packaging.
|
|
7
|
+
- **Release Prep**: `package.json` bumped to v0.0.8. `npm run release` ready (types + pack to `./release/`).
|
|
9
8
|
|
|
10
|
-
### v0.0.
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
9
|
+
### v0.0.7 (Released - April 13, 2026)
|
|
10
|
+
- **spawn_agent Enhancements**: Strict blueprint enforcement in `docs/prompt/spawn_agent.md` (mandatory tool sequence: INSPECT → VALIDATE → GATHER → GENERATE → AUTO-DEPLOY/TEST). Fixed one-shot hallucination/no-deploy via verbatim AGENT BLUEPRINT TEMPLATE, temp_agent.js validation (syntax/blueprint checks), PROJECT auto-deploy (write/mv/chmod/test/rm), FRESH manual code/bash. Robust fetchLivePrompt() (live MD full-load + fallbacks). CodeServer/PM2 awareness (LAUNCH_MODE detect, client connect hints). Tested 2026-04-13: /tmp FRESH, PROJECT diag_agent.js deploy+--help success.
|
|
11
|
+
- **JSDoc Updates (lib/ modules)**: Comprehensive JSDoc added/fixed for AgentClient.js, AgentManager.js, AgentServer.js, Cli.js, Prompt.js, Session.js, ToolSet.js, fafs.js, genericToolset.js, wsCli.js, wsIO.js. Typedefs, @returns, @private tags. Note: Some parser warnings (HTML entities < → <, import() expr); HTML generated in docs/jsdoc/.
|
|
12
|
+
- **bin/codeDave Fix**: Resolved SCRIPT_DIR symlink resolution for global npm bin runs from any dir (standard readlink loop idiom). Tested from /tmp/otherdir.
|
|
13
|
+
- **Types Regeneration**: `npm run types` → full types/*.d.ts updated via tsc.
|
|
14
|
+
- **Docs Added/Updated**: docs/generic-toolset.md (toolsPool/examples), docs/jsdoc-best-practices.md, docs/multi-agent-clusters.md (spawn_agent PM2), docs/prompt/spawn_agent.md (PROCESS/blueprint), docs/todo-archive.md (TODO history).
|
|
15
|
+
- **NPM Deps & Scripts**: Pruned extraneous, installed missing (@j-o-r/apiserver/cli, gpt-3-encoder). Clean `npm ls`. TODO.md shortened (recent 7 Done items; older archived).
|
|
16
|
+
- **utils/search_sessions.sh**: Added/modified for history search.
|
|
17
|
+
- **Tests & Fixes**: genericToolset.test.js notes (write_file validation stable). write_file temp-first + cleanup for deploys. All spawn_agent changes verified in CodeServer cluster (PM2 hello-dave_*_9000).
|
|
18
|
+
- **Release Prep**: package.json v0.0.7, git commits/tags. Ready for `npm publish --access public`.
|
|
18
19
|
|
|
19
|
-
### v0.0.
|
|
20
|
-
|
|
21
|
-
- **Agent Standardization**: All 12 example agents follow unified pattern: positional directCall, interactive CLI, --serve/--connect/--secret, detailed USAGE.
|
|
22
|
-
- **Prompt Safeguards**: STRICT NO-CODING RULE added to non-coding agents.
|
|
23
|
-
- **Memory Protocol Enhancements**: Prompts mandate memory_recall/write FIRST/LAST.
|
|
24
|
-
- **File Renames and Cleanup**: examples/*_agent.js, removed old Dave refs.
|
|
25
|
-
- **NPM Agent Improvements**: Dependency strategy, npm ls -a, no-installs.
|
|
26
|
-
- **Startup Modes Documentation**: Unified README section with 5 modes.
|
|
27
|
-
- **Test Agent Enhancements**: Standardized for Test class in scenarios/*.test.js.
|
|
28
|
-
- **WS Client Refinements**: lib/wsCli.js: auto-reconnect, key mappings, clipboard.
|
|
29
|
-
- **TODO Alignment**: High-priority cleared; stable.
|
|
20
|
+
### v0.0.6 (Released - April 2026)
|
|
21
|
+
[Previous content unchanged]
|
|
30
22
|
|
|
31
|
-
|
|
32
|
-
- Initial WS secrets, generic tools, AgentManager refinements.
|
|
33
|
-
- Reorganized examples/.
|
|
34
|
-
- Enhanced bin/dave.js: spawning, WS secrets, direct messaging.
|
|
35
|
-
- xAI Grok API: native tools/reasoning.
|
|
36
|
-
- No heartbeat; CLI/cron support.
|
|
37
|
-
- Piped one-shot for dave --ask.
|
|
23
|
+
[... rest of previous sections unchanged ...]
|
|
38
24
|
|
|
39
|
-
Full history in git tags.
|
|
25
|
+
Full history in git tags.
|
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# hello-dave
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](https://codeberg.org/duin/hello-dave)
|
|
6
|
+
[](https://pm2.keymetrics.io/)
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Description](#description)
|
|
11
|
+
- [Features](#features)
|
|
12
|
+
- [Folder Structure](#folder-structure)
|
|
13
|
+
- [Installation](#installation)
|
|
14
|
+
- [Usage](#usage)
|
|
15
|
+
- [Usage Examples](#usage-examples)
|
|
16
|
+
- [Development](#development)
|
|
17
|
+
- [Contributing](#contributing)
|
|
18
|
+
- [License](#license)
|
|
19
|
+
|
|
20
|
+
## Description
|
|
21
|
+
|
|
22
|
+
**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.
|
|
23
|
+
|
|
24
|
+
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).
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **Unified API Access**: Seamless integration with xAI (Grok), OpenAI, and Anthropic models.
|
|
29
|
+
- **CLI Tools**: `dave` for querying agents, `agentDave` for spawning servers, `codeDave` for code servers.
|
|
30
|
+
- **Agent Scripts**: Specialized agents for code, docs, npm, todo, readme, memory, and more.
|
|
31
|
+
- **WebSocket Support**: Connect to remote agent servers for interactive or one-shot interactions.
|
|
32
|
+
- **Toolsets**: Built-in tools for search, file I/O, email, and custom toolcalls.
|
|
33
|
+
- **Session Management**: Cache history, search sessions, reset, and inspect logs.
|
|
34
|
+
- **ESM-First**: Modern Node.js modules with TypeScript definitions.
|
|
35
|
+
- **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.
|
|
36
|
+
- **Multi-Agent Clusters**: PM2-powered CodeServer for scalable, clustered agent deployments (e.g., code_agent + todo_agent). Defaults to port 9000/secret '123'. See [docs/multi-agent-clusters.md](docs/multi-agent-clusters.md) for configuration.
|
|
37
|
+
|
|
38
|
+
## Folder Structure
|
|
39
|
+
|
|
40
|
+
- **bin/**: Executables for CLI tools.
|
|
41
|
+
- `dave.js`: Main CLI for asking agents or connecting to WebSocket servers.
|
|
42
|
+
- `spawn_agent.js`: Spawns agent instances (binary: `agentDave`).
|
|
43
|
+
- `codeDave`: Launches code servers (via PM2 clusters). References [docs/multi-agent-clusters.md](docs/multi-agent-clusters.md) for setup and scaling.
|
|
44
|
+
|
|
45
|
+
- **agents/**: Agent scripts (`*_agent.js`) for specific tasks. These can be run directly with `node agents/<script>.js`.
|
|
46
|
+
- `ask_agent.js`: General query agent.
|
|
47
|
+
- `code_agent.js`: Code generation and execution agent (serves as main server in code clusters).
|
|
48
|
+
- `daisy_agent.js`: Specialized agent (details in script).
|
|
49
|
+
- `docs_agent.js`: Documentation-focused agent.
|
|
50
|
+
- `gpt_agent.js`: OpenAI GPT integration agent.
|
|
51
|
+
- `grok_agent.js`: xAI Grok-specific agent.
|
|
52
|
+
- `memory_agent.js`: Agent with enhanced memory and context handling.
|
|
53
|
+
- `npm_agent.js`: NPM package management agent.
|
|
54
|
+
- `prompt_agent.js`: Prompt engineering and testing agent.
|
|
55
|
+
- `readme_agent.js`: README.md management agent.
|
|
56
|
+
- `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).
|
|
57
|
+
- `test_agent.js`: Testing and validation agent.
|
|
58
|
+
- `todo_agent.js`: TODO list and task management agent.
|
|
59
|
+
- `codeserver.sh`: Shell script for launching PM2-based code server clusters (uses agents above). See [docs/multi-agent-clusters.md](docs/multi-agent-clusters.md).
|
|
60
|
+
|
|
61
|
+
- **lib/**: Core library modules (e.g., `index.js`, `wsCli.js`, `wsIO.js`, API integrations).
|
|
62
|
+
- **scenarios/**: Test and example scenarios (e.g., toolset tests, integration scripts).
|
|
63
|
+
- **types/**: TypeScript definitions.
|
|
64
|
+
- **utils/**: Utility scripts (e.g., session management, testing).
|
|
65
|
+
- **docs/**: Additional documentation, including agent blueprints (e.g., [prompt/spawn_agent.md](docs/prompt/spawn_agent.md)) and multi-agent guides (e.g., [multi-agent-clusters.md](docs/multi-agent-clusters.md)).
|
|
66
|
+
- **release/**: Build artifacts.
|
|
67
|
+
|
|
68
|
+
Other files: `package.json`, `CHANGELOG.md`, `TODO.md`, `LICENSE`.
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
1. **Prerequisites**: Node.js >= 20. PM2 for multi-agent clusters: `npm install -g pm2`.
|
|
73
|
+
|
|
74
|
+
2. **Local Development**:
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://codeberg.org/duin/hello-dave.git
|
|
77
|
+
cd hello-dave
|
|
78
|
+
npm install
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. **Global CLI Installation** (for `dave`, `agentDave`, `codeDave`):
|
|
82
|
+
```bash
|
|
83
|
+
npm install -g .
|
|
84
|
+
# Or link for dev: npm run link-self
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
4. **API Keys**: Set environment variables (e.g., `XAIKEY` for xAI, `OPENAI_API_KEY` for OpenAI).
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
|
|
91
|
+
### CLI Tools
|
|
92
|
+
|
|
93
|
+
- **dave**: Interact with agents locally or remotely.
|
|
94
|
+
- Local query: `dave --ask "Predict the weather"`
|
|
95
|
+
- One-shot remote: `echo "Hello" | dave --connect 'ws://127.0.0.1:8080' --secret '123'`
|
|
96
|
+
- Interactive remote: `dave --connect 'ws://127.0.0.1:8080' --secret '123'`
|
|
97
|
+
- Other: `dave --list` (sessions), `dave --clear` (cache), `dave --help`.
|
|
98
|
+
|
|
99
|
+
- **agentDave**: Spawn an agent server (powered by `spawn_agent.js`).
|
|
100
|
+
```bash
|
|
101
|
+
agentDave --serve 8080 --secret '123' # Starts WebSocket server
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- **codeDave**: Launch a PM2 code server cluster.
|
|
105
|
+
```bash
|
|
106
|
+
codeDave 8080 --secret '123' # Or: dave --code 8080 --secret '123'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Running Agents
|
|
110
|
+
|
|
111
|
+
Run agent scripts directly:
|
|
112
|
+
```bash
|
|
113
|
+
node agents/spawn_agent.js --serve 8080 --secret '123' # Spawn server
|
|
114
|
+
node agents/code_agent.js --connect 'ws://127.0.0.1:8080' --secret '123' # Client mode
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
For full options, see script headers or run with `--help`.
|
|
118
|
+
|
|
119
|
+
### Programmatic Usage
|
|
120
|
+
|
|
121
|
+
Import and use in your Node.js app:
|
|
122
|
+
```javascript
|
|
123
|
+
import { AgentManager } from '@j-o-r/hello-dave';
|
|
124
|
+
// Setup and run agent...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### spawn_agent.js Specifics (v0.0.8 Portability Ready)
|
|
128
|
+
|
|
129
|
+
`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).
|
|
130
|
+
|
|
131
|
+
- **Modes**:
|
|
132
|
+
- **Direct (One-Shot)**: Positional input, e.g., `node agents/spawn_agent.js "Create a tester"`.
|
|
133
|
+
- **Interactive CLI**: No input; runs REPL-like session.
|
|
134
|
+
- **Server**: `--serve <port>` – Exposes as remote tool (e.g., for other agents to call `spawn_agent`).
|
|
135
|
+
- **Client**: `--connect <ws_url>` – Connects to remote server for tool access.
|
|
136
|
+
- **Hybrid**: `--serve <port> --connect <ws_url>` – Serves locally while using remote tools.
|
|
137
|
+
|
|
138
|
+
- **Portability**:
|
|
139
|
+
- **In Project**: Auto-deploys to `./agents/<name>.js` if `./agents/*.js` exist (uses existing structure).
|
|
140
|
+
- **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.
|
|
141
|
+
- Works in any dir; no repo deps beyond Node.js + npm installs.
|
|
142
|
+
|
|
143
|
+
- **Custom Tools**: Specify in prompt, e.g., "name=coderev, tools=read_file,web_search,execute_bash_script".
|
|
144
|
+
|
|
145
|
+
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).
|
|
146
|
+
|
|
147
|
+
### CodeServer & PM2 Multi-Agent (v0.0.8)
|
|
148
|
+
|
|
149
|
+
CodeServer (via `bin/codeDave` or `agents/codeserver.sh`) launches scalable, PM2-clustered multi-agent environments for collaborative tasks (e.g., code generation + task management). It deploys agents like `code_agent`, `todo_agent`, and `readme_agent` on a WebSocket server, enabling chaining and load balancing.
|
|
150
|
+
|
|
151
|
+
- **Defaults**: Port 9000, secret '123' (customizable via args).
|
|
152
|
+
- **Prerequisites**: Install PM2 globally (`npm install -g pm2`).
|
|
153
|
+
- **Quickstart**:
|
|
154
|
+
```bash
|
|
155
|
+
codeDave 9000 --secret 123 # Launches PM2 cluster on ws://127.0.0.1:9000/ws
|
|
156
|
+
pm2 list # Verify processes (e.g., code_agent, todo_agent instances)
|
|
157
|
+
echo "task" | bin/dave.js --connect ws://127.0.0.1:9000/ws --secret 123 # One-shot query to cluster
|
|
158
|
+
```
|
|
159
|
+
This starts the cluster, lists running agents, and sends a test task (response routed to available agents).
|
|
160
|
+
|
|
161
|
+
- **Scaling & Management**: Use PM2 commands (e.g., `pm2 scale <app> 4`, `pm2 stop all`). For ecosystem config, PM2 JSON files, or agent orchestration, see the [full guide in docs/multi-agent-clusters.md](docs/multi-agent-clusters.md).
|
|
162
|
+
|
|
163
|
+
- **Integration**: Combine with `spawn_agent.js` for dynamic agent addition to clusters (e.g., spawn new agents and connect via `--connect ws://127.0.0.1:9000/ws`).
|
|
164
|
+
|
|
165
|
+
## Usage Examples
|
|
166
|
+
|
|
167
|
+
- **Direct Spawn (Project)**:
|
|
168
|
+
```bash
|
|
169
|
+
cd hello-dave # Or any project with ./agents/
|
|
170
|
+
node agents/spawn_agent.js "Create code-review agent: name=coderev, desc=Git diff analyzer, tools=read_file,execute_bash_script,web_search"
|
|
171
|
+
# Deploys to ./agents/coderev_agent.js; test: node agents/coderev_agent.js "Review this diff"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- **/tmp Workflow (Portable, Fresh Setup)**:
|
|
175
|
+
```bash
|
|
176
|
+
mkdir -p /tmp/myportable/agents
|
|
177
|
+
cd /tmp/myportable
|
|
178
|
+
# Copy or fetch spawn_agent.js (e.g., curl from repo or npm install @j-o-r/hello-dave)
|
|
179
|
+
npm init -y && npm i @j-o-r/hello-dave @j-o-r/sh
|
|
180
|
+
node spawn_agent.js "Create todo agent: name=todo, desc=Task manager, tools=read_file,write_file"
|
|
181
|
+
# Deploys to ./agents/todo_agent.js; tools use /tmp/myportable as CWD
|
|
182
|
+
node agents/todo_agent.js --serve 8081 --secret abc # Test server mode
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
- **Hybrid Mode with Custom Tools**:
|
|
186
|
+
```bash
|
|
187
|
+
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"
|
|
188
|
+
# Serves on 8081 (exposes new agent), connects to 8080 (gains remote tools like email)
|
|
189
|
+
# Test: In another term, node agents/spawn_agent.js --connect ws://127.0.0.1:8081/ws --secret abc "Use the new docs agent"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
- **Spawn a Server**:
|
|
193
|
+
```bash
|
|
194
|
+
node agents/spawn_agent.js --serve 8080 --secret '123'
|
|
195
|
+
# Then connect: echo "Task" | dave --connect 'ws://127.0.0.1:8080' --secret '123'
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- **Launch Code Cluster** (includes multiple agents):
|
|
199
|
+
```bash
|
|
200
|
+
node agents/codeserver.sh 9000 '123' # Or use codeDave 9000 --secret 123
|
|
201
|
+
# Connects code_agent, todo_agent, readme_agent, etc., to the server on ws://127.0.0.1:9000/ws.
|
|
202
|
+
# Test: pm2 list; echo "Optimize this code" | dave --connect ws://127.0.0.1:9000/ws --secret 123
|
|
203
|
+
# For advanced config: See [docs/multi-agent-clusters.md](docs/multi-agent-clusters.md).
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- **Local Agent Query** (no server):
|
|
207
|
+
```bash
|
|
208
|
+
dave --ask --model 'grok-4-1-fast-reasoning' "Write a function"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- **Custom Agent**:
|
|
212
|
+
```bash
|
|
213
|
+
node agents/docs_agent.js --connect 'ws://127.0.0.1:8080' --secret '123'
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
See `scenarios/` for more test scenarios.
|
|
217
|
+
|
|
218
|
+
## Development
|
|
219
|
+
|
|
220
|
+
- **Build Types**: `npm run types`
|
|
221
|
+
- **Test**: `npm run tests` (runs `utils/test.sh`)
|
|
222
|
+
- **Release**: `npm run release` then `npm run publish`
|
|
223
|
+
- **Local Linking**: `npm run link-self` / `npm run unlink-self`
|
|
224
|
+
|
|
225
|
+
Use `git status` and `ls` to inspect changes. Ensure ESM compatibility.
|
|
226
|
+
|
|
227
|
+
## Contributing
|
|
228
|
+
|
|
229
|
+
Contributions welcome! Fork the repo, create a branch, and submit a pull request to https://codeberg.org/duin/hello-dave.
|
|
230
|
+
|
|
231
|
+
- Report bugs: https://codeberg.org/duin/hello-dave/issues
|
|
232
|
+
- Follow Apache-2.0 license.
|
|
233
|
+
|
|
234
|
+
## License
|
|
235
|
+
|
|
236
|
+
This project is licensed under the Apache-2.0 License - see the [LICENSE](LICENSE) file for details.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
*Repository: https://codeberg.org/duin/hello-dave*
|
|
240
|
+
---
|
package/TODO.md
ADDED
|
@@ -56,19 +56,19 @@ function printHelp() {
|
|
|
56
56
|
## USAGE MODES:
|
|
57
57
|
|
|
58
58
|
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
59
|
-
./
|
|
59
|
+
./agents/${name}.js "Your query here" [--options]
|
|
60
60
|
|
|
61
61
|
### 2. Interactive CLI (no positional arg):
|
|
62
|
-
./
|
|
62
|
+
./agents/${name}.js [--options]
|
|
63
63
|
|
|
64
64
|
### 3. WS Server (no positional arg):
|
|
65
|
-
./
|
|
65
|
+
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
66
66
|
|
|
67
67
|
### 4. WS Client (no positional arg):
|
|
68
|
-
./
|
|
68
|
+
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
69
69
|
|
|
70
70
|
### 5. Hybrid (Server + Client, no positional arg):
|
|
71
|
-
./
|
|
71
|
+
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
72
72
|
|
|
73
73
|
## SERVER OPTIONS EXPLAINED:
|
|
74
74
|
--serve [port]: Starts WebSocket SERVER at ws://127.0.0.1:[port]/ws. Allows other agents (--connect) to connect and use this agent as a remote TOOL (e.g., 'search_agent'). Runs indefinitely until Ctrl+C.
|
|
@@ -25,23 +25,23 @@ FOLDER=$(basename "$PROJECT_DIR")
|
|
|
25
25
|
echo "Starting CodeServer on port ${PORT} in folder '${FOLDER}' (SCRIPT_DIR: ${SCRIPT_DIR}) with SECRET '${SECRET}'..."
|
|
26
26
|
|
|
27
27
|
# Delete existing processes with folder_port suffix
|
|
28
|
-
pm2 delete "${FOLDER}
|
|
29
|
-
pm2 delete "${FOLDER}
|
|
30
|
-
pm2 delete "${FOLDER}
|
|
31
|
-
pm2 delete "${FOLDER}
|
|
32
|
-
pm2 delete "${FOLDER}
|
|
33
|
-
pm2 delete "${FOLDER}
|
|
34
|
-
pm2 delete "${FOLDER}
|
|
28
|
+
pm2 delete "${FOLDER}_code_${PORT}" 2>/dev/null || true
|
|
29
|
+
pm2 delete "${FOLDER}_todo_${PORT}" 2>/dev/null || true
|
|
30
|
+
pm2 delete "${FOLDER}_readme_${PORT}" 2>/dev/null || true
|
|
31
|
+
pm2 delete "${FOLDER}_npm_${PORT}" 2>/dev/null || true
|
|
32
|
+
pm2 delete "${FOLDER}_docs_${PORT}" 2>/dev/null || true
|
|
33
|
+
pm2 delete "${FOLDER}_test_${PORT}" 2>/dev/null || true
|
|
34
|
+
pm2 delete "${FOLDER}_memory__${PORT}" 2>/dev/null || true
|
|
35
35
|
|
|
36
36
|
# Spawn main Agent / server (absolute paths to scripts)
|
|
37
|
-
pm2 start "${SCRIPT_DIR}/code_agent.js" --name "${FOLDER}
|
|
37
|
+
pm2 start "${SCRIPT_DIR}/code_agent.js" --name "${FOLDER}_code_${PORT}" -- --serve "${PORT}" --tools javascript --secret "${SECRET}"
|
|
38
38
|
# Attach clients
|
|
39
|
-
pm2 start "${SCRIPT_DIR}/todo_agent.js" --name "${FOLDER}
|
|
40
|
-
pm2 start "${SCRIPT_DIR}/readme_agent.js" --name "${FOLDER}
|
|
41
|
-
pm2 start "${SCRIPT_DIR}/npm_agent.js" --name "${FOLDER}
|
|
42
|
-
pm2 start "${SCRIPT_DIR}/docs_agent.js" --name "${FOLDER}
|
|
43
|
-
pm2 start "${SCRIPT_DIR}/test_agent.js" --name "${FOLDER}
|
|
44
|
-
pm2 start "${SCRIPT_DIR}/memory_agent.js" --name "${FOLDER}
|
|
39
|
+
pm2 start "${SCRIPT_DIR}/todo_agent.js" --name "${FOLDER}_todo_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
40
|
+
pm2 start "${SCRIPT_DIR}/readme_agent.js" --name "${FOLDER}_readme_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
41
|
+
pm2 start "${SCRIPT_DIR}/npm_agent.js" --name "${FOLDER}_npm_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
42
|
+
pm2 start "${SCRIPT_DIR}/docs_agent.js" --name "${FOLDER}_docs_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
43
|
+
pm2 start "${SCRIPT_DIR}/test_agent.js" --name "${FOLDER}_test_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
44
|
+
pm2 start "${SCRIPT_DIR}/memory_agent.js" --name "${FOLDER}_memory_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
45
45
|
|
|
46
46
|
echo "CodeServer processes spawned with prefix '${FOLDER}_' and suffix _${PORT}. Check with: pm2 list | grep '${FOLDER}_${PORT}'"
|
|
47
47
|
echo "dave --connect ws://127.0.0.1:${PORT}/ws --secret '$SECRET'"
|
|
@@ -57,19 +57,19 @@ function printHelp() {
|
|
|
57
57
|
## USAGE MODES:
|
|
58
58
|
|
|
59
59
|
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
60
|
-
./
|
|
60
|
+
./agents/${name}.js "Generate lyrics for pop song" [--options]
|
|
61
61
|
|
|
62
62
|
### 2. Interactive CLI (no positional arg):
|
|
63
|
-
./
|
|
63
|
+
./agents/${name}.js [--options]
|
|
64
64
|
|
|
65
65
|
### 3. WS Server (no positional arg):
|
|
66
|
-
./
|
|
66
|
+
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
67
67
|
|
|
68
68
|
### 4. WS Client (no positional arg):
|
|
69
|
-
./
|
|
69
|
+
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
70
70
|
|
|
71
71
|
### 5. Hybrid (Server + Client, no positional arg):
|
|
72
|
-
./
|
|
72
|
+
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
73
73
|
|
|
74
74
|
## SERVER OPTIONS EXPLAINED:
|
|
75
75
|
--serve [port]: Starts WebSocket SERVER at ws://127.0.0.1:[port]/ws. Allows other agents (--connect) to connect and use this agent as a remote TOOL (e.g., 'daisy_agent'). Runs indefinitely until Ctrl+C.
|
|
@@ -54,19 +54,19 @@ function printHelp() {
|
|
|
54
54
|
## USAGE MODES:
|
|
55
55
|
|
|
56
56
|
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
57
|
-
./
|
|
57
|
+
./agents/${name}.js "Create a doc on Node.js basics" [--options]
|
|
58
58
|
|
|
59
59
|
### 2. Interactive CLI (no positional arg):
|
|
60
|
-
./
|
|
60
|
+
./agents/${name}.js [--options]
|
|
61
61
|
|
|
62
62
|
### 3. WS Server (no positional arg):
|
|
63
|
-
./
|
|
63
|
+
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
64
64
|
|
|
65
65
|
### 4. WS Client (no positional arg):
|
|
66
|
-
./
|
|
66
|
+
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
67
67
|
|
|
68
68
|
### 5. Hybrid (Server + Client, no positional arg):
|
|
69
|
-
./
|
|
69
|
+
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
70
70
|
|
|
71
71
|
## SERVER OPTIONS EXPLAINED:
|
|
72
72
|
--serve [port]: Starts WebSocket SERVER at ws://127.0.0.1:[port]/ws. Allows other agents (--connect) to connect and use this agent as a remote TOOL (e.g., 'agent_docs'). Runs indefinitely until Ctrl+C.
|
|
@@ -52,19 +52,19 @@ function printHelp() {
|
|
|
52
52
|
## USAGE MODES:
|
|
53
53
|
|
|
54
54
|
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
55
|
-
./
|
|
55
|
+
./agents/${name}.js "Your query" [--options]
|
|
56
56
|
|
|
57
57
|
### 2. Interactive CLI (no positional arg):
|
|
58
|
-
./
|
|
58
|
+
./agents/${name}.js [--options]
|
|
59
59
|
|
|
60
60
|
### 3. WS Server (no positional arg):
|
|
61
|
-
./
|
|
61
|
+
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
62
62
|
|
|
63
63
|
### 4. WS Client (no positional arg):
|
|
64
|
-
./
|
|
64
|
+
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
65
65
|
|
|
66
66
|
### 5. Hybrid (Server + Client, no positional arg):
|
|
67
|
-
./
|
|
67
|
+
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
68
68
|
|
|
69
69
|
## SERVER OPTIONS EXPLAINED:
|
|
70
70
|
--serve [port]: Starts WebSocket SERVER at ws://127.0.0.1:[port]/ws. Allows other agents (--connect) to connect and use this agent as a remote TOOL (e.g., 'gpt_agent'). Runs indefinitely until Ctrl+C.
|
|
@@ -64,19 +64,19 @@ function printHelp() {
|
|
|
64
64
|
## USAGE MODES:
|
|
65
65
|
|
|
66
66
|
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
67
|
-
./
|
|
67
|
+
./agents/${name}.js "What is your task?" [--options]
|
|
68
68
|
|
|
69
69
|
### 2. Interactive CLI (no positional arg):
|
|
70
|
-
./
|
|
70
|
+
./agents/${name}.js [--options]
|
|
71
71
|
|
|
72
72
|
### 3. WS Server (no positional arg):
|
|
73
|
-
./
|
|
73
|
+
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
74
74
|
|
|
75
75
|
### 4. WS Client (no positional arg):
|
|
76
|
-
./
|
|
76
|
+
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
77
77
|
|
|
78
78
|
### 5. Hybrid (Server + Client, no positional arg):
|
|
79
|
-
./
|
|
79
|
+
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
80
80
|
|
|
81
81
|
## SERVER OPTIONS EXPLAINED:
|
|
82
82
|
--serve [port]: Starts WebSocket SERVER at ws://127.0.0.1:[port]/ws. Allows other agents (--connect) to connect and use this agent as a remote TOOL. Runs indefinitely until Ctrl+C.
|
|
@@ -56,19 +56,19 @@ function printHelp() {
|
|
|
56
56
|
## USAGE MODES:
|
|
57
57
|
|
|
58
58
|
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
59
|
-
./
|
|
59
|
+
./agents/${name}.js "Recall tasks" [--options]
|
|
60
60
|
|
|
61
61
|
### 2. Interactive CLI (no positional arg):
|
|
62
|
-
./
|
|
62
|
+
./agents/${name}.js [--options]
|
|
63
63
|
|
|
64
64
|
### 3. WS Server (no positional arg):
|
|
65
|
-
./
|
|
65
|
+
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
66
66
|
|
|
67
67
|
### 4. WS Client (no positional arg):
|
|
68
|
-
./
|
|
68
|
+
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
69
69
|
|
|
70
70
|
### 5. Hybrid (Server + Client, no positional arg):
|
|
71
|
-
./
|
|
71
|
+
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
72
72
|
|
|
73
73
|
## SERVER OPTIONS EXPLAINED:
|
|
74
74
|
--serve [port]: Starts WebSocket SERVER at ws://127.0.0.1:[port]/ws. Allows other agents (--connect) to connect and use this agent as a remote TOOL (e.g., 'memory_agent'). Runs indefinitely until Ctrl+C.
|
|
@@ -55,19 +55,19 @@ function printHelp() {
|
|
|
55
55
|
## USAGE MODES:
|
|
56
56
|
|
|
57
57
|
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
58
|
-
./
|
|
58
|
+
./agents/${name}.js "What modules are installed?" [--options]
|
|
59
59
|
|
|
60
60
|
### 2. Interactive CLI (no positional arg):
|
|
61
|
-
./
|
|
61
|
+
./agents/${name}.js [--options]
|
|
62
62
|
|
|
63
63
|
### 3. WS Server (no positional arg):
|
|
64
|
-
./
|
|
64
|
+
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
65
65
|
|
|
66
66
|
### 4. WS Client (no positional arg):
|
|
67
|
-
./
|
|
67
|
+
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
68
68
|
|
|
69
69
|
### 5. Hybrid (Server + Client, no positional arg):
|
|
70
|
-
./
|
|
70
|
+
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
71
71
|
|
|
72
72
|
## SERVER OPTIONS EXPLAINED:
|
|
73
73
|
--serve [port]: Starts WebSocket SERVER at ws://127.0.0.1:[port]/ws. Allows other agents (--connect) to connect and use this agent as a remote TOOL (e.g., 'npm_module_inspector'). Runs indefinitely until Ctrl+C.
|
|
@@ -54,19 +54,19 @@ function printHelp() {
|
|
|
54
54
|
## USAGE MODES:
|
|
55
55
|
|
|
56
56
|
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
57
|
-
./
|
|
57
|
+
./agents/${name}.js "Optimize this prompt: [prompt]" [--options]
|
|
58
58
|
|
|
59
59
|
### 2. Interactive CLI (no positional arg):
|
|
60
|
-
./
|
|
60
|
+
./agents/${name}.js [--options]
|
|
61
61
|
|
|
62
62
|
### 3. WS Server (no positional arg):
|
|
63
|
-
./
|
|
63
|
+
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
64
64
|
|
|
65
65
|
### 4. WS Client (no positional arg):
|
|
66
|
-
./
|
|
66
|
+
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
67
67
|
|
|
68
68
|
### 5. Hybrid (Server + Client, no positional arg):
|
|
69
|
-
./
|
|
69
|
+
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
70
70
|
|
|
71
71
|
## SERVER OPTIONS EXPLAINED:
|
|
72
72
|
--serve [port]: Starts WebSocket SERVER at ws://127.0.0.1:[port]/ws. Allows other agents (--connect) to connect and use this agent as a remote TOOL (e.g., 'prompt_agent'). Runs indefinitely until Ctrl+C.
|