feat(core): restore per-request system prompt (#34335)

This commit is contained in:
Kit Langton 2026-06-28 14:02:46 -04:00 committed by GitHub
commit 04c6bed240
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 103 additions and 2 deletions

View file

@ -23,4 +23,5 @@ export const Prompt = Schema.Struct({
text: Schema.String,
files: Schema.Array(FileAttachment).pipe(optional),
agents: Schema.Array(AgentAttachment).pipe(optional),
system: Schema.String.pipe(optional),
}).annotate({ identifier: "PromptInput" })

View file

@ -42,16 +42,18 @@ export const Prompt = Schema.Struct({
text: Schema.String,
files: Schema.Array(FileAttachment).pipe(optional),
agents: Schema.Array(AgentAttachment).pipe(optional),
system: Schema.String.pipe(optional),
})
.annotate({ identifier: "Prompt" })
.pipe(
statics((schema) => ({
equivalence: Schema.toEquivalence(schema),
fromUserMessage: (input: Pick<Prompt, "text" | "files" | "agents">) =>
fromUserMessage: (input: Pick<Prompt, "text" | "files" | "agents" | "system">) =>
schema.make({
text: input.text,
...(input.files === undefined ? {} : { files: input.files }),
...(input.agents === undefined ? {} : { agents: input.agents }),
...(input.system === undefined ? {} : { system: input.system }),
}),
})),
)

View file

@ -47,6 +47,7 @@ export const User = Schema.Struct({
text: Prompt.fields.text,
files: Prompt.fields.files,
agents: Prompt.fields.agents,
system: Prompt.fields.system,
type: Schema.Literal("user"),
}).annotate({ identifier: "Session.Message.User" })