@@ -372,6 +372,7 @@ class DaemonProjectClient implements NativeMemoryRequester {
372372 if ( response . body . case !== "getDaemonInfo" ) {
373373 throw new Error ( "Native memory daemon omitted GetDaemonInfo" ) ;
374374 }
375+ assertDaemonSchemaCompatible ( this . pluginVersion , response . body . value , this . endpoint ) ;
375376 const hello = create ( OpenSessionRequestSchema , {
376377 clientInstanceId : randomUUID ( ) ,
377378 minimumProtocolGeneration : DAEMON_PROTOCOL_GENERATION ,
@@ -473,10 +474,11 @@ class DaemonProjectClient implements NativeMemoryRequester {
473474 throw new Error (
474475 `Native memory daemon protocol mismatch at ${ this . endpoint } : ` +
475476 `client supports ${ DAEMON_PROTOCOL_GENERATION } , daemon ${ daemon . daemonVersion } supports ` +
476- `${ daemon . minimumProtocolGeneration } -${ daemon . maximumProtocolGeneration } . ` +
477- "Close active OpenCode processes and restart the native memory daemon." ,
477+ `${ daemon . minimumProtocolGeneration } -${ daemon . maximumProtocolGeneration } (pid ${ daemon . pid } ) . ` +
478+ "Close all OpenCode processes using memory and restart the native memory daemon." ,
478479 ) ;
479480 }
481+ assertDaemonSchemaCompatible ( this . pluginVersion , daemon , this . endpoint ) ;
480482 assertDaemonVersionCompatible ( this . pluginVersion , daemon . daemonVersion , daemon . pid ) ;
481483 const hello = create ( OpenSessionRequestSchema , {
482484 clientInstanceId : randomUUID ( ) ,
@@ -909,6 +911,20 @@ export function assertDaemonVersionCompatible(
909911 ) ;
910912}
911913
914+ export function assertDaemonSchemaCompatible (
915+ pluginVersion : string ,
916+ daemon : Pick < GetDaemonInfoResponse , "daemonVersion" | "domainSchemaGeneration" | "pid" > ,
917+ endpoint : string ,
918+ ) : void {
919+ if ( daemon . domainSchemaGeneration === DOMAIN_SCHEMA_GENERATION ) return ;
920+ throw new Error (
921+ `Native memory daemon domain schema mismatch at ${ endpoint } : ` +
922+ `client ${ DOMAIN_SCHEMA_GENERATION } , daemon ${ daemon . domainSchemaGeneration } ` +
923+ `(plugin ${ pluginVersion } , daemon ${ daemon . daemonVersion } , pid ${ daemon . pid } ). ` +
924+ "Close all OpenCode processes using memory and restart the native memory daemon." ,
925+ ) ;
926+ }
927+
912928function resolvePackagedBinary ( packageName : string , binaryName : string ) : string | undefined {
913929 try {
914930 return require . resolve ( `${ packageName } /bin/${ binaryName } ` ) ;
0 commit comments