create-wirejs-app 2.0.170 → 2.0.172
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/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolCall } from 'wirejs-resources';
|
|
1
|
+
import type { ToolCall, ToolMessage } from 'wirejs-resources';
|
|
2
2
|
import { Infra } from './infra.js'
|
|
3
3
|
import { cleanTitle } from './utils.js';
|
|
4
4
|
import { generateConversationTitle } from './prompts.js';
|
|
@@ -58,6 +58,7 @@ export const tooledHandler = (infra: Infra) => async (
|
|
|
58
58
|
history.push(response);
|
|
59
59
|
|
|
60
60
|
toolCalls = tools && tools.length > 0 ? response.tool_calls ?? [] : [];
|
|
61
|
+
const toolMessage: ToolMessage = { role: 'tool', content: [] };
|
|
61
62
|
for (const call of toolCalls) {
|
|
62
63
|
const name = call.function.name;
|
|
63
64
|
const args = call.function.arguments;
|
|
@@ -82,22 +83,24 @@ export const tooledHandler = (infra: Infra) => async (
|
|
|
82
83
|
|
|
83
84
|
// makes tool results visible in the conversation history
|
|
84
85
|
// to the agent.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
tool_name: name,
|
|
88
|
-
tool_call_id: call.id || JSON.stringify([name, args]),
|
|
86
|
+
toolMessage.content.push({
|
|
87
|
+
id: call.id || JSON.stringify([name, args]),
|
|
89
88
|
content: JSON.stringify(r, null, 2),
|
|
90
|
-
|
|
89
|
+
isError: false,
|
|
90
|
+
})
|
|
91
91
|
} catch (error) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
tool_name: name,
|
|
95
|
-
tool_call_id: call.id || JSON.stringify([name, args]),
|
|
92
|
+
toolMessage.content.push({
|
|
93
|
+
id: call.id || JSON.stringify([name, args]),
|
|
96
94
|
content: String(error),
|
|
97
|
-
|
|
95
|
+
isError: true,
|
|
96
|
+
})
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
|
|
100
|
+
if (toolCalls.length > 0) {
|
|
101
|
+
history.push(await infra.addMessage(room, mid++, toolMessage));
|
|
102
|
+
}
|
|
103
|
+
|
|
101
104
|
maxLoops--;
|
|
102
105
|
} while (toolCalls.length > 0);
|
|
103
106
|
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"dompurify": "^3.2.3",
|
|
13
13
|
"marked": "^15.0.6",
|
|
14
14
|
"wirejs-dom": "^1.0.44",
|
|
15
|
-
"wirejs-resources": "^0.1.
|
|
16
|
-
"wirejs-components": "^0.1.
|
|
17
|
-
"wirejs-module-payments-stripe": "^0.1.
|
|
18
|
-
"wirejs-web-worker": "^1.0.
|
|
15
|
+
"wirejs-resources": "^0.1.167",
|
|
16
|
+
"wirejs-components": "^0.1.110",
|
|
17
|
+
"wirejs-module-payments-stripe": "^0.1.61",
|
|
18
|
+
"wirejs-web-worker": "^1.0.64"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"wirejs-scripts": "^3.0.
|
|
21
|
+
"wirejs-scripts": "^3.0.165",
|
|
22
22
|
"typescript": "^5.7.3"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|