Skip to content

feat: add serving type generator, Vite plugin, and UI hooks#240

Open
pkosiec wants to merge 6 commits intopkosiec/serving-1-corefrom
pkosiec/serving-2-types-hooks
Open

feat: add serving type generator, Vite plugin, and UI hooks#240
pkosiec wants to merge 6 commits intopkosiec/serving-1-corefrom
pkosiec/serving-2-types-hooks

Conversation

@pkosiec
Copy link
Copy Markdown
Member

@pkosiec pkosiec commented Apr 3, 2026

Summary

  • Add Vite plugin that auto-generates TypeScript types from serving endpoint OpenAPI schemas
  • Add AST-based server file extraction (@ast-grep/napi) for automatic endpoint discovery
  • Add schema-to-TypeScript conversion with OpenAI-compatible streaming chunk inference
  • Add useServingInvoke and useServingStream React hooks with type-safe registry support

Demo

model-serving-demo-compressed.mp4

PR Stack — Model Serving

# PR Description
1 #239 Serving connector & plugin
2 this PR Type generator, Vite plugin & UI hooks
3 #241 Dev-playground, template & docs

@pkosiec pkosiec force-pushed the pkosiec/serving-1-core branch from 83dab4c to 76a2618 Compare April 3, 2026 10:04
@pkosiec pkosiec force-pushed the pkosiec/serving-2-types-hooks branch from 735aa72 to 9b7bcc1 Compare April 3, 2026 10:06
@pkosiec pkosiec force-pushed the pkosiec/serving-1-core branch from 76a2618 to 41a0074 Compare April 3, 2026 10:14
@pkosiec pkosiec force-pushed the pkosiec/serving-2-types-hooks branch from 9b7bcc1 to e2336c1 Compare April 3, 2026 10:16
pkosiec added 5 commits April 3, 2026 14:20
Add Vite plugin that auto-generates TypeScript types from serving
endpoint OpenAPI schemas. Includes AST-based server file extraction
(@ast-grep/napi), schema-to-TypeScript conversion, and caching.
Also adds useServingInvoke and useServingStream React hooks in
appkit-ui with full type-safe registry support.

Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
- Store requestKeys[] in serving cache instead of regex-parsing
  TypeScript type strings in schema-filter (fragile indentation dependency)
- Add overrideBody parameter to useServingStream's stream() to allow
  callers to pass fresh body without waiting for useMemo recomputation
- Lazy-init WorkspaceClient in type generator (skip when no endpoints resolve)

Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
Chunks persisted after onComplete, causing the streaming bubble to
remain visible alongside the committed message (duplicate response).
Now chunks are cleared atomically with setStreaming(false) so React
batches all state updates in one render.

Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
Clearing chunks in the hook's .then() handler caused a race with React
batching — chunks were empty before the component could commit them.
Let consumers decide when to clear via reset() instead.

Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
Without a .catch(), if connectSSE rejects the promise is unhandled and
setStreaming(false) never fires, leaving the hook in a broken state.
This matches the pattern used by the genie chat hook.

Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
@pkosiec pkosiec force-pushed the pkosiec/serving-2-types-hooks branch from 2657962 to 8687067 Compare April 3, 2026 12:25
The invoke callback is recreated whenever body changes (via useCallback
deps), which triggers the useEffect cleanup that aborts in-flight
requests. Adding overrideBody allows callers to use a stable body while
passing the real payload per-invocation, matching useServingStream.

Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
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