Skip to content

refactor: remove the legacy agent-core v1 package - #3542

Open
sailist wants to merge 2 commits into
MoonshotAI:mainfrom
sailist:refact-119-09-01-remove-agent-core-v1
Open

refactor: remove the legacy agent-core v1 package#3542
sailist wants to merge 2 commits into
MoonshotAI:mainfrom
sailist:refact-119-09-01-remove-agent-core-v1

Conversation

@sailist

@sailist sailist commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

Internal refactoring — no linked issue.

Problem

The repository carried two generations of the agent engine: packages/agent-core (v1, half-retired) and packages/agent-core-v2 (the engine behind kap-server, klient, the CLI, and the VS Code extension). v2 was already the default everywhere, but v1 could not be deleted because packages/node-sdk still shipped a live v1 client (SDKRpcClient constructing KimiCore in-process) and v1-sourced public types, and the CLI / VS Code extension kept legacy engine switches (KIMI_CODE_LEGACY_FLAG, useAgentCoreV1). Maintaining both generations blocked consolidating the SDK and tooling on v2.

What changed

  • Deleted packages/agent-core (the whole v1 package) and every remaining reference: workspace/nix manifests, tsdown/vitest/api-extractor aliases, tsconfig includes, docker e2e mounts, the v2 import-boundary guard's v1 rule, and explanatory docs.
  • node-sdk is now a pure agent-core-v2 SDK. It owns its public contract (error protocol, whole-document KimiConfig schema + config file IO, process-global logging facade, telemetry client interface); event and interaction types re-export from @moonshot-ai/protocol or agent-core-v2 with shapes unchanged for consumers. createKimiHarness is the single harness factory, backed by the v2 client; the v1 SDKRpcClient is deleted.
  • v2 is the only engine. The CLI runs v2 unconditionally (run-shell, run-prompt, subcommands, upgrade, login); KIMI_CODE_LEGACY_FLAG and vscode's useAgentCoreV1 are removed, and the TUI's engineV2 branches collapse to the v2 path.
  • Replay fold moved engine-side. The wire.jsonl → replay-records fold now lives in agent-core-v2 (foldWireRecords in agent/replayBuilder) instead of borrowing a throwaway v1 Agent; the v2 journal now persists tool-call display, so diff/todo displays survive session resume (previously lost on the v2 path).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve). — internal refactoring, no issue.
  • I have added tests that prove my feature works. — new fold test suite in agent-core-v2; node-sdk / CLI / vscode suites updated.
  • Ran gen-changesets skill, or this PR needs no changeset. — no user-visible changelog entry needed.
  • Ran gen-docs skill, or this PR needs no doc update. — doc updates included (env-vars, config-files, plugins, AGENTS.md, CONTRIBUTING).

@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4b3177d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Delete packages/agent-core (v1 engine) and migrate node-sdk fully onto
agent-core-v2:

- node-sdk owns its public contract (error protocol, KimiConfig schema
  and file IO, process-global logging facade, telemetry client
  interface); event and interaction types re-export from
  @moonshot-ai/protocol or agent-core-v2
- createKimiHarness is now the single harness factory, backed by the
  v2 client; the v1 SDKRpcClient is deleted
- CLI and vscode run agent-core-v2 unconditionally;
  KIMI_CODE_LEGACY_FLAG and useAgentCoreV1 are removed
- the wire.jsonl replay fold moves into agent-core-v2's replayBuilder
  (foldWireRecords), and the v2 journal now persists tool-call display
  so replay restores diff/todo displays
- TUI engineV2 branches collapse to the v2 path
@sailist
sailist force-pushed the refact-119-09-01-remove-agent-core-v1 branch from 4f1cdf5 to da11a1c Compare September 4, 2026 08:32
@pkg-pr-new

pkg-pr-new Bot commented Sep 4, 2026

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

commit: 4b3177d

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