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

Function reload

packages/opencode/src/project/instance-store.ts:126–145  ·  view source on GitHub ↗
(input: LoadInput)

Source from the content-addressed store, hash-verified

124 }
125
126 const reload = (input: LoadInput): Effect.Effect<InstanceContext> => {
127 const directory = FSUtil.resolve(input.directory)
128 return Effect.uninterruptibleMask((restore) =>
129 Effect.gen(function* () {
130 const previous = cache.get(directory)
131 const entry: Entry = { deferred: Deferred.makeUnsafe<InstanceContext>() }
132 cache.set(directory, entry)
133 yield* Effect.gen(function* () {
134 yield* Effect.logInfo("reloading instance", { directory: directory })
135 if (previous) {
136 yield* Deferred.await(previous.deferred).pipe(Effect.ignore)
137 yield* Effect.promise(() => runDisposers(directory))
138 yield* emitDisposed({ directory, project: input.project?.id })
139 }
140 yield* completeLoad(directory, input, entry)
141 }).pipe(Effect.forkIn(scope, { startImmediately: true }))
142 return yield* restore(Deferred.await(entry.deferred))
143 }),
144 ).pipe(Effect.withSpan("InstanceStore.reload"))
145 }
146
147 const dispose = Effect.fn("InstanceStore.dispose")(function* (ctx: InstanceContext) {
148 const entry = cache.get(ctx.directory)

Callers

nothing calls this directly

Calls 5

emitDisposedFunction · 0.85
completeLoadFunction · 0.85
getMethod · 0.65
restoreFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected