// Run with Node's test runner and Playwright on the module path; see README.md. // The Library's Memory tab (internal/memory, /api/memory): the switch that // gives the agents ticked for instructions the memories' summary, the // Magpie Memory server offered while it isn't in the library, the memories // in use pinned first, a search, the ones an agent only guessed waiting // under To review, and a memory added, edited through the app's menu (never // a await drow.locator(".lib-distmodel").click(); await page.locator(".proto-menu .pm-item", { hasText: "Model One" }).click(); await page.waitForFunction(() => /Model One/.test(document.querySelector("#view-library .lib-distmodel")?.textContent || "")); assert.deepEqual(sent.findLast((x) => x.path === "/api/memory/distill").body, { on: true, model: "dt/m1" }); assert.equal(await page.locator(`${view} select`).count(), 0, "a native select"); await drow.locator(".lib-distnow").waitFor({ timeout: 8000 }); // a reasoning level picked: the model's own levels, Default first assert.equal(await drow.locator(".lib-disteffort .effort-ic").count(), 1); await drow.locator(".lib-disteffort").click(); assert.equal(await page.locator(".proto-menu .pm-item").count(), 4); await page.locator(".proto-menu .pm-item").nth(3).click(); await page.waitForFunction(() => document.querySelector("#view-library .lib-disteffort")?.textContent.trim() !== "" && !document.querySelector(".proto-menu")); assert.deepEqual(sent.findLast((x) => x.path === "/api/memory/distill").body, { on: true, model: "dt/m1", effort: "high" }); // how far back: 7 days unless picked; All reads at once await drow.locator(".lib-distrange").click(); assert.equal(await page.locator(".proto-menu .pm-item").count(), 5); await page.locator(".proto-menu .pm-item").nth(4).click(); assert.deepEqual(sent.findLast((x) => x.path === "/api/memory/distill").body, { on: true, model: "dt/m1", days: -1 }); await page.waitForFunction((was) => document.querySelector("#view-library .lib-distrange")?.textContent !== was, rangeShown); // stopped: what it left is said, and Read now reads the rest assert.match(await drow.locator(".sub").textContent(), /3\D+400/); await drow.locator(".lib-diststop").click(); await drow.locator(".lib-distnow").waitFor({ timeout: 8000 }); assert.ok(sent.some((x) => x.path === "/api/memory/distill/stop")); assert.match(await drow.locator(".sub").textContent(), /397/); assert.equal(await drow.locator(".lib-diststop").count(), 0); // a run that stopped says why await drow.locator(".lib-distnow").click(); await drow.locator(".sub.err").waitFor(); assert.match(await drow.locator(".sub.err").textContent(), /429: too many requests/); assert.ok(sent.some((x) => x.path === "/api/memory/distill/run")); } // tidied now: what it set aside leaves To review, and is undone once await page.locator(`${view} .lib-memstatus .opt`, { hasText: w.review }).click(); await page.locator(`${view} .lib-mems .lib-mem`, { hasText: "Ships on Tuesdays" }).waitFor(); await trow.locator(".lib-dreamnow").click(); await trow.locator(".lib-dreamundo").waitFor({ timeout: 8000 }); assert.ok(sent.some((x) => x.path === "/api/memory/dream/run")); assert.match(await trow.locator(".sub").textContent(), /1/); await page.locator(`${view} .lib-mems .lib-mem`, { hasText: "Ships on Tuesdays" }).waitFor({ state: "detached" }); await trow.locator(".lib-dreamundo").click(); await page.locator(`${view} .lib-mems .lib-mem`, { hasText: "Ships on Tuesdays" }).waitFor(); assert.equal(await trow.locator(".lib-dreamundo").count(), 0); assert.ok(sent.some((x) => x.path === "/api/memory/dream/undo")); assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 1), "the page scrolls sideways"); await ctx.close(); }); } assert.deepEqual(errors, []); }); }