* Add a prompt to the queue for later execution
(
sessionId: string,
prompt: {
message: string;
imagePaths?: string[];
model?: string;
thinkingLevel?: ThinkingLevel;
}
)
| 1057 | * Add a prompt to the queue for later execution |
| 1058 | */ |
| 1059 | async addToQueue( |
| 1060 | sessionId: string, |
| 1061 | prompt: { |
| 1062 | message: string; |
| 1063 | imagePaths?: string[]; |
| 1064 | model?: string; |
| 1065 | thinkingLevel?: ThinkingLevel; |
| 1066 | } |
| 1067 | ): Promise<{ success: boolean; queuedPrompt?: QueuedPrompt; error?: string }> { |
| 1068 | const session = await this.ensureSession(sessionId); |
| 1069 | if (!session) { |
| 1070 | return { success: false, error: 'Session not found' }; |
| 1071 | } |
| 1072 | |
| 1073 | const queuedPrompt: QueuedPrompt = { |
| 1074 | id: this.generateId(), |
| 1075 | message: prompt.message, |
| 1076 | imagePaths: prompt.imagePaths, |
| 1077 | model: prompt.model, |
| 1078 | thinkingLevel: prompt.thinkingLevel, |
| 1079 | addedAt: new Date().toISOString(), |
| 1080 | }; |
| 1081 | |
| 1082 | session.promptQueue.push(queuedPrompt); |
| 1083 | await this.saveQueueState(sessionId, session.promptQueue); |
| 1084 | |
| 1085 | // Emit queue update event |
| 1086 | this.emitAgentEvent(sessionId, { |
| 1087 | type: 'queue_updated', |
| 1088 | queue: session.promptQueue, |
| 1089 | }); |
| 1090 | |
| 1091 | return { success: true, queuedPrompt }; |
| 1092 | } |
| 1093 | |
| 1094 | /** |
| 1095 | * Get the current queue for a session |
no test coverage detected