kimi-code/packages
haozhe.yang 5bdee931e5 feat(agent-core-v2): dep-graph dev viewer + scope lint
Adds a dev-only tool under `scripts/dep-graph/` that statically analyses the
DI service graph and serves it as an interactive React Flow viewer:

- `analyzer/`: ts-morph pass over `src/**/*.ts` extracts every
  `registerScopedService` binding as a node keyed by `${scope}::${token}`,
  then records ctor / accessor / publish / subscribe / emit / on edges. Each
  edge is resolved to the concrete impl visible from the source's scope
  (walking source scope up to App); if no binding is visible the edge is
  marked `unresolved` — the exact signal for a container-construction
  failure. Framework tokens (`IKaos`, `ISessionContext`, …) are seeded so
  they don't sink into false-positive unresolveds.
- `plugin/virtual-dep-graph.ts`: Vite plugin that exposes the analyzer
  output as a `virtual:dep-graph` module, mirrors it to
  `.local/dep-graph.json`, and re-analyses on any `src/**/*.ts` change via
  chokidar with a 200 ms debounce, then invalidates the virtual module for
  HMR.
- `web/`: React + React Flow frontend with dagre auto-layout in RL mode
  (base primitives on the left, facades on the right). Sidebar filters by
  scope / edge kind / domain / search; toggles for `hide orphans` and
  `group by scope` (horizontal App | Session | Agent bands). Isolated
  nodes are pinned to the sink rank so they sit with the base primitives.
- `cli.ts` (`pnpm dep-graph:analyze`): one-shot JSON dump for CI / offline
  inspection.
- `lint.ts` (`pnpm dep-graph:lint`): treats unresolved ctor edges as
  errors (container will crash) and unresolved accessor edges as warnings
  (only safe under an active inner scope). Auto-runs the analyzer when the
  snapshot is stale.

Isolation from deploy: everything lives under `scripts/dep-graph/` and is
never referenced from `src/index.ts`, so `tsdown` doesn't bundle it into
`dist/`. The added `ts-morph`, `vite`, `react`, `react-dom`,
`@vitejs/plugin-react`, `@xyflow/react`, `@dagrejs/dagre`, `tsx`, and
`@types/react*` all land in `devDependencies` — `pnpm install --prod`
skips them.

Also adds `.vite/` to `.gitignore` so Vite's per-package dep pre-bundling
cache isn't tracked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-01 17:19:18 +08:00
..
acp-adapter chore(telemetry): normalize telemetry property keys to snake_case (#1196) 2026-06-29 17:40:50 +08:00
agent-core feat: support plugin slash commands (#1204) 2026-06-30 19:38:01 +08:00
agent-core-v2 feat(agent-core-v2): dep-graph dev viewer + scope lint 2026-07-01 17:19:18 +08:00
kaos ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
kimi-migration-legacy feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
kosong feat(timing): split TTFT into api-server and client portions (#1228) 2026-06-30 19:15:02 +08:00
migration-legacy ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
minidb feat(minidb): add embedded key-value database package 2026-06-28 16:30:10 +08:00
node-sdk feat: support plugin slash commands (#1204) 2026-06-30 19:38:01 +08:00
oauth feat(server): auto-refresh provider model catalog and push change events (#1207) 2026-06-30 12:29:10 +08:00
protocol Merge remote-tracking branch 'origin/main' into kimi-code-v2 2026-06-30 21:25:35 +08:00
server feat(server): add GUI store API mirroring localStorage (#1231) 2026-06-30 21:04:59 +08:00
server-e2e fix(web): stop auto-dismissing pending questions and approvals on a timeout (#1070) 2026-06-24 19:15:06 +08:00
server-v2 feat(server-v2): add model catalog auto-refresh and remaining wiring 2026-07-01 13:02:26 +08:00
telemetry ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00