Skip to content

Commit 5dc80b1

Browse files
committed
Fix context file message and update tool output schema: clarify context file instructions and adjust output property to match AI SDK requirements
1 parent b30348c commit 5dc80b1

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/agent/state.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// src/agent/state.ts
2-
// CORRECTED: Integrated the fix for the AI SDK's tool output validation.
2+
// CORRECTED: Changed the tool output property from `text` to `value` to match the AI SDK's expected schema.
33

44
import { create } from "zustand";
55
import logger from "@/logger.js";
@@ -277,23 +277,25 @@ export const useStore = create<AppState & AppActions>((set, get) => ({
277277
case "assistant":
278278
return { role: "assistant", content: item.content };
279279
case "tool-result": {
280-
// THIS IS THE FIX: Ensure tool output is always an object.
281-
const outputObject =
282-
typeof item.output === "object" && item.output !== null
280+
const outputText =
281+
typeof item.output === "string"
283282
? item.output
284-
: {
285-
result:
286-
String(item.output) ||
287-
"Tool executed successfully with no output.",
288-
};
283+
: JSON.stringify(item.output, null, 2);
284+
289285
return {
290286
role: "tool",
291287
content: [
292288
{
293289
type: "tool-result",
294290
toolCallId: item.toolCallId,
295291
toolName: item.toolName,
296-
output: outputObject as any,
292+
output: {
293+
type: "text",
294+
// CORRECTED: The property name is 'value', not 'text'.
295+
value:
296+
outputText ||
297+
"Tool executed successfully with no output.",
298+
},
297299
},
298300
],
299301
};

src/ui/ContextSummaryDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function ContextSummaryDisplay() {
1313
<Text color="gray">
1414
{tobiMdFileCount > 0
1515
? `Reading ${tobiMdFileCount} context file(s): ${contextFileNames.join(", ")}`
16-
: "No context files loaded. Add files with /add or create a TOBI.md file."}
16+
: "No context files loaded. Add files with /add or create a TOBI.md or AGENT.md file."}
1717
</Text>
1818
</Box>
1919
);

0 commit comments

Comments
 (0)