remoteclaw 0.1.0-next.7706bc4 → 0.1.0-next.aa1fa55
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/{accounts-7fm_KzPm.js → accounts-DBohBlww.js} +1 -1
- package/dist/boot/handler.js +29 -29
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-activity-Cd1JhIUj.js → channel-activity-C-G4n9BK.js} +2 -2
- package/dist/command-logger/handler.js +1 -1
- package/dist/{fetch-ePscvwi1.js → fetch-BFSBLBkA.js} +1 -1
- package/dist/{media-Dqv7Q0aS.js → media-CojxZ45J.js} +47 -47
- package/dist/{outbound-attachment-_jj74QBM.js → outbound-attachment-B_0D60Yr.js} +2 -2
- package/dist/{retry-B042l5UJ.js → retry-DUjAzOBy.js} +1 -1
- package/dist/{secure-random-DTcQnwrI.js → secure-random-Pl9rPl0l.js} +1 -1
- package/dist/{send-pwe9Gu8e.js → send-B84axiIa.js} +7 -7
- package/dist/{send-DVXOiKT4.js → send-BqVOxAmK.js} +13 -13
- package/dist/{send-CLrRM0El.js → send-CGXyTF22.js} +4 -4
- package/dist/send-CKavrhXj.js +11 -0
- package/dist/{send-BzN7X1Om.js → send-D08Je6DL.js} +6 -6
- package/dist/{send-Dh6d3CLl.js → send-D1aYEG-k.js} +3 -3
- package/dist/{store-Bjk6rTC_.js → store-CPJXuhvQ.js} +5 -5
- package/dist/{subsystem-D9ZpRKFP.js → subsystem-BUXAJwPD.js} +18 -18
- package/dist/{tables-D3a9iSU1.js → tables-PxcSPSO0.js} +1 -1
- package/dist/{targets-DfaVEd_u.js → targets-C1NeMn2J.js} +3 -3
- package/dist/{targets-CMhBAn87.js → targets-JCISV-hS.js} +3 -3
- package/dist/{usage-CS1zeIan.js → usage-CYlQW4M2.js} +56 -56
- package/dist/{web-D4oENnAL.js → web-BUYUdnRH.js} +16 -16
- package/package.json +1 -1
- package/dist/send-6l2S1bcr.js +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as createAccountListHelpers, V as resolveAccountEntry, ft as normalizeAccountId } from "./media-
|
|
1
|
+
import { B as createAccountListHelpers, V as resolveAccountEntry, ft as normalizeAccountId } from "./media-CojxZ45J.js";
|
|
2
2
|
|
|
3
3
|
//#region src/imessage/accounts.ts
|
|
4
4
|
const { listAccountIds, resolveDefaultAccountId } = createAccountListHelpers("imessage");
|
package/dist/boot/handler.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { $ as normalizeModelRef, A as normalizeChannelId, G as isGatewayMessageChannel, J as normalizeMessageChannel, K as isInternalMessageChannel, O as getChannelPlugin, Q as isCliProvider, U as INTERNAL_MESSAGE_CHANNEL, W as isDeliverableMessageChannel, Y as resolveMessageChannel, _ as resolveTextChunkLimit, at as resolveSessionAgentId, ct as normalizeAgentId, d as getAgentScopedMediaLocalRoots, ft as normalizeAccountId, g as resolveChunkMode, h as chunkMarkdownTextWithMode, it as resolveAgentWorkspaceDir, k as listChannelPlugins, lt as normalizeMainKey, m as chunkByParagraph, nt as listAgentIds, p as resolveMarkdownTableMode, q as listDeliverableMessageChannels, rt as resolveAgentConfig, tt as formatCliCommand, ut as resolveAgentIdFromSessionKey, x as loadConfig } from "../media-
|
|
2
|
-
import { D as createInternalHookEvent, M as resolveGatewayPort, O as isGatewayStartupEvent, P as resolveStateDir, k as triggerInternalHook, n as defaultRuntime, s as getActivePluginRegistry, t as createSubsystemLogger } from "../subsystem-
|
|
3
|
-
import { A as parseSessionThreadInfo, B as resolveChannelResetConfig, C as DEFAULT_CONTEXT_TOKENS, D as setCliSessionId, E as getCliSessionId, F as updateSessionStore, G as resolveSessionTranscriptPath, H as resolveSessionResetType, I as normalizeAccountId$1, J as resolveExplicitAgentSessionKey, K as resolveStorePath, M as resolveMirroredTranscriptText, N as resolveAndPersistSessionFile, O as resolveChannelMessageToolHints, P as loadSessionStore, R as resolveSessionKey, S as ensureAgentWorkspace, T as DEFAULT_PROVIDER, U as setSessionRuntimeModel, V as resolveSessionResetPolicy, W as resolveSessionFilePathOptions, X as ensureAuthProfileStore, Y as resolveMainSessionKey, Z as SILENT_REPLY_TOKEN, _ as formatThinkingLevels, a as parseReplyDirectives, b as normalizeVerboseLevel, c as AGENT_LANE_NESTED, d as ChannelBridge, f as getGlobalHookRunner, g as resolveGatewayCredentialsFromConfig, h as registerAgentRunContext, i as shouldSuppressReasoningPayload, j as appendAssistantMessageToSessionTranscript, k as clearSessionAuthProfileOverride, l as resolveSendPolicy, m as emitAgentEvent, n as hasNonzeroUsage, o as resolveOutboundTarget, p as clearAgentRunContext, q as resolveAgentMainSessionKey, r as isRenderablePayload, s as resolveSessionDeliveryTarget, t as deriveSessionTotalTokens, u as applyVerboseOverride, v as formatXHighModelHint, w as DEFAULT_MODEL, x as supportsXHighThinking, y as normalizeThinkLevel, z as evaluateSessionFreshness } from "../usage-
|
|
4
|
-
import "../targets-
|
|
5
|
-
import "../accounts-
|
|
6
|
-
import { t as generateSecureUuid } from "../secure-random-
|
|
7
|
-
import "../fetch-
|
|
8
|
-
import "../retry-
|
|
9
|
-
import "../targets-
|
|
10
|
-
import { n as markdownToSignalTextChunks, t as sendMessageSignal } from "../send-
|
|
11
|
-
import "../store-
|
|
12
|
-
import "../outbound-attachment-
|
|
1
|
+
import { $ as normalizeModelRef, A as normalizeChannelId, G as isGatewayMessageChannel, J as normalizeMessageChannel, K as isInternalMessageChannel, O as getChannelPlugin, Q as isCliProvider, U as INTERNAL_MESSAGE_CHANNEL, W as isDeliverableMessageChannel, Y as resolveMessageChannel, _ as resolveTextChunkLimit, at as resolveSessionAgentId, ct as normalizeAgentId, d as getAgentScopedMediaLocalRoots, ft as normalizeAccountId, g as resolveChunkMode, h as chunkMarkdownTextWithMode, it as resolveAgentWorkspaceDir, k as listChannelPlugins, lt as normalizeMainKey, m as chunkByParagraph, nt as listAgentIds, p as resolveMarkdownTableMode, q as listDeliverableMessageChannels, rt as resolveAgentConfig, tt as formatCliCommand, ut as resolveAgentIdFromSessionKey, x as loadConfig } from "../media-CojxZ45J.js";
|
|
2
|
+
import { D as createInternalHookEvent, M as resolveGatewayPort, O as isGatewayStartupEvent, P as resolveStateDir, k as triggerInternalHook, n as defaultRuntime, s as getActivePluginRegistry, t as createSubsystemLogger } from "../subsystem-BUXAJwPD.js";
|
|
3
|
+
import { A as parseSessionThreadInfo, B as resolveChannelResetConfig, C as DEFAULT_CONTEXT_TOKENS, D as setCliSessionId, E as getCliSessionId, F as updateSessionStore, G as resolveSessionTranscriptPath, H as resolveSessionResetType, I as normalizeAccountId$1, J as resolveExplicitAgentSessionKey, K as resolveStorePath, M as resolveMirroredTranscriptText, N as resolveAndPersistSessionFile, O as resolveChannelMessageToolHints, P as loadSessionStore, R as resolveSessionKey, S as ensureAgentWorkspace, T as DEFAULT_PROVIDER, U as setSessionRuntimeModel, V as resolveSessionResetPolicy, W as resolveSessionFilePathOptions, X as ensureAuthProfileStore, Y as resolveMainSessionKey, Z as SILENT_REPLY_TOKEN, _ as formatThinkingLevels, a as parseReplyDirectives, b as normalizeVerboseLevel, c as AGENT_LANE_NESTED, d as ChannelBridge, f as getGlobalHookRunner, g as resolveGatewayCredentialsFromConfig, h as registerAgentRunContext, i as shouldSuppressReasoningPayload, j as appendAssistantMessageToSessionTranscript, k as clearSessionAuthProfileOverride, l as resolveSendPolicy, m as emitAgentEvent, n as hasNonzeroUsage, o as resolveOutboundTarget, p as clearAgentRunContext, q as resolveAgentMainSessionKey, r as isRenderablePayload, s as resolveSessionDeliveryTarget, t as deriveSessionTotalTokens, u as applyVerboseOverride, v as formatXHighModelHint, w as DEFAULT_MODEL, x as supportsXHighThinking, y as normalizeThinkLevel, z as evaluateSessionFreshness } from "../usage-CYlQW4M2.js";
|
|
4
|
+
import "../targets-JCISV-hS.js";
|
|
5
|
+
import "../accounts-DBohBlww.js";
|
|
6
|
+
import { t as generateSecureUuid } from "../secure-random-Pl9rPl0l.js";
|
|
7
|
+
import "../fetch-BFSBLBkA.js";
|
|
8
|
+
import "../retry-DUjAzOBy.js";
|
|
9
|
+
import "../targets-C1NeMn2J.js";
|
|
10
|
+
import { n as markdownToSignalTextChunks, t as sendMessageSignal } from "../send-CGXyTF22.js";
|
|
11
|
+
import "../store-CPJXuhvQ.js";
|
|
12
|
+
import "../outbound-attachment-B_0D60Yr.js";
|
|
13
13
|
import path from "node:path";
|
|
14
|
-
import
|
|
15
|
-
import fs from "node:fs/promises";
|
|
14
|
+
import fs from "node:fs";
|
|
15
|
+
import fs$1 from "node:fs/promises";
|
|
16
16
|
import crypto from "node:crypto";
|
|
17
17
|
|
|
18
18
|
//#region src/cli/outbound-send-mapping.ts
|
|
@@ -32,27 +32,27 @@ function createOutboundSendDepsFromCliSource(deps) {
|
|
|
32
32
|
function createDefaultDeps() {
|
|
33
33
|
return {
|
|
34
34
|
sendMessageWhatsApp: async (...args) => {
|
|
35
|
-
const { sendMessageWhatsApp } = await import("../web-
|
|
35
|
+
const { sendMessageWhatsApp } = await import("../web-BUYUdnRH.js");
|
|
36
36
|
return await sendMessageWhatsApp(...args);
|
|
37
37
|
},
|
|
38
38
|
sendMessageTelegram: async (...args) => {
|
|
39
|
-
const { sendMessageTelegram } = await import("../send-
|
|
39
|
+
const { sendMessageTelegram } = await import("../send-BqVOxAmK.js");
|
|
40
40
|
return await sendMessageTelegram(...args);
|
|
41
41
|
},
|
|
42
42
|
sendMessageDiscord: async (...args) => {
|
|
43
|
-
const { sendMessageDiscord } = await import("../send-
|
|
43
|
+
const { sendMessageDiscord } = await import("../send-CKavrhXj.js");
|
|
44
44
|
return await sendMessageDiscord(...args);
|
|
45
45
|
},
|
|
46
46
|
sendMessageSlack: async (...args) => {
|
|
47
|
-
const { sendMessageSlack } = await import("../send-
|
|
47
|
+
const { sendMessageSlack } = await import("../send-D1aYEG-k.js");
|
|
48
48
|
return await sendMessageSlack(...args);
|
|
49
49
|
},
|
|
50
50
|
sendMessageSignal: async (...args) => {
|
|
51
|
-
const { sendMessageSignal } = await import("../send-
|
|
51
|
+
const { sendMessageSignal } = await import("../send-B84axiIa.js");
|
|
52
52
|
return await sendMessageSignal(...args);
|
|
53
53
|
},
|
|
54
54
|
sendMessageIMessage: async (...args) => {
|
|
55
|
-
const { sendMessageIMessage } = await import("../send-
|
|
55
|
+
const { sendMessageIMessage } = await import("../send-D08Je6DL.js");
|
|
56
56
|
return await sendMessageIMessage(...args);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
@@ -253,11 +253,11 @@ function resolveFailedDir(stateDir) {
|
|
|
253
253
|
/** Ensure the queue directory (and failed/ subdirectory) exist. */
|
|
254
254
|
async function ensureQueueDir(stateDir) {
|
|
255
255
|
const queueDir = resolveQueueDir(stateDir);
|
|
256
|
-
await
|
|
256
|
+
await fs.promises.mkdir(queueDir, {
|
|
257
257
|
recursive: true,
|
|
258
258
|
mode: 448
|
|
259
259
|
});
|
|
260
|
-
await
|
|
260
|
+
await fs.promises.mkdir(resolveFailedDir(stateDir), {
|
|
261
261
|
recursive: true,
|
|
262
262
|
mode: 448
|
|
263
263
|
});
|
|
@@ -284,18 +284,18 @@ async function enqueueDelivery(params, stateDir) {
|
|
|
284
284
|
const filePath = path.join(queueDir, `${id}.json`);
|
|
285
285
|
const tmp = `${filePath}.${process.pid}.tmp`;
|
|
286
286
|
const json = JSON.stringify(entry, null, 2);
|
|
287
|
-
await
|
|
287
|
+
await fs.promises.writeFile(tmp, json, {
|
|
288
288
|
encoding: "utf-8",
|
|
289
289
|
mode: 384
|
|
290
290
|
});
|
|
291
|
-
await
|
|
291
|
+
await fs.promises.rename(tmp, filePath);
|
|
292
292
|
return id;
|
|
293
293
|
}
|
|
294
294
|
/** Remove a successfully delivered entry from the queue. */
|
|
295
295
|
async function ackDelivery(id, stateDir) {
|
|
296
296
|
const filePath = path.join(resolveQueueDir(stateDir), `${id}.json`);
|
|
297
297
|
try {
|
|
298
|
-
await
|
|
298
|
+
await fs.promises.unlink(filePath);
|
|
299
299
|
} catch (err) {
|
|
300
300
|
if ((err && typeof err === "object" && "code" in err ? String(err.code) : null) !== "ENOENT") throw err;
|
|
301
301
|
}
|
|
@@ -303,16 +303,16 @@ async function ackDelivery(id, stateDir) {
|
|
|
303
303
|
/** Update a queue entry after a failed delivery attempt. */
|
|
304
304
|
async function failDelivery(id, error, stateDir) {
|
|
305
305
|
const filePath = path.join(resolveQueueDir(stateDir), `${id}.json`);
|
|
306
|
-
const raw = await
|
|
306
|
+
const raw = await fs.promises.readFile(filePath, "utf-8");
|
|
307
307
|
const entry = JSON.parse(raw);
|
|
308
308
|
entry.retryCount += 1;
|
|
309
309
|
entry.lastError = error;
|
|
310
310
|
const tmp = `${filePath}.${process.pid}.tmp`;
|
|
311
|
-
await
|
|
311
|
+
await fs.promises.writeFile(tmp, JSON.stringify(entry, null, 2), {
|
|
312
312
|
encoding: "utf-8",
|
|
313
313
|
mode: 384
|
|
314
314
|
});
|
|
315
|
-
await
|
|
315
|
+
await fs.promises.rename(tmp, filePath);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
//#endregion
|
|
@@ -1341,7 +1341,7 @@ async function resolveBootPrompt(boot, workspaceDir) {
|
|
|
1341
1341
|
if (boot.file !== void 0) {
|
|
1342
1342
|
const filePath = path.isAbsolute(boot.file) ? boot.file : path.join(workspaceDir, boot.file);
|
|
1343
1343
|
try {
|
|
1344
|
-
const trimmed = (await fs.readFile(filePath, "utf-8")).trim();
|
|
1344
|
+
const trimmed = (await fs$1.readFile(filePath, "utf-8")).trim();
|
|
1345
1345
|
if (!trimmed) return { status: "empty" };
|
|
1346
1346
|
return {
|
|
1347
1347
|
status: "ok",
|
package/dist/build-info.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.0-next.
|
|
3
|
-
"commit": "
|
|
4
|
-
"builtAt": "2026-03-
|
|
2
|
+
"version": "0.1.0-next.aa1fa55",
|
|
3
|
+
"commit": "aa1fa55d8a6b4d7f50270b29758ae90020b31ae9",
|
|
4
|
+
"builtAt": "2026-03-07T08:18:13.897Z"
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
5278c7166c299d622e834f74b1d3748a02cfa465576b27fd75ebd7f065900484
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as resolveNodeRequireFromMeta, t as createSubsystemLogger } from "./subsystem-
|
|
2
|
-
import { n as retryAsync, t as resolveRetryConfig } from "./retry-
|
|
1
|
+
import { T as resolveNodeRequireFromMeta, t as createSubsystemLogger } from "./subsystem-BUXAJwPD.js";
|
|
2
|
+
import { n as retryAsync, t as resolveRetryConfig } from "./retry-DUjAzOBy.js";
|
|
3
3
|
import { RateLimitError } from "@buape/carbon";
|
|
4
4
|
|
|
5
5
|
//#region src/security/safe-regex.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as resolveStateDir, t as createSubsystemLogger } from "../subsystem-
|
|
1
|
+
import { P as resolveStateDir, t as createSubsystemLogger } from "../subsystem-BUXAJwPD.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as resolveConfigPath, E as resolvePreferredRemoteClawTmpDir, I as resolveRequiredHomeDir, N as resolveOAuthDir, P as resolveStateDir, S as warn, _ as isPlainObject$2, a as normalizeAnyChannelId, b as logVerboseConsole, c as requireActivePluginRegistry, d as isRecord, f as normalizeE164, i as CHAT_CHANNEL_ORDER, j as resolveDefaultConfigCandidates, m as resolveUserPath, n as defaultRuntime, o as normalizeChatChannelId, p as resolveConfigDir, r as CHANNEL_IDS, s as getActivePluginRegistry, t as createSubsystemLogger, v as danger, w as getLogger, x as shouldLogVerbose, y as logVerbose } from "./subsystem-
|
|
1
|
+
import { A as resolveConfigPath, E as resolvePreferredRemoteClawTmpDir, I as resolveRequiredHomeDir, N as resolveOAuthDir, P as resolveStateDir, S as warn, _ as isPlainObject$2, a as normalizeAnyChannelId, b as logVerboseConsole, c as requireActivePluginRegistry, d as isRecord, f as normalizeE164, i as CHAT_CHANNEL_ORDER, j as resolveDefaultConfigCandidates, m as resolveUserPath, n as defaultRuntime, o as normalizeChatChannelId, p as resolveConfigDir, r as CHANNEL_IDS, s as getActivePluginRegistry, t as createSubsystemLogger, v as danger, w as getLogger, x as shouldLogVerbose, y as logVerbose } from "./subsystem-BUXAJwPD.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import
|
|
4
|
+
import fs, { constants } from "node:fs";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import JSON5 from "json5";
|
|
7
7
|
import util, { isDeepStrictEqual, promisify } from "node:util";
|
|
8
|
-
import fs from "node:fs/promises";
|
|
8
|
+
import fs$1 from "node:fs/promises";
|
|
9
9
|
import crypto from "node:crypto";
|
|
10
10
|
import dotenv from "dotenv";
|
|
11
11
|
import { execFile, execFileSync, spawn } from "node:child_process";
|
|
@@ -674,7 +674,7 @@ function resolveTelegramToken(cfg, opts = {}) {
|
|
|
674
674
|
const accountCfg = resolveAccountCfg(accountId !== DEFAULT_ACCOUNT_ID ? accountId : DEFAULT_ACCOUNT_ID);
|
|
675
675
|
const accountTokenFile = accountCfg?.tokenFile?.trim();
|
|
676
676
|
if (accountTokenFile) {
|
|
677
|
-
if (!
|
|
677
|
+
if (!fs.existsSync(accountTokenFile)) {
|
|
678
678
|
opts.logMissingFile?.(`channels.telegram.accounts.${accountId}.tokenFile not found: ${accountTokenFile}`);
|
|
679
679
|
return {
|
|
680
680
|
token: "",
|
|
@@ -682,7 +682,7 @@ function resolveTelegramToken(cfg, opts = {}) {
|
|
|
682
682
|
};
|
|
683
683
|
}
|
|
684
684
|
try {
|
|
685
|
-
const token =
|
|
685
|
+
const token = fs.readFileSync(accountTokenFile, "utf-8").trim();
|
|
686
686
|
if (token) return {
|
|
687
687
|
token,
|
|
688
688
|
source: "tokenFile"
|
|
@@ -707,7 +707,7 @@ function resolveTelegramToken(cfg, opts = {}) {
|
|
|
707
707
|
const allowEnv = accountId === DEFAULT_ACCOUNT_ID;
|
|
708
708
|
const tokenFile = telegramCfg?.tokenFile?.trim();
|
|
709
709
|
if (tokenFile && allowEnv) {
|
|
710
|
-
if (!
|
|
710
|
+
if (!fs.existsSync(tokenFile)) {
|
|
711
711
|
opts.logMissingFile?.(`channels.telegram.tokenFile not found: ${tokenFile}`);
|
|
712
712
|
return {
|
|
713
713
|
token: "",
|
|
@@ -715,7 +715,7 @@ function resolveTelegramToken(cfg, opts = {}) {
|
|
|
715
715
|
};
|
|
716
716
|
}
|
|
717
717
|
try {
|
|
718
|
-
const token =
|
|
718
|
+
const token = fs.readFileSync(tokenFile, "utf-8").trim();
|
|
719
719
|
if (token) return {
|
|
720
720
|
token,
|
|
721
721
|
source: "tokenFile"
|
|
@@ -845,7 +845,7 @@ function resolveLegacyAuthDir() {
|
|
|
845
845
|
}
|
|
846
846
|
function legacyAuthExists(authDir) {
|
|
847
847
|
try {
|
|
848
|
-
return
|
|
848
|
+
return fs.existsSync(path.join(authDir, "creds.json"));
|
|
849
849
|
} catch {
|
|
850
850
|
return false;
|
|
851
851
|
}
|
|
@@ -1038,7 +1038,7 @@ function loadDotEnv(opts) {
|
|
|
1038
1038
|
const quiet = opts?.quiet ?? true;
|
|
1039
1039
|
dotenv.config({ quiet });
|
|
1040
1040
|
const globalEnvPath = path.join(resolveConfigDir(process.env), ".env");
|
|
1041
|
-
if (!
|
|
1041
|
+
if (!fs.existsSync(globalEnvPath)) return;
|
|
1042
1042
|
dotenv.config({
|
|
1043
1043
|
quiet,
|
|
1044
1044
|
path: globalEnvPath,
|
|
@@ -1159,7 +1159,7 @@ function resolveTimeoutMs(timeoutMs) {
|
|
|
1159
1159
|
function readEtcShells() {
|
|
1160
1160
|
if (cachedEtcShells !== void 0) return cachedEtcShells;
|
|
1161
1161
|
try {
|
|
1162
|
-
const entries =
|
|
1162
|
+
const entries = fs.readFileSync("/etc/shells", "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#") && path.isAbsolute(line));
|
|
1163
1163
|
cachedEtcShells = new Set(entries);
|
|
1164
1164
|
} catch {
|
|
1165
1165
|
cachedEtcShells = null;
|
|
@@ -1534,7 +1534,7 @@ function resolveActiveTalkProviderConfig(talk) {
|
|
|
1534
1534
|
};
|
|
1535
1535
|
}
|
|
1536
1536
|
function readTalkApiKeyFromProfile(deps = {}) {
|
|
1537
|
-
const fsImpl = deps.fs ??
|
|
1537
|
+
const fsImpl = deps.fs ?? fs;
|
|
1538
1538
|
const osImpl = deps.os ?? os;
|
|
1539
1539
|
const pathImpl = deps.path ?? path;
|
|
1540
1540
|
const home = osImpl.homedir();
|
|
@@ -2083,7 +2083,7 @@ function isPathInside$1(basePath, candidatePath) {
|
|
|
2083
2083
|
}
|
|
2084
2084
|
function safeRealpathSync$1(filePath) {
|
|
2085
2085
|
try {
|
|
2086
|
-
return
|
|
2086
|
+
return fs.realpathSync(filePath);
|
|
2087
2087
|
} catch {
|
|
2088
2088
|
return null;
|
|
2089
2089
|
}
|
|
@@ -2192,7 +2192,7 @@ var IncludeProcessor = class IncludeProcessor {
|
|
|
2192
2192
|
const normalized = path.normalize(resolved);
|
|
2193
2193
|
if (!isPathInside$1(this.rootDir, normalized)) throw new ConfigIncludeError(`Include path escapes config directory: ${includePath} (root: ${this.rootDir})`, includePath);
|
|
2194
2194
|
try {
|
|
2195
|
-
const real =
|
|
2195
|
+
const real = fs.realpathSync(normalized);
|
|
2196
2196
|
if (!isPathInside$1(this.rootRealDir, real)) throw new ConfigIncludeError(`Include path resolves outside config directory (symlink): ${includePath} (root: ${this.rootDir})`, includePath);
|
|
2197
2197
|
} catch (err) {
|
|
2198
2198
|
if (err instanceof ConfigIncludeError) throw err;
|
|
@@ -2228,13 +2228,13 @@ var IncludeProcessor = class IncludeProcessor {
|
|
|
2228
2228
|
};
|
|
2229
2229
|
function safeRealpath(target) {
|
|
2230
2230
|
try {
|
|
2231
|
-
return
|
|
2231
|
+
return fs.realpathSync(target);
|
|
2232
2232
|
} catch {
|
|
2233
2233
|
return target;
|
|
2234
2234
|
}
|
|
2235
2235
|
}
|
|
2236
2236
|
const defaultResolver = {
|
|
2237
|
-
readFile: (p) =>
|
|
2237
|
+
readFile: (p) => fs.readFileSync(p, "utf-8"),
|
|
2238
2238
|
parseJson: (raw) => JSON5.parse(raw)
|
|
2239
2239
|
};
|
|
2240
2240
|
/**
|
|
@@ -3431,13 +3431,13 @@ function resolveBundledPluginsDir() {
|
|
|
3431
3431
|
try {
|
|
3432
3432
|
const execDir = path.dirname(process.execPath);
|
|
3433
3433
|
const sibling = path.join(execDir, "extensions");
|
|
3434
|
-
if (
|
|
3434
|
+
if (fs.existsSync(sibling)) return sibling;
|
|
3435
3435
|
} catch {}
|
|
3436
3436
|
try {
|
|
3437
3437
|
let cursor = path.dirname(fileURLToPath(import.meta.url));
|
|
3438
3438
|
for (let i = 0; i < 6; i += 1) {
|
|
3439
3439
|
const candidate = path.join(cursor, "extensions");
|
|
3440
|
-
if (
|
|
3440
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
3441
3441
|
const parent = path.dirname(cursor);
|
|
3442
3442
|
if (parent === cursor) break;
|
|
3443
3443
|
cursor = parent;
|
|
@@ -3464,20 +3464,20 @@ function normalizeStringList(value) {
|
|
|
3464
3464
|
function resolvePluginManifestPath(rootDir) {
|
|
3465
3465
|
for (const filename of PLUGIN_MANIFEST_FILENAMES) {
|
|
3466
3466
|
const candidate = path.join(rootDir, filename);
|
|
3467
|
-
if (
|
|
3467
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
3468
3468
|
}
|
|
3469
3469
|
return path.join(rootDir, PLUGIN_MANIFEST_FILENAME);
|
|
3470
3470
|
}
|
|
3471
3471
|
function loadPluginManifest(rootDir) {
|
|
3472
3472
|
const manifestPath = resolvePluginManifestPath(rootDir);
|
|
3473
|
-
if (!
|
|
3473
|
+
if (!fs.existsSync(manifestPath)) return {
|
|
3474
3474
|
ok: false,
|
|
3475
3475
|
error: `plugin manifest not found: ${manifestPath}`,
|
|
3476
3476
|
manifestPath
|
|
3477
3477
|
};
|
|
3478
3478
|
let raw;
|
|
3479
3479
|
try {
|
|
3480
|
-
raw = JSON.parse(
|
|
3480
|
+
raw = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
3481
3481
|
} catch (err) {
|
|
3482
3482
|
return {
|
|
3483
3483
|
ok: false,
|
|
@@ -3549,7 +3549,7 @@ function safeRealpathSync(targetPath, cache) {
|
|
|
3549
3549
|
const cached = cache?.get(targetPath);
|
|
3550
3550
|
if (cached) return cached;
|
|
3551
3551
|
try {
|
|
3552
|
-
const resolved =
|
|
3552
|
+
const resolved = fs.realpathSync(targetPath);
|
|
3553
3553
|
cache?.set(targetPath, resolved);
|
|
3554
3554
|
return resolved;
|
|
3555
3555
|
} catch {
|
|
@@ -3558,7 +3558,7 @@ function safeRealpathSync(targetPath, cache) {
|
|
|
3558
3558
|
}
|
|
3559
3559
|
function safeStatSync(targetPath) {
|
|
3560
3560
|
try {
|
|
3561
|
-
return
|
|
3561
|
+
return fs.statSync(targetPath);
|
|
3562
3562
|
} catch {
|
|
3563
3563
|
return null;
|
|
3564
3564
|
}
|
|
@@ -3680,9 +3680,9 @@ function shouldIgnoreScannedDirectory(dirName) {
|
|
|
3680
3680
|
}
|
|
3681
3681
|
function readPackageManifest(dir) {
|
|
3682
3682
|
const manifestPath = path.join(dir, "package.json");
|
|
3683
|
-
if (!
|
|
3683
|
+
if (!fs.existsSync(manifestPath)) return null;
|
|
3684
3684
|
try {
|
|
3685
|
-
const raw =
|
|
3685
|
+
const raw = fs.readFileSync(manifestPath, "utf-8");
|
|
3686
3686
|
return JSON.parse(raw);
|
|
3687
3687
|
} catch {
|
|
3688
3688
|
return null;
|
|
@@ -3740,10 +3740,10 @@ function resolvePackageEntrySource(params) {
|
|
|
3740
3740
|
return source;
|
|
3741
3741
|
}
|
|
3742
3742
|
function discoverInDirectory(params) {
|
|
3743
|
-
if (!
|
|
3743
|
+
if (!fs.existsSync(params.dir)) return;
|
|
3744
3744
|
let entries = [];
|
|
3745
3745
|
try {
|
|
3746
|
-
entries =
|
|
3746
|
+
entries = fs.readdirSync(params.dir, { withFileTypes: true });
|
|
3747
3747
|
} catch (err) {
|
|
3748
3748
|
params.diagnostics.push({
|
|
3749
3749
|
level: "warn",
|
|
@@ -3806,7 +3806,7 @@ function discoverInDirectory(params) {
|
|
|
3806
3806
|
"index.js",
|
|
3807
3807
|
"index.mjs",
|
|
3808
3808
|
"index.cjs"
|
|
3809
|
-
].map((candidate) => path.join(fullPath, candidate)).find((candidate) =>
|
|
3809
|
+
].map((candidate) => path.join(fullPath, candidate)).find((candidate) => fs.existsSync(candidate));
|
|
3810
3810
|
if (indexFile && isExtensionFile(indexFile)) addCandidate({
|
|
3811
3811
|
candidates: params.candidates,
|
|
3812
3812
|
diagnostics: params.diagnostics,
|
|
@@ -3824,7 +3824,7 @@ function discoverInDirectory(params) {
|
|
|
3824
3824
|
}
|
|
3825
3825
|
function discoverFromPath(params) {
|
|
3826
3826
|
const resolved = resolveUserPath(params.rawPath);
|
|
3827
|
-
if (!
|
|
3827
|
+
if (!fs.existsSync(resolved)) {
|
|
3828
3828
|
params.diagnostics.push({
|
|
3829
3829
|
level: "error",
|
|
3830
3830
|
message: `plugin path not found: ${resolved}`,
|
|
@@ -3832,7 +3832,7 @@ function discoverFromPath(params) {
|
|
|
3832
3832
|
});
|
|
3833
3833
|
return;
|
|
3834
3834
|
}
|
|
3835
|
-
const stat =
|
|
3835
|
+
const stat = fs.statSync(resolved);
|
|
3836
3836
|
if (stat.isFile()) {
|
|
3837
3837
|
if (!isExtensionFile(resolved)) {
|
|
3838
3838
|
params.diagnostics.push({
|
|
@@ -3892,7 +3892,7 @@ function discoverFromPath(params) {
|
|
|
3892
3892
|
"index.js",
|
|
3893
3893
|
"index.mjs",
|
|
3894
3894
|
"index.cjs"
|
|
3895
|
-
].map((candidate) => path.join(resolved, candidate)).find((candidate) =>
|
|
3895
|
+
].map((candidate) => path.join(resolved, candidate)).find((candidate) => fs.existsSync(candidate));
|
|
3896
3896
|
if (indexFile && isExtensionFile(indexFile)) {
|
|
3897
3897
|
addCandidate({
|
|
3898
3898
|
candidates: params.candidates,
|
|
@@ -4006,7 +4006,7 @@ function buildCacheKey(params) {
|
|
|
4006
4006
|
}
|
|
4007
4007
|
function safeStatMtimeMs(filePath) {
|
|
4008
4008
|
try {
|
|
4009
|
-
return
|
|
4009
|
+
return fs.statSync(filePath).mtimeMs;
|
|
4010
4010
|
} catch {
|
|
4011
4011
|
return null;
|
|
4012
4012
|
}
|
|
@@ -7492,7 +7492,7 @@ function resolveConfigPathForDeps(deps) {
|
|
|
7492
7492
|
}
|
|
7493
7493
|
function normalizeDeps(overrides = {}) {
|
|
7494
7494
|
return {
|
|
7495
|
-
fs: overrides.fs ??
|
|
7495
|
+
fs: overrides.fs ?? fs,
|
|
7496
7496
|
json5: overrides.json5 ?? JSON5,
|
|
7497
7497
|
env: overrides.env ?? process.env,
|
|
7498
7498
|
homedir: overrides.homedir ?? (() => resolveRequiredHomeDir(overrides.env ?? process.env, os.homedir)),
|
|
@@ -9083,19 +9083,19 @@ const OPEN_READ_FLAGS = constants.O_RDONLY | (SUPPORTS_NOFOLLOW ? constants.O_NO
|
|
|
9083
9083
|
async function openVerifiedLocalFile(filePath) {
|
|
9084
9084
|
let handle;
|
|
9085
9085
|
try {
|
|
9086
|
-
handle = await fs.open(filePath, OPEN_READ_FLAGS);
|
|
9086
|
+
handle = await fs$1.open(filePath, OPEN_READ_FLAGS);
|
|
9087
9087
|
} catch (err) {
|
|
9088
9088
|
if (isNotFoundPathError(err)) throw new SafeOpenError("not-found", "file not found");
|
|
9089
9089
|
if (isSymlinkOpenError(err)) throw new SafeOpenError("symlink", "symlink open blocked", { cause: err });
|
|
9090
9090
|
throw err;
|
|
9091
9091
|
}
|
|
9092
9092
|
try {
|
|
9093
|
-
const [stat, lstat] = await Promise.all([handle.stat(), fs.lstat(filePath)]);
|
|
9093
|
+
const [stat, lstat] = await Promise.all([handle.stat(), fs$1.lstat(filePath)]);
|
|
9094
9094
|
if (lstat.isSymbolicLink()) throw new SafeOpenError("symlink", "symlink not allowed");
|
|
9095
9095
|
if (!stat.isFile()) throw new SafeOpenError("not-file", "not a file");
|
|
9096
9096
|
if (!sameFileIdentity(stat, lstat)) throw new SafeOpenError("path-mismatch", "path changed during read");
|
|
9097
|
-
const realPath = await fs.realpath(filePath);
|
|
9098
|
-
if (!sameFileIdentity(stat, await fs.stat(realPath))) throw new SafeOpenError("path-mismatch", "path mismatch");
|
|
9097
|
+
const realPath = await fs$1.realpath(filePath);
|
|
9098
|
+
if (!sameFileIdentity(stat, await fs$1.stat(realPath))) throw new SafeOpenError("path-mismatch", "path mismatch");
|
|
9099
9099
|
return {
|
|
9100
9100
|
handle,
|
|
9101
9101
|
realPath,
|
|
@@ -9954,11 +9954,11 @@ function readJpegExifOrientation(buffer) {
|
|
|
9954
9954
|
return null;
|
|
9955
9955
|
}
|
|
9956
9956
|
async function withTempDir(fn) {
|
|
9957
|
-
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "remoteclaw-img-"));
|
|
9957
|
+
const dir = await fs$1.mkdtemp(path.join(os.tmpdir(), "remoteclaw-img-"));
|
|
9958
9958
|
try {
|
|
9959
9959
|
return await fn(dir);
|
|
9960
9960
|
} finally {
|
|
9961
|
-
await fs.rm(dir, {
|
|
9961
|
+
await fs$1.rm(dir, {
|
|
9962
9962
|
recursive: true,
|
|
9963
9963
|
force: true
|
|
9964
9964
|
}).catch(() => {});
|
|
@@ -9967,7 +9967,7 @@ async function withTempDir(fn) {
|
|
|
9967
9967
|
async function sipsMetadataFromBuffer(buffer) {
|
|
9968
9968
|
return await withTempDir(async (dir) => {
|
|
9969
9969
|
const input = path.join(dir, "in.img");
|
|
9970
|
-
await fs.writeFile(input, buffer);
|
|
9970
|
+
await fs$1.writeFile(input, buffer);
|
|
9971
9971
|
const { stdout } = await runExec("/usr/bin/sips", [
|
|
9972
9972
|
"-g",
|
|
9973
9973
|
"pixelWidth",
|
|
@@ -9995,7 +9995,7 @@ async function sipsResizeToJpeg(params) {
|
|
|
9995
9995
|
return await withTempDir(async (dir) => {
|
|
9996
9996
|
const input = path.join(dir, "in.img");
|
|
9997
9997
|
const output = path.join(dir, "out.jpg");
|
|
9998
|
-
await fs.writeFile(input, params.buffer);
|
|
9998
|
+
await fs$1.writeFile(input, params.buffer);
|
|
9999
9999
|
await runExec("/usr/bin/sips", [
|
|
10000
10000
|
"-Z",
|
|
10001
10001
|
String(Math.max(1, Math.round(params.maxSide))),
|
|
@@ -10012,14 +10012,14 @@ async function sipsResizeToJpeg(params) {
|
|
|
10012
10012
|
timeoutMs: 2e4,
|
|
10013
10013
|
maxBuffer: 1024 * 1024
|
|
10014
10014
|
});
|
|
10015
|
-
return await fs.readFile(output);
|
|
10015
|
+
return await fs$1.readFile(output);
|
|
10016
10016
|
});
|
|
10017
10017
|
}
|
|
10018
10018
|
async function sipsConvertToJpeg(buffer) {
|
|
10019
10019
|
return await withTempDir(async (dir) => {
|
|
10020
10020
|
const input = path.join(dir, "in.heic");
|
|
10021
10021
|
const output = path.join(dir, "out.jpg");
|
|
10022
|
-
await fs.writeFile(input, buffer);
|
|
10022
|
+
await fs$1.writeFile(input, buffer);
|
|
10023
10023
|
await runExec("/usr/bin/sips", [
|
|
10024
10024
|
"-s",
|
|
10025
10025
|
"format",
|
|
@@ -10031,7 +10031,7 @@ async function sipsConvertToJpeg(buffer) {
|
|
|
10031
10031
|
timeoutMs: 2e4,
|
|
10032
10032
|
maxBuffer: 1024 * 1024
|
|
10033
10033
|
});
|
|
10034
|
-
return await fs.readFile(output);
|
|
10034
|
+
return await fs$1.readFile(output);
|
|
10035
10035
|
});
|
|
10036
10036
|
}
|
|
10037
10037
|
async function getImageMetadata(buffer) {
|
|
@@ -10082,7 +10082,7 @@ async function sipsApplyOrientation(buffer, orientation) {
|
|
|
10082
10082
|
return await withTempDir(async (dir) => {
|
|
10083
10083
|
const input = path.join(dir, "in.jpg");
|
|
10084
10084
|
const output = path.join(dir, "out.jpg");
|
|
10085
|
-
await fs.writeFile(input, buffer);
|
|
10085
|
+
await fs$1.writeFile(input, buffer);
|
|
10086
10086
|
await runExec("/usr/bin/sips", [
|
|
10087
10087
|
...ops,
|
|
10088
10088
|
input,
|
|
@@ -10092,7 +10092,7 @@ async function sipsApplyOrientation(buffer, orientation) {
|
|
|
10092
10092
|
timeoutMs: 2e4,
|
|
10093
10093
|
maxBuffer: 1024 * 1024
|
|
10094
10094
|
});
|
|
10095
|
-
return await fs.readFile(output);
|
|
10095
|
+
return await fs$1.readFile(output);
|
|
10096
10096
|
});
|
|
10097
10097
|
}
|
|
10098
10098
|
async function resizeToJpeg(params) {
|
|
@@ -10245,7 +10245,7 @@ async function assertLocalMediaAllowed(mediaPath, localRoots) {
|
|
|
10245
10245
|
const roots = localRoots ?? getDefaultLocalRoots();
|
|
10246
10246
|
let resolved;
|
|
10247
10247
|
try {
|
|
10248
|
-
resolved = await fs.realpath(mediaPath);
|
|
10248
|
+
resolved = await fs$1.realpath(mediaPath);
|
|
10249
10249
|
} catch {
|
|
10250
10250
|
resolved = path.resolve(mediaPath);
|
|
10251
10251
|
}
|
|
@@ -10262,7 +10262,7 @@ async function assertLocalMediaAllowed(mediaPath, localRoots) {
|
|
|
10262
10262
|
for (const root of roots) {
|
|
10263
10263
|
let resolvedRoot;
|
|
10264
10264
|
try {
|
|
10265
|
-
resolvedRoot = await fs.realpath(root);
|
|
10265
|
+
resolvedRoot = await fs$1.realpath(root);
|
|
10266
10266
|
} catch {
|
|
10267
10267
|
resolvedRoot = path.resolve(root);
|
|
10268
10268
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as loadWebMedia } from "./media-
|
|
2
|
-
import { t as saveMediaBuffer } from "./store-
|
|
1
|
+
import { t as loadWebMedia } from "./media-CojxZ45J.js";
|
|
2
|
+
import { t as saveMediaBuffer } from "./store-CPJXuhvQ.js";
|
|
3
3
|
|
|
4
4
|
//#region src/media/outbound-attachment.ts
|
|
5
5
|
async function resolveOutboundAttachmentFromUrl(mediaUrl, maxBytes, options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as createAccountListHelpers, V as resolveAccountEntry, ft as normalizeAccountId } from "./media-
|
|
1
|
+
import { B as createAccountListHelpers, V as resolveAccountEntry, ft as normalizeAccountId } from "./media-CojxZ45J.js";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
|
|
4
4
|
//#region src/signal/accounts.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./media-
|
|
2
|
-
import "./subsystem-
|
|
3
|
-
import "./secure-random-
|
|
4
|
-
import "./fetch-
|
|
5
|
-
import { t as sendMessageSignal } from "./send-
|
|
6
|
-
import "./store-
|
|
7
|
-
import "./outbound-attachment-
|
|
1
|
+
import "./media-CojxZ45J.js";
|
|
2
|
+
import "./subsystem-BUXAJwPD.js";
|
|
3
|
+
import "./secure-random-Pl9rPl0l.js";
|
|
4
|
+
import "./fetch-BFSBLBkA.js";
|
|
5
|
+
import { t as sendMessageSignal } from "./send-CGXyTF22.js";
|
|
6
|
+
import "./store-CPJXuhvQ.js";
|
|
7
|
+
import "./outbound-attachment-B_0D60Yr.js";
|
|
8
8
|
import { WebClient } from "@slack/web-api";
|
|
9
9
|
|
|
10
10
|
//#region src/slack/client.ts
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { C as writeConfigFile, N as resolveTelegramAccount, P as isTruthyEnvValue, S as readConfigFileSnapshotForWrite, a as isGifMedia, i as getFileExtension, l as markdownToIR, o as normalizeMimeType, p as resolveMarkdownTableMode, s as mediaKindFromMime, t as loadWebMedia, x as loadConfig } from "./media-
|
|
2
|
-
import { F as expandHomePrefix, l as CONFIG_DIR, t as createSubsystemLogger, v as danger, y as logVerbose } from "./subsystem-
|
|
3
|
-
import { n as normalizeTelegramLookupTarget, r as parseTelegramTarget, t as normalizeTelegramChatId } from "./targets-
|
|
4
|
-
import { t as resolveFetch } from "./fetch-
|
|
5
|
-
import "./retry-
|
|
6
|
-
import { a as formatErrorMessage, i as extractErrorCode, o as formatUncaughtError, r as createTelegramRetryRunner, s as redactSensitiveText, t as recordChannelActivity } from "./channel-activity-
|
|
1
|
+
import { C as writeConfigFile, N as resolveTelegramAccount, P as isTruthyEnvValue, S as readConfigFileSnapshotForWrite, a as isGifMedia, i as getFileExtension, l as markdownToIR, o as normalizeMimeType, p as resolveMarkdownTableMode, s as mediaKindFromMime, t as loadWebMedia, x as loadConfig } from "./media-CojxZ45J.js";
|
|
2
|
+
import { F as expandHomePrefix, l as CONFIG_DIR, t as createSubsystemLogger, v as danger, y as logVerbose } from "./subsystem-BUXAJwPD.js";
|
|
3
|
+
import { n as normalizeTelegramLookupTarget, r as parseTelegramTarget, t as normalizeTelegramChatId } from "./targets-JCISV-hS.js";
|
|
4
|
+
import { t as resolveFetch } from "./fetch-BFSBLBkA.js";
|
|
5
|
+
import "./retry-DUjAzOBy.js";
|
|
6
|
+
import { a as formatErrorMessage, i as extractErrorCode, o as formatUncaughtError, r as createTelegramRetryRunner, s as redactSensitiveText, t as recordChannelActivity } from "./channel-activity-C-G4n9BK.js";
|
|
7
7
|
import { t as renderMarkdownWithMarkers } from "./render-6ahYfPwj.js";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
import
|
|
9
|
+
import fs, { readFileSync } from "node:fs";
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
import JSON5 from "json5";
|
|
12
|
-
import fs from "node:fs/promises";
|
|
12
|
+
import fs$1 from "node:fs/promises";
|
|
13
13
|
import crypto from "node:crypto";
|
|
14
14
|
import * as dns from "node:dns";
|
|
15
15
|
import { Agent, ProxyAgent, fetch, setGlobalDispatcher } from "undici";
|
|
@@ -640,7 +640,7 @@ function resolveCronStorePath(storePath) {
|
|
|
640
640
|
}
|
|
641
641
|
async function loadCronStore(storePath) {
|
|
642
642
|
try {
|
|
643
|
-
const raw = await
|
|
643
|
+
const raw = await fs.promises.readFile(storePath, "utf-8");
|
|
644
644
|
let parsed;
|
|
645
645
|
try {
|
|
646
646
|
parsed = JSON5.parse(raw);
|
|
@@ -661,14 +661,14 @@ async function loadCronStore(storePath) {
|
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
663
|
async function saveCronStore(storePath, store) {
|
|
664
|
-
await
|
|
664
|
+
await fs.promises.mkdir(path.dirname(storePath), { recursive: true });
|
|
665
665
|
const { randomBytes } = await import("node:crypto");
|
|
666
666
|
const tmp = `${storePath}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`;
|
|
667
667
|
const json = JSON.stringify(store, null, 2);
|
|
668
|
-
await
|
|
669
|
-
await
|
|
668
|
+
await fs.promises.writeFile(tmp, json, "utf-8");
|
|
669
|
+
await fs.promises.rename(tmp, storePath);
|
|
670
670
|
try {
|
|
671
|
-
await
|
|
671
|
+
await fs.promises.copyFile(storePath, `${storePath}.bak`);
|
|
672
672
|
} catch {}
|
|
673
673
|
}
|
|
674
674
|
|