feat(cloud): 馃 map tool effort onto catalog medium and xhigh - #3
Open
aipal-agent wants to merge 2 commits into
Open
aipal-agent wants to merge 2 commits into
aipal-agent wants to merge 2 commits into
Conversation
Live grok-4.6 catalogs list medium and xhigh, not med. Send the catalog value, merge the default variant when fast is omitted, and label colliding variant displayNames from params. Co-authored-by: AIPAL GROK (4.6) <aipal_grok@uklok.ai> Co-authored-by: Cursor <cursoragent@cursor.com>
yonathan9669
added this pull request to stack #5
September 29, 2026 06:56
yonathan9669
requested changes
Sep 29, 2026
Comment on lines
+13
to
+40
| const EFFORT_ALIASES: Record<EffortLevel, string[]> = { | ||
| low: ["low", "minimal", "min"], | ||
| med: ["medium", "med", "mid"], | ||
| high: ["high"], | ||
| xhigh: ["xhigh", "extra_high", "extrahigh", "max"], | ||
| }; | ||
|
|
||
| export function isEffortParamId(id: string): boolean { | ||
| const raw = id.trim().toLowerCase(); | ||
| return raw === "effort" || raw === "thinking" || raw === "reasoning" || raw.endsWith("_effort") || raw.includes("thinking"); | ||
| } | ||
|
|
||
| export function normalizeEffort(value?: string): EffortLevel | undefined { | ||
| const raw = value?.trim().toLowerCase(); | ||
| if (!raw) { | ||
| return undefined; | ||
| } | ||
| if (raw === "low" || raw === "med" || raw === "high") { | ||
| if (raw === "low" || raw === "med" || raw === "high" || raw === "xhigh") { | ||
| return raw; | ||
| } | ||
| if (raw === "medium" || raw === "mid") { | ||
| return "med"; | ||
| } | ||
| throw new ConfigError(`effort must be low, med, or high (got '${value}')`); | ||
| if (raw === "extra_high" || raw === "extrahigh" || raw === "extra-high") { | ||
| return "xhigh"; | ||
| } | ||
| throw new ConfigError(`effort must be low, med, high, or xhigh (got '${value}')`); | ||
| } |
There was a problem hiding this comment.
This could be easily rewritten as a mapper which results into a clear own-less principle alignment as the SoT is narrowed from code to data itself, therefore future changes surface is reduced too.
Example:
if (EFFORT_ALIASES[raw] != null) return raw;
const match = Object.entries(EFFORT_ALIASES).find(([effort, aliases]) =>
aliases.includes(raw)
)?.[0];
if (match) return match;
throw new ConfigError(`effort must be low, med, high, or xhigh (got '${value}')`);
Contributor
Author
There was a problem hiding this comment.
The alias table is the mapper. A spelling that is already a tool level sits in that level's list, so one lookup covers both the key and the aliases. The schema, the CLI help, and the models payload read that same table. The package split carries the same change.
Input branches, the tool schema, and the models payload were a second copy of the spellings. The table now maps a spelling to a level and supplies the preferred catalog value. Co-authored-by: AIPAL GROK (4.6) <aipal_grok@uklok.ai> Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2
Dependency: #1 on
feat/cloud-followup-status-watch.Outcome
Launch and the models tool speak the live catalog.
effort=medis sent asmediumwhen that is the listed value.xhighis extra high. Omittingfastkeeps the model's default. Variant names that would otherwise collide are labeled from their parameters. When the agent record has no model, status reports the source as unknown.Changes
Tool effort and the wire mapper share one catalog walk. Reply still fails closed when model, effort, or fast is set on a follow-up.
Acceptance
git checkout feat/map-grok-effort-catalog npm testExpect 16 files and 52 tests. The launch test sends
mediumforeffort=med. The models tool returnstoolEffortand labeled variants.Boundaries
Rollback
Revert this pull request. The mapping writes nothing on the host. Existing ledger rows keep the request fields already stored.