Skip to content

feat: add Kimi CLI agent plugin#306

Merged
subsy merged 4 commits intosubsy:mainfrom
27mfp:feat/add-kimi-agent
Feb 18, 2026
Merged

feat: add Kimi CLI agent plugin#306
subsy merged 4 commits intosubsy:mainfrom
27mfp:feat/add-kimi-agent

Conversation

@27mfp
Copy link
Contributor

@27mfp 27mfp commented Feb 15, 2026

Summary

Adds Moonshot AI's Kimi Code CLI as a new agent plugin for Ralph TUI.

Changes

New Files

  • src/plugins/agents/builtin/kimi.ts KimiAgentPlugin implementation with stream-json output parsing, stdin prompt delivery, and Windows encoding compatibility
  • src/plugins/agents/builtin/kimi.test.ts 43 unit tests covering meta, initialization, argument building, JSONL parsing, and edge cases
  • website/content/docs/plugins/agents/kimi.mdx Documentation page with install instructions, configuration, tracing, and troubleshooting

Modified Files

  • src/plugins/agents/builtin/index.ts Register KimiAgentPlugin (import, registration, factory export, class export)
  • src/setup/skill-installer.ts Add kimi: 'kimi' to AGENT_ID_MAP
  • src/tui/output-parser.ts Add Kimi stream-json parsing and formatted display in StreamingOutputParser (all 5 integration points)
  • website/lib/navigation.ts Add Kimi to docs sidebar navigation with 'New' label

How Kimi CLI Integration Works

  1. Ralph TUI runs: kimi --print --input-format text --output-format stream-json [--model NAME]
  2. Prompt is delivered via stdin to avoid shell escaping issues
  3. Output is parsed as JSONL (stream-json) for real-time subagent tracing
  4. On Windows, PYTHONUTF8=1 and PYTHONIOENCODING=utf-8 are injected to prevent charmap encoding errors

Checklist (per CONTRIBUTING.md)

Code Quality

  • Test coverage >50% on new code (43 tests, 64% function coverage)
  • Typecheck passes (bun run typecheck)
  • Lint passes (bun run lint 0 errors)

Documentation

  • Docs page with all required sections (overview, prerequisites, usage, config, tracing, troubleshooting)
  • ABOUTME header on all new source files
  • Navigation updated with 'New' label

Agent Plugin Checklist

  • Plugin file with BaseAgentPlugin extension
  • Meta with all required fields (including skillsPaths)
  • All required methods implemented
  • JSONL parsing functions exported and tested
  • Factory function and class exported
  • Registered in index.ts and AGENT_ID_MAP
  • TUI output parser integration (all 5 points)

Summary by CodeRabbit

  • New Features

    • Kimi CLI agent added with live streaming JSONL parsing, tool-call and structured-output support, selectable model and timeout, and UI-friendly event display.
  • Tests

    • Comprehensive test suite covering Kimi agent setup, streaming parsing and event handling.
  • Documentation

    • New Kimi agent setup, usage, configuration and troubleshooting guide; docs navigation updated.
  • Chores

    • Installer mapping updated to include the Kimi CLI identifier.

Copilot AI review requested due to automatic review settings February 15, 2026 02:00
@vercel
Copy link

vercel bot commented Feb 15, 2026

@27mfp is attempting to deploy a commit to the plgeek Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

Walkthrough

Adds a new Kimi CLI agent plugin with streaming JSONL parsing and event translation, registers and exports it as a builtin agent, integrates Kimi parsing into the TUI output pipeline, includes tests, updates skill-installer mapping, and adds documentation and a navigation entry.

Changes

Cohort / File(s) Summary
Kimi Agent Core
src/plugins/agents/builtin/kimi.ts, src/plugins/agents/builtin/kimi.test.ts
New KimiAgentPlugin and factory plus comprehensive tests. Implements streaming non‑interactive CLI invocation, stdin prompt handling, arg construction, version detection, JSONL→AgentDisplayEvent parsing helpers, and multi‑line aggregation.
Agent Registration & Public API
src/plugins/agents/builtin/index.ts
Register createKimiAgent via registry.registerBuiltin(createKimiAgent) and publicly export createKimiAgent and KimiAgentPlugin.
TUI Output Parsing
src/tui/output-parser.ts
Add Kimi detection (isKimiAgent), KimiEvent type, parseKimiJsonlLine and formatKimiEventForDisplay, and wire Kimi-specific parsing/formatting into StreamingOutputParser and top-level parse flow.
Skill Installer Mapping
src/setup/skill-installer.ts
Add "kimi": "kimi-cli" mapping to AGENT_ID_MAP.
Documentation & Navigation
website/content/docs/plugins/agents/kimi.mdx, website/lib/navigation.ts
Add Kimi agent documentation page and register it in site navigation under Plugins → Agents.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant TUI as Ralph TUI
    participant KimiPlugin as Kimi Agent Plugin
    participant KimiCLI as Kimi CLI
    participant Parser as Output Parser
    participant Display as UI Display

    User->>TUI: run command with Kimi agent
    TUI->>KimiPlugin: execute(prompt, options)
    KimiPlugin->>KimiPlugin: buildArgs() / getStdinInput()
    KimiPlugin->>KimiCLI: spawn process (--print, --input-format text, --output-format stream-json)
    KimiCLI-->>KimiPlugin: stream JSONL lines
    KimiPlugin->>KimiPlugin: buffer partial lines, detect complete JSONL
    loop per complete JSONL line
        KimiPlugin->>KimiPlugin: parseKimiJsonLine() → AgentDisplayEvent[]
        KimiPlugin->>Parser: emit events / onJsonlMessage
    end
    Parser->>Parser: formatKimiEventForDisplay()
    Parser-->>Display: formatted segments (text, tool calls, errors)
    Display-->>User: rendered output
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly Related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat: add Kimi CLI agent plugin' clearly and concisely summarizes the main change: adding a new Kimi CLI agent plugin to Ralph TUI.
Docstring Coverage ✅ Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@src/plugins/agents/builtin/kimi.ts`:
- Around line 66-74: The current logic can emit duplicate error events when an
incoming object has both a content array and top-level error fields: the block
that iterates and pushes from event.content and the later check if (event.type
=== 'error' || event.error) can both run. Fix by short-circuiting after handling
event.content (e.g., return/continue or wrap the later checks in an else) so
once you push events from event.content you do not re-evaluate the top-level
error branch; specifically adjust the block that processes event.content and the
subsequent if (event.type === 'error' || event.error) / events.push calls to be
mutually exclusive.

In `@src/tui/output-parser.ts`:
- Around line 109-128: parseKimiJsonlLine currently rejects top-level text
events (e.g., {"type":"text","text":"..."}) because it only accepts objects with
parsed.role and parsed.content or error/type fields; update parseKimiJsonlLine
to also detect and accept top-level text events by checking if parsed.type ===
'text' and typeof parsed.text === 'string' (return { success: true, event:
parsed }), leaving the existing role/content and error checks intact so other
KimiEvent shapes are still validated.
- Around line 134-181: The function formatKimiEventForDisplay currently returns
undefined for top-level text events because it only treats missing content as
errors; update the early branch that checks !event.content to also handle
top-level text by returning event.text (or String(event.text)) when event.type
=== 'text' or event.text is present, optionally truncating to a sensible length,
before falling through to content processing; modify the block inside
formatKimiEventForDisplay that handles the absence of event.content (the if
(!event.content || !Array.isArray(event.content)) branch) to return the
top-level text value instead of undefined.
🧹 Nitpick comments (3)
src/plugins/agents/builtin/kimi.ts (2)

405-414: Redundant type checks in validateModel.

The parameter model is typed as string, so model === undefined (line 406) and typeof model !== 'string' (line 410) are unreachable. This is harmless defensive code but adds unnecessary noise.

Simplified version
 override validateModel(model: string): string | null {
-  if (model === '' || model === undefined) {
+  if (model === '') {
     return null;
   }
-  // Kimi CLI accepts various model identifiers; basic validation only
-  if (typeof model !== 'string' || model.trim().length === 0) {
+  if (model.trim().length === 0) {
     return 'Model name must be a non-empty string';
   }
   return null;
 }

30-31: Minor: redundant length check.

!jsonLine already evaluates to true for an empty string, making jsonLine.length === 0 redundant.

Simplified guard
-  if (!jsonLine || jsonLine.length === 0) return [];
+  if (!jsonLine) return [];
src/tui/output-parser.ts (1)

1042-1060: Fragile string-prefix matching for segment colouring.

The colour logic checks displayText.startsWith('[Tool:') and displayText.startsWith('[Tool Error]') rather than inspecting the event structure. Other agents (OpenCode, Gemini, Codex) check event.type directly. If formatKimiEventForDisplay formatting ever changes, this breaks silently.

This is minor given Kimi tool events are nested in the content array and don't have a simple top-level type, but worth noting for future maintainability.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive support for Moonshot AI's Kimi Code CLI as a new agent plugin for Ralph TUI. The implementation follows established patterns from existing agent plugins (Gemini, Codex, Cursor) and includes full integration with the TUI's output parsing, subagent tracing, and skill installation systems.

Changes:

  • Added KimiAgentPlugin with stream-json output parsing and stdin prompt delivery
  • Integrated Kimi parsing into TUI output-parser.ts for real-time event display
  • Added comprehensive test suite (43 tests) covering meta, initialization, JSONL parsing, and edge cases
  • Created detailed documentation page with installation instructions, configuration, and troubleshooting

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/plugins/agents/builtin/kimi.ts Core plugin implementation with JSONL parsing, Windows UTF-8 compatibility, and stdin prompt delivery
src/plugins/agents/builtin/kimi.test.ts Comprehensive test suite (401 lines, 43 tests) covering all plugin functionality
src/plugins/agents/builtin/index.ts Plugin registration, factory export, and class export
src/setup/skill-installer.ts Added kimi to AGENT_ID_MAP for skill installation support
src/tui/output-parser.ts Added Kimi stream-json parsing functions and integrated into all 5 parsing entry points
website/content/docs/plugins/agents/kimi.mdx Complete documentation with prerequisites, usage, configuration, and troubleshooting
website/lib/navigation.ts Added Kimi to agent navigation (alphabetically positioned between GitHub Copilot and Kiro)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

subsy pushed a commit that referenced this pull request Feb 18, 2026
- Fix duplicate error events: use else-if chain in parseKimiJsonLine to
  prevent emitting both content-array errors and top-level error events
  for the same JSON object
- Add missing top-level text event handling in output-parser.ts
  parseKimiJsonlLine and formatKimiEventForDisplay so {type:"text"}
  events are recognized and displayed
- Use shared extractErrorMessage utility instead of inline error
  extraction, consistent with Gemini/Codex/Cursor plugins
- Remove redundant type checks in validateModel (parameter is already
  typed as string)
- Remove redundant length check (empty string is already falsy)
- Replace fragile string-prefix matching for segment coloring with
  event-structure-based detection

https://claude.ai/code/session_01FKwSxkif6BK1evwQ2RqNjt
subsy pushed a commit to 27mfp/ralph-tui that referenced this pull request Feb 18, 2026
- Fix duplicate error events: use else-if chain in parseKimiJsonLine to
  prevent emitting both content-array errors and top-level error events
  for the same JSON object
- Add missing top-level text event handling in output-parser.ts
  parseKimiJsonlLine and formatKimiEventForDisplay so {type:"text"}
  events are recognized and displayed
- Use shared extractErrorMessage utility instead of inline error
  extraction, consistent with Gemini/Codex/Cursor plugins
- Remove redundant type checks in validateModel (parameter is already
  typed as string)
- Remove redundant length check (empty string is already falsy)
- Replace fragile string-prefix matching for segment coloring with
  event-structure-based detection

https://claude.ai/code/session_01FKwSxkif6BK1evwQ2RqNjt
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/tui/output-parser.ts (1)

146-152: Consider using the shared extractErrorMessage utility here for consistency with kimi.ts.

kimi.ts (line 69) uses extractErrorMessage from utils.js for exactly this pattern. The inline typeof event.error === 'string' ? ... : ... chain duplicates that logic.

♻️ Proposed refactor

Add the import at the top of the file:

+import { extractErrorMessage } from '../plugins/agents/utils.js';

Then simplify the error block:

-    if (event.type === 'error' || event.error) {
-      const msg = typeof event.error === 'string' ? event.error :
-        typeof event.error === 'object' && event.error !== null && 'message' in event.error
-          ? String((event.error as { message?: unknown }).message)
-          : event.message || 'Unknown error';
-      return `Error: ${msg}`;
-    }
+    if (event.type === 'error' || event.error) {
+      const msg = extractErrorMessage(event.error) || extractErrorMessage(event.message) || 'Unknown error';
+      return `Error: ${msg}`;
+    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tui/output-parser.ts` around lines 146 - 152, Replace the inline
error-extraction logic in the event handler with the shared utility: import
extractErrorMessage from the utils module at the top of the file, then call
extractErrorMessage(event.error ?? event) (or otherwise pass the event/error
into extractErrorMessage) inside the block that currently computes msg and
return `Error: ${...}`; update the error branch that checks event.type ===
'error' || event.error to use extractErrorMessage instead of the ternary/object
checks so the code mirrors the behavior used in kimi.ts.
src/plugins/agents/builtin/kimi.ts (1)

402-407: Simplify or remove the validateModel override—both branches return null.

The method always returns null regardless of input, making it functionally identical to the base class. The guard clause checking for empty strings is dead code. Either simplify to return null; or remove the override entirely.

Proposed simplification
-  override validateModel(model: string): string | null {
-    if (model === '' || model.trim().length === 0) {
-      return null;
-    }
-    return null;
-  }
+  override validateModel(_model: string): string | null {
+    return null;
+  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/plugins/agents/builtin/kimi.ts` around lines 402 - 407, The override
validateModel in the class (function validateModel) always returns null and the
empty-string guard is dead code; either remove the entire validateModel override
so the base class implementation is used, or simplify the override to a single
unconditional return null; (update the validateModel method in
src/plugins/agents/builtin/kimi.ts accordingly).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/tui/output-parser.ts`:
- Around line 1059-1061: The isError check in the output parser uses the loose
comparison event.error !== undefined which treats null as an error; update the
logic that sets isError (the const isError in the same block) to use a truthy
check (e.g. !!event.error) so its behavior matches formatKimiEventForDisplay;
specifically change the event.error !== undefined part of the isError expression
to a boolean/coercion check to ensure null is treated as no error.

---

Nitpick comments:
In `@src/plugins/agents/builtin/kimi.ts`:
- Around line 402-407: The override validateModel in the class (function
validateModel) always returns null and the empty-string guard is dead code;
either remove the entire validateModel override so the base class implementation
is used, or simplify the override to a single unconditional return null; (update
the validateModel method in src/plugins/agents/builtin/kimi.ts accordingly).

In `@src/tui/output-parser.ts`:
- Around line 146-152: Replace the inline error-extraction logic in the event
handler with the shared utility: import extractErrorMessage from the utils
module at the top of the file, then call extractErrorMessage(event.error ??
event) (or otherwise pass the event/error into extractErrorMessage) inside the
block that currently computes msg and return `Error: ${...}`; update the error
branch that checks event.type === 'error' || event.error to use
extractErrorMessage instead of the ternary/object checks so the code mirrors the
behavior used in kimi.ts.

27mfp and others added 4 commits February 18, 2026 10:12
Add Moonshot AI's Kimi Code CLI as a new agent plugin for Ralph TUI.

- New KimiAgentPlugin with stream-json output parsing

- TUI output parser integration for real-time formatted display

- 43 unit tests with >50% code coverage

- Documentation page (kimi.mdx) and navigation entry

- AGENT_ID_MAP registration for skill installation

- Windows compatibility with PYTHONUTF8 env var injection
The add-skill tool expects 'kimi-cli' not 'kimi' as the agent identifier. This was discovered during Linux end-to-end testing where skill installation reported 'Invalid agents: kimi'.
- Fix duplicate error events: use else-if chain in parseKimiJsonLine to
  prevent emitting both content-array errors and top-level error events
  for the same JSON object
- Add missing top-level text event handling in output-parser.ts
  parseKimiJsonlLine and formatKimiEventForDisplay so {type:"text"}
  events are recognized and displayed
- Use shared extractErrorMessage utility instead of inline error
  extraction, consistent with Gemini/Codex/Cursor plugins
- Remove redundant type checks in validateModel (parameter is already
  typed as string)
- Remove redundant length check (empty string is already falsy)
- Replace fragile string-prefix matching for segment coloring with
  event-structure-based detection

https://claude.ai/code/session_01FKwSxkif6BK1evwQ2RqNjt
Change `event.error !== undefined` to `!!event.error` so that null
is treated as no-error, matching the behavior of
formatKimiEventForDisplay which uses the truthy check `event.error`.
@subsy subsy force-pushed the feat/add-kimi-agent branch from 0b222ef to 5ed32a7 Compare February 18, 2026 10:14
@vercel
Copy link

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ralph-tui Ignored Ignored Preview Feb 18, 2026 10:14am

Request Review

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 50.72165% with 239 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.00%. Comparing base (07ea6fc) to head (5ed32a7).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/agents/builtin/kimi.ts 53.91% 159 Missing ⚠️
src/tui/output-parser.ts 41.17% 80 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #306      +/-   ##
==========================================
+ Coverage   44.93%   45.00%   +0.07%     
==========================================
  Files          97       98       +1     
  Lines       30546    31020     +474     
==========================================
+ Hits        13727    13962     +235     
- Misses      16819    17058     +239     
Files with missing lines Coverage Δ
src/plugins/agents/builtin/index.ts 93.54% <100.00%> (+0.69%) ⬆️
src/setup/skill-installer.ts 74.17% <100.00%> (+0.14%) ⬆️
src/tui/output-parser.ts 71.61% <41.17%> (-6.15%) ⬇️
src/plugins/agents/builtin/kimi.ts 53.91% <53.91%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@subsy
Copy link
Owner

subsy commented Feb 18, 2026

Thanks @27mfp - fixeed a few outstanding issues and merging now - will be in the 0.9.0 release

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/plugins/agents/builtin/kimi.ts (1)

402-407: Dead if branch in validateModel — both code paths return null.

The condition model === '' || model.trim().length === 0 is never meaningful here: (a) validateSetup already guards with model !== '' before calling validateModel, and (b) even when the condition is true, it returns null — identical to the fallthrough. The entire if block can be removed.

♻️ Proposed fix
 override validateModel(model: string): string | null {
-  if (model === '' || model.trim().length === 0) {
-    return null;
-  }
   return null;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/plugins/agents/builtin/kimi.ts` around lines 402 - 407, The validateModel
method contains a dead if branch that always returns null and is redundant
because validateSetup already guards model !== '' before calling validateModel;
remove the entire conditional inside override validateModel (leave the method as
a single return null) so the function is concise and no-op as intended (refer to
validateModel and validateSetup to confirm the guard behavior).
src/plugins/agents/builtin/kimi.test.ts (1)

114-174: Simplify TestableKimiPluginprotected methods are directly accessible in subclasses.

The as unknown as { buildArgs: ... } casts inside testBuildArgs/testGetStdinInput are unnecessary; subclasses can call this.buildArgs(prompt) directly. Typing plugin as TestableKimiPlugin also removes the repeated (plugin as TestableKimiPlugin) casts throughout the tests.

♻️ Proposed simplification
 describe('KimiAgentPlugin buildArgs', () => {
-    let plugin: KimiAgentPlugin;
+    let plugin: TestableKimiPlugin;
 
-    // Create a test subclass to access protected method
     class TestableKimiPlugin extends KimiAgentPlugin {
         testBuildArgs(prompt: string): string[] {
-            return (this as unknown as { buildArgs: (p: string) => string[] }).buildArgs(prompt);
+            return this.buildArgs(prompt);
         }
 
         testGetStdinInput(prompt: string): string | undefined {
-            return (this as unknown as { getStdinInput: (p: string) => string | undefined }).getStdinInput(prompt);
+            return this.getStdinInput(prompt);
         }
     }
 
     beforeEach(() => {
         plugin = new TestableKimiPlugin();
     });
     // ...
     test('includes --print for non-interactive mode', async () => {
         await plugin.initialize({});
-        const args = (plugin as TestableKimiPlugin).testBuildArgs('test prompt');
+        const args = plugin.testBuildArgs('test prompt');
         expect(args).toContain('--print');
     });
     // (apply same pattern to all other tests in this describe block)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/plugins/agents/builtin/kimi.test.ts` around lines 114 - 174, The
TestableKimiPlugin wrapper is over-using type casts; since protected methods are
callable from subclasses, change testBuildArgs to call this.buildArgs(prompt)
and testGetStdinInput to call this.getStdinInput(prompt) directly, and type the
test variable plugin as TestableKimiPlugin (replace let plugin: KimiAgentPlugin
with let plugin: TestableKimiPlugin) so you can remove all (plugin as
TestableKimiPlugin) casts in tests; update references to buildArgs and
getStdinInput accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/tui/output-parser.ts`:
- Around line 76-105: formatKimiEventForDisplay and parseKimiJsonLine disagree
on how tool errors are detected (formatKimiEventForDisplay checks both
item.is_error and item.return_value?.is_error, while parseKimiJsonLine only
checks item.is_error); to fix, make the detection consistent by updating
parseKimiJsonLine to also check item.return_value?.is_error (and/or
item.return_value?.output/message) so it defensively handles both the direct
content form and any nested return_value form, and update the KimiEvent
type/comments if needed to reflect that both shapes are supported; ensure both
functions (formatKimiEventForDisplay and parseKimiJsonLine) use the same
predicate for tool error detection.

---

Nitpick comments:
In `@src/plugins/agents/builtin/kimi.test.ts`:
- Around line 114-174: The TestableKimiPlugin wrapper is over-using type casts;
since protected methods are callable from subclasses, change testBuildArgs to
call this.buildArgs(prompt) and testGetStdinInput to call
this.getStdinInput(prompt) directly, and type the test variable plugin as
TestableKimiPlugin (replace let plugin: KimiAgentPlugin with let plugin:
TestableKimiPlugin) so you can remove all (plugin as TestableKimiPlugin) casts
in tests; update references to buildArgs and getStdinInput accordingly.

In `@src/plugins/agents/builtin/kimi.ts`:
- Around line 402-407: The validateModel method contains a dead if branch that
always returns null and is redundant because validateSetup already guards model
!== '' before calling validateModel; remove the entire conditional inside
override validateModel (leave the method as a single return null) so the
function is concise and no-op as intended (refer to validateModel and
validateSetup to confirm the guard behavior).

@subsy subsy merged commit 3bafac6 into subsy:main Feb 18, 2026
9 checks passed
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.

3 participants

Comments