@swifty.js/swifty 0.0.28 → 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 +40 -38
- package/dist/{agent-3NON2EXE.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-JGSIQXEN.js → chunk-QFSCPD63.js} +1 -1
- package/dist/chunk-TKADLB2Q.js +4 -0
- package/dist/chunk-VA64DJNN.js +4 -0
- package/dist/lib/{agent-XYO2MXXK.js → agent-IRY7KR5D.js} +3 -3
- package/dist/lib/{anthropic-TGJGAP5R.js → anthropic-CL5IK7KN.js} +3 -3
- 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-P4F46PEF.js → chunk-I7OPU4K2.js} +48 -8
- package/dist/lib/{chunk-ALJAVRRX.js → chunk-IYPTOY3Y.js} +59 -19
- package/dist/lib/{chunk-DV6RV5WU.js → chunk-OOSNCCI7.js} +134 -258
- package/dist/lib/{chunk-FBSPZQGC.js → chunk-OQIQOU5S.js} +132 -73
- package/dist/lib/{chunk-IB5IQK2S.js → chunk-PIL7M52F.js} +2 -11
- package/dist/lib/{chunk-DJ6AILPN.js → chunk-RMB3J46W.js} +13 -16
- package/dist/lib/index.d.ts +387 -112
- package/dist/lib/index.js +1000 -1157
- package/dist/lib/{openai-5UCIIDPO.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-YLS2LUAI.js → openai-RZLCY55V.js} +15 -15
- package/dist/{server-GX72MJQF.js → server-IVIRQTO7.js} +17 -17
- package/dist/{tool-filter-VBP6WOGO.js → tool-filter-CG3KGQQW.js} +1 -1
- package/package.json +5 -4
- package/dist/anthropic-BJ5GN2VT.js +0 -4
- package/dist/chunk-D34FUVGU.js +0 -4
- package/dist/chunk-LZBOXJX2.js +0 -301
- package/dist/chunk-R63ASIIW.js +0 -407
- package/dist/chunk-WX3B64R4.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?: {
|
|
@@ -445,6 +446,31 @@ declare class ConversationManager {
|
|
|
445
446
|
declare class ConfigError extends Error {
|
|
446
447
|
constructor(message: string);
|
|
447
448
|
}
|
|
449
|
+
/** The single global config file: $HOME/.swifty/config.yaml. */
|
|
450
|
+
declare function globalConfigPath(): string;
|
|
451
|
+
/**
|
|
452
|
+
* PI-equivalent thinking levels. `off` disables reasoning entirely; the rest
|
|
453
|
+
* map to a provider-native effort string (openai / openai-compat) or a thinking
|
|
454
|
+
* token budget (anthropic).
|
|
455
|
+
*/
|
|
456
|
+
declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
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
|
+
}>;
|
|
448
474
|
declare const ProviderConfigSchema: z.ZodObject<{
|
|
449
475
|
name: z.ZodString;
|
|
450
476
|
protocol: z.ZodEnum<{
|
|
@@ -455,16 +481,117 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
455
481
|
base_url: z.ZodString;
|
|
456
482
|
model: z.ZodString;
|
|
457
483
|
api_key: z.ZodOptional<z.ZodString>;
|
|
458
|
-
thinking: z.ZodOptional<z.
|
|
484
|
+
thinking: z.ZodOptional<z.ZodEnum<{
|
|
485
|
+
off: "off";
|
|
486
|
+
minimal: "minimal";
|
|
487
|
+
low: "low";
|
|
488
|
+
medium: "medium";
|
|
489
|
+
high: "high";
|
|
490
|
+
xhigh: "xhigh";
|
|
491
|
+
max: "max";
|
|
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
|
+
}>>;
|
|
459
555
|
context_window: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
460
556
|
max_output_tokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
461
|
-
}, z.core.$
|
|
557
|
+
}, z.core.$loose>;
|
|
462
558
|
type ProviderConfig = z.infer<typeof ProviderConfigSchema>;
|
|
463
|
-
declare const
|
|
559
|
+
declare const DEFAULT_THINKING_LEVEL: ThinkingLevel;
|
|
464
560
|
declare const DEFAULT_CONTEXT_WINDOW = 1000000;
|
|
561
|
+
/**
|
|
562
|
+
* Fallback output-token ceiling used when `max_output_tokens` is unset (PI's
|
|
563
|
+
* custom-model `maxTokens` default).
|
|
564
|
+
*/
|
|
465
565
|
declare const DEFAULT_MAX_OUTPUT_TOKENS = 128000;
|
|
566
|
+
/**
|
|
567
|
+
* PI-equivalent thinking token budgets, used by the anthropic budget-based
|
|
568
|
+
* thinking path. Must stay below DEFAULT_MAX_OUTPUT_TOKENS so the answer keeps
|
|
569
|
+
* room after the thinking budget is reserved.
|
|
570
|
+
*/
|
|
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;
|
|
574
|
+
declare function isValidThinkingLevel(value: string): value is ThinkingLevel;
|
|
575
|
+
/** Resolve the effective logical level, including explicit capability limits. */
|
|
576
|
+
declare function getThinkingLevel(provider: ProviderConfig): ThinkingLevel;
|
|
577
|
+
/** Thinking token budget for a level; 0 when thinking is off. */
|
|
578
|
+
declare function thinkingBudgetForLevel(level: ThinkingLevel): number;
|
|
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;
|
|
466
587
|
declare function withProviderDefaults(provider: ProviderConfig): ProviderConfig;
|
|
467
588
|
declare function getContextWindow(provider: ProviderConfig): number;
|
|
589
|
+
/**
|
|
590
|
+
* Effective output cap for a provider. Configured value wins, otherwise the
|
|
591
|
+
* 128k fallback applies; the result never exceeds the context window (PI's
|
|
592
|
+
* `clampMaxTokensToContext`). This keeps small-output models from being sent an
|
|
593
|
+
* over-large `max_tokens` while still letting users lower the cap.
|
|
594
|
+
*/
|
|
468
595
|
declare function getMaxOutputTokens(provider: ProviderConfig): number;
|
|
469
596
|
declare function resolveAPIKey(p: ProviderConfig): string;
|
|
470
597
|
declare const MCPServerConfigSchema: z.ZodObject<{
|
|
@@ -511,10 +638,80 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
511
638
|
base_url: z.ZodString;
|
|
512
639
|
model: z.ZodString;
|
|
513
640
|
api_key: z.ZodOptional<z.ZodString>;
|
|
514
|
-
thinking: z.ZodOptional<z.
|
|
641
|
+
thinking: z.ZodOptional<z.ZodEnum<{
|
|
642
|
+
off: "off";
|
|
643
|
+
minimal: "minimal";
|
|
644
|
+
low: "low";
|
|
645
|
+
medium: "medium";
|
|
646
|
+
high: "high";
|
|
647
|
+
xhigh: "xhigh";
|
|
648
|
+
max: "max";
|
|
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
|
+
}>>;
|
|
515
712
|
context_window: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
516
713
|
max_output_tokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
517
|
-
}, z.core.$
|
|
714
|
+
}, z.core.$loose>>;
|
|
518
715
|
permission_mode: z.ZodOptional<z.ZodString>;
|
|
519
716
|
mcp_servers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
520
717
|
name: z.ZodString;
|
|
@@ -552,7 +749,6 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
552
749
|
/** Whether fork is available. Defaults to enabled when not specified in config. */
|
|
553
750
|
declare function forkEnabled(cfg: AppConfig): boolean;
|
|
554
751
|
type AppConfig = z.infer<typeof AppConfigSchema>;
|
|
555
|
-
declare function mergeConfig(base: AppConfig, override: AppConfig): AppConfig;
|
|
556
752
|
declare function loadConfig(path?: string, options?: {
|
|
557
753
|
allowEmptyProviders?: boolean;
|
|
558
754
|
}): AppConfig;
|
|
@@ -696,10 +892,15 @@ declare class OpenAIClient implements LLMClient {
|
|
|
696
892
|
private model;
|
|
697
893
|
private systemPrompt;
|
|
698
894
|
private maxOutputTokens;
|
|
895
|
+
private thinkingLevel;
|
|
896
|
+
private config;
|
|
699
897
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
700
898
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
701
899
|
setSystemPrompt(prompt: string): void;
|
|
702
900
|
setMaxOutputTokens(maxTokens: number): void;
|
|
901
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
902
|
+
getThinkingLevel(): ThinkingLevel;
|
|
903
|
+
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
703
904
|
}
|
|
704
905
|
type OpenAIMessageParam = OpenAI.Responses.EasyInputMessage | OpenAI.Responses.ResponseFunctionToolCall | OpenAI.Responses.ResponseInputItem.FunctionCallOutput | OpenAI.Responses.ResponseReasoningItem;
|
|
705
906
|
declare function buildOpenAIInput(messages: Message[]): OpenAIMessageParam[];
|
|
@@ -708,9 +909,14 @@ declare class OpenAICompatClient implements LLMClient {
|
|
|
708
909
|
private model;
|
|
709
910
|
private systemPrompt;
|
|
710
911
|
private maxOutputTokens;
|
|
912
|
+
private thinkingLevel;
|
|
913
|
+
private config;
|
|
711
914
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
712
915
|
setSystemPrompt(prompt: string): void;
|
|
713
916
|
setMaxOutputTokens(maxTokens: number): void;
|
|
917
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
918
|
+
getThinkingLevel(): ThinkingLevel;
|
|
919
|
+
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
714
920
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
715
921
|
}
|
|
716
922
|
declare function buildChatCompletionMessages(messages: Message[]): OpenAI.ChatCompletionMessageParam[];
|
|
@@ -747,7 +953,7 @@ declare function buildChatCompletionMessages(messages: Message[]): OpenAI.ChatCo
|
|
|
747
953
|
* built-in tools, so the array tail is often a deferred tool — we must scan
|
|
748
954
|
* backwards. Built-in tools are never deferred, so a valid slot always exists.
|
|
749
955
|
*/
|
|
750
|
-
declare function markToolsForCache(tools:
|
|
956
|
+
declare function markToolsForCache(tools: Pick<Anthropic.Tool, "defer_loading" | "cache_control">[]): void;
|
|
751
957
|
/**
|
|
752
958
|
* Whether any tool in this batch has defer_loading set.
|
|
753
959
|
*
|
|
@@ -761,16 +967,17 @@ declare function buildAnthropicMessages(messages: Message[]): Anthropic.MessageP
|
|
|
761
967
|
declare class AnthropicClient implements LLMClient {
|
|
762
968
|
private client;
|
|
763
969
|
private model;
|
|
764
|
-
/**
|
|
765
|
-
|
|
766
|
-
*/
|
|
767
|
-
private thinking;
|
|
970
|
+
/** Effective logical level for budget or explicitly configured adaptive mode. */
|
|
971
|
+
private thinkingLevel;
|
|
768
972
|
private systemPrompt;
|
|
769
973
|
private maxOutputTokens;
|
|
770
|
-
|
|
974
|
+
private config;
|
|
771
975
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
772
976
|
setSystemPrompt(prompt: string): void;
|
|
773
977
|
setMaxOutputTokens(maxTokens: number): void;
|
|
978
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel;
|
|
979
|
+
getThinkingLevel(): ThinkingLevel;
|
|
980
|
+
getSupportedThinkingLevels(): readonly ThinkingLevel[];
|
|
774
981
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
775
982
|
}
|
|
776
983
|
/**
|
|
@@ -778,13 +985,20 @@ declare class AnthropicClient implements LLMClient {
|
|
|
778
985
|
*/
|
|
779
986
|
declare function markLastUserTailForCache(messages: Anthropic.Messages.MessageParam[]): void;
|
|
780
987
|
|
|
781
|
-
interface LLMClient extends Partial<MaxTokensSetter> {
|
|
988
|
+
interface LLMClient extends Partial<MaxTokensSetter>, Partial<ThinkingLevelControl> {
|
|
782
989
|
stream(conversationManager: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
783
990
|
setSystemPrompt(prompt: string): void;
|
|
784
991
|
}
|
|
785
992
|
interface MaxTokensSetter {
|
|
786
993
|
setMaxOutputTokens(maxTokens: number): void;
|
|
787
994
|
}
|
|
995
|
+
/** Runtime control of the effective logical thinking level. */
|
|
996
|
+
interface ThinkingLevelControl {
|
|
997
|
+
/** Built-in clients return the effective level; legacy controls may return void. */
|
|
998
|
+
setThinkingLevel(level: ThinkingLevel): ThinkingLevel | void;
|
|
999
|
+
getThinkingLevel(): ThinkingLevel;
|
|
1000
|
+
getSupportedThinkingLevels?(): readonly ThinkingLevel[];
|
|
1001
|
+
}
|
|
788
1002
|
declare function createClient(config: ProviderConfig, systemPrompt: string): Promise<AnthropicClient | OpenAIClient | OpenAICompatClient>;
|
|
789
1003
|
|
|
790
1004
|
/**
|
|
@@ -921,8 +1135,9 @@ declare class ToolRegistry {
|
|
|
921
1135
|
register(tool: Tool): void;
|
|
922
1136
|
get(name: string): Tool | undefined;
|
|
923
1137
|
listTools(): Tool[];
|
|
924
|
-
getAllSchemas(protocol?: "anthropic"):
|
|
925
|
-
getAllSchemas(protocol: "openai"
|
|
1138
|
+
getAllSchemas(protocol?: "anthropic"): ToolSchema[];
|
|
1139
|
+
getAllSchemas(protocol: "openai"): FunctionTool[];
|
|
1140
|
+
getAllSchemas(protocol: "openai-compat"): ChatCompletionFunctionTool[];
|
|
926
1141
|
/**
|
|
927
1142
|
* Names of deferred tools not yet discovered, in lexicographic order.
|
|
928
1143
|
*
|
|
@@ -1308,6 +1523,7 @@ declare class StreamingExecutor {
|
|
|
1308
1523
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1309
1524
|
* SOFTWARE.
|
|
1310
1525
|
*/
|
|
1526
|
+
|
|
1311
1527
|
type CommandType = "local" | "local_ui" | "prompt" | "skill_fork";
|
|
1312
1528
|
interface CommandContext {
|
|
1313
1529
|
workDir: string;
|
|
@@ -1326,6 +1542,14 @@ interface CommandContext {
|
|
|
1326
1542
|
memoryClear?: () => void;
|
|
1327
1543
|
/** Returns the current model name */
|
|
1328
1544
|
model?: string;
|
|
1545
|
+
/** Returns the current effective thinking level */
|
|
1546
|
+
thinkingLevel?: () => ThinkingLevel;
|
|
1547
|
+
/** Returns the active client's available logical thinking levels */
|
|
1548
|
+
availableThinkingLevels?: () => readonly ThinkingLevel[];
|
|
1549
|
+
/** Sets the thinking level for the active client */
|
|
1550
|
+
setThinkingLevel?: (level: ThinkingLevel) => void;
|
|
1551
|
+
/** Persists the thinking level to the global config; throws on failure */
|
|
1552
|
+
persistThinkingLevel?: (level: ThinkingLevel) => void;
|
|
1329
1553
|
}
|
|
1330
1554
|
interface Command {
|
|
1331
1555
|
name: string;
|
|
@@ -2129,7 +2353,7 @@ declare function estimateTokens(conv: ConversationManager): number;
|
|
|
2129
2353
|
declare function computeKeepStartIndex(messages: Message[]): number;
|
|
2130
2354
|
declare function currentContextTokens(conv: ConversationManager, anchor?: UsageAnchor): number;
|
|
2131
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>;
|
|
2132
|
-
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>;
|
|
2133
2357
|
|
|
2134
2358
|
/**
|
|
2135
2359
|
* Copyright (c) 2026 hangtiancheng
|
|
@@ -2222,6 +2446,27 @@ declare const MAX_HISTORY_ENTRIES = 200;
|
|
|
2222
2446
|
declare function load(dir: string): string[];
|
|
2223
2447
|
declare function append(dir: string, text: string): string[];
|
|
2224
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
|
+
*/
|
|
2225
2470
|
type SaveClipboardImageResult = {
|
|
2226
2471
|
ok: true;
|
|
2227
2472
|
value: string;
|
|
@@ -2796,10 +3041,9 @@ interface InstructionSource {
|
|
|
2796
3041
|
*
|
|
2797
3042
|
* Discovery order (later entries take higher precedence — the model attends
|
|
2798
3043
|
* more to content appearing later):
|
|
2799
|
-
* 1. User-global: ~/.swifty/
|
|
2800
|
-
* 2. Project:
|
|
3044
|
+
* 1. User-global: ~/.swifty/AGENTS.md
|
|
3045
|
+
* 2. Project: AGENTS.md, and .swifty/AGENTS.md in every
|
|
2801
3046
|
* directory from the git root down to workDir
|
|
2802
|
-
* 3. workDir/SWIFTY.local.md (local private override)
|
|
2803
3047
|
*
|
|
2804
3048
|
* Supports @include directives:
|
|
2805
3049
|
* - @./relative/path, @~/home/path, @/absolute/path
|
|
@@ -2912,6 +3156,27 @@ declare function parsePrintFlags(args: string[]): PrintArgs | null;
|
|
|
2912
3156
|
*/
|
|
2913
3157
|
declare function runPrintMode(args: PrintArgs): Promise<void>;
|
|
2914
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
|
+
*/
|
|
2915
3180
|
/**
|
|
2916
3181
|
* Appends a timestamped entry to the crash log.
|
|
2917
3182
|
* Write failures are silently ignored so diagnostics never crash the process.
|
|
@@ -3070,11 +3335,8 @@ declare function parseSkillFile(content: string): {
|
|
|
3070
3335
|
body: string;
|
|
3071
3336
|
frontmatter: Record<string, unknown>;
|
|
3072
3337
|
} | null;
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
* descriptions are included; the full SOP is fetched on demand via LoadSkill.
|
|
3076
|
-
* Returns an empty string when the catalog is empty so callers can skip this section.
|
|
3077
|
-
*/
|
|
3338
|
+
declare function escapeSkillXml(text: string): string;
|
|
3339
|
+
/** Metadata-only conversation reminder; bodies load on demand without changing the system prefix. */
|
|
3078
3340
|
declare function buildSkillSection(catalog: SkillCatalog, workDir: string): string;
|
|
3079
3341
|
|
|
3080
3342
|
/**
|
|
@@ -3417,19 +3679,7 @@ declare function buildSystemPrompt(env: EnvironmentContext): string;
|
|
|
3417
3679
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3418
3680
|
* SOFTWARE.
|
|
3419
3681
|
*/
|
|
3420
|
-
/**
|
|
3421
|
-
* Returns the coordinator-mode orchestration guidance, injected as a system-reminder each turn.
|
|
3422
|
-
* The first turn sends the full text; subsequent turns send the condensed version: this guidance
|
|
3423
|
-
* is just over 8 KB, and system-reminders are appended incrementally — re-sending the full text
|
|
3424
|
-
* every turn would fill back up the context window that this mode is designed to save.
|
|
3425
|
-
*
|
|
3426
|
-
* There are two reasons this is not made a system-prompt paragraph: first, the model drifts in
|
|
3427
|
-
* long conversations — the system prompt appears only once at the beginning, and by turn twenty
|
|
3428
|
-
* those hard constraints are long buried; appending once per turn is what pulls them back.
|
|
3429
|
-
* Second, the system prompt belongs to the cached prefix — modifying it invalidates billing for
|
|
3430
|
-
* all subsequent content, whereas a system-reminder is a plain message appended at the end of
|
|
3431
|
-
* the conversation.
|
|
3432
|
-
*/
|
|
3682
|
+
/** Periodic conversation reminders preserve guidance without changing the cached system prefix. */
|
|
3433
3683
|
declare function coordinatorReminder(iteration?: number): string;
|
|
3434
3684
|
|
|
3435
3685
|
/**
|
|
@@ -3603,13 +3853,15 @@ declare class SeatbeltSandbox implements Sandbox {
|
|
|
3603
3853
|
* SOFTWARE.
|
|
3604
3854
|
*/
|
|
3605
3855
|
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
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. */
|
|
3609
3863
|
declare function runInline(skill: Skill, args: string, host: SkillHost): string;
|
|
3610
|
-
/**
|
|
3611
|
-
* Runs a skill in fork mode: executes it in an isolated subagent.
|
|
3612
|
-
*/
|
|
3864
|
+
/** Runs a skill in an isolated subagent and returns its result unchanged. */
|
|
3613
3865
|
declare function runFork(skill: Skill, args: string, host: SkillForkHost): Promise<string>;
|
|
3614
3866
|
|
|
3615
3867
|
/**
|
|
@@ -4430,13 +4682,13 @@ declare class BashTool implements Tool {
|
|
|
4430
4682
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4431
4683
|
* SOFTWARE.
|
|
4432
4684
|
*/
|
|
4433
|
-
declare const BASH_DESCRIPTION = "
|
|
4434
|
-
declare const POWERSHELL_DESCRIPTION = "
|
|
4435
|
-
declare const READ_FILE_DESCRIPTION = "
|
|
4436
|
-
declare const EDIT_FILE_DESCRIPTION = "
|
|
4437
|
-
declare const WRITE_FILE_DESCRIPTION = "
|
|
4438
|
-
declare const GLOB_DESCRIPTION = "
|
|
4439
|
-
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.";
|
|
4440
4692
|
|
|
4441
4693
|
/**
|
|
4442
4694
|
* Copyright (c) 2026 hangtiancheng
|
|
@@ -4598,6 +4850,66 @@ declare class ExitWorktreeTool implements Tool {
|
|
|
4598
4850
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4599
4851
|
}
|
|
4600
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
|
+
|
|
4601
4913
|
/**
|
|
4602
4914
|
* Copyright (c) 2026 hangtiancheng
|
|
4603
4915
|
*
|
|
@@ -4697,14 +5009,6 @@ declare class McpCallTool implements Tool {
|
|
|
4697
5009
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4698
5010
|
}
|
|
4699
5011
|
|
|
4700
|
-
declare class PowerShellTool implements Tool {
|
|
4701
|
-
name: string;
|
|
4702
|
-
description: string;
|
|
4703
|
-
category: ToolCategory;
|
|
4704
|
-
schema(): ToolSchema;
|
|
4705
|
-
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4706
|
-
}
|
|
4707
|
-
|
|
4708
5012
|
/**
|
|
4709
5013
|
* Copyright (c) 2026 hangtiancheng
|
|
4710
5014
|
*
|
|
@@ -4727,13 +5031,12 @@ declare class PowerShellTool implements Tool {
|
|
|
4727
5031
|
* SOFTWARE.
|
|
4728
5032
|
*/
|
|
4729
5033
|
|
|
4730
|
-
declare class
|
|
5034
|
+
declare class PowerShellTool implements Tool {
|
|
4731
5035
|
name: string;
|
|
4732
5036
|
description: string;
|
|
4733
5037
|
category: ToolCategory;
|
|
4734
5038
|
schema(): ToolSchema;
|
|
4735
5039
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4736
|
-
private readImage;
|
|
4737
5040
|
}
|
|
4738
5041
|
|
|
4739
5042
|
/**
|
|
@@ -4758,26 +5061,13 @@ declare class ReadFileTool implements Tool {
|
|
|
4758
5061
|
* SOFTWARE.
|
|
4759
5062
|
*/
|
|
4760
5063
|
|
|
4761
|
-
|
|
4762
|
-
* Lets the Agent deliver its final result as structured data. In
|
|
4763
|
-
* non-interactive mode and coordinator mode, callers want JSON they can parse
|
|
4764
|
-
* directly, not a snippet of text buried inside natural language.
|
|
4765
|
-
*/
|
|
4766
|
-
declare class SyntheticOutputTool implements Tool {
|
|
4767
|
-
private jsonSchema?;
|
|
5064
|
+
declare class ReadFileTool implements Tool {
|
|
4768
5065
|
name: string;
|
|
4769
5066
|
description: string;
|
|
4770
5067
|
category: ToolCategory;
|
|
4771
|
-
/** jsonSchema is optional; when set, output is validated against the structure agreed with the caller. */
|
|
4772
|
-
constructor(jsonSchema?: Record<string, unknown> | undefined);
|
|
4773
5068
|
schema(): ToolSchema;
|
|
4774
|
-
execute(
|
|
4775
|
-
|
|
4776
|
-
* Only covers top-level type and required fields; an empty return string
|
|
4777
|
-
* means it passed. Full JSON Schema validation is unnecessary here — what
|
|
4778
|
-
* we guard against is the model delivering a structurally malformed result.
|
|
4779
|
-
*/
|
|
4780
|
-
private validateSchema;
|
|
5069
|
+
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
5070
|
+
private readImage;
|
|
4781
5071
|
}
|
|
4782
5072
|
|
|
4783
5073
|
/**
|
|
@@ -4802,44 +5092,26 @@ declare class SyntheticOutputTool implements Tool {
|
|
|
4802
5092
|
* SOFTWARE.
|
|
4803
5093
|
*/
|
|
4804
5094
|
|
|
4805
|
-
declare class ToolSearchTool implements Tool {
|
|
4806
|
-
name: string;
|
|
4807
|
-
description: string;
|
|
4808
|
-
category: ToolCategory;
|
|
4809
|
-
private registry;
|
|
4810
|
-
constructor(registry: ToolRegistry);
|
|
4811
|
-
schema(): ToolSchema;
|
|
4812
|
-
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4813
|
-
}
|
|
4814
|
-
|
|
4815
5095
|
/**
|
|
4816
|
-
*
|
|
4817
|
-
*
|
|
4818
|
-
*
|
|
4819
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
4820
|
-
* in the Software without restriction, including without limitation the rights
|
|
4821
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4822
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
4823
|
-
* furnished to do so, subject to the following conditions:
|
|
4824
|
-
*
|
|
4825
|
-
* The above copyright notice and this permission notice shall be included in
|
|
4826
|
-
* all copies or substantial portions of the Software.
|
|
4827
|
-
*
|
|
4828
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4829
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4830
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4831
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4832
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4833
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4834
|
-
* 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.
|
|
4835
5099
|
*/
|
|
4836
|
-
|
|
4837
|
-
|
|
5100
|
+
declare class SyntheticOutputTool implements Tool {
|
|
5101
|
+
private jsonSchema?;
|
|
4838
5102
|
name: string;
|
|
4839
5103
|
description: string;
|
|
4840
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);
|
|
4841
5107
|
schema(): ToolSchema;
|
|
4842
|
-
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;
|
|
4843
5115
|
}
|
|
4844
5116
|
|
|
4845
5117
|
/**
|
|
@@ -4864,10 +5136,12 @@ declare class GlobTool implements Tool {
|
|
|
4864
5136
|
* SOFTWARE.
|
|
4865
5137
|
*/
|
|
4866
5138
|
|
|
4867
|
-
declare class
|
|
5139
|
+
declare class ToolSearchTool implements Tool {
|
|
4868
5140
|
name: string;
|
|
4869
5141
|
description: string;
|
|
4870
5142
|
category: ToolCategory;
|
|
5143
|
+
private registry;
|
|
5144
|
+
constructor(registry: ToolRegistry);
|
|
4871
5145
|
schema(): ToolSchema;
|
|
4872
5146
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
4873
5147
|
}
|
|
@@ -5022,6 +5296,7 @@ declare function connectToIde(opts: {
|
|
|
5022
5296
|
cwd: string;
|
|
5023
5297
|
onAtMentioned: (mention: IdeAtMention) => void;
|
|
5024
5298
|
onDisconnect?: () => void;
|
|
5299
|
+
signal?: AbortSignal;
|
|
5025
5300
|
}): Promise<IdeConnection | null>;
|
|
5026
5301
|
|
|
5027
5302
|
/**
|
|
@@ -5366,4 +5641,4 @@ declare class TaskUpdateTool implements Tool {
|
|
|
5366
5641
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
5367
5642
|
}
|
|
5368
5643
|
|
|
5369
|
-
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,
|
|
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 };
|