@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
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
# Creating ToolSets
|
|
2
|
+
|
|
3
|
+
This document describes the current project pattern for creating `ToolSet` wrappers around API modules and other helper functions.
|
|
4
|
+
|
|
5
|
+
The main goal is:
|
|
6
|
+
|
|
7
|
+
> A tool response must be self-describing enough that the model can write a normal assistant message containing the important follow-up references before old raw `function_call` / `function_response` history is pruned.
|
|
8
|
+
|
|
9
|
+
This keeps prompts compact while preserving durable IDs, URLs, paths, statuses, and other handles in normal conversation history.
|
|
10
|
+
|
|
11
|
+
## Why this pattern exists
|
|
12
|
+
|
|
13
|
+
`Prompt.pruneResolvedFunctionCallsExceptLast()` removes old resolved tool I/O from prompt history. This prevents repeated tool transcripts, large JSON outputs, command logs, buffers, and stale function-call messages from polluting future requests.
|
|
14
|
+
|
|
15
|
+
However, pruning is only safe if the important facts from the tool result are preserved elsewhere. The intended flow is:
|
|
16
|
+
|
|
17
|
+
```txt
|
|
18
|
+
assistant: function_call create_video_openai(...)
|
|
19
|
+
tool: function_response { "videoId": "vid_123", ... }
|
|
20
|
+
assistant: Created the video. The videoId is `vid_123`.
|
|
21
|
+
--- later: old resolved function call/response may be pruned ---
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Do not rely on old raw tool outputs as long-term memory. Toolsets must help the assistant preserve important references in ordinary assistant text.
|
|
25
|
+
|
|
26
|
+
## Required tool response style
|
|
27
|
+
|
|
28
|
+
Every tool should return a compact, structured JSON string, not a bare string or raw wrapper object.
|
|
29
|
+
|
|
30
|
+
Use a local helper:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
/**
|
|
34
|
+
* Serialize a tool response as pretty JSON for function-call output.
|
|
35
|
+
*
|
|
36
|
+
* @param {Record<string, unknown>} payload - JSON-serializable response payload.
|
|
37
|
+
* @returns {string} Pretty JSON response.
|
|
38
|
+
*/
|
|
39
|
+
function json(payload) {
|
|
40
|
+
return JSON.stringify(payload, null, 2);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
A good tool response includes:
|
|
45
|
+
|
|
46
|
+
- `tool`: the function-call name;
|
|
47
|
+
- `success`: boolean when meaningful;
|
|
48
|
+
- exact durable references:
|
|
49
|
+
- `id`, `*_id`, `*Id`;
|
|
50
|
+
- `url`, `*_url`, `*Url`;
|
|
51
|
+
- `image_url`, `audio_url`, `video_url`;
|
|
52
|
+
- `file_id`, `task_id`, `request_id`, `trace_id`;
|
|
53
|
+
- `local_path`, `localPath`, `local_paths`;
|
|
54
|
+
- pagination cursors;
|
|
55
|
+
- operation status, e.g. `status`, `finish_reason`;
|
|
56
|
+
- source references, e.g. `sourceVideoId`, `source_image_url`, `source_audio_url`;
|
|
57
|
+
- new output references, clearly distinguished from source references;
|
|
58
|
+
- a short `message` or `note` telling the assistant what to preserve in its normal response.
|
|
59
|
+
|
|
60
|
+
Example:
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
return json({
|
|
64
|
+
tool: 'create_video_openai',
|
|
65
|
+
success: true,
|
|
66
|
+
videoId: result.id,
|
|
67
|
+
id: result.id,
|
|
68
|
+
status: result.status,
|
|
69
|
+
prompt: params.prompt,
|
|
70
|
+
note: 'Assistant: tell the user the exact videoId. Use videoId for retrieve, download, edit, extend, remix, or delete follow-up calls.'
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Tool descriptions must guide the assistant
|
|
75
|
+
|
|
76
|
+
Tool descriptions are part of the model-facing contract. They should state:
|
|
77
|
+
|
|
78
|
+
1. what the tool does;
|
|
79
|
+
2. which input references are preferred;
|
|
80
|
+
3. which output references are important;
|
|
81
|
+
4. what the assistant should repeat in its normal response.
|
|
82
|
+
|
|
83
|
+
Example:
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
tools.add(
|
|
87
|
+
'create_video_openai',
|
|
88
|
+
'Create an OpenAI video from a text prompt. Prefer image_url for visual references when possible. Returns videoId, status, and optional local_path. After success, include the exact videoId in your normal assistant response because it is needed for retrieve/download/edit/extend/remix/delete follow-up calls.',
|
|
89
|
+
schema,
|
|
90
|
+
method
|
|
91
|
+
);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Do not assume the model will infer which ID matters. Tell it explicitly.
|
|
95
|
+
|
|
96
|
+
## Prefer URL-style references where possible
|
|
97
|
+
|
|
98
|
+
For media tools, prefer public URLs or data URLs in the tool schema when the underlying API supports them.
|
|
99
|
+
|
|
100
|
+
Common preferred fields:
|
|
101
|
+
|
|
102
|
+
- `image_url` instead of provider-specific image objects when possible;
|
|
103
|
+
- `audio_url` instead of local binary blobs when possible;
|
|
104
|
+
- `video_url` instead of opaque media response objects when possible;
|
|
105
|
+
- `public_url` for CDN-published assets.
|
|
106
|
+
|
|
107
|
+
If the wrapper needs a provider-specific shape, map the simple tool input internally.
|
|
108
|
+
|
|
109
|
+
Example:
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
/**
|
|
113
|
+
* Build provider options from tool parameters.
|
|
114
|
+
*
|
|
115
|
+
* @param {Record<string, unknown>} params - Tool parameters.
|
|
116
|
+
* @returns {Record<string, unknown>} Provider-specific options.
|
|
117
|
+
*/
|
|
118
|
+
function buildCreateOptions(params) {
|
|
119
|
+
const options = { ...params };
|
|
120
|
+
delete options.prompt;
|
|
121
|
+
delete options.image_url;
|
|
122
|
+
|
|
123
|
+
if (params.image_url) {
|
|
124
|
+
options.input_reference = { image_url: params.image_url };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return options;
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Keep outputs compact
|
|
132
|
+
|
|
133
|
+
Tool responses are sent back to the model. Avoid unnecessary transcript bloat.
|
|
134
|
+
|
|
135
|
+
Do not include:
|
|
136
|
+
|
|
137
|
+
- raw binary buffers;
|
|
138
|
+
- base64 media unless it is explicitly needed as a durable reference;
|
|
139
|
+
- full HTTP response objects;
|
|
140
|
+
- full provider debug payloads;
|
|
141
|
+
- huge command logs when a concise summary is enough;
|
|
142
|
+
- duplicate aliases beyond useful durable forms.
|
|
143
|
+
|
|
144
|
+
Do include:
|
|
145
|
+
|
|
146
|
+
- exact saved file paths;
|
|
147
|
+
- exact public URLs;
|
|
148
|
+
- exact IDs and task handles;
|
|
149
|
+
- byte counts/content types for downloads;
|
|
150
|
+
- concise errors;
|
|
151
|
+
- enough context for the assistant to explain the result.
|
|
152
|
+
|
|
153
|
+
Example download response:
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
return json({
|
|
157
|
+
tool: 'download_video_openai',
|
|
158
|
+
success: true,
|
|
159
|
+
videoId: params.videoId,
|
|
160
|
+
local_path: result.local_path,
|
|
161
|
+
localPath: result.local_path,
|
|
162
|
+
contentType: result.contentType,
|
|
163
|
+
bytes: result.bytes,
|
|
164
|
+
note: 'Assistant: tell the user the exact local_path and videoId.'
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Distinguish source references from output references
|
|
169
|
+
|
|
170
|
+
Edit, remix, extend, inpaint, upscale, and transform operations often take one existing resource and create a new one. The response must make that relationship explicit.
|
|
171
|
+
|
|
172
|
+
Good:
|
|
173
|
+
|
|
174
|
+
```js
|
|
175
|
+
return json({
|
|
176
|
+
tool: 'extend_video_openai',
|
|
177
|
+
success: true,
|
|
178
|
+
sourceVideoId: params.videoId,
|
|
179
|
+
videoId: result.id,
|
|
180
|
+
id: result.id,
|
|
181
|
+
status: result.status,
|
|
182
|
+
note: 'Assistant: tell the user that sourceVideoId is the input video and videoId is the new extended video.'
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Bad:
|
|
187
|
+
|
|
188
|
+
```js
|
|
189
|
+
return result.id;
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Bad responses lose context after pruning and can cause the assistant to reuse the wrong ID.
|
|
193
|
+
|
|
194
|
+
## Error responses should also be structured
|
|
195
|
+
|
|
196
|
+
If a tool catches and returns errors, return a structured payload.
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
return json({
|
|
200
|
+
tool: 'publish_file',
|
|
201
|
+
success: false,
|
|
202
|
+
error: error.message,
|
|
203
|
+
localPath: params.localPath,
|
|
204
|
+
note: 'Assistant: explain the failure and preserve the localPath if the user may retry.'
|
|
205
|
+
});
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`ToolSet.execute()` already catches thrown errors and converts them to an error string. For tools where retry context matters, catching locally and returning JSON can be more helpful.
|
|
209
|
+
|
|
210
|
+
## Recommended file structure
|
|
211
|
+
|
|
212
|
+
A typical toolset file:
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
/**
|
|
216
|
+
* @file lib/API/provider/ExampleToolset.js
|
|
217
|
+
* @module provider/exampleToolset
|
|
218
|
+
* @description ToolSet wrapper for provider example API functions.
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
import ToolSet from '../../ToolSet.js';
|
|
222
|
+
import * as example from './example.js';
|
|
223
|
+
|
|
224
|
+
const tools = new ToolSet('auto');
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Serialize a tool response as pretty JSON for function-call output.
|
|
228
|
+
*
|
|
229
|
+
* @param {Record<string, unknown>} payload - JSON-serializable response payload.
|
|
230
|
+
* @returns {string} Pretty JSON response.
|
|
231
|
+
*/
|
|
232
|
+
function json(payload) {
|
|
233
|
+
return JSON.stringify(payload, null, 2);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Build a compact self-describing response for example tools.
|
|
238
|
+
*
|
|
239
|
+
* @param {string} tool - Tool name.
|
|
240
|
+
* @param {Record<string, unknown>} params - Original tool parameters.
|
|
241
|
+
* @param {Record<string, unknown>} result - Wrapper result.
|
|
242
|
+
* @returns {string} Tool response JSON.
|
|
243
|
+
*/
|
|
244
|
+
function exampleToolResponse(tool, params, result) {
|
|
245
|
+
return json({
|
|
246
|
+
tool,
|
|
247
|
+
success: true,
|
|
248
|
+
id: result.id,
|
|
249
|
+
status: result.status,
|
|
250
|
+
source_url: params.url,
|
|
251
|
+
note: 'Assistant: include exact id, status, and source_url in your normal response if useful for follow-up.'
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
tools.add(
|
|
256
|
+
'example_create',
|
|
257
|
+
'Create an example resource. Returns id and status. After success, include the exact id in your normal assistant response for follow-up calls.',
|
|
258
|
+
{
|
|
259
|
+
type: 'object',
|
|
260
|
+
properties: {
|
|
261
|
+
prompt: {
|
|
262
|
+
type: 'string',
|
|
263
|
+
description: 'Prompt for creating the resource.'
|
|
264
|
+
},
|
|
265
|
+
image_url: {
|
|
266
|
+
type: 'string',
|
|
267
|
+
description: 'Preferred image reference URL when available.'
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
required: ['prompt']
|
|
271
|
+
},
|
|
272
|
+
async (params) => {
|
|
273
|
+
const result = await example.create(params);
|
|
274
|
+
return exampleToolResponse('example_create', params, result);
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
export default tools;
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## JSDoc requirements
|
|
282
|
+
|
|
283
|
+
Use ESM JavaScript and add JSDoc comments for helpers and important functions.
|
|
284
|
+
|
|
285
|
+
At minimum, document:
|
|
286
|
+
|
|
287
|
+
- response helper functions;
|
|
288
|
+
- provider option builders;
|
|
289
|
+
- functions that strip raw/binary data;
|
|
290
|
+
- functions that summarize wrapper results;
|
|
291
|
+
- typedefs for repeated response shapes when useful.
|
|
292
|
+
|
|
293
|
+
Prefer `Record<string, unknown>` for generic JSON-like helper parameters in JSDoc.
|
|
294
|
+
|
|
295
|
+
## Validation checklist
|
|
296
|
+
|
|
297
|
+
Before finishing a toolset change, run:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
node --check lib/path/to/Toolset.js
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Then verify import and registered tool names:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
node --input-type=module -e "import tools from './lib/path/to/Toolset.js'; console.log(tools.length); console.log(tools.list().map(t => t.name).join('\n'));"
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Check that:
|
|
310
|
+
|
|
311
|
+
- every tool name matches `ToolSet` naming rules;
|
|
312
|
+
- every tool has a clear description;
|
|
313
|
+
- schemas have required fields where needed;
|
|
314
|
+
- descriptions prefer URL inputs when possible;
|
|
315
|
+
- responses are JSON strings from `json(...)`;
|
|
316
|
+
- responses preserve durable IDs/URLs/paths/statuses;
|
|
317
|
+
- raw buffers/base64/debug objects are not returned unnecessarily;
|
|
318
|
+
- source IDs and new output IDs are clearly distinguished;
|
|
319
|
+
- response `note` fields tell the assistant what exact references to include in normal text.
|
|
320
|
+
|
|
321
|
+
## Existing examples
|
|
322
|
+
|
|
323
|
+
Good examples of this pattern include:
|
|
324
|
+
|
|
325
|
+
- `lib/API/openai.com/videoToolset.js`
|
|
326
|
+
- `lib/genericToolset.js`
|
|
327
|
+
- `lib/cdnToolset.js`
|
|
328
|
+
- `lib/API/stability.ai/ImageToolset.js`
|
|
329
|
+
- `lib/API/stability.ai/MusicToolset.js`
|
|
330
|
+
- `lib/API/mureka/MusicToolset.js`
|
|
331
|
+
- `lib/API/minimax/ImageToolset.js`
|
|
332
|
+
- `lib/API/minimax/VideoToolset.js`
|
|
333
|
+
- `lib/API/minimax/MusicToolset.js`
|
|
334
|
+
- `lib/API/x.ai/imageToolset.js`
|
|
335
|
+
|
|
336
|
+
Use these files as references when creating new provider toolsets.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Documentation Organization Guidelines
|
|
2
|
+
|
|
3
|
+
**Purpose**
|
|
4
|
+
The `docs/` folder serves two critical roles:
|
|
5
|
+
1. Human-readable reference.
|
|
6
|
+
2. Machine context for agents (`code_agent`, `agent_creator`, etc.).
|
|
7
|
+
|
|
8
|
+
## Framework Documentation Source
|
|
9
|
+
|
|
10
|
+
For `@j-o-r/hello-dave` framework behavior, the authoritative documentation lives only in the `@j-o-r/hello-dave` package docs folder.
|
|
11
|
+
|
|
12
|
+
Valid framework-doc locations are:
|
|
13
|
+
|
|
14
|
+
1. **Direct `@j-o-r/hello-dave` checkout**
|
|
15
|
+
- When CWD is the checked-out `@j-o-r/hello-dave` repository, use CWD-relative docs such as `docs/creating-agents.md`.
|
|
16
|
+
|
|
17
|
+
2. **Installed package usage**
|
|
18
|
+
- In all other projects, use the installed package docs, preferably from `node_modules/@j-o-r/hello-dave/docs`.
|
|
19
|
+
- A global install may be used when no local install is available.
|
|
20
|
+
|
|
21
|
+
Do not treat another project's `docs/` folder as the source of truth for `hello-dave` framework API behavior.
|
|
22
|
+
|
|
23
|
+
## Project-local Documentation
|
|
24
|
+
|
|
25
|
+
Other projects may keep their own `docs/` folders for project-specific conventions, product context, plans, and operational notes.
|
|
26
|
+
|
|
27
|
+
Those docs can guide project work, but they do not replace the `@j-o-r/hello-dave` framework docs for agent-definition patterns, API option shapes, launcher behavior, or toolset conventions.
|
|
28
|
+
|
|
29
|
+
`agent_creator` is dedicated to `@j-o-r/hello-dave` agent definitions. It should read framework guidance from the package docs only: CWD-relative docs when inside the direct checkout, otherwise installed package docs under `node_modules` or a global install.
|
|
30
|
+
|
|
31
|
+
## Folder Structure
|
|
32
|
+
|
|
33
|
+
- Root `docs/` — high-level current framework documents (`creating-agents.md`, `project-overview.md`, `bin-dave.md`, `docs-organization.md`, etc.).
|
|
34
|
+
- `howtos/`, `plans/`, `prompts/`, `_notes/`, `_legacy/`.
|
|
35
|
+
|
|
36
|
+
Follow kebab-case, start every file with `# Title`, use consistent Markdown, and cross-link heavily.
|
|
37
|
+
|
|
38
|
+
## Key Rules
|
|
39
|
+
|
|
40
|
+
- Accuracy first.
|
|
41
|
+
- Read relevant framework docs before significant framework or agent-definition work.
|
|
42
|
+
- Use direct-checkout docs only for this repository; use installed package docs in all other projects.
|
|
43
|
+
- Update docs after changes that affect patterns or architecture.
|
|
44
|
+
- Treat documentation work as first-class.
|
|
45
|
+
|
|
46
|
+
This document lives at `docs/docs-organization.md`.
|
|
47
|
+
|
|
48
|
+
**Current date context**: June 2026.
|
package/docs/project-overview.md
CHANGED
|
@@ -6,62 +6,97 @@ The root contains essential project configuration, documentation, and entry poin
|
|
|
6
6
|
- **TODO.md**: Outstanding tasks and development notes.
|
|
7
7
|
- **package.json**: NPM package metadata, dependencies, and scripts.
|
|
8
8
|
- **LICENSE**: Project license (Apache 2.0).
|
|
9
|
-
- **jsconfig.json** / **tsc.json**: TypeScript/JavaScript configuration
|
|
10
|
-
- **.gitignore** / **.npmignore
|
|
11
|
-
- **workspace.js
|
|
12
|
-
- Directories: `bin/`, `docs/`, `agents/`, `lib/`, `scenarios/`, `types/`, `utils/`, `release/`, `node_modules/`, `.cache
|
|
9
|
+
- **jsconfig.json** / **tsc.json**: TypeScript/JavaScript configuration.
|
|
10
|
+
- **.gitignore** / **.npmignore**.
|
|
11
|
+
- **workspace.js**.
|
|
12
|
+
- Directories: `bin/`, `docs/`, `agents/`, `lib/`, `scenarios/`, `types/`, `utils/`, `release/`, `node_modules/`, `.cache/`.
|
|
13
13
|
|
|
14
14
|
## bin/
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- `code_agent.js`: Code-related agent.
|
|
19
|
-
- `prompt_agent.js`, `docs_agent.js`: Prompt engineering and docs management.
|
|
20
|
-
- `readme_agent.js`, `todo_agent.js`: Project maintenance (README/TODO).
|
|
21
|
-
- `npm_agent.js`: NPM module inspection/publishing.
|
|
22
|
-
- Others: `format_agent.js`, `clear_agent.js`, `CodeServer`.
|
|
15
|
+
- `bin/dave.js` (the `dave` binary).
|
|
16
|
+
- Early bare-name delegation to `AgentLauncher` for `*_agent.js` files.
|
|
17
|
+
- Limited built-in commands for cache/session management and discovery.
|
|
23
18
|
|
|
24
19
|
## lib/
|
|
25
|
-
Core library
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
20
|
+
Core library (named exports from `lib/index.js`):
|
|
21
|
+
|
|
22
|
+
**Current primary components**:
|
|
23
|
+
- `Agent.js` — Unified minimal Agent class (prompt + api + call_name + call_description). Designed for clean handoff.
|
|
24
|
+
- `AgentLauncher.js` — Discovery, loading, execution, and in-process handoff (fresh context only).
|
|
25
|
+
- `Prompt.js`, `ToolSet.js`, `Session.js`, `Cli.js`
|
|
26
|
+
- `agentLoader.js`
|
|
27
|
+
- `genericToolset.js`, `handOffToolset.js`, `cdnToolset.js`
|
|
28
|
+
- `API/` (providers + toolsets)
|
|
29
|
+
- `fafs.js`, `promptHelpers.js`
|
|
30
|
+
|
|
31
|
+
**Session model (current and future)**:
|
|
32
|
+
- Interactive CLI provides rich in-memory session continuation with Alt shortcuts (reset, load session, info, etc.).
|
|
33
|
+
- One-shot calls (`dave <agent> "message"`) are independent processes.
|
|
34
|
+
- **Primary direction (no background services)**: Session continuation for one-shots is achieved via explicit CLI flags (`--list-sessions`, `--load-session`, `--reset-session`, `--session-info`, `--session-help`) plus a lightweight per-agent "current session pointer" file. Every invocation is a fresh short-lived process. See `docs/plans/no-service-session-continuation.md`.
|
|
35
|
+
- Previous exploration of file sockets for live attachment has been deprioritized in favor of the zero-service flag-based approach.
|
|
36
|
+
|
|
37
|
+
**Legacy / de-emphasized** (still present but not the primary path):
|
|
38
|
+
- `AgentServer.js`, `AgentClient.js`, `Swarm.js`, `wsIO.js`, `wsCli.js` — from the previous WebSocket swarm / CodeServer model (abandoned).
|
|
39
|
+
|
|
40
|
+
## Agent Workflow (Current)
|
|
41
|
+
|
|
42
|
+
Agents are built with the `Agent` class and executed via `AgentLauncher`:
|
|
43
|
+
- `dave <name>` → interactive CLI or one-shot.
|
|
44
|
+
- Handoffs via `hand_over` / `load_agent` tools (from `API.toolset.generic.handoff`).
|
|
45
|
+
- Fresh handoff: receiving agent gets only its own system prompt + short task-focused context (no history copied).
|
|
46
|
+
- Self-reset supported for deliberate fresh starts.
|
|
47
|
+
|
|
48
|
+
Old WS server/client/hybrid modes are no longer the focus.
|
|
49
|
+
|
|
50
|
+
**Session continuation strategy**:
|
|
51
|
+
- Interactive: natural in-memory continuation via the live `Cli`.
|
|
52
|
+
- One-shot / scripting: explicit flags + pointer file to preload previous session history from the existing NDJSON storage. No daemons or listeners.
|
|
53
|
+
|
|
54
|
+
## Creating Agents
|
|
55
|
+
|
|
56
|
+
**Canonical guide**: **[docs/creating-agents.md](creating-agents.md)**
|
|
57
|
+
|
|
58
|
+
Core requirements:
|
|
59
|
+
- `Agent.deriveCallName(import.meta.url)`
|
|
60
|
+
- `new Agent({ ... call_name, call_description ... })`
|
|
61
|
+
- `export default agent;`
|
|
62
|
+
- Optional sibling `.prompt.md` + `Agent.loadPrompt(import.meta.url)`
|
|
63
|
+
- Register tools + `toolset.borrow(API.toolset.generic.handoff)` for collaboration
|
|
64
|
+
|
|
65
|
+
## Documentation
|
|
66
|
+
|
|
67
|
+
Follow **[docs/docs-organization.md](docs-organization.md)**.
|
|
68
|
+
|
|
69
|
+
**Current / active documents** (root `docs/` and subdirs):
|
|
70
|
+
- `creating-agents.md` (the standard)
|
|
71
|
+
- `bin-dave.md`
|
|
72
|
+
- `project-overview.md` (this file)
|
|
73
|
+
- `toolset.md`, `generic-toolset.md`
|
|
74
|
+
- `docs-organization.md`
|
|
75
|
+
- `howtos/`, `plans/`, `prompts/`
|
|
76
|
+
- `plans/no-service-session-continuation.md` (primary session strategy for one-shots)
|
|
77
|
+
- `plans/agent-file-socket-communication.md` (earlier exploration, superseded for the no-service requirement)
|
|
78
|
+
|
|
79
|
+
**Legacy documents** (abandoned WS/swarm/CodeServer model):
|
|
80
|
+
- Located in `docs/_legacy/`
|
|
81
|
+
- `multi-agent-clusters.md`
|
|
82
|
+
- `codeserver-pattern.md`
|
|
83
|
+
- `agent-networking.md`
|
|
84
|
+
- `agent-dave-websocket-protocol.md`
|
|
85
|
+
|
|
86
|
+
These are kept only for historical reference. New work must not rely on the patterns they describe. All legacy files start with a clear "Legacy / Historical" notice and redirect to current docs.
|
|
58
87
|
|
|
59
88
|
## Other Directories
|
|
60
|
-
- **agents/**:
|
|
61
|
-
- **scenarios
|
|
62
|
-
- **types/**: TypeScript `.d.ts` files.
|
|
63
|
-
- **utils/**: Miscellaneous utilities.
|
|
64
|
-
- **release/**: NPM pack artifacts.
|
|
89
|
+
- **agents/**: Discoverable agents (all follow the modern `Agent` pattern).
|
|
90
|
+
- **scenarios/**, **types/**, **utils/**.
|
|
65
91
|
|
|
66
92
|
## Summary
|
|
67
|
-
|
|
93
|
+
|
|
94
|
+
`@j-o-r/hello-dave` is a lightweight ESM toolkit for tool-using AI agents with unified access to Grok / OpenAI / Anthropic.
|
|
95
|
+
|
|
96
|
+
**Current focus**: Clean `Agent` + `AgentLauncher` + rich toolsets + in-process handoff + practical session continuation for one-shots **without any background services**.
|
|
97
|
+
|
|
98
|
+
The architecture was deliberately simplified in 2026 by removing the complex persistent WebSocket cluster layer.
|
|
99
|
+
|
|
100
|
+
**Import**: `import { Agent, AgentLauncher, API, ... } from '@j-o-r/hello-dave';`
|
|
101
|
+
|
|
102
|
+
*Last updated: June 2026 (session continuation strategy clarified to no-service flag-based model)*
|