dsh-screen-automation 0.1.2 → 0.1.3
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/lib/index.js +23 -9
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -8,9 +8,13 @@ import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
|
8
8
|
// - ImageAttachmentRef/SaveImageAttachment/ImageMediaType 是 attachment 服务的写入契约
|
|
9
9
|
import { MessageId } from '@deepseek-ai/dsh-llm';
|
|
10
10
|
// 插件身份:name 是插件在配置树里的稳定 id;inject 声明本插件依赖的
|
|
11
|
-
// Harness
|
|
11
|
+
// Harness 服务。除了工具注册表 tools,understand(VLM 视觉理解) 工具还需要
|
|
12
|
+
// llm(视觉推理)与 attachments(把截图登记为图片引用)两个服务。不把它们
|
|
13
|
+
// 列入 inject,Cordis 会在执行里访问 ctx.llm / ctx.attachments 时抛
|
|
14
|
+
// "cannot get property 'llm' without inject"。注意:被注入的服务必须在该
|
|
15
|
+
// profile 中存在,否则整个插件不会激活(见末尾说明)。
|
|
12
16
|
export const name = 'screen-automation';
|
|
13
|
-
export const inject = ['tools'];
|
|
17
|
+
export const inject = ['tools', 'llm', 'attachments'];
|
|
14
18
|
/**
|
|
15
19
|
* 这个插件把本地「屏幕自动化小助手」(Screen Automation Helper) 桌面端桥接进
|
|
16
20
|
* DeepSeek Harness 的 Agent 工具系统。
|
|
@@ -555,8 +559,11 @@ export function apply(ctx) {
|
|
|
555
559
|
// 30) 把小助手截图喂给 dsh 的视觉模型(识别阶梯的最高层:VLM 理解屏幕)
|
|
556
560
|
// 流程:screen capture 拿图 → ctx.attachments 登记为不可变图片引用 →
|
|
557
561
|
// 拼一个含 image block 的 user 消息 → ctx.llm.stream 多模态推理 → 收集 text-delta。
|
|
558
|
-
// 注意:模型走的是 dsh 当前 profile 配置的 provider
|
|
559
|
-
//
|
|
562
|
+
// 注意:模型走的是 dsh 当前 profile 配置的 provider。默认 deepseek 提供方的
|
|
563
|
+
// DeepSeek-V4-Flash-Vision-Exp 就是视觉模型,可直接用于屏幕理解;若想改用
|
|
564
|
+
// 本机模型,用环境变量 SCREEN_AUTOMATION_VISION_PROVIDER / _MODEL 配置,或每次
|
|
565
|
+
// 调用传 provider/model(例如本机 Ollama 的 qwen2.5-vl)。understand 依赖
|
|
566
|
+
// ctx.llm 与 ctx.attachments,已在插件顶层 inject 中声明。
|
|
560
567
|
ctx.tools.register(defineTool({
|
|
561
568
|
name: 'screen_automation_understand',
|
|
562
569
|
description: 'Capture the screen via the local helper and feed the screenshot to the dsh vision model. ' +
|
|
@@ -569,8 +576,8 @@ export function apply(ctx) {
|
|
|
569
576
|
prompt: { type: 'string', description: 'What to ask about the screenshot. Defaults to a general description request.' },
|
|
570
577
|
target: { type: 'string', description: 'Capture target: foreground | virtual-screen | work-area | task. Default foreground.' },
|
|
571
578
|
region: { type: 'string', description: 'Optional capture region in helper format (e.g. "0,0,800,600").' },
|
|
572
|
-
provider: { type: 'string', description: 'dsh LLM provider route (e.g. deepseek
|
|
573
|
-
model: { type: 'string', description: '
|
|
579
|
+
provider: { type: 'string', description: 'dsh LLM provider route for vision (e.g. "deepseek" for DeepSeek-V4-Flash-Vision-Exp, or a local ollama provider). Falls back to env SCREEN_AUTOMATION_VISION_PROVIDER, then "deepseek".' },
|
|
580
|
+
model: { type: 'string', description: 'Vision model id under the provider. Falls back to env SCREEN_AUTOMATION_VISION_MODEL, then "DeepSeek-V4-Flash-Vision-Exp" (vision model on the deepseek provider).' },
|
|
574
581
|
system: { type: 'string', description: 'Optional system prompt for the vision call.' },
|
|
575
582
|
},
|
|
576
583
|
output: {
|
|
@@ -650,9 +657,16 @@ export function apply(ctx) {
|
|
|
650
657
|
content: userContent,
|
|
651
658
|
source: { kind: 'user' },
|
|
652
659
|
};
|
|
653
|
-
// 5) 走 dsh 当前 profile 的视觉模型(可传 provider/model
|
|
654
|
-
|
|
655
|
-
|
|
660
|
+
// 5) 走 dsh 当前 profile 的视觉模型(可传 provider/model 指向本地模型)。
|
|
661
|
+
// 优先级:调用参数 > 环境变量(整 profile 统一默认) > hardcoded 兜底。
|
|
662
|
+
// 默认 deepseek 提供方的 DeepSeek-V4-Flash-Vision-Exp 即视觉模型,可直接用;
|
|
663
|
+
// 想换本机模型(如 qwen2.5-vl)就靠 provider/model 或环境变量覆盖。
|
|
664
|
+
const provider = (typeof args.provider === 'string' && args.provider.trim())
|
|
665
|
+
? args.provider.trim()
|
|
666
|
+
: (process.env.SCREEN_AUTOMATION_VISION_PROVIDER?.trim() || 'deepseek');
|
|
667
|
+
const model = (typeof args.model === 'string' && args.model.trim())
|
|
668
|
+
? args.model.trim()
|
|
669
|
+
: (process.env.SCREEN_AUTOMATION_VISION_MODEL?.trim() || 'DeepSeek-V4-Flash-Vision-Exp');
|
|
656
670
|
let text = '';
|
|
657
671
|
for await (const chunk of ctx.llm.stream({
|
|
658
672
|
provider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-screen-automation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "DeepSeek Harness (dsh) plugin that bridges the local 'Screen Automation Helper' desktop platform (Windows/macOS) into the Agent tool system. Exposes status, capabilities, workflow list/run/stop, run management, screen capture, local recognition primitives, input control, workflow lifecycle, task sessions and VLM understanding as dsh tools that shell out to the helper's CLI (JSON interface).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|