art-framework 0.2.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/LICENSE +21 -0
- package/README.md +0 -0
- package/dist/index.cjs +47 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +937 -0
- package/dist/index.d.ts +937 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,937 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the role of a message sender in a conversation.
|
|
3
|
+
*/
|
|
4
|
+
declare enum MessageRole {
|
|
5
|
+
USER = "USER",
|
|
6
|
+
AI = "AI",
|
|
7
|
+
SYSTEM = "SYSTEM",// Added for system prompts, though not explicitly in checklist message interface
|
|
8
|
+
TOOL = "TOOL"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a single message within a conversation thread.
|
|
12
|
+
*/
|
|
13
|
+
interface ConversationMessage {
|
|
14
|
+
messageId: string;
|
|
15
|
+
threadId: string;
|
|
16
|
+
role: MessageRole;
|
|
17
|
+
content: string;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
metadata?: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Represents the type of an observation record.
|
|
23
|
+
*/
|
|
24
|
+
declare enum ObservationType {
|
|
25
|
+
INTENT = "INTENT",
|
|
26
|
+
PLAN = "PLAN",
|
|
27
|
+
THOUGHTS = "THOUGHTS",
|
|
28
|
+
TOOL_CALL = "TOOL_CALL",// Renamed from checklist for clarity
|
|
29
|
+
TOOL_EXECUTION = "TOOL_EXECUTION",
|
|
30
|
+
SYNTHESIS = "SYNTHESIS",// Added for final synthesis step
|
|
31
|
+
ERROR = "ERROR",
|
|
32
|
+
FINAL_RESPONSE = "FINAL_RESPONSE",// Added for the final AI response message
|
|
33
|
+
STATE_UPDATE = "STATE_UPDATE"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents a recorded event during the agent's execution.
|
|
37
|
+
*/
|
|
38
|
+
interface Observation {
|
|
39
|
+
id: string;
|
|
40
|
+
threadId: string;
|
|
41
|
+
traceId?: string;
|
|
42
|
+
timestamp: number;
|
|
43
|
+
type: ObservationType;
|
|
44
|
+
title: string;
|
|
45
|
+
content: any;
|
|
46
|
+
metadata?: Record<string, any>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents a basic JSON Schema definition, focusing on object types commonly used for tool inputs/outputs.
|
|
50
|
+
* This is a simplified representation and doesn't cover all JSON Schema features.
|
|
51
|
+
*/
|
|
52
|
+
interface JsonObjectSchema {
|
|
53
|
+
type: 'object';
|
|
54
|
+
properties: {
|
|
55
|
+
[key: string]: {
|
|
56
|
+
type: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
default?: any;
|
|
59
|
+
items?: JsonObjectSchema | {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
properties?: JsonObjectSchema['properties'];
|
|
63
|
+
required?: string[];
|
|
64
|
+
additionalProperties?: boolean | {
|
|
65
|
+
type: string;
|
|
66
|
+
};
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
required?: string[];
|
|
71
|
+
additionalProperties?: boolean;
|
|
72
|
+
}
|
|
73
|
+
type JsonSchema = JsonObjectSchema | {
|
|
74
|
+
type: 'string' | 'number' | 'boolean' | 'array';
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Defines the schema for a tool, including its input parameters.
|
|
79
|
+
* Uses JSON Schema format for inputSchema.
|
|
80
|
+
*/
|
|
81
|
+
interface ToolSchema {
|
|
82
|
+
name: string;
|
|
83
|
+
description: string;
|
|
84
|
+
inputSchema: JsonSchema;
|
|
85
|
+
outputSchema?: JsonSchema;
|
|
86
|
+
examples?: Array<{
|
|
87
|
+
input: any;
|
|
88
|
+
output?: any;
|
|
89
|
+
description?: string;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Represents the structured result of a tool execution.
|
|
94
|
+
*/
|
|
95
|
+
interface ToolResult {
|
|
96
|
+
callId: string;
|
|
97
|
+
toolName: string;
|
|
98
|
+
status: 'success' | 'error';
|
|
99
|
+
output?: any;
|
|
100
|
+
error?: string;
|
|
101
|
+
metadata?: Record<string, any>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Represents a parsed request from the LLM to call a specific tool.
|
|
105
|
+
*/
|
|
106
|
+
interface ParsedToolCall {
|
|
107
|
+
callId: string;
|
|
108
|
+
toolName: string;
|
|
109
|
+
arguments: any;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Configuration specific to a conversation thread.
|
|
113
|
+
*/
|
|
114
|
+
interface ThreadConfig {
|
|
115
|
+
reasoning: {
|
|
116
|
+
provider: string;
|
|
117
|
+
model: string;
|
|
118
|
+
parameters?: Record<string, any>;
|
|
119
|
+
};
|
|
120
|
+
enabledTools: string[];
|
|
121
|
+
historyLimit: number;
|
|
122
|
+
systemPrompt?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Represents non-configuration state associated with an agent or thread.
|
|
126
|
+
* Could include user preferences, accumulated knowledge, etc. (Less defined for v1.0)
|
|
127
|
+
*/
|
|
128
|
+
interface AgentState {
|
|
129
|
+
[key: string]: any;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Encapsulates the configuration and state for a specific thread.
|
|
133
|
+
*/
|
|
134
|
+
interface ThreadContext {
|
|
135
|
+
config: ThreadConfig;
|
|
136
|
+
state: AgentState | null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Properties required to initiate an agent processing cycle.
|
|
140
|
+
*/
|
|
141
|
+
interface AgentProps {
|
|
142
|
+
query: string;
|
|
143
|
+
threadId: string;
|
|
144
|
+
sessionId?: string;
|
|
145
|
+
userId?: string;
|
|
146
|
+
traceId?: string;
|
|
147
|
+
options?: AgentOptions;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Options to override agent behavior at runtime.
|
|
151
|
+
*/
|
|
152
|
+
interface AgentOptions {
|
|
153
|
+
llmParams?: Record<string, any>;
|
|
154
|
+
forceTools?: string[];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The final structured response returned by the agent core after processing.
|
|
158
|
+
*/
|
|
159
|
+
interface AgentFinalResponse {
|
|
160
|
+
response: ConversationMessage;
|
|
161
|
+
metadata: ExecutionMetadata;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Metadata summarizing an agent execution cycle.
|
|
165
|
+
*/
|
|
166
|
+
interface ExecutionMetadata {
|
|
167
|
+
threadId: string;
|
|
168
|
+
traceId?: string;
|
|
169
|
+
userId?: string;
|
|
170
|
+
status: 'success' | 'error' | 'partial';
|
|
171
|
+
totalDurationMs: number;
|
|
172
|
+
llmCalls: number;
|
|
173
|
+
toolCalls: number;
|
|
174
|
+
llmCost?: number;
|
|
175
|
+
error?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Context provided to a tool during its execution.
|
|
179
|
+
*/
|
|
180
|
+
interface ExecutionContext {
|
|
181
|
+
threadId: string;
|
|
182
|
+
traceId?: string;
|
|
183
|
+
userId?: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Options for configuring an LLM call.
|
|
187
|
+
*/
|
|
188
|
+
interface CallOptions {
|
|
189
|
+
threadId: string;
|
|
190
|
+
traceId?: string;
|
|
191
|
+
userId?: string;
|
|
192
|
+
onThought?: (thought: string) => void;
|
|
193
|
+
[key: string]: any;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Represents the prompt data formatted for a specific LLM provider.
|
|
197
|
+
* Can be a simple string or a complex object (e.g., for OpenAI Chat Completion API).
|
|
198
|
+
*/
|
|
199
|
+
type FormattedPrompt = string | object | Array<object>;
|
|
200
|
+
/**
|
|
201
|
+
* Options for filtering data retrieved from storage.
|
|
202
|
+
* Structure depends heavily on the underlying adapter's capabilities.
|
|
203
|
+
*/
|
|
204
|
+
interface FilterOptions {
|
|
205
|
+
filter?: Record<string, any>;
|
|
206
|
+
sort?: Record<string, 'asc' | 'desc'>;
|
|
207
|
+
limit?: number;
|
|
208
|
+
skip?: number;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Options for retrieving conversation messages.
|
|
212
|
+
*/
|
|
213
|
+
interface MessageOptions {
|
|
214
|
+
limit?: number;
|
|
215
|
+
beforeTimestamp?: number;
|
|
216
|
+
afterTimestamp?: number;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Options for filtering observations.
|
|
220
|
+
*/
|
|
221
|
+
interface ObservationFilter {
|
|
222
|
+
types?: ObservationType[];
|
|
223
|
+
beforeTimestamp?: number;
|
|
224
|
+
afterTimestamp?: number;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
type UnsubscribeFunction = () => void;
|
|
228
|
+
interface Subscription<DataType, FilterType> {
|
|
229
|
+
id: string;
|
|
230
|
+
callback: (data: DataType) => void;
|
|
231
|
+
filter?: FilterType;
|
|
232
|
+
options?: {
|
|
233
|
+
threadId?: string;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* A generic class for implementing a publish/subscribe pattern with filtering capabilities.
|
|
238
|
+
* Designed for decoupling components, particularly UI updates from backend events.
|
|
239
|
+
*/
|
|
240
|
+
declare class TypedSocket$1<DataType, FilterType = any> {
|
|
241
|
+
protected subscriptions: Map<string, Subscription<DataType, FilterType>>;
|
|
242
|
+
constructor();
|
|
243
|
+
/**
|
|
244
|
+
* Subscribes a callback function to receive notifications.
|
|
245
|
+
* @param callback - The function to call when new data is notified.
|
|
246
|
+
* @param filter - An optional filter to only receive specific types of data.
|
|
247
|
+
* @param options - Optional configuration, like a threadId for filtering.
|
|
248
|
+
* @returns An unsubscribe function.
|
|
249
|
+
*/
|
|
250
|
+
subscribe(callback: (data: DataType) => void, filter?: FilterType, options?: {
|
|
251
|
+
threadId?: string;
|
|
252
|
+
}): UnsubscribeFunction;
|
|
253
|
+
/**
|
|
254
|
+
* Notifies all relevant subscribers with new data.
|
|
255
|
+
* @param data - The data payload to send to subscribers.
|
|
256
|
+
* @param options - Optional targeting options (e.g., targetThreadId).
|
|
257
|
+
* @param filterCheck - A function to check if a subscription's filter matches the data.
|
|
258
|
+
*/
|
|
259
|
+
notify(data: DataType, options?: {
|
|
260
|
+
targetThreadId?: string;
|
|
261
|
+
targetSessionId?: string;
|
|
262
|
+
}, // targetSessionId might be useful later
|
|
263
|
+
filterCheck?: (data: DataType, filter?: FilterType) => boolean): void;
|
|
264
|
+
/**
|
|
265
|
+
* Optional: Retrieves historical data. This base implementation is empty.
|
|
266
|
+
* Subclasses might implement this by interacting with repositories.
|
|
267
|
+
*/
|
|
268
|
+
getHistory?(_filter?: FilterType, _options?: {
|
|
269
|
+
threadId?: string;
|
|
270
|
+
limit?: number;
|
|
271
|
+
}): Promise<DataType[]>;
|
|
272
|
+
/**
|
|
273
|
+
* Clears all subscriptions. Useful for cleanup.
|
|
274
|
+
*/
|
|
275
|
+
clearAllSubscriptions(): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* A specialized TypedSocket for handling Observation data.
|
|
280
|
+
* Allows filtering by ObservationType.
|
|
281
|
+
* Can optionally fetch historical observations from a repository.
|
|
282
|
+
*/
|
|
283
|
+
declare class ObservationSocket$1 extends TypedSocket$1<Observation, ObservationType | ObservationType[]> {
|
|
284
|
+
private observationRepository?;
|
|
285
|
+
constructor(observationRepository?: IObservationRepository);
|
|
286
|
+
/**
|
|
287
|
+
* Notifies subscribers about a new observation.
|
|
288
|
+
* @param observation - The observation data.
|
|
289
|
+
*/
|
|
290
|
+
notifyObservation(observation: Observation): void;
|
|
291
|
+
/**
|
|
292
|
+
* Retrieves historical observations, optionally filtered by type and thread.
|
|
293
|
+
* Requires an ObservationRepository to be configured.
|
|
294
|
+
* @param filter - Optional ObservationType or array of types to filter by.
|
|
295
|
+
* @param options - Optional threadId and limit.
|
|
296
|
+
* @returns A promise resolving to an array of observations.
|
|
297
|
+
*/
|
|
298
|
+
getHistory(filter?: ObservationType | ObservationType[], options?: {
|
|
299
|
+
threadId?: string;
|
|
300
|
+
limit?: number;
|
|
301
|
+
}): Promise<Observation[]>;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* A specialized TypedSocket for handling ConversationMessage data.
|
|
306
|
+
* Allows filtering by MessageRole.
|
|
307
|
+
* Can optionally fetch historical messages from a repository.
|
|
308
|
+
*/
|
|
309
|
+
declare class ConversationSocket$1 extends TypedSocket$1<ConversationMessage, MessageRole | MessageRole[]> {
|
|
310
|
+
private conversationRepository?;
|
|
311
|
+
constructor(conversationRepository?: IConversationRepository);
|
|
312
|
+
/**
|
|
313
|
+
* Notifies subscribers about a new conversation message.
|
|
314
|
+
* @param message - The conversation message data.
|
|
315
|
+
*/
|
|
316
|
+
notifyMessage(message: ConversationMessage): void;
|
|
317
|
+
/**
|
|
318
|
+
* Retrieves historical messages, optionally filtered by role and thread.
|
|
319
|
+
* Requires a ConversationRepository to be configured.
|
|
320
|
+
* @param filter - Optional MessageRole or array of roles to filter by.
|
|
321
|
+
* @param options - Optional threadId and limit.
|
|
322
|
+
* @returns A promise resolving to an array of messages.
|
|
323
|
+
*/
|
|
324
|
+
getHistory(filter?: MessageRole | MessageRole[], options?: {
|
|
325
|
+
threadId?: string;
|
|
326
|
+
limit?: number;
|
|
327
|
+
}): Promise<ConversationMessage[]>;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Interface for the central agent orchestrator.
|
|
332
|
+
*/
|
|
333
|
+
interface IAgentCore {
|
|
334
|
+
process(props: AgentProps): Promise<AgentFinalResponse>;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Interface for the component responsible for interacting with LLMs.
|
|
338
|
+
*/
|
|
339
|
+
interface ReasoningEngine {
|
|
340
|
+
/**
|
|
341
|
+
* Calls the underlying LLM provider.
|
|
342
|
+
* @param prompt The formatted prompt for the provider.
|
|
343
|
+
* @param options Call-specific options, including threadId and callbacks.
|
|
344
|
+
* @returns The raw string response from the LLM.
|
|
345
|
+
*/
|
|
346
|
+
call(prompt: FormattedPrompt, options: CallOptions): Promise<string>;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Interface for managing and constructing prompts for the LLM.
|
|
350
|
+
*/
|
|
351
|
+
interface PromptManager {
|
|
352
|
+
/**
|
|
353
|
+
* Creates the prompt for the planning phase.
|
|
354
|
+
* @param query User query.
|
|
355
|
+
* @param history Conversation history.
|
|
356
|
+
* @param systemPrompt System prompt string.
|
|
357
|
+
* @param availableTools Schemas of available tools.
|
|
358
|
+
* @param threadContext Current thread context.
|
|
359
|
+
* @returns Formatted prompt suitable for the ReasoningEngine.
|
|
360
|
+
*/
|
|
361
|
+
createPlanningPrompt(query: string, history: ConversationMessage[], systemPrompt: string | undefined, availableTools: ToolSchema[], threadContext: ThreadContext): Promise<FormattedPrompt>;
|
|
362
|
+
/**
|
|
363
|
+
* Creates the prompt for the synthesis phase.
|
|
364
|
+
* @param query User query.
|
|
365
|
+
* @param intent Parsed intent from planning.
|
|
366
|
+
* @param plan Parsed plan from planning.
|
|
367
|
+
* @param toolResults Results from tool execution.
|
|
368
|
+
* @param history Conversation history.
|
|
369
|
+
* @param systemPrompt System prompt string.
|
|
370
|
+
* @param threadContext Current thread context.
|
|
371
|
+
* @returns Formatted prompt suitable for the ReasoningEngine.
|
|
372
|
+
*/
|
|
373
|
+
createSynthesisPrompt(query: string, intent: string | undefined, // Or a structured intent object
|
|
374
|
+
plan: string | undefined, // Or a structured plan object
|
|
375
|
+
toolResults: ToolResult[], history: ConversationMessage[], systemPrompt: string | undefined, threadContext: ThreadContext): Promise<FormattedPrompt>;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Interface for parsing structured output from LLM responses.
|
|
379
|
+
*/
|
|
380
|
+
interface OutputParser {
|
|
381
|
+
/**
|
|
382
|
+
* Parses the output of the planning LLM call.
|
|
383
|
+
* @param output Raw LLM output string.
|
|
384
|
+
* @returns Structured planning data (intent, plan, tool calls).
|
|
385
|
+
*/
|
|
386
|
+
parsePlanningOutput(output: string): Promise<{
|
|
387
|
+
intent?: string;
|
|
388
|
+
plan?: string;
|
|
389
|
+
toolCalls?: ParsedToolCall[];
|
|
390
|
+
}>;
|
|
391
|
+
/**
|
|
392
|
+
* Parses the output of the synthesis LLM call.
|
|
393
|
+
* @param output Raw LLM output string.
|
|
394
|
+
* @returns The final synthesized response content.
|
|
395
|
+
*/
|
|
396
|
+
parseSynthesisOutput(output: string): Promise<string>;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Base interface for LLM Provider Adapters, extending the core ReasoningEngine.
|
|
400
|
+
* Implementations will handle provider-specific API calls, authentication, etc.
|
|
401
|
+
*/
|
|
402
|
+
interface ProviderAdapter extends ReasoningEngine {
|
|
403
|
+
readonly providerName: string;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Interface for the executable logic of a tool.
|
|
407
|
+
*/
|
|
408
|
+
interface IToolExecutor {
|
|
409
|
+
/** The schema definition for this tool. */
|
|
410
|
+
readonly schema: ToolSchema;
|
|
411
|
+
/**
|
|
412
|
+
* Executes the tool's logic.
|
|
413
|
+
* @param input Validated input arguments matching the tool's inputSchema.
|
|
414
|
+
* @param context Execution context containing threadId, traceId, etc.
|
|
415
|
+
* @returns A promise resolving to the structured tool result.
|
|
416
|
+
*/
|
|
417
|
+
execute(input: any, context: ExecutionContext): Promise<ToolResult>;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Interface for managing the registration and retrieval of tools.
|
|
421
|
+
*/
|
|
422
|
+
interface ToolRegistry {
|
|
423
|
+
/**
|
|
424
|
+
* Registers a tool executor.
|
|
425
|
+
* @param executor The tool executor instance.
|
|
426
|
+
*/
|
|
427
|
+
registerTool(executor: IToolExecutor): Promise<void>;
|
|
428
|
+
/**
|
|
429
|
+
* Retrieves a tool executor by its name.
|
|
430
|
+
* @param toolName The unique name of the tool.
|
|
431
|
+
* @returns The executor instance or undefined if not found.
|
|
432
|
+
*/
|
|
433
|
+
getToolExecutor(toolName: string): Promise<IToolExecutor | undefined>;
|
|
434
|
+
/**
|
|
435
|
+
* Retrieves the schemas of all registered tools, potentially filtered.
|
|
436
|
+
* @param filter Optional criteria (e.g., only enabled tools for a thread).
|
|
437
|
+
* @returns An array of tool schemas.
|
|
438
|
+
*/
|
|
439
|
+
getAvailableTools(filter?: {
|
|
440
|
+
enabledForThreadId?: string;
|
|
441
|
+
}): Promise<ToolSchema[]>;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Interface for the system responsible for orchestrating tool execution.
|
|
445
|
+
*/
|
|
446
|
+
interface ToolSystem {
|
|
447
|
+
/**
|
|
448
|
+
* Executes a list of parsed tool calls.
|
|
449
|
+
* @param toolCalls Array of tool calls requested by the LLM.
|
|
450
|
+
* @param threadId The current thread ID for context and permissions.
|
|
451
|
+
* @param traceId Optional trace ID.
|
|
452
|
+
* @returns A promise resolving to an array of tool results.
|
|
453
|
+
*/
|
|
454
|
+
executeTools(toolCalls: ParsedToolCall[], threadId: string, traceId?: string): Promise<ToolResult[]>;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Interface for managing thread-specific configuration and state.
|
|
458
|
+
*/
|
|
459
|
+
interface StateManager {
|
|
460
|
+
/**
|
|
461
|
+
* Loads the full context (config + state) for a given thread.
|
|
462
|
+
* @param threadId The ID of the thread.
|
|
463
|
+
* @param userId Optional user ID for access control.
|
|
464
|
+
* @returns The thread context.
|
|
465
|
+
*/
|
|
466
|
+
loadThreadContext(threadId: string, userId?: string): Promise<ThreadContext>;
|
|
467
|
+
/**
|
|
468
|
+
* Checks if a specific tool is enabled for the given thread based on its config.
|
|
469
|
+
* @param threadId The ID of the thread.
|
|
470
|
+
* @param toolName The name of the tool.
|
|
471
|
+
* @returns True if the tool is enabled, false otherwise.
|
|
472
|
+
*/
|
|
473
|
+
isToolEnabled(threadId: string, toolName: string): Promise<boolean>;
|
|
474
|
+
/**
|
|
475
|
+
* Retrieves a specific configuration value for the thread.
|
|
476
|
+
* @param threadId The ID of the thread.
|
|
477
|
+
* @param key The configuration key (potentially nested, e.g., 'reasoning.model').
|
|
478
|
+
* @returns The configuration value or undefined.
|
|
479
|
+
*/
|
|
480
|
+
getThreadConfigValue<T>(threadId: string, key: string): Promise<T | undefined>;
|
|
481
|
+
/**
|
|
482
|
+
* Saves the thread's state if it has been modified during execution.
|
|
483
|
+
* Implementations should track changes to avoid unnecessary writes.
|
|
484
|
+
* @param threadId The ID of the thread.
|
|
485
|
+
*/
|
|
486
|
+
saveStateIfModified(threadId: string): Promise<void>;
|
|
487
|
+
/**
|
|
488
|
+
* Sets or updates the configuration for a specific thread.
|
|
489
|
+
* @param threadId The ID of the thread.
|
|
490
|
+
* @param config The complete configuration object to set.
|
|
491
|
+
*/
|
|
492
|
+
setThreadConfig(threadId: string, config: ThreadConfig): Promise<void>;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Interface for managing conversation history.
|
|
496
|
+
*/
|
|
497
|
+
interface ConversationManager {
|
|
498
|
+
/**
|
|
499
|
+
* Adds one or more messages to a thread's history.
|
|
500
|
+
* @param threadId The ID of the thread.
|
|
501
|
+
* @param messages An array of messages to add.
|
|
502
|
+
*/
|
|
503
|
+
addMessages(threadId: string, messages: ConversationMessage[]): Promise<void>;
|
|
504
|
+
/**
|
|
505
|
+
* Retrieves messages from a thread's history.
|
|
506
|
+
* @param threadId The ID of the thread.
|
|
507
|
+
* @param options Filtering and pagination options.
|
|
508
|
+
* @returns An array of conversation messages.
|
|
509
|
+
*/
|
|
510
|
+
getMessages(threadId: string, options?: MessageOptions): Promise<ConversationMessage[]>;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Interface for managing the recording and retrieval of observations.
|
|
514
|
+
*/
|
|
515
|
+
interface ObservationManager {
|
|
516
|
+
/**
|
|
517
|
+
* Records a new observation. Automatically assigns ID, timestamp, and potentially title.
|
|
518
|
+
* Notifies the ObservationSocket.
|
|
519
|
+
* @param observationData Data for the observation (excluding id, timestamp, title).
|
|
520
|
+
*/
|
|
521
|
+
record(observationData: Omit<Observation, 'id' | 'timestamp' | 'title'>): Promise<void>;
|
|
522
|
+
/**
|
|
523
|
+
* Retrieves observations for a specific thread, with optional filtering.
|
|
524
|
+
* @param threadId The ID of the thread.
|
|
525
|
+
* @param filter Optional filtering criteria.
|
|
526
|
+
* @returns An array of observations.
|
|
527
|
+
*/
|
|
528
|
+
getObservations(threadId: string, filter?: ObservationFilter): Promise<Observation[]>;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Generic interface for a typed publish/subscribe socket.
|
|
532
|
+
*/
|
|
533
|
+
interface TypedSocket<DataType, FilterType = any> {
|
|
534
|
+
/**
|
|
535
|
+
* Subscribes a callback function to receive data updates.
|
|
536
|
+
* @param callback The function to call with new data.
|
|
537
|
+
* @param filter Optional filter criteria specific to the socket type.
|
|
538
|
+
* @param options Optional configuration like target threadId.
|
|
539
|
+
* @returns An unsubscribe function.
|
|
540
|
+
*/
|
|
541
|
+
subscribe(callback: (data: DataType) => void, filter?: FilterType, options?: {
|
|
542
|
+
threadId?: string;
|
|
543
|
+
}): () => void;
|
|
544
|
+
/**
|
|
545
|
+
* Notifies subscribers of new data.
|
|
546
|
+
* @param data The data payload.
|
|
547
|
+
* @param options Optional targeting information (e.g., specific thread).
|
|
548
|
+
*/
|
|
549
|
+
notify(data: DataType, options?: {
|
|
550
|
+
targetThreadId?: string;
|
|
551
|
+
targetSessionId?: string;
|
|
552
|
+
}): void;
|
|
553
|
+
/**
|
|
554
|
+
* Optional method to retrieve historical data from the socket's source.
|
|
555
|
+
* @param filter Optional filter criteria.
|
|
556
|
+
* @param options Optional configuration like threadId and limit.
|
|
557
|
+
*/
|
|
558
|
+
getHistory?(filter?: FilterType, options?: {
|
|
559
|
+
threadId?: string;
|
|
560
|
+
limit?: number;
|
|
561
|
+
}): Promise<DataType[]>;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* TypedSocket specifically for Observation data.
|
|
565
|
+
* FilterType is ObservationType or array of ObservationType.
|
|
566
|
+
*/
|
|
567
|
+
interface ObservationSocket extends TypedSocket<Observation, ObservationType | ObservationType[]> {
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* TypedSocket specifically for ConversationMessage data.
|
|
571
|
+
* FilterType is MessageRole or array of MessageRole.
|
|
572
|
+
*/
|
|
573
|
+
interface ConversationSocket extends TypedSocket<ConversationMessage, MessageRole | MessageRole[]> {
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Interface for the system providing access to UI communication sockets.
|
|
578
|
+
*/
|
|
579
|
+
interface UISystem {
|
|
580
|
+
getObservationSocket(): ObservationSocket$1;
|
|
581
|
+
getConversationSocket(): ConversationSocket$1;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Interface for a storage adapter, providing a generic persistence layer.
|
|
585
|
+
*/
|
|
586
|
+
interface StorageAdapter {
|
|
587
|
+
/** Optional initialization method (e.g., connecting to DB). */
|
|
588
|
+
init?(config?: any): Promise<void>;
|
|
589
|
+
/**
|
|
590
|
+
* Retrieves a single item from a collection by its ID.
|
|
591
|
+
* @param collection The name of the data collection (e.g., 'conversations', 'observations').
|
|
592
|
+
* @param id The unique ID of the item.
|
|
593
|
+
* @returns The item or null if not found.
|
|
594
|
+
*/
|
|
595
|
+
get<T>(collection: string, id: string): Promise<T | null>;
|
|
596
|
+
/**
|
|
597
|
+
* Saves (creates or updates) an item in a collection.
|
|
598
|
+
* @param collection The name of the collection.
|
|
599
|
+
* @param id The unique ID of the item.
|
|
600
|
+
* @param data The data to save.
|
|
601
|
+
*/
|
|
602
|
+
set<T>(collection: string, id: string, data: T): Promise<void>;
|
|
603
|
+
/**
|
|
604
|
+
* Deletes an item from a collection by its ID.
|
|
605
|
+
* @param collection The name of the collection.
|
|
606
|
+
* @param id The unique ID of the item.
|
|
607
|
+
*/
|
|
608
|
+
delete(collection: string, id: string): Promise<void>;
|
|
609
|
+
/**
|
|
610
|
+
* Queries items in a collection based on filter options.
|
|
611
|
+
* @param collection The name of the collection.
|
|
612
|
+
* @param filterOptions Filtering, sorting, and pagination options.
|
|
613
|
+
* @returns An array of matching items.
|
|
614
|
+
*/
|
|
615
|
+
query<T>(collection: string, filterOptions: FilterOptions): Promise<T[]>;
|
|
616
|
+
/** Optional: Clears all items from a specific collection. */
|
|
617
|
+
clearCollection?(collection: string): Promise<void>;
|
|
618
|
+
/** Optional: Clears all data managed by the adapter. Use with caution! */
|
|
619
|
+
clearAll?(): Promise<void>;
|
|
620
|
+
}
|
|
621
|
+
/** Repository for managing ConversationMessages. */
|
|
622
|
+
interface IConversationRepository {
|
|
623
|
+
addMessages(threadId: string, messages: ConversationMessage[]): Promise<void>;
|
|
624
|
+
getMessages(threadId: string, options?: MessageOptions): Promise<ConversationMessage[]>;
|
|
625
|
+
}
|
|
626
|
+
/** Repository for managing Observations. */
|
|
627
|
+
interface IObservationRepository {
|
|
628
|
+
addObservation(observation: Observation): Promise<void>;
|
|
629
|
+
getObservations(threadId: string, filter?: ObservationFilter): Promise<Observation[]>;
|
|
630
|
+
}
|
|
631
|
+
/** Repository for managing ThreadConfig and AgentState. */
|
|
632
|
+
interface IStateRepository {
|
|
633
|
+
getThreadConfig(threadId: string): Promise<ThreadConfig | null>;
|
|
634
|
+
setThreadConfig(threadId: string, config: ThreadConfig): Promise<void>;
|
|
635
|
+
getAgentState(threadId: string): Promise<AgentState | null>;
|
|
636
|
+
setAgentState(threadId: string, state: AgentState): Promise<void>;
|
|
637
|
+
getThreadContext(threadId: string): Promise<ThreadContext | null>;
|
|
638
|
+
setThreadContext(threadId: string, context: ThreadContext): Promise<void>;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Represents the initialized ART instance returned by the factory function.
|
|
642
|
+
*/
|
|
643
|
+
interface ArtInstance {
|
|
644
|
+
process: IAgentCore['process'];
|
|
645
|
+
uiSystem: UISystem;
|
|
646
|
+
stateManager: StateManager;
|
|
647
|
+
conversationManager: ConversationManager;
|
|
648
|
+
toolRegistry: ToolRegistry;
|
|
649
|
+
observationManager: ObservationManager;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
interface StorageConfig {
|
|
653
|
+
type: 'memory' | 'indexedDB';
|
|
654
|
+
dbName?: string;
|
|
655
|
+
}
|
|
656
|
+
interface ReasoningConfig {
|
|
657
|
+
provider: 'openai' | 'gemini' | 'anthropic' | 'openrouter' | 'deepseek';
|
|
658
|
+
apiKey: string;
|
|
659
|
+
model?: string;
|
|
660
|
+
baseURL?: string;
|
|
661
|
+
}
|
|
662
|
+
interface AgentFactoryConfig {
|
|
663
|
+
storage: StorageConfig;
|
|
664
|
+
reasoning: ReasoningConfig;
|
|
665
|
+
tools?: IToolExecutor[];
|
|
666
|
+
agentCore?: new (dependencies: any) => IAgentCore;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Creates and initializes an ART instance with the specified configuration.
|
|
670
|
+
* This is the recommended way to get started with the ART framework.
|
|
671
|
+
* @param config The configuration for the ART instance.
|
|
672
|
+
* @returns A promise resolving to the initialized ArtInstance.
|
|
673
|
+
*/
|
|
674
|
+
declare function createArtInstance(config: AgentFactoryConfig): Promise<ArtInstance>;
|
|
675
|
+
|
|
676
|
+
interface PESAgentDependencies {
|
|
677
|
+
stateManager: StateManager;
|
|
678
|
+
conversationManager: ConversationManager;
|
|
679
|
+
toolRegistry: ToolRegistry;
|
|
680
|
+
promptManager: PromptManager;
|
|
681
|
+
reasoningEngine: ReasoningEngine;
|
|
682
|
+
outputParser: OutputParser;
|
|
683
|
+
observationManager: ObservationManager;
|
|
684
|
+
toolSystem: ToolSystem;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Implements the Plan-Execute-Synthesize (PES) agent orchestration logic.
|
|
688
|
+
*/
|
|
689
|
+
declare class PESAgent implements IAgentCore {
|
|
690
|
+
private readonly deps;
|
|
691
|
+
constructor(dependencies: PESAgentDependencies);
|
|
692
|
+
process(props: AgentProps): Promise<AgentFinalResponse>;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* An in-memory implementation of the StorageAdapter interface.
|
|
697
|
+
* Useful for testing, development, or simple scenarios where persistence
|
|
698
|
+
* across sessions is not required.
|
|
699
|
+
*/
|
|
700
|
+
declare class InMemoryStorageAdapter implements StorageAdapter {
|
|
701
|
+
private storage;
|
|
702
|
+
/**
|
|
703
|
+
* Initializes the adapter (no-op for in-memory).
|
|
704
|
+
* @param _config Optional configuration (ignored).
|
|
705
|
+
*/
|
|
706
|
+
init(_config?: any): Promise<void>;
|
|
707
|
+
/**
|
|
708
|
+
* Retrieves a single item from a collection by its ID.
|
|
709
|
+
* @param collection The name of the data collection.
|
|
710
|
+
* @param id The unique ID of the item.
|
|
711
|
+
* @returns The item or null if not found.
|
|
712
|
+
*/
|
|
713
|
+
get<T>(collection: string, id: string): Promise<T | null>;
|
|
714
|
+
/**
|
|
715
|
+
* Saves (creates or updates) an item in a collection.
|
|
716
|
+
* @param collection The name of the collection.
|
|
717
|
+
* @param id The unique ID of the item.
|
|
718
|
+
* @param data The data to save (will be deep copied).
|
|
719
|
+
*/
|
|
720
|
+
set<T>(collection: string, id: string, data: T): Promise<void>;
|
|
721
|
+
/**
|
|
722
|
+
* Deletes an item from a collection by its ID.
|
|
723
|
+
* @param collection The name of the collection.
|
|
724
|
+
* @param id The unique ID of the item.
|
|
725
|
+
*/
|
|
726
|
+
delete(collection: string, id: string): Promise<void>;
|
|
727
|
+
/**
|
|
728
|
+
* Queries items in a collection based on simple filter options.
|
|
729
|
+
* Note: This is a basic implementation. It only supports exact matches
|
|
730
|
+
* on top-level properties defined in the filter object. It does not
|
|
731
|
+
* support complex queries, sorting, or deep filtering.
|
|
732
|
+
* @param collection The name of the collection.
|
|
733
|
+
* @param filterOptions Filtering options. Only `filter` is partially supported.
|
|
734
|
+
* @returns An array of matching items (deep copies).
|
|
735
|
+
*/
|
|
736
|
+
query<T>(collection: string, filterOptions: FilterOptions): Promise<T[]>;
|
|
737
|
+
/**
|
|
738
|
+
* Clears all items from a specific collection.
|
|
739
|
+
* @param collection The name of the collection to clear.
|
|
740
|
+
*/
|
|
741
|
+
clearCollection(collection: string): Promise<void>;
|
|
742
|
+
/**
|
|
743
|
+
* Clears all data managed by the adapter.
|
|
744
|
+
*/
|
|
745
|
+
clearAll(): Promise<void>;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Configuration options for the IndexedDBStorageAdapter.
|
|
750
|
+
*/
|
|
751
|
+
interface IndexedDBConfig {
|
|
752
|
+
dbName?: string;
|
|
753
|
+
dbVersion?: number;
|
|
754
|
+
objectStores: string[];
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* An implementation of the StorageAdapter interface using IndexedDB
|
|
758
|
+
* for persistent storage in the browser.
|
|
759
|
+
*/
|
|
760
|
+
declare class IndexedDBStorageAdapter implements StorageAdapter {
|
|
761
|
+
private db;
|
|
762
|
+
private dbName;
|
|
763
|
+
private dbVersion;
|
|
764
|
+
private requiredObjectStores;
|
|
765
|
+
private initPromise;
|
|
766
|
+
constructor(config: IndexedDBConfig);
|
|
767
|
+
/**
|
|
768
|
+
* Initializes the IndexedDB database connection and ensures object stores exist.
|
|
769
|
+
* This method should be called before any other operations.
|
|
770
|
+
*/
|
|
771
|
+
init(): Promise<void>;
|
|
772
|
+
private getTransaction;
|
|
773
|
+
get<T>(collection: string, id: string): Promise<T | null>;
|
|
774
|
+
set<T>(collection: string, id: string, data: T): Promise<void>;
|
|
775
|
+
delete(collection: string, id: string): Promise<void>;
|
|
776
|
+
query<T>(collection: string, filterOptions: FilterOptions): Promise<T[]>;
|
|
777
|
+
clearCollection(collection: string): Promise<void>;
|
|
778
|
+
clearAll(): Promise<void>;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
interface GeminiAdapterOptions {
|
|
782
|
+
apiKey: string;
|
|
783
|
+
model?: string;
|
|
784
|
+
apiBaseUrl?: string;
|
|
785
|
+
apiVersion?: string;
|
|
786
|
+
}
|
|
787
|
+
declare class GeminiAdapter implements ProviderAdapter {
|
|
788
|
+
readonly providerName = "gemini";
|
|
789
|
+
private apiKey;
|
|
790
|
+
private model;
|
|
791
|
+
private apiBaseUrl;
|
|
792
|
+
private apiVersion;
|
|
793
|
+
constructor(options: GeminiAdapterOptions);
|
|
794
|
+
/**
|
|
795
|
+
* Calls the Google Generative AI API (Gemini).
|
|
796
|
+
* Note: Assumes prompt is a string for basic user input.
|
|
797
|
+
* Does not yet handle complex history or system prompts.
|
|
798
|
+
* `onThought` is not implemented (requires streaming API).
|
|
799
|
+
* @param prompt - Treated as the user message content.
|
|
800
|
+
* @param options - Call options including LLM parameters.
|
|
801
|
+
* @returns The content string from the API response.
|
|
802
|
+
*/
|
|
803
|
+
call(prompt: FormattedPrompt, options: CallOptions): Promise<string>;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
interface OpenAIAdapterOptions {
|
|
807
|
+
apiKey: string;
|
|
808
|
+
model?: string;
|
|
809
|
+
apiBaseUrl?: string;
|
|
810
|
+
}
|
|
811
|
+
declare class OpenAIAdapter implements ProviderAdapter {
|
|
812
|
+
readonly providerName = "openai";
|
|
813
|
+
private apiKey;
|
|
814
|
+
private model;
|
|
815
|
+
private apiBaseUrl;
|
|
816
|
+
constructor(options: OpenAIAdapterOptions);
|
|
817
|
+
/**
|
|
818
|
+
* Calls the OpenAI Chat Completions API.
|
|
819
|
+
* Note: This basic implementation assumes the FormattedPrompt is a string
|
|
820
|
+
* representing the user's message or a pre-formatted structure.
|
|
821
|
+
* It doesn't yet handle complex history formatting or system prompts
|
|
822
|
+
* directly from the FormattedPrompt type itself.
|
|
823
|
+
* The `onThought` callback is not implemented in this non-streaming version.
|
|
824
|
+
* @param prompt - For this basic version, treated as the primary user message content.
|
|
825
|
+
* A more robust version would parse a structured prompt object.
|
|
826
|
+
* @param options - Call options, including threadId, traceId, and LLM parameters.
|
|
827
|
+
* @returns The content string from the API response.
|
|
828
|
+
*/
|
|
829
|
+
call(prompt: FormattedPrompt, options: CallOptions): Promise<string>;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
interface AnthropicAdapterOptions {
|
|
833
|
+
apiKey: string;
|
|
834
|
+
model?: string;
|
|
835
|
+
apiVersion?: string;
|
|
836
|
+
apiBaseUrl?: string;
|
|
837
|
+
}
|
|
838
|
+
declare class AnthropicAdapter implements ProviderAdapter {
|
|
839
|
+
readonly providerName = "anthropic";
|
|
840
|
+
private apiKey;
|
|
841
|
+
private model;
|
|
842
|
+
private apiVersion;
|
|
843
|
+
private apiBaseUrl;
|
|
844
|
+
private defaultMaxTokens;
|
|
845
|
+
constructor(options: AnthropicAdapterOptions);
|
|
846
|
+
/**
|
|
847
|
+
* Calls the Anthropic Messages API.
|
|
848
|
+
* Note: Assumes prompt is a string for basic user input.
|
|
849
|
+
* Does not yet handle complex history or system prompts robustly.
|
|
850
|
+
* `onThought` is not implemented (requires streaming API).
|
|
851
|
+
* @param prompt - Treated as the user message content.
|
|
852
|
+
* @param options - Call options including LLM parameters. Requires max_tokens/maxOutputTokens.
|
|
853
|
+
* @returns The content string from the API response.
|
|
854
|
+
*/
|
|
855
|
+
call(prompt: FormattedPrompt, options: CallOptions): Promise<string>;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
interface OpenRouterAdapterOptions {
|
|
859
|
+
apiKey: string;
|
|
860
|
+
model: string;
|
|
861
|
+
apiBaseUrl?: string;
|
|
862
|
+
siteUrl?: string;
|
|
863
|
+
appName?: string;
|
|
864
|
+
}
|
|
865
|
+
declare class OpenRouterAdapter implements ProviderAdapter {
|
|
866
|
+
readonly providerName = "openrouter";
|
|
867
|
+
private apiKey;
|
|
868
|
+
private model;
|
|
869
|
+
private apiBaseUrl;
|
|
870
|
+
private siteUrl?;
|
|
871
|
+
private appName?;
|
|
872
|
+
constructor(options: OpenRouterAdapterOptions);
|
|
873
|
+
/**
|
|
874
|
+
* Calls the OpenRouter Chat Completions API (OpenAI compatible).
|
|
875
|
+
* Note: Assumes prompt is a string for basic user input.
|
|
876
|
+
* Does not yet handle complex history or system prompts robustly.
|
|
877
|
+
* `onThought` is not implemented (requires streaming API).
|
|
878
|
+
* @param prompt - Treated as the user message content.
|
|
879
|
+
* @param options - Call options including LLM parameters.
|
|
880
|
+
* @returns The content string from the API response.
|
|
881
|
+
*/
|
|
882
|
+
call(prompt: FormattedPrompt, options: CallOptions): Promise<string>;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
interface DeepSeekAdapterOptions {
|
|
886
|
+
apiKey: string;
|
|
887
|
+
model?: string;
|
|
888
|
+
apiBaseUrl?: string;
|
|
889
|
+
}
|
|
890
|
+
declare class DeepSeekAdapter implements ProviderAdapter {
|
|
891
|
+
readonly providerName = "deepseek";
|
|
892
|
+
private apiKey;
|
|
893
|
+
private model;
|
|
894
|
+
private apiBaseUrl;
|
|
895
|
+
constructor(options: DeepSeekAdapterOptions);
|
|
896
|
+
/**
|
|
897
|
+
* Calls the DeepSeek Chat Completions API (OpenAI compatible).
|
|
898
|
+
* Note: Assumes prompt is a string for basic user input.
|
|
899
|
+
* Does not yet handle complex history or system prompts robustly.
|
|
900
|
+
* `onThought` is not implemented (requires streaming API).
|
|
901
|
+
* @param prompt - Treated as the user message content.
|
|
902
|
+
* @param options - Call options including LLM parameters.
|
|
903
|
+
* @returns The content string from the API response.
|
|
904
|
+
*/
|
|
905
|
+
call(prompt: FormattedPrompt, options: CallOptions): Promise<string>;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
declare class CalculatorTool implements IToolExecutor {
|
|
909
|
+
static readonly toolName = "calculator";
|
|
910
|
+
readonly schema: ToolSchema;
|
|
911
|
+
execute(input: any, context: ExecutionContext): Promise<ToolResult>;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
declare enum LogLevel {
|
|
915
|
+
DEBUG = 0,
|
|
916
|
+
INFO = 1,
|
|
917
|
+
WARN = 2,
|
|
918
|
+
ERROR = 3
|
|
919
|
+
}
|
|
920
|
+
interface LoggerConfig {
|
|
921
|
+
level: LogLevel;
|
|
922
|
+
prefix?: string;
|
|
923
|
+
}
|
|
924
|
+
declare class Logger {
|
|
925
|
+
private static config;
|
|
926
|
+
static configure(config: Partial<LoggerConfig>): void;
|
|
927
|
+
static debug(message: string, ...args: any[]): void;
|
|
928
|
+
static info(message: string, ...args: any[]): void;
|
|
929
|
+
static warn(message: string, ...args: any[]): void;
|
|
930
|
+
static error(message: string, ...args: any[]): void;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
declare const generateUUID: () => string;
|
|
934
|
+
|
|
935
|
+
declare const VERSION = "0.2.4";
|
|
936
|
+
|
|
937
|
+
export { type AgentFinalResponse, type AgentOptions, type AgentProps, type AgentState, AnthropicAdapter, type ArtInstance, CalculatorTool, type CallOptions, type ConversationManager, type ConversationMessage, type ConversationSocket, DeepSeekAdapter, type ExecutionContext, type ExecutionMetadata, type FilterOptions, type FormattedPrompt, GeminiAdapter, type IAgentCore, type IConversationRepository, type IObservationRepository, type IStateRepository, type IToolExecutor, InMemoryStorageAdapter, IndexedDBStorageAdapter, type JsonObjectSchema, type JsonSchema, LogLevel, Logger, type MessageOptions, MessageRole, type Observation, type ObservationFilter, type ObservationManager, type ObservationSocket, ObservationType, OpenAIAdapter, OpenRouterAdapter, type OutputParser, PESAgent, type ParsedToolCall, type PromptManager, type ProviderAdapter, type ReasoningEngine, type StateManager, type StorageAdapter, type ThreadConfig, type ThreadContext, type ToolRegistry, type ToolResult, type ToolSchema, type ToolSystem, type TypedSocket, type UISystem, VERSION, createArtInstance, generateUUID };
|