@@ -194,10 +194,10 @@ export interface RegisterToolsDeps {
194194 * minted `cc-<project>-<8>` name reflects the *calling* session's
195195 * project rather than the plugin's own location. Wired at boot in
196196 * `server.ts` from `COMMY_PROJECT` (operator override) and
197- * the git probe; defaults to a constant `undefined` resolver when
197+ * the git probe; defaults to a resolver that always answers none when
198198 * omitted (tests that don't care about per-session derivation).
199199 */
200- readonly projectForCwd ?: ( cwd : string | undefined ) => Effect . Effect < ProjectSlug | undefined >
200+ readonly projectForCwd ?: ( cwd : string | undefined ) => Effect . Effect < Option . Option < ProjectSlug > >
201201 /**
202202 * Restore (or seed) this session's narrow set on its first `subscribe`/
203203 * `unsubscribe` — memoised once per session_id in `server.ts`, so it runs
@@ -506,7 +506,7 @@ const UploadFileArgs = Schema.Struct({ path: Schema.String })
506506
507507const buildToolDefs = ( deps : RegisterToolsDeps , cache : InternalCache ) : ReadonlyArray < ToolDef > => {
508508 const { adapter, identityCache, narrowSet } = deps
509- const projectForCwd = deps . projectForCwd ?? ( ( ) => Effect . succeed ( undefined ) )
509+ const projectForCwd = deps . projectForCwd ?? ( ( ) => Effect . succeedNone )
510510 /**
511511 * The tools that accept a host-supplied `session_id` (see
512512 * {@link ToolDef.hostSuppliedArgs}). EIGHT tools carry it. That is the same
@@ -548,7 +548,7 @@ const buildToolDefs = (deps: RegisterToolsDeps, cache: InternalCache): ReadonlyA
548548 }
549549 const projectForArgs = (
550550 args : Readonly < Record < string , unknown > > ,
551- ) : Effect . Effect < ProjectSlug | undefined > => projectForCwd ( readCwd ( args ) )
551+ ) : Effect . Effect < Option . Option < ProjectSlug > > => projectForCwd ( readCwd ( args ) )
552552 // Every tool call that carries arguments supplies its calling session's
553553 // context, uniformly. This DECIDES NOTHING about identity: it feeds the
554554 // shared session-id deferred (comms-k7cv) and puts the naming inputs where
@@ -569,7 +569,12 @@ const buildToolDefs = (deps: RegisterToolsDeps, cache: InternalCache): ReadonlyA
569569 projectForArgs ( args ) . pipe (
570570 Effect . flatMap ( ( project ) =>
571571 feedSession ( sessionId ) . pipe (
572- Effect . zipRight ( withSessionContext ( effect , { sessionId, project } ) ) ,
572+ Effect . zipRight (
573+ withSessionContext ( effect , {
574+ sessionId,
575+ project : Option . getOrUndefined ( project ) ,
576+ } ) ,
577+ ) ,
573578 ) ,
574579 ) ,
575580 ) ,
@@ -937,7 +942,10 @@ const buildToolDefs = (deps: RegisterToolsDeps, cache: InternalCache): ReadonlyA
937942 // the snapshot persisted below captures the full live set and the
938943 // store's presence stays a true resume signal.
939944 if ( sessionId !== undefined && deps . ensureSessionSubscriptions !== undefined ) {
940- yield * deps . ensureSessionSubscriptions ( sessionId , yield * projectForArgs ( args ) )
945+ yield * deps . ensureSessionSubscriptions (
946+ sessionId ,
947+ Option . getOrUndefined ( yield * projectForArgs ( args ) ) ,
948+ )
941949 }
942950 // Two sinks (see bootstrap.subscribeFromEnv): the consumer-side
943951 // narrow tells the event pump to tee matching events through;
@@ -983,7 +991,10 @@ const buildToolDefs = (deps: RegisterToolsDeps, cache: InternalCache): ReadonlyA
983991 // Fed by `runFor` before this effect runs (see subscribe).
984992 const sessionId = readSessionId ( args )
985993 if ( sessionId !== undefined && deps . ensureSessionSubscriptions !== undefined ) {
986- yield * deps . ensureSessionSubscriptions ( sessionId , yield * projectForArgs ( args ) )
994+ yield * deps . ensureSessionSubscriptions (
995+ sessionId ,
996+ Option . getOrUndefined ( yield * projectForArgs ( args ) ) ,
997+ )
987998 }
988999 yield * Effect . sync ( ( ) => narrowSet . remove ( intent ) ) . pipe (
9891000 Effect . andThen ( adapter . inbox . unsubscribe ( intentToTarget ( intent ) ) ) ,
0 commit comments