Askhz
550dbb5532
feat: serve 模式支持 resume 历史会话继续对话
...
- prompt/prompt_async 接口找不到内存 session 时自动从磁盘历史恢复
- 从 transcript 读取历史 session 的原始 cwd,保证子进程在正确目录启动
- resume 时不传 --session-id 避免与 --resume 冲突(csc 限制)
- sessionManager.createSession 支持传入指定 sessionId,resume 时复用历史 id
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 17:54:25 +08:00
Askhz
f34325f60a
feat: 修复 serve 模式新建会话及消息读取问题
...
- tsconfig.json 加 baseUrl 修复 dev 模式子进程 src/* 路径别名解析
- waitReady/initReject 修复:子进程退出时正确 reject,避免永久 pending
- POST /session 等待子进程 ready 后再返回,避免立即发 prompt 崩溃
- transcriptReader pathCache 不缓存 null,文件未写入时下次可重新查找
- session/status 用 prompting 判断 busy/idle,prompt 结束后正确变为 idle
- /agent 接口补充默认 build 模式
- message.ts 使用 spawnCwd 定位 transcript 文件
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 17:35:05 +08:00
DoSun
265ff7d864
fix: 中断对话时添加 is_interrupted 标记并优化 abort 响应速度
...
- QueryEngine: result 消息新增 is_interrupted 字段,标识用户中断
- sessionHandle: abort() 不再等待子进程退出,改为等待 result 事件(2s 超时兜底)
2026-05-09 16:37:03 +08:00
DoSun
6274c0e2be
fix: 过滤子进程内部合成消息(model switch breadcrumb)不转发给前端
2026-05-09 11:43:10 +08:00
DoSun
0393ce927d
feat: GET /permission 响应格式对齐前端 PermissionRequest 类型
...
- 工具名 PascalCase 映射为小写 permission key(匹配 i18n)
- 从 tool input 提取 patterns(file_path/command 等)
- 补齐 sessionID/id/tool/callID/metadata/always 字段
2026-05-09 11:18:46 +08:00
DoSun
9c3441331c
feat: serve 模式默认启用权限问询(acceptEdits)并修复回复链路
...
- 默认权限模式从 undefined 改为 acceptEdits(工作目录内读写自动放行)
- 始终传递 --permission-prompt-tool stdio 给子进程
- 修复 updatedInput 为 undefined 导致子进程 Zod 解析失败
- always 回复附带 updatedPermissions + decisionClassification
- 新增 permission_replied/question_replied SSE 事件通知 UI 撤销弹窗
- hook_callback 控制请求自动回复防止子进程阻塞
- PendingPermission 保存 permission_suggestions 供 always 回复使用
2026-05-09 11:10:13 +08:00
DoSun
e37e9d3ad5
feat: enable stream_event forwarding for serve mode streaming
...
QueryEngine previously guarded stream_event yields behind includePartialMessages,
which was undefined in serve mode. Remove the guard so stream_event messages
always flow to the child process stdout. Add stream_event handling in
sessionHandle.routeMessage to emit via EventBus for downstream consumers.
2026-05-09 10:04:19 +08:00
DoSun
862a16c295
Merge pull request #50 from Askhz/feat/server-add-session
...
feat: serve 模式 session 列表按工作目录过滤
2026-05-09 10:01:45 +08:00
Askhz
aca6133318
feat: serve 模式 session 列表按工作目录过滤
...
从请求头 x-csc-directory 读取工作目录(cs-cloud 通过此头传递),
GET /session 和 GET /session/status 只返回该目录下的历史会话
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 09:59:26 +08:00
DoSun
5c3f1e16db
fix: read workspace from x-csc-directory header in session creation
2026-05-08 19:02:09 +08:00
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
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
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
DoSun
c55bd43f2e
test: 添加 server 模块单元测试
2026-05-06 14:32:55 +08:00
DoSun
5058953a30
feat: 实现基于 Hono 的 HTTP API 服务器(serve 模式)
2026-05-06 14:32:04 +08:00
claude-code-best
fac9341e73
feat: 全面清理类型错误 — tsc 零错误,any 标注全部消除
...
- 修复所有 33 个原始 tsc 编译错误(ink JSX 声明、类型不匹配、null check 等)
- 清理 176 处 `: any` 类型标注,全部替换为具体推断类型
- 修复清理过程中引入的 41 个回归错误
- 最终结果:0 tsc 错误,0 个非注释 any 标注
- Build 验证通过(25.75MB bundle)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 01:00:10 +08:00
claude-code-best
bd756cc369
feat: 完成stub
2026-03-31 20:40:16 +08:00
claude-code-best
f90eee85d8
feat: build
2026-03-31 19:22:47 +08:00