@ai-agent-forge/plugin-desktop-macos-input 0.0.0-stage → 0.88.4
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 +16 -0
- package/README.md +55 -2
- package/agent-forge.json +31 -0
- package/dist/capability.d.ts +21 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +456 -0
- package/dist/capability.js.map +1 -0
- package/dist/entry.d.ts +16 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +17 -0
- package/dist/entry.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/macos-ax-adapter.d.ts +72 -0
- package/dist/macos-ax-adapter.d.ts.map +1 -0
- package/dist/macos-ax-adapter.js +805 -0
- package/dist/macos-ax-adapter.js.map +1 -0
- package/dist/projection.d.ts +114 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/projection.js +226 -0
- package/dist/projection.js.map +1 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +30 -0
- package/dist/shared.js.map +1 -0
- package/dist/types.d.ts +223 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/package.json +56 -5
- package/plugin.json +20 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,SAAS,WAAW,CAAC,KAAc,EAAE,MAAe,EAA2B;IAC9E,MAAM,KAAK,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IACpD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,KAAgC,CAAC;AAAA,CACxC;AAED,MAAM,UAAU,cAAc,CAC7B,KAAc,EACd,MAAe,EAC6D;IAC5E,OAAO;QACN,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;QACjC,WAAW,EAAE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,2BAA2B;KACnG,CAAC;AAAA,CACF;AAED,MAAM,UAAU,UAAU,CAAC,KAAc,EAA2B;IACnE,OAAO,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAAA,CACxD;AAED,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,KAAa,EAAU;IACrE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,6BAA6B,CAAC,CAAC;IAC7G,OAAO,KAAK,CAAC;AAAA,CACb","sourcesContent":["/**\n * Inlined from agent-forge `src/profile/runtime-capabilities-shared.ts`\n * (D-075 S3 extraction), mirrored from the Windows desktop plugin packages,\n * so this package keeps its dependency closure limited to the plugin SDK and\n * typebox. Semantics are unchanged; the artifact-ref schema helpers stay\n * host-side because desktop tools do not use them. Deliberate copy shared\n * with `plugins/desktop-macos-input/src/shared.ts`; keep both copies in sync.\n */\n\nfunction objectInput(first: unknown, second: unknown): Record<string, unknown> {\n\tconst value = second === undefined ? first : second;\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(\"Plugin tool input must be an object\");\n\t}\n\treturn value as Record<string, unknown>;\n}\n\nexport function toolInvocation(\n\tfirst: unknown,\n\tsecond: unknown,\n): { readonly input: Record<string, unknown>; readonly operationId: string } {\n\treturn {\n\t\tinput: objectInput(first, second),\n\t\toperationId: typeof first === \"string\" && first.trim() !== \"\" ? first : \"profile-runtime-tool-call\",\n\t};\n}\n\nexport function signalFrom(value: unknown): AbortSignal | undefined {\n\treturn value instanceof AbortSignal ? value : undefined;\n}\n\nexport function nonEmptyString(value: unknown, label: string): string {\n\tif (typeof value !== \"string\" || value.trim() === \"\") throw new Error(`${label} must be a non-empty string`);\n\treturn value;\n}\n"]}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type { PluginResultStatusV1 } from "@agent-forge/plugin-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* macOS counterpart of the desktop plugin family contract, derived from the
|
|
4
|
+
* Windows package copies (`plugins/desktop-windows-observe/src/types.ts`,
|
|
5
|
+
* itself inlined from agent-forge `src/plugins/desktop/types.ts`, D-075 S3)
|
|
6
|
+
* so this package keeps its dependency closure limited to the plugin SDK and
|
|
7
|
+
* typebox. This file is a deliberate copy shared (not imported) with
|
|
8
|
+
* `plugins/desktop-macos-input/src/types.ts`; keep both copies in sync.
|
|
9
|
+
* Differences from the Windows copies:
|
|
10
|
+
* - The observation `source` union carries `"macos-ax"` instead of
|
|
11
|
+
* `"windows-uia"`; `"mock"` stays the test-fixture source.
|
|
12
|
+
* - Probe/driver types are `DesktopMacosProbeV1` / `DesktopMacosDriverV1`
|
|
13
|
+
* with `driver: "macos-ax"`, plus a read-only driver subset
|
|
14
|
+
* (`DesktopMacosReadonlyDriverV1`) so the observe package never carries an
|
|
15
|
+
* execute surface.
|
|
16
|
+
* - `DesktopTargetRefV1` gains the `coordinates` variant used by the input
|
|
17
|
+
* package's coordinate click (x/y integer non-negative screen coordinates,
|
|
18
|
+
* click-only by ruling); the observe package never consumes it.
|
|
19
|
+
* - Replay request/result types stay because the capability factory keeps the
|
|
20
|
+
* Windows factory contract (optional replay registration when the runtime
|
|
21
|
+
* exposes a replay method); the shipped macOS facades expose no replay.
|
|
22
|
+
*/
|
|
23
|
+
/** Stable capability ids owned by the desktop-control plugin family. */
|
|
24
|
+
export type DesktopCapabilityIdV1 = "desktop-session" | "desktop-uia" | "desktop-input" | "desktop-vision" | "desktop-replay";
|
|
25
|
+
export type DesktopSessionIsolationV1 = "mock" | "foreground" | "vm";
|
|
26
|
+
export type DesktopSessionStatusV1 = "ready" | "unavailable" | "stopped";
|
|
27
|
+
export interface DesktopSessionRequestV1 {
|
|
28
|
+
readonly version: 1;
|
|
29
|
+
readonly isolation: DesktopSessionIsolationV1;
|
|
30
|
+
readonly applicationId?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface DesktopSessionV1 {
|
|
33
|
+
readonly version: 1;
|
|
34
|
+
readonly sessionId: string;
|
|
35
|
+
readonly isolation: DesktopSessionIsolationV1;
|
|
36
|
+
readonly status: DesktopSessionStatusV1;
|
|
37
|
+
readonly applicationId?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface DesktopErrorV1 {
|
|
40
|
+
readonly version: 1;
|
|
41
|
+
readonly code: string;
|
|
42
|
+
readonly message: string;
|
|
43
|
+
readonly causeCode?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface DesktopSessionResultV1 {
|
|
46
|
+
readonly status: Extract<PluginResultStatusV1, "succeeded" | "unsupported" | "failed">;
|
|
47
|
+
readonly session?: DesktopSessionV1;
|
|
48
|
+
readonly error?: DesktopErrorV1;
|
|
49
|
+
}
|
|
50
|
+
export interface DesktopWindowIdentityV1 {
|
|
51
|
+
readonly version: 1;
|
|
52
|
+
readonly windowId: string;
|
|
53
|
+
readonly appId: string;
|
|
54
|
+
readonly title: string;
|
|
55
|
+
readonly bounds: DesktopBoundsV1;
|
|
56
|
+
}
|
|
57
|
+
export interface DesktopControlIdentityV1 {
|
|
58
|
+
readonly version: 1;
|
|
59
|
+
readonly controlId: string;
|
|
60
|
+
readonly windowId: string;
|
|
61
|
+
readonly role: string;
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly bounds: DesktopBoundsV1;
|
|
64
|
+
readonly enabled: boolean;
|
|
65
|
+
readonly value?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface DesktopBoundsV1 {
|
|
68
|
+
readonly x: number;
|
|
69
|
+
readonly y: number;
|
|
70
|
+
readonly width: number;
|
|
71
|
+
readonly height: number;
|
|
72
|
+
}
|
|
73
|
+
export interface DesktopObservationV1 {
|
|
74
|
+
readonly version: 1;
|
|
75
|
+
readonly sessionId: string;
|
|
76
|
+
readonly observationId: string;
|
|
77
|
+
readonly source: "mock" | "macos-ax";
|
|
78
|
+
readonly windows: readonly DesktopWindowIdentityV1[];
|
|
79
|
+
readonly controls: readonly DesktopControlIdentityV1[];
|
|
80
|
+
readonly focusedControlId?: string;
|
|
81
|
+
}
|
|
82
|
+
export type DesktopTargetRefV1 = {
|
|
83
|
+
readonly kind: "window";
|
|
84
|
+
readonly windowId: string;
|
|
85
|
+
} | {
|
|
86
|
+
readonly kind: "control";
|
|
87
|
+
readonly controlId: string;
|
|
88
|
+
readonly windowId?: string;
|
|
89
|
+
}
|
|
90
|
+
/** Screen-coordinate target; input-side click only (x/y integer, non-negative). */
|
|
91
|
+
| {
|
|
92
|
+
readonly kind: "coordinates";
|
|
93
|
+
readonly x: number;
|
|
94
|
+
readonly y: number;
|
|
95
|
+
};
|
|
96
|
+
export type DesktopActionKindV1 = "focus" | "click" | "type" | "key" | "scroll" | "submit" | "uac" | "password" | "admin" | "payment" | "external-submit";
|
|
97
|
+
/**
|
|
98
|
+
* Actions that must pause at the host/user boundary before any input is sent.
|
|
99
|
+
* This policy belongs to the desktop plugin, not Agent Core.
|
|
100
|
+
*/
|
|
101
|
+
export declare const DESKTOP_USER_CONFIRMATION_ACTIONS: readonly ["uac", "password", "admin", "payment", "external-submit"];
|
|
102
|
+
export declare const requiresDesktopUserConfirmation: (kind: DesktopActionKindV1) => boolean;
|
|
103
|
+
export interface DesktopActionV1 {
|
|
104
|
+
readonly version: 1;
|
|
105
|
+
readonly kind: DesktopActionKindV1;
|
|
106
|
+
readonly target?: DesktopTargetRefV1;
|
|
107
|
+
readonly text?: string;
|
|
108
|
+
readonly key?: string;
|
|
109
|
+
}
|
|
110
|
+
export type DesktopPostconditionV1 = {
|
|
111
|
+
readonly kind: "window-exists";
|
|
112
|
+
readonly windowId: string;
|
|
113
|
+
} | {
|
|
114
|
+
readonly kind: "control-exists";
|
|
115
|
+
readonly controlId: string;
|
|
116
|
+
} | {
|
|
117
|
+
readonly kind: "focused";
|
|
118
|
+
readonly controlId: string;
|
|
119
|
+
} | {
|
|
120
|
+
readonly kind: "property-equals";
|
|
121
|
+
readonly target: DesktopTargetRefV1;
|
|
122
|
+
readonly property: "enabled" | "value" | "name";
|
|
123
|
+
readonly expected: boolean | string;
|
|
124
|
+
};
|
|
125
|
+
export interface DesktopOperationRequestV1 {
|
|
126
|
+
readonly version: 1;
|
|
127
|
+
readonly operationId: string;
|
|
128
|
+
readonly sessionId: string;
|
|
129
|
+
readonly action: DesktopActionV1;
|
|
130
|
+
readonly postconditions?: readonly DesktopPostconditionV1[];
|
|
131
|
+
readonly reobserveAfterAction?: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface DesktopVerificationV1 {
|
|
134
|
+
readonly status: "passed" | "failed" | "unknown";
|
|
135
|
+
readonly checks: readonly string[];
|
|
136
|
+
}
|
|
137
|
+
export interface DesktopOperationResultV1 {
|
|
138
|
+
readonly version: 1;
|
|
139
|
+
readonly operationId: string;
|
|
140
|
+
readonly status: PluginResultStatusV1;
|
|
141
|
+
readonly summary: string;
|
|
142
|
+
readonly observation?: DesktopObservationV1;
|
|
143
|
+
readonly verification?: DesktopVerificationV1;
|
|
144
|
+
readonly error?: DesktopErrorV1;
|
|
145
|
+
}
|
|
146
|
+
export interface DesktopReplayRequestV1 {
|
|
147
|
+
readonly version: 1;
|
|
148
|
+
readonly sessionId: string;
|
|
149
|
+
readonly operations: readonly DesktopOperationRequestV1[];
|
|
150
|
+
readonly stopOnFailure: boolean;
|
|
151
|
+
}
|
|
152
|
+
/** Returns the first operation id that would cross the replay session boundary. */
|
|
153
|
+
export declare const findDesktopReplaySessionMismatch: (request: DesktopReplayRequestV1) => string | undefined;
|
|
154
|
+
export interface DesktopReplayResultV1 {
|
|
155
|
+
readonly version: 1;
|
|
156
|
+
readonly status: Extract<PluginResultStatusV1, "succeeded" | "failed" | "cancelled" | "needs_user">;
|
|
157
|
+
readonly results: readonly DesktopOperationResultV1[];
|
|
158
|
+
}
|
|
159
|
+
export interface DesktopAdapterV1 {
|
|
160
|
+
readonly adapterId: string;
|
|
161
|
+
readonly adapterVersion: string;
|
|
162
|
+
readonly capabilities: readonly DesktopCapabilityIdV1[];
|
|
163
|
+
openSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;
|
|
164
|
+
observe(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
165
|
+
reobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
166
|
+
execute(request: DesktopOperationRequestV1): DesktopOperationResultV1;
|
|
167
|
+
stop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;
|
|
168
|
+
replay(request: DesktopReplayRequestV1): DesktopReplayResultV1;
|
|
169
|
+
}
|
|
170
|
+
/** Result returned by the macOS Accessibility capability probe. */
|
|
171
|
+
export interface DesktopMacosProbeV1 {
|
|
172
|
+
readonly available: boolean;
|
|
173
|
+
readonly platform: string;
|
|
174
|
+
readonly driver: "macos-ax";
|
|
175
|
+
/** Capabilities that the host can expose without relying on a higher-risk facade. */
|
|
176
|
+
readonly capabilities?: readonly DesktopCapabilityIdV1[];
|
|
177
|
+
readonly reason?: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Read-only macOS host boundary used by the observe package's driver.
|
|
181
|
+
* Implementations may use the Accessibility tree through System Events, an OS
|
|
182
|
+
* broker, or a test driver. The adapter never invents observations when this
|
|
183
|
+
* boundary reports unavailable.
|
|
184
|
+
*/
|
|
185
|
+
export interface DesktopMacosReadonlyDriverV1 {
|
|
186
|
+
readonly driverId: string;
|
|
187
|
+
readonly driverVersion: string;
|
|
188
|
+
probe(): DesktopMacosProbeV1;
|
|
189
|
+
openSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;
|
|
190
|
+
observe(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
191
|
+
stop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;
|
|
192
|
+
}
|
|
193
|
+
/** Full macOS host boundary used by the input package's driver. */
|
|
194
|
+
export interface DesktopMacosDriverV1 extends DesktopMacosReadonlyDriverV1 {
|
|
195
|
+
execute(request: DesktopOperationRequestV1): DesktopOperationResultV1;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Production-safe, read-only desktop boundary. It deliberately omits
|
|
199
|
+
* execute/replay so a host cannot accidentally expose input through the
|
|
200
|
+
* observe plugin. The full DesktopAdapter remains a separate test/high-risk
|
|
201
|
+
* contract.
|
|
202
|
+
*/
|
|
203
|
+
export interface DesktopReadonlyAdapterV1 {
|
|
204
|
+
readonly adapterId: string;
|
|
205
|
+
readonly adapterVersion: string;
|
|
206
|
+
probe(): DesktopMacosProbeV1;
|
|
207
|
+
openSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;
|
|
208
|
+
observe(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
209
|
+
reobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;
|
|
210
|
+
stop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Production host boundary for intentionally bounded desktop input. This is
|
|
214
|
+
* separate from DesktopReadonlyAdapterV1 so observing a desktop never
|
|
215
|
+
* accidentally grants input, and replay is optional: adapters that expose it
|
|
216
|
+
* keep the session-mismatch gate and the needs-user confirmation per action.
|
|
217
|
+
* The shipped macOS input facade deliberately exposes no replay method.
|
|
218
|
+
*/
|
|
219
|
+
export interface DesktopFullControlAdapterV1 extends DesktopReadonlyAdapterV1 {
|
|
220
|
+
execute(request: DesktopOperationRequestV1): DesktopOperationResultV1;
|
|
221
|
+
replay?(request: DesktopReplayRequestV1): DesktopReplayResultV1;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;GAoBG;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,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAA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wBAAwB,CAAC;CACrE;AAED;;;;;;GAMG;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 * macOS counterpart of the desktop plugin family contract, derived from the\n * Windows package copies (`plugins/desktop-windows-observe/src/types.ts`,\n * itself inlined from agent-forge `src/plugins/desktop/types.ts`, D-075 S3)\n * so this package keeps its dependency closure limited to the plugin SDK and\n * typebox. This file is a deliberate copy shared (not imported) with\n * `plugins/desktop-macos-input/src/types.ts`; keep both copies in sync.\n * Differences from the Windows copies:\n * - The observation `source` union carries `\"macos-ax\"` instead of\n * `\"windows-uia\"`; `\"mock\"` stays the test-fixture source.\n * - Probe/driver types are `DesktopMacosProbeV1` / `DesktopMacosDriverV1`\n * with `driver: \"macos-ax\"`, plus a read-only driver subset\n * (`DesktopMacosReadonlyDriverV1`) so the observe package never carries an\n * execute surface.\n * - `DesktopTargetRefV1` gains the `coordinates` variant used by the input\n * package's coordinate click (x/y integer non-negative screen coordinates,\n * click-only by ruling); the observe package never consumes it.\n * - Replay request/result types stay because the capability factory keeps the\n * Windows factory contract (optional replay registration when the runtime\n * exposes a replay method); the shipped macOS facades expose no replay.\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\" | \"macos-ax\";\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/** Screen-coordinate target; input-side click only (x/y integer, non-negative). */\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\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 the macOS Accessibility capability probe. */\nexport interface DesktopMacosProbeV1 {\n\treadonly available: boolean;\n\treadonly platform: string;\n\treadonly driver: \"macos-ax\";\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 * Read-only macOS host boundary used by the observe package's driver.\n * Implementations may use the Accessibility tree through System Events, an OS\n * broker, or a test driver. The adapter never invents observations when this\n * boundary reports unavailable.\n */\nexport interface DesktopMacosReadonlyDriverV1 {\n\treadonly driverId: string;\n\treadonly driverVersion: string;\n\tprobe(): DesktopMacosProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n}\n\n/** Full macOS host boundary used by the input package's driver. */\nexport interface DesktopMacosDriverV1 extends DesktopMacosReadonlyDriverV1 {\n\texecute(request: DesktopOperationRequestV1): 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(): DesktopMacosProbeV1;\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 * The shipped macOS input facade deliberately exposes no replay method.\n */\nexport interface DesktopFullControlAdapterV1 extends DesktopReadonlyAdapterV1 {\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\treplay?(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n}\n"]}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actions that must pause at the host/user boundary before any input is sent.
|
|
3
|
+
* This policy belongs to the desktop plugin, not Agent Core.
|
|
4
|
+
*/
|
|
5
|
+
export const DESKTOP_USER_CONFIRMATION_ACTIONS = Object.freeze([
|
|
6
|
+
"uac",
|
|
7
|
+
"password",
|
|
8
|
+
"admin",
|
|
9
|
+
"payment",
|
|
10
|
+
"external-submit",
|
|
11
|
+
]);
|
|
12
|
+
export const requiresDesktopUserConfirmation = (kind) => DESKTOP_USER_CONFIRMATION_ACTIONS.includes(kind);
|
|
13
|
+
/** Returns the first operation id that would cross the replay session boundary. */
|
|
14
|
+
export const findDesktopReplaySessionMismatch = (request) => {
|
|
15
|
+
for (const operation of request.operations) {
|
|
16
|
+
if (operation.sessionId !== request.sessionId)
|
|
17
|
+
return operation.operationId;
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqHA;;;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 * macOS counterpart of the desktop plugin family contract, derived from the\n * Windows package copies (`plugins/desktop-windows-observe/src/types.ts`,\n * itself inlined from agent-forge `src/plugins/desktop/types.ts`, D-075 S3)\n * so this package keeps its dependency closure limited to the plugin SDK and\n * typebox. This file is a deliberate copy shared (not imported) with\n * `plugins/desktop-macos-input/src/types.ts`; keep both copies in sync.\n * Differences from the Windows copies:\n * - The observation `source` union carries `\"macos-ax\"` instead of\n * `\"windows-uia\"`; `\"mock\"` stays the test-fixture source.\n * - Probe/driver types are `DesktopMacosProbeV1` / `DesktopMacosDriverV1`\n * with `driver: \"macos-ax\"`, plus a read-only driver subset\n * (`DesktopMacosReadonlyDriverV1`) so the observe package never carries an\n * execute surface.\n * - `DesktopTargetRefV1` gains the `coordinates` variant used by the input\n * package's coordinate click (x/y integer non-negative screen coordinates,\n * click-only by ruling); the observe package never consumes it.\n * - Replay request/result types stay because the capability factory keeps the\n * Windows factory contract (optional replay registration when the runtime\n * exposes a replay method); the shipped macOS facades expose no replay.\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\" | \"macos-ax\";\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/** Screen-coordinate target; input-side click only (x/y integer, non-negative). */\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\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 the macOS Accessibility capability probe. */\nexport interface DesktopMacosProbeV1 {\n\treadonly available: boolean;\n\treadonly platform: string;\n\treadonly driver: \"macos-ax\";\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 * Read-only macOS host boundary used by the observe package's driver.\n * Implementations may use the Accessibility tree through System Events, an OS\n * broker, or a test driver. The adapter never invents observations when this\n * boundary reports unavailable.\n */\nexport interface DesktopMacosReadonlyDriverV1 {\n\treadonly driverId: string;\n\treadonly driverVersion: string;\n\tprobe(): DesktopMacosProbeV1;\n\topenSession(request: DesktopSessionRequestV1): DesktopSessionResultV1;\n\tobserve(sessionId: string): DesktopObservationV1 | DesktopOperationResultV1;\n\tstop(sessionId: string): DesktopSessionV1 | DesktopOperationResultV1;\n}\n\n/** Full macOS host boundary used by the input package's driver. */\nexport interface DesktopMacosDriverV1 extends DesktopMacosReadonlyDriverV1 {\n\texecute(request: DesktopOperationRequestV1): 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(): DesktopMacosProbeV1;\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 * The shipped macOS input facade deliberately exposes no replay method.\n */\nexport interface DesktopFullControlAdapterV1 extends DesktopReadonlyAdapterV1 {\n\texecute(request: DesktopOperationRequestV1): DesktopOperationResultV1;\n\treplay?(request: DesktopReplayRequestV1): DesktopReplayResultV1;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@ai-agent-forge/plugin-desktop-macos-input",
|
|
3
|
+
"version": "0.88.4",
|
|
4
|
+
"description": "Bounded macOS desktop input capability plugin for Agent Forge (desktop_execute; no replay)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"MANUAL.md",
|
|
17
|
+
"agent-forge.json",
|
|
18
|
+
"plugin.json",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"clean": "shx rm -rf dist",
|
|
23
|
+
"build": "tsgo -p tsconfig.build.json",
|
|
24
|
+
"test": "vitest --run",
|
|
25
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"agent-forge",
|
|
29
|
+
"plugin",
|
|
30
|
+
"desktop",
|
|
31
|
+
"macos",
|
|
32
|
+
"accessibility",
|
|
33
|
+
"input"
|
|
34
|
+
],
|
|
35
|
+
"author": "Agent Forge contributors",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/agent-forge/agent-forge.git",
|
|
40
|
+
"directory": "plugins/desktop-macos-input"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/agent-forge/agent-forge/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/agent-forge/agent-forge#readme",
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=22.19.0"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"typebox": "1.3.27",
|
|
51
|
+
"@ai-agent-forge/plugin-sdk": "^0.88.4"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"shx": "0.4.0",
|
|
55
|
+
"vitest": "4.1.11"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "agent-forge.plugin.desktop-macos-input",
|
|
3
|
+
"version": "0.88.4",
|
|
4
|
+
"apiVersion": "1-draft",
|
|
5
|
+
"entry": "./dist/entry.js",
|
|
6
|
+
"hostVersion": ">=0.84.4",
|
|
7
|
+
"description": "macOS 桌面真实输入:CGEvent HID 级鼠标点击/移动与键盘注入、AX 元素动作,observe→act→reobserve 闭环",
|
|
8
|
+
"activation": "on-demand",
|
|
9
|
+
"manual": "./MANUAL.md",
|
|
10
|
+
"requiredCapabilities": [
|
|
11
|
+
"tools"
|
|
12
|
+
],
|
|
13
|
+
"provides": [
|
|
14
|
+
{
|
|
15
|
+
"id": "desktop-input",
|
|
16
|
+
"version": 1,
|
|
17
|
+
"kind": "contribution"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|