@nextclaw/x-harness 0.2.50 → 0.2.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SOURCE.md +2 -2
- package/dist/browser-dom-capabilities.js +1 -0
- package/dist/browser-dom-navigation.js +19 -6
- package/dist/browser.js +1 -1
- package/dist/platform-collections.d.ts +1 -0
- package/dist/platform-collections.js +32 -9
- package/generated/observation.mjs +1 -1
- package/package.json +2 -2
package/SOURCE.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Corresponding source
|
|
2
2
|
|
|
3
|
-
Version 0.2.
|
|
3
|
+
Version 0.2.52, commit b3e3310d4977db067f05ee409f58ae619f042c9a.
|
|
4
4
|
|
|
5
|
-
Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/
|
|
5
|
+
Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/b3e3310d4977db067f05ee409f58ae619f042c9a
|
|
6
6
|
|
|
7
7
|
Clone this revision, run npm ci, npm run bootstrap and npm run release:build.
|
|
8
8
|
|
|
@@ -30,16 +30,23 @@ export class DOMNavigation {
|
|
|
30
30
|
posts?.length !== 1 ||
|
|
31
31
|
posts[0].quoteCards?.length !== 1 ||
|
|
32
32
|
posts[0].quoteCards[0].text !== command.cardText)
|
|
33
|
-
throw Error(
|
|
33
|
+
throw Error(`unique-observed-quote-required:snapshot:${posts?.length ?? 0}:${posts?.[0]?.quoteCards?.length ?? 0}`);
|
|
34
34
|
const article = this.#tab.playwright.getByRole("article").filter({
|
|
35
35
|
has: this.#tab.playwright.locator(`a[href=${JSON.stringify(posts[0].primary)}]`),
|
|
36
36
|
});
|
|
37
|
-
const
|
|
37
|
+
const cards = article
|
|
38
38
|
.locator('[role="link"][tabindex="0"]')
|
|
39
|
-
.filter({ visible: true
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
.filter({ visible: true });
|
|
40
|
+
const count = await cards.count();
|
|
41
|
+
const matches = [];
|
|
42
|
+
for (let i = 0; i < count; i++) {
|
|
43
|
+
const candidate = cards.nth(i);
|
|
44
|
+
if ((await candidate.innerText()) === command.cardText)
|
|
45
|
+
matches.push(candidate);
|
|
46
|
+
}
|
|
47
|
+
if (matches.length !== 1)
|
|
48
|
+
throw Error(`unique-observed-quote-required:controls:${count}:matches:${matches.length}`);
|
|
49
|
+
const card = matches[0];
|
|
43
50
|
this.#session.current = null;
|
|
44
51
|
await this.#tab.playwright.expectNavigation(() => card.click(), {
|
|
45
52
|
waitUntil: "commit",
|
|
@@ -64,6 +71,12 @@ export class DOMNavigation {
|
|
|
64
71
|
return;
|
|
65
72
|
}
|
|
66
73
|
async handleWaitForFolder(command) {
|
|
74
|
+
if (command.selected) {
|
|
75
|
+
await this.#tab.playwright
|
|
76
|
+
.getByRole("heading", { name: command.folder, exact: true })
|
|
77
|
+
.waitFor({ state: "visible", timeoutMs: 5000 });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
67
80
|
if (command.folderDiscovery) {
|
|
68
81
|
// "All bookmarks" renders before the asynchronously loaded named cards.
|
|
69
82
|
// Wait for any named card inside that specific menu, never an unrelated
|
package/dist/browser.js
CHANGED
|
@@ -138,7 +138,7 @@ export function readXSurface({ view, posts = [], targetId, replyTargetId, } = {}
|
|
|
138
138
|
.querySelector?.("time")
|
|
139
139
|
?.getAttribute("datetime"),
|
|
140
140
|
}))
|
|
141
|
-
.filter((card) => card.text?.trim()
|
|
141
|
+
.filter((card) => card.text?.trim())
|
|
142
142
|
: [],
|
|
143
143
|
};
|
|
144
144
|
}),
|
|
@@ -9,6 +9,7 @@ export declare class PlatformCollections {
|
|
|
9
9
|
private handleCollectSources;
|
|
10
10
|
private handleReadCreator;
|
|
11
11
|
private handleReadBookmarks;
|
|
12
|
+
private confirmBookmarkFolder;
|
|
12
13
|
private bookmarkDiscovery;
|
|
13
14
|
private waitForBookmarkLabel;
|
|
14
15
|
private handleSearchSources;
|
|
@@ -294,15 +294,9 @@ export class PlatformCollections {
|
|
|
294
294
|
folder,
|
|
295
295
|
controls: nav.controls,
|
|
296
296
|
};
|
|
297
|
-
const selected = await this
|
|
298
|
-
if (selected.
|
|
299
|
-
return
|
|
300
|
-
status: "needsDecision",
|
|
301
|
-
complete: false,
|
|
302
|
-
missing: ["folder-selection-unconfirmed"],
|
|
303
|
-
folder,
|
|
304
|
-
page: selected.page,
|
|
305
|
-
};
|
|
297
|
+
const selected = await this.confirmBookmarkFolder(folder);
|
|
298
|
+
if (selected.status)
|
|
299
|
+
return selected;
|
|
306
300
|
const value = await this.handleCollectSources(window);
|
|
307
301
|
return {
|
|
308
302
|
...value,
|
|
@@ -314,6 +308,35 @@ export class PlatformCollections {
|
|
|
314
308
|
},
|
|
315
309
|
};
|
|
316
310
|
}
|
|
311
|
+
async confirmBookmarkFolder(folder) {
|
|
312
|
+
let selected = await this.#ready({ view: "navigation" });
|
|
313
|
+
if (!selected.headings?.includes(folder)) {
|
|
314
|
+
try {
|
|
315
|
+
await this.#browser.act({
|
|
316
|
+
operation: "waitForFolder",
|
|
317
|
+
folder,
|
|
318
|
+
selected: true,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
if (!/timed out|timeout/i.test(error.message))
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
selected = await this.#ready({ view: "navigation" });
|
|
326
|
+
}
|
|
327
|
+
if (!selected.headings?.includes(folder) ||
|
|
328
|
+
!/\/i\/(?:history\/)?bookmarks\//.test(selected.page ?? "") ||
|
|
329
|
+
selected.needsStateCheck ||
|
|
330
|
+
selected.alerts?.length)
|
|
331
|
+
return {
|
|
332
|
+
status: "needsDecision",
|
|
333
|
+
complete: false,
|
|
334
|
+
missing: ["folder-selection-unconfirmed"],
|
|
335
|
+
folder,
|
|
336
|
+
page: selected.page,
|
|
337
|
+
};
|
|
338
|
+
return selected;
|
|
339
|
+
}
|
|
317
340
|
bookmarkDiscovery(nav) {
|
|
318
341
|
const folders = nav.bookmarkFolders ?? [];
|
|
319
342
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/x-harness",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Typed X task harness with compact business results and explicit diagnostics.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "b3e3310d4977db067f05ee409f58ae619f042c9a"
|
|
46
46
|
}
|