kimi-code/docs/plans
liruifengv 34d47a22bc
feat(desktop): unify the host identity and mark OAuth logins as desktop-originated (#159)
* feat(desktop): add kimi-code:// deep link to surface the app after OAuth login

The OAuth device-flow completion page can now link to
kimi-code://auth/success to bring the desktop window to the front once
the user finishes authorizing in the browser. No credentials ride the
URL: the daemon's device-flow poll completes the login on its own and
the renderer converges through its existing daemon polling, so the only
deep-link action is showing the main window.

- main/deep-link.ts: scheme constant, a strict URL whitelist (any
  webpage can fire the scheme), dev-only setAsDefaultProtocolClient,
  and the showMainWindow handler
- main/app.ts: macOS open-url listener registered before ready, queued
  until launch routing is up (same pattern as second-instance argv);
  Windows/Linux deliver the URL via argv and are covered by the existing
  second-instance / cold-start paths
- electron-builder.config.cjs: top-level protocols so packaged builds
  register the scheme (macOS Info.plist, Windows registry, Linux
  x-scheme-handler in the desktop file)

* fix(desktop): gate second-instance deep links through the URL whitelist

Windows/Linux deliver deep links as plain argv, and the second-instance
handler surfaced the window unconditionally — any webpage could fire
kimi-code://anything to steal focus. Route those argv through
handleDeepLink so only whitelisted URLs focus the window; plain
relaunches (no URL in argv) keep the existing always-show behavior,
including launches queued before the window is ready.

Also redact rejected deep-link URLs with redactUrlForLog before they
reach the persistent log, so a malformed auth link cannot persist codes
or tokens from its query or fragment.

* feat(desktop): unify the host identity and mark OAuth logins as desktop-originated

Resolve the desktop host identity once (main/identity.ts) and pass it to
the embedded server through kap-server's new typed hostIdentity option:
the OAuth device flow, model, and WebSearch requests now all carry the
desktop's User-Agent + X-Msh-* set (kimi_code_desktop) with headers
derived downstream — the manual X-Msh-Platform override, the header-seed
plumbing, and the device-id scraping are gone. The engine version keeps
traveling as serverVersion.

first_launch now means the desktop product's first launch: a marker in
ui-state.json instead of the shared device_id file, whose existence only
proves some kimi-code product ran before (the CLI could silently swallow
the desktop's first launch). No migration for existing installs.

The OAuth verification URL opened from the login dialog and onboarding
wizard gains from=kimi_code_desktop, so the authorization page can offer
an "open the desktop app" handoff only for desktop-originated flows;
CLI and web URLs stay bare.

Design doc: docs/plans/2026-07-29-host-identity-unification.md. Requires
the kimi-code host-identity unification (submodule bump follows its
merge).

* chore: bump kimi-code submodule to the host-identity branch

Point the submodule at feat/host-identity-unification HEAD (f2a293c02)
so the desktop builds against the new kap-server hostIdentity API.
Update to the main merge commit once MoonshotAI/kimi-code#2382 lands.

* docs(desktop): trim the host-identity native-todos entry to the divergence essentials

* docs(desktop): drop the native-todos entries for deep link and host identity

* docs: drop the review-tool mention from the host-identity plan

* chore: bump kimi-code submodule to the merged host-identity commit

Point the submodule at the main merge commit of the host-identity
unification (MoonshotAI/kimi-code#2382), replacing the temporary pointer
at the feature branch head.

* chore: sync the lockfile with long-declared workspace deps

kap-server's minidb and node-sdk's agent-core-v2/klient links were
declared in package.json by earlier PRs but never written into the
lockfile; pnpm install registers them now.

* chore: drop the desktop host-identity changeset
2026-07-30 14:00:41 +08:00
..
2026-07-10-code-app-split-phase0.md docs: add split design and phase-0 plan 2026-07-10 11:58:00 +08:00
2026-07-10-code-app-split-phase1.md docs: add code-app split phase 1-4 plans 2026-07-10 21:06:54 +08:00
2026-07-10-code-app-split-phase2.md docs: add code-app split phase 1-4 plans 2026-07-10 21:06:54 +08:00
2026-07-10-code-app-split-phase3.md docs: add code-app split phase 1-4 plans 2026-07-10 21:06:54 +08:00
2026-07-10-code-app-split-phase4.md docs: add code-app split phase 1-4 plans 2026-07-10 21:06:54 +08:00
2026-07-16-electron-43-upgrade.md chore: drop obsolete electron postinstall allowance and add electron 43 upgrade plan 2026-07-16 15:22:01 +08:00
2026-07-22-chat-scroll-stability.md fix(chat): stabilize transcript scrolling and streaming expand behavior (#80) 2026-07-22 19:57:25 +08:00
2026-07-23-custom-providers.md feat(desktop): add custom provider management in settings (#93) 2026-07-24 14:08:53 +08:00
2026-07-23-windows-native-pass.md feat: improve windows (#110) 2026-07-27 13:03:11 +08:00
2026-07-25-renderer-streaming-perf.md perf(renderer): eliminate streaming re-render amplification and session-switch scroll flash (#112) 2026-07-27 09:52:48 +08:00
2026-07-27-desktop-native-terminal.md feat(desktop): add a built-in native terminal (#132) 2026-07-29 11:47:03 +08:00
2026-07-27-desktop-telemetry-plan.md feat(desktop): collect host system metrics 2026-07-28 15:01:19 +08:00
2026-07-27-windows-custom-titlebar.md feat(desktop): add a custom Windows title bar (#123) 2026-07-27 17:23:03 +08:00
2026-07-29-host-identity-unification.md feat(desktop): unify the host identity and mark OAuth logins as desktop-originated (#159) 2026-07-30 14:00:41 +08:00
turn-activity-fold-handoff.md feat(chat): fold turn activity into a smart-summary row (#40) 2026-07-20 14:04:55 +08:00