staklink 0.4.6 → 0.4.7
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/dist/proxy-server.cjs +50 -2
- package/dist/staklink-cli.cjs +1 -1
- package/package.json +1 -1
package/dist/proxy-server.cjs
CHANGED
|
@@ -60794,7 +60794,7 @@ var SSEManager = class {
|
|
|
60794
60794
|
var sseManager = new SSEManager();
|
|
60795
60795
|
|
|
60796
60796
|
// src/proxy/version.ts
|
|
60797
|
-
var VERSION = "0.4.
|
|
60797
|
+
var VERSION = "0.4.7";
|
|
60798
60798
|
|
|
60799
60799
|
// node_modules/uuid/dist/esm/stringify.js
|
|
60800
60800
|
var byteToHex = [];
|
|
@@ -140012,6 +140012,27 @@ var SCREENSHOT_DIR = import_path3.default.join(
|
|
|
140012
140012
|
"tmp",
|
|
140013
140013
|
"screenshots"
|
|
140014
140014
|
);
|
|
140015
|
+
var RECORDING_DIR = import_path3.default.join(
|
|
140016
|
+
import_os2.default.homedir(),
|
|
140017
|
+
".agent-browser",
|
|
140018
|
+
"tmp",
|
|
140019
|
+
"recordings"
|
|
140020
|
+
);
|
|
140021
|
+
async function cleanupAllRecordings() {
|
|
140022
|
+
try {
|
|
140023
|
+
const entries = await import_promises2.default.readdir(RECORDING_DIR);
|
|
140024
|
+
await Promise.all(
|
|
140025
|
+
entries.map(
|
|
140026
|
+
(file3) => import_promises2.default.unlink(import_path3.default.join(RECORDING_DIR, file3)).catch(() => {
|
|
140027
|
+
})
|
|
140028
|
+
)
|
|
140029
|
+
);
|
|
140030
|
+
if (entries.length > 0) {
|
|
140031
|
+
log(`Cleaned up ${entries.length} leftover recording(s)`);
|
|
140032
|
+
}
|
|
140033
|
+
} catch {
|
|
140034
|
+
}
|
|
140035
|
+
}
|
|
140015
140036
|
async function cleanupAllScreenshots() {
|
|
140016
140037
|
try {
|
|
140017
140038
|
const entries = await import_promises2.default.readdir(SCREENSHOT_DIR);
|
|
@@ -140028,6 +140049,27 @@ async function cleanupAllScreenshots() {
|
|
|
140028
140049
|
} catch {
|
|
140029
140050
|
}
|
|
140030
140051
|
}
|
|
140052
|
+
async function collectRecordings(since) {
|
|
140053
|
+
try {
|
|
140054
|
+
const entries = await import_promises2.default.readdir(RECORDING_DIR);
|
|
140055
|
+
const webms = entries.filter((e) => e.endsWith(".webm"));
|
|
140056
|
+
const results = [];
|
|
140057
|
+
for (const file3 of webms) {
|
|
140058
|
+
const filePath = import_path3.default.join(RECORDING_DIR, file3);
|
|
140059
|
+
const stat4 = await import_promises2.default.stat(filePath);
|
|
140060
|
+
if (stat4.mtimeMs < since) {
|
|
140061
|
+
continue;
|
|
140062
|
+
}
|
|
140063
|
+
results.push({
|
|
140064
|
+
filename: file3,
|
|
140065
|
+
url: `recordings/${file3}`
|
|
140066
|
+
});
|
|
140067
|
+
}
|
|
140068
|
+
return results;
|
|
140069
|
+
} catch {
|
|
140070
|
+
return [];
|
|
140071
|
+
}
|
|
140072
|
+
}
|
|
140031
140073
|
async function collectScreenshots(since) {
|
|
140032
140074
|
try {
|
|
140033
140075
|
const entries = await import_promises2.default.readdir(SCREENSHOT_DIR);
|
|
@@ -140085,10 +140127,12 @@ var createAsyncAgentHandler = (getParams, transformResult) => {
|
|
|
140085
140127
|
}).then(async (result) => {
|
|
140086
140128
|
const finalResult = transformResult ? transformResult(result) : result;
|
|
140087
140129
|
const screenshots = await collectScreenshots(startTime);
|
|
140130
|
+
const recordings = await collectRecordings(startTime);
|
|
140088
140131
|
finishReq(request_id, {
|
|
140089
140132
|
success: true,
|
|
140090
140133
|
result: finalResult,
|
|
140091
|
-
...screenshots.length > 0 && { screenshots }
|
|
140134
|
+
...screenshots.length > 0 && { screenshots },
|
|
140135
|
+
...recordings.length > 0 && { recordings }
|
|
140092
140136
|
});
|
|
140093
140137
|
}).catch((error88) => {
|
|
140094
140138
|
error("Agent error:", error88);
|
|
@@ -141950,6 +141994,7 @@ async function startProxyServer() {
|
|
|
141950
141994
|
});
|
|
141951
141995
|
app.use(import_express.default.json({ limit: "50mb" }));
|
|
141952
141996
|
app.use(import_express.default.urlencoded({ extended: true }));
|
|
141997
|
+
app.use("/recordings", import_express.default.static(RECORDING_DIR));
|
|
141953
141998
|
app.get("/health", (req, res) => {
|
|
141954
141999
|
log("===> health check");
|
|
141955
142000
|
res.status(200).json({
|
|
@@ -142703,6 +142748,9 @@ console.log("Starting staklink proxy server...");
|
|
|
142703
142748
|
cleanupAllScreenshots().catch((err) => {
|
|
142704
142749
|
warn("Screenshot cleanup failed:", err);
|
|
142705
142750
|
});
|
|
142751
|
+
cleanupAllRecordings().catch((err) => {
|
|
142752
|
+
warn("Recording cleanup failed:", err);
|
|
142753
|
+
});
|
|
142706
142754
|
startProxyServer().catch((err) => {
|
|
142707
142755
|
error("Failed to start proxy server:", err);
|
|
142708
142756
|
process.exit(1);
|
package/dist/staklink-cli.cjs
CHANGED
|
@@ -10967,7 +10967,7 @@ var glob = Object.assign(glob_, {
|
|
|
10967
10967
|
glob.glob = glob;
|
|
10968
10968
|
|
|
10969
10969
|
// src/proxy/version.ts
|
|
10970
|
-
var VERSION = "0.4.
|
|
10970
|
+
var VERSION = "0.4.7";
|
|
10971
10971
|
|
|
10972
10972
|
// src/deps.ts
|
|
10973
10973
|
var import_child_process = require("child_process");
|