@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
@@ -20,6 +20,7 @@ export const PROVIDERS = [
20
20
  { name: "added", kind: "notes", aliases: [] },
21
21
  { name: "zoom", kind: "meetings", aliases: [] },
22
22
  { name: "google-meet", kind: "meetings", aliases: [], command: "gmeet" },
23
+ { name: "google-drive", kind: "documents", aliases: [] },
23
24
  // Its meetings come from the notes Telemost mails (`keeper@telemost.yandex.ru`), read by a mail rule.
24
25
  { name: "telemost", kind: "meetings", aliases: [] },
25
26
  // A phone export's records: its SMS and its calls in the one account the import names.
@@ -55,11 +56,15 @@ export const folderProviderSql = (column = "provider") => `${column} IN (${FOLDE
55
56
  export const folderProviderOf = (format) => format === "markdown" ? "local" : "obsidian";
56
57
  /**
57
58
  * Providers whose account holds documents the way a notes folder does: one account per remote principal, its
58
- * files as `documents` rows (store version 31 moved Drive here from a `folder` named `google-drive:<principal>`).
59
- * The provider registry's `documents` kind replaces this list when Drive leaves `notes` (Wave 3 R2).
59
+ * files as `documents` rows. Any registry entry of kind `documents` that a sync fills; an import-only one (`import`)
60
+ * keeps its documents beside its other records instead.
60
61
  */
61
- export const DOCUMENT_ACCOUNT_PROVIDERS = ["google-drive"];
62
- export const isDocumentAccountProvider = (provider) => DOCUMENT_ACCOUNT_PROVIDERS.includes(provider);
62
+ export const documentAccountProviders = () => registry.filter((entry) => entry.kind === "documents" && entry.imported !== true).map(({ name }) => name);
63
+ export const isDocumentAccountProvider = (provider) => typeof provider === "string" && documentAccountProviders().includes(provider);
64
+ /** The documents account providers as a SQL list, for `IN (…)`; names are checked words, so they need no binding. */
65
+ export const documentAccountProvidersSql = () => documentAccountProviders()
66
+ .map((name) => `'${name}'`)
67
+ .join(", ") || "NULL";
63
68
  /**
64
69
  * What the owner adds by hand (`saveAddedSource`): one account, `owner`. Neither a folder nor a documents account, so no
65
70
  * folder can be bound to it and no sync deletes a source whose file is gone.
@@ -69,7 +74,7 @@ export const ADDED_ACCOUNT = "owner";
69
74
  /** Documents `d` outside the added sources: a folder file joined to one would delete it when the file goes. */
70
75
  export const notAdded = `d.account_id NOT IN (SELECT id FROM accounts WHERE provider = '${ADDED_PROVIDER}')`;
71
76
  /** A folder, a documents account or the added sources, in SQL over an `accounts` row's `provider` column. */
72
- export const filesAccountSql = (column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...DOCUMENT_ACCOUNT_PROVIDERS, ADDED_PROVIDER].map((name) => `'${name}'`).join(", ")})`;
77
+ export const filesAccountSql = (column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...documentAccountProviders(), ADDED_PROVIDER].map((name) => `'${name}'`).join(", ")})`;
73
78
  /** Notes written in memo have no account row; this is their account. */
74
79
  export const INTERNAL_NOTES = "internal";
75
80
  /** The reason a search gives for an account whose provider no entry names. */
@@ -1,7 +1,6 @@
1
1
  /**
2
- * `--at-time`: a time like `2026-09-25T09:00`, or a delay like `30m`, `2h`, `1d`, as an ISO time — the
3
- * same words max-cli takes. Rounded down to the minute, because messengers send at the start of it
4
- * (MAX measured, max-cli `FIND-141`), so the time printed is the time it goes. A time without an
5
- * offset is read in `zone`, the computer's zone when none is given.
2
+ * `--at-time`, a mute's `--until`, a link's `--expire-time`: `aheadOf` within the messenger's limits of a minute to a
3
+ * year, and never a date alone. Rounded down to the minute, because messengers send at the start of it (MAX measured,
4
+ * max-cli `FIND-141`), so the time printed is the time it goes.
6
5
  */
7
6
  export declare const sendTime: (value: string, now?: number, flag?: string, zone?: string) => string;
@@ -1,29 +1,15 @@
1
- import { CliError } from "@wirecat/cli-base";
2
- import { calendarMoment } from "./moment.js";
3
- const MINUTE = 60_000;
4
- const YEAR = 365 * 24 * 60 * MINUTE;
5
- const DELAY = /^(\d+)(m|h|d)$/;
6
- const UNIT_MS = { m: MINUTE, h: 60 * MINUTE, d: 24 * 60 * MINUTE };
1
+ import { aheadOf, MINUTE, YEAR } from "./moment.js";
7
2
  /**
8
- * `--at-time`: a time like `2026-09-25T09:00`, or a delay like `30m`, `2h`, `1d`, as an ISO time — the
9
- * same words max-cli takes. Rounded down to the minute, because messengers send at the start of it
10
- * (MAX measured, max-cli `FIND-141`), so the time printed is the time it goes. A time without an
11
- * offset is read in `zone`, the computer's zone when none is given.
3
+ * `--at-time`, a mute's `--until`, a link's `--expire-time`: `aheadOf` within the messenger's limits of a minute to a
4
+ * year, and never a date alone. Rounded down to the minute, because messengers send at the start of it (MAX measured,
5
+ * max-cli `FIND-141`), so the time printed is the time it goes.
12
6
  */
13
7
  export const sendTime = (value, now = Date.now(), flag = "--at-time", zone) => {
14
- const trimmed = value.trim();
15
- const [, amount, unit] = DELAY.exec(trimmed) ?? [];
16
- const at = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(trimmed)
17
- ? calendarMoment(trimmed.replace(" ", "T"), flag, zone === undefined ? {} : { zone })
18
- : amount && unit
19
- ? now + Number(amount) * (UNIT_MS[unit] ?? 0)
20
- : Number.NaN;
21
- if (Number.isNaN(at)) {
22
- throw new CliError("validation_error", `${flag} takes a time like 2026-09-25T09:00 or a delay like 30m, 2h, 1d — not "${value}"`);
23
- }
24
- if (at < now + MINUTE)
25
- throw new CliError("validation_error", `${flag} has to be at least a minute from now`);
26
- if (at > now + YEAR)
27
- throw new CliError("validation_error", `${flag} can be at most a year from now`);
8
+ const at = aheadOf(value, flag, now, {
9
+ ...(zone === undefined ? {} : { zone }),
10
+ refuseDate: true,
11
+ soonest: MINUTE,
12
+ latest: YEAR,
13
+ });
28
14
  return new Date(at - (at % MINUTE)).toISOString();
29
15
  };
@@ -4,8 +4,8 @@ export { reference };
4
4
  export declare const text: v.StringSchema<undefined>;
5
5
  export declare const id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
6
6
  export declare const time: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
7
- /** A time a caller sends: any offset, read as the moment it names. Answers carry `time`, always UTC. */
8
- export declare const zonedTime: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>;
7
+ /** A time a caller types, read by the shared past-time grammar (`momentOf`). Answers carry `time`, always UTC. */
8
+ export declare const typedTime: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>;
9
9
  export declare const count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
10
10
  /** Fields of an answer item someone other than the owner wrote, as dotted paths: an agent reads them as data. */
11
11
  export declare const untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
@@ -5,8 +5,8 @@ export { reference };
5
5
  export const text = v.string();
6
6
  export const id = v.pipe(v.string(), v.minLength(1));
7
7
  export const time = isoTime;
8
- /** A time a caller sends: any offset, read as the moment it names. Answers carry `time`, always UTC. */
9
- export const zonedTime = v.pipe(v.string(), v.isoTimestamp("an ISO 8601 time with a zone"));
8
+ /** A time a caller types, read by the shared past-time grammar (`momentOf`). Answers carry `time`, always UTC. */
9
+ export const typedTime = v.pipe(v.string(), v.minLength(1), v.maxLength(64), v.description("an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago"));
10
10
  export const count = v.pipe(v.number(), v.integer(), v.minValue(0));
11
11
  /** Fields of an answer item someone other than the owner wrote, as dotted paths: an agent reads them as data. */
12
12
  export const untrusted = v.optional(v.array(text));
@@ -6579,6 +6579,97 @@ export declare const ENTITIES: {
6579
6579
  }, undefined>, undefined>;
6580
6580
  readonly has_more: v.BooleanSchema<undefined>;
6581
6581
  }, undefined>;
6582
+ readonly call_stats: v.GenericSchema<{
6583
+ time_zone: string;
6584
+ callback_within_ms: number;
6585
+ short_call_under_ms: number;
6586
+ calls: number;
6587
+ not_calls: number;
6588
+ known: {
6589
+ direction: number;
6590
+ outcome: number;
6591
+ wait_ms: number;
6592
+ talk_ms: number;
6593
+ duration_ms: number;
6594
+ roles: number;
6595
+ };
6596
+ by_direction?: {
6597
+ [x: string]: number;
6598
+ } | undefined;
6599
+ by_outcome?: {
6600
+ [x: string]: number;
6601
+ } | undefined;
6602
+ talk_ms?: number | undefined;
6603
+ mean_talk_ms?: number | undefined;
6604
+ duration_ms?: number | undefined;
6605
+ mean_wait_ms?: number | null | undefined;
6606
+ max_wait_ms?: number | null | undefined;
6607
+ short_calls?: number | undefined;
6608
+ employees: {
6609
+ key: string;
6610
+ name: string | null;
6611
+ identity_id: number | null;
6612
+ extension: string | null;
6613
+ calls: number;
6614
+ incoming: number;
6615
+ outgoing: number;
6616
+ internal: number;
6617
+ placed?: number | undefined;
6618
+ answered?: number | undefined;
6619
+ rang_not_answered?: number | undefined;
6620
+ talk_ms?: number | undefined;
6621
+ mean_talk_ms?: number | null | undefined;
6622
+ mean_wait_ms?: number | null | undefined;
6623
+ max_wait_ms?: number | null | undefined;
6624
+ }[];
6625
+ hours: {
6626
+ calls: number;
6627
+ incoming: number;
6628
+ outgoing: number;
6629
+ internal: number;
6630
+ answered?: number | undefined;
6631
+ missed?: number | undefined;
6632
+ talk_ms?: number | undefined;
6633
+ hour: number;
6634
+ }[];
6635
+ days: {
6636
+ calls: number;
6637
+ incoming: number;
6638
+ outgoing: number;
6639
+ internal: number;
6640
+ answered?: number | undefined;
6641
+ missed?: number | undefined;
6642
+ talk_ms?: number | undefined;
6643
+ date: string;
6644
+ }[];
6645
+ missed?: {
6646
+ calls: number;
6647
+ called_back: number;
6648
+ not_called_back: number;
6649
+ unknown_callback: number;
6650
+ unknown_outcome: number;
6651
+ items: {
6652
+ ref: string;
6653
+ meeting_id: number;
6654
+ started_at: string | null;
6655
+ outcome: "busy" | "no_answer" | "voicemail";
6656
+ client: {
6657
+ key: string;
6658
+ name: string | null;
6659
+ } | null;
6660
+ rang: string[];
6661
+ called_back?: boolean | undefined;
6662
+ callback?: {
6663
+ ref: string;
6664
+ meeting_id: number;
6665
+ started_at: string | null;
6666
+ after_ms: number;
6667
+ direction: "incoming" | "outgoing";
6668
+ } | null | undefined;
6669
+ }[];
6670
+ has_more: boolean;
6671
+ } | undefined;
6672
+ }>;
6582
6673
  readonly meeting_speaker: v.StrictObjectSchema<{
6583
6674
  readonly key: v.StringSchema<undefined>;
6584
6675
  readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
@@ -11967,7 +12058,7 @@ export declare const ENTITIES: {
11967
12058
  export type EntityName = keyof typeof ENTITIES;
11968
12059
  /** Every entity as a JSON Schema 2020-12 `$defs` entry, for bundling into an MCP tool's `outputSchema`. */
11969
12060
  export declare const entityDefinitions: () => Record<EntityName, unknown>;
11970
- export { zonedTime } from "./fields.js";
12061
+ export { typedTime } from "./fields.js";
11971
12062
  export { mailFindings } from "./mail-findings.js";
11972
12063
  export { meetingFindings } from "./meeting-findings.js";
11973
12064
  export { meetingPreparation } from "./meeting-preparation.js";
@@ -49,7 +49,7 @@ import { messageEvent, serveSummary, watchedMessage, watchItem } from "./listene
49
49
  import { mailCounts } from "./mail-counts.js";
50
50
  import { mailFindings } from "./mail-findings.js";
51
51
  import { mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer } from "./media-archive.js";
52
- import { event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "./meeting.js";
52
+ import { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "./meeting.js";
53
53
  import { meetingEvidence, meetingPersonContext } from "./meeting-evidence.js";
54
54
  import { meetingFindings } from "./meeting-findings.js";
55
55
  import { meetingPreparation } from "./meeting-preparation.js";
@@ -275,6 +275,7 @@ export const ENTITIES = {
275
275
  meeting_link: meetingLink,
276
276
  meeting_stats: meetingStats,
277
277
  meeting_counts: meetingCounts,
278
+ call_stats: callStats,
278
279
  meeting_speaker: meetingSpeaker,
279
280
  meeting_participants: meetingParticipants,
280
281
  meeting_passage: meetingPassage,
@@ -395,7 +396,7 @@ export const entityDefinitions = () => Object.fromEntries(Object.entries(ENTITIE
395
396
  const { $schema: _, ...definition } = jsonSchemaOf(schema);
396
397
  return [name, definition];
397
398
  }));
398
- export { zonedTime } from "./fields.js";
399
+ export { typedTime } from "./fields.js";
399
400
  export { mailFindings } from "./mail-findings.js";
400
401
  export { meetingFindings } from "./meeting-findings.js";
401
402
  export { meetingPreparation } from "./meeting-preparation.js";
@@ -1 +1 @@
1
- export { event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "../meetings/index.js";
1
+ export { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "../meetings/index.js";
@@ -1 +1 @@
1
- export { event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "../meetings/index.js";
1
+ export { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "../meetings/index.js";
@@ -312,7 +312,6 @@ const OTHERS = [
312
312
  ],
313
313
  ["store.vector-extension-failed", "configuration_error", "the sqlite-vec extension did not load; reinstall the CLI"],
314
314
  validation("store.vector-invalid", "a vector to store had a non-finite value"),
315
- validation("catalog.scope-limit", "the selected catalog exceeds its entry limit"),
316
315
  validation("evidence.quote-length", "a quote from the evidence is empty or over 500 characters"),
317
316
  validation("evidence.quote-not-found", "the cited source does not say the quoted words"),
318
317
  validation("evidence.row-too-large", "one evidence row is over its size limit"),
@@ -1,6 +1,6 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { annotate, sharedCommand } from "@wirecat/cli-base/commands";
3
- import { queryFieldsOf } from "@wirecat/cli-base/query";
3
+ import { queryFieldsOf, timezoneOf } from "@wirecat/cli-base/query";
4
4
  import { Command, InvalidArgumentError } from "commander";
5
5
  import * as v from "valibot";
6
6
  import { answerEntity } from "../../cli/answer-entity.js";
@@ -301,7 +301,9 @@ const conversationsCommand = (mail) => {
301
301
  const account = await store.accounts.storedAccount(mailbox).catch(absentAccount);
302
302
  if (!account)
303
303
  return { threads: [], mailbox };
304
- const where = query ? queryFilter(query, THREAD_COLUMNS, { command: "conversations list" }) : undefined;
304
+ const where = query
305
+ ? queryFilter(query, THREAD_COLUMNS, { command: "conversations list", zone: timezoneOf() })
306
+ : undefined;
305
307
  const threads = await store.mail.threads({
306
308
  accountId: account.id,
307
309
  limit: limit + 1,
@@ -1,9 +1,12 @@
1
1
  import type { MailFacts, MailRule } from "./rules.js";
2
2
  import type { DomainAge } from "./score.js";
3
3
  import type { Listed } from "./source.js";
4
+ /** Of these addresses, the ones the owner wrote to in mail the store holds: `store.mail.writtenTo`. */
5
+ export type WrittenTo = (addresses: readonly string[]) => Promise<ReadonlySet<string>>;
4
6
  /**
5
7
  * What a rule can know of each listed email. A score and "the owner wrote to this sender" come from the sender's
6
8
  * whole group in this listing, so they are worked out only when a rule needs them; a run that lists only new mail
7
- * judges them from that mail.
9
+ * judges the score from that mail. "Wrote to" also reads the stored outgoing mail, so a resumed run or an account
10
+ * synced without Sent still knows a correspondent.
8
11
  */
9
- export declare const factsOf: (listed: Listed[], rules: readonly MailRule[], ages?: ReadonlyMap<string, DomainAge>) => ((item: Listed) => MailFacts);
12
+ export declare const factsOf: (listed: Listed[], rules: readonly MailRule[], writtenTo: WrittenTo, ages?: ReadonlyMap<string, DomainAge>) => Promise<(item: Listed) => MailFacts>;
@@ -2,13 +2,16 @@ import { groupKey, probeMail } from "./probe.js";
2
2
  /**
3
3
  * What a rule can know of each listed email. A score and "the owner wrote to this sender" come from the sender's
4
4
  * whole group in this listing, so they are worked out only when a rule needs them; a run that lists only new mail
5
- * judges them from that mail.
5
+ * judges the score from that mail. "Wrote to" also reads the stored outgoing mail, so a resumed run or an account
6
+ * synced without Sent still knows a correspondent.
6
7
  */
7
- export const factsOf = (listed, rules, ages = new Map()) => {
8
+ export const factsOf = async (listed, rules, writtenTo, ages = new Map()) => {
8
9
  const grouped = rules.some(({ match }) => match.score_at_least !== undefined || match.preset !== undefined);
9
10
  if (!grouped)
10
11
  return (item) => item;
11
- const groups = new Map(probeMail(listed, Number.POSITIVE_INFINITY, ages).items.map((group) => [
12
+ const senders = [...new Set(listed.flatMap((item) => item.headers?.from ?? []))];
13
+ const written = await writtenTo(senders);
14
+ const groups = new Map(probeMail(listed, Number.POSITIVE_INFINITY, ages, written).items.map((group) => [
12
15
  groupKey({
13
16
  ...(group.from === null ? {} : { from: group.from }),
14
17
  ...(group.listId === null ? {} : { listId: group.listId }),
@@ -2,7 +2,7 @@ export { mailOwnText } from "../conversations/mail-text.js";
2
2
  export { mailAccountKey } from "./account-key.js";
3
3
  export { DEFAULT_ATTACHMENT_POLICY, type MailAttachmentPolicy, POLICY_SKIPS } from "./attachments.js";
4
4
  export { BULK, bulkBox } from "./bulk.js";
5
- export { factsOf } from "./facts.js";
5
+ export { factsOf, type WrittenTo } from "./facts.js";
6
6
  export { MAIL_FINDING_FIELDS, MAIL_FINDINGS_KIND, MAIL_FINDINGS_PER_RUN, MAIL_FINDINGS_PER_SENDER, type MailFinding, type MailFindingsInput, mailFindingFieldsHelp, mailFindingFingerprint, validateMailFindings, } from "./findings.js";
7
7
  export { GMAIL_ALL_MAIL, mailFolders } from "./folders.js";
8
8
  export { dropMissing, type Gone, tooManyGone } from "./gone.js";
@@ -116,7 +116,7 @@ export const mailMeetingSource = ({ store, meetings, address, rules, provider, a
116
116
  if (stored === null)
117
117
  return [];
118
118
  const listed = (await candidateFacts(store, stored.id, Date.parse(since), ruling)).map(listedOf);
119
- const factsFor = factsOf(listed, ruling);
119
+ const factsFor = await factsOf(listed, ruling, (addresses) => store.mail.writtenTo(addresses));
120
120
  const saved = accountId === undefined ? [] : await meetings.meetings({ accountId, includeDeleted: true });
121
121
  const linked = new Map(saved.flatMap(({ externalId, eventId }) => (eventId === null ? [] : [[externalId, eventId]])));
122
122
  const events = new Map(linked.size ? (await meetings.events()).map((event) => [event.id, event]) : []);
@@ -43,7 +43,10 @@ export declare const groupKey: (headers: {
43
43
  from?: string;
44
44
  listId?: string;
45
45
  }) => string;
46
- /** Groups mail by List-Id when it has one, else by sender address; largest groups first. */
47
- export declare const probeMail: (items: Listed[], limit: number, ages?: ReadonlyMap<string, DomainAge>) => Probe;
46
+ /**
47
+ * Groups mail by List-Id when it has one, else by sender address; largest groups first. `written` holds addresses the
48
+ * owner wrote to outside this listing (stored outgoing mail), so a listing without Sent still knows a correspondent.
49
+ */
50
+ export declare const probeMail: (items: Listed[], limit: number, ages?: ReadonlyMap<string, DomainAge>, written?: ReadonlySet<string>) => Probe;
48
51
  /** The sender domains of the groups worth asking a registry about: not a big mailbox provider, never replied to. */
49
52
  export declare const domainsToAge: (groups: ProbeGroup[], skip: ReadonlySet<string>) => string[];
@@ -6,10 +6,14 @@ const share = (part, whole) => Math.round((part / whole) * 100) / 100;
6
6
  const isSent = (item) => item.labels?.includes("Sent") || /(^|\/)sent\b/i.test(item.folder ?? "");
7
7
  /** A list's mail is one group whoever sends it; other mail is grouped by sender. */
8
8
  export const groupKey = (headers) => headers.listId === undefined ? `from:${headers.from}` : `list:${headers.listId}`;
9
- /** Groups mail by List-Id when it has one, else by sender address; largest groups first. */
10
- export const probeMail = (items, limit, ages = new Map()) => {
9
+ /**
10
+ * Groups mail by List-Id when it has one, else by sender address; largest groups first. `written` holds addresses the
11
+ * owner wrote to outside this listing (stored outgoing mail), so a listing without Sent still knows a correspondent.
12
+ */
13
+ export const probeMail = (items, limit, ages = new Map(), written = new Set()) => {
11
14
  const sent = items.filter(isSent);
12
- const recipients = new Set(sent.flatMap((item) => item.headers?.to ?? []));
15
+ const recipients = new Set([...written, ...sent.flatMap((item) => item.headers?.to ?? [])].map((to) => to.toLowerCase()));
16
+ const wrote = (sender) => recipients.has(sender.toLowerCase());
13
17
  const groups = new Map();
14
18
  let withoutHeaders = 0;
15
19
  for (const item of items) {
@@ -32,7 +36,7 @@ export const probeMail = (items, limit, ages = new Map()) => {
32
36
  const known = group.filter((item) => item.seen !== undefined);
33
37
  const years = group.map((item) => new Date(item.receivedAt).getUTCFullYear());
34
38
  const bulk = share(group.filter((item) => item.headers?.bulk).length, group.length);
35
- const replied = [...senders].some((sender) => recipients.has(sender));
39
+ const replied = [...senders].some(wrote);
36
40
  return {
37
41
  from: [...senders][0] ?? null,
38
42
  listId: group[0]?.headers?.listId ?? null,
@@ -49,7 +53,7 @@ export const probeMail = (items, limit, ages = new Map()) => {
49
53
  });
50
54
  const presets = PRESET_NAMES.map((preset) => {
51
55
  const hit = [...groups.values()].filter((group) => {
52
- const replied = group.some((item) => item.headers?.from !== undefined && recipients.has(item.headers.from));
56
+ const replied = group.some((item) => item.headers?.from !== undefined && wrote(item.headers.from));
53
57
  return presetMatches(preset, { ...group[0], replied });
54
58
  });
55
59
  return {
@@ -138,7 +138,7 @@ export const searchMailServer = async (store, mailbox, access, request) => {
138
138
  return;
139
139
  const unique = [...new Map(listed.map((item) => [item.messageId, item])).values()];
140
140
  rules = await storedMailRules(store, { address: mailbox.account });
141
- const facts = factsOf(unique, rules);
141
+ const facts = await factsOf(unique, rules, (addresses) => store.mail.writtenTo(addresses));
142
142
  for (const item of unique) {
143
143
  const held = (await store.mail.email(accountId, item.messageId)) !== null;
144
144
  const rule = decide(rules, facts(item));
package/dist/mail/sync.js CHANGED
@@ -397,7 +397,7 @@ const syncRound = async (source, store, { account, since, max = 200, maxBodyChar
397
397
  // By the instant, not the text: a source may give times with an offset, and "+02:00" sorts as text, not as time.
398
398
  const listed = [...new Map(collected.map((item) => [item.messageId, item])).values()].sort((a, b) => Date.parse(b.receivedAt) - Date.parse(a.receivedAt));
399
399
  const present = new Set(listed.map(({ messageId }) => messageId));
400
- const factsFor = factsOf(listed, rules, ages);
400
+ const factsFor = await factsOf(listed, rules, (addresses) => store.mail.writtenTo(addresses), ages);
401
401
  // A rule's tag goes on mail this run stores or records; mail stored earlier gets it from memo mail rules apply.
402
402
  const tagger = ruleTagger(store, key);
403
403
  const tagStored = async (item) => {
@@ -17,7 +17,7 @@ const inputs = {
17
17
  /** `communications: true` from a host that connects a messages source; without one the argument could only refuse. */
18
18
  export const meetingPreparationTool = ({ communications = false } = {}) => ({
19
19
  name: "meeting_prepare",
20
- description: `Prepare cited context for one exact provider series in the server's selected account. Reads remote upcoming proof and bounded stored history, related meeting transcripts through explicit people/confirmed project links, accepted meeting facts and directly sourced tasks; performs no writes. Optional project selects one existing project name/key/alias for up to four bounded word-evidence pages across the selected account and history window; matches remain unconfirmed and do not infer membership. ${communications ? "Optional communications searches only explicit host-captured source IDs with literal words, bounded excerpts and independent index/read/output coverage; it does not infer identity or project membership. Each source may resume with its opaque cursor; restart_required means narrow or restart that selection rather than advancing. " : ""}Optional ISO windows default to now, seven days ahead and thirty days of history. Coverage identifies incomplete and unqueried context. ${UNTRUSTED_NEUTRAL}`,
20
+ description: `Prepare cited context for one exact provider series in the server's selected account. Reads remote upcoming proof and bounded stored history, related meeting transcripts through explicit people/confirmed project links, accepted meeting facts and directly sourced tasks; performs no writes. Optional project selects one existing project name/key/alias for up to four bounded word-evidence pages across the selected account and history window; matches remain unconfirmed and do not infer membership. ${communications ? "Optional communications searches only explicit host-captured source IDs with literal words, bounded excerpts and independent index/read/output coverage; it does not infer identity or project membership. Each source may resume with its opaque cursor; restart_required means narrow or restart that selection rather than advancing. " : ""}Optional windows (an ISO date or time, local without a zone, or 7d ago) default to now, seven days ahead and thirty days of history. Coverage identifies incomplete and unqueried context. ${UNTRUSTED_NEUTRAL}`,
21
21
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
22
22
  inputSchema: { ...(communications ? inputs.with : inputs.without), type: "object" },
23
23
  outputSchema: { ...outputSchema, type: "object" },
@@ -10,7 +10,7 @@ const outputSchema = {
10
10
  };
11
11
  export const meetingSeriesInventoryTool = {
12
12
  name: "meeting_series_inventory",
13
- description: `Discover one bounded page of series candidates in the host's selected provider/account. ISO after/until default to now and seven days ahead. Provider inventory may contain undated or past recurring start hints; these never prove the next occurrence or calendar completeness. Continue with page.next_cursor and the returned absolute after/until. No store writes or automatic selection. ${UNTRUSTED_NEUTRAL}`,
13
+ description: `Discover one bounded page of series candidates in the host's selected provider/account. after/until (an ISO date or time, local without a zone, or 7d ago) default to now and seven days ahead. Provider inventory may contain undated or past recurring start hints; these never prove the next occurrence or calendar completeness. Continue with page.next_cursor and the returned absolute after/until. No store writes or automatic selection. ${UNTRUSTED_NEUTRAL}`,
14
14
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
15
15
  inputSchema: { ...inputSchema, type: "object" },
16
16
  outputSchema: { ...outputSchema, type: "object" },
@@ -14,16 +14,13 @@ const asked = (text) => ({
14
14
  */
15
15
  const call = (tool, command, args = {}) => `${tool} with ${JSON.stringify(Object.keys(args).length > 0 ? { command, arguments: args } : { command })}`;
16
16
  /**
17
- * The owner's time as a query term the query language reads: `1d ago` as `1d`, and an ISO time as the full UTC instant,
18
- * since the query refuses a time without seconds or a zone that `--since-time` takes. A time that does not read stays
19
- * as typed, so the tool's error names it.
17
+ * The owner's time as a query term every query language version reads: the full UTC instant, whatever the owner
18
+ * typed (`1d ago`, `today`, a time without seconds or a zone). A time that does not read stays as typed, so the
19
+ * tool's error names it.
20
20
  */
21
21
  const after = (time) => {
22
- const ago = /^(\d+[mhd])(?:\s+ago)?$/.exec(time.trim())?.[1];
23
- if (ago)
24
- return `date>${ago}`;
25
22
  try {
26
- return `date>${JSON.stringify(new Date(momentOf(time)).toISOString())}`;
23
+ return `date>${JSON.stringify(new Date(momentOf(time.trim().replace(/\s+ago$/i, ""))).toISOString())}`;
27
24
  }
28
25
  catch {
29
26
  return `date>${JSON.stringify(time)}`;
@@ -50,7 +47,7 @@ export const registerPrompts = (server, { command, name }) => {
50
47
  argsSchema: toStandardJsonSchema(v.object({
51
48
  kind: v.optional(v.pipe(v.string(), v.description("dialog, group or channel, comma-separated; every kind if not given"))),
52
49
  mode: v.optional(v.pipe(v.string(), v.description("unread (the messenger's read marks, the default), new (since the last catch-up with new), " +
53
- "or a time: ISO 8601, or 2h / 1d ago"))),
50
+ "or a time: ISO 8601, today, yesterday, or 2h / 1d ago"))),
54
51
  })),
55
52
  }, ({ kind, mode }) => {
56
53
  const kinds = kind
@@ -107,7 +104,7 @@ export const registerPrompts = (server, { command, name }) => {
107
104
  description: "What the owner owes, what others owe, what needs clarifying — since the last review. Reads only; " +
108
105
  "reminders are drafts until the owner approves each one.",
109
106
  argsSchema: toStandardJsonSchema(v.object({
110
- since: v.optional(v.pipe(v.string(), v.description("where the last review ended: an ISO 8601 time, or 2h / 1d ago"))),
107
+ since: v.optional(v.pipe(v.string(), v.description("where the last review ended: an ISO 8601 time, today, yesterday, or 2h / 1d ago"))),
111
108
  groups: v.optional(v.pipe(v.string(), v.description("group chats where work gets done, by name or id, comma-separated"))),
112
109
  })),
113
110
  }, ({ since, groups }) => asked([
@@ -0,0 +1,106 @@
1
+ import * as v from "valibot";
2
+ import type { CallStats } from "./call-stats.js";
3
+ /**
4
+ * `stats calls show`: layer-1 numbers over stored phone calls. Counts are over the calls that give the field, and
5
+ * `known` says how many do; a key no call gives is absent, never zero.
6
+ */
7
+ declare const callStatsSchema: v.StrictObjectSchema<{
8
+ readonly time_zone: v.StringSchema<undefined>;
9
+ readonly callback_within_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
10
+ readonly short_call_under_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
11
+ readonly calls: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
12
+ /** Selected meetings that are not calls. */
13
+ readonly not_calls: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
14
+ /** How many calls give each field; `roles` says who placed, answered and rang. */
15
+ readonly known: v.StrictObjectSchema<{
16
+ readonly direction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
17
+ readonly outcome: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
18
+ readonly wait_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
19
+ readonly talk_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
20
+ readonly duration_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
21
+ readonly roles: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
22
+ }, undefined>;
23
+ readonly by_direction: v.ExactOptionalSchema<v.StrictObjectSchema<Record<string, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>>, undefined>, undefined>;
24
+ readonly by_outcome: v.ExactOptionalSchema<v.StrictObjectSchema<Record<string, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>>, undefined>, undefined>;
25
+ readonly talk_ms: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
26
+ readonly mean_talk_ms: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
27
+ readonly duration_ms: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
28
+ readonly mean_wait_ms: v.ExactOptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
29
+ readonly max_wait_ms: v.ExactOptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
30
+ readonly short_calls: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
31
+ readonly employees: v.ArraySchema<v.StrictObjectSchema<{
32
+ /** `extension:<number>`, or `identity:<id>` where the provider names no extension. */
33
+ readonly key: v.StringSchema<undefined>;
34
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
35
+ readonly identity_id: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
36
+ readonly extension: v.NullableSchema<v.StringSchema<undefined>, undefined>;
37
+ readonly calls: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
38
+ readonly incoming: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
39
+ readonly outgoing: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
40
+ readonly internal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
41
+ readonly placed: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
42
+ readonly answered: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
43
+ readonly rang_not_answered: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
44
+ readonly talk_ms: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
45
+ readonly mean_talk_ms: v.ExactOptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
46
+ readonly mean_wait_ms: v.ExactOptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
47
+ readonly max_wait_ms: v.ExactOptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
48
+ }, undefined>, undefined>;
49
+ /** Hours 0–23 in `time_zone`. */
50
+ readonly hours: v.ArraySchema<v.StrictObjectSchema<{
51
+ readonly calls: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
52
+ readonly incoming: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
53
+ readonly outgoing: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
54
+ readonly internal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
55
+ readonly answered: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
56
+ readonly missed: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
57
+ readonly talk_ms: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
58
+ readonly hour: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.MaxValueAction<number, 23, undefined>]>;
59
+ }, undefined>, undefined>;
60
+ /** `YYYY-MM-DD` in `time_zone`, the days with a call. */
61
+ readonly days: v.ArraySchema<v.StrictObjectSchema<{
62
+ readonly calls: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
63
+ readonly incoming: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
64
+ readonly outgoing: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
65
+ readonly internal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
66
+ readonly answered: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
67
+ readonly missed: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
68
+ readonly talk_ms: v.ExactOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
69
+ readonly date: v.StringSchema<undefined>;
70
+ }, undefined>, undefined>;
71
+ readonly missed: v.ExactOptionalSchema<v.StrictObjectSchema<{
72
+ readonly calls: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
73
+ readonly called_back: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
74
+ readonly not_called_back: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
75
+ readonly unknown_callback: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
76
+ readonly unknown_outcome: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
77
+ /** Newest first. */
78
+ readonly items: v.ArraySchema<v.StrictObjectSchema<{
79
+ readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
80
+ readonly meeting_id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
81
+ readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
82
+ readonly outcome: v.PicklistSchema<["voicemail", "busy", "no_answer"], undefined>;
83
+ readonly client: v.NullableSchema<v.StrictObjectSchema<{
84
+ readonly key: v.StringSchema<undefined>;
85
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
86
+ }, undefined>, undefined>;
87
+ readonly rang: v.ArraySchema<v.StringSchema<undefined>, undefined>;
88
+ readonly called_back: v.ExactOptionalSchema<v.BooleanSchema<undefined>, undefined>;
89
+ readonly callback: v.ExactOptionalSchema<v.NullableSchema<v.StrictObjectSchema<{
90
+ readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
91
+ readonly meeting_id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
92
+ readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
93
+ readonly after_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
94
+ readonly direction: v.PicklistSchema<["outgoing", "incoming"], undefined>;
95
+ }, undefined>, undefined>, undefined>;
96
+ }, undefined>, undefined>;
97
+ readonly has_more: v.BooleanSchema<undefined>;
98
+ }, undefined>, undefined>;
99
+ }, undefined>;
100
+ export type CallStatsItem = v.InferOutput<typeof callStatsSchema>;
101
+ export declare const callStats: v.GenericSchema<CallStatsItem>;
102
+ export declare const callStatsItem: (found: CallStats & {
103
+ accountId: number;
104
+ notCalls: number;
105
+ }) => CallStatsItem;
106
+ export {};