@wirecat/cli-core 0.662.0 → 0.663.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.
Files changed (173) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/dist/background/daily-archive-timer.d.ts +1 -1
  3. package/dist/calendar/cli/bodies.js +2 -1
  4. package/dist/calendar/cli/index.js +13 -10
  5. package/dist/calendar/mcp/index.d.ts +3 -1
  6. package/dist/calendar/mcp/index.js +4 -4
  7. package/dist/cli/call-stats-command.d.ts +18 -0
  8. package/dist/cli/call-stats-command.js +52 -0
  9. package/dist/cli/contract-templates.js +2 -0
  10. package/dist/cli/envelope.d.ts +0 -5
  11. package/dist/cli/envelope.js +25 -0
  12. package/dist/cli/index.d.ts +2 -1
  13. package/dist/cli/index.js +2 -1
  14. package/dist/cli/meeting-batch.d.ts +2 -1
  15. package/dist/cli/meeting-batch.js +7 -5
  16. package/dist/cli/meeting-preparation-command.js +5 -5
  17. package/dist/cli/meeting-preparation-read.d.ts +5 -5
  18. package/dist/cli/meeting-preparation-read.js +13 -21
  19. package/dist/cli/meeting-series-inventory-command.js +2 -2
  20. package/dist/cli/meeting-series-inventory-read.d.ts +2 -2
  21. package/dist/cli/meeting-series-inventory-read.js +7 -15
  22. package/dist/cli/messenger/admin-statistics-command.js +2 -2
  23. package/dist/cli/messenger/counters-command.js +2 -2
  24. package/dist/cli/messenger/media-archive-command.js +5 -4
  25. package/dist/cli/messenger/media-archive-move-command.js +1 -1
  26. package/dist/cli/messenger/media-archive-timer-command.js +5 -4
  27. package/dist/cli/messenger/metadata-command.js +3 -3
  28. package/dist/cli/messenger/rankings-command.js +3 -3
  29. package/dist/cli/messenger/tags-command.js +7 -2
  30. package/dist/cli/messenger/tasks-command.js +2 -2
  31. package/dist/cli/paging.d.ts +10 -0
  32. package/dist/cli/paging.js +29 -0
  33. package/dist/cli/runs/command.js +6 -4
  34. package/dist/cli/runs/search-command.js +9 -5
  35. package/dist/cli/schedule/schedule-command.js +1 -5
  36. package/dist/domain/moment.d.ts +29 -0
  37. package/dist/domain/moment.js +58 -0
  38. package/dist/domain/providers.d.ts +6 -4
  39. package/dist/domain/providers.js +10 -5
  40. package/dist/domain/send-time.d.ts +3 -4
  41. package/dist/domain/send-time.js +10 -24
  42. package/dist/entities/fields.d.ts +2 -2
  43. package/dist/entities/fields.js +2 -2
  44. package/dist/entities/index.d.ts +92 -1
  45. package/dist/entities/index.js +3 -2
  46. package/dist/entities/meeting.d.ts +1 -1
  47. package/dist/entities/meeting.js +1 -1
  48. package/dist/errors/reasons.js +0 -1
  49. package/dist/mail/cli/index.js +4 -2
  50. package/dist/mail/facts.d.ts +5 -2
  51. package/dist/mail/facts.js +6 -3
  52. package/dist/mail/index.d.ts +1 -1
  53. package/dist/mail/meeting-notes.js +1 -1
  54. package/dist/mail/probe.d.ts +5 -2
  55. package/dist/mail/probe.js +9 -5
  56. package/dist/mail/server-search.js +1 -1
  57. package/dist/mail/sync.js +1 -1
  58. package/dist/mcp/meeting-preparation.js +1 -1
  59. package/dist/mcp/meeting-series-inventory.js +1 -1
  60. package/dist/mcp/prompts.js +6 -9
  61. package/dist/meetings/call-answers.d.ts +106 -0
  62. package/dist/meetings/call-answers.js +171 -0
  63. package/dist/meetings/call-stats.d.ts +121 -0
  64. package/dist/meetings/call-stats.js +211 -0
  65. package/dist/meetings/calls.d.ts +76 -0
  66. package/dist/meetings/calls.js +78 -0
  67. package/dist/meetings/cli/index.d.ts +8 -0
  68. package/dist/meetings/cli/index.js +10 -22
  69. package/dist/meetings/cli/search.d.ts +9 -2
  70. package/dist/meetings/cli/search.js +16 -26
  71. package/dist/meetings/index.d.ts +3 -0
  72. package/dist/meetings/index.js +3 -0
  73. package/dist/meetings/mcp/index.d.ts +6 -3
  74. package/dist/meetings/mcp/index.js +2 -4
  75. package/dist/meetings/mcp/search.d.ts +6 -1
  76. package/dist/meetings/mcp/search.js +3 -3
  77. package/dist/meetings/read-through.d.ts +2 -1
  78. package/dist/meetings/read-through.js +10 -1
  79. package/dist/meetings/stats.d.ts +3 -0
  80. package/dist/meetings/stats.js +3 -3
  81. package/dist/meetings/testing/index.d.ts +1 -0
  82. package/dist/meetings/testing/index.js +1 -0
  83. package/dist/meetings/testing/paging.d.ts +6 -0
  84. package/dist/meetings/testing/paging.js +5 -0
  85. package/dist/moderation/rules.d.ts +2 -0
  86. package/dist/moderation/rules.js +16 -2
  87. package/dist/search/fusion.d.ts +17 -0
  88. package/dist/search/fusion.js +17 -0
  89. package/dist/search/lucene/resolved.d.ts +2 -0
  90. package/dist/search/question-plan.d.ts +2 -0
  91. package/dist/search/question-plan.js +5 -0
  92. package/dist/search/service-query.d.ts +6 -1
  93. package/dist/search/service-query.js +9 -1
  94. package/dist/services/agenda-mail.js +2 -1
  95. package/dist/services/agenda.js +5 -3
  96. package/dist/services/attachments.js +4 -2
  97. package/dist/services/call-stats.d.ts +17 -0
  98. package/dist/services/call-stats.js +41 -0
  99. package/dist/services/chats.js +4 -2
  100. package/dist/services/conversations.js +4 -2
  101. package/dist/services/deps.d.ts +1 -1
  102. package/dist/services/document-source.d.ts +1 -1
  103. package/dist/services/document-source.js +4 -3
  104. package/dist/services/documents/ingestion.js +11 -40
  105. package/dist/services/documents/plan.d.ts +1 -1
  106. package/dist/services/documents/plan.js +30 -17
  107. package/dist/services/documents/ports.d.ts +5 -0
  108. package/dist/services/documents/sync.js +1 -1
  109. package/dist/services/embeddings-search.js +20 -4
  110. package/dist/services/events-search.js +2 -1
  111. package/dist/services/index.d.ts +1 -0
  112. package/dist/services/index.js +1 -0
  113. package/dist/services/mail-search.d.ts +1 -1
  114. package/dist/services/mail-search.js +10 -11
  115. package/dist/services/media-archive-move.js +2 -4
  116. package/dist/services/media-archive.d.ts +0 -1
  117. package/dist/services/media-archive.js +2 -12
  118. package/dist/services/meeting-combined.js +1 -1
  119. package/dist/services/messages-combined.js +15 -4
  120. package/dist/services/moderation.js +10 -2
  121. package/dist/services/moment.d.ts +4 -10
  122. package/dist/services/moment.js +16 -44
  123. package/dist/services/notes-search.d.ts +0 -2
  124. package/dist/services/notes-search.js +1 -2
  125. package/dist/services/search-all.js +2 -1
  126. package/dist/services/tags.js +4 -2
  127. package/dist/services/task-stats.js +2 -2
  128. package/dist/services/tasks.js +2 -2
  129. package/dist/store/accounts.js +2 -1
  130. package/dist/store/sqlite/account-purge.d.ts +3 -0
  131. package/dist/store/sqlite/account-purge.js +143 -0
  132. package/dist/store/sqlite/accounts.d.ts +0 -2
  133. package/dist/store/sqlite/accounts.js +2 -134
  134. package/dist/store/sqlite/calendar.d.ts +1 -0
  135. package/dist/store/sqlite/calendar.js +5 -5
  136. package/dist/store/sqlite/catalog.js +2 -16
  137. package/dist/store/sqlite/chats.js +2 -1
  138. package/dist/store/sqlite/context-document-source.d.ts +3 -3
  139. package/dist/store/sqlite/context-document-source.js +9 -7
  140. package/dist/store/sqlite/context-evidence.js +9 -3
  141. package/dist/store/sqlite/document-listing.js +2 -1
  142. package/dist/store/sqlite/events.js +2 -1
  143. package/dist/store/sqlite/file-note.d.ts +6 -0
  144. package/dist/store/sqlite/file-note.js +15 -0
  145. package/dist/store/sqlite/files.d.ts +3 -2
  146. package/dist/store/sqlite/files.js +5 -3
  147. package/dist/store/sqlite/identities.js +2 -1
  148. package/dist/store/sqlite/imported-documents.js +2 -2
  149. package/dist/store/sqlite/knowledge.js +19 -19
  150. package/dist/store/sqlite/lucene-fields.js +8 -12
  151. package/dist/store/sqlite/mail-rules.js +2 -1
  152. package/dist/store/sqlite/meeting-calls.d.ts +4 -0
  153. package/dist/store/sqlite/meeting-calls.js +66 -0
  154. package/dist/store/sqlite/meetings.d.ts +2 -2
  155. package/dist/store/sqlite/meetings.js +4 -1
  156. package/dist/store/sqlite/mention-sources.js +2 -1
  157. package/dist/store/sqlite/mentions.js +2 -2
  158. package/dist/store/sqlite/messages.js +6 -1
  159. package/dist/store/sqlite/note-search.js +8 -11
  160. package/dist/store/sqlite/notes.d.ts +2 -0
  161. package/dist/store/sqlite/notes.js +24 -13
  162. package/dist/store/sqlite/organizations.js +2 -2
  163. package/dist/store/sqlite/people-list.js +3 -3
  164. package/dist/store/sqlite/query-filter.d.ts +3 -3
  165. package/dist/store/sqlite/query-filter.js +3 -3
  166. package/dist/store/sqlite/reads.d.ts +4 -4
  167. package/dist/store/sqlite/reads.js +4 -4
  168. package/dist/store/sqlite/search.js +11 -7
  169. package/dist/store/sqlite/test-accounts.js +1 -1
  170. package/dist/store/sqlite/trigram-match.d.ts +9 -0
  171. package/dist/store/sqlite/trigram-match.js +28 -0
  172. package/dist/store/sqlite/work-tasks.js +1 -1
  173. package/package.json +3 -3
@@ -1,6 +1,7 @@
1
1
  import { annotate, annotateOption, sharedCommand } from "@wirecat/cli-base/commands";
2
- import { defineQuery, fieldsHelp, parseLucene, timezoneOf, validateQuery, zonedMoment } from "@wirecat/cli-base/query";
2
+ import { defineQuery, fieldsHelp, parseLucene, timezoneOf, validateQuery } from "@wirecat/cli-base/query";
3
3
  import { InvalidArgumentError, Option } from "commander";
4
+ import { dateWindow } from "../../services/moment.js";
4
5
  import { EVENT_QUERY } from "../event-query.js";
5
6
  import { exportMeeting } from "../export.js";
6
7
  import { importFiles } from "../import.js";
@@ -23,14 +24,6 @@ const lookbackDays = (text) => {
23
24
  throw new InvalidArgumentError("expected an integer from 0 through 31 days");
24
25
  return Number(text);
25
26
  };
26
- const date = (text) => {
27
- try {
28
- return zonedMoment(text, timezoneOf(), { start: 0, end: text.length });
29
- }
30
- catch {
31
- throw new InvalidArgumentError("expected an ISO date, or a time with or without an offset");
32
- }
33
- };
34
27
  const LOCAL_READ = { remote: "none", local: "read" };
35
28
  /** Reads the service; what it returns is kept as `sync` keeps it, which counts as a read (WC-CMD-17). */
36
29
  const REMOTE_READ = { remote: "read", local: "read" };
@@ -49,14 +42,8 @@ const addMeetingCommandsDefinition = (program, deps) => {
49
42
  const group = annotate(program.command("meetings").description("stored meetings and their records"), {
50
43
  effects: { remote: "none", local: "none" },
51
44
  });
52
- const output = (command) => command
53
- .option("--json", "one JSON value")
54
- .option("--jsonl", "one JSON object per item")
55
- .hook("preAction", (cmd) => {
56
- const opts = cmd.optsWithGlobals();
57
- if (opts.json && opts.jsonl)
58
- throw new MeetingError("validation_error", "choose --json or --jsonl");
59
- });
45
+ // The host's root gives `--json [fields]` and `--jsonl`; a leaf of its own would shadow them.
46
+ const output = (command) => command;
60
47
  const print = (value, command) => {
61
48
  const opts = command.optsWithGlobals();
62
49
  deps.write(value, opts.json ? "json" : opts.jsonl ? "jsonl" : "text");
@@ -77,16 +64,17 @@ const addMeetingCommandsDefinition = (program, deps) => {
77
64
  output: { entity: "meeting" },
78
65
  });
79
66
  backendOption(output(list))
80
- .option("--limit <n>", "meetings per page", integer, 100)
81
- .option("--page <n>", "page number", integer, 1)
67
+ .option("--limit <n>", "meetings per page; the profile's defaults.limit when absent", integer)
68
+ .option("--page <n>", "which page, starting at 1", integer)
82
69
  .action(async (words, opts, command) => {
83
70
  const query = meetingsQuery(words.join(" "));
71
+ const { limit, page } = deps.pagingOf(command);
84
72
  await deps.inRun(command, async () => {
85
73
  // The standard envelope has no place for the counts; what the reader must know is in `missing` and `meta`.
86
74
  const { server: _server, ...answer } = await meetingsListThrough(deps.source, deps.store, {
87
75
  accountId: deps.accountId,
88
- limit: opts.limit,
89
- offset: (opts.page - 1) * opts.limit,
76
+ limit,
77
+ offset: (page - 1) * limit,
90
78
  ...(query ? { query } : {}),
91
79
  }, access(command, opts.backend));
92
80
  print(answer, command);
@@ -169,7 +157,7 @@ const addMeetingCommandsDefinition = (program, deps) => {
169
157
  ...(deps.budgetOf ? { cooperative: true, partial: true } : {}),
170
158
  }).description("bring the stored meetings up to date from the connected account, oldest first; a run that stops before its " +
171
159
  "deadline keeps what it saved and the next one goes on from there"))
172
- .option("--since-time <time>", "fetch meetings starting at or after this ISO 8601 date or time", date)
160
+ .option("--since-time <time>", "fetch meetings starting at or after this ISO 8601 date or time, or 30m, 2h, 7d ago", (text) => dateWindow({ sinceTime: text, ...(deps.timezone ? { zone: deps.timezone } : {}), now: deps.now?.() }).since)
173
161
  .option("--lookback-days <days>", "revisit recent occurrences for late transcripts (0–31)", lookbackDays)
174
162
  .option("--rescan", "read the last 30 days again, not only what came after the last sync")
175
163
  .action(async (opts, command) => {
@@ -21,8 +21,11 @@ export interface MeetingSearchFlags {
21
21
  cursor?: string;
22
22
  maxReadBytes?: number;
23
23
  }
24
- /** Transport fields become one validated word request before a host opens its selected source. */
25
- export declare const meetingHitSearchRequest: (query: string, options: MeetingSearchFlags, signal?: AbortSignal) => MeetingHitSearchOptions;
24
+ /**
25
+ * Transport fields become one validated word request before a host opens its selected source. `limit` is the page
26
+ * without `--limit`: the profile's `defaults.limit`, which `pagingOf` from `@wirecat/cli-core/cli` reads.
27
+ */
28
+ export declare const meetingHitSearchRequest: (query: string, options: MeetingSearchFlags, limit: number, signal?: AbortSignal) => MeetingHitSearchOptions;
26
29
  /** Parsed dates must become ISO values again so the CLI can replay its own continuation. */
27
30
  export declare const meetingSearchArguments: (query: string, options: MeetingSearchFlags) => Record<string, unknown>;
28
31
  /** What `meta` says about the dates: the zone one without its own was read in, and the window in UTC. */
@@ -31,5 +34,9 @@ export declare const createMeetingSearchCommand: (program: Command) => Command;
31
34
  export declare const addMeetingSearchCommand: (program: Command, deps: {
32
35
  search: (query: string, request: MeetingHitSearchOptions, options: MeetingSearchFlags & Record<string, unknown>) => Promise<MeetingSearchPage>;
33
36
  signal: () => AbortSignal | undefined;
37
+ /** The page without `--limit`: `pagingOf` from `@wirecat/cli-core/cli`, which reads the profile's limit. */
38
+ pagingOf: (command: Command) => {
39
+ limit: number;
40
+ };
34
41
  output: (value: unknown) => void;
35
42
  }) => Command;
@@ -1,29 +1,16 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { annotate, sharedCommand } from "@wirecat/cli-base/commands";
3
- import { timezoneOf, zonedMoment } from "@wirecat/cli-base/query";
4
3
  import { Command } from "commander";
4
+ import { dateWindow } from "../../services/moment.js";
5
5
  import { meetingHitsList } from "../answers.js";
6
6
  import { validateMeetingHitSearch } from "../search-validation.js";
7
7
  export { validateMeetingHitSearch } from "../search-validation.js";
8
- const ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
9
- // `30m`, `2h`, `7d` ago, as the messenger commands' --since-time reads them and this command's `date>=7d` does.
10
- const AGO = /^(\d+)(m|h|d)$/;
11
- const AGO_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 };
8
+ /** One bound of the shared past-time grammar; `readIn` hears the zone a value without its own was read in. */
12
9
  const moment = (flag, end, readIn) => (value) => {
13
- const [, amount, unit] = AGO.exec(value.trim()) ?? [];
14
- if (amount && unit)
15
- return Date.now() - Number(amount) * (AGO_MS[unit] ?? 0);
16
- const zone = timezoneOf();
17
- let time;
18
- try {
19
- time = zonedMoment(value, zone, { start: 0, end: value.length }, { end });
20
- }
21
- catch {
22
- throw new CliError("validation_error", `${flag} takes an ISO date, a time with or without an offset, or 30m, 2h, 7d ago`);
23
- }
24
- if (!ZONED.test(value.trim()))
25
- readIn(zone);
26
- return time;
10
+ const { since, until, meta } = dateWindow(end ? { untilTime: value, names: [flag, flag] } : { sinceTime: value, names: [flag, flag] });
11
+ if (meta.timezone)
12
+ readIn(meta.timezone);
13
+ return (end ? until : since);
27
14
  };
28
15
  const integer = (value) => {
29
16
  if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
@@ -52,7 +39,7 @@ const createMeetingSearchCommandDefinition = (program) => {
52
39
  .option("--topic-name <name>", "meetings with this topic, by name or alias")
53
40
  .option("--since-time <time>", "meetings starting at or after this ISO 8601 date or time, or 30m, 2h, 7d ago", moment("--since-time", false, readIn))
54
41
  .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))
55
- .option("--limit <n>", "how many hits, 1 through 1000 (default 100)", integer)
42
+ .option("--limit <n>", "how many hits, 1 through 1000; the profile's defaults.limit when absent", integer)
56
43
  .option("--cursor <cursor>", "continue from the previous page's page.next_cursor, with the same query and filters")
57
44
  .option("--max-read-bytes <bytes>", "most stored bytes to read, 1 through 67108864 (default 4194304)", integer);
58
45
  annotate(command, {
@@ -62,8 +49,11 @@ const createMeetingSearchCommandDefinition = (program) => {
62
49
  });
63
50
  return command;
64
51
  };
65
- /** Transport fields become one validated word request before a host opens its selected source. */
66
- export const meetingHitSearchRequest = (query, options, signal) => {
52
+ /**
53
+ * Transport fields become one validated word request before a host opens its selected source. `limit` is the page
54
+ * without `--limit`: the profile's `defaults.limit`, which `pagingOf` from `@wirecat/cli-core/cli` reads.
55
+ */
56
+ export const meetingHitSearchRequest = (query, options, limit, signal) => {
67
57
  const request = {
68
58
  meetingId: options.meetingId,
69
59
  participantIdentityId: options.identityId,
@@ -75,7 +65,7 @@ export const meetingHitSearchRequest = (query, options, signal) => {
75
65
  topic: options.topicName ?? options.topic,
76
66
  since: options.sinceTime,
77
67
  until: options.untilTime,
78
- limit: options.limit,
68
+ limit: options.limit ?? limit,
79
69
  after: options.cursor,
80
70
  maxReadBytes: options.maxReadBytes,
81
71
  signal,
@@ -110,9 +100,9 @@ export const meetingSearchMeta = (options) => {
110
100
  ...(Object.keys(window).length === 0 ? {} : { window }),
111
101
  };
112
102
  };
113
- const addMeetingSearchCommandDefinition = (program, deps) => createMeetingSearchCommand(program).action(async (query, options) => {
114
- const request = meetingHitSearchRequest(query, options, deps.signal());
115
- deps.output(meetingHitsList(await deps.search(query, request, options), request.limit ?? 100, "search meetings", meetingSearchArguments(query, options), meetingSearchMeta(options)));
103
+ const addMeetingSearchCommandDefinition = (program, deps) => createMeetingSearchCommand(program).action(async (query, options, command) => {
104
+ const request = meetingHitSearchRequest(query, options, deps.pagingOf(command).limit, deps.signal());
105
+ deps.output(meetingHitsList(await deps.search(query, request, options), request.limit, "search meetings", meetingSearchArguments(query, options), meetingSearchMeta(options)));
116
106
  });
117
107
  export const createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
118
108
  export const addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
@@ -2,6 +2,9 @@ export { BACKENDS, type Backend, type QueryTree, type ServiceCalls, type Service
2
2
  export { MEETING_STEPS, type MeetingDetailsItem, type MeetingHitItem, type MeetingItemBody, type MeetingListBody, type MeetingSummaryItem, type MeetingTranscriptItem, meetingDetails, meetingHit, meetingHitsList, meetingSummary, meetingTranscript, } from "./answers.js";
3
3
  export type { MeetingBatchReader } from "./batch.js";
4
4
  export { calendarText, ENTRY_METADATA_KEYS, entryMetadata, withoutLinkQueries } from "./calendar-text.js";
5
+ export { type CallStatsItem, callStats, callStatsItem } from "./call-answers.js";
6
+ export { aggregateCallStats, CALLBACK_WITHIN_MS, type CallCallback, type CallEmployeeStats, type CallPeriodStats, type CallStats, type CallStatsOptions, type MissedCall, SHORT_CALL_UNDER_MS, } from "./call-stats.js";
7
+ export { CALL_DIRECTIONS, CALL_OUTCOMES, type Call, type CallClient, type CallDirection, type CallEmployee, type CallOutcome, callOf, type MeetingCallsInput, type MeetingCallsStore, MISSED_OUTCOMES, type StoredCall, type StoredCallParticipant, } from "./calls.js";
5
8
  export type { MeetingContextStore, MeetingEventLinkInput, MeetingEventLinkReceipt, ParticipantPerson, ParticipantPersonInput, ParticipantPersonLinkInput, ParticipantPersonLinkReceipt, } from "./context-store.js";
6
9
  export { type MeetingCueIdentity, meetingCueFingerprint } from "./cue-fingerprint.js";
7
10
  export { EVENT_QUERY } from "./event-query.js";
@@ -1,6 +1,9 @@
1
1
  export { BACKENDS, serviceCallsOf, } from "../search/service-query.js";
2
2
  export { MEETING_STEPS, meetingDetails, meetingHit, meetingHitsList, meetingSummary, meetingTranscript, } from "./answers.js";
3
3
  export { calendarText, ENTRY_METADATA_KEYS, entryMetadata, withoutLinkQueries } from "./calendar-text.js";
4
+ export { callStats, callStatsItem } from "./call-answers.js";
5
+ export { aggregateCallStats, CALLBACK_WITHIN_MS, SHORT_CALL_UNDER_MS, } from "./call-stats.js";
6
+ export { CALL_DIRECTIONS, CALL_OUTCOMES, callOf, MISSED_OUTCOMES, } from "./calls.js";
4
7
  export { meetingCueFingerprint } from "./cue-fingerprint.js";
5
8
  export { EVENT_QUERY } from "./event-query.js";
6
9
  export { entryInWindow, eventChange } from "./event-store.js";
@@ -751,9 +751,12 @@ export declare const meetingTools: ({
751
751
  openWorldHint: boolean;
752
752
  };
753
753
  })[];
754
- export declare const callMeetingTool: (store: MeetingStore, name: string, input: unknown,
755
- /** The host's error registry (`failureContext`), so its reasons and detail keys survive. */
756
- failure?: FailureContext) => Promise<{
754
+ export declare const callMeetingTool: (store: MeetingStore, name: string, input: unknown, { limit: configured, failure, }: {
755
+ /** A list's page without `limit`: the profile's `defaults.limit`, as the messenger MCP lists take it. */
756
+ limit: number;
757
+ /** The host's error registry (`failureContext`), so its reasons and detail keys survive. */
758
+ failure?: FailureContext;
759
+ }) => Promise<{
757
760
  content: {
758
761
  type: "text";
759
762
  text: string;
@@ -105,9 +105,7 @@ const argumentsOf = (name, input) => {
105
105
  }
106
106
  return args;
107
107
  };
108
- export const callMeetingTool = async (store, name, input,
109
- /** The host's error registry (`failureContext`), so its reasons and detail keys survive. */
110
- failure = {}) => {
108
+ export const callMeetingTool = async (store, name, input, { limit: configured, failure = {}, }) => {
111
109
  try {
112
110
  const args = argumentsOf(name, input);
113
111
  const filter = {
@@ -118,7 +116,7 @@ failure = {}) => {
118
116
  let result;
119
117
  switch (name) {
120
118
  case "meetings_list": {
121
- const limit = args.limit ?? 100;
119
+ const limit = args.limit ?? configured;
122
120
  result = await meetingsList(store, {
123
121
  ...filter,
124
122
  limit,
@@ -87,7 +87,12 @@ export declare const meetingSearchTool: {
87
87
  additionalProperties: boolean;
88
88
  };
89
89
  };
90
- export declare const callMeetingSearchTool: (search: MeetingHitSearch, input: unknown, signal?: AbortSignal, failure?: FailureContext) => Promise<({
90
+ export declare const callMeetingSearchTool: (search: MeetingHitSearch, input: unknown, { limit, signal, failure, }: {
91
+ /** The page without `limit`: the profile's `defaults.limit`, as the messenger MCP lists take it. */
92
+ limit: number;
93
+ signal?: AbortSignal;
94
+ failure?: FailureContext;
95
+ }) => Promise<({
91
96
  content: {
92
97
  type: "text";
93
98
  text: string;
@@ -34,7 +34,7 @@ export const meetingSearchTool = {
34
34
  additionalProperties: false,
35
35
  },
36
36
  };
37
- export const callMeetingSearchTool = async (search, input, signal, failure = {}) => {
37
+ export const callMeetingSearchTool = async (search, input, { limit, signal, failure = {}, }) => {
38
38
  try {
39
39
  if (!input || typeof input !== "object" || Array.isArray(input))
40
40
  throw new CliError("validation_error", "expected search argument object");
@@ -52,7 +52,7 @@ export const callMeetingSearchTool = async (search, input, signal, failure = {})
52
52
  topic: args.topic,
53
53
  since: args.since_time,
54
54
  until: args.until_time,
55
- limit: args.limit,
55
+ limit: args.limit ?? limit,
56
56
  after: args.cursor,
57
57
  maxReadBytes: args.max_read_bytes,
58
58
  signal,
@@ -64,7 +64,7 @@ export const callMeetingSearchTool = async (search, input, signal, failure = {})
64
64
  ...(options.since === undefined ? {} : { since: new Date(options.since).toISOString() }),
65
65
  ...(options.until === undefined ? {} : { until: new Date(options.until).toISOString() }),
66
66
  };
67
- const result = meetingHitsList(await search(query, options), options.limit ?? 100, "search meetings", { ...args, max_read_bytes: options.maxReadBytes ?? 4194304 }, Object.keys(window).length === 0 ? {} : { window });
67
+ const result = meetingHitsList(await search(query, options), options.limit, "search meetings", { ...args, max_read_bytes: options.maxReadBytes ?? 4194304 }, Object.keys(window).length === 0 ? {} : { window });
68
68
  signal?.throwIfAborted();
69
69
  return agentResult({
70
70
  content: [{ type: "text", text: JSON.stringify(result) }],
@@ -1,7 +1,7 @@
1
1
  import { type QueryAst } from "@wirecat/cli-base/query";
2
2
  import type { Meta, Missing } from "@wirecat/cli-base/standards";
3
3
  import { type Backend } from "../search/service-query.js";
4
- import type { MeetingItem } from "./item.js";
4
+ import { type MeetingItem } from "./item.js";
5
5
  import { type MeetingList } from "./reads.js";
6
6
  import type { MeetingSource } from "./source.js";
7
7
  import type { MeetingDetails, MeetingFilter, MeetingStore } from "./store.js";
@@ -56,6 +56,7 @@ export type MeetingListThrough = MeetingList & {
56
56
  server?: MeetingServerReport;
57
57
  meta?: Partial<Meta>;
58
58
  };
59
+ /** As `listThrough`, with `meta.timezone` when the query read a date in a zone, as every store list says it. */
59
60
  export declare const meetingsListThrough: (source: MeetingSource | undefined, store: MeetingStore, filter: MeetingFilter & {
60
61
  accountId: number;
61
62
  }, access: MeetingServerAccess) => Promise<MeetingListThrough>;
@@ -1,6 +1,7 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { timezoneOf } from "@wirecat/cli-base/query";
3
- import { rangeOf, serviceCallsOf, windowOf } from "../search/service-query.js";
3
+ import { rangeOf, readsZone, serviceCallsOf, windowOf, } from "../search/service-query.js";
4
+ import { MEETING_QUERY } from "./item.js";
4
5
  import { saveSourceMeeting, sourceMeetingInput } from "./pull.js";
5
6
  import { MeetingError, meetingsList } from "./reads.js";
6
7
  import { parseMeetingReference } from "./reference.js";
@@ -233,7 +234,15 @@ export const askServerForList = async (source, store, accountId, query, access)
233
234
  }
234
235
  return step;
235
236
  };
237
+ /** As `listThrough`, with `meta.timezone` when the query read a date in a zone, as every store list says it. */
236
238
  export const meetingsListThrough = async (source, store, filter, access) => {
239
+ const listed = await listThrough(source, store, filter, access);
240
+ if (!filter.query || !readsZone(filter.query, MEETING_TIMES))
241
+ return listed;
242
+ return { ...listed, meta: { ...listed.meta, timezone: timezoneOf(access.timezone) } };
243
+ };
244
+ const MEETING_TIMES = new Set(MEETING_QUERY.fields.filter(({ type }) => type === "time").map(({ name }) => name));
245
+ const listThrough = async (source, store, filter, access) => {
237
246
  const now = access.now ?? Date.now();
238
247
  const zoned = { ...filter, timezone: timezoneOf(access.timezone), now };
239
248
  const step = await askServerForList(source, store, filter.accountId, filter.query, { ...access, now });
@@ -87,6 +87,9 @@ export interface MeetingStatsStore {
87
87
  meetingStats(input: MeetingStatsInput): Promise<MeetingStats>;
88
88
  meetingCounts(input: MeetingCountsInput): Promise<MeetingCounts>;
89
89
  }
90
+ export declare const zoneOf: (timeZone: string | undefined) => string;
91
+ export declare const dayKey: (at: number, format: Intl.DateTimeFormat) => string;
92
+ export declare const zoneFormat: (zone: string) => Intl.DateTimeFormat;
90
93
  /** The row of meetings outside any series, under `--by series`; a constant for the same reason as `UNKNOWN_SPEAKER`. */
91
94
  export declare const NO_SERIES = "no-series";
92
95
  /**
@@ -1,6 +1,6 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  export const MEETING_COUNTS_GROUPINGS = ["day", "week", "series"];
3
- const zoneOf = (timeZone) => {
3
+ export const zoneOf = (timeZone) => {
4
4
  const zone = timeZone ?? "UTC";
5
5
  try {
6
6
  new Intl.DateTimeFormat("en", { timeZone: zone });
@@ -16,11 +16,11 @@ const weekStart = (at, format) => {
16
16
  const day = Date.UTC(Number(parts.year), Number(parts.month) - 1, Number(parts.day));
17
17
  return new Date(day - DAYS.indexOf(parts.weekday ?? "Mon") * 86_400_000).toISOString().slice(0, 10);
18
18
  };
19
- const dayKey = (at, format) => {
19
+ export const dayKey = (at, format) => {
20
20
  const parts = Object.fromEntries(format.formatToParts(new Date(at)).map((part) => [part.type, part.value]));
21
21
  return `${parts.year}-${parts.month}-${parts.day}`;
22
22
  };
23
- const zoneFormat = (zone) => new Intl.DateTimeFormat("en-US", {
23
+ export const zoneFormat = (zone) => new Intl.DateTimeFormat("en-US", {
24
24
  timeZone: zone,
25
25
  year: "numeric",
26
26
  month: "2-digit",
@@ -2,6 +2,7 @@ export { meetingStoreContract } from "./contract.js";
2
2
  export { CONTRACT_NOW, type EventStoreFixture, eventStoreContract } from "./event-store-contract.js";
3
3
  export { type MeetingManagementContractFixture, meetingManagementContract } from "./management-contract.js";
4
4
  export { memoryMeetingStore } from "./memory.js";
5
+ export { flagPaging } from "./paging.js";
5
6
  export { type RecordingSyncCheckpointFixture, recordingSyncCheckpointStoreContract, } from "./recording-sync-contract.js";
6
7
  export { memoryRecordingSyncCheckpointStore } from "./recording-sync-memory.js";
7
8
  export { type RecordingTransferStorageFixture, recordingTransferStorageContract, } from "./recording-transfer-contract.js";
@@ -2,6 +2,7 @@ export { meetingStoreContract } from "./contract.js";
2
2
  export { CONTRACT_NOW, eventStoreContract } from "./event-store-contract.js";
3
3
  export { meetingManagementContract } from "./management-contract.js";
4
4
  export { memoryMeetingStore } from "./memory.js";
5
+ export { flagPaging } from "./paging.js";
5
6
  export { recordingSyncCheckpointStoreContract, } from "./recording-sync-contract.js";
6
7
  export { memoryRecordingSyncCheckpointStore } from "./recording-sync-memory.js";
7
8
  export { recordingTransferStorageContract, } from "./recording-transfer-contract.js";
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /** `pagingOf` for a test of the commands outside cli-core's run, which has no profile: the flags, else 100 a page. */
3
+ export declare const flagPaging: (command: Command) => {
4
+ limit: number;
5
+ page: number;
6
+ };
@@ -0,0 +1,5 @@
1
+ /** `pagingOf` for a test of the commands outside cli-core's run, which has no profile: the flags, else 100 a page. */
2
+ export const flagPaging = (command) => {
3
+ const { limit, page } = command.opts();
4
+ return { limit: limit ?? 100, page: page ?? 1 };
5
+ };
@@ -83,6 +83,8 @@ export type GroupRules = v.InferOutput<typeof groupRules>;
83
83
  export declare const defaultRules: (title: string | null) => GroupRules;
84
84
  export declare const RULE_KEYS: string[];
85
85
  export declare const moderationPathFor: (app: AppIdentity, profile: string, env?: NodeJS.ProcessEnv) => string;
86
+ /** The choices when a caller named no profile: those logged in to here, and those that keep moderation rules. */
87
+ export declare const moderationProfiles: (app: AppIdentity, env?: NodeJS.ProcessEnv) => string[];
86
88
  /**
87
89
  * The rules of each group this profile moderates, one file per profile beside the recipient list —
88
90
  * the path max-cli used, so its rules carry over. May be edited by hand; a file that does not check
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync } from "node:fs";
1
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { CliError, resolvePaths, writeSecurely } from "@wirecat/cli-base";
4
4
  import * as v from "valibot";
@@ -80,7 +80,21 @@ const KEYS = {
80
80
  "consent.remove": { help: LEVELS.join("|"), parse: String },
81
81
  };
82
82
  export const RULE_KEYS = Object.keys(KEYS);
83
- export const moderationPathFor = (app, profile, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.moderation.json`);
83
+ const stateFolder = (app, env, folder) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, folder);
84
+ const profilesFolder = (app, env) => stateFolder(app, env, "profiles");
85
+ export const moderationPathFor = (app, profile, env = process.env) => join(profilesFolder(app, env), `${profile}.moderation.json`);
86
+ const namesIn = (folder, suffix) => existsSync(folder)
87
+ ? readdirSync(folder)
88
+ .filter((name) => name.endsWith(suffix))
89
+ .map((name) => name.slice(0, -suffix.length))
90
+ : [];
91
+ /** The choices when a caller named no profile: those logged in to here, and those that keep moderation rules. */
92
+ export const moderationProfiles = (app, env = process.env) => [
93
+ ...new Set([
94
+ ...namesIn(stateFolder(app, env, "accounts"), ".json"),
95
+ ...namesIn(profilesFolder(app, env), ".moderation.json"),
96
+ ]),
97
+ ].sort();
84
98
  /**
85
99
  * The rules of each group this profile moderates, one file per profile beside the recipient list —
86
100
  * the path max-cli used, so its rules carry over. May be edited by hand; a file that does not check
@@ -0,0 +1,17 @@
1
+ /** Reciprocal rank fusion's usual constant, as conversations use. */
2
+ export declare const RRF_K = 60;
3
+ export interface FusedFacts {
4
+ /** The hit holds the exact forms of the words, when the search was stemmed. */
5
+ exact?: boolean | undefined;
6
+ /** Its index ranked it by relevance; an unranked hit came by a field, a transcript or a file. */
7
+ ranked: boolean;
8
+ /** Milliseconds: what breaks a tie, newest first. */
9
+ at: number;
10
+ }
11
+ /**
12
+ * Lists, each best first from its own index, as one list best first. Raw scores of two word indexes never compare
13
+ * (each BM25 depends on its own corpus), so a hit's place in its own list votes instead, by reciprocal rank fusion;
14
+ * that place also carries the transcript and file tiers the list was sorted by. Exact hits stay first and ranked
15
+ * ones before unranked, as within one list. With nothing ranked, newest first.
16
+ */
17
+ export declare const fuseRanked: <T>(lists: readonly (readonly T[])[], facts: (item: T) => FusedFacts) => T[];
@@ -0,0 +1,17 @@
1
+ /** Reciprocal rank fusion's usual constant, as conversations use. */
2
+ export const RRF_K = 60;
3
+ /**
4
+ * Lists, each best first from its own index, as one list best first. Raw scores of two word indexes never compare
5
+ * (each BM25 depends on its own corpus), so a hit's place in its own list votes instead, by reciprocal rank fusion;
6
+ * that place also carries the transcript and file tiers the list was sorted by. Exact hits stay first and ranked
7
+ * ones before unranked, as within one list. With nothing ranked, newest first.
8
+ */
9
+ export const fuseRanked = (lists, facts) => {
10
+ const rows = lists.flatMap((list) => list.map((item, rank) => ({ item, vote: 1 / (RRF_K + rank + 1), ...facts(item) })));
11
+ const ranking = rows.some(({ ranked }) => ranked);
12
+ return rows
13
+ .sort((a, b) => Number(b.exact === true) - Number(a.exact === true) ||
14
+ (ranking ? Number(b.ranked) - Number(a.ranked) || b.vote - a.vote : 0) ||
15
+ b.at - a.at)
16
+ .map(({ item }) => item);
17
+ };
@@ -2,6 +2,8 @@ import type { DateRange, Occur, Predicate, QueryNode, Span } from "@wirecat/cli-
2
2
  import type { AccountKey } from "../../store/store.js";
3
3
  import type { Stemmer } from "../stem.js";
4
4
  export type ResolvedPredicate = Predicate & {
5
+ /** A prefix the search made of a word typed whole: past the expansions budget it reads as that word instead. */
6
+ widened?: true;
5
7
  resolution?: {
6
8
  chat?: {
7
9
  account: AccountKey;
@@ -1,4 +1,6 @@
1
1
  export declare const words: (text: string) => RegExpMatchArray | [];
2
+ /** Words that carry no topic of their own: widening one to a prefix (`про*`) finds only noise. */
3
+ export declare const isFunctionWord: (word: string) => boolean;
2
4
  /**
3
5
  * A question's content words — «что решили по цене?» → решили, цене — or null when the text is not a question: it
4
6
  * ends with «?» or starts with a question word.
@@ -9,6 +9,11 @@ const QUESTION_STARTS = new Set(words("what which how who whom whose where when
9
9
  "что кто кого кому кем где когда как какой какая какое какие какую каким какого каких почему зачем откуда " +
10
10
  "куда сколько ли можно разве чей чья чьё чьи"));
11
11
  const QUESTION_FILLER = new Set(words("about any did does why whom whose would will это мы вы я они он она о об про ли"));
12
+ const LINKING = new Set(words("and or but not nor with without this that these those there their they them you your our its his her all any " +
13
+ "and for into onto over then than also just and при для без над под или либо его её их все всё уже ещё так " +
14
+ "тоже также был была были было будет это эта этот эти там тут"));
15
+ /** Words that carry no topic of their own: widening one to a prefix (`про*`) finds only noise. */
16
+ export const isFunctionWord = (word) => scaffolding.has(word) || QUESTION_STARTS.has(word) || QUESTION_FILLER.has(word) || LINKING.has(word);
12
17
  /**
13
18
  * A question's content words — «что решили по цене?» → решили, цене — or null when the text is not a question: it
14
19
  * ends with «?» or starts with a question word.
@@ -1,4 +1,4 @@
1
- import { type DateRange, type Occur, type Predicate, type Span } from "@wirecat/cli-base/query";
1
+ import { type DateRange, type Occur, type Predicate, type QueryAst, type Span } from "@wirecat/cli-base/query";
2
2
  /**
3
3
  * Where a read looks, the one vocabulary of messages, mail, calendar and meetings: the store (`archive`), the
4
4
  * service's own search (`server`), or both, with what the service returns kept in the store.
@@ -61,3 +61,8 @@ export declare const windowOf: ({ lower, upper, lower_inclusive, upper_inclusive
61
61
  from?: number;
62
62
  to?: number;
63
63
  };
64
+ /**
65
+ * Whether a query reads one of `times` in a zone — a date, `today`, a time without an offset — so the answer names
66
+ * that zone in `meta.timezone`. A time counted back from now or carrying its offset needs none.
67
+ */
68
+ export declare const readsZone: (ast: QueryAst, times: ReadonlySet<string>) => boolean;
@@ -1,4 +1,4 @@
1
- import { dateRange } from "@wirecat/cli-base/query";
1
+ import { dateRange, walkQuery, } from "@wirecat/cli-base/query";
2
2
  /**
3
3
  * Where a read looks, the one vocabulary of messages, mail, calendar and meetings: the store (`archive`), the
4
4
  * service's own search (`server`), or both, with what the service returns kept in the store.
@@ -55,3 +55,11 @@ export const windowOf = ({ lower, upper, lower_inclusive, upper_inclusive, }) =>
55
55
  ...(lower === undefined ? {} : { from: lower_inclusive ? lower : lower + 1 }),
56
56
  ...(upper === undefined ? {} : { to: upper_inclusive ? upper : upper - 1 }),
57
57
  });
58
+ const RELATIVE_TIME = /^\d+[mhd]$/i;
59
+ const OFFSET = /(?:Z|[+-]\d{2}:?\d{2})$/i;
60
+ /**
61
+ * Whether a query reads one of `times` in a zone — a date, `today`, a time without an offset — so the answer names
62
+ * that zone in `meta.timezone`. A time counted back from now or carrying its offset needs none.
63
+ */
64
+ export const readsZone = (ast, times) => walkQuery(ast.root).some((term) => times.has(term.field) &&
65
+ [term.value, term.upper].some((value) => value !== undefined && value !== "*" && !RELATIVE_TIME.test(value) && !OFFSET.test(value)));
@@ -1,4 +1,5 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
+ import { timezoneOf } from "@wirecat/cli-base/query";
2
3
  import { mailTurn } from "../mail/owed.js";
3
4
  import { MAIL_AGENDA_COLUMNS, queryFilter, } from "../store/store.js";
4
5
  const absent = (error) => {
@@ -15,7 +16,7 @@ export const mailActivity = async (store, account, since, chats) => {
15
16
  if (!stored)
16
17
  return { chats: [], storedAt: null, coverage: () => [] };
17
18
  const where = chats
18
- ? queryFilter(chats, MAIL_AGENDA_COLUMNS, { command: "tasks agenda" })
19
+ ? queryFilter(chats, MAIL_AGENDA_COLUMNS, { command: "tasks agenda", zone: timezoneOf() })
19
20
  : undefined;
20
21
  const threads = await store.mail.threadActivity(stored.id, since, where);
21
22
  const synced = await store.sync.syncState(account, "mail_coverage");
@@ -1,4 +1,4 @@
1
- import { queryError, queryFieldsOf, walkQuery, } from "@wirecat/cli-base/query";
1
+ import { queryError, queryFieldsOf, timezoneOf, walkQuery, } from "@wirecat/cli-base/query";
2
2
  import { formatLocator, isLocator, parseLocator } from "../domain/locator.js";
3
3
  import { formatReference } from "../domain/references.js";
4
4
  import { agenda } from "../entities/agenda.js";
@@ -65,7 +65,7 @@ export const agendaService = (deps, now = Date.now) => ({
65
65
  const open = await find();
66
66
  const tags = await taskTagFilters(store, parts.tasks);
67
67
  const listed = parts.tasks
68
- ? await find(queryFilter(parts.tasks, taskColumns(holder, at, tags), { command: "tasks agenda" }))
68
+ ? await find(queryFilter(parts.tasks, taskColumns(holder, at, tags), { command: "tasks agenda", zone: timezoneOf() }))
69
69
  : open;
70
70
  const tasks = listed
71
71
  .map((task) => ({ task, reasons: reasonsOf(task, at, dueWithin) }))
@@ -106,7 +106,9 @@ export const agendaService = (deps, now = Date.now) => ({
106
106
  }));
107
107
  const mail = account.provider === "email" ? await mailActivity(store, account, at - within, parts.chats) : undefined;
108
108
  const activity = mail ??
109
- (await store.chats.chatActivity(account, at - within, parts.chats ? queryFilter(parts.chats, AGENDA_COLUMNS, { command: "tasks agenda" }) : undefined));
109
+ (await store.chats.chatActivity(account, at - within, parts.chats
110
+ ? queryFilter(parts.chats, AGENDA_COLUMNS, { command: "tasks agenda", zone: timezoneOf() })
111
+ : undefined));
110
112
  const turnOf = (chat) => "turn" in chat ? chat.turn : chat.lastFromOwner === null ? null : chat.lastFromOwner ? "waiting" : "owed";
111
113
  const chats = activity.chats.map(({ lastMessageId, ...chat }) => ({
112
114
  turn: turnOf({ lastMessageId, ...chat }),
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { constants, mkdirSync } from "node:fs";
3
3
  import { lstat, open, readFile, stat } from "node:fs/promises";
4
4
  import { CliError } from "@wirecat/cli-base";
5
- import { queryFieldsOf, walkQuery } from "@wirecat/cli-base/query";
5
+ import { queryFieldsOf, timezoneOf, walkQuery } from "@wirecat/cli-base/query";
6
6
  import { directoryPaths } from "../attachments/directory.js";
7
7
  import { documentExtractor, documentKind } from "../attachments/documents.js";
8
8
  import { classify, engineMissing, extractText, importEngine, MAX_TEXT_CHARS, } from "../attachments/extract.js";
@@ -367,7 +367,9 @@ export const attachmentsService = (deps) => ({
367
367
  for (const node of walkQuery(query.root))
368
368
  if (node.field === "chat" && node.operator !== "wildcard" && !chats.has(node.value))
369
369
  chats.set(node.value, await chatIdIn(deps.messenger, node.value, store, { includeLeft: true }));
370
- const where = query ? queryFilter(query, attachmentColumns(chats), { command: "attachments list" }) : undefined;
370
+ const where = query
371
+ ? queryFilter(query, attachmentColumns(chats), { command: "attachments list", zone: timezoneOf() })
372
+ : undefined;
371
373
  const views = await store.attachments.attachments({ ...(where ? { where } : {}), offset, limit: limit + 1 });
372
374
  return { items: views.slice(0, limit).map((view) => itemOf(account, view)), hasMore: views.length > limit };
373
375
  },
@@ -0,0 +1,17 @@
1
+ import { type CallStats, type MeetingCallsInput } from "../meetings/index.js";
2
+ import type { MessageStore } from "../store/store.js";
3
+ export type CallStatsRequest = MeetingCallsInput & {
4
+ timeZone?: string;
5
+ callbackWithinMs?: number;
6
+ missedLimit?: number;
7
+ };
8
+ export type CallStatsAnswer = CallStats & {
9
+ accountId: number;
10
+ /** Selected meetings that are not calls: no direction or outcome a phone system writes, and no client. */
11
+ notCalls: number;
12
+ };
13
+ /**
14
+ * The call numbers of one account over the selected meetings. A callback may come after `until` or from an employee
15
+ * the selection leaves out, so the account's calls up to `callbackWithinMs` after the selection are read too.
16
+ */
17
+ export declare const readCallStats: (store: Pick<MessageStore, "meetings">, request: CallStatsRequest) => Promise<CallStatsAnswer>;