browserpaw 0.0.0-stage → 5.0.0

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.
Files changed (45) hide show
  1. package/LICENSE +681 -0
  2. package/README.md +4 -2
  3. package/dist/v5/cli-files.cjs +147 -0
  4. package/dist/v5/cli.cjs +4028 -0
  5. package/dist/v5/extension/assets/popup-Djl4pI1R.css +359 -0
  6. package/dist/v5/extension/background.js +37712 -0
  7. package/dist/v5/extension/browserpaw-build.json +184 -0
  8. package/dist/v5/extension/chunks/popup-DjxqduQH.js +6542 -0
  9. package/dist/v5/extension/content-scripts/agent-cursor.js +1459 -0
  10. package/dist/v5/extension/icon/128.png +0 -0
  11. package/dist/v5/extension/icon/16.png +0 -0
  12. package/dist/v5/extension/icon/32.png +0 -0
  13. package/dist/v5/extension/icon/48.png +0 -0
  14. package/dist/v5/extension/icon/96.png +0 -0
  15. package/dist/v5/extension/images/cursor-chat.png +0 -0
  16. package/dist/v5/extension/inject-scripts/accessibility-tree-helper.js +1883 -0
  17. package/dist/v5/extension/inject-scripts/keyboard-helper.js +402 -0
  18. package/dist/v5/extension/inject-scripts/network-helper.js +213 -0
  19. package/dist/v5/extension/inject-scripts/screenshot-helper.js +408 -0
  20. package/dist/v5/extension/inpage-engine.js +9300 -0
  21. package/dist/v5/extension/manifest.json +1 -0
  22. package/dist/v5/extension/popup.html +14 -0
  23. package/dist/v5/host.cjs +19441 -0
  24. package/dist/v5/recipes/developer.mozilla.org.md +15 -0
  25. package/dist/v5/recipes/github-releases.json +177 -0
  26. package/dist/v5/recipes/mdn-search.json +174 -0
  27. package/dist/v5/recipes/npm-compare.json +456 -0
  28. package/dist/v5/recipes/x-search-thread.json +321 -0
  29. package/dist/v5/recipes/x-visible-thread.json +303 -0
  30. package/dist/v5/run_host.bat +7 -0
  31. package/dist/v5/run_host.sh +6 -0
  32. package/dist/v5/skill/browserpaw/SKILL.md +48 -0
  33. package/dist/v5/skill/browserpaw/assets/recipes/developer.mozilla.org.md +15 -0
  34. package/dist/v5/skill/browserpaw/assets/recipes/github-releases.json +177 -0
  35. package/dist/v5/skill/browserpaw/assets/recipes/mdn-search.json +174 -0
  36. package/dist/v5/skill/browserpaw/assets/recipes/npm-compare.json +456 -0
  37. package/dist/v5/skill/browserpaw/assets/recipes/x-search-thread.json +321 -0
  38. package/dist/v5/skill/browserpaw/assets/recipes/x-visible-thread.json +303 -0
  39. package/dist/v5/skill/browserpaw/references/TROUBLESHOOTING.md +7 -0
  40. package/dist/v5/skill/browserpaw/references/TROUBLESHOOTING.zh-CN.md +5 -0
  41. package/dist/v5/skill/browserpaw/references/browser-data.md +33 -0
  42. package/dist/v5/skill/browserpaw/references/commands.md +103 -0
  43. package/dist/v5/skill/browserpaw/references/debugging.md +32 -0
  44. package/dist/v5/skill/browserpaw/references/recipe-contract.md +46 -0
  45. package/package.json +67 -4
@@ -0,0 +1,321 @@
1
+ {
2
+ "id": "x-search-thread",
3
+ "name": "X search results reader",
4
+ "description": "Read visible X search results and return source-linked posts; this recipe does not read a full conversation thread. It waits briefly for the authenticated search timeline, returns an explicit empty result only for recognized no-results text, and reports loading_timeout instead of treating transient login text as authentication failure.",
5
+ "source": {
6
+ "type": "builtin",
7
+ "urls": [
8
+ "https://x.com/search?q=fetch&src=typed_query&f=live",
9
+ "https://help.x.com/en/using-x/x-search"
10
+ ]
11
+ },
12
+ "domains": [
13
+ "x.com",
14
+ "twitter.com"
15
+ ],
16
+ "keywords": [
17
+ "x",
18
+ "twitter",
19
+ "search",
20
+ "posts"
21
+ ],
22
+ "startUrl": "https://x.com/search?q={{query}}&src=typed_query&f=live",
23
+ "inputSchema": {
24
+ "type": "object",
25
+ "properties": {
26
+ "query": {
27
+ "type": "string",
28
+ "minLength": 1,
29
+ "maxLength": 200
30
+ },
31
+ "limit": {
32
+ "type": "integer",
33
+ "minimum": 1,
34
+ "maximum": 20,
35
+ "default": 8
36
+ }
37
+ },
38
+ "required": [
39
+ "query"
40
+ ],
41
+ "additionalProperties": false
42
+ },
43
+ "outputSchema": {
44
+ "oneOf": [
45
+ {
46
+ "type": "object",
47
+ "properties": {
48
+ "success": {
49
+ "const": true
50
+ },
51
+ "status": {
52
+ "const": "ok"
53
+ },
54
+ "query": {
55
+ "type": "string",
56
+ "minLength": 1
57
+ },
58
+ "posts": {
59
+ "type": "array",
60
+ "minItems": 1,
61
+ "maxItems": 20,
62
+ "items": {
63
+ "type": "object",
64
+ "properties": {
65
+ "text": {
66
+ "type": "string",
67
+ "minLength": 1
68
+ },
69
+ "author": {
70
+ "type": "string"
71
+ },
72
+ "url": {
73
+ "type": "string",
74
+ "pattern": "^https://(?:x|twitter)\\.com/.+/status/\\d+"
75
+ },
76
+ "publishedAt": {
77
+ "type": "string"
78
+ }
79
+ },
80
+ "required": [
81
+ "text",
82
+ "author",
83
+ "url",
84
+ "publishedAt"
85
+ ],
86
+ "additionalProperties": false
87
+ }
88
+ },
89
+ "sources": {
90
+ "type": "object",
91
+ "properties": {
92
+ "page": {
93
+ "type": "string",
94
+ "pattern": "^https://(?:x|twitter)\\.com/"
95
+ }
96
+ },
97
+ "required": [
98
+ "page"
99
+ ],
100
+ "additionalProperties": false
101
+ }
102
+ },
103
+ "required": [
104
+ "success",
105
+ "status",
106
+ "query",
107
+ "posts",
108
+ "sources"
109
+ ],
110
+ "additionalProperties": false
111
+ },
112
+ {
113
+ "type": "object",
114
+ "properties": {
115
+ "success": {
116
+ "const": true
117
+ },
118
+ "status": {
119
+ "const": "empty"
120
+ },
121
+ "query": {
122
+ "type": "string",
123
+ "minLength": 1
124
+ },
125
+ "posts": {
126
+ "type": "array",
127
+ "minItems": 0,
128
+ "maxItems": 0
129
+ },
130
+ "sources": {
131
+ "type": "object",
132
+ "properties": {
133
+ "page": {
134
+ "type": "string",
135
+ "pattern": "^https://(?:x|twitter)\\.com/"
136
+ }
137
+ },
138
+ "required": [
139
+ "page"
140
+ ],
141
+ "additionalProperties": false
142
+ }
143
+ },
144
+ "required": [
145
+ "success",
146
+ "status",
147
+ "query",
148
+ "posts",
149
+ "sources"
150
+ ],
151
+ "additionalProperties": false
152
+ },
153
+ {
154
+ "type": "object",
155
+ "properties": {
156
+ "success": {
157
+ "const": false
158
+ },
159
+ "status": {
160
+ "enum": [
161
+ "requires_auth",
162
+ "loading_timeout",
163
+ "unreadable"
164
+ ]
165
+ },
166
+ "requiresLogin": {
167
+ "type": "boolean"
168
+ },
169
+ "message": {
170
+ "type": "string",
171
+ "minLength": 1
172
+ },
173
+ "query": {
174
+ "type": "string",
175
+ "minLength": 1
176
+ },
177
+ "source": {
178
+ "type": "string",
179
+ "pattern": "^https://(?:x|twitter)\\.com/"
180
+ }
181
+ },
182
+ "required": [
183
+ "success",
184
+ "status",
185
+ "requiresLogin",
186
+ "message",
187
+ "query",
188
+ "source"
189
+ ],
190
+ "additionalProperties": false
191
+ }
192
+ ]
193
+ },
194
+ "steps": [
195
+ {
196
+ "tool": "chrome_javascript",
197
+ "args": {
198
+ "code": "const query = String(input.query || '').trim();\nconst limit = Math.max(1, Math.min(Number(input.limit) || 8, 20));\nconst source = new URL('/search', location.origin);\nsource.searchParams.set('q', query);\nsource.searchParams.set('src', 'typed_query');\nsource.searchParams.set('f', 'live');\nconst loginPath = /^\\/(?:i\\/flow\\/login|login)(?:\\/|$)/.test(location.pathname);\nconst isVisible = element => {\n if (!element || !element.getBoundingClientRect) return false;\n if (element.hidden || (typeof element.getAttribute === 'function' && element.getAttribute('aria-hidden') === 'true')) return false;\n const rect = element.getBoundingClientRect();\n const style = typeof getComputedStyle === 'function' ? getComputedStyle(element) : null;\n return rect.width > 0 && rect.height > 0 && (!style || (style.display !== 'none' && style.visibility !== 'hidden'));\n};\nconst hasVisibleLoginForm = () => Array.from(document.querySelectorAll('form')).some(form =>\n isVisible(form) && Array.from(form.querySelectorAll('input[autocomplete=\"username\"], input[name=\"text\"], input[type=\"password\"]')).some(isVisible)\n);\nconst hasExplicitEmptyState = () => {\n if (typeof document.querySelector !== 'function') return false;\n const element = document.querySelector('main [data-testid=\"emptyState\"]');\n if (!isVisible(element)) return false;\n const normalizeQuotes = value => value.replace(/[“”]/g, '\"').replace(/[‘’]/g, \"'\");\n const text = normalizeQuotes(String(element.innerText || element.textContent || '')).replace(/\\s+/g, ' ').trim().toLowerCase();\n const normalizedQuery = normalizeQuotes(query).replace(/\\s+/g, ' ').trim().toLowerCase();\n return !!normalizedQuery && (\n text.includes(`no results for \"${normalizedQuery}\"`) ||\n text.includes(`no results for '${normalizedQuery}'`) ||\n text.includes(`没有关于\"${normalizedQuery}\"的结果`) ||\n text.includes(`没有关于'${normalizedQuery}'的结果`)\n );\n};\nconst sleep = ms => new Promise(resolve => setTimeout(resolve, ms));\nlet articles = [];\nlet loginForm = false;\nlet emptyState = false;\nfor (let attempt = 0; attempt < 40; attempt += 1) {\n if (loginPath) break;\n articles = Array.from(document.querySelectorAll('article'));\n if (articles.length) break;\n loginForm = hasVisibleLoginForm();\n if (loginForm) break;\n emptyState = hasExplicitEmptyState();\n if (emptyState) break;\n if (attempt < 39) await sleep(250);\n}\nif (loginPath || loginForm) {\n return {\n success: false,\n status: 'requires_auth',\n requiresLogin: true,\n message: 'X requires authentication to read this search timeline',\n query,\n source: source.href\n };\n}\nif (emptyState) {\n return { success: true, status: 'empty', query, posts: [], sources: { page: source.href } };\n}\nif (!articles.length) {\n return { success: false, status: 'loading_timeout', requiresLogin: false, message: 'X search articles did not become visible within 10 seconds', query, source: source.href };\n}\nconst mainStatusLink = article => Array.from(article.querySelectorAll('a:has(time)')).find(link => {\n const href = link.getAttribute('href') || '';\n try {\n return /^\\/[^/]+\\/status\\/\\d+$/.test(new URL(href, location.origin).pathname);\n } catch {\n return false;\n }\n});\nconst posts = articles.slice(0, limit).map(article => {\n const text = String(article.querySelector('[data-testid=\"tweetText\"]') && article.querySelector('[data-testid=\"tweetText\"]').innerText || '').trim();\n const nameBlock = String(article.querySelector('[data-testid=\"User-Name\"]') && article.querySelector('[data-testid=\"User-Name\"]').innerText || '').trim();\n const author = nameBlock.split('\\n').map(part => part.trim()).find(Boolean) || '';\n const statusLink = mainStatusLink(article);\n const href = statusLink ? statusLink.getAttribute('href') || '' : '';\n const time = statusLink ? statusLink.querySelector('time') : null;\n return {\n text,\n author,\n url: href ? new URL(href, location.origin).href : '',\n publishedAt: time ? String(time.getAttribute('datetime') || '') : ''\n };\n}).filter(post => post.text && post.url);\nif (!posts.length) {\n return { success: false, status: 'unreadable', requiresLogin: false, message: 'Visible X articles did not expose readable text and main status links', query, source: source.href };\n}\nreturn { success: true, status: 'ok', query, posts, sources: { page: source.href } };",
199
+ "timeoutMs": 20000
200
+ },
201
+ "resultPath": "/result"
202
+ }
203
+ ],
204
+ "verification": {
205
+ "tool": "chrome_read_dom",
206
+ "args": {
207
+ "format": "compact",
208
+ "selector": "main",
209
+ "activeViewportOnly": false,
210
+ "limit": 80,
211
+ "maxTextLength": 240
212
+ },
213
+ "resultPath": "/treeString"
214
+ },
215
+ "tests": [
216
+ {
217
+ "inputs": {
218
+ "query": "browser automation",
219
+ "limit": 5
220
+ },
221
+ "expect": {
222
+ "type": "object",
223
+ "properties": {
224
+ "query": {
225
+ "const": "browser automation"
226
+ },
227
+ "status": {
228
+ "const": "ok"
229
+ },
230
+ "success": {
231
+ "const": true
232
+ },
233
+ "posts": {
234
+ "type": "array",
235
+ "minItems": 1,
236
+ "items": {
237
+ "type": "object",
238
+ "properties": {
239
+ "text": {
240
+ "type": "string",
241
+ "minLength": 1
242
+ },
243
+ "url": {
244
+ "type": "string",
245
+ "pattern": "^https://(?:x|twitter)\\.com/.+/status/\\d+"
246
+ }
247
+ },
248
+ "required": [
249
+ "text",
250
+ "url"
251
+ ]
252
+ }
253
+ }
254
+ },
255
+ "required": [
256
+ "success",
257
+ "status",
258
+ "query",
259
+ "posts"
260
+ ]
261
+ },
262
+ "observe": {
263
+ "type": "string",
264
+ "minLength": 100,
265
+ "pattern": "(?:Post|post|Search|search|status|Log in|Sign in)"
266
+ }
267
+ },
268
+ {
269
+ "inputs": {
270
+ "query": "typescript",
271
+ "limit": 3
272
+ },
273
+ "expect": {
274
+ "type": "object",
275
+ "properties": {
276
+ "query": {
277
+ "const": "typescript"
278
+ },
279
+ "status": {
280
+ "const": "ok"
281
+ },
282
+ "success": {
283
+ "const": true
284
+ },
285
+ "posts": {
286
+ "type": "array",
287
+ "minItems": 1,
288
+ "items": {
289
+ "type": "object",
290
+ "properties": {
291
+ "text": {
292
+ "type": "string",
293
+ "minLength": 1
294
+ },
295
+ "url": {
296
+ "type": "string",
297
+ "pattern": "^https://(?:x|twitter)\\.com/.+/status/\\d+"
298
+ }
299
+ },
300
+ "required": [
301
+ "text",
302
+ "url"
303
+ ]
304
+ }
305
+ }
306
+ },
307
+ "required": [
308
+ "success",
309
+ "status",
310
+ "query",
311
+ "posts"
312
+ ]
313
+ },
314
+ "observe": {
315
+ "type": "string",
316
+ "minLength": 100,
317
+ "pattern": "(?:Post|post|Search|search|status|Log in|Sign in)"
318
+ }
319
+ }
320
+ ]
321
+ }
@@ -0,0 +1,303 @@
1
+ {
2
+ "id": "x-visible-thread",
3
+ "name": "X visible focal thread reader",
4
+ "description": "Read the exact focal X post and mounted same-author replies with a verified parent chain. Coverage is visible_only; ancestors, unrelated recommendations and unverified relationships are excluded. This is not a complete conversation export.",
5
+ "source": {
6
+ "type": "builtin",
7
+ "urls": [
8
+ "https://x.com/Ytautomation6/status/2115063891591921877",
9
+ "https://x.com/crypto_vazima/status/2115072668210803107",
10
+ "https://help.x.com/en/using-x/x-search"
11
+ ]
12
+ },
13
+ "domains": [
14
+ "x.com",
15
+ "twitter.com"
16
+ ],
17
+ "keywords": [
18
+ "x",
19
+ "twitter",
20
+ "thread",
21
+ "visible",
22
+ "focal"
23
+ ],
24
+ "startUrl": "https://x.com/{{author}}/status/{{postId}}",
25
+ "inputSchema": {
26
+ "type": "object",
27
+ "properties": {
28
+ "author": {
29
+ "type": "string",
30
+ "pattern": "^[A-Za-z0-9_]{1,15}$"
31
+ },
32
+ "postId": {
33
+ "type": "string",
34
+ "pattern": "^[0-9]+$"
35
+ },
36
+ "limit": {
37
+ "type": "integer",
38
+ "minimum": 1,
39
+ "maximum": 20,
40
+ "default": 8
41
+ }
42
+ },
43
+ "required": [
44
+ "author",
45
+ "postId"
46
+ ],
47
+ "additionalProperties": false
48
+ },
49
+ "outputSchema": {
50
+ "oneOf": [
51
+ {
52
+ "type": "object",
53
+ "properties": {
54
+ "success": {
55
+ "const": true
56
+ },
57
+ "status": {
58
+ "const": "ok"
59
+ },
60
+ "focal": {
61
+ "$ref": "#/definitions/post"
62
+ },
63
+ "posts": {
64
+ "type": "array",
65
+ "minItems": 1,
66
+ "maxItems": 20,
67
+ "items": {
68
+ "$ref": "#/definitions/post"
69
+ }
70
+ },
71
+ "coverage": {
72
+ "const": "visible_only"
73
+ },
74
+ "sources": {
75
+ "type": "object",
76
+ "properties": {
77
+ "page": {
78
+ "type": "string",
79
+ "pattern": "^https://(?:x|twitter)\\.com/[A-Za-z0-9_]+/status/[0-9]+$"
80
+ }
81
+ },
82
+ "required": [
83
+ "page"
84
+ ],
85
+ "additionalProperties": false
86
+ }
87
+ },
88
+ "required": [
89
+ "success",
90
+ "status",
91
+ "focal",
92
+ "posts",
93
+ "coverage",
94
+ "sources"
95
+ ],
96
+ "additionalProperties": false
97
+ },
98
+ {
99
+ "type": "object",
100
+ "properties": {
101
+ "success": {
102
+ "const": false
103
+ },
104
+ "status": {
105
+ "enum": [
106
+ "requires_auth",
107
+ "loading_timeout",
108
+ "unreadable"
109
+ ]
110
+ },
111
+ "requiresLogin": {
112
+ "type": "boolean"
113
+ },
114
+ "message": {
115
+ "type": "string",
116
+ "minLength": 1
117
+ },
118
+ "author": {
119
+ "type": "string",
120
+ "pattern": "^[A-Za-z0-9_]{1,15}$"
121
+ },
122
+ "postId": {
123
+ "type": "string",
124
+ "pattern": "^[0-9]+$"
125
+ },
126
+ "source": {
127
+ "type": "string",
128
+ "pattern": "^https://(?:x|twitter)\\.com/[A-Za-z0-9_]+/status/[0-9]+$"
129
+ }
130
+ },
131
+ "required": [
132
+ "success",
133
+ "status",
134
+ "requiresLogin",
135
+ "message",
136
+ "author",
137
+ "postId",
138
+ "source"
139
+ ],
140
+ "additionalProperties": false
141
+ }
142
+ ],
143
+ "definitions": {
144
+ "post": {
145
+ "type": "object",
146
+ "properties": {
147
+ "author": {
148
+ "type": "string",
149
+ "pattern": "^[A-Za-z0-9_]{1,15}$"
150
+ },
151
+ "postId": {
152
+ "type": "string",
153
+ "pattern": "^[0-9]+$"
154
+ },
155
+ "text": {
156
+ "type": "string",
157
+ "minLength": 1
158
+ },
159
+ "url": {
160
+ "type": "string",
161
+ "pattern": "^https://(?:x|twitter)\\.com/[A-Za-z0-9_]+/status/[0-9]+$"
162
+ },
163
+ "publishedAt": {
164
+ "type": "string",
165
+ "minLength": 1
166
+ },
167
+ "parentId": {
168
+ "type": [
169
+ "string",
170
+ "null"
171
+ ]
172
+ }
173
+ },
174
+ "required": [
175
+ "author",
176
+ "postId",
177
+ "text",
178
+ "url",
179
+ "publishedAt",
180
+ "parentId"
181
+ ],
182
+ "additionalProperties": false
183
+ }
184
+ }
185
+ },
186
+ "steps": [
187
+ {
188
+ "tool": "chrome_javascript",
189
+ "args": {
190
+ "code": "const author = String(input.author || '').trim().replace(/^@/, '');\nconst postId = String(input.postId || '').trim();\nconst limit = Math.max(1, Math.min(Number(input.limit) || 8, 20));\nconst source = new URL('/' + encodeURIComponent(author) + '/status/' + encodeURIComponent(postId), location.origin);\nconst loginPath = /^\\/(?:i\\/flow\\/login|login)(?:\\/|$)/.test(location.pathname);\nconst isVisible = element => {\n if (!element || !element.getBoundingClientRect) return false;\n const rect = element.getBoundingClientRect();\n const style = typeof getComputedStyle === 'function' ? getComputedStyle(element) : null;\n return rect.width > 0 && rect.height > 0 && (!style || (style.display !== 'none' && style.visibility !== 'hidden'));\n};\nconst hasVisibleLoginForm = () => Array.from(document.querySelectorAll('form')).some(form =>\n isVisible(form) && Array.from(form.querySelectorAll('input[autocomplete=\"username\"], input[name=\"text\"], input[type=\"password\"]')).some(isVisible)\n);\nconst identityOf = article => {\n const link = Array.from(article.querySelectorAll('a:has(time)')).find(candidate => {\n const href = candidate.getAttribute('href') || '';\n try {\n return /^\\/[^/]+\\/status\\/\\d+$/.test(new URL(href, location.origin).pathname);\n } catch {\n return false;\n }\n });\n if (!link) return null;\n const url = new URL(link.getAttribute('href') || '', location.origin);\n const parts = url.pathname.split('/').filter(Boolean);\n if (parts.length !== 3 || parts[1] !== 'status' || !/^\\d+$/.test(parts[2])) return null;\n return { link, author: parts[0], postId: parts[2], url: url.href };\n};\nconst parentOf = (article, postId) => {\n const key = Object.keys(article).find(name => name.startsWith('__reactFiber'));\n let fiber = key ? article[key] : null;\n for (let depth = 0; fiber && depth < 30; depth += 1, fiber = fiber.return) {\n const tweet = fiber.memoizedProps && fiber.memoizedProps.tweet;\n if (tweet && tweet.id_str === postId) return typeof tweet.in_reply_to_status_id_str === 'string' ? tweet.in_reply_to_status_id_str : null;\n }\n return null;\n};\nconst matchesFocal = identity => Boolean(identity && identity.postId === postId && identity.author.toLowerCase() === author.toLowerCase());\nconst sleep = ms => new Promise(resolve => setTimeout(resolve, ms));\nlet articles = [];\nlet focal = null;\nlet loginForm = false;\nfor (let attempt = 0; attempt < 40; attempt += 1) {\n if (loginPath) break;\n articles = Array.from(document.querySelectorAll('article'));\n focal = articles.find(article => matchesFocal(identityOf(article))) || null;\n if (focal) break;\n loginForm = hasVisibleLoginForm();\n if (loginForm) break;\n if (attempt < 39) await sleep(250);\n}\nif (loginPath || loginForm) {\n return {\n success: false,\n status: 'requires_auth',\n requiresLogin: true,\n message: 'X requires authentication to read this focal thread',\n author,\n postId,\n source: source.href\n };\n}\nif (!focal) {\n return { success: false, status: 'loading_timeout', requiresLogin: false, message: 'Focal X article did not become visible within 10 seconds', author, postId, source: source.href };\n}\nconst focalIdentity = identityOf(focal);\nconst section = focal.closest('section[aria-labelledby]') || focal.closest('section');\nconst sectionArticles = section ? Array.from(section.querySelectorAll('article')) : articles;\nconst focalIndex = sectionArticles.indexOf(focal);\nconst ordered = focalIndex >= 0 ? sectionArticles.slice(focalIndex) : articles.slice(articles.indexOf(focal));\nconst posts = [];\nconst seen = new Set();\nfor (const article of ordered) {\n if (!isVisible(article)) continue;\n const identity = identityOf(article);\n if (!identity) continue;\n if (article !== focal && identity.author.toLowerCase() !== focalIdentity.author.toLowerCase()) continue;\n if (seen.has(identity.postId)) continue;\n const parentId = parentOf(article, identity.postId);\n if (article !== focal && !seen.has(parentId)) continue;\n const text = String(article.querySelector('[data-testid=\"tweetText\"]') && article.querySelector('[data-testid=\"tweetText\"]').innerText || '').trim();\n const time = identity.link.querySelector('time');\n if (!text) continue;\n seen.add(identity.postId);\n posts.push({\n author: identity.author,\n postId: identity.postId,\n parentId,\n text,\n url: identity.url,\n publishedAt: time ? String(time.getAttribute('datetime') || '') : ''\n });\n if (posts.length >= limit) break;\n}\nif (!posts.length || posts[0].postId !== focalIdentity.postId) {\n return { success: false, status: 'unreadable', requiresLogin: false, message: 'Focal X article was visible but its text or main status link was unreadable', author, postId, source: source.href };\n}\nreturn {\n success: true,\n status: 'ok',\n focal: posts[0],\n posts,\n coverage: 'visible_only',\n sources: { page: source.href }\n};",
191
+ "timeoutMs": 20000
192
+ },
193
+ "resultPath": "/result"
194
+ }
195
+ ],
196
+ "verification": {
197
+ "tool": "chrome_read_dom",
198
+ "args": {
199
+ "format": "compact",
200
+ "selector": "main",
201
+ "activeViewportOnly": false,
202
+ "limit": 120,
203
+ "maxTextLength": 260
204
+ },
205
+ "resultPath": "/treeString"
206
+ },
207
+ "tests": [
208
+ {
209
+ "inputs": {
210
+ "author": "Ytautomation6",
211
+ "postId": "2115063891591921877",
212
+ "limit": 8
213
+ },
214
+ "expect": {
215
+ "type": "object",
216
+ "properties": {
217
+ "success": {
218
+ "const": true
219
+ },
220
+ "status": {
221
+ "const": "ok"
222
+ },
223
+ "focal": {
224
+ "type": "object",
225
+ "properties": {
226
+ "postId": {
227
+ "const": "2115063891591921877"
228
+ }
229
+ },
230
+ "required": [
231
+ "postId"
232
+ ]
233
+ },
234
+ "coverage": {
235
+ "const": "visible_only"
236
+ },
237
+ "posts": {
238
+ "type": "array",
239
+ "minItems": 1
240
+ }
241
+ },
242
+ "required": [
243
+ "success",
244
+ "status",
245
+ "focal",
246
+ "coverage",
247
+ "posts"
248
+ ]
249
+ },
250
+ "observe": {
251
+ "type": "string",
252
+ "pattern": "Team Management"
253
+ }
254
+ },
255
+ {
256
+ "inputs": {
257
+ "author": "crypto_vazima",
258
+ "postId": "2115072668210803107",
259
+ "limit": 8
260
+ },
261
+ "expect": {
262
+ "type": "object",
263
+ "properties": {
264
+ "success": {
265
+ "const": true
266
+ },
267
+ "status": {
268
+ "const": "ok"
269
+ },
270
+ "focal": {
271
+ "type": "object",
272
+ "properties": {
273
+ "postId": {
274
+ "const": "2115072668210803107"
275
+ }
276
+ },
277
+ "required": [
278
+ "postId"
279
+ ]
280
+ },
281
+ "coverage": {
282
+ "const": "visible_only"
283
+ },
284
+ "posts": {
285
+ "type": "array",
286
+ "minItems": 1
287
+ }
288
+ },
289
+ "required": [
290
+ "success",
291
+ "status",
292
+ "focal",
293
+ "coverage",
294
+ "posts"
295
+ ]
296
+ },
297
+ "observe": {
298
+ "type": "string",
299
+ "pattern": "QA Automation Engineer"
300
+ }
301
+ }
302
+ ]
303
+ }
@@ -0,0 +1,7 @@
1
+ @echo off
2
+ setlocal DisableDelayedExpansion
3
+ for %%I in ("%~dp0..") do set "BROWSERPAW_HOME=%%~fI"
4
+ set /p "NODE_EXEC="<"%~dp0node_path.txt"
5
+ if not defined NODE_EXEC exit /b 1
6
+ "%NODE_EXEC%" "%~dp0host.cjs" %*
7
+ exit /b %ERRORLEVEL%
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+ set -eu
3
+ host_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
4
+ export BROWSERPAW_HOME="$(dirname -- "$host_dir")"
5
+ IFS= read -r node_path < "$host_dir/node_path.txt" || [ -n "$node_path" ]
6
+ exec "$node_path" "$host_dir/host.cjs" "$@"