Skip to content

[vite-plugin] Surface Local Explorer API to headless agents, matching wrangler's hint - #14996

Open
nickpatt wants to merge 4 commits into
cloudflare:mainfrom
nickpatt:vite-plugin-agent-hint-match-wrangler
Open

[vite-plugin] Surface Local Explorer API to headless agents, matching wrangler's hint#14996
nickpatt wants to merge 4 commits into
cloudflare:mainfrom
nickpatt:vite-plugin-agent-hint-match-wrangler

Conversation

@nickpatt

@nickpatt nickpatt commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Surfaces the Local Explorer API to headless agents from the Vite plugin, the same way wrangler dev already does.

This is #14912 (thanks @Dario) with the hint text aligned to the one wrangler prints today - the implementation is unchanged, only the message differs.

When a Vite dev or preview server with the Cloudflare plugin is started in a headless AI agent environment, the plugin now prints the Local Explorer API URL and useful resource routes to stdout so agents can discover and call them programmatically.

Also fixes the explorer path in the test: it was /cdn-cgi/explorer, but the route has since moved to /cdn-cgi/local/explorer on main, so the assertion no longer held.

Verified against a real vite dev session - the hint prints as above, and both the curl example and the KV route return data unmodified from the hint.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: undocumented feature for agents

Open in Devin Review

dario-piotrowicz and others added 2 commits August 3, 2026 10:24
Aligns the hint with the one `wrangler dev` already prints: adds the
observability query route (with a runnable example), keeps the OpenAPI schema
last behind a last-resort note so agents reach for the specific routes first, and
uses wrangler's route ordering.

Also updates the explorer path in the test, which moved to /cdn-cgi/local/explorer.
@changeset-bot

changeset-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a603a10

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/vite-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Aug 3, 2026
@workers-devprod
workers-devprod requested review from a team and edmundhung and removed request for a team August 3, 2026 15:30
@workers-devprod

workers-devprod commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14996

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@14996

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14996

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14996

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14996

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14996

miniflare

npm i https://pkg.pr.new/miniflare@14996

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@14996

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14996

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14996

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14996

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14996

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14996

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14996

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14996

wrangler

npm i https://pkg.pr.new/wrangler@14996

commit: a603a10

Comment thread packages/vite-plugin-cloudflare/src/detect-agent.ts Outdated
The wrapper used the library's isAgent(), which reports `hybrid` environments
as agents — so a human in Warp or VS Code would have been treated as a headless
agent, contradicting the wrapper's own doc comment. Check the detected type is
exactly `agent`, as wrangler's wrapper does, and pass an empty processAncestry
so process-tree traversal stays off regardless of the library's default.

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😄

Comment thread packages/vite-plugin-cloudflare/src/plugins/agent-hint.ts

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Aug 3, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread packages/vite-plugin-cloudflare/src/plugins/agent-hint.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

3 participants