@wirecat/notion-cli 0.5.0 → 0.6.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/CHANGELOG.md +35 -0
- package/README.md +5 -0
- package/contracts/wirecat.json +55 -2
- package/dist/bin/notion.js +2 -2
- package/dist/bundle/agent-ILG6AH7S.js +42 -0
- package/dist/bundle/{all-profiles-V37KCXH3.js → all-profiles-AELHUTFU.js} +64 -21
- package/dist/bundle/{anthropic-Q4S3BYXD.js → anthropic-3CCYAGO3.js} +6 -6
- package/dist/bundle/{app-server-43SR3ACI.js → app-server-DJ6P4NY4.js} +86 -65
- package/dist/bundle/{bun-M3J2QTR3.js → bun-2FLR4IV4.js} +2 -2
- package/dist/bundle/{bun-sqlite-EJ3W2PSV.js → bun-sqlite-QB6CU6TH.js} +7 -7
- package/dist/bundle/chunk-2CMLY2X3.js +72 -0
- package/dist/bundle/{chunk-NHHJHXMQ.js → chunk-2XUV7HNE.js} +2 -2
- package/dist/bundle/{chunk-HZRQLAHO.js → chunk-2Z7UOXFC.js} +1 -1
- package/dist/bundle/{chunk-TOSCB4SO.js → chunk-3LMW7U7F.js} +16 -10
- package/dist/bundle/chunk-3MYN2RMG.js +398 -0
- package/dist/bundle/{chunk-E5WLE7BM.js → chunk-3UX4VJWD.js} +1 -1
- package/dist/bundle/chunk-4HP6KGBI.js +32 -0
- package/dist/bundle/{chunk-KHWOLBHQ.js → chunk-4RFR4J2O.js} +2 -2
- package/dist/bundle/{chunk-G2MJYXZG.js → chunk-4VXXOJ2F.js} +4 -4
- package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
- package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
- package/dist/bundle/{chunk-ECC2UX7X.js → chunk-5OJLUUOJ.js} +6 -6
- package/dist/bundle/{chunk-C32AKHTY.js → chunk-5XPHFV7H.js} +35 -12
- package/dist/bundle/{chunk-O5YB7FQD.js → chunk-6EJCI47L.js} +4 -4
- package/dist/bundle/chunk-6VPC5Z56.js +2145 -0
- package/dist/bundle/{chunk-NA6QLHBZ.js → chunk-6YOMPW7Y.js} +10 -8
- package/dist/bundle/{chunk-P5BHKKBI.js → chunk-7JVKQ6NM.js} +4 -4
- package/dist/bundle/chunk-7L2XOKDZ.js +353 -0
- package/dist/bundle/{chunk-NE43YXKL.js → chunk-A42T4YX7.js} +3 -3
- package/dist/bundle/chunk-AE4VW4NB.js +50 -0
- package/dist/bundle/{chunk-FPUGMDJV.js → chunk-AV2ZJ4WX.js} +1 -1
- package/dist/bundle/{chunk-QWYMXFKM.js → chunk-AZLDR36U.js} +3 -3
- package/dist/bundle/{chunk-N2XADGL4.js → chunk-BAXNAOOL.js} +4 -4
- package/dist/bundle/{chunk-JCKWQGCD.js → chunk-BEV5LO4D.js} +110 -862
- package/dist/bundle/{chunk-UZSBGECU.js → chunk-BQBC2WIG.js} +1 -65
- package/dist/bundle/{chunk-CWXOXIWS.js → chunk-CFQQTDSA.js} +1 -1
- package/dist/bundle/chunk-CHPWBQUK.js +39 -0
- package/dist/bundle/chunk-CL3YNUCC.js +388 -0
- package/dist/bundle/{chunk-ONZVPE24.js → chunk-DGMTSDKB.js} +6 -6
- package/dist/bundle/{chunk-BWLBSQSU.js → chunk-DHVVXQEL.js} +4 -4
- package/dist/bundle/chunk-DIU2QJJF.js +785 -0
- package/dist/bundle/chunk-DQSOYH6N.js +20 -0
- package/dist/bundle/chunk-ECYOTDJM.js +14 -0
- package/dist/bundle/{chunk-DBEQI5YM.js → chunk-EHW45LLT.js} +3 -3
- package/dist/bundle/{chunk-WPP76PSX.js → chunk-ERN53B3Z.js} +32 -24
- package/dist/bundle/{chunk-XUPN2EHR.js → chunk-ESZHGC4Q.js} +23 -7
- package/dist/bundle/{chunk-3RL2MIUF.js → chunk-EZMG5QXB.js} +8 -8
- package/dist/bundle/chunk-F4BX7TH2.js +15 -0
- package/dist/bundle/{chunk-TP7GDWVF.js → chunk-F5ZAN7OC.js} +1 -1
- package/dist/bundle/{chunk-DFCHHR5M.js → chunk-FMMYBVCH.js} +1 -1
- package/dist/bundle/{chunk-E2AFUJDR.js → chunk-FRB2L7OE.js} +3 -3
- package/dist/bundle/chunk-FV4WTZCU.js +561 -0
- package/dist/bundle/{chunk-TD2JZ25O.js → chunk-G4ZU73SD.js} +98 -80
- package/dist/bundle/{chunk-FKA7DOCK.js → chunk-GCAJW4SR.js} +1 -1
- package/dist/bundle/{chunk-WE4UFASG.js → chunk-GPRJXJC7.js} +15 -1
- package/dist/bundle/chunk-GUIQJUJV.js +340 -0
- package/dist/bundle/{chunk-GTY6N5KZ.js → chunk-HHEWTLAT.js} +2 -2
- package/dist/bundle/{chunk-DB2XKHI4.js → chunk-HM6AMYHR.js} +2 -2
- package/dist/bundle/{chunk-H3E2PZ5Y.js → chunk-HOVHE3A3.js} +7 -7
- package/dist/bundle/{chunk-O3DYRCIT.js → chunk-HVXOA4FO.js} +1 -1
- package/dist/bundle/{chunk-PPHBRESD.js → chunk-IJVTN5L3.js} +2 -2
- package/dist/bundle/{chunk-FBZI4Z3Z.js → chunk-IURYZSG3.js} +13 -26
- package/dist/bundle/chunk-JFSVAOA7.js +108 -0
- package/dist/bundle/{chunk-HHVFIXDO.js → chunk-JVESLS7B.js} +399 -399
- package/dist/bundle/chunk-K5IC4FZN.js +36 -0
- package/dist/bundle/chunk-KB35BVTG.js +30 -0
- package/dist/bundle/chunk-KGAUINBO.js +594 -0
- package/dist/bundle/{chunk-W5JZMXGW.js → chunk-KNCPBX5P.js} +75 -75
- package/dist/bundle/{chunk-ECEZOLOD.js → chunk-KZJQPJK5.js} +4 -4
- package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
- package/dist/bundle/{chunk-QYXWRKNA.js → chunk-LC6WE6JS.js} +9 -9
- package/dist/bundle/{chunk-X2M6NIQG.js → chunk-LECMHK2F.js} +1 -1
- package/dist/bundle/chunk-LQVDFD65.js +72 -0
- package/dist/bundle/chunk-MEYYH47C.js +25 -0
- package/dist/bundle/chunk-NMQRSEZM.js +37 -0
- package/dist/bundle/{chunk-NTG657MI.js → chunk-NSR43UEW.js} +7 -64
- package/dist/bundle/{chunk-CDK5E45T.js → chunk-OEQNP56V.js} +2 -100
- package/dist/bundle/{chunk-MGUEZYFA.js → chunk-OLAGFJDM.js} +13 -2143
- package/dist/bundle/{chunk-PWRRDDMZ.js → chunk-P27NDZQR.js} +232 -552
- package/dist/bundle/{chunk-PAW6RRCW.js → chunk-PHKED7AG.js} +8 -210
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-RIGE67FR.js → chunk-Q7EIL6VU.js} +43 -33
- package/dist/bundle/{chunk-AT5I34AN.js → chunk-QEJFBORC.js} +3 -3
- package/dist/bundle/{chunk-RJMQGG3P.js → chunk-QGGRFRMP.js} +65 -49
- package/dist/bundle/{chunk-BNEE35WD.js → chunk-RD7BKTWV.js} +4 -4
- package/dist/bundle/chunk-RXU5T5NM.js +714 -0
- package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
- package/dist/bundle/{chunk-2FJNMADN.js → chunk-SAPP2LEH.js} +10 -10
- package/dist/bundle/{chunk-QIG55MZH.js → chunk-SEAGUFBX.js} +12 -12
- package/dist/bundle/{chunk-GCZ6MAEN.js → chunk-STTO2MSY.js} +43 -64
- package/dist/bundle/{chunk-DSP36YHQ.js → chunk-T37TAXVL.js} +2 -2
- package/dist/bundle/{chunk-KHZ2RGXI.js → chunk-T6XIBULH.js} +139 -572
- package/dist/bundle/chunk-TFT4FVRU.js +67 -0
- package/dist/bundle/chunk-TRYYWV7J.js +291 -0
- package/dist/bundle/{chunk-KFVDL2QS.js → chunk-UC7JLE6J.js} +1 -89
- package/dist/bundle/{chunk-LBYGJKXW.js → chunk-UOC52GCB.js} +4 -4
- package/dist/bundle/chunk-UPL474OW.js +94 -0
- package/dist/bundle/chunk-VH7526NL.js +80 -0
- package/dist/bundle/chunk-VNWF4I7E.js +34 -0
- package/dist/bundle/chunk-W2VQDIU5.js +221 -0
- package/dist/bundle/{chunk-TDNURSU6.js → chunk-WAGADES3.js} +19 -19
- package/dist/bundle/{chunk-J3NKZ6MO.js → chunk-WAU5LSHP.js} +79 -438
- package/dist/bundle/{chunk-B3FSLAIU.js → chunk-WB2KSQIP.js} +4 -4
- package/dist/bundle/{chunk-DO7BLXO3.js → chunk-WGZH2M64.js} +3 -3
- package/dist/bundle/chunk-WVN2KTNS.js +52 -0
- package/dist/bundle/{chunk-W7HM2VGO.js → chunk-XYQVVW4R.js} +1 -1
- package/dist/bundle/{chunk-BBSFQ3PU.js → chunk-YDDI4QIT.js} +1473 -1292
- package/dist/bundle/chunk-YHWFF6DN.js +39 -0
- package/dist/bundle/{chunk-W53EJOFQ.js → chunk-YUDVRFXN.js} +1 -1
- package/dist/bundle/{chunk-MNRMKWCN.js → chunk-YXYZAWWW.js} +6 -6
- package/dist/bundle/{chunk-5P5TXU2K.js → chunk-YYQ5GKAI.js} +9509 -10782
- package/dist/bundle/chunk-ZDYEOE7L.js +2366 -0
- package/dist/bundle/command-contract-L2FASWD6.js +41 -0
- package/dist/bundle/{command-server-entry-LJ627ZUA.js → command-server-entry-VUR6WL77.js} +30 -27
- package/dist/bundle/{decode-PX2LZ5Y2.js → decode-I64PF2RM.js} +6 -6
- package/dist/bundle/{definitions-M3U4UYHN.js → definitions-MB65223J.js} +72 -18
- package/dist/bundle/{dispatch-KOISQ5QJ.js → dispatch-JQBAZWCL.js} +8 -8
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-FVTUDXDU.js → echarts-YRRVLEX3.js} +2 -2
- package/dist/bundle/{embed-CCSDK43I.js → embed-BLXLKMK2.js} +7 -7
- package/dist/bundle/{embedder-VHI4DHB7.js → embedder-JYGF6R7I.js} +10 -10
- package/dist/bundle/{failure-FZ6VYKEQ.js → failure-I6AAF5R5.js} +3 -3
- package/dist/bundle/first-run-YLDOZGY6.js +29 -0
- package/dist/bundle/first-screen-GZH3LMLZ.js +41 -0
- package/dist/bundle/hast-util-from-html-X2DCPS3T.js +10531 -0
- package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
- package/dist/bundle/hast-util-to-mdast-3CSMIWK2.js +2272 -0
- package/dist/bundle/{instructions-HET7BCYK.js → instructions-AG7SRWTR.js} +1 -1
- package/dist/bundle/{mcp-RGNRW77S.js → mcp-YGOAUNC3.js} +2 -2
- package/dist/bundle/{mdast-util-from-markdown-R66F4HZA.js → mdast-util-from-markdown-XCR5KW5S.js} +138 -195
- package/dist/bundle/{mdast-util-gfm-LN2ELINH.js → mdast-util-gfm-JO7PHUIB.js} +28 -357
- package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
- package/dist/bundle/mdast-util-to-markdown-DOXGHRI7.js +1854 -0
- package/dist/bundle/meeting-combined-OFQSGKBG.js +25 -0
- package/dist/bundle/meeting-model-K6NSX3O5.js +27 -0
- package/dist/bundle/{meeting-semantic-UD26T37N.js → meeting-semantic-3DZPHM7L.js} +7 -7
- package/dist/bundle/{micromark-extension-gfm-5X7YT43T.js → micromark-extension-gfm-PQ7DWZM7.js} +12 -78
- package/dist/bundle/{node-CXZIFHZC.js → node-GJQYN4FT.js} +2 -2
- package/dist/bundle/{node-sqlite-ME7KMORI.js → node-sqlite-7VXIRQPH.js} +8 -8
- package/dist/bundle/notes-search-ACDOPTNH.js +64 -0
- package/dist/bundle/notion.js +14 -14
- package/dist/bundle/oauth-N67CH2TK.js +20 -0
- package/dist/bundle/{open-HA6D3SXR.js → open-JGXVHIKO.js} +6 -6
- package/dist/bundle/{openai-H5AJPZBX.js → openai-PFQJTF4H.js} +21 -18
- package/dist/bundle/{process-5RUXWGYS.js → process-MEKCZMX3.js} +1 -1
- package/dist/bundle/{program-F3NBTZ7J.js → program-DUJYLJH5.js} +6373 -6588
- package/dist/bundle/{prompt-6XSUOLHK.js → prompt-FW44QDHD.js} +6 -6
- package/dist/bundle/{recognize-2Y7AUVGG.js → recognize-62TDQ6A7.js} +5 -5
- package/dist/bundle/{remote-KCABPXQ3.js → remote-7ONFD7GG.js} +12 -11
- package/dist/bundle/{rerank-BTN7LUVA.js → rerank-YOHQQJS4.js} +8 -8
- package/dist/bundle/{schemas-VVLTLMXS.js → schemas-IIGJ7DOP.js} +39 -60
- package/dist/bundle/{serve-CYEMVRFC.js → serve-ZCXGT5RB.js} +11 -11
- package/dist/bundle/{server-WFIICGMI.js → server-RQ74M637.js} +78 -56
- package/dist/bundle/server-XMZF57WM.js +90 -0
- package/dist/bundle/{services-L4W6ZWDG.js → services-FWBRZ57M.js} +103 -88
- package/dist/bundle/{sqlite-runtime-IKMYLRQC.js → sqlite-runtime-ZZBNGV5L.js} +7 -7
- package/dist/bundle/{state-LMUP636P.js → state-GDDFO62Y.js} +7 -7
- package/dist/bundle/{store-W2JC2JP4.js → store-D2LRIWEI.js} +24 -20
- package/dist/bundle/{store-A2QZFBOX.js → store-KQCLR57N.js} +30 -18
- package/dist/bundle/store-maintenance-command-CK2MU5M6.js +77 -0
- package/dist/bundle/surface-K4TPIQW7.js +76 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +22 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/api.d.ts +7 -2
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +19 -119
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/library.d.ts.map +1 -1
- package/dist/commands/library.js +8 -2
- package/dist/commands/library.js.map +1 -1
- package/dist/config.d.ts +11 -13
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +63 -54
- package/dist/config.js.map +1 -1
- package/dist/generated/definitions.d.ts.map +1 -1
- package/dist/generated/definitions.js +72 -18
- package/dist/generated/definitions.js.map +1 -1
- package/dist/generated/manifest.d.ts.map +1 -1
- package/dist/generated/manifest.js +49 -0
- package/dist/generated/manifest.js.map +1 -1
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +32 -32
- package/dist/generated/schemas.js.map +1 -1
- package/dist/generated/types.d.ts +125 -25
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/library.d.ts +8 -0
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +24 -1
- package/dist/library.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -0
- package/dist/program.js.map +1 -1
- package/dist/sync/files.d.ts +12 -0
- package/dist/sync/files.d.ts.map +1 -1
- package/dist/sync/files.js.map +1 -1
- package/dist/sync/source.d.ts.map +1 -1
- package/dist/sync/source.js +53 -37
- package/dist/sync/source.js.map +1 -1
- package/dist/sync/users.d.ts +15 -2
- package/dist/sync/users.d.ts.map +1 -1
- package/dist/sync/users.js +36 -1
- package/dist/sync/users.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/bundle/chunk-6EOZTUHT.js +0 -726
- package/dist/bundle/command-contract-TVRFW2IX.js +0 -38
- package/dist/bundle/first-run-7JKE5AHN.js +0 -29
- package/dist/bundle/first-screen-ZROHOEYJ.js +0 -38
- package/dist/bundle/meeting-combined-SSTOJUIJ.js +0 -24
- package/dist/bundle/meeting-model-K7TPS4S5.js +0 -26
- package/dist/bundle/oauth-XBTROXHB.js +0 -20
- package/dist/bundle/server-UC2FNNXX.js +0 -72
- package/dist/bundle/store-maintenance-command-LRGQJPSZ.js +0 -63
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
PLAIN_HTTP_REFUSED,
|
|
5
|
+
modelAddressAllowed,
|
|
6
|
+
onThisComputer
|
|
7
|
+
} from "./chunk-FRB2L7OE.js";
|
|
8
|
+
import {
|
|
9
|
+
readSharedSection,
|
|
10
|
+
sharedConfigPath,
|
|
11
|
+
writeSharedSection
|
|
12
|
+
} from "./chunk-HOVHE3A3.js";
|
|
13
|
+
import {
|
|
14
|
+
storePath
|
|
15
|
+
} from "./chunk-HHEWTLAT.js";
|
|
16
|
+
import {
|
|
17
|
+
boolean,
|
|
18
|
+
isoTimestamp,
|
|
19
|
+
pipe,
|
|
20
|
+
safeParse,
|
|
21
|
+
strictObject,
|
|
22
|
+
string
|
|
23
|
+
} from "./chunk-S4UUN6LD.js";
|
|
24
|
+
import {
|
|
25
|
+
CliError
|
|
26
|
+
} from "./chunk-HM6AMYHR.js";
|
|
27
|
+
import {
|
|
28
|
+
__name
|
|
29
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
30
|
+
|
|
31
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/models/local-only.js
|
|
32
|
+
var SECTION = "local_only";
|
|
33
|
+
var Setting = strictObject({
|
|
34
|
+
on: boolean(),
|
|
35
|
+
at: pipe(string(), isoTimestamp())
|
|
36
|
+
});
|
|
37
|
+
var pathOf = /* @__PURE__ */ __name((env) => sharedConfigPath(storePath(env), env), "pathOf");
|
|
38
|
+
var readLocalOnly = /* @__PURE__ */ __name((env) => {
|
|
39
|
+
const section = readSharedSection(pathOf(env), SECTION);
|
|
40
|
+
if (section === void 0 || section === null)
|
|
41
|
+
return void 0;
|
|
42
|
+
const checked = safeParse(Setting, section);
|
|
43
|
+
return checked.success ? checked.output : { on: true, at: (/* @__PURE__ */ new Date(0)).toISOString() };
|
|
44
|
+
}, "readLocalOnly");
|
|
45
|
+
var localOnly = /* @__PURE__ */ __name((env) => readLocalOnly(env)?.on === true, "localOnly");
|
|
46
|
+
var writeLocalOnly = /* @__PURE__ */ __name((env, on) => writeSharedSection(pathOf(env), SECTION, on ? { on: true, at: (/* @__PURE__ */ new Date()).toISOString() } : void 0), "writeLocalOnly");
|
|
47
|
+
var localOnlyRefusal = /* @__PURE__ */ __name((what, where) => new CliError("permission_error", `local only is on: ${what} would go to ${where}, which is not this computer; nothing was sent. Choose a model on this computer, or turn local only off with \`models local-only set off\``, { reason: "local-only.refused" }), "localOnlyRefusal");
|
|
48
|
+
var refuseOffComputer = /* @__PURE__ */ __name((env, address, what) => {
|
|
49
|
+
if (!onThisComputer(address) && localOnly(env))
|
|
50
|
+
throw localOnlyRefusal(what, hostOf(address));
|
|
51
|
+
}, "refuseOffComputer");
|
|
52
|
+
var hostOf = /* @__PURE__ */ __name((address) => {
|
|
53
|
+
try {
|
|
54
|
+
return new URL(address).host;
|
|
55
|
+
} catch {
|
|
56
|
+
return address;
|
|
57
|
+
}
|
|
58
|
+
}, "hostOf");
|
|
59
|
+
var refuseModelAddress = /* @__PURE__ */ __name((env, address, what) => {
|
|
60
|
+
if (!modelAddressAllowed(address))
|
|
61
|
+
throw new CliError("validation_error", PLAIN_HTTP_REFUSED, { reason: "model.address-refused" });
|
|
62
|
+
refuseOffComputer(env, address, what);
|
|
63
|
+
}, "refuseModelAddress");
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
readLocalOnly,
|
|
67
|
+
localOnly,
|
|
68
|
+
writeLocalOnly,
|
|
69
|
+
localOnlyRefusal,
|
|
70
|
+
refuseOffComputer,
|
|
71
|
+
refuseModelAddress
|
|
72
|
+
};
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
} from "./chunk-Y5E2WNWB.js";
|
|
6
6
|
import {
|
|
7
7
|
CliError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HM6AMYHR.js";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-ZVVMGPBJ.js";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
|
|
14
14
|
import { readFileSync } from "node:fs";
|
|
15
15
|
var musl = /* @__PURE__ */ __name(() => {
|
|
16
16
|
if (process.platform !== "linux")
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/store/normalize.js
|
|
8
8
|
var NORMALIZER_VERSION = 1;
|
|
9
9
|
var fold = /* @__PURE__ */ __name((text) => text.normalize("NFKD").replace(new RegExp("\\p{M}+", "gu"), "").normalize("NFC").toLowerCase(), "fold");
|
|
10
10
|
var normalize = /* @__PURE__ */ __name((text) => fold(text).replace(new RegExp("\\p{Cc}", "gu"), " ").replace(/\s+/gu, " ").trim(), "normalize");
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
isoTimestamp,
|
|
10
10
|
literal,
|
|
11
11
|
maxLength,
|
|
12
|
+
minLength,
|
|
12
13
|
minValue,
|
|
13
14
|
nullable,
|
|
14
15
|
number,
|
|
@@ -23,17 +24,17 @@ import {
|
|
|
23
24
|
union,
|
|
24
25
|
unknown,
|
|
25
26
|
variant
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-S4UUN6LD.js";
|
|
27
28
|
import {
|
|
28
29
|
errorCodes,
|
|
29
30
|
isCliError,
|
|
30
31
|
visibleControls
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-HM6AMYHR.js";
|
|
32
33
|
import {
|
|
33
34
|
__name
|
|
34
35
|
} from "./chunk-ZVVMGPBJ.js";
|
|
35
36
|
|
|
36
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
37
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
|
|
37
38
|
var EXIT_CODES = {
|
|
38
39
|
validation_error: 2,
|
|
39
40
|
configuration_error: 3,
|
|
@@ -54,7 +55,7 @@ var EXIT_CODES = {
|
|
|
54
55
|
var exitCodeFor = /* @__PURE__ */ __name((code) => EXIT_CODES[code], "exitCodeFor");
|
|
55
56
|
var GENERIC_FAILURE = 1;
|
|
56
57
|
|
|
57
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
58
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/effects.js
|
|
58
59
|
var EFFECT_LEVELS = ["none", "read", "write"];
|
|
59
60
|
var effectsSchema = strictObject({
|
|
60
61
|
remote: picklist(EFFECT_LEVELS),
|
|
@@ -691,7 +692,7 @@ function toStandardJsonSchema(schema) {
|
|
|
691
692
|
}
|
|
692
693
|
__name(toStandardJsonSchema, "toStandardJsonSchema");
|
|
693
694
|
|
|
694
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
695
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/registry.js
|
|
695
696
|
var word = pipe(string(), regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, "a lower-case word, words joined by -"));
|
|
696
697
|
var SNAKE_CASE = /^[a-z][a-z0-9]*(_[a-z0-9]+)*$/;
|
|
697
698
|
var text = pipe(string(), regex(/\S/, "must not be empty"));
|
|
@@ -733,7 +734,7 @@ var fill = /* @__PURE__ */ __name((template, values) => template.replace(PLACEHO
|
|
|
733
734
|
return String(value);
|
|
734
735
|
}), "fill");
|
|
735
736
|
|
|
736
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
737
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/output.js
|
|
737
738
|
var MAX_NEXT_STEPS = 2;
|
|
738
739
|
var COMPACT_FLAG = "--compact";
|
|
739
740
|
var isoTime = pipe(string(), isoTimestamp("an ISO 8601 time in UTC"), endsWith("Z", "an ISO 8601 time in UTC, ending in `Z`"));
|
|
@@ -810,6 +811,10 @@ var rankingSchema = strictObject({
|
|
|
810
811
|
})),
|
|
811
812
|
ms: pipe(number(), integer(), minValue(0))
|
|
812
813
|
});
|
|
814
|
+
var querySchema = strictObject({
|
|
815
|
+
chat: optional(strictObject({ word: text, chat_id: text, title: nullable(text) })),
|
|
816
|
+
respelled: optional(array(strictObject({ word: text, tried: pipe(array(text), minLength(1)) })))
|
|
817
|
+
});
|
|
813
818
|
var metaSchema = strictObject({
|
|
814
819
|
run_id: text,
|
|
815
820
|
duration_ms: pipe(number(), integer(), minValue(0)),
|
|
@@ -822,7 +827,8 @@ var metaSchema = strictObject({
|
|
|
822
827
|
now: optional(isoTime),
|
|
823
828
|
now_local: optional(localTime),
|
|
824
829
|
window: optional(strictObject({ since: optional(isoTime), until: optional(isoTime) })),
|
|
825
|
-
ranking: optional(rankingSchema)
|
|
830
|
+
ranking: optional(rankingSchema),
|
|
831
|
+
query: optional(querySchema)
|
|
826
832
|
});
|
|
827
833
|
var offsetOf = /* @__PURE__ */ __name((at, zone) => {
|
|
828
834
|
const name = new Intl.DateTimeFormat("en-US", { timeZone: zone, timeZoneName: "longOffset" }).formatToParts(at).find((part) => part.type === "timeZoneName")?.value ?? "GMT";
|
|
@@ -860,7 +866,7 @@ var jsonlOf = /* @__PURE__ */ __name(({ items, page, meta }) => [
|
|
|
860
866
|
JSON.stringify({ type: "end", complete: meta.complete, ...meta.issues ? { issues: meta.issues } : {}, page })
|
|
861
867
|
].join("\n"), "jsonlOf");
|
|
862
868
|
|
|
863
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
869
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/errors.js
|
|
864
870
|
var CRASH_CODE = "internal_error";
|
|
865
871
|
var CRASH_REASON = "command.crashed";
|
|
866
872
|
var errorObjectSchema = strictObject({
|
|
@@ -959,7 +965,7 @@ var BASE_REASONS = defineReasons([
|
|
|
959
965
|
{ reason: CRASH_REASON, code: CRASH_CODE, message: "the command failed; this is a bug", details: [] }
|
|
960
966
|
]);
|
|
961
967
|
|
|
962
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
968
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/steps.js
|
|
963
969
|
var SAME_COMMAND = "*";
|
|
964
970
|
var commandPath = pipe(string(), regex(/^[a-z][a-z0-9-]*( [a-z][a-z0-9-]*)*$/, "a command path such as `messages sync`"));
|
|
965
971
|
var stepSchema = union([
|
|
@@ -1038,7 +1044,7 @@ var STEPS = defineSteps([
|
|
|
1038
1044
|
}
|
|
1039
1045
|
]);
|
|
1040
1046
|
|
|
1041
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
1047
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
|
|
1042
1048
|
var recognise = /* @__PURE__ */ __name((failure) => {
|
|
1043
1049
|
if (isCliError(failure))
|
|
1044
1050
|
return failure;
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
endpoint
|
|
5
|
+
} from "./chunk-FRB2L7OE.js";
|
|
6
|
+
import {
|
|
7
|
+
filesPresent,
|
|
8
|
+
sharedModelsDirectory
|
|
9
|
+
} from "./chunk-RD7BKTWV.js";
|
|
10
|
+
import {
|
|
11
|
+
check,
|
|
12
|
+
getDotPath,
|
|
13
|
+
maxLength,
|
|
14
|
+
minLength,
|
|
15
|
+
optional,
|
|
16
|
+
picklist,
|
|
17
|
+
pipe,
|
|
18
|
+
record,
|
|
19
|
+
regex,
|
|
20
|
+
safeParse,
|
|
21
|
+
strictObject,
|
|
22
|
+
string,
|
|
23
|
+
trim
|
|
24
|
+
} from "./chunk-S4UUN6LD.js";
|
|
25
|
+
import {
|
|
26
|
+
CliError,
|
|
27
|
+
isCliError
|
|
28
|
+
} from "./chunk-HM6AMYHR.js";
|
|
29
|
+
import {
|
|
30
|
+
__name
|
|
31
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
32
|
+
|
|
33
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/ports/app.js
|
|
34
|
+
import { readFileSync } from "node:fs";
|
|
35
|
+
var envName = /* @__PURE__ */ __name((app, name) => `${app.envPrefix}_${name}`, "envName");
|
|
36
|
+
var locking = /* @__PURE__ */ __name((value) => value !== void 0 && value.trim() !== "" && value !== "0", "locking");
|
|
37
|
+
var ancestries = /* @__PURE__ */ new Map();
|
|
38
|
+
var readable = /* @__PURE__ */ __name((read, path) => {
|
|
39
|
+
try {
|
|
40
|
+
return read(path);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (error.code === "EACCES")
|
|
43
|
+
return void 0;
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}, "readable");
|
|
47
|
+
var ancestorEnvironments = /* @__PURE__ */ __name(({ read = /* @__PURE__ */ __name((path) => readFileSync(path, "utf8"), "read"), from = process.ppid, uid = process.getuid?.() ?? -1, cache = ancestries } = {}) => {
|
|
48
|
+
if (process.platform !== "linux")
|
|
49
|
+
return [];
|
|
50
|
+
const key = `${from}:${uid}`;
|
|
51
|
+
const known = cache.get(key);
|
|
52
|
+
if (known !== void 0)
|
|
53
|
+
return known;
|
|
54
|
+
let found = [];
|
|
55
|
+
try {
|
|
56
|
+
for (let pid = from, depth = 0; pid >= 1 && depth < 64; depth++) {
|
|
57
|
+
const status = read(`/proc/${pid}/status`);
|
|
58
|
+
const field = /* @__PURE__ */ __name((name) => new RegExp(`^${name}:\\s*(\\d+)`, "m").exec(status)?.[1], "field");
|
|
59
|
+
if (Number(field("Uid")) !== uid)
|
|
60
|
+
break;
|
|
61
|
+
const environ = readable(read, `/proc/${pid}/environ`);
|
|
62
|
+
if (environ === void 0)
|
|
63
|
+
break;
|
|
64
|
+
found.push(environ.split("\0"));
|
|
65
|
+
pid = Number(field("PPid"));
|
|
66
|
+
}
|
|
67
|
+
} catch {
|
|
68
|
+
found = null;
|
|
69
|
+
}
|
|
70
|
+
cache.set(key, found);
|
|
71
|
+
return found;
|
|
72
|
+
}, "ancestorEnvironments");
|
|
73
|
+
var valuesOf = /* @__PURE__ */ __name((environments, name) => environments.flatMap((environ) => environ.filter((entry) => entry.startsWith(`${name}=`)).map((entry) => entry.slice(name.length + 1))), "valuesOf");
|
|
74
|
+
var lockedByAncestor = /* @__PURE__ */ __name((name, ancestry = {}) => {
|
|
75
|
+
const environments = ancestorEnvironments(ancestry);
|
|
76
|
+
return environments === null || valuesOf(environments, name).some(locking);
|
|
77
|
+
}, "lockedByAncestor");
|
|
78
|
+
var ancestorValue = /* @__PURE__ */ __name((name, env, ancestry = {}) => valuesOf(ancestorEnvironments(ancestry) ?? [], name).at(-1) ?? env[name], "ancestorValue");
|
|
79
|
+
var readOnlyLockOf = /* @__PURE__ */ __name((app, env) => {
|
|
80
|
+
const name = envName(app, "READ_ONLY");
|
|
81
|
+
return locking(env[name]) || lockedByAncestor(name) ? name : void 0;
|
|
82
|
+
}, "readOnlyLockOf");
|
|
83
|
+
var mailHolderVariable = /* @__PURE__ */ __name((app) => envName(app, "MAIL_HOLDER"), "mailHolderVariable");
|
|
84
|
+
var MESSENGER_CHANGE_REFUSAL = "send, react, change chats or change the account";
|
|
85
|
+
var readOnlyRefusal = /* @__PURE__ */ __name((lock, what) => new CliError("permission_error", `this process is read-only (${lock}) \u2014 it cannot ${what}`), "readOnlyRefusal");
|
|
86
|
+
|
|
87
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/background/budget.js
|
|
88
|
+
var DEADLINE_MARGIN_MS = 5e3;
|
|
89
|
+
var DEADLINE_MARGIN_SHARE = 0.15;
|
|
90
|
+
var DEFAULT_REQUEST_MS = 2e3;
|
|
91
|
+
var ANSWER_RESERVE_MS = 500;
|
|
92
|
+
var oneMoreFits = /* @__PURE__ */ __name((deadline, at, requestMs = DEFAULT_REQUEST_MS) => deadline !== void 0 && at + requestMs + ANSWER_RESERVE_MS < deadline.endsAt, "oneMoreFits");
|
|
93
|
+
var deadlineMargin = /* @__PURE__ */ __name((deadline) => Math.max(DEADLINE_MARGIN_MS, deadline.ms * DEADLINE_MARGIN_SHARE), "deadlineMargin");
|
|
94
|
+
var requestsFor = /* @__PURE__ */ __name((deadline, requestMs = DEFAULT_REQUEST_MS) => deadline === void 0 ? null : Math.max(1, Math.floor((deadline.ms - deadlineMargin(deadline)) / requestMs)), "requestsFor");
|
|
95
|
+
var runBudget = /* @__PURE__ */ __name(({ requests, deadline, requestMs, signal, now = Date.now } = {}) => {
|
|
96
|
+
const fits = requestsFor(deadline, requestMs);
|
|
97
|
+
const limit = fits === null ? requests ?? null : Math.min(fits, requests ?? fits);
|
|
98
|
+
const margin = deadline ? deadlineMargin(deadline) : 0;
|
|
99
|
+
let used = 0;
|
|
100
|
+
let granted = false;
|
|
101
|
+
let stopped2 = null;
|
|
102
|
+
let last;
|
|
103
|
+
let slowest = 0;
|
|
104
|
+
return {
|
|
105
|
+
take() {
|
|
106
|
+
if (stopped2)
|
|
107
|
+
return stopped2;
|
|
108
|
+
const at = now();
|
|
109
|
+
if (last !== void 0)
|
|
110
|
+
slowest = Math.max(slowest, at - last);
|
|
111
|
+
if (signal?.aborted)
|
|
112
|
+
stopped2 = "cancelled";
|
|
113
|
+
else if (limit !== null && used >= limit)
|
|
114
|
+
stopped2 = "requests";
|
|
115
|
+
else if (deadline && at + margin + slowest >= deadline.endsAt)
|
|
116
|
+
stopped2 = "deadline";
|
|
117
|
+
if (stopped2)
|
|
118
|
+
return stopped2;
|
|
119
|
+
used += 1;
|
|
120
|
+
last = at;
|
|
121
|
+
return null;
|
|
122
|
+
},
|
|
123
|
+
first() {
|
|
124
|
+
if (granted || used > 0 || stopped2 !== "deadline")
|
|
125
|
+
return false;
|
|
126
|
+
const at = now();
|
|
127
|
+
if (!oneMoreFits(deadline, at, Math.max(requestMs ?? DEFAULT_REQUEST_MS, slowest)))
|
|
128
|
+
return false;
|
|
129
|
+
granted = true;
|
|
130
|
+
used += 1;
|
|
131
|
+
last = at;
|
|
132
|
+
return true;
|
|
133
|
+
},
|
|
134
|
+
get used() {
|
|
135
|
+
return used;
|
|
136
|
+
},
|
|
137
|
+
limit,
|
|
138
|
+
get stopped() {
|
|
139
|
+
return stopped2;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}, "runBudget");
|
|
143
|
+
|
|
144
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/images/picture/models.js
|
|
145
|
+
import { join } from "node:path";
|
|
146
|
+
var clip = /* @__PURE__ */ __name((name) => `https://huggingface.co/Xenova/clip-vit-base-patch32/resolve/d15189d7028b43f1d3e65039190477f6af591c2a/${name}`, "clip");
|
|
147
|
+
var IMAGE_MODELS = [
|
|
148
|
+
{
|
|
149
|
+
id: "clip-b32",
|
|
150
|
+
title: "CLIP ViT-B/32, 8-bit",
|
|
151
|
+
languages: "English only: translate a query before searching",
|
|
152
|
+
licence: "MIT",
|
|
153
|
+
dims: 512,
|
|
154
|
+
key: "local:clip-b32:512",
|
|
155
|
+
maxTokens: 77,
|
|
156
|
+
vision: "onnx/vision_model_quantized.onnx",
|
|
157
|
+
text: "onnx/text_model_quantized.onnx",
|
|
158
|
+
files: [
|
|
159
|
+
{
|
|
160
|
+
name: "onnx/vision_model_quantized.onnx",
|
|
161
|
+
url: clip("onnx/vision_model_quantized.onnx"),
|
|
162
|
+
sha256: "583fd1110a514667812fee7d684952aaf82a99b959760c8d7dca7e0ab9839299",
|
|
163
|
+
bytes: 89117001
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "onnx/text_model_quantized.onnx",
|
|
167
|
+
url: clip("onnx/text_model_quantized.onnx"),
|
|
168
|
+
sha256: "73baab855d406190da9faa498cfedf65f15cf309f4cc7385b7b032e6d08e5c3a",
|
|
169
|
+
bytes: 64504507
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "tokenizer.json",
|
|
173
|
+
url: clip("tokenizer.json"),
|
|
174
|
+
sha256: "f7f3b7af117d467b58374797691a6438d3e6b9e9cef800dfd5dced7f697a90cd",
|
|
175
|
+
bytes: 2224119
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "tokenizer_config.json",
|
|
179
|
+
url: clip("tokenizer_config.json"),
|
|
180
|
+
sha256: "60ba2912bc6344c94bc16bbdec27fa1209409167b6f2fdf3cfe9e65462ea3967",
|
|
181
|
+
bytes: 775
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
];
|
|
186
|
+
var DEFAULT_IMAGE_MODEL = "clip-b32";
|
|
187
|
+
var imageModel = /* @__PURE__ */ __name((id) => {
|
|
188
|
+
const found = IMAGE_MODELS.find((model) => model.id === id);
|
|
189
|
+
if (!found) {
|
|
190
|
+
throw new CliError("validation_error", `no image model ${id} \u2014 one of: ${IMAGE_MODELS.map((model) => model.id).join(", ")}`);
|
|
191
|
+
}
|
|
192
|
+
return found;
|
|
193
|
+
}, "imageModel");
|
|
194
|
+
var imageModelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("image", env), "imageModelsDirectory");
|
|
195
|
+
var placedImage = /* @__PURE__ */ __name((model, directory) => model.files.map((file) => [file, join(directory, model.id, file.name)]), "placedImage");
|
|
196
|
+
var isImageModelInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placedImage(model, directory)), "isImageModelInstalled");
|
|
197
|
+
|
|
198
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/models/settings.js
|
|
199
|
+
var MODEL_FIELDS = ["provider", "model", "base_url"];
|
|
200
|
+
var modelSettingsShape = record(pipe(string(), regex(/^[a-z][a-z0-9-]*$/)), strictObject({
|
|
201
|
+
provider: optional(picklist(["off", "openai", "anthropic"])),
|
|
202
|
+
model: optional(pipe(string(), trim(), minLength(1), maxLength(200))),
|
|
203
|
+
base_url: optional(pipe(string(), check((value) => endpoint(value), "use an HTTP/S endpoint without credentials, query or fragment")))
|
|
204
|
+
}));
|
|
205
|
+
var resolveModelSettings = /* @__PURE__ */ __name((prefix, layers, env) => {
|
|
206
|
+
const configured = layers.map(([from, scope]) => [from, scope?.models ?? {}]);
|
|
207
|
+
const purposes = /* @__PURE__ */ new Set([
|
|
208
|
+
"default",
|
|
209
|
+
"analysis",
|
|
210
|
+
"replies",
|
|
211
|
+
...configured.flatMap(([, models2]) => Object.keys(models2))
|
|
212
|
+
]);
|
|
213
|
+
for (const name of Object.keys(env)) {
|
|
214
|
+
const match = new RegExp(`^${prefix}_MODELS_([A-Z][A-Z0-9_]*)_(PROVIDER|MODEL|BASE_URL)$`).exec(name);
|
|
215
|
+
if (match?.[1])
|
|
216
|
+
purposes.add(match[1].toLowerCase().replaceAll("_", "-"));
|
|
217
|
+
}
|
|
218
|
+
const models = {};
|
|
219
|
+
const sources = {};
|
|
220
|
+
for (const purpose of purposes) {
|
|
221
|
+
const resolved = {};
|
|
222
|
+
for (const field of MODEL_FIELDS) {
|
|
223
|
+
const variable = `${prefix}_MODELS_${purpose.replaceAll("-", "_").toUpperCase()}_${field.toUpperCase()}`;
|
|
224
|
+
const candidates = [
|
|
225
|
+
[variable, env[variable]?.trim() || void 0],
|
|
226
|
+
...configured.map(([from, model]) => [
|
|
227
|
+
`${from}: models.${purpose}.${field}`,
|
|
228
|
+
model[purpose]?.[field]
|
|
229
|
+
]),
|
|
230
|
+
...purpose === "default" ? [] : [
|
|
231
|
+
[
|
|
232
|
+
`${prefix}_MODELS_DEFAULT_${field.toUpperCase()}`,
|
|
233
|
+
env[`${prefix}_MODELS_DEFAULT_${field.toUpperCase()}`]?.trim() || void 0
|
|
234
|
+
],
|
|
235
|
+
...configured.map(([from, model]) => [
|
|
236
|
+
`${from}: models.default.${field}`,
|
|
237
|
+
model.default?.[field]
|
|
238
|
+
])
|
|
239
|
+
]
|
|
240
|
+
];
|
|
241
|
+
const selected = candidates.find(([, value]) => value !== void 0);
|
|
242
|
+
if (selected)
|
|
243
|
+
resolved[field] = selected[1];
|
|
244
|
+
sources[`models.${purpose}.${field}`] = selected?.[0] ?? "default";
|
|
245
|
+
}
|
|
246
|
+
if (Object.keys(resolved).length)
|
|
247
|
+
models[purpose] = resolved;
|
|
248
|
+
}
|
|
249
|
+
const checked = safeParse(modelSettingsShape, models);
|
|
250
|
+
if (!checked.success)
|
|
251
|
+
throw new CliError("configuration_error", `models.${getDotPath(checked.issues[0]) ?? "settings"} is invalid`);
|
|
252
|
+
return { models: checked.output, sources };
|
|
253
|
+
}, "resolveModelSettings");
|
|
254
|
+
var modelTarget = /* @__PURE__ */ __name((settings, purpose) => {
|
|
255
|
+
const configured = { ...settings.models?.default, ...settings.models?.[purpose] };
|
|
256
|
+
if (configured.provider === void 0 || configured.provider === "off")
|
|
257
|
+
return void 0;
|
|
258
|
+
if (!configured.model)
|
|
259
|
+
throw new CliError("configuration_error", `set models.${purpose}.model before calling its provider`);
|
|
260
|
+
return {
|
|
261
|
+
provider: configured.provider,
|
|
262
|
+
model: configured.model,
|
|
263
|
+
...configured.base_url === void 0 ? {} : { baseUrl: configured.base_url }
|
|
264
|
+
};
|
|
265
|
+
}, "modelTarget");
|
|
266
|
+
|
|
267
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/sends/guarded.js
|
|
268
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
269
|
+
var sentIds = /* @__PURE__ */ __name((typed, message) => ({
|
|
270
|
+
messageId: message.id,
|
|
271
|
+
...message.chatId && message.chatId !== typed ? { resultChatId: message.chatId } : {}
|
|
272
|
+
}), "sentIds");
|
|
273
|
+
var current = new AsyncLocalStorage();
|
|
274
|
+
var writesInFlight = new AsyncLocalStorage();
|
|
275
|
+
var parents = /* @__PURE__ */ new WeakMap();
|
|
276
|
+
var stopped = /* @__PURE__ */ new WeakMap();
|
|
277
|
+
var scopesFor = /* @__PURE__ */ __name((scope = writesInFlight.getStore()) => {
|
|
278
|
+
const result = [];
|
|
279
|
+
for (let at = scope; at; at = parents.get(at))
|
|
280
|
+
result.push(at);
|
|
281
|
+
return result;
|
|
282
|
+
}, "scopesFor");
|
|
283
|
+
var withWriteScope = /* @__PURE__ */ __name((scope, body) => {
|
|
284
|
+
const parent = writesInFlight.getStore();
|
|
285
|
+
if (parent && parent !== scope)
|
|
286
|
+
parents.set(scope, parent);
|
|
287
|
+
return writesInFlight.run(scope, body);
|
|
288
|
+
}, "withWriteScope");
|
|
289
|
+
var stopWrites = /* @__PURE__ */ __name((scope, reason) => {
|
|
290
|
+
stopped.set(scope, reason);
|
|
291
|
+
for (const write of scope)
|
|
292
|
+
write.cut();
|
|
293
|
+
}, "stopWrites");
|
|
294
|
+
var refuseStopped = /* @__PURE__ */ __name((scopes) => {
|
|
295
|
+
for (const scope of scopes)
|
|
296
|
+
if (stopped.has(scope))
|
|
297
|
+
throw stopped.get(scope);
|
|
298
|
+
}, "refuseStopped");
|
|
299
|
+
var currentOperation = /* @__PURE__ */ __name(() => current.getStore(), "currentOperation");
|
|
300
|
+
var guardedWrite = /* @__PURE__ */ __name(async (guard, attempt, act, settled = () => ({}), prepare) => {
|
|
301
|
+
const scopes = scopesFor();
|
|
302
|
+
refuseStopped(scopes);
|
|
303
|
+
try {
|
|
304
|
+
await guard.ask?.(attempt);
|
|
305
|
+
refuseStopped(scopes);
|
|
306
|
+
if (guard.reserve) {
|
|
307
|
+
guard.check(attempt, { reserve: false });
|
|
308
|
+
await guard.reserve(attempt);
|
|
309
|
+
} else
|
|
310
|
+
guard.check(attempt);
|
|
311
|
+
} catch (error) {
|
|
312
|
+
guard.record({ ...attempt, outcome: "refused", errorCode: codeOf(error) });
|
|
313
|
+
throw error;
|
|
314
|
+
}
|
|
315
|
+
try {
|
|
316
|
+
refuseStopped(scopes);
|
|
317
|
+
} catch (error) {
|
|
318
|
+
guard.record({ ...attempt, outcome: "failed", errorCode: codeOf(error) });
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
321
|
+
let recorded = false;
|
|
322
|
+
const once = /* @__PURE__ */ __name((entry) => {
|
|
323
|
+
if (recorded)
|
|
324
|
+
return;
|
|
325
|
+
recorded = true;
|
|
326
|
+
guard.record(entry);
|
|
327
|
+
}, "once");
|
|
328
|
+
let cancelled = false;
|
|
329
|
+
const flight = {
|
|
330
|
+
operationId: attempt.operationId,
|
|
331
|
+
preparing: prepare !== void 0,
|
|
332
|
+
cut: /* @__PURE__ */ __name(() => {
|
|
333
|
+
cancelled = true;
|
|
334
|
+
once({
|
|
335
|
+
...attempt,
|
|
336
|
+
outcome: flight.preparing ? "failed" : "outcome_unknown",
|
|
337
|
+
errorCode: flight.preparing ? "timeout" : "outcome_unknown"
|
|
338
|
+
});
|
|
339
|
+
}, "cut")
|
|
340
|
+
};
|
|
341
|
+
for (const scope of scopes)
|
|
342
|
+
scope.add(flight);
|
|
343
|
+
try {
|
|
344
|
+
if (prepare !== void 0)
|
|
345
|
+
await prepare();
|
|
346
|
+
if (cancelled)
|
|
347
|
+
throw new CliError("timeout", "the command ended before sending; nothing was sent", { sent: false });
|
|
348
|
+
flight.preparing = false;
|
|
349
|
+
const done = await current.run(attempt.operationId, act);
|
|
350
|
+
if (cancelled)
|
|
351
|
+
throw new CliError("outcome_unknown", "the command ended with a write in flight; check its result before continuing", { operation_id: attempt.operationId });
|
|
352
|
+
once({ ...attempt, ...settled(done), outcome: "sent" });
|
|
353
|
+
return done;
|
|
354
|
+
} catch (error) {
|
|
355
|
+
const code = codeOf(error);
|
|
356
|
+
once({ ...attempt, outcome: code === "outcome_unknown" ? "outcome_unknown" : "failed", errorCode: code });
|
|
357
|
+
if (code === "outcome_unknown" && error instanceof Error)
|
|
358
|
+
throw new CliError("outcome_unknown", error.message, {
|
|
359
|
+
...error.details,
|
|
360
|
+
operation_id: attempt.operationId,
|
|
361
|
+
retryable: false
|
|
362
|
+
});
|
|
363
|
+
if (flight.preparing && isCliError(error) && error.details.sent === void 0)
|
|
364
|
+
throw new CliError(error.code, error.message, { ...error.details, sent: false });
|
|
365
|
+
throw error;
|
|
366
|
+
} finally {
|
|
367
|
+
for (const scope of scopes)
|
|
368
|
+
scope.delete(flight);
|
|
369
|
+
}
|
|
370
|
+
}, "guardedWrite");
|
|
371
|
+
var codeOf = /* @__PURE__ */ __name((error) => typeof error?.code === "string" ? error.code : "unknown", "codeOf");
|
|
372
|
+
|
|
373
|
+
export {
|
|
374
|
+
modelSettingsShape,
|
|
375
|
+
resolveModelSettings,
|
|
376
|
+
modelTarget,
|
|
377
|
+
envName,
|
|
378
|
+
ancestorValue,
|
|
379
|
+
readOnlyLockOf,
|
|
380
|
+
mailHolderVariable,
|
|
381
|
+
MESSENGER_CHANGE_REFUSAL,
|
|
382
|
+
readOnlyRefusal,
|
|
383
|
+
ANSWER_RESERVE_MS,
|
|
384
|
+
deadlineMargin,
|
|
385
|
+
runBudget,
|
|
386
|
+
sentIds,
|
|
387
|
+
withWriteScope,
|
|
388
|
+
stopWrites,
|
|
389
|
+
currentOperation,
|
|
390
|
+
guardedWrite,
|
|
391
|
+
codeOf,
|
|
392
|
+
IMAGE_MODELS,
|
|
393
|
+
DEFAULT_IMAGE_MODEL,
|
|
394
|
+
imageModel,
|
|
395
|
+
imageModelsDirectory,
|
|
396
|
+
placedImage,
|
|
397
|
+
isImageModelInstalled
|
|
398
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/http/listen.js
|
|
8
8
|
import { createServer } from "node:http";
|
|
9
9
|
import { Readable } from "node:stream";
|
|
10
10
|
var MAX_BODY = 4 * 1024 * 1024;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.js
|
|
8
|
+
var own = {}.hasOwnProperty;
|
|
9
|
+
function zwitch(key, options) {
|
|
10
|
+
const settings = options || {};
|
|
11
|
+
function one(value, ...parameters) {
|
|
12
|
+
let fn = one.invalid;
|
|
13
|
+
const handlers = one.handlers;
|
|
14
|
+
if (value && own.call(value, key)) {
|
|
15
|
+
const id = String(value[key]);
|
|
16
|
+
fn = own.call(handlers, id) ? handlers[id] : one.unknown;
|
|
17
|
+
}
|
|
18
|
+
if (fn) {
|
|
19
|
+
return fn.call(this, value, ...parameters);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
__name(one, "one");
|
|
23
|
+
one.handlers = settings.handlers || {};
|
|
24
|
+
one.invalid = settings.invalid;
|
|
25
|
+
one.unknown = settings.unknown;
|
|
26
|
+
return one;
|
|
27
|
+
}
|
|
28
|
+
__name(zwitch, "zwitch");
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
zwitch
|
|
32
|
+
};
|
|
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
CAPABILITY_STATEMENTS,
|
|
5
5
|
storeCapable
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YXYZAWWW.js";
|
|
7
7
|
import {
|
|
8
8
|
importFrom
|
|
9
9
|
} from "./chunk-Y5E2WNWB.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
__name
|
|
12
12
|
} from "./chunk-ZVVMGPBJ.js";
|
|
13
13
|
|
|
14
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.707.0_@wirecat+cli-base@0.124.0_commander@15.0.0_esbuild@0.28.2_typ_1ab7200af0919d16d129ae0ece32d37f/node_modules/@wirecat/cli-core/dist/sqlite-runtime.js
|
|
15
15
|
import { spawn, spawnSync } from "node:child_process";
|
|
16
16
|
import { readFileSync } from "node:fs";
|
|
17
17
|
import { dirname } from "node:path";
|