@ai-agent-forge/plugin-desktop-windows-observe 0.88.1 → 0.88.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MANUAL.md +19 -0
- package/agent-forge.json +5 -1
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +65 -0
- package/dist/capability.js.map +1 -1
- package/dist/types.d.ts +39 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/windows-uia-adapter.d.ts +9 -2
- package/dist/windows-uia-adapter.d.ts.map +1 -1
- package/dist/windows-uia-adapter.js +170 -5
- package/dist/windows-uia-adapter.js.map +1 -1
- package/package.json +3 -2
- package/plugin.json +9 -1
package/MANUAL.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# desktop-windows-observe 能力手册(AI 用)
|
|
2
|
+
|
|
3
|
+
Windows 桌面观察:UIA(UI Automation)枚举窗口与控件树——窗口标题/几何、控件 role/name/value/坐标、焦点控件。只读,零输入。
|
|
4
|
+
|
|
5
|
+
## 工具速查
|
|
6
|
+
|
|
7
|
+
| 工具 | 用途 |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| desktop_probe | 探测驱动可用性(win32 + UIA) |
|
|
10
|
+
| desktop_session_open | 开观察会话(isolation: foreground = 当前真实桌面) |
|
|
11
|
+
| desktop_observe / desktop_reobserve | 全量/增量枚举窗口与控件(reobserve 更省) |
|
|
12
|
+
| desktop_session_stop | 关会话(幂等) |
|
|
13
|
+
|
|
14
|
+
## 使用要点
|
|
15
|
+
|
|
16
|
+
1. **observe→act→reobserve 闭环**:任何输入前先 observe 拿 controlId 与 bounds;输入后 reobserve 验证效果。不要凭记忆操作两次。
|
|
17
|
+
2. 控件定位用 controlId(`window-xxxx:automationId` 形态);Chrome/Edge 的 web 内容在 UIA 树里完整暴露(页面控件带 DOM id,如 `window-xxxx:inp-name`),**桌面通道可以元素级操作浏览器页面**。
|
|
18
|
+
3. 坐标是主屏物理像素(bounds 中心 = x + width/2)。
|
|
19
|
+
4. UIA 对 Chrome 的**原生文件对话框不可见**(模态窗口不进枚举)——操作对话框不要找控件,走 desktop-windows-input 的真实键盘流程。
|
package/agent-forge.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageFormatVersion": 1,
|
|
3
3
|
"id": "agent-forge.plugin.desktop-windows-observe",
|
|
4
|
-
"pluginVersion": "0.88.
|
|
4
|
+
"pluginVersion": "0.88.3",
|
|
5
5
|
"apiVersion": "1",
|
|
6
6
|
"minHostVersion": "0.84.4",
|
|
7
7
|
"capabilityRefs": [
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
{
|
|
13
13
|
"id": "desktop-uia",
|
|
14
14
|
"version": 1
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "desktop-vision",
|
|
18
|
+
"version": 1
|
|
15
19
|
}
|
|
16
20
|
],
|
|
17
21
|
"platform": {
|
package/dist/capability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAa3E,OAAO,KAAK,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAa3E,OAAO,KAAK,EAAE,wBAAwB,EAAsD,MAAM,YAAY,CAAC;AAE/G,wBAAgB,uCAAuC,CACtD,OAAO,EAAE,wBAAwB,GAC/B,2BAA2B,CAqL7B","sourcesContent":["/**\n * Read-only desktop observation capability factory, migrated from agent-forge\n * `src/profile/runtime-capabilities-desktop.ts` (`desktopFactory`, D-075 S3\n * extraction). Differences from the host original:\n * - The factory type is the public `CapabilityPluginSyncFactory` from the\n * plugin SDK instead of the host-internal `BuiltinCapabilityPlugin`.\n * - Projection helpers live in `projection.ts`, input helpers in `shared.ts`.\n * Tool names, parameters, budgets and result shapes are unchanged.\n */\nimport type { CapabilityPluginSyncFactory } from \"@agent-forge/plugin-sdk\";\nimport { Type } from \"typebox\";\nimport {\n\tDESKTOP_MAX_STRING_CHARS_V1,\n\tdesktopCapabilities,\n\tdesktopClampedString,\n\tdesktopFailure,\n\tdesktopObservationResult,\n\tdesktopResultWithinBudget,\n\tdesktopSessionResult,\n\tdesktopStopResult,\n} from \"./projection.ts\";\nimport { nonEmptyString, signalFrom, toolInvocation } from \"./shared.ts\";\nimport type { DesktopReadonlyAdapterV1, DesktopScreenshotResultV1, DesktopSessionRequestV1 } from \"./types.ts\";\n\nexport function createDesktopObserveCapabilityFactoryV1(\n\truntime: DesktopReadonlyAdapterV1,\n): CapabilityPluginSyncFactory {\n\treturn (api) => {\n\t\tconst invoke = <T>(\n\t\t\toperationId: string,\n\t\t\taction: () => T,\n\t\t\tproject: (value: T) => unknown,\n\t\t\tsignal?: AbortSignal,\n\t\t) => {\n\t\t\tif (signal?.aborted)\n\t\t\t\treturn Promise.resolve(desktopFailure(operationId, \"cancelled\", \"Desktop operation was cancelled\"));\n\t\t\ttry {\n\t\t\t\tconst value = project(action());\n\t\t\t\treturn Promise.resolve(\n\t\t\t\t\tsignal?.aborted ? desktopFailure(operationId, \"cancelled\", \"Desktop operation was cancelled\") : value,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\t// 透传原始诊断(dogfood 2026-09-25:无信息报错让一次观察失败的排障\n\t\t\t\t// 成本极高);code 仍是适配器/投影面失败。\n\t\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\t\treturn Promise.resolve(desktopFailure(operationId, \"desktop_adapter_failed\", detail));\n\t\t\t}\n\t\t};\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_probe\",\n\t\t\tlabel: \"Desktop probe\",\n\t\t\tdescription: \"Probe whether the selected Windows UI Automation adapter is available\",\n\t\t\tparameters: Type.Object({}),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { operationId } = toolInvocation(first, second);\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.probe(),\n\t\t\t\t\t(probe) => {\n\t\t\t\t\t\tconst capabilities = desktopCapabilities(probe.capabilities);\n\t\t\t\t\t\treturn desktopResultWithinBudget({\n\t\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\t\toperationId,\n\t\t\t\t\t\t\tstatus: probe.available ? (\"succeeded\" as const) : (\"unsupported\" as const),\n\t\t\t\t\t\t\tprobe: {\n\t\t\t\t\t\t\t\tavailable: probe.available,\n\t\t\t\t\t\t\t\tplatform: desktopClampedString(probe.platform, \"platform\"),\n\t\t\t\t\t\t\t\tdriver: \"windows-uia\" as const,\n\t\t\t\t\t\t\t\t...(capabilities === undefined ? {} : { capabilities }),\n\t\t\t\t\t\t\t\t...(probe.reason === undefined ? {} : { reason: desktopClampedString(probe.reason, \"reason\") }),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_screenshot\",\n\t\t\tlabel: \"Screenshot desktop\",\n\t\t\tdescription: \"Capture a scaled PNG screenshot of the primary Windows display and return it inline\",\n\t\t\tparameters: Type.Object({}),\n\t\t\t// Inline image results never fit the 64KB JSON projection budget; the host\n\t\t\t// passes content arrays through untouched, so every branch below returns\n\t\t\t// the same content-array envelope instead of a projected JSON object.\n\t\t\treadonlySafe: true,\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { operationId } = toolInvocation(first, second);\n\t\t\t\tconst signal = signalFrom(third);\n\t\t\t\tconst textResult = (payload: Record<string, unknown>) => ({\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: JSON.stringify({ operationId, ...payload }) }],\n\t\t\t\t});\n\t\t\t\tconst cancelledResult = () =>\n\t\t\t\t\ttextResult({\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\tstatus: \"cancelled\",\n\t\t\t\t\t\tsummary: \"Desktop operation was cancelled\",\n\t\t\t\t\t\terror: { version: 1, code: \"cancelled\", message: \"Desktop operation was cancelled\" },\n\t\t\t\t\t});\n\t\t\t\tif (signal?.aborted) return cancelledResult();\n\t\t\t\tlet result: DesktopScreenshotResultV1;\n\t\t\t\ttry {\n\t\t\t\t\tresult = runtime.screenshot();\n\t\t\t\t} catch (caught) {\n\t\t\t\t\t// Same diagnostics posture as invoke(): code stays an adapter-surface\n\t\t\t\t\t// failure, the message carries the original detail.\n\t\t\t\t\tconst detail = caught instanceof Error ? caught.message : String(caught);\n\t\t\t\t\treturn textResult({\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\tsource: \"windows-gdi\",\n\t\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\t\terror: { version: 1, code: \"desktop_adapter_failed\", message: detail },\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (signal?.aborted) return cancelledResult();\n\t\t\t\tif (result.status !== \"succeeded\" || result.data === undefined)\n\t\t\t\t\treturn textResult({\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\tsource: \"windows-gdi\",\n\t\t\t\t\t\tstatus: result.status,\n\t\t\t\t\t\t...(result.error === undefined ? {} : { error: result.error }),\n\t\t\t\t\t});\n\t\t\t\tconst summary = {\n\t\t\t\t\tversion: 1 as const,\n\t\t\t\t\tsource: \"windows-gdi\" as const,\n\t\t\t\t\twidth: result.width ?? 0,\n\t\t\t\t\theight: result.height ?? 0,\n\t\t\t\t\toriginalWidth: result.originalWidth ?? 0,\n\t\t\t\t\toriginalHeight: result.originalHeight ?? 0,\n\t\t\t\t\tscale: result.scale ?? 1,\n\t\t\t\t\t...(result.capturedAt === undefined ? {} : { capturedAt: result.capturedAt }),\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"image\", data: result.data, mimeType: \"image/png\" },\n\t\t\t\t\t\t{ type: \"text\", text: JSON.stringify(summary) },\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t},\n\t\t});\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_session_open\",\n\t\t\tlabel: \"Open desktop session\",\n\t\t\tdescription: \"Open a foreground or VM-scoped read-only Windows desktop session\",\n\t\t\tparameters: Type.Object({\n\t\t\t\tisolation: Type.Union([Type.Literal(\"foreground\"), Type.Literal(\"vm\")]),\n\t\t\t\tapplicationId: Type.Optional(Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 })),\n\t\t\t}),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\tif (input.isolation !== \"foreground\" && input.isolation !== \"vm\")\n\t\t\t\t\tthrow new Error(\"isolation must be foreground or vm\");\n\t\t\t\tconst request: DesktopSessionRequestV1 = {\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tisolation: input.isolation,\n\t\t\t\t\t...(input.applicationId === undefined\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { applicationId: nonEmptyString(input.applicationId, \"applicationId\") }),\n\t\t\t\t};\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.openSession(request),\n\t\t\t\t\t(value) => desktopSessionResult(value, operationId),\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t\tfor (const [name, action] of [\n\t\t\t[\"desktop_observe\", \"observe\"],\n\t\t\t[\"desktop_reobserve\", \"reobserve\"],\n\t\t] as const) {\n\t\t\tapi.registerTool({\n\t\t\t\tname,\n\t\t\t\tlabel: name === \"desktop_observe\" ? \"Observe desktop\" : \"Re-observe desktop\",\n\t\t\t\tdescription: \"Return a bounded Windows UI Automation observation for an existing session\",\n\t\t\t\tparameters: Type.Object({\n\t\t\t\t\tsessionId: Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 }),\n\t\t\t\t}),\n\t\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\t\tconst sessionId = nonEmptyString(input.sessionId, \"sessionId\");\n\t\t\t\t\treturn invoke(\n\t\t\t\t\t\toperationId,\n\t\t\t\t\t\t() => runtime[action](sessionId),\n\t\t\t\t\t\t(value) => desktopObservationResult(value, operationId),\n\t\t\t\t\t\tsignalFrom(third),\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_session_stop\",\n\t\t\tlabel: \"Stop desktop session\",\n\t\t\tdescription: \"Stop an existing read-only desktop session\",\n\t\t\tparameters: Type.Object({ sessionId: Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 }) }),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\tconst sessionId = nonEmptyString(input.sessionId, \"sessionId\");\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.stop(sessionId),\n\t\t\t\t\t(value) => desktopStopResult(value, operationId),\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t};\n}\n"]}
|
package/dist/capability.js
CHANGED
|
@@ -41,6 +41,71 @@ export function createDesktopObserveCapabilityFactoryV1(runtime) {
|
|
|
41
41
|
}, signalFrom(third));
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
|
+
api.registerTool({
|
|
45
|
+
name: "desktop_screenshot",
|
|
46
|
+
label: "Screenshot desktop",
|
|
47
|
+
description: "Capture a scaled PNG screenshot of the primary Windows display and return it inline",
|
|
48
|
+
parameters: Type.Object({}),
|
|
49
|
+
// Inline image results never fit the 64KB JSON projection budget; the host
|
|
50
|
+
// passes content arrays through untouched, so every branch below returns
|
|
51
|
+
// the same content-array envelope instead of a projected JSON object.
|
|
52
|
+
readonlySafe: true,
|
|
53
|
+
execute: async (first, second, third) => {
|
|
54
|
+
const { operationId } = toolInvocation(first, second);
|
|
55
|
+
const signal = signalFrom(third);
|
|
56
|
+
const textResult = (payload) => ({
|
|
57
|
+
content: [{ type: "text", text: JSON.stringify({ operationId, ...payload }) }],
|
|
58
|
+
});
|
|
59
|
+
const cancelledResult = () => textResult({
|
|
60
|
+
version: 1,
|
|
61
|
+
status: "cancelled",
|
|
62
|
+
summary: "Desktop operation was cancelled",
|
|
63
|
+
error: { version: 1, code: "cancelled", message: "Desktop operation was cancelled" },
|
|
64
|
+
});
|
|
65
|
+
if (signal?.aborted)
|
|
66
|
+
return cancelledResult();
|
|
67
|
+
let result;
|
|
68
|
+
try {
|
|
69
|
+
result = runtime.screenshot();
|
|
70
|
+
}
|
|
71
|
+
catch (caught) {
|
|
72
|
+
// Same diagnostics posture as invoke(): code stays an adapter-surface
|
|
73
|
+
// failure, the message carries the original detail.
|
|
74
|
+
const detail = caught instanceof Error ? caught.message : String(caught);
|
|
75
|
+
return textResult({
|
|
76
|
+
version: 1,
|
|
77
|
+
source: "windows-gdi",
|
|
78
|
+
status: "failed",
|
|
79
|
+
error: { version: 1, code: "desktop_adapter_failed", message: detail },
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (signal?.aborted)
|
|
83
|
+
return cancelledResult();
|
|
84
|
+
if (result.status !== "succeeded" || result.data === undefined)
|
|
85
|
+
return textResult({
|
|
86
|
+
version: 1,
|
|
87
|
+
source: "windows-gdi",
|
|
88
|
+
status: result.status,
|
|
89
|
+
...(result.error === undefined ? {} : { error: result.error }),
|
|
90
|
+
});
|
|
91
|
+
const summary = {
|
|
92
|
+
version: 1,
|
|
93
|
+
source: "windows-gdi",
|
|
94
|
+
width: result.width ?? 0,
|
|
95
|
+
height: result.height ?? 0,
|
|
96
|
+
originalWidth: result.originalWidth ?? 0,
|
|
97
|
+
originalHeight: result.originalHeight ?? 0,
|
|
98
|
+
scale: result.scale ?? 1,
|
|
99
|
+
...(result.capturedAt === undefined ? {} : { capturedAt: result.capturedAt }),
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
content: [
|
|
103
|
+
{ type: "image", data: result.data, mimeType: "image/png" },
|
|
104
|
+
{ type: "text", text: JSON.stringify(summary) },
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
});
|
|
44
109
|
api.registerTool({
|
|
45
110
|
name: "desktop_session_open",
|
|
46
111
|
label: "Open desktop session",
|
package/dist/capability.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.js","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EACN,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGzE,MAAM,UAAU,uCAAuC,CACtD,OAAiC,EACH;IAC9B,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,CACd,WAAmB,EACnB,MAAe,EACf,OAA8B,EAC9B,MAAoB,EACnB,EAAE,CAAC;YACJ,IAAI,MAAM,EAAE,OAAO;gBAClB,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,iCAAiC,CAAC,CAAC,CAAC;YACrG,IAAI,CAAC;gBACJ,MAAM,KA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E,WAAW,CAAC,CAAC;oBAC/D,OAAO,MAAM,CACZ,WAAW,EACX,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAChC,CAAC,KAAK,EAAE,EAAE,CAAC,wBAAwB,CAAC,KAAK,EAAE,WAAW,CAAC,EACvD,UAAU,CAAC,KAAK,CAAC,CACjB,CAAC;gBAAA,CACF;aACD,CAAC,CAAC;QACJ,CAAC;QACD,GAAG,CAAC,YAAY,CAAC;YAChB,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,4CAA4C;YACzD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,2BAA2B,EAAE,CAAC,EAAE,CAAC;YAC7G,OAAO,EAAE,KAAK,EAAE,KAAc,EAAE,MAAgB,EAAE,KAAe,EAAE,EAAE,CAAC;gBACrE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC7D,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;gBAC/D,OAAO,MAAM,CACZ,WAAW,EACX,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAC7B,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,EAChD,UAAU,CAAC,KAAK,CAAC,CACjB,CAAC;YAAA,CACF;SACD,CAAC,CAAC;IAAA,CACH,CAAC;AAAA,CACF","sourcesContent":["/**\n * Read-only desktop observation capability factory, migrated from agent-forge\n * `src/profile/runtime-capabilities-desktop.ts` (`desktopFactory`, D-075 S3\n * extraction). Differences from the host original:\n * - The factory type is the public `CapabilityPluginSyncFactory` from the\n * plugin SDK instead of the host-internal `BuiltinCapabilityPlugin`.\n * - Projection helpers live in `projection.ts`, input helpers in `shared.ts`.\n * Tool names, parameters, budgets and result shapes are unchanged.\n */\nimport type { CapabilityPluginSyncFactory } from \"@agent-forge/plugin-sdk\";\nimport { Type } from \"typebox\";\nimport {\n\tDESKTOP_MAX_STRING_CHARS_V1,\n\tdesktopCapabilities,\n\tdesktopClampedString,\n\tdesktopFailure,\n\tdesktopObservationResult,\n\tdesktopResultWithinBudget,\n\tdesktopSessionResult,\n\tdesktopStopResult,\n} from \"./projection.ts\";\nimport { nonEmptyString, signalFrom, toolInvocation } from \"./shared.ts\";\nimport type { DesktopReadonlyAdapterV1, DesktopSessionRequestV1 } from \"./types.ts\";\n\nexport function createDesktopObserveCapabilityFactoryV1(\n\truntime: DesktopReadonlyAdapterV1,\n): CapabilityPluginSyncFactory {\n\treturn (api) => {\n\t\tconst invoke = <T>(\n\t\t\toperationId: string,\n\t\t\taction: () => T,\n\t\t\tproject: (value: T) => unknown,\n\t\t\tsignal?: AbortSignal,\n\t\t) => {\n\t\t\tif (signal?.aborted)\n\t\t\t\treturn Promise.resolve(desktopFailure(operationId, \"cancelled\", \"Desktop operation was cancelled\"));\n\t\t\ttry {\n\t\t\t\tconst value = project(action());\n\t\t\t\treturn Promise.resolve(\n\t\t\t\t\tsignal?.aborted ? desktopFailure(operationId, \"cancelled\", \"Desktop operation was cancelled\") : value,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\t// 透传原始诊断(dogfood 2026-09-25:无信息报错让一次观察失败的排障\n\t\t\t\t// 成本极高);code 仍是适配器/投影面失败。\n\t\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\t\treturn Promise.resolve(desktopFailure(operationId, \"desktop_adapter_failed\", detail));\n\t\t\t}\n\t\t};\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_probe\",\n\t\t\tlabel: \"Desktop probe\",\n\t\t\tdescription: \"Probe whether the selected Windows UI Automation adapter is available\",\n\t\t\tparameters: Type.Object({}),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { operationId } = toolInvocation(first, second);\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.probe(),\n\t\t\t\t\t(probe) => {\n\t\t\t\t\t\tconst capabilities = desktopCapabilities(probe.capabilities);\n\t\t\t\t\t\treturn desktopResultWithinBudget({\n\t\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\t\toperationId,\n\t\t\t\t\t\t\tstatus: probe.available ? (\"succeeded\" as const) : (\"unsupported\" as const),\n\t\t\t\t\t\t\tprobe: {\n\t\t\t\t\t\t\t\tavailable: probe.available,\n\t\t\t\t\t\t\t\tplatform: desktopClampedString(probe.platform, \"platform\"),\n\t\t\t\t\t\t\t\tdriver: \"windows-uia\" as const,\n\t\t\t\t\t\t\t\t...(capabilities === undefined ? {} : { capabilities }),\n\t\t\t\t\t\t\t\t...(probe.reason === undefined ? {} : { reason: desktopClampedString(probe.reason, \"reason\") }),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_session_open\",\n\t\t\tlabel: \"Open desktop session\",\n\t\t\tdescription: \"Open a foreground or VM-scoped read-only Windows desktop session\",\n\t\t\tparameters: Type.Object({\n\t\t\t\tisolation: Type.Union([Type.Literal(\"foreground\"), Type.Literal(\"vm\")]),\n\t\t\t\tapplicationId: Type.Optional(Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 })),\n\t\t\t}),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\tif (input.isolation !== \"foreground\" && input.isolation !== \"vm\")\n\t\t\t\t\tthrow new Error(\"isolation must be foreground or vm\");\n\t\t\t\tconst request: DesktopSessionRequestV1 = {\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tisolation: input.isolation,\n\t\t\t\t\t...(input.applicationId === undefined\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { applicationId: nonEmptyString(input.applicationId, \"applicationId\") }),\n\t\t\t\t};\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.openSession(request),\n\t\t\t\t\t(value) => desktopSessionResult(value, operationId),\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t\tfor (const [name, action] of [\n\t\t\t[\"desktop_observe\", \"observe\"],\n\t\t\t[\"desktop_reobserve\", \"reobserve\"],\n\t\t] as const) {\n\t\t\tapi.registerTool({\n\t\t\t\tname,\n\t\t\t\tlabel: name === \"desktop_observe\" ? \"Observe desktop\" : \"Re-observe desktop\",\n\t\t\t\tdescription: \"Return a bounded Windows UI Automation observation for an existing session\",\n\t\t\t\tparameters: Type.Object({\n\t\t\t\t\tsessionId: Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 }),\n\t\t\t\t}),\n\t\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\t\tconst sessionId = nonEmptyString(input.sessionId, \"sessionId\");\n\t\t\t\t\treturn invoke(\n\t\t\t\t\t\toperationId,\n\t\t\t\t\t\t() => runtime[action](sessionId),\n\t\t\t\t\t\t(value) => desktopObservationResult(value, operationId),\n\t\t\t\t\t\tsignalFrom(third),\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_session_stop\",\n\t\t\tlabel: \"Stop desktop session\",\n\t\t\tdescription: \"Stop an existing read-only desktop session\",\n\t\t\tparameters: Type.Object({ sessionId: Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 }) }),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\tconst sessionId = nonEmptyString(input.sessionId, \"sessionId\");\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.stop(sessionId),\n\t\t\t\t\t(value) => desktopStopResult(value, operationId),\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"capability.js","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EACN,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGzE,MAAM,UAAU,uCAAuC,CACtD,OAAiC,EACH;IAC9B,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,CACd,WAAmB,EACnB,MAAe,EACf,OAA8B,EAC9B,MAAoB,EACnB,EAAE,CAAC;YACJ,IAAI,MAAM,EAAE,OAAO;gBAClB,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,iCAAiC,CAAC,CAAC,CAAC;YACrG,IAAI,CAAC;gBACJ,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;gBAChC,OAAO,OAAO,CAAC,OAAO,CACrB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,iCAAiC,CAAC,CAAC,CAAC,CAAC,KAAK,CACrG,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,0FAA4C;gBAC5C,4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AAW,EACX,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAChC,CAAC,KAAK,EAAE,EAAE,CAAC,wBAAwB,CAAC,KAAK,EAAE,WAAW,CAAC,EACvD,UAAU,CAAC,KAAK,CAAC,CACjB,CAAC;gBAAA,CACF;aACD,CAAC,CAAC;QACJ,CAAC;QACD,GAAG,CAAC,YAAY,CAAC;YAChB,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,4CAA4C;YACzD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,2BAA2B,EAAE,CAAC,EAAE,CAAC;YAC7G,OAAO,EAAE,KAAK,EAAE,KAAc,EAAE,MAAgB,EAAE,KAAe,EAAE,EAAE,CAAC;gBACrE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC7D,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;gBAC/D,OAAO,MAAM,CACZ,WAAW,EACX,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAC7B,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,EAChD,UAAU,CAAC,KAAK,CAAC,CACjB,CAAC;YAAA,CACF;SACD,CAAC,CAAC;IAAA,CACH,CAAC;AAAA,CACF","sourcesContent":["/**\n * Read-only desktop observation capability factory, migrated from agent-forge\n * `src/profile/runtime-capabilities-desktop.ts` (`desktopFactory`, D-075 S3\n * extraction). Differences from the host original:\n * - The factory type is the public `CapabilityPluginSyncFactory` from the\n * plugin SDK instead of the host-internal `BuiltinCapabilityPlugin`.\n * - Projection helpers live in `projection.ts`, input helpers in `shared.ts`.\n * Tool names, parameters, budgets and result shapes are unchanged.\n */\nimport type { CapabilityPluginSyncFactory } from \"@agent-forge/plugin-sdk\";\nimport { Type } from \"typebox\";\nimport {\n\tDESKTOP_MAX_STRING_CHARS_V1,\n\tdesktopCapabilities,\n\tdesktopClampedString,\n\tdesktopFailure,\n\tdesktopObservationResult,\n\tdesktopResultWithinBudget,\n\tdesktopSessionResult,\n\tdesktopStopResult,\n} from \"./projection.ts\";\nimport { nonEmptyString, signalFrom, toolInvocation } from \"./shared.ts\";\nimport type { DesktopReadonlyAdapterV1, DesktopScreenshotResultV1, DesktopSessionRequestV1 } from \"./types.ts\";\n\nexport function createDesktopObserveCapabilityFactoryV1(\n\truntime: DesktopReadonlyAdapterV1,\n): CapabilityPluginSyncFactory {\n\treturn (api) => {\n\t\tconst invoke = <T>(\n\t\t\toperationId: string,\n\t\t\taction: () => T,\n\t\t\tproject: (value: T) => unknown,\n\t\t\tsignal?: AbortSignal,\n\t\t) => {\n\t\t\tif (signal?.aborted)\n\t\t\t\treturn Promise.resolve(desktopFailure(operationId, \"cancelled\", \"Desktop operation was cancelled\"));\n\t\t\ttry {\n\t\t\t\tconst value = project(action());\n\t\t\t\treturn Promise.resolve(\n\t\t\t\t\tsignal?.aborted ? desktopFailure(operationId, \"cancelled\", \"Desktop operation was cancelled\") : value,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\t// 透传原始诊断(dogfood 2026-09-25:无信息报错让一次观察失败的排障\n\t\t\t\t// 成本极高);code 仍是适配器/投影面失败。\n\t\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\t\treturn Promise.resolve(desktopFailure(operationId, \"desktop_adapter_failed\", detail));\n\t\t\t}\n\t\t};\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_probe\",\n\t\t\tlabel: \"Desktop probe\",\n\t\t\tdescription: \"Probe whether the selected Windows UI Automation adapter is available\",\n\t\t\tparameters: Type.Object({}),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { operationId } = toolInvocation(first, second);\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.probe(),\n\t\t\t\t\t(probe) => {\n\t\t\t\t\t\tconst capabilities = desktopCapabilities(probe.capabilities);\n\t\t\t\t\t\treturn desktopResultWithinBudget({\n\t\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\t\toperationId,\n\t\t\t\t\t\t\tstatus: probe.available ? (\"succeeded\" as const) : (\"unsupported\" as const),\n\t\t\t\t\t\t\tprobe: {\n\t\t\t\t\t\t\t\tavailable: probe.available,\n\t\t\t\t\t\t\t\tplatform: desktopClampedString(probe.platform, \"platform\"),\n\t\t\t\t\t\t\t\tdriver: \"windows-uia\" as const,\n\t\t\t\t\t\t\t\t...(capabilities === undefined ? {} : { capabilities }),\n\t\t\t\t\t\t\t\t...(probe.reason === undefined ? {} : { reason: desktopClampedString(probe.reason, \"reason\") }),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_screenshot\",\n\t\t\tlabel: \"Screenshot desktop\",\n\t\t\tdescription: \"Capture a scaled PNG screenshot of the primary Windows display and return it inline\",\n\t\t\tparameters: Type.Object({}),\n\t\t\t// Inline image results never fit the 64KB JSON projection budget; the host\n\t\t\t// passes content arrays through untouched, so every branch below returns\n\t\t\t// the same content-array envelope instead of a projected JSON object.\n\t\t\treadonlySafe: true,\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { operationId } = toolInvocation(first, second);\n\t\t\t\tconst signal = signalFrom(third);\n\t\t\t\tconst textResult = (payload: Record<string, unknown>) => ({\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: JSON.stringify({ operationId, ...payload }) }],\n\t\t\t\t});\n\t\t\t\tconst cancelledResult = () =>\n\t\t\t\t\ttextResult({\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\tstatus: \"cancelled\",\n\t\t\t\t\t\tsummary: \"Desktop operation was cancelled\",\n\t\t\t\t\t\terror: { version: 1, code: \"cancelled\", message: \"Desktop operation was cancelled\" },\n\t\t\t\t\t});\n\t\t\t\tif (signal?.aborted) return cancelledResult();\n\t\t\t\tlet result: DesktopScreenshotResultV1;\n\t\t\t\ttry {\n\t\t\t\t\tresult = runtime.screenshot();\n\t\t\t\t} catch (caught) {\n\t\t\t\t\t// Same diagnostics posture as invoke(): code stays an adapter-surface\n\t\t\t\t\t// failure, the message carries the original detail.\n\t\t\t\t\tconst detail = caught instanceof Error ? caught.message : String(caught);\n\t\t\t\t\treturn textResult({\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\tsource: \"windows-gdi\",\n\t\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\t\terror: { version: 1, code: \"desktop_adapter_failed\", message: detail },\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (signal?.aborted) return cancelledResult();\n\t\t\t\tif (result.status !== \"succeeded\" || result.data === undefined)\n\t\t\t\t\treturn textResult({\n\t\t\t\t\t\tversion: 1,\n\t\t\t\t\t\tsource: \"windows-gdi\",\n\t\t\t\t\t\tstatus: result.status,\n\t\t\t\t\t\t...(result.error === undefined ? {} : { error: result.error }),\n\t\t\t\t\t});\n\t\t\t\tconst summary = {\n\t\t\t\t\tversion: 1 as const,\n\t\t\t\t\tsource: \"windows-gdi\" as const,\n\t\t\t\t\twidth: result.width ?? 0,\n\t\t\t\t\theight: result.height ?? 0,\n\t\t\t\t\toriginalWidth: result.originalWidth ?? 0,\n\t\t\t\t\toriginalHeight: result.originalHeight ?? 0,\n\t\t\t\t\tscale: result.scale ?? 1,\n\t\t\t\t\t...(result.capturedAt === undefined ? {} : { capturedAt: result.capturedAt }),\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"image\", data: result.data, mimeType: \"image/png\" },\n\t\t\t\t\t\t{ type: \"text\", text: JSON.stringify(summary) },\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t},\n\t\t});\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_session_open\",\n\t\t\tlabel: \"Open desktop session\",\n\t\t\tdescription: \"Open a foreground or VM-scoped read-only Windows desktop session\",\n\t\t\tparameters: Type.Object({\n\t\t\t\tisolation: Type.Union([Type.Literal(\"foreground\"), Type.Literal(\"vm\")]),\n\t\t\t\tapplicationId: Type.Optional(Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 })),\n\t\t\t}),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\tif (input.isolation !== \"foreground\" && input.isolation !== \"vm\")\n\t\t\t\t\tthrow new Error(\"isolation must be foreground or vm\");\n\t\t\t\tconst request: DesktopSessionRequestV1 = {\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tisolation: input.isolation,\n\t\t\t\t\t...(input.applicationId === undefined\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { applicationId: nonEmptyString(input.applicationId, \"applicationId\") }),\n\t\t\t\t};\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.openSession(request),\n\t\t\t\t\t(value) => desktopSessionResult(value, operationId),\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t\tfor (const [name, action] of [\n\t\t\t[\"desktop_observe\", \"observe\"],\n\t\t\t[\"desktop_reobserve\", \"reobserve\"],\n\t\t] as const) {\n\t\t\tapi.registerTool({\n\t\t\t\tname,\n\t\t\t\tlabel: name === \"desktop_observe\" ? \"Observe desktop\" : \"Re-observe desktop\",\n\t\t\t\tdescription: \"Return a bounded Windows UI Automation observation for an existing session\",\n\t\t\t\tparameters: Type.Object({\n\t\t\t\t\tsessionId: Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 }),\n\t\t\t\t}),\n\t\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\t\tconst sessionId = nonEmptyString(input.sessionId, \"sessionId\");\n\t\t\t\t\treturn invoke(\n\t\t\t\t\t\toperationId,\n\t\t\t\t\t\t() => runtime[action](sessionId),\n\t\t\t\t\t\t(value) => desktopObservationResult(value, operationId),\n\t\t\t\t\t\tsignalFrom(third),\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tapi.registerTool({\n\t\t\tname: \"desktop_session_stop\",\n\t\t\tlabel: \"Stop desktop session\",\n\t\t\tdescription: \"Stop an existing read-only desktop session\",\n\t\t\tparameters: Type.Object({ sessionId: Type.String({ minLength: 1, maxLength: DESKTOP_MAX_STRING_CHARS_V1 }) }),\n\t\t\texecute: async (first: unknown, second?: unknown, third?: unknown) => {\n\t\t\t\tconst { input, operationId } = toolInvocation(first, second);\n\t\t\t\tconst sessionId = nonEmptyString(input.sessionId, \"sessionId\");\n\t\t\t\treturn invoke(\n\t\t\t\t\toperationId,\n\t\t\t\t\t() => runtime.stop(sessionId),\n\t\t\t\t\t(value) => desktopStopResult(value, operationId),\n\t\t\t\t\tsignalFrom(third),\n\t\t\t\t);\n\t\t\t},\n\t\t});\n\t};\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -76,6 +76,12 @@ export type DesktopTargetRefV1 = {
|
|
|
76
76
|
readonly kind: "control";
|
|
77
77
|
readonly controlId: string;
|
|
78
78
|
readonly windowId?: string;
|
|
79
|
+
}
|
|
80
|
+
/** Raw primary-screen pixel coordinates; only valid for click actions. */
|
|
81
|
+
| {
|
|
82
|
+
readonly kind: "coordinates";
|
|
83
|
+
readonly x: number;
|
|
84
|
+
readonly y: number;
|
|
79
85
|
};
|
|
80
86
|
export type DesktopActionKindV1 = "focus" | "click" | "type" | "key" | "scroll" | "submit" | "uac" | "password" | "admin" | "payment" | "external-submit";
|
|
81
87
|
/**
|
|
@@ -140,6 +146,35 @@ export interface DesktopReplayResultV1 {
|
|
|
140
146
|
readonly status: Extract<PluginResultStatusV1, "succeeded" | "failed" | "cancelled" | "needs_user">;
|
|
141
147
|
readonly results: readonly DesktopOperationResultV1[];
|
|
142
148
|
}
|
|
149
|
+
/** Structured result of one primary-display screenshot capture. */
|
|
150
|
+
export interface DesktopScreenshotResultV1 {
|
|
151
|
+
readonly version: 1;
|
|
152
|
+
readonly source: "windows-gdi";
|
|
153
|
+
readonly status: "succeeded" | "unsupported" | "failed";
|
|
154
|
+
readonly mimeType?: "image/png";
|
|
155
|
+
/** Base64-encoded PNG payload; present only on success. */
|
|
156
|
+
readonly data?: string;
|
|
157
|
+
/** Delivered (post-scaling) pixel dimensions. */
|
|
158
|
+
readonly width?: number;
|
|
159
|
+
readonly height?: number;
|
|
160
|
+
/** Captured display pixel dimensions before scaling. */
|
|
161
|
+
readonly originalWidth?: number;
|
|
162
|
+
readonly originalHeight?: number;
|
|
163
|
+
/** originalWidth / width. */
|
|
164
|
+
readonly scale?: number;
|
|
165
|
+
readonly capturedAt?: string;
|
|
166
|
+
readonly error?: DesktopErrorV1;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Read-only GDI screenshot driver boundary. It stays separate from
|
|
170
|
+
* DesktopWindowsDriverV1 so UIA-only driver implementations (test drivers,
|
|
171
|
+
* remote brokers) are not forced to implement screen capture.
|
|
172
|
+
*/
|
|
173
|
+
export interface DesktopScreenshotDriverV1 {
|
|
174
|
+
readonly driverId: string;
|
|
175
|
+
readonly driverVersion: string;
|
|
176
|
+
screenshot(): DesktopScreenshotResultV1;
|
|
177
|
+
}
|
|
143
178
|
export interface DesktopAdapterV1 {
|
|
144
179
|
readonly adapterId: string;
|
|
145
180
|
readonly adapterVersion: string;
|
|
@@ -150,6 +185,8 @@ export interface DesktopAdapterV1 {
|
|
|
150
185
|
execute(request: DesktopOperationRequestV1): DesktopOperationResultV1;
|
|
151
186
|
stop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;
|
|
152
187
|
replay(request: DesktopReplayRequestV1): DesktopReplayResultV1;
|
|
188
|
+
/** Read-only primary-display capture; adapters delegate to a screenshot-capable driver. */
|
|
189
|
+
screenshot(): DesktopScreenshotResultV1;
|
|
153
190
|
}
|
|
154
191
|
/** Result returned by a host UI Automation capability probe. */
|
|
155
192
|
export interface DesktopWindowsProbeV1 {
|
|
@@ -188,6 +225,8 @@ export interface DesktopReadonlyAdapterV1 {
|
|
|
188
225
|
observe(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
189
226
|
reobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
190
227
|
stop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;
|
|
228
|
+
/** Read-only primary-display capture; adapters delegate to a screenshot-capable driver. */
|
|
229
|
+
screenshot(): DesktopScreenshotResultV1;
|
|
191
230
|
}
|
|
192
231
|
/**
|
|
193
232
|
* Production host boundary for intentionally bounded desktop input. This is
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;;;;;;;GAUG;AAEH,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAC9B,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,gBAAgB,GAChB,gBAAgB,CAAC;AAEpB,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;AACrE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,C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AQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,KAAK,IAAI,qBAAqB,CAAC;IAC/B,WAAW,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAAC;IACtE,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;IAC5E,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;IAC9E,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,GAAG,wBAAwB,CAAC;CACrE;AAED;;;;;GAKG;AACH,MAAM,WAAW,2BAA4B,SAAQ,wBAAwB;IAC5E,OAAO,CAAC,OAAO,EAAE,yBAAyB,GAAG,wBAAwB,CAAC;IACtE,MAAM,CAAC,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAAC;CAChE","sourcesContent":["import type { PluginResultStatusV1 } from \"@agent-forge/plugin-sdk\";\n\n/**\n * Inlined from agent-forge `src/plugins/desktop/types.ts` (D-075 S3 extraction)\n * so this package keeps its dependency closure limited to the plugin SDK and\n * typebox. Semantics are unchanged. Differences from the host original:\n * - `CapabilityRefV1`/`PluginPlatformBindingV1` import from `@agent-forge/plugin-sdk`.\n * - The `agent-forge.desktop-control` test-only manifest contract types\n * (`DesktopPluginManifestV1`, `DesktopCapabilityDeclarationV1`) stay host-side;\n * they belong to the test-only mock plugin, not to this standalone package.\n * This file is a deliberate copy shared (not imported) with\n * `plugins/desktop-windows-input/src/types.ts`; keep both copies in sync.\n */\n\n/** Stable capability ids owned by the desktop-control plugin family. */\nexport type DesktopCapabilityIdV1 =\n\t| \"desktop-session\"\n\t| \"desktop-uia\"\n\t| \"desktop-input\"\n\t| \"desktop-vision\"\n\t| \"desktop-replay\";\n\nexport type DesktopSessionIsolationV1 = \"mock\" | \"foreground\" | \"vm\";\nexport type DesktopSessionStatusV1 = \"ready\" | \"unavailable\" | \"stopped\";\n\nexport interface DesktopSessionRequestV1 {\n\treadonly version: 1;\n\treadonly isolation: DesktopSessionIsolationV1;\n\treadonly applicationId?: string;\n}\n\nexport interface DesktopSessionV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly isolation: DesktopSessionIsolationV1;\n\treadonly status: DesktopSessionStatusV1;\n\treadonly applicationId?: string;\n}\n\nexport interface DesktopErrorV1 {\n\treadonly version: 1;\n\treadonly code: string;\n\treadonly message: string;\n\treadonly causeCode?: string;\n}\n\nexport interface DesktopSessionResultV1 {\n\treadonly status: Extract<PluginResultStatusV1, \"succeeded\" | \"unsupported\" | \"failed\">;\n\treadonly session?: DesktopSessionV1;\n\treadonly error?: DesktopErrorV1;\n}\n\nexport interface DesktopWindowIdentityV1 {\n\treadonly version: 1;\n\treadonly windowId: string;\n\treadonly appId: string;\n\treadonly title: string;\n\treadonly bounds: DesktopBoundsV1;\n}\n\nexport interface DesktopControlIdentityV1 {\n\treadonly version: 1;\n\treadonly controlId: string;\n\treadonly windowId: string;\n\treadonly role: string;\n\treadonly name: string;\n\treadonly bounds: DesktopBoundsV1;\n\treadonly enabled: boolean;\n\treadonly value?: string;\n}\n\nexport interface DesktopBoundsV1 {\n\treadonly x: number;\n\treadonly y: number;\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport interface DesktopObservationV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly observationId: string;\n\treadonly source: \"mock\" | \"windows-uia\";\n\treadonly windows: readonly DesktopWindowIdentityV1[];\n\treadonly controls: readonly DesktopControlIdentityV1[];\n\treadonly focusedControlId?: string;\n}\n\nexport type DesktopTargetRefV1 =\n\t| { readonly kind: \"window\"; readonly windowId: string }\n\t| { readonly kind: \"control\"; readonly controlId: string; readonly windowId?: string };\n\nexport type DesktopActionKindV1 =\n\t| \"focus\"\n\t| \"click\"\n\t| \"type\"\n\t| \"key\"\n\t| \"scroll\"\n\t| \"submit\"\n\t| \"uac\"\n\t| \"password\"\n\t| \"admin\"\n\t| \"payment\"\n\t| \"external-submit\";\n\n/**\n * Actions that must pause at the host/user boundary before any input is sent.\n * This policy belongs to the desktop plugin, not Agent Core.\n */\nexport const DESKTOP_USER_CONFIRMATION_ACTIONS = Object.freeze([\n\t\"uac\",\n\t\"password\",\n\t\"admin\",\n\t\"payment\",\n\t\"external-submit\",\n] as const satisfies readonly DesktopActionKindV1[]);\n\nexport const requiresDesktopUserConfirmation = (kind: DesktopActionKindV1): boolean =>\n\t(DESKTOP_USER_CONFIRMATION_ACTIONS as readonly DesktopActionKindV1[]).includes(kind);\n\nexport interface DesktopActionV1 {\n\treadonly version: 1;\n\treadonly kind: DesktopActionKindV1;\n\treadonly target?: DesktopTargetRefV1;\n\treadonly text?: string;\n\treadonly key?: string;\n}\n\nexport type DesktopPostconditionV1 =\n\t| { readonly kind: \"window-exists\"; readonly windowId: string }\n\t| { readonly kind: \"control-exists\"; readonly controlId: string }\n\t| { readonly kind: \"focused\"; readonly controlId: string }\n\t| {\n\t\t\treadonly kind: \"property-equals\";\n\t\t\treadonly target: DesktopTargetRefV1;\n\t\t\treadonly property: \"enabled\" | \"value\" | \"name\";\n\t\t\treadonly expected: boolean | string;\n\t };\n\nexport interface DesktopOperationRequestV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly sessionId: string;\n\treadonly action: DesktopActionV1;\n\treadonly postconditions?: readonly DesktopPostconditionV1[];\n\treadonly reobserveAfterAction?: boolean;\n}\n\nexport interface DesktopVerificationV1 {\n\treadonly status: \"passed\" | \"failed\" | \"unknown\";\n\treadonly checks: readonly string[];\n}\n\nexport interface DesktopOperationResultV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly status: PluginResultStatusV1;\n\treadonly summary: string;\n\treadonly observation?: DesktopObservationV1;\n\treadonly verification?: DesktopVerificationV1;\n\treadonly error?: DesktopErrorV1;\n}\n\nexport interface DesktopReplayRequestV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly operations: readonly DesktopOperationRequestV1[];\n\treadonly stopOnFailure: boolean;\n}\n\n/** Returns the first operation id that would cross the replay session boundary. */\nexport const findDesktopReplaySessionMismatch = (request: DesktopReplayRequestV1): string | undefined => {\n\tfor (const operation of request.operations) {\n\t\tif (operation.sessionId !== request.sessionId) return operation.operationId;\n\t}\n\treturn undefined;\n};\n\nexport interface DesktopReplayResultV1 {\n\treadonly version: 1;\n\treadonly status: Extract<PluginResultStatusV1, \"succeeded\" | \"failed\" | \"cancelled\" | \"needs_user\">;\n\treadonly results: readonly DesktopOperationResultV1[];\n}\n\nexport interface DesktopAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\treadonly capabilities: readonly DesktopCapabilityIdV1[];\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\treobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n\treplay(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n}\n\n/** Result returned by a host UI Automation capability probe. */\nexport interface DesktopWindowsProbeV1 {\n\treadonly available: boolean;\n\treadonly platform: string;\n\treadonly driver: \"windows-uia\";\n\t/** Capabilities that the host can expose without relying on a higher-risk facade. */\n\treadonly capabilities?: readonly DesktopCapabilityIdV1[];\n\treadonly reason?: string;\n}\n\n/**\n * Synchronous host boundary used by the Windows adapter. Implementations may\n * use UI Automation, an OS broker, or a test driver. The adapter never\n * invents observations when this boundary reports unavailable.\n */\nexport interface DesktopWindowsDriverV1 {\n\treadonly driverId: string;\n\treadonly driverVersion: string;\n\tprobe(): DesktopWindowsProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n}\n\n/**\n * Production-safe, read-only desktop boundary. It deliberately omits\n * execute/replay so a host cannot accidentally expose input through the\n * observe plugin. The full DesktopAdapter remains a separate test/high-risk\n * contract.\n */\nexport interface DesktopReadonlyAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\tprobe(): DesktopWindowsProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\treobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n}\n\n/**\n * Production host boundary for intentionally bounded desktop input. This is\n * separate from DesktopReadonlyAdapterV1 so observing a desktop never\n * accidentally grants input, and replay is optional: adapters that expose it\n * keep the session-mismatch gate and the needs-user confirmation per action.\n */\nexport interface DesktopFullControlAdapterV1 extends DesktopReadonlyAdapterV1 {\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\treplay?(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;;;;;;;GAUG;AAEH,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAC9B,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,gBAAgB,GAChB,gBAAgB,CAAC;AAEpB,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;AACrE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,aAAa,CAAC,EAAE,MA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S,EAAE,MAAM,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;IAC9E,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,GAAG,wBAAwB,CAAC;IACrE,2FAA2F;IAC3F,UAAU,IAAI,yBAAyB,CAAC;CACxC;AAED;;;;;GAKG;AACH,MAAM,WAAW,2BAA4B,SAAQ,wBAAwB;IAC5E,OAAO,CAAC,OAAO,EAAE,yBAAyB,GAAG,wBAAwB,CAAC;IACtE,MAAM,CAAC,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB,CAAC;CAChE","sourcesContent":["import type { PluginResultStatusV1 } from \"@agent-forge/plugin-sdk\";\n\n/**\n * Inlined from agent-forge `src/plugins/desktop/types.ts` (D-075 S3 extraction)\n * so this package keeps its dependency closure limited to the plugin SDK and\n * typebox. Semantics are unchanged. Differences from the host original:\n * - `CapabilityRefV1`/`PluginPlatformBindingV1` import from `@agent-forge/plugin-sdk`.\n * - The `agent-forge.desktop-control` test-only manifest contract types\n * (`DesktopPluginManifestV1`, `DesktopCapabilityDeclarationV1`) stay host-side;\n * they belong to the test-only mock plugin, not to this standalone package.\n * This file is a deliberate copy shared (not imported) with\n * `plugins/desktop-windows-input/src/types.ts`; keep both copies in sync.\n */\n\n/** Stable capability ids owned by the desktop-control plugin family. */\nexport type DesktopCapabilityIdV1 =\n\t| \"desktop-session\"\n\t| \"desktop-uia\"\n\t| \"desktop-input\"\n\t| \"desktop-vision\"\n\t| \"desktop-replay\";\n\nexport type DesktopSessionIsolationV1 = \"mock\" | \"foreground\" | \"vm\";\nexport type DesktopSessionStatusV1 = \"ready\" | \"unavailable\" | \"stopped\";\n\nexport interface DesktopSessionRequestV1 {\n\treadonly version: 1;\n\treadonly isolation: DesktopSessionIsolationV1;\n\treadonly applicationId?: string;\n}\n\nexport interface DesktopSessionV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly isolation: DesktopSessionIsolationV1;\n\treadonly status: DesktopSessionStatusV1;\n\treadonly applicationId?: string;\n}\n\nexport interface DesktopErrorV1 {\n\treadonly version: 1;\n\treadonly code: string;\n\treadonly message: string;\n\treadonly causeCode?: string;\n}\n\nexport interface DesktopSessionResultV1 {\n\treadonly status: Extract<PluginResultStatusV1, \"succeeded\" | \"unsupported\" | \"failed\">;\n\treadonly session?: DesktopSessionV1;\n\treadonly error?: DesktopErrorV1;\n}\n\nexport interface DesktopWindowIdentityV1 {\n\treadonly version: 1;\n\treadonly windowId: string;\n\treadonly appId: string;\n\treadonly title: string;\n\treadonly bounds: DesktopBoundsV1;\n}\n\nexport interface DesktopControlIdentityV1 {\n\treadonly version: 1;\n\treadonly controlId: string;\n\treadonly windowId: string;\n\treadonly role: string;\n\treadonly name: string;\n\treadonly bounds: DesktopBoundsV1;\n\treadonly enabled: boolean;\n\treadonly value?: string;\n}\n\nexport interface DesktopBoundsV1 {\n\treadonly x: number;\n\treadonly y: number;\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport interface DesktopObservationV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly observationId: string;\n\treadonly source: \"mock\" | \"windows-uia\";\n\treadonly windows: readonly DesktopWindowIdentityV1[];\n\treadonly controls: readonly DesktopControlIdentityV1[];\n\treadonly focusedControlId?: string;\n}\n\nexport type DesktopTargetRefV1 =\n\t| { readonly kind: \"window\"; readonly windowId: string }\n\t| { readonly kind: \"control\"; readonly controlId: string; readonly windowId?: string }\n\t/** Raw primary-screen pixel coordinates; only valid for click actions. */\n\t| { readonly kind: \"coordinates\"; readonly x: number; readonly y: number };\n\nexport type DesktopActionKindV1 =\n\t| \"focus\"\n\t| \"click\"\n\t| \"type\"\n\t| \"key\"\n\t| \"scroll\"\n\t| \"submit\"\n\t| \"uac\"\n\t| \"password\"\n\t| \"admin\"\n\t| \"payment\"\n\t| \"external-submit\";\n\n/**\n * Actions that must pause at the host/user boundary before any input is sent.\n * This policy belongs to the desktop plugin, not Agent Core.\n */\nexport const DESKTOP_USER_CONFIRMATION_ACTIONS = Object.freeze([\n\t\"uac\",\n\t\"password\",\n\t\"admin\",\n\t\"payment\",\n\t\"external-submit\",\n] as const satisfies readonly DesktopActionKindV1[]);\n\nexport const requiresDesktopUserConfirmation = (kind: DesktopActionKindV1): boolean =>\n\t(DESKTOP_USER_CONFIRMATION_ACTIONS as readonly DesktopActionKindV1[]).includes(kind);\n\nexport interface DesktopActionV1 {\n\treadonly version: 1;\n\treadonly kind: DesktopActionKindV1;\n\treadonly target?: DesktopTargetRefV1;\n\treadonly text?: string;\n\treadonly key?: string;\n}\n\nexport type DesktopPostconditionV1 =\n\t| { readonly kind: \"window-exists\"; readonly windowId: string }\n\t| { readonly kind: \"control-exists\"; readonly controlId: string }\n\t| { readonly kind: \"focused\"; readonly controlId: string }\n\t| {\n\t\t\treadonly kind: \"property-equals\";\n\t\t\treadonly target: DesktopTargetRefV1;\n\t\t\treadonly property: \"enabled\" | \"value\" | \"name\";\n\t\t\treadonly expected: boolean | string;\n\t };\n\nexport interface DesktopOperationRequestV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly sessionId: string;\n\treadonly action: DesktopActionV1;\n\treadonly postconditions?: readonly DesktopPostconditionV1[];\n\treadonly reobserveAfterAction?: boolean;\n}\n\nexport interface DesktopVerificationV1 {\n\treadonly status: \"passed\" | \"failed\" | \"unknown\";\n\treadonly checks: readonly string[];\n}\n\nexport interface DesktopOperationResultV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly status: PluginResultStatusV1;\n\treadonly summary: string;\n\treadonly observation?: DesktopObservationV1;\n\treadonly verification?: DesktopVerificationV1;\n\treadonly error?: DesktopErrorV1;\n}\n\nexport interface DesktopReplayRequestV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly operations: readonly DesktopOperationRequestV1[];\n\treadonly stopOnFailure: boolean;\n}\n\n/** Returns the first operation id that would cross the replay session boundary. */\nexport const findDesktopReplaySessionMismatch = (request: DesktopReplayRequestV1): string | undefined => {\n\tfor (const operation of request.operations) {\n\t\tif (operation.sessionId !== request.sessionId) return operation.operationId;\n\t}\n\treturn undefined;\n};\n\nexport interface DesktopReplayResultV1 {\n\treadonly version: 1;\n\treadonly status: Extract<PluginResultStatusV1, \"succeeded\" | \"failed\" | \"cancelled\" | \"needs_user\">;\n\treadonly results: readonly DesktopOperationResultV1[];\n}\n\n/** Structured result of one primary-display screenshot capture. */\nexport interface DesktopScreenshotResultV1 {\n\treadonly version: 1;\n\treadonly source: \"windows-gdi\";\n\treadonly status: \"succeeded\" | \"unsupported\" | \"failed\";\n\treadonly mimeType?: \"image/png\";\n\t/** Base64-encoded PNG payload; present only on success. */\n\treadonly data?: string;\n\t/** Delivered (post-scaling) pixel dimensions. */\n\treadonly width?: number;\n\treadonly height?: number;\n\t/** Captured display pixel dimensions before scaling. */\n\treadonly originalWidth?: number;\n\treadonly originalHeight?: number;\n\t/** originalWidth / width. */\n\treadonly scale?: number;\n\treadonly capturedAt?: string;\n\treadonly error?: DesktopErrorV1;\n}\n\n/**\n * Read-only GDI screenshot driver boundary. It stays separate from\n * DesktopWindowsDriverV1 so UIA-only driver implementations (test drivers,\n * remote brokers) are not forced to implement screen capture.\n */\nexport interface DesktopScreenshotDriverV1 {\n\treadonly driverId: string;\n\treadonly driverVersion: string;\n\tscreenshot(): DesktopScreenshotResultV1;\n}\n\nexport interface DesktopAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\treadonly capabilities: readonly DesktopCapabilityIdV1[];\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\treobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n\treplay(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n\t/** Read-only primary-display capture; adapters delegate to a screenshot-capable driver. */\n\tscreenshot(): DesktopScreenshotResultV1;\n}\n\n/** Result returned by a host UI Automation capability probe. */\nexport interface DesktopWindowsProbeV1 {\n\treadonly available: boolean;\n\treadonly platform: string;\n\treadonly driver: \"windows-uia\";\n\t/** Capabilities that the host can expose without relying on a higher-risk facade. */\n\treadonly capabilities?: readonly DesktopCapabilityIdV1[];\n\treadonly reason?: string;\n}\n\n/**\n * Synchronous host boundary used by the Windows adapter. Implementations may\n * use UI Automation, an OS broker, or a test driver. The adapter never\n * invents observations when this boundary reports unavailable.\n */\nexport interface DesktopWindowsDriverV1 {\n\treadonly driverId: string;\n\treadonly driverVersion: string;\n\tprobe(): DesktopWindowsProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n}\n\n/**\n * Production-safe, read-only desktop boundary. It deliberately omits\n * execute/replay so a host cannot accidentally expose input through the\n * observe plugin. The full DesktopAdapter remains a separate test/high-risk\n * contract.\n */\nexport interface DesktopReadonlyAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\tprobe(): DesktopWindowsProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\treobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n\t/** Read-only primary-display capture; adapters delegate to a screenshot-capable driver. */\n\tscreenshot(): DesktopScreenshotResultV1;\n}\n\n/**\n * Production host boundary for intentionally bounded desktop input. This is\n * separate from DesktopReadonlyAdapterV1 so observing a desktop never\n * accidentally grants input, and replay is optional: adapters that expose it\n * keep the session-mismatch gate and the needs-user confirmation per action.\n */\nexport interface DesktopFullControlAdapterV1 extends DesktopReadonlyAdapterV1 {\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\treplay?(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n}\n"]}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyGA;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9D,KAAK;IACL,UAAU;IACV,OAAO;IACP,SAAS;IACT,iBAAiB;CACiC,CAAC,CAAC;AAErD,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,IAAyB,EAAW,EAAE,CACpF,iCAAoE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAoDtF,mFAAmF;AACnF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,OAA+B,EAAsB,EAAE,CAAC;IACxG,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QAC5C,IAAI,SAAS,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS;YAAE,OAAO,SAAS,CAAC,WAAW,CAAC;IAC7E,CAAC;IACD,OAAO,SAAS,CAAC;AAAA,CACjB,CAAC","sourcesContent":["import type { PluginResultStatusV1 } from \"@agent-forge/plugin-sdk\";\n\n/**\n * Inlined from agent-forge `src/plugins/desktop/types.ts` (D-075 S3 extraction)\n * so this package keeps its dependency closure limited to the plugin SDK and\n * typebox. Semantics are unchanged. Differences from the host original:\n * - `CapabilityRefV1`/`PluginPlatformBindingV1` import from `@agent-forge/plugin-sdk`.\n * - The `agent-forge.desktop-control` test-only manifest contract types\n * (`DesktopPluginManifestV1`, `DesktopCapabilityDeclarationV1`) stay host-side;\n * they belong to the test-only mock plugin, not to this standalone package.\n * This file is a deliberate copy shared (not imported) with\n * `plugins/desktop-windows-input/src/types.ts`; keep both copies in sync.\n */\n\n/** Stable capability ids owned by the desktop-control plugin family. */\nexport type DesktopCapabilityIdV1 =\n\t| \"desktop-session\"\n\t| \"desktop-uia\"\n\t| \"desktop-input\"\n\t| \"desktop-vision\"\n\t| \"desktop-replay\";\n\nexport type DesktopSessionIsolationV1 = \"mock\" | \"foreground\" | \"vm\";\nexport type DesktopSessionStatusV1 = \"ready\" | \"unavailable\" | \"stopped\";\n\nexport interface DesktopSessionRequestV1 {\n\treadonly version: 1;\n\treadonly isolation: DesktopSessionIsolationV1;\n\treadonly applicationId?: string;\n}\n\nexport interface DesktopSessionV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly isolation: DesktopSessionIsolationV1;\n\treadonly status: DesktopSessionStatusV1;\n\treadonly applicationId?: string;\n}\n\nexport interface DesktopErrorV1 {\n\treadonly version: 1;\n\treadonly code: string;\n\treadonly message: string;\n\treadonly causeCode?: string;\n}\n\nexport interface DesktopSessionResultV1 {\n\treadonly status: Extract<PluginResultStatusV1, \"succeeded\" | \"unsupported\" | \"failed\">;\n\treadonly session?: DesktopSessionV1;\n\treadonly error?: DesktopErrorV1;\n}\n\nexport interface DesktopWindowIdentityV1 {\n\treadonly version: 1;\n\treadonly windowId: string;\n\treadonly appId: string;\n\treadonly title: string;\n\treadonly bounds: DesktopBoundsV1;\n}\n\nexport interface DesktopControlIdentityV1 {\n\treadonly version: 1;\n\treadonly controlId: string;\n\treadonly windowId: string;\n\treadonly role: string;\n\treadonly name: string;\n\treadonly bounds: DesktopBoundsV1;\n\treadonly enabled: boolean;\n\treadonly value?: string;\n}\n\nexport interface DesktopBoundsV1 {\n\treadonly x: number;\n\treadonly y: number;\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport interface DesktopObservationV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly observationId: string;\n\treadonly source: \"mock\" | \"windows-uia\";\n\treadonly windows: readonly DesktopWindowIdentityV1[];\n\treadonly controls: readonly DesktopControlIdentityV1[];\n\treadonly focusedControlId?: string;\n}\n\nexport type DesktopTargetRefV1 =\n\t| { readonly kind: \"window\"; readonly windowId: string }\n\t| { readonly kind: \"control\"; readonly controlId: string; readonly windowId?: string };\n\nexport type DesktopActionKindV1 =\n\t| \"focus\"\n\t| \"click\"\n\t| \"type\"\n\t| \"key\"\n\t| \"scroll\"\n\t| \"submit\"\n\t| \"uac\"\n\t| \"password\"\n\t| \"admin\"\n\t| \"payment\"\n\t| \"external-submit\";\n\n/**\n * Actions that must pause at the host/user boundary before any input is sent.\n * This policy belongs to the desktop plugin, not Agent Core.\n */\nexport const DESKTOP_USER_CONFIRMATION_ACTIONS = Object.freeze([\n\t\"uac\",\n\t\"password\",\n\t\"admin\",\n\t\"payment\",\n\t\"external-submit\",\n] as const satisfies readonly DesktopActionKindV1[]);\n\nexport const requiresDesktopUserConfirmation = (kind: DesktopActionKindV1): boolean =>\n\t(DESKTOP_USER_CONFIRMATION_ACTIONS as readonly DesktopActionKindV1[]).includes(kind);\n\nexport interface DesktopActionV1 {\n\treadonly version: 1;\n\treadonly kind: DesktopActionKindV1;\n\treadonly target?: DesktopTargetRefV1;\n\treadonly text?: string;\n\treadonly key?: string;\n}\n\nexport type DesktopPostconditionV1 =\n\t| { readonly kind: \"window-exists\"; readonly windowId: string }\n\t| { readonly kind: \"control-exists\"; readonly controlId: string }\n\t| { readonly kind: \"focused\"; readonly controlId: string }\n\t| {\n\t\t\treadonly kind: \"property-equals\";\n\t\t\treadonly target: DesktopTargetRefV1;\n\t\t\treadonly property: \"enabled\" | \"value\" | \"name\";\n\t\t\treadonly expected: boolean | string;\n\t };\n\nexport interface DesktopOperationRequestV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly sessionId: string;\n\treadonly action: DesktopActionV1;\n\treadonly postconditions?: readonly DesktopPostconditionV1[];\n\treadonly reobserveAfterAction?: boolean;\n}\n\nexport interface DesktopVerificationV1 {\n\treadonly status: \"passed\" | \"failed\" | \"unknown\";\n\treadonly checks: readonly string[];\n}\n\nexport interface DesktopOperationResultV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly status: PluginResultStatusV1;\n\treadonly summary: string;\n\treadonly observation?: DesktopObservationV1;\n\treadonly verification?: DesktopVerificationV1;\n\treadonly error?: DesktopErrorV1;\n}\n\nexport interface DesktopReplayRequestV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly operations: readonly DesktopOperationRequestV1[];\n\treadonly stopOnFailure: boolean;\n}\n\n/** Returns the first operation id that would cross the replay session boundary. */\nexport const findDesktopReplaySessionMismatch = (request: DesktopReplayRequestV1): string | undefined => {\n\tfor (const operation of request.operations) {\n\t\tif (operation.sessionId !== request.sessionId) return operation.operationId;\n\t}\n\treturn undefined;\n};\n\nexport interface DesktopReplayResultV1 {\n\treadonly version: 1;\n\treadonly status: Extract<PluginResultStatusV1, \"succeeded\" | \"failed\" | \"cancelled\" | \"needs_user\">;\n\treadonly results: readonly DesktopOperationResultV1[];\n}\n\nexport interface DesktopAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\treadonly capabilities: readonly DesktopCapabilityIdV1[];\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\treobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n\treplay(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n}\n\n/** Result returned by a host UI Automation capability probe. */\nexport interface DesktopWindowsProbeV1 {\n\treadonly available: boolean;\n\treadonly platform: string;\n\treadonly driver: \"windows-uia\";\n\t/** Capabilities that the host can expose without relying on a higher-risk facade. */\n\treadonly capabilities?: readonly DesktopCapabilityIdV1[];\n\treadonly reason?: string;\n}\n\n/**\n * Synchronous host boundary used by the Windows adapter. Implementations may\n * use UI Automation, an OS broker, or a test driver. The adapter never\n * invents observations when this boundary reports unavailable.\n */\nexport interface DesktopWindowsDriverV1 {\n\treadonly driverId: string;\n\treadonly driverVersion: string;\n\tprobe(): DesktopWindowsProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n}\n\n/**\n * Production-safe, read-only desktop boundary. It deliberately omits\n * execute/replay so a host cannot accidentally expose input through the\n * observe plugin. The full DesktopAdapter remains a separate test/high-risk\n * contract.\n */\nexport interface DesktopReadonlyAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\tprobe(): DesktopWindowsProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\treobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n}\n\n/**\n * Production host boundary for intentionally bounded desktop input. This is\n * separate from DesktopReadonlyAdapterV1 so observing a desktop never\n * accidentally grants input, and replay is optional: adapters that expose it\n * keep the session-mismatch gate and the needs-user confirmation per action.\n */\nexport interface DesktopFullControlAdapterV1 extends DesktopReadonlyAdapterV1 {\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\treplay?(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2GA;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9D,KAAK;IACL,UAAU;IACV,OAAO;IACP,SAAS;IACT,iBAAiB;CACiC,CAAC,CAAC;AAErD,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,IAAyB,EAAW,EAAE,CACpF,iCAAoE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAoDtF,mFAAmF;AACnF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,OAA+B,EAAsB,EAAE,CAAC;IACxG,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QAC5C,IAAI,SAAS,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS;YAAE,OAAO,SAAS,CAAC,WAAW,CAAC;IAC7E,CAAC;IACD,OAAO,SAAS,CAAC;AAAA,CACjB,CAAC","sourcesContent":["import type { PluginResultStatusV1 } from \"@agent-forge/plugin-sdk\";\n\n/**\n * Inlined from agent-forge `src/plugins/desktop/types.ts` (D-075 S3 extraction)\n * so this package keeps its dependency closure limited to the plugin SDK and\n * typebox. Semantics are unchanged. Differences from the host original:\n * - `CapabilityRefV1`/`PluginPlatformBindingV1` import from `@agent-forge/plugin-sdk`.\n * - The `agent-forge.desktop-control` test-only manifest contract types\n * (`DesktopPluginManifestV1`, `DesktopCapabilityDeclarationV1`) stay host-side;\n * they belong to the test-only mock plugin, not to this standalone package.\n * This file is a deliberate copy shared (not imported) with\n * `plugins/desktop-windows-input/src/types.ts`; keep both copies in sync.\n */\n\n/** Stable capability ids owned by the desktop-control plugin family. */\nexport type DesktopCapabilityIdV1 =\n\t| \"desktop-session\"\n\t| \"desktop-uia\"\n\t| \"desktop-input\"\n\t| \"desktop-vision\"\n\t| \"desktop-replay\";\n\nexport type DesktopSessionIsolationV1 = \"mock\" | \"foreground\" | \"vm\";\nexport type DesktopSessionStatusV1 = \"ready\" | \"unavailable\" | \"stopped\";\n\nexport interface DesktopSessionRequestV1 {\n\treadonly version: 1;\n\treadonly isolation: DesktopSessionIsolationV1;\n\treadonly applicationId?: string;\n}\n\nexport interface DesktopSessionV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly isolation: DesktopSessionIsolationV1;\n\treadonly status: DesktopSessionStatusV1;\n\treadonly applicationId?: string;\n}\n\nexport interface DesktopErrorV1 {\n\treadonly version: 1;\n\treadonly code: string;\n\treadonly message: string;\n\treadonly causeCode?: string;\n}\n\nexport interface DesktopSessionResultV1 {\n\treadonly status: Extract<PluginResultStatusV1, \"succeeded\" | \"unsupported\" | \"failed\">;\n\treadonly session?: DesktopSessionV1;\n\treadonly error?: DesktopErrorV1;\n}\n\nexport interface DesktopWindowIdentityV1 {\n\treadonly version: 1;\n\treadonly windowId: string;\n\treadonly appId: string;\n\treadonly title: string;\n\treadonly bounds: DesktopBoundsV1;\n}\n\nexport interface DesktopControlIdentityV1 {\n\treadonly version: 1;\n\treadonly controlId: string;\n\treadonly windowId: string;\n\treadonly role: string;\n\treadonly name: string;\n\treadonly bounds: DesktopBoundsV1;\n\treadonly enabled: boolean;\n\treadonly value?: string;\n}\n\nexport interface DesktopBoundsV1 {\n\treadonly x: number;\n\treadonly y: number;\n\treadonly width: number;\n\treadonly height: number;\n}\n\nexport interface DesktopObservationV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly observationId: string;\n\treadonly source: \"mock\" | \"windows-uia\";\n\treadonly windows: readonly DesktopWindowIdentityV1[];\n\treadonly controls: readonly DesktopControlIdentityV1[];\n\treadonly focusedControlId?: string;\n}\n\nexport type DesktopTargetRefV1 =\n\t| { readonly kind: \"window\"; readonly windowId: string }\n\t| { readonly kind: \"control\"; readonly controlId: string; readonly windowId?: string }\n\t/** Raw primary-screen pixel coordinates; only valid for click actions. */\n\t| { readonly kind: \"coordinates\"; readonly x: number; readonly y: number };\n\nexport type DesktopActionKindV1 =\n\t| \"focus\"\n\t| \"click\"\n\t| \"type\"\n\t| \"key\"\n\t| \"scroll\"\n\t| \"submit\"\n\t| \"uac\"\n\t| \"password\"\n\t| \"admin\"\n\t| \"payment\"\n\t| \"external-submit\";\n\n/**\n * Actions that must pause at the host/user boundary before any input is sent.\n * This policy belongs to the desktop plugin, not Agent Core.\n */\nexport const DESKTOP_USER_CONFIRMATION_ACTIONS = Object.freeze([\n\t\"uac\",\n\t\"password\",\n\t\"admin\",\n\t\"payment\",\n\t\"external-submit\",\n] as const satisfies readonly DesktopActionKindV1[]);\n\nexport const requiresDesktopUserConfirmation = (kind: DesktopActionKindV1): boolean =>\n\t(DESKTOP_USER_CONFIRMATION_ACTIONS as readonly DesktopActionKindV1[]).includes(kind);\n\nexport interface DesktopActionV1 {\n\treadonly version: 1;\n\treadonly kind: DesktopActionKindV1;\n\treadonly target?: DesktopTargetRefV1;\n\treadonly text?: string;\n\treadonly key?: string;\n}\n\nexport type DesktopPostconditionV1 =\n\t| { readonly kind: \"window-exists\"; readonly windowId: string }\n\t| { readonly kind: \"control-exists\"; readonly controlId: string }\n\t| { readonly kind: \"focused\"; readonly controlId: string }\n\t| {\n\t\t\treadonly kind: \"property-equals\";\n\t\t\treadonly target: DesktopTargetRefV1;\n\t\t\treadonly property: \"enabled\" | \"value\" | \"name\";\n\t\t\treadonly expected: boolean | string;\n\t };\n\nexport interface DesktopOperationRequestV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly sessionId: string;\n\treadonly action: DesktopActionV1;\n\treadonly postconditions?: readonly DesktopPostconditionV1[];\n\treadonly reobserveAfterAction?: boolean;\n}\n\nexport interface DesktopVerificationV1 {\n\treadonly status: \"passed\" | \"failed\" | \"unknown\";\n\treadonly checks: readonly string[];\n}\n\nexport interface DesktopOperationResultV1 {\n\treadonly version: 1;\n\treadonly operationId: string;\n\treadonly status: PluginResultStatusV1;\n\treadonly summary: string;\n\treadonly observation?: DesktopObservationV1;\n\treadonly verification?: DesktopVerificationV1;\n\treadonly error?: DesktopErrorV1;\n}\n\nexport interface DesktopReplayRequestV1 {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly operations: readonly DesktopOperationRequestV1[];\n\treadonly stopOnFailure: boolean;\n}\n\n/** Returns the first operation id that would cross the replay session boundary. */\nexport const findDesktopReplaySessionMismatch = (request: DesktopReplayRequestV1): string | undefined => {\n\tfor (const operation of request.operations) {\n\t\tif (operation.sessionId !== request.sessionId) return operation.operationId;\n\t}\n\treturn undefined;\n};\n\nexport interface DesktopReplayResultV1 {\n\treadonly version: 1;\n\treadonly status: Extract<PluginResultStatusV1, \"succeeded\" | \"failed\" | \"cancelled\" | \"needs_user\">;\n\treadonly results: readonly DesktopOperationResultV1[];\n}\n\n/** Structured result of one primary-display screenshot capture. */\nexport interface DesktopScreenshotResultV1 {\n\treadonly version: 1;\n\treadonly source: \"windows-gdi\";\n\treadonly status: \"succeeded\" | \"unsupported\" | \"failed\";\n\treadonly mimeType?: \"image/png\";\n\t/** Base64-encoded PNG payload; present only on success. */\n\treadonly data?: string;\n\t/** Delivered (post-scaling) pixel dimensions. */\n\treadonly width?: number;\n\treadonly height?: number;\n\t/** Captured display pixel dimensions before scaling. */\n\treadonly originalWidth?: number;\n\treadonly originalHeight?: number;\n\t/** originalWidth / width. */\n\treadonly scale?: number;\n\treadonly capturedAt?: string;\n\treadonly error?: DesktopErrorV1;\n}\n\n/**\n * Read-only GDI screenshot driver boundary. It stays separate from\n * DesktopWindowsDriverV1 so UIA-only driver implementations (test drivers,\n * remote brokers) are not forced to implement screen capture.\n */\nexport interface DesktopScreenshotDriverV1 {\n\treadonly driverId: string;\n\treadonly driverVersion: string;\n\tscreenshot(): DesktopScreenshotResultV1;\n}\n\nexport interface DesktopAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\treadonly capabilities: readonly DesktopCapabilityIdV1[];\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\treobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n\treplay(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n\t/** Read-only primary-display capture; adapters delegate to a screenshot-capable driver. */\n\tscreenshot(): DesktopScreenshotResultV1;\n}\n\n/** Result returned by a host UI Automation capability probe. */\nexport interface DesktopWindowsProbeV1 {\n\treadonly available: boolean;\n\treadonly platform: string;\n\treadonly driver: \"windows-uia\";\n\t/** Capabilities that the host can expose without relying on a higher-risk facade. */\n\treadonly capabilities?: readonly DesktopCapabilityIdV1[];\n\treadonly reason?: string;\n}\n\n/**\n * Synchronous host boundary used by the Windows adapter. Implementations may\n * use UI Automation, an OS broker, or a test driver. The adapter never\n * invents observations when this boundary reports unavailable.\n */\nexport interface DesktopWindowsDriverV1 {\n\treadonly driverId: string;\n\treadonly driverVersion: string;\n\tprobe(): DesktopWindowsProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n}\n\n/**\n * Production-safe, read-only desktop boundary. It deliberately omits\n * execute/replay so a host cannot accidentally expose input through the\n * observe plugin. The full DesktopAdapter remains a separate test/high-risk\n * contract.\n */\nexport interface DesktopReadonlyAdapterV1 {\n\treadonly adapterId: string;\n\treadonly adapterVersion: string;\n\tprobe(): DesktopWindowsProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\treobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n\t/** Read-only primary-display capture; adapters delegate to a screenshot-capable driver. */\n\tscreenshot(): DesktopScreenshotResultV1;\n}\n\n/**\n * Production host boundary for intentionally bounded desktop input. This is\n * separate from DesktopReadonlyAdapterV1 so observing a desktop never\n * accidentally grants input, and replay is optional: adapters that expose it\n * keep the session-mismatch gate and the needs-user confirmation per action.\n */\nexport interface DesktopFullControlAdapterV1 extends DesktopReadonlyAdapterV1 {\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\treplay?(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DesktopAdapterV1, DesktopCapabilityIdV1, DesktopObservationV1, DesktopOperationRequestV1, DesktopOperationResultV1, DesktopReplayRequestV1, DesktopReplayResultV1, DesktopSessionRequestV1, DesktopSessionResultV1, DesktopSessionV1, DesktopWindowsDriverV1, DesktopWindowsProbeV1 } from "./types.ts";
|
|
1
|
+
import type { DesktopAdapterV1, DesktopCapabilityIdV1, DesktopObservationV1, DesktopOperationRequestV1, DesktopOperationResultV1, DesktopReplayRequestV1, DesktopReplayResultV1, DesktopScreenshotDriverV1, DesktopScreenshotResultV1, DesktopSessionRequestV1, DesktopSessionResultV1, DesktopSessionV1, DesktopWindowsDriverV1, DesktopWindowsProbeV1 } from "./types.ts";
|
|
2
2
|
type UiAutomationSpawnResult = {
|
|
3
3
|
readonly error?: Error;
|
|
4
4
|
readonly status: number | null;
|
|
@@ -9,6 +9,8 @@ type UiAutomationSpawn = (command: string, args: readonly string[], options: {
|
|
|
9
9
|
readonly timeout: number;
|
|
10
10
|
readonly windowsHide: boolean;
|
|
11
11
|
readonly env: NodeJS.ProcessEnv;
|
|
12
|
+
/** Raised only for the screenshot script so multi-MiB PNG payloads survive. */
|
|
13
|
+
readonly maxBuffer?: number;
|
|
12
14
|
}) => UiAutomationSpawnResult;
|
|
13
15
|
export interface WindowsUiAutomationDriverOptions {
|
|
14
16
|
/** Override the PowerShell executable for a brokered host or test harness. */
|
|
@@ -19,7 +21,7 @@ export interface WindowsUiAutomationDriverOptions {
|
|
|
19
21
|
/** Override the platform reported to the driver; intended for host adapters/tests. */
|
|
20
22
|
readonly platform?: NodeJS.Platform;
|
|
21
23
|
}
|
|
22
|
-
export declare class WindowsUiAutomationDriver implements DesktopWindowsDriverV1 {
|
|
24
|
+
export declare class WindowsUiAutomationDriver implements DesktopWindowsDriverV1, DesktopScreenshotDriverV1 {
|
|
23
25
|
readonly driverId = "windows-uia";
|
|
24
26
|
readonly driverVersion = "1.0.0";
|
|
25
27
|
private readonly command;
|
|
@@ -38,7 +40,10 @@ export declare class WindowsUiAutomationDriver implements DesktopWindowsDriverV1
|
|
|
38
40
|
openSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;
|
|
39
41
|
observe(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
40
42
|
execute(request: DesktopOperationRequestV1): DesktopOperationResultV1;
|
|
43
|
+
private completeAction;
|
|
41
44
|
stop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;
|
|
45
|
+
/** Capture the primary display through GDI; the PNG is scaled to a 1280px width cap. */
|
|
46
|
+
screenshot(): DesktopScreenshotResultV1;
|
|
42
47
|
private run;
|
|
43
48
|
private toObservation;
|
|
44
49
|
private resolveTarget;
|
|
@@ -62,6 +67,8 @@ export declare class DesktopWindowsAdapter implements DesktopAdapterV1 {
|
|
|
62
67
|
reobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
63
68
|
execute(request: DesktopOperationRequestV1): DesktopOperationResultV1;
|
|
64
69
|
stop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;
|
|
70
|
+
/** Delegates to the driver when it implements DesktopScreenshotDriverV1; structured unsupported otherwise. */
|
|
71
|
+
screenshot(): DesktopScreenshotResultV1;
|
|
65
72
|
replay(request: DesktopReplayRequestV1): DesktopReplayResultV1;
|
|
66
73
|
}
|
|
67
74
|
export {};
|