Files
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

44 lines
1.6 KiB
Go

package runtimeprep
import (
"os"
"strings"
)
// Browser use is delivered to agents through the daemon-owned `tutti browser`
// CLI (a chrome-devtools-mcp the daemon drives), not through per-provider MCP
// injection. The sidecar's only job here is to advertise, per session, whether
// browser use is enabled — the agent runtime surfaces the `browserUse`
// capability from this marker, and the browser-use skill is injected when set.
const (
// browserUseSwitchEnv is the operator-facing master switch read from the
// tuttid process environment. Browser use is on by default; set to a falsy
// value ("0"/"false"/"off"/"no") to disable it for all sessions.
browserUseSwitchEnv = "TUTTI_BROWSER_USE"
// browserUseEnabledSessionEnv is the per-session marker consumed by the
// agent runtime (packages/agent/daemon/runtime/browser_capability.go).
browserUseEnabledSessionEnv = "TUTTI_BROWSER_USE_ENABLED"
)
// browserUseEnv returns the per-session env advertising browser use, or nil when
// it is disabled (by the per-session toggle or the operator master switch).
func browserUseEnv(sessionEnabled bool) []string {
if !sessionEnabled || !BrowserUseDefaultEnabled() {
return nil
}
return []string{browserUseEnabledSessionEnv + "=1"}
}
// BrowserUseDefaultEnabled reports whether browser use is on. Defaults to true;
// only an explicit falsy value disables it. Used by the composer (to advertise
// the capability) and by CLI/skill gating.
func BrowserUseDefaultEnabled() bool {
switch strings.ToLower(strings.TrimSpace(os.Getenv(browserUseSwitchEnv))) {
case "0", "false", "off", "no":
return false
default:
return true
}
}