@j-o-r/hello-dave 0.1.1 → 0.1.4

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.
Files changed (173) hide show
  1. package/CHANGELOG.md +42 -25
  2. package/README.md +81 -221
  3. package/TODO.md +173 -35
  4. package/agents/agent_creator.js +105 -0
  5. package/agents/agent_creator.prompt.md +371 -0
  6. package/agents/ask_agent.js +64 -127
  7. package/agents/claude_agent.js +68 -0
  8. package/agents/code_agent.js +55 -135
  9. package/agents/code_agent.prompt.md +50 -0
  10. package/agents/echo_agent.js +76 -0
  11. package/agents/financial_expert.js +75 -0
  12. package/agents/gpt_agent.js +52 -103
  13. package/agents/gpt_code.js +81 -0
  14. package/agents/grok_agent.js +58 -114
  15. package/agents/minimax_agent.js +92 -0
  16. package/agents/mureka_agent.js +77 -0
  17. package/agents/planner_agent.js +172 -0
  18. package/agents/stability_agent.js +87 -0
  19. package/agents/test_agent.js +75 -157
  20. package/agents/weather_agent.js +73 -0
  21. package/agents/workflow_agent.js +189 -0
  22. package/bin/dave.js +436 -184
  23. package/docs/bin-dave.md +85 -35
  24. package/docs/cdn-ssh.md +100 -0
  25. package/docs/creating-agents.md +301 -0
  26. package/docs/creating-toolsets.md +336 -0
  27. package/docs/docs-organization.md +48 -0
  28. package/docs/project-overview.md +86 -51
  29. package/lib/API/elevenlabs.io/music.compose.md +441 -0
  30. package/lib/API/elevenlabs.io/music.create-composition-plan.md +370 -0
  31. package/lib/API/elevenlabs.io/music.stream.md +425 -0
  32. package/lib/API/lalal.ai/lalal.js +445 -0
  33. package/lib/API/lalal.ai/openapi.json +2614 -0
  34. package/lib/API/minimax/ImageToolset.js +82 -37
  35. package/lib/API/minimax/MusicToolset.js +125 -79
  36. package/lib/API/minimax/VideoToolset.js +170 -167
  37. package/lib/API/minimax/image.js +5 -1
  38. package/lib/API/minimax/music.js +210 -23
  39. package/lib/API/minimax/video.js +242 -53
  40. package/lib/API/mureka/MusicToolset.js +646 -0
  41. package/lib/API/mureka/README.md +41 -0
  42. package/lib/API/mureka/index.js +7 -0
  43. package/lib/API/mureka/music.js +658 -0
  44. package/lib/API/openai.com/index.js +7 -0
  45. package/lib/API/openai.com/{reponses/text.js → responses.js} +64 -18
  46. package/lib/API/openai.com/video.create.character.md +40 -0
  47. package/lib/API/openai.com/video.create.md +219 -0
  48. package/lib/API/openai.com/video.delete.md +44 -0
  49. package/lib/API/openai.com/video.download.md +31 -0
  50. package/lib/API/openai.com/video.edit.md +155 -0
  51. package/lib/API/openai.com/video.extend.md +166 -0
  52. package/lib/API/openai.com/video.fetch.character.md +43 -0
  53. package/lib/API/openai.com/video.js +784 -0
  54. package/lib/API/openai.com/video.list.md +201 -0
  55. package/lib/API/openai.com/video.remix.md +175 -0
  56. package/lib/API/openai.com/video.retrieve.md +139 -0
  57. package/lib/API/openai.com/videoToolset.js +616 -0
  58. package/lib/API/stability.ai/ImageToolset.js +131 -40
  59. package/lib/API/stability.ai/MusicToolset.js +79 -47
  60. package/lib/API/stability.ai/audio.js +63 -131
  61. package/lib/API/x.ai/chat.responses.md +1040 -0
  62. package/lib/API/x.ai/image.js +229 -59
  63. package/lib/API/x.ai/imageToolset.js +376 -0
  64. package/lib/API/x.ai/index.js +1 -1
  65. package/lib/API/x.ai/responses.js +9 -18
  66. package/lib/Agent.js +271 -0
  67. package/lib/Agent.js.old +284 -0
  68. package/lib/AgentLauncher.js +562 -0
  69. package/lib/Cli.js +87 -13
  70. package/lib/Prompt.js +23 -1
  71. package/lib/Session.js +5 -4
  72. package/lib/ToolSet.js +102 -6
  73. package/lib/agentLoader.js +369 -0
  74. package/lib/cdn.js +67 -231
  75. package/lib/{CdnToolset.js → cdnToolset.js} +47 -64
  76. package/lib/defaultToolsets.js +43 -0
  77. package/lib/fafs.js +1 -1
  78. package/lib/genericToolset.js +442 -119
  79. package/lib/handOffToolset.js +179 -0
  80. package/lib/index.js +34 -27
  81. package/lib/toolsetLoader.js +248 -0
  82. package/package.json +11 -5
  83. package/types/API/lalal.ai/lalal.d.ts +116 -0
  84. package/types/API/minimax/image.d.ts +2 -1
  85. package/types/API/minimax/music.d.ts +189 -26
  86. package/types/API/minimax/video.d.ts +100 -31
  87. package/types/API/mureka/index.d.ts +7 -0
  88. package/types/API/mureka/music.d.ts +472 -0
  89. package/types/API/openai.com/index.d.ts +7 -0
  90. package/types/API/openai.com/{reponses/text.d.ts → responses.d.ts} +11 -11
  91. package/types/API/openai.com/video.d.ts +409 -0
  92. package/types/API/openai.com/videoToolset.d.ts +24 -0
  93. package/types/API/stability.ai/audio.d.ts +14 -103
  94. package/types/API/stability.ai/image.d.ts +2 -2
  95. package/types/API/x.ai/image.d.ts +138 -26
  96. package/types/API/x.ai/imageToolset.d.ts +3 -0
  97. package/types/API/x.ai/index.d.ts +1 -1
  98. package/types/API/x.ai/responses.d.ts +4 -4
  99. package/types/Agent.d.ts +123 -0
  100. package/types/AgentLauncher.d.ts +222 -0
  101. package/types/Cli.d.ts +28 -8
  102. package/types/Prompt.d.ts +23 -5
  103. package/types/Session.d.ts +1 -1
  104. package/types/ToolSet.d.ts +10 -0
  105. package/types/agentLoader.d.ts +78 -0
  106. package/types/cdn.d.ts +15 -90
  107. package/types/defaultToolsets.d.ts +9 -0
  108. package/types/fafs.d.ts +1 -1
  109. package/types/genericToolset.d.ts +1 -1
  110. package/types/handOffToolset.d.ts +28 -0
  111. package/types/index.d.ts +19 -17
  112. package/types/toolsetLoader.d.ts +114 -0
  113. package/utils/format_log.js +101 -23
  114. package/utils/launch_agent.js +18 -0
  115. package/utils/list_sessions.sh +13 -5
  116. package/utils/search_sessions.sh +65 -29
  117. package/utils/toolsets.js +33 -0
  118. package/README.md.bak.1779452127 +0 -240
  119. package/agents/codeserver.sh +0 -47
  120. package/agents/daisy_agent.js +0 -173
  121. package/agents/docs_agent.js +0 -148
  122. package/agents/memory_agent.js +0 -263
  123. package/agents/minimax.js +0 -173
  124. package/agents/npm_agent.js +0 -202
  125. package/agents/prompt_agent.js +0 -133
  126. package/agents/readme_agent.js +0 -148
  127. package/agents/spawn_agent.js +0 -160
  128. package/agents/stability.js +0 -173
  129. package/agents/todo_agent.js +0 -175
  130. package/bin/codeDave +0 -58
  131. package/docs/agent-dave-websocket-protocol.md +0 -180
  132. package/docs/agent-manager.md +0 -244
  133. package/docs/codeserver-pattern.md +0 -191
  134. package/docs/generic-toolset.md +0 -326
  135. package/docs/howtos/agent-networking.md +0 -253
  136. package/docs/howtos/spawn-agents.md.bak +0 -200
  137. package/docs/howtos/spawn-agents.md.bak_new +0 -200
  138. package/docs/multi-agent-clusters.md +0 -265
  139. package/docs/music-toolsets.md +0 -137
  140. package/docs/path-resolution-best-practices.md +0 -104
  141. package/docs/plans/minimax-music-generation.md +0 -80
  142. package/docs/plans/unified-agent-architecture.md +0 -146
  143. package/docs/plans/websocket-streaming-plan.md.bak +0 -317
  144. package/docs/prompt/spawn_agent.md +0 -175
  145. package/docs/prompt/spawn_agent.md.bak +0 -201
  146. package/docs/prompt/task_clarification_and_documentation.md +0 -35
  147. package/docs/prompt-class.md +0 -141
  148. package/docs/todo-archive-infra-2026-04-21.md +0 -15
  149. package/docs/todo-archive-v0.0.8.md +0 -1
  150. package/docs/todo-archive-v0.1.0.md +0 -32
  151. package/docs/todo-archive.md +0 -44
  152. package/docs/tools-syntax-validation.md +0 -121
  153. package/docs/toolset.md +0 -164
  154. package/docs/xai-responses.md +0 -111
  155. package/docs/xai_collections.md +0 -106
  156. package/lib/API/x.ai/ImageToolset.js +0 -165
  157. package/lib/API/x.ai/text.js +0 -415
  158. package/lib/AgentClient.js +0 -248
  159. package/lib/AgentManager.js +0 -245
  160. package/lib/AgentServer.js +0 -404
  161. package/lib/wsCli.js +0 -287
  162. package/lib/wsIO.js +0 -90
  163. package/types/API/x.ai/text.d.ts +0 -286
  164. package/types/AgentClient.d.ts +0 -109
  165. package/types/AgentManager.d.ts +0 -100
  166. package/types/AgentServer.d.ts +0 -89
  167. package/types/wsCli.d.ts +0 -17
  168. package/types/wsIO.d.ts +0 -30
  169. package/utils/test.sh +0 -46
  170. /package/docs/{suggestions.md → _notes/token-counts.md} +0 -0
  171. /package/lib/API/openai.com/{reponses/MESSAGES.md → MESSAGES.md} +0 -0
  172. /package/types/API/{x.ai/ImageToolset.d.ts → mureka/MusicToolset.d.ts} +0 -0
  173. /package/types/{CdnToolset.d.ts → cdnToolset.d.ts} +0 -0
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @file agents/gpt_code.js
4
+ * @description GPT-based helper agent specialized for Node.js (ESM) JavaScript and Bash scripting tasks.
5
+ * Provides code assistance, file operations, and script execution via the generic bash toolset.
6
+ * Strictly follows ESM, uses only framework-provided tools (no external npm modules).
7
+ */
8
+
9
+ import { API, Agent } from '@j-o-r/hello-dave';
10
+
11
+ /**
12
+ * @typedef {import('@j-o-r/hello-dave/types/API/openai.com/responses').OAOptions} OAOptions
13
+ */
14
+
15
+ /** @type {OAOptions} */
16
+ const options = {
17
+ model: 'gpt-5.5',
18
+ reasoning: { effort: 'medium', summary: 'auto' }
19
+ };
20
+
21
+ const toolsetMode = 'auto';
22
+ const contextWindow = 900000;
23
+
24
+ const call_name = Agent.deriveCallName(import.meta.url);
25
+
26
+ /**
27
+ * Human-readable description of this agent (used by the launcher and handoff system).
28
+ */
29
+ const call_description = `
30
+ GPT Code Helper for Node.js ESM JavaScript and Bash scripts.
31
+ Specialized in writing, reading, editing, and executing code with zero external dependencies.
32
+ `.trim();
33
+
34
+ /**
35
+ * System prompt defining the agent's identity, behavior, and constraints.
36
+ */
37
+ const prompt = `
38
+ You are exactly the agent named "${call_name}".
39
+
40
+ Identity (use this every time you are asked who or what you are):
41
+ - Your name is "${call_name}".
42
+ - You are a GPT-based code helper agent in this system.
43
+ - You specialize in Node.js ESM JavaScript and Bash scripting.
44
+ - You never use external npm packages — only pure Node.js + the provided bash tools.
45
+ - When asked "Which agent are you?", "What agent are you?", or "Who are you?", answer directly:
46
+ "I am ${call_name}. A GPT helper for writing and running ESM JavaScript and Bash scripts."
47
+
48
+ Behavior:
49
+ - Respond concisely and directly.
50
+ - Always prefer ESM syntax (import/export) for JavaScript.
51
+ - Use the available tools (read_file, write_file, execute_bash_script) for all file and execution tasks.
52
+ - Provide JSDoc comments for all functions and important code.
53
+ - Validate code with "node --check" before suggesting execution.
54
+ - Offer safe, minimal, production-ready snippets.
55
+ `.trim();
56
+
57
+ const cliIntro = `
58
+ ${call_name} ${options.model} — Node.js ESM + Bash helper.
59
+ - context: ${contextWindow}
60
+ `.trim();
61
+
62
+ const agent = new Agent({
63
+ prompt,
64
+ api: API.chat.gpt,
65
+ options,
66
+ toolsetMode,
67
+ contextWindow,
68
+ call_name,
69
+ call_description,
70
+ cliIntro
71
+ });
72
+
73
+ const toolset = agent.getToolset();
74
+ if (toolset) {
75
+ toolset.borrow(API.toolset.generic.handoff);
76
+ toolset.addFrom(API.toolset.generic.bash, 'execute_bash_script');
77
+ toolset.addFrom(API.toolset.generic.bash, 'read_file');
78
+ toolset.addFrom(API.toolset.generic.bash, 'write_file');
79
+ }
80
+
81
+ export default agent;
@@ -1,132 +1,76 @@
1
- #!/usr/bin/env node
2
- /*
3
- * Full modes: Direct call (one-shot positional ONLY), CLI interactive (no args), WS Server (--serve), Client (--connect).
4
- * Direct: grok_agent.js "What is your task?"
5
- * CLI: grok_agent.js
6
- * Server: grok_agent.js --serve 8080
7
- */
8
- import { AgentManager } from '@j-o-r/hello-dave';
9
- import { parseArgs } from '@j-o-r/sh';
10
-
11
- const name = 'grok_agent';
12
- const api = 'xai';
13
- let secret = '';
14
-
15
- const args = parseArgs();
16
-
17
- let input; // Directcall input (positional ONLY - NO pipe)
18
- if (args._.length === 1 && typeof args._[0] === 'string' && args._[0].trim() !== '') {
19
- input = args._[0].trim();
20
- }
21
-
22
- const help = args['help'] || false;
23
- const connect = args['connect'] ? args['connect'] : undefined;
24
- const serve = args['serve'] ? parseInt(args['serve']) : undefined;
25
-
26
- /** @type {import('lib/API/x.ai/responses.js').XAIOptions} */
27
- const options = { tools: [] };
28
- options.tools.push({
29
- type: 'web_search'
30
- });
31
- options.tools.push({
32
- type: 'x_search'
33
- });
34
-
35
- if (args['secret']) {
36
- secret = args['secret'];
1
+ /**
2
+ * Grok Agent - Updated for Stage 1/2 standardization.
3
+ * Exposes **all** XAI toolsets (image, etc.) + useful generic tools.
4
+ */
5
+ import { API, Agent } from '@j-o-r/hello-dave';
6
+
7
+ const options = {
8
+ tools: [{ type: 'web_search' }, { type: 'x_search' }],
9
+ model: 'grok-4.3',
10
+ temperature:0.7,
11
+ reasoning: {
12
+ effort: 'medium',
13
+ summary: 'auto'
37
14
  }
38
- if (args['model'] || true) {
39
- options.model = args['model'] || 'grok-4-fast-reasoning';
40
- }
41
- if (args['temperature']) {
42
- options.temperature = parseFloat(args['temperature']);
43
- }
44
- if (args['tokens']) {
45
- options.max_output_tokens = parseInt(args['tokens']);
46
- }
47
- if (args['top_p']) {
48
- options.top_p = parseFloat(args['top_p']);
49
- }
50
- const reasoning = true;
51
- if (reasoning) {
52
- options.reasoning = {
53
- effort: 'medium',
54
- summary: 'auto'
55
- }
56
15
  }
57
16
  const toolsetMode = 'auto';
58
- const contextWindow = args['context'] ? parseInt(args['context']) : 250000;
59
-
60
- function printHelp() {
61
- console.log(`
62
- '${name} --help' You are looking at it.
63
-
64
- ## USAGE MODES:
65
-
66
- ### 1. Direct Call (One-Shot, Positional ONLY):
67
- ./agents/${name}.js "What is your task?" [--options]
68
-
69
- ### 2. Interactive CLI (no positional arg):
70
- ./agents/${name}.js [--options]
17
+ const contextWindow = 250000;
71
18
 
72
- ### 3. WS Server (no positional arg):
73
- ./agents/${name}.js --serve 8080 [--secret mysecret] [--options]
19
+ const call_name = Agent.deriveCallName(import.meta.url);
74
20
 
75
- ### 4. WS Client (no positional arg):
76
- ./agents/${name}.js --connect ws://127.0.0.1:8080/ws --secret mysecret [--options]
77
-
78
- ### 5. Hybrid (Server + Client, no positional arg):
79
- ./agents/${name}.js --serve 8081 --connect ws://other:8080/ws [--secret ...] [--options]
80
-
81
- ## SERVER OPTIONS EXPLAINED:
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.
83
-
84
- --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.
85
-
86
- --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.
21
+ const call_description = `
22
+ Grok (xAI) general-purpose assistant with full access to all XAI toolsets (web_search, x_search, image generation, etc.) plus generic tools.
23
+ Brief and direct when possible.
24
+ You are one of the discoverable, loadable agents in this system.
25
+ `.trim();
87
26
 
88
- Note: Server/Client/Hybrid IGNORES positional input arg (use CLI modes instead). Hybrid: This agent serves AND uses remote tools.
27
+ const prompt = `
28
+ You are exactly the agent named "${call_name}".
89
29
 
90
- ## OPTIONS:
91
- --model [grok-4-fast-reasoning|...] (default: grok-4-fast-reasoning)
92
- --temperature [float] (-2 to +2)
93
- --tokens [number] (max output tokens)
94
- --top_p [float]
95
- --context [number] (default: 250000)
30
+ Identity (use this every time you are asked who or what you are):
31
+ - Your name is "${call_name}".
32
+ - You are a general-purpose Grok (xAI) agent in this system.
33
+ - You appear in "list_agents" output and can be loaded via hand_over / load_agent.
34
+ - When asked "Which agent are you?", "What agent are you?", or "Who are you?", answer directly:
35
+ "I am ${call_name}. [short description of my purpose]."
96
36
 
97
- ## SERVER TOOLS (when no input):
98
- Exposes as brief responder tool for chaining.
99
- `);
100
- process.exit()
101
- }
37
+ Respond briefly and directly, using minimal words. Reason step-by-step first. Focus solely on core point; avoid elaboration or follow-ups. If unclear, ask clarifying questions before proceeding.
102
38
 
103
- if (help) {
104
- printHelp();
105
- }
39
+ You have access to the "list_agents" tool (via handoff tools) — use it when the user asks about available agents.
40
+ `.trim();
106
41
 
107
- const prompt = `
108
- Respond briefly and directly, using minimal words. Reason step-by-step first. Focus solely on core point; avoid elaboration or follow-ups. If unclear, ask clarifying questions before proceeding.
42
+ const cliIntro = `
43
+ ${call_name} ${options.model}
44
+ - context: ${contextWindow}
45
+ - Native tools: web_search, x_search
46
+ - All XAI toolsets + generic tools exposed
109
47
  `.trim();
110
48
 
111
- const agent = new AgentManager({ name, secret });
112
- agent.setup({
49
+ const agent = new Agent({
113
50
  prompt,
114
- api,
51
+ api: API.chat.grok,
115
52
  options,
116
53
  toolsetMode,
117
- contextWindow
54
+ contextWindow,
55
+ call_name,
56
+ call_description,
57
+ cliIntro
118
58
  });
119
59
 
120
- const cliIntro = `
121
- ${name} ${options.model}.
122
- - context: ${contextWindow}. Tools: web_search, x_search.
123
- Brief responder ready for CLI/Server/Client modes.
124
- `.trim();
125
-
126
- if (input) {
127
- // one-shot
128
- const RES = await agent.directCall(input);
129
- console.log(RES);
130
- } else {
131
- await agent.start(serve, connect, cliIntro);
60
+ const toolset = agent.getToolset();
61
+ if (toolset) {
62
+ // Expose ALL XAI toolsets
63
+ const xaiToolsets = API.toolset.xai || {};
64
+ Object.values(xaiToolsets).forEach(ts => {
65
+ if (ts) toolset.borrow(ts);
66
+ });
67
+
68
+ // Useful generic tools
69
+ toolset.addFrom(API.toolset.generic.bash, 'execute_bash_script');
70
+ toolset.addFrom(API.toolset.generic.bash, 'read_file');
71
+ toolset.addFrom(API.toolset.generic.bash, 'write_file');
72
+ toolset.borrow(API.toolset.generic.cdn);
73
+ toolset.borrow(API.toolset.generic.handoff);
132
74
  }
75
+
76
+ export default agent;
@@ -0,0 +1,92 @@
1
+ import { API, Agent } from '@j-o-r/hello-dave';
2
+
3
+ /** @type {import('@j-o-r/hello-dave/types/API/x.ai/responses').XAIOptions} */
4
+ const options = {
5
+ tools: [{ type: 'web_search' }],
6
+ model: 'grok-4.3',
7
+ temperature: 0.8,
8
+ reasoning: {
9
+ effort: 'medium',
10
+ summary: 'auto'
11
+ }
12
+ };
13
+
14
+ const toolsetMode = 'auto';
15
+ const contextWindow = 1900000;
16
+
17
+ const call_name = Agent.deriveCallName(import.meta.url);
18
+
19
+ const call_description = `
20
+ Minimax Agent: Music, image, and video generation using all Minimax toolsets.
21
+ Supports lyrics, music prompts, image/video creation, plus local media editing with ffmpeg/sox.
22
+ `.trim();
23
+
24
+ const prompt = `
25
+ You are ${call_name}, a helpful music, image, and video creation assistant for the user's computer.
26
+
27
+ Core expertise:
28
+ - Generate lyrics: Creative, structured (verses, chorus), themed, rhyming.
29
+ - Minimax prompts: Detailed, vivid descriptions for music (genre, mood, instruments, structure, vocals), images, and video.
30
+ - Local media editing: Use execute_bash_script with ffmpeg/sox commands. Provide exact bash snippets first, confirm before running.
31
+ Examples:
32
+ * Trim audio: ffmpeg -i input.mp3 -ss 00:00:30 -t 00:01:00 output.mp3
33
+ * Concat: echo "file 'a.mp3'" > list.txt; ffmpeg -f concat -i list.txt out.mp3
34
+ * Sox effects: sox input.wav output.wav fade 0 3 2 norm
35
+ * Video to audio: ffmpeg -i video.mp4 audio.aac
36
+ - Music theory: Chords, scales, BPM, EQ tips.
37
+ - Workflows: Step-by-step for mixing, mastering, layering tracks, image/video generation.
38
+
39
+ Behavior:
40
+ - Be creative & enthusiastic!
41
+ - Step-by-step: Explain, provide ready-to-copy code/commands, suggest files in current dir.
42
+ - Safety: Quote bash commands; ask confirmation for destructive operations (e.g., overwrite files).
43
+ - Use web_search for inspiration, lyrics, or references when needed.
44
+ - Output ready-to-copy bash for ffmpeg/sox and generation commands.
45
+ - List files if unclear: Use ls *.wav *.mp3 *.mp4 etc. via bash.
46
+
47
+ Current env: Ubuntu, ffmpeg & sox installed.
48
+
49
+ You have full access to Minimax music, image, and video generation tools, plus CDN and local bash tools.
50
+
51
+ Respond concisely but completely. Use markdown for code, lyrics, and prompts.
52
+ `.trim();
53
+
54
+ const cliIntro = `
55
+ ${call_name} ${options.model} ready! (temp: ${options.temperature}, context: ${contextWindow})
56
+
57
+ Ask me to:
58
+ - Write lyrics
59
+ - Craft Minimax music / image / video prompts
60
+ - Generate media with Minimax tools
61
+ - Edit audio/video with ffmpeg/sox
62
+ `.trim();
63
+
64
+ const agent = new Agent({
65
+ prompt,
66
+ api: API.chat.grok,
67
+ options,
68
+ toolsetMode,
69
+ contextWindow,
70
+ call_name,
71
+ call_description,
72
+ cliIntro
73
+ });
74
+
75
+ const toolset = agent.getToolset();
76
+ if (toolset) {
77
+ // Expose ALL Minimax toolsets (music, image, video)
78
+ toolset.borrow(API.toolset.minimax.music);
79
+ toolset.borrow(API.toolset.minimax.image);
80
+ toolset.borrow(API.toolset.minimax.video);
81
+
82
+ // CDN for uploads
83
+ toolset.borrow(API.toolset.generic.cdn);
84
+
85
+ // Useful local tools
86
+ toolset.addFrom(API.toolset.generic.bash, 'execute_bash_script');
87
+ toolset.addFrom(API.toolset.generic.bash, 'read_file');
88
+ toolset.addFrom(API.toolset.generic.bash, 'write_file');
89
+ toolset.addFrom(API.toolset.generic.bash, 'open_link');
90
+ }
91
+
92
+ export default agent;
@@ -0,0 +1,77 @@
1
+ import { API, Agent } from '@j-o-r/hello-dave';
2
+
3
+ /** @type {import('@j-o-r/hello-dave/types/API/x.ai/responses').XAIOptions} */
4
+ const options = {
5
+ tools: [{ type: 'web_search' }],
6
+ model: 'grok-4.3',
7
+ temperature: 0.8
8
+ };
9
+
10
+ const toolsetMode = 'auto';
11
+ const contextWindow = 1900000;
12
+
13
+ const call_name = Agent.deriveCallName(import.meta.url);
14
+
15
+ const call_description = `
16
+ Mureka Music Assistant:
17
+ - Generate songs and instrumentals with Mureka API
18
+ - Create detailed music prompts
19
+ - Local audio editing with ffmpeg
20
+ - CDN uploads/downloads
21
+ `.trim();
22
+
23
+ const prompt = `
24
+ You are ${call_name}, a helpful music creation and editing assistant using the Mureka platform.
25
+
26
+ Core expertise:
27
+ - Generate songs & instrumentals: Use Mureka tools for high-quality music generation (lyrics, vocals, styles).
28
+ - Music prompts: Detailed vivid descriptions (genre, mood, instruments, structure, vocals, BPM, etc.).
29
+ - Local audio editing: Use execute_bash_script with ffmpeg/sox. Quote commands first, confirm before running.
30
+ - CDN: Upload/download generated audio via generic.cdn tools.
31
+ - Music theory, workflows, step-by-step guidance.
32
+
33
+ Behavior:
34
+ - Be creative & enthusiastic.
35
+ - Step-by-step explanations.
36
+ - Safety: Quote bash commands; ask confirmation for destructive operations.
37
+ - Use web_search when needed.
38
+ - Output ready-to-copy bash snippets.
39
+ - List files if unclear.
40
+
41
+ Current env: Ubuntu, ffmpeg & sox installed.
42
+
43
+ Respond concisely but completely. Use markdown for code/lyrics/prompts.
44
+ `.trim();
45
+
46
+ const cliIntro = `
47
+ ${call_name} ready! model: ${options.model} | temp: ${options.temperature} | context: ${contextWindow}
48
+
49
+ Ask me to:
50
+ - Generate music with Mureka
51
+ - Write lyrics & prompts
52
+ - Edit audio with ffmpeg
53
+ - Upload/download via CDN
54
+ `.trim();
55
+
56
+ const agent = new Agent({
57
+ prompt,
58
+ api: API.chat.grok,
59
+ options,
60
+ toolsetMode,
61
+ contextWindow,
62
+ call_name,
63
+ call_description,
64
+ cliIntro
65
+ });
66
+
67
+ const toolset = agent.getToolset();
68
+ if (toolset) {
69
+ toolset.borrow(API.toolset.mureka.music);
70
+ toolset.borrow(API.toolset.generic.cdn);
71
+
72
+ toolset.addFrom(API.toolset.generic.bash, 'execute_bash_script');
73
+ toolset.addFrom(API.toolset.generic.bash, 'read_file');
74
+ toolset.addFrom(API.toolset.generic.bash, 'open_link');
75
+ }
76
+
77
+ export default agent;
@@ -0,0 +1,172 @@
1
+ /**
2
+ * agents/planner_agent.js
3
+ *
4
+ * Planner and workflow orchestrator.
5
+ * Designed to be loaded via utils/launch_agent.js + AgentLauncher.
6
+ *
7
+ * Usage:
8
+ * node utils/launch_agent.js planner_agent
9
+ */
10
+
11
+ import { API, Agent } from '@j-o-r/hello-dave';
12
+
13
+ /** @type {import('@j-o-r/hello-dave/types/API/x.ai/responses').XAIOptions} */
14
+ const options = {
15
+ model: 'grok-4.3',
16
+ temperature: 0.3,
17
+ // We want thoughtful, structured planning — keep temperature moderate
18
+ };
19
+
20
+ const toolsetMode = 'auto';
21
+ const contextWindow = 512000; // Large context for reading plans + maintaining workflows
22
+
23
+ const call_name = Agent.deriveCallName(import.meta.url);
24
+
25
+ const call_description = `
26
+ Planner and workflow orchestrator for @j-o-r/hello-dave projects.
27
+ Specialized in the strict "Plan First → Small & Realistic Plans → Human-in-the-Loop → Detailed Workflow → Track in TODO.md + .cache/workflows/ → Execute Step-by-Step → Report" methodology.
28
+ Creates and maintains plans in docs/plans/, workflows under .cache/workflows/, and keeps TODO.md up to date.
29
+ Can be used as a temporal or fixed specialist in a project swarm.
30
+ You are one of the discoverable, loadable agents in this system.
31
+ `.trim();
32
+
33
+ const prompt = `
34
+ You are exactly the agent named "${call_name}" (also known as PlannerAgent).
35
+
36
+ Identity (use this every time you are asked who or what you are):
37
+ - Your name is "${call_name}".
38
+ - You are the planner and workflow orchestrator in this system.
39
+ - You appear in "list_agents" output and can be loaded via hand_over / load_agent.
40
+ - When asked "Which agent are you?", "What agent are you?", or "Who are you?", answer directly:
41
+ "I am ${call_name}. [short description of my purpose]."
42
+
43
+ Your core mission is to help humans and other agents execute complex work **reliably and traceably** by strictly following the user's defined process.
44
+
45
+ ### MANDATORY PRINCIPLES (never violate)
46
+
47
+ 1. **Plan First — Always**
48
+ - Before doing any significant work, there must be a small, realistic plan in docs/plans/.
49
+ - The plan must describe WHAT to do, HOW to do it, and gather essential data/information first.
50
+ - Plans must be divided into clear stages when useful.
51
+ - A plan is only realistic if it can be executed with the actual abilities of agents in this system (file operations, code generation, agent creation, cluster management, documentation, git, etc.).
52
+ - Famous realism rule: "Can we actually cook a meal? No — but we can write the recipe."
53
+ - If a plan would grow too large, you MUST split it into multiple smaller linked plans.
54
+
55
+ 2. **Plans Must Be Small**
56
+ - The final [plan-name].md document must fit comfortably inside a typical LLM prompt.
57
+ - You are responsible for keeping plans concise.
58
+
59
+ 3. **Human-in-the-Loop (Critical)**
60
+ - You MUST explicitly ask the human for input when:
61
+ - Key decisions need to be made
62
+ - Requirements are unclear or ambiguous
63
+ - Scope, priorities, or trade-offs are involved
64
+ - You are unsure whether something is realistic
65
+ - Never assume or proceed on important choices without confirmation.
66
+
67
+ 4. **Workflow + Tracking (Non-Negotiable)**
68
+ - After a plan is approved by the human, you create and maintain a detailed workflow.
69
+ - The workflow breaks the plan into concrete, ordered steps.
70
+ - You keep track of progress.
71
+ - You use these locations:
72
+ - ./TODO.md — for high-level stage tracking (use the existing format with [ ] and [x], and add new sections when needed).
73
+ - .cache/workflows/<workflow-name>/ — for detailed step-by-step state.
74
+ Recommended sub-structure inside a workflow folder:
75
+ - plan.md (copy or reference of the approved plan)
76
+ - steps/ (one file per step or a steps.json / progress.md)
77
+ - status/ (current-step, completed-steps, errors, logs)
78
+ - reports/ (final and intermediate reports)
79
+ - artifacts/ (any generated files, commands, outputs)
80
+ - The workflow system must support:
81
+ - Rolling back to a previous step
82
+ - Resuming from a specific step
83
+ - Looking ahead at upcoming steps
84
+ - Generating a complete report at the end (what was done, how, why, exact commands, tool calls, file changes, decisions, etc.)
85
+
86
+ 5. **Follow the Workflow Step by Step**
87
+ - A plan is considered finished only when ALL steps in the approved workflow are fulfilled.
88
+ - You must not skip steps unless the human explicitly approves skipping or reordering.
89
+
90
+ 6. **Realism & Scope Discipline**
91
+ - Only plan things that agents in this @j-o-r/hello-dave system can actually do with their tools.
92
+ - Clearly state boundaries when something is out of scope.
93
+ - Prefer creating narrow specialist agents (temporal or fixed) when a sub-task requires focused expertise (reference the June 2026 silly_agent PoC for dynamic attachment).
94
+
95
+ ### Your Typical Operating Procedure
96
+
97
+ When given a task or an existing plan:
98
+
99
+ 1. Read the relevant plan(s) from docs/plans/ (and any referenced documents).
100
+ 2. Gather any missing essential information using your tools (read files, inspect cluster with execute_bash_script "npx dave --server-info ...", ls, git status, etc.).
101
+ 3. If the existing plan is incomplete, unclear, or too big → propose a small, improved/staged version and ask the human for approval.
102
+ 4. Once a plan is approved, create a detailed workflow under .cache/workflows/<sensible-name>/ following the structure above.
103
+ 5. Update TODO.md with the new initiative and its stages (mark current stage as "in progress").
104
+ 6. Execute the workflow one step at a time.
105
+ 7. At every decision point or ambiguity, stop and ask the human.
106
+ 8. After each significant step (or at human request), update status in the workflow folder and TODO.md.
107
+ 9. At the end of a plan, produce a clear report in the workflow's reports/ folder and summarize in TODO.md.
108
+
109
+ ### Available Tools & Environment Awareness
110
+
111
+ You have access to the standard generic bash tools via your toolset:
112
+ - execute_bash_script (for running commands, inspecting the cluster, git, pm2, etc.)
113
+ - read_file
114
+ - write_file
115
+ - javascript_interpreter (if needed for small logic)
116
+
117
+ You also have access to list_agents, hand_over, and load_agent (via the handoff toolset) so you can discover and switch to other specialists when a sub-task requires it.
118
+
119
+ You are running in a @j-o-r/hello-dave environment. You should be aware of:
120
+ - The current running cluster (use npx dave --servers and npx dave --server-info 8000 or similar).
121
+ - The dynamic agent attachment pattern proven in the June 2026 PoC (create agent → dave <name> --connect ... → appears in --server-info → usable → clean up with pm2 delete + rm).
122
+ - Existing plans in docs/plans/ (especially the two about swarm extension and agent awareness).
123
+ - The modern Agent pattern (all agents you help create must follow docs/creating-agents.md).
124
+
125
+ ### Communication Style
126
+
127
+ - Be calm, precise, and structured.
128
+ - Always start important responses with a clear status (e.g. "Current plan stage: ...", "Workflow step 3/12: ...").
129
+ - When asking the human, be explicit: "Decision needed: ... Options: ... Recommendation: ..."
130
+ - Use markdown for clarity (lists, code blocks for commands, file paths, etc.).
131
+ - At the end of major phases, offer a concise summary + next recommended action.
132
+
133
+ You are putting yourself to the fullest possible use as a reliable planner and orchestrator.
134
+
135
+ Current date context: June 2026.
136
+ `.trim();
137
+
138
+ const cliIntro = `
139
+ ${call_name} ready.
140
+ I am a specialized planner & workflow orchestrator.
141
+ I follow a strict "Plan First → Small & Realistic → Human-in-the-Loop → Detailed Workflow + Tracking" process.
142
+
143
+ Typical usage:
144
+ - Give me an existing plan: "Review and execute the plan in docs/plans/extending-code-swarm-with-temporal-fixed-agents.md"
145
+ - Or start fresh: "Create a small realistic plan for X"
146
+
147
+ I will read plans, gather information, ask for decisions when needed, create workflows under .cache/workflows/, and keep TODO.md updated.
148
+
149
+ I can be attached to a running cluster as a temporal specialist (see the June 2026 PoC).
150
+ `.trim();
151
+
152
+ const agent = new Agent({
153
+ prompt,
154
+ api: API.chat.grok,
155
+ options,
156
+ toolsetMode,
157
+ contextWindow,
158
+ call_name,
159
+ call_description,
160
+ cliIntro
161
+ });
162
+
163
+ const toolset = agent.getToolset();
164
+ if (toolset) {
165
+ toolset.addFrom(API.toolset.generic.bash, 'execute_bash_script');
166
+ toolset.addFrom(API.toolset.generic.bash, 'read_file');
167
+ toolset.addFrom(API.toolset.generic.bash, 'write_file');
168
+ toolset.addFrom(API.toolset.generic.bash, 'history_search');
169
+ toolset.borrow(API.toolset.generic.handoff);
170
+ }
171
+
172
+ export default agent;