@wirecat/slack-cli 0.0.0-stage → 0.2.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 +121 -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-3IZF5ENR.js +61 -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-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-AMLBQVKM.js +7577 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -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-OIYIBNSA.js +35443 -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/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/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 +574 -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 +437 -0
- package/dist/slack/map.d.ts.map +1 -0
- package/dist/slack/map.js +411 -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,388 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_RETRY,
|
|
5
|
+
backoffMs,
|
|
6
|
+
realSleep,
|
|
7
|
+
wallClock
|
|
8
|
+
} from "./chunk-H2COZZ55.js";
|
|
9
|
+
import {
|
|
10
|
+
CliError,
|
|
11
|
+
isCliError
|
|
12
|
+
} from "./chunk-QLLBACDR.js";
|
|
13
|
+
import {
|
|
14
|
+
__name
|
|
15
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
16
|
+
|
|
17
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/body.js
|
|
18
|
+
var interrupted = /* @__PURE__ */ __name((signal) => isCliError(signal.reason) ? signal.reason : new CliError(signal.reason instanceof Error && signal.reason.name === "TimeoutError" ? "timeout" : "cancelled", "HTTP response read was interrupted"), "interrupted");
|
|
19
|
+
var checked = /* @__PURE__ */ __name((signal) => {
|
|
20
|
+
if (signal?.aborted)
|
|
21
|
+
throw interrupted(signal);
|
|
22
|
+
}, "checked");
|
|
23
|
+
var abortable = /* @__PURE__ */ __name(async (pending, signal) => {
|
|
24
|
+
if (!signal)
|
|
25
|
+
return pending;
|
|
26
|
+
let abort = /* @__PURE__ */ __name(() => {
|
|
27
|
+
}, "abort");
|
|
28
|
+
const stopped = new Promise((_, reject) => {
|
|
29
|
+
abort = /* @__PURE__ */ __name(() => reject(interrupted(signal)), "abort");
|
|
30
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
31
|
+
if (signal.aborted)
|
|
32
|
+
abort();
|
|
33
|
+
});
|
|
34
|
+
try {
|
|
35
|
+
return await Promise.race([pending, stopped]);
|
|
36
|
+
} finally {
|
|
37
|
+
signal.removeEventListener("abort", abort);
|
|
38
|
+
}
|
|
39
|
+
}, "abortable");
|
|
40
|
+
var readJsonResponse = /* @__PURE__ */ __name(async (response, options) => {
|
|
41
|
+
const { maxBytes, signal } = options ?? {};
|
|
42
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1)
|
|
43
|
+
throw new CliError("validation_error", "maxBytes must be a positive safe integer");
|
|
44
|
+
if (signal !== void 0 && !(signal instanceof AbortSignal))
|
|
45
|
+
throw new CliError("validation_error", "signal must be an AbortSignal");
|
|
46
|
+
if (signal?.aborted) {
|
|
47
|
+
void response.body?.cancel().catch(() => {
|
|
48
|
+
});
|
|
49
|
+
throw interrupted(signal);
|
|
50
|
+
}
|
|
51
|
+
const length = response.headers.get("content-length");
|
|
52
|
+
if (length !== null && (!/^\d+$/.test(length) || Number(length) > maxBytes)) {
|
|
53
|
+
void response.body?.cancel().catch(() => {
|
|
54
|
+
});
|
|
55
|
+
throw new CliError("invalid_response", "HTTP response exceeds the byte budget");
|
|
56
|
+
}
|
|
57
|
+
if (!response.body)
|
|
58
|
+
throw new CliError("invalid_response", "HTTP response has no body");
|
|
59
|
+
if (response.body.locked)
|
|
60
|
+
throw new CliError("invalid_response", "HTTP response body is already in use");
|
|
61
|
+
const reader = response.body.getReader();
|
|
62
|
+
const chunks = [];
|
|
63
|
+
let bytes = 0;
|
|
64
|
+
try {
|
|
65
|
+
for (; ; ) {
|
|
66
|
+
checked(signal);
|
|
67
|
+
const part = await abortable(reader.read(), signal);
|
|
68
|
+
checked(signal);
|
|
69
|
+
if (part.done)
|
|
70
|
+
break;
|
|
71
|
+
if (!(part.value instanceof Uint8Array))
|
|
72
|
+
throw new CliError("invalid_response", "HTTP response is not bytes");
|
|
73
|
+
bytes += part.value.byteLength;
|
|
74
|
+
if (bytes > maxBytes)
|
|
75
|
+
throw new CliError("invalid_response", "HTTP response exceeds the byte budget");
|
|
76
|
+
if (part.value.byteLength)
|
|
77
|
+
chunks.push(new Uint8Array(part.value));
|
|
78
|
+
}
|
|
79
|
+
const body = new Uint8Array(bytes);
|
|
80
|
+
let offset = 0;
|
|
81
|
+
for (const chunk of chunks) {
|
|
82
|
+
body.set(chunk, offset);
|
|
83
|
+
offset += chunk.byteLength;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(body));
|
|
87
|
+
} catch {
|
|
88
|
+
throw new CliError("invalid_response", "HTTP response is not valid UTF-8 JSON");
|
|
89
|
+
}
|
|
90
|
+
} catch (error) {
|
|
91
|
+
checked(signal);
|
|
92
|
+
if (isCliError(error))
|
|
93
|
+
throw error;
|
|
94
|
+
throw new CliError("network_error", "HTTP response could not be read");
|
|
95
|
+
} finally {
|
|
96
|
+
void reader.cancel().catch(() => {
|
|
97
|
+
});
|
|
98
|
+
reader.releaseLock();
|
|
99
|
+
}
|
|
100
|
+
}, "readJsonResponse");
|
|
101
|
+
|
|
102
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/hosts.js
|
|
103
|
+
var LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
|
|
104
|
+
var HOST_PATTERN = new RegExp(`^(?:${LABEL}(?:\\.${LABEL})*|\\*\\.${LABEL}(?:\\.${LABEL})+)$`);
|
|
105
|
+
var hostProblems = /* @__PURE__ */ __name((hosts) => [
|
|
106
|
+
...hosts.filter((host) => !HOST_PATTERN.test(host) || host.length > 253).map((host) => `${JSON.stringify(host)} is not a host: a lower-case hostname with no scheme, port or path, or one leading *. before two labels or more`),
|
|
107
|
+
...hosts.filter((host, at) => hosts.indexOf(host) !== at).map((host) => `${JSON.stringify(host)} is listed twice`)
|
|
108
|
+
], "hostProblems");
|
|
109
|
+
var hostCovered = /* @__PURE__ */ __name((hostname, hosts) => {
|
|
110
|
+
const name = hostname.toLowerCase().replace(/\.$/, "");
|
|
111
|
+
return hosts.some((host) => host.startsWith("*.") ? name.endsWith(host.slice(1)) : name === host);
|
|
112
|
+
}, "hostCovered");
|
|
113
|
+
|
|
114
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/fetch.js
|
|
115
|
+
var HOST_FETCH_TIMEOUT_MS = 3e4;
|
|
116
|
+
var REDIRECTS = 5;
|
|
117
|
+
var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
118
|
+
var CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
|
|
119
|
+
var NO_BODY = /* @__PURE__ */ new Set([204, 205, 304]);
|
|
120
|
+
var deadline = /* @__PURE__ */ __name((ms) => {
|
|
121
|
+
const controller = new AbortController();
|
|
122
|
+
const timer = setTimeout(() => controller.abort(new DOMException(`no answer within ${ms} ms`, "TimeoutError")), ms);
|
|
123
|
+
timer.unref?.();
|
|
124
|
+
return { signal: controller.signal, clear: /* @__PURE__ */ __name(() => clearTimeout(timer), "clear") };
|
|
125
|
+
}, "deadline");
|
|
126
|
+
var released = /* @__PURE__ */ __name((response, clear) => {
|
|
127
|
+
if (!response.body || NO_BODY.has(response.status) || response.status < 200 || response.status > 599) {
|
|
128
|
+
clear();
|
|
129
|
+
return response;
|
|
130
|
+
}
|
|
131
|
+
const { status, statusText, headers, url, redirected } = response;
|
|
132
|
+
const wrapped = new Response(response.body.pipeThrough(new TransformStream({ flush: clear })), {
|
|
133
|
+
status,
|
|
134
|
+
statusText,
|
|
135
|
+
headers
|
|
136
|
+
});
|
|
137
|
+
return Object.defineProperties(wrapped, { url: { value: url }, redirected: { value: redirected } });
|
|
138
|
+
}, "released");
|
|
139
|
+
var undeclared = /* @__PURE__ */ __name((url) => new CliError("configuration_error", `${url.hostname} is not a host this CLI declares: add "${url.hostname}" to \`hosts\` in its WCAT identity and run cli-dev manifest`, { reason: "network.host-undeclared", sent: false }), "undeclared");
|
|
140
|
+
var checked2 = /* @__PURE__ */ __name((url, hosts) => {
|
|
141
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
142
|
+
throw new CliError("validation_error", `only http and https are fetched, not ${url.protocol.replace(/:$/, "")}`, {
|
|
143
|
+
sent: false
|
|
144
|
+
});
|
|
145
|
+
if (!hostCovered(url.hostname, hosts))
|
|
146
|
+
throw undeclared(url);
|
|
147
|
+
return url;
|
|
148
|
+
}, "checked");
|
|
149
|
+
var ENCODED_SLASH = /%2f|%5c/i;
|
|
150
|
+
var scopeOf = /* @__PURE__ */ __name((scope) => {
|
|
151
|
+
if (scope === void 0)
|
|
152
|
+
return void 0;
|
|
153
|
+
if (!URL.canParse(scope))
|
|
154
|
+
throw new CliError("configuration_error", `credentialScope ${scope} is not a URL`);
|
|
155
|
+
const { origin, pathname } = new URL(scope);
|
|
156
|
+
const prefix = pathname.endsWith("/") ? pathname : `${pathname}/`;
|
|
157
|
+
return (url) => url.origin === origin && (url.pathname === pathname || url.pathname.startsWith(prefix)) && !ENCODED_SLASH.test(url.pathname);
|
|
158
|
+
}, "scopeOf");
|
|
159
|
+
var signedHeaders = /* @__PURE__ */ __name((headers) => CREDENTIAL_HEADERS.some((name) => headers.has(name)), "signedHeaders");
|
|
160
|
+
var NOT_SENT = /* @__PURE__ */ new Set(["EAI_AGAIN", "ENOTFOUND", "ECONNREFUSED"]);
|
|
161
|
+
var neverSent = /* @__PURE__ */ __name((error) => {
|
|
162
|
+
for (let at = error, depth = 0; at instanceof Error && depth < 4; at = at.cause, depth++) {
|
|
163
|
+
const code = at.code;
|
|
164
|
+
if (typeof code === "string" && NOT_SENT.has(code))
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}, "neverSent");
|
|
169
|
+
var hostFetch = /* @__PURE__ */ __name((options) => {
|
|
170
|
+
const problems = hostProblems(options.hosts);
|
|
171
|
+
if (problems.length > 0)
|
|
172
|
+
throw new CliError("configuration_error", problems.join("; "));
|
|
173
|
+
const { hosts, fetch: send = globalThis.fetch, timeoutMs = HOST_FETCH_TIMEOUT_MS, redirects = REDIRECTS } = options;
|
|
174
|
+
const inScope = scopeOf(options.credentialScope);
|
|
175
|
+
return async (input, init = {}) => {
|
|
176
|
+
const request = input instanceof Request ? input : void 0;
|
|
177
|
+
let url = checked2(new URL(request?.url ?? String(input)), hosts);
|
|
178
|
+
const caller = init.signal ?? request?.signal;
|
|
179
|
+
const timeout = deadline(timeoutMs);
|
|
180
|
+
const signal = caller ? AbortSignal.any([caller, timeout.signal]) : timeout.signal;
|
|
181
|
+
const follow = (init.redirect ?? request?.redirect ?? "follow") === "follow";
|
|
182
|
+
let method = (init.method ?? request?.method ?? "GET").toUpperCase();
|
|
183
|
+
let body = init.body ?? request?.body ?? void 0;
|
|
184
|
+
const headers = new Headers(init.headers ?? request?.headers);
|
|
185
|
+
if (inScope && signedHeaders(headers) && !inScope(url))
|
|
186
|
+
throw new CliError("configuration_error", `the sign-in goes only under ${options.credentialScope}, not ${url.origin}${url.pathname}`, {
|
|
187
|
+
sent: false
|
|
188
|
+
});
|
|
189
|
+
let answered = false;
|
|
190
|
+
try {
|
|
191
|
+
let response = await send(input, { ...init, signal, ...follow ? { redirect: "manual" } : {} });
|
|
192
|
+
answered = true;
|
|
193
|
+
for (let hop = 0; follow && REDIRECT_STATUSES.has(response.status); hop += 1) {
|
|
194
|
+
const location = response.headers.get("location");
|
|
195
|
+
if (!location)
|
|
196
|
+
return released(response, timeout.clear);
|
|
197
|
+
if (hop >= redirects)
|
|
198
|
+
throw new CliError("invalid_response", `more than ${redirects} redirects from ${url.hostname}`);
|
|
199
|
+
void response.body?.cancel().catch(() => {
|
|
200
|
+
});
|
|
201
|
+
const next = checked2(new URL(location, url), hosts);
|
|
202
|
+
if (response.status === 303 || (response.status === 301 || response.status === 302) && method === "POST") {
|
|
203
|
+
method = method === "HEAD" ? "HEAD" : "GET";
|
|
204
|
+
body = void 0;
|
|
205
|
+
headers.delete("content-type");
|
|
206
|
+
headers.delete("content-length");
|
|
207
|
+
} else if (body instanceof ReadableStream)
|
|
208
|
+
throw new CliError("invalid_response", `${url.hostname} redirected a streamed body, which cannot be sent again`);
|
|
209
|
+
if (inScope ? !inScope(next) : next.origin !== url.origin)
|
|
210
|
+
for (const name of CREDENTIAL_HEADERS)
|
|
211
|
+
headers.delete(name);
|
|
212
|
+
url = next;
|
|
213
|
+
response = await send(url, { ...init, method, headers, body, signal, redirect: "manual" });
|
|
214
|
+
}
|
|
215
|
+
return released(response, timeout.clear);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
timeout.clear();
|
|
218
|
+
if (isCliError(error))
|
|
219
|
+
throw error;
|
|
220
|
+
if (caller?.aborted)
|
|
221
|
+
throw isCliError(caller.reason) ? caller.reason : new CliError("cancelled", "request cancelled");
|
|
222
|
+
if (timeout.signal.aborted)
|
|
223
|
+
throw new CliError("timeout", `${url.hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
|
|
224
|
+
throw new CliError("network_error", `${url.hostname} could not be reached`, {
|
|
225
|
+
retryable: true,
|
|
226
|
+
...!answered && neverSent(error) ? { sent: false } : {}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}, "hostFetch");
|
|
231
|
+
|
|
232
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.132.0_@scalar+openapi-upgrader@0.4.6_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/index.js
|
|
233
|
+
var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
|
|
234
|
+
if (!header)
|
|
235
|
+
return void 0;
|
|
236
|
+
const trimmed = header.trim();
|
|
237
|
+
if (/^\d+$/.test(trimmed))
|
|
238
|
+
return Number(trimmed) * 1e3;
|
|
239
|
+
const at = Date.parse(trimmed);
|
|
240
|
+
if (Number.isNaN(at))
|
|
241
|
+
return void 0;
|
|
242
|
+
const delta = at - now().getTime();
|
|
243
|
+
return delta > 0 ? delta : void 0;
|
|
244
|
+
}, "parseRetryAfter");
|
|
245
|
+
var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
|
|
246
|
+
if (!header)
|
|
247
|
+
return void 0;
|
|
248
|
+
const seconds = Number(header.trim());
|
|
249
|
+
if (!Number.isFinite(seconds))
|
|
250
|
+
return void 0;
|
|
251
|
+
const delta = seconds * 1e3 - now().getTime();
|
|
252
|
+
return delta > 0 ? delta : void 0;
|
|
253
|
+
}, "parseRateLimitReset");
|
|
254
|
+
var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
|
|
255
|
+
var retryableStatus = /* @__PURE__ */ __name((status) => status === 408 || status === 429 || status >= 500, "retryableStatus");
|
|
256
|
+
var statusToCode = /* @__PURE__ */ __name((status) => {
|
|
257
|
+
if (status === 400 || status === 422)
|
|
258
|
+
return "validation_error";
|
|
259
|
+
if (status === 401)
|
|
260
|
+
return "authentication_error";
|
|
261
|
+
if (status === 403)
|
|
262
|
+
return "permission_error";
|
|
263
|
+
if (status === 404)
|
|
264
|
+
return "not_found";
|
|
265
|
+
if (status === 408)
|
|
266
|
+
return "timeout";
|
|
267
|
+
if (status === 429)
|
|
268
|
+
return "rate_limited";
|
|
269
|
+
if (status === 502 || status === 503 || status === 504)
|
|
270
|
+
return "provider_unavailable";
|
|
271
|
+
return "provider_error";
|
|
272
|
+
}, "statusToCode");
|
|
273
|
+
var SAFE = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
274
|
+
var retrying = /* @__PURE__ */ __name((send, options = {}) => {
|
|
275
|
+
const { retry = DEFAULT_RETRY, reads = /* @__PURE__ */ __name((method) => SAFE.has(method), "reads"), pacer, budget = Number.POSITIVE_INFINITY, sleep = realSleep, now = wallClock, random = Math.random } = options;
|
|
276
|
+
return async (input, init = {}) => {
|
|
277
|
+
const request = input instanceof Request ? input : void 0;
|
|
278
|
+
const method = (init.method ?? request?.method ?? "GET").toUpperCase();
|
|
279
|
+
const read = reads(method, new URL(request?.url ?? String(input)));
|
|
280
|
+
const signal = init.signal ?? request?.signal ?? void 0;
|
|
281
|
+
const once = init.body instanceof ReadableStream;
|
|
282
|
+
let waited = 0;
|
|
283
|
+
const pause = /* @__PURE__ */ __name(async (ms) => {
|
|
284
|
+
waited += ms;
|
|
285
|
+
await sleep(ms, signal, "retry");
|
|
286
|
+
}, "pause");
|
|
287
|
+
for (let attempt = 1; ; attempt++) {
|
|
288
|
+
if (pacer) {
|
|
289
|
+
const wait = await pacer.reserve() - now().getTime();
|
|
290
|
+
if (wait > 0) {
|
|
291
|
+
if (waited + wait > budget)
|
|
292
|
+
throw new CliError("rate_limited", `the provider's pace needs a ${wait} ms wait, more than this run allows`, {
|
|
293
|
+
retry_after_ms: wait,
|
|
294
|
+
sent: false
|
|
295
|
+
});
|
|
296
|
+
await pause(wait);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
const last = once || attempt > retry.retries;
|
|
300
|
+
try {
|
|
301
|
+
const response = await send(request && !last ? request.clone() : input, init);
|
|
302
|
+
if (last || !retryableStatus(response.status) || !(read || response.status === 429))
|
|
303
|
+
return response;
|
|
304
|
+
const wait = providerWaitMs(response.headers, now) ?? backoffMs(attempt, retry, random);
|
|
305
|
+
if (wait > retry.maxRetryAfterMs || waited + wait > budget)
|
|
306
|
+
return response;
|
|
307
|
+
await response.body?.cancel().catch(() => {
|
|
308
|
+
});
|
|
309
|
+
if (response.status === 429)
|
|
310
|
+
await pacer?.holdFor(wait);
|
|
311
|
+
await pause(wait);
|
|
312
|
+
} catch (error) {
|
|
313
|
+
if (last || !read || signal?.aborted || !isCliError(error) || error.details.retryable !== true)
|
|
314
|
+
throw error;
|
|
315
|
+
const wait = backoffMs(attempt, retry, random);
|
|
316
|
+
if (waited + wait > budget)
|
|
317
|
+
throw error;
|
|
318
|
+
await pause(wait);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}, "retrying");
|
|
323
|
+
|
|
324
|
+
// 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/endpoint.js
|
|
325
|
+
var endpoint = /* @__PURE__ */ __name((value) => {
|
|
326
|
+
try {
|
|
327
|
+
const url = new URL(value);
|
|
328
|
+
return ["https:", "http:"].includes(url.protocol) && !url.username && !url.password && !url.search && !url.hash;
|
|
329
|
+
} catch {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
}, "endpoint");
|
|
333
|
+
var loopback = /* @__PURE__ */ __name((hostname) => hostname === "localhost" || hostname === "[::1]" || /^127(\.\d{1,3}){3}$/.test(hostname), "loopback");
|
|
334
|
+
var onThisComputer = /* @__PURE__ */ __name((value) => {
|
|
335
|
+
try {
|
|
336
|
+
return loopback(new URL(value).hostname);
|
|
337
|
+
} catch {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
}, "onThisComputer");
|
|
341
|
+
var modelAddressAllowed = /* @__PURE__ */ __name((value) => endpoint(value) && (new URL(value).protocol === "https:" || onThisComputer(value)), "modelAddressAllowed");
|
|
342
|
+
var PLAIN_HTTP_REFUSED = "this address is not allowed: use https, or http only on this computer";
|
|
343
|
+
var literalFetch = /* @__PURE__ */ __name((hostname, timeoutMs) => async (input, init = {}) => {
|
|
344
|
+
const url = new URL(input instanceof Request ? input.url : String(input));
|
|
345
|
+
if (url.hostname !== hostname)
|
|
346
|
+
throw new CliError("configuration_error", `${url.hostname} is not the model address's host, ${hostname}`, {
|
|
347
|
+
reason: "network.host-undeclared",
|
|
348
|
+
sent: false
|
|
349
|
+
});
|
|
350
|
+
const deadline2 = AbortSignal.timeout(timeoutMs);
|
|
351
|
+
const signal = init.signal ? AbortSignal.any([init.signal, deadline2]) : deadline2;
|
|
352
|
+
try {
|
|
353
|
+
const response = await fetch(input, { ...init, signal, redirect: "manual" });
|
|
354
|
+
if (response.status >= 300 && response.status < 400) {
|
|
355
|
+
void response.body?.cancel().catch(() => {
|
|
356
|
+
});
|
|
357
|
+
throw new CliError("invalid_response", `${hostname} answered with a redirect, which is not followed`);
|
|
358
|
+
}
|
|
359
|
+
return response;
|
|
360
|
+
} catch (error) {
|
|
361
|
+
if (isCliError(error))
|
|
362
|
+
throw error;
|
|
363
|
+
if (init.signal?.aborted)
|
|
364
|
+
throw new CliError("cancelled", "request cancelled");
|
|
365
|
+
if (deadline2.aborted)
|
|
366
|
+
throw new CliError("timeout", `${hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
|
|
367
|
+
throw new CliError("network_error", `${hostname} could not be reached`, { retryable: true });
|
|
368
|
+
}
|
|
369
|
+
}, "literalFetch");
|
|
370
|
+
var endpointFetch = /* @__PURE__ */ __name((address, timeoutMs) => {
|
|
371
|
+
const { hostname } = new URL(address);
|
|
372
|
+
if (hostname === "[::1]")
|
|
373
|
+
return fetch;
|
|
374
|
+
return hostname.startsWith("[") ? literalFetch(hostname, timeoutMs) : hostFetch({ hosts: [hostname], timeoutMs });
|
|
375
|
+
}, "endpointFetch");
|
|
376
|
+
|
|
377
|
+
export {
|
|
378
|
+
readJsonResponse,
|
|
379
|
+
hostFetch,
|
|
380
|
+
providerWaitMs,
|
|
381
|
+
statusToCode,
|
|
382
|
+
retrying,
|
|
383
|
+
endpoint,
|
|
384
|
+
onThisComputer,
|
|
385
|
+
modelAddressAllowed,
|
|
386
|
+
PLAIN_HTTP_REFUSED,
|
|
387
|
+
endpointFetch
|
|
388
|
+
};
|
|
@@ -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-DVHX7R54.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-QLLBACDR.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// 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-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
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
AUTHORITY_KEY,
|
|
5
|
+
BOT_API_KEY,
|
|
6
|
+
authorityAllowed,
|
|
7
|
+
botApiAllowed,
|
|
8
|
+
changesMessenger,
|
|
9
|
+
isBotApi,
|
|
10
|
+
keyForCommand,
|
|
11
|
+
levelFor,
|
|
12
|
+
readKeysForCommand
|
|
13
|
+
} from "./chunk-5LPREGD3.js";
|
|
14
|
+
import {
|
|
15
|
+
writes
|
|
16
|
+
} from "./chunk-CMZBCWND.js";
|
|
17
|
+
import {
|
|
18
|
+
__name
|
|
19
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
20
|
+
|
|
21
|
+
// 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/command-availability.js
|
|
22
|
+
var commandAvailability = /* @__PURE__ */ __name((info, levels, keyOf, authority, readOnly = false, mcp = true, declared, fetches) => {
|
|
23
|
+
const declaredKey = declared?.keyOf(info.path);
|
|
24
|
+
const key = declared ? declaredKey : keyOf?.(info.path) ?? keyForCommand(info.path);
|
|
25
|
+
const { level } = key ? levelFor(levels, key, declared?.defaults) : { level: "allow" };
|
|
26
|
+
const judged = { ...key ? { permission: key } : {}, level };
|
|
27
|
+
const blocked = /* @__PURE__ */ __name((reason, permission) => ({
|
|
28
|
+
available: false,
|
|
29
|
+
reason,
|
|
30
|
+
...judged,
|
|
31
|
+
...permission && permission !== judged.permission ? { permission, level: levelFor(levels, permission).level } : {}
|
|
32
|
+
}), "blocked");
|
|
33
|
+
const declaredChange = Boolean(declaredKey) && (info.effects === void 0 || info.effects.remote === "write");
|
|
34
|
+
if (readOnly && (changesMessenger(info) || declaredChange || authority?.(info.path)))
|
|
35
|
+
return blocked("the read-only lock blocks this change");
|
|
36
|
+
if (mcp && authority?.(info.path) && !authorityAllowed(levels))
|
|
37
|
+
return blocked(`the profile keeps ${AUTHORITY_KEY} off`, AUTHORITY_KEY);
|
|
38
|
+
if (mcp && isBotApi(info.path) && !botApiAllowed(levels))
|
|
39
|
+
return blocked(`the profile requires ${BOT_API_KEY}: allow`, BOT_API_KEY);
|
|
40
|
+
if (level === "deny")
|
|
41
|
+
return blocked(`the profile denies ${key}`);
|
|
42
|
+
if (level === "readonly" && writes(info.effects) && fetches?.(info.path) !== true)
|
|
43
|
+
return blocked(`${key} is readonly in this profile`);
|
|
44
|
+
const denied = (declared ? [] : readKeysForCommand(info.path)).find((read) => levelFor(levels, read).level === "deny");
|
|
45
|
+
return denied ? blocked(`the profile denies ${denied}`, denied) : { available: true, ...judged };
|
|
46
|
+
}, "commandAvailability");
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
commandAvailability
|
|
50
|
+
};
|