@wirecat/zoom-cli 0.55.0 → 0.57.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/README.md +4 -4
- package/dist/bin/zm.js +35 -5
- package/dist/bundle/all-profiles-EKHWTGOY.js +25 -0
- package/dist/bundle/answer-policy-KH2IFXPN.js +96 -0
- package/dist/bundle/anthropic-VL54IUGF.js +70 -0
- package/dist/bundle/bun-ADJVI4HY.js +169 -0
- package/dist/bundle/bun-sqlite-2SDA3YOT.js +69 -0
- package/dist/bundle/chunk-2IKY7VBH.js +9 -0
- package/dist/bundle/chunk-2WOGZDZG.js +431 -0
- package/dist/bundle/chunk-4R7HYNZS.js +73 -0
- package/dist/bundle/chunk-4VCA7QU3.js +538 -0
- package/dist/bundle/chunk-4YLS4YLS.js +29 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5F7IOESV.js +281 -0
- package/dist/bundle/chunk-5QESMCQK.js +122 -0
- package/dist/bundle/chunk-6M6FJV5D.js +138 -0
- package/dist/bundle/chunk-6MX5T6AQ.js +17 -0
- package/dist/bundle/chunk-6P3YHT54.js +385 -0
- package/dist/bundle/chunk-7A6PZUDR.js +938 -0
- package/dist/bundle/chunk-7GUG6UZS.js +884 -0
- package/dist/bundle/chunk-7JZJMHQY.js +487 -0
- package/dist/bundle/chunk-A4ETXPMZ.js +98 -0
- package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
- package/dist/bundle/chunk-AE4BOXH7.js +5292 -0
- package/dist/bundle/chunk-AN3GVZTU.js +76 -0
- package/dist/bundle/chunk-BAYNCCNM.js +215 -0
- package/dist/bundle/chunk-BW2WPOXP.js +166 -0
- package/dist/bundle/chunk-BW52AJ4R.js +3387 -0
- package/dist/bundle/chunk-CB5UTASG.js +18 -0
- package/dist/bundle/chunk-CLMXBW53.js +1028 -0
- package/dist/bundle/chunk-DCTXOMOR.js +35 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-EOQFWJJD.js +1095 -0
- package/dist/bundle/chunk-G4R4ZIGD.js +3569 -0
- package/dist/bundle/chunk-G4VZDINN.js +161 -0
- package/dist/bundle/chunk-GARCOIB6.js +409 -0
- package/dist/bundle/chunk-GKMGS7G5.js +1938 -0
- package/dist/bundle/chunk-HCNMFFG3.js +82 -0
- package/dist/bundle/chunk-HG5KRV55.js +1970 -0
- package/dist/bundle/chunk-HKYLSIZ2.js +82 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-I4VQDXFR.js +100 -0
- package/dist/bundle/chunk-ICSKEDPI.js +36139 -0
- package/dist/bundle/chunk-IP4OK7RQ.js +24 -0
- package/dist/bundle/chunk-IVQ6342B.js +2 -0
- package/dist/bundle/chunk-K72SEMYI.js +160 -0
- package/dist/bundle/chunk-LHRCJYFC.js +19 -0
- package/dist/bundle/chunk-LPTIQLDW.js +192 -0
- package/dist/bundle/chunk-LQ3T2ZIX.js +124 -0
- package/dist/bundle/chunk-LSVI3A5X.js +836 -0
- package/dist/bundle/chunk-LW2G4U6W.js +570 -0
- package/dist/bundle/chunk-LXB6ONWC.js +3517 -0
- package/dist/bundle/chunk-LY26NW3I.js +6848 -0
- package/dist/bundle/chunk-MAEFLDHG.js +6092 -0
- package/dist/bundle/chunk-MZH4GDR4.js +45 -0
- package/dist/bundle/chunk-NN5B24KP.js +1109 -0
- package/dist/bundle/chunk-NO7CJEYV.js +22 -0
- package/dist/bundle/chunk-NTDWAAGL.js +18435 -0
- package/dist/bundle/chunk-NW3X3G5X.js +264 -0
- package/dist/bundle/chunk-O66V2WHK.js +48 -0
- package/dist/bundle/chunk-OCGPZHXW.js +25 -0
- package/dist/bundle/chunk-OIHDCGV4.js +151 -0
- package/dist/bundle/chunk-OVSWVPXL.js +8190 -0
- package/dist/bundle/chunk-PIN5RZ3D.js +63 -0
- package/dist/bundle/chunk-QLIB3PEC.js +1146 -0
- package/dist/bundle/chunk-QTR6D5HT.js +58 -0
- package/dist/bundle/chunk-QUJPQMHJ.js +2315 -0
- package/dist/bundle/chunk-R3HPOCZD.js +188 -0
- package/dist/bundle/chunk-RMV4C2YL.js +482 -0
- package/dist/bundle/chunk-RRRBMQ2E.js +844 -0
- package/dist/bundle/chunk-S4S7E54J.js +60 -0
- package/dist/bundle/chunk-SB6WOSHG.js +1109 -0
- package/dist/bundle/chunk-SE75DPBY.js +31 -0
- package/dist/bundle/chunk-SQJ7EH2D.js +97 -0
- package/dist/bundle/chunk-TKCHUT2H.js +422 -0
- package/dist/bundle/chunk-TLQUKHEM.js +193 -0
- package/dist/bundle/chunk-TZ2MKETI.js +100 -0
- package/dist/bundle/chunk-UC44ZMQV.js +78 -0
- package/dist/bundle/chunk-UI5UTMSZ.js +275 -0
- package/dist/bundle/chunk-VPPYYWOH.js +630 -0
- package/dist/bundle/chunk-WJHK5D7Z.js +35612 -0
- package/dist/bundle/chunk-WQ24UC44.js +239 -0
- package/dist/bundle/chunk-X5DFDGWS.js +2 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YB4DMKYX.js +119 -0
- package/dist/bundle/chunk-Z4TZ6TAF.js +288 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/cli-72EQATJF.js +825 -0
- package/dist/bundle/command-contract-4MHSZUN3.js +38 -0
- package/dist/bundle/config-GFIJK6G2.js +79 -0
- package/dist/bundle/dist-IBNHCQXT.js +136 -0
- package/dist/bundle/dist-XUFQCJXW.js +7577 -0
- package/dist/bundle/echarts-RFTK737T.js +42501 -0
- package/dist/bundle/embed-7QYA2ZZE.js +35 -0
- package/dist/bundle/embedder-YNN6PCHG.js +108 -0
- package/dist/bundle/first-run-EVSRQKZJ.js +23 -0
- package/dist/bundle/first-screen-RG4GUKW7.js +36 -0
- package/dist/bundle/folders-JEPOMYM4.js +13 -0
- package/dist/bundle/instructions-FHNL7CMW.js +9 -0
- package/dist/bundle/main-NYGJXPH7.js +130 -0
- package/dist/bundle/mcp-IXFC2VVR.js +165 -0
- package/dist/bundle/mcp-VGSZDCKK.js +189 -0
- package/dist/bundle/mcp-XKP2PXLS.js +92 -0
- package/dist/bundle/meetings-IBPI4MM4.js +215 -0
- package/dist/bundle/node-P4E63KXA.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-ZMCACJVS.js +176 -0
- package/dist/bundle/node-sqlite-ZNGOBA5Q.js +45 -0
- package/dist/bundle/oauth-Q6LKF7DB.js +17 -0
- package/dist/bundle/open-LJ332Y5O.js +19 -0
- package/dist/bundle/output-file-RYQZ3RTE.js +63 -0
- package/dist/bundle/process-ZPTLNVQS.js +91 -0
- package/dist/bundle/program-IBRQBQ6W.js +5845 -0
- package/dist/bundle/prompt-RT7GUUXH.js +12 -0
- package/dist/bundle/recognize-QXGE7YJH.js +190 -0
- package/dist/bundle/remote-FD4MZQV3.js +26 -0
- package/dist/bundle/rerank-V6AVV755.js +49 -0
- package/dist/bundle/run-log-RE2EI3UU.js +111 -0
- package/dist/bundle/serve-HIJTFAW7.js +19 -0
- package/dist/bundle/server-3QOXOYYL.js +53 -0
- package/dist/bundle/server-WLJCU7KK.js +812 -0
- package/dist/bundle/services-KC5KQFBS.js +330 -0
- package/dist/bundle/speech-5JOXLYDA.js +44 -0
- package/dist/bundle/state-PPGRB3T6.js +33 -0
- package/dist/bundle/store-LODVDPK3.js +141 -0
- package/dist/bundle/store-WB5BICTG.js +124 -0
- package/dist/bundle/store-connection-EG6Z5ITP.js +76 -0
- package/dist/bundle/store-maintenance-command-Q5WMFUZ2.js +54 -0
- package/dist/bundle/streaming-UGFFNOXL.js +15 -0
- package/dist/bundle/tokens-AF5CPY2F.js +17 -0
- package/dist/bundle/zm.js +8 -0
- package/dist/commands.js +2 -2
- package/dist/commands.js.map +1 -1
- package/dist/config-issues.d.ts.map +1 -1
- package/dist/config-issues.js +3 -0
- package/dist/config-issues.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +34 -45
- package/dist/contract-overrides.js.map +1 -1
- package/dist/first-screen.js +1 -1
- package/dist/first-screen.js.map +1 -1
- package/dist/mcp-command.d.ts +5 -3
- package/dist/mcp-command.d.ts.map +1 -1
- package/dist/mcp-command.js +73 -15
- package/dist/mcp-command.js.map +1 -1
- package/dist/program-bindings.d.ts.map +1 -1
- package/dist/program-bindings.js +1 -0
- package/dist/program-bindings.js.map +1 -1
- package/dist/recording-archive.d.ts.map +1 -1
- package/dist/recording-archive.js +9 -4
- package/dist/recording-archive.js.map +1 -1
- package/dist/remote-http.d.ts +2 -0
- package/dist/remote-http.d.ts.map +1 -1
- package/dist/remote-http.js +21 -11
- package/dist/remote-http.js.map +1 -1
- package/dist/request-events.d.ts +12 -0
- package/dist/request-events.d.ts.map +1 -1
- package/dist/request-events.js +56 -4
- package/dist/request-events.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +4 -1
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -5
- package/skills/zoom-cli/SKILL.md +3 -1
|
@@ -0,0 +1,1146 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
AUDIT_MIN_SCORE,
|
|
5
|
+
throughWrapper
|
|
6
|
+
} from "./chunk-ICSKEDPI.js";
|
|
7
|
+
import {
|
|
8
|
+
Command,
|
|
9
|
+
InvalidArgumentError,
|
|
10
|
+
Option,
|
|
11
|
+
annotate,
|
|
12
|
+
environmentOf,
|
|
13
|
+
itemOf,
|
|
14
|
+
listOf,
|
|
15
|
+
nextStep,
|
|
16
|
+
renderAnswer,
|
|
17
|
+
sharedCommand,
|
|
18
|
+
snakeKeys
|
|
19
|
+
} from "./chunk-MAEFLDHG.js";
|
|
20
|
+
import {
|
|
21
|
+
readOnlyLockOf
|
|
22
|
+
} from "./chunk-OCGPZHXW.js";
|
|
23
|
+
import {
|
|
24
|
+
formatReference
|
|
25
|
+
} from "./chunk-GARCOIB6.js";
|
|
26
|
+
import {
|
|
27
|
+
EVENT_QUERY,
|
|
28
|
+
MEETING_PROJECT_EVIDENCE_QUERY,
|
|
29
|
+
MEETING_QUERY,
|
|
30
|
+
MEETING_QUERY_GUIDE,
|
|
31
|
+
MeetingError,
|
|
32
|
+
SAVE_HELP,
|
|
33
|
+
eventItem,
|
|
34
|
+
exportMeeting,
|
|
35
|
+
importFiles,
|
|
36
|
+
listed,
|
|
37
|
+
meetingDetailsAnswer,
|
|
38
|
+
meetingHitsList,
|
|
39
|
+
meetingPeople,
|
|
40
|
+
meetingSummaryAnswer,
|
|
41
|
+
meetingTranscriptAnswer,
|
|
42
|
+
meetingsList,
|
|
43
|
+
meetingsQuery,
|
|
44
|
+
pull,
|
|
45
|
+
readMeetingProjectEvidence,
|
|
46
|
+
validateMeetingHitSearch,
|
|
47
|
+
validateMeetingPassage
|
|
48
|
+
} from "./chunk-LXB6ONWC.js";
|
|
49
|
+
import {
|
|
50
|
+
OPERATORS_BY_TYPE,
|
|
51
|
+
QUERY_LIMITS,
|
|
52
|
+
dateRange,
|
|
53
|
+
defineQuery,
|
|
54
|
+
fieldsHelp,
|
|
55
|
+
fieldsNamed,
|
|
56
|
+
parseLucene,
|
|
57
|
+
queryError,
|
|
58
|
+
queryFieldsOf,
|
|
59
|
+
timezoneOf,
|
|
60
|
+
validateQuery,
|
|
61
|
+
zonedMoment
|
|
62
|
+
} from "./chunk-LSVI3A5X.js";
|
|
63
|
+
import {
|
|
64
|
+
CliError,
|
|
65
|
+
array,
|
|
66
|
+
boolean,
|
|
67
|
+
check,
|
|
68
|
+
description,
|
|
69
|
+
maxLength,
|
|
70
|
+
optional,
|
|
71
|
+
pipe,
|
|
72
|
+
record,
|
|
73
|
+
safeParse,
|
|
74
|
+
strictObject,
|
|
75
|
+
string
|
|
76
|
+
} from "./chunk-AE4BOXH7.js";
|
|
77
|
+
import {
|
|
78
|
+
__name
|
|
79
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
80
|
+
|
|
81
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
|
|
82
|
+
var COMMAND_NEEDS = {
|
|
83
|
+
"account update": ["updateProfile", "change the profile"],
|
|
84
|
+
"account sessions list": ["sessions", "list the account's sessions"],
|
|
85
|
+
"account sessions end": ["endOtherSessions", "end other sessions"],
|
|
86
|
+
"chats events": ["chatEvents", "read who joined or left"],
|
|
87
|
+
"chats inspect": ["inspect", "read a link"],
|
|
88
|
+
"chats folders list": ["folders", "list its folders"],
|
|
89
|
+
"chats folders show": ["folders", "list its folders"],
|
|
90
|
+
"chats folders create": ["createFolder", "create a folder"],
|
|
91
|
+
"chats folders update": ["updateFolder", "change a folder"],
|
|
92
|
+
"chats folders delete": ["deleteFolder", "delete a folder"],
|
|
93
|
+
"contacts add": ["addContact", "add a contact"],
|
|
94
|
+
"contacts remove": ["removeContact", "remove a contact"],
|
|
95
|
+
"contacts rename": ["renameContact", "rename a contact"],
|
|
96
|
+
"contacts import": ["importContacts", "import contacts"],
|
|
97
|
+
"messages comments": ["comments", "read comments on a channel post"],
|
|
98
|
+
"messages pin": ["pin", "pin a message"],
|
|
99
|
+
"messages unpin": ["unpin", "unpin a message"]
|
|
100
|
+
};
|
|
101
|
+
var STORE_ANSWERS = /* @__PURE__ */ new Set(["chats events"]);
|
|
102
|
+
var lackedNeed = /* @__PURE__ */ __name((messenger, path) => {
|
|
103
|
+
const need = COMMAND_NEEDS[path];
|
|
104
|
+
if (!need)
|
|
105
|
+
return void 0;
|
|
106
|
+
if (path === "messages comments" && (messenger?.readsComments ?? messenger?.channelComments) === false)
|
|
107
|
+
return need;
|
|
108
|
+
if (!messenger?.lacks?.includes(need[0]) && !messenger?.never?.includes(need[0]))
|
|
109
|
+
return void 0;
|
|
110
|
+
return messenger.history === "store" && STORE_ANSWERS.has(path) ? void 0 : need;
|
|
111
|
+
}, "lackedNeed");
|
|
112
|
+
var refuseLacking = /* @__PURE__ */ __name((messenger, path) => {
|
|
113
|
+
const need = lackedNeed(messenger, path.join(" "));
|
|
114
|
+
if (need)
|
|
115
|
+
throw new CliError("validation_error", `this messenger cannot ${need[1]}`);
|
|
116
|
+
}, "refuseLacking");
|
|
117
|
+
var hideNever = /* @__PURE__ */ __name((messenger, group) => {
|
|
118
|
+
const walk = /* @__PURE__ */ __name((command, path) => {
|
|
119
|
+
for (const child of command.commands) {
|
|
120
|
+
const at = [...path, child.name()];
|
|
121
|
+
const need = COMMAND_NEEDS[at.join(" ")];
|
|
122
|
+
if (need && messenger.never?.includes(need[0]))
|
|
123
|
+
child._hidden = true;
|
|
124
|
+
walk(child, at);
|
|
125
|
+
}
|
|
126
|
+
}, "walk");
|
|
127
|
+
walk(group, [group.name()]);
|
|
128
|
+
return group;
|
|
129
|
+
}, "hideNever");
|
|
130
|
+
|
|
131
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
|
|
132
|
+
var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
133
|
+
var moment = /* @__PURE__ */ __name((flag, end, readIn) => (value) => {
|
|
134
|
+
const zone = timezoneOf();
|
|
135
|
+
let time;
|
|
136
|
+
try {
|
|
137
|
+
time = zonedMoment(value, zone, { start: 0, end: value.length }, { end });
|
|
138
|
+
} catch {
|
|
139
|
+
throw new CliError("validation_error", `${flag} takes an ISO date, or a time with or without an offset`);
|
|
140
|
+
}
|
|
141
|
+
if (!ZONED.test(value.trim()))
|
|
142
|
+
readIn(zone);
|
|
143
|
+
return time;
|
|
144
|
+
}, "moment");
|
|
145
|
+
var integer = /* @__PURE__ */ __name((value) => {
|
|
146
|
+
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
147
|
+
throw new CliError("validation_error", "expected a positive safe integer");
|
|
148
|
+
return Number(value);
|
|
149
|
+
}, "integer");
|
|
150
|
+
var createMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program) => {
|
|
151
|
+
let search = program.commands.find((command2) => command2.name() === "search");
|
|
152
|
+
if (!search) {
|
|
153
|
+
search = new Command("search").description("search the stored resources");
|
|
154
|
+
program.addCommand(search);
|
|
155
|
+
}
|
|
156
|
+
const readIn = /* @__PURE__ */ __name((zone) => command.setOptionValue("timesReadIn", zone), "readIn");
|
|
157
|
+
const command = search.command("meetings").description("find words in stored meetings, indexing new ones first").argument("<query>", 'words, OR, (groups), -word, "a phrase", "a b"~N (within N lines), exact:word, from:"Name" (who said the line); date>=30d, project:, tag:, topic: choose meetings; a word also matches its other forms and spellings speech recognition garbled').option("--meeting-id <id>", "only this stored meeting", integer).option("--identity-id <id>", "meetings with this participant identity; does not say who spoke a hit", integer).option("--person-id <id>", "meetings with a participant linked to this person", integer).option("--event-id <id>", "only meetings linked to this stored event", integer).option("--series-id <id>", "only meetings in this stored series", integer).option("--project <project>", "meetings confirmed in this project, by name, key or alias").option("--tag <name>", "meetings with this tag, by name or alias").option("--topic-name <name>", "meetings with this topic, by name or alias").option("--since-time <time>", "meetings starting at or after this ISO 8601 date or time", moment("--since-time", false, readIn)).option("--until-time <time>", "meetings starting at or before this ISO 8601 date or time; a date alone covers that whole local day", moment("--until-time", true, readIn)).option("--limit <n>", "how many hits, 1 through 1000 (default 100)", integer).option("--cursor <cursor>", "continue from the previous page's page.next_cursor, with the same query and filters").option("--max-read-bytes <bytes>", "most stored bytes to read, 1 through 67108864 (default 4194304)", integer);
|
|
158
|
+
annotate(command, {
|
|
159
|
+
origin: "handwritten",
|
|
160
|
+
effects: { remote: "none", local: "read" },
|
|
161
|
+
output: { entity: "meeting_hit" }
|
|
162
|
+
});
|
|
163
|
+
return command;
|
|
164
|
+
}, "createMeetingSearchCommandDefinition");
|
|
165
|
+
var meetingHitSearchRequest = /* @__PURE__ */ __name((query, options, signal) => {
|
|
166
|
+
const request = {
|
|
167
|
+
meetingId: options.meetingId,
|
|
168
|
+
participantIdentityId: options.identityId,
|
|
169
|
+
personId: options.personId,
|
|
170
|
+
eventId: options.eventId,
|
|
171
|
+
meetingSeriesId: options.seriesId,
|
|
172
|
+
project: options.project,
|
|
173
|
+
tag: options.tag,
|
|
174
|
+
topic: options.topicName ?? options.topic,
|
|
175
|
+
since: options.sinceTime,
|
|
176
|
+
until: options.untilTime,
|
|
177
|
+
limit: options.limit,
|
|
178
|
+
after: options.cursor,
|
|
179
|
+
maxReadBytes: options.maxReadBytes,
|
|
180
|
+
signal
|
|
181
|
+
};
|
|
182
|
+
validateMeetingHitSearch(query, request);
|
|
183
|
+
signal?.throwIfAborted();
|
|
184
|
+
return request;
|
|
185
|
+
}, "meetingHitSearchRequest");
|
|
186
|
+
var meetingSearchArguments = /* @__PURE__ */ __name((query, options) => Object.fromEntries(Object.entries({
|
|
187
|
+
query,
|
|
188
|
+
meeting_id: options.meetingId?.toString(),
|
|
189
|
+
identity_id: options.identityId?.toString(),
|
|
190
|
+
person_id: options.personId?.toString(),
|
|
191
|
+
event_id: options.eventId?.toString(),
|
|
192
|
+
series_id: options.seriesId?.toString(),
|
|
193
|
+
project: options.project,
|
|
194
|
+
tag: options.tag,
|
|
195
|
+
topic_name: options.topicName ?? options.topic,
|
|
196
|
+
since_time: options.sinceTime === void 0 ? void 0 : new Date(options.sinceTime).toISOString(),
|
|
197
|
+
until_time: options.untilTime === void 0 ? void 0 : new Date(options.untilTime).toISOString(),
|
|
198
|
+
max_read_bytes: options.maxReadBytes ?? 4194304
|
|
199
|
+
}).filter(([, value]) => value !== void 0)), "meetingSearchArguments");
|
|
200
|
+
var meetingSearchMeta = /* @__PURE__ */ __name((options) => {
|
|
201
|
+
const window2 = {
|
|
202
|
+
...options.sinceTime === void 0 ? {} : { since: new Date(options.sinceTime).toISOString() },
|
|
203
|
+
...options.untilTime === void 0 ? {} : { until: new Date(options.untilTime).toISOString() }
|
|
204
|
+
};
|
|
205
|
+
return {
|
|
206
|
+
...options.timesReadIn === void 0 ? {} : { timezone: options.timesReadIn },
|
|
207
|
+
...Object.keys(window2).length === 0 ? {} : { window: window2 }
|
|
208
|
+
};
|
|
209
|
+
}, "meetingSearchMeta");
|
|
210
|
+
var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) => createMeetingSearchCommand(program).action(async (query, options) => {
|
|
211
|
+
const request = meetingHitSearchRequest(query, options, deps.signal());
|
|
212
|
+
deps.output(meetingHitsList(await deps.search(query, request, options), request.limit ?? 100, "search meetings", meetingSearchArguments(query, options), meetingSearchMeta(options)));
|
|
213
|
+
}), "addMeetingSearchCommandDefinition");
|
|
214
|
+
var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
|
|
215
|
+
var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
|
|
216
|
+
|
|
217
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
|
|
218
|
+
var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
|
|
219
|
+
command.allowUnknownOption();
|
|
220
|
+
const parse = command.parseOptions.bind(command);
|
|
221
|
+
command.parseOptions = (args) => {
|
|
222
|
+
const parsed = parse(args);
|
|
223
|
+
const end = parsed.unknown.indexOf("--");
|
|
224
|
+
const help = command._getHelpOption();
|
|
225
|
+
const typo = parsed.unknown.slice(0, end < 0 ? void 0 : end).find((word) => word.startsWith("--") && !help?.is(word));
|
|
226
|
+
if (typo !== void 0) {
|
|
227
|
+
command.allowUnknownOption(false);
|
|
228
|
+
command.unknownOption(typo);
|
|
229
|
+
}
|
|
230
|
+
if (end >= 0)
|
|
231
|
+
parsed.unknown.splice(end, 1);
|
|
232
|
+
return parsed;
|
|
233
|
+
};
|
|
234
|
+
return command;
|
|
235
|
+
}, "queryWordsAfterOptions");
|
|
236
|
+
|
|
237
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
|
|
238
|
+
var count = /* @__PURE__ */ __name((value) => {
|
|
239
|
+
if (!/^(0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
240
|
+
throw new CliError("validation_error", "expected a nonnegative safe integer");
|
|
241
|
+
return Number(value);
|
|
242
|
+
}, "count");
|
|
243
|
+
var meetingPassageRequest = /* @__PURE__ */ __name((reference, options, signal) => {
|
|
244
|
+
const input = {
|
|
245
|
+
before: options.beforeN,
|
|
246
|
+
after: options.afterN,
|
|
247
|
+
bytes: options.bytes,
|
|
248
|
+
max_read_bytes: options.maxReadBytes,
|
|
249
|
+
expected_fingerprint: options.expectedFingerprint,
|
|
250
|
+
format: options.format ?? "text",
|
|
251
|
+
signal
|
|
252
|
+
};
|
|
253
|
+
validateMeetingPassage(reference, input);
|
|
254
|
+
signal?.throwIfAborted();
|
|
255
|
+
return input;
|
|
256
|
+
}, "meetingPassageRequest");
|
|
257
|
+
var createMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program) => {
|
|
258
|
+
const meetings = program.commands.find((command) => command.name() === "meetings");
|
|
259
|
+
if (!meetings)
|
|
260
|
+
throw new CliError("configuration_error", "meeting command group is unavailable");
|
|
261
|
+
return annotate(meetings.command("passage").description("read a cited cue with bounded context before and after it").argument("<reference>", "retained transcript cue reference from a search hit").option("--before-n <n>", "preceding cues (default 3)", count).option("--after-n <n>", "following cues (default 3); at most 999 surrounding cues in total", count).option("--bytes <bytes>", "cue JSON byte budget (default 65536); the anchor must fit", count).option("--max-read-bytes <bytes>", "stored text byte budget (default 4194304); boundary probes read metadata only", count).option("--expected-fingerprint <hash>", "reject a changed anchor using its previously read cue fingerprint").addOption(new Option("--format <format>", "compact text, Markdown or structured JSON").choices(["text", "markdown", "json"]).default("text")), {
|
|
262
|
+
origin: "handwritten",
|
|
263
|
+
effects: { remote: "none", local: "read" },
|
|
264
|
+
output: { entity: "meeting_passage" },
|
|
265
|
+
examples: [`${program.name()} meetings passage meeting:1/1/1/0 --json`]
|
|
266
|
+
});
|
|
267
|
+
}, "createMeetingPassageCommandDefinition");
|
|
268
|
+
var addMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program, deps) => createMeetingPassageCommand(program).action(async (reference, options, command) => {
|
|
269
|
+
const globals = command.optsWithGlobals();
|
|
270
|
+
const format = globals.json || globals.jsonl ? "json" : options.format ?? "text";
|
|
271
|
+
const input = meetingPassageRequest(reference, { ...options, format }, deps.signal());
|
|
272
|
+
const result = await deps.read(reference, input);
|
|
273
|
+
input.signal?.throwIfAborted();
|
|
274
|
+
deps.output(result, format);
|
|
275
|
+
}), "addMeetingPassageCommandDefinition");
|
|
276
|
+
var createMeetingPassageCommand = sharedCommand(createMeetingPassageCommandDefinition);
|
|
277
|
+
var addMeetingPassageCommand = sharedCommand(addMeetingPassageCommandDefinition);
|
|
278
|
+
|
|
279
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
|
|
280
|
+
var integer2 = /* @__PURE__ */ __name((value) => {
|
|
281
|
+
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
282
|
+
throw new CliError("validation_error", "expected a positive safe integer");
|
|
283
|
+
return Number(value);
|
|
284
|
+
}, "integer");
|
|
285
|
+
var addMeetingProjectEvidenceCommandDefinition = /* @__PURE__ */ __name((program, deps) => {
|
|
286
|
+
const group = program.commands.find((command) => command.name() === "meetings");
|
|
287
|
+
if (!group)
|
|
288
|
+
throw new CliError("configuration_error", "meeting command group is unavailable");
|
|
289
|
+
const projects = group.commands.find((command) => command.name() === "projects") ?? group.command("projects").description("project-name evidence in stored meetings");
|
|
290
|
+
return annotate(queryWordsAfterOptions(projects.command("evidence").description("find cited project-name and alias evidence in the local meeting index; does not refresh it or confirm membership")).argument("<project>", "existing project name, key or explicit alias").argument("[query...]", "exact ID fields and a UTC started_at range, joined by AND").addHelpText("after", `
|
|
291
|
+
${fieldsHelp(MEETING_PROJECT_EVIDENCE_QUERY)}`).option("--limit <n>", "hits in one name page, 1 through 1000 (default 100)", integer2).option("--cursor <cursor>", "continue with the same project and frozen selection from next").option("--max-read-bytes <bytes>", "word-read byte budget, at most 67108864 (default 4194304)", integer2).action(async (project, words, options) => {
|
|
292
|
+
deps.output(await readMeetingProjectEvidence(deps.read, project, { ...options, query: words.join(" "), signal: deps.signal() }, deps.now?.()));
|
|
293
|
+
}), {
|
|
294
|
+
origin: "handwritten",
|
|
295
|
+
effects: { remote: "none", local: "read" },
|
|
296
|
+
query: MEETING_PROJECT_EVIDENCE_QUERY,
|
|
297
|
+
output: { entity: "meeting_project_evidence" }
|
|
298
|
+
});
|
|
299
|
+
}, "addMeetingProjectEvidenceCommandDefinition");
|
|
300
|
+
var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
|
|
301
|
+
|
|
302
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
|
|
303
|
+
var integer3 = /* @__PURE__ */ __name((text) => {
|
|
304
|
+
if (!/^[1-9]\d*$/.test(text) || !Number.isSafeInteger(Number(text)))
|
|
305
|
+
throw new InvalidArgumentError("expected a positive integer");
|
|
306
|
+
return Number(text);
|
|
307
|
+
}, "integer");
|
|
308
|
+
var lookbackDays = /* @__PURE__ */ __name((text) => {
|
|
309
|
+
if (!/^(0|[1-9]\d*)$/.test(text) || Number(text) > 31)
|
|
310
|
+
throw new InvalidArgumentError("expected an integer from 0 through 31 days");
|
|
311
|
+
return Number(text);
|
|
312
|
+
}, "lookbackDays");
|
|
313
|
+
var date = /* @__PURE__ */ __name((text) => {
|
|
314
|
+
try {
|
|
315
|
+
return zonedMoment(text, timezoneOf(), { start: 0, end: text.length });
|
|
316
|
+
} catch {
|
|
317
|
+
throw new InvalidArgumentError("expected an ISO date, or a time with or without an offset");
|
|
318
|
+
}
|
|
319
|
+
}, "date");
|
|
320
|
+
var LOCAL_READ = { remote: "none", local: "read" };
|
|
321
|
+
var LOCAL_WRITE = { remote: "none", local: "write" };
|
|
322
|
+
var FETCH = { remote: "read", local: "write" };
|
|
323
|
+
var addMeetingCommandsDefinition = /* @__PURE__ */ __name((program, deps) => {
|
|
324
|
+
const group = annotate(program.command("meetings").description("stored meetings and their records"), {
|
|
325
|
+
effects: { remote: "none", local: "none" }
|
|
326
|
+
});
|
|
327
|
+
const output = /* @__PURE__ */ __name((command) => command.option("--json", "one JSON value").option("--jsonl", "one JSON object per item").hook("preAction", (cmd) => {
|
|
328
|
+
const opts = cmd.optsWithGlobals();
|
|
329
|
+
if (opts.json && opts.jsonl)
|
|
330
|
+
throw new MeetingError("validation_error", "choose --json or --jsonl");
|
|
331
|
+
}), "output");
|
|
332
|
+
const print = /* @__PURE__ */ __name((value, command) => {
|
|
333
|
+
const opts = command.optsWithGlobals();
|
|
334
|
+
deps.write(value, opts.json ? "json" : opts.jsonl ? "jsonl" : "text");
|
|
335
|
+
}, "print");
|
|
336
|
+
const list = queryWordsAfterOptions(group.command("list").description("stored meetings, newest first")).argument("[query...]", "field:value terms that narrow the list \u2014 the fields are below").addHelpText("after", `
|
|
337
|
+
${fieldsHelp(MEETING_QUERY, MEETING_QUERY_GUIDE)}`);
|
|
338
|
+
annotate(list, { effects: LOCAL_READ, query: defineQuery(MEETING_QUERY), output: { entity: "meeting" } });
|
|
339
|
+
output(list).option("--limit <n>", "meetings per page", integer3, 100).option("--page <n>", "page number", integer3, 1).action(async (words, opts, command) => {
|
|
340
|
+
const query = meetingsQuery(words.join(" "));
|
|
341
|
+
print(await meetingsList(deps.store, { accountId: deps.accountId, limit: opts.limit, ...query ? { query } : {} }, opts.page), command);
|
|
342
|
+
});
|
|
343
|
+
output(annotate(group.command("show"), { effects: LOCAL_READ, output: { entity: "meeting_details" } }).description("show a stored meeting").argument("<meeting>", "stored meeting id", integer3).addHelpText("after", SAVE_HELP)).action(async (id, _opts, command) => {
|
|
344
|
+
print(await meetingDetailsAnswer(deps.store, id, deps.accountId), command);
|
|
345
|
+
});
|
|
346
|
+
output(annotate(group.command("transcript"), { effects: LOCAL_READ, output: { entity: "meeting_transcript" } }).description("show current meeting transcripts").argument("<meeting>", "stored meeting id", integer3).option("--history", "include superseded transcript versions").addHelpText("after", SAVE_HELP)).action(async (id, opts, command) => {
|
|
347
|
+
print(await meetingTranscriptAnswer(deps.store, id, deps.accountId, { history: opts.history }), command);
|
|
348
|
+
});
|
|
349
|
+
output(annotate(group.command("summary"), { effects: LOCAL_READ, output: { entity: "meeting_summary" } }).description("show stored meeting summaries").argument("<meeting>", "stored meeting id", integer3)).action(async (id, _opts, command) => {
|
|
350
|
+
print(await meetingSummaryAnswer(deps.store, id, deps.accountId), command);
|
|
351
|
+
});
|
|
352
|
+
output(annotate(group.command("export"), { effects: LOCAL_WRITE, output: { entity: "meeting_export" } }).description("export a meeting as Markdown or one transcript as WebVTT").argument("<meeting>", "stored meeting id", integer3).addOption(new Option("--format <format>", "export format").choices(["markdown", "vtt"]).default("markdown")).option("--transcript-id <id>", "export a specific transcript version", integer3).option("--output <file>", "write content to a file through the host's writer")).action(async (id, opts, command) => {
|
|
353
|
+
if (opts.output !== void 0 && !opts.output.trim())
|
|
354
|
+
throw new MeetingError("validation_error", "output path must not be empty");
|
|
355
|
+
if (opts.output !== void 0 && !deps.writeFile)
|
|
356
|
+
throw new MeetingError("configuration_error", "the host has no export file writer");
|
|
357
|
+
const result = await exportMeeting(deps.store, id, {
|
|
358
|
+
accountId: deps.accountId,
|
|
359
|
+
format: opts.format,
|
|
360
|
+
transcriptId: opts.transcriptId
|
|
361
|
+
});
|
|
362
|
+
if (opts.output !== void 0) {
|
|
363
|
+
await deps.writeFile?.(opts.output, result.content);
|
|
364
|
+
print({ meetingId: result.meetingId, format: result.format, output: opts.output }, command);
|
|
365
|
+
} else
|
|
366
|
+
print(result, command);
|
|
367
|
+
});
|
|
368
|
+
output(annotate(group.command("people"), { effects: LOCAL_READ, output: { entity: "meeting_participants" } }).description("find meeting participants by name or email").argument("<query>", "a name or an email address")).option("--limit <n>", "most matching observations per page, 1\u20131000 (default 50)", integer3).option("--scan-limit <n>", "most participant observations to inspect, 1\u201310000 (default 1000)", integer3).option("--max-read-bytes <bytes>", "most stored name and email bytes to read (default 1048576)", integer3).option("--cursor <cursor>", "continue with the same name query and selected account").action(async (query, opts, command) => {
|
|
369
|
+
print(await meetingPeople(deps.store, query, deps.accountId, {
|
|
370
|
+
limit: opts.limit,
|
|
371
|
+
scanLimit: opts.scanLimit,
|
|
372
|
+
maxReadBytes: opts.maxReadBytes,
|
|
373
|
+
cursor: opts.cursor
|
|
374
|
+
}), command);
|
|
375
|
+
});
|
|
376
|
+
output(annotate(group.command("sync"), {
|
|
377
|
+
effects: FETCH,
|
|
378
|
+
offline: false,
|
|
379
|
+
output: { entity: "meeting_ingestion" }
|
|
380
|
+
}).description("bring the stored meetings up to date from the connected account")).option("--since-time <time>", "fetch meetings starting at or after this ISO 8601 date or time", date).option("--lookback-days <days>", "revisit recent occurrences for late transcripts (0\u201331)", lookbackDays, 0).action(async (opts, command) => {
|
|
381
|
+
if (!deps.source)
|
|
382
|
+
throw new MeetingError("configuration_error", "meeting source is unavailable");
|
|
383
|
+
print(await pull(deps.source, deps.store, {
|
|
384
|
+
accountId: deps.accountId,
|
|
385
|
+
since: opts.sinceTime === void 0 ? void 0 : new Date(opts.sinceTime).toISOString(),
|
|
386
|
+
now: deps.now?.(),
|
|
387
|
+
lookbackMs: opts.lookbackDays * 864e5
|
|
388
|
+
}), command);
|
|
389
|
+
});
|
|
390
|
+
const importCommand = annotate(group.command("import"), {
|
|
391
|
+
effects: LOCAL_WRITE,
|
|
392
|
+
output: { entity: "meeting_ingestion" }
|
|
393
|
+
}).description("import downloaded meeting transcripts").argument("<folder>", "folder of transcripts downloaded from the provider");
|
|
394
|
+
if (deps.importHelp)
|
|
395
|
+
importCommand.addHelpText("after", `
|
|
396
|
+
${deps.importHelp}`);
|
|
397
|
+
output(importCommand).action(async (folder, _opts, command) => {
|
|
398
|
+
if (!deps.readFiles)
|
|
399
|
+
throw new MeetingError("configuration_error", "file reader is unavailable");
|
|
400
|
+
const files = await deps.readFiles(folder);
|
|
401
|
+
if (files.some((file) => file.meeting.accountId !== deps.accountId))
|
|
402
|
+
throw new MeetingError("validation_error", "file account differs from selected account");
|
|
403
|
+
print(await importFiles(files, deps.store, deps.now?.()), command);
|
|
404
|
+
});
|
|
405
|
+
const eventList = queryWordsAfterOptions(annotate(program.command("events").description("the owner's stored events"), {
|
|
406
|
+
effects: { remote: "none", local: "none" }
|
|
407
|
+
}).command("list")).description("list stored events").argument("[query...]", "event id, origin or time fields that narrow the list").addHelpText("after", `
|
|
408
|
+
${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
|
|
409
|
+
annotate(eventList, { effects: LOCAL_READ, output: { entity: "event" }, query: EVENT_QUERY });
|
|
410
|
+
output(eventList).action(async (words, _opts, command) => {
|
|
411
|
+
const query = words.length ? parseLucene(words.join(" "), { defaultField: "none", command: "events list" }) : void 0;
|
|
412
|
+
if (query)
|
|
413
|
+
validateQuery(query, EVENT_QUERY, { command: "events list" });
|
|
414
|
+
if (query && !deps.store.queryEvents)
|
|
415
|
+
throw new MeetingError("validation_error", "this store cannot filter events");
|
|
416
|
+
const events = query ? await deps.store.queryEvents?.(query) : await deps.store.events();
|
|
417
|
+
print(listed((events ?? []).map(eventItem)), command);
|
|
418
|
+
});
|
|
419
|
+
}, "addMeetingCommandsDefinition");
|
|
420
|
+
var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
|
|
421
|
+
|
|
422
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/cli/list-query.js
|
|
423
|
+
var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
|
|
424
|
+
var withQuery = /* @__PURE__ */ __name((command, registry) => {
|
|
425
|
+
const query = defineQuery(registry);
|
|
426
|
+
annotate(command, { query, output: { entity: registry.entity } });
|
|
427
|
+
const shown = askable(query);
|
|
428
|
+
queryWordsAfterOptions(command).argument("[query...]", shown.length > 0 ? "field:value terms that narrow the list \u2014 the fields are below" : "field:value terms; this list filters by none yet");
|
|
429
|
+
if (shown.length > 0)
|
|
430
|
+
command.addHelpText("after", `
|
|
431
|
+
${fieldsHelp({ ...query, fields: shown }, LIST_QUERY_GUIDE)}`);
|
|
432
|
+
return command;
|
|
433
|
+
}, "withQuery");
|
|
434
|
+
var unfilteredQuery = /* @__PURE__ */ __name((entity, schema) => ({
|
|
435
|
+
entity,
|
|
436
|
+
backend: "native",
|
|
437
|
+
fields: queryFieldsOf(schema, {})
|
|
438
|
+
}), "unfilteredQuery");
|
|
439
|
+
var commandPath = /* @__PURE__ */ __name((command) => {
|
|
440
|
+
const words = [];
|
|
441
|
+
for (let at = command; at?.parent; at = at.parent)
|
|
442
|
+
words.unshift(at.name());
|
|
443
|
+
return words.join(" ");
|
|
444
|
+
}, "commandPath");
|
|
445
|
+
var listQuery = /* @__PURE__ */ __name((text, registry, command) => {
|
|
446
|
+
const context = { command, guide: LIST_QUERY_GUIDE };
|
|
447
|
+
const typed = text.trim() === "" ? void 0 : parseLucene(text, { defaultField: "none", ...context });
|
|
448
|
+
if (typed)
|
|
449
|
+
validateQuery(typed, registry, context);
|
|
450
|
+
const named = typed ? fieldsNamed(typed) : /* @__PURE__ */ new Set();
|
|
451
|
+
const defaults = (registry.defaults ?? []).filter((term) => !named.has(term.replace(/^-/, "").split(/[:<>=]/)[0] ?? "")).map((term) => parseLucene(term, { defaultField: "none", ...context }).root);
|
|
452
|
+
const roots = [...typed ? [typed.root] : [], ...defaults];
|
|
453
|
+
if (roots.length === 0)
|
|
454
|
+
return void 0;
|
|
455
|
+
if (roots.length === 1 && typed)
|
|
456
|
+
return typed;
|
|
457
|
+
return {
|
|
458
|
+
version: 1,
|
|
459
|
+
language: "lucene-v1",
|
|
460
|
+
root: {
|
|
461
|
+
kind: "boolean",
|
|
462
|
+
clauses: roots.map((node) => ({ occur: "must", node })),
|
|
463
|
+
span: { start: 0, end: text.length }
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
}, "listQuery");
|
|
467
|
+
var typedQuery = /* @__PURE__ */ __name((words) => typeof words === "string" ? words : (words ?? []).join(" "), "typedQuery");
|
|
468
|
+
var EVERY = Number.MAX_SAFE_INTEGER - 1;
|
|
469
|
+
var pageOf = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { limit: EVERY, offset: 0 } : { limit, offset: (page - 1) * limit }, "pageOf");
|
|
470
|
+
var pagedList = /* @__PURE__ */ __name((command, { limit, page, all }, { items, has_more, ...rest }) => listOf(command, {
|
|
471
|
+
...rest,
|
|
472
|
+
items,
|
|
473
|
+
limit: all ? Math.max(1, items.length) : limit,
|
|
474
|
+
has_more: all ? false : has_more,
|
|
475
|
+
page
|
|
476
|
+
}), "pagedList");
|
|
477
|
+
var askable = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "askable");
|
|
478
|
+
var queryArgument = /* @__PURE__ */ __name((registry) => {
|
|
479
|
+
const fields = askable(registry);
|
|
480
|
+
return optional(pipe(string(), maxLength(QUERY_LIMITS.bytes), description(fields.length === 0 ? "field:value terms; this list filters by none yet, so any term is refused" : `${registry.backend === "native" ? "field:value terms joined by AND that narrow the list" : "field:value terms that narrow the list (Lucene: AND OR NOT, [a TO b], > <)"}; fields: ${fields.map((field) => field.name).join(", ")}; e.g. ${fields[0]?.example ?? ""}`)));
|
|
481
|
+
}, "queryArgument");
|
|
482
|
+
var nativeTerms = /* @__PURE__ */ __name((ast, command) => {
|
|
483
|
+
const terms = /* @__PURE__ */ new Map();
|
|
484
|
+
if (!ast)
|
|
485
|
+
return terms;
|
|
486
|
+
const context = { command, guide: LIST_QUERY_GUIDE };
|
|
487
|
+
const add = /* @__PURE__ */ __name((node) => {
|
|
488
|
+
if (node.kind === "boolean") {
|
|
489
|
+
for (const clause of node.clauses) {
|
|
490
|
+
if (clause.occur !== "must")
|
|
491
|
+
queryError("query.unsupported-placement", clause.node.span, "this list takes only field:value terms joined by AND", context);
|
|
492
|
+
add(clause.node);
|
|
493
|
+
}
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
if (terms.has(node.field))
|
|
497
|
+
queryError("query.unsupported-placement", node.span, `${node.field} only once here`, context);
|
|
498
|
+
terms.set(node.field, node);
|
|
499
|
+
}, "add");
|
|
500
|
+
add(ast.root);
|
|
501
|
+
return terms;
|
|
502
|
+
}, "nativeTerms");
|
|
503
|
+
var queryTerms = /* @__PURE__ */ __name((words, registry, command) => {
|
|
504
|
+
const terms = /* @__PURE__ */ new Map();
|
|
505
|
+
for (const [field, node] of nativeTerms(listQuery(typedQuery(words), registry, command), command)) {
|
|
506
|
+
if (node.operator !== "term" && node.operator !== "phrase")
|
|
507
|
+
queryError("query.unsupported-placement", node.span, `${field} takes one whole value here`, {
|
|
508
|
+
command,
|
|
509
|
+
guide: LIST_QUERY_GUIDE
|
|
510
|
+
});
|
|
511
|
+
const enumerated = registry.fields.find(({ name }) => name === field)?.type === "enum";
|
|
512
|
+
terms.set(field, enumerated ? node.value.toLowerCase() : node.value);
|
|
513
|
+
}
|
|
514
|
+
return terms;
|
|
515
|
+
}, "queryTerms");
|
|
516
|
+
var timeBounds = /* @__PURE__ */ __name((term, zone = timezoneOf()) => {
|
|
517
|
+
if (!term)
|
|
518
|
+
return {};
|
|
519
|
+
const upper = term.operator === "range" ? term.upper ?? "*" : term.value;
|
|
520
|
+
const range = dateRange(term.value, upper, term.operator === "range" ? term.lower_inclusive !== false : true, term.operator === "range" ? term.upper_inclusive !== false : true, zone, term.span);
|
|
521
|
+
const until = range.upper === void 0 ? void 0 : range.upper - (range.upper_inclusive ? 0 : 1);
|
|
522
|
+
return {
|
|
523
|
+
...range.lower === void 0 ? {} : { since: range.lower },
|
|
524
|
+
...until === void 0 ? {} : { until },
|
|
525
|
+
meta: {
|
|
526
|
+
timezone: zone,
|
|
527
|
+
window: {
|
|
528
|
+
...range.lower === void 0 ? {} : { since: new Date(range.lower).toISOString() },
|
|
529
|
+
...until === void 0 ? {} : { until: new Date(until).toISOString() }
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
}, "timeBounds");
|
|
534
|
+
var searchText = /* @__PURE__ */ __name((term) => term === void 0 ? void 0 : term.value.replace(/^\*+|\*+$/g, ""), "searchText");
|
|
535
|
+
var nativeField = /* @__PURE__ */ __name((field) => ({ ...field, native: true }), "nativeField");
|
|
536
|
+
var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativeField({
|
|
537
|
+
name,
|
|
538
|
+
type,
|
|
539
|
+
operators: OPERATORS_BY_TYPE[type].filter((operator) => operator === "term" || operator === "phrase"),
|
|
540
|
+
example,
|
|
541
|
+
...more
|
|
542
|
+
}), "termField");
|
|
543
|
+
var queryHelp = /* @__PURE__ */ __name((registry) => `
|
|
544
|
+
${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
|
|
545
|
+
|
|
546
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/cli/paging.js
|
|
547
|
+
var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
|
|
548
|
+
if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
|
|
549
|
+
throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
|
|
550
|
+
return Number(value);
|
|
551
|
+
}, "positiveCount");
|
|
552
|
+
var withPaging = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")).option("--all", "every row, no paging"), "withPaging");
|
|
553
|
+
var window = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
|
|
554
|
+
|
|
555
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
|
|
556
|
+
var defined = /* @__PURE__ */ __name((record2) => Object.fromEntries(Object.entries(record2).filter(([, value]) => value !== void 0)), "defined");
|
|
557
|
+
var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
|
|
558
|
+
var settingsOf = /* @__PURE__ */ __name((settings) => defined({
|
|
559
|
+
all_can_pin: settings.allCanPin,
|
|
560
|
+
only_admins_add: settings.onlyAdminsAdd,
|
|
561
|
+
only_admins_call: settings.onlyAdminsCall,
|
|
562
|
+
only_owner_edits_info: settings.onlyOwnerEditsInfo,
|
|
563
|
+
members_see_link: settings.membersSeeLink,
|
|
564
|
+
join_approval: settings.joinApproval,
|
|
565
|
+
only_admins_send: settings.onlyAdminsSend,
|
|
566
|
+
only_admins_edit_info: settings.onlyAdminsEditInfo,
|
|
567
|
+
disappearing_seconds: settings.disappearingSeconds
|
|
568
|
+
}), "settingsOf");
|
|
569
|
+
var chatAnswer = /* @__PURE__ */ __name((account, chat) => defined({
|
|
570
|
+
ref: chatRef(account, chat.id),
|
|
571
|
+
id: chat.id,
|
|
572
|
+
title: chat.title,
|
|
573
|
+
kind: chat.kind,
|
|
574
|
+
unread_count: chat.unreadCount,
|
|
575
|
+
unread_mentions: chat.unreadMentions,
|
|
576
|
+
last_message_at: chat.lastMessageAt,
|
|
577
|
+
participants_count: chat.participantsCount,
|
|
578
|
+
muted: chat.muted,
|
|
579
|
+
muted_until: chat.mutedUntil ?? void 0,
|
|
580
|
+
archived: chat.archived,
|
|
581
|
+
marked_unread: chat.markedUnread,
|
|
582
|
+
membership_state: chat.membershipState,
|
|
583
|
+
parent_chat_id: chat.parentChatId ?? void 0,
|
|
584
|
+
scope: chat.scope,
|
|
585
|
+
provider_metadata: chat.providerMetadata,
|
|
586
|
+
description: chat.description,
|
|
587
|
+
invite_link: chat.link,
|
|
588
|
+
settings: chat.settings ? settingsOf(chat.settings) : void 0,
|
|
589
|
+
members: chat.members?.map(memberAnswer)
|
|
590
|
+
}), "chatAnswer");
|
|
591
|
+
var memberAnswer = /* @__PURE__ */ __name((member) => {
|
|
592
|
+
const group = member;
|
|
593
|
+
return defined({
|
|
594
|
+
id: member.id,
|
|
595
|
+
name: member.name,
|
|
596
|
+
username: member.username,
|
|
597
|
+
role: group.role,
|
|
598
|
+
last_seen_at: group.lastSeenAt,
|
|
599
|
+
registered_at: group.registeredAt,
|
|
600
|
+
joined_at: group.joinedAt,
|
|
601
|
+
invited_by: group.invitedBy,
|
|
602
|
+
is_bot: group.isBot,
|
|
603
|
+
deleted: group.deleted,
|
|
604
|
+
flagged: group.flagged,
|
|
605
|
+
has_photo: group.hasPhoto,
|
|
606
|
+
score: group.score,
|
|
607
|
+
reasons: group.reasons,
|
|
608
|
+
check: group.check ? snakeKeys(group.check) : void 0
|
|
609
|
+
});
|
|
610
|
+
}, "memberAnswer");
|
|
611
|
+
var contactRef = /* @__PURE__ */ __name((provider, id) => formatReference({ type: "contact", provider, id }), "contactRef");
|
|
612
|
+
var contactAnswer = /* @__PURE__ */ __name((account, contact) => {
|
|
613
|
+
const card = contact;
|
|
614
|
+
return defined({
|
|
615
|
+
ref: contactRef(account.provider, contact.id),
|
|
616
|
+
id: contact.id,
|
|
617
|
+
name: contact.name,
|
|
618
|
+
username: contact.username,
|
|
619
|
+
alias: contact.alias,
|
|
620
|
+
display_name: contact.displayName,
|
|
621
|
+
description: contact.description,
|
|
622
|
+
last_messaged_at: contact.lastMessagedAt,
|
|
623
|
+
chats: card.chats?.map((chat) => ({
|
|
624
|
+
ref: chatRef(account, chat.id),
|
|
625
|
+
id: chat.id,
|
|
626
|
+
title: chat.title,
|
|
627
|
+
kind: chat.kind,
|
|
628
|
+
last_message_at: chat.lastMessageAt
|
|
629
|
+
})),
|
|
630
|
+
notes: card.notes?.map(({ id, text, revision, createdAt, updatedAt }) => ({
|
|
631
|
+
id,
|
|
632
|
+
text,
|
|
633
|
+
revision,
|
|
634
|
+
created_at: createdAt,
|
|
635
|
+
updated_at: updatedAt
|
|
636
|
+
}))
|
|
637
|
+
});
|
|
638
|
+
}, "contactAnswer");
|
|
639
|
+
var chatEventAnswer = /* @__PURE__ */ __name((chatId, event) => defined({
|
|
640
|
+
chat_id: chatId,
|
|
641
|
+
time: event.timestamp,
|
|
642
|
+
type: event.event,
|
|
643
|
+
message_id: event.messageId,
|
|
644
|
+
by: event.by,
|
|
645
|
+
people: event.people,
|
|
646
|
+
title: event.title
|
|
647
|
+
}), "chatEventAnswer");
|
|
648
|
+
var HISTORY_TYPES = { joined: "join", left: "leave", changed: "profile" };
|
|
649
|
+
var memberEventAnswer = /* @__PURE__ */ __name((chatId, event) => defined({
|
|
650
|
+
chat_id: chatId,
|
|
651
|
+
time: event.at,
|
|
652
|
+
type: HISTORY_TYPES[event.event],
|
|
653
|
+
by: event.invitedBy === void 0 ? void 0 : { id: event.invitedBy, name: null },
|
|
654
|
+
people: [{ id: event.id, name: event.name, username: event.username }],
|
|
655
|
+
before: event.before ? { name: event.before.name, username: event.before.username } : void 0
|
|
656
|
+
}), "memberEventAnswer");
|
|
657
|
+
var inviteLinkAnswer = /* @__PURE__ */ __name((link) => defined({
|
|
658
|
+
link: link.link,
|
|
659
|
+
approval: link.approval,
|
|
660
|
+
expires_at: link.expiresAt,
|
|
661
|
+
max_uses: link.maxUses,
|
|
662
|
+
primary: link.primary,
|
|
663
|
+
revoked: link.revoked,
|
|
664
|
+
pending_count: link.pending,
|
|
665
|
+
joined_count: link.joined
|
|
666
|
+
}), "inviteLinkAnswer");
|
|
667
|
+
var joinRequestAnswer = /* @__PURE__ */ __name((request) => defined({
|
|
668
|
+
person_id: request.person.id,
|
|
669
|
+
name: request.person.name,
|
|
670
|
+
username: request.person.username,
|
|
671
|
+
requested_at: request.requestedAt,
|
|
672
|
+
about: request.about
|
|
673
|
+
}), "joinRequestAnswer");
|
|
674
|
+
var pollVoteAnswer = /* @__PURE__ */ __name((vote) => ({
|
|
675
|
+
person_id: vote.person.id,
|
|
676
|
+
name: vote.person.name,
|
|
677
|
+
username: vote.person.username,
|
|
678
|
+
answers: vote.answers,
|
|
679
|
+
voted_at: vote.votedAt
|
|
680
|
+
}), "pollVoteAnswer");
|
|
681
|
+
var topicAnswer = /* @__PURE__ */ __name((topic) => defined({
|
|
682
|
+
id: topic.id,
|
|
683
|
+
title: topic.title,
|
|
684
|
+
closed: topic.closed,
|
|
685
|
+
pinned: topic.pinned,
|
|
686
|
+
hidden: topic.hidden,
|
|
687
|
+
unread_count: topic.unreadCount,
|
|
688
|
+
last_message_at: topic.lastMessageAt,
|
|
689
|
+
created_at: topic.createdAt,
|
|
690
|
+
untrusted: ["title"]
|
|
691
|
+
}), "topicAnswer");
|
|
692
|
+
var folderAnswer = /* @__PURE__ */ __name((folder) => {
|
|
693
|
+
const shown = "chats" in folder ? folder : void 0;
|
|
694
|
+
const listed2 = shown ? void 0 : folder;
|
|
695
|
+
return defined({
|
|
696
|
+
id: folder.id,
|
|
697
|
+
title: folder.title,
|
|
698
|
+
chat_ids: listed2 ? listed2.chatIds : shown?.chats.map((chat) => chat.id) ?? [],
|
|
699
|
+
emoji: folder.emoji,
|
|
700
|
+
include: folder.include,
|
|
701
|
+
skip: folder.skip,
|
|
702
|
+
excluded_chat_ids: listed2?.excludedChatIds ?? shown?.excluded.map((chat) => chat.id),
|
|
703
|
+
pinned_chat_ids: listed2?.pinnedChatIds ?? shown?.pinned.map((chat) => chat.id),
|
|
704
|
+
chats: shown?.chats,
|
|
705
|
+
pinned_chats: shown?.pinned,
|
|
706
|
+
excluded_chats: shown?.excluded
|
|
707
|
+
});
|
|
708
|
+
}, "folderAnswer");
|
|
709
|
+
var lines = /* @__PURE__ */ __name((line) => (body) => (body.items ?? (body.item === void 0 ? [] : [body.item])).map((item) => `${line(item).trimEnd()}
|
|
710
|
+
`).join(""), "lines");
|
|
711
|
+
var pageOf2 = /* @__PURE__ */ __name(({ limit, page, all }, { items, hasMore }) => all ? { limit: Math.max(1, items.length), has_more: false, page: 1 } : { limit, has_more: hasMore, page }, "pageOf");
|
|
712
|
+
var wholeList = /* @__PURE__ */ __name((command, items, extra = {}) => listOf(command, { items, limit: Math.max(1, items.length), has_more: false, ...extra }), "wholeList");
|
|
713
|
+
var chatShown = /* @__PURE__ */ __name((account, card) => {
|
|
714
|
+
const listed2 = card.members?.length;
|
|
715
|
+
const short = listed2 !== void 0 && card.participantsCount !== null && listed2 < card.participantsCount;
|
|
716
|
+
return itemOf(chatAnswer(account, card), short ? {
|
|
717
|
+
missing: [
|
|
718
|
+
{
|
|
719
|
+
field: "members",
|
|
720
|
+
why: `${listed2} listed; the chat reports ${card.participantsCount} \u2014 the list may omit your account or be partial`,
|
|
721
|
+
step: "chats.members"
|
|
722
|
+
}
|
|
723
|
+
],
|
|
724
|
+
next: [nextStep("chats.members", { args: { chat: card.id } })]
|
|
725
|
+
} : {});
|
|
726
|
+
}, "chatShown");
|
|
727
|
+
var scoreFloor = /* @__PURE__ */ __name((ast) => {
|
|
728
|
+
const term = nativeTerms(ast, "chats members check").get("score");
|
|
729
|
+
if (!term)
|
|
730
|
+
return AUDIT_MIN_SCORE;
|
|
731
|
+
const upper = term.operator === "range" ? term.upper ?? "*" : term.value;
|
|
732
|
+
if (term.operator !== "range" || upper !== "*")
|
|
733
|
+
queryError("query.unsupported-operator", term.span, "score takes a lower bound: score>=3", {
|
|
734
|
+
command: "chats members check",
|
|
735
|
+
guide: LIST_QUERY_GUIDE
|
|
736
|
+
});
|
|
737
|
+
const floor = Number(term.value);
|
|
738
|
+
return Math.ceil(term.lower_inclusive === false ? floor + 1 : floor);
|
|
739
|
+
}, "scoreFloor");
|
|
740
|
+
var auditAnswer = /* @__PURE__ */ __name((audit) => wholeList("chats members check", audit.items.map(memberAnswer), {
|
|
741
|
+
...audit.more ? { meta: { truncated: true } } : {},
|
|
742
|
+
...audit.completeness && audit.completeness.state !== "complete" ? {
|
|
743
|
+
missing: [
|
|
744
|
+
{
|
|
745
|
+
field: "reasons",
|
|
746
|
+
why: "never_wrote counts only stored messages, and the store does not hold the chat whole",
|
|
747
|
+
...audit.fetch ? { step: "messages.sync" } : {}
|
|
748
|
+
}
|
|
749
|
+
],
|
|
750
|
+
...audit.fetch ? { next: [nextStep("messages.sync", { args: { chat: audit.chatId } })] } : {}
|
|
751
|
+
} : {}
|
|
752
|
+
}), "auditAnswer");
|
|
753
|
+
var renderItem = /* @__PURE__ */ __name((command, output, value, next = []) => renderAnswer(command, output, itemOf(snakeKeys(value), { next })), "renderItem");
|
|
754
|
+
var withPage = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")), "withPage");
|
|
755
|
+
var documentLinkAnswer = /* @__PURE__ */ __name(({ url, documentId, title, inStore, locator, sentAt, sender }) => ({
|
|
756
|
+
url,
|
|
757
|
+
document_id: documentId,
|
|
758
|
+
title,
|
|
759
|
+
in_store: inStore,
|
|
760
|
+
ref: locator,
|
|
761
|
+
sent_at: sentAt,
|
|
762
|
+
sender
|
|
763
|
+
}), "documentLinkAnswer");
|
|
764
|
+
var accountAnswer = /* @__PURE__ */ __name((provider, { id, name, username, phone }) => ({
|
|
765
|
+
provider,
|
|
766
|
+
id,
|
|
767
|
+
name,
|
|
768
|
+
username,
|
|
769
|
+
...phone === void 0 ? {} : { phone }
|
|
770
|
+
}), "accountAnswer");
|
|
771
|
+
var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location, lastActiveAt, createdAt }) => ({
|
|
772
|
+
current,
|
|
773
|
+
client,
|
|
774
|
+
device,
|
|
775
|
+
location,
|
|
776
|
+
last_active_at: lastActiveAt,
|
|
777
|
+
...createdAt === void 0 ? {} : { created_at: createdAt }
|
|
778
|
+
}), "sessionAnswer");
|
|
779
|
+
|
|
780
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/background/relay.js
|
|
781
|
+
import { createHash } from "node:crypto";
|
|
782
|
+
import { chmodSync, lstatSync, mkdirSync, rmSync } from "node:fs";
|
|
783
|
+
import { createConnection, createServer } from "node:net";
|
|
784
|
+
import { tmpdir } from "node:os";
|
|
785
|
+
import { dirname, isAbsolute, join } from "node:path";
|
|
786
|
+
import { PassThrough, Writable } from "node:stream";
|
|
787
|
+
var RELAY_PROTOCOL = 1;
|
|
788
|
+
var requestSchema = strictObject({
|
|
789
|
+
argv: array(string()),
|
|
790
|
+
env: record(string(), string()),
|
|
791
|
+
cwd: pipe(string(), check((path) => isAbsolute(path))),
|
|
792
|
+
tty: boolean(),
|
|
793
|
+
stdinTty: boolean()
|
|
794
|
+
});
|
|
795
|
+
var MAX_CLIENT_LINE = 1024 * 1024;
|
|
796
|
+
var MAX_SERVE_LINE = 64 * 1024 * 1024;
|
|
797
|
+
var MAX_SOCKET_PATH = 100;
|
|
798
|
+
var relayPath = /* @__PURE__ */ __name((lockPath) => {
|
|
799
|
+
const beside = lockPath.replace(/\.lock$/, ".sock");
|
|
800
|
+
if (beside.length <= MAX_SOCKET_PATH)
|
|
801
|
+
return beside;
|
|
802
|
+
const hash = createHash("sha256").update(beside).digest("hex").slice(0, 16);
|
|
803
|
+
const name = join(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash}.sock`);
|
|
804
|
+
const temporary = join(tmpdir(), name);
|
|
805
|
+
if (temporary.length <= MAX_SOCKET_PATH || process.platform === "win32")
|
|
806
|
+
return temporary;
|
|
807
|
+
return join("/tmp", name);
|
|
808
|
+
}, "relayPath");
|
|
809
|
+
var privateDirectory = /* @__PURE__ */ __name((dir) => {
|
|
810
|
+
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
811
|
+
const stat = lstatSync(dir);
|
|
812
|
+
const mine = process.getuid === void 0 || stat.uid === process.getuid();
|
|
813
|
+
if (!stat.isDirectory() || !mine || (stat.mode & 63) !== 0) {
|
|
814
|
+
throw new CliError("permission_error", `${dir} is not a private directory, so serve does not listen there`);
|
|
815
|
+
}
|
|
816
|
+
}, "privateDirectory");
|
|
817
|
+
var lines2 = /* @__PURE__ */ __name((socket, max, onLine, onTooLong) => {
|
|
818
|
+
let buffered = "";
|
|
819
|
+
socket.setEncoding("utf8");
|
|
820
|
+
socket.on("data", (chunk) => {
|
|
821
|
+
buffered += chunk;
|
|
822
|
+
for (let end = buffered.indexOf("\n"); end >= 0; end = buffered.indexOf("\n")) {
|
|
823
|
+
const line = buffered.slice(0, end);
|
|
824
|
+
buffered = buffered.slice(end + 1);
|
|
825
|
+
if (line)
|
|
826
|
+
onLine(line);
|
|
827
|
+
}
|
|
828
|
+
if (buffered.length > max)
|
|
829
|
+
onTooLong();
|
|
830
|
+
});
|
|
831
|
+
}, "lines");
|
|
832
|
+
var frame = /* @__PURE__ */ __name((socket, value) => {
|
|
833
|
+
if (!socket.destroyed)
|
|
834
|
+
socket.write(`${JSON.stringify(value)}
|
|
835
|
+
`);
|
|
836
|
+
}, "frame");
|
|
837
|
+
var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
|
|
838
|
+
privateDirectory(dirname(path));
|
|
839
|
+
rmSync(path, { force: true });
|
|
840
|
+
const open = /* @__PURE__ */ new Set();
|
|
841
|
+
const running = /* @__PURE__ */ new Set();
|
|
842
|
+
const server = createServer((socket) => {
|
|
843
|
+
open.add(socket);
|
|
844
|
+
const stop = new AbortController();
|
|
845
|
+
const stdin = new PassThrough();
|
|
846
|
+
let started = false;
|
|
847
|
+
socket.on("error", () => {
|
|
848
|
+
});
|
|
849
|
+
socket.on("close", () => {
|
|
850
|
+
open.delete(socket);
|
|
851
|
+
stop.abort(new CliError("cancelled", "the client went away", { retryable: false }));
|
|
852
|
+
if (!stdin.writableEnded)
|
|
853
|
+
stdin.end();
|
|
854
|
+
});
|
|
855
|
+
lines2(socket, MAX_CLIENT_LINE, (line) => {
|
|
856
|
+
let message;
|
|
857
|
+
try {
|
|
858
|
+
message = JSON.parse(line);
|
|
859
|
+
} catch {
|
|
860
|
+
socket.destroy();
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
if (!started) {
|
|
864
|
+
started = true;
|
|
865
|
+
if (message.v !== RELAY_PROTOCOL) {
|
|
866
|
+
frame(socket, { diagnostic: `serve speaks relay protocol ${RELAY_PROTOCOL}; restart it`, exit: 1 });
|
|
867
|
+
socket.end();
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
const parsed = safeParse(requestSchema, message.run);
|
|
871
|
+
if (!parsed.success) {
|
|
872
|
+
socket.destroy();
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
stdin.isTTY = parsed.output.stdinTty;
|
|
876
|
+
if (parsed.output.stdinTty)
|
|
877
|
+
stdin.end();
|
|
878
|
+
const job = serve(socket, parsed.output, stdin, stop.signal, run);
|
|
879
|
+
running.add(job);
|
|
880
|
+
void job.then(() => running.delete(job), () => running.delete(job));
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
if (typeof message.stdin === "string" && !stdin.writableEnded)
|
|
884
|
+
stdin.write(Buffer.from(message.stdin, "base64"));
|
|
885
|
+
if (message.stdinEnd === true && !stdin.writableEnded)
|
|
886
|
+
stdin.end();
|
|
887
|
+
}, () => socket.destroy());
|
|
888
|
+
});
|
|
889
|
+
await new Promise((resolve, reject) => {
|
|
890
|
+
server.once("error", reject);
|
|
891
|
+
server.listen(path, () => {
|
|
892
|
+
server.off("error", reject);
|
|
893
|
+
resolve();
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
chmodSync(path, 384);
|
|
897
|
+
return {
|
|
898
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
899
|
+
for (const socket of open)
|
|
900
|
+
socket.destroy();
|
|
901
|
+
await new Promise((resolve) => server.close(() => resolve()));
|
|
902
|
+
await Promise.allSettled(running);
|
|
903
|
+
rmSync(path, { force: true });
|
|
904
|
+
}, "close")
|
|
905
|
+
};
|
|
906
|
+
}, "listenRelay");
|
|
907
|
+
var serve = /* @__PURE__ */ __name(async (socket, request, stdin, signal, run) => {
|
|
908
|
+
const streams = {
|
|
909
|
+
data: /* @__PURE__ */ __name((text) => frame(socket, { data: text }), "data"),
|
|
910
|
+
diagnostic: /* @__PURE__ */ __name((text) => frame(socket, { diagnostic: text }), "diagnostic"),
|
|
911
|
+
progress: /* @__PURE__ */ __name((text) => frame(socket, { progress: text }), "progress")
|
|
912
|
+
};
|
|
913
|
+
const stdout = new Writable({
|
|
914
|
+
write: /* @__PURE__ */ __name((chunk, _encoding, done) => {
|
|
915
|
+
frame(socket, { raw: Buffer.from(chunk).toString("base64") });
|
|
916
|
+
done();
|
|
917
|
+
}, "write")
|
|
918
|
+
});
|
|
919
|
+
let code = 1;
|
|
920
|
+
try {
|
|
921
|
+
code = await run(request, { streams, stdin, stdout, signal });
|
|
922
|
+
} finally {
|
|
923
|
+
frame(socket, { exit: code });
|
|
924
|
+
socket.end();
|
|
925
|
+
}
|
|
926
|
+
}, "serve");
|
|
927
|
+
var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promise((resolve, reject) => {
|
|
928
|
+
const { streams, stdin, stdout, signal, deadlineMs, writes, holder, listens = false } = options;
|
|
929
|
+
const socket = createConnection(path);
|
|
930
|
+
let connected = false;
|
|
931
|
+
let settled = false;
|
|
932
|
+
let timer;
|
|
933
|
+
const forward = /* @__PURE__ */ __name((chunk) => frame(socket, { stdin: Buffer.from(chunk).toString("base64") }), "forward");
|
|
934
|
+
const ended = /* @__PURE__ */ __name(() => frame(socket, { stdinEnd: true }), "ended");
|
|
935
|
+
const brokenPipe = /* @__PURE__ */ __name((error) => {
|
|
936
|
+
if (error.code === "EPIPE")
|
|
937
|
+
finish({ code: 0 });
|
|
938
|
+
}, "brokenPipe");
|
|
939
|
+
const finish = /* @__PURE__ */ __name((outcome) => {
|
|
940
|
+
if (settled)
|
|
941
|
+
return;
|
|
942
|
+
settled = true;
|
|
943
|
+
if (timer)
|
|
944
|
+
clearTimeout(timer);
|
|
945
|
+
stdout.off("error", brokenPipe);
|
|
946
|
+
signal.removeEventListener("abort", aborted);
|
|
947
|
+
stdin.off("data", forward).off("end", ended);
|
|
948
|
+
stdin.pause();
|
|
949
|
+
socket.destroy();
|
|
950
|
+
if ("code" in outcome)
|
|
951
|
+
resolve(outcome.code);
|
|
952
|
+
else
|
|
953
|
+
reject(outcome.error);
|
|
954
|
+
}, "finish");
|
|
955
|
+
const stopped = /* @__PURE__ */ __name(() => writes ? new CliError("outcome_unknown", `${holder} stopped before the command finished; it may have run \u2014 check before repeating it`, { retryable: false }) : new CliError("provider_unavailable", `${holder} stopped before the command finished`, { retryable: true }), "stopped");
|
|
956
|
+
const aborted = /* @__PURE__ */ __name(() => finish(listens ? { code: 0 } : { error: signal.reason }), "aborted");
|
|
957
|
+
if (signal.aborted)
|
|
958
|
+
return aborted();
|
|
959
|
+
signal.addEventListener("abort", aborted, { once: true });
|
|
960
|
+
stdout.on("error", brokenPipe);
|
|
961
|
+
if (deadlineMs !== void 0)
|
|
962
|
+
timer = setTimeout(() => finish({ error: stopped() }), deadlineMs);
|
|
963
|
+
socket.on("connect", () => {
|
|
964
|
+
connected = true;
|
|
965
|
+
frame(socket, { v: RELAY_PROTOCOL, run: request });
|
|
966
|
+
if (request.stdinTty)
|
|
967
|
+
ended();
|
|
968
|
+
else {
|
|
969
|
+
stdin.on("data", forward).once("end", ended);
|
|
970
|
+
stdin.resume();
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
socket.on("error", (error) => {
|
|
974
|
+
if (connected)
|
|
975
|
+
return finish({ error: stopped() });
|
|
976
|
+
finish({
|
|
977
|
+
error: new CliError("provider_unavailable", `${holder} holds the connection but does not answer its relay (${error.code ?? error.message}) \u2014 restart it`, { retryable: false, sent: false })
|
|
978
|
+
});
|
|
979
|
+
});
|
|
980
|
+
socket.on("close", () => finish({ error: stopped() }));
|
|
981
|
+
lines2(socket, MAX_SERVE_LINE, (line) => {
|
|
982
|
+
let message;
|
|
983
|
+
try {
|
|
984
|
+
message = JSON.parse(line);
|
|
985
|
+
} catch {
|
|
986
|
+
return finish({ error: stopped() });
|
|
987
|
+
}
|
|
988
|
+
if (typeof message.data === "string")
|
|
989
|
+
streams.data(message.data);
|
|
990
|
+
if (typeof message.diagnostic === "string")
|
|
991
|
+
streams.diagnostic(message.diagnostic);
|
|
992
|
+
if (typeof message.progress === "string")
|
|
993
|
+
streams.progress?.(message.progress);
|
|
994
|
+
if (typeof message.raw === "string")
|
|
995
|
+
stdout.write(Buffer.from(message.raw, "base64"));
|
|
996
|
+
if (typeof message.exit === "number")
|
|
997
|
+
finish({ code: message.exit });
|
|
998
|
+
}, () => finish({ error: stopped() }));
|
|
999
|
+
}), "relayCommand");
|
|
1000
|
+
|
|
1001
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.469.0_@wirecat+cli-base@0.65.0_commander@15.0.0_typescript@7.0.2_vi_80b586dbc8b099637a6e461856c2ee6b/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
|
|
1002
|
+
var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
|
|
1003
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
1004
|
+
}, "close"),
|
|
1005
|
+
feed: void 0,
|
|
1006
|
+
storedChats: void 0,
|
|
1007
|
+
listen: void 0,
|
|
1008
|
+
listenHistory: void 0,
|
|
1009
|
+
...connection.watch && watchers ? {
|
|
1010
|
+
// A watcher that throws (its output limit, a closed reader) ends its own watch, never serve's.
|
|
1011
|
+
watch: /* @__PURE__ */ __name(async (onEvent, signal, onReady) => {
|
|
1012
|
+
let watcher;
|
|
1013
|
+
try {
|
|
1014
|
+
await new Promise((resolve, reject) => {
|
|
1015
|
+
watcher = /* @__PURE__ */ __name((event) => {
|
|
1016
|
+
try {
|
|
1017
|
+
onEvent(event);
|
|
1018
|
+
} catch (error) {
|
|
1019
|
+
reject(error);
|
|
1020
|
+
}
|
|
1021
|
+
}, "watcher");
|
|
1022
|
+
watchers.add(watcher);
|
|
1023
|
+
signal.addEventListener("abort", () => resolve(), { once: true });
|
|
1024
|
+
onReady?.();
|
|
1025
|
+
if (signal.aborted)
|
|
1026
|
+
resolve();
|
|
1027
|
+
});
|
|
1028
|
+
} finally {
|
|
1029
|
+
if (watcher)
|
|
1030
|
+
watchers.delete(watcher);
|
|
1031
|
+
}
|
|
1032
|
+
}, "watch")
|
|
1033
|
+
} : { watch: void 0 }
|
|
1034
|
+
}), "lentConnection");
|
|
1035
|
+
var serveRelay = /* @__PURE__ */ __name((command, messenger) => {
|
|
1036
|
+
let held;
|
|
1037
|
+
let relay;
|
|
1038
|
+
const watchers = /* @__PURE__ */ new Set();
|
|
1039
|
+
const borrowed = /* @__PURE__ */ __name(() => {
|
|
1040
|
+
const connection = held;
|
|
1041
|
+
if (!connection)
|
|
1042
|
+
throw new CliError("provider_unavailable", "serve is not connected yet", { retryable: true });
|
|
1043
|
+
return lentConnection(connection, watchers);
|
|
1044
|
+
}, "borrowed");
|
|
1045
|
+
return {
|
|
1046
|
+
messenger: {
|
|
1047
|
+
...messenger,
|
|
1048
|
+
connect: /* @__PURE__ */ __name(async (...args) => {
|
|
1049
|
+
held = await messenger.connect(...args);
|
|
1050
|
+
return held;
|
|
1051
|
+
}, "connect")
|
|
1052
|
+
},
|
|
1053
|
+
arrived: /* @__PURE__ */ __name((event) => {
|
|
1054
|
+
for (const watcher of watchers)
|
|
1055
|
+
watcher(event);
|
|
1056
|
+
}, "arrived"),
|
|
1057
|
+
/** Listens beside the lock; the address goes into it, which is how a client finds it. */
|
|
1058
|
+
open: /* @__PURE__ */ __name(async (lockPath, profile) => {
|
|
1059
|
+
const environment = environmentOf(command);
|
|
1060
|
+
const runCommand = environment.runCommand;
|
|
1061
|
+
if (!runCommand)
|
|
1062
|
+
return void 0;
|
|
1063
|
+
const readOnly = readOnlyLockOf(messenger.app, environment.env ?? process.env);
|
|
1064
|
+
const path = relayPath(lockPath);
|
|
1065
|
+
relay = await listenRelay(path, (request, io) => runCommand(request.argv, {
|
|
1066
|
+
env: {
|
|
1067
|
+
...request.env,
|
|
1068
|
+
...readOnly ? { [`${messenger.app.envPrefix}_READ_ONLY`]: "1" } : {}
|
|
1069
|
+
},
|
|
1070
|
+
streams: io.streams,
|
|
1071
|
+
stdin: io.stdin,
|
|
1072
|
+
stdout: io.stdout,
|
|
1073
|
+
tty: request.tty,
|
|
1074
|
+
signal: io.signal,
|
|
1075
|
+
answer: /* @__PURE__ */ __name(() => null, "answer"),
|
|
1076
|
+
relayed: { profile, cwd: request.cwd, connection: borrowed }
|
|
1077
|
+
}));
|
|
1078
|
+
return { path, protocol: RELAY_PROTOCOL };
|
|
1079
|
+
}, "open"),
|
|
1080
|
+
close: /* @__PURE__ */ __name(async () => {
|
|
1081
|
+
await relay?.close();
|
|
1082
|
+
}, "close")
|
|
1083
|
+
};
|
|
1084
|
+
}, "serveRelay");
|
|
1085
|
+
|
|
1086
|
+
export {
|
|
1087
|
+
COMMAND_NEEDS,
|
|
1088
|
+
lackedNeed,
|
|
1089
|
+
refuseLacking,
|
|
1090
|
+
hideNever,
|
|
1091
|
+
RELAY_PROTOCOL,
|
|
1092
|
+
relayCommand,
|
|
1093
|
+
lentConnection,
|
|
1094
|
+
serveRelay,
|
|
1095
|
+
meetingPassageRequest,
|
|
1096
|
+
createMeetingPassageCommand,
|
|
1097
|
+
addMeetingPassageCommand,
|
|
1098
|
+
addMeetingProjectEvidenceCommand,
|
|
1099
|
+
meetingHitSearchRequest,
|
|
1100
|
+
meetingSearchArguments,
|
|
1101
|
+
meetingSearchMeta,
|
|
1102
|
+
createMeetingSearchCommand,
|
|
1103
|
+
addMeetingCommands,
|
|
1104
|
+
LIST_QUERY_GUIDE,
|
|
1105
|
+
withQuery,
|
|
1106
|
+
unfilteredQuery,
|
|
1107
|
+
commandPath,
|
|
1108
|
+
listQuery,
|
|
1109
|
+
typedQuery,
|
|
1110
|
+
pageOf,
|
|
1111
|
+
pagedList,
|
|
1112
|
+
queryArgument,
|
|
1113
|
+
nativeTerms,
|
|
1114
|
+
queryTerms,
|
|
1115
|
+
timeBounds,
|
|
1116
|
+
searchText,
|
|
1117
|
+
nativeField,
|
|
1118
|
+
termField,
|
|
1119
|
+
queryHelp,
|
|
1120
|
+
positiveCount,
|
|
1121
|
+
withPaging,
|
|
1122
|
+
window,
|
|
1123
|
+
chatRef,
|
|
1124
|
+
chatAnswer,
|
|
1125
|
+
memberAnswer,
|
|
1126
|
+
contactRef,
|
|
1127
|
+
contactAnswer,
|
|
1128
|
+
chatEventAnswer,
|
|
1129
|
+
memberEventAnswer,
|
|
1130
|
+
inviteLinkAnswer,
|
|
1131
|
+
joinRequestAnswer,
|
|
1132
|
+
pollVoteAnswer,
|
|
1133
|
+
topicAnswer,
|
|
1134
|
+
folderAnswer,
|
|
1135
|
+
lines,
|
|
1136
|
+
pageOf2,
|
|
1137
|
+
wholeList,
|
|
1138
|
+
chatShown,
|
|
1139
|
+
scoreFloor,
|
|
1140
|
+
auditAnswer,
|
|
1141
|
+
renderItem,
|
|
1142
|
+
withPage,
|
|
1143
|
+
documentLinkAnswer,
|
|
1144
|
+
accountAnswer,
|
|
1145
|
+
sessionAnswer
|
|
1146
|
+
};
|