@wirecat/cli-core 0.689.0 → 0.691.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,34 @@ 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.691.0 — 17.11.2026
9
+
10
+ ### Added
11
+
12
+ - **The MCP `meetings_list` and `meeting_show` read the service, as `meetings list` and `show` do.** A host passes
13
+ `callMeetingTool` the run's `accountId`, its `source` and its stop `signal` (and `timezone`, `now`, `offline`); the
14
+ two tools then take the same `backend` (`archive`, `server` or `both`, untyped meaning both with a fall-back to the
15
+ store), keep what the service returns, say `found_in` on each item and hand the service the signal, so a stopped
16
+ read ends the call. Every tool then reads that account only: an `account_id` naming another one is refused, and a
17
+ `source` without `accountId` is a configuration error. Without them the tools read the store as before; a typed
18
+ `backend: "both"` says so in `missing`, and `backend: "server"` is refused. The two tools now declare
19
+ `openWorldHint`, and their descriptions no longer say "stored".
20
+ - **`meetingAnswerBody(command, value)`** from `@wirecat/cli-core/cli`: what the shared meetings commands `write`, as
21
+ the host's answer body. An envelope stays as it is, a `listed()` page becomes a list answer whose `page.next` step
22
+ reruns the command at the next page, and any other value is one item, with a packet's own `next`, `missing` and
23
+ `meta` (`meetings people`) lifted onto the answer. `addMeetingCommands` now hands `write` the running command as a
24
+ third argument, so a host passes it straight on. It replaces zoom-cli's `bodyOf` and gcal-cli's `answerOf` for the
25
+ meetings commands.
26
+
27
+ ## 0.690.0 — 17.11.2026
28
+
29
+ ### Fixed
30
+
31
+ - **A chosen folder moved on a path-addressed provider comes back once it is added again under its new path.**
32
+ `documentLibraryCommands` read the folder's old path from the last sync before the one `folders add` had just read,
33
+ so the folder stayed unavailable for good. `folders add` now keeps a chosen folder's new metadata (without changing
34
+ its date), and that copy wins.
35
+
8
36
  ## 0.689.0 — 17.11.2026
9
37
 
10
38
  ### Added
@@ -82,6 +82,8 @@ export declare const documentProfile: <M extends SourceFile>(app: AppIdentity, e
82
82
  dir: string;
83
83
  folders: () => Folders<M>;
84
84
  saveFolders: (roots: string[], files: Record<string, M>) => void;
85
+ /** Keeps a chosen folder's newer metadata (a new path) without changing the choice or its date. */
86
+ saveFolderFile: (file: M) => void;
85
87
  state: (principal: string) => SourceStatePort<M>;
86
88
  synced: () => boolean;
87
89
  walkUnderWay: () => boolean;
@@ -77,6 +77,11 @@ export const documentProfile = (app, env, profile) => {
77
77
  files: Object.fromEntries(roots.flatMap((id) => (files[id] ? [[id, files[id]]] : []))),
78
78
  changed_at: new Date().toISOString(),
79
79
  }),
80
+ /** Keeps a chosen folder's newer metadata (a new path) without changing the choice or its date. */
81
+ saveFolderFile: (file) => {
82
+ const chosen = folders();
83
+ writeJson(join(dir, "folders.json"), { ...chosen, files: { ...chosen.files, [file.id]: file } });
84
+ },
80
85
  state,
81
86
  synced: () => existsSync(join(sync, "state.json")),
82
87
  walkUnderWay: () => existsSync(join(sync, "walk.json")),
@@ -200,7 +205,9 @@ export const documentLibraryCommands = (options) => {
200
205
  // The folder as `folders add` read it stands in for the one the last pass held, before the first sync.
201
206
  const known = (source) => {
202
207
  const chosen = files().folders().files ?? {};
203
- const metadata = (id, held) => source.metadata(id, held ?? chosen[id]);
208
+ // The folder as `folders add` last read it wins over the walk's copy: adding a moved folder again under its new
209
+ // path is how a path-addressed source finds it.
210
+ const metadata = (id, held) => source.metadata(id, chosen[id] ?? held);
204
211
  // A proxy, not a spread: a source written as a class keeps its methods and private fields.
205
212
  return new Proxy(source, {
206
213
  get: (target, name) => {
@@ -284,6 +291,8 @@ export const documentLibraryCommands = (options) => {
284
291
  // A folder already chosen keeps its date, so status does not report a new plan for it.
285
292
  if (!chosen.roots.includes(file.id))
286
293
  files().saveFolders([...chosen.roots, file.id], { ...chosen.files, [file.id]: file });
294
+ else
295
+ files().saveFolderFile(file);
287
296
  return { id: file.id, name: file.name };
288
297
  },
289
298
  list: (filter) => roots()
@@ -56,8 +56,8 @@ export interface CopyAge {
56
56
  }
57
57
  export declare const ageOf: (lastSync: string | undefined, now?: number) => CopyAge;
58
58
  export declare const staleCopy: (provider: string, lastSync: string | undefined, now?: number) => {
59
- next?: undefined;
60
59
  missing?: undefined;
60
+ next?: undefined;
61
61
  meta?: undefined;
62
62
  } | {
63
63
  missing: {
@@ -107,6 +107,7 @@ export { commandPath, LIST_QUERY_GUIDE, listQuery, nativeField, nativeTermLists,
107
107
  export { DOCUMENTS_LIST_QUERY, documentListRequest, MEETINGS_AHEAD_DAYS, MEETINGS_LIST_QUERY, MEETINGS_RECENT_DAYS, type MeetingWindowMeta, meetingListRequest, } from "./listings.js";
108
108
  export { answerLocally, type ShownTime, wallClock } from "./local-times.js";
109
109
  export { MCP_HTTP_DEFAULT_PORT, type McpServerOptions, type McpServerTarget, mcpServerCommand, } from "./mcp-server-command.js";
110
+ export { meetingAnswerBody } from "./meeting-answer-body.js";
110
111
  export { formatMeetingBatch, prepareMeetingBatch } from "./meeting-batch.js";
111
112
  export { meetingEvidenceItem, meetingPersonContextItem } from "./meeting-evidence-answer.js";
112
113
  export { addMeetingCombinedSearchCommand, addMeetingEmbeddingCommand, type MeetingCombinedSearchDeps, type MeetingEmbeddingCommandDeps, type MeetingSearchRun, } from "./meeting-meaning-command.js";
package/dist/cli/index.js CHANGED
@@ -98,6 +98,7 @@ export { commandPath, LIST_QUERY_GUIDE, listQuery, nativeField, nativeTermLists,
98
98
  export { DOCUMENTS_LIST_QUERY, documentListRequest, MEETINGS_AHEAD_DAYS, MEETINGS_LIST_QUERY, MEETINGS_RECENT_DAYS, meetingListRequest, } from "./listings.js";
99
99
  export { answerLocally, wallClock } from "./local-times.js";
100
100
  export { MCP_HTTP_DEFAULT_PORT, mcpServerCommand, } from "./mcp-server-command.js";
101
+ export { meetingAnswerBody } from "./meeting-answer-body.js";
101
102
  export { formatMeetingBatch, prepareMeetingBatch } from "./meeting-batch.js";
102
103
  export { meetingEvidenceItem, meetingPersonContextItem } from "./meeting-evidence-answer.js";
103
104
  export { addMeetingCombinedSearchCommand, addMeetingEmbeddingCommand, } from "./meeting-meaning-command.js";
@@ -0,0 +1,8 @@
1
+ import type { Command } from "commander";
2
+ import { type Body } from "./envelope.js";
3
+ /**
4
+ * What the shared meetings commands and tools `write`, as the host's answer body: an envelope as it is, a `listed()`
5
+ * page through `listOf`, so a page with more rows gets its `page.next` step to `command`, and any other value as one
6
+ * item. `command` is the running command, as `write` gets it, or its path below the program, such as `events list`.
7
+ */
8
+ export declare const meetingAnswerBody: (command: Command | string, value: unknown) => Body;
@@ -0,0 +1,37 @@
1
+ import { itemOf, listOf, snakeKeys } from "./envelope.js";
2
+ const ENVELOPE_KEYS = new Set(["item", "items", "page", "next", "missing", "meta"]);
3
+ const LISTED_KEYS = new Set(["items", "page", "limit", "has_more", "missing", "meta"]);
4
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
5
+ const only = (value, keys) => Object.keys(value).every((key) => keys.has(key));
6
+ const pathOf = (command) => command.parent?.parent ? [...pathOf(command.parent), command.name()] : [command.name()];
7
+ /**
8
+ * What the shared meetings commands and tools `write`, as the host's answer body: an envelope as it is, a `listed()`
9
+ * page through `listOf`, so a page with more rows gets its `page.next` step to `command`, and any other value as one
10
+ * item. `command` is the running command, as `write` gets it, or its path below the program, such as `events list`.
11
+ */
12
+ export const meetingAnswerBody = (command, value) => {
13
+ const path = typeof command === "string" ? command : pathOf(command).join(" ");
14
+ const data = snakeKeys(value);
15
+ if (!isRecord(data))
16
+ return itemOf(data);
17
+ if (only(data, ENVELOPE_KEYS) && ("item" in data || (Array.isArray(data.items) && isRecord(data.page))))
18
+ return data;
19
+ if (Array.isArray(data.items) &&
20
+ only(data, LISTED_KEYS) &&
21
+ (data.page === undefined || typeof data.page === "number"))
22
+ return listOf(path, {
23
+ items: data.items,
24
+ limit: Math.max(1, typeof data.limit === "number" ? data.limit : data.items.length),
25
+ has_more: data.has_more === true,
26
+ ...(typeof data.page === "number" ? { page: data.page } : {}),
27
+ ...(Array.isArray(data.missing) ? { missing: data.missing } : {}),
28
+ ...(isRecord(data.meta) ? { meta: data.meta } : {}),
29
+ });
30
+ // A packet such as `meetings people`'s is one entity whose steps, gaps and meta belong to the answer, not to it.
31
+ const { next, missing, meta, ...item } = data;
32
+ return itemOf(item, {
33
+ ...(Array.isArray(next) ? { next: next } : {}),
34
+ ...(Array.isArray(missing) ? { missing: missing } : {}),
35
+ ...(isRecord(meta) ? { meta: meta } : {}),
36
+ });
37
+ };
@@ -19,7 +19,8 @@ export interface MeetingCommandDeps {
19
19
  * never writes over a file.
20
20
  */
21
21
  newFileOutput?: (command: Command, option: string) => void;
22
- write: (value: unknown, format: "json" | "jsonl" | "text") => void;
22
+ /** Prints an answer; `meetingAnswerBody(command, value)` from `@wirecat/cli-core/cli` makes it the host's body. */
23
+ write: (value: unknown, format: "json" | "jsonl" | "text", command: Command) => void;
23
24
  /**
24
25
  * Runs a command that reaches the account inside cli-core's run, so it is recorded and ended by `--timeout`:
25
26
  * `inCommandRun` from `@wirecat/cli-core/cli`. Required, since this module cannot reach the run itself.
@@ -48,7 +48,7 @@ const addMeetingCommandsDefinition = (program, deps) => {
48
48
  const output = (command) => command;
49
49
  const print = (value, command) => {
50
50
  const opts = command.optsWithGlobals();
51
- deps.write(value, opts.json ? "json" : opts.jsonl ? "jsonl" : "text");
51
+ deps.write(value, opts.json ? "json" : opts.jsonl ? "jsonl" : "text", command);
52
52
  };
53
53
  const access = (command, backend) => {
54
54
  const signal = deps.signal?.();
@@ -1,4 +1,5 @@
1
1
  import { type FailureContext } from "@wirecat/cli-base";
2
+ import type { MeetingSource } from "../source.js";
2
3
  import type { MeetingStore } from "../store.js";
3
4
  export declare const meetingTools: ({
4
5
  name: string;
@@ -30,6 +31,195 @@ export declare const meetingTools: ({
30
31
  type: string;
31
32
  minimum: number;
32
33
  };
34
+ backend: {
35
+ type: string;
36
+ enum: ("archive" | "both" | "server")[];
37
+ description: string;
38
+ };
39
+ history?: undefined;
40
+ meeting?: undefined;
41
+ format?: undefined;
42
+ transcript_id?: undefined;
43
+ scan_limit?: undefined;
44
+ max_read_bytes?: undefined;
45
+ cursor?: undefined;
46
+ } | {
47
+ event_id?: undefined;
48
+ series_id?: undefined;
49
+ page?: undefined;
50
+ meeting: {
51
+ type: string;
52
+ minimum: number;
53
+ };
54
+ account_id: {
55
+ type: string;
56
+ minimum: number;
57
+ };
58
+ backend: {
59
+ type: string;
60
+ enum: ("archive" | "both" | "server")[];
61
+ description: string;
62
+ };
63
+ history?: undefined;
64
+ format?: undefined;
65
+ transcript_id?: undefined;
66
+ query?: undefined;
67
+ limit?: undefined;
68
+ scan_limit?: undefined;
69
+ max_read_bytes?: undefined;
70
+ cursor?: undefined;
71
+ } | {
72
+ event_id?: undefined;
73
+ series_id?: undefined;
74
+ page?: undefined;
75
+ backend?: undefined;
76
+ meeting: {
77
+ type: string;
78
+ minimum: number;
79
+ };
80
+ account_id: {
81
+ type: string;
82
+ minimum: number;
83
+ };
84
+ history: {
85
+ type: string;
86
+ };
87
+ format?: undefined;
88
+ transcript_id?: undefined;
89
+ query?: undefined;
90
+ limit?: undefined;
91
+ scan_limit?: undefined;
92
+ max_read_bytes?: undefined;
93
+ cursor?: undefined;
94
+ } | {
95
+ event_id?: undefined;
96
+ series_id?: undefined;
97
+ page?: undefined;
98
+ backend?: undefined;
99
+ history?: undefined;
100
+ meeting: {
101
+ type: string;
102
+ minimum: number;
103
+ };
104
+ account_id: {
105
+ type: string;
106
+ minimum: number;
107
+ };
108
+ format?: undefined;
109
+ transcript_id?: undefined;
110
+ query?: undefined;
111
+ limit?: undefined;
112
+ scan_limit?: undefined;
113
+ max_read_bytes?: undefined;
114
+ cursor?: undefined;
115
+ } | {
116
+ event_id?: undefined;
117
+ series_id?: undefined;
118
+ page?: undefined;
119
+ backend?: undefined;
120
+ history?: undefined;
121
+ meeting: {
122
+ type: string;
123
+ minimum: number;
124
+ };
125
+ account_id: {
126
+ type: string;
127
+ minimum: number;
128
+ };
129
+ format: {
130
+ type: string;
131
+ enum: string[];
132
+ };
133
+ transcript_id: {
134
+ type: string;
135
+ minimum: number;
136
+ };
137
+ query?: undefined;
138
+ limit?: undefined;
139
+ scan_limit?: undefined;
140
+ max_read_bytes?: undefined;
141
+ cursor?: undefined;
142
+ } | {
143
+ event_id?: undefined;
144
+ series_id?: undefined;
145
+ page?: undefined;
146
+ backend?: undefined;
147
+ history?: undefined;
148
+ meeting?: undefined;
149
+ format?: undefined;
150
+ transcript_id?: undefined;
151
+ query: {
152
+ type: string;
153
+ minLength: number;
154
+ };
155
+ account_id: {
156
+ type: string;
157
+ minimum: number;
158
+ };
159
+ limit: {
160
+ type: string;
161
+ minimum: number;
162
+ maximum: number;
163
+ };
164
+ scan_limit: {
165
+ type: string;
166
+ minimum: number;
167
+ maximum: number;
168
+ };
169
+ max_read_bytes: {
170
+ type: string;
171
+ minimum: number;
172
+ maximum: number;
173
+ };
174
+ cursor: {
175
+ type: string;
176
+ minLength: number;
177
+ };
178
+ };
179
+ required: string[] | never[];
180
+ additionalProperties: boolean;
181
+ };
182
+ annotations: {
183
+ readOnlyHint: boolean;
184
+ destructiveHint: boolean;
185
+ idempotentHint: boolean;
186
+ openWorldHint: boolean;
187
+ };
188
+ } | {
189
+ name: string;
190
+ description: string;
191
+ inputSchema: {
192
+ type: string;
193
+ properties: {
194
+ account_id: {
195
+ type: string;
196
+ minimum: number;
197
+ };
198
+ event_id: {
199
+ type: string;
200
+ minimum: number;
201
+ };
202
+ series_id: {
203
+ type: string;
204
+ minimum: number;
205
+ };
206
+ query: {
207
+ type: string;
208
+ minLength: number;
209
+ };
210
+ limit: {
211
+ type: string;
212
+ minimum: number;
213
+ };
214
+ page: {
215
+ type: string;
216
+ minimum: number;
217
+ };
218
+ backend: {
219
+ type: string;
220
+ enum: ("archive" | "both" | "server")[];
221
+ description: string;
222
+ };
33
223
  history?: undefined;
34
224
  meeting?: undefined;
35
225
  format?: undefined;
@@ -49,6 +239,11 @@ export declare const meetingTools: ({
49
239
  type: string;
50
240
  minimum: number;
51
241
  };
242
+ backend: {
243
+ type: string;
244
+ enum: ("archive" | "both" | "server")[];
245
+ description: string;
246
+ };
52
247
  history?: undefined;
53
248
  format?: undefined;
54
249
  transcript_id?: undefined;
@@ -61,6 +256,7 @@ export declare const meetingTools: ({
61
256
  event_id?: undefined;
62
257
  series_id?: undefined;
63
258
  page?: undefined;
259
+ backend?: undefined;
64
260
  meeting: {
65
261
  type: string;
66
262
  minimum: number;
@@ -83,6 +279,28 @@ export declare const meetingTools: ({
83
279
  event_id?: undefined;
84
280
  series_id?: undefined;
85
281
  page?: undefined;
282
+ backend?: undefined;
283
+ history?: undefined;
284
+ meeting: {
285
+ type: string;
286
+ minimum: number;
287
+ };
288
+ account_id: {
289
+ type: string;
290
+ minimum: number;
291
+ };
292
+ format?: undefined;
293
+ transcript_id?: undefined;
294
+ query?: undefined;
295
+ limit?: undefined;
296
+ scan_limit?: undefined;
297
+ max_read_bytes?: undefined;
298
+ cursor?: undefined;
299
+ } | {
300
+ event_id?: undefined;
301
+ series_id?: undefined;
302
+ page?: undefined;
303
+ backend?: undefined;
86
304
  history?: undefined;
87
305
  meeting: {
88
306
  type: string;
@@ -109,6 +327,7 @@ export declare const meetingTools: ({
109
327
  event_id?: undefined;
110
328
  series_id?: undefined;
111
329
  page?: undefined;
330
+ backend?: undefined;
112
331
  history?: undefined;
113
332
  meeting?: undefined;
114
333
  format?: undefined;
@@ -180,6 +399,11 @@ export declare const meetingTools: ({
180
399
  type: string;
181
400
  minimum: number;
182
401
  };
402
+ backend: {
403
+ type: string;
404
+ enum: ("archive" | "both" | "server")[];
405
+ description: string;
406
+ };
183
407
  history?: undefined;
184
408
  meeting?: undefined;
185
409
  format?: undefined;
@@ -199,6 +423,11 @@ export declare const meetingTools: ({
199
423
  type: string;
200
424
  minimum: number;
201
425
  };
426
+ backend: {
427
+ type: string;
428
+ enum: ("archive" | "both" | "server")[];
429
+ description: string;
430
+ };
202
431
  history?: undefined;
203
432
  format?: undefined;
204
433
  transcript_id?: undefined;
@@ -211,6 +440,7 @@ export declare const meetingTools: ({
211
440
  event_id?: undefined;
212
441
  series_id?: undefined;
213
442
  page?: undefined;
443
+ backend?: undefined;
214
444
  meeting: {
215
445
  type: string;
216
446
  minimum: number;
@@ -233,6 +463,28 @@ export declare const meetingTools: ({
233
463
  event_id?: undefined;
234
464
  series_id?: undefined;
235
465
  page?: undefined;
466
+ backend?: undefined;
467
+ history?: undefined;
468
+ meeting: {
469
+ type: string;
470
+ minimum: number;
471
+ };
472
+ account_id: {
473
+ type: string;
474
+ minimum: number;
475
+ };
476
+ format?: undefined;
477
+ transcript_id?: undefined;
478
+ query?: undefined;
479
+ limit?: undefined;
480
+ scan_limit?: undefined;
481
+ max_read_bytes?: undefined;
482
+ cursor?: undefined;
483
+ } | {
484
+ event_id?: undefined;
485
+ series_id?: undefined;
486
+ page?: undefined;
487
+ backend?: undefined;
236
488
  history?: undefined;
237
489
  meeting: {
238
490
  type: string;
@@ -259,6 +511,7 @@ export declare const meetingTools: ({
259
511
  event_id?: undefined;
260
512
  series_id?: undefined;
261
513
  page?: undefined;
514
+ backend?: undefined;
262
515
  history?: undefined;
263
516
  meeting?: undefined;
264
517
  format?: undefined;
@@ -330,6 +583,11 @@ export declare const meetingTools: ({
330
583
  type: string;
331
584
  minimum: number;
332
585
  };
586
+ backend: {
587
+ type: string;
588
+ enum: ("archive" | "both" | "server")[];
589
+ description: string;
590
+ };
333
591
  history?: undefined;
334
592
  meeting?: undefined;
335
593
  format?: undefined;
@@ -349,6 +607,11 @@ export declare const meetingTools: ({
349
607
  type: string;
350
608
  minimum: number;
351
609
  };
610
+ backend: {
611
+ type: string;
612
+ enum: ("archive" | "both" | "server")[];
613
+ description: string;
614
+ };
352
615
  history?: undefined;
353
616
  format?: undefined;
354
617
  transcript_id?: undefined;
@@ -361,6 +624,7 @@ export declare const meetingTools: ({
361
624
  event_id?: undefined;
362
625
  series_id?: undefined;
363
626
  page?: undefined;
627
+ backend?: undefined;
364
628
  meeting: {
365
629
  type: string;
366
630
  minimum: number;
@@ -383,6 +647,28 @@ export declare const meetingTools: ({
383
647
  event_id?: undefined;
384
648
  series_id?: undefined;
385
649
  page?: undefined;
650
+ backend?: undefined;
651
+ history?: undefined;
652
+ meeting: {
653
+ type: string;
654
+ minimum: number;
655
+ };
656
+ account_id: {
657
+ type: string;
658
+ minimum: number;
659
+ };
660
+ format?: undefined;
661
+ transcript_id?: undefined;
662
+ query?: undefined;
663
+ limit?: undefined;
664
+ scan_limit?: undefined;
665
+ max_read_bytes?: undefined;
666
+ cursor?: undefined;
667
+ } | {
668
+ event_id?: undefined;
669
+ series_id?: undefined;
670
+ page?: undefined;
671
+ backend?: undefined;
386
672
  history?: undefined;
387
673
  meeting: {
388
674
  type: string;
@@ -409,6 +695,7 @@ export declare const meetingTools: ({
409
695
  event_id?: undefined;
410
696
  series_id?: undefined;
411
697
  page?: undefined;
698
+ backend?: undefined;
412
699
  history?: undefined;
413
700
  meeting?: undefined;
414
701
  format?: undefined;
@@ -480,6 +767,11 @@ export declare const meetingTools: ({
480
767
  type: string;
481
768
  minimum: number;
482
769
  };
770
+ backend: {
771
+ type: string;
772
+ enum: ("archive" | "both" | "server")[];
773
+ description: string;
774
+ };
483
775
  history?: undefined;
484
776
  meeting?: undefined;
485
777
  format?: undefined;
@@ -499,6 +791,11 @@ export declare const meetingTools: ({
499
791
  type: string;
500
792
  minimum: number;
501
793
  };
794
+ backend: {
795
+ type: string;
796
+ enum: ("archive" | "both" | "server")[];
797
+ description: string;
798
+ };
502
799
  history?: undefined;
503
800
  format?: undefined;
504
801
  transcript_id?: undefined;
@@ -511,6 +808,7 @@ export declare const meetingTools: ({
511
808
  event_id?: undefined;
512
809
  series_id?: undefined;
513
810
  page?: undefined;
811
+ backend?: undefined;
514
812
  meeting: {
515
813
  type: string;
516
814
  minimum: number;
@@ -533,6 +831,28 @@ export declare const meetingTools: ({
533
831
  event_id?: undefined;
534
832
  series_id?: undefined;
535
833
  page?: undefined;
834
+ backend?: undefined;
835
+ history?: undefined;
836
+ meeting: {
837
+ type: string;
838
+ minimum: number;
839
+ };
840
+ account_id: {
841
+ type: string;
842
+ minimum: number;
843
+ };
844
+ format?: undefined;
845
+ transcript_id?: undefined;
846
+ query?: undefined;
847
+ limit?: undefined;
848
+ scan_limit?: undefined;
849
+ max_read_bytes?: undefined;
850
+ cursor?: undefined;
851
+ } | {
852
+ event_id?: undefined;
853
+ series_id?: undefined;
854
+ page?: undefined;
855
+ backend?: undefined;
536
856
  history?: undefined;
537
857
  meeting: {
538
858
  type: string;
@@ -559,6 +879,7 @@ export declare const meetingTools: ({
559
879
  event_id?: undefined;
560
880
  series_id?: undefined;
561
881
  page?: undefined;
882
+ backend?: undefined;
562
883
  history?: undefined;
563
884
  meeting?: undefined;
564
885
  format?: undefined;
@@ -630,6 +951,11 @@ export declare const meetingTools: ({
630
951
  type: string;
631
952
  minimum: number;
632
953
  };
954
+ backend: {
955
+ type: string;
956
+ enum: ("archive" | "both" | "server")[];
957
+ description: string;
958
+ };
633
959
  history?: undefined;
634
960
  meeting?: undefined;
635
961
  format?: undefined;
@@ -649,6 +975,11 @@ export declare const meetingTools: ({
649
975
  type: string;
650
976
  minimum: number;
651
977
  };
978
+ backend: {
979
+ type: string;
980
+ enum: ("archive" | "both" | "server")[];
981
+ description: string;
982
+ };
652
983
  history?: undefined;
653
984
  format?: undefined;
654
985
  transcript_id?: undefined;
@@ -661,6 +992,7 @@ export declare const meetingTools: ({
661
992
  event_id?: undefined;
662
993
  series_id?: undefined;
663
994
  page?: undefined;
995
+ backend?: undefined;
664
996
  meeting: {
665
997
  type: string;
666
998
  minimum: number;
@@ -683,6 +1015,28 @@ export declare const meetingTools: ({
683
1015
  event_id?: undefined;
684
1016
  series_id?: undefined;
685
1017
  page?: undefined;
1018
+ backend?: undefined;
1019
+ history?: undefined;
1020
+ meeting: {
1021
+ type: string;
1022
+ minimum: number;
1023
+ };
1024
+ account_id: {
1025
+ type: string;
1026
+ minimum: number;
1027
+ };
1028
+ format?: undefined;
1029
+ transcript_id?: undefined;
1030
+ query?: undefined;
1031
+ limit?: undefined;
1032
+ scan_limit?: undefined;
1033
+ max_read_bytes?: undefined;
1034
+ cursor?: undefined;
1035
+ } | {
1036
+ event_id?: undefined;
1037
+ series_id?: undefined;
1038
+ page?: undefined;
1039
+ backend?: undefined;
686
1040
  history?: undefined;
687
1041
  meeting: {
688
1042
  type: string;
@@ -709,6 +1063,7 @@ export declare const meetingTools: ({
709
1063
  event_id?: undefined;
710
1064
  series_id?: undefined;
711
1065
  page?: undefined;
1066
+ backend?: undefined;
712
1067
  history?: undefined;
713
1068
  meeting?: undefined;
714
1069
  format?: undefined;
@@ -751,11 +1106,28 @@ export declare const meetingTools: ({
751
1106
  openWorldHint: boolean;
752
1107
  };
753
1108
  })[];
754
- export declare const callMeetingTool: (store: MeetingStore, name: string, input: unknown, { limit: configured, failure, }: {
1109
+ export declare const callMeetingTool: (store: MeetingStore, name: string, input: unknown, { limit: configured, failure, source, accountId: bound, signal, timezone, now, offline, }: {
755
1110
  /** A list's page without `limit`: the profile's `defaults.limit`, as the messenger MCP lists take it. */
756
1111
  limit: number;
757
1112
  /** The host's error registry (`failureContext`), so its reasons and detail keys survive. */
758
1113
  failure?: FailureContext;
1114
+ /**
1115
+ * The run's meetings service: `meetings_list` and `meeting_show` read it and the store, as `meetings list` and
1116
+ * `show` do. It needs `accountId`.
1117
+ */
1118
+ source?: MeetingSource;
1119
+ /**
1120
+ * The run's account, the one its profile names. Given, every tool reads that account only, and `meetings_list`
1121
+ * and `meeting_show` read the service as well (a source-less host's answer says the service was not asked).
1122
+ */
1123
+ accountId?: number;
1124
+ /** The run's stop signal, handed to the service; a stopped read ends the call instead of answering from the store. */
1125
+ signal?: AbortSignal;
1126
+ /** The owner's zone, in which a list query's dates are read on both sides; the computer's without it. */
1127
+ timezone?: string;
1128
+ now?: number;
1129
+ /** `--offline`: the service is not asked, and the answer says so. */
1130
+ offline?: boolean;
759
1131
  }) => Promise<{
760
1132
  content: {
761
1133
  type: "text";
@@ -1,15 +1,25 @@
1
1
  import { errorObjectOf, mcpErrorResult } from "@wirecat/cli-base";
2
2
  import { exportMeeting } from "../export.js";
3
+ import { BACKENDS } from "../index.js";
3
4
  import { MEETING_QUERY } from "../item.js";
4
- import { MeetingError, meetingDetailsAnswer, meetingPeople, meetingSummaryAnswer, meetingsList, meetingsQuery, meetingTranscriptAnswer, positiveInteger, } from "../reads.js";
5
+ import { meetingShowThrough, meetingsListThrough } from "../read-through.js";
6
+ import { MeetingError, meetingDetailsAnswer, meetingDetailsBody, meetingPeople, meetingSummaryAnswer, meetingsList, meetingsQuery, meetingTranscriptAnswer, positiveInteger, } from "../reads.js";
5
7
  import { agentResult, UNTRUSTED_NEUTRAL } from "./agent-text.js";
6
8
  const integer = { type: "integer", minimum: 1 };
7
9
  const text = { type: "string", minLength: 1 };
10
+ const backend = {
11
+ type: "string",
12
+ enum: [...BACKENDS],
13
+ description: "where to read: the store (archive), the service (server), or both, kept in the store; without it both, and the " +
14
+ "store alone when the service cannot be asked, said in `missing`",
15
+ };
8
16
  export const meetingTools = [
9
17
  {
10
18
  name: "meetings_list",
11
- description: "stored meetings, newest first; `query` narrows them by field:value terms (Lucene: AND OR NOT, [a TO b], > <) " +
12
- `over ${MEETING_QUERY.fields.map((field) => field.name).join(", ")}, e.g. started_at:[2026-10-01 TO 2026-10-31]`,
19
+ description: "meetings, newest first: the service's, kept in the store, and the stored ones, as `backend` says; each item " +
20
+ "says found_in archive, server or both when the service was asked. `query` narrows them by field:value terms " +
21
+ `(Lucene: AND OR NOT, [a TO b], > <) over ${MEETING_QUERY.fields.map((field) => field.name).join(", ")}, ` +
22
+ "e.g. started_at:[2026-10-01 TO 2026-10-31]",
13
23
  properties: {
14
24
  account_id: integer,
15
25
  event_id: integer,
@@ -17,14 +27,17 @@ export const meetingTools = [
17
27
  query: text,
18
28
  limit: integer,
19
29
  page: integer,
30
+ backend,
20
31
  },
21
32
  required: [],
33
+ remote: true,
22
34
  },
23
35
  {
24
36
  name: "meeting_show",
25
- description: "show a stored meeting",
26
- properties: { meeting: integer, account_id: integer },
37
+ description: "show a stored meeting, read again from the service with its people, transcript and documents, as `backend` says",
38
+ properties: { meeting: integer, account_id: integer, backend },
27
39
  required: ["meeting"],
40
+ remote: true,
28
41
  },
29
42
  {
30
43
  name: "meeting_transcript",
@@ -62,11 +75,12 @@ export const meetingTools = [
62
75
  },
63
76
  required: ["query"],
64
77
  },
65
- ].map(({ properties, required, description, ...tool }) => ({
78
+ ].map(({ properties, required, description, remote = false, ...tool }) => ({
66
79
  ...tool,
67
80
  description: `${description}. ${UNTRUSTED_NEUTRAL}`,
68
81
  inputSchema: { type: "object", properties, required, additionalProperties: false },
69
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
82
+ // A read of the service keeps what it returns, as `meetings list` does, which still counts as a read (WC-CMD-17).
83
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: remote },
70
84
  }));
71
85
  const argumentsOf = (name, input) => {
72
86
  const tool = meetingTools.find((t) => t.name === name);
@@ -102,32 +116,78 @@ const argumentsOf = (name, input) => {
102
116
  throw new MeetingError("validation_error", "query must not be empty");
103
117
  else if (key === "cursor" && (typeof value !== "string" || !value))
104
118
  throw new MeetingError("validation_error", "cursor must not be empty");
119
+ else if (key === "backend" && !BACKENDS.includes(value))
120
+ throw new MeetingError("validation_error", "backend must be archive, server or both");
105
121
  }
106
122
  return args;
107
123
  };
108
- export const callMeetingTool = async (store, name, input, { limit: configured, failure = {}, }) => {
124
+ /** The run's account, which the tool caller may name but never change: the service is that account's. */
125
+ const accountOf = (args, bound) => {
126
+ const named = args.account_id;
127
+ if (bound === undefined || named === undefined || named === bound)
128
+ return bound ?? named;
129
+ throw new MeetingError("validation_error", `account_id ${named} is not this run's account; the tools read account ${bound} only`);
130
+ };
131
+ const NO_SERVICE = {
132
+ field: "server",
133
+ why: "this host gives the tool no service to ask — the answer is the store's",
134
+ };
135
+ export const callMeetingTool = async (store, name, input, { limit: configured, failure = {}, source, accountId: bound, signal, timezone, now, offline, }) => {
136
+ const remote = bound !== undefined && (name === "meetings_list" || name === "meeting_show");
109
137
  try {
138
+ if (source && bound === undefined)
139
+ throw new MeetingError("configuration_error", "a meetings service needs the run's account (accountId)");
110
140
  const args = argumentsOf(name, input);
141
+ const accountId = accountOf(args, bound);
111
142
  const filter = {
112
- accountId: args.account_id,
143
+ accountId,
113
144
  eventId: args.event_id,
114
145
  meetingSeriesId: args.series_id,
115
146
  };
147
+ const typed = args.backend;
148
+ if (bound === undefined && typed === "server")
149
+ throw new MeetingError("validation_error", "backend server: this host gives the tool no service to ask");
150
+ const access = {
151
+ ...(typed === undefined ? {} : { backend: typed }),
152
+ ...(offline ? { offline } : {}),
153
+ ...(timezone === undefined ? {} : { timezone }),
154
+ ...(now === undefined ? {} : { now }),
155
+ ...(signal ? { signal } : {}),
156
+ };
157
+ const unasked = bound === undefined && typed === "both" ? { missing: [NO_SERVICE] } : {};
116
158
  let result;
117
159
  switch (name) {
118
160
  case "meetings_list": {
119
161
  const limit = args.limit ?? configured;
120
- result = await meetingsList(store, {
162
+ const listFilter = {
121
163
  ...filter,
122
164
  limit,
123
165
  offset: ((args.page ?? 1) - 1) * limit,
124
166
  query: meetingsQuery(args.query),
125
- });
167
+ };
168
+ if (bound === undefined) {
169
+ result = { ...(await meetingsList(store, listFilter)), ...unasked };
170
+ break;
171
+ }
172
+ // The standard envelope has no place for the counts; what the reader must know is in `missing` and `meta`.
173
+ const { server: _server, ...answer } = await meetingsListThrough(source, store, { ...listFilter, accountId: bound }, access);
174
+ result = answer;
126
175
  break;
127
176
  }
128
- case "meeting_show":
129
- result = await meetingDetailsAnswer(store, args.meeting, filter.accountId);
177
+ case "meeting_show": {
178
+ if (bound === undefined) {
179
+ result = { ...(await meetingDetailsAnswer(store, args.meeting, filter.accountId)), ...unasked };
180
+ break;
181
+ }
182
+ const shown = await meetingShowThrough(source, store, bound, String(args.meeting), access);
183
+ const { item } = await meetingDetailsBody(store, shown.details);
184
+ result = {
185
+ item: shown.foundIn ? { ...item, found_in: shown.foundIn } : item,
186
+ ...(shown.missing ? { missing: shown.missing } : {}),
187
+ ...(shown.meta ? { meta: shown.meta } : {}),
188
+ };
130
189
  break;
190
+ }
131
191
  case "meeting_transcript":
132
192
  result = await meetingTranscriptAnswer(store, args.meeting, filter.accountId, {
133
193
  history: args.history,
@@ -157,7 +217,7 @@ export const callMeetingTool = async (store, name, input, { limit: configured, f
157
217
  });
158
218
  }
159
219
  catch (error) {
160
- const { content, structuredContent } = agentResult(mcpErrorResult(errorObjectOf(error, { ...failure, effects: { remote: "none", local: "read" } })));
220
+ const { content, structuredContent } = agentResult(mcpErrorResult(errorObjectOf(error, { ...failure, effects: { remote: remote ? "read" : "none", local: "read" } })));
161
221
  return { content, structuredContent, isError: true };
162
222
  }
163
223
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.689.0",
3
+ "version": "0.691.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",