Skip to content

feat: setup asks for Chrome's Allow User Scripts; the model is told when only the switch blocks scripts - #4

Merged
yzhg1983 merged 2 commits into
mainfrom
claude/loving-pasteur-5jlguh
Nov 2, 2026
Merged

yzhg1983 merged 2 commits into
mainfrom
claude/loving-pasteur-5jlguh

Conversation

@yzhg1983

@yzhg1983 yzhg1983 commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Why

Run script defaults to Ask, but Chrome's "Allow User Scripts" switch is off on every new install. Until now pi quietly dropped run_script in that case, and neither the user nor the model knew why. The only hint was a line in Settings > Tools. This PR treats scripts as a core feature and makes the gap visible (design 6.23).

What changes

Setup step

  • The card appears once the provider has a key and site access, while Run script is Ask or On and the switch is off:

    Let pi run scripts on pages
    Scripts let pi pull data out of pages, fill in pages and change them. Turn on "Allow User Scripts" on pi's Chrome details page (scroll down), then come back.
    With Run script on Ask, you review each script before it runs. (only while Ask)
    [Open pi's Chrome details page] [Skip]

  • It does not block the message box.
  • Chrome has no event for the switch, so the panel reads it on focus, when it becomes visible, and every second while the card shows.
  • When the switch turns on, the card closes. "Scripts enabled in Chrome" then shows outside it for 6 s and is announced to screen readers. The next message offers run_script; nothing retries automatically.
  • Skip only ends onboarding. Run script, Settings > Tools and the model hint are unchanged.
  • Only settings.scriptsOnboarded is stored, never the switch. If the switch is already on, the step is marked done without showing. The step never comes back, even if the switch is turned off later.

Model hint

  • run_script stays unoffered while the switch is off.
  • While only the switch blocks it, the instructions add a short note (SCRIPTS_BLOCKED) that names no tool: say so, and where to enable it, only when the task materially needs a script. Nothing changes when Run script is Off.

Settings > Tools

  • The "off" line now says to scroll down on the details page.

Docs

  • docs/page-tools.md: the hint word for word, plus a new "Setup: Allow User Scripts" section.
  • docs/guide.md, both READMEs (Quick start step 4) and PRIVACY.md.

Tests

  • npm test: 615 passed. New unit tests cover the setting's default and that Skip changes nothing else, and that the hint appears only while the switch alone is blocking (not when Run script is Off, not when the switch is on).
  • test:page-tools (61 checks), with new checks for:
    • the hint sent to the model;
    • the card shown, then the switch turned on from the details page, the confirmation appearing and the step saved as done;
    • the card staying closed after the switch is turned off again.
  • test:localization (268 checks), with new checks for the card in English, Skip, and the card staying closed after a restart in Chinese.
  • test:screenshots, test:slash, test:edit, test:attachments and test:selection still pass.

Generated by Claude Code

…hen only the switch blocks scripts

Run script is Ask by default, but Chrome's Allow User Scripts switch is off for every new install, so pi dropped
run_script without the user or the model knowing why (design 6.23).

- Setup: once the provider is ready, while Run script is Ask or On and the switch is off, the chat view shows "Let pi
  run scripts on pages" with "Open pi's Chrome details page" and Skip. It does not block the message box. The panel
  reads the switch on focus, when shown, and every second while the card shows; when it sees the switch on, the card
  closes and "Scripts enabled in Chrome" stays outside it for a few seconds and is announced.
- Skip ends the step only: Run script, Settings > Tools, and the note to the model stay. Only that the step is done is
  saved (settings.scriptsOnboarded), never the switch, so the step does not come back if the switch goes off later.
- Model: while only the switch keeps run_script back, the instructions say why and where to enable it, to mention it
  only when the task materially needs a script. run_script stays unoffered; the note names no tool.
- Settings > Tools: the off line says to scroll down on the details page.
- Docs: page-tools.md (the note, the setup step), guide, READMEs, privacy. Tests: unit tests for the setting and the
  note; e2e for the step shown, turned on with the confirmation, staying closed after the switch goes off, and Skip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jWSj3brZcX45UHmLWfNW4
The setup card for Allow User Scripts showed at the top of the chat view in this suite (provider ready, Run script on
Ask, switch off), pushing the transcript down so "diagrams in view" (a diagram's top 40 to 200 px from the top) could
never hold. The suite measures diagram layout, not setup: it seeds the step as done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jWSj3brZcX45UHmLWfNW4
@yzhg1983
yzhg1983 merged commit f561329 into main Nov 2, 2026
1 check passed
yzhg1983 added a commit that referenced this pull request Nov 2, 2026
…hen only the switch blocks scripts (#4)

* feat: setup asks for Chrome's Allow User Scripts; the model is told when only the switch blocks scripts

Run script is Ask by default, but Chrome's Allow User Scripts switch is off for every new install, so pi dropped
run_script without the user or the model knowing why (design 6.23).

- Setup: once the provider is ready, while Run script is Ask or On and the switch is off, the chat view shows "Let pi
  run scripts on pages" with "Open pi's Chrome details page" and Skip. It does not block the message box. The panel
  reads the switch on focus, when shown, and every second while the card shows; when it sees the switch on, the card
  closes and "Scripts enabled in Chrome" stays outside it for a few seconds and is announced.
- Skip ends the step only: Run script, Settings > Tools, and the note to the model stay. Only that the step is done is
  saved (settings.scriptsOnboarded), never the switch, so the step does not come back if the switch goes off later.
- Model: while only the switch keeps run_script back, the instructions say why and where to enable it, to mention it
  only when the task materially needs a script. run_script stays unoffered; the note names no tool.
- Settings > Tools: the off line says to scroll down on the details page.
- Docs: page-tools.md (the note, the setup step), guide, READMEs, privacy. Tests: unit tests for the setting and the
  note; e2e for the step shown, turned on with the confirmation, staying closed after the switch goes off, and Skip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jWSj3brZcX45UHmLWfNW4

* test: the diagrams suite starts with the Allow User Scripts step done

The setup card for Allow User Scripts showed at the top of the chat view in this suite (provider ready, Run script on
Ask, switch off), pushing the transcript down so "diagrams in view" (a diagram's top 40 to 200 px from the top) could
never hold. The suite measures diagram layout, not setup: it seeds the step as done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jWSj3brZcX45UHmLWfNW4

---------

Co-authored-by: Claude <noreply@anthropic.com>
@yzhg1983
yzhg1983 deleted the claude/loving-pasteur-5jlguh branch November 2, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants