@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.
- 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 +562 -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 +11 -5
- 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 +222 -0
- package/types/Cli.d.ts +28 -8
- package/types/Prompt.d.ts +23 -5
- package/types/Session.d.ts +1 -1
- package/types/ToolSet.d.ts +10 -0
- package/types/agentLoader.d.ts +78 -0
- package/types/cdn.d.ts +15 -90
- package/types/defaultToolsets.d.ts +9 -0
- package/types/fafs.d.ts +1 -1
- package/types/genericToolset.d.ts +1 -1
- package/types/handOffToolset.d.ts +28 -0
- package/types/index.d.ts +19 -17
- package/types/toolsetLoader.d.ts +114 -0
- package/utils/format_log.js +101 -23
- package/utils/launch_agent.js +18 -0
- package/utils/list_sessions.sh +13 -5
- package/utils/search_sessions.sh +65 -29
- package/utils/toolsets.js +33 -0
- package/README.md.bak.1779452127 +0 -240
- package/agents/codeserver.sh +0 -47
- package/agents/daisy_agent.js +0 -173
- package/agents/docs_agent.js +0 -148
- package/agents/memory_agent.js +0 -263
- package/agents/minimax.js +0 -173
- package/agents/npm_agent.js +0 -202
- package/agents/prompt_agent.js +0 -133
- package/agents/readme_agent.js +0 -148
- package/agents/spawn_agent.js +0 -160
- package/agents/stability.js +0 -173
- package/agents/todo_agent.js +0 -175
- package/bin/codeDave +0 -58
- package/docs/agent-dave-websocket-protocol.md +0 -180
- package/docs/agent-manager.md +0 -244
- package/docs/codeserver-pattern.md +0 -191
- package/docs/generic-toolset.md +0 -326
- package/docs/howtos/agent-networking.md +0 -253
- package/docs/howtos/spawn-agents.md.bak +0 -200
- package/docs/howtos/spawn-agents.md.bak_new +0 -200
- package/docs/multi-agent-clusters.md +0 -265
- package/docs/music-toolsets.md +0 -137
- package/docs/path-resolution-best-practices.md +0 -104
- package/docs/plans/minimax-music-generation.md +0 -80
- package/docs/plans/unified-agent-architecture.md +0 -146
- package/docs/plans/websocket-streaming-plan.md.bak +0 -317
- package/docs/prompt/spawn_agent.md +0 -175
- package/docs/prompt/spawn_agent.md.bak +0 -201
- package/docs/prompt/task_clarification_and_documentation.md +0 -35
- package/docs/prompt-class.md +0 -141
- package/docs/todo-archive-infra-2026-04-21.md +0 -15
- package/docs/todo-archive-v0.0.8.md +0 -1
- package/docs/todo-archive-v0.1.0.md +0 -32
- package/docs/todo-archive.md +0 -44
- package/docs/tools-syntax-validation.md +0 -121
- package/docs/toolset.md +0 -164
- package/docs/xai-responses.md +0 -111
- package/docs/xai_collections.md +0 -106
- package/lib/API/x.ai/ImageToolset.js +0 -165
- package/lib/API/x.ai/text.js +0 -415
- package/lib/AgentClient.js +0 -248
- package/lib/AgentManager.js +0 -245
- package/lib/AgentServer.js +0 -404
- package/lib/wsCli.js +0 -287
- package/lib/wsIO.js +0 -90
- package/types/API/x.ai/text.d.ts +0 -286
- package/types/AgentClient.d.ts +0 -109
- package/types/AgentManager.d.ts +0 -100
- package/types/AgentServer.d.ts +0 -89
- package/types/wsCli.d.ts +0 -17
- package/types/wsIO.d.ts +0 -30
- package/utils/test.sh +0 -46
- /package/docs/{suggestions.md → _notes/token-counts.md} +0 -0
- /package/lib/API/openai.com/{reponses/MESSAGES.md → MESSAGES.md} +0 -0
- /package/types/API/{x.ai/ImageToolset.d.ts → mureka/MusicToolset.d.ts} +0 -0
- /package/types/{CdnToolset.d.ts → cdnToolset.d.ts} +0 -0
package/types/Cli.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default Cli;
|
|
2
|
-
export type OARequest =
|
|
3
|
-
export type XRequest =
|
|
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 =
|
|
6
|
-
export type 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
|
-
*
|
|
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 =
|
|
3
|
-
export type XRequest =
|
|
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 =
|
|
6
|
+
export type XOptions = any;
|
|
7
7
|
export type XAIOptions = import("./API/x.ai/responses.js").XAIOptions;
|
|
8
|
-
export type 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';
|
package/types/Session.d.ts
CHANGED
|
@@ -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). */
|
package/types/ToolSet.d.ts
CHANGED
|
@@ -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 {
|
|
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://
|
|
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
|
-
*
|
|
33
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
114
|
-
*
|
|
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
|
-
* @
|
|
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
|
-
*
|
|
124
|
-
*
|
|
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
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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.
|
|
@@ -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
|
-
|
|
2
|
-
import
|
|
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
|
|
7
|
+
export namespace chat {
|
|
10
8
|
export { gpt };
|
|
11
|
-
export {
|
|
9
|
+
export { grok };
|
|
12
10
|
export { claude };
|
|
13
11
|
}
|
|
14
12
|
export namespace search {
|
|
15
13
|
export { brave };
|
|
16
14
|
}
|
|
17
|
-
export {
|
|
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
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
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
|
|
31
|
-
|
|
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
|
+
};
|