@j-o-r/hello-dave 0.1.1 → 0.1.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 +42 -25
- package/README.md +81 -221
- package/TODO.md +173 -35
- package/agents/agent_creator.js +105 -0
- package/agents/agent_creator.prompt.md +371 -0
- package/agents/ask_agent.js +64 -127
- package/agents/claude_agent.js +68 -0
- package/agents/code_agent.js +55 -135
- package/agents/code_agent.prompt.md +50 -0
- package/agents/echo_agent.js +76 -0
- package/agents/financial_expert.js +75 -0
- package/agents/gpt_agent.js +52 -103
- package/agents/gpt_code.js +81 -0
- package/agents/grok_agent.js +58 -114
- package/agents/minimax_agent.js +92 -0
- package/agents/mureka_agent.js +77 -0
- package/agents/planner_agent.js +172 -0
- package/agents/stability_agent.js +87 -0
- package/agents/test_agent.js +75 -157
- package/agents/weather_agent.js +73 -0
- package/agents/workflow_agent.js +189 -0
- package/bin/dave.js +436 -184
- package/docs/bin-dave.md +85 -35
- package/docs/cdn-ssh.md +100 -0
- package/docs/creating-agents.md +301 -0
- package/docs/creating-toolsets.md +336 -0
- package/docs/docs-organization.md +48 -0
- package/docs/project-overview.md +86 -51
- package/lib/API/elevenlabs.io/music.compose.md +441 -0
- package/lib/API/elevenlabs.io/music.create-composition-plan.md +370 -0
- package/lib/API/elevenlabs.io/music.stream.md +425 -0
- package/lib/API/lalal.ai/lalal.js +445 -0
- package/lib/API/lalal.ai/openapi.json +2614 -0
- package/lib/API/minimax/ImageToolset.js +82 -37
- package/lib/API/minimax/MusicToolset.js +125 -79
- package/lib/API/minimax/VideoToolset.js +170 -167
- package/lib/API/minimax/image.js +5 -1
- package/lib/API/minimax/music.js +210 -23
- package/lib/API/minimax/video.js +242 -53
- package/lib/API/mureka/MusicToolset.js +646 -0
- package/lib/API/mureka/README.md +41 -0
- package/lib/API/mureka/index.js +7 -0
- package/lib/API/mureka/music.js +658 -0
- package/lib/API/openai.com/index.js +7 -0
- package/lib/API/openai.com/{reponses/text.js → responses.js} +64 -18
- package/lib/API/openai.com/video.create.character.md +40 -0
- package/lib/API/openai.com/video.create.md +219 -0
- package/lib/API/openai.com/video.delete.md +44 -0
- package/lib/API/openai.com/video.download.md +31 -0
- package/lib/API/openai.com/video.edit.md +155 -0
- package/lib/API/openai.com/video.extend.md +166 -0
- package/lib/API/openai.com/video.fetch.character.md +43 -0
- package/lib/API/openai.com/video.js +784 -0
- package/lib/API/openai.com/video.list.md +201 -0
- package/lib/API/openai.com/video.remix.md +175 -0
- package/lib/API/openai.com/video.retrieve.md +139 -0
- package/lib/API/openai.com/videoToolset.js +616 -0
- package/lib/API/stability.ai/ImageToolset.js +131 -40
- package/lib/API/stability.ai/MusicToolset.js +79 -47
- package/lib/API/stability.ai/audio.js +63 -131
- package/lib/API/x.ai/chat.responses.md +1040 -0
- package/lib/API/x.ai/image.js +229 -59
- package/lib/API/x.ai/imageToolset.js +376 -0
- package/lib/API/x.ai/index.js +1 -1
- package/lib/API/x.ai/responses.js +9 -18
- package/lib/Agent.js +271 -0
- package/lib/Agent.js.old +284 -0
- package/lib/AgentLauncher.js +593 -0
- package/lib/Cli.js +87 -13
- package/lib/Prompt.js +23 -1
- package/lib/Session.js +5 -4
- package/lib/ToolSet.js +102 -6
- package/lib/agentLoader.js +369 -0
- package/lib/cdn.js +67 -231
- package/lib/{CdnToolset.js → cdnToolset.js} +47 -64
- package/lib/defaultToolsets.js +43 -0
- package/lib/fafs.js +1 -1
- package/lib/genericToolset.js +442 -119
- package/lib/handOffToolset.js +179 -0
- package/lib/index.js +34 -27
- package/lib/toolsetLoader.js +248 -0
- package/package.json +10 -4
- package/types/API/lalal.ai/lalal.d.ts +116 -0
- package/types/API/minimax/image.d.ts +2 -1
- package/types/API/minimax/music.d.ts +189 -26
- package/types/API/minimax/video.d.ts +100 -31
- package/types/API/mureka/index.d.ts +7 -0
- package/types/API/mureka/music.d.ts +472 -0
- package/types/API/openai.com/index.d.ts +7 -0
- package/types/API/openai.com/{reponses/text.d.ts → responses.d.ts} +11 -11
- package/types/API/openai.com/video.d.ts +409 -0
- package/types/API/openai.com/videoToolset.d.ts +24 -0
- package/types/API/stability.ai/audio.d.ts +14 -103
- package/types/API/stability.ai/image.d.ts +2 -2
- package/types/API/x.ai/image.d.ts +138 -26
- package/types/API/x.ai/imageToolset.d.ts +3 -0
- package/types/API/x.ai/index.d.ts +1 -1
- package/types/API/x.ai/responses.d.ts +4 -4
- package/types/Agent.d.ts +123 -0
- package/types/AgentLauncher.d.ts +250 -0
- package/types/Cli.d.ts +28 -8
- package/types/Prompt.d.ts +23 -5
- package/types/Session.d.ts +1 -1
- package/types/ToolSet.d.ts +10 -0
- package/types/agentLoader.d.ts +78 -0
- package/types/cdn.d.ts +15 -90
- package/types/defaultToolsets.d.ts +9 -0
- package/types/fafs.d.ts +1 -1
- package/types/genericToolset.d.ts +1 -1
- package/types/handOffToolset.d.ts +28 -0
- package/types/index.d.ts +19 -17
- package/types/toolsetLoader.d.ts +114 -0
- package/utils/format_log.js +101 -23
- package/utils/launch_agent.js +18 -0
- package/utils/list_sessions.sh +13 -5
- package/utils/search_sessions.sh +65 -29
- package/utils/toolsets.js +33 -0
- package/README.md.bak.1779452127 +0 -240
- package/agents/codeserver.sh +0 -47
- package/agents/daisy_agent.js +0 -173
- package/agents/docs_agent.js +0 -148
- package/agents/memory_agent.js +0 -263
- package/agents/minimax.js +0 -173
- package/agents/npm_agent.js +0 -202
- package/agents/prompt_agent.js +0 -133
- package/agents/readme_agent.js +0 -148
- package/agents/spawn_agent.js +0 -160
- package/agents/stability.js +0 -173
- package/agents/todo_agent.js +0 -175
- package/bin/codeDave +0 -58
- package/docs/agent-dave-websocket-protocol.md +0 -180
- package/docs/agent-manager.md +0 -244
- package/docs/codeserver-pattern.md +0 -191
- package/docs/generic-toolset.md +0 -326
- package/docs/howtos/agent-networking.md +0 -253
- package/docs/howtos/spawn-agents.md.bak +0 -200
- package/docs/howtos/spawn-agents.md.bak_new +0 -200
- package/docs/multi-agent-clusters.md +0 -265
- package/docs/music-toolsets.md +0 -137
- package/docs/path-resolution-best-practices.md +0 -104
- package/docs/plans/minimax-music-generation.md +0 -80
- package/docs/plans/unified-agent-architecture.md +0 -146
- package/docs/plans/websocket-streaming-plan.md.bak +0 -317
- package/docs/prompt/spawn_agent.md +0 -175
- package/docs/prompt/spawn_agent.md.bak +0 -201
- package/docs/prompt/task_clarification_and_documentation.md +0 -35
- package/docs/prompt-class.md +0 -141
- package/docs/todo-archive-infra-2026-04-21.md +0 -15
- package/docs/todo-archive-v0.0.8.md +0 -1
- package/docs/todo-archive-v0.1.0.md +0 -32
- package/docs/todo-archive.md +0 -44
- package/docs/tools-syntax-validation.md +0 -121
- package/docs/toolset.md +0 -164
- package/docs/xai-responses.md +0 -111
- package/docs/xai_collections.md +0 -106
- package/lib/API/x.ai/ImageToolset.js +0 -165
- package/lib/API/x.ai/text.js +0 -415
- package/lib/AgentClient.js +0 -248
- package/lib/AgentManager.js +0 -245
- package/lib/AgentServer.js +0 -404
- package/lib/wsCli.js +0 -287
- package/lib/wsIO.js +0 -90
- package/types/API/x.ai/text.d.ts +0 -286
- package/types/AgentClient.d.ts +0 -109
- package/types/AgentManager.d.ts +0 -100
- package/types/AgentServer.d.ts +0 -89
- package/types/wsCli.d.ts +0 -17
- package/types/wsIO.d.ts +0 -30
- package/utils/test.sh +0 -46
- /package/docs/{suggestions.md → _notes/token-counts.md} +0 -0
- /package/lib/API/openai.com/{reponses/MESSAGES.md → MESSAGES.md} +0 -0
- /package/types/API/{x.ai/ImageToolset.d.ts → mureka/MusicToolset.d.ts} +0 -0
- /package/types/{CdnToolset.d.ts → cdnToolset.d.ts} +0 -0
package/agents/spawn_agent.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { AgentManager } from '@j-o-r/hello-dave';
|
|
3
|
-
import { parseArgs } from '@j-o-r/sh';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import { createRequire } from 'module';
|
|
7
|
-
|
|
8
|
-
const name = 'spawn_agent';
|
|
9
|
-
const api = 'xai';
|
|
10
|
-
let secret = '';
|
|
11
|
-
|
|
12
|
-
const args = parseArgs();
|
|
13
|
-
|
|
14
|
-
let input;
|
|
15
|
-
if (args._.length === 1 && typeof args._[0] === 'string' && args._[0].trim() !== '') {
|
|
16
|
-
input = args._[0].trim();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const help = args['help'] || false;
|
|
20
|
-
const connect = args['connect'] ? args['connect'] : undefined;
|
|
21
|
-
const serve = args['serve'] ? parseInt(args['serve']) : undefined;
|
|
22
|
-
|
|
23
|
-
const options = { tools: [] };
|
|
24
|
-
options.tools.push({ type: 'web_search' });
|
|
25
|
-
|
|
26
|
-
if (args['secret']) {
|
|
27
|
-
secret = args['secret'];
|
|
28
|
-
}
|
|
29
|
-
if (args['model'] || true) {
|
|
30
|
-
options.model = args['model'] || 'grok-4-fast-reasoning';
|
|
31
|
-
}
|
|
32
|
-
if (args['temperature']) {
|
|
33
|
-
options.temperature = parseFloat(args['temperature']);
|
|
34
|
-
}
|
|
35
|
-
if (args['tokens']) {
|
|
36
|
-
options.max_output_tokens = parseInt(args['tokens']);
|
|
37
|
-
}
|
|
38
|
-
if (args['top_p']) {
|
|
39
|
-
options.top_p = parseFloat(args['top_p']);
|
|
40
|
-
}
|
|
41
|
-
if (true) {
|
|
42
|
-
options.reasoning = { effort: 'medium', summary: 'auto' };
|
|
43
|
-
}
|
|
44
|
-
const toolsetMode = 'auto';
|
|
45
|
-
const contextWindow = args['context'] ? parseInt(args['context']) : 250000;
|
|
46
|
-
|
|
47
|
-
function printHelp() {
|
|
48
|
-
console.log(`'${name} --help' You are looking at it.
|
|
49
|
-
|
|
50
|
-
## USAGE MODES:
|
|
51
|
-
|
|
52
|
-
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
53
|
-
./${name}.js "Create a code agent" [--options]
|
|
54
|
-
|
|
55
|
-
### 2. Interactive CLI (no positional arg):
|
|
56
|
-
./${name}.js [--options]
|
|
57
|
-
|
|
58
|
-
### 3. WS Server (no positional arg):
|
|
59
|
-
./${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
60
|
-
|
|
61
|
-
### 4. WS Client (no positional arg):
|
|
62
|
-
./${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
63
|
-
|
|
64
|
-
### 5. Hybrid (Server + Client, no positional arg):
|
|
65
|
-
./${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
66
|
-
|
|
67
|
-
## PORTABILITY NOTES:
|
|
68
|
-
- **Tools follow YOUR CWD** (e.g., cd /tmp/proj && ./spawn_agent.js → tools in /tmp/proj).
|
|
69
|
-
- **Hybrid Modes**: PROJECT (agents/*.js exist): Auto-deploy/test. FRESH (empty agents/): Code + manual bash.
|
|
70
|
-
- **Custom Tools**: natives=web_search, generics=read_file, custom={type:'git_diff',...}
|
|
71
|
-
- **Prompt**: Loaded with priority to local file inside the @j-o-r/hello-dave npm module (docs/prompt/spawn_agent.md), fallback to live repo fetch.
|
|
72
|
-
|
|
73
|
-
## OPTIONS:
|
|
74
|
-
--model [grok-4-fast-reasoning|...] (default: grok-4-fast-reasoning)
|
|
75
|
-
--temperature [float] (0.8)
|
|
76
|
-
--tokens [number]
|
|
77
|
-
--top_p [float]
|
|
78
|
-
--context [number] (250k)
|
|
79
|
-
|
|
80
|
-
## Examples:
|
|
81
|
-
"Create coderev: desc=Git analyzer, natives=web_search, generics=read_file execute_bash_script, custom=options.tools.push({type:'git_diff',description:'...',parameters:{...}})"
|
|
82
|
-
`);
|
|
83
|
-
process.exit();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (help) {
|
|
87
|
-
printHelp();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const tool_call_name = 'spawn_agent';
|
|
91
|
-
const tool_call_description = `Portable creator for CLI/WS agents + PM2 launchers. Tools use exec CWD (/tmp OK). PROJECT (agents/*.js >0): Full auto. FRESH: Manual code/bash.
|
|
92
|
-
|
|
93
|
-
Test new agent: ./agents/NEW.js --help | 'describe' | --serve 8081 --secret abc
|
|
94
|
-
|
|
95
|
-
Custom ex: natives=[{type:'mytool'}], generics=read_file
|
|
96
|
-
|
|
97
|
-
Prompt priority: local relative to @j-o-r/hello-dave module or live https://codeberg.org/duin/hello-dave/raw/branch/main/docs/prompt/spawn_agent.md`.trim();
|
|
98
|
-
|
|
99
|
-
const REPO_URL = 'https://codeberg.org/duin/hello-dave';
|
|
100
|
-
|
|
101
|
-
async function fetchLivePrompt() {
|
|
102
|
-
const promptFile = 'docs/prompt/spawn_agent.md';
|
|
103
|
-
|
|
104
|
-
// Priority 1: Local relative to the installed @j-o-r/hello-dave module (best for npm/offline)
|
|
105
|
-
try {
|
|
106
|
-
const require = createRequire(import.meta.url);
|
|
107
|
-
const packageJsonPath = require.resolve('@j-o-r/hello-dave/package.json');
|
|
108
|
-
const moduleRoot = path.dirname(packageJsonPath);
|
|
109
|
-
const localPromptPath = path.join(moduleRoot, promptFile);
|
|
110
|
-
if (fs.existsSync(localPromptPath)) {
|
|
111
|
-
const localPrompt = fs.readFileSync(localPromptPath, 'utf8');
|
|
112
|
-
console.log(`[spawn_agent] Loaded prompt locally from module: ${localPromptPath}`);
|
|
113
|
-
return localPrompt;
|
|
114
|
-
}
|
|
115
|
-
} catch (localErr) {
|
|
116
|
-
console.warn('[spawn_agent] Local module prompt load skipped:', localErr.message);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Priority 2: Live remote (for latest updates)
|
|
120
|
-
const promptUrl = `${REPO_URL}/raw/branch/main/${promptFile}`;
|
|
121
|
-
console.log(`[spawn_agent] Fetching live prompt: ${promptUrl}`);
|
|
122
|
-
const response = await fetch(promptUrl);
|
|
123
|
-
if (!response.ok) {
|
|
124
|
-
throw new Error(`HTTP ${response.status}`);
|
|
125
|
-
}
|
|
126
|
-
const text = await response.text();
|
|
127
|
-
console.log('[spawn_agent] Loaded live prompt from Codeberg');
|
|
128
|
-
return text;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const agent = new AgentManager({ name, secret });
|
|
132
|
-
|
|
133
|
-
const prompt = await fetchLivePrompt();
|
|
134
|
-
|
|
135
|
-
agent.setup({
|
|
136
|
-
prompt,
|
|
137
|
-
api,
|
|
138
|
-
options,
|
|
139
|
-
toolsetMode,
|
|
140
|
-
contextWindow
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
agent.addGenericToolcall('execute_bash_script');
|
|
144
|
-
agent.addGenericToolcall('read_file');
|
|
145
|
-
agent.addGenericToolcall('write_file');
|
|
146
|
-
agent.addGenericToolcall('javascript_interpreter');
|
|
147
|
-
|
|
148
|
-
const cliIntro = `🤖 ${name} (${options.model}) ready! (context: ${contextWindow})
|
|
149
|
-
|
|
150
|
-
Portable Creator: PROJECT (agents/*.js exist): Auto. FRESH (empty): Manual code.
|
|
151
|
-
Prompt: local in @j-o-r/hello-dave module preferred.
|
|
152
|
-
|
|
153
|
-
Ex: "Create testagent: desc=Tester, natives=web_search"`.trim();
|
|
154
|
-
|
|
155
|
-
if (input) {
|
|
156
|
-
const RES = await agent.directCall(input);
|
|
157
|
-
console.log(RES);
|
|
158
|
-
} else {
|
|
159
|
-
await agent.start(serve, connect, cliIntro, tool_call_name, tool_call_description);
|
|
160
|
-
}
|
package/agents/stability.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { AgentManager, API, CdnToolset } from '@j-o-r/hello-dave';
|
|
3
|
-
import * as test from '@j-o-r/hello-dave';
|
|
4
|
-
import { parseArgs } from '@j-o-r/sh';
|
|
5
|
-
|
|
6
|
-
const name = 'stability';
|
|
7
|
-
const api = 'xai';
|
|
8
|
-
let secret = '';
|
|
9
|
-
|
|
10
|
-
const args = parseArgs();
|
|
11
|
-
|
|
12
|
-
let input;
|
|
13
|
-
if (args._.length === 1 && typeof args._[0] === 'string' && args._[0].trim() !== '') {
|
|
14
|
-
input = args._[0].trim();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const help = args['help'] || false;
|
|
18
|
-
const connect = args['connect'] ? args['connect'] : undefined;
|
|
19
|
-
const serve = args['serve'] ? parseInt(args['serve']) : undefined;
|
|
20
|
-
|
|
21
|
-
/** @type {import('lib/API/x.ai/responses.js').XAIOptions} */
|
|
22
|
-
const options = { tools: [] };
|
|
23
|
-
options.tools.push({
|
|
24
|
-
type: 'web_search'
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (args['secret']) {
|
|
28
|
-
secret = args['secret'];
|
|
29
|
-
}
|
|
30
|
-
if (args['model'] || true) {
|
|
31
|
-
options.model = args['model'] || 'grok-4-fast-reasoning';
|
|
32
|
-
}
|
|
33
|
-
if (args['temperature']) {
|
|
34
|
-
options.temperature = parseFloat(args['temperature']);
|
|
35
|
-
} else {
|
|
36
|
-
options.temperature = 0.8;
|
|
37
|
-
}
|
|
38
|
-
if (args['tokens']) {
|
|
39
|
-
options.max_output_tokens = parseInt(args['tokens']);
|
|
40
|
-
}
|
|
41
|
-
if (args['top_p']) {
|
|
42
|
-
options.top_p = parseFloat(args['top_p']);
|
|
43
|
-
}
|
|
44
|
-
const reasoning = true;
|
|
45
|
-
if (reasoning) {
|
|
46
|
-
options.reasoning = {
|
|
47
|
-
effort: 'medium',
|
|
48
|
-
summary: 'auto'
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const toolsetMode = 'auto';
|
|
52
|
-
const contextWindow = args['context'] ? parseInt(args['context']) : 1900000;
|
|
53
|
-
|
|
54
|
-
function printHelp() {
|
|
55
|
-
console.log(`
|
|
56
|
-
'${name} --help' You are looking at it.
|
|
57
|
-
|
|
58
|
-
## USAGE MODES:
|
|
59
|
-
|
|
60
|
-
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
61
|
-
./agents/${name}.js "Generate lyrics for pop song" [--options]
|
|
62
|
-
|
|
63
|
-
### 2. Interactive CLI (no positional arg):
|
|
64
|
-
./agents/${name}.js [--options]
|
|
65
|
-
|
|
66
|
-
### 3. WS Server (no positional arg):
|
|
67
|
-
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
68
|
-
|
|
69
|
-
### 4. WS Client (no positional arg):
|
|
70
|
-
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
71
|
-
|
|
72
|
-
### 5. Hybrid (Server + Client, no positional arg):
|
|
73
|
-
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
74
|
-
|
|
75
|
-
## SERVER OPTIONS EXPLAINED:
|
|
76
|
-
--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.
|
|
77
|
-
|
|
78
|
-
--connect [ws_url]: Connects as CLIENT to remote WS server at [ws_url] (e.g., ws://127.0.0.1:8080/ws). Gains access to remote agent's tools. Interactive CLI available.
|
|
79
|
-
|
|
80
|
-
--secret [string]: SHARED AUTH TOKEN (min 3 chars). SERVER rejects clients without matching --secret. CLIENTS must provide server's secret to connect. Use same secret for chains.
|
|
81
|
-
|
|
82
|
-
Note: Server/Client/Hybrid IGNORES positional input arg (use CLI modes instead). Hybrid: This agent serves AND uses remote tools.
|
|
83
|
-
|
|
84
|
-
## OPTIONS:
|
|
85
|
-
--model [grok-4-fast-reasoning|...] (default: grok-4-fast-reasoning)
|
|
86
|
-
--temperature [float] (-2 to +2, default 0.8 for creativity)
|
|
87
|
-
--tokens [number] (max output tokens)
|
|
88
|
-
--top_p [float]
|
|
89
|
-
--context [number] (default: 1900000)
|
|
90
|
-
|
|
91
|
-
## SERVER TOOLS (when no input):
|
|
92
|
-
Exposes as 'daisy_agent' tool for chaining.
|
|
93
|
-
`);
|
|
94
|
-
process.exit();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (help) {
|
|
98
|
-
printHelp();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const tool_call_name = 'daisy_agent';
|
|
102
|
-
const tool_call_description = `
|
|
103
|
-
Daisy Music Assistant:
|
|
104
|
-
- "Lyrics for [theme]" → Generate lyrics.
|
|
105
|
-
- "Music minimax prompt: [style]" → Optimized prompt.
|
|
106
|
-
- "ffmpeg [task] on file.wav" → Bash script to run.
|
|
107
|
-
- web_search: Research chords/lyrics.
|
|
108
|
-
- execute_bash_script: Processes your local files safely.
|
|
109
|
-
- Create music
|
|
110
|
-
`.trim();
|
|
111
|
-
|
|
112
|
-
const prompt = `
|
|
113
|
-
You are ${name}, a helpful music creation and editing assistant for the user's computer.
|
|
114
|
-
|
|
115
|
-
Core expertise:
|
|
116
|
-
- Generate lyrics: Creative, structured (verses, chorus), themed, rhyming.
|
|
117
|
-
- niMAx 2.6 AI prompts: Detailed, vivid descriptions (genre, mood, instruments, structure, vocals).
|
|
118
|
-
- Local audio editing: Use execute_bash_script with ffmpeg/sox commands. Provide exact bash snippets first, confirm before running. Examples:
|
|
119
|
-
* Trim: ffmpeg -i input.mp3 -ss 00:00:30 -t 00:01:00 output.mp3
|
|
120
|
-
* Concat: echo "file 'a.mp3'" > list.txt; ffmpeg -f concat -i list.txt out.mp3
|
|
121
|
-
* Sox effects: sox input.wav output.wav fade 0 3 2 norm
|
|
122
|
-
* Convert: ffmpeg -i video.mp4 audio.aac
|
|
123
|
-
- Music theory: Chords, scales, BPM, EQ tips.
|
|
124
|
-
- Workflows: Step-by-step for mixing, mastering, layering tracks.
|
|
125
|
-
|
|
126
|
-
Behavior:
|
|
127
|
-
- Be creative & enthusiastic!
|
|
128
|
-
- Step-by-step: Explain, provide code, suggest files in current dir.
|
|
129
|
-
- Safety: Quote bash commands; ask confirmation for destructive ops (e.g., overwrite).
|
|
130
|
-
- Use web_search for inspiration/lyrics if needed.
|
|
131
|
-
- Output ready-to-copy bash for ffmpeg/sox.
|
|
132
|
-
- List files if unclear: Use ls *.wav *.mp3 etc. via bash.
|
|
133
|
-
|
|
134
|
-
Current env: Ubuntu, ffmpeg & sox installed
|
|
135
|
-
|
|
136
|
-
Respond concisely but completely. Use markdown for code/lyrics/prompts.
|
|
137
|
-
`.trim();
|
|
138
|
-
|
|
139
|
-
const agent = new AgentManager({ name, secret });
|
|
140
|
-
agent.setup({
|
|
141
|
-
prompt,
|
|
142
|
-
api,
|
|
143
|
-
options,
|
|
144
|
-
toolsetMode,
|
|
145
|
-
contextWindow
|
|
146
|
-
});
|
|
147
|
-
const toolset = agent.getToolset();
|
|
148
|
-
toolset?.borrow(API.stability.musicToolset);
|
|
149
|
-
toolset?.borrow(CdnToolset);
|
|
150
|
-
if (toolset) {
|
|
151
|
-
agent.addGenericToolcall('open_link');
|
|
152
|
-
agent.addGenericToolcall('execute_bash_script');
|
|
153
|
-
agent.addGenericToolcall('read_file');
|
|
154
|
-
agent.addGenericToolcall('write_file');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const cliIntro = `
|
|
158
|
-
${name} ${options.model} ready! (temp: ${options.temperature}, context: ${contextWindow})
|
|
159
|
-
|
|
160
|
-
Ask me to:
|
|
161
|
-
- Write lyrics
|
|
162
|
-
- Craft Music prompts
|
|
163
|
-
- Edit audio: "fade out my track.mp3" → I'll give ffmpeg cmd
|
|
164
|
-
Type /help for more.
|
|
165
|
-
${tool_call_name}
|
|
166
|
-
`.trim();
|
|
167
|
-
|
|
168
|
-
if (input) {
|
|
169
|
-
const RES = await agent.directCall(input);
|
|
170
|
-
console.log(RES);
|
|
171
|
-
} else {
|
|
172
|
-
await agent.start(serve, connect, cliIntro, tool_call_name, tool_call_description);
|
|
173
|
-
}
|
package/agents/todo_agent.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { AgentManager } from '@j-o-r/hello-dave';
|
|
3
|
-
import { parseArgs } from '@j-o-r/sh';
|
|
4
|
-
|
|
5
|
-
const name = 'todo_agent';
|
|
6
|
-
const api = 'xai';
|
|
7
|
-
let secret = '';
|
|
8
|
-
|
|
9
|
-
const args = parseArgs();
|
|
10
|
-
|
|
11
|
-
let input; // Directcall input (positional ONLY - NO pipe)
|
|
12
|
-
if (args._.length === 1 && typeof args._[0] === 'string' && args._[0].trim() !== '') {
|
|
13
|
-
input = args._[0].trim();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const help = args['help'] || false;
|
|
17
|
-
const connect = args['connect'] ? args['connect'] : undefined;
|
|
18
|
-
const serve = args['serve'] ? parseInt(args['serve']) : undefined;
|
|
19
|
-
|
|
20
|
-
/** @type {import('lib/API/x.ai/responses.js').XAIOptions} */
|
|
21
|
-
const options = { tools: [] };
|
|
22
|
-
options.tools.push({
|
|
23
|
-
type: 'web_search'
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
if (args['secret']) {
|
|
27
|
-
secret = args['secret'];
|
|
28
|
-
}
|
|
29
|
-
if (args['model'] || true) {
|
|
30
|
-
options.model = args['model'] || 'grok-4-fast-reasoning';
|
|
31
|
-
}
|
|
32
|
-
if (args['temperature']) {
|
|
33
|
-
options.temperature = parseFloat(args['temperature']);
|
|
34
|
-
}
|
|
35
|
-
if (args['tokens']) {
|
|
36
|
-
options.max_output_tokens = parseInt(args['tokens']);
|
|
37
|
-
}
|
|
38
|
-
if (args['top_p']) {
|
|
39
|
-
options.top_p = parseFloat(args['top_p']);
|
|
40
|
-
}
|
|
41
|
-
const reasoning = true;
|
|
42
|
-
if (reasoning) {
|
|
43
|
-
options.reasoning = {
|
|
44
|
-
effort: 'medium',
|
|
45
|
-
summary: 'auto'
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const toolsetMode = 'auto';
|
|
49
|
-
const contextWindow = args['context'] ? parseInt(args['context']) : 250000;
|
|
50
|
-
|
|
51
|
-
function printHelp() {
|
|
52
|
-
console.log(`
|
|
53
|
-
'${name} --help' You are looking at it.
|
|
54
|
-
|
|
55
|
-
## USAGE MODES:
|
|
56
|
-
|
|
57
|
-
### 1. Direct Call (One-Shot, Positional ONLY):
|
|
58
|
-
./agents/${name}.js "List tasks" [--options]
|
|
59
|
-
|
|
60
|
-
### 2. Interactive CLI (no positional arg):
|
|
61
|
-
./agents/${name}.js [--options]
|
|
62
|
-
|
|
63
|
-
### 3. WS Server (no positional arg):
|
|
64
|
-
./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
|
|
65
|
-
|
|
66
|
-
### 4. WS Client (no positional arg):
|
|
67
|
-
./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
|
|
68
|
-
|
|
69
|
-
### 5. Hybrid (Server + Client, no positional arg):
|
|
70
|
-
./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
|
|
71
|
-
|
|
72
|
-
## SERVER OPTIONS EXPLAINED:
|
|
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., 'todo_agent'). Runs indefinitely until Ctrl+C.
|
|
74
|
-
|
|
75
|
-
--connect [ws_url]: Connects as CLIENT to remote WS server at [ws_url] (e.g., ws://127.0.0.1:8080/ws). Gains access to remote agent's tools. Interactive CLI available.
|
|
76
|
-
|
|
77
|
-
--secret [string]: SHARED AUTH TOKEN (min 3 chars). SERVER rejects clients without matching --secret. CLIENTS must provide server's secret to connect. Use same secret for chains.
|
|
78
|
-
|
|
79
|
-
Note: Server/Client/Hybrid IGNORES positional input arg (use CLI modes instead). Hybrid: This agent serves AND uses remote tools.
|
|
80
|
-
|
|
81
|
-
## OPTIONS:
|
|
82
|
-
--model [grok-4-fast-reasoning|...] (default: grok-4-fast-reasoning)
|
|
83
|
-
--temperature [float] (-2 to +2)
|
|
84
|
-
--tokens [number] (max output tokens)
|
|
85
|
-
--top_p [float]
|
|
86
|
-
--context [number] (default: 250000)
|
|
87
|
-
|
|
88
|
-
## SERVER TOOLS (when no input):
|
|
89
|
-
Exposes as 'todo_agent' tool for chaining.
|
|
90
|
-
`);
|
|
91
|
-
process.exit()
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (help) {
|
|
95
|
-
printHelp();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const tool_call_name = 'todo_agent';
|
|
99
|
-
const tool_call_description = `
|
|
100
|
-
Project TODO list manager. Maintains TODO.md with tasks in Markdown checklists.
|
|
101
|
-
Inspects current TODO.md, adds/checks/completes tasks based on input, updates the file.
|
|
102
|
-
Suggests next actions, stores future important tasks.
|
|
103
|
-
`.trim();
|
|
104
|
-
|
|
105
|
-
const prompt = `
|
|
106
|
-
You are an expert TODO manager for this project. TODO.md stores tasks in Markdown format with checklists:
|
|
107
|
-
|
|
108
|
-
## TODO (high priority pending)
|
|
109
|
-
- [ ] Task 1
|
|
110
|
-
|
|
111
|
-
## In Progress
|
|
112
|
-
- [ ] Task 2
|
|
113
|
-
|
|
114
|
-
## Later (future tasks)
|
|
115
|
-
- [ ] Important task to do later
|
|
116
|
-
|
|
117
|
-
## Done
|
|
118
|
-
- [x] Completed task
|
|
119
|
-
|
|
120
|
-
**CRITICAL: STRICT NO-CODING RULE** - Stick to TODO management ONLY. NEVER:
|
|
121
|
-
- Use coding tools (e.g., javascript_interpreter, write_file, read_file, syntax_check).
|
|
122
|
-
- Generate, execute, or edit code.
|
|
123
|
-
- Misuse bash for anything beyond safe TODO.md ops (e.g., cat TODO.md, echo > TODO.md).
|
|
124
|
-
If asked to code, decline: "For coding, use other agents. I'll handle TODOs only."
|
|
125
|
-
Delegate complex tasks via suggestions; use memory_agent if available for persistence.
|
|
126
|
-
|
|
127
|
-
ALWAYS:
|
|
128
|
-
|
|
129
|
-
1. Inspect the current TODO.md file if it exists (use \`cat TODO.md\` or similar).
|
|
130
|
-
|
|
131
|
-
2. Understand the user input:
|
|
132
|
-
- Add new tasks: "add task: Fix bug in foo.js"
|
|
133
|
-
- Complete: "done: task X" or mark specific
|
|
134
|
-
- Check status: "status" or "what's next?"
|
|
135
|
-
- Prioritize/reorganize
|
|
136
|
-
- Archive old done tasks if too many
|
|
137
|
-
|
|
138
|
-
3. Update TODO.md with changes. Keep it organized, add dates if useful (e.g., - [ ] 2026-02-24: Task).
|
|
139
|
-
|
|
140
|
-
4. Write the FULL updated content to ./TODO.md.
|
|
141
|
-
|
|
142
|
-
5. In your response, summarize:
|
|
143
|
-
- Current status (pending count, next suggested)
|
|
144
|
-
- Changes made
|
|
145
|
-
- Updated TODO.md preview (first 10 lines or key sections)
|
|
146
|
-
|
|
147
|
-
If no TODO.md, create one inspecting the project (package.json, README.md, git status) for initial tasks like "Review code", "Add tests", etc.
|
|
148
|
-
|
|
149
|
-
Use tools to inspect files as needed (ls, cat, git log, etc.).
|
|
150
|
-
`.trim();
|
|
151
|
-
|
|
152
|
-
const agent = new AgentManager({ name, secret });
|
|
153
|
-
agent.setup({
|
|
154
|
-
prompt,
|
|
155
|
-
api,
|
|
156
|
-
options,
|
|
157
|
-
toolsetMode,
|
|
158
|
-
contextWindow
|
|
159
|
-
});
|
|
160
|
-
const toolset = agent.getToolset();
|
|
161
|
-
if (toolset) {
|
|
162
|
-
agent.addGenericToolcall('execute_bash_script');
|
|
163
|
-
}
|
|
164
|
-
const cliIntro = `
|
|
165
|
-
${name} ${options.model}.
|
|
166
|
-
- context: ${contextWindow}. TODO manager ready.
|
|
167
|
-
${tool_call_name}
|
|
168
|
-
`.trim();
|
|
169
|
-
|
|
170
|
-
if (input) {
|
|
171
|
-
const RES = await agent.directCall(input);
|
|
172
|
-
console.log(RES);
|
|
173
|
-
} else {
|
|
174
|
-
await agent.start(serve, connect, cliIntro, tool_call_name, tool_call_description);
|
|
175
|
-
}
|
package/bin/codeDave
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
|
|
3
|
-
echo "Usage: $0 <PORT> [SECRET] # PORT: 1024-65535, SECRET: optional (defaults to '123')"
|
|
4
|
-
exit 1
|
|
5
|
-
fi
|
|
6
|
-
|
|
7
|
-
PORT="$1"
|
|
8
|
-
SECRET="${2:-123}"
|
|
9
|
-
|
|
10
|
-
if [ -z "$SECRET" ] || [ ${#SECRET} -lt 3 ]; then
|
|
11
|
-
echo "Error: SECRET must be at least 3 characters: '$SECRET'"
|
|
12
|
-
exit 1
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
if ! [[ "$PORT" =~ ^[0-9]+$ ]] || [ "$PORT" -lt 1024 ] || [ "$PORT" -gt 65535 ]; then
|
|
16
|
-
echo "Error: Invalid port number: $PORT. Must be between 1024 and 65535."
|
|
17
|
-
exit 1
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
# Compute canonical paths relative to THIS script's real location (resolves symlinks for global npm installs)
|
|
21
|
-
SOURCE="${BASH_SOURCE[0]}"
|
|
22
|
-
while [ -h "$SOURCE" ]; do
|
|
23
|
-
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
24
|
-
SOURCE="$(readlink "$SOURCE")"
|
|
25
|
-
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
26
|
-
done
|
|
27
|
-
SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
28
|
-
PROJECT_DIR="$( cd -P "$( dirname "$SCRIPT_DIR" )" >/dev/null 2>&1 && pwd )"
|
|
29
|
-
|
|
30
|
-
# FOLDER: basename of CURRENT WORKING DIRECTORY (pwd) for per-project PM2 prefixes (e.g., myproject_code_8080)
|
|
31
|
-
# This allows multi-project usage without name conflicts; PROJECT_DIR remains package location for agents/
|
|
32
|
-
FOLDER=$(basename "$(pwd)")
|
|
33
|
-
|
|
34
|
-
echo "Starting codeDave on port ${PORT} in folder '${FOLDER}' (SCRIPT_DIR: ${SCRIPT_DIR}) with SECRET '${SECRET}'..."
|
|
35
|
-
|
|
36
|
-
# Delete existing processes with folder_port suffix
|
|
37
|
-
pm2 delete "${FOLDER}_code_${PORT}" 2>/dev/null || true
|
|
38
|
-
pm2 delete "${FOLDER}_todo_${PORT}" 2>/dev/null || true
|
|
39
|
-
pm2 delete "${FOLDER}_readme_${PORT}" 2>/dev/null || true
|
|
40
|
-
pm2 delete "${FOLDER}_npm_${PORT}" 2>/dev/null || true
|
|
41
|
-
pm2 delete "${FOLDER}_docs_${PORT}" 2>/dev/null || true
|
|
42
|
-
pm2 delete "${FOLDER}_test_${PORT}" 2>/dev/null || true
|
|
43
|
-
pm2 delete "${FOLDER}_memory_${PORT}" 2>/dev/null || true
|
|
44
|
-
pm2 delete "${FOLDER}_spawn_${PORT}" 2>/dev/null || true
|
|
45
|
-
|
|
46
|
-
# Spawn main Agent / server (absolute paths to scripts)
|
|
47
|
-
pm2 start "${PROJECT_DIR}/agents/code_agent.js" --name "${FOLDER}_code_${PORT}" -- --serve "${PORT}" --tools javascript --secret "${SECRET}"
|
|
48
|
-
# Attach clients
|
|
49
|
-
pm2 start "${PROJECT_DIR}/agents/todo_agent.js" --name "${FOLDER}_todo_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
50
|
-
pm2 start "${PROJECT_DIR}/agents/readme_agent.js" --name "${FOLDER}_readme_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
51
|
-
pm2 start "${PROJECT_DIR}/agents/npm_agent.js" --name "${FOLDER}_npm_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
52
|
-
pm2 start "${PROJECT_DIR}/agents/docs_agent.js" --name "${FOLDER}_docs_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
53
|
-
pm2 start "${PROJECT_DIR}/agents/test_agent.js" --name "${FOLDER}_test_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
54
|
-
pm2 start "${PROJECT_DIR}/agents/memory_agent.js" --name "${FOLDER}_memory_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
55
|
-
# pm2 start "${PROJECT_DIR}/agents/spawn_agent.js" --name "${FOLDER}_spawn_${PORT}" -- --connect "ws://127.0.0.1:${PORT}/ws" --secret "${SECRET}"
|
|
56
|
-
|
|
57
|
-
echo "codeDave processes spawned with prefix '${FOLDER}_' and suffix _${PORT}. Check with: pm2 list | grep '${FOLDER}_${PORT}'"
|
|
58
|
-
echo "dave --connect ws://127.0.0.1:${PORT}/ws --secret '$SECRET'"
|