@wirecat/cli-memo 0.131.43 → 0.131.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/memo.js +2 -2
- package/dist/bundle/{all-profiles-NL4TH4VM.js → all-profiles-ZBASDAVU.js} +5 -5
- package/dist/bundle/{anthropic-JTVP4FKR.js → anthropic-3ZS3RCUH.js} +3 -3
- package/dist/bundle/{app-server-FF6PISNB.js → app-server-PQF22PMD.js} +35 -35
- package/dist/bundle/auto-NW7IP4ST.js +86 -0
- package/dist/bundle/{bun-OTDLXIRE.js → bun-3CGVV3V2.js} +2 -2
- package/dist/bundle/{bun-sqlite-HXOV4SGX.js → bun-sqlite-D6T3ESTG.js} +2 -2
- package/dist/bundle/{chunk-GPT5MFYG.js → chunk-25MS26SH.js} +14 -9
- package/dist/bundle/{chunk-TVWO7K4U.js → chunk-2OYB4PWV.js} +5 -5
- package/dist/bundle/{chunk-NYJHYLKS.js → chunk-5IYS3BWO.js} +56 -56
- package/dist/bundle/{chunk-U3VDEHXY.js → chunk-5ZHM6SZW.js} +1 -1
- package/dist/bundle/{chunk-AH7TKAUY.js → chunk-65MK55RS.js} +53 -44
- package/dist/bundle/{chunk-VJ34VFZ5.js → chunk-6NQTGFAL.js} +2 -2
- package/dist/bundle/{chunk-CIN7A3OM.js → chunk-75EEQB2R.js} +11 -11
- package/dist/bundle/{chunk-MYOXBUSI.js → chunk-75RJJQ2Q.js} +10 -10
- package/dist/bundle/{chunk-LDQYIKJH.js → chunk-7EA6M6RA.js} +4 -4
- package/dist/bundle/{chunk-WCFGYCVN.js → chunk-7G63XPDR.js} +7 -7
- package/dist/bundle/{chunk-DTODXX7Y.js → chunk-7G7N3IUO.js} +1 -1
- package/dist/bundle/{chunk-LUHQEQA4.js → chunk-7WJEQ36E.js} +2 -2
- package/dist/bundle/{chunk-BGNGOAG6.js → chunk-AOSSO4YI.js} +6 -6
- package/dist/bundle/{chunk-MLVYZIXB.js → chunk-B4PZQYGP.js} +8 -8
- package/dist/bundle/{chunk-WBNWH2D5.js → chunk-C6GSSMDG.js} +1 -1
- package/dist/bundle/{chunk-Q52KLN53.js → chunk-CAPDRDQU.js} +5 -5
- package/dist/bundle/{chunk-6WDOIKM6.js → chunk-CGJFYMVZ.js} +7 -7
- package/dist/bundle/{chunk-U7MRZIBF.js → chunk-CH37NCAP.js} +3 -3
- package/dist/bundle/{chunk-K44PG5V3.js → chunk-CRLYBXV5.js} +31 -31
- package/dist/bundle/{chunk-USAH53BQ.js → chunk-CXRCADXS.js} +9 -9
- package/dist/bundle/{chunk-C67763MQ.js → chunk-EJ2PEYQU.js} +1 -1
- package/dist/bundle/{chunk-LUTZSIA6.js → chunk-EJ4X6XH2.js} +1 -1
- package/dist/bundle/{chunk-RCCKUVQP.js → chunk-F2VTAFIT.js} +1 -1
- package/dist/bundle/{chunk-2A42QHPZ.js → chunk-FMMIPFTU.js} +4 -4
- package/dist/bundle/{chunk-TYIENI7Z.js → chunk-FRT7URL7.js} +624 -445
- package/dist/bundle/{chunk-LGQZNRNK.js → chunk-G3FRUKAD.js} +258 -159
- package/dist/bundle/{chunk-WVZIP7Z5.js → chunk-G6TRTDHB.js} +2 -2
- package/dist/bundle/{chunk-5MP7XPIP.js → chunk-GBRK3WXY.js} +2 -2
- package/dist/bundle/{chunk-YXPAEW6N.js → chunk-GOJZ3FQY.js} +20 -20
- package/dist/bundle/{chunk-IJC57CPU.js → chunk-GTPWWGQI.js} +7 -7
- package/dist/bundle/{chunk-LSGFFIMA.js → chunk-HAPE26JK.js} +12 -12
- package/dist/bundle/{chunk-XCFGMQBF.js → chunk-HXCSD2XV.js} +1 -1
- package/dist/bundle/{chunk-ELAZVPZT.js → chunk-IAPKZSC5.js} +1 -1
- package/dist/bundle/{chunk-PIQUCN4T.js → chunk-IJBJ47GI.js} +2 -2
- package/dist/bundle/{chunk-TBHX7VF5.js → chunk-IQ2MW47B.js} +27 -27
- package/dist/bundle/{chunk-LAMKU426.js → chunk-IYJGFBNN.js} +5 -5
- package/dist/bundle/{chunk-MISLCCYA.js → chunk-KE3CYUON.js} +1 -1
- package/dist/bundle/{chunk-O5FX3Q4U.js → chunk-L45FSDH3.js} +1 -1
- package/dist/bundle/{chunk-BIVHDUAX.js → chunk-LL3Z6KA3.js} +5 -5
- package/dist/bundle/{chunk-L5NN6UER.js → chunk-MKVUBQEG.js} +1 -1
- package/dist/bundle/{chunk-SKV7GYNB.js → chunk-NB267XRJ.js} +4 -4
- package/dist/bundle/{chunk-RJM4D644.js → chunk-NBA3GJBR.js} +1011 -726
- package/dist/bundle/{chunk-VQPUADFF.js → chunk-NTFEJ52I.js} +1 -1
- package/dist/bundle/{chunk-2LHLMF3R.js → chunk-OMBFF6Z6.js} +7 -1
- package/dist/bundle/{chunk-J3V25QFZ.js → chunk-OT4CLMVF.js} +3 -3
- package/dist/bundle/{chunk-DYX5ATS5.js → chunk-OTOKJAYR.js} +3 -3
- package/dist/bundle/{chunk-RENUU3BQ.js → chunk-PMUAUR5S.js} +4 -4
- package/dist/bundle/{chunk-5HCWKNSM.js → chunk-PXSGUVZP.js} +43 -43
- package/dist/bundle/{chunk-FJVQDWVV.js → chunk-SK3TPK5Y.js} +4 -4
- package/dist/bundle/{chunk-PFWAQGHE.js → chunk-TKFG75MJ.js} +2 -2
- package/dist/bundle/{chunk-G7QBCTF6.js → chunk-TVZEELSS.js} +339 -351
- package/dist/bundle/{chunk-XFSE3ZGY.js → chunk-U4J7TAOW.js} +1 -1
- package/dist/bundle/{chunk-3Z4BMSVX.js → chunk-UP2K5XUA.js} +3 -3
- package/dist/bundle/{chunk-N5K6NZ2F.js → chunk-WGX73SAA.js} +2 -2
- package/dist/bundle/{chunk-GCTZK5QV.js → chunk-YDNM5KYV.js} +4 -4
- package/dist/bundle/{chunk-YHQ2XNNJ.js → chunk-YWTWDX4F.js} +1 -1
- package/dist/bundle/{chunk-IRHRNK2E.js → chunk-ZJXAYYLF.js} +1 -1
- package/dist/bundle/{command-contract-7LYHZI4Y.js → command-contract-K3GJRRXT.js} +11 -11
- package/dist/bundle/{decode-7PFJ3AKS.js → decode-TTMBMSGQ.js} +2 -2
- package/dist/bundle/{echarts-YDLD5JI2.js → echarts-7XN2RLJT.js} +2 -2
- package/dist/bundle/{embed-YDR7WSPK.js → embed-UKTHDQH5.js} +3 -3
- package/dist/bundle/{embedder-KQYPQKZA.js → embedder-SCKLAVKW.js} +6 -6
- package/dist/bundle/{entry-FD4B2GID.js → entry-VQRYB2HE.js} +4 -4
- package/dist/bundle/failure-JHW2U2OF.js +66 -0
- package/dist/bundle/{first-run-C6HSAXYV.js → first-run-RL6ZRY3Y.js} +5 -5
- package/dist/bundle/{first-screen-ZM3LZRP4.js → first-screen-CRURWNKP.js} +12 -12
- package/dist/bundle/{instructions-O7YN5F6D.js → instructions-KGU67SPR.js} +1 -1
- package/dist/bundle/{mcp-X5XYKVTY.js → mcp-CSN7BDNG.js} +35 -35
- package/dist/bundle/memo.js +6 -6
- package/dist/bundle/{node-YP265UUP.js → node-S5LQLVMO.js} +2 -2
- package/dist/bundle/{node-sqlite-K3PWKXTB.js → node-sqlite-PFCIEDPX.js} +3 -3
- package/dist/bundle/{oauth-CUIDTJ5Z.js → oauth-KJOGYDPV.js} +4 -4
- package/dist/bundle/{open-SHUV2BPO.js → open-TPBENKAD.js} +2 -2
- package/dist/bundle/{openai-LSBA5CCQ.js → openai-UOYTHO32.js} +7 -7
- package/dist/bundle/{process-POGO7VDZ.js → process-JWKE7GPV.js} +1 -1
- package/dist/bundle/{program-DZ4TM3PS.js → program-RJ6X4DXE.js} +945 -425
- package/dist/bundle/{prompt-V7SEBV7G.js → prompt-5HQ3Z7ZS.js} +2 -2
- package/dist/bundle/{recognize-DK3N2GVZ.js → recognize-5ILXEPII.js} +1 -1
- package/dist/bundle/{remote-XYFCKYIQ.js → remote-WIN3HJII.js} +4 -4
- package/dist/bundle/{rerank-COKJGAIB.js → rerank-JKHDSEBI.js} +4 -4
- package/dist/bundle/{serve-KW3AGGTZ.js → serve-VMHFRDYH.js} +6 -6
- package/dist/bundle/server-IBJ23GCB.js +48 -0
- package/dist/bundle/server-SNWCFMJN.js +61 -0
- package/dist/bundle/{server-72N5XGA6.js → server-TKWVP4OJ.js} +50 -50
- package/dist/bundle/{state-KHK3S4AC.js → state-OWOLD7JI.js} +3 -3
- package/dist/bundle/{store-GGUL63V7.js → store-6GFFSNRY.js} +9 -9
- package/dist/bundle/store-maintenance-command-7DMPWFT4.js +48 -0
- package/dist/bundle/update-KSB7VYAW.js +69 -0
- package/dist/context/command.d.ts +4 -0
- package/dist/context/command.d.ts.map +1 -1
- package/dist/context/command.js +7 -5
- package/dist/context/command.js.map +1 -1
- package/dist/context/context.d.ts.map +1 -1
- package/dist/context/context.js +4 -3
- package/dist/context/context.js.map +1 -1
- package/dist/contract-overrides/skill.js +1 -1
- package/dist/contract-overrides/skill.js.map +1 -1
- package/dist/digest/command.d.ts +9 -0
- package/dist/digest/command.d.ts.map +1 -0
- package/dist/digest/command.js +59 -0
- package/dist/digest/command.js.map +1 -0
- package/dist/digest/digest.d.ts +62 -0
- package/dist/digest/digest.d.ts.map +1 -0
- package/dist/digest/digest.js +347 -0
- package/dist/digest/digest.js.map +1 -0
- package/dist/digest/known.d.ts +7 -0
- package/dist/digest/known.d.ts.map +1 -0
- package/dist/digest/known.js +28 -0
- package/dist/digest/known.js.map +1 -0
- package/dist/digest/text.d.ts +8 -0
- package/dist/digest/text.d.ts.map +1 -0
- package/dist/digest/text.js +47 -0
- package/dist/digest/text.js.map +1 -0
- package/dist/doctor/command.d.ts +1 -1
- package/dist/examples.d.ts.map +1 -1
- package/dist/examples.js +3 -2
- package/dist/examples.js.map +1 -1
- package/dist/knowledge/command.d.ts.map +1 -1
- package/dist/knowledge/command.js +17 -33
- package/dist/knowledge/command.js.map +1 -1
- package/dist/knowledge/project-context.d.ts +1 -0
- package/dist/knowledge/project-context.d.ts.map +1 -1
- package/dist/knowledge/project-context.js +6 -3
- package/dist/knowledge/project-context.js.map +1 -1
- package/dist/mail/findings-command.d.ts.map +1 -1
- package/dist/mail/findings-command.js +20 -3
- package/dist/mail/findings-command.js.map +1 -1
- package/dist/mail/findings-duplicates.d.ts +19 -0
- package/dist/mail/findings-duplicates.d.ts.map +1 -0
- package/dist/mail/findings-duplicates.js +159 -0
- package/dist/mail/findings-duplicates.js.map +1 -0
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +1 -63
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +6 -0
- package/dist/reasons.js.map +1 -1
- package/dist/review/command.d.ts.map +1 -1
- package/dist/review/command.js +4 -8
- package/dist/review/command.js.map +1 -1
- package/dist/review/status.d.ts +9 -0
- package/dist/review/status.d.ts.map +1 -1
- package/dist/review/status.js +11 -6
- package/dist/review/status.js.map +1 -1
- package/dist/search/command.d.ts.map +1 -1
- package/dist/search/command.js +3 -1
- package/dist/search/command.js.map +1 -1
- package/dist/search/search.d.ts.map +1 -1
- package/dist/search/search.js +10 -2
- package/dist/search/search.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/cli-memo/SKILL.md +3 -1
- package/skills/cli-memo/topics/projects.md +2 -1
- package/skills/morning-digest/SKILL.md +50 -0
- package/dist/bundle/auto-KUNM4M5S.js +0 -86
- package/dist/bundle/failure-FOZGSUOL.js +0 -66
- package/dist/bundle/server-QZPRR4H3.js +0 -48
- package/dist/bundle/server-VPEPJSQM.js +0 -61
- package/dist/bundle/store-maintenance-command-3KI6LYZB.js +0 -48
- package/dist/bundle/update-OLU3IRV6.js +0 -69
- /package/dist/bundle/{chunk-SWSCSMAU.js → chunk-DL5LDAOS.js} +0 -0
|
@@ -100,11 +100,11 @@ import {
|
|
|
100
100
|
validateQuery,
|
|
101
101
|
walkQuery,
|
|
102
102
|
zonedMoment
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-5IYS3BWO.js";
|
|
104
104
|
import {
|
|
105
105
|
holdsCredential,
|
|
106
106
|
secretNamed
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-EJ4X6XH2.js";
|
|
108
108
|
import {
|
|
109
109
|
DEFAULT_STEMMERS,
|
|
110
110
|
DEFAULT_STEMMERS_VERSION,
|
|
@@ -117,26 +117,26 @@ import {
|
|
|
117
117
|
fold,
|
|
118
118
|
normalize,
|
|
119
119
|
parseStemmers
|
|
120
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-CGJFYMVZ.js";
|
|
121
121
|
import {
|
|
122
122
|
DEFAULT_TASK_CATEGORIES,
|
|
123
123
|
sharedConfigPath,
|
|
124
124
|
storedTaskCategories,
|
|
125
125
|
taskCategoriesReader
|
|
126
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-YDNM5KYV.js";
|
|
127
127
|
import {
|
|
128
128
|
refuseOwnerStoreInTests,
|
|
129
129
|
storePath
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-U4J7TAOW.js";
|
|
131
131
|
import {
|
|
132
132
|
quietSqliteWarning,
|
|
133
133
|
storeCapable
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-CAPDRDQU.js";
|
|
135
135
|
import {
|
|
136
136
|
PRAGMAS,
|
|
137
137
|
TIME_LIMIT_FUNCTION,
|
|
138
138
|
TimeLimitReached
|
|
139
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-7G7N3IUO.js";
|
|
140
140
|
import {
|
|
141
141
|
array,
|
|
142
142
|
boolean,
|
|
@@ -186,7 +186,7 @@ import {
|
|
|
186
186
|
sql,
|
|
187
187
|
sqliteTable,
|
|
188
188
|
text
|
|
189
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-C6GSSMDG.js";
|
|
190
190
|
import {
|
|
191
191
|
__commonJS,
|
|
192
192
|
__name,
|
|
@@ -9930,7 +9930,7 @@ var require_cjs = __commonJS({
|
|
|
9930
9930
|
}
|
|
9931
9931
|
});
|
|
9932
9932
|
|
|
9933
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9933
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/account-store.js
|
|
9934
9934
|
var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
|
|
9935
9935
|
const methods = whole;
|
|
9936
9936
|
return Object.fromEntries(Object.keys(keyed).map((name) => [
|
|
@@ -10058,7 +10058,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
10058
10058
|
};
|
|
10059
10059
|
}, "bindAccount");
|
|
10060
10060
|
|
|
10061
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10061
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/locator.js
|
|
10062
10062
|
var SCHEME = "msg:";
|
|
10063
10063
|
var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
|
|
10064
10064
|
var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
|
|
@@ -10072,7 +10072,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
|
|
|
10072
10072
|
return { provider, account, chat: chat2, message: message2 };
|
|
10073
10073
|
}, "parseLocator");
|
|
10074
10074
|
|
|
10075
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10075
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/references.js
|
|
10076
10076
|
var SIMPLE_REFERENCES = [
|
|
10077
10077
|
"note",
|
|
10078
10078
|
"document",
|
|
@@ -10223,7 +10223,7 @@ var looksLikeReference = /* @__PURE__ */ __name((text6) => {
|
|
|
10223
10223
|
return match !== null && byPrefix.has(match[1]);
|
|
10224
10224
|
}, "looksLikeReference");
|
|
10225
10225
|
|
|
10226
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10226
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/providers.js
|
|
10227
10227
|
var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events", "crm"];
|
|
10228
10228
|
var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
|
|
10229
10229
|
var PROVIDERS = [
|
|
@@ -10339,7 +10339,7 @@ var providerNamed = /* @__PURE__ */ __name((word2) => {
|
|
|
10339
10339
|
var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
|
|
10340
10340
|
var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
|
|
10341
10341
|
|
|
10342
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10342
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/query.js
|
|
10343
10343
|
var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
|
|
10344
10344
|
var inSource = /* @__PURE__ */ __name((source2, provider) => source2 === "all" || source2 === "bots" && isBotProvider(provider) || source2 === "personal" && !isBotProvider(provider) || source2 === provider || providerNamed(source2)?.name === provider || isKind(source2) && kindOf(provider) === source2, "inSource");
|
|
10345
10345
|
var fail = /* @__PURE__ */ __name((message2) => {
|
|
@@ -10362,7 +10362,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
|
|
|
10362
10362
|
return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
|
|
10363
10363
|
}, "sourceOf");
|
|
10364
10364
|
|
|
10365
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10365
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/account-list.js
|
|
10366
10366
|
var ACCOUNT_GROUPS = "accountGroups";
|
|
10367
10367
|
var ACCOUNT_GROUPS_SETTING = "account_groups";
|
|
10368
10368
|
var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
@@ -10550,7 +10550,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4)
|
|
|
10550
10550
|
return { accounts: [...chosen.values()], skipped };
|
|
10551
10551
|
}, "fitting");
|
|
10552
10552
|
|
|
10553
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10553
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
|
|
10554
10554
|
var IndexBuilderOn = class {
|
|
10555
10555
|
static {
|
|
10556
10556
|
__name(this, "IndexBuilderOn");
|
|
@@ -10745,7 +10745,7 @@ function alias(table, alias2) {
|
|
|
10745
10745
|
}
|
|
10746
10746
|
__name(alias, "alias");
|
|
10747
10747
|
|
|
10748
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10748
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
|
|
10749
10749
|
var ENTITY_TABLES = {
|
|
10750
10750
|
account: "accounts",
|
|
10751
10751
|
attachment: "attachments",
|
|
@@ -10791,7 +10791,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
|
|
|
10791
10791
|
return { table, pointer, type, count, known: known2 };
|
|
10792
10792
|
}).filter(({ count }) => count > 0)), "orphanPointers");
|
|
10793
10793
|
|
|
10794
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10794
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
|
|
10795
10795
|
var canonicalTags = sqliteTable("canonical_tags", {
|
|
10796
10796
|
id: integer("id").primaryKey(),
|
|
10797
10797
|
name: text("name").notNull().unique(),
|
|
@@ -10800,7 +10800,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
|
|
|
10800
10800
|
updatedAt: integer("updated_at").notNull()
|
|
10801
10801
|
});
|
|
10802
10802
|
|
|
10803
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10803
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
|
|
10804
10804
|
var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
10805
10805
|
sourceKey: text("source_key").notNull(),
|
|
10806
10806
|
collection: text("collection").notNull(),
|
|
@@ -10810,13 +10810,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
|
10810
10810
|
createdAt: integer("created_at").notNull()
|
|
10811
10811
|
}, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
|
|
10812
10812
|
|
|
10813
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10813
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
|
|
10814
10814
|
var documentIndexPending = sqliteTable("document_index_pending", {
|
|
10815
10815
|
id: integer("id").notNull(),
|
|
10816
10816
|
indexableType: text("indexable_type").notNull()
|
|
10817
10817
|
}, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
|
|
10818
10818
|
|
|
10819
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10819
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
|
|
10820
10820
|
var tagRedirects = sqliteTable("tag_redirects", {
|
|
10821
10821
|
sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
|
|
10822
10822
|
survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
|
|
@@ -10842,7 +10842,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
|
|
|
10842
10842
|
index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
|
|
10843
10843
|
]);
|
|
10844
10844
|
|
|
10845
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10845
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
|
|
10846
10846
|
var accounts = sqliteTable("accounts", {
|
|
10847
10847
|
id: integer("id").primaryKey(),
|
|
10848
10848
|
provider: text("provider").notNull(),
|
|
@@ -12611,7 +12611,7 @@ var storeSettings = sqliteTable("store_settings", {
|
|
|
12611
12611
|
at: integer("at").notNull()
|
|
12612
12612
|
});
|
|
12613
12613
|
|
|
12614
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12614
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
|
|
12615
12615
|
var ARMS = [
|
|
12616
12616
|
[
|
|
12617
12617
|
"message",
|
|
@@ -12738,7 +12738,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
|
|
|
12738
12738
|
return recomputed;
|
|
12739
12739
|
}, "drainInvolvementQueue");
|
|
12740
12740
|
|
|
12741
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12741
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
12742
12742
|
import { domainToUnicode } from "node:url";
|
|
12743
12743
|
|
|
12744
12744
|
// node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
|
|
@@ -22760,7 +22760,7 @@ var oa = /* @__PURE__ */ __name((e) => {
|
|
|
22760
22760
|
}, "oa");
|
|
22761
22761
|
var na = { parse: O, get: aa, isValid: oa };
|
|
22762
22762
|
|
|
22763
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22763
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
|
|
22764
22764
|
var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
|
|
22765
22765
|
var ID = /^[\w-]{10,}$/;
|
|
22766
22766
|
var trimUrl = /* @__PURE__ */ __name((url) => {
|
|
@@ -22801,7 +22801,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text6) => [...text6.matchAll(L
|
|
|
22801
22801
|
return { url, documentId: googleDocumentId(url) };
|
|
22802
22802
|
}), "googleDocumentLinks");
|
|
22803
22803
|
|
|
22804
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22804
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
|
|
22805
22805
|
var PHONE_PLANS = [
|
|
22806
22806
|
{
|
|
22807
22807
|
country: "us",
|
|
@@ -23181,7 +23181,7 @@ var PHONE_PLANS = [
|
|
|
23181
23181
|
}
|
|
23182
23182
|
];
|
|
23183
23183
|
|
|
23184
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23184
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/phones.js
|
|
23185
23185
|
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
23186
23186
|
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
23187
23187
|
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
@@ -23222,7 +23222,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
|
|
|
23222
23222
|
return void 0;
|
|
23223
23223
|
}, "nationalPhone");
|
|
23224
23224
|
|
|
23225
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23225
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/places.js
|
|
23226
23226
|
var BEFORE = [
|
|
23227
23227
|
[/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
|
|
23228
23228
|
[/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
|
|
@@ -23482,7 +23482,7 @@ var findPlaces = /* @__PURE__ */ __name((text6) => {
|
|
|
23482
23482
|
return found2.sort((a, b) => a.start - b.start);
|
|
23483
23483
|
}, "findPlaces");
|
|
23484
23484
|
|
|
23485
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23485
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
23486
23486
|
var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
|
|
23487
23487
|
var MENTION_VERSIONS = {
|
|
23488
23488
|
phone: 1,
|
|
@@ -23672,7 +23672,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
|
|
|
23672
23672
|
};
|
|
23673
23673
|
}, "typedPhone");
|
|
23674
23674
|
|
|
23675
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23675
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/first-names.js
|
|
23676
23676
|
var RUSSIAN = "\u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440 \u0410\u043B\u0435\u043A\u0441\u0435\u0439 \u0410\u043D\u0430\u0442\u043E\u043B\u0438\u0439 \u0410\u043D\u0434\u0440\u0435\u0439 \u0410\u043D\u0442\u043E\u043D \u0410\u0440\u043A\u0430\u0434\u0438\u0439 \u0410\u0440\u0441\u0435\u043D\u0438\u0439 \u0410\u0440\u0442\u0451\u043C \u0410\u0440\u0442\u0435\u043C \u0410\u0440\u0442\u0443\u0440 \u0411\u043E\u0440\u0438\u0441 \u0412\u0430\u0434\u0438\u043C \u0412\u0430\u043B\u0435\u043D\u0442\u0438\u043D \u0412\u0430\u043B\u0435\u0440\u0438\u0439 \u0412\u0430\u0441\u0438\u043B\u0438\u0439 \u0412\u0438\u043A\u0442\u043E\u0440 \u0412\u0438\u0442\u0430\u043B\u0438\u0439 \u0412\u043B\u0430\u0434\u0438\u043C\u0438\u0440 \u0412\u043B\u0430\u0434\u0438\u0441\u043B\u0430\u0432 \u0412\u0441\u0435\u0432\u043E\u043B\u043E\u0434 \u0412\u044F\u0447\u0435\u0441\u043B\u0430\u0432 \u0413\u0435\u043D\u043D\u0430\u0434\u0438\u0439 \u0413\u0435\u043E\u0440\u0433\u0438\u0439 \u0413\u043B\u0435\u0431 \u0413\u0440\u0438\u0433\u043E\u0440\u0438\u0439 \u0414\u0430\u043D\u0438\u0438\u043B \u0414\u0430\u043D\u0438\u043B\u0430 \u0414\u0435\u043D\u0438\u0441 \u0414\u043C\u0438\u0442\u0440\u0438\u0439 \u0415\u0432\u0433\u0435\u043D\u0438\u0439 \u0415\u0433\u043E\u0440 \u0418\u0432\u0430\u043D \u0418\u0433\u043E\u0440\u044C \u0418\u043B\u044C\u044F \u041A\u0438\u0440\u0438\u043B\u043B \u041A\u043E\u043D\u0441\u0442\u0430\u043D\u0442\u0438\u043D \u041B\u0435\u043E\u043D\u0438\u0434 \u041C\u0430\u043A\u0441\u0438\u043C \u041C\u0430\u0440\u0430\u0442 \u041C\u0430\u0442\u0432\u0435\u0439 \u041C\u0438\u0445\u0430\u0438\u043B \u041D\u0438\u043A\u0438\u0442\u0430 \u041D\u0438\u043A\u043E\u043B\u0430\u0439 \u041E\u043B\u0435\u0433 \u041F\u0430\u0432\u0435\u043B \u041F\u0451\u0442\u0440 \u041F\u0435\u0442\u0440 \u0420\u043E\u0434\u0438\u043E\u043D \u0420\u043E\u0441\u0442\u0438\u0441\u043B\u0430\u0432 \u0420\u0443\u0441\u043B\u0430\u043D \u0420\u0443\u0441\u0442\u0430\u043C \u0421\u0435\u043C\u0451\u043D \u0421\u0435\u043C\u0435\u043D \u0421\u0435\u0440\u0433\u0435\u0439 \u0421\u0442\u0430\u043D\u0438\u0441\u043B\u0430\u0432 \u0421\u0442\u0435\u043F\u0430\u043D \u0422\u0438\u043C\u043E\u0444\u0435\u0439 \u0422\u0438\u043C\u0443\u0440 \u0424\u0451\u0434\u043E\u0440 \u0424\u0435\u0434\u043E\u0440 \u0424\u0438\u043B\u0438\u043F\u043F \u042D\u0434\u0443\u0430\u0440\u0434 \u042E\u0440\u0438\u0439 \u042F\u0440\u043E\u0441\u043B\u0430\u0432 \u042F\u043A\u043E\u0432 \u042D\u043B\u044C\u0434\u0430\u0440 \u0414\u0430\u0432\u0438\u0434 \u0417\u0430\u0445\u0430\u0440 \u0421\u0430\u0432\u0435\u043B\u0438\u0439 \u041C\u0438\u0440\u043E\u043D \u041F\u043B\u0430\u0442\u043E\u043D \u0414\u0435\u043C\u0438\u0434 \u0410\u0440\u0441\u0435\u043D \u041D\u0443\u0440\u043B\u0430\u043D \u0410\u043D\u0437\u043E\u0440 \u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440\u0430 \u0410\u043B\u0438\u043D\u0430 \u0410\u043B\u0438\u0441\u0430 \u0410\u043B\u043B\u0430 \u0410\u043D\u0430\u0441\u0442\u0430\u0441\u0438\u044F \u0410\u043D\u0433\u0435\u043B\u0438\u043D\u0430 \u0410\u043D\u043D\u0430 \u0410\u043D\u0442\u043E\u043D\u0438\u043D\u0430 \u0412\u0430\u043B\u0435\u043D\u0442\u0438\u043D\u0430 \u0412\u0430\u043B\u0435\u0440\u0438\u044F \u0412\u0430\u0440\u0432\u0430\u0440\u0430 \u0412\u0435\u0440\u043E\u043D\u0438\u043A\u0430 \u0412\u0438\u043A\u0442\u043E\u0440\u0438\u044F \u0413\u0430\u043B\u0438\u043D\u0430 \u0414\u0430\u0440\u044C\u044F \u0414\u0438\u0430\u043D\u0430 \u0415\u0432\u0433\u0435\u043D\u0438\u044F \u0415\u043A\u0430\u0442\u0435\u0440\u0438\u043D\u0430 \u0415\u043B\u0435\u043D\u0430 \u0415\u043B\u0438\u0437\u0430\u0432\u0435\u0442\u0430 \u0416\u0430\u043D\u043D\u0430 \u0417\u0438\u043D\u0430\u0438\u0434\u0430 \u041A\u0430\u0440\u0438\u043D\u0430 \u041A\u0438\u0440\u0430 \u041A\u043B\u0430\u0432\u0434\u0438\u044F \u041A\u0440\u0438\u0441\u0442\u0438\u043D\u0430 \u041A\u0441\u0435\u043D\u0438\u044F \u041B\u0430\u0440\u0438\u0441\u0430 \u041B\u0438\u0434\u0438\u044F \u041B\u044E\u0434\u043C\u0438\u043B\u0430 \u041C\u0430\u0440\u0433\u0430\u0440\u0438\u0442\u0430 \u041C\u0430\u0440\u0438\u043D\u0430 \u041C\u0430\u0440\u0438\u044F \u041C\u0438\u043B\u0430\u043D\u0430 \u041D\u0430\u0442\u0430\u043B\u044C\u044F \u041D\u0430\u0442\u0430\u043B\u0438\u044F \u041D\u0438\u043D\u0430 \u041E\u043A\u0441\u0430\u043D\u0430 \u041E\u043B\u0435\u0441\u044F \u041E\u043B\u044C\u0433\u0430 \u041F\u043E\u043B\u0438\u043D\u0430 \u0420\u0430\u0438\u0441\u0430 \u0421\u0432\u0435\u0442\u043B\u0430\u043D\u0430 \u0421\u043E\u0444\u0438\u044F \u0421\u043E\u0444\u044C\u044F \u0422\u0430\u0438\u0441\u0438\u044F \u0422\u0430\u043C\u0430\u0440\u0430 \u0422\u0430\u0442\u044C\u044F\u043D\u0430 \u0423\u043B\u044C\u044F\u043D\u0430 \u042E\u043B\u0438\u044F \u042D\u043B\u044C\u0432\u0438\u0440\u0430 \u0420\u0435\u0433\u0438\u043D\u0430 \u0421\u043D\u0435\u0436\u0430\u043D\u0430 \u0410\u043B\u0451\u043D\u0430 \u0410\u043B\u0435\u043D\u0430 \u0412\u0430\u0441\u0438\u043B\u0438\u0441\u0430 \u0410\u0440\u0438\u043D\u0430 \u0415\u0441\u0435\u043D\u0438\u044F \u042D\u0432\u0435\u043B\u0438\u043D\u0430 \u0421\u0430\u0448\u0430 \u0416\u0435\u043D\u044F \u0412\u0430\u043B\u044F \u0414\u0438\u043C\u0430 \u041C\u0438\u0448\u0430 \u041A\u043E\u043B\u044F \u041F\u0435\u0442\u044F \u0412\u0430\u0441\u044F \u0421\u0435\u0440\u0451\u0436\u0430 \u0421\u0435\u0440\u0435\u0436\u0430 \u041F\u0430\u0448\u0430 \u041B\u0451\u0448\u0430 \u041B\u0435\u0448\u0430 \u0412\u0438\u0442\u044F \u041A\u043E\u0441\u0442\u044F \u0412\u043E\u0432\u0430 \u0412\u043E\u043B\u043E\u0434\u044F \u0412\u0430\u043D\u044F \u0413\u043E\u0448\u0430 \u0413\u0440\u0438\u0448\u0430 \u0422\u043E\u043B\u044F \u0411\u043E\u0440\u044F \u0421\u0442\u0430\u0441 \u0422\u0451\u043C\u0430 \u0422\u0430\u043D\u044F \u041A\u0430\u0442\u044F \u041B\u0435\u043D\u0430 \u041D\u0430\u0442\u0430\u0448\u0430 \u0421\u0432\u0435\u0442\u0430 \u042E\u043B\u044F \u041D\u0430\u0441\u0442\u044F \u0414\u0430\u0448\u0430 \u041C\u0430\u0448\u0430 \u041B\u044E\u0434\u0430 \u0413\u0430\u043B\u044F \u0412\u0438\u043A\u0430 \u041A\u0441\u044E\u0448\u0430 \u041B\u0438\u0437\u0430 \u0421\u043E\u043D\u044F \u041D\u0430\u0434\u044F \u041B\u0435\u0440\u0430 \u0410\u043B\u0451\u0448\u0430 \u0410\u043B\u0435\u0448\u0430 \u041C\u0438\u0442\u044F \u0421\u0435\u043D\u044F \u0424\u0435\u0434\u044F \u0416\u0435\u043D\u0435\u0447\u043A\u0430 \u041E\u043B\u0435\u043D\u044C\u043A\u0430 \u0422\u0430\u043D\u0435\u0447\u043A\u0430";
|
|
23677
23677
|
var EUROPEAN = "James John Robert Michael William David Richard Joseph Thomas Charles Christopher Daniel Matthew Anthony Donald Steven Paul Andrew Joshua Kenneth Kevin Brian George Timothy Ronald Edward Jason Jeffrey Ryan Jacob Gary Nicholas Eric Jonathan Stephen Larry Justin Scott Brandon Benjamin Samuel Gregory Alexander Patrick Raymond Dennis Jerry Tyler Aaron Nathan Henry Peter Zachary Douglas Harold Kyle Noah Ethan Oliver Harry Lucas Liam Mary Patricia Jennifer Linda Elizabeth Barbara Susan Jessica Sarah Karen Lisa Nancy Betty Margaret Sandra Ashley Kimberly Emily Donna Michelle Carol Amanda Dorothy Melissa Deborah Stephanie Rebecca Sharon Laura Cynthia Kathleen Angela Shirley Anna Brenda Pamela Emma Nicole Helen Samantha Katherine Christine Rachel Carolyn Janet Catherine Maria Heather Diane Ruth Julie Olivia Joyce Kelly Lauren Christina Joan Evelyn Judith Megan Andrea Cheryl Hannah Jacqueline Martha Teresa Sara Madison Frances Kathryn Janice Abigail Alice Julia Judy Sophia Denise Doris Marilyn Danielle Beverly Isabella Theresa Diana Natalie Charlotte Marie Kayla Alexis Javier Carlos Antonio Manuel Francisco Juan Pedro Alejandro Miguel Rafael Pablo Sergio Fernando Jorge Luis Alberto \xC1lvaro Diego Adri\xE1n Rub\xE9n Iv\xE1n \xD3scar Andr\xE9s Ra\xFAl Enrique Vicente Joaqu\xEDn Ignacio Gonzalo Marcos V\xEDctor Jaime Alfonso Guillermo Tom\xE1s Emilio Gabriel Nicol\xE1s Mart\xEDn Jordi Josep Xavier Luc\xEDa Carmen Isabel Cristina Marta Elena Raquel Silvia Beatriz Paula Nuria N\xFAria Sonia Alicia Irene Montserrat Inmaculada Noelia Lorena Sof\xEDa Valeria Claudia Natalia Sandra Ver\xF3nica Esther Yolanda Vanesa Laia Klaus J\xFCrgen Wolfgang Stefan Andreas Matthias Markus Tobias Florian Lukas Jonas Maximilian Sebastian Dirk Sabine Ursula Petra Monika Katrin Anja Pierre Michel Philippe Alain Fran\xE7ois Christophe Laurent Olivier Julien Mathieu S\xE9bastien Guillaume Antoine Camille Nathalie Isabelle Sylvie Sophie C\xE9line Aur\xE9lie Chlo\xE9 Manon Giuseppe Giovanni Marco Luca Francesco Alessandro Matteo Lorenzo Stefano Paolo Roberto Davide Simone Federico Giulia Francesca Chiara Valentina Alessia Martina Elisa Jo\xE3o Pedro Tiago Beatriz In\xEAs Mariana Piotr Krzysztof Tomasz Marcin Agnieszka Katarzyna Ma\u0142gorzata Magdalena";
|
|
23678
23678
|
var WORDS = "\u0412\u0435\u0440\u0430 \u041D\u0430\u0434\u0435\u0436\u0434\u0430 \u041B\u044E\u0431\u043E\u0432\u044C \u0421\u043B\u0430\u0432\u0430 \u0420\u043E\u043C\u0430\u043D \u0420\u043E\u0437\u0430 \u041C\u0430\u0439\u044F \u041B\u0438\u043B\u0438\u044F \u0417\u043B\u0430\u0442\u0430 \u041C\u0438\u043B\u0430 \u041D\u0438\u043A\u0430 \u041B\u0435\u0432 \u0413\u043B\u043E\u0440\u0438\u044F Will Mark Rose Grace Hope Faith Bill Frank Jack June April Summer Amber Ruby Lily Daisy Victoria Virginia Georgia Florence Sydney Chelsea Jordan Austin Dallas Mercedes Dolores Rosa Pilar Marina Esperanza Gloria Amparo Consuelo Roc\xEDo Salvador Santiago Jes\xFAs \xC1ngeles Hugo Ram\xF3n Christian Felix F\xE9lix Mario Martin Victor Pierre Paz Merc\xE8 Estrella Aurora Concepci\xF3n Remedios Soledad Milagros Angel \xC1ngel Dawn Joy Holly Ivy Iris Violet Pearl";
|
|
@@ -23680,7 +23680,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
|
|
|
23680
23680
|
var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
|
|
23681
23681
|
var NAME_WORDS = WORDS.split(" ");
|
|
23682
23682
|
|
|
23683
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23683
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/person-names.js
|
|
23684
23684
|
var LATIN_TO_CYRILLIC = {
|
|
23685
23685
|
shch: "\u0449",
|
|
23686
23686
|
sch: "\u0449",
|
|
@@ -23888,7 +23888,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text6, stem, taken) => {
|
|
|
23888
23888
|
return found2;
|
|
23889
23889
|
}, "findUnknownNames");
|
|
23890
23890
|
|
|
23891
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23891
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/attachments.js
|
|
23892
23892
|
var NOT_FILES = /* @__PURE__ */ new Set([
|
|
23893
23893
|
"webpage",
|
|
23894
23894
|
"share",
|
|
@@ -23928,7 +23928,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
|
|
|
23928
23928
|
});
|
|
23929
23929
|
}, "matchDownloads");
|
|
23930
23930
|
|
|
23931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23931
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
|
|
23932
23932
|
var QUERY_VERSION = 1;
|
|
23933
23933
|
var QUERY_LIMITS2 = {
|
|
23934
23934
|
...QUERY_LIMITS,
|
|
@@ -23964,7 +23964,7 @@ function exhausted(budget) {
|
|
|
23964
23964
|
}
|
|
23965
23965
|
__name(exhausted, "exhausted");
|
|
23966
23966
|
|
|
23967
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23967
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
23968
23968
|
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
23969
23969
|
var literal2 = /* @__PURE__ */ __name((c) => ({
|
|
23970
23970
|
kind: "char",
|
|
@@ -24364,7 +24364,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
|
24364
24364
|
return out;
|
|
24365
24365
|
}, "foldRegex");
|
|
24366
24366
|
|
|
24367
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24367
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
|
|
24368
24368
|
var PRESET_VERSION = 1;
|
|
24369
24369
|
var PRESETS = {
|
|
24370
24370
|
password: {
|
|
@@ -24418,7 +24418,7 @@ var PRESETS = {
|
|
|
24418
24418
|
}
|
|
24419
24419
|
};
|
|
24420
24420
|
|
|
24421
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24421
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
|
|
24422
24422
|
var FIELD_VERSION = 2;
|
|
24423
24423
|
var UNITS = {
|
|
24424
24424
|
"": 1,
|
|
@@ -24879,12 +24879,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
|
|
|
24879
24879
|
return validateFields(parsed3.output);
|
|
24880
24880
|
}, "validateAst");
|
|
24881
24881
|
|
|
24882
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24882
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
|
|
24883
24883
|
var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
|
|
24884
24884
|
var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
|
|
24885
24885
|
var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
|
|
24886
24886
|
|
|
24887
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24887
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
|
|
24888
24888
|
var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
|
|
24889
24889
|
var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
|
|
24890
24890
|
var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
|
|
@@ -24908,7 +24908,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
|
|
|
24908
24908
|
};
|
|
24909
24909
|
}, "linkMatch");
|
|
24910
24910
|
|
|
24911
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24911
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
|
|
24912
24912
|
var SETTING = "phoneCountries";
|
|
24913
24913
|
var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
|
|
24914
24914
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
|
|
@@ -24939,7 +24939,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
|
|
|
24939
24939
|
return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
|
|
24940
24940
|
}, "valueMatch");
|
|
24941
24941
|
|
|
24942
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24942
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
|
|
24943
24943
|
var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
|
|
24944
24944
|
if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
|
|
24945
24945
|
throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
|
|
@@ -24967,7 +24967,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
|
|
|
24967
24967
|
return 2 * intersection2 / (aa2.size + bb.size);
|
|
24968
24968
|
}, "vocabularySimilarity");
|
|
24969
24969
|
|
|
24970
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24970
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
|
|
24971
24971
|
import { createHash } from "node:crypto";
|
|
24972
24972
|
var folded2 = /* @__PURE__ */ __name((name) => {
|
|
24973
24973
|
try {
|
|
@@ -25033,7 +25033,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind4, by, options
|
|
|
25033
25033
|
});
|
|
25034
25034
|
}, "guardTagCreation");
|
|
25035
25035
|
|
|
25036
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25036
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
|
|
25037
25037
|
var invalid2 = /* @__PURE__ */ __name((message2) => {
|
|
25038
25038
|
throw new CliError("validation_error", message2);
|
|
25039
25039
|
}, "invalid");
|
|
@@ -25110,7 +25110,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
|
25110
25110
|
};
|
|
25111
25111
|
}, "createTagRedirectIndex");
|
|
25112
25112
|
|
|
25113
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25113
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
|
|
25114
25114
|
var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
|
|
25115
25115
|
const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
|
|
25116
25116
|
if (!row2)
|
|
@@ -25138,7 +25138,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
|
|
|
25138
25138
|
return snapshot2;
|
|
25139
25139
|
}, "tagRedirectSnapshot");
|
|
25140
25140
|
|
|
25141
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25141
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
|
|
25142
25142
|
import { createHash as createHash2 } from "node:crypto";
|
|
25143
25143
|
var TASK_KEY_PREFIXES = {
|
|
25144
25144
|
question: "Q",
|
|
@@ -25166,7 +25166,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
25166
25166
|
return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
|
|
25167
25167
|
}, "taskAccountOf");
|
|
25168
25168
|
|
|
25169
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25169
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
|
|
25170
25170
|
var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
|
|
25171
25171
|
var REFERABLE = {
|
|
25172
25172
|
note: { tombstone: true },
|
|
@@ -25334,7 +25334,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
25334
25334
|
return row2 ? String(row2.id ?? row2.key) : void 0;
|
|
25335
25335
|
}, "taskIdOf");
|
|
25336
25336
|
|
|
25337
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25337
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
|
|
25338
25338
|
var toMs = /* @__PURE__ */ __name((iso14) => {
|
|
25339
25339
|
if (iso14 === null || iso14 === void 0)
|
|
25340
25340
|
return null;
|
|
@@ -25348,7 +25348,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
|
|
|
25348
25348
|
var DELIVERY = { delivered: 1, read: 2 };
|
|
25349
25349
|
var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
|
|
25350
25350
|
|
|
25351
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25351
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
|
|
25352
25352
|
var TAG_KINDS = ["tag", "topic"];
|
|
25353
25353
|
var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
|
|
25354
25354
|
var TAG_TYPE = {
|
|
@@ -25551,7 +25551,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
|
|
|
25551
25551
|
return result;
|
|
25552
25552
|
}, "tagsOf");
|
|
25553
25553
|
|
|
25554
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25554
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
|
|
25555
25555
|
var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
|
|
25556
25556
|
var SPEECH = speech("att");
|
|
25557
25557
|
var mentionText = /* @__PURE__ */ __name((alias2) => `CASE WHEN coalesce(json_extract(${alias2}.contact, '$.phone'), '') <> '' THEN 'phone: ' || json_extract(${alias2}.contact, '$.phone') ELSE ${alias2}.text END`, "mentionText");
|
|
@@ -25915,7 +25915,7 @@ var FIELD_COMPILERS = {
|
|
|
25915
25915
|
subject
|
|
25916
25916
|
};
|
|
25917
25917
|
|
|
25918
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25918
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
|
|
25919
25919
|
var placeOf = /* @__PURE__ */ __name((database) => {
|
|
25920
25920
|
const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
|
|
25921
25921
|
const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
|
|
@@ -25931,7 +25931,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
|
|
|
25931
25931
|
};
|
|
25932
25932
|
}, "placeOf");
|
|
25933
25933
|
|
|
25934
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25934
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
|
|
25935
25935
|
var DRAIN_ON_WRITE = 500;
|
|
25936
25936
|
var METHOD = "rules";
|
|
25937
25937
|
var telegramLink = /* @__PURE__ */ __name((database) => {
|
|
@@ -26094,7 +26094,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
|
|
|
26094
26094
|
return queued.length;
|
|
26095
26095
|
}, "drainMentions");
|
|
26096
26096
|
|
|
26097
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26097
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
|
|
26098
26098
|
var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
26099
26099
|
const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
|
|
26100
26100
|
if (!exists2)
|
|
@@ -26102,7 +26102,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
|
26102
26102
|
return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
|
|
26103
26103
|
}, "indexRow");
|
|
26104
26104
|
|
|
26105
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26105
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
|
|
26106
26106
|
var INDEX = "message_stems";
|
|
26107
26107
|
var SETTING2 = "searchStemmers";
|
|
26108
26108
|
var DRAIN_ON_WRITE2 = 500;
|
|
@@ -26224,7 +26224,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
|
|
|
26224
26224
|
};
|
|
26225
26225
|
}, "stemmerCache");
|
|
26226
26226
|
|
|
26227
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26227
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
|
|
26228
26228
|
var SQLITE_BUSY = 5;
|
|
26229
26229
|
var pause = new Int32Array(new SharedArrayBuffer(4));
|
|
26230
26230
|
var isBusy = /* @__PURE__ */ __name((error) => {
|
|
@@ -26319,7 +26319,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
|
|
|
26319
26319
|
}
|
|
26320
26320
|
}, "read");
|
|
26321
26321
|
|
|
26322
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26322
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
|
|
26323
26323
|
var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
|
|
26324
26324
|
coalesce(CASE k.chunkable_type
|
|
26325
26325
|
WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
|
|
@@ -26461,7 +26461,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
|
|
|
26461
26461
|
}, "dropUnusedVectors");
|
|
26462
26462
|
var dropAllUnusedVectors = /* @__PURE__ */ __name((database) => database.prepare("DELETE FROM embeddings WHERE NOT EXISTS (SELECT 1 FROM chunks k WHERE k.content_hash = embeddings.content_hash) RETURNING 1").all().length, "dropAllUnusedVectors");
|
|
26463
26463
|
|
|
26464
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26464
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
|
|
26465
26465
|
var accountPk = /* @__PURE__ */ __name(({ orm, now: now2 }, { provider, account, scope: scope3 }, name = null) => Number(orm.insert(accounts).values({ provider, externalId: account, name, scope: scope3 ?? "personal", createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
|
|
26466
26466
|
target: [accounts.provider, accounts.externalId],
|
|
26467
26467
|
set: {
|
|
@@ -26570,7 +26570,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
|
|
|
26570
26570
|
AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
|
|
26571
26571
|
}, "dropOrphanPeople");
|
|
26572
26572
|
|
|
26573
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26573
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
|
|
26574
26574
|
var FOLDED = [
|
|
26575
26575
|
{ table: "tasks", column: "title" },
|
|
26576
26576
|
{ table: "tasks", column: "close_reason" },
|
|
@@ -26607,7 +26607,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
26607
26607
|
return filled2;
|
|
26608
26608
|
}, "fillFolded");
|
|
26609
26609
|
|
|
26610
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26610
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
|
|
26611
26611
|
var HISTORY_KEY = "$history";
|
|
26612
26612
|
var objectOf = /* @__PURE__ */ __name((text6) => {
|
|
26613
26613
|
if (typeof text6 !== "string")
|
|
@@ -26683,7 +26683,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
|
|
|
26683
26683
|
return rest;
|
|
26684
26684
|
}, "withoutHistory");
|
|
26685
26685
|
|
|
26686
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26686
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
|
|
26687
26687
|
import { createHash as createHash3 } from "node:crypto";
|
|
26688
26688
|
var CHUNK_CHARS = 1200;
|
|
26689
26689
|
var CHUNK_OVERLAP = 150;
|
|
@@ -26788,7 +26788,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
|
|
|
26788
26788
|
return chunks2;
|
|
26789
26789
|
}, "cutChunks");
|
|
26790
26790
|
|
|
26791
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26791
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/task-signature.js
|
|
26792
26792
|
var DAY = 864e5;
|
|
26793
26793
|
var CURRENCY = [
|
|
26794
26794
|
[/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
|
|
@@ -26854,15 +26854,15 @@ var dayOf = /* @__PURE__ */ __name((ms) => {
|
|
|
26854
26854
|
const date3 = new Date(ms);
|
|
26855
26855
|
return Math.floor(Date.UTC(date3.getFullYear(), date3.getMonth(), date3.getDate()) / DAY);
|
|
26856
26856
|
}, "dayOf");
|
|
26857
|
-
var dateDay = /* @__PURE__ */ __name((year, month,
|
|
26858
|
-
var monthDate = /* @__PURE__ */ __name((year, word2 = "",
|
|
26857
|
+
var dateDay = /* @__PURE__ */ __name((year, month, day2) => Math.floor(Date.UTC(year, month, day2) / DAY), "dateDay");
|
|
26858
|
+
var monthDate = /* @__PURE__ */ __name((year, word2 = "", day2 = "") => {
|
|
26859
26859
|
const month = monthIndex(word2);
|
|
26860
|
-
return month < 0 || Number(
|
|
26860
|
+
return month < 0 || Number(day2) > 31 ? void 0 : dateDay(year, month, Number(day2));
|
|
26861
26861
|
}, "monthDate");
|
|
26862
|
-
var nthDay = /* @__PURE__ */ __name((
|
|
26862
|
+
var nthDay = /* @__PURE__ */ __name((day2, now2) => {
|
|
26863
26863
|
const date3 = new Date(now2 * DAY);
|
|
26864
|
-
const sameMonth = dateDay(date3.getUTCFullYear(), date3.getUTCMonth(),
|
|
26865
|
-
return sameMonth >= now2 ? sameMonth : dateDay(date3.getUTCFullYear(), date3.getUTCMonth() + 1,
|
|
26864
|
+
const sameMonth = dateDay(date3.getUTCFullYear(), date3.getUTCMonth(), day2);
|
|
26865
|
+
return sameMonth >= now2 ? sameMonth : dateDay(date3.getUTCFullYear(), date3.getUTCMonth() + 1, day2);
|
|
26866
26866
|
}, "nthDay");
|
|
26867
26867
|
var monthEnd = /* @__PURE__ */ __name((now2) => {
|
|
26868
26868
|
const date3 = new Date(now2 * DAY);
|
|
@@ -26870,10 +26870,10 @@ var monthEnd = /* @__PURE__ */ __name((now2) => {
|
|
|
26870
26870
|
}, "monthEnd");
|
|
26871
26871
|
var nextWeekday = /* @__PURE__ */ __name((word2, now2) => {
|
|
26872
26872
|
const target = Math.max(RU_WEEKDAYS.findIndex((stem) => word2.startsWith(stem)), EN_WEEKDAYS.indexOf(word2), ES_WEEKDAYS.indexOf(word2));
|
|
26873
|
-
let
|
|
26874
|
-
while (new Date(
|
|
26875
|
-
|
|
26876
|
-
return
|
|
26873
|
+
let day2 = now2 + 1;
|
|
26874
|
+
while (new Date(day2 * DAY).getUTCDay() !== target)
|
|
26875
|
+
day2++;
|
|
26876
|
+
return day2;
|
|
26877
26877
|
}, "nextWeekday");
|
|
26878
26878
|
var words2 = /* @__PURE__ */ __name((source2) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${source2})(?![\\p{L}\\p{N}])`, "gu"), "words");
|
|
26879
26879
|
var ES_DAY = "(3[01]|[12]\\d|0?[1-9])";
|
|
@@ -26904,17 +26904,17 @@ var dueDayOf = /* @__PURE__ */ __name((text6, createdMs) => {
|
|
|
26904
26904
|
let best;
|
|
26905
26905
|
for (const [pattern, resolve] of DUE_PATTERNS)
|
|
26906
26906
|
for (const match of text6.matchAll(pattern)) {
|
|
26907
|
-
const
|
|
26908
|
-
if (
|
|
26907
|
+
const day2 = resolve(match, now2, year);
|
|
26908
|
+
if (day2 === void 0 || Number.isNaN(day2))
|
|
26909
26909
|
continue;
|
|
26910
26910
|
if (!best || (match.index ?? 0) < best.index)
|
|
26911
|
-
best = { index: match.index ?? 0, day };
|
|
26911
|
+
best = { index: match.index ?? 0, day: day2 };
|
|
26912
26912
|
break;
|
|
26913
26913
|
}
|
|
26914
26914
|
return best?.day ?? null;
|
|
26915
26915
|
}, "dueDayOf");
|
|
26916
26916
|
|
|
26917
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26917
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
|
|
26918
26918
|
var DAY2 = 864e5;
|
|
26919
26919
|
var STOP_WORDS = new Set([
|
|
26920
26920
|
// Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
|
|
@@ -27069,7 +27069,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
|
|
|
27069
27069
|
...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
|
|
27070
27070
|
})).sort((a, b) => b.score - a.score), "rankCandidates");
|
|
27071
27071
|
|
|
27072
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27072
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
|
|
27073
27073
|
var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
|
|
27074
27074
|
r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
|
|
27075
27075
|
JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
|
|
@@ -27340,7 +27340,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
|
|
|
27340
27340
|
};
|
|
27341
27341
|
}, "readiness");
|
|
27342
27342
|
|
|
27343
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27343
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
|
|
27344
27344
|
var DOCUMENT_PICTURE = "document_picture";
|
|
27345
27345
|
var SCAN_PAGE2 = 5e3;
|
|
27346
27346
|
var idOf = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -27403,7 +27403,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
27403
27403
|
}, "nearestPictures")
|
|
27404
27404
|
}), "documentPicturesOver");
|
|
27405
27405
|
|
|
27406
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27406
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
|
|
27407
27407
|
var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
|
|
27408
27408
|
const literal4 = escaped2 ?? plain2 ?? "";
|
|
27409
27409
|
return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
|
|
@@ -27468,7 +27468,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
|
|
|
27468
27468
|
var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
|
|
27469
27469
|
var bound2 = /* @__PURE__ */ __name(({ sql: text6, params }) => sql.join(text6.split("?").map((part, at) => at < params.length ? sql`${sql.raw(part)}${params[at]}` : sql.raw(part)), sql``), "bound");
|
|
27470
27470
|
|
|
27471
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27471
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
|
|
27472
27472
|
var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
|
|
27473
27473
|
var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
|
|
27474
27474
|
var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
|
|
@@ -27558,7 +27558,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
|
|
|
27558
27558
|
});
|
|
27559
27559
|
}, "linkMeeting");
|
|
27560
27560
|
|
|
27561
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27561
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
|
|
27562
27562
|
var EVENT_TEXT = "trim(coalesce(e.description, '') || ' ' || coalesce(e.location, '') || ' ' || coalesce((SELECT group_concat(p.name, ' ') FROM calendar_entries ce JOIN calendar_entry_participants p ON p.entry_id = ce.id WHERE ce.event_id = e.id AND ce.deleted_at IS NULL AND p.resource = 0 AND p.name IS NOT NULL), ''))";
|
|
27563
27563
|
var UNSEARCHED_EVENT_TYPES = [
|
|
27564
27564
|
"working-location",
|
|
@@ -27788,7 +27788,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
|
|
|
27788
27788
|
return true;
|
|
27789
27789
|
}, "resetNoteIndex");
|
|
27790
27790
|
|
|
27791
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27791
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
|
|
27792
27792
|
var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
|
|
27793
27793
|
var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
27794
27794
|
for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
|
|
@@ -27807,7 +27807,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
|
27807
27807
|
}
|
|
27808
27808
|
}, "resolvePersonLinks");
|
|
27809
27809
|
|
|
27810
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27810
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
|
|
27811
27811
|
var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
|
|
27812
27812
|
var prepare = /* @__PURE__ */ __name((orm) => ({
|
|
27813
27813
|
find: orm.select({
|
|
@@ -28032,7 +28032,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
|
|
|
28032
28032
|
}, "meetingIdentityPk");
|
|
28033
28033
|
var phoneOf = /* @__PURE__ */ __name(({ orm }, provider, nativeId) => orm.select({ phone: identities.phone }).from(identities).where(and(eq(identities.provider, provider), eq(identities.externalId, nativeId))).get()?.phone ?? null, "phoneOf");
|
|
28034
28034
|
|
|
28035
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28035
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
|
|
28036
28036
|
var chatOf = /* @__PURE__ */ __name(({ orm }, accountKey, chatKey) => orm.select({ id: chats.externalId }).from(chats).where(and(eq(chats.id, chatKey), eq(chats.accountId, accountKey))).get()?.id, "chatOf");
|
|
28037
28037
|
var findChatPk = /* @__PURE__ */ __name(({ orm }, accountKey, chatId) => orm.select({ pk: chats.id }).from(chats).where(and(eq(chats.accountId, accountKey), eq(chats.externalId, chatId))).get()?.pk, "findChatPk");
|
|
28038
28038
|
var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
|
|
@@ -28312,7 +28312,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
|
|
|
28312
28312
|
}
|
|
28313
28313
|
}, "replaceAutoTags");
|
|
28314
28314
|
|
|
28315
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28315
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/counters.js
|
|
28316
28316
|
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
28317
28317
|
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
28318
28318
|
var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
|
|
@@ -28331,7 +28331,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
|
28331
28331
|
return states.some((one2) => one2.freshness === "stale") ? "stale" : "fresh";
|
|
28332
28332
|
}, "counterFreshness");
|
|
28333
28333
|
|
|
28334
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28334
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/context/evidence.js
|
|
28335
28335
|
import { createHash as createHash4 } from "node:crypto";
|
|
28336
28336
|
var CONTEXT_MAX_READ_BYTES = 262144;
|
|
28337
28337
|
var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
|
|
@@ -28429,7 +28429,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
|
|
|
28429
28429
|
return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
|
|
28430
28430
|
}, "contextEvidenceRequest");
|
|
28431
28431
|
|
|
28432
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28432
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
|
|
28433
28433
|
var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
|
|
28434
28434
|
var ACTIVITY = `
|
|
28435
28435
|
SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
|
|
@@ -28504,6 +28504,14 @@ var emailMarks = /* @__PURE__ */ __name((database, accountId, externalIds) => {
|
|
|
28504
28504
|
}
|
|
28505
28505
|
return marks;
|
|
28506
28506
|
}, "emailMarks");
|
|
28507
|
+
var writtenTo = /* @__PURE__ */ __name((database, addresses) => {
|
|
28508
|
+
if (addresses.length === 0)
|
|
28509
|
+
return /* @__PURE__ */ new Set();
|
|
28510
|
+
const rows = database.prepare(`SELECT DISTINCT lower(r.address) AS address FROM emails e JOIN email_recipients r ON r.email_id = e.id
|
|
28511
|
+
WHERE e.outgoing = 1 AND e.deleted_at IS NULL AND r.role IN ('to', 'cc')
|
|
28512
|
+
AND lower(r.address) IN (SELECT value FROM json_each(?))`).all(JSON.stringify(addresses.map((address) => address.toLowerCase())));
|
|
28513
|
+
return new Set(rows.map((row2) => String(row2.address)));
|
|
28514
|
+
}, "writtenTo");
|
|
28507
28515
|
var MARKED = `
|
|
28508
28516
|
SELECT e.id, e.external_id, t.external_id AS thread, coalesce(e.received_at, e.sent_at) AS at, e.created_at,
|
|
28509
28517
|
e.updated_at, coalesce(e.draft, 0) AS draft, json_extract(e.metadata, '$.partial') IS NOT NULL AS partial,
|
|
@@ -28543,10 +28551,11 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
|
|
|
28543
28551
|
newestEmailId: /* @__PURE__ */ __name(async (accountId) => Number(database.prepare("SELECT max(id) AS id FROM emails WHERE account_id = ?").get(accountId)?.id ?? 0), "newestEmailId"),
|
|
28544
28552
|
statesLike: /* @__PURE__ */ __name(async (accountId, prefix) => database.prepare("SELECT key, value, updated_at FROM sync_cursors WHERE account_id = ? AND substr(key, 1, ?) = ?").all(accountId, prefix.length, prefix).map((row2) => ({ key: String(row2.key), value: String(row2.value), at: Number(row2.updated_at) })), "statesLike"),
|
|
28545
28553
|
emailMarks: /* @__PURE__ */ __name(async (accountId, externalIds) => emailMarks(database, accountId, externalIds), "emailMarks"),
|
|
28554
|
+
writtenTo: /* @__PURE__ */ __name(async (addresses) => writtenTo(database, addresses), "writtenTo"),
|
|
28546
28555
|
threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
|
|
28547
28556
|
}), "mailActivity");
|
|
28548
28557
|
|
|
28549
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28558
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
|
|
28550
28559
|
var GREETING = new RegExp("^(hi|hello|hey|dear|greetings|good (morning|afternoon|evening)|\u043F\u0440\u0438\u0432\u0435\u0442|\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439(\u0442\u0435)?|\u0434\u043E\u0431\u0440(\u044B\u0439|\u043E\u0435|\u043E\u0433\u043E) (\u0434\u0435\u043D\u044C|\u0432\u0435\u0447\u0435\u0440|\u0443\u0442\u0440\u043E|\u0443\u0442\u0440\u0430|\u0434\u043D\u044F)|hola|buen(os|as) (d\xEDas|dias|tardes|noches)|estimad[oa]s?|querid[oa]s?)(?![\\p{L}\\p{N}])([\\s,]+\\p{L}[\\p{L}.'\u2019-]*){0,3}\\s*[,!.:]?$", "iu");
|
|
28551
28560
|
var SIGN_OFF = /^(best|best regards|best wishes|kind regards|warm regards|regards|thanks|thanks again|thanks a lot|thank you|many thanks|cheers|sincerely|yours|yours truly|yours sincerely|br|с уважением|спасибо|заранее спасибо|всего доброго|всего хорошего|un saludo|saludos|saludos cordiales|atentamente|gracias|muchas gracias)[\s,.!]*$/iu;
|
|
28552
28561
|
var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
|
|
@@ -28687,7 +28696,7 @@ var mailOwnText = /* @__PURE__ */ __name((body2) => {
|
|
|
28687
28696
|
return text6 || body2.trim();
|
|
28688
28697
|
}, "mailOwnText");
|
|
28689
28698
|
|
|
28690
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28699
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
|
|
28691
28700
|
var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
|
|
28692
28701
|
var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
|
|
28693
28702
|
k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
|
|
@@ -28797,7 +28806,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
|
|
|
28797
28806
|
return emails3 + threads;
|
|
28798
28807
|
}, "drainEmailIndex");
|
|
28799
28808
|
|
|
28800
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28809
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
|
|
28801
28810
|
var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
|
|
28802
28811
|
SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
|
|
28803
28812
|
var folderEmails = /* @__PURE__ */ __name((database, accountId, folder, uidvalidity) => database.prepare(`SELECT l.uid, e.external_id, coalesce(e.received_at, e.sent_at) AS at, e.read, e.flagged,
|
|
@@ -28895,7 +28904,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
|
|
|
28895
28904
|
var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
|
|
28896
28905
|
SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
|
|
28897
28906
|
|
|
28898
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28907
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
|
|
28899
28908
|
var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
|
|
28900
28909
|
emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
|
|
28901
28910
|
last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
|
|
@@ -28945,7 +28954,67 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
|
|
|
28945
28954
|
return threads.length;
|
|
28946
28955
|
}, "markEmailsRestored");
|
|
28947
28956
|
|
|
28948
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28957
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
|
|
28958
|
+
var MAIL_PIECE_ROWS = `SELECT p.id, p.content_hash AS hash, p.type, p.owner, p.position, p.email_id AS email, v.vector
|
|
28959
|
+
FROM ${MAIL_PIECES} JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
|
|
28960
|
+
WHERE p.account_id = ?
|
|
28961
|
+
AND (? IS NULL OR p.thread_id IN (SELECT id FROM email_threads WHERE account_id = p.account_id AND external_id = ?))
|
|
28962
|
+
AND (? IS NULL OR p.occurred_at >= ?)`;
|
|
28963
|
+
var pieceKey = /* @__PURE__ */ __name((row2) => row2.type === "email_thread" ? `${row2.owner}:${row2.position}` : `email:${row2.email}`, "pieceKey");
|
|
28964
|
+
var filterParams = /* @__PURE__ */ __name((model, { accountId, threadExternalId, since }) => [
|
|
28965
|
+
model,
|
|
28966
|
+
accountId,
|
|
28967
|
+
threadExternalId ?? null,
|
|
28968
|
+
threadExternalId ?? null,
|
|
28969
|
+
since ?? null,
|
|
28970
|
+
since ?? null
|
|
28971
|
+
], "filterParams");
|
|
28972
|
+
var byScore = /* @__PURE__ */ __name((best) => [...best.entries()].map(([key2, { score }]) => [key2, score]).sort(([, a], [, b]) => b - a), "byScore");
|
|
28973
|
+
var scannedMailPieces = /* @__PURE__ */ __name((database, model, query, filter) => {
|
|
28974
|
+
const page3 = database.prepare(`${MAIL_PIECE_ROWS} AND p.id > ? ORDER BY p.id LIMIT 500`);
|
|
28975
|
+
const best = /* @__PURE__ */ new Map();
|
|
28976
|
+
for (let after2 = 0; ; ) {
|
|
28977
|
+
const rows = page3.all(...filterParams(model, filter), after2);
|
|
28978
|
+
for (const row2 of rows) {
|
|
28979
|
+
const score = dot(query, row2.vector);
|
|
28980
|
+
const key2 = pieceKey(row2);
|
|
28981
|
+
if (score > (best.get(key2)?.score ?? Number.NEGATIVE_INFINITY))
|
|
28982
|
+
best.set(key2, { score });
|
|
28983
|
+
}
|
|
28984
|
+
if (rows.length < 500)
|
|
28985
|
+
break;
|
|
28986
|
+
after2 = Number(rows.at(-1)?.id);
|
|
28987
|
+
}
|
|
28988
|
+
return byScore(best);
|
|
28989
|
+
}, "scannedMailPieces");
|
|
28990
|
+
var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter, depth) => {
|
|
28991
|
+
const candidates = database.prepare(`${MAIL_PIECE_ROWS} AND p.id IN (SELECT value FROM json_each(?)) ORDER BY p.id`);
|
|
28992
|
+
const merged = /* @__PURE__ */ new Map();
|
|
28993
|
+
for (const kind4 of ["email_thread", "attachment"]) {
|
|
28994
|
+
const found2 = searchIndex(database, model, { kind: kind4, account: filter.accountId, ...filter.since === void 0 ? {} : { since: filter.since } }, query, depth, (near2) => {
|
|
28995
|
+
const hashes = new Map(near2.map(({ id: id2, hash: hash2 }) => [id2, hash2]));
|
|
28996
|
+
const best = /* @__PURE__ */ new Map();
|
|
28997
|
+
for (const row2 of candidates.all(...filterParams(model, filter), JSON.stringify([...hashes.keys()]))) {
|
|
28998
|
+
if (hashes.get(Number(row2.id)) !== row2.hash)
|
|
28999
|
+
continue;
|
|
29000
|
+
const score = dot(query, row2.vector);
|
|
29001
|
+
const key2 = pieceKey(row2);
|
|
29002
|
+
if (score > (best.get(key2)?.score ?? Number.NEGATIVE_INFINITY))
|
|
29003
|
+
best.set(key2, { score, chunk: Number(row2.id) });
|
|
29004
|
+
}
|
|
29005
|
+
const results = byScore(best).slice(0, depth).map(([key2]) => [key2, best.get(key2)]);
|
|
29006
|
+
return { results, best: results.map(([, { chunk }]) => chunk) };
|
|
29007
|
+
});
|
|
29008
|
+
if (!found2)
|
|
29009
|
+
return void 0;
|
|
29010
|
+
for (const [key2, held] of found2)
|
|
29011
|
+
merged.set(key2, held);
|
|
29012
|
+
}
|
|
29013
|
+
return byScore(merged);
|
|
29014
|
+
}, "indexedMailPieces");
|
|
29015
|
+
var nearestMailPieces = /* @__PURE__ */ __name((database, model, query, filter, depth) => (filter.threadExternalId === void 0 ? indexedMailPieces(database, model, query, filter, depth) : void 0) ?? scannedMailPieces(database, model, query, filter), "nearestMailPieces");
|
|
29016
|
+
|
|
29017
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
|
|
28949
29018
|
var sorted = /* @__PURE__ */ __name((value) => Array.isArray(value) ? value.map(sorted) : value !== null && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map((key2) => [key2, sorted(value[key2])])) : value, "sorted");
|
|
28950
29019
|
var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
|
|
28951
29020
|
var ruleOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -29012,7 +29081,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
|
|
|
29012
29081
|
}
|
|
29013
29082
|
}), "mailRulesOver");
|
|
29014
29083
|
|
|
29015
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29084
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
|
|
29016
29085
|
var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
|
|
29017
29086
|
database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
|
|
29018
29087
|
VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
|
|
@@ -29020,7 +29089,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
|
|
|
29020
29089
|
reason = excluded.reason, updated_at = excluded.updated_at WHERE link_reviews.status = 'open'`).run(linkable.type, linkable.id, entity, JSON.stringify([...candidates].sort((a, b) => a - b)), reason, now2, now2);
|
|
29021
29090
|
}, "reviewLink");
|
|
29022
29091
|
|
|
29023
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29092
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
|
|
29024
29093
|
function checkMeetingCancelled(signal) {
|
|
29025
29094
|
if (!signal?.aborted)
|
|
29026
29095
|
return;
|
|
@@ -29031,7 +29100,7 @@ function checkMeetingCancelled(signal) {
|
|
|
29031
29100
|
}
|
|
29032
29101
|
__name(checkMeetingCancelled, "checkMeetingCancelled");
|
|
29033
29102
|
|
|
29034
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29103
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
|
|
29035
29104
|
var meetingOf = /* @__PURE__ */ __name((row2) => ({
|
|
29036
29105
|
id: Number(row2.id),
|
|
29037
29106
|
accountId: Number(row2.account_id),
|
|
@@ -29081,7 +29150,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
29081
29150
|
createdAt: Number(row2.created_at)
|
|
29082
29151
|
}), "transcriptRowOf");
|
|
29083
29152
|
|
|
29084
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
|
|
29085
29154
|
var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
|
|
29086
29155
|
var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
|
|
29087
29156
|
var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
|
|
@@ -29248,7 +29317,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
29248
29317
|
}
|
|
29249
29318
|
}), "meetingReadsOver");
|
|
29250
29319
|
|
|
29251
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29320
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
|
|
29252
29321
|
var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
29253
29322
|
const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
|
|
29254
29323
|
const params = [input.accountId];
|
|
@@ -29291,7 +29360,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
|
29291
29360
|
return { clauses, params };
|
|
29292
29361
|
}, "meetingSelectionSql");
|
|
29293
29362
|
|
|
29294
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29363
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
|
|
29295
29364
|
var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
29296
29365
|
async meetingChatLines(input) {
|
|
29297
29366
|
checkMeetingCancelled(input.signal);
|
|
@@ -29319,7 +29388,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
29319
29388
|
}
|
|
29320
29389
|
}), "meetingChatLinesOver");
|
|
29321
29390
|
|
|
29322
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29391
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
|
|
29323
29392
|
var MESSAGE_FIELDS = {
|
|
29324
29393
|
pk: messages.id,
|
|
29325
29394
|
nativeId: messages.externalId,
|
|
@@ -29490,7 +29559,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
|
|
|
29490
29559
|
storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
|
|
29491
29560
|
}), "chatActivity");
|
|
29492
29561
|
|
|
29493
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29562
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
|
|
29494
29563
|
var HIT_FIELDS = {
|
|
29495
29564
|
...MESSAGE_FIELDS,
|
|
29496
29565
|
chatTitle: sql`${chats.title}`.as("chat_title"),
|
|
@@ -29589,7 +29658,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
|
|
|
29589
29658
|
};
|
|
29590
29659
|
}, "directReplies");
|
|
29591
29660
|
|
|
29592
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29661
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
|
|
29593
29662
|
var identityRow = /* @__PURE__ */ __name(({ orm }, { provider, id: id2 }) => orm.select({ pk: identities.id, personPk: identityLinks.personId }).from(identities).innerJoin(identityLinks, eq(identityLinks.identityId, identities.id)).where(and(eq(identities.provider, provider), eq(identities.externalId, id2))).get(), "identityRow");
|
|
29594
29663
|
var required = /* @__PURE__ */ __name((context, ref3) => {
|
|
29595
29664
|
const found2 = identityRow(context, ref3);
|
|
@@ -29720,7 +29789,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
|
|
|
29720
29789
|
}, "mentioning");
|
|
29721
29790
|
var escaped = /* @__PURE__ */ __name((text6) => text6.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
29722
29791
|
|
|
29723
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29792
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
|
|
29724
29793
|
var missing2 = /* @__PURE__ */ __name(() => {
|
|
29725
29794
|
throw new CliError("not_found", "Meeting, participant or selected target not found");
|
|
29726
29795
|
}, "missing");
|
|
@@ -29842,7 +29911,7 @@ function meetingContextLinksOver(context) {
|
|
|
29842
29911
|
}
|
|
29843
29912
|
__name(meetingContextLinksOver, "meetingContextLinksOver");
|
|
29844
29913
|
|
|
29845
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29914
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
|
|
29846
29915
|
var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
|
|
29847
29916
|
var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
|
|
29848
29917
|
var summaryOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -29871,7 +29940,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
29871
29940
|
return row2 ? summaryText(summaryOf(row2)) : null;
|
|
29872
29941
|
}, "indexedText");
|
|
29873
29942
|
|
|
29874
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29943
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
|
|
29875
29944
|
var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
|
|
29876
29945
|
var meetingCurrentIndexRows = `
|
|
29877
29946
|
SELECT 'meeting_transcript_row' AS indexable_type,r.id,r.id*4+1 AS rid,1 AS live,coalesce(length(CAST(r.text AS BLOB)),0) AS bytes FROM meeting_transcript_rows r JOIN meeting_transcripts t ON t.id=r.meeting_transcript_id JOIN meetings m ON m.id=t.meeting_id WHERE m.account_id=? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL
|
|
@@ -29902,7 +29971,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
29902
29971
|
}, "invalidateMeetingStems");
|
|
29903
29972
|
var meetingStemmableText = /* @__PURE__ */ __name((text6) => text6.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
|
|
29904
29973
|
|
|
29905
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29974
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
|
|
29906
29975
|
function meetingHitIndexOver({ database, now: now2 }) {
|
|
29907
29976
|
return {
|
|
29908
29977
|
async indexSearch(original) {
|
|
@@ -29970,10 +30039,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
|
|
|
29970
30039
|
}
|
|
29971
30040
|
__name(meetingHitIndexOver, "meetingHitIndexOver");
|
|
29972
30041
|
|
|
29973
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30042
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
29974
30043
|
import { createHash as createHash5 } from "node:crypto";
|
|
29975
30044
|
|
|
29976
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30045
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
29977
30046
|
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
29978
30047
|
const padded = ` ${term} `;
|
|
29979
30048
|
const pieces = /* @__PURE__ */ new Set();
|
|
@@ -29982,7 +30051,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
|
|
|
29982
30051
|
return [...pieces];
|
|
29983
30052
|
}, "trigrams");
|
|
29984
30053
|
|
|
29985
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30054
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/correct.js
|
|
29986
30055
|
var SHORTEST_CORRECTION = 3;
|
|
29987
30056
|
var maxEdits = /* @__PURE__ */ __name((word2) => word2.length <= 4 ? 1 : 2, "maxEdits");
|
|
29988
30057
|
var editDistance = /* @__PURE__ */ __name((a, b, max) => {
|
|
@@ -30029,7 +30098,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
|
|
|
30029
30098
|
return corrections;
|
|
30030
30099
|
}, "correctWords");
|
|
30031
30100
|
|
|
30032
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30101
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/garbled.js
|
|
30033
30102
|
var SHORTEST_GARBLED = 4;
|
|
30034
30103
|
var MOST_WIDENED = 64;
|
|
30035
30104
|
var plain = /* @__PURE__ */ __name((word2) => word2.replaceAll("\u044D", "\u0435"), "plain");
|
|
@@ -30121,7 +30190,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
|
|
|
30121
30190
|
return found2.map((words3) => words3.sort((a, b) => a.distance - b.distance || b.docs - a.docs || a.term.localeCompare(b.term)).slice(0, MOST_WIDENED).map((word2) => word2.term));
|
|
30122
30191
|
}, "widenWords");
|
|
30123
30192
|
|
|
30124
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30193
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
|
|
30125
30194
|
import { readFileSync } from "node:fs";
|
|
30126
30195
|
var loaded;
|
|
30127
30196
|
var dictionary = /* @__PURE__ */ __name(() => {
|
|
@@ -30180,7 +30249,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word2) => {
|
|
|
30180
30249
|
return false;
|
|
30181
30250
|
}, "knownRussianWord");
|
|
30182
30251
|
|
|
30183
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30252
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
|
|
30184
30253
|
var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
|
|
30185
30254
|
var MOST_WORDS = 128;
|
|
30186
30255
|
var quote = /* @__PURE__ */ __name((word2) => `"${word2.replaceAll('"', '""')}"`, "quote");
|
|
@@ -30407,7 +30476,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text6, stemmer) => {
|
|
|
30407
30476
|
return check3(tree);
|
|
30408
30477
|
}, "matchMeetingText");
|
|
30409
30478
|
|
|
30410
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30479
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
30411
30480
|
var fail3 = /* @__PURE__ */ __name((message2) => {
|
|
30412
30481
|
throw new CliError("validation_error", message2);
|
|
30413
30482
|
}, "fail");
|
|
@@ -30589,7 +30658,7 @@ function meetingHitSearchOver({ database }) {
|
|
|
30589
30658
|
}
|
|
30590
30659
|
__name(meetingHitSearchOver, "meetingHitSearchOver");
|
|
30591
30660
|
|
|
30592
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30661
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
|
|
30593
30662
|
var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
30594
30663
|
async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
|
|
30595
30664
|
positiveReadInteger(accountId, "accountId");
|
|
@@ -30621,7 +30690,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
30621
30690
|
}
|
|
30622
30691
|
}), "meetingLanguagesOver");
|
|
30623
30692
|
|
|
30624
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30693
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
|
|
30625
30694
|
import { createHash as createHash6 } from "node:crypto";
|
|
30626
30695
|
var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
|
|
30627
30696
|
if (value === void 0)
|
|
@@ -30711,7 +30780,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
|
|
|
30711
30780
|
}
|
|
30712
30781
|
}), "meetingParticipantSearchOver");
|
|
30713
30782
|
|
|
30714
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30783
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
|
|
30715
30784
|
var preparationQueries = {
|
|
30716
30785
|
participants: {
|
|
30717
30786
|
fields: "p.id, p.identity_id, p.display_name, l.person_id",
|
|
@@ -30761,7 +30830,7 @@ var preparationQueries = {
|
|
|
30761
30830
|
}
|
|
30762
30831
|
};
|
|
30763
30832
|
|
|
30764
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30833
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
|
|
30765
30834
|
var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
30766
30835
|
async preparationContext(original) {
|
|
30767
30836
|
const input = validateMeetingPreparationContext(original);
|
|
@@ -30802,7 +30871,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
30802
30871
|
}
|
|
30803
30872
|
}), "meetingPreparationContextOver");
|
|
30804
30873
|
|
|
30805
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30874
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
|
|
30806
30875
|
var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
30807
30876
|
SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
|
|
30808
30877
|
WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
|
|
@@ -30816,7 +30885,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
|
30816
30885
|
JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
|
|
30817
30886
|
)`, "preparationSubjects");
|
|
30818
30887
|
|
|
30819
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30888
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
|
|
30820
30889
|
var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
30821
30890
|
async preparationKnowledge(original) {
|
|
30822
30891
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -30861,7 +30930,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
|
|
|
30861
30930
|
}
|
|
30862
30931
|
}), "meetingPreparationKnowledgeOver");
|
|
30863
30932
|
|
|
30864
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30933
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
|
|
30865
30934
|
var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
30866
30935
|
async preparationNotes(original) {
|
|
30867
30936
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -30914,7 +30983,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
30914
30983
|
}
|
|
30915
30984
|
}), "meetingPreparationNotesOver");
|
|
30916
30985
|
|
|
30917
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30986
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
|
|
30918
30987
|
var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
30919
30988
|
async relatedHistory(original) {
|
|
30920
30989
|
const input = validateMeetingRelatedHistory(original);
|
|
@@ -30985,7 +31054,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
30985
31054
|
}
|
|
30986
31055
|
}), "meetingRelatedHistoryOver");
|
|
30987
31056
|
|
|
30988
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31057
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
|
|
30989
31058
|
var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
|
|
30990
31059
|
var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
|
|
30991
31060
|
var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
@@ -31066,7 +31135,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
31066
31135
|
}
|
|
31067
31136
|
}), "meetingReviewOver");
|
|
31068
31137
|
|
|
31069
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31138
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
|
|
31070
31139
|
var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
|
|
31071
31140
|
var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
|
|
31072
31141
|
if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
|
|
@@ -31120,7 +31189,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
31120
31189
|
}
|
|
31121
31190
|
}), "meetingSeriesHistoryOver");
|
|
31122
31191
|
|
|
31123
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31192
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
|
|
31124
31193
|
var MOST_ROWS = 5e5;
|
|
31125
31194
|
var meetingCountsSql = /* @__PURE__ */ __name((where) => `SELECT m.started_at, coalesce(m.duration_ms, m.ended_at - m.started_at) AS duration_ms,
|
|
31126
31195
|
EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
|
|
@@ -31189,7 +31258,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
31189
31258
|
}
|
|
31190
31259
|
}), "meetingStatsOver");
|
|
31191
31260
|
|
|
31192
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31261
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
|
|
31193
31262
|
var CURSOR_KEY = "meetings";
|
|
31194
31263
|
var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
31195
31264
|
id: Number(row2.id),
|
|
@@ -31758,7 +31827,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31758
31827
|
};
|
|
31759
31828
|
}, "meetingStoreOver");
|
|
31760
31829
|
|
|
31761
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31830
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
|
|
31762
31831
|
var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
31763
31832
|
const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
|
|
31764
31833
|
return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
|
|
@@ -31784,7 +31853,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
|
|
|
31784
31853
|
orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
|
|
31785
31854
|
}, "release");
|
|
31786
31855
|
|
|
31787
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31856
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
|
|
31788
31857
|
var THREAD_COLUMNS = {
|
|
31789
31858
|
subject: {
|
|
31790
31859
|
where: /* @__PURE__ */ __name(({ value }) => ({
|
|
@@ -31801,7 +31870,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
|
|
|
31801
31870
|
AND (${filter.where?.sql ?? "1"}) ORDER BY coalesce(last_email_at, 0) DESC, id DESC LIMIT ? OFFSET ?`).all(filter.accountId ?? null, filter.accountId ?? null, filter.includeDeleted ? 1 : 0, ...filter.where?.params ?? [], limit, offset);
|
|
31802
31871
|
}, "threadRows");
|
|
31803
31872
|
|
|
31804
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31873
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
|
|
31805
31874
|
var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
|
|
31806
31875
|
id: `email:${place.emailId}`,
|
|
31807
31876
|
chatId: place.threadExternalId,
|
|
@@ -32289,28 +32358,10 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
|
|
|
32289
32358
|
},
|
|
32290
32359
|
async nearest(model, query, { accountId, limit, threadExternalId, since }) {
|
|
32291
32360
|
drainEmailIndex(database, stemmerFor2);
|
|
32292
|
-
const
|
|
32293
|
-
JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
|
|
32294
|
-
WHERE p.id > ? AND p.account_id = ?
|
|
32295
|
-
AND (? IS NULL OR p.thread_id IN (SELECT id FROM email_threads WHERE account_id = p.account_id AND external_id = ?))
|
|
32296
|
-
AND (? IS NULL OR p.occurred_at >= ?)
|
|
32297
|
-
ORDER BY p.id LIMIT 500`);
|
|
32298
|
-
const best = /* @__PURE__ */ new Map();
|
|
32299
|
-
for (let after2 = 0; ; ) {
|
|
32300
|
-
const rows = page3.all(model, after2, accountId, threadExternalId ?? null, threadExternalId ?? null, since ?? null, since ?? null);
|
|
32301
|
-
for (const row2 of rows) {
|
|
32302
|
-
const score = dot(query, row2.vector);
|
|
32303
|
-
const key2 = row2.type === "email_thread" ? `${row2.owner}:${row2.position}` : `email:${row2.email}`;
|
|
32304
|
-
if (score > (best.get(key2) ?? Number.NEGATIVE_INFINITY))
|
|
32305
|
-
best.set(key2, score);
|
|
32306
|
-
}
|
|
32307
|
-
if (rows.length < 500)
|
|
32308
|
-
break;
|
|
32309
|
-
after2 = Number(rows.at(-1)?.id);
|
|
32310
|
-
}
|
|
32361
|
+
const best = nearestMailPieces(database, model, query, { accountId, threadExternalId, since }, limit * 2);
|
|
32311
32362
|
const threads = /* @__PURE__ */ new Map();
|
|
32312
32363
|
const emails3 = /* @__PURE__ */ new Map();
|
|
32313
|
-
for (const [key2, score] of
|
|
32364
|
+
for (const [key2, score] of best) {
|
|
32314
32365
|
if (emails3.size >= limit)
|
|
32315
32366
|
break;
|
|
32316
32367
|
const [owner, position2] = key2.split(":");
|
|
@@ -32357,7 +32408,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
|
|
|
32357
32408
|
}
|
|
32358
32409
|
}), "mailStoreOver");
|
|
32359
32410
|
|
|
32360
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32411
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/search/dictionary.js
|
|
32361
32412
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
32362
32413
|
var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
|
|
32363
32414
|
var folded4 = /* @__PURE__ */ __name((word2) => /^[а-яё'-]*$/.test(word2) ? word2.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word2), "folded");
|
|
@@ -32447,7 +32498,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
|
|
|
32447
32498
|
}, "knownWord");
|
|
32448
32499
|
var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
|
|
32449
32500
|
|
|
32450
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32501
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
|
|
32451
32502
|
var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
|
|
32452
32503
|
var readsTranscripts = /* @__PURE__ */ __name((node) => (node.operator === "term" || node.operator === "phrase") && /[\p{L}\p{N}]/u.test(normalize(node.value)) && (node.field === "transcript" || node.implicit === true && (node.field === "text" || node.field === "exact")), "readsTranscripts");
|
|
32453
32504
|
var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
|
|
@@ -32533,7 +32584,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
|
|
|
32533
32584
|
return found2;
|
|
32534
32585
|
}, "spokenTranscripts");
|
|
32535
32586
|
|
|
32536
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32587
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
|
|
32537
32588
|
var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
|
|
32538
32589
|
const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
|
|
32539
32590
|
if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
|
|
@@ -32580,7 +32631,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
|
|
|
32580
32631
|
});
|
|
32581
32632
|
}, "placeHits");
|
|
32582
32633
|
|
|
32583
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32634
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
|
|
32584
32635
|
var GROUPS = {
|
|
32585
32636
|
chat: {
|
|
32586
32637
|
key: "m.chat_id",
|
|
@@ -32602,7 +32653,7 @@ var GROUPS = {
|
|
|
32602
32653
|
}
|
|
32603
32654
|
};
|
|
32604
32655
|
|
|
32605
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32656
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
|
|
32606
32657
|
var MESSAGES2 = {
|
|
32607
32658
|
rows: "messages",
|
|
32608
32659
|
threads: "chats",
|
|
@@ -33085,7 +33136,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
|
|
|
33085
33136
|
};
|
|
33086
33137
|
}, "runCompiled");
|
|
33087
33138
|
|
|
33088
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33139
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
|
|
33089
33140
|
function invalidMetadata() {
|
|
33090
33141
|
throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
|
|
33091
33142
|
}
|
|
@@ -33187,7 +33238,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
|
|
|
33187
33238
|
};
|
|
33188
33239
|
}), "counterTargets");
|
|
33189
33240
|
|
|
33190
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33241
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
|
|
33191
33242
|
var NOT_FILE_LIST = [...NOT_FILES].map((kind4) => `'${kind4}'`).join(",");
|
|
33192
33243
|
var fileAttachments = /* @__PURE__ */ __name(({ database }, accountKey, { chatKey, messageId, beforePk, limit }) => database.prepare(`SELECT att.id AS pk, c.external_id AS chat_id, m.external_id AS message_id, att.position, att.kind, att.name, att.mime,
|
|
33193
33244
|
att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
|
|
@@ -33306,7 +33357,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
|
|
|
33306
33357
|
}));
|
|
33307
33358
|
}, "attachmentViews");
|
|
33308
33359
|
|
|
33309
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33360
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
|
|
33310
33361
|
var transcript = /* @__PURE__ */ __name(({ orm }, chatKey, messageId) => orm.select({ text: messageTranscripts.text, source: messageTranscripts.source }).from(messageTranscripts).where(and(eq(messageTranscripts.chatId, chatKey), eq(messageTranscripts.messageExternalId, messageId))).get(), "transcript");
|
|
33311
33362
|
var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text6, source2) => {
|
|
33312
33363
|
const { orm, database, now: now2 } = context;
|
|
@@ -33344,7 +33395,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
|
|
|
33344
33395
|
keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
|
|
33345
33396
|
}, "intoVoiceAttachment");
|
|
33346
33397
|
|
|
33347
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33398
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
|
|
33348
33399
|
var FIELDS = [
|
|
33349
33400
|
"threadExternalId",
|
|
33350
33401
|
"senderIdentityId",
|
|
@@ -33661,7 +33712,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
|
|
|
33661
33712
|
reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
|
|
33662
33713
|
}, "writeDerivedReactions");
|
|
33663
33714
|
|
|
33664
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33715
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/keys.js
|
|
33665
33716
|
var keysOver = /* @__PURE__ */ __name((context) => {
|
|
33666
33717
|
const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
|
|
33667
33718
|
const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
|
|
@@ -33682,7 +33733,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
|
|
|
33682
33733
|
};
|
|
33683
33734
|
}, "keysOver");
|
|
33684
33735
|
|
|
33685
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33736
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
|
|
33686
33737
|
var accountGroupsOf = /* @__PURE__ */ __name((database) => {
|
|
33687
33738
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
|
|
33688
33739
|
if (!row2)
|
|
@@ -33717,7 +33768,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
|
|
|
33717
33768
|
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
|
|
33718
33769
|
}, "saveProfile");
|
|
33719
33770
|
|
|
33720
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33771
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
|
|
33721
33772
|
var BOT_KINDS = ["agent", "rule", "script", "integration"];
|
|
33722
33773
|
var ownerPerson = /* @__PURE__ */ __name((database) => {
|
|
33723
33774
|
const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
|
|
@@ -33774,7 +33825,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
|
|
|
33774
33825
|
return { sql: bot("pb.name = ?"), params: [by.bot] };
|
|
33775
33826
|
}, "proposedBySql");
|
|
33776
33827
|
|
|
33777
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33828
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
|
|
33778
33829
|
var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
|
|
33779
33830
|
const owner = ownerPerson(context.database).id;
|
|
33780
33831
|
const strays = context.database.prepare("SELECT DISTINCT l.person_id AS person FROM identity_links l JOIN identities i ON i.id = l.identity_id JOIN accounts a ON a.provider = i.provider AND a.external_id = i.external_id WHERE l.person_id <> ?").all(owner);
|
|
@@ -33795,7 +33846,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
|
|
|
33795
33846
|
return personOf(context, ref3);
|
|
33796
33847
|
}, "linkToOwner");
|
|
33797
33848
|
|
|
33798
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33849
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
|
|
33799
33850
|
var PROVIDERS_SETTING = "providers";
|
|
33800
33851
|
var storedProvidersOf = /* @__PURE__ */ __name((database) => {
|
|
33801
33852
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
|
|
@@ -33830,7 +33881,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
33830
33881
|
});
|
|
33831
33882
|
}, "registerProvider");
|
|
33832
33883
|
|
|
33833
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33884
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
|
|
33834
33885
|
var DAY3 = 864e5;
|
|
33835
33886
|
var RECENTLY_CLOSED_MS = 14 * DAY3;
|
|
33836
33887
|
var TEXT_LIMIT = 20;
|
|
@@ -34029,7 +34080,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
34029
34080
|
};
|
|
34030
34081
|
}, "taskSimilarityOver");
|
|
34031
34082
|
|
|
34032
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34083
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
|
|
34033
34084
|
var SETTING3 = "taskCategories";
|
|
34034
34085
|
var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
34035
34086
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
|
|
@@ -34048,7 +34099,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
|
|
|
34048
34099
|
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(SETTING3, JSON.stringify(categories), now2);
|
|
34049
34100
|
}, "saveTaskCategories");
|
|
34050
34101
|
|
|
34051
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34102
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
|
|
34052
34103
|
var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
|
|
34053
34104
|
var ALLOWED = "taskAgentClose";
|
|
34054
34105
|
var MIN = "taskAgentCloseMin";
|
|
@@ -34104,10 +34155,10 @@ var SUGGESTION_COLUMNS = [
|
|
|
34104
34155
|
];
|
|
34105
34156
|
var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
|
|
34106
34157
|
|
|
34107
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34158
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
|
|
34108
34159
|
var MAIL_FINDINGS_KIND = "mail_findings";
|
|
34109
34160
|
|
|
34110
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34161
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/decisions.js
|
|
34111
34162
|
var TASK_CLOSE_KIND = "task_close";
|
|
34112
34163
|
var DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
|
|
34113
34164
|
var isOwnerOnlyKind = /* @__PURE__ */ __name((kind4) => kind4 === MAIL_FINDINGS_KIND || kind4 === MEETING_FINDINGS_KIND || kind4 === TASK_CLOSE_KIND, "isOwnerOnlyKind");
|
|
@@ -34155,7 +34206,7 @@ var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISIO
|
|
|
34155
34206
|
}, "assertMayDecide");
|
|
34156
34207
|
var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
|
|
34157
34208
|
|
|
34158
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34209
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/deals.js
|
|
34159
34210
|
var DEAL_KINDS = ["deal", "lead"];
|
|
34160
34211
|
var DEAL_STATUSES = ["open", "won", "lost"];
|
|
34161
34212
|
var STAGE_OUTCOMES = DEAL_STATUSES;
|
|
@@ -34165,7 +34216,7 @@ var dealLine = /* @__PURE__ */ __name((deal) => {
|
|
|
34165
34216
|
return `${deal.title} \xB7 ${deal.stage}${money}${deal.status === "open" ? "" : ` (${deal.status})`}`;
|
|
34166
34217
|
}, "dealLine");
|
|
34167
34218
|
|
|
34168
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34219
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
|
|
34169
34220
|
var PROFILE_PLACEHOLDER = "<profile>";
|
|
34170
34221
|
var oneLine = /* @__PURE__ */ __name((text6) => singleLine(text6.replace(/\s+/g, " ").trim()), "oneLine");
|
|
34171
34222
|
var openKind = /* @__PURE__ */ __name((kind4) => kind4 === "email" ? "message" : kind4 === "email_thread" ? "chat" : kind4 === "unknown" ? void 0 : kind4, "openKind");
|
|
@@ -34221,7 +34272,7 @@ var refLabel = /* @__PURE__ */ __name((summary) => {
|
|
|
34221
34272
|
return `${WORDS2[summary.kind]} ${named3}${notes2 === "" ? "" : ` (${notes2})`}`;
|
|
34222
34273
|
}, "refLabel");
|
|
34223
34274
|
|
|
34224
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34275
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
|
|
34225
34276
|
var EXCERPT_CHARS = 280;
|
|
34226
34277
|
var TITLE_CHARS = 120;
|
|
34227
34278
|
var MEMORY_TITLE_CHARS = 80;
|
|
@@ -34594,7 +34645,7 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false } =
|
|
|
34594
34645
|
var summaryOf2 = /* @__PURE__ */ __name(({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary, "summaryOf");
|
|
34595
34646
|
var refSummariesOf = /* @__PURE__ */ __name((database, texts2, options = {}) => new Map([...refReadsOf(database, texts2, options)].map(([text6, read2]) => [text6, summaryOf2(read2, options.excerpt === true)])), "refSummariesOf");
|
|
34596
34647
|
|
|
34597
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34648
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
|
|
34598
34649
|
var sourceOf3 = /* @__PURE__ */ __name((read2, ref3) => ({
|
|
34599
34650
|
ref: ref3,
|
|
34600
34651
|
kind: read2.kind,
|
|
@@ -34630,7 +34681,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
|
|
|
34630
34681
|
});
|
|
34631
34682
|
}, "evidenceSourcesOf");
|
|
34632
34683
|
|
|
34633
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34684
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/attachments/limits.js
|
|
34634
34685
|
var MAX_FILE_BYTES = 50 * 1024 * 1024;
|
|
34635
34686
|
var MAX_TEXT_CHARS = 2e6;
|
|
34636
34687
|
var ATTACHMENT_LIMIT_ENV = [
|
|
@@ -34656,7 +34707,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
|
|
|
34656
34707
|
return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
|
|
34657
34708
|
}, "pdfPreviewLimits");
|
|
34658
34709
|
|
|
34659
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34710
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/ulid.js
|
|
34660
34711
|
import { randomBytes } from "node:crypto";
|
|
34661
34712
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
34662
34713
|
var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
@@ -34669,7 +34720,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
|
34669
34720
|
return time3 + random;
|
|
34670
34721
|
}, "ulid");
|
|
34671
34722
|
|
|
34672
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34723
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
|
|
34673
34724
|
var FOLDED_FIELDS = ["title", "site", "language", "author"];
|
|
34674
34725
|
var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
|
|
34675
34726
|
if (!meta && !sections?.length)
|
|
@@ -34690,7 +34741,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
|
|
|
34690
34741
|
return typeof language === "string" && language !== "" ? language : null;
|
|
34691
34742
|
}, "languageOf");
|
|
34692
34743
|
|
|
34693
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34744
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
|
|
34694
34745
|
var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
|
|
34695
34746
|
var objectOf2 = /* @__PURE__ */ __name((value) => {
|
|
34696
34747
|
if (isObject(value))
|
|
@@ -34933,7 +34984,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
34933
34984
|
};
|
|
34934
34985
|
}, "filesStoreOver");
|
|
34935
34986
|
|
|
34936
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34987
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
|
|
34937
34988
|
var IMPORTED_DOCUMENT_QUERY = defineQuery({
|
|
34938
34989
|
entity: "document",
|
|
34939
34990
|
backend: "sql",
|
|
@@ -34979,7 +35030,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
|
|
|
34979
35030
|
return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
|
|
34980
35031
|
}, "importedDocumentWhere");
|
|
34981
35032
|
|
|
34982
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35033
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
|
|
34983
35034
|
var NOTE_FORMATS = ["obsidian", "markdown"];
|
|
34984
35035
|
var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
34985
35036
|
var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
|
|
@@ -35505,7 +35556,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35505
35556
|
};
|
|
35506
35557
|
}, "notesStoreOver");
|
|
35507
35558
|
|
|
35508
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35559
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
|
|
35509
35560
|
var NAMED = "SELECT m.*, b.name AS author_name, b.kind AS author_kind FROM memories m LEFT JOIN bots b ON m.author_type = 'bot' AND b.id = m.author_id";
|
|
35510
35561
|
var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
35511
35562
|
var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -35727,7 +35778,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35727
35778
|
};
|
|
35728
35779
|
}, "memoriesStoreOver");
|
|
35729
35780
|
|
|
35730
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35781
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
|
|
35731
35782
|
var DEFAULT_FIRST_PASS_PER_CHAT = 0;
|
|
35732
35783
|
var KEY = "taskFirstPassPerChat";
|
|
35733
35784
|
var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
|
|
@@ -35747,7 +35798,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
35747
35798
|
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(KEY, String(value), now2);
|
|
35748
35799
|
}, "saveFirstPassPerChat");
|
|
35749
35800
|
|
|
35750
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35801
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/external-links.js
|
|
35751
35802
|
var EXTERNAL_SERVICE = /^[a-z][a-z0-9-]{0,31}$/;
|
|
35752
35803
|
var EXTERNAL_ID_CHARS = 200;
|
|
35753
35804
|
var SOURCE_URL_CHARS = 2e3;
|
|
@@ -35774,7 +35825,7 @@ var sourceUrlOf = /* @__PURE__ */ __name((value, reason = "task.source-url") =>
|
|
|
35774
35825
|
return text6;
|
|
35775
35826
|
}, "sourceUrlOf");
|
|
35776
35827
|
|
|
35777
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35828
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
|
|
35778
35829
|
var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
|
|
35779
35830
|
var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
|
|
35780
35831
|
name,
|
|
@@ -35997,7 +36048,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
|
|
|
35997
36048
|
return root === void 0 ? void 0 : { ...query, root };
|
|
35998
36049
|
}, "withoutField");
|
|
35999
36050
|
|
|
36000
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36051
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
|
|
36001
36052
|
var authorNamed = /* @__PURE__ */ __name((database, row2) => {
|
|
36002
36053
|
if (row2.author_type == null)
|
|
36003
36054
|
return null;
|
|
@@ -36025,7 +36076,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
|
|
|
36025
36076
|
return commentsOf(database, task).find((one2) => one2.ref === `note:${made}`);
|
|
36026
36077
|
}, "addComment");
|
|
36027
36078
|
|
|
36028
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36079
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
|
|
36029
36080
|
var TASK_RELATION_KINDS = [
|
|
36030
36081
|
"blocked-by",
|
|
36031
36082
|
"follow-up-of",
|
|
@@ -36155,7 +36206,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
36155
36206
|
};
|
|
36156
36207
|
}, "taskRelationsStoreOver");
|
|
36157
36208
|
|
|
36158
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36209
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
|
|
36159
36210
|
var TASK_ROLES = ["assignee", "reviewer", "watcher"];
|
|
36160
36211
|
var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
36161
36212
|
var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind4, changes, at) => {
|
|
@@ -36684,7 +36735,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
|
|
|
36684
36735
|
};
|
|
36685
36736
|
}, "workTasksOver");
|
|
36686
36737
|
|
|
36687
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36738
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
|
|
36688
36739
|
var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
36689
36740
|
const { database, now: now2 } = context;
|
|
36690
36741
|
const liveRow = /* @__PURE__ */ __name((id2) => {
|
|
@@ -36733,7 +36784,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
36733
36784
|
};
|
|
36734
36785
|
}, "taskCloseOver");
|
|
36735
36786
|
|
|
36736
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36787
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
|
|
36737
36788
|
var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
36738
36789
|
const { database, now: now2 } = context;
|
|
36739
36790
|
const required3 = /* @__PURE__ */ __name((id2) => {
|
|
@@ -36951,7 +37002,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
36951
37002
|
};
|
|
36952
37003
|
}, "taskPairsOver");
|
|
36953
37004
|
|
|
36954
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37005
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
|
|
36955
37006
|
var ACCOUNT_SCOPE = "t.package_id IS NOT NULL AND t.deleted_at IS NULL AND t.project_id = ?";
|
|
36956
37007
|
var TASK_STATS_SQL = {
|
|
36957
37008
|
rows: /* @__PURE__ */ __name((board, filter) => `SELECT t.source_group, t.source_kind, t.project_id, t.status, t.created_at, t.closed_at FROM tasks t WHERE ${board ? BOARD_SCOPE : ACCOUNT_SCOPE}${filter} ORDER BY t.created_at, t.id`, "rows"),
|
|
@@ -36990,7 +37041,7 @@ var taskStatsOver = /* @__PURE__ */ __name(({ database }, inbox) => ({
|
|
|
36990
37041
|
}, "statNames")
|
|
36991
37042
|
}), "taskStatsOver");
|
|
36992
37043
|
|
|
36993
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37044
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
|
|
36994
37045
|
var COLUMNS3 = "t.id AS row_id, t.package_id, t.source_locator, t.source_kind, t.source_group, t.type, t.status, t.close_reason, t.source, t.created_at, t.due_at, t.closed_at, t.closed_by_type, t.closed_by_id, t.key, t.category, t.claimed_by, t.claimed_until, p.name AS account";
|
|
36995
37046
|
var inboxProject = /* @__PURE__ */ __name(({ database, now: now2 }, account, create) => {
|
|
36996
37047
|
const key2 = inboxKey(account);
|
|
@@ -37197,7 +37248,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
|
|
|
37197
37248
|
throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
|
|
37198
37249
|
}, "oneOf");
|
|
37199
37250
|
|
|
37200
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37251
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/accounts.js
|
|
37201
37252
|
var accountAccountsOver = /* @__PURE__ */ __name((context) => {
|
|
37202
37253
|
const { database } = context;
|
|
37203
37254
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -37242,7 +37293,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
37242
37293
|
};
|
|
37243
37294
|
}, "accountsStoreOver");
|
|
37244
37295
|
|
|
37245
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37296
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
|
|
37246
37297
|
var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
|
|
37247
37298
|
var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
|
|
37248
37299
|
const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
|
|
@@ -37266,7 +37317,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
|
|
|
37266
37317
|
})), "keepDownloads");
|
|
37267
37318
|
var keepProviderRefs = /* @__PURE__ */ __name((context, chatKey, messageId, files2) => updatePlaced(context, chatKey, messageId, files2.filter((file) => Object.keys(file.providerRef).length > 0), (file) => refColumn(file.providerRef)), "keepProviderRefs");
|
|
37268
37319
|
|
|
37269
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37320
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/attachments.js
|
|
37270
37321
|
var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
|
|
37271
37322
|
const { database } = context;
|
|
37272
37323
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -37323,7 +37374,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
37323
37374
|
}, "keepAttachmentText")
|
|
37324
37375
|
}), "attachmentsStoreOver");
|
|
37325
37376
|
|
|
37326
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37377
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
|
|
37327
37378
|
var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
|
|
37328
37379
|
var pointerMover = /* @__PURE__ */ __name((context, type) => {
|
|
37329
37380
|
const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
|
|
@@ -37503,7 +37554,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
|
|
|
37503
37554
|
return done;
|
|
37504
37555
|
}, "rekeyChats");
|
|
37505
37556
|
|
|
37506
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37557
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
|
|
37507
37558
|
var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
|
|
37508
37559
|
var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
|
|
37509
37560
|
var CHAT_LIST_KEY = "chat_list_complete";
|
|
@@ -37561,7 +37612,7 @@ var chatCoverage = /* @__PURE__ */ __name(({ database }, accountKey) => {
|
|
|
37561
37612
|
return { ...coverage, oldestMessageAt: toIso(oldest) };
|
|
37562
37613
|
}, "chatCoverage");
|
|
37563
37614
|
|
|
37564
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37615
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/chats.js
|
|
37565
37616
|
var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
37566
37617
|
const { database } = context;
|
|
37567
37618
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
|
|
@@ -37696,7 +37747,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
37696
37747
|
};
|
|
37697
37748
|
}, "chatsStoreOver");
|
|
37698
37749
|
|
|
37699
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37750
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
|
|
37700
37751
|
import { createHash as createHash7 } from "node:crypto";
|
|
37701
37752
|
var BATCH_CONTEXT = 50;
|
|
37702
37753
|
var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
|
|
@@ -37834,7 +37885,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
|
|
|
37834
37885
|
var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
|
|
37835
37886
|
${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
|
|
37836
37887
|
|
|
37837
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37888
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
|
|
37838
37889
|
import { setTimeout } from "node:timers/promises";
|
|
37839
37890
|
var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
|
|
37840
37891
|
var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
|
|
@@ -38146,7 +38197,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
|
|
|
38146
38197
|
AND NOT EXISTS (SELECT 1 FROM messages d
|
|
38147
38198
|
WHERE d.id IN (l.message_id, l.parent_id) AND d.deleted_at > l.created_at)`).map(({ id: id2, parent: parent2 }) => [id2, parent2])), "agentAnswers");
|
|
38148
38199
|
|
|
38149
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38200
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/conversations.js
|
|
38150
38201
|
var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
38151
38202
|
const { database } = context;
|
|
38152
38203
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -38253,7 +38304,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
38253
38304
|
};
|
|
38254
38305
|
}, "conversationsStoreOver");
|
|
38255
38306
|
|
|
38256
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38307
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/counters.js
|
|
38257
38308
|
var LIVE_MESSAGE = "SELECT m.id AS pk FROM messages m JOIN chats c ON c.id=m.chat_id JOIN accounts ac ON ac.id=m.account_id WHERE ac.provider=? AND ac.external_id=? AND c.external_id=? AND m.external_id=? AND m.deleted_at IS NULL";
|
|
38258
38309
|
var accountCountersOver = /* @__PURE__ */ __name((context) => {
|
|
38259
38310
|
const { database } = context;
|
|
@@ -38278,7 +38329,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
38278
38329
|
counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
|
|
38279
38330
|
}), "countersStoreOver");
|
|
38280
38331
|
|
|
38281
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38332
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
|
|
38282
38333
|
var MENTION_STATUSES = ["found", "linked", "dismissed"];
|
|
38283
38334
|
var MENTION_QUERY = defineQuery({
|
|
38284
38335
|
entity: "mention",
|
|
@@ -38494,7 +38545,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
|
|
|
38494
38545
|
return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
|
|
38495
38546
|
}, "listPlaces");
|
|
38496
38547
|
|
|
38497
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38548
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/mentions.js
|
|
38498
38549
|
var accountMentionsOver = /* @__PURE__ */ __name((context) => {
|
|
38499
38550
|
const { database } = context;
|
|
38500
38551
|
const { findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -38529,7 +38580,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
38529
38580
|
places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
|
|
38530
38581
|
}), "mentionsStoreOver");
|
|
38531
38582
|
|
|
38532
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38583
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
|
|
38533
38584
|
var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
|
|
38534
38585
|
const read2 = database.prepare("SELECT m.id, m.external_id, m.text, m.sent_at, m.sender_name, coalesce(m.sender_chat_external_id, i.external_id) AS sender_id FROM messages m LEFT JOIN identities i ON i.id = m.sender_identity_id WHERE m.chat_id = ? AND m.deleted_at IS NULL AND (m.text LIKE '%google.com%' OR m.text LIKE '%forms.gle%') " + (messageId === void 0 ? "" : "AND m.external_id = ? ") + "ORDER BY m.sent_at DESC, m.id DESC");
|
|
38535
38586
|
const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
|
|
@@ -38544,7 +38595,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
|
|
|
38544
38595
|
}));
|
|
38545
38596
|
}, "documentLinkMessages");
|
|
38546
38597
|
|
|
38547
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38598
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
|
|
38548
38599
|
var stemmerFor = stemmerCache();
|
|
38549
38600
|
var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
|
|
38550
38601
|
if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
@@ -38588,7 +38639,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
|
|
|
38588
38639
|
});
|
|
38589
38640
|
}, "laterSharingRare");
|
|
38590
38641
|
|
|
38591
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38642
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/messages.js
|
|
38592
38643
|
var accountMessagesOver = /* @__PURE__ */ __name((context) => {
|
|
38593
38644
|
const { database } = context;
|
|
38594
38645
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
|
|
@@ -38723,7 +38774,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
38723
38774
|
laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
|
|
38724
38775
|
}), "messagesStoreOver");
|
|
38725
38776
|
|
|
38726
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38777
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
|
|
38727
38778
|
var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
|
|
38728
38779
|
var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
38729
38780
|
var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
|
|
@@ -38780,7 +38831,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
38780
38831
|
});
|
|
38781
38832
|
}, "personPreparation");
|
|
38782
38833
|
|
|
38783
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38834
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
|
|
38784
38835
|
var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
|
|
38785
38836
|
const id2 = Number(uid);
|
|
38786
38837
|
if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
|
|
@@ -38788,7 +38839,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
|
|
|
38788
38839
|
return Boolean(database.prepare("SELECT 1 FROM persons p JOIN identity_links l ON l.person_id=p.id JOIN account_identities a ON a.identity_id=l.identity_id WHERE p.id=? AND a.account_id IN (SELECT value FROM json_each(?)) LIMIT 1").get(id2, JSON.stringify(accountIds)));
|
|
38789
38840
|
}, "personSeenInAccounts");
|
|
38790
38841
|
|
|
38791
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38842
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
|
|
38792
38843
|
var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
|
|
38793
38844
|
const row2 = database.prepare("SELECT a.id AS account_id, i.id AS identity_id FROM accounts a JOIN account_identities ai ON ai.account_id=a.id JOIN identities i ON i.id=ai.identity_id WHERE a.provider=? AND a.external_id=? AND i.provider=? AND i.external_id=?").get(key2.provider, key2.account, key2.provider, personId);
|
|
38794
38845
|
if (!row2)
|
|
@@ -38854,7 +38905,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
|
|
|
38854
38905
|
return { id: id2, personId, removed: true };
|
|
38855
38906
|
}, "removeNote");
|
|
38856
38907
|
|
|
38857
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38908
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/people.js
|
|
38858
38909
|
var accountPeopleOver = /* @__PURE__ */ __name((context) => {
|
|
38859
38910
|
const { database } = context;
|
|
38860
38911
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
|
|
@@ -38939,13 +38990,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
38939
38990
|
};
|
|
38940
38991
|
}, "peopleStoreOver");
|
|
38941
38992
|
|
|
38942
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38993
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
38943
38994
|
import { createHash as createHash9 } from "node:crypto";
|
|
38944
38995
|
|
|
38945
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38996
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
38946
38997
|
import { createHash as createHash8 } from "node:crypto";
|
|
38947
38998
|
|
|
38948
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38999
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
|
|
38949
39000
|
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
38950
39001
|
var AUTHOR_MEASURES = [
|
|
38951
39002
|
"messages",
|
|
@@ -39085,7 +39136,7 @@ var withoutUrls = /* @__PURE__ */ __name((text6) => text6.replace(/\S+/gu, (toke
|
|
|
39085
39136
|
var rankingWords = /* @__PURE__ */ __name((text6) => withoutUrls(text6).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
39086
39137
|
var rankingQuestion = /* @__PURE__ */ __name((text6) => withoutUrls(text6).includes("?"), "rankingQuestion");
|
|
39087
39138
|
|
|
39088
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39139
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
|
|
39089
39140
|
var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
|
|
39090
39141
|
var exhausted2 = /* @__PURE__ */ __name((budget) => {
|
|
39091
39142
|
throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
|
|
@@ -39307,7 +39358,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
|
|
|
39307
39358
|
};
|
|
39308
39359
|
}, "rankReplyGraph");
|
|
39309
39360
|
|
|
39310
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39361
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
39311
39362
|
var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
|
|
39312
39363
|
var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
|
|
39313
39364
|
var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
|
|
@@ -39481,7 +39532,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
|
|
|
39481
39532
|
return { items, evidence, summary, graph: graph.quality };
|
|
39482
39533
|
}, "calculateAdminStatistics");
|
|
39483
39534
|
|
|
39484
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39535
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
|
|
39485
39536
|
var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
39486
39537
|
const dates = [];
|
|
39487
39538
|
const visit = /* @__PURE__ */ __name((node, required3) => {
|
|
@@ -39503,7 +39554,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
|
39503
39554
|
return dates[0].node.resolution.date;
|
|
39504
39555
|
}, "rankingContextRange");
|
|
39505
39556
|
|
|
39506
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39557
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
|
|
39507
39558
|
var reactionCounts = /* @__PURE__ */ __name((stored3) => {
|
|
39508
39559
|
let counts;
|
|
39509
39560
|
try {
|
|
@@ -39798,7 +39849,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
|
|
|
39798
39849
|
});
|
|
39799
39850
|
}, "rankQuery");
|
|
39800
39851
|
|
|
39801
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39852
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
39802
39853
|
function fail4(message2, reason = "query.too-large") {
|
|
39803
39854
|
throw new CliError("validation_error", message2, { reason, complete: false });
|
|
39804
39855
|
}
|
|
@@ -39975,7 +40026,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
39975
40026
|
return result;
|
|
39976
40027
|
}), "adminStatisticsQuery");
|
|
39977
40028
|
|
|
39978
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40029
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
|
|
39979
40030
|
var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
|
|
39980
40031
|
if (!execution.accounts.length)
|
|
39981
40032
|
return { conversations: [], chats: [] };
|
|
@@ -39993,7 +40044,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
|
|
|
39993
40044
|
return { conversations: conversations2, chats: chats2 };
|
|
39994
40045
|
}, "conversationEligibility");
|
|
39995
40046
|
|
|
39996
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40047
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
|
|
39997
40048
|
import { createHash as createHash10 } from "node:crypto";
|
|
39998
40049
|
var EVIDENCE_BYTES = 64 * 1024;
|
|
39999
40050
|
var FINGERPRINT_BYTES = 8 * 1024 * 1024;
|
|
@@ -40143,7 +40194,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
|
|
|
40143
40194
|
return result;
|
|
40144
40195
|
}, "rankingEvidence");
|
|
40145
40196
|
|
|
40146
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40197
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
|
|
40147
40198
|
var FAR = Number.MAX_SAFE_INTEGER;
|
|
40148
40199
|
var chatsIn = /* @__PURE__ */ __name((scope3, kinds2) => {
|
|
40149
40200
|
const params = [...scope3.accounts.flatMap(({ provider, account }) => [provider, account]), ...kinds2];
|
|
@@ -40237,7 +40288,7 @@ var waitingChats = /* @__PURE__ */ __name((context, scope3, waits, cap) => {
|
|
|
40237
40288
|
});
|
|
40238
40289
|
}, "waitingChats");
|
|
40239
40290
|
|
|
40240
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40291
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/queries.js
|
|
40241
40292
|
var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
40242
40293
|
const mailIndexed = /* @__PURE__ */ __name((execution) => {
|
|
40243
40294
|
if (execution.corpus === "mail")
|
|
@@ -40258,7 +40309,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
|
40258
40309
|
};
|
|
40259
40310
|
}, "queriesStoreOver");
|
|
40260
40311
|
|
|
40261
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40312
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
|
|
40262
40313
|
var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
|
|
40263
40314
|
const { database, now: now2 } = context;
|
|
40264
40315
|
const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
|
|
@@ -40297,10 +40348,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
|
|
|
40297
40348
|
}));
|
|
40298
40349
|
}, "chatEventsOf");
|
|
40299
40350
|
|
|
40300
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40351
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
40301
40352
|
import { createHash as createHash11 } from "node:crypto";
|
|
40302
40353
|
|
|
40303
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40354
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/calendar.js
|
|
40304
40355
|
var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
40305
40356
|
const format = new Intl.DateTimeFormat("en-CA", {
|
|
40306
40357
|
timeZone: zone,
|
|
@@ -40314,13 +40365,13 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
|
40314
40365
|
return `${part.year}-${part.month}-${part.day}${by === "hour" ? `T${part.hour}` : ""}`;
|
|
40315
40366
|
};
|
|
40316
40367
|
}, "calendarKey");
|
|
40317
|
-
var weekKey = /* @__PURE__ */ __name((
|
|
40318
|
-
const date3 = /* @__PURE__ */ new Date(`${
|
|
40368
|
+
var weekKey = /* @__PURE__ */ __name((day2) => {
|
|
40369
|
+
const date3 = /* @__PURE__ */ new Date(`${day2}T00:00:00Z`);
|
|
40319
40370
|
date3.setUTCDate(date3.getUTCDate() - (date3.getUTCDay() + 6) % 7);
|
|
40320
40371
|
return date3.toISOString().slice(0, 10);
|
|
40321
40372
|
}, "weekKey");
|
|
40322
40373
|
|
|
40323
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40374
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/retention.js
|
|
40324
40375
|
var RETENTION_TOLERANCE = 864e5;
|
|
40325
40376
|
var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
|
|
40326
40377
|
const { since, until, cutoff, checkpoints, within, limit, by } = options;
|
|
@@ -40374,7 +40425,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
|
|
|
40374
40425
|
return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
|
|
40375
40426
|
}, "retentionCohorts");
|
|
40376
40427
|
|
|
40377
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40428
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
40378
40429
|
var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
|
|
40379
40430
|
var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId, options, evidence) => {
|
|
40380
40431
|
validateRetentionOptions(options);
|
|
@@ -40396,7 +40447,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
40396
40447
|
const activityStatement = database.prepare(`SELECT min(sent_at) AS at FROM messages WHERE chat_id=? AND sender_identity_id=? AND deleted_at IS NULL AND sent_at >= ? AND sent_at < ?`);
|
|
40397
40448
|
const stays = raw.map((row2) => {
|
|
40398
40449
|
const joinedAt = Number(row2.joined_at), pk = Number(row2.pk), end = joinedAt + options.within;
|
|
40399
|
-
const
|
|
40450
|
+
const day2 = dayOf2(joinedAt), cohort = options.by === "week" ? weekKey(day2) : day2;
|
|
40400
40451
|
const absence = departureStatement.get(chatPk, Math.max(joinedAt, Number(row2.first_seen_at)), options.cutoff, pk);
|
|
40401
40452
|
const upper = absence ? Number(absence.observed_at) : null;
|
|
40402
40453
|
const positive2 = lastPositiveStatement.get(pk, upper ?? options.cutoff + 1);
|
|
@@ -40505,7 +40556,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
40505
40556
|
};
|
|
40506
40557
|
}, "retentionQuery");
|
|
40507
40558
|
|
|
40508
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40559
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
|
|
40509
40560
|
var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
|
|
40510
40561
|
var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
|
|
40511
40562
|
...isBot === void 0 ? {} : { bot: isBot },
|
|
@@ -40578,14 +40629,14 @@ var saveRoster = /* @__PURE__ */ __name((context, accountKey, provider, chatKey,
|
|
|
40578
40629
|
for (const person2 of present2)
|
|
40579
40630
|
orm.insert(chatMembers).values({ chatId: chatKey, identityId: person2, createdAt: at }).run();
|
|
40580
40631
|
}
|
|
40581
|
-
const
|
|
40632
|
+
const day2 = new Date(at).toISOString().slice(0, 10);
|
|
40582
40633
|
const count = {
|
|
40583
40634
|
reportedCount: participants3,
|
|
40584
40635
|
listedCount: members2.length,
|
|
40585
40636
|
completeList: complete ? 1 : 0,
|
|
40586
40637
|
createdAt: at
|
|
40587
40638
|
};
|
|
40588
|
-
orm.insert(memberCounts).values({ chatId: chatKey, date:
|
|
40639
|
+
orm.insert(memberCounts).values({ chatId: chatKey, date: day2, ...count }).onConflictDoUpdate({ target: [memberCounts.chatId, memberCounts.date], set: count }).run();
|
|
40589
40640
|
return change;
|
|
40590
40641
|
}, "saveRoster");
|
|
40591
40642
|
var memberStaysOf = /* @__PURE__ */ __name(({ orm }, chatKey, since) => orm.select({
|
|
@@ -40636,7 +40687,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
|
|
|
40636
40687
|
lastCount: memberCountsOf(context, pk).at(-1) ?? null
|
|
40637
40688
|
})), "trackedChats");
|
|
40638
40689
|
|
|
40639
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40690
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/roster.js
|
|
40640
40691
|
var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
40641
40692
|
const { database } = context;
|
|
40642
40693
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
|
|
@@ -40692,7 +40743,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
40692
40743
|
};
|
|
40693
40744
|
}, "rosterStoreOver");
|
|
40694
40745
|
|
|
40695
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40746
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
|
|
40696
40747
|
var pendingNormalization = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM messages WHERE normalized_text IS NULL AND deleted_at IS NULL").get()?.n), "pendingNormalization");
|
|
40697
40748
|
var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
|
|
40698
40749
|
const next = database.prepare(`SELECT id AS pk, text FROM messages WHERE normalized_text IS NULL AND deleted_at IS NULL AND id > ? ORDER BY id LIMIT ?`);
|
|
@@ -40716,7 +40767,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
|
|
|
40716
40767
|
}
|
|
40717
40768
|
}, "backfillNormalized");
|
|
40718
40769
|
|
|
40719
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40770
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
|
|
40720
40771
|
var INDEX2 = "message_words";
|
|
40721
40772
|
var searchIndexState2 = /* @__PURE__ */ __name((database) => {
|
|
40722
40773
|
const row2 = indexRow(database, INDEX2);
|
|
@@ -40843,7 +40894,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
|
|
|
40843
40894
|
});
|
|
40844
40895
|
}, "resetSearchIndex");
|
|
40845
40896
|
|
|
40846
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40897
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
|
|
40847
40898
|
var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
|
|
40848
40899
|
const filled2 = { stemmed: 0, drained: 0 };
|
|
40849
40900
|
const before2 = stemsState(database);
|
|
@@ -40938,7 +40989,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
|
|
|
40938
40989
|
return resetStems(database, { now: now2 });
|
|
40939
40990
|
}, "followDefaultStemmers");
|
|
40940
40991
|
|
|
40941
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40992
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
|
|
40942
40993
|
var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
|
|
40943
40994
|
var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
|
|
40944
40995
|
const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
|
|
@@ -40960,7 +41011,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
|
|
|
40960
41011
|
});
|
|
40961
41012
|
}, "termCandidates");
|
|
40962
41013
|
|
|
40963
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41014
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/search-index.js
|
|
40964
41015
|
var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
40965
41016
|
const { database } = context;
|
|
40966
41017
|
const stemmerFor2 = stemmerCache();
|
|
@@ -40982,7 +41033,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
40982
41033
|
};
|
|
40983
41034
|
}, "searchIndexStoreOver");
|
|
40984
41035
|
|
|
40985
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41036
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
|
|
40986
41037
|
var HISTORY_KEPT = 1e3;
|
|
40987
41038
|
var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
|
|
40988
41039
|
var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
|
|
@@ -41051,7 +41102,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
|
|
|
41051
41102
|
return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
|
|
41052
41103
|
}, "clearHistory");
|
|
41053
41104
|
|
|
41054
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41105
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/searches.js
|
|
41055
41106
|
var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
41056
41107
|
const { database } = context;
|
|
41057
41108
|
return {
|
|
@@ -41075,7 +41126,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
41075
41126
|
};
|
|
41076
41127
|
}, "searchesStoreOver");
|
|
41077
41128
|
|
|
41078
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41129
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
|
|
41079
41130
|
var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
|
|
41080
41131
|
var ACTION_OUTCOMES = ["ok", "refused", "failed"];
|
|
41081
41132
|
var CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
@@ -41118,7 +41169,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
|
|
|
41118
41169
|
};
|
|
41119
41170
|
}, "agentActionsStoreOver");
|
|
41120
41171
|
|
|
41121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41172
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
|
|
41122
41173
|
var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
41123
41174
|
}) => {
|
|
41124
41175
|
const { database, now: now2 } = context;
|
|
@@ -41177,7 +41228,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
|
41177
41228
|
};
|
|
41178
41229
|
}, "botUpdateStoreOver");
|
|
41179
41230
|
|
|
41180
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41231
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
|
|
41181
41232
|
var DAY4 = 864e5;
|
|
41182
41233
|
var accountsOf = /* @__PURE__ */ __name((filter) => {
|
|
41183
41234
|
if (filter.accountIds !== void 0 && filter.accountId !== void 0)
|
|
@@ -41286,7 +41337,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
|
41286
41337
|
return database.prepare(`SELECT e.* FROM events e WHERE ${clauses.join(" AND ")} ORDER BY ${filter.newest ? "e.starts_at DESC, e.id DESC" : "e.starts_at, e.id"} LIMIT ? OFFSET ?`).all(...params, limit, offset).map(eventOf);
|
|
41287
41338
|
}, "listEvents");
|
|
41288
41339
|
|
|
41289
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41340
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
|
|
41290
41341
|
var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
|
|
41291
41342
|
var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
|
|
41292
41343
|
const unseenBefore = unreferenced(database, "identities");
|
|
@@ -41341,7 +41392,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
|
|
|
41341
41392
|
return { entries: entryIds.length, events: goneEvents.length };
|
|
41342
41393
|
}, "forgetCalendarRows");
|
|
41343
41394
|
|
|
41344
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41395
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
|
|
41345
41396
|
var calendarOf = /* @__PURE__ */ __name((row2) => ({
|
|
41346
41397
|
id: Number(row2.id),
|
|
41347
41398
|
accountId: Number(row2.account_id),
|
|
@@ -41928,7 +41979,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
41928
41979
|
};
|
|
41929
41980
|
}, "eventStoreOver");
|
|
41930
41981
|
|
|
41931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41982
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
|
|
41932
41983
|
var CATALOG_QUERY = defineQuery({
|
|
41933
41984
|
entity: "document",
|
|
41934
41985
|
backend: "sql",
|
|
@@ -42170,7 +42221,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
42170
42221
|
};
|
|
42171
42222
|
}, "catalogStoreOver");
|
|
42172
42223
|
|
|
42173
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42224
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
|
|
42174
42225
|
var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
|
|
42175
42226
|
var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
|
|
42176
42227
|
CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
|
|
@@ -42183,7 +42234,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
|
|
|
42183
42234
|
THEN 'source-modified' ELSE 'stored-update' END`;
|
|
42184
42235
|
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
|
|
42185
42236
|
|
|
42186
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42237
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
|
|
42187
42238
|
var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
42188
42239
|
const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
|
|
42189
42240
|
signal?.throwIfAborted();
|
|
@@ -42282,7 +42333,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
|
42282
42333
|
});
|
|
42283
42334
|
}, "readMeetingContextEvidence");
|
|
42284
42335
|
|
|
42285
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42336
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
|
|
42286
42337
|
var corpora = {
|
|
42287
42338
|
message: {
|
|
42288
42339
|
table: "messages",
|
|
@@ -42521,7 +42572,462 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
42521
42572
|
}
|
|
42522
42573
|
}), "contextRecordsOver");
|
|
42523
42574
|
|
|
42524
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42575
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/records.js
|
|
42576
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
42577
|
+
var RECORDS_SCHEMA_VERSION = 1;
|
|
42578
|
+
var RECORD_OPERATIONS = ["upsert", "delete"];
|
|
42579
|
+
var RECORD_ENTITY_TYPES = ["invoice", "payment", "person", "organization", "project"];
|
|
42580
|
+
var WORD4 = "^[a-z0-9][a-z0-9_-]{0,62}$";
|
|
42581
|
+
var TYPE = "^(invoice|payment|person|organization|project|custom:[a-z0-9][a-z0-9_-]{0,62})$";
|
|
42582
|
+
var MAX_ID = 512;
|
|
42583
|
+
var MAX_FIELDS_BYTES = 65536;
|
|
42584
|
+
var MAX_RELATIONS = 100;
|
|
42585
|
+
var DECIMAL = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
|
|
42586
|
+
var RECORDS_ENVELOPE_SCHEMA = {
|
|
42587
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
42588
|
+
title: "WireCat records envelope, version 1",
|
|
42589
|
+
description: "Records one source sends to the store. JSONL is the same model: the first line holds schema_version and source, each further line one record.",
|
|
42590
|
+
type: "object",
|
|
42591
|
+
required: ["schema_version", "source", "records"],
|
|
42592
|
+
additionalProperties: false,
|
|
42593
|
+
properties: {
|
|
42594
|
+
schema_version: { const: RECORDS_SCHEMA_VERSION },
|
|
42595
|
+
source: { $ref: "#/$defs/source" },
|
|
42596
|
+
records: { type: "array", items: { $ref: "#/$defs/record" } }
|
|
42597
|
+
},
|
|
42598
|
+
$defs: {
|
|
42599
|
+
source: {
|
|
42600
|
+
type: "object",
|
|
42601
|
+
required: ["provider", "account", "batch_id"],
|
|
42602
|
+
additionalProperties: false,
|
|
42603
|
+
properties: {
|
|
42604
|
+
provider: { type: "string", pattern: WORD4, description: "The system the records come from" },
|
|
42605
|
+
account: { type: "string", minLength: 1, maxLength: MAX_ID, description: "The account in that system" },
|
|
42606
|
+
batch_id: { type: "string", minLength: 1, maxLength: MAX_ID, description: "This import, for the receipt" }
|
|
42607
|
+
}
|
|
42608
|
+
},
|
|
42609
|
+
record: {
|
|
42610
|
+
type: "object",
|
|
42611
|
+
required: ["key", "type", "external_id", "operation"],
|
|
42612
|
+
additionalProperties: false,
|
|
42613
|
+
properties: {
|
|
42614
|
+
key: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
42615
|
+
type: { type: "string", pattern: TYPE },
|
|
42616
|
+
external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
42617
|
+
operation: { enum: [...RECORD_OPERATIONS] },
|
|
42618
|
+
fields: {
|
|
42619
|
+
type: "object",
|
|
42620
|
+
description: "What the source says, as data: never secrets, never instructions"
|
|
42621
|
+
},
|
|
42622
|
+
revision: { type: "integer", minimum: 0, maximum: Number.MAX_SAFE_INTEGER },
|
|
42623
|
+
relations: { type: "array", maxItems: MAX_RELATIONS, items: { $ref: "#/$defs/relation" } }
|
|
42624
|
+
}
|
|
42625
|
+
},
|
|
42626
|
+
relation: {
|
|
42627
|
+
type: "object",
|
|
42628
|
+
required: ["role", "type", "external_id"],
|
|
42629
|
+
additionalProperties: false,
|
|
42630
|
+
properties: {
|
|
42631
|
+
role: { type: "string", pattern: WORD4 },
|
|
42632
|
+
type: { type: "string", pattern: TYPE },
|
|
42633
|
+
external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
42634
|
+
amount: {
|
|
42635
|
+
type: "string",
|
|
42636
|
+
pattern: DECIMAL,
|
|
42637
|
+
description: "A settles relation's share of the payment, a decimal in its currency"
|
|
42638
|
+
}
|
|
42639
|
+
}
|
|
42640
|
+
}
|
|
42641
|
+
}
|
|
42642
|
+
};
|
|
42643
|
+
var wordPattern = new RegExp(WORD4);
|
|
42644
|
+
var typePattern = new RegExp(TYPE);
|
|
42645
|
+
var decimalPattern = new RegExp(DECIMAL);
|
|
42646
|
+
var isObject2 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isObject");
|
|
42647
|
+
var escapePointer = /* @__PURE__ */ __name((segment) => String(segment).replaceAll("~", "~0").replaceAll("/", "~1"), "escapePointer");
|
|
42648
|
+
var pointerOf = /* @__PURE__ */ __name((...segments) => segments.map((s) => `/${escapePointer(s)}`).join(""), "pointerOf");
|
|
42649
|
+
var idText = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" && value.length <= MAX_ID && !value.includes("\0"), "idText");
|
|
42650
|
+
var extraKeys = /* @__PURE__ */ __name((value, allowed) => Object.keys(value).filter((key2) => !allowed.includes(key2)), "extraKeys");
|
|
42651
|
+
var secretIn = /* @__PURE__ */ __name((value, at) => {
|
|
42652
|
+
if (typeof value === "string")
|
|
42653
|
+
return holdsCredential(value) ? at : void 0;
|
|
42654
|
+
if (Array.isArray(value)) {
|
|
42655
|
+
for (const [index2, item] of value.entries()) {
|
|
42656
|
+
const found2 = secretIn(item, [...at, index2]);
|
|
42657
|
+
if (found2)
|
|
42658
|
+
return found2;
|
|
42659
|
+
}
|
|
42660
|
+
return void 0;
|
|
42661
|
+
}
|
|
42662
|
+
if (!isObject2(value))
|
|
42663
|
+
return void 0;
|
|
42664
|
+
for (const [key2, item] of Object.entries(value)) {
|
|
42665
|
+
if (secretNamed(key2))
|
|
42666
|
+
return [...at, key2];
|
|
42667
|
+
const found2 = secretIn(item, [...at, key2]);
|
|
42668
|
+
if (found2)
|
|
42669
|
+
return found2;
|
|
42670
|
+
}
|
|
42671
|
+
return void 0;
|
|
42672
|
+
}, "secretIn");
|
|
42673
|
+
var relationErrors = /* @__PURE__ */ __name((relations, at) => {
|
|
42674
|
+
if (relations === void 0)
|
|
42675
|
+
return [];
|
|
42676
|
+
if (!Array.isArray(relations) || relations.length > MAX_RELATIONS)
|
|
42677
|
+
return [invalid4(at, `relations is a list of at most ${MAX_RELATIONS}`)];
|
|
42678
|
+
return relations.flatMap((relation, index2) => {
|
|
42679
|
+
const here = [...at, index2];
|
|
42680
|
+
if (!isObject2(relation))
|
|
42681
|
+
return [invalid4(here, "a relation is an object")];
|
|
42682
|
+
const extra = extraKeys(relation, ["role", "type", "external_id", "amount"]);
|
|
42683
|
+
if (extra.length > 0)
|
|
42684
|
+
return [invalid4([...here, extra[0]], "a relation holds role, type, external_id and amount")];
|
|
42685
|
+
if (typeof relation.role !== "string" || !wordPattern.test(relation.role))
|
|
42686
|
+
return [invalid4([...here, "role"], "a role is lowercase letters, digits, - and _")];
|
|
42687
|
+
if (typeof relation.type !== "string" || !typePattern.test(relation.type))
|
|
42688
|
+
return [invalid4([...here, "type"], `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`)];
|
|
42689
|
+
if (!idText(relation.external_id))
|
|
42690
|
+
return [invalid4([...here, "external_id"], `an external id takes 1\u2013${MAX_ID} characters`)];
|
|
42691
|
+
if (relation.amount !== void 0 && (typeof relation.amount !== "string" || !decimalPattern.test(relation.amount)))
|
|
42692
|
+
return [invalid4([...here, "amount"], 'an amount is a decimal string, such as "13000.00"')];
|
|
42693
|
+
if (relation.amount !== void 0 && relation.role !== "settles")
|
|
42694
|
+
return [invalid4([...here, "amount"], "only a settles relation carries an amount")];
|
|
42695
|
+
return [];
|
|
42696
|
+
});
|
|
42697
|
+
}, "relationErrors");
|
|
42698
|
+
var invalid4 = /* @__PURE__ */ __name((at, message2, code = "record.invalid") => ({
|
|
42699
|
+
pointer: pointerOf(...at),
|
|
42700
|
+
code,
|
|
42701
|
+
message: message2
|
|
42702
|
+
}), "invalid");
|
|
42703
|
+
var recordErrors = /* @__PURE__ */ __name((record4, index2) => {
|
|
42704
|
+
const at = ["records", index2];
|
|
42705
|
+
if (!isObject2(record4))
|
|
42706
|
+
return [invalid4(at, "a record is an object")];
|
|
42707
|
+
const key2 = typeof record4.key === "string" ? record4.key : void 0;
|
|
42708
|
+
const withKey = /* @__PURE__ */ __name((errors) => errors.map((error) => key2 === void 0 ? error : { ...error, key: key2 }), "withKey");
|
|
42709
|
+
const extra = extraKeys(record4, ["key", "type", "external_id", "operation", "fields", "revision", "relations"]);
|
|
42710
|
+
if (extra.length > 0)
|
|
42711
|
+
return withKey([invalid4([...at, extra[0]], `a record has no ${extra[0]}`)]);
|
|
42712
|
+
if (!idText(record4.key))
|
|
42713
|
+
return [invalid4([...at, "key"], `a key takes 1\u2013${MAX_ID} characters`)];
|
|
42714
|
+
if (typeof record4.type !== "string" || !typePattern.test(record4.type))
|
|
42715
|
+
return withKey([
|
|
42716
|
+
invalid4([...at, "type"], `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`, "record.type")
|
|
42717
|
+
]);
|
|
42718
|
+
if (!idText(record4.external_id))
|
|
42719
|
+
return withKey([invalid4([...at, "external_id"], `an external id takes 1\u2013${MAX_ID} characters`)]);
|
|
42720
|
+
if (!RECORD_OPERATIONS.includes(record4.operation))
|
|
42721
|
+
return withKey([invalid4([...at, "operation"], "an operation is upsert or delete")]);
|
|
42722
|
+
if (record4.revision !== void 0 && (typeof record4.revision !== "number" || !Number.isSafeInteger(record4.revision) || record4.revision < 0))
|
|
42723
|
+
return withKey([invalid4([...at, "revision"], "a revision is a whole number, 0 or more")]);
|
|
42724
|
+
if (record4.operation === "upsert" && !isObject2(record4.fields))
|
|
42725
|
+
return withKey([invalid4([...at, "fields"], "an upsert carries its fields as an object")]);
|
|
42726
|
+
if (record4.fields !== void 0 && !isObject2(record4.fields))
|
|
42727
|
+
return withKey([invalid4([...at, "fields"], "fields is an object")]);
|
|
42728
|
+
if (record4.fields !== void 0 && Buffer.byteLength(JSON.stringify(record4.fields)) > MAX_FIELDS_BYTES)
|
|
42729
|
+
return withKey([invalid4([...at, "fields"], `fields take at most ${MAX_FIELDS_BYTES} bytes`, "record.too-large")]);
|
|
42730
|
+
const secret = record4.fields === void 0 ? void 0 : secretIn(record4.fields, [...at, "fields"]);
|
|
42731
|
+
if (secret)
|
|
42732
|
+
return withKey([
|
|
42733
|
+
invalid4(secret, "a secret never goes into the store: drop this field at the source", "record.secret-field")
|
|
42734
|
+
]);
|
|
42735
|
+
return withKey(relationErrors(record4.relations, [...at, "relations"]));
|
|
42736
|
+
}, "recordErrors");
|
|
42737
|
+
var envelopeErrors = /* @__PURE__ */ __name((envelope, account) => {
|
|
42738
|
+
if (!isObject2(envelope))
|
|
42739
|
+
return [invalid4([], "an envelope is an object", "envelope.invalid")];
|
|
42740
|
+
const extra = extraKeys(envelope, ["schema_version", "source", "records"]);
|
|
42741
|
+
if (extra.length > 0)
|
|
42742
|
+
return [invalid4([extra[0]], `an envelope has no ${extra[0]}`, "envelope.invalid")];
|
|
42743
|
+
if (envelope.schema_version !== RECORDS_SCHEMA_VERSION)
|
|
42744
|
+
return [
|
|
42745
|
+
invalid4(["schema_version"], `this build reads schema_version ${RECORDS_SCHEMA_VERSION}, not ${JSON.stringify(envelope.schema_version)}`, "envelope.schema-version")
|
|
42746
|
+
];
|
|
42747
|
+
const { source: source2 } = envelope;
|
|
42748
|
+
if (!isObject2(source2))
|
|
42749
|
+
return [invalid4(["source"], "source is an object", "envelope.invalid")];
|
|
42750
|
+
const sourceExtra = extraKeys(source2, ["provider", "account", "batch_id"]);
|
|
42751
|
+
if (sourceExtra.length > 0)
|
|
42752
|
+
return [
|
|
42753
|
+
invalid4(["source", sourceExtra[0]], "source holds provider, account and batch_id", "envelope.invalid")
|
|
42754
|
+
];
|
|
42755
|
+
if (typeof source2.provider !== "string" || !wordPattern.test(source2.provider))
|
|
42756
|
+
return [invalid4(["source", "provider"], "a provider is lowercase letters, digits, - and _", "envelope.invalid")];
|
|
42757
|
+
if (!idText(source2.account))
|
|
42758
|
+
return [invalid4(["source", "account"], `an account takes 1\u2013${MAX_ID} characters`, "envelope.invalid")];
|
|
42759
|
+
if (!idText(source2.batch_id))
|
|
42760
|
+
return [invalid4(["source", "batch_id"], `a batch id takes 1\u2013${MAX_ID} characters`, "envelope.invalid")];
|
|
42761
|
+
if (source2.account !== account)
|
|
42762
|
+
return [
|
|
42763
|
+
invalid4(["source", "account"], `the envelope is for account ${JSON.stringify(source2.account)}, the import for ${JSON.stringify(account)}`, "envelope.account-mismatch")
|
|
42764
|
+
];
|
|
42765
|
+
if (!Array.isArray(envelope.records))
|
|
42766
|
+
return [invalid4(["records"], "records is a list", "envelope.invalid")];
|
|
42767
|
+
return [];
|
|
42768
|
+
}, "envelopeErrors");
|
|
42769
|
+
var canonical = /* @__PURE__ */ __name((value) => {
|
|
42770
|
+
if (Array.isArray(value))
|
|
42771
|
+
return value.map(canonical);
|
|
42772
|
+
if (!isObject2(value))
|
|
42773
|
+
return value;
|
|
42774
|
+
return Object.fromEntries(Object.keys(value).sort().map((key2) => [key2, canonical(value[key2])]));
|
|
42775
|
+
}, "canonical");
|
|
42776
|
+
var recordFingerprint = /* @__PURE__ */ __name((fields4, relations) => createHash12("sha256").update(JSON.stringify(canonical({
|
|
42777
|
+
fields: fields4,
|
|
42778
|
+
relations: relations.map((relation) => [
|
|
42779
|
+
relation.role,
|
|
42780
|
+
relation.type,
|
|
42781
|
+
relation.external_id,
|
|
42782
|
+
...relation.amount === void 0 ? [] : [relation.amount]
|
|
42783
|
+
]).sort((a, b) => a.join("\0").localeCompare(b.join("\0")))
|
|
42784
|
+
}))).digest("hex"), "recordFingerprint");
|
|
42785
|
+
var envelopeOfJsonl = /* @__PURE__ */ __name((text6) => {
|
|
42786
|
+
const lines = text6.split(/\r?\n/);
|
|
42787
|
+
const first = lines.findIndex((line) => line.trim() !== "");
|
|
42788
|
+
if (first < 0)
|
|
42789
|
+
return {};
|
|
42790
|
+
const parse = /* @__PURE__ */ __name((line) => {
|
|
42791
|
+
try {
|
|
42792
|
+
return JSON.parse(line);
|
|
42793
|
+
} catch {
|
|
42794
|
+
return line;
|
|
42795
|
+
}
|
|
42796
|
+
}, "parse");
|
|
42797
|
+
const header = parse(lines[first]);
|
|
42798
|
+
const records2 = [];
|
|
42799
|
+
for (let at = first + 1; at < lines.length; at++) {
|
|
42800
|
+
const line = lines[at];
|
|
42801
|
+
if (line.trim() !== "")
|
|
42802
|
+
records2.push(parse(line));
|
|
42803
|
+
}
|
|
42804
|
+
return isObject2(header) ? { ...header, records: records2 } : header;
|
|
42805
|
+
}, "envelopeOfJsonl");
|
|
42806
|
+
|
|
42807
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
|
|
42808
|
+
var TABLES = { deal: "deals", lead: "leads" };
|
|
42809
|
+
var SOURCE = "crm";
|
|
42810
|
+
var crmIdentityId = /* @__PURE__ */ __name((key2, externalId, type = "contact") => `${key2.account}/${type}/${externalId}`, "crmIdentityId");
|
|
42811
|
+
var day = /* @__PURE__ */ __name((value, what) => {
|
|
42812
|
+
if (value === void 0 || value === null || value === "")
|
|
42813
|
+
return null;
|
|
42814
|
+
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(value) || Number.isNaN(Date.parse(value)))
|
|
42815
|
+
throw new CliError("validation_error", `${what} is YYYY-MM-DD, not ${JSON.stringify(value)}`);
|
|
42816
|
+
return value;
|
|
42817
|
+
}, "day");
|
|
42818
|
+
var epoch = /* @__PURE__ */ __name((value, fallback) => typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : fallback, "epoch");
|
|
42819
|
+
var textOf3 = /* @__PURE__ */ __name((value, most2) => {
|
|
42820
|
+
if (typeof value !== "string")
|
|
42821
|
+
return null;
|
|
42822
|
+
const kept = value.trim().slice(0, most2);
|
|
42823
|
+
return kept || null;
|
|
42824
|
+
}, "textOf");
|
|
42825
|
+
var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
|
|
42826
|
+
const { database, now: now2 } = context;
|
|
42827
|
+
const author = /* @__PURE__ */ __name((key2) => authorActor(context, { bot: key2.provider, kind: "rule" }).actor, "author");
|
|
42828
|
+
const account = /* @__PURE__ */ __name((key2) => accountPk(context, key2), "account");
|
|
42829
|
+
const pipelineOf = /* @__PURE__ */ __name((accountId, kind4, externalId) => database.prepare("SELECT * FROM pipelines WHERE account_id = ? AND kind = ? AND external_id = ?").get(accountId, kind4, externalId), "pipelineOf");
|
|
42830
|
+
const otherKindHolds = /* @__PURE__ */ __name((accountId, kind4, externalId) => database.prepare("SELECT 1 FROM pipelines WHERE account_id = ? AND kind <> ? AND external_id = ?").get(accountId, kind4, externalId) !== void 0, "otherKindHolds");
|
|
42831
|
+
const savePipelines = /* @__PURE__ */ __name((key2, kind4, pipelines2) => write(database, () => {
|
|
42832
|
+
const accountId = account(key2);
|
|
42833
|
+
const at = now2();
|
|
42834
|
+
const skipped = [];
|
|
42835
|
+
for (const pipeline of pipelines2) {
|
|
42836
|
+
if (otherKindHolds(accountId, kind4, pipeline.externalId)) {
|
|
42837
|
+
skipped.push({
|
|
42838
|
+
externalId: pipeline.externalId,
|
|
42839
|
+
reason: "crm.pipeline-clash",
|
|
42840
|
+
message: `${kind4} pipeline ${pipeline.externalId} has the id of a stored pipeline of the other kind`
|
|
42841
|
+
});
|
|
42842
|
+
continue;
|
|
42843
|
+
}
|
|
42844
|
+
const name = textOf3(pipeline.name, 80) ?? pipeline.externalId;
|
|
42845
|
+
const held = pipelineOf(accountId, kind4, pipeline.externalId);
|
|
42846
|
+
const id2 = held ? Number(held.id) : Number(database.prepare("INSERT INTO pipelines (account_id, external_id, kind, name, name_folded, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id").get(accountId, pipeline.externalId, kind4, name, fold(name), at, at)?.id);
|
|
42847
|
+
if (held && held.name !== name)
|
|
42848
|
+
database.prepare("UPDATE pipelines SET name = ?, name_folded = ?, updated_at = ? WHERE id = ?").run(name, fold(name), at, id2);
|
|
42849
|
+
saveStages(id2, pipeline, at);
|
|
42850
|
+
}
|
|
42851
|
+
return { saved: pipelines2.length - skipped.length, skipped };
|
|
42852
|
+
}), "savePipelines");
|
|
42853
|
+
const saveStages = /* @__PURE__ */ __name((pipelineId, pipeline, at) => {
|
|
42854
|
+
const ordered = [...pipeline.stages].sort((a, b) => a.position - b.position);
|
|
42855
|
+
const counts = /* @__PURE__ */ new Map();
|
|
42856
|
+
for (const stage of ordered)
|
|
42857
|
+
counts.set(fold(stage.name), (counts.get(fold(stage.name)) ?? 0) + 1);
|
|
42858
|
+
const wanted = ordered.map((stage, index2) => {
|
|
42859
|
+
const name = textOf3(stage.name, 80) ?? stage.externalId;
|
|
42860
|
+
const folded5 = (counts.get(fold(stage.name)) ?? 0) > 1 ? `${fold(name)} (${stage.externalId})` : fold(name);
|
|
42861
|
+
if (!STAGE_OUTCOMES.includes(stage.outcome))
|
|
42862
|
+
throw new CliError("invalid_response", `stage ${stage.externalId} has no known outcome: ${stage.outcome}`);
|
|
42863
|
+
return { ...stage, name, folded: folded5, position: index2 + 1 };
|
|
42864
|
+
});
|
|
42865
|
+
const held = database.prepare("SELECT * FROM pipeline_stages WHERE pipeline_id = ?").all(pipelineId);
|
|
42866
|
+
const listed = new Set(wanted.map(({ externalId }) => externalId));
|
|
42867
|
+
const taken = new Set(wanted.map(({ folded: folded5 }) => folded5));
|
|
42868
|
+
const rename = database.prepare("UPDATE pipeline_stages SET name_folded = ? WHERE id = ?");
|
|
42869
|
+
for (const row2 of held) {
|
|
42870
|
+
if (row2.external_id != null && listed.has(String(row2.external_id)))
|
|
42871
|
+
rename.run(`\0${row2.id}`, Number(row2.id));
|
|
42872
|
+
else if (taken.has(String(row2.name_folded)))
|
|
42873
|
+
rename.run(`${row2.name_folded} (${row2.external_id ?? row2.id})`, Number(row2.id));
|
|
42874
|
+
}
|
|
42875
|
+
const byId2 = new Map(held.map((row2) => [String(row2.external_id), row2]));
|
|
42876
|
+
for (const stage of wanted) {
|
|
42877
|
+
const row2 = byId2.get(stage.externalId);
|
|
42878
|
+
if (row2)
|
|
42879
|
+
database.prepare("UPDATE pipeline_stages SET name = ?, name_folded = ?, position = ?, outcome = ?, updated_at = ? WHERE id = ?").run(stage.name, stage.folded, stage.position, stage.outcome, at, Number(row2.id));
|
|
42880
|
+
else
|
|
42881
|
+
database.prepare("INSERT INTO pipeline_stages (pipeline_id, name, name_folded, position, outcome, external_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(pipelineId, stage.name, stage.folded, stage.position, stage.outcome, stage.externalId, at, at);
|
|
42882
|
+
}
|
|
42883
|
+
}, "saveStages");
|
|
42884
|
+
const personIdOf = /* @__PURE__ */ __name((key2, externalId) => {
|
|
42885
|
+
const row2 = database.prepare("SELECT l.person_id FROM identities i JOIN identity_links l ON l.identity_id = i.id WHERE i.provider = ? AND i.external_id = ?").get(key2.provider, crmIdentityId(key2, externalId));
|
|
42886
|
+
return row2 ? Number(row2.person_id) : null;
|
|
42887
|
+
}, "personIdOf");
|
|
42888
|
+
const organizationIdOf = /* @__PURE__ */ __name((accountId, externalId) => {
|
|
42889
|
+
const row2 = database.prepare("SELECT entity_id FROM records WHERE account_id = ? AND type = 'organization' AND external_id = ? AND entity_type = 'organization'").get(accountId, externalId);
|
|
42890
|
+
return row2?.entity_id == null ? null : Number(row2.entity_id);
|
|
42891
|
+
}, "organizationIdOf");
|
|
42892
|
+
const saveItem = /* @__PURE__ */ __name((key2, accountId, kind4, item, at) => {
|
|
42893
|
+
const pipeline = pipelineOf(accountId, kind4, item.pipeline);
|
|
42894
|
+
const stage = pipeline && database.prepare("SELECT id, outcome FROM pipeline_stages WHERE pipeline_id = ? AND external_id = ?").get(Number(pipeline.id), item.stage);
|
|
42895
|
+
if (!pipeline || !stage)
|
|
42896
|
+
return {
|
|
42897
|
+
externalId: item.externalId,
|
|
42898
|
+
reason: "crm.stage-unknown",
|
|
42899
|
+
message: `${kind4} ${item.externalId} stands in stage ${item.stage} of pipeline ${item.pipeline}, which is not stored`
|
|
42900
|
+
};
|
|
42901
|
+
const title = textOf3(item.title, 200) ?? `${kind4} ${item.externalId}`;
|
|
42902
|
+
const given = item.amount != null && item.currency != null;
|
|
42903
|
+
const currency = given ? currencyOf(item.currency) : null;
|
|
42904
|
+
const amount = currency === null ? null : minorUnits(String(item.amount), currency, `${kind4} ${item.externalId}'s amount`);
|
|
42905
|
+
if (amount !== null && amount < 0)
|
|
42906
|
+
throw new CliError("validation_error", "an amount is 0 or more");
|
|
42907
|
+
if (item.status != null && !STAGE_OUTCOMES.includes(item.status))
|
|
42908
|
+
throw new CliError("validation_error", `${kind4} ${item.externalId}'s status is open, won or lost`);
|
|
42909
|
+
const status = item.status ?? String(stage.outcome);
|
|
42910
|
+
const closed = status === "open" ? null : day(item.closedDate, "a closed day") ?? new Date(epoch(item.updatedAt, at)).toISOString().slice(0, 10);
|
|
42911
|
+
const deal = kind4 === "lead" && item.deal ? database.prepare("SELECT id FROM deals WHERE account_id = ? AND external_id = ?").get(accountId, item.deal) : void 0;
|
|
42912
|
+
const metadata3 = { ...item.metadata ?? {}, ...item.url ? { url: item.url } : {} };
|
|
42913
|
+
const values = {
|
|
42914
|
+
title,
|
|
42915
|
+
organization: item.organization ? organizationIdOf(accountId, item.organization) : null,
|
|
42916
|
+
stage: Number(stage.id),
|
|
42917
|
+
status,
|
|
42918
|
+
currency,
|
|
42919
|
+
amount,
|
|
42920
|
+
close: day(item.closeDate, "an expected close day"),
|
|
42921
|
+
closed,
|
|
42922
|
+
metadata: Object.keys(metadata3).length ? JSON.stringify(metadata3) : null,
|
|
42923
|
+
created: epoch(item.createdAt, at),
|
|
42924
|
+
updated: epoch(item.updatedAt, at)
|
|
42925
|
+
};
|
|
42926
|
+
const table = TABLES[kind4];
|
|
42927
|
+
const held = database.prepare(`SELECT id FROM ${table} WHERE account_id = ? AND external_id = ?`).get(accountId, item.externalId);
|
|
42928
|
+
let id2;
|
|
42929
|
+
if (held) {
|
|
42930
|
+
id2 = Number(held.id);
|
|
42931
|
+
database.prepare(`UPDATE ${table} SET title = ?, organization_id = ?, stage_id = ?, status = ?, currency = ?, amount = ?, close_date = ?, closed_date = ?, metadata = ?, updated_at = ?, deleted_at = NULL` + (kind4 === "lead" ? ", deal_id = coalesce(?, deal_id)" : "") + " WHERE id = ?").run(values.title, values.organization, values.stage, values.status, values.currency, values.amount, values.close, values.closed, values.metadata, values.updated, ...kind4 === "lead" ? [deal ? Number(deal.id) : null] : [], id2);
|
|
42932
|
+
} else {
|
|
42933
|
+
const actor = author(key2);
|
|
42934
|
+
id2 = Number(database.prepare(`INSERT INTO ${table} (title, organization_id, stage_id, status, currency, amount, close_date, closed_date, account_id, external_id, author_type, author_id, source, metadata, created_at, updated_at` + (kind4 === "lead" ? ", deal_id" : "") + `) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?${kind4 === "lead" ? ", ?" : ""}) RETURNING id`).get(values.title, values.organization, values.stage, values.status, values.currency, values.amount, values.close, values.closed, accountId, item.externalId, actor.type, actor.id, SOURCE, values.metadata, values.created, values.updated, ...kind4 === "lead" ? [deal ? Number(deal.id) : null] : [])?.id);
|
|
42935
|
+
}
|
|
42936
|
+
database.prepare(`DELETE FROM links WHERE from_type = ? AND from_id = ? AND to_type = 'person' AND kind = ${linkKind("related-to")} AND source = ?`).run(kind4, id2, SOURCE);
|
|
42937
|
+
const link3 = database.prepare(`INSERT INTO links (from_type, from_id, to_type, to_id, kind, role, source, confirmed, created_at, author, updated_at) VALUES (?, ?, 'person', ?, ${linkKind("related-to")}, ?, ?, 1, ?, 'rule', ?)`);
|
|
42938
|
+
const seen = /* @__PURE__ */ new Set();
|
|
42939
|
+
for (const person2 of item.people ?? []) {
|
|
42940
|
+
const personId = personIdOf(key2, person2.externalId);
|
|
42941
|
+
const role = DEAL_ROLES.includes(person2.role) ? person2.role : "contact";
|
|
42942
|
+
if (personId === null || seen.has(personId))
|
|
42943
|
+
continue;
|
|
42944
|
+
seen.add(personId);
|
|
42945
|
+
link3.run(kind4, id2, personId, role, SOURCE, at, at);
|
|
42946
|
+
}
|
|
42947
|
+
return null;
|
|
42948
|
+
}, "saveItem");
|
|
42949
|
+
const saveItems = /* @__PURE__ */ __name((key2, kind4, items) => write(database, () => {
|
|
42950
|
+
const accountId = account(key2);
|
|
42951
|
+
const at = now2();
|
|
42952
|
+
const skipped = [];
|
|
42953
|
+
for (const item of items)
|
|
42954
|
+
try {
|
|
42955
|
+
const missing4 = saveItem(key2, accountId, kind4, item, at);
|
|
42956
|
+
if (missing4)
|
|
42957
|
+
skipped.push(missing4);
|
|
42958
|
+
} catch (error) {
|
|
42959
|
+
if (!(error instanceof CliError) || error.code !== "validation_error")
|
|
42960
|
+
throw error;
|
|
42961
|
+
skipped.push({ externalId: item.externalId, reason: "crm.item-invalid", message: error.message });
|
|
42962
|
+
}
|
|
42963
|
+
return { saved: items.length - skipped.length, skipped };
|
|
42964
|
+
}), "saveItems");
|
|
42965
|
+
const saveOrganizations = /* @__PURE__ */ __name((key2, organizations2) => write(database, () => {
|
|
42966
|
+
const accountId = account(key2);
|
|
42967
|
+
const at = now2();
|
|
42968
|
+
for (const organization2 of organizations2) {
|
|
42969
|
+
const name = textOf3(organization2.name, 200) ?? `${key2.provider} company ${organization2.externalId}`;
|
|
42970
|
+
const fields4 = {
|
|
42971
|
+
name,
|
|
42972
|
+
...organization2.url ? { url: organization2.url } : {},
|
|
42973
|
+
...organization2.metadata ?? {}
|
|
42974
|
+
};
|
|
42975
|
+
const fingerprint2 = recordFingerprint(fields4, []);
|
|
42976
|
+
const held = database.prepare("SELECT * FROM records WHERE account_id = ? AND type = 'organization' AND external_id = ?").get(accountId, organization2.externalId);
|
|
42977
|
+
const before2 = held ? JSON.parse(String(held.fields)).name : void 0;
|
|
42978
|
+
let entity = held?.entity_type === "organization" && held.entity_id != null ? Number(held.entity_id) : null;
|
|
42979
|
+
if (entity === null)
|
|
42980
|
+
entity = Number(database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES ('company', ?, 'work', ?, ?) RETURNING id").get(name, at, at)?.id);
|
|
42981
|
+
else if (before2 !== name)
|
|
42982
|
+
database.prepare("UPDATE organizations SET name = ?, updated_at = ? WHERE id = ? AND name = ?").run(name, at, entity, typeof before2 === "string" ? before2 : name);
|
|
42983
|
+
if (held)
|
|
42984
|
+
database.prepare("UPDATE records SET fields = ?, fingerprint = ?, entity_type = 'organization', entity_id = ?, projected_fingerprint = ?, batch_id = ?, updated_at = ?, deleted_at = NULL WHERE id = ?").run(JSON.stringify(fields4), fingerprint2, entity, fingerprint2, SOURCE, at, Number(held.id));
|
|
42985
|
+
else
|
|
42986
|
+
database.prepare("INSERT INTO records (account_id, type, external_id, fields, fingerprint, entity_type, entity_id, projected_fingerprint, batch_id, created_at, updated_at) VALUES (?, 'organization', ?, ?, ?, 'organization', ?, ?, ?, ?, ?)").run(accountId, organization2.externalId, JSON.stringify(fields4), fingerprint2, entity, fingerprint2, SOURCE, at, at);
|
|
42987
|
+
}
|
|
42988
|
+
return { saved: organizations2.length, skipped: [] };
|
|
42989
|
+
}), "saveOrganizations");
|
|
42990
|
+
const stored3 = /* @__PURE__ */ __name((key2, kind4) => {
|
|
42991
|
+
const accountId = findAccountPk(context, key2);
|
|
42992
|
+
if (accountId === void 0 || kind4 === "person")
|
|
42993
|
+
return [];
|
|
42994
|
+
return kind4 === "organization" ? database.prepare("SELECT id, external_id, updated_at FROM records WHERE account_id = ? AND type = 'organization' AND deleted_at IS NULL").all(accountId) : database.prepare(`SELECT id, external_id, updated_at FROM ${TABLES[kind4]} WHERE account_id = ? AND deleted_at IS NULL`).all(accountId);
|
|
42995
|
+
}, "stored");
|
|
42996
|
+
const markDeleted2 = /* @__PURE__ */ __name((kind4, ids) => {
|
|
42997
|
+
const table = kind4 === "organization" ? "records" : TABLES[kind4];
|
|
42998
|
+
const mark = database.prepare(`UPDATE ${table} SET deleted_at = ? WHERE id = ?`);
|
|
42999
|
+
const at = now2();
|
|
43000
|
+
for (const id2 of ids)
|
|
43001
|
+
mark.run(at, id2);
|
|
43002
|
+
return ids.length;
|
|
43003
|
+
}, "markDeleted");
|
|
43004
|
+
return {
|
|
43005
|
+
savePipelines: /* @__PURE__ */ __name(async (key2, kind4, pipelines2) => savePipelines(key2, kind4, pipelines2), "savePipelines"),
|
|
43006
|
+
saveItems: /* @__PURE__ */ __name(async (key2, kind4, items) => saveItems(key2, kind4, items), "saveItems"),
|
|
43007
|
+
savePeople: /* @__PURE__ */ __name(async (key2, contacts2) => {
|
|
43008
|
+
await people2.savePeople(key2, contacts2.map((contact) => ({
|
|
43009
|
+
id: crmIdentityId(key2, contact.externalId),
|
|
43010
|
+
name: textOf3(contact.name, 200),
|
|
43011
|
+
email: textOf3(contact.email, 320)?.toLowerCase() ?? null,
|
|
43012
|
+
phone: textOf3(contact.phone, 64)
|
|
43013
|
+
})));
|
|
43014
|
+
return { saved: contacts2.length, skipped: [] };
|
|
43015
|
+
}, "savePeople"),
|
|
43016
|
+
saveOrganizations: /* @__PURE__ */ __name(async (key2, organizations2) => saveOrganizations(key2, organizations2), "saveOrganizations"),
|
|
43017
|
+
remove: /* @__PURE__ */ __name(async (key2, kind4, externalIds) => write(database, () => {
|
|
43018
|
+
const gone = new Set(externalIds);
|
|
43019
|
+
return markDeleted2(kind4, stored3(key2, kind4).filter((row2) => gone.has(String(row2.external_id))).map((row2) => Number(row2.id)));
|
|
43020
|
+
}), "remove"),
|
|
43021
|
+
removeUnlisted: /* @__PURE__ */ __name(async (key2, kind4, listed, before2, { dryRun } = {}) => write(database, () => {
|
|
43022
|
+
const held = new Set(listed);
|
|
43023
|
+
const gone = stored3(key2, kind4).filter((row2) => !held.has(String(row2.external_id)) && Number(row2.updated_at) < before2).map((row2) => Number(row2.id));
|
|
43024
|
+
return dryRun ? gone.length : markDeleted2(kind4, gone);
|
|
43025
|
+
}), "removeUnlisted"),
|
|
43026
|
+
count: /* @__PURE__ */ __name(async (key2, kind4) => kind4 === "person" ? Number(database.prepare("SELECT count(*) AS n FROM identities WHERE provider = ? AND substr(external_id, 1, ?) = ?").get(key2.provider, key2.account.length + 1, `${key2.account}/`)?.n) : stored3(key2, kind4).length, "count")
|
|
43027
|
+
};
|
|
43028
|
+
}, "crmCopiesOver");
|
|
43029
|
+
|
|
43030
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
|
|
42525
43031
|
var refuse = /* @__PURE__ */ __name((message2, reason, code = "validation_error") => {
|
|
42526
43032
|
throw new CliError(code, message2, { reason });
|
|
42527
43033
|
}, "refuse");
|
|
@@ -42982,9 +43488,9 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
42982
43488
|
};
|
|
42983
43489
|
}, "financeStoreOver");
|
|
42984
43490
|
|
|
42985
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42986
|
-
var
|
|
42987
|
-
var itemsSql = /* @__PURE__ */ __name((kind4) => `SELECT d.*, s.name AS stage_name, s.pipeline_id, p.name AS pipeline_name, b.name AS author_name, b.kind AS author_kind, a.provider AS account_provider, a.external_id AS account_external_id FROM ${
|
|
43491
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
|
|
43492
|
+
var TABLES2 = { deal: "deals", lead: "leads" };
|
|
43493
|
+
var itemsSql = /* @__PURE__ */ __name((kind4) => `SELECT d.*, s.name AS stage_name, s.pipeline_id, p.name AS pipeline_name, b.name AS author_name, b.kind AS author_kind, a.provider AS account_provider, a.external_id AS account_external_id FROM ${TABLES2[kind4]} d JOIN pipeline_stages s ON s.id = d.stage_id JOIN pipelines p ON p.id = s.pipeline_id LEFT JOIN bots b ON d.author_type = 'bot' AND b.id = d.author_id LEFT JOIN accounts a ON a.id = d.account_id`, "itemsSql");
|
|
42988
43494
|
var MAX_STAGES = 30;
|
|
42989
43495
|
var MAX_PEOPLE = 20;
|
|
42990
43496
|
var iso9 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
@@ -43056,18 +43562,19 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43056
43562
|
const { kind: kind4, row: row2 } = rowOf2(reference2);
|
|
43057
43563
|
return itemOf(kind4)(row2);
|
|
43058
43564
|
}, "read");
|
|
43565
|
+
const inScope = /* @__PURE__ */ __name((scope3, row2) => scope3 === void 0 || (scope3 === "own" ? row2.account_id == null : row2.account_provider === scope3.provider && row2.account_external_id === scope3.account), "inScope");
|
|
43059
43566
|
const kindOf4 = /* @__PURE__ */ __name((kind4) => kind4 === void 0 ? "deal" : oneOf4(kind4, DEAL_KINDS, "a kind"), "kindOf");
|
|
43060
|
-
const pipelineRows = /* @__PURE__ */ __name((kind4) => database.prepare("SELECT p.*, a.provider AS account_provider, a.external_id AS account_external_id FROM pipelines p LEFT JOIN accounts a ON a.id = p.account_id WHERE (? IS NULL OR p.kind = ?) ORDER BY p.name_folded, p.id").all(kind4 ?? null, kind4 ?? null), "pipelineRows");
|
|
43567
|
+
const pipelineRows = /* @__PURE__ */ __name((kind4, scope3) => database.prepare("SELECT p.*, a.provider AS account_provider, a.external_id AS account_external_id FROM pipelines p LEFT JOIN accounts a ON a.id = p.account_id WHERE (? IS NULL OR p.kind = ?) ORDER BY p.name_folded, p.id").all(kind4 ?? null, kind4 ?? null).filter((row2) => inScope(scope3, row2)), "pipelineRows");
|
|
43061
43568
|
const label = /* @__PURE__ */ __name((row2) => `pipeline:${row2.id} (${row2.name}${row2.account_provider == null ? "" : `, ${row2.account_provider}:${row2.account_external_id}`})`, "label");
|
|
43062
|
-
const pipelineRow = /* @__PURE__ */ __name((reference2, kind4) => {
|
|
43569
|
+
const pipelineRow = /* @__PURE__ */ __name((reference2, kind4, scope3) => {
|
|
43063
43570
|
const named3 = reference2.trim();
|
|
43064
43571
|
if (/^pipeline:\d+$/.test(named3)) {
|
|
43065
|
-
const row2 = pipelineRows(kind4).find((one2) => `pipeline:${one2.id}` === named3);
|
|
43572
|
+
const row2 = pipelineRows(kind4, scope3).find((one2) => `pipeline:${one2.id}` === named3);
|
|
43066
43573
|
if (!row2)
|
|
43067
43574
|
throw new CliError("not_found", `no ${kind4 ?? ""} pipeline ${named3}`, { reason: "pipeline.not-found" });
|
|
43068
43575
|
return row2;
|
|
43069
43576
|
}
|
|
43070
|
-
const rows = pipelineRows(kind4).filter((one2) => one2.name_folded === fold(named3));
|
|
43577
|
+
const rows = pipelineRows(kind4, scope3).filter((one2) => one2.name_folded === fold(named3));
|
|
43071
43578
|
if (rows.length === 0)
|
|
43072
43579
|
throw new CliError("not_found", `no ${kind4 === void 0 ? "" : `${kind4} `}pipeline named ${named3}`, {
|
|
43073
43580
|
reason: "pipeline.not-found"
|
|
@@ -43097,7 +43604,7 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43097
43604
|
}));
|
|
43098
43605
|
}, "pipelinesOf");
|
|
43099
43606
|
const stageRow = /* @__PURE__ */ __name((stage, kind4, pipeline) => {
|
|
43100
|
-
const rows = database.prepare("SELECT s.*, p.name AS pipeline_name FROM pipeline_stages s JOIN pipelines p ON p.id = s.pipeline_id WHERE s.name_folded = ? AND p.kind = ? AND (? IS NULL OR p.id = ?) ORDER BY p.id").all(fold(stage.trim()), kind4, pipeline ?? null, pipeline ?? null);
|
|
43607
|
+
const rows = database.prepare("SELECT s.*, p.name AS pipeline_name FROM pipeline_stages s JOIN pipelines p ON p.id = s.pipeline_id WHERE s.name_folded = ? AND p.kind = ? AND (? IS NULL OR p.id = ?) AND (? IS NOT NULL OR p.account_id IS NULL) ORDER BY p.id").all(fold(stage.trim()), kind4, pipeline ?? null, pipeline ?? null, pipeline ?? null);
|
|
43101
43608
|
if (rows.length === 0)
|
|
43102
43609
|
return refuse(`no stage named ${stage} in ${pipeline === void 0 ? `a ${kind4} pipeline` : "that pipeline"}`, "deal.stage");
|
|
43103
43610
|
if (rows.length > 1)
|
|
@@ -43105,7 +43612,7 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43105
43612
|
return rows[0];
|
|
43106
43613
|
}, "stageRow");
|
|
43107
43614
|
const firstStage = /* @__PURE__ */ __name((kind4, pipeline) => {
|
|
43108
|
-
const pipelines2 = pipeline === void 0 ? pipelineRows(kind4) : [{ id: pipeline }];
|
|
43615
|
+
const pipelines2 = pipeline === void 0 ? pipelineRows(kind4, "own") : [{ id: pipeline }];
|
|
43109
43616
|
if (pipelines2.length !== 1)
|
|
43110
43617
|
return refuse(`name the stage: ${pipelines2.length === 0 ? `no ${kind4} pipeline is stored` : `more than one ${kind4} pipeline is stored`}`, "deal.stage");
|
|
43111
43618
|
const row2 = database.prepare("SELECT * FROM pipeline_stages WHERE pipeline_id = ? ORDER BY position, id LIMIT 1").get(Number(pipelines2[0]?.id));
|
|
@@ -43114,7 +43621,7 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43114
43621
|
const funnelOf = /* @__PURE__ */ __name((pipeline, since) => {
|
|
43115
43622
|
const kind4 = pipeline.kind;
|
|
43116
43623
|
const cutoff = since === null ? null : Date.parse(`${since}T00:00:00Z`);
|
|
43117
|
-
const items = database.prepare(`SELECT d.id, d.status, d.stage_id FROM ${
|
|
43624
|
+
const items = database.prepare(`SELECT d.id, d.status, d.stage_id FROM ${TABLES2[kind4]} d JOIN pipeline_stages s ON s.id = d.stage_id WHERE s.pipeline_id = ? AND d.deleted_at IS NULL AND (? IS NULL OR d.created_at >= ?)`).all(Number(pipeline.id), cutoff, cutoff);
|
|
43118
43625
|
const stages = database.prepare("SELECT id, position, outcome FROM pipeline_stages WHERE pipeline_id = ? ORDER BY position, id").all(Number(pipeline.id));
|
|
43119
43626
|
const order = new Map(stages.map((stage, at) => [Number(stage.id), at]));
|
|
43120
43627
|
const lostStage = new Set(stages.filter((stage) => stage.outcome === "lost").map((stage) => Number(stage.id)));
|
|
@@ -43153,11 +43660,13 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43153
43660
|
};
|
|
43154
43661
|
}, "funnelOf");
|
|
43155
43662
|
const setStage = /* @__PURE__ */ __name((kind4, id2, stage, status, date3) => {
|
|
43156
|
-
database.prepare(`UPDATE ${
|
|
43663
|
+
database.prepare(`UPDATE ${TABLES2[kind4]} SET stage_id = ?, status = ?, closed_date = ?, updated_at = ? WHERE id = ?`).run(Number(stage.id), status, status === "open" ? null : date3, now2(), id2);
|
|
43157
43664
|
}, "setStage");
|
|
43158
43665
|
const notDeleted = /* @__PURE__ */ __name((row2, kind4, what) => {
|
|
43159
43666
|
if (row2.deleted_at != null)
|
|
43160
43667
|
refuse(`${kind4}:${row2.id} is deleted; it no longer ${what}`, "deal.closed");
|
|
43668
|
+
if (row2.account_id != null)
|
|
43669
|
+
refuse(`${kind4}:${row2.id} is a copy from ${row2.account_provider}:${row2.account_external_id}; change it there, and its next sync brings the change here`, "deal.copy");
|
|
43161
43670
|
}, "notDeleted");
|
|
43162
43671
|
return {
|
|
43163
43672
|
addPipeline: /* @__PURE__ */ __name(({ name, kind: kind4, stages, by }) => {
|
|
@@ -43188,11 +43697,11 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43188
43697
|
});
|
|
43189
43698
|
return pipelinesOf(pipelineRows(pipelineKind).filter((row2) => Number(row2.id) === id2))[0];
|
|
43190
43699
|
}, "addPipeline"),
|
|
43191
|
-
pipelines: /* @__PURE__ */ __name((filter = {}) => pipelinesOf(pipelineRows(filter.kind === void 0 ? void 0 : kindOf4(filter.kind))), "pipelines"),
|
|
43700
|
+
pipelines: /* @__PURE__ */ __name((filter = {}) => pipelinesOf(pipelineRows(filter.kind === void 0 ? void 0 : kindOf4(filter.kind), filter.account)), "pipelines"),
|
|
43192
43701
|
pipeline: /* @__PURE__ */ __name((reference2, options = {}) => {
|
|
43193
43702
|
const kind4 = options.kind === void 0 ? void 0 : kindOf4(options.kind);
|
|
43194
43703
|
const since = isoDate(options.since, "the first day counted");
|
|
43195
|
-
return funnelOf(pipelinesOf([pipelineRow(reference2, kind4)])[0], since);
|
|
43704
|
+
return funnelOf(pipelinesOf([pipelineRow(reference2, kind4, options.account)])[0], since);
|
|
43196
43705
|
}, "pipeline"),
|
|
43197
43706
|
add: /* @__PURE__ */ __name((input) => {
|
|
43198
43707
|
const kind4 = kindOf4(input.kind);
|
|
@@ -43214,7 +43723,7 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43214
43723
|
if (!Array.isArray(evidence) || evidence.length > 8)
|
|
43215
43724
|
refuse("evidence is at most 8 references", "deal.field");
|
|
43216
43725
|
const id2 = write(database, () => {
|
|
43217
|
-
const pipeline = input.pipeline === void 0 ? void 0 : Number(pipelineRow(input.pipeline, kind4).id);
|
|
43726
|
+
const pipeline = input.pipeline === void 0 ? void 0 : Number(pipelineRow(input.pipeline, kind4, "own").id);
|
|
43218
43727
|
const stageText = text3(input.stage, "a stage's name", 80);
|
|
43219
43728
|
const stage = stageText === null ? kind4 === "lead" ? firstStage(kind4, pipeline) : refuse("a deal starts in a stage", "deal.field") : stageRow(stageText, kind4, pipeline);
|
|
43220
43729
|
const status = stage.outcome ?? "open";
|
|
@@ -43229,7 +43738,7 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43229
43738
|
});
|
|
43230
43739
|
const { actor, model } = authorActor(context, input.by);
|
|
43231
43740
|
const at = now2();
|
|
43232
|
-
const made = Number(database.prepare(`INSERT INTO ${
|
|
43741
|
+
const made = Number(database.prepare(`INSERT INTO ${TABLES2[kind4]} (title, organization_id, project_id, stage_id, status, currency, amount, close_date, closed_date, author_type, author_id, model, source, metadata, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id`).get(title, organization2?.id ?? null, input.project === void 0 ? null : projectId(database, input.project), Number(stage.id), status, currency, amount, closeDate, status === "open" ? null : today(), actor.type, actor.id, model, source2, reason === null ? null : JSON.stringify({ reason }), at, at)?.id);
|
|
43233
43742
|
const link3 = database.prepare(`INSERT INTO links (from_type, from_id, to_type, to_id, kind, role, source, confirmed, created_at, author, updated_at) VALUES (?, ?, 'person', ?, ${linkKind("related-to")}, ?, ?, 1, ?, ?, ?)`);
|
|
43234
43743
|
for (const person2 of persons2)
|
|
43235
43744
|
link3.run(kind4, made, person2.id, person2.role, owner ? "owner" : "suggested", at, owner ? "owner" : "agent", at);
|
|
@@ -43247,9 +43756,13 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43247
43756
|
const by = proposedBySql("d.author_type", "d.author_id", filter.proposedBy);
|
|
43248
43757
|
const status = filter.status === void 0 ? null : oneOf4(filter.status, DEAL_STATUSES, "a status");
|
|
43249
43758
|
const stage = filter.stage === void 0 ? null : fold(filter.stage.trim());
|
|
43250
|
-
const pipeline = filter.pipeline === void 0 ? null : Number(pipelineRow(filter.pipeline, kind4).id);
|
|
43759
|
+
const pipeline = filter.pipeline === void 0 ? null : Number(pipelineRow(filter.pipeline, kind4, filter.account).id);
|
|
43760
|
+
const scope3 = filter.account;
|
|
43761
|
+
const own = scope3 === "own" ? 1 : 0;
|
|
43762
|
+
const provider = scope3 === void 0 || scope3 === "own" ? null : scope3.provider;
|
|
43763
|
+
const account = scope3 === void 0 || scope3 === "own" ? null : scope3.account;
|
|
43251
43764
|
const limit = Math.min(Math.max(filter.limit ?? 100, 1), 500);
|
|
43252
|
-
return database.prepare(`${itemsSql(kind4)} WHERE d.deleted_at IS NULL AND (? IS NULL OR d.status = ?) AND (? IS NULL OR d.project_id = ?) AND (? IS NULL OR s.name_folded = ?) AND (? IS NULL OR p.id = ?) AND (? IS NULL OR d.organization_id = ?) AND ${by.sql} ORDER BY d.created_at DESC, d.id DESC LIMIT ?`).all(status, status, project2, project2, stage, stage, pipeline, pipeline, organization2?.id ?? null, organization2?.id ?? null, ...by.params, limit).map(itemOf(kind4));
|
|
43765
|
+
return database.prepare(`${itemsSql(kind4)} WHERE d.deleted_at IS NULL AND (? IS NULL OR d.status = ?) AND (? IS NULL OR d.project_id = ?) AND (? IS NULL OR s.name_folded = ?) AND (? IS NULL OR p.id = ?) AND (? IS NULL OR d.organization_id = ?) AND (? = 0 OR d.account_id IS NULL) AND (? IS NULL OR (a.provider = ? AND a.external_id = ?)) AND ${by.sql} ORDER BY d.created_at DESC, d.id DESC LIMIT ? OFFSET ?`).all(status, status, project2, project2, stage, stage, pipeline, pipeline, organization2?.id ?? null, organization2?.id ?? null, own, provider, provider, account, ...by.params, limit, Math.max(0, Math.trunc(filter.offset ?? 0))).map(itemOf(kind4));
|
|
43253
43766
|
}, "list"),
|
|
43254
43767
|
find: /* @__PURE__ */ __name(({ words: words3, anyWord, accounts: accounts2, limit }) => {
|
|
43255
43768
|
const wanted = [...new Set(words3.map((word2) => fold(word2).trim()).filter(Boolean))];
|
|
@@ -43257,7 +43770,7 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43257
43770
|
return [];
|
|
43258
43771
|
const most2 = Math.min(Math.max(limit ?? 100, 1), 500);
|
|
43259
43772
|
const within = accounts2?.map(({ provider, account }) => `${provider}\0${account}`);
|
|
43260
|
-
const found2 = DEAL_KINDS.flatMap((kind4) => database.prepare(`SELECT d.id, d.title, d.updated_at, a.provider, a.external_id AS account FROM ${
|
|
43773
|
+
const found2 = DEAL_KINDS.flatMap((kind4) => database.prepare(`SELECT d.id, d.title, d.updated_at, a.provider, a.external_id AS account FROM ${TABLES2[kind4]} d LEFT JOIN accounts a ON a.id = d.account_id WHERE d.deleted_at IS NULL`).all().filter((row2) => within === void 0 || within.includes(`${row2.provider}\0${row2.account}`)).map((row2) => {
|
|
43261
43774
|
const title = fold(String(row2.title));
|
|
43262
43775
|
return { kind: kind4, row: row2, score: wanted.filter((word2) => title.includes(word2)).length };
|
|
43263
43776
|
}).filter(({ score }) => anyWord ? score > 0 : score === wanted.length));
|
|
@@ -43274,15 +43787,15 @@ var dealOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
43274
43787
|
close: /* @__PURE__ */ __name((reference2, { status, date: date3, reason, by }) => {
|
|
43275
43788
|
authorActor(context, by);
|
|
43276
43789
|
const outcome = oneOf4(status, ["won", "lost"], "a closed status");
|
|
43277
|
-
const
|
|
43790
|
+
const day2 = isoDate(date3, "the day it closed") ?? today();
|
|
43278
43791
|
const why = text3(reason, "why it closed", 2e3);
|
|
43279
43792
|
const { kind: kind4, row: row2 } = rowOf2(reference2);
|
|
43280
43793
|
notDeleted(row2, kind4, "closes");
|
|
43281
43794
|
const stage = database.prepare("SELECT * FROM pipeline_stages WHERE pipeline_id = ? AND outcome = ? ORDER BY position, id LIMIT 1").get(Number(row2.pipeline_id), outcome) ?? { id: row2.stage_id };
|
|
43282
43795
|
write(database, () => {
|
|
43283
|
-
setStage(kind4, Number(row2.id), stage, outcome,
|
|
43796
|
+
setStage(kind4, Number(row2.id), stage, outcome, day2);
|
|
43284
43797
|
if (why !== null)
|
|
43285
|
-
database.prepare(`UPDATE ${
|
|
43798
|
+
database.prepare(`UPDATE ${TABLES2[kind4]} SET metadata = json_set(coalesce(metadata, '{}'), '$.closed_reason', ?) WHERE id = ?`).run(why, Number(row2.id));
|
|
43286
43799
|
});
|
|
43287
43800
|
return read2(`${kind4}:${row2.id}`);
|
|
43288
43801
|
}, "close")
|
|
@@ -43303,7 +43816,7 @@ var dealsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
43303
43816
|
};
|
|
43304
43817
|
}, "dealsStoreOver");
|
|
43305
43818
|
|
|
43306
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43819
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
|
|
43307
43820
|
var NOTE_FIELDS = [
|
|
43308
43821
|
"text",
|
|
43309
43822
|
"exact",
|
|
@@ -43613,7 +44126,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
43613
44126
|
drain();
|
|
43614
44127
|
const scope3 = live2(void 0, void 0);
|
|
43615
44128
|
const texts2 = /* @__PURE__ */ new Map();
|
|
43616
|
-
const
|
|
44129
|
+
const textOf6 = /* @__PURE__ */ __name((owner) => {
|
|
43617
44130
|
if (!texts2.has(owner)) {
|
|
43618
44131
|
const [type, id2] = owner.split(":");
|
|
43619
44132
|
const note2 = read2(String(type), Number(id2));
|
|
@@ -43626,7 +44139,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
43626
44139
|
WHERE k.content_hash > ?${scope3.sql}
|
|
43627
44140
|
AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
|
|
43628
44141
|
GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
|
|
43629
|
-
const text6 =
|
|
44142
|
+
const text6 = textOf6(String(row2.owner));
|
|
43630
44143
|
return text6 === void 0 ? [] : [{ hash: String(row2.hash), text: text6.slice(Number(row2.start), Number(row2.end)) }];
|
|
43631
44144
|
});
|
|
43632
44145
|
}, "chunksToEmbed"),
|
|
@@ -43733,7 +44246,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
43733
44246
|
};
|
|
43734
44247
|
}, "noteSearchOver");
|
|
43735
44248
|
|
|
43736
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44249
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
|
|
43737
44250
|
var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
|
|
43738
44251
|
var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
|
|
43739
44252
|
var EVENT_CORPUS = {
|
|
@@ -43865,7 +44378,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
43865
44378
|
};
|
|
43866
44379
|
}, "eventSearchOver");
|
|
43867
44380
|
|
|
43868
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44381
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
|
|
43869
44382
|
var refuse2 = /* @__PURE__ */ __name((message2, reason) => {
|
|
43870
44383
|
throw new CliError("validation_error", message2, { reason });
|
|
43871
44384
|
}, "refuse");
|
|
@@ -43943,7 +44456,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
|
|
|
43943
44456
|
};
|
|
43944
44457
|
}, "paymentEntriesOver");
|
|
43945
44458
|
|
|
43946
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44459
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
|
|
43947
44460
|
var EVIDENCE_FINDINGS_KIND = "evidence_findings";
|
|
43948
44461
|
var reference = /* @__PURE__ */ __name((raw) => {
|
|
43949
44462
|
if (/^(document|note):[1-9]\d*$/.test(raw))
|
|
@@ -43969,7 +44482,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
|
|
|
43969
44482
|
return valid;
|
|
43970
44483
|
}, "validateEvidenceFindings");
|
|
43971
44484
|
|
|
43972
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44485
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/domain/moment.js
|
|
43973
44486
|
var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
|
|
43974
44487
|
try {
|
|
43975
44488
|
return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
|
|
@@ -43981,7 +44494,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
|
|
|
43981
44494
|
}
|
|
43982
44495
|
}, "calendarMoment");
|
|
43983
44496
|
|
|
43984
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44497
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
|
|
43985
44498
|
var NAMED3 = "SELECT f.*, b.name AS author_name, b.kind AS author_kind FROM facts f LEFT JOIN bots b ON f.author_type = 'bot' AND b.id = f.author_id";
|
|
43986
44499
|
var iso10 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
43987
44500
|
var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -44190,13 +44703,13 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44190
44703
|
};
|
|
44191
44704
|
}, "factsStoreOver");
|
|
44192
44705
|
|
|
44193
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44194
|
-
var
|
|
44706
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
|
|
44707
|
+
var invalid5 = /* @__PURE__ */ __name((message2) => {
|
|
44195
44708
|
throw new CliError("validation_error", message2);
|
|
44196
44709
|
}, "invalid");
|
|
44197
44710
|
var findingsAgent = /* @__PURE__ */ __name((agent) => {
|
|
44198
44711
|
if (!agent || typeof agent.bot !== "string" || !agent.bot.trim() || agent.bot.length > 200 || agent.bot === "owner" || agent.model !== void 0 && (typeof agent.model !== "string" || agent.model.length > 200))
|
|
44199
|
-
return
|
|
44712
|
+
return invalid5("findings must name an agent author independently of their payload");
|
|
44200
44713
|
return { bot: agent.bot, ...agent.model === void 0 ? {} : { model: agent.model } };
|
|
44201
44714
|
}, "findingsAgent");
|
|
44202
44715
|
var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
|
|
@@ -44211,7 +44724,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
|
|
|
44211
44724
|
if (finding.project !== void 0) {
|
|
44212
44725
|
const project2 = requiredThing(database, finding.project, "the project");
|
|
44213
44726
|
if (project2.type !== "project")
|
|
44214
|
-
return
|
|
44727
|
+
return invalid5("a finding needs an owner project");
|
|
44215
44728
|
const projectRow = database.prepare("SELECT id,key,name,description,type,scope,updated_at FROM projects WHERE id=? AND account_id IS NULL AND deleted_at IS NULL").get(project2.id);
|
|
44216
44729
|
if (!projectRow)
|
|
44217
44730
|
throw new CliError("not_found", "the owner project is unavailable");
|
|
@@ -44223,7 +44736,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
|
|
|
44223
44736
|
if (finding.kind === "task" && finding.assignee) {
|
|
44224
44737
|
const person2 = requiredThing(database, finding.assignee, "the assignee");
|
|
44225
44738
|
if (person2.type !== "person")
|
|
44226
|
-
return
|
|
44739
|
+
return invalid5("the assignee must be a stored person");
|
|
44227
44740
|
const personRow = database.prepare("SELECT id,name,updated_at FROM persons WHERE id=?").get(person2.id);
|
|
44228
44741
|
if (!personRow)
|
|
44229
44742
|
throw new CliError("not_found", "the assignee is unavailable");
|
|
@@ -44256,7 +44769,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
|
|
|
44256
44769
|
if (finding.kind === "payment")
|
|
44257
44770
|
return recordPayment({ ...finding, evidence }, agent, { confirm: true, by: decidedBy });
|
|
44258
44771
|
if (finding.project === void 0)
|
|
44259
|
-
return
|
|
44772
|
+
return invalid5("a task finding names the project the task goes in");
|
|
44260
44773
|
const task = tasks2.create({
|
|
44261
44774
|
project: finding.project,
|
|
44262
44775
|
title: finding.title,
|
|
@@ -44279,7 +44792,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
|
|
|
44279
44792
|
const prior = previous(account, fingerprint2);
|
|
44280
44793
|
if (prior) {
|
|
44281
44794
|
if (accepted.includes(finding.id) && prior.status === "rejected")
|
|
44282
|
-
return
|
|
44795
|
+
return invalid5("this unchanged finding was already rejected; changed evidence needs a new candidate");
|
|
44283
44796
|
return { ...prior, id: finding.id, reused: true };
|
|
44284
44797
|
}
|
|
44285
44798
|
const status = accepted.includes(finding.id) ? "accepted" : "rejected";
|
|
@@ -44294,7 +44807,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
|
|
|
44294
44807
|
return { snapshot: snapshot2, snapshotParts, previous, outcomes, create };
|
|
44295
44808
|
}, "findingsCoreOver");
|
|
44296
44809
|
|
|
44297
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44810
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
|
|
44298
44811
|
var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
|
|
44299
44812
|
var PROPOSAL_VERDICTS = ["useful", "not_useful"];
|
|
44300
44813
|
var iso11 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
@@ -44459,13 +44972,13 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44459
44972
|
};
|
|
44460
44973
|
}, "proposedActionsStoreOver");
|
|
44461
44974
|
|
|
44462
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44975
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
|
|
44463
44976
|
var stale = /* @__PURE__ */ __name(() => {
|
|
44464
44977
|
throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
|
|
44465
44978
|
reason: "evidence-findings.stale"
|
|
44466
44979
|
});
|
|
44467
44980
|
}, "stale");
|
|
44468
|
-
var
|
|
44981
|
+
var invalid6 = /* @__PURE__ */ __name((message2) => {
|
|
44469
44982
|
throw new CliError("validation_error", message2);
|
|
44470
44983
|
}, "invalid");
|
|
44471
44984
|
var TEXT_BUDGET = 262144;
|
|
@@ -44475,19 +44988,19 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44475
44988
|
const core = findingsCoreOver(context, EVIDENCE_FINDINGS_KIND);
|
|
44476
44989
|
const load = /* @__PURE__ */ __name((id2) => {
|
|
44477
44990
|
if (typeof id2 !== "string" || !/^[1-9]\d*$/.test(id2) || !Number.isSafeInteger(Number(id2)))
|
|
44478
|
-
return
|
|
44991
|
+
return invalid6("a findings batch needs a stored ID");
|
|
44479
44992
|
const row2 = database.prepare("SELECT length(CAST(payload AS BLOB)) AS bytes,length(CAST(result AS BLOB)) AS result_bytes FROM proposed_actions WHERE id=? AND account_id IS NULL AND kind=?").get(Number(id2), EVIDENCE_FINDINGS_KIND);
|
|
44480
44993
|
if (!row2)
|
|
44481
44994
|
throw new CliError("not_found", "the evidence findings batch is unavailable");
|
|
44482
44995
|
if (Number(row2.bytes) > 1e5 || Number(row2.result_bytes) > 65536)
|
|
44483
|
-
return
|
|
44996
|
+
return invalid6("stored findings exceed the read budget");
|
|
44484
44997
|
return proposals.get(id2);
|
|
44485
44998
|
}, "load");
|
|
44486
44999
|
const projectOf2 = /* @__PURE__ */ __name((input) => input.findings.find((finding) => finding.project)?.project ?? null, "projectOf");
|
|
44487
45000
|
const view = /* @__PURE__ */ __name((proposal) => {
|
|
44488
45001
|
const input = proposal.payload;
|
|
44489
45002
|
if (!input || !["proposed", "approved", "rejected"].includes(proposal.status))
|
|
44490
|
-
return
|
|
45003
|
+
return invalid6("invalid stored findings batch");
|
|
44491
45004
|
return {
|
|
44492
45005
|
id: proposal.id,
|
|
44493
45006
|
project: projectOf2(input),
|
|
@@ -44518,7 +45031,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44518
45031
|
return stale();
|
|
44519
45032
|
readBytes += Buffer.byteLength(record4.text) + Buffer.byteLength(record4.title ?? "");
|
|
44520
45033
|
if (readBytes > TEXT_BUDGET)
|
|
44521
|
-
return
|
|
45034
|
+
return invalid6(`finding evidence exceeds the ${TEXT_BUDGET}-byte stored text budget`);
|
|
44522
45035
|
const fingerprint2 = contextEvidenceFingerprint(record4);
|
|
44523
45036
|
if (fingerprint2 !== evidence.fingerprint)
|
|
44524
45037
|
return stale();
|
|
@@ -44530,14 +45043,14 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44530
45043
|
if (by === "owner")
|
|
44531
45044
|
return { author: "owner", decision: { by: "owner" } };
|
|
44532
45045
|
if (by === void 0)
|
|
44533
|
-
return
|
|
45046
|
+
return invalid6("a findings review names who decides: the owner or an agent with a reason");
|
|
44534
45047
|
const raw = by;
|
|
44535
45048
|
const agent = findingsAgent({
|
|
44536
45049
|
bot: raw.bot,
|
|
44537
45050
|
...raw.model === void 0 ? {} : { model: raw.model }
|
|
44538
45051
|
});
|
|
44539
45052
|
if (typeof raw.reason !== "string" || !raw.reason.trim() || raw.reason.length > 2e3)
|
|
44540
|
-
return
|
|
45053
|
+
return invalid6("an agent deciding for the owner gives a reason of 1\u20132000 characters");
|
|
44541
45054
|
return {
|
|
44542
45055
|
author: agent,
|
|
44543
45056
|
decision: { by: "agent", bot: agent.bot, model: agent.model ?? null, reason: raw.reason.trim() }
|
|
@@ -44548,7 +45061,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44548
45061
|
const input = validateEvidenceFindings(raw);
|
|
44549
45062
|
const projects2 = new Set(input.findings.flatMap((finding) => finding.project ?? []));
|
|
44550
45063
|
if (projects2.size > 1)
|
|
44551
|
-
return
|
|
45064
|
+
return invalid6("an evidence findings batch is about one project at most");
|
|
44552
45065
|
const subjects = new Set(input.findings.map((finding) => finding.subject));
|
|
44553
45066
|
const shared = subjects.size === 1 ? [...subjects][0] : void 0;
|
|
44554
45067
|
const target = shared ?? [...projects2][0];
|
|
@@ -44560,14 +45073,14 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44560
45073
|
if (held) {
|
|
44561
45074
|
const proposal = load(String(held.id));
|
|
44562
45075
|
if (proposal.payload.inputHash !== inputHash)
|
|
44563
|
-
return
|
|
45076
|
+
return invalid6("the findings batch key was already used for different input");
|
|
44564
45077
|
return view(proposal);
|
|
44565
45078
|
}
|
|
44566
45079
|
const snapshotHash = snapshot2(input);
|
|
44567
45080
|
const snapshotParts = core.snapshotParts(input, cite());
|
|
44568
45081
|
const fingerprints = input.findings.map(findingFingerprint);
|
|
44569
45082
|
if (new Set(fingerprints).size !== fingerprints.length)
|
|
44570
|
-
return
|
|
45083
|
+
return invalid6("the batch contains duplicate findings");
|
|
44571
45084
|
return view(proposals.propose({
|
|
44572
45085
|
kind: EVIDENCE_FINDINGS_KIND,
|
|
44573
45086
|
by,
|
|
@@ -44580,12 +45093,12 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44580
45093
|
sources: /* @__PURE__ */ __name(async (id2) => sourcesOfReferences(database, view(load(id2)).input.findings.flatMap((finding) => finding.evidence.map((one2) => one2.reference))), "sources"),
|
|
44581
45094
|
list: /* @__PURE__ */ __name(async ({ project: project2, limit = 20, offset = 0, status } = {}) => {
|
|
44582
45095
|
if (status !== void 0 && status !== "proposed" && status !== "reviewed")
|
|
44583
|
-
return
|
|
45096
|
+
return invalid6("finding status is proposed or reviewed");
|
|
44584
45097
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50 || !Number.isSafeInteger(offset) || offset < 0)
|
|
44585
|
-
return
|
|
45098
|
+
return invalid6("findings lists take 1\u201350 items and a nonnegative offset");
|
|
44586
45099
|
const projectId2 = project2 === void 0 ? null : /^project:([1-9]\d*)$/.exec(project2)?.[1];
|
|
44587
45100
|
if (projectId2 === void 0)
|
|
44588
|
-
return
|
|
45101
|
+
return invalid6("a findings list filters by a project reference");
|
|
44589
45102
|
const ids = database.prepare("SELECT id FROM proposed_actions WHERE account_id IS NULL AND kind=? AND (? IS NULL OR (target_type='project' AND target_id=?) OR EXISTS (SELECT 1 FROM json_each(payload,'$.findings') f WHERE json_extract(f.value,'$.project')=?)) AND (? IS NULL OR status=?) ORDER BY id DESC LIMIT ? OFFSET ?").all(EVIDENCE_FINDINGS_KIND, projectId2, projectId2 === null ? null : Number(projectId2), projectId2 === null ? null : `project:${projectId2}`, status ?? null, status === "reviewed" ? "approved" : status ?? null, limit + 1, offset);
|
|
44590
45103
|
return { items: ids.slice(0, limit).map((row2) => view(load(String(row2.id)))), hasMore: ids.length > limit };
|
|
44591
45104
|
}, "list"),
|
|
@@ -44595,7 +45108,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44595
45108
|
if (!decision || typeof decision.fingerprint !== "string" || decision.fingerprint !== batch.fingerprint)
|
|
44596
45109
|
return stale();
|
|
44597
45110
|
if (!Array.isArray(decision.accept) || decision.accept.length > 16 || new Set(decision.accept).size !== decision.accept.length || decision.accept.some((candidate) => !batch.input.findings.some((finding) => finding.id === candidate)))
|
|
44598
|
-
return
|
|
45111
|
+
return invalid6("accept only unique IDs shown in this batch");
|
|
44599
45112
|
const accepted = [...decision.accept].sort();
|
|
44600
45113
|
const { author, decision: checked } = decider(decision.by);
|
|
44601
45114
|
const reason = typeof decision.reason === "string" ? decision.reason.trim().slice(0, 2e3) : "";
|
|
@@ -44607,7 +45120,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44607
45120
|
}, decision.by, context.decisions);
|
|
44608
45121
|
if (batch.receipt) {
|
|
44609
45122
|
if (JSON.stringify(batch.receipt.accepted) !== JSON.stringify(accepted))
|
|
44610
|
-
return
|
|
45123
|
+
return invalid6("this findings batch was already reviewed with a different decision");
|
|
44611
45124
|
return batch;
|
|
44612
45125
|
}
|
|
44613
45126
|
const input = proposal.payload;
|
|
@@ -44624,7 +45137,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44624
45137
|
}
|
|
44625
45138
|
}
|
|
44626
45139
|
if (proposal.proposedBy.type !== "bot" || !proposal.proposedBy.name)
|
|
44627
|
-
return
|
|
45140
|
+
return invalid6("a findings author must be an agent");
|
|
44628
45141
|
const agent = {
|
|
44629
45142
|
bot: proposal.proposedBy.name,
|
|
44630
45143
|
...input.agentModel === null ? {} : { model: input.agentModel }
|
|
@@ -44640,7 +45153,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44640
45153
|
};
|
|
44641
45154
|
}, "evidenceFindingsStoreOver");
|
|
44642
45155
|
|
|
44643
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45156
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
|
|
44644
45157
|
var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
|
|
44645
45158
|
var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
|
|
44646
45159
|
rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
|
|
@@ -44693,8 +45206,8 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
44693
45206
|
}, "forPerson")
|
|
44694
45207
|
}), "involvementStoreOver");
|
|
44695
45208
|
|
|
44696
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44697
|
-
import { createHash as
|
|
45209
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
|
|
45210
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
44698
45211
|
var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
|
|
44699
45212
|
var id = /* @__PURE__ */ __name((value) => {
|
|
44700
45213
|
if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
@@ -44723,7 +45236,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
44723
45236
|
project: `project:${row2.to_id}`,
|
|
44724
45237
|
confirmed: Number(row2.confirmed) === 1,
|
|
44725
45238
|
provenance: row2.evidence == null ? null : String(row2.evidence),
|
|
44726
|
-
fingerprint:
|
|
45239
|
+
fingerprint: createHash13("sha256").update(JSON.stringify([row2.id, row2.from_id, row2.to_id, row2.source, row2.confirmed, row2.evidence, row2.updated_at])).digest("hex")
|
|
44727
45240
|
};
|
|
44728
45241
|
}, "linkOf");
|
|
44729
45242
|
return {
|
|
@@ -44779,7 +45292,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
44779
45292
|
};
|
|
44780
45293
|
}, "meetingProjectsStoreOver");
|
|
44781
45294
|
|
|
44782
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45295
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
|
|
44783
45296
|
var ORGANIZATIONS_QUERY = {
|
|
44784
45297
|
entity: "organization",
|
|
44785
45298
|
backend: "sql",
|
|
@@ -44820,7 +45333,7 @@ var REMINDERS_QUERY = {
|
|
|
44820
45333
|
})
|
|
44821
45334
|
};
|
|
44822
45335
|
|
|
44823
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45336
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
|
|
44824
45337
|
var organizationOf = /* @__PURE__ */ __name((row2) => ({
|
|
44825
45338
|
id: String(row2.id),
|
|
44826
45339
|
ref: `organization:${row2.id}`,
|
|
@@ -44853,7 +45366,7 @@ var organizationsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) =>
|
|
|
44853
45366
|
}), "updateOrganization")
|
|
44854
45367
|
}), "organizationsStoreOver");
|
|
44855
45368
|
|
|
44856
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45369
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
|
|
44857
45370
|
var relationOf = /* @__PURE__ */ __name((link3) => ({
|
|
44858
45371
|
id: link3.id,
|
|
44859
45372
|
from: link3.from,
|
|
@@ -45079,16 +45592,16 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
|
|
|
45079
45592
|
provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
|
|
45080
45593
|
}, "decidedOrigin");
|
|
45081
45594
|
|
|
45082
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45595
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
45596
|
+
import { createHash as createHash16 } from "node:crypto";
|
|
45597
|
+
|
|
45598
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
45083
45599
|
import { createHash as createHash15 } from "node:crypto";
|
|
45084
45600
|
|
|
45085
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45601
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
45086
45602
|
import { createHash as createHash14 } from "node:crypto";
|
|
45087
45603
|
|
|
45088
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45089
|
-
import { createHash as createHash13 } from "node:crypto";
|
|
45090
|
-
|
|
45091
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.589.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_0ee3f6df6a9715cc0d8fd3b6006034a9/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
|
|
45604
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
|
|
45092
45605
|
var consolidationId = /* @__PURE__ */ __name((value, field4) => {
|
|
45093
45606
|
if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
45094
45607
|
throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
|
|
@@ -45139,7 +45652,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
|
|
|
45139
45652
|
return input;
|
|
45140
45653
|
}, "consolidationApplyInput");
|
|
45141
45654
|
|
|
45142
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45655
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
45143
45656
|
var receiptOf = /* @__PURE__ */ __name((row2) => ({
|
|
45144
45657
|
id: String(row2.id),
|
|
45145
45658
|
sourceId: String(row2.source_id),
|
|
@@ -45163,7 +45676,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
|
|
|
45163
45676
|
check3();
|
|
45164
45677
|
return write(database, () => {
|
|
45165
45678
|
const owner = ownerPerson(database);
|
|
45166
|
-
const request =
|
|
45679
|
+
const request = createHash14("sha256").update(JSON.stringify([
|
|
45167
45680
|
source2,
|
|
45168
45681
|
survivor,
|
|
45169
45682
|
owner.type,
|
|
@@ -45214,7 +45727,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
|
|
|
45214
45727
|
}, { beforeCommit: check3 });
|
|
45215
45728
|
}, "applyTagConsolidation");
|
|
45216
45729
|
|
|
45217
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45730
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
45218
45731
|
var selections = [
|
|
45219
45732
|
["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
|
|
45220
45733
|
["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
|
|
@@ -45260,7 +45773,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
45260
45773
|
const memberIds = JSON.stringify([...sourceMemberIds, ...survivorMemberIds].map(Number));
|
|
45261
45774
|
const captured = JSON.stringify(graph);
|
|
45262
45775
|
let readBytes = Buffer.byteLength(captured);
|
|
45263
|
-
const hash2 =
|
|
45776
|
+
const hash2 = createHash15("sha256").update(JSON.stringify([source2, survivor, catalog.fingerprint, graph]));
|
|
45264
45777
|
for (const [table, where] of selections) {
|
|
45265
45778
|
cancelled(options);
|
|
45266
45779
|
const parameters = table === "links" ? [memberIds, memberIds] : [memberIds];
|
|
@@ -45358,7 +45871,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
45358
45871
|
};
|
|
45359
45872
|
}, "previewRows");
|
|
45360
45873
|
|
|
45361
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45874
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
45362
45875
|
var kinds = ["project", "tag", "topic"];
|
|
45363
45876
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
45364
45877
|
if (signal?.aborted)
|
|
@@ -45450,7 +45963,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
45450
45963
|
cancelled2(options.signal);
|
|
45451
45964
|
return {
|
|
45452
45965
|
entries,
|
|
45453
|
-
fingerprint: `v1:${options.kind ?? "all"}:${options.scope ?? "all"}:${
|
|
45966
|
+
fingerprint: `v1:${options.kind ?? "all"}:${options.scope ?? "all"}:${createHash16("sha256").update(JSON.stringify(entries)).digest("hex")}`,
|
|
45454
45967
|
coverage: { complete: true, maxEntries, maxReadBytes }
|
|
45455
45968
|
};
|
|
45456
45969
|
}), "catalog");
|
|
@@ -45622,7 +46135,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
45622
46135
|
};
|
|
45623
46136
|
}, "vocabularyStoreOver");
|
|
45624
46137
|
|
|
45625
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
46138
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
|
|
45626
46139
|
var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
|
|
45627
46140
|
var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
|
|
45628
46141
|
var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
|
|
@@ -45634,7 +46147,7 @@ var bounded2 = /* @__PURE__ */ __name((limit = 100, offset = 0) => {
|
|
|
45634
46147
|
throw new CliError("validation_error", "limit takes 1\u2013500 and offset takes 0\u2013100000");
|
|
45635
46148
|
return { limit, offset };
|
|
45636
46149
|
}, "bounded");
|
|
45637
|
-
var
|
|
46150
|
+
var textOf4 = /* @__PURE__ */ __name((text6, max = 1e5) => {
|
|
45638
46151
|
const value = text6.trim();
|
|
45639
46152
|
if (!value || value.length > max)
|
|
45640
46153
|
throw new CliError("validation_error", `text takes 1\u2013${max} characters`);
|
|
@@ -45862,7 +46375,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
45862
46375
|
return { items: rows.slice(0, limit).map((row2) => String(row2.id ?? row2.key)), hasMore: rows.length > limit };
|
|
45863
46376
|
}, "taskIds"),
|
|
45864
46377
|
addAnnotation: /* @__PURE__ */ __name(async (key2, target, text6) => {
|
|
45865
|
-
const body2 =
|
|
46378
|
+
const body2 = textOf4(text6);
|
|
45866
46379
|
if (subfolder(target) !== null)
|
|
45867
46380
|
throw new CliError("validation_error", "annotate a folder, not one of its subfolders");
|
|
45868
46381
|
const thing = available(key2, target);
|
|
@@ -45887,7 +46400,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
45887
46400
|
annotation: /* @__PURE__ */ __name(async (key2, id2) => annotation(key2, id2), "annotation"),
|
|
45888
46401
|
editAnnotation: /* @__PURE__ */ __name(async (key2, id2, text6, revision2) => {
|
|
45889
46402
|
const held = annotation(key2, id2);
|
|
45890
|
-
const changed = database.prepare("UPDATE notes SET body=?, revision=revision+1, updated_at=? WHERE id=? AND revision=?").run(
|
|
46403
|
+
const changed = database.prepare("UPDATE notes SET body=?, revision=revision+1, updated_at=? WHERE id=? AND revision=?").run(textOf4(text6), now2(), Number(id2), revision2).changes;
|
|
45891
46404
|
if (!changed)
|
|
45892
46405
|
throw new CliError("validation_error", "annotation changed; read the current revision before editing");
|
|
45893
46406
|
database.prepare("INSERT INTO note_revisions (note_id, body, revision, created_at) VALUES (?, ?, ?, ?)").run(Number(id2), held.text, held.revision, now2());
|
|
@@ -45960,11 +46473,11 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
45960
46473
|
}, "labelled"),
|
|
45961
46474
|
addOrganization: /* @__PURE__ */ __name(async ({ kind: kind4, name, scope: scope3 = "personal" }) => {
|
|
45962
46475
|
const at = now2();
|
|
45963
|
-
const row2 = database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?) RETURNING *").get(oneOf6(kind4, ORGANIZATION_KINDS, "an organization's kind"),
|
|
46476
|
+
const row2 = database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES (?, ?, ?, ?, ?) RETURNING *").get(oneOf6(kind4, ORGANIZATION_KINDS, "an organization's kind"), textOf4(name, 200), oneOf6(scope3, SCOPES, "a scope"), at, at);
|
|
45964
46477
|
return organizationOf(row2);
|
|
45965
46478
|
}, "addOrganization"),
|
|
45966
46479
|
addProject: /* @__PURE__ */ __name(async ({ name, key: key2, type = "other", organization: organization2, scope: scope3 = "personal", description }) => write(database, () => {
|
|
45967
|
-
const title =
|
|
46480
|
+
const title = textOf4(name, 200);
|
|
45968
46481
|
const organizationId = organization2 === void 0 ? null : (() => {
|
|
45969
46482
|
const thing = thingOf(database, organization2);
|
|
45970
46483
|
if (thing?.type !== "organization")
|
|
@@ -45999,7 +46512,7 @@ var knowledgeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
45999
46512
|
chosen = `${wanted.slice(0, 4 - suffix.length)}${suffix}`;
|
|
46000
46513
|
}
|
|
46001
46514
|
const at = now2();
|
|
46002
|
-
const row2 = database.prepare("INSERT INTO projects (key, name, name_folded, description, type, organization_id, scope, tasks_count, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'active', ?, ?) RETURNING *").get(chosen, title, fold(title), description === void 0 ? null :
|
|
46515
|
+
const row2 = database.prepare("INSERT INTO projects (key, name, name_folded, description, type, organization_id, scope, tasks_count, status, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'active', ?, ?) RETURNING *").get(chosen, title, fold(title), description === void 0 ? null : textOf4(description, 2e3), oneOf6(type, PROJECT_TYPES, "a project's type"), organizationId, oneOf6(scope3, SCOPES, "a scope"), at, at);
|
|
46003
46516
|
return projectOf2(row2);
|
|
46004
46517
|
}), "addProject"),
|
|
46005
46518
|
projects: /* @__PURE__ */ __name(async (query) => {
|
|
@@ -46163,7 +46676,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
|
|
|
46163
46676
|
return key2.padEnd(3, "X");
|
|
46164
46677
|
}, "projectKey");
|
|
46165
46678
|
|
|
46166
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
46679
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
|
|
46167
46680
|
var DAY5 = 864e5;
|
|
46168
46681
|
var SETTING4 = "logs_pruned_at";
|
|
46169
46682
|
var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
|
|
@@ -46190,10 +46703,10 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
|
|
|
46190
46703
|
};
|
|
46191
46704
|
}, "logPruner");
|
|
46192
46705
|
|
|
46193
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
46706
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/mail/findings.js
|
|
46194
46707
|
var MAIL_FINDINGS_PER_RUN = 30;
|
|
46195
46708
|
var MAIL_FINDINGS_PER_SENDER = 5;
|
|
46196
|
-
var
|
|
46709
|
+
var invalid7 = /* @__PURE__ */ __name((message2) => {
|
|
46197
46710
|
throw new CliError("validation_error", message2);
|
|
46198
46711
|
}, "invalid");
|
|
46199
46712
|
var emailEvidence = /* @__PURE__ */ __name((raw) => {
|
|
@@ -46203,7 +46716,7 @@ var emailEvidence = /* @__PURE__ */ __name((raw) => {
|
|
|
46203
46716
|
return formatLocator(locator2);
|
|
46204
46717
|
} catch {
|
|
46205
46718
|
}
|
|
46206
|
-
return
|
|
46719
|
+
return invalid7("mail finding evidence is a msg:email/\u2026 reference");
|
|
46207
46720
|
}, "emailEvidence");
|
|
46208
46721
|
var RULES = {
|
|
46209
46722
|
plural: "mail findings",
|
|
@@ -46309,16 +46822,16 @@ var PAYMENT = /^payment:[1-9]\d*$/;
|
|
|
46309
46822
|
var PROJECT = /^project:[1-9]\d*$/;
|
|
46310
46823
|
var oneOf7 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
46311
46824
|
if (typeof value !== "string" || !allowed.includes(value))
|
|
46312
|
-
return
|
|
46825
|
+
return invalid7(`${what} is ${allowed.join(", ")}`);
|
|
46313
46826
|
return value;
|
|
46314
46827
|
}, "oneOf");
|
|
46315
46828
|
var word = /* @__PURE__ */ __name((value, limit) => findingText(value, limit), "word");
|
|
46316
46829
|
var optional = /* @__PURE__ */ __name((key2, value, read2) => value === void 0 ? {} : { [key2]: read2(value) }, "optional");
|
|
46317
46830
|
var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
46318
46831
|
if (!raw || typeof raw !== "object")
|
|
46319
|
-
return
|
|
46832
|
+
return invalid7("a finding is an object");
|
|
46320
46833
|
if (!MAIL_FINDING_KINDS.includes(raw.kind))
|
|
46321
|
-
return
|
|
46834
|
+
return invalid7(`a mail finding is a ${MAIL_FINDING_KINDS.join(", ")}`);
|
|
46322
46835
|
const { needs, may } = MAIL_FINDING_FIELDS[raw.kind];
|
|
46323
46836
|
findingFields(raw, ["id", "kind", ...needs, ...may, "evidence"], RULES.singular);
|
|
46324
46837
|
findingNeeds(raw, needs, RULES.singular);
|
|
@@ -46343,21 +46856,21 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46343
46856
|
const reference2 = /* @__PURE__ */ __name((value, pattern, what) => {
|
|
46344
46857
|
const text6 = findingText(value, 400);
|
|
46345
46858
|
if (!pattern.test(text6))
|
|
46346
|
-
return
|
|
46859
|
+
return invalid7(`${what} is not a reference of the kind it takes: ${text6}`);
|
|
46347
46860
|
return text6;
|
|
46348
46861
|
}, "reference");
|
|
46349
46862
|
const party2 = /* @__PURE__ */ __name((field4, what) => {
|
|
46350
46863
|
const [given, name, email] = [raw[field4], raw[`${field4}Name`], raw[`${field4}Email`]];
|
|
46351
46864
|
if (given !== void 0 && name !== void 0)
|
|
46352
|
-
return
|
|
46865
|
+
return invalid7(`${what} is ${field4} or ${field4}_name, not both`);
|
|
46353
46866
|
if (email !== void 0 && name === void 0)
|
|
46354
|
-
return
|
|
46867
|
+
return invalid7(`${field4}_email comes with ${field4}_name`);
|
|
46355
46868
|
return {
|
|
46356
46869
|
...optional(field4, given, (value) => reference2(value, PARTY, what)),
|
|
46357
46870
|
...optional(`${field4}Name`, name, (value) => word(value, 200)),
|
|
46358
46871
|
...optional(`${field4}Email`, email, (value) => {
|
|
46359
46872
|
const address = findingText(value, 320).toLowerCase();
|
|
46360
|
-
return ADDRESS.test(address) ? address :
|
|
46873
|
+
return ADDRESS.test(address) ? address : invalid7(`${field4}_email is an email address`);
|
|
46361
46874
|
})
|
|
46362
46875
|
};
|
|
46363
46876
|
}, "party");
|
|
@@ -46366,11 +46879,11 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46366
46879
|
const task = reference2(raw.task, /^task:[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/, "a task update's task");
|
|
46367
46880
|
const change = raw.change;
|
|
46368
46881
|
if (change !== "close" && change !== "due" && change !== "detail")
|
|
46369
|
-
return
|
|
46882
|
+
return invalid7("a task update's change is close, due or detail");
|
|
46370
46883
|
if (change === "due" !== (raw.dueAt !== void 0))
|
|
46371
|
-
return
|
|
46884
|
+
return invalid7("a due change, and only it, gives due_at");
|
|
46372
46885
|
if (change === "detail" !== (raw.detail !== void 0))
|
|
46373
|
-
return
|
|
46886
|
+
return invalid7("a detail change, and only it, gives detail");
|
|
46374
46887
|
return {
|
|
46375
46888
|
id: id2,
|
|
46376
46889
|
kind: "task_update",
|
|
@@ -46384,11 +46897,11 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46384
46897
|
}
|
|
46385
46898
|
case "memory": {
|
|
46386
46899
|
if (!MEMORY_KINDS.includes(raw.memoryKind))
|
|
46387
|
-
return
|
|
46900
|
+
return invalid7(`a memory's memory_kind is ${MEMORY_KINDS.join(", ")}`);
|
|
46388
46901
|
if (!MEMORY_SCOPES.includes(raw.scope))
|
|
46389
|
-
return
|
|
46902
|
+
return invalid7("a memory's scope is personal or work");
|
|
46390
46903
|
if (raw.subject === void 0 && raw.project === void 0)
|
|
46391
|
-
return
|
|
46904
|
+
return invalid7("a memory is about a subject or a project");
|
|
46392
46905
|
return {
|
|
46393
46906
|
id: id2,
|
|
46394
46907
|
kind: "memory",
|
|
@@ -46406,13 +46919,13 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46406
46919
|
const to = findingText(raw.to, 80);
|
|
46407
46920
|
const wanted = LINKS[typeOf2(from2) ?? ""];
|
|
46408
46921
|
if (!wanted || typeOf2(to) !== wanted || !/:[1-9]\d*$/.test(to))
|
|
46409
|
-
return
|
|
46922
|
+
return invalid7("a link goes from contact:email/<address> to person:, person: to organization:, or chat:email/\u2026 to project:");
|
|
46410
46923
|
return { id: id2, kind: "link", from: from2, to, reason: findingText(raw.reason, 2e3), evidence };
|
|
46411
46924
|
}
|
|
46412
46925
|
case "new_contact": {
|
|
46413
46926
|
const address = findingText(raw.address, 320).toLowerCase();
|
|
46414
46927
|
if (!ADDRESS.test(address))
|
|
46415
|
-
return
|
|
46928
|
+
return invalid7("a new contact's address is an email address");
|
|
46416
46929
|
return {
|
|
46417
46930
|
id: id2,
|
|
46418
46931
|
kind: "new_contact",
|
|
@@ -46424,10 +46937,10 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46424
46937
|
}
|
|
46425
46938
|
case "invoice": {
|
|
46426
46939
|
if (!Array.isArray(raw.lines) || raw.lines.length < 1 || raw.lines.length > 50)
|
|
46427
|
-
return
|
|
46940
|
+
return invalid7("an invoice finding has 1\u201350 lines");
|
|
46428
46941
|
const lines = raw.lines.map((line) => {
|
|
46429
46942
|
if (!line || typeof line !== "object")
|
|
46430
|
-
return
|
|
46943
|
+
return invalid7("an invoice line is an object");
|
|
46431
46944
|
const fields4 = line;
|
|
46432
46945
|
findingFields(fields4, ["description", "quantity", "unitPrice", "amount"], "invoice line", raw);
|
|
46433
46946
|
return {
|
|
@@ -46441,7 +46954,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46441
46954
|
id: id2,
|
|
46442
46955
|
kind: "invoice",
|
|
46443
46956
|
direction: oneOf7(raw.direction, INVOICE_DIRECTIONS, "an invoice's direction"),
|
|
46444
|
-
...raw.counterparty === void 0 && raw.counterpartyName === void 0 ?
|
|
46957
|
+
...raw.counterparty === void 0 && raw.counterpartyName === void 0 ? invalid7("an invoice names its counterparty: counterparty person:N|organization:N, or counterparty_name") : party2("counterparty", "an invoice's counterparty"),
|
|
46445
46958
|
currency: word(raw.currency, 3),
|
|
46446
46959
|
lines,
|
|
46447
46960
|
...optional("total", raw.total, (value) => word(value, 30)),
|
|
@@ -46457,10 +46970,10 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46457
46970
|
let allocations;
|
|
46458
46971
|
if (raw.allocations !== void 0) {
|
|
46459
46972
|
if (!Array.isArray(raw.allocations) || raw.allocations.length < 1 || raw.allocations.length > 8)
|
|
46460
|
-
return
|
|
46973
|
+
return invalid7("a payment finding's allocations are 1\u20138 invoices it settles");
|
|
46461
46974
|
allocations = raw.allocations.map((share) => {
|
|
46462
46975
|
if (!share || typeof share !== "object")
|
|
46463
|
-
return
|
|
46976
|
+
return invalid7("an allocation is an invoice and an amount");
|
|
46464
46977
|
const fields4 = share;
|
|
46465
46978
|
findingFields(fields4, ["invoice", "amount"], "allocation", raw);
|
|
46466
46979
|
return {
|
|
@@ -46510,7 +47023,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46510
47023
|
case "order_update": {
|
|
46511
47024
|
const status = oneOf7(raw.status, ORDER_STATUSES, "an order update's status");
|
|
46512
47025
|
if (raw.date !== void 0 && status !== "delivered")
|
|
46513
|
-
return
|
|
47026
|
+
return invalid7("only a delivered order update gives date");
|
|
46514
47027
|
return {
|
|
46515
47028
|
id: id2,
|
|
46516
47029
|
kind: "order_update",
|
|
@@ -46523,7 +47036,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
46523
47036
|
};
|
|
46524
47037
|
}
|
|
46525
47038
|
default:
|
|
46526
|
-
return
|
|
47039
|
+
return invalid7(`a mail finding is a ${MAIL_FINDING_KINDS.join(", ")}`);
|
|
46527
47040
|
}
|
|
46528
47041
|
}, "one");
|
|
46529
47042
|
var KEY2 = /^[a-z0-9][a-z0-9-]{0,39}:[1-9]\d*(-r[1-9]\d*)?$/;
|
|
@@ -46531,7 +47044,7 @@ var KEY_SHAPE = "a mail findings key is the one `review --holder` gave: <holder>
|
|
|
46531
47044
|
var validateMailFindings = /* @__PURE__ */ __name((input) => {
|
|
46532
47045
|
const batch = validateBatch(input, RULES, MAIL_FINDINGS_PER_RUN, one);
|
|
46533
47046
|
if (!KEY2.test(batch.key))
|
|
46534
|
-
return
|
|
47047
|
+
return invalid7(KEY_SHAPE);
|
|
46535
47048
|
return batch;
|
|
46536
47049
|
}, "validateMailFindings");
|
|
46537
47050
|
var mailFindingProblem = /* @__PURE__ */ __name((raw, error) => {
|
|
@@ -46566,7 +47079,7 @@ var checkMailFindings = /* @__PURE__ */ __name((input) => {
|
|
|
46566
47079
|
}, "checkMailFindings");
|
|
46567
47080
|
var mailFindingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "mailFindingFingerprint");
|
|
46568
47081
|
|
|
46569
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
47082
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/mail/score.js
|
|
46570
47083
|
var import_disposable_email_domains_js = __toESM(require_dist(), 1);
|
|
46571
47084
|
var import_tldts = __toESM(require_cjs(), 1);
|
|
46572
47085
|
var WEIGHTS = {
|
|
@@ -46699,7 +47212,7 @@ var scoreGroup = /* @__PURE__ */ __name((items, context) => {
|
|
|
46699
47212
|
return { score: kept.reduce((sum, signal) => sum + WEIGHTS[signal], 0), signals: kept };
|
|
46700
47213
|
}, "scoreGroup");
|
|
46701
47214
|
|
|
46702
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
47215
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
|
|
46703
47216
|
var ORDERS = "SELECT o.*, b.name AS author_name, b.kind AS author_kind FROM orders o LEFT JOIN bots b ON o.author_type = 'bot' AND b.id = o.author_id";
|
|
46704
47217
|
var orderOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
46705
47218
|
const { database, now: now2 } = context;
|
|
@@ -46814,12 +47327,12 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
46814
47327
|
setStatus: /* @__PURE__ */ __name((reference2, { status, date: date3, by }) => {
|
|
46815
47328
|
ownerOnly(by, "moves an order on");
|
|
46816
47329
|
const next = statusOf(status);
|
|
46817
|
-
const
|
|
47330
|
+
const day2 = isoDate(date3, "an order's delivery date");
|
|
46818
47331
|
const row2 = rowOf2(reference2);
|
|
46819
47332
|
if (row2.review === "rejected" || row2.deleted_at != null)
|
|
46820
47333
|
refuse(`order:${row2.id} is ${row2.deleted_at != null ? "deleted" : "rejected"}`, "order.status");
|
|
46821
47334
|
write(database, () => {
|
|
46822
|
-
database.prepare("UPDATE orders SET status = ?, fulfilled_date = coalesce(?, fulfilled_date), updated_at = ? WHERE id = ?").run(next, next === "delivered" ?
|
|
47335
|
+
database.prepare("UPDATE orders SET status = ?, fulfilled_date = coalesce(?, fulfilled_date), updated_at = ? WHERE id = ?").run(next, next === "delivered" ? day2 : null, now2(), Number(row2.id));
|
|
46823
47336
|
});
|
|
46824
47337
|
return orderOf(rowOf2(`order:${row2.id}`));
|
|
46825
47338
|
}, "setStatus"),
|
|
@@ -46851,13 +47364,13 @@ var ordersStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
46851
47364
|
};
|
|
46852
47365
|
}, "ordersStoreOver");
|
|
46853
47366
|
|
|
46854
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
47367
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
|
|
46855
47368
|
var stale2 = /* @__PURE__ */ __name(() => {
|
|
46856
47369
|
throw new CliError("validation_error", "mail findings cite mail that changed since it was read; stage a new batch", {
|
|
46857
47370
|
reason: "mail-findings.stale"
|
|
46858
47371
|
});
|
|
46859
47372
|
}, "stale");
|
|
46860
|
-
var
|
|
47373
|
+
var invalid8 = /* @__PURE__ */ __name((message2, reason) => {
|
|
46861
47374
|
throw new CliError("validation_error", message2, reason ? { reason } : void 0);
|
|
46862
47375
|
}, "invalid");
|
|
46863
47376
|
var TEXT_BUDGET2 = 262144;
|
|
@@ -46876,7 +47389,7 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
46876
47389
|
const orders2 = orderOperationsOver(context);
|
|
46877
47390
|
const mailbox2 = /* @__PURE__ */ __name((key2) => {
|
|
46878
47391
|
if (key2?.provider !== "email" || typeof key2.account !== "string" || !key2.account.trim())
|
|
46879
|
-
return
|
|
47392
|
+
return invalid8("mail findings belong to one email account");
|
|
46880
47393
|
const row2 = database.prepare("SELECT id FROM accounts WHERE provider = 'email' AND external_id = ?").get(key2.account);
|
|
46881
47394
|
if (!row2)
|
|
46882
47395
|
throw new CliError("not_found", `no mail of ${key2.account} is stored`);
|
|
@@ -46884,19 +47397,19 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
46884
47397
|
}, "mailbox");
|
|
46885
47398
|
const load = /* @__PURE__ */ __name((id2) => {
|
|
46886
47399
|
if (typeof id2 !== "string" || !/^[1-9]\d*$/.test(id2) || !Number.isSafeInteger(Number(id2)))
|
|
46887
|
-
return
|
|
47400
|
+
return invalid8("a findings batch needs a stored ID");
|
|
46888
47401
|
const row2 = database.prepare("SELECT length(CAST(payload AS BLOB)) AS bytes, length(CAST(result AS BLOB)) AS result_bytes FROM proposed_actions WHERE id = ? AND kind = ?").get(Number(id2), MAIL_FINDINGS_KIND);
|
|
46889
47402
|
if (!row2)
|
|
46890
47403
|
throw new CliError("not_found", "the mail findings batch is unavailable");
|
|
46891
47404
|
if (Number(row2.bytes) > 1e5 || Number(row2.result_bytes) > 65536)
|
|
46892
|
-
return
|
|
47405
|
+
return invalid8("stored findings exceed the read budget");
|
|
46893
47406
|
return proposals.get(id2);
|
|
46894
47407
|
}, "load");
|
|
46895
47408
|
const accountOf4 = /* @__PURE__ */ __name((proposal) => mailbox2(proposal.account), "accountOf");
|
|
46896
47409
|
const view = /* @__PURE__ */ __name((proposal) => {
|
|
46897
47410
|
const input = proposal.payload;
|
|
46898
47411
|
if (!input || !proposal.account || !["proposed", "approved", "rejected"].includes(proposal.status))
|
|
46899
|
-
return
|
|
47412
|
+
return invalid8("invalid stored findings batch");
|
|
46900
47413
|
return {
|
|
46901
47414
|
id: proposal.id,
|
|
46902
47415
|
account: proposal.account,
|
|
@@ -46933,9 +47446,9 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
46933
47446
|
});
|
|
46934
47447
|
bytes3 += Buffer.byteLength(String(row2.body)) + Buffer.byteLength(String(row2.subject ?? ""));
|
|
46935
47448
|
if (bytes3 > TEXT_BUDGET2)
|
|
46936
|
-
return
|
|
47449
|
+
return invalid8(`finding evidence exceeds the ${TEXT_BUDGET2}-byte stored text budget`);
|
|
46937
47450
|
if (row2.partial)
|
|
46938
|
-
return
|
|
47451
|
+
return invalid8(`${reference2} is not stored whole yet; cite it once it is`, "mail-findings.partial");
|
|
46939
47452
|
const title = row2.subject == null ? null : String(row2.subject);
|
|
46940
47453
|
row2.fingerprint = contextEvidenceFingerprint({
|
|
46941
47454
|
ref: reference2,
|
|
@@ -46953,11 +47466,11 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
46953
47466
|
senders.add(String(row2.sender));
|
|
46954
47467
|
}
|
|
46955
47468
|
if (!own)
|
|
46956
|
-
return
|
|
47469
|
+
return invalid8(`finding ${finding.id} cites no email of this mailbox`);
|
|
46957
47470
|
for (const sender of senders) {
|
|
46958
47471
|
const count = (perSender.get(sender) ?? 0) + 1;
|
|
46959
47472
|
if (count > MAIL_FINDINGS_PER_SENDER)
|
|
46960
|
-
return
|
|
47473
|
+
return invalid8(`more than ${MAIL_FINDINGS_PER_SENDER} findings from ${sender} in one batch`);
|
|
46961
47474
|
perSender.set(sender, count);
|
|
46962
47475
|
}
|
|
46963
47476
|
}
|
|
@@ -46975,7 +47488,7 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
46975
47488
|
if (!found2.length)
|
|
46976
47489
|
found2 = database.prepare("SELECT id, name FROM organizations WHERE deleted_at IS NULL").all().filter((row2) => fold(String(row2.name)).trim() === fold(name).trim()).map((row2) => Number(row2.id));
|
|
46977
47490
|
if (found2.length > 1)
|
|
46978
|
-
return
|
|
47491
|
+
return invalid8(`${found2.length} organizations match ${name} (${found2.map((id3) => `organization:${id3}`).join(", ")}); name the one meant as a reference`, "finance.party");
|
|
46979
47492
|
const at = now2();
|
|
46980
47493
|
const id2 = found2[0] ?? Number(database.prepare("INSERT INTO organizations (kind, name, scope, created_at, updated_at) VALUES ('company', ?, 'work', ?, ?) RETURNING id").get(name, at, at)?.id);
|
|
46981
47494
|
if (email !== void 0) {
|
|
@@ -47086,11 +47599,11 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47086
47599
|
"customerEmail" in finding ? finding.customerEmail : void 0
|
|
47087
47600
|
])
|
|
47088
47601
|
if (address !== void 0 && !inCitedMail(address, finding, read2))
|
|
47089
|
-
return
|
|
47602
|
+
return invalid8(`${address} neither sent nor received the mail finding ${finding.id} cites`);
|
|
47090
47603
|
if (finding.kind === "order" && finding.number !== void 0) {
|
|
47091
47604
|
const waiting = proposedOrder(finding.supplierName, finding.number);
|
|
47092
47605
|
if (waiting)
|
|
47093
|
-
return
|
|
47606
|
+
return invalid8(`order ${finding.number} from ${finding.supplierName} already waits for the owner in findings batch ${waiting}; leave it out, or send an order_update once it is stored and its status changes`, "order.proposed");
|
|
47094
47607
|
}
|
|
47095
47608
|
wouldWrite(entry2(finding, finding.evidence.map((one2) => one2.reference)));
|
|
47096
47609
|
return;
|
|
@@ -47099,7 +47612,7 @@ var mailFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47099
47612
|
return;
|
|
47100
47613
|
case "new_contact": {
|
|
47101
47614
|
if (!inCitedMail(finding.address, finding, read2))
|
|
47102
|
-
return
|
|
47615
|
+
return invalid8(`${finding.address} neither sent nor received the mail finding ${finding.id} cites`);
|
|
47103
47616
|
if (!identityOfAddress(finding.address))
|
|
47104
47617
|
throw new CliError("not_found", `no stored contact ${finding.address}`);
|
|
47105
47618
|
return;
|
|
@@ -47187,7 +47700,7 @@ ${evidence.join("\n")}`, agent);
|
|
|
47187
47700
|
return void 0;
|
|
47188
47701
|
const proposal = load(String(held.id));
|
|
47189
47702
|
if (!whole || proposal.payload.inputHash !== findingHash({ input, model: by.model ?? null }))
|
|
47190
|
-
return
|
|
47703
|
+
return invalid8(`the findings batch key ${input.key} was already used for different input (batch ${proposal.id}); check a batch with --dry-run before staging it`, "mail-findings.key-used");
|
|
47191
47704
|
return proposal;
|
|
47192
47705
|
}, "heldBatch");
|
|
47193
47706
|
return {
|
|
@@ -47205,7 +47718,7 @@ ${evidence.join("\n")}`, agent);
|
|
|
47205
47718
|
targets(finding, read2);
|
|
47206
47719
|
const fingerprints = input.findings.map(mailFindingFingerprint);
|
|
47207
47720
|
if (new Set(fingerprints).size !== fingerprints.length)
|
|
47208
|
-
return
|
|
47721
|
+
return invalid8("the batch contains duplicate findings");
|
|
47209
47722
|
return view(proposals.propose({
|
|
47210
47723
|
kind: MAIL_FINDINGS_KIND,
|
|
47211
47724
|
by,
|
|
@@ -47242,7 +47755,7 @@ ${evidence.join("\n")}`, agent);
|
|
|
47242
47755
|
cite(valid, account);
|
|
47243
47756
|
const fingerprints = valid.map(mailFindingFingerprint);
|
|
47244
47757
|
if (new Set(fingerprints).size !== fingerprints.length)
|
|
47245
|
-
|
|
47758
|
+
invalid8("the batch contains duplicate findings");
|
|
47246
47759
|
} catch (error) {
|
|
47247
47760
|
batchProblem(error);
|
|
47248
47761
|
}
|
|
@@ -47252,9 +47765,9 @@ ${evidence.join("\n")}`, agent);
|
|
|
47252
47765
|
get: /* @__PURE__ */ __name(async (id2) => view(load(id2)), "get"),
|
|
47253
47766
|
list: /* @__PURE__ */ __name(async ({ account, status, limit = 20, offset = 0 } = {}) => {
|
|
47254
47767
|
if (status !== void 0 && status !== "proposed" && status !== "reviewed")
|
|
47255
|
-
return
|
|
47768
|
+
return invalid8("finding status is proposed or reviewed");
|
|
47256
47769
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50 || !Number.isSafeInteger(offset) || offset < 0)
|
|
47257
|
-
return
|
|
47770
|
+
return invalid8("findings lists take 1\u201350 items and a nonnegative offset");
|
|
47258
47771
|
const id2 = account === void 0 ? null : mailbox2(account);
|
|
47259
47772
|
const rows = database.prepare("SELECT id FROM proposed_actions WHERE kind = ? AND (? IS NULL OR account_id = ?) AND (? IS NULL OR status = ?) ORDER BY id DESC LIMIT ? OFFSET ?").all(MAIL_FINDINGS_KIND, id2, id2, status ?? null, status === "reviewed" ? "approved" : status ?? null, limit + 1, offset);
|
|
47260
47773
|
return { items: rows.slice(0, limit).map((row2) => view(load(String(row2.id)))), hasMore: rows.length > limit };
|
|
@@ -47265,14 +47778,14 @@ ${evidence.join("\n")}`, agent);
|
|
|
47265
47778
|
if (!decision || typeof decision.fingerprint !== "string" || decision.fingerprint !== batch.fingerprint)
|
|
47266
47779
|
return stale2();
|
|
47267
47780
|
if (!Array.isArray(decision.accept) || decision.accept.length > batch.input.findings.length || new Set(decision.accept).size !== decision.accept.length || decision.accept.some((candidate) => !batch.input.findings.some((finding) => finding.id === candidate)))
|
|
47268
|
-
return
|
|
47781
|
+
return invalid8("accept only unique IDs shown in this batch");
|
|
47269
47782
|
if (decision.by === void 0)
|
|
47270
|
-
return
|
|
47783
|
+
return invalid8("a findings review names who decides: the owner");
|
|
47271
47784
|
assertMayDecide({ id: id2, kind: MAIL_FINDINGS_KIND, proposedBy: proposals.proposer(id2) }, decision.by, context.decisions);
|
|
47272
47785
|
const accepted = [...decision.accept].sort();
|
|
47273
47786
|
if (batch.receipt) {
|
|
47274
47787
|
if (JSON.stringify(batch.receipt.accepted) !== JSON.stringify(accepted))
|
|
47275
|
-
return
|
|
47788
|
+
return invalid8("this findings batch was already reviewed with a different decision");
|
|
47276
47789
|
return batch;
|
|
47277
47790
|
}
|
|
47278
47791
|
const input = proposal.payload;
|
|
@@ -47281,7 +47794,7 @@ ${evidence.join("\n")}`, agent);
|
|
|
47281
47794
|
if (chosen.length)
|
|
47282
47795
|
cite(chosen, account, true);
|
|
47283
47796
|
if (proposal.proposedBy.type !== "bot" || !proposal.proposedBy.name)
|
|
47284
|
-
return
|
|
47797
|
+
return invalid8("a findings author must be an agent");
|
|
47285
47798
|
const agent = {
|
|
47286
47799
|
bot: proposal.proposedBy.name,
|
|
47287
47800
|
...input.agentModel === null ? {} : { model: input.agentModel }
|
|
@@ -47291,7 +47804,7 @@ ${evidence.join("\n")}`, agent);
|
|
|
47291
47804
|
const prior = core.previous(account, fingerprint2);
|
|
47292
47805
|
if (prior) {
|
|
47293
47806
|
if (accepted.includes(finding.id) && prior.status === "rejected")
|
|
47294
|
-
return
|
|
47807
|
+
return invalid8("this unchanged finding was already rejected; changed evidence needs a new candidate");
|
|
47295
47808
|
return { ...prior, id: finding.id, reused: true };
|
|
47296
47809
|
}
|
|
47297
47810
|
const status = accepted.includes(finding.id) ? "accepted" : "rejected";
|
|
@@ -47308,13 +47821,13 @@ ${evidence.join("\n")}`, agent);
|
|
|
47308
47821
|
};
|
|
47309
47822
|
}, "mailFindingsStoreOver");
|
|
47310
47823
|
|
|
47311
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
47824
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
|
|
47312
47825
|
var stale3 = /* @__PURE__ */ __name(() => {
|
|
47313
47826
|
throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
|
|
47314
47827
|
reason: "meeting-findings.stale"
|
|
47315
47828
|
});
|
|
47316
47829
|
}, "stale");
|
|
47317
|
-
var
|
|
47830
|
+
var invalid9 = /* @__PURE__ */ __name((message2) => {
|
|
47318
47831
|
throw new CliError("validation_error", message2);
|
|
47319
47832
|
}, "invalid");
|
|
47320
47833
|
var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
@@ -47322,7 +47835,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47322
47835
|
const proposals = proposalOperationsOver(context);
|
|
47323
47836
|
const accountId = /* @__PURE__ */ __name((key2) => {
|
|
47324
47837
|
if (!key2 || typeof key2.provider !== "string" || !key2.provider.trim() || typeof key2.account !== "string" || !key2.account.trim())
|
|
47325
|
-
return
|
|
47838
|
+
return invalid9("choose a meeting provider and account");
|
|
47326
47839
|
const row2 = database.prepare("SELECT id,scope FROM accounts WHERE provider=? AND external_id=?").get(key2.provider, key2.account);
|
|
47327
47840
|
if (!row2 || key2.scope !== void 0 && row2.scope !== key2.scope)
|
|
47328
47841
|
throw new CliError("not_found", "the meeting account is unavailable");
|
|
@@ -47330,18 +47843,18 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47330
47843
|
}, "accountId");
|
|
47331
47844
|
const load = /* @__PURE__ */ __name((account, id2) => {
|
|
47332
47845
|
if (typeof id2 !== "string" || !/^[1-9]\d*$/.test(id2) || !Number.isSafeInteger(Number(id2)))
|
|
47333
|
-
return
|
|
47846
|
+
return invalid9("a findings batch needs a stored ID");
|
|
47334
47847
|
const row2 = database.prepare("SELECT length(CAST(payload AS BLOB)) AS bytes,length(CAST(result AS BLOB)) AS result_bytes FROM proposed_actions WHERE id=? AND account_id=? AND kind=?").get(Number(id2), account, MEETING_FINDINGS_KIND);
|
|
47335
47848
|
if (!row2)
|
|
47336
47849
|
throw new CliError("not_found", "the findings batch is unavailable for this account");
|
|
47337
47850
|
if (Number(row2.bytes) > 1e5 || Number(row2.result_bytes) > 65536)
|
|
47338
|
-
return
|
|
47851
|
+
return invalid9("stored findings exceed the read budget");
|
|
47339
47852
|
return proposals.get(id2);
|
|
47340
47853
|
}, "load");
|
|
47341
47854
|
const view = /* @__PURE__ */ __name((proposal) => {
|
|
47342
47855
|
const input = proposal.payload;
|
|
47343
47856
|
if (!input || !proposal.account || !["proposed", "approved", "rejected"].includes(proposal.status))
|
|
47344
|
-
return
|
|
47857
|
+
return invalid9("invalid stored findings batch");
|
|
47345
47858
|
return {
|
|
47346
47859
|
id: proposal.id,
|
|
47347
47860
|
account: proposal.account,
|
|
@@ -47367,7 +47880,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47367
47880
|
throw new CliError("not_found", "the cited cue belongs to another account");
|
|
47368
47881
|
const membership = database.prepare("SELECT id,updated_at,confirmed,source FROM links WHERE from_type='meeting' AND from_id=? AND to_type='project' AND to_id=? AND kind='member-of' AND anchor IS NULL AND confirmed=1").get(parsed3.meetingId, projectId2);
|
|
47369
47882
|
if (!membership)
|
|
47370
|
-
return
|
|
47883
|
+
return invalid9("each cited meeting needs confirmed membership in the finding's project");
|
|
47371
47884
|
seen.set(`${finding.project}/${parsed3.meetingId}`, membership);
|
|
47372
47885
|
if (seen.has(evidence.reference)) {
|
|
47373
47886
|
if (seen.get(evidence.reference) !== evidence.fingerprint)
|
|
@@ -47381,7 +47894,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47381
47894
|
return stale3();
|
|
47382
47895
|
readBytes += Number(budget.bytes);
|
|
47383
47896
|
if (!Number.isSafeInteger(readBytes) || readBytes > 65536)
|
|
47384
|
-
return
|
|
47897
|
+
return invalid9("finding evidence exceeds the 65536-byte stored text budget");
|
|
47385
47898
|
const row2 = database.prepare(`SELECT t.content_hash,r.start_ms,r.end_ms,r.speaker_participant_id,r.speaker_name,r.text ${query}`).get(...params);
|
|
47386
47899
|
if (!row2)
|
|
47387
47900
|
return stale3();
|
|
@@ -47406,7 +47919,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47406
47919
|
stage: /* @__PURE__ */ __name(async (key2, raw, agent) => {
|
|
47407
47920
|
const input = validateMeetingFindings(raw);
|
|
47408
47921
|
if (!agent || typeof agent.bot !== "string" || !agent.bot.trim() || agent.bot.length > 200 || agent.bot === "owner" || agent.model !== void 0 && (typeof agent.model !== "string" || agent.model.length > 200))
|
|
47409
|
-
return
|
|
47922
|
+
return invalid9("findings must name an agent author independently of their payload");
|
|
47410
47923
|
const by = { bot: agent.bot, ...agent.model === void 0 ? {} : { model: agent.model } };
|
|
47411
47924
|
return write(database, () => {
|
|
47412
47925
|
const account = accountId(key2);
|
|
@@ -47416,13 +47929,13 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47416
47929
|
if (held) {
|
|
47417
47930
|
const proposal = load(account, String(held.id));
|
|
47418
47931
|
if (proposal.payload.inputHash !== inputHash)
|
|
47419
|
-
return
|
|
47932
|
+
return invalid9("the findings batch key was already used for different input");
|
|
47420
47933
|
return view(proposal);
|
|
47421
47934
|
}
|
|
47422
47935
|
const snapshotHash = snapshot2(account, input);
|
|
47423
47936
|
const fingerprints = input.findings.map(meetingFindingFingerprint);
|
|
47424
47937
|
if (new Set(fingerprints).size !== fingerprints.length)
|
|
47425
|
-
return
|
|
47938
|
+
return invalid9("the batch contains duplicate findings");
|
|
47426
47939
|
return view(proposals.propose({
|
|
47427
47940
|
kind: MEETING_FINDINGS_KIND,
|
|
47428
47941
|
by,
|
|
@@ -47434,9 +47947,9 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47434
47947
|
get: /* @__PURE__ */ __name(async (key2, id2) => view(load(accountId(key2), id2)), "get"),
|
|
47435
47948
|
list: /* @__PURE__ */ __name(async (key2, { limit = 20, offset = 0, status } = {}) => {
|
|
47436
47949
|
if (status !== void 0 && status !== "proposed" && status !== "reviewed")
|
|
47437
|
-
return
|
|
47950
|
+
return invalid9("finding status is proposed or reviewed");
|
|
47438
47951
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 50 || !Number.isSafeInteger(offset) || offset < 0)
|
|
47439
|
-
return
|
|
47952
|
+
return invalid9("findings lists take 1\u201350 items and a nonnegative offset");
|
|
47440
47953
|
const account = accountId(key2);
|
|
47441
47954
|
const ids = database.prepare("SELECT id FROM proposed_actions WHERE account_id=? AND kind=? AND (? IS NULL OR status=?) ORDER BY id DESC LIMIT ? OFFSET ?").all(account, MEETING_FINDINGS_KIND, status ?? null, status === "reviewed" ? "approved" : status ?? null, limit + 1, offset);
|
|
47442
47955
|
return {
|
|
@@ -47451,21 +47964,21 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47451
47964
|
if (!decision || typeof decision.fingerprint !== "string" || decision.fingerprint !== batch.fingerprint)
|
|
47452
47965
|
return stale3();
|
|
47453
47966
|
if (!Array.isArray(decision.accept) || decision.accept.length > 16 || new Set(decision.accept).size !== decision.accept.length || decision.accept.some((candidate) => !batch.input.findings.some((finding) => finding.id === candidate)))
|
|
47454
|
-
return
|
|
47967
|
+
return invalid9("accept only unique IDs shown in this batch");
|
|
47455
47968
|
const accepted = [...decision.accept].sort();
|
|
47456
47969
|
if (decision.by === void 0)
|
|
47457
|
-
return
|
|
47970
|
+
return invalid9("a findings review names who decides: the owner or an agent");
|
|
47458
47971
|
assertMayDecide({ id: id2, kind: MEETING_FINDINGS_KIND, proposedBy: proposals.proposer(id2) }, decision.by, context.decisions);
|
|
47459
47972
|
if (batch.receipt) {
|
|
47460
47973
|
if (JSON.stringify(batch.receipt.accepted) !== JSON.stringify(accepted))
|
|
47461
|
-
return
|
|
47974
|
+
return invalid9("this findings batch was already reviewed with a different decision");
|
|
47462
47975
|
return batch;
|
|
47463
47976
|
}
|
|
47464
47977
|
const input = proposal.payload;
|
|
47465
47978
|
if (accepted.length && snapshot2(account, batch.input) !== input.snapshotHash)
|
|
47466
47979
|
return stale3();
|
|
47467
47980
|
if (proposal.proposedBy.type !== "bot" || !proposal.proposedBy.name)
|
|
47468
|
-
return
|
|
47981
|
+
return invalid9("a findings author must be an agent");
|
|
47469
47982
|
const agent = {
|
|
47470
47983
|
bot: proposal.proposedBy.name,
|
|
47471
47984
|
...input.agentModel === null ? {} : { model: input.agentModel }
|
|
@@ -47476,7 +47989,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47476
47989
|
};
|
|
47477
47990
|
}, "meetingFindingsStoreOver");
|
|
47478
47991
|
|
|
47479
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
47992
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
|
|
47480
47993
|
var RANK_BATCH = 512;
|
|
47481
47994
|
var LIVE3 = "FROM chunks k JOIN meeting_transcripts t ON k.chunkable_type = 'meeting_transcript' AND t.id = k.chunkable_id JOIN meetings m ON m.id = t.meeting_id WHERE m.account_id = ? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL";
|
|
47482
47995
|
var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
|
|
@@ -47496,7 +48009,7 @@ var modelOf = /* @__PURE__ */ __name((model) => {
|
|
|
47496
48009
|
var missing3 = /* @__PURE__ */ __name(() => {
|
|
47497
48010
|
throw new CliError("not_found", "Current transcript not found");
|
|
47498
48011
|
}, "missing");
|
|
47499
|
-
var
|
|
48012
|
+
var textOf5 = /* @__PURE__ */ __name((context, accountId, transcriptId, budget, signal) => {
|
|
47500
48013
|
const maxRows = limitOf(budget.maxRows ?? 1e4, "maxRows", 1e5);
|
|
47501
48014
|
const maxBytes = limitOf(budget.maxTextBytes ?? 4 * 1024 * 1024, "maxTextBytes", 64 * 1024 * 1024);
|
|
47502
48015
|
const parent2 = context.database.prepare("SELECT m.id AS meeting_id FROM meeting_transcripts t JOIN meetings m ON m.id=t.meeting_id WHERE t.id=? AND m.account_id=? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL").get(transcriptId, accountId) ?? missing3();
|
|
@@ -47530,14 +48043,14 @@ var textLoader = /* @__PURE__ */ __name((context, input) => {
|
|
|
47530
48043
|
return existing;
|
|
47531
48044
|
if (remaining <= 0)
|
|
47532
48045
|
throw new CliError("validation_error", "Vector operation exceeds its aggregate text read budget");
|
|
47533
|
-
const document =
|
|
48046
|
+
const document = textOf5(context, input.accountId, id2, { ...input, maxTextBytes: remaining }, input.signal);
|
|
47534
48047
|
remaining -= document.readBytes;
|
|
47535
48048
|
loaded3.set(id2, document);
|
|
47536
48049
|
return document;
|
|
47537
48050
|
};
|
|
47538
48051
|
}, "textLoader");
|
|
47539
48052
|
var chunkText = /* @__PURE__ */ __name((context, accountId, row2, budget, signal, loaded3) => {
|
|
47540
|
-
const document = loaded3 ??
|
|
48053
|
+
const document = loaded3 ?? textOf5(context, accountId, Number(row2.chunkable_id), budget, signal);
|
|
47541
48054
|
const start = Number(row2.start_offset), end = Number(row2.end_offset);
|
|
47542
48055
|
const text6 = document.text.slice(start, end);
|
|
47543
48056
|
if (chunkHash(text6) !== String(row2.content_hash))
|
|
@@ -47747,7 +48260,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
47747
48260
|
}
|
|
47748
48261
|
}), "meetingVectorsOver");
|
|
47749
48262
|
|
|
47750
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
48263
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
|
|
47751
48264
|
var OTHER_SOURCES = ["document", "note", "email"];
|
|
47752
48265
|
var TEXTS = {
|
|
47753
48266
|
document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
|
|
@@ -47848,11 +48361,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
47848
48361
|
};
|
|
47849
48362
|
}, "sourceMentionStoreOver");
|
|
47850
48363
|
|
|
47851
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
48364
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
47852
48365
|
import { mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
47853
48366
|
import { dirname } from "node:path";
|
|
47854
48367
|
|
|
47855
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
48368
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
|
|
47856
48369
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
47857
48370
|
var CLIENTS_SETTING = "clients";
|
|
47858
48371
|
var coreVersion = (() => {
|
|
@@ -47910,7 +48423,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
|
|
|
47910
48423
|
return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
|
|
47911
48424
|
}, "refusalAdvice");
|
|
47912
48425
|
|
|
47913
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
48426
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
|
|
47914
48427
|
var GENERATED = [
|
|
47915
48428
|
{
|
|
47916
48429
|
"name": "20261010184427_initial",
|
|
@@ -48962,7 +49475,7 @@ WHERE json_type(params, '$.selection') = 'object';`
|
|
|
48962
49475
|
}
|
|
48963
49476
|
];
|
|
48964
49477
|
|
|
48965
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49478
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
|
|
48966
49479
|
var MANIFEST = [
|
|
48967
49480
|
{ name: "20261010184427_initial", version: 1, minCompatible: 1 },
|
|
48968
49481
|
{ name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
|
|
@@ -49056,7 +49569,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
|
|
|
49056
49569
|
return migrations;
|
|
49057
49570
|
}, "generatedMigrations");
|
|
49058
49571
|
|
|
49059
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49572
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/migrations.js
|
|
49060
49573
|
var MIGRATIONS = generatedMigrations();
|
|
49061
49574
|
var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
49062
49575
|
version INTEGER PRIMARY KEY,
|
|
@@ -49109,7 +49622,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
|
|
|
49109
49622
|
}
|
|
49110
49623
|
}, "migrate");
|
|
49111
49624
|
|
|
49112
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49625
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
|
|
49113
49626
|
var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
49114
49627
|
const pending = database.prepare("SELECT id, join_url FROM meetings WHERE join_url IS NOT NULL AND join_key IS NULL AND id > ? ORDER BY id LIMIT ?");
|
|
49115
49628
|
if (pending.get(0, 1) === void 0)
|
|
@@ -49131,7 +49644,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
49131
49644
|
}
|
|
49132
49645
|
}, "fillJoinKeys");
|
|
49133
49646
|
|
|
49134
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49647
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
|
|
49135
49648
|
var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
49136
49649
|
refuseOwnerStoreInTests(path);
|
|
49137
49650
|
const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
|
|
@@ -49145,8 +49658,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
|
|
|
49145
49658
|
}, "openSqlite");
|
|
49146
49659
|
var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
49147
49660
|
quietSqliteWarning();
|
|
49148
|
-
const { drizzle } = await import("./node-
|
|
49149
|
-
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-
|
|
49661
|
+
const { drizzle } = await import("./node-S5LQLVMO.js");
|
|
49662
|
+
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-PFCIEDPX.js");
|
|
49150
49663
|
const client = await nodeClient(path, { readOnly });
|
|
49151
49664
|
try {
|
|
49152
49665
|
return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
|
|
@@ -49156,8 +49669,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
49156
49669
|
}
|
|
49157
49670
|
}, "openUnderNode");
|
|
49158
49671
|
var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
49159
|
-
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-
|
|
49160
|
-
const { drizzle } = await import("./bun-
|
|
49672
|
+
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-D6T3ESTG.js");
|
|
49673
|
+
const { drizzle } = await import("./bun-3CGVV3V2.js");
|
|
49161
49674
|
const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
|
|
49162
49675
|
try {
|
|
49163
49676
|
return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
|
|
@@ -49167,7 +49680,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
49167
49680
|
}
|
|
49168
49681
|
}, "openUnderBun");
|
|
49169
49682
|
|
|
49170
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49683
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
|
|
49171
49684
|
var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
|
|
49172
49685
|
var paymentOf = /* @__PURE__ */ __name((metadata3) => {
|
|
49173
49686
|
try {
|
|
@@ -49235,7 +49748,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
|
|
|
49235
49748
|
});
|
|
49236
49749
|
}, "movePaymentFacts");
|
|
49237
49750
|
|
|
49238
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49751
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
|
|
49239
49752
|
var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
49240
49753
|
const ours = MIGRATIONS.at(-1)?.version ?? 0;
|
|
49241
49754
|
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
|
|
@@ -49250,7 +49763,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
|
49250
49763
|
throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
|
|
49251
49764
|
}, "assertReadCompatible");
|
|
49252
49765
|
|
|
49253
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49766
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
|
|
49254
49767
|
var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
|
|
49255
49768
|
var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
|
|
49256
49769
|
if (provenance2?.startsWith("rule:"))
|
|
@@ -49296,7 +49809,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
|
|
|
49296
49809
|
});
|
|
49297
49810
|
}, "moveSuggestedLinks");
|
|
49298
49811
|
|
|
49299
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49812
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
|
|
49300
49813
|
var TEST_ACCOUNTS_TO_PURGE = "test_accounts_to_purge";
|
|
49301
49814
|
var TEST_PROVIDER = "chat";
|
|
49302
49815
|
var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
|
|
@@ -49317,7 +49830,7 @@ var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
|
|
|
49317
49830
|
}
|
|
49318
49831
|
}, "purgeTestAccounts");
|
|
49319
49832
|
|
|
49320
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49833
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
49321
49834
|
var BACKFILL_ON_OPEN = 5e3;
|
|
49322
49835
|
var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
|
|
49323
49836
|
var createWritable = /* @__PURE__ */ __name((file) => {
|
|
@@ -49382,10 +49895,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
|
|
|
49382
49895
|
}
|
|
49383
49896
|
}, "openStoreContext");
|
|
49384
49897
|
|
|
49385
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49386
|
-
import { createHash as
|
|
49898
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
49899
|
+
import { createHash as createHash17 } from "node:crypto";
|
|
49387
49900
|
|
|
49388
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49901
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
|
|
49389
49902
|
var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
49390
49903
|
var ref = text4(2048);
|
|
49391
49904
|
var timestamp2 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -49451,16 +49964,16 @@ var projectAnnotationsSchema = strictObject({
|
|
|
49451
49964
|
}))
|
|
49452
49965
|
});
|
|
49453
49966
|
|
|
49454
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49967
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
49455
49968
|
var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
|
|
49456
|
-
var
|
|
49969
|
+
var invalid10 = /* @__PURE__ */ __name((field4) => {
|
|
49457
49970
|
throw new CliError("validation_error", `invalid project annotations.${field4}`);
|
|
49458
49971
|
}, "invalid");
|
|
49459
|
-
var
|
|
49972
|
+
var canonical2 = /* @__PURE__ */ __name((ref3) => {
|
|
49460
49973
|
try {
|
|
49461
49974
|
return ref3.startsWith("meeting:") ? canonicalMeetingReference(ref3) : canonicalReference(ref3);
|
|
49462
49975
|
} catch {
|
|
49463
|
-
return
|
|
49976
|
+
return invalid10("reference");
|
|
49464
49977
|
}
|
|
49465
49978
|
}, "canonical");
|
|
49466
49979
|
var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, additionalActors = []) => {
|
|
@@ -49468,38 +49981,38 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
49468
49981
|
const external = /* @__PURE__ */ new Set();
|
|
49469
49982
|
const used = /* @__PURE__ */ new Set();
|
|
49470
49983
|
const kind4 = /* @__PURE__ */ __name((ref3, kinds2) => {
|
|
49471
|
-
if (
|
|
49472
|
-
|
|
49984
|
+
if (canonical2(ref3) !== ref3 || !kinds2.includes(parseReference(ref3).type) || !/^[a-z]+:[1-9]\d*$/.test(ref3))
|
|
49985
|
+
invalid10("reference kind");
|
|
49473
49986
|
}, "kind");
|
|
49474
49987
|
kind4(manifest.project.ref, ["project"]);
|
|
49475
49988
|
for (const fact of manifest.facts) {
|
|
49476
49989
|
kind4(fact.ref, ["fact"]);
|
|
49477
49990
|
if (owned.has(fact.ref))
|
|
49478
|
-
|
|
49991
|
+
invalid10("facts.duplicate");
|
|
49479
49992
|
owned.add(fact.ref);
|
|
49480
49993
|
kind4(fact.author, ["person", "bot"]);
|
|
49481
49994
|
if (fact.confirmed_by !== null)
|
|
49482
49995
|
kind4(fact.confirmed_by, ["person", "bot"]);
|
|
49483
49996
|
if (fact.updated_at < fact.created_at)
|
|
49484
|
-
|
|
49997
|
+
invalid10("facts.updated_at");
|
|
49485
49998
|
if (fact.type !== "decision" && (fact.supersedes !== null || ["superseded", "reversed"].includes(fact.status)))
|
|
49486
|
-
|
|
49999
|
+
invalid10("facts.lifecycle");
|
|
49487
50000
|
if (fact.supersedes === fact.ref)
|
|
49488
|
-
|
|
50001
|
+
invalid10("facts.supersedes");
|
|
49489
50002
|
}
|
|
49490
50003
|
for (const item of manifest.external) {
|
|
49491
|
-
if (
|
|
49492
|
-
|
|
50004
|
+
if (canonical2(item.ref) !== item.ref || owned.has(item.ref) || external.has(item.ref))
|
|
50005
|
+
invalid10("external.ref");
|
|
49493
50006
|
external.add(item.ref);
|
|
49494
50007
|
const body2 = /^(msg|document|note|meeting):/.test(item.ref);
|
|
49495
50008
|
if (body2 !== (item.content_sha256 !== null))
|
|
49496
|
-
|
|
50009
|
+
invalid10("external.content_sha256");
|
|
49497
50010
|
}
|
|
49498
50011
|
const dependency = /* @__PURE__ */ __name((ref3) => {
|
|
49499
50012
|
if (ref3 === null)
|
|
49500
50013
|
return;
|
|
49501
|
-
if (
|
|
49502
|
-
|
|
50014
|
+
if (canonical2(ref3) !== ref3 || !owned.has(ref3) && !external.has(ref3))
|
|
50015
|
+
invalid10("missing dependency");
|
|
49503
50016
|
used.add(ref3);
|
|
49504
50017
|
}, "dependency");
|
|
49505
50018
|
if (manifest.project.organization !== null)
|
|
@@ -49513,7 +50026,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
49513
50026
|
for (const alias2 of manifest.aliases) {
|
|
49514
50027
|
const name = normalizeVocabularyName(alias2);
|
|
49515
50028
|
if (aliases2.has(name))
|
|
49516
|
-
|
|
50029
|
+
invalid10("aliases.duplicate");
|
|
49517
50030
|
aliases2.add(name);
|
|
49518
50031
|
}
|
|
49519
50032
|
for (const fact of manifest.facts) {
|
|
@@ -49522,7 +50035,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
49522
50035
|
if (fact.supersedes !== null) {
|
|
49523
50036
|
kind4(fact.supersedes, ["fact"]);
|
|
49524
50037
|
if (!manifest.facts.some((previous2) => previous2.ref === fact.supersedes && previous2.type === "decision"))
|
|
49525
|
-
|
|
50038
|
+
invalid10("facts.supersedes outside project");
|
|
49526
50039
|
}
|
|
49527
50040
|
}
|
|
49528
50041
|
const previous = new Map(manifest.facts.map((fact) => [fact.ref, fact.supersedes]));
|
|
@@ -49531,7 +50044,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
49531
50044
|
let ref3 = fact.ref;
|
|
49532
50045
|
while (ref3) {
|
|
49533
50046
|
if (path.has(ref3))
|
|
49534
|
-
|
|
50047
|
+
invalid10("facts.supersedes cycle");
|
|
49535
50048
|
path.add(ref3);
|
|
49536
50049
|
ref3 = previous.get(ref3);
|
|
49537
50050
|
}
|
|
@@ -49539,23 +50052,23 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
49539
50052
|
const links2 = /* @__PURE__ */ new Set();
|
|
49540
50053
|
for (const link3 of manifest.links) {
|
|
49541
50054
|
if (!/^link:[1-9]\d*$/.test(link3.ref) || links2.has(link3.ref))
|
|
49542
|
-
|
|
50055
|
+
invalid10("links.ref");
|
|
49543
50056
|
links2.add(link3.ref);
|
|
49544
50057
|
if (!owned.has(link3.from) && (link3.to === null || !owned.has(link3.to)))
|
|
49545
|
-
|
|
50058
|
+
invalid10("links.outside project");
|
|
49546
50059
|
if (link3.to === null && link3.target_text === null)
|
|
49547
|
-
|
|
50060
|
+
invalid10("links.target_text");
|
|
49548
50061
|
if (link3.updated_at < link3.created_at)
|
|
49549
|
-
|
|
50062
|
+
invalid10("links.updated_at");
|
|
49550
50063
|
for (const ref3 of [link3.from, link3.to])
|
|
49551
50064
|
dependency(ref3);
|
|
49552
50065
|
}
|
|
49553
50066
|
for (const ref3 of external)
|
|
49554
50067
|
if (!used.has(ref3))
|
|
49555
|
-
|
|
50068
|
+
invalid10("external.unused");
|
|
49556
50069
|
}, "validateProjectAnnotationsGraph");
|
|
49557
50070
|
|
|
49558
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50071
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
49559
50072
|
var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
|
|
49560
50073
|
var ref2 = pipe(string(), minLength(1), maxLength(2048));
|
|
49561
50074
|
var targetSchema = strictObject({
|
|
@@ -49575,23 +50088,23 @@ var kind3 = /* @__PURE__ */ __name((ref3) => {
|
|
|
49575
50088
|
const parsed3 = parseReference(ref3);
|
|
49576
50089
|
return "provider" in parsed3 ? `${parsed3.type}:${parsed3.provider}` : parsed3.type;
|
|
49577
50090
|
}, "kind");
|
|
49578
|
-
var
|
|
50091
|
+
var invalid11 = /* @__PURE__ */ __name((field4) => {
|
|
49579
50092
|
throw new CliError("validation_error", `invalid project annotation plan.${field4}`);
|
|
49580
50093
|
}, "invalid");
|
|
49581
50094
|
var projectAnnotationBindingSources = /* @__PURE__ */ __name((manifest, bindings) => {
|
|
49582
50095
|
if (!bindings || typeof bindings !== "object" || Array.isArray(bindings) || Object.keys(bindings).length > 1001)
|
|
49583
|
-
return
|
|
50096
|
+
return invalid11("bindings");
|
|
49584
50097
|
if (Object.getPrototypeOf(bindings) !== Object.prototype && Object.getPrototypeOf(bindings) !== null)
|
|
49585
|
-
return
|
|
50098
|
+
return invalid11("bindings");
|
|
49586
50099
|
const required3 = /* @__PURE__ */ new Set([manifest.project.ref, ...manifest.external.map((item) => item.ref)]);
|
|
49587
50100
|
for (const [source2, destination] of Object.entries(bindings))
|
|
49588
50101
|
if (!required3.has(source2) || typeof destination !== "string" || destination.length > 2048)
|
|
49589
|
-
return
|
|
50102
|
+
return invalid11("bindings");
|
|
49590
50103
|
for (const destination of Object.values(bindings)) {
|
|
49591
50104
|
try {
|
|
49592
50105
|
kind3(destination);
|
|
49593
50106
|
} catch {
|
|
49594
|
-
return
|
|
50107
|
+
return invalid11("bindings.reference");
|
|
49595
50108
|
}
|
|
49596
50109
|
}
|
|
49597
50110
|
return required3;
|
|
@@ -49599,17 +50112,17 @@ var projectAnnotationBindingSources = /* @__PURE__ */ __name((manifest, bindings
|
|
|
49599
50112
|
var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fingerprint, target, bindings) => {
|
|
49600
50113
|
const checked = safeParse(targetSchema, target);
|
|
49601
50114
|
if (!checked.success)
|
|
49602
|
-
return
|
|
50115
|
+
return invalid11(checked.issues[0]?.path?.map((p) => String(p.key)).join(".") ?? "target");
|
|
49603
50116
|
const required3 = projectAnnotationBindingSources(manifest, bindings);
|
|
49604
50117
|
const destinations = /* @__PURE__ */ new Map();
|
|
49605
50118
|
for (const item of checked.output.external) {
|
|
49606
50119
|
try {
|
|
49607
50120
|
kind3(item.ref);
|
|
49608
50121
|
} catch {
|
|
49609
|
-
return
|
|
50122
|
+
return invalid11("target.external.ref");
|
|
49610
50123
|
}
|
|
49611
50124
|
if (destinations.has(item.ref) || item.ref === target.project)
|
|
49612
|
-
return
|
|
50125
|
+
return invalid11("target.external.duplicate");
|
|
49613
50126
|
destinations.set(item.ref, item.content_sha256);
|
|
49614
50127
|
}
|
|
49615
50128
|
const missing_bindings = [], conflicts = [];
|
|
@@ -49626,7 +50139,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
49626
50139
|
continue;
|
|
49627
50140
|
}
|
|
49628
50141
|
} catch {
|
|
49629
|
-
return
|
|
50142
|
+
return invalid11("bindings.reference");
|
|
49630
50143
|
}
|
|
49631
50144
|
if (used.has(destination))
|
|
49632
50145
|
conflicts.push({ reference: source2, reason: "duplicate" });
|
|
@@ -49643,7 +50156,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
49643
50156
|
}
|
|
49644
50157
|
if (target.annotation_count > 0)
|
|
49645
50158
|
conflicts.push({ reference: target.project, reason: "populated" });
|
|
49646
|
-
const fingerprint2 =
|
|
50159
|
+
const fingerprint2 = createHash17("sha256").update(JSON.stringify({
|
|
49647
50160
|
manifest_fingerprint,
|
|
49648
50161
|
target: {
|
|
49649
50162
|
...checked.output,
|
|
@@ -49661,8 +50174,8 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
49661
50174
|
};
|
|
49662
50175
|
}, "planBoundProjectAnnotations");
|
|
49663
50176
|
|
|
49664
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49665
|
-
import { createHash as
|
|
50177
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
|
|
50178
|
+
import { createHash as createHash18 } from "node:crypto";
|
|
49666
50179
|
var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
49667
50180
|
var timestamp3 = pipe(number(), safeInteger(), minValue(0));
|
|
49668
50181
|
var projectAnnotationSnapshotSchema = strictObject({
|
|
@@ -49746,7 +50259,7 @@ var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
|
|
|
49746
50259
|
var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
49747
50260
|
const snapshot2 = decodeProjectAnnotationSnapshot(json3);
|
|
49748
50261
|
const order = /* @__PURE__ */ __name((a, b) => a.ref < b.ref ? -1 : a.ref > b.ref ? 1 : 0, "order");
|
|
49749
|
-
return
|
|
50262
|
+
return createHash18("sha256").update(JSON.stringify({
|
|
49750
50263
|
...snapshot2,
|
|
49751
50264
|
aliases: snapshot2.aliases.toSorted((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0),
|
|
49752
50265
|
facts: snapshot2.facts.toSorted(order),
|
|
@@ -49755,7 +50268,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
49755
50268
|
})).digest("hex");
|
|
49756
50269
|
}, "projectAnnotationSnapshotFingerprint");
|
|
49757
50270
|
|
|
49758
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50271
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
|
|
49759
50272
|
var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
|
|
49760
50273
|
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
49761
50274
|
throw new CliError("validation_error", "project annotation request is required");
|
|
@@ -49772,7 +50285,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
|
|
|
49772
50285
|
return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
|
|
49773
50286
|
}, "projectAnnotationRequest");
|
|
49774
50287
|
|
|
49775
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50288
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
|
|
49776
50289
|
var SnapshotBudget = class {
|
|
49777
50290
|
static {
|
|
49778
50291
|
__name(this, "SnapshotBudget");
|
|
@@ -49798,15 +50311,15 @@ var SnapshotBudget = class {
|
|
|
49798
50311
|
}
|
|
49799
50312
|
};
|
|
49800
50313
|
|
|
49801
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49802
|
-
import { createHash as
|
|
50314
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
50315
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
49803
50316
|
|
|
49804
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50317
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
|
|
49805
50318
|
var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
|
|
49806
50319
|
|
|
49807
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
49808
|
-
import { createHash as
|
|
49809
|
-
var
|
|
50320
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
|
|
50321
|
+
import { createHash as createHash19 } from "node:crypto";
|
|
50322
|
+
var invalid12 = /* @__PURE__ */ __name(() => {
|
|
49810
50323
|
throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
|
|
49811
50324
|
}, "invalid");
|
|
49812
50325
|
var scalar2 = /* @__PURE__ */ new Set([
|
|
@@ -49875,14 +50388,14 @@ var ProjectSnapshotSources = class {
|
|
|
49875
50388
|
if (type === null && id2 === null)
|
|
49876
50389
|
return null;
|
|
49877
50390
|
if (typeof type !== "string" || !scalar2.has(type) || typeof id2 !== "number" || !Number.isSafeInteger(id2) || id2 < 1)
|
|
49878
|
-
return
|
|
50391
|
+
return invalid12();
|
|
49879
50392
|
const key2 = `${type}:${id2}`, cached = this.byThing.get(key2);
|
|
49880
50393
|
if (cached)
|
|
49881
50394
|
return cached;
|
|
49882
50395
|
if (type === "project" || type === "organization") {
|
|
49883
50396
|
const table = type === "project" ? "projects" : "organizations";
|
|
49884
50397
|
if (!this.database.prepare(`SELECT 1 FROM ${table} WHERE id=? AND deleted_at IS NULL`).get(id2))
|
|
49885
|
-
return
|
|
50398
|
+
return invalid12();
|
|
49886
50399
|
}
|
|
49887
50400
|
const identifier = {
|
|
49888
50401
|
message: [
|
|
@@ -49904,7 +50417,7 @@ var ProjectSnapshotSources = class {
|
|
|
49904
50417
|
this.budget.rows(this.database, selection[0], [...selection[1]], [id2]);
|
|
49905
50418
|
const thing = storedThing(type, id2), ref3 = referenceOfThing(this.database, thing);
|
|
49906
50419
|
if (!ref3)
|
|
49907
|
-
return
|
|
50420
|
+
return invalid12();
|
|
49908
50421
|
this.byThing.set(key2, ref3);
|
|
49909
50422
|
this.references.set(ref3, thing);
|
|
49910
50423
|
return ref3;
|
|
@@ -49923,12 +50436,12 @@ var ProjectSnapshotSources = class {
|
|
|
49923
50436
|
return this.transcript(thing.id);
|
|
49924
50437
|
const spec = texts[thing.type];
|
|
49925
50438
|
if (!spec)
|
|
49926
|
-
return
|
|
50439
|
+
return invalid12();
|
|
49927
50440
|
const from2 = `FROM ${spec.table} n ${spec.join ?? ""} WHERE n.id=? AND ${spec.where}`;
|
|
49928
50441
|
this.budget.rows(this.database, from2, spec.fields, [thing.id]);
|
|
49929
50442
|
const row2 = this.database.prepare(`SELECT ${spec.fields.map((f, i) => `${f} AS v${i}`).join(",")} ${from2}`).get(thing.id);
|
|
49930
50443
|
if (!row2)
|
|
49931
|
-
return
|
|
50444
|
+
return invalid12();
|
|
49932
50445
|
return this.digest(thing.type, spec.fields.map((_f, i) => row2[`v${i}`]));
|
|
49933
50446
|
}
|
|
49934
50447
|
transcript(id2) {
|
|
@@ -49936,18 +50449,18 @@ var ProjectSnapshotSources = class {
|
|
|
49936
50449
|
this.budget.rows(this.database, from2, ["n.format", "n.language", "n.source"], [id2]);
|
|
49937
50450
|
const header = this.database.prepare(`SELECT n.format,n.language,n.source ${from2}`).get(id2);
|
|
49938
50451
|
if (!header)
|
|
49939
|
-
return
|
|
50452
|
+
return invalid12();
|
|
49940
50453
|
const rows = "FROM meeting_transcript_rows n WHERE n.meeting_transcript_id=?";
|
|
49941
50454
|
this.budget.rows(this.database, rows, ["n.position", "n.start_ms", "n.end_ms", "n.speaker_name", "n.text"], [id2]);
|
|
49942
50455
|
const cues = this.database.prepare(`SELECT n.position,n.start_ms,n.end_ms,n.speaker_name,n.text ${rows} ORDER BY n.position LIMIT 1001`).all(id2);
|
|
49943
50456
|
return this.digest("meeting_transcript", [header, cues]);
|
|
49944
50457
|
}
|
|
49945
50458
|
digest(kind4, content) {
|
|
49946
|
-
return
|
|
50459
|
+
return createHash19("sha256").update(JSON.stringify(["wirecat.project-source", 1, kind4, content])).digest("hex");
|
|
49947
50460
|
}
|
|
49948
50461
|
};
|
|
49949
50462
|
|
|
49950
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50463
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
|
|
49951
50464
|
var unsupported = /* @__PURE__ */ __name(() => {
|
|
49952
50465
|
throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
|
|
49953
50466
|
}, "unsupported");
|
|
@@ -50118,7 +50631,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
|
|
|
50118
50631
|
return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
|
|
50119
50632
|
}), "projectAnnotationSnapshot");
|
|
50120
50633
|
|
|
50121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50634
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
50122
50635
|
var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
|
|
50123
50636
|
const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
|
|
50124
50637
|
const sources = new ProjectSnapshotSources(database, budget);
|
|
@@ -50159,7 +50672,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
|
|
|
50159
50672
|
const target = {
|
|
50160
50673
|
project: current.project.ref,
|
|
50161
50674
|
annotation_count: current.aliases.length + current.facts.length + current.links.length,
|
|
50162
|
-
revision_sha256:
|
|
50675
|
+
revision_sha256: createHash20("sha256").update(JSON.stringify({
|
|
50163
50676
|
snapshot: projectAnnotationSnapshotFingerprint(JSON.stringify(current)),
|
|
50164
50677
|
projects: projects2,
|
|
50165
50678
|
aliases: aliases2,
|
|
@@ -50174,13 +50687,13 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
|
|
|
50174
50687
|
descriptor_conflicts,
|
|
50175
50688
|
namespace_conflicts,
|
|
50176
50689
|
ready: plan.ready && descriptor_conflicts.length === 0 && namespace_conflicts.length === 0,
|
|
50177
|
-
fingerprint:
|
|
50690
|
+
fingerprint: createHash20("sha256").update(JSON.stringify({ plan: plan.fingerprint, descriptor_conflicts, namespace_conflicts })).digest("hex"),
|
|
50178
50691
|
read_bytes: budget.bytes,
|
|
50179
50692
|
records: budget.records
|
|
50180
50693
|
};
|
|
50181
50694
|
}), "previewAnnotationSnapshot");
|
|
50182
50695
|
|
|
50183
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50696
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
|
|
50184
50697
|
var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, snapshot2, bindings) => {
|
|
50185
50698
|
const mappings = { ...bindings };
|
|
50186
50699
|
const resolve = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -50222,7 +50735,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
|
|
|
50222
50735
|
return mappings;
|
|
50223
50736
|
}, "restoreAnnotationRecords");
|
|
50224
50737
|
|
|
50225
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50738
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
|
|
50226
50739
|
var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
50227
50740
|
async preview(request) {
|
|
50228
50741
|
const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
|
|
@@ -50252,239 +50765,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
50252
50765
|
}
|
|
50253
50766
|
}), "projectAnnotationStoreOver");
|
|
50254
50767
|
|
|
50255
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
50256
|
-
import { createHash as createHash20 } from "node:crypto";
|
|
50257
|
-
var RECORDS_SCHEMA_VERSION = 1;
|
|
50258
|
-
var RECORD_OPERATIONS = ["upsert", "delete"];
|
|
50259
|
-
var RECORD_ENTITY_TYPES = ["invoice", "payment", "person", "organization", "project"];
|
|
50260
|
-
var WORD4 = "^[a-z0-9][a-z0-9_-]{0,62}$";
|
|
50261
|
-
var TYPE = "^(invoice|payment|person|organization|project|custom:[a-z0-9][a-z0-9_-]{0,62})$";
|
|
50262
|
-
var MAX_ID = 512;
|
|
50263
|
-
var MAX_FIELDS_BYTES = 65536;
|
|
50264
|
-
var MAX_RELATIONS = 100;
|
|
50265
|
-
var DECIMAL = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
|
|
50266
|
-
var RECORDS_ENVELOPE_SCHEMA = {
|
|
50267
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
50268
|
-
title: "WireCat records envelope, version 1",
|
|
50269
|
-
description: "Records one source sends to the store. JSONL is the same model: the first line holds schema_version and source, each further line one record.",
|
|
50270
|
-
type: "object",
|
|
50271
|
-
required: ["schema_version", "source", "records"],
|
|
50272
|
-
additionalProperties: false,
|
|
50273
|
-
properties: {
|
|
50274
|
-
schema_version: { const: RECORDS_SCHEMA_VERSION },
|
|
50275
|
-
source: { $ref: "#/$defs/source" },
|
|
50276
|
-
records: { type: "array", items: { $ref: "#/$defs/record" } }
|
|
50277
|
-
},
|
|
50278
|
-
$defs: {
|
|
50279
|
-
source: {
|
|
50280
|
-
type: "object",
|
|
50281
|
-
required: ["provider", "account", "batch_id"],
|
|
50282
|
-
additionalProperties: false,
|
|
50283
|
-
properties: {
|
|
50284
|
-
provider: { type: "string", pattern: WORD4, description: "The system the records come from" },
|
|
50285
|
-
account: { type: "string", minLength: 1, maxLength: MAX_ID, description: "The account in that system" },
|
|
50286
|
-
batch_id: { type: "string", minLength: 1, maxLength: MAX_ID, description: "This import, for the receipt" }
|
|
50287
|
-
}
|
|
50288
|
-
},
|
|
50289
|
-
record: {
|
|
50290
|
-
type: "object",
|
|
50291
|
-
required: ["key", "type", "external_id", "operation"],
|
|
50292
|
-
additionalProperties: false,
|
|
50293
|
-
properties: {
|
|
50294
|
-
key: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
50295
|
-
type: { type: "string", pattern: TYPE },
|
|
50296
|
-
external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
50297
|
-
operation: { enum: [...RECORD_OPERATIONS] },
|
|
50298
|
-
fields: {
|
|
50299
|
-
type: "object",
|
|
50300
|
-
description: "What the source says, as data: never secrets, never instructions"
|
|
50301
|
-
},
|
|
50302
|
-
revision: { type: "integer", minimum: 0, maximum: Number.MAX_SAFE_INTEGER },
|
|
50303
|
-
relations: { type: "array", maxItems: MAX_RELATIONS, items: { $ref: "#/$defs/relation" } }
|
|
50304
|
-
}
|
|
50305
|
-
},
|
|
50306
|
-
relation: {
|
|
50307
|
-
type: "object",
|
|
50308
|
-
required: ["role", "type", "external_id"],
|
|
50309
|
-
additionalProperties: false,
|
|
50310
|
-
properties: {
|
|
50311
|
-
role: { type: "string", pattern: WORD4 },
|
|
50312
|
-
type: { type: "string", pattern: TYPE },
|
|
50313
|
-
external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
50314
|
-
amount: {
|
|
50315
|
-
type: "string",
|
|
50316
|
-
pattern: DECIMAL,
|
|
50317
|
-
description: "A settles relation's share of the payment, a decimal in its currency"
|
|
50318
|
-
}
|
|
50319
|
-
}
|
|
50320
|
-
}
|
|
50321
|
-
}
|
|
50322
|
-
};
|
|
50323
|
-
var wordPattern = new RegExp(WORD4);
|
|
50324
|
-
var typePattern = new RegExp(TYPE);
|
|
50325
|
-
var decimalPattern = new RegExp(DECIMAL);
|
|
50326
|
-
var isObject2 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isObject");
|
|
50327
|
-
var escapePointer = /* @__PURE__ */ __name((segment) => String(segment).replaceAll("~", "~0").replaceAll("/", "~1"), "escapePointer");
|
|
50328
|
-
var pointerOf = /* @__PURE__ */ __name((...segments) => segments.map((s) => `/${escapePointer(s)}`).join(""), "pointerOf");
|
|
50329
|
-
var idText = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" && value.length <= MAX_ID && !value.includes("\0"), "idText");
|
|
50330
|
-
var extraKeys = /* @__PURE__ */ __name((value, allowed) => Object.keys(value).filter((key2) => !allowed.includes(key2)), "extraKeys");
|
|
50331
|
-
var secretIn = /* @__PURE__ */ __name((value, at) => {
|
|
50332
|
-
if (typeof value === "string")
|
|
50333
|
-
return holdsCredential(value) ? at : void 0;
|
|
50334
|
-
if (Array.isArray(value)) {
|
|
50335
|
-
for (const [index2, item] of value.entries()) {
|
|
50336
|
-
const found2 = secretIn(item, [...at, index2]);
|
|
50337
|
-
if (found2)
|
|
50338
|
-
return found2;
|
|
50339
|
-
}
|
|
50340
|
-
return void 0;
|
|
50341
|
-
}
|
|
50342
|
-
if (!isObject2(value))
|
|
50343
|
-
return void 0;
|
|
50344
|
-
for (const [key2, item] of Object.entries(value)) {
|
|
50345
|
-
if (secretNamed(key2))
|
|
50346
|
-
return [...at, key2];
|
|
50347
|
-
const found2 = secretIn(item, [...at, key2]);
|
|
50348
|
-
if (found2)
|
|
50349
|
-
return found2;
|
|
50350
|
-
}
|
|
50351
|
-
return void 0;
|
|
50352
|
-
}, "secretIn");
|
|
50353
|
-
var relationErrors = /* @__PURE__ */ __name((relations, at) => {
|
|
50354
|
-
if (relations === void 0)
|
|
50355
|
-
return [];
|
|
50356
|
-
if (!Array.isArray(relations) || relations.length > MAX_RELATIONS)
|
|
50357
|
-
return [invalid12(at, `relations is a list of at most ${MAX_RELATIONS}`)];
|
|
50358
|
-
return relations.flatMap((relation, index2) => {
|
|
50359
|
-
const here = [...at, index2];
|
|
50360
|
-
if (!isObject2(relation))
|
|
50361
|
-
return [invalid12(here, "a relation is an object")];
|
|
50362
|
-
const extra = extraKeys(relation, ["role", "type", "external_id", "amount"]);
|
|
50363
|
-
if (extra.length > 0)
|
|
50364
|
-
return [invalid12([...here, extra[0]], "a relation holds role, type, external_id and amount")];
|
|
50365
|
-
if (typeof relation.role !== "string" || !wordPattern.test(relation.role))
|
|
50366
|
-
return [invalid12([...here, "role"], "a role is lowercase letters, digits, - and _")];
|
|
50367
|
-
if (typeof relation.type !== "string" || !typePattern.test(relation.type))
|
|
50368
|
-
return [invalid12([...here, "type"], `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`)];
|
|
50369
|
-
if (!idText(relation.external_id))
|
|
50370
|
-
return [invalid12([...here, "external_id"], `an external id takes 1\u2013${MAX_ID} characters`)];
|
|
50371
|
-
if (relation.amount !== void 0 && (typeof relation.amount !== "string" || !decimalPattern.test(relation.amount)))
|
|
50372
|
-
return [invalid12([...here, "amount"], 'an amount is a decimal string, such as "13000.00"')];
|
|
50373
|
-
if (relation.amount !== void 0 && relation.role !== "settles")
|
|
50374
|
-
return [invalid12([...here, "amount"], "only a settles relation carries an amount")];
|
|
50375
|
-
return [];
|
|
50376
|
-
});
|
|
50377
|
-
}, "relationErrors");
|
|
50378
|
-
var invalid12 = /* @__PURE__ */ __name((at, message2, code = "record.invalid") => ({
|
|
50379
|
-
pointer: pointerOf(...at),
|
|
50380
|
-
code,
|
|
50381
|
-
message: message2
|
|
50382
|
-
}), "invalid");
|
|
50383
|
-
var recordErrors = /* @__PURE__ */ __name((record4, index2) => {
|
|
50384
|
-
const at = ["records", index2];
|
|
50385
|
-
if (!isObject2(record4))
|
|
50386
|
-
return [invalid12(at, "a record is an object")];
|
|
50387
|
-
const key2 = typeof record4.key === "string" ? record4.key : void 0;
|
|
50388
|
-
const withKey = /* @__PURE__ */ __name((errors) => errors.map((error) => key2 === void 0 ? error : { ...error, key: key2 }), "withKey");
|
|
50389
|
-
const extra = extraKeys(record4, ["key", "type", "external_id", "operation", "fields", "revision", "relations"]);
|
|
50390
|
-
if (extra.length > 0)
|
|
50391
|
-
return withKey([invalid12([...at, extra[0]], `a record has no ${extra[0]}`)]);
|
|
50392
|
-
if (!idText(record4.key))
|
|
50393
|
-
return [invalid12([...at, "key"], `a key takes 1\u2013${MAX_ID} characters`)];
|
|
50394
|
-
if (typeof record4.type !== "string" || !typePattern.test(record4.type))
|
|
50395
|
-
return withKey([
|
|
50396
|
-
invalid12([...at, "type"], `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`, "record.type")
|
|
50397
|
-
]);
|
|
50398
|
-
if (!idText(record4.external_id))
|
|
50399
|
-
return withKey([invalid12([...at, "external_id"], `an external id takes 1\u2013${MAX_ID} characters`)]);
|
|
50400
|
-
if (!RECORD_OPERATIONS.includes(record4.operation))
|
|
50401
|
-
return withKey([invalid12([...at, "operation"], "an operation is upsert or delete")]);
|
|
50402
|
-
if (record4.revision !== void 0 && (typeof record4.revision !== "number" || !Number.isSafeInteger(record4.revision) || record4.revision < 0))
|
|
50403
|
-
return withKey([invalid12([...at, "revision"], "a revision is a whole number, 0 or more")]);
|
|
50404
|
-
if (record4.operation === "upsert" && !isObject2(record4.fields))
|
|
50405
|
-
return withKey([invalid12([...at, "fields"], "an upsert carries its fields as an object")]);
|
|
50406
|
-
if (record4.fields !== void 0 && !isObject2(record4.fields))
|
|
50407
|
-
return withKey([invalid12([...at, "fields"], "fields is an object")]);
|
|
50408
|
-
if (record4.fields !== void 0 && Buffer.byteLength(JSON.stringify(record4.fields)) > MAX_FIELDS_BYTES)
|
|
50409
|
-
return withKey([invalid12([...at, "fields"], `fields take at most ${MAX_FIELDS_BYTES} bytes`, "record.too-large")]);
|
|
50410
|
-
const secret = record4.fields === void 0 ? void 0 : secretIn(record4.fields, [...at, "fields"]);
|
|
50411
|
-
if (secret)
|
|
50412
|
-
return withKey([
|
|
50413
|
-
invalid12(secret, "a secret never goes into the store: drop this field at the source", "record.secret-field")
|
|
50414
|
-
]);
|
|
50415
|
-
return withKey(relationErrors(record4.relations, [...at, "relations"]));
|
|
50416
|
-
}, "recordErrors");
|
|
50417
|
-
var envelopeErrors = /* @__PURE__ */ __name((envelope, account) => {
|
|
50418
|
-
if (!isObject2(envelope))
|
|
50419
|
-
return [invalid12([], "an envelope is an object", "envelope.invalid")];
|
|
50420
|
-
const extra = extraKeys(envelope, ["schema_version", "source", "records"]);
|
|
50421
|
-
if (extra.length > 0)
|
|
50422
|
-
return [invalid12([extra[0]], `an envelope has no ${extra[0]}`, "envelope.invalid")];
|
|
50423
|
-
if (envelope.schema_version !== RECORDS_SCHEMA_VERSION)
|
|
50424
|
-
return [
|
|
50425
|
-
invalid12(["schema_version"], `this build reads schema_version ${RECORDS_SCHEMA_VERSION}, not ${JSON.stringify(envelope.schema_version)}`, "envelope.schema-version")
|
|
50426
|
-
];
|
|
50427
|
-
const { source: source2 } = envelope;
|
|
50428
|
-
if (!isObject2(source2))
|
|
50429
|
-
return [invalid12(["source"], "source is an object", "envelope.invalid")];
|
|
50430
|
-
const sourceExtra = extraKeys(source2, ["provider", "account", "batch_id"]);
|
|
50431
|
-
if (sourceExtra.length > 0)
|
|
50432
|
-
return [
|
|
50433
|
-
invalid12(["source", sourceExtra[0]], "source holds provider, account and batch_id", "envelope.invalid")
|
|
50434
|
-
];
|
|
50435
|
-
if (typeof source2.provider !== "string" || !wordPattern.test(source2.provider))
|
|
50436
|
-
return [invalid12(["source", "provider"], "a provider is lowercase letters, digits, - and _", "envelope.invalid")];
|
|
50437
|
-
if (!idText(source2.account))
|
|
50438
|
-
return [invalid12(["source", "account"], `an account takes 1\u2013${MAX_ID} characters`, "envelope.invalid")];
|
|
50439
|
-
if (!idText(source2.batch_id))
|
|
50440
|
-
return [invalid12(["source", "batch_id"], `a batch id takes 1\u2013${MAX_ID} characters`, "envelope.invalid")];
|
|
50441
|
-
if (source2.account !== account)
|
|
50442
|
-
return [
|
|
50443
|
-
invalid12(["source", "account"], `the envelope is for account ${JSON.stringify(source2.account)}, the import for ${JSON.stringify(account)}`, "envelope.account-mismatch")
|
|
50444
|
-
];
|
|
50445
|
-
if (!Array.isArray(envelope.records))
|
|
50446
|
-
return [invalid12(["records"], "records is a list", "envelope.invalid")];
|
|
50447
|
-
return [];
|
|
50448
|
-
}, "envelopeErrors");
|
|
50449
|
-
var canonical2 = /* @__PURE__ */ __name((value) => {
|
|
50450
|
-
if (Array.isArray(value))
|
|
50451
|
-
return value.map(canonical2);
|
|
50452
|
-
if (!isObject2(value))
|
|
50453
|
-
return value;
|
|
50454
|
-
return Object.fromEntries(Object.keys(value).sort().map((key2) => [key2, canonical2(value[key2])]));
|
|
50455
|
-
}, "canonical");
|
|
50456
|
-
var recordFingerprint = /* @__PURE__ */ __name((fields4, relations) => createHash20("sha256").update(JSON.stringify(canonical2({
|
|
50457
|
-
fields: fields4,
|
|
50458
|
-
relations: relations.map((relation) => [
|
|
50459
|
-
relation.role,
|
|
50460
|
-
relation.type,
|
|
50461
|
-
relation.external_id,
|
|
50462
|
-
...relation.amount === void 0 ? [] : [relation.amount]
|
|
50463
|
-
]).sort((a, b) => a.join("\0").localeCompare(b.join("\0")))
|
|
50464
|
-
}))).digest("hex"), "recordFingerprint");
|
|
50465
|
-
var envelopeOfJsonl = /* @__PURE__ */ __name((text6) => {
|
|
50466
|
-
const lines = text6.split(/\r?\n/);
|
|
50467
|
-
const first = lines.findIndex((line) => line.trim() !== "");
|
|
50468
|
-
if (first < 0)
|
|
50469
|
-
return {};
|
|
50470
|
-
const parse = /* @__PURE__ */ __name((line) => {
|
|
50471
|
-
try {
|
|
50472
|
-
return JSON.parse(line);
|
|
50473
|
-
} catch {
|
|
50474
|
-
return line;
|
|
50475
|
-
}
|
|
50476
|
-
}, "parse");
|
|
50477
|
-
const header = parse(lines[first]);
|
|
50478
|
-
const records2 = [];
|
|
50479
|
-
for (let at = first + 1; at < lines.length; at++) {
|
|
50480
|
-
const line = lines[at];
|
|
50481
|
-
if (line.trim() !== "")
|
|
50482
|
-
records2.push(parse(line));
|
|
50483
|
-
}
|
|
50484
|
-
return isObject2(header) ? { ...header, records: records2 } : header;
|
|
50485
|
-
}, "envelopeOfJsonl");
|
|
50486
|
-
|
|
50487
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.589.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_0ee3f6df6a9715cc0d8fd3b6006034a9/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
|
|
50768
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
|
|
50488
50769
|
var PROJECTED = {
|
|
50489
50770
|
invoice: { roles: ["issuer", "counterparty", "project"], many: [] },
|
|
50490
50771
|
payment: { roles: ["payer", "payee", "project", "settles"], many: ["settles"] }
|
|
@@ -50897,7 +51178,7 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
50897
51178
|
};
|
|
50898
51179
|
}, "recordStoreOver");
|
|
50899
51180
|
|
|
50900
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51181
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
|
|
50901
51182
|
var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
|
|
50902
51183
|
const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
|
|
50903
51184
|
let merged = { from: from2, to };
|
|
@@ -50910,7 +51191,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
|
|
|
50910
51191
|
}, "markRange");
|
|
50911
51192
|
var ranges = /* @__PURE__ */ __name(({ orm }, chatKey) => orm.select({ from: syncRanges.fromKey, to: syncRanges.toKey }).from(syncRanges).where(eq(syncRanges.chatId, chatKey)).orderBy(syncRanges.fromKey).all(), "ranges");
|
|
50912
51193
|
|
|
50913
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51194
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
|
|
50914
51195
|
var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
|
|
50915
51196
|
var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
|
|
50916
51197
|
chatId: String(row2.key).slice(prefix.length),
|
|
@@ -50931,7 +51212,7 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
|
|
|
50931
51212
|
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(prefixOf2(account) + chatId, JSON.stringify({ ...saved, checkedAt: checkedAt ?? new Date(now2).toISOString() }), now2);
|
|
50932
51213
|
}, "setTaskAnalysisMark");
|
|
50933
51214
|
|
|
50934
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51215
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
|
|
50935
51216
|
var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
|
|
50936
51217
|
var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
|
|
50937
51218
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
|
|
@@ -50941,7 +51222,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
|
|
|
50941
51222
|
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(keyOf4(account), JSON.stringify(until), now2);
|
|
50942
51223
|
}, "setTaskRulesStop");
|
|
50943
51224
|
|
|
50944
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51225
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sync.js
|
|
50945
51226
|
var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
50946
51227
|
const { database } = context;
|
|
50947
51228
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
|
|
@@ -51000,7 +51281,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
51000
51281
|
};
|
|
51001
51282
|
}, "syncStoreOver");
|
|
51002
51283
|
|
|
51003
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51284
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/tags.js
|
|
51004
51285
|
var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
51005
51286
|
const { database } = context;
|
|
51006
51287
|
return {
|
|
@@ -51022,7 +51303,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
51022
51303
|
};
|
|
51023
51304
|
}, "tagsStoreOver");
|
|
51024
51305
|
|
|
51025
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51306
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
|
|
51026
51307
|
var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
|
|
51027
51308
|
var neighbours = /* @__PURE__ */ __name(({ orm }, chatKey, messagePk, sentAt, { messages: messages2, withinMs }, side) => orm.all(sql`SELECT sender_name AS sender, text, sent_at AS sentAt FROM messages
|
|
51028
51309
|
WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
|
|
@@ -51149,7 +51430,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
|
|
|
51149
51430
|
dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
|
|
51150
51431
|
}, "savePictureChunks");
|
|
51151
51432
|
|
|
51152
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51433
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
|
|
51153
51434
|
var messagesToEmbed = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model, after: after2, limit }) => orm.all(sql`SELECT m.id AS messagePk, m.text, m.sent_at AS sentAt, k.content_hash AS hash,
|
|
51154
51435
|
EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
|
|
51155
51436
|
FROM messages m
|
|
@@ -51238,7 +51519,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
|
|
|
51238
51519
|
return plain2(best(found2));
|
|
51239
51520
|
}, "nearestMessages");
|
|
51240
51521
|
|
|
51241
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51522
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/vectors.js
|
|
51242
51523
|
var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
51243
51524
|
const { database } = context;
|
|
51244
51525
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -51496,7 +51777,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
51496
51777
|
embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
|
|
51497
51778
|
}), "vectorsStoreOver");
|
|
51498
51779
|
|
|
51499
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51780
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
|
|
51500
51781
|
import { existsSync, readFileSync as readFileSync4 } from "node:fs";
|
|
51501
51782
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
51502
51783
|
var BOOKKEEPING = ["schema_migrations", "store_settings"];
|
|
@@ -51584,10 +51865,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
|
|
|
51584
51865
|
}
|
|
51585
51866
|
}, "lastBackup");
|
|
51586
51867
|
|
|
51587
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51868
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/providers.js
|
|
51588
51869
|
var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
|
|
51589
51870
|
|
|
51590
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51871
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
|
|
51591
51872
|
var COUNTED_TABLES = [
|
|
51592
51873
|
"accounts",
|
|
51593
51874
|
"chats",
|
|
@@ -51672,7 +51953,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
|
|
|
51672
51953
|
};
|
|
51673
51954
|
}, "storeContents");
|
|
51674
51955
|
|
|
51675
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
51956
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.593.0_@wirecat+cli-base@0.78.0_commander@15.0.0_esbuild@0.28.2_type_a38dc1e51ab7f561f21ddbf6a1611494/node_modules/@wirecat/cli-core/dist/store/store.js
|
|
51676
51957
|
var openStore = /* @__PURE__ */ __name(async (options = {}) => {
|
|
51677
51958
|
const context = await openStoreContext(options);
|
|
51678
51959
|
try {
|
|
@@ -51739,6 +52020,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
51739
52020
|
const finance = once3(() => financeStoreOver(context));
|
|
51740
52021
|
const orders2 = once3(() => ordersStoreOver(context));
|
|
51741
52022
|
const deals2 = once3(() => dealsStoreOver(context));
|
|
52023
|
+
const crm = once3(() => crmCopiesOver(context, accountPeopleOver(context)));
|
|
51742
52024
|
const records2 = once3(() => recordStoreOver(context));
|
|
51743
52025
|
const memories2 = once3(() => memoriesStoreOver(context));
|
|
51744
52026
|
const proposedActions2 = once3(() => proposedActionsStoreOver(context));
|
|
@@ -51852,6 +52134,9 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
51852
52134
|
get deals() {
|
|
51853
52135
|
return deals2();
|
|
51854
52136
|
},
|
|
52137
|
+
get crm() {
|
|
52138
|
+
return crm();
|
|
52139
|
+
},
|
|
51855
52140
|
get records() {
|
|
51856
52141
|
return records2();
|
|
51857
52142
|
},
|
|
@@ -52018,6 +52303,10 @@ export {
|
|
|
52018
52303
|
resetSearchIndex,
|
|
52019
52304
|
fillStems,
|
|
52020
52305
|
resetStems,
|
|
52306
|
+
pointerOf,
|
|
52307
|
+
recordErrors,
|
|
52308
|
+
envelopeErrors,
|
|
52309
|
+
envelopeOfJsonl,
|
|
52021
52310
|
EVIDENCE_FINDINGS_KIND,
|
|
52022
52311
|
validateEvidenceFindings,
|
|
52023
52312
|
calendarMoment,
|
|
@@ -52049,10 +52338,6 @@ export {
|
|
|
52049
52338
|
SnapshotBudget,
|
|
52050
52339
|
projectAnnotationSnapshot,
|
|
52051
52340
|
previewAnnotationSnapshot,
|
|
52052
|
-
pointerOf,
|
|
52053
|
-
recordErrors,
|
|
52054
|
-
envelopeErrors,
|
|
52055
|
-
envelopeOfJsonl,
|
|
52056
52341
|
readStoreTables,
|
|
52057
52342
|
fileFacts,
|
|
52058
52343
|
registerProvider2 as registerProvider,
|