threewzrd 1.0.4 → 1.0.5
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/tools/ToolExecutor.js +20 -3
- package/package.json +1 -1
|
@@ -64,12 +64,29 @@ export class ToolExecutor {
|
|
|
64
64
|
if (typeof obj.path !== 'string' || !obj.path.trim()) {
|
|
65
65
|
throw new Error('Invalid input: path must be a non-empty string');
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
// Coerce content to string - handle various types the model might return
|
|
68
|
+
let content;
|
|
69
|
+
if (typeof obj.content === 'string') {
|
|
70
|
+
content = obj.content;
|
|
71
|
+
}
|
|
72
|
+
else if (obj.content === null || obj.content === undefined) {
|
|
73
|
+
content = '';
|
|
74
|
+
}
|
|
75
|
+
else if (Array.isArray(obj.content)) {
|
|
76
|
+
// Model sometimes returns content as an array of strings
|
|
77
|
+
content = obj.content.map(item => String(item)).join('\n');
|
|
78
|
+
}
|
|
79
|
+
else if (typeof obj.content === 'object') {
|
|
80
|
+
// Fallback: stringify objects
|
|
81
|
+
content = JSON.stringify(obj.content, null, 2);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Fallback for numbers, booleans, etc.
|
|
85
|
+
content = String(obj.content);
|
|
69
86
|
}
|
|
70
87
|
return {
|
|
71
88
|
path: obj.path.trim(),
|
|
72
|
-
content
|
|
89
|
+
content,
|
|
73
90
|
skipValidation: obj.skipValidation === true
|
|
74
91
|
};
|
|
75
92
|
}
|