@co0ontty/wand 1.56.1 → 1.57.0
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/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
3
|
-
"builtAt": "2026-06-
|
|
4
|
-
"version": "1.
|
|
2
|
+
"commit": "ea7a7c74b5ed10ef88c0c20dade1ace6751e5b23",
|
|
3
|
+
"builtAt": "2026-06-12T15:05:55.316Z",
|
|
4
|
+
"version": "1.57.0",
|
|
5
5
|
"channel": "stable"
|
|
6
6
|
}
|
|
@@ -2041,7 +2041,7 @@ export class StructuredSessionManager {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
catch { /* partial json */ }
|
|
2043
2043
|
}
|
|
2044
|
-
block = { type: "tool_use", id: sb.id, name: sb.name, input };
|
|
2044
|
+
block = { type: "tool_use", id: sb.id, name: sb.name, input: this.normalizeToolInput(sb.name, input) };
|
|
2045
2045
|
}
|
|
2046
2046
|
if (!block)
|
|
2047
2047
|
continue;
|
|
@@ -2380,7 +2380,7 @@ export class StructuredSessionManager {
|
|
|
2380
2380
|
id: typedBlock.id,
|
|
2381
2381
|
name: typedBlock.name,
|
|
2382
2382
|
description: typeof typedBlock.description === "string" ? typedBlock.description : undefined,
|
|
2383
|
-
input: this.normalizeToolInput(typedBlock.input),
|
|
2383
|
+
input: this.normalizeToolInput(typedBlock.name, typedBlock.input),
|
|
2384
2384
|
});
|
|
2385
2385
|
}
|
|
2386
2386
|
}
|
|
@@ -2438,11 +2438,32 @@ export class StructuredSessionManager {
|
|
|
2438
2438
|
return [];
|
|
2439
2439
|
return current.queuedMessages;
|
|
2440
2440
|
}
|
|
2441
|
-
normalizeToolInput(input) {
|
|
2441
|
+
normalizeToolInput(name, input) {
|
|
2442
2442
|
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
2443
2443
|
return {};
|
|
2444
2444
|
}
|
|
2445
|
-
|
|
2445
|
+
const record = input;
|
|
2446
|
+
// `claude -p --output-format stream-json`(默认结构化 runner)有时把数组型工具参数
|
|
2447
|
+
// 当成 JSON 字符串吐出来——例如 TodoWrite 的 todos 会是 "[{...}]" 而非真正的数组。
|
|
2448
|
+
// 所有客户端(web / iOS / Android)读的都是数组,拿到字符串就解析不出待办,进度条
|
|
2449
|
+
// 与 AskUserQuestion 卡片整段消失。这里按工具名把已知的数组字段反序列化回数组,
|
|
2450
|
+
// 让线上协议恢复成「block.input.todos = [{content,status,activeForm}]」的契约。
|
|
2451
|
+
const arrayFieldsByTool = {
|
|
2452
|
+
TodoWrite: "todos",
|
|
2453
|
+
AskUserQuestion: "questions",
|
|
2454
|
+
};
|
|
2455
|
+
const field = typeof name === "string" ? arrayFieldsByTool[name] : undefined;
|
|
2456
|
+
if (field && typeof record[field] === "string") {
|
|
2457
|
+
try {
|
|
2458
|
+
const parsed = JSON.parse(record[field]);
|
|
2459
|
+
if (Array.isArray(parsed))
|
|
2460
|
+
record[field] = parsed;
|
|
2461
|
+
}
|
|
2462
|
+
catch {
|
|
2463
|
+
/* 保留原字符串:宁可不改也不要丢数据 */
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
return record;
|
|
2446
2467
|
}
|
|
2447
2468
|
normalizeToolResultContent(content) {
|
|
2448
2469
|
if (typeof content === "string") {
|