diff --git a/packages/opencode/src/cli/cmd/export.ts b/packages/opencode/src/cli/cmd/export.ts index bf73ce941e..6a64d0e057 100644 --- a/packages/opencode/src/cli/cmd/export.ts +++ b/packages/opencode/src/cli/cmd/export.ts @@ -23,11 +23,12 @@ function span(id: string, value: { value: string; start: number; end: number }) } } -function diff(kind: string, diffs: { file: string; patch: string }[] | undefined) { +function diff(kind: string, diffs: { file: string; patch?: string }[] | undefined) { return diffs?.map((item, i) => ({ ...item, file: redact(`${kind}-file`, String(i), item.file), - patch: redact(`${kind}-patch`, String(i), item.patch), + patch: + item.patch === undefined ? undefined : redact(`${kind}-patch`, String(i), item.patch), })) } diff --git a/packages/opencode/src/snapshot/index.ts b/packages/opencode/src/snapshot/index.ts index 6acd74763e..05d234e9b8 100644 --- a/packages/opencode/src/snapshot/index.ts +++ b/packages/opencode/src/snapshot/index.ts @@ -21,7 +21,7 @@ export type Patch = typeof Patch.Type export const FileDiff = Schema.Struct({ file: Schema.String, - patch: Schema.String, + patch: Schema.optional(Schema.String), additions: NonNegativeInt, deletions: NonNegativeInt, status: Schema.optional(Schema.Literals(["added", "deleted", "modified"])), diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index 220278b8c2..6a0ba21027 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -120,7 +120,7 @@ export type PermissionRequest = { export type SnapshotFileDiff = { file: string - patch: string + patch?: string additions: number deletions: number status?: "added" | "deleted" | "modified"