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

Function ensureSession

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

Source from the content-addressed store, hash-verified

209 agent: ctx.agent,
210 }
211 const ensureSession = () => {
212 if (!input.resolveSession || state.sessionID) {
213 return Promise.resolve()
214 }
215
216 if (state.session) {
217 return state.session
218 }
219
220 state.session = input.resolveSession(ctx).then((next) => {
221 state.sessionID = next.sessionID
222 state.sessionTitle = next.sessionTitle ?? state.sessionTitle
223 state.agent = next.agent
224 })
225 return state.session
226 }
227
228 const shell = await (deps.createRuntimeLifecycle ?? createRuntimeLifecycle)({
229 directory: ctx.directory,

Callers 2

runInteractiveRuntimeFunction · 0.85
ensureStreamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected