@j-o-r/hello-dave 0.1.0 → 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 -3
- 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 -3
- 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 -16
- 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/AgentClient.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export default AgentClient;
|
|
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;
|
|
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;
|
|
7
|
-
export type ANTHOptions = import("./API/anthropic.com/text.js").ANTHOptions;
|
|
8
|
-
export type Prompt = import("./Prompt.js").default;
|
|
9
|
-
export type ToolSet = import("./ToolSet.js").default;
|
|
10
|
-
export type WSOptions = {
|
|
11
|
-
/**
|
|
12
|
-
* - The prompt session instance.
|
|
13
|
-
*/
|
|
14
|
-
prompt: Prompt;
|
|
15
|
-
/**
|
|
16
|
-
* - Optional toolset for the prompt.
|
|
17
|
-
*/
|
|
18
|
-
toolset?: import("./ToolSet.js").default | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* - Custom introduction message for the agent.
|
|
21
|
-
*/
|
|
22
|
-
description: string;
|
|
23
|
-
/**
|
|
24
|
-
* - Logical name (e.g., 'search', 'code', 'os').
|
|
25
|
-
*/
|
|
26
|
-
name: string;
|
|
27
|
-
/**
|
|
28
|
-
* - Websocket server access secret (must match server).
|
|
29
|
-
*/
|
|
30
|
-
secret: string;
|
|
31
|
-
/**
|
|
32
|
-
* - WebSocket URL.
|
|
33
|
-
*/
|
|
34
|
-
url?: string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* - Polling interval for queue processing (ms).
|
|
37
|
-
*/
|
|
38
|
-
intervalMs?: number | undefined;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* @module lib/AgentClient
|
|
42
|
-
* @exports default AgentClient
|
|
43
|
-
* Websocket client for AI agent sessions, wrapping a Prompt/ToolSet instance with robust queue-based message handling, auto-reconnect, and epoch-based resets.
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* @typedef {import('./API/openai.com/reponses/text.js').request} OARequest
|
|
47
|
-
* @typedef {import('./API/x.ai/text.js').request} XRequest
|
|
48
|
-
* @typedef {import('./API/anthropic.com/text.js').request} ANTHRequest
|
|
49
|
-
*
|
|
50
|
-
* @typedef {import('./API/x.ai/text.js').XOptions} XOptions
|
|
51
|
-
* @typedef {import('./API/openai.com/reponses/text.js').OAOptions} OAOptions
|
|
52
|
-
* @typedef {import('./API/anthropic.com/text.js').ANTHOptions} ANTHOptions
|
|
53
|
-
*
|
|
54
|
-
* @typedef {import('./Prompt.js').default} Prompt
|
|
55
|
-
* @typedef {import('./ToolSet.js').default} ToolSet
|
|
56
|
-
*/
|
|
57
|
-
/**
|
|
58
|
-
* @typedef {Object} WSOptions
|
|
59
|
-
* @property {Prompt} prompt - The prompt session instance.
|
|
60
|
-
* @property {ToolSet} [toolset] - Optional toolset for the prompt.
|
|
61
|
-
* @property {string} description - Custom introduction message for the agent.
|
|
62
|
-
* @property {string} name - Logical name (e.g., 'search', 'code', 'os').
|
|
63
|
-
* @property {string} secret - Websocket server access secret (must match server).
|
|
64
|
-
* @property {string} [url='ws://127.0.0.1:8000/ws'] - WebSocket URL.
|
|
65
|
-
* @property {number} [intervalMs=2000] - Polling interval for queue processing (ms).
|
|
66
|
-
* @example { prompt, name: 'code-agent', secret: 'abc123', url: 'ws://localhost:8001/ws' }
|
|
67
|
-
*/
|
|
68
|
-
/**
|
|
69
|
-
* AgentClient: WebSocket client wrapper for AI agent sessions.
|
|
70
|
-
* Combines Prompt/ToolSet with WS communication for bidirectional queries, responses, tool calls, and resets.
|
|
71
|
-
* Features: Sequential message queue (one-at-a-time processing), auto-reconnect on close, epoch invalidation for resets.
|
|
72
|
-
* Logs events via console; emits via underlying Prompt (tool_request, tool_error, etc.).
|
|
73
|
-
* @emits tool_request - When tools are requested (via #prompt).
|
|
74
|
-
* @emits tool_error - When tools fail (via #prompt).
|
|
75
|
-
* @example
|
|
76
|
-
* const client = new AgentClient({
|
|
77
|
-
* prompt: myPrompt,
|
|
78
|
-
* name: 'code',
|
|
79
|
-
* description: 'Code execution agent',
|
|
80
|
-
* secret: 'mysecret',
|
|
81
|
-
* intervalMs: 1000
|
|
82
|
-
* });
|
|
83
|
-
*/
|
|
84
|
-
declare class AgentClient {
|
|
85
|
-
/**
|
|
86
|
-
* Initializes the AgentClient with configuration options.
|
|
87
|
-
* Registers Prompt events for logging and starts the WebSocket connection.
|
|
88
|
-
* @param {WSOptions} options - Configuration object.
|
|
89
|
-
* @throws {TypeError} If required options (e.g., prompt, secret) are invalid/missing.
|
|
90
|
-
* @example See WSOptions.
|
|
91
|
-
*/
|
|
92
|
-
constructor(options: WSOptions);
|
|
93
|
-
/**
|
|
94
|
-
* @private
|
|
95
|
-
* Starts the WebSocket connection, sends introduction, sets up handlers.
|
|
96
|
-
* Auto-retries on close after 5s.
|
|
97
|
-
* @returns {void}
|
|
98
|
-
*/
|
|
99
|
-
private _start;
|
|
100
|
-
/**
|
|
101
|
-
* Enqueues an incoming WebSocket message and starts interval processing if needed.
|
|
102
|
-
* Immediately handles 'reset' actions (clears queue, resets prompt, increments epoch).
|
|
103
|
-
* @param {MessageEvent} e - Raw WebSocket message event.
|
|
104
|
-
* @returns {void}
|
|
105
|
-
* @throws {SyntaxError} If JSON parse fails.
|
|
106
|
-
*/
|
|
107
|
-
incoming(e: MessageEvent): void;
|
|
108
|
-
#private;
|
|
109
|
-
}
|
package/types/AgentManager.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
export default AgentManager;
|
|
2
|
-
export type XOptions = import("./API/x.ai/text.js").XOptions;
|
|
3
|
-
export type XAIOptions = import("./API/x.ai/responses.js").XAIOptions;
|
|
4
|
-
export type OAOptions = import("./API/openai.com/reponses/text.js").OAOptions;
|
|
5
|
-
export type ANTHOptions = import("./API/anthropic.com/text.js").ANTHOptions;
|
|
6
|
-
export type Setup = {
|
|
7
|
-
/**
|
|
8
|
-
* - Initial system prompt.
|
|
9
|
-
*/
|
|
10
|
-
prompt: string;
|
|
11
|
-
/**
|
|
12
|
-
* - API model options.
|
|
13
|
-
*/
|
|
14
|
-
options: XAIOptions | OAOptions | XOptions | ANTHOptions;
|
|
15
|
-
/**
|
|
16
|
-
* - AI provider.
|
|
17
|
-
*/
|
|
18
|
-
api: "gpt" | "xai" | "claude";
|
|
19
|
-
/**
|
|
20
|
-
* - Token limit for context.
|
|
21
|
-
*/
|
|
22
|
-
contextWindow?: number | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* - Toolset activation mode.
|
|
25
|
-
*/
|
|
26
|
-
toolsetMode?: "auto" | "required" | null | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* - Enable verbose output.
|
|
29
|
-
*/
|
|
30
|
-
debug?: boolean | undefined;
|
|
31
|
-
};
|
|
32
|
-
export type Options = {
|
|
33
|
-
/**
|
|
34
|
-
* - Agent name (validated /^[a-z_0-9]{2,}$/).
|
|
35
|
-
*/
|
|
36
|
-
name: string;
|
|
37
|
-
/**
|
|
38
|
-
* - WS auth secret (base64-encoded).
|
|
39
|
-
*/
|
|
40
|
-
secret: string;
|
|
41
|
-
/**
|
|
42
|
-
* - Session cache directory.
|
|
43
|
-
*/
|
|
44
|
-
cachePath?: string | undefined;
|
|
45
|
-
};
|
|
46
|
-
declare class AgentManager {
|
|
47
|
-
/**
|
|
48
|
-
* Initializes AgentManager with base options.
|
|
49
|
-
* Validates name regex; encodes secret.
|
|
50
|
-
* @param {Options} options - Base configuration.
|
|
51
|
-
* @throws {Error} Invalid name (regex) or options.
|
|
52
|
-
* @chainable
|
|
53
|
-
*/
|
|
54
|
-
constructor(options: Options);
|
|
55
|
-
/**
|
|
56
|
-
* Configures the Prompt/Session/ToolSet with API adaptor.
|
|
57
|
-
* Adds system prompt; chains to start().
|
|
58
|
-
* @param {Setup} setup - AI setup details.
|
|
59
|
-
* @returns {AgentManager} This instance (chainable).
|
|
60
|
-
* @throws {Error} Invalid setup.
|
|
61
|
-
* @example mgr.setup({ prompt: 'You are a coder...', api: 'gpt', options: { model: 'gpt-4o' } });
|
|
62
|
-
*/
|
|
63
|
-
setup(setup: Setup): AgentManager;
|
|
64
|
-
/**
|
|
65
|
-
* Direct synchronous call to the underlying Prompt.
|
|
66
|
-
* @param {string} input - User input.
|
|
67
|
-
* @returns {Promise<string>} Response.
|
|
68
|
-
* @throws {Error} No setup.
|
|
69
|
-
*/
|
|
70
|
-
directCall(input: string): Promise<any> & lt;
|
|
71
|
-
/** @returns {Prompt} Underlying Prompt instance. */
|
|
72
|
-
getPrompt(): Prompt;
|
|
73
|
-
/** @returns {ToolSet|null} Toolset if configured. */
|
|
74
|
-
getToolset(): ToolSet | null;
|
|
75
|
-
/** @returns {Promise<import('./fafs.js').EnvironmentInfo>} System env info. */
|
|
76
|
-
environment(): Promise<any> & lt;
|
|
77
|
-
/**
|
|
78
|
-
* Adds a pre-defined generic tool from toolsPool (genericToolset) to this agent's ToolSet.
|
|
79
|
-
* @param {'execute_bash_script'|'execute_remote_script'|'get_user_env'|'history_search'|'javascript_interpreter'|'memory_recall'|'memory_write'|'open_link'|'read_file'|'send_email'|'syntax_check'|'write_file'} name - Tool name.
|
|
80
|
-
* @throws {Error} Invalid name, no toolset, or tool missing.
|
|
81
|
-
* @example mgr.addGenericToolcall('read_file');
|
|
82
|
-
*/
|
|
83
|
-
addGenericToolcall(name: "execute_bash_script" | "execute_remote_script" | "get_user_env" | "history_search" | "javascript_interpreter" | "memory_recall" | "memory_write" | "open_link" | "read_file" | "send_email" | "syntax_check" | "write_file"): void;
|
|
84
|
-
/**
|
|
85
|
-
* Smart launcher: CLI (default), server (servePort), or client (connectUrl).
|
|
86
|
-
* Auto-generates intros/descriptions if empty.
|
|
87
|
-
* @param {number} [servePort] - Launch server on port.
|
|
88
|
-
* @param {string} [connectUrl] - Connect as client to WS.
|
|
89
|
-
* @param {string} [cliIntro=""] - CLI intro text.
|
|
90
|
-
* @param {string} [toolName=""] - Tool/server name (falls back to #name).
|
|
91
|
-
* @param {string} [toolDescription=""] - Tool desc.
|
|
92
|
-
* @returns {Promise<void>}
|
|
93
|
-
* @throws {Error} No setup; invalid names/ports.
|
|
94
|
-
* @example mgr.start(8000); // Server\nmgr.start(undefined, 'ws://other:8001/ws'); // Client\nmgr.start(); // CLI
|
|
95
|
-
*/
|
|
96
|
-
start(servePort?: number, connectUrl?: string, cliIntro?: string, toolName?: string, toolDescription?: string): Promise<any> & lt;
|
|
97
|
-
#private;
|
|
98
|
-
}
|
|
99
|
-
import { Prompt } from './index.js';
|
|
100
|
-
import { ToolSet } from './index.js';
|
package/types/AgentServer.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export default AgentServer;
|
|
2
|
-
export type Client = import("@j-o-r/apiserver/types/ClientWrapper.d.ts").ClientWrapper;
|
|
3
|
-
export type Prompt = import("./Prompt.js").default;
|
|
4
|
-
export type ToolSet = import("./ToolSet.js").default;
|
|
5
|
-
export type Session = import("./Session.js").default;
|
|
6
|
-
export type MessageContent = string | object;
|
|
7
|
-
export type Message = {
|
|
8
|
-
/**
|
|
9
|
-
* - Action type (must be in ACTIONS).
|
|
10
|
-
*/
|
|
11
|
-
action: string;
|
|
12
|
-
content?: MessageContent | undefined;
|
|
13
|
-
id?: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
export type AgentServerOptions = {
|
|
16
|
-
/**
|
|
17
|
-
* - Server/agent name.
|
|
18
|
-
*/
|
|
19
|
-
name: string;
|
|
20
|
-
/**
|
|
21
|
-
* - Access secret (matches client secrets).
|
|
22
|
-
*/
|
|
23
|
-
secret: string;
|
|
24
|
-
/**
|
|
25
|
-
* - Server description.
|
|
26
|
-
*/
|
|
27
|
-
description: string;
|
|
28
|
-
/**
|
|
29
|
-
* - Prompt instance.
|
|
30
|
-
*/
|
|
31
|
-
prompt: Prompt;
|
|
32
|
-
/**
|
|
33
|
-
* - Session manager.
|
|
34
|
-
*/
|
|
35
|
-
session: Session;
|
|
36
|
-
/**
|
|
37
|
-
* - Custom auth function.
|
|
38
|
-
*/
|
|
39
|
-
auth?: AuthFunction;
|
|
40
|
-
/**
|
|
41
|
-
* - Listen port (>=1024).
|
|
42
|
-
*/
|
|
43
|
-
port?: number | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* - Verbose logging.
|
|
46
|
-
*/
|
|
47
|
-
debug?: boolean | undefined;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* AgentServer: Core WebSocket server class.
|
|
51
|
-
* Exposes connected agents as tools; handles user CLI/WS interactions, auth, sessions.
|
|
52
|
-
* Starts on localhost; broadcasts resets.
|
|
53
|
-
* Logs events via console; emits via Prompt.
|
|
54
|
-
* @emits tool_request - Tool calls (via #prompt).
|
|
55
|
-
* @emits tool_error - Tool failures (via #prompt).
|
|
56
|
-
* @example
|
|
57
|
-
* const server = new AgentServer({
|
|
58
|
-
* name: 'main',
|
|
59
|
-
* prompt: myPrompt,
|
|
60
|
-
* session: mySession,
|
|
61
|
-
* secret: 'abc',
|
|
62
|
-
* port: 8000,
|
|
63
|
-
* debug: true
|
|
64
|
-
* });
|
|
65
|
-
*/
|
|
66
|
-
declare class AgentServer {
|
|
67
|
-
/**
|
|
68
|
-
* Initializes and starts the AgentServer.
|
|
69
|
-
* Validates port, sets up Prompt event logging, launches WS server.
|
|
70
|
-
* @param {AgentServerOptions} options - Server configuration.
|
|
71
|
-
* @throws {Error} If port < 1024.
|
|
72
|
-
* @example See AgentServerOptions.
|
|
73
|
-
*/
|
|
74
|
-
constructor(options: AgentServerOptions);
|
|
75
|
-
/**
|
|
76
|
-
* @private
|
|
77
|
-
* Launches the WS server with handlers for messages, connections, closes.
|
|
78
|
-
* Defines HTTP / API index endpoint.
|
|
79
|
-
* @returns {Promise<void>}
|
|
80
|
-
*/
|
|
81
|
-
private _start;
|
|
82
|
-
/**
|
|
83
|
-
* Broadcasts a reset message to all connected clients (starts new sessions).
|
|
84
|
-
* @returns {void}
|
|
85
|
-
* @fires reset - Via underlying prompt/clients.
|
|
86
|
-
*/
|
|
87
|
-
resetAll(): void;
|
|
88
|
-
#private;
|
|
89
|
-
}
|
package/types/wsCli.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S node
|
|
2
|
-
declare function _default(connectUrl: string, secret?: string): void;
|
|
3
|
-
export default _default;
|
|
4
|
-
export type WsMessage = {
|
|
5
|
-
/**
|
|
6
|
-
* - Action type (e.g., 'user_request')
|
|
7
|
-
*/
|
|
8
|
-
action: string;
|
|
9
|
-
/**
|
|
10
|
-
* - Message content
|
|
11
|
-
*/
|
|
12
|
-
content: string;
|
|
13
|
-
/**
|
|
14
|
-
* - Unique message ID
|
|
15
|
-
*/
|
|
16
|
-
id: number;
|
|
17
|
-
};
|
package/types/wsIO.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {object} wsResponse
|
|
3
|
-
* @property {string} action
|
|
4
|
-
* @property {string} content
|
|
5
|
-
* @property {number} id - message id
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* One-shot WebSocket client for hello-dave server using standard 'ws' library.
|
|
9
|
-
* Connects directly to pure WS endpoint (no HTTP upgrade).
|
|
10
|
-
* Sends intro + action, awaits matching response by ID, closes, returns response.
|
|
11
|
-
*
|
|
12
|
-
* @param {string} connectUrl - Websocket server endpoint to connect to
|
|
13
|
-
* @param {string} [secret=''] - Secret websocket connection key
|
|
14
|
-
* @param {'user_request'|'user_info'|'user_reset'} action - Action to perform
|
|
15
|
-
* @param {string} [input=''] - Input content (required for 'user_request')
|
|
16
|
-
* @returns {Promise<wsResponse>}
|
|
17
|
-
* @throws {Error} Invalid action or missing input for user_request
|
|
18
|
-
* @example
|
|
19
|
-
* const response = await wsio('ws://localhost:8080', 'secret', 'user_request', 'Hello!');
|
|
20
|
-
* console.log(response.content);
|
|
21
|
-
*/
|
|
22
|
-
export default function wsio(connectUrl: string, secret?: string, action: "user_request" | "user_info" | "user_reset", input?: string): Promise<any> & lt;
|
|
23
|
-
export type wsResponse = {
|
|
24
|
-
action: string;
|
|
25
|
-
content: string;
|
|
26
|
-
/**
|
|
27
|
-
* - message id
|
|
28
|
-
*/
|
|
29
|
-
id: number;
|
|
30
|
-
};
|
package/utils/test.sh
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
TEST_DIR="${1:-scenarios}"
|
|
5
|
-
echo "=== TestDave: Running all tests in $TEST_DIR/ ==="
|
|
6
|
-
|
|
7
|
-
shopt -s nullglob
|
|
8
|
-
TEST_FILES=("$TEST_DIR"/*.test.js)
|
|
9
|
-
|
|
10
|
-
if [ ${#TEST_FILES[@]} -eq 0 ]; then
|
|
11
|
-
echo "No *.test.js files found in $TEST_DIR/"
|
|
12
|
-
exit 0
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
echo "Found ${#TEST_FILES[@]} test files."
|
|
16
|
-
|
|
17
|
-
TOTAL=${#TEST_FILES[@]}
|
|
18
|
-
PASSED=0
|
|
19
|
-
FAILED=()
|
|
20
|
-
|
|
21
|
-
for test_file in "${TEST_FILES[@]}"; do
|
|
22
|
-
echo ""
|
|
23
|
-
echo "=== $test_file ==="
|
|
24
|
-
RC=$(timeout 60s "$test_file");
|
|
25
|
-
XT=$?
|
|
26
|
-
echo "$RC";
|
|
27
|
-
if [ "$XT" -eq 0 ]; then
|
|
28
|
-
echo "✅ PASS"
|
|
29
|
-
((PASSED = PASSED + 1))
|
|
30
|
-
else
|
|
31
|
-
echo "❌ FAIL (exit code $XT)"
|
|
32
|
-
FAILED+=("$test_file")
|
|
33
|
-
fi
|
|
34
|
-
done
|
|
35
|
-
|
|
36
|
-
echo ""
|
|
37
|
-
echo "=== SUMMARY ==="
|
|
38
|
-
echo "Total: $TOTAL"
|
|
39
|
-
echo "Passed: $PASSED"
|
|
40
|
-
echo "Failed: ${#FAILED[@]}"
|
|
41
|
-
if [ ${#FAILED[@]} -gt 0 ]; then
|
|
42
|
-
echo "Failed tests:"
|
|
43
|
-
for f in "${FAILED[@]}"; do echo " $f"; done
|
|
44
|
-
exit 1
|
|
45
|
-
fi
|
|
46
|
-
echo "🎉 All tests passed!"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|