@crewai-ts/core 0.1.2 → 0.1.5
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/dist/a2a.d.ts +1684 -0
- package/dist/a2ui-schemas.d.ts +3312 -0
- package/dist/a2ui.d.ts +379 -0
- package/dist/agent-adapters.d.ts +178 -0
- package/dist/agent-executors.d.ts +508 -0
- package/dist/agent-parser.d.ts +44 -0
- package/dist/agent-planning.d.ts +358 -0
- package/dist/agent-utils.d.ts +210 -0
- package/dist/agent.d.ts +444 -0
- package/dist/auth.d.ts +179 -0
- package/dist/config-utils.d.ts +5 -0
- package/dist/content-processor.d.ts +12 -0
- package/dist/context.d.ts +157 -0
- package/dist/converter.d.ts +97 -0
- package/dist/crew-chat.d.ts +97 -0
- package/dist/crew.d.ts +424 -0
- package/dist/decorators.d.ts +20 -0
- package/dist/env.d.ts +13 -0
- package/dist/errors.d.ts +27 -0
- package/dist/evaluators.d.ts +477 -0
- package/dist/events.d.ts +2657 -0
- package/dist/execution-utils.d.ts +85 -0
- package/dist/experimental-conversational.d.ts +181 -0
- package/dist/file-handler.d.ts +36 -0
- package/dist/file-store.d.ts +37 -0
- package/dist/files.d.ts +554 -0
- package/dist/flow-conversation.d.ts +90 -0
- package/dist/flow-definition.d.ts +195 -0
- package/dist/flow-persistence.d.ts +107 -0
- package/dist/flow-visualization.d.ts +77 -0
- package/dist/flow.d.ts +927 -0
- package/dist/formatter.d.ts +7 -0
- package/dist/guardrail.d.ts +95 -0
- package/dist/hooks.d.ts +241 -0
- package/dist/human-input.d.ts +74 -0
- package/dist/i18n.d.ts +26 -0
- package/dist/index.cjs +83 -36
- package/dist/index.d.ts +99 -13004
- package/dist/index.js +82 -36
- package/dist/input-files.d.ts +24 -0
- package/dist/input-provider.d.ts +22 -0
- package/dist/knowledge.d.ts +353 -0
- package/dist/lite-agent-output.d.ts +69 -0
- package/dist/lite-agent.d.ts +154 -0
- package/dist/llm.d.ts +630 -0
- package/dist/llms-hooks-transport.d.ts +1 -2
- package/dist/lock-store.d.ts +14 -0
- package/dist/logger.d.ts +55 -0
- package/dist/mcp.d.ts +315 -0
- package/dist/memory.d.ts +915 -0
- package/dist/metadata.d.ts +9 -0
- package/dist/misc-compat.d.ts +125 -0
- package/dist/openai-completion.d.ts +324 -0
- package/dist/outputs.d.ts +69 -0
- package/dist/planning.d.ts +60 -0
- package/dist/plus-api.d.ts +194 -0
- package/dist/project-compat.d.ts +133 -0
- package/dist/project.d.ts +221 -0
- package/dist/prompts.d.ts +66 -0
- package/dist/provider-completions.d.ts +593 -0
- package/dist/rag.d.ts +1074 -0
- package/dist/rpm.d.ts +27 -0
- package/dist/rw-lock.d.ts +21 -0
- package/dist/schema-utils.d.ts +121 -0
- package/dist/security.d.ts +66 -0
- package/dist/settings.d.ts +103 -0
- package/dist/skills.d.ts +145 -0
- package/dist/state-provider-core.d.ts +1 -1
- package/dist/state.d.ts +204 -0
- package/dist/step-execution-context.d.ts +36 -0
- package/dist/streaming.d.ts +153 -0
- package/dist/string-utils.d.ts +12 -0
- package/dist/task-output-storage.d.ts +62 -0
- package/dist/task.d.ts +305 -0
- package/dist/telemetry.d.ts +91 -0
- package/dist/token-counter-callback.d.ts +36 -0
- package/dist/tools.d.ts +563 -0
- package/dist/tracing-utils.d.ts +56 -0
- package/dist/training-converter.d.ts +36 -0
- package/dist/training-handler.d.ts +10 -0
- package/dist/types.d.ts +72 -0
- package/dist/utilities.d.ts +130 -0
- package/dist/utility-types.d.ts +10 -0
- package/dist/version.d.ts +12 -0
- package/package.json +326 -4904
- package/dist/index.d.cts +0 -13068
- package/dist/llms-hooks-transport-ChGiFBiU.d.ts +0 -233
- package/dist/llms-hooks-transport-DZlurMUQ.d.cts +0 -233
- package/dist/llms-hooks-transport.d.cts +0 -2
- package/dist/state-provider-core-Be9RKRAm.d.cts +0 -4876
- package/dist/state-provider-core-Be9RKRAm.d.ts +0 -4876
- package/dist/state-provider-core.d.cts +0 -1
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
import type { InputValues, MaybePromise, Tool, ToolContext } from "./types.js";
|
|
2
|
+
import { sanitizeToolName } from "./string-utils.js";
|
|
3
|
+
import { AgentAction } from "./agent-parser.js";
|
|
4
|
+
export declare const OPENAI_BIGGER_MODELS: readonly ["gpt-4", "gpt-4o", "gpt-4.1"];
|
|
5
|
+
export type ToolArgumentType = "string" | "number" | "boolean" | "object" | "array" | "unknown";
|
|
6
|
+
export type ToolArgumentSpec = {
|
|
7
|
+
type?: ToolArgumentType;
|
|
8
|
+
description?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
default?: unknown;
|
|
11
|
+
};
|
|
12
|
+
export type ToolArgsSchema = Record<string, ToolArgumentSpec>;
|
|
13
|
+
export type ToolInvocationInput = string | Record<string, unknown> | ToolContext | undefined;
|
|
14
|
+
export type ToolHookContextOptions = {
|
|
15
|
+
agent?: unknown;
|
|
16
|
+
task?: unknown;
|
|
17
|
+
crew?: unknown;
|
|
18
|
+
};
|
|
19
|
+
export type ToolCacheReadResult = {
|
|
20
|
+
hit: true;
|
|
21
|
+
value: unknown;
|
|
22
|
+
} | {
|
|
23
|
+
hit: false;
|
|
24
|
+
};
|
|
25
|
+
export type ToolCache = {
|
|
26
|
+
read(toolName: string, input: string): ToolCacheReadResult;
|
|
27
|
+
write(toolName: string, input: string, output: unknown): void;
|
|
28
|
+
clear?(): void;
|
|
29
|
+
};
|
|
30
|
+
export type BaseToolOptions = {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
argsSchema?: ToolArgsSchema;
|
|
34
|
+
args_schema?: ToolArgsSchema;
|
|
35
|
+
envVars?: readonly EnvVar[];
|
|
36
|
+
env_vars?: readonly EnvVar[];
|
|
37
|
+
descriptionUpdated?: boolean;
|
|
38
|
+
description_updated?: boolean;
|
|
39
|
+
resultAsAnswer?: boolean;
|
|
40
|
+
result_as_answer?: boolean;
|
|
41
|
+
maxUsageCount?: number | null;
|
|
42
|
+
max_usage_count?: number | null;
|
|
43
|
+
currentUsageCount?: number;
|
|
44
|
+
current_usage_count?: number;
|
|
45
|
+
cacheFunction?: (args: Record<string, unknown>, result: unknown) => boolean;
|
|
46
|
+
cache_function?: (args: Record<string, unknown>, result: unknown) => boolean;
|
|
47
|
+
cache?: ToolCache | false;
|
|
48
|
+
};
|
|
49
|
+
export type AgentLikeForTool = {
|
|
50
|
+
role: string;
|
|
51
|
+
executeTask?: (task: unknown, context?: string | null) => MaybePromise<unknown>;
|
|
52
|
+
execute_task?: (task: unknown, context?: string | null) => MaybePromise<unknown>;
|
|
53
|
+
};
|
|
54
|
+
export type StructuredToolOptions = BaseToolOptions & {
|
|
55
|
+
func: (args: Record<string, unknown>) => MaybePromise<unknown>;
|
|
56
|
+
originalTool?: BaseTool | null;
|
|
57
|
+
original_tool?: BaseTool | null;
|
|
58
|
+
};
|
|
59
|
+
export type StructuredToolFromFunctionOptions = Omit<ToolDecoratorOptions, "resultAsAnswer" | "result_as_answer"> & {
|
|
60
|
+
returnDirect?: boolean;
|
|
61
|
+
return_direct?: boolean;
|
|
62
|
+
inferSchema?: boolean;
|
|
63
|
+
infer_schema?: boolean;
|
|
64
|
+
args_schema?: ToolArgsSchema;
|
|
65
|
+
};
|
|
66
|
+
export type EnvVarOptions = {
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
required?: boolean;
|
|
70
|
+
default?: string | null;
|
|
71
|
+
};
|
|
72
|
+
export declare class EnvVar {
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly description: string;
|
|
75
|
+
readonly required: boolean;
|
|
76
|
+
readonly default: string | null;
|
|
77
|
+
constructor(options: EnvVarOptions);
|
|
78
|
+
}
|
|
79
|
+
export type ToolFunction<TArgs extends readonly unknown[] = readonly unknown[]> = (...args: TArgs) => MaybePromise<unknown>;
|
|
80
|
+
export type ToolDecoratorOptions = {
|
|
81
|
+
name?: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
argsSchema?: ToolArgsSchema;
|
|
84
|
+
args_schema?: ToolArgsSchema;
|
|
85
|
+
envVars?: readonly EnvVar[];
|
|
86
|
+
env_vars?: readonly EnvVar[];
|
|
87
|
+
resultAsAnswer?: boolean;
|
|
88
|
+
result_as_answer?: boolean;
|
|
89
|
+
maxUsageCount?: number | null;
|
|
90
|
+
max_usage_count?: number | null;
|
|
91
|
+
cacheFunction?: (args: Record<string, unknown>, result: unknown) => boolean;
|
|
92
|
+
cache?: ToolCache | false;
|
|
93
|
+
};
|
|
94
|
+
export type ToolCalling = {
|
|
95
|
+
toolName: string;
|
|
96
|
+
tool_name?: string;
|
|
97
|
+
arguments?: Record<string, unknown> | null;
|
|
98
|
+
};
|
|
99
|
+
export type ToolCallingOptions = {
|
|
100
|
+
toolName?: string;
|
|
101
|
+
tool_name?: string;
|
|
102
|
+
arguments?: Record<string, unknown> | null;
|
|
103
|
+
};
|
|
104
|
+
export declare const ToolCalling: {
|
|
105
|
+
new (options: ToolCallingOptions): {
|
|
106
|
+
readonly toolName: string;
|
|
107
|
+
readonly tool_name: string;
|
|
108
|
+
readonly arguments: Record<string, unknown> | null;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export declare const InstructorToolCalling: {
|
|
112
|
+
new (options: ToolCallingOptions): {
|
|
113
|
+
readonly toolName: string;
|
|
114
|
+
readonly tool_name: string;
|
|
115
|
+
readonly arguments: Record<string, unknown> | null;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export type InstructorToolCalling = ToolCalling;
|
|
119
|
+
export type ToolCallingLike = {
|
|
120
|
+
toolName?: string;
|
|
121
|
+
tool_name?: string;
|
|
122
|
+
arguments?: Record<string, unknown> | null;
|
|
123
|
+
};
|
|
124
|
+
export type ToolResultOptions = {
|
|
125
|
+
result: unknown;
|
|
126
|
+
resultAsAnswer?: boolean;
|
|
127
|
+
result_as_answer?: boolean;
|
|
128
|
+
};
|
|
129
|
+
export declare class _ArgsSchemaPlaceholder {
|
|
130
|
+
readonly kind = "_ArgsSchemaPlaceholder";
|
|
131
|
+
}
|
|
132
|
+
export declare function _default_cache_function(_args?: unknown, _result?: unknown): boolean;
|
|
133
|
+
export declare function _is_async_callable(func: unknown): boolean;
|
|
134
|
+
export declare function _is_awaitable<T = unknown>(value: T | PromiseLike<T>): value is PromiseLike<T>;
|
|
135
|
+
export declare function _serialize_schema(schema: ToolArgsSchema | null | undefined): ToolArgsSchema | null;
|
|
136
|
+
export declare function _deserialize_schema(value: unknown): ToolArgsSchema | null;
|
|
137
|
+
export declare class ToolResult {
|
|
138
|
+
readonly result: unknown;
|
|
139
|
+
readonly resultAsAnswer: boolean;
|
|
140
|
+
readonly result_as_answer: boolean;
|
|
141
|
+
constructor(options: ToolResultOptions);
|
|
142
|
+
constructor(result: unknown, resultAsAnswer?: boolean);
|
|
143
|
+
}
|
|
144
|
+
export declare function build_schema_hint(argsSchema?: ToolArgsSchema | null): string;
|
|
145
|
+
export declare class ToolUsageLimitExceededError extends Error {
|
|
146
|
+
constructor(message: string);
|
|
147
|
+
}
|
|
148
|
+
export declare class ToolValidationError extends Error {
|
|
149
|
+
constructor(message: string);
|
|
150
|
+
}
|
|
151
|
+
export declare class InMemoryToolCache implements ToolCache {
|
|
152
|
+
private readonly cache;
|
|
153
|
+
read(toolName: string, input: string): ToolCacheReadResult;
|
|
154
|
+
write(toolName: string, input: string, output: unknown): void;
|
|
155
|
+
clear(): void;
|
|
156
|
+
}
|
|
157
|
+
export declare class CacheHandler {
|
|
158
|
+
private readonly cache;
|
|
159
|
+
add(tool: string, input: string, output: unknown): void;
|
|
160
|
+
read(tool: string, input: string): unknown;
|
|
161
|
+
clear(): void;
|
|
162
|
+
asToolCache(): ToolCache;
|
|
163
|
+
}
|
|
164
|
+
export type ToolsHandlerOptions = {
|
|
165
|
+
cache?: CacheHandler | null;
|
|
166
|
+
lastUsedTool?: ToolCallingLike | null;
|
|
167
|
+
last_used_tool?: ToolCallingLike | null;
|
|
168
|
+
};
|
|
169
|
+
export declare class ToolsHandler {
|
|
170
|
+
cache: CacheHandler | null;
|
|
171
|
+
lastUsedTool: ToolCallingLike | null;
|
|
172
|
+
last_used_tool: ToolCallingLike | null;
|
|
173
|
+
constructor(options?: ToolsHandlerOptions);
|
|
174
|
+
onToolUse(calling: ToolCallingLike, output: string, shouldCache?: boolean): void;
|
|
175
|
+
on_tool_use(calling: ToolCallingLike, output: string, should_cache?: boolean): void;
|
|
176
|
+
}
|
|
177
|
+
export declare abstract class BaseTool implements Tool {
|
|
178
|
+
readonly name: string;
|
|
179
|
+
readonly description: string;
|
|
180
|
+
readonly envVars: readonly EnvVar[];
|
|
181
|
+
readonly argsSchema: ToolArgsSchema;
|
|
182
|
+
readonly descriptionUpdated: boolean;
|
|
183
|
+
readonly resultAsAnswer: boolean;
|
|
184
|
+
readonly maxUsageCount: number | null;
|
|
185
|
+
readonly cacheFunction: (args: Record<string, unknown>, result: unknown) => boolean;
|
|
186
|
+
readonly cache: ToolCache | null;
|
|
187
|
+
currentUsageCount: number;
|
|
188
|
+
constructor(options: BaseToolOptions);
|
|
189
|
+
static validateMaxUsageCount(value: number | null): number | null;
|
|
190
|
+
static validate_max_usage_count(value: number | null): number | null;
|
|
191
|
+
static defaultArgsSchema(value: ToolArgsSchema | null | undefined): ToolArgsSchema;
|
|
192
|
+
static _default_args_schema(value: ToolArgsSchema | null | undefined): ToolArgsSchema;
|
|
193
|
+
static fromLangchain(tool: {
|
|
194
|
+
name?: string;
|
|
195
|
+
description?: string;
|
|
196
|
+
func?: (...args: never[]) => MaybePromise<unknown>;
|
|
197
|
+
args_schema?: ToolArgsSchema;
|
|
198
|
+
argsSchema?: ToolArgsSchema;
|
|
199
|
+
}): StructuredTool;
|
|
200
|
+
static from_langchain(tool: {
|
|
201
|
+
name?: string;
|
|
202
|
+
description?: string;
|
|
203
|
+
func?: (...args: never[]) => MaybePromise<unknown>;
|
|
204
|
+
args_schema?: ToolArgsSchema;
|
|
205
|
+
argsSchema?: ToolArgsSchema;
|
|
206
|
+
}): StructuredTool;
|
|
207
|
+
get toolType(): string;
|
|
208
|
+
get tool_type(): string;
|
|
209
|
+
modelPostInit(_context?: unknown): void;
|
|
210
|
+
model_post_init(_context?: unknown): void;
|
|
211
|
+
setArgsSchema(): ToolArgsSchema;
|
|
212
|
+
_set_args_schema(): ToolArgsSchema;
|
|
213
|
+
generateDescription(): string;
|
|
214
|
+
_generate_description(): string;
|
|
215
|
+
serializeArgsSchema(schema?: ToolArgsSchema | null): ToolArgsSchema | null;
|
|
216
|
+
_serialize_args_schema(schema?: ToolArgsSchema | null): ToolArgsSchema | null;
|
|
217
|
+
_claim_usage(): string | null;
|
|
218
|
+
validateKwargs(kwargs: Record<string, unknown>): Record<string, unknown>;
|
|
219
|
+
_validate_kwargs(kwargs: Record<string, unknown>): Record<string, unknown>;
|
|
220
|
+
get env_vars(): readonly EnvVar[];
|
|
221
|
+
get args_schema(): ToolArgsSchema;
|
|
222
|
+
get args(): ToolArgsSchema;
|
|
223
|
+
get description_updated(): boolean;
|
|
224
|
+
get result_as_answer(): boolean;
|
|
225
|
+
get max_usage_count(): number | null;
|
|
226
|
+
get current_usage_count(): number;
|
|
227
|
+
set current_usage_count(value: number);
|
|
228
|
+
get cache_function(): (args: Record<string, unknown>, result: unknown) => boolean;
|
|
229
|
+
run(input?: ToolInvocationInput, hookContext?: ToolHookContextOptions): MaybePromise<unknown>;
|
|
230
|
+
private runWithHooks;
|
|
231
|
+
arun(input?: ToolInvocationInput): Promise<unknown>;
|
|
232
|
+
invoke(input?: ToolInvocationInput, _config?: Record<string, unknown> | null): MaybePromise<unknown>;
|
|
233
|
+
ainvoke(input?: ToolInvocationInput, _config?: Record<string, unknown> | null): Promise<unknown>;
|
|
234
|
+
hasReachedMaxUsageCount(): boolean;
|
|
235
|
+
has_reached_max_usage_count(): boolean;
|
|
236
|
+
resetUsageCount(): void;
|
|
237
|
+
reset_usage_count(): void;
|
|
238
|
+
clearCache(): void;
|
|
239
|
+
clear_cache(): void;
|
|
240
|
+
toStructuredTool(): StructuredTool;
|
|
241
|
+
to_structured_tool(): StructuredTool;
|
|
242
|
+
toLangChain(): StructuredTool;
|
|
243
|
+
to_langchain(): StructuredTool;
|
|
244
|
+
withCache(cache: ToolCache | false): StructuredTool;
|
|
245
|
+
renderDescription(): string;
|
|
246
|
+
protected abstract _run(args: Record<string, unknown>): MaybePromise<unknown>;
|
|
247
|
+
protected _arun(args: Record<string, unknown>): Promise<unknown>;
|
|
248
|
+
protected parseArgs(input: ToolInvocationInput): Record<string, unknown>;
|
|
249
|
+
private claimUsage;
|
|
250
|
+
protected onUsageClaimed(): void;
|
|
251
|
+
private writeCache;
|
|
252
|
+
private emitToolFinished;
|
|
253
|
+
private emitToolError;
|
|
254
|
+
}
|
|
255
|
+
export declare function to_langchain(tool: BaseTool): StructuredTool;
|
|
256
|
+
export declare function to_langchain(tools: (BaseTool | StructuredTool)[]): StructuredTool[];
|
|
257
|
+
export declare class StructuredTool extends BaseTool {
|
|
258
|
+
private readonly func;
|
|
259
|
+
private readonly originalTool;
|
|
260
|
+
constructor(options: StructuredToolOptions);
|
|
261
|
+
static fromFunction(func: ToolFunction, options?: StructuredToolFromFunctionOptions): StructuredTool;
|
|
262
|
+
static fromFunction(func: ToolFunction, name?: string | null, description?: string | null, returnDirect?: boolean, argsSchema?: ToolArgsSchema | null, inferSchema?: boolean): StructuredTool;
|
|
263
|
+
static from_function(func: ToolFunction, options?: StructuredToolFromFunctionOptions): StructuredTool;
|
|
264
|
+
static from_function(func: ToolFunction, name?: string | null, description?: string | null, returnDirect?: boolean, argsSchema?: ToolArgsSchema | null, inferSchema?: boolean): StructuredTool;
|
|
265
|
+
protected _run(args: Record<string, unknown>): MaybePromise<unknown>;
|
|
266
|
+
protected parseArgs(input: ToolInvocationInput): Record<string, unknown>;
|
|
267
|
+
invoke(input?: ToolInvocationInput, _config?: Record<string, unknown> | null): MaybePromise<unknown>;
|
|
268
|
+
ainvoke(input?: ToolInvocationInput, _config?: Record<string, unknown> | null): Promise<unknown>;
|
|
269
|
+
arun(input?: ToolInvocationInput): Promise<unknown>;
|
|
270
|
+
_validate_func(): this;
|
|
271
|
+
static _create_schema_from_function(name: string, func: ToolFunction): ToolArgsSchema;
|
|
272
|
+
_validate_function_signature(): void;
|
|
273
|
+
_parseArgs(input: ToolInvocationInput): Record<string, unknown>;
|
|
274
|
+
_parse_args(input: ToolInvocationInput): Record<string, unknown>;
|
|
275
|
+
_incrementUsageCount(): void;
|
|
276
|
+
_increment_usage_count(): void;
|
|
277
|
+
private callStructuredFunction;
|
|
278
|
+
__repr__(): string;
|
|
279
|
+
toString(): string;
|
|
280
|
+
protected onUsageClaimed(): void;
|
|
281
|
+
}
|
|
282
|
+
export declare const CrewStructuredTool: typeof StructuredTool;
|
|
283
|
+
export type CrewStructuredTool = StructuredTool;
|
|
284
|
+
export declare const AddImageToolSchema: {
|
|
285
|
+
image_url: {
|
|
286
|
+
type: "string";
|
|
287
|
+
required: true;
|
|
288
|
+
description: string;
|
|
289
|
+
};
|
|
290
|
+
action: {
|
|
291
|
+
type: "string";
|
|
292
|
+
required: false;
|
|
293
|
+
description: string;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
export declare class AddImageTool extends BaseTool {
|
|
297
|
+
constructor(options?: Partial<BaseToolOptions>);
|
|
298
|
+
protected _run(args: Record<string, unknown>): Record<string, unknown>;
|
|
299
|
+
}
|
|
300
|
+
export declare const ReadFileToolSchema: {
|
|
301
|
+
file_name: {
|
|
302
|
+
type: "string";
|
|
303
|
+
required: true;
|
|
304
|
+
description: string;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
export declare class ReadFileTool extends BaseTool {
|
|
308
|
+
private files;
|
|
309
|
+
constructor(options?: Partial<BaseToolOptions> & {
|
|
310
|
+
files?: Record<string, {
|
|
311
|
+
read(): Uint8Array | Buffer | string;
|
|
312
|
+
content_type?: string;
|
|
313
|
+
contentType?: string;
|
|
314
|
+
filename?: string | null;
|
|
315
|
+
}> | null;
|
|
316
|
+
});
|
|
317
|
+
setFiles(files: Record<string, {
|
|
318
|
+
read(): Uint8Array | Buffer | string;
|
|
319
|
+
content_type?: string;
|
|
320
|
+
contentType?: string;
|
|
321
|
+
filename?: string | null;
|
|
322
|
+
}> | null): void;
|
|
323
|
+
set_files(files: Record<string, {
|
|
324
|
+
read(): Uint8Array | Buffer | string;
|
|
325
|
+
content_type?: string;
|
|
326
|
+
contentType?: string;
|
|
327
|
+
filename?: string | null;
|
|
328
|
+
}> | null): void;
|
|
329
|
+
protected _run(args: Record<string, unknown>): MaybePromise<string>;
|
|
330
|
+
}
|
|
331
|
+
export declare class BaseAgentTool extends BaseTool {
|
|
332
|
+
readonly agents: readonly AgentLikeForTool[];
|
|
333
|
+
constructor(options?: Partial<BaseToolOptions> & {
|
|
334
|
+
agents?: readonly AgentLikeForTool[];
|
|
335
|
+
});
|
|
336
|
+
sanitizeAgentName(name: string): string;
|
|
337
|
+
sanitize_agent_name(name: string): string;
|
|
338
|
+
static _getCoworker(coworker: unknown, args?: Record<string, unknown>): string | null;
|
|
339
|
+
static _get_coworker(coworker: unknown, args?: Record<string, unknown>): string | null;
|
|
340
|
+
_getCoworker(coworker: unknown, args?: Record<string, unknown>): string | null;
|
|
341
|
+
_get_coworker(coworker: unknown, args?: Record<string, unknown>): string | null;
|
|
342
|
+
protected _execute(agentName: string | null, task: string, context?: string | null): MaybePromise<string>;
|
|
343
|
+
protected _run(args: Record<string, unknown>): MaybePromise<unknown>;
|
|
344
|
+
private formatCoworkers;
|
|
345
|
+
}
|
|
346
|
+
export declare const AskQuestionToolSchema: {
|
|
347
|
+
question: {
|
|
348
|
+
type: "string";
|
|
349
|
+
required: true;
|
|
350
|
+
description: string;
|
|
351
|
+
};
|
|
352
|
+
context: {
|
|
353
|
+
type: "string";
|
|
354
|
+
required: true;
|
|
355
|
+
description: string;
|
|
356
|
+
};
|
|
357
|
+
coworker: {
|
|
358
|
+
type: "string";
|
|
359
|
+
required: true;
|
|
360
|
+
description: string;
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
export declare class AskQuestionTool extends BaseAgentTool {
|
|
364
|
+
constructor(options?: Partial<BaseToolOptions> & {
|
|
365
|
+
agents?: readonly AgentLikeForTool[];
|
|
366
|
+
});
|
|
367
|
+
protected _run(args: Record<string, unknown>): MaybePromise<string>;
|
|
368
|
+
}
|
|
369
|
+
export declare const DelegateWorkToolSchema: {
|
|
370
|
+
task: {
|
|
371
|
+
type: "string";
|
|
372
|
+
required: true;
|
|
373
|
+
description: string;
|
|
374
|
+
};
|
|
375
|
+
context: {
|
|
376
|
+
type: "string";
|
|
377
|
+
required: true;
|
|
378
|
+
description: string;
|
|
379
|
+
};
|
|
380
|
+
coworker: {
|
|
381
|
+
type: "string";
|
|
382
|
+
required: true;
|
|
383
|
+
description: string;
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
export declare class DelegateWorkTool extends BaseAgentTool {
|
|
387
|
+
constructor(options?: Partial<BaseToolOptions> & {
|
|
388
|
+
agents?: readonly AgentLikeForTool[];
|
|
389
|
+
});
|
|
390
|
+
protected _run(args: Record<string, unknown>): MaybePromise<string>;
|
|
391
|
+
}
|
|
392
|
+
export type AgentToolsOptions = {
|
|
393
|
+
agents: readonly AgentLikeForTool[];
|
|
394
|
+
};
|
|
395
|
+
export declare class AgentTools {
|
|
396
|
+
readonly agents: readonly AgentLikeForTool[];
|
|
397
|
+
constructor(agentsOrOptions: readonly AgentLikeForTool[] | AgentToolsOptions);
|
|
398
|
+
tools(): BaseTool[];
|
|
399
|
+
}
|
|
400
|
+
export declare class CacheTools {
|
|
401
|
+
readonly cacheHandler: CacheHandler;
|
|
402
|
+
readonly cache_handler: CacheHandler;
|
|
403
|
+
constructor(cacheHandler?: CacheHandler);
|
|
404
|
+
tool(): StructuredTool;
|
|
405
|
+
hitCache(key: string): unknown;
|
|
406
|
+
hit_cache(key: string): unknown;
|
|
407
|
+
}
|
|
408
|
+
export type MCPNativeToolOptions = {
|
|
409
|
+
clientFactory?: () => unknown;
|
|
410
|
+
client_factory?: () => unknown;
|
|
411
|
+
toolName?: string;
|
|
412
|
+
tool_name?: string;
|
|
413
|
+
toolSchema?: Record<string, unknown>;
|
|
414
|
+
tool_schema?: Record<string, unknown>;
|
|
415
|
+
serverName?: string;
|
|
416
|
+
server_name?: string;
|
|
417
|
+
originalToolName?: string | null;
|
|
418
|
+
original_tool_name?: string | null;
|
|
419
|
+
};
|
|
420
|
+
export declare class MCPNativeTool extends BaseTool {
|
|
421
|
+
private readonly clientFactory;
|
|
422
|
+
private readonly originalToolNameValue;
|
|
423
|
+
private readonly serverNameValue;
|
|
424
|
+
constructor(options: MCPNativeToolOptions);
|
|
425
|
+
constructor(clientFactory: () => unknown, toolName: string, toolSchema: Record<string, unknown>, serverName: string, originalToolName?: string | null);
|
|
426
|
+
get originalToolName(): string;
|
|
427
|
+
get original_tool_name(): string;
|
|
428
|
+
get serverName(): string;
|
|
429
|
+
get server_name(): string;
|
|
430
|
+
protected _run(args: Record<string, unknown>): Promise<string>;
|
|
431
|
+
protected _arun(args: Record<string, unknown>): Promise<string>;
|
|
432
|
+
runAsync(args?: Record<string, unknown>): Promise<string>;
|
|
433
|
+
_run_async(args?: Record<string, unknown>): Promise<string>;
|
|
434
|
+
}
|
|
435
|
+
export type MCPToolWrapperOptions = {
|
|
436
|
+
mcpServerParams?: Record<string, unknown>;
|
|
437
|
+
mcp_server_params?: Record<string, unknown>;
|
|
438
|
+
toolName?: string;
|
|
439
|
+
tool_name?: string;
|
|
440
|
+
toolSchema?: Record<string, unknown>;
|
|
441
|
+
tool_schema?: Record<string, unknown>;
|
|
442
|
+
serverName?: string;
|
|
443
|
+
server_name?: string;
|
|
444
|
+
};
|
|
445
|
+
type MCPWrapperOperation = (args?: Record<string, unknown>) => Promise<string>;
|
|
446
|
+
export declare class MCPToolWrapper extends BaseTool {
|
|
447
|
+
private readonly mcpServerParamsValue;
|
|
448
|
+
private readonly originalToolNameValue;
|
|
449
|
+
private readonly serverNameValue;
|
|
450
|
+
constructor(options: MCPToolWrapperOptions);
|
|
451
|
+
constructor(mcpServerParams: Record<string, unknown>, toolName: string, toolSchema: Record<string, unknown>, serverName: string);
|
|
452
|
+
get mcpServerParams(): Record<string, unknown>;
|
|
453
|
+
get mcp_server_params(): Record<string, unknown>;
|
|
454
|
+
get originalToolName(): string;
|
|
455
|
+
get original_tool_name(): string;
|
|
456
|
+
get serverName(): string;
|
|
457
|
+
get server_name(): string;
|
|
458
|
+
protected _run(args: Record<string, unknown>): Promise<string>;
|
|
459
|
+
protected _arun(args: Record<string, unknown>): Promise<string>;
|
|
460
|
+
runAsync(args?: Record<string, unknown>): Promise<string>;
|
|
461
|
+
_run_async(args?: Record<string, unknown>): Promise<string>;
|
|
462
|
+
_retry_with_exponential_backoff(operationFunc: MCPWrapperOperation, args?: Record<string, unknown>): Promise<string>;
|
|
463
|
+
_execute_single_attempt(operationFunc: MCPWrapperOperation, args?: Record<string, unknown>): Promise<[string | null, string, boolean]>;
|
|
464
|
+
_execute_tool_with_timeout(args?: Record<string, unknown>): Promise<string>;
|
|
465
|
+
_execute_tool(args?: Record<string, unknown>): Promise<string>;
|
|
466
|
+
_do_mcp_call(args?: Record<string, unknown>): Promise<string>;
|
|
467
|
+
}
|
|
468
|
+
export declare class ToolUsageError extends Error {
|
|
469
|
+
constructor(message: string);
|
|
470
|
+
}
|
|
471
|
+
export type ToolUsageOptions = {
|
|
472
|
+
toolsHandler?: ToolsHandler | null;
|
|
473
|
+
tools_handler?: ToolsHandler | null;
|
|
474
|
+
tools?: readonly Tool[];
|
|
475
|
+
task?: unknown;
|
|
476
|
+
functionCallingLlm?: unknown;
|
|
477
|
+
function_calling_llm?: unknown;
|
|
478
|
+
agent?: unknown;
|
|
479
|
+
action?: AgentAction | null;
|
|
480
|
+
fingerprintContext?: Record<string, string> | null;
|
|
481
|
+
fingerprint_context?: Record<string, string> | null;
|
|
482
|
+
};
|
|
483
|
+
export declare class ToolUsage {
|
|
484
|
+
private runAttempts;
|
|
485
|
+
private readonly maxParsingAttempts;
|
|
486
|
+
private readonly rememberFormatAfterUsages;
|
|
487
|
+
readonly toolsHandler: ToolsHandler | null;
|
|
488
|
+
readonly tools_handler: ToolsHandler | null;
|
|
489
|
+
readonly tools: readonly Tool[];
|
|
490
|
+
readonly task: unknown;
|
|
491
|
+
readonly functionCallingLlm: unknown;
|
|
492
|
+
readonly function_calling_llm: unknown;
|
|
493
|
+
readonly agent: unknown;
|
|
494
|
+
readonly action: AgentAction | null;
|
|
495
|
+
readonly fingerprintContext: Record<string, string>;
|
|
496
|
+
readonly fingerprint_context: Record<string, string>;
|
|
497
|
+
constructor(options?: ToolUsageOptions);
|
|
498
|
+
get run_attempts(): number;
|
|
499
|
+
get _run_attempts(): number;
|
|
500
|
+
get _max_parsing_attempts(): number;
|
|
501
|
+
get _remember_format_after_usages(): number;
|
|
502
|
+
parseToolCalling(toolString: string): ToolCalling | ToolUsageError;
|
|
503
|
+
parse_tool_calling(toolString: string): ToolCalling | ToolUsageError;
|
|
504
|
+
use(calling: ToolCalling | ToolUsageError, toolString?: string): Promise<string>;
|
|
505
|
+
ause(calling: ToolCalling | ToolUsageError, toolString?: string): Promise<string>;
|
|
506
|
+
_ause(toolString: string, tool: Tool, calling: ToolCallingLike): Promise<string>;
|
|
507
|
+
_format_result(result: unknown): string;
|
|
508
|
+
_should_remember_format(): boolean;
|
|
509
|
+
_remember_format(result: unknown): string;
|
|
510
|
+
_check_tool_repeated_usage(calling: ToolCallingLike): boolean;
|
|
511
|
+
static _check_usage_limit(tool: unknown, toolName: string): string | null;
|
|
512
|
+
_check_usage_limit(tool: unknown, toolName: string): string | null;
|
|
513
|
+
_select_tool(toolName: string): Tool;
|
|
514
|
+
_render(): string;
|
|
515
|
+
_function_calling(toolString: string): Promise<ToolCalling>;
|
|
516
|
+
_original_tool_calling(_toolString: string, raiseError?: boolean): ToolCalling | ToolUsageError;
|
|
517
|
+
_tool_calling(toolString: string): Promise<ToolCalling | ToolUsageError>;
|
|
518
|
+
_validate_tool_input(toolInput: string | null | undefined): Record<string, unknown>;
|
|
519
|
+
_emit_validate_input_error(finalError: string): void;
|
|
520
|
+
_prepare_event_data(tool: unknown, toolCalling: ToolCallingLike): Record<string, unknown>;
|
|
521
|
+
_build_fingerprint_config(): Record<string, unknown>;
|
|
522
|
+
onToolError(tool: unknown, toolCalling: ToolCallingLike, error: unknown): void;
|
|
523
|
+
on_tool_error(tool: unknown, toolCalling: ToolCallingLike, error: unknown): void;
|
|
524
|
+
onToolUseFinished(tool: unknown, toolCalling: ToolCallingLike, fromCache: boolean, startedAt: number, result: unknown): void;
|
|
525
|
+
on_tool_use_finished(tool: unknown, toolCalling: ToolCallingLike, fromCache: boolean, startedAt: number, result: unknown): void;
|
|
526
|
+
private prepareEventData;
|
|
527
|
+
private toolUsageErrorEventContext;
|
|
528
|
+
}
|
|
529
|
+
export declare function createTool(options: StructuredToolOptions): StructuredTool;
|
|
530
|
+
export declare function functionTool<TArgs extends readonly unknown[]>(func: ToolFunction<TArgs>): StructuredTool;
|
|
531
|
+
export declare function functionTool(name: string, options?: Omit<ToolDecoratorOptions, "name">): <TArgs extends readonly unknown[]>(func: ToolFunction<TArgs>) => StructuredTool;
|
|
532
|
+
export declare function functionTool(options: ToolDecoratorOptions): <TArgs extends readonly unknown[]>(func: ToolFunction<TArgs>) => StructuredTool;
|
|
533
|
+
export declare const create_tool: typeof createTool;
|
|
534
|
+
export declare const createFunctionTool: typeof functionTool;
|
|
535
|
+
export declare const create_function_tool: typeof functionTool;
|
|
536
|
+
export declare function _make_tool<TArgs extends readonly unknown[]>(func: ToolFunction<TArgs>): StructuredTool;
|
|
537
|
+
export declare function _make_with_name(name: string, options?: Omit<ToolDecoratorOptions, "name">): <TArgs extends readonly unknown[]>(func: ToolFunction<TArgs>) => StructuredTool;
|
|
538
|
+
export declare function _resolve_tool_dict(value: Record<string, unknown>): StructuredTool;
|
|
539
|
+
export declare function isToolCalling(value: unknown): value is ToolCalling;
|
|
540
|
+
export declare function normalizeToolCalling(value: unknown): ToolCalling | null;
|
|
541
|
+
export declare function aexecuteToolAndCheckFinality(agentAction: AgentAction, tools: readonly Tool[], options?: {
|
|
542
|
+
agentKey?: string | null;
|
|
543
|
+
agent_key?: string | null;
|
|
544
|
+
agentRole?: string | null;
|
|
545
|
+
agent_role?: string | null;
|
|
546
|
+
toolsHandler?: ToolsHandler | null;
|
|
547
|
+
tools_handler?: ToolsHandler | null;
|
|
548
|
+
task?: unknown;
|
|
549
|
+
agent?: unknown;
|
|
550
|
+
functionCallingLlm?: unknown;
|
|
551
|
+
function_calling_llm?: unknown;
|
|
552
|
+
fingerprintContext?: Record<string, string> | null;
|
|
553
|
+
fingerprint_context?: Record<string, string> | null;
|
|
554
|
+
crew?: unknown;
|
|
555
|
+
}): Promise<ToolResult>;
|
|
556
|
+
export declare const aexecute_tool_and_check_finality: typeof aexecuteToolAndCheckFinality;
|
|
557
|
+
export declare function executeToolAndCheckFinality(agentAction: AgentAction, tools: readonly Tool[], options?: Parameters<typeof aexecuteToolAndCheckFinality>[2]): Promise<ToolResult>;
|
|
558
|
+
export declare const execute_tool_and_check_finality: typeof executeToolAndCheckFinality;
|
|
559
|
+
export declare function renderToolsDescription(tools: readonly Tool[]): string;
|
|
560
|
+
export { sanitizeToolName };
|
|
561
|
+
export declare function normalizeToolInput(input: ToolInvocationInput): Record<string, unknown>;
|
|
562
|
+
export declare function validateArgs(toolName: string, schema: ToolArgsSchema, args: Record<string, unknown>): Record<string, unknown>;
|
|
563
|
+
export declare function buildToolContext(input: string, inputs: InputValues): ToolContext;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export { hasUserDeclinedTracing, has_user_declined_tracing, isTracingEnabled, is_tracing_enabled, updateUserData, update_user_data, } from "./settings.js";
|
|
2
|
+
export type TracingEnabledToken = {
|
|
3
|
+
readonly previous: boolean | null;
|
|
4
|
+
};
|
|
5
|
+
export type SuppressTracingMessagesToken = {
|
|
6
|
+
readonly previous: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type GenericSystemIdOptions = {
|
|
9
|
+
hostname?: () => string;
|
|
10
|
+
username?: () => string;
|
|
11
|
+
machine?: () => string;
|
|
12
|
+
processor?: () => string;
|
|
13
|
+
};
|
|
14
|
+
export type MachineIdOptions = {
|
|
15
|
+
linuxMachineIdPaths?: readonly string[];
|
|
16
|
+
genericSystemId?: () => string | null;
|
|
17
|
+
macAddress?: () => string | null;
|
|
18
|
+
fallbackId?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function setTracingEnabled(enabled: boolean): TracingEnabledToken;
|
|
21
|
+
export declare const set_tracing_enabled: typeof setTracingEnabled;
|
|
22
|
+
export declare function resetTracingEnabled(token: TracingEnabledToken): void;
|
|
23
|
+
export declare const reset_tracing_enabled: typeof resetTracingEnabled;
|
|
24
|
+
export declare function isTracingEnabledInContext(): boolean;
|
|
25
|
+
export declare const is_tracing_enabled_in_context: typeof isTracingEnabledInContext;
|
|
26
|
+
export declare function setSuppressTracingMessages(suppress: boolean): SuppressTracingMessagesToken;
|
|
27
|
+
export declare const set_suppress_tracing_messages: typeof setSuppressTracingMessages;
|
|
28
|
+
export declare function shouldSuppressTracingMessages(): boolean;
|
|
29
|
+
export declare const should_suppress_tracing_messages: typeof shouldSuppressTracingMessages;
|
|
30
|
+
export declare function shouldEnableTracing(options?: {
|
|
31
|
+
override?: boolean | null;
|
|
32
|
+
}): boolean;
|
|
33
|
+
export declare const should_enable_tracing: typeof shouldEnableTracing;
|
|
34
|
+
export declare function onFirstExecutionTracingConfirmation(): boolean;
|
|
35
|
+
export declare const on_first_execution_tracing_confirmation: typeof onFirstExecutionTracingConfirmation;
|
|
36
|
+
export declare function getUserId(): string;
|
|
37
|
+
export declare const get_user_id: typeof getUserId;
|
|
38
|
+
export declare function isFirstExecution(): boolean;
|
|
39
|
+
export declare const is_first_execution: typeof isFirstExecution;
|
|
40
|
+
export declare function markFirstExecutionDone(userConsented?: boolean): void;
|
|
41
|
+
export declare const mark_first_execution_done: typeof markFirstExecutionDone;
|
|
42
|
+
export declare function markFirstExecutionCompleted(userConsented?: boolean): void;
|
|
43
|
+
export declare const mark_first_execution_completed: typeof markFirstExecutionCompleted;
|
|
44
|
+
export declare function safeSerializeToDict(obj: unknown, exclude?: Set<string> | readonly string[] | null): Record<string, unknown>;
|
|
45
|
+
export declare const safe_serialize_to_dict: typeof safeSerializeToDict;
|
|
46
|
+
export declare function truncateMessages<T extends Record<string, unknown>>(messages: readonly T[], maxContentLength?: number, maxMessages?: number): T[];
|
|
47
|
+
export declare const truncate_messages: typeof truncateMessages;
|
|
48
|
+
export declare function shouldAutoCollectFirstTimeTraces(): boolean;
|
|
49
|
+
export declare const should_auto_collect_first_time_traces: typeof shouldAutoCollectFirstTimeTraces;
|
|
50
|
+
export declare function setFirstTimeTraceHook(hook: (() => boolean) | null): void;
|
|
51
|
+
export declare const set_first_time_trace_hook: typeof setFirstTimeTraceHook;
|
|
52
|
+
export declare function promptUserForTraceViewing(timeoutSeconds?: number): boolean;
|
|
53
|
+
export declare const prompt_user_for_trace_viewing: typeof promptUserForTraceViewing;
|
|
54
|
+
export declare function _get_machine_id(options?: MachineIdOptions): string;
|
|
55
|
+
export declare function _get_linux_machine_id(paths?: readonly string[]): string | null;
|
|
56
|
+
export declare function _get_generic_system_id(options?: GenericSystemIdOptions): string | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { LLMMessage } from "./types.js";
|
|
2
|
+
export type TrainingConverterField = {
|
|
3
|
+
description: string;
|
|
4
|
+
type?: "string" | "list" | "float" | "number" | "unknown";
|
|
5
|
+
};
|
|
6
|
+
export type TrainingConverterModel = Record<string, TrainingConverterField>;
|
|
7
|
+
export type TrainingConverterLLM = {
|
|
8
|
+
call(messages: readonly LLMMessage[]): string;
|
|
9
|
+
};
|
|
10
|
+
export type TrainingConverterOptions = {
|
|
11
|
+
llm: TrainingConverterLLM;
|
|
12
|
+
text: string;
|
|
13
|
+
model: TrainingConverterModel;
|
|
14
|
+
instructions?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare class TrainingConverter {
|
|
17
|
+
readonly llm: TrainingConverterLLM;
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly model: TrainingConverterModel;
|
|
20
|
+
readonly instructions: string;
|
|
21
|
+
constructor(options: TrainingConverterOptions);
|
|
22
|
+
toPydantic(): Record<string, unknown>;
|
|
23
|
+
to_pydantic(): Record<string, unknown>;
|
|
24
|
+
convertFieldByField(): Record<string, unknown>;
|
|
25
|
+
_convert_field_by_field(): Record<string, unknown>;
|
|
26
|
+
askLlmForField(fieldName: string, fieldDescription: string): string;
|
|
27
|
+
_ask_llm_for_field(fieldName: string, fieldDescription: string): string;
|
|
28
|
+
processFieldValue(response: string, fieldType?: TrainingConverterField["type"]): unknown;
|
|
29
|
+
_process_field_value(response: string, fieldType?: TrainingConverterField["type"]): unknown;
|
|
30
|
+
parseList(response: string): unknown[];
|
|
31
|
+
_parse_list(response: string): unknown[];
|
|
32
|
+
static parseFloat(response: string): number;
|
|
33
|
+
static _parse_float(response: string): number;
|
|
34
|
+
static stripBullet(item: string): string;
|
|
35
|
+
static _strip_bullet(item: string): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PickleHandler } from "./file-handler.js";
|
|
2
|
+
export type TrainingData = Record<string, unknown>;
|
|
3
|
+
export type TrainingDataStore = Record<string, Record<string, unknown> | TrainingData>;
|
|
4
|
+
export declare class CrewTrainingHandler extends PickleHandler {
|
|
5
|
+
saveTrainedData(agentId: string, trainedData: TrainingData): void;
|
|
6
|
+
save_trained_data(agentId: string, trainedData: TrainingData): void;
|
|
7
|
+
append(trainIteration: number, agentId: string, newData: unknown): void;
|
|
8
|
+
clear(): void;
|
|
9
|
+
private loadTrainingData;
|
|
10
|
+
}
|