Skip to content

feat(sdk): bind local model for text queries - #2457

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/sdk-minimum-text-query
Aug 24, 2026
Merged

feat(sdk): bind local model for text queries#2457
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/sdk-minimum-text-query

Conversation

@limityan

Copy link
Copy Markdown
Collaborator

Summary

  • require one process-lifetime model configuration when starting the TypeScript SDK
  • install that model into the native SDK Host as a runtime-only configuration and bind all Sessions/Queries to it
  • stream assistant text and one terminal Result through the existing Agent Runtime, with bounded cancel/close/process cleanup
  • verify the same built SDK through Node and Bun against a real native Host

Type and Areas

Type: Feature

Areas: TypeScript SDK, native SDK Host, Rust core model resolution

Motivation / Impact

Trusted local applications can now start the repository-internal SDK with their own model credentials and execute the minimum end-to-end Agent Query without a preinstalled BitFun application or persisted BitFun model configuration.

The API key is sent once over the managed Host stdin connection, remains process-local, and is removed when the connection shuts down. hostPath is currently required to be an explicit absolute path so PATH or environment-variable resolution cannot redirect the credential-bearing handshake.

This remains a private, unpublished local slice. It does not add callbacks, custom functions, structured output, usage reporting, Session resume, Python support, or native package staging.

Verification

  • pnpm --dir sdk/typescript run type-check — passed
  • pnpm --dir sdk/typescript test — 63 passed, 1 platform-specific skip
  • Node 24.14.1 real native Host smoke — passed; one model request, streamed text, terminal Result, cleanup, and credential scan
  • Bun 1.4.0 real native Host smoke using the same dist — passed
  • cargo test -p bitfun-sdk-host --tests — 50 passed
  • cargo test -p bitfun-sdk-host-app --tests — 21 passed
  • focused Core runtime-model overlay, AI client, and Turn-admission tests — passed
  • cargo fmt -p bitfun-core -p bitfun-sdk-host -p bitfun-sdk-host-app -- --check — passed
  • git diff --check gcwing/main...HEAD — passed

Workspace-wide cargo check --workspace was not completed in this worktree: the first attempt hit a TLS EOF while downloading sherpa-onnx; the retry passed that dependency and stopped because the desktop build expects the separately generated src/mobile-web/dist resource. SDK-scoped checks above are green.

Reviewer Notes

  • Protocol version moves from 1 to 2 and remains marked not_delivered; no published compatibility promise exists yet.
  • The runtime model overlay is intentionally visible only to Turn admission and AI client construction. Persisted config reads, exports, backups, and disk files remain unchanged.
  • Exact diff size: one commit, 29 files, 2000 insertions and 142 deletions (2142 changed lines).
  • Rollback is the single commit on this branch.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

Require one process-lifetime model configuration, keep its credentials runtime-only, and exercise the same SDK build through Node and Bun against the native Host.
@limityan
limityan merged commit a10728f into GCWing:main Aug 24, 2026
9 checks passed
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