File tree Expand file tree Collapse file tree
extensions/memory-core/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1271,6 +1271,23 @@ export async function runMemorySearch(
12711271 typeof ( manager as { status ?: ( ) => { workspaceDir ?: string } } ) . status === "function"
12721272 ? manager . status ( ) . workspaceDir
12731273 : undefined ;
1274+ if ( opts . json ) {
1275+ defaultRuntime . writeJson ( { results } ) ;
1276+ if ( dreamingEnabled && workspaceDir ) {
1277+ void recordShortTermRecalls ( {
1278+ workspaceDir,
1279+ query,
1280+ results,
1281+ timezone : dreaming . timezone ,
1282+ } ) . catch ( ( ) => {
1283+ // Recall tracking is best-effort and must not block normal search results.
1284+ } ) ;
1285+ }
1286+ if ( ! process . env . VITEST ) {
1287+ setImmediate ( ( ) => process . exit ( process . exitCode ?? 0 ) ) ;
1288+ }
1289+ return ;
1290+ }
12741291 if ( dreamingEnabled ) {
12751292 void recordShortTermRecalls ( {
12761293 workspaceDir,
@@ -1281,10 +1298,6 @@ export async function runMemorySearch(
12811298 // Recall tracking is best-effort and must not block normal search results.
12821299 } ) ;
12831300 }
1284- if ( opts . json ) {
1285- defaultRuntime . writeJson ( { results } ) ;
1286- return ;
1287- }
12881301 const identityWarning =
12891302 typeof manager . status === "function"
12901303 ? formatMemoryIndexIdentityWarning ( manager . status ( ) , agentId )
You can’t perform that action at this time.
0 commit comments