@sparkelf/dsh-plus 0.2.2-alpha.2.44 → 0.2.2-alpha.2.46

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sparkelf/dsh-plus",
3
3
  "description": "DeepSeek Harness Plus official-base Web distribution profile and ranged compatibility patchset",
4
- "version": "0.2.2-alpha.2.44",
4
+ "version": "0.2.2-alpha.2.46",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -75,7 +75,7 @@
75
75
  "@sparkelf/dsh-workbench-vault": "0.1.2",
76
76
  "@sparkelf/dsh-ssh-manager": "0.7.5",
77
77
  "@sparkelf/dsh-api-client": "0.5.3",
78
- "dsh-better-sidebar": "npm:@sparkelf/dsh-better-sidebar@0.29.0-sparkelf.17",
78
+ "dsh-better-sidebar": "npm:@sparkelf/dsh-better-sidebar@0.29.0-sparkelf.18",
79
79
  "@sparkelf/dsh-office-viewer-fonts": "0.1.6",
80
80
  "dsh-video-preview": "0.1.4",
81
81
  "dsh-right-bg-anim": "1.1.0",
@@ -607,6 +607,21 @@
607
607
  },
608
608
  "file": "./patches/dsh-resource-ref-chip.patch",
609
609
  "retireWhen": "官方 primitives 的 ReferenceIconKind 增加 resource 类型后退役"
610
+ },
611
+ {
612
+ "id": "session-controller-image-downgrade-and-tool-visibility",
613
+ "dsh": ">=0.2.2-alpha.2",
614
+ "target": {
615
+ "kind": "dsh-source",
616
+ "packages": [
617
+ "@deepseek-ai/dsh-api-session-controller"
618
+ ],
619
+ "paths": [
620
+ "packages/api/session-controller/"
621
+ ]
622
+ },
623
+ "file": "./patches/session-controller-image-downgrade-and-tool-visibility.patch",
624
+ "retireWhen": "上游 dsh-api-session-controller 支持非视觉模型图片降级与按模型能力裁剪工具面后退役"
610
625
  }
611
626
  ]
612
627
  },
@@ -644,7 +659,7 @@
644
659
  "@sparkelf/dsh-quant": "0.91.0-sparkelf.13",
645
660
  "@sparkelf/dsh-genui": "0.15.0-sparkelf.1",
646
661
  "@sparkelf/dsh-sql-workbench": "0.5.4-sparkelf.1",
647
- "@sparkelf/dsh-better-sidebar": "0.29.0-sparkelf.2"
662
+ "@sparkelf/dsh-better-sidebar": "0.29.0-sparkelf.18"
648
663
  }
649
664
  },
650
665
  "team": {
@@ -0,0 +1,83 @@
1
+ --- a/packages/api/session-controller/src/commands.ts 2026-11-03 00:40:46.207711920 +0800
2
+ +++ b/packages/api/session-controller/src/commands.ts 2026-11-03 00:40:46.209868821 +0800
3
+ @@ -83,6 +83,9 @@
4
+
5
+ /** Implements Session business commands delegated by the Session Controller Remote service. */
6
+ export class SessionCommandController {
7
+ + /** 每个 agent 当前生效的工具可见性限制的撤销函数(按模型能力同步)。 */
8
+ + private readonly toolVisibility = new WeakMap<Agent, () => void>()
9
+ +
10
+ /**
11
+ * @param ctx - Host context carrying Agent, model, attachment, title, and Workspace services.
12
+ * @param agents - sole owner of create, resume, and Agent composition.
13
+ @@ -142,6 +145,31 @@
14
+ }
15
+
16
+ /**
17
+ + * 按当前模型的输入能力裁剪工具面。
18
+ + *
19
+ + * `read_image` 会把像素作为图像内容送进对话;纯文本模型即使被允许调用也消费不了,
20
+ + * 而它只要出现在工具清单里,模型就会去试、试了必然失败。这里用
21
+ + * `ctx.tools.restrict({ deny })` 把它从**可见集合**里摘掉——不是调用时报错。
22
+ + *
23
+ + * 只在 agent 作用域调用(全局 ctx 会屏蔽所有 agent);切换模型时先撤销旧限制。
24
+ + *
25
+ + * @param agent - 目标 agent(其 ctx 是作用域键)。
26
+ + * @param selection - 已提交的模型选择。
27
+ + */
28
+ + private async syncToolVisibility(agent: Agent, selection: AgentModelSelection): Promise<void> {
29
+ + const disposers = this.toolVisibility
30
+ + disposers.get(agent)?.()
31
+ + disposers.delete(agent)
32
+ + try {
33
+ + const info = await this.ctx.llm.resolveModelInfo(selection.provider, selection.model)
34
+ + if (info.inputModalities?.includes('image') === true) return
35
+ + disposers.set(agent, agent.ctx.tools.restrict({ deny: ['read_image'] }))
36
+ + } catch {
37
+ + // 模型信息取不到时保持默认(全部可见),不影响主流程。
38
+ + }
39
+ + }
40
+ +
41
+ + /**
42
+ * Validate and record one Session model selection; save the default in the background.
43
+ * @param request - Session identity and requested model selection.
44
+ * @returns the normalized selection recorded for the Session, without waiting for default persistence.
45
+ @@ -160,6 +188,7 @@
46
+ }
47
+ await this.ctx.llm.resolveCallConfig(selected)
48
+ agent.model.select(selected)
49
+ + void this.syncToolVisibility(agent, selected)
50
+ void this.ctx.agentDefaultModel.saveSelection(selected).catch((error: unknown) => {
51
+ this.ctx.logger.warn(
52
+ `session-controller: model selection changed for the Session but the default was not saved: ${String(error)}`,
53
+ @@ -312,20 +341,24 @@
54
+ const hasImage = admission.content.some(part => part.type === 'image')
55
+ const admit = async (): Promise<SessionPromptValue> => {
56
+ try {
57
+ + let promptContent = admission.content
58
+ if (hasImage) {
59
+ const current = agent.model.current()
60
+ if (current !== undefined) {
61
+ const model = await this.ctx.llm.resolveModelInfo(current.provider, current.model)
62
+ if (model.inputModalities !== undefined && !model.inputModalities.includes('image')) {
63
+ - throw new RemoteError(
64
+ - 'session/attachment-invalid',
65
+ - `Model "${current.model}" does not support image input.`,
66
+ - { reason: 'MODEL_DOES_NOT_SUPPORT_IMAGES' },
67
+ - )
68
+ + // 纯文本模型:不要把整条消息拒掉。图片块降级成一行文字占位,消息照常入队;
69
+ + // 模型看不到像素,但至少用户能发出去,不会卡在输入框。
70
+ + promptContent = admission.content.map(part => part.type === 'image'
71
+ + ? {
72
+ + type: 'text' as const,
73
+ + text: '[图片附件已附加。当前模型不支持图像输入,无法查看图片内容;如需处理请改用文件/工具链路。]',
74
+ + }
75
+ + : part)
76
+ }
77
+ }
78
+ }
79
+ - const content = await this.ctx.attachments.admitPromptContent(admission.content)
80
+ + const content = await this.ctx.attachments.admitPromptContent(promptContent)
81
+ const message: UserMessage = createUserMessage({ content, source })
82
+ if (this.ctx.agents.get(agent.id) !== agent) {
83
+ throw new RemoteError(