Skip to content

[feature] stage-bundles P1-1:StageBundle schema + 六階段 builtins + override 讀取#152

Merged
Lanznx merged 4 commits into
mainfrom
feat/stage-bundles-p1
Jul 12, 2026
Merged

[feature] stage-bundles P1-1:StageBundle schema + 六階段 builtins + override 讀取#152
Lanznx merged 4 commits into
mainfrom
feat/stage-bundles-p1

Conversation

@Lanznx

@Lanznx Lanznx commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Closes #145.

P1 資料層——每個銷售階段一份缺口板(slots + coach rules + exit criteria)的地基。作戰室 UI 消費留給 #147

內容

  • typesSalesStage 擴為六階段(prospecting 置頂;S18 拍板 demo/proposal 分開,故由原 issue 標題的「五階段」→ 六階段);Thread.lostReason(S18,status 轉 lost 時提示)
  • bundles.tsSlotDef / CoachRuleDef(八種 kind:nextstep-gate / premature-pricing / premature-demo / spin-order / open-question / s-tax / talk-ratio / stage-mismatch)/ StageBundle schema
    • buildBuiltinBundles(t):prospecting(回撥板)與 discovery(SPIN 缺口板)為全量板;demo / proposal / negotiation / closing 從既有 stage guide 的 collect 逐行粗轉(每行 → 一格,doc §8 P1)
    • demo 反轉聆聽比(talk-ratio meMin55)+ open-question 規則
  • override 讀取parseOverrides 防禦性丟棄壞 override(malformed / 壞 JSON 皆不 brick 板)、mergeBundles 整階段替換(S9,無 per-slot merge)、read_stage_bundles Tauri command(仿 read_accounts,讀 config-dir stage-bundles.json
  • i18n:prospecting stage/guide + 44 個 accounts.bundle.*(zh-TW / en 對稱)

測試

src/lib/accounts/bundles.test.ts(12 例):builtins 六階完整 + prospecting 置頂、i18n 全解析(無 raw-key 洩漏)、prospecting 5 格板 + demo 反轉聆聽比、coarse 轉換行數 = 格數、parseOverrides 四類防禦(空/壞 JSON/malformed/未知階段)、mergeBundles 整階段替換。

驗證

  • vitest run:142 passed(含新增 12)
  • tsc --noEmit:pass
  • bun run build:pass
  • cargo check:pass
  • 靜態確認 stage stepper(bits.tsx StageStepper/MiniStages)與 ThreadPage/MeetingLinkSection 皆 data-driven(map over SALES_STAGES + accounts.stage.${s} / accounts.stageGuide.${stage}.*),prospecting 自動被既有 UI 渲染,tsc 排除非窮盡 stage switch → 無 regression 路徑

⚠️ 待補

現場瀏覽器自測(六階 stepper 顯示、「開發」置頂、prospecting 靜態指南渲染)尚未跑——本 session 根在 landing 專案,preview 工具只能啟動 landing dev server。merge 前建議在 parley-rooted session 補一眼現場。

🤖 Generated with Claude Code

Lanznx and others added 2 commits July 12, 2026 00:10
Closes #145. P1 資料層(作戰室缺口板的地基);UI 消費留給 #147。

- types:SalesStage 擴為六階段(prospecting 置頂,S18 拍板 demo/proposal
  分開);Thread.lostReason(S18)
- bundles.ts:SlotDef / CoachRuleDef(八種 kind)/ StageBundle schema;
  buildBuiltinBundles — prospecting(回撥板)與 discovery(SPIN 缺口板)
  全量板,demo/proposal/negotiation/closing 從 stage guide 粗轉(每行
  collect → 一格);demo 反轉聆聽比(meMin55)+開放式問題規則
- override 讀取:parseOverrides 防禦性丟棄壞 override(不 brick 板)、
  mergeBundles 整階段替換(S9)、read_stage_bundles Tauri command(仿
  read_accounts,config-dir stage-bundles.json)
- i18n:prospecting stage/guide + 44 個 accounts.bundle.*(zh-TW / en 對稱)
- bundles.test.ts:12 例(builtins 完整性、prospecting 置頂、coarse 轉換
  行數、override 解析防禦、merge)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
六階改版後 prospecting 置頂,原本寫死的 "discovery" 變成從第二階開始,
新戰線會直接跳過開發階段。改用 SALES_STAGES[0] 表達「從頭開始」的意圖。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Lanznx and others added 2 commits July 13, 2026 00:52
#153)

* [docs] stage-bundles review 補遺:S13–S18 拍板、S19/S20 提案、live 畫面配置、playbook 內容 (#151)

* [docs] stage-bundles: lock S13 (SPIN terminology) & S14 (live board = fill, not gap)

Brandon's review round 1: board headers use S/P/I/N verbatim; the live
right-rail board upgrades the sales intel board in place, and its
framing flips from negative space to fill — freshly captured intel
lands in its slot in real time, ghost rows stay a war-room (pre-call)
visual. Open questions renumbered; P1 ordering still open.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [docs] stage-bundles: lock S15 (war-room board first, live board in P2)

Review round 2: P1 keeps the original ordering — ThreadPage board +
question suggestions first (shared foundation, pre-call value), the
live fill board follows in P2. Remaining open questions annotated with
when they need answers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [docs] stage-bundles: lock S16/S17 — live screen as a second-attention surface

Review round 3, grounded in a real-call screenshot: the live screen
answers three questions only and converges to four active regions
(status band / single intervention slot / fill board / transcript as
reference layer). Timeline analysis moves to replay; info-gathering
checklist items merge into board slots, todos keep action items only.
New §4.4 is the scope basis for the P2 live restructure tickets.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [docs] stage-bundles: fold Brandon's sales playbook into the design (S18-S20 proposals)

From the pipeline-stages + callback/discovery/demo playbook notes:
- S18: add a prospecting stage (cold call / callback home), keep
  closed-won/lost as Thread.status + lostReason; qualification is not
  a stage — it rides S20.
- S19: per-call stage selection — the meeting picks its own stage
  (defaults from the thread); the board follows the call, the thread
  only advances explicitly.
- S20: MEDDIC qualification scorecard as a war-room (post-call)
  projection board in the discovery bundle — empty cells seed openq
  ("fill it after the call; whatever's missing is what you dig next").
- Bundle content: prospecting board sketch (KPI = book the demo),
  discovery slot hints upgraded with the per-letter SPIN discipline
  (S is a tax / spread multiple pains / implication chain / let them
  say the payoff), three new coach rules (premature demo, open-question
  in demos, S-tax overspend), few-shot sources for #148.
- Appendix B: content source = private Drive playbook, with an explicit
  de-identification rule (no competitor names, price anchors, or client
  specifics in this public repo).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* [docs] stage-bundles: lock S18 — six stages, demo and proposal stay separate

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* [fix] 新銷售戰線預設從第一階(開發)起步,不再寫死 discovery

六階改版後 prospecting 置頂,原本寫死的 "discovery" 變成從第二階開始,
新戰線會直接跳過開發階段。改用 SALES_STAGES[0] 表達「從頭開始」的意圖。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* [docs] S19 拍板+新增 S21:缺口板主場改為 live 情報板,P1-3 兩處掛載

Brandon 實測 P1-1 後拍板:階段在錄音主畫面唯一露出是補充背景 dialog
的下拉括號,違反「藏兩層深=不存在」;使用者目標是錄音當下有教練提示
缺什麼、怎麼問。S21 修訂 S15 入口順序——板元件做一次、P1-3 起兩處掛
載(live 情報板為主場、ThreadPage 作戰室為複盤);slotFills 暫態與
§4.4 重排仍留 P2。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* [feature] stage-bundles P1-2:slot 歸屬——Claim.slotIds、萃取標 slot、開板補分類與格狀態

Closes #146。P1-2/4,依賴 P1-1(#145)、被 P1-3(#147)依賴。

- types:Claim.slotIds?: string[](optional 向後相容,零 migration)
- slotState.ts:格狀態純函式——空(0卡)/薄/實(≥1 張新鮮 confirmed
  或 ≥solidAt 張新鮮卡;全過舊 >30 天恆薄);粗查詢兜底(S3):
  未分類卡照 SlotDef.query 預掛,slotIds 存在即權威(含 sentinel)
- 萃取帶 slot:opsSchema 增列 slotIds;會後 diff 路徑注入連結戰線
  stage 的 slot 清單、餵資料路徑注入全部 active 銷售戰線 stage 聯集;
  回傳白名單過濾,approve 時隨 applyExtractedOps 入庫;supersede 繼承
- 開板補分類(backfill.ts):只送 query 命中且本階段未分類的卡,
  一次性 LLM(deep lane)分類寫回 slotIds;負向結果寫階段限定
  sentinel(discovery.none)——該階段不重送、換階段仍可再分類,
  「無新卡不重跑」由資料保證(取代 issue 原提的獨立快取,避免
  跨階段鎖死);in-flight 去重防雙開板
- 門檻落常數 SLOT_SOLID_AT=2/SLOT_STALE_DAYS=30(真卡片庫校準待補,
  doc 開放問題 1)
- 測試 +20:slotState 三態邊界、extract 注入/白名單、backfill
  資格/正規化/去重、store slotIds 入庫與繼承

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* [feature] stage-bundles P1-3 live 面:stage board+slotFills+自動聚焦+建議問法(S19/S21/S22) (#154)

* [feature] stage-bundles P1-3 首切片:live 情報板 stage board(S19 本通階段+S21 可看形態)

銷售模式的情報板頂部掛上缺口板:六階段 chips(本通階段,預設帶連結
戰線的 stage、可當場改、永不寫回戰線 S19)+階段目標+格狀態(空虛
線/薄琥珀/實綠)+已掛卡片預覽+幽靈 hint(該格要收什麼、怎麼問的
種子)+退場條件。開板觸發 #146 補分類(deep lane)寫回 slotIds。
未連結客戶時純指南形態。ThreadPage 作戰室版與 recentIngest highlight
等完整 #147 範圍後續補。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* [feature] live slotFills(§4.3 提前)+建議問法(#148):搜集到了什麼、要講什麼

Brandon 實測回饋:板只會講「要搜集什麼」。補上另外兩塊:

- live slotFills:sales 即時萃取 schema 增列 slotFills(slotId/text/
  quote/speaker),本通階段(S19 解析:每通選擇→戰線→開發)的 slot
  清單注入 prompt;白名單正規化;StageBoard 以「✎ 待審核」樣式落格
  ——只進 UI 暫態,會後審核 approve 才入庫(D8 不破)
- 建議問法(suggest.ts,realtime lane):每格「怎麼問」鈕→slot hint
  +已知卡(不重問)+逐字稿尾段→2-3 句可照唸問句+一行釣什麼;
  §5 語感鐵則入 prompt(接話、開放式優先 demo 例外、一次一問、
  不像問卷);few-shot 素材庫(私有 playbook 去識別化)後續補
- currentStage.ts:本通階段/bundle 的 imperative 解析(extract 用)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* [feature] S22:live 板自動聚焦+密度紀律——方向全自動、使用者只選時機

Brandon 實測回饋:會中沒有注意力做方向選擇(每格手動點問法不可行)、
UI 框中框多色太雜。

- 自動聚焦:focus 搭同一班 30 秒 realtime 萃取(零額外呼叫),LLM 依
  階段內 slot 順序+未填/薄優先+跟著當下話題(跑題拉回)判斷唯一該
  追的格;一句可照唸問句+八字內原因;手動時機=重新整理鈕
- 密度改版:一格一行(狀態點+標籤+最新內容截斷+計數),僅 focus
  格以 secondary 色展開;拿掉框中框、每項 chip、藍色斜體、每格按鈕、
  goal/exit(歸作戰室);BANT 區塊在銷售模式隱藏(slot 已涵蓋)
- 點格手動叫問法(suggest.ts)保留給作戰室(會前有注意力做選擇)
- doc 新增 S22 拍板紀錄

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* [feature] S22 修訂:挑戰回應 focus+點行手動生成+highlight 視覺加強

同日再實測回饋三點:

- 對話非線性:focus 升級為「下一句該說什麼」——對方有未回應的
  挑戰/質疑時優先給回應建議(kind=objection,板頂「回應挑戰」卡),
  否則才追缺口(kind=gap);同班 30s 萃取,零額外呼叫
- 手動自由:點格「行」就地生成該格問法(suggest.ts realtime lane),
  一次一格、再點收合——方向自由保留、密度紀律不破
- highlight 加強:bg-secondary 深色主題辨識不到 → primary 左邊條
  +bg-primary/10+格名染色,餘光可讀

doc S22 補修訂紀錄。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* [fix] 時間軸 tooltip 跑板:靠邊的點不再衝出視窗左上角

tooltip 原本固定「置中+往上」開:點靠左時 224px 寬的卡衝出面板/
視窗左緣,上層 lane(對方提的)的 tooltip 往上逃出時間軸區蓋到轉錄
標頭。改為位置感知:時間軸前 20% 的點左對齊、後 20% 右對齊;上層
lane 往下開、下層 lane 維持往上開。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@Lanznx Lanznx merged commit cd9f50a into main Jul 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] stage-bundles P1-1:StageBundle schema+builtin 五階段 bundle+override 讀取

1 participant