@dench.com/cli 3.12.21-staging.1360 → 3.12.22-staging.1371

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/meetings.ts CHANGED
@@ -56,6 +56,11 @@ const api = {
56
56
  "functions/meetings/library:listMeetings",
57
57
  ),
58
58
  },
59
+ search: {
60
+ searchTranscripts: makeFunctionReference<"query">(
61
+ "functions/meetings/search:searchMeetingTranscripts",
62
+ ),
63
+ },
59
64
  entries: {
60
65
  get: makeFunctionReference<"query">("functions/crm/entries:get"),
61
66
  },
@@ -135,6 +140,8 @@ export async function runMeetingsCommand(opts: {
135
140
  switch (subcommand) {
136
141
  case "list":
137
142
  return await runList(ctx);
143
+ case "search":
144
+ return await runSearch(ctx);
138
145
  case "get":
139
146
  return await runGet(ctx);
140
147
  case "recording":
@@ -235,6 +242,222 @@ async function runGet(ctx: CrmCliContext): Promise<void> {
235
242
  out(ctx, entry);
236
243
  }
237
244
 
245
+ // ── search ─────────────────────────────────────────────────────────────────
246
+
247
+ function parseCliDateBound(
248
+ raw: string | undefined,
249
+ flagName: string,
250
+ bound: "start" | "end",
251
+ ): number | undefined {
252
+ if (raw === undefined) return undefined;
253
+ const trimmed = raw.trim();
254
+ if (!trimmed) throw new CrmCliError(`${flagName} needs a date value.`);
255
+ if (/^\d{10,13}$/.test(trimmed)) {
256
+ const n = Number(trimmed);
257
+ return trimmed.length === 10 ? n * 1000 : n;
258
+ }
259
+ if (/^\d{4}-\d{2}-\d{2}$/.test(trimmed)) {
260
+ const parsed = Date.parse(
261
+ bound === "end" ? `${trimmed}T23:59:59.999Z` : `${trimmed}T00:00:00.000Z`,
262
+ );
263
+ if (Number.isFinite(parsed)) return parsed;
264
+ }
265
+ const parsed = parseDateMs(trimmed);
266
+ if (parsed === null || parsed === undefined) {
267
+ throw new CrmCliError(
268
+ `Invalid ${flagName} date "${raw}" (use YYYY-MM-DD or ISO-8601).`,
269
+ );
270
+ }
271
+ return parsed;
272
+ }
273
+
274
+ type MeetingSearchResponse = {
275
+ query: string;
276
+ expandedTerms: string[];
277
+ searchMode: "fuzzy" | "exact";
278
+ totalMeetings: number;
279
+ matchedSegments: number;
280
+ meetings: Array<{
281
+ meetingId: string;
282
+ title: string;
283
+ startedAt: number | null;
284
+ endedAt: number | null;
285
+ durationSeconds: number | null;
286
+ status: string | null;
287
+ outcome: string | null;
288
+ participants: string[];
289
+ sharedWithWorkspace: boolean;
290
+ matchCount: number;
291
+ topScore: number;
292
+ matchedIn: Array<"transcript" | "summary">;
293
+ summaryMatches: Array<{
294
+ field: string;
295
+ snippet: string;
296
+ matchType: string;
297
+ matchedTerm: string;
298
+ score: number;
299
+ }>;
300
+ transcriptMatches: Array<{
301
+ seq: number;
302
+ speakerName: string | null;
303
+ speakerEmail: string | null;
304
+ startMs: number;
305
+ endMs: number;
306
+ timestamp: string;
307
+ text: string;
308
+ matchType: string;
309
+ matchedTerm: string;
310
+ score: number;
311
+ contextBefore: Array<{
312
+ seq: number;
313
+ speakerName: string | null;
314
+ startMs: number;
315
+ timestamp: string;
316
+ text: string;
317
+ }>;
318
+ contextAfter: Array<{
319
+ seq: number;
320
+ speakerName: string | null;
321
+ startMs: number;
322
+ timestamp: string;
323
+ text: string;
324
+ }>;
325
+ }>;
326
+ }>;
327
+ };
328
+
329
+ function printSearchResult(result: MeetingSearchResponse): void {
330
+ if (result.meetings.length === 0) {
331
+ console.log(
332
+ `(no meetings matched "${result.query}" in ${result.searchMode} mode)`,
333
+ );
334
+ return;
335
+ }
336
+ console.log(
337
+ `Found ${result.totalMeetings} meeting${result.totalMeetings === 1 ? "" : "s"} (${result.matchedSegments} transcript hit${result.matchedSegments === 1 ? "" : "s"}, mode: ${result.searchMode})`,
338
+ );
339
+ for (const m of result.meetings) {
340
+ const date = m.startedAt
341
+ ? new Date(m.startedAt).toISOString().slice(0, 10)
342
+ : "unknown date";
343
+ const who =
344
+ m.participants.length > 0
345
+ ? ` | ${m.participants.slice(0, 5).join(", ")}`
346
+ : "";
347
+ console.log(`\n${m.title} (${date}${who})`);
348
+ console.log(` id: ${m.meetingId}`);
349
+ for (const s of m.summaryMatches) {
350
+ console.log(` [summary:${s.field}] ${s.snippet}`);
351
+ }
352
+ for (const hit of m.transcriptMatches) {
353
+ for (const prev of hit.contextBefore) {
354
+ const prevSpeaker = prev.speakerName ? `${prev.speakerName}: ` : "";
355
+ console.log(` [${prev.timestamp}] ${prevSpeaker}${prev.text}`);
356
+ }
357
+ const speaker = hit.speakerName ? `${hit.speakerName}: ` : "";
358
+ const tag =
359
+ hit.matchType === "exact"
360
+ ? ""
361
+ : ` (${hit.matchType}: ${hit.matchedTerm})`;
362
+ console.log(` > [${hit.timestamp}] ${speaker}${hit.text}${tag}`);
363
+ for (const next of hit.contextAfter) {
364
+ const nextSpeaker = next.speakerName ? `${next.speakerName}: ` : "";
365
+ console.log(` [${next.timestamp}] ${nextSpeaker}${next.text}`);
366
+ }
367
+ }
368
+ }
369
+ }
370
+
371
+ async function executeMeetingSearch(
372
+ ctx: CrmCliContext,
373
+ opts: {
374
+ forcedMeetingId?: string;
375
+ commandLabel: string;
376
+ },
377
+ ): Promise<void> {
378
+ const alsoMatch: string[] = [];
379
+ for (const flag of ["--or", "--also-match"]) {
380
+ let val = getFlag(ctx.args, flag);
381
+ while (val !== undefined) {
382
+ if (val.trim()) alsoMatch.push(val.trim());
383
+ val = getFlag(ctx.args, flag);
384
+ }
385
+ }
386
+ const meetingFlag = getFlag(ctx.args, "--meeting");
387
+ const speaker = getFlag(ctx.args, "--speaker");
388
+ const participant = getFlag(ctx.args, "--participant");
389
+ const afterRaw = getFlag(ctx.args, "--after");
390
+ const beforeRaw = getFlag(ctx.args, "--before");
391
+ const exact = hasFlag(ctx.args, "--exact");
392
+ const contextRaw = getFlag(ctx.args, "--context");
393
+ const limitRaw = getFlag(ctx.args, "--limit");
394
+ const hitsRaw = getFlag(ctx.args, "--hits");
395
+ assertNoUnknownFlags(ctx.args, opts.commandLabel);
396
+
397
+ const queryText = ctx.args.join(" ").trim();
398
+ if (!queryText) {
399
+ throw new CrmCliError(`Missing search query. Run \`dench meetings help\`.`);
400
+ }
401
+
402
+ const meetingEntryId = opts.forcedMeetingId ?? meetingFlag;
403
+ const afterMs = parseCliDateBound(afterRaw, "--after", "start");
404
+ const beforeMs = parseCliDateBound(beforeRaw, "--before", "end");
405
+
406
+ const contextLines =
407
+ contextRaw !== undefined ? Number(contextRaw) : undefined;
408
+ if (
409
+ contextLines !== undefined &&
410
+ (!Number.isInteger(contextLines) || contextLines < 0 || contextLines > 3)
411
+ ) {
412
+ throw new CrmCliError("--context must be an integer between 0 and 3.");
413
+ }
414
+
415
+ const limit = limitRaw !== undefined ? Number(limitRaw) : undefined;
416
+ if (
417
+ limit !== undefined &&
418
+ (!Number.isInteger(limit) || limit < 1 || limit > 50)
419
+ ) {
420
+ throw new CrmCliError("--limit must be an integer between 1 and 50.");
421
+ }
422
+
423
+ const maxHitsPerMeeting = hitsRaw !== undefined ? Number(hitsRaw) : undefined;
424
+ if (
425
+ maxHitsPerMeeting !== undefined &&
426
+ (!Number.isInteger(maxHitsPerMeeting) ||
427
+ maxHitsPerMeeting < 1 ||
428
+ maxHitsPerMeeting > 10)
429
+ ) {
430
+ throw new CrmCliError("--hits must be an integer between 1 and 10.");
431
+ }
432
+
433
+ const result = (await callQuery(ctx, api.search.searchTranscripts, {
434
+ query: queryText,
435
+ ...(alsoMatch.length > 0 ? { alsoMatch: alsoMatch.slice(0, 6) } : {}),
436
+ ...(meetingEntryId ? { meetingEntryId } : {}),
437
+ ...(speaker ? { speaker } : {}),
438
+ ...(participant ? { participant } : {}),
439
+ ...(afterMs !== undefined ? { afterMs } : {}),
440
+ ...(beforeMs !== undefined ? { beforeMs } : {}),
441
+ ...(exact ? { fuzzy: false } : {}),
442
+ ...(contextLines !== undefined ? { contextLines } : {}),
443
+ ...(limit !== undefined ? { limit } : {}),
444
+ ...(maxHitsPerMeeting !== undefined ? { maxHitsPerMeeting } : {}),
445
+ })) as MeetingSearchResponse;
446
+
447
+ if (ctx.jsonOutput) {
448
+ out(ctx, result);
449
+ return;
450
+ }
451
+ printSearchResult(result);
452
+ }
453
+
454
+ /**
455
+ * `dench meetings search <query> [--or <alt> ...] [--speaker <name>] [--participant <name>] [--meeting <id>] [--after <date>] [--before <date>] [--exact] [--context 0..3] [--limit N] [--hits N] [--json]`
456
+ */
457
+ async function runSearch(ctx: CrmCliContext): Promise<void> {
458
+ return await executeMeetingSearch(ctx, { commandLabel: "meetings search" });
459
+ }
460
+
238
461
  // ── recording ──────────────────────────────────────────────────────────────
239
462
 
240
463
  type MeetingRecordingPayload = {
@@ -476,17 +699,24 @@ async function runShare(ctx: CrmCliContext): Promise<void> {
476
699
  // ── transcript ─────────────────────────────────────────────────────────────
477
700
 
478
701
  async function runTranscript(ctx: CrmCliContext): Promise<void> {
479
- const verb = shift(ctx.args, "transcript verb (get|set|clear)");
702
+ const verb = shift(ctx.args, "transcript verb (get|search|set|clear)");
480
703
  switch (verb) {
481
704
  case "get":
482
705
  return await runTranscriptGet(ctx);
706
+ case "search": {
707
+ const meetingEntryId = shift(ctx.args, "meeting id");
708
+ return await executeMeetingSearch(ctx, {
709
+ forcedMeetingId: meetingEntryId,
710
+ commandLabel: "meetings transcript search",
711
+ });
712
+ }
483
713
  case "set":
484
714
  return await runTranscriptSet(ctx);
485
715
  case "clear":
486
716
  return await runTranscriptClear(ctx);
487
717
  default:
488
718
  throw new CrmCliError(
489
- `dench meetings transcript <get|set|clear> <meetingId> … (got "${verb}")`,
719
+ `dench meetings transcript <get|search|set|clear> <meetingId> … (got "${verb}")`,
490
720
  );
491
721
  }
492
722
  }
@@ -972,6 +1202,10 @@ meeting\`. These verbs add the parts that live beside the record:
972
1202
 
973
1203
  dench meetings list [--limit N | --all] [--shared] [--json]
974
1204
  Newest first; --limit defaults to 50, --all lists every meeting.
1205
+ dench meetings search <query> [--or <alt> ...] [--speaker <name>] [--participant <name>] [--meeting <id>] [--after <YYYY-MM-DD>] [--before <YYYY-MM-DD>] [--exact] [--context 0..3] [--limit N] [--hits N] [--json]
1206
+ Fast search across all readable meeting transcripts and summaries,
1207
+ with sound-alike / speech-to-text tolerant matching enabled by default
1208
+ (pass --exact for exact keywords only).
975
1209
  dench meetings get <meetingId> [--json]
976
1210
  dench meetings recording <meetingId> [--download <path>] [--audio] [--json]
977
1211
  Mint short-lived signed video (MP4) and audio URLs; pass --download
@@ -991,6 +1225,7 @@ Sharing:
991
1225
 
992
1226
  Transcript (meetingTranscriptSegments):
993
1227
  dench meetings transcript get <meetingId> [--json|--text]
1228
+ dench meetings transcript search <meetingId> <query> [--or <alt> ...] [--speaker <name>] [--exact] [--context 0..3] [--hits N] [--json]
994
1229
  dench meetings transcript set <meetingId> --text notes.txt | --jsonl segments.jsonl | --file segments.json [--append]
995
1230
  --text lines look like "[00:01:05] Speaker: what they said"; the
996
1231
  timestamp and the speaker are both optional. JSON rows carry
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.12.21-staging.1360",
3
+ "version": "3.12.22-staging.1371",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {