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

Function createSessionResolver

packages/opencode/src/cli/cmd/run/runtime.ts:100–117  ·  view source on GitHub ↗
(fn?: CreateSession)

Source from the content-addressed store, hash-verified

98}
99
100function createSessionResolver(fn?: CreateSession) {
101 if (!fn) {
102 return undefined
103 }
104
105 return async (ctx: BootContext, input: CreateSessionInput): Promise<ResolvedSession> => {
106 const created = await fn(ctx.sdk, input)
107 if (!created.id) {
108 throw new Error("Failed to create session")
109 }
110
111 return {
112 sessionID: created.id,
113 sessionTitle: created.title,
114 agent: input.agent,
115 }
116 }
117}
118
119type RuntimeState = {
120 shown: boolean

Callers 2

runInteractiveLocalModeFunction · 0.85
runInteractiveModeFunction · 0.85

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected