Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(computer): search with teamhub web when the model runs on the gateway

LeoXing45d26a331261
diff --git a/apps/computer/local-daemon/README.md b/apps/computer/local-daemon/README.md
index 27cc51ec..3c2b075f 100644
--- a/apps/computer/local-daemon/README.md
+++ b/apps/computer/local-daemon/README.md
@@ -503,9 +503,19 @@ On macOS, `click` takes `delivery_mode: "foreground"` and `action`: the first fo
The macOS and Linux developer instructions identify the public entry. Codex
0.163.0 and later calls the public tools directly, outside code mode and
deferred tool search. Earlier versions use their standard tool discovery.
-Claude Code defers its own `WebSearch` and `WebFetch` behind `ToolSearch`, so
-every Claude Operation's developer instructions also name them and how to load
-them; Codex's `web_search` is not deferred and gets no such line.
+Web tools depend on where the Runtime's model is served. On a subscription,
+Claude Code keeps `WebSearch` and `WebFetch`, deferred behind `ToolSearch`, so
+its developer instructions name them and how to load them; Codex keeps its own
+`web_search`. Both are also told that `teamhub web search` and `teamhub web open`
+search and read through the search providers the user set up. A Runtime whose
+profile is a localmodels-managed gateway profile (local models or BYOK, see
+`localmodels.GatewayRuntime`) cannot run provider-hosted search: Codex launches
+with `web_search="disabled"` after every user override, Claude's `--tools` leaves
+out `WebSearch` and `WebFetch`, and the instructions name only `teamhub web
+search`, `open` and `list`. Pi has no web tools of its own and always gets that
+`teamhub web` line. Without a TeamHub CLI for the Agent, only Claude's own tools
+are named. A parked Codex process launched with the other web setting is not
+reused.
On macOS these tools show only the fields the Computer routes. They hide Cua's `scope` and `capture_id`; only `click` takes `delivery_mode`, as described above.
Within `ui_exec`, scripts can call individual input methods. An input to a
diff --git a/apps/computer/local-daemon/cmd/linger-computer-daemon/main.go b/apps/computer/local-daemon/cmd/linger-computer-daemon/main.go
index 2ae8c994..7f9ab605 100644
--- a/apps/computer/local-daemon/cmd/linger-computer-daemon/main.go
+++ b/apps/computer/local-daemon/cmd/linger-computer-daemon/main.go
@@ -203,7 +203,7 @@ func run(args []string) (resultErr error) {
if err != nil {
return err
}
- providers, runtimes := providerInstallations(discovered, providerEnvironment)
+ providers, runtimes := providerInstallations(discovered, providerEnvironment, localModelsStateDir)
providerCatalog := lingercontext.NewProviderCatalog(providers)
workspaceGrants := make(map[string]lingercontext.WorkspaceGrant)
wireGrants := make([]map[string]any, 0, len(computer.WorkspaceGrants))
@@ -351,7 +351,7 @@ func run(args []string) (resultErr error) {
defer localModels.Close()
applyDiscovered := func(publishCtx context.Context, next provider.DiscoveryResult) error {
logRuntimeDiagnostics(next.Diagnostics)
- nextProviders, nextRuntimes := providerInstallations(next, currentProviderEnvironment())
+ nextProviders, nextRuntimes := providerInstallations(next, currentProviderEnvironment(), localModelsStateDir)
providerCatalog.Replace(nextProviders)
if controller != nil {
controller.UpdateDiagnostics(next.Diagnostics)
@@ -728,7 +728,7 @@ func runtimeObservations(computer computerconfig.Config, diagnostics []provider.
return result
}
-func providerInstallations(discovered provider.DiscoveryResult, environment map[string]string) (map[string]lingercontext.ProviderInstallation, []string) {
+func providerInstallations(discovered provider.DiscoveryResult, environment map[string]string, localModelsStateDir string) (map[string]lingercontext.ProviderInstallation, []string) {
providers := make(map[string]lingercontext.ProviderInstallation, len(discovered.Installations))
runtimes := make([]string, 0, len(discovered.Installations))
for runtimeType, diagnostic := range discovered.Installations {
@@ -748,6 +748,7 @@ func providerInstallations(discovered provider.DiscoveryResult, environment map[
providers[runtimeType] = lingercontext.ProviderInstallation{
Type: runtimeType, ExecutablePath: diagnostic.ExecutablePath, EntryPath: diagnostic.EntryPath,
Environment: runtimeEnvironment, Version: diagnostic.Version, ContextWindows: contextWindows,
+ ModelGateway: localmodels.GatewayRuntime(environment, localModelsStateDir, runtimeType),
}
runtimes = append(runtimes, runtimeType)
}
diff --git a/apps/computer/local-daemon/cmd/linger-computer-daemon/main_test.go b/apps/computer/local-daemon/cmd/linger-computer-daemon/main_test.go
index 89626588..c3bf9eb6 100644
--- a/apps/computer/local-daemon/cmd/linger-computer-daemon/main_test.go
+++ b/apps/computer/local-daemon/cmd/linger-computer-daemon/main_test.go
@@ -219,7 +219,7 @@ func TestBoundComputerServiceCommandCannotSelectAnotherConfig(t *testing.T) {
func TestProviderInstallationsPreserveTerminalExecutionPath(t *testing.T) {
environment := map[string]string{"PATH": "daemon-path", "HOME": "/home/user"}
discovered := provider.DiscoveryResult{Installations: map[string]provider.RuntimeDiagnostic{"pi": {Type: "pi", ExecutablePath: "/mise/pi", EntryPath: "/mise/latest/pi", ExecutionPath: "terminal-node:daemon-path"}}}
- installations, _ := providerInstallations(discovered, environment)
+ installations, _ := providerInstallations(discovered, environment, "")
if installations["pi"].Environment["PATH"] != "terminal-node:daemon-path" || environment["PATH"] != "daemon-path" {
t.Fatalf("terminal execution environment was lost or caller mutated: %+v", installations["pi"])
}
@@ -230,7 +230,7 @@ func TestProviderInstallationsKeepDiscoveredContextWindows(t *testing.T) {
Type: "codex", ExecutablePath: "/bin/codex",
Models: []provider.RuntimeModel{{ID: "local", ContextWindow: 64896}, {ID: "unknown"}},
}}}
- installations, _ := providerInstallations(discovered, nil)
+ installations, _ := providerInstallations(discovered, nil, "")
if windows := installations["codex"].ContextWindows; len(windows) != 1 || windows["local"] != 64896 {
t.Fatalf("context windows = %v", windows)
}
diff --git a/apps/computer/local-daemon/internal/linger/context/resolver.go b/apps/computer/local-daemon/internal/linger/context/resolver.go
index 98ac9e29..44481136 100644
--- a/apps/computer/local-daemon/internal/linger/context/resolver.go
+++ b/apps/computer/local-daemon/internal/linger/context/resolver.go
@@ -27,6 +27,11 @@ type ProviderInstallation struct {
// ContextWindows maps a model ID to its discovered context length in
// tokens.
ContextWindows map[string]int
+ // ModelGateway marks a Runtime whose model is served through the
+ // localmodels gateway (local models or BYOK). Those models have no
+ // provider-hosted web search, so the Runtime's own web tools stay off and
+ // the Agent searches with the TeamHub CLI.
+ ModelGateway bool
}
type WorkspaceGrant struct {
@@ -48,6 +53,31 @@ type RegistrationBinding struct {
// does not think to search the web, as with the Computer tools in ToolGuide.
const claudeWebToolGuide = `Web tools: WebSearch searches the web and WebFetch reads one page. They are loaded on demand: before the first call, load them with ToolSearch (query "select:WebSearch,WebFetch").`
+// teamHubWebSupplement follows a subscription Runtime's own web tools.
+const teamHubWebSupplement = "`teamhub web search <query>` and `teamhub web open <url>` also search the web and read pages, through the search providers the user set up."
+
+// teamHubWebToolGuide is the only web access of Pi and of a Runtime on local
+// models or BYOK.
+const teamHubWebToolGuide = "Web tools: search the web with `teamhub web search <query>` and read one page as Markdown with `teamhub web open <url>`; `teamhub web list` shows the search backends and which are ready. Run `teamhub web search --help` for filters."
+
+// webToolGuide describes the web tools an Operation has. Without the TeamHub
+// CLI only Claude's own tools are named.
+func webToolGuide(runtimeType string, modelGateway, teamHubCLI bool) string {
+ native := !modelGateway && (runtimeType == "claude" || runtimeType == "codex")
+ switch {
+ case !teamHubCLI && native && runtimeType == "claude":
+ return claudeWebToolGuide
+ case !teamHubCLI:
+ return ""
+ case native && runtimeType == "claude":
+ return claudeWebToolGuide + " " + teamHubWebSupplement
+ case native:
+ return "Web tools: besides your built-in web search, " + teamHubWebSupplement
+ default:
+ return teamHubWebToolGuide
+ }
+}
+
type ExecutionResolver struct {
// Bound by the local launcher; never accepted from a wire request.
ServiceCommand []string
@@ -144,8 +174,13 @@ func (r ExecutionResolver) Resolve(ctx context.Context, command protocol.Command
if r.ToolGuide != "" {
developerInstructions = strings.TrimSpace(developerInstructions + "\n\n" + r.ToolGuide)
}
- if command.RuntimeType == "claude" {
- developerInstructions = strings.TrimSpace(developerInstructions + "\n\n" + claudeWebToolGuide)
+ cliInstalled, err := r.cliCredentialInstalled(command.TenantID, command.AgentID)
+ if err != nil {
+ return provider.OperationSpec{}, err
+ }
+ webGuide := webToolGuide(command.RuntimeType, installation.ModelGateway, cliInstalled && r.TeamHubCLIBin != "")
+ if webGuide != "" {
+ developerInstructions = strings.TrimSpace(developerInstructions + "\n\n" + webGuide)
}
systemPrompt := strings.TrimSpace(strings.Join([]string{
instructionValue(request.SessionOptions.BaseInstructions),
@@ -168,9 +203,10 @@ func (r ExecutionResolver) Resolve(ctx context.Context, command protocol.Command
DeveloperInstructions: request.SessionOptions.DeveloperInstructions,
MCPRelays: append(json.RawMessage(nil), request.RunResources.MCPServers...),
CodexVersion: installation.Version,
+ WithoutNativeWebTools: installation.ModelGateway,
TenantID: command.TenantID, OwnerActorID: binding.OwnerActorID, AgentID: command.AgentID,
}
- if command.HostAccess == "trusted" || r.ToolGuide != "" {
+ if command.HostAccess == "trusted" || r.ToolGuide != "" || webGuide != "" {
spec.DeveloperInstructions = &developerInstructions
}
// The profile path is stable and depends only on the Agent-level credential,
@@ -188,11 +224,7 @@ func (r ExecutionResolver) Resolve(ctx context.Context, command protocol.Command
} else if !errors.Is(err, os.ErrNotExist) {
return provider.OperationSpec{}, errors.New("TeamHub CLI configuration is unavailable")
}
- installed, err := r.cliCredentialInstalled(command.TenantID, command.AgentID)
- if err != nil {
- return provider.OperationSpec{}, err
- }
- if installed {
+ if cliInstalled {
if r.TeamHubCLIBin == "" {
return provider.OperationSpec{}, errors.New("TeamHub CLI configuration or installation is unavailable; upgrade Local Computer")
}
diff --git a/apps/computer/local-daemon/internal/linger/context/resolver_test.go b/apps/computer/local-daemon/internal/linger/context/resolver_test.go
index 40367af2..eaa2908d 100644
--- a/apps/computer/local-daemon/internal/linger/context/resolver_test.go
+++ b/apps/computer/local-daemon/internal/linger/context/resolver_test.go
@@ -297,6 +297,52 @@ func TestExecutionResolverNamesClaudeWebTools(t *testing.T) {
}
}
+func TestWebToolGuideFollowsTheModelSource(t *testing.T) {
+ cases := []struct {
+ runtimeType string
+ gateway, cli bool
+ want, notWant string
+ }{
+ {"claude", false, true, "select:WebSearch,WebFetch", ""},
+ {"claude", false, true, "also search the web", ""},
+ {"codex", false, true, "besides your built-in web search", "select:WebSearch"},
+ {"claude", true, true, "Web tools: search the web with `teamhub web search <query>`", "WebFetch"},
+ {"codex", true, true, "`teamhub web list`", "built-in"},
+ {"pi", false, true, "`teamhub web open <url>`", "built-in"},
+ {"claude", false, false, "select:WebSearch,WebFetch", "teamhub"},
+ }
+ for _, c := range cases {
+ guide := webToolGuide(c.runtimeType, c.gateway, c.cli)
+ if !strings.Contains(guide, c.want) || (c.notWant != "" && strings.Contains(guide, c.notWant)) {
+ t.Fatalf("webToolGuide(%s, gateway=%v, cli=%v) = %q", c.runtimeType, c.gateway, c.cli, guide)
+ }
+ }
+ if webToolGuide("codex", true, false) != "" || webToolGuide("pi", false, false) != "" {
+ t.Fatal("a guide named teamhub without the TeamHub CLI")
+ }
+}
+
+func TestExecutionResolverTurnsOffNativeWebToolsOnTheGateway(t *testing.T) {
+ resolver := ExecutionResolver{
+ Providers: map[string]ProviderInstallation{"claude": {Type: "claude", ExecutablePath: "/local/bin/claude", ModelGateway: true}},
+ WorkspaceGrants: map[string]WorkspaceGrant{"grant-local": {GrantID: "grant-local", TenantID: "tenant-acme", Path: "/local/workspace"}},
+ Views: testContextViews{root: "/local/workspace"},
+ Registrations: map[string]RegistrationBinding{
+ "registration-local": {RegistrationID: "registration-local", TenantID: "tenant-acme", OwnerActorID: "actor-alice", ProviderType: "claude", Status: registration.StatusOnline},
+ },
+ }
+ spec, err := resolver.Resolve(context.Background(), protocol.Command{
+ TenantID: "tenant-acme", RegistrationID: "registration-local", AssignmentRevision: 1,
+ WorkspaceGrantID: "grant-local", RuntimeType: "claude", ContextViewRef: json.RawMessage(`{"receipt_ref":"receipt-1"}`),
+ }, json.RawMessage(`{"kind":"run.start","runtime":{"type":"claude","model":"m"},"session_options":{"base_instructions":"Base","developer_instructions":"Developer"},"session":{"threadId":"thread-1"},"input":{"type":"text","text":"Go"}}`))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !spec.WithoutNativeWebTools || strings.Contains(spec.SystemPrompt, "WebSearch") {
+ t.Fatalf("gateway Claude keeps its web tools: %+v", spec)
+ }
+}
+
func TestBoundServiceGuidanceUsesLocalCommandOnly(t *testing.T) {
command := []string{"/opt/node", "/private install/cli.js", "--config", "/private/current.json"}
text := boundServiceInstructions(command)
diff --git a/apps/computer/local-daemon/internal/localmodels/source.go b/apps/computer/local-daemon/internal/localmodels/source.go
index ab36e826..6887249a 100644
--- a/apps/computer/local-daemon/internal/localmodels/source.go
+++ b/apps/computer/local-daemon/internal/localmodels/source.go
@@ -133,6 +133,19 @@ func isManagedGatewayProfilePath(stateDir, candidate string) bool {
return false
}
+// runtimeProfileKeys names the environment variable that selects each
+// Runtime's profile directory.
+var runtimeProfileKeys = map[string]string{"codex": "CODEX_HOME", "claude": "CLAUDE_CONFIG_DIR", "pi": "PI_CODING_AGENT_DIR"}
+
+// GatewayRuntime reports whether a Runtime with this effective environment
+// reaches its model through the localmodels gateway, serving local models or a
+// BYOK endpoint, rather than its own provider: its profile is one localmodels
+// manages. Such models have no provider-hosted web search.
+func GatewayRuntime(environment map[string]string, stateDir, runtimeType string) bool {
+ key, ok := runtimeProfileKeys[runtimeType]
+ return ok && isManagedGatewayProfilePath(stateDir, environment[key])
+}
+
// OverlayEnvironment computes the effective Runtime discovery/execution
// environment by applying stateDir/model-source.json over base without
// restarting the Daemon.
diff --git a/apps/computer/local-daemon/internal/localmodels/source_test.go b/apps/computer/local-daemon/internal/localmodels/source_test.go
index a8463b3d..2f38ca01 100644
--- a/apps/computer/local-daemon/internal/localmodels/source_test.go
+++ b/apps/computer/local-daemon/internal/localmodels/source_test.go
@@ -328,3 +328,20 @@ func TestModelSourceReportsUnsupportedWhenToolLacksSourceCommand(t *testing.T) {
})
assertUnsupported("ListByokModels", err)
}
+
+func TestGatewayRuntimeFollowsTheManagedProfile(t *testing.T) {
+ state := t.TempDir()
+ byok := map[string]string{
+ "CODEX_HOME": filepath.Join(state, "byok-home", ".codex"),
+ "CLAUDE_CONFIG_DIR": "/home/user/.claude",
+ "PI_CODING_AGENT_DIR": filepath.Join(state, "gateway-home", ".pi", "agent"),
+ }
+ for runtimeType, want := range map[string]bool{"codex": true, "claude": false, "pi": true, "antigravity": false} {
+ if got := GatewayRuntime(byok, state, runtimeType); got != want {
+ t.Fatalf("GatewayRuntime(%s) = %v", runtimeType, got)
+ }
+ }
+ if GatewayRuntime(byok, "", "codex") {
+ t.Fatal("a Computer without localmodels has no gateway Runtime")
+ }
+}
diff --git a/apps/computer/local-daemon/internal/provider/activity_status_test.go b/apps/computer/local-daemon/internal/provider/activity_status_test.go
index 07999ac7..92252e2e 100644
--- a/apps/computer/local-daemon/internal/provider/activity_status_test.go
+++ b/apps/computer/local-daemon/internal/provider/activity_status_test.go
@@ -27,6 +27,8 @@ func TestShellScriptsAreNamedByTheirSteps(t *testing.T) {
{`teamhub agent create --name "GTA6 Story Extractor" --description "Official facts; no leaks." --prompt "You research"`, "tool", []string{"Creating GTA6 Story Extractor"}},
{"teamhub agent create --help", "tool", []string{"Checking TeamHub commands"}},
{"teamhub docs get doc_123 --json", "read", []string{"Reading a document"}},
+ {"teamhub web search 'rust 2026 edition' --limit 5", "search", []string{"Searching the web"}},
+ {"teamhub web open https://example.com/a --output a.md", "read", []string{"Reading a page"}},
{"teamhub docs update doc_123 --file notes.md", "file_change", []string{"Editing a document"}},
{"teamhub task create --title 'Check fares'", "delegation", []string{"Assigning a task"}},
{"teamhub gmail send --to [email protected]", "tool", []string{"Posting in Gmail"}},
diff --git a/apps/computer/local-daemon/internal/provider/command_activity.go b/apps/computer/local-daemon/internal/provider/command_activity.go
index 11165c50..b19bc32c 100644
--- a/apps/computer/local-daemon/internal/provider/command_activity.go
+++ b/apps/computer/local-daemon/internal/provider/command_activity.go
@@ -322,6 +322,10 @@ var teamhubPhrases = map[string]string{
"apps auto-reminders list": "Checking reminders",
"apps auto-reminders set": "Setting reminders",
"knowledge search": "Searching knowledge",
+ "web search": "Searching the web",
+ "web open": "Reading a page",
+ "web list": "Checking web search",
+ "web connect": "Asking for a search key",
"knowledge read": "Reading knowledge",
"tracking-items list": "Checking tracking items",
"tracking-items add": "Adding a tracking item",
@@ -380,7 +384,7 @@ func teamhubStep(args []string) step {
kind = native.ActivityMessageRead
case slices.Contains(path, "search"):
kind = native.ActivitySearch
- case is("knowledge", "wiki", "read"), is("knowledge", "raw", "read"), is("docs", "get"), is("docs", "comment", "get"), is("docs", "image", "get"):
+ case is("knowledge", "wiki", "read"), is("knowledge", "raw", "read"), is("docs", "get"), is("docs", "comment", "get"), is("docs", "image", "get"), is("web", "open"):
kind = native.ActivityRead
case is("docs", "create"), is("docs", "update"), is("docs", "replace"), is("docs", "comment", "reply"), is("docs", "comment", "replace"), is("docs", "image", "put"):
kind = native.ActivityFileChange
diff --git a/apps/computer/local-daemon/internal/provider/executor.go b/apps/computer/local-daemon/internal/provider/executor.go
index 035893e5..b716ffdc 100644
--- a/apps/computer/local-daemon/internal/provider/executor.go
+++ b/apps/computer/local-daemon/internal/provider/executor.go
@@ -78,11 +78,14 @@ type OperationSpec struct {
RegistrationID string
DaemonVersion string
CodexVersion string
- TenantID string
- OwnerActorID string
- AgentID string
- ComputerID string
- ScopeID string
+ // WithoutNativeWebTools turns off the Runtime's own web search and page
+ // fetch, which a model served through the localmodels gateway cannot run.
+ WithoutNativeWebTools bool
+ TenantID string
+ OwnerActorID string
+ AgentID string
+ ComputerID string
+ ScopeID string
// ContextWindow is the selected model's context length in tokens as
// Runtime discovery resolved it; zero when unknown.
ContextWindow int
@@ -565,6 +568,7 @@ func (e Executor) Start(ctx context.Context, spec OperationSpec, emit EmitFunc)
MCPServers: mcpConfig,
Effort: spec.ThinkingLevel,
ContextWindow: spec.ContextWindow,
+ WithoutNativeWebTools: spec.WithoutNativeWebTools,
Title: spec.ThreadName,
AppendPrompt: spec.SystemPrompt,
BaseInstructions: spec.BaseInstructions,
diff --git a/apps/computer/local-daemon/internal/provider/native/claude_policy.go b/apps/computer/local-daemon/internal/provider/native/claude_policy.go
index dd8a690f..1d3ba4b4 100644
--- a/apps/computer/local-daemon/internal/provider/native/claude_policy.go
+++ b/apps/computer/local-daemon/internal/provider/native/claude_policy.go
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"log/slog"
+ "slices"
"strconv"
"strings"
@@ -34,6 +35,20 @@ type ClaudeToolPolicy struct {
// Without it every request carries every MCP tool definition.
var claudeBuiltinTools = []string{"Read", "Glob", "Grep", "Write", "Edit", "Bash", "TodoWrite", "Skill", "Agent", "WebSearch", "WebFetch", "ToolSearch"}
+// claudeWebTools are left out of --tools for a model served through the
+// localmodels gateway, which cannot run Anthropic's server-side web search.
+var claudeWebTools = []string{"WebSearch", "WebFetch"}
+
+// claudeLaunchTools is the --tools list of one launch.
+func claudeLaunchTools(withoutWebTools bool) []string {
+ if !withoutWebTools {
+ return claudeBuiltinTools
+ }
+ return slices.DeleteFunc(slices.Clone(claudeBuiltinTools), func(name string) bool {
+ return slices.Contains(claudeWebTools, name)
+ })
+}
+
const (
claudeInitializeRequestID = "linger-session-restore"
claudeHookCallbackID = "hook_0"
@@ -176,7 +191,7 @@ func claudeBuildArgv(logger *slog.Logger, spec RunSpec) (shaped, launch []string
"-p", "--input-format", "stream-json", "--output-format", "stream-json", "--verbose",
"--permission-mode", "acceptEdits", "--disallowedTools", "AskUserQuestion", "--replay-user-messages",
"--permission-prompt-tool", "stdio",
- "--tools", strings.Join(claudeBuiltinTools, ","),
+ "--tools", strings.Join(claudeLaunchTools(spec.WithoutNativeWebTools), ","),
"--strict-mcp-config",
"--setting-sources", "project,user",
"--managed-settings", claudeManagedSettings(policy),
diff --git a/apps/computer/local-daemon/internal/provider/native/claude_runtime_test.go b/apps/computer/local-daemon/internal/provider/native/claude_runtime_test.go
index 65b134b7..b51f5827 100644
--- a/apps/computer/local-daemon/internal/provider/native/claude_runtime_test.go
+++ b/apps/computer/local-daemon/internal/provider/native/claude_runtime_test.go
@@ -296,6 +296,10 @@ func TestClaudeArgv(t *testing.T) {
if tools := claudeFlagValue(argv, "--tools"); len(tools) != 1 || tools[0] != "Read,Glob,Grep,Write,Edit,Bash,TodoWrite,Skill,Agent,WebSearch,WebFetch,ToolSearch" {
t.Fatalf("tools = %v", tools)
}
+ _, gatewayArgv := claudeBuildArgv(logger, RunSpec{ClaudePolicy: policy, Model: "m", WithoutNativeWebTools: true})
+ if tools := claudeFlagValue(gatewayArgv, "--tools"); len(tools) != 1 || tools[0] != "Read,Glob,Grep,Write,Edit,Bash,TodoWrite,Skill,Agent,ToolSearch" {
+ t.Fatalf("gateway tools = %v", tools)
+ }
var managed, settings map[string]any
_ = json.Unmarshal([]byte(claudeFlagValue(argv, "--managed-settings")[0]), &managed)
_ = json.Unmarshal([]byte(claudeFlagValue(argv, "--settings")[0]), &settings)
diff --git a/apps/computer/local-daemon/internal/provider/native/codex_args.go b/apps/computer/local-daemon/internal/provider/native/codex_args.go
index af40a0c3..f079121b 100644
--- a/apps/computer/local-daemon/internal/provider/native/codex_args.go
+++ b/apps/computer/local-daemon/internal/provider/native/codex_args.go
@@ -95,6 +95,10 @@ func codexExecutionArgs(profile Profile, spec RunSpec, home string, logger *slog
user := NormalizeCodexLaunchArgs(lists[0], lists[1], logger)
launch := append(append([]string{}, profile.CodexConfigArgs...), user...)
args := CodexAppServerArgs(profile.CodexToolVersion, launch...)
+ if spec.WithoutNativeWebTools {
+ // After every user override, which cannot turn it back on.
+ args = append(args, "--config", `web_search="disabled"`)
+ }
if codexSupportsImmediateUnload(profile.CodexToolVersion, home) {
args = append(args, "-c", "thread_unload_delay_secs=0")
}
diff --git a/apps/computer/local-daemon/internal/provider/native/codex_process.go b/apps/computer/local-daemon/internal/provider/native/codex_process.go
index cfb37cd1..abf69a97 100644
--- a/apps/computer/local-daemon/internal/provider/native/codex_process.go
+++ b/apps/computer/local-daemon/internal/provider/native/codex_process.go
@@ -67,9 +67,11 @@ type codexProcess struct {
executable string
version string
configArgs []string
- dir string
- model string
- effort string
+ // withoutWebTools records that web_search was launched disabled.
+ withoutWebTools bool
+ dir string
+ model string
+ effort string
// authPrint and skillPrint are the account and the delivered Skills the
// app-server loaded at launch.
authPrint string
@@ -175,8 +177,9 @@ func codexLaunch(profile Profile, spec RunSpec, executable, home, key string, at
stdout: stdoutR, stderrR: stderrR, release: release,
baseLog: logger,
key: key, home: home, executable: executable, version: profile.CodexToolVersion,
- configArgs: append([]string(nil), profile.CodexConfigArgs...),
- dir: spec.Dir, model: spec.Model, effort: spec.Effort,
+ configArgs: append([]string(nil), profile.CodexConfigArgs...),
+ withoutWebTools: spec.WithoutNativeWebTools,
+ dir: spec.Dir, model: spec.Model, effort: spec.Effort,
authPrint: authPrint, skillPrint: skillPrint,
stdoutDone: make(chan struct{}), waitDone: make(chan struct{}),
front: front,
diff --git a/apps/computer/local-daemon/internal/provider/native/codex_resident.go b/apps/computer/local-daemon/internal/provider/native/codex_resident.go
index 9e6f5320..cc5b9eb5 100644
--- a/apps/computer/local-daemon/internal/provider/native/codex_resident.go
+++ b/apps/computer/local-daemon/internal/provider/native/codex_resident.go
@@ -52,6 +52,7 @@ func codexMismatch(profile Profile, spec RunSpec, executable string) func(*codex
add(p.executable != executable, "exec_path")
add(p.authPrint != codexAuthFingerprint(home), "auth")
add(p.skillPrint != profile.ResidentSkillDigest, "skills")
+ add(p.withoutWebTools != spec.WithoutNativeWebTools, "web_tools")
return fields
}
}
diff --git a/apps/computer/local-daemon/internal/provider/native/codex_units_test.go b/apps/computer/local-daemon/internal/provider/native/codex_units_test.go
index 20461330..66bb2011 100644
--- a/apps/computer/local-daemon/internal/provider/native/codex_units_test.go
+++ b/apps/computer/local-daemon/internal/provider/native/codex_units_test.go
@@ -513,3 +513,20 @@ func TestCodexCleanupExcusedWhenTheProcessHadGone(t *testing.T) {
}
}
}
+
+func TestCodexExecutionArgsDisableWebSearchLast(t *testing.T) {
+ spec := RunSpec{AgentArgs: []string{"-c", `web_search="live"`}}
+ args := codexExecutionArgs(Profile{CodexToolVersion: "0.150.1"}, spec, "/home", slog.New(slog.DiscardHandler))
+ if slices.Contains(args, `web_search="disabled"`) {
+ t.Fatalf("subscription Codex lost web search: %q", args)
+ }
+ spec.WithoutNativeWebTools = true
+ args = codexExecutionArgs(Profile{CodexToolVersion: "0.150.1"}, spec, "/home", slog.New(slog.DiscardHandler))
+ if !slices.Equal(args[len(args)-2:], []string{"--config", `web_search="disabled"`}) {
+ t.Fatalf("gateway Codex keeps web search: %q", args)
+ }
+ process := &codexProcess{withoutWebTools: false}
+ if fields := codexMismatch(Profile{}, spec, "")(process); !slices.Contains(fields, "web_tools") {
+ t.Fatalf("a process with web search served a gateway Operation: %v", fields)
+ }
+}
diff --git a/apps/computer/local-daemon/internal/provider/native/runtime.go b/apps/computer/local-daemon/internal/provider/native/runtime.go
index 3e4e24e1..06738f7a 100644
--- a/apps/computer/local-daemon/internal/provider/native/runtime.go
+++ b/apps/computer/local-daemon/internal/provider/native/runtime.go
@@ -113,6 +113,10 @@ type RunSpec struct {
// ContextWindow is the model's context length in tokens; zero when
// unknown.
ContextWindow int
+ // WithoutNativeWebTools turns off Codex's web_search and Claude's
+ // WebSearch and WebFetch: a model served through the localmodels gateway
+ // cannot run provider-hosted search, and the Agent uses teamhub web.
+ WithoutNativeWebTools bool
// Readiness counts the spawns, sessions and recycles of this Operation.
Readiness *ReadinessCounters
ExposeTurnStarted bool
diff --git a/docs/local-inference.md b/docs/local-inference.md
index 0f0974f3..4bf32360 100644
--- a/docs/local-inference.md
+++ b/docs/local-inference.md
@@ -42,6 +42,16 @@ model, and leaving Local model unloads the local models to free memory. When an
agent is still working, the switch asks first and ends that work only if you
confirm.
+## Web search
+
+On Subscription, Claude Code and Codex keep their own web search. On Local
+model and BYOK the gateway cannot run that provider-hosted search, so the
+computer turns it off and agents search and read pages with `teamhub web search`
+and `teamhub web open`, as Pi always does. Those commands use the web search
+providers set up on the server (Tavily, Brave Search, Firecrawl or You.com,
+whose limited free trial needs no key); pages are read from this computer by
+default. When a provider needs a key, a card in the chat asks for it.
+
## Background Memory and Wiki
Memory facts and reports, Agent Memory, and personal Wiki generation use the