@aigne/core 1.72.0-beta.1 → 1.72.0-beta.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.
- package/CHANGELOG.md +31 -0
- package/lib/cjs/agents/chat-model.d.ts +160 -0
- package/lib/cjs/agents/chat-model.js +38 -1
- package/lib/cjs/agents/image-model.d.ts +15 -0
- package/lib/cjs/agents/image-model.js +2 -0
- package/lib/cjs/agents/video-model.d.ts +15 -0
- package/lib/cjs/agents/video-model.js +2 -0
- package/lib/cjs/aigne/usage.d.ts +5 -0
- package/lib/cjs/aigne/usage.js +6 -0
- package/lib/cjs/loader/agent-yaml.d.ts +4 -0
- package/lib/cjs/loader/agent-yaml.js +15 -5
- package/lib/cjs/prompt/context/afs/index.js +1 -2
- package/lib/cjs/prompt/skills/afs/base.d.ts +4 -0
- package/lib/cjs/prompt/skills/afs/base.js +8 -0
- package/lib/cjs/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/delete.js +2 -2
- package/lib/cjs/prompt/skills/afs/edit.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/edit.js +2 -2
- package/lib/cjs/prompt/skills/afs/exec.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/exec.js +7 -4
- package/lib/cjs/prompt/skills/afs/list.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/list.js +6 -13
- package/lib/cjs/prompt/skills/afs/read.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/read.js +2 -2
- package/lib/cjs/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/rename.js +2 -2
- package/lib/cjs/prompt/skills/afs/search.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/search.js +2 -2
- package/lib/cjs/prompt/skills/afs/write.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/write.js +2 -2
- package/lib/cjs/prompt/template.d.ts +82 -7
- package/lib/cjs/prompt/template.js +46 -17
- package/lib/dts/agents/chat-model.d.ts +160 -0
- package/lib/dts/agents/image-model.d.ts +15 -0
- package/lib/dts/agents/video-model.d.ts +15 -0
- package/lib/dts/aigne/usage.d.ts +5 -0
- package/lib/dts/loader/agent-yaml.d.ts +4 -0
- package/lib/dts/prompt/skills/afs/base.d.ts +4 -0
- package/lib/dts/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/edit.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/exec.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/list.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/read.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/search.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/write.d.ts +3 -2
- package/lib/dts/prompt/template.d.ts +82 -7
- package/lib/esm/agents/chat-model.d.ts +160 -0
- package/lib/esm/agents/chat-model.js +37 -0
- package/lib/esm/agents/image-model.d.ts +15 -0
- package/lib/esm/agents/image-model.js +2 -0
- package/lib/esm/agents/video-model.d.ts +15 -0
- package/lib/esm/agents/video-model.js +2 -0
- package/lib/esm/aigne/usage.d.ts +5 -0
- package/lib/esm/aigne/usage.js +6 -0
- package/lib/esm/loader/agent-yaml.d.ts +4 -0
- package/lib/esm/loader/agent-yaml.js +15 -5
- package/lib/esm/prompt/context/afs/index.js +1 -2
- package/lib/esm/prompt/skills/afs/base.d.ts +4 -0
- package/lib/esm/prompt/skills/afs/base.js +4 -0
- package/lib/esm/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/delete.js +2 -2
- package/lib/esm/prompt/skills/afs/edit.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/edit.js +2 -2
- package/lib/esm/prompt/skills/afs/exec.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/exec.js +7 -4
- package/lib/esm/prompt/skills/afs/list.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/list.js +6 -13
- package/lib/esm/prompt/skills/afs/read.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/read.js +2 -2
- package/lib/esm/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/rename.js +2 -2
- package/lib/esm/prompt/skills/afs/search.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/search.js +2 -2
- package/lib/esm/prompt/skills/afs/write.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/write.js +2 -2
- package/lib/esm/prompt/template.d.ts +82 -7
- package/lib/esm/prompt/template.js +46 -17
- package/package.json +5 -5
|
@@ -203,6 +203,13 @@ export interface ChatModelInputMessage {
|
|
|
203
203
|
* Name of the message sender (for multi-agent scenarios)
|
|
204
204
|
*/
|
|
205
205
|
name?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Cache control marker for the entire message (only supported by Claude)
|
|
208
|
+
*
|
|
209
|
+
* This is syntactic sugar that applies cacheControl to the last content block
|
|
210
|
+
* of the message. See {@link CacheControl} for details.
|
|
211
|
+
*/
|
|
212
|
+
cacheControl?: CacheControl;
|
|
206
213
|
}
|
|
207
214
|
/**
|
|
208
215
|
* Type of input message content
|
|
@@ -218,27 +225,64 @@ export type ChatModelInputMessageContent = string | UnionContent[];
|
|
|
218
225
|
export type TextContent = {
|
|
219
226
|
type: "text";
|
|
220
227
|
text: string;
|
|
228
|
+
/**
|
|
229
|
+
* Cache control marker (only supported by Claude)
|
|
230
|
+
*
|
|
231
|
+
* When set, this content block will be marked as a cache breakpoint.
|
|
232
|
+
* See {@link CacheControl} for details.
|
|
233
|
+
*/
|
|
234
|
+
cacheControl?: CacheControl;
|
|
221
235
|
};
|
|
222
236
|
export declare const textContentSchema: z.ZodObject<{
|
|
223
237
|
type: z.ZodLiteral<"text">;
|
|
224
238
|
text: z.ZodString;
|
|
239
|
+
cacheControl: ZodType<{
|
|
240
|
+
type: "ephemeral";
|
|
241
|
+
ttl?: "5m" | "1h" | undefined;
|
|
242
|
+
} | undefined, z.ZodTypeDef, {
|
|
243
|
+
type: "ephemeral";
|
|
244
|
+
ttl?: "5m" | "1h" | undefined;
|
|
245
|
+
} | undefined>;
|
|
225
246
|
}, "strip", z.ZodTypeAny, {
|
|
226
247
|
type: "text";
|
|
227
248
|
text: string;
|
|
249
|
+
cacheControl?: {
|
|
250
|
+
type: "ephemeral";
|
|
251
|
+
ttl?: "5m" | "1h" | undefined;
|
|
252
|
+
} | undefined;
|
|
228
253
|
}, {
|
|
229
254
|
type: "text";
|
|
230
255
|
text: string;
|
|
256
|
+
cacheControl?: {
|
|
257
|
+
type: "ephemeral";
|
|
258
|
+
ttl?: "5m" | "1h" | undefined;
|
|
259
|
+
} | undefined;
|
|
231
260
|
}>;
|
|
232
261
|
export type UnionContent = TextContent | FileUnionContent;
|
|
233
262
|
export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
234
263
|
type: z.ZodLiteral<"text">;
|
|
235
264
|
text: z.ZodString;
|
|
265
|
+
cacheControl: ZodType<{
|
|
266
|
+
type: "ephemeral";
|
|
267
|
+
ttl?: "5m" | "1h" | undefined;
|
|
268
|
+
} | undefined, z.ZodTypeDef, {
|
|
269
|
+
type: "ephemeral";
|
|
270
|
+
ttl?: "5m" | "1h" | undefined;
|
|
271
|
+
} | undefined>;
|
|
236
272
|
}, "strip", z.ZodTypeAny, {
|
|
237
273
|
type: "text";
|
|
238
274
|
text: string;
|
|
275
|
+
cacheControl?: {
|
|
276
|
+
type: "ephemeral";
|
|
277
|
+
ttl?: "5m" | "1h" | undefined;
|
|
278
|
+
} | undefined;
|
|
239
279
|
}, {
|
|
240
280
|
type: "text";
|
|
241
281
|
text: string;
|
|
282
|
+
cacheControl?: {
|
|
283
|
+
type: "ephemeral";
|
|
284
|
+
ttl?: "5m" | "1h" | undefined;
|
|
285
|
+
} | undefined;
|
|
242
286
|
}>, z.ZodObject<{
|
|
243
287
|
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
244
288
|
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
@@ -340,6 +384,14 @@ export interface ChatModelInputTool {
|
|
|
340
384
|
* For example, Gemini's thought_signature
|
|
341
385
|
*/
|
|
342
386
|
metadata?: Record<string, any>;
|
|
387
|
+
/**
|
|
388
|
+
* Cache control marker (only supported by Claude)
|
|
389
|
+
*
|
|
390
|
+
* When set, this tool definition will be marked as a cache breakpoint.
|
|
391
|
+
* Typically applied to the last tool in the tools array.
|
|
392
|
+
* See {@link CacheControl} for details.
|
|
393
|
+
*/
|
|
394
|
+
cacheControl?: CacheControl;
|
|
343
395
|
}
|
|
344
396
|
/**
|
|
345
397
|
* Tool selection strategy
|
|
@@ -362,6 +414,82 @@ export type ChatModelInputToolChoice = "auto" | "none" | "required" | {
|
|
|
362
414
|
};
|
|
363
415
|
};
|
|
364
416
|
export type Modality = "text" | "image" | "audio";
|
|
417
|
+
/**
|
|
418
|
+
* Cache control marker for prompt caching
|
|
419
|
+
*
|
|
420
|
+
* Used to mark content blocks, messages, or tools for caching.
|
|
421
|
+
* Currently only supported by Anthropic (Claude) models.
|
|
422
|
+
*/
|
|
423
|
+
export interface CacheControl {
|
|
424
|
+
/**
|
|
425
|
+
* Cache type (currently only "ephemeral" is supported)
|
|
426
|
+
*/
|
|
427
|
+
type: "ephemeral";
|
|
428
|
+
/**
|
|
429
|
+
* Cache TTL (Time To Live)
|
|
430
|
+
* - "5m": 5 minutes (default)
|
|
431
|
+
* - "1h": 1 hour
|
|
432
|
+
*/
|
|
433
|
+
ttl?: "5m" | "1h";
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Cache configuration options
|
|
437
|
+
*
|
|
438
|
+
* Controls how prompt caching is used for supported providers.
|
|
439
|
+
* Prompt caching can significantly reduce costs and latency by reusing
|
|
440
|
+
* previously processed prompts (system messages, tool definitions, etc.).
|
|
441
|
+
*/
|
|
442
|
+
export interface CacheConfig {
|
|
443
|
+
/**
|
|
444
|
+
* Whether to enable prompt caching
|
|
445
|
+
*
|
|
446
|
+
* - OpenAI: Ignored (always enabled automatically)
|
|
447
|
+
* - Gemini: Controls explicit caching
|
|
448
|
+
* - Claude: Controls whether to add cache_control markers
|
|
449
|
+
*
|
|
450
|
+
* @default true
|
|
451
|
+
*/
|
|
452
|
+
enabled?: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* Cache TTL (Time To Live)
|
|
455
|
+
*
|
|
456
|
+
* - OpenAI: Ignored (automatic)
|
|
457
|
+
* - Gemini: Supports custom seconds
|
|
458
|
+
* - Claude: Only supports "5m" or "1h"
|
|
459
|
+
*
|
|
460
|
+
* @default "5m"
|
|
461
|
+
*/
|
|
462
|
+
ttl?: "5m" | "1h" | number;
|
|
463
|
+
/**
|
|
464
|
+
* Caching strategy
|
|
465
|
+
*
|
|
466
|
+
* - "auto": Automatically add cache breakpoints at optimal locations
|
|
467
|
+
* - "manual": Require explicit cacheControl markers on messages/tools
|
|
468
|
+
*
|
|
469
|
+
* @default "auto"
|
|
470
|
+
*/
|
|
471
|
+
strategy?: "auto" | "manual";
|
|
472
|
+
/**
|
|
473
|
+
* Auto cache breakpoint locations (only effective when strategy="auto")
|
|
474
|
+
*
|
|
475
|
+
* @default { tools: true, system: true, lastMessage: false }
|
|
476
|
+
*/
|
|
477
|
+
autoBreakpoints?: {
|
|
478
|
+
/** Cache tool definitions */
|
|
479
|
+
tools?: boolean;
|
|
480
|
+
/** Cache system messages */
|
|
481
|
+
system?: boolean;
|
|
482
|
+
/** Cache last message in conversation history */
|
|
483
|
+
lastMessage?: boolean;
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Default cache configuration
|
|
488
|
+
*
|
|
489
|
+
* Enables automatic caching for system messages and tool definitions,
|
|
490
|
+
* which typically provides the best cost/performance tradeoff.
|
|
491
|
+
*/
|
|
492
|
+
export declare const DEFAULT_CACHE_CONFIG: CacheConfig;
|
|
365
493
|
/**
|
|
366
494
|
* Model-specific configuration options
|
|
367
495
|
*
|
|
@@ -395,6 +523,15 @@ export interface ChatModelInputOptions extends Record<string, unknown> {
|
|
|
395
523
|
modalities?: Modality[];
|
|
396
524
|
preferInputFileType?: "file" | "url";
|
|
397
525
|
reasoningEffort?: number | "minimal" | "low" | "medium" | "high";
|
|
526
|
+
/**
|
|
527
|
+
* Cache configuration for prompt caching
|
|
528
|
+
*
|
|
529
|
+
* Enables caching of system messages, tool definitions, and conversation history
|
|
530
|
+
* to reduce costs and latency. See {@link CacheConfig} for details.
|
|
531
|
+
*
|
|
532
|
+
* @default DEFAULT_CACHE_CONFIG (enabled with auto strategy)
|
|
533
|
+
*/
|
|
534
|
+
cacheConfig?: CacheConfig;
|
|
398
535
|
}
|
|
399
536
|
export type ChatModelInputOptionsWithGetter = GetterSchema<ChatModelInputOptions>;
|
|
400
537
|
/**
|
|
@@ -492,17 +629,40 @@ export interface ChatModelOutputUsage {
|
|
|
492
629
|
* AIGNE Hub credit usage
|
|
493
630
|
*/
|
|
494
631
|
aigneHubCredits?: number;
|
|
632
|
+
/**
|
|
633
|
+
* Number of tokens written to cache (first time caching)
|
|
634
|
+
* Only applicable for providers that support explicit cache creation (e.g., Anthropic)
|
|
635
|
+
*/
|
|
636
|
+
cacheCreationInputTokens?: number;
|
|
637
|
+
/**
|
|
638
|
+
* Number of tokens read from cache (cache hit)
|
|
639
|
+
* Supported by OpenAI, Anthropic, and Gemini
|
|
640
|
+
*/
|
|
641
|
+
cacheReadInputTokens?: number;
|
|
642
|
+
/**
|
|
643
|
+
* Credit prefix
|
|
644
|
+
*/
|
|
645
|
+
creditPrefix?: "$" | "€" | "¥";
|
|
495
646
|
}
|
|
496
647
|
export declare const chatModelOutputUsageSchema: z.ZodObject<{
|
|
497
648
|
inputTokens: z.ZodNumber;
|
|
498
649
|
outputTokens: z.ZodNumber;
|
|
499
650
|
aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
651
|
+
cacheCreationInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
652
|
+
cacheReadInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
653
|
+
creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
|
|
500
654
|
}, "strip", z.ZodTypeAny, {
|
|
501
655
|
inputTokens: number;
|
|
502
656
|
outputTokens: number;
|
|
503
657
|
aigneHubCredits?: number | undefined;
|
|
658
|
+
cacheCreationInputTokens?: number | undefined;
|
|
659
|
+
cacheReadInputTokens?: number | undefined;
|
|
660
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
504
661
|
}, {
|
|
505
662
|
inputTokens: number;
|
|
506
663
|
outputTokens: number;
|
|
507
664
|
aigneHubCredits?: number | undefined;
|
|
665
|
+
cacheCreationInputTokens?: number | undefined;
|
|
666
|
+
cacheReadInputTokens?: number | undefined;
|
|
667
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
508
668
|
}>;
|
|
@@ -196,14 +196,23 @@ export declare const imageModelOutputSchema: z.ZodObject<{
|
|
|
196
196
|
inputTokens: z.ZodNumber;
|
|
197
197
|
outputTokens: z.ZodNumber;
|
|
198
198
|
aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
199
|
+
cacheCreationInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
200
|
+
cacheReadInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
201
|
+
creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
|
|
199
202
|
}, "strip", z.ZodTypeAny, {
|
|
200
203
|
inputTokens: number;
|
|
201
204
|
outputTokens: number;
|
|
202
205
|
aigneHubCredits?: number | undefined;
|
|
206
|
+
cacheCreationInputTokens?: number | undefined;
|
|
207
|
+
cacheReadInputTokens?: number | undefined;
|
|
208
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
203
209
|
}, {
|
|
204
210
|
inputTokens: number;
|
|
205
211
|
outputTokens: number;
|
|
206
212
|
aigneHubCredits?: number | undefined;
|
|
213
|
+
cacheCreationInputTokens?: number | undefined;
|
|
214
|
+
cacheReadInputTokens?: number | undefined;
|
|
215
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
207
216
|
}>>;
|
|
208
217
|
model: z.ZodOptional<z.ZodString>;
|
|
209
218
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -228,6 +237,9 @@ export declare const imageModelOutputSchema: z.ZodObject<{
|
|
|
228
237
|
inputTokens: number;
|
|
229
238
|
outputTokens: number;
|
|
230
239
|
aigneHubCredits?: number | undefined;
|
|
240
|
+
cacheCreationInputTokens?: number | undefined;
|
|
241
|
+
cacheReadInputTokens?: number | undefined;
|
|
242
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
231
243
|
} | undefined;
|
|
232
244
|
}, {
|
|
233
245
|
images: ({
|
|
@@ -251,5 +263,8 @@ export declare const imageModelOutputSchema: z.ZodObject<{
|
|
|
251
263
|
inputTokens: number;
|
|
252
264
|
outputTokens: number;
|
|
253
265
|
aigneHubCredits?: number | undefined;
|
|
266
|
+
cacheCreationInputTokens?: number | undefined;
|
|
267
|
+
cacheReadInputTokens?: number | undefined;
|
|
268
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
254
269
|
} | undefined;
|
|
255
270
|
}>;
|
|
@@ -203,14 +203,23 @@ export declare const videoModelOutputSchema: z.ZodObject<{
|
|
|
203
203
|
inputTokens: z.ZodNumber;
|
|
204
204
|
outputTokens: z.ZodNumber;
|
|
205
205
|
aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
206
|
+
cacheCreationInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
207
|
+
cacheReadInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
208
|
+
creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
|
|
206
209
|
}, "strip", z.ZodTypeAny, {
|
|
207
210
|
inputTokens: number;
|
|
208
211
|
outputTokens: number;
|
|
209
212
|
aigneHubCredits?: number | undefined;
|
|
213
|
+
cacheCreationInputTokens?: number | undefined;
|
|
214
|
+
cacheReadInputTokens?: number | undefined;
|
|
215
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
210
216
|
}, {
|
|
211
217
|
inputTokens: number;
|
|
212
218
|
outputTokens: number;
|
|
213
219
|
aigneHubCredits?: number | undefined;
|
|
220
|
+
cacheCreationInputTokens?: number | undefined;
|
|
221
|
+
cacheReadInputTokens?: number | undefined;
|
|
222
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
214
223
|
}>>;
|
|
215
224
|
model: z.ZodOptional<z.ZodString>;
|
|
216
225
|
seconds: z.ZodOptional<z.ZodNumber>;
|
|
@@ -236,6 +245,9 @@ export declare const videoModelOutputSchema: z.ZodObject<{
|
|
|
236
245
|
inputTokens: number;
|
|
237
246
|
outputTokens: number;
|
|
238
247
|
aigneHubCredits?: number | undefined;
|
|
248
|
+
cacheCreationInputTokens?: number | undefined;
|
|
249
|
+
cacheReadInputTokens?: number | undefined;
|
|
250
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
239
251
|
} | undefined;
|
|
240
252
|
seconds?: number | undefined;
|
|
241
253
|
}, {
|
|
@@ -260,6 +272,9 @@ export declare const videoModelOutputSchema: z.ZodObject<{
|
|
|
260
272
|
inputTokens: number;
|
|
261
273
|
outputTokens: number;
|
|
262
274
|
aigneHubCredits?: number | undefined;
|
|
275
|
+
cacheCreationInputTokens?: number | undefined;
|
|
276
|
+
cacheReadInputTokens?: number | undefined;
|
|
277
|
+
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
263
278
|
} | undefined;
|
|
264
279
|
seconds?: number | undefined;
|
|
265
280
|
}>;
|
package/lib/dts/aigne/usage.d.ts
CHANGED
|
@@ -5,8 +5,13 @@ export interface ContextUsage {
|
|
|
5
5
|
inputTokens: number;
|
|
6
6
|
outputTokens: number;
|
|
7
7
|
aigneHubCredits: number;
|
|
8
|
+
creditPrefix?: "$" | "€" | "¥";
|
|
8
9
|
agentCalls: number;
|
|
9
10
|
duration: number;
|
|
11
|
+
/** Number of tokens written to cache (first time caching) */
|
|
12
|
+
cacheCreationInputTokens: number;
|
|
13
|
+
/** Number of tokens read from cache (cache hit) */
|
|
14
|
+
cacheReadInputTokens: number;
|
|
10
15
|
}
|
|
11
16
|
/**
|
|
12
17
|
* @hidden
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
|
|
2
|
+
import { AFSSkillBase } from "./base.js";
|
|
2
3
|
export interface AFSDeleteInput extends Message {
|
|
3
4
|
path: string;
|
|
4
5
|
recursive?: boolean;
|
|
@@ -12,7 +13,7 @@ export interface AFSDeleteOutput extends Message {
|
|
|
12
13
|
export interface AFSDeleteAgentOptions extends AgentOptions<AFSDeleteInput, AFSDeleteOutput> {
|
|
13
14
|
afs: NonNullable<AgentOptions<AFSDeleteInput, AFSDeleteOutput>["afs"]>;
|
|
14
15
|
}
|
|
15
|
-
export declare class AFSDeleteAgent extends
|
|
16
|
+
export declare class AFSDeleteAgent extends AFSSkillBase<AFSDeleteInput, AFSDeleteOutput> {
|
|
16
17
|
constructor(options: AFSDeleteAgentOptions);
|
|
17
18
|
process(input: AFSDeleteInput, _options: AgentInvokeOptions): Promise<AFSDeleteOutput>;
|
|
18
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
|
|
2
|
+
import { AFSSkillBase } from "./base.js";
|
|
2
3
|
export interface Patch {
|
|
3
4
|
start_line: number;
|
|
4
5
|
end_line: number;
|
|
@@ -19,7 +20,7 @@ export interface AFSEditOutput extends Message {
|
|
|
19
20
|
export interface AFSEditAgentOptions extends AgentOptions<AFSEditInput, AFSEditOutput> {
|
|
20
21
|
afs: NonNullable<AgentOptions<AFSEditInput, AFSEditOutput>["afs"]>;
|
|
21
22
|
}
|
|
22
|
-
export declare class AFSEditAgent extends
|
|
23
|
+
export declare class AFSEditAgent extends AFSSkillBase<AFSEditInput, AFSEditOutput> {
|
|
23
24
|
constructor(options: AFSEditAgentOptions);
|
|
24
25
|
process(input: AFSEditInput, _options: AgentInvokeOptions): Promise<AFSEditOutput>;
|
|
25
26
|
applyCustomPatches(text: string, patches: Patch[]): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
|
|
2
|
+
import { AFSSkillBase } from "./base.js";
|
|
2
3
|
export interface AFSExecInput extends Message {
|
|
3
4
|
path: string;
|
|
4
5
|
args: string;
|
|
@@ -9,7 +10,7 @@ export interface AFSExecOutput extends Message {
|
|
|
9
10
|
export interface AFSExecAgentOptions extends AgentOptions<AFSExecInput, AFSExecOutput> {
|
|
10
11
|
afs: NonNullable<AgentOptions<AFSExecInput, AFSExecOutput>["afs"]>;
|
|
11
12
|
}
|
|
12
|
-
export declare class AFSExecAgent extends
|
|
13
|
+
export declare class AFSExecAgent extends AFSSkillBase<AFSExecInput, AFSExecOutput> {
|
|
13
14
|
constructor(options: AFSExecAgentOptions);
|
|
14
15
|
process(input: AFSExecInput, options: AgentInvokeOptions): Promise<AFSExecOutput>;
|
|
15
16
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AFSListOptions } from "@aigne/afs";
|
|
2
|
-
import {
|
|
2
|
+
import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
|
|
3
|
+
import { AFSSkillBase } from "./base.js";
|
|
3
4
|
export interface AFSListInput extends Message {
|
|
4
5
|
path: string;
|
|
5
6
|
options?: AFSListOptions;
|
|
@@ -15,7 +16,7 @@ export interface AFSListOutput extends Message {
|
|
|
15
16
|
export interface AFSListAgentOptions extends AgentOptions<AFSListInput, AFSListOutput> {
|
|
16
17
|
afs: NonNullable<AgentOptions<AFSListInput, AFSListOutput>["afs"]>;
|
|
17
18
|
}
|
|
18
|
-
export declare class AFSListAgent extends
|
|
19
|
+
export declare class AFSListAgent extends AFSSkillBase<AFSListInput, AFSListOutput> {
|
|
19
20
|
constructor(options: AFSListAgentOptions);
|
|
20
21
|
process(input: AFSListInput, _options: AgentInvokeOptions): Promise<AFSListOutput>;
|
|
21
22
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AFSEntry } from "@aigne/afs";
|
|
2
|
-
import {
|
|
2
|
+
import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
|
|
3
|
+
import { AFSSkillBase } from "./base.js";
|
|
3
4
|
export interface AFSReadInput extends Message {
|
|
4
5
|
path: string;
|
|
5
6
|
withLineNumbers?: boolean;
|
|
@@ -15,7 +16,7 @@ export interface AFSReadOutput extends Message {
|
|
|
15
16
|
export interface AFSReadAgentOptions extends AgentOptions<AFSReadInput, AFSReadOutput> {
|
|
16
17
|
afs: NonNullable<AgentOptions<AFSReadInput, AFSReadOutput>["afs"]>;
|
|
17
18
|
}
|
|
18
|
-
export declare class AFSReadAgent extends
|
|
19
|
+
export declare class AFSReadAgent extends AFSSkillBase<AFSReadInput, AFSReadOutput> {
|
|
19
20
|
constructor(options: AFSReadAgentOptions);
|
|
20
21
|
process(input: AFSReadInput, _options: AgentInvokeOptions): Promise<AFSReadOutput>;
|
|
21
22
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
|
|
2
|
+
import { AFSSkillBase } from "./base.js";
|
|
2
3
|
export interface AFSRenameInput extends Message {
|
|
3
4
|
oldPath: string;
|
|
4
5
|
newPath: string;
|
|
@@ -14,7 +15,7 @@ export interface AFSRenameOutput extends Message {
|
|
|
14
15
|
export interface AFSRenameAgentOptions extends AgentOptions<AFSRenameInput, AFSRenameOutput> {
|
|
15
16
|
afs: NonNullable<AgentOptions<AFSRenameInput, AFSRenameOutput>["afs"]>;
|
|
16
17
|
}
|
|
17
|
-
export declare class AFSRenameAgent extends
|
|
18
|
+
export declare class AFSRenameAgent extends AFSSkillBase<AFSRenameInput, AFSRenameOutput> {
|
|
18
19
|
constructor(options: AFSRenameAgentOptions);
|
|
19
20
|
process(input: AFSRenameInput, _options: AgentInvokeOptions): Promise<AFSRenameOutput>;
|
|
20
21
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AFSEntry, AFSSearchOptions } from "@aigne/afs";
|
|
2
|
-
import {
|
|
2
|
+
import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
|
|
3
|
+
import { AFSSkillBase } from "./base.js";
|
|
3
4
|
export interface AFSSearchInput extends Message {
|
|
4
5
|
path: string;
|
|
5
6
|
query: string;
|
|
@@ -17,7 +18,7 @@ export interface AFSSearchOutput extends Message {
|
|
|
17
18
|
export interface AFSSearchAgentOptions extends AgentOptions<AFSSearchInput, AFSSearchOutput> {
|
|
18
19
|
afs: NonNullable<AgentOptions<AFSSearchInput, AFSSearchOutput>["afs"]>;
|
|
19
20
|
}
|
|
20
|
-
export declare class AFSSearchAgent extends
|
|
21
|
+
export declare class AFSSearchAgent extends AFSSkillBase<AFSSearchInput, AFSSearchOutput> {
|
|
21
22
|
constructor(options: AFSSearchAgentOptions);
|
|
22
23
|
process(input: AFSSearchInput, _options: AgentInvokeOptions): Promise<AFSSearchOutput>;
|
|
23
24
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AgentInvokeOptions, AgentOptions, Message } from "../../../agents/agent.js";
|
|
2
|
+
import { AFSSkillBase } from "./base.js";
|
|
2
3
|
export interface AFSWriteInput extends Message {
|
|
3
4
|
path: string;
|
|
4
5
|
content: string;
|
|
@@ -13,7 +14,7 @@ export interface AFSWriteOutput extends Message {
|
|
|
13
14
|
export interface AFSWriteAgentOptions extends AgentOptions<AFSWriteInput, AFSWriteOutput> {
|
|
14
15
|
afs: NonNullable<AgentOptions<AFSWriteInput, AFSWriteOutput>["afs"]>;
|
|
15
16
|
}
|
|
16
|
-
export declare class AFSWriteAgent extends
|
|
17
|
+
export declare class AFSWriteAgent extends AFSSkillBase<AFSWriteInput, AFSWriteOutput> {
|
|
17
18
|
constructor(options: AFSWriteAgentOptions);
|
|
18
19
|
process(input: AFSWriteInput, _options: AgentInvokeOptions): Promise<AFSWriteOutput>;
|
|
19
20
|
}
|
|
@@ -27,35 +27,38 @@ export declare class ChatMessageTemplate {
|
|
|
27
27
|
content?: ChatModelInputMessage["content"];
|
|
28
28
|
name?: string | undefined;
|
|
29
29
|
options?: FormatOptions | undefined;
|
|
30
|
-
|
|
30
|
+
cacheControl?: ChatModelInputMessage["cacheControl"];
|
|
31
|
+
constructor(role: "system" | "user" | "agent" | "tool", content?: ChatModelInputMessage["content"], name?: string | undefined, options?: FormatOptions | undefined, cacheControl?: ChatModelInputMessage["cacheControl"]);
|
|
31
32
|
format(variables?: Record<string, unknown>, options?: FormatOptions): Promise<ChatModelInputMessage>;
|
|
32
33
|
}
|
|
33
34
|
export declare class SystemMessageTemplate extends ChatMessageTemplate {
|
|
34
|
-
static from(content: string, name?: string, options?: FormatOptions): SystemMessageTemplate;
|
|
35
|
+
static from(content: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): SystemMessageTemplate;
|
|
35
36
|
}
|
|
36
37
|
export declare class UserMessageTemplate extends ChatMessageTemplate {
|
|
37
|
-
static from(template: ChatModelInputMessageContent, name?: string, options?: FormatOptions): UserMessageTemplate;
|
|
38
|
+
static from(template: ChatModelInputMessageContent, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): UserMessageTemplate;
|
|
38
39
|
}
|
|
39
40
|
export declare class AgentMessageTemplate extends ChatMessageTemplate {
|
|
40
41
|
toolCalls?: ChatModelOutputToolCall[] | undefined;
|
|
41
|
-
static from(template?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[], name?: string, options?: FormatOptions): AgentMessageTemplate;
|
|
42
|
-
constructor(content?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[] | undefined, name?: string, options?: FormatOptions);
|
|
42
|
+
static from(template?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[], name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): AgentMessageTemplate;
|
|
43
|
+
constructor(content?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[] | undefined, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]);
|
|
43
44
|
format(_variables?: Record<string, unknown>, _options?: FormatOptions): Promise<{
|
|
44
45
|
role: "agent" | "system" | "user" | "tool";
|
|
45
46
|
name: string | undefined;
|
|
46
47
|
content: ChatModelInputMessageContent | undefined;
|
|
47
48
|
toolCalls: ChatModelOutputToolCall[] | undefined;
|
|
49
|
+
cacheControl: import("../agents/chat-model.js").CacheControl | undefined;
|
|
48
50
|
}>;
|
|
49
51
|
}
|
|
50
52
|
export declare class ToolMessageTemplate extends ChatMessageTemplate {
|
|
51
53
|
toolCallId: string;
|
|
52
|
-
static from(content: object | string, toolCallId: string, name?: string, options?: FormatOptions): ToolMessageTemplate;
|
|
53
|
-
constructor(content: object | string, toolCallId: string, name?: string, options?: FormatOptions);
|
|
54
|
+
static from(content: object | string, toolCallId: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): ToolMessageTemplate;
|
|
55
|
+
constructor(content: object | string, toolCallId: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]);
|
|
54
56
|
format(_variables?: Record<string, unknown>, _options?: FormatOptions): Promise<{
|
|
55
57
|
role: "agent" | "system" | "user" | "tool";
|
|
56
58
|
name: string | undefined;
|
|
57
59
|
content: ChatModelInputMessageContent | undefined;
|
|
58
60
|
toolCallId: string;
|
|
61
|
+
cacheControl: import("../agents/chat-model.js").CacheControl | undefined;
|
|
59
62
|
}>;
|
|
60
63
|
}
|
|
61
64
|
export declare class ChatMessagesTemplate {
|
|
@@ -69,26 +72,62 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
69
72
|
role: z.ZodLiteral<"system">;
|
|
70
73
|
content: z.ZodString;
|
|
71
74
|
name: z.ZodOptional<z.ZodString>;
|
|
75
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
77
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
type: "ephemeral";
|
|
80
|
+
ttl?: "5m" | "1h" | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
type: "ephemeral";
|
|
83
|
+
ttl?: "5m" | "1h" | undefined;
|
|
84
|
+
}>>;
|
|
72
85
|
}, "strip", z.ZodTypeAny, {
|
|
73
86
|
role: "system";
|
|
74
87
|
content: string;
|
|
75
88
|
name?: string | undefined;
|
|
89
|
+
cacheControl?: {
|
|
90
|
+
type: "ephemeral";
|
|
91
|
+
ttl?: "5m" | "1h" | undefined;
|
|
92
|
+
} | undefined;
|
|
76
93
|
}, {
|
|
77
94
|
role: "system";
|
|
78
95
|
content: string;
|
|
79
96
|
name?: string | undefined;
|
|
97
|
+
cacheControl?: {
|
|
98
|
+
type: "ephemeral";
|
|
99
|
+
ttl?: "5m" | "1h" | undefined;
|
|
100
|
+
} | undefined;
|
|
80
101
|
}>, z.ZodObject<{
|
|
81
102
|
role: z.ZodLiteral<"user">;
|
|
82
103
|
content: z.ZodString;
|
|
83
104
|
name: z.ZodOptional<z.ZodString>;
|
|
105
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
107
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
type: "ephemeral";
|
|
110
|
+
ttl?: "5m" | "1h" | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
type: "ephemeral";
|
|
113
|
+
ttl?: "5m" | "1h" | undefined;
|
|
114
|
+
}>>;
|
|
84
115
|
}, "strip", z.ZodTypeAny, {
|
|
85
116
|
role: "user";
|
|
86
117
|
content: string;
|
|
87
118
|
name?: string | undefined;
|
|
119
|
+
cacheControl?: {
|
|
120
|
+
type: "ephemeral";
|
|
121
|
+
ttl?: "5m" | "1h" | undefined;
|
|
122
|
+
} | undefined;
|
|
88
123
|
}, {
|
|
89
124
|
role: "user";
|
|
90
125
|
content: string;
|
|
91
126
|
name?: string | undefined;
|
|
127
|
+
cacheControl?: {
|
|
128
|
+
type: "ephemeral";
|
|
129
|
+
ttl?: "5m" | "1h" | undefined;
|
|
130
|
+
} | undefined;
|
|
92
131
|
}>, z.ZodObject<{
|
|
93
132
|
role: z.ZodLiteral<"agent">;
|
|
94
133
|
content: z.ZodOptional<z.ZodString>;
|
|
@@ -121,6 +160,16 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
121
160
|
id: string;
|
|
122
161
|
}>, "many">>;
|
|
123
162
|
name: z.ZodOptional<z.ZodString>;
|
|
163
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
165
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
type: "ephemeral";
|
|
168
|
+
ttl?: "5m" | "1h" | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
type: "ephemeral";
|
|
171
|
+
ttl?: "5m" | "1h" | undefined;
|
|
172
|
+
}>>;
|
|
124
173
|
}, "strip", z.ZodTypeAny, {
|
|
125
174
|
role: "agent";
|
|
126
175
|
name?: string | undefined;
|
|
@@ -133,6 +182,10 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
133
182
|
type: "function";
|
|
134
183
|
id: string;
|
|
135
184
|
}[] | undefined;
|
|
185
|
+
cacheControl?: {
|
|
186
|
+
type: "ephemeral";
|
|
187
|
+
ttl?: "5m" | "1h" | undefined;
|
|
188
|
+
} | undefined;
|
|
136
189
|
}, {
|
|
137
190
|
role: "agent";
|
|
138
191
|
name?: string | undefined;
|
|
@@ -145,21 +198,43 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
145
198
|
type: "function";
|
|
146
199
|
id: string;
|
|
147
200
|
}[] | undefined;
|
|
201
|
+
cacheControl?: {
|
|
202
|
+
type: "ephemeral";
|
|
203
|
+
ttl?: "5m" | "1h" | undefined;
|
|
204
|
+
} | undefined;
|
|
148
205
|
}>, z.ZodObject<{
|
|
149
206
|
role: z.ZodLiteral<"tool">;
|
|
150
207
|
content: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, string, string | Record<string, unknown>>;
|
|
151
208
|
toolCallId: z.ZodString;
|
|
152
209
|
name: z.ZodOptional<z.ZodString>;
|
|
210
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
211
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
212
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
type: "ephemeral";
|
|
215
|
+
ttl?: "5m" | "1h" | undefined;
|
|
216
|
+
}, {
|
|
217
|
+
type: "ephemeral";
|
|
218
|
+
ttl?: "5m" | "1h" | undefined;
|
|
219
|
+
}>>;
|
|
153
220
|
}, "strip", z.ZodTypeAny, {
|
|
154
221
|
role: "tool";
|
|
155
222
|
content: string;
|
|
156
223
|
toolCallId: string;
|
|
157
224
|
name?: string | undefined;
|
|
225
|
+
cacheControl?: {
|
|
226
|
+
type: "ephemeral";
|
|
227
|
+
ttl?: "5m" | "1h" | undefined;
|
|
228
|
+
} | undefined;
|
|
158
229
|
}, {
|
|
159
230
|
role: "tool";
|
|
160
231
|
content: string | Record<string, unknown>;
|
|
161
232
|
toolCallId: string;
|
|
162
233
|
name?: string | undefined;
|
|
234
|
+
cacheControl?: {
|
|
235
|
+
type: "ephemeral";
|
|
236
|
+
ttl?: "5m" | "1h" | undefined;
|
|
237
|
+
} | undefined;
|
|
163
238
|
}>]>;
|
|
164
239
|
export declare function safeParseChatMessages(messages: unknown): ChatMessageTemplate[] | undefined;
|
|
165
240
|
export declare function parseChatMessages(messages: (z.infer<typeof chatMessageSchema> & {
|