@wirecat/cli-core 0.670.0 → 0.672.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,29 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
5
5
  minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
6
6
  shape of this file.
7
7
 
8
+ ## 0.672.0 — 16.11.2026
9
+
10
+ ### Fixed
11
+
12
+ - **An option an agent guesses on a search or a message read fails with the form that runs.** `search all`, `search
13
+ messages`, `search notes` and `search conversations` answer `--since`, `--after`, `--until`, `--before` (and
14
+ `--from`, `--to`) with where the date goes (`date>=…` in the query, or `--since-time` and `--filter` for
15
+ conversations), `--around` with `messages context <hit ref> --before-n 5 --after-n 5`, and `--only` with
16
+ `search all … --only`. `messages list`, `show` and `context` answer `--chat` with the chat as the first argument,
17
+ and `context` answers `--before` and `--after` with `--before-n` and `--after-n`. Before, commander said a bare
18
+ "unknown option", or suggested an unrelated near name (`--since` → `--source`); each guess cost an agent a call.
19
+
20
+ ## 0.671.0 — 15.11.2026
21
+
22
+ ### Changed — may break callers
23
+
24
+ - **The shared documents `sync` is cooperative.** It declared `partial` but not `cooperative`, so it got a one-shot's
25
+ 30 s deadline and a budget of about 12 requests per call: a first Notion sync of 5 000 pages took some 830 calls.
26
+ It now gets a sync's deadline, 15 min in a terminal and 45 s over MCP, unless `--timeout` sets one. A cancel no
27
+ longer cuts the command from outside: the walk stops at the next folder on the run's `signal` (with or without a
28
+ budget) and saves where it is, and the batch stops before the next file, as before. See
29
+ [Walks over several syncs](docs/dev/DOCUMENTS.md#walks-over-several-syncs).
30
+
8
31
  ## 0.670.0 — 15.11.2026
9
32
 
10
33
  ### Added
@@ -9,7 +9,10 @@ const addDocumentSyncCommandsDefinition = (program, helpers) => {
9
9
  const { output } = helpers;
10
10
  const wording = wordsOf(helpers.words);
11
11
  const { prefix, text } = wording;
12
- const sync = examples(annotate(program.command("sync"), { effects: FETCH, partial: true })
12
+ const sync = examples(
13
+ // Cooperative: it stops on its own at its budget, its deadline or a cancel and keeps its work, so it gets a sync's
14
+ // deadline (15 min in a terminal, 45 s over MCP) instead of a one-shot's 30 s.
15
+ annotate(program.command("sync"), { effects: FETCH, cooperative: true, partial: true })
13
16
  .summary("import what changed in the chosen folders, and finish an unfinished sync")
14
17
  .description("import what changed in the chosen folders, and finish an unfinished sync; " +
15
18
  `one sync walks about ${helpers.maxEntries} entries under the chosen folders, saves where it stopped, and ` +
@@ -12,7 +12,7 @@ import { modelWith, spoken } from "../../speech/hearing.js";
12
12
  import { REMOTE_READ } from "../effects.js";
13
13
  import { itemOf, listOf, renderAnswer } from "../envelope.js";
14
14
  import { queryHelp } from "../list-query.js";
15
- import { withOptionHints } from "../option-hints.js";
15
+ import { AROUND_HINT, END_FLAGS, hintsFor, START_FLAGS, withOptionHints } from "../option-hints.js";
16
16
  import { positiveCount } from "../paging.js";
17
17
  import { marksUntrusted } from "../untrusted-marks.js";
18
18
  import { syncCommand } from "./backfill-command.js";
@@ -101,7 +101,11 @@ export const messagesCommand = (messenger) => {
101
101
  }), () => renderMessages(spokenItems(page.items, hearing), viewOf(context, messenger)));
102
102
  });
103
103
  annotate(list, { output: { entity: "message" }, query: history });
104
- withOptionHints(list, Object.fromEntries(TIME_FLAGS.map((flag) => [flag, `messages list reads a window by its query: '${WINDOW_EXAMPLE}'`])));
104
+ withOptionHints(list, {
105
+ ...hintsFor([...TIME_FLAGS, ...START_FLAGS, ...END_FLAGS], `messages list reads a window by its query: '${WINDOW_EXAMPLE}'`),
106
+ "--chat": CHAT_FIRST("list"),
107
+ "--around": AROUND_HINT,
108
+ });
105
109
  const readWindow = async (command, chat, message, window) => {
106
110
  const context = messengerContext(command, messenger);
107
111
  const { found, reader } = await context.withServices(async (services) => ({
@@ -198,8 +202,18 @@ export const messagesCommand = (messenger) => {
198
202
  messages.addCommand(commentsCommand(messenger));
199
203
  messages.addCommand(linksCommand(messenger));
200
204
  messages.addCommand(syncCommand(messenger));
205
+ for (const name of ["show", "context"]) {
206
+ const command = messages.commands.find((one) => one.name() === name);
207
+ if (command)
208
+ withOptionHints(command, {
209
+ "--chat": CHAT_FIRST(name),
210
+ "--around": name === "show" ? AROUND_HINT : "the window is around the message already; --before-n 5 --after-n 5",
211
+ ...(name === "context" ? { "--before": "--before-n <n>", "--after": "--after-n <n>" } : {}),
212
+ });
213
+ }
201
214
  return hideNever(messenger, messages);
202
215
  };
216
+ const CHAT_FIRST = (name) => `the chat is the first argument: messages ${name} <chat>${name === "list" ? "" : " <message>, or a hit's msg: ref"}`;
203
217
  /** Mail lives in the mail tables of the store, whichever messenger CLI reads it. */
204
218
  const isMailLocator = (chat, message) => message === undefined && isLocator(chat) && parseLocator(chat).provider === "email";
205
219
  const count = (value) => {
@@ -5,7 +5,7 @@ import { SAVE_HELP } from "../../meetings/index.js";
5
5
  import { searchNotesOf } from "../../services/notes-search.js";
6
6
  import { LOCAL_READ, REMOTE_READ } from "../effects.js";
7
7
  import { renderAnswer } from "../envelope.js";
8
- import { withOptionHints } from "../option-hints.js";
8
+ import { AROUND_HINT, END_FLAGS, hintsFor, START_FLAGS, withOptionHints } from "../option-hints.js";
9
9
  import { positiveCount } from "../paging.js";
10
10
  import { runsSearchCommand } from "../runs/search-command.js";
11
11
  import { commandAt } from "../steps.js";
@@ -16,6 +16,7 @@ import { messagesSearchCommand } from "./messages-search-command.js";
16
16
  import { allAnswer, meaningNote, notesAnswer, offsetOf, SOURCE_SEARCHED, shownOf, } from "./search-answers.js";
17
17
  import { backendOptions, backendRequest, noteServer } from "./search-backend-options.js";
18
18
  import { topicsSearchCommand } from "./topics-command.js";
19
+ const ONLY_HINT = "this search reads one kind already; --only belongs to search all: search all 'words' --only messages";
19
20
  export const searchAllOnlyOf = (value, allowed = SOURCE_SEARCHED) => {
20
21
  const chosen = value.split(",").map((one) => one.trim());
21
22
  if (chosen.includes("mail"))
@@ -186,12 +187,28 @@ export const searchCommand = (messenger, { topics = false } = {}) => {
186
187
  if (command)
187
188
  annotate(command, { examples: [`${messenger.app.command} personal search ${path} ${args}`] });
188
189
  }
189
- for (const path of ["all", "messages"]) {
190
+ for (const path of ["all", "messages", "notes"]) {
190
191
  const command = commandAt(search, path);
192
+ const dates = hintsFor([...START_FLAGS, ...END_FLAGS], `put the dates in the query: search ${path} 'words date>=2026-10-01 date<2026-10-20', or 'words date:7d'`);
191
193
  if (command)
192
194
  withOptionHints(command, {
193
- "--chat": `search in one chat with chat:<chat> in the query: search ${path} 'chat:<chat> words'`,
195
+ ...dates,
196
+ ...(path === "notes"
197
+ ? {}
198
+ : {
199
+ "--chat": `search in one chat with chat:<chat> in the query: search ${path} 'chat:<chat> words'`,
200
+ "--around": AROUND_HINT,
201
+ }),
202
+ ...(path === "all" ? {} : { "--only": ONLY_HINT }),
194
203
  });
195
204
  }
205
+ const conversations = commandAt(search, "conversations");
206
+ if (conversations)
207
+ withOptionHints(conversations, {
208
+ ...hintsFor(START_FLAGS, "--since-time 7d, or --since-time 2026-10-01"),
209
+ ...hintsFor(END_FLAGS, "put the end in the filter: --filter 'date<2026-10-20'"),
210
+ "--around": AROUND_HINT,
211
+ "--only": ONLY_HINT,
212
+ });
196
213
  return search;
197
214
  };
@@ -4,3 +4,9 @@ import type { Command } from "commander";
4
4
  * commander's bare "unknown option".
5
5
  */
6
6
  export declare const withOptionHints: (command: Command, hints: Readonly<Record<string, string>>) => Command;
7
+ /** The same hint for each of these flags. */
8
+ export declare const hintsFor: (flags: readonly string[], hint: string) => Record<string, string>;
9
+ /** Date flags agents guess; commander would suggest an unrelated near name (`--since` → `--source`). */
10
+ export declare const START_FLAGS: string[];
11
+ export declare const END_FLAGS: string[];
12
+ export declare const AROUND_HINT: string;
@@ -13,3 +13,10 @@ export const withOptionHints = (command, hints) => {
13
13
  };
14
14
  return command;
15
15
  };
16
+ /** The same hint for each of these flags. */
17
+ export const hintsFor = (flags, hint) => Object.fromEntries(flags.map((flag) => [flag, hint]));
18
+ /** Date flags agents guess; commander would suggest an unrelated near name (`--since` → `--source`). */
19
+ export const START_FLAGS = ["--since", "--after", "--from", "--since-date", "--after-date", "--start"];
20
+ export const END_FLAGS = ["--until", "--before", "--to", "--until-date", "--before-date", "--end"];
21
+ export const AROUND_HINT = "read the messages either side of one: messages context <hit ref> --before-n 5 --after-n 5 " +
22
+ "(or messages context <chat> <message>)";
@@ -170,7 +170,12 @@ export const planDocuments = async (options, source, state, roots, limit, pictur
170
170
  continue;
171
171
  }
172
172
  // One folder at least per call, so a folder with more children than the bound still gets listed.
173
- stopped = listed > 0 && spent >= maxEntries ? "entries" : (budget?.take() ?? null);
173
+ // The run's own signal too: a cooperative sync is not cut from outside, and a CLI may pass no budget.
174
+ stopped = options.signal?.aborted
175
+ ? "cancelled"
176
+ : listed > 0 && spent >= maxEntries
177
+ ? "entries"
178
+ : (budget?.take() ?? null);
174
179
  if (stopped)
175
180
  break;
176
181
  const folder = step.folder ?? (await source.metadata(step.id));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.670.0",
3
+ "version": "0.672.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",