@web-auto/webauto 0.1.4 → 0.1.7

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 (174) hide show
  1. package/apps/desktop-console/default-settings.json +2 -2
  2. package/apps/desktop-console/dist/main/index.mjs +983 -128
  3. package/apps/desktop-console/dist/main/preload.mjs +7 -0
  4. package/apps/desktop-console/dist/renderer/index.html +622 -50
  5. package/apps/desktop-console/dist/renderer/index.js +2423 -469
  6. package/apps/desktop-console/dist/renderer/run.mts +6 -5
  7. package/apps/desktop-console/entry/ui-cli.mjs +672 -0
  8. package/apps/desktop-console/entry/ui-console.mjs +416 -29
  9. package/apps/webauto/entry/account.mjs +89 -53
  10. package/apps/webauto/entry/browser-status.mjs +7 -10
  11. package/apps/webauto/entry/lib/account-detect.mjs +254 -28
  12. package/apps/webauto/entry/lib/account-store.mjs +219 -30
  13. package/apps/webauto/entry/lib/bus-publish.mjs +63 -0
  14. package/apps/webauto/entry/lib/camo-cli.mjs +93 -0
  15. package/apps/webauto/entry/lib/profilepool.mjs +14 -5
  16. package/apps/webauto/entry/lib/quota-status.mjs +23 -0
  17. package/apps/webauto/entry/lib/schedule-store.mjs +1068 -0
  18. package/apps/webauto/entry/profilepool.mjs +106 -17
  19. package/apps/webauto/entry/schedule.mjs +612 -0
  20. package/apps/webauto/entry/weibo-unified.mjs +134 -0
  21. package/apps/webauto/entry/xhs-install.mjs +256 -31
  22. package/apps/webauto/entry/xhs-status.mjs +5 -2
  23. package/apps/webauto/entry/xhs-unified.mjs +631 -98
  24. package/apps/webauto/resources/container-library/weibo/weibo_detail_page/comment_item/container.json +40 -0
  25. package/apps/webauto/resources/container-library/weibo/weibo_detail_page/reply_expand_button/container.json +38 -0
  26. package/apps/webauto/resources/container-library/weibo/weibo_detail_page/reply_list/container.json +37 -0
  27. package/apps/webauto/resources/container-library/weibo/weibo_search_page/container.json +8 -3
  28. package/apps/webauto/resources/container-library/weibo/weibo_search_page/login_anchor/container.json +30 -0
  29. package/apps/webauto/resources/container-library/weibo/weibo_search_page/search_bar/container.json +47 -0
  30. package/apps/webauto/resources/container-library/weibo/weibo_search_page/search_button/container.json +39 -0
  31. package/bin/camoufox-cli.mjs +61 -0
  32. package/bin/webauto.mjs +301 -54
  33. package/dist/modules/camo-backend/src/index.js +49 -1
  34. package/dist/modules/camo-backend/src/internal/BrowserSession.js +572 -3
  35. package/dist/modules/camo-backend/src/internal/SessionManager.js +13 -1
  36. package/dist/modules/camo-backend/src/internal/storage-paths.js +6 -0
  37. package/dist/modules/collection-manager/bloom-filter.js +91 -0
  38. package/dist/modules/collection-manager/date-utils.js +275 -0
  39. package/dist/modules/collection-manager/index.js +258 -0
  40. package/dist/modules/collection-manager/storage.js +195 -0
  41. package/dist/modules/collection-manager/types.js +47 -0
  42. package/dist/modules/logging/src/index.js +1 -1
  43. package/dist/modules/process-registry/index.js +230 -0
  44. package/dist/modules/rate-limiter/index.js +242 -0
  45. package/dist/modules/workflow/blocks/ExecuteWeiboSearchBlock.js +128 -0
  46. package/dist/modules/workflow/blocks/PersistXhsNoteBlock.js +7 -3
  47. package/dist/modules/workflow/blocks/RenderMarkdown.js +4 -1
  48. package/dist/modules/workflow/blocks/WeiboCollectCommentsBlock.js +282 -0
  49. package/dist/modules/workflow/blocks/WeiboCollectFromLinksBlock.js +283 -0
  50. package/dist/modules/workflow/blocks/WeiboCollectSearchLinksBlock.js +208 -0
  51. package/dist/modules/workflow/blocks/WeiboCollectTimelineListBlock.js +128 -0
  52. package/dist/modules/workflow/blocks/WeiboCollectUserPostsListBlock.js +127 -0
  53. package/dist/modules/workflow/blocks/helpers/downloadPaths.js +21 -0
  54. package/dist/modules/workflow/config/workflowRegistry.js +2 -0
  55. package/dist/modules/workflow/definitions/weibo-search-workflow-v1.js +47 -0
  56. package/dist/modules/workflow/src/runner.js +6 -0
  57. package/dist/modules/xiaohongshu/app/src/blocks/Phase34PersistDetailBlock.js +4 -0
  58. package/dist/modules/xiaohongshu/app/src/blocks/Phase3InteractBlock.js +2 -2
  59. package/dist/modules/xiaohongshu/app/src/blocks/helpers/sharding.js +123 -0
  60. package/dist/modules/xiaohongshu/app/src/container-registry/src/index.d.ts +37 -0
  61. package/dist/modules/xiaohongshu/app/src/container-registry/src/index.js +184 -0
  62. package/dist/modules/xiaohongshu/app/src/workflow/blocks/AnchorVerificationBlock.d.ts +31 -0
  63. package/dist/modules/xiaohongshu/app/src/workflow/blocks/AnchorVerificationBlock.js +71 -0
  64. package/dist/modules/xiaohongshu/app/src/workflow/blocks/DetectPageStateBlock.d.ts +48 -0
  65. package/dist/modules/xiaohongshu/app/src/workflow/blocks/DetectPageStateBlock.js +259 -0
  66. package/dist/modules/xiaohongshu/app/src/workflow/blocks/ErrorRecoveryBlock.d.ts +28 -0
  67. package/dist/modules/xiaohongshu/app/src/workflow/blocks/ErrorRecoveryBlock.js +319 -0
  68. package/dist/modules/xiaohongshu/app/src/workflow/blocks/WaitSearchPermitBlock.d.ts +36 -0
  69. package/dist/modules/xiaohongshu/app/src/workflow/blocks/WaitSearchPermitBlock.js +162 -0
  70. package/dist/modules/xiaohongshu/app/src/workflow/blocks/helpers/containerAnchors.d.ts +36 -0
  71. package/dist/modules/xiaohongshu/app/src/workflow/blocks/helpers/containerAnchors.js +301 -0
  72. package/dist/modules/xiaohongshu/app/src/workflow/blocks/helpers/operationLogger.d.ts +29 -0
  73. package/dist/modules/xiaohongshu/app/src/workflow/blocks/helpers/operationLogger.js +195 -0
  74. package/dist/modules/xiaohongshu/app/src/workflow/blocks/helpers/searchPageState.d.ts +25 -0
  75. package/dist/modules/xiaohongshu/app/src/workflow/blocks/helpers/searchPageState.js +164 -0
  76. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/MatchCommentsBlock.d.ts +66 -0
  77. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/MatchCommentsBlock.js +139 -0
  78. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase1EnsureServicesBlock.d.ts +16 -0
  79. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase1EnsureServicesBlock.js +36 -0
  80. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase1MonitorCookieBlock.d.ts +27 -0
  81. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase1MonitorCookieBlock.js +213 -0
  82. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase1StartProfileBlock.d.ts +18 -0
  83. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase1StartProfileBlock.js +121 -0
  84. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase2CollectLinksBlock.d.ts +34 -0
  85. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase2CollectLinksBlock.js +1249 -0
  86. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase2SearchBlock.d.ts +17 -0
  87. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase2SearchBlock.js +703 -0
  88. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34CloseDetailBlock.d.ts +15 -0
  89. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34CloseDetailBlock.js +41 -0
  90. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34CloseTabsBlock.d.ts +26 -0
  91. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34CloseTabsBlock.js +44 -0
  92. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34CollectCommentsBlock.d.ts +29 -0
  93. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34CollectCommentsBlock.js +150 -0
  94. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34ExtractDetailBlock.d.ts +38 -0
  95. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34ExtractDetailBlock.js +117 -0
  96. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34OpenDetailBlock.d.ts +30 -0
  97. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34OpenDetailBlock.js +102 -0
  98. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34OpenTabsBlock.d.ts +23 -0
  99. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34OpenTabsBlock.js +109 -0
  100. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34PersistDetailBlock.d.ts +32 -0
  101. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34PersistDetailBlock.js +117 -0
  102. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34ProcessSingleNoteBlock.d.ts +35 -0
  103. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34ProcessSingleNoteBlock.js +114 -0
  104. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34ValidateLinksBlock.d.ts +34 -0
  105. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase34ValidateLinksBlock.js +90 -0
  106. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase3InteractBlock.d.ts +111 -0
  107. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase3InteractBlock.js +1009 -0
  108. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase4MultiTabHarvestBlock.d.ts +20 -0
  109. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/Phase4MultiTabHarvestBlock.js +233 -0
  110. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/ReplyInteractBlock.d.ts +48 -0
  111. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/ReplyInteractBlock.js +291 -0
  112. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/XhsDiscoverFallbackBlock.d.ts +23 -0
  113. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/XhsDiscoverFallbackBlock.js +240 -0
  114. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/commentMatchDsl.d.ts +55 -0
  115. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/commentMatchDsl.js +126 -0
  116. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/commentMatcher.d.ts +21 -0
  117. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/commentMatcher.js +99 -0
  118. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/evidence.d.ts +5 -0
  119. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/evidence.js +27 -0
  120. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/sharding.d.ts +37 -0
  121. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/sharding.js +165 -0
  122. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/xhsComments.d.ts +33 -0
  123. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/blocks/helpers/xhsComments.js +270 -0
  124. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/index.d.ts +9 -0
  125. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/index.js +9 -0
  126. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/utils/checkpoints.d.ts +50 -0
  127. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/utils/checkpoints.js +222 -0
  128. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/utils/controllerAction.d.ts +10 -0
  129. package/dist/modules/xiaohongshu/app/src/xiaohongshu/app/src/utils/controllerAction.js +43 -0
  130. package/dist/services/shared/serviceProcessLogger.js +1 -1
  131. package/dist/services/unified-api/server.js +105 -11
  132. package/modules/camo-backend/src/index.ts +46 -1
  133. package/modules/camo-backend/src/internal/BrowserSession.ts +619 -3
  134. package/modules/camo-backend/src/internal/SessionManager.ts +12 -1
  135. package/modules/camo-backend/src/internal/storage-paths.ts +5 -0
  136. package/modules/camo-runtime/src/autoscript/action-providers/xhs/comments.mjs +38 -2
  137. package/modules/camo-runtime/src/autoscript/action-providers/xhs/interaction.mjs +47 -2
  138. package/modules/camo-runtime/src/autoscript/action-providers/xhs/search.mjs +94 -11
  139. package/modules/camo-runtime/src/autoscript/action-providers/xhs.mjs +208 -2
  140. package/modules/camo-runtime/src/autoscript/runtime.mjs +7 -1
  141. package/modules/camo-runtime/src/autoscript/xhs-unified-template.mjs +76 -43
  142. package/modules/camo-runtime/src/container/runtime-core/operations/index.mjs +75 -1
  143. package/modules/camo-runtime/src/container/runtime-core/operations/selector-scripts.mjs +71 -4
  144. package/modules/camo-runtime/src/container/runtime-core/operations/tab-pool.mjs +183 -27
  145. package/modules/collection-manager/bloom-filter.ts +112 -0
  146. package/modules/collection-manager/date-utils.ts +316 -0
  147. package/modules/collection-manager/index.ts +309 -0
  148. package/modules/collection-manager/package.json +10 -0
  149. package/modules/collection-manager/storage.ts +174 -0
  150. package/modules/collection-manager/types.ts +156 -0
  151. package/modules/logging/src/index.ts +1 -1
  152. package/modules/process-registry/index.ts +284 -0
  153. package/modules/rate-limiter/index.ts +322 -0
  154. package/modules/state/src/paths.ts +9 -1
  155. package/modules/task-scheduler/index.ts +293 -0
  156. package/modules/workflow/blocks/ExecuteWeiboSearchBlock.ts +167 -0
  157. package/modules/workflow/blocks/PersistXhsNoteBlock.ts +7 -3
  158. package/modules/workflow/blocks/RenderMarkdown.ts +4 -1
  159. package/modules/workflow/blocks/WeiboCollectCommentsBlock.ts +339 -0
  160. package/modules/workflow/blocks/WeiboCollectFromLinksBlock.ts +338 -0
  161. package/modules/workflow/blocks/helpers/downloadPaths.ts +16 -0
  162. package/modules/workflow/config/workflowRegistry.ts +2 -0
  163. package/modules/workflow/definitions/weibo-search-workflow-v1.ts +47 -0
  164. package/modules/workflow/src/runner.ts +6 -0
  165. package/modules/xiaohongshu/app/src/blocks/Phase1StartProfileBlock.ts +1 -1
  166. package/modules/xiaohongshu/app/src/blocks/Phase34PersistDetailBlock.ts +4 -0
  167. package/modules/xiaohongshu/app/src/blocks/Phase3InteractBlock.ts +2 -3
  168. package/modules/xiaohongshu/app/src/blocks/helpers/sharding.ts +152 -0
  169. package/package.json +13 -4
  170. package/scripts/postinstall-resources.mjs +62 -0
  171. package/scripts/test/run-coverage.mjs +76 -0
  172. package/scripts/weibo/search.ts +49 -0
  173. package/services/shared/serviceProcessLogger.ts +1 -1
  174. package/services/unified-api/server.ts +98 -12
@@ -0,0 +1,40 @@
1
+ {
2
+ "id": "weibo_detail_page.comment_item",
3
+ "name": "详情页-单条评论",
4
+ "type": "content",
5
+ "selectors": [
6
+ {
7
+ "css": "div[class*='Comment_wrap_']",
8
+ "variant": "primary",
9
+ "score": 1.0
10
+ },
11
+ {
12
+ "css": "article[class*='Comment_item_']",
13
+ "variant": "backup",
14
+ "score": 0.8
15
+ }
16
+ ],
17
+ "capabilities": ["highlight", "extract", "click"],
18
+ "operations": [
19
+ {
20
+ "type": "highlight",
21
+ "config": {
22
+ "style": "2px solid #8e44ad",
23
+ "duration": 800
24
+ }
25
+ },
26
+ {
27
+ "type": "extract",
28
+ "config": {
29
+ "target": "comment",
30
+ "fields": {
31
+ "author": "a[class*='author']",
32
+ "content": "div[class*='content']",
33
+ "timestamp": "time",
34
+ "likeCount": "span[class*='like_count']",
35
+ "replyCount": "span[class*='reply_count']"
36
+ }
37
+ }
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "id": "weibo_detail_page.reply_expand_button",
3
+ "name": "详情页-回复展开按钮",
4
+ "type": "button",
5
+ "selectors": [
6
+ {
7
+ "css": "a[class*='reply_expand']",
8
+ "variant": "primary",
9
+ "score": 1.0
10
+ },
11
+ {
12
+ "css": "span[class*='reply_btn']",
13
+ "variant": "backup",
14
+ "score": 0.8
15
+ }
16
+ ],
17
+ "metadata": {
18
+ "text_contains": ["收起回复", "展开"],
19
+ "auto_click": true
20
+ },
21
+ "capabilities": ["highlight", "click"],
22
+ "operations": [
23
+ {
24
+ "type": "highlight",
25
+ "config": {
26
+ "style": "2px solid #f39c12",
27
+ "duration": 1000
28
+ }
29
+ },
30
+ {
31
+ "type": "click",
32
+ "config": {
33
+ "scroll_to_view": true,
34
+ "wait_after": 800
35
+ }
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "id": "weibo_detail_page.reply_list",
3
+ "name": "详情页-回复列表",
4
+ "type": "list",
5
+ "selectors": [
6
+ {
7
+ "css": "div[class*='reply_list']",
8
+ "variant": "primary",
9
+ "score": 1.0
10
+ },
11
+ {
12
+ "css": "div[class*='Reply_wrap_']",
13
+ "variant": "backup",
14
+ "score": 0.8
15
+ }
16
+ ],
17
+ "capabilities": ["scroll", "highlight", "find-child"],
18
+ "children": [
19
+ "weibo_detail_page.comment_item"
20
+ ],
21
+ "operations": [
22
+ {
23
+ "type": "highlight",
24
+ "config": {
25
+ "style": "2px solid #16a085",
26
+ "duration": 800
27
+ }
28
+ },
29
+ {
30
+ "type": "scroll",
31
+ "config": {
32
+ "direction": "down",
33
+ "distance": 300
34
+ }
35
+ }
36
+ ]
37
+ }
@@ -2,17 +2,22 @@
2
2
  "id": "weibo_search_page",
3
3
  "name": "微博搜索页(未登录/已登录均可)",
4
4
  "type": "page",
5
- "page_patterns": ["s.weibo.com"],
5
+ "page_patterns": ["s.weibo.com", "s.weibo.com/weibo/*"],
6
6
  "selectors": [
7
- { "css": "body.wbs-feed", "variant": "primary", "score": 1.0 }
7
+ { "css": "body.wbs-feed", "variant": "primary", "score": 1.0 },
8
+ { "css": ".search_wrap", "variant": "backup", "score": 0.8 }
8
9
  ],
9
10
  "children": [
11
+ "weibo_search_page.search_bar",
12
+ "weibo_search_page.search_button",
10
13
  "weibo_search_page.search_list",
11
- "weibo_search_page.search_item"
14
+ "weibo_search_page.search_item",
15
+ "weibo_search_page.login_anchor"
12
16
  ],
13
17
  "capabilities": ["scroll", "highlight", "find-child"],
14
18
  "operations": [
15
19
  { "type": "highlight", "config": { "style": "2px solid #26a69a", "duration": 1000 } },
20
+ { "type": "find-child", "config": { "container_id": "weibo_search_page.search_bar" } },
16
21
  { "type": "find-child", "config": { "container_id": "weibo_search_page.search_list" } }
17
22
  ]
18
23
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "id": "weibo_search_page.login_anchor",
3
+ "name": "登录状态标识",
4
+ "type": "anchor",
5
+ "capabilities": ["highlight"],
6
+ "selectors": [
7
+ {
8
+ "css": "a[href*='/u/'][class*='user']",
9
+ "variant": "logged-in",
10
+ "score": 1.0
11
+ },
12
+ {
13
+ "css": ".user_icon",
14
+ "variant": "backup",
15
+ "score": 0.8
16
+ }
17
+ ],
18
+ "metadata": {
19
+ "indicates": "logged_in"
20
+ },
21
+ "operations": [
22
+ {
23
+ "type": "highlight",
24
+ "config": {
25
+ "style": "2px solid #22c55e",
26
+ "duration": 1000
27
+ }
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "id": "weibo_search_page.search_bar",
3
+ "name": "搜索输入框",
4
+ "type": "input",
5
+ "capabilities": ["input", "highlight", "focus"],
6
+ "selectors": [
7
+ {
8
+ "css": ".woo-input-main[placeholder*='搜索']",
9
+ "variant": "primary",
10
+ "score": 1.0
11
+ },
12
+ {
13
+ "css": "input[type='text'][placeholder*='搜索']",
14
+ "variant": "backup",
15
+ "score": 0.8
16
+ },
17
+ {
18
+ "css": "input[name='q']",
19
+ "variant": "fallback",
20
+ "score": 0.7
21
+ }
22
+ ],
23
+ "operations": [
24
+ {
25
+ "type": "highlight",
26
+ "config": {
27
+ "style": "2px solid #34a853",
28
+ "duration": 1500
29
+ }
30
+ },
31
+ {
32
+ "type": "type",
33
+ "config": {
34
+ "clear_first": true,
35
+ "human_typing": true,
36
+ "pause_after": 300
37
+ }
38
+ },
39
+ {
40
+ "type": "key",
41
+ "config": {
42
+ "key": "Enter",
43
+ "wait_after": 1500
44
+ }
45
+ }
46
+ ]
47
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "id": "weibo_search_page.search_button",
3
+ "name": "搜索按钮",
4
+ "type": "button",
5
+ "capabilities": ["click", "highlight"],
6
+ "selectors": [
7
+ {
8
+ "css": "button[type='submit']",
9
+ "variant": "primary",
10
+ "score": 1.0
11
+ },
12
+ {
13
+ "css": ".search_btn",
14
+ "variant": "backup",
15
+ "score": 0.8
16
+ },
17
+ {
18
+ "css": "a[class*='search_btn']",
19
+ "variant": "fallback",
20
+ "score": 0.6
21
+ }
22
+ ],
23
+ "operations": [
24
+ {
25
+ "type": "highlight",
26
+ "config": {
27
+ "style": "2px solid #e6162d",
28
+ "duration": 1000
29
+ }
30
+ },
31
+ {
32
+ "type": "click",
33
+ "config": {
34
+ "scroll_to_view": true,
35
+ "wait_after": 1500
36
+ }
37
+ }
38
+ ]
39
+ }
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'node:child_process';
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const ROOT = path.resolve(__dirname, '..');
9
+ const args = process.argv.slice(2);
10
+
11
+ function quoteCmdArg(value) {
12
+ if (!value) return '""';
13
+ if (!/[\s"]/u.test(value)) return value;
14
+ return `"${value.replace(/"/g, '""')}"`;
15
+ }
16
+
17
+ function spawnCommand(command, argv) {
18
+ if (process.platform === 'win32') {
19
+ const lower = String(command || '').toLowerCase();
20
+ if (lower.endsWith('.cmd') || lower.endsWith('.bat')) {
21
+ const cmdLine = [quoteCmdArg(command), ...argv.map(quoteCmdArg)].join(' ');
22
+ return spawn('cmd.exe', ['/d', '/s', '/c', cmdLine], {
23
+ stdio: 'inherit',
24
+ env: process.env,
25
+ windowsHide: true,
26
+ });
27
+ }
28
+ }
29
+ return spawn(command, argv, {
30
+ stdio: 'inherit',
31
+ env: process.env,
32
+ windowsHide: true,
33
+ });
34
+ }
35
+
36
+ function resolveCamoCommand() {
37
+ const localCamo = path.join(ROOT, 'node_modules', '@web-auto', 'camo', 'bin', 'camo.mjs');
38
+ if (fs.existsSync(localCamo)) {
39
+ return { cmd: process.execPath, argv: [localCamo, ...args] };
40
+ }
41
+
42
+ const shim = process.platform === 'win32' ? 'camo.cmd' : 'camo';
43
+ const localShim = path.join(ROOT, 'node_modules', '.bin', shim);
44
+ if (fs.existsSync(localShim)) {
45
+ return { cmd: localShim, argv: args };
46
+ }
47
+
48
+ return { cmd: shim, argv: args };
49
+ }
50
+
51
+ const { cmd, argv } = resolveCamoCommand();
52
+ const child = spawnCommand(cmd, argv);
53
+
54
+ child.on('error', (err) => {
55
+ console.error(`Failed to start camoufox-cli: ${err?.message || String(err)}`);
56
+ process.exit(1);
57
+ });
58
+
59
+ child.on('exit', (code) => {
60
+ process.exit(code ?? 0);
61
+ });