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

Function runQueue

packages/opencode/src/cli/cmd/run/runtime.ts:537–688  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

535 })
536
537 const runQueue = async () => {
538 let includeFiles = true
539 if (state.demo) {
540 await state.demo.start()
541 }
542
543 const mod = await import("./runtime.queue")
544 const createSession = input.createSession
545 await mod.runPromptQueue({
546 footer,
547 initialInput: input.initialInput,
548 trace: log,
549 onSend: (prompt) => {
550 state.shown = true
551 state.history.push(prompt)
552 if (prompt.mode !== "shell") {
553 rememberLocal({
554 kind: "user",
555 text: prompt.text,
556 phase: "start",
557 source: "system",
558 messageID: prompt.messageID,
559 })
560 }
561 },
562 onNewSession: createSession
563 ? async () => {
564 try {
565 await state.switching?.catch(() => {})
566 const created = await createSession(ctx, {
567 agent: state.agent,
568 model: state.model,
569 variant: state.activeVariant,
570 })
571 await footer.idle().catch(() => {})
572 await state.stream?.then((item) => item.handle.close()).catch(() => {})
573 state.stream = undefined
574 state.session = undefined
575 state.selectSubagent = undefined
576 state.shown = false
577 state.sessionID = created.sessionID
578 state.sessionTitle = created.sessionTitle
579 state.agent = created.agent ?? state.agent
580 state.history = []
581 state.localRows = []
582 includeFiles = true
583 state.demo = input.demo
584 ? createRunDemo({
585 footer,
586 sessionID: state.sessionID,
587 thinking: input.thinking,
588 limits: () => state.limits,
589 })
590 : undefined
591 log?.write("session.new", {
592 sessionID: state.sessionID,
593 })
594 footer.event({

Callers 1

runInteractiveRuntimeFunction · 0.85

Calls 12

createRunDemoFunction · 0.90
rememberLocalFunction · 0.85
ensureStreamFunction · 0.85
pushMethod · 0.80
idleMethod · 0.80
writeMethod · 0.80
createSessionFunction · 0.70
promptMethod · 0.65
startMethod · 0.45
closeMethod · 0.45
eventMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected