MCPcopy Index your code
hub / github.com/anomalyco/opencode / submit

Function submit

packages/opencode/src/cli/cmd/run/runtime.queue.ts:268–315  ·  view source on GitHub ↗
(prompt: RunPrompt)

Source from the content-addressed store, hash-verified

266 }
267
268 const submit = (prompt: RunPrompt) => {
269 if (!prompt.text.trim() || state.closed) {
270 return
271 }
272
273 if (prompt.mode !== "shell" && isExitCommand(prompt.text)) {
274 input.footer.close()
275 return
276 }
277
278 const active = state.active
279 if (
280 active &&
281 active.mode !== "shell" &&
282 !active.command &&
283 prompt.mode !== "shell" &&
284 !prompt.command &&
285 !isNewCommand(prompt.text)
286 ) {
287 const queued: FooterQueuedPrompt = {
288 messageID: MessageID.ascending(),
289 partID: PartID.ascending(),
290 prompt,
291 }
292 state.queued = [...state.queued, queued]
293 state.queue.push(prompt)
294 syncQueue()
295 return
296 }
297
298 state.queue.push(prompt)
299 syncQueue()
300 if (prompt.mode !== "shell" && isNewCommand(prompt.text)) {
301 drain()
302 return
303 }
304
305 emit(
306 {
307 type: "first",
308 first: false,
309 },
310 {
311 first: false,
312 },
313 )
314 drain()
315 }
316
317 const offPrompt = input.footer.onPrompt((prompt) => {
318 submit(prompt)

Callers 1

runPromptQueueFunction · 0.70

Calls 7

isExitCommandFunction · 0.90
isNewCommandFunction · 0.90
syncQueueFunction · 0.85
pushMethod · 0.80
drainFunction · 0.70
emitFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected