Repository navigation
Conversation
…and read pages
Asked about something outside the workspace, the agent had no way to look it up, and the browser edition's
prompt said "There is no network" (the simulated shell's sentence), so it answered that it had no internet.
Modelled on ChatGPT.app, which turns on OpenAI's hosted web_search (docs/WEB-SEARCH.md has the evidence),
but as two ordinary function tools, so every model the agent runs on can use them:
- web_search({queries: 1-4, recency?}): the queries run at the same time; their lists are merged by taking
turns and de-duplicated by address (at most 12 results, each with an excerpt), and the model is told to cite
facts with Markdown links. A query answered in the last ten minutes comes from the cache.
- web_fetch({url, find?}): a page's readable text, or only the passages around `find` (ChatGPT's open_page and
find_in_page). It opens only an address from a search result, a page it opened or the person's own message,
so a page cannot get the model to send data to an address it makes up. On the desktop pages are read from
this machine (webFetchNode.js), never one on a private or local network: checked in the connection's own
DNS lookup, for IP literals before connecting, and again on every redirect. In the browser they are read
through LevelCode Cloud.
Searches go to LevelCode Cloud (POST /ai/web/search, billed in credits, added to the run's cost) whenever the
person is signed in, or to their own Brave Search, Tavily or Exa key on the desktop ("LevelCode: AI: Set Web
Search Key…", SecretStorage). With neither, the tools are not offered and the model is told why and how to
turn search on. Settings levelcode.ai.web.search and levelcode.ai.web.searchProvider, both application-scoped;
the browser manifest drops the own-key command and provider setting, and its build stubs the Node network
modules. In the chat: "Searched the web for … · N results · 0.3 s" with the pages as links under it.
Tested: webSearch.test.js (22), webFetchNode.test.js (4, a real HTTP server on 127.0.0.1),
agentWebSearch.test.js (7, the real runAgent with scripted turns), webChatRows.test.js (3); host,
groupReducer, diagramHost and sessionExpiredHost harnesses follow the new pieces. 21 one-edit mutations each
fail a test. The fixtures use a fictional person and company.
scripts/web-search-editor-check.js runs the dev build with this extension against one local server standing in for the model, Brave Search and two web pages. It sets the Brave key from the command palette as a person would, asks the question the owner compared with ChatGPT.app (with a fictional person), and checks: both tools offered and the web rules in the prompt; Brave asked both queries at the same time with the key; the results and the page read back to the model, the page marked as data; the search row, its count and time and the found pages as links in the chat; the answer's citation as a real link; with web search off, no tools and the reason told to the model; nothing thrown in the chat page. Screenshots of the answer and of the opened activity group. Ran on macOS: 11/11.
…ow, and the owner's decisions The evidence from ChatGPT.app (the engine's hosted web_search modes and fields, the window's labels, and the owner's recorded dialog with its timings: 1.2-1.7 s per search, the rest the model), the design of web_search / web_fetch and the gateway endpoints, the billing hole closed in thin.ly, the same dialog side by side, what was run and what was not (no real search API or real model yet), and five decisions for the owner.
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The agent can search the web and read pages. Before this it had no web tool, and the browser edition's prompt said "There is no network" (the simulated shell's sentence), so a question about anything outside the workspace ended in "I don't have internet or web-search access".
Gateway side: systemu-net/thin.ly#462. Design note with the ChatGPT.app evidence:
docs/WEB-SEARCH.md.How ChatGPT.app does it
/Applications/ChatGPT.app(Codex desktop 26.930.31730) turns on OpenAI's hostedweb_search:WebSearchModesetting is disabled, cached, indexed or live. The hosted tool's fields includeexternal_web_access,filters.allowed_domains,user_locationandsearch_context_size. Its actions aresearch {queries},open_pageandfind_in_page.The time is the model's, not the search's.
What this adds
Two function tools, so every model can use them (
extensions/levelcode-ai/webSearch.js):web_search({queries: 1-4, recency?})web_fetch({url, find?})find.What web_fetch may open:
Where searches go:
Settings and chat:
levelcode.ai.web.searchandlevelcode.ai.web.searchProviderare both application-scoped.Tested (macOS, Node 24)
test/webSearch.test.js(22),webFetchNode.test.js(4, a real HTTP server),agentWebSearch.test.js(7, the realrunAgent) andwebChatRows.test.js(3).scripts/test-extensions.sh: 141 files.scripts/web-search-editor-check.jsruns the dev build with a stand-in model, a stand-in Brave and pages. The key is set from the command palette, the ChatGPT dialog runs end to end (with a fictional person), then search is turned off. 11/11.tsc --checkJsshows no new errors inagent.jsorextension.js.Not run
A real search API or real model with these tools; the browser edition in a tab; Linux. The live comparison with ChatGPT on the same dialog needs a search key, entered by the owner.
Decisions (see the doc)