refactor(core): align model content helper names (#45458)

This commit is contained in:
Kit Langton
2026-08-27 11:44:37 -04:00
committed by GitHub
parent c33dc8808b
commit 8d1d1ee982
4 changed files with 11 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@opencode-ai/core": patch
---
Rename the write, patch, and question tool formatting helpers from `toModelOutput` to `toModelContent` to match the result field they populate. Direct imports of these helpers must use the new name; generated content and declared machine output are unchanged.
+2 -2
View File
@@ -36,7 +36,7 @@ export const Output = Schema.Struct({
})
export type Output = typeof Output.Type
export const toModelOutput = (output: Output) =>
export const toModelContent = (output: Output) =>
[
"Success. Updated the following files:",
...output.applied.map(
@@ -296,7 +296,7 @@ export const Plugin = {
fileMutation.withLock(lockTargets),
Effect.map((output) => ({
output,
content: toModelOutput(output),
content: toModelContent(output),
metadata: { files: output.files },
})),
Effect.mapError((error) =>
+2 -2
View File
@@ -35,7 +35,7 @@ export class CancelledError extends Schema.TaggedError<CancelledError>()("Questi
}
}
export const toModelOutput = (questions: ReadonlyArray<Question.Prompt>, answers: ReadonlyArray<Question.Answer>) => {
export const toModelContent = (questions: ReadonlyArray<Question.Prompt>, answers: ReadonlyArray<Question.Answer>) => {
const formatted = questions
.map(
(question, index) =>
@@ -101,7 +101,7 @@ export const Plugin = {
}
return Effect.succeed({
output,
content: toModelOutput(input.questions, output.answers),
content: toModelContent(input.questions, output.answers),
metadata: { answers: output.answers },
})
}),
+2 -2
View File
@@ -35,7 +35,7 @@ export const Output = Schema.Struct({
})
export type Output = typeof Output.Type
export const toModelOutput = (output: Output) =>
export const toModelContent = (output: Output) =>
`${output.existed ? "Wrote" : "Created"} file successfully: ${output.resource}`
/** Deferred write UX integrations remain visible at the model-facing seam. */
@@ -98,7 +98,7 @@ export const Plugin = {
}
return result
}).pipe(
Effect.map((output) => ({ output, content: toModelOutput(output) })),
Effect.map((output) => ({ output, content: toModelContent(output) })),
Effect.mapError((error) => new ToolFailure({ message: `Unable to write ${input.path}`, error })),
),
}),