Windows 下从 8.1.0 升级到 8.1.1 后,Claude CLI 订阅模式无法检测 Claude Code,并混入工具调用记录

描述: 我在 Windows 上使用 Alma 的 Claude Subscription / Claude CLI 模式时遇到问题。这个问题是在从 8.1.0 升级到 8.1.1 后开始出现的,8.1.0 版本没有遇到这个问题。

问题 1: Alma 显示 “Claude CLI not found”,但实际上 Claude Code 已经通过 npm 全局安装,并且命令行里可以正常运行。

环境:

  • 系统:Windows

  • Alma 版本:8.1.1

  • 上一个正常版本:8.1.0

  • Claude Code 路径:C:\Users\22965\AppData\Roaming\npm\claude.exe

  • claude --version 输出:2.1.161 (Claude Code)

可能原因: Alma 的 Claude CLI 检测逻辑似乎调用了 which claude。 但 Windows 默认没有 which 命令,Windows 下应该使用 where claude,或使用支持 PATHEXT 的跨平台可执行文件查找方式。

问题 2: 绕过检测问题后,Claude Subscription 模式的回复里会出现工具调用/历史消息内容,例如:

Human: [tool result] {"stdout":"...","stderr":"","exitCode":0,"cwd":"..."} AssistantHuman:

这些内容看起来是内部工具调用结果或历史消息转换时产生的,不应该出现在最终回复里。

期望行为:

  • Windows 下应该能正确检测到已安装的 Claude Code。

  • 工具调用结果不应该以 [tool result]stdoutstderrexitCode 等原始文本形式混入 Claude 的上下文或最终回复。

  • 空的 Human: / Assistant: 前缀也不应该出现在回复中。

可能修复方向:

  • Windows 下使用 where claude,或使用跨平台命令查找逻辑。

  • 在 Claude CLI 历史消息转换时,跳过 tool 类型消息,或者用结构化方式传递工具结果,避免把工具 JSON 当成普通聊天文本拼进 prompt。

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board
💡

Feature Request

Date

About 2 hours ago

Author

Lateautumns

Subscribe to post

Get notified by email when there are changes.