dsh-vscode-mode 0.30.0 → 0.31.0

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.
Files changed (53) hide show
  1. package/README.md +54 -10
  2. package/lib/client.js +143 -52
  3. package/lib/client.js.map +1 -1
  4. package/lib/index.js +3549 -1465
  5. package/lib/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/skills/dsh-vscodemode-html-plan/LICENSE +202 -0
  8. package/skills/dsh-vscodemode-html-plan/SKILL.md +147 -0
  9. package/skills/dsh-vscodemode-html-plan/examples/scheduled-send.html +298 -0
  10. package/skills/dsh-vscodemode-html-plan/references/blocks.md +227 -0
  11. package/skills/dsh-vscodemode-html-plan/references/subagent-brief.md +17 -0
  12. package/skills/dsh-vscodemode-html-plan/references/upstream-SKILL.md +174 -0
  13. package/skills/dsh-vscodemode-html-plan/runtime/htmlplan.css +564 -0
  14. package/skills/dsh-vscodemode-html-plan/runtime/htmlplan.js +1299 -0
  15. package/skills/dsh-vscodemode-html-plan/runtime/pack.mjs +300 -0
  16. package/src/ai/llmTask.ts +178 -0
  17. package/src/ai/llmTypes.ts +6 -0
  18. package/src/ai/svnCommitMsg.ts +107 -0
  19. package/src/ai/svnTriage.ts +34 -85
  20. package/src/client/aiCommit.ts +57 -0
  21. package/src/client/htmlPlan/HtmlPlanPanel.ts +261 -0
  22. package/src/client/htmlPlan/planActions.ts +347 -0
  23. package/src/client/htmlPlan/planPage.ts +333 -0
  24. package/src/client/htmlPreview.ts +218 -0
  25. package/src/client/index.ts +8 -0
  26. package/src/client/officialSidebar.ts +11 -3
  27. package/src/client/planState.ts +8 -2
  28. package/src/client/sidebar/menuItems.ts +1 -0
  29. package/src/client/sidebar/panels/SvnPanel.ts +17 -0
  30. package/src/client/sidebar/types.ts +2 -0
  31. package/src/client/styles/editor.css +77 -0
  32. package/src/client/svnActions.ts +7 -0
  33. package/src/client/svnCommit.ts +109 -0
  34. package/src/client/svnNotice.ts +1 -1
  35. package/src/client/svnStatus.ts +5 -2
  36. package/src/client/ui/EditorView.ts +85 -7
  37. package/src/client/ui/McpSettings.ts +59 -0
  38. package/src/client/ui/SvnAiPlanDialog.ts +24 -4
  39. package/src/client/ui/SvnCommitDialog.ts +458 -0
  40. package/src/client/ui/commandCatalog.ts +11 -0
  41. package/src/client/ui/svnCommitModel.ts +204 -0
  42. package/src/fileOpenSettings.ts +113 -5
  43. package/src/htmlPlanCommand.ts +176 -0
  44. package/src/index.ts +4 -0
  45. package/src/shared/keybindings.ts +11 -0
  46. package/src/shared/rpc.ts +13 -4
  47. package/src/shared/svn.ts +191 -10
  48. package/src/shared/svnActions.ts +16 -0
  49. package/src/svn.ts +205 -47
  50. package/src/svnCommit.ts +348 -0
  51. package/src/svnCore.ts +254 -0
  52. package/src/svnToolJson.ts +73 -0
  53. package/src/svnTools.ts +566 -0
@@ -20,7 +20,28 @@ import { log } from './log.js'
20
20
 
21
21
  export const FILE_OPEN_SETTINGS_NS = 'dsh-vscode-mode'
22
22
  export const FILE_OPEN_DEFAULT = 'auto'
23
- export interface FileOpenSettings { fileOpenTool: string; integrationBaseUrl: string; svnPath: string; tortoisePath: string }
23
+ /** SVN 命令超时倍数默认值(1 = 不放大)。 */
24
+ export const SVN_SCALE_DEFAULT = 1
25
+ /** SVN 超时倍数范围。 */
26
+ export const SVN_SCALE_MIN = 0.2
27
+ export const SVN_SCALE_MAX = 20
28
+
29
+ export interface FileOpenSettings {
30
+ fileOpenTool: string
31
+ integrationBaseUrl: string
32
+ svnPath: string
33
+ tortoisePath: string
34
+ /** SVN 命令超时倍数(0.2–20,默认 1)。 */
35
+ svnCommandTimeoutScale?: number
36
+ /** 提交前对未版本化文件自动 svn add(默认 true)。 */
37
+ svnAutoAddUnversioned?: boolean
38
+ /** 提交前对缺失文件自动 svn delete(默认 true)。 */
39
+ svnAutoDeleteMissing?: boolean
40
+ /** 只读模式:host 拒绝全部写操作(默认 false)。 */
41
+ svnReadOnly?: boolean
42
+ /** AI 提交信息风格(默认 plain)。 */
43
+ aiCommitStyle?: 'plain' | 'conventional'
44
+ }
24
45
  export interface FileOpenSettingsState { value: string; revision?: number; update: (value: string, expectedRevision?: number) => Promise<void> }
25
46
 
26
47
  /** AI 配置默认值(补全默认关;路由空 = 自动;档位空 = 跟随模型默认;任务模型空 = 跟随补全配置)。 */
@@ -429,6 +450,13 @@ export function buildSettingsSchema(z: SettingsDeps['z'], options?: { volatile?:
429
450
  // SVN 能力:svn CLI 覆盖(空 = PATH)与 TortoiseSVN 目录(Windows 过渡增强)
430
451
  svnPath: withVol(z.string().default('')),
431
452
  tortoisePath: withVol(z.string().default(TORTOISE_DIR_DEFAULT)),
453
+ // SVN 执行与提交(22-agent-tools-and-commit):超时倍数 / 提交前自动整理 / 只读门禁
454
+ svnCommandTimeoutScale: withVol(z.number().default(SVN_SCALE_DEFAULT)),
455
+ svnAutoAddUnversioned: withVol(z.boolean().default(true)),
456
+ svnAutoDeleteMissing: withVol(z.boolean().default(true)),
457
+ svnReadOnly: withVol(z.boolean().default(false)),
458
+ // AI:提交信息风格(plain = 中文模板 / conventional = Conventional Commits)
459
+ aiCommitStyle: withVol(z.string().default('plain')),
432
460
  // 原生打开范围(逗号分隔后缀;默认 = 让位清单并集,csv/tsv 决策见 shared/nativeOpen.ts)
433
461
  nativeOpenExts: withVol(z.string().default(DEFAULT_NATIVE_CSV)),
434
462
  // 交互特性开关(默认开):拖拽/粘贴/复制的引用接入;搜索面板的全局替换
@@ -533,6 +561,25 @@ function tortoiseDirValueOf(config: unknown): string {
533
561
  return typeof raw === 'string' && raw.trim() ? raw.trim() : TORTOISE_DIR_DEFAULT
534
562
  }
535
563
 
564
+ /** 布尔设置读取(缺省/非布尔 → 默认值)。 */
565
+ function boolValueOf(stored: unknown, key: string, fallback: boolean): boolean {
566
+ const raw = configField(stored, key)
567
+ return typeof raw === 'boolean' ? raw : fallback
568
+ }
569
+
570
+ /** 超时倍数读取(越界夹到 0.2–20;非数值回落默认)。 */
571
+ function scaleValueOf(stored: unknown): number {
572
+ const raw = configField(stored, 'svnCommandTimeoutScale')
573
+ const value = typeof raw === 'number' ? raw : Number(raw)
574
+ if (!Number.isFinite(value)) return SVN_SCALE_DEFAULT
575
+ return Math.min(SVN_SCALE_MAX, Math.max(SVN_SCALE_MIN, value))
576
+ }
577
+
578
+ /** AI 提交信息风格读取(未知值回落 plain)。 */
579
+ function commitStyleValueOf(stored: unknown): 'plain' | 'conventional' {
580
+ return configField(stored, 'aiCommitStyle') === 'conventional' ? 'conventional' : 'plain'
581
+ }
582
+
536
583
  /**
537
584
  * 安装设置 section(版本自适应;任一策略不可用返回 false 不抛错)。
538
585
  * @author ddj 2026年08月24号 / 2026年09月02号
@@ -579,6 +626,46 @@ function aiValueOf(stored: unknown): { enabled: boolean; provider: string; model
579
626
  }
580
627
  }
581
628
 
629
+ /** SVN 执行设置视图(host 执行器/提交/工具共用)。 */
630
+ export interface PluginSvnSettings {
631
+ /** svn 可执行文件(空 = PATH)。 */
632
+ svnPath: string
633
+ /** TortoiseSVN 目录(Windows 过渡增强)。 */
634
+ tortoisePath: string
635
+ /** 只读模式(写操作统一拒绝)。 */
636
+ readOnly: boolean
637
+ /** 命令超时倍数(0.2–20)。 */
638
+ commandTimeoutScale: number
639
+ }
640
+
641
+ /** 提交前自动整理默认开关。 */
642
+ export interface PluginSvnCommitDefaults {
643
+ /** 未版本化文件自动 add。 */
644
+ autoAdd: boolean
645
+ /** 缺失文件自动 delete。 */
646
+ autoDelete: boolean
647
+ }
648
+
649
+ /** AI 界面设置视图。 */
650
+ export interface PluginAiUiSettings {
651
+ /** 提交信息风格。 */
652
+ commitStyle: 'plain' | 'conventional'
653
+ }
654
+
655
+ /** setupOpenSettings 句柄(设置读写 + 分面视图读取)。 */
656
+ export interface OpenSettingsHandle extends FileOpenSettingsState {
657
+ /** AI 补全配置。 */
658
+ ai: () => AiConfigView
659
+ /** 写 AI 补全配置。 */
660
+ aiUpdate: (patch: AiConfigPatch, expectedRevision?: number) => Promise<AiConfigView>
661
+ /** SVN 执行设置。 */
662
+ svn: () => PluginSvnSettings
663
+ /** 提交自动整理默认值。 */
664
+ svnCommitDefaults: () => PluginSvnCommitDefaults
665
+ /** AI 界面设置。 */
666
+ aiUi: () => PluginAiUiSettings
667
+ }
668
+
582
669
  /**
583
670
  * 注册设置命名空间,并提供 host 侧的读取与更新状态。
584
671
  * @author ddj 2026年08月24号
@@ -587,7 +674,7 @@ function aiValueOf(stored: unknown): { enabled: boolean; provider: string; model
587
674
  * @param onChange 设置变化回调
588
675
  * @returns 设置状态(fileOpenTool 值 + AI 补全配置读写)
589
676
  */
590
- export function setupOpenSettings(ctx: Ctx, config: unknown, onChange: (value: string) => void): FileOpenSettingsState & { ai: () => AiConfigView; aiUpdate: (patch: AiConfigPatch, expectedRevision?: number) => Promise<AiConfigView>; svn: () => { svnPath: string; tortoisePath: string } } {
677
+ export function setupOpenSettings(ctx: Ctx, config: unknown, onChange: (value: string) => void): OpenSettingsHandle {
591
678
  let current = configValue(config)
592
679
  let revision: number | undefined
593
680
  let provider: SettingsProvider | undefined
@@ -605,13 +692,27 @@ export function setupOpenSettings(ctx: Ctx, config: unknown, onChange: (value: s
605
692
  aiCurrent = stored !== undefined ? aiValueOf(stored) : aiCurrent
606
693
  }
607
694
 
608
- /** SVN 路径当前值(settings 未就绪回退配置值)。 */
609
- let svnCurrent: { svnPath: string; tortoisePath: string } = {
695
+ /** SVN 执行设置当前值(settings 未就绪回退配置值;只读/倍数/自动整理在此汇总)。 */
696
+ let svnCurrent: PluginSvnSettings & { autoAdd: boolean; autoDelete: boolean } = {
610
697
  svnPath: svnPathValueOf(config),
611
698
  tortoisePath: tortoiseDirValueOf(config),
699
+ readOnly: boolValueOf(config, 'svnReadOnly', false),
700
+ commandTimeoutScale: scaleValueOf(config),
701
+ autoAdd: boolValueOf(config, 'svnAutoAddUnversioned', true),
702
+ autoDelete: boolValueOf(config, 'svnAutoDeleteMissing', true),
612
703
  }
704
+ /** AI 界面设置当前值(提交信息风格 / 整理是否默认按勾选范围)。 */
705
+ let aiUiCurrent: PluginAiUiSettings = { commitStyle: commitStyleValueOf(config) }
613
706
  const svnSync = (stored: unknown): void => {
614
- svnCurrent = { svnPath: svnPathValueOf(stored), tortoisePath: tortoiseDirValueOf(stored) }
707
+ svnCurrent = {
708
+ svnPath: svnPathValueOf(stored),
709
+ tortoisePath: tortoiseDirValueOf(stored),
710
+ readOnly: boolValueOf(stored, 'svnReadOnly', false),
711
+ commandTimeoutScale: scaleValueOf(stored),
712
+ autoAdd: boolValueOf(stored, 'svnAutoAddUnversioned', true),
713
+ autoDelete: boolValueOf(stored, 'svnAutoDeleteMissing', true),
714
+ }
715
+ aiUiCurrent = { commitStyle: commitStyleValueOf(stored) }
615
716
  }
616
717
  /** 读取 settings 存储值(describe 未就绪返回 undefined)。 */
617
718
  const storedValue = (): unknown => {
@@ -623,6 +724,11 @@ export function setupOpenSettings(ctx: Ctx, config: unknown, onChange: (value: s
623
724
  integrationBaseUrl: baseValueOf(config),
624
725
  svnPath: svnCurrent.svnPath,
625
726
  tortoisePath: svnCurrent.tortoisePath,
727
+ svnCommandTimeoutScale: svnCurrent.commandTimeoutScale,
728
+ svnAutoAddUnversioned: svnCurrent.autoAdd,
729
+ svnAutoDeleteMissing: svnCurrent.autoDelete,
730
+ svnReadOnly: svnCurrent.readOnly,
731
+ aiCommitStyle: aiUiCurrent.commitStyle,
626
732
  }, {
627
733
  setSource: (source) => {
628
734
  notify(source().fileOpenTool)
@@ -656,6 +762,8 @@ export function setupOpenSettings(ctx: Ctx, config: unknown, onChange: (value: s
656
762
  },
657
763
  ai: () => aiCurrent,
658
764
  svn: () => svnCurrent,
765
+ svnCommitDefaults: () => ({ autoAdd: svnCurrent.autoAdd, autoDelete: svnCurrent.autoDelete }),
766
+ aiUi: () => aiUiCurrent,
659
767
  aiUpdate: async (patch: AiConfigPatch, expectedRevision?: number): Promise<AiConfigView> => {
660
768
  const stored = { ...aiCurrent }
661
769
  const body: Record<string, unknown> = {}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * dsh-vscode-mode host — /html-plan 命令:一键进入计划模式,并用 HTML 计划页交付。
3
+ *
4
+ * 机制(不复制官方逻辑):
5
+ * - 宿主命令声明 input,rawInput 就是用户的「任务」;
6
+ * - 处理器调用官方 /plan 命令并带上本插件的技能指令,官方 plan 处理器会
7
+ * 进入计划模式并用 agent.steer 把这段指令作为用户消息送出;
8
+ * - 因此这里不自行构造 UserMessage、不碰 plan 模式内部状态,官方不可用时直接报错(fail closed)。
9
+ * @author ddj 2026年11月21号
10
+ */
11
+ import { log } from './log.js'
12
+ import type { Ctx } from './store.js'
13
+
14
+ /** 命令名(官方语法:小写字母开头,允许数字/_/-)。 */
15
+ export const HTML_PLAN_COMMAND = 'html-plan'
16
+
17
+ /** 命令描述(出现在 / 菜单与命令目录)。 */
18
+ export const HTML_PLAN_DESCRIPTION = '用 HTML 计划页进入计划模式:/html-plan <任务>'
19
+
20
+ /** 计划指令模板版本(改文案时便于测试断言)。 */
21
+ export const HTML_PLAN_INSTRUCTION_HEAD = '请使用技能 dsh-vscodemode-html-plan 规划下面的任务,并按 DSH 计划模式提交:'
22
+
23
+ /** 裸 /html-plan 的指令:先问清任务,再产出 HTML 计划页。 */
24
+ export const HTML_PLAN_BARE_INSTRUCTION = '请使用技能 dsh-vscodemode-html-plan 规划接下来的任务:先用一句话询问我要规划什么,再按技能规则产出 HTML 计划页,并在 exit_plan_mode 正文写一行「HTML 计划页:<path>」。'
25
+
26
+ /** 委派开关:写在任务前,用户显式输入即视为本任务已授权委派。 */
27
+ export const HTML_PLAN_DELEGATE_FLAG = '--delegate'
28
+
29
+ /** 关闭委派:即使达到阈值也不委派。 */
30
+ export const HTML_PLAN_NO_DELEGATE_FLAG = '--no-delegate'
31
+
32
+ /** 委派写页的指令段(用户在 --delegate 下已授权)。 */
33
+ export const HTML_PLAN_DELEGATE_INSTRUCTION = '5. 写页方式:本次已获用户授权,写页阶段用一个 subagent_fork 专门写 plans/<slug>/plan.html 并打包。调研与主张树由你定稿后,给子级一份摘要(目标、主张列表、图示要点、决策、页路径与 pack 命令),要求它只写页与 pack,返回 packed 路径、lint 结果与主张/决策计数;父级只验 lint、计数与三处抽查,不读全文。子级失败则自己写。'
34
+
35
+ /** 明确不委派的指令段(--no-delegate)。 */
36
+ export const HTML_PLAN_SINGLE_AGENT_INSTRUCTION = '5. 写页方式:本次不要委派子 agent,由你自己写计划页并打包。'
37
+ /** 官方命令运行时最小结构面(宿主服务,鸭子类型)。 */interface CommandsLike {
38
+ register?: (definition: unknown) => unknown
39
+ execute?: (agent: unknown, line: string, attachments: readonly unknown[], signal: AbortSignal) => Promise<{ result?: { kind?: string; text?: string } } | undefined>
40
+ }
41
+
42
+ /** 注入回调上下文最小结构面。 */
43
+ interface CommandCtxLike {
44
+ commands?: CommandsLike
45
+ effect?: (run: () => unknown, label?: string) => unknown
46
+ }
47
+
48
+ /** 安装选项(测试可替换指令模板)。 */
49
+ export interface HtmlPlanCommandOptions {
50
+ /** 自定义指令模板(入参为任务文本与委派开关)。 */
51
+ instructionOf?: (task: string, delegate?: boolean | null) => string
52
+ }
53
+
54
+ /** 命令输入解析结果。 */
55
+ export interface HtmlPlanInput {
56
+ /** true = --delegate,false = --no-delegate,null = 未指定。 */
57
+ delegate: boolean | null
58
+ /** 剥离开关后的任务文本。 */
59
+ task: string
60
+ }
61
+
62
+ /**
63
+ * 解析 /html-plan 的输入:前导 --delegate / --no-delegate 开关(大小写不敏感,最后一个生效),
64
+ * 其余文本作为任务。开关之外的文本原样保留(含内部空格与换行)。
65
+ * @author ddj 2026年11月21号
66
+ * @param rawInput 官方命令的 rawInput
67
+ * @returns 委派开关与任务文本
68
+ */
69
+ export function parseHtmlPlanInput(rawInput: unknown): HtmlPlanInput {
70
+ let rest = String(rawInput ?? '').trim()
71
+ let delegate: boolean | null = null
72
+ for (;;) {
73
+ const match = /^(--delegate|--no-delegate)(?=\s|$)\s*/i.exec(rest)
74
+ if (!match) break
75
+ delegate = match[1].toLowerCase() === HTML_PLAN_DELEGATE_FLAG
76
+ rest = rest.slice(match[0].length)
77
+ }
78
+ return { delegate, task: rest.trim() }
79
+ }
80
+ /**
81
+ * 构造交给 agent 的计划指令:点名技能、产出路径、打包、标记行与审批方式。
82
+ * @author ddj 2026年11月21号
83
+ * @param task 用户任务文本
84
+ * @returns 完整用户消息正文
85
+ */
86
+ export function buildHtmlPlanInstruction(task: string, delegate: boolean | null = null): string {
87
+ const objective = String(task ?? '').trim()
88
+ const lines = [ HTML_PLAN_INSTRUCTION_HEAD,
89
+ '1. 先读相关代码与文件,按技能规则写 plans/<slug>/plan.html(slug 用 kebab-case)。',
90
+ '2. 把技能目录的 runtime/(htmlplan.css、htmlplan.js、pack.mjs)复制到 plans/<slug>/runtime/,运行 pack.mjs 生成 plan.packed.html,成功后删除 runtime/ 与未打包的 plan.html。',
91
+ '3. 调用 exit_plan_mode:正文第一行必须是「# 计划:<标题>」,并包含一行「HTML 计划页:plans/<slug>/plan.packed.html」。',
92
+ '4. 计划正文同时给出 3~6 行摘要与待决策清单;不要绕过计划模式直接开工。',
93
+ '',
94
+ '任务:' + objective,
95
+ ]
96
+ if (delegate !== null) lines.splice(5, 0, delegate ? HTML_PLAN_DELEGATE_INSTRUCTION : HTML_PLAN_SINGLE_AGENT_INSTRUCTION)
97
+ return lines.join('\n')
98
+ }
99
+
100
+ /** 取异常的展示文案。 */
101
+ function messageOf(error: unknown): string {
102
+ if (error instanceof Error) return error.message
103
+ return String(error ?? '未知错误')
104
+ }
105
+
106
+ /**
107
+ * 构造 /html-plan 命令定义(导出便于单测直接调用 handler)。
108
+ * @author ddj 2026年11月21号
109
+ * @param commands 官方命令运行时
110
+ * @param options 安装选项
111
+ * @returns 官方 CommandDefinition 形状对象
112
+ */
113
+ export function htmlPlanCommandDefinition(commands: CommandsLike, options: HtmlPlanCommandOptions = {}): unknown {
114
+ const instructionOf = typeof options.instructionOf === 'function' ? options.instructionOf : buildHtmlPlanInstruction
115
+ return {
116
+ name: HTML_PLAN_COMMAND,
117
+ description: HTML_PLAN_DESCRIPTION,
118
+ input: { hint: '<任务描述>' },
119
+ /** @private @author ddj 2026年11月21号 @param invocation 官方命令调用。 @returns 成功/错误结算。 */
120
+ handler: async (invocation: { agent?: unknown; rawInput?: unknown; signal?: AbortSignal }) => {
121
+ const parsed = parseHtmlPlanInput(invocation?.rawInput)
122
+ const task = parsed.task
123
+ if (typeof commands.execute !== 'function') return { kind: 'error', text: '无法进入计划模式:官方 /plan 命令不可用' }
124
+ const signal = invocation?.signal instanceof AbortSignal ? invocation.signal : new AbortController().signal
125
+ try {
126
+ const delegateNote = parsed.delegate === null ? '' : '\n' + (parsed.delegate ? HTML_PLAN_DELEGATE_INSTRUCTION : HTML_PLAN_SINGLE_AGENT_INSTRUCTION)
127
+ const message = task ? instructionOf(task, parsed.delegate) : HTML_PLAN_BARE_INSTRUCTION + delegateNote
128
+ const execution = await commands.execute(invocation?.agent, '/plan ' + message, [], signal)
129
+ if (!execution) return { kind: 'error', text: '无法进入计划模式:官方 /plan 命令不可用' }
130
+ if (execution.result?.kind !== 'success') {
131
+ return { kind: 'error', text: '无法进入计划模式:' + String(execution.result?.text ?? '未知原因') }
132
+ }
133
+ return { kind: 'success', text: task ? 'HTML 计划模式已开启:正在生成 HTML 计划页…' : 'HTML 计划模式已开启:请描述要规划的任务' }
134
+ } catch (error) {
135
+ return { kind: 'error', text: '无法进入计划模式:' + messageOf(error) }
136
+ }
137
+ },
138
+ }
139
+ }
140
+
141
+ /**
142
+ * 装配 /html-plan 宿主命令(commands 服务惰性获取;缺失时降级记日志,不抛错)。
143
+ * @author ddj 2026年11月21号
144
+ * @param ctx DSH host 上下文
145
+ * @param options 安装选项
146
+ * @returns 是否已调度注册(inject 回调异步执行)
147
+ */
148
+ export function installHtmlPlanCommand(ctx: Ctx, options: HtmlPlanCommandOptions = {}): boolean {
149
+ const inject = (ctx as { inject?: unknown } | undefined)?.inject
150
+ if (typeof inject !== 'function') {
151
+ log.warn('/html-plan 未注册:DSH 未提供 ctx.inject')
152
+ return false
153
+ }
154
+ try {
155
+ ;(inject as (services: string[], callback: (sctx: unknown) => void) => unknown).call(ctx, ['commands'], (sctx) => {
156
+ const commandCtx = sctx as CommandCtxLike
157
+ const commands = commandCtx?.commands
158
+ if (!commands || typeof commands.register !== 'function') {
159
+ log.warn('/html-plan 未注册:commands 服务不支持 register')
160
+ return
161
+ }
162
+ const mount = (): unknown => commands.register!(htmlPlanCommandDefinition(commands, options))
163
+ try {
164
+ if (typeof commandCtx.effect === 'function') commandCtx.effect(mount, 'vscode-mode: html-plan command')
165
+ else mount()
166
+ log.info('/html-plan 已注册:进入计划模式并用 HTML 计划页交付')
167
+ } catch (error) {
168
+ log.warn('/html-plan 注册失败:' + messageOf(error))
169
+ }
170
+ })
171
+ } catch (error) {
172
+ log.warn('/html-plan 注册调度失败:' + messageOf(error))
173
+ return false
174
+ }
175
+ return true
176
+ }
package/src/index.ts CHANGED
@@ -30,9 +30,11 @@ import { disposeAllServers, hookExitReclaim } from './lsp/transport.js'
30
30
  import { createAiRpc } from './ai/rpc.js'
31
31
  import { createFileVersions } from './fileVersions.js'
32
32
  import { createSvnRpc } from './svn.js'
33
+ import { installSvnTools } from './svnTools.js'
33
34
  import { createDapRpc } from './dap/rpc.js'
34
35
  import { installRulesSection } from './rules.js'
35
36
  import { installSkillGroup } from './skills.js'
37
+ import { installHtmlPlanCommand } from './htmlPlanCommand.js'
36
38
  import type { RpcHandlerMap, RpcMethod, RpcRequestMap } from './shared/rpc.js'
37
39
  import type { Registry } from './registry.js'
38
40
  import type { Ctx } from './store.js'
@@ -119,6 +121,7 @@ function attachRuntime(ctx: Ctx, runtime: Runtime): void {
119
121
  function installContent(ctx: Ctx): void {
120
122
  if (!installRulesSection(ctx)) log.warn('未检测到 systemPrompt 服务,规则仅可管理不注入')
121
123
  if (!installSkillGroup(ctx)) log.warn('技能组未调度,插件技能组不可用')
124
+ if (!installHtmlPlanCommand(ctx)) log.warn('/html-plan 命令未调度(官方 /plan 不可用时该命令不可用)')
122
125
  }
123
126
  // #endregion
124
127
 
@@ -156,6 +159,7 @@ export async function apply(ctx: Ctx, config?: unknown): Promise<void> {
156
159
  /** @author ddj 2026年09月28号 @param args Session-bound plan. @returns Validated inbox result. */
157
160
  function submitPlan(args: RpcRequestMap['svn.aiPlanSubmit']) { return dispatch('svn.aiPlanSubmit', args) }
158
161
  await installPlanTool(ctx, submitPlan)
162
+ await installSvnTools(ctx, runtime.svnRpc.api)
159
163
  ctx.effect(mountInbox, 'vscode-mode:open-inbox')
160
164
  ctx.effect(() => shellMenuLifecycle(ctx), 'vscode-mode:integration')
161
165
  /** @author ddj 2026年10月12号 @returns Active-profile bridge disposer; failures never block boot. */
@@ -22,6 +22,9 @@ export const KEYBINDING_DEFAULTS: Record<string, string> = {
22
22
  // Markdown 预览切换:VS Code 同款 (Ctrl+K V 为分栏,此处取单键 Ctrl+Shift+V)。
23
23
  // 仅当活动文件是 .md 时才吞键,其余情况放行给浏览器/输入框(保留「粘贴为纯文本」语义)。
24
24
  'edrv.toggleMarkdownPreview': 'Ctrl+Shift+V',
25
+ // HTML 网页预览:交给官方 HTML 渲染器,Ctrl+Alt+V 与 Markdown 预览分工。
26
+ // 仅当活动文件是 .html/.htm 且官方渲染器可用时才吞键,其余情况放行。
27
+ 'edrv.previewHtml': 'Ctrl+Alt+V',
25
28
  'edrv.navigateBack': 'Alt+ArrowLeft|Ctrl+Alt+-',
26
29
  'edrv.navigateForward': 'Alt+ArrowRight|Ctrl+Shift+-',
27
30
  // 页签循环:主候选避开浏览器保留键(Ctrl+Tab / Ctrl+PgUp/PgDn 会被浏览器截获)
@@ -250,6 +253,14 @@ export const SHORTCUT_PROFILES: Record<string, ShortcutProfiles> = {
250
253
  'web:macos': bind('KeyV', ['primary', 'shift']),
251
254
  'web:windows': bind('KeyV', ['primary', 'shift']),
252
255
  },
256
+ // HTML 预览用 primary+alt+KeyV:避开 Markdown 的 primary+shift+V;
257
+ // linux 的 primary+KeyV 属官方保留键,两个 linux profile 都不声明(用户可自设)。
258
+ 'edrv.previewHtml': {
259
+ 'desktop:macos': bind('KeyV', ['primary', 'alt']),
260
+ 'desktop:windows': bind('KeyV', ['primary', 'alt']),
261
+ 'web:macos': bind('KeyV', ['primary', 'alt']),
262
+ 'web:windows': bind('KeyV', ['primary', 'alt']),
263
+ },
253
264
  // 导航历史:主候选 Alt+Arrow 在 linux/web 为保留或白名单外;web 取第二候选(Ctrl+Alt+- / Ctrl+Shift+-)
254
265
  'edrv.navigateBack': {
255
266
  'desktop:macos': bind('ArrowLeft', ['alt']),
package/src/shared/rpc.ts CHANGED
@@ -22,7 +22,7 @@ import type { SnippetEntry, SnippetInfo, SnippetProject, SnippetRefInput, Snippe
22
22
  import type { QuickMenuDoc } from './quickMenu.js'
23
23
  import type { LspCompletionItem, LspCompletionList, LspEnvInstallState, LspExtInfo, LspExtUpdate, LspHover, LspLocation, LspMarketItem, LspPosition, LspSemanticTokens, LspServerStatus, LspSignatureHelp, LspSymbol } from './lsp.js'
24
24
  import type { AiConfigPatch, AiConfigView, AiDirectoryView, AiInlineRequest, AiInlineResult } from './ai.js'
25
- import type { SvnAction, SvnAiPlan, SvnChangeEntry, SvnConflictArtifact, SvnDiffRevResult, SvnIgnoreItem, SvnLogEntry, SvnRemoteOutdatedEntry, SvnStatusPayload, SvnSumEntry, SvnUpdatePoll, SvnUpdateResult, SvnUpdateState } from './svn.js'
25
+ import type { SvnAction, SvnAiPlan, SvnChangeEntry, SvnCommitPlan, SvnCommitResult, SvnConflictArtifact, SvnDiffRevResult, SvnIgnoreItem, SvnLogEntry, SvnRemoteOutdatedEntry, SvnStatusPayload, SvnSumEntry, SvnUpdatePoll, SvnUpdateResult, SvnUpdateState } from './svn.js'
26
26
  import type { DapAction, DapAdapterInfo, DapBreakpointAck, DapBreakpointInput, DapConfigSnippet, DapConfigSource, DapDebugConfig, DapFrameView, DapPhase, DapPollResult, DapProcessInfo, DapScopeView, DapVariableView } from './dap.js'
27
27
  import { DAP_ACTIONS } from './dap.js'
28
28
  import { transportUrl } from './remoteChannel.js'
@@ -539,14 +539,20 @@ export interface RpcRequestMap {
539
539
  'svn.conflictArtifacts': { sessionId?: string; path: string }
540
540
  'svn.diffLocalPair': { sessionId?: string; left: string; right: string }
541
541
  'svn.fileSizes': { sessionId?: string; paths: string[] }
542
- /** AI 智能整理:只读分析全部变更,产出分组/还原/忽略三段方案(不写工作副本)。 */
543
- 'svn.aiPlan': { sessionId?: string }
542
+ /** AI 智能整理:只读分析变更(paths 限定范围,缺省 = 全部),产出分组/还原/忽略/拆分提交方案。 */
543
+ 'svn.aiPlan': { sessionId?: string; paths?: string[] }
544
544
  /** AI 智能整理执行段:按目录合并写入 svn:ignore 属性(propget 合并,不整体覆盖)。 */
545
545
  'svn.ignore': { sessionId?: string; items: SvnIgnoreItem[] }
546
546
  /** 混合通道投递口:会话 agent 深度分析后把方案 POST 回面板收件箱(免鉴权本地 RPC)。 */
547
547
  'svn.aiPlanSubmit': { sessionId?: string; plan: unknown }
548
548
  /** 混合通道取件口:面板轮询取收件箱方案(since = 注入时刻,早于它的旧投递不算新件)。 */
549
549
  'svn.aiPlanPending': { sessionId?: string; since?: number }
550
+ /** 提交计划:变更清单 + 既有 changelist + 最近提交信息(只读)。 */
551
+ 'svn.commitPlan': { sessionId?: string }
552
+ /** 原生提交:仅提交给定路径;host 先 status 重查再按开关自动 add/delete。 */
553
+ 'svn.commit': { sessionId?: string; paths: string[]; message: string; changelist?: string; keepLocks?: boolean; autoAdd?: boolean; autoDelete?: boolean }
554
+ /** AI 生成提交信息:只分析给定路径(提交范围),产出 subject/body(不提交)。 */
555
+ 'svn.aiCommitMsg': { sessionId?: string; paths: string[]; style?: 'plain' | 'conventional' }
550
556
  'edrv.dap.configs': { workspacePath: string }
551
557
  'edrv.dap.snippets': {}
552
558
  'edrv.dap.processes': { processName?: string }
@@ -732,11 +738,14 @@ export interface RpcOkMap {
732
738
  'svn.conflictArtifacts': { artifacts: SvnConflictArtifact[] }
733
739
  'svn.diffLocalPair': SvnDiffRevResult
734
740
  'svn.fileSizes': { sizes: Array<{ path: string; size: number | null }> }
735
- 'svn.aiPlan': { plan: SvnAiPlan; entriesCount: number; diffIncluded: boolean; dropped: number; model?: string }
741
+ 'svn.aiPlan': { plan: SvnAiPlan; entriesCount: number; analyzedCount: number; diffIncluded: boolean; dropped: number; model?: string }
736
742
  'svn.ignore': { count: number; summary: string; output: string }
737
743
  /** accepted = 归一后三段总路径数(0 = ok:false 拒收);dropped = 幻觉/落选丢弃数。 */
738
744
  'svn.aiPlanSubmit': { accepted: number; dropped: number }
739
745
  'svn.aiPlanPending': { plan: SvnAiPlan | null; dropped: number; at: number }
746
+ 'svn.commitPlan': SvnCommitPlan
747
+ 'svn.commit': SvnCommitResult
748
+ 'svn.aiCommitMsg': { subject: string; body: string; message: string; model: string; stats: { files: number; diffBytes: number; diffIncluded: boolean } }
740
749
  'edrv.dap.configs': { configs: DapDebugConfig[]; adapters: DapAdapterInfo[]; source: DapConfigSource }
741
750
  'edrv.dap.snippets': { snippets: DapConfigSnippet[] }
742
751
  'edrv.dap.processes': { items: DapProcessInfo[] }