overlord-cli 0.2606081442.0 → 0.2606090710.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.
@@ -0,0 +1,12 @@
1
+ export const CANONICAL_DEVICE_FILE: string;
2
+
3
+ export function getLegacyDesktopDeviceFilePath(userDataPath: string): string;
4
+
5
+ export function readOrCreateCanonicalDeviceFingerprintSync(input?: {
6
+ explicitFingerprint?: string | null | undefined;
7
+ legacyDesktopUserDataPath?: string | null | undefined;
8
+ }): string;
9
+
10
+ export function readOrCreateCanonicalDeviceFingerprint(input?: {
11
+ legacyDesktopUserDataPath?: string | null | undefined;
12
+ }): Promise<string>;
@@ -0,0 +1,92 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import fs from 'node:fs';
3
+ import fsp from 'node:fs/promises';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+
7
+ export const CANONICAL_DEVICE_FILE = path.join(os.homedir(), '.ovld', 'device.json');
8
+
9
+ export function getLegacyDesktopDeviceFilePath(userDataPath) {
10
+ return path.join(userDataPath, 'overlord-device.json');
11
+ }
12
+
13
+ function parseDeviceFingerprint(raw) {
14
+ const parsed = JSON.parse(raw);
15
+ return typeof parsed.deviceFingerprint === 'string' ? parsed.deviceFingerprint.trim() : '';
16
+ }
17
+
18
+ function serializeDeviceFingerprint(deviceFingerprint) {
19
+ return `${JSON.stringify({ deviceFingerprint }, null, 2)}\n`;
20
+ }
21
+
22
+ function readDeviceFingerprintSync(filePath) {
23
+ try {
24
+ const fingerprint = parseDeviceFingerprint(fs.readFileSync(filePath, 'utf8'));
25
+ return fingerprint || null;
26
+ } catch {
27
+ return null;
28
+ }
29
+ }
30
+
31
+ async function readDeviceFingerprint(filePath) {
32
+ try {
33
+ const fingerprint = parseDeviceFingerprint(await fsp.readFile(filePath, 'utf8'));
34
+ return fingerprint || null;
35
+ } catch {
36
+ return null;
37
+ }
38
+ }
39
+
40
+ function writeCanonicalDeviceFingerprintSync(deviceFingerprint) {
41
+ fs.mkdirSync(path.dirname(CANONICAL_DEVICE_FILE), { recursive: true });
42
+ fs.writeFileSync(CANONICAL_DEVICE_FILE, serializeDeviceFingerprint(deviceFingerprint), 'utf8');
43
+ }
44
+
45
+ async function writeCanonicalDeviceFingerprint(deviceFingerprint) {
46
+ await fsp.mkdir(path.dirname(CANONICAL_DEVICE_FILE), { recursive: true });
47
+ await fsp.writeFile(CANONICAL_DEVICE_FILE, serializeDeviceFingerprint(deviceFingerprint), 'utf8');
48
+ }
49
+
50
+ export function readOrCreateCanonicalDeviceFingerprintSync({
51
+ explicitFingerprint,
52
+ legacyDesktopUserDataPath
53
+ } = {}) {
54
+ const explicit = typeof explicitFingerprint === 'string' ? explicitFingerprint.trim() : '';
55
+ if (explicit) return explicit;
56
+
57
+ const canonical = readDeviceFingerprintSync(CANONICAL_DEVICE_FILE);
58
+ if (canonical) return canonical;
59
+
60
+ if (legacyDesktopUserDataPath) {
61
+ const legacy = readDeviceFingerprintSync(getLegacyDesktopDeviceFilePath(legacyDesktopUserDataPath));
62
+ if (legacy) {
63
+ writeCanonicalDeviceFingerprintSync(legacy);
64
+ return legacy;
65
+ }
66
+ }
67
+
68
+ const deviceFingerprint = randomUUID();
69
+ writeCanonicalDeviceFingerprintSync(deviceFingerprint);
70
+ return deviceFingerprint;
71
+ }
72
+
73
+ export async function readOrCreateCanonicalDeviceFingerprint({
74
+ legacyDesktopUserDataPath
75
+ } = {}) {
76
+ const canonical = await readDeviceFingerprint(CANONICAL_DEVICE_FILE);
77
+ if (canonical) return canonical;
78
+
79
+ if (legacyDesktopUserDataPath) {
80
+ const legacy = await readDeviceFingerprint(
81
+ getLegacyDesktopDeviceFilePath(legacyDesktopUserDataPath)
82
+ );
83
+ if (legacy) {
84
+ await writeCanonicalDeviceFingerprint(legacy);
85
+ return legacy;
86
+ }
87
+ }
88
+
89
+ const deviceFingerprint = randomUUID();
90
+ await writeCanonicalDeviceFingerprint(deviceFingerprint);
91
+ return deviceFingerprint;
92
+ }
@@ -3,7 +3,7 @@
3
3
  import { execFileSync, spawn } from 'node:child_process';
4
4
  import os from 'node:os';
5
5
 
6
- import { readOrCreateCanonicalDeviceFingerprintSync } from '../../../../lib/overlord/device-identity.mjs';
6
+ import { readOrCreateCanonicalDeviceFingerprintSync } from './device-identity.mjs';
7
7
 
8
8
  const OVLD_ENTRY = process.argv[1];
9
9
  const DEFAULT_TMUX_COMMAND = 'tmux new-session bash {script}';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overlord-cli",
3
- "version": "0.2606081442.0",
3
+ "version": "0.2606090710.0",
4
4
  "description": "Overlord CLI — launch AI agents on tickets from anywhere",
5
5
  "homepage": "https://www.ovld.ai/docs/",
6
6
  "type": "module",