@nextclaw/x-harness 0.2.44 → 0.2.46

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.44, commit 5f83f4e0fa5f5d3e052b63498a4878f18e12e48b.
3
+ Version 0.2.46, commit c242fc8d8d9b935668cf4093bb4cb9bda14edf16.
4
4
 
5
- Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/5f83f4e0fa5f5d3e052b63498a4878f18e12e48b
5
+ Complete source, build scripts and dependencies: https://github.com/Peiiii/x-harness/tree/c242fc8d8d9b935668cf4093bb4cb9bda14edf16
6
6
 
7
7
  Clone this revision, run npm ci, npm run bootstrap and npm run release:build.
8
8
 
@@ -3,6 +3,7 @@ export declare class DOMCapabilities {
3
3
  #private;
4
4
  constructor(dependencies: Pick<DOMDependencies, "tab" | "nativeSubmit">);
5
5
  capabilities(operation: any): any;
6
+ private quoteCapabilities;
6
7
  private creatorCapabilities;
7
8
  private collectionCapabilities;
8
9
  }
@@ -89,19 +89,8 @@ export class DOMCapabilities {
89
89
  "press",
90
90
  ]));
91
91
  }
92
- if (operation === "openQuoteComposer") {
93
- base.push(...missingMethods(this.#tab?.playwright, ["locator", "getByRole"]));
94
- if (typeof this.#tab?.playwright?.getByRole === "function") {
95
- base.push(...missingMethods(this.#tab.playwright.getByRole("article"), [
96
- "filter",
97
- "getByRole",
98
- ]));
99
- base.push(...missingMethods(this.#tab.playwright.getByRole("button"), [
100
- "press",
101
- "waitFor",
102
- ]));
103
- }
104
- }
92
+ if (operation === "openQuoteComposer")
93
+ return this.quoteCapabilities(base);
105
94
  if (operation === "attachAssets")
106
95
  base.push(...missingMethods(this.#tab?.playwright, [
107
96
  "waitForEvent",
@@ -112,6 +101,26 @@ export class DOMCapabilities {
112
101
  base.push(...missingMethods(this.#tab, ["getAXState", "click"]));
113
102
  return base;
114
103
  }
104
+ quoteCapabilities(base) {
105
+ base.push(...missingMethods(this.#tab?.playwright, ["getByTestId"]));
106
+ if (typeof this.#tab?.playwright?.getByTestId === "function")
107
+ base.push(...missingMethods(this.#tab.playwright.getByTestId("attachments"), [
108
+ "getByTestId",
109
+ "waitFor",
110
+ ]));
111
+ base.push(...missingMethods(this.#tab?.playwright, ["locator", "getByRole"]));
112
+ if (typeof this.#tab?.playwright?.getByRole === "function") {
113
+ base.push(...missingMethods(this.#tab.playwright.getByRole("article"), [
114
+ "filter",
115
+ "getByRole",
116
+ ]));
117
+ base.push(...missingMethods(this.#tab.playwright.getByRole("button"), [
118
+ "press",
119
+ "waitFor",
120
+ ]));
121
+ }
122
+ return base;
123
+ }
115
124
  creatorCapabilities(base, operation) {
116
125
  base.push(...missingMethods(this.#tab, [
117
126
  "url",
@@ -426,6 +426,10 @@ export class DOMEditing {
426
426
  });
427
427
  await menu.waitFor({ state: "visible", timeoutMs: 2000 });
428
428
  await (await this.#unique(menu)).press("Enter");
429
+ await this.#tab.playwright
430
+ .getByTestId("attachments")
431
+ .getByTestId("tweetText")
432
+ .waitFor({ state: "visible", timeoutMs: 2000 });
429
433
  this.#session.quoteBinding = {
430
434
  postId: post.id,
431
435
  author: post.author,
@@ -9,6 +9,7 @@ export declare class PlatformWriting {
9
9
  constructor(dependencies: Pick<PlatformDependencies, "observed" | "browser" | "followStage" | "readPerson" | "open" | "clock" | "readPost">);
10
10
  private handleCompose;
11
11
  private handleFindSubmission;
12
+ private readCandidateDetail;
12
13
  private matchesQuote;
13
14
  private matchesContent;
14
15
  private readQuotedReceipt;
@@ -148,20 +148,7 @@ export class PlatformWriting {
148
148
  const url = xURL(new URL(candidate.primary, xURL(value.page).origin).href);
149
149
  if (url.pathname.toLowerCase() ===
150
150
  `/${action.accountHandle}/status/${candidate.id}`.toLowerCase()) {
151
- value = await this.#open({
152
- url: url.href,
153
- evidenceRef: {
154
- page: value.page,
155
- observedAt: value.observedAt,
156
- publicId: candidate.id,
157
- primary: candidate.primary,
158
- },
159
- }, {
160
- view: "posts",
161
- targetId: candidate.id,
162
- replyTargetId: action.postId,
163
- });
164
- value = await this.readLoadedReplyReceipt(value, candidate.id, matchesContent);
151
+ value = await this.readCandidateDetail(value, url.href, candidate, action.postId, matchesContent);
165
152
  matches = (value.posts ?? []).filter(matchesContent);
166
153
  }
167
154
  }
@@ -181,6 +168,31 @@ export class PlatformWriting {
181
168
  missing: matches.length === 1 ? [] : ["unique-public-submission-unconfirmed"],
182
169
  };
183
170
  }
171
+ async readCandidateDetail(value, url, candidate, parentId, matchesContent) {
172
+ try {
173
+ const opened = await this.#open({
174
+ url,
175
+ evidenceRef: {
176
+ page: value.page,
177
+ observedAt: value.observedAt,
178
+ publicId: candidate.id,
179
+ primary: candidate.primary,
180
+ },
181
+ }, {
182
+ view: "posts",
183
+ targetId: candidate.id,
184
+ replyTargetId: parentId,
185
+ });
186
+ return await this.readLoadedReplyReceipt(opened, candidate.id, matchesContent);
187
+ }
188
+ catch (error) {
189
+ // Preserve the fresh observed link for the root API’s existing read-only recovery.
190
+ // Missing parent evidence still fails the exact-parent gate below.
191
+ if (!/Timed out waiting for URL/.test(error instanceof Error ? error.message : ""))
192
+ throw error;
193
+ }
194
+ return value;
195
+ }
184
196
  matchesQuote(post, action) {
185
197
  return (post.quoteSource?.parentId === post.id &&
186
198
  post.quoteSource?.id === action.quoteTarget.postId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/x-harness",
3
- "version": "0.2.44",
3
+ "version": "0.2.46",
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": "5f83f4e0fa5f5d3e052b63498a4878f18e12e48b"
45
+ "gitHead": "c242fc8d8d9b935668cf4093bb4cb9bda14edf16"
46
46
  }