@namzu/sdk 48.2.0 → 48.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,7 @@ export interface ComputerUseCapabilities {
30
30
  readonly keyboard: boolean
31
31
  readonly cursorPosition: boolean
32
32
  readonly clipboard: boolean
33
- /** Exact action subset when known. Refines the broad flags; absent retains their legacy interpretation. */
33
+ /** Display action subset when known. Window capture and input are a separate path. */
34
34
  readonly supportedActions?: readonly ComputerUseAction['type'][]
35
35
  /** Supported click buttons; absent leaves button admission to the host. */
36
36
  readonly mouseClickButtons?: readonly MouseButton[]
@@ -50,6 +50,16 @@ export interface ComputerUseCapabilities {
50
50
  * offer `list_windows` or `focus_window`, even when the methods exist.
51
51
  */
52
52
  readonly windows?: boolean
53
+ /**
54
+ * The host can capture and act on one named window without sharing the
55
+ * whole desktop. Requires `captureWindow` and `executeWindow`.
56
+ */
57
+ readonly windowCapture?: boolean
58
+ /**
59
+ * Whether scoped pixel scrolling can be delivered safely. Explicit false
60
+ * refuses it before a batch starts; absent retains host-defined behavior.
61
+ */
62
+ readonly windowScroll?: boolean
53
63
  /**
54
64
  * The host implements {@link ComputerUseHost.captureRegion}. Absent or
55
65
  * false, `zoom` still works: the tool crops a full capture instead, which
@@ -71,12 +81,13 @@ export interface ComputerUseCapabilities {
71
81
  // ---------------------------------------------------------------------------
72
82
  // Geometry + screenshot payload
73
83
  //
74
- // Units, once for the whole file: every coordinate and size a host accepts or
75
- // returns is in PHYSICAL pixels — the pixels of the captured bitmap, not
76
- // logical points or DPI-scaled units. A 3440x1440 monitor at 150 % scaling is
77
- // 3440x1440 here. A point a host is asked to act on is relative to the
78
- // top-left of the display it last captured (the primary display until a host
79
- // offers display selection); the host adds that display's origin itself.
84
+ // Display actions use PHYSICAL pixels, not logical points or DPI-scaled
85
+ // units. A 3440x1440 monitor at 150 % scaling is 3440x1440 here. A point a
86
+ // host is asked to act on is relative to the top-left of the display it last
87
+ // captured (the primary display until a host offers display selection); the
88
+ // host adds that display's origin itself. Window actions are the explicit
89
+ // exception: their coordinates are pixels of captureWindow's returned PNG,
90
+ // which the window driver may have downscaled.
80
91
  // Window and UI-element bounds are the exception and say so: they are in
81
92
  // virtual-desktop physical pixels, because a window can span displays.
82
93
  // ---------------------------------------------------------------------------
@@ -146,6 +157,45 @@ export interface WindowInfo {
146
157
  readonly minimized: boolean
147
158
  }
148
159
 
160
+ /** A PNG of one window. Its pixels are window-local, not display-relative. */
161
+ export interface WindowScreenshotResult {
162
+ readonly data: Buffer
163
+ readonly mimeType: 'image/png'
164
+ /** Pixel size of the exact PNG returned by the host. */
165
+ readonly width: number
166
+ readonly height: number
167
+ readonly window: WindowInfo
168
+ /**
169
+ * Opaque capture token. The host rejects actions after another window
170
+ * capture, driver restart, session revival, or target geometry change.
171
+ */
172
+ readonly captureId: string
173
+ /** A limitation of this capture, when the driver reports one. */
174
+ readonly captureCoverage?: string
175
+ }
176
+
177
+ /** How input is delivered to a captured window. Foreground may briefly activate it. */
178
+ export type WindowDeliveryMode = 'background' | 'foreground'
179
+
180
+ /** Window-local actions. A window-scoped mouse move is not a real OS move. */
181
+ export type WindowInputAction =
182
+ | Extract<ComputerUseAction, { readonly type: 'mouse_click' | 'mouse_drag' | 'scroll' }>
183
+ /** Foreground delivery sends text to the verified target window. */
184
+ | {
185
+ readonly type: 'type_text'
186
+ readonly text: string
187
+ readonly delivery_mode?: WindowDeliveryMode
188
+ }
189
+ /**
190
+ * `foreground` explicitly permits the host to bring the verified target
191
+ * window forward for keys its background input path cannot deliver.
192
+ */
193
+ | {
194
+ readonly type: 'key'
195
+ readonly keys: string
196
+ readonly delivery_mode?: WindowDeliveryMode
197
+ }
198
+
149
199
  /**
150
200
  * What {@link ComputerUseHost.focusWindow} achieved. Bringing a window to
151
201
  * the front is a request the operating system can refuse (Windows'
@@ -334,6 +384,14 @@ export interface ComputerUseHost {
334
384
  * with {@link ComputerUseCapabilities.windows}.
335
385
  */
336
386
  focusWindow?(id: string): Promise<FocusWindowResult>
387
+ /** Capture a named window. Never silently replace a failed capture with the desktop. */
388
+ captureWindow?(id: string): Promise<WindowScreenshotResult>
389
+ /**
390
+ * Act in the PNG pixel space of `captureId`. The host must verify the
391
+ * capture is current and still belongs to the same process/window before
392
+ * dispatching input. No implicit fallback to display input is permitted.
393
+ */
394
+ executeWindow?(captureId: string, action: WindowInputAction): Promise<void>
337
395
  /**
338
396
  * Capture one region of the current display at full physical resolution.
339
397
  * `rect` is display-relative physical pixels; the result's `width` and