Repository navigation
feat(hooks): SessionStart source "fork" 区分 fork 与 resume - #80
Merged
Merged
Conversation
CC 2.1.214 对齐: --fork-session / /fork picker 会话应在 SessionStart hook 报告 source "fork", 而非 "resume", 让用户 hook 能区分 fork 与 普通 resume。 4 处类型/schema/可选值对齐 + 2 个 fork 入口报告 fork + 6 个调用点 透传 forkSession 标志: - hooks.ts:3925 executeSessionStartHooks source union + "fork" - sessionStart.ts:36 processSessionStartHooks source union + "fork" - coreSchemas.ts:498 zod enum + "fork" (运行时验证 gate) - hooksConfigManager.ts:91 matcherMetadata.values + "fork" (可选值列表) - REPL.tsx:2473 /resume picker fork 路径报告 "fork" - conversationRecovery.ts:460 loadConversationForResume 增 forkSession 参, :575 forkSession ? "fork" : "resume" - main.tsx 4 调用点透传 !!options.forkSession (ccshare 恒 true) - print.ts 2 headless 调用点透传 !!options.forkSession 新增 tests/hooks/sessionStartForkSource.test.ts (4 tests): zod 接受/拒绝 source + matcherMetadata 可选值含 fork。 typecheck 0; 444 tests pass (无回归); build + build:dev:full pass。 Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 20, 2026
追 CC 2.1.196→2.1.234 Tier-1 特性批量落地 (13 PR): 变更自 v0.4.22: - WS1 DirectoryAdded hook + Notification agent_* 类型 (#73) - WS2 堆叠 slash-skill 调用, 最多 5 前导 (#74) - LSP+filecache 内存泄漏 cap, 对齐 CC 2.1.208 (#76) - skill body-defer 懒加载, item 9 (#78) - SessionStart source "fork" 区分 fork 与 resume (#80) - P2.1 子代理护栏 — 并发/会话/深度三限 (#82) - P1.1 大输出 tool_result tail 预览 (#84) - P4.1 --ax-screen-reader 入口点对齐 — env 别名 + settings key (#86) - item 13 WebSearch per-session 搜索次数上限 (#88) - P4.2 §6 /doctor FUSION_* vs ANTHROPIC_* 环境变量冲突检测 (#90) - P4.2 #1+#3 /doctor MLX 网关连通 + 模型加载探测 (#92) - item 4 MCP 工具自动后台化 FUSION_MCP_AUTO_BACKGROUND_MS (#94) - item 22 审计日志凭证脱敏 (#96) - package.json: version 0.4.22 → 0.4.23 Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #79
背景 (CC 2.1.214 对齐)
--fork-session//forkpicker 会话在 SessionStart hook 报告source: "resume", 无法区分 fork 与普通 resume。CC 2.1.214 新增source: "fork", 让用户 hook 能写 fork-only 逻辑。fusion-code 有 2 个 fork 入口, 之前都报 "resume":
--fork-session(via --continue/--resume →loadConversationForResume)/resumeslash command picker fork (entrypoint === "fork"→ REPL.tsx)改动
4 处类型/schema/可选值对齐 (新增 "fork"):
src/utils/hooks.tsexecuteSessionStartHookssource unionsrc/utils/sessionStart.tsprocessSessionStartHookssource unionsrc/entrypoints/sdk/coreSchemas.tszod enum (运行时验证 gate)src/utils/hooks/hooksConfigManager.tsmatcherMetadata.values (hook 配置可选值列表, 让用户配 fork-only hook)2 个 fork 入口报告 "fork":
src/screens/REPL.tsx/resumepicker:entrypoint === "fork" ? "fork" : "resume"src/utils/conversationRecovery.tsloadConversationForResume增forkSession?: boolean参,forkSession ? "fork" : "resume"6 个调用点透传 forkSession 标志 (向後兼容, undefined → "resume"):
src/main.tsx4 处 (含 ccshare 恒 fork:true)src/cli/print.ts2 处 (headless/print mode)测试
tests/hooks/sessionStartForkSource.test.ts(4 tests):验证
bun run typecheck— 0 errorsbun test src/__tests__/ tests/— 444 pass, 0 fail (无回归)bun run build+bun run build:dev:full— pass注意
main.tsx:5141恒传true。Co-Authored-By: Claude Fable 5 [email protected]