diff --git a/packages/core/src/plugin.ts b/packages/core/src/plugin.ts index 8ade6826585..94ca4c0463d 100644 --- a/packages/core/src/plugin.ts +++ b/packages/core/src/plugin.ts @@ -260,7 +260,7 @@ const layer = Layer.effect( // `plugin` is the requested definition; `activation` is its last activation, which may have // failed or be an older fallback while the requested revision keeps failing setup. type Slot = { - readonly plugin: Generation + readonly plugin: Generation & { readonly id: Plugin.ID } readonly activation?: Activation readonly error?: string } @@ -285,7 +285,7 @@ type PendingFailure = { function slotInfo(slot: Slot): Plugin.Info { const failure = slot.activation?.failure ?? (slot.error === undefined ? undefined : { error: slot.error }) return { - id: Plugin.ID.make(slot.plugin.id), + id: slot.plugin.id, source: slot.plugin.source ?? { type: "builtin" }, state: failure === undefined ? { status: "active" } : { status: "failed", ...failure }, features: { server: true, ...slot.plugin.features }, diff --git a/packages/core/src/pty.ts b/packages/core/src/pty.ts index c5d7015e059..6d4ac6d628f 100644 --- a/packages/core/src/pty.ts +++ b/packages/core/src/pty.ts @@ -42,11 +42,11 @@ export type Info = Types.DeepMutable export const CreateInput = Pty.CreateInput -export type CreateInput = Types.DeepMutable +export type CreateInput = typeof CreateInput.Type export const UpdateInput = Pty.UpdateInput -export type UpdateInput = Types.DeepMutable +export type UpdateInput = typeof UpdateInput.Type export { Event } from "@opencode/schema/pty" @@ -275,7 +275,7 @@ const layer = Layer.effect( const from = input.cursor === -1 ? end - : typeof input.cursor === "number" && Number.isSafeInteger(input.cursor) + : input.cursor !== undefined && Number.isSafeInteger(input.cursor) ? Math.max(0, input.cursor) : 0 const replay = (() => { diff --git a/packages/core/src/snapshot.ts b/packages/core/src/snapshot.ts index 3ac6df3e241..e9d5785b598 100644 --- a/packages/core/src/snapshot.ts +++ b/packages/core/src/snapshot.ts @@ -168,6 +168,7 @@ const layer = Layer.effect( const changed = yield* git.tree .files({ repository: compared.repository, from: compared.from, to: compared.to }) .pipe(Effect.mapError((cause) => failure("files", cause))) + if (changed.length === 0) return [] const skipped = yield* ignored("files", compared.source, changed) return changed.filter((file) => !skipped.has(file)) }) @@ -185,12 +186,10 @@ const layer = Layer.effect( paths: input.paths, }) .pipe(Effect.mapError((cause) => failure("diff", cause))) - const skipped = yield* ignored( - "diff", - compared.source, - diffs.map((file) => RelativePath.make(file.file)), - ) - return diffs.filter((file) => !skipped.has(RelativePath.make(file.file))) + if (diffs.length === 0) return [] + const paths = diffs.map((file) => RelativePath.make(file.file)) + const skipped = yield* ignored("diff", compared.source, paths) + return diffs.filter((_, index) => !skipped.has(paths[index]!)) }) const plan = Effect.fnUntraced(function* (worktree: AbsolutePath, input: RestoreInput) { diff --git a/packages/core/src/tool/plugin/question.ts b/packages/core/src/tool/plugin/question.ts index 60d115eae35..67febf3a81b 100644 --- a/packages/core/src/tool/plugin/question.ts +++ b/packages/core/src/tool/plugin/question.ts @@ -99,7 +99,7 @@ export const Plugin = { answers: input.questions.map((_, index): Question.Answer => { const value = state.answer[`q${index}`] if (value === undefined) return [] - if (typeof value === "object") return Array.from(value) + if (Array.isArray(value)) return Array.from(value) return [String(value)] }), }