Repository navigation
hive/openai-server: OpenAI's whole API, in front of every nurse hum reaches - #97
Merged
Merged
Conversation
…eaches
An audit of openai-server against a real humd found it mostly broken for real clients: tool results that never came back, conversations re-sent whole into shared sigils, every sampling setting dropped, errors returned as 200s, and Claude never seeing a tool. This rebuilds the hive and fixes what it rested on.
**The wire (0.8.0, unreleased)**
- A prompt's `graft` carries the blooms of its sigil before it, each `{ content, grew }`, for a cell that did not grow them; a prompt with no content grows on from its graft. Petals no longer carry a `role`, and `petal-cell` is gone.
- `scion` on a prompt is the text after the bloom, for filling in the middle.
- A forager's breath says what it can reach, `models`, `scents` and `tools`, breathed again when that changes; the client core hands the bee every breath, the admitting one included.
- The thrum declares `scent`, an embedding, served by an attendant for the models its hello names and routed by model; no bloom is handed it, and no attendant may offer a tool named `scent` or `bash`.
- `error.code` names `no-nurse`, `cannot-grow-on` and `empty-prompt`; `wilt.reason` names `stop`, `max_tokens`, `refusal` and `cancel`.
**humd**
- A reach for a forager's own tool now records the nurse that reached, so the forager's answer comes back; it never did, for any forager hive.
- `cancel` and `cleanup` follow a bloom to the peer whose nurse grows it.
- A prompt with no `modelId` goes to any nurse with room; the kernel's `"sonnet"` default and its dead `CLAUDE_CLI_PATH` are gone.
**hum-nest speaks no hive**
- A cell is fed its sigil's tones and gives tones back; everything Claude-specific moved into claude-cli. The `Egg` is what any nurse raises a cell from.
- A live cell is fed its sigil's next prompt only while the prompt grows the same way and its graft holds no bloom the cell did not grow; `Nurse::grows_on` says whether a nurse can grow on from a graft.
- A cell's MCP path is its sigil's sid as the wire carries it. It was the sid's hum id, so Claude behind openai-server never saw a tool.
- A raw wilt from a cell marks it wilted; every ollama bloom used to wilt twice.
**Nurses**
- claude-cli: `stream.rs` translates between tones and Claude Code's stream-json. A graft is stitched into the session transcript. The system prompt rides at the head of the session's first user turn, since Claude Code signed in with a subscription ignores `--system-prompt`. A `trellis` is `--json-schema` and its answer is the JSON alone; a `sepal` effort is `--effort`. Transcripts are found by the nest's resolved path, and a session is resumed or begun by whether it exists. Its session namespace and `~/.claude` paths left hum-identity and hum-paths.
- ollama: streams; takes the graft, the sampling options, `format` and `think`; grows plain text on through `/api/generate` with a suffix.
- dwarfstar: reads the graft.
**openai-server**
- One forager bee per API key (`key add|list|remove`, kept as sha256), anonymous when there are none.
- A conversation keeps one sigil while it only grows, by caller; strangers never share one; history travels as the graft.
- Chat completions: `stream` defaults off, usage only when asked, tool names exact, parallel tool calls, answers carried on, tools the server runs kept out, finish reasons and statuses true, a hang-up cancels.
- The Responses API: function calls, `previous_response_id` and `conversation`, stored responses to `GET` and `DELETE`, server-run tools as `mcp_call` items.
- `/v1/completions` with `suffix`, `/v1/embeddings` through `scent`, `/v1/models` from the breath with each model's server-run `tools`, CORS, a rate per key, timeouts and keepalives.
- The nurse half takes every setting, images and the graft, waits for every parallel answer, aborts on cancel, retries upstream, and follows the upstream's model list; a scent attendant serves its embedding models.
**Gone**
- The opencode recipe and the `hum recipes` mechanism with it; opencode is named nowhere.
- `ollama-gaps.md`, moved to #44.
**Site**
- The docs sync skips `vendor/`, whose third-party README broke every page locally.
- The bee hangs from the header, the word fades h, u, m, the sidebar is a file tree, the body takes the free width beside a narrow contents rail, and light mode is a real palette.
**Verified**
- `codegen --check`, tools/speech.py, tools/paths.py, the CI clippy line.
- `cargo test --locked` for codegen, hum-thrum, thrum-core, ensemble, sim, humd, hum, humctl, hum-nest, hum-identity, hum-paths: 59 suites, conformance across rs/ts/py/go/c included. New sim tests: a forager's tool comes back, scent routing, the breath listing, model-less prompts, a cancel following its bloom to a peer.
- openai-server: 34 offline tests driving the official OpenAI SDK against Node, a real humd and a scripted upstream; 15 live tests against Claude through the claude-cli nurse (opt-in, `HUM_LIVE_CLAUDE=1`).
- claude-cli, claude-repl, ollama-server, bash and web2 build and test; the dwarfstar stub builds warning-free; the TS, Python, Go and C clients pass their checks.
Closes #68. Closes #69. Refs #44.
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.
An audit of openai-server against a real humd found it mostly broken for real clients: tool results that never came back, conversations re-sent whole into shared sigils, every sampling setting dropped, errors returned as 200s, and Claude never seeing a tool. This rebuilds the hive and fixes what it rested on.
The wire (0.8.0, unreleased)
graftcarries the blooms of its sigil before it, each{ content, grew }, for a cell that did not grow them; a prompt with no content grows on from its graft. Petals no longer carry arole, andpetal-cellis gone.scionon a prompt is the text after the bloom, for filling in the middle.models,scentsandtools, breathed again when that changes; the client core hands the bee every breath, the admitting one included.scent, an embedding, served by an attendant for the models its hello names and routed by model; no bloom is handed it, and no attendant may offer a tool namedscentorbash.error.codenamesno-nurse,cannot-grow-onandempty-prompt;wilt.reasonnamesstop,max_tokens,refusalandcancel.humd
cancelandcleanupfollow a bloom to the peer whose nurse grows it.modelIdgoes to any nurse with room; the kernel's"sonnet"default and its deadCLAUDE_CLI_PATHare gone.hum-nest speaks no hive
Eggis what any nurse raises a cell from.Nurse::grows_onsays whether a nurse can grow on from a graft.Nurses
stream.rstranslates between tones and Claude Code's stream-json. A graft is stitched into the session transcript. The system prompt rides at the head of the session's first user turn, since Claude Code signed in with a subscription ignores--system-prompt. Atrellisis--json-schemaand its answer is the JSON alone; asepaleffort is--effort. Transcripts are found by the nest's resolved path, and a session is resumed or begun by whether it exists. Its session namespace and~/.claudepaths left hum-identity and hum-paths.formatandthink; grows plain text on through/api/generatewith a suffix.openai-server
key add|list|remove, kept as sha256), anonymous when there are none.streamdefaults off, usage only when asked, tool names exact, parallel tool calls, answers carried on, tools the server runs kept out, finish reasons and statuses true, a hang-up cancels.previous_response_idandconversation, stored responses toGETandDELETE, server-run tools asmcp_callitems./v1/completionswithsuffix,/v1/embeddingsthroughscent,/v1/modelsfrom the breath with each model's server-runtools, CORS, a rate per key, timeouts and keepalives.Gone
hum recipesmechanism with it; opencode is named nowhere.ollama-gaps.md, moved to ollama-server: Gap analysis — missing endpoints & fields for drop-in compatibility #44.Site
vendor/, whose third-party README broke every page locally.Verified
codegen --check, tools/speech.py, tools/paths.py, the CI clippy line.cargo test --lockedfor codegen, hum-thrum, thrum-core, ensemble, sim, humd, hum, humctl, hum-nest, hum-identity, hum-paths: 59 suites, conformance across rs/ts/py/go/c included. New sim tests: a forager's tool comes back, scent routing, the breath listing, model-less prompts, a cancel following its bloom to a peer.HUM_LIVE_CLAUDE=1).Closes #68. Closes #69. Refs #44.