跪拜 Guibai
← All articles
JavaScript · Chrome · Browser

Free APIs Are Everywhere, So Why Build a Web-AI File Agent?

By afumu ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Web UIs are the only LLM gateway in locked-down networks and during quota outages, but DOM-based automation is fragile enough to break silently on any redesign. This project shows the workaround exists and exactly where its limits are.

Summary

afumu's Chrome extension turns a browser chat page into an agent that can call local tools: it watches the DOM for specific CSS classes, catches the model's XML output, forwards tool calls to a local server, and feeds results back. The author concedes the tool is useless for anyone with a working API key, needs stability, runs on servers, or builds a product. Most developers should ignore it.

The remaining use cases are narrow but real. In air-gapped environments where the only LLM entry point is a web page, the extension is the only way to reach a model. When free API quotas go down exactly when needed, a 60%-reliable fallback beats nothing. And for debugging or teaching, watching each tool call render in the browser makes agent internals visible in a way a JSON response never does.

The trade-offs are structural: each tool call takes seconds because of DOM rendering and debounce delays, the model's output is fragile because it's steered by a prompt instead of a function-calling schema, and command safety relies on a blacklist that can be bypassed with a whitespace trick. The author plans to cut the observer delay and replace the blacklist with real parsing, but he's clear the project is not a security product.

Takeaways
— The extension listens only on 127.0.0.1, requires a 64-character hexadecimal token, and runs commands in a sandboxed working directory.
— The DOM observer waits 800ms of silence before capturing output, and can wait up to 3 seconds per tool call.
— The model is steered with a prompt to output XML because web chat UIs expose no function-calling schema.
— A string blacklist blocks rm -rf, rm -fr, sudo, and mkfs, but variants like rm -r -f get through.
— Three real use cases exist: intranets with no external API, free quotas that fail exactly when needed, and debugging or teaching agent loops.
— Planned changes include lowering the observer delay and replacing the command blacklist with proper command parsing.
— The author explicitly states the extension is not a security product.
Conclusions

The author's candid admission that the project is 'a toy' sets accurate expectations, which is more useful than marketing copy for anyone tempted to rely on it.

A fallback that works 60% of the time can be genuinely valuable when the 100% option is unavailable at the exact moment you need it.

String blacklists for command safety are inherently bypassable; switching to command parsing is the only meaningful hardening step.

From the discussion
Featured comments
afumu

Not many people have actually used this, I'll keep this one on file. The biggest trap with this version is that after the site's redesign the extension silently stops working—returns not a single byte, and nothing shows up in the logs. If you hit it, don't doubt your own hands.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗