agent: Grok App keeps its own route; magpie is a custom provider under Accounts, and the Library writes instructions, MCP and skills on agent-home (#1625)
This commit is contained in:
+1
-1
@@ -129,7 +129,7 @@ line; agents connected to magpie lose it when it quits.
|
||||
| Qoder (CLI) | `~/.qoder/settings.json` (`$QODER_CONFIG_DIR`) | model, effort (a `magpie` custom provider; needs a Qoder plan with BYOK) |
|
||||
| Qoder CN (CLI) | `~/.qoder-cn/settings.json` (`$QODERCN_CONFIG_DIR`) | model, effort (as Qoder; its own accounts, a Qoder CN plan with BYOK) |
|
||||
| Grok Build | `~/.grok/config.toml` (`$GROK_HOME`) | model, effort |
|
||||
| Grok App | `agent-home/config.toml` in its data folder (`$GROK_APP_HOME`, else `~/Library/Application Support/com.grokapp.grok-app`, `%APPDATA%\grokapp\grok-app\data`, `$XDG_DATA_HOME/grok-app`, or `~/.grok-app`) | model (a `[model.magpie]` provider channel as the App's Providers page writes one, with magpie's models and their effort levels in `app_models`; `[models] default = "magpie"`, what was there put back on Disconnect; a model or default effort picked in the App kept; effort is picked in the App's composer; MCP servers and skills reach it through Grok Build's row) |
|
||||
| Grok App | `agent-home/config.toml` in its data folder (`$GROK_APP_HOME`, else `~/Library/Application Support/com.grokapp.grok-app`, `%APPDATA%\grokapp\grok-app\data`, `$XDG_DATA_HOME/grok-app`, or `~/.grok-app`) | model (a `[model.magpie]` custom provider under Accounts, with magpie's models and their effort levels in `app_models`; the route, `[models] default`, stays until the user presses Use on magpie there; a route an older magpie set to `magpie` is put back once; Disconnect drops the channel and puts the route back only if it is still `magpie`; a model or default effort picked in the App kept; instructions, MCP and skills are the Library's Grok App row on agent-home; RTK has no hook) |
|
||||
| ZCode | `~/.zcode/v2/config.json` | provider (magpie's models in ZCode's picker) |
|
||||
| WorkBuddy | `~/.workbuddy/models.json` (`$WORKBUDDY_CONFIG_DIR`) | provider (magpie's models in WorkBuddy's picker) |
|
||||
| WorkBuddy AI | `~/.workbuddy-ai/models.json` (the international build) | provider (magpie's models in WorkBuddy AI's picker) |
|
||||
|
||||
@@ -44,7 +44,7 @@ something else shows up as drift.
|
||||
- Ante's `catalog.json` keeps user-added fields in `providers.magpie` the same way (`ante` in [`ante.go`](../../internal/agent/ante.go)); its `auth`, `http_headers`, `extra_body` and `stream_idle_timeout_secs` are what a gateway shared on the local network or reached from WSL needs to send a key. Ante starts a session on the `provider` and `model` of `settings.json`, not on what its catalog holds (#1210), so magpie sets that pair and puts back what it found there; a pick the user makes in Ante while magpie is wired is theirs and stands.
|
||||
- AstrBot keeps its providers in `data/cmd_config.json` under its root (`$ASTRBOT_ROOT`, else `~/.astrbot`, the desktop app's, else `~/astrbot`), written with a UTF-8 BOM, which magpie keeps (`astrbot` in [`astrbot.go`](../../internal/agent/astrbot.go)). magpie adds a `magpie` entry to `provider_sources` and one `magpie/<model>` entry per model to `provider`, keeps the user's own entries byte for byte and keeps what the user changes in magpie's (timeout, proxy, enable), and sets the default chat model (`agent_runner.config.model.provider_id`, or `provider_settings.default_provider_id` before the agent runner), putting back what it found there. A pick the user makes while magpie is wired is theirs and stands. The first connect copies the file to `cmd_config.json.before-magpie`. AstrBot reads the file only at start-up and its WebUI writes it back whole on save, so the agent's notice says to restart AstrBot before saving in the WebUI. A Docker install's root is inside its container, which magpie doesn't reach.
|
||||
- jcode keeps its settings in `config.toml` in `$JCODE_HOME`, else `~/.jcode` (`jcode` in [`jcode.go`](../../internal/agent/jcode.go)). magpie adds a named profile, `[providers.magpie]`, as `jcode provider add` writes one: `type = "openai-compatible"`, the gateway's `/v1`, an inline `api_key` naming jcode (jcode sends nothing else that tells it apart) and `requires_api_key = true`, since jcode sends no key to a loopback URL without it. Its `models` list has one entry per model, with `context_window`, `input` and `reasoning` for a model with effort levels. A `reasoning_effort` the user set on one stays while the model has that level. The model jcode starts on is `[provider] default_provider = "magpie"` and `default_model`. What was there is stashed and put back on Disconnect. A model of jcode's own picked while it is on magpie takes magpie out. Each key is set alone, so the user's other keys and tables stay, and the `[[providers.magpie.models]]` tables jcode writes when it saves the file itself are replaced by the one list. A sync with nothing to change doesn't write. Disconnect drops the profile whole, its sub-tables included. jcode reads the file when it starts, so the notice says to restart open sessions.
|
||||
- Grok App (RongleCat/grok-app, a desktop front end that starts Grok Build over ACP) keeps its provider channels in `agent-home/config.toml` under its data folder: `$GROK_APP_HOME`, else where its `directories` crate puts it, or its `~/.grok-app` fallback when that is the one there (`grokApp` in [`grokapp.go`](../../internal/agent/grokapp.go)). Its composer lists only Grok Build's official catalog, never the `[model."magpie/…"]` tables of Grok Build's row, so magpie adds itself as a channel, `[model.magpie]`, with the keys the App's Providers page writes: the gateway's `/v1`, a key naming Grok App, `api_backend = "chat_completions"`, `app_provider_mode = "generic"`, and `app_models`, a JSON list of magpie's models with `contextWindow`, `supportsVision` and their effort levels (no `none`; a default the user marks in the App stays, else medium). The picked model's `context_window` (a bare integer) and `supports_reasoning_effort` (a bare bool, Grok Build's gate for `--reasoning-effort`) are on the channel, as the App puts them there when a model is picked in its composer. `[models] default = "magpie"` makes it the route; what was there is stashed and put back on Disconnect, which drops the channel. A model picked in the App's composer since is the user's and stays through a sync, and a sync with nothing to change doesn't write. The App switches itself to its independent mode when a channel is the route, so Grok Build then runs with `GROK_HOME` at agent-home; MCP servers still reach it, since the App reads `~/.grok/config.toml`'s `[mcp_servers]` in both modes and hands them to each session, and skills are Grok Build's `~/.agents/skills`. The notice, while the App runs, says to start a new chat or restart it.
|
||||
- Grok App (RongleCat/grok-app, a desktop front end that starts Grok Build over ACP) keeps its provider channels in `agent-home/config.toml` under its data folder: `$GROK_APP_HOME`, else where its `directories` crate puts it, or its `~/.grok-app` fallback when that is the one there (`grokApp` in [`grokapp.go`](../../internal/agent/grokapp.go)). Its composer lists only Grok Build's official catalog, never the `[model."magpie/…"]` tables of Grok Build's row, so magpie adds itself as a channel, `[model.magpie]`, with the keys the App's Providers page writes: the gateway's `/v1`, a key naming Grok App, `api_backend = "chat_completions"`, `app_provider_mode = "generic"`, and `app_models`, a JSON list of magpie's models with `contextWindow`, `supportsVision` and their effort levels (no `none`; a default the user marks in the App stays, else medium). The picked model's `context_window` (a bare integer) and `supports_reasoning_effort` (a bare bool, Grok Build's gate for `--reasoning-effort`) are on the channel, as the App puts them there when a model is picked in its composer. `[models] default` is the route, and magpie does not set it: setting it to `"magpie"` makes the App drop its own sign-in (`ensure_independent_for_custom_route`). The route stays whatever the App had. Pressing Use on magpie under Accounts is what switches it. A magpie that already set the route puts the old one back once, on the next sync or connect (`grokAppReleased`); a Use after that stays. Disconnect drops only the channel, and puts the route back only when it is still `"magpie"`. A model picked in the App's composer since is the user's and stays through a sync, and a sync with nothing to change doesn't write. Shared mode keeps `GROK_HOME` at `~/.grok` (Grok Build's library row). Independent mode, which Use turns on, reads agent-home: the Library writes `AGENTS.md`, `[mcp_servers]` in the same `config.toml`, and `skills/` there, and Grok App also reads `~/.agents/skills`. RTK has no Grok hook, so the Library lists Grok App with the switch off. The notice, while the App runs, says magpie is a custom provider and the App stays on its current route until Use.
|
||||
- JSON/JSONC config edits and their previews reject malformed input rather than editing a partially parsed document. Object edits and VS Code's model-group array edits leave the original file untouched on a parse error; valid comments and trailing commas remain supported (`internal/edit`).
|
||||
- A config that starts with a UTF-8 byte order mark (a Windows `settings.json` or `config.toml` saved by PowerShell, Notepad or a channel switcher, #1534) is read without it (`edit.Read`), and a write keeps it (`keepBOM` in `WriteAtomic`): the user's file keeps the encoding it was saved in. That covers every format `internal/edit` writes (JSON/JSONC and its arrays, TOML, YAML, env); Codex reads a TOML file through a BOM too, so magpie no longer refuses one. A file read some other way trims it with `edit.TrimBOM` (the Claude Code and CC Switch imports). A line an edit takes out of a CRLF file goes with its `\r\n`.
|
||||
- Codex signed in to ChatGPT stays beside its sign-in (`openai_base_url`) unless the user picks magpie API. magpie becomes its provider only while the Codex app holds the active account, which it sends nothing for: `/wham/usage` says it isn't allowed, and it has no credits and isn't a workspace still within its overage (`codexHeld`, read by `provider.CodexUsedUp`). Where the app goes by what usage can't show (an experiment's gate, a reserve, a Team plan's overage under the reserve experiment), it counts as held: a wrong move costs ChatGPT extras, a missed one every turn. A saved reading kept through a failed read stops saying held once its used-up window has started again; a hold with no window used up stays till a fresh read. The app then loses its ChatGPT state (durable threads, remote control), so a window at 100% alone, which credits get past, doesn't move it (`codex.out` marks the move, and Sync undoes it once the account has room).
|
||||
|
||||
@@ -25,7 +25,7 @@ agents RTK, a CLI that cuts shell output down before the model reads it.
|
||||
| Skill updates | A skill from GitHub (`kind: github`, a market install among them) keeps the commit it was fetched at and `Hash`, the hash of its files as fetched. `CheckSkills` asks GitHub for each one's last commit and keeps the result in memory; `View.CheckDue` says none was checked since magpie started, or not for `checkEvery` (12 hours), and the page then checks by itself as the skills open (#1449). `editState` says a skill was changed here when the library's folder no longer hashes to `Hash` (`.DS_Store` aside), or an agent's copy was edited since its mark and not yet taken in; the view's `edited` says so. `UpdateSkill` refuses such a skill with `*EditedError` unless told to replace it (the page's own Update asks first; the CLI takes `--replace-edits`), and `UpdateSkills`/`UpdateSomeSkills` leave it as it is, in `Unupdated`. A replaced version that was changed, or that can't be told (no `Hash`), is moved to the backups (`keepReplaced`). Skills the skills CLI manages (`npx skills`, `~/.agents/.skill-lock.json`) are only grouped: the CLI updates them (`npx skills update`). A linked folder, a skill imported from an agent and a `From`-only skill have no remote to check; one CC Switch installed (`Origin`) can be updated by hand but isn't checked. | [`skill_changed.go`](../../internal/library/skill_changed.go), [`skillcheck.go`](../../internal/library/skillcheck.go), [`skills.go`](../../internal/library/skills.go) |
|
||||
| Hooks | A `Hook` (#1790) is a command, an event, an optional matcher, a timeout and the agents ticked for it. Its event is portable (`HookEvents`: turn-end, after-tool, before-tool, prompt, session-start, each under the agent's own name) or an agent's own (`"codex:PermissionRequest"`), which only that agent is given. A portable tool event can be narrowed to shell or edit tools, each agent's own tool names for them. `syncHooks` writes each into the agent's own file and shape (`hookSpecOf`): Claude Code `<claude dir>/settings.json`, Codex `hooks.json` beside its config.toml, Gemini CLI `~/.gemini/settings.json` (timeout in ms), Cursor `~/.cursor/hooks.json` (flat entries, `version: 1`). Every other agent, and an agent in WSL, is refused with why, and the page greys its chip with that reason. The page also says when an agent has every hook turned off (`hooksOff`: Claude Code's `disableAllHooks`, Gemini's `hooksConfig.enabled`, Codex's `[features] hooks`). | [`hooks.go`](../../internal/library/hooks.go) |
|
||||
| Backups | Before a change first writes an agent file, `backups` copies it to `BackupDir`, one folder per change. The last `keepBackups` (30) changes are kept. The Backups button at the top of every tab, beside Library folder, opens that folder (`libHead`; Dade on Discord found it at the foot of a long page). | [`backup.go`](../../internal/library/backup.go) |
|
||||
| RTK | `SetRTK` runs rtk's own installer (`rtk init -g …`) for an agent being switched on. For one being switched off, it removes exactly what the installer wrote, using magpie's own code, which works even with rtk gone. `ReadRTK` reads each agent's files to say which have the hook. `rtkSpec.blocked` stops the installer where it would break an agent. `rtkSpec.env` tells the installer the agent's folder where rtk would pick another: Hermes Agent's is `appdir.HermesHome` (`%LOCALAPPDATA%\hermes` on Windows), which rtk is given as `HERMES_HOME`, since rtk 0.51 knows only `$HERMES_HOME` and `~/.hermes`. A detected agent RTK has no hook for at all is still listed, from `rtkNoHook`, with the reason and a switch that can't be turned on (dsh: its hooks can allow or deny a command but not rewrite it, and `rtk init` has no `--agent dsh`). | [`rtk.go`](../../internal/library/rtk.go) |
|
||||
| RTK | `SetRTK` runs rtk's own installer (`rtk init -g …`) for an agent being switched on. For one being switched off, it removes exactly what the installer wrote, using magpie's own code, which works even with rtk gone. `ReadRTK` reads each agent's files to say which have the hook. `rtkSpec.blocked` stops the installer where it would break an agent. `rtkSpec.env` tells the installer the agent's folder where rtk would pick another: Hermes Agent's is `appdir.HermesHome` (`%LOCALAPPDATA%\hermes` on Windows), which rtk is given as `HERMES_HOME`, since rtk 0.51 knows only `$HERMES_HOME` and `~/.hermes`. A detected agent RTK has no hook for at all is still listed, from `rtkNoHook`, with the reason and a switch that can't be turned on (dsh: its hooks can allow or deny a command but not rewrite it, and `rtk init` has no `--agent dsh`; Grok App: `rtk init` has no Grok or Grok App agent). | [`rtk.go`](../../internal/library/rtk.go) |
|
||||
|
||||
## Runtime path
|
||||
|
||||
@@ -55,6 +55,7 @@ agents RTK, a CLI that cuts shell output down before the model reads it.
|
||||
- A carried library (`Collect`) has every file of each skill, its templates and other binaries included, up to `maxCarried` (16 MiB) a file and `maxCarriedAll` (32 MiB) in all, chosen smallest first across the skills (`readSkills`), so every skill's text goes before any big file. The total keeps a sealed backup under the 64 MiB a sync reads: the files are base64 twice in it. What is left out is named in `Left`, and `Put` keeps this computer's copy of such a file in the skill it puts (`keepLeft`). [`carry.go`](../../internal/library/carry.go)
|
||||
- WorkBuddy's servers go in `$WORKBUDDY_CONFIG_DIR/mcp.json` (default `~/.workbuddy`; WorkBuddy AI, the international build, keeps its own in `~/.workbuddy-ai`, #1494), and CodeBuddy Code's go in the first of `.mcp.json`, `mcp.json` and `~/.codebuddy.json` that exists, as `resolveMcpFilePath` reads them (#1266). WorkBuddy connects a server only after the user has switched it on once in its own MCP settings. It keeps that approval in `mcp-approvals.json`, keyed by the command, args and env names or the URL's origin, so changing those asks again. magpie never writes the approval, and the servers page says so, by the build's name, when a server is given to WorkBuddy or WorkBuddy AI.
|
||||
- Alma's servers go in `~/.config/alma/mcp.json` on every system (its home, not its data folder), as its own MCP settings write them: `command`/`args`/`env`, or `url`/`headers` with `transport: "sse"` only for SSE (#1292). Alma reads the file as it starts and when its MCP settings refresh, so a server given to it while it runs reaches it after one of those.
|
||||
- Grok App's independent home (Use on a custom provider, `GROK_HOME` at `agent-home` under its data folder) gets instructions in `AGENTS.md`, MCP servers in `[mcp_servers]` of the same `config.toml` magpie's channel is in, and skills in `skills/`, and it also reads `~/.agents/skills`. Shared mode stays on Grok Build's `~/.grok` row. RTK lists Grok App with the switch off: `rtk init` has no Grok agent.
|
||||
- Zed's servers go in `context_servers` of the settings.json magpie sets its model in (`agent.zed`: `~/.config/zed` on macOS, `$XDG_CONFIG_HOME/zed` on Linux, `%APPDATA%\Zed` on Windows, or `$MAGPIE_ZED_CONFIG_DIR`), as `command`/`args`/`env` or `url`/`headers` (`ContextServerSettingsContent`, zed-industries/zed 2c99f547). The file is JSONC: it is edited in place, so the user's comments, other settings and own servers stay, and `enabled`, `remote`, `timeout` and `oauth` in magpie's entry are the user's. Zed speaks streamable HTTP only (its `http.rs` only POSTs), so no SSE. An entry Zed's extensions configure (`settings` and no command or url) is never written over: a server by that name is refused for Zed (`mcpFile.foreign`), and asks for another name. Zed reloads the file as it changes.
|
||||
- An agent with no place for an item is refused by `Takes`, never recorded as given it. The refusal lists the agents here that take that item (`takenBy`), and says where it goes instead (`noPlace`): OpenChamber reads OpenCode's global AGENTS.md, skills folder and opencode.json (its server's `shared.js`), so it gets them from OpenCode; Claude Desktop's chat keeps its instructions in its own settings, with the Claude account, and its Code tab reads Claude Code's. A plugin's agent is refused an item its `agent.library` names no place for, and the refusal names the key its plugin would set.
|
||||
- Removing RTK never uses `rtk init --uninstall`. That command deletes Gemini's `GEMINI.md` whole and removes Claude Code, OpenCode and Cursor together.
|
||||
|
||||
+92
-51
@@ -1,11 +1,12 @@
|
||||
package agent
|
||||
|
||||
// Grok App (RongleCat/grok-app, Tauri) is a desktop front end for the grok
|
||||
// CLI, which it starts over ACP. Most of what the CLI reads it reads where
|
||||
// Grok Build's own row writes it: MCP servers from ~/.grok/config.toml,
|
||||
// which the App reads and hands each session itself in either of its modes,
|
||||
// skills from ~/.agents/skills, instructions from AGENTS.md. Its models are
|
||||
// its own, though: its composer lists only Grok Build's official catalog
|
||||
// CLI, which it starts over ACP. Shared mode, the default, uses ~/.grok,
|
||||
// the same home as Grok Build. Independent mode, which Use on a custom
|
||||
// provider turns on, uses agent-home. The Library writes that home's
|
||||
// AGENTS.md, [mcp_servers] and skills/ (and Grok App still reads
|
||||
// ~/.agents/skills). Its models are its own, though: its composer lists
|
||||
// only Grok Build's official catalog
|
||||
// (models_cache.json), never a [model."<id>"] table of config.toml, and a
|
||||
// model of the user's choosing is a "provider channel" of its Settings ›
|
||||
// Providers page, a [model.<id>] table with the App's own keys in
|
||||
@@ -18,14 +19,19 @@ package agent
|
||||
// So magpie adds itself as the channel "magpie", written as the App writes
|
||||
// one (upsert_custom_provider): the gateway as base_url with Grok App's own
|
||||
// key, chat completions, app_models a JSON list of magpie's models with each
|
||||
// one's context window, images and effort levels, so the composer offers
|
||||
// them and their efforts. The model picked is the channel's model and
|
||||
// [models] default is "magpie"; what default was before is stashed and put
|
||||
// back on Disconnect. A model the user picks in the App's composer since is
|
||||
// theirs and stays through a sync.
|
||||
// one's context window, images and effort levels, so Accounts › Custom
|
||||
// providers lists it and the composer can offer the models and their
|
||||
// efforts. It does not set [models] default. That key is the route, and
|
||||
// making it "magpie" takes the App over: the App then drops its own sign-in
|
||||
// and the session no longer runs. The route stays whatever the App had.
|
||||
// Pressing Use on the provider in the App is what switches the route, and
|
||||
// that choice is the App's. A magpie that already set the route puts the
|
||||
// old one back once, on the next sync or connect. A model the user picks in
|
||||
// the App's composer since is theirs and stays through a sync.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -41,7 +47,16 @@ import (
|
||||
const grokAppChannel = "model." + magpieID
|
||||
|
||||
// what Grok App says after a change (notice.go)
|
||||
var noticeGrokApp = newNotice("Grok App reads its providers when it starts an agent — start a new chat in Grok App, or restart it, to use this.")
|
||||
var noticeGrokApp = newNotice("Magpie is a custom provider under Grok App's Accounts. Grok App stays on its current route until you press Use on magpie there.")
|
||||
|
||||
// errGrokAppRoute is Set's answer when asked to switch Grok App's route.
|
||||
// The route is the App's, from Accounts › Use, not from magpie's model field.
|
||||
var errGrokAppRoute = errors.New("Grok App keeps its own route. Magpie is a custom provider under Accounts — press Use on it there to switch")
|
||||
|
||||
// grokAppReleased marks that this magpie has already put back a route an
|
||||
// older one set to magpie. One restore: a Use the user presses after that
|
||||
// stays until they disconnect.
|
||||
const grokAppReleased = "grok-app:released-route"
|
||||
|
||||
// grokAppOS is the system grokAppDir looks for the App's data on; a test
|
||||
// sets it.
|
||||
@@ -164,12 +179,40 @@ func grokApp(home string) *Agent {
|
||||
at := here(home)
|
||||
key := func() string { return agentKeyAt("grok-app", at.gw()) }
|
||||
get := func() string {
|
||||
def, ch, _ := grokAppRead(path)
|
||||
if def == magpieID && ch != nil && ch["model"] != "" {
|
||||
_, ch, _ := grokAppRead(path)
|
||||
if ch != nil && ch["model"] != "" {
|
||||
return magpieID + "/" + ch["model"]
|
||||
}
|
||||
def, _, _ := grokAppRead(path)
|
||||
return def
|
||||
}
|
||||
// setDefault names the route the App starts on, the key taken out for "".
|
||||
// Magpie calls it only to put a route back, never to name itself.
|
||||
setDefault := func(v string) error {
|
||||
if v == "" {
|
||||
return edit.DelTOMLKey(path, "models", "default")
|
||||
}
|
||||
return edit.SetTOMLKey(path, "models", "default", v)
|
||||
}
|
||||
// releaseRoute puts back a route an older magpie set to itself, once.
|
||||
// The App stops working when that route is magpie. A route the user
|
||||
// picks in the App after this stays.
|
||||
releaseRoute := func() error {
|
||||
if stashLoad()[grokAppReleased] == "1" {
|
||||
return nil
|
||||
}
|
||||
def, _, err := grokAppRead(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if def == magpieID {
|
||||
if err := setDefault(unstash(keyDefault)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
stash(map[string]string{grokAppReleased: "1"})
|
||||
return nil
|
||||
}
|
||||
// wire writes magpie's channel, model, if given, its model, and
|
||||
// nothing when the file has it all already. The channel's own extras
|
||||
// (context window, images, efforts) are the model's, as the App copies
|
||||
@@ -256,36 +299,32 @@ func grokApp(home string) *Agent {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// setDefault names the route the App starts on, the key taken out for ""
|
||||
setDefault := func(v string) error {
|
||||
if v == "" {
|
||||
return edit.DelTOMLKey(path, "models", "default")
|
||||
// rememberRoute keeps the App's route so a later disconnect can put it
|
||||
// back if the route was magpie. An empty route can't be stashed (the
|
||||
// stash drops an empty value), and magpie's own route is never remembered
|
||||
// over the one it replaced.
|
||||
rememberRoute := func() error {
|
||||
def, _, err := grokAppRead(path)
|
||||
if err != nil || def == "" || def == magpieID || stashLoad()[keyDefault] != "" {
|
||||
return err
|
||||
}
|
||||
return edit.SetTOMLKey(path, "models", "default", v)
|
||||
stash(map[string]string{keyDefault: def})
|
||||
return nil
|
||||
}
|
||||
// unwire takes magpie's channel out, and the App back to the route it
|
||||
// was on before — when it is still on magpie: a route picked in the App
|
||||
// since is the user's and stands
|
||||
unwire := func(own string) error {
|
||||
// unwire takes magpie's channel out. The route is touched only when it
|
||||
// still names magpie, which is a route that doesn't run: put back the
|
||||
// one remembered, or clear it. Any other route is the App's and stays.
|
||||
unwire := func() error {
|
||||
def, _, err := grokAppRead(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if def == magpieID {
|
||||
was := unstash(keyDefault)
|
||||
if own != "" {
|
||||
was = own
|
||||
}
|
||||
if err := setDefault(was); err != nil {
|
||||
if err := setDefault(unstash(keyDefault)); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
forget(keyDefault)
|
||||
if own != "" {
|
||||
if err := setDefault(own); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return edit.SetTOMLTablesMatching(path, []string{grokAppChannel}, []string{grokAppChannel + "."}, nil)
|
||||
}
|
||||
@@ -299,6 +338,12 @@ func grokApp(home string) *Agent {
|
||||
return ""
|
||||
},
|
||||
Sync: func() error {
|
||||
if err := rememberRoute(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := releaseRoute(); err != nil {
|
||||
return err
|
||||
}
|
||||
_, ch, err := grokAppRead(path)
|
||||
if err != nil || ch == nil {
|
||||
return err
|
||||
@@ -306,44 +351,40 @@ func grokApp(home string) *Agent {
|
||||
return wire("")
|
||||
},
|
||||
Check: func() string {
|
||||
def, ch, err := grokAppRead(path)
|
||||
_, ch, err := grokAppRead(path)
|
||||
if err != nil {
|
||||
return err.Error()
|
||||
}
|
||||
if def != magpieID {
|
||||
return ""
|
||||
}
|
||||
if ch == nil {
|
||||
return "Grok App's [" + grokAppChannel + "] (config.toml) is gone, so it no longer reaches magpie"
|
||||
return ""
|
||||
}
|
||||
return wiringOff("Grok App", path, func(k string) (string, bool) { v, ok := ch[k]; return v, ok },
|
||||
"base_url", at.v1(), "api_key", key())
|
||||
},
|
||||
Fields: []Field{{
|
||||
// the route the App starts on: one of magpie's models is
|
||||
// magpie/<provider>/<model>, magpie's channel with the model in
|
||||
// it; anything else is the App's own route ("grok", or a
|
||||
// channel of the user's)
|
||||
// the model on magpie's custom provider, not the route the App
|
||||
// starts on. One of magpie's models is magpie/<provider>/<model>
|
||||
// written into the channel. The App's own route stays in
|
||||
// [models] default until the user presses Use in Accounts.
|
||||
Key: "model", Label: "model",
|
||||
Get: get,
|
||||
Set: func(v string) error {
|
||||
def, ch, err := grokAppRead(path)
|
||||
if err != nil {
|
||||
if _, _, err := grokAppRead(path); err != nil {
|
||||
return err
|
||||
}
|
||||
if ref, ok := strings.CutPrefix(v, magpieID+"/"); ok && isMagpie(ref) {
|
||||
if def != magpieID {
|
||||
stash(map[string]string{keyDefault: def})
|
||||
}
|
||||
if err := wire(ref); err != nil {
|
||||
if err := rememberRoute(); err != nil {
|
||||
return err
|
||||
}
|
||||
return setDefault(magpieID)
|
||||
if err := releaseRoute(); err != nil {
|
||||
return err
|
||||
}
|
||||
return wire(ref)
|
||||
}
|
||||
if ch != nil || def == magpieID {
|
||||
return unwire(v)
|
||||
if v == "" {
|
||||
return unwire()
|
||||
}
|
||||
return setDefault(v)
|
||||
return errGrokAppRoute
|
||||
},
|
||||
Options: func(cur map[string]string) []Option {
|
||||
return append(grokAppOwn(path, keyDefault, cur["model"]), viaMagpie("grok-app", magpieID+"/")...)
|
||||
|
||||
@@ -118,7 +118,7 @@ func grokAppSections(t *testing.T, path string) map[string]map[string]string {
|
||||
|
||||
// Connecting Grok App adds magpie as one of its provider channels — the
|
||||
// gateway, with a key naming Grok App, and every one of magpie's models in
|
||||
// the App's own app_models form — and makes it the route. The App's own
|
||||
// the App's own app_models form — and leaves the route alone. The App's own
|
||||
// channel stays in the file, and Disconnect gives the file back byte for
|
||||
// byte.
|
||||
func TestGrokApp(t *testing.T) {
|
||||
@@ -148,8 +148,8 @@ func TestGrokApp(t *testing.T) {
|
||||
if err := toml.Unmarshal(b, &m); err != nil {
|
||||
t.Fatalf("not TOML (Grok Build reads it as TOML): %v\n%s", err, b)
|
||||
}
|
||||
if d := m["models"].(map[string]any); d["default"] != "magpie" || d["max_retries"] != int64(3) {
|
||||
t.Fatalf("[models]: %v", d)
|
||||
if d := m["models"].(map[string]any); d["default"] != "deepseek" || d["max_retries"] != int64(3) {
|
||||
t.Fatalf("[models] route changed: %v", d)
|
||||
}
|
||||
ch := m["model"].(map[string]any)["magpie"].(map[string]any)
|
||||
// Grok Build reads these two bare: a quoted context window is what the
|
||||
@@ -288,26 +288,72 @@ func TestGrokAppSyncKeepsTheirs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A route of the App's own picked while it is on magpie takes magpie out:
|
||||
// the channel goes, and the App is on the route picked.
|
||||
func TestGrokAppOwnRouteTakesMagpieOut(t *testing.T) {
|
||||
// Picking the App's own route in magpie does not take the App over and does
|
||||
// not remove the custom provider. The route stays the one the App had.
|
||||
func TestGrokAppOwnRouteStays(t *testing.T) {
|
||||
home, path := grokAppHome(t, grokAppConfig)
|
||||
a := grokApp(home)
|
||||
if err := a.Pick("model", "magpie/kimi/k2"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Pick("model", "grok"); err != nil {
|
||||
t.Fatal(err)
|
||||
err := a.Pick("model", "grok")
|
||||
if err == nil || !strings.Contains(err.Error(), "Accounts") {
|
||||
t.Fatalf("picking the official route: %v", err)
|
||||
}
|
||||
secs := grokAppSections(t, path)
|
||||
if _, on := secs["magpie"]; on || a.Field("model").Get() != "grok" || a.Wired() {
|
||||
t.Fatalf("magpie still in:\n%v", secs)
|
||||
if secs["magpie"]["model"] != "kimi/k2" || a.Field("model").Get() != "magpie/kimi/k2" || !a.Wired() {
|
||||
t.Fatalf("the provider went: model %q wired %v\n%v", a.Field("model").Get(), a.Wired(), secs["magpie"])
|
||||
}
|
||||
def, _, rerr := grokAppRead(path)
|
||||
if rerr != nil || def != "deepseek" {
|
||||
t.Fatalf("route %q err %v", def, rerr)
|
||||
}
|
||||
if secs["deepseek"]["api_key"] != "sk-test" {
|
||||
t.Fatalf("the user's channel went: %v", secs)
|
||||
t.Fatalf("the user's channel went: %v", secs["deepseek"])
|
||||
}
|
||||
}
|
||||
|
||||
// An older magpie that set the route to itself is put back once. A Use the
|
||||
// user presses after that is the App's choice and stays.
|
||||
func TestGrokAppReleasesATakeover(t *testing.T) {
|
||||
home, path := grokAppHome(t, grokAppConfig)
|
||||
a := grokApp(home)
|
||||
stash(map[string]string{"grok-app:" + path + ":default": "deepseek"})
|
||||
b, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(path, []byte(strings.Replace(string(b), `default = "deepseek"`, `default = "magpie"`, 1)), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
def, _, err := grokAppRead(path)
|
||||
if err != nil || def != "deepseek" {
|
||||
t.Fatalf("after sync: route %q err %v", def, err)
|
||||
}
|
||||
if err := os.WriteFile(path, []byte(strings.Replace(string(mustRead(t, path)), `default = "deepseek"`, `default = "magpie"`, 1)), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
def, _, err = grokAppRead(path)
|
||||
if err != nil || def != "magpie" {
|
||||
t.Fatalf("Use was undone: %q err %v", def, err)
|
||||
}
|
||||
}
|
||||
|
||||
func mustRead(t *testing.T, path string) string {
|
||||
t.Helper()
|
||||
b, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// With no channel of the user's and no route set (a fresh install, Grok's
|
||||
// own sign-in), Disconnect leaves no route either: the App is back on
|
||||
// Grok's official one.
|
||||
|
||||
@@ -4474,7 +4474,7 @@ const I18N = {
|
||||
"It reads its settings at start-up — restart open Command Code sessions to use this.": "它启动时读取设置,需重启已打开的 Command Code 会话才会生效。",
|
||||
"Kimi Code reads its settings at start-up — restart open kimi sessions to use this.": "Kimi Code 启动时读取设置,需重启已打开的 kimi 会话才会生效。",
|
||||
"jcode reads its settings at start-up — restart open jcode sessions to use this.": "jcode 启动时读取设置,需重启已打开的 jcode 会话才会生效。",
|
||||
"Grok App reads its providers when it starts an agent — start a new chat in Grok App, or restart it, to use this.": "Grok App 在启动 agent 时读取供应商设置,需在 Grok App 中新建对话或重启它才会生效。",
|
||||
"Magpie is a custom provider under Grok App's Accounts. Grok App stays on its current route until you press Use on magpie there.": "Magpie 是 Grok App「账户」里的一个自定义供应商。在你于该处对 magpie 点「使用」之前,Grok App 保持当前路线。",
|
||||
"MiniMax Code reads its settings at start-up — restart open mcode sessions to use this.": "MiniMax Code 启动时读取设置,需重启已打开的 mcode 会话才会生效。",
|
||||
"Mister Morph's Console uses this for new tasks; restart open morph chats to use it there.": "Mister Morph 的 Console 会在新任务中使用这项设置;已打开的 morph 对话需重启才会生效。",
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.": "Muse Code 启动时读取设置,需重启已打开的 muse 会话才会生效。",
|
||||
@@ -8986,7 +8986,7 @@ const I18N = {
|
||||
"It reads its settings at start-up — restart open Command Code sessions to use this.": "它啟動時讀取設定,需重啟已打開的 Command Code 會話才會生效。",
|
||||
"Kimi Code reads its settings at start-up — restart open kimi sessions to use this.": "Kimi Code 啟動時讀取設定,需重啟已打開的 kimi 會話才會生效。",
|
||||
"jcode reads its settings at start-up — restart open jcode sessions to use this.": "jcode 啟動時讀取設定,需重啟已打開的 jcode 會話才會生效。",
|
||||
"Grok App reads its providers when it starts an agent — start a new chat in Grok App, or restart it, to use this.": "Grok App 在啟動 agent 時讀取供應商設定,需在 Grok App 中新建對話或重啟它才會生效。",
|
||||
"Magpie is a custom provider under Grok App's Accounts. Grok App stays on its current route until you press Use on magpie there.": "Magpie 是 Grok App「帳戶」裡的一個自訂供應商。在你於該處對 magpie 按「使用」之前,Grok App 維持目前的路線。",
|
||||
"MiniMax Code reads its settings at start-up — restart open mcode sessions to use this.": "MiniMax Code 啟動時讀取設定,需重啟已打開的 mcode 會話才會生效。",
|
||||
"Mister Morph's Console uses this for new tasks; restart open morph chats to use it there.": "Mister Morph 的 Console 會在新任務中使用這項設定;已打開的 morph 對話需重啟才會生效。",
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.": "Muse Code 啟動時讀取設定,需重啟已打開的 muse 會話才會生效。",
|
||||
@@ -13500,7 +13500,7 @@ const I18N = {
|
||||
"It reads its settings at start-up — restart open Command Code sessions to use this.": "起動時に設定を読み込むため、反映するには開いている Command Code セッションを再起動してください。",
|
||||
"Kimi Code reads its settings at start-up — restart open kimi sessions to use this.": "Kimi Code は起動時に設定を読み込みます。反映するには開いている kimi セッションを再起動してください。",
|
||||
"jcode reads its settings at start-up — restart open jcode sessions to use this.": "jcode は起動時に設定を読み込みます。反映するには開いている jcode セッションを再起動してください。",
|
||||
"Grok App reads its providers when it starts an agent — start a new chat in Grok App, or restart it, to use this.": "Grok App は agent の起動時にプロバイダーを読み込みます。反映するには Grok App で新しいチャットを開始するか、再起動してください。",
|
||||
"Magpie is a custom provider under Grok App's Accounts. Grok App stays on its current route until you press Use on magpie there.": "Magpie は Grok App の「アカウント」にあるカスタムプロバイダーです。そこで magpie の「使用」を押すまで、Grok App は今のルートのままです。",
|
||||
"MiniMax Code reads its settings at start-up — restart open mcode sessions to use this.": "MiniMax Code は起動時に設定を読み込みます。反映するには開いている mcode セッションを再起動してください。",
|
||||
"Mister Morph's Console uses this for new tasks; restart open morph chats to use it there.": "Mister Morph の Console は新しいタスクでこれを使います。開いている morph チャットに反映するには再起動してください。",
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.": "Muse Code は起動時に設定を読み込みます。反映するには開いている muse セッションを再起動してください。",
|
||||
@@ -18014,7 +18014,7 @@ const I18N = {
|
||||
"It reads its settings at start-up — restart open Command Code sessions to use this.": "Es liest seine Einstellungen beim Start – offene Command-Code-Sitzungen neu starten, damit es gilt.",
|
||||
"Kimi Code reads its settings at start-up — restart open kimi sessions to use this.": "Kimi Code liest seine Einstellungen beim Start – offene kimi-Sitzungen neu starten, damit es gilt.",
|
||||
"jcode reads its settings at start-up — restart open jcode sessions to use this.": "jcode liest seine Einstellungen beim Start – offene jcode-Sitzungen neu starten, damit es gilt.",
|
||||
"Grok App reads its providers when it starts an agent — start a new chat in Grok App, or restart it, to use this.": "Grok App liest seine Anbieter beim Start eines Agenten – in Grok App einen neuen Chat beginnen oder es neu starten, damit es gilt.",
|
||||
"Magpie is a custom provider under Grok App's Accounts. Grok App stays on its current route until you press Use on magpie there.": "Magpie ist ein eigener Anbieter unter Konten in Grok App. Grok App bleibt auf seiner aktuellen Route, bis du dort bei magpie auf Verwenden drückst.",
|
||||
"MiniMax Code reads its settings at start-up — restart open mcode sessions to use this.": "MiniMax Code liest seine Einstellungen beim Start – offene mcode-Sitzungen neu starten, damit es gilt.",
|
||||
"Mister Morph's Console uses this for new tasks; restart open morph chats to use it there.": "Die Console von Mister Morph nutzt dies für neue Aufgaben; offene morph-Chats neu starten, damit es dort gilt.",
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.": "Muse Code liest seine Einstellungen beim Start – offene muse-Sitzungen neu starten, damit es gilt.",
|
||||
@@ -18103,7 +18103,7 @@ const NOTICES = [
|
||||
"It reads its settings at start-up — restart open Command Code sessions to use this.",
|
||||
"Kimi Code reads its settings at start-up — restart open kimi sessions to use this.",
|
||||
"jcode reads its settings at start-up — restart open jcode sessions to use this.",
|
||||
"Grok App reads its providers when it starts an agent — start a new chat in Grok App, or restart it, to use this.",
|
||||
"Magpie is a custom provider under Grok App's Accounts. Grok App stays on its current route until you press Use on magpie there.",
|
||||
"MiniMax Code reads its settings at start-up — restart open mcode sessions to use this.",
|
||||
"Mister Morph's Console uses this for new tasks; restart open morph chats to use it there.",
|
||||
"Muse Code reads its settings at start-up — restart open muse sessions to use this.",
|
||||
|
||||
@@ -154,6 +154,16 @@ func TestAgentMCPFiles(t *testing.T) {
|
||||
web: entry{"url": "https://example.com/mcp", "headers": entry{"Authorization": "Bearer x"}},
|
||||
noSSE: true,
|
||||
},
|
||||
{
|
||||
// Grok App's independent home: the same [mcp_servers] tables,
|
||||
// and the route and magpie's channel stay
|
||||
id: "grok-app", file: "grok-app-data/agent-home/config.toml", toml: true,
|
||||
env: map[string]string{"GROK_APP_HOME": "grok-app-data"},
|
||||
user: "# mine\n[models]\ndefault = \"deepseek\"\n\n[model.magpie]\nmodel = \"grok/grok-4.7\"\nname = \"magpie\"\n\n[mcp_servers.mine]\ncommand = \"uvx\"\nargs = [\"mine\"]\nenabled = true\n",
|
||||
fs: entry{"command": "npx", "args": []any{"-y", "@mcp/fs"}, "env": entry{"K": "V"}},
|
||||
web: entry{"url": "https://example.com/mcp", "headers": entry{"Authorization": "Bearer x"}},
|
||||
noSSE: true,
|
||||
},
|
||||
} {
|
||||
t.Run(c.id+" "+c.file, func(t *testing.T) {
|
||||
h := sandbox(t)
|
||||
@@ -269,7 +279,7 @@ func TestAgentMCPFiles(t *testing.T) {
|
||||
if len(got) != 1 || got["mine"] == nil {
|
||||
t.Errorf("after removing:\n%s", read(t, p))
|
||||
}
|
||||
for _, keep := range []string{`"$schema"`, "timeout", "disabled", "enabled", "# mine", `default = "grok-4"`, "A = "} {
|
||||
for _, keep := range []string{`"$schema"`, "timeout", "disabled", "enabled", "# mine", `default = "grok-4"`, `default = "deepseek"`, `model = "grok/grok-4.7"`, "A = "} {
|
||||
if strings.Contains(c.user, keep) && !strings.Contains(read(t, p), keep) {
|
||||
t.Errorf("lost %s:\n%s", keep, read(t, p))
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -169,3 +170,30 @@ func TestDroidGrokInstructions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Grok App's independent home (Use on a custom provider) reads AGENTS.md
|
||||
// and skills beside agent-home/config.toml, not Grok Build's ~/.grok.
|
||||
func TestGrokAppInstructions(t *testing.T) {
|
||||
h := sandbox(t)
|
||||
root := filepath.Join(h, "grok-app-data")
|
||||
t.Setenv("GROK_APP_HOME", root)
|
||||
home := filepath.Join(root, "agent-home")
|
||||
write(t, filepath.Join(home, "config.toml"), "[models]\ndefault = \"deepseek\"\n")
|
||||
inst := filepath.Join(home, "AGENTS.md")
|
||||
write(t, inst, "# Mine\n")
|
||||
tg := targetByID("grok-app")
|
||||
if tg == nil || tg.Instructions != inst || tg.Skills != filepath.Join(home, "skills") || tg.MCP == nil || tg.MCP.Path != filepath.Join(home, "config.toml") {
|
||||
t.Fatalf("Grok App library places: %+v", tg)
|
||||
}
|
||||
if !slices.Contains(readsShared, "grok-app") {
|
||||
t.Fatal("Grok App doesn't read ~/.agents/skills")
|
||||
}
|
||||
shared := "Use tabs."
|
||||
ok(t)(SaveInstructions(InstructionsChange{Shared: &shared, Agents: []string{"grok-app"}}))
|
||||
if s := read(t, inst); s != "# Mine\n\n"+blockBegin+"\nUse tabs.\n"+blockEnd+"\n" {
|
||||
t.Fatalf("AGENTS.md:\n%s", s)
|
||||
}
|
||||
if cfg := read(t, filepath.Join(home, "config.toml")); !strings.Contains(cfg, `default = "deepseek"`) {
|
||||
t.Fatalf("instructions rewrote the route:\n%s", cfg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +206,10 @@ var rtkSpecs = map[string]rtkSpec{
|
||||
// instructions to AGENTS.md, which rewrite nothing).
|
||||
var rtkNoHook = map[string]string{
|
||||
"dsh": "RTK has no hook for DeepSeek Harness yet: RTK works by rewriting the shell command an agent is about to run, and dsh's hooks can only allow or deny a command, not change it; rtk init has no --agent dsh either (github.com/rtk-ai/rtk/issues/3847)",
|
||||
// rtk init's agents are claude, cursor, codex, copilot, gemini,
|
||||
// opencode and the rest of rtkSpecs. There is no grok or grok-app,
|
||||
// so a hook written here would have nowhere to go.
|
||||
"grok-app": "RTK has no hook for Grok App yet: rtk init has no Grok or Grok App agent, so it cannot rewrite the shell commands Grok App runs",
|
||||
}
|
||||
|
||||
func opencodePlugin(a *agent.Agent) string {
|
||||
|
||||
@@ -517,3 +517,30 @@ func TestRTKHermesHome(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Grok App is listed on the RTK tab with the switch unable to turn on:
|
||||
// rtk init has no Grok agent, so there is nothing to install.
|
||||
func TestRTKNoHookGrokApp(t *testing.T) {
|
||||
h := sandbox(t)
|
||||
root := filepath.Join(h, "grok-app-data")
|
||||
t.Setenv("GROK_APP_HOME", root)
|
||||
write(t, filepath.Join(root, "agent-home", "config.toml"), "")
|
||||
var app *RTKAgent
|
||||
for _, a := range ReadRTK().Agents {
|
||||
if a.ID == "grok-app" {
|
||||
app = &a
|
||||
}
|
||||
}
|
||||
if app == nil {
|
||||
t.Fatal("Grok App isn't listed")
|
||||
}
|
||||
if b, _ := json.Marshal(app); app.On || !strings.Contains(string(b), `"noHook":true`) || !strings.Contains(app.Blocked, "no Grok or Grok App agent") {
|
||||
t.Fatalf("listed as %s", b)
|
||||
}
|
||||
if _, err := SetRTK("grok-app", true); err == nil || !strings.Contains(err.Error(), "Grok App") {
|
||||
t.Fatalf("switched on: %v", err)
|
||||
}
|
||||
if _, err := RTKTakes("grok-app"); err == nil || !strings.Contains(err.Error(), "no Grok or Grok App agent") {
|
||||
t.Fatalf("magpie library rtk on grok-app: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,6 +254,15 @@ func targetOf(a *agent.Agent) *Target {
|
||||
t.MCP = &mcpFile{Path: a.Path, Format: fmtGrok}
|
||||
t.Instructions = filepath.Join(a.Dir, "AGENTS.md")
|
||||
t.Skills = filepath.Join(a.Dir, "skills")
|
||||
case "grok-app":
|
||||
// Independent mode (Use on a custom provider) starts the CLI with
|
||||
// GROK_HOME at agent-home, beside config.toml (grok-app's
|
||||
// providers.md). Shared mode keeps ~/.grok, which is Grok Build's
|
||||
// row. Skills there are read as well as ~/.agents/skills.
|
||||
home := filepath.Dir(a.Path)
|
||||
t.MCP = &mcpFile{Path: a.Path, Format: fmtGrok}
|
||||
t.Instructions = filepath.Join(home, "AGENTS.md")
|
||||
t.Skills = filepath.Join(home, "skills")
|
||||
case "droid":
|
||||
// Droid's user-wide servers are ~/.factory/mcp.json's mcpServers,
|
||||
// type stdio, http or sse as Claude Code's (docs.factory.ai/cli/
|
||||
@@ -524,7 +533,7 @@ func Targets() []*Target {
|
||||
|
||||
// readsShared are the agents that read ~/.agents/skills as well as their
|
||||
// own folder (each one's docs or source).
|
||||
var readsShared = []string{"codex", "gemini", "opencode", "crush", "dsh", "commandcode", "devin", "droid", "cline", "grok", "fx", "alma"}
|
||||
var readsShared = []string{"codex", "gemini", "opencode", "crush", "dsh", "commandcode", "devin", "droid", "cline", "grok", "grok-app", "fx", "alma"}
|
||||
|
||||
// readsWith adds to each agent's SkillsAlso the agents whose folder it
|
||||
// reads skills from too: one that is the very same folder (Kimi Code's,
|
||||
|
||||
Reference in New Issue
Block a user