@swifty.js/swifty 0.0.29 → 0.0.30
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/README.md +11 -11
- package/dist/{agent-YR6YK26C.js → agent-TCNIRVHD.js} +1 -1
- package/dist/anthropic-7RIVSEDF.js +4 -0
- package/dist/{checker-N5TIJEN5.js → checker-3LHDOATB.js} +1 -1
- package/dist/chunk-2IBMB3ZM.js +150 -0
- package/dist/chunk-AQ3A5CF4.js +5 -0
- package/dist/chunk-FA26MQ7K.js +257 -0
- package/dist/chunk-TKADLB2Q.js +4 -0
- package/dist/chunk-VA64DJNN.js +4 -0
- package/dist/lib/{agent-5WEKVRTD.js → agent-IRY7KR5D.js} +2 -2
- package/dist/lib/{anthropic-KWO3KLNV.js → anthropic-CL5IK7KN.js} +2 -2
- package/dist/lib/{checker-AXHPKVBY.js → checker-BS4MK3O6.js} +1 -1
- package/dist/lib/{chunk-2IVEVG5N.js → chunk-7QPDFSQE.js} +10 -17
- package/dist/lib/{chunk-3FBS5NB7.js → chunk-I7OPU4K2.js} +27 -11
- package/dist/lib/{chunk-KZSBR4FO.js → chunk-IYPTOY3Y.js} +48 -21
- package/dist/lib/{chunk-GCY44T7S.js → chunk-OOSNCCI7.js} +129 -254
- package/dist/lib/{chunk-Z4CYHTII.js → chunk-OQIQOU5S.js} +85 -26
- package/dist/lib/{chunk-DJ6AILPN.js → chunk-RMB3J46W.js} +13 -16
- package/dist/lib/index.d.ts +325 -123
- package/dist/lib/index.js +791 -1078
- package/dist/lib/{openai-PBF7EWNJ.js → openai-LH4E7ZQS.js} +2 -2
- package/dist/lib/{tool-filter-R6HDDJHE.js → tool-filter-CS6W2GMU.js} +1 -1
- package/dist/main.js +186 -178
- package/dist/{openai-QQ2K7GPF.js → openai-RZLCY55V.js} +15 -15
- package/dist/{server-G23HCFLI.js → server-IVIRQTO7.js} +17 -17
- package/dist/{tool-filter-VBP6WOGO.js → tool-filter-CG3KGQQW.js} +1 -1
- package/package.json +4 -3
- package/dist/anthropic-5GRR5JCT.js +0 -4
- package/dist/chunk-D34FUVGU.js +0 -4
- package/dist/chunk-LIMEBKCY.js +0 -408
- package/dist/chunk-POHIQUFP.js +0 -301
- package/dist/chunk-TMEX7RFA.js +0 -4
- package/dist/chunk-Y6SQB5FG.js +0 -4
- package/dist/glob.wasm +0 -0
- package/dist/lib/glob.wasm +0 -0
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Anthropic from '@anthropic-ai/sdk';
|
|
2
2
|
import z$1, { z } from 'zod';
|
|
3
3
|
import OpenAI from 'openai';
|
|
4
|
+
import { ChatCompletionFunctionTool } from 'openai/resources/chat/completions';
|
|
4
5
|
import { FunctionTool } from 'openai/resources/responses/responses';
|
|
5
6
|
import { Logger } from 'pino';
|
|
6
7
|
import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
@@ -99,13 +100,12 @@ declare function evaluateRules(rules: Rule[], toolName: string, content: string)
|
|
|
99
100
|
declare class RuleEngine {
|
|
100
101
|
private userPath;
|
|
101
102
|
private projectPath;
|
|
102
|
-
private localPath;
|
|
103
103
|
private cache;
|
|
104
104
|
constructor(workDir: string);
|
|
105
105
|
private rulesFor;
|
|
106
106
|
snapshot(): Rule[];
|
|
107
107
|
evaluate(toolName: string, content: string): RuleEffect | null;
|
|
108
|
-
|
|
108
|
+
appendProjectRule(rule: Rule): void;
|
|
109
109
|
}
|
|
110
110
|
declare function isSafeCommand(command: string): boolean;
|
|
111
111
|
declare class PermissionChecker {
|
|
@@ -296,6 +296,7 @@ interface ToolSchema {
|
|
|
296
296
|
type: "object";
|
|
297
297
|
properties: Record<string, object>;
|
|
298
298
|
required?: string[];
|
|
299
|
+
[keyword: string]: unknown;
|
|
299
300
|
};
|
|
300
301
|
allowed_callers?: ("direct" | "code_execution_20250825" | "code_execution_20260120")[];
|
|
301
302
|
cache_control?: {
|
|
@@ -454,6 +455,22 @@ declare function globalConfigPath(): string;
|
|
|
454
455
|
*/
|
|
455
456
|
declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
456
457
|
type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
458
|
+
declare const ReasoningEffortSchema: z.ZodEnum<{
|
|
459
|
+
minimal: "minimal";
|
|
460
|
+
low: "low";
|
|
461
|
+
medium: "medium";
|
|
462
|
+
high: "high";
|
|
463
|
+
xhigh: "xhigh";
|
|
464
|
+
max: "max";
|
|
465
|
+
none: "none";
|
|
466
|
+
}>;
|
|
467
|
+
declare const AnthropicEffortSchema: z.ZodEnum<{
|
|
468
|
+
low: "low";
|
|
469
|
+
medium: "medium";
|
|
470
|
+
high: "high";
|
|
471
|
+
xhigh: "xhigh";
|
|
472
|
+
max: "max";
|
|
473
|
+
}>;
|
|
457
474
|
declare const ProviderConfigSchema: z.ZodObject<{
|
|
458
475
|
name: z.ZodString;
|
|
459
476
|
protocol: z.ZodEnum<{
|
|
@@ -464,7 +481,7 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
464
481
|
base_url: z.ZodString;
|
|
465
482
|
model: z.ZodString;
|
|
466
483
|
api_key: z.ZodOptional<z.ZodString>;
|
|
467
|
-
thinking: z.ZodOptional<z.
|
|
484
|
+
thinking: z.ZodOptional<z.ZodEnum<{
|
|
468
485
|
off: "off";
|
|
469
486
|
minimal: "minimal";
|
|
470
487
|
low: "low";
|
|
@@ -472,10 +489,72 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
472
489
|
high: "high";
|
|
473
490
|
xhigh: "xhigh";
|
|
474
491
|
max: "max";
|
|
475
|
-
}
|
|
492
|
+
}>>;
|
|
493
|
+
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
494
|
+
thinking_level_map: z.ZodOptional<z.ZodObject<{
|
|
495
|
+
off: z.ZodOptional<z.ZodNullable<z.ZodLiteral<"none">>>;
|
|
496
|
+
minimal: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
497
|
+
minimal: "minimal";
|
|
498
|
+
low: "low";
|
|
499
|
+
medium: "medium";
|
|
500
|
+
high: "high";
|
|
501
|
+
xhigh: "xhigh";
|
|
502
|
+
max: "max";
|
|
503
|
+
none: "none";
|
|
504
|
+
}>>>;
|
|
505
|
+
low: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
506
|
+
minimal: "minimal";
|
|
507
|
+
low: "low";
|
|
508
|
+
medium: "medium";
|
|
509
|
+
high: "high";
|
|
510
|
+
xhigh: "xhigh";
|
|
511
|
+
max: "max";
|
|
512
|
+
none: "none";
|
|
513
|
+
}>>>;
|
|
514
|
+
medium: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
515
|
+
minimal: "minimal";
|
|
516
|
+
low: "low";
|
|
517
|
+
medium: "medium";
|
|
518
|
+
high: "high";
|
|
519
|
+
xhigh: "xhigh";
|
|
520
|
+
max: "max";
|
|
521
|
+
none: "none";
|
|
522
|
+
}>>>;
|
|
523
|
+
high: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
524
|
+
minimal: "minimal";
|
|
525
|
+
low: "low";
|
|
526
|
+
medium: "medium";
|
|
527
|
+
high: "high";
|
|
528
|
+
xhigh: "xhigh";
|
|
529
|
+
max: "max";
|
|
530
|
+
none: "none";
|
|
531
|
+
}>>>;
|
|
532
|
+
xhigh: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
533
|
+
minimal: "minimal";
|
|
534
|
+
low: "low";
|
|
535
|
+
medium: "medium";
|
|
536
|
+
high: "high";
|
|
537
|
+
xhigh: "xhigh";
|
|
538
|
+
max: "max";
|
|
539
|
+
none: "none";
|
|
540
|
+
}>>>;
|
|
541
|
+
max: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
542
|
+
minimal: "minimal";
|
|
543
|
+
low: "low";
|
|
544
|
+
medium: "medium";
|
|
545
|
+
high: "high";
|
|
546
|
+
xhigh: "xhigh";
|
|
547
|
+
max: "max";
|
|
548
|
+
none: "none";
|
|
549
|
+
}>>>;
|
|
550
|
+
}, z.core.$strict>>;
|
|
551
|
+
thinking_mode: z.ZodOptional<z.ZodEnum<{
|
|
552
|
+
budget: "budget";
|
|
553
|
+
adaptive: "adaptive";
|
|
554
|
+
}>>;
|
|
476
555
|
context_window: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
477
556
|
max_output_tokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
478
|
-
}, z.core.$
|
|
557
|
+
}, z.core.$loose>;
|
|
479
558
|
type ProviderConfig = z.infer<typeof ProviderConfigSchema>;
|
|
480
559
|
declare const DEFAULT_THINKING_LEVEL: ThinkingLevel;
|
|
481
560
|
declare const DEFAULT_CONTEXT_WINDOW = 1000000;
|
|
@@ -490,20 +569,21 @@ declare const DEFAULT_MAX_OUTPUT_TOKENS = 128000;
|
|
|
490
569
|
* room after the thinking budget is reserved.
|
|
491
570
|
*/
|
|
492
571
|
declare const THINKING_BUDGETS: Record<Exclude<ThinkingLevel, "off">, number>;
|
|
572
|
+
declare const MIN_THINKING_BUDGET_TOKENS = 1024;
|
|
573
|
+
declare const MIN_THINKING_ANSWER_TOKENS = 1024;
|
|
493
574
|
declare function isValidThinkingLevel(value: string): value is ThinkingLevel;
|
|
494
|
-
/**
|
|
495
|
-
* Default thinking level per protocol. Anthropic historically enabled extended
|
|
496
|
-
* thinking by default; the OpenAI protocols never sent a reasoning parameter
|
|
497
|
-
* before, and non-reasoning models reject `reasoning_effort`, so they only opt
|
|
498
|
-
* in when `thinking` is configured explicitly.
|
|
499
|
-
*/
|
|
500
|
-
declare function defaultThinkingLevelFor(protocol: ProviderConfig["protocol"]): ThinkingLevel;
|
|
501
|
-
/** Normalize the config `thinking` field (level or legacy boolean) to a level. */
|
|
575
|
+
/** Resolve the effective logical level, including explicit capability limits. */
|
|
502
576
|
declare function getThinkingLevel(provider: ProviderConfig): ThinkingLevel;
|
|
503
577
|
/** Thinking token budget for a level; 0 when thinking is off. */
|
|
504
578
|
declare function thinkingBudgetForLevel(level: ThinkingLevel): number;
|
|
505
|
-
/** Map a
|
|
506
|
-
declare function toReasoningEffort(level: ThinkingLevel):
|
|
579
|
+
/** Map a logical level using configured capabilities, not model-name guesses. */
|
|
580
|
+
declare function toReasoningEffort(level: ThinkingLevel, provider?: ProviderConfig): z.infer<typeof ReasoningEffortSchema> | null;
|
|
581
|
+
/** Narrow adaptive efforts to the Anthropic SDK's legal values. */
|
|
582
|
+
declare function toAnthropicThinkingEffort(level: ThinkingLevel, provider: ProviderConfig): z.infer<typeof AnthropicEffortSchema> | null;
|
|
583
|
+
/** Available logical levels; missing metadata preserves the existing defaults. */
|
|
584
|
+
declare function getSupportedThinkingLevels(provider: ProviderConfig): readonly ThinkingLevel[];
|
|
585
|
+
/** Lower unsupported requests to the nearest available level, never higher. */
|
|
586
|
+
declare function clampThinkingLevel(provider: ProviderConfig, level: ThinkingLevel): ThinkingLevel;
|
|
507
587
|
declare function withProviderDefaults(provider: ProviderConfig): ProviderConfig;
|
|
508
588
|
declare function getContextWindow(provider: ProviderConfig): number;
|
|
509
589
|
/**
|
|
@@ -558,7 +638,7 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
558
638
|
base_url: z.ZodString;
|
|
559
639
|
model: z.ZodString;
|
|
560
640
|
api_key: z.ZodOptional<z.ZodString>;
|
|
561
|
-
thinking: z.ZodOptional<z.
|
|
641
|
+
thinking: z.ZodOptional<z.ZodEnum<{
|
|
562
642
|
off: "off";
|
|
563
643
|
minimal: "minimal";
|
|
564
644
|
low: "low";
|
|
@@ -566,10 +646,72 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
566
646
|
high: "high";
|
|
567
647
|
xhigh: "xhigh";
|
|
568
648
|
max: "max";
|
|
569
|
-
}
|
|
649
|
+
}>>;
|
|
650
|
+
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
651
|
+
thinking_level_map: z.ZodOptional<z.ZodObject<{
|
|
652
|
+
off: z.ZodOptional<z.ZodNullable<z.ZodLiteral<"none">>>;
|
|
653
|
+
minimal: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
654
|
+
minimal: "minimal";
|
|
655
|
+
low: "low";
|
|
656
|
+
medium: "medium";
|
|
657
|
+
high: "high";
|
|
658
|
+
xhigh: "xhigh";
|
|
659
|
+
max: "max";
|
|
660
|
+
none: "none";
|
|
661
|
+
}>>>;
|
|
662
|
+
low: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
663
|
+
minimal: "minimal";
|
|
664
|
+
low: "low";
|
|
665
|
+
medium: "medium";
|
|
666
|
+
high: "high";
|
|
667
|
+
xhigh: "xhigh";
|
|
668
|
+
max: "max";
|
|
669
|
+
none: "none";
|
|
670
|
+
}>>>;
|
|
671
|
+
medium: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
672
|
+
minimal: "minimal";
|
|
673
|
+
low: "low";
|
|
674
|
+
medium: "medium";
|
|
675
|
+
high: "high";
|
|
676
|
+
xhigh: "xhigh";
|
|
677
|
+
max: "max";
|
|
678
|
+
none: "none";
|
|
679
|
+
}>>>;
|
|
680
|
+
high: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
681
|
+
minimal: "minimal";
|
|
682
|
+
low: "low";
|
|
683
|
+
medium: "medium";
|
|
684
|
+
high: "high";
|
|
685
|
+
xhigh: "xhigh";
|
|
686
|
+
max: "max";
|
|
687
|
+
none: "none";
|
|
688
|
+
}>>>;
|
|
689
|
+
xhigh: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
690
|
+
minimal: "minimal";
|
|
691
|
+
low: "low";
|
|
692
|
+
medium: "medium";
|
|
693
|
+
high: "high";
|
|
694
|
+
xhigh: "xhigh";
|
|
695
|
+
max: "max";
|
|
696
|
+
none: "none";
|
|
697
|
+
}>>>;
|
|
698
|
+
max: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
699
|
+
minimal: "minimal";
|
|
700
|
+
low: "low";
|
|
701
|
+
medium: "medium";
|
|
702
|
+
high: "high";
|
|
703
|
+
xhigh: "xhigh";
|
|
704
|
+
max: "max";
|
|
705
|
+
none: "none";
|
|
706
|
+
}>>>;
|
|
707
|
+
}, z.core.$strict>>;
|
|
708
|
+
thinking_mode: z.ZodOptional<z.ZodEnum<{
|
|
709
|
+
budget: "budget";
|
|
710
|
+
adaptive: "adaptive";
|
|
711
|
+
}>>;
|
|
570
712
|
context_window: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
571
713
|
max_output_tokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
572
|
-
}, z.core.$
|
|
714
|
+
}, z.core.$loose>>;
|
|
573
715
|
permission_mode: z.ZodOptional<z.ZodString>;
|
|
574
716
|
mcp_servers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
575
717
|
name: z.ZodString;
|
|
@@ -751,12 +893,14 @@ declare class OpenAIClient implements LLMClient {
|
|
|
751
893
|
private systemPrompt;
|
|
752
894
|
private maxOutputTokens;
|
|
753
895
|
private thinkingLevel;
|
|
896
|
+
private config;
|
|
754
897
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
755
898
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
756
899
|
setSystemPrompt(prompt: string): void;
|
|
757
900
|
setMaxOutputTokens(maxTokens: number): void;
|
|
758
|
-
setThinkingLevel(level: ThinkingLevel):
|
|
901
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
759
902
|
getThinkingLevel(): ThinkingLevel;
|
|
903
|
+
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
760
904
|
}
|
|
761
905
|
type OpenAIMessageParam = OpenAI.Responses.EasyInputMessage | OpenAI.Responses.ResponseFunctionToolCall | OpenAI.Responses.ResponseInputItem.FunctionCallOutput | OpenAI.Responses.ResponseReasoningItem;
|
|
762
906
|
declare function buildOpenAIInput(messages: Message[]): OpenAIMessageParam[];
|
|
@@ -766,11 +910,13 @@ declare class OpenAICompatClient implements LLMClient {
|
|
|
766
910
|
private systemPrompt;
|
|
767
911
|
private maxOutputTokens;
|
|
768
912
|
private thinkingLevel;
|
|
913
|
+
private config;
|
|
769
914
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
770
915
|
setSystemPrompt(prompt: string): void;
|
|
771
916
|
setMaxOutputTokens(maxTokens: number): void;
|
|
772
|
-
setThinkingLevel(level: ThinkingLevel):
|
|
917
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
773
918
|
getThinkingLevel(): ThinkingLevel;
|
|
919
|
+
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
774
920
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
775
921
|
}
|
|
776
922
|
declare function buildChatCompletionMessages(messages: Message[]): OpenAI.ChatCompletionMessageParam[];
|
|
@@ -807,7 +953,7 @@ declare function buildChatCompletionMessages(messages: Message[]): OpenAI.ChatCo
|
|
|
807
953
|
* built-in tools, so the array tail is often a deferred tool — we must scan
|
|
808
954
|
* backwards. Built-in tools are never deferred, so a valid slot always exists.
|
|
809
955
|
*/
|
|
810
|
-
declare function markToolsForCache(tools:
|
|
956
|
+
declare function markToolsForCache(tools: Pick<Anthropic.Tool, "defer_loading" | "cache_control">[]): void;
|
|
811
957
|
/**
|
|
812
958
|
* Whether any tool in this batch has defer_loading set.
|
|
813
959
|
*
|
|
@@ -821,18 +967,17 @@ declare function buildAnthropicMessages(messages: Message[]): Anthropic.MessageP
|
|
|
821
967
|
declare class AnthropicClient implements LLMClient {
|
|
822
968
|
private client;
|
|
823
969
|
private model;
|
|
824
|
-
/**
|
|
825
|
-
* PI-equivalent thinking level; maps to a thinking token budget.
|
|
826
|
-
*/
|
|
970
|
+
/** Effective logical level for budget or explicitly configured adaptive mode. */
|
|
827
971
|
private thinkingLevel;
|
|
828
972
|
private systemPrompt;
|
|
829
973
|
private maxOutputTokens;
|
|
830
|
-
|
|
974
|
+
private config;
|
|
831
975
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
832
976
|
setSystemPrompt(prompt: string): void;
|
|
833
977
|
setMaxOutputTokens(maxTokens: number): void;
|
|
834
|
-
setThinkingLevel(level: ThinkingLevel):
|
|
978
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
835
979
|
getThinkingLevel(): ThinkingLevel;
|
|
980
|
+
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
836
981
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
837
982
|
}
|
|
838
983
|
/**
|
|
@@ -847,10 +992,12 @@ interface LLMClient extends Partial<MaxTokensSetter>, Partial<ThinkingLevelContr
|
|
|
847
992
|
interface MaxTokensSetter {
|
|
848
993
|
setMaxOutputTokens(maxTokens: number): void;
|
|
849
994
|
}
|
|
850
|
-
/** Runtime control of the
|
|
995
|
+
/** Runtime control of the effective logical thinking level. */
|
|
851
996
|
interface ThinkingLevelControl {
|
|
852
|
-
|
|
997
|
+
/** Built-in clients return the effective level; legacy controls may return void. */
|
|
998
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel | void;
|
|
853
999
|
getThinkingLevel(): ThinkingLevel;
|
|
1000
|
+
getSupportedThinkingLevels?(): readonly ThinkingLevel[];
|
|
854
1001
|
}
|
|
855
1002
|
declare function createClient(config: ProviderConfig, systemPrompt: string): Promise<AnthropicClient | OpenAIClient | OpenAICompatClient>;
|
|
856
1003
|
|
|
@@ -988,8 +1135,9 @@ declare class ToolRegistry {
|
|
|
988
1135
|
register(tool: Tool): void;
|
|
989
1136
|
get(name: string): Tool | undefined;
|
|
990
1137
|
listTools(): Tool[];
|
|
991
|
-
getAllSchemas(protocol?: "anthropic"):
|
|
992
|
-
getAllSchemas(protocol: "openai"
|
|
1138
|
+
getAllSchemas(protocol?: "anthropic"): ToolSchema[];
|
|
1139
|
+
getAllSchemas(protocol: "openai"): FunctionTool[];
|
|
1140
|
+
getAllSchemas(protocol: "openai-compat"): ChatCompletionFunctionTool[];
|
|
993
1141
|
/**
|
|
994
1142
|
* Names of deferred tools not yet discovered, in lexicographic order.
|
|
995
1143
|
*
|
|
@@ -1394,8 +1542,10 @@ interface CommandContext {
|
|
|
1394
1542
|
memoryClear?: () => void;
|
|
1395
1543
|
/** Returns the current model name */
|
|
1396
1544
|
model?: string;
|
|
1397
|
-
/** Returns the current thinking level */
|
|
1545
|
+
/** Returns the current effective thinking level */
|
|
1398
1546
|
thinkingLevel?: () => ThinkingLevel;
|
|
1547
|
+
/** Returns the active client's available logical thinking levels */
|
|
1548
|
+
availableThinkingLevels?: () => readonly ThinkingLevel[];
|
|
1399
1549
|
/** Sets the thinking level for the active client */
|
|
1400
1550
|
setThinkingLevel?: (level: ThinkingLevel) => void;
|
|
1401
1551
|
/** Persists the thinking level to the global config; throws on failure */
|
|
@@ -2203,7 +2353,7 @@ declare function estimateTokens(conv: ConversationManager): number;
|
|
|
2203
2353
|
declare function computeKeepStartIndex(messages: Message[]): number;
|
|
2204
2354
|
declare function currentContextTokens(conv: ConversationManager, anchor?: UsageAnchor): number;
|
|
2205
2355
|
declare function manageContext(conv: ConversationManager, client: LLMClient, contextWindow: number, maxOutput: number, trackingState: AutoCompactTrackingState, recoveryState: RecoveryState | null, toolSchemaNames: string[], toolSchemas: ToolSchema[], sessionFilePath?: string, abortSignal?: AbortSignal): Promise<CompactResult>;
|
|
2206
|
-
declare function forceCompact(conv: ConversationManager, client: LLMClient, recoveryState: RecoveryState | null, toolSchemaNames: string[], toolSchemas: ToolSchema[], sessionFilePath?: string, abortSignal?: AbortSignal): Promise<CompactResult>;
|
|
2356
|
+
declare function forceCompact(conv: ConversationManager, client: LLMClient, recoveryState: RecoveryState | null, toolSchemaNames: string[], toolSchemas: ToolSchema[], sessionFilePath?: string, abortSignal?: AbortSignal, customInstructions?: string): Promise<CompactResult>;
|
|
2207
2357
|
|
|
2208
2358
|
/**
|
|
2209
2359
|
* Copyright (c) 2026 hangtiancheng
|
|
@@ -2296,6 +2446,27 @@ declare const MAX_HISTORY_ENTRIES = 200;
|
|
|
2296
2446
|
declare function load(dir: string): string[];
|
|
2297
2447
|
declare function append(dir: string, text: string): string[];
|
|
2298
2448
|
|
|
2449
|
+
/**
|
|
2450
|
+
* Copyright (c) 2026 hangtiancheng
|
|
2451
|
+
*
|
|
2452
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2453
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
2454
|
+
* in the Software without restriction, including without limitation the rights
|
|
2455
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2456
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
2457
|
+
* furnished to do so, subject to the following conditions:
|
|
2458
|
+
*
|
|
2459
|
+
* The above copyright notice and this permission notice shall be included in
|
|
2460
|
+
* all copies or substantial portions of the Software.
|
|
2461
|
+
*
|
|
2462
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2463
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2464
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2465
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2466
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2467
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2468
|
+
* SOFTWARE.
|
|
2469
|
+
*/
|
|
2299
2470
|
type SaveClipboardImageResult = {
|
|
2300
2471
|
ok: true;
|
|
2301
2472
|
value: string;
|
|
@@ -2985,6 +3156,27 @@ declare function parsePrintFlags(args: string[]): PrintArgs | null;
|
|
|
2985
3156
|
*/
|
|
2986
3157
|
declare function runPrintMode(args: PrintArgs): Promise<void>;
|
|
2987
3158
|
|
|
3159
|
+
/**
|
|
3160
|
+
* Copyright (c) 2026 hangtiancheng
|
|
3161
|
+
*
|
|
3162
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3163
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
3164
|
+
* in the Software without restriction, including without limitation the rights
|
|
3165
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3166
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
3167
|
+
* furnished to do so, subject to the following conditions:
|
|
3168
|
+
*
|
|
3169
|
+
* The above copyright notice and this permission notice shall be included in
|
|
3170
|
+
* all copies or substantial portions of the Software.
|
|
3171
|
+
*
|
|
3172
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3173
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3174
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3175
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3176
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3177
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3178
|
+
* SOFTWARE.
|
|
3179
|
+
*/
|
|
2988
3180
|
/**
|
|
2989
3181
|
* Appends a timestamped entry to the crash log.
|
|
2990
3182
|
* Write failures are silently ignored so diagnostics never crash the process.
|
|
@@ -3143,11 +3335,8 @@ declare function parseSkillFile(content: string): {
|
|
|
3143
3335
|
body: string;
|
|
3144
3336
|
frontmatter: Record<string, unknown>;
|
|
3145
3337
|
} | null;
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
* descriptions are included; the full SOP is fetched on demand via LoadSkill.
|
|
3149
|
-
* Returns an empty string when the catalog is empty so callers can skip this section.
|
|
3150
|
-
*/
|
|
3338
|
+
declare function escapeSkillXml(text: string): string;
|
|
3339
|
+
/** Metadata-only conversation reminder; bodies load on demand without changing the system prefix. */
|
|
3151
3340
|
declare function buildSkillSection(catalog: SkillCatalog, workDir: string): string;
|
|
3152
3341
|
|
|
3153
3342
|
/**
|
|
@@ -3490,19 +3679,7 @@ declare function buildSystemPrompt(env: EnvironmentContext): string;
|
|
|
3490
3679
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3491
3680
|
* SOFTWARE.
|
|
3492
3681
|
*/
|
|
3493
|
-
/**
|
|
3494
|
-
* Returns the coordinator-mode orchestration guidance, injected as a system-reminder each turn.
|
|
3495
|
-
* The first turn sends the full text; subsequent turns send the condensed version: this guidance
|
|
3496
|
-
* is just over 8 KB, and system-reminders are appended incrementally — re-sending the full text
|
|
3497
|
-
* every turn would fill back up the context window that this mode is designed to save.
|
|
3498
|
-
*
|
|
3499
|
-
* There are two reasons this is not made a system-prompt paragraph: first, the model drifts in
|
|
3500
|
-
* long conversations — the system prompt appears only once at the beginning, and by turn twenty
|
|
3501
|
-
* those hard constraints are long buried; appending once per turn is what pulls them back.
|
|
3502
|
-
* Second, the system prompt belongs to the cached prefix — modifying it invalidates billing for
|
|
3503
|
-
* all subsequent content, whereas a system-reminder is a plain message appended at the end of
|
|
3504
|
-
* the conversation.
|
|
3505
|
-
*/
|
|
3682
|
+
/** Periodic conversation reminders preserve guidance without changing the cached system prefix. */
|
|
3506
3683
|
declare function coordinatorReminder(iteration?: number): string;
|
|
3507
3684
|
|
|
3508
3685
|
/**
|
|
@@ -3676,13 +3853,15 @@ declare class SeatbeltSandbox implements Sandbox {
|
|
|
3676
3853
|
* SOFTWARE.
|
|
3677
3854
|
*/
|
|
3678
3855
|
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3856
|
+
declare function parseSkillPrompt(prompt: string): {
|
|
3857
|
+
name: string;
|
|
3858
|
+
directory: string;
|
|
3859
|
+
body: string;
|
|
3860
|
+
args: string;
|
|
3861
|
+
} | undefined;
|
|
3862
|
+
/** Activate once through the host so its existing skill cache and permissions remain authoritative. */
|
|
3682
3863
|
declare function runInline(skill: Skill, args: string, host: SkillHost): string;
|
|
3683
|
-
/**
|
|
3684
|
-
* Runs a skill in fork mode: executes it in an isolated subagent.
|
|
3685
|
-
*/
|
|
3864
|
+
/** Runs a skill in an isolated subagent and returns its result unchanged. */
|
|
3686
3865
|
declare function runFork(skill: Skill, args: string, host: SkillForkHost): Promise<string>;
|
|
3687
3866
|
|
|
3688
3867
|
/**
|
|
@@ -4503,13 +4682,13 @@ declare class BashTool implements Tool {
|
|
|
4503
4682
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4504
4683
|
* SOFTWARE.
|
|
4505
4684
|
*/
|
|
4506
|
-
declare const BASH_DESCRIPTION = "
|
|
4507
|
-
declare const POWERSHELL_DESCRIPTION = "
|
|
4508
|
-
declare const READ_FILE_DESCRIPTION = "
|
|
4509
|
-
declare const EDIT_FILE_DESCRIPTION = "
|
|
4510
|
-
declare const WRITE_FILE_DESCRIPTION = "
|
|
4511
|
-
declare const GLOB_DESCRIPTION = "
|
|
4512
|
-
declare const GREP_DESCRIPTION = "
|
|
4685
|
+
declare const BASH_DESCRIPTION = "Execute command in Bash; return stdout and stderr. Prefer PowerShell on Windows.\n- timeout is in seconds: default 120, maximum 600. Each call starts a fresh, independent shell in the Agent's working directory; cd, variables, functions, and options do not persist.\n- Quote paths with spaces. To change directory, use cd \"path\" && command in the same call. Separate independent commands; chain dependent commands with &&, not ;.\n- Prefer dedicated file/search tools over cat, head, tail, sed, awk, echo, or find. Scope searches to a directory, never the filesystem root. Diagnose failures rather than retrying in sleep loops.\nGit: commit or push only when requested. Destructive operations (push --force, reset --hard, checkout ., clean -f, branch -D), amending, or skipping hooks/signing require explicit authorization; never bypass permission/hook denials. Prefer new commits. When committing, include Co-Authored-By: Swifty <usr161043261@outlook.com>.";
|
|
4686
|
+
declare const POWERSHELL_DESCRIPTION = "Execute command in PowerShell; return stdout and stderr. Recommended on Windows (powershell.exe); uses pwsh elsewhere.\n- timeout is in seconds: default 120, maximum 600. Each call starts a fresh, independent shell in the Agent's working directory; location, variables, and options do not persist.\n- Quote paths with spaces; use Set-Location -LiteralPath \"path\" in the same call. Separate independent commands. For dependencies, check $LASTEXITCODE for native commands and use -ErrorAction Stop for cmdlets; ; does not stop on failure. Do not assume PowerShell 7 syntax.\n- Prefer dedicated file/search tools over Get-Content, Select-String, or Write-Output. Scope recursion to a directory, not a drive root. Diagnose failures rather than retrying in Start-Sleep loops.\nGit: commit or push only when requested. Destructive operations (push --force, reset --hard, checkout ., clean -f, branch -D), amending, or skipping hooks/signing require explicit authorization; never bypass permission/hook denials. Prefer new commits. When committing, include Co-Authored-By: Swifty <usr161043261@outlook.com>.";
|
|
4687
|
+
declare const READ_FILE_DESCRIPTION = "Read text with 1-based display line numbers, or images (png, jpg, jpeg, gif, webp) as visual content; not directories.\n- file_path is absolute or relative to the Agent's working directory. offset skips lines (0-based, default 0); limit defaults to 2000 lines, with a 50KB text output cap. Displayed line 101 starts at offset=100. Follow continuation/readback instructions for partial output.\n- Images ignore offset/limit. A successful read refreshes the file-state cache used by EditFile/WriteFile; re-read after an external-change error.";
|
|
4688
|
+
declare const EDIT_FILE_DESCRIPTION = "Replace exact text in an existing file and return a diff. Prefer this over whole-file rewrites.\n- file_path is absolute or relative to the Agent's working directory. ReadFile is required first; stale file-state errors require a fresh read and revised edit.\n- old_string must be non-empty and unique unless replace_all=true (default false). Use enough context to disambiguate; preserve whitespace and exclude display line numbers.\n- new_string must differ from old_string; an empty string deletes the match.";
|
|
4689
|
+
declare const WRITE_FILE_DESCRIPTION = "Write complete UTF-8 content to file_path, creating parent directories and overwriting existing content. Use for new files or complete rewrites; prefer EditFile for targeted changes.\n- file_path is absolute or relative to the Agent's working directory. Existing files require ReadFile first; re-read if the cached state is stale.\n- content includes any desired trailing newline; an empty string creates or truncates an empty file. Avoid unrelated files or unsolicited documentation.";
|
|
4690
|
+
declare const GLOB_DESCRIPTION = "Find files by glob pattern (e.g. \"**/*.ts\", \"*.{ts,tsx}\"). Return paths relative to path, sorted newest modification first.\n- path is absolute or relative to the Agent's working directory (default \".\"); never search the filesystem root.\n- Includes dotfiles; traversal skips fixed directories such as .git, .agents, .swifty, node_modules, dist, and __pycache__, not rules from .gitignore.\n- At most 1000 matches; narrow limited searches rather than treating them as exhaustive. Prefer this over shell find/ls.";
|
|
4691
|
+
declare const GREP_DESCRIPTION = "Search file content with a case-insensitive, line-by-line JavaScript-style regex pattern; return file:line:content with 1-based lines and working-directory-relative paths.\n- path is a file or directory, absolute or relative to the Agent's working directory (default \".\"). Escape regex backslashes in JSON. No multiline matching or general PCRE support.\n- include is an optional glob: \"*.ts\" matches names at any depth; patterns with \"/\" match working-directory-relative paths. A direct file path is searched without this filter.\n- Traversal includes dotfiles but skips fixed directories such as .git, .agents, .swifty, node_modules, dist, and __pycache__, not .gitignore rules. Binary/unreadable files are skipped; directory symlinks are not traversed.\n- At most 500 matching lines. Narrow searches; never search the filesystem root. Use ReadFile for context and this tool instead of shell grep/rg.";
|
|
4513
4692
|
|
|
4514
4693
|
/**
|
|
4515
4694
|
* Copyright (c) 2026 hangtiancheng
|
|
@@ -4671,6 +4850,66 @@ declare class ExitWorktreeTool implements Tool {
|
|
|
4671
4850
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4672
4851
|
}
|
|
4673
4852
|
|
|
4853
|
+
/**
|
|
4854
|
+
* Copyright (c) 2026 hangtiancheng
|
|
4855
|
+
*
|
|
4856
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4857
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
4858
|
+
* in the Software without restriction, including without limitation the rights
|
|
4859
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4860
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
4861
|
+
* furnished to do so, subject to the following conditions:
|
|
4862
|
+
*
|
|
4863
|
+
* The above copyright notice and this permission notice shall be included in
|
|
4864
|
+
* all copies or substantial portions of the Software.
|
|
4865
|
+
*
|
|
4866
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4867
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4868
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4869
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4870
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4871
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4872
|
+
* SOFTWARE.
|
|
4873
|
+
*/
|
|
4874
|
+
|
|
4875
|
+
declare class GlobTool implements Tool {
|
|
4876
|
+
name: string;
|
|
4877
|
+
description: string;
|
|
4878
|
+
category: ToolCategory;
|
|
4879
|
+
schema(): ToolSchema;
|
|
4880
|
+
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4883
|
+
/**
|
|
4884
|
+
* Copyright (c) 2026 hangtiancheng
|
|
4885
|
+
*
|
|
4886
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4887
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
4888
|
+
* in the Software without restriction, including without limitation the rights
|
|
4889
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4890
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
4891
|
+
* furnished to do so, subject to the following conditions:
|
|
4892
|
+
*
|
|
4893
|
+
* The above copyright notice and this permission notice shall be included in
|
|
4894
|
+
* all copies or substantial portions of the Software.
|
|
4895
|
+
*
|
|
4896
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4897
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4898
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4899
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4900
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4901
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4902
|
+
* SOFTWARE.
|
|
4903
|
+
*/
|
|
4904
|
+
|
|
4905
|
+
declare class GrepTool implements Tool {
|
|
4906
|
+
name: string;
|
|
4907
|
+
description: string;
|
|
4908
|
+
category: ToolCategory;
|
|
4909
|
+
schema(): ToolSchema;
|
|
4910
|
+
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4911
|
+
}
|
|
4912
|
+
|
|
4674
4913
|
/**
|
|
4675
4914
|
* Copyright (c) 2026 hangtiancheng
|
|
4676
4915
|
*
|
|
@@ -4770,14 +5009,6 @@ declare class McpCallTool implements Tool {
|
|
|
4770
5009
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4771
5010
|
}
|
|
4772
5011
|
|
|
4773
|
-
declare class PowerShellTool implements Tool {
|
|
4774
|
-
name: string;
|
|
4775
|
-
description: string;
|
|
4776
|
-
category: ToolCategory;
|
|
4777
|
-
schema(): ToolSchema;
|
|
4778
|
-
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4779
|
-
}
|
|
4780
|
-
|
|
4781
5012
|
/**
|
|
4782
5013
|
* Copyright (c) 2026 hangtiancheng
|
|
4783
5014
|
*
|
|
@@ -4800,13 +5031,12 @@ declare class PowerShellTool implements Tool {
|
|
|
4800
5031
|
* SOFTWARE.
|
|
4801
5032
|
*/
|
|
4802
5033
|
|
|
4803
|
-
declare class
|
|
5034
|
+
declare class PowerShellTool implements Tool {
|
|
4804
5035
|
name: string;
|
|
4805
5036
|
description: string;
|
|
4806
5037
|
category: ToolCategory;
|
|
4807
5038
|
schema(): ToolSchema;
|
|
4808
5039
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4809
|
-
private readImage;
|
|
4810
5040
|
}
|
|
4811
5041
|
|
|
4812
5042
|
/**
|
|
@@ -4831,26 +5061,13 @@ declare class ReadFileTool implements Tool {
|
|
|
4831
5061
|
* SOFTWARE.
|
|
4832
5062
|
*/
|
|
4833
5063
|
|
|
4834
|
-
|
|
4835
|
-
* Lets the Agent deliver its final result as structured data. In
|
|
4836
|
-
* non-interactive mode and coordinator mode, callers want JSON they can parse
|
|
4837
|
-
* directly, not a snippet of text buried inside natural language.
|
|
4838
|
-
*/
|
|
4839
|
-
declare class SyntheticOutputTool implements Tool {
|
|
4840
|
-
private jsonSchema?;
|
|
5064
|
+
declare class ReadFileTool implements Tool {
|
|
4841
5065
|
name: string;
|
|
4842
5066
|
description: string;
|
|
4843
5067
|
category: ToolCategory;
|
|
4844
|
-
/** jsonSchema is optional; when set, output is validated against the structure agreed with the caller. */
|
|
4845
|
-
constructor(jsonSchema?: Record<string, unknown> | undefined);
|
|
4846
5068
|
schema(): ToolSchema;
|
|
4847
|
-
execute(
|
|
4848
|
-
|
|
4849
|
-
* Only covers top-level type and required fields; an empty return string
|
|
4850
|
-
* means it passed. Full JSON Schema validation is unnecessary here — what
|
|
4851
|
-
* we guard against is the model delivering a structurally malformed result.
|
|
4852
|
-
*/
|
|
4853
|
-
private validateSchema;
|
|
5069
|
+
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
5070
|
+
private readImage;
|
|
4854
5071
|
}
|
|
4855
5072
|
|
|
4856
5073
|
/**
|
|
@@ -4875,44 +5092,26 @@ declare class SyntheticOutputTool implements Tool {
|
|
|
4875
5092
|
* SOFTWARE.
|
|
4876
5093
|
*/
|
|
4877
5094
|
|
|
4878
|
-
declare class ToolSearchTool implements Tool {
|
|
4879
|
-
name: string;
|
|
4880
|
-
description: string;
|
|
4881
|
-
category: ToolCategory;
|
|
4882
|
-
private registry;
|
|
4883
|
-
constructor(registry: ToolRegistry);
|
|
4884
|
-
schema(): ToolSchema;
|
|
4885
|
-
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4886
|
-
}
|
|
4887
|
-
|
|
4888
5095
|
/**
|
|
4889
|
-
*
|
|
4890
|
-
*
|
|
4891
|
-
*
|
|
4892
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
4893
|
-
* in the Software without restriction, including without limitation the rights
|
|
4894
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4895
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
4896
|
-
* furnished to do so, subject to the following conditions:
|
|
4897
|
-
*
|
|
4898
|
-
* The above copyright notice and this permission notice shall be included in
|
|
4899
|
-
* all copies or substantial portions of the Software.
|
|
4900
|
-
*
|
|
4901
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4902
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4903
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4904
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4905
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4906
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4907
|
-
* SOFTWARE.
|
|
5096
|
+
* Lets the Agent deliver its final result as structured data. In
|
|
5097
|
+
* non-interactive mode and coordinator mode, callers want JSON they can parse
|
|
5098
|
+
* directly, not a snippet of text buried inside natural language.
|
|
4908
5099
|
*/
|
|
4909
|
-
|
|
4910
|
-
|
|
5100
|
+
declare class SyntheticOutputTool implements Tool {
|
|
5101
|
+
private jsonSchema?;
|
|
4911
5102
|
name: string;
|
|
4912
5103
|
description: string;
|
|
4913
5104
|
category: ToolCategory;
|
|
5105
|
+
/** jsonSchema is optional; when set, output is validated against the structure agreed with the caller. */
|
|
5106
|
+
constructor(jsonSchema?: Record<string, unknown> | undefined);
|
|
4914
5107
|
schema(): ToolSchema;
|
|
4915
|
-
execute(
|
|
5108
|
+
execute(_ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
5109
|
+
/**
|
|
5110
|
+
* Only covers top-level type and required fields; an empty return string
|
|
5111
|
+
* means it passed. Full JSON Schema validation is unnecessary here — what
|
|
5112
|
+
* we guard against is the model delivering a structurally malformed result.
|
|
5113
|
+
*/
|
|
5114
|
+
private validateSchema;
|
|
4916
5115
|
}
|
|
4917
5116
|
|
|
4918
5117
|
/**
|
|
@@ -4937,10 +5136,12 @@ declare class GlobTool implements Tool {
|
|
|
4937
5136
|
* SOFTWARE.
|
|
4938
5137
|
*/
|
|
4939
5138
|
|
|
4940
|
-
declare class
|
|
5139
|
+
declare class ToolSearchTool implements Tool {
|
|
4941
5140
|
name: string;
|
|
4942
5141
|
description: string;
|
|
4943
5142
|
category: ToolCategory;
|
|
5143
|
+
private registry;
|
|
5144
|
+
constructor(registry: ToolRegistry);
|
|
4944
5145
|
schema(): ToolSchema;
|
|
4945
5146
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4946
5147
|
}
|
|
@@ -5095,6 +5296,7 @@ declare function connectToIde(opts: {
|
|
|
5095
5296
|
cwd: string;
|
|
5096
5297
|
onAtMentioned: (mention: IdeAtMention) => void;
|
|
5097
5298
|
onDisconnect?: () => void;
|
|
5299
|
+
signal?: AbortSignal;
|
|
5098
5300
|
}): Promise<IdeConnection | null>;
|
|
5099
5301
|
|
|
5100
5302
|
/**
|
|
@@ -5439,4 +5641,4 @@ declare class TaskUpdateTool implements Tool {
|
|
|
5439
5641
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
5440
5642
|
}
|
|
5441
5643
|
|
|
5442
|
-
export { ASYNC_AGENT_ALLOWED_TOOLS, Agent, type AgentConfig, type AgentDefinition, type AgentEvent, type AgentEventCallback, AgentEventLogger, type AgentEventSink, type AgentProgress, AgentProgressSchema, type AgentTask, AgentTool, AnthropicClient, type AppConfig, AskUserQuestionTool, type Asker, AuthenticationError, AutoCompactTrackingState, BASH_DESCRIPTION, BUILTIN_AGENTS, type Backup, BashTool, BwrapSandbox, CHARS_PER_TOKEN, COMPACT_BOUNDARY, CUSTOM_AGENT_DISALLOWED_TOOLS, CodeReviewManager, type CodeReviewMember, type CodeReviewTeam, type Command, type CommandContext, CommandRegistry, type CommandType, CommandUsageTracker, type CommentIssue, type CommentResolution, type CompactBoundaryPayload, type CompactResult, ConfigError, type ConnectResult, ContextTooLongError, ConversationManager, type CriticAssessment, type CriticEvaluation, DEFAULT_CONTEXT_WINDOW, DEFAULT_EAGER_THRESHOLD_PERCENT, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_LEVEL, type Decision, type DecisionEffect, type DetectedIde, type DiffResult, EDIT_FILE_DESCRIPTION, EditFileTool, EnterWorktreeTool, type EnvironmentContext, type EventLogger, type EventName, ExitPlanModeTool, ExitWorktreeTool, FORK_QUERY_SOURCE, type FileFeedback, FileHistory, type FileMailMessage, FileMailbox, FileStateCache, GLOB_DESCRIPTION, GREP_DESCRIPTION, GlobTool, GrepTool, type HookConfig, HookConfigSchema, type HookContext, HookEngine, type HookResult, type HookRuntimeOptions, INTERRUPTED_TOOL_RESULT, type IdeAtMention, type IdeConnection, ImageTooLargeError, InstallSkillTool, type InstructionSource, type KeptMessage, type LLMClient, LLMError, ListTeamsTool, LoadSkillTool, MAX_DIMENSION_PX, MAX_HISTORY_ENTRIES, MAX_IMAGES_PER_MESSAGE, MAX_IMAGE_BYTES_PASSTHROUGH, MCPClient, MCPManager, type MCPServerConfig, type MCPTool, type MCPToolLike, MCPToolWrapper, MCP_CALL_TOOL_NAME, MCP_NAME_SEP, MCP_TOOL_PREFIX, MSG_PLAN_APPROVAL_REQUEST, MSG_PLAN_APPROVAL_RESPONSE, MSG_SHUTDOWN_REQUEST, MSG_SHUTDOWN_RESPONSE, MSG_TEXT, type MaxTokensSetter, McpCallTool, type McpLoadingMode, type Member, MemoryConsolidator, MemoryExtractor, type MemoryFile, type MemoryHeader, MemoryManager, type Message, NATIVE_TOOL_USE_BETA, NameRegistry, NetworkError, OpenAIClient, OpenAICompatClient, type OpenAIMessageParam, POWERSHELL_DESCRIPTION, PathSandbox, PermissionChecker, type PermissionMode, PowerShellTool, type PrintArgs, PromptBuilder, type ProviderConfig, ProviderConfigSchema, type Question, type QuestionOption, READ_FILE_DESCRIPTION, REJECTED_TOOL_RESULT, RateLimitError, ReadFileTool, type RecallResult, RecoveryState, type RelevantMemory, type RemoteAgentHandle, RemoteServer, type RestoredMessage, type ReviewComment, type ReviewRequest, ReviewSession, type ReviewSummary, RuleEngine, type RunAgent, type RunCallbacks, SHUTDOWN_PREFIX, SKIP_DIRS, SUBAGENT_DISALLOWED_TOOLS, type Sandbox, type SandboxConfig, type SandboxYamlConfig, type SaveClipboardImageResult, SeatbeltSandbox, type Section, SendMessageTool, type SessionInfo, type SessionMessage, type SharedTask, SharedTaskStore, type Skill, SkillCatalog, type SkillForkHost, type SkillHost, type SkillMeta, type Snapshot, type SpawnConfig, SpawnTeammateTool, type Task$1 as StoredTask, type StreamEvent, StreamingExecutor, type SubagentRunOptions, SyntheticOutputTool, TEAMMATE_DISALLOWED_TOOLS, THINKING_BUDGETS, THINKING_LEVELS, TOOL_RESULT_PREVIEW_CHARS, TOOL_SEARCH_TOOL_NAME, type Task, TaskCreateTool$1 as TaskCreateTool, TaskGetTool$1 as TaskGetTool, TaskList, TaskListTool$1 as TaskListTool, TaskManager, type TaskStatus, TaskStopTool, TaskStore, type TaskUpdateFields, TaskUpdateTool$1 as TaskUpdateTool, Team, TeamCreateTool, TeamDeleteTool, type TeamFile, TeamManager, type TeamMemberEntry, TeamMemberEntrySchema, type TeamMode, TaskCreateTool as TeamTaskCreateTool, TaskGetTool as TeamTaskGetTool, TaskListTool as TeamTaskListTool, TaskUpdateTool as TeamTaskUpdateTool, type TeammateUIState, TeammateUIStateSchema, type ThinkingBlock, type ThinkingLevel, type ThinkingLevelControl, type Tool, type ToolActivity, ToolActivitySchema, type ToolCategory, type ToolContext, ToolRegistry, type ToolResult, type ToolResultBlock, type ToolResultContentBlock, type ToolResultRecord, type ToolSchema, ToolSearchTool, type ToolUseBlock, type ToolUseRecord, type TranscriptEntry, type UsageAnchor, type UsageInfo, WRITE_FILE_DESCRIPTION, WebSocketTransport, type WorktreeResult, WriteFileTool, append, applyBudget, applyMode, approved, asCriticEvaluation, asError, asErrorString, asImageMediaType, asRecord, asString, boolArg, buildAnthropicMessages, buildChatCompletionMessages, buildDiff, buildMcpToolName, buildOpenAIInput, buildPlanModeExitReminder, buildPlanModeReentryReminder, buildPlanModeReminder, buildSkillSection, buildSystemPrompt, buildTeammateRegistry, buildWorktreeNotice, cleanExpiredSessions, clipboardImageFileName, cloneRegistryForFork, closeLogger, coerceBySchema, computeCompactThreshold, computeKeepStartIndex, connectToIde, contentToText, coordinatorActive, coordinatorReminder, coordinatorToolFilter, createAgentWorktree, createChildLogger, createClient, createDefaultCodeReviewTeam, createDefaultRegistry, createModelResolver, createProgress, createRemoteAgent, createSandbox, currentContextTokens, decideAndApply, decideMode,
|
|
5644
|
+
export { ASYNC_AGENT_ALLOWED_TOOLS, Agent, type AgentConfig, type AgentDefinition, type AgentEvent, type AgentEventCallback, AgentEventLogger, type AgentEventSink, type AgentProgress, AgentProgressSchema, type AgentTask, AgentTool, AnthropicClient, type AppConfig, AskUserQuestionTool, type Asker, AuthenticationError, AutoCompactTrackingState, BASH_DESCRIPTION, BUILTIN_AGENTS, type Backup, BashTool, BwrapSandbox, CHARS_PER_TOKEN, COMPACT_BOUNDARY, CUSTOM_AGENT_DISALLOWED_TOOLS, CodeReviewManager, type CodeReviewMember, type CodeReviewTeam, type Command, type CommandContext, CommandRegistry, type CommandType, CommandUsageTracker, type CommentIssue, type CommentResolution, type CompactBoundaryPayload, type CompactResult, ConfigError, type ConnectResult, ContextTooLongError, ConversationManager, type CriticAssessment, type CriticEvaluation, DEFAULT_CONTEXT_WINDOW, DEFAULT_EAGER_THRESHOLD_PERCENT, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_THINKING_LEVEL, type Decision, type DecisionEffect, type DetectedIde, type DiffResult, EDIT_FILE_DESCRIPTION, EditFileTool, EnterWorktreeTool, type EnvironmentContext, type EventLogger, type EventName, ExitPlanModeTool, ExitWorktreeTool, FORK_QUERY_SOURCE, type FileFeedback, FileHistory, type FileMailMessage, FileMailbox, FileStateCache, GLOB_DESCRIPTION, GREP_DESCRIPTION, GlobTool, GrepTool, type HookConfig, HookConfigSchema, type HookContext, HookEngine, type HookResult, type HookRuntimeOptions, INTERRUPTED_TOOL_RESULT, type IdeAtMention, type IdeConnection, ImageTooLargeError, InstallSkillTool, type InstructionSource, type KeptMessage, type LLMClient, LLMError, ListTeamsTool, LoadSkillTool, MAX_DIMENSION_PX, MAX_HISTORY_ENTRIES, MAX_IMAGES_PER_MESSAGE, MAX_IMAGE_BYTES_PASSTHROUGH, MCPClient, MCPManager, type MCPServerConfig, type MCPTool, type MCPToolLike, MCPToolWrapper, MCP_CALL_TOOL_NAME, MCP_NAME_SEP, MCP_TOOL_PREFIX, MIN_THINKING_ANSWER_TOKENS, MIN_THINKING_BUDGET_TOKENS, MSG_PLAN_APPROVAL_REQUEST, MSG_PLAN_APPROVAL_RESPONSE, MSG_SHUTDOWN_REQUEST, MSG_SHUTDOWN_RESPONSE, MSG_TEXT, type MaxTokensSetter, McpCallTool, type McpLoadingMode, type Member, MemoryConsolidator, MemoryExtractor, type MemoryFile, type MemoryHeader, MemoryManager, type Message, NATIVE_TOOL_USE_BETA, NameRegistry, NetworkError, OpenAIClient, OpenAICompatClient, type OpenAIMessageParam, POWERSHELL_DESCRIPTION, PathSandbox, PermissionChecker, type PermissionMode, PowerShellTool, type PrintArgs, PromptBuilder, type ProviderConfig, ProviderConfigSchema, type Question, type QuestionOption, READ_FILE_DESCRIPTION, REJECTED_TOOL_RESULT, RateLimitError, ReadFileTool, type RecallResult, RecoveryState, type RelevantMemory, type RemoteAgentHandle, RemoteServer, type RestoredMessage, type ReviewComment, type ReviewRequest, ReviewSession, type ReviewSummary, RuleEngine, type RunAgent, type RunCallbacks, SHUTDOWN_PREFIX, SKIP_DIRS, SUBAGENT_DISALLOWED_TOOLS, type Sandbox, type SandboxConfig, type SandboxYamlConfig, type SaveClipboardImageResult, SeatbeltSandbox, type Section, SendMessageTool, type SessionInfo, type SessionMessage, type SharedTask, SharedTaskStore, type Skill, SkillCatalog, type SkillForkHost, type SkillHost, type SkillMeta, type Snapshot, type SpawnConfig, SpawnTeammateTool, type Task$1 as StoredTask, type StreamEvent, StreamingExecutor, type SubagentRunOptions, SyntheticOutputTool, TEAMMATE_DISALLOWED_TOOLS, THINKING_BUDGETS, THINKING_LEVELS, TOOL_RESULT_PREVIEW_CHARS, TOOL_SEARCH_TOOL_NAME, type Task, TaskCreateTool$1 as TaskCreateTool, TaskGetTool$1 as TaskGetTool, TaskList, TaskListTool$1 as TaskListTool, TaskManager, type TaskStatus, TaskStopTool, TaskStore, type TaskUpdateFields, TaskUpdateTool$1 as TaskUpdateTool, Team, TeamCreateTool, TeamDeleteTool, type TeamFile, TeamManager, type TeamMemberEntry, TeamMemberEntrySchema, type TeamMode, TaskCreateTool as TeamTaskCreateTool, TaskGetTool as TeamTaskGetTool, TaskListTool as TeamTaskListTool, TaskUpdateTool as TeamTaskUpdateTool, type TeammateUIState, TeammateUIStateSchema, type ThinkingBlock, type ThinkingLevel, type ThinkingLevelControl, type Tool, type ToolActivity, ToolActivitySchema, type ToolCategory, type ToolContext, ToolRegistry, type ToolResult, type ToolResultBlock, type ToolResultContentBlock, type ToolResultRecord, type ToolSchema, ToolSearchTool, type ToolUseBlock, type ToolUseRecord, type TranscriptEntry, type UsageAnchor, type UsageInfo, WRITE_FILE_DESCRIPTION, WebSocketTransport, type WorktreeResult, WriteFileTool, append, applyBudget, applyMode, approved, asCriticEvaluation, asError, asErrorString, asImageMediaType, asRecord, asString, boolArg, buildAnthropicMessages, buildChatCompletionMessages, buildDiff, buildMcpToolName, buildOpenAIInput, buildPlanModeExitReminder, buildPlanModeReentryReminder, buildPlanModeReminder, buildSkillSection, buildSystemPrompt, buildTeammateRegistry, buildWorktreeNotice, clampThinkingLevel, cleanExpiredSessions, clipboardImageFileName, cloneRegistryForFork, closeLogger, coerceBySchema, computeCompactThreshold, computeKeepStartIndex, connectToIde, contentToText, coordinatorActive, coordinatorReminder, coordinatorToolFilter, createAgentWorktree, createChildLogger, createClient, createDefaultCodeReviewTeam, createDefaultRegistry, createModelResolver, createProgress, createRemoteAgent, createSandbox, currentContextTokens, decideAndApply, decideMode, detectBackend, detectBackendFromEnv, detectEnvironment, detectIde, discoverInstructions, doingTasksSection, ensureToolPairing, environmentSection, escapeSkillXml, estimateMessages, estimateSchemaTokens, estimateTokens, evaluateRules, executingActionsSection, expandAtRefs, expandAtRefsWithImages, extractContent, fetchModelContextWindow, fileHistoryDir, filterToolsForAgent, forceCompact, forkEnabled, formatTokens, getContextWindow, getCurrentBranch, getCurrentPlanPath, getMaxOutputTokens, getMediaType, getNameRegistry, getOrCreatePlanPath, getSessionFilePath, getSupportedThinkingLevels, getThinkingLevel, globalConfigPath, handleCodeReviewCommand, hasWorktreeChanges, identitySection, initLogger, intArg, isCoordinatorTool, isCriticEvaluation, isDiffTool, isImagePath, isMcpToolLike, isObject, isOfficialAnthropicEndpoint, isPngBuffer, isRecord, isSafeCommand, isShutdownRequest, isSpillReadback, isToolResultContentBlock, isValidThinkingLevel, listSessions, load, loadAgentDefinitions, loadConfig, loadImageAttachment, loadInstructions, loadPlan, loadSession, loadTranscript, loadUserCommands, logger, manageContext, markLastUserTailForCache, markToolsForCache, maybeResizeAndDownsampleImage, mcpCallPermissionContent, mcpContentToToolOutput, mcpToolNamePrefix, measureSchemaChars, memoryAge, memoryAgeDays, memoryFreshnessText, needsToolSearchBeta, newRequestId, newSessionId, normalizeToolResultContentBlock, outputEfficiencySection, parse, parsePrintFlags, parseSkillFile, parseSkillPrompt, parseTeammateFlags, persistLargeResult, planApprovalRequest, planApprovalResponse, planExists, quickSort, randomCompletionVerb, randomVerb, readTeamFile, readWorktreeHeadSha, rebuildFromSession, record, recordError, recordExit, recordTokens, recordToolUse, recover, removeAgentWorktree, renderBody, replaceToolResultContent, resetPlanPath, resolveAPIKey, resolveGitDir, resolveModelId, runFork, runInline, runPrintMode, runTeammate, safeJSONParse, sanitizeNameSegment, sanitizeSegment, sanitizeTeamName, saveClipboardImage, saveCompactBoundary, saveMessage, savePlan, saveTranscript, shutdownRequest, shutdownResponse, sniffMediaType, spawnSubagent, spawnTeammate, storeClipboardImage, strArg, strList, summarizeActivities, systemSection, teamConfigPath, teamDir, teamsBaseDir, thinkingBudgetForLevel, toAnthropicThinkingEffort, toDisplayPreview, toReasoningEffort, toTry, toneStyleSection, toolResultsToRecords, toolUsesToRecords, usingToolsSection, validate, version, withProviderDefaults, writeTeamFile };
|