@nextclaw/x-harness 0.2.53 → 0.2.55

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # Corresponding source
2
2
 
3
- Version 0.2.53, commit 9feb94d648082c67a04a4203f922a8394751e524.
3
+ Version 0.2.55, commit 7fc4a6a0e9bcea24ea2ac8d739572dc15afad136.
4
4
 
5
- Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/9feb94d648082c67a04a4203f922a8394751e524
5
+ Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/7fc4a6a0e9bcea24ea2ac8d739572dc15afad136
6
6
 
7
7
  Clone this revision, run npm ci, npm run bootstrap and npm run release:build.
8
8
 
@@ -196,7 +196,7 @@ export class DOMEditing {
196
196
  throw new Error("翻页须有已观察原帖链接");
197
197
  const anchor = await this.#unique(this.#tab.playwright
198
198
  .locator(`a[href=${JSON.stringify(primary)}]`)
199
- .filter({ visible: true }));
199
+ .filter({ has: this.#tab.playwright.locator("time") }));
200
200
  this.#session.current = null;
201
201
  await anchor.press("PageDown");
202
202
  return { completed: true };
@@ -83,7 +83,7 @@ export class IndependentPublishing {
83
83
  const baseline = await this.#platform.findSubmission({
84
84
  ...action,
85
85
  intentAt: this.#stamp(),
86
- });
86
+ }, { phase: "baseline" });
87
87
  if (baseline.needsStateCheck || baseline.alerts?.length)
88
88
  throw new Error("publication-baseline-unconfirmed");
89
89
  token = `${action.id}:${this.#stamp()}:${Math.random()}`;
@@ -31,7 +31,9 @@ export interface PlatformDependencies {
31
31
  readFeedback: ({ targets, replyLimit }?: any) => Promise<any>;
32
32
  readPerson: (target: any) => Promise<any>;
33
33
  readPost: (target: any) => Promise<any>;
34
- findSubmission: (action: any) => Promise<any>;
34
+ findSubmission: (action: any, context?: {
35
+ phase?: "baseline";
36
+ }) => Promise<any>;
35
37
  submitFollow: (action: any) => Promise<any>;
36
38
  submitPost: (action: any) => Promise<any>;
37
39
  submitReply: (action: any) => Promise<any>;
@@ -2,7 +2,9 @@ import type { PlatformDependencies } from "./platform-dependencies.js";
2
2
  export declare class PlatformWriting {
3
3
  #private;
4
4
  compose: (action: any) => Promise<any>;
5
- findSubmission: (action: any) => Promise<any>;
5
+ findSubmission: (action: any, context?: {
6
+ phase?: "baseline";
7
+ }) => Promise<any>;
6
8
  submitFollow: (action: any) => Promise<any>;
7
9
  submitPost: (action: any) => Promise<any>;
8
10
  submitReply: (action: any) => Promise<any>;
@@ -58,7 +58,7 @@ export class PlatformWriting {
58
58
  ...(action.activation ? { activation: action.activation } : {}),
59
59
  });
60
60
  }
61
- async handleFindSubmission(action) {
61
+ async handleFindSubmission(action, context = {}) {
62
62
  if (action.kind === "follow") {
63
63
  let value = await this.#followStage(action, "verify-read", () => this.#readPerson(action));
64
64
  const verificationAlerts = [...(value.alerts ?? [])];
@@ -117,7 +117,8 @@ export class PlatformWriting {
117
117
  ? { url: action.url, evidenceRef: action.evidenceRef }
118
118
  : { url: action.accountURL, evidenceRef: action.accountEvidenceRef };
119
119
  let value = await this.#open(receiptTarget, { view: "posts", limit: 5 });
120
- if (!(action.kind === "original" && observedReceipt) &&
120
+ if (context.phase !== "baseline" &&
121
+ !(action.kind === "original" && observedReceipt) &&
121
122
  !value.needsStateCheck &&
122
123
  !(this.#browser.capabilities?.("refreshPosts") ?? ["refreshPosts"]).length) {
123
124
  await this.#browser.act({
@@ -11,7 +11,9 @@ export declare class XPlatform {
11
11
  readFeedback: ({ targets, replyLimit }?: any) => Promise<any>;
12
12
  readPerson: (target: any) => Promise<any>;
13
13
  readPost: (target: any) => Promise<any>;
14
- findSubmission: (action: any) => Promise<any>;
14
+ findSubmission: (action: any, context?: {
15
+ phase?: "baseline";
16
+ }) => Promise<any>;
15
17
  submitFollow: (action: any) => Promise<any>;
16
18
  submitPost: (action: any) => Promise<any>;
17
19
  submitReply: (action: any) => Promise<any>;
@@ -23,7 +23,7 @@ export function readNavigation({ targetLabel, bookmarkNavigation = false, } = {}
23
23
  ...new Set([
24
24
  ...Array.from(document.querySelectorAll("nav a[href],nav button")).filter((el) => !el.closest("main")),
25
25
  ...Array.from(primary?.querySelectorAll('a[href],button,[role="button"],[role="tab"]') ?? []),
26
- ...Array.from(document.querySelectorAll('[role="menu"] a[href], [role="menu"] button, [data-testid="Dropdown"] a[href], [data-testid="Dropdown"] button')),
26
+ ...Array.from(document.querySelectorAll('[role="menu"] a[href], [role="menu"] button, [data-testid="Dropdown"] a[href], [data-testid="Dropdown"] button, [data-testid="Dropdown"] [role="menuitemradio"]')),
27
27
  ]),
28
28
  ].filter((el) => visible(el) &&
29
29
  !el.closest("article") &&
@@ -445,7 +445,7 @@ export const readXObservation = (query) => {
445
445
  ...new Set([
446
446
  ...Array.from(document.querySelectorAll("nav a[href],nav button")).filter((el) => !el.closest("main")),
447
447
  ...Array.from(primary?.querySelectorAll('a[href],button,[role="button"],[role="tab"]') ?? []),
448
- ...Array.from(document.querySelectorAll('[role="menu"] a[href], [role="menu"] button, [data-testid="Dropdown"] a[href], [data-testid="Dropdown"] button')),
448
+ ...Array.from(document.querySelectorAll('[role="menu"] a[href], [role="menu"] button, [data-testid="Dropdown"] a[href], [data-testid="Dropdown"] button, [data-testid="Dropdown"] [role="menuitemradio"]')),
449
449
  ]),
450
450
  ].filter((el) => visible(el) &&
451
451
  !el.closest("article") &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/x-harness",
3
- "version": "0.2.53",
3
+ "version": "0.2.55",
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": "9feb94d648082c67a04a4203f922a8394751e524"
45
+ "gitHead": "7fc4a6a0e9bcea24ea2ac8d739572dc15afad136"
46
46
  }