@swifty.js/swifty 0.0.28 → 0.0.29
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 +39 -37
- package/dist/{agent-3NON2EXE.js → agent-YR6YK26C.js} +1 -1
- package/dist/anthropic-5GRR5JCT.js +4 -0
- package/dist/chunk-LIMEBKCY.js +408 -0
- package/dist/{chunk-LZBOXJX2.js → chunk-POHIQUFP.js} +25 -25
- package/dist/{chunk-JGSIQXEN.js → chunk-QFSCPD63.js} +1 -1
- package/dist/chunk-TMEX7RFA.js +4 -0
- package/dist/glob.wasm +0 -0
- package/dist/lib/{agent-XYO2MXXK.js → agent-5WEKVRTD.js} +3 -3
- package/dist/lib/{anthropic-TGJGAP5R.js → anthropic-KWO3KLNV.js} +3 -3
- package/dist/lib/{chunk-P4F46PEF.js → chunk-3FBS5NB7.js} +30 -6
- package/dist/lib/{chunk-DV6RV5WU.js → chunk-GCY44T7S.js} +7 -6
- package/dist/lib/{chunk-ALJAVRRX.js → chunk-KZSBR4FO.js} +22 -9
- package/dist/lib/{chunk-IB5IQK2S.js → chunk-PIL7M52F.js} +2 -11
- package/dist/lib/{chunk-FBSPZQGC.js → chunk-Z4CYHTII.js} +69 -69
- package/dist/lib/glob.wasm +0 -0
- package/dist/lib/index.d.ts +84 -11
- package/dist/lib/index.js +273 -143
- package/dist/lib/{openai-5UCIIDPO.js → openai-PBF7EWNJ.js} +2 -2
- package/dist/main.js +163 -163
- package/dist/{openai-YLS2LUAI.js → openai-QQ2K7GPF.js} +14 -14
- package/dist/{server-GX72MJQF.js → server-G23HCFLI.js} +16 -16
- package/package.json +2 -2
- package/dist/anthropic-BJ5GN2VT.js +0 -4
- package/dist/chunk-R63ASIIW.js +0 -407
- package/dist/chunk-WX3B64R4.js +0 -4
|
@@ -59,6 +59,11 @@ var ConfigError = class extends Error {
|
|
|
59
59
|
this.name = "ConfigError";
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
+
function globalConfigPath() {
|
|
63
|
+
return join(homedir(), ".swifty", "config.yaml");
|
|
64
|
+
}
|
|
65
|
+
var THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
66
|
+
var ThinkingConfigSchema = z.union([z.boolean(), z.enum(THINKING_LEVELS)]);
|
|
62
67
|
var ProviderConfigSchema = z.object({
|
|
63
68
|
name: z.string(),
|
|
64
69
|
/**
|
|
@@ -68,17 +73,51 @@ var ProviderConfigSchema = z.object({
|
|
|
68
73
|
base_url: z.string(),
|
|
69
74
|
model: z.string(),
|
|
70
75
|
api_key: z.string().optional(),
|
|
71
|
-
thinking:
|
|
76
|
+
thinking: ThinkingConfigSchema.optional(),
|
|
72
77
|
context_window: z.coerce.number().optional(),
|
|
78
|
+
/**
|
|
79
|
+
* The model's output ceiling (PI's `model.maxTokens`). Clamped to the
|
|
80
|
+
* context window; reasoning shares this ceiling instead of raising it.
|
|
81
|
+
*/
|
|
73
82
|
max_output_tokens: z.coerce.number().optional()
|
|
74
83
|
});
|
|
75
|
-
var
|
|
84
|
+
var DEFAULT_THINKING_LEVEL = "high";
|
|
76
85
|
var DEFAULT_CONTEXT_WINDOW = 1e6;
|
|
77
86
|
var DEFAULT_MAX_OUTPUT_TOKENS = 128e3;
|
|
87
|
+
var THINKING_BUDGETS = {
|
|
88
|
+
minimal: 1024,
|
|
89
|
+
low: 2048,
|
|
90
|
+
medium: 8192,
|
|
91
|
+
high: 16384,
|
|
92
|
+
xhigh: 32768,
|
|
93
|
+
max: 65536
|
|
94
|
+
};
|
|
95
|
+
function isValidThinkingLevel(value) {
|
|
96
|
+
return THINKING_LEVELS.includes(value);
|
|
97
|
+
}
|
|
98
|
+
function defaultThinkingLevelFor(protocol) {
|
|
99
|
+
return protocol === "anthropic" ? DEFAULT_THINKING_LEVEL : "off";
|
|
100
|
+
}
|
|
101
|
+
function getThinkingLevel(provider) {
|
|
102
|
+
const thinking = provider.thinking;
|
|
103
|
+
if (thinking === void 0) {
|
|
104
|
+
return defaultThinkingLevelFor(provider.protocol);
|
|
105
|
+
}
|
|
106
|
+
if (typeof thinking === "boolean") {
|
|
107
|
+
return thinking ? defaultThinkingLevelFor(provider.protocol) : "off";
|
|
108
|
+
}
|
|
109
|
+
return thinking;
|
|
110
|
+
}
|
|
111
|
+
function thinkingBudgetForLevel(level) {
|
|
112
|
+
return level === "off" ? 0 : THINKING_BUDGETS[level];
|
|
113
|
+
}
|
|
114
|
+
function toReasoningEffort(level) {
|
|
115
|
+
return level === "off" ? "none" : level;
|
|
116
|
+
}
|
|
78
117
|
function withProviderDefaults(provider) {
|
|
79
118
|
return {
|
|
80
119
|
...provider,
|
|
81
|
-
thinking: provider
|
|
120
|
+
thinking: getThinkingLevel(provider),
|
|
82
121
|
context_window: getContextWindow(provider),
|
|
83
122
|
max_output_tokens: getMaxOutputTokens(provider)
|
|
84
123
|
};
|
|
@@ -87,7 +126,9 @@ function getContextWindow(provider) {
|
|
|
87
126
|
return Number.isSafeInteger(provider.context_window) && (provider.context_window ?? 0) > 0 ? provider.context_window ?? DEFAULT_CONTEXT_WINDOW : DEFAULT_CONTEXT_WINDOW;
|
|
88
127
|
}
|
|
89
128
|
function getMaxOutputTokens(provider) {
|
|
90
|
-
|
|
129
|
+
const configured = provider.max_output_tokens;
|
|
130
|
+
const maxOutput = Number.isSafeInteger(configured) && (configured ?? 0) > 0 ? configured ?? DEFAULT_MAX_OUTPUT_TOKENS : DEFAULT_MAX_OUTPUT_TOKENS;
|
|
131
|
+
return Math.min(maxOutput, getContextWindow(provider));
|
|
91
132
|
}
|
|
92
133
|
function resolveAPIKey(p) {
|
|
93
134
|
if (p.api_key) {
|
|
@@ -216,41 +257,6 @@ function loadSingleFile(path) {
|
|
|
216
257
|
enable_fork: enableFork
|
|
217
258
|
};
|
|
218
259
|
}
|
|
219
|
-
function mergeConfig(base, override) {
|
|
220
|
-
if (override.providers.length > 0) {
|
|
221
|
-
base.providers = override.providers;
|
|
222
|
-
}
|
|
223
|
-
if (override.permission_mode) {
|
|
224
|
-
base.permission_mode = override.permission_mode;
|
|
225
|
-
}
|
|
226
|
-
if (override.mcp_servers.length > 0) {
|
|
227
|
-
const mcpToIdx = /* @__PURE__ */ new Map();
|
|
228
|
-
for (let i = 0; i < base.mcp_servers.length; i++) {
|
|
229
|
-
const mcp = base.mcp_servers[i];
|
|
230
|
-
mcpToIdx.set(mcp.name, i);
|
|
231
|
-
}
|
|
232
|
-
for (const s of override.mcp_servers) {
|
|
233
|
-
const idx = mcpToIdx.get(s.name);
|
|
234
|
-
if (idx !== void 0) {
|
|
235
|
-
base.mcp_servers[idx] = s;
|
|
236
|
-
} else {
|
|
237
|
-
base.mcp_servers.push(s);
|
|
238
|
-
mcpToIdx.set(s.name, base.mcp_servers.length - 1);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
base.hooks = [...base.hooks, ...override.hooks];
|
|
243
|
-
if (override.sandbox) {
|
|
244
|
-
base.sandbox = { ...base.sandbox, ...override.sandbox };
|
|
245
|
-
}
|
|
246
|
-
if (override.enable_coordinator_mode) {
|
|
247
|
-
base.enable_coordinator_mode = true;
|
|
248
|
-
}
|
|
249
|
-
if (override.enable_fork !== void 0) {
|
|
250
|
-
base.enable_fork = override.enable_fork;
|
|
251
|
-
}
|
|
252
|
-
return base;
|
|
253
|
-
}
|
|
254
260
|
function validateProviders(config) {
|
|
255
261
|
if (config.providers.length === 0) {
|
|
256
262
|
throw new ConfigError("At least one provider MUST be configured.");
|
|
@@ -277,43 +283,30 @@ function validateProviders(config) {
|
|
|
277
283
|
}
|
|
278
284
|
function loadConfig(path, options = {}) {
|
|
279
285
|
if (path) {
|
|
280
|
-
const
|
|
281
|
-
if (!options.allowEmptyProviders ||
|
|
282
|
-
validateProviders(
|
|
283
|
-
}
|
|
284
|
-
return config;
|
|
285
|
-
}
|
|
286
|
-
const wd = process.cwd();
|
|
287
|
-
const home = homedir();
|
|
288
|
-
const candidates = [
|
|
289
|
-
join(home, ".swifty", "config.yaml"),
|
|
290
|
-
join(wd, ".swifty", "config.yaml"),
|
|
291
|
-
join(wd, ".swifty", "config.local.yaml")
|
|
292
|
-
];
|
|
293
|
-
let merged = null;
|
|
294
|
-
for (const candidate of candidates) {
|
|
295
|
-
if (!existsSync(candidate)) {
|
|
296
|
-
continue;
|
|
297
|
-
}
|
|
298
|
-
const layer = loadSingleFile(candidate);
|
|
299
|
-
if (!merged) {
|
|
300
|
-
merged = layer;
|
|
301
|
-
} else {
|
|
302
|
-
merged = mergeConfig(merged, layer);
|
|
286
|
+
const config2 = loadSingleFile(path);
|
|
287
|
+
if (!options.allowEmptyProviders || config2.providers.length > 0) {
|
|
288
|
+
validateProviders(config2);
|
|
303
289
|
}
|
|
290
|
+
return config2;
|
|
304
291
|
}
|
|
305
|
-
|
|
292
|
+
const candidate = globalConfigPath();
|
|
293
|
+
if (!existsSync(candidate)) {
|
|
306
294
|
if (options.allowEmptyProviders) {
|
|
307
295
|
return { providers: [], mcp_servers: [], hooks: [] };
|
|
308
296
|
}
|
|
297
|
+
const legacy = [
|
|
298
|
+
join(process.cwd(), ".swifty/config.yaml"),
|
|
299
|
+
join(process.cwd(), ".swifty/config.local.yaml")
|
|
300
|
+
].filter((legacyPath) => existsSync(legacyPath)).join(", ");
|
|
309
301
|
throw new ConfigError(
|
|
310
|
-
|
|
302
|
+
`No config file found, expected ${candidate}.` + (legacy ? ` Found project config at ${legacy}; move it to ${candidate}.` : "")
|
|
311
303
|
);
|
|
312
304
|
}
|
|
313
|
-
|
|
314
|
-
|
|
305
|
+
const config = loadSingleFile(candidate);
|
|
306
|
+
if (!options.allowEmptyProviders || config.providers.length > 0) {
|
|
307
|
+
validateProviders(config);
|
|
315
308
|
}
|
|
316
|
-
return
|
|
309
|
+
return config;
|
|
317
310
|
}
|
|
318
311
|
|
|
319
312
|
// src/conversation/pairing.ts
|
|
@@ -374,17 +367,24 @@ export {
|
|
|
374
367
|
NetworkError,
|
|
375
368
|
ContextTooLongError,
|
|
376
369
|
ConfigError,
|
|
370
|
+
globalConfigPath,
|
|
371
|
+
THINKING_LEVELS,
|
|
377
372
|
ProviderConfigSchema,
|
|
378
|
-
|
|
373
|
+
DEFAULT_THINKING_LEVEL,
|
|
379
374
|
DEFAULT_CONTEXT_WINDOW,
|
|
380
375
|
DEFAULT_MAX_OUTPUT_TOKENS,
|
|
376
|
+
THINKING_BUDGETS,
|
|
377
|
+
isValidThinkingLevel,
|
|
378
|
+
defaultThinkingLevelFor,
|
|
379
|
+
getThinkingLevel,
|
|
380
|
+
thinkingBudgetForLevel,
|
|
381
|
+
toReasoningEffort,
|
|
381
382
|
withProviderDefaults,
|
|
382
383
|
getContextWindow,
|
|
383
384
|
getMaxOutputTokens,
|
|
384
385
|
resolveAPIKey,
|
|
385
386
|
HookConfigSchema,
|
|
386
387
|
forkEnabled,
|
|
387
|
-
mergeConfig,
|
|
388
388
|
loadConfig,
|
|
389
389
|
INTERRUPTED_TOOL_RESULT,
|
|
390
390
|
REJECTED_TOOL_RESULT,
|
package/dist/lib/glob.wasm
CHANGED
|
Binary file
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -445,6 +445,15 @@ declare class ConversationManager {
|
|
|
445
445
|
declare class ConfigError extends Error {
|
|
446
446
|
constructor(message: string);
|
|
447
447
|
}
|
|
448
|
+
/** The single global config file: $HOME/.swifty/config.yaml. */
|
|
449
|
+
declare function globalConfigPath(): string;
|
|
450
|
+
/**
|
|
451
|
+
* PI-equivalent thinking levels. `off` disables reasoning entirely; the rest
|
|
452
|
+
* map to a provider-native effort string (openai / openai-compat) or a thinking
|
|
453
|
+
* token budget (anthropic).
|
|
454
|
+
*/
|
|
455
|
+
declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
456
|
+
type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
448
457
|
declare const ProviderConfigSchema: z.ZodObject<{
|
|
449
458
|
name: z.ZodString;
|
|
450
459
|
protocol: z.ZodEnum<{
|
|
@@ -455,16 +464,54 @@ declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
455
464
|
base_url: z.ZodString;
|
|
456
465
|
model: z.ZodString;
|
|
457
466
|
api_key: z.ZodOptional<z.ZodString>;
|
|
458
|
-
thinking: z.ZodOptional<z.ZodBoolean
|
|
467
|
+
thinking: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodEnum<{
|
|
468
|
+
off: "off";
|
|
469
|
+
minimal: "minimal";
|
|
470
|
+
low: "low";
|
|
471
|
+
medium: "medium";
|
|
472
|
+
high: "high";
|
|
473
|
+
xhigh: "xhigh";
|
|
474
|
+
max: "max";
|
|
475
|
+
}>]>>;
|
|
459
476
|
context_window: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
460
477
|
max_output_tokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
461
478
|
}, z.core.$strip>;
|
|
462
479
|
type ProviderConfig = z.infer<typeof ProviderConfigSchema>;
|
|
463
|
-
declare const
|
|
480
|
+
declare const DEFAULT_THINKING_LEVEL: ThinkingLevel;
|
|
464
481
|
declare const DEFAULT_CONTEXT_WINDOW = 1000000;
|
|
482
|
+
/**
|
|
483
|
+
* Fallback output-token ceiling used when `max_output_tokens` is unset (PI's
|
|
484
|
+
* custom-model `maxTokens` default).
|
|
485
|
+
*/
|
|
465
486
|
declare const DEFAULT_MAX_OUTPUT_TOKENS = 128000;
|
|
487
|
+
/**
|
|
488
|
+
* PI-equivalent thinking token budgets, used by the anthropic budget-based
|
|
489
|
+
* thinking path. Must stay below DEFAULT_MAX_OUTPUT_TOKENS so the answer keeps
|
|
490
|
+
* room after the thinking budget is reserved.
|
|
491
|
+
*/
|
|
492
|
+
declare const THINKING_BUDGETS: Record<Exclude<ThinkingLevel, "off">, number>;
|
|
493
|
+
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. */
|
|
502
|
+
declare function getThinkingLevel(provider: ProviderConfig): ThinkingLevel;
|
|
503
|
+
/** Thinking token budget for a level; 0 when thinking is off. */
|
|
504
|
+
declare function thinkingBudgetForLevel(level: ThinkingLevel): number;
|
|
505
|
+
/** Map a PI thinking level to an OpenAI reasoning effort string. */
|
|
506
|
+
declare function toReasoningEffort(level: ThinkingLevel): "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
466
507
|
declare function withProviderDefaults(provider: ProviderConfig): ProviderConfig;
|
|
467
508
|
declare function getContextWindow(provider: ProviderConfig): number;
|
|
509
|
+
/**
|
|
510
|
+
* Effective output cap for a provider. Configured value wins, otherwise the
|
|
511
|
+
* 128k fallback applies; the result never exceeds the context window (PI's
|
|
512
|
+
* `clampMaxTokensToContext`). This keeps small-output models from being sent an
|
|
513
|
+
* over-large `max_tokens` while still letting users lower the cap.
|
|
514
|
+
*/
|
|
468
515
|
declare function getMaxOutputTokens(provider: ProviderConfig): number;
|
|
469
516
|
declare function resolveAPIKey(p: ProviderConfig): string;
|
|
470
517
|
declare const MCPServerConfigSchema: z.ZodObject<{
|
|
@@ -511,7 +558,15 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
511
558
|
base_url: z.ZodString;
|
|
512
559
|
model: z.ZodString;
|
|
513
560
|
api_key: z.ZodOptional<z.ZodString>;
|
|
514
|
-
thinking: z.ZodOptional<z.ZodBoolean
|
|
561
|
+
thinking: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodEnum<{
|
|
562
|
+
off: "off";
|
|
563
|
+
minimal: "minimal";
|
|
564
|
+
low: "low";
|
|
565
|
+
medium: "medium";
|
|
566
|
+
high: "high";
|
|
567
|
+
xhigh: "xhigh";
|
|
568
|
+
max: "max";
|
|
569
|
+
}>]>>;
|
|
515
570
|
context_window: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
516
571
|
max_output_tokens: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
517
572
|
}, z.core.$strip>>;
|
|
@@ -552,7 +607,6 @@ declare const AppConfigSchema: z.ZodObject<{
|
|
|
552
607
|
/** Whether fork is available. Defaults to enabled when not specified in config. */
|
|
553
608
|
declare function forkEnabled(cfg: AppConfig): boolean;
|
|
554
609
|
type AppConfig = z.infer<typeof AppConfigSchema>;
|
|
555
|
-
declare function mergeConfig(base: AppConfig, override: AppConfig): AppConfig;
|
|
556
610
|
declare function loadConfig(path?: string, options?: {
|
|
557
611
|
allowEmptyProviders?: boolean;
|
|
558
612
|
}): AppConfig;
|
|
@@ -696,10 +750,13 @@ declare class OpenAIClient implements LLMClient {
|
|
|
696
750
|
private model;
|
|
697
751
|
private systemPrompt;
|
|
698
752
|
private maxOutputTokens;
|
|
753
|
+
private thinkingLevel;
|
|
699
754
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
700
755
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
701
756
|
setSystemPrompt(prompt: string): void;
|
|
702
757
|
setMaxOutputTokens(maxTokens: number): void;
|
|
758
|
+
setThinkingLevel(level: ThinkingLevel): void;
|
|
759
|
+
getThinkingLevel(): ThinkingLevel;
|
|
703
760
|
}
|
|
704
761
|
type OpenAIMessageParam = OpenAI.Responses.EasyInputMessage | OpenAI.Responses.ResponseFunctionToolCall | OpenAI.Responses.ResponseInputItem.FunctionCallOutput | OpenAI.Responses.ResponseReasoningItem;
|
|
705
762
|
declare function buildOpenAIInput(messages: Message[]): OpenAIMessageParam[];
|
|
@@ -708,9 +765,12 @@ declare class OpenAICompatClient implements LLMClient {
|
|
|
708
765
|
private model;
|
|
709
766
|
private systemPrompt;
|
|
710
767
|
private maxOutputTokens;
|
|
768
|
+
private thinkingLevel;
|
|
711
769
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
712
770
|
setSystemPrompt(prompt: string): void;
|
|
713
771
|
setMaxOutputTokens(maxTokens: number): void;
|
|
772
|
+
setThinkingLevel(level: ThinkingLevel): void;
|
|
773
|
+
getThinkingLevel(): ThinkingLevel;
|
|
714
774
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
715
775
|
}
|
|
716
776
|
declare function buildChatCompletionMessages(messages: Message[]): OpenAI.ChatCompletionMessageParam[];
|
|
@@ -762,15 +822,17 @@ declare class AnthropicClient implements LLMClient {
|
|
|
762
822
|
private client;
|
|
763
823
|
private model;
|
|
764
824
|
/**
|
|
765
|
-
*
|
|
825
|
+
* PI-equivalent thinking level; maps to a thinking token budget.
|
|
766
826
|
*/
|
|
767
|
-
private
|
|
827
|
+
private thinkingLevel;
|
|
768
828
|
private systemPrompt;
|
|
769
829
|
private maxOutputTokens;
|
|
770
830
|
/** Currently not used */
|
|
771
831
|
constructor(config: ProviderConfig, systemPrompt: string);
|
|
772
832
|
setSystemPrompt(prompt: string): void;
|
|
773
833
|
setMaxOutputTokens(maxTokens: number): void;
|
|
834
|
+
setThinkingLevel(level: ThinkingLevel): void;
|
|
835
|
+
getThinkingLevel(): ThinkingLevel;
|
|
774
836
|
stream(conversation: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
775
837
|
}
|
|
776
838
|
/**
|
|
@@ -778,13 +840,18 @@ declare class AnthropicClient implements LLMClient {
|
|
|
778
840
|
*/
|
|
779
841
|
declare function markLastUserTailForCache(messages: Anthropic.Messages.MessageParam[]): void;
|
|
780
842
|
|
|
781
|
-
interface LLMClient extends Partial<MaxTokensSetter> {
|
|
843
|
+
interface LLMClient extends Partial<MaxTokensSetter>, Partial<ThinkingLevelControl> {
|
|
782
844
|
stream(conversationManager: ConversationManager, toolSchemas: ToolSchema[], abortSignal?: AbortSignal): AsyncGenerator<StreamEvent>;
|
|
783
845
|
setSystemPrompt(prompt: string): void;
|
|
784
846
|
}
|
|
785
847
|
interface MaxTokensSetter {
|
|
786
848
|
setMaxOutputTokens(maxTokens: number): void;
|
|
787
849
|
}
|
|
850
|
+
/** Runtime control of the PI-equivalent thinking level. */
|
|
851
|
+
interface ThinkingLevelControl {
|
|
852
|
+
setThinkingLevel(level: ThinkingLevel): void;
|
|
853
|
+
getThinkingLevel(): ThinkingLevel;
|
|
854
|
+
}
|
|
788
855
|
declare function createClient(config: ProviderConfig, systemPrompt: string): Promise<AnthropicClient | OpenAIClient | OpenAICompatClient>;
|
|
789
856
|
|
|
790
857
|
/**
|
|
@@ -1308,6 +1375,7 @@ declare class StreamingExecutor {
|
|
|
1308
1375
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1309
1376
|
* SOFTWARE.
|
|
1310
1377
|
*/
|
|
1378
|
+
|
|
1311
1379
|
type CommandType = "local" | "local_ui" | "prompt" | "skill_fork";
|
|
1312
1380
|
interface CommandContext {
|
|
1313
1381
|
workDir: string;
|
|
@@ -1326,6 +1394,12 @@ interface CommandContext {
|
|
|
1326
1394
|
memoryClear?: () => void;
|
|
1327
1395
|
/** Returns the current model name */
|
|
1328
1396
|
model?: string;
|
|
1397
|
+
/** Returns the current thinking level */
|
|
1398
|
+
thinkingLevel?: () => ThinkingLevel;
|
|
1399
|
+
/** Sets the thinking level for the active client */
|
|
1400
|
+
setThinkingLevel?: (level: ThinkingLevel) => void;
|
|
1401
|
+
/** Persists the thinking level to the global config; throws on failure */
|
|
1402
|
+
persistThinkingLevel?: (level: ThinkingLevel) => void;
|
|
1329
1403
|
}
|
|
1330
1404
|
interface Command {
|
|
1331
1405
|
name: string;
|
|
@@ -2796,10 +2870,9 @@ interface InstructionSource {
|
|
|
2796
2870
|
*
|
|
2797
2871
|
* Discovery order (later entries take higher precedence — the model attends
|
|
2798
2872
|
* more to content appearing later):
|
|
2799
|
-
* 1. User-global: ~/.swifty/
|
|
2800
|
-
* 2. Project:
|
|
2873
|
+
* 1. User-global: ~/.swifty/AGENTS.md
|
|
2874
|
+
* 2. Project: AGENTS.md, and .swifty/AGENTS.md in every
|
|
2801
2875
|
* directory from the git root down to workDir
|
|
2802
|
-
* 3. workDir/SWIFTY.local.md (local private override)
|
|
2803
2876
|
*
|
|
2804
2877
|
* Supports @include directives:
|
|
2805
2878
|
* - @./relative/path, @~/home/path, @/absolute/path
|
|
@@ -5366,4 +5439,4 @@ declare class TaskUpdateTool implements Tool {
|
|
|
5366
5439
|
execute(ctx: ToolContext, args: Record<string, unknown>): Promise<ToolResult>;
|
|
5367
5440
|
}
|
|
5368
5441
|
|
|
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,
|
|
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, defaultThinkingLevelFor, detectBackend, detectBackendFromEnv, detectEnvironment, detectIde, discoverInstructions, doingTasksSection, ensureToolPairing, environmentSection, estimateMessages, estimateSchemaTokens, estimateTokens, evaluateRules, executingActionsSection, expandAtRefs, expandAtRefsWithImages, extractContent, fetchModelContextWindow, fileHistoryDir, filterToolsForAgent, forceCompact, forkEnabled, formatTokens, getContextWindow, getCurrentBranch, getCurrentPlanPath, getMaxOutputTokens, getMediaType, getNameRegistry, getOrCreatePlanPath, getSessionFilePath, 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, 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, toDisplayPreview, toReasoningEffort, toTry, toneStyleSection, toolResultsToRecords, toolUsesToRecords, usingToolsSection, validate, version, withProviderDefaults, writeTeamFile };
|