@wirecat/cli-core 0.657.0 → 0.658.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.
@@ -0,0 +1,154 @@
1
+ import * as v from "valibot";
2
+ import { DOCUMENT_KINDS } from "../store/sqlite/document-listing.js";
3
+ import { MEETING_ROW_KINDS } from "../store/sqlite/meeting-listing.js";
4
+ import { count, id, reference, text, time, untrusted } from "./fields.js";
5
+ /** The account a document or a meeting came from, as `provider:account` names it and as a person reads it. */
6
+ const source = v.strictObject({
7
+ provider: text,
8
+ account: text,
9
+ /** `provider:account`: what a list's `source:` term takes. */
10
+ source: text,
11
+ label: text,
12
+ });
13
+ const person = v.strictObject({ ref: reference, name: v.nullable(text), kind: text });
14
+ /** One document of any account: a Drive file, a notes folder's file, an added source, an import's document. */
15
+ export const documentEntry = v.strictObject({
16
+ ref: reference,
17
+ id,
18
+ title: v.nullable(text),
19
+ file_name: v.nullable(text),
20
+ kind: v.picklist(DOCUMENT_KINDS),
21
+ mime: v.nullable(text),
22
+ size: v.nullable(count),
23
+ source,
24
+ /** The folder it is in, inside its account; `null` at the top or where the source keeps no folders. */
25
+ folder: v.nullable(text),
26
+ path: v.nullable(text),
27
+ /** Where it opens: its page at the source. */
28
+ url: v.nullable(text),
29
+ /** Where it opens on this computer: a notes folder's file or the copy kept of an added file. */
30
+ local_path: v.nullable(text),
31
+ /** When its source last changed it. */
32
+ source_modified_at: v.nullable(time),
33
+ /** When the store last wrote its copy. */
34
+ stored_at: time,
35
+ has_text: v.boolean(),
36
+ untrusted,
37
+ });
38
+ const linked = v.strictObject({ ref: reference, title: v.nullable(text), at: v.nullable(time), role: v.nullable(text) });
39
+ /** One document with a part of its text, its tags, the people it names and the meetings it belongs to. */
40
+ export const documentEntryDetails = v.strictObject({
41
+ ...documentEntry.entries,
42
+ text: v.nullable(text),
43
+ /** Where `text` starts in the whole text, in characters. */
44
+ text_offset: count,
45
+ /** The whole text's length, in characters. */
46
+ text_length: count,
47
+ /** More text follows `text`: read it with a larger offset. */
48
+ has_more: v.boolean(),
49
+ extraction: v.nullable(text),
50
+ extraction_error: v.nullable(text),
51
+ language: v.nullable(text),
52
+ tags: v.array(text),
53
+ people: v.array(person),
54
+ meetings: v.array(linked),
55
+ events: v.array(linked),
56
+ });
57
+ /** One account holding documents, with its folders and how many documents each holds. */
58
+ export const documentSource = v.strictObject({
59
+ ...source.entries,
60
+ name: v.nullable(text),
61
+ count,
62
+ /** Documents at the top of the account, in no folder. */
63
+ loose: count,
64
+ /** Every folder down to the depth asked, parents before children; `count` takes in the folders under it. */
65
+ folders: v.array(v.strictObject({ path: text, name: text, depth: count, count })),
66
+ });
67
+ /** The person the store links a name or address to, as `meetings participants` gives it. */
68
+ const personLink = v.strictObject({ ref: reference, name: v.nullable(text) });
69
+ const participant = v.strictObject({
70
+ name: v.nullable(text),
71
+ email: v.nullable(text),
72
+ person: v.nullable(personLink),
73
+ organizer: v.boolean(),
74
+ });
75
+ /** One real meeting, call or calendar event: a calendar's event and its Zoom or Meet record are one row. */
76
+ export const meetingEntry = v.strictObject({
77
+ /** `event:<id>` when a calendar or a meeting service's record made an event of it, else `meeting:<account>/<id>`. */
78
+ ref: reference,
79
+ kind: v.picklist(MEETING_ROW_KINDS),
80
+ title: v.nullable(text),
81
+ started_at: v.nullable(time),
82
+ ended_at: v.nullable(time),
83
+ duration_ms: v.nullable(count),
84
+ all_day: v.boolean(),
85
+ /** The zone its calendar or meeting service gave it, which may differ from the computer's. */
86
+ timezone: v.nullable(text),
87
+ status: v.nullable(text),
88
+ /** The link that joins it: a calendar copy's, else its first meeting's. */
89
+ url: v.nullable(text),
90
+ /** Every distinct join link, with the source that gave it, so each opens in its own app. */
91
+ links: v.array(v.strictObject({ source: text, url: text })),
92
+ sources: v.array(v.strictObject({
93
+ ...source.entries,
94
+ via: v.picklist(["calendar", "meeting"]),
95
+ calendar: v.nullable(text),
96
+ ref: reference,
97
+ })),
98
+ /** The meeting records on this row, `meeting:<account>/<id>`. */
99
+ meetings: v.array(reference),
100
+ participants: v.array(participant),
101
+ participants_count: count,
102
+ has_recording: v.boolean(),
103
+ has_transcript: v.boolean(),
104
+ has_summary: v.boolean(),
105
+ documents: v.array(v.strictObject({ ref: reference, title: v.nullable(text), role: v.nullable(text) })),
106
+ /** Findings waiting for the owner (`meetings actions`) that cite one of its meetings. */
107
+ pending_findings: count,
108
+ untrusted,
109
+ });
110
+ /** One meeting row with its transcript lines, summaries, findings batches and the calendar's text. */
111
+ export const meetingEntryDetails = v.strictObject({
112
+ ...meetingEntry.entries,
113
+ description: v.nullable(text),
114
+ location: v.nullable(text),
115
+ summaries: v.array(v.strictObject({
116
+ meeting: reference,
117
+ source: text,
118
+ title: v.nullable(text),
119
+ overview: v.nullable(text),
120
+ sections: v.array(v.strictObject({ label: text, text })),
121
+ next_steps: v.array(text),
122
+ url: v.nullable(text),
123
+ })),
124
+ transcript: v.nullable(v.strictObject({
125
+ meeting: reference,
126
+ source: text,
127
+ language: v.nullable(text),
128
+ /** Lines from this position, as `--offset` asked. */
129
+ offset: count,
130
+ total: count,
131
+ has_more: v.boolean(),
132
+ lines: v.array(v.strictObject({
133
+ position: count,
134
+ offset_ms: count,
135
+ end_ms: count,
136
+ speaker: v.nullable(text),
137
+ person: v.nullable(personLink),
138
+ text,
139
+ })),
140
+ })),
141
+ /** `findings` cite the row's meetings; `pending` of them wait for the owner's decision. */
142
+ findings: v.array(v.strictObject({ id, status: v.picklist(["proposed", "reviewed"]), findings: count, pending: count })),
143
+ });
144
+ /**
145
+ * The listings' answers by entity name. Not in `ENTITIES`: that registry's inferred type is at the compiler's size
146
+ * limit, so a CLI registers these as its own (memo's `entityFields`).
147
+ */
148
+ export const LISTING_ENTITIES = {
149
+ document_entry: documentEntry,
150
+ document_entry_details: documentEntryDetails,
151
+ document_source: documentSource,
152
+ meeting_entry: meetingEntry,
153
+ meeting_entry_details: meetingEntryDetails,
154
+ };
@@ -154,6 +154,10 @@ const OTHERS = [
154
154
  validation("agent.cost-unknown", "the agent reports no cost, so a cost cap cannot stop it"),
155
155
  validation("document.changed", "the document changed while it was read; nothing was saved"),
156
156
  ["document.not-imported", "not_found", "the document is not imported in this source account"],
157
+ ["document.not-found", "not_found", "no listed document has that reference"],
158
+ ["meeting.not-found", "not_found", "no meeting row has that event or meeting reference"],
159
+ ["listing.source-not-found", "not_found", "a source: term names no account holding what is listed"],
160
+ validation("query.empty-window", "the time window ends before it starts, so no row can fall in it"),
157
161
  ["extraction.invalid-proposals", "invalid_response", "the model's memory proposals could not be used"],
158
162
  validation("extraction.text-too-long", "the text is too long for memory extraction"),
159
163
  validation("file.locked", "another process holds the file's lock"),
@@ -38,6 +38,7 @@ export declare const meetingTools: ({
38
38
  max_read_bytes?: undefined;
39
39
  cursor?: undefined;
40
40
  } | {
41
+ limit?: undefined;
41
42
  event_id?: undefined;
42
43
  series_id?: undefined;
43
44
  page?: undefined;
@@ -53,11 +54,11 @@ export declare const meetingTools: ({
53
54
  format?: undefined;
54
55
  transcript_id?: undefined;
55
56
  query?: undefined;
56
- limit?: undefined;
57
57
  scan_limit?: undefined;
58
58
  max_read_bytes?: undefined;
59
59
  cursor?: undefined;
60
60
  } | {
61
+ limit?: undefined;
61
62
  event_id?: undefined;
62
63
  series_id?: undefined;
63
64
  page?: undefined;
@@ -75,11 +76,11 @@ export declare const meetingTools: ({
75
76
  format?: undefined;
76
77
  transcript_id?: undefined;
77
78
  query?: undefined;
78
- limit?: undefined;
79
79
  scan_limit?: undefined;
80
80
  max_read_bytes?: undefined;
81
81
  cursor?: undefined;
82
82
  } | {
83
+ limit?: undefined;
83
84
  event_id?: undefined;
84
85
  series_id?: undefined;
85
86
  page?: undefined;
@@ -101,7 +102,6 @@ export declare const meetingTools: ({
101
102
  minimum: number;
102
103
  };
103
104
  query?: undefined;
104
- limit?: undefined;
105
105
  scan_limit?: undefined;
106
106
  max_read_bytes?: undefined;
107
107
  cursor?: undefined;
@@ -188,6 +188,7 @@ export declare const meetingTools: ({
188
188
  max_read_bytes?: undefined;
189
189
  cursor?: undefined;
190
190
  } | {
191
+ limit?: undefined;
191
192
  event_id?: undefined;
192
193
  series_id?: undefined;
193
194
  page?: undefined;
@@ -203,11 +204,11 @@ export declare const meetingTools: ({
203
204
  format?: undefined;
204
205
  transcript_id?: undefined;
205
206
  query?: undefined;
206
- limit?: undefined;
207
207
  scan_limit?: undefined;
208
208
  max_read_bytes?: undefined;
209
209
  cursor?: undefined;
210
210
  } | {
211
+ limit?: undefined;
211
212
  event_id?: undefined;
212
213
  series_id?: undefined;
213
214
  page?: undefined;
@@ -225,11 +226,11 @@ export declare const meetingTools: ({
225
226
  format?: undefined;
226
227
  transcript_id?: undefined;
227
228
  query?: undefined;
228
- limit?: undefined;
229
229
  scan_limit?: undefined;
230
230
  max_read_bytes?: undefined;
231
231
  cursor?: undefined;
232
232
  } | {
233
+ limit?: undefined;
233
234
  event_id?: undefined;
234
235
  series_id?: undefined;
235
236
  page?: undefined;
@@ -251,7 +252,6 @@ export declare const meetingTools: ({
251
252
  minimum: number;
252
253
  };
253
254
  query?: undefined;
254
- limit?: undefined;
255
255
  scan_limit?: undefined;
256
256
  max_read_bytes?: undefined;
257
257
  cursor?: undefined;
@@ -338,6 +338,7 @@ export declare const meetingTools: ({
338
338
  max_read_bytes?: undefined;
339
339
  cursor?: undefined;
340
340
  } | {
341
+ limit?: undefined;
341
342
  event_id?: undefined;
342
343
  series_id?: undefined;
343
344
  page?: undefined;
@@ -353,11 +354,11 @@ export declare const meetingTools: ({
353
354
  format?: undefined;
354
355
  transcript_id?: undefined;
355
356
  query?: undefined;
356
- limit?: undefined;
357
357
  scan_limit?: undefined;
358
358
  max_read_bytes?: undefined;
359
359
  cursor?: undefined;
360
360
  } | {
361
+ limit?: undefined;
361
362
  event_id?: undefined;
362
363
  series_id?: undefined;
363
364
  page?: undefined;
@@ -375,11 +376,11 @@ export declare const meetingTools: ({
375
376
  format?: undefined;
376
377
  transcript_id?: undefined;
377
378
  query?: undefined;
378
- limit?: undefined;
379
379
  scan_limit?: undefined;
380
380
  max_read_bytes?: undefined;
381
381
  cursor?: undefined;
382
382
  } | {
383
+ limit?: undefined;
383
384
  event_id?: undefined;
384
385
  series_id?: undefined;
385
386
  page?: undefined;
@@ -401,7 +402,6 @@ export declare const meetingTools: ({
401
402
  minimum: number;
402
403
  };
403
404
  query?: undefined;
404
- limit?: undefined;
405
405
  scan_limit?: undefined;
406
406
  max_read_bytes?: undefined;
407
407
  cursor?: undefined;
@@ -488,6 +488,7 @@ export declare const meetingTools: ({
488
488
  max_read_bytes?: undefined;
489
489
  cursor?: undefined;
490
490
  } | {
491
+ limit?: undefined;
491
492
  event_id?: undefined;
492
493
  series_id?: undefined;
493
494
  page?: undefined;
@@ -503,11 +504,11 @@ export declare const meetingTools: ({
503
504
  format?: undefined;
504
505
  transcript_id?: undefined;
505
506
  query?: undefined;
506
- limit?: undefined;
507
507
  scan_limit?: undefined;
508
508
  max_read_bytes?: undefined;
509
509
  cursor?: undefined;
510
510
  } | {
511
+ limit?: undefined;
511
512
  event_id?: undefined;
512
513
  series_id?: undefined;
513
514
  page?: undefined;
@@ -525,11 +526,11 @@ export declare const meetingTools: ({
525
526
  format?: undefined;
526
527
  transcript_id?: undefined;
527
528
  query?: undefined;
528
- limit?: undefined;
529
529
  scan_limit?: undefined;
530
530
  max_read_bytes?: undefined;
531
531
  cursor?: undefined;
532
532
  } | {
533
+ limit?: undefined;
533
534
  event_id?: undefined;
534
535
  series_id?: undefined;
535
536
  page?: undefined;
@@ -551,7 +552,6 @@ export declare const meetingTools: ({
551
552
  minimum: number;
552
553
  };
553
554
  query?: undefined;
554
- limit?: undefined;
555
555
  scan_limit?: undefined;
556
556
  max_read_bytes?: undefined;
557
557
  cursor?: undefined;
@@ -638,6 +638,7 @@ export declare const meetingTools: ({
638
638
  max_read_bytes?: undefined;
639
639
  cursor?: undefined;
640
640
  } | {
641
+ limit?: undefined;
641
642
  event_id?: undefined;
642
643
  series_id?: undefined;
643
644
  page?: undefined;
@@ -653,11 +654,11 @@ export declare const meetingTools: ({
653
654
  format?: undefined;
654
655
  transcript_id?: undefined;
655
656
  query?: undefined;
656
- limit?: undefined;
657
657
  scan_limit?: undefined;
658
658
  max_read_bytes?: undefined;
659
659
  cursor?: undefined;
660
660
  } | {
661
+ limit?: undefined;
661
662
  event_id?: undefined;
662
663
  series_id?: undefined;
663
664
  page?: undefined;
@@ -675,11 +676,11 @@ export declare const meetingTools: ({
675
676
  format?: undefined;
676
677
  transcript_id?: undefined;
677
678
  query?: undefined;
678
- limit?: undefined;
679
679
  scan_limit?: undefined;
680
680
  max_read_bytes?: undefined;
681
681
  cursor?: undefined;
682
682
  } | {
683
+ limit?: undefined;
683
684
  event_id?: undefined;
684
685
  series_id?: undefined;
685
686
  page?: undefined;
@@ -701,7 +702,6 @@ export declare const meetingTools: ({
701
702
  minimum: number;
702
703
  };
703
704
  query?: undefined;
704
- limit?: undefined;
705
705
  scan_limit?: undefined;
706
706
  max_read_bytes?: undefined;
707
707
  cursor?: undefined;
@@ -184,6 +184,7 @@ export { type DocumentTarget, openPictureEmbedderFor, type PictureOptions, remov
184
184
  export type { ModelChoice } from "./embeddings.js";
185
185
  export { calendarAccounts, type EventsFound, type EventsQuery, type FoundEvent, foundEvent, searchEvents, } from "./events-search.js";
186
186
  export { type GroupGuard, groupGuardOf, lockedRegistry } from "./group-guard.js";
187
+ export { DOCUMENT_TEXT_CANDIDATES, type DocumentEntry, type DocumentEntryDetails, type DocumentListRequest, type DocumentSourceEntry, type Listed, listDocumentSources, listDocuments, listMeetingEntries, type MeetingEntry, type MeetingEntryDetails, type MeetingListRequest, showDocument, showMeetingEntry, } from "./listings.js";
187
188
  export { createMeetingBatchReader } from "./meeting-batch.js";
188
189
  export { type MeetingCombinedHit, type MeetingCombinedRequest, searchMeetingsCombined, } from "./meeting-combined.js";
189
190
  export type { MeetingCommunicationCoverage, MeetingCommunicationExcerpt, MeetingCommunications, MeetingCommunicationsPort, MeetingCommunicationsRequest, } from "./meeting-communications-types.js";
@@ -140,6 +140,7 @@ export { countersService } from "./counters.js";
140
140
  export { openPictureEmbedderFor, removePicture, savePicture, } from "./document-pictures.js";
141
141
  export { calendarAccounts, foundEvent, searchEvents, } from "./events-search.js";
142
142
  export { groupGuardOf, lockedRegistry } from "./group-guard.js";
143
+ export { DOCUMENT_TEXT_CANDIDATES, listDocumentSources, listDocuments, listMeetingEntries, showDocument, showMeetingEntry, } from "./listings.js";
143
144
  export { createMeetingBatchReader } from "./meeting-batch.js";
144
145
  export { searchMeetingsCombined, } from "./meeting-combined.js";
145
146
  export { createMeetingContextService, } from "./meeting-context.js";
@@ -0,0 +1,74 @@
1
+ import type { QueryAst } from "@wirecat/cli-base/query";
2
+ import type * as v from "valibot";
3
+ import type { documentEntry, documentEntryDetails, documentSource, meetingEntry, meetingEntryDetails } from "../entities/listings.js";
4
+ import { type SearchTotal } from "../search/total.js";
5
+ import type { ListedAccount, MeetingRowKind, MessageStore } from "../store/index.js";
6
+ export type DocumentEntry = v.InferOutput<typeof documentEntry>;
7
+ export type DocumentEntryDetails = v.InferOutput<typeof documentEntryDetails>;
8
+ export type DocumentSourceEntry = v.InferOutput<typeof documentSource>;
9
+ export type MeetingEntry = v.InferOutput<typeof meetingEntry>;
10
+ export type MeetingEntryDetails = v.InferOutput<typeof meetingEntryDetails>;
11
+ /** How many documents a text term may match before the list counts them as "at least". */
12
+ export declare const DOCUMENT_TEXT_CANDIDATES = 2000;
13
+ export interface DocumentListRequest {
14
+ /** `source:` terms; every account holding documents when none. */
15
+ sources?: readonly string[];
16
+ /** Words searched as `search notes` searches them, in the document text and titles. */
17
+ text?: string;
18
+ /** The other terms, over the store's document fields (`kind`, `folder`, `source_modified_at`, `tag`, `person`). */
19
+ query?: QueryAst;
20
+ zone?: string;
21
+ now?: number;
22
+ limit: number;
23
+ offset: number;
24
+ }
25
+ export interface Listed<T> {
26
+ items: T[];
27
+ total: SearchTotal;
28
+ /** Every account read, `provider:account`. */
29
+ accounts: string[];
30
+ }
31
+ /** Every document of every account, or of the `source:` accounts, newest change first; a text term ranks nothing. */
32
+ export declare const listDocuments: (store: MessageStore, request: DocumentListRequest) => Promise<Listed<DocumentEntry>>;
33
+ /** The accounts holding documents, each with its folders flattened parents first, for a page's left panel. */
34
+ export declare const listDocumentSources: (store: MessageStore, { sources, depth }: {
35
+ sources?: readonly string[];
36
+ depth: number;
37
+ }) => Promise<DocumentSourceEntry[]>;
38
+ /** One document with `limit` characters of its text from `offset`, its tags, people, meetings and events. */
39
+ export declare const showDocument: (store: MessageStore, reference: string, text: {
40
+ offset: number;
41
+ limit: number;
42
+ }) => Promise<DocumentEntryDetails>;
43
+ export interface MeetingListRequest {
44
+ sources?: readonly string[];
45
+ kinds?: readonly MeetingRowKind[];
46
+ /** `person:<id>`. */
47
+ person?: string;
48
+ hasTranscript?: boolean;
49
+ titleWords?: readonly string[];
50
+ /** Rows that end after this instant; `fromDate` is the same bound as a local day, for all-day events. */
51
+ from?: number;
52
+ to?: number;
53
+ fromDate?: string;
54
+ toDate?: string;
55
+ newest?: boolean;
56
+ limit: number;
57
+ offset: number;
58
+ }
59
+ /**
60
+ * Meetings, calls and calendar events of every account (or the `source:` ones) as one row per real meeting, in a
61
+ * time window. A calendar event and its Zoom or Meet record share a row when the store linked them or their rooms
62
+ * (`join_key`) are the same and their times overlap.
63
+ */
64
+ export declare const listMeetingEntries: (store: MessageStore, request: MeetingListRequest) => Promise<Listed<MeetingEntry> & {
65
+ read: readonly ListedAccount[];
66
+ }>;
67
+ /**
68
+ * One row as `listMeetingEntries` shows it, with the calendar's text, every meeting's summaries, the findings citing
69
+ * them and `limit` transcript lines from `offset` of its first meeting with a transcript.
70
+ */
71
+ export declare const showMeetingEntry: (store: MessageStore, reference: string, lines: {
72
+ offset: number;
73
+ limit: number;
74
+ }) => Promise<MeetingEntryDetails>;