@bitseek/claw 1.1.0-beta.2 → 1.2.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.
- package/dist/{accounts-CX1yOBOk.js → accounts-BTexwKe8.js} +1 -1
- package/dist/{accounts-DZqwa5NK.js → accounts-CFz9Jc5d.js} +1 -1
- package/dist/{accounts-CaiECgq3.js → accounts-ubG6irXZ.js} +16 -16
- package/dist/{active-listener-neKWQsOO.js → active-listener-Hd9sOu9T.js} +1 -1
- package/dist/{agent-scope-CTbRzU1C.js → agent-scope-C6hps0r3.js} +4 -4
- package/dist/{api-key-rotation-BTSy5kZN.js → api-key-rotation-WzOC5dTW.js} +2 -2
- package/dist/{audio-preflight-DZWb0ozj.js → audio-preflight-BWOdDA2n.js} +39 -39
- package/dist/{audio-transcription-runner-2dp0SxL3.js → audio-transcription-runner-DaoqvWoi.js} +11 -11
- package/dist/{bindings-Daa-Etag.js → bindings-CsIiIjqN.js} +2 -2
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +65 -65
- package/dist/bundled/bootstrap-extra-files/handler.js +7 -7
- package/dist/bundled/command-logger/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +65 -65
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-activity-Btz1t5_1.js → channel-activity-D81g48kD.js} +3 -3
- package/dist/{chrome-DX1blHAJ.js → chrome-CjTE-vWv.js} +18 -18
- package/dist/{chunk-DEkdXze6.js → chunk-DtYb6TYl.js} +1 -1
- package/dist/{commands-registry-BQkQRhEo.js → commands-registry-NIsv9Z4R.js} +5 -5
- package/dist/{deliver-C82Egs0W.js → deliver-xY3h9X6N.js} +22 -22
- package/dist/{diagnostic-DpOlXoSr.js → diagnostic-BO1GQJJf.js} +2 -2
- package/dist/{dock-DWqb4ufG.js → dock-Cr9V9V1V.js} +6 -6
- package/dist/{env-Bn6pmvjK.js → env-DNMZEG57.js} +2 -2
- package/dist/{errors-azBrKJmF.js → errors-DEkWxItM.js} +1 -1
- package/dist/{fetch-B82CeaHJ.js → fetch--iXu7oa7.js} +5 -5
- package/dist/{fetch-guard-CCLWHwu7.js → fetch-guard-CNvY0vzQ.js} +2 -2
- package/dist/{frontmatter-5U1LYLH9.js → frontmatter-DIRc-IR1.js} +2 -2
- package/dist/{fs-safe-BDR6eQAw.js → fs-safe-D8x_nIIA.js} +4 -4
- package/dist/{github-copilot-token-CPjAmbfr.js → github-copilot-token-DLGN-8YS.js} +7 -7
- package/dist/{image-BQ1JgwZu.js → image-DCyaYY2d.js} +6 -6
- package/dist/{image-ops-jvmQoiyw.js → image-ops-DCpyia_K.js} +1 -1
- package/dist/{internal-hooks-oLQ2m8YT.js → internal-hooks-yQe6H47q.js} +1 -1
- package/dist/{ir-BODD8g-I.js → ir-BZUjdf-6.js} +6 -6
- package/dist/llm-slug-generator.js +65 -65
- package/dist/{logger-DelEB7MK.js → logger-BlH5MJiV.js} +1 -1
- package/dist/{login-Cm2zDfEU.js → login-CgEHUE7h.js} +6 -6
- package/dist/{login-qr-iS1jPDpP.js → login-qr-DUJfhbUe.js} +13 -13
- package/dist/{manager-DdzkWOvc.js → manager-BNuB9clC.js} +15 -15
- package/dist/{markdown-tables-pfs_NCNh.js → markdown-tables-BHONoo6S.js} +1 -1
- package/dist/{message-channel-POuk6EOq.js → message-channel-Dl8dSs0T.js} +1 -1
- package/dist/{model-selection-DfZMxaX3.js → model-selection-D_Si2Ict.js} +44 -44
- package/dist/{outbound-4q4mbU-Z.js → outbound-DOVV_R6m.js} +7 -7
- package/dist/{outbound-attachment-CBCp1oVQ.js → outbound-attachment-C7sJLSnv.js} +2 -2
- package/dist/{path-alias-guards-DfQIjfhB.js → path-alias-guards-CKjKIhQ3.js} +1 -1
- package/dist/{paths-BZO1jkK2.js → paths-Cpu0XgUj.js} +3 -3
- package/dist/{paths-DKuX7-1L.js → paths-aGRLvQx9.js} +5 -5
- package/dist/{pi-embedded-DiUmkZyz.js → pi-embedded-DE3hb87F.js} +178 -178
- package/dist/{pi-embedded-helpers-CuwhW4u9.js → pi-embedded-helpers-CMTVhLjq.js} +29 -29
- package/dist/{pi-model-discovery-COjkql-U.js → pi-model-discovery-DCIw1y1c.js} +7 -7
- package/dist/{plugins-D63QYxW6.js → plugins-CJoaoIHc.js} +11 -11
- package/dist/{proxy-jINniQBi.js → proxy-DfJJLvch.js} +1 -1
- package/dist/{proxy-env-vYAjKL5q.js → proxy-env-BnDt8j9F.js} +1 -1
- package/dist/{proxy-fetch-AvkSvetA.js → proxy-fetch-xlbVQYN_.js} +1 -1
- package/dist/{pw-ai-BLNiRUPI.js → pw-ai-DGwA7iCM.js} +17 -17
- package/dist/{qmd-manager-BBKfRzj-.js → qmd-manager-CeN3N992.js} +11 -11
- package/dist/{query-expansion-2BrixCA2.js → query-expansion-CGnW4Mk_.js} +5 -5
- package/dist/{redact-uUggP88O.js → redact-ScShueoF.js} +1 -1
- package/dist/{registry-C2GEGa2t.js → registry-CJCkqTms.js} +3 -3
- package/dist/{replies-yAf6dFeT.js → replies-BFYGUEKu.js} +3 -3
- package/dist/{reply-prefix-9mzt89Cf.js → reply-prefix-DK1i6bCJ.js} +1 -1
- package/dist/{resolve-route-BNElrVxR.js → resolve-route-C5hVstLo.js} +4 -4
- package/dist/{retry-Ayb7e4XG.js → retry-DTeP7C3h.js} +1 -1
- package/dist/{send-Bclgg0Ur.js → send-B4pSMBHk.js} +8 -8
- package/dist/{send-Bjaa69Cy.js → send-BqKSZyIb.js} +27 -27
- package/dist/{send-DYY51FOR.js → send-CN0f1Yst.js} +6 -6
- package/dist/{send-Cp0yQi_p.js → send-V3fEVmLq.js} +10 -10
- package/dist/{send-DQ7hIAIK.js → send-XAO1mk64.js} +7 -7
- package/dist/{session-meta-CyQWVUk4.js → session-meta-Cqv55kSk.js} +2 -2
- package/dist/{session-TVb8hgJP.js → session-xKPVUYQP.js} +9 -9
- package/dist/{sessions-3jroJwu7.js → sessions-CA_BydGA.js} +31 -31
- package/dist/{skill-commands-CSr9_48V.js → skill-commands-CZFmIM-s.js} +9 -9
- package/dist/{skills-B82IjVxn.js → skills-DMmr25nW.js} +22 -22
- package/dist/{store-DhC72KqW.js → store-C8KgeMt2.js} +2 -2
- package/dist/{subsystem-CAatx5oo.js → subsystem-BRjuJbbM.js} +14 -14
- package/dist/{tables-Bfh_TnCf.js → tables-BKnPZssn.js} +1 -1
- package/dist/{target-errors-CGYXYvSZ.js → target-errors-B9Jzop3d.js} +2 -2
- package/dist/{tokens-BvzZdrVJ.js → tokens-B9EDT4jv.js} +1 -1
- package/dist/{tool-images-CqsWnc1k.js → tool-images-ffdfBx0b.js} +2 -2
- package/dist/{tool-loop-detection-C4V990MS.js → tool-loop-detection-CLoYKYIq.js} +3 -3
- package/dist/{utils-Bo1RFF0l.js → utils-BFZnl-5N.js} +6 -6
- package/dist/{web-DsAoa63g.js → web-B2_c07KN.js} +69 -69
- package/dist/{whatsapp-actions-DXjy9m41.js → whatsapp-actions-CHt12z-f.js} +28 -28
- package/dist/{workspace-CswOYN9T.js → workspace-D6mrCnXi.js} +21 -21
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { w as resolvePreferredOpenClawTmpDir } from "./subsystem-
|
|
3
|
-
import { H as loadConfig } from "./model-selection-
|
|
4
|
-
import { _ as resolveDiscordAccount, v as normalizeDiscordToken } from "./plugins-
|
|
2
|
+
import { w as resolvePreferredOpenClawTmpDir } from "./subsystem-BRjuJbbM.js";
|
|
3
|
+
import { H as loadConfig } from "./model-selection-D_Si2Ict.js";
|
|
4
|
+
import { _ as resolveDiscordAccount, v as normalizeDiscordToken } from "./plugins-CJoaoIHc.js";
|
|
5
5
|
import { i as requireTargetKind, r as parseMentionPrefixOrAtUserTarget, t as buildMessagingTarget } from "./targets-Ci42d9xO.js";
|
|
6
|
-
import { _ as maxBytesForKind, l as extensionForMime } from "./image-ops-
|
|
7
|
-
import { c as resolveChunkMode, i as chunkMarkdownTextWithMode } from "./chunk-
|
|
8
|
-
import { n as resolveMarkdownTableMode } from "./markdown-tables-
|
|
9
|
-
import { a as loadWebMedia, o as loadWebMediaRaw } from "./ir-
|
|
6
|
+
import { _ as maxBytesForKind, l as extensionForMime } from "./image-ops-DCpyia_K.js";
|
|
7
|
+
import { c as resolveChunkMode, i as chunkMarkdownTextWithMode } from "./chunk-DtYb6TYl.js";
|
|
8
|
+
import { n as resolveMarkdownTableMode } from "./markdown-tables-BHONoo6S.js";
|
|
9
|
+
import { a as loadWebMedia, o as loadWebMediaRaw } from "./ir-BZUjdf-6.js";
|
|
10
10
|
import { t as resolveFetch } from "./fetch-CIXnD4u2.js";
|
|
11
|
-
import { n as retryAsync, t as resolveRetryConfig } from "./retry-
|
|
12
|
-
import { n as recordChannelActivity, r as createDiscordRetryRunner } from "./channel-activity-
|
|
11
|
+
import { n as retryAsync, t as resolveRetryConfig } from "./retry-DTeP7C3h.js";
|
|
12
|
+
import { n as recordChannelActivity, r as createDiscordRetryRunner } from "./channel-activity-D81g48kD.js";
|
|
13
13
|
import { t as buildOutboundMediaLoadOptions } from "./load-options-xFTRYZAO.js";
|
|
14
14
|
import { n as normalizePollInput, t as normalizePollDurationHours } from "./polls-an_kOejR.js";
|
|
15
|
-
import { t as convertMarkdownTables } from "./tables-
|
|
15
|
+
import { t as convertMarkdownTables } from "./tables-BKnPZssn.js";
|
|
16
16
|
import fs from "node:fs/promises";
|
|
17
17
|
import path from "node:path";
|
|
18
18
|
import { promisify } from "node:util";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { d as normalizeE164, h as resolveUserPath } from "./utils-
|
|
3
|
-
import { H as loadConfig } from "./model-selection-
|
|
4
|
-
import { m as kindFromMime } from "./image-ops-
|
|
5
|
-
import { t as resolveIMessageAccount } from "./accounts-
|
|
6
|
-
import { n as resolveMarkdownTableMode } from "./markdown-tables-
|
|
7
|
-
import { t as convertMarkdownTables } from "./tables-
|
|
8
|
-
import { t as resolveOutboundAttachmentFromUrl } from "./outbound-attachment-
|
|
2
|
+
import { d as normalizeE164, h as resolveUserPath } from "./utils-BFZnl-5N.js";
|
|
3
|
+
import { H as loadConfig } from "./model-selection-D_Si2Ict.js";
|
|
4
|
+
import { m as kindFromMime } from "./image-ops-DCpyia_K.js";
|
|
5
|
+
import { t as resolveIMessageAccount } from "./accounts-CFz9Jc5d.js";
|
|
6
|
+
import { n as resolveMarkdownTableMode } from "./markdown-tables-BHONoo6S.js";
|
|
7
|
+
import { t as convertMarkdownTables } from "./tables-BKnPZssn.js";
|
|
8
|
+
import { t as resolveOutboundAttachmentFromUrl } from "./outbound-attachment-C7sJLSnv.js";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
10
10
|
import { createInterface } from "node:readline";
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { c as recordSessionMetaFromInbound } from "./sessions-
|
|
3
|
-
import { s as resolveStorePath } from "./paths-
|
|
2
|
+
import { c as recordSessionMetaFromInbound } from "./sessions-CA_BydGA.js";
|
|
3
|
+
import { s as resolveStorePath } from "./paths-Cpu0XgUj.js";
|
|
4
4
|
|
|
5
5
|
//#region src/channels/session-meta.ts
|
|
6
6
|
var session_meta_exports = /* @__PURE__ */ __exportAll({ recordInboundSessionMetaSafe: () => recordInboundSessionMetaSafe });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as danger, m as success, x as toPinoLikeLogger, y as getChildLogger } from "./subsystem-
|
|
2
|
-
import { a as ensureDir, h as resolveUserPath } from "./utils-
|
|
3
|
-
import { yn as VERSION } from "./model-selection-
|
|
4
|
-
import { n as formatCliCommand } from "./env-
|
|
5
|
-
import { d as resolveDefaultWebAuthDir, f as resolveWebCredsBackupPath, l as readCredsJsonRaw, p as resolveWebCredsPath, s as maybeRestoreCredsFromBackup } from "./accounts-
|
|
6
|
-
import
|
|
1
|
+
import { c as danger, m as success, x as toPinoLikeLogger, y as getChildLogger } from "./subsystem-BRjuJbbM.js";
|
|
2
|
+
import { a as ensureDir, h as resolveUserPath } from "./utils-BFZnl-5N.js";
|
|
3
|
+
import { yn as VERSION } from "./model-selection-D_Si2Ict.js";
|
|
4
|
+
import { n as formatCliCommand } from "./env-DNMZEG57.js";
|
|
5
|
+
import { d as resolveDefaultWebAuthDir, f as resolveWebCredsBackupPath, l as readCredsJsonRaw, p as resolveWebCredsPath, s as maybeRestoreCredsFromBackup } from "./accounts-ubG6irXZ.js";
|
|
6
|
+
import syncFs from "node:fs";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
8
|
import { DisconnectReason, fetchLatestBaileysVersion, makeCacheableSignalKeyStore, makeWASocket, useMultiFileAuthState } from "@whiskeysockets/baileys";
|
|
9
9
|
import qrcode from "qrcode-terminal";
|
|
@@ -22,16 +22,16 @@ async function safeSaveCreds(authDir, saveCreds, logger) {
|
|
|
22
22
|
const raw = readCredsJsonRaw(credsPath);
|
|
23
23
|
if (raw) try {
|
|
24
24
|
JSON.parse(raw);
|
|
25
|
-
|
|
25
|
+
syncFs.copyFileSync(credsPath, backupPath);
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
syncFs.chmodSync(backupPath, 384);
|
|
28
28
|
} catch {}
|
|
29
29
|
} catch {}
|
|
30
30
|
} catch {}
|
|
31
31
|
try {
|
|
32
32
|
await Promise.resolve(saveCreds());
|
|
33
33
|
try {
|
|
34
|
-
|
|
34
|
+
syncFs.chmodSync(resolveWebCredsPath(authDir), 384);
|
|
35
35
|
} catch {}
|
|
36
36
|
} catch (err) {
|
|
37
37
|
logger.warn({ error: String(err) }, "failed saving WhatsApp creds");
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { d as resolveRequiredHomeDir } from "./paths-
|
|
2
|
-
import { t as createSubsystemLogger } from "./subsystem-
|
|
1
|
+
import { d as resolveRequiredHomeDir } from "./paths-aGRLvQx9.js";
|
|
2
|
+
import { t as createSubsystemLogger } from "./subsystem-BRjuJbbM.js";
|
|
3
3
|
import { c as normalizeAgentId, h as normalizeOptionalAccountId, l as normalizeMainKey, r as buildAgentMainSessionKey, t as DEFAULT_AGENT_ID } from "./session-key-a6av96Fj.js";
|
|
4
|
-
import { d as normalizeE164 } from "./utils-
|
|
5
|
-
import { H as loadConfig, Mn as getProcessStartTime, Nn as isPidAlive, at as parseDurationMs, jn as resolveProcessScopedMap, ot as parseByteSize } from "./model-selection-
|
|
6
|
-
import { c as normalizeHyphenSlug, t as getChannelDock } from "./dock-
|
|
7
|
-
import { r as normalizeChannelId } from "./plugins-
|
|
4
|
+
import { d as normalizeE164 } from "./utils-BFZnl-5N.js";
|
|
5
|
+
import { H as loadConfig, Mn as getProcessStartTime, Nn as isPidAlive, at as parseDurationMs, jn as resolveProcessScopedMap, ot as parseByteSize } from "./model-selection-D_Si2Ict.js";
|
|
6
|
+
import { c as normalizeHyphenSlug, t as getChannelDock } from "./dock-Cr9V9V1V.js";
|
|
7
|
+
import { r as normalizeChannelId } from "./plugins-CJoaoIHc.js";
|
|
8
8
|
import { t as normalizeChatType } from "./chat-type-DKb2TlGZ.js";
|
|
9
|
-
import { o as listDeliverableMessageChannels, s as normalizeMessageChannel } from "./message-channel-
|
|
9
|
+
import { o as listDeliverableMessageChannels, s as normalizeMessageChannel } from "./message-channel-Dl8dSs0T.js";
|
|
10
10
|
import { i as writeTextAtomic } from "./json-files-JTS4WE3P.js";
|
|
11
11
|
import { n as resolveConversationLabel } from "./conversation-label-CEQUZyFY.js";
|
|
12
|
-
import { a as resolveSessionTranscriptPathInDir, i as resolveSessionTranscriptPath, n as resolveSessionFilePath, s as resolveStorePath, t as resolveDefaultSessionStorePath } from "./paths-
|
|
12
|
+
import { a as resolveSessionTranscriptPathInDir, i as resolveSessionTranscriptPath, n as resolveSessionFilePath, s as resolveStorePath, t as resolveDefaultSessionStorePath } from "./paths-Cpu0XgUj.js";
|
|
13
13
|
import { t as emitSessionTranscriptUpdate } from "./transcript-events-Cso7-m1w.js";
|
|
14
14
|
import fs from "node:fs/promises";
|
|
15
15
|
import os from "node:os";
|
|
16
16
|
import path from "node:path";
|
|
17
|
-
import
|
|
17
|
+
import syncFs from "node:fs";
|
|
18
18
|
import crypto from "node:crypto";
|
|
19
19
|
import { CURRENT_SESSION_VERSION, SessionManager } from "@mariozechner/pi-coding-agent";
|
|
20
20
|
|
|
@@ -103,7 +103,7 @@ function releaseAllLocksSync() {
|
|
|
103
103
|
if (typeof held.handle.close === "function") held.handle.close().catch(() => {});
|
|
104
104
|
} catch {}
|
|
105
105
|
try {
|
|
106
|
-
|
|
106
|
+
syncFs.rmSync(held.lockPath, { force: true });
|
|
107
107
|
} catch {}
|
|
108
108
|
HELD_LOCKS.delete(sessionFile);
|
|
109
109
|
}
|
|
@@ -908,14 +908,14 @@ function resolveSessionTranscriptCandidates(sessionId, storePath, sessionFile, a
|
|
|
908
908
|
function canonicalizePathForComparison$1(filePath) {
|
|
909
909
|
const resolved = path.resolve(filePath);
|
|
910
910
|
try {
|
|
911
|
-
return
|
|
911
|
+
return syncFs.realpathSync(resolved);
|
|
912
912
|
} catch {
|
|
913
913
|
return resolved;
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
916
|
function archiveFileOnDisk(filePath, reason) {
|
|
917
917
|
const archived = `${filePath}.${reason}.${formatSessionArchiveTimestamp()}`;
|
|
918
|
-
|
|
918
|
+
syncFs.renameSync(filePath, archived);
|
|
919
919
|
return archived;
|
|
920
920
|
}
|
|
921
921
|
/**
|
|
@@ -931,7 +931,7 @@ function archiveSessionTranscripts(opts) {
|
|
|
931
931
|
const relative = path.relative(storeDir, candidatePath);
|
|
932
932
|
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) continue;
|
|
933
933
|
}
|
|
934
|
-
if (!
|
|
934
|
+
if (!syncFs.existsSync(candidatePath)) continue;
|
|
935
935
|
try {
|
|
936
936
|
archived.push(archiveFileOnDisk(candidatePath, opts.reason));
|
|
937
937
|
} catch {}
|
|
@@ -949,15 +949,15 @@ async function cleanupArchivedSessionTranscripts(opts) {
|
|
|
949
949
|
let removed = 0;
|
|
950
950
|
let scanned = 0;
|
|
951
951
|
for (const dir of directories) {
|
|
952
|
-
const entries = await
|
|
952
|
+
const entries = await syncFs.promises.readdir(dir).catch(() => []);
|
|
953
953
|
for (const entry of entries) {
|
|
954
954
|
const timestamp = parseSessionArchiveTimestamp(entry, reason);
|
|
955
955
|
if (timestamp == null) continue;
|
|
956
956
|
scanned += 1;
|
|
957
957
|
if (now - timestamp <= opts.olderThanMs) continue;
|
|
958
958
|
const fullPath = path.join(dir, entry);
|
|
959
|
-
if (!(await
|
|
960
|
-
await
|
|
959
|
+
if (!(await syncFs.promises.stat(fullPath).catch(() => null))?.isFile()) continue;
|
|
960
|
+
await syncFs.promises.rm(fullPath).catch(() => void 0);
|
|
961
961
|
removed += 1;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
@@ -1086,7 +1086,7 @@ function isCacheEnabled(ttlMs) {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
function getFileStatSnapshot(filePath) {
|
|
1088
1088
|
try {
|
|
1089
|
-
const stats =
|
|
1089
|
+
const stats = syncFs.statSync(filePath);
|
|
1090
1090
|
return {
|
|
1091
1091
|
mtimeMs: stats.mtimeMs,
|
|
1092
1092
|
sizeBytes: stats.size
|
|
@@ -1105,7 +1105,7 @@ const NOOP_LOGGER = {
|
|
|
1105
1105
|
function canonicalizePathForComparison(filePath) {
|
|
1106
1106
|
const resolved = path.resolve(filePath);
|
|
1107
1107
|
try {
|
|
1108
|
-
return
|
|
1108
|
+
return syncFs.realpathSync(resolved);
|
|
1109
1109
|
} catch {
|
|
1110
1110
|
return resolved;
|
|
1111
1111
|
}
|
|
@@ -1163,12 +1163,12 @@ function resolveReferencedSessionTranscriptPaths(params) {
|
|
|
1163
1163
|
return referenced;
|
|
1164
1164
|
}
|
|
1165
1165
|
async function readSessionsDirFiles(sessionsDir) {
|
|
1166
|
-
const dirEntries = await
|
|
1166
|
+
const dirEntries = await syncFs.promises.readdir(sessionsDir, { withFileTypes: true }).catch(() => []);
|
|
1167
1167
|
const files = [];
|
|
1168
1168
|
for (const dirent of dirEntries) {
|
|
1169
1169
|
if (!dirent.isFile()) continue;
|
|
1170
1170
|
const filePath = path.join(sessionsDir, dirent.name);
|
|
1171
|
-
const stat = await
|
|
1171
|
+
const stat = await syncFs.promises.stat(filePath).catch(() => null);
|
|
1172
1172
|
if (!stat?.isFile()) continue;
|
|
1173
1173
|
files.push({
|
|
1174
1174
|
path: filePath,
|
|
@@ -1181,9 +1181,9 @@ async function readSessionsDirFiles(sessionsDir) {
|
|
|
1181
1181
|
return files;
|
|
1182
1182
|
}
|
|
1183
1183
|
async function removeFileIfExists(filePath) {
|
|
1184
|
-
const stat = await
|
|
1184
|
+
const stat = await syncFs.promises.stat(filePath).catch(() => null);
|
|
1185
1185
|
if (!stat?.isFile()) return 0;
|
|
1186
|
-
await
|
|
1186
|
+
await syncFs.promises.rm(filePath, { force: true }).catch(() => void 0);
|
|
1187
1187
|
return stat.size;
|
|
1188
1188
|
}
|
|
1189
1189
|
async function removeFileForBudget(params) {
|
|
@@ -1542,7 +1542,7 @@ function capEntryCount(store, overrideMax, opts = {}) {
|
|
|
1542
1542
|
}
|
|
1543
1543
|
async function getSessionFileSize(storePath) {
|
|
1544
1544
|
try {
|
|
1545
|
-
return (await
|
|
1545
|
+
return (await syncFs.promises.stat(storePath)).size;
|
|
1546
1546
|
} catch {
|
|
1547
1547
|
return null;
|
|
1548
1548
|
}
|
|
@@ -1559,7 +1559,7 @@ async function rotateSessionFile(storePath, overrideBytes) {
|
|
|
1559
1559
|
if (fileSize <= maxBytes) return false;
|
|
1560
1560
|
const backupPath = `${storePath}.bak.${Date.now()}`;
|
|
1561
1561
|
try {
|
|
1562
|
-
await
|
|
1562
|
+
await syncFs.promises.rename(storePath, backupPath);
|
|
1563
1563
|
log$1.info("rotated session store file", {
|
|
1564
1564
|
backupPath: path.basename(backupPath),
|
|
1565
1565
|
sizeBytes: fileSize
|
|
@@ -1570,11 +1570,11 @@ async function rotateSessionFile(storePath, overrideBytes) {
|
|
|
1570
1570
|
try {
|
|
1571
1571
|
const dir = path.dirname(storePath);
|
|
1572
1572
|
const baseName = path.basename(storePath);
|
|
1573
|
-
const backups = (await
|
|
1573
|
+
const backups = (await syncFs.promises.readdir(dir)).filter((f) => f.startsWith(`${baseName}.bak.`)).toSorted().toReversed();
|
|
1574
1574
|
const maxBackups = 3;
|
|
1575
1575
|
if (backups.length > maxBackups) {
|
|
1576
1576
|
const toDelete = backups.slice(maxBackups);
|
|
1577
|
-
for (const old of toDelete) await
|
|
1577
|
+
for (const old of toDelete) await syncFs.promises.unlink(path.join(dir, old)).catch(() => void 0);
|
|
1578
1578
|
log$1.info("cleaned up old session store backups", { deleted: toDelete.length });
|
|
1579
1579
|
}
|
|
1580
1580
|
} catch {}
|
|
@@ -1697,7 +1697,7 @@ function loadSessionStore(storePath, opts = {}) {
|
|
|
1697
1697
|
const maxReadAttempts = process.platform === "win32" ? 3 : 1;
|
|
1698
1698
|
const retryBuf = maxReadAttempts > 1 ? new Int32Array(new SharedArrayBuffer(4)) : void 0;
|
|
1699
1699
|
for (let attempt = 0; attempt < maxReadAttempts; attempt++) try {
|
|
1700
|
-
const raw =
|
|
1700
|
+
const raw = syncFs.readFileSync(storePath, "utf-8");
|
|
1701
1701
|
if (raw.length === 0 && attempt < maxReadAttempts - 1) {
|
|
1702
1702
|
Atomics.wait(retryBuf, 0, 0, 50);
|
|
1703
1703
|
continue;
|
|
@@ -1851,7 +1851,7 @@ async function saveSessionStoreUnlocked(storePath, store, opts) {
|
|
|
1851
1851
|
});
|
|
1852
1852
|
}
|
|
1853
1853
|
}
|
|
1854
|
-
await
|
|
1854
|
+
await syncFs.promises.mkdir(path.dirname(storePath), { recursive: true });
|
|
1855
1855
|
const json = JSON.stringify(store, null, 2);
|
|
1856
1856
|
if (getSerializedSessionStore(storePath) === json) {
|
|
1857
1857
|
updateSessionStoreWriteCaches({
|
|
@@ -2173,8 +2173,8 @@ function resolveMirroredTranscriptText(params) {
|
|
|
2173
2173
|
return trimmed ? trimmed : null;
|
|
2174
2174
|
}
|
|
2175
2175
|
async function ensureSessionHeader(params) {
|
|
2176
|
-
if (
|
|
2177
|
-
await
|
|
2176
|
+
if (syncFs.existsSync(params.sessionFile)) return;
|
|
2177
|
+
await syncFs.promises.mkdir(path.dirname(params.sessionFile), { recursive: true });
|
|
2178
2178
|
const header = {
|
|
2179
2179
|
type: "session",
|
|
2180
2180
|
version: CURRENT_SESSION_VERSION,
|
|
@@ -2182,7 +2182,7 @@ async function ensureSessionHeader(params) {
|
|
|
2182
2182
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2183
2183
|
cwd: process.cwd()
|
|
2184
2184
|
};
|
|
2185
|
-
await
|
|
2185
|
+
await syncFs.promises.writeFile(params.sessionFile, `${JSON.stringify(header)}\n`, {
|
|
2186
2186
|
encoding: "utf-8",
|
|
2187
2187
|
mode: 384
|
|
2188
2188
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
-
import { n as listAgentIds, o as resolveAgentSkillsFilter, s as resolveAgentWorkspaceDir } from "./agent-scope-
|
|
3
|
-
import { c as resolveStateDir } from "./paths-
|
|
4
|
-
import { t as createSubsystemLogger, u as logVerbose } from "./subsystem-
|
|
5
|
-
import { h as resolveUserPath, t as CONFIG_DIR } from "./utils-
|
|
6
|
-
import { o as resolvePluginSkillDirs, t as buildWorkspaceSkillCommandSpecs } from "./skills-
|
|
2
|
+
import { n as listAgentIds, o as resolveAgentSkillsFilter, s as resolveAgentWorkspaceDir } from "./agent-scope-C6hps0r3.js";
|
|
3
|
+
import { c as resolveStateDir } from "./paths-aGRLvQx9.js";
|
|
4
|
+
import { t as createSubsystemLogger, u as logVerbose } from "./subsystem-BRjuJbbM.js";
|
|
5
|
+
import { h as resolveUserPath, t as CONFIG_DIR } from "./utils-BFZnl-5N.js";
|
|
6
|
+
import { o as resolvePluginSkillDirs, t as buildWorkspaceSkillCommandSpecs } from "./skills-DMmr25nW.js";
|
|
7
7
|
import { t as createAsyncLock } from "./json-files-JTS4WE3P.js";
|
|
8
|
-
import { a as listChatCommands } from "./commands-registry-
|
|
8
|
+
import { a as listChatCommands } from "./commands-registry-NIsv9Z4R.js";
|
|
9
9
|
import os from "node:os";
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
import
|
|
11
|
+
import syncFs from "node:fs";
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
13
13
|
import chokidar from "chokidar";
|
|
14
14
|
|
|
@@ -248,13 +248,13 @@ function listSkillCommandsForAgents(params) {
|
|
|
248
248
|
const workspaceFilters = /* @__PURE__ */ new Map();
|
|
249
249
|
for (const agentId of agentIds) {
|
|
250
250
|
const workspaceDir = resolveAgentWorkspaceDir(params.cfg, agentId);
|
|
251
|
-
if (!
|
|
251
|
+
if (!syncFs.existsSync(workspaceDir)) {
|
|
252
252
|
logVerbose(`Skipping agent "${agentId}": workspace does not exist: ${workspaceDir}`);
|
|
253
253
|
continue;
|
|
254
254
|
}
|
|
255
255
|
let canonicalDir;
|
|
256
256
|
try {
|
|
257
|
-
canonicalDir =
|
|
257
|
+
canonicalDir = syncFs.realpathSync(workspaceDir);
|
|
258
258
|
} catch {
|
|
259
259
|
logVerbose(`Skipping agent "${agentId}": cannot resolve workspace: ${workspaceDir}`);
|
|
260
260
|
continue;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { p as normalizeSkillFilter } from "./agent-scope-
|
|
2
|
-
import { t as createSubsystemLogger, w as resolvePreferredOpenClawTmpDir } from "./subsystem-
|
|
3
|
-
import { h as resolveUserPath, t as CONFIG_DIR } from "./utils-
|
|
4
|
-
import { A as isPathInside, _ as resolveOpenClawPackageRootSync } from "./workspace-
|
|
5
|
-
import { At as resolveEffectiveEnableState, Sn as isDangerousHostEnvVarName, hn as isPathInsideWithRealpath, jt as resolveMemorySlotDecision, kt as normalizePluginsConfig, wt as loadPluginManifestRegistry } from "./model-selection-
|
|
6
|
-
import { a as resolveOpenClawManifestBlock, c as resolveOpenClawManifestRequires, d as hasBinary, f as isConfigPathTruthyWithDefaults, i as parseOpenClawManifestInstallBase, l as parseFrontmatterBlock, n as normalizeStringList, o as resolveOpenClawManifestInstall, r as parseFrontmatterBool, s as resolveOpenClawManifestOs, t as getFrontmatterString, u as evaluateRuntimeEligibility } from "./frontmatter-
|
|
7
|
-
import { n as assertNoPathAliasEscape } from "./path-alias-guards-
|
|
1
|
+
import { p as normalizeSkillFilter } from "./agent-scope-C6hps0r3.js";
|
|
2
|
+
import { t as createSubsystemLogger, w as resolvePreferredOpenClawTmpDir } from "./subsystem-BRjuJbbM.js";
|
|
3
|
+
import { h as resolveUserPath, t as CONFIG_DIR } from "./utils-BFZnl-5N.js";
|
|
4
|
+
import { A as isPathInside, _ as resolveOpenClawPackageRootSync } from "./workspace-D6mrCnXi.js";
|
|
5
|
+
import { At as resolveEffectiveEnableState, Sn as isDangerousHostEnvVarName, hn as isPathInsideWithRealpath, jt as resolveMemorySlotDecision, kt as normalizePluginsConfig, wt as loadPluginManifestRegistry } from "./model-selection-D_Si2Ict.js";
|
|
6
|
+
import { a as resolveOpenClawManifestBlock, c as resolveOpenClawManifestRequires, d as hasBinary, f as isConfigPathTruthyWithDefaults, i as parseOpenClawManifestInstallBase, l as parseFrontmatterBlock, n as normalizeStringList, o as resolveOpenClawManifestInstall, r as parseFrontmatterBool, s as resolveOpenClawManifestOs, t as getFrontmatterString, u as evaluateRuntimeEligibility } from "./frontmatter-DIRc-IR1.js";
|
|
7
|
+
import { n as assertNoPathAliasEscape } from "./path-alias-guards-CKjKIhQ3.js";
|
|
8
8
|
import os from "node:os";
|
|
9
9
|
import path from "node:path";
|
|
10
|
-
import
|
|
10
|
+
import syncFs from "node:fs";
|
|
11
11
|
import { URL as URL$1, fileURLToPath } from "node:url";
|
|
12
12
|
import { formatSkillsForPrompt, loadSkillsFromDir } from "@mariozechner/pi-coding-agent";
|
|
13
13
|
|
|
@@ -540,13 +540,13 @@ function shortPath(value) {
|
|
|
540
540
|
//#region src/agents/skills/bundled-dir.ts
|
|
541
541
|
function looksLikeSkillsDir(dir) {
|
|
542
542
|
try {
|
|
543
|
-
const entries =
|
|
543
|
+
const entries = syncFs.readdirSync(dir, { withFileTypes: true });
|
|
544
544
|
for (const entry of entries) {
|
|
545
545
|
if (entry.name.startsWith(".")) continue;
|
|
546
546
|
const fullPath = path.join(dir, entry.name);
|
|
547
547
|
if (entry.isFile() && entry.name.endsWith(".md")) return true;
|
|
548
548
|
if (entry.isDirectory()) {
|
|
549
|
-
if (
|
|
549
|
+
if (syncFs.existsSync(path.join(fullPath, "SKILL.md"))) return true;
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
} catch {
|
|
@@ -561,7 +561,7 @@ function resolveBundledSkillsDir(opts = {}) {
|
|
|
561
561
|
const execPath = opts.execPath ?? process.execPath;
|
|
562
562
|
const execDir = path.dirname(execPath);
|
|
563
563
|
const sibling = path.join(execDir, "skills");
|
|
564
|
-
if (
|
|
564
|
+
if (syncFs.existsSync(sibling)) return sibling;
|
|
565
565
|
} catch {}
|
|
566
566
|
try {
|
|
567
567
|
const moduleUrl = opts.moduleUrl ?? import.meta.url;
|
|
@@ -624,7 +624,7 @@ function resolvePluginSkillDirs(params) {
|
|
|
624
624
|
const trimmed = raw.trim();
|
|
625
625
|
if (!trimmed) continue;
|
|
626
626
|
const candidate = path.resolve(record.rootDir, trimmed);
|
|
627
|
-
if (!
|
|
627
|
+
if (!syncFs.existsSync(candidate)) {
|
|
628
628
|
log.warn(`plugin skill path not found (${record.id}): ${candidate}`);
|
|
629
629
|
continue;
|
|
630
630
|
}
|
|
@@ -655,7 +655,7 @@ async function serializeByKey(key, task) {
|
|
|
655
655
|
|
|
656
656
|
//#endregion
|
|
657
657
|
//#region src/agents/skills/workspace.ts
|
|
658
|
-
const fsp =
|
|
658
|
+
const fsp = syncFs.promises;
|
|
659
659
|
const skillsLogger = createSubsystemLogger("skills");
|
|
660
660
|
const skillCommandDebugOnce = /* @__PURE__ */ new Set();
|
|
661
661
|
/**
|
|
@@ -732,7 +732,7 @@ function resolveSkillsLimits(config) {
|
|
|
732
732
|
}
|
|
733
733
|
function listChildDirectories(dir) {
|
|
734
734
|
try {
|
|
735
|
-
const entries =
|
|
735
|
+
const entries = syncFs.readdirSync(dir, { withFileTypes: true });
|
|
736
736
|
const dirs = [];
|
|
737
737
|
for (const entry of entries) {
|
|
738
738
|
if (entry.name.startsWith(".")) continue;
|
|
@@ -743,7 +743,7 @@ function listChildDirectories(dir) {
|
|
|
743
743
|
continue;
|
|
744
744
|
}
|
|
745
745
|
if (entry.isSymbolicLink()) try {
|
|
746
|
-
if (
|
|
746
|
+
if (syncFs.statSync(fullPath).isDirectory()) dirs.push(entry.name);
|
|
747
747
|
} catch {}
|
|
748
748
|
}
|
|
749
749
|
return dirs;
|
|
@@ -754,7 +754,7 @@ function listChildDirectories(dir) {
|
|
|
754
754
|
function resolveNestedSkillsRoot(dir, opts) {
|
|
755
755
|
const nested = path.join(dir, "skills");
|
|
756
756
|
try {
|
|
757
|
-
if (!
|
|
757
|
+
if (!syncFs.existsSync(nested) || !syncFs.statSync(nested).isDirectory()) return { baseDir: dir };
|
|
758
758
|
} catch {
|
|
759
759
|
return { baseDir: dir };
|
|
760
760
|
}
|
|
@@ -763,7 +763,7 @@ function resolveNestedSkillsRoot(dir, opts) {
|
|
|
763
763
|
const toScan = scanLimit === 0 ? [] : nestedDirs.slice(0, Math.min(nestedDirs.length, scanLimit));
|
|
764
764
|
for (const name of toScan) {
|
|
765
765
|
const skillMd = path.join(nested, name, "SKILL.md");
|
|
766
|
-
if (
|
|
766
|
+
if (syncFs.existsSync(skillMd)) return {
|
|
767
767
|
baseDir: nested,
|
|
768
768
|
note: `Detected nested skills root at ${nested}`
|
|
769
769
|
};
|
|
@@ -783,9 +783,9 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
783
783
|
const loadSkills = (params) => {
|
|
784
784
|
const baseDir = resolveNestedSkillsRoot(params.dir, { maxEntriesToScan: limits.maxCandidatesPerRoot }).baseDir;
|
|
785
785
|
const rootSkillMd = path.join(baseDir, "SKILL.md");
|
|
786
|
-
if (
|
|
786
|
+
if (syncFs.existsSync(rootSkillMd)) {
|
|
787
787
|
try {
|
|
788
|
-
const size =
|
|
788
|
+
const size = syncFs.statSync(rootSkillMd).size;
|
|
789
789
|
if (size > limits.maxSkillFileBytes) {
|
|
790
790
|
skillsLogger.warn("Skipping skills root due to oversized SKILL.md.", {
|
|
791
791
|
dir: baseDir,
|
|
@@ -824,9 +824,9 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
824
824
|
for (const name of limitedChildren) {
|
|
825
825
|
const skillDir = path.join(baseDir, name);
|
|
826
826
|
const skillMd = path.join(skillDir, "SKILL.md");
|
|
827
|
-
if (!
|
|
827
|
+
if (!syncFs.existsSync(skillMd)) continue;
|
|
828
828
|
try {
|
|
829
|
-
const size =
|
|
829
|
+
const size = syncFs.statSync(skillMd).size;
|
|
830
830
|
if (size > limits.maxSkillFileBytes) {
|
|
831
831
|
skillsLogger.warn("Skipping skill due to oversized SKILL.md.", {
|
|
832
832
|
skill: name,
|
|
@@ -894,7 +894,7 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
894
894
|
return Array.from(merged.values()).map((skill) => {
|
|
895
895
|
let frontmatter = {};
|
|
896
896
|
try {
|
|
897
|
-
frontmatter = parseFrontmatter(
|
|
897
|
+
frontmatter = parseFrontmatter(syncFs.readFileSync(skill.filePath, "utf-8"));
|
|
898
898
|
} catch {}
|
|
899
899
|
return {
|
|
900
900
|
skill,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as resolveConfigDir } from "./utils-
|
|
2
|
-
import { c as detectMime, l as extensionForMime } from "./image-ops-
|
|
1
|
+
import { p as resolveConfigDir } from "./utils-BFZnl-5N.js";
|
|
2
|
+
import { c as detectMime, l as extensionForMime } from "./image-ops-DCpyia_K.js";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import crypto from "node:crypto";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as resolveConfigPath } from "./paths-
|
|
1
|
+
import { r as resolveConfigPath } from "./paths-aGRLvQx9.js";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import
|
|
4
|
+
import syncFs from "node:fs";
|
|
5
5
|
import chalk, { Chalk } from "chalk";
|
|
6
6
|
import { Logger } from "tslog";
|
|
7
7
|
import JSON5 from "json5";
|
|
@@ -54,15 +54,15 @@ function getCommandPathInternal(argv, depth, opts) {
|
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/infra/tmp-openclaw-dir.ts
|
|
56
56
|
const POSIX_OPENCLAW_TMP_DIR = "/tmp/openclaw";
|
|
57
|
-
const TMP_DIR_ACCESS_MODE =
|
|
57
|
+
const TMP_DIR_ACCESS_MODE = syncFs.constants.W_OK | syncFs.constants.X_OK;
|
|
58
58
|
function isNodeErrorWithCode(err, code) {
|
|
59
59
|
return typeof err === "object" && err !== null && "code" in err && err.code === code;
|
|
60
60
|
}
|
|
61
61
|
function resolvePreferredOpenClawTmpDir(options = {}) {
|
|
62
|
-
const accessSync = options.accessSync ??
|
|
63
|
-
const chmodSync = options.chmodSync ??
|
|
64
|
-
const lstatSync = options.lstatSync ??
|
|
65
|
-
const mkdirSync = options.mkdirSync ??
|
|
62
|
+
const accessSync = options.accessSync ?? syncFs.accessSync;
|
|
63
|
+
const chmodSync = options.chmodSync ?? syncFs.chmodSync;
|
|
64
|
+
const lstatSync = options.lstatSync ?? syncFs.lstatSync;
|
|
65
|
+
const mkdirSync = options.mkdirSync ?? syncFs.mkdirSync;
|
|
66
66
|
const warn = options.warn ?? ((message) => console.warn(message));
|
|
67
67
|
const getuid = options.getuid ?? (() => {
|
|
68
68
|
try {
|
|
@@ -155,8 +155,8 @@ function resolvePreferredOpenClawTmpDir(options = {}) {
|
|
|
155
155
|
function readLoggingConfig() {
|
|
156
156
|
const configPath = resolveConfigPath();
|
|
157
157
|
try {
|
|
158
|
-
if (!
|
|
159
|
-
const raw =
|
|
158
|
+
if (!syncFs.existsSync(configPath)) return;
|
|
159
|
+
const raw = syncFs.readFileSync(configPath, "utf-8");
|
|
160
160
|
const logging = JSON5.parse(raw)?.logging;
|
|
161
161
|
if (!logging || typeof logging !== "object" || Array.isArray(logging)) return;
|
|
162
162
|
return logging;
|
|
@@ -344,7 +344,7 @@ function buildLogger(settings) {
|
|
|
344
344
|
for (const transport of externalTransports) attachExternalTransport(logger, transport);
|
|
345
345
|
return logger;
|
|
346
346
|
}
|
|
347
|
-
|
|
347
|
+
syncFs.mkdirSync(path.dirname(settings.file), { recursive: true });
|
|
348
348
|
if (isRollingPath(settings.file)) pruneOldRollingLogs(path.dirname(settings.file));
|
|
349
349
|
let currentFileBytes = getCurrentLogFileBytes(settings.file);
|
|
350
350
|
let warnedAboutSizeCap = false;
|
|
@@ -383,14 +383,14 @@ function resolveMaxLogFileBytes(raw) {
|
|
|
383
383
|
}
|
|
384
384
|
function getCurrentLogFileBytes(file) {
|
|
385
385
|
try {
|
|
386
|
-
return
|
|
386
|
+
return syncFs.statSync(file).size;
|
|
387
387
|
} catch {
|
|
388
388
|
return 0;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
function appendLogLine(file, line) {
|
|
392
392
|
try {
|
|
393
|
-
|
|
393
|
+
syncFs.appendFileSync(file, line, { encoding: "utf8" });
|
|
394
394
|
return true;
|
|
395
395
|
} catch {
|
|
396
396
|
return false;
|
|
@@ -442,14 +442,14 @@ function isRollingPath(file) {
|
|
|
442
442
|
}
|
|
443
443
|
function pruneOldRollingLogs(dir) {
|
|
444
444
|
try {
|
|
445
|
-
const entries =
|
|
445
|
+
const entries = syncFs.readdirSync(dir, { withFileTypes: true });
|
|
446
446
|
const cutoff = Date.now() - MAX_LOG_AGE_MS;
|
|
447
447
|
for (const entry of entries) {
|
|
448
448
|
if (!entry.isFile()) continue;
|
|
449
449
|
if (!entry.name.startsWith(`${LOG_PREFIX}-`) || !entry.name.endsWith(LOG_SUFFIX)) continue;
|
|
450
450
|
const fullPath = path.join(dir, entry.name);
|
|
451
451
|
try {
|
|
452
|
-
if (
|
|
452
|
+
if (syncFs.statSync(fullPath).mtimeMs < cutoff) syncFs.rmSync(fullPath, { force: true });
|
|
453
453
|
} catch {}
|
|
454
454
|
}
|
|
455
455
|
} catch {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as detectMime } from "./image-ops-
|
|
2
|
-
import { r as sanitizeToolResultImages } from "./tool-images-
|
|
1
|
+
import { c as detectMime } from "./image-ops-DCpyia_K.js";
|
|
2
|
+
import { r as sanitizeToolResultImages } from "./tool-images-ffdfBx0b.js";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
|
|
5
5
|
//#region src/agents/tools/common.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createSubsystemLogger } from "./subsystem-
|
|
2
|
-
import { i as getImageMetadata, n as buildImageResizeSideGrid, s as resizeToJpeg, t as IMAGE_REDUCE_QUALITY_STEPS } from "./image-ops-
|
|
1
|
+
import { t as createSubsystemLogger } from "./subsystem-BRjuJbbM.js";
|
|
2
|
+
import { i as getImageMetadata, n as buildImageResizeSideGrid, s as resizeToJpeg, t as IMAGE_REDUCE_QUALITY_STEPS } from "./image-ops-DCpyia_K.js";
|
|
3
3
|
|
|
4
4
|
//#region src/media/base64.ts
|
|
5
5
|
function estimateBase64DecodedBytes(base64) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./paths-
|
|
2
|
-
import { t as createSubsystemLogger } from "./subsystem-
|
|
3
|
-
import { C as isPlainObject } from "./utils-
|
|
1
|
+
import "./paths-aGRLvQx9.js";
|
|
2
|
+
import { t as createSubsystemLogger } from "./subsystem-BRjuJbbM.js";
|
|
3
|
+
import { C as isPlainObject } from "./utils-BFZnl-5N.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
|
|
6
6
|
//#region src/agents/tool-loop-detection.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as resolveStateDir, d as resolveRequiredHomeDir, l as expandHomePrefix, o as resolveOAuthDir, u as resolveEffectiveHomeDir } from "./paths-
|
|
2
|
-
import { p as shouldLogVerbose, u as logVerbose } from "./subsystem-
|
|
1
|
+
import { c as resolveStateDir, d as resolveRequiredHomeDir, l as expandHomePrefix, o as resolveOAuthDir, u as resolveEffectiveHomeDir } from "./paths-aGRLvQx9.js";
|
|
2
|
+
import { p as shouldLogVerbose, u as logVerbose } from "./subsystem-BRjuJbbM.js";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import
|
|
5
|
+
import syncFs from "node:fs";
|
|
6
6
|
|
|
7
7
|
//#region src/infra/plain-object.ts
|
|
8
8
|
/**
|
|
@@ -15,14 +15,14 @@ function isPlainObject(value) {
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/utils.ts
|
|
17
17
|
async function ensureDir(dir) {
|
|
18
|
-
await
|
|
18
|
+
await syncFs.promises.mkdir(dir, { recursive: true });
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Check if a file or directory exists at the given path.
|
|
22
22
|
*/
|
|
23
23
|
async function pathExists(targetPath) {
|
|
24
24
|
try {
|
|
25
|
-
await
|
|
25
|
+
await syncFs.promises.access(targetPath);
|
|
26
26
|
return true;
|
|
27
27
|
} catch {
|
|
28
28
|
return false;
|
|
@@ -105,7 +105,7 @@ function readLidReverseMapping(lid, opts) {
|
|
|
105
105
|
for (const dir of mappingDirs) {
|
|
106
106
|
const mappingPath = path.join(dir, mappingFilename);
|
|
107
107
|
try {
|
|
108
|
-
const data =
|
|
108
|
+
const data = syncFs.readFileSync(mappingPath, "utf8");
|
|
109
109
|
const phone = JSON.parse(data);
|
|
110
110
|
if (phone === null || phone === void 0) continue;
|
|
111
111
|
return normalizeE164(String(phone));
|