refactor(schema): apply session review decisions (#35793)
This commit is contained in:
parent
d27746e5b3
commit
ed6ad272ec
142 changed files with 4239 additions and 3174 deletions
|
|
@ -10,9 +10,12 @@ import { PositiveInt, statics } from "./schema.js"
|
|||
|
||||
const Updated = ephemeral({ type: "agent.updated", schema: {} })
|
||||
|
||||
export const ID = Schema.String.pipe(Schema.brand("AgentV2.ID"))
|
||||
export const ID = Schema.String.pipe(Schema.brand("Agent.ID"))
|
||||
export type ID = typeof ID.Type
|
||||
|
||||
export const Name = Schema.String.pipe(Schema.brand("Agent.Name"))
|
||||
export type Name = typeof Name.Type
|
||||
|
||||
export const Color = Schema.Union([
|
||||
Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/)),
|
||||
Schema.Literals(["primary", "secondary", "accent", "success", "warning", "error", "info"]),
|
||||
|
|
@ -22,6 +25,7 @@ export type Color = typeof Color.Type
|
|||
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
||||
export const Info = Schema.Struct({
|
||||
id: ID,
|
||||
name: Name,
|
||||
model: Model.Ref.pipe(optional),
|
||||
request: Provider.Request,
|
||||
system: Schema.String.pipe(optional),
|
||||
|
|
@ -32,12 +36,13 @@ export const Info = Schema.Struct({
|
|||
steps: PositiveInt.pipe(optional),
|
||||
permissions: Permission.Ruleset,
|
||||
})
|
||||
.annotate({ identifier: "AgentV2.Info" })
|
||||
.annotate({ identifier: "Agent.Info" })
|
||||
.pipe(
|
||||
statics((schema) => ({
|
||||
empty: (id: ID) =>
|
||||
schema.make({
|
||||
id,
|
||||
name: Name.make(id),
|
||||
request: { settings: {}, headers: {}, body: {} },
|
||||
mode: "all",
|
||||
hidden: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue