@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
@@ -1,8 +1,10 @@
1
1
  import { exitCodeOfAnswer } from "@wirecat/cli-base";
2
2
  import { metaOf } from "@wirecat/cli-base/commands";
3
+ import { parseLucene, timezoneOf } from "@wirecat/cli-base/query";
3
4
  import { COMPACT_FLAG, itemEnvelopeSchema, jsonlOf, listEnvelopeSchema, MAX_NEXT_STEPS, } from "@wirecat/cli-base/standards";
4
5
  import * as v from "valibot";
5
6
  import { currentRun } from "../runs/scope.js";
7
+ import { readsZone } from "../search/service-query.js";
6
8
  import { compactText, entityRows, rowShapeOf, rowsOfEntity, TEXT_CHARS } from "./compact.js";
7
9
  import { environmentOf, setExitCode } from "./context.js";
8
10
  import { largeAnswerSteps, SOFT_OUTPUT_BYTES } from "./output-budget.js";
@@ -154,9 +156,32 @@ export const jsonlRecords = (body) => linesOf(sealed(body))
154
156
  * the items — `view` draws them — and each next step this CLI has, as a line on stderr. A partial answer the
155
157
  * command does not declare `partial` exits with its first issue's code, after printing what was read.
156
158
  */
159
+ /**
160
+ * The zone a list's `[query...]` read its dates in, for `meta.timezone` as search and the inbox give it: every store
161
+ * list compiles its query in the computer's zone, or in `--timezone` where the list takes one.
162
+ */
163
+ const listZone = (command) => {
164
+ const registry = metaOf(command).query;
165
+ const words = command.processedArgs.at(-1);
166
+ const text = Array.isArray(words) ? words.join(" ") : typeof words === "string" ? words : "";
167
+ const times = new Set(registry?.fields.filter(({ type }) => type === "time").map(({ name }) => name));
168
+ if (times.size === 0 || text.trim() === "")
169
+ return undefined;
170
+ try {
171
+ if (!readsZone(parseLucene(text, { defaultField: "none" }), times))
172
+ return undefined;
173
+ }
174
+ catch {
175
+ return undefined;
176
+ }
177
+ return timezoneOf(command.optsWithGlobals().timezone);
178
+ };
157
179
  export const renderAnswer = (command, { renderer, format, streams, compact, full }, body, view) => {
158
180
  if (!isBody(body))
159
181
  refuse(body);
182
+ const zone = "items" in body && body.meta?.timezone === undefined ? listZone(command) : undefined;
183
+ if (zone)
184
+ body = { ...body, meta: { ...body.meta, timezone: zone } };
160
185
  const root = rootOf(command);
161
186
  const runnableSteps = runnable(root, body.next);
162
187
  const next = environmentOf(command).agent ? runnableSteps : withLines(root, runnableSteps);
@@ -67,6 +67,7 @@ export { BOT_ACTIONS, type BotAction, type BotAdapter, type BotCallbacks, type B
67
67
  export { botFiles, botsDirectory, ChatRegistry, registryProfiles, type SeenChat } from "./bot/registry.js";
68
68
  export { BotTokenStore, type BotTokenStoreOptions } from "./bot/token.js";
69
69
  export { PressLog, UpdatesCursor } from "./bot/updates.js";
70
+ export { addCallStatsCommand, type CallStatsCommandDeps, type CallStatsRead } from "./call-stats-command.js";
70
71
  export type { CommandAvailability, DiscoveredCommand } from "./command-availability.js";
71
72
  export { commandContract, type JsonSchema, SCHEMA_DIALECT } from "./command-contract.js";
72
73
  export { type CommandRunOptions, type CommandRuns, commandRuns, type ProviderAnswer, type ProviderCall, providerEvent, providerRequest, type RunSettings, recordRuns, runSettings, type SavedRunSettings, } from "./command-runs.js";
@@ -105,11 +106,13 @@ export { answerLocally, type ShownTime, wallClock } from "./local-times.js";
105
106
  export { MCP_HTTP_DEFAULT_PORT, type McpServerOptions, type McpServerTarget, mcpServerCommand, } from "./mcp-server-command.js";
106
107
  export { formatMeetingBatch, prepareMeetingBatch } from "./meeting-batch.js";
107
108
  export { meetingEvidenceItem, meetingPersonContextItem } from "./meeting-evidence-answer.js";
109
+ export { addMeetingCombinedSearchCommand, addMeetingEmbeddingCommand, type MeetingCombinedSearchDeps, type MeetingEmbeddingCommandDeps, type MeetingSearchRun, } from "./meeting-meaning-command.js";
108
110
  export { meetingPreparationAnswer } from "./meeting-preparation-answer.js";
109
111
  export { type MeetingPreparationReader, meetingPreparationInput, readMeetingPreparation, } from "./meeting-preparation-read.js";
110
112
  export { readMeetingProjectCandidates } from "./meeting-project-candidates-read.js";
111
113
  export { meetingResultItem } from "./meeting-results.js";
112
114
  export { type MeetingSeriesInventoryReader, readMeetingSeriesInventory } from "./meeting-series-inventory-read.js";
115
+ export { addMeetingTagsCommand, type MeetingTagsCommandDeps } from "./meeting-tags-command.js";
113
116
  export { accountFileFor, profilesHere, rememberAccount } from "./messenger/accounts.js";
114
117
  export { terminalAsker } from "./messenger/ask.js";
115
118
  export type { CompletionOptions } from "./messenger/complete-command.js";
@@ -132,7 +135,7 @@ export { type Saving, stored } from "./messenger/stored.js";
132
135
  export { dateOrNone } from "./messenger/tasks-command.js";
133
136
  export { MODEL_CATALOGUE_QUERY, type ModelCatalogueOptions } from "./model-catalogue-command.js";
134
137
  export { writeNewFile } from "./new-file.js";
135
- export { positiveCount, window, withPaging } from "./paging.js";
138
+ export { pagingOf, positiveCount, window, withPaging } from "./paging.js";
136
139
  export { type CommandPermissions, type ConditionalKey, commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, type PermissionKeyOf, type PermissionKeySource, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
137
140
  export { asFirstWord, commandWords, liftProfile, profileFree, refuseCommandName, rootOf, runGroup, takesProfile, usableProfileName, } from "./profile.js";
138
141
  export { ProfileTokenStore, type ProfileTokenStoreOptions, type TokenStorage } from "./profile-token.js";
package/dist/cli/index.js CHANGED
@@ -60,6 +60,7 @@ export { BOT_ACTIONS, } from "./bot/port.js";
60
60
  export { botFiles, botsDirectory, ChatRegistry, registryProfiles } from "./bot/registry.js";
61
61
  export { BotTokenStore } from "./bot/token.js";
62
62
  export { PressLog, UpdatesCursor } from "./bot/updates.js";
63
+ export { addCallStatsCommand } from "./call-stats-command.js";
63
64
  export { commandContract, SCHEMA_DIALECT } from "./command-contract.js";
64
65
  export { commandRuns, providerEvent, providerRequest, recordRuns, runSettings, } from "./command-runs.js";
65
66
  export { CONTRACT } from "./commands-command.js";
@@ -96,11 +97,13 @@ export { answerLocally, wallClock } from "./local-times.js";
96
97
  export { MCP_HTTP_DEFAULT_PORT, mcpServerCommand, } from "./mcp-server-command.js";
97
98
  export { formatMeetingBatch, prepareMeetingBatch } from "./meeting-batch.js";
98
99
  export { meetingEvidenceItem, meetingPersonContextItem } from "./meeting-evidence-answer.js";
100
+ export { addMeetingCombinedSearchCommand, addMeetingEmbeddingCommand, } from "./meeting-meaning-command.js";
99
101
  export { meetingPreparationAnswer } from "./meeting-preparation-answer.js";
100
102
  export { meetingPreparationInput, readMeetingPreparation, } from "./meeting-preparation-read.js";
101
103
  export { readMeetingProjectCandidates } from "./meeting-project-candidates-read.js";
102
104
  export { meetingResultItem } from "./meeting-results.js";
103
105
  export { readMeetingSeriesInventory } from "./meeting-series-inventory-read.js";
106
+ export { addMeetingTagsCommand } from "./meeting-tags-command.js";
104
107
  export { accountFileFor, profilesHere, rememberAccount } from "./messenger/accounts.js";
105
108
  export { terminalAsker } from "./messenger/ask.js";
106
109
  export { connectFor, messengerContext, } from "./messenger/context.js";
@@ -121,7 +124,7 @@ export { stored } from "./messenger/stored.js";
121
124
  export { dateOrNone } from "./messenger/tasks-command.js";
122
125
  export { MODEL_CATALOGUE_QUERY } from "./model-catalogue-command.js";
123
126
  export { writeNewFile } from "./new-file.js";
124
- export { positiveCount, window, withPaging } from "./paging.js";
127
+ export { pagingOf, positiveCount, window, withPaging } from "./paging.js";
125
128
  export { commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
126
129
  export { asFirstWord, commandWords, liftProfile, profileFree, refuseCommandName, rootOf, runGroup, takesProfile, usableProfileName, } from "./profile.js";
127
130
  export { ProfileTokenStore } from "./profile-token.js";
@@ -3,7 +3,8 @@ import { type Meta } from "@wirecat/cli-base/standards";
3
3
  import { Command } from "commander";
4
4
  import { type MeetingBatchReader, type MeetingPassageOutputFormat } from "../meetings/index.js";
5
5
  import { type Body } from "./envelope.js";
6
- export declare const prepareMeetingBatch: (input: string, reader: MeetingBatchReader, meta: () => Meta) => import("@wirecat/cli-base").PreparedBatchRequest[];
6
+ /** `limit` is a search's page without `--limit`: the profile's `defaults.limit`. */
7
+ export declare const prepareMeetingBatch: (input: string, reader: MeetingBatchReader, meta: () => Meta, limit: number) => import("@wirecat/cli-base").PreparedBatchRequest[];
7
8
  export declare const formatMeetingBatch: (report: BatchReport, format: "text" | "markdown") => string;
8
9
  export declare const addMeetingBatchCommand: (program: Command, deps: {
9
10
  reader: MeetingBatchReader;
@@ -11,6 +11,7 @@ import { formatMeetingEvidenceText, formatMeetingPassage } from "../services/mee
11
11
  import { answerEntity } from "./answer-entity.js";
12
12
  import { destroysNothing } from "./effects.js";
13
13
  import { answerSchema, itemOf, listOf } from "./envelope.js";
14
+ import { pagingOf } from "./paging.js";
14
15
  const INDEX_BYTES = 4194304;
15
16
  const parse = (command, args) => {
16
17
  command
@@ -27,7 +28,7 @@ const parse = (command, args) => {
27
28
  }
28
29
  return command;
29
30
  };
30
- const handlers = (reader, meta) => {
31
+ const handlers = (reader, meta, limit) => {
31
32
  let indexed;
32
33
  return [
33
34
  {
@@ -36,7 +37,7 @@ const handlers = (reader, meta) => {
36
37
  const command = parse(createMeetingSearchCommand(new Command()), args);
37
38
  const query = command.processedArgs[0];
38
39
  const flags = command.opts();
39
- const request = meetingHitSearchRequest(query, flags);
40
+ const request = meetingHitSearchRequest(query, flags, limit);
40
41
  return {
41
42
  run: async (ctx) => {
42
43
  ctx.reserveReadBytes(request.maxReadBytes ?? 4194304);
@@ -50,7 +51,7 @@ const handlers = (reader, meta) => {
50
51
  found.coverage = { ...found.coverage, indexing: "pending" };
51
52
  const complete = found.coverage.indexing === "ready";
52
53
  const answer = {
53
- ...meetingHitsList(found, request.limit ?? 100, "search meetings", meetingSearchArguments(query, flags)),
54
+ ...meetingHitsList(found, request.limit, "search meetings", meetingSearchArguments(query, flags)),
54
55
  meta: {
55
56
  ...meta(),
56
57
  ...meetingSearchMeta(flags),
@@ -99,7 +100,8 @@ const handlers = (reader, meta) => {
99
100
  },
100
101
  ];
101
102
  };
102
- export const prepareMeetingBatch = (input, reader, meta) => prepareBatch(input, handlers(reader, meta));
103
+ /** `limit` is a search's page without `--limit`: the profile's `defaults.limit`. */
104
+ export const prepareMeetingBatch = (input, reader, meta, limit) => prepareBatch(input, handlers(reader, meta, limit));
103
105
  const textResult = (result, format) => {
104
106
  const title = `${result.id}: ${result.command.join(" ")}`;
105
107
  if (result.status !== "ok")
@@ -138,7 +140,7 @@ export const addMeetingBatchCommand = (program, deps) => {
138
140
  if (fields && format !== "json")
139
141
  throw new CliError("validation_error", "batch field selection requires JSON output");
140
142
  const input = await deps.input(path, deps.signal());
141
- const requests = prepareMeetingBatch(input, deps.reader, deps.meta);
143
+ const requests = prepareMeetingBatch(input, deps.reader, deps.meta, pagingOf(action).limit);
142
144
  const report = await runBatch(requests, {
143
145
  signal: deps.signal(),
144
146
  maxReadBytes: options.maxReadBytes,
@@ -0,0 +1,47 @@
1
+ import { type Command } from "commander";
2
+ import { type MeetingHitSearch, type MeetingSearchFlags } from "../meetings/cli/index.js";
3
+ import type { MeetingMeaning } from "../services/meeting-meaning.js";
4
+ import { type Body } from "./envelope.js";
5
+ interface MeaningFlags {
6
+ model?: string;
7
+ baseUrl?: string;
8
+ dims?: number;
9
+ maxChunks?: number;
10
+ maxRows?: number;
11
+ maxTextBytes?: number;
12
+ }
13
+ type SearchFlags = MeetingSearchFlags & MeaningFlags;
14
+ export interface MeetingCombinedSearchDeps {
15
+ words: () => Promise<MeetingHitSearch>;
16
+ meaning: () => Promise<MeetingMeaning>;
17
+ signal: () => AbortSignal | undefined;
18
+ /** The page without `--limit`: `pagingOf` from `@wirecat/cli-core/cli`, which reads the profile's limit. */
19
+ pagingOf: (command: Command) => {
20
+ limit: number;
21
+ };
22
+ output: (body: Body, command: Command) => void;
23
+ /** One to three examples that run as written, with the host's command and a profile. */
24
+ examples: string[];
25
+ }
26
+ export type MeetingSearchRun = (query: string, options: SearchFlags, command: Command) => Promise<Body>;
27
+ /**
28
+ * `search meetings` by words, and by words and meaning ranked together with `--model`, for any host of stored
29
+ * meetings. Returns the run, so a host's saved searches replay it.
30
+ */
31
+ export declare const addMeetingCombinedSearchCommand: (program: Command, deps: MeetingCombinedSearchDeps) => MeetingSearchRun;
32
+ export interface MeetingEmbeddingCommandDeps {
33
+ meaning: () => Promise<MeetingMeaning>;
34
+ /** The local model used without `--model`: the `models` command's default text model. */
35
+ defaultModel: () => string;
36
+ signal: () => AbortSignal | undefined;
37
+ output: (body: Body, command: Command) => void;
38
+ /** Where a write's answer goes when the host keeps a receipt of it; `output` otherwise. */
39
+ receipt?: (body: Body, command: Command) => Promise<void>;
40
+ examples: string[];
41
+ }
42
+ /**
43
+ * `meetings embed`: previews the vectors a search by meaning needs, and `--yes` splits every transcript and embeds one
44
+ * batch of the passages without a vector; run it again for the next batch.
45
+ */
46
+ export declare const addMeetingEmbeddingCommand: (program: Command, deps: MeetingEmbeddingCommandDeps) => void;
47
+ export {};
@@ -0,0 +1,136 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ import { annotate, overrideSharedContract } from "@wirecat/cli-base/commands";
3
+ import { InvalidArgumentError } from "commander";
4
+ import { createMeetingSearchCommand, meetingHitSearchRequest, meetingSearchArguments, meetingSearchMeta, } from "../meetings/cli/index.js";
5
+ import { meetingHitsList } from "../meetings/index.js";
6
+ import { FETCH } from "./effects.js";
7
+ import { itemOf, listOf } from "./envelope.js";
8
+ const count = (value) => {
9
+ if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
10
+ throw new InvalidArgumentError("expected a positive integer");
11
+ return Number(value);
12
+ };
13
+ const FLAG = {
14
+ maxReadBytes: "--max-read-bytes",
15
+ baseUrl: "--base-url",
16
+ dims: "--dims",
17
+ maxChunks: "--max-chunks",
18
+ maxRows: "--max-rows",
19
+ maxTextBytes: "--max-text-bytes",
20
+ };
21
+ const refuse = (options, keys, mode) => {
22
+ const given = keys.filter((key) => options[key] !== undefined).map((key) => FLAG[key]);
23
+ if (given.length)
24
+ throw new CliError("validation_error", `${given.join(", ")} do not apply ${mode}`);
25
+ };
26
+ // The root `--offline`: a remote `--base-url` would send the passages out.
27
+ const offline = (command) => command.optsWithGlobals().offline === true;
28
+ /** Combined hits as the list answer: each cites a line, says how it was found, and keeps its passage. */
29
+ const combinedList = (found, limit, args) => listOf("search meetings", {
30
+ items: found.items.map((hit) => ({
31
+ ref: hit.ref,
32
+ meeting: hit.ref.split("/").slice(0, 2).join("/"),
33
+ scope: hit.scope,
34
+ excerpt: hit.text,
35
+ offset_ms: hit.startMs,
36
+ by: hit.by,
37
+ score: hit.score,
38
+ ...(hit.passage ? { passage: hit.passage } : {}),
39
+ ...(hit.match ? { match: hit.match } : {}),
40
+ ...(hit.corrections ? { corrections: hit.corrections } : {}),
41
+ source: {
42
+ ref: hit.ref,
43
+ title: hit.source.title,
44
+ started_at: hit.source.startedAt === null ? null : new Date(hit.source.startedAt).toISOString(),
45
+ url: hit.source.url,
46
+ },
47
+ untrusted: ["excerpt", "passage.first", "passage.last", "source.title"],
48
+ })),
49
+ limit,
50
+ has_more: found.hasMore,
51
+ paging: "cursor",
52
+ ...(found.nextCursor ? { cursor: found.nextCursor } : {}),
53
+ args,
54
+ missing: [
55
+ ...(found.coverage.meaningScanComplete
56
+ ? []
57
+ : [{ field: "items", why: `meaning compared only ${found.coverage.scanned} passages; raise --max-chunks` }]),
58
+ ...(found.words.refused ? [{ field: "items", why: `found by meaning only: ${found.words.refused}` }] : []),
59
+ ],
60
+ });
61
+ const MEANING_REASON = "search meetings also ranks by meaning with --model, over vectors built on this computer";
62
+ const withMeaningOptions = (command) => overrideSharedContract(command, MEANING_REASON, (one) => {
63
+ one
64
+ .description("find words in stored meetings, and by meaning with --model")
65
+ .option("--model <model>", "rank words and meaning together with this embedding model, building missing vectors first; local stays here")
66
+ .option("--base-url <url>", "remote embedding service for --model; the passages are sent there")
67
+ .option("--dims <n>", "vector size the remote service returns, in dimensions", count)
68
+ .option("--max-chunks <n>", "by meaning: most stored passages to compare (default 10000)", count)
69
+ .option("--max-rows <n>", "by meaning: most transcript lines to read, 1 through 100000", count)
70
+ .option("--max-text-bytes <bytes>", "by meaning: most transcript text to read (default 4 MiB)", count);
71
+ });
72
+ /**
73
+ * `search meetings` by words, and by words and meaning ranked together with `--model`, for any host of stored
74
+ * meetings. Returns the run, so a host's saved searches replay it.
75
+ */
76
+ export const addMeetingCombinedSearchCommand = (program, deps) => {
77
+ const execute = async (query, options, command) => {
78
+ const request = meetingHitSearchRequest(query, options, deps.pagingOf(command).limit, deps.signal());
79
+ if (options.model !== undefined) {
80
+ refuse(options, ["maxReadBytes"], "to a search by meaning");
81
+ const { limit, after, maxReadBytes: _bytes, signal, ...selection } = request;
82
+ if (options.baseUrl !== undefined && offline(command))
83
+ throw new CliError("configuration_error", "remote embeddings require network access; remove --offline");
84
+ const meaning = {
85
+ model: options.model,
86
+ baseUrl: options.baseUrl,
87
+ dims: options.dims,
88
+ limit,
89
+ maxChunks: options.maxChunks,
90
+ after,
91
+ selection,
92
+ maxRows: options.maxRows,
93
+ maxTextBytes: options.maxTextBytes,
94
+ buildMissing: true,
95
+ signal,
96
+ };
97
+ return combinedList(await (await deps.meaning()).search(query, meaning), limit, meetingSearchArguments(query, options));
98
+ }
99
+ refuse(options, ["baseUrl", "dims", "maxChunks", "maxRows", "maxTextBytes"], "without --model");
100
+ return meetingHitsList(await (await deps.words())(query, request), request.limit, "search meetings", meetingSearchArguments(query, options), meetingSearchMeta(options));
101
+ };
102
+ const command = withMeaningOptions(createMeetingSearchCommand(program)).action(async (query, options, self) => deps.output(await execute(query, options, self), self));
103
+ overrideSharedContract(command, "a search by meaning may build missing vectors, so it writes to the store", (one) => annotate(one, { origin: "handwritten", effects: FETCH, examples: deps.examples }));
104
+ return execute;
105
+ };
106
+ /**
107
+ * `meetings embed`: previews the vectors a search by meaning needs, and `--yes` splits every transcript and embeds one
108
+ * batch of the passages without a vector; run it again for the next batch.
109
+ */
110
+ export const addMeetingEmbeddingCommand = (program, deps) => {
111
+ const meetings = program.commands.find((command) => command.name() === "meetings");
112
+ if (!meetings)
113
+ throw new CliError("configuration_error", "meeting command group is unavailable");
114
+ annotate(meetings
115
+ .command("embed")
116
+ .description("preview building the vectors search by meaning reads; --yes builds one batch, rerun for the next")
117
+ .option("--model <model>", "embedding model: a local one (default: the models command's default text model)")
118
+ .option("--base-url <url>", "remote embedding service; the passages are sent there. OpenAI reads OPENAI_API_KEY")
119
+ .option("--dims <n>", "vector size the remote service returns, in dimensions", count)
120
+ .option("--limit <n>", "how many passages in one batch, 1 through 1000 (default 100)", count)
121
+ .option("--max-rows <n>", "most transcript lines to read, 1 through 100000", count)
122
+ .option("--max-text-bytes <bytes>", "most transcript text to read, in bytes (default 4 MiB)", count)
123
+ .option("--yes", "split transcripts and build their vectors; otherwise only preview")
124
+ .action(async (flags, command) => {
125
+ if (flags.baseUrl !== undefined && flags.model === undefined)
126
+ throw new CliError("validation_error", "a remote --base-url needs its own --model");
127
+ if (flags.baseUrl !== undefined && offline(command))
128
+ throw new CliError("configuration_error", "remote embeddings require network access; remove --offline");
129
+ const options = { ...flags, model: flags.model ?? deps.defaultModel(), signal: deps.signal() };
130
+ const body = itemOf(await (await deps.meaning()).generate(options));
131
+ if (options.yes && deps.receipt)
132
+ await deps.receipt(body, command);
133
+ else
134
+ deps.output(body, command);
135
+ }), { origin: "handwritten", effects: FETCH, examples: deps.examples });
136
+ };
@@ -317,6 +317,12 @@ export declare const meetingPreparationAnswer: (packet: MeetingPreparation) => i
317
317
  from: string;
318
318
  to: string[];
319
319
  }[] | undefined;
320
+ by?: ("meaning" | "words")[] | undefined;
321
+ score?: number | null | undefined;
322
+ passage?: {
323
+ first: string;
324
+ last: string;
325
+ } | undefined;
320
326
  source?: {
321
327
  ref: string;
322
328
  title: string | null;
@@ -20,13 +20,13 @@ export const addMeetingPreparationCommand = (program, deps) => {
20
20
  prepare
21
21
  .option("--context-source <id=cursor>", "authorized communications selection ID, optionally ID=cursor; repeat", (value, previous) => [...previous, value], [])
22
22
  .option("--context-query <words>", "literal words to find within the selected communications")
23
- .option("--context-since-time <time>", "communications window start as zoned ISO timestamp (default fourteen days before end)")
24
- .option("--context-before-time <time>", "exclusive communications end as zoned ISO timestamp (default preparation start)");
23
+ .option("--context-since-time <time>", "communications window start, an ISO date or time or 7d ago (default fourteen days before end)")
24
+ .option("--context-before-time <time>", "exclusive communications end, an ISO date or time (default preparation start)");
25
25
  return annotate(prepare
26
26
  .option("--project <project>", "include unconfirmed word evidence for one existing project name, key or alias")
27
- .option("--since-time <time>", "window start as ISO timestamp with zone (default now)")
28
- .option("--before-time <time>", "exclusive window end as ISO timestamp (default seven days after start)")
29
- .option("--history-since-time <time>", "history start as ISO timestamp (default thirty days before start)")
27
+ .option("--since-time <time>", "window start, an ISO date or time, local without a zone (default now)")
28
+ .option("--before-time <time>", "exclusive window end, an ISO date or time; a date alone covers that day (default seven days after start)")
29
+ .option("--history-since-time <time>", "history start, an ISO date or time or 30d ago (default thirty days before start)")
30
30
  .option("--meetings <n>", "prior occurrences and separate related-meeting limit, 1–20 (default 5)", integer)
31
31
  .option("--cues <n>", "cues per occurrence, 1–100 (default 10)", integer)
32
32
  .option("--context-limit <n>", "entries per context category, 1–100 (default 20)", integer)
@@ -37,6 +37,12 @@ export declare const mapPreparationProjectEvidence: (section: NonNullable<Meetin
37
37
  from: string;
38
38
  to: string[];
39
39
  }[] | undefined;
40
+ by?: ("meaning" | "words")[] | undefined;
41
+ score?: number | null | undefined;
42
+ passage?: {
43
+ first: string;
44
+ last: string;
45
+ } | undefined;
40
46
  source?: {
41
47
  ref: string;
42
48
  title: string | null;
@@ -15,13 +15,13 @@ export declare const meetingPreparationInput: v.StrictObjectSchema<{
15
15
  cursor?: string | undefined;
16
16
  }[], 8, undefined>]>;
17
17
  readonly query: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
18
- readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>, undefined>;
19
- readonly before: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>, undefined>;
18
+ readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
19
+ readonly before: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
20
20
  }, undefined>, undefined>;
21
21
  readonly project: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
22
- readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>, undefined>;
23
- readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>, undefined>;
24
- readonly history_after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>, undefined>;
22
+ readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
23
+ readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
24
+ readonly history_after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
25
25
  readonly meetings: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1 | 4096, undefined>, v.MaxValueAction<number, 20 | 100 | 4194304, undefined>]>, undefined>;
26
26
  readonly cues: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1 | 4096, undefined>, v.MaxValueAction<number, 20 | 100 | 4194304, undefined>]>, undefined>;
27
27
  readonly context_limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1 | 4096, undefined>, v.MaxValueAction<number, 20 | 100 | 4194304, undefined>]>, undefined>;
@@ -346,6 +346,12 @@ export declare const readMeetingPreparation: (read: MeetingPreparationReader, in
346
346
  from: string;
347
347
  to: string[];
348
348
  }[] | undefined;
349
+ by?: ("meaning" | "words")[] | undefined;
350
+ score?: number | null | undefined;
351
+ passage?: {
352
+ first: string;
353
+ last: string;
354
+ } | undefined;
349
355
  source?: {
350
356
  ref: string;
351
357
  title: string | null;
@@ -1,10 +1,10 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import * as v from "valibot";
3
3
  import { communicationFields } from "../context/communication-selection.js";
4
- import { zonedTime } from "../entities/index.js";
5
- import { validateMeetingChange } from "../meetings/index.js";
4
+ import { typedTime } from "../entities/index.js";
6
5
  import { MEETING_PREPARATION_LIMITS, validateMeetingPreparationRequest, } from "../services/index.js";
7
6
  import { validatePreparationCommunications } from "../services/meeting-communications-selection.js";
7
+ import { momentOf } from "../services/moment.js";
8
8
  import { meetingPreparationAnswer } from "./meeting-preparation-answer.js";
9
9
  const bound = (name) => {
10
10
  const { min, max } = MEETING_PREPARATION_LIMITS[name];
@@ -12,27 +12,19 @@ const bound = (name) => {
12
12
  };
13
13
  export const meetingPreparationInput = v.strictObject({
14
14
  series_id: v.pipe(v.string(), v.minLength(1), v.maxLength(1000)),
15
- communications: v.optional(v.strictObject({ ...communicationFields, after: v.optional(zonedTime), before: v.optional(zonedTime) })),
15
+ communications: v.optional(v.strictObject({ ...communicationFields, after: v.optional(typedTime), before: v.optional(typedTime) })),
16
16
  project: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(200))),
17
- after: v.optional(zonedTime),
18
- until: v.optional(zonedTime),
19
- history_after: v.optional(zonedTime),
17
+ after: v.optional(typedTime),
18
+ until: v.optional(typedTime),
19
+ history_after: v.optional(typedTime),
20
20
  meetings: bound("meetings"),
21
21
  cues: bound("cues"),
22
22
  context_limit: bound("contextLimit"),
23
23
  max_read_bytes: bound("maxReadBytes"),
24
24
  bytes: bound("bytes"),
25
25
  });
26
- const instant = (value, fallback, field) => {
27
- if (value === undefined)
28
- return fallback;
29
- try {
30
- return Date.parse(validateMeetingChange({ startTime: value }, false).startTime);
31
- }
32
- catch {
33
- throw new CliError("validation_error", `${field} must be a valid ISO timestamp with a zone`);
34
- }
35
- };
26
+ // A date alone ends a window at the end of that day and starts one at its start.
27
+ const instant = (value, fallback, field, now, end = false) => value === undefined ? fallback : momentOf(value, field, now, { end });
36
28
  export const readMeetingPreparation = async (read, input, signal, now = Date.now()) => {
37
29
  if (!input || typeof input !== "object" || Array.isArray(input))
38
30
  throw new CliError("validation_error", "meeting preparation arguments are required");
@@ -48,9 +40,9 @@ export const readMeetingPreparation = async (read, input, signal, now = Date.now
48
40
  throw new CliError("validation_error", `invalid meeting preparation field: ${String(field)}`);
49
41
  }
50
42
  const args = parsed.output;
51
- const after = instant(args.after, now, "after");
52
- const until = instant(args.until, after + 7 * 86400000, "until");
53
- const historyAfter = instant(args.history_after, after - 30 * 86400000, "history_after");
43
+ const after = instant(args.after, now, "after", now);
44
+ const until = instant(args.until, after + 7 * 86400000, "until", now, true);
45
+ const historyAfter = instant(args.history_after, after - 30 * 86400000, "history_after", now);
54
46
  const request = validateMeetingPreparationRequest(args.series_id, {
55
47
  ...(args.project === undefined ? {} : { project: args.project }),
56
48
  ...(args.communications === undefined
@@ -58,8 +50,8 @@ export const readMeetingPreparation = async (read, input, signal, now = Date.now
58
50
  : {
59
51
  communications: {
60
52
  ...args.communications,
61
- after: instant(args.communications.after, Math.max(0, instant(args.communications.before, after, "communications.before") - 14 * 86400000), "communications.after"),
62
- before: instant(args.communications.before, after, "communications.before"),
53
+ after: instant(args.communications.after, Math.max(0, instant(args.communications.before, after, "communications.before", now, true) - 14 * 86400000), "communications.after", now),
54
+ before: instant(args.communications.before, after, "communications.before", now, true),
63
55
  },
64
56
  }),
65
57
  after,
@@ -14,8 +14,8 @@ export const addMeetingSeriesInventoryCommand = (program, deps) => {
14
14
  return annotate(meetings
15
15
  .command("scheduled")
16
16
  .description("discover candidate meeting series from one bounded provider page")
17
- .option("--since-time <time>", "absolute window start as ISO timestamp with zone (default now)")
18
- .option("--before-time <time>", "exclusive ISO window end (default seven days after start)")
17
+ .option("--since-time <time>", "window start, an ISO date or time, local without a zone (default now)")
18
+ .option("--before-time <time>", "exclusive window end, an ISO date or time; a date alone covers that day (default seven days after start)")
19
19
  .option("--limit <n>", "series candidates in one provider page, 1–100 (default 100)", integer)
20
20
  .option("--max-read-bytes <bytes>", "normalized provider-page bytes, at most 1048576 (default 65536)", integer)
21
21
  .option("--bytes <bytes>", "answer item UTF-8 JSON bytes, 2048–1048576 (default 65536)", integer)
@@ -2,8 +2,8 @@ import * as v from "valibot";
2
2
  import { type MeetingSeriesInventoryRequest, type MeetingSeriesInventoryResult } from "../meetings/index.js";
3
3
  export type MeetingSeriesInventoryReader = (request: MeetingSeriesInventoryRequest) => Promise<MeetingSeriesInventoryResult>;
4
4
  export declare const meetingSeriesInventoryInput: v.StrictObjectSchema<{
5
- readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>, undefined>;
6
- readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time with a zone">]>, undefined>;
5
+ readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
6
+ readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
7
7
  readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
8
8
  readonly max_read_bytes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
9
9
  readonly bytes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
@@ -1,12 +1,13 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import * as v from "valibot";
3
- import { meetingSeriesInventory, zonedTime } from "../entities/index.js";
4
- import { validateMeetingChange, validateMeetingSeriesInventoryCursor, } from "../meetings/index.js";
3
+ import { meetingSeriesInventory, typedTime } from "../entities/index.js";
4
+ import { validateMeetingSeriesInventoryCursor, } from "../meetings/index.js";
5
+ import { momentOf } from "../services/moment.js";
5
6
  import { itemOf, metaNow, sealed, snakeKeys } from "./envelope.js";
6
7
  const bounded = (min, max) => v.optional(v.pipe(v.number(), v.integer(), v.minValue(min), v.maxValue(max)));
7
8
  export const meetingSeriesInventoryInput = v.strictObject({
8
- after: v.optional(zonedTime),
9
- until: v.optional(zonedTime),
9
+ after: v.optional(typedTime),
10
+ until: v.optional(typedTime),
10
11
  limit: bounded(1, 100),
11
12
  max_read_bytes: bounded(1, 1048576),
12
13
  bytes: bounded(2048, 1048576),
@@ -20,16 +21,7 @@ const storedInstant = (value) => {
20
21
  throw new CliError("invalid_response", "meeting inventory scheduled_start_at is invalid");
21
22
  return new Date(value).toISOString();
22
23
  };
23
- const instant = (value, fallback, field) => {
24
- if (value === undefined)
25
- return fallback;
26
- try {
27
- return Date.parse(validateMeetingChange({ startTime: value }, false).startTime);
28
- }
29
- catch {
30
- throw new CliError("validation_error", `invalid meeting inventory ${field}`);
31
- }
32
- };
24
+ const instant = (value, fallback, field, now, end = false) => value === undefined ? fallback : momentOf(value, `meeting inventory ${field}`, now, { end });
33
25
  export const boundMeetingSeriesInventoryItem = (item) => {
34
26
  if (Buffer.byteLength(JSON.stringify(item), "utf8") > item.limits.bytes)
35
27
  throw new CliError("validation_error", "meeting inventory bytes cannot fit the provider page; increase bytes or lower limit");
@@ -51,7 +43,7 @@ export const readMeetingSeriesInventory = async (read, input, signal, now = Date
51
43
  const args = parsed.output;
52
44
  if (args.cursor !== undefined)
53
45
  validateMeetingSeriesInventoryCursor(args.cursor);
54
- const after = instant(args.after, now, "after"), until = instant(args.until, after + 7 * 86400000, "until");
46
+ const after = instant(args.after, now, "after", now), until = instant(args.until, after + 7 * 86400000, "until", now, true);
55
47
  if (!Number.isSafeInteger(after) || !Number.isSafeInteger(until) || after >= until || until - after > 366 * 86400000)
56
48
  throw new CliError("validation_error", "meeting inventory after/until must form a finite window of at most 366 days");
57
49
  signal?.throwIfAborted();
@@ -0,0 +1,18 @@
1
+ import { type Command } from "commander";
2
+ import type { MeetingTags } from "../services/meeting-tags.js";
3
+ import { type Body } from "./envelope.js";
4
+ export interface MeetingTagsCommandDeps {
5
+ /** The tags of the profile's own meetings account; opened when the command runs. */
6
+ read: () => Promise<MeetingTags>;
7
+ signal?: () => AbortSignal | undefined;
8
+ /** Prints the answer; cli-core's renderer when not given. A host that closes its store first passes its own. */
9
+ output?: (body: Body, command: Command) => void;
10
+ /** One to three examples per command that run as written, with the host's command and a profile. */
11
+ examples: Record<"add" | "remove" | "list", string[]>;
12
+ }
13
+ /**
14
+ * `tags add|remove|list` for a host whose things to label are its meetings, such as pbx's phone calls. A host of
15
+ * chats mounts the messenger's `tags` instead. `--matching` takes `search meetings`'s query, so "search, then tag" is
16
+ * one command, and a rerun after new calls are transcribed marks only those.
17
+ */
18
+ export declare const addMeetingTagsCommand: (program: Command, deps: MeetingTagsCommandDeps) => void;