@crewai-ts/core 0.1.1 → 0.1.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.
Files changed (90) hide show
  1. package/dist/a2a.d.ts +1684 -0
  2. package/dist/a2ui-schemas.d.ts +3312 -0
  3. package/dist/a2ui.d.ts +379 -0
  4. package/dist/agent-adapters.d.ts +178 -0
  5. package/dist/agent-executors.d.ts +508 -0
  6. package/dist/agent-parser.d.ts +44 -0
  7. package/dist/agent-planning.d.ts +358 -0
  8. package/dist/agent-utils.d.ts +210 -0
  9. package/dist/agent.d.ts +444 -0
  10. package/dist/auth.d.ts +179 -0
  11. package/dist/config-utils.d.ts +5 -0
  12. package/dist/content-processor.d.ts +12 -0
  13. package/dist/context.d.ts +157 -0
  14. package/dist/converter.d.ts +97 -0
  15. package/dist/crew-chat.d.ts +97 -0
  16. package/dist/crew.d.ts +424 -0
  17. package/dist/decorators.d.ts +20 -0
  18. package/dist/env.d.ts +13 -0
  19. package/dist/errors.d.ts +27 -0
  20. package/dist/evaluators.d.ts +477 -0
  21. package/dist/events.d.ts +2657 -0
  22. package/dist/execution-utils.d.ts +85 -0
  23. package/dist/experimental-conversational.d.ts +181 -0
  24. package/dist/file-handler.d.ts +36 -0
  25. package/dist/file-store.d.ts +37 -0
  26. package/dist/files.d.ts +554 -0
  27. package/dist/flow-conversation.d.ts +90 -0
  28. package/dist/flow-definition.d.ts +195 -0
  29. package/dist/flow-persistence.d.ts +107 -0
  30. package/dist/flow-visualization.d.ts +77 -0
  31. package/dist/flow.d.ts +927 -0
  32. package/dist/formatter.d.ts +7 -0
  33. package/dist/guardrail.d.ts +95 -0
  34. package/dist/hooks.d.ts +241 -0
  35. package/dist/human-input.d.ts +74 -0
  36. package/dist/i18n.d.ts +26 -0
  37. package/dist/index.d.ts +99 -13004
  38. package/dist/input-files.d.ts +24 -0
  39. package/dist/input-provider.d.ts +22 -0
  40. package/dist/knowledge.d.ts +353 -0
  41. package/dist/lite-agent-output.d.ts +69 -0
  42. package/dist/lite-agent.d.ts +154 -0
  43. package/dist/llm.d.ts +630 -0
  44. package/dist/llms-hooks-transport.d.ts +1 -2
  45. package/dist/lock-store.d.ts +14 -0
  46. package/dist/logger.d.ts +55 -0
  47. package/dist/mcp.d.ts +315 -0
  48. package/dist/memory.d.ts +915 -0
  49. package/dist/metadata.d.ts +9 -0
  50. package/dist/misc-compat.d.ts +125 -0
  51. package/dist/openai-completion.d.ts +324 -0
  52. package/dist/outputs.d.ts +69 -0
  53. package/dist/planning.d.ts +60 -0
  54. package/dist/plus-api.d.ts +194 -0
  55. package/dist/project-compat.d.ts +133 -0
  56. package/dist/project.d.ts +221 -0
  57. package/dist/prompts.d.ts +66 -0
  58. package/dist/provider-completions.d.ts +593 -0
  59. package/dist/rag.d.ts +1074 -0
  60. package/dist/rpm.d.ts +27 -0
  61. package/dist/rw-lock.d.ts +21 -0
  62. package/dist/schema-utils.d.ts +121 -0
  63. package/dist/security.d.ts +66 -0
  64. package/dist/settings.d.ts +103 -0
  65. package/dist/skills.d.ts +145 -0
  66. package/dist/state-provider-core.d.ts +1 -1
  67. package/dist/state.d.ts +204 -0
  68. package/dist/step-execution-context.d.ts +36 -0
  69. package/dist/streaming.d.ts +153 -0
  70. package/dist/string-utils.d.ts +12 -0
  71. package/dist/task-output-storage.d.ts +62 -0
  72. package/dist/task.d.ts +305 -0
  73. package/dist/telemetry.d.ts +91 -0
  74. package/dist/token-counter-callback.d.ts +36 -0
  75. package/dist/tools.d.ts +563 -0
  76. package/dist/tracing-utils.d.ts +56 -0
  77. package/dist/training-converter.d.ts +36 -0
  78. package/dist/training-handler.d.ts +10 -0
  79. package/dist/types.d.ts +72 -0
  80. package/dist/utilities.d.ts +130 -0
  81. package/dist/utility-types.d.ts +10 -0
  82. package/dist/version.d.ts +12 -0
  83. package/package.json +326 -4904
  84. package/dist/index.d.cts +0 -13068
  85. package/dist/llms-hooks-transport-ChGiFBiU.d.ts +0 -233
  86. package/dist/llms-hooks-transport-DZlurMUQ.d.cts +0 -233
  87. package/dist/llms-hooks-transport.d.cts +0 -2
  88. package/dist/state-provider-core-Be9RKRAm.d.cts +0 -4876
  89. package/dist/state-provider-core-Be9RKRAm.d.ts +0 -4876
  90. package/dist/state-provider-core.d.cts +0 -1
@@ -0,0 +1,24 @@
1
+ import type { Tool } from "./types.js";
2
+ export type InputFileLike = {
3
+ read(): Uint8Array | Buffer | string;
4
+ content_type?: string | null;
5
+ contentType?: string | null;
6
+ filename?: string | null;
7
+ };
8
+ export type StructuredInputFile = {
9
+ path?: string;
10
+ content?: string;
11
+ filename?: string;
12
+ contentType?: string;
13
+ };
14
+ export type InputFile = string | InputFileLike | StructuredInputFile;
15
+ export type InputFiles = Record<string, InputFile>;
16
+ export type ExtractedInputFiles = {
17
+ inputs: Record<string, unknown>;
18
+ inputFiles: InputFiles;
19
+ };
20
+ export declare function renderInputFiles(inputFiles: InputFiles): string | null;
21
+ export declare function createReadFileTool(inputFiles: InputFiles): Tool;
22
+ export declare function withReadFileTool(tools: readonly Tool[], inputFiles: InputFiles | undefined): readonly Tool[];
23
+ export declare function extractInputFilesFromInputs(inputs: Record<string, unknown>): ExtractedInputFiles;
24
+ export declare function isStructuredInputFile(value: unknown): value is Exclude<InputFile, string>;
@@ -0,0 +1,22 @@
1
+ import type { Flow, HumanFeedbackProvider } from "./flow.js";
2
+ import type { MaybePromise } from "./types.js";
3
+ export type InputResponse = {
4
+ text: string | null;
5
+ metadata?: Record<string, unknown> | null;
6
+ };
7
+ export type InputProvider = {
8
+ requestInput?(message: string, flow: Flow<object>, metadata?: Record<string, unknown> | null): MaybePromise<string | InputResponse | null>;
9
+ request_input?(message: string, flow: Flow<object>, metadata?: Record<string, unknown> | null): MaybePromise<string | InputResponse | null>;
10
+ };
11
+ export type FlowConfig = {
12
+ inputProvider: InputProvider | null;
13
+ hitlProvider: HumanFeedbackProvider | null;
14
+ };
15
+ export declare const FlowConfig: Readonly<{
16
+ kind: "FlowConfig";
17
+ }>;
18
+ export declare const flowConfig: FlowConfig;
19
+ export declare class ConsoleInputProvider implements InputProvider {
20
+ requestInput(message: string): Promise<string>;
21
+ }
22
+ export declare function isInputResponse(value: unknown): value is InputResponse;
@@ -0,0 +1,353 @@
1
+ import { type EmbedderConfig, type RagClient, type SearchResult } from "./rag.js";
2
+ export type KnowledgeSearchResult = {
3
+ content: string;
4
+ score: number;
5
+ source: string | null;
6
+ metadata: Record<string, unknown>;
7
+ };
8
+ export type KnowledgeQueryOptions = {
9
+ resultsLimit?: number;
10
+ results_limit?: number;
11
+ scoreThreshold?: number | null;
12
+ score_threshold?: number | null;
13
+ };
14
+ export declare const DEFAULT_KNOWLEDGE_SCORE_THRESHOLD = 0.6;
15
+ export type KnowledgeSource = {
16
+ readonly sourceType?: string;
17
+ readonly metadata?: Record<string, unknown>;
18
+ storage?: BaseKnowledgeStorage | null;
19
+ chunks(): readonly string[];
20
+ add?(): void;
21
+ aadd?(): Promise<void>;
22
+ get_embeddings?(): readonly unknown[];
23
+ validate_content?(): unknown;
24
+ };
25
+ export type StringKnowledgeSourceOptions = {
26
+ content: string;
27
+ chunkSize?: number;
28
+ chunkOverlap?: number;
29
+ metadata?: Record<string, unknown>;
30
+ storage?: BaseKnowledgeStorage | null;
31
+ collectionName?: string | null;
32
+ collection_name?: string | null;
33
+ };
34
+ export type FileKnowledgeSourceOptions = {
35
+ filePaths?: string | readonly string[];
36
+ file_path?: string | readonly string[];
37
+ file_paths?: string | readonly string[];
38
+ chunkSize?: number;
39
+ chunkOverlap?: number;
40
+ metadata?: Record<string, unknown>;
41
+ storage?: BaseKnowledgeStorage | null;
42
+ collectionName?: string | null;
43
+ collection_name?: string | null;
44
+ };
45
+ export type BaseKnowledgeSourceOptions = {
46
+ chunkSize?: number;
47
+ chunk_size?: number;
48
+ chunkOverlap?: number;
49
+ chunk_overlap?: number;
50
+ chunks?: readonly string[];
51
+ chunkEmbeddings?: readonly unknown[];
52
+ chunk_embeddings?: readonly unknown[];
53
+ metadata?: Record<string, unknown>;
54
+ storage?: BaseKnowledgeStorage | null;
55
+ collectionName?: string | null;
56
+ collection_name?: string | null;
57
+ };
58
+ export type PDFTextExtractor = (filePath: string, bytes: Buffer) => string;
59
+ export type PDFKnowledgeSourceOptions = FileKnowledgeSourceOptions & {
60
+ extractor?: PDFTextExtractor;
61
+ };
62
+ export type ExcelSheetData = readonly (readonly unknown[])[];
63
+ export type ExcelWorkbookData = Record<string, ExcelSheetData>;
64
+ export type ExcelTextExtractor = (filePath: string, bytes: Buffer) => ExcelWorkbookData | string;
65
+ export type ExcelKnowledgeSourceOptions = FileKnowledgeSourceOptions & {
66
+ extractor?: ExcelTextExtractor;
67
+ };
68
+ export type DoclingConversionResult = unknown;
69
+ export type DoclingDocumentConverter = {
70
+ convert_all?: (paths: readonly string[]) => Iterable<DoclingConversionResult>;
71
+ convertAll?: (paths: readonly string[]) => Iterable<DoclingConversionResult>;
72
+ } | ((paths: readonly string[]) => Iterable<DoclingConversionResult>);
73
+ export type DoclingChunk = {
74
+ text?: string | number | boolean | bigint | null | undefined;
75
+ } | string;
76
+ export type DoclingChunker = {
77
+ chunk?: (document: unknown) => Iterable<DoclingChunk>;
78
+ } | ((document: unknown) => Iterable<DoclingChunk>);
79
+ export type CrewDoclingSourceOptions = FileKnowledgeSourceOptions & {
80
+ documentConverter?: DoclingDocumentConverter | null;
81
+ document_converter?: DoclingDocumentConverter | null;
82
+ chunker?: DoclingChunker | null;
83
+ };
84
+ export declare class BaseKnowledgeSource {
85
+ readonly chunkSize: number;
86
+ readonly chunk_size: number;
87
+ readonly chunkOverlap: number;
88
+ readonly chunk_overlap: number;
89
+ readonly metadata: Record<string, unknown>;
90
+ readonly collectionName: string | null;
91
+ readonly collection_name: string | null;
92
+ storage: BaseKnowledgeStorage | null;
93
+ chunks: string[];
94
+ private chunkEmbeddingsValue;
95
+ constructor(options?: BaseKnowledgeSourceOptions);
96
+ get chunkEmbeddings(): unknown[];
97
+ set chunkEmbeddings(value: readonly unknown[]);
98
+ get chunk_embeddings(): unknown[];
99
+ set chunk_embeddings(value: readonly unknown[]);
100
+ validateContent(): unknown;
101
+ validate_content(): unknown;
102
+ add(): void;
103
+ aadd(): Promise<void>;
104
+ getEmbeddings(): readonly unknown[];
105
+ get_embeddings(): readonly unknown[];
106
+ chunkText(text: string): string[];
107
+ _chunk_text(text: string): string[];
108
+ saveDocuments(): void;
109
+ _save_documents(): void;
110
+ asaveDocuments(): Promise<void>;
111
+ _asave_documents(): Promise<void>;
112
+ }
113
+ export type KnowledgeOptions = {
114
+ sources?: readonly KnowledgeSource[];
115
+ collectionName?: string | null;
116
+ collection_name?: string | null;
117
+ storage?: BaseKnowledgeStorage | null;
118
+ embedder?: EmbedderConfig | null;
119
+ };
120
+ export type KnowledgeStorageOptions = {
121
+ collectionName?: string | null;
122
+ collection_name?: string | null;
123
+ client?: RagClient | null;
124
+ embedder?: EmbedderConfig | null;
125
+ };
126
+ export declare class StringKnowledgeSource implements KnowledgeSource {
127
+ readonly sourceType = "string";
128
+ readonly source_type = "string";
129
+ readonly content: string;
130
+ readonly chunkSize: number;
131
+ readonly chunkOverlap: number;
132
+ readonly metadata: Record<string, unknown>;
133
+ readonly collectionName: string | null;
134
+ readonly collection_name: string | null;
135
+ storage: BaseKnowledgeStorage | null;
136
+ constructor(options: StringKnowledgeSourceOptions | string);
137
+ model_post_init(_context?: unknown): void;
138
+ validateContent(): void;
139
+ validate_content(): void;
140
+ chunks(): readonly string[];
141
+ _chunk_text(text: string): string[];
142
+ add(): void;
143
+ aadd(): Promise<void>;
144
+ getEmbeddings(): readonly unknown[];
145
+ get_embeddings(): readonly unknown[];
146
+ saveDocuments(documents?: readonly string[]): void;
147
+ _save_documents(): void;
148
+ asaveDocuments(documents?: readonly string[]): Promise<void>;
149
+ _asave_documents(): Promise<void>;
150
+ }
151
+ declare abstract class BaseTextKnowledgeSource implements KnowledgeSource {
152
+ abstract readonly sourceType: string;
153
+ readonly chunkSize: number;
154
+ readonly chunkOverlap: number;
155
+ readonly metadata: Record<string, unknown>;
156
+ readonly collectionName: string | null;
157
+ readonly collection_name: string | null;
158
+ storage: BaseKnowledgeStorage | null;
159
+ protected constructor(options: Pick<FileKnowledgeSourceOptions, "chunkSize" | "chunkOverlap" | "metadata" | "storage" | "collectionName" | "collection_name">);
160
+ chunks(): readonly string[];
161
+ _chunk_text(text: string): string[];
162
+ validateContent(): void;
163
+ validate_content(): void;
164
+ add(): void;
165
+ aadd(): Promise<void>;
166
+ getEmbeddings(): readonly unknown[];
167
+ get_embeddings(): readonly unknown[];
168
+ protected abstract loadText(): string;
169
+ saveDocuments(documents?: readonly string[]): void;
170
+ _save_documents(): void;
171
+ asaveDocuments(documents?: readonly string[]): Promise<void>;
172
+ _asave_documents(): Promise<void>;
173
+ }
174
+ export declare abstract class BaseFileKnowledgeSource extends BaseTextKnowledgeSource {
175
+ readonly filePath: string | readonly string[] | null;
176
+ readonly file_path: string | readonly string[] | null;
177
+ readonly filePaths: readonly string[];
178
+ readonly file_paths: readonly string[];
179
+ safeFilePaths: string[];
180
+ safe_file_paths: string[];
181
+ content: Record<string, string>;
182
+ protected constructor(options: FileKnowledgeSourceOptions | string | readonly string[]);
183
+ model_post_init(_context?: unknown): void;
184
+ validateFilePath(value: string | readonly string[] | null, info?: {
185
+ field_name?: string;
186
+ data?: Record<string, unknown>;
187
+ }): string | readonly string[] | null;
188
+ validate_file_path(value: string | readonly string[] | null, info?: {
189
+ field_name?: string;
190
+ data?: Record<string, unknown>;
191
+ }): string | readonly string[] | null;
192
+ validateContent(): void;
193
+ validate_content(): void;
194
+ abstract loadContent(): Record<string, string>;
195
+ load_content(): Record<string, string>;
196
+ _load_content(): unknown;
197
+ convertToPath(filePath: string): string;
198
+ convert_to_path(filePath: string): string;
199
+ protected loadText(): string;
200
+ protected processFilePaths(): string[];
201
+ _process_file_paths(): string[];
202
+ }
203
+ export declare class TextFileKnowledgeSource extends BaseFileKnowledgeSource {
204
+ readonly sourceType = "text_file";
205
+ readonly source_type = "text_file";
206
+ constructor(options: FileKnowledgeSourceOptions | string | readonly string[]);
207
+ loadContent(): Record<string, string>;
208
+ }
209
+ export declare class JSONKnowledgeSource extends BaseFileKnowledgeSource {
210
+ readonly sourceType = "json";
211
+ readonly source_type = "json";
212
+ constructor(options: FileKnowledgeSourceOptions | string | readonly string[]);
213
+ loadContent(): Record<string, string>;
214
+ _json_to_text(data: unknown, level?: number): string;
215
+ }
216
+ export declare class CSVKnowledgeSource extends BaseFileKnowledgeSource {
217
+ readonly sourceType = "csv";
218
+ readonly source_type = "csv";
219
+ constructor(options: FileKnowledgeSourceOptions | string | readonly string[]);
220
+ loadContent(): Record<string, string>;
221
+ }
222
+ export declare class PDFKnowledgeSource extends BaseFileKnowledgeSource {
223
+ readonly sourceType = "pdf";
224
+ readonly source_type = "pdf";
225
+ private readonly extractor;
226
+ constructor(options: PDFKnowledgeSourceOptions | string | readonly string[]);
227
+ loadContent(): Record<string, string>;
228
+ _import_pdfplumber(): never;
229
+ _chunk_text(text: string): string[];
230
+ add(): void;
231
+ aadd(): Promise<void>;
232
+ private loadContentAsync;
233
+ }
234
+ export declare class ExcelKnowledgeSource extends BaseFileKnowledgeSource {
235
+ readonly sourceType = "excel";
236
+ readonly source_type = "excel";
237
+ private readonly extractor;
238
+ constructor(options: ExcelKnowledgeSourceOptions | string | readonly string[]);
239
+ loadContent(): Record<string, string>;
240
+ _import_dependencies(): {
241
+ readWorkbook: typeof parseXlsxWorkbook;
242
+ };
243
+ }
244
+ export declare class CrewDoclingSource extends BaseFileKnowledgeSource {
245
+ readonly sourceType = "docling";
246
+ readonly source_type = "docling";
247
+ private readonly documentConverter;
248
+ private readonly chunker;
249
+ private doclingDocuments;
250
+ constructor(options: CrewDoclingSourceOptions | string | readonly string[]);
251
+ model_post_init(_context?: unknown): void;
252
+ validateContent(): string[];
253
+ validate_content(): string[];
254
+ loadContent(): Record<string, string>;
255
+ load_content(): Record<string, string>;
256
+ _load_content(): unknown[];
257
+ add(): void;
258
+ aadd(): Promise<void>;
259
+ _convert_source_to_docling_documents(): unknown[];
260
+ _chunk_doc(document: unknown): Iterable<string>;
261
+ _save_documents(): void;
262
+ _asave_documents(): Promise<void>;
263
+ _validate_url(url: string): boolean;
264
+ private convertSourceToDoclingDocuments;
265
+ private chunkDoc;
266
+ private saveDoclingDocuments;
267
+ private asaveDoclingDocuments;
268
+ }
269
+ export declare class SourceHelper {
270
+ static readonly SUPPORTED_FILE_TYPES: readonly [".csv", ".pdf", ".json", ".txt", ".xlsx", ".xls"];
271
+ static readonly _FILE_TYPE_MAP: {
272
+ readonly ".csv": typeof CSVKnowledgeSource;
273
+ readonly ".pdf": typeof PDFKnowledgeSource;
274
+ readonly ".json": typeof JSONKnowledgeSource;
275
+ readonly ".txt": typeof TextFileKnowledgeSource;
276
+ readonly ".xlsx": typeof ExcelKnowledgeSource;
277
+ readonly ".xls": typeof ExcelKnowledgeSource;
278
+ };
279
+ readonly supportedFileTypes: readonly [".csv", ".pdf", ".json", ".txt", ".xlsx", ".xls"];
280
+ readonly _fileTypeMap: {
281
+ readonly ".csv": typeof CSVKnowledgeSource;
282
+ readonly ".pdf": typeof PDFKnowledgeSource;
283
+ readonly ".json": typeof JSONKnowledgeSource;
284
+ readonly ".txt": typeof TextFileKnowledgeSource;
285
+ readonly ".xlsx": typeof ExcelKnowledgeSource;
286
+ readonly ".xls": typeof ExcelKnowledgeSource;
287
+ };
288
+ readonly _file_type_map: {
289
+ readonly ".csv": typeof CSVKnowledgeSource;
290
+ readonly ".pdf": typeof PDFKnowledgeSource;
291
+ readonly ".json": typeof JSONKnowledgeSource;
292
+ readonly ".txt": typeof TextFileKnowledgeSource;
293
+ readonly ".xlsx": typeof ExcelKnowledgeSource;
294
+ readonly ".xls": typeof ExcelKnowledgeSource;
295
+ };
296
+ isSupportedFile(filePath: string): boolean;
297
+ getSource(filePath: string, metadata?: Record<string, unknown> | null): KnowledgeSource;
298
+ static isSupportedFile(filePath: string): boolean;
299
+ static is_supported_file(filePath: string): boolean;
300
+ static getSource(filePath: string, metadata?: Record<string, unknown> | null): KnowledgeSource;
301
+ static get_source(filePath: string, metadata?: Record<string, unknown> | null): KnowledgeSource;
302
+ }
303
+ export declare class Knowledge {
304
+ readonly sources: readonly KnowledgeSource[];
305
+ readonly collectionName: string | null;
306
+ readonly collection_name: string | null;
307
+ readonly storage: BaseKnowledgeStorage | null;
308
+ private entries;
309
+ constructor(options?: KnowledgeOptions);
310
+ addSources(sources?: readonly KnowledgeSource[]): void;
311
+ add_sources(sources?: readonly KnowledgeSource[]): void;
312
+ aaddSources(sources?: readonly KnowledgeSource[]): Promise<void>;
313
+ aadd_sources(sources?: readonly KnowledgeSource[]): Promise<void>;
314
+ add(content: string, options?: {
315
+ source?: string | null;
316
+ metadata?: Record<string, unknown> | null;
317
+ }): void;
318
+ query(query: string | readonly string[], options?: KnowledgeQueryOptions): KnowledgeSearchResult[];
319
+ aquery(query: string | readonly string[], options?: KnowledgeQueryOptions): Promise<KnowledgeSearchResult[]>;
320
+ reset(): void;
321
+ areset(): Promise<void>;
322
+ private documentsFromSources;
323
+ }
324
+ export declare abstract class BaseKnowledgeStorage {
325
+ abstract search(query: readonly string[], limit?: number, metadataFilter?: Record<string, unknown> | null, scoreThreshold?: number): SearchResult[];
326
+ abstract asearch(query: readonly string[], limit?: number, metadataFilter?: Record<string, unknown> | null, scoreThreshold?: number): Promise<SearchResult[]>;
327
+ abstract save(documents: readonly string[]): void;
328
+ abstract asave(documents: readonly string[]): Promise<void>;
329
+ abstract reset(): void;
330
+ abstract areset(): Promise<void>;
331
+ }
332
+ export declare class KnowledgeStorage extends BaseKnowledgeStorage {
333
+ readonly collectionName: string | null;
334
+ readonly collection_name: string | null;
335
+ readonly embedder: EmbedderConfig | null;
336
+ private client;
337
+ constructor(options?: KnowledgeStorageOptions);
338
+ _init_client(): this;
339
+ search(query: readonly string[], limit?: number, metadataFilter?: Record<string, unknown> | null, scoreThreshold?: number): SearchResult[];
340
+ asearch(query: readonly string[], limit?: number, metadataFilter?: Record<string, unknown> | null, scoreThreshold?: number): Promise<SearchResult[]>;
341
+ save(documents: readonly string[]): void;
342
+ asave(documents: readonly string[]): Promise<void>;
343
+ reset(): void;
344
+ areset(): Promise<void>;
345
+ _get_client(): RagClient;
346
+ get _client(): RagClient | null;
347
+ set _client(client: RagClient | null);
348
+ ragCollectionName(): string;
349
+ rag_collection_name(): string;
350
+ }
351
+ export declare function extractKnowledgeContext(results: readonly unknown[]): string;
352
+ declare function parseXlsxWorkbook(bytes: Buffer): ExcelWorkbookData;
353
+ export {};
@@ -0,0 +1,69 @@
1
+ import type { UsageMetrics } from "./llm.js";
2
+ import type { LLMMessage } from "./types.js";
3
+ export type TodoExecutionResultOptions = {
4
+ stepNumber?: number;
5
+ step_number?: number;
6
+ description: string;
7
+ toolUsed?: string | null;
8
+ tool_used?: string | null;
9
+ status: string;
10
+ result?: string | null;
11
+ dependsOn?: readonly number[];
12
+ depends_on?: readonly number[];
13
+ };
14
+ export declare class TodoExecutionResult {
15
+ readonly stepNumber: number;
16
+ readonly step_number: number;
17
+ readonly description: string;
18
+ readonly toolUsed: string | null;
19
+ readonly tool_used: string | null;
20
+ readonly status: string;
21
+ readonly result: string | null;
22
+ readonly dependsOn: readonly number[];
23
+ readonly depends_on: readonly number[];
24
+ constructor(options: TodoExecutionResultOptions);
25
+ }
26
+ export type LiteAgentOutputOptions = {
27
+ raw?: string;
28
+ pydantic?: unknown;
29
+ agentRole?: string;
30
+ agent_role?: string;
31
+ usageMetrics?: UsageMetrics | null;
32
+ usage_metrics?: UsageMetrics | null;
33
+ messages?: readonly LLMMessage[];
34
+ plan?: string | null;
35
+ todos?: readonly (TodoExecutionResult | TodoExecutionResultOptions)[];
36
+ replanCount?: number;
37
+ replan_count?: number;
38
+ lastReplanReason?: string | null;
39
+ last_replan_reason?: string | null;
40
+ };
41
+ export declare class LiteAgentOutput {
42
+ readonly raw: string;
43
+ readonly pydantic: unknown;
44
+ readonly agentRole: string;
45
+ readonly agent_role: string;
46
+ readonly usageMetrics: UsageMetrics | null;
47
+ readonly usage_metrics: UsageMetrics | null;
48
+ readonly messages: readonly LLMMessage[];
49
+ readonly plan: string | null;
50
+ readonly todos: readonly TodoExecutionResult[];
51
+ readonly replanCount: number;
52
+ readonly replan_count: number;
53
+ readonly lastReplanReason: string | null;
54
+ readonly last_replan_reason: string | null;
55
+ constructor(options: LiteAgentOutputOptions);
56
+ static fromTodoItems(items: readonly TodoExecutionResultOptions[]): TodoExecutionResult[];
57
+ static from_todo_items(items: readonly TodoExecutionResultOptions[]): TodoExecutionResult[];
58
+ toDict(): Record<string, unknown>;
59
+ to_dict(): Record<string, unknown>;
60
+ get completedTodos(): readonly TodoExecutionResult[];
61
+ get completed_todos(): readonly TodoExecutionResult[];
62
+ get failedTodos(): readonly TodoExecutionResult[];
63
+ get failed_todos(): readonly TodoExecutionResult[];
64
+ get hadPlan(): boolean;
65
+ get had_plan(): boolean;
66
+ toString(): string;
67
+ __str__(): string;
68
+ __repr__(): string;
69
+ }
@@ -0,0 +1,154 @@
1
+ import { Agent, type CodeExecutionMode } from "./agent.js";
2
+ import { type AfterLLMCallHook, type BeforeLLMCallHook } from "./hooks.js";
3
+ import { type InputFiles } from "./input-files.js";
4
+ import { type LLM, type LLMClient, type UsageMetrics } from "./llm.js";
5
+ import { LiteAgentOutput } from "./lite-agent-output.js";
6
+ import { Memory, type MemoryScope } from "./memory.js";
7
+ import { AgentFinish } from "./agent-parser.js";
8
+ import type { AgentStepCallback, LLMMessage, Tool } from "./types.js";
9
+ export type LiteAgentGuardrailResult = readonly [boolean, unknown] | {
10
+ success: boolean;
11
+ result?: unknown;
12
+ error?: unknown;
13
+ };
14
+ export type LiteAgentGuardrail = (output: LiteAgentOutput) => LiteAgentGuardrailResult | Promise<LiteAgentGuardrailResult>;
15
+ type ModelDumpOptions = {
16
+ mode?: string;
17
+ exclude?: ReadonlySet<string> | readonly string[] | Record<string, unknown>;
18
+ };
19
+ export type LiteAgentKickoffOptions = {
20
+ responseFormat?: unknown;
21
+ response_format?: unknown;
22
+ inputFiles?: InputFiles;
23
+ input_files?: InputFiles;
24
+ };
25
+ export type LiteAgentOptions = {
26
+ id?: string;
27
+ role: string;
28
+ goal: string;
29
+ backstory: string;
30
+ llm?: LLM | string | null;
31
+ tools?: readonly Tool[];
32
+ verbose?: boolean;
33
+ maxIterations?: number;
34
+ max_iterations?: number;
35
+ maxExecutionTime?: number | null;
36
+ max_execution_time?: number | null;
37
+ respectContextWindow?: boolean;
38
+ respect_context_window?: boolean;
39
+ useStopWords?: boolean;
40
+ use_stop_words?: boolean;
41
+ requestWithinRpmLimit?: (() => boolean) | null;
42
+ request_within_rpm_limit?: (() => boolean) | null;
43
+ responseFormat?: unknown;
44
+ response_format?: unknown;
45
+ guardrail?: LiteAgentGuardrail | null;
46
+ guardrailMaxRetries?: number;
47
+ guardrail_max_retries?: number;
48
+ memory?: Memory | MemoryScope | boolean | null;
49
+ stepCallback?: AgentStepCallback | null;
50
+ step_callback?: AgentStepCallback | null;
51
+ codeExecutionMode?: CodeExecutionMode;
52
+ code_execution_mode?: CodeExecutionMode;
53
+ a2a?: unknown;
54
+ };
55
+ export type LiteAgentKickoffInput = string | readonly LLMMessage[];
56
+ export type LiteAgentKickoffFunction = (messages: LiteAgentKickoffInput, responseFormatOrOptions?: unknown, inputFiles?: InputFiles) => LiteAgentOutput | Promise<LiteAgentOutput>;
57
+ export declare function _kickoff_with_a2a_support(agent: LiteAgent, original_kickoff: LiteAgentKickoffFunction, messages: LiteAgentKickoffInput, response_format?: unknown, input_files?: InputFiles | null, extension_registry?: import("./a2a.js").ExtensionRegistry): Promise<LiteAgentOutput>;
58
+ export declare function task_to_kickoff_adapter(original_kickoff: LiteAgentKickoffFunction, messages: LiteAgentKickoffInput, response_format?: unknown, input_files?: InputFiles | null): (...args: unknown[]) => Promise<string>;
59
+ export declare class LiteAgent {
60
+ readonly id: string;
61
+ readonly role: string;
62
+ readonly goal: string;
63
+ readonly backstory: string;
64
+ llm: LLM | LLMClient | string | null;
65
+ readonly tools: readonly Tool[];
66
+ readonly verbose: boolean;
67
+ readonly maxIterations: number;
68
+ readonly max_iterations: number;
69
+ readonly maxExecutionTime: number | null;
70
+ readonly max_execution_time: number | null;
71
+ readonly respectContextWindow: boolean;
72
+ readonly respect_context_window: boolean;
73
+ readonly useStopWords: boolean;
74
+ readonly use_stop_words: boolean;
75
+ readonly requestWithinRpmLimit: (() => boolean) | null;
76
+ readonly request_within_rpm_limit: (() => boolean) | null;
77
+ readonly responseFormat: unknown;
78
+ readonly response_format: unknown;
79
+ readonly guardrail: LiteAgentGuardrail | null;
80
+ readonly guardrailMaxRetries: number;
81
+ readonly guardrail_max_retries: number;
82
+ memory: Memory | MemoryScope | null;
83
+ readonly stepCallback: AgentStepCallback | null;
84
+ readonly codeExecutionMode: CodeExecutionMode;
85
+ readonly code_execution_mode: CodeExecutionMode;
86
+ readonly a2a: unknown;
87
+ readonly originalAgent: Agent | null;
88
+ readonly original_agent: Agent | null;
89
+ toolsResults: Record<string, unknown>[];
90
+ tools_results: Record<string, unknown>[];
91
+ private readonly _key;
92
+ private currentMessages;
93
+ private currentIterations;
94
+ private usageMetrics;
95
+ constructor(options: LiteAgentOptions);
96
+ get key(): string;
97
+ get messages(): readonly LLMMessage[];
98
+ get iterations(): number;
99
+ get _original_role(): string;
100
+ get beforeLlmCallHooks(): BeforeLLMCallHook[];
101
+ get before_llm_call_hooks(): BeforeLLMCallHook[];
102
+ get afterLlmCallHooks(): AfterLLMCallHook[];
103
+ get after_llm_call_hooks(): AfterLLMCallHook[];
104
+ setupLlm(): this;
105
+ setup_llm(): this;
106
+ parseTools(): this;
107
+ parse_tools(): this;
108
+ setupA2aSupport(): this;
109
+ setup_a2a_support(): this;
110
+ ensureGuardrailIsCallable(): this;
111
+ ensure_guardrail_is_callable(): this;
112
+ resolveMemory(): this;
113
+ resolve_memory(): this;
114
+ static validateGuardrailFunction(value: LiteAgentGuardrail | string | null | undefined): LiteAgentGuardrail | string | null | undefined;
115
+ static validate_guardrail_function(value: LiteAgentGuardrail | string | null | undefined): LiteAgentGuardrail | string | null | undefined;
116
+ modelDump(options?: ModelDumpOptions): Record<string, unknown>;
117
+ model_dump(options?: ModelDumpOptions): Record<string, unknown>;
118
+ kickoff(messages: LiteAgentKickoffInput, responseFormatOrOptions?: unknown, inputFiles?: InputFiles): Promise<LiteAgentOutput>;
119
+ kickoffAsync(messages: LiteAgentKickoffInput, responseFormatOrOptions?: unknown, inputFiles?: InputFiles): Promise<LiteAgentOutput>;
120
+ kickoff_async(messages: LiteAgentKickoffInput, responseFormatOrOptions?: unknown, inputFiles?: InputFiles): Promise<LiteAgentOutput>;
121
+ akickoff(messages: LiteAgentKickoffInput, responseFormatOrOptions?: unknown, inputFiles?: InputFiles): Promise<LiteAgentOutput>;
122
+ _invokeLoop(responseModel?: unknown): Promise<AgentFinish>;
123
+ _invoke_loop(response_model?: unknown): Promise<AgentFinish>;
124
+ _executeCore(agentInfo?: Record<string, unknown> | null): Promise<LiteAgentOutput>;
125
+ _execute_core(agent_info?: Record<string, unknown> | null): Promise<LiteAgentOutput>;
126
+ getUsageMetrics(): UsageMetrics;
127
+ get_usage_metrics(): UsageMetrics;
128
+ getTokenUsageSummary(): UsageMetrics;
129
+ get_token_usage_summary(): UsageMetrics;
130
+ resetUsageMetrics(): void;
131
+ reset_usage_metrics(): void;
132
+ _formatMessages(messages: LiteAgentKickoffInput, responseFormat?: unknown, inputFiles?: InputFiles): LLMMessage[];
133
+ _format_messages(messages: LiteAgentKickoffInput, response_format?: unknown, input_files?: InputFiles): LLMMessage[];
134
+ _getDefaultSystemPrompt(responseFormat?: unknown): string;
135
+ _get_default_system_prompt(response_format?: unknown): string;
136
+ _serializeResponseFormat(value: unknown): unknown;
137
+ _serialize_response_format(value: unknown): unknown;
138
+ _showLogs(formattedAnswer: unknown): void;
139
+ _show_logs(formatted_answer: unknown): void;
140
+ _getLastUserContent(): string;
141
+ _get_last_user_content(): string;
142
+ _appendMessage(message: LLMMessage): void;
143
+ _append_message(message: LLMMessage): void;
144
+ _injectMemoryContext(): void;
145
+ _inject_memory_context(): void;
146
+ _saveToMemory(outputText: string): void;
147
+ _save_to_memory(output_text: string): void;
148
+ private toolsWithMemoryTools;
149
+ private toAgent;
150
+ private agentInfo;
151
+ private captureStepCallback;
152
+ private applyGuardrail;
153
+ }
154
+ export {};