@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,358 @@
1
+ import type { LLM, MaybePromise } from "./types.js";
2
+ export type ReasoningEffort = "low" | "medium" | "high";
3
+ export type PlanningConfigOptions = {
4
+ reasoningEffort?: ReasoningEffort;
5
+ reasoning_effort?: ReasoningEffort;
6
+ observeSteps?: boolean | null;
7
+ observe_steps?: boolean | null;
8
+ maxAttempts?: number | null;
9
+ max_attempts?: number | null;
10
+ maxSteps?: number;
11
+ max_steps?: number;
12
+ systemPrompt?: string | null;
13
+ system_prompt?: string | null;
14
+ planPrompt?: string | null;
15
+ plan_prompt?: string | null;
16
+ refinePrompt?: string | null;
17
+ refine_prompt?: string | null;
18
+ maxReplans?: number;
19
+ max_replans?: number;
20
+ maxStepIterations?: number;
21
+ max_step_iterations?: number;
22
+ stepTimeout?: number | null;
23
+ step_timeout?: number | null;
24
+ llm?: LLM | string | null;
25
+ };
26
+ export type AgentPlanStep = {
27
+ stepNumber?: number;
28
+ step_number?: number;
29
+ description: string;
30
+ toolToUse?: string | null;
31
+ tool_to_use?: string | null;
32
+ dependsOn?: readonly number[];
33
+ depends_on?: readonly number[];
34
+ };
35
+ export type AgentReasoningPlan = {
36
+ plan: string;
37
+ steps: readonly AgentPlanStep[];
38
+ ready: boolean;
39
+ };
40
+ export declare const REASONING_READY_MARKER = "READY: I am ready to execute the task.";
41
+ export declare const TodoStatus: {
42
+ readonly PENDING: "pending";
43
+ readonly RUNNING: "running";
44
+ readonly COMPLETED: "completed";
45
+ readonly FAILED: "failed";
46
+ };
47
+ export type TodoStatus = typeof TodoStatus[keyof typeof TodoStatus];
48
+ export declare class PlanStep {
49
+ readonly stepNumber: number;
50
+ readonly step_number: number;
51
+ readonly description: string;
52
+ readonly toolToUse: string | null;
53
+ readonly tool_to_use: string | null;
54
+ readonly dependsOn: readonly number[];
55
+ readonly depends_on: readonly number[];
56
+ constructor(options: AgentPlanStep);
57
+ modelDump(): AgentPlanStep;
58
+ model_dump(): AgentPlanStep;
59
+ toJSON(): AgentPlanStep;
60
+ }
61
+ export declare class TodoItem extends PlanStep {
62
+ readonly id: string;
63
+ status: TodoStatus;
64
+ result: string | null;
65
+ constructor(options: AgentPlanStep & {
66
+ id?: string;
67
+ status?: TodoStatus;
68
+ result?: string | null;
69
+ });
70
+ modelDump(): AgentPlanStep & {
71
+ id: string;
72
+ status: TodoStatus;
73
+ result: string | null;
74
+ };
75
+ model_dump(): AgentPlanStep & {
76
+ id: string;
77
+ status: TodoStatus;
78
+ result: string | null;
79
+ };
80
+ toJSON(): AgentPlanStep & {
81
+ id: string;
82
+ status: TodoStatus;
83
+ result: string | null;
84
+ };
85
+ }
86
+ export declare class TodoList {
87
+ items: TodoItem[];
88
+ constructor(options?: {
89
+ items?: readonly (TodoItem | (AgentPlanStep & {
90
+ id?: string;
91
+ status?: TodoStatus;
92
+ result?: string | null;
93
+ }))[];
94
+ });
95
+ get currentTodo(): TodoItem | null;
96
+ get current_todo(): TodoItem | null;
97
+ get nextPending(): TodoItem | null;
98
+ get next_pending(): TodoItem | null;
99
+ get isComplete(): boolean;
100
+ get is_complete(): boolean;
101
+ get pendingCount(): number;
102
+ get pending_count(): number;
103
+ get completedCount(): number;
104
+ get completed_count(): number;
105
+ get runningCount(): number;
106
+ get running_count(): number;
107
+ get canParallelize(): boolean;
108
+ get can_parallelize(): boolean;
109
+ getByStepNumber(stepNumber: number): TodoItem | null;
110
+ get_by_step_number(stepNumber: number): TodoItem | null;
111
+ markRunning(stepNumber: number): void;
112
+ mark_running(stepNumber: number): void;
113
+ markCompleted(stepNumber: number, result?: string | null): void;
114
+ mark_completed(stepNumber: number, result?: string | null): void;
115
+ markFailed(stepNumber: number, result?: string | null): void;
116
+ mark_failed(stepNumber: number, result?: string | null): void;
117
+ getReadyTodos(): TodoItem[];
118
+ get_ready_todos(): TodoItem[];
119
+ getCompletedTodos(): TodoItem[];
120
+ get_completed_todos(): TodoItem[];
121
+ getFailedTodos(): TodoItem[];
122
+ get_failed_todos(): TodoItem[];
123
+ getPendingTodos(): TodoItem[];
124
+ get_pending_todos(): TodoItem[];
125
+ replacePendingTodos(newItems: readonly TodoItem[]): void;
126
+ replace_pending_todos(newItems: readonly TodoItem[]): void;
127
+ private dependenciesSatisfied;
128
+ _dependencies_satisfied(item: TodoItem): boolean;
129
+ modelDump(): {
130
+ items: Array<ReturnType<TodoItem["modelDump"]>>;
131
+ };
132
+ model_dump(): {
133
+ items: Array<ReturnType<TodoItem["modelDump"]>>;
134
+ };
135
+ toJSON(): {
136
+ items: Array<ReturnType<TodoItem["modelDump"]>>;
137
+ };
138
+ }
139
+ export declare class StepRefinement {
140
+ readonly stepNumber: number;
141
+ readonly step_number: number;
142
+ readonly newDescription: string;
143
+ readonly new_description: string;
144
+ constructor(options: {
145
+ stepNumber?: number;
146
+ step_number?: number;
147
+ newDescription?: string;
148
+ new_description?: string;
149
+ });
150
+ }
151
+ type StepRefinementOptions = ConstructorParameters<typeof StepRefinement>[0];
152
+ export declare class StepObservation {
153
+ readonly stepCompletedSuccessfully: boolean;
154
+ readonly step_completed_successfully: boolean;
155
+ readonly keyInformationLearned: string;
156
+ readonly key_information_learned: string;
157
+ readonly remainingPlanStillValid: boolean;
158
+ readonly remaining_plan_still_valid: boolean;
159
+ readonly suggestedRefinements: readonly StepRefinement[] | null;
160
+ readonly suggested_refinements: readonly StepRefinement[] | null;
161
+ readonly needsFullReplan: boolean;
162
+ readonly needs_full_replan: boolean;
163
+ readonly replanReason: string | null;
164
+ readonly replan_reason: string | null;
165
+ readonly goalAlreadyAchieved: boolean;
166
+ readonly goal_already_achieved: boolean;
167
+ static coerceSingleRefinementToList(value: unknown): unknown;
168
+ static coerce_single_refinement_to_list(value: unknown): unknown;
169
+ constructor(options?: {
170
+ stepCompletedSuccessfully?: boolean;
171
+ step_completed_successfully?: boolean;
172
+ keyInformationLearned?: string;
173
+ key_information_learned?: string;
174
+ remainingPlanStillValid?: boolean;
175
+ remaining_plan_still_valid?: boolean;
176
+ suggestedRefinements?: readonly (StepRefinement | StepRefinementOptions)[] | StepRefinement | StepRefinementOptions | null;
177
+ suggested_refinements?: readonly (StepRefinement | StepRefinementOptions)[] | StepRefinement | StepRefinementOptions | null;
178
+ needsFullReplan?: boolean;
179
+ needs_full_replan?: boolean;
180
+ replanReason?: string | null;
181
+ replan_reason?: string | null;
182
+ goalAlreadyAchieved?: boolean;
183
+ goal_already_achieved?: boolean;
184
+ });
185
+ }
186
+ export declare class ReasoningPlan {
187
+ readonly plan: string;
188
+ readonly steps: readonly PlanStep[];
189
+ readonly ready: boolean;
190
+ constructor(options: {
191
+ plan: string;
192
+ steps?: readonly (PlanStep | AgentPlanStep)[];
193
+ ready: boolean;
194
+ });
195
+ }
196
+ export declare const PlanningPlan: typeof ReasoningPlan;
197
+ export declare const AgentReasoningOutput: {
198
+ new (options: {
199
+ plan: ReasoningPlan | {
200
+ plan: string;
201
+ steps?: readonly (PlanStep | AgentPlanStep)[];
202
+ ready: boolean;
203
+ };
204
+ }): {
205
+ readonly plan: ReasoningPlan;
206
+ };
207
+ };
208
+ export type AgentReasoningOutput = InstanceType<typeof AgentReasoningOutput>;
209
+ export declare const AgentPlanningOutput: {
210
+ new (options: {
211
+ plan: ReasoningPlan | {
212
+ plan: string;
213
+ steps?: readonly (PlanStep | AgentPlanStep)[];
214
+ ready: boolean;
215
+ };
216
+ }): {
217
+ readonly plan: ReasoningPlan;
218
+ };
219
+ };
220
+ export declare const FUNCTION_SCHEMA: {
221
+ readonly type: "function";
222
+ readonly function: {
223
+ readonly name: "create_reasoning_plan";
224
+ readonly description: "Create or refine a reasoning plan for a task with structured steps";
225
+ readonly parameters: {
226
+ readonly type: "object";
227
+ readonly properties: {
228
+ readonly plan: {
229
+ readonly type: "string";
230
+ };
231
+ readonly steps: {
232
+ readonly type: "array";
233
+ readonly items: {
234
+ readonly type: "object";
235
+ readonly properties: {
236
+ readonly step_number: {
237
+ readonly type: "integer";
238
+ };
239
+ readonly description: {
240
+ readonly type: "string";
241
+ };
242
+ readonly tool_to_use: {
243
+ readonly type: readonly ["string", "null"];
244
+ };
245
+ readonly depends_on: {
246
+ readonly type: "array";
247
+ readonly items: {
248
+ readonly type: "integer";
249
+ };
250
+ };
251
+ };
252
+ readonly required: readonly ["step_number", "description", "tool_to_use", "depends_on"];
253
+ readonly additionalProperties: false;
254
+ };
255
+ };
256
+ readonly ready: {
257
+ readonly type: "boolean";
258
+ };
259
+ };
260
+ readonly required: readonly ["plan", "steps", "ready"];
261
+ readonly additionalProperties: false;
262
+ };
263
+ };
264
+ };
265
+ export declare class PlanningConfig {
266
+ readonly reasoningEffort: ReasoningEffort;
267
+ readonly reasoning_effort: ReasoningEffort;
268
+ readonly observeSteps: boolean | null;
269
+ readonly observe_steps: boolean | null;
270
+ readonly maxAttempts: number | null;
271
+ readonly max_attempts: number | null;
272
+ readonly maxSteps: number;
273
+ readonly max_steps: number;
274
+ readonly systemPrompt: string | null;
275
+ readonly system_prompt: string | null;
276
+ readonly planPrompt: string | null;
277
+ readonly plan_prompt: string | null;
278
+ readonly refinePrompt: string | null;
279
+ readonly refine_prompt: string | null;
280
+ readonly maxReplans: number;
281
+ readonly max_replans: number;
282
+ readonly maxStepIterations: number;
283
+ readonly max_step_iterations: number;
284
+ readonly stepTimeout: number | null;
285
+ readonly step_timeout: number | null;
286
+ readonly llm: LLM | string | null;
287
+ constructor(options?: PlanningConfigOptions);
288
+ }
289
+ export declare function createDefaultPlanningConfigForFlag(): PlanningConfig;
290
+ export declare function normalizePlanningConfig(config: PlanningConfig | PlanningConfigOptions | null | undefined): PlanningConfig | null;
291
+ export declare function createAgentPlanningPrompt(options: {
292
+ role: string;
293
+ goal: string;
294
+ backstory: string;
295
+ description: string;
296
+ expectedOutput?: string | null;
297
+ tools: string;
298
+ config: PlanningConfig;
299
+ }): string;
300
+ export declare function createAgentRefinePlanningPrompt(options: {
301
+ role: string;
302
+ goal: string;
303
+ backstory: string;
304
+ currentPlan: string;
305
+ current_plan?: string;
306
+ config: PlanningConfig;
307
+ }): string;
308
+ export declare function createAgentPlanningSystemPrompt(options: {
309
+ role: string;
310
+ goal: string;
311
+ backstory: string;
312
+ config: PlanningConfig;
313
+ }): string;
314
+ export declare function parseAgentPlanningOutput(raw: string): AgentReasoningPlan;
315
+ export declare class AgentReasoning {
316
+ readonly agent: unknown;
317
+ readonly task: unknown;
318
+ readonly config: PlanningConfig;
319
+ readonly llm: LLM | string | null;
320
+ readonly description: string;
321
+ readonly expectedOutput: string;
322
+ readonly expected_output: string;
323
+ constructor(agentOrOptions: unknown, task?: unknown, options?: {
324
+ description?: string | null;
325
+ expectedOutput?: string | null;
326
+ expected_output?: string | null;
327
+ });
328
+ _get_planning_config(): PlanningConfig;
329
+ _resolve_llm(): LLM | string | null;
330
+ handleAgentReasoning(): AgentReasoningOutput | Promise<AgentReasoningOutput>;
331
+ handle_agent_reasoning(): AgentReasoningOutput | Promise<AgentReasoningOutput>;
332
+ _execute_planning(): AgentReasoningOutput | Promise<AgentReasoningOutput>;
333
+ _create_initial_plan(): [string, PlanStep[], boolean] | Promise<[string, PlanStep[], boolean]>;
334
+ _refine_plan_if_needed(plan: string, steps: PlanStep[], ready: boolean): [string, PlanStep[], boolean] | Promise<[string, PlanStep[], boolean]>;
335
+ _call_with_function(prompt: string, planType: "create_plan" | "refine_plan"): [string, PlanStep[], boolean] | Promise<[string, PlanStep[], boolean]>;
336
+ _call_llm_with_prompt(prompt: string, planType: "create_plan" | "refine_plan"): MaybePromise<string>;
337
+ _get_system_prompt(): string;
338
+ _get_agent_backstory(): string;
339
+ _create_planning_prompt(): string;
340
+ _format_available_tools(): string;
341
+ _create_refine_prompt(currentPlan: string): string;
342
+ static _parse_planning_response(response: string): [string, boolean];
343
+ _parse_planning_response(response: string): [string, boolean];
344
+ private resolvePlanningOutput;
345
+ private refinePlanLoop;
346
+ private textRefinePlan;
347
+ private parseFunctionPlanResponse;
348
+ private callPlanningLlm;
349
+ private llmSupportsFunctionCalling;
350
+ private agentRole;
351
+ private agentGoal;
352
+ private taskId;
353
+ private emitReasoningStarted;
354
+ private emitReasoningCompleted;
355
+ private emitReasoningFailed;
356
+ }
357
+ export declare const AgentPlanning: typeof AgentReasoning;
358
+ export {};
@@ -0,0 +1,210 @@
1
+ import { type JsonSchema } from "./schema-utils.js";
2
+ import { AgentAction, AgentFinish } from "./agent-parser.js";
3
+ import { BaseTool, ToolResult } from "./tools.js";
4
+ import type { LLMMessage, MaybePromise, Tool, ToolContext } from "./types.js";
5
+ import { Printer } from "./logger.js";
6
+ export type ToolRunner = (input?: ToolContext | Record<string, unknown> | string) => MaybePromise<unknown>;
7
+ export type SummaryContent = {
8
+ content: string;
9
+ };
10
+ export declare const SummaryContent: {
11
+ new (options?: {
12
+ content?: string;
13
+ }): {
14
+ readonly content: string;
15
+ };
16
+ };
17
+ export type AgentKnowledgeContextLike = {
18
+ agentKnowledgeContext?: string | null;
19
+ agent_knowledge_context?: string | null;
20
+ crewKnowledgeContext?: string | null;
21
+ crew_knowledge_context?: string | null;
22
+ };
23
+ export declare const DELEGATION_TOOL_NAMES: readonly string[];
24
+ export type NativeToolCallResultOptions = {
25
+ text?: string;
26
+ result?: unknown;
27
+ resultAsAnswer?: boolean;
28
+ result_as_answer?: boolean;
29
+ toolCallId?: string | null;
30
+ tool_call_id?: string | null;
31
+ toolName?: string | null;
32
+ tool_name?: string | null;
33
+ };
34
+ export declare class NativeToolCallResult {
35
+ readonly text: string;
36
+ readonly result: unknown;
37
+ readonly resultAsAnswer: boolean;
38
+ readonly result_as_answer: boolean;
39
+ readonly toolCallId: string | null;
40
+ readonly tool_call_id: string | null;
41
+ readonly toolName: string | null;
42
+ readonly tool_name: string | null;
43
+ constructor(options?: NativeToolCallResultOptions);
44
+ }
45
+ export type OpenAIFunctionToolSchema = {
46
+ type: "function";
47
+ function: {
48
+ name: string;
49
+ description: string;
50
+ parameters: JsonSchema;
51
+ strict: true;
52
+ };
53
+ };
54
+ export type OpenAIToolConversionResult = [
55
+ openaiTools: OpenAIFunctionToolSchema[],
56
+ availableFunctions: Record<string, ToolRunner>,
57
+ toolNameMapping: Record<string, Tool>
58
+ ];
59
+ type SummaryLLM = {
60
+ call?: (messages: readonly LLMMessage[], options?: Record<string, unknown>) => MaybePromise<unknown>;
61
+ acall?: (messages: readonly LLMMessage[], options?: Record<string, unknown>) => MaybePromise<unknown>;
62
+ get_context_window_size?: () => number;
63
+ getContextWindowSize?: () => number;
64
+ };
65
+ export declare function getToolNames(tools: readonly Tool[]): string;
66
+ export declare function renderTextDescriptionAndArgs(tools: readonly Tool[]): string;
67
+ export declare function convertToolsToOpenAISchema(tools: readonly Tool[]): OpenAIToolConversionResult;
68
+ export declare function extractTaskSection(text: string): string;
69
+ export declare function hasReachedMaxIterations(iterations: number, maxIterations: number): boolean;
70
+ export declare function _executor_stop_words(executorContext: unknown): string[];
71
+ export declare function _llm_stop_words_applied<T>(llm: unknown, executorContext: unknown, callback: () => MaybePromise<T>): Promise<T>;
72
+ export declare function formatMessageForLLM(prompt: string, role?: "user" | "assistant" | "system"): LLMMessage;
73
+ export declare function combineKnowledgeContext(agent: AgentKnowledgeContextLike): string;
74
+ export declare const _combine_knowledge_context: typeof combineKnowledgeContext;
75
+ export declare function isInsideEventLoop(): boolean;
76
+ export declare const is_inside_event_loop: typeof isInsideEventLoop;
77
+ export declare function parseTools(tools: readonly Tool[]): Tool[];
78
+ export declare const parse_tools: typeof parseTools;
79
+ export type MaxIterationsPrinter = {
80
+ print?: (options: {
81
+ content: string;
82
+ color?: string;
83
+ }) => void;
84
+ };
85
+ export type MaxIterationsLLM = {
86
+ call?: (messages: readonly LLMMessage[], options?: Record<string, unknown>) => MaybePromise<unknown>;
87
+ };
88
+ export type HandleMaxIterationsExceededOptions = {
89
+ formattedAnswer?: AgentAction | AgentFinish | null | undefined;
90
+ formatted_answer?: AgentAction | AgentFinish | null | undefined;
91
+ printer?: MaxIterationsPrinter | null | undefined;
92
+ messages?: LLMMessage[] | undefined;
93
+ llm?: MaxIterationsLLM | null | undefined;
94
+ callbacks?: readonly unknown[] | undefined;
95
+ verbose?: boolean | undefined;
96
+ };
97
+ export declare function handleMaxIterationsExceeded(options?: HandleMaxIterationsExceededOptions): AgentFinish | Promise<AgentFinish>;
98
+ export declare function handleMaxIterationsExceeded(formattedAnswer?: AgentAction | AgentFinish | null, printer?: MaxIterationsPrinter | null, messages?: LLMMessage[], llm?: MaxIterationsLLM | null, callbacks?: readonly unknown[], verbose?: boolean): AgentFinish | Promise<AgentFinish>;
99
+ export declare const handle_max_iterations_exceeded: typeof handleMaxIterationsExceeded;
100
+ export declare function formatAnswer(answer: unknown): string;
101
+ export declare const format_answer: typeof formatAnswer;
102
+ export declare function enforceRpmLimit(requestWithinRpmLimit?: (() => boolean | Promise<boolean>) | null): void;
103
+ export declare const enforce_rpm_limit: typeof enforceRpmLimit;
104
+ export type AgentUtilsExecutorContext = {
105
+ messages?: readonly LLMMessage[];
106
+ llm?: unknown;
107
+ agent?: unknown;
108
+ task?: unknown;
109
+ crew?: unknown;
110
+ iterations?: number;
111
+ };
112
+ export declare function _prepare_llm_call(executorContext: AgentUtilsExecutorContext | null | undefined, messages: readonly LLMMessage[]): Promise<LLMMessage[]>;
113
+ export declare function _validate_and_finalize_llm_response(answer: unknown, executorContext?: AgentUtilsExecutorContext | null | undefined, messages?: readonly LLMMessage[]): Promise<unknown>;
114
+ export declare function getLlmResponse(llm: {
115
+ call?: (messages: readonly LLMMessage[], options?: Record<string, unknown>) => MaybePromise<unknown>;
116
+ }, messages: readonly LLMMessage[], options?: Record<string, unknown>): Promise<unknown>;
117
+ export declare const get_llm_response: typeof getLlmResponse;
118
+ export declare function agetLlmResponse(llm: {
119
+ acall?: (messages: readonly LLMMessage[], options?: Record<string, unknown>) => MaybePromise<unknown>;
120
+ call?: (messages: readonly LLMMessage[], options?: Record<string, unknown>) => MaybePromise<unknown>;
121
+ }, messages: readonly LLMMessage[], options?: Record<string, unknown>): Promise<unknown>;
122
+ export declare const aget_llm_response: typeof agetLlmResponse;
123
+ export declare function processLlmResponse(response: unknown, useStopWords?: boolean): unknown;
124
+ export declare const process_llm_response: typeof processLlmResponse;
125
+ export declare function handleAgentActionCore(action: AgentAction, tools: readonly Tool[]): ToolResult;
126
+ export declare function handleAgentActionCore(formattedAnswer: AgentAction, toolResult: ToolResult, messages?: LLMMessage[] | null, stepCallback?: ((toolResult: ToolResult) => MaybePromise<unknown>) | null, showLogs?: ((formattedAnswer: AgentAction) => unknown) | null): AgentAction | AgentFinish | Promise<AgentAction | AgentFinish>;
127
+ export declare const handle_agent_action_core: typeof handleAgentActionCore;
128
+ export declare function handleUnknownError(error: unknown): string;
129
+ export declare function handleUnknownError(printer: Printer, exception: unknown, verbose?: boolean): void;
130
+ export declare const handle_unknown_error: typeof handleUnknownError;
131
+ export declare function handleOutputParserException(error: unknown): string;
132
+ export declare function handleOutputParserException(error: unknown, messages: LLMMessage[], iterations?: number, logErrorAfter?: number): AgentAction;
133
+ export declare const handle_output_parser_exception: typeof handleOutputParserException;
134
+ export declare function isContextLengthExceeded(error: unknown): boolean;
135
+ export declare const is_context_length_exceeded: typeof isContextLengthExceeded;
136
+ export declare function handleContextLength(messages: readonly LLMMessage[], summary: string): LLMMessage[];
137
+ export declare const handle_context_length: typeof handleContextLength;
138
+ export declare function summarizeMessages(messages: readonly LLMMessage[]): SummaryContent;
139
+ export declare function summarizeMessages(messages: LLMMessage[], llm: SummaryLLM, callbacks?: readonly unknown[], verbose?: boolean): Promise<void>;
140
+ export declare const summarize_messages: typeof summarizeMessages;
141
+ export declare function _asummarize_chunks(chunks: readonly (readonly LLMMessage[])[], llm: {
142
+ acall?: (messages: readonly LLMMessage[], options?: Record<string, unknown>) => MaybePromise<unknown>;
143
+ call?: (messages: readonly LLMMessage[], options?: Record<string, unknown>) => MaybePromise<unknown>;
144
+ }, callbacks?: readonly unknown[]): Promise<SummaryContent[]>;
145
+ export declare function _estimate_token_count(text: string): number;
146
+ export declare function _format_messages_for_summary(messages: readonly LLMMessage[]): string;
147
+ export declare function _split_messages_into_chunks(messages: readonly LLMMessage[], max_tokens: number): LLMMessage[][];
148
+ export declare function _extract_summary_tags(text: string): string;
149
+ export declare function showAgentLogs(printer: Printer, agentRole: string, formattedAnswer?: AgentAction | AgentFinish | null, taskDescription?: string | null, verbose?: boolean): void;
150
+ export declare function showAgentLogs(agent: unknown, message: string): void;
151
+ export declare const show_agent_logs: typeof showAgentLogs;
152
+ type AgentRepositoryResponse = {
153
+ status?: number;
154
+ status_code?: number;
155
+ ok?: boolean;
156
+ text?: string | (() => string);
157
+ json?: Record<string, unknown> | (() => Record<string, unknown>);
158
+ };
159
+ type AgentRepositoryClient = {
160
+ getAgent?: (repository: string) => AgentRepositoryResponse;
161
+ get_agent?: (repository: string) => AgentRepositoryResponse;
162
+ };
163
+ export declare function setCreatePlusClientHook(hook: (() => AgentRepositoryClient) | null): void;
164
+ export declare const set_create_plus_client_hook: typeof setCreatePlusClientHook;
165
+ export declare function loadAgentFromRepository(repository: string): Record<string, unknown>;
166
+ export declare const load_agent_from_repository: typeof loadAgentFromRepository;
167
+ export declare function trackDelegationIfNeeded(toolName: string, args: Record<string, unknown>, task?: {
168
+ incrementDelegations?: (coworker?: unknown) => void;
169
+ } | null): void;
170
+ export declare const track_delegation_if_needed: typeof trackDelegationIfNeeded;
171
+ export declare function extractToolCallInfo(value: unknown): {
172
+ toolName: string;
173
+ arguments: Record<string, unknown> | null;
174
+ argumentParseError: string | null;
175
+ id: string | null;
176
+ } | null;
177
+ export declare const extract_tool_call_info: typeof extractToolCallInfo;
178
+ export declare function isToolCallList(value: unknown): value is readonly unknown[];
179
+ export declare const is_tool_call_list: typeof isToolCallList;
180
+ export declare function checkNativeToolSupport(llm: unknown, tools: readonly Tool[]): boolean;
181
+ export declare const check_native_tool_support: typeof checkNativeToolSupport;
182
+ export declare function setupNativeTools(tools: readonly Tool[]): OpenAIToolConversionResult;
183
+ export declare const setup_native_tools: typeof setupNativeTools;
184
+ export declare function buildToolCallsAssistantMessage(results: readonly NativeToolCallResult[]): LLMMessage;
185
+ export declare const build_tool_calls_assistant_message: typeof buildToolCallsAssistantMessage;
186
+ export type ExecuteSingleNativeToolCallOptions = {
187
+ originalTools?: readonly Tool[];
188
+ original_tools?: readonly Tool[];
189
+ };
190
+ export declare function executeSingleNativeToolCall(toolCall: unknown, availableFunctions: Record<string, ToolRunner>, options?: ExecuteSingleNativeToolCallOptions): Promise<NativeToolCallResult>;
191
+ export declare const execute_single_native_tool_call: typeof executeSingleNativeToolCall;
192
+ export declare function parseToolCallArgs(value: unknown): Record<string, unknown> | null;
193
+ export type ParsedToolCallArgs = [
194
+ args: Record<string, unknown> | null,
195
+ error: {
196
+ call_id: string;
197
+ func_name: string;
198
+ result: string;
199
+ from_cache: false;
200
+ original_tool: unknown;
201
+ } | null
202
+ ];
203
+ export declare function parse_tool_call_args(value: unknown, func_name?: string, call_id?: string, original_tool?: unknown): ParsedToolCallArgs;
204
+ export declare const get_tool_names: typeof getToolNames;
205
+ export declare const render_text_description_and_args: typeof renderTextDescriptionAndArgs;
206
+ export declare const convert_tools_to_openai_schema: typeof convertToolsToOpenAISchema;
207
+ export declare const extract_task_section: typeof extractTaskSection;
208
+ export declare const has_reached_max_iterations: typeof hasReachedMaxIterations;
209
+ export declare const format_message_for_llm: typeof formatMessageForLLM;
210
+ export type { BaseTool };