@hasna/computer 0.1.1 → 0.1.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.
@@ -0,0 +1,33 @@
1
+ /** A UI element from the accessibility tree */
2
+ export interface AXElement {
3
+ role: string | null;
4
+ title: string | null;
5
+ value: string | null;
6
+ label: string | null;
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ enabled: boolean;
12
+ focused: boolean;
13
+ children: number;
14
+ }
15
+ /**
16
+ * Query the accessibility tree for a given app (or the frontmost app).
17
+ * Returns structured UI elements with roles, titles, positions, and sizes.
18
+ * Requires Accessibility permissions in System Settings.
19
+ */
20
+ export declare function queryAccessibilityTree(opts?: {
21
+ /** App name to query (default: frontmost app) */
22
+ app?: string;
23
+ /** Only get the focused element's subtree */
24
+ focusedOnly?: boolean;
25
+ /** Max tree depth (default: 3) */
26
+ depth?: number;
27
+ }): Promise<AXElement[]>;
28
+ /**
29
+ * Build a text summary of the accessibility tree for the AI model.
30
+ * Includes clickable elements with positions for precise targeting.
31
+ */
32
+ export declare function summarizeAccessibilityTree(elements: AXElement[]): string;
33
+ //# sourceMappingURL=accessibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../../src/drivers/mac/accessibility.ts"],"names":[],"mappings":"AAIA,+CAA+C;AAC/C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,CAAC,EAAE;IAClD,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CA+BvB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAsBxE"}
@@ -4,11 +4,17 @@ import type { ComputerDriver, DriverAction, ActionResult, ScreenSize, Screenshot
4
4
  * Requires: macOS, cliclick (brew install cliclick), Accessibility permissions.
5
5
  */
6
6
  export declare class MacDriver implements ComputerDriver {
7
+ private displayNumber?;
8
+ constructor(opts?: {
9
+ displayNumber?: number;
10
+ });
7
11
  getScreenSize(): Promise<ScreenSize>;
8
12
  screenshot(): Promise<Screenshot>;
9
13
  execute(action: DriverAction): Promise<ActionResult>;
10
14
  dispose(): Promise<void>;
11
15
  }
12
16
  /** Create a macOS driver */
13
- export declare function createMacDriver(): ComputerDriver;
17
+ export declare function createMacDriver(opts?: {
18
+ displayNumber?: number;
19
+ }): ComputerDriver;
14
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drivers/mac/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAI/G;;;GAGG;AACH,qBAAa,SAAU,YAAW,cAAc;IACxC,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAIpC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IAIjC,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAIpD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B;AAED,4BAA4B;AAC5B,wBAAgB,eAAe,IAAI,cAAc,CAEhD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drivers/mac/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAI/G;;;GAGG;AACH,qBAAa,SAAU,YAAW,cAAc;IAC9C,OAAO,CAAC,aAAa,CAAC,CAAS;gBAEnB,IAAI,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE;IAIvC,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAIpC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IAIjC,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAIpD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B;AAED,4BAA4B;AAC5B,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,CAEjF"}
@@ -3,7 +3,7 @@ import type { Screenshot, ScreenSize } from "../../types/index.js";
3
3
  * Capture a screenshot using macOS screencapture.
4
4
  * Returns base64 PNG data and screen dimensions.
5
5
  */
6
- export declare function captureScreenshot(): Promise<Screenshot>;
6
+ export declare function captureScreenshot(displayNumber?: number): Promise<Screenshot>;
7
7
  /**
8
8
  * Get the main display screen size using system_profiler.
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../../src/drivers/mac/screenshot.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAyB7D;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CA8BzD;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAKjB"}
1
+ {"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../../src/drivers/mac/screenshot.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA+BnF;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CA8BzD;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAKjB"}
package/dist/index.d.ts CHANGED
@@ -10,6 +10,11 @@ export { createMacDriver, MacDriver } from "./drivers/mac/index.js";
10
10
  export { captureScreenshot, getScreenSize, saveScreenshotToFile } from "./drivers/mac/screenshot.js";
11
11
  export { executeAction } from "./drivers/mac/input.js";
12
12
  export { createProvider, createAnthropicProvider, createOpenAIProvider } from "./providers/index.js";
13
+ export { queryAccessibilityTree, summarizeAccessibilityTree } from "./drivers/mac/accessibility.js";
14
+ export type { AXElement } from "./drivers/mac/accessibility.js";
15
+ export { runPostSessionIntegrations, saveToRecordings, registerWithSessions, pushToLogs } from "./lib/integrations.js";
16
+ export { registerAgent, heartbeat, setFocus, getAgent, listAgents } from "./db/agents.js";
17
+ export type { Agent } from "./db/agents.js";
13
18
  export { checkAction, resetRateLimiter } from "./agent/safety.js";
14
19
  export type { SafetyCheckResult } from "./agent/safety.js";
15
20
  export { loadConfig, saveConfig, getConfigValue, setConfigValue, getConfigPath, DEFAULT_CONFIG } from "./lib/config.js";
@@ -17,5 +22,7 @@ export type { ComputerConfig } from "./lib/config.js";
17
22
  export { calculateCost, formatCost, stepCost, listPricing } from "./lib/pricing.js";
18
23
  export { scaleScreenshot, getScaledSize, RECOMMENDED_WIDTHS } from "./lib/scale.js";
19
24
  export { screenshotsMatch, computeScreenHash, compareHashes } from "./lib/diff.js";
25
+ export { renderInlineImage, supportsInlineImages, detectProtocol } from "./lib/terminal-image.js";
26
+ export type { TerminalProtocol } from "./lib/terminal-image.js";
20
27
  export { getDb, createSession, updateSession, logAction, getSession, listSessions, getActionLogs, deleteSession, getStats, searchSessions, searchActionLogs, } from "./db/index.js";
21
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,QAAQ,EACR,WAAW,EACX,KAAK,EACL,UAAU,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,UAAU,EACV,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGrG,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,YAAY,EAAE,iBAAiB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