Something went wrong. Try again.
opencode v2 mirror
Something went wrong. Try again.
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859export * as Pty from "./pty.js"
import { Schema } from "effect"import { optional } from "./schema.js"import { ephemeral, inventory } from "./event.js"import { ascending } from "./identifier.js"import { NonNegativeInt, PositiveInt, statics } from "./schema.js"
const IDSchema = Schema.String.check(Schema.isStartsWith("pty")).pipe(Schema.brand("PtyID"))
export const ID = IDSchema.pipe( statics((schema: typeof IDSchema) => { const create = () => schema.make("pty_" + ascending()) return { create, ascending: (id?: string) => (id === undefined ? create() : schema.make(id)), } }),)export type ID = typeof ID.Type
export const Info = Schema.Struct({ id: ID, title: Schema.String, command: Schema.String, args: Schema.Array(Schema.String), cwd: Schema.String, status: Schema.Literals(["running", "exited"]), pid: NonNegativeInt, exitCode: optional(NonNegativeInt),}).annotate({ identifier: "Pty" })export interface Info extends Schema.Schema.Type<typeof Info> {}
const Created = ephemeral({ type: "pty.created", schema: { info: Info } })const Updated = ephemeral({ type: "pty.updated", schema: { info: Info } })const Exited = ephemeral({ type: "pty.exited", schema: { id: ID, exitCode: NonNegativeInt } })const Deleted = ephemeral({ type: "pty.deleted", schema: { id: ID } })export const Event = { Created, Updated, Exited, Deleted, Definitions: inventory(Created, Updated, Exited, Deleted) }
export const CreateInput = Schema.Struct({ command: optional(Schema.String), args: optional(Schema.Array(Schema.String)), cwd: optional(Schema.String), title: optional(Schema.String), env: optional(Schema.Record(Schema.String, Schema.String)),})export interface CreateInput extends Schema.Schema.Type<typeof CreateInput> {}
export const UpdateInput = Schema.Struct({ title: optional(Schema.String), size: optional( Schema.Struct({ rows: PositiveInt, cols: PositiveInt, }), ),})export interface UpdateInput extends Schema.Schema.Type<typeof UpdateInput> {}