@j-o-r/hello-dave 0.0.3 → 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 +32 -0
- package/README.md +337 -68
- package/README.md.bak +523 -0
- package/README.md.bak.1774780058 +338 -0
- package/README.md.bak2 +531 -0
- package/bin/dave.js +33 -22
- package/bin/spawn_agent.js +293 -0
- package/docs.bak.1774780058/agent-manager.md +167 -0
- package/docs.bak.1774780058/agent-manager.md.bak +137 -0
- package/docs.bak.1774780058/agent-manager.md.bak2 +157 -0
- package/docs.bak.1774780058/codeserver-pattern.md +191 -0
- package/docs.bak.1774780058/path-resolution-best-practices.md +104 -0
- package/docs.bak.1774780058/project-overview.md +67 -0
- package/docs.bak.1774780058/project-overview.md.bak +67 -0
- package/docs.bak.1774780058/prompt-class.md +141 -0
- package/docs.bak.1774780058/prompt-class.md.bak +142 -0
- package/docs.bak.1774780058/tools-syntax-validation.md +121 -0
- package/docs.bak.1774780058/tools-syntax-validation.md.bak2 +125 -0
- package/docs.bak.1774780058/tools-syntax-validation.md.bak3 +125 -0
- package/docs.bak.1774780058/tools-syntax-validation.md.bak4 +106 -0
- package/docs.bak.1774780058/tools-syntax-validation.md.bak_path +106 -0
- package/docs.bak.1774780058/toolset.md +164 -0
- package/docs.bak.1774780058/toolset.md.bak +94 -0
- package/docs.bak.1774780058/toolset.md.bak3 +161 -0
- package/docs.bak.1774780058/toolset.md.bak4 +161 -0
- package/docs.bak.1774780058/toolset.md.bak5 +161 -0
- package/docs.bak.1774780058/toolset.md.bak6 +163 -0
- package/docs.bak.1774780058/toolset.md.bak_path +163 -0
- package/docs.bak.1774780058/toolset.md.bak_syntax +161 -0
- package/docs.bak.1774780058/xai-responses.md +111 -0
- package/docs.bak.1774780058/xai-responses.md.bak +107 -0
- package/docs.bak.1774780058/xai-responses.md.bak2 +107 -0
- package/docs.bak.1774780058/xai_collections.md +106 -0
- package/examples/ask_agent.js +137 -0
- package/examples/code_agent.js +149 -0
- package/examples/codeserver.sh +47 -0
- package/examples/daisy_agent.js +170 -0
- package/examples/docs_agent.js +148 -0
- package/examples/gpt_agent.js +122 -0
- package/examples/grok_agent.js +132 -0
- package/examples/memory_agent.js +152 -0
- package/examples/npm_agent.js +202 -0
- package/examples/prompt_agent.js +133 -0
- package/examples/readme_agent.js +148 -0
- package/examples/test_agent.js +187 -0
- package/examples/todo_agent.js +175 -0
- package/{examples/codeDave.js → examples.bak.1774780058/code_agent.js} +40 -6
- package/{examples/CodeServer → examples.bak.1774780058/codeserver.sh} +9 -5
- package/examples.bak.1774780058/memory_agent.js +112 -0
- package/{examples/spawndave.js → examples.bak.1774780058/spawn_agent.js} +29 -6
- package/examples.bak.1774780058/test_agent.js +162 -0
- package/{examples/todoDave.js → examples.bak.1774780058/todo_agent.js} +8 -2
- package/lib/API/x.ai/responses.js +7 -9
- package/lib/AgentManager.js +3 -2
- package/lib/AgentServer.js +23 -19
- package/lib/ToolSet.js +4 -1
- package/lib/genericToolset.js +159 -26
- package/lib/genericToolset.js.bak_syntax +402 -0
- package/lib/index.js +5 -1
- package/lib/wsCli.js +0 -1
- package/package.json +5 -6
- package/scenarios.bak.1774780058/data/eval_node_message.json +9 -0
- package/scenarios.bak.1774780058/data/hist_oa.json +66 -0
- package/scenarios.bak.1774780058/data/o3_response1.json +96 -0
- package/scenarios.bak.1774780058/data/oa_reasoning_parse.json +112 -0
- package/scenarios.bak.1774780058/data/tool_oa.json +96 -0
- package/scenarios.bak.1774780058/data/tool_xai.json +59 -0
- package/scenarios.bak.1774780058/data/tool_xai2.json +40 -0
- package/scenarios.bak.1774780058/data/xai-response-1.json +59 -0
- package/scenarios.bak.1774780058/data/xai-response-2.json +10 -0
- package/scenarios.bak.1774780058/data/xai_reasoning_tools_resp.json +59 -0
- package/scenarios.bak.1774780058/data/xai_search_response.json +58 -0
- package/scenarios.bak.1774780058/environment.js +10 -0
- package/scenarios.bak.1774780058/example.js +17 -0
- package/scenarios.bak.1774780058/genericToolset.test.js +182 -0
- package/scenarios.bak.1774780058/grok.js +113 -0
- package/scenarios.bak.1774780058/memory-tools.js +51 -0
- package/scenarios.bak.1774780058/openai-o3.js +137 -0
- package/scenarios.bak.1774780058/openai-prompt.js +155 -0
- package/scenarios.bak.1774780058/openai-session.js +148 -0
- package/scenarios.bak.1774780058/openai.js +102 -0
- package/scenarios.bak.1774780058/prompt.js +118 -0
- package/scenarios.bak.1774780058/promptFishbowl.js +76 -0
- package/scenarios.bak.1774780058/search.brave.com.js +25 -0
- package/scenarios.bak.1774780058/sh.js +15 -0
- package/scenarios.bak.1774780058/test-wsio.js +26 -0
- package/scenarios.bak.1774780058/testToolset.js +42 -0
- package/scenarios.bak.1774780058/toolset.js +16 -0
- package/scenarios.bak.1774780058/toolset.test.js +141 -0
- package/scenarios.bak.1774780058/write_file_syntax.test.js +145 -0
- package/scenarios.bak.1774780058/write_file_validation/README.md +30 -0
- package/scenarios.bak.1774780058/write_file_validation/bad.js +3 -0
- package/scenarios.bak.1774780058/write_file_validation/good.js +4 -0
- package/scenarios.bak.1774780058/write_file_validation/test.sh +43 -0
- package/scenarios.bak.1774780058/wsClient.js +69 -0
- package/scenarios.bak.1774780058/xai_responses.integration.test.js +57 -0
- package/scenarios.bak.1774780058/xai_responses.test.js +154 -0
- package/scenarios.bak.1774780058/xaicoll.js +50 -0
- package/scenarios.bak.1774780058/xaifiles.js +48 -0
- package/types/AgentManager.d.ts +4 -3
- package/types/index.d.ts +3 -1
- package/utils/syntax_check.sh +61 -0
- package/utils/test.sh +46 -0
- /package/{examples/askDave.js → examples.bak.1774780058/ask_agent.js} +0 -0
- /package/{examples/coderev.js → examples.bak.1774780058/coderev_agent.js} +0 -0
- /package/{examples/daisy.js → examples.bak.1774780058/daisy_agent.js} +0 -0
- /package/{examples/docsDave.js → examples.bak.1774780058/docs_agent.js} +0 -0
- /package/{examples/gpt.js → examples.bak.1774780058/gpt_agent.js} +0 -0
- /package/{examples/grok.js → examples.bak.1774780058/grok_agent.js} +0 -0
- /package/{examples/npmDave.js → examples.bak.1774780058/npm_agent.js} +0 -0
- /package/{examples/promptDave.js → examples.bak.1774780058/prompt_agent.js} +0 -0
- /package/{examples/readmeDave.js → examples.bak.1774780058/readme_agent.js} +0 -0
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
|
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
- [Installation](#installation)
|
|
14
14
|
- [Quick Start](#quick-start)
|
|
15
15
|
- [Usage](#usage)
|
|
16
|
+
- [Startup Modes](#startup-modes)
|
|
16
17
|
- [Examples](#examples)
|
|
17
18
|
- [Development](#development)
|
|
18
19
|
- [Changelog](#changelog)
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
|
|
27
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.
|
|
28
29
|
|
|
29
|
-
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.
|
|
30
31
|
|
|
31
32
|
## Features
|
|
32
33
|
|
|
@@ -37,8 +38,9 @@ Whether you're building a code reviewer, a research assistant, or a creative col
|
|
|
37
38
|
- **Direct CLI/Cron Messaging**: Simplified interactions without needing heartbeat mechanisms—ideal for scheduled tasks.
|
|
38
39
|
- **Customizable Prompts**: Tailor agent behavior with system prompts for specialized tasks (e.g., music production, code analysis).
|
|
39
40
|
- **Session Management**: Persistent conversations with large context windows; automatic truncation and history search.
|
|
40
|
-
- **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`.
|
|
41
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: auto`).
|
|
42
44
|
|
|
43
45
|
## Installation
|
|
44
46
|
|
|
@@ -48,7 +50,7 @@ Install as a dependency in your Node.js project (requires Node.js >= 20 with `"t
|
|
|
48
50
|
npm install @j-o-r/hello-dave
|
|
49
51
|
```
|
|
50
52
|
|
|
51
|
-
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`):
|
|
52
54
|
|
|
53
55
|
```bash
|
|
54
56
|
npm install -g @j-o-r/hello-dave
|
|
@@ -72,11 +74,11 @@ mkdir .cache
|
|
|
72
74
|
export XAIKEY=your_xai_api_key
|
|
73
75
|
```
|
|
74
76
|
|
|
75
|
-
2. Use the core CLI utility `bin/dave.js` for interactive queries or management:
|
|
77
|
+
2. Use the core CLI utility `bin/dave.js` (not a full agent) for interactive queries or management:
|
|
76
78
|
```bash
|
|
77
79
|
npx @j-o-r/hello-dave dave --ask
|
|
78
80
|
```
|
|
79
|
-
- Launches an interactive agent session. Use `Alt+d` to exit, `Alt+r` to reset.
|
|
81
|
+
- Launches an interactive agent session using default Grok tools. Use `Alt+d` to exit, `Alt+r` to reset.
|
|
80
82
|
- Example: Ask questions about anything; it uses xAI Grok by default with web search and X search tools.
|
|
81
83
|
|
|
82
84
|
3. For one-shot queries via piped input:
|
|
@@ -85,32 +87,32 @@ mkdir .cache
|
|
|
85
87
|
```
|
|
86
88
|
- Provides a direct response using the specified model (e.g., `--model grok-4`).
|
|
87
89
|
|
|
88
|
-
4. Connect to a WebSocket server (
|
|
90
|
+
4. Connect to a WebSocket server using the CLI utility (for UI access to servers):
|
|
89
91
|
```bash
|
|
90
92
|
npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret your_secret
|
|
91
93
|
```
|
|
92
94
|
|
|
93
|
-
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`):
|
|
94
96
|
```bash
|
|
95
|
-
npx @j-o-r/hello-dave
|
|
97
|
+
npx @j-o-r/hello-dave createAgent
|
|
96
98
|
```
|
|
97
99
|
- Interactive: Follow prompts to create a new agent script in `bin/` (e.g., `bin/myagent.js`).
|
|
98
|
-
- 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):
|
|
99
101
|
```bash
|
|
100
|
-
npx @j-o-r/hello-dave
|
|
102
|
+
npx @j-o-r/hello-dave createAgent --cwd ~/my-project
|
|
101
103
|
```
|
|
102
|
-
- Supports one-shot: `echo "Create code-review agent" | npx @j-o-r/hello-dave
|
|
103
|
-
- 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.
|
|
104
106
|
|
|
105
|
-
`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).
|
|
106
108
|
|
|
107
109
|
## Usage
|
|
108
110
|
|
|
109
|
-
### Core CLI via `bin/dave.js`
|
|
111
|
+
### Core CLI Utility via `bin/dave.js` (Not a Full Agent)
|
|
110
112
|
|
|
111
|
-
`bin/dave.js`
|
|
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:
|
|
112
114
|
|
|
113
|
-
- **Ask Mode** (Interactive or Piped One-Shot):
|
|
115
|
+
- **Ask Mode** (Interactive or Piped One-Shot, using default Grok agent):
|
|
114
116
|
```bash
|
|
115
117
|
# Interactive
|
|
116
118
|
npx @j-o-r/hello-dave dave --ask --model grok-4 --temperature 0.2
|
|
@@ -120,28 +122,29 @@ mkdir .cache
|
|
|
120
122
|
```
|
|
121
123
|
- Note: Piped input triggers a direct response via `directCall`; without pipe, it launches an interactive CLI session.
|
|
122
124
|
- `--model` option works for both modes (e.g., `grok-4`, `grok-4-1-fast-reasoning`).
|
|
123
|
-
- Uses `AgentManager` with xAI Grok API integration, adds tools like `web_search`, `x_search`, `open_link`, `send_email`, `history_search`.
|
|
125
|
+
- Uses default `AgentManager` with xAI Grok API integration, adds tools like `web_search`, `x_search`, `open_link`, `send_email`, `history_search`.
|
|
124
126
|
- System prompt emphasizes brief, direct responses with step-by-step reasoning.
|
|
125
127
|
|
|
126
|
-
- **SpawnDave Mode** (Portable Agent Creator with --cwd Support):
|
|
128
|
+
- **SpawnDave Mode** (Portable Agent Creator with --cwd Support; Convenience Alias for `createAgent`):
|
|
127
129
|
```bash
|
|
128
130
|
# Interactive in current project
|
|
129
|
-
npx @j-o-r/hello-dave
|
|
131
|
+
npx @j-o-r/hello-dave dave --spawn --model grok-4-fast-reasoning --temperature 0.7
|
|
130
132
|
|
|
131
133
|
# Portable to another project (switches cwd, auto-deps)
|
|
132
|
-
npx @j-o-r/hello-dave
|
|
134
|
+
npx @j-o-r/hello-dave dave --spawn --cwd ../other-proj
|
|
133
135
|
|
|
134
136
|
# One-shot for quick generation
|
|
135
|
-
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
|
|
136
138
|
```
|
|
137
139
|
- Creates production-ready CLI/WS agents (`bin/<name>.js`) supporting CLI, server (`--serve`), client (`--connect`), and hybrid modes.
|
|
138
140
|
- Generates multi-agent CodeServer launchers (`examples/<Name>Server`) using PM2 for persistent networked setups (main server + sub-agents).
|
|
139
141
|
- **Portable**: Runs via `npx` anywhere—no local install needed. Auto-inspects project, installs `@j-o-r/hello-dave @j-o-r/sh` if missing, validates ESM code (`node --check`), tests deployment.
|
|
140
142
|
- Aligns with CodeServer pattern: Self-contained Bash launchers for PM2-managed multi-agents (e.g., code review + TODO + NPM agents).
|
|
141
143
|
- Requires `XAIKEY`; uses online repo docs (https://codeberg.org/duin/hello-dave) for portability.
|
|
142
|
-
- Example output: Deploys `bin/
|
|
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.
|
|
143
146
|
|
|
144
|
-
- **WebSocket Client Mode** (with secrets for secure networking):
|
|
147
|
+
- **WebSocket Client Mode** (Utility UI for connecting to servers, with secrets for secure networking):
|
|
145
148
|
```bash
|
|
146
149
|
# Interactive connection
|
|
147
150
|
npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret "mysecret"
|
|
@@ -151,16 +154,88 @@ mkdir .cache
|
|
|
151
154
|
echo "user_reset" | npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret "mysecret"
|
|
152
155
|
```
|
|
153
156
|
|
|
154
|
-
- **
|
|
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
|
+
|
|
174
|
+
- **Cache Management** (Session maintenance in .cache):
|
|
155
175
|
```bash
|
|
156
176
|
npx @j-o-r/hello-dave dave --list # List sessions
|
|
157
177
|
npx @j-o-r/hello-dave dave --search "AI agents" # Search history
|
|
158
178
|
npx @j-o-r/hello-dave dave --clear # Clear cache
|
|
179
|
+
npx @j-o-r/hello-dave dave --inspect path/to/log.ndjson # Inspect log
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
For custom full agents (with prompts/tools/server support), use `AgentManager` programmatically (see Examples) or scripts like `examples/npm_agent.js`.
|
|
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
|
|
159
204
|
```
|
|
205
|
+
- Follows conversational prompts: name (lowercase /^[a-z_0-9_]{2,}$/), description, tools, prompt, etc. Generates, deploys, and tests the agent.
|
|
160
206
|
|
|
161
|
-
|
|
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).
|
|
162
233
|
|
|
163
|
-
|
|
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
|
+
|
|
238
|
+
### Programmatic Usage with AgentManager (For Full Agents)
|
|
164
239
|
|
|
165
240
|
```javascript
|
|
166
241
|
import AgentManager from '@j-o-r/hello-dave';
|
|
@@ -177,6 +252,8 @@ agent.setup({
|
|
|
177
252
|
agent.addGenericToolcall('execute_bash_script'); // Post-setup generics
|
|
178
253
|
agent.addGenericToolcall('read_file');
|
|
179
254
|
agent.addGenericToolcall('write_file');
|
|
255
|
+
agent.addGenericToolcall('memory_recall'); // Persist/recall tasks, errors, prefs in .cache/memory.ndjson
|
|
256
|
+
agent.addGenericToolcall('memory_write'); // Optimizes loops and long-running sessions
|
|
180
257
|
|
|
181
258
|
await agent.start(); // Interactive CLI
|
|
182
259
|
// Or: await agent.start(undefined, 8000, undefined, 'Intro', 'toolName', 'desc'); // WS server
|
|
@@ -185,42 +262,200 @@ await agent.start(); // Interactive CLI
|
|
|
185
262
|
|
|
186
263
|
Direct CLI/cron: Pipe inputs to custom scripts for non-interactive use. WS supports secrets for authentication; no heartbeat required due to event-driven messaging.
|
|
187
264
|
|
|
265
|
+
The `memory_recall` and `memory_write` tools, available when `toolsetMode: 'auto'`, enable agents to persist and recall tasks, errors, and preferences in `.cache/memory.ndjson`. This optimizes iterative loops and long-running sessions by maintaining state across interactions without relying solely on session history.
|
|
266
|
+
|
|
267
|
+
## Startup Modes
|
|
268
|
+
|
|
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).
|
|
270
|
+
|
|
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).
|
|
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
|
+
|
|
277
|
+
### AgentManager.start() Options Explained
|
|
278
|
+
The `start()` method is the smart launcher for all modes. It accepts up to 5 arguments in order:
|
|
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.
|
|
280
|
+
- `connect` (string | undefined): WS URL for **client** mode (e.g., `ws://127.0.0.1:8080/ws`). Connects to a remote server to gain access to its tools. Launches interactive CLI after connection.
|
|
281
|
+
- `cliIntro` (string | undefined): Custom welcome message for interactive CLI mode (e.g., "NPM Agent ready. Ask about modules.").
|
|
282
|
+
- `tool_call_name` (string | undefined): **Required for server mode**. The tool name this agent exposes (must match naming regex `/^[a-z_0-9_]{2,}$/`). E.g., `npm_module_inspector`. Used when clients attach.
|
|
283
|
+
- `tool_call_description` (string | undefined): **Required for server mode**. Detailed description of the exposed tool (e.g., "Inspects NPM modules in node_modules/ using bash and cache.").
|
|
284
|
+
|
|
285
|
+
**Mode Determination**:
|
|
286
|
+
- If `serve` provided: Starts WS server (exposes tools).
|
|
287
|
+
- If `connect` provided: Starts WS client (attaches to remote, gains tools).
|
|
288
|
+
- If both: Hybrid mode (serves locally while using remote tools).
|
|
289
|
+
- If neither: Interactive CLI mode.
|
|
290
|
+
- For one-shot (non-start): Use `directCall(input)` directly (positional arg in scripts).
|
|
291
|
+
|
|
292
|
+
**Shared Notes**:
|
|
293
|
+
- `--secret [string]` (min 3 chars): Shared auth token. Servers reject mismatched clients; use the same for chains/networks.
|
|
294
|
+
- Other options: `--model [grok-4-fast-reasoning|...]`, `--temperature [-2 to +2]`, `--tokens`, `--top_p`, `--context [250000]`.
|
|
295
|
+
- Positional args ignored in WS modes (use CLI/pipes instead).
|
|
296
|
+
- No heartbeat: Event-driven responses.
|
|
297
|
+
- For multi-agent chaining, see [CodeServer pattern](docs/codeserver-pattern.md).
|
|
298
|
+
|
|
299
|
+
### 1. Direct Call (One-Shot, Positional Arg Only)
|
|
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.)
|
|
301
|
+
|
|
302
|
+
**CLI Example (Full Agent, e.g., npm_agent.js or createAgent)**:
|
|
303
|
+
```bash
|
|
304
|
+
npx @j-o-r/hello-dave createAgent "What modules are installed?" [--model grok-4]
|
|
305
|
+
./examples/npm_agent.js "What modules are installed?" [--model grok-4]
|
|
306
|
+
```
|
|
307
|
+
- Input: Positional string (trimmed). If empty/missing, falls to interactive CLI or help.
|
|
308
|
+
|
|
309
|
+
**Programmatic (AgentManager)**:
|
|
310
|
+
```javascript
|
|
311
|
+
import { AgentManager } from '@j-o-r/hello-dave' ;
|
|
312
|
+
const agent = new AgentManager({ name: 'npm_agent' });
|
|
313
|
+
await agent.setup({ /* prompt, api, options, toolsetMode, contextWindow */ });
|
|
314
|
+
const response = await agent.directCall('What modules are installed?' );
|
|
315
|
+
console.log(response);
|
|
316
|
+
```
|
|
317
|
+
- Pair with `readIn()` from `@j-o-r/sh` for piped stdin detection in scripts (e.g., `echo "query" | script.js`).
|
|
318
|
+
|
|
319
|
+
**Utility (dave.js for Default Queries)**:
|
|
320
|
+
```bash
|
|
321
|
+
echo "Explain quantum computing" | npx @j-o-r/hello-dave dave --ask [--model grok-4]
|
|
322
|
+
```
|
|
323
|
+
- Triggers `directCall` on piped input.
|
|
324
|
+
|
|
325
|
+
### 2. Interactive CLI (No Positional Arg)
|
|
326
|
+
Launches ongoing conversation session with REPL-like input (multi-turn, until Ctrl+C or `Alt+d`).
|
|
327
|
+
|
|
328
|
+
**CLI Example (Full Agent)**:
|
|
329
|
+
```bash
|
|
330
|
+
npx @j-o-r/hello-dave createAgent [--model grok-4]
|
|
331
|
+
./examples/npm_agent.js [--model grok-4]
|
|
332
|
+
```
|
|
333
|
+
- No positional: Starts `agent.start()` with CLI intro.
|
|
334
|
+
|
|
335
|
+
**Programmatic**:
|
|
336
|
+
```javascript
|
|
337
|
+
await agent.start(undefined, undefined, 'NPM Agent ready. Ask about modules or tools.' ); // Interactive CLI with custom intro
|
|
338
|
+
```
|
|
339
|
+
- Uses `cliIntro` for welcome message. Supports history, reset (`Alt+r`).
|
|
340
|
+
|
|
341
|
+
**Utility (dave.js)**:
|
|
342
|
+
```bash
|
|
343
|
+
npx @j-o-r/hello-dave dave --ask
|
|
344
|
+
```
|
|
345
|
+
- Default agent; no custom tools/prompts.
|
|
346
|
+
|
|
347
|
+
### 3. WS Server (--serve [port])
|
|
348
|
+
Starts a WebSocket server at `ws://127.0.0.1:[port]/ws` to expose the agent as a remote tool for clients. Runs indefinitely. (Not supported in `dave` utility.)
|
|
349
|
+
|
|
350
|
+
**CLI Example (Full Agent)**:
|
|
351
|
+
```bash
|
|
352
|
+
npx @j-o-r/hello-dave createAgent --serve 8080 [--secret mysecret] [--model grok-4]
|
|
353
|
+
./examples/npm_agent.js --serve 8080 [--secret mysecret] [--model grok-4]
|
|
354
|
+
```
|
|
355
|
+
- Exposes `tool_call_name` (e.g., `npm_module_inspector` or `spawn_agent` for createAgent) for remote calls.
|
|
356
|
+
|
|
357
|
+
**Programmatic**:
|
|
358
|
+
```javascript
|
|
359
|
+
await agent.start(8080, undefined, undefined, 'npm_module_inspector' , 'NPM modules expert using bash and cache in node_modules/.' ); // Server on 8080; secret optional but recommended
|
|
360
|
+
```
|
|
361
|
+
- `tool_call_name` and `tool_call_description` required for exposure. See [AgentManager docs](docs/agent-manager.md) for full server config, including reset propagation.
|
|
362
|
+
|
|
363
|
+
**Client Usage** (Connect to this server):
|
|
364
|
+
```bash
|
|
365
|
+
# Interactive
|
|
366
|
+
npx @j-o-r/hello-dave dave --connect ws://127.0.0.1:8080 --secret mysecret
|
|
367
|
+
# Or full agent: ./examples/other_agent.js --connect ws://127.0.0.1:8080 --secret mysecret
|
|
368
|
+
```
|
|
369
|
+
- Clients gain the servers tools (e.g., call `npm_module_inspector` in their prompts).
|
|
370
|
+
|
|
371
|
+
### 4. WS Client (--connect [ws_url])
|
|
372
|
+
Connects to a remote WS server as a client, gaining access to its tools, then launches interactive CLI.
|
|
373
|
+
|
|
374
|
+
**CLI Example (Full Agent)**:
|
|
375
|
+
```bash
|
|
376
|
+
npx @j-o-r/hello-dave createAgent --connect ws://127.0.0.1:8080/ws --secret mysecret [--model grok-4]
|
|
377
|
+
./examples/npm_agent.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--model grok-4]
|
|
378
|
+
```
|
|
379
|
+
- Attaches to server; uses remote tools in local sessions.
|
|
380
|
+
|
|
381
|
+
**Programmatic**:
|
|
382
|
+
```javascript
|
|
383
|
+
await agent.start(undefined, 'ws://127.0.0.1:8080/ws' , undefined, undefined, undefined ); // Client mode; secret required if server uses one
|
|
384
|
+
```
|
|
385
|
+
- After connection, interactive CLI starts. For one-shot: Pipe to script (uses `directCall` with remote tools).
|
|
386
|
+
|
|
387
|
+
**Utility (dave.js)**:
|
|
388
|
+
```bash
|
|
389
|
+
# Interactive
|
|
390
|
+
npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret "mysecret"
|
|
391
|
+
# Piped one-shot (cron-friendly)
|
|
392
|
+
echo "Use remote NPM tool to list modules" | npx @j-o-r/hello-dave dave --connect ws://localhost:8080 --secret "mysecret"
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### 5. Hybrid (--serve [port] + --connect [ws_url])
|
|
396
|
+
Serves tools locally (on local port) while connecting as a client to a remote server (gains remote tools). No positional arg; launches interactive CLI. Ideal for agent chains/networks. (Not supported in `dave` utility.)
|
|
397
|
+
|
|
398
|
+
**CLI Example (Full Agent)**:
|
|
399
|
+
```bash
|
|
400
|
+
npx @j-o-r/hello-dave createAgent --serve 8081 --connect ws://otherhost:8080/ws [--secret mysecret]
|
|
401
|
+
./examples/npm_agent.js --serve 8081 --connect ws://otherhost:8080/ws [--secret mysecret]
|
|
402
|
+
```
|
|
403
|
+
- Local server on 8081 (exposes local tools); client to remote (uses remote tools).
|
|
404
|
+
|
|
405
|
+
**Programmatic**:
|
|
406
|
+
```javascript
|
|
407
|
+
await agent.start(8081, 'ws://otherhost:8080/ws' , 'Hybrid NPM Agent ready.' , 'npm_module_inspector' , 'Hybrid NPM inspector with remote access.' ); // Hybrid; secret for both if needed
|
|
408
|
+
```
|
|
409
|
+
- Custom handling for secrets (use same or per-mode). See [AgentManager docs](docs/agent-manager.md) for hybrid details and error handling.
|
|
410
|
+
|
|
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.
|
|
412
|
+
|
|
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/).
|
|
414
|
+
|
|
188
415
|
## Examples
|
|
189
416
|
|
|
190
|
-
Example scripts (e.g., `
|
|
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).
|
|
418
|
+
|
|
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).
|
|
191
420
|
|
|
192
|
-
|
|
421
|
+
In custom agents, consider adding `memory_recall` and `memory_write` tools to enable state persistence for complex workflows, such as tracking progress in multi-step tasks or storing user preferences across sessions.
|
|
193
422
|
|
|
194
423
|
### Persistent Multi-Agent CodeServer Pattern
|
|
195
424
|
|
|
196
|
-
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.
|
|
197
426
|
|
|
198
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).
|
|
199
428
|
|
|
200
|
-
**Usage:**
|
|
429
|
+
**Usage (Prefer Shell Portability):**
|
|
201
430
|
|
|
202
431
|
```bash
|
|
203
|
-
#
|
|
204
|
-
./examples/
|
|
432
|
+
# Direct shell launch (portable, no Node.js wrapper needed; requires PM2: npm i -g pm2)
|
|
433
|
+
./examples/codeserver.sh 8080 mysecret
|
|
205
434
|
|
|
206
|
-
#
|
|
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
|
|
438
|
+
```
|
|
439
|
+
|
|
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
|
|
207
444
|
npx @j-o-r/hello-dave dave --connect ws://127.0.0.1:8080/ws --secret mysecret
|
|
208
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
|
|
209
446
|
```
|
|
210
447
|
|
|
211
|
-
|
|
448
|
+
### Snippet: Spawning Agents (Portable via `createAgent` or `dave --spawn`)
|
|
212
449
|
|
|
213
|
-
|
|
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.
|
|
214
451
|
|
|
215
|
-
|
|
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).
|
|
216
453
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
**Portable**: `spawndave` is fully portable—no local docs/examples needed. Uses online repo links (https://codeberg.org/duin/hello-dave). Works in any project via `npx` (auto-deps with `--cwd`).
|
|
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.
|
|
220
455
|
|
|
221
456
|
```javascript
|
|
222
|
-
// Core setup in
|
|
223
|
-
const agent = new AgentManager({ name: '
|
|
457
|
+
// Core setup in createAgent (examples/spawn_agent.js)
|
|
458
|
+
const agent = new AgentManager({ name: 'spawn_agent', secret });
|
|
224
459
|
agent.setup({
|
|
225
460
|
prompt: 'You are AgentCreator... [detailed prompt for portability, validation]',
|
|
226
461
|
api: 'xai',
|
|
@@ -231,6 +466,8 @@ agent.setup({
|
|
|
231
466
|
agent.addGenericToolcall('execute_bash_script'); // For project inspection
|
|
232
467
|
agent.addGenericToolcall('read_file');
|
|
233
468
|
agent.addGenericToolcall('write_file'); // For generating bin/ scripts
|
|
469
|
+
agent.addGenericToolcall('memory_recall'); // For recalling previous generations or prefs
|
|
470
|
+
agent.addGenericToolcall('memory_write'); // For persisting agent configs or errors
|
|
234
471
|
|
|
235
472
|
await agent.start(); // Guides user to create e.g., bin/myagent.js
|
|
236
473
|
```
|
|
@@ -238,19 +475,27 @@ await agent.start(); // Guides user to create e.g., bin/myagent.js
|
|
|
238
475
|
- Validates generated ESM code with `node --check` and tool rules (xAI natives pre-setup, generics post-setup).
|
|
239
476
|
- Ensures absolute imports for portability.
|
|
240
477
|
|
|
241
|
-
**Example Usage
|
|
478
|
+
**Example Usage (Portable Agent Generation & CodeServer)**:
|
|
242
479
|
|
|
243
480
|
```bash
|
|
244
481
|
# Interactive spawning (runs from npm without cloning; current dir)
|
|
245
|
-
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
|
|
246
484
|
|
|
247
485
|
# Portable to specific project (auto-switches cwd, installs deps if needed)
|
|
248
|
-
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
|
|
249
490
|
|
|
250
|
-
#
|
|
251
|
-
|
|
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
|
|
252
494
|
```
|
|
253
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
|
+
|
|
254
499
|
### Snippet: Using xAI Grok API Integration
|
|
255
500
|
|
|
256
501
|
The unified xAI Grok API access supports options like reasoning and tools:
|
|
@@ -270,38 +515,61 @@ Detailed examples for xAI integration (e.g., advanced tool calls, reasoning) are
|
|
|
270
515
|
### Running Examples
|
|
271
516
|
|
|
272
517
|
```bash
|
|
273
|
-
# Music agent (examples/
|
|
274
|
-
chmod +x examples/
|
|
275
|
-
./examples/
|
|
518
|
+
# Music agent (examples/daisy_agent.js - full agent)
|
|
519
|
+
chmod +x examples/daisy_agent.js
|
|
520
|
+
./examples/daisy_agent.js "Generate lyrics for a pop song"
|
|
276
521
|
|
|
277
|
-
# TODO manager (examples/
|
|
278
|
-
./examples/
|
|
522
|
+
# TODO manager (examples/todo_agent.js - full agent)
|
|
523
|
+
./examples/todo_agent.js --connect ws://localhost:8080 --secret "secret"
|
|
279
524
|
|
|
280
|
-
# Server setup for networked examples
|
|
281
|
-
|
|
525
|
+
# Server setup for networked examples (use full agents, not dave utility)
|
|
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"
|
|
282
530
|
```
|
|
283
531
|
|
|
284
532
|
## Development
|
|
285
533
|
|
|
286
|
-
- **Scripts**: `npm test` (runs scenarios/
|
|
534
|
+
- **Scripts**: `npm test` (runs scenarios/grok_agent.js), `npm run types` (generate TypeScript defs), `npm run release` (pack for release).
|
|
287
535
|
- **Structure**: Core in `lib/` (AgentManager.js, wsCli.js, etc.), API integrations in `lib/API/`, examples in `examples/`, utils in `utils/`.
|
|
288
536
|
- **Testing**: Basic validation via `npm test`. Unit tests for xAI integration planned (see TODO).
|
|
289
|
-
- **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.
|
|
290
538
|
|
|
291
539
|
## Changelog
|
|
292
540
|
|
|
293
|
-
### 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)
|
|
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.
|
|
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.
|
|
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.
|
|
555
|
+
- **Memory Protocol Enhancements**: Updated prompts (e.g., spawn_agent.js, test_agent.js) to mandate memory_recall/write FIRST/LAST for tasks/errors/prefs/decisions, reducing token burn and enabling human handoff. Integrated into workflows for iterative testing and agent generation.
|
|
556
|
+
- **File Renames and Cleanup**: Renamed all examples/ files to *_agent.js (e.g., codedave.js → code_agent.js); updated references in README.md, docs/, TODO.md, package.json. Removed all old "Dave/dave" references (grep -r confirmed zero remnants).
|
|
557
|
+
- **NPM Agent Improvements**: Enhanced prompt with Dependency Strategy (prefer installed modules/native JS/Bash, suggest new deps only as last resort). Added full npm ls -a scanning for subdeps; strict no-installs policy. Vague query handling improved (e.g., auto-cache for tests).
|
|
558
|
+
- **Startup Modes Documentation**: Finalized "## Startup Modes" section in README.md with 5 unified modes (Direct Call, CLI, Server, Client, Hybrid), AgentManager.start() explanations, CLI/programmatic examples, and links to docs/agent-manager.md. Aligned with all agent help outputs.
|
|
559
|
+
- **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.
|
|
560
|
+
- **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.
|
|
561
|
+
- **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.
|
|
562
|
+
- **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.
|
|
563
|
+
|
|
564
|
+
### v0.0.3 (Previous - March 2026)
|
|
565
|
+
- Initial WS secrets, generic tools, AgentManager refinements.
|
|
294
566
|
- Reorganized examples to `examples/` folder (readmeDave, todoDave, etc.).
|
|
295
567
|
- Enhanced `bin/dave.js` for core utilities: spawning, WS with secrets, direct messaging.
|
|
296
568
|
- Improved xAI Grok API integration; added native tools/reasoning support.
|
|
297
569
|
- Removed heartbeat needs; direct CLI/cron support.
|
|
298
570
|
- Added piped one-shot support to dave --ask.
|
|
299
|
-
- TODO alignment: High-priority items noted (release prep, spawnDave enhancements).
|
|
300
571
|
|
|
301
|
-
|
|
302
|
-
- Initial WS secrets, generic tools, AgentManager refinements.
|
|
303
|
-
|
|
304
|
-
Full history in git tags.
|
|
572
|
+
Full history in git tags (recent: cleanup toolset test, TODO status update, fixed test/README, syntax fixes, startup modes explanation).
|
|
305
573
|
|
|
306
574
|
## Contributing
|
|
307
575
|
|
|
@@ -322,11 +590,12 @@ Apache License 2.0. See [LICENSE](LICENSE) for details.
|
|
|
322
590
|
## TODO Alignment
|
|
323
591
|
|
|
324
592
|
This README aligns with high-priority items from [TODO.md](TODO.md):
|
|
325
|
-
- **v0.0.
|
|
326
|
-
- **
|
|
327
|
-
-
|
|
328
|
-
-
|
|
329
|
-
-
|
|
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).
|
|
598
|
+
- Documentation tasks (e.g., AgentManager internals, WS refinements) completed in Usage/Examples/Changelog.
|
|
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.
|
|
330
600
|
|
|
331
601
|
For full TODO, see [TODO.md](TODO.md).
|
|
332
|
-
|