dsh-windows-parallel-mcp 0.5.0 → 0.7.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.
- package/CHANGELOG.de.md +13 -1
- package/CHANGELOG.es.md +13 -1
- package/CHANGELOG.fr.md +13 -1
- package/CHANGELOG.it.md +13 -1
- package/CHANGELOG.ja.md +12 -0
- package/CHANGELOG.ko.md +12 -0
- package/CHANGELOG.md +181 -3
- package/CHANGELOG.pt.md +13 -1
- package/CHANGELOG.ru.md +13 -1
- package/CHANGELOG.zh.md +12 -0
- package/README.de.md +218 -7
- package/README.es.md +218 -7
- package/README.fr.md +218 -7
- package/README.it.md +218 -7
- package/README.ja.md +218 -7
- package/README.ko.md +218 -7
- package/README.md +218 -7
- package/README.pt.md +218 -7
- package/README.ru.md +218 -7
- package/README.zh.md +218 -7
- package/docs/refusals.md +3 -0
- package/dsh.plugin.json +2 -2
- package/lib/audit.js +109 -0
- package/lib/config.js +55 -2
- package/lib/host-tools.js +76 -3
- package/lib/index.js +333 -18
- package/lib/policy.js +127 -0
- package/package.json +2 -2
- package/src/engine/decide.ps1 +120 -3
- package/src/engine/engine.ps1 +407 -5
- package/src/engine/win.ps1 +496 -6
- package/src/engine/worker.ps1 +57 -0
- package/src/schema/tools.json +156 -13
- package/types/index.d.ts +63 -4
package/docs/refusals.md
CHANGED
|
@@ -50,6 +50,9 @@ R2′ 把「拒绝」当成本产品的**正常结果**(`engine.ps1` 首段注
|
|
|
50
50
|
| `stale_ref` | `engine.ps1`(`space:"image"` 的 `shotId` 不在本进程的截图表里;`label`+`snapId` 不是最新帧;宿主侧 `lib/index.js` 对 `space:"image"` 缺 `shotId` 做前置拒绝) | **引用过期**:这次调用指的是引擎上一代产物(一张已被保留策略删掉的截图,或一帧已被新快照取代的编号表)。编号只在印出它的那一帧里有意义 | 重新 `snapshot` / `screenshot` 拿新 id 再动作。**不要**把图像像素当屏幕像素直接用——那正是本码要挡的「看起来对」的位置错误 | **REAL** — `test/refusals-test.ps1` 执行 `click-stale-shot`:未发过的 `shotId` ⇒ 该码且不进探测 |
|
|
51
51
|
| `restore_failed` | `engine.ps1`(表判 restore、OS 拒绝 SetForegroundWindow) | 所有者被留在了一个不是他选的窗口里 | 立刻上报;不要静默重试,也不要启动看门狗抢第三次 | **NOT-COVERED** — 需提权窗配合,属 task_52 |
|
|
52
52
|
| `takeover_aborted` | `engine.ps1`(HUD 按钮/中断键/宿主取消,三路汇聚后置位) | 接管被**人**或**宿主**中止了。这不是故障,是 R3 承诺的能力:结果里仍带 `cursorRestored` 与 `injectedChars`,让读者知道做到哪一步 | 读 `injectedChars` 判断已写入多少;要接着做就**重新发起**一次动作(不会从断点续写)。不要把它当成失败来重试 | **REAL** — `test/takeover-test.ps1` 三臂(volatile 标志/latch 文件/长文本中途中断),每臂都断言光标回位 |
|
|
53
|
+
| `app_launch_denied` | `lib/index.js`(前 worker 闸)、`decide.ps1`(引擎侧二道) | `launch` 未被授权:`appLaunchAllowed` 关着,或程序名不在 `appLaunchAllow` 精确白名单里(空名单 = 即使开关开着也什么都不能启动) | 这是**所有者的决定**,不是可重试的临时失败:由所有者把精确名称或绝对 exe 路径加入白名单。不存在通配符与前缀匹配;宿主侧拒绝时**零 worker 请求**,因此没有任何进程被启动 | **REAL** — `launch-gate-off`(闸门关)与 `launch-not-whitelisted`(`calc` 不在 `[write-only-probe, notepad]` 里)两臂均跑引擎且断言无 pid |
|
|
54
|
+
| `policy_denied` | `lib/index.js`(前 worker 闸)、`decide.ps1`(引擎侧二道) | 这个动作声明的最低档(`tools.json#requiresTier`)高于 `policy` 设置允许的天花板。十一个动作对一个旋钮:新增能力不需要新增开关 | 唯一正确的下一步是**改设置**(readonly < quiet < balanced < full),而不是重试同一个调用;结果里已写出需要哪一档、当前允许到哪一档。拒绝时零 worker 请求、不弹 HUD | **REAL** — `policy-ceiling-readonly`(readonly 天花板 + quiet 需求)与 `policy-ceiling-takeover`(两个 launch 开关都满足、仍因天花板不足被拒 ⇒ 证明两条轴真的正交)|
|
|
55
|
+
| `user_active` | `decide.ps1`(仅对需要 takeover 档的动作) | 主人**正在用电脑**:`GetLastInputInfo` 测到的间隔小于 `policyIdleMs`(默认 3000ms)。与上游 Windows-MCP 的有意差异:上游即使你在用也会弹一个 10 秒倒计时对话框;我们不弹——弹框本身就是第二次打扰,而不是同意 | 等空闲后重试(或先 `action=status` 看 `lastHumanInputAgeMs`);确实需要在有人时用,就显式传 `forceUserActive:true`,它会进审计日志并标 `forced` | **REAL** — `test/refusals-test.ps1` 的 `user-active-takeover`(决策表:age=100 / idle=3000);引擎侧实测见 `test/takeover-test.ps1`(长文本中途中断臂) |
|
|
53
56
|
|
|
54
57
|
## 三个诚实的缺口(写在文档里,而不是留白)
|
|
55
58
|
|
package/dsh.plugin.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-windows-parallel-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
|
-
"description": "One tool,
|
|
5
|
+
"description": "One tool, eleven actions: drive a Windows window quietly by default, read the target as a numbered element frame, and since 0.7.0 start a whitelisted program, touch the clipboard, and change one named window. Prefers window messages (zero foreground change); falls back to UI Automation with a bounded, self-reversing focus flash (measured net return 15-95 ms); offers an opt-in takeover tier (policy:'full' AND takeoverAllowed) where the cursor moves to the action point and is always restored, with a mandatory three-phase HUD and three interruption paths; adds snapshot/screenshot/preview, where labels address the UIA element itself and image coordinates are converted by the engine; reads a write back (effect=readback-verified only when the field's own value matches a prediction built from the control's measurements) with caretPosition, disabled/focus reporting and a BitBlt capture path named as captureBackend; and gates everything through one ceiling (policy) plus a per-program launch whitelist, an idle check that refuses instead of interrupting, and an append-only JSONL audit log.",
|
|
6
6
|
"engines": {
|
|
7
7
|
"dsh": ">=0.1.7-0 <0.3.0-0"
|
|
8
8
|
},
|
package/lib/audit.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// audit.js -- one JSONL line per action, appended to %LOCALAPPDATA%\wpm\audit.log.
|
|
2
|
+
//
|
|
3
|
+
// WHY THIS EXISTS AT ALL. Every other field in this product answers "what did the caller get back".
|
|
4
|
+
// None of them answers the question that is asked AFTER something went wrong, at 3 a.m., by someone who
|
|
5
|
+
// needs to know what the agent did to this machine and when: `policy_denied` is visible to the caller
|
|
6
|
+
// and gone a second later. This file is the only artifact that survives the call, and per the plan it is
|
|
7
|
+
// written for ALLOW as well as DENY -- an audit trail that only records refusals documents the times the
|
|
8
|
+
// guard worked and is silent about the times it didn't have to.
|
|
9
|
+
//
|
|
10
|
+
// WHAT IS DELIBERATELY NOT HERE, because an audit log is a copy of what it records:
|
|
11
|
+
// * clipboard CONTENT -- op, format and character count only (R8: the clipboard may hold a token);
|
|
12
|
+
// * typed text -- its LENGTH, never its value, for the same reason;
|
|
13
|
+
// * anything else that is content rather than a decision.
|
|
14
|
+
// The line is a decision record: who asked, what was permitted, what tier it cost, what the engine
|
|
15
|
+
// reported. That is enough to reconstruct an incident and not enough to leak one.
|
|
16
|
+
//
|
|
17
|
+
// BEST-EFFORT WRITE, VISIBLE FAILURE. An audit that can throw would turn a successful action into a
|
|
18
|
+
// failed one -- so failures are counted and reported in the result text (`auditNote=...`) rather than
|
|
19
|
+
// raised. Silently swallowing a broken audit is the exact opposite of what this file is for.
|
|
20
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
21
|
+
import { dirname, join } from 'node:path';
|
|
22
|
+
import { homedir, tmpdir } from 'node:os';
|
|
23
|
+
|
|
24
|
+
/** The same base the engine uses (win.ps1 Get-WpmDataDir) -- one directory to open when reviewing. */
|
|
25
|
+
export function auditDir() {
|
|
26
|
+
const base = process.env.LOCALAPPDATA || join(homedir() || tmpdir(), 'AppData', 'Local');
|
|
27
|
+
return join(base, 'wpm');
|
|
28
|
+
}
|
|
29
|
+
export function auditPath() { return join(auditDir(), 'audit.log'); }
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Build the line. Kept separate from the write so a test can assert the SHAPE without touching the disk,
|
|
33
|
+
* and so the "never content" rule is one function deep rather than a habit.
|
|
34
|
+
* @param {{ts?:number, action:string, hwnd?:string, tier?:string, policy?:string,
|
|
35
|
+
* decision:string, code?:string, userActiveAgeMs?:number, effect?:string, latencyMs?:number,
|
|
36
|
+
* detail?:string, target?:string, args?:string, op?:string, format?:string, chars?:number,
|
|
37
|
+
* resultChars?:number, forced?:boolean}} rec
|
|
38
|
+
* @returns {string} one JSON object, no newline
|
|
39
|
+
*/
|
|
40
|
+
export function auditLine(rec) {
|
|
41
|
+
// Built as an open record because the shape is CONDITIONAL by design: a launch line carries target and
|
|
42
|
+
// arguments, a clipboard line carries op/format/length, and an ordinary action carries neither. A
|
|
43
|
+
// closed literal would force every line to carry every field (and so to record a clipboard `text` it is
|
|
44
|
+
// not allowed to record) or force a cast per branch -- which is exactly how a "not here"
|
|
45
|
+
// privacy rule becomes a "here, because the type said so" leak.
|
|
46
|
+
/** @type {Record<string, any>} */
|
|
47
|
+
const out = {
|
|
48
|
+
ts: rec.ts ?? Date.now(),
|
|
49
|
+
action: String(rec.action ?? ''),
|
|
50
|
+
hwnd: String(rec.hwnd ?? ''),
|
|
51
|
+
tier: String(rec.tier ?? ''),
|
|
52
|
+
policy: String(rec.policy ?? ''),
|
|
53
|
+
// decision is one of 'allow' | 'deny'. `code` is the refusal code when it is a deny, empty when it
|
|
54
|
+
// is an allow -- and it is recorded for BOTH so a reader can sort by outcome instead of guessing
|
|
55
|
+
// from a missing field.
|
|
56
|
+
decision: rec.decision === 'deny' ? 'deny' : 'allow',
|
|
57
|
+
code: String(rec.code ?? ''),
|
|
58
|
+
userActiveAgeMs: Number.isFinite(rec.userActiveAgeMs) ? rec.userActiveAgeMs : -1,
|
|
59
|
+
effect: String(rec.effect ?? ''),
|
|
60
|
+
latencyMs: Number.isFinite(rec.latencyMs) ? rec.latencyMs : -1,
|
|
61
|
+
};
|
|
62
|
+
if (rec.target !== undefined) out.target = String(rec.target);
|
|
63
|
+
if (rec.args !== undefined) out.args = String(rec.args);
|
|
64
|
+
if (rec.op !== undefined) out.op = String(rec.op);
|
|
65
|
+
if (rec.format !== undefined) out.format = String(rec.format);
|
|
66
|
+
// Length, never payload. The field name says which, so a reader of the log cannot mistake `chars`
|
|
67
|
+
// for content and neither can a reviewer of this line.
|
|
68
|
+
if (rec.chars !== undefined) out.chars = Number(rec.chars);
|
|
69
|
+
if (rec.forced === true) out.forced = true;
|
|
70
|
+
if (rec.detail) out.detail = String(rec.detail);
|
|
71
|
+
return JSON.stringify(out);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Append one decision, then keep the file bounded. The prune rewrites the file (read last N lines,
|
|
76
|
+
* write, swap), which is the same newest-first discipline the screenshot retention uses -- a log that
|
|
77
|
+
* grows without bound is a disk problem that arrives at the worst possible moment, and a truncation that
|
|
78
|
+
* drops the NEWEST lines instead of the oldest is a cover-up.
|
|
79
|
+
* @param {string} line @param {{keep?:number}} [opts]
|
|
80
|
+
* @returns {{ok:boolean, wrote:boolean, error?:string}}
|
|
81
|
+
*/
|
|
82
|
+
export function auditWrite(line, opts = {}) {
|
|
83
|
+
const keep = Math.max(1, Math.min(200000, opts.keep ?? 2000));
|
|
84
|
+
try {
|
|
85
|
+
const path = auditPath();
|
|
86
|
+
if (!existsSync(dirname(path))) mkdirSync(dirname(path), { recursive: true });
|
|
87
|
+
appendFileSync(path, line + '\n', 'utf8');
|
|
88
|
+
// Prune only when the file is plausibly over budget: a line count on every action would read the
|
|
89
|
+
// whole log each time, and an audit must never become the slow part of a click.
|
|
90
|
+
let lines = 0;
|
|
91
|
+
try {
|
|
92
|
+
const buf = readFileSync(path, 'utf8');
|
|
93
|
+
lines = buf.split('\n').filter((l) => l !== '').length;
|
|
94
|
+
} catch { lines = 0; }
|
|
95
|
+
if (lines > keep * 1.25 || lines > keep + 500) {
|
|
96
|
+
const tail = readFileSync(path, 'utf8').split('\n').filter((l) => l !== '').slice(-keep);
|
|
97
|
+
const tmp = path + '.new';
|
|
98
|
+
writeFileSync(tmp, tail.join('\n') + '\n', 'utf8');
|
|
99
|
+
try { renameSync(tmp, path); } catch { }
|
|
100
|
+
}
|
|
101
|
+
return { ok: true, wrote: true };
|
|
102
|
+
} catch (err) {
|
|
103
|
+
// `catch` binds `unknown` under checkJs+strict, so the message is reached through a type test rather
|
|
104
|
+
// than a cast: an audit failure that itself threw on the way out would be a worse bug than the one it
|
|
105
|
+
// is meant to make visible.
|
|
106
|
+
const message = err && typeof err === 'object' && 'message' in err ? String(/** @type {{message?: string}} */ (err).message) : String(err);
|
|
107
|
+
return { ok: false, wrote: false, error: message };
|
|
108
|
+
}
|
|
109
|
+
}
|
package/lib/config.js
CHANGED
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
// from the bundle patch. That limitation is stated in the README rather than papered over.
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* One declarable setting. `type` is a closed string union rather than a string so the
|
|
24
|
+
* One declarable setting. `type` is a closed string union rather than a string so the four-way
|
|
25
25
|
* branch in both validators is checked as exhaustive by the reader, not just by the shim at runtime.
|
|
26
|
+
* `string[]` exists for one reason: `appLaunchAllow` is a whitelist, and a whitelist that has to be
|
|
27
|
+
* spelled inside a string is a whitelist that will be parsed differently by two readers.
|
|
26
28
|
* @typedef {object} ConfigField
|
|
27
29
|
* @property {string} key
|
|
28
|
-
* @property {'boolean'|'number'|'string'} type
|
|
30
|
+
* @property {'boolean'|'number'|'string'|'string[]'} type
|
|
29
31
|
* @property {any} default
|
|
30
32
|
* @property {number} [min]
|
|
31
33
|
* @property {number} [max]
|
|
@@ -82,6 +84,35 @@ const FIELDS = [
|
|
|
82
84
|
description: 'How many screenshot PNGs stay in %LOCALAPPDATA%\\wpm\\shots. Older files are deleted '
|
|
83
85
|
+ 'after each capture, so the directory cannot grow without bound; a shotId that was cleaned up '
|
|
84
86
|
+ 'is refused with stale_ref rather than reinterpreted.' },
|
|
87
|
+
// ---- 0.7.0 desktop actions. `launch` is the one action in this product that can run arbitrary code,
|
|
88
|
+
// so it gets its OWN gate rather than riding on takeoverAllowed, and it gets a whitelist rather than a
|
|
89
|
+
// denylist: a denylist is wrong the first time someone adds a program (spec 0.7.0-A). Both default to
|
|
90
|
+
// "nothing may launch", which means an upgrade cannot start spawning processes on its own, and the
|
|
91
|
+
// whitelist is matched EXACTLY (case-insensitive, no wildcards, no prefixes) because `notepad` matching
|
|
92
|
+
// `notepad-helper.exe` by prefix is the shape of a whitelist that authorises more than it says.
|
|
93
|
+
{ key: 'appLaunchAllowed', type: 'boolean', default: false, volatile: true,
|
|
94
|
+
description: 'Allow action=launch at all. Off by default; when off, a launch is refused with '
|
|
95
|
+
+ 'app_launch_denied before any worker request is made. This gate is independent of '
|
|
96
|
+
+ 'takeoverAllowed: being allowed to move a cursor is not being allowed to start a program.' },
|
|
97
|
+
{ key: 'appLaunchAllow', type: 'string[]', default: [], volatile: true,
|
|
98
|
+
description: 'The launch whitelist: exact program names or absolute exe paths, matched '
|
|
99
|
+
+ 'case-insensitively and in full. An EMPTY list means nothing may launch even when '
|
|
100
|
+
+ 'appLaunchAllowed is on -- the two switches are deliberately not one.' },
|
|
101
|
+
// ---- 0.7.0 authorization model. TWO AXES, deliberately not one enum per action: the action declares
|
|
102
|
+
// the minimum tier it can need (src/schema/tools.json#requiresTier), and this setting says how far the
|
|
103
|
+
// plugin may go. Eleven actions times one knob stays readable; eleven knobs would not.
|
|
104
|
+
{ key: 'policy', type: 'string', default: 'balanced', volatile: true,
|
|
105
|
+
description: 'How far an action may go without asking again: readonly (reads only -- snapshot, '
|
|
106
|
+
+ 'screenshot, preview, status, windows, clipboard read), quiet (adds click/type/focus through the '
|
|
107
|
+
+ 'message door), balanced (default: adds the bounded-flash tier, clipboard writes and window ops), '
|
|
108
|
+
+ 'full (adds takeover and launch). Anything above the level is refused with policy_denied, whose '
|
|
109
|
+
+ 'next step is to raise this setting -- not to retry. An unrecognizable value falls back to '
|
|
110
|
+
+ 'balanced, never to full.' },
|
|
111
|
+
{ key: 'policyIdleMs', type: 'number', default: 3000, min: 0, max: 60000, volatile: true,
|
|
112
|
+
description: 'Idle sensing: how recently a PHYSICAL input must have happened for the owner to count '
|
|
113
|
+
+ 'as "present". An action that needs the takeover tier while the owner is present is refused with '
|
|
114
|
+
+ 'user_active and NO dialog -- a popup that interrupts someone who is typing is not consent, it is '
|
|
115
|
+
+ 'a second disturbance. 0 disables the check. Measured input age already travels with status.' },
|
|
85
116
|
];
|
|
86
117
|
|
|
87
118
|
/** Defaults, for documentation and for tests that must not depend on a resolver. */
|
|
@@ -116,6 +147,27 @@ function validateWithShim(raw) {
|
|
|
116
147
|
} else {
|
|
117
148
|
value[field.key] = given;
|
|
118
149
|
}
|
|
150
|
+
} else if (field.type === 'string[]') {
|
|
151
|
+
// An array is validated element-wise, and a non-array is an ISSUE rather than a coercion: the
|
|
152
|
+
// bundle patch is YAML, and `appLaunchAllow: notepad` (a bare string) is the single most likely
|
|
153
|
+
// way someone will write a one-entry whitelist. Accepting it silently would make the setting work
|
|
154
|
+
// today and break the moment a second entry is added as a list.
|
|
155
|
+
if (!Array.isArray(given)) {
|
|
156
|
+
issues.push({ message: 'expected an array of strings', path: [field.key] });
|
|
157
|
+
} else if (given.some((x) => typeof x !== 'string')) {
|
|
158
|
+
issues.push({ message: 'expected every entry to be a string', path: [field.key] });
|
|
159
|
+
} else {
|
|
160
|
+
value[field.key] = given.map((x) => x.trim()).filter((x) => x !== '');
|
|
161
|
+
}
|
|
162
|
+
} else if (field.key === 'policy') {
|
|
163
|
+
// A closed set, checked where the settings are parsed rather than at the decision site: a policy
|
|
164
|
+
// that silently reads as an unknown level is the same class of bug as a level the table does not
|
|
165
|
+
// know how to compare.
|
|
166
|
+
if (!['readonly', 'quiet', 'balanced', 'full'].includes(given)) {
|
|
167
|
+
issues.push({ message: 'expected readonly|quiet|balanced|full', path: [field.key] });
|
|
168
|
+
} else {
|
|
169
|
+
value[field.key] = given;
|
|
170
|
+
}
|
|
119
171
|
} else if (typeof given !== 'string') {
|
|
120
172
|
issues.push({ message: `expected a string`, path: [field.key] });
|
|
121
173
|
} else {
|
|
@@ -161,6 +213,7 @@ export async function createConfigSchema() {
|
|
|
161
213
|
let s;
|
|
162
214
|
if (field.type === 'boolean') s = z.boolean();
|
|
163
215
|
else if (field.type === 'number') s = z.number();
|
|
216
|
+
else if (field.type === 'string[]') s = z.array(z.string());
|
|
164
217
|
else s = z.string();
|
|
165
218
|
if (field.min !== undefined || field.max !== undefined) {
|
|
166
219
|
if (typeof s.min === 'function' && field.min !== undefined) s = s.min(field.min);
|
package/lib/host-tools.js
CHANGED
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
// that the caller can branch on the code and read the next step.
|
|
19
19
|
export const TOOL_NAME = 'wpm';
|
|
20
20
|
|
|
21
|
-
/** The
|
|
22
|
-
export const ACTIONS = ['windows', 'click', 'type', 'focus', 'status', 'snapshot', 'screenshot', 'preview'
|
|
21
|
+
/** The eleven actions, in the order the contract lists them. */
|
|
22
|
+
export const ACTIONS = ['windows', 'click', 'type', 'focus', 'status', 'snapshot', 'screenshot', 'preview',
|
|
23
|
+
'launch', 'clipboard', 'window'];
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* One field of the simplified parameter spec -- the shape the host's `defineTool` consumes and the
|
|
@@ -57,7 +58,12 @@ export const PARAMETERS = {
|
|
|
57
58
|
+ 'focus: move keyboard focus to a named control inside the target. '
|
|
58
59
|
+ 'snapshot: read the accessibility tree as a numbered element table (labels you can act on). '
|
|
59
60
|
+ 'screenshot: capture the target rect to a PNG and return its coordinate mapping as data. '
|
|
60
|
-
+ 'preview: draw the marker at a point and report the element under it, without clicking.'
|
|
61
|
+
+ 'preview: draw the marker at a point and report the element under it, without clicking. '
|
|
62
|
+
+ 'launch: start a program by name or path (needs appLaunchAllowed AND an exact whitelist entry; '
|
|
63
|
+
+ 'refused with app_launch_denied before any worker call otherwise). '
|
|
64
|
+
+ 'clipboard: read or write the system clipboard (read reports lengths, never contents). '
|
|
65
|
+
+ 'window: minimize/restore/move/resize/topmost ONE window named by hwnd, verified by reading its '
|
|
66
|
+
+ 'real state back.',
|
|
61
67
|
},
|
|
62
68
|
hwnd: {
|
|
63
69
|
type: 'string',
|
|
@@ -73,6 +79,21 @@ export const PARAMETERS = {
|
|
|
73
79
|
+ 'because a window message cannot address "the control called X".',
|
|
74
80
|
},
|
|
75
81
|
replace: { type: 'boolean', description: 'Replace the existing value instead of appending (type only).' },
|
|
82
|
+
// ---- 0.6.0: where the caret goes, and what the engine reads back afterwards ------------------
|
|
83
|
+
// The description names the syscall because the parameter is a syscall argument, and it names the
|
|
84
|
+
// measured exception because '-1 means the end' is a documentation sentence that WinForms EDIT does
|
|
85
|
+
// not honour (findings 8.2). A caller reading this should be able to predict the result exactly.
|
|
86
|
+
caretPosition: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
enum: ['idle', 'start', 'end'],
|
|
89
|
+
description:
|
|
90
|
+
'type only, message door: where the caret sits before the characters are sent. "idle" (default) touches nothing -- ' +
|
|
91
|
+
'the caret is where the control left it, which for a never-focused field is position 0 (measured), so "idle" is not "start". ' +
|
|
92
|
+
'"start" is EM_SETSEL(0,0); "end" is EM_SETSEL(len,len) with len read from the control, because the documented -1 form is a no-op ' +
|
|
93
|
+
'on WinForms EDIT. On a buffer containing newlines the numeric end can land inside the text, so the result reports the requested ' +
|
|
94
|
+
'and the applied pair (caret=end asked=6 applied=4,4) and the readback decides. The UIA value channel replaces the whole value and ' +
|
|
95
|
+
'has no caret to move -- it answers caretIgnored=value-pattern instead of pretending it honoured this.',
|
|
96
|
+
},
|
|
76
97
|
settleMs: { type: 'number', description: 'How long to let the app commit its state before the effect is judged (0-2000, default 350).' },
|
|
77
98
|
// ---- R3. Every one of these costs the owner something real, so each description says so: a caller
|
|
78
99
|
// that asks for takeover has to know it moves the pointer and needs the HUD up.
|
|
@@ -154,6 +175,58 @@ export const PARAMETERS = {
|
|
|
154
175
|
type: 'number',
|
|
155
176
|
description: 'screenshot only: downscale the saved image to at most this width (0 = no scaling, default). Scaling changes the coordinate system, so it must be asked for explicitly and is reported as scale.',
|
|
156
177
|
},
|
|
178
|
+
// ---- 0.7.0 desktop actions -----------------------------------------------------------------
|
|
179
|
+
// Every description states the gate it falls under, because these three are the first actions whose
|
|
180
|
+
// refusal is about a SETTING rather than about the target, and a caller that cannot see which gate
|
|
181
|
+
// blocked it will retry forever.
|
|
182
|
+
target: {
|
|
183
|
+
type: 'string',
|
|
184
|
+
description:
|
|
185
|
+
'launch only: the program to start -- an exact name on the appLaunchAllow whitelist ("notepad") or an '
|
|
186
|
+
+ 'absolute exe path that appears in the list verbatim. Matched case-insensitively and IN FULL: '
|
|
187
|
+
+ '"notepad" does not authorise "notepad-helper.exe", and no wildcard exists. Refused with '
|
|
188
|
+
+ 'app_launch_denied when appLaunchAllowed is off or the name is not listed, before any worker request.',
|
|
189
|
+
},
|
|
190
|
+
args: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
description:
|
|
193
|
+
'launch only: one command line for the program, passed through as given. It is NOT parsed by the '
|
|
194
|
+
+ 'whitelist -- listing a program does not vouch for its arguments, which is why every launch is '
|
|
195
|
+
+ 'written to the audit log with its arguments attached.',
|
|
196
|
+
},
|
|
197
|
+
waitMs: {
|
|
198
|
+
type: 'number',
|
|
199
|
+
description: 'launch only: how long to wait for the started process to publish a top-level window (0-30000, default 3000). A window that has not appeared answers ok:true with hwnd="" and detail=window-not-yet -- the program DID start, and pretending otherwise would be a different lie.',
|
|
200
|
+
},
|
|
201
|
+
op: {
|
|
202
|
+
type: 'string',
|
|
203
|
+
enum: ['read', 'write', 'minimize', 'restore', 'move', 'resize', 'topmost'],
|
|
204
|
+
description:
|
|
205
|
+
'clipboard: "read" or "write". window: "minimize", "restore", "move", "resize", "topmost". Each op is ' +
|
|
206
|
+
'verified by reading the window back (IsIconic / the rect / the ex-style), not by the call\'s return ' +
|
|
207
|
+
'value, so a syscall that said yes while the window said no is reported as verified=false.',
|
|
208
|
+
},
|
|
209
|
+
format: {
|
|
210
|
+
type: 'string',
|
|
211
|
+
enum: ['text', 'image'],
|
|
212
|
+
description: 'clipboard only (default text). "image" read returns a PNG under %LOCALAPPDATA%\\wpm\\clipboard and reports its size; "image" write takes a shotId from action=screenshot. Text reads are capped at 64 KB and a longer payload says truncated.',
|
|
213
|
+
},
|
|
214
|
+
width: { type: 'number', description: 'window only: the width to resize to (resize). The result reports what the window actually became, which may be a clamp.' },
|
|
215
|
+
height: { type: 'number', description: 'window only: the height to resize to (resize).' },
|
|
216
|
+
// ---- 0.7.0 the escape hatch on the idle check ------------------------------------------------
|
|
217
|
+
// It exists because an unattended run is the case that MUST still work, and because a caller that is
|
|
218
|
+
// blocked with no way forward will simply look for a way around the plugin. Making the override an
|
|
219
|
+
// explicit argument rather than a hidden retry keeps it visible: it is written to the audit log with
|
|
220
|
+
// forced=true, so a run that typed over someone's keyboard is attributable afterwards.
|
|
221
|
+
forceUserActive: {
|
|
222
|
+
type: 'boolean',
|
|
223
|
+
description:
|
|
224
|
+
'Override the idle check (user_active) for THIS call: "start it even though the owner is at the keyboard". '
|
|
225
|
+
+ 'Has an effect only on actions that need the takeover tier (takeover:true, keyInput:"inject", launch). '
|
|
226
|
+
+ 'It does NOT bypass policy, takeoverAllowed, keyInjectAllowed or the launch whitelist, and the audit '
|
|
227
|
+
+ 'line records forced:true, so an interruption you caused on purpose stays distinguishable from one '
|
|
228
|
+
+ 'the plugin caused by accident.',
|
|
229
|
+
},
|
|
157
230
|
};
|
|
158
231
|
|
|
159
232
|
/**
|