Commit Graph

1000 Commits

Author SHA1 Message Date
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
7512672684
Merge branch 'y574444354:main' into main 2026-05-14 19:11:06 +08:00
linkai0924
8b4d990489
Merge pull request #93 from y574444354/feat/workflow
ci(publish-npm): add debug output and fault tolerance to version bump…
2026-05-14 18:38:42 +08:00
林凯90331
6a55dcb38e ci(publish-npm): add debug output and fault tolerance to version bump step
Add git status and git diff for debugging visibility during release.

Change git add to -A and append || true to commit/push to prevent workflow failures when there are no changes or push issues.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 18:36:52 +08:00
linkai0924
a41232d294
Merge pull request #92 from y574444354/feat/workflow
fix(ci): recreate tag if it points to old commit
2026-05-14 18:18:08 +08:00
林凯90331
ca59e79568 fix(ci): recreate tag if it points to old commit
Add verification output after syncing package.json and defines.ts

so the logs clearly show whether the version bump succeeded.

Also replace 'Create tag if missing' with 'Create or recreate tag'

that deletes and recreates the tag when it points to a stale commit,

preventing checkout of outdated code from previous failed runs.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 18:12:31 +08:00
github-actions[bot]
04aa2dc662 chore(release): bump version to 4.0.20 2026-05-14 09:37:36 +00:00
linkai0924
390540dd78
Merge pull request #90 from y574444354/feat/workflow
fix(ci): correct boolean condition for workflow dispatch inputs
2026-05-14 17:33:53 +08:00
林凯90331
59269f381d fix(ci): correct boolean condition for workflow dispatch inputs
GitHub Actions workflow_dispatch boolean inputs are strings in

expressions ('true'/'false'). Non-empty strings are always truthy,

so !inputs.dry_run always evaluated to false. Use explicit string

comparison to fix version sync and publish step gating.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 17:25:05 +08:00
linkai0924
e8349395ed
Merge pull request #88 from y574444354/feat/workflow
ci: add manual npm publish workflow with dry-run and auto version sync
2026-05-14 17:18:38 +08:00
林凯90331
5890d776dd ci(publish-npm): add ssh setup and review builtin generation
Add SSH agent setup before build so generate-review-builtin.ts

can clone the private costrict-review repo. Also run the

generator explicitly with continue-on-error to ensure the

bundled review skills file exists before Bun.build.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 17:13:30 +08:00
林凯90331
86c68723a4 ci(publish-npm): drop v prefix from tags and skip tests
Use the exact input version for git tags without adding a v prefix.

Also comment out typecheck and test steps to speed up the publish flow.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 17:07:16 +08:00
林凯90331
a23ebc0303 ci(publish-npm): restrict to manual trigger and auto-sync version
Remove push tag trigger so the workflow only runs on manual dispatch.

Add steps to automatically sync package.json and scripts/defines.ts

version before publishing, create the git tag, and skip typecheck.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 16:57:09 +08:00
林凯90331
de53813db3 ci(publish-npm): auto-create missing tag on manual dispatch
When triggering the publish workflow manually with a version that does

not yet have a corresponding git tag, automatically create and push

the v-prefixed tag on the current HEAD instead of failing.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 16:37:35 +08:00
林凯90331
5de3460884 ci(publish-npm): add dry-run support and normalize version input
Add optional dry-run flag to workflow dispatch for validating publishes

without uploading to the registry.

Support version inputs with or without the v prefix by resolving

the correct git ref automatically. Skip changelog generation and

GitHub release creation when running in dry-run mode.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 16:33:03 +08:00
xixingde
5a306c3ea7 feat(auth): update OAuth flow message to reference Costrict branding 2026-05-14 16:28:24 +08:00
xixingde
25ea4a0cf3 feat(auth): add remote API control config to gate third-party providers 2026-05-14 16:03:04 +08:00
IronRookieCoder
95a4430fa2 Revert "fix(bash): wake foreground task after auto-backgrounding"
This reverts commit 1a85db7ca8.
2026-05-14 13:33:00 +08:00
IronRookieCoder
54bc918970
Merge branch 'y574444354:main' into main 2026-05-14 13:24:33 +08:00
IronRookieCoder
1a85db7ca8 fix(bash): wake foreground task after auto-backgrounding
## Bug 详情
用户升级 4.0.16 后,使用过程中 CLI 会话可能一直处于 busy 状态,表现为无法继续输入且没有响应。

## 根因
BashTool 的长命令在已经注册为 foreground task 后被自动后台化时,只设置了 backgroundShellId,但没有唤醒正在等待 progress/result 的 generator。若命令无输出或轮询没有再次触发,主 REPL 会继续等待,输入循环无法释放。

## 修复方案
在 foreground task 自动后台化成功后,立即 resolve 当前 progress 等待器,让 runShellCommand 能观察到 backgroundShellId 并返回后台任务结果。

## 变更要点
- 在 BashTool foreground auto-background 路径补齐 resolveProgress 唤醒逻辑
- 保持已有 spawnBackgroundTask 路径的唤醒行为一致

## 自测
- bun test packages/builtin-tools/src/tools/BashTool/__tests__ 通过
- bun run typecheck 当前仍有仓库既有无关错误,未涉及本次变更
2026-05-14 13:21:58 +08:00
geroge
a1dca02b55
Merge pull request #81 from y574444354/fix/raw-dump
feat(rawDump): add raw dump reporting module with local mode and deduplication
2026-05-14 11:34:01 +08:00
林凯90331
dc82486456 feat(rawDump): enable raw dump by default
Change isEnabled() logic so raw dump is on by default unless
explicitly disabled via CSC_DISABLE_RAW_DUMP=1 or
COSTRICT_DISABLE_RAW_DUMP=1.

Signed-off-by: 林凯90331 <90331@sangfor.com>
Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 11:22:38 +08:00
林凯90331
12caa6706b perf(rawDump): reduce CPU usage and fix worker spawn reliability
Add session messages and repo info caching to avoid repeated JSONL
parsing and git subprocess spawning across tasks.

Share state across all tasks in a single batch to minimize file lock
contention and JSON parse overhead.

Convert queue operations from sync to async to prevent event loop
blocking in the main process.

Restore inline batch worker fallback when external spawn fails,
and increase worker interval from 30s to 2min to reduce CPU impact.

Add 5s debounce per session+messageID to prevent duplicate enqueues.

Improve binary mode spawn reliability by falling back to node runtime
when bun is not available.

Signed-off-by: 林凯90331 <90331@sangfor.com>
Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-14 11:07:02 +08:00
林凯90331
e24ed3b63d feat(rawDump): add raw dump reporting module with local mode and deduplication
Implement the raw dump data reporting module for uploading conversation,
summary, and commit data to the CoStrict endpoint.

Key features:
- Local dump mode for debugging without network
- PID-based file locking to prevent state corruption with multiple csc instances
- 5-minute deduplication window for summary uploads
- Auto-detect sender (user/agent) and conditional user_input
- Repository fields (repo_addr, repo_branch, work_dir) in conversation
- Anonymous interface fallback when auth fails
- Filter commits to current user and limit fetch range
- Skip empty intermediate conversation turns
- Fix worker spawning for build and binary modes
- Remove git diff HEAD fallback to avoid unrelated working tree changes

Signed-off-by: 林凯90331 <90331@sangfor.com>
Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-13 23:49:20 +08:00
y574444354
60856a29bc chore: bump version to 4.0.17 2026-05-13 20:17:39 +08:00
geroge
42107f7d2f
Merge pull request #64 from y574444354/feat/migrate-review-agents
【Review】feat: 将 review skill 迁移到 extract-to-disk 架构
2026-05-13 19:38:26 +08:00
geroge
d3d0dd25d2
Merge pull request #80 from IronRookieCoder/fix/issues-31-32
fix: 修复任务列表数字ID乱序和内存轮询导致滚动跳动
2026-05-13 19:37:25 +08:00
geroge
d8a19f1473
Merge pull request #79 from IronRookieCoder/personal-ironrookiecoder-fix-issue-42-43
fix: merge sub-agent readFileState to prevent cross-agent write confl…
2026-05-13 19:37:09 +08:00
geroge
e570eee02a
Merge pull request #78 from IronRookieCoder/fix/issue-28-costrict-provider
fix: 修复 CoStrict provider 提前停止与 token override 问题
2026-05-13 19:36:34 +08:00
geroge
3cf17ad756
Merge pull request #74 from IronRookieCoder/fix/sdd-design-invalid-tool-params
Fix/sdd design invalid tool params
2026-05-13 19:33:47 +08:00
IronRookieCoder
5ee2d6dcc3 fix: 修复任务列表数字ID乱序和内存轮询导致滚动跳动
两个修复:

1. 任务列表数字ID乱序(#32):新增 compareTaskIds 比较函数,纯数字ID按
   数值大小排序(1, 2, 3, 10 而非 1, 10, 2, 3),非纯数字回退到
   localeCompare 自然排序。listTasks 和 taskStateMessage 两处排序入口
   均已修复。

2. 终端 RSS 内存轮询引发滚动跳动(#31):useRssDisplay hook 新增 isLoading
   参数,仅在加载中启用定时轮询,闲时仅渲染一次内存占用值,避免 Ink 重渲染
   干扰用户滚动查看结果。

附:TaskCreateTool.isConcurrencySafe 改为 false,防止并发任务创建的文件
IO 竞态。

Co-Authored-By: CoStrict-DeepSeek-V4-Pro <deepseek-ai@claude-code-best.win>
2026-05-13 16:44:13 +08:00
IronRookieCoder
233971c6ce fix: merge sub-agent readFileState to prevent cross-agent write conflicts
子代理完成后将其 readFileState 合并回主代理缓存,防止主代理写文件时因
缓存过期而误报 FILE_UNEXPECTEDLY_MODIFIED_ERROR。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 16:36:46 +08:00
kingboung
558d0ac9a2 fix: rename SSH secret to MY_SSH_PRIVATE_KEY
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 16:31:09 +08:00
IronRookieCoder
62f4cb9daf fix: 修复 CoStrict provider 提前停止与 token override 问题 2026-05-13 16:24:34 +08:00
kingboung
e63cc84693 chore: trigger CI
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 16:23:40 +08:00
kingboung
ed513c6292 merge: sync main into feat/migrate-review-agents
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 16:08:01 +08:00
kingboung
167bd1f648 fix: pin CI bun version and regenerate lockfile
CI used bun latest (1.3.13) while local was 1.3.11, causing
frozen-lockfile mismatch. Pin to 1.3.11 and regenerate lockfile.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 09:18:37 +08:00
IronRookieCoder
65e55ac763 Merge remote-tracking branch 'origin' into fix/sdd-design-invalid-tool-params 2026-05-12 21:31:12 +08:00
IronRookieCoder
b58fd8f782 fix: 修复子代理参数兼容问题 2026-05-12 21:24:12 +08:00
kingboung
6ea0297ecb chore: switch review skill download branch to main
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 20:51:25 +08:00
kingboung
e0f8c1a289 fix: show (bundled) label for /review and /security-review commands
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 20:45:33 +08:00
geroge
5c2e1918ca
Merge pull request #73 from mini2s/fix-autocompact
feat(compact): add CoStrict model support and prevent infinite compaction loops
2026-05-12 20:12:15 +08:00
mini2s
a796a328c9 feat(compact): add CoStrict model support and prevent infinite compaction loops 2026-05-12 20:07:24 +08:00
geroge
9fb1410b6f
Merge pull request #72 from Askhz/fix/costrict-subagent-model-inherit
fix: costrict provider 下子 agent 模型别名继承父模型
2026-05-12 19:35:06 +08:00
Askhz
339ef4bc63 fix: costrict provider 下子 agent 模型别名继承父模型
costrict 没有 haiku/sonnet/opus 模型层级,当子 agent(如 Explore)
配置为 haiku 时,parseUserSpecifiedModel 会解析到 Claude haiku
模型 ID 而非继承主会话所选模型。修复为 costrict 下所有 family
alias 强制走 inherit 逻辑,使用 getRuntimeMainLoopModel 以正确
支持 plan mode 等场景。

Co-Authored-By: CoStrict-DeepSeek-V4-Pro <deepseek-ai@claude-code-best.win>
2026-05-12 19:31:36 +08:00
kingboung
680342bc28 chore: remove /strict:review and /strict:security-review commands
Only keep /review and /security-review via extract-to-disk.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 18:00:10 +08:00
kingboung
dbaf0374fc fix: clean target directory before extracting review skills
Regenerate builtin.ts template to rm stale files from previous
version/locale before writing new ones, preventing file residue
when switching languages or upgrading skill versions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 17:42:27 +08:00
kingboung
08ad8a55da refactor: strict review variants load skill via Skill tool
Remove embedded files, use Skill tool to load review/security-review
skill instead, matching the same mechanism as /review.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 17:38:56 +08:00
kingboung
909e001100 feat: register /strict:review and /strict:security-review via registerBundledSkill
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 17:31:24 +08:00
kingboung
5b4d0c2ac1 fix: use process.cwd() for generate-review-builtin cwd on Windows
URL pathname returns /E:/... on Windows which spawnSync can't resolve.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 17:20:27 +08:00