refactor: split SDK RPC client#339
Conversation
🦋 Changeset detectedLatest commit: a869ec7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7b1ec4fff
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c39d31e99
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| userAgentProduct: this.identity.userAgentProduct, | ||
| version: this.identity.version, |
There was a problem hiding this comment.
Preserve the identity user-agent suffix
When a host passes identity.userAgentSuffix, the local RPC client now rebuilds the headers with only userAgentProduct and version, so createKimiDefaultHeaders no longer receives the suffix and the generated User-Agent silently loses the host-provided qualifier. This regresses SDK callers that use the public KimiHostIdentity.userAgentSuffix to distinguish integrations; pass the full identity through as before instead of selecting only these two fields.
Useful? React with 👍 / 👎.
…c-client # Conflicts: # apps/kimi-code/test/cli/run-prompt.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ee739d65d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| setContext: setTelemetryContext, | ||
| }; | ||
| const harness = new KimiHarness({ | ||
| const harness = createKimiHarness({ |
There was a problem hiding this comment.
Mock createKimiHarness in goal prompt tests
When runPrompt is exercised by apps/kimi-code/test/cli/goal-prompt.test.ts, that suite's SDK mock still overrides only KimiHarness, not createKimiHarness; this changed call therefore instantiates the real local SDK harness instead of the fake session, so the headless goal tests no longer drive mocks.session and can fail or touch real SDK state. Update that remaining mock as the other CLI tests do before switching this path.
Useful? React with 👍 / 👎.
…onshotAI/kimi-code into xtr/split-node-sdk-rpc-client
Related Issue
No linked issue. This change comes from maintainer discussion to make the SDK harness usable with a transport supplied by web integrations.
Problem
The SDK harness constructed its local in-memory RPC client internally, which made it hard for other runtimes to provide their own RPC transport without reworking the harness itself. CLI startup also needed to keep using the local runtime path after the constructor split.
What changed
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.Verification
pnpm exec oxlint apps/kimi-code/src/cli/run-shell.ts apps/kimi-code/src/cli/run-prompt.ts apps/kimi-code/src/cli/sub/export.ts apps/kimi-code/test/cli/run-shell.test.ts apps/kimi-code/test/cli/run-prompt.test.ts apps/kimi-code/test/cli/export.test.ts apps/kimi-code/test/e2e/real-llm-smoke.e2e.test.ts apps/kimi-code/test/e2e/local-logging-export.e2e.test.ts packages/node-sdk/examples/kimi-harness-auth-smoke.ts packages/node-sdk/examples/t8-race-create.ts packages/node-sdk/src/kimi-harness.ts packages/node-sdk/src/local-rpc.tspnpm -C packages/node-sdk run typecheckpnpm -C apps/kimi-code run typecheckpnpm -C apps/kimi-code exec vitest run test/cli/run-shell.test.ts test/cli/run-prompt.test.ts test/cli/export.test.tspnpm dev:cli -- migrate