@nanocollective/nanocoder
Version:
A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter
32 lines • 881 B
JavaScript
import { randomBytes } from 'node:crypto';
/**
* Generates a unique tool call ID
*/
export function generateToolCallId() {
return `tool_${Date.now()}_${randomBytes(8).toString('hex')}`;
}
/**
* Converts AI SDK tool call format to our ToolCall format
*/
export function convertAISDKToolCall(toolCall) {
return {
id: toolCall.toolCallId || generateToolCallId(),
function: {
name: toolCall.toolName,
arguments: toolCall.input,
},
};
}
/**
* Converts multiple AI SDK tool calls to our ToolCall format
*/
export function convertAISDKToolCalls(toolCalls) {
return toolCalls.map(convertAISDKToolCall);
}
/**
* Gets the tool result output as a string
*/
export function getToolResultOutput(output) {
return typeof output === 'string' ? output : JSON.stringify(output);
}
//# sourceMappingURL=tool-converter.js.map