Fix opencode-local adapter: parser, UI, CLI, and environment tests
- Move costUsd to top-level return field in parseOpenCodeJsonl (out of usage) - Fix session-not-found regex to match "Session not found" pattern - Use callID for toolUseId in UI stdout parser, add status/metadata header - Fix CLI formatter: separate tool_call/tool_result lines, split step_finish - Enable createIfMissing for cwd validation in environment tests - Add empty OPENAI_API_KEY override detection - Classify ProviderModelNotFoundError as warning during model discovery - Make model discovery best-effort when no model is configured Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,19 +56,28 @@ function parseToolUse(parsed: Record<string, unknown>, ts: string): TranscriptEn
|
||||
const status = asString(state?.status);
|
||||
if (status !== "completed" && status !== "error") return [callEntry];
|
||||
|
||||
const output =
|
||||
const rawOutput =
|
||||
asString(state?.output) ||
|
||||
asString(state?.error) ||
|
||||
asString(part.title) ||
|
||||
`${toolName} ${status}`;
|
||||
|
||||
const metadata = asRecord(state?.metadata);
|
||||
const headerParts: string[] = [`status: ${status}`];
|
||||
if (metadata) {
|
||||
for (const [key, value] of Object.entries(metadata)) {
|
||||
if (value !== undefined && value !== null) headerParts.push(`${key}: ${value}`);
|
||||
}
|
||||
}
|
||||
const content = `${headerParts.join("\n")}\n\n${rawOutput}`.trim();
|
||||
|
||||
return [
|
||||
callEntry,
|
||||
{
|
||||
kind: "tool_result",
|
||||
ts,
|
||||
toolUseId: asString(part.id, toolName),
|
||||
content: output,
|
||||
toolUseId: asString(part.callID) || asString(part.id, toolName),
|
||||
content,
|
||||
isError: status === "error",
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user