@recallai/desktop-sdk 2025.6.27-5f99bc45c76fd76ef9ebcbf39d16593800472e6f → 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.
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: "pipe",
87
+ stdio: ['pipe', 'pipe', 'pipe', 'pipe'],
97
88
  env: {
98
89
  "GST_DEBUG": "2",
99
- "GST_DEBUG_DUMP_DOT_DIR": os.tmpdir(),
100
- ...envExtra,
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', (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', (line) => {
106
+ rlStderr.on('line', (data) => {
143
107
  if (process.env.RECALLAI_DESKTOP_SDK_DEV)
144
- console.error(line);
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
- async function init(options) {
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
- return doInit(options);
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-5f99bc45c76fd76ef9ebcbf39d16593800472e6f",
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
- if (fs.existsSync(frameworksDir)) {
38
- fs.rmSync(frameworksDir, { recursive: true, force: true });
39
- }
40
-
41
- try {
42
- await tar.extract({ file: nativeTarPathMacOS, cwd: __dirname });
43
- } catch (e) {
44
- console.error("Error extracting tar file:", e);
45
- process.exit(1);
46
- }
47
-
48
- await cleanup();
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
- const gstreamerDir = path.join(__dirname, "gstreamer-1.0");
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: nativeTarPathWin32, cwd: __dirname });
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
- await cleanup();
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(version);
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 platform native install");
45
+ console.log("Doing local build, skipping framework unpacking");
94
46
  } else {
95
47
  setup();
96
48
  }