@wirecat/cli-core 0.661.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 (201) hide show
  1. package/CHANGELOG.md +109 -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/ai-model-command.js +3 -3
  8. package/dist/cli/call-stats-command.d.ts +18 -0
  9. package/dist/cli/call-stats-command.js +52 -0
  10. package/dist/cli/command-availability.d.ts +1 -1
  11. package/dist/cli/command-availability.js +4 -4
  12. package/dist/cli/contract-templates.js +2 -0
  13. package/dist/cli/dry-run-guard.js +7 -5
  14. package/dist/cli/early-refusal.d.ts +1 -1
  15. package/dist/cli/early-refusal.js +2 -2
  16. package/dist/cli/effects.d.ts +9 -2
  17. package/dist/cli/effects.js +16 -4
  18. package/dist/cli/envelope.d.ts +0 -5
  19. package/dist/cli/envelope.js +25 -0
  20. package/dist/cli/index.d.ts +3 -2
  21. package/dist/cli/index.js +3 -2
  22. package/dist/cli/meeting-batch.d.ts +2 -1
  23. package/dist/cli/meeting-batch.js +7 -5
  24. package/dist/cli/meeting-preparation-command.js +5 -5
  25. package/dist/cli/meeting-preparation-read.d.ts +5 -5
  26. package/dist/cli/meeting-preparation-read.js +13 -21
  27. package/dist/cli/meeting-series-inventory-command.js +2 -2
  28. package/dist/cli/meeting-series-inventory-read.d.ts +2 -2
  29. package/dist/cli/meeting-series-inventory-read.js +7 -15
  30. package/dist/cli/messenger/admin-moderation-command.js +2 -2
  31. package/dist/cli/messenger/admin-statistics-command.js +2 -2
  32. package/dist/cli/messenger/archive-commands.js +2 -2
  33. package/dist/cli/messenger/context.d.ts +2 -2
  34. package/dist/cli/messenger/context.js +5 -3
  35. package/dist/cli/messenger/counters-command.js +2 -2
  36. package/dist/cli/messenger/media-archive-command.js +5 -4
  37. package/dist/cli/messenger/media-archive-move-command.js +1 -1
  38. package/dist/cli/messenger/media-archive-timer-command.js +5 -4
  39. package/dist/cli/messenger/metadata-command.js +3 -3
  40. package/dist/cli/messenger/rankings-command.js +3 -3
  41. package/dist/cli/messenger/tags-command.js +7 -2
  42. package/dist/cli/messenger/tasks-command.js +4 -3
  43. package/dist/cli/paging.d.ts +10 -0
  44. package/dist/cli/paging.js +29 -0
  45. package/dist/cli/preview.js +3 -5
  46. package/dist/cli/program.js +2 -2
  47. package/dist/cli/runs/command.js +6 -4
  48. package/dist/cli/runs/search-command.js +9 -5
  49. package/dist/cli/schedule/schedule-command.js +1 -5
  50. package/dist/cli/shadowed-options.d.ts +7 -0
  51. package/dist/cli/shadowed-options.js +26 -0
  52. package/dist/crm/cli/index.js +4 -2
  53. package/dist/domain/moment.d.ts +29 -0
  54. package/dist/domain/moment.js +58 -0
  55. package/dist/domain/providers.d.ts +6 -4
  56. package/dist/domain/providers.js +10 -5
  57. package/dist/domain/send-time.d.ts +3 -4
  58. package/dist/domain/send-time.js +10 -24
  59. package/dist/entities/fields.d.ts +2 -2
  60. package/dist/entities/fields.js +2 -2
  61. package/dist/entities/index.d.ts +92 -1
  62. package/dist/entities/index.js +3 -2
  63. package/dist/entities/meeting.d.ts +1 -1
  64. package/dist/entities/meeting.js +1 -1
  65. package/dist/errors/reasons.js +0 -1
  66. package/dist/kit/sync-after-install.d.ts +10 -1
  67. package/dist/kit/sync-after-install.js +35 -11
  68. package/dist/mail/cli/index.js +4 -2
  69. package/dist/mail/facts.d.ts +5 -2
  70. package/dist/mail/facts.js +6 -3
  71. package/dist/mail/index.d.ts +1 -1
  72. package/dist/mail/meeting-notes.js +1 -1
  73. package/dist/mail/probe.d.ts +5 -2
  74. package/dist/mail/probe.js +9 -5
  75. package/dist/mail/server-search.js +4 -4
  76. package/dist/mail/sync.js +1 -1
  77. package/dist/mcp/meeting-preparation.js +1 -1
  78. package/dist/mcp/meeting-series-inventory.js +1 -1
  79. package/dist/mcp/prompts.js +6 -9
  80. package/dist/mcp/server.js +4 -4
  81. package/dist/mcp/tool.js +3 -3
  82. package/dist/meetings/call-answers.d.ts +106 -0
  83. package/dist/meetings/call-answers.js +171 -0
  84. package/dist/meetings/call-stats.d.ts +121 -0
  85. package/dist/meetings/call-stats.js +211 -0
  86. package/dist/meetings/calls.d.ts +76 -0
  87. package/dist/meetings/calls.js +78 -0
  88. package/dist/meetings/cli/index.d.ts +8 -0
  89. package/dist/meetings/cli/index.js +10 -22
  90. package/dist/meetings/cli/search.d.ts +9 -2
  91. package/dist/meetings/cli/search.js +16 -26
  92. package/dist/meetings/index.d.ts +3 -0
  93. package/dist/meetings/index.js +3 -0
  94. package/dist/meetings/mcp/index.d.ts +21 -18
  95. package/dist/meetings/mcp/index.js +2 -4
  96. package/dist/meetings/mcp/search.d.ts +6 -1
  97. package/dist/meetings/mcp/search.js +3 -3
  98. package/dist/meetings/read-through.d.ts +2 -1
  99. package/dist/meetings/read-through.js +10 -1
  100. package/dist/meetings/stats.d.ts +3 -0
  101. package/dist/meetings/stats.js +3 -3
  102. package/dist/meetings/testing/index.d.ts +1 -0
  103. package/dist/meetings/testing/index.js +1 -0
  104. package/dist/meetings/testing/paging.d.ts +6 -0
  105. package/dist/meetings/testing/paging.js +5 -0
  106. package/dist/moderation/rules.d.ts +2 -0
  107. package/dist/moderation/rules.js +16 -2
  108. package/dist/search/fusion.d.ts +17 -0
  109. package/dist/search/fusion.js +17 -0
  110. package/dist/search/lucene/resolved.d.ts +2 -0
  111. package/dist/search/question-plan.d.ts +2 -0
  112. package/dist/search/question-plan.js +5 -0
  113. package/dist/search/service-query.d.ts +6 -1
  114. package/dist/search/service-query.js +9 -1
  115. package/dist/sends/guard.js +4 -20
  116. package/dist/sends/keyed-guard.d.ts +1 -1
  117. package/dist/sends/keyed-guard.js +2 -1
  118. package/dist/sends/permissions.d.ts +14 -0
  119. package/dist/sends/permissions.js +32 -0
  120. package/dist/services/agenda-mail.js +2 -1
  121. package/dist/services/agenda.js +5 -3
  122. package/dist/services/attachments.js +4 -2
  123. package/dist/services/call-stats.d.ts +17 -0
  124. package/dist/services/call-stats.js +41 -0
  125. package/dist/services/chats.js +4 -2
  126. package/dist/services/conversations.js +4 -2
  127. package/dist/services/deps.d.ts +1 -1
  128. package/dist/services/document-source.d.ts +1 -1
  129. package/dist/services/document-source.js +4 -3
  130. package/dist/services/documents/ingestion.js +11 -40
  131. package/dist/services/documents/plan.d.ts +1 -1
  132. package/dist/services/documents/plan.js +30 -17
  133. package/dist/services/documents/ports.d.ts +5 -0
  134. package/dist/services/documents/sync.js +1 -1
  135. package/dist/services/embeddings-search.js +20 -4
  136. package/dist/services/events-search.js +2 -1
  137. package/dist/services/index.d.ts +1 -0
  138. package/dist/services/index.js +1 -0
  139. package/dist/services/mail-search.d.ts +1 -1
  140. package/dist/services/mail-search.js +10 -11
  141. package/dist/services/media-archive-move.js +2 -4
  142. package/dist/services/media-archive.d.ts +0 -1
  143. package/dist/services/media-archive.js +2 -12
  144. package/dist/services/meeting-combined.js +1 -1
  145. package/dist/services/messages-combined.js +15 -4
  146. package/dist/services/moderation.js +10 -2
  147. package/dist/services/moment.d.ts +4 -10
  148. package/dist/services/moment.js +16 -44
  149. package/dist/services/notes-search.d.ts +0 -2
  150. package/dist/services/notes-search.js +1 -2
  151. package/dist/services/search-all.js +2 -1
  152. package/dist/services/server-search.js +1 -1
  153. package/dist/services/tags.js +4 -2
  154. package/dist/services/task-stats.js +2 -2
  155. package/dist/services/tasks.js +2 -2
  156. package/dist/store/accounts.js +2 -1
  157. package/dist/store/sqlite/account-purge.d.ts +3 -0
  158. package/dist/store/sqlite/account-purge.js +143 -0
  159. package/dist/store/sqlite/accounts.d.ts +0 -2
  160. package/dist/store/sqlite/accounts.js +2 -134
  161. package/dist/store/sqlite/calendar.d.ts +1 -0
  162. package/dist/store/sqlite/calendar.js +5 -5
  163. package/dist/store/sqlite/catalog.js +2 -16
  164. package/dist/store/sqlite/chats.js +2 -1
  165. package/dist/store/sqlite/context-document-source.d.ts +3 -3
  166. package/dist/store/sqlite/context-document-source.js +9 -7
  167. package/dist/store/sqlite/context-evidence.js +9 -3
  168. package/dist/store/sqlite/document-listing.js +2 -1
  169. package/dist/store/sqlite/events.js +2 -1
  170. package/dist/store/sqlite/file-note.d.ts +6 -0
  171. package/dist/store/sqlite/file-note.js +15 -0
  172. package/dist/store/sqlite/files.d.ts +3 -2
  173. package/dist/store/sqlite/files.js +5 -3
  174. package/dist/store/sqlite/identities.js +2 -1
  175. package/dist/store/sqlite/imported-documents.js +2 -2
  176. package/dist/store/sqlite/knowledge.js +19 -19
  177. package/dist/store/sqlite/lucene-fields.js +8 -12
  178. package/dist/store/sqlite/mail-rules.js +2 -1
  179. package/dist/store/sqlite/meeting-calls.d.ts +4 -0
  180. package/dist/store/sqlite/meeting-calls.js +66 -0
  181. package/dist/store/sqlite/meetings.d.ts +2 -2
  182. package/dist/store/sqlite/meetings.js +4 -1
  183. package/dist/store/sqlite/mention-sources.js +2 -1
  184. package/dist/store/sqlite/mentions.js +2 -2
  185. package/dist/store/sqlite/messages.js +6 -1
  186. package/dist/store/sqlite/note-search.js +8 -11
  187. package/dist/store/sqlite/notes.d.ts +2 -0
  188. package/dist/store/sqlite/notes.js +24 -13
  189. package/dist/store/sqlite/organizations.js +2 -2
  190. package/dist/store/sqlite/people-list.js +3 -3
  191. package/dist/store/sqlite/query-filter.d.ts +3 -3
  192. package/dist/store/sqlite/query-filter.js +3 -3
  193. package/dist/store/sqlite/reads.d.ts +4 -4
  194. package/dist/store/sqlite/reads.js +4 -4
  195. package/dist/store/sqlite/search.js +11 -7
  196. package/dist/store/sqlite/test-accounts.js +1 -1
  197. package/dist/store/sqlite/trigram-match.d.ts +9 -0
  198. package/dist/store/sqlite/trigram-match.js +28 -0
  199. package/dist/store/sqlite/work-tasks.js +1 -1
  200. package/package.json +3 -3
  201. package/parity.json +2 -1
@@ -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";
@@ -38,7 +38,6 @@ export declare const meetingTools: ({
38
38
  max_read_bytes?: undefined;
39
39
  cursor?: undefined;
40
40
  } | {
41
- limit?: undefined;
42
41
  event_id?: undefined;
43
42
  series_id?: undefined;
44
43
  page?: undefined;
@@ -54,11 +53,11 @@ export declare const meetingTools: ({
54
53
  format?: undefined;
55
54
  transcript_id?: undefined;
56
55
  query?: undefined;
56
+ limit?: undefined;
57
57
  scan_limit?: undefined;
58
58
  max_read_bytes?: undefined;
59
59
  cursor?: undefined;
60
60
  } | {
61
- limit?: undefined;
62
61
  event_id?: undefined;
63
62
  series_id?: undefined;
64
63
  page?: undefined;
@@ -76,11 +75,11 @@ export declare const meetingTools: ({
76
75
  format?: undefined;
77
76
  transcript_id?: undefined;
78
77
  query?: undefined;
78
+ limit?: undefined;
79
79
  scan_limit?: undefined;
80
80
  max_read_bytes?: undefined;
81
81
  cursor?: undefined;
82
82
  } | {
83
- limit?: undefined;
84
83
  event_id?: undefined;
85
84
  series_id?: undefined;
86
85
  page?: undefined;
@@ -102,6 +101,7 @@ export declare const meetingTools: ({
102
101
  minimum: number;
103
102
  };
104
103
  query?: undefined;
104
+ limit?: undefined;
105
105
  scan_limit?: undefined;
106
106
  max_read_bytes?: undefined;
107
107
  cursor?: undefined;
@@ -188,7 +188,6 @@ export declare const meetingTools: ({
188
188
  max_read_bytes?: undefined;
189
189
  cursor?: undefined;
190
190
  } | {
191
- limit?: undefined;
192
191
  event_id?: undefined;
193
192
  series_id?: undefined;
194
193
  page?: undefined;
@@ -204,11 +203,11 @@ export declare const meetingTools: ({
204
203
  format?: undefined;
205
204
  transcript_id?: undefined;
206
205
  query?: undefined;
206
+ limit?: undefined;
207
207
  scan_limit?: undefined;
208
208
  max_read_bytes?: undefined;
209
209
  cursor?: undefined;
210
210
  } | {
211
- limit?: undefined;
212
211
  event_id?: undefined;
213
212
  series_id?: undefined;
214
213
  page?: undefined;
@@ -226,11 +225,11 @@ export declare const meetingTools: ({
226
225
  format?: undefined;
227
226
  transcript_id?: undefined;
228
227
  query?: undefined;
228
+ limit?: undefined;
229
229
  scan_limit?: undefined;
230
230
  max_read_bytes?: undefined;
231
231
  cursor?: undefined;
232
232
  } | {
233
- limit?: undefined;
234
233
  event_id?: undefined;
235
234
  series_id?: undefined;
236
235
  page?: undefined;
@@ -252,6 +251,7 @@ export declare const meetingTools: ({
252
251
  minimum: number;
253
252
  };
254
253
  query?: undefined;
254
+ limit?: undefined;
255
255
  scan_limit?: undefined;
256
256
  max_read_bytes?: undefined;
257
257
  cursor?: undefined;
@@ -338,7 +338,6 @@ export declare const meetingTools: ({
338
338
  max_read_bytes?: undefined;
339
339
  cursor?: undefined;
340
340
  } | {
341
- limit?: undefined;
342
341
  event_id?: undefined;
343
342
  series_id?: undefined;
344
343
  page?: undefined;
@@ -354,11 +353,11 @@ export declare const meetingTools: ({
354
353
  format?: undefined;
355
354
  transcript_id?: undefined;
356
355
  query?: undefined;
356
+ limit?: undefined;
357
357
  scan_limit?: undefined;
358
358
  max_read_bytes?: undefined;
359
359
  cursor?: undefined;
360
360
  } | {
361
- limit?: undefined;
362
361
  event_id?: undefined;
363
362
  series_id?: undefined;
364
363
  page?: undefined;
@@ -376,11 +375,11 @@ export declare const meetingTools: ({
376
375
  format?: undefined;
377
376
  transcript_id?: undefined;
378
377
  query?: undefined;
378
+ limit?: undefined;
379
379
  scan_limit?: undefined;
380
380
  max_read_bytes?: undefined;
381
381
  cursor?: undefined;
382
382
  } | {
383
- limit?: undefined;
384
383
  event_id?: undefined;
385
384
  series_id?: undefined;
386
385
  page?: undefined;
@@ -402,6 +401,7 @@ export declare const meetingTools: ({
402
401
  minimum: number;
403
402
  };
404
403
  query?: undefined;
404
+ limit?: undefined;
405
405
  scan_limit?: undefined;
406
406
  max_read_bytes?: undefined;
407
407
  cursor?: undefined;
@@ -488,7 +488,6 @@ export declare const meetingTools: ({
488
488
  max_read_bytes?: undefined;
489
489
  cursor?: undefined;
490
490
  } | {
491
- limit?: undefined;
492
491
  event_id?: undefined;
493
492
  series_id?: undefined;
494
493
  page?: undefined;
@@ -504,11 +503,11 @@ export declare const meetingTools: ({
504
503
  format?: undefined;
505
504
  transcript_id?: undefined;
506
505
  query?: undefined;
506
+ limit?: undefined;
507
507
  scan_limit?: undefined;
508
508
  max_read_bytes?: undefined;
509
509
  cursor?: undefined;
510
510
  } | {
511
- limit?: undefined;
512
511
  event_id?: undefined;
513
512
  series_id?: undefined;
514
513
  page?: undefined;
@@ -526,11 +525,11 @@ export declare const meetingTools: ({
526
525
  format?: undefined;
527
526
  transcript_id?: undefined;
528
527
  query?: undefined;
528
+ limit?: undefined;
529
529
  scan_limit?: undefined;
530
530
  max_read_bytes?: undefined;
531
531
  cursor?: undefined;
532
532
  } | {
533
- limit?: undefined;
534
533
  event_id?: undefined;
535
534
  series_id?: undefined;
536
535
  page?: undefined;
@@ -552,6 +551,7 @@ export declare const meetingTools: ({
552
551
  minimum: number;
553
552
  };
554
553
  query?: undefined;
554
+ limit?: undefined;
555
555
  scan_limit?: undefined;
556
556
  max_read_bytes?: undefined;
557
557
  cursor?: undefined;
@@ -638,7 +638,6 @@ export declare const meetingTools: ({
638
638
  max_read_bytes?: undefined;
639
639
  cursor?: undefined;
640
640
  } | {
641
- limit?: undefined;
642
641
  event_id?: undefined;
643
642
  series_id?: undefined;
644
643
  page?: undefined;
@@ -654,11 +653,11 @@ export declare const meetingTools: ({
654
653
  format?: undefined;
655
654
  transcript_id?: undefined;
656
655
  query?: undefined;
656
+ limit?: undefined;
657
657
  scan_limit?: undefined;
658
658
  max_read_bytes?: undefined;
659
659
  cursor?: undefined;
660
660
  } | {
661
- limit?: undefined;
662
661
  event_id?: undefined;
663
662
  series_id?: undefined;
664
663
  page?: undefined;
@@ -676,11 +675,11 @@ export declare const meetingTools: ({
676
675
  format?: undefined;
677
676
  transcript_id?: undefined;
678
677
  query?: undefined;
678
+ limit?: undefined;
679
679
  scan_limit?: undefined;
680
680
  max_read_bytes?: undefined;
681
681
  cursor?: undefined;
682
682
  } | {
683
- limit?: undefined;
684
683
  event_id?: undefined;
685
684
  series_id?: undefined;
686
685
  page?: undefined;
@@ -702,6 +701,7 @@ export declare const meetingTools: ({
702
701
  minimum: number;
703
702
  };
704
703
  query?: undefined;
704
+ limit?: undefined;
705
705
  scan_limit?: undefined;
706
706
  max_read_bytes?: undefined;
707
707
  cursor?: undefined;
@@ -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