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

Function emit

packages/opencode/src/cli/cmd/run.ts:678–691  ·  view source on GitHub ↗
(type: string, data: Record<string, unknown>)

Source from the content-addressed store, hash-verified

676 const sessionID = sess.id
677
678 function emit(type: string, data: Record<string, unknown>) {
679 if (args.format === "json") {
680 process.stdout.write(
681 JSON.stringify({
682 type,
683 timestamp: Date.now(),
684 sessionID,
685 ...data,
686 }) + EOL,
687 )
688 return true
689 }
690 return false
691 }
692
693 // Consume one subscribed event stream for the active session and mirror it
694 // to stdout/UI. `client` is passed explicitly because attach mode may

Callers 2

loopFunction · 0.70
executeFunction · 0.70

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected