@wirecat/cli-core 0.395.0 → 0.396.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 (42) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cli/commands-command.js +6 -0
  3. package/dist/cli/index.d.ts +1 -1
  4. package/dist/cli/index.js +1 -1
  5. package/dist/cli/input-fields.d.ts +3 -0
  6. package/dist/cli/input-fields.js +27 -0
  7. package/dist/cli/messenger/attachments-command.js +16 -4
  8. package/dist/cli/messenger/conversation-answers.d.ts +5 -0
  9. package/dist/cli/messenger/message-answers.d.ts +5 -0
  10. package/dist/cli/messenger/message-writes.d.ts +5 -0
  11. package/dist/cli/messenger/search-answers.js +2 -0
  12. package/dist/cli/messenger/searches-command.d.ts +2 -0
  13. package/dist/cli/messenger/searches-command.js +2 -1
  14. package/dist/cli/messenger/store-maintenance-command.d.ts +1 -1
  15. package/dist/cli/program.js +5 -2
  16. package/dist/entities/evidence.d.ts +40 -0
  17. package/dist/entities/index.d.ts +71 -1
  18. package/dist/entities/index.js +2 -0
  19. package/dist/entities/message.d.ts +9 -0
  20. package/dist/entities/message.js +6 -0
  21. package/dist/errors/reasons.d.ts +1 -0
  22. package/dist/errors/reasons.js +15 -0
  23. package/dist/search/lucene/registry.js +2 -2
  24. package/dist/services/messages-search.js +13 -2
  25. package/dist/services/messages.d.ts +5 -0
  26. package/dist/store/search-index.d.ts +4 -1
  27. package/dist/store/search-index.js +10 -1
  28. package/dist/store/sqlite/hit-places.d.ts +12 -0
  29. package/dist/store/sqlite/hit-places.js +76 -0
  30. package/dist/store/sqlite/lucene-fields.d.ts +8 -0
  31. package/dist/store/sqlite/lucene-fields.js +6 -4
  32. package/dist/store/sqlite/lucene.js +25 -70
  33. package/dist/store/sqlite/manifest.js +2 -0
  34. package/dist/store/sqlite/migrations.generated.js +19 -0
  35. package/dist/store/sqlite/note-index.d.ts +11 -1
  36. package/dist/store/sqlite/note-index.js +18 -6
  37. package/dist/store/sqlite/schema.d.ts +39 -0
  38. package/dist/store/sqlite/schema.js +4 -0
  39. package/dist/store/sqlite/transcript-query.d.ts +40 -0
  40. package/dist/store/sqlite/transcript-query.js +108 -0
  41. package/dist/store/sqlite/words.d.ts +6 -0
  42. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -7,6 +7,36 @@ shape of this file.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.396.0 — 23.10.2026
11
+
12
+ ### Changed — may break callers
13
+
14
+ - **Command discovery uses `--json`.** `commands`, scoped discovery and `commands schema` refuse `--jsonl` with `output.one-object`, instead of printing a line with no stream end record. Use `--json` for the discovery document.
15
+
16
+ - cli-core requires cli-base 0.50.1 or newer within the 0.50 line for profile-preserving command corrections and concise skill summaries.
17
+
18
+ ### Fixed
19
+
20
+ - **Unknown-command explanations are separated.** The explanation of a word read as a profile follows the command error with a dash, keeping both parts readable on one line.
21
+
22
+ - **Input-field errors name the command's flags.** Adapters can report unsupported or conflicting domain fields through `input.field-unsupported` or `input.field-conflict`. The CLI maps declared fields to flags in the human message and structured parameter, while SDK errors stay independent of command syntax. Unknown fields are kept without guessing.
23
+
24
+ - **Joined command hints keep the chosen profile.** A command path passed as one argument is refused with a correction that preserves a separate explicit profile, including when global options come first.
25
+
26
+ ### Added
27
+
28
+ - `SEARCHES_QUERY` (`@wirecat/cli-core/cli`): the query `searches list` takes, for another CLI's own saved searches.
29
+
30
+ - **A voice note's transcript is found in any form of a word, and widened to the spellings speech recognition
31
+ garbles (store version 29).** «риелтор» finds a transcript saying «риелтору», and «реелтора»: always, not only when
32
+ nothing matched, by meeting search's rules — one stem edit from a word the Russian dictionary does not know, never
33
+ a number word, never a phrase or under `exact:`. A hit found only through a garbled spelling has `match:
34
+ "corrected"` and `corrections`, and the answer's `corrections` lists them. New tables `transcript_words`, its
35
+ vocabulary, `transcript_stems` and `transcript_index_pending`, filled before each search; existing transcripts are
36
+ queued on upgrade.
37
+
38
+ - Attachment commands include concrete examples in help and command discovery.
39
+
10
40
  ## 0.395.0 — 23.10.2026
11
41
 
12
42
  ### Changed — may break callers
@@ -20,6 +20,12 @@ export const CONTRACT = 3;
20
20
  export const commandsCommand = (app) => {
21
21
  const command = annotate(new Command("commands"), { effects: NO_EFFECTS })
22
22
  .description("every command by section, one line each; --json: the contract, one path per call")
23
+ .hook("preAction", (_command, action) => {
24
+ if (action.optsWithGlobals().jsonl)
25
+ throw new CliError("validation_error", "command discovery is one JSON object — use --json", {
26
+ reason: "output.one-object",
27
+ });
28
+ })
23
29
  .argument("[path...]", "one command path, for example: search messages; inspect other groups in separate calls")
24
30
  .action(function (path) {
25
31
  const root = rootOf(this);
@@ -108,7 +108,7 @@ export { reviewCommand } from "./messenger/review.js";
108
108
  export { scheduleCommand } from "./messenger/schedule-command.js";
109
109
  export { allHitItem, type HitItem, type MessageHitItem, messageHitItem, type NoteHitItem, noteHitItem, } from "./messenger/search-answers.js";
110
110
  export { searchCommand } from "./messenger/search-command.js";
111
- export { searchesCommand } from "./messenger/searches-command.js";
111
+ export { SEARCHES_QUERY, searchesCommand } from "./messenger/searches-command.js";
112
112
  export { serveCommand, servingProfiles } from "./messenger/serve-command.js";
113
113
  export { DAY_MS, FIRST_FETCH_MS, type MemberFetches, memberFetches } from "./messenger/serve-members.js";
114
114
  export { STEMS_EVERY_MS, STEMS_SLICE_MS, type StemFills, stemFills } from "./messenger/serve-stems.js";
package/dist/cli/index.js CHANGED
@@ -103,7 +103,7 @@ export { reviewCommand } from "./messenger/review.js";
103
103
  export { scheduleCommand } from "./messenger/schedule-command.js";
104
104
  export { allHitItem, messageHitItem, noteHitItem, } from "./messenger/search-answers.js";
105
105
  export { searchCommand } from "./messenger/search-command.js";
106
- export { searchesCommand } from "./messenger/searches-command.js";
106
+ export { SEARCHES_QUERY, searchesCommand } from "./messenger/searches-command.js";
107
107
  export { serveCommand, servingProfiles } from "./messenger/serve-command.js";
108
108
  export { DAY_MS, FIRST_FETCH_MS, memberFetches } from "./messenger/serve-members.js";
109
109
  export { STEMS_EVERY_MS, STEMS_SLICE_MS, stemFills } from "./messenger/serve-stems.js";
@@ -0,0 +1,3 @@
1
+ import type { errorObjectOf } from "@wirecat/cli-base";
2
+ import type { Command } from "commander";
3
+ export declare const showInputFields: (object: ReturnType<typeof errorObjectOf>, command: Command) => void;
@@ -0,0 +1,27 @@
1
+ import { INPUT_FIELD_REASONS } from "../errors/reasons.js";
2
+ export const showInputFields = (object, command) => {
3
+ if (!INPUT_FIELD_REASONS.some((reason) => reason.reason === object.error.reason))
4
+ return;
5
+ const fields = object.error.details?.fields;
6
+ if (!Array.isArray(fields) || fields.length === 0 || !fields.every((field) => typeof field === "string"))
7
+ return;
8
+ const options = new Map();
9
+ for (let at = command; at; at = at.parent)
10
+ for (const option of at.options)
11
+ if (!option.hidden && option.long && !options.has(option.attributeName()))
12
+ options.set(option.attributeName(), option.long);
13
+ const flags = [];
14
+ for (const field of fields) {
15
+ const flag = options.get(field);
16
+ if (!flag)
17
+ return;
18
+ if (!flags.includes(flag))
19
+ flags.push(flag);
20
+ }
21
+ const first = flags[0];
22
+ if (first === undefined)
23
+ return;
24
+ object.error.message = `${flags.join(", ")}: ${object.error.message}`;
25
+ object.error.param = first;
26
+ object.error.details = { ...object.error.details, fields: flags };
27
+ };
@@ -34,7 +34,10 @@ const summary = (run) => [
34
34
  ]
35
35
  .filter(Boolean)
36
36
  .join(", ");
37
- const extractCommand = (messenger) => annotate(new Command("extract"), { effects: FETCH })
37
+ const extractCommand = (messenger) => annotate(new Command("extract"), {
38
+ effects: FETCH,
39
+ examples: [`${messenger.app.command} personal attachments extract --chat "Book club" --limit 10`],
40
+ })
38
41
  .description("read the text of downloaded files — text, PDF/DOCX text layers, ODT/ODS/XLSX/PPTX/EPUB — into the local store, where search finds them")
39
42
  .option("--chat <chat>", `only this chat's files; ${messenger.chatArgument}`)
40
43
  .option("--from-dir <dir>", "match files in this nonrecursive directory; needs --chat")
@@ -121,13 +124,19 @@ const extractCommand = (messenger) => annotate(new Command("extract"), { effects
121
124
  });
122
125
  const row = ({ message, position, name, local_path, extraction }) => `${message} #${position} ${name ?? ""} ${extraction ? `${extraction.origin} ${extraction.chars}` : "no text"} ` +
123
126
  (local_path ?? "not downloaded");
124
- const listCommand = (messenger) => withQuery(withPaging(annotate(new Command("list"), { effects: REMOTE_READ }).description("files of stored messages, newest first: where each was saved and whether its text is held — never the text")), ATTACHMENT_QUERY).action(async function (words) {
127
+ const listCommand = (messenger) => withQuery(withPaging(annotate(new Command("list"), {
128
+ effects: REMOTE_READ,
129
+ examples: [`${messenger.app.command} personal attachments list --limit 10`],
130
+ }).description("files of stored messages, newest first: where each was saved and whether its text is held — never the text")), ATTACHMENT_QUERY).action(async function (words) {
125
131
  const context = messengerContext(this, messenger);
126
132
  const query = listQuery(typedQuery(words), ATTACHMENT_QUERY, "attachments list");
127
133
  const found = await context.withServices((services) => services.attachments.list({ ...pageOf(context.settings), ...(query ? { query } : {}) }));
128
134
  renderAnswer(this, context, pagedList("attachments list", context.settings, found), () => found.items.length === 0 ? "" : `${found.items.map(row).join("\n")}\n`);
129
135
  });
130
- const showCommand = (messenger) => annotate(new Command("show"), { effects: REMOTE_READ })
136
+ const showCommand = (messenger) => annotate(new Command("show"), {
137
+ effects: REMOTE_READ,
138
+ examples: [`${messenger.app.command} personal attachments show "Book club" 101 --attachment 1`],
139
+ })
131
140
  .description("read a bounded chunk of one retained attachment; JSON includes base64 bytes")
132
141
  .argument("<chat>", `${messenger.chatArgument}; or a msg: locator alone`)
133
142
  .argument("[message]", "the message id")
@@ -159,7 +168,10 @@ const showCommand = (messenger) => annotate(new Command("show"), { effects: REMO
159
168
  });
160
169
  const textCommand = (messenger) => {
161
170
  const text = new Command("text").description("the text of one file, as an agent read it");
162
- readsStdin(annotate(text.command("set"), { effects: LOCAL_WRITE }), {
171
+ readsStdin(annotate(text.command("set"), {
172
+ effects: LOCAL_WRITE,
173
+ examples: [`${messenger.app.command} personal attachments text set "Book club" 101 --text-file ./transcript.txt`],
174
+ }), {
163
175
  name: "text",
164
176
  description: "the text of the file",
165
177
  })
@@ -54,6 +54,11 @@ export declare const conversationShown: (account: AccountKey, { summary, message
54
54
  excerpt?: string | undefined;
55
55
  matched_in?: "context" | "file" | "filename" | "picture" | "text" | "transcript" | undefined;
56
56
  score?: number | undefined;
57
+ match?: "beginnings" | "corrected" | "words" | undefined;
58
+ corrections?: {
59
+ from: string;
60
+ to: string[];
61
+ }[] | undefined;
57
62
  found_in?: "archive" | "both" | "server" | undefined;
58
63
  discovery?: {
59
64
  coverage: number;
@@ -31,6 +31,11 @@ export declare const threadAnswer: ({ items, ...thread }: ThreadContext, reader:
31
31
  excerpt?: string | undefined;
32
32
  matched_in?: "context" | "file" | "filename" | "picture" | "text" | "transcript" | undefined;
33
33
  score?: number | undefined;
34
+ match?: "beginnings" | "corrected" | "words" | undefined;
35
+ corrections?: {
36
+ from: string;
37
+ to: string[];
38
+ }[] | undefined;
34
39
  found_in?: "archive" | "both" | "server" | undefined;
35
40
  discovery?: {
36
41
  coverage: number;
@@ -33,6 +33,11 @@ export declare const writtenAnswer: ({ operationId, sendId, message, scheduledFo
33
33
  excerpt?: string | undefined;
34
34
  matched_in?: "context" | "file" | "filename" | "picture" | "text" | "transcript" | undefined;
35
35
  score?: number | undefined;
36
+ match?: "beginnings" | "corrected" | "words" | undefined;
37
+ corrections?: {
38
+ from: string;
39
+ to: string[];
40
+ }[] | undefined;
36
41
  found_in?: "archive" | "both" | "server" | undefined;
37
42
  discovery?: {
38
43
  coverage: number;
@@ -21,6 +21,8 @@ export const messageHitItem = (hit, query = "") => {
21
21
  excerpt: hit.excerpt ?? excerpt(hit.text, query),
22
22
  matched_in: hit.matchedIn,
23
23
  score: hit.score ?? undefined,
24
+ match: hit.match,
25
+ corrections: hit.corrections,
24
26
  found_in: hit.source,
25
27
  discovery: hit.discovery
26
28
  ? defined({
@@ -1,4 +1,6 @@
1
1
  import { Command } from "commander";
2
2
  import { type Messenger } from "./context.js";
3
+ /** `searches list` takes a query over the saved search fields, none of them a filter: the list is short and whole. */
4
+ export declare const SEARCHES_QUERY: import("@wirecat/cli-base/query").QueryRegistry;
3
5
  /** Saved searches and the history of `search messages` and `stats messages show`, in the local store only. */
4
6
  export declare const searchesCommand: (messenger: Messenger) => Command;
@@ -20,7 +20,8 @@ const line = ({ id, name, command, params, runs, lastRunAt }) => [
20
20
  `${runs} runs`,
21
21
  lastRunAt?.slice(0, 16).replace("T", " ") ?? "never run",
22
22
  ].join(" ");
23
- const SEARCHES_QUERY = unfilteredQuery("saved_search", savedSearch);
23
+ /** `searches list` takes a query over the saved search fields, none of them a filter: the list is short and whole. */
24
+ export const SEARCHES_QUERY = unfilteredQuery("saved_search", savedSearch);
24
25
  /** Saved searches and the history of `search messages` and `stats messages show`, in the local store only. */
25
26
  export const searchesCommand = (messenger) => {
26
27
  const searches = new Command("searches").description("saved searches and the history of search messages and stats messages show, kept in the local store; --saved runs one");
@@ -2,9 +2,9 @@ import { Command } from "commander";
2
2
  import type { Messenger } from "./context.js";
3
3
  /** `doctor`'s short summary of the store. Must answer for a broken file, so an error is a field. */
4
4
  export declare const storeSummary: (env: NodeJS.ProcessEnv) => Promise<{
5
+ error?: undefined;
5
6
  path: string;
6
7
  exists: boolean;
7
- error?: undefined;
8
8
  } | {
9
9
  path: string;
10
10
  exists: boolean;
@@ -20,6 +20,7 @@ import { changesAuthorityNow, isLogin, isStoreChange, judgedEffects, judgedTarge
20
20
  import { itemOf, renderAnswer, snakeKeys } from "./envelope.js";
21
21
  import { byteCount, DEFAULT_COMMAND_MS, DEFAULT_OUTPUT_BYTES, execution } from "./execution.js";
22
22
  import { installHelp } from "./help/first-screen.js";
23
+ import { showInputFields } from "./input-fields.js";
23
24
  import { MAX_BUFFERED_INPUT, provideInputPolicy } from "./input-policy.js";
24
25
  import { checkJson, liftJson } from "./json-fields.js";
25
26
  import { movedPath, movedPointer } from "./moved.js";
@@ -354,7 +355,7 @@ const runOnce = async (argv, definition, options) => {
354
355
  // Only before `--`: what follows is a positional, an agent's text among them, never a command word.
355
356
  const end = lifted.indexOf("--");
356
357
  for (const words of [flags, end < 0 ? lifted : lifted.slice(0, end)])
357
- refuseJoinedPath(program, words.filter((word) => !word.startsWith("-")));
358
+ refuseJoinedPath(program, words.filter((word) => !word.startsWith("-")), profile !== undefined && !/\s/.test(profile) ? [profile] : []);
358
359
  }
359
360
  catch (failure) {
360
361
  const settled = await settleFailure(failure, { definition, program, rest: lifted, profile, options });
@@ -420,7 +421,8 @@ const runOnce = async (argv, definition, options) => {
420
421
  error.code === "commander.unknownCommand" &&
421
422
  rest[0] !== undefined &&
422
423
  !commandWords(program).has(rest[0])) {
423
- message += ` "${profile}" is not a command, so it was read as a profile name — which left "${rest[0]}" to be one.`;
424
+ message = message.trimEnd();
425
+ message += ` — "${profile}" is not a command, so it was read as a profile name — which left "${rest[0]}" to be one.`;
424
426
  }
425
427
  const failure = new CliError("validation_error", message);
426
428
  const settled = await settleFailure(failure, { definition, program, rest, profile, options });
@@ -577,6 +579,7 @@ const failed = ({ app }, program, rest, error, settled, debug) => {
577
579
  targets: judgedTargets(program),
578
580
  ...(effects ? { effects } : {}),
579
581
  });
582
+ showInputFields(object, (path && commandAt(program, path)) || program);
580
583
  const command = path || app.command;
581
584
  return {
582
585
  object,
@@ -21,6 +21,11 @@ export declare const contribution: v.StrictObjectSchema<{
21
21
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
22
22
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
23
23
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
24
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
25
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
26
+ readonly from: v.StringSchema<undefined>;
27
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
28
+ }, undefined>, undefined>, undefined>;
24
29
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
25
30
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
26
31
  readonly coverage: v.NumberSchema<undefined>;
@@ -202,6 +207,11 @@ export declare const contribution: v.StrictObjectSchema<{
202
207
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
203
208
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
204
209
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
210
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
211
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
212
+ readonly from: v.StringSchema<undefined>;
213
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
214
+ }, undefined>, undefined>, undefined>;
205
215
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
206
216
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
207
217
  readonly coverage: v.NumberSchema<undefined>;
@@ -421,6 +431,11 @@ export declare const contribution: v.StrictObjectSchema<{
421
431
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
422
432
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
423
433
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
434
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
435
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
436
+ readonly from: v.StringSchema<undefined>;
437
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
438
+ }, undefined>, undefined>, undefined>;
424
439
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
425
440
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
426
441
  readonly coverage: v.NumberSchema<undefined>;
@@ -602,6 +617,11 @@ export declare const contribution: v.StrictObjectSchema<{
602
617
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
603
618
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
604
619
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
620
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
621
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
622
+ readonly from: v.StringSchema<undefined>;
623
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
624
+ }, undefined>, undefined>, undefined>;
605
625
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
606
626
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
607
627
  readonly coverage: v.NumberSchema<undefined>;
@@ -857,6 +877,11 @@ export declare const evidence: v.UnionSchema<[v.StrictObjectSchema<{
857
877
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
858
878
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
859
879
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
880
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
881
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
882
+ readonly from: v.StringSchema<undefined>;
883
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
884
+ }, undefined>, undefined>, undefined>;
860
885
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
861
886
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
862
887
  readonly coverage: v.NumberSchema<undefined>;
@@ -1038,6 +1063,11 @@ export declare const evidence: v.UnionSchema<[v.StrictObjectSchema<{
1038
1063
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1039
1064
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
1040
1065
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
1066
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
1067
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
1068
+ readonly from: v.StringSchema<undefined>;
1069
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
1070
+ }, undefined>, undefined>, undefined>;
1041
1071
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
1042
1072
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
1043
1073
  readonly coverage: v.NumberSchema<undefined>;
@@ -1257,6 +1287,11 @@ export declare const evidence: v.UnionSchema<[v.StrictObjectSchema<{
1257
1287
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1258
1288
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
1259
1289
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
1290
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
1291
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
1292
+ readonly from: v.StringSchema<undefined>;
1293
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
1294
+ }, undefined>, undefined>, undefined>;
1260
1295
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
1261
1296
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
1262
1297
  readonly coverage: v.NumberSchema<undefined>;
@@ -1438,6 +1473,11 @@ export declare const evidence: v.UnionSchema<[v.StrictObjectSchema<{
1438
1473
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1439
1474
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
1440
1475
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
1476
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
1477
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
1478
+ readonly from: v.StringSchema<undefined>;
1479
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
1480
+ }, undefined>, undefined>, undefined>;
1441
1481
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
1442
1482
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
1443
1483
  readonly coverage: v.NumberSchema<undefined>;
@@ -69,6 +69,11 @@ export declare const ENTITIES: {
69
69
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
70
70
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
71
71
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
72
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
73
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
74
+ readonly from: v.StringSchema<undefined>;
75
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
76
+ }, undefined>, undefined>, undefined>;
72
77
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
73
78
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
74
79
  readonly coverage: v.NumberSchema<undefined>;
@@ -250,6 +255,11 @@ export declare const ENTITIES: {
250
255
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
251
256
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
252
257
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
258
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
259
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
260
+ readonly from: v.StringSchema<undefined>;
261
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
262
+ }, undefined>, undefined>, undefined>;
253
263
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
254
264
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
255
265
  readonly coverage: v.NumberSchema<undefined>;
@@ -431,6 +441,11 @@ export declare const ENTITIES: {
431
441
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
432
442
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
433
443
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
444
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
445
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
446
+ readonly from: v.StringSchema<undefined>;
447
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
448
+ }, undefined>, undefined>, undefined>;
434
449
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
435
450
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
436
451
  readonly coverage: v.NumberSchema<undefined>;
@@ -591,7 +606,7 @@ export declare const ENTITIES: {
591
606
  }, undefined>, undefined>;
592
607
  }, undefined>, undefined>;
593
608
  readonly provider_metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
594
- }, "chat_title" | "context" | "discovery" | "email" | "excerpt" | "found_in" | "matched_in" | "ref" | "score" | "sender_name" | "timestamp">;
609
+ }, "chat_title" | "context" | "corrections" | "discovery" | "email" | "excerpt" | "found_in" | "match" | "matched_in" | "ref" | "score" | "sender_name" | "timestamp">;
595
610
  readonly "~standard": v.StandardProps<{
596
611
  ref: string;
597
612
  chat_title?: string | null | undefined;
@@ -600,6 +615,11 @@ export declare const ENTITIES: {
600
615
  excerpt?: string | undefined;
601
616
  matched_in?: "context" | "file" | "filename" | "picture" | "text" | "transcript" | undefined;
602
617
  score?: number | undefined;
618
+ match?: "beginnings" | "corrected" | "words" | undefined;
619
+ corrections?: {
620
+ from: string;
621
+ to: string[];
622
+ }[] | undefined;
603
623
  found_in?: "archive" | "both" | "server" | undefined;
604
624
  discovery?: {
605
625
  coverage: number;
@@ -658,6 +678,11 @@ export declare const ENTITIES: {
658
678
  excerpt?: string | undefined;
659
679
  matched_in?: "context" | "file" | "filename" | "picture" | "text" | "transcript" | undefined;
660
680
  score?: number | undefined;
681
+ match?: "beginnings" | "corrected" | "words" | undefined;
682
+ corrections?: {
683
+ from: string;
684
+ to: string[];
685
+ }[] | undefined;
661
686
  found_in?: "archive" | "both" | "server" | undefined;
662
687
  discovery?: {
663
688
  coverage: number;
@@ -717,6 +742,11 @@ export declare const ENTITIES: {
717
742
  excerpt?: string | undefined;
718
743
  matched_in?: "context" | "file" | "filename" | "picture" | "text" | "transcript" | undefined;
719
744
  score?: number | undefined;
745
+ match?: "beginnings" | "corrected" | "words" | undefined;
746
+ corrections?: {
747
+ from: string;
748
+ to: string[];
749
+ }[] | undefined;
720
750
  found_in?: "archive" | "both" | "server" | undefined;
721
751
  discovery?: {
722
752
  coverage: number;
@@ -777,6 +807,11 @@ export declare const ENTITIES: {
777
807
  excerpt?: string | undefined;
778
808
  matched_in?: "context" | "file" | "filename" | "picture" | "text" | "transcript" | undefined;
779
809
  score?: number | undefined;
810
+ match?: "beginnings" | "corrected" | "words" | undefined;
811
+ corrections?: {
812
+ from: string;
813
+ to: string[];
814
+ }[] | undefined;
780
815
  found_in?: "archive" | "both" | "server" | undefined;
781
816
  discovery?: {
782
817
  coverage: number;
@@ -836,6 +871,11 @@ export declare const ENTITIES: {
836
871
  excerpt?: string | undefined;
837
872
  matched_in?: "context" | "file" | "filename" | "picture" | "text" | "transcript" | undefined;
838
873
  score?: number | undefined;
874
+ match?: "beginnings" | "corrected" | "words" | undefined;
875
+ corrections?: {
876
+ from: string;
877
+ to: string[];
878
+ }[] | undefined;
839
879
  found_in?: "archive" | "both" | "server" | undefined;
840
880
  discovery?: {
841
881
  coverage: number;
@@ -910,6 +950,11 @@ export declare const ENTITIES: {
910
950
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
911
951
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
912
952
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
953
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
954
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
955
+ readonly from: v.StringSchema<undefined>;
956
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
957
+ }, undefined>, undefined>, undefined>;
913
958
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
914
959
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
915
960
  readonly coverage: v.NumberSchema<undefined>;
@@ -1091,6 +1136,11 @@ export declare const ENTITIES: {
1091
1136
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1092
1137
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
1093
1138
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
1139
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
1140
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
1141
+ readonly from: v.StringSchema<undefined>;
1142
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
1143
+ }, undefined>, undefined>, undefined>;
1094
1144
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
1095
1145
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
1096
1146
  readonly coverage: v.NumberSchema<undefined>;
@@ -3264,6 +3314,11 @@ export declare const ENTITIES: {
3264
3314
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
3265
3315
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
3266
3316
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
3317
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
3318
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
3319
+ readonly from: v.StringSchema<undefined>;
3320
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
3321
+ }, undefined>, undefined>, undefined>;
3267
3322
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
3268
3323
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
3269
3324
  readonly coverage: v.NumberSchema<undefined>;
@@ -3445,6 +3500,11 @@ export declare const ENTITIES: {
3445
3500
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
3446
3501
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
3447
3502
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
3503
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
3504
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
3505
+ readonly from: v.StringSchema<undefined>;
3506
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
3507
+ }, undefined>, undefined>, undefined>;
3448
3508
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
3449
3509
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
3450
3510
  readonly coverage: v.NumberSchema<undefined>;
@@ -3664,6 +3724,11 @@ export declare const ENTITIES: {
3664
3724
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
3665
3725
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
3666
3726
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
3727
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
3728
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
3729
+ readonly from: v.StringSchema<undefined>;
3730
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
3731
+ }, undefined>, undefined>, undefined>;
3667
3732
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
3668
3733
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
3669
3734
  readonly coverage: v.NumberSchema<undefined>;
@@ -3845,6 +3910,11 @@ export declare const ENTITIES: {
3845
3910
  readonly excerpt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
3846
3911
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
3847
3912
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
3913
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
3914
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
3915
+ readonly from: v.StringSchema<undefined>;
3916
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
3917
+ }, undefined>, undefined>, undefined>;
3848
3918
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
3849
3919
  readonly discovery: v.OptionalSchema<v.StrictObjectSchema<{
3850
3920
  readonly coverage: v.NumberSchema<undefined>;
@@ -61,6 +61,8 @@ export const ENTITIES = {
61
61
  "excerpt",
62
62
  "matched_in",
63
63
  "score",
64
+ "match",
65
+ "corrections",
64
66
  "found_in",
65
67
  "discovery",
66
68
  "context",
@@ -25,6 +25,15 @@ export declare const message: v.StrictObjectSchema<{
25
25
  /** `picture`: the picture search lane found it by what the picture shows; it follows the text hits. */
26
26
  readonly matched_in: v.OptionalSchema<v.PicklistSchema<["text", "transcript", "filename", "file", "context", "picture"], undefined>, undefined>;
27
27
  readonly score: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
28
+ /**
29
+ * `corrected`: a query word matched only a spelling speech recognition garbled in a voice note's transcript,
30
+ * listed in `corrections`. `words` and `beginnings`: what a discovery search matched.
31
+ */
32
+ readonly match: v.OptionalSchema<v.PicklistSchema<["words", "beginnings", "corrected"], undefined>, undefined>;
33
+ readonly corrections: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
34
+ readonly from: v.StringSchema<undefined>;
35
+ readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
36
+ }, undefined>, undefined>, undefined>;
28
37
  /** Where a search found it: the local archive, the messenger's server, or both. */
29
38
  readonly found_in: v.OptionalSchema<v.PicklistSchema<["archive", "server", "both"], undefined>, undefined>;
30
39
  /** A discovery search's partial match: how much of the question it covers, and which words it lacks. */
@@ -37,6 +37,12 @@ export const message = v.strictObject({
37
37
  /** `picture`: the picture search lane found it by what the picture shows; it follows the text hits. */
38
38
  matched_in: v.optional(v.picklist(["text", "transcript", "filename", "file", "context", "picture"])),
39
39
  score: v.optional(v.number()),
40
+ /**
41
+ * `corrected`: a query word matched only a spelling speech recognition garbled in a voice note's transcript,
42
+ * listed in `corrections`. `words` and `beginnings`: what a discovery search matched.
43
+ */
44
+ match: v.optional(v.picklist(["words", "beginnings", "corrected"])),
45
+ corrections: v.optional(v.array(v.strictObject({ from: text, to: v.array(text) }))),
40
46
  /** Where a search found it: the local archive, the messenger's server, or both. */
41
47
  found_in: v.optional(v.picklist(["archive", "server", "both"])),
42
48
  /** A discovery search's partial match: how much of the question it covers, and which words it lacks. */
@@ -1,5 +1,6 @@
1
1
  import type { FailureContext } from "@wirecat/cli-base";
2
2
  import type { ErrorReason } from "@wirecat/cli-base/standards";
3
+ export declare const INPUT_FIELD_REASONS: ErrorReason[];
3
4
  /** Every reason this package raises; cli-base's own are known to the handler already. */
4
5
  export declare const REASONS: ErrorReason[];
5
6
  /**
@@ -78,9 +78,24 @@ const OTHERS = [
78
78
  validation("vocabulary.over-entry-budget", "the vocabulary has too many entries"),
79
79
  ["vocabulary.stale", "configuration_error", "the vocabulary changed meanwhile"],
80
80
  ];
81
+ export const INPUT_FIELD_REASONS = defineReasons([
82
+ {
83
+ reason: "input.field-conflict",
84
+ code: "validation_error",
85
+ message: "the input fields conflict",
86
+ details: ["fields"],
87
+ },
88
+ {
89
+ reason: "input.field-unsupported",
90
+ code: "validation_error",
91
+ message: "the input field is not supported",
92
+ details: ["fields"],
93
+ },
94
+ ]);
81
95
  /** Every reason this package raises; cli-base's own are known to the handler already. */
82
96
  export const REASONS = defineReasons([
83
97
  ...QUERY_REASONS,
98
+ ...INPUT_FIELD_REASONS,
84
99
  ...[...QUERY, ...OTHERS].map(([reason, code, message]) => ({
85
100
  reason,
86
101
  code,