Daniel Salazar
Daniel Salazar
Following request from discord: We want to expose usage counts in streamed ai responses. They require adding the usage data in our ai stream handlers: https://github.com/HeyPuter/puter/blob/main/src/backend/src/modules/puterai/lib/OpenAIUtil.js#L89 https://github.com/HeyPuter/puter/blob/main/src/backend/src/modules/puterai/ClaudeService.js#L307
Newer gemini models support things like grounded searches and timed caching. However openai compatible api might not expose these costs in the input/output tokens the way claude api does. verify...
Following backend changes in [PR #1567](https://github.com/HeyPuter/puter/pull/1567), frontend must support the new `manage:fs:{file-uuid}` permission for file sharing. **Summary of Changes:** - File owners can now grant a `manage:fs:{file-uuid}` permission, which allows...
## Issue We had some bugs with streaming for some models, which were missed during testing due to lack of streaming tests ## Request Add test to get stream responses...
The chat provider stack funnels everything through [src/backend/drivers/ai-chat/utils/OpenAIUtil.js](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/utils/OpenAIUtil.js), which normalizes Puter messages to OpenAI shape (image_url/video_url inference, tool_use coercion from Anthropic format, multi-part content). It has zero unit tests despite...
[Messages.js](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/utils/Messages.js), [FunctionCalling.js](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/utils/FunctionCalling.js), and [Streaming.js](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/utils/Streaming.js) are imported across all chat providers but untested. Cover message building/merging, tool-call serialization round-trips, and stream chunk parsing/aggregation with fixture inputs.
[src/backend/drivers/util/fileInput.ts](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/util/fileInput.ts) is shared by image/video/tts/ocr/speech drivers but has no tests. Cover URL vs base64 vs Buffer input handling and error paths.
[ClaudeProvider.ts](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/providers/claude/ClaudeProvider.ts) only has [ClaudeProvider.integration.test.ts](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/providers/claude/ClaudeProvider.integration.test.ts). Add a separate ClaudeProvider.test.ts that mocks the Anthropic SDK and covers request mapping (system prompt extraction, tool_use translation), streaming aggregation, error mapping, and metering token accounting....
[OpenAiChatCompletionsProvider.ts](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/providers/openai/OpenAiChatCompletionsProvider.ts) only has [its integration test](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/providers/openai/OpenAiChatCompletionsProvider.integration.test.ts). Add a separate OpenAiChatCompletionsProvider.test.ts for tool-call shape, streaming deltas, and usage/cost reporting through MeteringService. Keep the integration test untouched.
[OpenAiChatResponsesProvider.ts](vscode-webview://0uki7mv0sch46gvqu913g7vskcmjb03c6skt17pln2k7uqte77t0/src/backend/drivers/ai-chat/providers/openai/OpenAiChatResponsesProvider.ts) has no test at all. Add a OpenAiChatResponsesProvider.test.ts for the Responses-API shape mapping, plus a separate OpenAiChatResponsesProvider.integration.test.ts matching siblings — two distinct files.