Skip to content

feat(schema): the shared OpenAI-compatible LLM vocabulary (#LLMSpec/#LLMParams) - #136

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/llm-schema
Sep 16, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/llm-schema

Conversation

@atrawog

@atrawog atrawog commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

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: 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)

…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)*
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 56bb6407733d1e2bfd214c34c72356c49ecedf70

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.

  • Change class: contract/schema (CUE source + regenerated Go + tests), 1 atomic commit, 3 files, +422/−0.
  • SDD (B13): schema/llm.cue → spec/cue_types_gen.go regenerated in the same commit; every field/@go tag and every one of the 6 defs (LLMSpec, LLMParams, LLMResponseFormat, LLMReasoning, LLMStreamOptions, LLMNamedToolChoice) cross-checked one-for-one against the generated structs — no drift, no hand-written wire type, no naked generated-file edit (e).
  • R10/A2/B12: gate for this class is task cue:gen + TestGenReproducible + the new schema/llm_test.go cases; the tests would fail without the new defs (verified from the diff), and the abbreviated transcript is internally consistent and matches meta exactly (142+127+153 = 422 additions). No bed is required for a runtime-less contract module.
  • Architecture (B16): placement: CORRECT — a wire SHAPE for two out-of-process consumers belongs in the spec contract module, CUE-first.
  • A1/A3: body accounts for every diff item, no description↔code mismatch, ends with the italicized *Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)*; tier is the maximum achievable for a schema change whose tests executed.
  • No comments on the PR to reconcile.

Verdict: PASS


opencode/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

[step: review]

Review — PASS

Head SHA: 56bb6407733d1e2bfd214c34c72356c49ecedf70

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.

  • Change class: contract/schema (CUE source + regenerated Go + tests), 1 atomic commit, 3 files, +422/−0.
  • SDD (B13): schema/llm.cue → spec/cue_types_gen.go regenerated in the same commit; every field/@go tag and every one of the 6 defs (LLMSpec, LLMParams, LLMResponseFormat, LLMReasoning, LLMStreamOptions, LLMNamedToolChoice) cross-checked one-for-one against the generated structs — no drift, no hand-written wire type, no naked generated-file edit (e).
  • R10/A2/B12: gate for this class is task cue:gen + TestGenReproducible + the new schema/llm_test.go cases; the tests would fail without the new defs (verified from the diff), and the abbreviated transcript is internally consistent and matches meta exactly (142+127+153 = 422 additions). No bed is required for a runtime-less contract module.
  • Architecture (B16): placement: CORRECT — a wire SHAPE for two out-of-process consumers belongs in the spec contract module, CUE-first.
  • A1/A3: body accounts for every diff item, no description↔code mismatch, ends with the italicized *Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)*; tier is the maximum achievable for a schema change whose tests executed.
  • No comments on the PR to reconcile.

Verdict: PASS


opencode/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 16, 2026 20:33
@github-actions
github-actions Bot merged commit fdde85f into main Sep 16, 2026
2 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 16, 2026
@aitrawog
aitrawog deleted the feat/llm-schema branch September 25, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant