dsh-codex-style-computer-use 2.2.9 → 2.3.1
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/README.md +25 -2
- package/README.zh.md +21 -3
- package/cordis.patch.yml +6 -0
- package/lib/approval-attribution.js +118 -33
- package/lib/approval-env.js +178 -0
- package/lib/audit.js +62 -1
- package/lib/image-output.js +23 -65
- package/lib/index.js +57 -6
- package/lib/policy.js +91 -11
- package/lib/tools.js +26 -10
- package/package.json +2 -2
- package/scripts/check-behavior.mjs +1 -1
- package/skills/computer-use/SKILL.md +2 -2
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ English | [中文](README.zh.md) | [Français](README.fr.md) | [Deutsch](README.
|
|
|
23
23
|
|
|
24
24
|
## Why it costs less
|
|
25
25
|
|
|
26
|
+
- **Find a window without reading its controls.** Start with `computer_state {windows:true}`. When you need a control, pass that window's handle to `computer_uia`.
|
|
26
27
|
- **One round trip for a known sequence.** One `computer_batch` call runs a list of actions serially, stops at the first failure, and costs one model round trip instead of one per action.
|
|
27
28
|
- **Only the delta comes back.** Pass the previous observation ID as `since` and receive additions, changes, removals and ordering — not the whole tree again.
|
|
28
29
|
- **Compact receipts by default in 2.0.0.** Post-action text normally adds at most 6 KiB to the action receipt; `feedback: full` is still there when detail matters more.
|
|
@@ -179,13 +180,35 @@ For a host that reports a disabled-prompt automatic refusal as “the user rejec
|
|
|
179
180
|
| Mode | Observation | Actuation |
|
|
180
181
|
|---|---|---|
|
|
181
182
|
| `read-only` | allowed | denied |
|
|
182
|
-
| `standard` | allowed | every action asks through the host's approval card |
|
|
183
|
+
| `standard` | allowed | every action asks through the host's approval card (with no card available it refuses) |
|
|
183
184
|
| `autonomous` | allowed | allowed, high-risk operations still ask |
|
|
184
185
|
| `unrestricted` | allowed | allowed (worker failsafe and rate limit still apply) |
|
|
185
186
|
|
|
186
|
-
High-risk operations (closing a window, `alt+f4`, `win+r`, and the like) ask in every mode
|
|
187
|
+
High-risk operations (closing a window, `alt+f4`, `win+r`, and the like) ask in every mode — as long
|
|
188
|
+
as the session can show a card; the full-access case is described below. Password
|
|
187
189
|
fields are detected through UI Automation's `IsPassword` and refused by default.
|
|
188
190
|
|
|
191
|
+
**An ask is only honoured when the session can actually ask.** The host reports a per-session
|
|
192
|
+
approval policy; its `danger-full-access` preset selects `never`, where no card can be shown and
|
|
193
|
+
every `ask` is auto-rejected. The plugin therefore settles its own asks instead of forwarding an
|
|
194
|
+
unanswerable one:
|
|
195
|
+
|
|
196
|
+
- `autonomous` + proven full access: the high-risk action runs under the human's standing grant
|
|
197
|
+
(recorded as `escalated:"full-access"` in `policy.jsonl`).
|
|
198
|
+
- `standard`: refuses and says so. Full access is not an approval, and the mode's contract is
|
|
199
|
+
per-action consent — raise `automationMode` to `autonomous` if that is what you want.
|
|
200
|
+
- a delegated subagent session: refuses. `@deepseek-ai/dsh-subagent` pins `never` on every child
|
|
201
|
+
and copies the parent's sandbox, so neither fact is the human's grant.
|
|
202
|
+
- any sandbox without proven full access: refuses with an explicit
|
|
203
|
+
`approval prompts are unavailable in this session (approval policy: never)` reason that says
|
|
204
|
+
nothing ran and the user was not asked.
|
|
205
|
+
|
|
206
|
+
The host's legacy `the user rejected tool "…"` wording is corrected for `computer_*` calls, so an
|
|
207
|
+
automatic refusal is never reported as a human decision. Whenever a card can be shown, `standard`
|
|
208
|
+
and `autonomous` ask exactly as before. Gate diagnostics land in
|
|
209
|
+
`$DSH_HOME/data/computer-use/policy.jsonl` (modes, channel, verdict; launch URLs are redacted;
|
|
210
|
+
no typed text).
|
|
211
|
+
|
|
189
212
|
## Safety model
|
|
190
213
|
|
|
191
214
|
- **Shared input** — ordinary user activity is allowed while the agent is thinking, observing or preparing. During actual actuation, typing, scrolling and buttons yield immediately; pointer movement has a 16-pixel displacement tolerance. Continued input or a held key/button for 2 seconds enters automatic waiting. After release and 3 quiet seconds, the agent must inspect the current target and continue the original task, without blindly replaying partial writes. A gentle pale-yellow edge gradient shows human ownership.
|
package/README.zh.md
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
## 为什么它更省
|
|
25
25
|
|
|
26
|
+
- **找窗口时只读窗口列表。** 先用 `computer_state {windows:true}` 拿到目标窗口的句柄,需要定位控件时再把句柄传给 `computer_uia`。
|
|
26
27
|
- **一段已知流程只花一轮往返。** 一次 `computer_batch` 串行执行整串动作、遇错即停,只花一轮模型往返,而不是每个动作各花一轮。
|
|
27
28
|
- **只回增量。** 把上一次观察 ID 作为 `since` 传回,只拿到新增、变化、删除与顺序,而不是整棵树重发。
|
|
28
29
|
- **2.0.0 默认精简回执。** 动作后的文字回执通常最多再加 6 KiB;需要细节时仍可用 `feedback: full`。
|
|
@@ -170,12 +171,29 @@ ID**:派发输入前会核对窗口身份与采样像素,因此过期的 mar
|
|
|
170
171
|
| 模式 | 观察 | 操作 |
|
|
171
172
|
|---|---|---|
|
|
172
173
|
| `read-only` | 允许 | 拒绝 |
|
|
173
|
-
| `standard` | 允许 |
|
|
174
|
+
| `standard` | 允许 | 每个动作都经宿主审批卡确认(无卡可用时拒绝) |
|
|
174
175
|
| `autonomous` | 允许 | 允许,高危动作仍需确认 |
|
|
175
176
|
| `unrestricted` | 允许 | 允许(worker 自身的失效保护与限速仍在) |
|
|
176
177
|
|
|
177
|
-
高危动作(关闭窗口、`alt+f4`、`win+r`
|
|
178
|
-
|
|
178
|
+
高危动作(关闭窗口、`alt+f4`、`win+r` 等)在任何模式下都要确认——前提是当前会话真的能弹卡;
|
|
179
|
+
完全权限下的情形见下。密码框通过 UI Automation 的 `IsPassword` 识别,默认拒绝输入。
|
|
180
|
+
|
|
181
|
+
**只有在当前会话真的能弹卡时,`ask` 才会被交给宿主。** 宿主按会话给出审批策略;`danger-full-access`
|
|
182
|
+
预设选的是 `never`,此时弹不出任何卡片,任何 `ask` 都会被自动拒绝。插件因此自己裁决这个 ask,而不是
|
|
183
|
+
把一个无人可答的请求转发下去:
|
|
184
|
+
|
|
185
|
+
- `autonomous` + 已证实完全权限:高危动作按人的既有授权直接执行(`policy.jsonl` 记为
|
|
186
|
+
`escalated:"full-access"`)。
|
|
187
|
+
- `standard`:拒绝并说明原因。完全权限不是一次审批,而这个模式的契约是「逐次同意」;确实要放行,
|
|
188
|
+
请把 `automationMode` 提到 `autonomous`。
|
|
189
|
+
- 被委派的 subagent 会话:拒绝。`@deepseek-ai/dsh-subagent` 给每个子会话钉死 `never` 并复制父会话
|
|
190
|
+
沙箱,这两件事都不是人给的授权。
|
|
191
|
+
- 任何没有「已证实完全权限」的沙箱:明确拒绝,理由写明「本会话审批弹窗不可用(审批策略 `never`),
|
|
192
|
+
没有执行任何动作,也没有询问用户」。
|
|
193
|
+
|
|
194
|
+
宿主那句遗留的「the user rejected tool "…"」对 `computer_*` 调用会被改写,因此自动拒绝不会再被写成
|
|
195
|
+
人的决定。只要还能弹卡,`standard` 与 `autonomous` 照旧询问。门禁诊断落在
|
|
196
|
+
`$DSH_HOME/data/computer-use/policy.jsonl`(模式、通道、裁决;启动 URL 已脱敏;不记录输入文本)。
|
|
179
197
|
|
|
180
198
|
## 安全模型
|
|
181
199
|
|
package/cordis.patch.yml
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
# (click / type / key / drag / scroll / clipboard write) goes through the host's approval card.
|
|
7
7
|
# Raise it to `autonomous` (high-risk operations still ask) or `unrestricted` deliberately, in
|
|
8
8
|
# Settings → computer-use, once you have decided the machine may be driven without a prompt.
|
|
9
|
+
#
|
|
10
|
+
# If the session's approval policy is `never` (DSH selects it for the danger-full-access preset)
|
|
11
|
+
# there is no card to show. `standard` then refuses rather than running, because full access is
|
|
12
|
+
# not an approval; `autonomous` runs the unanswerable high-risk ask under the full-access grant
|
|
13
|
+
# and records it as `escalated:"full-access"` in $DSH_HOME/data/computer-use/policy.jsonl. A
|
|
14
|
+
# delegated subagent session never inherits that grant.
|
|
9
15
|
- insert:
|
|
10
16
|
- id: computer-use
|
|
11
17
|
name: dsh-codex-style-computer-use
|
|
@@ -1,39 +1,124 @@
|
|
|
1
1
|
// Compatibility with hosts that conflate policy refusals and answerer refusals.
|
|
2
2
|
// Delegate first so the host still owns every approval and durable audit pair.
|
|
3
|
+
//
|
|
4
|
+
// The host's `serviceAsk` maps a non-grant to a reason string. One of those strings —
|
|
5
|
+
// `the user rejected tool "X"` — is produced for BOTH a real human "no" and the deterministic
|
|
6
|
+
// auto-reject of the `never` approval policy, where no prompt was ever shown. This seam repairs
|
|
7
|
+
// the `never` case and only that wording: it runs only for computer_* tools, only after the host
|
|
8
|
+
// ran, and only by replacing the reason — the outcome, the borrowed signal and the
|
|
9
|
+
// approval/asked + approval/decided audit pair stay the host's. A rejection under the `ask`
|
|
10
|
+
// policy is left as a channel rejection without any claim about who answered (the answerer may
|
|
11
|
+
// be the human card or the Auto reviewer).
|
|
12
|
+
//
|
|
13
|
+
// 2026-11-12: the seam must also INSTALL reliably. A plugin applied before the tool registry is
|
|
14
|
+
// mounted has no `serviceAsk` to wrap, so it used to degrade to a warning in a log nobody reads
|
|
15
|
+
// and the misleading host wording reached the model. The registry is now also awaited through
|
|
16
|
+
// `ctx.inject`, installs are ref-counted per service (an out-of-order/FIFO unload can no longer
|
|
17
|
+
// leave a dead wrapper installed), and the returned status object (`installed` / `reason` /
|
|
18
|
+
// `rewrites`) is reported in the gate's own diagnostics so "seam never installed" is a visible
|
|
19
|
+
// fact rather than a guess.
|
|
20
|
+
|
|
21
|
+
const LEGACY_USER_REJECTION = /^the user rejected tool "([^"]*)"$/
|
|
22
|
+
|
|
23
|
+
// Identity that survives a TRACED PROXY. `ctx.get('tools')` hands out a fresh proxy on every
|
|
24
|
+
// call, so a WeakMap keyed on the object it returned can never dedupe two installs. The entry is
|
|
25
|
+
// carried on the wrapper function we install as the service's own `serviceAsk`, and read back
|
|
26
|
+
// through that property's DESCRIPTOR value — a plain function reference the proxy forwards — so
|
|
27
|
+
// two fibers wrapping one registry share one entry and restore it exactly once.
|
|
28
|
+
const OWNER = Symbol.for('dsh-computer-use.approval-attribution')
|
|
29
|
+
|
|
30
|
+
function installedEntry (tools) {
|
|
31
|
+
try {
|
|
32
|
+
const value = Object.getOwnPropertyDescriptor(tools, 'serviceAsk')?.value
|
|
33
|
+
return typeof value === 'function' && value[OWNER] ? value[OWNER] : null
|
|
34
|
+
} catch { return null }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One install leaves. The wrapper is removed only when the LAST install leaves, and only if the
|
|
39
|
+
* service still holds our wrapper — a host that replaced `serviceAsk` afterwards keeps its own.
|
|
40
|
+
*/
|
|
41
|
+
function release (entry) {
|
|
42
|
+
entry.refs -= 1
|
|
43
|
+
if (entry.refs > 0) return
|
|
44
|
+
const tools = entry.tools
|
|
45
|
+
try {
|
|
46
|
+
if (Object.getOwnPropertyDescriptor(tools, 'serviceAsk')?.value !== entry.wrapped) return
|
|
47
|
+
if (entry.ownDescriptor) Object.defineProperty(tools, 'serviceAsk', entry.ownDescriptor)
|
|
48
|
+
else delete tools.serviceAsk
|
|
49
|
+
} catch { /* a failed restore must never break disposal */ }
|
|
50
|
+
}
|
|
51
|
+
|
|
3
52
|
export function installApprovalAttribution (ctx, log) {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
53
|
+
const state = { installed: false, reason: 'unknown', entry: null }
|
|
54
|
+
// `rewrites` follows whichever seam this install ended up sharing.
|
|
55
|
+
Object.defineProperty(state, 'rewrites', { get: () => state.entry?.rewrites ?? 0, enumerable: true })
|
|
56
|
+
|
|
57
|
+
const attach = (tools) => {
|
|
58
|
+
if (!tools || typeof tools.serviceAsk !== 'function') return false
|
|
59
|
+
const existing = installedEntry(tools)
|
|
60
|
+
if (existing) {
|
|
61
|
+
existing.refs += 1
|
|
62
|
+
ctx.effect(() => () => release(existing))
|
|
63
|
+
state.entry = existing
|
|
64
|
+
state.installed = true
|
|
65
|
+
state.reason = 'installed'
|
|
66
|
+
return true
|
|
16
67
|
}
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
68
|
+
const entry = { refs: 1, rewrites: 0, tools, original: tools.serviceAsk, ownDescriptor: Object.getOwnPropertyDescriptor(tools, 'serviceAsk'), wrapped: null }
|
|
69
|
+
entry.wrapped = async function (exec, ask) {
|
|
70
|
+
let policy = null
|
|
71
|
+
if (exec?.name?.startsWith('computer_') && exec.agent) {
|
|
72
|
+
// Every member read is guarded: a service whose getter throws must leave the policy
|
|
73
|
+
// unknown (say less), never reject the host's approval call.
|
|
74
|
+
try {
|
|
75
|
+
const approval = this.ctx?.get?.('approval')
|
|
76
|
+
const effectivePolicy = approval?.effectivePolicy
|
|
77
|
+
if (typeof effectivePolicy === 'function') policy = effectivePolicy.call(approval, exec.agent.session)
|
|
78
|
+
} catch { /* unknown policy: say less, not more */ }
|
|
79
|
+
}
|
|
80
|
+
const result = await entry.original.call(this, exec, ask)
|
|
81
|
+
if (!exec?.name?.startsWith('computer_') || result?.decision?.kind !== 'deny') return result
|
|
82
|
+
if (!LEGACY_USER_REJECTION.test(String(result.decision.reason ?? ''))) return result
|
|
83
|
+
entry.rewrites += 1
|
|
84
|
+
const reason = (policy === 'never'
|
|
85
|
+
? `tool "${exec.name}" requires approval, but approval prompts are disabled in this session (approval policy: never); the request was automatically rejected without asking the user`
|
|
86
|
+
: `approval for tool "${exec.name}" was rejected by the approval channel`) +
|
|
87
|
+
(ask?.reason ? `; approval required because: ${ask.reason}` : '')
|
|
88
|
+
return { ...result, decision: { ...result.decision, reason } }
|
|
36
89
|
}
|
|
37
|
-
|
|
38
|
-
|
|
90
|
+
entry.wrapped[OWNER] = entry
|
|
91
|
+
ctx.effect(() => {
|
|
92
|
+
tools.serviceAsk = entry.wrapped
|
|
93
|
+
return () => release(entry)
|
|
94
|
+
})
|
|
95
|
+
state.entry = entry
|
|
96
|
+
state.installed = true
|
|
97
|
+
state.reason = 'installed'
|
|
98
|
+
log.info('approval attribution: installed for computer-use; host approvals and audit retained')
|
|
99
|
+
return true
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let mounted = null
|
|
103
|
+
try { mounted = typeof ctx?.get === 'function' ? ctx.get('tools') : null } catch { mounted = null }
|
|
104
|
+
if (attach(mounted)) return state
|
|
105
|
+
// Not mounted yet: wait for the registry rather than warning into the void. `inject` runs the
|
|
106
|
+
// callback as soon as the service exists, including immediately when it already does; the
|
|
107
|
+
// reason is set BEFORE registering so a synchronous callback cannot be overwritten by it.
|
|
108
|
+
if (typeof ctx?.inject === 'function') {
|
|
109
|
+
state.reason = 'awaiting-tools'
|
|
110
|
+
try {
|
|
111
|
+
ctx.inject(['tools'], (child) => {
|
|
112
|
+
let tools = null
|
|
113
|
+
try { tools = child?.tools ?? (typeof child?.get === 'function' ? child.get('tools') : null) } catch { tools = null }
|
|
114
|
+
if (attach(tools)) return
|
|
115
|
+
state.reason = 'unavailable'
|
|
116
|
+
log.warn('approval attribution: tools service arrived without a serviceAsk seam')
|
|
117
|
+
})
|
|
118
|
+
return state
|
|
119
|
+
} catch { /* fall through to the warning */ }
|
|
120
|
+
}
|
|
121
|
+
state.reason = 'unavailable'
|
|
122
|
+
log.warn('approval attribution: host compatibility seam unavailable')
|
|
123
|
+
return state
|
|
39
124
|
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// approval-env.js — the approval-channel facts this gate is allowed to act on.
|
|
2
|
+
//
|
|
3
|
+
// WHY THIS MODULE EXISTS (measured, 2026-11-12)
|
|
4
|
+
// The policy gate used to answer `{kind:'ask'}` for a high-risk key in `autonomous` mode and
|
|
5
|
+
// hand it to the host. The host's approval service has two policies:
|
|
6
|
+
//
|
|
7
|
+
// * `ask` — an answerer may put a card in front of the human (the host logs approval/asked
|
|
8
|
+
// + approval/decided and routes it to the UI);
|
|
9
|
+
// * `never` — NOTHING is asked. `ApprovalService.decide()` returns `'rejected'` immediately,
|
|
10
|
+
// the tool layer maps that to `the user rejected tool "computer_key"`, and the
|
|
11
|
+
// model/human read a refusal that never happened. DSH selects this policy for the
|
|
12
|
+
// `danger-full-access` permission preset ("Full file access without approval
|
|
13
|
+
// prompts"), i.e. exactly the mode a human picks to say "stop asking me".
|
|
14
|
+
//
|
|
15
|
+
// So the plugin has to settle its OWN asks against the channel it actually has, which needs
|
|
16
|
+
// two facts about the CALLING session:
|
|
17
|
+
//
|
|
18
|
+
// 1. the effective APPROVAL POLICY (`ask` | `never`);
|
|
19
|
+
// 2. the effective SANDBOX MODE (`danger-full-access` is the human's explicit
|
|
20
|
+
// "this machine is pre-authorized" grant; see lib/policy.js applyApprovalChannel()).
|
|
21
|
+
//
|
|
22
|
+
// Reading them must never throw into the gate, and a service that is absent, remounted, or
|
|
23
|
+
// answers with an unknown shape leaves the fact UNKNOWN — unknown keeps the conservative path
|
|
24
|
+
// (`ask` stays `ask`), because guessing "full access" is the one guess that must never happen.
|
|
25
|
+
//
|
|
26
|
+
// The lookup is layered because a host may compose only some of these rows:
|
|
27
|
+
// sandbox : sandboxPolicy.resolve({session}).mode (authoritative, per session)
|
|
28
|
+
// → permissionPresets.permissionState(session).sandbox
|
|
29
|
+
// → the durable session record, NARROWING ONLY (lib/host-debug.js helper)
|
|
30
|
+
// approval : approval.effectivePolicy(session) (authoritative, per session)
|
|
31
|
+
//
|
|
32
|
+
// Both entering facts must be proven LIVE, because either one can widen what the machine does:
|
|
33
|
+
// "full access" suppresses a prompt, and "policy never" declares that no prompt can be shown.
|
|
34
|
+
// Two deliberate omissions follow from that:
|
|
35
|
+
// * `shell.sandboxMode` is NOT consulted. It is the DEPLOYMENT default, not the session's
|
|
36
|
+
// effective mode, so a host launched with full access would report full access for a session
|
|
37
|
+
// the human had switched back to workspace-write.
|
|
38
|
+
// * the durable session record may only NARROW the sandbox and is never read for the approval
|
|
39
|
+
// policy. It is a throttled cache (writeEveryEvents / writeIntervalMs), so right after
|
|
40
|
+
// switching away from full access it can still say "danger-full-access", and right after an
|
|
41
|
+
// approval-policy change it can still say "never"; a cache must never manufacture either
|
|
42
|
+
// grant, only remove one.
|
|
43
|
+
//
|
|
44
|
+
// `sources` names which layer answered, so a later failure is diagnosable from one log line.
|
|
45
|
+
|
|
46
|
+
export const SANDBOX_MODES = Object.freeze(['read-only', 'workspace-write', 'danger-full-access'])
|
|
47
|
+
export const APPROVAL_POLICIES = Object.freeze(['ask', 'never'])
|
|
48
|
+
|
|
49
|
+
const isSandboxMode = (value) => typeof value === 'string' && SANDBOX_MODES.includes(value)
|
|
50
|
+
const readService = (ctx, name) => {
|
|
51
|
+
try { return typeof ctx?.get === 'function' ? ctx.get(name) : undefined } catch { return undefined }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the approval-channel facts for one call.
|
|
56
|
+
* @param {object} request
|
|
57
|
+
* @param {object} [request.ctx] the plugin context; `get(name)` is optional and never trusted to throw
|
|
58
|
+
* @param {object|string|null} [request.session] the calling Agent's session object
|
|
59
|
+
* @param {string|null} [request.sessionId] the calling session id (disk fallback only)
|
|
60
|
+
* @param {((id: string|null) => object|null)|null} [request.durablePermission] optional disk reader
|
|
61
|
+
* @returns {{approvalPolicy: ('ask'|'never'|null), sandbox: (string|null),
|
|
62
|
+
* promptsAvailable: boolean, fullAccess: boolean, sources: string[]}}
|
|
63
|
+
*/
|
|
64
|
+
export function readApprovalEnv ({ ctx, session = null, sessionId = null, durablePermission = null } = {}) {
|
|
65
|
+
const sources = []
|
|
66
|
+
let approvalPolicy = null
|
|
67
|
+
let sandbox = null
|
|
68
|
+
const usable = session !== null && session !== undefined
|
|
69
|
+
|
|
70
|
+
// Every member read goes through this: a service whose property GETTER throws must leave the
|
|
71
|
+
// fact unknown, not turn every computer_* call into "computer-use policy error" (that would be
|
|
72
|
+
// a fail-closed denial of working calls, i.e. a denial-of-service on the gate itself).
|
|
73
|
+
const member = (service, name) => {
|
|
74
|
+
try { return service == null ? undefined : service[name] } catch { return undefined }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const approval = readService(ctx, 'approval')
|
|
78
|
+
if (usable) {
|
|
79
|
+
const effectivePolicy = member(approval, 'effectivePolicy')
|
|
80
|
+
if (typeof effectivePolicy === 'function') {
|
|
81
|
+
try {
|
|
82
|
+
const policy = effectivePolicy.call(approval, session)
|
|
83
|
+
if (APPROVAL_POLICIES.includes(policy)) { approvalPolicy = policy; sources.push('approval.effectivePolicy') }
|
|
84
|
+
} catch { /* unknown policy keeps the conservative path */ }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const sandboxPolicy = readService(ctx, 'sandboxPolicy')
|
|
89
|
+
if (usable) {
|
|
90
|
+
const resolve = member(sandboxPolicy, 'resolve')
|
|
91
|
+
if (typeof resolve === 'function') {
|
|
92
|
+
try {
|
|
93
|
+
const mode = resolve.call(sandboxPolicy, { session })?.mode
|
|
94
|
+
if (isSandboxMode(mode)) { sandbox = mode; sources.push('sandboxPolicy.resolve') }
|
|
95
|
+
} catch { /* fall through to the next layer */ }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (sandbox === null) {
|
|
100
|
+
const presets = readService(ctx, 'permissionPresets')
|
|
101
|
+
if (usable) {
|
|
102
|
+
const permissionState = member(presets, 'permissionState')
|
|
103
|
+
if (typeof permissionState === 'function') {
|
|
104
|
+
try {
|
|
105
|
+
const state = permissionState.call(presets, session)
|
|
106
|
+
if (isSandboxMode(state?.sandbox)) { sandbox = state.sandbox; sources.push('permissionPresets.permissionState') }
|
|
107
|
+
} catch { /* fall through */ }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (sandbox === null && typeof durablePermission === 'function') {
|
|
113
|
+
try {
|
|
114
|
+
const record = durablePermission(sessionId)
|
|
115
|
+
// Narrowing only: a throttled cache may say "full access" after the human left it, so it
|
|
116
|
+
// can never be the evidence FOR an execution grant — only against one.
|
|
117
|
+
if (isSandboxMode(record?.sandbox) && record.sandbox !== 'danger-full-access') {
|
|
118
|
+
sandbox = record.sandbox
|
|
119
|
+
sources.push('session-record')
|
|
120
|
+
}
|
|
121
|
+
} catch { /* unknown stays unknown */ }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
approvalPolicy,
|
|
126
|
+
sandbox,
|
|
127
|
+
// No policy means no proof that prompts are unavailable: keep asking.
|
|
128
|
+
promptsAvailable: approvalPolicy !== 'never',
|
|
129
|
+
fullAccess: sandbox === 'danger-full-access',
|
|
130
|
+
// A delegated child inherits its parent's sandbox mode and has its approval policy pinned to
|
|
131
|
+
// `never` by @deepseek-ai/dsh-subagent. Neither fact is the human's grant: the human granted
|
|
132
|
+
// THIS conversation, not an arbitrary child that decides to drive the desktop on its own.
|
|
133
|
+
delegated: readDelegation(session),
|
|
134
|
+
sources,
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Is this session a delegated child rather than the human's own conversation?
|
|
140
|
+
*
|
|
141
|
+
* The header is the host's own durable identity (`@deepseek-ai/dsh-session` validates
|
|
142
|
+
* `origin: "subagent"`, `parentSession`, `delegationDepth`, `isSeeded`). Three real shapes exist:
|
|
143
|
+
*
|
|
144
|
+
* * the human's own session — no parent fields (`delegationDepth: 0`);
|
|
145
|
+
* * a delegated subagent child — `origin:"subagent"` + `delegationDepth: 1` + `parentSession`
|
|
146
|
+
* (all 260 child headers on this machine have all three);
|
|
147
|
+
* * a FORK of the human's own conversation (sidebar "fork") — `parentSession` + `isSeeded:true`
|
|
148
|
+
* and NO origin/delegationDepth. That is still the human's own
|
|
149
|
+
* conversation: it must keep the grant its parent had, not be
|
|
150
|
+
* refused as if a subagent had asked.
|
|
151
|
+
*
|
|
152
|
+
* So `origin`/`delegationDepth` decide, and a bare `parentSession` only counts as a child when
|
|
153
|
+
* the session is not seeded from its parent (the legacy child shape). A missing header on a live
|
|
154
|
+
* session cannot prove it is the human's, and is treated as delegated.
|
|
155
|
+
*/
|
|
156
|
+
export function readDelegation (session) {
|
|
157
|
+
try {
|
|
158
|
+
if (session === null || session === undefined) return false
|
|
159
|
+
const header = session.header
|
|
160
|
+
if (header === null || header === undefined) return true
|
|
161
|
+
if (typeof header !== 'object') return true
|
|
162
|
+
if (header.origin === 'subagent') return true
|
|
163
|
+
const depth = header.delegationDepth
|
|
164
|
+
if (typeof depth === 'number' && Number.isFinite(depth) && depth > 0) return true
|
|
165
|
+
if (typeof header.parentSession === 'string' && header.parentSession.length > 0) {
|
|
166
|
+
return header.isSeeded !== true
|
|
167
|
+
}
|
|
168
|
+
return false
|
|
169
|
+
} catch { return true }
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** One-line, secret-free summary for logs and diagnostics. */
|
|
173
|
+
export function describeApprovalEnv (env) {
|
|
174
|
+
if (!env || typeof env !== 'object') return 'approval=? sandbox=?'
|
|
175
|
+
return `approval=${env.approvalPolicy ?? '?'} sandbox=${env.sandbox ?? '?'}` +
|
|
176
|
+
(env.delegated === true ? ' delegated' : '') +
|
|
177
|
+
(env.sources?.length ? ` (from ${env.sources.join('+')})` : '')
|
|
178
|
+
}
|
package/lib/audit.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Every actuation the core emits lands here: {ts, op, args(redacted), result?|error?}.
|
|
3
3
|
// Screenshots taken before risky ops (v1) will join the same stream.
|
|
4
4
|
|
|
5
|
-
import { appendFileSync, mkdirSync, existsSync } from 'node:fs'
|
|
5
|
+
import { appendFileSync, mkdirSync, existsSync, renameSync, statSync } from 'node:fs'
|
|
6
6
|
import { join } from 'node:path'
|
|
7
7
|
import { homedir } from 'node:os'
|
|
8
8
|
import { randomUUID } from 'node:crypto'
|
|
@@ -35,3 +35,64 @@ export function installAudit (cu, dataDir) {
|
|
|
35
35
|
for (const event of events) cu.on(event, write)
|
|
36
36
|
return () => { for (const event of events) cu.off(event, write) }
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
// ---- gate diagnostics: WHO asked, WHO could have answered, WHAT was decided ------------------
|
|
40
|
+
// A separate stream from audit.jsonl on purpose: the actuation audit must keep its shape, and a
|
|
41
|
+
// policy question must stay answerable from a file the next report can attach. One line per
|
|
42
|
+
// gated call that reaches the decision (the procedure-gate deny and `acknowledge` return earlier
|
|
43
|
+
// by design), written after the decision, never containing typed text or clipboard contents.
|
|
44
|
+
// Bounded: past GATE_ROTATE_BYTES the stream becomes policy.jsonl.1 and a fresh file starts.
|
|
45
|
+
const GATE_ROTATE_BYTES = 4 * 1024 * 1024
|
|
46
|
+
export function appendGate (dataDir, rec) {
|
|
47
|
+
if (!dataDir || typeof dataDir.root !== 'string') return
|
|
48
|
+
try {
|
|
49
|
+
const file = join(dataDir.root, 'policy.jsonl')
|
|
50
|
+
try {
|
|
51
|
+
if (existsSync(file) && statSync(file).size > GATE_ROTATE_BYTES) renameSync(file, `${file}.1`)
|
|
52
|
+
} catch { /* a failed rotation must not lose the record we are about to append */ }
|
|
53
|
+
appendFileSync(file, JSON.stringify(rec) + '\n')
|
|
54
|
+
} catch { /* diagnostics must never break the decision */ }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// A launch target may be a URL carrying userinfo or a query token. The gate records and logs
|
|
58
|
+
// run through here, so neither the log line nor policy.jsonl can become a credential store.
|
|
59
|
+
const URL_SHAPE = /^([a-z][a-z0-9+.\-]*:\/\/)([^/?#]*)([^?#]*)([?#][\s\S]*)?$/i
|
|
60
|
+
function redactUrl (url) {
|
|
61
|
+
const match = URL_SHAPE.exec(url)
|
|
62
|
+
if (!match) return url
|
|
63
|
+
const authority = match[2].includes('@') ? match[2].slice(match[2].lastIndexOf('@') + 1) : match[2]
|
|
64
|
+
const tail = match[4] === undefined ? '' : (match[4][0] === '?' ? '?<redacted>' : '#<redacted>')
|
|
65
|
+
return `${match[1]}${authority}${match[3]}${tail}`
|
|
66
|
+
}
|
|
67
|
+
export function redactTarget (value) {
|
|
68
|
+
if (typeof value !== 'string') return value
|
|
69
|
+
return redactUrlTokens(value.slice(0, 400)).slice(0, 120)
|
|
70
|
+
}
|
|
71
|
+
/** Redact every URL-shaped token in free text: a target can embed one ("cmd https://u:p@h/?t=1"),
|
|
72
|
+
* and a decision reason quotes the target. */
|
|
73
|
+
const redactUrlTokens = (text) => text.replace(/[a-z][a-z0-9+.\-]*:\/\/[^\s"'<>)\]]+/gi, (token) => redactUrl(token))
|
|
74
|
+
export function redactReasonText (value) {
|
|
75
|
+
return typeof value === 'string' ? redactUrlTokens(value) : value
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const GATE_ARG_KEYS = new Set(['combo', 'op', 'action', 'target', 'hwnd', 'button', 'clicks',
|
|
79
|
+
'allowPassword', 'holdMs', 'mark', 'at', 'from', 'to', 'dir', 'lines', 'x', 'y', 'deltaX', 'deltaY'])
|
|
80
|
+
|
|
81
|
+
/** Argument summary safe to persist: identities, coordinates and lengths, never payload text.
|
|
82
|
+
* Every string goes through the URL redaction, so a URL stuffed into a coordinate field cannot
|
|
83
|
+
* smuggle credentials into the diagnostics either. */
|
|
84
|
+
export function gateArgSummary (name, args) {
|
|
85
|
+
const a = args || {}
|
|
86
|
+
const out = {}
|
|
87
|
+
for (const key of Object.keys(a)) {
|
|
88
|
+
if (!GATE_ARG_KEYS.has(key)) continue
|
|
89
|
+
const value = a[key]
|
|
90
|
+
if (key === 'target') out.target = redactTarget(value)
|
|
91
|
+
else if (typeof value === 'string') out[key] = redactUrlTokens(value).slice(0, 120)
|
|
92
|
+
else if (typeof value === 'number' || typeof value === 'boolean') out[key] = value
|
|
93
|
+
}
|
|
94
|
+
if (name === 'computer_type' && typeof a.text === 'string') out.textLength = a.text.length
|
|
95
|
+
if (name === 'computer_batch' && Array.isArray(a.actions)) out.steps = a.actions.length
|
|
96
|
+
return out
|
|
97
|
+
}
|
|
98
|
+
|
package/lib/image-output.js
CHANGED
|
@@ -21,39 +21,32 @@ function setCoordinates (value, size) {
|
|
|
21
21
|
const validImageSize = size => Array.isArray(size) && size.length === 2 && size.every(n => Number.isFinite(n) && n > 0)
|
|
22
22
|
const validPoint = point => Number.isFinite(point?.x) && Number.isFinite(point?.y)
|
|
23
23
|
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
value.
|
|
27
|
-
if (value.sourceCursorInImage) value.cursorInImage = value.sourceCursorInImage
|
|
28
|
-
else delete value.cursorInImage
|
|
29
|
-
delete value.sourceImageSize
|
|
30
|
-
delete value.sourceCursorInImage
|
|
24
|
+
export function screenshotPathOnly (value, reason) {
|
|
25
|
+
value.imageStatus = 'path-only'
|
|
26
|
+
value.imageReason = reason
|
|
31
27
|
setCoordinates(value, value.imageSize)
|
|
28
|
+
const notes = {
|
|
29
|
+
'model-text-only': 'Image not attached: this model does not declare image input. Use UIA/text or switch to an image-capable model.',
|
|
30
|
+
'delivery-path': 'Path delivery requested: no image block was attached. The file is on path; call read_image only if visual inspection is actually needed.',
|
|
31
|
+
'earlier-batch-image': 'This earlier capture is available at its path.',
|
|
32
|
+
}
|
|
33
|
+
value.view = notes[reason] || 'Image not attached. Use read_image on path if visual inspection is needed.'
|
|
34
|
+
if (value.settled === false) value.view = 'NOT settled — re-shoot. ' + value.view
|
|
35
|
+
return value
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
// DSH image blocks reference the host's durable attachment store. Paths and raw
|
|
35
39
|
// base64 are not image blocks. Keep a usable file when a route cannot accept one.
|
|
36
40
|
export async function attachScreenshot (ctx, exec, value, data, options = {}) {
|
|
37
|
-
|
|
38
|
-
setCoordinates(value, value.imageSize)
|
|
39
|
-
const fallback = (reason) => {
|
|
40
|
-
delete value.image
|
|
41
|
-
restoreFileGeometry(value)
|
|
42
|
-
value.imageStatus = 'path-only'
|
|
43
|
-
value.imageReason = reason
|
|
44
|
-
value.view = reason === 'model-text-only'
|
|
45
|
-
? 'Image not attached: this model does not declare image input. Use UIA/text or switch to an image-capable model.'
|
|
46
|
-
: reason === 'delivery-path'
|
|
47
|
-
? 'Path delivery requested: no image block was attached. The file is on path; call read_image only if visual inspection is actually needed.'
|
|
48
|
-
: 'Image not attached. Use read_image on path if visual inspection is needed.'
|
|
49
|
-
if (value.settled === false) value.view = 'NOT settled — re-shoot. ' + value.view
|
|
50
|
-
return value
|
|
51
|
-
}
|
|
41
|
+
const fallback = reason => screenshotPathOnly(value, reason)
|
|
52
42
|
// delivery:"path" — the caller has another way to verify (UIA/OCR/window text), so the pixels
|
|
53
43
|
// are not evidence it will read. The file is still written and the path still returned; only
|
|
54
44
|
// the image block is withheld, which is what keeps it out of the re-sent conversation history.
|
|
55
45
|
if (options.delivery === 'path') return fallback('delivery-path')
|
|
46
|
+
const blocked = () => exec?.signal?.aborted || options.blocked?.()
|
|
56
47
|
try {
|
|
48
|
+
const interrupted = () => fallback(exec?.signal?.aborted ? 'cancelled' : 'cancelled-or-paused')
|
|
49
|
+
if (blocked()) return interrupted()
|
|
57
50
|
if (!validImageSize(value.imageSize)) return fallback('invalid-source-image-size')
|
|
58
51
|
const sourceSize = [...value.imageSize]
|
|
59
52
|
const attachments = ctx.get?.('attachments')
|
|
@@ -65,10 +58,10 @@ export async function attachScreenshot (ctx, exec, value, data, options = {}) {
|
|
|
65
58
|
if (!llm?.resolveModelInfo || !provider || !model) return fallback('route-unavailable')
|
|
66
59
|
const active = await llm.resolveModelInfo(provider, model, exec?.signal)
|
|
67
60
|
if (!active.inputModalities?.includes('image')) return fallback('model-text-only')
|
|
68
|
-
if (
|
|
61
|
+
if (blocked()) return interrupted()
|
|
69
62
|
if (!attachments.imageLimits?.mediaTypes?.includes(value.mime)) return fallback('media-type-unavailable')
|
|
70
63
|
const image = await attachments.saveImage({ data, mediaType: value.mime, name: basename(value.path) })
|
|
71
|
-
if (
|
|
64
|
+
if (blocked()) return interrupted()
|
|
72
65
|
const attachedSize = [image?.width, image?.height]
|
|
73
66
|
if (!validImageSize(attachedSize)) return fallback('invalid-attachment-image-size')
|
|
74
67
|
const evidence = visionEvidence(exec, { ...options, adapterVersion: active.adapterVersion || 'unversioned' })
|
|
@@ -84,6 +77,7 @@ export async function attachScreenshot (ctx, exec, value, data, options = {}) {
|
|
|
84
77
|
}
|
|
85
78
|
value.image = image
|
|
86
79
|
value.imageStatus = 'attached'
|
|
80
|
+
delete value.imageReason
|
|
87
81
|
setCoordinates(value, attachedSize)
|
|
88
82
|
if (resized && value.coordinateRule) value.coordinateRule += ' imageSize, cursorInImage and coordinates describe the attached image. path retains the original capture: use sourceImageSize and sourceCursorInImage for that file; map its pixels using region.width/sourceImageSize[0] and region.height/sourceImageSize[1].'
|
|
89
83
|
value.view = value.settled === false
|
|
@@ -111,48 +105,12 @@ export function renderScreenshot (value) {
|
|
|
111
105
|
]
|
|
112
106
|
}
|
|
113
107
|
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// falls back to the last explicit step image. A batch that asked for paths must not hand one
|
|
120
|
-
// back as a picture just because the checkpoint was skipped — same pixels, quieter route.
|
|
121
|
-
export function selectBatchScreenshot (result, automatic, kind = 'image', delivery = 'auto') {
|
|
122
|
-
let latest = automatic
|
|
123
|
-
let index
|
|
124
|
-
if (!latest) {
|
|
125
|
-
for (const [i, action] of result.actions.entries()) {
|
|
126
|
-
if (action.tool === 'computer_shot' && action.result?.path) {
|
|
127
|
-
latest = action.result
|
|
128
|
-
index = i
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const pathDelivery = delivery === 'path'
|
|
133
|
-
const pathNote = 'Path delivery requested: no image block was attached. Use read_image on this path only if these pixels are the evidence.'
|
|
134
|
-
for (const action of result.actions) {
|
|
135
|
-
const shot = action.result
|
|
136
|
-
if (shot?.image && shot !== latest) {
|
|
137
|
-
delete shot.image
|
|
138
|
-
restoreFileGeometry(shot)
|
|
139
|
-
shot.imageStatus = 'path-only'
|
|
140
|
-
shot.imageReason = pathDelivery ? 'delivery-path' : 'earlier-batch-image'
|
|
141
|
-
shot.view = pathDelivery
|
|
142
|
-
? pathNote
|
|
143
|
-
: kind === 'state'
|
|
144
|
-
? 'A newer UIA state is returned. This earlier image remains at its path.'
|
|
145
|
-
: 'Only the latest batch screenshot is attached. Use read_image on this path if this earlier frame is needed.'
|
|
146
|
-
}
|
|
147
|
-
}
|
|
108
|
+
// If no automatic checkpoint exists (including after a failed step), identify the
|
|
109
|
+
// last successful explicit capture by its actual step, not the end of the batch.
|
|
110
|
+
export function selectBatchScreenshot (result, automatic, kind = 'image') {
|
|
111
|
+
const index = automatic ? -1 : result.actions.findLastIndex(a => a.tool === 'computer_shot' && a.result?.path)
|
|
112
|
+
const latest = automatic ?? result.actions[index]?.result
|
|
148
113
|
if (latest) {
|
|
149
|
-
if (pathDelivery && latest.image) {
|
|
150
|
-
delete latest.image
|
|
151
|
-
restoreFileGeometry(latest)
|
|
152
|
-
latest.imageStatus = 'path-only'
|
|
153
|
-
latest.imageReason = 'delivery-path'
|
|
154
|
-
latest.view = pathNote
|
|
155
|
-
}
|
|
156
114
|
result.observation = latest
|
|
157
115
|
if (kind === 'state') result.observationSource = 'automatic final UIA state'
|
|
158
116
|
else result.imageSource = automatic ? 'automatic final screenshot' : `action ${index + 1}; captured before any later actions`
|
package/lib/index.js
CHANGED
|
@@ -15,6 +15,12 @@ import { installHumanAttention } from './attention.js'
|
|
|
15
15
|
// autonomous → actuation allowed except high-risk ops (still asks)
|
|
16
16
|
// unrestricted → everything allowed (worker failsafe corner + rate limit remain)
|
|
17
17
|
//
|
|
18
|
+
// `ask` is only honoured when the session CAN ask. Under the host's `never` approval policy —
|
|
19
|
+
// the one the danger-full-access preset selects — an ask is settled by policy.js instead:
|
|
20
|
+
// full access runs it under the human's standing grant, every other sandbox refuses and names
|
|
21
|
+
// the unavailable channel. It is never forwarded to a host that would answer `the user rejected
|
|
22
|
+
// tool "..."` on the user's behalf (measured 2026-11-12).
|
|
23
|
+
//
|
|
18
24
|
// Two out-of-band behaviours live here rather than in the tool layer, because both are
|
|
19
25
|
// triggered by things that happen while the MODEL is not calling anything:
|
|
20
26
|
//
|
|
@@ -30,9 +36,10 @@ import { installHumanAttention } from './attention.js'
|
|
|
30
36
|
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
31
37
|
import Schema from '@deepseek-ai/schemastery'
|
|
32
38
|
import { ComputerUse } from './core/index.js'
|
|
33
|
-
import { policyDecision, HIGH_RISK_NOTE } from './policy.js'
|
|
39
|
+
import { policyDecision, HIGH_RISK_NOTE, ACTUATION_TOOLS } from './policy.js'
|
|
40
|
+
import { readApprovalEnv, describeApprovalEnv } from './approval-env.js'
|
|
34
41
|
import { acknowledge, isAcked, ACK_HINT, isDrivingCall } from './skill-gate.js'
|
|
35
|
-
import { mkDataDir, snapshotPath, installAudit } from './audit.js'
|
|
42
|
+
import { mkDataDir, snapshotPath, installAudit, appendGate, gateArgSummary, redactReasonText } from './audit.js'
|
|
36
43
|
import { registerTools, isCycleStateOnly } from './tools.js'
|
|
37
44
|
import { installToolExposure, ACTIVATION_TOOL } from './exposure.js'
|
|
38
45
|
import { scopeOf } from '@deepseek-ai/dsh-scope'
|
|
@@ -503,7 +510,10 @@ export function apply (ctx, config) {
|
|
|
503
510
|
return
|
|
504
511
|
}
|
|
505
512
|
if (!config.enabled) return
|
|
506
|
-
|
|
513
|
+
// Kept in scope: the gate's diagnostics report whether the legacy-attribution seam is live,
|
|
514
|
+
// because "the misleading wording reached the model" and "the seam was never installed" are
|
|
515
|
+
// different bugs and the next report must not have to guess which one happened.
|
|
516
|
+
const approvalSeam = installApprovalAttribution(ctx, log)
|
|
507
517
|
// Harness compatibility: several fixtures evaluate this module with the `import` lines stripped
|
|
508
518
|
// and only a fixed argument list (test-cycle-no-timeout and friends). `typeof <binding>` is safe
|
|
509
519
|
// even when the binding was stripped, so the debug-gate wiring degrades to "not mounted" there
|
|
@@ -1278,9 +1288,50 @@ export function apply (ctx, config) {
|
|
|
1278
1288
|
if (!isAcked(sessionKey(drv)) && isDrivingCall(exec.name, gArgs)) {
|
|
1279
1289
|
return { kind: 'deny', reason: `READ THE PROCEDURE FIRST. ${ACK_HINT}` }
|
|
1280
1290
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1291
|
+
// ---- THE APPROVAL CHANNEL IS PART OF THE DECISION ---------------------------------------
|
|
1292
|
+
// A policy `ask` is a request for a HUMAN. DSH's `never` approval policy (selected by the
|
|
1293
|
+
// danger-full-access preset) cannot deliver one: ApprovalService.decide() rejects at once
|
|
1294
|
+
// and the tool layer reports `the user rejected tool "..."` — measured 2026-11-12 on
|
|
1295
|
+
// `computer_key {combo:"backspace"}` in a full-access session where the human had touched
|
|
1296
|
+
// nothing. So the two facts that decide whether an ask is answerable are read HERE, per
|
|
1297
|
+
// call, and handed to policy.js, which settles the ask itself (lib/policy.js
|
|
1298
|
+
// applyApprovalChannel): full access runs it, anything else refuses in words that name the
|
|
1299
|
+
// unavailable channel instead of blaming the user. Unknown facts keep the old behaviour.
|
|
1300
|
+
const approvalEnv = readApprovalEnv({
|
|
1301
|
+
ctx,
|
|
1302
|
+
session: (exec.agent && exec.agent.session) || (typeof drv === 'object' ? drv : null),
|
|
1303
|
+
sessionId: sessionKey(drv),
|
|
1304
|
+
durablePermission: typeof sessionPermission === 'function' ? sessionPermission : null,
|
|
1305
|
+
})
|
|
1306
|
+
const rawDecision = policyDecision(exec.name, gArgs, config.automationMode)
|
|
1307
|
+
const decision = policyDecision(exec.name, gArgs, config.automationMode, approvalEnv)
|
|
1308
|
+
// An unanswerable ask that ran anyway is the one transition a reader must be able to see
|
|
1309
|
+
// without guessing: log it as such, never as a plain allow.
|
|
1310
|
+
const ranUnderFullAccess = rawDecision.kind === 'ask' && decision.kind === 'allow'
|
|
1311
|
+
// The reason may quote a launch target (`[target=…]`): redact URL userinfo/query tokens
|
|
1312
|
+
// before either the log or the durable record so neither can become a credential store.
|
|
1313
|
+
const safeReason = decision.reason ? redactReasonText(String(decision.reason)) : ''
|
|
1314
|
+
const gateLine = `gate ${exec.name} ${JSON.stringify(gateArgSummary(exec.name, gArgs))} ` +
|
|
1315
|
+
`automation=${config.automationMode} ${describeApprovalEnv(approvalEnv)} ` +
|
|
1316
|
+
`raw=${rawDecision.kind} final=${decision.kind}` +
|
|
1317
|
+
(ranUnderFullAccess ? ' (unanswerable ask ran under full access)' : '') +
|
|
1318
|
+
(decision.kind !== 'allow' && safeReason ? ` — ${safeReason}` : '')
|
|
1319
|
+
log.info(gateLine)
|
|
1320
|
+
// Durable, secret-free diagnostics for the next report. Observation calls only appear when
|
|
1321
|
+
// something other than "allow" happened, so a busy screenshot session cannot flood it.
|
|
1322
|
+
if (decision.kind !== 'allow' || ranUnderFullAccess || ACTUATION_TOOLS.has(exec.name) || exec.name === 'computer_ctrl') {
|
|
1323
|
+
appendGate(dataDir, {
|
|
1324
|
+
ts: Date.now(), tool: exec.name, args: gateArgSummary(exec.name, gArgs),
|
|
1325
|
+
automationMode: config.automationMode,
|
|
1326
|
+
approvalPolicy: approvalEnv.approvalPolicy, sandbox: approvalEnv.sandbox,
|
|
1327
|
+
promptsAvailable: approvalEnv.promptsAvailable, fullAccess: approvalEnv.fullAccess,
|
|
1328
|
+
delegated: approvalEnv.delegated === true,
|
|
1329
|
+
envSources: approvalEnv.sources, raw: rawDecision.kind, final: decision.kind,
|
|
1330
|
+
attributionSeam: approvalSeam?.installed === true ? 'installed' : (approvalSeam?.reason ?? 'absent'),
|
|
1331
|
+
...(ranUnderFullAccess ? { escalated: 'full-access' } : {}),
|
|
1332
|
+
...(safeReason ? { reason: safeReason.slice(0, 500) } : {}),
|
|
1333
|
+
...(sessionKey(drv) ? { session: sessionKey(drv) } : {}),
|
|
1334
|
+
})
|
|
1284
1335
|
}
|
|
1285
1336
|
// RETURN the decision — do not hand it to next(). On this DSH build `next` is
|
|
1286
1337
|
// `() => Promise<PreToolDecision>`: it takes NO arguments, so `next(decision)` silently
|
package/lib/policy.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
// policy.js — pure approval decision for dsh-computer-use.
|
|
2
2
|
// Modeled on @anweat/dsh-browser's approval-policy.js: a pure function mapping
|
|
3
|
-
// (toolName, args, automationMode) -> {kind:'allow'|'deny'|'ask', reason}.
|
|
3
|
+
// (toolName, args, automationMode, approvalEnv?) -> {kind:'allow'|'deny'|'ask', reason}.
|
|
4
4
|
// Fail-closed by construction: unknown tool names are denied.
|
|
5
5
|
//
|
|
6
|
+
// The 4th argument names THIS session's approval channel (see lib/approval-env.js). It exists
|
|
7
|
+
// because `ask` is a request for a HUMAN, and a channel that cannot reach one turns every ask
|
|
8
|
+
// into a silent auto-reject the host reports as `the user rejected tool "..."`. Full access is
|
|
9
|
+
// the human's standing "do not ask me" grant, so there an unanswerable ask runs; everywhere
|
|
10
|
+
// else it becomes an honest, explicitly-worded refusal. See applyApprovalChannel().
|
|
11
|
+
//
|
|
6
12
|
// ⚠️ KEEP IN SYNC WITH THE TOOL SURFACE. A fail-closed list is only safe if it is also COMPLETE.
|
|
7
13
|
// 2026-09-13: the tool set was rewritten from 28 names to 17 (merged + renamed) and this
|
|
8
14
|
// allow-list was NOT updated, so the plugin's own gate would have denied most of its own tools
|
|
@@ -30,8 +36,8 @@ export const ACTUATION_TOOLS = new Set([
|
|
|
30
36
|
'computer_launch', 'computer_focus',
|
|
31
37
|
])
|
|
32
38
|
|
|
33
|
-
export const HIGH_RISK_NOTE = 'high-risk action (destructive key / closing a window / password field) —
|
|
34
|
-
export const LAUNCH_HIGH_RISK_NOTE = 'high-risk launch (executable / script / installer / UNC / file: target) — explorer will run what it resolves;
|
|
39
|
+
export const HIGH_RISK_NOTE = 'high-risk action (destructive key / closing a window / password field) — normally requires human approval'
|
|
40
|
+
export const LAUNCH_HIGH_RISK_NOTE = 'high-risk launch (executable / script / installer / UNC / file: target) — explorer will run what it resolves; normally requires human approval'
|
|
35
41
|
|
|
36
42
|
// A launch target that IS code (or points at it) escalates everywhere it can: the launcher
|
|
37
43
|
// executes what it resolves, so argv discipline cannot make an .exe/.bat/UNC target "just a
|
|
@@ -41,7 +47,7 @@ export const LAUNCH_HIGH_RISK_NOTE = 'high-risk launch (executable / script / in
|
|
|
41
47
|
const LAUNCH_CODE_TARGET = /\.(exe|scr|msi|hta|bat|cmd|com|pif|cpl|msc|reg|jse|vbe|vbs|ws|wsf|wsh|ps1|lnk|url|jar|application|appref-ms|appx|msix|gadget|sct)$/i
|
|
42
48
|
|
|
43
49
|
/** @returns {{kind:'allow'|'deny'|'ask', reason?: string}} */
|
|
44
|
-
export function policyDecision (name, args, mode) {
|
|
50
|
+
export function policyDecision (name, args, mode, approvalEnv) {
|
|
45
51
|
const a = args || {}
|
|
46
52
|
|
|
47
53
|
// ---- the two argument-dependent tools -------------------------------------------------
|
|
@@ -59,7 +65,7 @@ export function policyDecision (name, args, mode) {
|
|
|
59
65
|
// the second answer of the ask protocol ("I cannot proceed") and the ask notice promises the
|
|
60
66
|
// human the agent can give it — denying it made that answer dead in all four modes.
|
|
61
67
|
if (act === 'exit') return { kind: 'allow' }
|
|
62
|
-
if (act === 'calibrate' || act === 'indicator') return decideActuation(name, a, mode)
|
|
68
|
+
if (act === 'calibrate' || act === 'indicator') return decideActuation(name, a, mode, approvalEnv)
|
|
63
69
|
return { kind: 'deny', reason: `unknown computer_ctrl action: ${act}` }
|
|
64
70
|
}
|
|
65
71
|
|
|
@@ -74,15 +80,15 @@ export function policyDecision (name, args, mode) {
|
|
|
74
80
|
if (name === 'computer_ask') return { kind: 'allow' }
|
|
75
81
|
if (name === 'computer_clip') {
|
|
76
82
|
if (a.text === undefined) return { kind: 'allow' } // read
|
|
77
|
-
return decideActuation(name, a, mode)
|
|
83
|
+
return decideActuation(name, a, mode, approvalEnv) // write
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
if (OBSERVATION_TOOLS.has(name)) return { kind: 'allow' }
|
|
81
|
-
if (ACTUATION_TOOLS.has(name)) return decideActuation(name, a, mode)
|
|
87
|
+
if (ACTUATION_TOOLS.has(name)) return decideActuation(name, a, mode, approvalEnv)
|
|
82
88
|
return { kind: 'deny', reason: `unknown computer-use tool: ${name}` }
|
|
83
89
|
}
|
|
84
90
|
|
|
85
|
-
function decideActuation (name, a, mode) {
|
|
91
|
+
function decideActuation (name, a, mode, approvalEnv) {
|
|
86
92
|
let hr
|
|
87
93
|
try { hr = highRisk(name, a) } catch (error) { return { kind: 'deny', reason: error.message } }
|
|
88
94
|
const note = name === 'computer_launch' ? LAUNCH_HIGH_RISK_NOTE : HIGH_RISK_NOTE
|
|
@@ -90,10 +96,12 @@ function decideActuation (name, a, mode) {
|
|
|
90
96
|
case 'read-only':
|
|
91
97
|
return { kind: 'deny', reason: `automationMode=read-only: ${name} drives the machine` }
|
|
92
98
|
case 'standard':
|
|
93
|
-
return hr
|
|
94
|
-
|
|
99
|
+
return applyApprovalChannel(hr
|
|
100
|
+
? { kind: 'ask', reason: note + riskSuffix(name, a) }
|
|
101
|
+
: { kind: 'ask', reason: `automationMode=standard: actuation ${name}` }, approvalEnv, mode)
|
|
95
102
|
case 'autonomous':
|
|
96
|
-
return hr ? { kind: 'ask', reason: note + riskSuffix(name, a) }
|
|
103
|
+
return hr ? applyApprovalChannel({ kind: 'ask', reason: note + riskSuffix(name, a) }, approvalEnv, mode)
|
|
104
|
+
: { kind: 'allow' }
|
|
97
105
|
case 'unrestricted':
|
|
98
106
|
return { kind: 'allow' }
|
|
99
107
|
default:
|
|
@@ -101,6 +109,78 @@ function decideActuation (name, a, mode) {
|
|
|
101
109
|
}
|
|
102
110
|
}
|
|
103
111
|
|
|
112
|
+
/** The sentence every unanswerable refusal must carry, so nobody reads it as a human decision. */
|
|
113
|
+
export const NO_APPROVAL_CHANNEL = 'approval prompts are unavailable in this session (approval policy: never)'
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Settle one `ask` against the approval channel this session actually has.
|
|
117
|
+
*
|
|
118
|
+
* `ask` means "a human must decide". It is only meaningful when a human can be asked. The host
|
|
119
|
+
* approval service's `never` policy creates the exact opposite of an approval: it rejects at
|
|
120
|
+
* once, without a prompt, and the tool layer then reports `the user rejected tool "..."` — a
|
|
121
|
+
* decision the human never made (measured 2026-11-12 on `computer_key {combo:"backspace"}` in a
|
|
122
|
+
* `danger-full-access` session the user had explicitly granted).
|
|
123
|
+
*
|
|
124
|
+
* * prompts available → unchanged `ask`; the host owns the card and its audit pair.
|
|
125
|
+
* * prompts unavailable + full access + a mode that already runs unprompted actuation
|
|
126
|
+
* → `allow`. Full access IS the human's standing "do not ask
|
|
127
|
+
* me" grant, so suppressing a prompt that cannot be shown is
|
|
128
|
+
* not a widening: it is the grant the human already gave.
|
|
129
|
+
* * also unanswerable, but `standard`, or a delegated child session, or no proven full access
|
|
130
|
+
* → `deny` that says exactly which fact blocked it. Nothing
|
|
131
|
+
* ran, nobody was asked, and no refusal is attributed to the
|
|
132
|
+
* user.
|
|
133
|
+
*
|
|
134
|
+
* `standard` keeps failing closed on purpose: its whole contract is "every actuation is approved
|
|
135
|
+
* first", and full access is not an approval — it only means the prompt cannot be shown. Turning
|
|
136
|
+
* `standard` into `unrestricted` would silently delete the mode the user chose.
|
|
137
|
+
*
|
|
138
|
+
* A delegated child (`approvalEnv.delegated`) is never granted: `@deepseek-ai/dsh-subagent` pins
|
|
139
|
+
* `approval/policy = never` on every child and copies the parent's sandbox mode, so a full-access
|
|
140
|
+
* + never child is the *default shape* of a subagent, not evidence that the human authorized it.
|
|
141
|
+
*
|
|
142
|
+
* Unknown facts (`approvalEnv` absent, policy unknown, sandbox unknown) keep the original
|
|
143
|
+
* `ask`/deny: guessing full access is the one guess that must never be made here.
|
|
144
|
+
*
|
|
145
|
+
* @param {{kind: string, reason?: string}} decision the raw mode decision
|
|
146
|
+
* @param {{approvalPolicy?: string|null, sandbox?: string|null, promptsAvailable?: boolean,
|
|
147
|
+
* fullAccess?: boolean, delegated?: boolean}|null|undefined} approvalEnv
|
|
148
|
+
* @param {string} [mode] the automationMode that produced `decision`
|
|
149
|
+
* @returns {{kind: 'allow'|'deny'|'ask', reason?: string}}
|
|
150
|
+
*/
|
|
151
|
+
export function applyApprovalChannel (decision, approvalEnv, mode) {
|
|
152
|
+
if (!decision || decision.kind !== 'ask' || !approvalEnv || typeof approvalEnv !== 'object') return decision
|
|
153
|
+
const unanswerable = approvalEnv.approvalPolicy === 'never' || approvalEnv.promptsAvailable === false
|
|
154
|
+
if (!unanswerable) return decision
|
|
155
|
+
if (approvalEnv.delegated === true) {
|
|
156
|
+
return {
|
|
157
|
+
kind: 'deny',
|
|
158
|
+
reason: `${decision.reason}; ${NO_APPROVAL_CHANNEL} and this is a delegated subagent session, ` +
|
|
159
|
+
'whose approval policy the host pins to never — the human\'s full-access grant covers the ' +
|
|
160
|
+
'conversation that started it, not a child driving the machine on its own. Nothing ran, and the user was not asked',
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (approvalEnv.fullAccess !== true && approvalEnv.sandbox !== 'danger-full-access') {
|
|
164
|
+
return {
|
|
165
|
+
kind: 'deny',
|
|
166
|
+
reason: `${decision.reason}; ${NO_APPROVAL_CHANNEL} and this session is not full access — nothing ran, and the user was not asked`,
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (mode !== 'autonomous' && mode !== 'unrestricted') {
|
|
170
|
+
return {
|
|
171
|
+
kind: 'deny',
|
|
172
|
+
reason: `${decision.reason}; ${NO_APPROVAL_CHANNEL} and automationMode=${mode ?? 'unknown'} asks before ` +
|
|
173
|
+
'this actuation, so it cannot run unprompted — nothing ran, and the user was not asked. ' +
|
|
174
|
+
'Raise automationMode to autonomous (Settings → computer-use) if this session\'s full access should run it without a prompt',
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
kind: 'allow',
|
|
179
|
+
reason: `${decision.reason}; ${NO_APPROVAL_CHANNEL}, but this session has full access, so that required ` +
|
|
180
|
+
'approval is satisfied by the standing full-access grant — executed without a prompt',
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
104
184
|
/** Names the exact argument that escalated, so a refused batch names its offending step
|
|
105
185
|
* (test report 2026-11-04: "ctrl+a then delete" read as a generic high-risk refusal and the
|
|
106
186
|
* model had to guess which op tripped it). Empty string when there is nothing to add. */
|
package/lib/tools.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { runBatch, actionRefusal } from './batch.js'
|
|
19
19
|
import { saveOwnedShot } from './artifacts.js'
|
|
20
|
-
import { attachScreenshot, renderScreenshot, selectBatchScreenshot, screenshotMetadata } from './image-output.js'
|
|
20
|
+
import { attachScreenshot, renderScreenshot, selectBatchScreenshot, screenshotMetadata, screenshotPathOnly } from './image-output.js'
|
|
21
21
|
import { ObservationStore } from './observations.js'
|
|
22
22
|
import { feedbackPolicy, feedbackActions, feedbackVerification, selectFeedbackDetail } from './feedback.js'
|
|
23
23
|
import { collectCompactState, limitCompactFeedback, feedbackViewport } from './compact-feedback.js'
|
|
@@ -86,10 +86,7 @@ export function registerTools ({ ctx, cu, config, dataDir, log, snapshotPath, de
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// Shared by direct calls, explicit batch steps, and the batch checkpoint.
|
|
89
|
-
const
|
|
90
|
-
// Refuse a bad value BEFORE the capture: a refused request that already wrote a file and
|
|
91
|
-
// reports outcome:"not-dispatched" is a false receipt.
|
|
92
|
-
const delivery = deliveryMode(args.delivery)
|
|
89
|
+
const captureFile = async (args) => {
|
|
93
90
|
const r = rect(args.region)
|
|
94
91
|
const shot = await cu.screenshot({
|
|
95
92
|
x: r && r.x, y: r && r.y, width: r && r.width, height: r && r.height,
|
|
@@ -97,8 +94,12 @@ export function registerTools ({ ctx, cu, config, dataDir, log, snapshotPath, de
|
|
|
97
94
|
maxWidth: r && r.width <= 900 ? r.width : 1280,
|
|
98
95
|
})
|
|
99
96
|
const path = saveShot(shot.image, shot.mime === 'image/png' ? 'png' : 'jpg')
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
return { value: { path, mime: shot.mime, region: shot.region, ...screenshotMetadata(shot) }, bytes: shot.image }
|
|
98
|
+
}
|
|
99
|
+
const takeScreenshot = async (args, exec) => {
|
|
100
|
+
const delivery = deliveryMode(args.delivery)
|
|
101
|
+
const { value, bytes } = await captureFile(args)
|
|
102
|
+
return attachScreenshot(ctx, exec, value, bytes, { rules: config.feedbackRules, delivery })
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
const clickTarget = async (args) => {
|
|
@@ -766,9 +767,19 @@ export function registerTools ({ ctx, cu, config, dataDir, log, snapshotPath, de
|
|
|
766
767
|
let automatic, feedback, lastContext = {}
|
|
767
768
|
const detail = selectFeedbackDetail(args.feedback,
|
|
768
769
|
config.actionFeedback === false ? 'none' : config.actionFeedbackDetail ?? 'compact')
|
|
770
|
+
// Keep only the latest eligible frame's bytes until we know whether a checkpoint
|
|
771
|
+
// supersedes it. All completed explicit captures have their own local file.
|
|
772
|
+
let pendingFrame
|
|
773
|
+
const captureStep = async input => {
|
|
774
|
+
const stepDelivery = deliveryMode(input.delivery)
|
|
775
|
+
const frame = await captureFile(input)
|
|
776
|
+
const pathOnly = delivery === 'path' || stepDelivery === 'path'
|
|
777
|
+
pendingFrame = pathOnly ? undefined : frame
|
|
778
|
+
return screenshotPathOnly(frame.value, pathOnly ? 'delivery-path' : 'earlier-batch-image')
|
|
779
|
+
}
|
|
769
780
|
// Batch still observes once at its final checkpoint. Capture the actual
|
|
770
781
|
// result coordinates without re-resolving potentially stale mark ids.
|
|
771
|
-
const feedbackHandlers = Object.fromEntries(Object.entries(HANDLERS).map(([name, handler]) => [name,
|
|
782
|
+
const feedbackHandlers = Object.fromEntries(Object.entries({ ...HANDLERS, computer_shot: captureStep }).map(([name, handler]) => [name,
|
|
772
783
|
async (input, context) => {
|
|
773
784
|
const receipt = await handler(input, context)
|
|
774
785
|
lastContext = { args: input, receipt, tool: name }
|
|
@@ -791,7 +802,13 @@ export function registerTools ({ ctx, cu, config, dataDir, log, snapshotPath, de
|
|
|
791
802
|
if (!automatic) return null
|
|
792
803
|
return automatic.path
|
|
793
804
|
} })
|
|
794
|
-
|
|
805
|
+
const checkpoint = feedback?.observation ?? automatic
|
|
806
|
+
if (!checkpoint && pendingFrame) {
|
|
807
|
+
await attachScreenshot(ctx, exec, pendingFrame.value, pendingFrame.bytes, {
|
|
808
|
+
rules: config.feedbackRules, blocked: () => feedbackBlocked(exec),
|
|
809
|
+
})
|
|
810
|
+
}
|
|
811
|
+
return { ...selectBatchScreenshot(result, checkpoint, feedback?.feedback?.kind), ...feedback }
|
|
795
812
|
},
|
|
796
813
|
})
|
|
797
814
|
|
|
@@ -871,7 +888,6 @@ export function registerTools ({ ctx, cu, config, dataDir, log, snapshotPath, de
|
|
|
871
888
|
// The observation tools and the meta tool were missing from this map, so a batch could not
|
|
872
889
|
// take a screenshot: "unknown tool computer_shot" (reported 2026-09-12). The map must cover
|
|
873
890
|
// the WHOLE surface — a caller should never have to know which subset happens to be wired.
|
|
874
|
-
computer_shot: takeScreenshot,
|
|
875
891
|
computer_ocr: async (a) => {
|
|
876
892
|
let region
|
|
877
893
|
if (a.region) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-codex-style-computer-use",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Codex-style Computer Use for DeepSeek Harness: Windows desktop control, screenshots, UI Automation, human input handoff, approval gates and prebuilt native workers. Install and update from dsh-market without PowerShell 7 or build steps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -99,4 +99,4 @@
|
|
|
99
99
|
"url": "https://github.com/ltmroberthk915/dsh-computer-use/issues"
|
|
100
100
|
},
|
|
101
101
|
"icon": "./icon.svg"
|
|
102
|
-
}
|
|
102
|
+
}
|
|
@@ -31,7 +31,7 @@ const excluded = {
|
|
|
31
31
|
'test-approval-attention.mjs': 'alias imports test-attention.mjs, which is already run directly',
|
|
32
32
|
}
|
|
33
33
|
const reviewed = new Set([
|
|
34
|
-
'action-feedback', 'agent-pointer', 'approval-attribution', 'ask-invariants', 'ask-merge', 'ask-orphan', 'ask-release',
|
|
34
|
+
'action-feedback', 'agent-pointer', 'approval-attribution', 'approval-channel', 'ask-invariants', 'ask-merge', 'ask-orphan', 'ask-release',
|
|
35
35
|
'attention-native', 'attention', 'audit-completion', 'batch-coverage', 'buildusermessage', 'bundled-skill', 'client-export',
|
|
36
36
|
'coactive', 'compact-feedback', 'control-targets', 'core-system-recovery', 'cursor', 'cycle-completion',
|
|
37
37
|
'cycle-no-timeout', 'cycle-open', 'desktop-acceptance-io', 'desktop-ownership', 'drag-options', 'evidence-protocol',
|
|
@@ -48,7 +48,7 @@ The plugin also has a deterministic backstop: after a non-desktop top-level tool
|
|
|
48
48
|
|
|
49
49
|
`computer_shot` returns a native image on routes declaring image input. `imageStatus:"attached"`: follow `view` and inspect it directly — no extra read_image. `imageStatus:"path-only"`: follow `view`; the path is not visual evidence. A text-only route needs UIA/text or an image-capable model, and `settled:false` needs a fresh capture. A batch attaches only its latest image and labels its step; an earlier image does not verify later actions. `computer_marks {shot:true}` returns an annotated path whose ids match the text map.
|
|
50
50
|
|
|
51
|
-
`delivery:"path"` on `computer_shot`/`computer_batch`
|
|
51
|
+
`delivery:"path"` on `computer_shot`/`computer_batch` saves the local files without creating image attachments. Set it once on the batch when verifying from UIA/OCR/window text. With default `auto`, only the selected frame can become an attachment; earlier files remain available. A later read_image still adds the pixels to the conversation.
|
|
52
52
|
|
|
53
53
|
Reuse `observation` from direct click/type/key/move/drag/scroll/select; do not call shot/read_image again without a reason. Image-capable routes (provider aliases included) get image feedback when the attachment channel exists, otherwise UIA/text with the reason in `feedback`. Image transport does not certify grounding — inspect `visionEvidence`. `feedbackRules` match provider/model/adapter version and expire; a current failed-grounding record selects text feedback (the GLM 5.3 record has a limited window) while explicit screenshots keep their image/path. If UIA is absent or truncated, narrow or report the gap. `actionFeedback:false` restores manual feedback.
|
|
54
54
|
|
|
@@ -131,4 +131,4 @@ The plugin's own window is refused by default: the host holds the human's approv
|
|
|
131
131
|
1. this conversation is 完全权限 (`danger-full-access`); and
|
|
132
132
|
2. debug mode is switched on in 设置 → 电脑操控(调试).
|
|
133
133
|
|
|
134
|
-
Neither gate can be opened from a tool call — do not try: the switch lives host-side and the permission is the composer pill. When a refusal happens the human gets one notice card (at most once per 10 minutes) naming both gates. With both open, driving the Harness window is allowed and every action is audited as `HOST-CONTROL`; `close`, `minimize` and `hide` of the Harness remain refused even then, and observation never needs the gates. A worker launched without host identity (CLI, MCP) also refuses those three on a Harness window unless the caller passes `confirmHost:true`.
|
|
134
|
+
Neither gate can be opened from a tool call — do not try: the switch lives host-side and the permission is the composer pill. When a refusal happens the human gets one notice card (at most once per 10 minutes) naming both gates. With both open, driving the Harness window is allowed and every action is audited as `HOST-CONTROL`; `close`, `minimize` and `hide` of the Harness remain refused even then, and observation never needs the gates. A worker launched without host identity (CLI, MCP) also refuses those three on a Harness window unless the caller passes `confirmHost:true`.
|