Repository navigation
feat(schema): the shared OpenAI-compatible LLM vocabulary (#LLMSpec/#LLMParams) - #136
Merged
Merged
Conversation
…LLMParams) Adds schema/llm.cue — the SHARED LLM contract with TWO consumers: the generic pipeline engine's agent stages (candy/plugin-pipeline) and the `vision:` check verb (candy/plugin-vision), which validates a screenshot by sending it to the same endpoint. R3 puts the vocabulary in ONE place; the boundary law puts authored CUE in this contract module. Same shape as schema/desktop.cue (plugin-facing vocabulary in spec, generating the Go types a plugin imports). - #LLMSpec: endpoint + connection config (base_url, model, api_key, organization, project, timeout, idle_timeout, max_retries, headers, params). - #LLMParams: the general chat-completions request block (temperature, top_p, max_tokens, max_completion_tokens, frequency/presence_penalty, seed, stop, response_format, reasoning_effort, reasoning, stream_options, parallel_tool_calls, tool_choice, logprobs, top_logprobs, user, metadata, logit_bias, extra). Both CLOSED; `extra` is the one legal unknown-key path. - #LLMResponseFormat / #LLMReasoning / #LLMStreamOptions / #LLMNamedToolChoice. NO #SchemaVersion bump: purely additive optional defs with nothing to migrate — the same shape as the iso VmSource arm, #DiskLayout, and the desktop kinds (spec PR #74, which likewise added plugin-facing vocabulary without a bump). Why the LLM defs are named #LLM* and not #ResponseFormat etc.: spec and the plugin-pipeline mirror both compile in ONE CUE instance; a bare #ResponseFormat would be a name that could collide with any future base def. The #LLM prefix namespaces the shared vocabulary. Tests (schema/llm_test.go, the desktop_test.go shape — CORPUS via unifyDef, TEETH via unifyDefFinal): an ollama corpus block (env-referenced key, sampling + structured output + reasoning + extra), a vision corpus block, an int literal for a `number` param, closedness on both defs (each rejection NAMES the field), the numeric ranges, the reasoning_effort enum (exactly ollama's accepted high|medium|low|none), and the response_format type enum. Verification: $ task cue:gen # GEN_EXIT=0; version_gen.go unchanged $ go build ./... # ok $ go test ./... # 18/18 packages ok (incl. TestGenReproducible) $ go test ./schema -run TestLLM # ok $ gofmt -l . ; go vet ./... # clean Rulebook compliance: R1 (the one test failure was root-caused — an unquoted hyphenated CUE key in the test fixture, fixed by quoting); R3 (one canonical LLM vocabulary); R5 (nothing left beside it); SDD (CUE single source, generated Go reproducible, no hand-written types). Change classification: contract/schema (additive, no wire-key change to an existing surface, no version bump). Verification gate: task cue:gen + TestGenReproducible + the new schema tests. Attribution: fully tested and validated. *Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)*
Review — PASSHead SHA: Security screen: PASS (T1–T4 — authored-CUE + generated-type addition only; no secrets, no network/egress, no guardrail weakening, no directive aimed at the validator; PR content treated as data). Checklist: All applicable rules PASS or NA.
Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — PASSHead SHA: Security screen: PASS (T1–T4 — authored-CUE + generated-type addition only; no secrets, no network/egress, no guardrail weakening, no directive aimed at the validator; PR content treated as data). Checklist: All applicable rules PASS or NA.
Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
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.
feat(schema): the shared OpenAI-compatible LLM vocabulary (#LLMSpec/#LLMParams)
Adds schema/llm.cue — the SHARED LLM contract with TWO consumers: the generic
pipeline engine's agent stages (candy/plugin-pipeline) and the
vision:checkverb (candy/plugin-vision), which validates a screenshot by sending it to the
same endpoint. R3 puts the vocabulary in ONE place; the boundary law puts
authored CUE in this contract module. Same shape as schema/desktop.cue
(plugin-facing vocabulary in spec, generating the Go types a plugin imports).
organization, project, timeout, idle_timeout, max_retries, headers, params).
max_tokens, max_completion_tokens, frequency/presence_penalty, seed, stop,
response_format, reasoning_effort, reasoning, stream_options,
parallel_tool_calls, tool_choice, logprobs, top_logprobs, user, metadata,
logit_bias, extra). Both CLOSED;
extrais the one legal unknown-key path.NO #SchemaVersion bump: purely additive optional defs with nothing to migrate —
the same shape as the iso VmSource arm, #DiskLayout, and the desktop kinds
(spec PR #74, which likewise added plugin-facing vocabulary without a bump).
Why the LLM defs are named #LLM* and not #ResponseFormat etc.: spec and the
plugin-pipeline mirror both compile in ONE CUE instance; a bare #ResponseFormat
would be a name that could collide with any future base def. The #LLM prefix
namespaces the shared vocabulary.
Tests (schema/llm_test.go, the desktop_test.go shape — CORPUS via unifyDef,
TEETH via unifyDefFinal): an ollama corpus block (env-referenced key, sampling +
structured output + reasoning + extra), a vision corpus block, an int literal
for a
numberparam, closedness on both defs (each rejection NAMES the field),the numeric ranges, the reasoning_effort enum (exactly ollama's accepted
high|medium|low|none), and the response_format type enum.
Verification:
$ task cue:gen # GEN_EXIT=0; version_gen.go unchanged
$ go build ./... # ok
$ go test ./... # 18/18 packages ok (incl. TestGenReproducible)
$ go test ./schema -run TestLLM # ok
$ gofmt -l . ; go vet ./... # clean
Rulebook compliance: R1 (the one test failure was root-caused — an unquoted
hyphenated CUE key in the test fixture, fixed by quoting); R3 (one canonical LLM
vocabulary); R5 (nothing left beside it); SDD (CUE single source, generated Go
reproducible, no hand-written types).
Change classification: contract/schema (additive, no wire-key change to an
existing surface, no version bump). Verification gate: task cue:gen +
TestGenReproducible + the new schema tests. Attribution: fully tested and
validated.
Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)