@wirecat/slack-cli 0.0.0-stage → 0.1.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 +104 -0
- package/LICENSE +204 -0
- package/README.md +131 -2
- package/contracts/wirecat.json +5526 -0
- package/dist/bin/slack.d.ts +3 -0
- package/dist/bin/slack.d.ts.map +1 -0
- package/dist/bin/slack.js +40 -0
- package/dist/bin/slack.js.map +1 -0
- package/dist/bundle/agent-GOFXFUQP.js +37 -0
- package/dist/bundle/all-profiles-4C7VOT2D.js +320 -0
- package/dist/bundle/anthropic-ZD66TC5S.js +91 -0
- package/dist/bundle/app-server-QNCVEDMY.js +249 -0
- package/dist/bundle/bun-2FULBYXS.js +169 -0
- package/dist/bundle/bun-sqlite-PMS26ZUT.js +76 -0
- package/dist/bundle/chunk-2LB5BWC4.js +362 -0
- package/dist/bundle/chunk-2ZEYRHZV.js +18 -0
- package/dist/bundle/chunk-3IJ3THPV.js +7 -0
- package/dist/bundle/chunk-4HSVEQ3R.js +29 -0
- package/dist/bundle/chunk-4QPMHVM5.js +1007 -0
- package/dist/bundle/chunk-53LIHHXC.js +16 -0
- package/dist/bundle/chunk-5F36CXDM.js +794 -0
- package/dist/bundle/chunk-5LPREGD3.js +12636 -0
- package/dist/bundle/chunk-5R5YRYIP.js +1148 -0
- package/dist/bundle/chunk-5RSQTG7L.js +388 -0
- package/dist/bundle/chunk-5SXZETJF.js +170 -0
- package/dist/bundle/chunk-6PDQP5RM.js +50 -0
- package/dist/bundle/chunk-75BLNPN3.js +1197 -0
- package/dist/bundle/chunk-7BEO72EN.js +131 -0
- package/dist/bundle/chunk-7F6RNAIM.js +230 -0
- package/dist/bundle/chunk-AG7FP64Z.js +77 -0
- package/dist/bundle/chunk-B7ZM3FCB.js +61 -0
- package/dist/bundle/chunk-BRXTN5LJ.js +338 -0
- package/dist/bundle/chunk-CABZAU37.js +319 -0
- package/dist/bundle/chunk-CCOSG3F2.js +24616 -0
- package/dist/bundle/chunk-CDTZSFTN.js +58 -0
- package/dist/bundle/chunk-CMZBCWND.js +1246 -0
- package/dist/bundle/chunk-CRQEEJNF.js +185 -0
- package/dist/bundle/chunk-CWYU4R65.js +358 -0
- package/dist/bundle/chunk-CZFR6JQX.js +52 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DVHX7R54.js +4072 -0
- package/dist/bundle/chunk-DYKOG7QR.js +9596 -0
- package/dist/bundle/chunk-ECDI42G6.js +100 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-ELY2TLCY.js +259 -0
- package/dist/bundle/chunk-ERRVUVKR.js +156 -0
- package/dist/bundle/chunk-FBWR4E5D.js +353 -0
- package/dist/bundle/chunk-GKS6KL57.js +6848 -0
- package/dist/bundle/chunk-H2COZZ55.js +2787 -0
- package/dist/bundle/chunk-HGXTEK7R.js +82 -0
- package/dist/bundle/chunk-HXLXM7HV.js +726 -0
- package/dist/bundle/chunk-IPP4N6HD.js +24 -0
- package/dist/bundle/chunk-IWTVR7S7.js +53 -0
- package/dist/bundle/chunk-IYJH75D4.js +63 -0
- package/dist/bundle/chunk-JCZLRT4Z.js +39 -0
- package/dist/bundle/chunk-JGRWMR5H.js +123 -0
- package/dist/bundle/chunk-JYRYQJBN.js +633 -0
- package/dist/bundle/chunk-KIKLDI74.js +161 -0
- package/dist/bundle/chunk-L4WO3XH6.js +2020 -0
- package/dist/bundle/chunk-LQDNUAK3.js +274 -0
- package/dist/bundle/chunk-LV5ONLQH.js +38 -0
- package/dist/bundle/chunk-M27Z23OZ.js +23 -0
- package/dist/bundle/chunk-M5XTZHXM.js +142 -0
- package/dist/bundle/chunk-MJBEGUIZ.js +76 -0
- package/dist/bundle/chunk-N4WOLGIV.js +2333 -0
- package/dist/bundle/chunk-N5K4OHPT.js +206 -0
- package/dist/bundle/chunk-NYAPUET7.js +108 -0
- package/dist/bundle/chunk-P4IFLOIK.js +218 -0
- package/dist/bundle/chunk-P6G2QTCD.js +288 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PU7R6XNV.js +80 -0
- package/dist/bundle/chunk-QLLBACDR.js +72 -0
- package/dist/bundle/chunk-QP7XN5KX.js +407 -0
- package/dist/bundle/chunk-QY2F6A3D.js +557 -0
- package/dist/bundle/chunk-RLIT7VAZ.js +66 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-SKGAKI62.js +86 -0
- package/dist/bundle/chunk-SQMZP5MA.js +66653 -0
- package/dist/bundle/chunk-UB6NTICY.js +95 -0
- package/dist/bundle/chunk-UBHQO5HV.js +778 -0
- package/dist/bundle/chunk-UM4RKO24.js +106 -0
- package/dist/bundle/chunk-VAHFY732.js +1068 -0
- package/dist/bundle/chunk-VGDM4C3F.js +188 -0
- package/dist/bundle/chunk-VOUAKCPM.js +41181 -0
- package/dist/bundle/chunk-WCCFJ4Q6.js +3736 -0
- package/dist/bundle/chunk-WV6EXRDV.js +46 -0
- package/dist/bundle/chunk-WVAT5TGY.js +334 -0
- package/dist/bundle/chunk-WW76JMKE.js +1243 -0
- package/dist/bundle/chunk-XXOMUKC6.js +54 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YDO6RJ2P.js +1337 -0
- package/dist/bundle/chunk-ZBCFZCJW.js +388 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-BWGRUY6L.js +37 -0
- package/dist/bundle/command-server-entry-BATOWE3Y.js +166 -0
- package/dist/bundle/decode-MZQGYXJH.js +297 -0
- package/dist/bundle/definitions-3EONB23J.js +8600 -0
- package/dist/bundle/dispatch-NYC4ARWX.js +411 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/dist-XZ65GRQ6.js +7577 -0
- package/dist/bundle/echarts-7OYGL2GW.js +42501 -0
- package/dist/bundle/embed-4I25DVKZ.js +38 -0
- package/dist/bundle/embedder-YXKQHAZO.js +111 -0
- package/dist/bundle/emoji-4LYX3GOS.js +4271 -0
- package/dist/bundle/failure-3YOVYZTX.js +25 -0
- package/dist/bundle/first-run-2VL2BOV7.js +29 -0
- package/dist/bundle/first-screen-C7FIWZL2.js +37 -0
- package/dist/bundle/instructions-UMNDHXG2.js +11 -0
- package/dist/bundle/mcp-V27RHILF.js +167 -0
- package/dist/bundle/meeting-combined-LS6XO4JH.js +24 -0
- package/dist/bundle/meeting-model-VIR465CY.js +25 -0
- package/dist/bundle/meeting-semantic-H5J3OOF2.js +22 -0
- package/dist/bundle/node-JJ3WDCNJ.js +2340 -0
- package/dist/bundle/node-PYFPGL4E.js +176 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-LFWPGDVP.js +74 -0
- package/dist/bundle/oauth-42VCSIVL.js +20 -0
- package/dist/bundle/open-XJ5R5LHC.js +23 -0
- package/dist/bundle/openai-RZBLV4HG.js +238 -0
- package/dist/bundle/process-DD6H3K7L.js +91 -0
- package/dist/bundle/program-33RT6DER.js +35421 -0
- package/dist/bundle/prompt-NQRDM5LY.js +17 -0
- package/dist/bundle/recognize-EM7H2IZS.js +26 -0
- package/dist/bundle/remote-Z6NU6QQA.js +31 -0
- package/dist/bundle/rerank-PNPCSPNF.js +52 -0
- package/dist/bundle/schemas-JMKNP4U3.js +2765 -0
- package/dist/bundle/serve-SQVGX76J.js +199 -0
- package/dist/bundle/server-NPJH45FZ.js +212 -0
- package/dist/bundle/server-Z4ZMGRAH.js +79 -0
- package/dist/bundle/slack.js +184 -0
- package/dist/bundle/sqlite-runtime-F3AJGAPN.js +20 -0
- package/dist/bundle/state-JT7ZFSXN.js +36 -0
- package/dist/bundle/store-FXGMHRF3.js +181 -0
- package/dist/bundle/store-J5ZL2USR.js +295 -0
- package/dist/bundle/store-maintenance-command-TIHOIKLZ.js +66 -0
- package/dist/bundle/surface-NW6T5OR6.js +65 -0
- package/dist/commands/api.d.ts +7 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +49 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/doctor.d.ts +7 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +53 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/session.d.ts +7 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +26 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +75 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +59 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +75 -0
- package/dist/context.js.map +1 -0
- package/dist/generated/definitions.d.ts +3 -0
- package/dist/generated/definitions.d.ts.map +1 -0
- package/dist/generated/definitions.js +8596 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/emoji.d.ts +2 -0
- package/dist/generated/emoji.d.ts.map +1 -0
- package/dist/generated/emoji.js +4265 -0
- package/dist/generated/emoji.js.map +1 -0
- package/dist/generated/manifest.d.ts +6 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +6139 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +631 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +2426 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +3220 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +5 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/identity.d.ts +29 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +32 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/messenger.d.ts +12 -0
- package/dist/messenger.d.ts.map +1 -0
- package/dist/messenger.js +184 -0
- package/dist/messenger.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +116 -0
- package/dist/program.js.map +1 -0
- package/dist/reasons.d.ts +7 -0
- package/dist/reasons.d.ts.map +1 -0
- package/dist/reasons.js +20 -0
- package/dist/reasons.js.map +1 -0
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/setup/flow.d.ts +2 -0
- package/dist/setup/flow.d.ts.map +1 -0
- package/dist/setup/flow.js +83 -0
- package/dist/setup/flow.js.map +1 -0
- package/dist/setup/guide.d.ts +6 -0
- package/dist/setup/guide.d.ts.map +1 -0
- package/dist/setup/guide.js +13 -0
- package/dist/setup/guide.js.map +1 -0
- package/dist/setup/texts.d.ts +24 -0
- package/dist/setup/texts.d.ts.map +1 -0
- package/dist/setup/texts.js +24 -0
- package/dist/setup/texts.js.map +1 -0
- package/dist/slack/adapter.d.ts +36 -0
- package/dist/slack/adapter.d.ts.map +1 -0
- package/dist/slack/adapter.js +551 -0
- package/dist/slack/adapter.js.map +1 -0
- package/dist/slack/app-manifest.d.ts +25 -0
- package/dist/slack/app-manifest.d.ts.map +1 -0
- package/dist/slack/app-manifest.js +51 -0
- package/dist/slack/app-manifest.js.map +1 -0
- package/dist/slack/client.d.ts +45 -0
- package/dist/slack/client.d.ts.map +1 -0
- package/dist/slack/client.js +236 -0
- package/dist/slack/client.js.map +1 -0
- package/dist/slack/map.d.ts +429 -0
- package/dist/slack/map.d.ts.map +1 -0
- package/dist/slack/map.js +406 -0
- package/dist/slack/map.js.map +1 -0
- package/dist/slack/mrkdwn.d.ts +9 -0
- package/dist/slack/mrkdwn.d.ts.map +1 -0
- package/dist/slack/mrkdwn.js +56 -0
- package/dist/slack/mrkdwn.js.map +1 -0
- package/dist/slack/search.d.ts +24 -0
- package/dist/slack/search.d.ts.map +1 -0
- package/dist/slack/search.js +99 -0
- package/dist/slack/search.js.map +1 -0
- package/dist/slack/threads.d.ts +28 -0
- package/dist/slack/threads.d.ts.map +1 -0
- package/dist/slack/threads.js +56 -0
- package/dist/slack/threads.js.map +1 -0
- package/dist/slack/tokens.d.ts +17 -0
- package/dist/slack/tokens.d.ts.map +1 -0
- package/dist/slack/tokens.js +27 -0
- package/dist/slack/tokens.js.map +1 -0
- package/dist/slack/writes.d.ts +43 -0
- package/dist/slack/writes.d.ts.map +1 -0
- package/dist/slack/writes.js +277 -0
- package/dist/slack/writes.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/package.json +89 -4
- package/skills/slack-cli/SKILL.md +117 -0
- package/skills/slack-cli/references/api/api-admin.md +541 -0
- package/skills/slack-cli/references/api/api-api.md +13 -0
- package/skills/slack-cli/references/api/api-apps.md +78 -0
- package/skills/slack-cli/references/api/api-auth.md +18 -0
- package/skills/slack-cli/references/api/api-bots.md +12 -0
- package/skills/slack-cli/references/api/api-calls.md +68 -0
- package/skills/slack-cli/references/api/api-chat.md +123 -0
- package/skills/slack-cli/references/api/api-conversations.md +230 -0
- package/skills/slack-cli/references/api/api-dialog.md +13 -0
- package/skills/slack-cli/references/api/api-dnd.md +31 -0
- package/skills/slack-cli/references/api/api-emoji.md +8 -0
- package/skills/slack-cli/references/api/api-files.md +120 -0
- package/skills/slack-cli/references/api/api-migration.md +14 -0
- package/skills/slack-cli/references/api/api-pins.md +37 -0
- package/skills/slack-cli/references/api/api-reactions.md +58 -0
- package/skills/slack-cli/references/api/api-reminders.md +51 -0
- package/skills/slack-cli/references/api/api-search.md +18 -0
- package/skills/slack-cli/references/api/api-stars.md +42 -0
- package/skills/slack-cli/references/api/api-team.md +55 -0
- package/skills/slack-cli/references/api/api-usergroups.md +80 -0
- package/skills/slack-cli/references/api/api-users.md +101 -0
- package/skills/slack-cli/references/api/api-views.md +46 -0
- package/skills/slack-cli/references/api/api-workflows.md +36 -0
- package/skills/slack-cli/references/api.md +35 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
PLAIN_HTTP_REFUSED,
|
|
5
|
+
modelAddressAllowed,
|
|
6
|
+
onThisComputer
|
|
7
|
+
} from "./chunk-5RSQTG7L.js";
|
|
8
|
+
import {
|
|
9
|
+
readSharedSection,
|
|
10
|
+
sharedConfigPath,
|
|
11
|
+
writeSharedSection
|
|
12
|
+
} from "./chunk-75BLNPN3.js";
|
|
13
|
+
import {
|
|
14
|
+
unit
|
|
15
|
+
} from "./chunk-4QPMHVM5.js";
|
|
16
|
+
import {
|
|
17
|
+
storePath
|
|
18
|
+
} from "./chunk-XXOMUKC6.js";
|
|
19
|
+
import {
|
|
20
|
+
boolean,
|
|
21
|
+
isoTimestamp,
|
|
22
|
+
pipe,
|
|
23
|
+
safeParse,
|
|
24
|
+
strictObject,
|
|
25
|
+
string
|
|
26
|
+
} from "./chunk-S4UUN6LD.js";
|
|
27
|
+
import {
|
|
28
|
+
CliError
|
|
29
|
+
} from "./chunk-QLLBACDR.js";
|
|
30
|
+
import {
|
|
31
|
+
__name
|
|
32
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
33
|
+
|
|
34
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/node_modules/@wirecat/cli-core/dist/embeddings/remote.js
|
|
35
|
+
import { setTimeout } from "node:timers/promises";
|
|
36
|
+
|
|
37
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/node_modules/@wirecat/cli-core/dist/models/local-only.js
|
|
38
|
+
var SECTION = "local_only";
|
|
39
|
+
var Setting = strictObject({
|
|
40
|
+
on: boolean(),
|
|
41
|
+
at: pipe(string(), isoTimestamp())
|
|
42
|
+
});
|
|
43
|
+
var pathOf = /* @__PURE__ */ __name((env) => sharedConfigPath(storePath(env), env), "pathOf");
|
|
44
|
+
var readLocalOnly = /* @__PURE__ */ __name((env) => {
|
|
45
|
+
const section = readSharedSection(pathOf(env), SECTION);
|
|
46
|
+
if (section === void 0 || section === null)
|
|
47
|
+
return void 0;
|
|
48
|
+
const checked = safeParse(Setting, section);
|
|
49
|
+
return checked.success ? checked.output : { on: true, at: (/* @__PURE__ */ new Date(0)).toISOString() };
|
|
50
|
+
}, "readLocalOnly");
|
|
51
|
+
var localOnly = /* @__PURE__ */ __name((env) => readLocalOnly(env)?.on === true, "localOnly");
|
|
52
|
+
var writeLocalOnly = /* @__PURE__ */ __name((env, on) => writeSharedSection(pathOf(env), SECTION, on ? { on: true, at: (/* @__PURE__ */ new Date()).toISOString() } : void 0), "writeLocalOnly");
|
|
53
|
+
var localOnlyRefusal = /* @__PURE__ */ __name((what, where) => new CliError("permission_error", `local only is on: ${what} would go to ${where}, which is not this computer; nothing was sent. Choose a model on this computer, or turn local only off with \`models local-only set off\``, { reason: "local-only.refused" }), "localOnlyRefusal");
|
|
54
|
+
var refuseOffComputer = /* @__PURE__ */ __name((env, address, what) => {
|
|
55
|
+
if (!onThisComputer(address) && localOnly(env))
|
|
56
|
+
throw localOnlyRefusal(what, hostOf(address));
|
|
57
|
+
}, "refuseOffComputer");
|
|
58
|
+
var hostOf = /* @__PURE__ */ __name((address) => {
|
|
59
|
+
try {
|
|
60
|
+
return new URL(address).host;
|
|
61
|
+
} catch {
|
|
62
|
+
return address;
|
|
63
|
+
}
|
|
64
|
+
}, "hostOf");
|
|
65
|
+
var refuseModelAddress = /* @__PURE__ */ __name((env, address, what) => {
|
|
66
|
+
if (!modelAddressAllowed(address))
|
|
67
|
+
throw new CliError("validation_error", PLAIN_HTTP_REFUSED, { reason: "model.address-refused" });
|
|
68
|
+
refuseOffComputer(env, address, what);
|
|
69
|
+
}, "refuseModelAddress");
|
|
70
|
+
|
|
71
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/node_modules/@wirecat/cli-core/dist/embeddings/remote.js
|
|
72
|
+
var OPENAI_URL = "https://api.openai.com/v1";
|
|
73
|
+
var OPENAI_MODELS = {
|
|
74
|
+
"text-embedding-3-small": { dims: 1536, perMillion: 0.02 },
|
|
75
|
+
"text-embedding-3-large": { dims: 3072, perMillion: 0.13 }
|
|
76
|
+
};
|
|
77
|
+
var DEFAULT_OPENAI_MODEL = "text-embedding-3-small";
|
|
78
|
+
var PER_REQUEST = 256;
|
|
79
|
+
var isLocal = /* @__PURE__ */ __name((baseUrl) => onThisComputer(baseUrl), "isLocal");
|
|
80
|
+
var remoteModel = /* @__PURE__ */ __name(({ model = DEFAULT_OPENAI_MODEL, baseUrl, dims }) => {
|
|
81
|
+
const known = baseUrl === void 0 ? OPENAI_MODELS[model] : void 0;
|
|
82
|
+
if (baseUrl === void 0 && !known) {
|
|
83
|
+
throw new CliError("validation_error", `OpenAI has no embedding model ${model} here \u2014 one of: ${Object.keys(OPENAI_MODELS).join(", ")}; another server takes --base-url`);
|
|
84
|
+
}
|
|
85
|
+
const size = dims ?? known?.dims;
|
|
86
|
+
if (size === void 0)
|
|
87
|
+
throw new CliError("validation_error", "with --base-url, say the vector size with --dims");
|
|
88
|
+
return {
|
|
89
|
+
provider: baseUrl === void 0 ? "openai" : `url:${new URL(baseUrl).host}`,
|
|
90
|
+
model,
|
|
91
|
+
dims: size,
|
|
92
|
+
baseUrl: baseUrl ?? OPENAI_URL,
|
|
93
|
+
shorten: known !== void 0 && size !== known.dims,
|
|
94
|
+
...known ? { price: { perMillion: known.perMillion, read: "2026-10-02" } } : {}
|
|
95
|
+
};
|
|
96
|
+
}, "remoteModel");
|
|
97
|
+
var remoteKey = /* @__PURE__ */ __name(({ provider, model, dims }) => `${provider}:${model}:${dims}`, "remoteKey");
|
|
98
|
+
var openRemote = /* @__PURE__ */ __name((remote, apiKey, { concurrency = 4, fetch: post = fetch, tries = 5, env }) => {
|
|
99
|
+
refuseModelAddress(env ?? process.env, remote.baseUrl, "text to embed");
|
|
100
|
+
const request = /* @__PURE__ */ __name(async (input) => {
|
|
101
|
+
for (let attempt = 1; ; attempt++) {
|
|
102
|
+
let response;
|
|
103
|
+
try {
|
|
104
|
+
response = await post(`${remote.baseUrl.replace(/\/$/, "")}/embeddings`, {
|
|
105
|
+
method: "POST",
|
|
106
|
+
headers: {
|
|
107
|
+
"content-type": "application/json",
|
|
108
|
+
...apiKey ? { authorization: `Bearer ${apiKey}` } : {}
|
|
109
|
+
},
|
|
110
|
+
body: JSON.stringify({
|
|
111
|
+
model: remote.model,
|
|
112
|
+
input,
|
|
113
|
+
encoding_format: "float",
|
|
114
|
+
...remote.shorten ? { dimensions: remote.dims } : {}
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
} catch {
|
|
118
|
+
if (attempt >= tries)
|
|
119
|
+
throw new CliError("network_error", `${remote.provider} could not be reached`);
|
|
120
|
+
await setTimeout(1e3 * attempt);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (response.ok) {
|
|
124
|
+
const body = await response.json();
|
|
125
|
+
const data = [...body.data ?? []].sort((a, b) => a.index - b.index);
|
|
126
|
+
if (data.length !== input.length || data.some(({ embedding }) => embedding.length !== remote.dims)) {
|
|
127
|
+
throw new CliError("invalid_response", `${remote.provider} answered with vectors of another number or size than ${input.length} \xD7 ${remote.dims}`);
|
|
128
|
+
}
|
|
129
|
+
return data.map(({ embedding }) => unit(Float32Array.from(embedding)));
|
|
130
|
+
}
|
|
131
|
+
const code = await errorCode(response);
|
|
132
|
+
if (response.status === 401 || response.status === 403) {
|
|
133
|
+
throw new CliError("authentication_error", `${remote.provider} refused the key (HTTP ${response.status}${code}) \u2014 set it again with \`models keys set\``);
|
|
134
|
+
}
|
|
135
|
+
const again = response.status === 429 || response.status >= 500;
|
|
136
|
+
if (!again || attempt >= tries) {
|
|
137
|
+
throw new CliError(response.status === 429 ? "rate_limited" : "provider_error", `${remote.provider} answered HTTP ${response.status}${code}`);
|
|
138
|
+
}
|
|
139
|
+
const wait = Number(response.headers.get("retry-after"));
|
|
140
|
+
await setTimeout(Number.isFinite(wait) && wait > 0 ? wait * 1e3 : 1e3 * 2 ** attempt);
|
|
141
|
+
}
|
|
142
|
+
}, "request");
|
|
143
|
+
return {
|
|
144
|
+
model: { id: remote.model, dims: remote.dims },
|
|
145
|
+
embed: /* @__PURE__ */ __name(async (texts) => {
|
|
146
|
+
const parts = [];
|
|
147
|
+
for (let start = 0; start < texts.length; start += PER_REQUEST)
|
|
148
|
+
parts.push(texts.slice(start, start + PER_REQUEST));
|
|
149
|
+
const results = new Array(parts.length);
|
|
150
|
+
let next = 0;
|
|
151
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, parts.length) }, async () => {
|
|
152
|
+
for (let index = next++; index < parts.length; index = next++)
|
|
153
|
+
results[index] = await request(parts[index]);
|
|
154
|
+
}));
|
|
155
|
+
return results.flat();
|
|
156
|
+
}, "embed"),
|
|
157
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
158
|
+
}, "close")
|
|
159
|
+
};
|
|
160
|
+
}, "openRemote");
|
|
161
|
+
var errorCode = /* @__PURE__ */ __name(async (response) => {
|
|
162
|
+
try {
|
|
163
|
+
const body = await response.json();
|
|
164
|
+
const code = body.error?.code ?? body.error?.type;
|
|
165
|
+
return typeof code === "string" && /^[\w.-]{1,64}$/.test(code) ? `, ${code}` : "";
|
|
166
|
+
} catch {
|
|
167
|
+
return "";
|
|
168
|
+
}
|
|
169
|
+
}, "errorCode");
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
readLocalOnly,
|
|
173
|
+
localOnly,
|
|
174
|
+
writeLocalOnly,
|
|
175
|
+
localOnlyRefusal,
|
|
176
|
+
refuseOffComputer,
|
|
177
|
+
refuseModelAddress,
|
|
178
|
+
OPENAI_URL,
|
|
179
|
+
OPENAI_MODELS,
|
|
180
|
+
DEFAULT_OPENAI_MODEL,
|
|
181
|
+
isLocal,
|
|
182
|
+
remoteModel,
|
|
183
|
+
remoteKey,
|
|
184
|
+
openRemote
|
|
185
|
+
};
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
validateVector
|
|
5
|
+
} from "./chunk-5SXZETJF.js";
|
|
6
|
+
import {
|
|
7
|
+
meaningFloor
|
|
8
|
+
} from "./chunk-WVAT5TGY.js";
|
|
9
|
+
import {
|
|
10
|
+
MESSAGE_PARSING,
|
|
11
|
+
RRF_K
|
|
12
|
+
} from "./chunk-UBHQO5HV.js";
|
|
13
|
+
import {
|
|
14
|
+
normalize
|
|
15
|
+
} from "./chunk-53LIHHXC.js";
|
|
16
|
+
import {
|
|
17
|
+
formatMeetingReference,
|
|
18
|
+
implicitTextTerms,
|
|
19
|
+
liftMeetingFields,
|
|
20
|
+
parseLucene,
|
|
21
|
+
parseMeetingReference,
|
|
22
|
+
refreshMeetingIndex,
|
|
23
|
+
walkQuery
|
|
24
|
+
} from "./chunk-DVHX7R54.js";
|
|
25
|
+
import {
|
|
26
|
+
CliError
|
|
27
|
+
} from "./chunk-QLLBACDR.js";
|
|
28
|
+
import {
|
|
29
|
+
__name
|
|
30
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
31
|
+
|
|
32
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
|
|
33
|
+
import { createHash } from "node:crypto";
|
|
34
|
+
|
|
35
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/node_modules/@wirecat/cli-core/dist/search/question-plan.js
|
|
36
|
+
var words = /* @__PURE__ */ __name((text) => normalize(text).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
|
|
37
|
+
var joinedHyphens = /* @__PURE__ */ __name((text) => (normalize(text).match(new RegExp("(?<![:\\p{L}\\p{N}-])\\p{L}[\\p{L}\\p{N}]*(?:-\\p{L}[\\p{L}\\p{N}]*)+", "gu")) ?? []).map((word) => word.replaceAll("-", "")), "joinedHyphens");
|
|
38
|
+
var scaffolding = new Set(words("what which how many much who where when is are was were do does did can could should we the a an for of to under from in on at has have \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u043E\u0435 \u043A\u0442\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u0447\u0442\u043E \u0432\u043E \u043F\u043E \u043D\u0430 \u0432 \u043A \u0441 \u0443 \u0447\u0435\u0440\u0435\u0437 \u043B\u0438 \u0434\u043E\u043B\u0436\u0435\u043D \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0443\u0436\u043D\u043E \u0438\u0434\u0451\u0442 \u0438\u0434\u0435\u0442 \u043C\u043E\u0436\u043D\u043E \u043C\u043E\u0436\u0435\u0442 \u043C\u043E\u0433\u0443\u0442"));
|
|
39
|
+
var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
40
|
+
var QUESTION_STARTS = new Set(words("what which how who whom whose where when why can could should would did do does is are was were will \u0447\u0442\u043E \u043A\u0442\u043E \u043A\u043E\u0433\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u043E\u0435 \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u0443\u044E \u043A\u0430\u043A\u0438\u043C \u043A\u0430\u043A\u043E\u0433\u043E \u043A\u0430\u043A\u0438\u0445 \u043F\u043E\u0447\u0435\u043C\u0443 \u0437\u0430\u0447\u0435\u043C \u043E\u0442\u043A\u0443\u0434\u0430 \u043A\u0443\u0434\u0430 \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043B\u0438 \u043C\u043E\u0436\u043D\u043E \u0440\u0430\u0437\u0432\u0435 \u0447\u0435\u0439 \u0447\u044C\u044F \u0447\u044C\u0451 \u0447\u044C\u0438"));
|
|
41
|
+
var QUESTION_FILLER = new Set(words("about any did does why whom whose would will \u044D\u0442\u043E \u043C\u044B \u0432\u044B \u044F \u043E\u043D\u0438 \u043E\u043D \u043E\u043D\u0430 \u043E \u043E\u0431 \u043F\u0440\u043E \u043B\u0438"));
|
|
42
|
+
var LINKING = new Set(words("and or but not nor with without this that these those there their they them you your our its his her all any and for into onto over then than also just and \u043F\u0440\u0438 \u0434\u043B\u044F \u0431\u0435\u0437 \u043D\u0430\u0434 \u043F\u043E\u0434 \u0438\u043B\u0438 \u043B\u0438\u0431\u043E \u0435\u0433\u043E \u0435\u0451 \u0438\u0445 \u0432\u0441\u0435 \u0432\u0441\u0451 \u0443\u0436\u0435 \u0435\u0449\u0451 \u0442\u0430\u043A \u0442\u043E\u0436\u0435 \u0442\u0430\u043A\u0436\u0435 \u0431\u044B\u043B \u0431\u044B\u043B\u0430 \u0431\u044B\u043B\u0438 \u0431\u044B\u043B\u043E \u0431\u0443\u0434\u0435\u0442 \u044D\u0442\u043E \u044D\u0442\u0430 \u044D\u0442\u043E\u0442 \u044D\u0442\u0438 \u0442\u0430\u043C \u0442\u0443\u0442"));
|
|
43
|
+
var isFunctionWord = /* @__PURE__ */ __name((word) => scaffolding.has(word) || QUESTION_STARTS.has(word) || QUESTION_FILLER.has(word) || LINKING.has(word), "isFunctionWord");
|
|
44
|
+
var questionTerms = /* @__PURE__ */ __name((text) => /\?\s*$/u.test(text) || QUESTION_STARTS.has(words(text)[0] ?? "") ? words(text).filter((word) => !scaffolding.has(word) && !QUESTION_STARTS.has(word) && !QUESTION_FILLER.has(word)) : null, "questionTerms");
|
|
45
|
+
function planQuestion(text, strict = false) {
|
|
46
|
+
if (strict)
|
|
47
|
+
return {
|
|
48
|
+
changed: false,
|
|
49
|
+
natural: false,
|
|
50
|
+
queries: [text],
|
|
51
|
+
scope: "",
|
|
52
|
+
terms: words(text),
|
|
53
|
+
rankingTerms: words(text),
|
|
54
|
+
removed: [],
|
|
55
|
+
aliases: []
|
|
56
|
+
};
|
|
57
|
+
const inputAst = parseLucene(text, MESSAGE_PARSING);
|
|
58
|
+
const rawTextual = walkQuery(inputAst.root).filter((node) => node.field === "text" || node.field === "exact");
|
|
59
|
+
const body = rawTextual.map((node) => node.value).join(" ");
|
|
60
|
+
const prefix = words(body).slice(0, 2);
|
|
61
|
+
const questionPrefix = [
|
|
62
|
+
"what",
|
|
63
|
+
"which",
|
|
64
|
+
"how",
|
|
65
|
+
"who",
|
|
66
|
+
"where",
|
|
67
|
+
"when",
|
|
68
|
+
"can",
|
|
69
|
+
"could",
|
|
70
|
+
"should",
|
|
71
|
+
"\u0441\u043A\u043E\u043B\u044C\u043A\u043E",
|
|
72
|
+
"\u043A\u0430\u043A\u043E\u0438",
|
|
73
|
+
"\u043A\u0430\u043A\u0430\u044F",
|
|
74
|
+
"\u043A\u0430\u043A\u0438\u0435",
|
|
75
|
+
"\u043A\u0430\u043A\u043E\u0435",
|
|
76
|
+
"\u043A\u0442\u043E",
|
|
77
|
+
"\u043A\u043E\u043C\u0443",
|
|
78
|
+
"\u043A\u0435\u043C",
|
|
79
|
+
"\u0433\u0434\u0435",
|
|
80
|
+
"\u043A\u043E\u0433\u0434\u0430",
|
|
81
|
+
"\u043A\u0430\u043A",
|
|
82
|
+
"\u0447\u0442\u043E",
|
|
83
|
+
"\u043C\u043E\u0436\u043D\u043E",
|
|
84
|
+
"\u043C\u043E\u0436\u0435\u0442",
|
|
85
|
+
"\u043C\u043E\u0433\u0443\u0442"
|
|
86
|
+
].includes(prefix[0] ?? "") || ["\u043A", "\u0432\u043E"].includes(prefix[0] ?? "") && ["\u043A\u043E\u043C\u0443", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E"].includes(prefix[1] ?? "");
|
|
87
|
+
const natural = questionWord.test(body) && (/\?/u.test(body) || questionPrefix);
|
|
88
|
+
let cleaned = text;
|
|
89
|
+
if (natural && !text.includes("\\")) {
|
|
90
|
+
const last = rawTextual.at(-1);
|
|
91
|
+
const mark = (last?.span.end ?? 0) - 1;
|
|
92
|
+
if (last?.operator === "wildcard" && text[mark] === "?")
|
|
93
|
+
cleaned = text.slice(0, mark) + text.slice(mark + 1);
|
|
94
|
+
}
|
|
95
|
+
const ast = cleaned === text ? inputAst : parseLucene(cleaned, MESSAGE_PARSING);
|
|
96
|
+
const predicates = walkQuery(ast.root);
|
|
97
|
+
const textual = predicates.filter((p) => p.field === "text" || p.field === "exact");
|
|
98
|
+
const fields = predicates.filter((p) => p.field !== "text" && p.field !== "exact");
|
|
99
|
+
const scope = fields.map((p) => {
|
|
100
|
+
const raw = cleaned.slice(p.span.start, p.span.end);
|
|
101
|
+
return new RegExp(`^${p.field}[:=<>]`, "u").test(raw) ? raw : `${p.field}:${raw}`;
|
|
102
|
+
}).join(" ");
|
|
103
|
+
const bypass = strict || !natural || implicitTextTerms(cleaned).size === 0 || // A quoted single word is how `plainQuery` keeps `10:30` or `HH:MM` literal; it is no phrase the asker wrote.
|
|
104
|
+
textual.some((p) => !(p.operator === "term" || p.operator === "phrase" && !/\s/u.test(p.value)) || p.field === "exact");
|
|
105
|
+
if (bypass)
|
|
106
|
+
return {
|
|
107
|
+
changed: false,
|
|
108
|
+
natural: false,
|
|
109
|
+
queries: [text],
|
|
110
|
+
scope,
|
|
111
|
+
terms: textual.flatMap((p) => words(p.value)),
|
|
112
|
+
rankingTerms: textual.flatMap((p) => words(p.value)),
|
|
113
|
+
removed: [],
|
|
114
|
+
aliases: []
|
|
115
|
+
};
|
|
116
|
+
const original = textual.flatMap((p) => words(p.value));
|
|
117
|
+
const removed = original.filter((w) => scaffolding.has(w));
|
|
118
|
+
const terms = [...new Set(original.filter((w) => !scaffolding.has(w)))];
|
|
119
|
+
if (!terms.length)
|
|
120
|
+
return {
|
|
121
|
+
changed: false,
|
|
122
|
+
natural: true,
|
|
123
|
+
queries: [text],
|
|
124
|
+
scope,
|
|
125
|
+
terms,
|
|
126
|
+
rankingTerms: original,
|
|
127
|
+
removed,
|
|
128
|
+
aliases: []
|
|
129
|
+
};
|
|
130
|
+
const alias = [...terms];
|
|
131
|
+
const changes = [];
|
|
132
|
+
const replace = /* @__PURE__ */ __name((from, to) => {
|
|
133
|
+
for (let i = 0; i < alias.length; i++)
|
|
134
|
+
if (from.includes(alias[i] ?? "")) {
|
|
135
|
+
changes.push(`${alias[i]} -> ${to}`);
|
|
136
|
+
alias[i] = to;
|
|
137
|
+
}
|
|
138
|
+
}, "replace");
|
|
139
|
+
if (terms.some((w) => ["refund", "euros", "euro", "money", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442\u0430", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442", "\u0435\u0432\u0440\u043E"].includes(w))) {
|
|
140
|
+
replace(["returned", "refunded", "received"], "refund");
|
|
141
|
+
replace(["\u0432\u0435\u0440\u043D\u0443\u043B\u0438", "\u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0435\u043D\u043E", "\u043F\u0435\u0440\u0435\u0447\u0438\u0441\u043B\u0435\u043D\u043E"], "\u0432\u043E\u0437\u0432\u0440\u0430\u0442");
|
|
142
|
+
}
|
|
143
|
+
if (terms.some((w) => ["log", "logs", "retention", "backup", "\u043B\u043E\u0433\u043E\u0432", "\u043B\u043E\u0433\u0438", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F"].includes(w))) {
|
|
144
|
+
replace(["lifetime", "kept", "keep"], "retention");
|
|
145
|
+
replace(["\u0445\u0440\u0430\u043D\u044F\u0442\u0441\u044F", "\u0445\u0440\u0430\u043D\u044F\u0442", "\u0445\u0440\u0430\u043D\u0438\u0442\u044C", "\u0441\u0440\u043E\u043A"], "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435");
|
|
146
|
+
}
|
|
147
|
+
if (terms.includes("service") || terms.includes("build"))
|
|
148
|
+
replace(["currently", "now"], "current");
|
|
149
|
+
const render = /* @__PURE__ */ __name((ws) => [...new Set(ws)].join(" ") + (scope ? ` ${scope}` : ""), "render");
|
|
150
|
+
const queries = [.../* @__PURE__ */ new Set([render(terms), render(alias)])].slice(0, 2);
|
|
151
|
+
return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
|
|
152
|
+
}
|
|
153
|
+
__name(planQuestion, "planQuestion");
|
|
154
|
+
var questionText = /* @__PURE__ */ __name((text) => text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
|
|
155
|
+
var lookupTerms = /* @__PURE__ */ __name((plan) => [
|
|
156
|
+
...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words(alias.split(" -> ")[1] ?? ""))))
|
|
157
|
+
], "lookupTerms");
|
|
158
|
+
var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
|
|
159
|
+
var questionLookup = /* @__PURE__ */ __name((text) => {
|
|
160
|
+
let plan;
|
|
161
|
+
try {
|
|
162
|
+
plan = planQuestion(questionText(text));
|
|
163
|
+
} catch (error) {
|
|
164
|
+
if (error instanceof CliError)
|
|
165
|
+
return void 0;
|
|
166
|
+
throw error;
|
|
167
|
+
}
|
|
168
|
+
const terms = plan.changed ? lookupTerms(plan) : [];
|
|
169
|
+
return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
|
|
170
|
+
}, "questionLookup");
|
|
171
|
+
|
|
172
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
|
|
173
|
+
var resolveMeetingSelection = /* @__PURE__ */ __name(async (store, request) => {
|
|
174
|
+
const { project, tag, topic, ...input } = request;
|
|
175
|
+
input.signal?.throwIfAborted();
|
|
176
|
+
if (project !== void 0 && input.projectId !== void 0 || [tag, topic].filter((value) => value !== void 0).length + Number(input.tagId !== void 0) > 1)
|
|
177
|
+
throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
|
|
178
|
+
const selection = [];
|
|
179
|
+
const knowledge = store.knowledge;
|
|
180
|
+
if (!knowledge && [project, tag, topic].some((value) => value !== void 0))
|
|
181
|
+
throw new CliError("configuration_error", "this store cannot resolve project, tag or topic names");
|
|
182
|
+
for (const [kind, name] of [
|
|
183
|
+
["project", project],
|
|
184
|
+
["tag", tag],
|
|
185
|
+
["topic", topic]
|
|
186
|
+
]) {
|
|
187
|
+
if (name === void 0)
|
|
188
|
+
continue;
|
|
189
|
+
if (!knowledge)
|
|
190
|
+
continue;
|
|
191
|
+
const found = await knowledge.resolveVocabulary(name, { kind, signal: input.signal });
|
|
192
|
+
input.signal?.throwIfAborted();
|
|
193
|
+
if (found.ambiguous || found.matches.length !== 1)
|
|
194
|
+
throw new CliError(found.matches.length ? "validation_error" : "not_found", `the ${kind} name needs one canonical record`, {
|
|
195
|
+
candidates: found.matches.map((entry2) => ({ kind: entry2.kind, id: entry2.id, name: entry2.name }))
|
|
196
|
+
});
|
|
197
|
+
const entry = found.matches[0];
|
|
198
|
+
const id = Number(entry?.id);
|
|
199
|
+
if (!entry || entry.kind !== kind || !Number.isSafeInteger(id) || id < 1)
|
|
200
|
+
throw new CliError("invalid_response", "vocabulary resolution returned an invalid canonical record");
|
|
201
|
+
if (kind === "project")
|
|
202
|
+
input.projectId = id;
|
|
203
|
+
else
|
|
204
|
+
input.tagId = id;
|
|
205
|
+
selection.push({ kind, id, name: entry.name, by: "explicit-link" });
|
|
206
|
+
}
|
|
207
|
+
return { input, selection };
|
|
208
|
+
}, "resolveMeetingSelection");
|
|
209
|
+
|
|
210
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
|
|
211
|
+
var DEPTH = 200;
|
|
212
|
+
var cursorOf = /* @__PURE__ */ __name((value, key) => {
|
|
213
|
+
if (value === void 0)
|
|
214
|
+
return 0;
|
|
215
|
+
let cursor;
|
|
216
|
+
try {
|
|
217
|
+
cursor = JSON.parse(Buffer.from(value, "base64url").toString("utf8"));
|
|
218
|
+
} catch {
|
|
219
|
+
throw new CliError("validation_error", "the cursor is not from a combined meeting search; search again");
|
|
220
|
+
}
|
|
221
|
+
if (cursor?.version !== 1 || cursor.key !== key || !Number.isSafeInteger(cursor.offset) || cursor.offset < 0)
|
|
222
|
+
throw new CliError("validation_error", "the cursor belongs to another query, filter or model; search again");
|
|
223
|
+
return cursor.offset;
|
|
224
|
+
}, "cursorOf");
|
|
225
|
+
var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, typed, request) => {
|
|
226
|
+
const { maxChunks, maxRows, maxTextBytes, ...chosen } = request;
|
|
227
|
+
const { query, request: words2 } = liftMeetingFields(typed, chosen);
|
|
228
|
+
const { input, selection } = await resolveMeetingSelection(store, words2);
|
|
229
|
+
const { after, limit = 20, maxReadBytes, ...filters } = input;
|
|
230
|
+
const terms = questionTerms(query);
|
|
231
|
+
const wordQuery = terms === null ? query : terms.join(" ");
|
|
232
|
+
const key = createHash("sha256").update(JSON.stringify([query, embedder.key, Object.entries(filters).filter(([name]) => name !== "signal")])).digest("base64url");
|
|
233
|
+
const offset = cursorOf(after, key);
|
|
234
|
+
let byWords = [];
|
|
235
|
+
let indexing = "ready";
|
|
236
|
+
let refused;
|
|
237
|
+
if (wordQuery.trim()) {
|
|
238
|
+
await refreshMeetingIndex(store.meetings, input.accountId, input.signal);
|
|
239
|
+
try {
|
|
240
|
+
const page = await store.meetings.searchHits(wordQuery, { ...filters, limit: DEPTH, maxReadBytes });
|
|
241
|
+
byWords = page.items;
|
|
242
|
+
indexing = page.coverage.indexing;
|
|
243
|
+
} catch (error) {
|
|
244
|
+
if (!(error instanceof CliError) || error.code !== "validation_error")
|
|
245
|
+
throw error;
|
|
246
|
+
refused = error.message;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
input.signal?.throwIfAborted();
|
|
250
|
+
const vectors = await embedder.embed([query], "query");
|
|
251
|
+
if (vectors.length !== 1)
|
|
252
|
+
throw new CliError("invalid_response", "Meeting query model returned another vector count");
|
|
253
|
+
const vector = vectors[0];
|
|
254
|
+
const ranked = await store.meetingVectors.ranked(embedder.key, validateVector(vector, embedder.dims), {
|
|
255
|
+
...filters,
|
|
256
|
+
limit: DEPTH,
|
|
257
|
+
...maxChunks === void 0 ? {} : { maxChunks },
|
|
258
|
+
...maxRows === void 0 ? {} : { maxRows },
|
|
259
|
+
...maxTextBytes === void 0 ? {} : { maxTextBytes }
|
|
260
|
+
});
|
|
261
|
+
const floor = meaningFloor(embedder.key);
|
|
262
|
+
const byMeaning = ranked.items.filter(({ score }) => score > floor);
|
|
263
|
+
const merged = /* @__PURE__ */ new Map();
|
|
264
|
+
byMeaning.forEach((hit, rank) => {
|
|
265
|
+
const reference = { type: "meeting", accountId: input.accountId, meetingId: hit.meetingId };
|
|
266
|
+
const first = formatMeetingReference({
|
|
267
|
+
...reference,
|
|
268
|
+
transcriptId: hit.transcriptId,
|
|
269
|
+
cuePosition: hit.firstPosition
|
|
270
|
+
});
|
|
271
|
+
merged.set(`${hit.transcriptId}:${hit.firstPosition}`, {
|
|
272
|
+
ref: first,
|
|
273
|
+
meetingId: hit.meetingId,
|
|
274
|
+
scope: "transcript",
|
|
275
|
+
text: hit.text,
|
|
276
|
+
startMs: null,
|
|
277
|
+
source: { title: hit.title, startedAt: hit.startedAt, url: null },
|
|
278
|
+
by: ["meaning"],
|
|
279
|
+
score: hit.score,
|
|
280
|
+
passage: {
|
|
281
|
+
first,
|
|
282
|
+
last: formatMeetingReference({ ...reference, transcriptId: hit.transcriptId, cuePosition: hit.lastPosition })
|
|
283
|
+
},
|
|
284
|
+
fused: 1 / (RRF_K + rank + 1)
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
byWords.forEach((hit, rank) => {
|
|
288
|
+
const share = 1 / (RRF_K + rank + 1);
|
|
289
|
+
const cue = hit.scope === "transcript" ? parseMeetingReference(hit.ref) : void 0;
|
|
290
|
+
const within = cue?.cuePosition === void 0 ? void 0 : byMeaning.find((passage) => passage.transcriptId === cue.transcriptId && passage.firstPosition <= cue.cuePosition && cue.cuePosition <= passage.lastPosition);
|
|
291
|
+
const held = within && merged.get(`${within.transcriptId}:${within.firstPosition}`);
|
|
292
|
+
const found = {
|
|
293
|
+
ref: hit.ref,
|
|
294
|
+
text: hit.text,
|
|
295
|
+
startMs: hit.startMs,
|
|
296
|
+
...hit.match === void 0 ? {} : { match: hit.match },
|
|
297
|
+
...hit.corrections === void 0 ? {} : { corrections: hit.corrections }
|
|
298
|
+
};
|
|
299
|
+
if (held && !held.by.includes("words")) {
|
|
300
|
+
Object.assign(held, found, { by: ["words", "meaning"], fused: held.fused + share });
|
|
301
|
+
if (hit.source?.url)
|
|
302
|
+
held.source.url = hit.source.url;
|
|
303
|
+
} else if (held)
|
|
304
|
+
held.fused += share;
|
|
305
|
+
else
|
|
306
|
+
merged.set(`w:${hit.ref}:${hit.scope}:${hit.id}`, {
|
|
307
|
+
...found,
|
|
308
|
+
meetingId: hit.meetingId,
|
|
309
|
+
scope: hit.scope,
|
|
310
|
+
source: {
|
|
311
|
+
title: hit.source?.title ?? null,
|
|
312
|
+
startedAt: hit.source?.startedAt ?? null,
|
|
313
|
+
url: hit.source?.url ?? null
|
|
314
|
+
},
|
|
315
|
+
by: ["words"],
|
|
316
|
+
score: null,
|
|
317
|
+
fused: share
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
const ordered = [...merged.values()].sort((a, b) => b.fused - a.fused || Number(b.by.includes("words")) - Number(a.by.includes("words")) || (b.score ?? -2) - (a.score ?? -2));
|
|
321
|
+
const items = ordered.slice(offset, offset + limit).map(({ fused: _, ...hit }) => hit);
|
|
322
|
+
const hasMore = ordered.length > offset + limit;
|
|
323
|
+
return {
|
|
324
|
+
items,
|
|
325
|
+
hasMore,
|
|
326
|
+
nextCursor: hasMore ? Buffer.from(JSON.stringify({ version: 1, key, offset: offset + limit })).toString("base64url") : null,
|
|
327
|
+
selection,
|
|
328
|
+
words: {
|
|
329
|
+
query: wordQuery,
|
|
330
|
+
...terms === null ? {} : { from: "question" },
|
|
331
|
+
...refused === void 0 ? {} : { refused }
|
|
332
|
+
},
|
|
333
|
+
model: { key: embedder.key, model: embedder.model, kind: embedder.kind, dims: embedder.dims },
|
|
334
|
+
coverage: {
|
|
335
|
+
archiveCompleteness: "unknown",
|
|
336
|
+
indexCompleteness: "unknown",
|
|
337
|
+
indexing,
|
|
338
|
+
/** Every vector of the selection was compared; false when `maxChunks` stopped the scan. */
|
|
339
|
+
meaningScanComplete: ranked.complete,
|
|
340
|
+
scanned: ranked.scanned,
|
|
341
|
+
/** Each side ranks this many at most; pages past them hold nothing more. */
|
|
342
|
+
depth: DEPTH
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
}, "searchMeetingsCombined");
|
|
346
|
+
|
|
347
|
+
export {
|
|
348
|
+
words,
|
|
349
|
+
joinedHyphens,
|
|
350
|
+
isFunctionWord,
|
|
351
|
+
planQuestion,
|
|
352
|
+
questionText,
|
|
353
|
+
lookupTerms,
|
|
354
|
+
anyOfTerms,
|
|
355
|
+
questionLookup,
|
|
356
|
+
resolveMeetingSelection,
|
|
357
|
+
searchMeetingsCombined
|
|
358
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
readSharedSection,
|
|
5
|
+
writeSharedSection
|
|
6
|
+
} from "./chunk-75BLNPN3.js";
|
|
7
|
+
import {
|
|
8
|
+
CliError
|
|
9
|
+
} from "./chunk-QLLBACDR.js";
|
|
10
|
+
import {
|
|
11
|
+
__name
|
|
12
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
13
|
+
|
|
14
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.738.0_@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_comm_2f4ef0250212140e76029d09a7f79b43/node_modules/@wirecat/cli-core/dist/cli/setup-answers.js
|
|
15
|
+
var PERMISSION_ANSWERS = ["readonly", "allow"];
|
|
16
|
+
var QUESTIONS = ["languages", "tools", "permissions"];
|
|
17
|
+
var SECTION = "setup";
|
|
18
|
+
var readSetupAnswers = /* @__PURE__ */ __name((path) => {
|
|
19
|
+
const section = readSharedSection(path, SECTION);
|
|
20
|
+
if (section === void 0)
|
|
21
|
+
return {};
|
|
22
|
+
const answers = section;
|
|
23
|
+
if (section === null || typeof section !== "object" || Array.isArray(section) || answers.languages !== void 0 && answers.languages !== true || answers.tools !== void 0 && answers.tools !== true || answers.permissions !== void 0 && !PERMISSION_ANSWERS.includes(answers.permissions))
|
|
24
|
+
throw new CliError("configuration_error", `${path}: ${SECTION} holds what setup asked \u2014 languages: true, tools: true, permissions: ${PERMISSION_ANSWERS.join(" | ")}`);
|
|
25
|
+
return answers;
|
|
26
|
+
}, "readSetupAnswers");
|
|
27
|
+
var unanswered = /* @__PURE__ */ __name((answers) => QUESTIONS.filter((question) => answers[question] === void 0), "unanswered");
|
|
28
|
+
var writeSetupAnswers = /* @__PURE__ */ __name((path, answers) => {
|
|
29
|
+
let kept = {};
|
|
30
|
+
try {
|
|
31
|
+
kept = readSetupAnswers(path);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (!(error instanceof CliError) || !error.message.includes(`${SECTION} holds`))
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
writeSharedSection(path, SECTION, { ...kept, ...answers });
|
|
37
|
+
}, "writeSetupAnswers");
|
|
38
|
+
var permissionCeiling = /* @__PURE__ */ __name((path) => {
|
|
39
|
+
try {
|
|
40
|
+
return readSetupAnswers(path).permissions === "readonly" ? "readonly" : void 0;
|
|
41
|
+
} catch {
|
|
42
|
+
return void 0;
|
|
43
|
+
}
|
|
44
|
+
}, "permissionCeiling");
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
QUESTIONS,
|
|
48
|
+
readSetupAnswers,
|
|
49
|
+
unanswered,
|
|
50
|
+
writeSetupAnswers,
|
|
51
|
+
permissionCeiling
|
|
52
|
+
};
|