Skip to content

feat(cli): port portable fixes and publish KKM - #1

Merged
Pidbid merged 2 commits into
mainfrom
agent/portable-upstream-fixes
Jul 28, 2026
Merged

feat(cli): port portable fixes and publish KKM#1
Pidbid merged 2 commits into
mainfrom
agent/portable-upstream-fixes

Conversation

@Pidbid

@Pidbid Pidbid commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Related Issue

No linked issue. This PR curates portable upstream fixes for the Pidbid/kkm fork and closes a fork-specific gap around using multiple skills in one prompt.

Problem

The fork was still at the same base as upstream while a number of broadly useful correctness, compatibility, and reliability fixes had accumulated. Importing everything would also pull in changes coupled to Moonshot/Kimi services, so this needs a deliberately portable subset.

The TUI and SDK also could not activate multiple skills atomically in one user message. Inputs such as Use /skill:review and then /skill:commit were not delivered as one turn with both skill instructions and the original prompt.

What changed

Selection approach

Selected exactly 30 upstream PRs using these criteria:

  • useful across providers, operating systems, or local deployments;
  • fixes correctness, durability, compatibility, or bounded resource use;
  • avoids auth, billing, telemetry, hosted-service, and other Kimi-ecosystem coupling;
  • includes tests and can be adapted cleanly to both current agent engines where relevant.

PR MoonshotAI#1720 is the only provider-named exception: its behavior is generic MCP/JSON-schema compatibility rather than a hosted Kimi dependency.

Upstream PR Portable value
#1720 Normalize malformed MCP required fields
#1910 Force remote MCP proxy transports to HTTP/1.1 where required
#1962 Support WSLg clipboard images exposed only as BMP
#1979 Prevent Cyrillic key doubling in Windows Terminal, including WSL
#1987 Surface skill-load warnings in both agent engines
#2046 Surface skill parse failures as session warnings
#2060 List files inside untracked directories in Git status
#2066 Conservative max_tokens handling for custom Anthropic-compatible endpoints
#2081 Runtime-safe stdio/no-proxy handling and Node launcher detection
#2088 Persist diagnostics after terminal exit
#2127 Stop registering auxiliary skill docs as standalone skills
#2130 Stream live subagent events into background-task output
#2137 Read wire logs line-by-line instead of loading whole files
#2160 Clamp uncached OpenAI-compatible input usage
#2161 Observe aborted-source promise rejections
#2162 Write session metadata atomically
#2170 Preserve and drain buffered prompt output during signal shutdown
#2171 Bound Git diff reads while preserving truncation prefixes
#2172 Recover sessions interrupted during reasoning
#2175 Coerce string-typed tool arguments safely at the parse boundary
#2200 Resolve Git Bash POSIX paths for Windows file tools
#2205 Correct TUI redraws above the viewport
#2207 Use Node randomUUID for VS Code webview IDs
#2211 Skip known legacy wire records during restore
#2227 Skip empty reasoning fields in OpenAI-compatible streams
#2237 Support ACP prompts containing multiple questions
#2263 Handle a leading ] and invalid glob character classes safely
#2287 Make globstar match zero directories
#2288 Validate SDK catalog payloads
#2291 Detect the newer Bun global package layout

Multi-skill prompts

  • Recognize canonical /skill:<name> tokens anywhere in a prompt, deduplicate them in first-occurrence order, and preserve the original prompt and media.
  • Add inline skill autocomplete without replacing surrounding prompt text.
  • Add Session.promptWithSkills(...) to the Node SDK.
  • Validate all requested skills before recording any activation.
  • Submit all skill wrappers plus the original prompt as one user turn in both v1 and v2 agent engines.
  • Preserve legacy single leading-skill command behavior.
  • Keep queued-message and prompt-metadata behavior intact.

KKM release and branding

  • Rename the primary CLI, process title, help text, session hints, ACP identity, TUI copy, native executable, archive, and checksum artifacts to kkm.
  • Retain kimi as an npm compatibility alias so existing automation continues to work.
  • Set the embedded package and binary version to 0.29.2-kkm.1.
  • Add a fork-specific Release workflow triggered by the version marker on main.
  • Build six native targets: Linux x64/arm64, macOS x64/arm64, and Windows x64/arm64.
  • Require all six archives and checksums before publishing, generate manifest.json, and support idempotent asset re-upload on workflow reruns.
  • Disable the inherited upstream auto-update path for KKM; kkm upgrade directs users to this repository's Releases.
  • Keep Kimi OAuth/provider compatibility and the existing data/config paths. macOS artifacts are currently unsigned and not notarized.

Integration adaptations

  • Adapt upstream tests and state manifest paths to the current v2 architecture.
  • Extend Windows Terminal detection to WSL sessions.
  • Await atomic metadata persistence when creating agents so session teardown cannot race a background write.
  • Resolve overlapping upstream changes while retaining both skill-warning paths, state-backed configuration, tool-argument normalization, and glob behavior.

Validation

  • pnpm run typecheck — passed across the monorepo.
  • pnpm run lint — passed with 0 errors (2,677 existing warnings).
  • pnpm exec changeset status — valid patch/minor release set.
  • Bundle build and smoke — passed with Usage: kkm and version 0.29.2-kkm.1.
  • Linux x64 SEA build, native smoke, archive, and checksum generation — passed.
  • Final isolated regression set — 58 tests passed.
  • Broader selected upstream regression set — 1,114 tests passed across 27 files.
  • pi-tui full suite — 720 tests passed.
  • Full root Vitest run was also attempted: 968 files / 15,430 tests passed; the remaining failures are environment-bound in this sandbox (/tmp/.git discovery, unwritable /root/.kimi-code, and restricted network/IPC), not failures in the targeted paths.
  • Repository-required final read-only audit passed with no secrets, temporary paths, generated-by attribution, conflict markers, or unintended build artifacts.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill; this PR includes the required changesets.
  • Updated the English and Chinese READMEs with KKM installation, command, compatibility, and Release guidance.

Pidbid added 2 commits July 28, 2026 14:27
Curate and adapt 30 generally useful fixes from MoonshotAI/kimi-code, then add atomic inline multi-skill prompts across the CLI, SDK, and both agent engines.
@Pidbid Pidbid changed the title feat(skill): port portable fixes and multi-skill prompts feat(cli): port portable fixes and publish KKM Jul 28, 2026
@Pidbid
Pidbid marked this pull request as ready for review July 28, 2026 09:18
@Pidbid
Pidbid merged commit 4ced813 into main Jul 28, 2026
12 of 15 checks passed
@github-actions

Copy link
Copy Markdown

❌ Nix build failed

    kimi-code> - Using dynamic import() to code-split the application
    kimi-code> - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
    kimi-code> - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
    kimi-code> ✓ built in 23.83s
    kimi-code> Copied Kimi web assets to /build/source/apps/kimi-code/dist-web
    kimi-code> 
    kimi-code> > @moonshot-ai/kimi-code@0.29.2-kkm.1 build:native:sea /build/source/apps/kimi-code
    kimi-code> > node scripts/native/build.mjs --profile=local
    kimi-code> 
    kimi-code> ==> Native build (profile=local)
    kimi-code> [build-vis-asset] building vis web single-file bundle…
    kimi-code> vite v6.4.2 building for production...
    kimi-code> transforming...
    kimi-code> ✓ 136 modules transformed.
    kimi-code> rendering chunks...
    kimi-code> [plugin vite:singlefile]
    kimi-code> 
    kimi-code> [plugin vite:singlefile] Inlining: index-hnWqAAon.js
    kimi-code> [plugin vite:singlefile] Inlining: style-D6lxOw1d.css
    kimi-code> computing gzip size...
    kimi-code> dist-single/index.html  441.27 kB │ gzip: 125.89 kB
    kimi-code> ✓ built in 1.74s
    kimi-code> [build-vis-asset] wrote /build/source/apps/kimi-code/src/generated/vis-web-asset.ts (163 KB base64)
    kimi-code> ℹ tsdown v0.22.0 powered by rolldown v1.0.1
    kimi-code> ℹ config file: /build/source/apps/kimi-code/tsdown.native.config.ts
    kimi-code> ℹ entry: ./src/main.ts
    kimi-code> ℹ target: node24
    kimi-code> ℹ tsconfig: tsconfig.json
    kimi-code> ℹ Build start
    kimi-code> ℹ Granting execute permission to dist-native/intermediates/main.cjs
    kimi-code> ℹ dist-native/intermediates/main.cjs  16.79 MB
    kimi-code> ℹ 1 files, total: 16.79 MB
    kimi-code> ✔ Build complete in 3294ms
    kimi-code> Collected native assets for linux-x64:
    kimi-code> - @mariozechner/clipboard: 2 files
    kimi-code> - @mariozechner/clipboard-linux-x64-gnu: 2 files
    kimi-code> - @moonshot-ai/pi-tui: 1 files
    kimi-code> Collected web assets for linux-x64: 202 files
    kimi-code> Wrote single executable preparation blob to /build/source/apps/kimi-code/dist-native/intermediates/kkm.blob
    kimi-code> Start injection of NODE_SEA_BLOB in /build/source/apps/kimi-code/dist-native/bin/linux-x64/kkm...
    kimi-code> 💉 Injection done!
    kimi-code> warning: Can't find string offset for section name '.note'
    kimi-code> Signed and hashed: /build/source/apps/kimi-code/dist-native/bin/linux-x64/kkm
    kimi-code> Verify step skipped (not macOS)
    kimi-code> ==> Native build complete
    kimi-code> buildPhase completed in 36 seconds
    kimi-code> Running phase: installPhase
    kimi-code> install: cannot stat 'apps/kimi-code/dist-native/bin/linux-x64/kimi': No such file or directory
    error: Cannot build '/nix/store/jac70g7cpbqkxvf1f5j9qb8z3qzbvsrf-kimi-code-0.29.2-kkm.1.drv'.
           Reason: builder failed with exit code 1.
           Output paths:
             /nix/store/mdahr4j7yca3gw68nzidq9ikw25x277c-kimi-code-0.29.2-kkm.1
           Last 25 log lines:
           > ℹ tsdown v0.22.0 powered by rolldown v1.0.1
           > ℹ config file: /build/source/apps/kimi-code/tsdown.native.config.ts
           > ℹ entry: ./src/main.ts
           > ℹ target: node24
           > ℹ tsconfig: tsconfig.json
           > ℹ Build start
           > ℹ Granting execute permission to dist-native/intermediates/main.cjs
           > ℹ dist-native/intermediates/main.cjs  16.79 MB
           > ℹ 1 files, total: 16.79 MB
           > ✔ Build complete in 3294ms
           > Collected native assets for linux-x64:
           > - @mariozechner/clipboard: 2 files
           > - @mariozechner/clipboard-linux-x64-gnu: 2 files
           > - @moonshot-ai/pi-tui: 1 files
           > Collected web assets for linux-x64: 202 files
           > Wrote single executable preparation blob to /build/source/apps/kimi-code/dist-native/intermediates/kkm.blob
           > Start injection of NODE_SEA_BLOB in /build/source/apps/kimi-code/dist-native/bin/linux-x64/kkm...
           > 💉 Injection done!
           > warning: Can't find string offset for section name '.note'
           > Signed and hashed: /build/source/apps/kimi-code/dist-native/bin/linux-x64/kkm
           > Verify step skipped (not macOS)
           > ==> Native build complete
           > buildPhase completed in 36 seconds
           > Running phase: installPhase
           > install: cannot stat 'apps/kimi-code/dist-native/bin/linux-x64/kimi': No such file or directory
           For full logs, run:
             nix log /nix/store/jac70g7cpbqkxvf1f5j9qb8z3qzbvsrf-kimi-code-0.29.2-kkm.1.drv

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