session-prompt.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import * as Schema from "effect/Schema"
  2. export class Source extends Schema.Class<Source>("Prompt.Source")({
  3. start: Schema.Finite,
  4. end: Schema.Finite,
  5. text: Schema.String,
  6. }) {}
  7. export class FileAttachment extends Schema.Class<FileAttachment>("Prompt.FileAttachment")({
  8. uri: Schema.String,
  9. mime: Schema.String,
  10. name: Schema.String.pipe(Schema.optional),
  11. description: Schema.String.pipe(Schema.optional),
  12. source: Source.pipe(Schema.optional),
  13. }) {
  14. static create(input: FileAttachment) {
  15. return new FileAttachment({
  16. uri: input.uri,
  17. mime: input.mime,
  18. name: input.name,
  19. description: input.description,
  20. source: input.source,
  21. })
  22. }
  23. }
  24. export class AgentAttachment extends Schema.Class<AgentAttachment>("Prompt.AgentAttachment")({
  25. name: Schema.String,
  26. source: Source.pipe(Schema.optional),
  27. }) {}
  28. export class ReferenceAttachment extends Schema.Class<ReferenceAttachment>("Prompt.ReferenceAttachment")({
  29. name: Schema.String,
  30. kind: Schema.Literals(["local", "git", "invalid"]),
  31. uri: Schema.String.pipe(Schema.optional),
  32. repository: Schema.String.pipe(Schema.optional),
  33. branch: Schema.String.pipe(Schema.optional),
  34. target: Schema.String.pipe(Schema.optional),
  35. targetUri: Schema.String.pipe(Schema.optional),
  36. problem: Schema.String.pipe(Schema.optional),
  37. source: Source.pipe(Schema.optional),
  38. }) {}
  39. export class Prompt extends Schema.Class<Prompt>("Prompt")({
  40. text: Schema.String,
  41. files: Schema.Array(FileAttachment).pipe(Schema.optional),
  42. agents: Schema.Array(AgentAttachment).pipe(Schema.optional),
  43. references: Schema.Array(ReferenceAttachment).pipe(Schema.optional),
  44. }) {}