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

Function open

packages/opencode/src/cli/cmd/run/demo.ts:276–312  ·  view source on GitHub ↗
(state: State)

Source from the content-addressed store, hash-verified

274}
275
276function open(state: State): string {
277 const id = take(state, "msg", "msg")
278 feed(state, {
279 type: "message.updated",
280 properties: {
281 sessionID: state.id,
282 info: {
283 id,
284 sessionID: state.id,
285 role: "assistant",
286 time: {
287 created: Date.now(),
288 },
289 parentID: `user_${id}`,
290 modelID: "demo",
291 providerID: "demo",
292 mode: "demo",
293 agent: "demo",
294 path: {
295 cwd: process.cwd(),
296 root: process.cwd(),
297 },
298 cost: 0.001,
299 tokens: {
300 input: 120,
301 output: 320,
302 reasoning: 80,
303 cache: {
304 read: 0,
305 write: 0,
306 },
307 },
308 },
309 },
310 } as Event)
311 return id
312}
313
314async function emitText(state: State, body: string, signal?: AbortSignal): Promise<void> {
315 const msg = open(state)

Callers 7

emitTextFunction · 0.70
emitReasoningFunction · 0.70
makeFunction · 0.70
resolveInteractiveStdinFunction · 0.70
run.tsFile · 0.50
web.tsFile · 0.50
openBrowserFunction · 0.50

Calls 3

takeFunction · 0.70
feedFunction · 0.70
cwdMethod · 0.65

Tested by

no test coverage detected