@wirecat/cli-core 0.619.0 → 0.621.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 (94) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/dist/background/daily-archive-timer.d.ts +1 -1
  3. package/dist/calendar/cli/search-all.d.ts +1 -1
  4. package/dist/calendar/cli/search-all.js +9 -10
  5. package/dist/calendar/prepare.js +1 -0
  6. package/dist/cli/base-stages-command.d.ts +1 -1
  7. package/dist/cli/base-stages-command.js +1 -1
  8. package/dist/cli/bot/buttons.d.ts +3 -0
  9. package/dist/cli/bot/buttons.js +24 -0
  10. package/dist/cli/bot/messages.js +14 -1
  11. package/dist/cli/bot/port.d.ts +8 -0
  12. package/dist/cli/contract-templates.js +31 -2
  13. package/dist/cli/messenger/contacts-command.js +2 -1
  14. package/dist/cli/messenger/conversations-command.js +2 -1
  15. package/dist/cli/messenger/message-items.js +1 -1
  16. package/dist/cli/messenger/search-answers.d.ts +5 -5
  17. package/dist/cli/messenger/search-answers.js +9 -20
  18. package/dist/cli/messenger/search-command.d.ts +2 -2
  19. package/dist/cli/messenger/search-command.js +8 -18
  20. package/dist/cli/model-catalogue-command.js +3 -1
  21. package/dist/cli/search-harder-consents-command.d.ts +21 -0
  22. package/dist/cli/search-harder-consents-command.js +112 -0
  23. package/dist/cli/steps.js +0 -6
  24. package/dist/cli/templates-command.js +4 -4
  25. package/dist/crm/cli/index.js +2 -2
  26. package/dist/crm/cli/search-all.js +7 -6
  27. package/dist/crm/source.d.ts +8 -0
  28. package/dist/crm/sync.d.ts +1 -1
  29. package/dist/crm/sync.js +13 -1
  30. package/dist/domain/models.d.ts +2 -0
  31. package/dist/domain/relations.d.ts +1 -0
  32. package/dist/domain/relations.js +5 -1
  33. package/dist/entities/contact-context.d.ts +3 -0
  34. package/dist/entities/contact-context.js +4 -0
  35. package/dist/entities/hit.d.ts +9 -2
  36. package/dist/entities/hit.js +6 -2
  37. package/dist/entities/index.d.ts +9 -1
  38. package/dist/errors/reasons.js +3 -0
  39. package/dist/meetings/hit-query.d.ts +1 -1
  40. package/dist/meetings/hit-query.js +2 -2
  41. package/dist/meetings/index.d.ts +1 -0
  42. package/dist/meetings/index.js +1 -0
  43. package/dist/meetings/store.d.ts +4 -0
  44. package/dist/meetings/store.js +2 -1
  45. package/dist/models/anthropic.js +5 -0
  46. package/dist/search/question-period.d.ts +10 -0
  47. package/dist/search/question-period.js +133 -0
  48. package/dist/sends/buttons.d.ts +2 -0
  49. package/dist/sends/buttons.js +6 -1
  50. package/dist/services/enrichment-setting.d.ts +6 -0
  51. package/dist/services/enrichment-setting.js +5 -1
  52. package/dist/services/enrichment.d.ts +5 -0
  53. package/dist/services/enrichment.js +1 -1
  54. package/dist/services/index.d.ts +4 -2
  55. package/dist/services/index.js +3 -1
  56. package/dist/services/messages.d.ts +1 -4
  57. package/dist/services/messages.js +0 -2
  58. package/dist/services/metadata.d.ts +1 -1
  59. package/dist/services/person-context.d.ts +3 -1
  60. package/dist/services/person-context.js +21 -8
  61. package/dist/services/person-preparation.d.ts +5 -1
  62. package/dist/services/person-preparation.js +10 -3
  63. package/dist/services/person-timeline.d.ts +6 -1
  64. package/dist/services/person-timeline.js +10 -2
  65. package/dist/services/search-all-deprecated.d.ts +40 -0
  66. package/dist/services/search-all-deprecated.js +10 -0
  67. package/dist/services/search-all-meetings.d.ts +50 -52
  68. package/dist/services/search-all-meetings.js +265 -272
  69. package/dist/services/search-all.d.ts +34 -6
  70. package/dist/services/search-all.js +119 -24
  71. package/dist/services/search-harder.d.ts +90 -0
  72. package/dist/services/search-harder.js +264 -0
  73. package/dist/store/chats.d.ts +3 -1
  74. package/dist/store/chats.js +6 -0
  75. package/dist/store/people.d.ts +6 -2
  76. package/dist/store/sqlite/added-sources.d.ts +15 -3
  77. package/dist/store/sqlite/added-sources.js +26 -5
  78. package/dist/store/sqlite/chats.d.ts +2 -0
  79. package/dist/store/sqlite/chats.js +6 -0
  80. package/dist/store/sqlite/involvements.d.ts +1 -1
  81. package/dist/store/sqlite/involvements.js +4 -2
  82. package/dist/store/sqlite/meeting-hit-query.d.ts +5 -0
  83. package/dist/store/sqlite/meeting-hit-query.js +33 -0
  84. package/dist/store/sqlite/meeting-hit-search.js +10 -8
  85. package/dist/store/sqlite/meetings.js +1 -1
  86. package/dist/store/sqlite/notes.d.ts +7 -0
  87. package/dist/store/sqlite/notes.js +23 -7
  88. package/dist/store/sqlite/person-preparation.d.ts +7 -3
  89. package/dist/store/sqlite/person-preparation.js +20 -6
  90. package/dist/store/sqlite/relation-list.js +4 -2
  91. package/dist/store/sqlite/reported-relations.d.ts +0 -1
  92. package/dist/store/sqlite/reported-relations.js +1 -4
  93. package/package.json +1 -1
  94. package/parity.json +26 -12
package/CHANGELOG.md CHANGED
@@ -5,6 +5,150 @@ 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.621.0 — 09.11.2026
9
+
10
+ ### Added
11
+
12
+ - A CRM source may say which users in `crm.<provider>:<account>.unassigned` its sign-in may count as nobody's
13
+ (`CrmSource.unassigned`), asked at every sync under `scope mine`. The sync copies no deal or lead of a user it
14
+ leaves out, narrows the copy to match, and names them in an issue with the reason `crm.unassigned-dropped`.
15
+ - **`models search-consents set` takes `openai`, `anthropic` or an OpenAI-compatible API (`--base-url`, such as
16
+ OpenRouter).** Each provider has its own default model for `search all --harder` (`claude-haiku-5-5`,
17
+ `gpt-4o-mini`); another API needs `--model`. `show` proposes enrichment's provider and model when the owner chose
18
+ one there, but never gives this consent by itself. The answer's `harder` field names the `endpoint` too. Anthropic's
19
+ `thinking` and `output_config` go to Anthropic only; OpenAI gets its JSON mode, and any reply wrapped in a code block
20
+ is still read. See
21
+ [AI providers, "Search harder"](docs/search/ai-providers.md#search-harder-a-hosted-model-reorders-search-all-off-by-default).
22
+
23
+ ### Fixed
24
+
25
+ - **A file's own relationship, such as a Drive document's owner, no longer waits for review.** `replaceFileLinks`
26
+ writes an unconfirmed relationship from a document with the document's account, so it is `reported` (what the
27
+ source says) instead of `proposed`. Before, every Drive document's owner and last editor stood in the owner's review
28
+ list. Links the file states that are not relationships, and the owner's own links, are unchanged. A source re-writes
29
+ its links on its next import: `drive <profile> catalog import --offline` moves the stored ones.
30
+ - **`search all --harder` sends the question as typed.** It sent the query parser's escaped copy (`deposit\?`), and a
31
+ `$&` in a question was read as a replacement pattern.
32
+ - **`relationships list include:ended` answers in about 0.2 seconds instead of minutes on a store with a busy
33
+ person.** The check for an owner's override of a link looked the override up by the link's target, so a person on
34
+ 25,857 deals read every one of those links again for each relationship (325 seconds on a 108,000-link store). It now
35
+ looks it up by the relationship's own key. The same check runs in the deal's people, a thing's relationships and a
36
+ meeting's preparation, so those get faster too.
37
+
38
+ ## 0.620.0 — 09.11.2026
39
+
40
+ ### Added
41
+
42
+ - **`bot messages send` and `bot messages edit` take inline buttons.** `--button <text>=<data>`, repeated, puts the
43
+ buttons in one row (up to 8; the data is 1 to 64 bytes, checked before anything is sent). `edit` replaces the
44
+ message's buttons with `--button`, takes them all off with `--no-buttons`, and leaves the choice to the messenger
45
+ when neither is given. A bot adapter gets `buttons` (`BotButton[][]`; `[]` means none) in the options of `send` and
46
+ `edit`; one that cannot draw buttons must refuse them. The bot MCP tools gain `button` (one button) and `no_buttons`.
47
+ - **`Button.data`**, what a callback button sends the bot, for an adapter that can read it. It is never printed.
48
+ - **`search all` moves up what is dated inside the period a question names.** "What did we decide in March?", "June
49
+ 22", "last week", «в прошлом месяце»: each source is read to 100 hits, and a hit dated inside the period gains 0.5 over
50
+ its place (1 - rank/100) before the page is cut. On LifeBench, over words and meaning merged, recall@10 went from 0.44
51
+ to 0.47 and hit@10 from 0.84 to 0.88; the v3 questions, which name no period, did not move. `SearchAllRequest.now`
52
+ sets the clock.
53
+ - **`search all` finds a meeting by its title.** A meeting whose title holds the words, each as the start of a word
54
+ as passages are matched, is a hit of its own (`scope: "title"`, `found_by: ["title"]`), within the 3 hits a meeting
55
+ gives. It ranks with the passages that hold the words, the newer meeting first, and before its own passages. A
56
+ question, whose passages need only some of its words, matches a title that holds every one. With `--exact` a title
57
+ must hold each word whole. The title is matched through the folded title the store already keeps, so no store
58
+ version is needed. A query with `from:`, `"a b"~N`, `project:` or `tag:` matches no title.
59
+ - **`meetings list` reads an account's meetings newest first through `meetings_by_time`**, stopping at the limit
60
+ instead of sorting every meeting; a meeting with no start still comes last.
61
+ - **`saveAddedSource` takes an optional `sourceKey`** (`<namespace>:<id>`, as `google-drive:<fileId>`). A source
62
+ saved again under the same key is the same document: changed text becomes its next revision, so a memory or fact
63
+ citing it gets a "source changed" review from `knowledge.checkSources` instead of a second copy beside it, and the
64
+ same text changes nothing. Different keys stay separate. The answer has a new optional `changed` field: whether
65
+ text was written; a host store that wraps `saveAddedSource` may leave it out. No store migration.
66
+ - **`searchAll` takes `harder`: a hosted model reorders the first 30 hits (off by default).** Claude Haiku reads the
67
+ question with the hits and puts the ones that answer it first; in the search lab, over a first stage with Haiku
68
+ rewrites, it lifted LifeBench recall@10 from 0.49 to 0.55 for about $0.0004 a question. It sends only when a search asks, the owner has agreed with
69
+ `models search-consents set anthropic --yes` (memo), and a key is found. Any failure or a 5 s wait keeps the plain
70
+ order, and the answer's `harder` field says why. See
71
+ [AI providers, "Search harder"](docs/search/ai-providers.md#search-harder-a-hosted-model-reorders-search-all-off-by-default).
72
+ - **The Anthropic model adapter takes `thinking` and `output_config` (effort, JSON schema format).**
73
+ - **`templates edit` and `templates preview` take `--file -` to read the template from stdin.** It matches
74
+ `digest brief edit --file -`, and lets a caller on Windows, where `/dev/stdin` does not exist, pass a template
75
+ without a temporary file.
76
+
77
+ ### Security
78
+
79
+ - **`messages press` refuses a callback button whose data starts with `wcr`**, the prefix of review decisions, with
80
+ `permission_error` and reason `press.owner-hand-only`, so an agent with the owner's account cannot press a decision
81
+ button. It needs the adapter to fill `Button.data`; a button without data is pressed as before.
82
+
83
+ ### Changed — may break callers
84
+
85
+ - **`search all` reads meetings from every meeting account, through their search index, ranked with the other
86
+ sources.** Meetings are one more resource of `searchAll` (`RESOURCES_SEARCHED` ends with `meetings`). Without
87
+ `--source`, every meeting account of the scope of the caller's stored account is read, so a work profile never
88
+ reads personal meetings; `meetingScopes` widens it. A named account of another scope is skipped with its scope.
89
+ With no meeting account to read, a caller that named meetings (`meetingsAsked`, from `--only meetings`) gets a
90
+ `meetings` skip with `not_found`; any other answer says nothing of meetings. `--source zoom:<account>` reads only
91
+ that one, and `--source zoom` or `meetings` reads them all instead of refusing several. The meeting query language
92
+ applies: phrases, OR, NOT, `"a b"~N`, `from:` (who said it), `date:` in `--timezone`, and `--exact`. A field
93
+ meetings lack (`in:`, `chat:`, `filename:`) skips meetings with the reason; a failure of one account (`from:` naming
94
+ two speakers) skips only that account. One meeting gives at most 3 passages, each its own hit, with an excerpt of
95
+ about 240 characters instead of 2000. Search all never builds the index: `meetings` in the answer has
96
+ `indexing: "ready" | "pending"` and `hasMore` per account, and the CLI answer names a pending account in `missing`.
97
+ Meeting hits carry `foundBy` (`found_by`); a hit found only through a garbled spelling says so with
98
+ `match: "corrected"` and `corrections`, and the excerpt is centred on the words the index matched (`searchHits` hits
99
+ carry them as `matchedWords`, with `speakerName`). Each account's index is read 200 rows a page, and a page past the
100
+ store's 4 MB budget is asked again with half the rows, down to one, before the account is skipped.
101
+ - **`--max-meetings` (MCP `max_meetings`) is gone from `search all`**, in the messenger, CRM and calendar commands,
102
+ and so are `MEETINGS_UNNAMED`, the `search.meetings` step, `searchAllWithMeetings` (and
103
+ `messages.searchAllWithMeetings`), `SearchAllWithMeetingsRequest` and `RESOURCES_SEARCHED_WITH_MEETINGS`. Call
104
+ `searchAll` (or `messages.searchAll`) with `source`; its answer is `SearchAllFound`, whose `hasMore` is always a
105
+ boolean. `SearchAllItem` is now `SearchAllRecordItem | MeetingSearchItem`. At their next bump of this package:
106
+ tg-cli and max-cli drop `--max-meetings` from `docs/commands.md`, `docs/dev/test-matrix.md` and
107
+ `scripts/test-matrix-untested.ts`; whatsapp-cli from `docs/commands.md` and its test matrix; gcal-cli and
108
+ bitrix24-cli from their `search all` tests and test matrix.
109
+ - **`searchAllIncludingMeetings`, `ResourceWithMeetings`, `MeetingSearchCursor`, `MeetingSearchCoverage` and the
110
+ `SearchAllIncludingMeetings*` types are deprecated**, kept until zoom-cli moves to `searchAll`
111
+ ([zoom-cli#344](https://github.com/WireCatLabs/zoom-cli/pull/344)). `searchAllIncludingMeetings` now calls
112
+ `searchAll`: `meetingAccount` becomes `scope.meetings`, `maxMeetings` and `meetingCursor` are ignored, pages are
113
+ `offset`, and its answer never has `meetings`. `allAnswer` takes either answer.
114
+ - **`sharedCommandTemplate(app, "search")` keeps the old `search all`** (its summary and description, the `--only`
115
+ and `--source` wording and `--max-meetings`), while the messenger's own `search all` has the new one. cli-memo,
116
+ zoom-cli and drive-cli review their overrides against those exact values. The template moves to the new shape in
117
+ the release that [cli-memo#703](https://github.com/WireCatLabs/cli-memo/pull/703), zoom-cli#344 and drive-cli's
118
+ matching change ship with; then each updates the `search all` entries of its shared contract overrides.
119
+ - **`liftMeetingFields` takes the caller's timezone** as a fourth argument for `date:`; without it, the process's.
120
+ - **`contacts prepare` and `contacts events` read only the scope of the account asked.** A person merged across a
121
+ personal and a work account brought every fact, note and task into `contacts prepare`, and every scope into
122
+ `contacts events`. Now the facts, the owner's notes and the tasks of projects with no account come only from the
123
+ asked account's scope, personal or work, or from the scopes the caller passes (`scopes`, as `personContext` takes).
124
+ A fact takes its own scope, then its project's. A note shows only when every scope it touches is read: its
125
+ project's, or those of the projects it is about. A note about the person alone is personal. Anything else unscoped
126
+ counts as personal, so a work profile no longer sees the owner's personal notes. `prepare.coverage.tasks`, `.facts`
127
+ and `.notes` name the `scopes` read. `contacts events` reads the same scopes and refuses `scope:` of another one
128
+ with `permission_error` / `selection.out-of-scope`, where it answered that scope's rows before. A chat pinned to the
129
+ other scope no longer shows in this account's events. `personTimeline` takes `scopes` and answers them.
130
+ `store.people.preparation` needs `scopes`, and `store.involvements.forPerson` takes `scopes` (a list) in place of
131
+ `scope`. `contacts context`, `contacts prepare` and calendar preparation also leave out a chat pinned to a scope
132
+ that is not read, even in a readable account: its shared chat, messages and mentions.
133
+ `store.chats.chatScopes(key, chatIds)` answers each chat's scope, its own or else its account's.
134
+ - **The CRM's `deals` and `leads` commands name their argument `<deal>` and `<lead>`, not `<ref>`** (WC-CMD-13).
135
+ `show`, `update`, `move`, `close` and `delete` take the same `deal:<id>` or `lead:<id>` as before; only the name
136
+ changes. Through MCP the argument is now `deal` or `lead`, so a call that sends `ref` is refused. Under
137
+ `<PREFIX>_GROUP_LOCK` a bare id such as `deals show 12` is now read as `deal:12` and checked against the group. A
138
+ CRM CLI runs `pnpm generate` and `pnpm exec cli-contract contracts/plan.json --update` on the bump that brings this.
139
+
140
+ ### Fixed
141
+
142
+ - **The links list and the relationships list read a merged person's old rows too.** `notes.links({ from, to })` with
143
+ the current person now lists links written on a uid merged into them, and `listRelations({ about })` marks such a
144
+ relationship `outgoing` or `incoming` by the person it is about, not by the uid written on it.
145
+ - **`bin/release` publishes when main has only `changes/` fragments and no `## Unreleased`.** With the version taken on
146
+ npm it looked for `## Unreleased` to put the next version under, found none and stopped before publishing 0.620.0.
147
+ It now adds the new version's heading above the newest one and collects the fragments into it.
148
+ - **Help and docs name EmbeddingGemma as the default text model.** `conversations embed --model` said
149
+ "default: e5-small" and now reads the name from `DEFAULT_TEXT_MODEL`. `docs/search/ai-providers.md` no longer
150
+ says e5-small is the default. e5-small stays a choice and the fallback on a machine that has only it.
151
+
8
152
  ## 0.619.0 — 09.11.2026
9
153
 
10
154
  ### Added
@@ -24,12 +24,12 @@ export interface DailyArchiveTimerInput {
24
24
  }
25
25
  export declare const dailyArchiveTimer: (input: DailyArchiveTimerInput) => DailyArchiveTimer;
26
26
  export declare const manageDailyArchiveTimer: (plan: DailyArchiveTimer, action: "install" | "start" | "stop" | "status" | "uninstall", system: Pick<ServerSystem, "platform" | "run">, env: NodeJS.ProcessEnv, signal?: AbortSignal) => Promise<{
27
- action?: undefined;
28
27
  name: string;
29
28
  installed: boolean;
30
29
  active: boolean;
31
30
  servicePath: string;
32
31
  timerPath: string;
32
+ action?: undefined;
33
33
  } | {
34
34
  active?: undefined;
35
35
  name: string;
@@ -6,7 +6,7 @@ interface SearchAllHelpers extends Pick<CommandHelpers, "within" | "zone" | "exa
6
6
  }
7
7
  /**
8
8
  * `search all` beside `search events`: the messenger's shared search over the store, without a messenger server.
9
- * Events are the calendar's own kind and always read; meeting transcripts only when `--source` names a meeting account.
9
+ * Events are the calendar's own kind and always read.
10
10
  */
11
11
  export declare const addSearchAll: (searches: Command, { within, app, zone, example }: SearchAllHelpers) => void;
12
12
  export {};
@@ -10,20 +10,20 @@ import { deniedKinds } from "../../cli/search-left-out.js";
10
10
  import { commandAt, rootOf } from "../../cli/steps.js";
11
11
  import { SAVE_HELP } from "../../meetings/index.js";
12
12
  import { meaningLane } from "../../services/messages-meaning.js";
13
- import { searchAllWithMeetings } from "../../services/search-all-meetings.js";
13
+ import { searchAll } from "../../services/search-all.js";
14
14
  import { messagesOf } from "./bodies.js";
15
15
  const DEFAULT_LIMIT = 20;
16
16
  /**
17
17
  * `search all` beside `search events`: the messenger's shared search over the store, without a messenger server.
18
- * Events are the calendar's own kind and always read; meeting transcripts only when `--source` names a meeting account.
18
+ * Events are the calendar's own kind and always read.
19
19
  */
20
20
  export const addSearchAll = (searches, { within, app, zone, example }) => {
21
21
  const all = annotate(new Command("all"), { effects: LOCAL_READ, partial: true, output: { entity: "hit" } })
22
- .summary("search stored messages, notes, calendar events and selected meeting transcripts")
23
- .description("search calendar events, messages from the other WireCat tools and notes in the local store, and a meeting " +
24
- "account's transcripts when --source names one — best match first; not mail (the separate memo CLI " +
25
- "searches it: memo search mail). Use it when you do not know where something was written; search events " +
26
- "reads the calendar with all its fields")
22
+ .summary("search stored messages, notes, calendar events and meetings")
23
+ .description("search calendar events, messages from the other WireCat tools, notes and meeting transcripts, chat and " +
24
+ "summaries in the local store — best match first; not mail (the separate memo CLI searches it: memo search " +
25
+ "mail). Use it when you do not know where something was written; search events reads the calendar with all " +
26
+ "its fields")
27
27
  .argument("<query...>", 'strict Lucene query: words, "phrases", AND/OR/NOT, field groups and date ranges')
28
28
  .addHelpText("after", SAVE_HELP)
29
29
  .addHelpText("after", "--json: the list is items; each result's reference is ref, with its kind.");
@@ -43,7 +43,7 @@ export const addSearchAll = (searches, { within, app, zone, example }) => {
43
43
  const limit = opts.limit ?? DEFAULT_LIMIT;
44
44
  const offset = offsetOf(opts.page, limit);
45
45
  const env = run.env ?? process.env;
46
- const found = await searchAllWithMeetings(store, run.account, {
46
+ const found = await searchAll(store, run.account, {
47
47
  text: words.join(" "),
48
48
  limit,
49
49
  ...(offset === undefined ? {} : { offset }),
@@ -51,8 +51,8 @@ export const addSearchAll = (searches, { within, app, zone, example }) => {
51
51
  timezone: opts.timezone ?? zone(),
52
52
  env,
53
53
  only,
54
+ ...(opts.only?.includes("meetings") ? { meetingsAsked: true } : {}),
54
55
  ...(opts.source === undefined ? {} : { source: opts.source }),
55
- ...(opts.maxMeetings === undefined ? {} : { maxMeetings: opts.maxMeetings }),
56
56
  ...(run.locked ? { scope: { events: [run.account] } } : {}),
57
57
  }, { app, hintCommand: commandAt(rootOf(leaf), "models download") ? app.command : null }, undefined, meaningLane({ env, messenger: { app }, store: async () => store }));
58
58
  const note = (text) => outputFor(leaf).renderer.note(text);
@@ -71,7 +71,6 @@ export const addSearchAll = (searches, { within, app, zone, example }) => {
71
71
  query: words.join(" "),
72
72
  ...(opts.only === undefined ? {} : { only: opts.only.join(",") }),
73
73
  ...(opts.source === undefined ? {} : { source: opts.source }),
74
- ...(opts.maxMeetings === undefined ? {} : { max_meetings: opts.maxMeetings }),
75
74
  ...(opts.exact ? { exact: true } : {}),
76
75
  ...(opts.timezone === undefined ? {} : { timezone: opts.timezone }),
77
76
  };
@@ -104,6 +104,7 @@ export const eventPreparation = async (details, options) => {
104
104
  for (const { key } of reads)
105
105
  read.set(nameOf(key), key);
106
106
  const context = await recordContext(store, record, reads, readable, {
107
+ ...(options.scopes === undefined ? {} : { scopes: options.scopes }),
107
108
  messages: limit,
108
109
  bytes: Math.min(left, PERSON_BYTES),
109
110
  now,
@@ -17,6 +17,6 @@ export interface BaseStagesCommandOptions {
17
17
  }
18
18
  /**
19
19
  * `stages …`: the owner's base stages of deals and of leads, and the stages of every other pipeline mapped onto them. memo mounts it; a CRM
20
- * CLI moves a card to a base stage with `deals move <ref> stage:<id>`.
20
+ * CLI moves a card to a base stage with `deals move <deal> stage:<id>`.
21
21
  */
22
22
  export declare const baseStagesCommand: (app: AppIdentity, options: BaseStagesCommandOptions) => Command;
@@ -54,7 +54,7 @@ const position = (value) => {
54
54
  const kindArgument = () => new Argument("<kind>", "deal or lead: which base set").choices(DEAL_KINDS);
55
55
  /**
56
56
  * `stages …`: the owner's base stages of deals and of leads, and the stages of every other pipeline mapped onto them. memo mounts it; a CRM
57
- * CLI moves a card to a base stage with `deals move <ref> stage:<id>`.
57
+ * CLI moves a card to a base stage with `deals move <deal> stage:<id>`.
58
58
  */
59
59
  export const baseStagesCommand = (app, options) => {
60
60
  const isAgent = (command) => Boolean(environmentOf(command).agent || agentOf(options.env()));
@@ -0,0 +1,3 @@
1
+ import type { BotButton } from "./port.js";
2
+ /** `--button` values, `<text>=<data>` each, as one row; the text may not hold `=`, the data may. */
3
+ export declare const parseButtons: (values: readonly string[]) => BotButton[][];
@@ -0,0 +1,24 @@
1
+ import { CliError } from "@wirecat/cli-base";
2
+ /** Telegram's limits; MAX's are looser, so one check serves both. */
3
+ const MAX_DATA_BYTES = 64;
4
+ const MAX_BUTTONS = 8;
5
+ /** `--button` values, `<text>=<data>` each, as one row; the text may not hold `=`, the data may. */
6
+ export const parseButtons = (values) => {
7
+ if (values.length > MAX_BUTTONS) {
8
+ throw new CliError("validation_error", `at most ${MAX_BUTTONS} buttons fit in a row; got ${values.length}`);
9
+ }
10
+ const row = values.map((value) => {
11
+ const cut = value.indexOf("=");
12
+ const text = (cut < 0 ? value : value.slice(0, cut)).trim();
13
+ const data = cut < 0 ? "" : value.slice(cut + 1);
14
+ if (cut < 0 || text === "") {
15
+ throw new CliError("validation_error", `--button wants <text>=<data>, got "${value}"`);
16
+ }
17
+ const bytes = Buffer.byteLength(data, "utf8");
18
+ if (bytes < 1 || bytes > MAX_DATA_BYTES) {
19
+ throw new CliError("validation_error", `--button "${text}": the callback data must be 1 to ${MAX_DATA_BYTES} bytes, got ${bytes}`);
20
+ }
21
+ return { text, data };
22
+ });
23
+ return row.length === 0 ? [] : [row];
24
+ };
@@ -14,6 +14,7 @@ import { wholeList } from "../messenger/chat-answers.js";
14
14
  import { messageItem } from "../messenger/message-items.js";
15
15
  import { readAll } from "../messenger/stdin.js";
16
16
  import { positiveCount } from "../paging.js";
17
+ import { parseButtons } from "./buttons.js";
17
18
  import { botContext } from "./context.js";
18
19
  import { botExamples } from "./examples.js";
19
20
  import { BOT_MESSAGES_QUERY, botMessageWindow } from "./list-queries.js";
@@ -53,6 +54,7 @@ const written = (context, botId, receipt, message) => itemOf({
53
54
  });
54
55
  /** Says what fills the copy, rather than printing an empty list. */
55
56
  const nothingKept = (context) => new CliError("not_found", `this bot has kept nothing on this machine yet — run \`${context.words} messages list <chat>\` once without --offline`);
57
+ const collectButton = (value, previous = []) => [...previous, value];
56
58
  const marks = (md, html) => {
57
59
  if (md && html)
58
60
  throw new CliError("validation_error", "--md and --html mark up the text two ways; use one");
@@ -74,6 +76,7 @@ const sendCommand = (bot) => annotate(new Command("send"), {
74
76
  .option("--silent", "deliver without a notification")
75
77
  .option("--md", "read this messenger's Markdown; see its formatting guide for supported syntax")
76
78
  .option("--html", "the text is HTML: <b>, <i>, <a href>, <code>")
79
+ .option("--button <text=data>", "an inline button, as <text>=<data>; repeat for more in one row; the data (1 to 64 bytes) goes back to the bot", collectButton)
77
80
  .addOption(ownerOnlyOption("--file <file>", "attach a file; the text becomes its caption"))
78
81
  .addOption(ownerOnlyOption("--photo <file>", "attach a .jpg, .png or .webp as a photo; the text becomes its caption"))
79
82
  .addOption(ownerOnlyOption("--as-file", "send the --file as a file to download, a video included"))
@@ -83,6 +86,7 @@ const sendCommand = (bot) => annotate(new Command("send"), {
83
86
  const context = botContext(this, bot);
84
87
  const options = this.opts();
85
88
  marks(options.md, options.html);
89
+ const buttons = parseButtons(options.button ?? []);
86
90
  const ref = context.chatRef(chat);
87
91
  const attachments = await readAttachments({
88
92
  ...(options.photo === undefined ? {} : { photo: options.photo }),
@@ -118,6 +122,7 @@ const sendCommand = (bot) => annotate(new Command("send"), {
118
122
  ...(spans.length > 0 ? { formatting: spans } : {}),
119
123
  ...(options.html ? { html: true } : {}),
120
124
  ...(attachments.length > 0 ? { attachments } : {}),
125
+ ...(buttons.length > 0 ? { buttons } : {}),
121
126
  }), (sent) => ({ messageId: sent.id }));
122
127
  seen(context, message);
123
128
  if (message.senderId)
@@ -204,16 +209,23 @@ const editCommand = (bot) => annotate(new Command("edit"), {
204
209
  effects: REMOTE_WRITE,
205
210
  examples: botExamples(bot, 'messages edit Team 101 "Doors open at 10"'),
206
211
  })
207
- .description("replace the text of a message the bot sent")
212
+ .description("replace the text of a message the bot sent; --button replaces its buttons, --no-buttons takes them off")
213
+ .summary("replace the text or buttons of a message the bot sent")
208
214
  .argument("<chat>", "a chat id, user:<id> for a person, or the title of a chat this bot has seen")
209
215
  .argument("<message>", "message id")
210
216
  .argument("<text>", "the new text")
211
217
  .option("--md", "read this messenger's Markdown; see its formatting guide for supported syntax")
212
218
  .option("--html", "the text is HTML: <b>, <i>, <a href>, <code>")
219
+ .option("--button <text=data>", "a button under the message, as <text>=<data>; replaces its buttons; repeat for more in one row", collectButton)
220
+ .option("--no-buttons", "take the buttons off the message")
213
221
  .action(async function (chat, messageId, text) {
214
222
  const context = botContext(this, bot);
215
223
  const options = this.opts();
216
224
  marks(options.md, options.html);
225
+ if (options.buttons === false && options.button?.length) {
226
+ throw new CliError("validation_error", "--button and --no-buttons set the buttons two ways; use one");
227
+ }
228
+ const buttons = options.buttons === false ? [] : options.button ? parseButtons(options.button) : undefined;
217
229
  const ref = context.chatRef(chat);
218
230
  await context.run(async (events) => {
219
231
  const adapter = await context.authenticated({ events });
@@ -227,6 +239,7 @@ const editCommand = (bot) => annotate(new Command("edit"), {
227
239
  const message = await guardedWrite(context.guard(), { operationId, chatId: ref, kind: "edit", key: "bot.messages.edit", messageId, length: plain.length }, () => edit(ref, messageId, plain, {
228
240
  ...(spans.length > 0 ? { formatting: spans } : {}),
229
241
  ...(options.html ? { html: true } : {}),
242
+ ...(buttons ? { buttons } : {}),
230
243
  }));
231
244
  const botId = await botIdOf(context, adapter);
232
245
  await context.copy.keep(botId, [message], "send", context.renderer.warn, adapter.senders?.());
@@ -19,6 +19,11 @@ import type { BotTokenStore } from "./token.js";
19
19
  * MAX's Bot API writes to a person by user id, and Telegram's chat id for a dialog is the person's id.
20
20
  */
21
21
  export type BotChatRef = string;
22
+ /** An inline button that sends `data` back to the bot when pressed; Telegram allows 1 to 64 bytes of it. */
23
+ export interface BotButton {
24
+ text: string;
25
+ data: string;
26
+ }
22
27
  /** How one bot message goes. A bot send is never repeated — neither Bot API makes a repeat safe — so it has no send id. */
23
28
  export interface BotSendOptions {
24
29
  /** A message id in the same chat. */
@@ -30,6 +35,8 @@ export interface BotSendOptions {
30
35
  /** `text` is the messenger's HTML. */
31
36
  html?: boolean;
32
37
  attachments?: Upload[];
38
+ /** Inline buttons under the message, row by row. */
39
+ buttons?: BotButton[][];
33
40
  }
34
41
  /** Sending, changing and deleting the bot's messages. */
35
42
  export interface BotMessaging {
@@ -38,6 +45,7 @@ export interface BotMessaging {
38
45
  markup?: Markup[];
39
46
  formatting?: TextSpan[];
40
47
  html?: boolean;
48
+ buttons?: BotButton[][];
41
49
  }): Promise<Message>;
42
50
  delete(chat: BotChatRef, messageIds: Id[]): Promise<void>;
43
51
  }
@@ -1,6 +1,6 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
2
  import { annotate, sharedCommand } from "@wirecat/cli-base/commands";
3
- import { Command } from "commander";
3
+ import { Command, Option } from "commander";
4
4
  import { note } from "../entities/note.js";
5
5
  import { addMeetingCommands } from "../meetings/cli/index.js";
6
6
  import { commandsCommand } from "./commands-command.js";
@@ -10,6 +10,35 @@ import { doctorCommand } from "./messenger/doctor-command.js";
10
10
  import { mcpCommand } from "./messenger/mcp-command.js";
11
11
  import { searchCommand } from "./messenger/search-command.js";
12
12
  import { settingsFor } from "./settings.js";
13
+ /**
14
+ * `search all` as it was before meetings became one of its sources: cli-memo, zoom-cli and drive-cli review their
15
+ * overrides against these exact values, and a template that moves fails their start. Drop it in the cli-core release
16
+ * that cli-memo#703, zoom-cli#344 and drive-cli's update land with.
17
+ */
18
+ const frozenSearch = (search) => {
19
+ const all = search.commands.find((command) => command.name() === "all");
20
+ if (!all)
21
+ return search;
22
+ all
23
+ .summary("search stored messages, notes, calendar events and selected meeting transcripts")
24
+ .description("search messenger messages and notes in the local store, calendar events when the store holds a calendar, and " +
25
+ "a meeting account's transcripts when --source names one — best match first; not mail (the separate memo CLI " +
26
+ "searches it: memo search mail), tasks, people, memories or projects. Use it when you do not know where " +
27
+ "something was written; search messages or notes reads one kind with all its fields");
28
+ const option = (flags) => all.options.find((one) => one.flags === flags);
29
+ const only = option("--only <resources>");
30
+ const source = option("--source <accounts>");
31
+ if (only)
32
+ only.description =
33
+ "only these resources, separated by commas: messages, notes, events; meetings when --source names a meeting account";
34
+ if (source) {
35
+ source.description =
36
+ "only these accounts, separated by commas: provider:account as a hit shows it, a provider, a kind or " +
37
+ "group:<name>; each resource reads the ones of its kind, and meetings only when it names one";
38
+ all.options.splice(all.options.indexOf(source) + 1, 0, new Option("--max-meetings <n>", "how many of the meeting account's meetings to look through, newest first, or all for every one (default 100)"));
39
+ }
40
+ return search;
41
+ };
13
42
  /** Construction-only defaults for a CLI that explicitly binds an independent source or transport. */
14
43
  export const sharedCommandTemplate = (app, name) => {
15
44
  const unavailable = () => {
@@ -32,7 +61,7 @@ export const sharedCommandTemplate = (app, name) => {
32
61
  if (name === "mcp")
33
62
  return mcpCommand(messenger);
34
63
  if (name === "search")
35
- return searchCommand(messenger);
64
+ return frozenSearch(searchCommand(messenger));
36
65
  if (name === "meetings") {
37
66
  const root = new Command(app.command);
38
67
  addMeetingCommands(root, {
@@ -191,7 +191,8 @@ export const contactsCommand = (messenger) => {
191
191
  })
192
192
  .summary("one person's activity across their linked identities")
193
193
  .description("everything one person took part in, in every messenger linked to them — messages they wrote or were " +
194
- "mentioned in, chats, mail, meetings, tasks — newest first, from the store; never connects")
194
+ "mentioned in, chats, mail, meetings, tasks — newest first, from the store; only in this account's scope, " +
195
+ "personal or work, and scope: of the other one is refused; never connects")
195
196
  .argument("<person>", "their id, @username, or part of their name"), CONTACT_ACTIVITY_QUERY)
196
197
  .option("--limit <n>", `at most this many; ${TIMELINE_ITEMS} if not given`, positiveCount("--limit"))
197
198
  .option("--cursor <cursor>", "go on from where the last page stopped; page.next gives it, with the same filters")
@@ -4,6 +4,7 @@ import { Command, Option } from "commander";
4
4
  import { analysisConsents } from "../../analysis/consents.js";
5
5
  import { openAnalysis, providerIdentity } from "../../analysis/provider.js";
6
6
  import { runAnalysis } from "../../analysis/runner.js";
7
+ import { DEFAULT_TEXT_MODEL } from "../../embeddings/models.js";
7
8
  import { isLocal } from "../../embeddings/remote.js";
8
9
  import { renderMessages } from "../../render/messages.js";
9
10
  import { BATCH_SIZE, CONVERSATION_QUERY } from "../../services/conversations.js";
@@ -401,7 +402,7 @@ const chatOf = ({ chat }) => {
401
402
  return chat;
402
403
  };
403
404
  const withModelOptions = (command) => command
404
- .option("--model <model>", "local: a model id from `models list` (default: e5-small); remote: the provider's model")
405
+ .option("--model <model>", `local: a model id from \`models list\` (default: ${DEFAULT_TEXT_MODEL}); remote: the provider's model`)
405
406
  .addOption(new Option("--embedding-provider <provider>", "embedding provider: local or openai; flags override profile settings"))
406
407
  .option("--base-url <url>", "a server with OpenAI's /v1/embeddings: Gemini, Jina, or Ollama and LM Studio on this machine")
407
408
  .option("--dims <n>", "remote: the vector size — needed with --base-url; shortens an OpenAI model's", positiveCount("--dims"));
@@ -20,7 +20,7 @@ const attachmentItem = (attachment) => defined({
20
20
  phone: attachment.contact.phone,
21
21
  user_id: attachment.contact.userId,
22
22
  }),
23
- buttons: attachment.buttons,
23
+ buttons: attachment.buttons?.map((row) => row.map(({ data: _data, ...button }) => button)),
24
24
  });
25
25
  const quotedItem = (quoted) => quoted === null
26
26
  ? null
@@ -6,8 +6,8 @@ import type { ChatCoverage } from "../../services/chat-coverage.js";
6
6
  import type { FoundMessage, SearchFound } from "../../services/messages.js";
7
7
  import type { MeaningSkipped } from "../../services/messages-discovery.js";
8
8
  import type { FoundNote, NotesFoundOf } from "../../services/notes-search.js";
9
- import type { SearchAllItem } from "../../services/search-all.js";
10
- import type { MeetingSearchItem, SearchAllIncludingMeetingsFound } from "../../services/search-all-meetings.js";
9
+ import type { SearchAllFound, SearchAllItem } from "../../services/search-all.js";
10
+ import type { SearchAllIncludingMeetingsFound } from "../../services/search-all-deprecated.js";
11
11
  import type { StoredHistorySkip } from "../../store/store.js";
12
12
  import { type ListBody } from "../envelope.js";
13
13
  /** What a source tool's `search all` reads: never mail, which is memo's (docs/dev/TOOL-BOUNDARIES.md). */
@@ -46,11 +46,11 @@ export declare const shownOf: (shown: number, offset: number, total: SearchTotal
46
46
  /** `search messages` and `search mail`, CLI and MCP alike. */
47
47
  export declare const messagesAnswer: (command: string, found: SearchFound, { limit, page, again }: Paging, query?: string, skips?: StoredHistorySkip[]) => ListBody<MessageHitItem>;
48
48
  export declare const noteHitItem: (hit: FoundNote) => NoteHitItem;
49
- export declare const allHitItem: (item: SearchAllItem | MeetingSearchItem) => HitItem;
49
+ export declare const allHitItem: (item: SearchAllItem) => HitItem;
50
50
  /** `search notes`, CLI and MCP alike. */
51
51
  export declare const notesAnswer: (command: string, found: NotesFoundOf, { limit, page, again }: Paging, exact?: boolean) => ListBody<NoteHitItem>;
52
- /** `search all`, CLI and MCP alike. A bounded meeting scan that could not tell whether more match says so. */
53
- export declare const allAnswer: (command: string, found: SearchAllIncludingMeetingsFound, { limit, page, again }: Paging, exact?: boolean, skips?: StoredHistorySkip[],
52
+ /** `search all`, CLI and MCP alike. A meeting account whose index is still being built says so. */
53
+ export declare const allAnswer: (command: string, found: SearchAllFound | SearchAllIncludingMeetingsFound, { limit, page, again }: Paging, exact?: boolean, skips?: StoredHistorySkip[],
54
54
  /** Kinds the profile's levels kept out of the search, each with why. */
55
55
  leftOut?: readonly {
56
56
  why: string;
@@ -306,7 +306,9 @@ export const allHitItem = (item) => item.kind === "meeting"
306
306
  excerpt: item.text,
307
307
  offset_ms: item.startMs,
308
308
  scope: item.scope,
309
+ found_by: item.foundBy,
309
310
  id: String(item.id),
311
+ ...(item.match === undefined ? {} : { match: item.match, corrections: item.corrections ?? [] }),
310
312
  ...(item.cueRef === undefined
311
313
  ? {}
312
314
  : {
@@ -359,12 +361,11 @@ export const notesAnswer = (command, found, { limit, page, again }, exact = fals
359
361
  ...meaningGap(found.meaning_skipped, exact),
360
362
  meta: metaOf(found.accounts, found.skipped),
361
363
  });
362
- /** `search all`, CLI and MCP alike. A bounded meeting scan that could not tell whether more match says so. */
364
+ /** `search all`, CLI and MCP alike. A meeting account whose index is still being built says so. */
363
365
  export const allAnswer = (command, found, { limit, page, again }, exact = false, skips = [],
364
366
  /** Kinds the profile's levels kept out of the search, each with why. */
365
367
  leftOut = []) => {
366
368
  const limited = historyLimitGaps(skips);
367
- const scan = found.meetings?.complete === false ? found.meetings : undefined;
368
369
  const notes = meaningGap(found.notes?.meaningSkipped, exact);
369
370
  const messages = messageMeaningGap(found.messages?.meaningSkipped, "found_by");
370
371
  const archive = coverageGaps({ coverage: found.coverage }, found.items.length);
@@ -375,30 +376,18 @@ leftOut = []) => {
375
376
  page: page ?? 1,
376
377
  ...(again ? { args: again } : {}),
377
378
  next: [
378
- ...(scan
379
- ? [
380
- nextStep("search.meetings", {
381
- command,
382
- args: { ...again, max_meetings: "all" },
383
- values: { scanned: scan.meetingsScanned },
384
- }),
385
- ]
386
- : []),
387
379
  ...notes.next,
388
380
  ...messages.next.filter((step) => !notes.next.some((asked) => JSON.stringify(asked) === JSON.stringify(step))),
389
381
  ...archive.next,
390
382
  ...limited.next,
391
383
  ],
392
384
  missing: [
393
- ...(scan
394
- ? [
395
- {
396
- field: "items",
397
- why: `stopped after ${scan.meetingsScanned} meetings; more may match`,
398
- step: "search.meetings",
399
- },
400
- ]
401
- : []),
385
+ ...(Array.isArray(found.meetings) ? found.meetings : [])
386
+ .filter(({ indexing }) => indexing === "pending")
387
+ .map(({ provider, account }) => ({
388
+ field: "items",
389
+ why: `${provider}:${account}: meetings saved since its search index was last built are not found yet`,
390
+ })),
402
391
  ...notes.missing,
403
392
  ...messages.missing,
404
393
  ...archive.missing,
@@ -1,10 +1,10 @@
1
1
  import { Command } from "commander";
2
- import type { SearchAllIncludingMeetingsFound } from "../../services/search-all-meetings.js";
2
+ import type { SearchAllItem } from "../../services/search-all.js";
3
3
  import { type Messenger } from "./context.js";
4
4
  import { type SourceSearched } from "./search-answers.js";
5
5
  export declare const searchAllOnlyOf: (value: string, allowed?: readonly string[]) => SourceSearched[];
6
6
  /** One `search all` hit as a person reads it. */
7
- export declare const searchAllLine: (item: SearchAllIncludingMeetingsFound["items"][number]) => string;
7
+ export declare const searchAllLine: (item: SearchAllItem) => string;
8
8
  /**
9
9
  * `search all`'s scope, paging and matching options, the same in every CLI that mounts it (WC-ACCT-8): a messenger's
10
10
  * and a calendar's.