-
Notifications
You must be signed in to change notification settings - Fork 866
feat(web): support --agent-file option for kimi web command #1712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,9 @@ | |
|
|
||
| import asyncio | ||
| import json | ||
| import os | ||
| import sys | ||
| from pathlib import Path | ||
| from typing import Any | ||
| from uuid import UUID | ||
|
|
||
|
|
@@ -45,16 +47,22 @@ async def run_worker(session_id: UUID) -> None: | |
| path=default_mcp_file, | ||
| ) | ||
|
|
||
| # Resolve agent file from environment (set by `kimi web --agent-file`) | ||
| agent_file_str = os.environ.get("KIMI_WEB_AGENT_FILE") | ||
| agent_file = Path(agent_file_str) if agent_file_str else None | ||
|
|
||
| # Create KimiCLI instance with MCP configuration | ||
| try: | ||
| kimi_cli = await KimiCLI.create(session, mcp_configs=mcp_configs or None) | ||
| kimi_cli = await KimiCLI.create( | ||
| session, agent_file=agent_file, mcp_configs=mcp_configs or None | ||
| ) | ||
|
Comment on lines
+56
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This always passes the Useful? React with 👍 / 👎. |
||
| except MCPConfigError as exc: | ||
| logger.warning( | ||
| "Invalid MCP config in {path}: {error}. Starting without MCP.", | ||
| path=default_mcp_file, | ||
| error=exc, | ||
| ) | ||
| kimi_cli = await KimiCLI.create(session, mcp_configs=None) | ||
| kimi_cli = await KimiCLI.create(session, agent_file=agent_file, mcp_configs=None) | ||
|
|
||
| # Run in wire stdio mode | ||
| await kimi_cli.run_wire_stdio() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new web CLI option accepts any path string without Typer path constraints, so an invalid/non-existent file is accepted at startup and the server still launches. The failure is deferred to worker startup when
KimiCLI.createtries to load the agent spec, causing session-level crashes instead of an immediate actionable CLI error. Addingexists=True,file_okay=True,dir_okay=False, andreadable=Truehere would prevent starting a broken server.Useful? React with 👍 / 👎.