netube99 (X, 2119721422918742222): masking is switched on in Plugins ›
Built-in, set in Settings › Privacy and seen in Insights › Masking, and
none of the three leads to the others. Web search had the same split.
One pattern for every built-in whose switch, settings and page are apart:
- pluginrt.Manifest.SetAt ("privacy #redactList") says where Settings has
its settings: redact, search, gateway and otel set one. builtins.go
sends setAt and page (its nav.page Part).
- Its Built-in row (featGo): "Settings › <tab>" and, while on, its page
("Masking"). No settings link while off when those settings hide with
the plugin (Observability).
- Its settings, while off (featOff): a first row "Off in Plugins ›
Built-in", what being off means, and Turn on. Privacy and Web search
use it; search's own off row went.
- Insights › Masking's head: "Settings › Privacy", unless Turn off
already goes there. At 600px and under its buttons wrap below the title.
- docs/subsystems/plugin-runtime.md documents SetAt.
Proposal for the owner, not built: give each feature one home with its
switch, settings and page together. This commit only links the three.
Core budget: no raise. +~1.9KB of code is paid for by shortening six
app.js comments (logo mask shelf, copy, sidebar, account models,
fitSend, the hold room).
Run on mote at fe672ce69's tree (origin/main 2b22425b4 + these two):
- go vet ./internal/gui ./internal/pluginrt ./plugins/...;
GOOS=linux -tags nogui and GOOS=windows vet of gui and plugins: clean.
gofmt -l: clean.
- go test -run 'TestBuiltin|TestCoreScriptBudget|Translated'
./internal/gui ./internal/pluginrt: ok (budget passes after the cuts).
- node --test builtin-places, websearch-places, builtins, i18n-keys,
i18n-en-no-cjk: 235 pass, 1 fail. The fail is i18n-keys "a plugin's
words are its own" on plugins/usage "View routing", red on origin/main
too (#5332, #5426, #5482).
builtin-places and websearch-places cover en, zh, zh-TW, ja and de in
Chromium and WebKit, at 1100 and 420 wide, nothing past the edge.
Broken by hand: featGo and featOff made to return at once, and 40
builtin-places subtests went red (42 fails with their parents). Round 1's
files reverted made websearch-places 102 of 142 red.
Queued, not waited for (owner: push each verified fix at once): the full
`go test -timeout 45m ./...` then `make test-ui` on mote behind
~/suite.lock; log at
~/workspace/projects/magpie-wt/websearch-surfaces-scratch/full.log. Any
red gets an issue.
Not tried: the real app on Linux/Windows; warm-ups have no SetAt (their
settings moved into the provider editor).
51 lines
1.7 KiB
Go
51 lines
1.7 KiB
Go
// Package search is magpie's web search for a model that can't search by
|
|
// itself: the agent's web_search tool, answered by a provider that can
|
|
// search or a search API set up in Settings. While a search API is set up
|
|
// or a searcher is picked, it stays on.
|
|
//
|
|
// It serves gwtool.WebSearch on the gateway's tool point (P3 of
|
|
// docs/subsystems/plugin-runtime.md). Off, magpie offers and answers no
|
|
// search of its own: the stand-in tool, the search MCP server and Codex's
|
|
// search in ChatGPT's place say there is no searcher, and a vendor that
|
|
// searches by itself still does.
|
|
package search
|
|
|
|
import (
|
|
"github.com/yetone/magpie/internal/gwtool"
|
|
"github.com/yetone/magpie/internal/pluginrt"
|
|
"github.com/yetone/magpie/internal/provider"
|
|
"github.com/yetone/magpie/internal/settings"
|
|
)
|
|
|
|
func init() {
|
|
pluginrt.Register(pluginrt.Manifest{
|
|
ID: "search", API: "^1", Requires: []string{"settings", "gateway"}, Essential: true,
|
|
Name: "Web search", Sub: "Models that can't search the web search with a provider that can, or a search API",
|
|
One: "1 search source set up", Many: "{n} search sources set up",
|
|
InUse: InUse,
|
|
SetAt: "models #searchList",
|
|
Apply: func(c *pluginrt.Ctx) error {
|
|
c.OnDispose(gwtool.Serve(gwtool.WebSearch))
|
|
return nil
|
|
},
|
|
})
|
|
}
|
|
|
|
// InUse counts the search APIs set up, and a searcher picked in Settings
|
|
// (neither magpie's pick nor off); a providers.json or settings that can't
|
|
// be read are not known, so it stays on.
|
|
func InUse() (int, error) {
|
|
n, err := provider.SearchAPIsSet()
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
st, err := settings.LoadChecked()
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
if st.Searcher != "" && st.Searcher != "off" {
|
|
n++
|
|
}
|
|
return n, nil
|
|
}
|