Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline (Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/* packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
14 lines
560 B
TypeScript
14 lines
560 B
TypeScript
/**
|
|
* Coerce a tool-call argument into text for file-writing tools.
|
|
*
|
|
* Models occasionally pass structured JSON where a string is expected
|
|
* (e.g. write_file content). String() on an object yields "[object Object]",
|
|
* which would silently corrupt the written file — serialise objects to
|
|
* readable JSON instead.
|
|
*/
|
|
export function textContentArg(value: unknown, fallback: string): string {
|
|
if (value === null || value === undefined) return fallback;
|
|
if (typeof value === "object") return JSON.stringify(value, null, 2);
|
|
return String(value);
|
|
}
|