Commit Graph

1211 Commits

Author SHA1 Message Date
IronRookieCoder
7b3260e757 fix(ink): restore Git Bash raw input handling
## Bug 详情
Windows Git Bash 终端下,csc 4.1.x 的 REPL 输入异常:回车需要按两次,方向键无法选择历史对话,输入 / 无法正常显示或触发命令。

## 根因
Windows raw mode 风险判断将 Git for Windows 的 MINGW64/MINGW32 与 MSYS2/Cygwin/mintty 环境一并禁用 raw mode,导致 Git Bash 走 cooked input fallback,Ink 无法按预期解析 Enter、方向键和 slash 输入。

## 修复方案
将 Git for Windows 的 MINGW64/MINGW32 从 raw mode 不安全名单中排除,恢复 Git Bash 的 raw mode 输入处理,同时保留 MSYS/UCRT/CLANG/Cygwin 和显式禁用开关的保护路径。

## 变更要点
- 调整 Ink raw mode 风险检测,Git Bash 保持 raw mode
- 同步启动早期输入捕获的 Git Bash raw mode 判断
- 增加 Git Bash raw mode 回归测试,并保留 MSYS2/Cygwin 场景覆盖

## 自测
- bun test packages/@ant/ink/src/core/__tests__/raw-mode-support.test.ts src/utils/__tests__/earlyInput.test.ts
- git diff --check
- bun run typecheck(失败,失败点为仓库既有 Zod 类型、缺失声明、MACRO.COMMIT、AppState 等错误,不涉及本次修改文件)
2026-05-18 17:13:17 +08:00
Askhz
5b19f83040 fix: 禁用 build.ts 中的 CONTEXT_COLLAPSE
与 defines.ts 和 dev.ts 保持一致,构建产物中也不再启用空壳
CONTEXT_COLLAPSE,恢复 autocompact 正常工作。

Co-Authored-By: CoStrict-DeepSeek-V4-Pro <deepseek-ai@claude-code-best.win>
2026-05-18 16:49:59 +08:00
geroge
99f99b74e8
Merge pull request #120 from IronRookieCoder/personal/plugin-auto-update-config
fix(plugin): make marketplace auto-update configurable by default
2026-05-18 16:43:08 +08:00
Askhz
9062511428 fix: 禁用 CONTEXT_COLLAPSE 修复自动压缩不触发的问题
CONTEXT_COLLAPSE 是空壳 stub,启用后会在 shouldAutoCompact() 中抑制
autocompact,但自身的 collapse 能力并未实现,导致上下文超限后不会触发
自动压缩,一直涨到 API 返回 413 硬报错。

上游已在 0290fe32 修复,CSC 在合并 upstream/main v2.4.2 时漏掉了这个
变更。此次修复与上游一致:注释掉 defines.ts 和 dev.ts 中的
CONTEXT_COLLAPSE feature flag。

Co-Authored-By: CoStrict-DeepSeek-V4-Pro <deepseek-ai@claude-code-best.win>
2026-05-18 16:11:19 +08:00
IronRookieCoder
416e2767ed fix(query): surface missing task tool call failures
## Bug 详情
GLM-5 返回 `stop_reason=tool_use` 但没有携带真实任务工具调用时,任务列表流程会停在“准备查看/更新任务”的文本状态,用户无法判断任务是卡住还是已结束。

## 根因
原有缺失工具调用恢复逻辑会尝试追加一次隐式恢复提示;任务相关场景下如果模型没有发出 `TaskList`、`TaskUpdate` 等实际工具调用,缺少用户可见的失败提示。

## 修复方案
对任务相关的缺失工具调用直接输出英文错误,并保留普通缺失工具调用的一次恢复机会;同时把合成缺失工具结果占位改为明确英文失败文案。

## 变更要点
- 新增任务相关 `stop_reason=tool_use` 但无工具调用的检测和失败返回
- 新增通用缺失工具调用恢复失败时的英文错误提示
- 将合成缺失工具结果文案从内部占位改为用户可理解的失败说明
- 增加 query 缺失工具调用恢复路径测试

## 自测
- `bun test src/__tests__/queryMissingToolUseRecovery.test.ts`
- `bun test src/utils/__tests__/messages.test.ts`
- `bun run typecheck` 未完全通过,剩余错误来自仓库既有问题;本次修改相关文件无 TypeScript 错误
2026-05-18 14:50:56 +08:00
IronRookieCoder
602efce18a docs: update contributors 2026-05-18 00:32:15 +00:00
IronRookieCoder
3a463313ea fix(plugin): make marketplace auto-update configurable by default
## Bug 详情
/plugin marketplace 中的 Enable/Disable auto-update 会继承 CLI binary auto-updater 的禁用状态。在 CSC 默认关闭 CLI auto-updater 的场景下,plugin marketplace 的自动更新配置入口不可见,用户无法按 marketplace 配置 autoUpdate。

## 根因
shouldSkipPluginAutoupdate() 复用了 isAutoUpdaterDisabled(),导致 ENABLE_AUTOUPDATER、/config channel、development build、nonessential traffic 等 CLI updater 门禁同时影响 plugin marketplace 自动更新。

## 修复方案
将 plugin marketplace auto-update 门禁收敛为 DISABLE_AUTOUPDATER 和 FORCE_AUTOUPDATE_PLUGINS:默认不跳过 plugin auto-update;DISABLE_AUTOUPDATER 显式关闭;FORCE_AUTOUPDATE_PLUGINS 可覆盖关闭状态。

## 变更要点
- 调整 shouldSkipPluginAutoupdate(),使 plugin auto-update 独立于 CLI binary updater 配置
- 新增 plugin autoupdate 门禁单元测试
- 补充 plugin auto-update 机制文档,记录 UI、配置优先级和环境变量行为

## 自测
- bun test src/utils/__tests__/pluginAutoupdateConfig.test.ts
- bun test src/utils/settings/__tests__/config.test.ts
- bun run typecheck 仍失败,失败项为仓库既有 Zod 类型、缺声明和依赖类型问题,非本次变更引入
2026-05-16 16:58:20 +08:00
github-actions[bot]
9cdff19cb7 chore(release): bump version to 4.1.1 2026-05-16 03:32:18 +00:00
geroge
7178eac204
Merge pull request #116 from IronRookieCoder/fix/tasks-tool-arguments-repair
Fix/tasks tool arguments repair
2026-05-16 10:59:25 +08:00
geroge
d042115b6a
Merge pull request #115 from IronRookieCoder/fix-exit-terminal-state
Fix exit terminal state
2026-05-16 10:59:03 +08:00
geroge
b49678aaf0
Merge pull request #118 from IronRookieCoder/fix/agents-build-empty-list
Fix/agents build empty list
2026-05-16 10:58:08 +08:00
IronRookieCoder
aaeb662bee fix(agents): reload empty agent definitions in menu
## Bug 详情
生产构建后执行交互式 /agents 时,菜单可能从 AppState 读到空的 agentDefinitions,导致显示 No agents found;同一环境下 bun run dev 可以正常显示 agents。

## 根因
生产 bundle 中底层 agent loader 和内置 agents 均可用,但 /agents 动态菜单只消费启动时注入的 AppState.agentDefinitions。构建产物复现时该状态可能为空,菜单没有现场刷新兜底。

## 修复方案
在 AgentsMenu 打开时检测 allAgents 和 activeAgents 是否同时为空;为空时基于当前 cwd 调用 getAgentDefinitionsWithOverrides 重新加载并写回 AppState,正常已有 agents 的路径直接跳过。

## 变更要点
- 为 AgentsMenu 增加空 agentDefinitions 的 fallback reload
- 使用取消标记避免组件卸载后继续写状态
- 保持现有编辑、删除和正常 dev 路径不变

## 自测
- bun run build
- ./dist/cli-bun.js agents 可列出 27 active agents
- bun run typecheck 仍存在仓库既有类型错误,未新增 AgentsMenu 相关错误
2026-05-16 10:48:31 +08:00
IronRookieCoder
fd55d42048
Merge branch 'y574444354:main' into main 2026-05-16 09:08:18 +08:00
linkai0924
091d3a07d1
Merge pull request #117 from y574444354/fix/hub-command
fix(favorite): ensure /hub enabled skills appear in command list immediately
2026-05-15 22:49:22 +08:00
林凯90331
5bfaeb21bd fix(favorite): ensure /hub enabled skills appear in command list immediately
Replace incomplete clearSkillCaches() with clearCommandsCache() so the

loadAllCommands memoize layer is also busted when a cloud favorite skill is

enabled or disabled via /hub.

Add skillChangeDetector.notify() to trigger an immediate REPL command list

refresh instead of waiting for the file watcher to detect the change.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 22:46:03 +08:00
IronRookieCoder
1b8e022522 fix(openai): recover missing streamed tool calls
## Bug 详情
OpenAI 兼容流在部分工具调用场景下会出现累计参数片段、复用 tool_calls index 或结束原因为 tool_calls 但缺少 tool_use 块,导致后续 TaskUpdate 等工具调用丢失或参数解析失败。

## 根因
OpenAI stream adapter 直接透传参数片段,无法区分累计快照和增量片段;同一 tool_calls index 被后端复用时也没有重开 tool_use 块。Task 工具参数 JSON 解析失败后统一退回空对象,query 主循环也没有对 stop_reason=tool_use 但无 tool_use 块的响应做恢复。

## 修复方案
在 OpenAI stream adapter 中去重累计参数并处理工具身份变化;仅对 Task 工具做窄范围参数修复,避免将无效 TaskUpdate 修复成 no-op;query 主循环发现缺失 tool_use 块时追加一次元消息让模型补发工具调用。

## 变更要点
- 修复 OpenAI 工具流参数快照去重和 tool_calls index 复用处理
- 增加 TaskCreate/TaskGet/TaskList/TaskUpdate 的解析失败窄范围容错
- 阻止无效 TaskUpdate status 或仅 taskId 输入被修复成空更新
- 增加缺失 tool_use 块的一次性 query recovery transition
- 补充 stream adapter、Task 参数修复和 query recovery 回归测试

## 自测
- bun test packages/@ant/model-provider/src/shared/__tests__/openaiStreamAdapter.test.ts src/utils/__tests__/messages.test.ts src/__tests__/queryMissingToolUseRecovery.test.ts
- bun run typecheck 当前仍失败,错误位于既有未改动文件。
2026-05-15 21:19:04 +08:00
IronRookieCoder
4aa15ac52a fix(terminal): clear Ink UI on REPL shutdown
## Bug 详情
使用 /exit 退出交互式 REPL 后,终端可能保留提示输入、命令补全或其他 Ink 临时 UI,导致 shell prompt 与旧 UI 重叠,出现光标和显示异常。

## 根因
shutdown 路径会恢复 raw mode、bracketed paste、focus reporting 等终端模式,但普通主屏幕 REPL 不会清理 Ink 当前占用的可见区域。进程退出前 React 也不一定能完成 /exit 输入清空后的重新渲染。

## 修复方案
在 Ink 实例中增加主屏幕 shutdown 清理方法,根据最后一帧和声明光标位置清除 Ink 占用区域;gracefulShutdown 在非 alternate-screen 场景调用该方法,alternate-screen 继续保留原有退出逻辑。

## 变更要点
- 新增 ERASE_TO_END_SCREEN CSI 常量用于从当前光标位置清到屏幕底部
- 增加 Ink.clearMainScreenForShutdown() 统一计算并清理主屏幕 REPL 区域
- 在 gracefulShutdown 的终端清理阶段区分 alternate-screen 和主屏幕 Ink 实例

## 自测
- 已运行局部 Biome 检查:bunx biome check packages/@ant/ink/src/core/ink.tsx packages/@ant/ink/src/core/termio/csi.ts src/utils/gracefulShutdown.ts
- 已通过 Bun 直接导入验证新增 Ink 方法和 gracefulShutdown 模块可解析
- 全量 typecheck/build 当前被既有无关问题阻断:ctx_viz/LogoV2/doubaoSTT 类型错误,以及 generate-review-builtin 访问 git@github.com:zgsm-ai/costrict-review.git 失败
2026-05-15 19:03:35 +08:00
DoSun
754157fd88
Merge pull request #114 from Askhz/fix/thinking-model-duplicate-response
fix(serve): skip thinking-only message fragments to prevent duplicate response in cs-cloud
2026-05-15 18:12:58 +08:00
Askhz
02899ce69f fix(serve): skip thinking-only message fragments to prevent duplicate response in cs-cloud
normalizeMessages() splits a multi-block AssistantMessage (e.g. [thinking,
text]) into one message per content block. When serve mode emits both the
thinking-only fragment and the text message as separate session.message events,
cs-cloud's adaptMessageEvent creates two assistant messages (one via the
streaming path, one via the non-streaming path), causing the response to appear
twice in the UI.

Fix: skip thinking-only normalized messages in normalizeMessage(), since the
thinking content is already rendered via the stream_event path.

Co-Authored-By: claude-sonnet-4-6 <noreply@anthropic.com>
2026-05-15 17:58:53 +08:00
github-actions[bot]
7f9d8ba78a chore(release): bump version to 4.1.0 2026-05-15 09:03:10 +00:00
linkai0924
81b8abc9e3
Merge pull request #84 from IronRookieCoder/fix/issue-34-agent-team-idle
fix(agent-team): handle idle teammate coordination failures
2026-05-15 17:01:46 +08:00
linkai0924
0b271a7847
Merge pull request #86 from IronRookieCoder/fix-snip-tool
fix(builtin-tools): handle undefined message_ids in SnipTool.call()
2026-05-15 17:01:26 +08:00
linkai0924
8f1d3cebd9
Merge pull request #113 from y574444354/opt/mcp-detector
opt/mcp detector
2026-05-15 16:56:06 +08:00
林凯90331
c45544c066 fix(mcp): add availability hint for failed servers in list panel
Show 'failed (may be unavailable)' next to disconnected servers instead of plain 'failed'

Add footer note explaining unavailable servers cannot be used until reconnected

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 16:55:02 +08:00
linkai0924
d98b4d0cde
Merge pull request #112 from y574444354/opt/mcp-detector
fix(favorite): sync load/unload state and improve error visibility
2026-05-15 16:45:49 +08:00
林凯90331
b0f10760fe fix(favorite): sync load/unload state and improve error visibility
Clear listFavoriteItems cache after load/unload to ensure UI reflects latest state on next open

Filter defaultValue by Active status in cloud-enabled menu so unloaded items are not pre-selected

Surface specific error reasons instead of generic failure count in cloud-enabled menu

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 16:44:24 +08:00
linkai0924
d1f5ee72a5
Merge pull request #111 from y574444354/feat/upgrade-fix
fix(update): enhance failure diagnostics and prevent claude symlink deletion
2026-05-15 16:23:55 +08:00
林凯90331
c2d5077cf9 fix(update): enhance failure diagnostics and prevent claude symlink deletion
Add analyzeNpmError() to classify npm install failures (permission, network, missing package, locked file, etc.) and return InstallResult with errorCategory, suggestion, and raw npmStderr.

Display targeted troubleshooting steps with colored cause and fix suggestions when csc update fails.

Fix removeInstalledSymlink() to only delete symlinks pointing into our managed ~/.local/share/claude/versions/ directory, preventing accidental removal of user-installed claude binaries from other sources.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 16:19:13 +08:00
linkai0924
2857e77065
Merge pull request #110 from y574444354/fix/rawdump-0515
fix(raw-dump): reverse commit order to prevent duplicate uploads
2026-05-15 15:39:54 +08:00
林凯90331
47aa3271be fix(raw-dump): reverse commit order to prevent duplicate uploads
Add --reverse to git log in getCommitLog so commits are returned
oldest-first. Previously, git log defaulted to newest-first, causing
the loop in uploadCommits to overwrite state with the oldest commit.
The next run then queried git log <oldest>..HEAD, re-fetching all
already-uploaded commits and triggering infinite duplicate uploads.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:38:08 +08:00
DoSun
4dc157e493
Merge pull request #108 from y574444354/fix/linux-cloud-hang
Fix/linux cloud hang
2026-05-15 14:56:48 +08:00
DoSun
0dc1f67a04 refactor: remove special handling for upgrade command, simplify logic
统一对所有 cloud 子命令先 ensureCsCloud 再执行,移除对 upgrade
的特殊判断,逻辑更清晰简洁。

Co-Authored-By: claude-sonnet-4-6 <noreply@anthropic.com>
2026-05-15 14:53:01 +08:00
DoSun
bf62a5e118 fix: use process.argv to get raw args for cs-cloud to fix Linux hang issue
参考 opencode 实现,从 process.argv 重新获取原始参数,避免 commander 的
参数解析影响 cs-cloud 的正常运行。修复 Linux 上通过 csc cloud start
调用会卡住的问题。

Co-Authored-By: claude-sonnet-4-6 <noreply@anthropic.com>
2026-05-15 14:49:49 +08:00
linkai0924
10ef26b1d4
Merge pull request #107 from y574444354/fix/raw-dump-ua
fix(raw-dump): add user-agent header to worker requests
2026-05-15 14:47:27 +08:00
IronRookieCoder
39106e4f9d
Merge branch 'main' into fix-snip-tool 2026-05-15 14:40:34 +08:00
geroge
37fe62a5de
Merge pull request #91 from IronRookieCoder/fix/issue-49-show-memory-pid
feat(config): add showMemoryPid setting to toggle footer memory/PID display
2026-05-15 14:34:04 +08:00
林凯90331
3be987891b fix(raw-dump): add user-agent header to worker requests
Set User-Agent to csc/${version} in both auth() and authWithFallback()

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 14:33:33 +08:00
geroge
ba9c2e1538
Merge pull request #89 from IronRookieCoder/fix/issue-46-47
fix(windows): prevent terminal startup failures
2026-05-15 14:33:28 +08:00
geroge
8e52334f0a
Merge pull request #83 from IronRookieCoder/fix/issue-37-bash-autobg
fix(bash): wake foreground task after auto-backgrounding
2026-05-15 14:32:20 +08:00
geroge
0007879cf4
Merge pull request #82 from IronRookieCoder/fix/issue-41
fix(cursor): handle ANSI wrapped line offset recovery
2026-05-15 14:31:48 +08:00
DoSun
ecb0df50d3 fix: add type guards and null checks for UUID handling in snip functionality
- Add UUID type import and type guard in force-snip command
- Add null/undefined checks in snipCompact, snipProjection, and sessionStorage
- Improve optional chaining in SnipTool for safer property access
- Prevent potential runtime errors from invalid UUID values

Co-Authored-By: claude-sonnet-4-6 <noreply@anthropic.com>
2026-05-15 14:26:33 +08:00
github-actions[bot]
de83394e8a chore(release): bump version to 4.0.26 2026-05-15 03:47:01 +00:00
linkai0924
7d38f3af4b
Merge pull request #106 from y574444354/fix/semver
fix(deps): move semver from devDependencies to dependencies
2026-05-15 11:44:22 +08:00
林凯90331
c0ff0fb716 fix(deps): move semver from devDependencies to dependencies
semver is required at runtime by the Node.js polyfill in cli-node.js

(globalThis.Bun.semver fallback) and by src/utils/semver.ts fallback.

Moving it to dependencies ensures it is installed during global npm install.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 11:39:45 +08:00
github-actions[bot]
90f27f36d6 chore(release): bump version to 4.0.25 2026-05-15 03:18:45 +00:00
linkai0924
117a857b25
Merge pull request #105 from y574444354/fix/publish
ci(publish-npm): fix publish workflow
2026-05-15 11:18:01 +08:00
林凯90331
0641c2857f ci(publish-npm): remove --ignore-scripts from publish command
Allow lifecycle scripts to run during npm publish for both actual and dry-run releases.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 11:17:07 +08:00
linkai0924
b90c8fc828
Merge pull request #104 from y574444354/fix/centos-input
fix(ink): treat newline as return and suppress favorite fetch error in TUI
2026-05-15 11:16:39 +08:00
林凯90331
675ebea846 ci(publish-npm): switch from vite build to default build
Replace bun run build:vite with bun run build in the publish workflow.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 11:14:12 +08:00
林凯90331
6b5b801dae fix(ink): treat newline as return and suppress favorite fetch error in TUI
Some terminals on CentOS emit \n or \r\n instead of \r for the Enter key.

Map both sequences to 'return' in parseKeypress so key.return is set correctly.

Replace console.warn with logForDebugging in favorite.ts to prevent

network errors from polluting the TUI output.

Signed-off-by: 林凯90331 <90331@sangfor.com>

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-15 11:06:18 +08:00