1 parent
5e5ef5091f
commit
9a37ccab16
4 files changed
+8
-8
No files matched your search
@@ -26,7 +26,7 @@ import UserQuestions, { UserQuestionError } from '@deepseek-ai/dsh-user-question
|
||||
import NodeRuntime from '@deepseek-ai/dsh-ptc-runtime-node'
|
||||
import Sandbox from '@deepseek-ai/dsh-sandbox-local'
|
||||
import SandboxPolicy from '@deepseek-ai/dsh-sandbox-policy'
|
||||
import { LlmAdapter, ToolCallId, type LlmResolvedModelInfo, type StreamChunk } from '@deepseek-ai/dsh-llm'
|
||||
import { LlmAdapter, LlmError, ToolCallId, type LlmResolvedModelInfo, type StreamChunk } from '@deepseek-ai/dsh-llm'
|
||||
import { SessionId } from '@deepseek-ai/dsh-session'
|
||||
import Subprocess from '@deepseek-ai/dsh-subprocess'
|
||||
import SubprocessLocal from '@deepseek-ai/dsh-subprocess-local'
|
||||
@@ -671,7 +671,7 @@ it.each(['unresolved', 'unknown', 'text-only', 'provider-error'] as const)(
|
||||
await f.ctx.plugin(LocalAttachmentStore, { dshHome: root })
|
||||
const saved = vi.spyOn(f.ctx.attachments, 'saveImages')
|
||||
const resolve = vi.spyOn(f.ctx.llm, 'resolveModelInfo')
|
||||
if (route === 'provider-error') resolve.mockRejectedValue(new Error('model lookup failed'))
|
||||
if (route === 'provider-error') resolve.mockRejectedValue(new LlmError('model lookup failed', 'UNKNOWN_MODEL'))
|
||||
else resolve.mockResolvedValue({ provider: 'image-fixture', id: 'vision', name: 'Vision',
|
||||
...route === 'text-only' ? { inputModalities: ['text'] } : {},
|
||||
})
|
||||
@@ -679,10 +679,10 @@ it.each(['unresolved', 'unknown', 'text-only', 'provider-error'] as const)(
|
||||
const result = await f.execute('screenshot', { appHandle: 'app-one', windowId: 7 })
|
||||
expect(result.isError).toBe(true)
|
||||
expect(JSON.stringify(result.content)).toContain(route === 'unresolved' ? 'model route could not be resolved'
|
||||
: route === 'provider-error' ? 'model lookup failed' : 'declare image input')
|
||||
: route === 'provider-error' ? 'model lookup failed' : 'IMAGE_MODEL_UNSUPPORTED: CUA screenshots require model')
|
||||
expect(result.error?.info).toEqual(route === 'unresolved'
|
||||
? { name: 'ToolContextUnavailableError', code: 'TOOL_CONTEXT_UNAVAILABLE' }
|
||||
: route === 'provider-error' ? undefined : { name: 'NativeError', code: 'IMAGE_MODEL_UNSUPPORTED' })
|
||||
: route === 'provider-error' ? { name: 'LlmError', code: 'UNKNOWN_MODEL' } : { name: 'NativeError', code: 'IMAGE_MODEL_UNSUPPORTED' })
|
||||
expect(native.request).not.toHaveBeenCalled()
|
||||
expect(saved).not.toHaveBeenCalled()
|
||||
},
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
en: 5db4d4fea25493b9
|
||||
zh: 65ab64fc24eb0d09
|
||||
/deepseek-ai-dsh-cua/use-this-package:
|
||||
en: 588271340c0d2969
|
||||
zh: b368d49754564764
|
||||
en: 3d14b1f943e5750a
|
||||
zh: 9b2fe4c4cdbb689f
|
||||
/deepseek-ai-dsh-cua/use-this-package/permission-controls:
|
||||
en: d92d5948a7941e8d
|
||||
zh: d43491ae6521b87e
|
||||
|
||||
@@ -37,7 +37,7 @@ Keyboard methods are available in the scopes a provider declares; the provider o
|
||||
|
||||
Observation methods emit and return their result. Use `void await app.getAccessibilityTree()` for one visible copy, or use `emit:false` and print the returned text once. `window.getScreenshot()` returns `CuaScreenshot` with `bytes`, `mimeType`, `pixelWidth`, `pixelHeight`, and `windowId`. The image sink receives the same object. Use its MIME type when selecting a file extension or declaring an image; the format can be PNG, JPEG, WebP, or GIF. Each screenshot enters the attachment pipeline once; `emit:false` only suppresses the object sink.
|
||||
|
||||
`tools.cua` returns operation values directly. Screenshot values retain the encoded image Base64 and add a durable `attachment` reference for the tool renderer; model content contains coordinate metadata and one image, without the encoded bytes. Before capture, the tool requires an attachment store and a resolved model route declaring image input. Admission and storage failures reject the call. Failed calls carry structured identity: native and host refusals use `NativeError` with the native or host code, such as `APP_ACCESS_DENIED`, `NATIVE_TIMEOUT`, or `IMAGE_MODEL_UNSUPPORTED` for a model without image input; a missing Agent, attachment store, or model route uses `ToolContextUnavailableError`; arguments the schema cannot check use `ToolArgsError`; native cancellation after the caller cancels records `AbortError` with `ABORTED`. The object bridge preserves the screenshot bytes and validated metadata without uploading or emitting the same image again.
|
||||
`tools.cua` returns operation values directly. Screenshot values retain the encoded image Base64 and add a durable `attachment` reference for the tool renderer; model content contains coordinate metadata and one image, without the encoded bytes. Before capture, the tool requires an attachment store and a resolved model route declaring image input. Admission and storage failures reject the call. Failed calls carry structured identity: native and host refusals use `NativeError` with the native or host code, such as `APP_ACCESS_DENIED`, `NATIVE_TIMEOUT`, or `IMAGE_MODEL_UNSUPPORTED` for a model without image input, which stays on `NativeError` because it is the package's one error class and its message keeps the `CODE: ` prefix every `NativeError` carries; a missing Agent, attachment store, or model route uses `ToolContextUnavailableError`; arguments the schema cannot check use `ToolArgsError`; native cancellation after the caller cancels records `AbortError` with `ABORTED`. The object bridge preserves the screenshot bytes and validated metadata without uploading or emitting the same image again.
|
||||
|
||||
Application consent precedes launch, observation, capture, and input. Session access is stored by conversation and application identity and survives DSH restart and Computer Use disablement. Other conversations require their own consent. Saved grants require a platform-provided reusable application identity. Refusal and revocation close affected Agent connections, so their old objects require fresh selection. No input is replayed after cancellation, timeout, or reconnect.
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ kind: "package-reference"
|
||||
|
||||
观察方法会输出并返回结果。使用 `void await app.getAccessibilityTree()` 只展示一份内容,或使用 `emit:false` 后打印一次返回文本。`window.getScreenshot()` 返回包含 `bytes`、`mimeType`、`pixelWidth`、`pixelHeight` 和 `windowId` 的 `CuaScreenshot`,图片输出回调接收同一个对象。选择文件后缀或声明图片时使用其中的 MIME 类型;格式可能是 PNG、JPEG、WebP 或 GIF。每张截图只进入一次附件处理链;`emit:false` 只抑制对象层的输出。
|
||||
|
||||
`tools.cua` 直接返回操作结果。截图结果保留图片 Base64,并增加供工具渲染使用的持久 `attachment` 引用;模型内容只包含坐标元数据和一张图片,不包含编码字节。截图前要求附件服务可用,并确认当前模型支持图片输入。图片接入或保存失败会拒绝调用。失败调用带有结构化标识:原生与 Host 拒绝使用 `NativeError` 及原生或 Host code,例如 `APP_ACCESS_DENIED`、`NATIVE_TIMEOUT`,模型不支持图片输入时为 `IMAGE_MODEL_UNSUPPORTED`;缺少 Agent、附件服务或模型路由时使用 `ToolContextUnavailableError`;参数 schema 无法检查的参数错误使用 `ToolArgsError`;调用方取消后的原生取消记录为 `AbortError` 与 `ABORTED`。对象桥接保留截图字节和已校验的元数据,不重复上传或输出同一张图片。
|
||||
`tools.cua` 直接返回操作结果。截图结果保留图片 Base64,并增加供工具渲染使用的持久 `attachment` 引用;模型内容只包含坐标元数据和一张图片,不包含编码字节。截图前要求附件服务可用,并确认当前模型支持图片输入。图片接入或保存失败会拒绝调用。失败调用带有结构化标识:原生与 Host 拒绝使用 `NativeError` 及原生或 Host code,例如 `APP_ACCESS_DENIED`、`NATIVE_TIMEOUT`,模型不支持图片输入时为 `IMAGE_MODEL_UNSUPPORTED`,它仍属于 `NativeError`,因为这是本包唯一的错误类,其 message 也与所有 `NativeError` 一样带 `CODE: ` 前缀;缺少 Agent、附件服务或模型路由时使用 `ToolContextUnavailableError`;参数 schema 无法检查的参数错误使用 `ToolArgsError`;调用方取消后的原生取消记录为 `AbortError` 与 `ABORTED`。对象桥接保留截图字节和已校验的元数据,不重复上传或输出同一张图片。
|
||||
|
||||
应用授权发生在启动、观察、截图和输入之前。会话许可按对话和应用身份持久化,重启 DSH 或关闭 Computer Use 后仍可复用,其他对话需要单独授权。长期许可要求平台提供可复用的应用身份。拒绝或撤销会关闭受影响的 Agent 连接,因此旧对象必须重新选择目标。取消、超时或重新连接后均不重放输入。
|
||||
|
||||
|
||||
Reference in new issue
Block a user