prompt-input.ts 900 B

1234567891011121314151617181920212223242526
  1. export * as PromptInput from "./prompt-input"
  2. import { Schema } from "effect"
  3. import { AgentAttachment, Source } from "./prompt"
  4. import { optional, statics } from "./schema"
  5. export interface FileAttachment extends Schema.Schema.Type<typeof FileAttachment> {}
  6. export const FileAttachment = Schema.Struct({
  7. uri: Schema.String,
  8. name: Schema.String.pipe(optional),
  9. description: Schema.String.pipe(optional),
  10. source: Source.pipe(optional),
  11. })
  12. .annotate({ identifier: "PromptInput.FileAttachment" })
  13. .pipe(
  14. statics((schema) => ({
  15. create: (input: FileAttachment) => schema.make(input),
  16. })),
  17. )
  18. export interface Prompt extends Schema.Schema.Type<typeof Prompt> {}
  19. export const Prompt = Schema.Struct({
  20. text: Schema.String,
  21. files: Schema.Array(FileAttachment).pipe(optional),
  22. agents: Schema.Array(AgentAttachment).pipe(optional),
  23. }).annotate({ identifier: "PromptInput" })