claude-code-best/src/server
林凯90331 0b36424820 feat(server/question): adapt question API to opencode-compatible format
Refactor csc serve question endpoints to match opencode/app-ai-native
expected data models and request/response shapes:

- GET /question now returns QuestionRequest[] (direct array) instead of
  { questions: [...] }
- POST /question/:id/reply accepts { answers: string[][] } mapping to
  selected option labels per question
- POST /question/:id/reject no longer requires a request body
- Support dual question sources:
  - MCP Elicitation (converted to opencode format with enum→options)
  - AskUserQuestionTool permissions exposed as questions
- Add conversion helpers: convertAskUserQuestionToOpencode,
  convertElicitationToOpencode, buildElicitationContent
- Reply to AskUserQuestionTool via replyPermission('allow') with
  constructed updatedInput.answers map

Also includes serve-mode infrastructure improvements:
- Session routes auto-create sessions on demand via getOrCreateSession
- Set CSC_SERVE_MODE env var in child process spawn
- Skip push-suggestion stream waiting in serve mode

Add comprehensive unit tests for question route opencode conversion.

Co-authored-by: CoStrict <zgsm@sangfor.com.cn>
2026-05-09 17:52:43 +08:00
..
__tests__ feat(server/question): adapt question API to opencode-compatible format 2026-05-09 17:52:43 +08:00
backends feat: 全面清理类型错误 — tsc 零错误,any 标注全部消除 2026-04-01 01:00:10 +08:00
routes feat(server/question): adapt question API to opencode-compatible format 2026-05-09 17:52:43 +08:00
connectHeadless.ts feat: 全面清理类型错误 — tsc 零错误,any 标注全部消除 2026-04-01 01:00:10 +08:00
createDirectConnectSession.ts feat: build 2026-03-31 19:22:47 +08:00
directConnectManager.ts feat: build 2026-03-31 19:22:47 +08:00
errors.ts feat(hub): migrate favorite command with auto-enable, real-time toggle and server refactor 2026-05-08 18:18:44 +08:00
eventBus.ts feat(hub): migrate favorite command with auto-enable, real-time toggle and server refactor 2026-05-08 18:18:44 +08:00
parseConnectUrl.ts feat: 全面清理类型错误 — tsc 零错误,any 标注全部消除 2026-04-01 01:00:10 +08:00
server.ts fix: remove debug logs, add model fallback, fix prompt_async flow 2026-05-08 18:42:51 +08:00
serverBanner.ts feat(hub): migrate favorite command with auto-enable, real-time toggle and server refactor 2026-05-08 18:18:44 +08:00
serverLog.ts feat(hub): migrate favorite command with auto-enable, real-time toggle and server refactor 2026-05-08 18:18:44 +08:00
sessionHandle.ts feat(server/question): adapt question API to opencode-compatible format 2026-05-09 17:52:43 +08:00
sessionManager.ts feat(hub): migrate favorite command with auto-enable, real-time toggle and server refactor 2026-05-08 18:18:44 +08:00
transcriptReader.ts feat(hub): migrate favorite command with auto-enable, real-time toggle and server refactor 2026-05-08 18:18:44 +08:00
types.ts feat(hub): migrate favorite command with auto-enable, real-time toggle and server refactor 2026-05-08 18:18:44 +08:00