@wirecat/mail-cli 0.23.0 → 0.23.1
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/CHANGELOG.md +19 -0
- package/dist/bin/mail.js +2 -2
- package/dist/bundle/{all-profiles-CI32WFEV.js → all-profiles-FJHJCGRU.js} +7 -7
- package/dist/bundle/{anthropic-ICSOMJIN.js → anthropic-AFL7NKVZ.js} +2 -2
- package/dist/bundle/{app-server-3F4ZB7DH.js → app-server-WKCBJMHI.js} +41 -41
- package/dist/bundle/{bun-7AHNFZMZ.js → bun-HQATAQJQ.js} +2 -2
- package/dist/bundle/{bun-sqlite-UIWRS4HI.js → bun-sqlite-4ECAV7OU.js} +2 -2
- package/dist/bundle/{chunk-D6WTKSRA.js → chunk-2HXHAFRP.js} +2 -2
- package/dist/bundle/{chunk-XP5FBDIG.js → chunk-34743C4C.js} +1 -1
- package/dist/bundle/{chunk-SETCGPFG.js → chunk-3OZKDC6Y.js} +7 -6
- package/dist/bundle/{chunk-ETIUB2DF.js → chunk-3UFD76IR.js} +4 -4
- package/dist/bundle/{chunk-UA4BOLIY.js → chunk-4IFX4HV2.js} +4 -4
- package/dist/bundle/{chunk-7SIWMF77.js → chunk-4IWJARFA.js} +1 -1
- package/dist/bundle/{chunk-WQRX4RQS.js → chunk-4YJJQNNJ.js} +3 -3
- package/dist/bundle/{chunk-5Y2WRUYP.js → chunk-5UKBUI4I.js} +1 -1
- package/dist/bundle/{chunk-7OVVX4F4.js → chunk-76RTQYJQ.js} +1 -1
- package/dist/bundle/{chunk-TEL2OMS5.js → chunk-7YRKUEYE.js} +70 -49
- package/dist/bundle/{chunk-I3YNNSGB.js → chunk-AGNAT7CM.js} +1 -1
- package/dist/bundle/{chunk-4YTX5YAU.js → chunk-B6QMMRIM.js} +175 -151
- package/dist/bundle/{chunk-5J4WNTTM.js → chunk-BVJQBAGL.js} +9 -9
- package/dist/bundle/{chunk-NEDYKKJJ.js → chunk-CBWA2T3N.js} +2 -2
- package/dist/bundle/{chunk-R4RAWEMV.js → chunk-CCYHBNRL.js} +14 -14
- package/dist/bundle/{chunk-ZYHBMDNU.js → chunk-CUOCDJFI.js} +7 -7
- package/dist/bundle/{chunk-HN6PB7F5.js → chunk-CYQVWITQ.js} +16 -16
- package/dist/bundle/{chunk-SCH3NC5X.js → chunk-E7ZVKQHG.js} +2 -2
- package/dist/bundle/{chunk-B4MWHI2V.js → chunk-EXPR6QAX.js} +25 -11
- package/dist/bundle/{chunk-5AQ4S4TZ.js → chunk-FWFNUJQD.js} +17 -17
- package/dist/bundle/{chunk-UTLJQG6Q.js → chunk-GJNFNC76.js} +7 -7
- package/dist/bundle/{chunk-S2U5BXWS.js → chunk-HOKGIYUO.js} +22 -2
- package/dist/bundle/{chunk-HGV7DSSA.js → chunk-KKGX7JMX.js} +2 -2
- package/dist/bundle/{chunk-7DFWXIY5.js → chunk-LQDMUMA2.js} +222 -222
- package/dist/bundle/{chunk-FIZWQTUC.js → chunk-M7RGG3UU.js} +2 -2
- package/dist/bundle/{chunk-HRIYU2HJ.js → chunk-MBKNL5TX.js} +433 -94
- package/dist/bundle/{chunk-5Z7LZAVP.js → chunk-MUDHCYN4.js} +5 -5
- package/dist/bundle/{chunk-KNRONMVG.js → chunk-NKBAZ4VC.js} +1 -1
- package/dist/bundle/{chunk-JDKC7EXM.js → chunk-NMGF3UOZ.js} +27 -27
- package/dist/bundle/{chunk-FVKZ55I2.js → chunk-NOA6E6MM.js} +1652 -1216
- package/dist/bundle/{chunk-7ZDH2XEY.js → chunk-OJCUSHZG.js} +3 -3
- package/dist/bundle/{chunk-JO4BJYVE.js → chunk-OU5CWCG2.js} +1 -1
- package/dist/bundle/{chunk-NKDYHAHP.js → chunk-PMIKRELC.js} +2 -2
- package/dist/bundle/{chunk-XV3M3NAN.js → chunk-QR7JZM3D.js} +1 -1
- package/dist/bundle/{chunk-KJQZXCNK.js → chunk-QUKD5SO2.js} +3 -3
- package/dist/bundle/{chunk-AFPETMXZ.js → chunk-QV3M2MHG.js} +8 -8
- package/dist/bundle/{chunk-6FSLEARF.js → chunk-R554W7ZO.js} +1 -1
- package/dist/bundle/{chunk-2BAO4T4Z.js → chunk-R5MYOLQP.js} +12 -12
- package/dist/bundle/{chunk-ELGEHZK2.js → chunk-ROKTS7WM.js} +1 -1
- package/dist/bundle/{chunk-5QQOUYNA.js → chunk-S5OTP7XS.js} +2 -2
- package/dist/bundle/{chunk-B6GITVDX.js → chunk-SBGXKM4U.js} +4 -4
- package/dist/bundle/{chunk-5AS5N7V5.js → chunk-SNTLN2QT.js} +1 -1
- package/dist/bundle/{chunk-FHCOGR7S.js → chunk-SR3ADLGX.js} +2 -2
- package/dist/bundle/{chunk-SGMENSI6.js → chunk-UMXVQIGD.js} +24 -14
- package/dist/bundle/{chunk-4PNIZUEC.js → chunk-V3TDQUXD.js} +23 -23
- package/dist/bundle/{chunk-BT7UUI6E.js → chunk-V7CFZ773.js} +2 -2
- package/dist/bundle/{chunk-4TKQIXND.js → chunk-VAMCRP47.js} +1 -1
- package/dist/bundle/{chunk-AHRHP2H2.js → chunk-VFKX5UMJ.js} +5 -5
- package/dist/bundle/{chunk-CNYQ3TTZ.js → chunk-VYHIX3OP.js} +22 -22
- package/dist/bundle/{chunk-OMW37FXK.js → chunk-VYIIX6VN.js} +1 -1
- package/dist/bundle/{chunk-RIAZTS6C.js → chunk-WN4HP7IZ.js} +10 -10
- package/dist/bundle/{chunk-IMIY7HQB.js → chunk-ZXIPJF3Y.js} +1 -1
- package/dist/bundle/{command-contract-UIRWJVEY.js → command-contract-IIHBNF7J.js} +14 -14
- package/dist/bundle/{decode-BJXABRAN.js → decode-QXKTMOTH.js} +2 -2
- package/dist/bundle/{dist-LLEA6R4V.js → dist-5FX36DAW.js} +18 -10
- package/dist/bundle/{echarts-YPTKBOZV.js → echarts-HHUM43TU.js} +2 -2
- package/dist/bundle/{embed-DMROTI5M.js → embed-SRZSDZVI.js} +3 -3
- package/dist/bundle/{embedder-DWMHXCHJ.js → embedder-WZIZCWLX.js} +6 -6
- package/dist/bundle/{first-run-FQOEF2IO.js → first-run-6DVWZ3JQ.js} +5 -5
- package/dist/bundle/first-screen-SRZ7NYHZ.js +33 -0
- package/dist/bundle/{instructions-OGKMROLD.js → instructions-UWONE6UT.js} +1 -1
- package/dist/bundle/mail.js +2 -2
- package/dist/bundle/{node-HIKYE546.js → node-HLAOYJDB.js} +2 -2
- package/dist/bundle/{node-sqlite-3GJAG7VO.js → node-sqlite-RO66I7W6.js} +3 -3
- package/dist/bundle/{oauth-H3DB6IHI.js → oauth-VNLB2TET.js} +4 -4
- package/dist/bundle/{open-DJ2PRG74.js → open-QQSG343L.js} +2 -2
- package/dist/bundle/{openai-MDBRYB55.js → openai-JTFC7OGF.js} +10 -10
- package/dist/bundle/{process-4LBD72JH.js → process-3CZAXR6P.js} +1 -1
- package/dist/bundle/{program-F6WK6RX4.js → program-XTOS4RAM.js} +1504 -817
- package/dist/bundle/{prompt-UNPUG6SO.js → prompt-HGQ6GPYL.js} +2 -2
- package/dist/bundle/{recognize-DMIO4PDB.js → recognize-2SHMNEIZ.js} +1 -1
- package/dist/bundle/{remote-24HJA72D.js → remote-GBQC3433.js} +4 -4
- package/dist/bundle/{rerank-PTNCHHIU.js → rerank-FQHQXFNR.js} +4 -4
- package/dist/bundle/{serve-T6JHM2YD.js → serve-THU67QUZ.js} +6 -6
- package/dist/bundle/{server-BWEYRUR3.js → server-LOT3CLYX.js} +33 -33
- package/dist/bundle/server-VKMUX7ZT.js +65 -0
- package/dist/bundle/{sqlite-runtime-ZJ4EH5ZM.js → sqlite-runtime-NOOUMBC4.js} +3 -3
- package/dist/bundle/{state-KSN4OFYW.js → state-KSKZCV2U.js} +3 -3
- package/dist/bundle/{store-OIEZJEA7.js → store-BAKSHTKF.js} +18 -12
- package/dist/bundle/{store-GVBW2ZFK.js → store-OHNZOQ7U.js} +20 -16
- package/dist/bundle/store-maintenance-command-ROQHJVEA.js +54 -0
- package/dist/commands/rules.d.ts.map +1 -1
- package/dist/commands/rules.js +29 -7
- package/dist/commands/rules.js.map +1 -1
- package/dist/commands/sync.d.ts +0 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +8 -2
- package/dist/commands/sync.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/first-screen-B6LF5464.js +0 -33
- package/dist/bundle/server-VUQNR5ZD.js +0 -65
- package/dist/bundle/store-maintenance-command-KJ54HLUQ.js +0 -54
|
@@ -2,11 +2,11 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
renderMessages
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AGNAT7CM.js";
|
|
6
6
|
import {
|
|
7
7
|
answerOf,
|
|
8
8
|
messengerContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VYHIX3OP.js";
|
|
10
10
|
import {
|
|
11
11
|
FETCHING,
|
|
12
12
|
RULES_VERSION,
|
|
@@ -30,17 +30,17 @@ import {
|
|
|
30
30
|
typedQuery,
|
|
31
31
|
withQuery,
|
|
32
32
|
withTimeLimit
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-LQDMUMA2.js";
|
|
34
34
|
import {
|
|
35
35
|
holdLock,
|
|
36
36
|
lockPath,
|
|
37
37
|
releaseLock,
|
|
38
38
|
servingProfiles,
|
|
39
39
|
takeLock
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-M7RGG3UU.js";
|
|
41
41
|
import {
|
|
42
42
|
readSecret
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-S5OTP7XS.js";
|
|
44
44
|
import {
|
|
45
45
|
Command,
|
|
46
46
|
LOCAL_READ,
|
|
@@ -66,20 +66,20 @@ import {
|
|
|
66
66
|
snakeKeys,
|
|
67
67
|
storeTable,
|
|
68
68
|
withoutProviderRefs
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-B6QMMRIM.js";
|
|
70
70
|
import {
|
|
71
71
|
levelFor
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-SBGXKM4U.js";
|
|
73
73
|
import {
|
|
74
74
|
holdersOf
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-OU5CWCG2.js";
|
|
76
76
|
import {
|
|
77
77
|
QUICK_HEALTH_CHECKS,
|
|
78
78
|
explainDamage,
|
|
79
79
|
fts5Tables,
|
|
80
80
|
invalidJson,
|
|
81
81
|
storeHealth
|
|
82
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-CYQVWITQ.js";
|
|
83
83
|
import {
|
|
84
84
|
CORPORA,
|
|
85
85
|
MIGRATIONS,
|
|
@@ -93,6 +93,7 @@ import {
|
|
|
93
93
|
fillTrigrams,
|
|
94
94
|
fillVectorIndexes,
|
|
95
95
|
involvementStoreOver,
|
|
96
|
+
isDerivedTable,
|
|
96
97
|
migrate,
|
|
97
98
|
noteIndexState,
|
|
98
99
|
openSqlite,
|
|
@@ -113,29 +114,29 @@ import {
|
|
|
113
114
|
storeClients,
|
|
114
115
|
storeContents,
|
|
115
116
|
vectorIndexCounts
|
|
116
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-NOA6E6MM.js";
|
|
117
118
|
import {
|
|
118
119
|
formatLocator,
|
|
119
120
|
parseLocator
|
|
120
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-FWFNUJQD.js";
|
|
121
122
|
import {
|
|
122
123
|
readDamageMark,
|
|
123
124
|
readHealthMark,
|
|
124
125
|
recordDeepCheck
|
|
125
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-EXPR6QAX.js";
|
|
126
127
|
import {
|
|
127
128
|
queryFieldsOf
|
|
128
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-7YRKUEYE.js";
|
|
129
130
|
import {
|
|
130
131
|
failureKey,
|
|
131
132
|
isStoreDamage
|
|
132
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-R554W7ZO.js";
|
|
133
134
|
import {
|
|
134
135
|
storePath
|
|
135
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-5UKBUI4I.js";
|
|
136
137
|
import {
|
|
137
138
|
openCache
|
|
138
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-MUDHCYN4.js";
|
|
139
140
|
import {
|
|
140
141
|
resolvePaths,
|
|
141
142
|
writeSecurely
|
|
@@ -1817,7 +1818,7 @@ var require_liquid_node = __commonJS({
|
|
|
1817
1818
|
return readFileAsync(filepath, "utf8");
|
|
1818
1819
|
}
|
|
1819
1820
|
__name(readFile, "readFile");
|
|
1820
|
-
function
|
|
1821
|
+
function existsSync11(filepath) {
|
|
1821
1822
|
try {
|
|
1822
1823
|
fs$1.statSync(filepath);
|
|
1823
1824
|
return true;
|
|
@@ -1825,11 +1826,11 @@ var require_liquid_node = __commonJS({
|
|
|
1825
1826
|
return false;
|
|
1826
1827
|
}
|
|
1827
1828
|
}
|
|
1828
|
-
__name(
|
|
1829
|
-
function
|
|
1829
|
+
__name(existsSync11, "existsSync");
|
|
1830
|
+
function readFileSync6(filepath) {
|
|
1830
1831
|
return fs$1.readFileSync(filepath, "utf8");
|
|
1831
1832
|
}
|
|
1832
|
-
__name(
|
|
1833
|
+
__name(readFileSync6, "readFileSync");
|
|
1833
1834
|
function resolve2(root, file2, ext) {
|
|
1834
1835
|
if (!path.extname(file2))
|
|
1835
1836
|
file2 += ext;
|
|
@@ -1843,10 +1844,10 @@ var require_liquid_node = __commonJS({
|
|
|
1843
1844
|
}
|
|
1844
1845
|
}
|
|
1845
1846
|
__name(fallback, "fallback");
|
|
1846
|
-
function
|
|
1847
|
+
function dirname4(filepath) {
|
|
1847
1848
|
return path.dirname(filepath);
|
|
1848
1849
|
}
|
|
1849
|
-
__name(
|
|
1850
|
+
__name(dirname4, "dirname");
|
|
1850
1851
|
var realpathAsync = promisify(fs$1.realpath);
|
|
1851
1852
|
async function contains(root, file2) {
|
|
1852
1853
|
try {
|
|
@@ -1874,11 +1875,11 @@ var require_liquid_node = __commonJS({
|
|
|
1874
1875
|
__proto__: null,
|
|
1875
1876
|
exists,
|
|
1876
1877
|
readFile,
|
|
1877
|
-
existsSync:
|
|
1878
|
-
readFileSync:
|
|
1878
|
+
existsSync: existsSync11,
|
|
1879
|
+
readFileSync: readFileSync6,
|
|
1879
1880
|
resolve: resolve2,
|
|
1880
1881
|
fallback,
|
|
1881
|
-
dirname:
|
|
1882
|
+
dirname: dirname4,
|
|
1882
1883
|
contains,
|
|
1883
1884
|
containsSync,
|
|
1884
1885
|
sep: path.sep
|
|
@@ -3603,7 +3604,7 @@ var require_liquid_node = __commonJS({
|
|
|
3603
3604
|
uri_escape,
|
|
3604
3605
|
slugify
|
|
3605
3606
|
});
|
|
3606
|
-
var
|
|
3607
|
+
var join6 = argumentsToValue(function(v, arg) {
|
|
3607
3608
|
const array2 = toArray(v);
|
|
3608
3609
|
const sep = isNil(arg) ? " " : stringify(arg);
|
|
3609
3610
|
let outputSize = sep.length * Math.max(array2.length - 1, 0);
|
|
@@ -3879,7 +3880,7 @@ var require_liquid_node = __commonJS({
|
|
|
3879
3880
|
__name(sample, "sample");
|
|
3880
3881
|
var arrayFilters = /* @__PURE__ */ Object.freeze({
|
|
3881
3882
|
__proto__: null,
|
|
3882
|
-
join:
|
|
3883
|
+
join: join6,
|
|
3883
3884
|
last,
|
|
3884
3885
|
first,
|
|
3885
3886
|
reverse,
|
|
@@ -5503,11 +5504,11 @@ var require_liquid_node = __commonJS({
|
|
|
5503
5504
|
}
|
|
5504
5505
|
});
|
|
5505
5506
|
|
|
5506
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5507
|
-
import { chmodSync, constants, copyFileSync, existsSync as
|
|
5508
|
-
import { dirname as
|
|
5507
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
5508
|
+
import { chmodSync, constants, copyFileSync, existsSync as existsSync10, mkdirSync, realpathSync as realpathSync3, renameSync as renameSync3, rmSync as rmSync3, statfsSync as statfsSync2, statSync as statSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
5509
|
+
import { dirname as dirname3, resolve } from "node:path";
|
|
5509
5510
|
|
|
5510
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5511
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/sealed.js
|
|
5511
5512
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
|
5512
5513
|
import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
|
|
5513
5514
|
import { Transform } from "node:stream";
|
|
@@ -5614,7 +5615,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
|
|
|
5614
5615
|
renameSync(pending, to);
|
|
5615
5616
|
}, "unsealFile");
|
|
5616
5617
|
|
|
5617
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5618
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/compatibility.js
|
|
5618
5619
|
var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
|
|
5619
5620
|
var fileSchemaOf = /* @__PURE__ */ __name((database) => {
|
|
5620
5621
|
const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
|
|
@@ -5638,7 +5639,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
|
|
|
5638
5639
|
};
|
|
5639
5640
|
}, "compatibilityOf");
|
|
5640
5641
|
|
|
5641
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5642
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/repair.js
|
|
5642
5643
|
import { createHash as createHash2 } from "node:crypto";
|
|
5643
5644
|
var COPY_MARK = "__repair_";
|
|
5644
5645
|
var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
|
|
@@ -5892,17 +5893,99 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
|
|
|
5892
5893
|
return found;
|
|
5893
5894
|
}, "deleteCopy");
|
|
5894
5895
|
|
|
5895
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5896
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
5896
5897
|
import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
|
|
5897
5898
|
|
|
5898
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5899
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
5899
5900
|
import { existsSync as existsSync3 } from "node:fs";
|
|
5900
5901
|
|
|
5901
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5902
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/recover.js
|
|
5902
5903
|
import { execFileSync, spawn } from "node:child_process";
|
|
5903
5904
|
import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
|
|
5904
5905
|
import { basename, dirname, join } from "node:path";
|
|
5905
5906
|
import { Transform as Transform2 } from "node:stream";
|
|
5907
|
+
|
|
5908
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/refill.js
|
|
5909
|
+
var REFILL_MARGIN_MS = 864e5;
|
|
5910
|
+
var TIME_KEYS = 1e12;
|
|
5911
|
+
var integerId = `external_id GLOB '[0-9]*' AND NOT external_id GLOB '*[^0-9]*'`;
|
|
5912
|
+
var forgetCoverageSince = /* @__PURE__ */ __name((database, cutoff, now = Date.now()) => {
|
|
5913
|
+
database.exec("BEGIN");
|
|
5914
|
+
try {
|
|
5915
|
+
const refetch = forget(database, cutoff, now);
|
|
5916
|
+
database.exec("COMMIT");
|
|
5917
|
+
return refetch;
|
|
5918
|
+
} catch (error) {
|
|
5919
|
+
database.exec("ROLLBACK");
|
|
5920
|
+
throw error;
|
|
5921
|
+
}
|
|
5922
|
+
}, "forgetCoverageSince");
|
|
5923
|
+
var forget = /* @__PURE__ */ __name((database, cutoff, now) => {
|
|
5924
|
+
const chats = /* @__PURE__ */ new Map();
|
|
5925
|
+
const held = database.prepare(`SELECT c.id, c.account_id, c.external_id AS chat, a.provider, a.external_id AS account,
|
|
5926
|
+
max(r.to_key) AS top FROM sync_ranges r JOIN chats c ON c.id = r.chat_id JOIN accounts a ON a.id = c.account_id
|
|
5927
|
+
GROUP BY c.id`).all();
|
|
5928
|
+
for (const row of held) {
|
|
5929
|
+
const chat = Number(row.id);
|
|
5930
|
+
const top = Number(row.top);
|
|
5931
|
+
const keepTo = cutoff === null ? null : top >= TIME_KEYS ? cutoff : database.prepare(`SELECT max(CAST(external_id AS INTEGER)) AS k FROM messages WHERE chat_id = ? AND sent_at < ? AND ${integerId}`).get(chat, cutoff)?.k;
|
|
5932
|
+
if (keepTo !== null && top <= keepTo)
|
|
5933
|
+
continue;
|
|
5934
|
+
if (keepTo === null)
|
|
5935
|
+
database.prepare("DELETE FROM sync_ranges WHERE chat_id = ?").run(chat);
|
|
5936
|
+
else {
|
|
5937
|
+
database.prepare("DELETE FROM sync_ranges WHERE chat_id = ? AND from_key > ?").run(chat, keepTo);
|
|
5938
|
+
database.prepare("UPDATE sync_ranges SET to_key = ?, updated_at = ? WHERE chat_id = ? AND to_key > ?").run(keepTo, now, chat, keepTo);
|
|
5939
|
+
}
|
|
5940
|
+
const account = Number(row.account_id);
|
|
5941
|
+
const external = String(row.chat);
|
|
5942
|
+
database.prepare("DELETE FROM sync_cursors WHERE account_id = ? AND key = ?").run(account, `fetched:${external}`);
|
|
5943
|
+
database.prepare(`DELETE FROM sync_cursors WHERE account_id = ? AND key = ? AND NOT EXISTS
|
|
5944
|
+
(SELECT 1 FROM sync_ranges WHERE chat_id = ? AND from_key <= CAST(sync_cursors.value AS INTEGER))`).run(account, `history_start:${external}`, chat);
|
|
5945
|
+
const key = `${row.provider}\0${row.account}`;
|
|
5946
|
+
const one = chats.get(key) ?? { provider: String(row.provider), account: String(row.account), chats: 0 };
|
|
5947
|
+
one.chats += 1;
|
|
5948
|
+
chats.set(key, one);
|
|
5949
|
+
}
|
|
5950
|
+
return {
|
|
5951
|
+
since: cutoff === null ? null : new Date(cutoff).toISOString(),
|
|
5952
|
+
chats: [...chats.values()],
|
|
5953
|
+
mail: forgetMail(database, cutoff, now)
|
|
5954
|
+
};
|
|
5955
|
+
}, "forget");
|
|
5956
|
+
var forgetMail = /* @__PURE__ */ __name((database, cutoff, now) => {
|
|
5957
|
+
const folders = /* @__PURE__ */ new Map();
|
|
5958
|
+
const points = database.prepare(`SELECT s.account_id, s.key, s.value, a.external_id AS account FROM sync_cursors s
|
|
5959
|
+
JOIN accounts a ON a.id = s.account_id WHERE a.provider = 'email' AND s.key LIKE 'mail_resume:%'`).all();
|
|
5960
|
+
for (const row of points) {
|
|
5961
|
+
let point;
|
|
5962
|
+
try {
|
|
5963
|
+
point = JSON.parse(String(row.value));
|
|
5964
|
+
} catch {
|
|
5965
|
+
continue;
|
|
5966
|
+
}
|
|
5967
|
+
const account = String(row.account);
|
|
5968
|
+
if (!Array.isArray(point.done)) {
|
|
5969
|
+
if (cutoff !== null && Date.parse(point.updatedAt ?? "") < cutoff)
|
|
5970
|
+
continue;
|
|
5971
|
+
database.prepare("DELETE FROM sync_cursors WHERE account_id = ? AND key = ?").run(Number(row.account_id), String(row.key));
|
|
5972
|
+
folders.set(account, (folders.get(account) ?? 0) + 1);
|
|
5973
|
+
continue;
|
|
5974
|
+
}
|
|
5975
|
+
const folder = String(row.key).slice("mail_resume:".length);
|
|
5976
|
+
const last = cutoff === null ? null : database.prepare(`SELECT max(l.uid) AS uid FROM email_locations l JOIN emails e ON e.id = l.email_id
|
|
5977
|
+
WHERE l.mailbox_id = (SELECT id FROM mailboxes WHERE account_id = ? AND external_id = ?)
|
|
5978
|
+
AND l.uidvalidity = ? AND coalesce(e.received_at, e.sent_at) < ?`).get(Number(row.account_id), folder, point.validity ?? "", cutoff)?.uid;
|
|
5979
|
+
const done = last === null ? [] : point.done.filter(([from]) => from <= last).map(([from, to]) => [from, Math.min(to, last)]);
|
|
5980
|
+
if (JSON.stringify(done) === JSON.stringify(point.done))
|
|
5981
|
+
continue;
|
|
5982
|
+
database.prepare("UPDATE sync_cursors SET value = ?, updated_at = ? WHERE account_id = ? AND key = ?").run(JSON.stringify({ ...point, done }), now, Number(row.account_id), String(row.key));
|
|
5983
|
+
folders.set(account, (folders.get(account) ?? 0) + 1);
|
|
5984
|
+
}
|
|
5985
|
+
return [...folders].map(([account, count3]) => ({ account, folders: count3 }));
|
|
5986
|
+
}, "forgetMail");
|
|
5987
|
+
|
|
5988
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/store/recover.js
|
|
5906
5989
|
var SQLITE3_MINIMUM = [3, 43, 0];
|
|
5907
5990
|
var STORE_PARTS = ["", "-wal", "-shm"];
|
|
5908
5991
|
var RECOVER_LOCK = ".recover-lock";
|
|
@@ -5997,9 +6080,12 @@ var storeHolders = /* @__PURE__ */ __name((path) => {
|
|
|
5997
6080
|
return { pid, name };
|
|
5998
6081
|
});
|
|
5999
6082
|
}, "storeHolders");
|
|
6000
|
-
var
|
|
6083
|
+
var dataTables = /* @__PURE__ */ __name((database) => {
|
|
6001
6084
|
const indexes = fts5Tables(database).map((index) => index.name);
|
|
6002
|
-
|
|
6085
|
+
return database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND rootpage > 0 AND name NOT LIKE 'sqlite_%' AND name NOT LIKE 'vector_index_%' ORDER BY name").all().map((row) => String(row.name)).filter((name) => !indexes.some((index) => name.startsWith(`${index}_`)));
|
|
6086
|
+
}, "dataTables");
|
|
6087
|
+
var tableRows = /* @__PURE__ */ __name((database) => {
|
|
6088
|
+
const tables = dataTables(database);
|
|
6003
6089
|
return Object.fromEntries(tables.map((table) => {
|
|
6004
6090
|
try {
|
|
6005
6091
|
return [table, Number(database.prepare(`SELECT count(*) AS n FROM "${table}"`).get()?.n)];
|
|
@@ -6008,6 +6094,117 @@ var tableRows = /* @__PURE__ */ __name((database) => {
|
|
|
6008
6094
|
}
|
|
6009
6095
|
}));
|
|
6010
6096
|
}, "tableRows");
|
|
6097
|
+
var sourceTables = /* @__PURE__ */ __name((database) => {
|
|
6098
|
+
const withoutRowid = new Set(database.prepare("SELECT name FROM pragma_table_list WHERE wr = 1").all().map((row) => String(row.name)));
|
|
6099
|
+
return dataTables(database).filter((table) => table !== LOST_AND_FOUND && !withoutRowid.has(table) && !isDerivedTable(table));
|
|
6100
|
+
}, "sourceTables");
|
|
6101
|
+
var indexedButGone = /* @__PURE__ */ __name((database) => {
|
|
6102
|
+
const found = {};
|
|
6103
|
+
for (const table of sourceTables(database)) {
|
|
6104
|
+
const indexes = database.prepare("SELECT name FROM pragma_index_list(?) WHERE partial = 0 ORDER BY name").all(table).map((row) => String(row.name));
|
|
6105
|
+
for (const index of indexes) {
|
|
6106
|
+
const columns = database.prepare("SELECT cid, name FROM pragma_index_xinfo(?) WHERE key = 1 ORDER BY seqno").all(index);
|
|
6107
|
+
if (columns.some((column) => Number(column.cid) < 0))
|
|
6108
|
+
continue;
|
|
6109
|
+
const keys = columns.map((column) => `"${String(column.name)}"`).join(", ");
|
|
6110
|
+
const grouped = `${keys}, row_id`;
|
|
6111
|
+
let rows;
|
|
6112
|
+
try {
|
|
6113
|
+
rows = Number(database.prepare(`SELECT count(*) AS n FROM (SELECT 1 FROM (SELECT ${keys}, rowid AS row_id, 1 AS side FROM "${table}" INDEXED BY "${index}" UNION ALL SELECT ${keys}, rowid, 2 FROM "${table}" NOT INDEXED) GROUP BY ${grouped} HAVING max(side) = 1)`).get()?.n);
|
|
6114
|
+
} catch {
|
|
6115
|
+
continue;
|
|
6116
|
+
}
|
|
6117
|
+
if (rows > (found[table]?.rows ?? 0))
|
|
6118
|
+
found[table] = { rows, index };
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
return found;
|
|
6122
|
+
}, "indexedButGone");
|
|
6123
|
+
var storedAs = /* @__PURE__ */ __name((declared) => {
|
|
6124
|
+
const type = declared.toUpperCase();
|
|
6125
|
+
if (type.includes("INT"))
|
|
6126
|
+
return ["integer"];
|
|
6127
|
+
if (/CHAR|CLOB|TEXT/.test(type))
|
|
6128
|
+
return ["text"];
|
|
6129
|
+
if (type === "" || type.includes("BLOB"))
|
|
6130
|
+
return null;
|
|
6131
|
+
if (/REAL|FLOA|DOUB/.test(type))
|
|
6132
|
+
return ["real", "integer"];
|
|
6133
|
+
return null;
|
|
6134
|
+
}, "storedAs");
|
|
6135
|
+
var columnsOf = /* @__PURE__ */ __name((database, table) => {
|
|
6136
|
+
const all = database.prepare('SELECT name, type, "notnull" AS required, dflt_value, pk FROM pragma_table_info(?)').all(table);
|
|
6137
|
+
const keys = all.filter((column) => Number(column.pk) > 0);
|
|
6138
|
+
return all.map((column) => ({
|
|
6139
|
+
name: String(column.name),
|
|
6140
|
+
type: String(column.type),
|
|
6141
|
+
required: Number(column.required) === 1,
|
|
6142
|
+
hasDefault: column.dflt_value !== null,
|
|
6143
|
+
rowid: keys.length === 1 && Number(column.pk) === 1 && String(column.type).toUpperCase() === "INTEGER"
|
|
6144
|
+
}));
|
|
6145
|
+
}, "columnsOf");
|
|
6146
|
+
var fits = /* @__PURE__ */ __name((columns, fields, types) => fields <= columns.length && columns.every((column, at) => {
|
|
6147
|
+
if (at >= fields)
|
|
6148
|
+
return !column.required || column.hasDefault;
|
|
6149
|
+
const type = types[at];
|
|
6150
|
+
if (column.rowid)
|
|
6151
|
+
return type === "null" || type === "integer";
|
|
6152
|
+
if (type === "null")
|
|
6153
|
+
return !column.required;
|
|
6154
|
+
const allowed = storedAs(column.type);
|
|
6155
|
+
return allowed === null || allowed.includes(type);
|
|
6156
|
+
}), "fits");
|
|
6157
|
+
var placeLostRows = /* @__PURE__ */ __name((database) => {
|
|
6158
|
+
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE name = ?").get(LOST_AND_FOUND))
|
|
6159
|
+
return {};
|
|
6160
|
+
const fields = database.prepare("SELECT name FROM pragma_table_info(?) WHERE name GLOB 'c[0-9]*'").all(LOST_AND_FOUND).map((row) => String(row.name));
|
|
6161
|
+
const tables = sourceTables(database).map((table) => ({ table, columns: columnsOf(database, table) }));
|
|
6162
|
+
const rows = database.prepare(`SELECT rowid AS at, nfield, ${fields.map((field) => `typeof(${field}) AS "${field}"`).join(", ")} FROM ${LOST_AND_FOUND} WHERE id IS NOT NULL`).all();
|
|
6163
|
+
const placed = {};
|
|
6164
|
+
const triggers = [];
|
|
6165
|
+
const quiet = /* @__PURE__ */ __name((table) => {
|
|
6166
|
+
if (table in placed)
|
|
6167
|
+
return;
|
|
6168
|
+
placed[table] = 0;
|
|
6169
|
+
for (const row of database.prepare("SELECT name, sql FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ?").all(table)) {
|
|
6170
|
+
triggers.push(String(row.sql));
|
|
6171
|
+
database.exec(`DROP TRIGGER "${String(row.name)}"`);
|
|
6172
|
+
}
|
|
6173
|
+
}, "quiet");
|
|
6174
|
+
database.exec("PRAGMA foreign_keys = OFF");
|
|
6175
|
+
database.exec("BEGIN");
|
|
6176
|
+
try {
|
|
6177
|
+
for (const row of rows) {
|
|
6178
|
+
const count3 = Number(row.nfield);
|
|
6179
|
+
const types = fields.slice(0, count3).map((field) => String(row[field]));
|
|
6180
|
+
const fitting = tables.filter(({ columns: columns2 }) => fits(columns2, count3, types));
|
|
6181
|
+
if (fitting.length !== 1)
|
|
6182
|
+
continue;
|
|
6183
|
+
const { table, columns } = fitting[0];
|
|
6184
|
+
quiet(table);
|
|
6185
|
+
const given = columns.slice(0, count3);
|
|
6186
|
+
const names = [...given.some((column) => column.rowid) ? [] : ["rowid"], ...given.map((column) => column.name)];
|
|
6187
|
+
const values = [
|
|
6188
|
+
...given.some((column) => column.rowid) ? [] : ["id"],
|
|
6189
|
+
...given.map((column, at) => column.rowid ? "id" : `c${at}`)
|
|
6190
|
+
];
|
|
6191
|
+
const inserted = database.prepare(`INSERT OR IGNORE INTO "${table}" (${names.map((name) => `"${name}"`).join(", ")}) SELECT ${values.join(", ")} FROM ${LOST_AND_FOUND} WHERE rowid = ?`).run(Number(row.at));
|
|
6192
|
+
if (Number(inserted.changes) === 0)
|
|
6193
|
+
continue;
|
|
6194
|
+
placed[table] = (placed[table] ?? 0) + 1;
|
|
6195
|
+
database.prepare(`DELETE FROM ${LOST_AND_FOUND} WHERE rowid = ?`).run(Number(row.at));
|
|
6196
|
+
}
|
|
6197
|
+
for (const sql of triggers)
|
|
6198
|
+
database.exec(sql);
|
|
6199
|
+
database.exec("COMMIT");
|
|
6200
|
+
} catch (error) {
|
|
6201
|
+
database.exec("ROLLBACK");
|
|
6202
|
+
throw error;
|
|
6203
|
+
} finally {
|
|
6204
|
+
database.exec("PRAGMA foreign_keys = ON");
|
|
6205
|
+
}
|
|
6206
|
+
return Object.fromEntries(Object.entries(placed).filter(([, rows2]) => rows2 > 0));
|
|
6207
|
+
}, "placeLostRows");
|
|
6011
6208
|
var copyReadableRows = /* @__PURE__ */ __name((path, target, program = "sqlite3") => new Promise((resolve2, reject) => {
|
|
6012
6209
|
const reader = spawn(program, ["-readonly", path, `.recover --ignore-freelist --lost-and-found ${LOST_AND_FOUND}`], {
|
|
6013
6210
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -6204,6 +6401,9 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6204
6401
|
throw error;
|
|
6205
6402
|
throw new CliError("configuration_error", "the store file's header or schema is damaged, so its tables cannot be listed and it cannot be recovered; the file was left as it was", { reason: "store.unreadable" });
|
|
6206
6403
|
}
|
|
6404
|
+
note("looking for rows the indexes list and the tables no longer hold");
|
|
6405
|
+
const gone = indexedButGone(watch);
|
|
6406
|
+
const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
|
|
6207
6407
|
const before = { data: dataVersion(), inode: statSync2(path).ino };
|
|
6208
6408
|
const stamp = new Date(now()).toISOString().replace(/[:.]/g, "-");
|
|
6209
6409
|
const target = `${path}.recovering-${stamp}`;
|
|
@@ -6232,7 +6432,10 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6232
6432
|
let json;
|
|
6233
6433
|
let fetch;
|
|
6234
6434
|
let schema;
|
|
6435
|
+
let placed;
|
|
6436
|
+
let refetch;
|
|
6235
6437
|
try {
|
|
6438
|
+
placed = placeLostRows(opened.database);
|
|
6236
6439
|
kept = tableRows(opened.database);
|
|
6237
6440
|
migrate(opened.database, { command, ...version ? { version } : {} });
|
|
6238
6441
|
note("clearing values that are not valid JSON");
|
|
@@ -6241,6 +6444,8 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6241
6444
|
note("looking for rows that point at rows that were lost");
|
|
6242
6445
|
dangling = danglingRows(opened.database);
|
|
6243
6446
|
fetch = mailToFetch(opened.database);
|
|
6447
|
+
const good = lastKnownGood === null ? Number.NaN : Date.parse(lastKnownGood);
|
|
6448
|
+
refetch = forgetCoverageSince(opened.database, Number.isNaN(good) ? null : good - REFILL_MARGIN_MS, now());
|
|
6244
6449
|
schema = fileSchemaOf(opened.database).version;
|
|
6245
6450
|
opened.database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
6246
6451
|
} catch (error) {
|
|
@@ -6270,16 +6475,29 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6270
6475
|
if (existsSync2(`${target}${suffix}`))
|
|
6271
6476
|
renameSync2(`${target}${suffix}`, `${path}${suffix}`);
|
|
6272
6477
|
recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema, now });
|
|
6273
|
-
const lost = Object.entries(rowsBefore).map(([table, before2]) =>
|
|
6478
|
+
const lost = Object.entries(rowsBefore).map(([table, before2]) => {
|
|
6479
|
+
const goneAtLeast = Math.max(0, (gone[table]?.rows ?? 0) - (placed[table] ?? 0));
|
|
6480
|
+
return {
|
|
6481
|
+
table,
|
|
6482
|
+
before: before2,
|
|
6483
|
+
read: read[table] ?? 0,
|
|
6484
|
+
kept: kept[table] ?? 0,
|
|
6485
|
+
goneAtLeast,
|
|
6486
|
+
seenIn: goneAtLeast > 0 ? gone[table]?.index ?? null : null
|
|
6487
|
+
};
|
|
6488
|
+
}).filter(({ before: before2, read: read2, kept: kept2, goneAtLeast }) => before2 === null || before2 > kept2 || read2 > kept2 || goneAtLeast > 0);
|
|
6274
6489
|
const seconds = /* @__PURE__ */ __name((from, to) => Math.round((to - from) / 100) / 10, "seconds");
|
|
6275
6490
|
return {
|
|
6276
6491
|
path,
|
|
6277
6492
|
keptAt,
|
|
6278
6493
|
sqlite3: program.version,
|
|
6279
6494
|
lost,
|
|
6495
|
+
placed,
|
|
6496
|
+
lastKnownGood,
|
|
6280
6497
|
dangling,
|
|
6281
6498
|
invalidJson: json,
|
|
6282
6499
|
mailToFetch: fetch,
|
|
6500
|
+
refetch,
|
|
6283
6501
|
rebuilt,
|
|
6284
6502
|
copyErrors,
|
|
6285
6503
|
health,
|
|
@@ -6295,7 +6513,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6295
6513
|
}
|
|
6296
6514
|
}, "recoverLocked");
|
|
6297
6515
|
|
|
6298
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6516
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
6299
6517
|
var COUNTED = [
|
|
6300
6518
|
"accounts",
|
|
6301
6519
|
"chats",
|
|
@@ -6382,12 +6600,28 @@ var storeRecoveryRun = /* @__PURE__ */ __name(async (env, { command, version, no
|
|
|
6382
6600
|
next: [...mail, ...lostMail, "systemctl --user start <the timers stopped before>"]
|
|
6383
6601
|
};
|
|
6384
6602
|
}, "storeRecoveryRun");
|
|
6603
|
+
var refetchNotes = /* @__PURE__ */ __name(({ since, chats, mail }) => {
|
|
6604
|
+
const from = since === null ? "from the start" : `from ${since} on`;
|
|
6605
|
+
const marked = [
|
|
6606
|
+
...chats.map(({ provider, account, chats: chats2 }) => `${chats2} chats of ${provider} ${account}`),
|
|
6607
|
+
...mail.map(({ account, folders }) => `${folders} mail folders of ${account}`)
|
|
6608
|
+
];
|
|
6609
|
+
return [
|
|
6610
|
+
marked.length > 0 ? `marked as not fetched ${from}, so the next sync or serve fetches it again: ${marked.join(", ")}` : `nothing held ${from} was marked as fetched, so there is nothing to fetch again`,
|
|
6611
|
+
...chats.filter(({ provider }) => provider === "whatsapp").map(({ account }) => `whatsapp ${account}: WhatsApp cannot be asked for its chats, so only what the phone pushes while serve runs comes back`),
|
|
6612
|
+
"notes, memories, tags and whatever else only this store held cannot be fetched again"
|
|
6613
|
+
];
|
|
6614
|
+
}, "refetchNotes");
|
|
6385
6615
|
var recoveryNotes = /* @__PURE__ */ __name((answer) => {
|
|
6386
6616
|
if ("keptAt" in answer) {
|
|
6387
|
-
const lost = answer.lost.map(({ table, before, read, kept }) => `${table}: ${kept} kept of ${before ?? "an uncountable number"}${read > kept ? `, ${read - kept} read but unusable` : ""}`);
|
|
6617
|
+
const lost = answer.lost.map(({ table, before, read, kept, goneAtLeast, seenIn }) => `${table}: ${kept} kept of ${before ?? "an uncountable number"}${read > kept ? `, ${read - kept} read but unusable` : ""}` + (goneAtLeast > 0 ? `; at least ${goneAtLeast} rows are gone (the index ${seenIn} lists them)` : ""));
|
|
6618
|
+
const since = answer.lastKnownGood ? `since the last deep check that passed (${answer.lastKnownGood})` : "since the store was made (no deep check that passed is on record)";
|
|
6388
6619
|
return [
|
|
6389
6620
|
`recovered in ${answer.seconds.total} s; the damaged file is kept at ${answer.keptAt}`,
|
|
6390
|
-
...lost
|
|
6621
|
+
...lost,
|
|
6622
|
+
...Object.entries(answer.placed).map(([table, rows]) => `${table}: ${rows} rows found on pages no table claimed were put back`),
|
|
6623
|
+
...refetchNotes(answer.refetch),
|
|
6624
|
+
`${lost.some((line) => line.includes("are gone")) ? "more rows may be gone" : "how many rows were lost is unknown"}: damage can take rows written ${since} without leaving a trace; a sync fetches again what the servers still hold`,
|
|
6391
6625
|
...answer.dangling.map(({ table, parent, rows }) => `${rows} rows of ${table} point at ${parent} rows the store does not hold`),
|
|
6392
6626
|
...answer.invalidJson.map(({ table, column, rows, required }) => `${table}.${column}: ${rows} values were not valid JSON \u2014 ${required ? "those rows were dropped" : "set to empty"}`),
|
|
6393
6627
|
...answer.next.map((line) => `next: ${line}`)
|
|
@@ -6428,7 +6662,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
|
|
|
6428
6662
|
return recover;
|
|
6429
6663
|
}, "storeRecoverCommand");
|
|
6430
6664
|
|
|
6431
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6665
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
6432
6666
|
var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
|
|
6433
6667
|
var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
|
|
6434
6668
|
var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
|
|
@@ -6474,7 +6708,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
|
|
|
6474
6708
|
renderAnswer(this, outputFor(this), itemOf(answer));
|
|
6475
6709
|
}), "storeInfoCommand");
|
|
6476
6710
|
|
|
6477
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6711
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
|
|
6478
6712
|
var ENCRYPT_OPTION = [
|
|
6479
6713
|
"--encrypt",
|
|
6480
6714
|
"compress and encrypt with a password, typed at a hidden prompt or piped on stdin; it is never kept \u2014 lose it and the file cannot be opened"
|
|
@@ -6493,7 +6727,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
|
|
|
6493
6727
|
return password;
|
|
6494
6728
|
}, "passwordOf");
|
|
6495
6729
|
|
|
6496
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6730
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/rules.js
|
|
6497
6731
|
import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
|
|
6498
6732
|
import { join as join2 } from "node:path";
|
|
6499
6733
|
var REPLY_ACTIONS = ["reply", "task"];
|
|
@@ -6664,7 +6898,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
|
|
|
6664
6898
|
}, "problem");
|
|
6665
6899
|
var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
|
|
6666
6900
|
|
|
6667
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6901
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/state.js
|
|
6668
6902
|
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
6669
6903
|
import { join as join3 } from "node:path";
|
|
6670
6904
|
var ANSWERED_KEPT = 1e3;
|
|
@@ -6717,7 +6951,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
|
|
|
6717
6951
|
}, "recordReply");
|
|
6718
6952
|
var broken2 = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply state ${path} cannot be read (${why}) \u2014 fix or move the file`), "broken");
|
|
6719
6953
|
|
|
6720
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6954
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/decide.js
|
|
6721
6955
|
var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
|
|
6722
6956
|
var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
|
|
6723
6957
|
const { message, chat, owner, sender } = incoming;
|
|
@@ -6823,10 +7057,10 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
|
|
|
6823
7057
|
return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
|
|
6824
7058
|
}, "filled");
|
|
6825
7059
|
|
|
6826
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7060
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
6827
7061
|
var import_liquidjs2 = __toESM(require_liquid_node(), 1);
|
|
6828
7062
|
|
|
6829
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7063
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/render/liquid.js
|
|
6830
7064
|
var import_liquidjs = __toESM(require_liquid_node(), 1);
|
|
6831
7065
|
var safeLiquid = /* @__PURE__ */ __name((limits) => {
|
|
6832
7066
|
const engine = new import_liquidjs.Liquid({
|
|
@@ -6853,7 +7087,7 @@ var safeLiquid = /* @__PURE__ */ __name((limits) => {
|
|
|
6853
7087
|
return engine;
|
|
6854
7088
|
}, "safeLiquid");
|
|
6855
7089
|
|
|
6856
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7090
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
6857
7091
|
var TEMPLATE_LIMITS = {
|
|
6858
7092
|
parse: 32768,
|
|
6859
7093
|
renders: 2e3,
|
|
@@ -6992,7 +7226,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
6992
7226
|
}
|
|
6993
7227
|
}, "renderReplyTemplate");
|
|
6994
7228
|
|
|
6995
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7229
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
|
|
6996
7230
|
var DRY_RUN_DAYS = 7;
|
|
6997
7231
|
var PAGE = 500;
|
|
6998
7232
|
var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
|
|
@@ -7106,7 +7340,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
|
|
|
7106
7340
|
}
|
|
7107
7341
|
}, "storedSince");
|
|
7108
7342
|
|
|
7109
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7343
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
7110
7344
|
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
7111
7345
|
import { join as join4 } from "node:path";
|
|
7112
7346
|
var shape = strictObject({
|
|
@@ -7131,7 +7365,7 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
|
|
|
7131
7365
|
return consent.provider === provider && !consent.deniedChats.includes(chat);
|
|
7132
7366
|
}, "mayModelReply");
|
|
7133
7367
|
|
|
7134
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7368
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/rendering.js
|
|
7135
7369
|
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options = {
|
|
7136
7370
|
ai: true
|
|
7137
7371
|
}) => async (rule2, message, chat, now) => {
|
|
@@ -7178,7 +7412,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7178
7412
|
return result2;
|
|
7179
7413
|
}, "replyRenderer");
|
|
7180
7414
|
|
|
7181
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7415
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/replies/serve.js
|
|
7182
7416
|
var NOT_ALLOWED = "replies.send is not allow";
|
|
7183
7417
|
var NO_RULES = "no rules";
|
|
7184
7418
|
var ONLY_TASK = "opened a task, sent nothing";
|
|
@@ -7271,7 +7505,7 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
|
|
|
7271
7505
|
return { skip: why };
|
|
7272
7506
|
}, "replyTo");
|
|
7273
7507
|
|
|
7274
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7508
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
|
|
7275
7509
|
var START_SYNC_DELAY_MS = 3e4;
|
|
7276
7510
|
var START_SYNC_BUDGET_MS = 5 * 6e4;
|
|
7277
7511
|
var START_SYNC_WINDOW_MS = 7 * 864e5;
|
|
@@ -7348,7 +7582,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch, note, warn,
|
|
|
7348
7582
|
};
|
|
7349
7583
|
}, "startSync");
|
|
7350
7584
|
|
|
7351
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7585
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
|
|
7352
7586
|
var FIRST_FETCH_MS = 6e4;
|
|
7353
7587
|
var DAY_MS = 864e5;
|
|
7354
7588
|
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
|
|
@@ -7402,7 +7636,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs =
|
|
|
7402
7636
|
};
|
|
7403
7637
|
}, "memberFetches");
|
|
7404
7638
|
|
|
7405
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7639
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
|
|
7406
7640
|
var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
|
|
7407
7641
|
var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
|
|
7408
7642
|
if (context.format === "pretty") {
|
|
@@ -7435,7 +7669,93 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
|
|
|
7435
7669
|
return context;
|
|
7436
7670
|
}, "recordDiagnostics");
|
|
7437
7671
|
|
|
7438
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7672
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
|
|
7673
|
+
import { existsSync as existsSync8, readFileSync as readFileSync5, realpathSync as realpathSync2 } from "node:fs";
|
|
7674
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
7675
|
+
var OUTDATED_CHECK_MS = 6e4;
|
|
7676
|
+
var ownPackageRoot = /* @__PURE__ */ __name((running, script = process.argv[1]) => {
|
|
7677
|
+
let dir;
|
|
7678
|
+
try {
|
|
7679
|
+
dir = dirname2(realpathSync2(script ?? ""));
|
|
7680
|
+
} catch {
|
|
7681
|
+
return void 0;
|
|
7682
|
+
}
|
|
7683
|
+
for (let up = 0; up < 8; up++) {
|
|
7684
|
+
const manifest = join5(dir, "package.json");
|
|
7685
|
+
if (existsSync8(manifest))
|
|
7686
|
+
return installedVersion(dir) === running ? dir : void 0;
|
|
7687
|
+
const parent = dirname2(dir);
|
|
7688
|
+
if (parent === dir)
|
|
7689
|
+
return void 0;
|
|
7690
|
+
dir = parent;
|
|
7691
|
+
}
|
|
7692
|
+
return void 0;
|
|
7693
|
+
}, "ownPackageRoot");
|
|
7694
|
+
var installedVersion = /* @__PURE__ */ __name((root) => {
|
|
7695
|
+
try {
|
|
7696
|
+
const { version } = JSON.parse(readFileSync5(join5(root, "package.json"), "utf8"));
|
|
7697
|
+
return typeof version === "string" ? version : void 0;
|
|
7698
|
+
} catch {
|
|
7699
|
+
return void 0;
|
|
7700
|
+
}
|
|
7701
|
+
}, "installedVersion");
|
|
7702
|
+
var newer = /* @__PURE__ */ __name((one, other) => {
|
|
7703
|
+
const parts = /* @__PURE__ */ __name((version) => version.split(/[.+-]/, 3).map(Number), "parts");
|
|
7704
|
+
const [a, b] = [parts(one), parts(other)];
|
|
7705
|
+
for (let i = 0; i < 3; i++)
|
|
7706
|
+
if ((a[i] ?? 0) !== (b[i] ?? 0))
|
|
7707
|
+
return (a[i] ?? 0) > (b[i] ?? 0);
|
|
7708
|
+
return false;
|
|
7709
|
+
}, "newer");
|
|
7710
|
+
var outdatedReason = /* @__PURE__ */ __name(async ({ command, running, storePath: storePath2, packageRoot, speaks = SPEAKS }) => {
|
|
7711
|
+
const installed = packageRoot === void 0 ? void 0 : installedVersion(packageRoot);
|
|
7712
|
+
if (installed !== void 0 && newer(installed, running))
|
|
7713
|
+
return `${command} ${installed} is installed and this serve runs ${running}: stopping so it starts again on ${installed}`;
|
|
7714
|
+
if (!existsSync8(storePath2))
|
|
7715
|
+
return void 0;
|
|
7716
|
+
let schema;
|
|
7717
|
+
try {
|
|
7718
|
+
const { database } = await openSqlite(storePath2, { readOnly: true });
|
|
7719
|
+
try {
|
|
7720
|
+
schema = fileSchemaOf(database);
|
|
7721
|
+
} finally {
|
|
7722
|
+
database.close();
|
|
7723
|
+
}
|
|
7724
|
+
} catch {
|
|
7725
|
+
return void 0;
|
|
7726
|
+
}
|
|
7727
|
+
if (writableBy(schema, speaks))
|
|
7728
|
+
return void 0;
|
|
7729
|
+
return `the store is at format ${schema.version} and needs at least ${schema.minCompatible}; this serve (${command} ${running}) speaks ${speaks} and can no longer write it: stopping \u2014 \`${command} upgrade\` if it does not start again on a newer version`;
|
|
7730
|
+
}, "outdatedReason");
|
|
7731
|
+
var watchOutdated = /* @__PURE__ */ __name(({ check: check2, onOutdated, everyMs = OUTDATED_CHECK_MS }) => {
|
|
7732
|
+
let busy = false;
|
|
7733
|
+
let done = false;
|
|
7734
|
+
const timer = setInterval(() => {
|
|
7735
|
+
if (busy || done)
|
|
7736
|
+
return;
|
|
7737
|
+
busy = true;
|
|
7738
|
+
check2().then((reason) => {
|
|
7739
|
+
if (reason === void 0 || done)
|
|
7740
|
+
return;
|
|
7741
|
+
done = true;
|
|
7742
|
+
clearInterval(timer);
|
|
7743
|
+
onOutdated(reason);
|
|
7744
|
+
}).catch(() => {
|
|
7745
|
+
}).finally(() => {
|
|
7746
|
+
busy = false;
|
|
7747
|
+
});
|
|
7748
|
+
}, everyMs);
|
|
7749
|
+
timer.unref();
|
|
7750
|
+
return {
|
|
7751
|
+
stop: /* @__PURE__ */ __name(() => {
|
|
7752
|
+
done = true;
|
|
7753
|
+
clearInterval(timer);
|
|
7754
|
+
}, "stop")
|
|
7755
|
+
};
|
|
7756
|
+
}, "watchOutdated");
|
|
7757
|
+
|
|
7758
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
|
|
7439
7759
|
var STEMS_EVERY_MS = 3e4;
|
|
7440
7760
|
var STEMS_SLICE_MS = 2e3;
|
|
7441
7761
|
var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
|
|
@@ -7475,7 +7795,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
|
|
|
7475
7795
|
};
|
|
7476
7796
|
}, "stemFills");
|
|
7477
7797
|
|
|
7478
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7798
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
|
|
7479
7799
|
var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
|
|
7480
7800
|
var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
|
|
7481
7801
|
kind: attachment.kind,
|
|
@@ -7570,7 +7890,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
|
|
|
7570
7890
|
locale: messenger.app.locale
|
|
7571
7891
|
}), "viewOf");
|
|
7572
7892
|
|
|
7573
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7893
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
|
|
7574
7894
|
var observed = /* @__PURE__ */ __name((value) => ({
|
|
7575
7895
|
value: value.value,
|
|
7576
7896
|
observed_at: value.observedAt,
|
|
@@ -7637,7 +7957,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
|
|
|
7637
7957
|
}
|
|
7638
7958
|
}, "watchEventItem");
|
|
7639
7959
|
|
|
7640
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7960
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
|
|
7641
7961
|
var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
|
|
7642
7962
|
output: { entity: "watch_item" },
|
|
7643
7963
|
effects: REMOTE_READ,
|
|
@@ -7792,7 +8112,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
|
|
|
7792
8112
|
}
|
|
7793
8113
|
}, "describe");
|
|
7794
8114
|
|
|
7795
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8115
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
|
|
7796
8116
|
var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
7797
8117
|
const command = annotate(new Command("serve"), {
|
|
7798
8118
|
output: { entity: "serve_summary" },
|
|
@@ -7816,8 +8136,8 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7816
8136
|
}
|
|
7817
8137
|
let relaying;
|
|
7818
8138
|
const onReady = /* @__PURE__ */ __name(() => {
|
|
7819
|
-
const
|
|
7820
|
-
holdLock(path,
|
|
8139
|
+
const listening2 = { pid: process.pid, startedAt, version, listeningAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
8140
|
+
holdLock(path, listening2);
|
|
7821
8141
|
note({
|
|
7822
8142
|
code: "listening",
|
|
7823
8143
|
text: `listening for profile ${context.profile}, catching up on what arrived while it was down`
|
|
@@ -7826,7 +8146,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7826
8146
|
return;
|
|
7827
8147
|
relaying = relay.open(path, context.profile).then((address) => {
|
|
7828
8148
|
if (address)
|
|
7829
|
-
holdLock(path, { ...
|
|
8149
|
+
holdLock(path, { ...listening2, relay: address });
|
|
7830
8150
|
}).catch((error) => {
|
|
7831
8151
|
const errorCode = failureKey(error);
|
|
7832
8152
|
warn({ code: "relay_failed", errorCode, text: `commands cannot run through this serve: ${errorCode}` });
|
|
@@ -7835,7 +8155,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7835
8155
|
const counts = {};
|
|
7836
8156
|
const rules = replying(context, messenger, Date.parse(startedAt));
|
|
7837
8157
|
const tasks = tasking(context, warn);
|
|
7838
|
-
const { handled, startSyncDelayMs } = environmentOf(this);
|
|
8158
|
+
const { handled, startSyncDelayMs, outdated: outdatedHook } = environmentOf(this);
|
|
7839
8159
|
const count3 = /* @__PURE__ */ __name((event) => {
|
|
7840
8160
|
counts[event.event] = (counts[event.event] ?? 0) + 1;
|
|
7841
8161
|
if (event.event === "message") {
|
|
@@ -7907,9 +8227,25 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7907
8227
|
withStore: /* @__PURE__ */ __name((work) => context.withStore((store) => work(store), { name: "serve stems" }), "withStore"),
|
|
7908
8228
|
warn
|
|
7909
8229
|
});
|
|
8230
|
+
const listening = new AbortController();
|
|
8231
|
+
let outdated;
|
|
8232
|
+
const packageRoot = outdatedHook?.packageRoot ?? ownPackageRoot(version);
|
|
8233
|
+
const watch = watchOutdated({
|
|
8234
|
+
check: /* @__PURE__ */ __name(() => outdatedReason({
|
|
8235
|
+
command: messenger.app.command,
|
|
8236
|
+
running: version,
|
|
8237
|
+
storePath: storePath(context.env),
|
|
8238
|
+
packageRoot
|
|
8239
|
+
}), "check"),
|
|
8240
|
+
onOutdated: /* @__PURE__ */ __name((reason) => {
|
|
8241
|
+
outdated = reason;
|
|
8242
|
+
listening.abort();
|
|
8243
|
+
}, "onOutdated"),
|
|
8244
|
+
...outdatedHook?.everyMs === void 0 ? {} : { everyMs: outdatedHook.everyMs }
|
|
8245
|
+
});
|
|
7910
8246
|
try {
|
|
7911
8247
|
await listenUntilStopped(this, context, relay?.messenger ?? messenger, count3, {
|
|
7912
|
-
stop:
|
|
8248
|
+
stop: listening,
|
|
7913
8249
|
catchUp: true,
|
|
7914
8250
|
onReady,
|
|
7915
8251
|
connected: /* @__PURE__ */ __name((open) => {
|
|
@@ -7922,6 +8258,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7922
8258
|
}, "connected")
|
|
7923
8259
|
});
|
|
7924
8260
|
} finally {
|
|
8261
|
+
watch.stop();
|
|
7925
8262
|
await relaying;
|
|
7926
8263
|
await relay?.close();
|
|
7927
8264
|
rules.stop();
|
|
@@ -7932,6 +8269,8 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7932
8269
|
await tasks.settled();
|
|
7933
8270
|
releaseLock(path);
|
|
7934
8271
|
}
|
|
8272
|
+
if (outdated !== void 0)
|
|
8273
|
+
throw new CliError("configuration_error", outdated, { reason: "serve.outdated" });
|
|
7935
8274
|
renderAnswer(this, context, itemOf({
|
|
7936
8275
|
profile: context.profile,
|
|
7937
8276
|
started_at: startedAt,
|
|
@@ -8056,8 +8395,8 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
|
|
|
8056
8395
|
};
|
|
8057
8396
|
}, "tasking");
|
|
8058
8397
|
|
|
8059
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8060
|
-
import { existsSync as
|
|
8398
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
|
|
8399
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
8061
8400
|
var PATH = "store tables list";
|
|
8062
8401
|
var STORE_TABLES_QUERY = {
|
|
8063
8402
|
entity: "store_table",
|
|
@@ -8086,7 +8425,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8086
8425
|
const filter = filterOf(words);
|
|
8087
8426
|
const { full } = this.optsWithGlobals();
|
|
8088
8427
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8089
|
-
if (!
|
|
8428
|
+
if (!existsSync9(path))
|
|
8090
8429
|
throw new CliError("not_found", `no store at ${path}`);
|
|
8091
8430
|
const items = await readStoreTables(path, { filter, sizes: full === true });
|
|
8092
8431
|
renderAnswer(this, outputFor(this), listOf(PATH, {
|
|
@@ -8099,7 +8438,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8099
8438
|
return tables;
|
|
8100
8439
|
}, "storeTablesCommand");
|
|
8101
8440
|
|
|
8102
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8441
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.618.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_89df442a19027064da492ef27322716d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
8103
8442
|
var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
|
|
8104
8443
|
var WORD_INDEX = "message_words";
|
|
8105
8444
|
var schemaOf = /* @__PURE__ */ __name((database) => {
|
|
@@ -8108,7 +8447,7 @@ var schemaOf = /* @__PURE__ */ __name((database) => {
|
|
|
8108
8447
|
}, "schemaOf");
|
|
8109
8448
|
var count2 = /* @__PURE__ */ __name((database, table) => Number(database.prepare(`SELECT count(*) AS n FROM ${table}`).get()?.n ?? 0), "count");
|
|
8110
8449
|
var pendingIfKnown2 = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
|
|
8111
|
-
var bytesOf2 = /* @__PURE__ */ __name((path) =>
|
|
8450
|
+
var bytesOf2 = /* @__PURE__ */ __name((path) => existsSync10(path) ? statSync4(path).size : 0, "bytesOf");
|
|
8112
8451
|
var reading = /* @__PURE__ */ __name(async (path, read) => {
|
|
8113
8452
|
const database = await openCache(path);
|
|
8114
8453
|
try {
|
|
@@ -8135,7 +8474,7 @@ var fileSchema = /* @__PURE__ */ __name(async (path) => {
|
|
|
8135
8474
|
}, "fileSchema");
|
|
8136
8475
|
var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, version } = {}) => {
|
|
8137
8476
|
const path = storePath(env);
|
|
8138
|
-
if (!
|
|
8477
|
+
if (!existsSync10(path))
|
|
8139
8478
|
return { path, exists: false };
|
|
8140
8479
|
const checked = await storeHealth(path, { deep });
|
|
8141
8480
|
const recorded = deep ? recordDeepCheck(path, checked, {
|
|
@@ -8205,7 +8544,7 @@ var repairCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("
|
|
|
8205
8544
|
const { renderer, format } = outputFor(this);
|
|
8206
8545
|
const { dryRun: dryRun2 } = this.opts();
|
|
8207
8546
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8208
|
-
if (!
|
|
8547
|
+
if (!existsSync10(path)) {
|
|
8209
8548
|
result(this, { path, exists: false });
|
|
8210
8549
|
return;
|
|
8211
8550
|
}
|
|
@@ -8245,7 +8584,7 @@ var notesOf = /* @__PURE__ */ __name((report, command) => {
|
|
|
8245
8584
|
}, "notesOf");
|
|
8246
8585
|
var copiesCommand = /* @__PURE__ */ __name(() => new Command("copies").description("the tables `store repair` kept as copies").addCommand(annotate(new Command("delete"), { output: { entity: "store_copy_removal" }, effects: LOCAL_WRITE }).description("delete one copy `store repair` kept, named exactly; refuses any other table").argument("<name>", "the copy's name, as `store repair` printed it").action(async function(name) {
|
|
8247
8586
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8248
|
-
if (!
|
|
8587
|
+
if (!existsSync10(path))
|
|
8249
8588
|
throw new CliError("not_found", `no store at ${path}`);
|
|
8250
8589
|
const deleted = await reading(path, (database) => deleteCopy(database, name));
|
|
8251
8590
|
result(this, { path, deleted });
|
|
@@ -8253,7 +8592,7 @@ var copiesCommand = /* @__PURE__ */ __name(() => new Command("copies").descripti
|
|
|
8253
8592
|
var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("check"), { output: { entity: "store_check" }, effects: LOCAL_READ }).summary("check the local archive for problems").description("whether the store is healthy \u2014 integrity, search indexes, disk, and which chats are behind").action(async function() {
|
|
8254
8593
|
const { renderer } = outputFor(this);
|
|
8255
8594
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8256
|
-
if (!
|
|
8595
|
+
if (!existsSync10(path)) {
|
|
8257
8596
|
result(this, { path, exists: false, ok: true });
|
|
8258
8597
|
return;
|
|
8259
8598
|
}
|
|
@@ -8316,7 +8655,7 @@ var inspect = /* @__PURE__ */ __name((path) => reading(path, (database) => {
|
|
|
8316
8655
|
...schema.version > 0 ? [["attachment_words", indexIntegrity(database, "attachment_words", 0)]] : []
|
|
8317
8656
|
]);
|
|
8318
8657
|
const size = bytesOf2(path) + bytesOf2(`${path}-wal`);
|
|
8319
|
-
const { bavail, bsize } = statfsSync2(
|
|
8658
|
+
const { bavail, bsize } = statfsSync2(dirname3(path));
|
|
8320
8659
|
const free = Number(bavail) * Number(bsize);
|
|
8321
8660
|
const behind = schema.version > 0 ? chatsBehind(database) : [];
|
|
8322
8661
|
const vectorIndexes = schema.version >= 34 ? vectorIndexCounts(database) : [];
|
|
@@ -8404,7 +8743,7 @@ var chatsBehind = /* @__PURE__ */ __name((database) => database.prepare(`SELECT
|
|
|
8404
8743
|
var migrateCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("migrate"), { output: { entity: "store_migration" }, effects: LOCAL_WRITE }).summary("migrate an older local archive").description("bring the store up to this build's schema, then normalize, index and stem the messages and notes stored before it").action(async function() {
|
|
8405
8744
|
const { renderer } = outputFor(this);
|
|
8406
8745
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8407
|
-
if (!
|
|
8746
|
+
if (!existsSync10(path)) {
|
|
8408
8747
|
result(this, { path, exists: false });
|
|
8409
8748
|
renderer.note(`no store yet \u2014 the first \`${messenger.app.command}\` command that reads a chat creates it`);
|
|
8410
8749
|
return;
|
|
@@ -8468,7 +8807,7 @@ var buildNoteIndex = /* @__PURE__ */ __name((database, note, { reset = false } =
|
|
|
8468
8807
|
var reindexCommand = /* @__PURE__ */ __name((messenger) => destroysNothing(annotate(new Command("rebuild"), { output: { entity: "store_reindex" }, effects: LOCAL_WRITE })).summary("rebuild the local archive's search indexes").description("rebuild the word index, its typo vocabulary, the stems, the files' word index, the notes' indexes and who took part in what, from what is stored, and drop the vectors no stored text uses; loses nothing").action(async function() {
|
|
8469
8808
|
const { renderer } = outputFor(this);
|
|
8470
8809
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8471
|
-
if (!
|
|
8810
|
+
if (!existsSync10(path)) {
|
|
8472
8811
|
result(this, { path, exists: false });
|
|
8473
8812
|
return;
|
|
8474
8813
|
}
|
|
@@ -8510,9 +8849,9 @@ var backupCommand = /* @__PURE__ */ __name(() => destroysNothing(annotate(new Co
|
|
|
8510
8849
|
const { encrypt } = this.opts();
|
|
8511
8850
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8512
8851
|
const target = resolve(file2);
|
|
8513
|
-
if (!
|
|
8852
|
+
if (!existsSync10(path))
|
|
8514
8853
|
throw new CliError("not_found", `no store at ${path} to back up`);
|
|
8515
|
-
if (
|
|
8854
|
+
if (existsSync10(target))
|
|
8516
8855
|
throw new CliError("validation_error", `${target} exists \u2014 a backup never overwrites a file`);
|
|
8517
8856
|
const password = encrypt ? await passwordOf(this, { twice: true }) : void 0;
|
|
8518
8857
|
const copyAt = password === void 0 ? target : `${path}.backup-${process.pid}`;
|
|
@@ -8545,11 +8884,11 @@ var decryptCommand = /* @__PURE__ */ __name(() => annotate(new Command("decrypt"
|
|
|
8545
8884
|
const { output } = this.opts();
|
|
8546
8885
|
const from = resolve(file2);
|
|
8547
8886
|
const to = resolve(output);
|
|
8548
|
-
if (!
|
|
8887
|
+
if (!existsSync10(from))
|
|
8549
8888
|
throw new CliError("not_found", `no file at ${from}`);
|
|
8550
8889
|
if (!isSealed(from))
|
|
8551
8890
|
throw new CliError("validation_error", `${from} was not written with --encrypt`);
|
|
8552
|
-
if (
|
|
8891
|
+
if (existsSync10(to))
|
|
8553
8892
|
throw new CliError("validation_error", `${to} exists \u2014 never overwritten`);
|
|
8554
8893
|
await unsealFile(from, to, await passwordOf(this, { twice: false }));
|
|
8555
8894
|
result(this, { path: to, from, bytes: bytesOf2(to) });
|
|
@@ -8557,13 +8896,13 @@ var decryptCommand = /* @__PURE__ */ __name(() => annotate(new Command("decrypt"
|
|
|
8557
8896
|
var restoreCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("restore"), { output: { entity: "store_restore" }, effects: LOCAL_WRITE }).summary("restore a backup and keep the current store, or roll back a breaking upgrade").description("put a backup in place of the store; the store it replaces is kept beside it, never deleted. Given a rollback copy (backups/<store>-rollback-schema-<version>-<time>.db, kept for a day before an upgrade older tools cannot open), put its tables back in the store and return it to that version instead").argument("<file>", "a file `store backup` wrote, or a rollback copy; one written with --encrypt asks for its password").action(async function(file2) {
|
|
8558
8897
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8559
8898
|
const given = resolve(file2);
|
|
8560
|
-
if (!
|
|
8899
|
+
if (!existsSync10(given))
|
|
8561
8900
|
throw new CliError("not_found", `no file at ${given}`);
|
|
8562
8901
|
refuseWhileServing(this, messenger);
|
|
8563
8902
|
if (!isSealed(given))
|
|
8564
8903
|
return restoreFrom(this, messenger, given, given);
|
|
8565
8904
|
const opened = `${path}.unsealing-${process.pid}`;
|
|
8566
|
-
mkdirSync(
|
|
8905
|
+
mkdirSync(dirname3(path), { recursive: true, mode: 448 });
|
|
8567
8906
|
try {
|
|
8568
8907
|
await unsealFile(given, opened, await passwordOf(this, { twice: false }));
|
|
8569
8908
|
await restoreFrom(this, messenger, opened, given);
|
|
@@ -8574,26 +8913,26 @@ var restoreCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command(
|
|
|
8574
8913
|
var restoreFrom = /* @__PURE__ */ __name(async (command, messenger, backup, given) => {
|
|
8575
8914
|
const { renderer } = outputFor(command);
|
|
8576
8915
|
const path = storePath(environmentOf(command).env ?? process.env);
|
|
8577
|
-
if (
|
|
8916
|
+
if (existsSync10(path) && realpathSync3(backup) === realpathSync3(path)) {
|
|
8578
8917
|
throw new CliError("validation_error", `${backup} is the store itself`);
|
|
8579
8918
|
}
|
|
8580
8919
|
if (await isRollbackCopy(backup))
|
|
8581
8920
|
return rollBackFrom(command, messenger, backup);
|
|
8582
8921
|
const schema = await backupSchema(backup);
|
|
8583
8922
|
const stamp = stampNow();
|
|
8584
|
-
const kept =
|
|
8923
|
+
const kept = existsSync10(path) ? `${path}.before-restore-${stamp}` : null;
|
|
8585
8924
|
if (kept) {
|
|
8586
8925
|
const waitMs = environmentOf(command).storeLockWaitMs;
|
|
8587
8926
|
await quiesce(path, messenger, "restore", (message) => renderer.warn(message), waitMs);
|
|
8588
8927
|
} else
|
|
8589
|
-
mkdirSync(
|
|
8928
|
+
mkdirSync(dirname3(path), { recursive: true, mode: 448 });
|
|
8590
8929
|
const incoming = `${path}.restoring-${stamp}`;
|
|
8591
8930
|
copyFileSync(backup, incoming, constants.COPYFILE_EXCL);
|
|
8592
8931
|
chmodSync(incoming, 384);
|
|
8593
8932
|
if (kept) {
|
|
8594
8933
|
renameSync3(path, kept);
|
|
8595
8934
|
for (const suffix of ["-wal", "-shm"])
|
|
8596
|
-
if (
|
|
8935
|
+
if (existsSync10(`${path}${suffix}`))
|
|
8597
8936
|
renameSync3(`${path}${suffix}`, `${kept}${suffix}`);
|
|
8598
8937
|
}
|
|
8599
8938
|
renameSync3(incoming, path);
|
|
@@ -8615,7 +8954,7 @@ var isRollbackCopy = /* @__PURE__ */ __name(async (file2) => {
|
|
|
8615
8954
|
var rollBackFrom = /* @__PURE__ */ __name(async (command, messenger, copy) => {
|
|
8616
8955
|
const { renderer } = outputFor(command);
|
|
8617
8956
|
const path = storePath(environmentOf(command).env ?? process.env);
|
|
8618
|
-
if (!
|
|
8957
|
+
if (!existsSync10(path))
|
|
8619
8958
|
throw new CliError("not_found", `no store at ${path} to roll back`);
|
|
8620
8959
|
const waitMs = environmentOf(command).storeLockWaitMs;
|
|
8621
8960
|
await quiesce(path, messenger, "restore", (message) => renderer.warn(message), waitMs);
|
|
@@ -8665,7 +9004,7 @@ var backupSchema = /* @__PURE__ */ __name(async (backup) => {
|
|
|
8665
9004
|
var STORE_LOCK_WAIT_MS = 1e3;
|
|
8666
9005
|
var quiesce = /* @__PURE__ */ __name(async (path, messenger, then, warn, waitMs = STORE_LOCK_WAIT_MS) => {
|
|
8667
9006
|
const { command } = messenger.app;
|
|
8668
|
-
const files = [path, `${path}-wal`, `${path}-shm`].filter((file2) =>
|
|
9007
|
+
const files = [path, `${path}-wal`, `${path}-shm`].filter((file2) => existsSync10(file2)).map((file2) => realpathSync3(file2));
|
|
8669
9008
|
const holders = holdersOf(files);
|
|
8670
9009
|
if (holders === void 0) {
|
|
8671
9010
|
warn(`this system cannot say which processes have the store open \u2014 restart every running serve and mcp after this`);
|
|
@@ -8691,7 +9030,7 @@ var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("r
|
|
|
8691
9030
|
const { command } = messenger.app;
|
|
8692
9031
|
const env = environmentOf(this).env ?? process.env;
|
|
8693
9032
|
const path = storePath(env);
|
|
8694
|
-
if (!
|
|
9033
|
+
if (!existsSync10(path)) {
|
|
8695
9034
|
result(this, { path, exists: false, reset: false });
|
|
8696
9035
|
renderer.note(`no store at ${path} \u2014 nothing to reset; the first \`${command}\` command that reads a chat creates it`);
|
|
8697
9036
|
return;
|
|
@@ -8736,8 +9075,8 @@ var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("r
|
|
|
8736
9075
|
}), "resetCommand");
|
|
8737
9076
|
var STORE_PARTS2 = ["", "-wal", "-shm"];
|
|
8738
9077
|
var resetPreview = /* @__PURE__ */ __name(async (path, messenger, env, keep) => {
|
|
8739
|
-
const files = STORE_PARTS2.map((suffix) => `${path}${suffix}`).filter((file2) =>
|
|
8740
|
-
const holders = holdersOf(files.map((file2) =>
|
|
9078
|
+
const files = STORE_PARTS2.map((suffix) => `${path}${suffix}`).filter((file2) => existsSync10(file2));
|
|
9079
|
+
const holders = holdersOf(files.map((file2) => realpathSync3(file2)));
|
|
8741
9080
|
const serving = servingProfiles(messenger.app, env).length > 0;
|
|
8742
9081
|
const read = await readingOnly(path, (database) => ({
|
|
8743
9082
|
schema: schemaOf(database).version,
|