test: migrate prompt tests to HTTP mock LLM server (#20304)

This commit is contained in:
Kit Langton
2026-03-31 19:14:32 -04:00
committed by GitHub
parent 53330a518f
commit 0c03a3ee10
27 changed files with 1140 additions and 711 deletions

View File

@@ -114,6 +114,14 @@ export const Instance = {
const ctx = context.use()
return ((...args: any[]) => context.provide(ctx, () => fn(...args))) as F
},
/**
* Run a synchronous function within the given instance context ALS.
* Use this to bridge from Effect (where InstanceRef carries context)
* back to sync code that reads Instance.directory from ALS.
*/
restore<R>(ctx: InstanceContext, fn: () => R): R {
return context.provide(ctx, fn)
},
state<S>(init: () => S, dispose?: (state: Awaited<S>) => Promise<void>): () => S {
return State.create(() => Instance.directory, init, dispose)
},