MCPcopy Create free account
hub / github.com/anomalyco/opencode / bootstrapInstance

Function bootstrapInstance

packages/app/src/context/server-sync.tsx:331–370  ·  view source on GitHub ↗
(directory: string)

Source from the content-addressed store, hash-verified

329 }
330
331 async function bootstrapInstance(directory: string) {
332 const key = directoryKey(directory)
333 if (!key) return
334 const pending = booting.get(key)
335 if (pending) return pending
336
337 children.pin(key)
338 const promise = Promise.resolve().then(async () => {
339 const child = children.ensureChild(directory)
340 const cache = children.vcsCache.get(key)
341 if (!cache) return
342 const sdk = sdkFor(directory)
343 await bootstrapDirectory({
344 directory,
345 scope: serverSDK.scope,
346 mcp: children.mcp(key),
347 global: {
348 config: globalStore.config,
349 path: globalStore.path,
350 project: globalStore.project,
351 provider: globalStore.provider,
352 },
353 sdk,
354 store: child[0],
355 setStore: child[1],
356 vcsCache: cache,
357 loadSessions,
358 translate: language.t,
359 queryClient,
360 session,
361 })
362 })
363
364 booting.set(key, promise)
365 void promise.finally(() => {
366 booting.delete(key)
367 children.unpin(key)
368 })
369 return promise
370 }
371
372 const unsub = serverSDK.event.listen((e) => {
373 const directory = e.name

Callers 1

Calls 6

bootstrapDirectoryFunction · 0.90
sdkForFunction · 0.85
mcpMethod · 0.80
getMethod · 0.65
setMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected