@wirecat/cli-template 0.13.1 → 0.14.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/.github/workflows/changelog-guard.yml +1 -1
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/monthly.yml +1 -1
- package/.github/workflows/release.yml +44 -10
- package/CHANGELOG.md +36 -0
- package/config/parity-groups.json +32 -1
- package/contracts/mcp-tools.json +100 -0
- package/dist/bin/clidev.js +6 -2
- package/dist/bundle/{all-profiles-MJ6XSFOO.js → all-profiles-NVB2HT2S.js} +6 -6
- package/dist/bundle/{anthropic-W5UKBZUB.js → anthropic-ICTW7CNQ.js} +4 -4
- package/dist/bundle/{app-server-EZ46JAHB.js → app-server-B6BCKXR7.js} +40 -38
- package/dist/bundle/{bun-HB6O2TTT.js → bun-ILPS6AYA.js} +2 -2
- package/dist/bundle/{bun-sqlite-KBXOW2ES.js → bun-sqlite-JE6FJFQT.js} +3 -3
- package/dist/bundle/{chunk-KJTNT4SW.js → chunk-2DAXUNTS.js} +2 -2
- package/dist/bundle/chunk-3MDNAYQA.js +34 -0
- package/dist/bundle/chunk-3WDYHOAF.js +91 -0
- package/dist/bundle/{chunk-EGRB55FF.js → chunk-45244QQ6.js} +14 -12
- package/dist/bundle/{chunk-JHO2LL2J.js → chunk-4PA6DJ7F.js} +7 -7
- package/dist/bundle/{chunk-FZZIU4B7.js → chunk-5SAF3XOL.js} +8196 -5601
- package/dist/bundle/chunk-62JRF2JA.js +35 -0
- package/dist/bundle/{chunk-TGB5F7NC.js → chunk-66VMJGV6.js} +4 -4
- package/dist/bundle/{chunk-V3ZTQ24B.js → chunk-6AW4DDK4.js} +4 -4
- package/dist/bundle/{chunk-PJOVK7PG.js → chunk-7F5VMLVK.js} +49 -24
- package/dist/bundle/{chunk-MFS52LTZ.js → chunk-7Z4HR6GO.js} +1 -1
- package/dist/bundle/{chunk-E42W72PQ.js → chunk-AS2PJNQ2.js} +7 -5
- package/dist/bundle/{chunk-SVDF6NJF.js → chunk-ASHVHS52.js} +14 -14
- package/dist/bundle/{chunk-N2Z3MCOF.js → chunk-BEBD27QT.js} +37 -35
- package/dist/bundle/{chunk-IGHEW777.js → chunk-BM5ZCDPQ.js} +5 -40
- package/dist/bundle/{chunk-AK257OMS.js → chunk-BVLPNNEL.js} +209 -78
- package/dist/bundle/{chunk-ERKR3VJ5.js → chunk-BWBZCYUN.js} +141 -46
- package/dist/bundle/{chunk-Z7MSIRSQ.js → chunk-CGFQT3LQ.js} +1 -1
- package/dist/bundle/{chunk-QKWRL4OD.js → chunk-DQIBGCF3.js} +6 -6
- package/dist/bundle/{chunk-RUKDZEID.js → chunk-DZLHY4IA.js} +3 -3
- package/dist/bundle/{chunk-TAYOKLGF.js → chunk-EMHCXXNJ.js} +7 -6
- package/dist/bundle/{chunk-IBBN7Z3A.js → chunk-F34HGYWF.js} +12 -3
- package/dist/bundle/{chunk-ERGB4NJA.js → chunk-G45R7M42.js} +1 -1
- package/dist/bundle/{chunk-ZLY6GUAS.js → chunk-G7W53MQP.js} +3 -3
- package/dist/bundle/{chunk-JAOGZMKQ.js → chunk-GUFPQZUA.js} +2 -2
- package/dist/bundle/{chunk-4LURWBVV.js → chunk-HYTHTSJP.js} +188 -22
- package/dist/bundle/{chunk-EFHLQXG6.js → chunk-IOJ2DTCY.js} +162 -55
- package/dist/bundle/{chunk-L5WWMP5M.js → chunk-IZKXJJ7V.js} +121 -31
- package/dist/bundle/{chunk-NOVLCHDV.js → chunk-LATYBJ4T.js} +2 -2
- package/dist/bundle/{chunk-QBP7OMN5.js → chunk-LFLSV353.js} +2 -2
- package/dist/bundle/{chunk-HDY5X3WQ.js → chunk-LU4A2T7Y.js} +4 -4
- package/dist/bundle/{chunk-JRK73FOW.js → chunk-NENYWEXF.js} +1 -1
- package/dist/bundle/{chunk-2B5U4Z5H.js → chunk-NH6LZ3H3.js} +8 -13
- package/dist/bundle/{chunk-OV6PHTAY.js → chunk-NVNUUHT5.js} +17130 -2232
- package/dist/bundle/chunk-PIJUGF5F.js +392 -0
- package/dist/bundle/{chunk-7IXL4UFK.js → chunk-PX2KP4QE.js} +8 -8
- package/dist/bundle/{chunk-N5GXKDBC.js → chunk-QXOSPYM3.js} +1 -1
- package/dist/bundle/{chunk-PBN4RBHS.js → chunk-R2JKPHH5.js} +8 -8
- package/dist/bundle/{chunk-PDGXMKJS.js → chunk-R5RYPD23.js} +2 -2
- package/dist/bundle/{chunk-QJ6XW4DM.js → chunk-RJ7AS7UB.js} +6210 -1207
- package/dist/bundle/{chunk-35KYY65W.js → chunk-SOYOOU2D.js} +3 -3
- package/dist/bundle/{chunk-FDBINRWA.js → chunk-TJJ2XSJP.js} +5 -5
- package/dist/bundle/{chunk-O3UXNU3S.js → chunk-U6QD3J3F.js} +3 -3
- package/dist/bundle/{chunk-YJNUDHJD.js → chunk-UT5TQ6MD.js} +139 -35
- package/dist/bundle/{chunk-VYSUKHKL.js → chunk-VOTEB3AN.js} +1 -1
- package/dist/bundle/{chunk-IN3FVRPK.js → chunk-VS5LGSTM.js} +1 -1
- package/dist/bundle/{chunk-MJRSEUKG.js → chunk-VXOR76ZL.js} +13 -89
- package/dist/bundle/{chunk-CXQXVKUY.js → chunk-YIVY2WI3.js} +1 -1
- package/dist/bundle/{chunk-VLNKTMV7.js → chunk-YOJLIVGO.js} +959 -350
- package/dist/bundle/clidev.js +3 -3
- package/dist/bundle/command-contract-JMVMT5HT.js +28 -0
- package/dist/bundle/{decode-AMXUVKNY.js → decode-NXB5UKMO.js} +18 -16
- package/dist/bundle/{echarts-GJDMQ2AQ.js → echarts-DRDGGHJT.js} +2 -2
- package/dist/bundle/{embed-L4CRZ2XQ.js → embed-IKZ24BMC.js} +4 -4
- package/dist/bundle/{embedder-IBGV4M2K.js → embedder-GMQ24DOQ.js} +7 -7
- package/dist/bundle/{first-run-VTKC2IBV.js → first-run-MDD4SIUK.js} +8 -8
- package/dist/bundle/first-screen-376CXGXJ.js +26 -0
- package/dist/bundle/{instructions-YJECS4KN.js → instructions-EOQOXY6V.js} +1 -1
- package/dist/bundle/{mcp-OQBZXELQ.js → mcp-7HBLFGCW.js} +2 -2
- package/dist/bundle/mcp-KHUZOJO6.js +82 -0
- package/dist/bundle/{mcp-7XPOACO4.js → mcp-MZHWJXAE.js} +38 -37
- package/dist/bundle/{node-NQG4EVZR.js → node-52WF2326.js} +2 -2
- package/dist/bundle/{node-sqlite-BR7F3BLB.js → node-sqlite-73Z4SFOA.js} +9 -3
- package/dist/bundle/{oauth-J7UAWNIK.js → oauth-EVTPAMZP.js} +5 -5
- package/dist/bundle/{open-BR47R5UE.js → open-46WZAPJ3.js} +3 -2
- package/dist/bundle/openai-GWRDAHDU.js +248 -0
- package/dist/bundle/{process-66I7RDPJ.js → process-YIQPKLZI.js} +1 -1
- package/dist/bundle/{program-ZNXLJ3D2.js → program-B3CY3FP7.js} +11346 -9559
- package/dist/bundle/{prompt-NE5JJ7UP.js → prompt-IVEYRLS5.js} +3 -3
- package/dist/bundle/{recognize-GC3YFVIA.js → recognize-WVEKHODM.js} +4 -2
- package/dist/bundle/{remote-QELOMKQM.js → remote-4K5VPMC7.js} +5 -5
- package/dist/bundle/{rerank-BH6TZ2SP.js → rerank-V24UJZYJ.js} +5 -5
- package/dist/bundle/{serve-WWLRNDT2.js → serve-PJWSOV7F.js} +7 -7
- package/dist/bundle/server-2ZN7KZHZ.js +40 -0
- package/dist/bundle/server-5VYM7CCF.js +53 -0
- package/dist/bundle/{state-2BEGXAMO.js → state-ZPYGECVP.js} +4 -4
- package/dist/bundle/{store-AH6WZMCF.js → store-6JQCLPQF.js} +14 -9
- package/dist/bundle/store-maintenance-command-7XICIYHW.js +42 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/commands.md +37 -11
- package/docs/dev/reference-clis.md +1 -1
- package/docs/dev/skills/design-interview/SKILL.md +2 -2
- package/docs/dev/test-matrix.md +5 -1
- package/kit/dist/interview.js +1 -0
- package/kit/dist/new.js +8 -3
- package/package.json +3 -3
- package/src/program.test.ts +56 -0
- package/src/version.ts +1 -1
- package/dist/bundle/chunk-IDWW4TU2.js +0 -18
- package/dist/bundle/chunk-MUSYGFCY.js +0 -3556
- package/dist/bundle/chunk-O5EHUB2V.js +0 -2
- package/dist/bundle/command-contract-75VJ36U4.js +0 -29
- package/dist/bundle/first-screen-X5IJKBSU.js +0 -27
- package/dist/bundle/mcp-RDZGYPSY.js +0 -78
- package/dist/bundle/server-DE6NLNUF.js +0 -52
- package/dist/bundle/server-ZPSQKOAH.js +0 -39
- package/dist/bundle/store-maintenance-command-PBXX3IEV.js +0 -40
- /package/dist/bundle/{chunk-GOO67PDU.js → chunk-NL2DQPT7.js} +0 -0
|
@@ -3,15 +3,18 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
answerOf,
|
|
5
5
|
messengerContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IZKXJJ7V.js";
|
|
7
7
|
import {
|
|
8
|
+
FETCHING,
|
|
8
9
|
RULES_VERSION,
|
|
9
10
|
applyTaskRulesOnArrival,
|
|
11
|
+
capability,
|
|
10
12
|
chatEventAnswer,
|
|
11
13
|
memberAnswer,
|
|
12
14
|
newSendId,
|
|
13
15
|
onlineDeps,
|
|
14
16
|
openRequestTask,
|
|
17
|
+
patiently,
|
|
15
18
|
pollVoteAnswer,
|
|
16
19
|
queryTerms,
|
|
17
20
|
senderIsMe,
|
|
@@ -19,11 +22,12 @@ import {
|
|
|
19
22
|
servicesFor,
|
|
20
23
|
syncsOneChat,
|
|
21
24
|
typedQuery,
|
|
22
|
-
withQuery
|
|
23
|
-
|
|
25
|
+
withQuery,
|
|
26
|
+
withTimeLimit
|
|
27
|
+
} from "./chunk-5SAF3XOL.js";
|
|
24
28
|
import {
|
|
25
29
|
readSecret
|
|
26
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-G7W53MQP.js";
|
|
27
31
|
import {
|
|
28
32
|
stringWidth,
|
|
29
33
|
wrapAnsi
|
|
@@ -34,45 +38,16 @@ import {
|
|
|
34
38
|
releaseLock,
|
|
35
39
|
servingProfiles,
|
|
36
40
|
takeLock
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import {
|
|
39
|
-
MIGRATIONS,
|
|
40
|
-
drainNoteIndex,
|
|
41
|
-
dropAllUnusedVectors,
|
|
42
|
-
fileFacts,
|
|
43
|
-
fillSearchIndex,
|
|
44
|
-
fillStems,
|
|
45
|
-
formatLocator,
|
|
46
|
-
involvementStoreOver,
|
|
47
|
-
migrate,
|
|
48
|
-
noteIndexState,
|
|
49
|
-
openSqlite,
|
|
50
|
-
openStore,
|
|
51
|
-
orphanPointers,
|
|
52
|
-
parseLocator,
|
|
53
|
-
pendingNormalization,
|
|
54
|
-
readStoreTables,
|
|
55
|
-
resetAttachmentWords,
|
|
56
|
-
resetNoteIndex,
|
|
57
|
-
resetSearchIndex,
|
|
58
|
-
resetStems,
|
|
59
|
-
rowCounts,
|
|
60
|
-
searchIndexState,
|
|
61
|
-
stemmerCache,
|
|
62
|
-
stemsState,
|
|
63
|
-
storeClients,
|
|
64
|
-
storeContents,
|
|
65
|
-
vectorIndexCounts
|
|
66
|
-
} from "./chunk-OV6PHTAY.js";
|
|
41
|
+
} from "./chunk-DZLHY4IA.js";
|
|
67
42
|
import {
|
|
68
43
|
checkedOptions,
|
|
69
44
|
range
|
|
70
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-R5RYPD23.js";
|
|
71
46
|
import {
|
|
72
47
|
messagesFor,
|
|
73
48
|
systemFor,
|
|
74
49
|
validateImages
|
|
75
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-LATYBJ4T.js";
|
|
76
51
|
import {
|
|
77
52
|
Command,
|
|
78
53
|
LOCAL_READ,
|
|
@@ -94,28 +69,58 @@ import {
|
|
|
94
69
|
modelTarget,
|
|
95
70
|
nextStep,
|
|
96
71
|
outputFor,
|
|
72
|
+
parseDuration,
|
|
97
73
|
recalledAccount,
|
|
98
74
|
recordLogFor,
|
|
99
75
|
renderAnswer,
|
|
100
76
|
snakeKeys,
|
|
101
77
|
storeTable,
|
|
102
78
|
withoutProviderRefs
|
|
103
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-RJ7AS7UB.js";
|
|
104
80
|
import {
|
|
105
81
|
failureKey
|
|
106
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-VXOR76ZL.js";
|
|
107
83
|
import {
|
|
108
84
|
holdersOf
|
|
109
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-VOTEB3AN.js";
|
|
110
86
|
import {
|
|
111
|
-
|
|
112
|
-
|
|
87
|
+
MIGRATIONS,
|
|
88
|
+
drainNoteIndex,
|
|
89
|
+
dropAllUnusedVectors,
|
|
90
|
+
fileFacts,
|
|
91
|
+
fillSearchIndex,
|
|
92
|
+
fillStems,
|
|
93
|
+
formatLocator,
|
|
94
|
+
involvementStoreOver,
|
|
95
|
+
migrate,
|
|
96
|
+
noteIndexState,
|
|
97
|
+
openSqlite,
|
|
98
|
+
openStore,
|
|
99
|
+
orphanPointers,
|
|
100
|
+
parseLocator,
|
|
101
|
+
pendingNormalization,
|
|
102
|
+
readStoreTables,
|
|
103
|
+
resetAttachmentWords,
|
|
104
|
+
resetNoteIndex,
|
|
105
|
+
resetSearchIndex,
|
|
106
|
+
resetStems,
|
|
107
|
+
rowCounts,
|
|
108
|
+
searchIndexState,
|
|
109
|
+
stemmerCache,
|
|
110
|
+
stemsState,
|
|
111
|
+
storeClients,
|
|
112
|
+
storeContents,
|
|
113
|
+
vectorIndexCounts
|
|
114
|
+
} from "./chunk-NVNUUHT5.js";
|
|
113
115
|
import {
|
|
114
|
-
|
|
115
|
-
} from "./chunk-
|
|
116
|
+
queryFieldsOf
|
|
117
|
+
} from "./chunk-YOJLIVGO.js";
|
|
116
118
|
import {
|
|
117
119
|
openCache
|
|
118
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-NH6LZ3H3.js";
|
|
121
|
+
import {
|
|
122
|
+
storePath
|
|
123
|
+
} from "./chunk-62JRF2JA.js";
|
|
119
124
|
import {
|
|
120
125
|
CliError,
|
|
121
126
|
Credentials,
|
|
@@ -146,7 +151,7 @@ import {
|
|
|
146
151
|
union,
|
|
147
152
|
visibleControls,
|
|
148
153
|
writeSecurely
|
|
149
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-IOJ2DTCY.js";
|
|
150
155
|
import {
|
|
151
156
|
__commonJS,
|
|
152
157
|
__name,
|
|
@@ -5486,11 +5491,11 @@ var require_liquid_node = __commonJS({
|
|
|
5486
5491
|
}
|
|
5487
5492
|
});
|
|
5488
5493
|
|
|
5489
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5494
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
5490
5495
|
import { chmodSync, constants, copyFileSync, existsSync as existsSync7, mkdirSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync3, writeFileSync } from "node:fs";
|
|
5491
5496
|
import { dirname, resolve } from "node:path";
|
|
5492
5497
|
|
|
5493
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5498
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sealed.js
|
|
5494
5499
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
|
5495
5500
|
import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
|
|
5496
5501
|
import { Transform } from "node:stream";
|
|
@@ -5597,7 +5602,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
|
|
|
5597
5602
|
renameSync(pending, to);
|
|
5598
5603
|
}, "unsealFile");
|
|
5599
5604
|
|
|
5600
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5605
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/store/compatibility.js
|
|
5601
5606
|
var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
|
|
5602
5607
|
var fileSchemaOf = /* @__PURE__ */ __name((database) => {
|
|
5603
5608
|
const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
|
|
@@ -5621,7 +5626,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
|
|
|
5621
5626
|
};
|
|
5622
5627
|
}, "compatibilityOf");
|
|
5623
5628
|
|
|
5624
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5629
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/store/repair.js
|
|
5625
5630
|
import { createHash as createHash2 } from "node:crypto";
|
|
5626
5631
|
var COPY_MARK = "__repair_";
|
|
5627
5632
|
var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
|
|
@@ -5875,7 +5880,7 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
|
|
|
5875
5880
|
return found;
|
|
5876
5881
|
}, "deleteCopy");
|
|
5877
5882
|
|
|
5878
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5883
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
5879
5884
|
import { existsSync as existsSync2, statSync as statSync2 } from "node:fs";
|
|
5880
5885
|
var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
|
|
5881
5886
|
var bytesOf = /* @__PURE__ */ __name((path) => existsSync2(path) ? statSync2(path).size : 0, "bytesOf");
|
|
@@ -5922,7 +5927,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
|
|
|
5922
5927
|
renderAnswer(this, outputFor(this), itemOf(answer));
|
|
5923
5928
|
}), "storeInfoCommand");
|
|
5924
5929
|
|
|
5925
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5930
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
|
|
5926
5931
|
var ENCRYPT_OPTION = [
|
|
5927
5932
|
"--encrypt",
|
|
5928
5933
|
"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"
|
|
@@ -5941,7 +5946,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
|
|
|
5941
5946
|
return password;
|
|
5942
5947
|
}, "passwordOf");
|
|
5943
5948
|
|
|
5944
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5949
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/replies/rules.js
|
|
5945
5950
|
import { existsSync as existsSync3, readFileSync } from "node:fs";
|
|
5946
5951
|
import { join } from "node:path";
|
|
5947
5952
|
var REPLY_ACTIONS = ["reply", "task"];
|
|
@@ -6112,7 +6117,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
|
|
|
6112
6117
|
}, "problem");
|
|
6113
6118
|
var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
|
|
6114
6119
|
|
|
6115
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6120
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/replies/state.js
|
|
6116
6121
|
import { existsSync as existsSync4, readFileSync as readFileSync2 } from "node:fs";
|
|
6117
6122
|
import { join as join2 } from "node:path";
|
|
6118
6123
|
var ANSWERED_KEPT = 1e3;
|
|
@@ -6165,7 +6170,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
|
|
|
6165
6170
|
}, "recordReply");
|
|
6166
6171
|
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");
|
|
6167
6172
|
|
|
6168
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6173
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/replies/decide.js
|
|
6169
6174
|
var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
|
|
6170
6175
|
var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
|
|
6171
6176
|
const { message, chat, owner, sender } = incoming;
|
|
@@ -6271,7 +6276,7 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
|
|
|
6271
6276
|
return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
|
|
6272
6277
|
}, "filled");
|
|
6273
6278
|
|
|
6274
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6279
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
6275
6280
|
var import_liquidjs = __toESM(require_liquid_node(), 1);
|
|
6276
6281
|
var TEMPLATE_LIMITS = {
|
|
6277
6282
|
parse: 32768,
|
|
@@ -6431,7 +6436,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
6431
6436
|
}
|
|
6432
6437
|
}, "renderReplyTemplate");
|
|
6433
6438
|
|
|
6434
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6439
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
|
|
6435
6440
|
var DRY_RUN_DAYS = 7;
|
|
6436
6441
|
var PAGE = 500;
|
|
6437
6442
|
var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
|
|
@@ -6545,7 +6550,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
|
|
|
6545
6550
|
}
|
|
6546
6551
|
}, "storedSince");
|
|
6547
6552
|
|
|
6548
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6553
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
|
|
6549
6554
|
var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
|
|
6550
6555
|
const host = new URL(baseUrl).host;
|
|
6551
6556
|
return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
|
|
@@ -6571,12 +6576,12 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
|
|
|
6571
6576
|
const shared = ["openai", "anthropic"].includes(provider) ? env[`${provider.toUpperCase()}_API_KEY`]?.trim() : void 0;
|
|
6572
6577
|
return shared ? { key: shared, source: "env" } : void 0;
|
|
6573
6578
|
}, "read"),
|
|
6574
|
-
write: /* @__PURE__ */ __name((provider, key) => credentials(provider).write(account(provider), key), "write"),
|
|
6579
|
+
write: /* @__PURE__ */ __name((provider, key) => credentials(provider).write(account(provider), key, { signIn: true }), "write"),
|
|
6575
6580
|
remove: /* @__PURE__ */ __name((provider) => credentials(provider).remove(account(provider)), "remove")
|
|
6576
6581
|
};
|
|
6577
6582
|
}, "embeddingKeys");
|
|
6578
6583
|
|
|
6579
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6584
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/models/openai.js
|
|
6580
6585
|
var options = strictObject({
|
|
6581
6586
|
temperature: range(0, 2),
|
|
6582
6587
|
top_p: range(0, 1),
|
|
@@ -6590,7 +6595,7 @@ var openai = {
|
|
|
6590
6595
|
images: true,
|
|
6591
6596
|
baseUrl: "https://api.openai.com/v1",
|
|
6592
6597
|
validate: /* @__PURE__ */ __name((given) => checkedOptions("openai", options, given), "validate"),
|
|
6593
|
-
complete: /* @__PURE__ */ __name(
|
|
6598
|
+
complete: /* @__PURE__ */ __name((target, request, checked, apiKey, fetcher) => withTimeLimit(12e4, async (deadline) => {
|
|
6594
6599
|
const response = await fetcher(`${target.baseUrl.replace(/\/+$/, "")}/chat/completions`, {
|
|
6595
6600
|
method: "POST",
|
|
6596
6601
|
headers: { "Content-Type": "application/json", ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {} },
|
|
@@ -6612,7 +6617,7 @@ var openai = {
|
|
|
6612
6617
|
],
|
|
6613
6618
|
...new URL(target.baseUrl).hostname === "api.openai.com" ? { max_completion_tokens: request.maxTokens } : { max_tokens: request.maxTokens }
|
|
6614
6619
|
}),
|
|
6615
|
-
signal:
|
|
6620
|
+
signal: deadline,
|
|
6616
6621
|
redirect: "error"
|
|
6617
6622
|
});
|
|
6618
6623
|
if (!response.ok)
|
|
@@ -6622,10 +6627,10 @@ var openai = {
|
|
|
6622
6627
|
if (choice?.finish_reason !== "stop" || typeof choice.message?.content !== "string" || !Number.isInteger(body.usage?.total_tokens) || (body.usage?.total_tokens ?? 0) < 1)
|
|
6623
6628
|
throw new Error("incomplete response");
|
|
6624
6629
|
return { text: choice.message.content, tokens: body.usage?.total_tokens };
|
|
6625
|
-
}, "complete")
|
|
6630
|
+
}), "complete")
|
|
6626
6631
|
};
|
|
6627
6632
|
|
|
6628
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6633
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/models/index.js
|
|
6629
6634
|
var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
6630
6635
|
complete: /* @__PURE__ */ __name(async (request) => {
|
|
6631
6636
|
if (deps.signal?.aborted)
|
|
@@ -6640,7 +6645,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
|
6640
6645
|
if (!adapter && target.provider === "openai")
|
|
6641
6646
|
adapter = openai;
|
|
6642
6647
|
if (!adapter && target.provider === "anthropic")
|
|
6643
|
-
adapter = (await import("./anthropic-
|
|
6648
|
+
adapter = (await import("./anthropic-ICTW7CNQ.js")).anthropic;
|
|
6644
6649
|
if (!adapter)
|
|
6645
6650
|
throw new CliError("validation_error", `no model adapter for ${target.provider}`);
|
|
6646
6651
|
if (request.images !== void 0 && adapter.images !== true)
|
|
@@ -6681,7 +6686,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
|
6681
6686
|
}, "complete")
|
|
6682
6687
|
}), "modelGateway");
|
|
6683
6688
|
|
|
6684
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6689
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
6685
6690
|
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "node:fs";
|
|
6686
6691
|
import { join as join3 } from "node:path";
|
|
6687
6692
|
var shape = strictObject({
|
|
@@ -6706,7 +6711,7 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
|
|
|
6706
6711
|
return consent.provider === provider && !consent.deniedChats.includes(chat);
|
|
6707
6712
|
}, "mayModelReply");
|
|
6708
6713
|
|
|
6709
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6714
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/replies/rendering.js
|
|
6710
6715
|
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options2 = {
|
|
6711
6716
|
ai: true
|
|
6712
6717
|
}) => async (rule2, message, chat, now) => {
|
|
@@ -6753,7 +6758,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
6753
6758
|
return result2;
|
|
6754
6759
|
}, "replyRenderer");
|
|
6755
6760
|
|
|
6756
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6761
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/replies/serve.js
|
|
6757
6762
|
var NOT_ALLOWED = "replies.send is not allow";
|
|
6758
6763
|
var NO_RULES = "no rules";
|
|
6759
6764
|
var ONLY_TASK = "opened a task, sent nothing";
|
|
@@ -6846,7 +6851,84 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
|
|
|
6846
6851
|
return { skip: why };
|
|
6847
6852
|
}, "replyTo");
|
|
6848
6853
|
|
|
6849
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6854
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
|
|
6855
|
+
var START_SYNC_DELAY_MS = 3e4;
|
|
6856
|
+
var START_SYNC_BUDGET_MS = 5 * 6e4;
|
|
6857
|
+
var START_SYNC_WINDOW_MS = 7 * 864e5;
|
|
6858
|
+
var START_SYNC_PER_CHAT = 500;
|
|
6859
|
+
var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note, warn, delayMs = START_SYNC_DELAY_MS, budgetMs = START_SYNC_BUDGET_MS, windowMs = START_SYNC_WINDOW_MS, now = Date.now }) => {
|
|
6860
|
+
const controller = new AbortController();
|
|
6861
|
+
let timer;
|
|
6862
|
+
let pass = Promise.resolve();
|
|
6863
|
+
let started = false;
|
|
6864
|
+
let done;
|
|
6865
|
+
const run = /* @__PURE__ */ __name(() => withTimeLimit(budgetMs, (deadline) => catchUp(AbortSignal.any([controller.signal, deadline]))), "run");
|
|
6866
|
+
const catchUp = /* @__PURE__ */ __name(async (stop) => {
|
|
6867
|
+
const floor = now() - windowMs;
|
|
6868
|
+
const moved = [];
|
|
6869
|
+
for (const chat of await chats(stop)) {
|
|
6870
|
+
const lastAt = Date.parse(chat.lastMessageAt ?? "");
|
|
6871
|
+
if (Number.isNaN(lastAt) || lastAt < floor)
|
|
6872
|
+
continue;
|
|
6873
|
+
moved.push({ chat, lastAt, held: await newestHeld(chat.id) });
|
|
6874
|
+
}
|
|
6875
|
+
const anywhere = moved.reduce((top, { held }) => held === void 0 ? top : Math.max(top, held), -Infinity);
|
|
6876
|
+
if (!Number.isFinite(anywhere))
|
|
6877
|
+
return;
|
|
6878
|
+
const behind = moved.filter(({ lastAt, held }) => lastAt > (held ?? anywhere)).sort((one, other) => other.lastAt - one.lastAt);
|
|
6879
|
+
if (behind.length === 0)
|
|
6880
|
+
return;
|
|
6881
|
+
const summary = { chats: 0, fetched: 0, failed: 0, stopped: false };
|
|
6882
|
+
done = summary;
|
|
6883
|
+
for (const { chat, held } of behind) {
|
|
6884
|
+
if (stop.aborted)
|
|
6885
|
+
break;
|
|
6886
|
+
try {
|
|
6887
|
+
summary.fetched += (await fetch2(chat.id, Math.max(held ?? anywhere, floor), stop)).fetched;
|
|
6888
|
+
summary.chats += 1;
|
|
6889
|
+
} catch (error) {
|
|
6890
|
+
if (stop.aborted)
|
|
6891
|
+
break;
|
|
6892
|
+
summary.failed += 1;
|
|
6893
|
+
const errorCode = failureKey(error);
|
|
6894
|
+
warn({
|
|
6895
|
+
code: "start_sync_chat_failed",
|
|
6896
|
+
chatId: chat.id,
|
|
6897
|
+
errorCode,
|
|
6898
|
+
text: `what ${chat.id} received while serve was down was not fetched: ${errorCode}`
|
|
6899
|
+
});
|
|
6900
|
+
}
|
|
6901
|
+
}
|
|
6902
|
+
summary.stopped = stop.aborted && summary.chats + summary.failed < behind.length;
|
|
6903
|
+
note({
|
|
6904
|
+
code: "start_sync",
|
|
6905
|
+
text: `caught up ${summary.fetched} message(s) in ${summary.chats} chat(s) that moved while serve was down` + (summary.stopped ? ` \u2014 stopped at the time limit, ${behind.length - summary.chats - summary.failed} left` : "")
|
|
6906
|
+
});
|
|
6907
|
+
}, "catchUp");
|
|
6908
|
+
return {
|
|
6909
|
+
start: /* @__PURE__ */ __name(() => {
|
|
6910
|
+
if (started || controller.signal.aborted)
|
|
6911
|
+
return;
|
|
6912
|
+
started = true;
|
|
6913
|
+
timer = setTimeout(() => {
|
|
6914
|
+
pass = run().catch((error) => {
|
|
6915
|
+
if (controller.signal.aborted)
|
|
6916
|
+
return;
|
|
6917
|
+
const errorCode = failureKey(error);
|
|
6918
|
+
warn({ code: "start_sync_failed", errorCode, text: `the catch-up on start failed: ${errorCode}` });
|
|
6919
|
+
});
|
|
6920
|
+
}, delayMs);
|
|
6921
|
+
}, "start"),
|
|
6922
|
+
stop: /* @__PURE__ */ __name(async () => {
|
|
6923
|
+
controller.abort();
|
|
6924
|
+
clearTimeout(timer);
|
|
6925
|
+
await pass;
|
|
6926
|
+
}, "stop"),
|
|
6927
|
+
summary: /* @__PURE__ */ __name(() => done, "summary")
|
|
6928
|
+
};
|
|
6929
|
+
}, "startSync");
|
|
6930
|
+
|
|
6931
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
|
|
6850
6932
|
var FIRST_FETCH_MS = 6e4;
|
|
6851
6933
|
var DAY_MS = 864e5;
|
|
6852
6934
|
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
|
|
@@ -6900,7 +6982,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
|
|
|
6900
6982
|
};
|
|
6901
6983
|
}, "memberFetches");
|
|
6902
6984
|
|
|
6903
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6985
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
|
|
6904
6986
|
var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
|
|
6905
6987
|
var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
|
|
6906
6988
|
if (context.format === "pretty") {
|
|
@@ -6933,7 +7015,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
|
|
|
6933
7015
|
return context;
|
|
6934
7016
|
}, "recordDiagnostics");
|
|
6935
7017
|
|
|
6936
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7018
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
|
|
6937
7019
|
var STEMS_EVERY_MS = 3e4;
|
|
6938
7020
|
var STEMS_SLICE_MS = 2e3;
|
|
6939
7021
|
var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
|
|
@@ -6973,7 +7055,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
|
|
|
6973
7055
|
};
|
|
6974
7056
|
}, "stemFills");
|
|
6975
7057
|
|
|
6976
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7058
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/render/messages.js
|
|
6977
7059
|
import { styleText } from "node:util";
|
|
6978
7060
|
var TIME_WIDTH = 8;
|
|
6979
7061
|
var INDENT = " ".repeat(TIME_WIDTH + 2);
|
|
@@ -7149,7 +7231,7 @@ var editedAt = /* @__PURE__ */ __name((message, options2) => {
|
|
|
7149
7231
|
return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
|
|
7150
7232
|
}, "editedAt");
|
|
7151
7233
|
|
|
7152
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7234
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
|
|
7153
7235
|
var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
|
|
7154
7236
|
var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
|
|
7155
7237
|
kind: attachment.kind,
|
|
@@ -7244,7 +7326,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
|
|
|
7244
7326
|
locale: messenger.app.locale
|
|
7245
7327
|
}), "viewOf");
|
|
7246
7328
|
|
|
7247
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7329
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
|
|
7248
7330
|
var observed = /* @__PURE__ */ __name((value) => ({
|
|
7249
7331
|
value: value.value,
|
|
7250
7332
|
observed_at: value.observedAt,
|
|
@@ -7311,7 +7393,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
|
|
|
7311
7393
|
}
|
|
7312
7394
|
}, "watchEventItem");
|
|
7313
7395
|
|
|
7314
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7396
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
|
|
7315
7397
|
var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
|
|
7316
7398
|
output: { entity: "watch_item" },
|
|
7317
7399
|
effects: REMOTE_READ,
|
|
@@ -7466,7 +7548,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
|
|
|
7466
7548
|
}
|
|
7467
7549
|
}, "describe");
|
|
7468
7550
|
|
|
7469
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7551
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
|
|
7470
7552
|
var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
7471
7553
|
const command = annotate(new Command("serve"), {
|
|
7472
7554
|
output: { entity: "serve_summary" },
|
|
@@ -7509,7 +7591,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7509
7591
|
const counts = {};
|
|
7510
7592
|
const rules = replying(context, messenger, Date.parse(startedAt));
|
|
7511
7593
|
const tasks = tasking(context, warn);
|
|
7512
|
-
const { handled } = environmentOf(this);
|
|
7594
|
+
const { handled, startSyncDelayMs } = environmentOf(this);
|
|
7513
7595
|
const count3 = /* @__PURE__ */ __name((event) => {
|
|
7514
7596
|
counts[event.event] = (counts[event.event] ?? 0) + 1;
|
|
7515
7597
|
if (event.event === "message") {
|
|
@@ -7533,6 +7615,50 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7533
7615
|
}).chats.fetchMembers(chatId, {}), "fetch"),
|
|
7534
7616
|
warn
|
|
7535
7617
|
});
|
|
7618
|
+
const fetching = messenger.fetching ?? FETCHING;
|
|
7619
|
+
const catchingUp = startSync({
|
|
7620
|
+
chats: /* @__PURE__ */ __name(async (stop) => {
|
|
7621
|
+
const list = capability(connection, "chats", "list its chats");
|
|
7622
|
+
const all = [];
|
|
7623
|
+
for (let offset = 0; ; ) {
|
|
7624
|
+
const page = await patiently(() => list({ offset, limit: 100 }), context.renderer.note, stop);
|
|
7625
|
+
for (const chat of page.items)
|
|
7626
|
+
all.push(chat);
|
|
7627
|
+
offset += page.items.length;
|
|
7628
|
+
if (!page.hasMore || page.items.length === 0)
|
|
7629
|
+
return all;
|
|
7630
|
+
}
|
|
7631
|
+
}, "chats"),
|
|
7632
|
+
newestHeld: /* @__PURE__ */ __name((chatId) => context.withStore(async (store, account) => {
|
|
7633
|
+
const [newest] = await store.messages.messagesWindow(account, chatId, {
|
|
7634
|
+
at: startedAt,
|
|
7635
|
+
before: 1,
|
|
7636
|
+
after: 0
|
|
7637
|
+
});
|
|
7638
|
+
return newest ? Date.parse(newest.timestamp) : void 0;
|
|
7639
|
+
}, { name: "serve catch-up" }), "newestHeld"),
|
|
7640
|
+
fetch: /* @__PURE__ */ __name((chatId, sinceMs, stop) => context.withStore((store, account) => servicesFor({
|
|
7641
|
+
...onlineDeps(messenger, connection, context.guard, {
|
|
7642
|
+
profile: context.profile,
|
|
7643
|
+
env: context.env
|
|
7644
|
+
}),
|
|
7645
|
+
store: /* @__PURE__ */ __name(async () => store, "store"),
|
|
7646
|
+
account: /* @__PURE__ */ __name(async () => account, "account")
|
|
7647
|
+
}).archive.fetch(chatId, {
|
|
7648
|
+
limit: START_SYNC_PER_CHAT,
|
|
7649
|
+
pageSize: fetching.page,
|
|
7650
|
+
pauseMs: parseDuration(fetching.pause, "pause"),
|
|
7651
|
+
sinceMs,
|
|
7652
|
+
catchUp: false,
|
|
7653
|
+
note: context.renderer.note,
|
|
7654
|
+
stop,
|
|
7655
|
+
onPage: /* @__PURE__ */ __name(() => {
|
|
7656
|
+
}, "onPage")
|
|
7657
|
+
}), { name: "serve catch-up" }), "fetch"),
|
|
7658
|
+
note,
|
|
7659
|
+
warn,
|
|
7660
|
+
...startSyncDelayMs === void 0 ? {} : { delayMs: startSyncDelayMs }
|
|
7661
|
+
});
|
|
7536
7662
|
const stems = stemFills({
|
|
7537
7663
|
withStore: /* @__PURE__ */ __name((work) => context.withStore((store) => work(store), { name: "serve stems" }), "withStore"),
|
|
7538
7664
|
warn
|
|
@@ -7547,12 +7673,15 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7547
7673
|
rules.connected(open);
|
|
7548
7674
|
members.start();
|
|
7549
7675
|
stems.start();
|
|
7676
|
+
if (messenger.history !== "store" && typeof open.chats === "function")
|
|
7677
|
+
catchingUp.start();
|
|
7550
7678
|
}, "connected")
|
|
7551
7679
|
});
|
|
7552
7680
|
} finally {
|
|
7553
7681
|
await relaying;
|
|
7554
7682
|
await relay?.close();
|
|
7555
7683
|
rules.stop();
|
|
7684
|
+
await catchingUp.stop();
|
|
7556
7685
|
await members.stop();
|
|
7557
7686
|
await stems.stop();
|
|
7558
7687
|
await rules.settled();
|
|
@@ -7567,6 +7696,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7567
7696
|
...rules.summary(),
|
|
7568
7697
|
...members.summary().fetched + members.summary().failed > 0 ? { members: members.summary() } : {},
|
|
7569
7698
|
...stems.summary().stemmed > 0 ? { stems: stems.summary() } : {},
|
|
7699
|
+
...catchingUp.summary() ? { caught_up: catchingUp.summary() } : {},
|
|
7570
7700
|
...tasks.summary()
|
|
7571
7701
|
}));
|
|
7572
7702
|
});
|
|
@@ -7682,7 +7812,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
|
|
|
7682
7812
|
};
|
|
7683
7813
|
}, "tasking");
|
|
7684
7814
|
|
|
7685
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7815
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
|
|
7686
7816
|
import { existsSync as existsSync6 } from "node:fs";
|
|
7687
7817
|
var PATH = "store tables list";
|
|
7688
7818
|
var STORE_TABLES_QUERY = {
|
|
@@ -7725,7 +7855,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7725
7855
|
return tables;
|
|
7726
7856
|
}, "storeTablesCommand");
|
|
7727
7857
|
|
|
7728
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7858
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
7729
7859
|
var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
|
|
7730
7860
|
var WORD_INDEX = "message_words";
|
|
7731
7861
|
var schemaOf = /* @__PURE__ */ __name((database) => {
|
|
@@ -8340,6 +8470,7 @@ export {
|
|
|
8340
8470
|
seal,
|
|
8341
8471
|
ENCRYPT_OPTION,
|
|
8342
8472
|
passwordOf,
|
|
8473
|
+
DAY_MS,
|
|
8343
8474
|
renderMessages,
|
|
8344
8475
|
messageItem,
|
|
8345
8476
|
messageItems,
|