@swifty.js/swifty 0.0.36 → 0.0.37
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 +8 -8
- package/dist/{acp-ZU5LZRUP.js → acp-R22FJPVN.js} +1 -1
- package/dist/{agent-YDU6HB4S.js → agent-WOWGQDBG.js} +1 -1
- package/dist/anthropic-3DXT42SN.js +4 -0
- package/dist/{chunk-MTAGHTBG.js → chunk-ENZ5LHRN.js} +4 -4
- package/dist/{chunk-RDVRYI56.js → chunk-FOPUR6OB.js} +11 -11
- package/dist/{chunk-EEEW3GG4.js → chunk-LW273HD5.js} +1 -1
- package/dist/{chunk-Q3NPRV5P.js → chunk-QBGGDF62.js} +1 -1
- package/dist/{chunk-MNP6IJ7C.js → chunk-R62BGTT4.js} +2 -2
- package/dist/chunk-S2VEXEVV.js +4 -0
- package/dist/{chunk-H56UQALW.js → chunk-VN7HK3YD.js} +1 -1
- package/dist/chunk-YBS5ATGZ.js +4 -0
- package/dist/esm-VBV56AO5.js +229 -0
- package/dist/lib/{agent-ZMIS6IH6.js → agent-ZSFK66FQ.js} +2 -2
- package/dist/lib/{anthropic-FKIGL7NL.js → anthropic-GD3ILYG6.js} +1 -1
- package/dist/lib/{chunk-YUDCYSKO.js → chunk-5OJV33Y2.js} +17 -9
- package/dist/lib/{chunk-LRN4MOQ3.js → chunk-GWZDEU27.js} +0 -5
- package/dist/lib/{chunk-ALQHMYOZ.js → chunk-LKFJIK6F.js} +0 -3
- package/dist/lib/{chunk-PJ7354ZG.js → chunk-O35GIE35.js} +1 -1
- package/dist/lib/{chunk-6V7RW6HA.js → chunk-TD7Z6L4D.js} +10 -13
- package/dist/lib/index.d.ts +215 -491
- package/dist/lib/index.js +17 -358
- package/dist/lib/{openai-ZWIYIBLC.js → openai-N6X7XUQJ.js} +1 -1
- package/dist/lib/{providers-5SJFTU2G.js → providers-WQ3UOLMF.js} +1 -1
- package/dist/lib/{tool-filter-QU4LOZII.js → tool-filter-S3ZZOXFD.js} +1 -1
- package/dist/main.js +164 -164
- package/dist/{openai-7LMX5HKW.js → openai-XMJVVTTX.js} +1 -1
- package/dist/{providers-FQCJFM3Q.js → providers-NWLGMQOZ.js} +1 -1
- package/dist/{server-C6H5ZWUG.js → server-TINTK5DM.js} +1 -1
- package/dist/{tool-filter-U5SSL3LR.js → tool-filter-QETBQPHL.js} +1 -1
- package/package.json +2 -2
- package/dist/anthropic-GDT73MMP.js +0 -4
- package/dist/chunk-I7XJSLRI.js +0 -4
- package/dist/chunk-UJGMTIYO.js +0 -4
- package/dist/esm-PDXUGWFK.js +0 -229
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
Agent,
|
|
3
3
|
events_exports,
|
|
4
4
|
streaming_executor_exports
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-5OJV33Y2.js";
|
|
6
|
+
import "./chunk-O35GIE35.js";
|
|
7
7
|
import "./chunk-BQFVUVLI.js";
|
|
8
8
|
import "./chunk-HQSYRTER.js";
|
|
9
9
|
import "./chunk-OLFXCZVH.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
providers_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O35GIE35.js";
|
|
4
4
|
import {
|
|
5
5
|
normalizeToolResultContentBlock
|
|
6
6
|
} from "./chunk-BQFVUVLI.js";
|
|
@@ -104,7 +104,7 @@ async function initializeTelemetry() {
|
|
|
104
104
|
if (!shouldInitialize()) {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
initialization = import("./providers-
|
|
107
|
+
initialization = import("./providers-WQ3UOLMF.js").then(async ({ createTelemetryRuntime }) => {
|
|
108
108
|
runtime = await createTelemetryRuntime();
|
|
109
109
|
runtime.setMode(mode);
|
|
110
110
|
process.once("beforeExit", () => {
|
|
@@ -995,7 +995,7 @@ async function compressWithSharp(buf, mediaType2) {
|
|
|
995
995
|
}
|
|
996
996
|
|
|
997
997
|
// src/conversation/at-expand.ts
|
|
998
|
-
var log4 = createChildLogger({ module: "
|
|
998
|
+
var log4 = createChildLogger({ module: "terminal" });
|
|
999
999
|
var MAX_INLINE_BYTES = 1e5;
|
|
1000
1000
|
var MAX_RANGE_FILE_BYTES = 1e7;
|
|
1001
1001
|
function parseRef(ref) {
|
|
@@ -1060,7 +1060,7 @@ ${readFileSync3(p, "utf-8")}
|
|
|
1060
1060
|
</file>`;
|
|
1061
1061
|
}
|
|
1062
1062
|
} catch (err) {
|
|
1063
|
-
log4.error({ err }, "
|
|
1063
|
+
log4.error({ err }, "UI operation failed");
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
1066
|
return appendix ? text + appendix : text;
|
|
@@ -1106,7 +1106,7 @@ Error: too many images attached (limit ${String(MAX_IMAGES_PER_MESSAGE)} per mes
|
|
|
1106
1106
|
|
|
1107
1107
|
<image type="base64" media_type="${attachment.mediaType}" path="${refPath}" />`;
|
|
1108
1108
|
} catch (err) {
|
|
1109
|
-
log4.error({ err }, "
|
|
1109
|
+
log4.error({ err }, "UI operation failed");
|
|
1110
1110
|
}
|
|
1111
1111
|
} else if (lineStart !== void 0 && lineEnd !== void 0) {
|
|
1112
1112
|
if (st.size <= MAX_RANGE_FILE_BYTES) {
|
|
@@ -1127,7 +1127,7 @@ ${readFileSync3(p, "utf-8")}
|
|
|
1127
1127
|
</file>`;
|
|
1128
1128
|
}
|
|
1129
1129
|
} catch (err) {
|
|
1130
|
-
log4.error({ err }, "
|
|
1130
|
+
log4.error({ err }, "UI operation failed");
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
1133
|
const expanded = appendix ? text + appendix : text;
|
|
@@ -2676,7 +2676,11 @@ ${body}`)
|
|
|
2676
2676
|
this.abortSignal
|
|
2677
2677
|
);
|
|
2678
2678
|
if (mc.message) {
|
|
2679
|
-
yield {
|
|
2679
|
+
yield {
|
|
2680
|
+
type: "compact",
|
|
2681
|
+
message: mc.message,
|
|
2682
|
+
boundary: mc.boundary
|
|
2683
|
+
};
|
|
2680
2684
|
}
|
|
2681
2685
|
if (mc.compacted) {
|
|
2682
2686
|
this.restoreContext();
|
|
@@ -2830,7 +2834,11 @@ ${body}`)
|
|
|
2830
2834
|
"Output token limit hit. Resume directly from where you stopped. Do not apologize or repeat previous content. Pick up mid-thought if needed."
|
|
2831
2835
|
);
|
|
2832
2836
|
}
|
|
2833
|
-
yield {
|
|
2837
|
+
yield {
|
|
2838
|
+
type: "retry",
|
|
2839
|
+
reason: "max_tokens escalation",
|
|
2840
|
+
delay: 0
|
|
2841
|
+
};
|
|
2834
2842
|
continue;
|
|
2835
2843
|
} else if (outputRecoveries < MAX_TOKENS_RECOVERIES) {
|
|
2836
2844
|
outputRecoveries++;
|
|
@@ -3217,7 +3225,7 @@ ${body}`)
|
|
|
3217
3225
|
* Persist the most recently appended conversation message to the session log.
|
|
3218
3226
|
*
|
|
3219
3227
|
* Persistence lives in the main loop rather than in individual frontends: both
|
|
3220
|
-
* the
|
|
3228
|
+
* the UI and Web share the same recording path, ensuring intermediate assistant
|
|
3221
3229
|
* text and complete tool-call chains are captured for session restoration.
|
|
3222
3230
|
* Skipped when sessionId is empty (one-shot invocations, sub-agents).
|
|
3223
3231
|
*/
|
|
@@ -73,11 +73,6 @@ var ToolRegistry = class {
|
|
|
73
73
|
if (deferred && !native) {
|
|
74
74
|
continue;
|
|
75
75
|
}
|
|
76
|
-
const providerSchema = protocol ? tool.providerSchema?.(resolvedProtocol) : void 0;
|
|
77
|
-
if (providerSchema) {
|
|
78
|
-
schemas.push(providerSchema);
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
76
|
const s = tool.schema();
|
|
82
77
|
if (resolvedProtocol === "openai") {
|
|
83
78
|
schemas.push({
|
|
@@ -138,17 +138,16 @@ function markToolsForCache(tools) {
|
|
|
138
138
|
function needsToolSearchBeta(toolSchemas) {
|
|
139
139
|
return toolSchemas.some((schema) => "defer_loading" in schema && schema.defer_loading === true);
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
function toAnthropicToolSchema(schema) {
|
|
143
|
-
if ("type" in schema && schema.type === "computer_20251124") {
|
|
144
|
-
return { ...schema };
|
|
145
|
-
}
|
|
141
|
+
function toAnthropicToolSchema(schema, useExplicitCustomType) {
|
|
146
142
|
if ("input_schema" in schema) {
|
|
147
143
|
const tool = schema;
|
|
148
144
|
const { cache_control: cacheControl, ...rest } = tool;
|
|
145
|
+
if (!useExplicitCustomType) {
|
|
146
|
+
delete rest.type;
|
|
147
|
+
}
|
|
149
148
|
return {
|
|
150
149
|
...rest,
|
|
151
|
-
type: "custom",
|
|
150
|
+
...useExplicitCustomType ? { type: "custom" } : {},
|
|
152
151
|
...tool.defer_loading !== true && cacheControl ? { cache_control: cacheControl } : {}
|
|
153
152
|
};
|
|
154
153
|
}
|
|
@@ -304,6 +303,7 @@ var AnthropicClient = class {
|
|
|
304
303
|
systemPrompt;
|
|
305
304
|
maxOutputTokens;
|
|
306
305
|
config;
|
|
306
|
+
useExplicitCustomToolType;
|
|
307
307
|
constructor(config, systemPrompt) {
|
|
308
308
|
const apiKey = resolveAPIKey(config);
|
|
309
309
|
if (!apiKey) {
|
|
@@ -315,6 +315,7 @@ var AnthropicClient = class {
|
|
|
315
315
|
apiKey,
|
|
316
316
|
baseURL: config.base_url
|
|
317
317
|
});
|
|
318
|
+
this.useExplicitCustomToolType = isOfficialAnthropicEndpoint(config.base_url);
|
|
318
319
|
this.model = config.model;
|
|
319
320
|
this.config = { ...config };
|
|
320
321
|
this.thinkingLevel = getThinkingLevel(config);
|
|
@@ -342,9 +343,8 @@ var AnthropicClient = class {
|
|
|
342
343
|
async *stream(conversation, toolSchemas, abortSignal) {
|
|
343
344
|
const messages = buildAnthropicMessages(ensureToolPairing(conversation.getMessages()));
|
|
344
345
|
const sendToolSearchBeta = needsToolSearchBeta(toolSchemas);
|
|
345
|
-
const antToolSchemas = toolSchemas.map(
|
|
346
|
-
|
|
347
|
-
(schema) => "type" in schema && schema.type === "computer_20251124"
|
|
346
|
+
const antToolSchemas = toolSchemas.map(
|
|
347
|
+
(schema) => toAnthropicToolSchema(schema, this.useExplicitCustomToolType)
|
|
348
348
|
);
|
|
349
349
|
markToolsForCache(antToolSchemas);
|
|
350
350
|
markLastUserTailForCache(messages);
|
|
@@ -400,10 +400,7 @@ var AnthropicClient = class {
|
|
|
400
400
|
let thinkingSignature = "";
|
|
401
401
|
let inThinking = false;
|
|
402
402
|
try {
|
|
403
|
-
const betas = [
|
|
404
|
-
...sendToolSearchBeta ? [NATIVE_TOOL_USE_BETA] : [],
|
|
405
|
-
...sendComputerUseBeta ? [COMPUTER_USE_BETA] : []
|
|
406
|
-
];
|
|
403
|
+
const betas = [...sendToolSearchBeta ? [NATIVE_TOOL_USE_BETA] : []];
|
|
407
404
|
const response = this.client.messages.stream(params, {
|
|
408
405
|
...abortSignal ? { signal: abortSignal } : {},
|
|
409
406
|
...betas.length > 0 ? { headers: { "anthropic-beta": betas.join(",") } } : {}
|