Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 },
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/pty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export type Info = Types.DeepMutable<typeof Info.Type>

export const CreateInput = Pty.CreateInput

export type CreateInput = Types.DeepMutable<typeof CreateInput.Type>
export type CreateInput = typeof CreateInput.Type

export const UpdateInput = Pty.UpdateInput

export type UpdateInput = Types.DeepMutable<typeof UpdateInput.Type>
export type UpdateInput = typeof UpdateInput.Type

export { Event } from "@opencode/schema/pty"

Expand Down Expand Up @@ -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 = (() => {
Expand Down
11 changes: 5 additions & 6 deletions packages/core/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tool/plugin/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
}),
}
Expand Down
Loading