@oxmumu3/dsh-incidental-learn 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -43,22 +43,28 @@ const MASTERY_LABELS = {
43
43
  const DEFAULT_TRACKS = [
44
44
  {
45
45
  id: 'track-frontend',
46
- title: '前端与交互品味',
47
- subtitle: '现代 CSS 容器查询、原生顶层交互与主题令牌',
46
+ title: '前端与界面体验',
47
+ subtitle: '自适应布局、原生组件、明暗主题与交互细节',
48
48
  order: 1,
49
49
  },
50
50
  {
51
- id: 'track-harness',
52
- title: 'Agent 架构与 DSH Harness 六格主线',
53
- subtitle: '槽位契约、会话隔离、幂等写盘与双端边界',
51
+ id: 'track-engineering',
52
+ title: '架构与工程实践',
53
+ subtitle: '接口边界、读写安全、并发控制与性能取舍',
54
54
  order: 2,
55
55
  },
56
56
  {
57
- id: 'track-growth',
58
- title: '增长分发与内容渠道适配',
59
- subtitle: '微信搜一搜首屏利益点、阅读转化与渠道结构差异',
57
+ id: 'track-ai',
58
+ title: 'AI 与 Agent 协作',
59
+ subtitle: '提示词结构、上下文省流、工具设计与多端配合',
60
60
  order: 3,
61
61
  },
62
+ {
63
+ id: 'track-product',
64
+ title: '产品与增长策略',
65
+ subtitle: '首次上手路径、信息层级、表达结构与分发转化',
66
+ order: 4,
67
+ },
62
68
  ]
63
69
 
64
70
  const STARTER_SAMPLE_PACK = {
@@ -74,7 +80,7 @@ const STARTER_SAMPLE_PACK = {
74
80
  why: '@container 本身不增加选择器权重;写在基础 repeat(2, 1fr) 规则之后,才能在 390px 分屏下真正覆写成单列。',
75
81
  rejected: '用全局 @media(max-width:768px) 猜测面板宽度(宿主分屏时窗口虽宽,插件面板容器其实已变窄)。',
76
82
  probe: '如果把 @container (max-width: 580px) { grid-template-columns: 1fr } 写在双列网格之前,390px 下还会变成单列吗?',
77
- evidenceSummary: '已看过 learn-v2 原型中 390px 分屏溢出 45px 的真坑定位,待独立完成一次跨场景追问。',
83
+ evidenceSummary: '在分屏窄栏场景中独立核对 @container 与基础规则先后顺序,待完成一次跨项目追问。',
78
84
  priority: 100,
79
85
  quiz: {
80
86
  question: 'DSH 右侧栏只占 420px,而桌面端窗口宽度有 1440px。为什么这里不能靠 @media (max-width: 600px) 切换单列?',
@@ -115,87 +121,87 @@ const STARTER_SAMPLE_PACK = {
115
121
  },
116
122
  {
117
123
  id: 'item-fence-vs-foldturns',
118
- trackId: 'track-harness',
119
- title: '用 markdown.fence 替代 tool.call.toolview 绕开回合自动折叠',
124
+ trackId: 'track-ai',
125
+ title: '把长期要回看的学习卡放进正文自定义围栏,而不是塞进工具折叠区',
120
126
  source: 'dsh-chat',
121
127
  epistemic: 'verified',
122
128
  masteryTier: 3,
123
- why: 'DSH 0.2.2-rc.3 对已结束回合一律设置 foldCompletedTurns: true;正文里的自定义围栏(shield / learn-quiz / learn-pass)在过程头之外保持常驻展示,停用插件后仍可阅读。',
124
- rejected: '把每次回合结束的决策卡做成一次 tool call(每回合多消耗 1 次工具往返 Token,且回合一结束立刻被收折)。',
125
- probe: '为什么 learn_checkpoint 归档可以走工具调用,但过关毕业卡却要多出一块 learn-pass 围栏?',
126
- evidenceSummary: '在 RC3 app.asar 契约核查中复述出 presentation-policy 折叠范围与 markdown.fence 会话作用域差异。',
129
+ why: '助手在回合结束后通常会把 tool call 过程头折叠收起;放在正文自定义围栏里既不抢主正文风头,还能脱离单次调用常驻留存。',
130
+ rejected: '把每次回合结束的顺带学习卡做成一次 tool call(每轮多花一次工具往返,还容易随着过程记录一起折起来)。',
131
+ probe: '什么适合做成正文里的持久学习卡,什么更适合留作后台动作的工具回执?',
132
+ evidenceSummary: '对比过过程区自动折叠和正文自定义围栏的展示差异,能说清两者的边界。',
127
133
  priority: 85,
128
134
  },
129
135
  {
130
136
  id: 'item-atomic-mtime-ledger',
131
- trackId: 'track-harness',
132
- title: '跨 Agent 共享 ledger.json 的 mtimeMs 合并与原子落盘',
137
+ trackId: 'track-engineering',
138
+ title: '多端共享 JSON 账本前先比对 mtimeMs 再原子 rename 落盘',
133
139
  source: 'codex',
134
140
  epistemic: 'verified',
135
141
  masteryTier: 2,
136
- why: 'DSH 插件宿主与外部 CLI(Antigravity / Codex)会并发读写同一份 ledger.json;写入前比对文件 mtimeMs 并重新合并,再经临时文件 renameSync 原子替换,才能避免半截 JSON 与覆盖丢卡。',
137
- rejected: '启动时把账本全读进内存直接 writeFileSync 覆盖,或引入 SQLite 重型二进制依赖增加跨平台安装风险。',
138
- probe: '如果 Antigravity 刚通过 CLI 塞入一条新盲区,正在运行的 DSH 宿主若不做 mtimeMs 检查直接点「略过」会发生什么?',
139
- evidenceSummary: '已在设计评审阶段对照 state-file-two-hosts 规矩推演双写覆盖场景,待完成一次跨进程盲测确认。',
142
+ why: '桌面插件与外部命令行可能同时读写同一份 ledger.json;写入前比对文件修改时间重新合并,再通过临时文件 rename 原子替换,才能防并发覆盖。',
143
+ rejected: '启动时把文件整份缓存在内存里直接 writeFileSync 覆盖,或为此引入重型数据库依赖。',
144
+ probe: '如果外部命令行刚塞入一条新卡片,桌面端不做 mtimeMs 校验就直接写盘会发生什么?',
145
+ evidenceSummary: '已演练过双进程并发写盘的竞态保护,待在真实多端联动里验证一次。',
140
146
  priority: 92,
141
147
  },
142
148
  {
143
149
  id: 'item-wechat-search-firstscreen',
144
- trackId: 'track-growth',
145
- title: '微信搜一搜短图文与公众号纯文本分发结构差异',
150
+ trackId: 'track-product',
151
+ title: '冷启动图文卡片与熟人长文的首屏信息结构差异',
146
152
  source: 'manual',
147
153
  epistemic: 'explicit',
148
154
  masteryTier: 3,
149
- why: '纯文本只触达既有读者,首句靠共鸣切入;微信搜一搜短图文依赖 3:4 封面卡在信息流抢占第一眼,必须在前 2 秒用结构化利益点代替铺垫背景。',
150
- rejected: '直接把公众号长文拆成白底黑字长截图套用(首屏信息密度失焦,搜一搜点击率折损明显)。',
151
- probe: '面向老读者群发的纯文本与面向冷启动搜一搜的 3:4 短图文,第一眼最核心的改动分别是什么?',
152
- evidenceSummary: '复盘了 500+ 阅读纯文本反馈与 6 张 3:4 短图文封面结构取舍,能独立拆出首屏利益点公式。',
155
+ why: '熟人订阅长文靠共鸣铺垫;公开信息流或搜索卡片依赖首屏前两秒用结构化利益点抓人,不能把长段落裁图硬塞。',
156
+ rejected: '把长文直接截成白底密字长图发进信息流(首屏看不出价值,划走率高)。',
157
+ probe: '面向老读者发长文和面向新用户发卡片,首屏第一眼各自最该放什么?',
158
+ evidenceSummary: '对比大段说明文与三步图文流程卡后,能独立把首屏核心价值收在两秒可读范围内。',
153
159
  priority: 65,
154
160
  },
155
161
  ],
156
162
  triage: [
157
163
  {
158
164
  id: 'cand-draft-guard-lexical',
159
- trackId: 'track-harness',
160
- title: '围栏选项按钮触发 inputActions.submit() 前必须读取 useInput().draft',
165
+ trackId: 'track-frontend',
166
+ title: '点卡片快捷选项自动发送前,必须先检查输入框是否已有未发送草稿',
161
167
  source: 'dsh-chat',
162
168
  epistemic: 'inferred',
163
- why: '用户可能正在输入框编写长回复,直接调 setDraft() 会静默擦除未发送心血。',
164
- rejected: '点击选择题卡片后不检查输入框状态直接覆写发送。',
165
- probe: '当用户在底部输入框留有未发送草稿时,点击 learn-quiz 选项应采取哪两步保护?',
169
+ why: '用户可能正在输入框写长段话,直接替用户提交会覆盖未发送的心血。',
170
+ rejected: '点击选择题卡片后不检查草稿状态直接覆写并提交。',
171
+ probe: '输入框已有草稿时,点击卡片按钮应该触发哪两步保护?',
166
172
  lowValue: false,
167
173
  },
168
174
  {
169
175
  id: 'cand-sidebar-right-id-kind',
170
- trackId: 'track-harness',
171
- title: 'sidebarRightTabs 注册用 id 而 openTab() 传 kind',
176
+ trackId: 'track-engineering',
177
+ title: '插件插槽注册 ID 与按 kind 打开抽屉必须一一对应',
172
178
  source: 'superagent-review',
173
179
  epistemic: 'verified',
174
- why: 'DSH 右侧栏 SlotRegistry 按 definition.id 分发渲染组件,但侧栏服务的 openTab(kind) 按 definition.kind 反查。两者混写同一字符串会在开抽屉时静音失效。',
175
- rejected: '凭直觉把槽位 key 与 openTab 参数都传成同一个 ID。',
176
- probe: '在 dsh-client-ui-sidebar-right 中,Slots 注册 key 与 openTab() 入参分别读哪个字段?',
180
+ why: '插槽定义表和侧栏激活接口往往分别按 id 和 kind 索引,混写会在打开侧栏时静音失败。',
181
+ rejected: '凭直觉把槽位 key 与打开参数硬传成同一字符串。',
182
+ probe: '当点击按钮开侧栏没报错却没反应时,最该先查哪两个注册字段?',
177
183
  lowValue: false,
178
184
  },
179
185
  {
180
186
  id: 'cand-optional-schema-no-false',
181
- trackId: 'track-harness',
182
- title: '工具可选参数必须省略 required 而不是写 required: false',
187
+ trackId: 'track-ai',
188
+ title: '工具可选参数应省略在 required 数组外,避免写 required: false',
183
189
  source: 'codex',
184
190
  epistemic: 'verified',
185
- why: 'JSON Schema 2020-12 校验器要求 required 必须是父级字符串数组,给单个字段写 required: false 会导致底层模型注册报错。',
186
- rejected: '沿用部分旧表单习惯在字段描述对象内写 { type: "string", required: false }。',
187
- probe: '向 DeepSeek Tool Schema 暴露一个可选字符串字段时,正确的 Schema 写法是什么?',
191
+ why: 'JSON Schema 2020-12 要求 required 是父对象的字符串数组,字段内写 required: false 会让模型工具注册校验失败。',
192
+ rejected: '按旧表单习惯在字段定义对象里写 { type: "string", required: false }。',
193
+ probe: '给大模型暴露一个可选字符串入参时,正确的 Schema 结构怎么写?',
188
194
  lowValue: false,
189
195
  },
190
196
  {
191
197
  id: 'cand-prompt-kv-cache',
192
- trackId: 'track-harness',
193
- title: '常驻 systemPrompt.section 必须保持文本固定且 <= 1150 字节',
198
+ trackId: 'track-ai',
199
+ title: '常驻系统提示词必须保持前缀静止与严格字节预算,动态内容按需走工具读取',
194
200
  source: 'antigravity',
195
201
  epistemic: 'verified',
196
- why: '把动态变化的账本条目直接拼进系统提示词前缀,每轮都会击穿模型 KV Cache 导致首字延迟翻倍且账单飙升;静态规则 + 工具按需读取才是省流正道。',
197
- rejected: '每次生成新系统消息把所有历史盲区全部塞进 system prompt。',
198
- probe: '为什么个人盲区数量增加后,系统提示词前缀仍然必须逐字保持静止?',
202
+ why: '把不断变化的个人账本直接塞进系统提示词前缀,每轮都会击穿模型 KV Cache;保持前缀不变、查账本走工具才省钱又低延迟。',
203
+ rejected: '每次对话把用户所有历史盲区拼进 system prompt。',
204
+ probe: '为什么个人积累的卡片越多,系统提示词前缀越不能跟着变长?',
199
205
  lowValue: false,
200
206
  },
201
207
  {
@@ -211,7 +217,7 @@ const STARTER_SAMPLE_PACK = {
211
217
  },
212
218
  {
213
219
  id: 'cand-rename-readme-heading',
214
- trackId: 'track-growth',
220
+ trackId: 'track-product',
215
221
  title: '文档格式微调:统一 README 二级标题序号格式',
216
222
  source: 'manual',
217
223
  epistemic: 'inferred',
@@ -333,7 +339,7 @@ function parseShieldFence(code) {
333
339
  why: why || '已基于当前项目边界做出取舍。',
334
340
  rejected: rejected || '已排除高维护成本或脆弱实现方案。',
335
341
  probe: probe || `关于「${finalTitle}」,换到另一处模块时会不会遇到同样的边界?`,
336
- trackId: cleanText(json.trackId, 60) || 'track-harness',
342
+ trackId: cleanText(json.trackId, 60) || 'track-engineering',
337
343
  source: normalizeSource(json.source || 'dsh-chat'),
338
344
  epistemic: normalizeEpistemic(json.epistemic || 'inferred'),
339
345
  quiz: sanitizeQuizBlock(json.quiz, finalTitle, why, rejected, probe),
@@ -368,7 +374,7 @@ function parseShieldFence(code) {
368
374
  why: cleanText(why, 420) || '已基于当前项目边界做出取舍。',
369
375
  rejected: cleanText(rejected, 420) || '已排除脆弱或高成本备选方案。',
370
376
  probe: cleanText(probe, 320) || `换到另一个新模块时,如何避免重复踩中「${finalTitle}」的坑?`,
371
- trackId: 'track-harness',
377
+ trackId: 'track-engineering',
372
378
  source: 'dsh-chat',
373
379
  epistemic: 'inferred',
374
380
  quiz: buildDefaultQuiz(finalTitle, why, rejected, probe),
@@ -443,16 +449,33 @@ function parseLearnPassFence(code) {
443
449
  }
444
450
  }
445
451
 
452
+ function inferTrackIdFromTopic(text) {
453
+ const s = String(text || '')
454
+ if (/css|flex|grid|container|dialog|布局|样式|动画|前端|界面|颜色|主题|弹窗|悬浮|分屏|按钮|组件/i.test(s)) {
455
+ return 'track-frontend'
456
+ }
457
+ if (/prompt|agent|token|mcp|tool|llm|模型|提示词|上下文|多智能体|围栏/i.test(s)) {
458
+ return 'track-ai'
459
+ }
460
+ if (/增长|转化|标题|留存|分发|引导|文案|小红书|公众号|首屏|定位|用户|产品/i.test(s)) {
461
+ return 'track-product'
462
+ }
463
+ return 'track-engineering'
464
+ }
465
+
446
466
  function buildDeepLearnStarterPrompt(item) {
447
467
  const safe = item && typeof item === 'object' ? item : {}
448
468
  const tierLabel = MASTERY_LABELS[clampTier(safe.masteryTier || 1)]
469
+ const isAdHoc = !safe.rejected && !safe.probe
449
470
  return [
450
471
  '[顺带私教·专心闯关]',
451
472
  `知识点:${cleanText(safe.title, 140) || '当前盲区'}(itemId: ${cleanText(safe.id, 80) || 'ad-hoc'},当前掌握度:${tierLabel})`,
452
473
  safe.why ? `背景取舍:${cleanText(safe.why, 220)}` : '',
453
474
  safe.rejected ? `曾经对比过的坑:${cleanText(safe.rejected, 180)}` : '',
454
475
  safe.probe ? `摸底种子:${cleanText(safe.probe, 180)}` : '',
455
- '请严格按「先探后讲 + 换景追问」节奏带我过关:第 1 轮直接输出一个 ```learn-quiz JSON 代码块让我先盲选判断并停下等我回复,暂不要剧透完整解释。',
476
+ isAdHoc
477
+ ? '这是我主动发起的专心学习主题(若涉及当前工作区代码,可先快速只读扫一眼关键实现)。请严格按「先探后讲 + 换景追问」节奏带我一对一闯关:第 1 轮直接输出一个 ```learn-quiz JSON 代码块让我先盲选判断并停下等我回复,暂不要剧透完整解释。'
478
+ : '请严格按「先探后讲 + 换景追问」节奏带我过关:第 1 轮直接输出一个 ```learn-quiz JSON 代码块让我先盲选判断并停下等我回复,暂不要剧透完整解释。',
456
479
  ].filter(Boolean).join('\n')
457
480
  }
458
481
 
@@ -517,8 +540,9 @@ const ILP_CSS = [
517
540
 
518
541
  // Zero-specificity resets scoped strictly inside plugin containers (never *)
519
542
  ':where(.ilp-wb,.ilp-fence,.ilp-drawer,.ilp-dialog,.ilp-pill) [hidden]{display:none!important}',
520
- ':where(.ilp-wb,.ilp-fence,.ilp-drawer,.ilp-dialog) :is(div,section,article,main,aside,header,footer,button,input,textarea,pre,code,details,summary){box-sizing:border-box}',
543
+ ':where(.ilp-wb,.ilp-fence,.ilp-drawer,.ilp-dialog) :is(div,section,article,main,aside,header,footer,form,label,button,input,select,textarea,pre,code,details,summary){box-sizing:border-box}',
521
544
  ':where(.ilp-wb,.ilp-fence,.ilp-drawer,.ilp-dialog) :is(h1,h2,h3,h4,p,ul,ol,pre){margin:0}',
545
+ ':where(.ilp-wb) :is(input,select){font:inherit;color:inherit}',
522
546
  ':where(.ilp-wb,.ilp-fence,.ilp-drawer,.ilp-dialog) button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer;text-align:left}',
523
547
  '.ilp-wb :is(h1,h2,h3){text-wrap:balance}',
524
548
  '.ilp-wb :is(p,li){text-wrap:pretty}',
@@ -686,6 +710,20 @@ const ILP_CSS = [
686
710
  '.ilp-spot-probe{font-size:12.5px;color:var(--ilp-ink2);padding:8px 11px;border-radius:var(--ilp-r-sm);background:var(--ilp-sub);border:1px solid var(--ilp-line);overflow-wrap:anywhere}',
687
711
  '.ilp-spot-acts{display:flex;flex-direction:column;align-items:stretch;gap:8px;min-width:168px}',
688
712
 
713
+ // Direct Focused Study Launcher (always reachable without prior triage acceptance)
714
+ '.ilp-direct-box{border-radius:var(--ilp-r-lg);border:1px solid var(--ilp-line);background:var(--ilp-panel);padding:16px 18px;display:flex;flex-direction:column;gap:10px;min-width:0}',
715
+ '.ilp-direct-box.is-hero{border-color:var(--ilp-line2);padding:18px 20px}',
716
+ '.ilp-direct-head{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 12px;min-width:0}',
717
+ '.ilp-direct-title{font-size:14.5px;font-weight:600;color:var(--ilp-ink)}',
718
+ '.ilp-direct-sub{font-size:12px;color:var(--ilp-ink3);overflow-wrap:anywhere}',
719
+ '.ilp-direct-row{display:flex;align-items:center;gap:8px;min-width:0}',
720
+ '.ilp-direct-input{flex:1 1 0%;min-width:0;min-height:35px;padding:6px 11px;border-radius:var(--ilp-r-btn);border:1px solid var(--ilp-line2);background:var(--ilp-bg);color:var(--ilp-ink);font-size:13px;line-height:1.4}',
721
+ '.ilp-direct-input::placeholder{color:var(--ilp-ink3)}',
722
+ '.ilp-direct-ws{max-width:180px;min-height:35px;padding:6px 10px;border-radius:var(--ilp-r-btn);border:1px solid var(--ilp-line2);background:var(--ilp-bg);color:var(--ilp-ink2);font-size:12px}',
723
+ '.ilp-direct-chips{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}',
724
+ '.ilp-chip-btn{display:inline-flex;align-items:center;min-height:25px;padding:3px 10px;border-radius:999px;border:1px solid var(--ilp-line);background:var(--ilp-sub);color:var(--ilp-ink2);font-size:11.5px;line-height:1.3}',
725
+ '@media (hover:hover){.ilp-chip-btn:hover:not(:disabled){background:var(--ilp-hover);border-color:var(--ilp-line2);color:var(--ilp-ink)}}',
726
+
689
727
  // Collapsible Background Auto-Archive Inbox
690
728
  '.ilp-triage-box{border-radius:var(--ilp-r-md);border:1px solid var(--ilp-line);background:var(--ilp-panel);overflow:hidden;min-width:0}',
691
729
  '.ilp-triage-head{width:100%;padding:12px 16px;display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--ilp-panel);min-width:0}',
@@ -693,12 +731,14 @@ const ILP_CSS = [
693
731
  '.ilp-triage-head-left{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0}',
694
732
  '.ilp-triage-body{border-top:1px solid var(--ilp-line);display:flex;flex-direction:column}',
695
733
  '.ilp-triage-batch{padding:10px 16px;background:var(--ilp-wait-bg);border-bottom:1px solid var(--ilp-line);display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px}',
734
+ '.ilp-triage-subbar{padding:9px 16px;background:var(--ilp-sub);border-bottom:1px solid var(--ilp-line);display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px;font-size:12px;color:var(--ilp-ink2)}',
696
735
  '.ilp-triage-row{padding:12px 16px;border-bottom:1px solid var(--ilp-line);display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px 14px;min-width:0}',
697
736
  '.ilp-triage-row:last-child{border-bottom:0}',
698
737
  '.ilp-triage-info{flex:1 1 280px;min-width:0;display:flex;flex-direction:column;gap:4px}',
699
738
  '.ilp-triage-title{font-weight:500;font-size:13px;overflow-wrap:anywhere}',
700
739
  '.ilp-triage-why{font-size:12px;color:var(--ilp-ink2);overflow-wrap:anywhere}',
701
- '.ilp-triage-acts{display:flex;align-items:center;gap:6px;flex-shrink:0}',
740
+ '.ilp-triage-acts{display:flex;align-items:center;flex-wrap:wrap;gap:6px;flex-shrink:0}',
741
+ '.ilp-empty-tracks-note{font-size:12px;color:var(--ilp-ink3);padding:2px 2px;overflow-wrap:anywhere}',
702
742
 
703
743
  // Accordion Capability Tracks
704
744
  '.ilp-tracks{display:flex;flex-direction:column;gap:10px;min-width:0}',
@@ -853,8 +893,14 @@ const ILP_CSS = [
853
893
  ' .ilp-sim-sep{display:none}',
854
894
  ' .ilp-spot-card{grid-template-columns:minmax(0,1fr);padding:18px}',
855
895
  ' .ilp-spot-acts{flex-direction:row;flex-wrap:wrap;min-width:0}',
896
+ ' .ilp-direct-row{flex-direction:column;align-items:stretch}',
897
+ ' .ilp-direct-input{flex:none;width:100%}',
898
+ ' .ilp-direct-ws{max-width:none}',
856
899
  ' .ilp-course-grid{grid-template-columns:minmax(0,1fr)}',
857
900
  '}',
901
+ '@media (pointer:coarse){',
902
+ ' .ilp-direct-input,.ilp-direct-ws{font-size:16px}',
903
+ '}',
858
904
  '@container ilpwb (max-width:660px){',
859
905
  ' .ilp-wb-inner{padding:48px 14px 48px}',
860
906
  '}',
@@ -872,7 +918,7 @@ const ILP_CSS = [
872
918
 
873
919
  // Forced Colors High-Contrast Fallbacks
874
920
  '@media (forced-colors:active){',
875
- ' .ilp-btn,.ilp-sim-btn,.ilp-quiet-btn,.ilp-source-badge,.ilp-badge-card,.ilp-tag,.ilp-onb-step,.ilp-sim-disclosure,.ilp-strip-details,.ilp-mini-win,.ilp-mini-embed,.ilp-toast,dialog.ilp-dialog{border:1px solid ButtonBorder}',
921
+ ' .ilp-btn,.ilp-sim-btn,.ilp-quiet-btn,.ilp-source-badge,.ilp-badge-card,.ilp-tag,.ilp-onb-step,.ilp-sim-disclosure,.ilp-strip-details,.ilp-mini-win,.ilp-mini-embed,.ilp-toast,.ilp-direct-box,.ilp-direct-input,.ilp-direct-ws,.ilp-chip-btn,dialog.ilp-dialog{border:1px solid ButtonBorder}',
876
922
  ' .ilp-btn.solid{background:Highlight;color:HighlightText;border-color:Highlight}',
877
923
  ' .ilp-sim-btn[aria-pressed="true"],.ilp-quiet-btn[aria-pressed="true"]{outline:2px solid Highlight;outline-offset:1px}',
878
924
  ' .ilp-sim-sep{border-left-color:ButtonBorder}',
@@ -937,6 +983,7 @@ var AUTO_CAPTURED_KEYS = new Set()
937
983
 
938
984
  function createClientLedgerBridge() {
939
985
  var snapshot = null
986
+ var workspaces = []
940
987
  var loading = false
941
988
  var error = null
942
989
  var listeners = new Set()
@@ -944,13 +991,14 @@ function createClientLedgerBridge() {
944
991
 
945
992
  function emit() {
946
993
  listeners.forEach(function (fn) {
947
- try { fn({ snapshot: snapshot, loading: loading, error: error }) } catch (_e) {}
994
+ try { fn({ snapshot: snapshot, workspaces: workspaces, loading: loading, error: error }) } catch (_e) {}
948
995
  })
949
996
  }
950
997
 
951
- function setSnapshot(next) {
998
+ function setSnapshot(next, nextWorkspaces) {
952
999
  if (!next) return
953
1000
  snapshot = next
1001
+ if (Array.isArray(nextWorkspaces)) workspaces = nextWorkspaces
954
1002
  versionSeen = next.version
955
1003
  error = null
956
1004
  loading = false
@@ -963,8 +1011,9 @@ function createClientLedgerBridge() {
963
1011
  return fetchJson(VIEW_URL + qs, { headers: { Accept: 'application/json' } })
964
1012
  .then(function (res) {
965
1013
  if (!res.unchanged && res.snapshot) {
966
- setSnapshot(res.snapshot)
1014
+ setSnapshot(res.snapshot, res.workspaces)
967
1015
  } else {
1016
+ if (Array.isArray(res.workspaces)) workspaces = res.workspaces
968
1017
  loading = false
969
1018
  error = null
970
1019
  emit()
@@ -981,7 +1030,7 @@ function createClientLedgerBridge() {
981
1030
 
982
1031
  function runAction(action, payload) {
983
1032
  return postLearnAction(action, payload).then(function (res) {
984
- if (res && res.snapshot) setSnapshot(res.snapshot)
1033
+ if (res && res.snapshot) setSnapshot(res.snapshot, res.workspaces)
985
1034
  return res
986
1035
  })
987
1036
  }
@@ -992,7 +1041,7 @@ function createClientLedgerBridge() {
992
1041
  }
993
1042
 
994
1043
  return {
995
- getState: function () { return { snapshot: snapshot, loading: loading, error: error } },
1044
+ getState: function () { return { snapshot: snapshot, workspaces: workspaces, loading: loading, error: error } },
996
1045
  refresh: refresh,
997
1046
  runAction: runAction,
998
1047
  subscribe: subscribe,
@@ -1066,10 +1115,10 @@ function hashCardKey(parsed, fallbackSeed) {
1066
1115
  return 'card-' + Math.abs(hVal).toString(36)
1067
1116
  }
1068
1117
 
1069
- function openDeepLearnSession(ctx, item) {
1118
+ function openDeepLearnSession(ctx, item, preferredWorkspaceId) {
1070
1119
  var prompt = buildDeepLearnStarterPrompt(item)
1071
1120
  return postLearnAction('ensure_practice_workspace', {}).then(function (res) {
1072
- var wsId = res && res.workspace && res.workspace.workspaceId
1121
+ var wsId = preferredWorkspaceId || (res && res.workspace && res.workspace.workspaceId)
1073
1122
  var layout = getHostService(ctx, 'layout')
1074
1123
  var uiWorkspace = getHostService(ctx, 'uiWorkspace')
1075
1124
  var sessions = getHostService(ctx, 'sessions')
@@ -1236,7 +1285,7 @@ function openStarterChatSession(ctx) {
1236
1285
  }
1237
1286
  var uiWorkspace = getHostService(ctx, 'uiWorkspace')
1238
1287
  var sessions = getHostService(ctx, 'sessions')
1239
- var conv = getHostService(ctx, 'conversations')
1288
+ var conv = getHostService(ctx, 'conversation') || getHostService(ctx, 'conversations')
1240
1289
  var starterPrompt = '帮我检查一下当前项目的结构与改动方案,如果遇到值得留心的工程、架构或前端设计经验,干完顺手附一张顺带学习卡。'
1241
1290
  return postLearnAction('ensure_practice_workspace', {}).catch(function () { return null }).then(function (res) {
1242
1291
  var wsId = (res && res.workspace && res.workspace.workspaceId) || undefined
@@ -1281,16 +1330,16 @@ var SIM_OUTCOMES = {
1281
1330
  takeaway: '手头刚好有空时点一下,在右边花一两分钟直接把这条经验学明白。',
1282
1331
  },
1283
1332
  save: {
1284
- chatBadge: '已加入重点',
1333
+ chatBadge: '已存技能库',
1285
1334
  chatBadgeClass: 'ilp-tag run',
1286
1335
  collapsed: false,
1287
1336
  wbTitle: '顺带私教里',
1288
- wbBadge: '标为重点待学',
1337
+ wbBadge: '已存进技能库',
1289
1338
  wbBadgeClass: 'ilp-tag run',
1290
- wbHeading: '直接放进「重点学习清单」',
1291
- wbLine1: '觉得这条经验很实用,但眼下正忙,先标上重点',
1292
- wbLine2: '下次点进顺带私教时优先排在前面,方便集中去学',
1293
- takeaway: '适合眼下没空细看、但觉得这条经验很值钱,先标成重点留着集中学。',
1339
+ wbHeading: '直接放进「个人技能库」',
1340
+ wbLine1: '觉得这条经验很实用,先正式存进对应分类里',
1341
+ wbLine2: '下次点进顺带私教时优先排在前面,方便随时开练',
1342
+ takeaway: '适合眼下没空细看、但确定值得留下慢慢消化的实用经验。',
1294
1343
  },
1295
1344
  dismiss: {
1296
1345
  chatBadge: '已收起卡片',
@@ -1464,7 +1513,7 @@ function makeVisualGuideComponent(React) {
1464
1513
  ),
1465
1514
  h('div', { className: 'ilp-wf-btn-row' },
1466
1515
  h('span', { className: 'ilp-wf-mini-btn' }, '展开学习'),
1467
- h('span', { className: 'ilp-wf-mini-btn' }, '加入重点'),
1516
+ h('span', { className: 'ilp-wf-mini-btn' }, '存技能库'),
1468
1517
  h('span', { className: 'ilp-wf-mini-btn' }, '已掌握'),
1469
1518
  ),
1470
1519
  ),
@@ -1613,7 +1662,7 @@ function makeVisualGuideComponent(React) {
1613
1662
  },
1614
1663
  h('div', { className: 'ilp-sim-group', role: 'group', 'aria-label': '学习卡操作按钮' },
1615
1664
  makeSimToolbarButton('coach', '当场展开学', ''),
1616
- makeSimToolbarButton('save', '加入重点学', ''),
1665
+ makeSimToolbarButton('save', '存进技能库', ''),
1617
1666
  makeSimToolbarButton('dismiss', '已掌握,收起', ''),
1618
1667
  ),
1619
1668
  h('span', { role: 'separator', 'aria-orientation': 'vertical', className: 'ilp-sim-sep' }),
@@ -1642,7 +1691,7 @@ function makeVisualGuideComponent(React) {
1642
1691
  ),
1643
1692
  h('div', { className: 'ilp-mini-embed-pills' },
1644
1693
  h('span', { className: 'ilp-mini-pill' + (simMode === 'coach' ? ' is-hi' : '') }, '在右侧边聊边学'),
1645
- h('span', { className: 'ilp-mini-pill' + (simMode === 'save' ? ' is-hi' : '') }, '加入重点学'),
1694
+ h('span', { className: 'ilp-mini-pill' + (simMode === 'save' ? ' is-hi' : '') }, '存进技能库'),
1646
1695
  h('span', { className: 'ilp-mini-pill' + (simMode === 'dismiss' ? ' is-hi' : '') }, '已掌握,收起'),
1647
1696
  ),
1648
1697
  ),
@@ -1704,10 +1753,22 @@ function makeWorkbenchComponent(React, ctx, bridge) {
1704
1753
  var triageOpen = triageOpenTuple[0]
1705
1754
  var setTriageOpen = triageOpenTuple[1]
1706
1755
 
1707
- var expandedTrackTuple = React.useState({ 'track-frontend': true })
1756
+ var expandedTrackTuple = React.useState({})
1708
1757
  var expandedTracks = expandedTrackTuple[0]
1709
1758
  var setExpandedTracks = expandedTrackTuple[1]
1710
1759
 
1760
+ var directTopicTuple = React.useState('')
1761
+ var directTopic = directTopicTuple[0]
1762
+ var setDirectTopic = directTopicTuple[1]
1763
+
1764
+ var selectedWsTuple = React.useState('')
1765
+ var selectedWsId = selectedWsTuple[0]
1766
+ var setSelectedWsId = selectedWsTuple[1]
1767
+
1768
+ var startingDirectTuple = React.useState(false)
1769
+ var startingDirect = startingDirectTuple[0]
1770
+ var setStartingDirect = startingDirectTuple[1]
1771
+
1711
1772
  var courseOpenTuple = React.useState(false)
1712
1773
  var courseOpen = courseOpenTuple[0]
1713
1774
  var setCourseOpen = courseOpenTuple[1]
@@ -1763,25 +1824,74 @@ function makeWorkbenchComponent(React, ctx, bridge) {
1763
1824
  }
1764
1825
  } else {
1765
1826
  autoOpenedTriageRef.current = false
1827
+ if (currentTriageLen === 0 && triageOpen) {
1828
+ setTriageOpen(false)
1829
+ }
1766
1830
  }
1767
- }, [currentStats.totalItems, currentTriageLen])
1831
+ }, [currentStats.totalItems, currentTriageLen, triageOpen])
1768
1832
 
1769
1833
  function showToast(text, canUndo) {
1770
1834
  setToast({ text: text, canUndo: !!canUndo })
1771
1835
  }
1772
1836
 
1773
- function toggleTrack(id) {
1837
+ function toggleTrack(id, currentlyOpen) {
1774
1838
  setExpandedTracks(function (prev) {
1775
1839
  var next = Object.assign({}, prev)
1776
- next[id] = !prev[id]
1840
+ next[id] = !currentlyOpen
1777
1841
  return next
1778
1842
  })
1779
1843
  }
1780
1844
 
1845
+ var workspaces = Array.isArray(bridgeState.workspaces) ? bridgeState.workspaces : []
1846
+ var effectiveWsId = selectedWsId || (workspaces[0] && workspaces[0].id) || undefined
1847
+
1848
+ var DIRECT_TOPICS = [
1849
+ '复盘当前工作区刚改过的关键取舍',
1850
+ '前端自适应布局与原生组件避坑',
1851
+ '接口边界、并发写盘与架构取舍',
1852
+ 'Agent 提示词省流与工具设计',
1853
+ ]
1854
+
1855
+ function handleStartDirectStudy(e) {
1856
+ if (e && e.preventDefault) e.preventDefault()
1857
+ if (startingDirect) return
1858
+ var topicTitle = directTopic.trim() || '结合当前工作区最近一次关键改动,挑一个核心取舍带我专心闯关'
1859
+ setStartingDirect(true)
1860
+ bridge.runAction('save_explicit', {
1861
+ payload: {
1862
+ title: topicTitle,
1863
+ trackId: inferTrackIdFromTopic(topicTitle),
1864
+ source: 'manual',
1865
+ epistemic: 'explicit',
1866
+ why: '由顺带私教工作台主动发起专心学习,通过一问一答闯关沉淀证据。',
1867
+ },
1868
+ }).then(function (res) {
1869
+ var item = (res && res.item) || { title: topicTitle }
1870
+ setDirectTopic('')
1871
+ return openDeepLearnSession(ctx, item, effectiveWsId)
1872
+ }).then(function () {
1873
+ setStartingDirect(false)
1874
+ }).catch(function (err) {
1875
+ setStartingDirect(false)
1876
+ showToast('开启专心学习失败:' + err.message, false)
1877
+ })
1878
+ }
1879
+
1880
+ function handleDrillTriage(cand) {
1881
+ if (!cand) return
1882
+ bridge.runAction('triage_item', { id: cand.id, decision: 'accept' }).then(function (res) {
1883
+ var item = (res && res.item) || cand
1884
+ return openDeepLearnSession(ctx, item, effectiveWsId)
1885
+ }).catch(function (err) {
1886
+ showToast('开启专心学习失败:' + err.message, false)
1887
+ })
1888
+ }
1889
+
1781
1890
  function handleLoadSamples() {
1782
1891
  bridge.runAction('load_sample_pack', {}).then(function () {
1783
1892
  setIsPreviewSamples(true)
1784
1893
  setGuideOpen(false)
1894
+ setTriageOpen(false)
1785
1895
  showToast('已载入多 Agent 演示样本', true)
1786
1896
  }).catch(function (err) {
1787
1897
  showToast('加载失败:' + err.message, false)
@@ -1795,6 +1905,8 @@ function makeWorkbenchComponent(React, ctx, bridge) {
1795
1905
  setCourseOpen(false)
1796
1906
  setExportInfo(null)
1797
1907
  setTriageOpen(false)
1908
+ setDirectTopic('')
1909
+ setExpandedTracks({})
1798
1910
  autoOpenedTriageRef.current = false
1799
1911
  showToast('已清空恢复空台账', true)
1800
1912
  }).catch(function () {})
@@ -1802,14 +1914,14 @@ function makeWorkbenchComponent(React, ctx, bridge) {
1802
1914
 
1803
1915
  function handleStartDeepDrill(item) {
1804
1916
  if (!item) return
1805
- openDeepLearnSession(ctx, item).catch(function (err) {
1917
+ openDeepLearnSession(ctx, item, effectiveWsId).catch(function (err) {
1806
1918
  showToast('打开闯关会话失败:' + err.message, false)
1807
1919
  })
1808
1920
  }
1809
1921
 
1810
1922
  function handleTriageOne(id, decision) {
1811
1923
  bridge.runAction('triage_item', { id: id, decision: decision }).then(function (res) {
1812
- showToast(decision === 'accept' ? '已收入能力路线' : '已略过该候选', !!(res && res.snapshot && res.snapshot.canUndo))
1924
+ showToast(decision === 'accept' ? '已存进个人技能库' : '已删掉该存档', !!(res && res.snapshot && res.snapshot.canUndo))
1813
1925
  }).catch(function (err) {
1814
1926
  showToast('操作失败:' + err.message, false)
1815
1927
  })
@@ -1818,7 +1930,10 @@ function makeWorkbenchComponent(React, ctx, bridge) {
1818
1930
  function handleTriageBatch(mode) {
1819
1931
  bridge.runAction('triage_batch', { mode: mode }).then(function (res) {
1820
1932
  var count = (res && res.affected) || 0
1821
- showToast(mode === 'accept_all' ? ('已一键收入 ' + count + ' 条候选') : ('已清理 ' + count + ' 条低价值候选'), true)
1933
+ var msg = mode === 'clear_all'
1934
+ ? ('已清空 ' + count + ' 张自动存档')
1935
+ : (mode === 'accept_all' ? ('已一键存进 ' + count + ' 条技能') : ('已清理 ' + count + ' 条低价值存档'))
1936
+ showToast(msg, true)
1822
1937
  }).catch(function (err) {
1823
1938
  showToast('批量处理失败:' + err.message, false)
1824
1939
  })
@@ -1880,12 +1995,67 @@ function makeWorkbenchComponent(React, ctx, bridge) {
1880
1995
  )
1881
1996
  }
1882
1997
 
1883
- var stats = snap.stats || { masteredItems: 0, totalItems: 0, trackCount: 3, triageCount: 0 }
1998
+ var stats = snap.stats || { masteredItems: 0, totalItems: 0, trackCount: 4, triageCount: 0 }
1884
1999
  var tracks = snap.tracks || []
2000
+ var populatedTracks = tracks.filter(function (t) { return t.items && t.items.length > 0 })
2001
+ var emptyTrackNames = tracks.filter(function (t) { return !t.items || t.items.length === 0 }).map(function (t) { return t.title })
2002
+ var firstPopTrackId = populatedTracks[0] ? populatedTracks[0].id : ''
1885
2003
  var triage = snap.triage || []
1886
2004
  var spotlight = snap.spotlight
1887
2005
  var isCompletelyEmpty = stats.totalItems === 0 && triage.length === 0
1888
2006
 
2007
+ function renderDirectStudyBox(isHero) {
2008
+ return h('form', {
2009
+ className: 'ilp-direct-box' + (isHero ? ' is-hero' : ''),
2010
+ 'data-testid': 'ilp-direct-study',
2011
+ onSubmit: handleStartDirectStudy,
2012
+ },
2013
+ h('div', { className: 'ilp-direct-head' },
2014
+ h('span', { className: 'ilp-direct-title' }, '直接开启专心学习(1 对 1 闯关对话)'),
2015
+ h('span', { className: 'ilp-direct-sub' }, '不必先挑旧存档;填一个现在想弄懂的问题或直接点选下方主题,一键跳进专心学习对话。'),
2016
+ ),
2017
+ h('div', { className: 'ilp-direct-row' },
2018
+ h('input', {
2019
+ type: 'text',
2020
+ className: 'ilp-direct-input',
2021
+ 'data-testid': 'ilp-direct-topic-input',
2022
+ 'aria-label': '输入想专心学习的主题',
2023
+ placeholder: '例如:复盘当前项目刚改的权限边界 / CSS 容器查询先后顺序(留空也可直接开练)',
2024
+ value: directTopic,
2025
+ onChange: function (e) { setDirectTopic(e.target.value) },
2026
+ }),
2027
+ workspaces.length > 0 ? h('select', {
2028
+ className: 'ilp-direct-ws',
2029
+ 'data-testid': 'ilp-direct-ws-select',
2030
+ 'aria-label': '选择学习关联的工作区',
2031
+ value: effectiveWsId || '',
2032
+ onChange: function (e) { setSelectedWsId(e.target.value) },
2033
+ },
2034
+ workspaces.map(function (ws) {
2035
+ return h('option', { key: ws.id, value: ws.id }, ws.name || ws.id)
2036
+ }),
2037
+ ) : null,
2038
+ h('button', {
2039
+ type: 'submit',
2040
+ className: 'ilp-btn ' + (isHero ? 'solid' : 'line'),
2041
+ 'data-testid': 'ilp-direct-start-btn',
2042
+ disabled: startingDirect,
2043
+ }, startingDirect ? '正在开启…' : '开始专心学'),
2044
+ ),
2045
+ h('div', { className: 'ilp-direct-chips' },
2046
+ DIRECT_TOPICS.map(function (chip, idx) {
2047
+ return h('button', {
2048
+ key: String(idx),
2049
+ type: 'button',
2050
+ className: 'ilp-chip-btn',
2051
+ 'data-testid': 'ilp-direct-chip-' + idx,
2052
+ onClick: function () { setDirectTopic(chip) },
2053
+ }, chip)
2054
+ }),
2055
+ ),
2056
+ )
2057
+ }
2058
+
1889
2059
  return h('div', { className: 'ilp-wb', 'data-testid': 'ilp-workbench' },
1890
2060
  h('div', { className: 'ilp-wb-inner' },
1891
2061
  // Calm Header
@@ -1961,11 +2131,7 @@ function makeWorkbenchComponent(React, ctx, bridge) {
1961
2131
  }))
1962
2132
  : null,
1963
2133
 
1964
- stats.totalItems === 0 && triage.length > 0 ? h('div', { className: 'ilp-onb-triage-tip', 'data-testid': 'ilp-empty-triage-tip' },
1965
- '个人技能库目前 0 项,但下方已自动帮你接住平时对话里出现的顺带学习卡:点「加入重点学」就开始跟踪练习,点「跳过」则直接清掉。',
1966
- ) : null,
1967
-
1968
- // Single Spotlight Hero Card
2134
+ // Single Spotlight Hero Card (when accumulated items > 0) vs Direct Study Hero (when 0 items)
1969
2135
  spotlight ? h('section', { className: 'ilp-spot-card', 'data-testid': 'ilp-spotlight' },
1970
2136
  h('div', { className: 'ilp-spot-main' },
1971
2137
  h('div', { className: 'ilp-spot-eyebrow' },
@@ -1997,6 +2163,8 @@ function makeWorkbenchComponent(React, ctx, bridge) {
1997
2163
  ),
1998
2164
  ) : null,
1999
2165
 
2166
+ renderDirectStudyBox(!isCompletelyEmpty && !spotlight),
2167
+
2000
2168
  // 1-Line Default-Collapsed Background Auto-Archive
2001
2169
  triage.length > 0 ? h('section', { className: 'ilp-triage-box', 'data-testid': 'ilp-triage-box' },
2002
2170
  h('button', {
@@ -2008,28 +2176,44 @@ function makeWorkbenchComponent(React, ctx, bridge) {
2008
2176
  },
2009
2177
  h('span', { className: 'ilp-triage-head-left' },
2010
2178
  h('span', { className: 'ilp-tag ' + (snap.triageOverCap ? 'wait' : 'outline') }, '后台自动存档 · ' + triage.length + ' 张'),
2011
- h('span', { className: 'ilp-summary' }, snap.triageOverCap ? '待看卡片超过 5 张,建议批量清理或全部加入' : '平时对话里先放着没点的学习卡,都自动帮你存在这里'),
2179
+ h('span', { className: 'ilp-summary' }, snap.triageOverCap ? '待看卡片超过 5 张,可批量清理、全部存进技能库或一键清空' : '平时对话先放着没点的卡片;想练直接点「拿这张去练」,不要的可点「删掉」'),
2012
2180
  ),
2013
2181
  h('span', { className: 'ilp-btn ghost xs' }, triageOpen ? '收起' : '展开查看'),
2014
2182
  ),
2015
2183
  triageOpen ? h('div', { className: 'ilp-triage-body' },
2016
- triage.length > 5 ? h('div', { className: 'ilp-triage-batch', 'data-testid': 'ilp-triage-batch' },
2017
- h('span', { style: { fontSize: '12px', fontWeight: 600 } }, '整理提醒:后台共自动存了 ' + triage.length + ' 张待看卡片'),
2018
- h('div', { style: { display: 'flex', gap: '6px', flexWrap: 'wrap' } },
2019
- h('button', {
2020
- type: 'button',
2021
- className: 'ilp-btn line xs',
2022
- 'data-testid': 'ilp-batch-sweep-low',
2023
- onClick: function () { handleTriageBatch('sweep_low_value') },
2024
- }, '清理细碎卡片'),
2025
- h('button', {
2026
- type: 'button',
2027
- className: 'ilp-btn solid xs',
2028
- 'data-testid': 'ilp-batch-accept-all',
2029
- onClick: function () { handleTriageBatch('accept_all') },
2030
- }, '全部加入重点学'),
2031
- ),
2032
- ) : null,
2184
+ triage.length > 5
2185
+ ? h('div', { className: 'ilp-triage-batch', 'data-testid': 'ilp-triage-batch' },
2186
+ h('span', { style: { fontSize: '12px', fontWeight: 600 } }, '整理提醒:后台共自动存了 ' + triage.length + ' 张待看卡片'),
2187
+ h('div', { style: { display: 'flex', gap: '6px', flexWrap: 'wrap' } },
2188
+ h('button', {
2189
+ type: 'button',
2190
+ className: 'ilp-btn line xs',
2191
+ 'data-testid': 'ilp-batch-sweep-low',
2192
+ onClick: function () { handleTriageBatch('sweep_low_value') },
2193
+ }, '清理细碎卡片'),
2194
+ h('button', {
2195
+ type: 'button',
2196
+ className: 'ilp-btn solid xs',
2197
+ 'data-testid': 'ilp-batch-accept-all',
2198
+ onClick: function () { handleTriageBatch('accept_all') },
2199
+ }, '全部存进技能库'),
2200
+ h('button', {
2201
+ type: 'button',
2202
+ className: 'ilp-btn ghost xs',
2203
+ 'data-testid': 'ilp-triage-clear-all',
2204
+ onClick: function () { handleTriageBatch('clear_all') },
2205
+ }, '一键清空存档'),
2206
+ ),
2207
+ )
2208
+ : h('div', { className: 'ilp-triage-subbar' },
2209
+ h('span', null, '点「拿这张去练」直接新开一对一闯关对话;不想留的存档可直接删掉或一键清空。'),
2210
+ h('button', {
2211
+ type: 'button',
2212
+ className: 'ilp-btn ghost xs',
2213
+ 'data-testid': 'ilp-triage-clear-all',
2214
+ onClick: function () { handleTriageBatch('clear_all') },
2215
+ }, '一键清空存档'),
2216
+ ),
2033
2217
  triage.map(function (cand) {
2034
2218
  return h('div', { key: cand.id, className: 'ilp-triage-row', 'data-testid': 'ilp-triage-row-' + cand.id },
2035
2219
  h('div', { className: 'ilp-triage-info' },
@@ -2042,18 +2226,24 @@ function makeWorkbenchComponent(React, ctx, bridge) {
2042
2226
  cand.why ? h('div', { className: 'ilp-triage-why' }, cand.why) : null,
2043
2227
  ),
2044
2228
  h('div', { className: 'ilp-triage-acts' },
2229
+ h('button', {
2230
+ type: 'button',
2231
+ className: 'ilp-btn soft xs',
2232
+ 'data-testid': 'ilp-triage-drill-' + cand.id,
2233
+ onClick: function () { handleDrillTriage(cand) },
2234
+ }, '拿这张去练'),
2045
2235
  h('button', {
2046
2236
  type: 'button',
2047
2237
  className: 'ilp-btn line xs',
2048
2238
  'data-testid': 'ilp-triage-accept-' + cand.id,
2049
2239
  onClick: function () { handleTriageOne(cand.id, 'accept') },
2050
- }, '加入重点学'),
2240
+ }, '先存着'),
2051
2241
  h('button', {
2052
2242
  type: 'button',
2053
2243
  className: 'ilp-btn ghost xs',
2054
2244
  'data-testid': 'ilp-triage-skip-' + cand.id,
2055
2245
  onClick: function () { handleTriageOne(cand.id, 'skip') },
2056
- }, '跳过'),
2246
+ }, '删掉'),
2057
2247
  ),
2058
2248
  )
2059
2249
  }),
@@ -2101,17 +2291,19 @@ function makeWorkbenchComponent(React, ctx, bridge) {
2101
2291
  h('pre', { className: 'ilp-code-pre', style: { maxHeight: '160px', overflowY: 'auto' } }, exportInfo.markdown),
2102
2292
  ) : null,
2103
2293
 
2104
- // Accordion Skill Categories (Category 1 open by default; 2 & 3 collapsed)
2105
- tracks.length > 0 && !isCompletelyEmpty ? h('section', { className: 'ilp-tracks', 'data-testid': 'ilp-tracks' },
2294
+ // Populated Skill Categories ONLY (never render empty 0/0 clickable shells!)
2295
+ populatedTracks.length > 0 ? h('section', { className: 'ilp-tracks', 'data-testid': 'ilp-tracks' },
2106
2296
  h('div', { className: 'ilp-section-label' }, '沉淀下来的技能分类(可随时查看学习记录)'),
2107
- tracks.map(function (track) {
2108
- var isOpen = !!expandedTracks[track.id]
2297
+ populatedTracks.map(function (track) {
2298
+ var isOpen = Object.prototype.hasOwnProperty.call(expandedTracks, track.id)
2299
+ ? !!expandedTracks[track.id]
2300
+ : (track.id === firstPopTrackId)
2109
2301
  return h('div', { key: track.id, className: 'ilp-track', 'data-testid': 'ilp-track-' + track.id },
2110
2302
  h('button', {
2111
2303
  type: 'button',
2112
2304
  className: 'ilp-track-head',
2113
2305
  'aria-expanded': isOpen ? 'true' : 'false',
2114
- onClick: function () { toggleTrack(track.id) },
2306
+ onClick: function () { toggleTrack(track.id, isOpen) },
2115
2307
  },
2116
2308
  h('div', { className: 'ilp-track-meta' },
2117
2309
  h('span', { className: 'ilp-track-title' }, track.title),
@@ -2125,43 +2317,44 @@ function makeWorkbenchComponent(React, ctx, bridge) {
2125
2317
  ),
2126
2318
  ),
2127
2319
  isOpen ? h('div', { className: 'ilp-track-list' },
2128
- track.items.length === 0
2129
- ? h('div', { className: 'ilp-item-row' },
2130
- h('span', { className: 'ilp-summary' }, '该分类暂无条目,可在对话学习卡点「加入重点学」或从后台自动存档加入。'),
2131
- )
2132
- : track.items.map(function (item) {
2133
- return h('div', { key: item.id, className: 'ilp-item-row', 'data-testid': 'ilp-item-' + item.id },
2134
- h('div', { className: 'ilp-item-main' },
2135
- h('div', { className: 'ilp-item-badges' },
2136
- sourceTag(h, item.source),
2137
- epistemicTag(h, item.epistemic),
2138
- makeMasteryMeter(h, item.masteryTier),
2139
- ),
2140
- h('button', {
2141
- type: 'button',
2142
- className: 'ilp-item-title',
2143
- onClick: function () { setModalItem(item) },
2144
- }, item.title),
2145
- item.evidenceSummary ? h('p', { className: 'ilp-item-evidence' }, item.evidenceSummary) : null,
2146
- ),
2147
- h('div', { className: 'ilp-item-acts' },
2148
- h('button', {
2149
- type: 'button',
2150
- className: 'ilp-btn line xs',
2151
- onClick: function () { setModalItem(item) },
2152
- }, '学习记录'),
2153
- h('button', {
2154
- type: 'button',
2155
- className: 'ilp-btn soft xs',
2156
- onClick: function () { handleStartDeepDrill(item) },
2157
- }, '展开学'),
2158
- ),
2159
- )
2160
- }),
2320
+ track.items.map(function (item) {
2321
+ return h('div', { key: item.id, className: 'ilp-item-row', 'data-testid': 'ilp-item-' + item.id },
2322
+ h('div', { className: 'ilp-item-main' },
2323
+ h('div', { className: 'ilp-item-badges' },
2324
+ sourceTag(h, item.source),
2325
+ epistemicTag(h, item.epistemic),
2326
+ makeMasteryMeter(h, item.masteryTier),
2327
+ ),
2328
+ h('button', {
2329
+ type: 'button',
2330
+ className: 'ilp-item-title',
2331
+ onClick: function () { setModalItem(item) },
2332
+ }, item.title),
2333
+ item.evidenceSummary ? h('p', { className: 'ilp-item-evidence' }, item.evidenceSummary) : null,
2334
+ ),
2335
+ h('div', { className: 'ilp-item-acts' },
2336
+ h('button', {
2337
+ type: 'button',
2338
+ className: 'ilp-btn line xs',
2339
+ onClick: function () { setModalItem(item) },
2340
+ }, '学习记录'),
2341
+ h('button', {
2342
+ type: 'button',
2343
+ className: 'ilp-btn soft xs',
2344
+ onClick: function () { handleStartDeepDrill(item) },
2345
+ }, '展开学'),
2346
+ ),
2347
+ )
2348
+ }),
2161
2349
  ) : null,
2162
2350
  )
2163
2351
  }),
2164
- ) : null,
2352
+ emptyTrackNames.length > 0 ? h('p', { className: 'ilp-empty-tracks-note', 'data-testid': 'ilp-empty-tracks-note' },
2353
+ '其余待积累分类:' + emptyTrackNames.join(' · '),
2354
+ ) : null,
2355
+ ) : (!isCompletelyEmpty ? h('p', { className: 'ilp-empty-tracks-note', 'data-testid': 'ilp-empty-tracks-note' },
2356
+ '练过或存下的内容会自动按分类归档到这里;目前还没有已存记录。',
2357
+ ) : null),
2165
2358
 
2166
2359
  // Undo Toast (calm panel surface + green dot)
2167
2360
  toast ? h('div', { className: 'ilp-toast', role: 'status', 'data-testid': 'ilp-toast' },
@@ -2356,9 +2549,9 @@ function makeShieldFenceComponent(React, ctx, bridge, coachStore) {
2356
2549
  }).then(function (res) {
2357
2550
  setSavedLocal(true)
2358
2551
  if (res && res.created === false) {
2359
- setFeedback('已在重点清单中')
2552
+ setFeedback('已在技能库中')
2360
2553
  } else {
2361
- setFeedback('已标为重点待学,去顺带私教可复习')
2554
+ setFeedback('已存进个人技能库,去顺带私教可随时开练')
2362
2555
  }
2363
2556
  }).catch(function (err) {
2364
2557
  setFeedback('保存失败:' + err.message)
@@ -2419,7 +2612,7 @@ function makeShieldFenceComponent(React, ctx, bridge, coachStore) {
2419
2612
  'data-testid': 'ilp-shield-capture-btn',
2420
2613
  'aria-pressed': isCaptured ? 'true' : 'false',
2421
2614
  onClick: handleSaveDirect,
2422
- }, isCaptured ? '已在重点清单' : '加入重点学'),
2615
+ }, isCaptured ? '已存进技能库' : '存进技能库'),
2423
2616
  h('button', {
2424
2617
  type: 'button',
2425
2618
  className: 'ilp-quiet-btn is-ghost',