MCPcopy
hub / github.com/Dimillian/CodexMonitor / useQueuedSend

Function useQueuedSend

src/features/threads/hooks/useQueuedSend.ts:108–441  ·  view source on GitHub ↗
({
  activeThreadId,
  activeTurnId,
  isProcessing,
  isReviewing,
  queueFlushPaused = false,
  steerEnabled,
  followUpMessageBehavior,
  appsEnabled,
  activeWorkspace,
  connectWorkspace,
  startThreadForWorkspace,
  sendUserMessage,
  sendUserMessageToThread,
  startFork,
  startReview,
  startResume,
  startCompact,
  startApps,
  startMcp,
  startFast,
  startStatus,
  clearActiveImages,
}: UseQueuedSendOptions)

Source from the content-addressed store, hash-verified

106}
107
108export function useQueuedSend({
109 activeThreadId,
110 activeTurnId,
111 isProcessing,
112 isReviewing,
113 queueFlushPaused = false,
114 steerEnabled,
115 followUpMessageBehavior,
116 appsEnabled,
117 activeWorkspace,
118 connectWorkspace,
119 startThreadForWorkspace,
120 sendUserMessage,
121 sendUserMessageToThread,
122 startFork,
123 startReview,
124 startResume,
125 startCompact,
126 startApps,
127 startMcp,
128 startFast,
129 startStatus,
130 clearActiveImages,
131}: UseQueuedSendOptions): UseQueuedSendResult {
132 const [queuedByThread, setQueuedByThread] = useState<
133 Record<string, QueuedMessage[]>
134 >({});
135 const [inFlightByThread, setInFlightByThread] = useState<
136 Record<string, QueuedMessage | null>
137 >({});
138 const [hasStartedByThread, setHasStartedByThread] = useState<
139 Record<string, boolean>
140 >({});
141
142 const activeQueue = useMemo(
143 () => (activeThreadId ? queuedByThread[activeThreadId] ?? [] : []),
144 [activeThreadId, queuedByThread],
145 );
146
147 const enqueueMessage = useCallback((threadId: string, item: QueuedMessage) => {
148 setQueuedByThread((prev) => ({
149 ...prev,
150 [threadId]: [...(prev[threadId] ?? []), item],
151 }));
152 }, []);
153
154 const removeQueuedMessage = useCallback(
155 (threadId: string, messageId: string) => {
156 setQueuedByThread((prev) => ({
157 ...prev,
158 [threadId]: (prev[threadId] ?? []).filter(
159 (entry) => entry.id !== messageId,
160 ),
161 }));
162 },
163 [],
164 );
165

Calls 4

startReviewFunction · 0.85
parseSlashCommandFunction · 0.85
connectWorkspaceFunction · 0.85
sendUserMessageFunction · 0.85

Tested by

no test coverage detected