@open-dy/interest-card-cli 0.0.0-stage → 0.1.0-beta.27
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/LICENSE +1 -0
- package/README.md +31 -2
- package/THIRD_PARTY_NOTICES.json +307 -0
- package/browser-runtime/scripts/build-preview-message.mjs +193 -0
- package/browser-runtime/scripts/capture-feed-card.sh +507 -0
- package/browser-runtime/scripts/cdp-client.mjs +275 -0
- package/browser-runtime/scripts/cli-input.mjs +109 -0
- package/browser-runtime/scripts/cli.mjs +970 -0
- package/browser-runtime/scripts/close-session.mjs +82 -0
- package/browser-runtime/scripts/ensure-webgl.mjs +388 -0
- package/browser-runtime/scripts/inspect-preview-state.mjs +529 -0
- package/browser-runtime/scripts/observe-preview-network.mjs +210 -0
- package/browser-runtime/scripts/prepare-agent-browser.sh +135 -0
- package/browser-runtime/scripts/preview-console-collector.mjs +158 -0
- package/browser-runtime/scripts/preview-console-trace.mjs +291 -0
- package/browser-runtime/scripts/preview-console.mjs +174 -0
- package/browser-runtime/scripts/preview-document.mjs +96 -0
- package/browser-runtime/scripts/preview-frame-action.mjs +849 -0
- package/browser-runtime/scripts/preview-frame-map.mjs +251 -0
- package/browser-runtime/scripts/preview-session.mjs +459 -0
- package/browser-runtime/scripts/probe-browser-health.mjs +139 -0
- package/browser-runtime/scripts/resume-check.mjs +170 -0
- package/browser-runtime/scripts/run-browser-command.mjs +62 -0
- package/browser-runtime/scripts/wait-dev-status.mjs +149 -0
- package/card-skills/douyin-interest-card-browser/.interest-card-cli.json +3 -0
- package/card-skills/douyin-interest-card-browser/SKILL.md +48 -0
- package/card-skills/douyin-interest-card-browser/references/commands.md +123 -0
- package/card-skills/douyin-interest-card-capability/.interest-card-cli.json +3 -0
- package/card-skills/douyin-interest-card-capability/.skillignore +2 -0
- package/card-skills/douyin-interest-card-capability/SKILL.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/common/openapi/external/guide.md +421 -0
- package/card-skills/douyin-interest-card-capability/references/common/openapi/guide.md +11 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/add-calendar-event.md +104 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/add-to-ec-cart.md +84 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/apply-ec-coupon.md +84 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/apply-refund.md +77 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/array-buffer-to-base64.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-canplay.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-ended.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-error.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-next.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-pause.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-play.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-prev.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-seeked.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-seeking.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-stop.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-time-update.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-off-waiting.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-canplay.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-ended.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-error.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-next.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-pause.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-play.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-prev.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-seeked.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-seeking.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-stop.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-time-update.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-on-waiting.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-pause.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-play.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-seek.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/background-audio-manager-stop.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/base64-to-array-buffer.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/batch-add-to-ec-cart.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/bytenn-engine-context-load.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/camera-context-on-camera-frame.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/camera-context-set-zoom.md +91 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/camera-context-start-record.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/camera-context-stop-record.md +101 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/camera-context-take-photo.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/camera-frame-listener-start.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/camera-frame-listener-stop.md +87 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/can-iput-stuff-over-component.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/can-iuse-video-format.md +94 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/can-iuse.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/can-rate-aweme-orders.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-arc.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-begin-path.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-bezier-curve-to.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-clear-rect.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-clip.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-close-path.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-create-linear-gradient.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-draw-image.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-draw.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-fill-rect.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-fill-text.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-fill.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-line-to.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-measure-text.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-move-to.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-quadratic-curve-to.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-rect.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-restore.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-rotate.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-save.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-scale.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-fill-style.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-font-size.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-global-alpha.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-line-cap.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-line-dash.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-line-join.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-line-width.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-miter-limit.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-stroke-style.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-text-align.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-text-baseline.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-set-transform.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-stroke-rect.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-stroke.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-transform.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/canvas-context-translate.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/capability-index.json +454 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/check-follow-aweme-state.md +93 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/check-follow-state.md +89 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/check-session.md +88 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/check-shop-member.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/choose-address.md +98 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/choose-image.md +106 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/choose-location.md +100 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/choose-media.md +114 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/choose-video.md +110 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/clear-storage-sync.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/clear-storage.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/compress-image.md +100 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/confirm.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/connect-socket.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/continue-to-pay.md +82 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-animation.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-bytenn-engine-context.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-camera-context.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-canvas-context.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-effect-camera-stream.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-inner-audio-context.md +67 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-intersection-observer.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-interstitial-ad.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-live-player-context.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-map-context.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-media-recorder.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-offscreen-canvas.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-order.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-rewarded-video-ad.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-rtc-room-context.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-scene-activity-context.md +81 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-selector-query.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-sticker-manager.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/create-video-context.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/delete-calendar-event.md +100 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/disable-alert-before-unload.md +83 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/disable-user-screen-record.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/download-file.md +137 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/download-task-abort.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/download-task-off-progress-update.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/download-task-on-progress-update.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-dispose.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-off-error.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-off-play.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-off-request.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-off-stop.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-on-error.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-on-play.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-on-request.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-on-stop.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-paint-to.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-play.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-request.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/effect-camera-stream-stop.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/enable-alert-before-unload.md +93 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/enable-user-screen-record.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/exit-mini-program.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-access-sync.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-access.md +94 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-append-file-sync.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-append-file.md +101 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-copy-file-sync.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-copy-file.md +100 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-get-file-info.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-get-saved-file-list.md +93 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-mkdir-sync.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-mkdir.md +100 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-read-file-sync.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-read-file.md +107 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-readdir-sync.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-readdir.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-remove-saved-file.md +95 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-rename-sync.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-rename.md +98 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-rmdir-sync.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-rmdir.md +98 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-save-file-sync.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-save-file.md +102 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-stat-sync.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-stat.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-truncate-sync.md +65 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-truncate.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-unlink-sync.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-unlink.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-unzip.md +100 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-write-file-sync.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/file-system-manager-write-file.md +102 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/follow-aweme-user.md +102 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/follow-official-account.md +89 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-algorithm-manager.md +84 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-analysis-info.md +105 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-background-audio-manager.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-clipboard-data.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-connected-wifi.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-custom-button-bounding-client-rect.md +76 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-device-info-sync.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-enter-options-sync.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-env-info-sync.md +67 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-ext-config-sync.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-ext-config.md +84 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-file-info.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-file-system-manager.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-image-info.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-launch-options-sync.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-location.md +82 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-menu-button-bounding-client-rect.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-network-type.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-order-payment.md +108 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-privacy-setting.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-random-values.md +90 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-recorder-manager.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-saved-file-list.md +87 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-screen-brightness.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-setting.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-sidebar-activity.md +87 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-storage-info-sync.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-storage-info.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-storage-sync.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-storage.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-system-info-sync.md +78 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-system-info.md +105 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-update-manager.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-user-profile.md +112 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/get-wifi-list.md +95 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/hide-home-button.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/hide-keyboard.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/hide-loading.md +88 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/hide-navigation-bar-loading.md +87 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/hide-share-menu.md +80 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/hide-tab-bar-red-dot.md +89 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/hide-tab-bar.md +89 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/hide-toast.md +88 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-destroy.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-canplay.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-ended.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-error.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-pause.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-play.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-seeked.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-seeking.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-stop.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-time-update.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-off-waiting.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-canplay.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-ended.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-error.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-pause.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-play.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-seeked.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-seeking.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-stop.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-time-update.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-on-waiting.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-pause.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-play.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-seek.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/inner-audio-context-stop.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/intersection-observer-disconnect.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/intersection-observer-observe.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/intersection-observer-relative-to-viewport.md +67 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/intersection-observer-relative-to.md +67 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/interstitial-ad-destroy.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/interstitial-ad-load.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/interstitial-ad-off-load.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/interstitial-ad-on-load.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/interstitial-ad-show.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-exit-full-screen.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-mute.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-pause.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-play.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-request-full-screen.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-resume.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-set-water-mark.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-stop.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/live-player-context-unmute.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/login.md +97 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/make-phone-call.md +98 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-destroy.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-on-error.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-on-start.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-on-stop.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-pause.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-request-frame.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-resume.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-start.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/media-recorder-stop.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/navigate-back-mini-program.md +90 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/navigate-back.md +84 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/navigate-to-mini-program.md +103 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/navigate-to-scene.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/navigate-to.md +91 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/nodes-ref-bounding-client-rect.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/nodes-ref-fields.md +73 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/nodes-ref-node.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/nodes-ref-scroll-offset.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-accelerometer-change.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-app-hide.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-app-show.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-compass-change.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-error.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-get-wifi-list.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-gyroscope-change.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-lazy-load-error.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-location-change-error.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-location-change.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-network-status-change.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-unhandled-rejection.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-user-capture-screen.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-user-screen-record.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/off-window-resize.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-accelerometer-change.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-app-hide.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-app-launch.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-app-show.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-compass-change.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-error.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-get-wifi-list.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-gyroscope-change.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-lazy-load-error.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-location-change-error.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-location-change.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-memory-warning.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-need-privacy-authorization.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-network-status-change.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-unhandled-rejection.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-user-capture-screen.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-user-screen-record.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/on-window-resize.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-document.md +101 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-douyin-order-list.md +78 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-ec-cart.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-ec-good.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-ec-im.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-ec-order-detail.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-ec-order.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-ec-shop-custom.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-ec-shop.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-location.md +107 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-privacy-contract.md +83 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-setting.md +90 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/open-webcast-room.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/page-scroll-to.md +101 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/pay.md +76 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/preload-video-task-abort.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/preload-video.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/prerender-video.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/preview-image.md +101 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/rate-aweme-order.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/re-launch.md +100 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-off-error.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-off-frame-recorded.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-off-pause.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-off-resume.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-off-start.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-off-stop.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-on-error.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-on-frame-recorded.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-on-pause.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-on-resume.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-on-start.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-on-stop.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-pause.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-resume.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-start.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/recorder-manager-stop.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/redirect-to.md +101 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/remove-saved-file.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/remove-storage-sync.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/remove-storage.md +88 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/remove-tab-bar-badge.md +90 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/report-analytics.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/request-order.md +113 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/request-subscribe-message.md +110 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/request-task-abort.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/request.md +132 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/rewarded-video-ad-load.md +65 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/rewarded-video-ad-off-close.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/rewarded-video-ad-off-error.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/rewarded-video-ad-off-load.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/rewarded-video-ad-on-close.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/rewarded-video-ad-on-error.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/rewarded-video-ad-on-load.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/save-file.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/save-image-to-photos-album.md +97 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/save-video-to-photos-album.md +101 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/scan-code.md +94 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/selector-query-exec.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/selector-query-in.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/selector-query-select-all.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/selector-query-select-viewport.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/selector-query-select.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/send-sms.md +91 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-clipboard-data.md +94 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-keep-screen-on.md +88 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-navigation-bar-color.md +95 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-navigation-bar-title.md +90 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-page-info.md +79 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-screen-brightness.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-storage-sync.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-storage.md +98 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-swipe-back-mode.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-tab-bar-badge.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-tab-bar-item.md +98 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/set-tab-bar-style.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-action-sheet.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-douyin-open-auth.md +144 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-favorite-guide.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-interaction-bar.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-loading.md +91 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-modal.md +113 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-navigation-bar-loading.md +87 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-share-menu.md +80 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-tab-bar-red-dot.md +89 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-tab-bar.md +89 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/show-toast.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/sign.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/socket-task-close.md +99 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/socket-task-on-close.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/socket-task-on-error.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/socket-task-on-message.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/socket-task-on-open.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/socket-task-send.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/start-accelerometer.md +88 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/start-compass.md +87 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/start-facial-recognition-verify.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/start-gyroscope.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/start-location-update.md +95 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/start-pull-down-refresh.md +83 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/stat-is-directory.md +54 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/stat-is-file.md +54 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/sticker-manager-load.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/sticker-processor-paint-to-texture.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/stop-accelerometer.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/stop-compass.md +83 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/stop-gyroscope.md +83 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/stop-location-update.md +89 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/stop-pull-down-refresh.md +87 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/subscribe-audiences-follow-action.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/subscribe-specified-content-comment.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/subscribe-specified-user-comment.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/switch-tab.md +91 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/unsubscribe-all-specified-content-comment.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/unsubscribe-all-specified-user-comment.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/unsubscribe-audiences-follow-action.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/update-manager-apply-update.md +89 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/update-manager-on-check-for-update.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/update-manager-on-update-failed.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/update-manager-on-update-ready.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/update-sidebar-activity.md +94 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/upload-file.md +137 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/upload-task-abort.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/upload-task-off-progress-update.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/upload-task-on-progress-update.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/vibrate-long.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/vibrate-short.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-exit-full-screen.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-get-media-volume.md +87 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-pause.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-play.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-playback-rate.md +65 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-request-full-screen.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-seek.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-set-media-volume.md +90 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-set-water-mark.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/api/video-context-stop.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/ad.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/aweme-data.md +53 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/aweme-user-card.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-add-calendar-event.md +80 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-add-shortcut.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-authorize-private-message.md +81 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-get-user-total-info.md +78 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-join-group.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-navigate-to-video-view.md +77 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-open-aweme-user-profile.md +77 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-open-webcast-room.md +73 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-platform-im.md +67 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-private-message.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button-share.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/button.md +44 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/camera.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/canvas.md +48 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/capability-index.json +60 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/checkbox-group.md +40 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/checkbox.md +41 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/consume-card.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/diamond-balance.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/form.md +43 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/icon.md +38 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/image.md +48 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/input.md +65 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/label.md +38 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/live-player.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/live-preview.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/map.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/mask.md +37 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/member-button.md +37 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/movable-area.md +38 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/movable-view.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/navigator.md +48 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/open-data.md +52 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/pay-button.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/picker-view-column.md +36 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/picker-view.md +47 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/picker.md +47 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/progress.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/radio-group.md +40 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/radio.md +41 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/rate-button.md +47 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/rich-text.md +43 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/rtc-room.md +46 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/scroll-view.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/slider.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/swiper-item.md +40 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/swiper.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/switch.md +47 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/text.md +40 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/textarea.md +73 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/video.md +127 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/view.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/component/web-view.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/flow-index.json +94 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/capability-index.json +2237 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/censor-image.md +84 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/censor-text.md +77 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/check-fans.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/create-activity.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-affiliate-id.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-aiuser-data-info.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-aiuser-item-list.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-aiuser-profile.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-fans-favourite.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-fans-profile.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-fans-source.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-feed.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-follow-feed.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-follow-hot-word.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-friend-list.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-hot-list.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-music-collection-list.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-recommend.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-related-id.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-room-real-time-data.md +82 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-basic-data.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-cert-labels-info.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-comment-data.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-constellation.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-fans-data.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-fans-profile.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-following.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-hash-mobile.md +79 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-interest.md +69 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-item-data.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-like-data.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-profile-data.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-user-share-data.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/get-video-pack.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/modify-activity.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/query-activity-info.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/query-activity-user-completion-status.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/query-room-data.md +82 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/search-experience.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/search-general.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/search-live.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/search-music.md +95 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/search-user.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/search-video.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/openapi/external/search-vision.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/canvas-init.md +15 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/facial-recognition.md +15 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/image-recognition.md +16 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/location-map.md +13 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/scene-activity.md +15 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/search-video-navigation.md +17 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/sidebar-navigation.md +15 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/user-openapi-auth.md +28 -0
- package/card-skills/douyin-interest-card-capability/references/microapp/recipes/video-prerender.md +14 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/array-buffer-to-base64.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/base64-to-array-buffer.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/call-container.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/can-iuse.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/capability-index.json +50 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/check-session.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/choose-image.md +103 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/choose-media.md +111 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/choose-video.md +107 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/clear-storage-sync.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/clear-storage.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/create-channel-video-context.md +66 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/create-cloud.md +61 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/create-event-source.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/create-inner-audio-context.md +57 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/create-map-context.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/create-selector-query.md +54 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/create-video-context.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/download-file.md +130 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-background-audio-manager.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-device-info-sync.md +65 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-enter-options-sync.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-env-info-sync.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-image-info.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-launch-options-sync.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-location.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-setting.md +54 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-storage-info-sync.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-storage-info.md +72 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-storage-sync.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-storage.md +77 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-system-info-sync.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/get-system-info.md +90 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/login.md +84 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/navigate-to-mini-program.md +135 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/open-schema.md +75 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/preload-channel-video.md +59 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/preview-image.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/remove-storage-sync.md +60 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/remove-storage.md +73 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/request.md +138 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/save-image-to-photos-album.md +92 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/save-video-to-photos-album.md +96 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/set-storage-sync.md +64 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/set-storage.md +85 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/api/upload-file.md +129 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/closed-domain-openapi.md +43 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/button.md +95 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/canvas.md +68 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/capability-index.json +28 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/channel-video.md +100 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/checkbox-group.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/checkbox.md +51 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/form.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/icon.md +50 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/image.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/input.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/label.md +48 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/map.md +91 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/progress.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/radio-group.md +62 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/radio.md +51 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/slider.md +77 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/svg.md +58 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/swiper-item.md +56 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/swiper.md +79 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/switch.md +63 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/text.md +49 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/textarea.md +91 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/video.md +104 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component/view.md +55 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/component-guide.md +27 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/flow-index.json +44 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/capability-index.json +2156 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/censor-image.md +86 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/censor-text.md +79 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/check-fans.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/create-activity.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-affiliate-id.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-aiuser-data-info.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-aiuser-item-list.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-aiuser-profile.md +77 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-fans-favourite.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-fans-profile.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-fans-source.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-feed.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-follow-feed.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-follow-hot-word.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-friend-list.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-hot-list.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-music-collection-list.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-recommend.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-related-id.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-room-real-time-data.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-basic-data.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-cert-labels-info.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-comment-data.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-constellation.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-fans-data.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-fans-profile.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-following.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-hash-mobile.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-interest.md +71 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-item-data.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-like-data.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-profile-data.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-user-share-data.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/get-video-pack.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/modify-activity.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/query-activity-info.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/query-activity-user-completion-status.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/query-room-data.md +30 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/search-experience.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/search-general.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/search-live.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/search-music.md +97 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/search-user.md +70 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/search-video.md +98 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/openapi/search-vision.md +74 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/recipes/canvas-init.md +15 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/recipes/channel-video-control.md +16 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/recipes/location-map.md +15 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/recipes/search-video-navigation.md +15 -0
- package/card-skills/douyin-interest-card-capability/references/opencard/runtime.md +203 -0
- package/card-skills/douyin-interest-card-capability/scripts/search-capabilities.mjs +365 -0
- package/card-skills/douyin-interest-card-cli/.interest-card-cli.json +3 -0
- package/card-skills/douyin-interest-card-cli/SKILL.md +294 -0
- package/card-skills/douyin-interest-card-cli/references/basic-info.md +54 -0
- package/card-skills/douyin-interest-card-cli/references/card-background.md +55 -0
- package/card-skills/douyin-interest-card-cli/references/transparent-assets.md +33 -0
- package/card-skills/douyin-interest-card-cli/scripts/chroma_key.py +209 -0
- package/card-skills/douyin-interest-card-design/.interest-card-cli.json +3 -0
- package/card-skills/douyin-interest-card-design/SKILL.md +56 -0
- package/card-skills/douyin-interest-card-design/assets/component/button/example.css +227 -0
- package/card-skills/douyin-interest-card-design/assets/component/button/example.tsx +85 -0
- package/card-skills/douyin-interest-card-design/assets/component/comparison/example.css +90 -0
- package/card-skills/douyin-interest-card-design/assets/component/comparison/example.tsx +24 -0
- package/card-skills/douyin-interest-card-design/assets/component/content-list/example.css +152 -0
- package/card-skills/douyin-interest-card-design/assets/component/content-list/example.tsx +55 -0
- package/card-skills/douyin-interest-card-design/assets/component/metrics/example.css +176 -0
- package/card-skills/douyin-interest-card-design/assets/component/metrics/example.tsx +47 -0
- package/card-skills/douyin-interest-card-design/assets/component/place-list/example.css +232 -0
- package/card-skills/douyin-interest-card-design/assets/component/place-list/example.tsx +83 -0
- package/card-skills/douyin-interest-card-design/assets/component/product-list/example.css +249 -0
- package/card-skills/douyin-interest-card-design/assets/component/product-list/example.tsx +83 -0
- package/card-skills/douyin-interest-card-design/assets/component/tab-bar/example.css +185 -0
- package/card-skills/douyin-interest-card-design/assets/component/tab-bar/example.tsx +87 -0
- package/card-skills/douyin-interest-card-design/assets/component/tag/example.css +150 -0
- package/card-skills/douyin-interest-card-design/assets/component/tag/example.tsx +62 -0
- package/card-skills/douyin-interest-card-design/assets/component/timeline/example.css +114 -0
- package/card-skills/douyin-interest-card-design/assets/component/timeline/example.tsx +20 -0
- package/card-skills/douyin-interest-card-design/assets/component/vote/example.css +173 -0
- package/card-skills/douyin-interest-card-design/assets/component/vote/example.tsx +33 -0
- package/card-skills/douyin-interest-card-design/assets/icon/AI_filled.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/arrowdown_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/arrowleft_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/arrowright_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/arrowup_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/bell_filled.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/bell_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/book_filled.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/book_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/comment_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/doc_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/doc_outlined.svg +5 -0
- package/card-skills/douyin-interest-card-design/assets/icon/eye_outlined.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/fire_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/fire_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/headphone_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/image_filled.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/image_outlined.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/label_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/label_outlined.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/like_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/like_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/lineararrow_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/message_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/message_outlined.svg +8 -0
- package/card-skills/douyin-interest-card-design/assets/icon/microphone_filled.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/microphone_outlined.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/play_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/play_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/plus_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/pluscircle_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/pulscircle_outlined.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/questioncircle_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/questioncircle_outlined.svg +5 -0
- package/card-skills/douyin-interest-card-design/assets/icon/satr_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/search_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/search_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/shoppingcart_filled.svg +5 -0
- package/card-skills/douyin-interest-card-design/assets/icon/shoppingcart_outlined.svg +5 -0
- package/card-skills/douyin-interest-card-design/assets/icon/star_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/store_filled.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/store_outlined.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/thumbsdown_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/thumbsdown_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/thumbsup_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/thumbsup_outlined.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/tv_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/tv_outlined.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/user_filled.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/user_outlined.svg +4 -0
- package/card-skills/douyin-interest-card-design/assets/icon/warningcircle_filled.svg +3 -0
- package/card-skills/douyin-interest-card-design/assets/icon/warningcircle_outlined.svg +5 -0
- package/card-skills/douyin-interest-card-design/assets/layout/random-flip-decision/example.css +698 -0
- package/card-skills/douyin-interest-card-design/assets/layout/random-flip-decision/example.tsx +491 -0
- package/card-skills/douyin-interest-card-design/assets/layout/tarot-spread/example.css +708 -0
- package/card-skills/douyin-interest-card-design/assets/layout/tarot-spread/example.tsx +302 -0
- package/card-skills/douyin-interest-card-design/assets/layout/tarot-spread/tarot-card-back-light.png +0 -0
- package/card-skills/douyin-interest-card-design/assets/layout/tarot-spread/tarot-card-back.png +0 -0
- package/card-skills/douyin-interest-card-design/assets/layout/test-illustrated/example.css +476 -0
- package/card-skills/douyin-interest-card-design/assets/layout/test-illustrated/example.tsx +181 -0
- package/card-skills/douyin-interest-card-design/assets/layout/test-image/example.css +439 -0
- package/card-skills/douyin-interest-card-design/assets/layout/test-image/example.tsx +175 -0
- package/card-skills/douyin-interest-card-design/assets/layout/trend/example.css +81 -0
- package/card-skills/douyin-interest-card-design/assets/layout/trend/example.tsx +22 -0
- package/card-skills/douyin-interest-card-design/assets/layout/vote-comparison/example.css +149 -0
- package/card-skills/douyin-interest-card-design/assets/layout/vote-comparison/example.tsx +44 -0
- package/card-skills/douyin-interest-card-design/assets/shared/widget-shell.css +90 -0
- package/card-skills/douyin-interest-card-design/references/component.md +95 -0
- package/card-skills/douyin-interest-card-design/references/layout.md +168 -0
- package/card-skills/douyin-interest-card-design/references/system.md +170 -0
- package/card-skills/douyin-interest-card-design/references/widget.md +142 -0
- package/card-skills/douyin-interest-card-design/scripts/convert-card-background-to-9x16.py +594 -0
- package/card-skills/douyin-interest-card-design/scripts/package.sh +47 -0
- package/card-skills/douyin-interest-card-generate/.interest-card-cli.json +3 -0
- package/card-skills/douyin-interest-card-generate/SKILL.md +250 -0
- package/card-skills/douyin-interest-card-generate/init.sh +199 -0
- package/card-skills/douyin-interest-card-generate/references/common/business-experience.md +73 -0
- package/card-skills/douyin-interest-card-generate/references/common/canvas-2d.md +550 -0
- package/card-skills/douyin-interest-card-generate/references/common/canvas-3d.md +416 -0
- package/card-skills/douyin-interest-card-generate/references/common/card-data-model.md +191 -0
- package/card-skills/douyin-interest-card-generate/references/common/code-quality/async-outcome.md +70 -0
- package/card-skills/douyin-interest-card-generate/references/common/code-quality.md +40 -0
- package/card-skills/douyin-interest-card-generate/references/common/database_specification.md +232 -0
- package/card-skills/douyin-interest-card-generate/references/common/fullstack.md +624 -0
- package/card-skills/douyin-interest-card-generate/references/common/interest-card-cover.md +7 -0
- package/card-skills/douyin-interest-card-generate/references/common/legacy-project-compatibility.md +180 -0
- package/card-skills/douyin-interest-card-generate/references/common/post-card-differences.md +93 -0
- package/card-skills/douyin-interest-card-generate/references/common/privacy-service-consent.md +7 -0
- package/card-skills/douyin-interest-card-generate/references/common/private-data-intent-routing.md +158 -0
- package/card-skills/douyin-interest-card-generate/references/common/runtime-environments.md +14 -0
- package/card-skills/douyin-interest-card-generate/references/common/upgrade-to-post.md +63 -0
- package/card-skills/douyin-interest-card-generate/references/microapp/audit-compliance.md +96 -0
- package/card-skills/douyin-interest-card-generate/references/microapp/microapp.md +782 -0
- package/card-skills/douyin-interest-card-generate/references/microapp/miniapp-open-card.md +138 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/api.md +408 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/bgm-catalog.json +244 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/bgm-pe.md +300 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/closed-domain-card.md +70 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/components.md +187 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/coordinates.md +51 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/feed-card-shell.md +44 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/opencard.md +269 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/rendering.md +1136 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/state-sync.md +139 -0
- package/card-skills/douyin-interest-card-generate/references/opencard/taro-dsl.md +220 -0
- package/card-skills/douyin-interest-card-generate/scripts/install-opencard.sh +346 -0
- package/card-skills/douyin-interest-card-generate/scripts/verify-card-render-engine.cjs +42 -0
- package/card-skills/douyin-interest-card-generate/scripts/verify-card-render-scheduler.cjs +64 -0
- package/card-skills/douyin-interest-card-generate/scripts/verify-fingertip-page.cjs +76 -0
- package/card-skills/douyin-interest-card-generate/sdk-docs/README.md +10 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/babel.config.js +11 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/card-data/types.ts +41 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/config/index.ts +17 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/eslint.config.mjs +12 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/package.json +37 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/pnpm-lock.yaml +8338 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/project.card.json +9 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/project.tt.json +9 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/server-src/card-data/card-data.controller.ts +21 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/server-src/card-data/card-data.module.ts +10 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/server-src/card-data/card-data.mutation.example.ts +19 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/server-src/card-data/card-data.service.ts +54 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/server-src/card-data/card-data.types.ts +37 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/app.config.ts +14 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/app.css +34 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/empty.png +0 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/index.html +54 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/network.ts +14 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/pages/index/index.config.ts +3 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/pages/index/index.css +89 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/pages/index/index.tsx +80 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/src/services/card-data.ts +114 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/tsconfig.json +28 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/turbo.json +39 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/types/douyin-open-capabilities.d.ts +32 -0
- package/card-skills/douyin-interest-card-generate/templates/fragments/opencard/types/global.d.ts +1 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/.editorconfig +12 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/babel.config.js +11 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/Dockerfile +15 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/nest-cli.json +8 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/package.json +26 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/run.sh +9 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/scripts/extract-routes.js +29 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/app.module.ts +12 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/health.controller.ts +9 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/lib/closed-domain-readonly-db.ts +29 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/lib/closed-domain-runtime.ts +3 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/lib/preview-read-only-mysql.ts +86 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/lib/read-only-mysql-proxy.ts +143 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/lib/read-only-sql.ts +382 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/logger.middleware.ts +33 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/src/main.ts +15 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/tsconfig.build.json +4 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/closed-domain-server/tsconfig.json +22 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/config/card-routing.json +10 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/config/index.ts +17 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/eslint.config.mjs +3 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/feed/custom-card-schema.json +108 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/package.json +117 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/patches/@weapp-tailwindcss__postcss@2.1.7.patch +13 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/pnpm-lock.yaml +15199 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/pnpm-workspace.yaml +3 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/postcss.config.mjs +5 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/project.config.json +15 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/project.tt.json +9 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/scripts/check-routes.js +9 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/scripts/dev_run.sh +92 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/scripts/lint.sh +5 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/scripts/pack.sh +6 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/scripts/validate-feed-card.js +9 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/.dockerignore +27 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/.prettierrc +4 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/.vscode/settings.json +10 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/Dockerfile +15 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/README.md +98 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/eslint.config.mjs +5 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/nest-cli.json +8 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/package.json +41 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/run.sh +17 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/scripts/extract-routes.js +218 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/scripts/init-mysql-db.js +407 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/sql/001_create_database.sql +2 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/src/app.controller.ts +114 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/src/app.module.ts +14 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/src/app.service.ts +225 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/src/lib/db.ts +253 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/src/logger.middleware.ts +28 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/src/main.ts +18 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/tsconfig.build.json +4 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/server/tsconfig.json +28 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/app.config.ts +12 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/app.css +2 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/app.ts +15 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/assets/empty.png +0 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/base.css +37 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/components/custom-nav-space.tsx +16 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/hooks/use-custom-nav-layout.ts +19 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/index.html +46 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/lib/canvas-game.ts +162 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/lib/custom-nav-layout.ts +122 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/lib/event-bus.ts +31 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/lib/measure.ts +101 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/lib/pointer.ts +49 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/lib/utils.ts +6 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/network.ts +17 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/pages/index/index.config.ts +5 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/src/pages/index/index.tsx +59 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/tsconfig.json +33 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/turbo.json +36 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/types/components-sar-game.d.ts +4 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/types/douyin-open-capabilities.d.ts +48 -0
- package/card-skills/douyin-interest-card-generate/templates/taro/types/global.d.ts +1 -0
- package/card-skills/douyin-interest-card-llm/.interest-card-cli.json +3 -0
- package/card-skills/douyin-interest-card-llm/SKILL.md +231 -0
- package/card-skills/douyin-interest-card-llm/examples/frontend/ai-platform-client.example.tsx +376 -0
- package/card-skills/douyin-interest-card-llm/examples/server/ai-platform-sdk.example.d.ts +238 -0
- package/card-skills/douyin-interest-card-llm/examples/server/ai-platform-service.http-fallback.example.ts +659 -0
- package/card-skills/douyin-interest-card-llm/examples/server/ai-platform-service.sdk.example.ts +307 -0
- package/card-skills/douyin-interest-card-llm/examples/server/generate-text.sdk.example.ts +110 -0
- package/card-skills/douyin-interest-card-llm/references/frontend/usage.md +131 -0
- package/card-skills/douyin-interest-card-llm/references/server/generate-and-media.md +233 -0
- package/card-skills/douyin-interest-card-llm/references/server/model-constraints.md +177 -0
- package/card-skills/douyin-interest-card-llm/references/server/streaming.md +163 -0
- package/card-skills/douyin-interest-card-llm/scripts/check-model-permission.sh +194 -0
- package/card-skills/douyin-interest-card-optimize/.interest-card-cli.json +3 -0
- package/card-skills/douyin-interest-card-optimize/SKILL.md +34 -0
- package/card-skills/douyin-interest-card-optimize/references/README.md +26 -0
- package/card-skills/douyin-interest-card-optimize/references/creator-language.md +72 -0
- package/card-skills/douyin-interest-card-optimize/references/images/oversized-images.md +32 -0
- package/card-skills/douyin-interest-card-optimize/references/startup/inline-images.md +64 -0
- package/card-skills/douyin-interest-card-optimize/references/startup/non-essential-work.md +143 -0
- package/card-skills/douyin-interest-card-optimize/references/startup/prefetched-card-data.md +43 -0
- package/card-skills/douyin-interest-card-optimize/references/verification.md +73 -0
- package/dist/bin/interest-card-cli.js +8 -0
- package/dist/src/args.js +163 -0
- package/dist/src/browser.js +62 -0
- package/dist/src/card/agent-chat.js +182 -0
- package/dist/src/card/agent-events.js +132 -0
- package/dist/src/card/agent-questions.js +156 -0
- package/dist/src/card/aio-client.js +177 -0
- package/dist/src/card/answered-questions.js +44 -0
- package/dist/src/card/binding.js +119 -0
- package/dist/src/card/browser-command.js +275 -0
- package/dist/src/card/browser-runtime.js +93 -0
- package/dist/src/card/card-api.js +105 -0
- package/dist/src/card/card-token.js +361 -0
- package/dist/src/card/chat-commands.js +240 -0
- package/dist/src/card/constants.js +102 -0
- package/dist/src/card/create-project-client.js +144 -0
- package/dist/src/card/create.js +128 -0
- package/dist/src/card/dev-commands.js +312 -0
- package/dist/src/card/diff.js +54 -0
- package/dist/src/card/editor-client.js +158 -0
- package/dist/src/card/editor-fs.js +158 -0
- package/dist/src/card/feed-preview.js +174 -0
- package/dist/src/card/global-skills.js +250 -0
- package/dist/src/card/handlers-global-skills.js +60 -0
- package/dist/src/card/handlers-misc.js +214 -0
- package/dist/src/card/handlers.js +346 -0
- package/dist/src/card/help.js +146 -0
- package/dist/src/card/ignore.js +153 -0
- package/dist/src/card/list.js +110 -0
- package/dist/src/card/logs.js +179 -0
- package/dist/src/card/preview-qr.js +211 -0
- package/dist/src/card/preview.js +234 -0
- package/dist/src/card/project.js +117 -0
- package/dist/src/card/reconcile.js +121 -0
- package/dist/src/card/rename.js +72 -0
- package/dist/src/card/reporter.js +25 -0
- package/dist/src/card/sandbox-commands.js +81 -0
- package/dist/src/card/skill-names.js +22 -0
- package/dist/src/card/skills.js +264 -0
- package/dist/src/card/snapshot.js +94 -0
- package/dist/src/card/sync-engine.js +259 -0
- package/dist/src/card/sync-local.js +122 -0
- package/dist/src/card/zip-extract.js +86 -0
- package/dist/src/card-install.js +153 -0
- package/dist/src/cli-helpers.js +43 -0
- package/dist/src/cli.js +210 -0
- package/dist/src/command-context.js +62 -0
- package/dist/src/config.js +306 -0
- package/dist/src/creator-device-login.js +437 -0
- package/dist/src/creator-login-session.js +295 -0
- package/dist/src/creator-login.js +114 -0
- package/dist/src/creator-passport-login.js +194 -0
- package/dist/src/creator-session.js +60 -0
- package/dist/src/external-login/cookie-jar.js +65 -0
- package/dist/src/external-login/passport-platform.js +256 -0
- package/dist/src/external-login/passport-qr-login.js +317 -0
- package/dist/src/external-login/passport-sdk.js +233 -0
- package/dist/src/external-login/passport-utils.js +181 -0
- package/dist/src/external-login/qr-login.js +67 -0
- package/dist/src/help.js +144 -0
- package/dist/src/http.js +243 -0
- package/dist/src/login-handlers.js +122 -0
- package/dist/src/output.js +110 -0
- package/dist/src/platform.js +105 -0
- package/dist/src/qr.js +15 -0
- package/dist/src/request-source.js +35 -0
- package/dist/src/semver.js +58 -0
- package/dist/src/telemetry-sender.js +32 -0
- package/dist/src/telemetry.js +349 -0
- package/dist/src/tenant-list.js +3 -0
- package/dist/src/types.js +53 -0
- package/dist/src/update-check.js +256 -0
- package/dist/src/upgrade.js +220 -0
- package/dist/src/version.js +40 -0
- package/package.json +43 -4
|
@@ -0,0 +1,970 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
':' //; exec node "$0" "$@"
|
|
3
|
+
// Unified entry for the interest-card browser skill: `cli.mjs <verb> [sub] [options]`.
|
|
4
|
+
// Every verb wraps the existing adapters in this directory and prints exactly one JSON receipt line on stdout.
|
|
5
|
+
// The verb set is fixed; new values (ops, read kinds, conditions) are listed by `describe` so callers never hard-code them.
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { spawn } from 'node:child_process';
|
|
9
|
+
import { randomUUID } from 'node:crypto';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import { writeSessionFile } from './cli-input.mjs';
|
|
12
|
+
|
|
13
|
+
export const PROTOCOL = 1;
|
|
14
|
+
export const CLI_VERSION = '1.0.0';
|
|
15
|
+
export const EXIT = { ok: 0, failed: 1, usage: 2, blocked: 3 };
|
|
16
|
+
|
|
17
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
const scriptDir = () => process.env.ICB_SCRIPT_DIR || HERE;
|
|
19
|
+
const workRoot = () => process.env.ICB_WORK_ROOT || '/workspace/tmp/cli/interest-card-browser';
|
|
20
|
+
|
|
21
|
+
export const VERBS = {
|
|
22
|
+
open: 'Open the Feed preview (optionally the landing page) and keep the session open. --scene feed|post --page card|landing|pages/<route> --viewport WxH',
|
|
23
|
+
act: 'Perform one action: act <op> --target <target> [--value v] [--expect cond]... [--shot [name]]',
|
|
24
|
+
read: 'Read page information: read <kind>',
|
|
25
|
+
wait: 'Wait for conditions: wait <cond>... (all must hold)',
|
|
26
|
+
shot: 'Screenshot the current page: shot [--name n] [--area page|face] [--full] [--expect cond]...',
|
|
27
|
+
run: 'Run several steps in one call: run --steps <json-or-file> (array of argv arrays); stops at the first failure; a session it opened is closed at the end unless --keep-open',
|
|
28
|
+
snap: 'One-call screenshot: snap [--page p] [--scene s] [--click target]... [--wait cond]... [--area page|face] [--full] [--viewport WxH] [--name n]; opens, acts in order, shoots and closes',
|
|
29
|
+
close: 'Close the session tab and browser session; --clean also deletes the session screenshots',
|
|
30
|
+
describe: 'Print supported verbs, values and protocol version',
|
|
31
|
+
};
|
|
32
|
+
export const ACT_OPS = ['click', 'fill', 'scroll', 'press', 'wait'];
|
|
33
|
+
export const READ_KINDS = ['map', 'text', 'state', 'layout', 'console', 'network', 'env'];
|
|
34
|
+
export const CONDITIONS = ['stable', 'text:<visible text>', 'gone:<visible text>', 'route:pages/<route>', 'request:<url part>', 'ms:<1..30000>'];
|
|
35
|
+
export const TARGETS = ['text:<visible text>', 'css:<selector>', 'id:<test id>', 'ref:eN', 'xy:<x>,<y>'];
|
|
36
|
+
export const IN_VALUES = { card: 'interest-card', host: 'feed-host', landing: 'landing-page' };
|
|
37
|
+
export const SCENES = ['feed', 'post'];
|
|
38
|
+
/** shot --area: page is the whole phone page; face is the card face slot inside the Feed shell (343x436). */
|
|
39
|
+
export const SHOT_AREAS = { page: null, face: '#opencard-preview-iframe' };
|
|
40
|
+
/** Default phone viewport of a fresh open; --viewport WxH overrides it (and resizes a reused session). */
|
|
41
|
+
export const DEFAULT_VIEWPORT = { width: 375, height: 812 };
|
|
42
|
+
/** Old artifacts are pruned once per process: older than ARTIFACT_MAX_AGE_MS, or beyond the newest ARTIFACT_KEEP files. */
|
|
43
|
+
export const ARTIFACT_KEEP = 40;
|
|
44
|
+
export const ARTIFACT_MAX_AGE_MS = 24 * 3600 * 1000;
|
|
45
|
+
|
|
46
|
+
export class CliError extends Error {
|
|
47
|
+
constructor(code, message, exit = EXIT.failed, extra = {}) {
|
|
48
|
+
super(message);
|
|
49
|
+
this.code = code;
|
|
50
|
+
this.exit = exit;
|
|
51
|
+
this.extra = extra;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const usage = message => new CliError('USAGE', message, EXIT.usage);
|
|
55
|
+
|
|
56
|
+
const VALUE_FLAGS = new Set(['--session', '--in', '--target', '--expect', '--timeout', '--scene', '--page', '--value',
|
|
57
|
+
'--steps', '--name', '--level', '--selectors', '--route', '--position', '--delta', '--duration', '--match', '--fields',
|
|
58
|
+
'--key', '--occurrence', '--limit', '--area', '--viewport']);
|
|
59
|
+
/** Repeatable snap steps; their order on the command line is the order they run in. */
|
|
60
|
+
const STEP_FLAGS = new Set(['--click', '--wait']);
|
|
61
|
+
const BOOL_FLAGS = new Set(['--full', '--detail', '--clear', '--clean', '--reload', '--help', '--keep-open']);
|
|
62
|
+
const camel = flag => flag.slice(2).replace(/-([a-z])/gu, (_, c) => c.toUpperCase());
|
|
63
|
+
|
|
64
|
+
export const parseArgs = argv => {
|
|
65
|
+
const [verb = '', ...rest] = argv;
|
|
66
|
+
const flags = { expect: [], steps_: [] };
|
|
67
|
+
const positional = [];
|
|
68
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
69
|
+
const arg = rest[index];
|
|
70
|
+
if (arg === '--shot') {
|
|
71
|
+
const next = rest[index + 1];
|
|
72
|
+
if (next !== undefined && !next.startsWith('--')) { flags.shot = next; index += 1; } else flags.shot = true;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (!arg.startsWith('--')) { positional.push(arg); continue; }
|
|
76
|
+
const eq = arg.indexOf('=');
|
|
77
|
+
const name = eq > 0 ? arg.slice(0, eq) : arg;
|
|
78
|
+
if (BOOL_FLAGS.has(name)) { flags[camel(name)] = true; continue; }
|
|
79
|
+
if (STEP_FLAGS.has(name)) {
|
|
80
|
+
const value = eq > 0 ? arg.slice(eq + 1) : rest[++index];
|
|
81
|
+
if (value === undefined) throw usage(`${name} requires a value`);
|
|
82
|
+
flags.steps_.push({ kind: name.slice(2), value });
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (!VALUE_FLAGS.has(name)) throw usage(`Unknown option ${name}; run describe for supported options`);
|
|
86
|
+
let value = eq > 0 ? arg.slice(eq + 1) : rest[++index];
|
|
87
|
+
if (value === undefined) throw usage(`${name} requires a value`);
|
|
88
|
+
if (name === '--expect') flags.expect.push(value);
|
|
89
|
+
else flags[camel(name)] = value;
|
|
90
|
+
}
|
|
91
|
+
if (!flags.steps_.length) delete flags.steps_;
|
|
92
|
+
return { verb, positional, flags };
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const parseViewport = value => {
|
|
96
|
+
if (value === undefined) return undefined;
|
|
97
|
+
const match = /^(\d+)x(\d+)$/u.exec(String(value));
|
|
98
|
+
const viewport = match && { width: Number(match[1]), height: Number(match[2]) };
|
|
99
|
+
if (!viewport || viewport.width < 240 || viewport.width > 1920 || viewport.height < 320 || viewport.height > 4000) {
|
|
100
|
+
throw usage('--viewport looks like 375x812 (width 240..1920, height 320..4000)');
|
|
101
|
+
}
|
|
102
|
+
return viewport;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const parseTimeout = (value, fallbackMs) => {
|
|
106
|
+
if (value === undefined) return fallbackMs;
|
|
107
|
+
const match = /^(\d+)(ms|s)?$/u.exec(String(value));
|
|
108
|
+
if (!match) throw usage('--timeout takes seconds (30, 30s) or milliseconds (30000ms)');
|
|
109
|
+
const ms = match[2] === 'ms' ? Number(match[1]) : Number(match[1]) * 1000;
|
|
110
|
+
if (ms < 1 || ms > 600000) throw usage('--timeout must be between 1ms and 600s');
|
|
111
|
+
return ms;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const parseTarget = (spec, occurrence) => {
|
|
115
|
+
const match = /^(text|css|id|ref|xy):(.+)$/su.exec(spec ?? '');
|
|
116
|
+
if (!match) throw usage(`--target must be one of ${TARGETS.join(' | ')}`);
|
|
117
|
+
const [, kind, value] = match;
|
|
118
|
+
if (kind === 'ref') {
|
|
119
|
+
if (!/^@?e\d+$/u.test(value)) throw usage('ref target looks like ref:e3 (from read map / agent-browser snapshot)');
|
|
120
|
+
return { kind: 'ref', ref: `@${value.replace(/^@/u, '')}` };
|
|
121
|
+
}
|
|
122
|
+
if (kind === 'xy') {
|
|
123
|
+
const point = value.split(',').map(Number);
|
|
124
|
+
if (point.length !== 2 || point.some(n => !Number.isFinite(n) || n < 0)) throw usage('xy target looks like xy:120,300');
|
|
125
|
+
return { kind: 'xy', x: point[0], y: point[1] };
|
|
126
|
+
}
|
|
127
|
+
const by = { text: 'text', css: 'selector', id: 'test-id' }[kind];
|
|
128
|
+
const target = { by, value };
|
|
129
|
+
if (occurrence !== undefined) {
|
|
130
|
+
if (!/^\d+$/u.test(String(occurrence))) throw usage('--occurrence is a zero-based integer');
|
|
131
|
+
target.occurrence = Number(occurrence);
|
|
132
|
+
}
|
|
133
|
+
return { kind: 'frame', target };
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const parseCondition = spec => {
|
|
137
|
+
if (spec === 'stable') return { kind: 'stable' };
|
|
138
|
+
const match = /^(text|gone|route|request|ms):(.+)$/su.exec(spec ?? '');
|
|
139
|
+
if (!match) throw usage(`Condition must be one of ${CONDITIONS.join(' | ')}`);
|
|
140
|
+
const [, kind, value] = match;
|
|
141
|
+
if (kind === 'route' && !/^pages\/[^\s?]+/u.test(value)) throw usage('route condition looks like route:pages/home/index');
|
|
142
|
+
if (kind === 'ms') {
|
|
143
|
+
const ms = Number(value);
|
|
144
|
+
if (!Number.isInteger(ms) || ms < 1 || ms > 30000) throw usage('ms condition takes 1..30000');
|
|
145
|
+
return { kind, ms, spec };
|
|
146
|
+
}
|
|
147
|
+
return { kind, value, spec };
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// Merges page conditions into one preview-session readiness object; request/ms are handled separately.
|
|
151
|
+
export const readinessFor = (conditions, timeoutMs) => {
|
|
152
|
+
const readiness = { stablePasses: 2, timeoutMs };
|
|
153
|
+
for (const condition of conditions) {
|
|
154
|
+
if (condition.kind === 'text') (readiness.textPresent ??= []).push(condition.value);
|
|
155
|
+
if (condition.kind === 'gone') (readiness.textAbsent ??= []).push(condition.value);
|
|
156
|
+
if (condition.kind === 'route') readiness.expectedRoute = condition.value;
|
|
157
|
+
}
|
|
158
|
+
return readiness;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const resolveIn = (value, meta) => {
|
|
162
|
+
const key = value ?? (meta?.page === 'landing' ? 'landing' : 'card');
|
|
163
|
+
if (!IN_VALUES[key]) throw usage(`--in must be ${Object.keys(IN_VALUES).join(' | ')}`);
|
|
164
|
+
return key;
|
|
165
|
+
};
|
|
166
|
+
// wait/observe/inspect only know the two business documents; the Feed host shell lives on the card page.
|
|
167
|
+
const readScope = inKey => (inKey === 'landing' ? 'landing-page' : 'interest-card');
|
|
168
|
+
|
|
169
|
+
export const sanitizeName = (value, fallback) => {
|
|
170
|
+
const base = String(value ?? '').replace(/\.png$/iu, '').replace(/[^A-Za-z0-9._-]/gu, '-').replace(/^[-.]+/u, '').slice(0, 64);
|
|
171
|
+
return base || fallback;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const describe = () => ({
|
|
175
|
+
protocol: PROTOCOL, version: CLI_VERSION,
|
|
176
|
+
verbs: VERBS,
|
|
177
|
+
values: {
|
|
178
|
+
act: ACT_OPS, read: READ_KINDS, conditions: CONDITIONS, targets: TARGETS,
|
|
179
|
+
in: Object.keys(IN_VALUES), scene: SCENES, page: ['card', 'landing', 'pages/<registered route>'], area: Object.keys(SHOT_AREAS),
|
|
180
|
+
},
|
|
181
|
+
options: {
|
|
182
|
+
common: ['--session <name> (default "default")', '--in card|host|landing', '--timeout <30s|30000ms>',
|
|
183
|
+
'--expect <cond> (repeatable)', '--shot [name]'],
|
|
184
|
+
act: ['--target <target>', '--occurrence <n>', '--value <text> (fill)', '--position top|bottom', '--delta <px> (scroll)',
|
|
185
|
+
'--key <key> (press)', '--route pages/<route> (bind the landing document)'],
|
|
186
|
+
read: ['state: --fields <json-or-file>', 'layout: --selectors <json-or-file>', 'console: --level error|warning|all --clear --detail --reload',
|
|
187
|
+
'network: --match <url part> --duration <ms>'],
|
|
188
|
+
open: ['--scene feed|post', '--page card|landing|pages/<route>', '--viewport <W>x<H> (default 375x812; resizes a reused session)'],
|
|
189
|
+
shot: ['--name <name> (same name replaces the earlier file)', '--area page|face (face: card face only, card page only)',
|
|
190
|
+
'--full (landing: also the content scrolled inside its container)'],
|
|
191
|
+
close: ['--clean (delete this session\'s screenshots and artifacts)'],
|
|
192
|
+
run: ['--steps <json-or-file>: [["open"],["act","click","--target","text:开始"],["shot"]]', '--keep-open (keep a session this run opened)'],
|
|
193
|
+
snap: ['--page card|landing|pages/<route>', '--scene feed|post', '--click <target> (repeatable, in order)', '--wait <cond> (repeatable, in order)',
|
|
194
|
+
'--area page|face', '--full', '--viewport <W>x<H>', '--name <name>', '--expect <cond> (checked on the shot)', '--keep-open'],
|
|
195
|
+
},
|
|
196
|
+
receipt: '{protocol, ok, code, verb, session, page:{scene,in,route,url}, outcome, expect:[{cond,ok}], data, artifacts:[{kind,path}], error?, nextSteps?}',
|
|
197
|
+
exitCodes: { 0: 'ok', 1: 'business failure', 2: 'usage error', 3: 'environment blocked' },
|
|
198
|
+
workDir: `${workRoot()}/<session>/`,
|
|
199
|
+
artifacts: `${workRoot()}/<session>/artifacts/: a reused name replaces its file; files older than 24h or beyond the newest ${ARTIFACT_KEEP} are pruned`,
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// ---------- child processes ----------
|
|
203
|
+
|
|
204
|
+
const lastJsonLine = text => {
|
|
205
|
+
const lines = String(text).trim().split('\n').reverse();
|
|
206
|
+
for (const line of lines) {
|
|
207
|
+
const trimmed = line.trim();
|
|
208
|
+
if (!trimmed.startsWith('{')) continue;
|
|
209
|
+
try { return JSON.parse(trimmed); } catch {}
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const MAX_CAPTURE = 4 * 1024 * 1024;
|
|
215
|
+
export const startScript = (file, args, { timeoutMs = 120000, onStderrLine } = {}) => {
|
|
216
|
+
const full = path.join(scriptDir(), file);
|
|
217
|
+
const command = file.endsWith('.sh') ? 'bash' : process.execPath;
|
|
218
|
+
const child = spawn(command, [full, ...args], { cwd: process.cwd(), env: process.env, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
219
|
+
let stdout = '';
|
|
220
|
+
let stderr = '';
|
|
221
|
+
let pending = '';
|
|
222
|
+
child.stdout.on('data', chunk => { if (stdout.length < MAX_CAPTURE) stdout += chunk; });
|
|
223
|
+
child.stderr.on('data', chunk => {
|
|
224
|
+
if (stderr.length < MAX_CAPTURE) stderr += chunk;
|
|
225
|
+
if (!onStderrLine) return;
|
|
226
|
+
pending += chunk;
|
|
227
|
+
let newline;
|
|
228
|
+
while ((newline = pending.indexOf('\n')) >= 0) {
|
|
229
|
+
onStderrLine(pending.slice(0, newline));
|
|
230
|
+
pending = pending.slice(newline + 1);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
let timedOut = false;
|
|
234
|
+
const timer = setTimeout(() => { timedOut = true; child.kill('SIGTERM'); }, timeoutMs);
|
|
235
|
+
const done = new Promise(resolve => {
|
|
236
|
+
child.on('error', error => { clearTimeout(timer); resolve({ code: 127, stdout, stderr: `${stderr}${error.message}`, json: undefined, timedOut }); });
|
|
237
|
+
child.on('close', code => {
|
|
238
|
+
clearTimeout(timer);
|
|
239
|
+
resolve({ code: timedOut ? 124 : code ?? 1, stdout, stderr, json: lastJsonLine(stdout), timedOut });
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
return { child, done };
|
|
243
|
+
};
|
|
244
|
+
const runScript = (file, args, options) => startScript(file, args, options).done;
|
|
245
|
+
|
|
246
|
+
const BLOCKED_CODE = /^(CDP_|AGENT_BROWSER_|BROWSER_)/u;
|
|
247
|
+
// Converts a failed adapter receipt into a CliError: CDP/browser faults are environment blocks, the rest business failures.
|
|
248
|
+
const childFailure = (step, result, fallbackCode) => {
|
|
249
|
+
const json = result.json ?? {};
|
|
250
|
+
const code = result.timedOut ? 'TIMEOUT' : json.code || fallbackCode;
|
|
251
|
+
const blocked = result.timedOut || BLOCKED_CODE.test(code) || result.code === 4 || result.code === 127;
|
|
252
|
+
const reasons = [...new Set((json.attempts ?? []).map(item => item?.reason).filter(Boolean))].join(', ');
|
|
253
|
+
const error = json.error || (result.timedOut ? `${step} did not finish in time` : '')
|
|
254
|
+
|| (reasons ? `${step}: ${reasons}` : '')
|
|
255
|
+
|| result.stderr.trim().split('\n').slice(-3).join(' ').slice(0, 400) || `${step} exited ${result.code}`;
|
|
256
|
+
const nextSteps = json.nextSteps ?? (code === 'SESSION_STALE' ? ['open'] : undefined);
|
|
257
|
+
return new CliError(code, error, blocked ? EXIT.blocked : EXIT.failed, { data: json, ...(nextSteps ? { nextSteps } : {}) });
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// ---------- session context ----------
|
|
261
|
+
|
|
262
|
+
const SESSION_NAME = /^[A-Za-z0-9._-]{1,48}$/u;
|
|
263
|
+
const CONVERSATION = /^conv_[A-Za-z0-9-]+(_ext)?$/u;
|
|
264
|
+
const readJson = file => { try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return undefined; } };
|
|
265
|
+
const writeJson = (file, value) => {
|
|
266
|
+
const staged = `${file}.${process.pid}.tmp`;
|
|
267
|
+
fs.writeFileSync(staged, `${JSON.stringify(value)}\n`, { mode: 0o600 });
|
|
268
|
+
fs.renameSync(staged, file);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const createContext = flags => {
|
|
272
|
+
const session = flags.session ?? 'default';
|
|
273
|
+
if (!SESSION_NAME.test(session)) throw usage('--session may contain letters, digits, dot, underscore and hyphen (max 48)');
|
|
274
|
+
const dir = path.join(workRoot(), session);
|
|
275
|
+
const artifactsDir = path.join(dir, 'artifacts');
|
|
276
|
+
fs.mkdirSync(artifactsDir, { recursive: true });
|
|
277
|
+
const ctx = {
|
|
278
|
+
session, dir, artifactsDir,
|
|
279
|
+
statePath: path.join(dir, 'session.json'),
|
|
280
|
+
metaPath: path.join(dir, 'cli.json'),
|
|
281
|
+
artifacts: [],
|
|
282
|
+
};
|
|
283
|
+
ctx.meta = readJson(ctx.metaPath) ?? {};
|
|
284
|
+
if (!process.env.CONVERSATION_ID && CONVERSATION.test(ctx.meta.conversationId ?? '')) process.env.CONVERSATION_ID = ctx.meta.conversationId;
|
|
285
|
+
return ctx;
|
|
286
|
+
};
|
|
287
|
+
const saveMeta = ctx => writeJson(ctx.metaPath, ctx.meta);
|
|
288
|
+
/** Paths handed out by this process (a run/snap spans several nested verbs): only these force a -2/-3 suffix. */
|
|
289
|
+
const claimedArtifacts = new Set();
|
|
290
|
+
const prunedDirs = new Set();
|
|
291
|
+
export const pruneArtifacts = (dir, { keep = ARTIFACT_KEEP, maxAgeMs = ARTIFACT_MAX_AGE_MS, now = Date.now() } = {}) => {
|
|
292
|
+
let entries;
|
|
293
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return []; }
|
|
294
|
+
const files = entries.filter(entry => entry.isFile()).map(entry => {
|
|
295
|
+
const file = path.join(dir, entry.name);
|
|
296
|
+
try { return { file, mtime: fs.statSync(file).mtimeMs }; } catch { return undefined; }
|
|
297
|
+
}).filter(Boolean).sort((a, b) => b.mtime - a.mtime);
|
|
298
|
+
const removed = files.filter((item, index) => !claimedArtifacts.has(item.file) && (index >= keep || now - item.mtime > maxAgeMs));
|
|
299
|
+
for (const item of removed) fs.rmSync(item.file, { force: true });
|
|
300
|
+
return removed.map(item => item.file);
|
|
301
|
+
};
|
|
302
|
+
// A reused name replaces the file an earlier command left, so artifacts/ holds the latest "landing.png", not landing-7.png.
|
|
303
|
+
const artifactPath = (ctx, name, extension = 'png') => {
|
|
304
|
+
if (!prunedDirs.has(ctx.artifactsDir)) { prunedDirs.add(ctx.artifactsDir); pruneArtifacts(ctx.artifactsDir); }
|
|
305
|
+
let candidate = path.join(ctx.artifactsDir, `${name}.${extension}`);
|
|
306
|
+
for (let n = 2; claimedArtifacts.has(candidate); n += 1) candidate = path.join(ctx.artifactsDir, `${name}-${n}.${extension}`);
|
|
307
|
+
claimedArtifacts.add(candidate);
|
|
308
|
+
fs.rmSync(candidate, { force: true });
|
|
309
|
+
return candidate;
|
|
310
|
+
};
|
|
311
|
+
const addArtifact = (ctx, kind, file) => {
|
|
312
|
+
if (file && fs.existsSync(file) && !ctx.artifacts.some(item => item.path === file)) ctx.artifacts.push({ kind, path: file });
|
|
313
|
+
};
|
|
314
|
+
const openState = ctx => {
|
|
315
|
+
const state = readJson(ctx.statePath);
|
|
316
|
+
if (!state || state.ok !== true || state.sessionOpen !== true || !ctx.meta.browserSession) {
|
|
317
|
+
throw new CliError('SESSION_NOT_OPEN', `Session "${ctx.session}" is not open; run open first`, EXIT.failed, { nextSteps: ['open'] });
|
|
318
|
+
}
|
|
319
|
+
return state;
|
|
320
|
+
};
|
|
321
|
+
const stamp = () => new Date().toISOString().replace(/[-:]/gu, '').replace(/\..+$/u, '');
|
|
322
|
+
const jsonArg = (ctx, label, value) => {
|
|
323
|
+
const file = path.join(ctx.dir, `${label}.json`);
|
|
324
|
+
writeJson(file, value);
|
|
325
|
+
return file;
|
|
326
|
+
};
|
|
327
|
+
// --fields/--selectors/--steps accept inline JSON or an existing JSON file.
|
|
328
|
+
const readJsonOption = (value, label) => {
|
|
329
|
+
if (value === undefined) return undefined;
|
|
330
|
+
const text = /^\s*[[{]/u.test(value) ? value : (() => {
|
|
331
|
+
if (!fs.existsSync(value)) throw usage(`${label} must be inline JSON or an existing JSON file`);
|
|
332
|
+
return fs.readFileSync(value, 'utf8');
|
|
333
|
+
})();
|
|
334
|
+
try { return JSON.parse(text); } catch { throw usage(`${label} is not valid JSON`); }
|
|
335
|
+
};
|
|
336
|
+
const landingUrlArgs = (ctx, scope) => (scope === 'landing-page' && ctx.meta.url ? ['--url', ctx.meta.url] : []);
|
|
337
|
+
|
|
338
|
+
const browserCommand = (ctx, args, timeoutMs = 15000) => runScript('run-browser-command.mjs',
|
|
339
|
+
['--timeout-ms', String(timeoutMs), '--', '--session', ctx.meta.browserSession, ...args], { timeoutMs: timeoutMs + 5000 });
|
|
340
|
+
const requireOk = (step, result, fallbackCode) => {
|
|
341
|
+
if (result.code !== 0 || (result.json && result.json.ok === false)) throw childFailure(step, result, fallbackCode);
|
|
342
|
+
return result.json ?? {};
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
// ---------- conditions ----------
|
|
346
|
+
|
|
347
|
+
const waitConditions = async (ctx, inKey, conditions, timeoutMs) => {
|
|
348
|
+
const report = [];
|
|
349
|
+
const page = conditions.filter(item => ['stable', 'text', 'gone', 'route'].includes(item.kind));
|
|
350
|
+
for (const item of conditions.filter(entry => entry.kind === 'ms')) {
|
|
351
|
+
await new Promise(resolve => setTimeout(resolve, item.ms));
|
|
352
|
+
report.push({ cond: item.spec, ok: true });
|
|
353
|
+
}
|
|
354
|
+
let data;
|
|
355
|
+
if (page.length) {
|
|
356
|
+
const scope = readScope(inKey);
|
|
357
|
+
const readiness = readinessFor(page, timeoutMs);
|
|
358
|
+
const result = await runScript('preview-session.mjs', ['wait', '--session-file', ctx.statePath,
|
|
359
|
+
...landingUrlArgs(ctx, scope), scope, jsonArg(ctx, 'readiness', readiness)], { timeoutMs: timeoutMs + 15000 });
|
|
360
|
+
data = result.json;
|
|
361
|
+
const ok = result.code === 0 && result.json?.ok !== false;
|
|
362
|
+
for (const item of page) report.push({ cond: item.spec ?? item.kind, ok });
|
|
363
|
+
if (ok && scope === 'landing-page' && result.json?.renderedRoute) { ctx.meta.route = result.json.renderedRoute; saveMeta(ctx); }
|
|
364
|
+
if (!ok) return { report, data, failure: childFailure('wait', result, 'EXPECT_FAILED') };
|
|
365
|
+
}
|
|
366
|
+
return { report, data };
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// Starts a passive network observer before an action so request conditions see the request it triggers.
|
|
370
|
+
const startRequestWatch = async (ctx, inKey, conditions, durationMs) => {
|
|
371
|
+
const requests = conditions.filter(item => item.kind === 'request');
|
|
372
|
+
if (!requests.length) return undefined;
|
|
373
|
+
const scope = readScope(inKey);
|
|
374
|
+
const match = requests[0].value;
|
|
375
|
+
let ready;
|
|
376
|
+
const readyPromise = new Promise(resolve => { ready = resolve; });
|
|
377
|
+
const handle = startScript('observe-preview-network.mjs', ['--session-file', ctx.statePath,
|
|
378
|
+
...(scope === 'landing-page' ? ['--scope', 'landing-page'] : []), ...landingUrlArgs(ctx, scope),
|
|
379
|
+
JSON.stringify({ durationMs, urlIncludes: match })], {
|
|
380
|
+
timeoutMs: durationMs + 20000,
|
|
381
|
+
onStderrLine: line => { if (line.startsWith('{') && !line.includes('"event":"response"')) ready(); },
|
|
382
|
+
});
|
|
383
|
+
handle.done.then(() => ready());
|
|
384
|
+
await Promise.race([readyPromise, new Promise(resolve => setTimeout(resolve, 10000))]);
|
|
385
|
+
return { requests, handle };
|
|
386
|
+
};
|
|
387
|
+
const finishRequestWatch = async watch => {
|
|
388
|
+
if (!watch) return { report: [] };
|
|
389
|
+
const result = await watch.handle.done;
|
|
390
|
+
const records = result.json?.records ?? [];
|
|
391
|
+
const report = watch.requests.map(item => ({
|
|
392
|
+
cond: item.spec, ok: records.some(record => record.url?.includes(item.value) && !record.error && (record.status ?? 0) < 400),
|
|
393
|
+
}));
|
|
394
|
+
const data = { records: records.map(({ url, method, status, error }) => ({ url, method, status, ...(error ? { error } : {}) })) };
|
|
395
|
+
return { report, data };
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const checkExpectations = async (ctx, inKey, flags, timeoutMs, watch) => {
|
|
399
|
+
const conditions = flags.expect.map(parseCondition);
|
|
400
|
+
const page = await waitConditions(ctx, inKey, conditions.filter(item => item.kind !== 'request'), timeoutMs);
|
|
401
|
+
const network = await finishRequestWatch(watch);
|
|
402
|
+
const report = [...page.report, ...network.report];
|
|
403
|
+
return { report, data: { ...(page.data ? { wait: page.data } : {}), ...(network.data ? { network: network.data } : {}) },
|
|
404
|
+
failure: page.failure ?? (report.some(item => !item.ok)
|
|
405
|
+
? new CliError('EXPECT_FAILED', `Not met: ${report.filter(item => !item.ok).map(item => item.cond).join(', ')}`) : undefined) };
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
// ---------- verbs ----------
|
|
409
|
+
|
|
410
|
+
/** Tallest page the landing --full capture grows the viewport to. */
|
|
411
|
+
export const FULL_MAX_HEIGHT = 12000;
|
|
412
|
+
/**
|
|
413
|
+
* Height the viewport needs so no visible scroller (top page or same-origin frames such as the
|
|
414
|
+
* mini-program simulator's miniapp-frame) still scrolls: innerHeight + the largest remaining scroll range.
|
|
415
|
+
*/
|
|
416
|
+
export const fullHeightExpression = () => `JSON.stringify((() => {
|
|
417
|
+
let extra = 0;
|
|
418
|
+
const scan = (doc, depth) => {
|
|
419
|
+
const view = doc.defaultView;
|
|
420
|
+
for (const element of [...doc.querySelectorAll('*'), doc.scrollingElement]) {
|
|
421
|
+
if (!element || element.scrollHeight <= element.clientHeight + 1) continue;
|
|
422
|
+
const rect = element.getBoundingClientRect();
|
|
423
|
+
if (rect.width < 1 || rect.height < 1) continue;
|
|
424
|
+
const overflow = view.getComputedStyle(element).overflowY;
|
|
425
|
+
if (element !== doc.scrollingElement && !['auto', 'scroll', 'overlay'].includes(overflow)) continue;
|
|
426
|
+
extra = Math.max(extra, element.scrollHeight - element.clientHeight);
|
|
427
|
+
}
|
|
428
|
+
if (depth < 2) for (const frame of doc.querySelectorAll('iframe')) {
|
|
429
|
+
const box = frame.getBoundingClientRect();
|
|
430
|
+
if (box.width < 1 || box.height < 1) continue;
|
|
431
|
+
try { if (frame.contentDocument) scan(frame.contentDocument, depth + 1); } catch {}
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
scan(document, 0);
|
|
435
|
+
return { width: innerWidth, height: innerHeight, extra: Math.ceil(extra) };
|
|
436
|
+
})())`;
|
|
437
|
+
const parseEval = stdout => {
|
|
438
|
+
let value = stdout.trim();
|
|
439
|
+
for (let i = 0; i < 2 && typeof value === 'string'; i += 1) { try { value = JSON.parse(value); } catch { break; } }
|
|
440
|
+
return typeof value === 'object' && value ? value : undefined;
|
|
441
|
+
};
|
|
442
|
+
const setViewport = (ctx, { width, height }) => browserCommand(ctx, ['set', 'viewport', String(width), String(height)]);
|
|
443
|
+
|
|
444
|
+
/** Landing content scrolls inside the simulator frame: grow the viewport until nothing scrolls, shoot, restore. */
|
|
445
|
+
const fullLandingShot = async (ctx, output, readiness) => {
|
|
446
|
+
const base = ctx.meta.viewport ?? DEFAULT_VIEWPORT;
|
|
447
|
+
let height = base.height;
|
|
448
|
+
let grown = false;
|
|
449
|
+
try {
|
|
450
|
+
for (let pass = 0; pass < 3; pass += 1) {
|
|
451
|
+
const result = await browserCommand(ctx, ['eval', fullHeightExpression()]);
|
|
452
|
+
requireOk('measure', result, 'SHOT_FAILED');
|
|
453
|
+
const measured = parseEval(result.stdout ?? '');
|
|
454
|
+
if (!Number.isFinite(measured?.extra) || !Number.isFinite(measured?.height) || measured.extra <= 1 || height >= FULL_MAX_HEIGHT) break;
|
|
455
|
+
height = Math.min(FULL_MAX_HEIGHT, measured.height + measured.extra);
|
|
456
|
+
requireOk('viewport', await setViewport(ctx, { width: base.width, height }), 'VIEWPORT_FAILED');
|
|
457
|
+
grown = true;
|
|
458
|
+
}
|
|
459
|
+
const scope = readScope('landing');
|
|
460
|
+
requireOk('shot', await runScript('preview-session.mjs', ['capture', '--session-file', ctx.statePath, '--scope', scope,
|
|
461
|
+
...landingUrlArgs(ctx, scope), output,
|
|
462
|
+
jsonArg(ctx, 'capture-options', readiness ?? { stablePasses: 1, timeoutMs: 15000, settleImagesMs: 8000 })], { timeoutMs: 60000 }), 'SHOT_FAILED');
|
|
463
|
+
} finally {
|
|
464
|
+
if (grown) await setViewport(ctx, base);
|
|
465
|
+
}
|
|
466
|
+
return { fullHeight: height, truncated: height >= FULL_MAX_HEIGHT };
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
const screenshot = async (ctx, inKey, { name, full = false, readiness, clipSelector }) => {
|
|
470
|
+
const output = artifactPath(ctx, sanitizeName(name, `shot-${stamp()}`));
|
|
471
|
+
if (full && readScope(inKey) === 'landing-page') {
|
|
472
|
+
ctx.fullShot = await fullLandingShot(ctx, output, readiness);
|
|
473
|
+
} else if (full) {
|
|
474
|
+
requireOk('screenshot', await browserCommand(ctx, ['screenshot', '--full', output], 30000), 'SHOT_FAILED');
|
|
475
|
+
} else {
|
|
476
|
+
const scope = readScope(inKey);
|
|
477
|
+
const result = await runScript('preview-session.mjs', ['capture', '--session-file', ctx.statePath,
|
|
478
|
+
...(scope === 'landing-page' ? ['--scope', 'landing-page'] : []), ...landingUrlArgs(ctx, scope), output,
|
|
479
|
+
jsonArg(ctx, 'capture-options', { ...(readiness ?? { stablePasses: 1, timeoutMs: 15000, settleImagesMs: 8000 }), ...(clipSelector ? { clipSelector } : {}) })],
|
|
480
|
+
{ timeoutMs: 60000 });
|
|
481
|
+
requireOk('shot', result, 'SHOT_FAILED');
|
|
482
|
+
}
|
|
483
|
+
addArtifact(ctx, 'screenshot', output);
|
|
484
|
+
return output;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
const closeQuietly = async ctx => {
|
|
488
|
+
if (fs.existsSync(ctx.statePath)) await runScript('close-session.mjs', ['--session-file', ctx.statePath], { timeoutMs: 20000 });
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
async function verbOpen(ctx, flags, timeoutMs) {
|
|
492
|
+
const scene = flags.scene ?? ctx.meta.scene ?? 'feed';
|
|
493
|
+
if (!SCENES.includes(scene)) throw usage('--scene must be feed or post');
|
|
494
|
+
const pageSpec = flags.page ?? 'card';
|
|
495
|
+
if (!['card', 'landing'].includes(pageSpec) && !/^pages\/\S+/u.test(pageSpec)) throw usage('--page must be card, landing or pages/<route>');
|
|
496
|
+
const requestedViewport = parseViewport(flags.viewport);
|
|
497
|
+
const data = {};
|
|
498
|
+
let state = readJson(ctx.statePath);
|
|
499
|
+
let reused = false;
|
|
500
|
+
if (state?.ok && state.sessionOpen && ctx.meta.browserSession && ctx.meta.scene === scene) {
|
|
501
|
+
const resume = await runScript('resume-check.mjs', ['--session-file', ctx.statePath], { timeoutMs: 30000 });
|
|
502
|
+
data.resume = { decision: resume.json?.decision, reasons: resume.json?.reasons };
|
|
503
|
+
if (resume.json?.decision === 'reuse') reused = true;
|
|
504
|
+
else if (resume.json?.decision === 'blocked') {
|
|
505
|
+
throw new CliError('RESUME_BLOCKED', (resume.json.reasons ?? []).join('; ') || 'Session cannot be resumed', EXIT.blocked,
|
|
506
|
+
{ data: resume.json, nextSteps: resume.json.nextSteps });
|
|
507
|
+
} else await closeQuietly(ctx);
|
|
508
|
+
} else if (state?.sessionOpen) await closeQuietly(ctx);
|
|
509
|
+
|
|
510
|
+
if (!reused) {
|
|
511
|
+
const prepare = await runScript('prepare-agent-browser.sh', ['--ensure'], { timeoutMs: 180000 });
|
|
512
|
+
data.agentBrowser = prepare.json ? { version: prepare.json.version, meetsMinimum: prepare.json.meetsMinimum } : { error: prepare.stderr.slice(-300) };
|
|
513
|
+
const dev = await runScript('wait-dev-status.mjs', [], { timeoutMs: Math.max(timeoutMs, 60000) + 10000 });
|
|
514
|
+
const devStatus = dev.json?.status ?? {};
|
|
515
|
+
if (!(dev.json?.ok && devStatus.ready && devStatus.cardReady)) {
|
|
516
|
+
throw new CliError('DEV_NOT_READY', dev.json?.error || 'Dev server is not ready (ready && cardReady required)', EXIT.blocked,
|
|
517
|
+
{ data: { ready: devStatus.ready ?? false, cardReady: devStatus.cardReady ?? false, recentLogs: (devStatus.recentLogs ?? []).slice(-5) } });
|
|
518
|
+
}
|
|
519
|
+
// The sandbox shell has no CONVERSATION_ID; dev/status reports the one the running project belongs to.
|
|
520
|
+
const conversationId = process.env.CONVERSATION_ID || dev.json?.runtimeConversationId || '';
|
|
521
|
+
if (CONVERSATION.test(conversationId)) process.env.CONVERSATION_ID = conversationId;
|
|
522
|
+
const browserSession = `icb-${ctx.session}-${Date.now().toString(36)}`;
|
|
523
|
+
// The first frame is the open receipt only without --shot; --shot is taken after readiness below.
|
|
524
|
+
const output = artifactPath(ctx, flags.shot ? 'open-initial' : 'open');
|
|
525
|
+
const capture = await runScript('capture-feed-card.sh', ['--output', output, '--session-name', browserSession,
|
|
526
|
+
'--state-file', ctx.statePath, '--keep-open', '--preview-scene', scene, '--wait-ms', String(timeoutMs),
|
|
527
|
+
'--width', String((requestedViewport ?? DEFAULT_VIEWPORT).width), '--height', String((requestedViewport ?? DEFAULT_VIEWPORT).height)],
|
|
528
|
+
{ timeoutMs: timeoutMs + 120000 });
|
|
529
|
+
state = readJson(ctx.statePath) ?? capture.json;
|
|
530
|
+
if (!state?.ok) {
|
|
531
|
+
addArtifact(ctx, 'diagnostic', state?.diagnosticScreenshot);
|
|
532
|
+
const blocked = state?.status === 'blocked' || capture.code === 4;
|
|
533
|
+
throw new CliError(blocked ? 'CAPTURE_BLOCKED' : 'CAPTURE_FAILED',
|
|
534
|
+
state?.error || capture.stderr.trim().split('\n').slice(-3).join(' ') || `capture exited ${capture.code}`,
|
|
535
|
+
blocked ? EXIT.blocked : EXIT.failed,
|
|
536
|
+
{ data: { stage: state?.stage, state: state?.state, webgl: state?.webgl, lastInspection: state?.lastInspection } });
|
|
537
|
+
}
|
|
538
|
+
if (!flags.shot && pageSpec === 'card') addArtifact(ctx, 'screenshot', output);
|
|
539
|
+
ctx.meta = { browserSession, conversationId: process.env.CONVERSATION_ID ?? '', scene, page: 'card', route: '', url: state.previewUrl,
|
|
540
|
+
viewport: requestedViewport ?? DEFAULT_VIEWPORT, openedAt: new Date().toISOString() };
|
|
541
|
+
saveMeta(ctx);
|
|
542
|
+
if (state.webgl) data.webgl = state.webgl;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
const current = ctx.meta.viewport ?? state.viewport ?? DEFAULT_VIEWPORT;
|
|
546
|
+
if (reused && requestedViewport && (requestedViewport.width !== current.width || requestedViewport.height !== current.height)) {
|
|
547
|
+
requireOk('viewport', await browserCommand(ctx, ['set', 'viewport', String(requestedViewport.width), String(requestedViewport.height)]), 'VIEWPORT_FAILED');
|
|
548
|
+
ctx.meta = { ...ctx.meta, viewport: requestedViewport };
|
|
549
|
+
saveMeta(ctx);
|
|
550
|
+
}
|
|
551
|
+
data.viewport = ctx.meta.viewport ?? current;
|
|
552
|
+
if (pageSpec === 'card' && reused && ctx.meta.page === 'landing') {
|
|
553
|
+
requireOk('navigate', await browserCommand(ctx, ['open', state.previewUrl], 30000), 'NAVIGATE_FAILED');
|
|
554
|
+
requireOk('inject', await runScript('preview-session.mjs', ['inject', '--session-file', ctx.statePath, state.feedFile, '--reload'],
|
|
555
|
+
{ timeoutMs: 60000 }), 'INJECT_FAILED');
|
|
556
|
+
ctx.meta = { ...ctx.meta, page: 'card', route: '', url: state.previewUrl };
|
|
557
|
+
saveMeta(ctx);
|
|
558
|
+
}
|
|
559
|
+
if (pageSpec !== 'card') {
|
|
560
|
+
const route = pageSpec === 'landing' ? '' : pageSpec;
|
|
561
|
+
let url = state.landingPreviewUrl;
|
|
562
|
+
if (!url) throw new CliError('NO_LANDING', 'This preview has no landing page', EXIT.failed);
|
|
563
|
+
if (route) url = requireOk('landing-url', await runScript('preview-session.mjs', ['landing-url', url, route], { timeoutMs: 10000 }), 'USAGE').url;
|
|
564
|
+
requireOk('navigate', await browserCommand(ctx, ['open', url], 30000), 'NAVIGATE_FAILED');
|
|
565
|
+
ctx.meta = { ...ctx.meta, page: 'landing', route, url };
|
|
566
|
+
saveMeta(ctx);
|
|
567
|
+
const waited = await waitConditions(ctx, 'landing', route ? [{ kind: 'route', value: route, spec: `route:${route}` }] : [{ kind: 'stable' }], timeoutMs);
|
|
568
|
+
if (waited.failure) throw waited.failure;
|
|
569
|
+
}
|
|
570
|
+
const inKey = ctx.meta.page === 'landing' ? 'landing' : 'card';
|
|
571
|
+
const expectations = await checkExpectations(ctx, inKey, flags, timeoutMs);
|
|
572
|
+
if (flags.shot) {
|
|
573
|
+
await screenshot(ctx, inKey, { name: typeof flags.shot === 'string' ? flags.shot : 'open' });
|
|
574
|
+
}
|
|
575
|
+
return { outcome: reused ? 'reused' : 'opened', expect: expectations.report, failure: expectations.failure,
|
|
576
|
+
data: { ...data, ...expectations.data, previewMessageAttempts: state.previewMessageAttempts } };
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
async function verbAct(ctx, flags, positional, timeoutMs) {
|
|
580
|
+
const [op, extra] = positional;
|
|
581
|
+
if (!ACT_OPS.includes(op)) throw usage(`act takes one of ${ACT_OPS.join(' | ')}`);
|
|
582
|
+
openState(ctx);
|
|
583
|
+
const inKey = resolveIn(flags.in, ctx.meta);
|
|
584
|
+
const scope = IN_VALUES[inKey];
|
|
585
|
+
const conditions = flags.expect.map(parseCondition);
|
|
586
|
+
const watch = await startRequestWatch(ctx, inKey, conditions, Math.min(timeoutMs, 15000));
|
|
587
|
+
const shotName = flags.shot ? sanitizeName(typeof flags.shot === 'string' ? flags.shot : '', `${op}-${stamp()}`) : '';
|
|
588
|
+
let outcome = 'confirmed';
|
|
589
|
+
let data;
|
|
590
|
+
let shotDone = false;
|
|
591
|
+
if (op === 'press') {
|
|
592
|
+
const key = flags.key ?? extra;
|
|
593
|
+
if (!key) throw usage('act press needs --key <Enter|Tab|...>');
|
|
594
|
+
requireOk('press', await browserCommand(ctx, ['press', key]), 'ACTION_FAILED');
|
|
595
|
+
} else {
|
|
596
|
+
const target = flags.target ? parseTarget(flags.target, flags.occurrence) : undefined;
|
|
597
|
+
if (['click', 'fill'].includes(op) && !target) throw usage(`act ${op} needs --target`);
|
|
598
|
+
if (op === 'fill' && typeof flags.value !== 'string') throw usage('act fill needs --value');
|
|
599
|
+
if (op !== 'fill' && flags.value !== undefined) {
|
|
600
|
+
throw usage(op === 'scroll' ? 'act scroll takes --position top|bottom or --delta <px>, not --value'
|
|
601
|
+
: `--value is only for act fill`);
|
|
602
|
+
}
|
|
603
|
+
if (target?.kind === 'ref') {
|
|
604
|
+
const args = op === 'fill' ? ['fill', target.ref, flags.value] : op === 'click' ? ['click', target.ref] : ['scrollintoview', target.ref];
|
|
605
|
+
requireOk(op, await browserCommand(ctx, args), 'ACTION_FAILED');
|
|
606
|
+
} else if (target?.kind === 'xy') {
|
|
607
|
+
if (op !== 'click') throw usage(op === 'scroll' ? 'xy targets support act click only; scroll with --position top|bottom or --delta <px>' : 'xy targets support act click only');
|
|
608
|
+
try {
|
|
609
|
+
data = await pointClick(ctx, target);
|
|
610
|
+
} catch (error) {
|
|
611
|
+
if (watch) watch.handle.child.kill('SIGTERM');
|
|
612
|
+
throw error;
|
|
613
|
+
}
|
|
614
|
+
} else {
|
|
615
|
+
const action = { scope, op };
|
|
616
|
+
if (target) action.target = target.target;
|
|
617
|
+
if (op === 'fill') action.value = flags.value;
|
|
618
|
+
if (op === 'scroll') {
|
|
619
|
+
if (flags.position) {
|
|
620
|
+
if (!['top', 'bottom'].includes(flags.position)) throw usage('--position must be top or bottom');
|
|
621
|
+
action.position = flags.position;
|
|
622
|
+
} else if (flags.delta !== undefined) {
|
|
623
|
+
if (!Number.isFinite(Number(flags.delta))) throw usage('--delta must be a number of pixels');
|
|
624
|
+
action.deltaY = Number(flags.delta);
|
|
625
|
+
} else if (!target) action.deltaY = 600;
|
|
626
|
+
}
|
|
627
|
+
if (op === 'wait') {
|
|
628
|
+
const ms = Number(extra ?? 1000);
|
|
629
|
+
if (!Number.isInteger(ms) || ms < 1 || ms > 30000) throw usage('act wait takes 1..30000 ms');
|
|
630
|
+
action.ms = ms;
|
|
631
|
+
}
|
|
632
|
+
if (flags.route) action.expectedRoute = flags.route;
|
|
633
|
+
if (shotName) { action.capture = { output: artifactPath(ctx, shotName), delayMs: 300 }; shotDone = true; }
|
|
634
|
+
const result = await runScript('preview-frame-action.mjs', ['--session-file', ctx.statePath,
|
|
635
|
+
jsonArg(ctx, 'action', action), ...landingUrlArgs(ctx, scope)], { timeoutMs: timeoutMs + 15000 });
|
|
636
|
+
data = result.json;
|
|
637
|
+
outcome = result.json?.operation?.outcome ?? (result.code === 0 ? 'confirmed' : 'unknown');
|
|
638
|
+
if (result.code !== 0 || result.json?.ok === false) {
|
|
639
|
+
if (watch) watch.handle.child.kill('SIGTERM');
|
|
640
|
+
const failure = childFailure(`act ${op}`, result, 'ACTION_FAILED');
|
|
641
|
+
failure.extra.outcome = outcome;
|
|
642
|
+
if (!failure.extra.nextSteps && inKey === 'card' && !flags.in && target && notFound(result.json)) {
|
|
643
|
+
failure.extra.nextSteps = [`act ${op} --in host --target ${flags.target}`, 'open --page landing', 'read map'];
|
|
644
|
+
failure.message += '. Not found in the card: Feed shell controls (title, 不感兴趣, the button under the card) need --in host; landing-page elements need open --page landing';
|
|
645
|
+
}
|
|
646
|
+
throw failure;
|
|
647
|
+
}
|
|
648
|
+
if (action.capture) addArtifact(ctx, 'screenshot', action.capture.output);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
const expectations = await checkExpectations(ctx, inKey, flags, timeoutMs, watch);
|
|
652
|
+
if (shotName && !shotDone) await screenshot(ctx, inKey, { name: shotName });
|
|
653
|
+
const match = data?.match;
|
|
654
|
+
const hint = op === 'scroll' && match && match.moved === false && !match.atBoundary
|
|
655
|
+
? 'The page did not move; scroll the page with --position top|bottom or --delta <px> instead of a --target element' : undefined;
|
|
656
|
+
return { outcome, expect: expectations.report, failure: expectations.failure,
|
|
657
|
+
data: { ...(data ? { action: summarizeAction(data) } : {}), ...expectations.data, ...(hint ? { hint } : {}) } };
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
const UNKNOWN_WRITE = 'Previous action result is unknown; inspect the business result before rebuilding, do not replay it';
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* act click --target xy: through agent-browser mouse move / down / up, on the same write lifecycle as the
|
|
664
|
+
* DOM clicks of preview-frame-action.mjs: the session file's lastOperation is unknown from the press until the
|
|
665
|
+
* release is confirmed, and a previous unknown write blocks this click before anything is sent. A failed or
|
|
666
|
+
* timed-out down/up stays unknown (the page may have the event) and records that the pointer may still be
|
|
667
|
+
* pressed; nothing is retried or released here, since a late up could finish the click.
|
|
668
|
+
*/
|
|
669
|
+
async function pointClick(ctx, target) {
|
|
670
|
+
const session = readJson(ctx.statePath) ?? {};
|
|
671
|
+
if (session.lastOperation?.outcome === 'unknown') {
|
|
672
|
+
throw new CliError('ACTION_RESULT_UNKNOWN', UNKNOWN_WRITE, EXIT.failed,
|
|
673
|
+
{ outcome: 'not-dispatched', data: { lastOperation: session.lastOperation } });
|
|
674
|
+
}
|
|
675
|
+
const point = { x: target.x, y: target.y };
|
|
676
|
+
const operation = { id: randomUUID(), op: 'click', target: `xy:${point.x},${point.y}`, startedAt: new Date().toISOString(),
|
|
677
|
+
stage: 'mouse-move', outcome: 'not-dispatched' };
|
|
678
|
+
const persist = () => writeSessionFile(ctx.statePath, { ...(readJson(ctx.statePath) ?? session), lastOperation: { ...operation } });
|
|
679
|
+
const send = async args => {
|
|
680
|
+
const result = await browserCommand(ctx, args);
|
|
681
|
+
if (result.code !== 0 || (result.json && result.json.ok === false)) {
|
|
682
|
+
const failure = childFailure('click', result, 'ACTION_FAILED');
|
|
683
|
+
failure.extra.outcome = operation.outcome;
|
|
684
|
+
failure.extra.data = { ...failure.extra.data, operation: { ...operation } };
|
|
685
|
+
if (operation.outcome === 'unknown') {
|
|
686
|
+
failure.message += '. The click may have reached the page; check it with shot or read text before another click, do not replay it';
|
|
687
|
+
}
|
|
688
|
+
throw failure;
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
// A move alone is not a click: if it fails nothing was written.
|
|
692
|
+
await send(['mouse', 'move', String(point.x), String(point.y)]);
|
|
693
|
+
Object.assign(operation, { stage: 'mouse-pressed', outcome: 'unknown', pointer: { ...point, state: 'maybe-pressed' } });
|
|
694
|
+
persist();
|
|
695
|
+
try {
|
|
696
|
+
await send(['mouse', 'down']);
|
|
697
|
+
Object.assign(operation, { stage: 'mouse-released', pointer: { ...point, state: 'pressed' } });
|
|
698
|
+
persist();
|
|
699
|
+
await send(['mouse', 'up']);
|
|
700
|
+
} catch (error) {
|
|
701
|
+
operation.pointer = { ...point, state: 'maybe-pressed' };
|
|
702
|
+
error.extra.data = { ...error.extra.data, operation: { ...operation } };
|
|
703
|
+
persist();
|
|
704
|
+
throw error;
|
|
705
|
+
}
|
|
706
|
+
Object.assign(operation, { stage: 'action-confirmed', outcome: 'confirmed' });
|
|
707
|
+
delete operation.pointer;
|
|
708
|
+
persist();
|
|
709
|
+
return { ok: true, operation, match: { point, dispatchMethod: 'agent-browser-mouse' } };
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
const notFound = json => json?.code === 'TARGET_NOT_FOUND'
|
|
713
|
+
|| (json?.attempts ?? []).some(item => /not-found/u.test(String(item?.reason ?? '')));
|
|
714
|
+
|
|
715
|
+
// Keeps the adapter's useful fields; the full receipt stays in the work dir for detail.
|
|
716
|
+
const summarizeAction = json => {
|
|
717
|
+
const { ok, operation, route, renderedRoute, scroll, before, after, moved, atBoundary, navigationSignal, target, matched } = json;
|
|
718
|
+
// match carries the per-op result (scroll before/after, click point, fill value); drop its document identity.
|
|
719
|
+
const match = json.match && typeof json.match === 'object'
|
|
720
|
+
? Object.fromEntries(Object.entries(json.match).filter(([key]) => !['targetId', 'targetUrl', 'documentUrl', 'frameId'].includes(key)))
|
|
721
|
+
: undefined;
|
|
722
|
+
return Object.fromEntries(Object.entries({ ok, operation, route, renderedRoute, scroll, before, after, moved, atBoundary,
|
|
723
|
+
navigationSignal, target, matched, match }).filter(([, value]) => value !== undefined));
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
async function verbRead(ctx, flags, positional, timeoutMs) {
|
|
727
|
+
const [kind] = positional;
|
|
728
|
+
if (!READ_KINDS.includes(kind)) throw usage(`read takes one of ${READ_KINDS.join(' | ')}`);
|
|
729
|
+
if (kind === 'env') return readEnv(ctx);
|
|
730
|
+
openState(ctx);
|
|
731
|
+
const inKey = resolveIn(flags.in, ctx.meta);
|
|
732
|
+
const scope = readScope(inKey);
|
|
733
|
+
const scopeArgs = scope === 'landing-page' ? ['--scope', 'landing-page'] : [];
|
|
734
|
+
const routeArgs = flags.route ? ['--expected-route', flags.route] : [];
|
|
735
|
+
let result;
|
|
736
|
+
if (kind === 'map') {
|
|
737
|
+
result = await runScript('preview-frame-map.mjs', ['--session', ctx.meta.browserSession, '--session-file', ctx.statePath,
|
|
738
|
+
'--timeout-ms', String(Math.min(timeoutMs, 120000))], { timeoutMs: timeoutMs + 10000 });
|
|
739
|
+
} else if (kind === 'text' || (kind === 'state' && !flags.fields)) {
|
|
740
|
+
result = await runScript('inspect-preview-state.mjs', ['--session-file', ctx.statePath, ...scopeArgs,
|
|
741
|
+
...landingUrlArgs(ctx, scope), ...routeArgs, ...(kind === 'text' ? ['--with-text'] : []),
|
|
742
|
+
'--timeout-ms', String(timeoutMs)], { timeoutMs: timeoutMs + 10000 });
|
|
743
|
+
} else if (kind === 'state') {
|
|
744
|
+
const output = artifactPath(ctx, `observe-${stamp()}`, 'json');
|
|
745
|
+
result = await runScript('preview-session.mjs', ['observe', '--session-file', ctx.statePath, ...landingUrlArgs(ctx, scope),
|
|
746
|
+
scope, output, jsonArg(ctx, 'fields', readJsonOption(flags.fields, '--fields'))], { timeoutMs: timeoutMs + 10000 });
|
|
747
|
+
addArtifact(ctx, 'evidence', output);
|
|
748
|
+
} else if (kind === 'layout') {
|
|
749
|
+
const selectors = readJsonOption(flags.selectors, '--selectors');
|
|
750
|
+
if (!selectors) throw usage('read layout needs --selectors \'[".selector"]\'');
|
|
751
|
+
result = await runScript('inspect-preview-state.mjs', ['--session-file', ctx.statePath, ...scopeArgs,
|
|
752
|
+
...landingUrlArgs(ctx, scope), ...routeArgs, '--selectors-json', jsonArg(ctx, 'selectors', selectors),
|
|
753
|
+
'--timeout-ms', String(timeoutMs)], { timeoutMs: timeoutMs + 10000 });
|
|
754
|
+
} else if (kind === 'console') {
|
|
755
|
+
if (flags.detail) {
|
|
756
|
+
const options = { durationMs: Number(flags.duration ?? 8000), ...(flags.reload ? { reload: true } : {}),
|
|
757
|
+
...(flags.limit ? { limit: Number(flags.limit) } : {}) };
|
|
758
|
+
result = await runScript('preview-console-trace.mjs', ['--session', ctx.meta.browserSession, '--session-file', ctx.statePath,
|
|
759
|
+
JSON.stringify(options)], { timeoutMs: options.durationMs + 60000 });
|
|
760
|
+
} else {
|
|
761
|
+
if (flags.level && !['error', 'warning', 'all'].includes(flags.level)) throw usage('--level must be error, warning or all');
|
|
762
|
+
result = await runScript('preview-console.mjs', ['--session', ctx.meta.browserSession, '--session-file', ctx.statePath,
|
|
763
|
+
...(flags.level ? ['--level', flags.level] : []), ...(flags.limit ? ['--limit', flags.limit] : []),
|
|
764
|
+
...(flags.clear ? ['--clear'] : []), ...(flags.reload ? ['--reload'] : [])], { timeoutMs: timeoutMs + 20000 });
|
|
765
|
+
}
|
|
766
|
+
} else if (kind === 'network') {
|
|
767
|
+
if (!flags.match) throw usage('read network needs --match <url part>');
|
|
768
|
+
const durationMs = Number(flags.duration ?? 8000);
|
|
769
|
+
if (!Number.isInteger(durationMs) || durationMs < 1 || durationMs > 120000) throw usage('--duration takes 1..120000 ms');
|
|
770
|
+
result = await runScript('observe-preview-network.mjs', ['--session-file', ctx.statePath, ...scopeArgs,
|
|
771
|
+
...landingUrlArgs(ctx, scope), JSON.stringify({ durationMs, urlIncludes: flags.match })], { timeoutMs: durationMs + 30000 });
|
|
772
|
+
}
|
|
773
|
+
const json = requireOk(`read ${kind}`, result, 'READ_FAILED');
|
|
774
|
+
if (kind === 'map' && json.business?.route && inKey === 'landing') { ctx.meta.route = json.business.route; saveMeta(ctx); }
|
|
775
|
+
const fileOut = artifactPath(ctx, `read-${kind}-${stamp()}`, 'json');
|
|
776
|
+
writeJson(fileOut, json);
|
|
777
|
+
addArtifact(ctx, 'receipt', fileOut);
|
|
778
|
+
return { outcome: 'read', expect: [], data: json };
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
async function readEnv(ctx) {
|
|
782
|
+
const [dev, webgl, health] = await Promise.all([
|
|
783
|
+
runScript('wait-dev-status.mjs', [], { timeoutMs: 20000 }),
|
|
784
|
+
runScript('ensure-webgl.mjs', ['--check'], { timeoutMs: 20000 }),
|
|
785
|
+
runScript('probe-browser-health.mjs', [], { timeoutMs: 20000 }),
|
|
786
|
+
]);
|
|
787
|
+
const resume = fs.existsSync(ctx.statePath)
|
|
788
|
+
? await runScript('resume-check.mjs', ['--session-file', ctx.statePath], { timeoutMs: 20000 }) : undefined;
|
|
789
|
+
const data = {
|
|
790
|
+
dev: dev.json ?? { ok: false, error: dev.timedOut ? 'dev/status not ready within 20s' : dev.stderr.slice(-300) },
|
|
791
|
+
webgl: webgl.json ?? { ok: false }, browser: health.json ?? { ok: false },
|
|
792
|
+
session: resume?.json ? { decision: resume.json.decision, reasons: resume.json.reasons, nextSteps: resume.json.nextSteps } : { decision: 'none' },
|
|
793
|
+
};
|
|
794
|
+
return { outcome: 'read', expect: [], data };
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
async function verbWait(ctx, flags, positional, timeoutMs) {
|
|
798
|
+
openState(ctx);
|
|
799
|
+
const specs = [...positional, ...flags.expect];
|
|
800
|
+
if (!specs.length) throw usage(`wait takes one or more of ${CONDITIONS.join(' | ')}`);
|
|
801
|
+
const inKey = resolveIn(flags.in, ctx.meta);
|
|
802
|
+
const conditions = specs.map(parseCondition);
|
|
803
|
+
const requests = conditions.filter(item => item.kind === 'request');
|
|
804
|
+
const watch = requests.length ? await startRequestWatch(ctx, inKey, requests, Math.min(timeoutMs, 120000)) : undefined;
|
|
805
|
+
const result = await checkExpectations(ctx, inKey, { expect: specs }, timeoutMs, watch);
|
|
806
|
+
if (flags.shot) await screenshot(ctx, inKey, { name: typeof flags.shot === 'string' ? flags.shot : `wait-${stamp()}` });
|
|
807
|
+
return { outcome: 'waited', expect: result.report, failure: result.failure, data: result.data };
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
async function verbShot(ctx, flags, _positional, timeoutMs) {
|
|
811
|
+
openState(ctx);
|
|
812
|
+
const inKey = resolveIn(flags.in, ctx.meta);
|
|
813
|
+
const area = flags.area ?? 'page';
|
|
814
|
+
if (!(area in SHOT_AREAS)) throw usage(`--area must be ${Object.keys(SHOT_AREAS).join(' | ')}`);
|
|
815
|
+
if (area === 'face' && (ctx.meta.page === 'landing' || inKey === 'landing')) {
|
|
816
|
+
throw new CliError('USAGE', 'shot --area face needs the card page; run open first (without --page landing)', EXIT.usage,
|
|
817
|
+
{ nextSteps: ['open', 'shot --area face'] });
|
|
818
|
+
}
|
|
819
|
+
if (area === 'face' && flags.full) throw usage('shot --area face cannot be combined with --full');
|
|
820
|
+
const conditions = flags.expect.map(parseCondition).filter(item => item.kind !== 'request' && item.kind !== 'ms');
|
|
821
|
+
const output = await screenshot(ctx, inKey, { name: flags.name ?? (typeof flags.shot === 'string' ? flags.shot : undefined),
|
|
822
|
+
full: Boolean(flags.full), readiness: conditions.length ? readinessFor(conditions, timeoutMs) : undefined,
|
|
823
|
+
clipSelector: SHOT_AREAS[area] ?? undefined });
|
|
824
|
+
return { outcome: 'captured', expect: conditions.map(item => ({ cond: item.spec ?? item.kind, ok: true })),
|
|
825
|
+
data: { path: output, area, ...(ctx.fullShot ?? {}) } };
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const cleanArtifacts = ctx => {
|
|
829
|
+
const removed = pruneArtifacts(ctx.artifactsDir, { keep: 0, maxAgeMs: -1 });
|
|
830
|
+
return { cleaned: removed.length };
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
async function verbClose(ctx, flags = {}) {
|
|
834
|
+
if (!fs.existsSync(ctx.statePath)) return { outcome: 'already-closed', expect: [], data: flags.clean ? cleanArtifacts(ctx) : {} };
|
|
835
|
+
const result = await runScript('close-session.mjs', ['--session-file', ctx.statePath], { timeoutMs: 30000 });
|
|
836
|
+
ctx.meta = { ...ctx.meta, closedAt: new Date().toISOString() };
|
|
837
|
+
delete ctx.meta.browserSession;
|
|
838
|
+
saveMeta(ctx);
|
|
839
|
+
requireOk('close', result, 'CLOSE_FAILED');
|
|
840
|
+
return { outcome: 'closed', expect: [], data: { ...result.json, ...(flags.clean ? cleanArtifacts(ctx) : {}) } };
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
const sessionIsOpen = ctx => Boolean(ctx.meta?.browserSession) && Boolean(readJson(ctx.statePath)?.sessionOpen);
|
|
844
|
+
|
|
845
|
+
async function verbRun(ctx, flags) {
|
|
846
|
+
const steps = typeof flags.steps === 'object' ? flags.steps : readJsonOption(flags.steps, '--steps');
|
|
847
|
+
if (!Array.isArray(steps) || !steps.length || steps.length > 30) throw usage('--steps must be a JSON array of 1..30 argv arrays');
|
|
848
|
+
const argvs = steps.map((step, index) => {
|
|
849
|
+
const argv = Array.isArray(step) ? step.map(String) : typeof step === 'object' && step?.verb ? [step.verb, ...(step.args ?? []).map(String)] : undefined;
|
|
850
|
+
if (!argv?.length || ['run', 'describe', 'snap'].includes(argv[0])) throw usage(`steps[${index}] must be an argv array of a verb other than run/snap/describe`);
|
|
851
|
+
return argv;
|
|
852
|
+
});
|
|
853
|
+
const wasOpen = sessionIsOpen(ctx);
|
|
854
|
+
const results = [];
|
|
855
|
+
let failure;
|
|
856
|
+
let opened = false;
|
|
857
|
+
for (const [index, argv] of argvs.entries()) {
|
|
858
|
+
if (argv[0] === 'open') opened = true;
|
|
859
|
+
const receipt = await execute(argv.includes('--session') ? argv : [...argv, '--session', ctx.session], { nested: true });
|
|
860
|
+
for (const artifact of receipt.artifacts) {
|
|
861
|
+
// snap only wants its final shot: the open receipt frame is dropped (and deleted so it does not pile up).
|
|
862
|
+
if (flags.dropOpenFrame && argv[0] === 'open' && artifact.kind === 'screenshot') { fs.rmSync(artifact.path, { force: true }); continue; }
|
|
863
|
+
if (!ctx.artifacts.some(item => item.path === artifact.path)) ctx.artifacts.push(artifact);
|
|
864
|
+
}
|
|
865
|
+
results.push({ step: index, verb: receipt.verb, ok: receipt.ok, code: receipt.code, outcome: receipt.outcome,
|
|
866
|
+
expect: receipt.expect, ...(receipt.error ? { error: receipt.error } : {}), data: receipt.data });
|
|
867
|
+
if (!receipt.ok) {
|
|
868
|
+
failure = new CliError(receipt.code, `steps[${index}] ${argv[0]} failed: ${receipt.error ?? receipt.code}`, receipt.exit ?? EXIT.failed,
|
|
869
|
+
receipt.nextSteps ? { nextSteps: receipt.nextSteps } : {});
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
ctx.meta = readJson(ctx.metaPath) ?? ctx.meta;
|
|
874
|
+
// A session this run opened is closed even when a step failed, so a one-off run never leaves a browser behind.
|
|
875
|
+
let autoClose;
|
|
876
|
+
if (opened && !wasOpen && !flags.keepOpen && sessionIsOpen(ctx)) {
|
|
877
|
+
const receipt = await execute(['close', '--session', ctx.session], { nested: true });
|
|
878
|
+
autoClose = { ok: receipt.ok, outcome: receipt.outcome, ...(receipt.error ? { error: receipt.error } : {}) };
|
|
879
|
+
ctx.meta = readJson(ctx.metaPath) ?? ctx.meta;
|
|
880
|
+
}
|
|
881
|
+
return { outcome: failure ? 'stopped' : 'completed', expect: [], failure,
|
|
882
|
+
data: { steps: results, ...(autoClose ? { autoClose } : {}) } };
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/** Flags snap reads; parseArgs accepts every verb's flags, so anything else would be silently dropped. */
|
|
886
|
+
const SNAP_FLAGS = new Set(['page', 'scene', 'viewport', 'timeout', 'in', 'name', 'area', 'full', 'expect', 'keepOpen',
|
|
887
|
+
'steps_', 'session', 'help']);
|
|
888
|
+
|
|
889
|
+
export const rejectSnapFlags = flags => {
|
|
890
|
+
for (const [key, value] of Object.entries(flags)) {
|
|
891
|
+
if (SNAP_FLAGS.has(key) || (Array.isArray(value) && !value.length)) continue;
|
|
892
|
+
const flag = `--${key.replace(/[A-Z]/gu, c => `-${c.toLowerCase()}`)}`;
|
|
893
|
+
if (key === 'target') throw usage('snap does not take --target; click with --click <target> (repeatable, in order)');
|
|
894
|
+
throw usage(`snap does not take ${flag}; see describe snap`);
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
/** snap = open + the --click/--wait steps in command-line order + shot, then close (via run). */
|
|
899
|
+
async function verbSnap(ctx, flags) {
|
|
900
|
+
rejectSnapFlags(flags);
|
|
901
|
+
const page = flags.page ?? 'card';
|
|
902
|
+
const area = flags.area ?? 'page';
|
|
903
|
+
if (!(area in SHOT_AREAS)) throw usage(`--area must be one of ${Object.keys(SHOT_AREAS).join(' | ')}`);
|
|
904
|
+
if (area === 'face' && page !== 'card') throw usage('snap --area face needs the card page; leave out --page or use --page card');
|
|
905
|
+
if (area === 'face' && flags.full) throw usage('--area face cannot be combined with --full');
|
|
906
|
+
const pass = (name, value) => (value === undefined ? [] : [name, String(value)]);
|
|
907
|
+
parseViewport(flags.viewport);
|
|
908
|
+
// Check click targets (e.g. a malformed xy:) before a browser is opened for nothing.
|
|
909
|
+
for (const step of flags.steps_ ?? []) if (step.kind === 'click') parseTarget(step.value);
|
|
910
|
+
const steps = [['open', ...pass('--scene', flags.scene), ...pass('--page', flags.page), ...pass('--viewport', flags.viewport), ...pass('--timeout', flags.timeout)]];
|
|
911
|
+
for (const step of flags.steps_ ?? []) {
|
|
912
|
+
if (step.kind === 'click') steps.push(['act', 'click', '--target', step.value, ...pass('--in', flags.in)]);
|
|
913
|
+
else steps.push(['wait', step.value]);
|
|
914
|
+
}
|
|
915
|
+
steps.push(['shot', ...pass('--name', flags.name), ...pass('--area', flags.area), ...(flags.full ? ['--full'] : []),
|
|
916
|
+
...flags.expect.flatMap(cond => ['--expect', cond])]);
|
|
917
|
+
if (steps.length > 30) throw usage('snap takes at most 28 --click/--wait steps');
|
|
918
|
+
const result = await verbRun(ctx, { steps, keepOpen: flags.keepOpen, dropOpenFrame: true });
|
|
919
|
+
return { ...result, outcome: result.failure ? 'stopped' : 'captured' };
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// ---------- dispatch ----------
|
|
923
|
+
|
|
924
|
+
const pageOf = ctx => (ctx?.meta?.scene ? {
|
|
925
|
+
scene: ctx.meta.scene, in: ctx.meta.page === 'landing' ? 'landing' : 'card', route: ctx.meta.route ?? '', url: ctx.meta.url ?? '',
|
|
926
|
+
} : null);
|
|
927
|
+
|
|
928
|
+
export const execute = async (argv, { nested = false } = {}) => {
|
|
929
|
+
let ctx;
|
|
930
|
+
let verb = argv[0] ?? '';
|
|
931
|
+
try {
|
|
932
|
+
const parsed = parseArgs(argv);
|
|
933
|
+
verb = parsed.verb;
|
|
934
|
+
if (!verb || verb === 'describe' || parsed.flags.help) {
|
|
935
|
+
return { protocol: PROTOCOL, ok: true, code: 'OK', verb: 'describe', session: null, page: null, outcome: 'described',
|
|
936
|
+
expect: [], data: describe(), artifacts: [], exit: EXIT.ok };
|
|
937
|
+
}
|
|
938
|
+
if (!VERBS[verb]) throw usage(`Unknown verb ${verb}; one of ${Object.keys(VERBS).join(' | ')}`);
|
|
939
|
+
if (nested && (verb === 'run' || verb === 'snap')) throw usage(`${verb} cannot be nested`);
|
|
940
|
+
const timeoutMs = parseTimeout(parsed.flags.timeout, verb === 'open' ? 60000 : 30000);
|
|
941
|
+
ctx = createContext(parsed.flags);
|
|
942
|
+
const handlers = { open: verbOpen, act: verbAct, read: verbRead, wait: verbWait, shot: verbShot, close: verbClose, run: verbRun, snap: verbSnap };
|
|
943
|
+
const result = verb === 'open' ? await verbOpen(ctx, parsed.flags, timeoutMs)
|
|
944
|
+
: await handlers[verb](ctx, parsed.flags, parsed.positional, timeoutMs);
|
|
945
|
+
const failure = result.failure;
|
|
946
|
+
return {
|
|
947
|
+
protocol: PROTOCOL, ok: !failure, code: failure ? failure.code : 'OK', verb, session: ctx.session, page: pageOf(ctx),
|
|
948
|
+
outcome: result.outcome, expect: result.expect ?? [], data: result.data ?? {}, artifacts: ctx.artifacts,
|
|
949
|
+
...(failure ? { error: failure.message, ...(failure.extra?.nextSteps ? { nextSteps: failure.extra.nextSteps } : {}) } : {}),
|
|
950
|
+
exit: failure ? failure.exit : EXIT.ok,
|
|
951
|
+
};
|
|
952
|
+
} catch (error) {
|
|
953
|
+
const known = error instanceof CliError;
|
|
954
|
+
return {
|
|
955
|
+
protocol: PROTOCOL, ok: false, code: known ? error.code : 'INTERNAL', verb, session: ctx?.session ?? null, page: pageOf(ctx),
|
|
956
|
+
outcome: error.extra?.outcome ?? (known && error.exit === EXIT.usage ? 'not-run' : 'failed'), expect: [],
|
|
957
|
+
data: error.extra?.data ?? {}, artifacts: ctx?.artifacts ?? [], error: error.message,
|
|
958
|
+
...(error.extra?.nextSteps ? { nextSteps: error.extra.nextSteps } : {}),
|
|
959
|
+
exit: known ? error.exit : EXIT.failed,
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
const isMain = process.argv[1] && fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
|
|
965
|
+
if (isMain) {
|
|
966
|
+
const receipt = await execute(process.argv.slice(2));
|
|
967
|
+
const { exit, ...printed } = receipt;
|
|
968
|
+
process.stdout.write(`${JSON.stringify(printed)}\n`);
|
|
969
|
+
process.exitCode = exit;
|
|
970
|
+
}
|