@@ -3,7 +3,7 @@ import { SessionID } from "@/session/schema"
33import { SyncEvent } from "@/sync"
44import { Effect , Layer , Scope , Context } from "effect"
55import { Config } from "@/config/config"
6- import { Flag } from "@opencode-ai/core/flag/flag "
6+ import { RuntimeFlags } from "@/effect/runtime-flags "
77import * as ShareNext from "./share-next"
88
99export interface Interface {
@@ -22,6 +22,7 @@ export const layer = Layer.effect(
2222 const shareNext = yield * ShareNext . Service
2323 const scope = yield * Scope . Scope
2424 const sync = yield * SyncEvent . Service
25+ const flags = yield * RuntimeFlags . Service
2526
2627 const share = Effect . fn ( "SessionShare.share" ) ( function * ( sessionID : SessionID ) {
2728 const conf = yield * cfg . get ( )
@@ -40,7 +41,7 @@ export const layer = Layer.effect(
4041 const result = yield * session . create ( input )
4142 if ( result . parentID ) return result
4243 const conf = yield * cfg . get ( )
43- if ( ! ( Flag . OPENCODE_AUTO_SHARE || conf . share === "auto" ) ) return result
44+ if ( ! ( flags . autoShare || conf . share === "auto" ) ) return result
4445 yield * share ( result . id ) . pipe ( Effect . ignore , Effect . forkIn ( scope ) )
4546 return result
4647 } )
@@ -54,6 +55,7 @@ export const defaultLayer = layer.pipe(
5455 Layer . provide ( Session . defaultLayer ) ,
5556 Layer . provide ( Config . defaultLayer ) ,
5657 Layer . provide ( SyncEvent . defaultLayer ) ,
58+ Layer . provide ( RuntimeFlags . defaultLayer ) ,
5759)
5860
5961export * as SessionShare from "./session"
0 commit comments