feat(core): generalize session input inbox (#36005)
This commit is contained in:
parent
7eea97184a
commit
984cab7938
47 changed files with 1590 additions and 767 deletions
|
|
@ -62,7 +62,7 @@ if (schemas) {
|
|||
visit({ ...document, components: { ...document.components, schemas: undefined } })
|
||||
for (const name of Object.keys(schemas)) {
|
||||
if (
|
||||
/^(SessionAgentSelected|SessionModelSelected|SessionMoved|SessionRenamed|SessionForked|SessionPromptPromoted|SessionPromptAdmitted|SessionExecutionStarted|SessionExecutionSucceeded|SessionExecutionFailed|SessionExecutionInterrupted|SessionInstructionsUpdated|SessionSynthetic|SessionSkillActivated|SessionShellStarted|SessionShellEnded|SessionStepStarted|SessionStepEnded|SessionStepFailed|SessionTextStarted|SessionTextDelta|SessionTextEnded|SessionToolInputStarted|SessionToolInputDelta|SessionToolInputEnded|SessionToolCalled|SessionToolProgress|SessionToolSuccess|SessionToolFailed|SessionRetryScheduled|SessionCompactionStarted|SessionCompactionDelta|SessionCompactionEnded|SessionRevertStaged|SessionRevertCleared|SessionRevertCommitted)\d+$/.test(
|
||||
/^(SessionAgentSelected|SessionModelSelected|SessionMoved|SessionRenamed|SessionForked|SessionInputPromoted|SessionInputAdmitted|SessionExecutionStarted|SessionExecutionSucceeded|SessionExecutionFailed|SessionExecutionInterrupted|SessionInstructionsUpdated|SessionSynthetic|SessionSkillActivated|SessionShellStarted|SessionShellEnded|SessionStepStarted|SessionStepEnded|SessionStepFailed|SessionTextStarted|SessionTextDelta|SessionTextEnded|SessionToolInputStarted|SessionToolInputDelta|SessionToolInputEnded|SessionToolCalled|SessionToolProgress|SessionToolSuccess|SessionToolFailed|SessionRetryScheduled|SessionCompactionStarted|SessionCompactionDelta|SessionCompactionEnded|SessionRevertStaged|SessionRevertCleared|SessionRevertCommitted)\d+$/.test(
|
||||
name,
|
||||
) &&
|
||||
!reachable.has(name)
|
||||
|
|
@ -102,7 +102,7 @@ await createClient({
|
|||
const generatedTypesPath = "./src/v2/gen/types.gen.ts"
|
||||
const generatedTypes = await Bun.file(generatedTypesPath).text()
|
||||
if (
|
||||
/export type (SessionAgentSelected|SessionModelSelected|SessionMoved|SessionRenamed|SessionForked|SessionPromptPromoted|SessionPromptAdmitted|SessionExecutionStarted|SessionExecutionSucceeded|SessionExecutionFailed|SessionExecutionInterrupted|SessionInstructionsUpdated|SessionSynthetic|SessionSkillActivated|SessionShellStarted|SessionShellEnded|SessionStepStarted|SessionStepEnded|SessionStepFailed|SessionTextStarted|SessionTextDelta|SessionTextEnded|SessionToolInputStarted|SessionToolInputDelta|SessionToolInputEnded|SessionToolCalled|SessionToolProgress|SessionToolSuccess|SessionToolFailed|SessionRetryScheduled|SessionCompactionStarted|SessionCompactionDelta|SessionCompactionEnded|SessionRevertStaged|SessionRevertCleared|SessionRevertCommitted)\d+ =/.test(
|
||||
/export type (SessionAgentSelected|SessionModelSelected|SessionMoved|SessionRenamed|SessionForked|SessionInputPromoted|SessionInputAdmitted|SessionExecutionStarted|SessionExecutionSucceeded|SessionExecutionFailed|SessionExecutionInterrupted|SessionInstructionsUpdated|SessionSynthetic|SessionSkillActivated|SessionShellStarted|SessionShellEnded|SessionStepStarted|SessionStepEnded|SessionStepFailed|SessionTextStarted|SessionTextDelta|SessionTextEnded|SessionToolInputStarted|SessionToolInputDelta|SessionToolInputEnded|SessionToolCalled|SessionToolProgress|SessionToolSuccess|SessionToolFailed|SessionRetryScheduled|SessionCompactionStarted|SessionCompactionDelta|SessionCompactionEnded|SessionRevertStaged|SessionRevertCleared|SessionRevertCommitted)\d+ =/.test(
|
||||
generatedTypes,
|
||||
)
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ import type {
|
|||
ProjectUpdateErrors,
|
||||
ProjectUpdateResponses,
|
||||
PromptAgentAttachment,
|
||||
PromptInput,
|
||||
PromptInputFileAttachment,
|
||||
ProviderAuthErrors,
|
||||
ProviderAuthResponses,
|
||||
|
|
@ -6165,7 +6164,12 @@ export class Session3 extends HeyApiClient {
|
|||
parameters: {
|
||||
sessionID: string
|
||||
id?: string | null
|
||||
prompt?: PromptInput
|
||||
text?: string
|
||||
files?: Array<PromptInputFileAttachment>
|
||||
agents?: Array<PromptAgentAttachment>
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
delivery?: "steer" | "queue" | null
|
||||
resume?: boolean | null
|
||||
},
|
||||
|
|
@ -6178,7 +6182,10 @@ export class Session3 extends HeyApiClient {
|
|||
args: [
|
||||
{ in: "path", key: "sessionID" },
|
||||
{ in: "body", key: "id" },
|
||||
{ in: "body", key: "prompt" },
|
||||
{ in: "body", key: "text" },
|
||||
{ in: "body", key: "files" },
|
||||
{ in: "body", key: "agents" },
|
||||
{ in: "body", key: "metadata" },
|
||||
{ in: "body", key: "delivery" },
|
||||
{ in: "body", key: "resume" },
|
||||
],
|
||||
|
|
@ -6290,16 +6297,18 @@ export class Session3 extends HeyApiClient {
|
|||
/**
|
||||
* Add synthetic message
|
||||
*
|
||||
* Append a synthetic message to a session and resume execution.
|
||||
* Durably admit synthetic session input and schedule execution unless resume is false.
|
||||
*/
|
||||
public synthetic<ThrowOnError extends boolean = false>(
|
||||
parameters: {
|
||||
sessionID: string
|
||||
id?: string | null
|
||||
text?: string
|
||||
description?: string | null
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
delivery?: "steer" | "queue" | null
|
||||
resume?: boolean | null
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
|
|
@ -6310,9 +6319,11 @@ export class Session3 extends HeyApiClient {
|
|||
{
|
||||
args: [
|
||||
{ in: "path", key: "sessionID" },
|
||||
{ in: "body", key: "id" },
|
||||
{ in: "body", key: "text" },
|
||||
{ in: "body", key: "description" },
|
||||
{ in: "body", key: "metadata" },
|
||||
{ in: "body", key: "delivery" },
|
||||
{ in: "body", key: "resume" },
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ export type Event =
|
|||
| EventSessionRenamed
|
||||
| EventSessionUsageUpdated
|
||||
| EventSessionForked
|
||||
| EventSessionPromptPromoted
|
||||
| EventSessionPromptAdmitted
|
||||
| EventSessionInputPromoted
|
||||
| EventSessionInputAdmitted
|
||||
| EventSessionExecutionStarted
|
||||
| EventSessionExecutionSucceeded
|
||||
| EventSessionExecutionFailed
|
||||
|
|
@ -599,12 +599,6 @@ export type Part =
|
|||
| RetryPart
|
||||
| CompactionPart
|
||||
|
||||
export type Prompt = {
|
||||
text: string
|
||||
files?: Array<PromptFileAttachment>
|
||||
agents?: Array<PromptAgentAttachment>
|
||||
}
|
||||
|
||||
export type Shell = {
|
||||
id: string
|
||||
status: "running" | "exited" | "timeout" | "killed"
|
||||
|
|
@ -856,7 +850,7 @@ export type GlobalEvent = {
|
|||
}
|
||||
| {
|
||||
id: string
|
||||
type: "session.prompt.promoted"
|
||||
type: "session.input.promoted"
|
||||
properties: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
|
|
@ -864,12 +858,11 @@ export type GlobalEvent = {
|
|||
}
|
||||
| {
|
||||
id: string
|
||||
type: "session.prompt.admitted"
|
||||
type: "session.input.admitted"
|
||||
properties: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
prompt: Prompt
|
||||
delivery: "steer" | "queue"
|
||||
input: SessionInputMessage
|
||||
}
|
||||
}
|
||||
| {
|
||||
|
|
@ -1720,8 +1713,8 @@ export type GlobalEvent = {
|
|||
| SyncEventSessionMoved
|
||||
| SyncEventSessionRenamed
|
||||
| SyncEventSessionForked
|
||||
| SyncEventSessionPromptPromoted
|
||||
| SyncEventSessionPromptAdmitted
|
||||
| SyncEventSessionInputPromoted
|
||||
| SyncEventSessionInputAdmitted
|
||||
| SyncEventSessionExecutionStarted
|
||||
| SyncEventSessionExecutionSucceeded
|
||||
| SyncEventSessionExecutionFailed
|
||||
|
|
@ -2876,12 +2869,6 @@ export type MessageNotFoundError = {
|
|||
message: string
|
||||
}
|
||||
|
||||
export type PromptInput = {
|
||||
text: string
|
||||
files?: Array<PromptInputFileAttachment>
|
||||
agents?: Array<PromptAgentAttachment>
|
||||
}
|
||||
|
||||
export type ConflictError = {
|
||||
_tag: "ConflictError"
|
||||
message: string
|
||||
|
|
@ -3058,8 +3045,8 @@ export type V2Event =
|
|||
| SessionRenamed
|
||||
| SessionUsageUpdated
|
||||
| SessionForked
|
||||
| SessionPromptPromoted
|
||||
| SessionPromptAdmitted
|
||||
| SessionInputPromoted
|
||||
| SessionInputAdmitted
|
||||
| SessionExecutionStarted
|
||||
| SessionExecutionSucceeded
|
||||
| SessionExecutionFailed
|
||||
|
|
@ -3391,6 +3378,37 @@ export type PromptAgentAttachment = {
|
|||
mention?: PromptMention
|
||||
}
|
||||
|
||||
export type SessionInputUserData = {
|
||||
text: string
|
||||
files?: Array<PromptFileAttachment>
|
||||
agents?: Array<PromptAgentAttachment>
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionInputUserMessage = {
|
||||
type: "user"
|
||||
data: SessionInputUserData
|
||||
delivery: "steer" | "queue"
|
||||
}
|
||||
|
||||
export type SessionInputSyntheticData = {
|
||||
text: string
|
||||
description?: string
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionInputSyntheticMessage = {
|
||||
type: "synthetic"
|
||||
data: SessionInputSyntheticData
|
||||
delivery: "steer" | "queue"
|
||||
}
|
||||
|
||||
export type SessionInputMessage = SessionInputUserMessage | SessionInputSyntheticMessage
|
||||
|
||||
export type SessionStructuredError = {
|
||||
type: string
|
||||
message: string
|
||||
|
|
@ -3799,11 +3817,11 @@ export type SyncEventSessionForked = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SyncEventSessionPromptPromoted = {
|
||||
export type SyncEventSessionInputPromoted = {
|
||||
type: "sync"
|
||||
id: string
|
||||
syncEvent: {
|
||||
type: "session.prompt.promoted.1"
|
||||
type: "session.input.promoted.1"
|
||||
id: string
|
||||
seq: number
|
||||
aggregateID: string
|
||||
|
|
@ -3814,19 +3832,18 @@ export type SyncEventSessionPromptPromoted = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SyncEventSessionPromptAdmitted = {
|
||||
export type SyncEventSessionInputAdmitted = {
|
||||
type: "sync"
|
||||
id: string
|
||||
syncEvent: {
|
||||
type: "session.prompt.admitted.1"
|
||||
type: "session.input.admitted.1"
|
||||
id: string
|
||||
seq: number
|
||||
aggregateID: string
|
||||
data: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
prompt: Prompt
|
||||
delivery: "steer" | "queue"
|
||||
input: SessionInputMessage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4459,22 +4476,34 @@ export type PromptInputFileAttachment = {
|
|||
mention?: PromptMention
|
||||
}
|
||||
|
||||
export type SessionInputAdmitted = {
|
||||
export type SessionInputUser = {
|
||||
admittedSeq: number
|
||||
id: string
|
||||
sessionID: string
|
||||
prompt: Prompt
|
||||
delivery: "steer" | "queue"
|
||||
timeCreated: number
|
||||
promotedSeq?: number
|
||||
type: "user"
|
||||
data: SessionInputUserData
|
||||
delivery: "steer" | "queue"
|
||||
}
|
||||
|
||||
export type SessionInputSynthetic = {
|
||||
admittedSeq: number
|
||||
id: string
|
||||
sessionID: string
|
||||
timeCreated: number
|
||||
promotedSeq?: number
|
||||
type: "synthetic"
|
||||
data: SessionInputSyntheticData
|
||||
delivery: "steer" | "queue"
|
||||
}
|
||||
|
||||
export type SessionInputCompaction = {
|
||||
type: "compaction"
|
||||
admittedSeq: number
|
||||
id: string
|
||||
sessionID: string
|
||||
timeCreated: number
|
||||
type: "compaction"
|
||||
handledSeq?: number
|
||||
}
|
||||
|
||||
|
|
@ -4866,13 +4895,13 @@ export type SessionForked = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionPromptPromoted = {
|
||||
export type SessionInputPromoted = {
|
||||
id: string
|
||||
created: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.prompt.promoted"
|
||||
type: "session.input.promoted"
|
||||
durable: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
|
|
@ -4885,13 +4914,13 @@ export type SessionPromptPromoted = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionPromptAdmitted = {
|
||||
export type SessionInputAdmitted = {
|
||||
id: string
|
||||
created: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.prompt.admitted"
|
||||
type: "session.input.admitted"
|
||||
durable: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
|
|
@ -4901,8 +4930,7 @@ export type SessionPromptAdmitted = {
|
|||
data: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
prompt: Prompt
|
||||
delivery: "steer" | "queue"
|
||||
input: SessionInputMessage
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5548,8 +5576,8 @@ export type SessionEventDurable =
|
|||
| SessionRenamed
|
||||
| SessionDeleted
|
||||
| SessionForked
|
||||
| SessionPromptPromoted
|
||||
| SessionPromptAdmitted
|
||||
| SessionInputPromoted
|
||||
| SessionInputAdmitted
|
||||
| SessionExecutionStarted
|
||||
| SessionExecutionSucceeded
|
||||
| SessionExecutionFailed
|
||||
|
|
@ -7182,23 +7210,22 @@ export type EventSessionForked = {
|
|||
}
|
||||
}
|
||||
|
||||
export type EventSessionPromptPromoted = {
|
||||
export type EventSessionInputPromoted = {
|
||||
id: string
|
||||
type: "session.prompt.promoted"
|
||||
type: "session.input.promoted"
|
||||
properties: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
}
|
||||
}
|
||||
|
||||
export type EventSessionPromptAdmitted = {
|
||||
export type EventSessionInputAdmitted = {
|
||||
id: string
|
||||
type: "session.prompt.admitted"
|
||||
type: "session.input.admitted"
|
||||
properties: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
prompt: Prompt
|
||||
delivery: "steer" | "queue"
|
||||
input: SessionInputMessage
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8644,8 +8671,8 @@ export type V2EventV2 =
|
|||
| SessionUsageUpdatedV2
|
||||
| SessionDeletedV2
|
||||
| SessionForkedV2
|
||||
| SessionPromptPromotedV2
|
||||
| SessionPromptAdmittedV2
|
||||
| SessionInputPromotedV2
|
||||
| SessionInputAdmittedV2
|
||||
| SessionExecutionStartedV2
|
||||
| SessionExecutionSucceededV2
|
||||
| SessionExecutionFailedV2
|
||||
|
|
@ -8801,22 +8828,34 @@ export type SessionInfoV2 = {
|
|||
|
||||
export type PromptBase64V2 = string
|
||||
|
||||
export type SessionInputAdmittedV2 = {
|
||||
export type SessionInputUserV2 = {
|
||||
admittedSeq: number
|
||||
id: string
|
||||
sessionID: string
|
||||
prompt: Prompt
|
||||
delivery: "steer" | "queue"
|
||||
timeCreated: number
|
||||
promotedSeq?: number
|
||||
type: "user"
|
||||
data: SessionInputUserData
|
||||
delivery: "steer" | "queue"
|
||||
}
|
||||
|
||||
export type SessionInputSyntheticV2 = {
|
||||
admittedSeq: number
|
||||
id: string
|
||||
sessionID: string
|
||||
timeCreated: number
|
||||
promotedSeq?: number
|
||||
type: "synthetic"
|
||||
data: SessionInputSyntheticData
|
||||
delivery: "steer" | "queue"
|
||||
}
|
||||
|
||||
export type SessionInputCompactionV2 = {
|
||||
type: "compaction"
|
||||
admittedSeq: number
|
||||
id: string
|
||||
sessionID: string
|
||||
timeCreated: number
|
||||
type: "compaction"
|
||||
handledSeq?: number
|
||||
}
|
||||
|
||||
|
|
@ -9115,13 +9154,13 @@ export type SessionForkedV2 = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionPromptPromotedV2 = {
|
||||
export type SessionInputPromotedV2 = {
|
||||
id: string
|
||||
created: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.prompt.promoted"
|
||||
type: "session.input.promoted"
|
||||
durable: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
|
|
@ -9134,13 +9173,42 @@ export type SessionPromptPromotedV2 = {
|
|||
}
|
||||
}
|
||||
|
||||
export type SessionPromptAdmittedV2 = {
|
||||
export type SessionInputUserData1 = {
|
||||
text: string
|
||||
files?: Array<PromptFileAttachment>
|
||||
agents?: Array<PromptAgentAttachment>
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionInputUserMessageV2 = {
|
||||
type: "user"
|
||||
data: SessionInputUserData1
|
||||
delivery: "steer" | "queue"
|
||||
}
|
||||
|
||||
export type SessionInputSyntheticData1 = {
|
||||
text: string
|
||||
description?: string
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
}
|
||||
|
||||
export type SessionInputSyntheticMessageV2 = {
|
||||
type: "synthetic"
|
||||
data: SessionInputSyntheticData1
|
||||
delivery: "steer" | "queue"
|
||||
}
|
||||
|
||||
export type SessionInputAdmittedV2 = {
|
||||
id: string
|
||||
created: number
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
type: "session.prompt.admitted"
|
||||
type: "session.input.admitted"
|
||||
durable: {
|
||||
aggregateID: string
|
||||
seq: number
|
||||
|
|
@ -9150,8 +9218,7 @@ export type SessionPromptAdmittedV2 = {
|
|||
data: {
|
||||
sessionID: string
|
||||
inputID: string
|
||||
prompt: Prompt
|
||||
delivery: "steer" | "queue"
|
||||
input: SessionInputMessage
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -15672,7 +15739,12 @@ export type V2SessionMoveResponse = V2SessionMoveResponses[keyof V2SessionMoveRe
|
|||
export type V2SessionPromptData = {
|
||||
body: {
|
||||
id?: string | null
|
||||
prompt: PromptInput
|
||||
text: string
|
||||
files?: Array<PromptInputFileAttachment>
|
||||
agents?: Array<PromptAgentAttachment>
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
delivery?: "steer" | "queue" | null
|
||||
resume?: boolean | null
|
||||
}
|
||||
|
|
@ -15709,7 +15781,7 @@ export type V2SessionPromptResponses = {
|
|||
* Success
|
||||
*/
|
||||
200: {
|
||||
data: SessionInputAdmittedV2
|
||||
data: SessionInputUserV2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -15764,7 +15836,7 @@ export type V2SessionCommandResponses = {
|
|||
* Success
|
||||
*/
|
||||
200: {
|
||||
data: SessionInputAdmittedV2
|
||||
data: SessionInputUserV2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -15811,11 +15883,13 @@ export type V2SessionSkillResponse = V2SessionSkillResponses[keyof V2SessionSkil
|
|||
|
||||
export type V2SessionSyntheticData = {
|
||||
body: {
|
||||
id?: string | null
|
||||
text: string
|
||||
description?: string | null
|
||||
metadata?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
delivery?: "steer" | "queue" | null
|
||||
resume?: boolean | null
|
||||
}
|
||||
path: {
|
||||
|
|
@ -15838,15 +15912,21 @@ export type V2SessionSyntheticErrors = {
|
|||
* SessionNotFoundError
|
||||
*/
|
||||
404: SessionNotFoundError
|
||||
/**
|
||||
* ConflictError
|
||||
*/
|
||||
409: ConflictErrorV2
|
||||
}
|
||||
|
||||
export type V2SessionSyntheticError = V2SessionSyntheticErrors[keyof V2SessionSyntheticErrors]
|
||||
|
||||
export type V2SessionSyntheticResponses = {
|
||||
/**
|
||||
* <No Content>
|
||||
* Success
|
||||
*/
|
||||
204: void
|
||||
200: {
|
||||
data: SessionInputSyntheticV2
|
||||
}
|
||||
}
|
||||
|
||||
export type V2SessionSyntheticResponse = V2SessionSyntheticResponses[keyof V2SessionSyntheticResponses]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue