@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
package/types/Cli.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export default Cli;
2
- export type OARequest = typeof import("./API/openai.com/reponses/text.js").request;
3
- export type XRequest = typeof import("./API/x.ai/text.js").request;
2
+ export type OARequest = any;
3
+ export type XRequest = any;
4
4
  export type ANTHRequest = typeof import("./API/anthropic.com/text.js").request;
5
- export type XOptions = import("./API/x.ai/text.js").XOptions;
6
- export type OAOptions = import("./API/openai.com/reponses/text.js").OAOptions;
5
+ export type XOptions = any;
6
+ export type OAOptions = any;
7
7
  export type ANTHOptions = import("./API/anthropic.com/text.js").ANTHOptions;
8
8
  export type Prompt = import("./Prompt.js").default;
9
9
  export type Session = import("./Session.js").default;
@@ -44,6 +44,8 @@ export type CLIOptions = {
44
44
  * - Event-driven updates from Prompt (messages, truncated, finished).
45
45
  * - Built-in help, reset, load session, copy last message (Alt+m).
46
46
  * - Customizable intro/help via options.
47
+ * - Supports rebinding to a new Prompt/Session (for in-process agent handoff) without creating a new CLI instance.
48
+ * Use rebind() then start(initialContext) for clean handoff.
47
49
  *
48
50
  * @example
49
51
  * const cli = new Cli({ prompt: myPrompt, session: mySession });
@@ -61,6 +63,23 @@ declare class Cli {
61
63
  * @throws {Error} If required prompt or session is missing.
62
64
  */
63
65
  constructor(options: CLIOptions);
66
+ /**
67
+ * Rebind this CLI instance to a new Prompt and Session (used for in-process agent handoff).
68
+ *
69
+ * - Unbinds listeners from the old prompt.
70
+ * - Updates internal prompt/session references.
71
+ * - Updates the assistant role prefix to the new agent's name.
72
+ * - Re-attaches prompt event listeners to the *new* prompt.
73
+ * - Optionally updates the description shown on next start().
74
+ *
75
+ * Does **not** re-register global key mappings or inputHandler (prevents duplication and double-typing).
76
+ * Does **not** call start(). Caller should call start() (optionally with initial context) afterwards.
77
+ *
78
+ * @param {Prompt} newPrompt
79
+ * @param {Session} newSession
80
+ * @param {string} [newDescription] - Optional new description/intro (banner + agent info). If omitted, keeps previous.
81
+ */
82
+ rebind(newPrompt: Prompt, newSession: Session, newDescription?: string): void;
64
83
  /**
65
84
  * Prints detailed info about current session and prompt, plus description.
66
85
  * Triggered by Alt+i.
@@ -68,11 +87,12 @@ declare class Cli {
68
87
  printInfo(): void;
69
88
  /**
70
89
  * Starts the CLI: Shows intro/description, focuses user input, optionally processes initial message.
71
- * @param {string} [s] - Optional initial user message to process.
90
+ *
91
+ * When called with a string `s` (e.g. handoff context), the context is shown as a user message
92
+ * and then processed. This makes the injected handoff context visible in the terminal.
93
+ *
94
+ * @param {string} [s] - Optional initial user message / handoff context to process.
72
95
  * @returns {Promise<void>}
73
- * @example
74
- * await cli.start(); // Interactive mode
75
- * await cli.start('What is the weather?'); // Start with query
76
96
  */
77
97
  start(s?: string): Promise<void>;
78
98
  /**
package/types/Prompt.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export default Prompt;
2
- export type OARequest = typeof import("./API/openai.com/reponses/text.js").request;
3
- export type XRequest = typeof import("./API/x.ai/text.js").request;
2
+ export type OARequest = any;
3
+ export type XRequest = any;
4
4
  export type XAIRequest = typeof import("./API/x.ai/responses.js").request;
5
5
  export type ANTHRequest = typeof import("./API/anthropic.com/text.js").request;
6
- export type XOptions = import("./API/x.ai/text.js").XOptions;
6
+ export type XOptions = any;
7
7
  export type XAIOptions = import("./API/x.ai/responses.js").XAIOptions;
8
- export type OAOptions = import("./API/openai.com/reponses/text.js").OAOptions;
8
+ export type OAOptions = any;
9
9
  export type ANTHOptions = import("./API/anthropic.com/text.js").ANTHOptions;
10
10
  export type ToolSet = import("./ToolSet.js").default;
11
11
  /**
@@ -176,7 +176,7 @@ export type Message = {
176
176
  * @fires Prompt#http_request - HTTP tool request starts
177
177
  * @fires Prompt#http_response - HTTP tool response received
178
178
  */
179
- declare class Prompt {
179
+ declare class Prompt extends EventEmitter<any> {
180
180
  /**
181
181
  * Constructs a new Prompt instance.
182
182
  * If contextWindow = 0 (defaut) the prompt will have no context building up (ONE_SHOT)
@@ -261,6 +261,23 @@ declare class Prompt {
261
261
  * @param returns {number}
262
262
  */
263
263
  countTokens(str?: string): number;
264
+ /**
265
+ * Prune resolved function-call I/O from the prompt history, keeping only the
266
+ * most recent complete function request/response pair.
267
+ *
268
+ * A resolved function call is an assistant `function_request` that has a
269
+ * matching tool `function_response` by `call_id` (or `id` fallback). Older
270
+ * resolved pairs are removed from their messages; empty assistant/tool
271
+ * messages are removed entirely. Unresolved function calls and normal
272
+ * user/assistant text messages are preserved.
273
+ *
274
+ * This is useful before serializing history for providers such as the OpenAI
275
+ * Responses API, where repeatedly sending all historical tool transcripts can
276
+ * pollute context and waste tokens.
277
+ *
278
+ * @returns {boolean} True when the prompt history was changed.
279
+ */
280
+ pruneResolvedFunctionCallsExceptLast(): boolean;
264
281
  /**
265
282
  * reduce the prompt length to fit in the contextWindow
266
283
  * or simply reset when there is no contextWindow
@@ -330,3 +347,4 @@ declare class Prompt {
330
347
  info(): string;
331
348
  #private;
332
349
  }
350
+ import { EventEmitter } from 'node:events';
@@ -11,7 +11,7 @@ declare class Session {
11
11
  *
12
12
  * @param {string} name - The name of the prompt.
13
13
  * @param {Prompt} prompt - The Prompt instance.
14
- * @param {string} [storage] - The base storage folder; defaults to process.cwd()/.cache/hello-dave.
14
+ * @param {string} [storage] - The base storage folder; defaults to process.cwd()/.cache/@j-o-r/hello-dave.
15
15
  */
16
16
  constructor(name: string, prompt: Prompt, storage?: string);
17
17
  /** @type {string} Sanitized prompt name (public readonly). */
@@ -96,6 +96,16 @@ declare class ToolSet {
96
96
  * @returns {ToolSet} Returns this instance to allow chaining
97
97
  */
98
98
  borrow(sourceToolSet: ToolSet): ToolSet;
99
+ /**
100
+ * Copies ONE tool from another ToolSet into this one.
101
+ * Optionally renames it to avoid name conflicts.
102
+ *
103
+ * @param {ToolSet} sourceToolSet - The source ToolSet
104
+ * @param {string} sourceName - Name of the tool in the source ToolSet
105
+ * @param {string} [newName] - Optional new name for the tool in this ToolSet
106
+ * @returns {ToolSet} Returns this instance for chaining
107
+ */
108
+ addFrom(sourceToolSet: ToolSet, sourceName: string, newName?: string): ToolSet;
99
109
  /**
100
110
  * Getter for the current tool choice setting.
101
111
  * @returns {string} The tool choice: 'auto', 'none', or 'required'
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Find the nearest package root by walking upward until package.json is found.
3
+ *
4
+ * @param {string|URL} from - Starting file path, directory path, or file URL.
5
+ * @returns {Promise<string|null>} Package root path, or null.
6
+ */
7
+ export function findNearestPackageRoot(from: string | URL): Promise<string | null>;
8
+ /**
9
+ * Build ordered agent directory candidates.
10
+ *
11
+ * When `options.from` is supplied, discovery is intentionally strict: the only
12
+ * directory searched is the `agents` directory under the nearest package root
13
+ * found from that caller module URL/path.
14
+ *
15
+ * @param {AgentLoaderOptions} [options={}] - Loader options.
16
+ * @returns {Promise<string[]>} Absolute agent directory candidates.
17
+ */
18
+ export function getAgentDirs(options?: AgentLoaderOptions): Promise<string[]>;
19
+ /**
20
+ * Discover all available agents by performing a lightweight filesystem scan.
21
+ *
22
+ * @param {AgentLoaderOptions} [options={}] - Loader options.
23
+ * @returns {Promise<Array<{name: string, path: string, desc: string}>>}
24
+ * Array of discovered agents.
25
+ */
26
+ export function listAgents(options?: AgentLoaderOptions): Promise<Array<{
27
+ name: string;
28
+ path: string;
29
+ desc: string;
30
+ }>>;
31
+ /**
32
+ * Resolve the absolute path to an agent module by name.
33
+ *
34
+ * @param {string} agentName - The agent identifier or safe direct path.
35
+ * @param {AgentLoaderOptions} [options={}] - Loader options.
36
+ * @returns {Promise<string>} Absolute path to the matching .js file.
37
+ */
38
+ export function resolveAgentPath(agentName: string, options?: AgentLoaderOptions): Promise<string>;
39
+ /**
40
+ * Load (import + validate) a clean Agent instance by name.
41
+ *
42
+ * @param {string} agentName - Agent identifier to load.
43
+ * @param {Array<any>} [extraArgs=[]] - Optional factory arguments.
44
+ * @param {AgentLoaderOptions} [options={}] - Loader options.
45
+ * @returns {Promise<import('./Agent.js').default>} Loaded Agent instance.
46
+ */
47
+ export function loadAgent(agentName: string, extraArgs?: Array<any>, options?: AgentLoaderOptions): Promise<import("./Agent.js").default>;
48
+ /**
49
+ * Create an isolated agent loader bound to a caller/project context.
50
+ *
51
+ * @param {AgentLoaderOptions} [options={}] - Loader options.
52
+ * @returns {{
53
+ * getAgentDirs: () => Promise<string[]>,
54
+ * listAgents: () => Promise<Array<{name: string, path: string, desc: string}>>,
55
+ * resolveAgentPath: (agentName: string) => Promise<string>,
56
+ * loadAgent: (agentName: string, extraArgs?: Array<any>) => Promise<import('./Agent.js').default>
57
+ * }} Configured loader API.
58
+ */
59
+ export function createAgentLoader(options?: AgentLoaderOptions): {
60
+ getAgentDirs: () => Promise<string[]>;
61
+ listAgents: () => Promise<Array<{
62
+ name: string;
63
+ path: string;
64
+ desc: string;
65
+ }>>;
66
+ resolveAgentPath: (agentName: string) => Promise<string>;
67
+ loadAgent: (agentName: string, extraArgs?: Array<any>) => Promise<import("./Agent.js").default>;
68
+ };
69
+ export type AgentLoaderOptions = {
70
+ /**
71
+ * - Caller module URL/path, usually caller import.meta.url.
72
+ */
73
+ from?: string | URL | undefined;
74
+ /**
75
+ * - Explicit agent directories. Used only when `from` is not supplied.
76
+ */
77
+ agentDirs?: (string | URL)[] | undefined;
78
+ };
package/types/cdn.d.ts CHANGED
@@ -1,11 +1,7 @@
1
1
  declare namespace _default {
2
2
  export { getSshConfig };
3
- export { ensureRemoteDir };
4
- export { ensureProjectStructure };
5
- export { listProjects };
6
- export { deleteProject };
7
3
  export { publishFile };
8
- export { publishToProject };
4
+ export { unpublishFile };
9
5
  }
10
6
  export default _default;
11
7
  /**
@@ -20,7 +16,7 @@ export default _default;
20
16
  *
21
17
  * @example
22
18
  * // Required environment variable:
23
- * // export SSH_EP='ssh://jorrit@drive.duin.xyz:4301'
19
+ * // export SSH_EP='ssh://user@your-cdn.example.com:4301'
24
20
  */
25
21
  export function getSshConfig(): {
26
22
  user: string;
@@ -29,61 +25,8 @@ export function getSshConfig(): {
29
25
  raw: string;
30
26
  };
31
27
  /**
32
- * Ensure a remote directory exists under `htdocs/`.
33
- * Creates all parent directories as needed (`mkdir -p`).
34
- *
35
- * @param {string} remoteRelativeDir - Relative path under htdocs (e.g. "tmp/cdn-demo-123" or "projects/my-project")
36
- * @returns {Promise<string>} The full remote directory path (e.g. "htdocs/tmp/cdn-demo-123")
37
- */
38
- export function ensureRemoteDir(remoteRelativeDir: string): Promise<string>;
39
- /**
40
- * Ensure the remote project directory structure exists.
41
- * Creates `htdocs/projects/<slug>` (and the `generated` subfolder).
42
- *
43
- * @param {string} projectSlug - Project identifier (will be sanitized)
44
- * @returns {Promise<string>} The remote directory path under htdocs
45
- */
46
- export function ensureProjectStructure(projectSlug: string): Promise<string>;
47
- /**
48
- * List all existing projects on the remote server.
49
- *
50
- * Scans the `htdocs/projects/` directory and returns metadata for each project.
51
- * Useful when starting without prior context about what has already been published.
52
- *
53
- * @returns {Promise<Array<{slug: string, url: string, fileCount: number, created?: string}>>}
54
- * Array of project objects.
55
- *
56
- * @throws {Error} If the SSH connection or directory listing fails.
57
- *
58
- * @example
59
- * const projects = await cdn.listProjects();
60
- * console.log(projects[0].url); // https://drive.duin.xyz/projects/my-project/
61
- */
62
- export function listProjects(): Promise<Array<{
63
- slug: string;
64
- url: string;
65
- fileCount: number;
66
- created?: string;
67
- }>>;
68
- /**
69
- * Delete an entire project folder from the remote server.
70
- *
71
- * Permanently removes `htdocs/projects/<slug>` and all its contents.
72
- * Use with caution — this operation cannot be undone.
73
- *
74
- * @param {string} projectSlug - Project identifier (will be sanitized to kebab-case)
75
- * @returns {Promise<{deleted: boolean, project: string}>}
76
- *
77
- * @example
78
- * await cdn.deleteProject('my-old-project');
79
- */
80
- export function deleteProject(projectSlug: string): Promise<{
81
- deleted: boolean;
82
- project: string;
83
- }>;
84
- /**
85
- * Publish a single local file to an arbitrary location on the public CDN.
86
- *
28
+ * Publish a single local file to an arbitrary temp location on the public CDN.
29
+ * this folder is cleared regulary.
87
30
  * Automatically creates any missing parent directories.
88
31
  * Returns a direct public HTTPS URL.
89
32
  *
@@ -104,38 +47,20 @@ export function publishFile(localPath: string, remoteRelativePath: string): Prom
104
47
  remote_path: string;
105
48
  }>;
106
49
  /**
107
- * Publish one or more local files into an organized project folder on the public CDN.
108
- *
109
- * Supports both single file (string) and multiple files (array).
110
- * Automatically creates the project directory and generates `meta.json`.
111
- * Optional `description.md` and `plan.md` files can be created.
50
+ * Delete a previously published file from the public CDN temp folder.
112
51
  *
113
- * @param {string|string[]} localPaths - Single path or array of local file paths
114
- * @param {string} projectSlug - Project identifier (sanitized to kebab-case)
115
- * @param {Object} [options]
116
- * @param {string} [options.description] - Human-readable project description
117
- * @param {string} [options.plan] - Planning notes or step-by-step evolution
118
- * @param {string} [options.filename] - Custom filename (only used when uploading a single file)
52
+ * The target path is resolved relative to `htdocs/aaztmp/`. Missing files are
53
+ * treated as already unpublished because `rm -f` is used.
119
54
  *
120
- * @returns {Promise<{public_urls: string[], project_folder: string, meta: object}>}
55
+ * @param {string} remoteRelativePath - File path under htdocs/aaztmp (e.g. "tmp/quick-reference.mp3")
56
+ * @returns {Promise<{public_url: string, remote_path: string, unpublished: boolean}>}
121
57
  *
122
58
  * @example
123
- * // Multiple files
124
- * const result = await cdn.publishToProject(
125
- * ['audio.mp3', 'cover.jpg'],
126
- * 'my-project',
127
- * { description: 'Music cover project' }
128
- * );
129
- *
130
- * // Single file with custom name
131
- * await cdn.publishToProject('/tmp/file.mp3', 'my-project', { filename: 'final.mp3' });
59
+ * const result = await cdn.unpublishFile('tmp/quick-reference.mp3');
60
+ * console.log(result.unpublished);
132
61
  */
133
- export function publishToProject(localPaths: string | string[], projectSlug: string, options?: {
134
- description?: string | undefined;
135
- plan?: string | undefined;
136
- filename?: string | undefined;
137
- }): Promise<{
138
- public_urls: string[];
139
- project_folder: string;
140
- meta: object;
62
+ export function unpublishFile(remoteRelativePath: string): Promise<{
63
+ public_url: string;
64
+ remote_path: string;
65
+ unpublished: boolean;
141
66
  }>;
@@ -0,0 +1,9 @@
1
+ export { createHandOffToolset };
2
+ export default defaultToolsets;
3
+ import { createHandOffToolset } from './handOffToolset.js';
4
+ /**
5
+ * Default framework-owned toolset tree exposed as API.toolset.
6
+ *
7
+ * @type {Record<string, Record<string, any>>}
8
+ */
9
+ declare const defaultToolsets: Record<string, Record<string, any>>;
package/types/fafs.d.ts CHANGED
@@ -68,7 +68,7 @@ import { jsType } from '@j-o-r/sh';
68
68
  export const GLOBAL: Object;
69
69
  /**
70
70
  * Gathers comprehensive environment information: user name, fresh system details, IP-based geolocation,
71
- * and normalized current working directory. Results are cached in ~/.cache/hello-dave/env for 31 days,
71
+ * and normalized current working directory. Results are cached in ~/.cache/@j-o-r/hello-dave/env for 31 days,
72
72
  * refreshed on expiry. On cache hit, updates with fresh system info and cwd.
73
73
  *
74
74
  * @returns {Promise<EnvironmentInfo>} The environment information object.
@@ -1,3 +1,3 @@
1
1
  export default tools;
2
2
  declare const tools: ToolSet;
3
- import { ToolSet } from './index.js';
3
+ import ToolSet from './ToolSet.js';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Configure the singleton handoff toolset used by API.toolset.generic.handoff.
3
+ *
4
+ * This keeps existing agent code working while allowing AgentLauncher instances
5
+ * created with `{ from: import.meta.url }` to make `list_agents` use the same
6
+ * project-aware loader as handoff loading.
7
+ *
8
+ * @param {HandOffToolsetOptions} options - Handoff toolset options.
9
+ * @returns {void}
10
+ */
11
+ export function configureDefaultHandOffToolset(options?: HandOffToolsetOptions): void;
12
+ /**
13
+ * Create a handoff toolset using the provided agent discovery function.
14
+ *
15
+ * @param {HandOffToolsetOptions} [options={}] - Toolset options.
16
+ * @returns {ToolSet} Configured ToolSet instance.
17
+ */
18
+ export function createHandOffToolset(options?: HandOffToolsetOptions): ToolSet;
19
+ export default handoffTools;
20
+ export type HandOffToolsetOptions = {
21
+ listAgents?: (() => Promise<Array<{
22
+ name: string;
23
+ path: string;
24
+ desc: string;
25
+ }>>) | undefined;
26
+ };
27
+ import ToolSet from './ToolSet.js';
28
+ declare const handoffTools: ToolSet;
package/types/index.d.ts CHANGED
@@ -1,33 +1,35 @@
1
- export { default as CdnToolset } from "./CdnToolset.js";
2
- import AgentManager from './AgentManager.js';
3
- import AgentServer from './AgentServer.js';
4
- import AgentClient from './AgentClient.js';
1
+ import Agent from './Agent.js';
2
+ import AgentLauncher from './AgentLauncher.js';
5
3
  import Prompt from './Prompt.js';
6
4
  import ToolSet from './ToolSet.js';
7
5
  import Session from './Session.js';
8
6
  export namespace API {
9
- export namespace text {
7
+ export namespace chat {
10
8
  export { gpt };
11
- export { xai };
9
+ export { grok };
12
10
  export { claude };
13
11
  }
14
12
  export namespace search {
15
13
  export { brave };
16
14
  }
17
- export { minimax };
18
- export { stability };
19
- export { xaitools };
15
+ export { defaultToolsets as toolset };
20
16
  }
21
17
  import Cli from './Cli.js';
22
18
  import { env } from './fafs.js';
23
19
  import { GLOBAL } from './fafs.js';
24
- import wsCli from '../lib/wsCli.js';
25
- import wsIO from '../lib/wsIO.js';
26
- import { request as gpt } from './API/openai.com/reponses/text.js';
27
- import { request as xai } from './API/x.ai/responses.js';
20
+ import { createAgentLoader } from './agentLoader.js';
21
+ import { createHandOffToolset } from './defaultToolsets.js';
22
+ import { findNearestPackageRoot } from './agentLoader.js';
23
+ import { getAgentDirs } from './agentLoader.js';
24
+ import { listToolsets } from './toolsetLoader.js';
25
+ import { matchesToolsetFilter } from './toolsetLoader.js';
26
+ import { parseToolsetArgs } from './toolsetLoader.js';
27
+ import { renderToolsetList } from './toolsetLoader.js';
28
+ import { renderToolsetsHelp } from './toolsetLoader.js';
29
+ import { shortDescription } from './toolsetLoader.js';
30
+ import { request as gpt } from './API/openai.com/responses.js';
31
+ import { request as grok } from './API/x.ai/responses.js';
28
32
  import { request as claude } from './API/anthropic.com/text.js';
29
33
  import { request as brave } from './API/brave.com/search.js';
30
- import minimax from './API/minimax/index.js';
31
- import stability from './API/stability.ai/index.js';
32
- import xaitools from './API/x.ai/index.js';
33
- export { AgentManager, AgentServer, AgentClient, Prompt, ToolSet, Session, Cli, env, GLOBAL, wsCli, wsIO };
34
+ import defaultToolsets from './defaultToolsets.js';
35
+ export { Agent, AgentLauncher, Prompt, ToolSet, Session, Cli, env, GLOBAL, createAgentLoader, createHandOffToolset, findNearestPackageRoot, getAgentDirs, listToolsets, matchesToolsetFilter, parseToolsetArgs, renderToolsetList, renderToolsetsHelp, shortDescription };
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Shorten a description for compact CLI display.
3
+ *
4
+ * @param {unknown} desc - Description value.
5
+ * @param {number} [maxLen=140] - Maximum length.
6
+ * @returns {string} Shortened description.
7
+ */
8
+ export function shortDescription(desc: unknown, maxLen?: number): string;
9
+ /**
10
+ * Parse toolset CLI arguments.
11
+ *
12
+ * @param {string[]} [argv=process.argv.slice(2)] - Arguments without node/script prefix.
13
+ * @returns {ParsedToolsetArgs} Parsed toolset arguments.
14
+ */
15
+ export function parseToolsetArgs(argv?: string[]): ParsedToolsetArgs;
16
+ /**
17
+ * Check if a display name matches any provided filters.
18
+ *
19
+ * @param {string} displayName - Toolset display name, for example "minimax/music".
20
+ * @param {string[]} [filters=[]] - Filters to apply.
21
+ * @returns {boolean} Whether the display name matches.
22
+ */
23
+ export function matchesToolsetFilter(displayName: string, filters?: string[]): boolean;
24
+ /**
25
+ * List framework/default toolsets directly in the current process.
26
+ *
27
+ * @param {ToolsetListOptions} [options={}] - Listing options.
28
+ * @returns {ToolsetListResult} Structured toolset listing.
29
+ */
30
+ export function listToolsets(options?: ToolsetListOptions): ToolsetListResult;
31
+ /**
32
+ * Render toolset help text.
33
+ *
34
+ * @param {string} [command='dave --toolsets'] - Command shown in examples.
35
+ * @returns {string} Help text.
36
+ */
37
+ export function renderToolsetsHelp(command?: string): string;
38
+ /**
39
+ * Render a human-readable toolset listing.
40
+ *
41
+ * @param {ToolsetListResult} result - Structured toolset listing.
42
+ * @returns {string} Human-readable output.
43
+ */
44
+ export function renderToolsetList(result: ToolsetListResult): string;
45
+ export type ListedTool = {
46
+ /**
47
+ * - Tool name.
48
+ */
49
+ name: string;
50
+ /**
51
+ * - Shortened tool description.
52
+ */
53
+ description: string;
54
+ };
55
+ export type ListedToolset = {
56
+ /**
57
+ * - Display name, for example "minimax/music".
58
+ */
59
+ name: string;
60
+ /**
61
+ * - Number of tools in this toolset.
62
+ */
63
+ toolCount: number;
64
+ /**
65
+ * - Listed tool metadata.
66
+ */
67
+ tools: ListedTool[];
68
+ /**
69
+ * - Optional note when the value is not a ToolSet instance.
70
+ */
71
+ note?: string | undefined;
72
+ };
73
+ export type ToolsetListResult = {
74
+ /**
75
+ * - Public import reference.
76
+ */
77
+ reference: string;
78
+ /**
79
+ * - Matching toolsets.
80
+ */
81
+ toolsets: ListedToolset[];
82
+ /**
83
+ * - Number of matching toolsets.
84
+ */
85
+ totalToolsets: number;
86
+ /**
87
+ * - Number of matching tools.
88
+ */
89
+ totalTools: number;
90
+ };
91
+ export type ToolsetListOptions = {
92
+ /**
93
+ * - Optional provider/type/name filters.
94
+ */
95
+ filters?: string[] | undefined;
96
+ /**
97
+ * - Optional toolset tree. Defaults to framework toolsets.
98
+ */
99
+ toolsets?: Record<string, Record<string, any>> | undefined;
100
+ };
101
+ export type ParsedToolsetArgs = {
102
+ /**
103
+ * - Positional filters.
104
+ */
105
+ filters: string[];
106
+ /**
107
+ * - Whether JSON output was requested.
108
+ */
109
+ json: boolean;
110
+ /**
111
+ * - Whether help output was requested.
112
+ */
113
+ help: boolean;
114
+ };