mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-27 22:10:11 -04:00
refactor(core): align model content helper names (#45458)
This commit is contained in:
@@ -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.
|
||||
@@ -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) =>
|
||||
|
||||
@@ -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 },
|
||||
})
|
||||
}),
|
||||
|
||||
@@ -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 })),
|
||||
),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user