Skip to content

docs(llm): name the two response shapes and export Provider so the API tier renders them - #170

Merged
laithalsaadoon merged 1 commit into
mainfrom
docs/llm-response-types
Sep 14, 2026
Merged

laithalsaadoon merged 1 commit into
mainfrom
docs/llm-response-types

Conversation

@laithalsaadoon

Copy link
Copy Markdown
Contributor

What

Type-only and comment-only changes in packages/llm/src, made so the @memhtml/llm slice of the generated API tier can render. No runtime statement changes: tsc emits the same JavaScript.

  • InvokeClient.send now resolves to a named, exported InvokeResult interface and ProxyFetch to a named, exported ProxyFetchResponse interface. The structural shapes are unchanged ({ readonly body?: Uint8Array | undefined } and { ok, status, text() }), so the recording fakes in tests/ and the platform Response satisfy them as before.
  • thinkingFor's inline return literal gains a member doc comment.
  • Provider is re-exported from index.ts, because ModelInfo.provider references it and TypeDoc warned that it was referenced but not included.
  • Three {@link} tags that pointed at module-private symbols (closingTagsFor, PROXY_BACKOFF, unwrapDoubleEncoded) become code spans.

Why

typedoc-plugin-markdown renders an object literal that sits inside a type argument (Promise<{ ... }>) as escaped \{ ... \} prose. apps/docs/tests/figures.test.ts walks the generated pages with the authored ones and reads that as an MDX expression, so the slice cannot merge while those two signatures are inline. The plugin fences a literal only when it is the direct return type and one of its members carries a doc comment (that is the thinkingFor fix); for a type argument the only brace-free rendering is a named declaration, which the page then links.

Measured with the typedoc CLI over packages/llm/src/index.ts: 4 warnings and 3 brace hits before this commit, 0 and 0 after.

Boundary

This PR is open-only under the maintenance authority: it adds two exported names to a workspace package's public surface and edits files under packages/llm/src, which is Laith's side of the line even though the change is type-level. Local gate (mise run check) result and CI are recorded below once they finish. The docs-only slice that depends on this is stacked on top in a second PR.

…I tier renders them

Type-only and comment-only. No runtime statement changes; tsc emits the same JavaScript.

- `InvokeClient.send` now resolves to a named `InvokeResult` interface and `ProxyFetch` to a
  named `ProxyFetchResponse` interface, both exported. typedoc-plugin-markdown renders an
  inline object literal inside `Promise<...>` as escaped `\{ ... \}` prose, which the docs
  site's MDX brace probe (`apps/docs/tests/figures.test.ts`) rejects; a named interface
  renders as a linked declaration. The structural shapes are unchanged, so every existing
  fake and the platform `Response` still satisfy them.
- `thinkingFor`'s inline return literal gains a member doc comment, which makes the plugin
  emit a fenced type-literal block instead of escaped prose.
- `Provider` is re-exported from `index.ts`: `ModelInfo.provider` references it and TypeDoc
  warned that it was referenced but not included.
- Three `{@link}` tags pointing at module-private symbols (`closingTagsFor`, `PROXY_BACKOFF`,
  `unwrapDoubleEncoded`) become code spans; TypeDoc cannot link a symbol the package does
  not export and warned on each.

Measured with the typedoc CLI over `packages/llm/src/index.ts`: 4 warnings and 3 brace hits
before, 0 and 0 after. Prepares the `@memhtml/llm` slice of the generated API tier, which
follows in a separate docs-only PR stacked on this one.
Copilot AI lite review requested due to automatic review settings September 10, 2026 07:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are confined to exported type names and documentation/link formatting with no runtime logic changes, and the updated types preserve the existing structural shapes.

Pull request overview

This PR makes type-only and doc/comment-only updates in @memhtml/llm so the generated API docs render cleanly (avoiding inline object-literal brace rendering issues) and TypeDoc can include all referenced public types. It keeps runtime behavior unchanged while introducing named, exported interfaces for previously inline structural return types and re-exporting Provider to satisfy TypeDoc’s public-surface requirements.

Changes:

  • Replace inline structural return types with named exported interfaces (InvokeResult, ProxyFetchResponse) to improve TypeDoc rendering/linking.
  • Re-export Provider from packages/llm/src/index.ts so ModelInfo.provider’s type is included in generated docs.
  • Convert broken {@link} references to code spans for module-private symbols, and add a doc comment to thinkingFor’s return member to trigger TypeDoc fencing.
File summaries
File Description
packages/llm/src/structured.ts Replace a {@link} to a module-private symbol with a code span to avoid broken TypeDoc links.
packages/llm/src/proxy.ts Introduce exported ProxyFetchResponse and update ProxyFetch to return it; adjust docs to avoid private-symbol links.
packages/llm/src/models.ts Add a member doc comment inside thinkingFor’s return type to influence TypeDoc rendering.
packages/llm/src/model-client.ts Replace {@link} to a module-private helper with a code span.
packages/llm/src/index.ts Re-export InvokeResult, ProxyFetchResponse, and Provider (type-only) so the public API slice is fully documentable.
packages/llm/src/client.ts Introduce exported InvokeResult and update InvokeClient.send to return it (shape unchanged).
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@laithalsaadoon

Copy link
Copy Markdown
Contributor Author

Local gate on this head (b733ba2): mise run check exit 0, 64/64 tasks, 3m24s, after mise run install on a clone reset to origin/main at 9ad7240. CI is 11/11 green and Copilot recommends approval with no comments.

Left open for Laith under the maintenance rules: it adds two exported names to @memhtml/llm's surface and edits packages/llm/src, so the maintenance run does not merge it. #171 (the @memhtml/llm API-tier slice) is stacked on this branch and retargets to main when this merges.

@laithalsaadoon
laithalsaadoon merged commit 0c620c6 into main Sep 14, 2026
12 checks passed
@laithalsaadoon
laithalsaadoon deleted the docs/llm-response-types branch September 14, 2026 15:03
@laithalsaadoon
laithalsaadoon restored the docs/llm-response-types branch September 14, 2026 15:06
@laithalsaadoon
laithalsaadoon deleted the docs/llm-response-types branch September 14, 2026 15:06
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.

2 participants