Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.
TypeScript agent-teamagentic-aiai-agentsai-assistantclaude-codecodexcursorelectrongrokgrok-bot-alternativelinuxlocal-firstmacosmcpmulti-agentopenclaw-alternativeopencodewindows
Keep a Codex model with priority 0 at the top of the list (#55)
Rayanne B. Lima1192ac0184b4
diff --git a/src/core/engines/detect.ts b/src/core/engines/detect.tsindex 4104301..f26a7b6 100644--- a/src/core/engines/detect.ts+++ b/src/core/engines/detect.ts@@ -118,13 +118,16 @@ export interface CodexModel {description?: string}+// 0 is the top of the list, not a missing priority.+const priorityOf = (p: unknown): number => (typeof p === 'number' ? p : 999)+export function parseCodexCatalog(json: string): CodexModel[] {try {const d = JSON.parse(json) as { models?: unknown } | unknown[]const list = (Array.isArray(d) ? d : Array.isArray(d.models) ? d.models : []) as { slug?: unknown; display_name?: unknown; description?: unknown; visibility?: unknown; priority?: unknown }[]return list.filter((m) => typeof m.slug === 'string' && m.slug && (m.visibility === undefined || m.visibility === 'list'))- .sort((a, b) => (Number(a.priority) || 999) - (Number(b.priority) || 999))+ .sort((a, b) => priorityOf(a.priority) - priorityOf(b.priority)).map((m) => ({slug: m.slug as string,label: typeof m.display_name === 'string' && m.display_name ? m.display_name : (m.slug as string),diff --git a/test/codex-models.test.ts b/test/codex-models.test.tsindex 57cc085..ec071f0 100644--- a/test/codex-models.test.ts+++ b/test/codex-models.test.ts@@ -21,6 +21,11 @@ describe("Codex's own catalog", () => {])})+ it('keeps priority 0 at the top, and one with no priority last', () => {+ const list = parseCodexCatalog(JSON.stringify([{ slug: 'none' }, { slug: 'second', priority: 1 }, { slug: 'first', priority: 0 }]))+ expect(list.map((m) => m.slug)).toEqual(['first', 'second', 'none'])+ })+it('takes a bare list (the cache file) and bad output without breaking', () => {expect(parseCodexCatalog(JSON.stringify([{ slug: 'x' }]))).toEqual([{ slug: 'x', label: 'x' }])expect(parseCodexCatalog('')).toEqual([])