@wirecat/cli-core 0.662.0 → 0.664.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 (247) hide show
  1. package/CHANGELOG.md +213 -0
  2. package/dist/calendar/cli/bodies.js +2 -1
  3. package/dist/calendar/cli/index.js +13 -10
  4. package/dist/calendar/mcp/index.d.ts +3 -1
  5. package/dist/calendar/mcp/index.js +4 -4
  6. package/dist/cli/call-stats-command.d.ts +18 -0
  7. package/dist/cli/call-stats-command.js +52 -0
  8. package/dist/cli/chat-sending-command.d.ts +14 -0
  9. package/dist/cli/chat-sending-command.js +64 -0
  10. package/dist/cli/context.d.ts +7 -0
  11. package/dist/cli/context.js +12 -4
  12. package/dist/cli/contract-templates.js +2 -0
  13. package/dist/cli/envelope.d.ts +0 -5
  14. package/dist/cli/envelope.js +25 -0
  15. package/dist/cli/index.d.ts +4 -1
  16. package/dist/cli/index.js +4 -1
  17. package/dist/cli/meeting-batch.d.ts +2 -1
  18. package/dist/cli/meeting-batch.js +7 -5
  19. package/dist/cli/meeting-meaning-command.d.ts +47 -0
  20. package/dist/cli/meeting-meaning-command.js +136 -0
  21. package/dist/cli/meeting-preparation-answer.d.ts +6 -0
  22. package/dist/cli/meeting-preparation-command.js +5 -5
  23. package/dist/cli/meeting-preparation-projects.d.ts +6 -0
  24. package/dist/cli/meeting-preparation-read.d.ts +11 -5
  25. package/dist/cli/meeting-preparation-read.js +13 -21
  26. package/dist/cli/meeting-series-inventory-command.js +2 -2
  27. package/dist/cli/meeting-series-inventory-read.d.ts +2 -2
  28. package/dist/cli/meeting-series-inventory-read.js +7 -15
  29. package/dist/cli/meeting-tags-command.d.ts +18 -0
  30. package/dist/cli/meeting-tags-command.js +74 -0
  31. package/dist/cli/messenger/admin-statistics-command.js +2 -2
  32. package/dist/cli/messenger/conversation-answers.d.ts +1 -1
  33. package/dist/cli/messenger/conversation-answers.js +1 -0
  34. package/dist/cli/messenger/conversations-command.js +38 -12
  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/models-command.js +7 -0
  41. package/dist/cli/messenger/rankings-command.js +3 -3
  42. package/dist/cli/messenger/records-command.d.ts +4 -1
  43. package/dist/cli/messenger/records-command.js +6 -1
  44. package/dist/cli/messenger/tags-command.js +7 -2
  45. package/dist/cli/messenger/tasks-command.js +2 -2
  46. package/dist/cli/model-catalogue-command.js +2 -0
  47. package/dist/cli/paging.d.ts +10 -0
  48. package/dist/cli/paging.js +29 -0
  49. package/dist/cli/profile-token.d.ts +15 -1
  50. package/dist/cli/profile-token.js +103 -7
  51. package/dist/cli/program.js +2 -2
  52. package/dist/cli/runs/command.js +6 -4
  53. package/dist/cli/runs/search-command.js +9 -5
  54. package/dist/cli/schedule/schedule-command.js +1 -5
  55. package/dist/domain/links.d.ts +11 -0
  56. package/dist/domain/links.js +4 -0
  57. package/dist/domain/moment.d.ts +29 -0
  58. package/dist/domain/moment.js +58 -0
  59. package/dist/domain/providers.d.ts +6 -4
  60. package/dist/domain/providers.js +10 -5
  61. package/dist/domain/send-time.d.ts +3 -4
  62. package/dist/domain/send-time.js +10 -24
  63. package/dist/entities/chat-sending.d.ts +10 -0
  64. package/dist/entities/chat-sending.js +11 -0
  65. package/dist/entities/fields.d.ts +2 -2
  66. package/dist/entities/fields.js +2 -2
  67. package/dist/entities/index.d.ts +135 -2
  68. package/dist/entities/index.js +8 -3
  69. package/dist/entities/meeting-preparation.d.ts +6 -0
  70. package/dist/entities/meeting.d.ts +1 -1
  71. package/dist/entities/meeting.js +1 -1
  72. package/dist/errors/reasons.js +25 -2
  73. package/dist/mail/cli/index.js +4 -2
  74. package/dist/mail/facts.d.ts +5 -2
  75. package/dist/mail/facts.js +6 -3
  76. package/dist/mail/index.d.ts +1 -1
  77. package/dist/mail/meeting-notes.js +1 -1
  78. package/dist/mail/probe.d.ts +5 -2
  79. package/dist/mail/probe.js +9 -5
  80. package/dist/mail/server-search.js +1 -1
  81. package/dist/mail/sync.js +1 -1
  82. package/dist/mcp/meeting-preparation.d.ts +6 -0
  83. package/dist/mcp/meeting-preparation.js +1 -1
  84. package/dist/mcp/meeting-series-inventory.js +1 -1
  85. package/dist/mcp/prompts.js +6 -9
  86. package/dist/meetings/answers.d.ts +7 -0
  87. package/dist/meetings/answers.js +4 -0
  88. package/dist/meetings/call-answers.d.ts +106 -0
  89. package/dist/meetings/call-answers.js +171 -0
  90. package/dist/meetings/call-stats.d.ts +121 -0
  91. package/dist/meetings/call-stats.js +211 -0
  92. package/dist/meetings/calls.d.ts +76 -0
  93. package/dist/meetings/calls.js +78 -0
  94. package/dist/meetings/cli/index.d.ts +8 -0
  95. package/dist/meetings/cli/index.js +10 -22
  96. package/dist/meetings/cli/search.d.ts +9 -2
  97. package/dist/meetings/cli/search.js +16 -26
  98. package/dist/meetings/index.d.ts +4 -0
  99. package/dist/meetings/index.js +4 -0
  100. package/dist/meetings/mcp/index.d.ts +6 -3
  101. package/dist/meetings/mcp/index.js +2 -4
  102. package/dist/meetings/mcp/search.d.ts +12 -1
  103. package/dist/meetings/mcp/search.js +3 -3
  104. package/dist/meetings/project-evidence-answer.d.ts +6 -0
  105. package/dist/meetings/read-through.d.ts +2 -1
  106. package/dist/meetings/read-through.js +10 -1
  107. package/dist/meetings/stats.d.ts +3 -0
  108. package/dist/meetings/stats.js +3 -3
  109. package/dist/meetings/tag-answers.d.ts +43 -0
  110. package/dist/meetings/tag-answers.js +41 -0
  111. package/dist/meetings/testing/index.d.ts +1 -0
  112. package/dist/meetings/testing/index.js +1 -0
  113. package/dist/meetings/testing/paging.d.ts +6 -0
  114. package/dist/meetings/testing/paging.js +5 -0
  115. package/dist/models/chat-sending.d.ts +24 -0
  116. package/dist/models/chat-sending.js +40 -0
  117. package/dist/moderation/rules.d.ts +2 -0
  118. package/dist/moderation/rules.js +16 -2
  119. package/dist/runs/events.d.ts +1 -1
  120. package/dist/search/fusion.d.ts +17 -0
  121. package/dist/search/fusion.js +17 -0
  122. package/dist/search/lucene/resolved.d.ts +2 -0
  123. package/dist/search/question-plan.d.ts +4 -0
  124. package/dist/search/question-plan.js +7 -0
  125. package/dist/search/service-query.d.ts +6 -1
  126. package/dist/search/service-query.js +9 -1
  127. package/dist/search/task-similarity.d.ts +1 -0
  128. package/dist/search/task-similarity.js +1 -1
  129. package/dist/services/agenda-mail.js +2 -1
  130. package/dist/services/agenda.js +5 -3
  131. package/dist/services/attachments.js +4 -2
  132. package/dist/services/call-stats.d.ts +17 -0
  133. package/dist/services/call-stats.js +41 -0
  134. package/dist/services/chats.js +4 -2
  135. package/dist/services/conversations.js +4 -2
  136. package/dist/services/deps.d.ts +1 -1
  137. package/dist/services/document-source.d.ts +1 -1
  138. package/dist/services/document-source.js +4 -3
  139. package/dist/services/documents/ingestion.js +11 -40
  140. package/dist/services/documents/plan.d.ts +1 -1
  141. package/dist/services/documents/plan.js +30 -17
  142. package/dist/services/documents/ports.d.ts +5 -0
  143. package/dist/services/documents/sync.js +1 -1
  144. package/dist/services/embeddings-search.js +39 -9
  145. package/dist/services/embeddings.d.ts +4 -0
  146. package/dist/services/events-search.js +2 -1
  147. package/dist/services/index.d.ts +3 -0
  148. package/dist/services/index.js +3 -0
  149. package/dist/services/mail-search.d.ts +1 -1
  150. package/dist/services/mail-search.js +10 -11
  151. package/dist/services/media-archive-move.js +2 -4
  152. package/dist/services/media-archive.d.ts +0 -1
  153. package/dist/services/media-archive.js +2 -12
  154. package/dist/services/meeting-combined.js +1 -1
  155. package/dist/services/meeting-meaning.d.ts +47 -0
  156. package/dist/services/meeting-meaning.js +158 -0
  157. package/dist/services/meeting-tags.d.ts +27 -0
  158. package/dist/services/meeting-tags.js +81 -0
  159. package/dist/services/messages-combined.js +15 -4
  160. package/dist/services/messages-discovery.js +2 -2
  161. package/dist/services/moderation.js +10 -2
  162. package/dist/services/moment.d.ts +4 -10
  163. package/dist/services/moment.js +16 -44
  164. package/dist/services/notes-search.d.ts +0 -2
  165. package/dist/services/notes-search.js +1 -2
  166. package/dist/services/search-all.js +2 -1
  167. package/dist/services/tags.js +4 -2
  168. package/dist/services/task-stats.js +2 -2
  169. package/dist/services/tasks.js +2 -2
  170. package/dist/sftp/index.d.ts +1 -1
  171. package/dist/sftp/index.js +1 -1
  172. package/dist/sftp/session.d.ts +30 -4
  173. package/dist/sftp/session.js +195 -11
  174. package/dist/sftp/ssh2.d.ts +19 -4
  175. package/dist/sftp/ssh2.js +144 -17
  176. package/dist/speech/cloud.d.ts +47 -0
  177. package/dist/speech/cloud.js +73 -0
  178. package/dist/speech/decode.d.ts +36 -9
  179. package/dist/speech/decode.js +208 -61
  180. package/dist/speech/index.d.ts +2 -1
  181. package/dist/speech/index.js +2 -1
  182. package/dist/speech/openai.d.ts +4 -0
  183. package/dist/speech/openai.js +13 -12
  184. package/dist/sql/index.d.ts +1 -0
  185. package/dist/sql/index.js +1 -0
  186. package/dist/sql/reader.d.ts +95 -0
  187. package/dist/sql/reader.js +214 -0
  188. package/dist/store/accounts.js +2 -1
  189. package/dist/store/sqlite/account-purge.d.ts +3 -0
  190. package/dist/store/sqlite/account-purge.js +143 -0
  191. package/dist/store/sqlite/accounts.d.ts +0 -2
  192. package/dist/store/sqlite/accounts.js +2 -134
  193. package/dist/store/sqlite/calendar.d.ts +1 -0
  194. package/dist/store/sqlite/calendar.js +5 -5
  195. package/dist/store/sqlite/catalog.js +2 -16
  196. package/dist/store/sqlite/chats.js +2 -1
  197. package/dist/store/sqlite/context-document-source.d.ts +3 -3
  198. package/dist/store/sqlite/context-document-source.js +9 -7
  199. package/dist/store/sqlite/context-evidence.js +9 -3
  200. package/dist/store/sqlite/document-listing.js +2 -1
  201. package/dist/store/sqlite/drizzle/bun.js +4 -4
  202. package/dist/store/sqlite/drizzle/bun.js.map +1 -1
  203. package/dist/store/sqlite/drizzle/core.js +5 -5
  204. package/dist/store/sqlite/drizzle/core.js.map +1 -1
  205. package/dist/store/sqlite/drizzle/node.js +4 -4
  206. package/dist/store/sqlite/drizzle/node.js.map +1 -1
  207. package/dist/store/sqlite/drizzle/{shared-55XJMTPA.js → shared-5XR7K42U.js} +58 -58
  208. package/dist/store/sqlite/drizzle/{shared-55XJMTPA.js.map → shared-5XR7K42U.js.map} +1 -1
  209. package/dist/store/sqlite/events.js +2 -1
  210. package/dist/store/sqlite/file-note.d.ts +6 -0
  211. package/dist/store/sqlite/file-note.js +15 -0
  212. package/dist/store/sqlite/files.d.ts +3 -2
  213. package/dist/store/sqlite/files.js +5 -3
  214. package/dist/store/sqlite/identities.js +2 -1
  215. package/dist/store/sqlite/imported-documents.js +2 -2
  216. package/dist/store/sqlite/knowledge.d.ts +1 -1
  217. package/dist/store/sqlite/knowledge.js +27 -23
  218. package/dist/store/sqlite/labelled.d.ts +5 -0
  219. package/dist/store/sqlite/labelled.js +6 -0
  220. package/dist/store/sqlite/link-row.d.ts +1 -0
  221. package/dist/store/sqlite/link-row.js +2 -0
  222. package/dist/store/sqlite/lucene-fields.js +8 -12
  223. package/dist/store/sqlite/mail-rules.js +2 -1
  224. package/dist/store/sqlite/meeting-calls.d.ts +4 -0
  225. package/dist/store/sqlite/meeting-calls.js +66 -0
  226. package/dist/store/sqlite/meetings.d.ts +2 -2
  227. package/dist/store/sqlite/meetings.js +4 -1
  228. package/dist/store/sqlite/mention-sources.js +2 -1
  229. package/dist/store/sqlite/mentions.js +2 -2
  230. package/dist/store/sqlite/messages.js +6 -1
  231. package/dist/store/sqlite/note-search.js +8 -11
  232. package/dist/store/sqlite/notes.d.ts +3 -1
  233. package/dist/store/sqlite/notes.js +25 -14
  234. package/dist/store/sqlite/organizations.js +2 -2
  235. package/dist/store/sqlite/people-list.js +3 -3
  236. package/dist/store/sqlite/query-filter.d.ts +3 -3
  237. package/dist/store/sqlite/query-filter.js +3 -3
  238. package/dist/store/sqlite/reads.d.ts +4 -4
  239. package/dist/store/sqlite/reads.js +4 -4
  240. package/dist/store/sqlite/search.js +11 -7
  241. package/dist/store/sqlite/test-accounts.js +1 -1
  242. package/dist/store/sqlite/trigram-match.d.ts +9 -0
  243. package/dist/store/sqlite/trigram-match.js +28 -0
  244. package/dist/store/sqlite/work-tasks.js +1 -1
  245. package/package.json +18 -3
  246. package/parity.json +20 -1
  247. package/skills/link-conversations/SKILL.md +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,219 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
5
5
  minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
6
6
  shape of this file.
7
7
 
8
+ ## 0.664.0 — 14.11.2026
9
+
10
+ ### Added
11
+
12
+ - **Tags on calls and other meetings, from a search: `addMeetingTagsCommand`** in `@wirecat/cli-core/cli` mounts
13
+ `tags add|remove|list` for a host whose meetings are its records, such as pbx and beeline.
14
+ `tags add complaint --matching "refund OR complaint"` labels every meeting of the account where `search meetings`
15
+ finds the query; `--meeting <id>` (repeatable) labels by id. A rerun after new calls are transcribed labels only
16
+ those, and `changed` in the `meeting_tag_change` answer says which. `tags list tag:complaint` answers
17
+ `meeting_tagging` items with the call's title marked untrusted. The labels are the store's ordinary taggings, so
18
+ `search meetings --tag complaint` and memo's `tags list` see them. The service is `meetingTags` in
19
+ `@wirecat/cli-core/services`. A mark stays when a new transcript of the call no longer says the words.
20
+ - cli-core's command lint now also checks a calls host's program: `stats calls show`, `search meetings` and the
21
+ meeting `tags`, with cli-base's `calls`, `--matching` and `--tag`.
22
+ - **Search by meaning for any host of stored meetings, from cli-core.** `addMeetingCombinedSearchCommand` in
23
+ `@wirecat/cli-core/cli` mounts `search meetings`: words by default, and words and meaning ranked together with
24
+ `--model <model>`, which first splits new transcripts and builds the missing vectors. A hit says how it was found
25
+ (`by`), its similarity (`score`) and the passage meaning matched, and marks `excerpt`, the passage and the title
26
+ untrusted. `addMeetingEmbeddingCommand` mounts `meetings embed`: a preview, and `--yes` splits every transcript and builds one batch of the missing
27
+ vectors; a rerun builds the next.
28
+ Without `--model` it uses the `models` command's default local text model, so the transcripts stay on this
29
+ computer; `--base-url` sends passages to a remote service only when given, and `--offline` refuses it. Both run over
30
+ `meetingMeaning(store, accountId)` in `@wirecat/cli-core/services`. These moved from zoom-cli, which can mount them
31
+ in place of its own copies; pbx and beeline mount them for calls.
32
+ - `meeting_hit` takes the optional `by`, `score` and `passage` of a search by meaning.
33
+ - **A profile can keep a second secret, in its one keyring entry.** `ProfileTokenStore` takes named secrets beside
34
+ the token: `writeSecret(profile, "ssh", secret)`, `readSecret(profile, "ssh")` and `removeSecret(profile, "ssh")`,
35
+ so a CLI can keep a database password and an SSH or SFTP password for one profile. They live in the same
36
+ `token:<profile>` entry as one value, as an OAuth entry holds its tokens and client secret: the keyring gets no
37
+ second entry (WC-SECR-4). An entry with only the token stays the plain value it was, so every entry written before
38
+ reads as before. `<PREFIX>_TOKEN_<NAME>` (`secretVariable(name)`) overrides one for CI, as `<PREFIX>_TOKEN` does the
39
+ token. Changing the token keeps the named secrets and the other way round; `remove` still forgets the whole entry,
40
+ as `session end` wants. A run with moved folders writes them to its temporary entry and never touches the owner's
41
+ (WC-SECR-24).
42
+ - **A link can open a call or meeting in WireCat Desktop.** `linkFor({ type: "meeting", provider, account, meeting })`
43
+ builds `wirecat://open/v1/meeting/<provider>/<account>/<meeting>` (or the web form) from the provider's own ids, as
44
+ a message link does: `asterisk`, the account as the provider knows it, and the call's id there. It is built only
45
+ from that target: `meeting:<account>/<meeting>` stays a store reference and never becomes a link.
46
+ `test/fixtures/links-v1.json` has the cases under `target_only`, since no ref names them, and two refused paths.
47
+ - **`readStream` on the SFTP client reads a file of any size in pieces.** It gives the file in order, 64 KiB at a
48
+ time with about a megabyte read ahead, so a Master.csv of gigabytes or a recording for ffmpeg is never held whole.
49
+ `maxBytes` is optional. A connection that breaks halfway is opened again and the read goes on where it stopped,
50
+ once the bytes just before that point read the same; a file replaced meanwhile is refused (`sftp.file-changed`).
51
+ Host-key pinning and the read-only rules are the same as for `readFile`. Each attempt is an `sftp.stream` event.
52
+ See [SFTP](docs/sftp.md#read).
53
+ - **`openSshTunnel` reaches a database that listens only on its own server** (a FreePBX CDR database) with no
54
+ `ssh -L` by hand. It signs in with the pinned host key, only forwards (no shell, no command, no SFTP), and opens no
55
+ port on this computer: `connect(host, port)` answers a stream shaped as a socket, which `pg` and `mysql2` take as
56
+ their `stream`. `close()` ends it at the end of the run. Its events are `ssh.connect` and `ssh.forward`
57
+ (`transport: "ssh"`), with no forwarded address. See
58
+ [SFTP, "A tunnel to a database behind the server"](docs/sftp.md#a-tunnel-to-a-database-behind-the-server).
59
+ - **`@wirecat/cli-core/sql`: a read-only MySQL, MariaDB and PostgreSQL reader for a host's own table.**
60
+ `openSqlReader` opens a read-only session with TLS checked and connect and query timeouts, keeps a time without a
61
+ zone as its text, reads in pages by the last row's key (or by offset), checks every name as an identifier and
62
+ sends every value as a parameter, takes a tunnel's stream as `socket`, and maps driver errors to reasons without
63
+ their text (`db.refused`, `db.no-table`, `db.no-select`, `db.read-only`…; `sqlFailure` for a host's own code).
64
+ `mysql2` and `pg` are optional peers, loaded on first use. It is the generic half of pbx's CDR reader; the
65
+ schema mapping stays in pbx. See [SQL](docs/sql.md).
66
+ - **Recordings that ffmpeg reads keep their channels.** `decodeChannels` gives a stereo WAV, GSM, AAC or M4A call
67
+ two channels, one speaker each, as it already did for MP3, Ogg and FLAC. A mono file stays one channel, and a file
68
+ of more channels is mixed down to two. Each channel still stops at an hour of audio, and ffmpeg's output is split
69
+ into channels as it arrives, so the interleaved samples are never held whole. `decodeChannelsFile(path, { maxBytes })`
70
+ hands a WAV or GSM file to ffmpeg by its path, so a recording of gigabytes is not read into memory first;
71
+ `runFfmpegFile(path)` is the step under it, and `mixDown` averages channels into one.
72
+ - **`cloudSpeech` lets a host send a profile's recordings to an OpenAI-compatible speech-to-text, when that profile
73
+ asks.** It is `null` unless the profile's own settings say `transcribeWith: "openai"`. The audio goes to OpenAI, or
74
+ to the address the shared AI model is set to (`models ai set openai --base-url … --secret-stdin`), with the key
75
+ kept for that address. The model is the profile's `transcribeModel` (`gpt-transcribe` when not set). The host's
76
+ `notify` gets one line naming the host before the first audio leaves the computer. It refuses in a read-only
77
+ process, with local only on, and without a key (`transcription.no-key`, naming the command that sets it). Long
78
+ audio goes in pieces of at most ten minutes, under the provider's 25 MB limit. See
79
+ [MEETING-PROVIDERS.md, "Decoding a recording, and cloud speech"](docs/dev/MEETING-PROVIDERS.md#decoding-a-recording-and-cloud-speech).
80
+ - `transcribeOpenAI` takes `label` and `keyHint`, so a compatible service's errors name that service and the command
81
+ that sets its key, not OpenAI. A compatible server on this computer needs no key.
82
+ - **`models chats show|set allowed|ask|denied`: one setting for chat text sent to a model outside this
83
+ computer.** It decides what `conversations embed` and `conversations links rebuild --analyze` do with a model that
84
+ is not on this computer. `allowed` sends without a yes, in a terminal and over MCP. `ask`, the default, needs a yes
85
+ as before. `denied` refuses. The setting is shared by every WireCat tool. Messenger CLIs mount it under `models`,
86
+ and so does the model catalogue for the tool that turns on enrichment. Only the owner makes it less strict: `set`
87
+ is no MCP tool, and an agent's run is refused unless it passes `--from-app`.
88
+ - **`conversations embed` and `conversations links rebuild` take their own `--yes`**, so an agent can pass `yes`
89
+ over MCP under `ask`. Before, they read only the root program's `--yes`, which a tool call cannot pass, so an
90
+ agent got `confirmation_required … add --yes` and could not go on.
91
+
92
+ ### Changed — may break callers
93
+
94
+ - **`SftpClient` has `readStream`.** A fake typed as `SftpClient` in a host's tests adds it.
95
+ - **No MCP server offers `chats delete` or `chats clear`.** Over MCP an `ask` level goes ahead without a question, so
96
+ an agent could delete a whole chat or its history from the account. Both stay on the command line, where `ask` still
97
+ asks first.
98
+ - **`Ffmpeg` (the seam of `decodeChannels` and `decodeAudio`) may answer `Pcm[]`, one per channel,** and `runFfmpeg`
99
+ now does. A seam that still answers one `Pcm` works, and `decodeChannels` then says `mixed: true`. `mixed` is no
100
+ longer true for every file ffmpeg read.
101
+ - **`decodeAudio` mixes every channel into one,** where it gave the first channel of a stereo MP3, Ogg or FLAC. A
102
+ stereo voice message or audio file now keeps both sides in its one text.
103
+ - **Under `models chats denied`, `conversations embed` and `--analyze` to a model outside this computer refuse even
104
+ with `--yes`** and even with a consent remembered for the chat: `permission_error`, reason `chat-sending.denied`.
105
+ The message names the owner's command, `<cli> models chats set ask`. Without the setting nothing changes.
106
+ - **`--analyze` with a model on this computer no longer asks for consent or remembers one**, the same as
107
+ `conversations embed` with a local model. A caller that expected `confirmation_required` there now gets the
108
+ analysis.
109
+ - **The refusal under `ask` without a yes** now has reason `chat-sending.ask`, and its message says an agent may
110
+ pass yes or ask the owner to run `<cli> models chats set allowed`.
111
+
112
+ ### Fixed
113
+
114
+ - **`knowledge.labelled` with an account lists only that account's meetings, and never a deleted meeting.** With
115
+ `null`, as memo calls it, it still lists every account's meetings, now without the deleted ones.
116
+ - cli-base 0.101.0, whose vocabulary has `calls`, `--matching` and `--tag`; the peer range moves to it.
117
+ - **A command's own `--fields` is no longer read as `--json`'s field list.** A generated Google API command such as
118
+ `gcal <profile> api calendar-events-list --fields 'items(id)' --json` failed with "--json takes comma-separated field
119
+ paths", because the command's `--fields` (Google's partial-response mask) stood in for the root's. Only
120
+ `--json=a,b` now picks the answer's fields, in `outputFor`, `baseContext` and the program's own output.
121
+ - **A project's status no longer crashes on a link whose chat was deleted.** `knowledge.relations` leaves out a link
122
+ whose start or end no longer exists, such as a `member-of` link from a chat the store has since removed. Before,
123
+ it returned the link with `from: null`, and `projectStatus` failed on it, so memo's `review agenda` and the morning
124
+ digest stopped with `command.crashed`.
125
+ - `search conversations` no longer fails on a long sentence over a large store: when the word half runs out of time,
126
+ the meaning half still answers, and the answer says so (`meta.words: "out-of-time"`, a note in pretty output).
127
+ Stop words (`что`, `какие`, `what`, `the`…) no longer go into the word half, unless the query holds nothing else.
128
+ - `search conversations` follows an explicit `--timeout`, as `search messages` does: the word half gets the longer
129
+ time limit.
130
+ - `search messages --discover` finds a name written as one word when the question spells it with a hyphen
131
+ (`Альфа-банк` finds `АльфаБанк`).
132
+
133
+ ## 0.663.0 — 14.11.2026
134
+
135
+ ### Added
136
+
137
+ - **`stats calls show` reports a business's phone calls as one JSON answer (`call_stats`).** A CLI whose meetings are
138
+ calls (pbx, beeline) mounts it with `addCallStatsCommand` from `@wirecat/cli-core/cli`. It counts calls by
139
+ direction and outcome; per employee the calls placed, answered and rung but not answered, with talk and wait time;
140
+ calls by hour and by day in `--timezone`; missed incoming calls and whether the client was called back within
141
+ `--within` (default 1d), even when the callback falls after `--until-time`; and answered calls shorter than 30
142
+ seconds. A number the phone system does not record, such as Beeline's outcome and wait, is left out and
143
+ counted under `known`, never shown as zero. The parts are separate: `callOf` reads a meeting as a call, `aggregateCallStats` is
144
+ the arithmetic, `meetingCalls` on the store reads the selection, and `readCallStats` joins them.
145
+ - **A synced node can be a folder and a document at once.** `syncDocuments` takes an optional
146
+ `isDocument(file)`: a folder it answers yes for, such as a Notion or Confluence page with sub-pages, is walked
147
+ for its children and imported itself, a selected root page included. Without it nothing changes: Drive's
148
+ folders are still only walked. See [DOCUMENTS.md, "Bind a provider"](docs/dev/DOCUMENTS.md#bind-a-provider).
149
+ - **Any documents provider gets documents accounts, not only Google Drive.** A CLI whose provider entry has
150
+ kind `documents` (and is not `imported`) can call `notes.documentsAccount` and `documentIngestion({ provider })`
151
+ for its own principals, and `documentsAccounts()` lists them beside Drive's. A document whose front matter names
152
+ such a provider in `source` is kept as Drive's are: placed by its catalog parents, never joined by content to a
153
+ copy in a notes folder, and its `sourceUrl` and `modifiedAt` stand in when no file row gives them. `google-drive`
154
+ is now in the provider seed, so Drive behaves the same before drive has written its entry. See
155
+ [DOCUMENTS.md, "Bind a provider"](docs/dev/DOCUMENTS.md#bind-a-provider).
156
+
157
+ ### Changed — may break callers
158
+
159
+ - **The store has no ceiling of 10 000 entries on a documents account any more** (owner's ruling, 2026-11-14). `catalog.list`
160
+ no longer refuses an account over 10 000 entries or 32 MB of metadata, `catalog.reconcile` takes any number of
161
+ ids, and `documentIngestion`'s catalog import takes any number of files, written 200 at a time. A sync no longer
162
+ reads every document of the account into memory before its first save: each save and removal looks up its one
163
+ document with the new `notes.fileNote(folderId, path)`. One catalog write still takes at most 200 entries and one
164
+ list page at most 1000, and a sync still walks at most the `maxEntries` its CLI passes (drive passes 10 000), so
165
+ a CLI raises that to sync more. Speed and memory at 10 000, 50 000 and 100 000 entries are measured in
166
+ [cli-testing](https://github.com/WireCatLabs/cli-testing/tree/main/performance/documents/catalog-scale).
167
+ A store that implements `NotesStore` itself must add `fileNote`. The `catalog.scope-limit` reason is gone;
168
+ nothing raised it any more. The `observed` callback is the only reason the import reads its entries back, so an
169
+ import without one no longer does.
170
+ - **`meetings` commands take the program's `--json [fields]` and `--jsonl`,** not their own on/off flags, so
171
+ `meetings list --json id,title` keeps those fields and `--json --jsonl` together is no longer refused.
172
+ - **Lists without `--limit` show the configured `defaults.limit`** (20 unless set), capped at the command's maximum,
173
+ not their own number: `meetings list`, `events list`, `search events`, `search meetings` (also inside
174
+ `meetings batch`), `runs list`, `search runs`, admin reports, rankings evidence, `stats messages counters`,
175
+ `metadata sync` and `tags rebuild` (these two drop from 50 to 20). The MCP tools `meetings_list`, `events_list` and
176
+ `search_meetings` page by the host's configured limit, not 100.
177
+ - **Hosts pass `pagingOf`** (exported from `@wirecat/cli-core/cli`) to `addMeetingCommands` and
178
+ `addMeetingSearchCommand`. Changed signatures: `meetingHitSearchRequest(query, flags, limit, signal?)`,
179
+ `prepareMeetingBatch(input, reader, meta, limit)`, `callMeetingTool(store, name, input, { limit, failure? })`,
180
+ `callCalendarTool(…, { accountIds, limit, … })`, `callMeetingSearchTool(search, input, { limit, signal?,
181
+ failure? })`. `flagPaging` in `@wirecat/cli-core/meetings/testing` pages bare test roots.
182
+ - **`search events --cursor 0` is refused;** a cursor comes from `page.next_cursor`.
183
+ - **`zonedTime` is `typedTime`** and no longer demands a zone.
184
+ - **Moderation needs a named profile** and never falls back to `default`; a missing one lists the profiles to name.
185
+ - **`factsOf` (mail) is async** and takes a required "written to" lookup.
186
+ - **`find` also matches words shorter than three letters,** so `find AI bot` returns fewer, more exact hits.
187
+ - **Time errors read** `--x takes an ISO 8601 time, today, yesterday, or 30m, 2h, 1d ago — not "…"` (and `… from
188
+ now` for future times).
189
+ - **Needs `@wirecat/cli-base` 0.100.0,** whose query dates take a time without seconds or without an offset.
190
+ - **`store clear --allow-dangerous` and `admin moderate --allow-dangerous` are the owner's alone.** Their MCP tools
191
+ no longer take `allow_dangerous`, as with every other delete that cannot be undone: an agent previews with
192
+ `dry_run`, and the owner runs the command in a terminal.
193
+
194
+ ### Fixed
195
+
196
+ - **Every time flag takes one grammar:** ISO with or without seconds and zone, a space for `T`, a date alone,
197
+ `today`, `yesterday`, `30m`/`2h`/`7d`. This now holds for `meetings sync`, `search meetings`, `meetings prepare`,
198
+ `meetings scheduled` (CLI and MCP), the media archive (`download`, `jobs install --since-time`,
199
+ `move --before-time`) and `schedule --at-time`. One parser reads every future time.
200
+ - **A list query's dates read the computer's zone** for every list (`created_at>"2026-11-14 23:00"` too), and the
201
+ answer names it in `meta.timezone`.
202
+ - **The MCP review and catch-up prompts pass `since` as a full instant,** so `2026-11-13T18:00+01:00` and `2h` work.
203
+ - **Mail presets count a correspondent from stored outgoing mail too,** so a resumed sync, or an account synced
204
+ without Sent, no longer skips their new mail.
205
+ - **`--discover` never fails with "use a longer prefix"** on words the user typed whole, and `search all` keeps its
206
+ messages part.
207
+ - **Trigram searches treat ё and е as one letter** (`find`, `chats list title:`, people and contacts search).
208
+ - **Mail beside messages, and files beside written notes, are ordered by rank in each source,** not by raw scores
209
+ from different indexes; conversations search too.
210
+ - **`changes` reports a message a later fetch brought back after its deletion** as new.
211
+ - **Removing an account clears its calendars, mail rules, reminders and proposed actions** instead of failing on a
212
+ foreign key.
213
+ - **A command's own `--yes` or `--timeout` gets its value.** The root program declares both, and the value went to
214
+ the root alone, so `meetings repair --yes` only previewed, `models consents set --yes` and
215
+ `models search-consents set --yes` changed nothing, and `search-consents set --timeout 2m` stored no wait. Every
216
+ option a command shares with the root now gets the value too, through the command's own parser. A CLI that copied
217
+ the root's values itself can drop that copy.
218
+ - **`tasks scan` and the CRM kit's `store apply` take `yes` over MCP.** Both read the root's `--yes`, which a tool
219
+ call cannot pass, so an agent could only preview them.
220
+
8
221
  ## 0.662.0 — 14.11.2026
9
222
 
10
223
  ### Added
@@ -1,5 +1,6 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { itemOf, listOf, snakeKeys } from "../../cli/envelope.js";
3
+ import { pagingOf } from "../../cli/paging.js";
3
4
  /** The command's words below the program, as `page.next` and `sync`'s next step rerun it. */
4
5
  export const pathOf = (command) => command.parent?.parent ? [...pathOf(command.parent), command.name()] : [command.name()];
5
6
  const snakeMeta = (meta) => meta === undefined ? undefined : snakeKeys(meta);
@@ -29,7 +30,7 @@ export const hitsBody = (command, value) => {
29
30
  const untrusted = (value.untrusted ?? []).filter((field) => field.startsWith("hits.")).map((f) => f.slice(5));
30
31
  const { next, ...list } = listOf(pathOf(command).join(" "), {
31
32
  items: value.hits.map((hit) => snakeKeys({ ...hit, untrusted })),
32
- limit: opts.limit,
33
+ limit: pagingOf(command).limit,
33
34
  has_more: value.has_more === true,
34
35
  paging: "cursor",
35
36
  ...(typeof value.next_offset === "number" ? { cursor: String(value.next_offset) } : {}),
@@ -9,6 +9,7 @@ import { changesStore, ownerOnlyOption, writesFileOnlyWith } from "../../cli/eff
9
9
  import { renderAnswer } from "../../cli/envelope.js";
10
10
  import { queryTerms, withQuery } from "../../cli/list-query.js";
11
11
  import { terminalAsker } from "../../cli/messenger/ask.js";
12
+ import { pagingOf } from "../../cli/paging.js";
12
13
  import { lineOf } from "../../cli/steps.js";
13
14
  import { secretInput } from "../../runs/run-context.js";
14
15
  import { searchEvents } from "../../services/events-search.js";
@@ -280,11 +281,12 @@ const addCalendarCommandsDefinition = (program, options) => {
280
281
  };
281
282
  const events = annotate(program.command("events").description("the account's stored events"), { effects: GROUP });
282
283
  example(withQuery(annotate(events.command("list"), { effects: LOCAL_READ, partial: true }).description("list stored events, earliest first; --source reads several accounts as one list"), EVENTS_QUERY).addHelpText("after", EVENTS_QUERY_NOTE), "events list 'starts_at:[2026-11-02 TO 2026-11-07}' --json", "events list ends_at>=today person:ana@example.com", "events list overlapping:true --source all")
283
- .option("--limit <n>", "events per page, 1–1000", integer, 100)
284
- .option("--page <n>", "which page, starting at 1", integer, 1)
284
+ .option("--limit <n>", "events per page, 1–1000; the profile's defaults.limit when absent", upTo(1000))
285
+ .option("--page <n>", "which page, starting at 1", integer)
285
286
  .option("--source <accounts>", "calendar accounts held in the store to read as one list: all, a provider, or a list such as " +
286
287
  `${options.app.command}:work,${options.app.command}:personal or group:<name>; the profile's account when absent`)
287
288
  .action(async (words, opts, command) => {
289
+ const { limit, page } = pagingOf(command);
288
290
  await within(command, async (run) => {
289
291
  const own = { id: run.accountId, key: run.account };
290
292
  const { accounts, skipped } = opts.source === undefined
@@ -300,7 +302,7 @@ const addCalendarCommandsDefinition = (program, options) => {
300
302
  now: now(),
301
303
  personOf: personId(run),
302
304
  });
303
- return listBody(command, eachMarked(await eventsAnswer(run.store, filter && { ...filter, limit: opts.limit }, opts.page), EVENT_ITEM_UNTRUSTED), { ...(await accountsMeta(run.store, accounts, skipped, now())), ...clockMeta(now(), zone()) });
305
+ return listBody(command, eachMarked(await eventsAnswer(run.store, filter && { ...filter, limit }, page), EVENT_ITEM_UNTRUSTED), { ...(await accountsMeta(run.store, accounts, skipped, now())), ...clockMeta(now(), zone()) });
304
306
  });
305
307
  });
306
308
  const exporter = example(withQuery(annotate(events.command("export"), { effects: LOCAL_WRITE }).description(`write stored events as iCalendar (.ics), at most ${EXPORT_MAX}: one with id:<id>, or those the query ` +
@@ -374,8 +376,8 @@ const addCalendarCommandsDefinition = (program, options) => {
374
376
  .argument("<query...>", "what to find in titles, descriptions, places and attendees"), "search events roadmap planning --json", ...(options.serverSearch
375
377
  ? ["search events --backend server quarterly review", "search events --backend both quarterly review"]
376
378
  : []))
377
- .option("--limit <n>", "events per page", integer, 20)
378
- .option("--cursor <cursor>", "go on from where the last page stopped; page.next gives it", (text) => (text === "0" ? 0 : integer(text)), 0)
379
+ .option("--limit <n>", "events per page; the profile's defaults.limit when absent", integer)
380
+ .option("--cursor <cursor>", "go on from the previous page's page.next_cursor, with the same query", integer)
379
381
  .option("--exact", "every word as written, no word stems")
380
382
  .option("--newest", "latest start first instead of best first");
381
383
  if (options.serverSearch)
@@ -385,6 +387,7 @@ const addCalendarCommandsDefinition = (program, options) => {
385
387
  .choices(["archive", "server", "both"])
386
388
  .default("archive"));
387
389
  search.action(async (words, opts, command) => {
390
+ const { limit } = pagingOf(command);
388
391
  const flag = `search events --backend ${opts.backend}`;
389
392
  const server = opts.backend === "server" || opts.backend === "both";
390
393
  if (server) {
@@ -396,14 +399,14 @@ const addCalendarCommandsDefinition = (program, options) => {
396
399
  throw new CliError("validation_error", `${flag} takes no --exact: the provider matches words its own way`, {
397
400
  reason: "search.server-options",
398
401
  });
399
- if (opts.cursor || opts.newest)
402
+ if (opts.cursor !== undefined || opts.newest)
400
403
  throw new CliError("validation_error", `${flag} takes neither --cursor nor --newest: the provider ranks and pages its own hits`, { reason: "search.server-options" });
401
404
  }
402
405
  await within(command, async (run) => {
403
406
  const archived = () => searchEvents(messagesOf(run, "search"), words.join(" "), {
404
407
  accounts: [run.account],
405
- limit: opts.limit,
406
- offset: opts.cursor,
408
+ limit,
409
+ offset: opts.cursor ?? 0,
407
410
  timezone: zone(),
408
411
  command: options.app.command,
409
412
  ...(opts.exact ? { exact: true } : {}),
@@ -423,12 +426,12 @@ const addCalendarCommandsDefinition = (program, options) => {
423
426
  accountId: run.accountId,
424
427
  account: run.account,
425
428
  query: words.join(" "),
426
- limit: opts.limit,
429
+ limit,
427
430
  });
428
431
  if (opts.backend === "server")
429
432
  return hitsBody(command, { ...served, untrusted: SERVER_SEARCH_UNTRUSTED });
430
433
  return hitsBody(command, {
431
- ...(await bothSearchAnswer(run.store, run.accountId, await archived(), served, opts.limit)),
434
+ ...(await bothSearchAnswer(run.store, run.accountId, await archived(), served, limit)),
432
435
  untrusted: SEARCH_UNTRUSTED,
433
436
  });
434
437
  });
@@ -1464,8 +1464,10 @@ export declare const calendarWriteTools: ({
1464
1464
  * Runs one calendar tool over the accounts the host serves. Without `account_id` a tool reads every one of them and
1465
1465
  * names them in `accounts`; with one it must be among them.
1466
1466
  */
1467
- export declare const callCalendarTool: (store: EventStore, name: string, input: unknown, { accountIds, failure, now, writes, profileOf, }: {
1467
+ export declare const callCalendarTool: (store: EventStore, name: string, input: unknown, { accountIds, limit, failure, now, writes, profileOf, }: {
1468
1468
  accountIds: readonly number[];
1469
+ /** `events_list`'s page without `limit`: the profile's `defaults.limit`, as the messenger MCP lists take it. */
1470
+ limit: number;
1469
1471
  /** What `status` calls each account's sync. */
1470
1472
  profileOf?: (accountId: number) => string;
1471
1473
  failure?: FailureContext;
@@ -215,7 +215,7 @@ const argumentsOf = (name, input) => {
215
215
  * Runs one calendar tool over the accounts the host serves. Without `account_id` a tool reads every one of them and
216
216
  * names them in `accounts`; with one it must be among them.
217
217
  */
218
- export const callCalendarTool = async (store, name, input, { accountIds, failure = {}, now = Date.now(), writes, profileOf = (accountId) => `account ${accountId}`, }) => {
218
+ export const callCalendarTool = async (store, name, input, { accountIds, limit, failure = {}, now = Date.now(), writes, profileOf = (accountId) => `account ${accountId}`, }) => {
219
219
  const writing = WRITES.has(name);
220
220
  try {
221
221
  const args = argumentsOf(name, input);
@@ -247,7 +247,7 @@ export const callCalendarTool = async (store, name, input, { accountIds, failure
247
247
  answer = listed((await Promise.all(accounts.map((id) => calendarStatus(store, id, { profile: profileOf(id), now }).then(({ items }) => items)))).flat());
248
248
  break;
249
249
  case "events_list":
250
- answer = await eventsList(store, args, accounts, now);
250
+ answer = await eventsList(store, args, accounts, now, limit);
251
251
  break;
252
252
  case "event_show": {
253
253
  const { accountId, details } = await eventIn();
@@ -283,8 +283,8 @@ const EVENTS_READ = 1000;
283
283
  * One page of events across the accounts. Page n of several accounts is not each account's page n, so each one is
284
284
  * read from its first event up to the page's end and the merge is cut there.
285
285
  */
286
- const eventsList = async (store, args, accounts, now) => {
287
- const limit = args.limit ?? 100;
286
+ const eventsList = async (store, args, accounts, now, configured) => {
287
+ const limit = args.limit ?? configured;
288
288
  const page = args.page ?? 1;
289
289
  const end = page * limit;
290
290
  const merging = accounts.length > 1;
@@ -0,0 +1,18 @@
1
+ import { type Command } from "commander";
2
+ import type { CallStatsAnswer, CallStatsRequest } from "../services/call-stats.js";
3
+ import { type Body } from "./envelope.js";
4
+ export type CallStatsRead = (request: Omit<CallStatsRequest, "accountId">) => Promise<CallStatsAnswer>;
5
+ export interface CallStatsCommandDeps {
6
+ /** The calls of the profile's own account; opened when the command runs. */
7
+ read: () => Promise<CallStatsRead>;
8
+ signal?: () => AbortSignal | undefined;
9
+ /** Prints the answer; cli-core's renderer when not given. A host that closes its store first passes its own. */
10
+ output?: (body: Body, command: Command) => void;
11
+ /** One to three examples that run as written, with the host's command and a profile. */
12
+ examples: string[];
13
+ }
14
+ /**
15
+ * `stats calls show`, for a host whose meetings are phone calls: it mounts the command, so a host of video meetings
16
+ * never shows it. Numbers over the stored calls only; nothing is read from the phone system.
17
+ */
18
+ export declare const addCallStatsCommand: (program: Command, deps: CallStatsCommandDeps) => void;
@@ -0,0 +1,52 @@
1
+ import { annotate } from "@wirecat/cli-base/commands";
2
+ import { timezoneOf } from "@wirecat/cli-base/query";
3
+ import { InvalidArgumentError } from "commander";
4
+ import { parseDuration } from "../domain/duration.js";
5
+ import { callStatsItem } from "../meetings/index.js";
6
+ import { dateWindow } from "../services/moment.js";
7
+ import { outputFor } from "./context.js";
8
+ import { LOCAL_READ, NO_EFFECTS } from "./effects.js";
9
+ import { itemOf, renderAnswer } from "./envelope.js";
10
+ const positive = (value) => {
11
+ if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
12
+ throw new InvalidArgumentError("expected a positive integer");
13
+ return Number(value);
14
+ };
15
+ /**
16
+ * `stats calls show`, for a host whose meetings are phone calls: it mounts the command, so a host of video meetings
17
+ * never shows it. Numbers over the stored calls only; nothing is read from the phone system.
18
+ */
19
+ export const addCallStatsCommand = (program, deps) => {
20
+ const stats = program.commands.find((command) => command.name() === "stats") ??
21
+ annotate(program.command("stats"), { effects: NO_EFFECTS }).description("statistics");
22
+ const calls = annotate(stats.command("calls"), { effects: NO_EFFECTS }).description("numbers about the stored phone calls");
23
+ annotate(calls.command("show"), { effects: LOCAL_READ, output: { entity: "call_stats" }, examples: deps.examples })
24
+ .summary("calls by direction, outcome, employee, hour and day; missed calls and callbacks")
25
+ .description("calls by direction and outcome, per employee, by hour and by day; missed incoming calls and whether the " +
26
+ "client was called back; short calls. What the phone system does not record is counted as unknown")
27
+ .option("--since-time <time>", "calls starting at or after this date or time (ISO 8601, or 30d ago)")
28
+ .option("--until-time <time>", "calls starting at or before this date or time; a date alone is that whole day")
29
+ .option("--timezone <zone>", "the IANA zone hours and days are read in (default: this computer's)")
30
+ .option("--person-id <id>", "only calls this stored person took part in; a phone system that keeps no one who only rang misses those", positive)
31
+ .option("--within <duration>", "how long after a missed call a callback counts (default 1d)", (value) => parseDuration(value, "--within"))
32
+ .option("--limit <n>", "most missed calls listed one by one, newest first (default 100); all are counted", positive)
33
+ .action(async (flags, command) => {
34
+ const zone = timezoneOf(flags.timezone);
35
+ const window = dateWindow({ sinceTime: flags.sinceTime, untilTime: flags.untilTime, zone });
36
+ const signal = deps.signal?.();
37
+ const found = await (await deps.read())({
38
+ ...(window.since === undefined ? {} : { since: window.since }),
39
+ ...(window.until === undefined ? {} : { until: window.until }),
40
+ ...(flags.personId === undefined ? {} : { personId: flags.personId }),
41
+ ...(flags.within === undefined ? {} : { callbackWithinMs: flags.within }),
42
+ ...(flags.limit === undefined ? {} : { missedLimit: flags.limit }),
43
+ ...(signal ? { signal } : {}),
44
+ timeZone: zone,
45
+ });
46
+ const body = itemOf(callStatsItem(found), { meta: { ...window.meta, timezone: zone } });
47
+ if (deps.output)
48
+ deps.output(body, command);
49
+ else
50
+ renderAnswer(command, outputFor(command), body);
51
+ });
52
+ };
@@ -0,0 +1,14 @@
1
+ import { Command } from "commander";
2
+ import type { AppIdentity } from "../ports/app.js";
3
+ import { type Body } from "./envelope.js";
4
+ export interface ChatSendingCommandOptions {
5
+ env: (command: Command) => NodeJS.ProcessEnv;
6
+ output: (answer: Body, command: Command) => void;
7
+ /** The command line as the owner types it, such as `tg personal`; the app's command when absent. */
8
+ tool?: (command: Command) => string;
9
+ }
10
+ /**
11
+ * `models chats`: whether `conversations embed` and `conversations links rebuild --analyze` may send chat text
12
+ * to a model outside this computer. One setting for every WireCat tool; a model on this computer is not affected.
13
+ */
14
+ export declare const chatSendingCommand: (app: AppIdentity, options: ChatSendingCommandOptions) => Command;
@@ -0,0 +1,64 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ import { annotate } from "@wirecat/cli-base/commands";
3
+ import { Command } from "commander";
4
+ import { CHAT_SENDING_MODES, chatSendingMode, loosens, readChatSending, writeChatSending, } from "../models/chat-sending.js";
5
+ import { agentOf } from "../runs/run-context.js";
6
+ import { environmentOf } from "./context.js";
7
+ import { grantsAuthority, LOCAL_READ, LOCAL_WRITE } from "./effects.js";
8
+ import { itemOf } from "./envelope.js";
9
+ const MEANING = {
10
+ allowed: "chat text goes to a model outside this computer without a yes, in a terminal and over MCP",
11
+ ask: "each send to a model outside this computer needs a yes: --yes, which an agent may pass",
12
+ denied: "chat text never goes to a model outside this computer, even with --yes",
13
+ };
14
+ const view = (env) => {
15
+ const mode = chatSendingMode(env);
16
+ return { mode, meaning: MEANING[mode], since: readChatSending(env)?.at ?? null };
17
+ };
18
+ /**
19
+ * `models chats`: whether `conversations embed` and `conversations links rebuild --analyze` may send chat text
20
+ * to a model outside this computer. One setting for every WireCat tool; a model on this computer is not affected.
21
+ */
22
+ export const chatSendingCommand = (app, options) => {
23
+ const tool = (command) => options.tool?.(command) ?? app.command;
24
+ const sending = annotate(new Command("chats"), { effects: LOCAL_READ }).description("whether chat text may go to a model off this computer: allowed, ask or denied");
25
+ annotate(sending.command("show"), {
26
+ effects: LOCAL_READ,
27
+ output: { entity: "chat_sending" },
28
+ examples: [`${app.command} models chats show`],
29
+ })
30
+ .description("whether chat text may go to a model outside this computer, and since when")
31
+ .action(function () {
32
+ options.output(itemOf(view(options.env(this))), this);
33
+ });
34
+ grantsAuthority(annotate(sending.command("set"), {
35
+ effects: LOCAL_WRITE,
36
+ mcp: false,
37
+ output: { entity: "chat_sending" },
38
+ examples: [
39
+ `${app.command} models chats set allowed`,
40
+ `${app.command} models chats set ask`,
41
+ `${app.command} models chats set denied`,
42
+ ],
43
+ }))
44
+ .summary("allowed, ask (the default) or denied; only you make it less strict")
45
+ .description("allowed: no yes needed; ask: --yes needed, an agent may pass it; denied: refused even with --yes. " +
46
+ "Only you make it less strict")
47
+ .argument("<mode>", "allowed, ask or denied")
48
+ .option("--from-app", "you did this in WireCat Desktop")
49
+ .action(function (given) {
50
+ if (!CHAT_SENDING_MODES.includes(given))
51
+ throw new CliError("validation_error", "say allowed, ask or denied");
52
+ const mode = given;
53
+ const env = options.env(this);
54
+ const before = chatSendingMode(env);
55
+ if (loosens(before, mode) &&
56
+ (environmentOf(this).agent || agentOf(env)) &&
57
+ !this.opts().fromApp)
58
+ throw new CliError("permission_error", `only the owner makes \`models chats\` less strict, not an agent: ask the owner to run \`${tool(this)} models chats set ${mode}\``, { reason: "chat-sending.owner-only" });
59
+ if (before !== mode)
60
+ writeChatSending(env, mode);
61
+ options.output(itemOf({ ...view(env), changed: before !== mode }), this);
62
+ });
63
+ return sending;
64
+ };
@@ -138,6 +138,13 @@ export declare const withAgentLevels: <F extends {
138
138
  * output goes and a test that captures it sees it. `readSecret(prompt, { ...secretInputOf(this), echo: true })`.
139
139
  */
140
140
  export declare const secretInputOf: (command: Command) => Pick<SecretInput, "input" | "output">;
141
+ /**
142
+ * `--json=a,b` sets the root's `fields`. A command may declare a `--fields` of its own (Google's partial-response
143
+ * mask), which `optsWithGlobals` would put in its place.
144
+ */
145
+ export declare const outputFieldsOf: (command: Command) => {
146
+ fields?: string;
147
+ };
141
148
  /** Whether the run asked for one line per item (WC-OUT-24). */
142
149
  export declare const compactOf: (command: Command) => boolean;
143
150
  /** For the commands that print but never need settings or a connection. */
@@ -60,13 +60,23 @@ const detailOf = ({ brief, full }) => {
60
60
  return brief ? { hitDetail: "brief" } : full ? { hitDetail: "full" } : {};
61
61
  };
62
62
  const COMPACT_KEY = new Option(COMPACT_FLAG).attributeName();
63
+ /**
64
+ * `--json=a,b` sets the root's `fields`. A command may declare a `--fields` of its own (Google's partial-response
65
+ * mask), which `optsWithGlobals` would put in its place.
66
+ */
67
+ export const outputFieldsOf = (command) => {
68
+ const fields = rootOf(command).getOptionValue("fields");
69
+ return typeof fields === "string" ? { fields } : {};
70
+ };
63
71
  /** Whether the run asked for one line per item (WC-OUT-24). */
64
72
  export const compactOf = (command) => command.optsWithGlobals()[COMPACT_KEY] === true;
65
73
  /** For the commands that print but never need settings or a connection. */
66
74
  export const outputFor = (command) => {
67
75
  const { streams, tty, env, agent } = environmentOf(command);
76
+ const { fields: _own, ...flags } = command.optsWithGlobals();
68
77
  return resolveOutput({
69
- ...command.optsWithGlobals(),
78
+ ...flags,
79
+ ...outputFieldsOf(command),
70
80
  ...detailOf(command.optsWithGlobals()),
71
81
  compact: compactOf(command),
72
82
  ...(agent ? { capture: agent.result } : {}),
@@ -85,9 +95,7 @@ export const baseContext = (command, resolveSettings) => {
85
95
  env,
86
96
  compact: compactOf(command),
87
97
  ...detailOf(command.optsWithGlobals()),
88
- ...(command.optsWithGlobals().fields
89
- ? { fields: command.optsWithGlobals().fields }
90
- : {}),
98
+ ...outputFieldsOf(command),
91
99
  ...(environment.agent ? { capture: environment.agent.result } : {}),
92
100
  ...(environment.streams ? { streams: environment.streams } : {}),
93
101
  ...(environment.tty === undefined ? {} : { tty: environment.tty }),
@@ -9,6 +9,7 @@ import { unfilteredQuery, withQuery } from "./list-query.js";
9
9
  import { doctorCommand } from "./messenger/doctor-command.js";
10
10
  import { mcpCommand } from "./messenger/mcp-command.js";
11
11
  import { searchCommand } from "./messenger/search-command.js";
12
+ import { pagingOf } from "./paging.js";
12
13
  import { settingsFor } from "./settings.js";
13
14
  /**
14
15
  * `search all` as it was before meetings became one of its sources: cli-memo, zoom-cli and drive-cli review their
@@ -68,6 +69,7 @@ export const sharedCommandTemplate = (app, name) => {
68
69
  get store() {
69
70
  return unavailable();
70
71
  },
72
+ pagingOf,
71
73
  accountId: 0,
72
74
  write: unavailable,
73
75
  inRun: unavailable,
@@ -228,11 +228,6 @@ export interface AnswerOutput {
228
228
  }
229
229
  /** An answer as JSON-lines records, for a writer that streams objects: one per item, then the end record. */
230
230
  export declare const jsonlRecords: <T>(body: Body<T>) => object[];
231
- /**
232
- * Prints an answer. Machine output gets the whole envelope (`--jsonl` the items and an end line); a person gets
233
- * the items — `view` draws them — and each next step this CLI has, as a line on stderr. A partial answer the
234
- * command does not declare `partial` exits with its first issue's code, after printing what was read.
235
- */
236
231
  export declare const renderAnswer: <T>(command: Command, { renderer, format, streams, compact, full }: AnswerOutput, body: Body<T>, view?: (body: Body<T>) => string) => void;
237
232
  /**
238
233
  * A document that is not an answer about the owner's data — the command registry, a `--dry-run` preview of what a