From 8d1d1ee9822f0f6b073ee31dfa72876f4086487f Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 27 Aug 2026 11:44:37 -0400 Subject: [PATCH] refactor(core): align model content helper names (#45458) --- .changeset/model-content-names.md | 5 +++++ packages/core/src/tool/plugin/patch.ts | 4 ++-- packages/core/src/tool/plugin/question.ts | 4 ++-- packages/core/src/tool/plugin/write.ts | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/model-content-names.md diff --git a/.changeset/model-content-names.md b/.changeset/model-content-names.md new file mode 100644 index 00000000000..47b420d40a8 --- /dev/null +++ b/.changeset/model-content-names.md @@ -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. diff --git a/packages/core/src/tool/plugin/patch.ts b/packages/core/src/tool/plugin/patch.ts index 4c2c4853fd6..59239948dab 100644 --- a/packages/core/src/tool/plugin/patch.ts +++ b/packages/core/src/tool/plugin/patch.ts @@ -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) => diff --git a/packages/core/src/tool/plugin/question.ts b/packages/core/src/tool/plugin/question.ts index 72404199f46..319c084bb4e 100644 --- a/packages/core/src/tool/plugin/question.ts +++ b/packages/core/src/tool/plugin/question.ts @@ -35,7 +35,7 @@ export class CancelledError extends Schema.TaggedError()("Questi } } -export const toModelOutput = (questions: ReadonlyArray, answers: ReadonlyArray) => { +export const toModelContent = (questions: ReadonlyArray, answers: ReadonlyArray) => { 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 }, }) }), diff --git a/packages/core/src/tool/plugin/write.ts b/packages/core/src/tool/plugin/write.ts index a0e96e65a99..4b3dde278c0 100644 --- a/packages/core/src/tool/plugin/write.ts +++ b/packages/core/src/tool/plugin/write.ts @@ -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 })), ), }),