@j-o-r/hello-dave 0.0.2 → 0.0.3
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/README.md +288 -163
- package/README.md.backup +269 -0
- package/bin/dave.js +165 -0
- package/examples/CodeServer +43 -0
- package/{bin/hdAsk.js → examples/askDave.js} +50 -39
- package/{bin/hdCode.js → examples/codeDave.js} +47 -47
- package/examples/coderev.js +72 -0
- package/examples/daisy.js +177 -0
- package/examples/docsDave.js +119 -0
- package/examples/gpt.js +54 -72
- package/examples/grok.js +47 -68
- package/examples/npmDave.js +175 -0
- package/examples/promptDave.js +112 -0
- package/examples/readmeDave.js +144 -0
- package/examples/spawndave.js +240 -0
- package/examples/todoDave.js +132 -0
- package/lib/API/openai.com/reponses/text.js +12 -18
- package/lib/API/x.ai/collections.js +354 -0
- package/lib/API/x.ai/files.js +218 -0
- package/lib/API/x.ai/responses.js +494 -0
- package/lib/API/x.ai/text.js +1 -1
- package/lib/AgentClient.js +13 -6
- package/lib/AgentManager.js +79 -10
- package/lib/AgentServer.js +45 -21
- package/lib/Cli.js +7 -1
- package/lib/Prompt.js +4 -2
- package/lib/ToolSet.js +2 -1
- package/lib/genericToolset.js +124 -87
- package/lib/index.js +4 -2
- package/lib/wsCli.js +257 -0
- package/lib/wsIO.js +96 -0
- package/package.json +26 -20
- package/types/API/openai.com/reponses/text.d.ts +17 -3
- package/types/API/x.ai/collections.d.ts +167 -0
- package/types/API/x.ai/files.d.ts +84 -0
- package/types/API/x.ai/responses.d.ts +379 -0
- package/types/AgentClient.d.ts +5 -0
- package/types/AgentManager.d.ts +24 -31
- package/types/AgentServer.d.ts +5 -1
- package/types/Prompt.d.ts +4 -2
- package/types/ToolSet.d.ts +1 -0
- package/types/index.d.ts +4 -3
- package/types/wsCli.d.ts +3 -0
- package/types/wsIO.d.ts +26 -0
- package/utils/bars.js +40 -0
- package/utils/clear_sessions.sh +54 -0
- package/{bin/hdInspect.js → utils/format_log.js} +5 -0
- package/utils/list_sessions.sh +46 -0
- package/utils/search_sessions.sh +73 -0
- package/bin/hdClear.js +0 -13
- package/bin/hdConnect.js +0 -230
- package/bin/hdNpm.js +0 -114
- package/bin/hdPrompt.js +0 -108
- package/examples/claude-test.js +0 -89
- package/examples/claude.js +0 -143
- package/examples/gpt_code.js +0 -125
- package/examples/gpt_note_keeping.js +0 -117
- package/examples/grok_code.js +0 -114
- package/examples/grok_note_keeping.js +0 -111
- package/module.md +0 -189
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { list };
|
|
3
|
+
export { upload };
|
|
4
|
+
export { get };
|
|
5
|
+
export { getMeta };
|
|
6
|
+
export { rm };
|
|
7
|
+
export { getStorage as storage };
|
|
8
|
+
}
|
|
9
|
+
export default _default;
|
|
10
|
+
export type fileList = {
|
|
11
|
+
data: File[];
|
|
12
|
+
pagination_token: string | null;
|
|
13
|
+
};
|
|
14
|
+
export type File = {
|
|
15
|
+
/**
|
|
16
|
+
* - File size in bytes.
|
|
17
|
+
*/
|
|
18
|
+
bytes: number;
|
|
19
|
+
/**
|
|
20
|
+
* - Unix timestamp of creation.
|
|
21
|
+
*/
|
|
22
|
+
created_at: number;
|
|
23
|
+
/**
|
|
24
|
+
* - Unix timestamp of expiration, or null.
|
|
25
|
+
*/
|
|
26
|
+
expires_at: number | null;
|
|
27
|
+
/**
|
|
28
|
+
* - Path to the file.
|
|
29
|
+
*/
|
|
30
|
+
filename: string;
|
|
31
|
+
/**
|
|
32
|
+
* - Unique file identifier.
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* - Type of object, e.g., 'file'.
|
|
37
|
+
*/
|
|
38
|
+
object: string;
|
|
39
|
+
/**
|
|
40
|
+
* - Purpose of the file.
|
|
41
|
+
*/
|
|
42
|
+
purpose: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* List Files
|
|
46
|
+
* @param {number} limit
|
|
47
|
+
* @param {'asc'|'desc'} order
|
|
48
|
+
* @param {'created_at'|'filename'| 'size'} sort_by
|
|
49
|
+
* @param {string} page (pagination_token)
|
|
50
|
+
* @retuns {Promise<fileList>}
|
|
51
|
+
*/
|
|
52
|
+
declare function list(limit?: number, order?: "asc" | "desc", sort_by?: "created_at" | "filename" | "size", page?: string): Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* Upload a file
|
|
55
|
+
* When content is filled this will be used as file content
|
|
56
|
+
* @param {string} filePath
|
|
57
|
+
* @param {string} [content] - optional content for a non existing file
|
|
58
|
+
* @returns {Promise<File>} file_id
|
|
59
|
+
*/
|
|
60
|
+
declare function upload(filePath: string, content?: string): Promise<File>;
|
|
61
|
+
/**
|
|
62
|
+
* Get file content
|
|
63
|
+
* @param {string} fileId
|
|
64
|
+
* @returns {Promise<*>}
|
|
65
|
+
*/
|
|
66
|
+
declare function get(fileId: string): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Get file meta data
|
|
69
|
+
* @param {string} fileId
|
|
70
|
+
* @returns {Promise<File>}
|
|
71
|
+
*/
|
|
72
|
+
declare function getMeta(fileId: string): Promise<File>;
|
|
73
|
+
/**
|
|
74
|
+
* Remove a file
|
|
75
|
+
* @param {string} fileId
|
|
76
|
+
* @returns {Promise<void>}
|
|
77
|
+
*/
|
|
78
|
+
declare function rm(fileId: string): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Get all on-line files
|
|
81
|
+
* @returns {Promise<Map<string, File>>}
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
declare function getStorage(page?: string): Promise<Map<string, File>>;
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
export type Prompt = import("../../Prompt.js").default;
|
|
2
|
+
export type ToolSet = import("../../ToolSet.js").default;
|
|
3
|
+
export type Includes = "code_interpreter_call.outputs" | "computer_call_output.output.image_url" | "file_search_call.results" | "message.input_image.image_url" | "message.output_text.logprobs" | "reasoning.encrypted_conten";
|
|
4
|
+
export type XAIOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* - Optional include parameter.
|
|
7
|
+
*/
|
|
8
|
+
include?: string | null | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* - Array of input objects.
|
|
11
|
+
*/
|
|
12
|
+
input?: XAIInput[] | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* - Instructions for the model.
|
|
15
|
+
*/
|
|
16
|
+
instructions?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* - Maximum number of output tokens.
|
|
19
|
+
*/
|
|
20
|
+
max_output_tokens?: number | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* - Maximum number of tool calls allowed.
|
|
23
|
+
*/
|
|
24
|
+
max_tool_calls?: number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* - Optional metadata object.
|
|
27
|
+
*/
|
|
28
|
+
metadata?: Object | null | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* - Model version to use.
|
|
31
|
+
*/
|
|
32
|
+
model?: "grok-4-1-fast-reasoning" | "grok-4-1-fast-non-reasoning" | "grok-code-fast-1" | "grok-4-fast-reasoning" | "grok-4-fast-non-reasoning" | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* - Reusable prompt string.
|
|
35
|
+
*/
|
|
36
|
+
prompt?: string | null | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* - Reasoning configuration.
|
|
39
|
+
*/
|
|
40
|
+
reasoning?: {
|
|
41
|
+
/**
|
|
42
|
+
* - Effort level for reasoning.
|
|
43
|
+
*/
|
|
44
|
+
effort: "low" | "medium" | "high" | null;
|
|
45
|
+
/**
|
|
46
|
+
* - Summary type for reasoning.
|
|
47
|
+
*/
|
|
48
|
+
summary: "auto" | "concise" | "detailed";
|
|
49
|
+
} | undefined;
|
|
50
|
+
search?: "low" | "high" | "medium" | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* - Service tier option, default is auto-selected.
|
|
53
|
+
*/
|
|
54
|
+
service_tier?: "auto" | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* - Whether to store the response or not.
|
|
57
|
+
*/
|
|
58
|
+
store?: boolean | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* - Whether to stream the response or not.
|
|
61
|
+
*/
|
|
62
|
+
stream?: boolean | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* - Sampling temperature between 0 and 2.
|
|
65
|
+
*/
|
|
66
|
+
temperature?: number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* - text format
|
|
69
|
+
*/
|
|
70
|
+
text?: {
|
|
71
|
+
/**
|
|
72
|
+
* - Summary type for reasoning.
|
|
73
|
+
*/
|
|
74
|
+
format: "text" | "json_schema";
|
|
75
|
+
} | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* - Allow parallel tool calls if true.
|
|
78
|
+
*/
|
|
79
|
+
parallel_tool_calls?: boolean | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* - Tool choice setting, default is auto-selected.
|
|
82
|
+
*/
|
|
83
|
+
tool_choice?: "auto" | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Array of tool call objects.
|
|
86
|
+
*/
|
|
87
|
+
tools?: (XSearchTool | XAIFunctionTool | MCPTool | CodeInterpreterTool | FileSearchTool | XAIWebSearchTool)[] | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* - An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.
|
|
90
|
+
*/
|
|
91
|
+
top_logprobs?: number | null | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Top-p sampling value between 0 and 1.
|
|
94
|
+
*/
|
|
95
|
+
top_p?: number | null | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* - Needed reponse_id to validate tool calls on the next request
|
|
98
|
+
*/
|
|
99
|
+
previous_response_id?: string | null | undefined;
|
|
100
|
+
};
|
|
101
|
+
export type XAIFunctionTool = {
|
|
102
|
+
/**
|
|
103
|
+
* - The type of the tool call, e.g., "function".
|
|
104
|
+
*/
|
|
105
|
+
type: "function";
|
|
106
|
+
/**
|
|
107
|
+
* - The name of the function.
|
|
108
|
+
*/
|
|
109
|
+
name: string;
|
|
110
|
+
/**
|
|
111
|
+
* - A brief description of what the function does.
|
|
112
|
+
*/
|
|
113
|
+
description: string;
|
|
114
|
+
/**
|
|
115
|
+
* - The parameters required by the function.
|
|
116
|
+
*/
|
|
117
|
+
parameters: {
|
|
118
|
+
type: string;
|
|
119
|
+
properties: {
|
|
120
|
+
[x: string]: ParameterProperty;
|
|
121
|
+
};
|
|
122
|
+
required?: string[] | undefined;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
export type ParameterProperty = {
|
|
126
|
+
/**
|
|
127
|
+
* - The data type of the parameter, e.g., "string".
|
|
128
|
+
*/
|
|
129
|
+
type: string;
|
|
130
|
+
/**
|
|
131
|
+
* - A brief description of the parameter.
|
|
132
|
+
*/
|
|
133
|
+
description: string;
|
|
134
|
+
};
|
|
135
|
+
export type WebSearchFilters = {
|
|
136
|
+
/**
|
|
137
|
+
* - Whitelist of domains (max 5); cannot use with excluded_domains.
|
|
138
|
+
*/
|
|
139
|
+
allowed_domains?: string[] | null | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* - Blacklist of domains (max 5); cannot use with allowed_domains.
|
|
142
|
+
*/
|
|
143
|
+
excluded_domains?: string[] | null | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* - Context size; for OpenAI compatibility (reject if set).
|
|
146
|
+
*/
|
|
147
|
+
search_context_size?: "low" | "high" | "medium" | null | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* - User location; for OpenAI compatibility (reject if set).
|
|
150
|
+
*/
|
|
151
|
+
user_location?: UserLocation | null | undefined;
|
|
152
|
+
};
|
|
153
|
+
export type UserLocation = {
|
|
154
|
+
/**
|
|
155
|
+
* - City of the user's location.
|
|
156
|
+
*/
|
|
157
|
+
city?: string | null | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* - ISO 3166-1 alpha-2 country code.
|
|
160
|
+
*/
|
|
161
|
+
country?: string | null | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* - Region of the user's location.
|
|
164
|
+
*/
|
|
165
|
+
region?: string | null | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* - IANA timezone.
|
|
168
|
+
*/
|
|
169
|
+
timezone?: string | null | undefined;
|
|
170
|
+
type: "approximate";
|
|
171
|
+
};
|
|
172
|
+
export type XAIWebSearchTool = {
|
|
173
|
+
/**
|
|
174
|
+
* - Whitelist of domains (max 5); cannot use with excluded_domains.
|
|
175
|
+
*/
|
|
176
|
+
allowed_domains?: string[] | null | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* - Enable image understanding.
|
|
179
|
+
*/
|
|
180
|
+
enable_image_understanding?: boolean | null | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* - Blacklist of domains (max 5); cannot use with allowed_domains.
|
|
183
|
+
*/
|
|
184
|
+
excluded_domains?: string[] | null | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* - For OpenAI compatibility (reject if set).
|
|
187
|
+
*/
|
|
188
|
+
external_web_access?: boolean | null | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* - Filters; for OpenAI compatibility.
|
|
191
|
+
*/
|
|
192
|
+
filters?: WebSearchFilters | null | undefined;
|
|
193
|
+
type: "web_search";
|
|
194
|
+
};
|
|
195
|
+
export type XSearchTool = {
|
|
196
|
+
/**
|
|
197
|
+
* - Whitelist of X handles; cannot use with excluded_x_handles.
|
|
198
|
+
*/
|
|
199
|
+
allowed_x_handles?: string[] | null | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* - Enable image understanding.
|
|
202
|
+
*/
|
|
203
|
+
enable_image_understanding?: boolean | null | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* - Enable video understanding.
|
|
206
|
+
*/
|
|
207
|
+
enable_video_understanding?: boolean | null | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* - Blacklist of X handles; cannot use with allowed_x_handles.
|
|
210
|
+
*/
|
|
211
|
+
excluded_x_handles?: string[] | null | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* - ISO-8601 date (YYYY-MM-DD).
|
|
214
|
+
*/
|
|
215
|
+
from_date?: string | null | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* - ISO-8601 date (YYYY-MM-DD).
|
|
218
|
+
*/
|
|
219
|
+
to_date?: string | null | undefined;
|
|
220
|
+
type: "x_search";
|
|
221
|
+
};
|
|
222
|
+
export type FileSearchTool = {
|
|
223
|
+
/**
|
|
224
|
+
* - For OpenAI compatibility (reject if set).
|
|
225
|
+
*/
|
|
226
|
+
filters: Object;
|
|
227
|
+
/**
|
|
228
|
+
* - Max results (min 1).
|
|
229
|
+
*/
|
|
230
|
+
max_num_results?: number | null | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* - For OpenAI compatibility (reject if set).
|
|
233
|
+
*/
|
|
234
|
+
ranking_options: Object;
|
|
235
|
+
/**
|
|
236
|
+
* - List of vector store IDs.
|
|
237
|
+
*/
|
|
238
|
+
vector_store_ids: string[];
|
|
239
|
+
type: "file_search";
|
|
240
|
+
};
|
|
241
|
+
export type CodeInterpreterTool = {
|
|
242
|
+
/**
|
|
243
|
+
* - Container ID or uploaded files object; for OpenAI compatibility (reject if set).
|
|
244
|
+
*/
|
|
245
|
+
container: string | Object;
|
|
246
|
+
type: "code_interpreter";
|
|
247
|
+
};
|
|
248
|
+
export type MCPTool = {
|
|
249
|
+
/**
|
|
250
|
+
* - Allowed tools.
|
|
251
|
+
*/
|
|
252
|
+
allowed_tools?: string[] | null | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* - Authorization details.
|
|
255
|
+
*/
|
|
256
|
+
authorization?: string | null | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* - Connector ID.
|
|
259
|
+
*/
|
|
260
|
+
connector_id?: string | null | undefined;
|
|
261
|
+
/**
|
|
262
|
+
* - Headers.
|
|
263
|
+
*/
|
|
264
|
+
headers?: Object | null | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* - Approval requirement.
|
|
267
|
+
*/
|
|
268
|
+
require_approval?: string | null | undefined;
|
|
269
|
+
/**
|
|
270
|
+
* - Server description.
|
|
271
|
+
*/
|
|
272
|
+
server_description?: string | null | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* - Server label.
|
|
275
|
+
*/
|
|
276
|
+
server_label: string;
|
|
277
|
+
/**
|
|
278
|
+
* - Server URL.
|
|
279
|
+
*/
|
|
280
|
+
server_url: string;
|
|
281
|
+
type: "mcp";
|
|
282
|
+
};
|
|
283
|
+
export type XAIMessage = {
|
|
284
|
+
/**
|
|
285
|
+
* - The role of the participant (e.g., "assistant", "user").
|
|
286
|
+
*/
|
|
287
|
+
role: "assistant" | "user";
|
|
288
|
+
/**
|
|
289
|
+
* - The content of the message.
|
|
290
|
+
*/
|
|
291
|
+
content: Array<XAIContent>;
|
|
292
|
+
};
|
|
293
|
+
export type XAIInputMessage = {
|
|
294
|
+
/**
|
|
295
|
+
* - The role of the participant (e.g., "assistant", "user").
|
|
296
|
+
*/
|
|
297
|
+
role: "assistant" | "user" | "system";
|
|
298
|
+
/**
|
|
299
|
+
* - The content of the message.
|
|
300
|
+
*/
|
|
301
|
+
content: string;
|
|
302
|
+
};
|
|
303
|
+
export type XAIContent = {
|
|
304
|
+
/**
|
|
305
|
+
* - The type of content (e.g., "output_text", "input_text").
|
|
306
|
+
*/
|
|
307
|
+
type: "output_text" | "input_text";
|
|
308
|
+
/**
|
|
309
|
+
* - The text content.
|
|
310
|
+
*/
|
|
311
|
+
text: string;
|
|
312
|
+
};
|
|
313
|
+
export type XAIFunctionCall = {
|
|
314
|
+
/**
|
|
315
|
+
* - Unique identifier for the function call.
|
|
316
|
+
*/
|
|
317
|
+
id: string;
|
|
318
|
+
/**
|
|
319
|
+
* - Indicates this is a function call (e.g., "function_call").
|
|
320
|
+
*/
|
|
321
|
+
type: "function_call";
|
|
322
|
+
/**
|
|
323
|
+
* - Unique identifier for the specific function call instance.
|
|
324
|
+
*/
|
|
325
|
+
call_id: string;
|
|
326
|
+
/**
|
|
327
|
+
* - The name of the function being called.
|
|
328
|
+
*/
|
|
329
|
+
name: string;
|
|
330
|
+
/**
|
|
331
|
+
* - JSON string representing arguments passed to the function.
|
|
332
|
+
*/
|
|
333
|
+
arguments: string;
|
|
334
|
+
};
|
|
335
|
+
export type XAIFunctionCallOutput = {
|
|
336
|
+
/**
|
|
337
|
+
* - Indicates this is a function call output (e.g., "function_call_output").
|
|
338
|
+
*/
|
|
339
|
+
type: "function_call_output";
|
|
340
|
+
/**
|
|
341
|
+
* - Identifier linking to the related function call.
|
|
342
|
+
*/
|
|
343
|
+
call_id: string;
|
|
344
|
+
/**
|
|
345
|
+
* - JSON string representing the output from the function call.
|
|
346
|
+
*/
|
|
347
|
+
output: string;
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* Represents an OpenAI API response request INPUT structure.
|
|
351
|
+
*/
|
|
352
|
+
export type XAIInput = (XAIInputMessage | XAIFunctionCall | XAIFunctionCallOutput);
|
|
353
|
+
/**
|
|
354
|
+
* @param {Prompt} prompt
|
|
355
|
+
* @param {ToolSet} [toolset]
|
|
356
|
+
* @param {XAIOptions} [options]
|
|
357
|
+
*/
|
|
358
|
+
export function generateRequest(prompt: Prompt, toolset?: ToolSet, options?: XAIOptions): {
|
|
359
|
+
url: string;
|
|
360
|
+
headers: object;
|
|
361
|
+
body: XAIOptions;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Parse a response
|
|
365
|
+
* @param {number} duration - Fetch time in MS
|
|
366
|
+
* @param {Prompt} prompt
|
|
367
|
+
* @param {import('@j-o-r/apiserver/types/request.js').FetchResponseObject} res
|
|
368
|
+
* @param {import('../../ToolSet.js').default} [toolset]
|
|
369
|
+
*/
|
|
370
|
+
export function parseResponse(duration: number, prompt: Prompt, res: import("@j-o-r/apiserver/types/request.js").FetchResponseObject, toolset?: import("../../ToolSet.js").default): Promise<void>;
|
|
371
|
+
/**
|
|
372
|
+
* Do a request
|
|
373
|
+
* @param {Prompt} prompt
|
|
374
|
+
* @param {ToolSet|null} toolset
|
|
375
|
+
* @param {XAIOptions} [options]:
|
|
376
|
+
* @param {number} [counter] - leave empty this counts the number of requests when doing recursive request calls
|
|
377
|
+
* @return {Promise<import('../../Session.js').Message>}
|
|
378
|
+
*/
|
|
379
|
+
export function request(prompt: Prompt, toolset?: ToolSet | null, options?: XAIOptions, counter?: number): Promise<import("../../Session.js").Message>;
|
package/types/AgentClient.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ export type WSOptions = {
|
|
|
24
24
|
* - Logical name: e.g. search, code, os, support.
|
|
25
25
|
*/
|
|
26
26
|
name: string;
|
|
27
|
+
/**
|
|
28
|
+
* - Websocket server access secret.
|
|
29
|
+
*/
|
|
30
|
+
secret: string;
|
|
27
31
|
url?: string | undefined;
|
|
28
32
|
/**
|
|
29
33
|
* - How often to pull one message from the queue.
|
|
@@ -48,6 +52,7 @@ export type WSOptions = {
|
|
|
48
52
|
* @property {ToolSet} [toolset] - The toolset
|
|
49
53
|
* @property {string} description - Custom introduction message.
|
|
50
54
|
* @property {string} name - Logical name: e.g. search, code, os, support.
|
|
55
|
+
* @property {string} secret - Websocket server access secret.
|
|
51
56
|
* @property {string} [url='ws://127.0.0.1:8000/ws?params=1234']
|
|
52
57
|
* @property {number} [intervalMs=250] - How often to pull one message from the queue.
|
|
53
58
|
*/
|
package/types/AgentManager.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default AgentManager;
|
|
2
2
|
export type XOptions = import("./API/x.ai/text.js").XOptions;
|
|
3
|
+
export type XAIOptions = import("./API/x.ai/responses.js").XAIOptions;
|
|
3
4
|
export type OAOptions = import("./API/openai.com/reponses/text.js").OAOptions;
|
|
4
5
|
export type ANTHOptions = import("./API/anthropic.com/text.js").ANTHOptions;
|
|
5
6
|
export type Setup = {
|
|
@@ -10,11 +11,11 @@ export type Setup = {
|
|
|
10
11
|
/**
|
|
11
12
|
* - Model options
|
|
12
13
|
*/
|
|
13
|
-
options: OAOptions | XOptions | ANTHOptions;
|
|
14
|
+
options: XAIOptions | OAOptions | XOptions | ANTHOptions;
|
|
14
15
|
/**
|
|
15
16
|
* - AI endpoint to use
|
|
16
17
|
*/
|
|
17
|
-
api: "gpt" | "
|
|
18
|
+
api: "gpt" | "xai" | "claude";
|
|
18
19
|
/**
|
|
19
20
|
* - The size in tokens for the context/session
|
|
20
21
|
*/
|
|
@@ -33,6 +34,10 @@ export type Options = {
|
|
|
33
34
|
* - Agent name
|
|
34
35
|
*/
|
|
35
36
|
name: string;
|
|
37
|
+
/**
|
|
38
|
+
* - Secret string for WS access authorisation (server and client secrets should match)
|
|
39
|
+
*/
|
|
40
|
+
secret: string;
|
|
36
41
|
/**
|
|
37
42
|
* - path to session/record storage
|
|
38
43
|
*/
|
|
@@ -40,14 +45,15 @@ export type Options = {
|
|
|
40
45
|
};
|
|
41
46
|
/**
|
|
42
47
|
* @typedef {import('./API/x.ai/text.js').XOptions} XOptions
|
|
48
|
+
* @typedef {import('./API/x.ai/responses.js').XAIOptions} XAIOptions
|
|
43
49
|
* @typedef {import('./API/openai.com/reponses/text.js').OAOptions} OAOptions
|
|
44
50
|
* @typedef {import('./API/anthropic.com/text.js').ANTHOptions} ANTHOptions
|
|
45
51
|
*/
|
|
46
52
|
/**
|
|
47
53
|
* @typedef {Object} Setup
|
|
48
54
|
* @property {string} prompt - Initial system prompt
|
|
49
|
-
* @property {OAOptions|XOptions|ANTHOptions} options - Model options
|
|
50
|
-
* @property {'gpt'|'
|
|
55
|
+
* @property {XAIOptions|OAOptions|XOptions|ANTHOptions} options - Model options
|
|
56
|
+
* @property {'gpt'|'xai'|'claude'} api - AI endpoint to use
|
|
51
57
|
* @property {number} [contextWindow] - The size in tokens for the context/session
|
|
52
58
|
* @property {'auto'|'required'|void} [toolsetMode] -
|
|
53
59
|
* @property {boolean} [debug] - verbose output
|
|
@@ -55,6 +61,7 @@ export type Options = {
|
|
|
55
61
|
/**
|
|
56
62
|
* @typedef {Object} Options
|
|
57
63
|
* @property {string} name - Agent name
|
|
64
|
+
* @property {string} secret - Secret string for WS access authorisation (server and client secrets should match)
|
|
58
65
|
* @property {string} [cachePath] - path to session/record storage
|
|
59
66
|
*/
|
|
60
67
|
declare class AgentManager {
|
|
@@ -67,29 +74,6 @@ declare class AgentManager {
|
|
|
67
74
|
*/
|
|
68
75
|
setup(setup: Setup): this;
|
|
69
76
|
/**
|
|
70
|
-
* Start a CLI for local usage
|
|
71
|
-
* @param {string} description - introduction message for the CLI user
|
|
72
|
-
*/
|
|
73
|
-
startCli(description: string): void;
|
|
74
|
-
/**
|
|
75
|
-
* Attach a session to an AgentServer
|
|
76
|
-
* DO NOT ATTACH TO SELF, however, when in server mode
|
|
77
|
-
* An AgentServer can attach as client to another server
|
|
78
|
-
* @param {string} name - function_call name
|
|
79
|
-
* @param {string} description - function_call description
|
|
80
|
-
* @param {string} [url='ws://127.0.0.1:8000/ws'] - ws URL
|
|
81
|
-
*/
|
|
82
|
-
attach(name: string, description: string, url?: string): AgentClient;
|
|
83
|
-
/**
|
|
84
|
-
* Start the Agent in server mode.
|
|
85
|
-
* A server is always started on localhost
|
|
86
|
-
* Clients can attach now and are accesible as via function_calls (toolset)
|
|
87
|
-
* @param {string} name - function_call name
|
|
88
|
-
* @param {string} description - function_call description
|
|
89
|
-
* @param {number} [port=8000] - Start the dynamic toolset server on this port
|
|
90
|
-
*/
|
|
91
|
-
enableServer(name: string, description?: string, port?: number): void;
|
|
92
|
-
/**
|
|
93
77
|
* Direct call to the prompt
|
|
94
78
|
* @param {string} input
|
|
95
79
|
* @returns {Promise<string>}
|
|
@@ -102,11 +86,20 @@ declare class AgentManager {
|
|
|
102
86
|
/** @returns {Promise<import('./fafs.js').EnvironmentInfo>} */
|
|
103
87
|
environment(): Promise<import("./fafs.js").EnvironmentInfo>;
|
|
104
88
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
89
|
+
* Add (copy) a pre-defined toolcall to the function_calls
|
|
90
|
+
* @param {'read_file'|'write_file'|'get_user_env'|'execute_bash_script'|'send_email'|'open_link'|'execute_remote_script'|'history_search'|'javascript_interpreter'} name - name /^[a-z_0-9]{2,}$/ e.g. 'execute_bash_script'
|
|
91
|
+
*/
|
|
92
|
+
addGenericToolcall(name: "read_file" | "write_file" | "get_user_env" | "execute_bash_script" | "send_email" | "open_link" | "execute_remote_script" | "history_search" | "javascript_interpreter"): void;
|
|
93
|
+
/**
|
|
94
|
+
* Smart launcher: Dispatches to CLI/server/attach/direct. Auto-gens cliIntro/desc if empty.
|
|
95
|
+
* @param {number} [servePort] - Server port (if no input).
|
|
96
|
+
* @param {string} [connectUrl] - WS to attach. e.g. ws://127.0.0.1:8091/ws
|
|
97
|
+
* @param {string} [cliIntro=""] - CLI intro (auto-gen if falsy).
|
|
98
|
+
* @param {string} [toolName=""] - name /^[a-z_0-9]{2,}$/ Tool name for server/attach (defaults to agent.name).
|
|
99
|
+
* @param {string} [toolDescription=""] - Tool desc (auto-gen if falsy).
|
|
100
|
+
*/
|
|
101
|
+
start(servePort?: number, connectUrl?: string, cliIntro?: string, toolName?: string, toolDescription?: string): Promise<void>;
|
|
108
102
|
#private;
|
|
109
103
|
}
|
|
110
|
-
import { AgentClient } from './index.js';
|
|
111
104
|
import { Prompt } from './index.js';
|
|
112
105
|
import { ToolSet } from './index.js';
|
package/types/AgentServer.d.ts
CHANGED
|
@@ -3,9 +3,13 @@ export type Client = import("../node_modules/@j-o-r/apiserver/types/ClientWrappe
|
|
|
3
3
|
export type Prompt = import("./Prompt.js").default;
|
|
4
4
|
export type ToolSet = import("./ToolSet.js").default;
|
|
5
5
|
export type Session = import("./Session.js").default;
|
|
6
|
-
export type AuthFunction = (conn: import("@j-o-r/apiserver/types/WebSocketServer.js").WebSocketConnection) => Promise<boolean>;
|
|
6
|
+
export type AuthFunction = (conn: import("@j-o-r/apiserver/types/WebSocketServer.js").WebSocketConnection, req: any) => Promise<boolean>;
|
|
7
7
|
export type AgentServerOptions = {
|
|
8
8
|
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* - server access secret
|
|
11
|
+
*/
|
|
12
|
+
secret: string;
|
|
9
13
|
description: string;
|
|
10
14
|
prompt: Prompt;
|
|
11
15
|
session: Session;
|
package/types/Prompt.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
export default Prompt;
|
|
2
2
|
export type OARequest = typeof import("./API/openai.com/reponses/text.js").request;
|
|
3
3
|
export type XRequest = typeof import("./API/x.ai/text.js").request;
|
|
4
|
+
export type XAIRequest = typeof import("./API/x.ai/responses.js").request;
|
|
4
5
|
export type ANTHRequest = typeof import("./API/anthropic.com/text.js").request;
|
|
5
6
|
export type XOptions = import("./API/x.ai/text.js").XOptions;
|
|
7
|
+
export type XAIOptions = import("./API/x.ai/responses.js").XAIOptions;
|
|
6
8
|
export type OAOptions = import("./API/openai.com/reponses/text.js").OAOptions;
|
|
7
9
|
export type ANTHOptions = import("./API/anthropic.com/text.js").ANTHOptions;
|
|
8
10
|
export type ToolSet = import("./ToolSet.js").default;
|
|
9
11
|
/**
|
|
10
12
|
* - The AI model to use for chat functionality.
|
|
11
13
|
*/
|
|
12
|
-
export type request = OARequest | XRequest | ANTHRequest;
|
|
14
|
+
export type request = OARequest | XRequest | ANTHRequest | XAIRequest;
|
|
13
15
|
/**
|
|
14
16
|
* - Model options
|
|
15
17
|
*/
|
|
16
|
-
export type options = OAOptions | XOptions | ANTHOptions;
|
|
18
|
+
export type options = OAOptions | XOptions | ANTHOptions | XAIOptions;
|
|
17
19
|
export type Roles = "system" | "assistant" | "user" | "tool" | "log" | "reasoning";
|
|
18
20
|
export type Record = {
|
|
19
21
|
/**
|
package/types/ToolSet.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import AgentManager from './AgentManager.js';
|
|
1
2
|
import AgentServer from './AgentServer.js';
|
|
2
3
|
import AgentClient from './AgentClient.js';
|
|
3
4
|
import Prompt from './Prompt.js';
|
|
@@ -6,7 +7,7 @@ import Session from './Session.js';
|
|
|
6
7
|
export namespace API {
|
|
7
8
|
namespace text {
|
|
8
9
|
export { gpt };
|
|
9
|
-
export {
|
|
10
|
+
export { xai };
|
|
10
11
|
export { claude };
|
|
11
12
|
}
|
|
12
13
|
namespace search {
|
|
@@ -17,7 +18,7 @@ import Cli from './Cli.js';
|
|
|
17
18
|
import { env } from './fafs.js';
|
|
18
19
|
import { GLOBAL } from './fafs.js';
|
|
19
20
|
import { request as gpt } from './API/openai.com/reponses/text.js';
|
|
20
|
-
import { request as
|
|
21
|
+
import { request as xai } from './API/x.ai/responses.js';
|
|
21
22
|
import { request as claude } from './API/anthropic.com/text.js';
|
|
22
23
|
import { request as brave } from './API/brave.com/search.js';
|
|
23
|
-
export { AgentServer, AgentClient, Prompt, ToolSet, Session, Cli, env, GLOBAL };
|
|
24
|
+
export { AgentManager, AgentServer, AgentClient, Prompt, ToolSet, Session, Cli, env, GLOBAL };
|
package/types/wsCli.d.ts
ADDED