@@ -227,7 +227,7 @@ vi.mock("../features/settings/appearance/AppearancePreferencesProvider", () => (
227227} ) ) ;
228228vi . mock ( "../features/terminal/terminalTheme" , ( ) => ( { getMobileTerminalTheme : ( ) => ( { } ) } ) ) ;
229229import { ComposerContextSheet } from "./ComposerContextSheet" ;
230- import { ProjectKnowledgeEntry , requestRememberMessage } from "./ProjectKnowledgeEntry" ;
230+ import { ProjectKnowledgeEntry , requestProjectMemory } from "./ProjectKnowledgeEntry" ;
231231
232232const scope = {
233233 environmentId : EnvironmentId . make ( "mobile-memory" ) ,
@@ -330,6 +330,7 @@ function setup(entries = [scope]) {
330330 ) ,
331331 ) ,
332332 rerender : ( ) => act ( ( ) => root . render ( renderEntries ( ) ) ) ,
333+ openMemory : ( ) => act ( ( ) => requestProjectMemory ( { ...entries [ 0 ] ! , message : null } ) ) ,
333334 click : async ( label : string ) => {
334335 const button = [ ...container . querySelectorAll ( "button" ) ] . find (
335336 ( item ) => item . textContent === label || item . getAttribute ( "aria-label" ) === label ,
@@ -400,7 +401,7 @@ it.each(["selection", "archive", "close", "unmount", "removal"] as const)(
400401 complete = resolve ;
401402 } ) ,
402403 ) ;
403- await screen . click ( "Project memory" ) ;
404+ screen . openMemory ( ) ;
404405 if ( change !== "removal" ) await screen . click ( "Select for draft" ) ;
405406 await screen . click ( "Attach to draft" ) ;
406407 if ( change === "selection" ) await screen . click ( "Selected for draft" ) ;
@@ -410,7 +411,7 @@ it.each(["selection", "archive", "close", "unmount", "removal"] as const)(
410411 ) ;
411412 if ( change === "close" ) {
412413 await screen . click ( "Close" ) ;
413- await screen . click ( "Project memory" ) ;
414+ screen . openMemory ( ) ;
414415 }
415416 if ( change === "unmount" ) screen . unmount ( ) ;
416417 if ( change === "removal" ) await screen . click ( "Remove from draft" ) ;
@@ -435,7 +436,7 @@ it("flags a fact whose citation is unavailable in the list", async () => {
435436 nextCursor : null ,
436437 unavailableSources : [ { factId : fact . id , reason : "changed" } ] ,
437438 } ;
438- await screen . click ( "Project memory" ) ;
439+ screen . openMemory ( ) ;
439440 expect ( screen . container . textContent ) . toContain ( "Source changed" ) ;
440441} ) ;
441442
@@ -457,7 +458,7 @@ it("saves a remembered feed message with a citation to that message", async () =
457458 archived : false ,
458459 } ;
459460 act ( ( ) =>
460- requestRememberMessage ( {
461+ requestProjectMemory ( {
461462 environmentId : scope . environmentId ,
462463 projectId : scope . projectId ,
463464 draftKey : scope . draftKey ,
@@ -487,7 +488,7 @@ it("shows user origin once without treating the assertion as a citation", async
487488 sources : [ { kind : "user" } ] ,
488489 } ;
489490 state . list = { facts : [ asserted ] , nextCursor : null } ;
490- await screen . click ( "Project memory" ) ;
491+ screen . openMemory ( ) ;
491492 await screen . click ( "Inspect fact: " + asserted . content ) ;
492493 expect ( screen . container . textContent ?. match ( / U s e r a s s e r t i o n / g) ) . toHaveLength ( 1 ) ;
493494 expect ( screen . container . textContent ) . toContain ( "No cited source" ) ;
@@ -496,7 +497,7 @@ it("shows user origin once without treating the assertion as a citation", async
496497
497498it ( "attaches the current selection" , async ( ) => {
498499 using screen = setup ( ) ;
499- await screen . click ( "Project memory" ) ;
500+ screen . openMemory ( ) ;
500501 await screen . click ( "Select for draft" ) ;
501502 await screen . click ( "Attach to draft" ) ;
502503 expect ( state . insert ) . toHaveBeenCalledWith (
@@ -513,7 +514,7 @@ it("attaches the current selection", async () => {
513514
514515it ( "edits a citationless agent observation as an explicit user assertion" , async ( ) => {
515516 using screen = setup ( ) ;
516- await screen . click ( "Project memory" ) ;
517+ screen . openMemory ( ) ;
517518 await screen . click ( `Inspect fact: ${ fact . content } ` ) ;
518519 await screen . click ( "Edit" ) ;
519520 await screen . click ( "Save" ) ;
@@ -558,7 +559,7 @@ it("pages both result streams without restarting the other stream", async () =>
558559 ] ,
559560 } ,
560561 } ) ) ;
561- await screen . click ( "Project memory" ) ;
562+ screen . openMemory ( ) ;
562563 const input = screen . container . querySelector (
563564 '[aria-label="Search project knowledge"]' ,
564565 ) as HTMLInputElement ;
@@ -620,7 +621,7 @@ it.each([
620621] as const ) ( "sends %s feedback against the fact's revision" , async ( label , helpful ) => {
621622 using screen = setup ( ) ;
622623 state . list = { facts : [ { ...fact , revision : 3 } ] , nextCursor : null } ;
623- await screen . click ( "Project memory" ) ;
624+ screen . openMemory ( ) ;
624625 await screen . click ( `Inspect fact: ${ fact . content } ` ) ;
625626 await screen . click ( label ) ;
626627 expect ( state . mutate ) . toHaveBeenCalledWith ( {
@@ -638,7 +639,7 @@ it.each([
638639
639640it ( "forgets a fact only after the permanent-erase warning is confirmed" , async ( ) => {
640641 using screen = setup ( ) ;
641- await screen . click ( "Project memory" ) ;
642+ screen . openMemory ( ) ;
642643 await screen . click ( `Inspect fact: ${ fact . content } ` ) ;
643644
644645 await screen . click ( "Forget" ) ;
@@ -673,7 +674,7 @@ it("marks a superseded fact read-only and lists superseded facts on request", as
673674 facts : [ { ...fact , supersededBy : ProjectFactId . make ( "replacement" ) } ] ,
674675 nextCursor : null ,
675676 } ;
676- await screen . click ( "Project memory" ) ;
677+ screen . openMemory ( ) ;
677678 expect ( screen . container . textContent ) . toContain ( "Superseded" ) ;
678679 await screen . click ( `Inspect fact: ${ fact . content } ` ) ;
679680 const labels = [ ...screen . container . querySelectorAll ( "button" ) ] . map ( ( item ) => item . textContent ) ;
@@ -709,7 +710,7 @@ it("supersedes a fact with a new replacement and shows the returned conflict hin
709710 ] ,
710711 } ,
711712 } ) ;
712- await screen . click ( "Project memory" ) ;
713+ screen . openMemory ( ) ;
713714 await screen . click ( `Inspect fact: ${ fact . content } ` ) ;
714715 await screen . click ( "Supersede" ) ;
715716 await screen . click ( "Save" ) ;
@@ -737,7 +738,7 @@ it("treats a changed message source as the same selection and shows it as change
737738 facts : { state : "available" , matches : [ ] , coverage : "complete" , nextCursor : null } ,
738739 } ) ;
739740 state . search = match ( "a" . repeat ( 64 ) ) ;
740- await screen . click ( "Project memory" ) ;
741+ screen . openMemory ( ) ;
741742 const input = screen . container . querySelector (
742743 '[aria-label="Search project knowledge"]' ,
743744 ) as HTMLInputElement ;
@@ -790,7 +791,7 @@ it("replaces a changed source with its current version on request", async () =>
790791 maxBytes : 48_000 ,
791792 } ) ;
792793 state . draft = { text : reference . text , context : { records : [ reference . record ] } } ;
793- await screen . click ( "Project memory" ) ;
794+ screen . openMemory ( ) ;
794795 const input = screen . container . querySelector (
795796 '[aria-label="Search project knowledge"]' ,
796797 ) as HTMLInputElement ;
@@ -818,7 +819,7 @@ it("removes the attached draft reference when the selection changes and says so"
818819 state . setText . mockImplementation ( ( _key : string , text : string ) => {
819820 state . draft = { text } ;
820821 } ) ;
821- await screen . click ( "Project memory" ) ;
822+ screen . openMemory ( ) ;
822823 expect ( screen . container . textContent ) . toContain ( "is attached to this draft" ) ;
823824 await screen . click ( "Selected for draft" ) ;
824825 expect ( state . setText ) . toHaveBeenCalledWith ( scope . draftKey , "See" ) ;
@@ -836,7 +837,7 @@ it("drops a revised fact from the selection and the draft after saving", async (
836837 state . setText . mockImplementation ( ( _key : string , text : string ) => {
837838 state . draft = { text } ;
838839 } ) ;
839- await screen . click ( "Project memory" ) ;
840+ screen . openMemory ( ) ;
840841 await screen . click ( `Inspect fact: ${ fact . content } ` ) ;
841842 await screen . click ( "Confirm" ) ;
842843 expect ( state . setText ) . toHaveBeenCalledWith ( scope . draftKey , "" ) ;
@@ -862,7 +863,7 @@ it("opens only the destination composer for a remembered message from another th
862863 archived : false ,
863864 } ;
864865 act ( ( ) =>
865- requestRememberMessage ( {
866+ requestProjectMemory ( {
866867 environmentId : scope . environmentId ,
867868 projectId : scope . projectId ,
868869 draftKey : "other-thread-draft" ,
@@ -883,7 +884,7 @@ it("ignores remember requests while the destination entry is unfocused", () => {
883884 state . focused = false ;
884885 screen . rerender ( ) ;
885886 act ( ( ) =>
886- requestRememberMessage ( {
887+ requestProjectMemory ( {
887888 environmentId : scope . environmentId ,
888889 projectId : scope . projectId ,
889890 draftKey : scope . draftKey ,
@@ -901,7 +902,7 @@ it.each(["Hardware Back", "Header Back"])(
901902 async ( back ) => {
902903 using screen = setup ( ) ;
903904 state . androidSheet = true ;
904- await screen . click ( "Project memory" ) ;
905+ screen . openMemory ( ) ;
905906 await screen . click ( "Select for draft" ) ;
906907 await screen . click ( "Inspect fact: " + fact . content ) ;
907908 await screen . click ( back ) ;
@@ -917,7 +918,7 @@ it.each(["Hardware Back", "Header Back"])(
917918 async ( back ) => {
918919 using screen = setup ( ) ;
919920 state . androidSheet = true ;
920- await screen . click ( "Project memory" ) ;
921+ screen . openMemory ( ) ;
921922 await screen . click ( back ) ;
922923 expect ( screen . container . textContent ) . not . toContain ( "Search" ) ;
923924 } ,
@@ -928,7 +929,7 @@ it.each(["Hardware Back", "Header Back", "Back", "Cancel"])(
928929 async ( back ) => {
929930 using screen = setup ( ) ;
930931 state . androidSheet = true ;
931- await screen . click ( "Project memory" ) ;
932+ screen . openMemory ( ) ;
932933 await screen . click ( "Inspect fact: " + fact . content ) ;
933934 await screen . click ( "Edit" ) ;
934935 const input = screen . container . querySelector ( '[aria-label="Fact content"]' ) as HTMLInputElement ;
0 commit comments