Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ repos:
- id: check-yaml
exclude: '^mkdocs\.yml$'
- id: check-json
# Every commit, not only during a merge: a resolution committed later still carries markers.
- id: check-merge-conflict
args: ["--assume-in-merge"]
- id: check-added-large-files
args: ["--maxkb=2000"]

Expand Down
23 changes: 18 additions & 5 deletions demo/check-reset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,25 @@ const controls = () =>
// A DOM click, because some controls move the panel over the page's own buttons.
const press = (label) =>
page.evaluate((name) => [...document.querySelectorAll(".try button")].find((b) => b.textContent === name).click(), label);
// Nothing navigates any more, so a load state says nothing: wait, then for the run.
// Settled once the chat is idle and its text has held still briefly, or held still for longer
// while a run waits on an approval; a fixed sleep per step made the check take minutes.
const settle = async () => {
await page.waitForTimeout(2500);
await page
.waitForFunction(() => document.querySelector("ag-ui-chat")?.running === false, null, { timeout: 15000 })
.catch(() => {});
const started = Date.now();
let last = null;
let since = Date.now();
while (Date.now() - started < 15000) {
await page.waitForTimeout(150);
const now = await page.evaluate(() => {
const chat = document.querySelector("ag-ui-chat");
return `${chat?.running}|${chat?.shadowRoot?.textContent?.length}|${location.pathname}`;
});
if (now !== last) {
last = now;
since = Date.now();
}
const quiet = Date.now() - since;
if ((now.startsWith("false|") && quiet >= 700) || quiet >= 2500) return;
}
};
// A marker on window outlives every mount and dies with the document.
const stayed = async (step) => {
Expand Down