react-native-ai-devtools 1.3.4 → 1.3.5
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/README.md +20 -2
- package/build/__tests__/unit/fingerprint.test.d.ts +2 -0
- package/build/__tests__/unit/fingerprint.test.d.ts.map +1 -0
- package/build/__tests__/unit/fingerprint.test.js +89 -0
- package/build/__tests__/unit/fingerprint.test.js.map +1 -0
- package/build/core/config.d.ts +8 -0
- package/build/core/config.d.ts.map +1 -0
- package/build/core/config.js +27 -0
- package/build/core/config.js.map +1 -0
- package/build/core/fingerprint.d.ts +4 -0
- package/build/core/fingerprint.d.ts.map +1 -0
- package/build/core/fingerprint.js +47 -0
- package/build/core/fingerprint.js.map +1 -0
- package/build/core/license.d.ts +3 -1
- package/build/core/license.d.ts.map +1 -1
- package/build/core/license.js +94 -19
- package/build/core/license.js.map +1 -1
- package/build/core/sdkBridge.d.ts +54 -29
- package/build/core/sdkBridge.d.ts.map +1 -1
- package/build/core/sdkBridge.js +116 -36
- package/build/core/sdkBridge.js.map +1 -1
- package/build/core/telemetry.js +1 -1
- package/build/core/telemetry.js.map +1 -1
- package/build/index.js +148 -9
- package/build/index.js.map +1 -1
- package/build/tools/accountTools.d.ts +44 -0
- package/build/tools/accountTools.d.ts.map +1 -0
- package/build/tools/accountTools.js +188 -0
- package/build/tools/accountTools.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1242,7 +1242,7 @@ The server prioritizes devices in this order:
|
|
|
1242
1242
|
- Try `clear_logs` then trigger some actions in the app
|
|
1243
1243
|
- Check `get_apps` to verify connection status
|
|
1244
1244
|
|
|
1245
|
-
## Telemetry
|
|
1245
|
+
## Telemetry & Data Collection
|
|
1246
1246
|
|
|
1247
1247
|
This package collects anonymous usage telemetry to help improve the product. No personal information is collected.
|
|
1248
1248
|
|
|
@@ -1259,9 +1259,25 @@ This package collects anonymous usage telemetry to help improve the product. No
|
|
|
1259
1259
|
|
|
1260
1260
|
**Not collected**: No file paths, code content, network data, or personally identifiable information.
|
|
1261
1261
|
|
|
1262
|
+
### Auto-registration
|
|
1263
|
+
|
|
1264
|
+
On first tool use, the package automatically registers your installation with our backend. No account or login is required — the Tool works fully out of the box.
|
|
1265
|
+
|
|
1266
|
+
**Why we do this:** The product roadmap includes features that build on installation identity — project memory (your AI assistant gets smarter with every session by remembering navigation maps, element signatures, and debug patterns), cloud sync across machines, team collaboration with shared debugging context, and a Pro dashboard for managing installations and subscriptions. Auto-registration lays the groundwork so these features work seamlessly when they ship, without requiring a disruptive setup step later.
|
|
1267
|
+
|
|
1268
|
+
**What is sent:**
|
|
1269
|
+
|
|
1270
|
+
- A random installation ID (UUID)
|
|
1271
|
+
- A device fingerprint (one-way SHA-256 hash — cannot be reversed to recover its components)
|
|
1272
|
+
- Platform, hostname, OS version, and server version
|
|
1273
|
+
|
|
1274
|
+
**What is NOT sent:** No source code, file paths, console logs, network data, component names, or any content from your app. The fingerprint exists solely to prevent installation hijacking — it ties your installation to your physical machine so no one else can claim it.
|
|
1275
|
+
|
|
1276
|
+
Registration is fire-and-forget — it never blocks your work, fails silently if the network is unavailable, and can be disabled entirely (see Opt-out below). See [PRIVACY.md](./PRIVACY.md) for full details on data handling, storage, and your rights.
|
|
1277
|
+
|
|
1262
1278
|
### Opt-out
|
|
1263
1279
|
|
|
1264
|
-
To disable telemetry, set the environment variable:
|
|
1280
|
+
To disable telemetry and auto-registration, set the environment variable:
|
|
1265
1281
|
|
|
1266
1282
|
```bash
|
|
1267
1283
|
export RN_DEBUGGER_TELEMETRY=false
|
|
@@ -1273,6 +1289,8 @@ Or inline:
|
|
|
1273
1289
|
RN_DEBUGGER_TELEMETRY=false npx react-native-ai-devtools
|
|
1274
1290
|
```
|
|
1275
1291
|
|
|
1292
|
+
All debugging tools work normally with telemetry disabled. For the complete privacy policy, see [PRIVACY.md](./PRIVACY.md).
|
|
1293
|
+
|
|
1276
1294
|
## License
|
|
1277
1295
|
|
|
1278
1296
|
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/fingerprint.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jest } from "@jest/globals";
|
|
2
|
+
const mockExecSync = jest.fn();
|
|
3
|
+
jest.unstable_mockModule("child_process", () => ({
|
|
4
|
+
execSync: mockExecSync,
|
|
5
|
+
}));
|
|
6
|
+
const mockReadFileSync = jest.fn();
|
|
7
|
+
const mockExistsSync = jest.fn();
|
|
8
|
+
jest.unstable_mockModule("fs", () => ({
|
|
9
|
+
readFileSync: mockReadFileSync,
|
|
10
|
+
existsSync: mockExistsSync,
|
|
11
|
+
}));
|
|
12
|
+
const mockUserInfo = jest.fn();
|
|
13
|
+
const mockCpus = jest.fn();
|
|
14
|
+
const mockPlatform = jest.fn();
|
|
15
|
+
jest.unstable_mockModule("os", () => ({
|
|
16
|
+
userInfo: mockUserInfo,
|
|
17
|
+
cpus: mockCpus,
|
|
18
|
+
platform: mockPlatform,
|
|
19
|
+
}));
|
|
20
|
+
const { getDeviceFingerprint, getMachineId } = await import("../../core/fingerprint.js");
|
|
21
|
+
describe("fingerprint", () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
jest.clearAllMocks();
|
|
24
|
+
mockUserInfo.mockReturnValue({ username: "testuser" });
|
|
25
|
+
mockCpus.mockReturnValue([{ model: "Apple M2 Pro" }]);
|
|
26
|
+
});
|
|
27
|
+
describe("getMachineId", () => {
|
|
28
|
+
it("reads hardware UUID on macOS", () => {
|
|
29
|
+
mockPlatform.mockReturnValue("darwin");
|
|
30
|
+
mockExecSync.mockReturnValue("Hardware UUID: ABC123-DEF456-GHI789\n");
|
|
31
|
+
const id = getMachineId();
|
|
32
|
+
expect(id).toBe("ABC123-DEF456-GHI789");
|
|
33
|
+
expect(mockExecSync).toHaveBeenCalledWith("system_profiler SPHardwareDataType", expect.any(Object));
|
|
34
|
+
});
|
|
35
|
+
it("reads /etc/machine-id on Linux", () => {
|
|
36
|
+
mockPlatform.mockReturnValue("linux");
|
|
37
|
+
mockExistsSync.mockReturnValue(true);
|
|
38
|
+
mockReadFileSync.mockReturnValue("abc123def456\n");
|
|
39
|
+
const id = getMachineId();
|
|
40
|
+
expect(id).toBe("abc123def456");
|
|
41
|
+
});
|
|
42
|
+
it("reads MachineGuid from registry on Windows", () => {
|
|
43
|
+
mockPlatform.mockReturnValue("win32");
|
|
44
|
+
mockExecSync.mockReturnValue(" MachineGuid REG_SZ {12345-ABCDE}\n");
|
|
45
|
+
const id = getMachineId();
|
|
46
|
+
expect(id).toBe("{12345-ABCDE}");
|
|
47
|
+
});
|
|
48
|
+
it("returns empty string on unsupported platform", () => {
|
|
49
|
+
mockPlatform.mockReturnValue("freebsd");
|
|
50
|
+
const id = getMachineId();
|
|
51
|
+
expect(id).toBe("");
|
|
52
|
+
});
|
|
53
|
+
it("returns empty string when command fails", () => {
|
|
54
|
+
mockPlatform.mockReturnValue("darwin");
|
|
55
|
+
mockExecSync.mockImplementation(() => {
|
|
56
|
+
throw new Error("command not found");
|
|
57
|
+
});
|
|
58
|
+
const id = getMachineId();
|
|
59
|
+
expect(id).toBe("");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe("getDeviceFingerprint", () => {
|
|
63
|
+
it("returns consistent SHA256 hash", () => {
|
|
64
|
+
mockPlatform.mockReturnValue("darwin");
|
|
65
|
+
mockExecSync.mockReturnValue("Hardware UUID: ABC123\n");
|
|
66
|
+
const fp1 = getDeviceFingerprint();
|
|
67
|
+
const fp2 = getDeviceFingerprint();
|
|
68
|
+
expect(fp1).toBe(fp2);
|
|
69
|
+
expect(fp1).toMatch(/^[a-f0-9]{64}$/);
|
|
70
|
+
});
|
|
71
|
+
it("produces different hashes for different inputs", () => {
|
|
72
|
+
mockPlatform.mockReturnValue("darwin");
|
|
73
|
+
mockExecSync.mockReturnValue("Hardware UUID: ABC123\n");
|
|
74
|
+
const fp1 = getDeviceFingerprint();
|
|
75
|
+
mockUserInfo.mockReturnValue({ username: "otheruser" });
|
|
76
|
+
const fp2 = getDeviceFingerprint();
|
|
77
|
+
expect(fp1).not.toBe(fp2);
|
|
78
|
+
});
|
|
79
|
+
it("still produces a hash when machineId is unavailable (degraded mode)", () => {
|
|
80
|
+
mockPlatform.mockReturnValue("darwin");
|
|
81
|
+
mockExecSync.mockImplementation(() => {
|
|
82
|
+
throw new Error("permission denied");
|
|
83
|
+
});
|
|
84
|
+
const fp = getDeviceFingerprint();
|
|
85
|
+
expect(fp).toMatch(/^[a-f0-9]{64}$/);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=fingerprint.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/fingerprint.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,MAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC/B,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7C,QAAQ,EAAE,YAAY;CACzB,CAAC,CAAC,CAAC;AAEJ,MAAM,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACnC,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AACjC,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAClC,YAAY,EAAE,gBAAgB;IAC9B,UAAU,EAAE,cAAc;CAC7B,CAAC,CAAC,CAAC;AAEJ,MAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC3B,MAAM,YAAY,GAAG,IAAI,CAAC,E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
|
+
import { homedir } from "os";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
const CONFIG_FILE = join(homedir(), ".rn-ai-debugger", "config.json");
|
|
5
|
+
const IS_DEV = process.argv.includes("--http");
|
|
6
|
+
const PRODUCTION_URL = "https://mobile-ai-devtools.link";
|
|
7
|
+
const LOCAL_URL = "http://localhost:3000";
|
|
8
|
+
function loadConfig() {
|
|
9
|
+
if (!existsSync(CONFIG_FILE))
|
|
10
|
+
return {};
|
|
11
|
+
try {
|
|
12
|
+
const raw = readFileSync(CONFIG_FILE, "utf-8");
|
|
13
|
+
return JSON.parse(raw);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const config = loadConfig();
|
|
20
|
+
/**
|
|
21
|
+
* Resolution order:
|
|
22
|
+
* 1. config.json apiUrl (if set)
|
|
23
|
+
* 2. --http flag → localhost:3000
|
|
24
|
+
* 3. Default → production URL
|
|
25
|
+
*/
|
|
26
|
+
export const API_BASE_URL = config.apiUrl ?? (IS_DEV ? LOCAL_URL : PRODUCTION_URL);
|
|
27
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AACtE,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAE/C,MAAM,cAAc,GAAG,iCAAiC,CAAC;AACzD,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAM1C,SAAS,UAAU;IACf,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,IAAI,CAAC;QACD,MAAM,GAAG,GAAG,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GACrB,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../src/core/fingerprint.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,IAAI,MAAM,CAiCrC;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAW7C;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createHash } from "crypto";
|
|
2
|
+
import { userInfo, cpus, platform } from "os";
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { readFileSync, existsSync } from "fs";
|
|
5
|
+
const FINGERPRINT_VERSION = 1;
|
|
6
|
+
export function getMachineId() {
|
|
7
|
+
const os = platform();
|
|
8
|
+
try {
|
|
9
|
+
if (os === "darwin") {
|
|
10
|
+
const output = execSync("system_profiler SPHardwareDataType", {
|
|
11
|
+
encoding: "utf-8",
|
|
12
|
+
timeout: 5000,
|
|
13
|
+
});
|
|
14
|
+
const match = output.match(/Hardware UUID:\s*(.+)/);
|
|
15
|
+
return match ? match[1].trim() : "";
|
|
16
|
+
}
|
|
17
|
+
if (os === "linux") {
|
|
18
|
+
if (existsSync("/etc/machine-id")) {
|
|
19
|
+
return readFileSync("/etc/machine-id", "utf-8").trim();
|
|
20
|
+
}
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
if (os === "win32") {
|
|
24
|
+
const output = execSync('reg query "HKLM\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid', { encoding: "utf-8", timeout: 5000 });
|
|
25
|
+
const match = output.match(/MachineGuid\s+REG_SZ\s+(.+)/);
|
|
26
|
+
return match ? match[1].trim() : "";
|
|
27
|
+
}
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return "";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function getDeviceFingerprint() {
|
|
35
|
+
const username = userInfo().username;
|
|
36
|
+
const cpuModel = cpus()[0]?.model ?? "unknown";
|
|
37
|
+
const machineId = getMachineId();
|
|
38
|
+
if (!machineId) {
|
|
39
|
+
console.warn("[rn-ai-debugger] Device fingerprint: machineId unavailable, using degraded fingerprint");
|
|
40
|
+
}
|
|
41
|
+
const input = username + cpuModel + machineId;
|
|
42
|
+
return createHash("sha256").update(input).digest("hex");
|
|
43
|
+
}
|
|
44
|
+
export function getFingerprintVersion() {
|
|
45
|
+
return FINGERPRINT_VERSION;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../src/core/fingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAE9C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,MAAM,UAAU,Y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AI,SAAS,CAAC;IAC/C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,wFAAwF,CAAC,CAAC;IAC3G,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC9C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,qBAAqB;IACjC,OAAO,mBAAmB,CAAC;AAC/B,CAAC"}
|
package/build/core/license.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type LicenseTier = "free" | "pro" | "team";
|
|
2
2
|
export interface LicenseStatus {
|
|
3
3
|
installationId: string;
|
|
4
|
-
|
|
4
|
+
tier: LicenseTier;
|
|
5
|
+
accountStatus: "anonymous" | "linked";
|
|
5
6
|
validatedAt: string;
|
|
6
7
|
cacheExpiresAt: string;
|
|
7
8
|
plan?: {
|
|
@@ -21,5 +22,6 @@ interface LicenseResult {
|
|
|
21
22
|
export declare function ensureLicense(): Promise<LicenseResult>;
|
|
22
23
|
export declare function getLicenseStatus(): LicenseStatus;
|
|
23
24
|
export declare function getDashboardUrl(): string;
|
|
25
|
+
export declare function resetLicense(): void;
|
|
24
26
|
export {};
|
|
25
27
|
//# sourceMappingURL=license.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../src/core/license.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../src/core/license.ts"],"names":[],"mappings":"AA0BA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,aAAa;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,aAAa,EAAE,WAAW,GAAG,QAAQ,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;CACL;AA6JD,UAAU,aAAa;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,CAKtD;AAqDD,wBAAgB,gBAAgB,IAAI,aAAa,CAOhD;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAWnC"}
|
package/build/core/license.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
2
|
-
import { homedir } from "os";
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, unlinkSync } from "fs";
|
|
2
|
+
import { homedir, platform, hostname, release } from "os";
|
|
3
3
|
import { join, dirname } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
4
5
|
import { getInstallationId } from "./telemetry.js";
|
|
6
|
+
import { getDeviceFingerprint, getFingerprintVersion } from "./fingerprint.js";
|
|
5
7
|
// ============================================================================
|
|
6
8
|
// Configuration
|
|
7
9
|
// ============================================================================
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
+
import { API_BASE_URL } from "./config.js";
|
|
11
|
+
const IS_DEV = process.argv.includes("--http");
|
|
12
|
+
const CACHE_TTL_MS = IS_DEV ? 0 : 24 * 60 * 60 * 1000; // No cache in dev, 24h in prod
|
|
13
|
+
const VALIDATION_ENDPOINT = API_BASE_URL;
|
|
14
|
+
const REGISTRATION_ENDPOINT = API_BASE_URL;
|
|
15
|
+
const ACCOUNTS_API_KEY = "fb4b5d8f410ff8d0dfe3ade01adc0b2444479ac9380b3f256554dd9d7044f5d2";
|
|
10
16
|
const API_TIMEOUT_MS = 5_000;
|
|
11
17
|
const LICENSE_FILE = join(homedir(), ".rn-ai-debugger", "license.json");
|
|
12
|
-
const DASHBOARD_URL =
|
|
18
|
+
const DASHBOARD_URL = API_BASE_URL;
|
|
13
19
|
// ============================================================================
|
|
14
20
|
// State
|
|
15
21
|
// ============================================================================
|
|
@@ -24,7 +30,7 @@ function readCache() {
|
|
|
24
30
|
const data = readFileSync(LICENSE_FILE, "utf-8");
|
|
25
31
|
const parsed = JSON.parse(data);
|
|
26
32
|
// Validate required fields
|
|
27
|
-
if (!parsed.installationId || !parsed.
|
|
33
|
+
if (!parsed.installationId || !parsed.tier || !parsed.cacheExpiresAt) {
|
|
28
34
|
return null;
|
|
29
35
|
}
|
|
30
36
|
return parsed;
|
|
@@ -54,33 +60,86 @@ function createDefaultStatus(installationId) {
|
|
|
54
60
|
const now = new Date().toISOString();
|
|
55
61
|
return {
|
|
56
62
|
installationId,
|
|
57
|
-
|
|
63
|
+
tier: "free",
|
|
64
|
+
accountStatus: "anonymous",
|
|
58
65
|
validatedAt: now,
|
|
59
66
|
cacheExpiresAt: now, // Already expired — will trigger API call next startup
|
|
60
67
|
};
|
|
61
68
|
}
|
|
62
69
|
// ============================================================================
|
|
70
|
+
// Registration
|
|
71
|
+
// ============================================================================
|
|
72
|
+
let registrationAttempted = false;
|
|
73
|
+
async function registerInstallation(installationId) {
|
|
74
|
+
if (registrationAttempted || !REGISTRATION_ENDPOINT)
|
|
75
|
+
return;
|
|
76
|
+
registrationAttempted = true;
|
|
77
|
+
try {
|
|
78
|
+
const controller = new AbortController();
|
|
79
|
+
const timeout = setTimeout(() => controller.abort(), API_TIMEOUT_MS);
|
|
80
|
+
await fetch(`${REGISTRATION_ENDPOINT}/api/accounts/register`, {
|
|
81
|
+
method: "POST",
|
|
82
|
+
headers: {
|
|
83
|
+
"Content-Type": "application/json",
|
|
84
|
+
"X-API-Key": ACCOUNTS_API_KEY,
|
|
85
|
+
},
|
|
86
|
+
body: JSON.stringify({
|
|
87
|
+
installationId,
|
|
88
|
+
fingerprint: getDeviceFingerprint(),
|
|
89
|
+
fingerprintVersion: getFingerprintVersion(),
|
|
90
|
+
platform: platform(),
|
|
91
|
+
serverVersion: getServerVersion(),
|
|
92
|
+
hostname: hostname(),
|
|
93
|
+
osVersion: `${platform()} ${release()}`,
|
|
94
|
+
}),
|
|
95
|
+
signal: controller.signal,
|
|
96
|
+
});
|
|
97
|
+
clearTimeout(timeout);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
registrationAttempted = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function getServerVersion() {
|
|
104
|
+
try {
|
|
105
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
106
|
+
const pkgPath = join(__dirname, "..", "..", "package.json");
|
|
107
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
108
|
+
return pkg.version || "unknown";
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return "unknown";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// ============================================================================
|
|
63
115
|
// API Validation
|
|
64
116
|
// ============================================================================
|
|
65
117
|
async function callValidationApi(installationId) {
|
|
66
|
-
// Skip if endpoint not configured
|
|
67
118
|
if (!VALIDATION_ENDPOINT)
|
|
68
119
|
return null;
|
|
69
120
|
try {
|
|
70
121
|
const controller = new AbortController();
|
|
71
122
|
const timeout = setTimeout(() => controller.abort(), API_TIMEOUT_MS);
|
|
72
|
-
const response = await fetch(`${VALIDATION_ENDPOINT}/validate
|
|
123
|
+
const response = await fetch(`${VALIDATION_ENDPOINT}/api/license/validate`, {
|
|
124
|
+
method: "POST",
|
|
125
|
+
headers: {
|
|
126
|
+
"Content-Type": "application/json",
|
|
127
|
+
"X-API-Key": ACCOUNTS_API_KEY,
|
|
128
|
+
},
|
|
129
|
+
body: JSON.stringify({
|
|
130
|
+
installationId,
|
|
131
|
+
fingerprint: getDeviceFingerprint(),
|
|
132
|
+
}),
|
|
133
|
+
signal: controller.signal,
|
|
134
|
+
});
|
|
73
135
|
clearTimeout(timeout);
|
|
74
|
-
if (response.status
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
if (!response.ok) {
|
|
78
|
-
return null; // 5xx or unexpected — fail open
|
|
136
|
+
if (!response.ok && response.status !== 200) {
|
|
137
|
+
return null;
|
|
79
138
|
}
|
|
80
139
|
return (await response.json());
|
|
81
140
|
}
|
|
82
141
|
catch {
|
|
83
|
-
return null;
|
|
142
|
+
return null;
|
|
84
143
|
}
|
|
85
144
|
}
|
|
86
145
|
// ============================================================================
|
|
@@ -100,6 +159,8 @@ export function ensureLicense() {
|
|
|
100
159
|
async function resolveLicense() {
|
|
101
160
|
const startTime = Date.now();
|
|
102
161
|
const installationId = getInstallationId();
|
|
162
|
+
// Fire-and-forget registration on first run
|
|
163
|
+
registerInstallation(installationId);
|
|
103
164
|
const cache = readCache();
|
|
104
165
|
let source = "default";
|
|
105
166
|
// Check if cache is fresh and matches current installation
|
|
@@ -115,10 +176,11 @@ async function resolveLicense() {
|
|
|
115
176
|
const expiresAt = new Date(now.getTime() + CACHE_TTL_MS);
|
|
116
177
|
currentStatus = {
|
|
117
178
|
installationId,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
179
|
+
tier: apiResponse.tier,
|
|
180
|
+
accountStatus: "anonymous",
|
|
181
|
+
validatedAt: apiResponse.validatedAt || now.toISOString(),
|
|
182
|
+
cacheExpiresAt: apiResponse.cacheExpiresAt || expiresAt.toISOString(),
|
|
183
|
+
plan: apiResponse.plan || undefined,
|
|
122
184
|
};
|
|
123
185
|
writeCache(currentStatus);
|
|
124
186
|
source = "api";
|
|
@@ -146,4 +208,17 @@ export function getLicenseStatus() {
|
|
|
146
208
|
export function getDashboardUrl() {
|
|
147
209
|
return DASHBOARD_URL;
|
|
148
210
|
}
|
|
211
|
+
export function resetLicense() {
|
|
212
|
+
currentStatus = null;
|
|
213
|
+
licensePromise = null;
|
|
214
|
+
registrationAttempted = false;
|
|
215
|
+
try {
|
|
216
|
+
if (existsSync(LICENSE_FILE)) {
|
|
217
|
+
unlinkSync(LICENSE_FILE);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
// Best-effort cleanup
|
|
222
|
+
}
|
|
223
|
+
}
|
|
149
224
|
//# sourceMappingURL=license.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.js","sourceRoot":"","sources":["../../src/core/license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"license.js","sourceRoot":"","sources":["../../src/core/license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/C,MAAM,YAAY,GAAG,MAA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AE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC5B,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,oEAAoE;QACpE,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;QAC3C,aAAa,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,aAAa,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,eAAe;IAC3B,OAAO,aAAa,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,YAAY;IACxB,aAAa,GAAG,IAAI,CAAC;IACrB,cAAc,GAAG,IAAI,CAAC;IACtB,qBAAqB,GAAG,KAAK,CAAC;IAC9B,IAAI,CAAC;QACD,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC3B,UAAU,CAAC,YAAY,CAAC,CAAC;QAC7B,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,sBAAsB;IAC1B,CAAC;AACL,CAAC"}
|
|
@@ -1,42 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
interface SDKNetworkEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
method: string;
|
|
5
|
+
url: string;
|
|
6
|
+
status?: number;
|
|
7
|
+
statusText?: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
requestHeaders: Record<string, string>;
|
|
10
|
+
requestBody?: string;
|
|
11
|
+
responseHeaders: Record<string, string>;
|
|
12
|
+
responseBody?: string;
|
|
13
|
+
mimeType?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
completed: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface SDKConsoleEntry {
|
|
18
|
+
id: string;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
level: string;
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
type SDKResult<T> = {
|
|
24
|
+
success: true;
|
|
25
|
+
data: T;
|
|
26
|
+
} | {
|
|
27
|
+
success: false;
|
|
28
|
+
error: string;
|
|
29
|
+
};
|
|
4
30
|
export declare function isSDKInstalled(): Promise<boolean>;
|
|
5
|
-
|
|
6
|
-
* Read network requests from the SDK's in-app buffer.
|
|
7
|
-
*/
|
|
8
|
-
export declare function readSDKNetworkRequests(options?: {
|
|
31
|
+
export declare function querySDKNetwork(options?: {
|
|
9
32
|
count?: number;
|
|
10
33
|
method?: string;
|
|
11
34
|
urlPattern?: string;
|
|
12
35
|
status?: number;
|
|
13
|
-
}): Promise<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export declare function
|
|
36
|
+
}): Promise<SDKResult<SDKNetworkEntry[]>>;
|
|
37
|
+
export declare function getSDKNetworkEntry(id: string): Promise<SDKResult<SDKNetworkEntry | null>>;
|
|
38
|
+
export declare function getSDKNetworkStats(): Promise<SDKResult<{
|
|
39
|
+
total: number;
|
|
40
|
+
completed: number;
|
|
41
|
+
errors: number;
|
|
42
|
+
avgDuration: number | null;
|
|
43
|
+
byMethod: Record<string, number>;
|
|
44
|
+
byStatus: Record<string, number>;
|
|
45
|
+
byDomain: Record<string, number>;
|
|
46
|
+
}>>;
|
|
47
|
+
export declare function querySDKConsole(options?: {
|
|
48
|
+
count?: number;
|
|
49
|
+
level?: string;
|
|
50
|
+
text?: string;
|
|
51
|
+
}): Promise<SDKResult<SDKConsoleEntry[]>>;
|
|
52
|
+
export declare function getSDKConsoleStats(): Promise<SDKResult<{
|
|
53
|
+
total: number;
|
|
54
|
+
byLevel: Record<string, number>;
|
|
55
|
+
}>>;
|
|
56
|
+
export declare function clearSDKNetwork(): Promise<{
|
|
30
57
|
success: boolean;
|
|
31
|
-
|
|
58
|
+
count?: number;
|
|
32
59
|
error?: string;
|
|
33
60
|
}>;
|
|
34
|
-
|
|
35
|
-
* Clear the SDK's network buffer.
|
|
36
|
-
*/
|
|
37
|
-
export declare function clearSDKNetwork(): Promise<{
|
|
61
|
+
export declare function clearSDKConsole(): Promise<{
|
|
38
62
|
success: boolean;
|
|
39
63
|
count?: number;
|
|
40
64
|
error?: string;
|
|
41
65
|
}>;
|
|
66
|
+
export {};
|
|
42
67
|
//# sourceMappingURL=sdkBridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkBridge.d.ts","sourceRoot":"","sources":["../../src/core/sdkBridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdkBridge.d.ts","sourceRoot":"","sources":["../../src/core/sdkBridge.ts"],"names":[],"mappings":"AAKA,UAAU,eAAe;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,eAAe;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;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