-
Notifications
You must be signed in to change notification settings - Fork 370
feat: unify OpenMaus model picker with fleet catalog #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lightcloud00
wants to merge
4
commits into
milind-soni:main
Choose a base branch
from
lightcloud00:codex/openmaus-fleet-catalog-20260822
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
727bff1
feat(models): project fleet catalog into OpenMausBot
lightcloud00 8d98ce3
Merge remote-tracking branch 'origin/main' into codex/openmaus-fleet-…
lightcloud00 277170c
fix(models): harden OpenMaus fleet catalog switching
lightcloud00 06bb384
test(models): exercise persistence rollback portably
lightcloud00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { hermesAcpModelId } from "./hermes.ts"; | ||
|
|
||
| describe("hermes fleet model translation", () => { | ||
| it("passes a guarded Hermes route alias to session/set_model", () => { | ||
| expect(hermesAcpModelId("litellm-local:minimax-m3-light")).toBe("litellm-local:minimax-m3-light"); | ||
| expect(hermesAcpModelId("litellm-local:MiniMax-M3")).toBe("litellm-local:MiniMax-M3"); | ||
| expect(hermesAcpModelId("minimax-m3-light")).toBeNull(); | ||
| }); | ||
|
|
||
| it("keeps local host injection syntax and rejects malformed ids", () => { | ||
| expect(hermesAcpModelId("ollama::qwen3:14b")).toBe("custom:ollama:qwen3:14b"); | ||
| expect(hermesAcpModelId("bad model\nnext")).toBeNull(); | ||
| expect(hermesAcpModelId("litellm-local:qwen\n")).toBeNull(); | ||
| }); | ||
| }); |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import { createServer, type Server } from "node:http"; | ||
| import { afterEach, describe, expect, it } from "vitest"; | ||
| import { z } from "zod"; | ||
|
|
||
| import type { ProviderInstance } from "../contracts.ts"; | ||
| import { parseJson, type JsonValue } from "../schema.ts"; | ||
| import { recordEvents, type EventRecorder } from "../testing/events.ts"; | ||
| import { decodeFleetLocalSelector, LocalDriver } from "./local.ts"; | ||
|
|
||
| let server: Server | null = null; | ||
| let instance: ProviderInstance | null = null; | ||
| let recorder: EventRecorder | null = null; | ||
| const requests: Array<{ url: string; body: JsonValue | null }> = []; | ||
| const chatRequestSchema = z.object({ model: z.string() }).passthrough(); | ||
|
|
||
| async function fakeHost(finalFrameWithoutNewline = false): Promise<string> { | ||
| server = createServer((request, response) => { | ||
| let raw = ""; | ||
| request.on("data", (chunk) => raw += chunk); | ||
| request.on("end", () => { | ||
| const body = raw ? parseJson(raw) : null; | ||
| requests.push({ url: request.url ?? "", body }); | ||
| const json = (payload: JsonValue) => { | ||
| response.writeHead(200, { "content-type": "application/json" }); | ||
| response.end(JSON.stringify(payload)); | ||
| }; | ||
| if (request.url === "/v1/models") return json({ data: [{ id: "qwen3.8:27b-mlx" }] }); | ||
| if (request.url === "/api/ps") return json({ | ||
| models: [{ name: "qwen3.8:27b-mlx", context_length: 65_536 }], | ||
| }); | ||
| if (request.url === "/v1/chat/completions") { | ||
| response.writeHead(200, { "content-type": "text/event-stream" }); | ||
| if (finalFrameWithoutNewline) { | ||
| response.end(`data: ${JSON.stringify({ choices: [{ delta: { content: "tail" } }] })}`); | ||
| return; | ||
| } | ||
| response.write(`data: ${JSON.stringify({ choices: [{ delta: { content: "hello" } }] })}\n\n`); | ||
| response.end("data: [DONE]\n\n"); | ||
| return; | ||
| } | ||
| response.writeHead(404).end(); | ||
| }); | ||
| }); | ||
| const running = server; | ||
| return new Promise((resolve) => running.listen(0, "127.0.0.1", () => { | ||
| // SAFETY: a TCP server listening on an ephemeral IPv4 port returns an AddressInfo object. | ||
| const address = running.address() as { port: number }; | ||
| resolve(`http://127.0.0.1:${address.port}/v1`); | ||
| })); | ||
| } | ||
|
|
||
| afterEach(async () => { | ||
| recorder?.stop(); | ||
| recorder = null; | ||
| await instance?.dispose(); | ||
| instance = null; | ||
| const running = server; | ||
| await new Promise<void>((resolve) => { | ||
| if (!running) return resolve(); | ||
| running.closeIdleConnections(); | ||
| running.close(() => resolve()); | ||
| }); | ||
| server = null; | ||
| requests.length = 0; | ||
| }); | ||
|
|
||
| describe("fleet local selectors", () => { | ||
| it("keeps Mac and Windows namespaces disjoint", () => { | ||
| expect(decodeFleetLocalSelector("ollama-mac/qwen3.8:27b-mlx", "mac")).toBe("qwen3.8:27b-mlx"); | ||
| expect(decodeFleetLocalSelector("ollama-windows/qwen3.8:27b-mlx", "mac")).toBeNull(); | ||
| expect(decodeFleetLocalSelector("bad model", "mac")).toBeNull(); | ||
| }); | ||
|
|
||
| it("runs the canonical Mac selector as the host-native model", async () => { | ||
| instance = await LocalDriver.create({ | ||
| instanceId: "localMac", | ||
| displayName: "Mac M5 models", | ||
| environment: {}, | ||
| enabled: true, | ||
| config: { host: "custom", url: await fakeHost(), fleetHost: "mac" }, | ||
| }); | ||
| recorder = recordEvents(instance.adapter); | ||
| // The transport checks only readiness; the guarded fleet projection owns | ||
| // every picker row and its chat/non-chat classification. | ||
| expect(instance.models.options).toEqual([]); | ||
| expect(await instance.snapshot()).toMatchObject({ state: "available" }); | ||
| await instance.adapter.sendTurn({ | ||
| threadId: "local-turn", | ||
| text: "hi", | ||
| model: "ollama-mac/qwen3.8:27b-mlx", | ||
| }); | ||
| await recorder.until((event) => event.type === "turn.completed"); | ||
| const chatRequest = requests.find((request) => request.url === "/v1/chat/completions"); | ||
| expect(chatRequestSchema.parse(chatRequest?.body).model).toBe("qwen3.8:27b-mlx"); | ||
| expect(recorder.events).toContainEqual(expect.objectContaining({ type: "item.completed", text: "hello" })); | ||
| }); | ||
|
|
||
| it("processes a final SSE frame without a trailing newline", async () => { | ||
| instance = await LocalDriver.create({ | ||
| instanceId: "localMac", | ||
| displayName: "Mac M5 models", | ||
| environment: {}, | ||
| enabled: true, | ||
| config: { host: "custom", url: await fakeHost(true), fleetHost: "mac" }, | ||
| }); | ||
| recorder = recordEvents(instance.adapter); | ||
| await instance.adapter.sendTurn({ | ||
| threadId: "local-tail-turn", | ||
| text: "hi", | ||
| model: "ollama-mac/qwen3.8:27b-mlx", | ||
| }); | ||
| await recorder.until((event) => event.type === "turn.completed"); | ||
| expect(recorder.events).toContainEqual(expect.objectContaining({ type: "item.completed", text: "tail" })); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.