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

Function emitFmt

packages/opencode/src/cli/cmd/run/demo.ts:1023–1101  ·  view source on GitHub ↗
(state: State, kind: string, body: string, signal?: AbortSignal)

Source from the content-addressed store, hash-verified

1021}
1022
1023async function emitFmt(state: State, kind: string, body: string, signal?: AbortSignal): Promise<boolean> {
1024 if (kind === "text") {
1025 await emitText(state, body || SAMPLE_MARKDOWN, signal)
1026 return true
1027 }
1028
1029 if (kind === "markdown" || kind === "md") {
1030 await emitText(state, body || SAMPLE_MARKDOWN, signal)
1031 return true
1032 }
1033
1034 if (kind === "table") {
1035 await emitText(state, body || SAMPLE_TABLE, signal)
1036 return true
1037 }
1038
1039 if (kind === "reasoning") {
1040 await emitReasoning(state, body || "Planning next steps [REDACTED] while preserving reducer ordering.", signal)
1041 return true
1042 }
1043
1044 if (kind === "bash") {
1045 await emitBash(state, signal)
1046 return true
1047 }
1048
1049 if (kind === "write") {
1050 emitWrite(state)
1051 return true
1052 }
1053
1054 if (kind === "edit") {
1055 emitEdit(state)
1056 return true
1057 }
1058
1059 if (kind === "patch") {
1060 emitPatch(state)
1061 return true
1062 }
1063
1064 if (kind === "task") {
1065 emitTask(state)
1066 return true
1067 }
1068
1069 if (kind === "todo") {
1070 emitTodo(state)
1071 return true
1072 }
1073
1074 if (kind === "question") {
1075 emitQuestionTool(state)
1076 return true
1077 }
1078
1079 if (kind === "error") {
1080 emitError(state, body || "demo error event")

Callers 1

promptFunction · 0.85

Calls 11

emitTextFunction · 0.85
emitReasoningFunction · 0.85
emitBashFunction · 0.85
emitWriteFunction · 0.85
emitEditFunction · 0.85
emitPatchFunction · 0.85
emitTaskFunction · 0.85
emitTodoFunction · 0.85
emitQuestionToolFunction · 0.85
emitErrorFunction · 0.85
waitFunction · 0.70

Tested by

no test coverage detected