@wirecat/notion-cli 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/README.md +14 -4
- package/contracts/wirecat.json +698 -1
- package/dist/bin/notion.js +2 -2
- package/dist/bundle/{all-profiles-OETMCOLN.js → all-profiles-4IONYZB6.js} +10 -10
- package/dist/bundle/{anthropic-5Y3O2TYM.js → anthropic-OXF74J4P.js} +6 -6
- package/dist/bundle/{app-server-IVWBIVHC.js → app-server-M2VF6ABM.js} +61 -52
- package/dist/bundle/{bun-EO636SAD.js → bun-DLA6QRLL.js} +2 -2
- package/dist/bundle/{bun-sqlite-C2T7QJ2M.js → bun-sqlite-F4BYLW3F.js} +7 -7
- package/dist/bundle/{chunk-QBC23NHD.js → chunk-2MHMKNWD.js} +1 -1
- package/dist/bundle/{chunk-TSCIIXN3.js → chunk-4KUJTSHG.js} +2 -2
- package/dist/bundle/{chunk-24FAYAML.js → chunk-4TQVZXOV.js} +3 -3
- package/dist/bundle/{chunk-FF4DDBCB.js → chunk-5LBJNTEJ.js} +6 -6
- package/dist/bundle/chunk-5UA2TYMI.js +29 -0
- package/dist/bundle/{chunk-DIM5YWBU.js → chunk-5XP4KQ2F.js} +1 -1
- package/dist/bundle/{chunk-WM7663C2.js → chunk-6GN7KU7X.js} +9 -9
- package/dist/bundle/chunk-6JBLIQQN.js +16 -0
- package/dist/bundle/{chunk-CLG2ISQH.js → chunk-7NF3V5L2.js} +4 -4
- package/dist/bundle/{chunk-TR7R5DL4.js → chunk-7NGFGFE5.js} +12 -63
- package/dist/bundle/{chunk-YA4LSSDZ.js → chunk-7NVPM55S.js} +2913 -2371
- package/dist/bundle/{chunk-XC5CKHX2.js → chunk-7YZPBAQX.js} +1 -1
- package/dist/bundle/{chunk-RSIS7BR7.js → chunk-AYU5TFDU.js} +21 -21
- package/dist/bundle/{chunk-64D5VUZ4.js → chunk-BEPFGITI.js} +68 -64
- package/dist/bundle/{chunk-HRTIRRXR.js → chunk-CBGBFAYJ.js} +41 -6
- package/dist/bundle/{chunk-QC3KOJT4.js → chunk-CDGZZNGY.js} +6 -6
- package/dist/bundle/{chunk-JK44XO2S.js → chunk-CIVXTBJY.js} +56 -56
- package/dist/bundle/{chunk-OWJDC4CB.js → chunk-COH7OEER.js} +14 -13
- package/dist/bundle/{chunk-XL2HXHP3.js → chunk-D6RCRBDH.js} +2 -2
- package/dist/bundle/{chunk-47R43UVJ.js → chunk-EQPAZ33O.js} +19 -19
- package/dist/bundle/{chunk-AE2KQ37N.js → chunk-EY6S7FV3.js} +6 -6
- package/dist/bundle/chunk-FEMHUSGO.js +88 -0
- package/dist/bundle/{chunk-NLDYZBTC.js → chunk-FSJHASRQ.js} +1146 -2555
- package/dist/bundle/chunk-GBFEEHQC.js +385 -0
- package/dist/bundle/{chunk-IQWEJEB5.js → chunk-GCCPFKSU.js} +26264 -21086
- package/dist/bundle/{chunk-RDZ7SVBZ.js → chunk-GK4GLPG2.js} +3 -3
- package/dist/bundle/{chunk-B2XKEEFX.js → chunk-GSNE7OB4.js} +4 -4
- package/dist/bundle/{chunk-UWW24JQF.js → chunk-HTKSCSJU.js} +4 -4
- package/dist/bundle/{chunk-7FII4DCE.js → chunk-IJMFG7HB.js} +7 -7
- package/dist/bundle/{chunk-WVZFXI36.js → chunk-JIRRF6BM.js} +4 -4
- package/dist/bundle/{chunk-ST2UC7FS.js → chunk-JODE2XED.js} +31 -27
- package/dist/bundle/{chunk-CWVAYQXI.js → chunk-K5I64ZVI.js} +9 -9
- package/dist/bundle/chunk-KFVDL2QS.js +146 -0
- package/dist/bundle/{chunk-JKIN5TOU.js → chunk-KL3P5TQK.js} +4 -4
- package/dist/bundle/chunk-L62XTC7N.js +726 -0
- package/dist/bundle/chunk-L6H7PY4X.js +170 -0
- package/dist/bundle/{chunk-F6MLJ3V5.js → chunk-LIQMUDIZ.js} +2 -2
- package/dist/bundle/{chunk-HWRKURQH.js → chunk-M2EEIYBU.js} +2 -2
- package/dist/bundle/chunk-M6DGZ2O6.js +823 -0
- package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
- package/dist/bundle/{chunk-UWIA2G6Q.js → chunk-MRA62W5K.js} +404 -537
- package/dist/bundle/{chunk-XYIT2XB3.js → chunk-MVA5HVKL.js} +20 -0
- package/dist/bundle/{chunk-GA3URWIF.js → chunk-NO2LIHWA.js} +1 -1
- package/dist/bundle/{chunk-ESZT4WW3.js → chunk-OCDJ4FFA.js} +4 -4
- package/dist/bundle/{chunk-B4B65XIO.js → chunk-OI5DWZJG.js} +3 -3
- package/dist/bundle/chunk-P3P6DA6K.js +259 -0
- package/dist/bundle/chunk-QX3TPFEX.js +1977 -0
- package/dist/bundle/{chunk-EU5WCOMQ.js → chunk-R6SDRSZK.js} +76 -35
- package/dist/bundle/{chunk-K5TWMQSY.js → chunk-RMJMID5D.js} +8 -8
- package/dist/bundle/{chunk-RLSFOR2D.js → chunk-SGBS5QCU.js} +4 -4
- package/dist/bundle/{chunk-3D3PFXBP.js → chunk-T5UNSFES.js} +10 -15
- package/dist/bundle/{chunk-RAZKIHGH.js → chunk-TFNRCCGR.js} +4 -4
- package/dist/bundle/{chunk-WK3OSDNV.js → chunk-TJCPTRYD.js} +7 -7
- package/dist/bundle/{chunk-BWICUW7W.js → chunk-TXONV3HW.js} +2 -2
- package/dist/bundle/{chunk-AQZO3ITW.js → chunk-TZ2QJ53V.js} +2 -2
- package/dist/bundle/{chunk-35K5T6WV.js → chunk-UKE3CGHK.js} +1 -1
- package/dist/bundle/{chunk-7N5QB6NL.js → chunk-UROEWCOG.js} +5 -3
- package/dist/bundle/chunk-WHJWURZB.js +335 -0
- package/dist/bundle/{chunk-R6ZM45NF.js → chunk-WU3XHGOB.js} +185 -57
- package/dist/bundle/{chunk-2YR3RYT4.js → chunk-WZEEEQGC.js} +3 -3
- package/dist/bundle/{chunk-B2WFKFYL.js → chunk-XCTOCVMW.js} +20 -116
- package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
- package/dist/bundle/{chunk-EGTBL3MJ.js → chunk-Y5LAJWR5.js} +1 -1
- package/dist/bundle/{chunk-66PL7P4C.js → chunk-YAPDU3SV.js} +1 -1
- package/dist/bundle/{chunk-WWMB4UHF.js → chunk-YFWLHTNO.js} +1 -1
- package/dist/bundle/{chunk-KHOVVPLC.js → chunk-YGCI3DHS.js} +1 -1
- package/dist/bundle/{chunk-4GC5DBHW.js → chunk-Z53LYX4M.js} +3 -3
- package/dist/bundle/{chunk-EPAZ7DJB.js → chunk-ZC6ZQQ55.js} +48 -45
- package/dist/bundle/command-contract-UBXS6NHI.js +38 -0
- package/dist/bundle/{command-server-entry-A66DJ3MH.js → command-server-entry-2SORMVRM.js} +27 -24
- package/dist/bundle/decode-5O7IEFPN.js +297 -0
- package/dist/bundle/{dispatch-FEKU5UXC.js → dispatch-YHQX6FEJ.js} +8 -8
- package/dist/bundle/{dist-YFKABFFF.js → dist-ILNOLGYN.js} +1 -1
- package/dist/bundle/{echarts-XD2JSWU4.js → echarts-ARLMVQC7.js} +2 -2
- package/dist/bundle/{embed-F3HYGAF7.js → embed-FUDUKQ3K.js} +7 -7
- package/dist/bundle/{embedder-GSEDDUH7.js → embedder-HDRV7GX3.js} +10 -10
- package/dist/bundle/{failure-HDJLR2YJ.js → failure-JHXICWIL.js} +3 -3
- package/dist/bundle/first-run-BGEFTXOE.js +29 -0
- package/dist/bundle/first-screen-F5F3VS6Y.js +38 -0
- package/dist/bundle/{instructions-NZGJ4FW5.js → instructions-MEFIKCDI.js} +1 -1
- package/dist/bundle/{mcp-VFIOZDVY.js → mcp-VMS6PBCU.js} +2 -2
- package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
- package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
- package/dist/bundle/meeting-combined-HNSS3FQY.js +24 -0
- package/dist/bundle/meeting-model-REZVYGQW.js +26 -0
- package/dist/bundle/meeting-semantic-R4CSLVRG.js +22 -0
- package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
- package/dist/bundle/{node-RPKPDYQS.js → node-MAQALPLA.js} +2 -2
- package/dist/bundle/{node-sqlite-KH2UUYVO.js → node-sqlite-J7IJYNBO.js} +8 -8
- package/dist/bundle/notion.js +14 -14
- package/dist/bundle/{oauth-NKAI7TQD.js → oauth-AMV4YGJD.js} +8 -8
- package/dist/bundle/{open-WSAEAA2V.js → open-AB27MTGR.js} +6 -6
- package/dist/bundle/{openai-JPVDGHG5.js → openai-D77MU5XV.js} +31 -29
- package/dist/bundle/{process-5ZFVKOQX.js → process-SIOWTRJ6.js} +1 -1
- package/dist/bundle/{program-M3D56D6T.js → program-QC5MX4ZJ.js} +7533 -1997
- package/dist/bundle/{prompt-FROYQ5LV.js → prompt-W77YDHA6.js} +6 -6
- package/dist/bundle/{recognize-NYCHQMCX.js → recognize-3JAXQQ36.js} +5 -5
- package/dist/bundle/{remote-4OERF3Z4.js → remote-PSOJXCXO.js} +11 -11
- package/dist/bundle/{rerank-TEGXFUWY.js → rerank-EE44ZTGL.js} +8 -8
- package/dist/bundle/{schemas-MZNNOEYN.js → schemas-LBYUMBC6.js} +2 -2
- package/dist/bundle/{serve-HLYYBAXY.js → serve-XJMGAMFW.js} +10 -10
- package/dist/bundle/{server-D5OYNEUW.js → server-ASU6CP5R.js} +53 -44
- package/dist/bundle/server-WSPQ5EOA.js +72 -0
- package/dist/bundle/services-PT4PA4J6.js +588 -0
- package/dist/bundle/{sqlite-runtime-H2S5RR2F.js → sqlite-runtime-YHXRTVXE.js} +7 -7
- package/dist/bundle/{state-OPOXCDZL.js → state-T6ZKFWGD.js} +7 -7
- package/dist/bundle/{store-NHMXEJPD.js → store-3MUCZEI3.js} +20 -14
- package/dist/bundle/{store-Y3KRLCJ7.js → store-E5EE25FY.js} +30 -21
- package/dist/bundle/store-maintenance-command-ZZ55BBBG.js +63 -0
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +13 -4
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/documents.d.ts +10 -1
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +175 -5
- package/dist/commands/documents.js.map +1 -1
- package/dist/commands/library.d.ts +10 -0
- package/dist/commands/library.d.ts.map +1 -0
- package/dist/commands/library.js +470 -0
- package/dist/commands/library.js.map +1 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +4 -3
- package/dist/commands/session.js.map +1 -1
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +73 -5
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +8 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +15 -3
- package/dist/context.js.map +1 -1
- package/dist/generated/types.d.ts +485 -375
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -0
- package/dist/identity.js.map +1 -1
- package/dist/knowledge.d.ts +27 -0
- package/dist/knowledge.d.ts.map +1 -0
- package/dist/knowledge.js +87 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/library.d.ts +44 -0
- package/dist/library.d.ts.map +1 -0
- package/dist/library.js +149 -0
- package/dist/library.js.map +1 -0
- package/dist/notion/client.d.ts +4 -1
- package/dist/notion/client.d.ts.map +1 -1
- package/dist/notion/client.js +5 -2
- package/dist/notion/client.js.map +1 -1
- package/dist/notion/errors.d.ts +5 -0
- package/dist/notion/errors.d.ts.map +1 -1
- package/dist/notion/errors.js +33 -1
- package/dist/notion/errors.js.map +1 -1
- package/dist/notion/reads.d.ts +4 -0
- package/dist/notion/reads.d.ts.map +1 -1
- package/dist/notion/writes.d.ts +40 -0
- package/dist/notion/writes.d.ts.map +1 -0
- package/dist/notion/writes.js +112 -0
- package/dist/notion/writes.js.map +1 -0
- package/dist/program.js +2 -2
- package/dist/program.js.map +1 -1
- package/dist/sync/cursor.d.ts +93 -0
- package/dist/sync/cursor.d.ts.map +1 -1
- package/dist/sync/cursor.js +63 -2
- package/dist/sync/cursor.js.map +1 -1
- package/dist/sync/files.d.ts +87 -0
- package/dist/sync/files.d.ts.map +1 -0
- package/dist/sync/files.js +31 -0
- package/dist/sync/files.js.map +1 -0
- package/dist/sync/markdown.d.ts +4 -1
- package/dist/sync/markdown.d.ts.map +1 -1
- package/dist/sync/markdown.js +8 -6
- package/dist/sync/markdown.js.map +1 -1
- package/dist/sync/source.d.ts +6 -59
- package/dist/sync/source.d.ts.map +1 -1
- package/dist/sync/source.js +650 -271
- package/dist/sync/source.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/notion-cli/SKILL.md +18 -1
- package/dist/bundle/command-contract-6G5DC2FN.js +0 -35
- package/dist/bundle/decode-7XOFRAAT.js +0 -163
- package/dist/bundle/first-run-TXNTIUSP.js +0 -28
- package/dist/bundle/first-screen-JZPJND7J.js +0 -33
- package/dist/bundle/server-LWZGVMNW.js +0 -62
- package/dist/bundle/store-maintenance-command-D4W7WSLQ.js +0 -53
- package/dist/commands/comments.d.ts +0 -3
- package/dist/commands/comments.d.ts.map +0 -1
- package/dist/commands/comments.js +0 -114
- package/dist/commands/comments.js.map +0 -1
- package/dist/sample/comments.d.ts +0 -61
- package/dist/sample/comments.d.ts.map +0 -1
- package/dist/sample/comments.js +0 -39
- package/dist/sample/comments.js.map +0 -1
- package/dist/sample/records.d.ts +0 -16
- package/dist/sample/records.d.ts.map +0 -1
- package/dist/sample/records.js +0 -22
- package/dist/sample/records.js.map +0 -1
- package/dist/sample/transport.d.ts +0 -42
- package/dist/sample/transport.d.ts.map +0 -1
- package/dist/sample/transport.js +0 -153
- package/dist/sample/transport.js.map +0 -1
- /package/dist/bundle/{chunk-ZI3YTXSF.js → chunk-SHTHNBHG.js} +0 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
formatMeetingReference
|
|
5
|
+
} from "./chunk-FSJHASRQ.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-LIQMUDIZ.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
|
|
14
|
+
var positive = /* @__PURE__ */ __name((value, name, max) => {
|
|
15
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
16
|
+
throw new CliError("validation_error", `Invalid ${name}`);
|
|
17
|
+
return value;
|
|
18
|
+
}, "positive");
|
|
19
|
+
var cancel = /* @__PURE__ */ __name((signal) => {
|
|
20
|
+
if (signal?.aborted)
|
|
21
|
+
throw new CliError("cancelled", "Meeting semantic operation was cancelled");
|
|
22
|
+
}, "cancel");
|
|
23
|
+
var account = /* @__PURE__ */ __name((accountId) => positive(accountId, "authorized meeting account", Number.MAX_SAFE_INTEGER), "account");
|
|
24
|
+
var descriptor = /* @__PURE__ */ __name((model) => {
|
|
25
|
+
if (!model || typeof model.key !== "string" || !model.key.trim() || model.key.length > 1e3 || typeof model.model !== "string" || !model.model.trim() || !["local", "remote"].includes(model.kind))
|
|
26
|
+
throw new CliError("validation_error", "An explicit meeting embedding model is required");
|
|
27
|
+
return { key: model.key, model: model.model, kind: model.kind, dims: positive(model.dims, "model dimensions", 8192) };
|
|
28
|
+
}, "descriptor");
|
|
29
|
+
var textBudget = /* @__PURE__ */ __name((options) => ({
|
|
30
|
+
maxRows: positive(options.maxRows ?? 1e4, "transcript row budget", 1e5),
|
|
31
|
+
maxTextBytes: positive(options.maxTextBytes ?? 4 * 1024 * 1024, "transcript text byte budget", 64 * 1024 * 1024)
|
|
32
|
+
}), "textBudget");
|
|
33
|
+
var validateVector = /* @__PURE__ */ __name((vector, dims) => {
|
|
34
|
+
if (!(vector instanceof Float32Array) || vector.length !== dims || !vector.some((value) => value !== 0) || vector.some((value) => !Number.isFinite(value)))
|
|
35
|
+
throw new CliError("invalid_response", "Meeting model returned an invalid vector");
|
|
36
|
+
return vector;
|
|
37
|
+
}, "validateVector");
|
|
38
|
+
var readMeetingSemantic = /* @__PURE__ */ __name(async (store, accountId, query, embedder, options = {}) => {
|
|
39
|
+
const accountIdSnapshot = account(accountId);
|
|
40
|
+
const model = descriptor(embedder);
|
|
41
|
+
if (typeof query !== "string" || !query.trim() || Buffer.byteLength(query, "utf8") > 64 * 1024)
|
|
42
|
+
throw new CliError("validation_error", "Meeting semantic query requires 1\u201365536 UTF-8 bytes");
|
|
43
|
+
const limit = positive(options.limit ?? 20, "semantic result limit", 1e3);
|
|
44
|
+
const maxChunks = positive(options.maxChunks ?? 1e3, "semantic candidate budget", 1e4);
|
|
45
|
+
const afterChunkId = options.afterChunkId === void 0 ? void 0 : positive(options.afterChunkId, "semantic candidate cursor", Number.MAX_SAFE_INTEGER);
|
|
46
|
+
const budget = textBudget(options);
|
|
47
|
+
const signal = options.signal;
|
|
48
|
+
cancel(signal);
|
|
49
|
+
const vectors = await embedder.embed([query], "query");
|
|
50
|
+
cancel(signal);
|
|
51
|
+
if (vectors.length !== 1)
|
|
52
|
+
throw new CliError("invalid_response", "Meeting query model returned another vector count");
|
|
53
|
+
const vector = validateVector(vectors[0], model.dims);
|
|
54
|
+
const result = await store.nearest(model.key, vector, {
|
|
55
|
+
accountId: accountIdSnapshot,
|
|
56
|
+
limit,
|
|
57
|
+
maxChunks,
|
|
58
|
+
...budget,
|
|
59
|
+
...afterChunkId === void 0 ? {} : { afterChunkId },
|
|
60
|
+
...signal ? { signal } : {}
|
|
61
|
+
});
|
|
62
|
+
cancel(signal);
|
|
63
|
+
const items = result.items.map((hit) => {
|
|
64
|
+
positive(hit.meetingId, "semantic meeting ID", Number.MAX_SAFE_INTEGER);
|
|
65
|
+
positive(hit.transcriptId, "semantic transcript ID", Number.MAX_SAFE_INTEGER);
|
|
66
|
+
if (!Number.isSafeInteger(hit.firstPosition) || hit.firstPosition < 0 || !Number.isSafeInteger(hit.lastPosition) || hit.lastPosition < hit.firstPosition || !Number.isFinite(hit.score))
|
|
67
|
+
throw new CliError("invalid_response", "Meeting semantic hit contains invalid provenance");
|
|
68
|
+
const ref = {
|
|
69
|
+
type: "meeting",
|
|
70
|
+
accountId: accountIdSnapshot,
|
|
71
|
+
meetingId: hit.meetingId,
|
|
72
|
+
transcriptId: hit.transcriptId
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
...hit,
|
|
76
|
+
reference: formatMeetingReference(ref),
|
|
77
|
+
firstCueReference: formatMeetingReference({ ...ref, cuePosition: hit.firstPosition }),
|
|
78
|
+
lastCueReference: formatMeetingReference({ ...ref, cuePosition: hit.lastPosition })
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
...result,
|
|
83
|
+
accountId: accountIdSnapshot,
|
|
84
|
+
model,
|
|
85
|
+
items,
|
|
86
|
+
coverage: {
|
|
87
|
+
scope: "current-indexed-vectors",
|
|
88
|
+
candidateScanComplete: result.complete,
|
|
89
|
+
indexCompleteness: "unknown",
|
|
90
|
+
archiveCompleteness: "unknown"
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}, "readMeetingSemantic");
|
|
94
|
+
var proposeMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, selected, options = {}) => {
|
|
95
|
+
const accountIdSnapshot = account(accountId);
|
|
96
|
+
const model = descriptor(selected);
|
|
97
|
+
const signal = options.signal;
|
|
98
|
+
cancel(signal);
|
|
99
|
+
const status = await store.status({ accountId: accountIdSnapshot, model: model.key, ...signal ? { signal } : {} });
|
|
100
|
+
cancel(signal);
|
|
101
|
+
return {
|
|
102
|
+
accountId: accountIdSnapshot,
|
|
103
|
+
model,
|
|
104
|
+
status,
|
|
105
|
+
applied: false,
|
|
106
|
+
scope: "existing-current-chunks",
|
|
107
|
+
rebuildRequired: "explicit"
|
|
108
|
+
};
|
|
109
|
+
}, "proposeMeetingEmbedding");
|
|
110
|
+
var applyMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, embedder, options = {}) => {
|
|
111
|
+
const accountIdSnapshot = account(accountId);
|
|
112
|
+
const model = descriptor(embedder);
|
|
113
|
+
const maxChunks = positive(options.maxChunks ?? 100, "embedding chunk budget", 1e3);
|
|
114
|
+
const budget = textBudget(options);
|
|
115
|
+
const maxVectorBytes = positive(options.maxVectorBytes ?? 8 * 1024 * 1024, "vector payload byte budget", 64 * 1024 * 1024);
|
|
116
|
+
const afterHash = options.afterHash;
|
|
117
|
+
if (afterHash !== void 0 && !/^[0-9a-f]{64}$/.test(afterHash))
|
|
118
|
+
throw new CliError("validation_error", "Invalid embedding chunk cursor");
|
|
119
|
+
const signal = options.signal;
|
|
120
|
+
cancel(signal);
|
|
121
|
+
const page = await store.chunksToEmbed(model.key, {
|
|
122
|
+
accountId: accountIdSnapshot,
|
|
123
|
+
limit: maxChunks,
|
|
124
|
+
...budget,
|
|
125
|
+
...afterHash === void 0 ? {} : { afterHash },
|
|
126
|
+
...signal ? { signal } : {}
|
|
127
|
+
});
|
|
128
|
+
cancel(signal);
|
|
129
|
+
if (typeof page.hasMore !== "boolean" || page.nextHash !== void 0 && !/^[0-9a-f]{64}$/.test(page.nextHash) || page.hasMore && (page.items.length === 0 || page.nextHash === void 0))
|
|
130
|
+
throw new CliError("invalid_response", "Meeting chunk page cannot advance");
|
|
131
|
+
if (page.items.length > maxChunks || page.items.length * model.dims * 4 > maxVectorBytes)
|
|
132
|
+
throw new CliError("validation_error", "Embedding batch exceeds its chunk or vector payload budget");
|
|
133
|
+
const items = page.items.map(({ hash, text }) => ({ hash, text }));
|
|
134
|
+
if (items.some(({ hash, text }) => !/^[0-9a-f]{64}$/.test(hash) || typeof text !== "string") || new Set(items.map(({ hash }) => hash)).size !== items.length)
|
|
135
|
+
throw new CliError("invalid_response", "Meeting chunk page is invalid");
|
|
136
|
+
if (items.reduce((bytes, item) => bytes + Buffer.byteLength(item.text, "utf8"), 0) > budget.maxTextBytes)
|
|
137
|
+
throw new CliError("validation_error", "Embedding batch exceeds its text byte budget");
|
|
138
|
+
if (!items.length)
|
|
139
|
+
return {
|
|
140
|
+
accountId: accountIdSnapshot,
|
|
141
|
+
model,
|
|
142
|
+
saved: 0,
|
|
143
|
+
skipped: 0,
|
|
144
|
+
hasMore: page.hasMore,
|
|
145
|
+
...page.nextHash === void 0 ? {} : { nextHash: page.nextHash }
|
|
146
|
+
};
|
|
147
|
+
const vectors = await embedder.embed(items.map(({ text }) => text), "passage");
|
|
148
|
+
cancel(signal);
|
|
149
|
+
if (vectors.length !== items.length)
|
|
150
|
+
throw new CliError("invalid_response", "Meeting model returned another vector count");
|
|
151
|
+
const rows = items.map(({ hash }, index) => ({ hash, vector: validateVector(vectors[index], model.dims) }));
|
|
152
|
+
const saved = await store.saveCurrent(model.key, model.dims, rows, {
|
|
153
|
+
accountId: accountIdSnapshot,
|
|
154
|
+
...signal ? { signal } : {}
|
|
155
|
+
});
|
|
156
|
+
return {
|
|
157
|
+
accountId: accountIdSnapshot,
|
|
158
|
+
model,
|
|
159
|
+
...saved,
|
|
160
|
+
hasMore: page.hasMore,
|
|
161
|
+
...page.nextHash === void 0 ? {} : { nextHash: page.nextHash }
|
|
162
|
+
};
|
|
163
|
+
}, "applyMeetingEmbedding");
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
validateVector,
|
|
167
|
+
readMeetingSemantic,
|
|
168
|
+
proposeMeetingEmbedding,
|
|
169
|
+
applyMeetingEmbedding
|
|
170
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
|
|
8
8
|
var errorCodes = [
|
|
9
9
|
"validation_error",
|
|
10
10
|
"configuration_error",
|
|
@@ -39,7 +39,7 @@ var CliError = class extends Error {
|
|
|
39
39
|
};
|
|
40
40
|
var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
|
|
41
41
|
|
|
42
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
42
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
|
|
43
43
|
var CONTROL = (
|
|
44
44
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
|
|
45
45
|
/[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
|
|
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
resolvePaths
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AYU5TFDU.js";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-ZVVMGPBJ.js";
|
|
9
9
|
|
|
10
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.680.0_@wirecat+cli-base@0.106.0_commander@15.0.0_esbuild@0.28.2_typ_620ac9b386657c249f5c9038159a7caa/node_modules/@wirecat/cli-core/dist/store/path.js
|
|
11
11
|
import { realpathSync } from "node:fs";
|
|
12
12
|
import { userInfo } from "node:os";
|
|
13
13
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|