Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

chore: remove build artifacts from git (dist/, *.js)

Mario29c5657fd9a5
diff --git a/.gitignore b/.gitignore
index 7db7b15e..70df2354 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,16 @@ browser-bridge
/pinchtab
coverage.out
+# Build artifacts
+dist/
+*.js
+!scripts/**/*.js
+!npm/bin/pinchtab
+
+# npm package
+npm/node_modules/
+npm/package-lock.json
+
# OpenClaw workspace files (should never be committed)
.openclaw/
SOUL.md
diff --git a/npm/dist/download.d.ts b/npm/dist/download.d.ts
deleted file mode 100644
index 2603b6c2..00000000
--- a/npm/dist/download.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export declare function ensureBinary(): Promise<string>;
diff --git a/npm/dist/download.js b/npm/dist/download.js
deleted file mode 100644
index 3b4b458c..00000000
--- a/npm/dist/download.js
+++ /dev/null
@@ -1,119 +0,0 @@
-"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || (function () {
- var ownKeys = function(o) {
- ownKeys = Object.getOwnPropertyNames || function (o) {
- var ar = [];
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
- return ar;
- };
- return ownKeys(o);
- };
- return function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
- __setModuleDefault(result, mod);
- return result;
- };
-})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.ensureBinary = ensureBinary;
-const fs = __importStar(require("fs"));
-const path = __importStar(require("path"));
-const https = __importStar(require("https"));
-const GITHUB_REPO = 'pinchtab/pinchtab';
-const VERSION = '0.7.0';
-function detectPlatform() {
- const platform = process.platform;
- const arch = process.arch === 'arm64' ? 'arm64' : 'x64';
- const osMap = {
- darwin: 'darwin',
- linux: 'linux',
- win32: 'windows',
- };
- const os = osMap[platform];
- if (!os) {
- throw new Error(`Unsupported platform: ${platform}`);
- }
- return { os, arch };
-}
-function getBinaryName(platform) {
- const { os, arch } = platform;
- const archName = arch === 'arm64' ? 'arm64' : 'x64';
- if (os === 'windows') {
- return `pinchtab-${os}-${archName}.exe`;
- }
- return `pinchtab-${os}-${archName}`;
-}
-function getBinDir() {
- return path.join(process.env.HOME || process.env.USERPROFILE || '', '.pinchtab', 'bin');
-}
-async function downloadBinary(platform) {
- const binaryName = getBinaryName(platform);
- const binDir = getBinDir();
- const binaryPath = path.join(binDir, binaryName);
- // Skip if already exists
- if (fs.existsSync(binaryPath)) {
- console.log(`✓ Pinchtab binary already present: ${binaryPath}`);
- return;
- }
- const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/${binaryName}`;
- console.log(`Downloading Pinchtab ${VERSION} for ${platform.os}-${platform.arch}...`);
- console.log(`URL: ${downloadUrl}`);
- // Ensure directory exists
- if (!fs.existsSync(binDir)) {
- fs.mkdirSync(binDir, { recursive: true });
- }
- return new Promise((resolve, reject) => {
- https
- .get(downloadUrl, (response) => {
- if (response.statusCode === 404) {
- reject(new Error(`Binary not found: ${downloadUrl}. Make sure v${VERSION} is released on GitHub.`));
- return;
- }
- if (response.statusCode !== 200) {
- reject(new Error(`Download failed with status ${response.statusCode}`));
- return;
- }
- const file = fs.createWriteStream(binaryPath);
- response.pipe(file);
- file.on('finish', () => {
- file.close();
- // Make executable
- fs.chmodSync(binaryPath, 0o755);
- console.log(`✓ Downloaded to ${binaryPath}`);
- resolve();
- });
- file.on('error', (err) => {
- fs.unlink(binaryPath, () => { });
- reject(err);
- });
- })
- .on('error', (err) => {
- reject(err);
- });
- });
-}
-async function ensureBinary() {
- const platform = detectPlatform();
- await downloadBinary(platform);
- const binDir = getBinDir();
- const binaryName = getBinaryName(platform);
- return path.join(binDir, binaryName);
-}
diff --git a/npm/dist/index.d.ts b/npm/dist/index.d.ts
deleted file mode 100644
index acb3cf3d..00000000
--- a/npm/dist/index.d.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { SnapshotParams, SnapshotResponse, TabClickParams, TabLockParams, TabUnlockParams, CreateTabParams, CreateTabResponse, PinchtabOptions } from './types';
-export * from './types';
-export declare class Pinchtab {
- private baseUrl;
- private timeout;
- private port;
- private process;
- private binaryPath;
- constructor(options?: PinchtabOptions);
- /**
- * Start the Pinchtab server process
- */
- start(binaryPath?: string): Promise<void>;
- /**
- * Stop the Pinchtab server process
- */
- stop(): Promise<void>;
- /**
- * Take a snapshot of the current tab
- */
- snapshot(params?: SnapshotParams): Promise<SnapshotResponse>;
- /**
- * Click on a UI element
- */
- click(params: TabClickParams): Promise<void>;
- /**
- * Lock a tab
- */
- lock(params: TabLockParams): Promise<void>;
- /**
- * Unlock a tab
- */
- unlock(params: TabUnlockParams): Promise<void>;
- /**
- * Create a new tab
- */
- createTab(params: CreateTabParams): Promise<CreateTabResponse>;
- /**
- * Make a request to the Pinchtab API
- */
- private request;
- /**
- * Get the path to the Pinchtab binary
- */
- private getBinaryPath;
- private getBinaryName;
-}
-export default Pinchtab;
diff --git a/npm/dist/index.js b/npm/dist/index.js
deleted file mode 100644
index 0f8431f6..00000000
--- a/npm/dist/index.js
+++ /dev/null
@@ -1,174 +0,0 @@
-"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || (function () {
- var ownKeys = function(o) {
- ownKeys = Object.getOwnPropertyNames || function (o) {
- var ar = [];
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
- return ar;
- };
- return ownKeys(o);
- };
- return function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
- __setModuleDefault(result, mod);
- return result;
- };
-})();
-var __exportStar = (this && this.__exportStar) || function(m, exports) {
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Pinchtab = void 0;
-const child_process_1 = require("child_process");
-const path = __importStar(require("path"));
-const fs = __importStar(require("fs"));
-__exportStar(require("./types"), exports);
-class Pinchtab {
- constructor(options = {}) {
- this.process = null;
- this.binaryPath = null;
- this.port = options.port || 9867;
- this.baseUrl = options.baseUrl || `http://localhost:${this.port}`;
- this.timeout = options.timeout || 30000;
- }
- /**
- * Start the Pinchtab server process
- */
- async start(binaryPath) {
- if (this.process) {
- throw new Error('Pinchtab process already running');
- }
- if (!binaryPath) {
- binaryPath = await this.getBinaryPath();
- }
- this.binaryPath = binaryPath;
- return new Promise((resolve, reject) => {
- this.process = (0, child_process_1.spawn)(binaryPath, ['serve', `--port=${this.port}`], {
- stdio: 'inherit',
- });
- this.process.on('error', (err) => {
- reject(new Error(`Failed to start Pinchtab: ${err.message}`));
- });
- // Give the server a moment to start
- setTimeout(resolve, 500);
- });
- }
- /**
- * Stop the Pinchtab server process
- */
- async stop() {
- if (this.process) {
- return new Promise((resolve) => {
- this.process?.kill();
- this.process = null;
- resolve();
- });
- }
- }
- /**
- * Take a snapshot of the current tab
- */
- async snapshot(params) {
- return this.request('/snapshot', params);
- }
- /**
- * Click on a UI element
- */
- async click(params) {
- await this.request('/tab/click', params);
- }
- /**
- * Lock a tab
- */
- async lock(params) {
- await this.request('/tab/lock', params);
- }
- /**
- * Unlock a tab
- */
- async unlock(params) {
- await this.request('/tab/unlock', params);
- }
- /**
- * Create a new tab
- */
- async createTab(params) {
- return this.request('/tab/create', params);
- }
- /**
- * Make a request to the Pinchtab API
- */
- async request(path, body) {
- const url = `${this.baseUrl}${path}`;
- const controller = new AbortController();
- const timeoutId = setTimeout(() => controller.abort(), this.timeout);
- try {
- const response = await fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: body ? JSON.stringify(body) : undefined,
- signal: controller.signal,
- });
- if (!response.ok) {
- const error = await response.text();
- throw new Error(`${response.status}: ${error}`);
- }
- return response.json();
- }
- finally {
- clearTimeout(timeoutId);
- }
- }
- /**
- * Get the path to the Pinchtab binary
- */
- async getBinaryPath() {
- const homedir = require('os').homedir();
- const defaultPath = path.join(homedir, '.pinchtab', 'bin', this.getBinaryName());
- if (fs.existsSync(defaultPath)) {
- return defaultPath;
- }
- // Try relative to package
- const relativePath = path.join(__dirname, '..', 'bin', this.getBinaryName());
- if (fs.existsSync(relativePath)) {
- return relativePath;
- }
- throw new Error(`Pinchtab binary not found. Please run: npm run postinstall or ensure the binary is in ~/.pinchtab/bin/`);
- }
- getBinaryName() {
- const platform = process.platform;
- const arch = process.arch === 'arm64' ? 'arm64' : 'x64';
- if (platform === 'darwin') {
- return `pinchtab-darwin-${arch}`;
- }
- else if (platform === 'linux') {
- return `pinchtab-linux-${arch}`;
- }
- else if (platform === 'win32') {
- return `pinchtab-windows-${arch}.exe`;
- }
- throw new Error(`Unsupported platform: ${platform}`);
- }
-}
-exports.Pinchtab = Pinchtab;
-exports.default = Pinchtab;
diff --git a/npm/dist/src/download.d.ts b/npm/dist/src/download.d.ts
deleted file mode 100644
index 2603b6c2..00000000
--- a/npm/dist/src/download.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export declare function ensureBinary(): Promise<string>;
diff --git a/npm/dist/src/download.js b/npm/dist/src/download.js
deleted file mode 100644
index 3b4b458c..00000000
--- a/npm/dist/src/download.js
+++ /dev/null
@@ -1,119 +0,0 @@
-"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || (function () {
- var ownKeys = function(o) {
- ownKeys = Object.getOwnPropertyNames || function (o) {
- var ar = [];
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
- return ar;
- };
- return ownKeys(o);
- };
- return function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
- __setModuleDefault(result, mod);
- return result;
- };
-})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.ensureBinary = ensureBinary;
-const fs = __importStar(require("fs"));
-const path = __importStar(require("path"));
-const https = __importStar(require("https"));
-const GITHUB_REPO = 'pinchtab/pinchtab';
-const VERSION = '0.7.0';
-function detectPlatform() {
- const platform = process.platform;
- const arch = process.arch === 'arm64' ? 'arm64' : 'x64';
- const osMap = {
- darwin: 'darwin',
- linux: 'linux',
- win32: 'windows',
- };
- const os = osMap[platform];
- if (!os) {
- throw new Error(`Unsupported platform: ${platform}`);
- }
- return { os, arch };
-}
-function getBinaryName(platform) {
- const { os, arch } = platform;
- const archName = arch === 'arm64' ? 'arm64' : 'x64';
- if (os === 'windows') {
- return `pinchtab-${os}-${archName}.exe`;
- }
- return `pinchtab-${os}-${archName}`;
-}
-function getBinDir() {
- return path.join(process.env.HOME || process.env.USERPROFILE || '', '.pinchtab', 'bin');
-}
-async function downloadBinary(platform) {
- const binaryName = getBinaryName(platform);
- const binDir = getBinDir();
- const binaryPath = path.join(binDir, binaryName);
- // Skip if already exists
- if (fs.existsSync(binaryPath)) {
- console.log(`✓ Pinchtab binary already present: ${binaryPath}`);
- return;
- }
- const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/${binaryName}`;
- console.log(`Downloading Pinchtab ${VERSION} for ${platform.os}-${platform.arch}...`);
- console.log(`URL: ${downloadUrl}`);
- // Ensure directory exists
- if (!fs.existsSync(binDir)) {
- fs.mkdirSync(binDir, { recursive: true });
- }
- return new Promise((resolve, reject) => {
- https
- .get(downloadUrl, (response) => {
- if (response.statusCode === 404) {
- reject(new Error(`Binary not found: ${downloadUrl}. Make sure v${VERSION} is released on GitHub.`));
- return;
- }
- if (response.statusCode !== 200) {
- reject(new Error(`Download failed with status ${response.statusCode}`));
- return;
- }
- const file = fs.createWriteStream(binaryPath);
- response.pipe(file);
- file.on('finish', () => {
- file.close();
- // Make executable
- fs.chmodSync(binaryPath, 0o755);
- console.log(`✓ Downloaded to ${binaryPath}`);
- resolve();
- });
- file.on('error', (err) => {
- fs.unlink(binaryPath, () => { });
- reject(err);
- });
- })
- .on('error', (err) => {
- reject(err);
- });
- });
-}
-async function ensureBinary() {
- const platform = detectPlatform();
- await downloadBinary(platform);
- const binDir = getBinDir();
- const binaryName = getBinaryName(platform);
- return path.join(binDir, binaryName);
-}
diff --git a/npm/dist/src/index.d.ts b/npm/dist/src/index.d.ts
deleted file mode 100644
index acb3cf3d..00000000
--- a/npm/dist/src/index.d.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { SnapshotParams, SnapshotResponse, TabClickParams, TabLockParams, TabUnlockParams, CreateTabParams, CreateTabResponse, PinchtabOptions } from './types';
-export * from './types';
-export declare class Pinchtab {
- private baseUrl;
- private timeout;
- private port;
- private process;
- private binaryPath;
- constructor(options?: PinchtabOptions);
- /**
- * Start the Pinchtab server process
- */
- start(binaryPath?: string): Promise<void>;
- /**
- * Stop the Pinchtab server process
- */
- stop(): Promise<void>;
- /**
- * Take a snapshot of the current tab
- */
- snapshot(params?: SnapshotParams): Promise<SnapshotResponse>;
- /**
- * Click on a UI element
- */
- click(params: TabClickParams): Promise<void>;
- /**
- * Lock a tab
- */
- lock(params: TabLockParams): Promise<void>;
- /**
- * Unlock a tab
- */
- unlock(params: TabUnlockParams): Promise<void>;
- /**
- * Create a new tab
- */
- createTab(params: CreateTabParams): Promise<CreateTabResponse>;
- /**
- * Make a request to the Pinchtab API
- */
- private request;
- /**
- * Get the path to the Pinchtab binary
- */
- private getBinaryPath;
- private getBinaryName;
-}
-export default Pinchtab;
diff --git a/npm/dist/src/index.js b/npm/dist/src/index.js
deleted file mode 100644
index 0f8431f6..00000000
--- a/npm/dist/src/index.js
+++ /dev/null
@@ -1,174 +0,0 @@
-"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || (function () {
- var ownKeys = function(o) {
- ownKeys = Object.getOwnPropertyNames || function (o) {
- var ar = [];
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
- return ar;
- };
- return ownKeys(o);
- };
- return function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
- __setModuleDefault(result, mod);
- return result;
- };
-})();
-var __exportStar = (this && this.__exportStar) || function(m, exports) {
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Pinchtab = void 0;
-const child_process_1 = require("child_process");
-const path = __importStar(require("path"));
-const fs = __importStar(require("fs"));
-__exportStar(require("./types"), exports);
-class Pinchtab {
- constructor(options = {}) {
- this.process = null;
- this.binaryPath = null;
- this.port = options.port || 9867;
- this.baseUrl = options.baseUrl || `http://localhost:${this.port}`;
- this.timeout = options.timeout || 30000;
- }
- /**
- * Start the Pinchtab server process
- */
- async start(binaryPath) {
- if (this.process) {
- throw new Error('Pinchtab process already running');
- }
- if (!binaryPath) {
- binaryPath = await this.getBinaryPath();
- }
- this.binaryPath = binaryPath;
- return new Promise((resolve, reject) => {
- this.process = (0, child_process_1.spawn)(binaryPath, ['serve', `--port=${this.port}`], {
- stdio: 'inherit',
- });
- this.process.on('error', (err) => {
- reject(new Error(`Failed to start Pinchtab: ${err.message}`));
- });
- // Give the server a moment to start
- setTimeout(resolve, 500);
- });
- }
- /**
- * Stop the Pinchtab server process
- */
- async stop() {
- if (this.process) {
- return new Promise((resolve) => {
- this.process?.kill();
- this.process = null;
- resolve();
- });
- }
- }
- /**
- * Take a snapshot of the current tab
- */
- async snapshot(params) {
- return this.request('/snapshot', params);
- }
- /**
- * Click on a UI element
- */
- async click(params) {
- await this.request('/tab/click', params);
- }
- /**
- * Lock a tab
- */
- async lock(params) {
- await this.request('/tab/lock', params);
- }
- /**
- * Unlock a tab
- */
- async unlock(params) {
- await this.request('/tab/unlock', params);
- }
- /**
- * Create a new tab
- */
- async createTab(params) {
- return this.request('/tab/create', params);
- }
- /**
- * Make a request to the Pinchtab API
- */
- async request(path, body) {
- const url = `${this.baseUrl}${path}`;
- const controller = new AbortController();
- const timeoutId = setTimeout(() => controller.abort(), this.timeout);
- try {
- const response = await fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: body ? JSON.stringify(body) : undefined,
- signal: controller.signal,
- });
- if (!response.ok) {
- const error = await response.text();
- throw new Error(`${response.status}: ${error}`);
- }
- return response.json();
- }
- finally {
- clearTimeout(timeoutId);
- }
- }
- /**
- * Get the path to the Pinchtab binary
- */
- async getBinaryPath() {
- const homedir = require('os').homedir();
- const defaultPath = path.join(homedir, '.pinchtab', 'bin', this.getBinaryName());
- if (fs.existsSync(defaultPath)) {
- return defaultPath;
- }
- // Try relative to package
- const relativePath = path.join(__dirname, '..', 'bin', this.getBinaryName());
- if (fs.existsSync(relativePath)) {
- return relativePath;
- }
- throw new Error(`Pinchtab binary not found. Please run: npm run postinstall or ensure the binary is in ~/.pinchtab/bin/`);
- }
- getBinaryName() {
- const platform = process.platform;
- const arch = process.arch === 'arm64' ? 'arm64' : 'x64';
- if (platform === 'darwin') {
- return `pinchtab-darwin-${arch}`;
- }
- else if (platform === 'linux') {
- return `pinchtab-linux-${arch}`;
- }
- else if (platform === 'win32') {
- return `pinchtab-windows-${arch}.exe`;
- }
- throw new Error(`Unsupported platform: ${platform}`);
- }
-}
-exports.Pinchtab = Pinchtab;
-exports.default = Pinchtab;
diff --git a/npm/dist/src/types.d.ts b/npm/dist/src/types.d.ts
deleted file mode 100644
index 95d085bb..00000000
--- a/npm/dist/src/types.d.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-export interface SnapshotParams {
- refs?: 'role' | 'aria';
- selector?: string;
- maxTokens?: number;
- format?: 'full' | 'compact';
-}
-export interface SnapshotResponse {
- html: string;
- refs?: Record<string, any>;
-}
-export interface TabClickParams {
- ref: string;
- targetId?: string;
-}
-export interface TabLockParams {
- tabId: string;
- timeoutMs?: number;
-}
-export interface TabUnlockParams {
- tabId: string;
-}
-export interface CreateTabParams {
- url: string;
- stealth?: 'light' | 'full';
-}
-export interface CreateTabResponse {
- tabId: string;
-}
-export interface PinchtabOptions {
- baseUrl?: string;
- timeout?: number;
- port?: number;
-}
diff --git a/npm/dist/src/types.js b/npm/dist/src/types.js
deleted file mode 100644
index c8ad2e54..00000000
--- a/npm/dist/src/types.js
+++ /dev/null
@@ -1,2 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
diff --git a/npm/dist/tests/integration.test.d.ts b/npm/dist/tests/integration.test.d.ts
deleted file mode 100644
index cb0ff5c3..00000000
--- a/npm/dist/tests/integration.test.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export {};
diff --git a/npm/dist/tests/integration.test.js b/npm/dist/tests/integration.test.js
deleted file mode 100644
index 149e4023..00000000
--- a/npm/dist/tests/integration.test.js
+++ /dev/null
@@ -1,137 +0,0 @@
-"use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = { enumerable: true, get: function() { return m[k]; } };
- }
- Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
-}));
-var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
- Object.defineProperty(o, "default", { enumerable: true, value: v });
-}) : function(o, v) {
- o["default"] = v;
-});
-var __importStar = (this && this.__importStar) || (function () {
- var ownKeys = function(o) {
- ownKeys = Object.getOwnPropertyNames || function (o) {
- var ar = [];
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
- return ar;
- };
- return ownKeys(o);
- };
- return function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
- __setModuleDefault(result, mod);
- return result;
- };
-})();
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const node_test_1 = require("node:test");
-const assert = __importStar(require("node:assert"));
-const index_1 = __importDefault(require("../src/index"));
-const fs = __importStar(require("fs"));
-const path = __importStar(require("path"));
-const os = __importStar(require("os"));
-(0, node_test_1.describe)('Pinchtab npm Integration Tests', () => {
- let pinch;
- const testPort = 9867;
- (0, node_test_1.before)(async () => {
- // Check if binary exists before running tests
- const binDir = path.join(os.homedir(), '.pinchtab', 'bin');
- const platform = process.platform === 'darwin' ? 'darwin' : process.platform === 'linux' ? 'linux' : 'windows';
- const arch = process.arch === 'arm64' ? 'arm64' : 'x64';
- const ext = platform === 'windows' ? '.exe' : '';
- const binaryPath = path.join(binDir, `pinchtab-${platform}-${arch}${ext}`);
- if (!fs.existsSync(binaryPath)) {
- console.warn(`⚠ Binary not found at ${binaryPath}`);
- console.warn('Tests will skip binary execution. Build the Go binary and place it at:');
- console.warn(` ${binaryPath}`);
- }
- pinch = new index_1.default({ port: testPort });
- });
- (0, node_test_1.after)(async () => {
- // Clean up: stop server if running
- try {
- await pinch.stop();
- }
- catch (e) {
- // Ignore
- }
- });
- (0, node_test_1.test)('should import Pinchtab class', () => {
- assert.ok(typeof index_1.default === 'function');
- assert.ok(pinch instanceof index_1.default);
- });
- (0, node_test_1.test)('should initialize with default options', () => {
- const client = new index_1.default();
- assert.ok(client);
- });
- (0, node_test_1.test)('should initialize with custom port', () => {
- const client = new index_1.default({ port: 9999 });
- assert.ok(client);
- });
- (0, node_test_1.test)('should have API methods defined', () => {
- assert.strictEqual(typeof pinch.start, 'function');
- assert.strictEqual(typeof pinch.stop, 'function');
- assert.strictEqual(typeof pinch.snapshot, 'function');
- assert.strictEqual(typeof pinch.click, 'function');
- assert.strictEqual(typeof pinch.lock, 'function');
- assert.strictEqual(typeof pinch.unlock, 'function');
- assert.strictEqual(typeof pinch.createTab, 'function');
- });
- (0, node_test_1.test)('should start server (requires binary)', async () => {
- const client = new index_1.default({ port: testPort });
- try {
- await client.start();
- // Give server a moment to be ready
- await new Promise(r => setTimeout(r, 1000));
- // Try a simple health check
- const response = await fetch(`http://localhost:${testPort}/`);
- assert.ok(response.status !== undefined);
- await client.stop();
- }
- catch (err) {
- const errorMsg = err.message;
- if (errorMsg.includes('ENOENT') || errorMsg.includes('not found')) {
- console.log('⊘ Binary not available — skipping start test');
- }
- else {
- throw err;
- }
- }
- });
- (0, node_test_1.test)('should handle missing binary gracefully', async () => {
- const client = new index_1.default({ port: 9998 });
- try {
- await client.start('/nonexistent/path/to/binary');
- // If we get here, the binary exists (unusual test environment)
- }
- catch (err) {
- assert.ok(err instanceof Error);
- assert.ok(err.message.includes('Failed to start') ||
- err.message.includes('ENOENT'));
- }
- });
- (0, node_test_1.test)('should reject invalid request to non-running server', async () => {
- const client = new index_1.default({ port: 9997 });
- try {
- await client.snapshot();
- // Should not reach here
- assert.fail('Expected connection error');
- }
- catch (err) {
- // Expected — server not running
- assert.ok(err instanceof Error);
- }
- });
-});
diff --git a/npm/dist/types.d.ts b/npm/dist/types.d.ts
deleted file mode 100644
index 95d085bb..00000000
--- a/npm/dist/types.d.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-export interface SnapshotParams {
- refs?: 'role' | 'aria';
- selector?: string;
- maxTokens?: number;
- format?: 'full' | 'compact';
-}
-export interface SnapshotResponse {
- html: string;
- refs?: Record<string, any>;
-}
-export interface TabClickParams {
- ref: string;
- targetId?: string;
-}
-export interface TabLockParams {
- tabId: string;
- timeoutMs?: number;
-}
-export interface TabUnlockParams {
- tabId: string;
-}
-export interface CreateTabParams {
- url: string;
- stealth?: 'light' | 'full';
-}
-export interface CreateTabResponse {
- tabId: string;
-}
-export interface PinchtabOptions {
- baseUrl?: string;
- timeout?: number;
- port?: number;
-}
diff --git a/npm/dist/types.js b/npm/dist/types.js
deleted file mode 100644
index c8ad2e54..00000000
--- a/npm/dist/types.js
+++ /dev/null
@@ -1,2 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });