Documentation
¶
Overview ¶
Package ask answers the questions the addon queues with /ask (schema 1, see docs/ask.md). It reads WoWCompanionDB.asks from the addon's SavedVariables file, runs a headless agent CLI once per unanswered question, and writes the WoWCompanion_Answers slot addon's Answers.lua.
The agent gets the question and the character key, never the capture: it reads facts through the advisor's MCP tools.
Index ¶
- Constants
- Variables
- func AgyWorkspace(mcpConfig string) string
- func AllowedGuideURL(raw string) (*url.URL, error)
- func AmmoBagFacts(ds store.DataStore, text string) string
- func Argv(tmpl []string, prompt, mcpConfig string) []string
- func CanBrowse(cfg Config) bool
- func CheckNote(pages []Source, searches, errs []string) string
- func Clean(s string) string
- func CleanTo(s string, max int) string
- func ClientName(command []string) string
- func Command(ctx context.Context, argv []string) *exec.Cmd
- func CreatureFacts(ds store.DataStore, text string) string
- func Detect(pathEnv string, extra []string) (name, path string, ok bool)
- func DetectedPath(source string, command []string) string
- func DisenchantFacts(ds store.DataStore, text string) string
- func DisplayName(id string) string
- func ExtraDirs(getenv func(string) string) []string
- func Facts(cfg Config, q Question) string
- func GatherFacts(ds store.DataStore, text string) string
- func GeminiPolicy() []byte
- func GuardAnswer(cfg Config, character, text string) string
- func GuardBagAnswer(text string, ps []inventory.Protected) (string, []string)
- func GuideGap(text string) bool
- func GuideGapFacts(text string) string
- func GuideLookup(text string) bool
- func GuideSearches(urls []string) []string
- func IcyPage(urls []string) string
- func ItemTooltipFacts(ds store.DataStore, text string) string
- func Launch(ctx context.Context, argv []string, extraEnv ...string) (*exec.Cmd, error)
- func LimitFacts(text string) string
- func LookPath(name string) (string, error)
- func LootRollFacts(c character.Character, ds store.DataStore, text string) string
- func MCPConfig(exe string, env map[string]string) []byte
- func ModelArgs(command []string, o Options) (args []string, at int)
- func ModelUsed(command []string, o Options) string
- func NamedQuestFacts(ds store.DataStore, text string) string
- func NextQuestion(q Question) bool
- func OrderSpecs(specs []string, role string) []string
- func PathStepsRule(kind string) string
- func PolicyPath(mcpConfig string) string
- func Probe(ctx context.Context, command []string, prompt string) (string, error)
- func ProfessionAsked(c character.Character, text string) string
- func ProficiencyFacts(c character.Character, ds store.DataStore, text string) string
- func Prompt(q Question) string
- func PromptFor(q Question, length string) string
- func PromptWithFacts(q Question, length, facts string) string
- func QuestRewardFacts(c character.Character, ds store.DataStore, ix *questie.Index, text string) string
- func RecipeSkillFacts(ds store.DataStore, text string) string
- func ResolveAgent(flagValue, configPath string) ([]string, error)
- func ResolveRef(cfg Config, q Question) string
- func Respond(ctx context.Context, cfg Config, q Question, prompt string, stream bool, ...) (text string, streamed bool, err error)
- func SavedNote(text string) string
- func SetFacts(ds store.DataStore, text string) string
- func Sources(s string) []string
- func SourcesLine(pages []Source) string
- func Stamp(path string) string
- func StandingFacts(c character.Character, text string) string
- func StatQuestion(q Question) bool
- func SummonStoneFacts(ds store.DataStore, text string) string
- func TalentQuestion(text string) bool
- func TrainerWhereFacts(c character.Character, text string) string
- func TravelRouteFacts(c character.Character, qx *questie.Index, text string) string
- func WeaponFacts(c character.Character, ds store.DataStore, text string) string
- func WeaponQuestion(text string) bool
- func WithBrowse(argv, command []string) []string
- func WithCheckNote(answer, note string) string
- func WithModel(argv []string, command []string, o Options) []string
- func WithSaved(answer, note string) string
- func WithSources(answer string, pages []Source) string
- func WriteAgyWorkspace(mcpConfig string, data []byte) error
- type API
- type Agent
- type Choice
- type Choices
- type Class
- type Config
- type Entity
- type Grounding
- type Kind
- type Needs
- type Option
- type Options
- type Question
- type Registry
- type Source
- type Topic
- type Trace
- type Usage
Constants ¶
const ( MaxAnswer = 1500 MaxOutput = 64 << 10 DefaultTimeout = 2 * time.Minute DefaultMaxPerRun = 5 )
Limits. MaxAnswer is in characters. MaxOutput bounds what is read from the agent at all.
const ( SourceFlag = "flag" // --agent SourceConfig = "config" // "agent" in the config file SourceAuto = "auto" // found on this machine SourceNone = "none" // no agent configured and none found )
Where an agent came from, as the companion's handshake reports it.
const ( // FactsBudget is the most characters of pre-fetched facts in a prompt (about 1.5k tokens). FactsBudget = 6000 // FactsSteps is how many next steps are pre-fetched. FactsSteps = 5 // FactsPlanSteps is how many route plan stops are pre-fetched (the plan's count covers the rest). FactsPlanSteps = 8 )
Pre-fetched facts: the character's brief and next steps are put in the prompt, so most questions need no tool call (each tool round trip resends the whole context). The tools stay available.
const ( LengthBrief = "brief" LengthStandard = "standard" // the default LengthDetailed = "detailed" )
Answer length, applied in the system prompt the same way for every client.
const ( TierEfficient = "efficient" TierBalanced = "balanced" TierBest = "best" TierCustom = "custom" // Options.Custom, a model name the player typed )
Model tiers. Efficient is the default: the client's small, fast tier.
const AgyRule = "mcp(" + ServerName + "/*)"
AgyRule is the permission rule that lets agy run the advisor's MCP tools without asking (https://antigravity.google/docs/permissions?tab=cli: mcp(server/*) matches every tool of one server).
const AutoAgent = "auto"
AutoAgent is the --agent (or config) value that asks for detection even when the config file names an agent.
const FormatRule = "Concise Markdown: short # headings, bullets with no blank lines, no tables over 3 columns,"
FormatRule asks for tight Markdown; the text after it is the length limit. Prompt rewriters find the rule by this marker, so keep it at the start of the prompt's last sentence.
const GapRule = " Never state as fact what neither the facts nor a guide page you read says. When the facts hold no reward, vendor or reputation data for a quest line or faction, " +
"say that gap in one line (\"the game data has no quest rewards for these lines\"); never claim that no reward suits the player's class, that one line is harder or easier to combine with another, or any other mechanic you cannot point to. "
GapRule keeps an answer from stating as fact what neither the facts nor a guide page holds.
const GroundingRules = "How to answer: answer from these facts first. Look anything up by id (quest id, NPC id, item id), " +
"never by name alone. A lookup that finds nothing is not an answer: never tell the player there was \"no match\" or that " +
"you cannot tell what this is. When the facts are thin, say plainly what they do show (who gives it, where, the level, " +
"whether it is a class quest, why it is listed) and what it usually means. Never invent specifics such as a reward, " +
"an ability name or a location that is not in the facts. Name NPCs, coordinates, prices and skill levels only from the facts; when one is missing, say what kind of place to look (\"your class trainer in Undercity\")."
GroundingRules tell the agent how to use a subject's facts: they are the answer's first source, ids are the key for lookups (a quest or item can be missing from the dataset by name), and a miss is never reported to the player as "no match".
const GuideRule = " Our facts come first. Only when they cannot answer (a quest line's final rewards, a faction or reputation choice, what a reputation vendor sells, " +
"where an item comes from when the facts give no source, which dungeon drops suit a class, where to farm a material at a skill level, where a recipe is learned, " +
"or the steps of a class quest) read the WoW Forever guides with guide_fetch or your web fetch tool, at most 3 pages after the search (4 fetches): " +
"search https://www.wowhead.com/forever/search?q=<words>, then open the best news, quest, item or npc page (for a which-of-two question, a news article or guide titled with both options); Icy Veins pages at icy-veins.com/wow-forever/ are allowed too. " +
"Fetch nothing else, and nothing when the facts already answer. For a faction or quest-line choice, weigh the character's class, spec and professions from the facts " +
"and say which pick fits them. Keep our facts over a page that differs. Paraphrase every page and quote at most one short phrase per source. " +
"The sources and the \"Tactics: guides\" line are added under your answer for you; do not write them. "
GuideRule is added to the prompt when the model may look guides up by itself.
const GuideTool = "guide_fetch"
GuideTool is the name of the fetch tool the API agent loop gets.
const HeadsUpRule = "" /* 136-byte string literal not displayed */
HeadsUpRule is added to a What next? answer only: the one place a heads-up line belongs.
const IcyRule = " The player asked you to check the guides: read the matching WoW Forever guide at icy-veins.com/wow-forever/ or wowhead.com/forever/ with your web or fetch tool (at most 3 pages after the search), " +
"refine the tactics from it, and keep our facts over anything it says that differs. Paraphrase it and quote at most one short phrase per source. Fetch nothing else. " +
"Search first (https://www.wowhead.com/forever/search?q=<the subject's words>) to find the page. When no page matches, answer from our facts alone and claim nothing from a guide; " +
"never say which pages you read or that you found none: the line under the answer reports it. "
IcyRule is added when the player pressed Check guides: the same question, refined from the guides.
const JustReadRule = "" /* 140-byte string literal not displayed */
JustReadRule is added whenever a question arrives with a ref: the player clicked the entry and has read its card, so the answer is only what the card does not say, in the short answer shape.
const KnowHowRule = " This is a question about how the game works, not about the player's own state: answer it with your own WoW knowledge, " + "framed by the facts given below it. Our facts always win: use their levels, entrances, bosses, quests and spells where they differ from what you remember. " + "Attach tactics only to the bosses and creatures listed in the facts, and leave out anything you are not sure exists in WoW Forever. " + "Tailor it to the saved class, role and spec (a Fury warrior is a damage dealer by default: threat, and the interrupts they have at their level). " + "When the player is under the level, give one line, \"You're N; it opens around M.\", then the full plan for when they are ready. " + "Write the answer itself plainly and never comment on where the information comes from: a source line is added under it for you. " + GapRule
KnowHowRule is added to the prompt of a know-how question. It replaces the "answer from the facts only" stance for the how-the-game-works part: the model uses its own WoW knowledge, framed by the facts below it. The source line is added by the server, so the body never says where facts came from.
const LogisticsFraming = "WoW Companion is a gameplay logistics planner: one route of stops and legs over everything the player opted into. " +
"Think in routes and errands: bundle errands into stops the route already visits (\"while you're here\"); cut back-trips and wasted flights."
LogisticsFraming is the product framing (docs/product-principles.md) in the prompt's words.
const MaxGuideFetches = 4
MaxGuideFetches is how many fetches one answer may make (one search plus up to three pages).
const MaxTurns = 10
MaxTurns caps the agent's turns per ask where the CLI has a flag for it (Claude Code only).
const NeedsPlayStyle = "play_style"
NeedsPlayStyle is the Needs value of a question that cannot be answered before the character has a play style.
const NeedsSpec = "spec"
NeedsSpec is the Needs value of a talent question for a character that has a role and focus but no spec: the card has one button per talent tree and nothing else.
const NoDataFacts = "Game data not downloaded yet; see Setup. Tell the player this, in those words, rather than guessing quests, zones or gear."
NoDataFacts stands in for the next steps when no game dataset has downloaded.
const NoStandingGrindFacts = "Reputation: the game data holds no faction reputation, no standing that an item, vendor or recipe asks for, and no reputation grind route. " +
"Say so for any such part of the question; never name a standing an item needs, a number of points a quest or kill gives, or a grind route from memory."
NoStandingGrindFacts is said for a reputation question: the game data holds no faction, no standing a vendor or an item asks for and no reputation grind route, so the advisor names none.
const NoWeaponFacts = "" /* 283-byte string literal not displayed */
NoWeaponFacts stands in for the weapon-skill facts when the dataset has no weapon-skill tables.
const ProbeTimeout = 60 * time.Second
ProbeTimeout bounds one Probe.
const Schema = 1
Schema is the Answers.lua format version this package writes.
const ServerName = "wowc-advisor"
ServerName is the advisor's name in the generated MCP config and in each CLI's own settings.
const ShortAnswerRules = "Answer the question asked in your first sentence. Then add at most 3 short bullets (lines starting with \"- \"), only what matters for that question. " + "Never restate or re-list the plan, and add no unrelated steps. Never end with a \"Heads-up:\" line. " + "The plan in the facts is shared context: if your answer would change what it says, say so in one plain sentence (for example \"Your plan has her later, after Unwelcome Spirits\") rather than contradicting it silently." + WordingRules
ShortAnswerRules shape every answer, whatever its length setting: the question first, little after it, and the plan left alone. The length setting is an upper bound on top of them.
const SlotAddon = "WoWCompanion_Answers"
SlotAddon is the data-only addon the answers are written into.
const SpecNote = "Saved for this character. Change it any time in Settings → Play Style."
SpecNote is the line under the spec buttons.
ToolsUnavailable is the answer when the AI client would not run the advisor's tools.
const UsageTip = "" /* 139-byte string literal not displayed */
UsageTip is the tooltip of the usage line.
const WordingRules = " Wording: lead with the answer. Never mention the advisor, data, \"general game knowledge\", tools, sources or what is missing; " +
"when a fact is unknown, give the best practical step plainly (\"Any Blacksmithing trainer can teach it.\"), but for who trains, sells or teaches a recipe call where_to_learn and name the place it gives. " +
"For a vendor, trainer, flight master or who sells an item or goods (poison, reagents), call find_vendor first and name the NPC, subname, place, coordinates and goods; never say you cannot confirm one without it; an empty result is \"not in my data\", naming what was searched, with no item, NPC or tip added. " +
"A recipe whose product the character carries is known: never say to learn it; with no recipe list say \"Open your <Profession> window once so I can see your recipes\". " +
"A requirement already met by far is an ability (\"You can make these now.\"), never \"you have 35, it needs 1\". " +
"Never say something was saved unless the save tool succeeded in this answer."
WordingRules are the one wording rule for every answer, on both the CLI and the API path.
Variables ¶
var ( Lengths = []string{LengthStandard, LengthBrief, LengthDetailed} Tiers = []string{TierEfficient, TierBalanced, TierBest, TierCustom} // Reasonings are the reasoning levels, lowest first. Reasonings = []string{"low", "medium", "high"} )
Lengths and Tiers list the valid values, default first.
var DetectOrder = []string{"claude", "codex", "agy", "gemini"}
DetectOrder is the order the AI CLIs are looked for in; the first one found is used. Gemini CLI is legacy (API keys only since 2026-06-18), so it is chosen only when nothing else is installed.
var ErrGuideURL = errors.New("only https://www.icy-veins.com/wow-forever/ and https://www.wowhead.com/forever/ pages can be fetched")
ErrGuideURL is why a fetch was refused.
var Presets = map[string][]string{ "claude": {"claude", "-p", "{prompt}", "--mcp-config", "{mcp_config}", "--strict-mcp-config", "--tools", "", "--setting-sources", "", "--disable-slash-commands", "--no-session-persistence", "--exclude-dynamic-system-prompt-sections", "--allowedTools", "mcp__" + ServerName}, "codex": {"codex", "exec", "--skip-git-repo-check", "--ephemeral", "-s", "read-only", "-c", "mcp_servers." + ServerName + "={mcp_codex}", "{prompt}"}, "agy": {"agy", "-p", "{prompt}"}, "gemini": {"gemini", "--allowed-mcp-server-names", ServerName, "--policy", "{mcp_policy}", "-p", "{prompt}"}, }
Presets are the documented agent commands (docs/ask.md lists what each passes). {prompt} is the question text, {mcp_config} the path of a generated MCP config file, {mcp_codex} the advisor server as a Codex inline config table, {mcp_policy} the path of a generated Gemini policy file; a command without {prompt} gets the prompt as its last argument.
Each preset pre-allows the advisor's tools and nothing else, because a headless run refuses what it cannot ask about.
var StreamArgs = []string{"--output-format", "stream-json", "--verbose", "--include-partial-messages"}
StreamArgs are appended to a Claude command to make it print stream-json with partial messages.
var Tools = []string{"character_brief", "get_character_profile", "list_characters", "profession_plan", "quest_plan", "server_info", "set_character_profile", "stat_check", "talent_tree", "update_digest", "upgrade_finder", "upgrade_paths", "whats_next"}
Tools are the advisor tool names; an answer that names one gets it in its sources line.
Functions ¶
func AgyWorkspace ¶ added in v0.4.0
AgyWorkspace is the folder an Antigravity run starts in: it holds .agents/mcp_config.json, the workspace MCP config agy reads (https://antigravity.google/docs/mcp/), beside the generated config.
func AllowedGuideURL ¶ added in v0.7.109
AllowedGuideURL parses raw and returns it when it is an https page under icy-veins.com/wow-forever/ or wowhead.com/forever/ (its search, news, item, quest and npc pages included).
func AmmoBagFacts ¶ added in v0.7.106
AmmoBagFacts says what the dataset holds for a quiver, an ammo pouch or a class bag: the class limit on each row and the ammo each holds. "" for any other question, or without a dataset.
func Argv ¶
Argv fills the placeholders in the command template; with no {prompt}, the prompt is appended. An argument that needs the MCP config is dropped, with the flag before it, when there is none.
func CanBrowse ¶ added in v0.7.43
CanBrowse reports whether the client that will answer can read a web page: an API client (the advisor gives it the fetch tool) or Claude Code (its own WebFetch). Other CLI clients can't, so the Check guides button is hidden for them.
func CheckNote ¶ added in v0.7.110
CheckNote is the line a guide check adds under its answer besides the Sources line: "No Icy Veins or Wowhead WoW Forever page covers this" (and the searches tried) when no page was read, and each fetch that failed. "" when pages were read and none failed.
func Clean ¶
Clean trims the agent's output and cuts it to MaxAnswer characters, at a rune boundary.
func ClientName ¶ added in v0.3.0
ClientName is the preset name (claude, codex, agy, gemini) of an agent command, or "" for any other.
func Command ¶
Command is exec.CommandContext for the agent argv. On Windows a .cmd or .bat shim (npm's) runs through cmd.exe and a .ps1 script through PowerShell; anything else runs directly.
func CreatureFacts ¶ added in v0.7.101
CreatureFacts is what the dataset holds of each creature the question names (by an exact name in npcs): its level, zone, faction and rank where the row has them, "not held" where it has none, and the items players saw it drop (loot_sources, with the share of kills). "" for a question that does not ask about a creature or names none the dataset holds. The dataset holds no spawn point, respawn timer or elite status, so the lines say so: none is stated from memory.
func Detect ¶
Detect finds the first of DetectOrder in the PATH list, else in the extra directories, and the full path to it.
func DetectedPath ¶
DetectedPath is the executable a detected agent runs ("" for any other source).
func DisenchantFacts ¶ added in v0.7.100
DisenchantFacts is what disenchanting gives for each item the question links by [name], from the item row and the dataset's disenchant bands (item class, quality and item level): the materials with their chance and count. An item that is not armor or a weapon of uncommon quality or better cannot be disenchanted; an item no band covers, or none the dataset rates, gets no material from memory. "" for a question that is not about disenchanting.
func DisplayName ¶ added in v0.4.0
DisplayName is the name people know a client by (Claude Code, Codex, Antigravity, Gemini CLI); any other id comes back as given. The overlay keeps the same table in app.js.
func ExtraDirs ¶
ExtraDirs are the places the AI CLIs' installers put them that a desktop app's PATH may lack. getenv supplies USERPROFILE, APPDATA, LOCALAPPDATA and ProgramFiles (Windows) or HOME.
On Windows:
%USERPROFILE%\.local\bin Claude Code's native installer (claude.exe) %USERPROFILE%\.claude\local Claude Code's local install %LOCALAPPDATA%\agy\bin Antigravity CLI's installer (agy.exe; install.ps1, https://antigravity.google/docs/getting-started) %APPDATA%\npm npm install -g shims (claude.cmd, codex.cmd, gemini.cmd) %LOCALAPPDATA%\Microsoft\WinGet\Links WinGet's command links %LOCALAPPDATA%\Programs\claude %USERPROFILE%\scoop\shims Scoop shims %ProgramFiles%\nodejs a system-wide npm prefix
func Facts ¶ added in v0.4.0
Facts is the pre-fetched facts block for q's character, or "" when the character cannot be chosen or the capture cannot be read (the agent then uses its tools, as before). The block is cut at FactsBudget characters.
func GatherFacts ¶ added in v0.7.99
GatherFacts is the gathering section of the facts for a question about an ore or herb node's skill or zones, about the skill a creature needs to be skinned, or about fishing: what the game data holds, and a line saying it holds nothing for the rest. "" for any other question or without a dataset.
func GeminiPolicy ¶
func GeminiPolicy() []byte
GeminiPolicy is the Gemini CLI policy file: the advisor's tools run without asking, and shell, file writes and web access are denied outright (a headless run cannot ask).
func GuardAnswer ¶ added in v0.7.98
GuardAnswer applies GuardBagAnswer for the question's character and logs each correction. It is a no-op when the capture cannot be read or the answer names no item the log needs.
func GuardBagAnswer ¶ added in v0.7.98
GuardBagAnswer checks a bag answer against the items the quest log needs. A line under a sell, toss, destroy or mail heading that names such an item is dropped, as is a "Toss: a, b, c" line's entry for it, and "Kept: <item> (needed for <quest>)" is added once per item. It returns the text and the corrections made; the text is unchanged when there are none.
func GuideGap ¶ added in v0.7.109
GuideGap reports whether the question is of a kind our data has no rows for (quest-line final rewards, faction or reputation choices, reputation vendor goods).
func GuideGapFacts ¶ added in v0.7.109
GuideGapFacts is the facts line that tells the model the dataset has a hole for this question; "" for any other.
func GuideLookup ¶ added in v0.7.113
GuideLookup reports whether the model may read guide pages for the question when the facts cannot answer it: a dataset gap (GuideGap) or one of the guideLookupRE kinds.
func GuideSearches ¶ added in v0.7.110
GuideSearches are the allowed search pages among urls.
func IcyPage ¶ added in v0.7.43
IcyPage is the first Icy Veins guide page among urls, "" when none (a URL a client's own tool read is checked the same way the fetch tool checks it).
func ItemTooltipFacts ¶ added in v0.7.99
ItemTooltipFacts is the tooltip for each item the question links by [name]: item level, required level, binding and what the binding lets a player do with it, from the dataset row. "" for a question that is not about those or that links no item. An item the dataset does not hold says so and states nothing about it.
func Launch ¶ added in v0.3.0
Launch builds the command for an agent argv: argv[0] is resolved to an absolute path, scripts are wrapped (see Command) and the environment carries a fresh PATH. The error is fit to show.
func LimitFacts ¶ added in v0.7.99
LimitFacts says what the game data does not hold about bags, banks, stacks, unique items, mail, the Auction House, gold making and gold fees, the trade window, holiday events, weather and time of day, quest XP rewards, elite and group quests, a quest's minimum level, escort and timed quests, quests that start from an item, race, class and faction limits on quests, zone levels, a hunter's pet diet, abilities and taming, boss abilities, raid lockouts, dungeon difficulty, group roles and threat, battlegrounds, honor ranks, travel times, riding and mounts, class trainer prices, racial traits, capital city services, faction leaders, class reagents, soul shards, totems and summoning rituals, bandage and anti-venom effects, lockpicking, cooking fires and food effects and macros, for a question that asks about one. "" for any other question.
func LookPath ¶ added in v0.3.0
LookPath resolves an agent command to an absolute file, by the rules detection uses: PATH from freshPath, PATHEXT, then the known install folders. A name with a directory is used as given (with an extension added on Windows). A .ps1 script is swapped for a sibling .cmd or .exe.
func LootRollFacts ¶ added in v0.7.99
LootRollFacts is the loot rule for each item the question links by [name]: what the character rolls and how it binds, from the dataset row and the class rules. "" for a question that is not about rolling or that links no item. An item the dataset does not hold says so.
func MCPConfig ¶
MCPConfig renders the MCP config JSON handed to the agent: it starts this binary as a stdio server on the capture. The agent reads facts through it and is never given the file itself.
func ModelArgs ¶ added in v0.3.0
ModelArgs are the arguments that select the model (and cap the turns) for the command's client, and the index in the argv they go at: right after the program, or after Codex's exec subcommand. A command that is not a known client gets none.
func ModelUsed ¶ added in v0.3.0
ModelUsed names the model an ask with these options runs, as far as the command line says: the alias or custom name, or "default model" when the client picks its own.
func NamedQuestFacts ¶ added in v0.7.101
NamedQuestFacts is the no-data line of a quest question that names a quest by its title and has no word "quest" ("what is the minimum level for Dusky Crab Cakes?"): the lines LimitFacts does not already give. The prerequisite line is left out for a quest that sits in one of the dataset's quest lines, whose order the quest tool gives. "" when the text names no quest of quests_observed or asks none of these things.
func NextQuestion ¶ added in v0.7.40
NextQuestion reports whether q is the What next? question, the only answer that carries a heads-up.
func OrderSpecs ¶ added in v0.7.35
OrderSpecs puts the trees that fit the role first: tank trees for a tank, healing trees for a healer, the rest, and a hybrid tree such as Feral Combat, for damage. Every tree is still offered; the order is otherwise kept.
func PathStepsRule ¶ added in v0.7.16
PathStepsRule is added when the player asks an upgrade's first question, the one that follows the path the card suggests: they want the steps, not the card's one line again. It keeps the short answer shape (one answer line, then at most 3 steps) and takes its facts from upgrade_paths.
func PolicyPath ¶
PolicyPath is where the Gemini policy file sits: next to the generated MCP config.
func Probe ¶ added in v0.3.0
Probe sends one tiny prompt through the agent and returns its first output line. A failure is an error whose text is the first line the agent printed to stderr (for example "not signed in"), else a short reason. It reads nothing from the game and hands the agent no MCP config.
func ProfessionAsked ¶ added in v0.7.99
ProfessionAsked is professionAsked for the benchmark: the profession of the character that a leveling question names, "" for any other question.
func ProficiencyFacts ¶ added in v0.7.100
ProficiencyFacts is the weapon and armor rules of each class a question names, for a question about what a class can wear or wield, when the question names a class other than the character's (the character's own weapon rules are WeaponFacts's) or asks about armor. "" for any other question.
func PromptFor ¶ added in v0.3.0
PromptFor is what the agent is asked: the question and the character key, where the facts are, what to say if the tools are missing, and how long the answer should be. It is kept short on purpose, as it is sent with every ask.
func PromptWithFacts ¶ added in v0.4.0
PromptWithFacts is PromptFor plus the pre-fetched facts, when there are any.
func QuestRewardFacts ¶ added in v0.7.112
func QuestRewardFacts(c character.Character, ds store.DataStore, ix *questie.Index, text string) string
QuestRewardFacts is the facts block of the rewards the player's own game showed, for a reward, faction or quest-line question; it comes before the guides and general knowledge. "" for any other question, or when the capture holds no quest rewards and the text names no quest line.
func RecipeSkillFacts ¶ added in v0.7.99
RecipeSkillFacts are the Cooking and First Aid recipes the question names (by name, or linked as [Name]) with the skill each needs and where it is learned, from the recipe rows, for a question that asks what a recipe needs. A linked recipe the data lacks says so.
func ResolveAgent ¶
ResolveAgent turns the --agent value, or else the config file's "agent" field, into an argv. A preset name (claude, codex, agy, gemini) expands to its command; anything else is split on spaces.
func ResolveRef ¶ added in v0.7.7
ResolveRef is q's ref: the one it carries, else that of the current suggested question of the character that the text matches exactly (case and punctuation aside); "" when neither.
func Respond ¶
func Respond(ctx context.Context, cfg Config, q Question, prompt string, stream bool, onText func(string)) (text string, streamed bool, err error)
Respond runs the agent for q with prompt (see Prompt) and returns the answer. With stream set the command is Claude's: its text deltas are passed to onText as they arrive and streamed is true when any did. Otherwise the output is read whole, cut like ask does, and streamed is false.
func SavedNote ¶ added in v0.7.35
SavedNote is the saved_note field of a set_character_profile result, "" when it is not there.
func SetFacts ¶ added in v0.7.100
SetFacts is the membership of each item set the question names (or the set an [item] in the question belongs to): the set's name and id and its pieces, from item_sets, each piece named from items where the table holds it. "" for a question that is not about a set or names none the dataset holds. The dataset holds no set bonus, so the line says so: the bonus is never stated.
func SourcesLine ¶ added in v0.7.109
SourcesLine is the line that ends an answer which read guide pages: "Sources: [title](url), ..."; "" when none were read. It comes from what was fetched, never from the model.
func StandingFacts ¶ added in v0.7.99
StandingFacts is the reputation section of the facts for a reputation question: the player's own standing and points to the next standing for every faction the question names (or for every captured faction when it names none, up to maxStandings), and what the game data does not hold. "" for a question that is not about reputation.
func StatQuestion ¶ added in v0.7.12
StatQuestion reports whether a question is about the character's stats (the stat check's subject).
func SummonStoneFacts ¶ added in v0.7.100
SummonStoneFacts is the line for a question about a summoning stone: the dataset holds the dungeon and its entrance zone, level range and group size, and no stone row or position.
func TalentQuestion ¶ added in v0.7.0
TalentQuestion reports whether a question is about talents.
func TrainerWhereFacts ¶ added in v0.7.100
TrainerWhereFacts is the line for a question about where a class trainer is: the capitals that hold one, for the class the question names (else the character's), both sides; "" for any other question.
func TravelRouteFacts ¶ added in v0.7.113
TravelRouteFacts is the route for a travel question, from the same travel graph the plan uses; "" for any other question or when no destination is named.
func WeaponFacts ¶ added in v0.7.97
WeaponFacts is the weapon-skill section of the facts: the character's captured weapon skills, the class's learnable skills, and for each learnable skill the character lacks the masters of their faction with cost and level. Masters are listed only for a weapon question, to spare the budget.
func WeaponQuestion ¶ added in v0.7.87
WeaponQuestion reports whether a question is about which weapons a class can use or where to train a weapon skill.
func WithBrowse ¶ added in v0.7.43
WithBrowse lets Claude Code's own WebFetch read Icy Veins and nothing else: the built-in tool list is no longer empty and the one tool is pre-approved for the site. Other argv is returned unchanged.
func WithCheckNote ¶ added in v0.7.110
WithCheckNote ends the answer with the note, once.
func WithSaved ¶ added in v0.7.35
WithSaved ends the answer with the saved note, once; the note comes from the tool, not the model.
func WithSources ¶ added in v0.7.109
WithSources ends the answer with the sources line, once.
func WriteAgyWorkspace ¶ added in v0.4.0
WriteAgyWorkspace writes mcpConfig's contents to AgyWorkspace's .agents/mcp_config.json.
Types ¶
type API ¶ added in v0.7.26
type API struct {
Name string // short name for messages, e.g. "Anthropic (Claude)"
Adapter provider.Adapter // sends the calls; holds the key
Model string // the model id to ask
NeedKey bool
HasKey bool
// MaxTurns, Timeout and MaxResult override the loop's defaults (zero: MaxTurns, Config.Timeout, the loop's).
MaxResult int
// HTTP is the client the guide fetch tool uses (nil: a default with a timeout).
HTTP *http.Client
}
API is a model provider API client (client kind "api"): the loop runs in this process, and the advisor's tools are served to it over an in-memory MCP session, the same server a CLI starts.
type Agent ¶
Agent is a resolved agent: its argv, its short name and where it came from. A Source of SourceNone has no Command.
func ResolveAuto ¶
ResolveAuto is ResolveAgent for callers that can run without an agent: with nothing configured, or the value "auto", it looks for the first of DetectOrder installed. Nothing found is no error.
type Choice ¶ added in v0.3.0
type Choice struct {
Tier string `json:"tier"` // the Options.Tier it selects
Label string `json:"label"` // "Haiku (small)"
}
Choice is one entry of a client's model dropdown.
type Choices ¶ added in v0.3.0
type Choices struct {
Models []Choice `json:"models"` // empty: the client's model is not ours to set
ModelNote string `json:"model_note"` // the model dropdown's tooltip
Reasoning []string `json:"reasoning"` // empty: the client has no reasoning option
ReasoningNote string `json:"reasoning_note,omitempty"` // the reasoning dropdown's tooltip
}
Choices is what the settings dropdowns offer for a client.
func ChoicesFor ¶ added in v0.3.0
ChoicesFor lists the model and reasoning options for a client name; a client that is not a known preset gets none, and the notes say why.
type Class ¶ added in v0.7.43
type Class struct {
Kind Kind
Topic Topic
// Subject is the dungeon, class or profession named (or the saved character's class); "" for none.
Subject string
}
Class is a classified question.
func Classify ¶ added in v0.7.43
Classify sorts a question by keywords and its subject. A know-how word wins; else a personal phrase makes it a state question; when unsure it is know-how (the facts still override what the model remembers). ds and the character are optional: they let a dungeon name, or "my class", be found.
type Config ¶
type Config struct {
SavedVariables string // the addon's WoWCompanion.lua
Command []string // the agent argv, see Presets; empty when no agent is set up (the companion only)
Name, Source string // the agent's short name and where it came from (see Agent); may be empty
Dataset string // dataset directory for the pre-fetched next steps (empty: none)
MCPConfig string // path of the MCP config file handed to the agent; may be empty
Options Options // answer length, model tier and reasoning, see Options
API *API // set: ask this model provider API instead of running Command
Guides bool // the player's setting: the model may look up guides by itself when the data has no answer
Server func() *mcp.Server // builds the advisor's tools for an API client (nil: none)
Fallback []Config // tried in order when this client cannot start (see RespondUsage)
Notice func(string) // told a one-line notice, e.g. that the CLI rejected a flag (may be nil)
Timeout time.Duration
MaxPerRun int
Now func() time.Time
}
Config is one pass's settings.
func (Config) GuidesFor ¶ added in v0.7.113
GuidesFor is guidesFor for callers outside the package (the guide audit).
func (Config) Prompt ¶ added in v0.4.0
Prompt is what the agent is asked for q under cfg: PromptFor with the pre-fetched facts.
func (Config) PromptGround ¶ added in v0.7.43
PromptGround is Prompt and the grounding of a know-how question (the zero Grounding for any other).
func (Config) Usable ¶ added in v0.7.26
Usable reports whether the config can ask anything: an agent command or an API client.
func (Config) WithClients ¶ added in v0.7.26
WithClients applies a saved client list to c: the first client answers, the rest follow in order when it cannot start. An empty list returns c unchanged (the CLI-only setup).
type Entity ¶ added in v0.7.30
type Entity struct {
Kind string `json:"kind"`
ID int64 `json:"id,omitempty"`
Name string `json:"name"`
}
Entity is something an answer's tools touched: a quest, NPC, item, zone or recipe, with its display name.
func AnswerEntities ¶ added in v0.7.35
AnswerEntities is what the answer is about: the touched, character and dataset entities named in the answer text, first mention first.
func DatasetEntities ¶ added in v0.7.35
DatasetEntities are the dataset's items, recipes, NPCs and instances named in the answer: every run of up to six words that starts with a capital is looked up by exact name.
func EntitiesIn ¶ added in v0.7.30
EntitiesIn finds the entities in one tool result: JSON objects with a display name and an id (or a tool that names its kind), and a "zone" name. At most maxPerResult, in the order they appear.
func KnownEntities ¶ added in v0.7.35
KnownEntities are the names the character's own data can put on a card: its quest log, gear, bags, NPCs, zone and the entries of its digest.
type Grounding ¶ added in v0.7.43
type Grounding struct {
Topic Topic
Subject string
Levels bool // a level range
Bosses bool // bosses or creatures
Quests bool // dungeon quests with givers
Drops bool // drops for the character
Spells bool // the class's spells at the character's level
Notes bool // the profession notes
IcyURL string
Pack string // the facts handed to the model; "" when there are none
KnowHow bool
Browsing bool // the answer was checked against the guides
Guides bool // the answer read guide pages
Rewards bool // quest rewards the player's own game showed grounded the answer
Seen bool // some of the facts are ones the player saw in game (trainers, vendors, gathering, quest givers)
}
Grounding is what the facts of one know-how answer covered; the footer is built from it.
func GroundFor ¶ added in v0.7.43
GroundFor classifies q and, for a know-how question, builds the grounding pack. State questions return the zero Grounding.
type Kind ¶ added in v0.7.43
type Kind int
Kind is the kind of question: about the player's own state, or about how the game works.
const ( // KindState is personal ("what should I do", "my gear", "can I make X"): answered strictly from // the player's data. KindState Kind = iota // KindKnowHow is about how the game works (strategy, tactics, boss mechanics, rotations, how a // profession works, lore, thinking ahead): the model may use its own WoW knowledge, framed by our facts. KindKnowHow )
type Needs ¶ added in v0.7.7
type Needs struct {
Needs string `json:"needs"` // NeedsPlayStyle
Character string `json:"character"`
Question string `json:"question"` // the original question, as asked
Ref string `json:"ref,omitempty"`
Hook string `json:"hook,omitempty"` // for a stat question: "Choose a play style for a stat check"
Roles []Option `json:"roles"`
Activities []Option `json:"activities"`
Specs []string `json:"specs,omitempty"` // the class's trees, optional
Note string `json:"note,omitempty"` // NeedsSpec: the line under the buttons
Role string `json:"role,omitempty"` // the saved role and focus the choice is saved with; an empty one is still to be asked
Focus string `json:"focus,omitempty"`
}
Needs is the structured response to a question that needs a play style the character does not have. No AI call is made for it: the overlay shows the options as buttons, saves the choice with the profile store (POST /api/profile), and the question is then asked again once, automatically.
func PlayStyleNeeded ¶ added in v0.7.7
PlayStyleNeeded is the choices to put to the player instead of an AI call, when q needs a play style the character has not saved; ok is false when it does not, or the character cannot be read (the agent then works as before).
type Options ¶ added in v0.3.0
type Options struct {
Length string // brief, standard (default) or detailed
Tier string // efficient (default), balanced, best or custom
Custom string // the model name for TierCustom
// Reasoning is the reasoning level (low, medium or high); low is the default. It is passed only
// to a client that has a flag for it, see reasoningFor.
Reasoning string
// contains filtered or unexported fields
}
Options are the per-ask settings the player controls. The zero value is Standard and Efficient.
func (Options) AnswerLimit ¶ added in v0.3.0
AnswerLimit is the most characters an answer of this length is kept to.
type Question ¶
type Question struct {
ID string
Character string
Text string
AskedAt int64
Answered bool
// Ref is the subject the question is about (a digest entry's ref, see docs/digest.md); empty for a
// free-typed question. The advisor expands it into the entry's facts.
Ref string
// Icy is set when the player pressed Check guides: the same question is asked again and the AI
// client may read the matching WoW Forever guide at runtime.
Icy bool
}
Question is one queued question.
type Registry ¶ added in v0.3.0
type Registry interface {
// Paths are the user's and the system's PATH values, %VAR% references already expanded.
Paths(getenv func(string) string) []string
}
Registry reads the PATH the machine's settings hold, as opposed to the one this process was started with. A fake stands in for it in tests so they run on any OS.
type Source ¶ added in v0.7.109
type Source struct{ Title, URL string }
Source is a guide page an answer read: its title and address.
func GuidePages ¶ added in v0.7.109
GuidePages are the allowed guide pages among urls (what a client's own tool read), as sources.
type Trace ¶ added in v0.7.30
type Trace struct {
// contains filtered or unexported fields
}
Trace collects the entities seen in one ask's tool calls and results, oldest first.
type Usage ¶ added in v0.3.0
type Usage struct {
Tokens int // input, output and cache tokens together
In int // fresh input: new input plus tokens written to the cache
Out int // output
Cached int // tokens read from the cache
CostUSD float64 // total_cost_usd, when reported
Model string // the model that ran: reported by Claude, else the one the command line selected
Notice string // a one-line notice for the player, e.g. a rejected flag that was dropped
Saved string // the line a successful set_character_profile returned, for the end of the answer
Pages []string // the web pages a CLI client read for the guides, in order
Sources []Source // the guide pages the fetch tool read for an API client, in order
Check string // the guide check's note: no page matched, or a fetch failed; "" when the client reported none
Checked bool // an API client ran a guide check, so Check is complete
Entities []Entity // what the answer's tools touched, oldest first (empty when the client shows no tool trace)
}
Usage is what the CLI reported for one ask. Tokens is zero when it reported nothing.
func RespondUsage ¶ added in v0.3.0
func RespondUsage(ctx context.Context, cfg Config, q Question, prompt string, stream bool, onText func(string)) (text string, streamed bool, usage Usage, err error)
RespondUsage is Respond that also returns the token usage Claude's stream-json result reports.
With cfg.Fallback set, a client that cannot start (no key, not reachable, key refused, no such program) hands over to the next one, and the usage notice says so.
Source Files
¶
- ammobagfacts.go
- api.go
- ask.go
- bagguard.go
- command.go
- command_other.go
- creaturefacts.go
- detect.go
- disenchant.go
- facts.go
- gatherfacts.go
- guide.go
- guidelookup.go
- guides.go
- icy.go
- itemfacts.go
- knowhow.go
- launch.go
- lootroll.go
- needs.go
- options.go
- placefacts.go
- probe.go
- questfacts.go
- registry_other.go
- rewardfacts.go
- session.go
- setfacts.go
- standing.go
- stream.go
- subject.go
- trace.go
- travelfacts.go
- watch.go
- weapons.go
- wowhead.go