@web-auto/webauto 0.1.1 → 0.1.2
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/apps/desktop-console/default-settings.json +1 -0
- package/apps/desktop-console/dist/main/index.mjs +1618 -0
- package/apps/desktop-console/{src → dist}/main/preload.mjs +10 -0
- package/apps/desktop-console/dist/renderer/index.js +3063 -0
- package/apps/desktop-console/entry/ui-console.mjs +299 -0
- package/apps/webauto/entry/account.mjs +356 -0
- package/apps/webauto/entry/lib/account-detect.mjs +160 -0
- package/apps/webauto/entry/lib/account-store.mjs +587 -0
- package/apps/webauto/entry/lib/profilepool.mjs +1 -1
- package/apps/webauto/entry/xhs-install.mjs +27 -3
- package/apps/webauto/entry/xhs-status.mjs +152 -0
- package/apps/webauto/entry/xhs-unified.mjs +595 -17
- package/bin/webauto.mjs +247 -12
- package/dist/apps/webauto/server.js +66 -0
- package/dist/modules/camo-backend/src/index.js +575 -0
- package/dist/modules/camo-backend/src/internal/BrowserSession.js +817 -0
- package/dist/modules/camo-backend/src/internal/ElementRegistry.js +61 -0
- package/dist/modules/camo-backend/src/internal/ProfileLock.js +85 -0
- package/dist/modules/camo-backend/src/internal/SessionManager.js +172 -0
- package/dist/modules/camo-backend/src/internal/container-matcher.js +852 -0
- package/dist/modules/camo-backend/src/internal/engine-manager.js +258 -0
- package/dist/modules/camo-backend/src/internal/fingerprint.js +203 -0
- package/dist/modules/camo-backend/src/internal/pageRuntime.js +29 -0
- package/dist/modules/camo-backend/src/internal/runtimeInjector.js +30 -0
- package/dist/modules/camo-backend/src/internal/state-bus.js +46 -0
- package/dist/modules/camo-backend/src/internal/storage-paths.js +36 -0
- package/dist/modules/camo-backend/src/internal/ws-server.js +1202 -0
- package/dist/modules/camo-runtime/src/utils/browser-service.mjs +423 -0
- package/dist/modules/camo-runtime/src/utils/config.mjs +77 -0
- package/dist/modules/container-registry/src/index.js +184 -0
- package/dist/modules/logging/src/index.js +92 -0
- package/dist/modules/operations/src/builtin.js +27 -0
- package/dist/modules/operations/src/container-binding.js +75 -0
- package/dist/modules/operations/src/executor.js +146 -0
- package/dist/modules/operations/src/operations/click.js +167 -0
- package/dist/modules/operations/src/operations/extract.js +204 -0
- package/dist/modules/operations/src/operations/find-child.js +17 -0
- package/dist/modules/operations/src/operations/highlight.js +138 -0
- package/dist/modules/operations/src/operations/key.js +61 -0
- package/dist/modules/operations/src/operations/navigate.js +148 -0
- package/dist/modules/operations/src/operations/scroll.js +126 -0
- package/dist/modules/operations/src/operations/type.js +190 -0
- package/dist/modules/operations/src/queue.js +100 -0
- package/dist/modules/operations/src/registry.js +11 -0
- package/dist/modules/operations/src/system/mouse.js +33 -0
- package/dist/modules/state/src/atomic-json.js +33 -0
- package/dist/modules/workflow/blocks/AnchorVerificationBlock.js +71 -0
- package/dist/modules/workflow/blocks/BehaviorRandomizer.js +26 -0
- package/dist/modules/workflow/blocks/CallWorkflowBlock.js +38 -0
- package/dist/modules/workflow/blocks/CloseDetailBlock.js +209 -0
- package/dist/modules/workflow/blocks/CollectBatch.js +137 -0
- package/dist/modules/workflow/blocks/CollectCommentsBlock.js +415 -0
- package/dist/modules/workflow/blocks/CollectSearchListBlock.js +599 -0
- package/dist/modules/workflow/blocks/CollectWeiboPosts.js +229 -0
- package/dist/modules/workflow/blocks/DetectPageStateBlock.js +259 -0
- package/dist/modules/workflow/blocks/EnsureLoginBlock.js +162 -0
- package/dist/modules/workflow/blocks/EnsureSession.js +426 -0
- package/dist/modules/workflow/blocks/ErrorClassifier.js +164 -0
- package/dist/modules/workflow/blocks/ErrorRecoveryBlock.js +319 -0
- package/dist/modules/workflow/blocks/ExpandCommentsBlock.js +1032 -0
- package/dist/modules/workflow/blocks/ExtractDetailBlock.js +310 -0
- package/dist/modules/workflow/blocks/ExtractPostFields.js +88 -0
- package/dist/modules/workflow/blocks/GenerateSmartReplyBlock.js +68 -0
- package/dist/modules/workflow/blocks/GoToSearchBlock.js +497 -0
- package/dist/modules/workflow/blocks/GracefulFallbackBlock.js +104 -0
- package/dist/modules/workflow/blocks/HighlightBlock.js +66 -0
- package/dist/modules/workflow/blocks/InitAutoScroll.js +65 -0
- package/dist/modules/workflow/blocks/LoadContainerDefinition.js +50 -0
- package/dist/modules/workflow/blocks/LoadContainerIndex.js +43 -0
- package/dist/modules/workflow/blocks/LocateAndGuardBlock.js +176 -0
- package/dist/modules/workflow/blocks/LoginRecoveryBlock.js +242 -0
- package/dist/modules/workflow/blocks/MatchContainers.js +64 -0
- package/dist/modules/workflow/blocks/MonitoringBlock.js +190 -0
- package/dist/modules/workflow/blocks/OpenDetailBlock.js +1240 -0
- package/dist/modules/workflow/blocks/OrganizeXhsNotesBlock.js +117 -0
- package/dist/modules/workflow/blocks/PersistXhsNoteBlock.js +270 -0
- package/dist/modules/workflow/blocks/PickSinglePost.js +69 -0
- package/dist/modules/workflow/blocks/ProgressTracker.js +125 -0
- package/dist/modules/workflow/blocks/RecordFixtureBlock.js +44 -0
- package/dist/modules/workflow/blocks/RenderMarkdown.js +48 -0
- package/dist/modules/workflow/blocks/SaveFile.js +54 -0
- package/dist/modules/workflow/blocks/ScrollNextBatch.js +72 -0
- package/dist/modules/workflow/blocks/SessionHealthBlock.js +73 -0
- package/dist/modules/workflow/blocks/StartBrowserService.js +45 -0
- package/dist/modules/workflow/blocks/ValidateContainerDefinition.js +67 -0
- package/dist/modules/workflow/blocks/ValidateExtract.js +35 -0
- package/dist/modules/workflow/blocks/WaitSearchPermitBlock.js +162 -0
- package/dist/modules/workflow/blocks/WaitStable.js +74 -0
- package/dist/modules/workflow/blocks/WarmupCommentsBlock.js +120 -0
- package/dist/modules/workflow/blocks/WorkflowExecutor.js +156 -0
- package/dist/modules/workflow/blocks/XiaohongshuCollectFromLinksBlock.js +1004 -0
- package/dist/modules/workflow/blocks/XiaohongshuCollectLinksBlock.js +1049 -0
- package/dist/modules/workflow/blocks/XiaohongshuFullCollectBlock.js +782 -0
- package/dist/modules/workflow/blocks/helpers/anchorVerify.js +198 -0
- package/dist/modules/workflow/blocks/helpers/asyncWorkQueue.js +53 -0
- package/dist/modules/workflow/blocks/helpers/commentScroller.js +334 -0
- package/dist/modules/workflow/blocks/helpers/commentSectionLocator.js +126 -0
- package/dist/modules/workflow/blocks/helpers/containerAnchors.js +301 -0
- package/dist/modules/workflow/blocks/helpers/debugArtifacts.js +6 -0
- package/dist/modules/workflow/blocks/helpers/downloadPaths.js +29 -0
- package/dist/modules/workflow/blocks/helpers/expandCommentsController.js +53 -0
- package/dist/modules/workflow/blocks/helpers/expandCommentsExtractor.js +129 -0
- package/dist/modules/workflow/blocks/helpers/macosVisionOcrPlugin.js +116 -0
- package/dist/modules/workflow/blocks/helpers/mergeXhsMarkdown.js +109 -0
- package/dist/modules/workflow/blocks/helpers/openDetailController.js +56 -0
- package/dist/modules/workflow/blocks/helpers/openDetailTypes.js +7 -0
- package/dist/modules/workflow/blocks/helpers/openDetailViewport.js +474 -0
- package/dist/modules/workflow/blocks/helpers/openDetailWaiter.js +104 -0
- package/dist/modules/workflow/blocks/helpers/operationLogger.js +195 -0
- package/dist/modules/workflow/blocks/helpers/persistedNotes.js +107 -0
- package/dist/modules/workflow/blocks/helpers/replyExpander.js +260 -0
- package/dist/modules/workflow/blocks/helpers/scrollIntoView.js +138 -0
- package/dist/modules/workflow/blocks/helpers/searchExecutor.js +328 -0
- package/dist/modules/workflow/blocks/helpers/searchGate.js +46 -0
- package/dist/modules/workflow/blocks/helpers/searchPageState.js +164 -0
- package/dist/modules/workflow/blocks/helpers/searchResultWaiter.js +64 -0
- package/dist/modules/workflow/blocks/helpers/simpleAnchor.js +134 -0
- package/dist/modules/workflow/blocks/helpers/smartReply.js +40 -0
- package/dist/modules/workflow/blocks/helpers/systemInput.js +635 -0
- package/dist/modules/workflow/blocks/helpers/targetCountMode.js +9 -0
- package/dist/modules/workflow/blocks/helpers/xhsCliArgs.js +80 -0
- package/dist/modules/workflow/blocks/helpers/xhsCommentDom.js +805 -0
- package/dist/modules/workflow/blocks/helpers/xhsNoteOrganizer.js +140 -0
- package/dist/modules/workflow/blocks/restore/RestorePhaseBlock.js +204 -0
- package/dist/modules/workflow/config/workflowRegistry.js +32 -0
- package/dist/modules/workflow/definitions/batch-collect-workflow.js +63 -0
- package/dist/modules/workflow/definitions/scroll-extract-workflow.js +74 -0
- package/dist/modules/workflow/definitions/xiaohongshu-collect-workflow-v2.js +81 -0
- package/dist/modules/workflow/definitions/xiaohongshu-collect-workflow.js +57 -0
- package/dist/modules/workflow/definitions/xiaohongshu-full-collect-workflow-v3.js +68 -0
- package/dist/modules/workflow/definitions/xiaohongshu-note-collect.js +49 -0
- package/dist/modules/workflow/definitions/xiaohongshu-phase1-workflow-v3.js +30 -0
- package/dist/modules/workflow/definitions/xiaohongshu-phase2-links-workflow-v3.js +40 -0
- package/dist/modules/workflow/definitions/xiaohongshu-phase3-collect-workflow-v1.js +54 -0
- package/dist/modules/workflow/definitions/xiaohongshu-phase34-from-links-workflow-v3.js +25 -0
- package/dist/modules/workflow/src/WeiboEventDrivenWorkflowRunner.js +308 -0
- package/dist/modules/workflow/src/context.js +70 -0
- package/dist/modules/workflow/src/index.js +5 -0
- package/dist/modules/workflow/src/orchestrator.js +230 -0
- package/dist/modules/workflow/src/runner.js +55 -0
- package/dist/modules/workflow/src/runtime.js +70 -0
- package/dist/modules/workflow/workflows/WeiboFeedExtractionWorkflow.js +359 -0
- package/dist/modules/workflow/workflows/XiaohongshuLoginWorkflow.js +110 -0
- package/dist/modules/xiaohongshu/app/src/blocks/MatchCommentsBlock.js +139 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase1EnsureServicesBlock.js +36 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase1MonitorCookieBlock.js +213 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase1StartProfileBlock.js +121 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase2CollectLinksBlock.js +1249 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase2SearchBlock.js +703 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34CloseDetailBlock.js +41 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34CloseTabsBlock.js +44 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34CollectCommentsBlock.js +150 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34ExtractDetailBlock.js +117 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34OpenDetailBlock.js +102 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34OpenTabsBlock.js +109 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34PersistDetailBlock.js +117 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34ProcessSingleNoteBlock.js +114 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase34ValidateLinksBlock.js +90 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase3InteractBlock.js +1009 -0
- package/dist/modules/xiaohongshu/app/src/blocks/Phase4MultiTabHarvestBlock.js +233 -0
- package/dist/modules/xiaohongshu/app/src/blocks/ReplyInteractBlock.js +291 -0
- package/dist/modules/xiaohongshu/app/src/blocks/XhsDiscoverFallbackBlock.js +240 -0
- package/dist/modules/xiaohongshu/app/src/blocks/helpers/commentMatchDsl.js +126 -0
- package/dist/modules/xiaohongshu/app/src/blocks/helpers/commentMatcher.js +99 -0
- package/dist/modules/xiaohongshu/app/src/blocks/helpers/evidence.js +27 -0
- package/dist/modules/xiaohongshu/app/src/blocks/helpers/sharding.js +42 -0
- package/dist/modules/xiaohongshu/app/src/blocks/helpers/xhsComments.js +270 -0
- package/dist/modules/xiaohongshu/app/src/index.js +9 -0
- package/dist/modules/xiaohongshu/app/src/utils/checkpoints.js +222 -0
- package/dist/modules/xiaohongshu/app/src/utils/controllerAction.js +43 -0
- package/dist/services/controller/src/controller.js +1476 -0
- package/dist/services/controller/src/index.js +2 -0
- package/dist/services/controller/src/payload-normalizer.js +129 -0
- package/dist/services/shared/heartbeat.js +120 -0
- package/dist/services/shared/lib/errorHandler.js +2 -0
- package/dist/services/shared/serviceProcessLogger.js +139 -0
- package/dist/services/unified-api/RemoteBrowserSession.js +176 -0
- package/dist/services/unified-api/RemoteSessionManager.js +148 -0
- package/dist/services/unified-api/container-operations-handler.js +115 -0
- package/dist/services/unified-api/server.js +652 -0
- package/dist/services/unified-api/state-registry.js +274 -0
- package/dist/services/unified-api/task-persistence.js +66 -0
- package/dist/services/unified-api/task-state.js +130 -0
- package/modules/camo-runtime/src/autoscript/action-providers/xhs/search.mjs +12 -5
- package/modules/xiaohongshu/app/pnpm-lock.yaml +24 -0
- package/package.json +37 -9
- package/.beads/README.md +0 -81
- package/.beads/config.yaml +0 -67
- package/.beads/interactions.jsonl +0 -0
- package/.beads/issues.jsonl +0 -180
- package/.beads/metadata.json +0 -4
- package/.claude/settings.local.json +0 -10
- package/.github/workflows/ci.yml +0 -55
- package/AGENTS.md +0 -253
- package/apps/desktop-console/README.md +0 -27
- package/apps/desktop-console/package-lock.json +0 -897
- package/apps/desktop-console/package.json +0 -20
- package/apps/desktop-console/scripts/build-and-install.mjs +0 -19
- package/apps/desktop-console/scripts/build.mjs +0 -45
- package/apps/desktop-console/scripts/test-preload.mjs +0 -13
- package/apps/desktop-console/src/main/config.mts +0 -26
- package/apps/desktop-console/src/main/core-daemon-manager.mts +0 -131
- package/apps/desktop-console/src/main/desktop-settings.mts +0 -267
- package/apps/desktop-console/src/main/heartbeat-watchdog.mts +0 -50
- package/apps/desktop-console/src/main/heartbeat-watchdog.test.mts +0 -68
- package/apps/desktop-console/src/main/index-streaming.test.mts +0 -20
- package/apps/desktop-console/src/main/index.mts +0 -980
- package/apps/desktop-console/src/main/profile-store.mts +0 -239
- package/apps/desktop-console/src/main/profile-store.test.mts +0 -54
- package/apps/desktop-console/src/main/state-bridge.mts +0 -114
- package/apps/desktop-console/src/main/task-state-types.ts +0 -32
- package/apps/desktop-console/src/renderer/hooks/use-task-state.mts +0 -120
- package/apps/desktop-console/src/renderer/index.mts +0 -133
- package/apps/desktop-console/src/renderer/index.test.mts +0 -34
- package/apps/desktop-console/src/renderer/path-helpers.mts +0 -46
- package/apps/desktop-console/src/renderer/path-helpers.test.mts +0 -14
- package/apps/desktop-console/src/renderer/tabs/debug.mts +0 -48
- package/apps/desktop-console/src/renderer/tabs/debug.test.mts +0 -22
- package/apps/desktop-console/src/renderer/tabs/logs.mts +0 -421
- package/apps/desktop-console/src/renderer/tabs/logs.test.mts +0 -27
- package/apps/desktop-console/src/renderer/tabs/preflight.mts +0 -486
- package/apps/desktop-console/src/renderer/tabs/preflight.test.mts +0 -33
- package/apps/desktop-console/src/renderer/tabs/profile-pool.mts +0 -213
- package/apps/desktop-console/src/renderer/tabs/results.mts +0 -171
- package/apps/desktop-console/src/renderer/tabs/run.test.mts +0 -63
- package/apps/desktop-console/src/renderer/tabs/runtime.mts +0 -151
- package/apps/desktop-console/src/renderer/tabs/settings.mts +0 -146
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu/account-flow.mts +0 -486
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu/guide-browser-check.mts +0 -56
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu/helpers.mts +0 -262
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu/layout-block.mts +0 -430
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu/live-stats.mts +0 -847
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu/run-flow.mts +0 -443
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu-state.mts +0 -425
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu.mts +0 -497
- package/apps/desktop-console/src/renderer/tabs/xiaohongshu.test.mts +0 -291
- package/apps/desktop-console/src/renderer/ui-components.mts +0 -31
- package/docs/README_camoufox_chinese.md +0 -141
- package/docs/USAGE_V3.md +0 -163
- package/docs/arch/OCR_MACOS_PLUGIN.md +0 -39
- package/docs/arch/PORTS.md +0 -40
- package/docs/arch/REGRESSION_CHECKLIST.md +0 -121
- package/docs/arch/SEARCH_GATE.md +0 -224
- package/docs/arch/VIEWPORT_SAFETY.md +0 -182
- package/docs/arch/XIAOHONGSHU_OFFLINE_MOCK_DESIGN.md +0 -267
- package/docs/xiaohongshu-container-driven-summary.md +0 -221
- package/docs/xiaohongshu-full-collect-runbook.md +0 -134
- package/docs/xiaohongshu-next-steps.md +0 -228
- package/docs/xiaohongshu-quickstart.md +0 -73
- package/docs/xiaohongshu-workflow-summary.md +0 -227
- package/modules/container-registry/tests/container-registry.test.ts +0 -16
- package/modules/logging/tests/logging.test.ts +0 -38
- package/modules/operations/tests/operations.test.ts +0 -22
- package/modules/operations/tests/viewport-filter.test.ts +0 -161
- package/modules/operations/tests/visible-only.test.ts +0 -250
- package/modules/session-manager/tests/session-manager.test.ts +0 -23
- package/modules/state/src/atomic-json.test.ts +0 -30
- package/modules/state/src/paths.test.ts +0 -59
- package/modules/state/src/xiaohongshu-collect-state.test.ts +0 -259
- package/modules/workflow/blocks/AnchorVerificationBlock.d.ts.map +0 -1
- package/modules/workflow/blocks/AnchorVerificationBlock.js.map +0 -1
- package/modules/workflow/blocks/DetectPageStateBlock.d.ts.map +0 -1
- package/modules/workflow/blocks/DetectPageStateBlock.js.map +0 -1
- package/modules/workflow/blocks/ErrorRecoveryBlock.d.ts.map +0 -1
- package/modules/workflow/blocks/ErrorRecoveryBlock.js.map +0 -1
- package/modules/workflow/blocks/WaitSearchPermitBlock.d.ts.map +0 -1
- package/modules/workflow/blocks/WaitSearchPermitBlock.js.map +0 -1
- package/modules/workflow/blocks/helpers/containerAnchors.d.ts.map +0 -1
- package/modules/workflow/blocks/helpers/containerAnchors.js.map +0 -1
- package/modules/workflow/blocks/helpers/downloadPaths.test.ts +0 -62
- package/modules/workflow/blocks/helpers/mergeXhsMarkdown.test.ts +0 -121
- package/modules/workflow/blocks/helpers/operationLogger.d.ts.map +0 -1
- package/modules/workflow/blocks/helpers/operationLogger.js.map +0 -1
- package/modules/workflow/blocks/helpers/persistedNotes.test.ts +0 -268
- package/modules/workflow/blocks/helpers/searchPageState.d.ts.map +0 -1
- package/modules/workflow/blocks/helpers/searchPageState.js.map +0 -1
- package/modules/workflow/blocks/helpers/targetCountMode.test.ts +0 -29
- package/modules/workflow/blocks/helpers/xhsCliArgs.test.ts +0 -75
- package/modules/workflow/tests/smartReply.test.ts +0 -32
- package/modules/xiaohongshu/app/src/blocks/Phase3Interact.matcher.test.ts +0 -33
- package/modules/xiaohongshu/app/src/utils/__tests__/checkpoints.test.ts +0 -141
- package/modules/xiaohongshu/app/tests/commentMatchDsl.test.ts +0 -50
- package/modules/xiaohongshu/app/tests/commentMatcher.test.ts +0 -46
- package/modules/xiaohongshu/app/tests/sharding.test.ts +0 -31
- package/package-scripts.json +0 -8
- package/runtime/infra/utils/README.md +0 -13
- package/runtime/infra/utils/scripts/README.md +0 -0
- package/runtime/infra/utils/scripts/development/eval-in-session.mjs +0 -40
- package/runtime/infra/utils/scripts/development/highlight-search-containers.mjs +0 -35
- package/runtime/infra/utils/scripts/service/kill-port.mjs +0 -24
- package/runtime/infra/utils/scripts/service/start-api.mjs +0 -39
- package/runtime/infra/utils/scripts/service/start-browser-service.mjs +0 -106
- package/runtime/infra/utils/scripts/service/stop-api.mjs +0 -18
- package/runtime/infra/utils/scripts/service/stop-browser-service.mjs +0 -104
- package/runtime/infra/utils/scripts/test-services.mjs +0 -94
- package/services/shared/heartbeat.test.ts +0 -102
- package/services/unified-api/__tests__/task-state.test.ts +0 -95
- package/sitecustomize.py +0 -19
- package/tests/README.md +0 -194
- package/tests/e2e/workflows/weibo-feed-extraction.test.ts +0 -171
- package/tests/fixtures/data/container-definitions.json +0 -67
- package/tests/fixtures/pages/simple-page.html +0 -69
- package/tests/integration/01-test-container-match.mjs +0 -188
- package/tests/integration/02-test-dom-branch.mjs +0 -161
- package/tests/integration/03-test-container-operation-system.mjs +0 -91
- package/tests/integration/05-test-container-lifecycle-events.mjs +0 -224
- package/tests/integration/05-test-container-lifecycle-with-events.mjs +0 -250
- package/tests/integration/06-test-container-dom-tree-drawing.mjs +0 -256
- package/tests/integration/07-test-weibo-container-lifecycle.mjs +0 -355
- package/tests/integration/08-test-weibo-feed-workflow.test.mjs +0 -164
- package/tests/integration/10-test-visual-analyzer.mjs +0 -312
- package/tests/integration/11-test-visual-loop.mjs +0 -284
- package/tests/integration/12-test-simple-visual-loop.mjs +0 -242
- package/tests/integration/13-test-visual-robust.mjs +0 -185
- package/tests/integration/14-test-visual-highlight-loop.mjs +0 -271
- package/tests/integration/inspect-page.mjs +0 -50
- package/tests/integration/run-all-tests.mjs +0 -95
- package/tests/patch_verification/CODEX_PATCH_TEST.md +0 -103
- package/tests/patch_verification/PHASE2_ANALYSIS.md +0 -179
- package/tests/patch_verification/PHASE2_OPTIMIZATION_REPORT.md +0 -55
- package/tests/patch_verification/PHASE2_TO_PHASE4_SUMMARY.md +0 -126
- package/tests/patch_verification/QUICK_TEST_SEQUENCE.md +0 -262
- package/tests/patch_verification/README.md +0 -143
- package/tests/patch_verification/RUN_TESTS.md +0 -60
- package/tests/patch_verification/TEST_EXECUTION.md +0 -99
- package/tests/patch_verification/TEST_PLAN.md +0 -328
- package/tests/patch_verification/TEST_RESULTS.md +0 -34
- package/tests/patch_verification/TOOL_TEST_PLAN.md +0 -48
- package/tests/patch_verification/run-tool-test.mjs +0 -121
- package/tests/patch_verification/temp_test_files/test01.txt +0 -1
- package/tests/patch_verification/temp_test_files/test02.txt +0 -3
- package/tests/patch_verification/temp_test_files/test02_gnu.txt +0 -3
- package/tests/patch_verification/temp_test_files/test03.txt +0 -1
- package/tests/patch_verification/temp_test_files/test03_multiline.txt +0 -5
- package/tests/patch_verification/temp_test_files/test04_function.ts +0 -5
- package/tests/patch_verification/temp_test_files/test05_import.ts +0 -4
- package/tests/patch_verification/temp_test_files/test06_special_chars.txt +0 -4
- package/tests/patch_verification/temp_test_files/test07_indentation.ts +0 -5
- package/tests/patch_verification/temp_test_files/test08_mismatch.txt +0 -1
- package/tests/patch_verification/temp_test_files/test_add_02.txt +0 -3
- package/tests/patch_verification/temp_test_files/test_simple.txt +0 -1
- package/tests/runner/TestReporter.mjs +0 -57
- package/tests/runner/TestRunner.mjs +0 -244
- package/tests/unit/commands/profile.test.mjs +0 -10
- package/tests/unit/container/change-notifier.test.mjs +0 -181
- package/tests/unit/lifecycle/session-registry.test.mjs +0 -135
- package/tests/unit/operations/registry.test.ts +0 -73
- package/tests/unit/utils/browser-service.test.mjs +0 -153
- package/tests/unit/utils/config.test.mjs +0 -166
- package/tests/unit/utils/fingerprint.test.mjs +0 -166
- package/tsconfig.json +0 -31
- package/tsconfig.services.json +0 -26
- /package/apps/desktop-console/{src → dist}/renderer/index.html +0 -0
- /package/apps/desktop-console/{src/renderer/tabs → dist/renderer}/run.mts +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { promises as fs } from 'node:fs';
|
|
3
|
+
import { isImageFile, ocrImagesWithMacPlugin, pickMacOcrLanguages } from './macosVisionOcrPlugin.js';
|
|
4
|
+
function readLineValue(md, prefix) {
|
|
5
|
+
const re = new RegExp(`^${prefix}\\s*(.+)$`, 'm');
|
|
6
|
+
const m = md.match(re);
|
|
7
|
+
return m ? String(m[1] ?? '').trim() : null;
|
|
8
|
+
}
|
|
9
|
+
export async function organizeOneNote(options) {
|
|
10
|
+
const noteDir = options.noteDir;
|
|
11
|
+
const noteId = options.noteId;
|
|
12
|
+
const keyword = options.keyword;
|
|
13
|
+
const contentPath = path.join(noteDir, 'content.md');
|
|
14
|
+
const commentsPath = path.join(noteDir, 'comments.md');
|
|
15
|
+
const imagesDir = path.join(noteDir, 'images');
|
|
16
|
+
const ocrPath = path.join(noteDir, 'ocr.md');
|
|
17
|
+
const mergedPath = path.join(noteDir, 'merged.md');
|
|
18
|
+
const content = await fs.readFile(contentPath, 'utf-8');
|
|
19
|
+
const comments = await fs.readFile(commentsPath, 'utf-8');
|
|
20
|
+
const link = readLineValue(content, '- 链接:') || undefined;
|
|
21
|
+
let imageFiles = [];
|
|
22
|
+
try {
|
|
23
|
+
const ents = await fs.readdir(imagesDir, { withFileTypes: true });
|
|
24
|
+
imageFiles = ents
|
|
25
|
+
.filter((e) => e.isFile())
|
|
26
|
+
.map((e) => e.name)
|
|
27
|
+
.filter((n) => isImageFile(n))
|
|
28
|
+
.sort();
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
imageFiles = [];
|
|
32
|
+
}
|
|
33
|
+
const picked = pickMacOcrLanguages(options.ocrLanguages);
|
|
34
|
+
const ocrLanguagesUsed = picked.languages;
|
|
35
|
+
let ocrErrors = 0;
|
|
36
|
+
let ocrMd = null;
|
|
37
|
+
const runOcr = options.runOcr !== false;
|
|
38
|
+
if (runOcr) {
|
|
39
|
+
const absImages = imageFiles.map((img) => path.join(imagesDir, img));
|
|
40
|
+
const ocr = imageFiles.length
|
|
41
|
+
? await ocrImagesWithMacPlugin(absImages, { languages: ocrLanguagesUsed, timeoutMs: 120_000 })
|
|
42
|
+
: { languagesUsed: ocrLanguagesUsed, results: [], binPath: '' };
|
|
43
|
+
const byImage = new Map();
|
|
44
|
+
for (const r of ocr.results) {
|
|
45
|
+
byImage.set(String(r.image || '').trim(), { text: r.text, error: r.error });
|
|
46
|
+
}
|
|
47
|
+
const lines = [];
|
|
48
|
+
lines.push(`# OCR(${imageFiles.length})`);
|
|
49
|
+
lines.push('');
|
|
50
|
+
lines.push(`- Note ID: ${noteId}`);
|
|
51
|
+
lines.push(`- 关键词: ${keyword}`);
|
|
52
|
+
if (link)
|
|
53
|
+
lines.push(`- 链接: ${link}`);
|
|
54
|
+
lines.push(`- OCR 语言: ${ocrLanguagesUsed}`);
|
|
55
|
+
lines.push('');
|
|
56
|
+
if (imageFiles.length === 0) {
|
|
57
|
+
lines.push('(无图片或 images/ 目录不存在)');
|
|
58
|
+
lines.push('');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
for (const img of imageFiles) {
|
|
62
|
+
const imgPath = path.join(imagesDir, img);
|
|
63
|
+
const rel = `images/${img}`;
|
|
64
|
+
const res = byImage.get(imgPath) || {};
|
|
65
|
+
lines.push(`## ${rel}`);
|
|
66
|
+
lines.push('');
|
|
67
|
+
if (res.error) {
|
|
68
|
+
ocrErrors += 1;
|
|
69
|
+
lines.push(`> OCR 失败: ${res.error}`);
|
|
70
|
+
lines.push('');
|
|
71
|
+
}
|
|
72
|
+
const text = String(res.text || '').trim();
|
|
73
|
+
if (text) {
|
|
74
|
+
lines.push('```');
|
|
75
|
+
lines.push(text);
|
|
76
|
+
lines.push('```');
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
lines.push('(无可识别文字)');
|
|
80
|
+
}
|
|
81
|
+
lines.push('');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
ocrMd = `${lines.join('\n')}\n`;
|
|
85
|
+
await fs.writeFile(ocrPath, ocrMd, 'utf-8');
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
try {
|
|
89
|
+
ocrMd = await fs.readFile(ocrPath, 'utf-8');
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
if (options.requireExistingOcr) {
|
|
93
|
+
throw new Error(`missing ocr.md (requireExistingOcr=true): ${ocrPath}`);
|
|
94
|
+
}
|
|
95
|
+
const lines = [];
|
|
96
|
+
lines.push(`# OCR(${imageFiles.length})`);
|
|
97
|
+
lines.push('');
|
|
98
|
+
lines.push(`- Note ID: ${noteId}`);
|
|
99
|
+
lines.push(`- 关键词: ${keyword}`);
|
|
100
|
+
if (link)
|
|
101
|
+
lines.push(`- 链接: ${link}`);
|
|
102
|
+
lines.push(`- OCR 语言: ${ocrLanguagesUsed}`);
|
|
103
|
+
lines.push(`- OCR: skipped`);
|
|
104
|
+
lines.push('');
|
|
105
|
+
ocrMd = `${lines.join('\n')}\n`;
|
|
106
|
+
await fs.writeFile(ocrPath, ocrMd, 'utf-8');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const mergedLines = [];
|
|
110
|
+
mergedLines.push(`# 合并(${noteId})`);
|
|
111
|
+
mergedLines.push('');
|
|
112
|
+
mergedLines.push(`- Note ID: ${noteId}`);
|
|
113
|
+
mergedLines.push(`- 关键词: ${keyword}`);
|
|
114
|
+
if (link)
|
|
115
|
+
mergedLines.push(`- 链接: ${link}`);
|
|
116
|
+
mergedLines.push('');
|
|
117
|
+
mergedLines.push('## 正文');
|
|
118
|
+
mergedLines.push('');
|
|
119
|
+
mergedLines.push(content.trim());
|
|
120
|
+
mergedLines.push('');
|
|
121
|
+
mergedLines.push('## OCR');
|
|
122
|
+
mergedLines.push('');
|
|
123
|
+
mergedLines.push(String(ocrMd || '').trim());
|
|
124
|
+
mergedLines.push('');
|
|
125
|
+
mergedLines.push('## 评论');
|
|
126
|
+
mergedLines.push('');
|
|
127
|
+
mergedLines.push(comments.trim());
|
|
128
|
+
mergedLines.push('');
|
|
129
|
+
await fs.writeFile(mergedPath, `${mergedLines.join('\n')}\n`, 'utf-8');
|
|
130
|
+
return {
|
|
131
|
+
noteId,
|
|
132
|
+
ocrPath,
|
|
133
|
+
mergedPath,
|
|
134
|
+
imageCount: imageFiles.length,
|
|
135
|
+
ocrErrors,
|
|
136
|
+
ocrLanguagesUsed,
|
|
137
|
+
...(link ? { link } : {}),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=xhsNoteOrganizer.js.map
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RestorePhaseBlock
|
|
3
|
+
*
|
|
4
|
+
* 基于 URL + 容器匹配恢复到指定阶段(Phase 入口锚点),用于 Phase1–4 的“回归锚点”能力。
|
|
5
|
+
*
|
|
6
|
+
* 约定:
|
|
7
|
+
* - phase=1: 期望在 home/login(交给 Phase1 自己处理)
|
|
8
|
+
* - phase=2: 期望在搜索入口阶段(home 或 search_result)
|
|
9
|
+
* - phase=3: 期望在搜索结果阶段(search_result)
|
|
10
|
+
* - phase=4: 期望在详情页阶段(detail)
|
|
11
|
+
*
|
|
12
|
+
* 恢复策略(小红书):
|
|
13
|
+
* - 当前在 detail:优先使用 ErrorRecoveryBlock(ESC) 关闭模态框,回到 search_result/home
|
|
14
|
+
* - 当前在风控/未知页面:优先点击“发现页” sidebar 容器按钮(home/search.discover_button),回到首页
|
|
15
|
+
* - 当前在 login:交给上层 Phase1 处理,不在此处强行导航
|
|
16
|
+
*/
|
|
17
|
+
import { execute as detectPageState } from '../DetectPageStateBlock.js';
|
|
18
|
+
import { execute as errorRecovery } from '../ErrorRecoveryBlock.js';
|
|
19
|
+
import { logControllerActionError, logControllerActionResult, logControllerActionStart, } from '../helpers/operationLogger.js';
|
|
20
|
+
function expectedStageForPhase(phase) {
|
|
21
|
+
switch (phase) {
|
|
22
|
+
case 1:
|
|
23
|
+
return ['home', 'login', 'unknown'];
|
|
24
|
+
case 2:
|
|
25
|
+
return ['home', 'search'];
|
|
26
|
+
case 3:
|
|
27
|
+
return ['search'];
|
|
28
|
+
case 4:
|
|
29
|
+
return ['detail'];
|
|
30
|
+
default:
|
|
31
|
+
return ['unknown'];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function choosePhaseFromStage(stage) {
|
|
35
|
+
if (stage === 'detail')
|
|
36
|
+
return 4;
|
|
37
|
+
if (stage === 'search')
|
|
38
|
+
return 3;
|
|
39
|
+
if (stage === 'home')
|
|
40
|
+
return 2;
|
|
41
|
+
if (stage === 'login')
|
|
42
|
+
return 1;
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
export async function execute(input) {
|
|
46
|
+
const { sessionId, phase, serviceUrl = 'http://127.0.0.1:7701' } = input;
|
|
47
|
+
const controllerUrl = `${serviceUrl}/v1/controller/action`;
|
|
48
|
+
async function controllerAction(action, payload = {}) {
|
|
49
|
+
const opId = logControllerActionStart(action, payload, { source: 'RestorePhaseBlock' });
|
|
50
|
+
try {
|
|
51
|
+
const res = await fetch(controllerUrl, {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
headers: { 'Content-Type': 'application/json' },
|
|
54
|
+
body: JSON.stringify({ action, payload }),
|
|
55
|
+
});
|
|
56
|
+
if (!res.ok) {
|
|
57
|
+
throw new Error(`HTTP ${res.status}: ${await res.text()}`);
|
|
58
|
+
}
|
|
59
|
+
const data = await res.json();
|
|
60
|
+
const result = data.data || data;
|
|
61
|
+
logControllerActionResult(opId, action, result, { source: 'RestorePhaseBlock' });
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
logControllerActionError(opId, action, error, payload, { source: 'RestorePhaseBlock' });
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function clickDiscoverButton() {
|
|
70
|
+
const candidates = [
|
|
71
|
+
'xiaohongshu_home.discover_button',
|
|
72
|
+
'xiaohongshu_search.discover_button',
|
|
73
|
+
];
|
|
74
|
+
for (const containerId of candidates) {
|
|
75
|
+
try {
|
|
76
|
+
await controllerAction('container:operation', {
|
|
77
|
+
containerId,
|
|
78
|
+
operationId: 'click',
|
|
79
|
+
config: { useSystemMouse: true },
|
|
80
|
+
sessionId,
|
|
81
|
+
});
|
|
82
|
+
// 给页面一点时间完成导航
|
|
83
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
84
|
+
return { success: true, method: `discover:${containerId}` };
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
// 尝试下一个候选
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return { success: false };
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
// 1) 检测当前阶段(入口锚点)
|
|
94
|
+
const state = await detectPageState({
|
|
95
|
+
sessionId,
|
|
96
|
+
platform: 'xiaohongshu',
|
|
97
|
+
serviceUrl,
|
|
98
|
+
});
|
|
99
|
+
const expectedStages = expectedStageForPhase(phase);
|
|
100
|
+
if (state.success && expectedStages.includes(state.stage)) {
|
|
101
|
+
// 已经在本 Phase 允许的阶段,不做任何操作
|
|
102
|
+
return {
|
|
103
|
+
success: true,
|
|
104
|
+
restored: false,
|
|
105
|
+
finalPhase: phase,
|
|
106
|
+
finalStage: state.stage,
|
|
107
|
+
url: state.url,
|
|
108
|
+
method: 'already-at-expected-stage',
|
|
109
|
+
error: state.error,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
let currentStage = state.stage;
|
|
113
|
+
let currentUrl = state.url;
|
|
114
|
+
let method;
|
|
115
|
+
// 2) 针对不同阶段执行恢复策略
|
|
116
|
+
if (currentStage === 'detail') {
|
|
117
|
+
// 使用 ErrorRecoveryBlock 的 ESC 模式关闭详情模态框
|
|
118
|
+
const rec = await errorRecovery({
|
|
119
|
+
sessionId,
|
|
120
|
+
fromStage: 'detail',
|
|
121
|
+
targetStage: 'search',
|
|
122
|
+
serviceUrl,
|
|
123
|
+
recoveryMode: 'esc',
|
|
124
|
+
maxRetries: 2,
|
|
125
|
+
});
|
|
126
|
+
if (!rec.success) {
|
|
127
|
+
return {
|
|
128
|
+
success: false,
|
|
129
|
+
restored: false,
|
|
130
|
+
finalPhase: phase,
|
|
131
|
+
finalStage: currentStage,
|
|
132
|
+
url: rec.currentUrl || currentUrl,
|
|
133
|
+
method: rec.method,
|
|
134
|
+
error: rec.error || 'ErrorRecoveryBlock failed',
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
method = `errorRecovery:${rec.method || 'esc'}`;
|
|
138
|
+
currentUrl = rec.currentUrl || currentUrl;
|
|
139
|
+
const after = await detectPageState({
|
|
140
|
+
sessionId,
|
|
141
|
+
platform: 'xiaohongshu',
|
|
142
|
+
serviceUrl,
|
|
143
|
+
});
|
|
144
|
+
currentStage = after.stage;
|
|
145
|
+
currentUrl = after.url;
|
|
146
|
+
}
|
|
147
|
+
else if (currentStage === 'login') {
|
|
148
|
+
// 登录页交给 Phase1 处理,不在此处强行导航
|
|
149
|
+
return {
|
|
150
|
+
success: false,
|
|
151
|
+
restored: false,
|
|
152
|
+
finalPhase: 1,
|
|
153
|
+
finalStage: 'login',
|
|
154
|
+
url: state.url,
|
|
155
|
+
method: 'login-delegate-phase1',
|
|
156
|
+
error: 'Current stage is login, please run Phase1 to complete login',
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// 风控/未知/其他页面:尝试点击发现页 sidebar 容器按钮
|
|
161
|
+
const clickRes = await clickDiscoverButton();
|
|
162
|
+
if (!clickRes.success) {
|
|
163
|
+
return {
|
|
164
|
+
success: false,
|
|
165
|
+
restored: false,
|
|
166
|
+
finalPhase: phase,
|
|
167
|
+
finalStage: currentStage,
|
|
168
|
+
url: currentUrl,
|
|
169
|
+
method: 'discover-button-failed',
|
|
170
|
+
error: 'Failed to click discover button to return home',
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
method = clickRes.method;
|
|
174
|
+
const after = await detectPageState({
|
|
175
|
+
sessionId,
|
|
176
|
+
platform: 'xiaohongshu',
|
|
177
|
+
serviceUrl,
|
|
178
|
+
});
|
|
179
|
+
currentStage = after.stage;
|
|
180
|
+
currentUrl = after.url;
|
|
181
|
+
}
|
|
182
|
+
const finalPhase = choosePhaseFromStage(currentStage);
|
|
183
|
+
return {
|
|
184
|
+
success: true,
|
|
185
|
+
restored: true,
|
|
186
|
+
finalPhase,
|
|
187
|
+
finalStage: currentStage,
|
|
188
|
+
url: currentUrl,
|
|
189
|
+
method,
|
|
190
|
+
error: state.error,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
return {
|
|
195
|
+
success: false,
|
|
196
|
+
restored: false,
|
|
197
|
+
finalPhase: phase,
|
|
198
|
+
finalStage: 'unknown',
|
|
199
|
+
url: '',
|
|
200
|
+
error: error?.message || String(error),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=RestorePhaseBlock.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { xiaohongshuCollectWorkflowV2 } from '../definitions/xiaohongshu-collect-workflow-v2.js';
|
|
2
|
+
import { xiaohongshuCollectWorkflow } from '../definitions/xiaohongshu-collect-workflow.js';
|
|
3
|
+
import { xiaohongshuNoteCollectWorkflow } from '../definitions/xiaohongshu-note-collect.js';
|
|
4
|
+
import { xiaohongshuFullCollectWorkflowV3 } from '../definitions/xiaohongshu-full-collect-workflow-v3.js';
|
|
5
|
+
import { xiaohongshuPhase3CollectWorkflowV1 } from '../definitions/xiaohongshu-phase3-collect-workflow-v1.js';
|
|
6
|
+
import { xiaohongshuPhase1WorkflowV3 } from '../definitions/xiaohongshu-phase1-workflow-v3.js';
|
|
7
|
+
import { xiaohongshuPhase2LinksWorkflowV3 } from '../definitions/xiaohongshu-phase2-links-workflow-v3.js';
|
|
8
|
+
import { xiaohongshuPhase34FromLinksWorkflowV3 } from '../definitions/xiaohongshu-phase34-from-links-workflow-v3.js';
|
|
9
|
+
const registry = new Map();
|
|
10
|
+
function register(def, idOverride) {
|
|
11
|
+
const id = idOverride || def.id;
|
|
12
|
+
if (!id) {
|
|
13
|
+
throw new Error('Workflow definition missing id');
|
|
14
|
+
}
|
|
15
|
+
registry.set(id, { ...def, id });
|
|
16
|
+
}
|
|
17
|
+
// 注册已有的小红书相关 workflow 定义
|
|
18
|
+
register(xiaohongshuCollectWorkflowV2, 'xiaohongshu-collect-v2');
|
|
19
|
+
register(xiaohongshuCollectWorkflow, 'xiaohongshu-collect-v1');
|
|
20
|
+
register(xiaohongshuNoteCollectWorkflow, 'xiaohongshu-note-collect');
|
|
21
|
+
register(xiaohongshuFullCollectWorkflowV3, 'xiaohongshu-collect-full-v3');
|
|
22
|
+
register(xiaohongshuPhase3CollectWorkflowV1, 'xiaohongshu-collect-phase3-v1');
|
|
23
|
+
register(xiaohongshuPhase1WorkflowV3, 'xiaohongshu-phase1-v3');
|
|
24
|
+
register(xiaohongshuPhase2LinksWorkflowV3, 'xiaohongshu-phase2-links-v3');
|
|
25
|
+
register(xiaohongshuPhase34FromLinksWorkflowV3, 'xiaohongshu-phase34-from-links-v3');
|
|
26
|
+
export function getWorkflowDefinition(id) {
|
|
27
|
+
return registry.get(id);
|
|
28
|
+
}
|
|
29
|
+
export function listWorkflowIds() {
|
|
30
|
+
return Array.from(registry.keys());
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=workflowRegistry.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 批量采集 Workflow 定义
|
|
3
|
+
*
|
|
4
|
+
* 采集150条微博并生成 Markdown
|
|
5
|
+
*/
|
|
6
|
+
export const batchCollectWorkflow = {
|
|
7
|
+
id: 'weibo-batch-collect-150',
|
|
8
|
+
name: '微博批量采集150条',
|
|
9
|
+
config: {
|
|
10
|
+
targetCount: 150,
|
|
11
|
+
scrollDistance: 800,
|
|
12
|
+
stableWait: 10000,
|
|
13
|
+
outputPath: 'output/weibo/collect-150.md'
|
|
14
|
+
},
|
|
15
|
+
steps: [
|
|
16
|
+
{
|
|
17
|
+
blockName: 'StartBrowserService',
|
|
18
|
+
input: {
|
|
19
|
+
host: '127.0.0.1',
|
|
20
|
+
port: 7704
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
blockName: 'EnsureSession',
|
|
25
|
+
input: {
|
|
26
|
+
profileId: 'weibo_fresh',
|
|
27
|
+
url: 'https://weibo.com'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
blockName: 'InitAutoScroll',
|
|
32
|
+
input: {
|
|
33
|
+
sessionId: '$sessionId',
|
|
34
|
+
scrollDistance: 800
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
blockName: 'CollectBatch',
|
|
39
|
+
input: {
|
|
40
|
+
sessionId: '$sessionId',
|
|
41
|
+
targetCount: 150,
|
|
42
|
+
containerSelector: '[class*="Feed_retweated"]',
|
|
43
|
+
scrollDistance: 800,
|
|
44
|
+
stableWait: 10000
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
blockName: 'RenderMarkdown',
|
|
49
|
+
input: {
|
|
50
|
+
posts: '$collectedPosts',
|
|
51
|
+
template: 'default'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
blockName: 'SaveFile',
|
|
56
|
+
input: {
|
|
57
|
+
content: '$markdown',
|
|
58
|
+
path: 'output/weibo/collect-150.md'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=batch-collect-workflow.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 完整滚动+提取测试 Workflow 定义
|
|
3
|
+
*
|
|
4
|
+
* 组合 blocks 实现端到端数据采集
|
|
5
|
+
*/
|
|
6
|
+
export const scrollExtractWorkflow = {
|
|
7
|
+
id: 'weibo-scroll-extract',
|
|
8
|
+
name: '微博滚动+提取完整流程',
|
|
9
|
+
steps: [
|
|
10
|
+
{
|
|
11
|
+
blockName: 'StartBrowserService',
|
|
12
|
+
input: {
|
|
13
|
+
host: '127.0.0.1',
|
|
14
|
+
port: 7704,
|
|
15
|
+
wsPort: 8765
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
blockName: 'EnsureSession',
|
|
20
|
+
input: {
|
|
21
|
+
profileId: 'weibo_fresh',
|
|
22
|
+
url: 'https://weibo.com',
|
|
23
|
+
serviceUrl: 'http://127.0.0.1:7704'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
blockName: 'InitAutoScroll',
|
|
28
|
+
input: {
|
|
29
|
+
sessionId: '$sessionId',
|
|
30
|
+
scrollStrategy: 'smooth',
|
|
31
|
+
scrollDistance: 800
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
blockName: 'ScrollNextBatch',
|
|
36
|
+
input: {
|
|
37
|
+
sessionId: '$sessionId',
|
|
38
|
+
distance: 800,
|
|
39
|
+
behavior: 'smooth'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
blockName: 'WaitStable',
|
|
44
|
+
input: {
|
|
45
|
+
sessionId: '$sessionId',
|
|
46
|
+
checkInterval: 500,
|
|
47
|
+
maxWait: 10000
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
blockName: 'MatchContainers',
|
|
52
|
+
input: {
|
|
53
|
+
sessionId: '$sessionId',
|
|
54
|
+
rootSelector: 'body'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
blockName: 'ExtractPostFields',
|
|
59
|
+
input: {
|
|
60
|
+
sessionId: '$sessionId',
|
|
61
|
+
containerSelector: '[class*="Feed_retweeted"]',
|
|
62
|
+
index: 0
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
blockName: 'ValidateExtract',
|
|
67
|
+
input: {
|
|
68
|
+
fields: '$fields',
|
|
69
|
+
requiredFields: ['author', 'content']
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=scroll-extract-workflow.js.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 小红书关键词采集 Workflow v2(容器驱动版)
|
|
3
|
+
*
|
|
4
|
+
* 新增:
|
|
5
|
+
* - WaitSearchPermitBlock:在执行搜索前先向 SearchGate 申请许可
|
|
6
|
+
*/
|
|
7
|
+
export const xiaohongshuCollectWorkflowV2 = {
|
|
8
|
+
id: 'xiaohongshu-collect-v2',
|
|
9
|
+
name: '小红书关键词采集(容器驱动版)',
|
|
10
|
+
steps: [
|
|
11
|
+
{
|
|
12
|
+
blockName: 'EnsureSession',
|
|
13
|
+
input: {
|
|
14
|
+
profileId: '$sessionId',
|
|
15
|
+
url: 'https://www.xiaohongshu.com'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
blockName: 'EnsureLoginBlock',
|
|
20
|
+
input: {
|
|
21
|
+
sessionId: '$sessionId',
|
|
22
|
+
maxWaitMs: 180000,
|
|
23
|
+
checkIntervalMs: 5000
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
blockName: 'WaitSearchPermitBlock',
|
|
28
|
+
input: {
|
|
29
|
+
sessionId: '$sessionId',
|
|
30
|
+
keyword: '$keyword',
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
blockName: 'GoToSearchBlock',
|
|
35
|
+
input: {
|
|
36
|
+
sessionId: '$sessionId',
|
|
37
|
+
keyword: '$keyword'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
blockName: 'CollectSearchListBlock',
|
|
42
|
+
input: {
|
|
43
|
+
sessionId: '$sessionId',
|
|
44
|
+
targetCount: '$targetCount'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
blockName: 'OpenDetailBlock',
|
|
49
|
+
input: {
|
|
50
|
+
sessionId: '$sessionId',
|
|
51
|
+
containerId: '$firstItemContainerId'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
blockName: 'ExtractDetailBlock',
|
|
56
|
+
input: {
|
|
57
|
+
sessionId: '$sessionId'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
blockName: 'WarmupCommentsBlock',
|
|
62
|
+
input: {
|
|
63
|
+
sessionId: '$sessionId',
|
|
64
|
+
maxRounds: 8
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
blockName: 'ExpandCommentsBlock',
|
|
69
|
+
input: {
|
|
70
|
+
sessionId: '$sessionId'
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
blockName: 'CloseDetailBlock',
|
|
75
|
+
input: {
|
|
76
|
+
sessionId: '$sessionId'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=xiaohongshu-collect-workflow-v2.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 小红书采集 Workflow 定义
|
|
3
|
+
*/
|
|
4
|
+
export const xiaohongshuCollectWorkflow = {
|
|
5
|
+
id: 'xiaohongshu-collect',
|
|
6
|
+
name: '小红书关键词采集(已迁移到 v3 安全链路)',
|
|
7
|
+
steps: [
|
|
8
|
+
{
|
|
9
|
+
blockName: 'StartBrowserService',
|
|
10
|
+
input: {
|
|
11
|
+
host: '127.0.0.1',
|
|
12
|
+
port: 7704
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
blockName: 'EnsureSession',
|
|
17
|
+
input: {
|
|
18
|
+
profileId: '$sessionId',
|
|
19
|
+
url: 'https://www.xiaohongshu.com'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
blockName: 'EnsureLoginBlock',
|
|
24
|
+
input: {
|
|
25
|
+
sessionId: '$sessionId',
|
|
26
|
+
maxWaitMs: 180000,
|
|
27
|
+
checkIntervalMs: 5000,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
blockName: 'WaitSearchPermitBlock',
|
|
32
|
+
input: {
|
|
33
|
+
sessionId: '$sessionId',
|
|
34
|
+
keyword: '$keyword',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
blockName: 'GoToSearchBlock',
|
|
39
|
+
input: {
|
|
40
|
+
sessionId: '$sessionId',
|
|
41
|
+
keyword: '$keyword',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
blockName: 'XiaohongshuFullCollectBlock',
|
|
46
|
+
input: {
|
|
47
|
+
sessionId: '$sessionId',
|
|
48
|
+
keyword: '$keyword',
|
|
49
|
+
env: '$env',
|
|
50
|
+
targetCount: '$targetCount',
|
|
51
|
+
maxWarmupRounds: '$maxWarmupRounds',
|
|
52
|
+
allowClickCommentButton: '$allowClickCommentButton',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=xiaohongshu-collect-workflow.js.map
|