Upstream changes (since c497af60e, 2026-07-25)
Upstream advanced by 2 commits (git fetch upstream main; new tip bf8e967d5, 2026-07-26). Both are large agent-core-v2 DI refactors by Haozhe — combined they touch 362 files.
🏗️ agent-core-v2 — DI / scope lifecycle refactor (2 themes, entangled)
Theme A — Per-scope keyed state container (7799bd734, MoonshotAI#2192)
- Eager scope instantiation: every service registered for a scope tier is now constructed at scope creation (drops the hand-maintained eager lists in
AgentLifecycleService, SessionLifecycleService, and the bootstrap kosong bridge).
- New
_base StateRegistry: typed StateKey/defineState descriptors, per-key onDidChange + global onDidChangeAny, with BugIndicatingError on duplicate/unregistered access. Bound as IStateService (App) / ISessionStateService (Session) / IAgentStateService (Agent).
- State migration: plain-data fields of 13 session-scope services (cron, interaction, sessionActivity, agentProfileCatalog, fs, fsWatch, log, metadata, skillCatalog, toolPolicy, workspaceCommand, workspaceContext) moved into
defineState keys. New StateRegistry.snapshot() for JSON-safe serialization.
Theme B — Tools as scoped services (bf8e967d5, MoonshotAI#2196)
- Replaces module-level
registerTool + AgentBuiltinToolsRegistrar with registerAgentTool (Agent-scope DI service + contribution table). New toolActivation domain: AgentToolActivationService filters contributions by the bound Profile's tool policy and re-activates on agent.status.updated.
- Centralizes builtin tools under
agent/tools/: tools moved from scattered domain folders (plan/tools, goal/tools, os/backends/node-local/tools, task/tools) into a unified directory; each split into a kebab-case definition (bash.ts) + registration (bashTool.ts).
BuiltinTool → AgentTool service interface; tools become Agent-scope services with decorator-injected deps (e.g. AgentTool → SubagentTool/ISubagentTool).
SyncDescriptor.instantiateWithScope opt-out so agent tools (which may legitimately throw if their host capability is missing, e.g. WebSearchTool) stay lazy despite the new eager-scope semantics from Theme A.
Note: the two themes are interdependent — Theme B's tool-laziness is a direct patch on Theme A's eagerness. Port one, port both.
Impact on this fork
The fork has 16 local commits (161 files) since the merge-base. A git merge-tree dry-run of upstream/main into main reports 6 content conflicts out of 16 overlapping files; the other 10 overlap files auto-merge cleanly.
| Severity |
File |
Fork change (commits) |
Upstream change |
Conflict nature |
| 🔴 High |
agent/tools/agent-swarm/agentSwarmTool.ts |
subagent model surfacing (353a1c573) |
moved + re-registered as scoped service (Theme B) |
fork edits a tool file upstream relocated & rewired; file may even be at a new path on each side |
| 🔴 High |
agent/tools/agent/agentTool.ts |
subagent model (353a1c573) |
same tool relocation (Theme B) |
same — agent/subagent tool files are ground zero |
| 🔴 High |
session/sessionSkillCatalog/skillCatalogService.ts |
disabled_skills denylist (b168c608e), catalog reload wait (410ce581f), plugin guidance (50c148327) |
service migrated to ISessionStateService (Theme A) |
fork added filtering/reload logic to a file upstream restructured for state-container migration |
| 🟡 Med |
test/agent/swarm/swarm.test.ts |
subagent model test (353a1c573) |
test rewritten for new tool DI |
test edits collide; resolve by re-applying fork's assertions on upstream's new test shape |
| 🟡 Med |
test/session/sessionSkillCatalog/skillCatalog.test.ts |
catalog reload/disabled-skills tests |
test updated for state-container migration |
same — fork's new tests need porting onto upstream's restructured fixtures |
| 🟡 Med |
test/tool/tool.test.ts |
subagent model / exact-alias tests |
tool test rewritten for scoped-service registration |
same |
| 🟢 Auto-merged |
apps/kimi-code/src/tui/components/messages/tool-call.ts |
subagent model display (353a1c573) |
TUI tool-call refactor |
merged cleanly — verify behavior post-merge |
| 🟢 Auto-merged |
agent/profile/profileService.ts, agent/skill/skillService.ts, agent/plugin/agentPluginService.ts, app/kosongConfig/kosongConfigService.ts, index.ts, session/sessionInit/sessionInitService.ts, session/swarm/sessionSwarmService.ts + 4 test files |
various fork features |
various upstream refactors |
all auto-merge; spot-check that fork features still compile |
Bottom line: The fork's subagent-model-selection work (353a1c573) and skills work (b168c608e/410ce581f/50c148327) sit squarely in the files upstream just relocated and rewired. Both lines of work touch the same tool registration + skill catalog plumbing, so this is a real rebase, not a clean merge.
Recommended follow-ups
Upstream tip: bf8e967d5 (2026-07-26). Fork is 16 commits ahead, now 2 behind. Generated by daily upstream-summary automation.
Upstream changes (since
c497af60e, 2026-07-25)Upstream advanced by 2 commits (
git fetch upstream main; new tipbf8e967d5, 2026-07-26). Both are largeagent-core-v2DI refactors by Haozhe — combined they touch 362 files.🏗️
agent-core-v2— DI / scope lifecycle refactor (2 themes, entangled)Theme A — Per-scope keyed state container (
7799bd734, MoonshotAI#2192)AgentLifecycleService,SessionLifecycleService, and the bootstrap kosong bridge)._baseStateRegistry: typedStateKey/defineStatedescriptors, per-keyonDidChange+ globalonDidChangeAny, withBugIndicatingErroron duplicate/unregistered access. Bound asIStateService(App) /ISessionStateService(Session) /IAgentStateService(Agent).defineStatekeys. NewStateRegistry.snapshot()for JSON-safe serialization.Theme B — Tools as scoped services (
bf8e967d5, MoonshotAI#2196)registerTool+AgentBuiltinToolsRegistrarwithregisterAgentTool(Agent-scope DI service + contribution table). NewtoolActivationdomain:AgentToolActivationServicefilters contributions by the bound Profile's tool policy and re-activates onagent.status.updated.agent/tools/: tools moved from scattered domain folders (plan/tools,goal/tools,os/backends/node-local/tools,task/tools) into a unified directory; each split into a kebab-case definition (bash.ts) + registration (bashTool.ts).BuiltinTool→AgentToolservice interface; tools become Agent-scope services with decorator-injected deps (e.g.AgentTool→SubagentTool/ISubagentTool).SyncDescriptor.instantiateWithScopeopt-out so agent tools (which may legitimately throw if their host capability is missing, e.g.WebSearchTool) stay lazy despite the new eager-scope semantics from Theme A.Impact on this fork
The fork has 16 local commits (161 files) since the merge-base. A
git merge-treedry-run ofupstream/mainintomainreports 6 content conflicts out of 16 overlapping files; the other 10 overlap files auto-merge cleanly.agent/tools/agent-swarm/agentSwarmTool.ts353a1c573)agent/tools/agent/agentTool.ts353a1c573)session/sessionSkillCatalog/skillCatalogService.tsb168c608e), catalog reload wait (410ce581f), plugin guidance (50c148327)ISessionStateService(Theme A)test/agent/swarm/swarm.test.ts353a1c573)test/session/sessionSkillCatalog/skillCatalog.test.tstest/tool/tool.test.tsapps/kimi-code/src/tui/components/messages/tool-call.ts353a1c573)agent/profile/profileService.ts,agent/skill/skillService.ts,agent/plugin/agentPluginService.ts,app/kosongConfig/kosongConfigService.ts,index.ts,session/sessionInit/sessionInitService.ts,session/swarm/sessionSwarmService.ts+ 4 test filesBottom line: The fork's subagent-model-selection work (
353a1c573) and skills work (b168c608e/410ce581f/50c148327) sit squarely in the files upstream just relocated and rewired. Both lines of work touch the same tool registration + skill catalog plumbing, so this is a real rebase, not a clean merge.Recommended follow-ups
git merge upstream/main(don't cherry-pick — the two upstream commits depend on each other and touch 362 files). Do it on a fresh branch.353a1c573's subagent-model surfacing onto the relocatedagent/tools/agent/agentTool.ts+agent/tools/agent-swarm/agentSwarmTool.tsand the newAgentTool/ISubagentToolDI wiring from Theme B. The fork's edits were against the old scattered tool layout.b168c608e(disabled_skills denylist),410ce581f(catalog reload wait),50c148327(disabled plugin guidance) ontoskillCatalogService.tsafter upstream'sISessionStateServicemigration — the filtering logic likely needs to register its owndefineStatekey now.swarm.test.ts/skillCatalog.test.ts/tool.test.tsassertions against upstream's new test fixtures (scoped-service registration, state-container stubs). Use upstream's newtest/state/stubs.tshelper.pnpm -r build+ the agent-core-v2, kap-server, and kimi-code test suites; thetool-call.tsTUI auto-merge especially needs a visual check that subagent model still renders.disabled_skillssemantic drift: upstream's newAgentToolActivationServicefilters by Profile tool policy — confirm the fork'sdisabled_skillsdenylist (config-driven) composes correctly with upstream's profile-driven filtering and isn't shadowed.Upstream tip:
bf8e967d5(2026-07-26). Fork is 16 commits ahead, now 2 behind. Generated by daily upstream-summary automation.