merco-agents 0.1.1

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/index.d.ts ADDED
@@ -0,0 +1,423 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ /** Wrapper for AgentBuilder to expose to JavaScript */
4
+ export declare class AgentBuilderWrapper {
5
+ name(name: string): AgentBuilderWrapper
6
+ description(description: string): AgentBuilderWrapper
7
+ role(role: JsAgentRole): AgentBuilderWrapper
8
+ llmConfig(config: JsAgentModelConfig): AgentBuilderWrapper
9
+ capabilities(capabilities: JsAgentCapabilities): AgentBuilderWrapper
10
+ tools(toolNames: Array<string>): AgentBuilderWrapper
11
+ storage(storage: JsStorageHandler): AgentBuilderWrapper
12
+ build(): Promise<JsAgent>
13
+ }
14
+
15
+ /** JavaScript wrapper for Agent */
16
+ export declare class JsAgent {
17
+ /** Get agent ID */
18
+ get id(): string
19
+ /** Get agent name */
20
+ get name(): string
21
+ /** Get agent description */
22
+ get description(): string
23
+ /** Execute a task */
24
+ call(task: JsTask): Promise<JsAgentResponse>
25
+ /** Execute a task with string input */
26
+ callStr(input: string): Promise<JsAgentResponse>
27
+ /** Execute a task with session */
28
+ callWithSession(task: JsTask, sessionKey?: string | undefined | null): Promise<JsAgentResponse>
29
+ /** Execute a task with user context */
30
+ callWithUser(task: JsTask, userId?: string | undefined | null): Promise<JsAgentResponse>
31
+ /** Stream a task execution with callbacks */
32
+ callStream(task: JsTask, handler: JsStreamingHandler): Promise<void>
33
+ /** Stream a task execution with string input */
34
+ callStrStream(input: string, handler: JsStreamingHandler): Promise<void>
35
+ /** Stream a task execution with session */
36
+ callStreamWithSession(task: JsTask, sessionKey: string | undefined | null, handler: JsStreamingHandler): Promise<void>
37
+ }
38
+
39
+ /** JavaScript wrapper for Session */
40
+ export declare class JsSession {
41
+ /** Create a new session */
42
+ static new(name: string): JsSession
43
+ /** Create a session with description */
44
+ static withDescription(name: string, description: string): JsSession
45
+ /** Get session ID */
46
+ get id(): bigint
47
+ /** Get session name */
48
+ get name(): string
49
+ /** Get session description */
50
+ get description(): string | null
51
+ /** Get message count */
52
+ messageCount(): bigint
53
+ /** Get total tokens */
54
+ totalTokens(): bigint
55
+ /** Get tool call count */
56
+ toolCallCount(): bigint
57
+ /** Get unique tools used */
58
+ uniqueToolsUsed(): Array<string>
59
+ /** Get last activity timestamp */
60
+ lastActivity(): string
61
+ /** Serialize session to JSON */
62
+ toJson(): string
63
+ /** Deserialize session from JSON */
64
+ static fromJson(json: string): JsSession
65
+ }
66
+
67
+ /** JavaScript wrapper for StorageHandler */
68
+ export declare class JsStorageHandler {
69
+ /** Create a new session */
70
+ createSession(session: JsSession): Promise<void>
71
+ /** Get a session by ID */
72
+ getSession(id: number): Promise<JsSession | null>
73
+ /** List all sessions */
74
+ listSessions(): Promise<Array<JsSession>>
75
+ /** Update a session */
76
+ updateSession(session: JsSession): Promise<void>
77
+ /** Delete a session by ID */
78
+ deleteSession(id: number): Promise<void>
79
+ /** Close the storage connection */
80
+ close(): Promise<void>
81
+ }
82
+
83
+ /** JavaScript callback-based streaming handler */
84
+ export declare class JsStreamingHandler {
85
+ /** Creates a new instance of JsStreamingHandler */
86
+ static new(): JsStreamingHandler
87
+ /** Sets the callback for handling streaming chunks */
88
+ withOnChunk(callback: (arg: JsStreamingChunk) => void): JsStreamingHandler
89
+ /** Sets the callback for handling the final response */
90
+ withOnFinal(callback: (arg: JsStreamingResponse) => void): JsStreamingHandler
91
+ /** Sets the callback for handling errors */
92
+ withOnError(callback: (arg: string) => void): JsStreamingHandler
93
+ /**
94
+ * Sets the callback for handling tool call start events
95
+ * The callback should return a boolean: true to allow execution, false to reject
96
+ * The callback receives a JsToolCallStart object with tool_name, call_id, and execution_id.
97
+ * The callback should call tool_call_start_complete(execution_id, allow) to return the result.
98
+ */
99
+ withOnToolCallStart(callback: (arg: JsToolCallStart) => boolean): JsStreamingHandler
100
+ /** Sets the callback for handling tool call after execution events */
101
+ withOnToolCallAfterExecution(callback: (arg: JsToolCallExecuted) => void): JsStreamingHandler
102
+ }
103
+
104
+ /** JavaScript wrapper for Task */
105
+ export declare class JsTask {
106
+ /** Create a new text task */
107
+ constructor(description: string, expectedOutput?: string | undefined | null)
108
+ /** Create a new task with JSON output format */
109
+ static newWithJson(description: string, expectedOutput: string | undefined | null, requiredFields: Array<JsJsonField>, optionalFields: Array<JsJsonField>, strict: boolean): JsTask
110
+ /** Create a simple JSON task */
111
+ static newSimpleJson(description: string, expectedOutput: string | undefined | null, requiredFields: Array<[string, JsJsonFieldType]>, strict: boolean): JsTask
112
+ /** Validate output against task format */
113
+ validate(output: string): boolean
114
+ /** Get task description */
115
+ get description(): string
116
+ /** Get expected output */
117
+ get expectedOutput(): string | null
118
+ }
119
+
120
+ /** Create a new agent using the builder pattern */
121
+ export declare function agentBuilder(): Promise<AgentBuilderWrapper>
122
+
123
+ /** JavaScript representation of AgentCapabilities */
124
+ export interface JsAgentCapabilities {
125
+ maxConcurrentTasks: number
126
+ supportedOutputFormats: Array<JsOutputFormat>
127
+ }
128
+
129
+ /** JavaScript representation of AgentModelConfig */
130
+ export interface JsAgentModelConfig {
131
+ modelName: string
132
+ temperature: number
133
+ maxTokens: number
134
+ llmConfig: JsLlmConfig
135
+ reasoningEffort?: JsReasoningEffort
136
+ }
137
+
138
+ /** JavaScript representation of AgentResponse */
139
+ export interface JsAgentResponse {
140
+ content: string
141
+ success: boolean
142
+ executionTimeMs: number
143
+ inputTokens: number
144
+ outputTokens: number
145
+ totalTokens: number
146
+ toolsUsed: Array<string>
147
+ toolCalls: Array<string>
148
+ toolCallsCount: number
149
+ toolExecutionTimeMs: number
150
+ outputFormat: string
151
+ modelUsed: string
152
+ temperature: number
153
+ error?: string
154
+ errorCode?: string
155
+ timestamp: string
156
+ metadata?: string
157
+ sessionInfo?: JsSessionInfo
158
+ reasoning?: string
159
+ reasoningSummary?: string
160
+ encryptedReasoningItems?: Array<string>
161
+ }
162
+
163
+ /** JavaScript representation of AgentRole */
164
+ export interface JsAgentRole {
165
+ name: string
166
+ description: string
167
+ metadata?: string
168
+ developerInstructions?: string
169
+ }
170
+
171
+ /** JavaScript representation of ChunkType */
172
+ export declare const enum JsChunkType {
173
+ Text = 0,
174
+ Reasoning = 1,
175
+ ToolCall = 2,
176
+ ToolCallResult = 3
177
+ }
178
+
179
+ /** JavaScript representation of JsonField */
180
+ export interface JsJsonField {
181
+ name: string
182
+ fieldType: JsJsonFieldType
183
+ description?: string
184
+ }
185
+
186
+ /** JavaScript representation of JsonFieldType */
187
+ export declare const enum JsJsonFieldType {
188
+ String = 0,
189
+ Number = 1,
190
+ Boolean = 2,
191
+ Array = 3,
192
+ Object = 4
193
+ }
194
+
195
+ /**
196
+ * JavaScript representation of JSON Schema for tool parameters
197
+ * Matches the structure of merco_llmproxy::JsonSchema
198
+ *
199
+ * Note: properties is a JSON string that will be parsed into a serde_json::Map.
200
+ * This allows TypeScript to pass a typed object which gets serialized to JSON.
201
+ */
202
+ export interface JsJsonSchema {
203
+ /** The schema type, typically "object" for tool parameters */
204
+ schemaType?: string
205
+ /**
206
+ * Properties of the schema as a JSON string (will be parsed)
207
+ * In TypeScript, pass a plain object - it will be serialized automatically
208
+ */
209
+ properties?: string
210
+ /** List of required property names */
211
+ required?: Array<string>
212
+ }
213
+
214
+ /** JavaScript representation of LlmConfig */
215
+ export interface JsLlmConfig {
216
+ provider: JsProvider
217
+ apiKey?: string
218
+ baseUrl?: string
219
+ headers?: string
220
+ }
221
+
222
+ /** JavaScript representation of OutputFormat (for agent capabilities) */
223
+ export declare const enum JsOutputFormat {
224
+ Text = 0,
225
+ Json = 1,
226
+ Markdown = 2,
227
+ Html = 3,
228
+ MultiModal = 4
229
+ }
230
+
231
+ /** JavaScript representation of PostgresConfig */
232
+ export interface JsPostgresConfig {
233
+ host: string
234
+ port?: number
235
+ database: string
236
+ username: string
237
+ password: string
238
+ schema?: string
239
+ sslMode?: string
240
+ maxConnections?: number
241
+ minConnections?: number
242
+ connectionTimeout?: number
243
+ idleTimeout?: number
244
+ }
245
+
246
+ /** JavaScript representation of Provider enum */
247
+ export declare const enum JsProvider {
248
+ OpenAI = 0,
249
+ Anthropic = 1,
250
+ Google = 2,
251
+ Ollama = 3,
252
+ Custom = 4
253
+ }
254
+
255
+ /** JavaScript representation of reasoning event */
256
+ export interface JsReasoning {
257
+ reasoningChunk: string
258
+ accumulatedReasoning: string
259
+ }
260
+
261
+ /** JavaScript representation of ReasoningEffort */
262
+ export declare const enum JsReasoningEffort {
263
+ Low = 0,
264
+ Medium = 1,
265
+ High = 2
266
+ }
267
+
268
+ /** JavaScript representation of SessionInfo */
269
+ export interface JsSessionInfo {
270
+ sessionId: number
271
+ sessionName: string
272
+ totalMessages: number
273
+ totalTokens: number
274
+ toolCallsCount: number
275
+ uniqueToolsUsed: Array<string>
276
+ lastActivity: string
277
+ }
278
+
279
+ /** JavaScript representation of SqliteConfig */
280
+ export interface JsSqliteConfig {
281
+ databasePath: string
282
+ createIfMissing?: boolean
283
+ journalMode?: string
284
+ synchronous?: string
285
+ cacheSize?: number
286
+ foreignKeys?: boolean
287
+ maxConnections?: number
288
+ connectionTimeout?: number
289
+ busyTimeout?: number
290
+ }
291
+
292
+ /** JavaScript representation of StreamingChunk */
293
+ export interface JsStreamingChunk {
294
+ chunkType: JsChunkType
295
+ content: string
296
+ isFinal: boolean
297
+ accumulatedContent: string
298
+ toolCalls?: Array<string>
299
+ hasToolCalls: boolean
300
+ usage?: JsStreamingUsage
301
+ finishReason?: string
302
+ timestamp: string
303
+ metadata?: string
304
+ reasoning?: string
305
+ accumulatedReasoning?: string
306
+ toolCallName?: string
307
+ toolCallId?: string
308
+ toolCallArgs?: string
309
+ toolCallResult?: string
310
+ toolCallExecutionTimeMs?: number
311
+ reasoningSummary?: string
312
+ }
313
+
314
+ /** JavaScript representation of StreamingResponse */
315
+ export interface JsStreamingResponse {
316
+ content: string
317
+ success: boolean
318
+ executionTimeMs: number
319
+ totalTokens: number
320
+ toolsUsed: Array<string>
321
+ toolCalls: Array<string>
322
+ outputFormat: string
323
+ modelUsed: string
324
+ temperature: number
325
+ error?: string
326
+ errorCode?: string
327
+ timestamp: string
328
+ metadata?: string
329
+ reasoning?: string
330
+ reasoningSummary?: string
331
+ encryptedReasoningItems?: Array<string>
332
+ }
333
+
334
+ /** JavaScript representation of StreamingUsage */
335
+ export interface JsStreamingUsage {
336
+ promptTokens: number
337
+ completionTokens: number
338
+ totalTokens: number
339
+ reasoningTokens?: number
340
+ }
341
+
342
+ /** JavaScript representation of ToolCall */
343
+ export interface JsToolCall {
344
+ toolName: string
345
+ parameters: string
346
+ result: string
347
+ executionTimeMs: number
348
+ error?: string
349
+ outputFormat: string
350
+ }
351
+
352
+ /** JavaScript representation of tool call executed event */
353
+ export interface JsToolCallExecuted {
354
+ toolName: string
355
+ callId: string
356
+ result: string
357
+ executionTimeMs: number
358
+ error?: string
359
+ }
360
+
361
+ /** JavaScript representation of tool call ready event */
362
+ export interface JsToolCallReady {
363
+ toolName: string
364
+ callId: string
365
+ completeArgs: string
366
+ }
367
+
368
+ /** JavaScript representation of tool call start event */
369
+ export interface JsToolCallStart {
370
+ toolName: string
371
+ callId: string
372
+ executionId?: string
373
+ }
374
+
375
+ /** JavaScript representation of tool call streaming event */
376
+ export interface JsToolCallStreaming {
377
+ toolName: string
378
+ callId: string
379
+ partialArgs: string
380
+ }
381
+
382
+ /** Create storage from URL */
383
+ export declare function storageCreateFromUrl(url: string): Promise<JsStorageHandler>
384
+
385
+ /** Create PostgreSQL storage */
386
+ export declare function storageCreatePostgres(config: JsPostgresConfig): Promise<JsStorageHandler>
387
+
388
+ /** Create SQLite storage */
389
+ export declare function storageCreateSqlite(config: JsSqliteConfig): Promise<JsStorageHandler>
390
+
391
+ /**
392
+ * Store result from tool call start callback (called from JS side)
393
+ * The JS callback should call this function with the execution_id and allow boolean
394
+ */
395
+ export declare function toolCallStartComplete(executionId: string, allow: boolean): void
396
+
397
+ /**
398
+ * Store result from JS tool execution (called from JS side via a special API)
399
+ * This is called by the JS wrapper function automatically
400
+ */
401
+ export declare function toolCompleteExecution(executionId: string, result: string, isError: boolean): void
402
+
403
+ /** List all registered tools */
404
+ export declare function toolList(): Array<string>
405
+
406
+ /**
407
+ * Register a tool from JavaScript function
408
+ * The callback can be synchronous: (args: object) => any
409
+ * Or asynchronous: (args: object) => Promise<any>
410
+ * The function receives parsed JSON arguments and should return a value (or Promise of value)
411
+ *
412
+ * Note: The function will receive a string containing JSON with __execution_id and __args.
413
+ * The user's function should parse this and call tool_complete_execution when done.
414
+ * A helper wrapper will be provided in the JS/TS layer to simplify this.
415
+ */
416
+ export declare function toolRegister(name: string, description: string, parameters: JsJsonSchema, callback: (arg: string) => void): void
417
+
418
+ /**
419
+ * Unregister a tool
420
+ * Note: merco_llmproxy doesn't currently support unregistering tools.
421
+ * This function is kept for API compatibility but does nothing.
422
+ */
423
+ export declare function toolUnregister(name: string): void
package/lib/index.d.ts ADDED
@@ -0,0 +1,282 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ /** Wrapper for AgentBuilder to expose to JavaScript */
4
+ export declare class AgentBuilderWrapper {
5
+ name(name: string): AgentBuilderWrapper
6
+ description(description: string): AgentBuilderWrapper
7
+ role(role: JsAgentRole): AgentBuilderWrapper
8
+ llmConfig(config: JsAgentModelConfig): AgentBuilderWrapper
9
+ capabilities(capabilities: JsAgentCapabilities): AgentBuilderWrapper
10
+ storage(storage: JsStorageHandler): AgentBuilderWrapper
11
+ build(): Promise<JsAgent>
12
+ }
13
+
14
+ /** JavaScript wrapper for Agent */
15
+ export declare class JsAgent {
16
+ /** Get agent ID */
17
+ get id(): string
18
+ /** Get agent name */
19
+ get name(): string
20
+ /** Get agent description */
21
+ get description(): string
22
+ /** Execute a task */
23
+ call(task: JsTask): Promise<JsAgentResponse>
24
+ /** Execute a task with string input */
25
+ callStr(input: string): Promise<JsAgentResponse>
26
+ /** Execute a task with session */
27
+ callWithSession(task: JsTask, sessionKey?: string | undefined | null): Promise<JsAgentResponse>
28
+ /** Execute a task with user context */
29
+ callWithUser(task: JsTask, userId?: string | undefined | null): Promise<JsAgentResponse>
30
+ /**
31
+ * Stream a task execution with callbacks
32
+ * Note: callbacks parameter is temporarily removed due to Function type limitations in #[napi(object)]
33
+ * This will be re-implemented with a different approach
34
+ */
35
+ callStream(task: JsTask, callbacks?: string | undefined | null): Promise<void>
36
+ /** Stream a task execution with string input */
37
+ callStrStream(input: string, callbacks?: string | undefined | null): Promise<void>
38
+ /** Stream a task execution with session */
39
+ callStreamWithSession(task: JsTask, sessionKey?: string | undefined | null, callbacks?: string | undefined | null): Promise<void>
40
+ }
41
+
42
+ /** JavaScript wrapper for Session */
43
+ export declare class JsSession {
44
+ /** Create a new session */
45
+ static new(name: string): JsSession
46
+ /** Create a session with description */
47
+ static withDescription(name: string, description: string): JsSession
48
+ /** Get session ID */
49
+ get id(): bigint
50
+ /** Get session name */
51
+ get name(): string
52
+ /** Get session description */
53
+ get description(): string | null
54
+ /** Get message count */
55
+ messageCount(): bigint
56
+ /** Get total tokens */
57
+ totalTokens(): bigint
58
+ /** Get tool call count */
59
+ toolCallCount(): bigint
60
+ /** Get unique tools used */
61
+ uniqueToolsUsed(): Array<string>
62
+ /** Get last activity timestamp */
63
+ lastActivity(): string
64
+ /** Serialize session to JSON */
65
+ toJson(): string
66
+ /** Deserialize session from JSON */
67
+ static fromJson(json: string): JsSession
68
+ }
69
+
70
+ /** JavaScript wrapper for StorageHandler */
71
+ export declare class JsStorageHandler {
72
+ /** Create a new session */
73
+ createSession(session: JsSession): Promise<void>
74
+ /** Get a session by ID */
75
+ getSession(id: number): Promise<JsSession | null>
76
+ /** List all sessions */
77
+ listSessions(): Promise<Array<JsSession>>
78
+ /** Update a session */
79
+ updateSession(session: JsSession): Promise<void>
80
+ /** Delete a session by ID */
81
+ deleteSession(id: number): Promise<void>
82
+ /** Close the storage connection */
83
+ close(): Promise<void>
84
+ }
85
+
86
+ /** JavaScript wrapper for Task */
87
+ export declare class JsTask {
88
+ /** Create a new text task */
89
+ constructor(description: string, expectedOutput?: string | undefined | null)
90
+ /** Create a new task with JSON output format */
91
+ static newWithJson(description: string, expectedOutput: string | undefined | null, requiredFields: Array<JsJsonField>, optionalFields: Array<JsJsonField>, strict: boolean): JsTask
92
+ /** Create a simple JSON task */
93
+ static newSimpleJson(description: string, expectedOutput: string | undefined | null, requiredFields: Array<[string, JsJsonFieldType]>, strict: boolean): JsTask
94
+ /** Validate output against task format */
95
+ validate(output: string): boolean
96
+ /** Get task description */
97
+ get description(): string
98
+ /** Get expected output */
99
+ get expectedOutput(): string | null
100
+ }
101
+
102
+ /** Create a new agent using the builder pattern */
103
+ export declare function agentBuilder(): Promise<AgentBuilderWrapper>
104
+
105
+ /** JavaScript representation of AgentCapabilities */
106
+ export interface JsAgentCapabilities {
107
+ maxConcurrentTasks: number
108
+ supportedOutputFormats: Array<JsOutputFormat>
109
+ }
110
+
111
+ /** JavaScript representation of AgentModelConfig */
112
+ export interface JsAgentModelConfig {
113
+ modelName: string
114
+ temperature: number
115
+ maxTokens: number
116
+ llmConfig: JsLlmConfig
117
+ }
118
+
119
+ /** JavaScript representation of AgentResponse */
120
+ export interface JsAgentResponse {
121
+ content: string
122
+ success: boolean
123
+ executionTimeMs: number
124
+ inputTokens: number
125
+ outputTokens: number
126
+ totalTokens: number
127
+ toolsUsed: Array<string>
128
+ toolCalls: Array<string>
129
+ toolCallsCount: number
130
+ toolExecutionTimeMs: number
131
+ outputFormat: string
132
+ modelUsed: string
133
+ temperature: number
134
+ error?: string
135
+ timestamp: string
136
+ metadata?: string
137
+ sessionInfo?: JsSessionInfo
138
+ }
139
+
140
+ /** JavaScript representation of AgentRole */
141
+ export interface JsAgentRole {
142
+ name: string
143
+ description: string
144
+ metadata?: string
145
+ }
146
+
147
+ /** JavaScript representation of JsonField */
148
+ export interface JsJsonField {
149
+ name: string
150
+ fieldType: JsJsonFieldType
151
+ description?: string
152
+ }
153
+
154
+ /** JavaScript representation of JsonFieldType */
155
+ export declare const enum JsJsonFieldType {
156
+ String = 0,
157
+ Number = 1,
158
+ Boolean = 2,
159
+ Array = 3,
160
+ Object = 4
161
+ }
162
+
163
+ /** JavaScript representation of LlmConfig */
164
+ export interface JsLlmConfig {
165
+ provider: JsProvider
166
+ apiKey?: string
167
+ baseUrl?: string
168
+ headers?: string
169
+ }
170
+
171
+ /** JavaScript representation of OutputFormat (for agent capabilities) */
172
+ export declare const enum JsOutputFormat {
173
+ Text = 0,
174
+ Json = 1,
175
+ Markdown = 2,
176
+ Html = 3,
177
+ MultiModal = 4
178
+ }
179
+
180
+ /** JavaScript representation of PostgresConfig */
181
+ export interface JsPostgresConfig {
182
+ host: string
183
+ port?: number
184
+ database: string
185
+ username: string
186
+ password: string
187
+ schema?: string
188
+ sslMode?: string
189
+ maxConnections?: number
190
+ minConnections?: number
191
+ connectionTimeout?: number
192
+ idleTimeout?: number
193
+ }
194
+
195
+ /** JavaScript representation of Provider enum */
196
+ export declare const enum JsProvider {
197
+ OpenAI = 0,
198
+ Anthropic = 1,
199
+ Google = 2,
200
+ Ollama = 3,
201
+ Custom = 4
202
+ }
203
+
204
+ /** JavaScript representation of SessionInfo */
205
+ export interface JsSessionInfo {
206
+ sessionId: number
207
+ sessionName: string
208
+ totalMessages: number
209
+ totalTokens: number
210
+ toolCallsCount: number
211
+ uniqueToolsUsed: Array<string>
212
+ lastActivity: string
213
+ }
214
+
215
+ /** JavaScript representation of SqliteConfig */
216
+ export interface JsSqliteConfig {
217
+ databasePath: string
218
+ createIfMissing?: boolean
219
+ journalMode?: string
220
+ synchronous?: string
221
+ cacheSize?: number
222
+ foreignKeys?: boolean
223
+ maxConnections?: number
224
+ connectionTimeout?: number
225
+ busyTimeout?: number
226
+ }
227
+
228
+ /** JavaScript representation of StreamingChunk */
229
+ export interface JsStreamingChunk {
230
+ content: string
231
+ isFinal: boolean
232
+ accumulatedContent: string
233
+ toolCalls?: Array<string>
234
+ hasToolCalls: boolean
235
+ usage?: JsStreamingUsage
236
+ finishReason?: string
237
+ timestamp: string
238
+ metadata?: string
239
+ }
240
+
241
+ /** JavaScript representation of StreamingResponse */
242
+ export interface JsStreamingResponse {
243
+ content: string
244
+ success: boolean
245
+ executionTimeMs: number
246
+ totalTokens: number
247
+ toolsUsed: Array<string>
248
+ toolCalls: Array<string>
249
+ outputFormat: string
250
+ modelUsed: string
251
+ temperature: number
252
+ error?: string
253
+ timestamp: string
254
+ metadata?: string
255
+ }
256
+
257
+ /** JavaScript representation of StreamingUsage */
258
+ export interface JsStreamingUsage {
259
+ promptTokens: number
260
+ completionTokens: number
261
+ totalTokens: number
262
+ }
263
+
264
+ /** Create storage from URL */
265
+ export declare function storageCreateFromUrl(url: string): Promise<JsStorageHandler>
266
+
267
+ /** Create PostgreSQL storage */
268
+ export declare function storageCreatePostgres(config: JsPostgresConfig): Promise<JsStorageHandler>
269
+
270
+ /** Create SQLite storage */
271
+ export declare function storageCreateSqlite(config: JsSqliteConfig): Promise<JsStorageHandler>
272
+
273
+ /** List all registered tools */
274
+ export declare function toolList(): Array<string>
275
+
276
+ /** Register a tool from JavaScript function */
277
+ export declare function toolRegister(name: string, description: string, parameters: string, callback: (arg?: unknown) => unknown): void
278
+
279
+ /** Unregister a tool */
280
+ export declare function toolUnregister(name: string): void
281
+
282
+