refactor(packages): extract utils package

This commit is contained in:
YeonGyu-Kim
2026-05-21 00:31:03 +09:00
parent c4fe747e15
commit a5c1d71001
52 changed files with 717 additions and 508 deletions
+1 -16
View File
@@ -1,16 +1 @@
/**
* Safely replace tool arguments without mutating frozen objects.
*
* opencode >=1.14 may freeze `output.args` via Immer before plugin hooks run.
* Direct property assignment (`output.args.key = value`) or `Object.assign(output.args, patch)`
* throws `TypeError: Attempted to assign to readonly property` on a frozen object.
*
* This helper replaces `output.args` with a shallow clone containing the patch,
* which works regardless of whether the original args object is frozen.
*/
export function replaceToolArgs(
output: { args: Record<string, unknown> },
patch: Record<string, unknown>,
): void {
output.args = { ...output.args, ...patch }
}
export { replaceToolArgs } from "@oh-my-opencode/utils"