@@ -23,41 +23,45 @@ afterEach(async () => {
2323} ) ;
2424
2525describe ( "createHarnessRuntime" , ( ) => {
26- it ( "returns a native Pi runtime with the PostHog model and named harness extensions" , async ( ) => {
27- vi . stubEnv ( "PI_OFFLINE" , "1" ) ;
28- const pi = await import ( "@earendil-works/pi-coding-agent" ) ;
29- const cwd = await temporaryDirectory ( ) ;
30- const agentDir = await temporaryDirectory ( ) ;
31-
32- const runtime = await createHarnessRuntime ( {
33- agentDir,
34- authStorage : pi . AuthStorage . inMemory ( ) ,
35- cwd,
36- sessionManager : pi . SessionManager . inMemory ( cwd ) ,
37- } ) ;
26+ it (
27+ "returns a native Pi runtime with the PostHog model and named harness extensions" ,
28+ { timeout : 15_000 } ,
29+ async ( ) => {
30+ vi . stubEnv ( "PI_OFFLINE" , "1" ) ;
31+ const pi = await import ( "@earendil-works/pi-coding-agent" ) ;
32+ const cwd = await temporaryDirectory ( ) ;
33+ const agentDir = await temporaryDirectory ( ) ;
34+
35+ const runtime = await createHarnessRuntime ( {
36+ agentDir,
37+ authStorage : pi . AuthStorage . inMemory ( ) ,
38+ cwd,
39+ sessionManager : pi . SessionManager . inMemory ( cwd ) ,
40+ } ) ;
3841
39- try {
40- expect ( runtime ) . toBeInstanceOf ( pi . AgentSessionRuntime ) ;
41- expect ( runtime . session . model ?. provider ) . toBe ( "posthog" ) ;
42- expect ( runtime . services . settingsManager . isProjectTrusted ( ) ) . toBe ( false ) ;
43- expect (
44- runtime . services . resourceLoader
45- . getExtensions ( )
46- . extensions . map ( ( extension ) => extension . path ) ,
47- ) . toEqual (
48- expect . arrayContaining ( [
49- "<inline:hog-branding>" ,
50- "<inline:posthog-provider>" ,
51- "<inline:web-access>" ,
52- "<inline:subagent>" ,
53- "<inline:workflow>" ,
54- "<inline:mcp>" ,
55- ] ) ,
56- ) ;
57- } finally {
58- await runtime . dispose ( ) ;
59- }
60- } ) ;
42+ try {
43+ expect ( runtime ) . toBeInstanceOf ( pi . AgentSessionRuntime ) ;
44+ expect ( runtime . session . model ?. provider ) . toBe ( "posthog" ) ;
45+ expect ( runtime . services . settingsManager . isProjectTrusted ( ) ) . toBe ( false ) ;
46+ expect (
47+ runtime . services . resourceLoader
48+ . getExtensions ( )
49+ . extensions . map ( ( extension ) => extension . path ) ,
50+ ) . toEqual (
51+ expect . arrayContaining ( [
52+ "<inline:hog-branding>" ,
53+ "<inline:posthog-provider>" ,
54+ "<inline:web-access>" ,
55+ "<inline:subagent>" ,
56+ "<inline:workflow>" ,
57+ "<inline:mcp>" ,
58+ ] ) ,
59+ ) ;
60+ } finally {
61+ await runtime . dispose ( ) ;
62+ }
63+ } ,
64+ ) ;
6165
6266 it ( "keeps desktop-provided OAuth credentials in memory without touching auth.json" , async ( ) => {
6367 vi . stubEnv ( "PI_OFFLINE" , "1" ) ;
0 commit comments