kimi-code/apps/kimi-inspect
Haozhe 314b39489e
refactor(agent-core-v2): extract swarm into a scope-organized feature (#2874)
* refactor(agent-core-v2): extract swarm into a scope-organized feature

- move src/agent/swarm, src/session/swarm, and src/agent/tools/agent-swarm
  into src/features/swarm/{agent,session,tools/agent-swarm}; swarmOps.ts
  stays a static import=register wire channel at the feature root
- add SwarmFeature carrying the three runtime registrations
  (IAgentSwarmService, ISessionSwarmService, IAgentSwarmTool) with
  ScopeActivation.OnScopeCreated preserved
- switch src/index.ts to precise leaf exports and update import sites,
  including the kap-server and kimi-inspect deep-path imports
- move tests to test/features/swarm and re-assert service overrides in
  the test harness so stubs keep winning over feature contributions

* fix(agent-core-v2): keep feature-contributed tools in Agent tool descriptions

SubagentTool.knownToolReferences() now reads the full AgentToolContribution
collection (static registrations and feature contributions alike) instead
of the static contribution table. A caller profile that does not activate
a feature-contributed tool (e.g. AgentSwarm) no longer drops it from the
per-profile tool listings the description advertises for spawned profiles
when a workspace/session restriction forces explicit enumeration.

Add a regression test with a caller profile lacking AgentSwarm under a
global tool restriction.

* refactor(kap-server): lift session profile updates to the route edge

- add sessionProfile.ts/sessionAgentConfig.ts route helpers that resume
  the session and dispatch title/metadata and the agent_config patch to
  the native v2 services directly
- drop updateProfile from ISessionLegacyService, leaving only the
  status rollup and the goal read in the legacy adapter
- wire shape and client-visible behavior unchanged
2026-08-13 13:35:49 +08:00
..
src refactor(agent-core-v2): extract swarm into a scope-organized feature (#2874) 2026-08-13 13:35:49 +08:00
vite feat(cli): replace the kimi server command tree with kimi web and share one home across servers (#1826) 2026-07-19 11:43:46 +08:00
AGENTS.md feat(agent-core-v2): add event-subscription introspection (#2806) 2026-08-11 14:55:08 +08:00
index.html feat(kimi-inspect): add kap-server web inspector with dev-only /api/v1/debug RPC surface (#1806) 2026-07-17 15:56:53 +08:00
package.json feat(transcript): add unified transcript layer, drop the /api/v2 RPC surface (#1888) 2026-07-20 15:33:05 +08:00
README.md feat(agent-core-v2): add the L3 unit layer and the Feature seam (#2678) 2026-08-06 18:22:36 +08:00
tsconfig.json feat(kimi-inspect): add kap-server web inspector with dev-only /api/v1/debug RPC surface (#1806) 2026-07-17 15:56:53 +08:00
vite.config.ts feat(kimi-inspect): add kap-server web inspector with dev-only /api/v1/debug RPC surface (#1806) 2026-07-17 15:56:53 +08:00

kimi-inspect

Web inspector for the kap-server /api/v1/debug RPC surface — a read/trigger window into a running Kimi Code engine (workspaces, sessions, agents, and the scoped DI registry).

Run

  1. Start a kap-server with the debug surface mounted (repo dev scripts do this for you): pnpm dev:v1 / pnpm dev:v2 from the repo root pass --debug-endpoints on a loopback bind; the surface inherits the global bearer auth.
  2. pnpm --filter @moonshot-ai/kimi-inspect dev — the Vite dev server proxies /api to the server (KIMI_SERVER_URL, default http://127.0.0.1:58627) and auto-discovers running instances (~/.kimi-code/server/instances); switch servers from the header dropdown.

A connection failure shows a blocking "Debug surface unavailable" screen — there is no fallback data source.

Views (left icon rail)

  • Chat workspace — session list (activity badges from the global-events WS) plus a transcript-driven per-session chat; the right dock hosts the Agent-scope Service panels, a plan lookup card, and the transcript audit panel. The Session scope has its own column (pending interactions + session Service panels, and a State tab).
  • Search — cross-session full-text search over POST /api/v1/search (cursor-paged; exact-match maps to the API's literal mode; a live/index badge shows which server route served the results).
  • Model Catalog — every provider with its models; expanding one opens the model inspector (config layers + resolved runtime view with per-value provenance).
  • App / Workspace Services — the full Service reflection over the App scope, and over each Workspace scope (picked via the directory browser; workspace handlers materialize on demand).
  • DI — the engine's Service × Effect × DI debug surface, four panels fed by the App-scope debug Services (IDebugLedgerService / IDebugGraphService / IDebugCascadeService) and refreshed eagerly off the event.di.unit_changed WS frame:
    • Unit tree — scope → unit → ledger entries (label, five-state Pending / Activating / Active / Unloading / Failed, uid, pinned flag, unit error object), with unprovide / update / dispose triggers.
    • Graph — the dependency DAG (instance edges across scopes + collection edges).
    • Cascade — the cascade transaction history ring (changes, contagion set, torn-down / rebuilt / failed, abort wait, duration).
    • Pending — the waiting area: units parked on unsatisfied dependencies with their missing-token sets.

Notes for maintainers

  • The channel layer (src/channel/) is a VS Code-style ProxyChannel: GET /api/v1/debug/channels enumerates every scoped Service — there is no whitelist; new Services appear automatically.
  • There is no Service-event push channel besides the global events listed above; panels fetch/refresh on demand (react-query, 15 s poll) plus the event.di.unit_changed invalidation for the DI view.