File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed
Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change @@ -979,6 +979,35 @@ export namespace Server {
979979 } )
980980 } ,
981981 )
982+ . post (
983+ "/session/:id/prompt_async" ,
984+ describeRoute ( {
985+ description : "Create and send a new message to a session, start if needed and return immediately" ,
986+ operationId : "session.prompt_async" ,
987+ responses : {
988+ 204 : {
989+ description : "Prompt accepted" ,
990+ } ,
991+ ...errors ( 400 , 404 ) ,
992+ } ,
993+ } ) ,
994+ validator (
995+ "param" ,
996+ z . object ( {
997+ id : z . string ( ) . meta ( { description : "Session ID" } ) ,
998+ } ) ,
999+ ) ,
1000+ validator ( "json" , SessionPrompt . PromptInput . omit ( { sessionID : true } ) ) ,
1001+ async ( c ) => {
1002+ c . status ( 204 )
1003+ c . header ( "Content-Type" , "application/json" )
1004+ return stream ( c , async ( stream ) => {
1005+ const sessionID = c . req . valid ( "param" ) . id
1006+ const body = c . req . valid ( "json" )
1007+ SessionPrompt . prompt ( { ...body , sessionID } )
1008+ } )
1009+ } ,
1010+ )
9821011 . post (
9831012 "/session/:id/command" ,
9841013 describeRoute ( {
Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ import type {
7575 SessionMessageData ,
7676 SessionMessageResponses ,
7777 SessionMessageErrors ,
78+ SessionPromptAsyncData ,
79+ SessionPromptAsyncResponses ,
80+ SessionPromptAsyncErrors ,
7881 SessionCommandData ,
7982 SessionCommandResponses ,
8083 SessionCommandErrors ,
@@ -513,6 +516,20 @@ class Session extends _HeyApiClient {
513516 } )
514517 }
515518
519+ /**
520+ * Create and send a new message to a session, start if needed and return immediately
521+ */
522+ public promptAsync < ThrowOnError extends boolean = false > ( options : Options < SessionPromptAsyncData , ThrowOnError > ) {
523+ return ( options . client ?? this . _client ) . post < SessionPromptAsyncResponses , SessionPromptAsyncErrors , ThrowOnError > ( {
524+ url : "/session/{id}/prompt_async" ,
525+ ...options ,
526+ headers : {
527+ "Content-Type" : "application/json" ,
528+ ...options . headers ,
529+ } ,
530+ } )
531+ }
532+
516533 /**
517534 * Send a new command to a session
518535 */
Original file line number Diff line number Diff line change @@ -2301,6 +2301,55 @@ export type SessionMessageResponses = {
23012301
23022302export type SessionMessageResponse = SessionMessageResponses [ keyof SessionMessageResponses ]
23032303
2304+ export type SessionPromptAsyncData = {
2305+ body ?: {
2306+ messageID ?: string
2307+ model ?: {
2308+ providerID : string
2309+ modelID : string
2310+ }
2311+ agent ?: string
2312+ noReply ?: boolean
2313+ system ?: string
2314+ tools ?: {
2315+ [ key : string ] : boolean
2316+ }
2317+ parts : Array < TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput >
2318+ }
2319+ path : {
2320+ /**
2321+ * Session ID
2322+ */
2323+ id : string
2324+ }
2325+ query ?: {
2326+ directory ?: string
2327+ }
2328+ url : "/session/{id}/prompt_async"
2329+ }
2330+
2331+ export type SessionPromptAsyncErrors = {
2332+ /**
2333+ * Bad request
2334+ */
2335+ 400 : BadRequestError
2336+ /**
2337+ * Not found
2338+ */
2339+ 404 : NotFoundError
2340+ }
2341+
2342+ export type SessionPromptAsyncError = SessionPromptAsyncErrors [ keyof SessionPromptAsyncErrors ]
2343+
2344+ export type SessionPromptAsyncResponses = {
2345+ /**
2346+ * Prompt accepted
2347+ */
2348+ 204 : void
2349+ }
2350+
2351+ export type SessionPromptAsyncResponse = SessionPromptAsyncResponses [ keyof SessionPromptAsyncResponses ]
2352+
23042353export type SessionCommandData = {
23052354 body ?: {
23062355 messageID ?: string
You can’t perform that action at this time.
0 commit comments