chore: merge upstream main (5c0ec2938a) into fork - #24
Merged
Conversation
* feat: support plugin-contributed custom agents * fix: await plugin loading before agent catalog * fix: refresh plugin agents on v1 reload * test(agent-core-v2): add enabledSystemPrompts to the plugin service stub
* fix: remove the blocking wait from the TaskOutput tool The block/timeout parameters let a model stall the whole turn waiting for a background task (up to 3600s), even though completion already arrives via automatic notification. Remove both parameters from the v1 and v2 engines (kept in model-facing parity), simplify retrieval_status to success/not_ready, and update the tool, Bash, and Agent prompt wording plus user docs accordingly. Stale callers passing block are silently treated as a non-blocking snapshot. * fix: align background-task prompts with the non-blocking TaskOutput The compaction reminder promised TaskOutput could fetch a task's result for tasks that are still running, where it now returns not_ready — reword it to snapshot semantics and point at the completion notification. Also list AskUserQuestion(background=true) as a task source in the TaskOutput description. * test: exercise stale TaskOutput args through the runtime validator A stale block/timeout argument never reaches the tool: the executor's preflight validates args against the closed tool schema and rejects them immediately, so the old test documented silent-tolerance semantics the runtime never exhibits. Assert the real behavior through compileToolArgsValidator/validateToolArgs instead, and drop statement-adjacent comments to match the package's header-only comment convention.
…MoonshotAI#2382) * refactor(oauth): make X-Msh-Platform an explicit host identity field X-Msh-Platform was hardcoded to kimi_code_cli in createKimiDeviceHeaders, so non-CLI hosts could not state their own platform and the desktop had to patch the header after the fact. KimiHostIdentity now carries a required platform (every host declares its own value; the CLI constant stays the fallback only for direct createKimiDeviceHeaders callers), and userAgentProduct is renamed to productName so the transport identity uses one name everywhere. All in-repo identity constructions pass platform explicitly; the wire value for CLI and VS Code hosts is unchanged (kimi_code_cli). * feat(agent-core-v2): carry the host identity in the bootstrap snapshot Replace the flat clientVersion field with a required clientIdentity (KimiHostIdentity) so every consumer reads the same host identity object: OAuthToolkitService now passes it to the OAuth toolkit, which means the OAuth device-flow endpoints (device authorization, token polling, refresh) on the kap-server path finally send the full X-Msh-* device headers instead of none, and the telemetry cloud appender reads client_version from the same source. A built-in CLI fallback keeps bare bootstrap() calls in tests working; composition roots must pass their own identity. The session export manifest grows an optional desktopVersion field (payload plumbed through; filled by kap-server in a follow-up). * feat(agent-core): thread the host identity into the managed auth facades The v1 managed auth facade constructed its OAuth toolkit without an identity, so token refreshes from inside the core went out without any X-Msh-* device headers. createManagedAuthFacade now takes an optional KimiHostIdentity and every call site supplies one: CoreProcessService._defaultOAuthTokenResolver forwards the core process's options.identity (the same source _defaultKimiRequestHeaders uses), and the DI-held services (oauth / auth summary / model catalog) read it from a new optional identity field on IEnvironmentService. The library-level "no identity, no device headers" contract is unchanged. * feat(kap-server)!: require the host identity and derive request headers from it ServerStartOptions.hostIdentity is now a required ServerHostIdentity (KimiHostIdentity + optional prompt display fields), replacing both the old optional HostIdentityOverrides (renamed to PromptIdentityOverrides, its productName field now displayName) and the version option (renamed to serverVersion — it is the engine version reported as server_version, while the host product version travels in hostIdentity.version). The server now feeds bootstrap's clientIdentity from hostIdentity and derives the default outbound headers (User-Agent + X-Msh-*) from it via createKimiDefaultHeaders, so kap-server-hosted OAuth flows and model / WebSearch requests carry the real host identity instead of a hardcoded kimi-code-cli fallback UA. Explicit header seeds still win as an escape hatch. Session export manifests record the host product version: kimiCodeVersion now carries hostIdentity.version (the engine version no longer appears), and desktop exports (desktop: true) are additionally stamped with a desktopVersion field. The instance registry keeps its host_version wire field for compatibility (kimi-inspect reads it); only the in-memory name changed to serverVersion. * feat(cli): wire the CLI host identity into the kimi web server kimi web now passes createKimiCodeHostIdentity(version) as the server's hostIdentity, so web-UI OAuth flows and the engine's outbound requests carry the explicit CLI identity (productName + version + platform). The explicit hostRequestHeadersSeed is dropped — kap-server derives the same headers from hostIdentity — and buildKimiDefaultHeaders goes away with its only consumer. * test(klient): drop clientVersion from the bootstrap contract parity list * chore: add changesets for the host identity unification * feat(cli): tag kimi web requests with a (web) User-Agent suffix kimi web shares the CLI product token and platform, so its outbound requests were indistinguishable from direct CLI runs upstream. Its host identity now carries userAgentSuffix 'web', putting web-UI traffic at kimi-code-cli/<version> (web) while X-Msh-Platform stays kimi_code_cli. * fix(klient): keep the env() clientVersion wire field after the bootstrap identity switch The bootstrap snapshot replaced the flat clientVersion scalar with clientIdentity, which broke klient's env() fan-out (RPCError: method not found). The wire surface keeps clientVersion — now sourced from clientIdentity.version — and bootstrapService gains a clientIdentity read (registered in envContract with an object schema) for consumers that want the full identity. * feat(oauth): send the product User-Agent on OAuth requests The OAuth endpoints used to receive only the X-Msh-* device headers (undici's default UA otherwise), which left the OAuth host unable to distinguish runtime surfaces — notably kimi web, whose platform matches the CLI and whose only distinguishing mark is the (web) UA suffix. The toolkit now feeds the full identity headers (User-Agent + X-Msh-*) into every device authorization, token polling, and refresh request; the request-header type widens from DeviceHeaders to OAuthRequestHeaders. * feat(vscode): report kimi_code_vscode as the extension's platform The VS Code extension inherited the CLI's hardcoded X-Msh-Platform value; with platform now an explicit identity field it declares its own, so the managed endpoints and OAuth host can tell extension traffic apart from CLI runs. * refactor(agent-core-v2)!: require the client identity at the composition root The bootstrap fallback identity fabricated a kimi-code-cli/unknown host for any caller that forgot to pass one — the same silent-misreport pattern this series set out to remove, and it made "required" a lie. BootstrapInput.clientIdentity is now required, so a missing identity fails at compile time instead of being papered over. Test and example callers pass a shared fixture (klient examples and test engines get one each); the node-sdk v2 client asserts its host identity with the oauth helper. Also folds DeviceHeaders from an interface into a type alias so it stays assignable to the widened OAuthRequestHeaders record. * feat(oauth)!: require and validate the platform in device headers Drops the quiet CLI fallback in createKimiDeviceHeaders (the same silent-misreport pattern removed from the bootstrap identity): platform is now a required option, validated with the same required-ASCII rule as the version — empty or all-non-ASCII values throw instead of emitting a blank X-Msh-Platform, and header-unsafe characters are stripped rather than sent raw. * fix(node-sdk): seed the host request headers on the v2 client path The interactive v2 engine path (experimental flag) bootstrapped without a hostRequestHeaders seed, so managed vendor calls went out with the SDK's default User-Agent (OpenAI/JS) and no X-Msh-* at all — v1 passes the full identity headers on the same requests. The v2 client now seeds the headers from its asserted host identity, and a test pins the seed. * chore: simplify the CLI changeset wording
…ld misses (MoonshotAI#2395) * fix(agent-core-v2): treat cache entries missing required fields as cold misses - normalize `archived` to a boolean when mirroring session metadata to the read model, so entries for pre-`archived` sessions no longer lose the key during JSON serialization - add a runtime shape check on read-model cache hits; entries missing required fields are rebuilt from disk and overwritten, self-healing poisoned entries written before the fix - log a warning when the TUI session picker fails to fetch sessions instead of silently showing "No sessions found." * chore: add changeset for session index cold-miss fix
…ure (MoonshotAI#2399) - delete the faultInjection domain (IFaultInjectionService, its Agent-scope implementation, and the fault-injection experimental flag) - drop the llmRequester's per-attempt fault consumption point and the faultToError helper - remove the fault-injection test cases and DI wiring from the requester service tests, and the domain's layer-registry entry - regenerate the state manifest without the faultInjection.* state keys
…otAI#2393) * fix(vscode): keep sign-in reachable from the no-models screen * fix(vscode): stop flagging bundled this.require(...) calls as VSIX runtime dependencies
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…erinfo (MoonshotAI#2363) * feat(kap-server): expose the managed-account profile at GET /oauth/userinfo * refactor(oauth): serve the userinfo profile as the camelCase domain type end to end * style(agent-core-v2): drop the method-local comment on getManagedUserInfo * chore: drop the userinfo endpoint changeset * test(kap-server): pass the required host identity in the userinfo route test
* chore(vscode): release 0.6.6 * chore(vscode): release 0.6.7 * chore(vscode): fold the sign-in wording fix into 0.6.6 * chore(vscode): backfill the 0.6.5 changelog entry
…otAI#2404) * docs(changelog): sync 0.31.0 from apps/kimi-code/CHANGELOG.md * docs(changelog): polish 0.31.0 entries and note secondary model as experimental
…tion (MoonshotAI#2410) * fix(agent-core-v2): write refresh results in one atomic config transition - add IConfigService.replaceSections: applies several domains in a single state transition — one disk write, one effective rebuild, change events fire only after all domains took effect - rework ProviderDiscoveryService to absorb the orchestrator's two-phase removeProvider/setConfig host contract into one replaceSections write, so the kosong registries never pass through a halfway-removed catalog - stop writing the env-synthesized __kimi_env__ slice to config; the bridge's event-driven sync carries it into the registries on its own - fixes sporadic "model is not configured" errors when starting kimi web, caused by the background refresh transiently clearing the model catalog while the first session was being created * fix(agent-core-v2): stage replaceSections writes before mutating raw config Validate and strip every domain into a staged copy of the raw/memory layer first, then swap it in only after the whole batch succeeds — previously a later domain failing validation left earlier domains already applied to this.raw/this.memory while the call reported failure, exposing a partially applied user layer to inspect() and future merges.
…de highlighting (MoonshotAI#2415) * fix(web): upgrade markstream-vue to 1.0.9-beta.1 and enable Monaco code highlighting * fix(nix): update pnpm deps hash for markstream-vue 1.0.9-beta.1
Conflict resolutions (6 files): - agent-core-v2/docs/state-manifest.d.ts: took upstream, regenerated via gen:state-manifest. - agent-core/test/harness/runtime.test.ts: kept all 3 added tests (fork stale plugin_session_start disabled-skill case + 2 upstream plugin agent layer cases). - agent-core-v2/test/agent/loop/loop.test.ts + test/tool/tool.test.ts: tools-hash inline snapshots collided (fork Agent tool exact-alias model param vs upstream MoonshotAI#2379 non-blocking TaskOutput contract); kept fork side, regenerated snapshots from merged behavior — exact-alias model contract preserved. - agent-core-v2/test/app/config/config.test.ts: kept both import additions (fork PERSIST_DEFAULT_MODEL_SECTION + upstream PROVIDERS_SECTION, atomic config refresh MoonshotAI#2410). - kap-server/test/skills.test.ts: restartWithDisabledSkills helper now passes TEST_HOST_IDENTITY (upstream made StartServerOptions.hostIdentity required). Verification: - agent-core-v2: 4265/4265 pass; gen:state-manifest --check clean. - kap-server: 927/927 pass. - agent-core: 4147 pass; 4 failures in test/harness/coder-subagent-tools.test.ts are pre-existing spawn /bin/bash ENOENT on NixOS (not merge-related). - kimi-code TUI: 2487 pass. typecheck: agent-core, agent-core-v2, kap-server clean. - lint: 2 errors in packages/oauth/src/managed-userinfo.ts are pre-existing on upstream (no-redundant-type-constituents, MoonshotAI#2363), unchanged by this merge. Closes the sync tracked in #23.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Upstream sync tracked in #23. Fork was 30+ commits behind upstream; this merge brings
main@origintip5c0ec2938a(2026-07-29) into the fork.What changed
Merge commit with 6 conflict resolutions, all in tests / generated artifacts — zero production-code conflicts:
agent-core-v2/docs/state-manifest.d.ts— took upstream side, regenerated viapnpm gen:state-manifest(--checkclean).agent-core/test/harness/runtime.test.ts— both sides appended tests; kept all 3 (fork: staleplugin_session_startdisabled-skill neutralization; upstream: 2 plugin agent layer cases).agent-core-v2/test/agent/loop/loop.test.ts+agent-core-v2/test/tool/tool.test.ts— tools-hash inline snapshots collided: fork Agent tool carries the exact-aliasmodelparam (subagent model selection) while upstream fix: remove the blocking wait from the TaskOutput tool MoonshotAI/kimi-code#2379 changed the TaskOutput contract (non-blocking,success/not_ready). Kept the fork side, then regenerated snapshots from actual merged behavior — the exact-aliasmodelcontract is preserved in the regenerated snapshot.agent-core-v2/test/app/config/config.test.ts— kept both import additions (forkPERSIST_DEFAULT_MODEL_SECTION+ upstreamPROVIDERS_SECTIONfrom atomic config refresh fix(agent-core-v2): write refresh results in one atomic config transition MoonshotAI/kimi-code#2410).kap-server/test/skills.test.ts— fork helperrestartWithDisabledSkillsnow passesTEST_HOST_IDENTITY(upstream madeStartServerOptions.hostIdentityrequired).Verification
agent-core-v2: 4265/4265 tests pass;gen:state-manifest --checkclean.kap-server: 927/927 pass.agent-core: 4147 pass; the 4 failures intest/harness/coder-subagent-tools.test.tsare pre-existingspawn /bin/bash ENOENTon NixOS (fail identically on forkmainbefore this merge).apps/kimi-codeTUI: 2487 pass.typecheck: agent-core, agent-core-v2, kap-server clean (afterpnpm install— upstream addedzodtopackages/oauth).packages/oauth/src/managed-userinfo.tsare pre-existing on upstream (feat(kap-server): expose the managed-account profile at GET /oauth/userinfo MoonshotAI/kimi-code#2363), unchanged by this merge.Closes #23.