kimi-code/packages/agent-core-v2/package.json
Haozhe 1c85f94472
feat(agent-core-v2): gate image formats and add media recovery resends (#1626)
* feat(kap-server): drop WS heartbeat; never terminate idle connections

- remove ping interval / pong timeout / socket.terminate() from both the
  v1 (WsConnectionV1) and v2 (WsConnection) WebSocket connections
- v2 protocol: drop pong from the client message schema, remove PingMessage
  and ReadyMessage.heartbeatMs; the ready frame is now bare { type: 'ready' }
- v1 protocol: remove buildPing/PingFrame and ServerHelloPayload.heartbeat_ms;
  server_hello no longer advertises a heartbeat
- drop pingIntervalMs/pongTimeoutMs options from registerWs/registerWsV1

* feat(agent-core-v2): gate image formats and add media-stripped resend

- add image-format-policy as the single source of truth for the
  provider-accepted image MIME set (PNG/JPEG/GIF/WebP), with MIME
  normalization, data-URL parsing, byte sniffing, and refusal notices
- enforce the format gate at every ingestion point: ReadMediaFile refuses
  unsupported formats with per-OS conversion guidance, MCP tool results and
  prompt step requests drop them for a text notice, and kap-server prompt
  routes gate inline, uploaded, and remote-URL images on the sniffed bytes
- resend once with every media part replaced by a text marker when the
  provider rejects an image's format, and keep later steps of the same turn
  on the media-stripped projection (v1 parity)
- commit the WebP decoder wasm as a base64 module for the bundled CLI, with
  a regenerate script

* feat(agent-core-v2): add media-degraded 413 resend and WebP re-encoding

- resend once with the media-degraded projection after an HTTP 413
  body-size rejection: all but the two most recent media parts are replaced
  by text markers, and later steps of the turn stay degraded (stripped
  still wins over degraded)
- generalize stripAllMediaParts into degradeOlderMediaParts; the
  media-stripped resend is now the keepRecent=0 case
- re-encode non-animated WebP through the wasm decoder and the PNG/JPEG
  ladder instead of passing oversized WebP through (animated WebP still
  passes through whole)
- stop lossless PNG rescaling at a 1000px floor and switch to the JPEG
  ladder below it, so small byte budgets stay readable
- add the @jsquash/webp dependency

* feat(agent-core-v2): add flag-gated fault injection for recovery testing

- add the faultInjection domain: a one-shot arm/take latch that raises a
  deterministic provider failure (HTTP 413 body-size or image-format 400)
  before the provider is contacted, so the media-degraded / media-stripped
  recovery resends can be exercised end-to-end against a real provider
- gate arming behind the new fault-injection experimental flag
  (KIMI_CODE_EXPERIMENTAL_FAULT_INJECTION), off by default
- expose IAgentPromptService and IFaultInjectionService over the kap-server
  /api/v2 RPC channel
- add a klient example that drives the REST ingestion gate and both
  recovery resends against a live server
2026-07-13 22:11:46 +08:00

110 lines
2.9 KiB
JSON

{
"name": "@moonshot-ai/agent-core-v2",
"version": "0.0.0",
"private": true,
"description": "The unified agent engine for Kimi (v2 — DI Scope architecture)",
"license": "MIT",
"author": "Moonshot AI",
"homepage": "https://github.com/MoonshotAI/kimi-code/tree/main/packages/agent-core-v2#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/MoonshotAI/kimi-code.git",
"directory": "packages/agent-core-v2"
},
"bugs": {
"url": "https://github.com/MoonshotAI/kimi-code/issues"
},
"keywords": [
"kimi",
"agent",
"ai",
"llm",
"session",
"tools"
],
"files": [
"dist"
],
"type": "module",
"imports": {
"#/*": "./src/*.ts"
},
"exports": {
".": {
"types": "./src/index.ts",
"default": "./src/index.ts"
},
"./package.json": {
"types": "./package.json",
"default": "./package.json"
},
"./*": {
"types": "./src/*.ts",
"default": "./src/*.ts"
}
},
"scripts": {
"build": "tsdown",
"test": "vitest run",
"typecheck": "tsc -p tsconfig.json --noEmit",
"gen:contract-types": "node scripts/gen-contract-types.mjs",
"lint:domain": "node scripts/check-domain-layers.mjs",
"clean": "rm -rf dist",
"dep-graph:analyze": "tsx scripts/dep-graph/cli.ts",
"dep-graph:dev": "vite --config scripts/dep-graph/vite.config.ts",
"dep-graph:lint": "tsx scripts/dep-graph/lint.ts"
},
"dependencies": {
"@antfu/utils": "^9.3.0",
"@anthropic-ai/sdk": "^0.95.2",
"@google/genai": "^1.49.0",
"@jsquash/webp": "^1.5.0",
"@modelcontextprotocol/sdk": "^1.29.0",
"@moonshot-ai/kimi-code-oauth": "workspace:^",
"@moonshot-ai/minidb": "workspace:^",
"@moonshot-ai/protocol": "workspace:^",
"@mozilla/readability": "^0.6.0",
"ajv": "^8.18.0",
"ajv-formats": "^3.0.1",
"chokidar": "^4.0.3",
"ignore": "^5.3.2",
"jimp": "^1.6.1",
"js-yaml": "^4.1.1",
"linkedom": "^0.18.12",
"node-pty": "^1.1.0",
"nunjucks": "^3.2.4",
"openai": "^6.34.0",
"pathe": "^2.0.3",
"picomatch": "^4.0.4",
"retry": "0.13.1",
"smol-toml": "^1.6.1",
"socks": "^2.8.9",
"tar": "^7.5.13",
"ulid": "^3.0.1",
"undici": "^7.27.1",
"yauzl": "^3.3.0",
"yazl": "^3.3.1",
"zod": "^4.3.6"
},
"devDependencies": {
"@dagrejs/dagre": "^1.1.4",
"@types/js-yaml": "^4.0.9",
"@types/nunjucks": "^3.2.6",
"@types/picomatch": "^4.0.3",
"@types/react": "^19.1.2",
"@types/react-dom": "^19.1.2",
"@types/retry": "0.12.0",
"@types/sinon": "^21.0.1",
"@types/tar": "^7.0.87",
"@types/yauzl": "^2.10.3",
"@types/yazl": "^2.4.6",
"@vitejs/plugin-react": "^4.4.1",
"@xyflow/react": "^12.4.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"sinon": "^22.0.0",
"ts-morph": "^28.0.0",
"tsx": "^4.21.0",
"vite": "^6.3.3"
}
}