@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 +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"),
@@ -15,8 +15,17 @@ export interface SyncAfterInstallOptions {
15
15
  err: string;
16
16
  out?: string;
17
17
  }>;
18
- /** Words of a local-only change that the "read only" answer must still refuse, as a check it opens no more. */
18
+ /** Words of a change that a `readonly` level must still refuse, as a check it opens no more. */
19
19
  refusedUnderReadOnly?: readonly string[];
20
+ /**
21
+ * The profile's own levels, set in a config of its own: `variable` names the CLI's config folder
22
+ * (`TG_CONFIG_DIR`), and each of `keys` (`messages`, the key the sync's command names) is set to `readonly`, which
23
+ * the sync must pass, and to `deny`, which must refuse it.
24
+ */
25
+ profileLevels?: {
26
+ variable: string;
27
+ keys: readonly string[];
28
+ };
20
29
  }
21
30
  /**
22
31
  * Cases that a CLI's sync runs right after install, whatever state the shared config is in. The kit points
@@ -4,7 +4,8 @@ import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  /**
6
6
  * The shared config (`~/.config/WireCat/config.json`) as a fresh or damaged machine has it. Only an explicit
7
- * "read only" answer limits a tool, and even then a sync runs: it only reads the service (owner ruling, 2026-11-13).
7
+ * "read only" answer limits a tool, and even then a sync runs: it only reads the service (owner rulings, 2026-11-13
8
+ * and 2026-11-14, which extends it to a profile's own `readonly`).
8
9
  * A slip with one reading is mended in place (2026-11-14), so only `broken` states may fail a step.
9
10
  */
10
11
  const SHARED_CONFIGS = [
@@ -51,15 +52,32 @@ const errorCodeOf = (text) => {
51
52
  * the CLI's own harness gives.
52
53
  */
53
54
  export const syncAfterInstallCases = (options) => {
54
- const { sync, refusedUnderReadOnly } = options;
55
- const cli = async (argv, shared) => {
55
+ const { sync, refusedUnderReadOnly, profileLevels } = options;
56
+ const profile = sync[0];
57
+ const cli = async (argv, shared, levels) => {
56
58
  const configDir = mkdtempSync(join(tmpdir(), "sync-after-install-"));
57
59
  shared.write?.(configDir);
60
+ const own = {};
61
+ if (levels && profileLevels) {
62
+ const dir = mkdtempSync(join(tmpdir(), "sync-after-install-own-"));
63
+ writeFileSync(join(dir, "config.json"), JSON.stringify({ profiles: { [profile]: { permissions: levels } } }));
64
+ own[profileLevels.variable] = dir;
65
+ }
58
66
  const ran = await options.run(argv.includes("--json") ? [...argv] : [...argv, "--json"], {
59
67
  WIRECAT_CONFIG_DIR: configDir,
68
+ ...own,
60
69
  });
61
70
  return { code: ran.code, out: ran.out ?? "", err: ran.err };
62
71
  };
72
+ const fresh = SHARED_CONFIGS[0];
73
+ const readOnly = SHARED_CONFIGS.find((one) => one.readOnly);
74
+ const refused = (name, argv, shared, levels) => ({
75
+ name,
76
+ run: async () => {
77
+ const ran = await cli(argv, shared, levels);
78
+ assert.equal(errorCodeOf(ran.err), "permission_error", `it was not refused: ${ran.out}${ran.err}`);
79
+ },
80
+ });
63
81
  return [
64
82
  ...SHARED_CONFIGS.map((shared) => ({
65
83
  name: `${sync.join(" ")} runs with ${shared.state}`,
@@ -71,16 +89,22 @@ export const syncAfterInstallCases = (options) => {
71
89
  assert.equal(ran.code, 0, `sync exited ${ran.code}: ${ran.out}${ran.err}`);
72
90
  },
73
91
  })),
92
+ ...(profileLevels?.keys ?? []).flatMap((key) => [
93
+ {
94
+ name: `${sync.join(" ")} runs with permissions.${key} readonly in the profile`,
95
+ run: async () => {
96
+ const ran = await cli(sync, fresh, { [key]: "readonly" });
97
+ assert.notEqual(errorCodeOf(ran.err), "permission_error", `sync was refused: ${ran.err}`);
98
+ assert.equal(ran.code, 0, `sync exited ${ran.code}: ${ran.out}${ran.err}`);
99
+ },
100
+ },
101
+ refused(`${sync.join(" ")} is refused with permissions.${key} deny in the profile`, sync, fresh, {
102
+ [key]: "deny",
103
+ }),
104
+ ]),
74
105
  ...(refusedUnderReadOnly
75
106
  ? [
76
- {
77
- name: `${refusedUnderReadOnly.join(" ")} is still refused under the explicit "read only" answer`,
78
- run: async () => {
79
- const readOnly = SHARED_CONFIGS.find((one) => one.readOnly);
80
- const ran = await cli(refusedUnderReadOnly, readOnly);
81
- assert.equal(errorCodeOf(ran.err), "permission_error", `it was not refused: ${ran.out}${ran.err}`);
82
- },
83
- },
107
+ refused(`${refusedUnderReadOnly.join(" ")} is still refused under the explicit "read only" answer`, refusedUnderReadOnly, readOnly),
84
108
  ]
85
109
  : []),
86
110
  ];
@@ -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 {
@@ -1,7 +1,7 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { importEngine } from "../attachments/extract.js";
3
3
  import { deadlineMargin } from "../background/budget.js";
4
- import { levelFor } from "../sends/permissions.js";
4
+ import { fetchesAt, levelFor } from "../sends/permissions.js";
5
5
  import { DEFAULT_BACKEND, SERVER_BOUNDS, SERVER_SEARCH_KEY, sourceKey, } from "../services/server-search.js";
6
6
  import { MAX_ATTACHMENT_CHARS, readAttachments } from "./attachments.js";
7
7
  import { bulkBox } from "./bulk.js";
@@ -60,8 +60,8 @@ export const searchMailServer = async (store, mailbox, access, request) => {
60
60
  };
61
61
  if (access.offline)
62
62
  return skip("offline");
63
- // As tg's: `ask` and `readonly` give the archive's answer, since nobody is asked before a search.
64
- if (access.readOnly || levelFor(access.permissions, SERVER_SEARCH_KEY, access.defaults).level !== "allow")
63
+ // As tg's: `ask` gives the archive's answer, since nobody is asked before a search; `readonly` still reads the server.
64
+ if (access.readOnly || !fetchesAt(levelFor(access.permissions, SERVER_SEARCH_KEY, access.defaults).level))
65
65
  return skip("not_allowed");
66
66
  const { branches, partial } = mailCriteriaOf(request.text, {
67
67
  ...(request.exact ? { exact: true } : {}),
@@ -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([
@@ -22,7 +22,7 @@ import { warmEmbedders } from "../embeddings/embed.js";
22
22
  import { mcpUrlOf } from "../http/public-url.js";
23
23
  import { readOnlyLockOf } from "../ports/app.js";
24
24
  import { guardFor } from "../sends/guard.js";
25
- import { levelFor, readKeysForCommand } from "../sends/permissions.js";
25
+ import { fetchesAt, levelFor, readKeysForCommand } from "../sends/permissions.js";
26
26
  import { openStore } from "../store/store.js";
27
27
  import { runCommandForAgent, toolsFromCommands } from "./agent.js";
28
28
  import { agentLog } from "./agent-log.js";
@@ -114,8 +114,8 @@ export const createServer = (command, context, messenger, sessionOptions) => {
114
114
  }
115
115
  };
116
116
  const syncAllowed = (path) => syncsFirst(messenger) &&
117
- levelOf("messages.sync-first") === "allow" &&
118
- (path[0] !== "stats" || levelOf(`${path.join(".")}.sync-first`) === "allow");
117
+ fetchesAt(levelOf("messages.sync-first")) &&
118
+ (path[0] !== "stats" || fetchesAt(levelOf(`${path.join(".")}.sync-first`)));
119
119
  // Discovery stays complete while availability follows changes to the profile.
120
120
  const generated = toolsFromCommands(program.commands, {
121
121
  includeUnavailable: true,
@@ -317,7 +317,7 @@ export const createServer = (command, context, messenger, sessionOptions) => {
317
317
  spawnJob: sessionOptions.spawnJob,
318
318
  limit: settings.limit,
319
319
  get syncAllowed() {
320
- return syncsFirst(messenger) && levelOf("messages.sync-first") === "allow";
320
+ return syncsFirst(messenger) && fetchesAt(levelOf("messages.sync-first"));
321
321
  },
322
322
  guard,
323
323
  settings,
package/dist/mcp/tool.js CHANGED
@@ -14,7 +14,7 @@ import { startRecording } from "../runs/recording.js";
14
14
  import { newRunId } from "../runs/run.js";
15
15
  import { keepsSuccess, runContextOf } from "../runs/run-context.js";
16
16
  import { inRun } from "../runs/scope.js";
17
- import { keyForCommand, levelFor, readKeysForCommand } from "../sends/permissions.js";
17
+ import { fetchesAt, keyForCommand, levelFor, readKeysForCommand } from "../sends/permissions.js";
18
18
  import { onlineDeps, storeModeDeps } from "../services/deps.js";
19
19
  import { servicesFor } from "../services/index.js";
20
20
  import { callerOf, currentCaller, withCaller } from "./caller.js";
@@ -94,9 +94,9 @@ export const inputOf = (definition, syncAllowed) => v.strictObject(syncAllowed |
94
94
  /** Whether a profile may sync before answering this entry. */
95
95
  export const syncAllowedFor = (key, defaults) => {
96
96
  const permissions = defaults.settings.permissions ?? {};
97
- const shared = defaults.syncAllowed ?? levelFor(permissions, "messages.sync-first").level === "allow";
97
+ const shared = defaults.syncAllowed ?? fetchesAt(levelFor(permissions, "messages.sync-first").level);
98
98
  return (shared &&
99
- (!key.startsWith("stats_") || levelFor(permissions, `${key.replaceAll("_", ".")}.sync-first`).level === "allow"));
99
+ (!key.startsWith("stats_") || fetchesAt(levelFor(permissions, `${key.replaceAll("_", ".")}.sync-first`).level)));
100
100
  };
101
101
  export const entryRunner = (registration) => {
102
102
  const run = callRunner(registration);
@@ -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 {};