@william_jin/autobrowse 0.8.4 → 0.8.6
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.md +10 -40
- package/README.md +114 -71
- package/assets/live-view/AppIcon.icns +0 -0
- package/assets/live-view/hub.html +797 -0
- package/assets/live-view/toast.html +36 -0
- package/assets/live-view/viewer.html +921 -0
- package/assets/overlay/bin/darwin-arm64/overlay-host +0 -0
- package/assets/overlay/bin/darwin-x64/overlay-host +0 -0
- package/assets/overlay/bin/linux-arm64/overlay-host +0 -0
- package/assets/overlay/bin/linux-x64/overlay-host +0 -0
- package/assets/overlay/bin/win32-arm64/overlay-host.exe +0 -0
- package/assets/overlay/bin/win32-x64/overlay-host.exe +0 -0
- package/dist/access/keys.d.ts +1 -1
- package/dist/agent/builder.d.ts +1 -1
- package/dist/agent/builder.js +1 -1
- package/dist/agent/builder.js.map +1 -1
- package/dist/agent/digest.d.ts +21 -1
- package/dist/agent/digest.js +17 -2
- package/dist/agent/digest.js.map +1 -1
- package/dist/agent/explorer.d.ts +132 -28
- package/dist/agent/explorer.js +126 -21
- package/dist/agent/explorer.js.map +1 -1
- package/dist/agent/heal.d.ts +15 -2
- package/dist/agent/heal.js +53 -3
- package/dist/agent/heal.js.map +1 -1
- package/dist/agent/records.js +2 -2
- package/dist/agent/run-json.d.ts +32 -0
- package/dist/agent/run-json.js +36 -0
- package/dist/agent/run-json.js.map +1 -0
- package/dist/agent/sessions.d.ts +12 -1
- package/dist/agent/sessions.js +45 -12
- package/dist/agent/sessions.js.map +1 -1
- package/dist/app/backend.d.ts +9 -1
- package/dist/app/backend.js +63 -9
- package/dist/app/backend.js.map +1 -1
- package/dist/app/box.d.ts +1 -1
- package/dist/app/box.js +2 -8
- package/dist/app/box.js.map +1 -1
- package/dist/app/cli-auth.d.ts +1 -1
- package/dist/app/cli-auth.js +131 -35
- package/dist/app/cli-auth.js.map +1 -1
- package/dist/app/cli-authbridge.d.ts +18 -0
- package/dist/app/cli-authbridge.js +190 -0
- package/dist/app/cli-authbridge.js.map +1 -0
- package/dist/app/cli-aws.js +27 -16
- package/dist/app/cli-aws.js.map +1 -1
- package/dist/app/cli-connectors.d.ts +2 -2
- package/dist/app/cli-connectors.js +5 -3
- package/dist/app/cli-connectors.js.map +1 -1
- package/dist/app/cli-desktop.d.ts +2 -1
- package/dist/app/cli-desktop.js +72 -15
- package/dist/app/cli-desktop.js.map +1 -1
- package/dist/app/cli-do.js +28 -6
- package/dist/app/cli-do.js.map +1 -1
- package/dist/app/cli-env.d.ts +8 -1
- package/dist/app/cli-env.js +161 -14
- package/dist/app/cli-env.js.map +1 -1
- package/dist/app/cli-evals.d.ts +3 -0
- package/dist/app/cli-evals.js +74 -0
- package/dist/app/cli-evals.js.map +1 -0
- package/dist/app/cli-files.js +1 -1
- package/dist/app/cli-files.js.map +1 -1
- package/dist/app/cli-film.d.ts +0 -4
- package/dist/app/cli-film.js +43 -2
- package/dist/app/cli-film.js.map +1 -1
- package/dist/app/cli-groups.d.ts +7 -0
- package/dist/app/cli-groups.js +17 -0
- package/dist/app/cli-groups.js.map +1 -0
- package/dist/app/cli-jobs.d.ts +4 -0
- package/dist/app/cli-jobs.js +60 -0
- package/dist/app/cli-jobs.js.map +1 -0
- package/dist/app/cli-keys.d.ts +3 -1
- package/dist/app/cli-keys.js +39 -9
- package/dist/app/cli-keys.js.map +1 -1
- package/dist/app/cli-reach.js +102 -23
- package/dist/app/cli-reach.js.map +1 -1
- package/dist/app/cli-record.d.ts +10 -1
- package/dist/app/cli-record.js +238 -46
- package/dist/app/cli-record.js.map +1 -1
- package/dist/app/cli-runs.d.ts +2 -2
- package/dist/app/cli-runs.js +51 -30
- package/dist/app/cli-runs.js.map +1 -1
- package/dist/app/cli-settings.d.ts +4 -0
- package/dist/app/cli-settings.js +60 -0
- package/dist/app/cli-settings.js.map +1 -0
- package/dist/app/cli-share.js +1 -1
- package/dist/app/cli-share.js.map +1 -1
- package/dist/app/cli-shots.js +19 -1
- package/dist/app/cli-shots.js.map +1 -1
- package/dist/app/cli-site.d.ts +7 -2
- package/dist/app/cli-site.js +239 -14
- package/dist/app/cli-site.js.map +1 -1
- package/dist/app/cli-skills.d.ts +2 -0
- package/dist/app/cli-skills.js +45 -0
- package/dist/app/cli-skills.js.map +1 -0
- package/dist/app/cli-teach.d.ts +5 -0
- package/dist/app/cli-teach.js +83 -0
- package/dist/app/cli-teach.js.map +1 -1
- package/dist/app/cli-watched.d.ts +2 -2
- package/dist/app/cli-watched.js +8 -7
- package/dist/app/cli-watched.js.map +1 -1
- package/dist/app/cli.js +329 -93
- package/dist/app/cli.js.map +1 -1
- package/dist/app/client.d.ts +36 -8
- package/dist/app/client.js +69 -11
- package/dist/app/client.js.map +1 -1
- package/dist/app/config.d.ts +74 -19
- package/dist/app/config.js +108 -44
- package/dist/app/config.js.map +1 -1
- package/dist/app/desk.js +56 -64
- package/dist/app/desk.js.map +1 -1
- package/dist/app/display.d.ts +10 -0
- package/dist/app/display.js.map +1 -1
- package/dist/app/door-pull.d.ts +123 -0
- package/dist/app/door-pull.js +326 -0
- package/dist/app/door-pull.js.map +1 -0
- package/dist/app/help.d.ts +27 -0
- package/dist/app/help.js +55 -21
- package/dist/app/help.js.map +1 -1
- package/dist/app/idle.d.ts +5 -1
- package/dist/app/idle.js +28 -2
- package/dist/app/idle.js.map +1 -1
- package/dist/app/jobs.d.ts +48 -0
- package/dist/app/jobs.js +85 -0
- package/dist/app/jobs.js.map +1 -0
- package/dist/app/main.d.ts +5 -1
- package/dist/app/main.js +27 -93
- package/dist/app/main.js.map +1 -1
- package/dist/app/metered.d.ts +8 -0
- package/dist/app/metered.js +33 -0
- package/dist/app/metered.js.map +1 -0
- package/dist/app/owed.js +2 -2
- package/dist/app/owed.js.map +1 -1
- package/dist/app/owner.d.ts +6 -2
- package/dist/app/owner.js +10 -2
- package/dist/app/owner.js.map +1 -1
- package/dist/app/prompt.d.ts +2 -0
- package/dist/app/prompt.js +11 -0
- package/dist/app/prompt.js.map +1 -1
- package/dist/app/services-authbridge.d.ts +18 -0
- package/dist/app/services-authbridge.js +85 -0
- package/dist/app/services-authbridge.js.map +1 -0
- package/dist/app/services-browser.d.ts +5 -2
- package/dist/app/services-browser.js +40 -9
- package/dist/app/services-browser.js.map +1 -1
- package/dist/app/services-keys.d.ts +15 -2
- package/dist/app/services-keys.js +34 -4
- package/dist/app/services-keys.js.map +1 -1
- package/dist/app/services-kit.d.ts +11 -0
- package/dist/app/services-kit.js +24 -1
- package/dist/app/services-kit.js.map +1 -1
- package/dist/app/services-money.d.ts +1 -1
- package/dist/app/services-money.js +3 -4
- package/dist/app/services-money.js.map +1 -1
- package/dist/app/services-reach.d.ts +6 -3
- package/dist/app/services-reach.js +6 -5
- package/dist/app/services-reach.js.map +1 -1
- package/dist/app/services-signin.d.ts +5 -0
- package/dist/app/services-signin.js +39 -4
- package/dist/app/services-signin.js.map +1 -1
- package/dist/app/services-state.d.ts +41 -7
- package/dist/app/services-state.js +211 -40
- package/dist/app/services-state.js.map +1 -1
- package/dist/app/services-workflows.d.ts +1 -1
- package/dist/app/services-workflows.js +16 -5
- package/dist/app/services-workflows.js.map +1 -1
- package/dist/app/services.d.ts +3 -3
- package/dist/app/services.js +33 -9
- package/dist/app/services.js.map +1 -1
- package/dist/app/settings-file.d.ts +21 -0
- package/dist/app/settings-file.js +111 -0
- package/dist/app/settings-file.js.map +1 -0
- package/dist/app/setup.d.ts +3 -4
- package/dist/app/setup.js +4 -24
- package/dist/app/setup.js.map +1 -1
- package/dist/app/status.d.ts +1 -1
- package/dist/app/status.js +1 -1
- package/dist/app/status.js.map +1 -1
- package/dist/auth/accounts.d.ts +1 -1
- package/dist/auth/accounts.js +22 -6
- package/dist/auth/accounts.js.map +1 -1
- package/dist/auth/codes.d.ts +2 -1
- package/dist/auth/codes.js +1 -0
- package/dist/auth/codes.js.map +1 -1
- package/dist/auth/enroll.d.ts +8 -1
- package/dist/auth/enroll.js +33 -8
- package/dist/auth/enroll.js.map +1 -1
- package/dist/auth/free-accounts.d.ts +1 -1
- package/dist/auth/github.d.ts +1 -10
- package/dist/auth/github.js +4 -96
- package/dist/auth/github.js.map +1 -1
- package/dist/auth/google.d.ts +1 -10
- package/dist/auth/google.js +5 -364
- package/dist/auth/google.js.map +1 -1
- package/dist/auth/guard.js +4 -0
- package/dist/auth/guard.js.map +1 -1
- package/dist/auth/index.d.ts +3 -3
- package/dist/auth/index.js +3 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/keys.d.ts +2 -0
- package/dist/auth/keys.js +5 -0
- package/dist/auth/keys.js.map +1 -1
- package/dist/auth/login.d.ts +107 -4
- package/dist/auth/login.js +452 -80
- package/dist/auth/login.js.map +1 -1
- package/dist/auth/microsoft.d.ts +1 -9
- package/dist/auth/microsoft.js +5 -160
- package/dist/auth/microsoft.js.map +1 -1
- package/dist/auth/page-login.d.ts +38 -0
- package/dist/auth/page-login.js +165 -0
- package/dist/auth/page-login.js.map +1 -0
- package/dist/auth/passkey.d.ts +1 -1
- package/dist/auth/phone.d.ts +5 -0
- package/dist/auth/phone.js +16 -0
- package/dist/auth/phone.js.map +1 -0
- package/dist/auth/providers.d.ts +9 -0
- package/dist/auth/providers.js +27 -0
- package/dist/auth/providers.js.map +1 -1
- package/dist/auth/recovery.d.ts +1 -1
- package/dist/auth/rotate.d.ts +1 -1
- package/dist/auth/session-status.d.ts +35 -0
- package/dist/auth/session-status.js +135 -0
- package/dist/auth/session-status.js.map +1 -0
- package/dist/auth/sign-in-holds.d.ts +61 -0
- package/dist/auth/sign-in-holds.js +72 -0
- package/dist/auth/sign-in-holds.js.map +1 -0
- package/dist/auth/sign-in-kit.d.ts +124 -0
- package/dist/auth/sign-in-kit.js +300 -0
- package/dist/auth/sign-in-kit.js.map +1 -0
- package/dist/auth/signup.d.ts +12 -5
- package/dist/auth/signup.js +37 -17
- package/dist/auth/signup.js.map +1 -1
- package/dist/auth/sites.d.ts +40 -40
- package/dist/auth/sites.js +101 -747
- package/dist/auth/sites.js.map +1 -1
- package/dist/authbridge/bridge.d.ts +49 -0
- package/dist/authbridge/bridge.js +147 -0
- package/dist/authbridge/bridge.js.map +1 -0
- package/dist/authbridge/snapshot.d.ts +69 -0
- package/dist/authbridge/snapshot.js +127 -0
- package/dist/authbridge/snapshot.js.map +1 -0
- package/dist/authbridge/store.d.ts +32 -0
- package/dist/authbridge/store.js +65 -0
- package/dist/authbridge/store.js.map +1 -0
- package/dist/autotrack/code.d.ts +1 -1
- package/dist/autotrack/code.js +3 -3
- package/dist/autotrack/code.js.map +1 -1
- package/dist/autotrack/import.d.ts +2 -0
- package/dist/autotrack/import.js +20 -6
- package/dist/autotrack/import.js.map +1 -1
- package/dist/autotrack/label.d.ts +1 -1
- package/dist/autotrack/store.d.ts +21 -1
- package/dist/autotrack/store.js +95 -3
- package/dist/autotrack/store.js.map +1 -1
- package/dist/browser/address-suggest.d.ts +30 -0
- package/dist/browser/address-suggest.js +173 -0
- package/dist/browser/address-suggest.js.map +1 -0
- package/dist/browser/article.d.ts +25 -0
- package/dist/browser/article.js +59 -0
- package/dist/browser/article.js.map +1 -0
- package/dist/browser/attempt.d.ts +47 -0
- package/dist/browser/attempt.js +72 -1
- package/dist/browser/attempt.js.map +1 -1
- package/dist/browser/background-launch.d.ts +18 -0
- package/dist/browser/background-launch.js +201 -0
- package/dist/browser/background-launch.js.map +1 -0
- package/dist/browser/ban-signals.d.ts +22 -0
- package/dist/browser/ban-signals.js +83 -0
- package/dist/browser/ban-signals.js.map +1 -0
- package/dist/browser/brand.d.ts +52 -0
- package/dist/browser/brand.js +117 -0
- package/dist/browser/brand.js.map +1 -0
- package/dist/browser/browsers.d.ts +64 -9
- package/dist/browser/browsers.js +224 -38
- package/dist/browser/browsers.js.map +1 -1
- package/dist/browser/captcha/index.d.ts +40 -4
- package/dist/browser/captcha/index.js +109 -18
- package/dist/browser/captcha/index.js.map +1 -1
- package/dist/browser/captcha/llm-eyes.js +3 -1
- package/dist/browser/captcha/llm-eyes.js.map +1 -1
- package/dist/browser/card-mask.d.ts +13 -0
- package/dist/browser/card-mask.js +42 -0
- package/dist/browser/card-mask.js.map +1 -0
- package/dist/browser/chrome-testing.d.ts +20 -0
- package/dist/browser/chrome-testing.js +70 -0
- package/dist/browser/chrome-testing.js.map +1 -0
- package/dist/browser/clean-text.d.ts +3 -0
- package/dist/browser/clean-text.js +17 -0
- package/dist/browser/clean-text.js.map +1 -0
- package/dist/browser/code.d.ts +96 -0
- package/dist/browser/code.js +461 -0
- package/dist/browser/code.js.map +1 -0
- package/dist/browser/dialogs.d.ts +49 -0
- package/dist/browser/dialogs.js +78 -0
- package/dist/browser/dialogs.js.map +1 -0
- package/dist/browser/downloads.d.ts +23 -0
- package/dist/browser/downloads.js +68 -0
- package/dist/browser/downloads.js.map +1 -0
- package/dist/browser/driver-memory.d.ts +24 -0
- package/dist/browser/driver-memory.js +82 -0
- package/dist/browser/driver-memory.js.map +1 -0
- package/dist/browser/engines.d.ts +81 -0
- package/dist/browser/engines.js +203 -0
- package/dist/browser/engines.js.map +1 -0
- package/dist/browser/extras.d.ts +13 -0
- package/dist/browser/extras.js +116 -0
- package/dist/browser/extras.js.map +1 -0
- package/dist/browser/film.d.ts +32 -3
- package/dist/browser/film.js +50 -6
- package/dist/browser/film.js.map +1 -1
- package/dist/browser/fingerprint.d.ts +27 -6
- package/dist/browser/fingerprint.js +58 -9
- package/dist/browser/fingerprint.js.map +1 -1
- package/dist/browser/fixes.js +1 -1
- package/dist/browser/flow-api.d.ts +358 -0
- package/dist/browser/flow-api.js +41 -0
- package/dist/browser/flow-api.js.map +1 -0
- package/dist/browser/flow-steps.d.ts +56 -0
- package/dist/browser/flow-steps.js +229 -0
- package/dist/browser/flow-steps.js.map +1 -0
- package/dist/browser/flow.d.ts +8 -261
- package/dist/browser/flow.js +460 -263
- package/dist/browser/flow.js.map +1 -1
- package/dist/browser/flows/answer-engines.d.ts +25 -0
- package/dist/browser/flows/answer-engines.js +134 -0
- package/dist/browser/flows/answer-engines.js.map +1 -0
- package/dist/browser/flows/aws-cli-login.d.ts +1 -1
- package/dist/browser/flows/calcom-api-key.d.ts +3 -1
- package/dist/browser/flows/calcom-api-key.js +2 -0
- package/dist/browser/flows/calcom-api-key.js.map +1 -1
- package/dist/browser/flows/cloudflare-token.d.ts +2 -2
- package/dist/browser/flows/connector-keys.d.ts +5 -3
- package/dist/browser/flows/connector-keys.js +10 -6
- package/dist/browser/flows/connector-keys.js.map +1 -1
- package/dist/browser/flows/consent-walker.js +1 -0
- package/dist/browser/flows/consent-walker.js.map +1 -1
- package/dist/browser/flows/discord.d.ts +4 -2
- package/dist/browser/flows/discord.js +3 -0
- package/dist/browser/flows/discord.js.map +1 -1
- package/dist/browser/flows/facebook-oauth-consent.d.ts +1 -1
- package/dist/browser/flows/facebook-oauth-consent.js +4 -2
- package/dist/browser/flows/facebook-oauth-consent.js.map +1 -1
- package/dist/browser/flows/fb-ad-library.d.ts +122 -0
- package/dist/browser/flows/fb-ad-library.js +261 -0
- package/dist/browser/flows/fb-ad-library.js.map +1 -0
- package/dist/browser/flows/fb-marketplace.d.ts +20 -0
- package/dist/browser/flows/fb-marketplace.js +59 -0
- package/dist/browser/flows/fb-marketplace.js.map +1 -0
- package/dist/browser/flows/fingerprint.d.ts +1 -1
- package/dist/browser/flows/fingerprint.js +1 -0
- package/dist/browser/flows/fingerprint.js.map +1 -1
- package/dist/browser/flows/google-dkim.d.ts +2 -2
- package/dist/browser/flows/google-dkim.js +2 -0
- package/dist/browser/flows/google-dkim.js.map +1 -1
- package/dist/browser/flows/google-place.d.ts +1 -1
- package/dist/browser/flows/google-place.js +2 -0
- package/dist/browser/flows/google-place.js.map +1 -1
- package/dist/browser/flows/google-profile-photo.d.ts +1 -1
- package/dist/browser/flows/google-profile-photo.js +1 -0
- package/dist/browser/flows/google-profile-photo.js.map +1 -1
- package/dist/browser/flows/google-reviews.d.ts +1 -1
- package/dist/browser/flows/google-reviews.js +2 -0
- package/dist/browser/flows/google-reviews.js.map +1 -1
- package/dist/browser/flows/google-search.d.ts +22 -3
- package/dist/browser/flows/google-search.js +5 -1
- package/dist/browser/flows/google-search.js.map +1 -1
- package/dist/browser/flows/google-workspace-logo.d.ts +1 -1
- package/dist/browser/flows/google-workspace-logo.js +1 -0
- package/dist/browser/flows/google-workspace-logo.js.map +1 -1
- package/dist/browser/flows/index.d.ts +14 -2
- package/dist/browser/flows/index.js +14 -2
- package/dist/browser/flows/index.js.map +1 -1
- package/dist/browser/flows/inputs.gen.d.ts +11 -0
- package/dist/browser/flows/inputs.gen.js +539 -0
- package/dist/browser/flows/inputs.gen.js.map +1 -0
- package/dist/browser/flows/instagram-act.d.ts +102 -6
- package/dist/browser/flows/instagram-act.js +375 -69
- package/dist/browser/flows/instagram-act.js.map +1 -1
- package/dist/browser/flows/instagram-comments.d.ts +1 -1
- package/dist/browser/flows/instagram-comments.js +1 -0
- package/dist/browser/flows/instagram-comments.js.map +1 -1
- package/dist/browser/flows/instagram-create-post.d.ts +3 -1
- package/dist/browser/flows/instagram-create-post.js +12 -5
- package/dist/browser/flows/instagram-create-post.js.map +1 -1
- package/dist/browser/flows/instagram-oauth-consent.d.ts +1 -1
- package/dist/browser/flows/instagram-oauth-consent.js +4 -2
- package/dist/browser/flows/instagram-oauth-consent.js.map +1 -1
- package/dist/browser/flows/instagram-people.d.ts +77 -0
- package/dist/browser/flows/instagram-people.js +254 -0
- package/dist/browser/flows/instagram-people.js.map +1 -0
- package/dist/browser/flows/instagram-posts.d.ts +47 -0
- package/dist/browser/flows/instagram-posts.js +154 -0
- package/dist/browser/flows/instagram-posts.js.map +1 -0
- package/dist/browser/flows/instagram-reels.d.ts +59 -0
- package/dist/browser/flows/instagram-reels.js +124 -0
- package/dist/browser/flows/instagram-reels.js.map +1 -0
- package/dist/browser/flows/kit.d.ts +27 -4
- package/dist/browser/flows/kit.js +62 -0
- package/dist/browser/flows/kit.js.map +1 -1
- package/dist/browser/flows/learn.d.ts +3 -3
- package/dist/browser/flows/learn.js +9 -8
- package/dist/browser/flows/learn.js.map +1 -1
- package/dist/browser/flows/linkedin-act.d.ts +2 -2
- package/dist/browser/flows/linkedin-act.js +50 -37
- package/dist/browser/flows/linkedin-act.js.map +1 -1
- package/dist/browser/flows/linkedin-activity.d.ts +1 -1
- package/dist/browser/flows/linkedin-activity.js +1 -0
- package/dist/browser/flows/linkedin-activity.js.map +1 -1
- package/dist/browser/flows/linkedin-audience.d.ts +1 -1
- package/dist/browser/flows/linkedin-audience.js +1 -0
- package/dist/browser/flows/linkedin-audience.js.map +1 -1
- package/dist/browser/flows/linkedin-comment.d.ts +17 -4
- package/dist/browser/flows/linkedin-comment.js +90 -5
- package/dist/browser/flows/linkedin-comment.js.map +1 -1
- package/dist/browser/flows/linkedin-create-post.d.ts +1 -1
- package/dist/browser/flows/linkedin-create-post.js +1 -0
- package/dist/browser/flows/linkedin-create-post.js.map +1 -1
- package/dist/browser/flows/linkedin-dashboard.d.ts +1 -1
- package/dist/browser/flows/linkedin-dashboard.js +1 -0
- package/dist/browser/flows/linkedin-dashboard.js.map +1 -1
- package/dist/browser/flows/linkedin-developer-app.d.ts +19 -0
- package/dist/browser/flows/linkedin-developer-app.js +38 -0
- package/dist/browser/flows/linkedin-developer-app.js.map +1 -0
- package/dist/browser/flows/linkedin-notifications.d.ts +1 -1
- package/dist/browser/flows/linkedin-notifications.js +1 -0
- package/dist/browser/flows/linkedin-notifications.js.map +1 -1
- package/dist/browser/flows/linkedin-oauth-consent.d.ts +1 -1
- package/dist/browser/flows/linkedin-oauth-consent.js +3 -2
- package/dist/browser/flows/linkedin-oauth-consent.js.map +1 -1
- package/dist/browser/flows/linkedin-post-analytics.d.ts +1 -1
- package/dist/browser/flows/linkedin-post-analytics.js +1 -0
- package/dist/browser/flows/linkedin-post-analytics.js.map +1 -1
- package/dist/browser/flows/linkedin-posts.d.ts +27 -13
- package/dist/browser/flows/linkedin-posts.js +42 -12
- package/dist/browser/flows/linkedin-posts.js.map +1 -1
- package/dist/browser/flows/linkedin-reach.d.ts +53 -16
- package/dist/browser/flows/linkedin-reach.js +338 -69
- package/dist/browser/flows/linkedin-reach.js.map +1 -1
- package/dist/browser/flows/linkedin-saved.d.ts +40 -0
- package/dist/browser/flows/linkedin-saved.js +99 -0
- package/dist/browser/flows/linkedin-saved.js.map +1 -0
- package/dist/browser/flows/loom.d.ts +3 -3
- package/dist/browser/flows/loom.js +3 -0
- package/dist/browser/flows/loom.js.map +1 -1
- package/dist/browser/flows/npm-create-org.d.ts +1 -1
- package/dist/browser/flows/npm-create-org.js +1 -0
- package/dist/browser/flows/npm-create-org.js.map +1 -1
- package/dist/browser/flows/npm-granular-token.d.ts +3 -1
- package/dist/browser/flows/npm-granular-token.js +2 -0
- package/dist/browser/flows/npm-granular-token.js.map +1 -1
- package/dist/browser/flows/npm-trusted-publisher.d.ts +4 -2
- package/dist/browser/flows/npm-trusted-publisher.js +42 -15
- package/dist/browser/flows/npm-trusted-publisher.js.map +1 -1
- package/dist/browser/flows/oauth-consent.d.ts +1 -1
- package/dist/browser/flows/oauth-consent.js +1 -0
- package/dist/browser/flows/oauth-consent.js.map +1 -1
- package/dist/browser/flows/open-pages.d.ts +112 -0
- package/dist/browser/flows/open-pages.js +252 -0
- package/dist/browser/flows/open-pages.js.map +1 -0
- package/dist/browser/flows/outlook-oauth-consent.d.ts +1 -1
- package/dist/browser/flows/page-api.d.ts +28 -0
- package/dist/browser/flows/page-api.js +105 -0
- package/dist/browser/flows/page-api.js.map +1 -0
- package/dist/browser/flows/perplexity-ask.d.ts +1 -1
- package/dist/browser/flows/perplexity-ask.js +2 -0
- package/dist/browser/flows/perplexity-ask.js.map +1 -1
- package/dist/browser/flows/pinterest.d.ts +64 -0
- package/dist/browser/flows/pinterest.js +176 -0
- package/dist/browser/flows/pinterest.js.map +1 -0
- package/dist/browser/flows/profile-name.d.ts +4 -4
- package/dist/browser/flows/profile-name.js +4 -0
- package/dist/browser/flows/profile-name.js.map +1 -1
- package/dist/browser/flows/proof-shot.d.ts +1 -1
- package/dist/browser/flows/proof-shot.js +5 -3
- package/dist/browser/flows/proof-shot.js.map +1 -1
- package/dist/browser/flows/reddit-html.d.ts +118 -0
- package/dist/browser/flows/reddit-html.js +337 -0
- package/dist/browser/flows/reddit-html.js.map +1 -0
- package/dist/browser/flows/reddit-rss.d.ts +5 -31
- package/dist/browser/flows/reddit-rss.js +9 -52
- package/dist/browser/flows/reddit-rss.js.map +1 -1
- package/dist/browser/flows/reddit.d.ts +5 -5
- package/dist/browser/flows/reddit.js +211 -92
- package/dist/browser/flows/reddit.js.map +1 -1
- package/dist/browser/flows/reset-mail-probe.d.ts +1 -1
- package/dist/browser/flows/reset-mail-probe.js +1 -0
- package/dist/browser/flows/reset-mail-probe.js.map +1 -1
- package/dist/browser/flows/threads-act.d.ts +83 -0
- package/dist/browser/flows/threads-act.js +196 -0
- package/dist/browser/flows/threads-act.js.map +1 -0
- package/dist/browser/flows/threads-following.d.ts +1 -1
- package/dist/browser/flows/threads-following.js +1 -0
- package/dist/browser/flows/threads-following.js.map +1 -1
- package/dist/browser/flows/threads-oauth-consent.d.ts +1 -1
- package/dist/browser/flows/threads-posts.d.ts +38 -0
- package/dist/browser/flows/threads-posts.js +133 -0
- package/dist/browser/flows/threads-posts.js.map +1 -0
- package/dist/browser/flows/tiktok-act.d.ts +65 -0
- package/dist/browser/flows/tiktok-act.js +231 -0
- package/dist/browser/flows/tiktok-act.js.map +1 -0
- package/dist/browser/flows/tiktok-comments.d.ts +1 -4
- package/dist/browser/flows/tiktok-comments.js +6 -21
- package/dist/browser/flows/tiktok-comments.js.map +1 -1
- package/dist/browser/flows/tiktok-create-post.d.ts +1 -1
- package/dist/browser/flows/tiktok-create-post.js +1 -0
- package/dist/browser/flows/tiktok-create-post.js.map +1 -1
- package/dist/browser/flows/tiktok-following.d.ts +1 -1
- package/dist/browser/flows/tiktok-following.js +1 -0
- package/dist/browser/flows/tiktok-following.js.map +1 -1
- package/dist/browser/flows/tiktok-oauth-consent.d.ts +1 -1
- package/dist/browser/flows/tiktok-oauth-consent.js +4 -2
- package/dist/browser/flows/tiktok-oauth-consent.js.map +1 -1
- package/dist/browser/flows/tiktok-reads.d.ts +57 -0
- package/dist/browser/flows/tiktok-reads.js +213 -0
- package/dist/browser/flows/tiktok-reads.js.map +1 -0
- package/dist/browser/flows/tiktok-video-analytics.d.ts +1 -1
- package/dist/browser/flows/tiktok-video-analytics.js +1 -0
- package/dist/browser/flows/tiktok-video-analytics.js.map +1 -1
- package/dist/browser/flows/tiktok-video.d.ts +21 -0
- package/dist/browser/flows/tiktok-video.js +62 -0
- package/dist/browser/flows/tiktok-video.js.map +1 -0
- package/dist/browser/flows/wrangler-login.d.ts +1 -1
- package/dist/browser/flows/x-act.d.ts +16 -5
- package/dist/browser/flows/x-act.js +54 -21
- package/dist/browser/flows/x-act.js.map +1 -1
- package/dist/browser/flows/x-graph.d.ts +98 -0
- package/dist/browser/flows/x-graph.js +321 -0
- package/dist/browser/flows/x-graph.js.map +1 -0
- package/dist/browser/flows/x-oauth-consent.d.ts +1 -1
- package/dist/browser/flows/x-oauth-consent.js +4 -2
- package/dist/browser/flows/x-oauth-consent.js.map +1 -1
- package/dist/browser/flows/x-read.d.ts +15 -9
- package/dist/browser/flows/x-read.js +49 -8
- package/dist/browser/flows/x-read.js.map +1 -1
- package/dist/browser/flows/youtube-community-post.d.ts +1 -1
- package/dist/browser/flows/youtube-community-post.js +1 -0
- package/dist/browser/flows/youtube-community-post.js.map +1 -1
- package/dist/browser/flows/youtube-studio-analytics.d.ts +1 -1
- package/dist/browser/flows/youtube-studio-analytics.js +1 -0
- package/dist/browser/flows/youtube-studio-analytics.js.map +1 -1
- package/dist/browser/flows/youtube-thumbnail.d.ts +1 -1
- package/dist/browser/flows/youtube-thumbnail.js +1 -0
- package/dist/browser/flows/youtube-thumbnail.js.map +1 -1
- package/dist/browser/flows/youtube-transcript.d.ts +34 -0
- package/dist/browser/flows/youtube-transcript.js +169 -0
- package/dist/browser/flows/youtube-transcript.js.map +1 -0
- package/dist/browser/focus-guard.d.ts +49 -0
- package/dist/browser/focus-guard.js +200 -0
- package/dist/browser/focus-guard.js.map +1 -0
- package/dist/browser/frames.d.ts +8 -1
- package/dist/browser/frames.js +11 -0
- package/dist/browser/frames.js.map +1 -1
- package/dist/browser/har.d.ts +32 -0
- package/dist/browser/har.js +87 -0
- package/dist/browser/har.js.map +1 -0
- package/dist/browser/human/draw.d.ts +8 -0
- package/dist/browser/human/draw.js +17 -0
- package/dist/browser/human/draw.js.map +1 -1
- package/dist/browser/human/index.d.ts +32 -6
- package/dist/browser/human/index.js +196 -28
- package/dist/browser/human/index.js.map +1 -1
- package/dist/browser/human/scroll.d.ts +31 -8
- package/dist/browser/human/scroll.js +111 -21
- package/dist/browser/human/scroll.js.map +1 -1
- package/dist/browser/joined-run.d.ts +15 -0
- package/dist/browser/joined-run.js +58 -0
- package/dist/browser/joined-run.js.map +1 -0
- package/dist/browser/keep-session.d.ts +1 -1
- package/dist/browser/keep-session.js +2 -2
- package/dist/browser/keep-session.js.map +1 -1
- package/dist/browser/keeps.d.ts +13 -0
- package/dist/browser/keeps.js +38 -0
- package/dist/browser/keeps.js.map +1 -0
- package/dist/browser/ladder.d.ts +21 -0
- package/dist/browser/ladder.js +33 -0
- package/dist/browser/ladder.js.map +1 -0
- package/dist/browser/launch-hygiene.d.ts +38 -0
- package/dist/browser/launch-hygiene.js +138 -0
- package/dist/browser/launch-hygiene.js.map +1 -0
- package/dist/browser/live-hub.d.ts +56 -0
- package/dist/browser/live-hub.js +330 -0
- package/dist/browser/live-hub.js.map +1 -0
- package/dist/browser/live-view.d.ts +141 -0
- package/dist/browser/live-view.js +1369 -0
- package/dist/browser/live-view.js.map +1 -0
- package/dist/browser/load.d.ts +23 -0
- package/dist/browser/load.js +27 -0
- package/dist/browser/load.js.map +1 -0
- package/dist/browser/memory-guard.d.ts +38 -0
- package/dist/browser/memory-guard.js +135 -0
- package/dist/browser/memory-guard.js.map +1 -0
- package/dist/browser/memory-pressure-log.d.ts +40 -0
- package/dist/browser/memory-pressure-log.js +125 -0
- package/dist/browser/memory-pressure-log.js.map +1 -0
- package/dist/browser/nav-fence.d.ts +37 -0
- package/dist/browser/nav-fence.js +141 -0
- package/dist/browser/nav-fence.js.map +1 -0
- package/dist/browser/network.d.ts +33 -4
- package/dist/browser/network.js +137 -17
- package/dist/browser/network.js.map +1 -1
- package/dist/browser/own-tabs.d.ts +31 -0
- package/dist/browser/own-tabs.js +138 -0
- package/dist/browser/own-tabs.js.map +1 -0
- package/dist/browser/own.js +3 -2
- package/dist/browser/own.js.map +1 -1
- package/dist/browser/owner.d.ts +14 -0
- package/dist/browser/owner.js +89 -0
- package/dist/browser/owner.js.map +1 -0
- package/dist/browser/page-errors.d.ts +26 -0
- package/dist/browser/page-errors.js +25 -0
- package/dist/browser/page-errors.js.map +1 -0
- package/dist/browser/page-fn.d.ts +5 -0
- package/dist/browser/page-fn.js +6 -0
- package/dist/browser/page-fn.js.map +1 -0
- package/dist/browser/page-json.d.ts +60 -0
- package/dist/browser/page-json.js +115 -0
- package/dist/browser/page-json.js.map +1 -0
- package/dist/browser/page-proof.d.ts +76 -0
- package/dist/browser/page-proof.js +180 -0
- package/dist/browser/page-proof.js.map +1 -0
- package/dist/browser/page-script.d.ts +6 -0
- package/dist/browser/page-script.js +10 -0
- package/dist/browser/page-script.js.map +1 -0
- package/dist/browser/page-scroll.d.ts +16 -0
- package/dist/browser/page-scroll.js +42 -0
- package/dist/browser/page-scroll.js.map +1 -0
- package/dist/browser/park.d.ts +1 -1
- package/dist/browser/park.js +1 -1
- package/dist/browser/park.js.map +1 -1
- package/dist/browser/profile-pool.d.ts +88 -0
- package/dist/browser/profile-pool.js +153 -0
- package/dist/browser/profile-pool.js.map +1 -0
- package/dist/browser/profile-trim.d.ts +31 -0
- package/dist/browser/profile-trim.js +211 -0
- package/dist/browser/profile-trim.js.map +1 -0
- package/dist/browser/profile-wait.d.ts +2 -0
- package/dist/browser/profile-wait.js +5 -1
- package/dist/browser/profile-wait.js.map +1 -1
- package/dist/browser/reap.d.ts +26 -3
- package/dist/browser/reap.js +77 -15
- package/dist/browser/reap.js.map +1 -1
- package/dist/browser/records.d.ts +2 -1
- package/dist/browser/records.js.map +1 -1
- package/dist/browser/render.d.ts +44 -5
- package/dist/browser/render.js +47 -12
- package/dist/browser/render.js.map +1 -1
- package/dist/browser/repair.js +76 -5
- package/dist/browser/repair.js.map +1 -1
- package/dist/browser/reserve.d.ts +20 -0
- package/dist/browser/reserve.js +53 -0
- package/dist/browser/reserve.js.map +1 -0
- package/dist/browser/run-files.d.ts +25 -7
- package/dist/browser/run-files.js +102 -38
- package/dist/browser/run-files.js.map +1 -1
- package/dist/browser/run-type.d.ts +6 -0
- package/dist/browser/run-type.js +7 -0
- package/dist/browser/run-type.js.map +1 -0
- package/dist/browser/saved-tabs.d.ts +14 -0
- package/dist/browser/saved-tabs.js +196 -0
- package/dist/browser/saved-tabs.js.map +1 -0
- package/dist/browser/screens.d.ts +6 -0
- package/dist/browser/screens.js +9 -3
- package/dist/browser/screens.js.map +1 -1
- package/dist/browser/scroll-collect.d.ts +9 -2
- package/dist/browser/scroll-collect.js +29 -3
- package/dist/browser/scroll-collect.js.map +1 -1
- package/dist/browser/session.d.ts +88 -9
- package/dist/browser/session.js +486 -72
- package/dist/browser/session.js.map +1 -1
- package/dist/browser/site-memory.d.ts +48 -0
- package/dist/browser/site-memory.js +162 -0
- package/dist/browser/site-memory.js.map +1 -0
- package/dist/browser/tab-focus.d.ts +32 -0
- package/dist/browser/tab-focus.js +190 -0
- package/dist/browser/tab-focus.js.map +1 -0
- package/dist/browser/trace-secrets.d.ts +11 -0
- package/dist/browser/trace-secrets.js +93 -7
- package/dist/browser/trace-secrets.js.map +1 -1
- package/dist/browser/watch.js +2 -1
- package/dist/browser/watch.js.map +1 -1
- package/dist/browser/watchers.d.ts +10 -3
- package/dist/browser/watchers.js +37 -10
- package/dist/browser/watchers.js.map +1 -1
- package/dist/browser/webauthn.js +2 -3
- package/dist/browser/webauthn.js.map +1 -1
- package/dist/browser/window-bounds.d.ts +30 -0
- package/dist/browser/window-bounds.js +95 -0
- package/dist/browser/window-bounds.js.map +1 -0
- package/dist/calls/obs.d.ts +3 -1
- package/dist/calls/obs.js +7 -2
- package/dist/calls/obs.js.map +1 -1
- package/dist/calls/recorder.d.ts +1 -1
- package/dist/calls/recorder.js +3 -2
- package/dist/calls/recorder.js.map +1 -1
- package/dist/catalog-file.d.ts +13 -0
- package/dist/catalog-file.js +43 -0
- package/dist/catalog-file.js.map +1 -0
- package/dist/channels/render.js +7 -0
- package/dist/channels/render.js.map +1 -1
- package/dist/chores/aws-login.d.ts +1 -1
- package/dist/chores/aws-login.js +6 -2
- package/dist/chores/aws-login.js.map +1 -1
- package/dist/chores/gcloud-login.d.ts +2 -2
- package/dist/chores/gcloud-login.js +4 -3
- package/dist/chores/gcloud-login.js.map +1 -1
- package/dist/chores/langfuse.js +2 -1
- package/dist/chores/langfuse.js.map +1 -1
- package/dist/chores/wrangler-login.d.ts +2 -2
- package/dist/chores/wrangler-login.js +4 -3
- package/dist/chores/wrangler-login.js.map +1 -1
- package/dist/claude/service.d.ts +3 -1
- package/dist/claude/service.js +13 -4
- package/dist/claude/service.js.map +1 -1
- package/dist/clients/roster.js +9 -7
- package/dist/clients/roster.js.map +1 -1
- package/dist/clients/wren.js +2 -2
- package/dist/clients/wren.js.map +1 -1
- package/dist/compiler/check.d.ts +2 -0
- package/dist/compiler/check.js +2 -0
- package/dist/compiler/check.js.map +1 -1
- package/dist/compiler/finish.js +1 -1
- package/dist/compiler/lint.js +10 -1
- package/dist/compiler/lint.js.map +1 -1
- package/dist/compiler/outline.d.ts +315 -26
- package/dist/compiler/outline.js +86 -11
- package/dist/compiler/outline.js.map +1 -1
- package/dist/compiler/patch.js +1 -1
- package/dist/compiler/patch.js.map +1 -1
- package/dist/compiler/render.d.ts +35 -0
- package/dist/compiler/render.js +206 -34
- package/dist/compiler/render.js.map +1 -1
- package/dist/compiler/scrolls.d.ts +20 -0
- package/dist/compiler/scrolls.js +75 -0
- package/dist/compiler/scrolls.js.map +1 -0
- package/dist/compiler/structure.js +138 -38
- package/dist/compiler/structure.js.map +1 -1
- package/dist/deps/keys.d.ts +9 -2
- package/dist/deps/keys.js.map +1 -1
- package/dist/deps/sink.d.ts +26 -7
- package/dist/deps/sink.js +34 -1
- package/dist/deps/sink.js.map +1 -1
- package/dist/deps/stats.d.ts +1 -1
- package/dist/deps/stats.js +4 -3
- package/dist/deps/stats.js.map +1 -1
- package/dist/desktop/agent-desktop.d.ts +84 -0
- package/dist/desktop/agent-desktop.js +294 -0
- package/dist/desktop/agent-desktop.js.map +1 -0
- package/dist/desktop/answer.d.ts +3 -0
- package/dist/desktop/answer.js +21 -0
- package/dist/desktop/answer.js.map +1 -0
- package/dist/desktop/describe.js +20 -14
- package/dist/desktop/describe.js.map +1 -1
- package/dist/desktop/hands.d.ts +59 -0
- package/dist/desktop/hands.js +694 -0
- package/dist/desktop/hands.js.map +1 -0
- package/dist/desktop/mac.d.ts +8 -21
- package/dist/desktop/mac.js +47 -185
- package/dist/desktop/mac.js.map +1 -1
- package/dist/desktop/overlaid.d.ts +17 -0
- package/dist/desktop/overlaid.js +138 -0
- package/dist/desktop/overlaid.js.map +1 -0
- package/dist/desktop/session.d.ts +68 -0
- package/dist/desktop/session.js +512 -0
- package/dist/desktop/session.js.map +1 -0
- package/dist/desktop/types.d.ts +327 -46
- package/dist/desktop/types.js +293 -49
- package/dist/desktop/types.js.map +1 -1
- package/dist/do/catalog.d.ts +7 -2
- package/dist/do/catalog.js +4 -4
- package/dist/do/catalog.js.map +1 -1
- package/dist/do/doer.js.map +1 -1
- package/dist/do/list.d.ts +23 -0
- package/dist/do/list.js +46 -0
- package/dist/do/list.js.map +1 -0
- package/dist/do/pick.d.ts +12 -0
- package/dist/do/pick.js +40 -4
- package/dist/do/pick.js.map +1 -1
- package/dist/do/wire.js +9 -2
- package/dist/do/wire.js.map +1 -1
- package/dist/engine/browser-service.d.ts +1 -1
- package/dist/engine/browser-service.js +73 -6
- package/dist/engine/browser-service.js.map +1 -1
- package/dist/engine/effects.js.map +1 -1
- package/dist/engine/events.d.ts +8 -0
- package/dist/engine/events.js.map +1 -1
- package/dist/engine/leg.d.ts +26 -0
- package/dist/engine/leg.js +64 -0
- package/dist/engine/leg.js.map +1 -0
- package/dist/engine/object.d.ts +22 -1
- package/dist/engine/object.js +98 -10
- package/dist/engine/object.js.map +1 -1
- package/dist/engine/rows.d.ts +1 -1
- package/dist/engine/rows.js +9 -3
- package/dist/engine/rows.js.map +1 -1
- package/dist/engine/run.d.ts +23 -2
- package/dist/engine/run.js +77 -8
- package/dist/engine/run.js.map +1 -1
- package/dist/engine/workflow.d.ts +11 -0
- package/dist/engine/workflow.js +2 -0
- package/dist/engine/workflow.js.map +1 -1
- package/dist/errors.d.ts +24 -0
- package/dist/errors.js +197 -0
- package/dist/errors.js.map +1 -0
- package/dist/evals/run.d.ts +15 -0
- package/dist/evals/run.js +107 -0
- package/dist/evals/run.js.map +1 -0
- package/dist/evals/suite.d.ts +59 -0
- package/dist/evals/suite.js +133 -0
- package/dist/evals/suite.js.map +1 -0
- package/dist/explore/act-outcome.d.ts +25 -0
- package/dist/explore/act-outcome.js +51 -0
- package/dist/explore/act-outcome.js.map +1 -0
- package/dist/explore/boundary.d.ts +21 -0
- package/dist/explore/boundary.js +56 -0
- package/dist/explore/boundary.js.map +1 -0
- package/dist/explore/bring-back.d.ts +33 -0
- package/dist/explore/bring-back.js +122 -0
- package/dist/explore/bring-back.js.map +1 -0
- package/dist/explore/code-version.d.ts +6 -0
- package/dist/explore/code-version.js +59 -0
- package/dist/explore/code-version.js.map +1 -0
- package/dist/explore/commands.d.ts +257 -20
- package/dist/explore/commands.js +287 -12
- package/dist/explore/commands.js.map +1 -1
- package/dist/explore/compact.d.ts +17 -0
- package/dist/explore/compact.js +151 -0
- package/dist/explore/compact.js.map +1 -0
- package/dist/explore/control-kind.d.ts +10 -0
- package/dist/explore/control-kind.js +49 -0
- package/dist/explore/control-kind.js.map +1 -0
- package/dist/explore/fit.d.ts +13 -0
- package/dist/explore/fit.js +19 -0
- package/dist/explore/fit.js.map +1 -0
- package/dist/explore/journal.d.ts +4 -0
- package/dist/explore/journal.js +6 -0
- package/dist/explore/journal.js.map +1 -1
- package/dist/explore/lease.d.ts +13 -1
- package/dist/explore/lease.js +18 -1
- package/dist/explore/lease.js.map +1 -1
- package/dist/explore/marks.d.ts +24 -5
- package/dist/explore/marks.js +237 -15
- package/dist/explore/marks.js.map +1 -1
- package/dist/explore/overlay-host.d.ts +25 -0
- package/dist/explore/overlay-host.js +229 -0
- package/dist/explore/overlay-host.js.map +1 -0
- package/dist/explore/overlay.d.ts +261 -0
- package/dist/explore/overlay.js +1824 -0
- package/dist/explore/overlay.js.map +1 -0
- package/dist/explore/script-scan.d.ts +32 -0
- package/dist/explore/script-scan.js +90 -0
- package/dist/explore/script-scan.js.map +1 -0
- package/dist/explore/server.d.ts +109 -14
- package/dist/explore/server.js +1769 -268
- package/dist/explore/server.js.map +1 -1
- package/dist/explore/sign-in-keep.d.ts +59 -0
- package/dist/explore/sign-in-keep.js +149 -0
- package/dist/explore/sign-in-keep.js.map +1 -0
- package/dist/explore/since.d.ts +9 -0
- package/dist/explore/since.js +31 -0
- package/dist/explore/since.js.map +1 -0
- package/dist/explore/steer.d.ts +98 -0
- package/dist/explore/steer.js +236 -0
- package/dist/explore/steer.js.map +1 -0
- package/dist/explore/stop.d.ts +73 -0
- package/dist/explore/stop.js +297 -0
- package/dist/explore/stop.js.map +1 -0
- package/dist/explore/target-matches.d.ts +26 -0
- package/dist/explore/target-matches.js +75 -0
- package/dist/explore/target-matches.js.map +1 -0
- package/dist/explore/wire.d.ts +7 -0
- package/dist/explore/wire.js +25 -0
- package/dist/explore/wire.js.map +1 -0
- package/dist/files/store.d.ts +3 -3
- package/dist/files/store.js +1 -1
- package/dist/files/store.js.map +1 -1
- package/dist/film/director.js +4 -14
- package/dist/film/director.js.map +1 -1
- package/dist/film/obs.d.ts +27 -0
- package/dist/film/obs.js +165 -0
- package/dist/film/obs.js.map +1 -0
- package/dist/film/tape.d.ts +1 -1
- package/dist/gates/ask.d.ts +7 -0
- package/dist/gates/ask.js +43 -11
- package/dist/gates/ask.js.map +1 -1
- package/dist/gates/payment.d.ts +11 -4
- package/dist/gates/payment.js +6 -4
- package/dist/gates/payment.js.map +1 -1
- package/dist/gates/spend.js +2 -2
- package/dist/gates/spend.js.map +1 -1
- package/dist/google/gmail.d.ts +8 -1
- package/dist/google/gmail.js +6 -12
- package/dist/google/gmail.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/llm/anthropic.js +5 -1
- package/dist/llm/anthropic.js.map +1 -1
- package/dist/llm/budget.js.map +1 -1
- package/dist/llm/cohere.js +13 -3
- package/dist/llm/cohere.js.map +1 -1
- package/dist/llm/index.d.ts +4 -2
- package/dist/llm/index.js +10 -2
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/types.d.ts +0 -1
- package/dist/llm/types.js.map +1 -1
- package/dist/llms.txt +301 -0
- package/dist/mail/imap.d.ts +1 -1
- package/dist/mail/imap.js +1 -1
- package/dist/mail/imap.js.map +1 -1
- package/dist/mail/instantly.d.ts +1 -1
- package/dist/mail/instantly.js +1 -1
- package/dist/mail/instantly.js.map +1 -1
- package/dist/mods/extend.d.ts +9 -0
- package/dist/mods/extend.js +56 -0
- package/dist/mods/extend.js.map +1 -0
- package/dist/mods/install.js +14 -2
- package/dist/mods/install.js.map +1 -1
- package/dist/mods/login.d.ts +3 -2
- package/dist/mods/login.js +5 -15
- package/dist/mods/login.js.map +1 -1
- package/dist/mods/mod.d.ts +5 -1
- package/dist/mods/mod.js +11 -9
- package/dist/mods/mod.js.map +1 -1
- package/dist/mods/pack.js +32 -0
- package/dist/mods/pack.js.map +1 -1
- package/dist/money/profile.d.ts +1 -1
- package/dist/money/profile.js +11 -1
- package/dist/money/profile.js.map +1 -1
- package/dist/money/wallet.d.ts +1 -1
- package/dist/money/wallet.js +9 -3
- package/dist/money/wallet.js.map +1 -1
- package/dist/oauth/core.js.map +1 -1
- package/dist/owner.d.ts +11 -1
- package/dist/owner.js +18 -1
- package/dist/owner.js.map +1 -1
- package/dist/reach/key-ring.d.ts +1 -1
- package/dist/reach/key-ring.js +1 -1
- package/dist/reach/key-ring.js.map +1 -1
- package/dist/reach/ladder.d.ts +1 -1
- package/dist/reach/ladder.js +50 -11
- package/dist/reach/ladder.js.map +1 -1
- package/dist/reach/maps.d.ts +25 -0
- package/dist/reach/maps.js +116 -5
- package/dist/reach/maps.js.map +1 -1
- package/dist/reach/net-guard.d.ts +58 -0
- package/dist/reach/net-guard.js +182 -0
- package/dist/reach/net-guard.js.map +1 -0
- package/dist/reach/web.js +1 -1
- package/dist/reach/web.js.map +1 -1
- package/dist/recorder/browser.d.ts +9 -1
- package/dist/recorder/browser.js +7 -1
- package/dist/recorder/browser.js.map +1 -1
- package/dist/recorder/observer.d.ts +1 -1
- package/dist/recorder/observer.js +10 -2
- package/dist/recorder/observer.js.map +1 -1
- package/dist/recorder/redact.js +7 -1
- package/dist/recorder/redact.js.map +1 -1
- package/dist/recorder/types.d.ts +23 -0
- package/dist/recorder/types.js.map +1 -1
- package/dist/runs/call-bodies.d.ts +19 -0
- package/dist/runs/call-bodies.js +66 -0
- package/dist/runs/call-bodies.js.map +1 -0
- package/dist/runs/calls.d.ts +17 -1
- package/dist/runs/calls.js +32 -4
- package/dist/runs/calls.js.map +1 -1
- package/dist/runs/capture.d.ts +27 -0
- package/dist/runs/capture.js +147 -0
- package/dist/runs/capture.js.map +1 -0
- package/dist/runs/engine.d.ts +53 -0
- package/dist/runs/engine.js +196 -0
- package/dist/runs/engine.js.map +1 -0
- package/dist/runs/flows.d.ts +40 -0
- package/dist/runs/flows.js +57 -1
- package/dist/runs/flows.js.map +1 -1
- package/dist/runs/import.d.ts +7 -31
- package/dist/runs/import.js +5 -54
- package/dist/runs/import.js.map +1 -1
- package/dist/runs/ledger-ship.d.ts +8 -0
- package/dist/runs/ledger-ship.js +32 -0
- package/dist/runs/ledger-ship.js.map +1 -0
- package/dist/runs/log.d.ts +45 -2
- package/dist/runs/log.js +5 -0
- package/dist/runs/log.js.map +1 -1
- package/dist/runs/probes.d.ts +27 -0
- package/dist/runs/probes.js +156 -0
- package/dist/runs/probes.js.map +1 -0
- package/dist/runs/steps.d.ts +41 -0
- package/dist/runs/steps.js +95 -0
- package/dist/runs/steps.js.map +1 -0
- package/dist/runs/success.js +3 -1
- package/dist/runs/success.js.map +1 -1
- package/dist/runtime/core/ids.d.ts +17 -0
- package/dist/runtime/core/ids.js +56 -0
- package/dist/runtime/core/ids.js.map +1 -0
- package/dist/runtime/core/promise.d.ts +63 -0
- package/dist/runtime/core/promise.js +111 -0
- package/dist/runtime/core/promise.js.map +1 -0
- package/dist/runtime/core/registry.d.ts +65 -0
- package/dist/runtime/core/registry.js +56 -0
- package/dist/runtime/core/registry.js.map +1 -0
- package/dist/runtime/core/turn.d.ts +229 -0
- package/dist/runtime/core/turn.js +815 -0
- package/dist/runtime/core/turn.js.map +1 -0
- package/dist/runtime/dispatcher.d.ts +27 -0
- package/dist/runtime/dispatcher.js +100 -0
- package/dist/runtime/dispatcher.js.map +1 -0
- package/dist/runtime/door.d.ts +6 -0
- package/dist/runtime/door.js +198 -0
- package/dist/runtime/door.js.map +1 -0
- package/dist/runtime/executor.d.ts +16 -0
- package/dist/runtime/executor.js +78 -0
- package/dist/runtime/executor.js.map +1 -0
- package/dist/runtime/index.d.ts +51 -0
- package/dist/runtime/index.js +96 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/promise.d.ts +8 -0
- package/dist/runtime/promise.js +38 -0
- package/dist/runtime/promise.js.map +1 -0
- package/dist/runtime/sdk.d.ts +3 -0
- package/dist/runtime/sdk.js +4 -0
- package/dist/runtime/sdk.js.map +1 -0
- package/dist/runtime/sqlite.d.ts +9 -0
- package/dist/runtime/sqlite.js +595 -0
- package/dist/runtime/sqlite.js.map +1 -0
- package/dist/runtime/store.d.ts +113 -0
- package/dist/runtime/store.js +21 -0
- package/dist/runtime/store.js.map +1 -0
- package/dist/share/fetch.d.ts +6 -0
- package/dist/share/fetch.js +17 -5
- package/dist/share/fetch.js.map +1 -1
- package/dist/share/gate.d.ts +12 -12
- package/dist/share/gate.js +35 -22
- package/dist/share/gate.js.map +1 -1
- package/dist/share/ports.d.ts +28 -0
- package/dist/share/ports.js +139 -0
- package/dist/share/ports.js.map +1 -0
- package/dist/share/presidio.d.ts +3 -1
- package/dist/share/presidio.js +31 -3
- package/dist/share/presidio.js.map +1 -1
- package/dist/share/scrub.js.map +1 -1
- package/dist/shots/s3.d.ts +8 -1
- package/dist/shots/s3.js +123 -15
- package/dist/shots/s3.js.map +1 -1
- package/dist/shots/ship.d.ts +9 -1
- package/dist/shots/ship.js +32 -2
- package/dist/shots/ship.js.map +1 -1
- package/dist/shots/trace-scrub.d.ts +4 -1
- package/dist/shots/trace-scrub.js +9 -5
- package/dist/shots/trace-scrub.js.map +1 -1
- package/dist/shots/trace-steps.d.ts +46 -0
- package/dist/shots/trace-steps.js +128 -0
- package/dist/shots/trace-steps.js.map +1 -0
- package/dist/shots/traces.d.ts +7 -0
- package/dist/shots/traces.js +23 -1
- package/dist/shots/traces.js.map +1 -1
- package/dist/sites/blockers.d.ts +23 -0
- package/dist/sites/blockers.js +62 -0
- package/dist/sites/blockers.js.map +1 -0
- package/dist/sites/breaker.d.ts +29 -0
- package/dist/sites/breaker.js +74 -0
- package/dist/sites/breaker.js.map +1 -0
- package/dist/sites/call-cache.d.ts +32 -0
- package/dist/sites/call-cache.js +79 -0
- package/dist/sites/call-cache.js.map +1 -0
- package/dist/sites/caps.d.ts +44 -4
- package/dist/sites/caps.js +101 -13
- package/dist/sites/caps.js.map +1 -1
- package/dist/sites/conventions.d.ts +11 -0
- package/dist/sites/conventions.js +75 -0
- package/dist/sites/conventions.js.map +1 -0
- package/dist/sites/discord.d.ts +2 -4
- package/dist/sites/discord.js +14 -60
- package/dist/sites/discord.js.map +1 -1
- package/dist/sites/facade-api.d.ts +251 -0
- package/dist/sites/facade-api.js +2 -0
- package/dist/sites/facade-api.js.map +1 -0
- package/dist/sites/facade-checks.d.ts +27 -0
- package/dist/sites/facade-checks.js +127 -0
- package/dist/sites/facade-checks.js.map +1 -0
- package/dist/sites/facade.d.ts +4 -206
- package/dist/sites/facade.js +426 -266
- package/dist/sites/facade.js.map +1 -1
- package/dist/sites/facets/core.d.ts +125 -0
- package/dist/sites/facets/core.js +134 -0
- package/dist/sites/facets/core.js.map +1 -0
- package/dist/sites/facets/sets.d.ts +25 -0
- package/dist/sites/facets/sets.js +167 -0
- package/dist/sites/facets/sets.js.map +1 -0
- package/dist/sites/fb-public.js +39 -12
- package/dist/sites/fb-public.js.map +1 -1
- package/dist/sites/hooks.d.ts +34 -0
- package/dist/sites/hooks.js +60 -0
- package/dist/sites/hooks.js.map +1 -0
- package/dist/sites/ig-container.d.ts +28 -0
- package/dist/sites/ig-container.js +27 -0
- package/dist/sites/ig-container.js.map +1 -0
- package/dist/sites/index.d.ts +4 -1
- package/dist/sites/index.js +54 -1
- package/dist/sites/index.js.map +1 -1
- package/dist/sites/instagram.js +220 -28
- package/dist/sites/instagram.js.map +1 -1
- package/dist/sites/limits.d.ts +47 -0
- package/dist/sites/limits.js +108 -0
- package/dist/sites/limits.js.map +1 -0
- package/dist/sites/linkedin-pages.d.ts +3 -0
- package/dist/sites/linkedin-pages.js +82 -0
- package/dist/sites/linkedin-pages.js.map +1 -0
- package/dist/sites/linkedin.d.ts +8 -0
- package/dist/sites/linkedin.js +151 -41
- package/dist/sites/linkedin.js.map +1 -1
- package/dist/sites/loom.js +3 -0
- package/dist/sites/loom.js.map +1 -1
- package/dist/sites/meta.d.ts +11 -0
- package/dist/sites/meta.js +194 -32
- package/dist/sites/meta.js.map +1 -1
- package/dist/sites/npm.js +5 -1
- package/dist/sites/npm.js.map +1 -1
- package/dist/sites/oauth.js +24 -4
- package/dist/sites/oauth.js.map +1 -1
- package/dist/sites/open/answers.d.ts +3 -0
- package/dist/sites/open/answers.js +64 -0
- package/dist/sites/open/answers.js.map +1 -0
- package/dist/sites/open/arxiv.d.ts +12 -0
- package/dist/sites/open/arxiv.js +101 -0
- package/dist/sites/open/arxiv.js.map +1 -0
- package/dist/sites/open/bluesky.d.ts +4 -0
- package/dist/sites/open/bluesky.js +127 -0
- package/dist/sites/open/bluesky.js.map +1 -0
- package/dist/sites/open/dblp.d.ts +2 -0
- package/dist/sites/open/dblp.js +82 -0
- package/dist/sites/open/dblp.js.map +1 -0
- package/dist/sites/open/devto.d.ts +2 -0
- package/dist/sites/open/devto.js +90 -0
- package/dist/sites/open/devto.js.map +1 -0
- package/dist/sites/open/hackernews.d.ts +17 -0
- package/dist/sites/open/hackernews.js +121 -0
- package/dist/sites/open/hackernews.js.map +1 -0
- package/dist/sites/open/jobs.d.ts +3 -0
- package/dist/sites/open/jobs.js +100 -0
- package/dist/sites/open/jobs.js.map +1 -0
- package/dist/sites/open/kit.d.ts +36 -0
- package/dist/sites/open/kit.js +98 -0
- package/dist/sites/open/kit.js.map +1 -0
- package/dist/sites/open/lobsters.d.ts +4 -0
- package/dist/sites/open/lobsters.js +77 -0
- package/dist/sites/open/lobsters.js.map +1 -0
- package/dist/sites/open/medium.d.ts +2 -0
- package/dist/sites/open/medium.js +44 -0
- package/dist/sites/open/medium.js.map +1 -0
- package/dist/sites/open/news.d.ts +4 -0
- package/dist/sites/open/news.js +120 -0
- package/dist/sites/open/news.js.map +1 -0
- package/dist/sites/open/openalex.d.ts +4 -0
- package/dist/sites/open/openalex.js +106 -0
- package/dist/sites/open/openalex.js.map +1 -0
- package/dist/sites/open/openreview.d.ts +18 -0
- package/dist/sites/open/openreview.js +124 -0
- package/dist/sites/open/openreview.js.map +1 -0
- package/dist/sites/open/producthunt.d.ts +28 -0
- package/dist/sites/open/producthunt.js +89 -0
- package/dist/sites/open/producthunt.js.map +1 -0
- package/dist/sites/open/pubmed.d.ts +14 -0
- package/dist/sites/open/pubmed.js +143 -0
- package/dist/sites/open/pubmed.js.map +1 -0
- package/dist/sites/open/scholar.d.ts +2 -0
- package/dist/sites/open/scholar.js +53 -0
- package/dist/sites/open/scholar.js.map +1 -0
- package/dist/sites/open/stackoverflow.d.ts +2 -0
- package/dist/sites/open/stackoverflow.js +177 -0
- package/dist/sites/open/stackoverflow.js.map +1 -0
- package/dist/sites/open/substack.d.ts +4 -0
- package/dist/sites/open/substack.js +82 -0
- package/dist/sites/open/substack.js.map +1 -0
- package/dist/sites/open/wiki.d.ts +3 -0
- package/dist/sites/open/wiki.js +130 -0
- package/dist/sites/open/wiki.js.map +1 -0
- package/dist/sites/open/yahoo-finance.d.ts +2 -0
- package/dist/sites/open/yahoo-finance.js +78 -0
- package/dist/sites/open/yahoo-finance.js.map +1 -0
- package/dist/sites/perplexity.js +1 -0
- package/dist/sites/perplexity.js.map +1 -1
- package/dist/sites/pinterest.d.ts +2 -0
- package/dist/sites/pinterest.js +58 -0
- package/dist/sites/pinterest.js.map +1 -0
- package/dist/sites/proof.js +1 -0
- package/dist/sites/proof.js.map +1 -1
- package/dist/sites/reddit.js +43 -7
- package/dist/sites/reddit.js.map +1 -1
- package/dist/sites/refused.d.ts +13 -1
- package/dist/sites/refused.js +7 -1
- package/dist/sites/refused.js.map +1 -1
- package/dist/sites/renew.js +4 -1
- package/dist/sites/renew.js.map +1 -1
- package/dist/sites/route-state.d.ts +28 -0
- package/dist/sites/route-state.js +57 -0
- package/dist/sites/route-state.js.map +1 -0
- package/dist/sites/send-journal.d.ts +3 -1
- package/dist/sites/send-journal.js +8 -3
- package/dist/sites/send-journal.js.map +1 -1
- package/dist/sites/service.d.ts +22 -7
- package/dist/sites/service.js +179 -65
- package/dist/sites/service.js.map +1 -1
- package/dist/sites/standing.d.ts +99 -0
- package/dist/sites/standing.js +142 -0
- package/dist/sites/standing.js.map +1 -0
- package/dist/sites/threads.js +21 -2
- package/dist/sites/threads.js.map +1 -1
- package/dist/sites/tiktok.js +147 -0
- package/dist/sites/tiktok.js.map +1 -1
- package/dist/sites/types.d.ts +83 -2
- package/dist/sites/types.js +12 -1
- package/dist/sites/types.js.map +1 -1
- package/dist/sites/upstream.d.ts +29 -0
- package/dist/sites/upstream.js +111 -0
- package/dist/sites/upstream.js.map +1 -0
- package/dist/sites/verdict.d.ts +13 -0
- package/dist/sites/verdict.js.map +1 -1
- package/dist/sites/web.js +39 -3
- package/dist/sites/web.js.map +1 -1
- package/dist/sites/why.d.ts +10 -0
- package/dist/sites/why.js +6 -1
- package/dist/sites/why.js.map +1 -1
- package/dist/sites/wire.d.ts +10 -0
- package/dist/sites/wire.js +39 -7
- package/dist/sites/wire.js.map +1 -1
- package/dist/sites/x.js +160 -6
- package/dist/sites/x.js.map +1 -1
- package/dist/sites/youtube.d.ts +4 -1
- package/dist/sites/youtube.js +112 -10
- package/dist/sites/youtube.js.map +1 -1
- package/dist/skills/autobrowse/SKILL.md +73 -0
- package/dist/skills/autobrowse/accounts.md +66 -0
- package/dist/skills/autobrowse/explore.md +231 -0
- package/dist/skills/autobrowse/leads.md +31 -0
- package/dist/skills/autobrowse/overlay.md +74 -0
- package/dist/skills/autobrowse/research.md +66 -0
- package/dist/skills/autobrowse/scripts/cmd.sh +24 -0
- package/dist/skills/autobrowse/scripts/start.sh +50 -0
- package/dist/skills/autobrowse/scripts/state.sh +33 -0
- package/dist/skills/autobrowse/scripts/stop.sh +3 -0
- package/dist/skills/autobrowse/signup.md +55 -0
- package/dist/skills/autobrowse/site-apis.md +69 -0
- package/dist/skills-pack.d.ts +32 -0
- package/dist/skills-pack.js +91 -0
- package/dist/skills-pack.js.map +1 -0
- package/dist/studio/service.d.ts +18 -1
- package/dist/studio/service.js +129 -10
- package/dist/studio/service.js.map +1 -1
- package/dist/ui/api.js +43 -7
- package/dist/ui/api.js.map +1 -1
- package/dist/ui/http.d.ts +20 -2
- package/dist/ui/http.js.map +1 -1
- package/dist/walks/build.d.ts +2 -0
- package/dist/walks/build.js +35 -3
- package/dist/walks/build.js.map +1 -1
- package/dist/walks/calls.d.ts +197 -0
- package/dist/walks/calls.js +801 -0
- package/dist/walks/calls.js.map +1 -0
- package/dist/walks/cut.d.ts +1454 -41
- package/dist/walks/drafts.d.ts +29 -0
- package/dist/walks/drafts.js +71 -0
- package/dist/walks/drafts.js.map +1 -0
- package/dist/walks/flow.d.ts +27 -2
- package/dist/walks/flow.js +390 -58
- package/dist/walks/flow.js.map +1 -1
- package/dist/walks/login-heal.d.ts +81 -0
- package/dist/walks/login-heal.js +269 -0
- package/dist/walks/login-heal.js.map +1 -0
- package/dist/walks/login.d.ts +9 -2
- package/dist/walks/login.js +131 -34
- package/dist/walks/login.js.map +1 -1
- package/dist/walks/logins/anthropic.d.ts +46 -0
- package/dist/walks/logins/anthropic.js +31 -0
- package/dist/walks/logins/anthropic.js.map +1 -0
- package/dist/walks/logins/apple.d.ts +147 -0
- package/dist/walks/logins/apple.js +68 -0
- package/dist/walks/logins/apple.js.map +1 -0
- package/dist/walks/logins/aws.d.ts +240 -0
- package/dist/walks/logins/aws.js +134 -0
- package/dist/walks/logins/aws.js.map +1 -0
- package/dist/walks/logins/cloudflare.d.ts +160 -0
- package/dist/walks/logins/cloudflare.js +97 -0
- package/dist/walks/logins/cloudflare.js.map +1 -0
- package/dist/walks/logins/costco.d.ts +73 -0
- package/dist/walks/logins/costco.js +45 -0
- package/dist/walks/logins/costco.js.map +1 -0
- package/dist/walks/logins/discord.d.ts +121 -0
- package/dist/walks/logins/discord.js +66 -0
- package/dist/walks/logins/discord.js.map +1 -0
- package/dist/walks/logins/facebook.d.ts +161 -0
- package/dist/walks/logins/facebook.js +86 -0
- package/dist/walks/logins/facebook.js.map +1 -0
- package/dist/walks/logins/github.d.ts +228 -0
- package/dist/walks/logins/github.js +145 -0
- package/dist/walks/logins/github.js.map +1 -0
- package/dist/walks/logins/google.d.ts +572 -0
- package/dist/walks/logins/google.js +332 -0
- package/dist/walks/logins/google.js.map +1 -0
- package/dist/walks/logins/hubspot.d.ts +73 -0
- package/dist/walks/logins/hubspot.js +44 -0
- package/dist/walks/logins/hubspot.js.map +1 -0
- package/dist/walks/logins/index.d.ts +8 -0
- package/dist/walks/logins/index.js +56 -0
- package/dist/walks/logins/index.js.map +1 -0
- package/dist/walks/logins/instagram.d.ts +191 -0
- package/dist/walks/logins/instagram.js +100 -0
- package/dist/walks/logins/instagram.js.map +1 -0
- package/dist/walks/logins/instantly.d.ts +98 -0
- package/dist/walks/logins/instantly.js +55 -0
- package/dist/walks/logins/instantly.js.map +1 -0
- package/dist/walks/logins/intuit.d.ts +101 -0
- package/dist/walks/logins/intuit.js +58 -0
- package/dist/walks/logins/intuit.js.map +1 -0
- package/dist/walks/logins/learn.d.ts +189 -0
- package/dist/walks/logins/learn.js +121 -0
- package/dist/walks/logins/learn.js.map +1 -0
- package/dist/walks/logins/linkedin.d.ts +201 -0
- package/dist/walks/logins/linkedin.js +120 -0
- package/dist/walks/logins/linkedin.js.map +1 -0
- package/dist/walks/logins/microsoft.d.ts +273 -0
- package/dist/walks/logins/microsoft.js +210 -0
- package/dist/walks/logins/microsoft.js.map +1 -0
- package/dist/walks/logins/npm.d.ts +149 -0
- package/dist/walks/logins/npm.js +84 -0
- package/dist/walks/logins/npm.js.map +1 -0
- package/dist/walks/logins/perplexity.d.ts +69 -0
- package/dist/walks/logins/perplexity.js +40 -0
- package/dist/walks/logins/perplexity.js.map +1 -0
- package/dist/walks/logins/reddit.d.ts +106 -0
- package/dist/walks/logins/reddit.js +63 -0
- package/dist/walks/logins/reddit.js.map +1 -0
- package/dist/walks/logins/sentry.d.ts +40 -0
- package/dist/walks/logins/sentry.js +29 -0
- package/dist/walks/logins/sentry.js.map +1 -0
- package/dist/walks/logins/tiktok.d.ts +227 -0
- package/dist/walks/logins/tiktok.js +115 -0
- package/dist/walks/logins/tiktok.js.map +1 -0
- package/dist/walks/logins/twilio.d.ts +83 -0
- package/dist/walks/logins/twilio.js +51 -0
- package/dist/walks/logins/twilio.js.map +1 -0
- package/dist/walks/logins/x.d.ts +191 -0
- package/dist/walks/logins/x.js +101 -0
- package/dist/walks/logins/x.js.map +1 -0
- package/dist/walks/spec.d.ts +1904 -215
- package/dist/walks/spec.js +263 -20
- package/dist/walks/spec.js.map +1 -1
- package/dist/workflows/airbnb-search/index.d.ts +33 -0
- package/dist/workflows/airbnb-search/index.js +97 -0
- package/dist/workflows/airbnb-search/index.js.map +1 -0
- package/dist/workflows/amazon-cart/index.d.ts +27 -0
- package/dist/workflows/amazon-cart/index.js +57 -0
- package/dist/workflows/amazon-cart/index.js.map +1 -0
- package/dist/workflows/anthropic-console-api-key/index.js +2 -0
- package/dist/workflows/anthropic-console-api-key/index.js.map +1 -1
- package/dist/workflows/aws-port25-request/index.d.ts +2 -2
- package/dist/workflows/aws-port25-request/index.js +4 -2
- package/dist/workflows/aws-port25-request/index.js.map +1 -1
- package/dist/workflows/bootstrap/index.d.ts +4 -0
- package/dist/workflows/bootstrap/index.js +12 -3
- package/dist/workflows/bootstrap/index.js.map +1 -1
- package/dist/workflows/compiled-deps.d.ts +15 -1
- package/dist/workflows/compiled-deps.js +35 -5
- package/dist/workflows/compiled-deps.js.map +1 -1
- package/dist/workflows/compiled.js +8 -5
- package/dist/workflows/compiled.js.map +1 -1
- package/dist/workflows/domain/index.d.ts +1 -1
- package/dist/workflows/example-title/index.js +2 -0
- package/dist/workflows/example-title/index.js.map +1 -1
- package/dist/workflows/expect.d.ts +28 -0
- package/dist/workflows/expect.js +104 -0
- package/dist/workflows/expect.js.map +1 -0
- package/dist/workflows/find.d.ts +15 -0
- package/dist/workflows/find.js +43 -0
- package/dist/workflows/find.js.map +1 -0
- package/dist/workflows/google-cloud-oauth-client/index.d.ts +5 -2
- package/dist/workflows/google-cloud-oauth-client/index.js +22 -5
- package/dist/workflows/google-cloud-oauth-client/index.js.map +1 -1
- package/dist/workflows/google-cloud-project/index.js +7 -1
- package/dist/workflows/google-cloud-project/index.js.map +1 -1
- package/dist/workflows/google-name/index.js +2 -0
- package/dist/workflows/google-name/index.js.map +1 -1
- package/dist/workflows/hn-search/index.js +2 -0
- package/dist/workflows/hn-search/index.js.map +1 -1
- package/dist/workflows/inbox-activity/index.d.ts +2 -2
- package/dist/workflows/inbox-activity/index.js +1 -1
- package/dist/workflows/inbox-fleet/index.d.ts +1 -1
- package/dist/workflows/instagram-change-email/index.d.ts +1 -1
- package/dist/workflows/instagram-change-email/index.js +3 -1
- package/dist/workflows/instagram-change-email/index.js.map +1 -1
- package/dist/workflows/instagram-profile-basics/index.js +4 -2
- package/dist/workflows/instagram-profile-basics/index.js.map +1 -1
- package/dist/workflows/langfuse-project-keys/index.d.ts +3 -0
- package/dist/workflows/langfuse-project-keys/index.js +10 -1
- package/dist/workflows/langfuse-project-keys/index.js.map +1 -1
- package/dist/workflows/learn-quiz-submit/index.js +1 -0
- package/dist/workflows/learn-quiz-submit/index.js.map +1 -1
- package/dist/workflows/legs.d.ts +34 -0
- package/dist/workflows/legs.js +65 -0
- package/dist/workflows/legs.js.map +1 -0
- package/dist/workflows/linkedin-page-admin/index.js +2 -0
- package/dist/workflows/linkedin-page-admin/index.js.map +1 -1
- package/dist/workflows/linkedin-page-branding/index.js +8 -5
- package/dist/workflows/linkedin-page-branding/index.js.map +1 -1
- package/dist/workflows/linkedin-profile-basics/index.d.ts +3 -3
- package/dist/workflows/linkedin-profile-basics/index.js +2 -0
- package/dist/workflows/linkedin-profile-basics/index.js.map +1 -1
- package/dist/workflows/linkedin-profile-photo/index.d.ts +1 -1
- package/dist/workflows/linkedin-profile-photo/index.js +7 -4
- package/dist/workflows/linkedin-profile-photo/index.js.map +1 -1
- package/dist/workflows/logins.d.ts +34 -0
- package/dist/workflows/logins.js +100 -0
- package/dist/workflows/logins.js.map +1 -0
- package/dist/workflows/proof.d.ts +7 -0
- package/dist/workflows/proof.js +8 -2
- package/dist/workflows/proof.js.map +1 -1
- package/dist/workflows/roots.js.map +1 -1
- package/dist/workflows/sender-domain/index.d.ts +1 -1
- package/dist/workflows/signup-instagram/index.js +2 -0
- package/dist/workflows/signup-instagram/index.js.map +1 -1
- package/dist/workflows/signup-reddit/index.js +2 -0
- package/dist/workflows/signup-reddit/index.js.map +1 -1
- package/dist/workflows/toolkit.d.ts +69 -0
- package/dist/workflows/toolkit.js +147 -0
- package/dist/workflows/toolkit.js.map +1 -0
- package/dist/workflows/workspace-skip-passwords/index.js +2 -0
- package/dist/workflows/workspace-skip-passwords/index.js.map +1 -1
- package/evals/baseline.json +28 -0
- package/evals/tasks.jsonl +12 -0
- package/package.json +28 -8
- package/vendor/google-maps-scraper-kit/LICENSE +21 -0
- package/vendor/google-maps-scraper-kit/PIN.md +8 -0
- package/vendor/google-maps-scraper-kit/engine/browser.py +384 -0
- package/vendor/google-maps-scraper-kit/engine/cdp.py +307 -0
- package/vendor/google-maps-scraper-kit/engine/details.py +297 -0
- package/vendor/google-maps-scraper-kit/engine/jobs.py +1252 -0
- package/vendor/google-maps-scraper-kit/engine/maps.py +294 -0
- package/vendor/google-maps-scraper-kit/engine/presets/NOTICE.md +9 -0
- package/vendor/google-maps-scraper-kit/engine/presets/business-types.json +203 -0
- package/vendor/google-maps-scraper-kit/engine/presets/cities.tsv.gz +0 -0
- package/vendor/google-maps-scraper-kit/engine/serve.py +1000 -0
- package/vendor/google-maps-scraper-kit/engine/website_browser.py +342 -0
- package/dist/app/box-register.d.ts +0 -11
- package/dist/app/box-register.js +0 -51
- package/dist/app/box-register.js.map +0 -1
- package/dist/app/endpoint.d.ts +0 -19
- package/dist/app/endpoint.js +0 -43
- package/dist/app/endpoint.js.map +0 -1
- package/dist/app/pending.d.ts +0 -18
- package/dist/app/pending.js +0 -15
- package/dist/app/pending.js.map +0 -1
- package/dist/app/register.d.ts +0 -20
- package/dist/app/register.js +0 -34
- package/dist/app/register.js.map +0 -1
- package/dist/auth/facebook.d.ts +0 -12
- package/dist/auth/facebook.js +0 -68
- package/dist/auth/facebook.js.map +0 -1
- package/dist/auth/instagram.d.ts +0 -13
- package/dist/auth/instagram.js +0 -67
- package/dist/auth/instagram.js.map +0 -1
- package/dist/auth/linkedin.d.ts +0 -14
- package/dist/auth/linkedin.js +0 -73
- package/dist/auth/linkedin.js.map +0 -1
- package/dist/auth/tiktok.d.ts +0 -10
- package/dist/auth/tiktok.js +0 -66
- package/dist/auth/tiktok.js.map +0 -1
- package/dist/auth/uwaterloo.d.ts +0 -5
- package/dist/auth/uwaterloo.js +0 -123
- package/dist/auth/uwaterloo.js.map +0 -1
- package/dist/auth/x.d.ts +0 -17
- package/dist/auth/x.js +0 -83
- package/dist/auth/x.js.map +0 -1
- package/dist/browser/lock.d.ts +0 -15
- package/dist/browser/lock.js +0 -40
- package/dist/browser/lock.js.map +0 -1
package/dist/explore/server.js
CHANGED
|
@@ -15,24 +15,55 @@ import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSyn
|
|
|
15
15
|
import { createServer } from "node:http";
|
|
16
16
|
import { tmpdir } from "node:os";
|
|
17
17
|
import { dirname, join, relative } from "node:path";
|
|
18
|
+
import { keyId, parseKeyAddress } from "credvault";
|
|
18
19
|
import { writeRecords } from "../agent/records.js";
|
|
20
|
+
import { seedInCalls, seedOnPage } from "../auth/enroll.js";
|
|
19
21
|
import { SecretLeak, urlWithoutQuery } from "../auth/guard.js";
|
|
22
|
+
import { credentialFor } from "../auth/login.js";
|
|
23
|
+
import { SITE_LOGINS } from "../auth/sites.js";
|
|
24
|
+
import { articleText } from "../browser/article.js";
|
|
25
|
+
import { cardMask, cardShown } from "../browser/card-mask.js";
|
|
26
|
+
import { cleanStrings } from "../browser/clean-text.js";
|
|
27
|
+
import { CodeFailed, planScope, runCode } from "../browser/code.js";
|
|
28
|
+
import { dialogsOf, watchDialogs } from "../browser/dialogs.js";
|
|
20
29
|
import { fetchFile } from "../browser/download.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
30
|
+
import { watchDownloads } from "../browser/downloads.js";
|
|
31
|
+
import { collectWhenIdle, holdCollect } from "../browser/driver-memory.js";
|
|
32
|
+
import { extrasOf } from "../browser/extras.js";
|
|
33
|
+
import { handsLog } from "../browser/film.js";
|
|
34
|
+
import { chooseOption, defineFlow, flowRunner, pageWide, seedOf, } from "../browser/flow.js";
|
|
35
|
+
import { ariaWithFrames, captchaInView, withFrame } from "../browser/frames.js";
|
|
36
|
+
import { freshSeed, handsFor, seeded } from "../browser/human/index.js";
|
|
25
37
|
import { inPage } from "../browser/in-page.js";
|
|
26
38
|
import { layoutText } from "../browser/layout.js";
|
|
39
|
+
import { liveViewOf } from "../browser/live-view.js";
|
|
27
40
|
import { locate, locateAll, textOf } from "../browser/locate.js";
|
|
28
|
-
import {
|
|
41
|
+
import { fenceNavigations, outsideSession, urlAllowed, } from "../browser/nav-fence.js";
|
|
42
|
+
import { callName, diffHtml, diffShapes, exploreNetworkOn, findText, groupRows, htmlForFile, isPersonalProfile, MAX_BODY_BYTES, MAX_ROWS, NETWORK_OFF, parseRows, pickPath, redactUrl, shapes, } from "../browser/network.js";
|
|
43
|
+
import { pageErrorLog } from "../browser/page-errors.js";
|
|
44
|
+
import { compareProofs, proofFlags, proofPage } from "../browser/page-proof.js";
|
|
29
45
|
import { checkRows, readRecords } from "../browser/records.js";
|
|
30
46
|
import { snapshotPage } from "../browser/repair.js";
|
|
31
47
|
import { lookAt, urlShape } from "../browser/screens.js";
|
|
32
48
|
import { holdsSecret, secret } from "../browser/secrets.js";
|
|
33
|
-
import { bodyText, looksLikeWall, NeedsHuman } from "../browser/session.js";
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
49
|
+
import { bodyText, looksLikeWall, NeedsHuman, } from "../browser/session.js";
|
|
50
|
+
import { memoryDir, readMemory, recall, rememberCalls } from "../browser/site-memory.js";
|
|
51
|
+
import { actKind, refusedFields, tabWaiter } from "./act-outcome.js";
|
|
52
|
+
import { checkFill, checkSelect } from "./control-kind.js";
|
|
53
|
+
import { pageChange, steering } from "./steer.js";
|
|
54
|
+
import { AmbiguousTarget, oneTarget } from "./target-matches.js";
|
|
55
|
+
import { commandId, SENT_KEEP, withRepeat } from "./wire.js";
|
|
56
|
+
export { pageChange } from "./steer.js";
|
|
57
|
+
export { commandId, withRepeat } from "./wire.js";
|
|
58
|
+
import { scrollAndSettle } from "../browser/page-scroll.js";
|
|
59
|
+
import { windowBounds, windowPlace } from "../browser/window-bounds.js";
|
|
60
|
+
import { heldOther, replaceQuestion, valueMark } from "../deps/sink.js";
|
|
61
|
+
import { desktopAnswer } from "../desktop/answer.js";
|
|
62
|
+
import { desktopHands } from "../desktop/hands.js";
|
|
63
|
+
import { localDesktop } from "../desktop/mac.js";
|
|
64
|
+
import { memoryEffects } from "../engine/memory.js";
|
|
65
|
+
import { advance, applyAnswer, KEYS, nextStep, outcomeOf, } from "../engine/run.js";
|
|
66
|
+
import { errorOf } from "../errors.js";
|
|
36
67
|
import { describeFile, fileLine, filePayload, fileRef, filesInSets, } from "../files/store.js";
|
|
37
68
|
import { activates, amountNear, chargesNow, PaymentFlowYes, PaymentGate, PendingApprovals, paymentAmount, paymentFlowOf, paymentGate, scriptActs, } from "../gates/payment.js";
|
|
38
69
|
import { bankCodeSecret, codeWindowOpen } from "../money/bank-code.js";
|
|
@@ -43,16 +74,40 @@ import { redactRaw } from "../recorder/browser.js";
|
|
|
43
74
|
import { BINDING, OBSERVER_SCRIPT } from "../recorder/observer.js";
|
|
44
75
|
import { looksLikeSecretField, looksLikeSecretValue, REDACTED, redactAria, redactRow, redactText, } from "../recorder/redact.js";
|
|
45
76
|
import { saveRecording } from "../recorder/store.js";
|
|
77
|
+
import { captureFor } from "../runs/capture.js";
|
|
46
78
|
import { machine, runLog } from "../runs/log.js";
|
|
47
79
|
import { missCause, targetOf } from "../runs/success.js";
|
|
48
|
-
import {
|
|
80
|
+
import { releasePort } from "../share/ports.js";
|
|
81
|
+
import { accountIn, compiledDeps, platformOf } from "../workflows/compiled-deps.js";
|
|
82
|
+
import { loginName, loginWorkflows, PAGE_LOGIN } from "../workflows/logins.js";
|
|
83
|
+
import { findable, find as findTools, loginAccounts, signature, sitesOfHost, sitesTree, toolkitFor, toolsOf, } from "../workflows/toolkit.js";
|
|
84
|
+
import { originOf, pageFence } from "./boundary.js";
|
|
85
|
+
import { codeVersion, skewWatch } from "./code-version.js";
|
|
86
|
+
import { commandSchema, KEEPS_LOAD, LOOK_ONLY, LOOKED_AT, LOOKS, ONE_TARGET, placeHint, toLocatorHints, UNBATCHABLE, WAITS_FOR_CONTROL, WHOLE_PAGE, } from "./commands.js";
|
|
87
|
+
import { compactValue } from "./compact.js";
|
|
88
|
+
import { fitText, keepWhole } from "./fit.js";
|
|
49
89
|
import { readJournal } from "./journal.js";
|
|
50
|
-
import { DEFAULT_IDLE_MINUTES } from "./lease.js";
|
|
51
|
-
import { marksFor, missed } from "./marks.js";
|
|
90
|
+
import { DEFAULT_IDLE_MINUTES, leaseMs } from "./lease.js";
|
|
91
|
+
import { marksFor, missed, missText, refHints, StaleMark, scrollOf } from "./marks.js";
|
|
92
|
+
import { handColour, overlayFor, traceRow } from "./overlay.js";
|
|
93
|
+
import { COLLECT_SCRIPTS, scanScripts } from "./script-scan.js";
|
|
94
|
+
import { applyKeep, askLine, planKeep, signInHolder, siteFor, USERNAME_READ, } from "./sign-in-keep.js";
|
|
95
|
+
import { shotDiff, sinceStore } from "./since.js";
|
|
52
96
|
export { commandSchema, placeHint } from "./commands.js";
|
|
53
97
|
export { journalFileFor, readJournal, tokenFileFor } from "./journal.js";
|
|
54
98
|
/** How long one yes to pay on a host lasts. */
|
|
99
|
+
/** A tool as an answer lists it: what to send `flow`. */
|
|
55
100
|
const FLOW_MS = 30 * 60_000;
|
|
101
|
+
/** A panel approval waits as long as a phone one (`askOverChannel`). */
|
|
102
|
+
const PANE_ASK_MS = 30 * 60_000;
|
|
103
|
+
/** eval answer chars before compaction (~5k tokens). */
|
|
104
|
+
const EVAL_LIMIT = 20_000;
|
|
105
|
+
/** Page text read whole before compaction; past this a page is not text. */
|
|
106
|
+
const WHOLE_TEXT = 2_000_000;
|
|
107
|
+
/** A `code` command stops after this long: a loop that never ends. */
|
|
108
|
+
const CODE_MS = 30 * 60_000;
|
|
109
|
+
/** In Chrome after ⌘⇧O: the idle close waits this long for Bring back. */
|
|
110
|
+
const MOVED_IDLE_MS = 8 * 3_600_000;
|
|
56
111
|
/** How long a spending click's page gets to say paid or declined before it counts as no charge. */
|
|
57
112
|
const SETTLE_MS = Number(process.env.EXPLORE_CHARGE_SETTLE_MS ?? 60_000);
|
|
58
113
|
/** A frame's visible, editable text inputs, each tagged `data-ab-billing` so a locator finds it again; `billingKind` reads the label. */
|
|
@@ -76,8 +131,12 @@ const FRAME_MS = 5_000;
|
|
|
76
131
|
/** How long the whole-page measure may take before the row goes without it. */
|
|
77
132
|
const FULL_MS = 1_500;
|
|
78
133
|
const HAND_GRACE_MS = 750;
|
|
79
|
-
/**
|
|
80
|
-
|
|
134
|
+
/** The vault's key at an address; a keep with `key` needs the vault. */
|
|
135
|
+
async function vaultKey(keeper, address) {
|
|
136
|
+
if (!keeper)
|
|
137
|
+
throw new Error("keep: no key vault here; keep under an env name alone");
|
|
138
|
+
return keeper.get(address);
|
|
139
|
+
}
|
|
81
140
|
/**
|
|
82
141
|
* Where an act left the page, short: an OAuth URL runs to 2 KB, and every
|
|
83
142
|
* act and batch step repeats it. The path stays, a long query does not;
|
|
@@ -102,45 +161,38 @@ function leanUrls(answer) {
|
|
|
102
161
|
...(Array.isArray(a.done) ? { done: a.done.map(step) } : {}),
|
|
103
162
|
};
|
|
104
163
|
}
|
|
105
|
-
/**
|
|
106
|
-
export function
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
const n = left.get(r) ?? 0;
|
|
113
|
-
if (n)
|
|
114
|
-
left.set(r, n - 1);
|
|
115
|
-
else
|
|
116
|
-
added.push(r);
|
|
117
|
-
}
|
|
118
|
-
const gone = [...left.values()].reduce((a, b) => a + b, 0);
|
|
119
|
-
return {
|
|
120
|
-
added: added.slice(0, CHANGED_ROWS),
|
|
121
|
-
gone,
|
|
122
|
-
...(added.length > CHANGED_ROWS ? { more: added.length - CHANGED_ROWS } : {}),
|
|
123
|
-
};
|
|
164
|
+
/** A wall for the agent: a sign-in wall names the site's `<site>-login` tool (the provider's on its products). */
|
|
165
|
+
export function wallAnswer(wall, url) {
|
|
166
|
+
if (!wall || wall.kind === "captcha")
|
|
167
|
+
return wall;
|
|
168
|
+
const host = URL.canParse(url) ? new URL(url).host : "";
|
|
169
|
+
const site = sitesOfHost(host, SITE_LOGINS, []).find((s) => SITE_LOGINS.some((l) => l.site === s));
|
|
170
|
+
return site ? { ...wall, signIn: loginName(site) } : wall;
|
|
124
171
|
}
|
|
172
|
+
/** After a sign-in's submit and load: time for the site to show the next page or its error. */
|
|
173
|
+
const SIGN_IN_SETTLE_MS = 2500;
|
|
125
174
|
export { DEFAULT_IDLE_MINUTES };
|
|
126
175
|
/**
|
|
127
|
-
* After an act: a page it navigated to loads, then
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* waits for its own control anyway.
|
|
176
|
+
* After an act: a page it navigated to loads, then the network goes quiet or the
|
|
177
|
+
* DOM stops changing for 500 ms, whichever comes first, at most 1.5 s. Live apps
|
|
178
|
+
* (LinkedIn, Facebook, X) poll forever and never reach networkidle, but stop
|
|
179
|
+
* redrawing; the next command's locator waits for its own control anyway.
|
|
131
180
|
*/
|
|
132
181
|
async function settle(page) {
|
|
133
182
|
await page.waitForLoadState("domcontentloaded", { timeout: 8_000 }).catch(() => undefined);
|
|
134
|
-
|
|
183
|
+
const idle = page.waitForLoadState("networkidle", { timeout: 1_500 }).catch(() => undefined);
|
|
184
|
+
// A navigation mid-wait kills the evaluate: the network wait goes on alone.
|
|
185
|
+
const still = page.evaluate(`(${domQuiet(500, 1_500)})()`).catch(() => idle);
|
|
186
|
+
await Promise.race([idle, still]);
|
|
135
187
|
}
|
|
136
|
-
/** Resolves once the DOM has not changed for
|
|
137
|
-
const
|
|
188
|
+
/** Resolves once the DOM has not changed for `still` ms, or after `cap` ms on a page that never stops. */
|
|
189
|
+
const domQuiet = (still, cap) => `() => new Promise((done) => {
|
|
138
190
|
let t;
|
|
139
191
|
const end = () => { o.disconnect(); clearTimeout(cap); done(true); };
|
|
140
|
-
const o = new MutationObserver(() => { clearTimeout(t); t = setTimeout(end,
|
|
192
|
+
const o = new MutationObserver(() => { clearTimeout(t); t = setTimeout(end, ${still}); });
|
|
141
193
|
o.observe(document, { subtree: true, childList: true, attributes: true, characterData: true });
|
|
142
|
-
t = setTimeout(end,
|
|
143
|
-
const cap = setTimeout(end,
|
|
194
|
+
t = setTimeout(end, ${still});
|
|
195
|
+
const cap = setTimeout(end, ${cap});
|
|
144
196
|
})`;
|
|
145
197
|
/**
|
|
146
198
|
* Explore runs as one long flow: the runner owns the session, so a login
|
|
@@ -157,18 +209,35 @@ export async function startExplore(opts) {
|
|
|
157
209
|
if (opts.fileSets?.length && !opts.files)
|
|
158
210
|
throw new Error("--files: no files here (they live on the Mac: autobrowse files add)");
|
|
159
211
|
const files = opts.fileSets?.length && opts.files ? await filesInSets(opts.files, opts.fileSets) : [];
|
|
212
|
+
// A leg run here signs in as its own site (plan.account re-sites it); with `stop` set, not at all.
|
|
213
|
+
const leg = { site: null, stop: null };
|
|
214
|
+
const login = opts.login;
|
|
160
215
|
const ready = new Promise((resolve, reject) => {
|
|
161
216
|
const flow = defineFlow({
|
|
162
217
|
site: opts.site,
|
|
163
218
|
name: "explore",
|
|
219
|
+
// the journal, the run history and the observations record the session
|
|
220
|
+
trace: false,
|
|
164
221
|
run: (fp) => new Promise((finish) => {
|
|
165
222
|
resolve({ fp, finish });
|
|
166
223
|
}),
|
|
167
224
|
});
|
|
168
|
-
const
|
|
225
|
+
const fenced = { ...opts.browser, fenced: true, fenceHops: hopsOf(opts) };
|
|
226
|
+
const runner = flowRunner(opts.allowHosts ? fenced : opts.browser, {
|
|
169
227
|
pace: opts.pace ?? null,
|
|
170
|
-
network: { maxRows: MAX_ROWS, maxBodyBytes: MAX_BODY_BYTES },
|
|
171
|
-
...(
|
|
228
|
+
network: { maxRows: MAX_ROWS, maxBodyBytes: MAX_BODY_BYTES, on: exploreNetworkOn() },
|
|
229
|
+
...(login
|
|
230
|
+
? {
|
|
231
|
+
// the session's site = no site named (a wall): the leg's; a named one (OAuth) stays
|
|
232
|
+
login: async (lfp, site, account) => {
|
|
233
|
+
if (site !== opts.site)
|
|
234
|
+
return login(lfp, site, account);
|
|
235
|
+
if (leg.stop)
|
|
236
|
+
throw new Error(leg.stop);
|
|
237
|
+
return login(lfp, leg.site ?? site, account);
|
|
238
|
+
},
|
|
239
|
+
}
|
|
240
|
+
: {}),
|
|
172
241
|
...(opts.captcha ? { captcha: opts.captcha } : {}),
|
|
173
242
|
});
|
|
174
243
|
// A run that fails before the flow starts (the profile held elsewhere) is the opener's
|
|
@@ -176,52 +245,15 @@ export async function startExplore(opts) {
|
|
|
176
245
|
void runner.run(flow, undefined).catch(reject);
|
|
177
246
|
});
|
|
178
247
|
const { fp, finish: finishFlow } = await ready;
|
|
179
|
-
return serve(opts, fp, finishFlow, files);
|
|
248
|
+
return serve(opts, fp, finishFlow, files, leg);
|
|
180
249
|
}
|
|
181
|
-
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
case "open":
|
|
187
|
-
await d.open(a.app);
|
|
188
|
-
return { ok: true };
|
|
189
|
-
case "tree":
|
|
190
|
-
return { tree: redactText(treeText(await d.tree(a.app, a.depth))) };
|
|
191
|
-
case "click":
|
|
192
|
-
await d.click({
|
|
193
|
-
name: a.name,
|
|
194
|
-
...(a.role ? { role: a.role } : {}),
|
|
195
|
-
...(a.app ? { app: a.app } : {}),
|
|
196
|
-
});
|
|
197
|
-
return { ok: true };
|
|
198
|
-
case "type":
|
|
199
|
-
await d.type(a.text);
|
|
200
|
-
return { ok: true };
|
|
201
|
-
case "key":
|
|
202
|
-
await d.key(a.combo);
|
|
203
|
-
return { ok: true };
|
|
204
|
-
case "shot": {
|
|
205
|
-
const file = join(shotsDir, `os-${String(n).padStart(4, "0")}.png`);
|
|
206
|
-
await d.screenshot(file);
|
|
207
|
-
return { file };
|
|
208
|
-
}
|
|
209
|
-
case "shell": {
|
|
210
|
-
const r = await d.shell(a.command, a.root ?? false);
|
|
211
|
-
// Output can hold tokens: masked like everything else that leaves the socket.
|
|
212
|
-
return {
|
|
213
|
-
code: r.code,
|
|
214
|
-
stdout: redactText(r.stdout.slice(0, 4_000)),
|
|
215
|
-
stderr: redactText(r.stderr.slice(0, 1_000)),
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
case "wait":
|
|
219
|
-
await new Promise((r) => setTimeout(r, a.ms));
|
|
220
|
-
return { ok: true };
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
250
|
+
/** Command ids kept per session: a resend this far back still gets its first answer. */
|
|
251
|
+
/** The browser or its page closed under the act. */
|
|
252
|
+
export const browserGone = (err) => /Target (?:page, context or browser )?(?:has been )?closed|browser has been closed|Browser closed|Session closed/i.test(err instanceof Error ? err.message : String(err));
|
|
253
|
+
const hopsOf = (opts) => opts.fenceHops ?? opts.browser.fenceHops ?? "blank";
|
|
254
|
+
async function serve(opts, fp, finishFlow, sessionFiles, leg = { site: null, stop: null }) {
|
|
224
255
|
const now = opts.now ?? Date.now;
|
|
256
|
+
const actMs = opts.actTimeoutMs ?? 10_000;
|
|
225
257
|
const t0 = now();
|
|
226
258
|
const startedAt = new Date(t0).toISOString();
|
|
227
259
|
const infoFile = opts.tokenFile ? `${opts.tokenFile.replace(/\.token$/, "")}.json` : null;
|
|
@@ -232,7 +264,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
232
264
|
const tBase = carried ? carried.t + 1 : 0;
|
|
233
265
|
const shotsDir = join(opts.recordingsDir, `.explore-${opts.site}`);
|
|
234
266
|
mkdirSync(shotsDir, { recursive: true });
|
|
235
|
-
const desktop = opts.desktop ?? (
|
|
267
|
+
const desktop = opts.desktop ?? localDesktop();
|
|
236
268
|
// A resumed journal points at the earlier shots: number on past them. A fresh
|
|
237
269
|
// session writes over them, so the folder stays one session's size.
|
|
238
270
|
let shotN = carried ? readdirSync(shotsDir).filter((f) => /^\d{4}\.png$/.test(f)).length : 0;
|
|
@@ -242,10 +274,42 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
242
274
|
});
|
|
243
275
|
/** The active page: it moves when a popup opens (OAuth) and comes back after; re-read per command. */
|
|
244
276
|
let page = fp.page;
|
|
245
|
-
|
|
246
|
-
let
|
|
247
|
-
|
|
248
|
-
|
|
277
|
+
/** Outside pages that loaded past the fence, then were blanked (`browser/nav-fence`). */
|
|
278
|
+
let landings = 0;
|
|
279
|
+
// Popups share the context: one watcher sees every tab's dialogs.
|
|
280
|
+
const dialogs = dialogsOf(fp.page) ?? watchDialogs(fp.page.context());
|
|
281
|
+
const downloads = watchDownloads(fp.page.context(), join(shotsDir, "downloads"));
|
|
282
|
+
// uncaught errors in every tab, from the observer: `errors`, and new throws on an act
|
|
283
|
+
const pageErrors = pageErrorLog();
|
|
284
|
+
// the live view (`browser/live-view`): headless, the viewer app is the window
|
|
285
|
+
const live = liveViewOf(fp.page.context());
|
|
286
|
+
const inWindow = opts.browser.headless === false && !live;
|
|
287
|
+
// A film stays clean: its rows go to the pane json.
|
|
288
|
+
const overlay = overlayFor(opts.overlay ?? ((inWindow || live !== null) && !opts.browser.film), {
|
|
289
|
+
tray: inWindow,
|
|
290
|
+
// the panel draws in the viewer, over the stream
|
|
291
|
+
...(live ? { host: (why) => live.overlayHost(why), geometry: (p) => live.geometry(p) } : {}),
|
|
292
|
+
...opts.overlayDeps,
|
|
293
|
+
});
|
|
294
|
+
// A new document wipes the layer: the panel comes back on it.
|
|
295
|
+
page.on("load", (p) => void overlay.loaded(p));
|
|
296
|
+
overlay.who(opts.site, handColour(opts.port));
|
|
297
|
+
const steer = steering({
|
|
298
|
+
scene: {
|
|
299
|
+
where: () => page.url(),
|
|
300
|
+
rows: () => rows(),
|
|
301
|
+
short: shortUrl,
|
|
302
|
+
key: "url",
|
|
303
|
+
noun: "page",
|
|
304
|
+
},
|
|
305
|
+
journal: (row) => journal(row),
|
|
306
|
+
held: (h) => overlay.held(page, h),
|
|
307
|
+
takeNotes: () => overlay.takeNotes(),
|
|
308
|
+
busy: () => busy,
|
|
309
|
+
now,
|
|
310
|
+
change: pageChange,
|
|
311
|
+
redact: redactText,
|
|
312
|
+
});
|
|
249
313
|
/**
|
|
250
314
|
* Help without a pause: a person at a headed browser types the code the
|
|
251
315
|
* agent could not get, or clicks past the screen it was stuck on, between
|
|
@@ -253,18 +317,24 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
253
317
|
* until the next command, whose answer says so (`helped`).
|
|
254
318
|
*/
|
|
255
319
|
let helpedActs = 0;
|
|
320
|
+
/** Hand acts in the run being written: one or more, and its end builds a draft walk. */
|
|
321
|
+
let runHandActs = 0;
|
|
322
|
+
/** Sign-ins typed by hand, in memory only (WA-1307). */
|
|
323
|
+
const signIns = signInHolder();
|
|
256
324
|
/** Commands in flight, and when the last one's own late DOM events stop counting as a person's. */
|
|
257
325
|
let busy = 0;
|
|
258
326
|
let quietAt = 0;
|
|
327
|
+
/** Tabs a command opened (a `target=_blank` link, a popup). A person's own tabs are never in it. */
|
|
328
|
+
const stepTabs = new Set();
|
|
329
|
+
/** The agent moved on: each tab it left holds a renderer (100 to 300 MB) until the browser closes. */
|
|
330
|
+
const closeStepTabs = async () => {
|
|
331
|
+
const left = [...stepTabs].filter((p) => p !== page && !p.isClosed());
|
|
332
|
+
await Promise.all(left.map((p) => p.close().catch(() => undefined)));
|
|
333
|
+
return left.length;
|
|
334
|
+
};
|
|
259
335
|
/** Where the agent last left the page: the url, and the rows when its last act diffed them. */
|
|
260
336
|
let left = null;
|
|
261
|
-
const byHand = () => paused || (busy === 0 && now() >= quietAt);
|
|
262
|
-
const resume = () => {
|
|
263
|
-
paused = false;
|
|
264
|
-
for (const w of waiters)
|
|
265
|
-
w();
|
|
266
|
-
waiters = [];
|
|
267
|
-
};
|
|
337
|
+
const byHand = () => steer.paused() || (busy === 0 && now() >= quietAt);
|
|
268
338
|
// Run history: the journal is resume state and goes on `close`; the run stays.
|
|
269
339
|
// A resumed session goes on writing the run its journal's sidecar names.
|
|
270
340
|
const runSide = opts.journalFile ? `${opts.journalFile}.run` : null;
|
|
@@ -279,6 +349,10 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
279
349
|
let closedWhy = null;
|
|
280
350
|
/** `close` was sent: nothing of this run is left to resume. */
|
|
281
351
|
let closing = false;
|
|
352
|
+
// keep's first phase: the name asked about → the mark of the value that would be written.
|
|
353
|
+
const keepAsked = new Map();
|
|
354
|
+
/** Logins whose held authenticator seed `seed` asked about replacing. */
|
|
355
|
+
const seedAsked = new Set();
|
|
282
356
|
/** The page the command in flight acts on, as it was before the act. */
|
|
283
357
|
let lookBefore = null;
|
|
284
358
|
/**
|
|
@@ -295,7 +369,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
295
369
|
const p = page;
|
|
296
370
|
void (async () => {
|
|
297
371
|
await p.waitForLoadState("domcontentloaded", { timeout: 8_000 }).catch(() => undefined);
|
|
298
|
-
await p.evaluate(`(${
|
|
372
|
+
await p.evaluate(`(${domQuiet(300, 3_000)})()`).catch(() => undefined);
|
|
299
373
|
const look = p.isClosed() ? null : await lookAt(p).catch(() => null);
|
|
300
374
|
if (gen === lookGen && look)
|
|
301
375
|
handLook = look;
|
|
@@ -313,6 +387,36 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
313
387
|
// not written
|
|
314
388
|
}
|
|
315
389
|
};
|
|
390
|
+
/**
|
|
391
|
+
* What the model saw, for training (designs/2026-10-26-run-observations.md); none on a
|
|
392
|
+
* personal profile. A command's pictures and marks boxes wait here for its row.
|
|
393
|
+
*/
|
|
394
|
+
let capture = null;
|
|
395
|
+
let stepPics = [];
|
|
396
|
+
let stepBoxes = null;
|
|
397
|
+
/** The command's typing, planned against real time: for its run row. */
|
|
398
|
+
let stepTyped = null;
|
|
399
|
+
/** The screen last pictured (URL shape and landmarks): a new one takes a picture. */
|
|
400
|
+
let lastScreen = "";
|
|
401
|
+
/** The Claude Code session that last sent a command: rows name a change. */
|
|
402
|
+
let lastSession = process.env.CLAUDE_CODE_SESSION_ID ?? null;
|
|
403
|
+
const picture = async () => {
|
|
404
|
+
const c = capture;
|
|
405
|
+
if (!c || page.isClosed() || secretFlow)
|
|
406
|
+
return null;
|
|
407
|
+
try {
|
|
408
|
+
const shot = await page.screenshot({
|
|
409
|
+
type: "jpeg",
|
|
410
|
+
quality: 80,
|
|
411
|
+
scale: "css",
|
|
412
|
+
mask: cardMask(page),
|
|
413
|
+
});
|
|
414
|
+
return c.picture(shot);
|
|
415
|
+
}
|
|
416
|
+
catch {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
};
|
|
316
420
|
const openRun = () => {
|
|
317
421
|
if (!opts.runs || (history && !history.ended()))
|
|
318
422
|
return;
|
|
@@ -327,19 +431,33 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
327
431
|
}
|
|
328
432
|
if (runSide)
|
|
329
433
|
writeFileSync(runSide, history.id, { mode: 0o600 });
|
|
434
|
+
const runs = opts.runs;
|
|
435
|
+
const id = history.id;
|
|
436
|
+
try {
|
|
437
|
+
capture = isPersonalProfile(opts.site) ? null : captureFor(runs, opts.site, id);
|
|
438
|
+
}
|
|
439
|
+
catch {
|
|
440
|
+
capture = null;
|
|
441
|
+
}
|
|
442
|
+
lastScreen = "";
|
|
330
443
|
const vp = page.viewportSize();
|
|
331
444
|
logged((h) => h.start({
|
|
332
|
-
run:
|
|
445
|
+
run: id,
|
|
333
446
|
site: opts.site,
|
|
334
447
|
driver: opts.driver ?? "console",
|
|
335
448
|
goal: firstGoal,
|
|
336
449
|
machine: machine(),
|
|
337
450
|
resumed: was !== null,
|
|
338
451
|
viewport: vp ? { width: vp.width, height: vp.height } : null,
|
|
452
|
+
...(lastSession ? { session: lastSession } : {}),
|
|
453
|
+
...(opts.pace ? { seed } : {}),
|
|
339
454
|
}));
|
|
340
455
|
firstGoal = null;
|
|
341
456
|
saved = false;
|
|
457
|
+
runHandActs = 0;
|
|
342
458
|
};
|
|
459
|
+
/** Observation packs still at work. */
|
|
460
|
+
const packs = [];
|
|
343
461
|
/** `resumable`: an idle close or a lost browser, whose next life goes on writing this run. */
|
|
344
462
|
const endRun = async (outcome, summary, resumable = false) => {
|
|
345
463
|
const h = history;
|
|
@@ -347,11 +465,30 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
347
465
|
return;
|
|
348
466
|
// A person who closed the browser ended on the page they last saw.
|
|
349
467
|
const look = page.isClosed() ? handLook : await lookAt(page).catch(() => null);
|
|
350
|
-
|
|
468
|
+
const pic = await picture();
|
|
469
|
+
logged((l) => l.end({ outcome, summary, look, ...(pic ? { pic } : {}) }));
|
|
470
|
+
// not awaited: `done` answers at once; the close waits for it (`packs`). A pack that fails is the next ship's (`packStale`).
|
|
471
|
+
if (capture)
|
|
472
|
+
packs.push(capture.close().catch(() => undefined));
|
|
473
|
+
capture = null;
|
|
351
474
|
if (runSide && !resumable)
|
|
352
475
|
rmSync(runSide, { force: true });
|
|
476
|
+
const acts = runHandActs;
|
|
477
|
+
runHandActs = 0;
|
|
478
|
+
if (opts.onHandRun &&
|
|
479
|
+
acts > 0 &&
|
|
480
|
+
!resumable &&
|
|
481
|
+
opts.driver !== "person" &&
|
|
482
|
+
outcome !== "failed" &&
|
|
483
|
+
outcome !== "idle")
|
|
484
|
+
try {
|
|
485
|
+
opts.onHandRun({ site: opts.site, run: h.id, outcome, acts });
|
|
486
|
+
}
|
|
487
|
+
catch (err) {
|
|
488
|
+
console.error(`draft walk for ${h.id}: ${err instanceof Error ? err.message : String(err)}`);
|
|
489
|
+
}
|
|
353
490
|
};
|
|
354
|
-
/**
|
|
491
|
+
/** The whole accessibility tree: what a full answer would have cost; null when it takes too long. */
|
|
355
492
|
const wholePage = async () => {
|
|
356
493
|
const p = page;
|
|
357
494
|
let timer;
|
|
@@ -360,34 +497,76 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
360
497
|
});
|
|
361
498
|
const tree = await Promise.race([ariaWithFrames(p).catch(() => null), late]);
|
|
362
499
|
clearTimeout(timer);
|
|
363
|
-
return tree
|
|
500
|
+
return tree;
|
|
364
501
|
};
|
|
365
502
|
/**
|
|
366
503
|
* One command's row: how long, what its answer cost the caller in chars,
|
|
367
504
|
* and (for acts and looks) what the whole page would have. The whole page
|
|
368
505
|
* is measured beside the next command, never in its way.
|
|
369
506
|
*/
|
|
370
|
-
const counted = (c, t0, error,
|
|
507
|
+
const counted = (c, t0, error,
|
|
508
|
+
/** The answer as the caller got it: its length is the cost, its masked text the observation. */
|
|
509
|
+
answer,
|
|
371
510
|
/** The whole error, call log included: why a locator missed. */
|
|
372
|
-
detail
|
|
511
|
+
detail,
|
|
512
|
+
/** The Claude Code session that sent it (`x-claude-session`). */
|
|
513
|
+
session) => {
|
|
514
|
+
// The overlay is for a person who watches; a run's rows never count it.
|
|
515
|
+
if (c.cmd === "overlay" || c.cmd === "window" || c.cmd === "waitNote")
|
|
516
|
+
return;
|
|
517
|
+
// A session control answers mid-command: the pictures wait for the command they belong to.
|
|
518
|
+
const own = !IMMEDIATE.has(c.cmd);
|
|
519
|
+
const pics = own ? stepPics : [];
|
|
520
|
+
const boxes = own ? stepBoxes : null;
|
|
521
|
+
const typed = own ? stepTyped : null;
|
|
522
|
+
if (own) {
|
|
523
|
+
stepPics = [];
|
|
524
|
+
stepBoxes = null;
|
|
525
|
+
stepTyped = null;
|
|
526
|
+
}
|
|
373
527
|
const h = history;
|
|
374
528
|
if (!h || h.ended())
|
|
375
529
|
return;
|
|
376
530
|
const ms = now() - t0;
|
|
377
531
|
const host = URL.canParse(page.url()) ? new URL(page.url()).host : "";
|
|
378
|
-
const missed = error !== null &&
|
|
532
|
+
const missed = error !== null &&
|
|
533
|
+
"hints" in c &&
|
|
534
|
+
c.hints &&
|
|
535
|
+
/^(locator\.\w+: (Timeout|Error: strict mode violation)|ambiguous: )/.test(error)
|
|
379
536
|
? { target: redactText(targetOf(c.hints)), miss: missCause(detail ?? error) }
|
|
380
537
|
: {};
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
538
|
+
const cap = capture;
|
|
539
|
+
const stored = (text) => {
|
|
540
|
+
try {
|
|
541
|
+
return cap ? cap.text(text) : null;
|
|
542
|
+
}
|
|
543
|
+
catch {
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
const obs = stored(answer);
|
|
548
|
+
const by = session && session !== lastSession ? session : null;
|
|
549
|
+
if (session)
|
|
550
|
+
lastSession = session;
|
|
551
|
+
const write = (tree) => {
|
|
552
|
+
const after = tree === null ? null : stored(tree);
|
|
553
|
+
logged((l) => l.cmd({
|
|
554
|
+
cmd: c.cmd,
|
|
555
|
+
ok: error === null,
|
|
556
|
+
error: error === null ? null : redactText(error).slice(0, 200),
|
|
557
|
+
ms,
|
|
558
|
+
chars: answer.length,
|
|
559
|
+
full: tree === null ? null : tree.length,
|
|
560
|
+
host,
|
|
561
|
+
...missed,
|
|
562
|
+
...(obs ? { obs } : {}),
|
|
563
|
+
...(after ? { after } : {}),
|
|
564
|
+
...(pics.length ? { pics } : {}),
|
|
565
|
+
...(boxes ? { boxes } : {}),
|
|
566
|
+
...(typed ? { typed } : {}),
|
|
567
|
+
...(by ? { session: by } : {}),
|
|
568
|
+
}));
|
|
569
|
+
};
|
|
391
570
|
if (error !== null || !WHOLE_PAGE.has(c.cmd))
|
|
392
571
|
return write(null);
|
|
393
572
|
void wholePage().then(write);
|
|
@@ -411,7 +590,56 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
411
590
|
.at(-1);
|
|
412
591
|
return prev ? parseRows(readFileSync(join(shotsDir, prev), "utf8")) : null;
|
|
413
592
|
};
|
|
414
|
-
const
|
|
593
|
+
const waitFor = async (c) => {
|
|
594
|
+
const asked = ["text", "gone", "url", "hints", "idle", "download", "ms"].filter((k) => c[k] !== undefined);
|
|
595
|
+
if (asked.length !== 1)
|
|
596
|
+
throw new Error("wait: give one of text, gone, url, hints, idle, download, ms");
|
|
597
|
+
const ms = c.timeout ?? 15_000;
|
|
598
|
+
const t0 = Date.now();
|
|
599
|
+
if (c.ms !== undefined) {
|
|
600
|
+
await new Promise((r) => setTimeout(r, c.ms));
|
|
601
|
+
return { waited: Date.now() - t0, url: page.url() };
|
|
602
|
+
}
|
|
603
|
+
const n = downloads.count();
|
|
604
|
+
try {
|
|
605
|
+
if (c.text !== undefined)
|
|
606
|
+
await page.getByText(c.text).first().waitFor({ state: "visible", timeout: ms });
|
|
607
|
+
else if (c.gone !== undefined)
|
|
608
|
+
await page.waitForFunction(`!document.body?.innerText.includes(${JSON.stringify(c.gone)})`, undefined, { timeout: ms });
|
|
609
|
+
else if (c.url !== undefined) {
|
|
610
|
+
const part = c.url;
|
|
611
|
+
await page.waitForURL((u) => u.href.includes(part), { timeout: ms });
|
|
612
|
+
}
|
|
613
|
+
else if (c.hints)
|
|
614
|
+
await locate(page, c.hints).waitFor({
|
|
615
|
+
state: c.hidden ? "hidden" : "visible",
|
|
616
|
+
timeout: ms,
|
|
617
|
+
});
|
|
618
|
+
else if (c.idle)
|
|
619
|
+
await page.waitForLoadState("networkidle", { timeout: ms });
|
|
620
|
+
else {
|
|
621
|
+
while (downloads.count() === n) {
|
|
622
|
+
if (Date.now() - t0 > ms)
|
|
623
|
+
throw Object.assign(new Error("timeout"), { name: "TimeoutError" });
|
|
624
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
625
|
+
}
|
|
626
|
+
await downloads.settled();
|
|
627
|
+
return { waited: Date.now() - t0, download: downloads.since(n)[0] };
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
catch (err) {
|
|
631
|
+
if (err instanceof Error && err.name === "TimeoutError")
|
|
632
|
+
throw new Error(`wait: ${asked[0]} not met after ${Math.round(ms / 1000)} s`);
|
|
633
|
+
throw err;
|
|
634
|
+
}
|
|
635
|
+
return { waited: Date.now() - t0, url: page.url() };
|
|
636
|
+
};
|
|
637
|
+
const network = async (c) => {
|
|
638
|
+
if (c.scripts)
|
|
639
|
+
return {
|
|
640
|
+
url: redactUrl(page.url()),
|
|
641
|
+
...scanScripts((await page.evaluate(COLLECT_SCRIPTS))),
|
|
642
|
+
};
|
|
415
643
|
const log = fp.network;
|
|
416
644
|
if (!log)
|
|
417
645
|
throw new Error(NETWORK_OFF);
|
|
@@ -421,12 +649,22 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
421
649
|
const r = log.row(c.id);
|
|
422
650
|
if (!r)
|
|
423
651
|
throw new Error(`no call ${c.id} (the log keeps the newest ${MAX_ROWS})`);
|
|
424
|
-
|
|
425
|
-
|
|
652
|
+
if (r.body === undefined)
|
|
653
|
+
return r;
|
|
654
|
+
const body = c.pick ? pickPath(r.body, c.pick) : r.body;
|
|
655
|
+
if (body === undefined)
|
|
656
|
+
throw new Error(`call ${c.id} has nothing at ${c.pick}`);
|
|
657
|
+
const v = compactValue(body, c.limit ?? 20_000);
|
|
658
|
+
if (v.kind === "json")
|
|
659
|
+
return { ...r, body: JSON.stringify(body, null, 1) };
|
|
660
|
+
const json = JSON.stringify(body);
|
|
426
661
|
return {
|
|
427
662
|
...r,
|
|
428
|
-
|
|
429
|
-
|
|
663
|
+
body: v.text,
|
|
664
|
+
format: "toon",
|
|
665
|
+
...(v.even
|
|
666
|
+
? { whole: { chars: json.length, file: keepWhole(shotsDir, "network", json, "json") } }
|
|
667
|
+
: {}),
|
|
430
668
|
};
|
|
431
669
|
}
|
|
432
670
|
if (c.diff) {
|
|
@@ -435,11 +673,16 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
435
673
|
return { diff: null, reason: "no earlier session of this site" };
|
|
436
674
|
return { diff: diffShapes(shapes(prev), shapes(rows)) };
|
|
437
675
|
}
|
|
438
|
-
|
|
439
|
-
|
|
676
|
+
if (c.find)
|
|
677
|
+
return { found: findText(rows, c.find), file: netFile };
|
|
678
|
+
const hits = c.filter
|
|
679
|
+
? rows.filter((r) => r.url.includes(c.filter ?? "") || callName(r)?.includes(c.filter ?? ""))
|
|
680
|
+
: rows;
|
|
681
|
+
const groups = groupRows(hits, c.all);
|
|
682
|
+
const shown = groups.slice(-(c.last ?? 40));
|
|
440
683
|
return {
|
|
441
|
-
calls: shown
|
|
442
|
-
...(
|
|
684
|
+
calls: shown,
|
|
685
|
+
...(groups.length > shown.length ? { more: groups.length - shown.length } : {}),
|
|
443
686
|
...(log.personal ? { personal: true } : {}),
|
|
444
687
|
file: netFile,
|
|
445
688
|
};
|
|
@@ -484,7 +727,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
484
727
|
const shoot = async () => {
|
|
485
728
|
const file = join(shotsDir, `${String(shotN++).padStart(4, "0")}.png`);
|
|
486
729
|
// A failed shot is an error, never a path to a file that is not there.
|
|
487
|
-
await page.screenshot({ path: file });
|
|
730
|
+
await page.screenshot({ path: file, mask: cardMask(page) });
|
|
488
731
|
return file;
|
|
489
732
|
};
|
|
490
733
|
const journal = (a) => {
|
|
@@ -502,18 +745,78 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
502
745
|
if (hand)
|
|
503
746
|
lookWhenQuiet();
|
|
504
747
|
};
|
|
748
|
+
/** A sign-in typed by hand: asked once on the panel; a yes stores it sealed (WA-1307). */
|
|
749
|
+
const offerSignIn = async (p, h) => {
|
|
750
|
+
const store = opts.credentials;
|
|
751
|
+
if (!store)
|
|
752
|
+
return;
|
|
753
|
+
const plan = await planKeep(store, siteFor(h.host), h, new Date().toISOString().slice(0, 10));
|
|
754
|
+
if (plan.outcome === "same")
|
|
755
|
+
return;
|
|
756
|
+
const yes = await overlay.ask(p, askLine(plan));
|
|
757
|
+
if (yes === null) {
|
|
758
|
+
signIns.park(h);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (!yes)
|
|
762
|
+
return signIns.decline(h.host);
|
|
763
|
+
await applyKeep(store, plan, h);
|
|
764
|
+
console.error(`kept the sign-in typed by hand as ${plan.name}`);
|
|
765
|
+
};
|
|
766
|
+
/** After the submit settles: the password field gone means it signed in. */
|
|
767
|
+
const checkSignIn = async (p) => {
|
|
768
|
+
await p.waitForLoadState("load", { timeout: 10_000 }).catch(() => undefined);
|
|
769
|
+
await new Promise((r) => setTimeout(r, SIGN_IN_SETTLE_MS));
|
|
770
|
+
if (p.isClosed())
|
|
771
|
+
return;
|
|
772
|
+
const form = await p
|
|
773
|
+
.locator('input[type="password"]:visible')
|
|
774
|
+
.count()
|
|
775
|
+
.catch(() => 1);
|
|
776
|
+
if (form > 0)
|
|
777
|
+
return signIns.disarm();
|
|
778
|
+
const h = signIns.take();
|
|
779
|
+
if (h?.username)
|
|
780
|
+
await offerSignIn(p, { ...h, username: h.username }).catch(() => undefined);
|
|
781
|
+
};
|
|
782
|
+
const heldFrom = (raw, p) => {
|
|
783
|
+
if (!opts.credentials)
|
|
784
|
+
return;
|
|
785
|
+
if (raw.kind === "input") {
|
|
786
|
+
// the site filled the name itself: read its field once, in code
|
|
787
|
+
if (signIns.typed(raw.target, raw.value, p.url()))
|
|
788
|
+
void p
|
|
789
|
+
.evaluate(USERNAME_READ)
|
|
790
|
+
.then((v) => signIns.named(p.url(), typeof v === "string" ? v : null))
|
|
791
|
+
.catch(() => undefined);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
if (raw.kind === "submit" ||
|
|
795
|
+
raw.kind === "click" ||
|
|
796
|
+
(raw.kind === "press" && raw.key === "Enter"))
|
|
797
|
+
if (signIns.acted())
|
|
798
|
+
void checkSignIn(p);
|
|
799
|
+
};
|
|
505
800
|
// While paused, the page reports what a person does (the recorder's
|
|
506
801
|
// observer), so hand-done steps sit in the same journal as the
|
|
507
802
|
// commands. Un-paused, commands journal themselves and the DOM is quiet.
|
|
508
803
|
await page
|
|
509
804
|
.context()
|
|
510
|
-
.exposeBinding(BINDING, (
|
|
805
|
+
.exposeBinding(BINDING, (src, raw) => {
|
|
806
|
+
if (raw.kind === "pageerror")
|
|
807
|
+
return pageErrors.push(raw, src.page.url());
|
|
511
808
|
if (!byHand())
|
|
512
809
|
return;
|
|
513
|
-
|
|
514
|
-
|
|
810
|
+
// the agent's own late events (a fill's change) are not the person's
|
|
811
|
+
if (steer.paused()) {
|
|
812
|
+
if (now() >= quietAt)
|
|
813
|
+
steer.handAct();
|
|
814
|
+
}
|
|
515
815
|
else
|
|
516
816
|
helpedActs++;
|
|
817
|
+
runHandActs++;
|
|
818
|
+
// before the redaction: the held value goes nowhere but the store
|
|
819
|
+
heldFrom(raw, src.page);
|
|
517
820
|
journal(redactRaw(raw));
|
|
518
821
|
})
|
|
519
822
|
.catch(() => undefined);
|
|
@@ -521,19 +824,51 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
521
824
|
.context()
|
|
522
825
|
.addInitScript(OBSERVER_SCRIPT)
|
|
523
826
|
.catch(() => undefined);
|
|
827
|
+
// The document already open predates the init script: hook it once, here.
|
|
828
|
+
await inPage(page, OBSERVER_SCRIPT).catch(() => undefined);
|
|
524
829
|
// A load between commands is a person's only when they also acted (a slow redirect is not).
|
|
525
830
|
page.on("framenavigated", (frame) => {
|
|
526
831
|
if (frame !== page.mainFrame())
|
|
527
832
|
return;
|
|
528
|
-
if (paused || ((helpedActs || opts.driver === "person") && byHand()))
|
|
833
|
+
if (steer.paused() || ((helpedActs || opts.driver === "person") && byHand()))
|
|
529
834
|
journal({ kind: "navigate" });
|
|
835
|
+
if (opts.credentials && signIns.acted())
|
|
836
|
+
void checkSignIn(page);
|
|
530
837
|
lookWhenQuiet();
|
|
531
838
|
});
|
|
532
839
|
const find = (t) => locate(page, t.hints);
|
|
840
|
+
/** Every match of vague hints, redacted and marked as page data: the agent picks one. */
|
|
841
|
+
const matchesAnswer = (err) => ({
|
|
842
|
+
matches: err.matches.map((m) => ({
|
|
843
|
+
...m,
|
|
844
|
+
aria: redactText(m.aria),
|
|
845
|
+
row: m.row && redactText(m.row),
|
|
846
|
+
html: redactText(m.html),
|
|
847
|
+
})),
|
|
848
|
+
...(err.visible > err.matches.length ? { more: err.visible - err.matches.length } : {}),
|
|
849
|
+
page: originOf(page.url()),
|
|
850
|
+
hint: 'pick one: "hints":{"ref":"<ref>"}, or the same hints with its "nth"',
|
|
851
|
+
});
|
|
533
852
|
const marks = marksFor();
|
|
853
|
+
// page text in answers sits inside markers with this nonce: the page never sees it
|
|
854
|
+
const fence = pageFence(randomBytes(6).toString("hex"));
|
|
855
|
+
const looks = sinceStore(pageChange);
|
|
856
|
+
let lastShot = null;
|
|
534
857
|
/** The marks picture, names masked as `aria` masks them. */
|
|
535
858
|
const takeMarks = async () => {
|
|
536
|
-
const taken = await marks.take(page, shoot)
|
|
859
|
+
const { boxes, ...taken } = await marks.take(page, shoot, async () => {
|
|
860
|
+
const pic = await picture();
|
|
861
|
+
if (pic)
|
|
862
|
+
stepPics.push(pic);
|
|
863
|
+
});
|
|
864
|
+
await overlay.marked(page, taken.marks.map((m, i) => ({ n: m.n, box: boxes[i] })));
|
|
865
|
+
if (capture)
|
|
866
|
+
stepBoxes = boxes.map((b) => [
|
|
867
|
+
Math.round(b.x),
|
|
868
|
+
Math.round(b.y),
|
|
869
|
+
Math.round(b.w),
|
|
870
|
+
Math.round(b.h),
|
|
871
|
+
]);
|
|
537
872
|
return {
|
|
538
873
|
...taken,
|
|
539
874
|
marks: taken.marks.map((m) => ({ ...m, name: m.name && redactText(m.name) })),
|
|
@@ -545,7 +880,30 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
545
880
|
* same command is sent again after the reply (`reason: "asked"`); in
|
|
546
881
|
* process the caller waits.
|
|
547
882
|
*/
|
|
548
|
-
|
|
883
|
+
/** Questions on the panel now, oldest first: the hub row says Needs you with the first. */
|
|
884
|
+
const paneWhys = [];
|
|
885
|
+
/** The panel as one more answer channel, raced with the phone (`askOverChannel`). */
|
|
886
|
+
const pane = async (text, signal) => {
|
|
887
|
+
if (!overlay.enabled)
|
|
888
|
+
return null;
|
|
889
|
+
const why = `Approve: ${text.split("\n")[0]}`;
|
|
890
|
+
paneWhys.push(why);
|
|
891
|
+
live?.person(paneWhys[0] ?? null);
|
|
892
|
+
try {
|
|
893
|
+
return await overlay.ask(page, text, {
|
|
894
|
+
yes: "Approve",
|
|
895
|
+
no: "Reject",
|
|
896
|
+
whole: true,
|
|
897
|
+
ms: PANE_ASK_MS,
|
|
898
|
+
signal,
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
finally {
|
|
902
|
+
paneWhys.splice(paneWhys.indexOf(why), 1);
|
|
903
|
+
live?.person(paneWhys[0] ?? null);
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
const approvals = opts.approve ? new PendingApprovals(opts.approve, { pane }) : null;
|
|
549
907
|
/**
|
|
550
908
|
* One yes per payment flow (William, 2026-09-25: "only ask one yes or no
|
|
551
909
|
* for whether you want to start the payment flow and pay, not repeated
|
|
@@ -568,8 +926,11 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
568
926
|
}, wait);
|
|
569
927
|
flowYes.grant(flow, FLOW_MS);
|
|
570
928
|
};
|
|
571
|
-
/** Instant for a console; a person's hands when an agent drives (`pace`). */
|
|
572
|
-
const
|
|
929
|
+
/** Instant for a console; a person's hands when an agent drives (`pace`), on the session's seed. */
|
|
930
|
+
const seed = seedOf() ?? freshSeed();
|
|
931
|
+
if (opts.pace)
|
|
932
|
+
overlay.tag(`seed ${seed}`);
|
|
933
|
+
const hands = handsFor(opts.pace ?? null, seeded(seed), handsLog, holdsSecret);
|
|
573
934
|
const gate = async (act, t, wait) => {
|
|
574
935
|
// A click is judged by what the button says too: `#checkout` or `.btn` alone names nothing.
|
|
575
936
|
const said = act === "click"
|
|
@@ -578,7 +939,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
578
939
|
.evaluate((e) => e.innerText ||
|
|
579
940
|
e.value ||
|
|
580
941
|
e.getAttribute("aria-label") ||
|
|
581
|
-
"", undefined, { timeout:
|
|
942
|
+
"", undefined, { timeout: actMs })
|
|
582
943
|
.catch(() => "")
|
|
583
944
|
: "";
|
|
584
945
|
const hints = {
|
|
@@ -589,7 +950,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
589
950
|
if (!what)
|
|
590
951
|
return null;
|
|
591
952
|
// A miss is a miss, not a question: the element must be there before anyone is asked.
|
|
592
|
-
await find(t).first().waitFor({ state: "visible", timeout:
|
|
953
|
+
await find(t).first().waitFor({ state: "visible", timeout: actMs });
|
|
593
954
|
// The button's own amount, else the order total next to it, else a question with no amount.
|
|
594
955
|
const amount = act === "click"
|
|
595
956
|
? (paymentAmount(t.hints) ?? (await amountNear(find(t).first())))
|
|
@@ -708,7 +1069,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
708
1069
|
const value = kind ? want[kind] : undefined;
|
|
709
1070
|
if (!kind || !value || holdsBilling(kind, f.value, value))
|
|
710
1071
|
continue;
|
|
711
|
-
await hands.paste(frame.locator(`[data-ab-billing="${f.i}"]`), value, { timeout:
|
|
1072
|
+
await hands.paste(frame.locator(`[data-ab-billing="${f.i}"]`), value, { timeout: actMs });
|
|
712
1073
|
set.push(kind);
|
|
713
1074
|
}
|
|
714
1075
|
}
|
|
@@ -749,7 +1110,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
749
1110
|
}
|
|
750
1111
|
await audit(true);
|
|
751
1112
|
await hands.think(page);
|
|
752
|
-
await hands.paste(find(c), value, { timeout:
|
|
1113
|
+
await hands.paste(find(c), value, { timeout: actMs });
|
|
753
1114
|
journalAct(c, (target) => ({
|
|
754
1115
|
kind: "input",
|
|
755
1116
|
target,
|
|
@@ -769,7 +1130,16 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
769
1130
|
contacts: { ...card.tell, ...(card.taxId ? { taxId: card.taxId } : {}) },
|
|
770
1131
|
};
|
|
771
1132
|
const billing = await fillBilling();
|
|
772
|
-
|
|
1133
|
+
// A card form often holds a captcha (Instacart's Add Payment): its submit fails until ticked.
|
|
1134
|
+
const captcha = await captchaInView(page).catch(() => null);
|
|
1135
|
+
return {
|
|
1136
|
+
ok: true,
|
|
1137
|
+
secret: c.secret,
|
|
1138
|
+
...(billing.length ? { billing } : {}),
|
|
1139
|
+
...(captcha
|
|
1140
|
+
? { captcha: `a captcha is on this form: {"cmd":"captcha"} before you submit (${captcha})` }
|
|
1141
|
+
: {}),
|
|
1142
|
+
};
|
|
773
1143
|
};
|
|
774
1144
|
/**
|
|
775
1145
|
* The bank's confirmation code (3-D Secure, often in an iframe on the bank's
|
|
@@ -809,7 +1179,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
809
1179
|
throw new Error(`place: ${c.secret} is not available now (the bank's text has not arrived on the phone yet, wait and retry)`);
|
|
810
1180
|
await audit(true);
|
|
811
1181
|
await hands.think(page);
|
|
812
|
-
await hands.paste(find(c), secret(code), { timeout:
|
|
1182
|
+
await hands.paste(find(c), secret(code), { timeout: actMs });
|
|
813
1183
|
journalAct(c, (target) => ({
|
|
814
1184
|
kind: "input",
|
|
815
1185
|
target,
|
|
@@ -835,7 +1205,9 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
835
1205
|
if (receiptOutcome(whole) === "unclear" || stillAsking(whole))
|
|
836
1206
|
return [];
|
|
837
1207
|
const text = redactText(whole).slice(0, 6_000);
|
|
838
|
-
const png = await page
|
|
1208
|
+
const png = await page
|
|
1209
|
+
.screenshot({ fullPage: true, timeout: 15_000, mask: cardMask(page) })
|
|
1210
|
+
.catch(() => undefined);
|
|
839
1211
|
const host = new URL(page.url()).host;
|
|
840
1212
|
const kept = placedCard
|
|
841
1213
|
? null
|
|
@@ -857,20 +1229,40 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
857
1229
|
}, { text, ...(png ? { png } : {}) }, placedCard?.tell)
|
|
858
1230
|
.catch(() => []);
|
|
859
1231
|
};
|
|
860
|
-
/**
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
1232
|
+
/** The `wait` of the `os` command running now: a gate holds or answers pending by it. */
|
|
1233
|
+
let osWait = false;
|
|
1234
|
+
/** Desktop acts; a click that spends (an App Store "Buy") waits for the person; "url" is the app. */
|
|
1235
|
+
const osHands = desktopHands(desktop, {
|
|
1236
|
+
secret: sessionSecret,
|
|
1237
|
+
looksSecret: looksLikeSecretValue,
|
|
1238
|
+
shotsDir,
|
|
1239
|
+
async gateClick(app, control) {
|
|
1240
|
+
const what = paymentGate("click", { name: control.name, role: control.role });
|
|
1241
|
+
if (what)
|
|
1242
|
+
await decide(`os click ${JSON.stringify(control)}`, `${what} in ${app}`, `app:${app}`, osWait);
|
|
1243
|
+
},
|
|
1244
|
+
});
|
|
1245
|
+
const journalAct = (t, act) => {
|
|
1246
|
+
const j = act(toLocatorHints(t.hints));
|
|
1247
|
+
if (j.kind !== "click") {
|
|
1248
|
+
if (j.kind !== "input")
|
|
1249
|
+
lastClick = null;
|
|
1250
|
+
return journal(j);
|
|
1251
|
+
}
|
|
1252
|
+
// A stepper's second press: the first one changed the page, so it is no retry.
|
|
1253
|
+
const again = lastClick !== null &&
|
|
1254
|
+
JSON.stringify(lastClick.hints) === JSON.stringify(t.hints) &&
|
|
1255
|
+
lastChanged;
|
|
1256
|
+
lastClick = t;
|
|
1257
|
+
journal(again ? { ...j, again } : j);
|
|
872
1258
|
};
|
|
873
|
-
|
|
1259
|
+
/** The control last clicked: a `type` after it is journaled as its input. */
|
|
1260
|
+
let lastClick = null;
|
|
1261
|
+
/** The start page (the session's first `open`) with nothing done since: an `open` to it again is a no-op. */
|
|
1262
|
+
let asLoaded = false;
|
|
1263
|
+
let openedOnce = false;
|
|
1264
|
+
/** Whether the last looked-at command changed the page's controls. */
|
|
1265
|
+
let lastChanged = false;
|
|
874
1266
|
/** What leaves the socket: masked like a transcript, unless the caller asks for raw. */
|
|
875
1267
|
const out = (text, raw) => (raw ? text : redactText(text));
|
|
876
1268
|
/**
|
|
@@ -885,8 +1277,14 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
885
1277
|
"journal",
|
|
886
1278
|
"url",
|
|
887
1279
|
"pages",
|
|
1280
|
+
"errors",
|
|
888
1281
|
"close",
|
|
889
1282
|
"goal",
|
|
1283
|
+
// Drawing is no page work: it never waits behind an act or opens a run.
|
|
1284
|
+
"overlay",
|
|
1285
|
+
"window",
|
|
1286
|
+
// waits on the person, not the page: a queued act never blocks it
|
|
1287
|
+
"waitNote",
|
|
890
1288
|
]);
|
|
891
1289
|
let chain = Promise.resolve();
|
|
892
1290
|
let lastTouch = now();
|
|
@@ -903,12 +1301,13 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
903
1301
|
};
|
|
904
1302
|
const run = (c, wait = false) => {
|
|
905
1303
|
touch();
|
|
1304
|
+
const arrived = now();
|
|
906
1305
|
// After a `done`, the next command that works the page (or names a goal) starts the next run.
|
|
907
1306
|
if (c.cmd === "goal" || !IMMEDIATE.has(c.cmd))
|
|
908
1307
|
openRun();
|
|
909
1308
|
if (IMMEDIATE.has(c.cmd))
|
|
910
1309
|
return runOne(c, wait);
|
|
911
|
-
const next = chain.then(() => runOne(c, wait));
|
|
1310
|
+
const next = chain.then(() => runOne(c, wait, arrived));
|
|
912
1311
|
chain = next.catch(() => undefined);
|
|
913
1312
|
return next;
|
|
914
1313
|
};
|
|
@@ -917,36 +1316,198 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
917
1316
|
.split("\n")
|
|
918
1317
|
.filter(Boolean)
|
|
919
1318
|
.map((r) => redactRow(r));
|
|
920
|
-
const runOne = async (c, wait) => {
|
|
1319
|
+
const runOne = async (c, wait, arrived = now()) => {
|
|
921
1320
|
page = fp.page;
|
|
922
1321
|
if (IMMEDIATE.has(c.cmd))
|
|
923
1322
|
return act(c, wait);
|
|
1323
|
+
// the person's Pause holds it before it starts: the panel never says Running while held
|
|
1324
|
+
const held = await steer.heldAnswer(arrived);
|
|
1325
|
+
if (held)
|
|
1326
|
+
return held;
|
|
924
1327
|
busy++;
|
|
1328
|
+
holdCollect();
|
|
1329
|
+
const began = now();
|
|
1330
|
+
let failed = null;
|
|
1331
|
+
let answer;
|
|
1332
|
+
const from = page.url();
|
|
1333
|
+
await overlay.begin(page, c.cmd);
|
|
925
1334
|
try {
|
|
926
1335
|
const helped = await helpedSince();
|
|
927
1336
|
if (history && LOOKED_AT.has(c.cmd))
|
|
928
1337
|
lookBefore = await lookAt(page).catch(() => null);
|
|
1338
|
+
// A new screen before an act: the picture of the state the act was chosen on.
|
|
1339
|
+
const screen = lookBefore
|
|
1340
|
+
? `${urlShape(lookBefore.url)}\t${lookBefore.landmarks.join("|")}`
|
|
1341
|
+
: "";
|
|
1342
|
+
if (capture && screen && screen !== lastScreen) {
|
|
1343
|
+
lastScreen = screen;
|
|
1344
|
+
const pic = await picture();
|
|
1345
|
+
if (pic)
|
|
1346
|
+
stepPics.push(pic);
|
|
1347
|
+
}
|
|
929
1348
|
const out = await looked(c, wait);
|
|
930
1349
|
left = { url: page.url(), rows: out.rows ?? left?.rows ?? null };
|
|
931
|
-
|
|
932
|
-
|
|
1350
|
+
answer = out.answer;
|
|
1351
|
+
const plain = out.answer && typeof out.answer === "object" && !Array.isArray(out.answer);
|
|
1352
|
+
// only an object answer can carry it: the next one gets it otherwise
|
|
1353
|
+
const tools = plain ? await newSiteTools().catch(() => null) : null;
|
|
1354
|
+
const notes = plain ? overlay.takeNotes() : [];
|
|
1355
|
+
return plain && (helped || tools || notes.length)
|
|
1356
|
+
? {
|
|
1357
|
+
...(helped ? { helped } : {}),
|
|
1358
|
+
...(notes.length ? { notes } : {}),
|
|
1359
|
+
...out.answer,
|
|
1360
|
+
...(tools ? { tools } : {}),
|
|
1361
|
+
}
|
|
933
1362
|
: out.answer;
|
|
934
1363
|
}
|
|
1364
|
+
catch (err) {
|
|
1365
|
+
failed = err;
|
|
1366
|
+
throw err;
|
|
1367
|
+
}
|
|
935
1368
|
finally {
|
|
1369
|
+
await overlay.end(fp.page, traceRow(c, failed, now() - began, { from, to: fp.page.url(), answer }));
|
|
936
1370
|
busy--;
|
|
1371
|
+
if (busy === 0)
|
|
1372
|
+
collectWhenIdle();
|
|
1373
|
+
// Pause pressed mid-command takes hold now, before the next one starts.
|
|
1374
|
+
await steer.afterCommand();
|
|
1375
|
+
// Idle counts from a command's end: a long one is someone driving.
|
|
1376
|
+
touch();
|
|
937
1377
|
quietAt = now() + HAND_GRACE_MS;
|
|
938
1378
|
lookBefore = null;
|
|
939
1379
|
lookWhenQuiet();
|
|
940
1380
|
}
|
|
941
1381
|
};
|
|
1382
|
+
// The toolkit: the page's site's workflows, sent once per site (a host with no site clears it).
|
|
1383
|
+
const toolsNow = async () => toolsOf(opts.workflows ? ((await opts.workflows.list?.()) ?? []) : []);
|
|
1384
|
+
let toolsSent = "";
|
|
1385
|
+
let toolsHost = "";
|
|
1386
|
+
const newSiteTools = async () => {
|
|
1387
|
+
if (!opts.workflows)
|
|
1388
|
+
return null;
|
|
1389
|
+
const host = URL.canParse(page.url()) ? new URL(page.url()).host : "";
|
|
1390
|
+
if (host === toolsHost)
|
|
1391
|
+
return null;
|
|
1392
|
+
const all = await toolsNow().catch(() => null);
|
|
1393
|
+
// a catalog that failed to load: the next answer tries again
|
|
1394
|
+
if (!all)
|
|
1395
|
+
return null;
|
|
1396
|
+
toolsHost = host;
|
|
1397
|
+
const kit = toolkitFor(host, SITE_LOGINS, all);
|
|
1398
|
+
const key = kit?.sites.join(",") ?? "";
|
|
1399
|
+
if (key === toolsSent)
|
|
1400
|
+
return null;
|
|
1401
|
+
toolsSent = key;
|
|
1402
|
+
if (!kit)
|
|
1403
|
+
return kit;
|
|
1404
|
+
const byName = new Map(all.map((t) => [t.name, t]));
|
|
1405
|
+
const tools = await Promise.all(kit.tools.map((t) => {
|
|
1406
|
+
const full = byName.get(t.name);
|
|
1407
|
+
return full ? shown(full) : t;
|
|
1408
|
+
}));
|
|
1409
|
+
return { ...kit, tools };
|
|
1410
|
+
};
|
|
1411
|
+
/**
|
|
1412
|
+
* A tool as this session would run it, defaults shown as code shows them: the schema's, the
|
|
1413
|
+
* saved plan's, the profile's own account. A login lists every account it can sign in as.
|
|
1414
|
+
*/
|
|
1415
|
+
const shown = async (t) => {
|
|
1416
|
+
const saved = await (opts.workflows?.plan(t.name, {}) ?? Promise.resolve({})).catch(() => ({}));
|
|
1417
|
+
const login = t.name.endsWith("-login") && loginWorkflows().has(t.name);
|
|
1418
|
+
const takes = t.fields.some((f) => f.name === "account");
|
|
1419
|
+
const platform = login
|
|
1420
|
+
? loginPlatform(t.name, {})
|
|
1421
|
+
: takes && t.site
|
|
1422
|
+
? platformOf(t.site)
|
|
1423
|
+
: null;
|
|
1424
|
+
const accounts = platform ? await accountsOf(platform) : [];
|
|
1425
|
+
const own = accounts.find((a) => a.profile)?.account;
|
|
1426
|
+
const given = { ...saved, ...(own && !accountIn(saved) ? { account: own } : {}) };
|
|
1427
|
+
return {
|
|
1428
|
+
name: t.name,
|
|
1429
|
+
aim: t.aim,
|
|
1430
|
+
inputs: redactText(signature(t.fields, given)),
|
|
1431
|
+
...(login && accounts.length ? { accounts } : {}),
|
|
1432
|
+
};
|
|
1433
|
+
};
|
|
1434
|
+
// Each login's stored accounts, read once a session: what a wall and a login tool list.
|
|
1435
|
+
const accountCache = new Map();
|
|
1436
|
+
const accountsOf = (site) => {
|
|
1437
|
+
const platform = credentialFor(SITE_LOGINS, site).split("@")[0] ?? site;
|
|
1438
|
+
const got = accountCache.get(platform) ??
|
|
1439
|
+
(opts.accounts?.(platform) ?? Promise.resolve([])).then((rows) => loginAccounts(opts.site, platform, SITE_LOGINS, rows), () => []);
|
|
1440
|
+
accountCache.set(platform, got);
|
|
1441
|
+
return got;
|
|
1442
|
+
};
|
|
1443
|
+
/**
|
|
1444
|
+
* plan.account when none is given or saved: the profile's own account on the workflow's
|
|
1445
|
+
* platform. A login with none must name one; another workflow runs bare (guarded at walls).
|
|
1446
|
+
*/
|
|
1447
|
+
const accountDefault = async (name, site, given) => {
|
|
1448
|
+
if (accountIn(given))
|
|
1449
|
+
return {};
|
|
1450
|
+
const login = name.endsWith("-login") && loginWorkflows().has(name);
|
|
1451
|
+
const platform = login ? loginPlatform(name, given) : site ? platformOf(site) : null;
|
|
1452
|
+
if (!platform)
|
|
1453
|
+
return {};
|
|
1454
|
+
const accounts = await accountsOf(platform);
|
|
1455
|
+
const own = accounts.find((a) => a.profile);
|
|
1456
|
+
if (own)
|
|
1457
|
+
return { account: own.account };
|
|
1458
|
+
if (login && accounts.length)
|
|
1459
|
+
throw new Error(`flow ${name}: name an account in plan.account, one of: ${accounts.map((a) => `${a.account} (${a.roles.join(", ") || a.user})`).join("; ")}`);
|
|
1460
|
+
return {};
|
|
1461
|
+
};
|
|
1462
|
+
/** The platform a login tool signs in to; `page-login`'s is its plan's site, else the session's. */
|
|
1463
|
+
const loginPlatform = (name, given) => name === PAGE_LOGIN
|
|
1464
|
+
? platformOf(typeof given.site === "string" ? given.site : opts.site)
|
|
1465
|
+
: name.slice(0, -"-login".length);
|
|
1466
|
+
const withAccounts = async (wall) => {
|
|
1467
|
+
if (!wall || wall.kind === "captcha")
|
|
1468
|
+
return wall;
|
|
1469
|
+
// no `<site>-login`: the page's own boxes, when the session's site has a stored account
|
|
1470
|
+
const signIn = wall.signIn ?? PAGE_LOGIN;
|
|
1471
|
+
const accounts = await accountsOf(loginPlatform(signIn, {}));
|
|
1472
|
+
if (!accounts.length)
|
|
1473
|
+
return wall;
|
|
1474
|
+
return { ...wall, signIn, accounts };
|
|
1475
|
+
};
|
|
942
1476
|
const looked = async (c, wait) => {
|
|
943
1477
|
if (!LOOKS.has(c.cmd))
|
|
944
1478
|
return { answer: await act(c, wait), rows: null };
|
|
945
1479
|
const before = await rows();
|
|
946
|
-
const
|
|
1480
|
+
const seen = dialogs.count();
|
|
1481
|
+
const files = downloads.count();
|
|
1482
|
+
const errs = pageErrors.count();
|
|
1483
|
+
const hadTabs = new Set(stepTabs);
|
|
1484
|
+
const out = await act(c, wait).finally(() => overlay.after(fp.page));
|
|
947
1485
|
page = fp.page;
|
|
948
1486
|
const after = await rows();
|
|
949
|
-
|
|
1487
|
+
const changed = pageChange(before, after);
|
|
1488
|
+
lastChanged = changed.added.length + changed.gone + (changed.more ?? 0) > 0;
|
|
1489
|
+
const opened = dialogs.since(seen);
|
|
1490
|
+
if (downloads.count() > files)
|
|
1491
|
+
await Promise.race([downloads.settled(), new Promise((r) => setTimeout(r, 30_000))]);
|
|
1492
|
+
const got = downloads.since(files);
|
|
1493
|
+
// the page threw during the act: the reason a click seems to do nothing
|
|
1494
|
+
const thrown = pageErrors.since(errs);
|
|
1495
|
+
// a tab the act opened: `page` with its index goes there; the next `open` closes it
|
|
1496
|
+
const all = page.context().pages();
|
|
1497
|
+
const tabs = [...stepTabs]
|
|
1498
|
+
.filter((p) => !hadTabs.has(p) && !p.isClosed())
|
|
1499
|
+
.map((p) => ({ index: all.indexOf(p), url: p.url() }));
|
|
1500
|
+
return {
|
|
1501
|
+
answer: {
|
|
1502
|
+
...out,
|
|
1503
|
+
changed,
|
|
1504
|
+
...(tabs.length ? { tabs } : {}),
|
|
1505
|
+
...(opened.length ? { dialogs: opened } : {}),
|
|
1506
|
+
...(thrown.length ? { pageErrors: thrown.slice(-5).map((e) => e.message) } : {}),
|
|
1507
|
+
...(got.length ? { downloads: got } : {}),
|
|
1508
|
+
},
|
|
1509
|
+
rows: after,
|
|
1510
|
+
};
|
|
950
1511
|
};
|
|
951
1512
|
/**
|
|
952
1513
|
* What a person did since the agent's last command, once: the count, where
|
|
@@ -954,7 +1515,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
954
1515
|
* "someone got me past it": it re-reads the page instead of redoing the step.
|
|
955
1516
|
*/
|
|
956
1517
|
const helpedSince = async () => {
|
|
957
|
-
if (!helpedActs || paused)
|
|
1518
|
+
if (!helpedActs || steer.paused())
|
|
958
1519
|
return null;
|
|
959
1520
|
const acts = helpedActs;
|
|
960
1521
|
helpedActs = 0;
|
|
@@ -970,57 +1531,564 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
970
1531
|
left = { url: page.url(), rows: now_ };
|
|
971
1532
|
return out;
|
|
972
1533
|
};
|
|
1534
|
+
overlay.onSteer((st) => steer.onSteer(st));
|
|
1535
|
+
/** A script that clicks, on a page that shows a spending button, needs the click's yes first. */
|
|
1536
|
+
const scriptGate = async (js, wait) => {
|
|
1537
|
+
if (!scriptActs(js))
|
|
1538
|
+
return;
|
|
1539
|
+
const labels = await page.evaluate(BUTTON_LABELS).catch(() => []);
|
|
1540
|
+
const spend = labels
|
|
1541
|
+
.map((text) => paymentGate("click", { text: text.trim().slice(0, 200) }))
|
|
1542
|
+
.find((w) => w !== null);
|
|
1543
|
+
if (spend)
|
|
1544
|
+
await decide(`eval ${js.slice(0, 80)}`, `run a script on a page where it can ${spend.replace(/^press /, "press ")}`, page.url(), wait);
|
|
1545
|
+
};
|
|
1546
|
+
/**
|
|
1547
|
+
* `flow`: a compiled workflow on this page (designs/2026-10-29-explore-flow.md). Its browser
|
|
1548
|
+
* legs run on the session's own FlowPage; each money act passes this session's gate first.
|
|
1549
|
+
*/
|
|
1550
|
+
const flowRuns = new Map();
|
|
1551
|
+
/** A secret flow runs: no pictures, rows or flat journal. */
|
|
1552
|
+
let secretFlow = false;
|
|
1553
|
+
// legs of another site a workflow ran on this profile: said in its answer
|
|
1554
|
+
const crossSite = new Set();
|
|
1555
|
+
/** The payment refusal a flow's act met: the command answers with it, not with a failed step. */
|
|
1556
|
+
let flowGated = null;
|
|
1557
|
+
const unpaused = steer.unpaused;
|
|
1558
|
+
/** A flow's acts journaled flat, as the same commands would be: a mixed session saves as one recording. */
|
|
1559
|
+
const journalOp = (op, hints) => {
|
|
1560
|
+
const t = { hints };
|
|
1561
|
+
if (op.kind === "click")
|
|
1562
|
+
journalAct(t, (target) => ({ kind: "click", target }));
|
|
1563
|
+
else if (op.kind === "fill") {
|
|
1564
|
+
const secret = looksLikeSecretField(toLocatorHints(t.hints)) ||
|
|
1565
|
+
looksLikeSecretValue(op.value) ||
|
|
1566
|
+
holdsSecret(op.value);
|
|
1567
|
+
journalAct(t, (target) => ({
|
|
1568
|
+
kind: "input",
|
|
1569
|
+
target,
|
|
1570
|
+
value: secret ? REDACTED : op.value,
|
|
1571
|
+
redacted: secret,
|
|
1572
|
+
}));
|
|
1573
|
+
}
|
|
1574
|
+
else if (op.kind === "select")
|
|
1575
|
+
journalAct(t, (target) => ({ kind: "select", target, value: op.value }));
|
|
1576
|
+
else if (op.kind === "press")
|
|
1577
|
+
journalAct(t, (target) => ({ kind: "press", target, key: op.key }));
|
|
1578
|
+
else if (op.kind === "hover")
|
|
1579
|
+
journalAct(t, (target) => ({ kind: "hover", target }));
|
|
1580
|
+
else if (op.kind === "script" && scriptActs(op.js))
|
|
1581
|
+
journal({
|
|
1582
|
+
kind: "eval",
|
|
1583
|
+
target: pageWide(hints) ? null : toLocatorHints(t.hints),
|
|
1584
|
+
js: op.js,
|
|
1585
|
+
});
|
|
1586
|
+
// upload: the flow's own paths or bytes; a recording names stored files, so none
|
|
1587
|
+
};
|
|
1588
|
+
const flowPage = (flow, wait, o = {}) => {
|
|
1589
|
+
const quiet = flow.secret === true;
|
|
1590
|
+
// `code` journals itself as one row: its inner ops are not replayed on their own.
|
|
1591
|
+
const journals = !quiet && o.journal !== false;
|
|
1592
|
+
/** One row per step, as a flow draws its own; a pause holds the next step. */
|
|
1593
|
+
const step = async (s, run, answer) => {
|
|
1594
|
+
await unpaused();
|
|
1595
|
+
page = fp.page;
|
|
1596
|
+
if (quiet)
|
|
1597
|
+
return run();
|
|
1598
|
+
const from = page.url();
|
|
1599
|
+
const began = now();
|
|
1600
|
+
await overlay.begin(page, s.cmd);
|
|
1601
|
+
if (s.hints)
|
|
1602
|
+
await overlay.flash(page, s.hints, `${s.cmd}: ${s.goal}`);
|
|
1603
|
+
let failed = null;
|
|
1604
|
+
let got;
|
|
1605
|
+
try {
|
|
1606
|
+
got = await run();
|
|
1607
|
+
return got;
|
|
1608
|
+
}
|
|
1609
|
+
catch (err) {
|
|
1610
|
+
failed = err;
|
|
1611
|
+
throw err;
|
|
1612
|
+
}
|
|
1613
|
+
finally {
|
|
1614
|
+
page = fp.page;
|
|
1615
|
+
await overlay.after(page);
|
|
1616
|
+
// An open's goal holds the whole URL: the row shows its host and path only.
|
|
1617
|
+
const c = { cmd: s.cmd, hints: s.hints, url: s.url, ...(s.url ? {} : { goal: s.goal }) };
|
|
1618
|
+
await overlay.end(page, traceRow(c, failed, now() - began, {
|
|
1619
|
+
from,
|
|
1620
|
+
to: page.url(),
|
|
1621
|
+
...(answer && got !== undefined ? { answer: answer(got) } : {}),
|
|
1622
|
+
}));
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
const money = (op) => op.kind === "click" || (op.kind === "press" && activates(op.key))
|
|
1626
|
+
? "click"
|
|
1627
|
+
: op.kind === "fill" || op.kind === "select"
|
|
1628
|
+
? op.kind
|
|
1629
|
+
: null;
|
|
1630
|
+
return {
|
|
1631
|
+
...fp,
|
|
1632
|
+
// Live, not copied: after `switchTo` (a popup) it is the page acted on now.
|
|
1633
|
+
get page() {
|
|
1634
|
+
return fp.page;
|
|
1635
|
+
},
|
|
1636
|
+
open: (url, o) => step({ cmd: "open", goal: `open ${url}`, url }, async () => {
|
|
1637
|
+
await fp.open(url, o);
|
|
1638
|
+
if (journals)
|
|
1639
|
+
journal({ kind: "navigate" });
|
|
1640
|
+
}),
|
|
1641
|
+
read: (hints) => step({ cmd: "read", goal: "read", hints }, () => fp.read(hints), (text) => ({ as: "text", text })),
|
|
1642
|
+
act: (op, hints, o) => step({ cmd: op.kind, goal: o.goal, hints }, async () => {
|
|
1643
|
+
const kind = money(op);
|
|
1644
|
+
let spent = null;
|
|
1645
|
+
try {
|
|
1646
|
+
if (kind)
|
|
1647
|
+
spent = await gate(kind, { hints }, wait);
|
|
1648
|
+
if (op.kind === "script")
|
|
1649
|
+
await scriptGate(op.js, wait);
|
|
1650
|
+
}
|
|
1651
|
+
catch (err) {
|
|
1652
|
+
if (err instanceof PaymentGate)
|
|
1653
|
+
flowGated = err;
|
|
1654
|
+
throw err;
|
|
1655
|
+
}
|
|
1656
|
+
await fp.act(op, hints, o);
|
|
1657
|
+
page = fp.page;
|
|
1658
|
+
if (journals)
|
|
1659
|
+
journalOp(op, hints);
|
|
1660
|
+
if (spent?.charges)
|
|
1661
|
+
await reportSpend(spent);
|
|
1662
|
+
}),
|
|
1663
|
+
};
|
|
1664
|
+
};
|
|
1665
|
+
/**
|
|
1666
|
+
* Explore as the workflow's browser: its legs run here, any site's (a guide, not a lock). A wall
|
|
1667
|
+
* signs in as the leg's site: labelled by plan.account or the profile's own account. A bare leg
|
|
1668
|
+
* of another platform has neither: it stops at the wall, which names the login and its accounts.
|
|
1669
|
+
*/
|
|
1670
|
+
const onPage = (wait) => ({
|
|
1671
|
+
run: async (flow, input) => {
|
|
1672
|
+
const platform = platformOf(flow.site);
|
|
1673
|
+
const other = !flow.site.includes("@") && platform !== platformOf(opts.site);
|
|
1674
|
+
if (other)
|
|
1675
|
+
crossSite.add(`${flow.site}/${flow.name}`);
|
|
1676
|
+
leg.site = flow.site;
|
|
1677
|
+
leg.stop = other
|
|
1678
|
+
? `${flow.site}/${flow.name} met a sign-in wall; this profile has no ${platform} account: run flow ${loginName(platform)} or this one with plan.account`
|
|
1679
|
+
: null;
|
|
1680
|
+
secretFlow = flow.secret === true;
|
|
1681
|
+
const mark = fp.network?.last() ?? 0;
|
|
1682
|
+
try {
|
|
1683
|
+
return await flow.run(flowPage(flow, wait), input);
|
|
1684
|
+
}
|
|
1685
|
+
finally {
|
|
1686
|
+
leg.site = null;
|
|
1687
|
+
leg.stop = null;
|
|
1688
|
+
if (secretFlow) {
|
|
1689
|
+
await settle(fp.page).catch(() => undefined);
|
|
1690
|
+
fp.network?.forget(mark);
|
|
1691
|
+
}
|
|
1692
|
+
secretFlow = false;
|
|
1693
|
+
}
|
|
1694
|
+
},
|
|
1695
|
+
});
|
|
1696
|
+
const runWorkflow = async (c, wait) => {
|
|
1697
|
+
const from = opts.workflows;
|
|
1698
|
+
if (!from)
|
|
1699
|
+
throw new Error("flow: no workflows in this session (the CLI's explore has them)");
|
|
1700
|
+
const workflow = await from.get(c.name);
|
|
1701
|
+
if (!workflow)
|
|
1702
|
+
throw new Error(`flow: no compiled workflow ${c.name}; see: autobrowse workflows`);
|
|
1703
|
+
const given = await from.plan(c.name, c.plan ?? {});
|
|
1704
|
+
const raw = {
|
|
1705
|
+
...(await accountDefault(c.name, workflow.site, given)),
|
|
1706
|
+
...(c.name === PAGE_LOGIN ? { site: opts.site } : {}),
|
|
1707
|
+
...given,
|
|
1708
|
+
};
|
|
1709
|
+
const plan = workflow.plan.parse({ dryRun: false, ...raw });
|
|
1710
|
+
crossSite.clear();
|
|
1711
|
+
if (c.fresh)
|
|
1712
|
+
flowRuns.delete(c.name);
|
|
1713
|
+
const run = flowRuns.get(c.name) ?? { fx: memoryEffects().fx, gate: null };
|
|
1714
|
+
flowRuns.set(c.name, run);
|
|
1715
|
+
const deps = compiledDeps(onPage(wait), {
|
|
1716
|
+
account: accountIn(raw),
|
|
1717
|
+
...(opts.audit ? { audit: opts.audit } : {}),
|
|
1718
|
+
...(opts.sink ? { sink: opts.sink } : {}),
|
|
1719
|
+
...(from.keys ? { keys: from.keys } : {}),
|
|
1720
|
+
});
|
|
1721
|
+
const at = () => new Date().toISOString();
|
|
1722
|
+
// The gate it stopped on: the same command sent again answers it.
|
|
1723
|
+
if (run.gate?.name === "human")
|
|
1724
|
+
await applyAnswer(run.fx, run.gate, {
|
|
1725
|
+
approved: true,
|
|
1726
|
+
note: "explore: sent again",
|
|
1727
|
+
at: at(),
|
|
1728
|
+
});
|
|
1729
|
+
else if (run.gate?.name === "choose" && c.choice)
|
|
1730
|
+
await applyAnswer(run.fx, run.gate, { approved: true, note: c.choice, at: at() });
|
|
1731
|
+
run.gate = null;
|
|
1732
|
+
journal({ kind: "note", text: `flow ${c.name} start` });
|
|
1733
|
+
/** The hub row's step line: the step about to run, from the run state. */
|
|
1734
|
+
const stepOut = async () => {
|
|
1735
|
+
const results = (await run.fx.get(KEYS.results)) ?? {};
|
|
1736
|
+
const name = nextStep(workflow, results);
|
|
1737
|
+
const k = name ? workflow.steps.findIndex((s) => s.name === name) + 1 : 0;
|
|
1738
|
+
if (name && k)
|
|
1739
|
+
live?.flow({
|
|
1740
|
+
type: "workflow",
|
|
1741
|
+
name: c.name,
|
|
1742
|
+
step: k,
|
|
1743
|
+
of: workflow.steps.length,
|
|
1744
|
+
at: name,
|
|
1745
|
+
});
|
|
1746
|
+
};
|
|
1747
|
+
const answer = async (status) => {
|
|
1748
|
+
// waiting at a gate keeps the line; any other end takes it away
|
|
1749
|
+
if (status !== "waiting")
|
|
1750
|
+
live?.flow(null);
|
|
1751
|
+
const o = await outcomeOf(run.fx, workflow, status);
|
|
1752
|
+
// Done or refused: nothing to go on from. Failed or waiting: the next call goes on.
|
|
1753
|
+
if (status === "done" || status === "rejected")
|
|
1754
|
+
flowRuns.delete(c.name);
|
|
1755
|
+
journal({ kind: "note", text: `flow ${c.name} ${status}` });
|
|
1756
|
+
page = fp.page;
|
|
1757
|
+
const g = run.gate;
|
|
1758
|
+
const account = accountIn(raw);
|
|
1759
|
+
// a guarded leg stopped at a sign-in: the wall, its login and accounts, as `open` answers
|
|
1760
|
+
const wall = status === "failed"
|
|
1761
|
+
? await withAccounts(wallAnswer(await looksLikeWall(page), page.url()))
|
|
1762
|
+
: null;
|
|
1763
|
+
return JSON.parse(redactText(JSON.stringify({
|
|
1764
|
+
flow: c.name,
|
|
1765
|
+
status,
|
|
1766
|
+
steps: o.results,
|
|
1767
|
+
...(g ? { gate: { name: g.name, step: g.step, prompt: g.prompt } } : {}),
|
|
1768
|
+
...(account ? { account } : {}),
|
|
1769
|
+
...(crossSite.size ? { otherSite: [...crossSite] } : {}),
|
|
1770
|
+
...(wall ? { wall } : {}),
|
|
1771
|
+
url: page.url(),
|
|
1772
|
+
})));
|
|
1773
|
+
};
|
|
1774
|
+
try {
|
|
1775
|
+
for (;;) {
|
|
1776
|
+
flowGated = null;
|
|
1777
|
+
await stepOut();
|
|
1778
|
+
const a = await advance(run.fx, workflow, deps, plan);
|
|
1779
|
+
// Kept: the step that met the gate runs again on the next call.
|
|
1780
|
+
if (flowGated)
|
|
1781
|
+
throw flowGated;
|
|
1782
|
+
if (a.kind === "continue")
|
|
1783
|
+
continue;
|
|
1784
|
+
if (a.kind === "finished")
|
|
1785
|
+
return answer(a.status);
|
|
1786
|
+
const g = a.gate;
|
|
1787
|
+
if (g.name === "human" || g.name === "choose") {
|
|
1788
|
+
run.gate = g;
|
|
1789
|
+
return answer("waiting");
|
|
1790
|
+
}
|
|
1791
|
+
try {
|
|
1792
|
+
if (!approvals)
|
|
1793
|
+
throw new PaymentGate(g.prompt, "no-approver");
|
|
1794
|
+
await approvals.decide(
|
|
1795
|
+
// the question in the key: a changed draft is a new ask
|
|
1796
|
+
`flow ${c.name} ${g.step} ${g.name} ${g.prompt}`, { what: `${c.name}: ${g.prompt}`, url: page.url(), site: opts.site }, wait);
|
|
1797
|
+
}
|
|
1798
|
+
catch (err) {
|
|
1799
|
+
if (!(err instanceof PaymentGate) || err.reason !== "denied")
|
|
1800
|
+
throw err;
|
|
1801
|
+
await applyAnswer(run.fx, g, {
|
|
1802
|
+
approved: false,
|
|
1803
|
+
note: "explore: a person said no",
|
|
1804
|
+
at: at(),
|
|
1805
|
+
});
|
|
1806
|
+
return answer("rejected");
|
|
1807
|
+
}
|
|
1808
|
+
await applyAnswer(run.fx, g, {
|
|
1809
|
+
approved: true,
|
|
1810
|
+
note: "explore: a person said yes",
|
|
1811
|
+
at: at(),
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
catch (err) {
|
|
1816
|
+
// An ask or a refusal: the run is kept, the journal says where it stopped.
|
|
1817
|
+
journal({ kind: "note", text: `flow ${c.name} stopped` });
|
|
1818
|
+
// an ask out over the socket still waits at its gate; anything else ends the line
|
|
1819
|
+
if (!(err instanceof PaymentGate && err.reason === "asked"))
|
|
1820
|
+
live?.flow(null);
|
|
1821
|
+
throw err;
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
/**
|
|
1825
|
+
* Saved call results of `code`, by its `as` and plan, beside the journal: a resend after a fix
|
|
1826
|
+
* goes on from the call that failed, across a kept close. Gone with the journal.
|
|
1827
|
+
*/
|
|
1828
|
+
const codeFile = opts.journalFile ? `${opts.journalFile}.code` : null;
|
|
1829
|
+
let codeSaved = null;
|
|
1830
|
+
const codeScopes = () => {
|
|
1831
|
+
if (codeSaved)
|
|
1832
|
+
return codeSaved;
|
|
1833
|
+
codeSaved = new Map();
|
|
1834
|
+
if (codeFile && existsSync(codeFile))
|
|
1835
|
+
for (const line of readFileSync(codeFile, "utf8").split("\n")) {
|
|
1836
|
+
if (!line.trim())
|
|
1837
|
+
continue;
|
|
1838
|
+
try {
|
|
1839
|
+
const r = JSON.parse(line);
|
|
1840
|
+
if (r.key === undefined)
|
|
1841
|
+
codeSaved.delete(r.scope);
|
|
1842
|
+
else
|
|
1843
|
+
codeSaved.set(r.scope, (codeSaved.get(r.scope) ?? new Map()).set(r.key, { value: r.value }));
|
|
1844
|
+
}
|
|
1845
|
+
catch {
|
|
1846
|
+
// cut by a crash
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
return codeSaved;
|
|
1850
|
+
};
|
|
1851
|
+
const codeWrite = (row) => {
|
|
1852
|
+
if (codeFile)
|
|
1853
|
+
appendFileSync(codeFile, `${JSON.stringify(row)}\n`, { mode: 0o600 });
|
|
1854
|
+
};
|
|
1855
|
+
const codeStore = (scope, fresh) => {
|
|
1856
|
+
const all = codeScopes();
|
|
1857
|
+
if (fresh && all.delete(scope))
|
|
1858
|
+
codeWrite({ scope });
|
|
1859
|
+
const mine = all.get(scope) ?? new Map();
|
|
1860
|
+
all.set(scope, mine);
|
|
1861
|
+
return {
|
|
1862
|
+
get: (key) => mine.get(key),
|
|
1863
|
+
set: (key, value) => {
|
|
1864
|
+
mine.set(key, { value });
|
|
1865
|
+
codeWrite({ scope, key, value });
|
|
1866
|
+
},
|
|
1867
|
+
};
|
|
1868
|
+
};
|
|
1869
|
+
const runCodeHere = async (c, wait) => {
|
|
1870
|
+
const plan = c.plan ?? {};
|
|
1871
|
+
for (const text of [c.code, ...Object.values(plan)])
|
|
1872
|
+
if (holdsSecret(text) || redactText(text) !== text)
|
|
1873
|
+
throw new Error("code: it holds a secret; `place` it on the page, never in code or plan");
|
|
1874
|
+
const store = codeStore(planScope({ as: c.as, plan }), c.fresh === true);
|
|
1875
|
+
const here = flowPage({ site: opts.site, name: "code" }, wait, {
|
|
1876
|
+
journal: false,
|
|
1877
|
+
});
|
|
1878
|
+
const shown = (o) => JSON.parse(redactText(JSON.stringify(o)));
|
|
1879
|
+
try {
|
|
1880
|
+
const r = await runCode(here, { code: c.code, plan }, {
|
|
1881
|
+
store,
|
|
1882
|
+
trace: (row) => logged((h) => h.call(row)),
|
|
1883
|
+
deadline: now() + CODE_MS,
|
|
1884
|
+
passThrough: (err) => err instanceof PaymentGate,
|
|
1885
|
+
...(c.started ? { started: c.started } : {}),
|
|
1886
|
+
});
|
|
1887
|
+
page = fp.page;
|
|
1888
|
+
journal({ kind: "code", code: c.code, as: c.as, plan });
|
|
1889
|
+
return shown({
|
|
1890
|
+
as: c.as,
|
|
1891
|
+
rows: r.rows.length,
|
|
1892
|
+
calls: r.calls,
|
|
1893
|
+
stored: r.stored,
|
|
1894
|
+
first: r.rows.slice(0, 5),
|
|
1895
|
+
...(r.log === undefined ? {} : { log: r.log }),
|
|
1896
|
+
url: page.url(),
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
catch (err) {
|
|
1900
|
+
if (!(err instanceof CodeFailed))
|
|
1901
|
+
throw err;
|
|
1902
|
+
page = fp.page;
|
|
1903
|
+
const r = err.result;
|
|
1904
|
+
return shown({
|
|
1905
|
+
as: c.as,
|
|
1906
|
+
rows: r.rows.length,
|
|
1907
|
+
calls: r.calls,
|
|
1908
|
+
stored: r.stored,
|
|
1909
|
+
failed: r.failed,
|
|
1910
|
+
url: page.url(),
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1914
|
+
/** Every command, batch steps too: the look-only refusal, then the answer's page text fenced. */
|
|
973
1915
|
const act = async (given, wait) => {
|
|
1916
|
+
if (opts.lookOnly && !LOOK_ONLY.has(given.cmd))
|
|
1917
|
+
throw new Error(`${given.cmd}: refused, this session is look-only (explore --look-only)`);
|
|
1918
|
+
const allow = opts.allowHosts;
|
|
1919
|
+
const outside = (u) => !!allow && !urlAllowed(u, allow);
|
|
1920
|
+
const seen = landings;
|
|
1921
|
+
// an outside page not yet blanked: a read now holds its text (`open` replaces it)
|
|
1922
|
+
const before = given.cmd === "open" ? "about:blank" : fp.page.url();
|
|
1923
|
+
const raw = await actRaw(given, wait);
|
|
1924
|
+
// barrier: the reply comes after every earlier navigation event, so `landings` is current
|
|
1925
|
+
const href = allow
|
|
1926
|
+
? await fp.page.evaluate("location.href").catch(() => fp.page.url())
|
|
1927
|
+
: "";
|
|
1928
|
+
// a hop's outside page loaded mid-command: what it read may hold that page's text
|
|
1929
|
+
if (landings !== seen || outside(before) || outside(href) || outside(fp.page.url())) {
|
|
1930
|
+
// the error names the page's URL: wait out the blank
|
|
1931
|
+
if (allow)
|
|
1932
|
+
await fp.page
|
|
1933
|
+
.waitForURL((u) => urlAllowed(u.href, allow), { timeout: 3000 })
|
|
1934
|
+
.catch(() => undefined);
|
|
1935
|
+
throw new Error(`${given.cmd}: the page left this session's sites mid-command and was blanked; its answer is dropped`);
|
|
1936
|
+
}
|
|
1937
|
+
return fence.answer(given.cmd, raw, originOf(fp.page.url()));
|
|
1938
|
+
};
|
|
1939
|
+
const actRaw = async (given, wait) => {
|
|
1940
|
+
// ⌘⇧O closed this browser; the person's Chrome has the profile now. A close still ends it.
|
|
1941
|
+
if (live?.moved && given.cmd !== "close")
|
|
1942
|
+
throw new Error(opts.bringBack
|
|
1943
|
+
? `the session moved to a Chrome window: \`autobrowse bring-back ${port}\` brings it back, or stop it`
|
|
1944
|
+
: "the session moved to a window: stop it, the person finishes there");
|
|
974
1945
|
page = fp.page;
|
|
975
|
-
// A mark from the last picture
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
:
|
|
1946
|
+
// A mark from the last picture, or a ref from the last aria, acts and journals as the control's own hints.
|
|
1947
|
+
const h = "hints" in given ? given.hints : undefined;
|
|
1948
|
+
const cmd = h?.mark
|
|
1949
|
+
? { ...given, hints: await marks.hints(page, h.mark) }
|
|
1950
|
+
: h?.ref
|
|
1951
|
+
? { ...given, hints: await refHints(page, h.ref) }
|
|
1952
|
+
: given;
|
|
979
1953
|
// A target on no frame that the page lacks is looked for in its iframes (card fields, a
|
|
980
1954
|
// bank's challenge). A fill or place gives frames still loading a moment.
|
|
981
|
-
const
|
|
1955
|
+
const framed = "hints" in cmd && cmd.hints && !cmd.hints.frame
|
|
982
1956
|
? {
|
|
983
1957
|
...cmd,
|
|
984
1958
|
hints: await withFrame(page, cmd.hints, WAITS_FOR_CONTROL.has(cmd.cmd) ? FRAME_MS : 0),
|
|
985
1959
|
}
|
|
986
1960
|
: cmd;
|
|
1961
|
+
// Plain hints that match two or more on screen: no act; the matches answer (target-matches.ts).
|
|
1962
|
+
const c = !h?.mark && !h?.ref && ONE_TARGET.has(framed.cmd) && "hints" in framed && framed.hints
|
|
1963
|
+
? { ...framed, hints: await oneTarget(page, framed.hints) }
|
|
1964
|
+
: framed;
|
|
1965
|
+
if (overlay.enabled && LOOKED_AT.has(c.cmd) && "hints" in c && c.hints)
|
|
1966
|
+
await overlay.flash(page, c.hints, c.cmd, "goal" in c && c.goal ? String(c.goal) : undefined);
|
|
1967
|
+
if (c.cmd !== "open" && !KEEPS_LOAD.has(c.cmd))
|
|
1968
|
+
asLoaded = false;
|
|
987
1969
|
switch (c.cmd) {
|
|
1970
|
+
case "window": {
|
|
1971
|
+
// headless Chrome still answers bounds: a placed window nobody sees
|
|
1972
|
+
if (!inWindow)
|
|
1973
|
+
throw new Error(live
|
|
1974
|
+
? "this session shows in the live view: no window to place"
|
|
1975
|
+
: "this session is headless: no window to place. Stop it, then start it again with --headed");
|
|
1976
|
+
const { cmd: _, place, ...want } = c;
|
|
1977
|
+
// a preset or notation, as `explore --window` takes it
|
|
1978
|
+
return {
|
|
1979
|
+
window: await windowBounds(page, place ? { ...(await windowPlace(place)), ...want } : want),
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
case "overlay": {
|
|
1983
|
+
const { cmd: _, refs, on, name, color, person, ...fields } = c;
|
|
1984
|
+
if (person)
|
|
1985
|
+
return { person: await overlay.person(person) };
|
|
1986
|
+
if (name !== undefined || color !== undefined)
|
|
1987
|
+
overlay.who(name, color);
|
|
1988
|
+
if (on !== undefined)
|
|
1989
|
+
await overlay.toggle(page, on);
|
|
1990
|
+
if (on === false)
|
|
1991
|
+
return { drawn: false };
|
|
1992
|
+
return overlay.set(page, {
|
|
1993
|
+
...fields,
|
|
1994
|
+
...(refs ? { refs: refs.map((r) => ({ n: r.n, hints: r.hints })) } : {}),
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
988
1997
|
case "open": {
|
|
989
|
-
// Through the runner: a login
|
|
990
|
-
//
|
|
1998
|
+
// Through the runner: a wall its URL shows (the login page) is signed through. One only
|
|
1999
|
+
// the text suggests comes back as the wall, with the site's sign-in tool: the agent judges.
|
|
2000
|
+
// A captcha wall: solved here once (a checkbox by a human click, a picture by the eyes); unsolved, it comes back.
|
|
2001
|
+
if (opts.allowHosts && !urlAllowed(c.url, opts.allowHosts))
|
|
2002
|
+
throw outsideSession(c.url);
|
|
2003
|
+
// start.sh <site> <url> loaded it; a second load is a flash on a film. Later opens always load (a reopen re-reads a page).
|
|
2004
|
+
if (!c.reload && asLoaded && samePage(page.url(), c.url))
|
|
2005
|
+
return {
|
|
2006
|
+
url: page.url(),
|
|
2007
|
+
stayed: true,
|
|
2008
|
+
wall: await withAccounts(wallAnswer(await looksLikeWall(page), page.url())),
|
|
2009
|
+
};
|
|
2010
|
+
// the main frame's last document answer: a 404 or 401 page reads like any other
|
|
2011
|
+
let status = 0;
|
|
2012
|
+
const onDoc = (r) => {
|
|
2013
|
+
if (r.request().isNavigationRequest() && r.frame() === r.frame().page().mainFrame())
|
|
2014
|
+
status = r.status();
|
|
2015
|
+
};
|
|
2016
|
+
page.context().on("response", onDoc);
|
|
991
2017
|
try {
|
|
992
|
-
|
|
2018
|
+
// An agent at the console picks the account: open never signs in; the wall lists them.
|
|
2019
|
+
await fp.open(c.url, { allowWall: opts.signInOn !== "any" || !opts.login });
|
|
993
2020
|
}
|
|
994
2021
|
catch (err) {
|
|
995
2022
|
if (!(err instanceof NeedsHuman) || (await looksLikeWall(page))?.kind !== "captcha")
|
|
996
2023
|
throw err;
|
|
997
2024
|
}
|
|
2025
|
+
finally {
|
|
2026
|
+
page.context().off("response", onDoc);
|
|
2027
|
+
}
|
|
998
2028
|
journal({ kind: "navigate" });
|
|
999
|
-
|
|
2029
|
+
asLoaded = !openedOnce;
|
|
2030
|
+
openedOnce = true;
|
|
2031
|
+
// `open` goes to the main page: the tabs earlier steps opened are behind it now.
|
|
2032
|
+
page = fp.page;
|
|
2033
|
+
const closedTabs = await closeStepTabs();
|
|
2034
|
+
let wall = await looksLikeWall(page);
|
|
2035
|
+
let captcha;
|
|
2036
|
+
if (wall?.kind === "captcha") {
|
|
2037
|
+
captcha = await fp.captcha();
|
|
2038
|
+
page = fp.page;
|
|
2039
|
+
if (captcha.solved) {
|
|
2040
|
+
journal({ kind: "note", text: "solved a captcha here: `await fp.captcha()`" });
|
|
2041
|
+
// Cloudflare reloads the page once the box is ticked
|
|
2042
|
+
await page.waitForLoadState("networkidle", { timeout: 10_000 }).catch(() => undefined);
|
|
2043
|
+
}
|
|
2044
|
+
wall = await looksLikeWall(page);
|
|
2045
|
+
}
|
|
2046
|
+
return {
|
|
2047
|
+
url: page.url(),
|
|
2048
|
+
...(status >= 400 ? { status } : {}),
|
|
2049
|
+
...(closedTabs ? { closedTabs } : {}),
|
|
2050
|
+
...(captcha ? { captcha } : {}),
|
|
2051
|
+
wall: await withAccounts(wallAnswer(wall, page.url())),
|
|
2052
|
+
};
|
|
1000
2053
|
}
|
|
1001
2054
|
case "click": {
|
|
1002
2055
|
const spent = await gate("click", c, wait);
|
|
1003
2056
|
const billing = spent ? await fillBilling() : [];
|
|
1004
2057
|
await hands.think(page);
|
|
1005
|
-
await
|
|
2058
|
+
const kind = await actKind(find(c));
|
|
2059
|
+
const tab = kind.tab ? tabWaiter(page, actMs) : null;
|
|
2060
|
+
await hands.click(find(c), { timeout: actMs, ...(c.at ? { at: c.at } : {}) });
|
|
1006
2061
|
await settle(page);
|
|
2062
|
+
await tab?.();
|
|
1007
2063
|
journalAct(c, (target) => ({ kind: "click", target }));
|
|
2064
|
+
const invalid = kind.submits ? await refusedFields(find(c)) : [];
|
|
1008
2065
|
// A receipt only for the click that takes money; checkout or "add a card" only led there.
|
|
1009
|
-
const set =
|
|
2066
|
+
const set = {
|
|
2067
|
+
...(billing.length ? { billing } : {}),
|
|
2068
|
+
...(invalid.length ? { invalid } : {}),
|
|
2069
|
+
};
|
|
1010
2070
|
if (spent?.charges)
|
|
1011
2071
|
return { url: page.url(), ...set, told: await reportSpend(spent) };
|
|
1012
2072
|
return { url: page.url(), ...set };
|
|
1013
2073
|
}
|
|
2074
|
+
case "hover": {
|
|
2075
|
+
await hands.think(page);
|
|
2076
|
+
await hands.hover(find(c), { timeout: actMs });
|
|
2077
|
+
await settle(page);
|
|
2078
|
+
journalAct(c, (target) => ({ kind: "hover", target }));
|
|
2079
|
+
return { url: page.url() };
|
|
2080
|
+
}
|
|
1014
2081
|
case "drag": {
|
|
1015
2082
|
await hands.think(page);
|
|
1016
|
-
await hands.drag(find(c), c.from, c.to, { timeout:
|
|
2083
|
+
await hands.drag(find(c), c.from, c.to, { timeout: actMs });
|
|
1017
2084
|
await settle(page);
|
|
1018
2085
|
return { url: page.url() };
|
|
1019
2086
|
}
|
|
1020
2087
|
case "fill": {
|
|
2088
|
+
await checkFill(find(c), c.value, actMs);
|
|
1021
2089
|
await gate("fill", c, wait);
|
|
1022
2090
|
await hands.think(page);
|
|
1023
|
-
await hands.type(find(c), c.value, { timeout:
|
|
2091
|
+
stepTyped = await hands.type(find(c), c.value, { timeout: actMs });
|
|
1024
2092
|
const secret = looksLikeSecretField(toLocatorHints(c.hints)) || looksLikeSecretValue(c.value);
|
|
1025
2093
|
journalAct(c, (target) => ({
|
|
1026
2094
|
kind: "input",
|
|
@@ -1056,7 +2124,7 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1056
2124
|
await gate("fill", c, wait);
|
|
1057
2125
|
await hands.think(page);
|
|
1058
2126
|
// A secret arrives whole, as autofill or a password manager puts it; nobody types a minted password.
|
|
1059
|
-
await hands.paste(find(c), value, { timeout:
|
|
2127
|
+
await hands.paste(find(c), value, { timeout: actMs });
|
|
1060
2128
|
journalAct(c, (target) => ({
|
|
1061
2129
|
kind: "input",
|
|
1062
2130
|
target,
|
|
@@ -1067,16 +2135,17 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1067
2135
|
return { ok: true, secret: c.secret };
|
|
1068
2136
|
}
|
|
1069
2137
|
case "select": {
|
|
2138
|
+
await checkSelect(find(c), c.value, actMs);
|
|
1070
2139
|
await gate("select", c, wait);
|
|
1071
2140
|
await hands.think(page);
|
|
1072
|
-
await chooseOption(find(c), c.value,
|
|
2141
|
+
await chooseOption(find(c), c.value, actMs, hands);
|
|
1073
2142
|
journalAct(c, (target) => ({ kind: "select", target, value: c.value }));
|
|
1074
2143
|
return { ok: true };
|
|
1075
2144
|
}
|
|
1076
2145
|
case "upload": {
|
|
1077
2146
|
await fp.act({ kind: "upload", files: await uploadFiles(c.files, wait) }, c.hints, {
|
|
1078
2147
|
goal: c.goal ?? "upload",
|
|
1079
|
-
timeoutMs:
|
|
2148
|
+
timeoutMs: actMs,
|
|
1080
2149
|
});
|
|
1081
2150
|
await settle(page);
|
|
1082
2151
|
journalAct(c, (target) => ({ kind: "upload", target, files: c.files }));
|
|
@@ -1087,52 +2156,160 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1087
2156
|
const spent = activates(c.key) ? await gate("click", c, wait) : null;
|
|
1088
2157
|
const billing = spent ? await fillBilling() : [];
|
|
1089
2158
|
await hands.think(page);
|
|
1090
|
-
await
|
|
2159
|
+
const kind = activates(c.key) ? await actKind(find(c)) : null;
|
|
2160
|
+
const tab = kind?.tab ? tabWaiter(page, actMs) : null;
|
|
2161
|
+
await hands.press(find(c), c.key, { timeout: actMs });
|
|
1091
2162
|
await settle(page);
|
|
2163
|
+
await tab?.();
|
|
1092
2164
|
journalAct(c, (target) => ({ kind: "press", target, key: c.key }));
|
|
1093
|
-
const
|
|
2165
|
+
const sent = kind?.submits || (kind?.field && c.key === "Enter");
|
|
2166
|
+
const invalid = sent ? await refusedFields(find(c)) : [];
|
|
2167
|
+
const set = {
|
|
2168
|
+
...(billing.length ? { billing } : {}),
|
|
2169
|
+
...(invalid.length ? { invalid } : {}),
|
|
2170
|
+
};
|
|
1094
2171
|
if (spent?.charges)
|
|
1095
2172
|
return { url: page.url(), ...set, told: await reportSpend(spent) };
|
|
1096
2173
|
return { url: page.url(), ...set };
|
|
1097
2174
|
}
|
|
1098
|
-
case "type":
|
|
1099
|
-
|
|
2175
|
+
case "type": {
|
|
2176
|
+
// Into the control just clicked: journaled as its input, so the flow types it too.
|
|
2177
|
+
const into = lastClick;
|
|
2178
|
+
const held = into
|
|
2179
|
+
? await find(into)
|
|
2180
|
+
.evaluate((el) => el === el.ownerDocument.activeElement ||
|
|
2181
|
+
el.contains(el.ownerDocument.activeElement), undefined, { timeout: 2_000 })
|
|
2182
|
+
.catch(() => false)
|
|
2183
|
+
: false;
|
|
2184
|
+
stepTyped = await hands.type(page, c.text, {
|
|
2185
|
+
timeout: actMs,
|
|
2186
|
+
...(c.speed ? { speed: c.speed } : {}),
|
|
2187
|
+
});
|
|
2188
|
+
if (!into || !held)
|
|
2189
|
+
return {
|
|
2190
|
+
ok: true,
|
|
2191
|
+
journaled: false,
|
|
2192
|
+
note: "typed into a focus no clicked control holds: the recording lacks it; use fill",
|
|
2193
|
+
};
|
|
2194
|
+
const secret = looksLikeSecretField(toLocatorHints(into.hints)) || looksLikeSecretValue(c.text);
|
|
2195
|
+
journalAct(into, (target) => ({
|
|
2196
|
+
kind: "input",
|
|
2197
|
+
target,
|
|
2198
|
+
value: secret ? REDACTED : c.text,
|
|
2199
|
+
redacted: secret,
|
|
2200
|
+
}));
|
|
1100
2201
|
return { ok: true };
|
|
2202
|
+
}
|
|
1101
2203
|
case "key": {
|
|
1102
2204
|
// Enter or Space presses whatever has focus: judged as a click on it.
|
|
1103
2205
|
const focused = { ...c, hints: { css: "*:focus" } };
|
|
1104
2206
|
const spent = activates(c.key) ? await gate("click", focused, wait) : null;
|
|
1105
|
-
await hands.press(page, c.key, { timeout:
|
|
2207
|
+
await hands.press(page, c.key, { timeout: actMs });
|
|
1106
2208
|
await settle(page);
|
|
1107
2209
|
if (spent?.charges)
|
|
1108
2210
|
return { url: page.url(), told: await reportSpend(spent) };
|
|
1109
2211
|
return { url: page.url() };
|
|
1110
2212
|
}
|
|
2213
|
+
case "scroll": {
|
|
2214
|
+
// the hands aim the pointer (the pane, else the page's content), then wheel or swipe
|
|
2215
|
+
const over = c.hints ? find({ hints: c.hints }) : undefined;
|
|
2216
|
+
const s = await scrollAndSettle(page, () => hands.scroll(page, c.dy, { over }), {
|
|
2217
|
+
over,
|
|
2218
|
+
settle: () => settle(page),
|
|
2219
|
+
});
|
|
2220
|
+
const row = {
|
|
2221
|
+
dy: c.dy,
|
|
2222
|
+
...(s.moved !== null ? { moved: s.moved } : {}),
|
|
2223
|
+
...(s.loaded ? { loaded: true } : {}),
|
|
2224
|
+
};
|
|
2225
|
+
if (c.hints)
|
|
2226
|
+
journalAct({ hints: c.hints }, (target) => ({ kind: "scroll", ...row, target }));
|
|
2227
|
+
else
|
|
2228
|
+
journal({ kind: "scroll", ...row });
|
|
2229
|
+
return { url: page.url(), ...row, scroll: (await scrollOf(page)) ?? null };
|
|
2230
|
+
}
|
|
1111
2231
|
case "aria": {
|
|
2232
|
+
// refs: `[ref=e12]` per line, iframes inline (`f1e3`), for `hints:{ref}`
|
|
2233
|
+
const ai = c.refs !== false;
|
|
1112
2234
|
const tree = await (c.hints
|
|
1113
|
-
? locate(page, c.hints).ariaSnapshot()
|
|
1114
|
-
:
|
|
2235
|
+
? locate(page, c.hints).ariaSnapshot(ai ? { mode: "ai" } : {})
|
|
2236
|
+
: ai
|
|
2237
|
+
? page.ariaSnapshot({ mode: "ai" })
|
|
2238
|
+
: ariaWithFrames(page)).catch((e) => `error: ${e.message}`);
|
|
1115
2239
|
// Even raw: a password typed into a field is never something a caller may read back.
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
2240
|
+
const shown_ = out(redactAria(tree), c.raw);
|
|
2241
|
+
if (!tree.startsWith("error:")) {
|
|
2242
|
+
const key = `aria|${JSON.stringify(c.hints ?? null)}|${ai}|${!!c.raw}`;
|
|
2243
|
+
const delta = looks.look(key, page.url(), shown_.split("\n"), c.since);
|
|
2244
|
+
if (delta)
|
|
2245
|
+
return { since: delta };
|
|
2246
|
+
}
|
|
2247
|
+
const fit = fitText(shotsDir, "aria", shown_, c.limit ?? 12_000);
|
|
2248
|
+
const aria = fit.text;
|
|
2249
|
+
const whole = fit.whole ? { whole: fit.whole } : {};
|
|
2250
|
+
if (c.hints && tree.startsWith("error:"))
|
|
2251
|
+
return { aria, hint: 'see the page: {"cmd":"marks"}' };
|
|
2252
|
+
if (!c.extras || c.hints)
|
|
2253
|
+
return { aria, ...whole };
|
|
2254
|
+
const extras = (await extrasOf(page)).map((e) => ({ ...e, name: out(e.name, c.raw) }));
|
|
2255
|
+
return { aria, extras, ...whole };
|
|
2256
|
+
}
|
|
2257
|
+
case "snapshot": {
|
|
2258
|
+
const rows_ = (await snapshotPage(page, c.limit ?? 120))
|
|
2259
|
+
.split("\n")
|
|
2260
|
+
.map((r) => redactRow(r));
|
|
2261
|
+
const delta = looks.look(`snapshot|${c.limit ?? 120}`, page.url(), rows_, c.since);
|
|
2262
|
+
return delta ? { since: delta } : { rows: rows_.join("\n") };
|
|
2263
|
+
}
|
|
2264
|
+
case "text": {
|
|
2265
|
+
if (c.article) {
|
|
2266
|
+
const a = await articleText(page);
|
|
2267
|
+
if (a.article) {
|
|
2268
|
+
const fit = fitText(shotsDir, "text", out(a.text, c.raw), c.limit ?? 4_000);
|
|
2269
|
+
return {
|
|
2270
|
+
article: true,
|
|
2271
|
+
title: a.title,
|
|
2272
|
+
byline: a.byline,
|
|
2273
|
+
site: a.site,
|
|
2274
|
+
text: fit.text,
|
|
2275
|
+
...(fit.whole ? { whole: fit.whole } : {}),
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
const fit = fitText(shotsDir, "text", out(await layoutText(page, WHOLE_TEXT, { coords: false }), c.raw), c.limit ?? 4_000);
|
|
2279
|
+
return {
|
|
2280
|
+
article: false,
|
|
2281
|
+
why: a.why,
|
|
2282
|
+
text: fit.text,
|
|
2283
|
+
...(fit.whole ? { whole: fit.whole } : {}),
|
|
2284
|
+
};
|
|
2285
|
+
}
|
|
2286
|
+
const all = out(c.layout === false
|
|
2287
|
+
? await bodyText(page, WHOLE_TEXT)
|
|
2288
|
+
: await layoutText(page, WHOLE_TEXT, { coords: c.coords === true }), c.raw);
|
|
2289
|
+
const fit = fitText(shotsDir, "text", all, c.limit ?? 4_000);
|
|
2290
|
+
return { text: fit.text, ...(fit.whole ? { whole: fit.whole } : {}) };
|
|
1120
2291
|
}
|
|
1121
|
-
case "snapshot":
|
|
1122
|
-
return {
|
|
1123
|
-
rows: (await snapshotPage(page, c.limit ?? 120))
|
|
1124
|
-
.split("\n")
|
|
1125
|
-
.map((r) => redactRow(r))
|
|
1126
|
-
.join("\n"),
|
|
1127
|
-
};
|
|
1128
|
-
case "text":
|
|
1129
|
-
return {
|
|
1130
|
-
text: out(c.layout === false
|
|
1131
|
-
? await bodyText(page, c.limit ?? 4_000)
|
|
1132
|
-
: await layoutText(page, c.limit ?? 4_000, { coords: c.coords === true }), c.raw),
|
|
1133
|
-
};
|
|
1134
2292
|
case "url":
|
|
1135
2293
|
return { url: page.url() };
|
|
2294
|
+
case "errors": {
|
|
2295
|
+
const errors = pageErrors.log.slice(-(c.last ?? 30));
|
|
2296
|
+
const total = pageErrors.count();
|
|
2297
|
+
if (c.clear)
|
|
2298
|
+
pageErrors.clear();
|
|
2299
|
+
return { errors, total };
|
|
2300
|
+
}
|
|
2301
|
+
case "wait":
|
|
2302
|
+
return waitFor(c);
|
|
2303
|
+
case "dialog": {
|
|
2304
|
+
if (c.accept === undefined)
|
|
2305
|
+
return { dialogs: dialogs.log.slice(-20) };
|
|
2306
|
+
dialogs.answerNext({ accept: c.accept, ...(c.text !== undefined ? { text: c.text } : {}) });
|
|
2307
|
+
journal({
|
|
2308
|
+
kind: "note",
|
|
2309
|
+
text: `the next confirm or prompt is answered ${c.accept ? "yes" : "no"}: \`fp.page.once("dialog", (d) => d.${c.accept ? "accept()" : "dismiss()"})\``,
|
|
2310
|
+
});
|
|
2311
|
+
return { ok: true, next: c.accept ? "accept" : "dismiss" };
|
|
2312
|
+
}
|
|
1136
2313
|
case "files": {
|
|
1137
2314
|
if (!opts.files)
|
|
1138
2315
|
throw new Error("files: none here (they live on the Mac: autobrowse files add)");
|
|
@@ -1159,12 +2336,12 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1159
2336
|
return { name: f.name, text: null, why: "no text: an ID document" };
|
|
1160
2337
|
if (!f.text)
|
|
1161
2338
|
return { name: f.name, text: null, why: "no text: an image or a scan" };
|
|
1162
|
-
const
|
|
2339
|
+
const fit = fitText(shotsDir, "file", f.text, c.limit ?? 40_000);
|
|
1163
2340
|
return {
|
|
1164
2341
|
name: f.name,
|
|
1165
2342
|
note: f.note,
|
|
1166
|
-
text:
|
|
1167
|
-
...(
|
|
2343
|
+
text: fit.text,
|
|
2344
|
+
...(fit.whole ? { whole: fit.whole } : {}),
|
|
1168
2345
|
};
|
|
1169
2346
|
}
|
|
1170
2347
|
case "pages":
|
|
@@ -1184,33 +2361,62 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1184
2361
|
// A popup that closes (OAuth done) hands control back to the main page.
|
|
1185
2362
|
if (c.index !== "main")
|
|
1186
2363
|
next.once("close", () => fp.switchTo(all[0]));
|
|
1187
|
-
|
|
2364
|
+
const closedTabs = c.index === "main" ? await closeStepTabs() : 0;
|
|
2365
|
+
return { url: next.url(), ...(closedTabs ? { closedTabs } : {}) };
|
|
2366
|
+
}
|
|
2367
|
+
case "screenshot": {
|
|
2368
|
+
const file = await shoot();
|
|
2369
|
+
const prev = lastShot;
|
|
2370
|
+
lastShot = file;
|
|
2371
|
+
if (!c.ifChanged || !prev || !existsSync(prev))
|
|
2372
|
+
return { file };
|
|
2373
|
+
const diff = shotDiff(readFileSync(prev), readFileSync(file));
|
|
2374
|
+
if (diff >= (c.threshold ?? 0.01))
|
|
2375
|
+
return { file, diff: Math.round(diff * 1e4) / 1e4 };
|
|
2376
|
+
// same picture: the earlier file stands, this one goes
|
|
2377
|
+
rmSync(file, { force: true });
|
|
2378
|
+
lastShot = prev;
|
|
2379
|
+
return { file: prev, unchanged: true, diff: Math.round(diff * 1e4) / 1e4 };
|
|
2380
|
+
}
|
|
2381
|
+
case "proof": {
|
|
2382
|
+
const n = String(shotN++).padStart(4, "0");
|
|
2383
|
+
const proof = await proofPage(page, {
|
|
2384
|
+
url: c.url ?? page.url(),
|
|
2385
|
+
...(c.widths ? { widths: c.widths } : {}),
|
|
2386
|
+
errors: pageErrors,
|
|
2387
|
+
shotPath: (w) => join(shotsDir, `proof-${n}-${w}.png`),
|
|
2388
|
+
});
|
|
2389
|
+
const file = join(shotsDir, `proof-${n}.json`);
|
|
2390
|
+
writeFileSync(file, JSON.stringify(proof, null, 1));
|
|
2391
|
+
const before = c.against ? JSON.parse(readFileSync(c.against, "utf8")) : null;
|
|
2392
|
+
return {
|
|
2393
|
+
file,
|
|
2394
|
+
flags: proofFlags(proof),
|
|
2395
|
+
shots: proof.widths.map((w) => w.shot),
|
|
2396
|
+
...(before ? { drift: compareProofs(before, proof) } : {}),
|
|
2397
|
+
};
|
|
1188
2398
|
}
|
|
1189
|
-
case "screenshot":
|
|
1190
|
-
return { file: await shoot() };
|
|
1191
2399
|
case "marks":
|
|
1192
2400
|
return takeMarks();
|
|
1193
2401
|
case "network":
|
|
1194
2402
|
return network(c);
|
|
2403
|
+
case "memory":
|
|
2404
|
+
return {
|
|
2405
|
+
...recall(readMemory(opts.site), c.find),
|
|
2406
|
+
dir: memoryDir(opts.site),
|
|
2407
|
+
...(fp.network?.personal ? { personal: "this profile adds nothing to it" } : {}),
|
|
2408
|
+
};
|
|
1195
2409
|
case "html":
|
|
1196
2410
|
return html(c);
|
|
1197
2411
|
case "eval": {
|
|
1198
|
-
// A click by script never meets the click's gate
|
|
1199
|
-
|
|
1200
|
-
if (scriptActs(c.js)) {
|
|
1201
|
-
const labels = await page.evaluate(BUTTON_LABELS).catch(() => []);
|
|
1202
|
-
const spend = labels
|
|
1203
|
-
.map((text) => paymentGate("click", { text: text.trim().slice(0, 200) }))
|
|
1204
|
-
.find((w) => w !== null);
|
|
1205
|
-
if (spend)
|
|
1206
|
-
await decide(`eval ${c.js.slice(0, 80)}`, `run a script on a page where it can ${spend.replace(/^press /, "press ")}`, page.url(), wait);
|
|
1207
|
-
}
|
|
2412
|
+
// A click by script never meets the click's gate.
|
|
2413
|
+
await scriptGate(c.js, wait);
|
|
1208
2414
|
const result = c.hints
|
|
1209
2415
|
? await locate(page, c.hints)
|
|
1210
2416
|
.first()
|
|
1211
2417
|
// A string is an expression to Playwright, never called: wrap it as a function of el.
|
|
1212
2418
|
.evaluate(new Function("el", `return (${c.js})(el);`), undefined, {
|
|
1213
|
-
timeout:
|
|
2419
|
+
timeout: actMs,
|
|
1214
2420
|
})
|
|
1215
2421
|
: await inPage(page, c.js);
|
|
1216
2422
|
// A script that clicked or submitted is an act a walk replays; one that only looked is not.
|
|
@@ -1220,13 +2426,31 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1220
2426
|
target: c.hints ? toLocatorHints(c.hints) : null,
|
|
1221
2427
|
js: c.js,
|
|
1222
2428
|
});
|
|
1223
|
-
|
|
2429
|
+
const shown = typeof result === "string" ? out(result, c.raw) : result;
|
|
2430
|
+
const budget = c.limit ?? EVAL_LIMIT;
|
|
2431
|
+
if (typeof shown === "string") {
|
|
2432
|
+
const t = fitText(shotsDir, "eval", shown, budget);
|
|
2433
|
+
return { result: t.text, ...(t.whole ? { whole: t.whole } : {}) };
|
|
2434
|
+
}
|
|
2435
|
+
// 10 answers of 100k-1.6M tokens were 96% of eval's (WA-1093): TOON, then an even cut.
|
|
2436
|
+
const v = compactValue(shown, budget);
|
|
2437
|
+
if (v.kind === "json")
|
|
2438
|
+
return { result: v.value };
|
|
2439
|
+
const json = out(JSON.stringify(shown), c.raw);
|
|
2440
|
+
return {
|
|
2441
|
+
result: v.text,
|
|
2442
|
+
format: "toon",
|
|
2443
|
+
...(v.even
|
|
2444
|
+
? { whole: { chars: json.length, file: keepWhole(shotsDir, "eval", json, "json") } }
|
|
2445
|
+
: {}),
|
|
2446
|
+
};
|
|
1224
2447
|
}
|
|
1225
2448
|
case "count":
|
|
1226
2449
|
return { count: await locateAll(page, c.hints).count() };
|
|
1227
2450
|
case "read": {
|
|
1228
|
-
const text = (await find(c).first().innerText({ timeout:
|
|
1229
|
-
const
|
|
2451
|
+
const text = (await find(c).first().innerText({ timeout: actMs })).trim();
|
|
2452
|
+
const fit = fitText(shotsDir, "read", out(text, false), 2_000);
|
|
2453
|
+
const shown = fit.text;
|
|
1230
2454
|
journalAct(c, (target) => ({ kind: "read", target, as: c.as, value: shown }));
|
|
1231
2455
|
return { as: c.as, text: shown };
|
|
1232
2456
|
}
|
|
@@ -1271,12 +2495,98 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1271
2495
|
case "keep": {
|
|
1272
2496
|
if (!opts.sink)
|
|
1273
2497
|
throw new Error("keep needs a secret sink (SECRET_SINK / .env)");
|
|
2498
|
+
const keeper = opts.workflows?.keys;
|
|
1274
2499
|
const value = await textOf(find(c));
|
|
1275
2500
|
if (!value)
|
|
1276
2501
|
throw new Error("keep: the element is empty");
|
|
1277
|
-
await
|
|
2502
|
+
const there = c.key ? await vaultKey(keeper, c.key) : null;
|
|
2503
|
+
if (!c.key) {
|
|
2504
|
+
const filled = (await keeper?.filledBy?.(c.env)) ?? null;
|
|
2505
|
+
if (filled)
|
|
2506
|
+
throw new Error(`keep: ${c.env} is filled by the vault key ${filled}. A second key takes its own address and env name: add "key":"${filled.split("@")[0]}@<label>". A new value for ${filled} is a person's call: autobrowse creds key rotate ${filled}`);
|
|
2507
|
+
}
|
|
2508
|
+
else if (there && there.secret !== value)
|
|
2509
|
+
throw new Error(`keep: ${c.key} already holds another key (id ${keyId(there.secret)}). A second key takes its own label; a new value for this one is a person's call: autobrowse creds key rotate ${c.key}`);
|
|
2510
|
+
// Two phases (WA-1126): phase one asks and writes nothing; a yes counts only for a
|
|
2511
|
+
// question this session asked about this name and this value.
|
|
2512
|
+
const held = await heldOther(opts.sink, c.env, value);
|
|
2513
|
+
if (held !== null) {
|
|
2514
|
+
const mark = valueMark(value);
|
|
2515
|
+
if (!(c.confirm === true && keepAsked.get(c.env) === mark)) {
|
|
2516
|
+
keepAsked.set(c.env, mark);
|
|
2517
|
+
const row = { name: c.env, length: held.length, where: "the store" };
|
|
2518
|
+
return {
|
|
2519
|
+
ok: false,
|
|
2520
|
+
kept: false,
|
|
2521
|
+
held: { env: c.env, length: held.length },
|
|
2522
|
+
question: replaceQuestion([row], 'send the same command with "confirm":true'),
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
keepAsked.delete(c.env);
|
|
2527
|
+
if (c.key) {
|
|
2528
|
+
if (!keeper)
|
|
2529
|
+
throw new Error("keep: no key vault here; keep under an env name alone");
|
|
2530
|
+
const { site, account } = parseKeyAddress(c.key);
|
|
2531
|
+
if (!there)
|
|
2532
|
+
await keeper.put({
|
|
2533
|
+
site,
|
|
2534
|
+
account,
|
|
2535
|
+
owner: keeper.owner,
|
|
2536
|
+
secret: value,
|
|
2537
|
+
status: "live",
|
|
2538
|
+
madeAt: new Date().toISOString(),
|
|
2539
|
+
via: await keeper.login(site),
|
|
2540
|
+
env: [c.env],
|
|
2541
|
+
});
|
|
2542
|
+
else if (!there.env.includes(c.env))
|
|
2543
|
+
await keeper.put({ ...there, env: [...there.env, c.env] });
|
|
2544
|
+
// The projection writes the env name; not journaled: a compiled mint is the vendor's own workflow.
|
|
2545
|
+
await keeper.project([site], { replace: held !== null });
|
|
2546
|
+
return {
|
|
2547
|
+
key: c.key,
|
|
2548
|
+
id: keyId(value),
|
|
2549
|
+
env: c.env,
|
|
2550
|
+
length: value.length,
|
|
2551
|
+
...(held !== null ? { replaced: true } : {}),
|
|
2552
|
+
};
|
|
2553
|
+
}
|
|
2554
|
+
await opts.sink.put(c.env, value, { replace: held !== null });
|
|
1278
2555
|
journalAct(c, (target) => ({ kind: "keep", target, env: c.env }));
|
|
1279
|
-
return {
|
|
2556
|
+
return {
|
|
2557
|
+
env: c.env,
|
|
2558
|
+
length: value.length,
|
|
2559
|
+
...(held !== null ? { replaced: true } : {}),
|
|
2560
|
+
};
|
|
2561
|
+
}
|
|
2562
|
+
case "seed": {
|
|
2563
|
+
if (!opts.credentials)
|
|
2564
|
+
throw new Error("seed: no login store in this session");
|
|
2565
|
+
const name = credentialFor(SITE_LOGINS, opts.site);
|
|
2566
|
+
const cred = await opts.credentials.get(name);
|
|
2567
|
+
if (!cred)
|
|
2568
|
+
throw new Error(`seed: no login stored for ${name}; sign up or \`creds add\` first`);
|
|
2569
|
+
const seed = seedInCalls(fp.network?.rows().map((r) => r.body) ?? []) ?? (await seedOnPage(page));
|
|
2570
|
+
if (!seed)
|
|
2571
|
+
throw new Error("seed: no authenticator seed on the page; open the step that shows its QR or setup key (often 'another authenticator app' or 'can't scan')");
|
|
2572
|
+
// two phases: a held seed is replaced only on a yes to this session's question
|
|
2573
|
+
if (cred.totpSecret &&
|
|
2574
|
+
cred.totpSecret !== seed &&
|
|
2575
|
+
!(c.confirm === true && seedAsked.has(name))) {
|
|
2576
|
+
seedAsked.add(name);
|
|
2577
|
+
return {
|
|
2578
|
+
ok: false,
|
|
2579
|
+
sealed: false,
|
|
2580
|
+
question: `${name} already holds another authenticator seed. Is that intended? Yes: the same command with "confirm":true. No: stop here; the held seed keeps working.`,
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
seedAsked.delete(name);
|
|
2584
|
+
await opts.credentials.put(name, { ...cred, totpSecret: seed });
|
|
2585
|
+
return {
|
|
2586
|
+
ok: true,
|
|
2587
|
+
sealed: name,
|
|
2588
|
+
next: `place {"secret":"${name}.code"} into the code box`,
|
|
2589
|
+
};
|
|
1280
2590
|
}
|
|
1281
2591
|
case "captcha": {
|
|
1282
2592
|
const got = await fp.captcha();
|
|
@@ -1309,42 +2619,52 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1309
2619
|
});
|
|
1310
2620
|
return { as: c.as, file, bytes: got.buffer.length, type: got.mimeType };
|
|
1311
2621
|
}
|
|
2622
|
+
case "waitNote": {
|
|
2623
|
+
const got = await overlay.nextNote((c.timeoutS ?? 60) * 1000);
|
|
2624
|
+
return { notes: got ? overlay.takeNotes() : [] };
|
|
2625
|
+
}
|
|
1312
2626
|
case "goal":
|
|
1313
2627
|
logged((h) => h.goal(c.text));
|
|
1314
2628
|
return { ok: true, run: history?.id ?? null };
|
|
1315
2629
|
case "done": {
|
|
1316
2630
|
const id = history && !history.ended() ? history.id : null;
|
|
1317
2631
|
await endRun(c.outcome, c.summary ?? null);
|
|
1318
|
-
|
|
2632
|
+
// The browser stays open for a next goal: say how it goes.
|
|
2633
|
+
return { ok: true, run: id, close: `autobrowse stop ${port}` };
|
|
1319
2634
|
}
|
|
1320
2635
|
case "os": {
|
|
1321
2636
|
const a = c.act;
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
2637
|
+
// the OS picture cannot be masked: a card on this session's page stops it
|
|
2638
|
+
if (a.op === "shot" && !page.isClosed() && (await cardShown(page)))
|
|
2639
|
+
throw new Error("os shot: a card field on this page holds a value; the screen picture would print it. Use `screenshot` (card fields are covered)");
|
|
2640
|
+
osWait = wait;
|
|
2641
|
+
const r = await osHands.act(a);
|
|
2642
|
+
// Looking (windows, snapshot, shot) journals nothing; a secret is kept by name only.
|
|
2643
|
+
if (r.op)
|
|
1327
2644
|
journal({
|
|
1328
2645
|
kind: "desktop",
|
|
1329
|
-
op:
|
|
1330
|
-
redacted,
|
|
2646
|
+
op: r.op,
|
|
2647
|
+
redacted: r.op.op === "type" && r.op.secret !== undefined,
|
|
1331
2648
|
});
|
|
1332
|
-
|
|
1333
|
-
return result;
|
|
2649
|
+
return desktopAnswer(r, shotsDir);
|
|
1334
2650
|
}
|
|
1335
|
-
case "pause":
|
|
1336
|
-
|
|
1337
|
-
|
|
2651
|
+
case "pause": {
|
|
2652
|
+
const held = steer.agentPause();
|
|
2653
|
+
if (held)
|
|
2654
|
+
return held;
|
|
1338
2655
|
if (history)
|
|
1339
2656
|
lookBefore = await lookAt(page).catch(() => null);
|
|
1340
|
-
journal({ kind: "pause" });
|
|
1341
|
-
// The page may predate the init script: hook it now.
|
|
1342
|
-
await inPage(page, OBSERVER_SCRIPT).catch(() => undefined);
|
|
1343
2657
|
return { paused: true };
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
2658
|
+
}
|
|
2659
|
+
case "resume":
|
|
2660
|
+
return steer.agentResume();
|
|
2661
|
+
case "tools": {
|
|
2662
|
+
const all = await toolsNow();
|
|
2663
|
+
if (c.find)
|
|
2664
|
+
return { tools: await Promise.all(findTools(all.map(findable), c.find).map(shown)) };
|
|
2665
|
+
if (c.site)
|
|
2666
|
+
return { tools: await Promise.all(all.filter((t) => t.site === c.site).map(shown)) };
|
|
2667
|
+
return { sites: sitesTree(all) };
|
|
1348
2668
|
}
|
|
1349
2669
|
case "journal":
|
|
1350
2670
|
return { total: actions.length, actions: c.last ? actions.slice(-c.last) : actions };
|
|
@@ -1388,17 +2708,25 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1388
2708
|
// A payment gate answers the whole call, as it does a single act.
|
|
1389
2709
|
if (err instanceof PaymentGate)
|
|
1390
2710
|
throw err;
|
|
1391
|
-
const error = err
|
|
2711
|
+
const error = missText(err, "hints" in one ? one.hints : undefined);
|
|
1392
2712
|
const shot = "hints" in one && missed(err) ? await takeMarks().catch(() => null) : null;
|
|
1393
2713
|
return answer({
|
|
1394
2714
|
failed: { at: i, cmd: one.cmd, error },
|
|
2715
|
+
...(err instanceof AmbiguousTarget ? matchesAnswer(err) : {}),
|
|
1395
2716
|
...(shot ? { marks: shot } : {}),
|
|
1396
2717
|
});
|
|
1397
2718
|
}
|
|
1398
2719
|
}
|
|
1399
2720
|
return answer({});
|
|
1400
2721
|
}
|
|
2722
|
+
case "flow":
|
|
2723
|
+
return runWorkflow(c, wait);
|
|
2724
|
+
case "code":
|
|
2725
|
+
return runCodeHere(c, wait);
|
|
1401
2726
|
case "close":
|
|
2727
|
+
// An agent that ended at a wall paused first: the session waits on a person.
|
|
2728
|
+
if (c.unlessPaused && steer.paused())
|
|
2729
|
+
return { ok: false, paused: true };
|
|
1402
2730
|
// Closed on purpose: nothing left to resume, unless asked to keep it.
|
|
1403
2731
|
closing = !c.keep;
|
|
1404
2732
|
if (c.why) {
|
|
@@ -1407,11 +2735,32 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1407
2735
|
}
|
|
1408
2736
|
if (opts.journalFile && closing)
|
|
1409
2737
|
rmSync(opts.journalFile, { force: true });
|
|
2738
|
+
if (codeFile && closing)
|
|
2739
|
+
rmSync(codeFile, { force: true });
|
|
2740
|
+
if (!live?.moved)
|
|
2741
|
+
await overlay.remove(page);
|
|
1410
2742
|
queueMicrotask(() => finish());
|
|
1411
|
-
|
|
2743
|
+
// A run still open ends with no verdict: `autobrowse stop` says so.
|
|
2744
|
+
return { ok: true, ...(history && !history.ended() && !saved ? { verdict: false } : {}) };
|
|
1412
2745
|
}
|
|
1413
2746
|
};
|
|
1414
2747
|
const token = randomBytes(16).toString("hex");
|
|
2748
|
+
// Answers by command id, newest last; the oldest go past SENT_KEEP.
|
|
2749
|
+
const sent = new Map();
|
|
2750
|
+
const remember = (id, p) => {
|
|
2751
|
+
sent.set(id, p);
|
|
2752
|
+
if (sent.size > SENT_KEEP)
|
|
2753
|
+
sent.delete(sent.keys().next().value);
|
|
2754
|
+
};
|
|
2755
|
+
const startedCode = codeVersion();
|
|
2756
|
+
const skewOf = skewWatch(startedCode);
|
|
2757
|
+
/** A reply object gains `skew` once the checkout moved past this session's code. */
|
|
2758
|
+
const withSkew = (body) => {
|
|
2759
|
+
const skew = skewOf();
|
|
2760
|
+
return skew && body.startsWith("{") && body !== "{}"
|
|
2761
|
+
? `${body.slice(0, -1)},${JSON.stringify({ skew }).slice(1)}`
|
|
2762
|
+
: body;
|
|
2763
|
+
};
|
|
1415
2764
|
const server = createServer((req, res) => {
|
|
1416
2765
|
if (req.headers.authorization !== `Bearer ${token}`) {
|
|
1417
2766
|
res.statusCode = 401;
|
|
@@ -1425,8 +2774,11 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1425
2774
|
req.on("end", async () => {
|
|
1426
2775
|
res.setHeader("content-type", "application/json");
|
|
1427
2776
|
let parsed;
|
|
2777
|
+
let id = null;
|
|
1428
2778
|
try {
|
|
1429
|
-
|
|
2779
|
+
const raw = JSON.parse(body || "{}");
|
|
2780
|
+
id = commandId(raw);
|
|
2781
|
+
parsed = commandSchema.parse(raw);
|
|
1430
2782
|
}
|
|
1431
2783
|
catch (err) {
|
|
1432
2784
|
res.statusCode = 400;
|
|
@@ -1437,57 +2789,159 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1437
2789
|
// resend loop); without it the gate answers 202 at once and the same command re-asks.
|
|
1438
2790
|
const wait = new URL(req.url ?? "/", "http://x").searchParams.get("wait") === "1";
|
|
1439
2791
|
const t = now();
|
|
2792
|
+
const by = req.headers["x-claude-session"];
|
|
2793
|
+
const session = typeof by === "string" && /^[\w-]{8,64}$/.test(by) ? by : undefined;
|
|
2794
|
+
// A resend with the same id gets the first answer, never a second act (U6).
|
|
2795
|
+
const first = id ? sent.get(id) : undefined;
|
|
2796
|
+
if (first) {
|
|
2797
|
+
const got = await first;
|
|
2798
|
+
res.statusCode = got.status;
|
|
2799
|
+
res.end(withRepeat(got.body));
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
let settle = () => undefined;
|
|
2803
|
+
if (id)
|
|
2804
|
+
remember(id, new Promise((r) => (settle = r)));
|
|
2805
|
+
const reply = (body) => {
|
|
2806
|
+
settle({ status: res.statusCode, body });
|
|
2807
|
+
// A gate that asked waits on the person: the same command, same id, asks again.
|
|
2808
|
+
if (id && res.statusCode === 202)
|
|
2809
|
+
sent.delete(id);
|
|
2810
|
+
res.end(withSkew(body));
|
|
2811
|
+
};
|
|
1440
2812
|
try {
|
|
1441
2813
|
const answer = await run(parsed, wait);
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
2814
|
+
// page text to the agent: no bidi, zero-width or tag characters
|
|
2815
|
+
const body = JSON.stringify(parsed.cmd === "url" ? answer : leanUrls(answer), cleanStrings);
|
|
2816
|
+
counted(parsed, t, null, body, undefined, session);
|
|
2817
|
+
reply(body);
|
|
1445
2818
|
}
|
|
1446
2819
|
catch (err) {
|
|
1447
2820
|
res.statusCode = err instanceof PaymentGate ? (err.reason === "asked" ? 202 : 403) : 500;
|
|
1448
2821
|
const detail = err instanceof Error ? err.message : String(err);
|
|
1449
|
-
const error =
|
|
2822
|
+
const error = missText(err, "hints" in parsed ? parsed.hints : undefined);
|
|
1450
2823
|
// A target the page lacks as named: the picture of what it has, numbered to act on.
|
|
1451
2824
|
const shot = "hints" in parsed && parsed.hints && missed(err)
|
|
1452
2825
|
? await run({ cmd: "marks" }).catch(() => null)
|
|
1453
2826
|
: null;
|
|
2827
|
+
const e = errorOf(err);
|
|
2828
|
+
// a failed command still carries the person's notes: else they wait for a success
|
|
2829
|
+
const notes = overlay.takeNotes();
|
|
2830
|
+
// The browser went mid-act: the click or submit may have landed.
|
|
2831
|
+
const outcome = e.outcome ?? (LOOKS.has(parsed.cmd) && browserGone(err) ? "unknown" : null);
|
|
1454
2832
|
const body = JSON.stringify({
|
|
1455
2833
|
error,
|
|
2834
|
+
code: e.code,
|
|
2835
|
+
retryable: e.retryable,
|
|
2836
|
+
...(outcome ? { outcome } : {}),
|
|
2837
|
+
...(notes.length ? { notes } : {}),
|
|
1456
2838
|
url: shortUrl(page.url()),
|
|
1457
2839
|
...(err instanceof PaymentGate ? { gate: err.gate, reason: err.reason } : {}),
|
|
1458
|
-
...(
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
2840
|
+
...(err instanceof AmbiguousTarget
|
|
2841
|
+
? matchesAnswer(err)
|
|
2842
|
+
: shot
|
|
2843
|
+
? {
|
|
2844
|
+
marks: shot,
|
|
2845
|
+
hint: err instanceof StaleMark && "hints" in parsed && parsed.hints?.ref
|
|
2846
|
+
? 'take aria again ({"cmd":"aria"}) for a fresh ref, or act on a mark: "hints":{"mark":n}'
|
|
2847
|
+
: 'act on a mark: "hints":{"mark":n}',
|
|
2848
|
+
}
|
|
2849
|
+
: e.code !== "failed"
|
|
2850
|
+
? { hint: e.hint }
|
|
2851
|
+
: {}),
|
|
2852
|
+
}, cleanStrings);
|
|
2853
|
+
counted(parsed, t, error ?? "", body, detail, session);
|
|
2854
|
+
reply(body);
|
|
1462
2855
|
}
|
|
1463
2856
|
});
|
|
1464
2857
|
});
|
|
1465
|
-
await new Promise((resolve) =>
|
|
2858
|
+
await new Promise((resolve, reject) => {
|
|
2859
|
+
server.once("error", reject); // a taken port fails the start, never hangs
|
|
2860
|
+
server.listen(opts.port, "127.0.0.1", () => {
|
|
2861
|
+
server.off("error", reject);
|
|
2862
|
+
resolve();
|
|
2863
|
+
});
|
|
2864
|
+
});
|
|
2865
|
+
const port = server.address().port; // opts.port 0: the OS picks
|
|
1466
2866
|
if (opts.tokenFile) {
|
|
1467
2867
|
mkdirSync(dirname(opts.tokenFile), { recursive: true, mode: 0o700 });
|
|
1468
2868
|
writeFileSync(opts.tokenFile, token, { mode: 0o600 });
|
|
2869
|
+
releasePort(port, dirname(opts.tokenFile)); // listening now: the OS holds the port
|
|
1469
2870
|
}
|
|
1470
2871
|
const idleMs = (opts.idleMinutes ?? DEFAULT_IDLE_MINUTES) * 60_000;
|
|
2872
|
+
let info = null;
|
|
1471
2873
|
if (infoFile) {
|
|
1472
2874
|
// No secret in it: who serves this port, for `autobrowse browsers`. Never idle-closed = held.
|
|
1473
|
-
|
|
1474
|
-
port
|
|
2875
|
+
info = {
|
|
2876
|
+
port,
|
|
1475
2877
|
pid: process.pid,
|
|
1476
2878
|
site: opts.site,
|
|
1477
2879
|
driver: opts.driver ?? "console",
|
|
1478
2880
|
held: idleMs === 0,
|
|
1479
2881
|
startedAt,
|
|
2882
|
+
...(opts.owner?.session ? { session: opts.owner.session } : {}),
|
|
2883
|
+
version: startedCode,
|
|
1480
2884
|
};
|
|
1481
2885
|
writeFileSync(infoFile, JSON.stringify(info), { mode: 0o600 });
|
|
1482
2886
|
}
|
|
1483
|
-
|
|
2887
|
+
if (opts.allowHosts) {
|
|
2888
|
+
const held = await fenceNavigations(page.context(), opts.allowHosts, {
|
|
2889
|
+
hops: hopsOf(opts),
|
|
2890
|
+
onLanded: (url) => {
|
|
2891
|
+
landings++;
|
|
2892
|
+
journal({
|
|
2893
|
+
kind: "note",
|
|
2894
|
+
text: `left this session's sites: ${URL.canParse(url) ? new URL(url).hostname : url} loaded, then blanked`,
|
|
2895
|
+
});
|
|
2896
|
+
},
|
|
2897
|
+
});
|
|
2898
|
+
console.error(held === "cdp"
|
|
2899
|
+
? "nav fence: every top-frame request off the sites stops unsent"
|
|
2900
|
+
: "nav fence: by route (no CDP); a redirect hop that gets past it is blanked, its answer dropped");
|
|
2901
|
+
}
|
|
2902
|
+
// Bring back: the person's tabs, opened before the step-tab watch, so never closed as one
|
|
2903
|
+
for (const url of opts.tabs ?? [])
|
|
2904
|
+
void page
|
|
2905
|
+
.context()
|
|
2906
|
+
.newPage()
|
|
2907
|
+
.then((p) => p.goto(url))
|
|
2908
|
+
.catch(() => undefined);
|
|
2909
|
+
const back = live && opts.bringBack ? opts.bringBack : null;
|
|
2910
|
+
if (live && back)
|
|
2911
|
+
live.onBack(() => back.start());
|
|
2912
|
+
page.context().on("close", () => {
|
|
2913
|
+
// ⌘⇧O with Bring back: the person's Chrome has the profile; this server waits for Bring back
|
|
2914
|
+
if (live?.moved && back && live.profileDir) {
|
|
2915
|
+
journal({ kind: "note", text: "moved to a Chrome window" });
|
|
2916
|
+
if (infoFile && info) {
|
|
2917
|
+
info.moved = { profileDir: live.profileDir, urls: [...live.movedUrls], argv: back.argv };
|
|
2918
|
+
writeFileSync(infoFile, JSON.stringify(info), { mode: 0o600 });
|
|
2919
|
+
}
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2922
|
+
finish();
|
|
2923
|
+
});
|
|
1484
2924
|
// A page load is a person (or a popup) still at work.
|
|
1485
|
-
page.context().on("page", (p) =>
|
|
2925
|
+
page.context().on("page", (p) => {
|
|
2926
|
+
p.on("framenavigated", touch);
|
|
2927
|
+
if (byHand())
|
|
2928
|
+
return;
|
|
2929
|
+
stepTabs.add(p);
|
|
2930
|
+
p.once("close", () => stepTabs.delete(p));
|
|
2931
|
+
});
|
|
1486
2932
|
fp.page.on("framenavigated", touch);
|
|
1487
2933
|
const idleCheck = idleMs > 0
|
|
1488
2934
|
? setInterval(() => {
|
|
1489
|
-
|
|
2935
|
+
const paused = steer.paused();
|
|
2936
|
+
const gone = !paused && opts.owner?.alive?.() === false;
|
|
2937
|
+
// in Chrome: the person works there, not through commands
|
|
2938
|
+
const lease = live?.moved
|
|
2939
|
+
? MOVED_IDLE_MS
|
|
2940
|
+
: leaseMs(idleMs, { paused, ownerGone: gone });
|
|
2941
|
+
if (busy === 0 && now() - lastTouch >= lease) {
|
|
1490
2942
|
endedBy = "idle";
|
|
2943
|
+
if (gone)
|
|
2944
|
+
closedWhy = "its Claude session ended";
|
|
1491
2945
|
finish();
|
|
1492
2946
|
}
|
|
1493
2947
|
}, Math.min(60_000, idleMs))
|
|
@@ -1498,11 +2952,15 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1498
2952
|
clearInterval(idleCheck);
|
|
1499
2953
|
try {
|
|
1500
2954
|
writeNet();
|
|
2955
|
+
if (fp.network && !fp.network.personal)
|
|
2956
|
+
rememberCalls(opts.site, fp.network.rows());
|
|
1501
2957
|
}
|
|
1502
2958
|
catch {
|
|
1503
2959
|
// A full disk loses the log, never the close.
|
|
1504
2960
|
}
|
|
1505
2961
|
server.close();
|
|
2962
|
+
// a row kept for Bring back goes
|
|
2963
|
+
await live?.close().catch(() => undefined);
|
|
1506
2964
|
if (opts.tokenFile)
|
|
1507
2965
|
rmSync(opts.tokenFile, { force: true });
|
|
1508
2966
|
if (infoFile)
|
|
@@ -1511,32 +2969,75 @@ async function serve(opts, fp, finishFlow, sessionFiles) {
|
|
|
1511
2969
|
// A person teaching ends by closing the browser: that run did its job too.
|
|
1512
2970
|
const closedAs = saved ? "saved" : opts.driver === "person" ? "achieved" : "closed";
|
|
1513
2971
|
await endRun(endedBy ?? closedAs, closedWhy, !closing).catch(() => undefined);
|
|
2972
|
+
await Promise.all(packs);
|
|
1514
2973
|
finishFlow();
|
|
1515
2974
|
});
|
|
1516
2975
|
openRun();
|
|
1517
2976
|
return {
|
|
1518
|
-
port
|
|
2977
|
+
port,
|
|
1519
2978
|
token,
|
|
1520
2979
|
exec: async (c) => {
|
|
1521
2980
|
const t = now();
|
|
1522
2981
|
try {
|
|
1523
2982
|
const answer = await run(c, true);
|
|
1524
|
-
counted(c, t, null, JSON.stringify(answer ?? null)
|
|
2983
|
+
counted(c, t, null, JSON.stringify(answer ?? null));
|
|
1525
2984
|
return answer;
|
|
1526
2985
|
}
|
|
1527
2986
|
catch (err) {
|
|
1528
2987
|
const detail = err instanceof Error ? err.message : String(err);
|
|
1529
2988
|
const error = detail.split("\n")[0] ?? "";
|
|
1530
|
-
counted(c, t, error, error
|
|
2989
|
+
counted(c, t, error, error, detail);
|
|
1531
2990
|
throw err;
|
|
1532
2991
|
}
|
|
1533
2992
|
},
|
|
1534
|
-
paused:
|
|
1535
|
-
resumed:
|
|
2993
|
+
paused: steer.paused,
|
|
2994
|
+
resumed: steer.resumed,
|
|
1536
2995
|
done: ended,
|
|
1537
2996
|
resumedFrom,
|
|
1538
2997
|
runId: () => (history && !history.ended() ? history.id : null),
|
|
2998
|
+
heldSignIns: async () => {
|
|
2999
|
+
const store = opts.credentials;
|
|
3000
|
+
if (!store)
|
|
3001
|
+
return [];
|
|
3002
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
3003
|
+
const out = [];
|
|
3004
|
+
for (const h of signIns.parked())
|
|
3005
|
+
if (h.username)
|
|
3006
|
+
out.push(await planKeep(store, siteFor(h.host), { ...h, username: h.username }, today));
|
|
3007
|
+
return out;
|
|
3008
|
+
},
|
|
3009
|
+
keepSignIn: async (name) => {
|
|
3010
|
+
const store = opts.credentials;
|
|
3011
|
+
if (!store)
|
|
3012
|
+
return false;
|
|
3013
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
3014
|
+
for (const h of signIns.parked()) {
|
|
3015
|
+
if (!h.username)
|
|
3016
|
+
continue;
|
|
3017
|
+
const held = { ...h, username: h.username };
|
|
3018
|
+
const plan = await planKeep(store, siteFor(h.host), held, today);
|
|
3019
|
+
if (plan.name !== name)
|
|
3020
|
+
continue;
|
|
3021
|
+
await applyKeep(store, plan, held);
|
|
3022
|
+
signIns.unpark(h.host);
|
|
3023
|
+
return true;
|
|
3024
|
+
}
|
|
3025
|
+
return false;
|
|
3026
|
+
},
|
|
1539
3027
|
files: sessionFiles.map(fileLine),
|
|
1540
3028
|
};
|
|
1541
3029
|
}
|
|
3030
|
+
/** One page: same origin, path (a trailing slash aside) and query; the hash is ignored. */
|
|
3031
|
+
export function samePage(a, b) {
|
|
3032
|
+
const key = (u) => {
|
|
3033
|
+
try {
|
|
3034
|
+
const x = new URL(u);
|
|
3035
|
+
return `${x.origin}${x.pathname.replace(/\/+$/, "")}${x.search}`;
|
|
3036
|
+
}
|
|
3037
|
+
catch {
|
|
3038
|
+
return u;
|
|
3039
|
+
}
|
|
3040
|
+
};
|
|
3041
|
+
return key(a) === key(b);
|
|
3042
|
+
}
|
|
1542
3043
|
//# sourceMappingURL=server.js.map
|