Drop prompt input Zod statics (#26923)
This commit is contained in:
@@ -46,8 +46,6 @@ import { Truncate } from "@/tool/truncate"
|
||||
import { decodeDataUrl } from "@/util/data-url"
|
||||
import { Process } from "@/util/process"
|
||||
import { Cause, Effect, Exit, Latch, Layer, Option, Scope, Context, Schema, Types } from "effect"
|
||||
import { zod } from "@opencode-ai/core/effect-zod"
|
||||
import { withStatics } from "@opencode-ai/core/schema"
|
||||
import * as EffectLogger from "@opencode-ai/core/effect/logger"
|
||||
import { InstanceState } from "@/effect/instance-state"
|
||||
import { TaskTool, type TaskPromptOps } from "@/tool/task"
|
||||
@@ -2054,14 +2052,12 @@ export const PromptInput = Schema.Struct({
|
||||
MessageV2.SubtaskPartInput,
|
||||
]).annotate({ discriminator: "type" }),
|
||||
),
|
||||
}).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
})
|
||||
export type PromptInput = Schema.Schema.Type<typeof PromptInput>
|
||||
|
||||
export class LoopInput extends Schema.Class<LoopInput>("SessionPrompt.LoopInput")({
|
||||
sessionID: SessionID,
|
||||
}) {
|
||||
static readonly zod = zod(this)
|
||||
}
|
||||
}) {}
|
||||
|
||||
export const ShellInput = Schema.Struct({
|
||||
sessionID: SessionID,
|
||||
@@ -2069,7 +2065,7 @@ export const ShellInput = Schema.Struct({
|
||||
agent: Schema.String,
|
||||
model: Schema.optional(ModelRef),
|
||||
command: Schema.String,
|
||||
}).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
})
|
||||
export type ShellInput = Schema.Schema.Type<typeof ShellInput>
|
||||
|
||||
export const CommandInput = Schema.Struct({
|
||||
@@ -2097,7 +2093,7 @@ export const CommandInput = Schema.Struct({
|
||||
]).annotate({ discriminator: "type" }),
|
||||
),
|
||||
),
|
||||
}).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
})
|
||||
export type CommandInput = Schema.Schema.Type<typeof CommandInput>
|
||||
|
||||
/** @internal Exported for testing */
|
||||
|
||||
@@ -37,8 +37,7 @@ import type { Provider } from "@/provider/provider"
|
||||
import { Permission } from "@/permission"
|
||||
import { Global } from "@opencode-ai/core/global"
|
||||
import { Effect, Layer, Option, Context, Schema, Types } from "effect"
|
||||
import { zod } from "@opencode-ai/core/effect-zod"
|
||||
import { NonNegativeInt, optionalOmitUndefined, withStatics } from "@opencode-ai/core/schema"
|
||||
import { NonNegativeInt, optionalOmitUndefined } from "@opencode-ai/core/schema"
|
||||
|
||||
const log = Log.create({ service: "session" })
|
||||
|
||||
@@ -193,26 +192,20 @@ export const Info = Schema.Struct({
|
||||
time: Time,
|
||||
permission: optionalOmitUndefined(Permission.Ruleset),
|
||||
revert: optionalOmitUndefined(Revert),
|
||||
})
|
||||
.annotate({ identifier: "Session" })
|
||||
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
}).annotate({ identifier: "Session" })
|
||||
export type Info = Types.DeepMutable<Schema.Schema.Type<typeof Info>>
|
||||
|
||||
export const ProjectInfo = Schema.Struct({
|
||||
id: ProjectID,
|
||||
name: optionalOmitUndefined(Schema.String),
|
||||
worktree: Schema.String,
|
||||
})
|
||||
.annotate({ identifier: "ProjectSummary" })
|
||||
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
}).annotate({ identifier: "ProjectSummary" })
|
||||
export type ProjectInfo = Types.DeepMutable<Schema.Schema.Type<typeof ProjectInfo>>
|
||||
|
||||
export const GlobalInfo = Schema.Struct({
|
||||
...Info.fields,
|
||||
project: Schema.NullOr(ProjectInfo),
|
||||
})
|
||||
.annotate({ identifier: "GlobalSession" })
|
||||
.pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
}).annotate({ identifier: "GlobalSession" })
|
||||
export type GlobalInfo = Types.DeepMutable<Schema.Schema.Type<typeof GlobalInfo>>
|
||||
|
||||
export const CreateInput = Schema.optional(
|
||||
@@ -224,36 +217,34 @@ export const CreateInput = Schema.optional(
|
||||
permission: Schema.optional(Permission.Ruleset),
|
||||
workspaceID: Schema.optional(WorkspaceID),
|
||||
}),
|
||||
).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
)
|
||||
export type CreateInput = Types.DeepMutable<Schema.Schema.Type<typeof CreateInput>>
|
||||
|
||||
export const ForkInput = Schema.Struct({
|
||||
sessionID: SessionID,
|
||||
messageID: Schema.optional(MessageID),
|
||||
}).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
})
|
||||
export const GetInput = SessionID
|
||||
export const ChildrenInput = SessionID
|
||||
export const RemoveInput = SessionID
|
||||
export const SetTitleInput = Schema.Struct({ sessionID: SessionID, title: Schema.String }).pipe(
|
||||
withStatics((s) => ({ zod: zod(s) })),
|
||||
)
|
||||
export const SetTitleInput = Schema.Struct({ sessionID: SessionID, title: Schema.String })
|
||||
export const SetArchivedInput = Schema.Struct({
|
||||
sessionID: SessionID,
|
||||
time: Schema.optional(ArchivedTimestamp),
|
||||
}).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
})
|
||||
export const SetPermissionInput = Schema.Struct({
|
||||
sessionID: SessionID,
|
||||
permission: Permission.Ruleset,
|
||||
}).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
})
|
||||
export const SetRevertInput = Schema.Struct({
|
||||
sessionID: SessionID,
|
||||
revert: Schema.optional(Revert),
|
||||
summary: Schema.optional(Summary),
|
||||
}).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
})
|
||||
export const MessagesInput = Schema.Struct({
|
||||
sessionID: SessionID,
|
||||
limit: Schema.optional(NonNegativeInt),
|
||||
}).pipe(withStatics((s) => ({ zod: zod(s) })))
|
||||
})
|
||||
export type ListInput = {
|
||||
directory?: string
|
||||
scope?: "project"
|
||||
|
||||
Reference in New Issue
Block a user