Commit Graph
4 Commits
Author SHA1 Message Date
yetone 1e654d8ce7 agent: T3 Code keeps the name, auto-compact and other settings the user gave magpie's provider across a restart (#2030, Kanscape)
T3 Code's sync wrote providerInstances.magpie whole on every start, so
what the user changed on it in T3 Code (Display Name, Auto-compact
after, its switch, colour, launch args, an env var of their own) went
back to magpie's defaults when magpie restarted or updated.

Sync and the field setter now merge into what is there (t3Merged):
magpie's own parts are written as before (driver, customModels, the
gateway's ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN and the review
switch), every other key under the instance and its config is the
user's and kept (mergeTheirs), a non-empty displayName and the enabled
switch are theirs, and the environment list keeps the user's own
variables beside magpie's. T3's own claudeAgent instance is never
touched, so it and magpie's keep their settings apart.

Run:
- TestT3CodeKeepsTheUsersSettings: T3's claudeAgent instance beside
  magpie's; the user edits magpie's (name, enabled, accentColor,
  autoCompactWindow "300000", launchArgs, a stale model, a changed base
  URL, an added HTTPS_PROXY), then three syncs. Against the old
  t3code.go it fails on the name, the switch, the colour, the config
  and the env.
- go test -tags nogui ./internal/agent (whole package, ok, 1555s on
  4c746ab39; T3 tests again after rebasing on 27956002c), gofmt -l,
  go vet darwin, GOOS=linux -tags nogui, GOOS=windows.

Not tried: the real T3 Code app (not installed here); the instance
layout follows T3's settings schema from its source. A binaryPath or
homePath carried over from T3's own Claude instance stays once T3
drops it; a value the user gives magpie's review variable is put back.
2026-10-14 05:28:39 +08:00
yetone 0a10be9cf9 agents: T3 Code gets a Thinking switch beside Reasoning for magpie's models (owner: T3 的 thinking 开关也加上吧) — each magpie custom model that thinks at some level (an effort other than none) now carries T3's boolean "thinking" option descriptor, on at first, as T3's own Claude Haiku has it. T3's Claude adapter sets Claude Code's alwaysThinkingEnabled from it, and Claude Code's requests with thinking off reach the gateway with none (thinking.disabled for non-Anthropic models), so the switch turns reasoning off. A model with Claude Code levels keeps its Reasoning pick, and Haiku-like ones get the switch alone. TestT3CodeEfforts covers it; t3Format accepts boolean descriptors. Not tried in a running T3 Code. 2026-10-03 11:58:14 +08:00
yetone 12cc2089e4 agents: each magpie model in T3 Code has a Reasoning pick of the levels it takes (KevinXC on Discord: 加进去的那些模型没有任何 reason 和 thinking 的设置,导致现在所有的模型都默认是 medium) — magpie's custom models in T3 Code's magpie instance were a slug and a name, and T3 shows a custom model with no capabilities with no options and sends Claude Code no effort. T3 Code's custom model entry takes capabilities.optionDescriptors (packages/contracts model.ts CustomModelEntry), which replace the driver's default in its picker, and its Claude adapter hands the effort chosen to the Agent SDK as it is for a custom model (no effortMap), which Claude Code sends to the gateway. Each model now gets an "effort" select labelled Reasoning, as T3's own Claude models have it, of the levels it takes that Claude Code can send (low, medium, high, xhigh, max, within claudeEffortsFor for Claude's own models), medium chosen first, else the lowest; a model with none (or only none/minimal) gets no pick. TestT3CodeEfforts is new, and t3Format now decodes a custom model's capabilities strictly as T3's schema has them (one default per select). Not run against a live T3 Code. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-03 01:47:42 +08:00
yetone ff36a2994f agents: T3 Code gets magpie as a provider of its own, every magpie model in it (KevinXC on Discord: T3 Code's Settings → Providers lists Codex, Claude, Cursor… each with "Add custom model"; magpie's models should be there without adding them one by one) — T3 Code (pingdotgg/t3code) keeps its settings in ~/.t3/userdata/settings.json ($T3CODE_HOME/userdata), sparse JSON its server watches and reloads on an outside edit, and besides its built-in providers takes provider instances of one's own: {"providerInstances":{"<id>":{"driver","displayName","enabled","environment":[{name,value,sensitive}],"config":{"customModels":[{slug,name}]}}}}. A claudeAgent instance runs Claude Code (the Agent SDK, ~/.claude settings read as Claude Code reads them) with its environment added, and sends a custom model's slug as Claude Code's model. The new t3code agent (t3code.go) adds the instance "magpie": driver claudeAgent, displayName magpie, ANTHROPIC_BASE_URL the gateway and ANTHROPIC_AUTH_TOKEN the token Claude Code is routed with (so its requests are Claude Code's to the gateway, haiku tier and all), not sensitive so T3 keeps them in the file rather than its secret store, and every magpie model shown to T3 Code as a custom model, a 1M one marked [1m] as for Claude Code (claude1MFor). The binary path and Claude home the user gave T3's own Claude (its instance, else the legacy providers.claudeAgent) are carried over. It is magpie's alone: the user's instances, their custom models and T3's other keys stay, off takes only it out, and the catalog sync rewrites it only where it is. T3's Codex lists Codex's model/list, which is magpie's catalog once Codex is routed through magpie, so it needs nothing; T3's own Claude asks for Claude's models by their full ids, which the gateway already sends to Claude Code's tiers (claudeTierStandIn). Found by ~/.t3 or, on a Mac, T3 Code (Alpha).app / T3 Code.app; T3CODE_HOME is in agentenv.Vars. Its icon is T3's mark (assets/prod/logo.svg, MIT), its letters alone so it draws as a mask; the option's note has its Chinese. Checked against T3 Code's own schema (effect 4.0.0-rc.115, packages/contracts at 54084ae1): the file magpie writes decodes as ServerSettings, magpie's config as ClaudeSettings, and encodes back to the same instance. Not run against a live T3 Code. TestT3CodeInstance (the user's instance, legacy Claude binary path and T3's key kept through on, sync and off; magpie's instance decoded strictly; found only with ~/.t3; among All()), TestT3CodeHomeAndInstance ($T3CODE_HOME, a file made, the Claude home carried from the user's claudeAgent instance) and TestStateListsT3Code are new. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-03 00:15:53 +08:00