Skip to content

feat(server): default to kap-server and remove the v1 server package - #1617

Merged
sailist merged 2 commits into
MoonshotAI:mainfrom
sailist:refactor/server-remove
Jul 13, 2026
Merged

feat(server): default to kap-server and remove the v1 server package#1617
sailist merged 2 commits into
MoonshotAI:mainfrom
sailist:refactor/server-remove

Conversation

@sailist

@sailist sailist commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained in the next section.

Problem

The repo carried two server implementations behind an experimental flag: the legacy v1 server (packages/server, backed by agent-core) and kap-server (packages/kap-server, backed by agent-core-v2). kimi server run / kimi web booted v1 by default and only routed to kap-server when KIMI_CODE_EXPERIMENTAL_FLAG was set. kap-server has reached /api/v1 wire parity (it shares the @moonshot-ai/protocol schemas and passes the full e2e surface), so keeping the v1 package around doubles maintenance and leaves ambiguity about which engine is the product.

What changed

  • kimi server run / kimi web now boot kap-server unconditionally; the experimental gate on the server path is removed. All existing CLI options are forwarded as before, and the daemon idle-shutdown wiring (connection-count driven) is preserved. The kimi -p print-mode v2 gate and KIMI_CODE_EXPERIMENTAL_MULTI_SERVER are intentionally untouched.
  • The only capability unique to the v1 package — the OS service manager (svc: launchd / systemd / schtasks behind kimi server install and friends) — was moved to packages/kap-server/src/svc together with its tests, and re-exported from the kap-server public surface, so CLI call sites only change their import source.
  • All CLI server subcommands (run, kill, ps, rotate-token, daemon/lifecycle plumbing) now import from @moonshot-ai/kap-server; the @moonshot-ai/server dependency is dropped and packages/server is deleted.
  • Workspace bookkeeping updated: flake.nix path/name lists, pnpm-lock.yaml, changeset docs, root dev scripts (dev:v1 removed; dev:server now boots kap-server), kimi-web dev-proxy presets relabeled default/multi, and the agent-core-dev skill docs now treat the protocol schema plus the existing kap-server routes as the /api/v1 contract source of truth.
  • Wire compatibility is unchanged: /api/v1 keeps the same protocol schemas, and /api/v1/meta continues to report backend: "v2".

Verification: kap-server typecheck + 607 tests (including the 60 migrated svc tests), apps/kimi-code typecheck + 460 CLI tests, apps/kimi-web typecheck, oxlint (0 errors), the nix workspace sync check, and a smoke boot of kimi server run with no env flags that returned backend: "v2" from /api/v1/meta.

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, or this PR needs no changeset. (.changeset/kap-server-default-engine.md: @moonshot-ai/kimi-code minor, @moonshot-ai/kap-server patch)
  • Ran gen-docs skill, or this PR needs no doc update. (env-var docs stay accurate: the flag still gates kimi -p and the tool-select master switch)

@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b5582db

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kimi-code Minor
@moonshot-ai/kap-server Patch

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

@sailist
sailist force-pushed the refactor/server-remove branch from 598c816 to 1872b81 Compare July 13, 2026 12:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 598c8161bd

ℹ️ 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".

port: options.port,
logLevel: options.logLevel,
logger,
debugEndpoints: options.debugEndpoints,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore debug routes before making kap-server default

Now that this path unconditionally boots @moonshot-ai/kap-server, --debug-endpoints no longer mounts the three /api/v1/debug/prompts/... routes: packages/kap-server/src/routes/registerApiV1Routes.ts accepts debugEndpoints but never registers a debug route, and its debug non-loopback test documents that the option is currently a no-op. packages/server-e2e/scripts/run-docker-e2e.sh still starts pnpm dev:server -- --debug-endpoints, and scenarios 04/10/12 call those debug URLs, so the default docker e2e flow now gets 404s where the legacy server used to provide the introspection/mutation endpoints.

Useful? React with 👍 / 👎.

@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@8568575
npx https://pkg.pr.new/@moonshot-ai/kimi-code@8568575

commit: 8568575

@sailist
sailist force-pushed the refactor/server-remove branch 2 times, most recently from 8568575 to 4e2d4a1 Compare July 13, 2026 13:42
sailist added 2 commits July 13, 2026 21:43
- kimi server run / kimi web now boot kap-server (agent-core-v2 engine)
  unconditionally; the KIMI_CODE_EXPERIMENTAL_FLAG gate on the server
  path is gone (the kimi -p print-mode gate stays)
- move the OS service manager (svc: launchd/systemd/schtasks) from
  packages/server into packages/kap-server and export it there
- repoint the CLI server subcommands, tests, and dev scripts at
  kap-server; relabel the web dev backend presets default/multi
- delete packages/server and update workspace bookkeeping (flake.nix,
  pnpm-lock.yaml, changeset ignore docs, AGENTS.md, agent-core-dev skill)
Scenarios 04-stateless-controls, 10-prompt-queue-steer and
12-send-and-cancel assert through the /api/v1/debug/prompts/*
introspection routes, which only the deleted v1 server mounted —
kap-server's --debug-endpoints is a documented no-op, so these
scenarios can only 404 now. The vitest e2e files using the same
surface already skip when it is absent.
@sailist
sailist force-pushed the refactor/server-remove branch from 4e2d4a1 to b5582db Compare July 13, 2026 13:43
@sailist
sailist merged commit 4ec2e7f into MoonshotAI:main Jul 13, 2026
12 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 14, 2026
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