@recallai/desktop-sdk 2025.6.27-590a49b6bd32083221a1597509161442120e1a16 → 2025.6.27-605b4076056d95534d1f0b9f4d2d24c84d9b3c50
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/desktop_sdk_macos_exe +0 -0
- package/desktop_sdk_macos_frameworks.tar +0 -0
- package/index.js +43 -53
- package/package.json +1 -4
- package/setup.js +20 -68
|
Binary file
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -2,7 +2,6 @@ const path = require('path');
|
|
|
2
2
|
const { spawn } = require('child_process');
|
|
3
3
|
const readline = require('node:readline');
|
|
4
4
|
const fs = require('node:fs');
|
|
5
|
-
const os = require("node:os");
|
|
6
5
|
const { v4: uuidv4 } = require('uuid');
|
|
7
6
|
|
|
8
7
|
// HACK: This is needed because of https://github.com/electron/electron/issues/6262
|
|
@@ -12,9 +11,7 @@ const { v4: uuidv4 } = require('uuid');
|
|
|
12
11
|
|
|
13
12
|
const exe_paths = [
|
|
14
13
|
path.join(__dirname, "desktop_sdk_macos_exe").replace('app.asar', 'app.asar.unpacked'),
|
|
15
|
-
path.join(__dirname, "desktop_sdk_macos_exe")
|
|
16
|
-
path.join(__dirname, "agent-windows.exe").replace('app.asar', 'app.asar.unpacked'),
|
|
17
|
-
path.join(__dirname, "agent-windows.exe")
|
|
14
|
+
path.join(__dirname, "desktop_sdk_macos_exe")
|
|
18
15
|
];
|
|
19
16
|
|
|
20
17
|
let proc;
|
|
@@ -86,62 +83,57 @@ function startProcess() {
|
|
|
86
83
|
return;
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
let envExtra = {};
|
|
90
|
-
|
|
91
|
-
if (process.platform === "win32") {
|
|
92
|
-
envExtra["GST_PLUGIN_PATH"] = path.join(path.dirname(exe_path), "gstreamer-1.0");
|
|
93
|
-
}
|
|
94
|
-
|
|
95
86
|
proc = spawn(exe_path, {
|
|
96
|
-
stdio:
|
|
87
|
+
stdio: ['pipe', 'pipe', 'pipe', 'pipe'],
|
|
97
88
|
env: {
|
|
98
89
|
"GST_DEBUG": "2",
|
|
99
|
-
"GST_DEBUG_DUMP_DOT_DIR":
|
|
100
|
-
|
|
90
|
+
"GST_DEBUG_DUMP_DOT_DIR": "/tmp"
|
|
91
|
+
|
|
101
92
|
}
|
|
102
93
|
});
|
|
103
94
|
|
|
95
|
+
const extraStream = proc.stdio[3];
|
|
96
|
+
|
|
97
|
+
const rl = readline.createInterface({ input: extraStream, crlfDelay: Infinity });
|
|
104
98
|
const rlStdout = readline.createInterface({ input: proc.stdout, crlfDelay: Infinity });
|
|
105
99
|
const rlStderr = readline.createInterface({ input: proc.stderr, crlfDelay: Infinity });
|
|
106
100
|
|
|
107
|
-
rlStdout.on('line', (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (line.startsWith("recall_ai_command|")) {
|
|
111
|
-
try {
|
|
112
|
-
const data = JSON.parse(line.substring(18));
|
|
113
|
-
|
|
114
|
-
switch (data.type) {
|
|
115
|
-
case "event":
|
|
116
|
-
const event = JSON.parse(data.event);
|
|
117
|
-
emitEvent(event.type, event.payload);
|
|
118
|
-
break;
|
|
119
|
-
|
|
120
|
-
case "response":
|
|
121
|
-
const pendingCommand = pendingCommands[data.commandId];
|
|
122
|
-
if (pendingCommand) {
|
|
123
|
-
if (data.status === "success") {
|
|
124
|
-
pendingCommand.resolve(data.result);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
pendingCommand.reject(new Error(data.result));
|
|
128
|
-
}
|
|
129
|
-
delete pendingCommands[data.commandId];
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
} catch (err) {
|
|
134
|
-
logError("Desktop SDK: Failed to parse incoming data:", err);
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
if (process.env.RECALLAI_DESKTOP_SDK_DEV)
|
|
138
|
-
console.log(line);
|
|
139
|
-
}
|
|
101
|
+
rlStdout.on('line', (data) => {
|
|
102
|
+
if (process.env.RECALLAI_DESKTOP_SDK_DEV)
|
|
103
|
+
console.log(data);
|
|
140
104
|
});
|
|
141
105
|
|
|
142
|
-
rlStderr.on('line', (
|
|
106
|
+
rlStderr.on('line', (data) => {
|
|
143
107
|
if (process.env.RECALLAI_DESKTOP_SDK_DEV)
|
|
144
|
-
console.error(
|
|
108
|
+
console.error(data);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
rl.on('line', (line) => {
|
|
112
|
+
try {
|
|
113
|
+
const data = JSON.parse(line);
|
|
114
|
+
|
|
115
|
+
switch (data.type) {
|
|
116
|
+
case "event":
|
|
117
|
+
const event = JSON.parse(data.event);
|
|
118
|
+
emitEvent(event.type, event.payload);
|
|
119
|
+
break;
|
|
120
|
+
|
|
121
|
+
case "response":
|
|
122
|
+
const pendingCommand = pendingCommands[data.commandId];
|
|
123
|
+
if (pendingCommand) {
|
|
124
|
+
if (data.status === "success") {
|
|
125
|
+
pendingCommand.resolve(data.result);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
pendingCommand.reject(new Error(data.result));
|
|
129
|
+
}
|
|
130
|
+
delete pendingCommands[data.commandId];
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
} catch (err) {
|
|
135
|
+
logError("Desktop SDK: Failed to parse incoming data:", err);
|
|
136
|
+
}
|
|
145
137
|
});
|
|
146
138
|
|
|
147
139
|
proc.on('error', (error) => {
|
|
@@ -208,10 +200,8 @@ function doInit(options) {
|
|
|
208
200
|
return sendCommand("init", { config: JSON.stringify(options) });
|
|
209
201
|
}
|
|
210
202
|
|
|
211
|
-
|
|
212
|
-
if (process.platform !== "darwin"
|
|
213
|
-
&& process.platform !== "win32"
|
|
214
|
-
) {
|
|
203
|
+
function init(options) {
|
|
204
|
+
if (process.platform !== "darwin") {
|
|
215
205
|
throw new Error(`Platform ${process.platform} is not supported by Desktop SDK`);
|
|
216
206
|
}
|
|
217
207
|
|
|
@@ -227,7 +217,7 @@ async function init(options) {
|
|
|
227
217
|
options.restartOnError = true;
|
|
228
218
|
|
|
229
219
|
lastOptions = options;
|
|
230
|
-
|
|
220
|
+
doInit(options);
|
|
231
221
|
}
|
|
232
222
|
|
|
233
223
|
async function shutdown() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recallai/desktop-sdk",
|
|
3
|
-
"version": "2025.06.27-
|
|
3
|
+
"version": "2025.06.27-605b4076056d95534d1f0b9f4d2d24c84d9b3c50",
|
|
4
4
|
"description": "Recall Desktop SDK (Alpha)",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
"tar": "^7.4.3",
|
|
9
9
|
"uuid": "^11.1.0"
|
|
10
10
|
},
|
|
11
|
-
"engines": {
|
|
12
|
-
"node": ">=18.0.0"
|
|
13
|
-
},
|
|
14
11
|
"scripts": {
|
|
15
12
|
"install": "node ./setup.js",
|
|
16
13
|
"validate-types": "tsc --noEmit index.d.ts"
|
package/setup.js
CHANGED
|
@@ -1,96 +1,48 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const tar = require("tar");
|
|
4
|
-
const { Readable } = require("stream");
|
|
5
|
-
const { finished } = require("stream/promises");
|
|
6
|
-
|
|
7
|
-
const nativeTarPathMacOS = path.join(__dirname, "desktop_sdk_macos.tar");
|
|
8
|
-
const nativeTarPathWin32 = path.join(__dirname, "desktop_sdk_win32.tar");
|
|
9
|
-
const nativeUrlBase = "https://recallai-desktop-sdk-releases.s3.us-east-1.amazonaws.com";
|
|
10
|
-
|
|
11
|
-
async function downloadFile(url, path) {
|
|
12
|
-
const stream = fs.createWriteStream(path);
|
|
13
|
-
const { body } = await fetch(url);
|
|
14
|
-
await finished(Readable.fromWeb(body).pipe(stream));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async function cleanup() {
|
|
18
|
-
for (const platform of [nativeTarPathMacOS, nativeTarPathWin32]) {
|
|
19
|
-
try {
|
|
20
|
-
fs.unlinkSync(platform);
|
|
21
|
-
} catch (e) {
|
|
22
|
-
// Nothing.
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function setupMacOS(version) {
|
|
28
|
-
await downloadFile(`${nativeUrlBase}/${version}/desktop_sdk_macos.tar`, nativeTarPathMacOS);
|
|
29
|
-
|
|
30
|
-
if (!fs.existsSync(nativeTarPathMacOS)) {
|
|
31
|
-
console.error("Missing native platform tar file");
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
4
|
|
|
5
|
+
async function setupMacOS() {
|
|
35
6
|
const frameworksDir = path.join(__dirname, "Frameworks");
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async function setupWin32(version) {
|
|
52
|
-
await downloadFile(`${nativeUrlBase}/${version}/desktop_sdk_win32.tar`, nativeTarPathWin32);
|
|
53
|
-
|
|
54
|
-
if (!fs.existsSync(nativeTarPathWin32)) {
|
|
55
|
-
console.error("Missing native platform tar file");
|
|
56
|
-
process.exit(1);
|
|
7
|
+
const tarPath = path.join(__dirname, "desktop_sdk_macos_frameworks.tar");
|
|
8
|
+
|
|
9
|
+
const frameworksExists = fs.existsSync(frameworksDir);
|
|
10
|
+
|
|
11
|
+
if (!fs.existsSync(tarPath)) {
|
|
12
|
+
// Framework was already installed properly, no updated tar package exists.
|
|
13
|
+
// Some users are reporting this command running twice, so use this as a gate.
|
|
14
|
+
if (frameworksExists) {
|
|
15
|
+
return;
|
|
16
|
+
} else {
|
|
17
|
+
console.error("Missing framework tar file");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
57
20
|
}
|
|
58
21
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (fs.existsSync(gstreamerDir)) {
|
|
62
|
-
fs.rmSync(gstreamerDir, { recursive: true, force: true });
|
|
22
|
+
if (!frameworksExists) {
|
|
23
|
+
fs.mkdirSync(frameworksDir);
|
|
63
24
|
}
|
|
64
25
|
|
|
65
26
|
try {
|
|
66
|
-
await tar.extract({ file:
|
|
27
|
+
await tar.extract({ file: tarPath, cwd: frameworksDir });
|
|
67
28
|
} catch (e) {
|
|
68
29
|
console.error("Error extracting tar file:", e);
|
|
69
30
|
process.exit(1);
|
|
70
31
|
}
|
|
71
32
|
|
|
72
|
-
|
|
33
|
+
fs.unlinkSync(tarPath);
|
|
73
34
|
}
|
|
74
35
|
|
|
75
36
|
async function setup() {
|
|
76
|
-
const package = fs.readFileSync("./package.json");
|
|
77
|
-
const packageJson = JSON.parse(package);
|
|
78
|
-
const version = packageJson["version"].split("-")[1];
|
|
79
|
-
|
|
80
|
-
console.log(`Downloading native sdk for version: ${version}, platform: ${process.platform}`);
|
|
81
|
-
|
|
82
37
|
if (process.platform === "darwin") {
|
|
83
|
-
await setupMacOS(
|
|
84
|
-
} else if (process.platform === "win32") {
|
|
85
|
-
await setupWin32(version);
|
|
38
|
+
await setupMacOS();
|
|
86
39
|
} else {
|
|
87
40
|
console.warn("Unsupported platform, Desktop SDK will not be available.");
|
|
88
|
-
await cleanup();
|
|
89
41
|
}
|
|
90
42
|
}
|
|
91
43
|
|
|
92
44
|
if (process.env.RECALL_LOCAL_BUILD) {
|
|
93
|
-
console.log("Doing local build, skipping
|
|
45
|
+
console.log("Doing local build, skipping framework unpacking");
|
|
94
46
|
} else {
|
|
95
47
|
setup();
|
|
96
48
|
}
|