dsh-any-deepseek 0.0.21 → 0.0.23

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/lib/adapter.d.ts CHANGED
@@ -202,6 +202,17 @@ export declare function collectImages(options: GenerateOptions, readImage: Adapt
202
202
  * @returns a pi-ai context plus the one-shot system prompt, when the caller set one.
203
203
  */
204
204
  export declare function toPiContext(options: GenerateOptions, images?: ImageBytes): PiContext;
205
+ /**
206
+ * 🔴 **DELETED: `textBlocks()` — do not reintroduce a text-only tool-result converter.**
207
+ *
208
+ * It mapped tool results to `{type:'text'}[]` only, justified by a comment claiming "tool results
209
+ * carry no images once projected". No layer enforces that: pi-ai types tool-result content as
210
+ * `(TextContent | ImageContent)[]` and the host converts tool messages through its user-message
211
+ * image path. The comment made a silent data loss look like a contract.
212
+ *
213
+ * The tool branch now uses {@link userContent}, so a `read_image` result reaches the model with
214
+ * its bytes — and an unreadable one becomes a visible placeholder instead of vanishing.
215
+ */
205
216
  /** Map pi-ai usage onto the harness's disjoint counters. */
206
217
  export declare function toTokenUsage(usage: AssistantMessage['usage']): TokenUsage;
207
218
  /**
package/lib/index.js CHANGED
@@ -1017,7 +1017,7 @@ function toPiContext(options, images) {
1017
1017
  role: "toolResult",
1018
1018
  toolCallId: message.toolCallId,
1019
1019
  toolName: "tool",
1020
- content: textBlocks(message.content),
1020
+ content: userContent(message.content, images),
1021
1021
  isError: message.isError ?? false,
1022
1022
  timestamp: 0
1023
1023
  };
@@ -1106,18 +1106,17 @@ function userContent(content, images) {
1106
1106
  }
1107
1107
  return out;
1108
1108
  }
1109
- /** Map harness content blocks to pi-ai text blocks (tool results carry no images once projected). */
1110
- function textBlocks(content) {
1111
- const out = [];
1112
- for (const block of content) {
1113
- const typed = block;
1114
- if (typed.type === "text" && typeof typed.text === "string") out.push({
1115
- type: "text",
1116
- text: typed.text
1117
- });
1118
- }
1119
- return out;
1120
- }
1109
+ /**
1110
+ * 🔴 **DELETED: `textBlocks()` — do not reintroduce a text-only tool-result converter.**
1111
+ *
1112
+ * It mapped tool results to `{type:'text'}[]` only, justified by a comment claiming "tool results
1113
+ * carry no images once projected". No layer enforces that: pi-ai types tool-result content as
1114
+ * `(TextContent | ImageContent)[]` and the host converts tool messages through its user-message
1115
+ * image path. The comment made a silent data loss look like a contract.
1116
+ *
1117
+ * The tool branch now uses {@link userContent}, so a `read_image` result reaches the model with
1118
+ * its bytes — and an unreadable one becomes a visible placeholder instead of vanishing.
1119
+ */
1121
1120
  /** Map pi-ai usage onto the harness's disjoint counters. */
1122
1121
  function toTokenUsage(usage) {
1123
1122
  const total = usage.totalTokens ?? usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-any-deepseek",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "One DeepSeek V4.1 Flash provider for DeepSeek Harness: paste a key per channel, switch channels manually, token usage booked per real upstream.",
5
5
  "license": "MIT",
6
6
  "repository": {