@swifty.js/swifty 0.0.36 → 0.0.38

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.
Files changed (35) hide show
  1. package/README.md +8 -8
  2. package/dist/{acp-ZU5LZRUP.js → acp-K6UNT7R2.js} +1 -1
  3. package/dist/{agent-YDU6HB4S.js → agent-TVRVBK2C.js} +1 -1
  4. package/dist/anthropic-3DXT42SN.js +4 -0
  5. package/dist/{chunk-EEEW3GG4.js → chunk-AN6IJDRD.js} +1 -1
  6. package/dist/chunk-CJZX34IA.js +4 -0
  7. package/dist/{chunk-MTAGHTBG.js → chunk-CTLUJRU3.js} +5 -5
  8. package/dist/{chunk-MNP6IJ7C.js → chunk-FITQ5CCD.js} +2 -2
  9. package/dist/{chunk-Q3NPRV5P.js → chunk-QBGGDF62.js} +1 -1
  10. package/dist/{chunk-H56UQALW.js → chunk-VN7HK3YD.js} +1 -1
  11. package/dist/chunk-YBS5ATGZ.js +4 -0
  12. package/dist/{chunk-RDVRYI56.js → chunk-Z4QZQ7X6.js} +16 -19
  13. package/dist/esm-VBV56AO5.js +229 -0
  14. package/dist/lib/{agent-ZMIS6IH6.js → agent-N64HDJ3J.js} +2 -2
  15. package/dist/lib/{anthropic-FKIGL7NL.js → anthropic-GD3ILYG6.js} +1 -1
  16. package/dist/lib/{chunk-PJ7354ZG.js → chunk-5QBKDZYN.js} +1 -1
  17. package/dist/lib/{chunk-YUDCYSKO.js → chunk-FPULYNJL.js} +17 -10
  18. package/dist/lib/{chunk-ALQHMYOZ.js → chunk-LKFJIK6F.js} +0 -3
  19. package/dist/lib/{chunk-LRN4MOQ3.js → chunk-OM7DYLTN.js} +0 -6
  20. package/dist/lib/{chunk-6V7RW6HA.js → chunk-TD7Z6L4D.js} +10 -13
  21. package/dist/lib/index.d.ts +224 -572
  22. package/dist/lib/index.js +64 -782
  23. package/dist/lib/{openai-ZWIYIBLC.js → openai-N6X7XUQJ.js} +1 -1
  24. package/dist/lib/{providers-5SJFTU2G.js → providers-YRULZPXI.js} +1 -1
  25. package/dist/lib/{tool-filter-QU4LOZII.js → tool-filter-UULMJRDQ.js} +1 -1
  26. package/dist/main.js +171 -219
  27. package/dist/{openai-7LMX5HKW.js → openai-XMJVVTTX.js} +1 -1
  28. package/dist/{providers-FQCJFM3Q.js → providers-6YCHQM6N.js} +1 -1
  29. package/dist/{server-C6H5ZWUG.js → server-OHPTZAGM.js} +1 -1
  30. package/dist/{tool-filter-U5SSL3LR.js → tool-filter-NRC4U62K.js} +1 -1
  31. package/package.json +2 -3
  32. package/dist/anthropic-GDT73MMP.js +0 -4
  33. package/dist/chunk-I7XJSLRI.js +0 -4
  34. package/dist/chunk-UJGMTIYO.js +0 -4
  35. 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-YUDCYSKO.js";
6
- import "./chunk-PJ7354ZG.js";
5
+ } from "./chunk-FPULYNJL.js";
6
+ import "./chunk-5QBKDZYN.js";
7
7
  import "./chunk-BQFVUVLI.js";
8
8
  import "./chunk-HQSYRTER.js";
9
9
  import "./chunk-OLFXCZVH.js";
@@ -5,7 +5,7 @@ import {
5
5
  markLastUserTailForCache,
6
6
  markToolsForCache,
7
7
  needsToolSearchBeta
8
- } from "./chunk-6V7RW6HA.js";
8
+ } from "./chunk-TD7Z6L4D.js";
9
9
  import "./chunk-BQFVUVLI.js";
10
10
  import "./chunk-HQSYRTER.js";
11
11
  import "./chunk-OLFXCZVH.js";
@@ -47,7 +47,7 @@ var PackageJsonSchema = z.object({
47
47
  });
48
48
  function resolveVersion() {
49
49
  if (true) {
50
- return "0.0.36";
50
+ return "0.0.38";
51
51
  }
52
52
  const here = path.dirname(fileURLToPath(import.meta.url));
53
53
  for (const levels of ["..", "../.."]) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  providers_exports
3
- } from "./chunk-PJ7354ZG.js";
3
+ } from "./chunk-5QBKDZYN.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-5SJFTU2G.js").then(async ({ createTelemetryRuntime }) => {
107
+ initialization = import("./providers-YRULZPXI.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: "tui" });
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 }, "TUI operation failed");
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 }, "TUI operation failed");
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 }, "TUI operation failed");
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 { type: "compact", message: mc.message, boundary: mc.boundary };
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 { type: "retry", reason: "max_tokens escalation", delay: 0 };
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 TUI and Web share the same recording path, ensuring intermediate assistant
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
  */
@@ -3290,7 +3298,6 @@ export {
3290
3298
  TOOL_RESULT_PREVIEW_CHARS,
3291
3299
  spillDir,
3292
3300
  buildPersistedOutputPreview,
3293
- persistLargeResult,
3294
3301
  tool_result_exports,
3295
3302
  events_exports,
3296
3303
  Agent,
@@ -72,9 +72,6 @@ function computerCallArguments(item) {
72
72
  };
73
73
  }
74
74
  function toOpenAIResponsesTool(schema) {
75
- if ("type" in schema && schema.type === "computer") {
76
- return { ...schema };
77
- }
78
75
  if ("input_schema" in schema) {
79
76
  const tool = schema;
80
77
  return {
@@ -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({
@@ -178,7 +173,6 @@ var ASYNC_AGENT_ALLOWED_TOOLS = /* @__PURE__ */ new Set([
178
173
  "Grep",
179
174
  "Glob",
180
175
  "Bash",
181
- "JavaScript",
182
176
  "PowerShell",
183
177
  "EditFile",
184
178
  "WriteFile",
@@ -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
- var COMPUTER_USE_BETA = "computer-use-2025-11-24";
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(toAnthropicToolSchema);
346
- const sendComputerUseBeta = antToolSchemas.some(
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(",") } } : {}