@wirecat/cli-core 0.664.0 → 0.666.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 (47) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/calendar/index.d.ts +1 -1
  3. package/dist/calendar/index.js +1 -1
  4. package/dist/calendar/prepare.d.ts +2 -2
  5. package/dist/calendar/reads.d.ts +5 -5
  6. package/dist/calendar/writes.d.ts +4 -4
  7. package/dist/cli/documents/catalog.d.ts +87 -0
  8. package/dist/cli/documents/catalog.js +246 -0
  9. package/dist/cli/documents/documents.d.ts +32 -0
  10. package/dist/cli/documents/documents.js +76 -0
  11. package/dist/cli/documents/folders.d.ts +22 -0
  12. package/dist/cli/documents/folders.js +45 -0
  13. package/dist/cli/documents/index.d.ts +36 -0
  14. package/dist/cli/documents/index.js +32 -0
  15. package/dist/cli/documents/knowledge.d.ts +36 -0
  16. package/dist/cli/documents/knowledge.js +235 -0
  17. package/dist/cli/documents/mirrors.d.ts +46 -0
  18. package/dist/cli/documents/mirrors.js +198 -0
  19. package/dist/cli/documents/queries.d.ts +120 -0
  20. package/dist/cli/documents/queries.js +156 -0
  21. package/dist/cli/documents/search.d.ts +25 -0
  22. package/dist/cli/documents/search.js +34 -0
  23. package/dist/cli/documents/sync.d.ts +31 -0
  24. package/dist/cli/documents/sync.js +41 -0
  25. package/dist/cli/documents/testing/commands-contract.d.ts +35 -0
  26. package/dist/cli/documents/testing/commands-contract.js +205 -0
  27. package/dist/cli/documents/testing/index.d.ts +3 -0
  28. package/dist/cli/documents/testing/index.js +3 -0
  29. package/dist/cli/documents/testing/source-contract.d.ts +18 -0
  30. package/dist/cli/documents/testing/source-contract.js +112 -0
  31. package/dist/cli/documents/testing/source.d.ts +13 -0
  32. package/dist/cli/documents/testing/source.js +67 -0
  33. package/dist/cli/documents/words.d.ts +87 -0
  34. package/dist/cli/documents/words.js +79 -0
  35. package/dist/entities/listings.d.ts +60 -0
  36. package/dist/entities/listings.js +15 -0
  37. package/dist/errors/reasons.js +15 -2
  38. package/dist/meetings/event-store.d.ts +2 -1
  39. package/dist/meetings/event-store.js +6 -0
  40. package/dist/meetings/index.d.ts +1 -1
  41. package/dist/meetings/index.js +1 -1
  42. package/dist/search/question-plan.d.ts +4 -1
  43. package/dist/search/question-plan.js +5 -2
  44. package/dist/services/listings.js +17 -2
  45. package/dist/store/sqlite/meeting-listing.d.ts +12 -0
  46. package/dist/store/sqlite/meeting-listing.js +20 -5
  47. package/package.json +9 -1
@@ -1,3 +1,9 @@
1
+ /*
2
+ * Calendar words are stored in one neutral spelling, RFC 5545 where it has one, lower case with hyphens. Each
3
+ * adapter translates its provider's words; a provider's own spelling never reaches a column.
4
+ */
5
+ /** RFC 5545 PARTSTAT: a participant's answer, and the owner's own. */
6
+ export const PARTICIPANT_RESPONSES = ["needs-action", "accepted", "tentative", "declined", "delegated"];
1
7
  const UNTIL = /(?:^|;)UNTIL=(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})Z?)?(?:;|$)/iu;
2
8
  /** The last moment a series can have a slot, when its rule says; a COUNT rule or none repeats as far as this knows. */
3
9
  const seriesEnd = (entry) => {
@@ -9,7 +9,7 @@ export type { MeetingContextStore, MeetingEventLinkInput, MeetingEventLinkReceip
9
9
  export { type MeetingCueIdentity, meetingCueFingerprint } from "./cue-fingerprint.js";
10
10
  export { EVENT_QUERY } from "./event-query.js";
11
11
  export type { CalendarAccessRole, CalendarInput, EntryAttachment, EntryAttachmentInput, EntryEventType, EntryInput, EntryKind, EntryParticipantInput, EntryRevision, EntryStatus, EntryTransparency, EntryVisibility, EventChange, EventDetails, EventFilter, EventStore, LinkReview, ParticipantResponse, ReviewDecision, SeriesSlots, StoredCalendar, StoredEntry, StoredParticipant, } from "./event-store.js";
12
- export { entryInWindow, eventChange } from "./event-store.js";
12
+ export { entryInWindow, eventChange, PARTICIPANT_RESPONSES } from "./event-store.js";
13
13
  export { linkEvent } from "./events.js";
14
14
  export { exportMeeting, type MeetingExport, type MeetingExportFormat, type MeetingExportOptions, serializeVtt, } from "./export.js";
15
15
  export { type FindingEvidence, type FindingOutcome, findingHash, MEETING_FINDINGS_KIND, type MeetingFactFinding, type MeetingFinding, type MeetingFindingsInput, type MeetingFindingsReceipt, type MeetingTaskFinding, meetingFindingFingerprint, validateMeetingFindings, } from "./findings.js";
@@ -6,7 +6,7 @@ export { aggregateCallStats, CALLBACK_WITHIN_MS, SHORT_CALL_UNDER_MS, } from "./
6
6
  export { CALL_DIRECTIONS, CALL_OUTCOMES, callOf, MISSED_OUTCOMES, } from "./calls.js";
7
7
  export { meetingCueFingerprint } from "./cue-fingerprint.js";
8
8
  export { EVENT_QUERY } from "./event-query.js";
9
- export { entryInWindow, eventChange } from "./event-store.js";
9
+ export { entryInWindow, eventChange, PARTICIPANT_RESPONSES } from "./event-store.js";
10
10
  export { linkEvent } from "./events.js";
11
11
  export { exportMeeting, serializeVtt, } from "./export.js";
12
12
  export { findingHash, MEETING_FINDINGS_KIND, meetingFindingFingerprint, validateMeetingFindings, } from "./findings.js";
@@ -1,5 +1,8 @@
1
1
  export declare const words: (text: string) => RegExpMatchArray | [];
2
- /** `альфа-банк` also as `альфабанк`: people write one name both ways, and the index keeps each as typed. */
2
+ /**
3
+ * `альфа-банк` also as `альфабанк`: people write one name both ways, and the index keeps each as typed. Only letters
4
+ * on both sides of a hyphen, and never a field's value: `date:2026-10-08` is no word.
5
+ */
3
6
  export declare const joinedHyphens: (text: string) => string[];
4
7
  /** Words that carry no topic of their own: widening one to a prefix (`про*`) finds only noise. */
5
8
  export declare const isFunctionWord: (word: string) => boolean;
@@ -3,8 +3,11 @@ import { implicitTextTerms, parseLucene, walkQuery } from "@wirecat/cli-base/que
3
3
  import { normalize } from "../store/normalize.js";
4
4
  import { MESSAGE_PARSING } from "./lucene/types.js";
5
5
  export const words = (text) => normalize(text).match(/[\p{L}\p{N}]+/gu) ?? [];
6
- /** `альфа-банк` also as `альфабанк`: people write one name both ways, and the index keeps each as typed. */
7
- export const joinedHyphens = (text) => (normalize(text).match(/[\p{L}\p{N}]+(?:-[\p{L}\p{N}]+)+/gu) ?? []).map((word) => word.replaceAll("-", ""));
6
+ /**
7
+ * `альфа-банк` also as `альфабанк`: people write one name both ways, and the index keeps each as typed. Only letters
8
+ * on both sides of a hyphen, and never a field's value: `date:2026-10-08` is no word.
9
+ */
10
+ export const joinedHyphens = (text) => (normalize(text).match(/(?<![:\p{L}\p{N}-])\p{L}[\p{L}\p{N}]*(?:-\p{L}[\p{L}\p{N}]*)+/gu) ?? []).map((word) => word.replaceAll("-", ""));
8
11
  const scaffolding = new Set(words("what which how many much who where when is are was were do does did can could should we the a an for of to under from in on at has have сколько какой какая какие какое кто кому кем где когда как что во по на в к с у через ли должен должна нужно идёт идет можно может могут"));
9
12
  const questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
10
13
  const QUESTION_STARTS = new Set(words("what which how who whom whose where when why can could should would did do does is are was were will " +
@@ -1,11 +1,13 @@
1
1
  import { CliError } from "@wirecat/cli-base";
2
- import { eventIdOf } from "../calendar/index.js";
2
+ import { eventIdOf, ruleLine } from "../calendar/index.js";
3
3
  import { providerLabel } from "../domain/providers.js";
4
4
  import { formatMeetingReference, parseMeetingReference } from "../meetings/index.js";
5
5
  import { TOTAL_CAP } from "../search/total.js";
6
6
  import { storeQuery } from "./notes-search.js";
7
7
  /** How many documents a text term may match before the list counts them as "at least". */
8
8
  export const DOCUMENT_TEXT_CANDIDATES = 2_000;
9
+ /** A page link a caller may open: `https` only, so a stored `javascript:` or `file:` link never reaches a button. */
10
+ const webUrl = (url) => (url !== null && /^https:\/\//iu.test(url) ? url : null);
9
11
  const iso = (ms) => (ms === null ? null : new Date(ms).toISOString());
10
12
  const sourceName = ({ provider, account }) => `${provider}:${account}`;
11
13
  const sourceOf = (account) => ({
@@ -156,6 +158,9 @@ const meetingItem = (row, accounts) => {
156
158
  via: source.via,
157
159
  calendar: source.calendar,
158
160
  ref: source.ref,
161
+ page_url: webUrl(source.pageUrl),
162
+ own_response: source.ownResponse,
163
+ conference: source.conference,
159
164
  })),
160
165
  meetings,
161
166
  participants: row.participants,
@@ -164,8 +169,10 @@ const meetingItem = (row, accounts) => {
164
169
  has_transcript: row.hasTranscript,
165
170
  has_summary: row.hasSummary,
166
171
  documents: row.documents,
172
+ series_id: row.seriesId === null ? null : String(row.seriesId),
173
+ recurrence: ruleLine(row.recurrence ?? []) ?? null,
167
174
  pending_findings: row.pendingFindings,
168
- untrusted: ["title", "participants.name", "sources.calendar", "documents.title"],
175
+ untrusted: ["title", "participants.name", "sources.calendar", "sources.conference", "documents.title"],
169
176
  };
170
177
  };
171
178
  const personIdOf = (value) => {
@@ -231,6 +238,7 @@ export const showMeetingEntry = async (store, reference, lines) => {
231
238
  details.push(one);
232
239
  }
233
240
  const live = event?.entries.find(({ deletedAt }) => deletedAt === null) ?? event?.entries[0];
241
+ const files = new Map((event?.attachments ?? []).map((one) => [one.fileId, one]));
234
242
  const first = details[0]?.meeting;
235
243
  const spoken = details.flatMap((one) => one.transcripts
236
244
  .filter(({ transcript }) => transcript.deletedAt === null && transcript.supersededAt === null)
@@ -240,6 +248,11 @@ export const showMeetingEntry = async (store, reference, lines) => {
240
248
  ...meetingItem(row, byName),
241
249
  description: live?.description ?? event?.event.description ?? first?.description ?? null,
242
250
  location: live?.location ?? event?.event.location ?? first?.location ?? null,
251
+ attachments: [...files.values()].map(({ fileId, title, documentId }) => ({
252
+ file_id: fileId,
253
+ title,
254
+ document: documentId === null ? null : `document:${documentId}`,
255
+ })),
243
256
  summaries: details.flatMap((one) => one.summaries.map((summary) => ({
244
257
  meeting: ref(one.meeting),
245
258
  source: summary.source,
@@ -277,7 +290,9 @@ export const showMeetingEntry = async (store, reference, lines) => {
277
290
  "location",
278
291
  "participants.name",
279
292
  "sources.calendar",
293
+ "sources.conference",
280
294
  "documents.title",
295
+ "attachments.title",
281
296
  "summaries",
282
297
  "transcript.lines.speaker",
283
298
  "transcript.lines.text",
@@ -1,3 +1,4 @@
1
+ import { type ParticipantResponse } from "../../meetings/index.js";
1
2
  import type { StoreContext } from "./open.js";
2
3
  export declare const MEETING_ROW_KINDS: readonly ["meeting", "call", "event"];
3
4
  export type MeetingRowKind = (typeof MEETING_ROW_KINDS)[number];
@@ -30,6 +31,12 @@ export interface MeetingRowSource {
30
31
  calendar: string | null;
31
32
  /** `meeting:<account>/<id>` for a meeting, `event:<id>` for a calendar copy. */
32
33
  ref: string;
34
+ /** A calendar copy's own page at its provider (Google's `htmlLink`). */
35
+ pageUrl: string | null;
36
+ /** How the calendar's owner answered the invitation. */
37
+ ownResponse: ParticipantResponse | null;
38
+ /** The conference's product, as the calendar names it (`Google Meet`, `Zoom Meeting`). */
39
+ conference: string | null;
33
40
  }
34
41
  export interface MeetingRowParticipant {
35
42
  name: string | null;
@@ -40,6 +47,8 @@ export interface MeetingRowParticipant {
40
47
  name: string | null;
41
48
  } | null;
42
49
  organizer: boolean;
50
+ /** The answer to a calendar's invitation; `null` for a meeting's participant, who was not asked. */
51
+ response: ParticipantResponse | null;
43
52
  }
44
53
  export interface MeetingRowDocument {
45
54
  ref: string;
@@ -73,6 +82,9 @@ export interface MeetingRow {
73
82
  hasTranscript: boolean;
74
83
  hasSummary: boolean;
75
84
  documents: MeetingRowDocument[];
85
+ /** The calendar series the event is an occurrence of, and that series' RFC 5545 lines. */
86
+ seriesId: number | null;
87
+ recurrence: string[] | null;
76
88
  /** Findings in batches still waiting for the owner that cite one of the row's meetings. */
77
89
  pendingFindings: number;
78
90
  /** Every findings batch citing one of its meetings, newest first, with how many of its findings do. */
@@ -210,11 +210,16 @@ const hydrate = (database, page) => {
210
210
  .all(ids(eventIds))
211
211
  .map((row) => [Number(row.id), row]));
212
212
  const entries = database
213
- .prepare(`SELECT ce.id, ce.event_id, ce.join_url, ce.timezone, ce.status, ce.deleted_at, ce.event_type,
214
- c.title AS calendar, a.provider, a.external_id AS account FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id
213
+ .prepare(`SELECT ce.id, ce.event_id, ce.join_url, ce.timezone, ce.status, ce.deleted_at, ce.event_type, ce.url,
214
+ ce.own_response, ce.conference, c.title AS calendar, a.provider, a.external_id AS account FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id
215
215
  JOIN accounts a ON a.id = c.account_id WHERE ce.event_id IN (SELECT value FROM json_each(?))
216
216
  ORDER BY ce.deleted_at IS NOT NULL, ce.id`)
217
217
  .all(ids(eventIds));
218
+ const series = new Map(database
219
+ .prepare("SELECT id, recurrence FROM event_series WHERE id IN (SELECT event_series_id FROM events " +
220
+ "WHERE id IN (SELECT value FROM json_each(?)))")
221
+ .all(ids(eventIds))
222
+ .map((row) => [Number(row.id), row.recurrence == null ? null : JSON.parse(String(row.recurrence))]));
218
223
  const meetings = new Map(database
219
224
  .prepare(`SELECT m.*, a.provider, a.external_id AS account,
220
225
  EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
@@ -228,17 +233,18 @@ const hydrate = (database, page) => {
228
233
  .all(ids(meetingIds))
229
234
  .map((row) => [Number(row.id), row]));
230
235
  const people = database
231
- .prepare(`SELECT 'event' AS type, ce.event_id AS owner, p.name, p.email, p.organizer, l.person_id, pn.name AS person_name
236
+ .prepare(`SELECT 'event' AS type, ce.event_id AS owner, p.name, p.email, p.organizer, l.person_id, pn.name AS person_name,
237
+ p.response
232
238
  FROM calendar_entries ce JOIN calendar_entry_participants p ON p.entry_id = ce.id
233
239
  LEFT JOIN identity_links l ON l.identity_id = p.identity_id LEFT JOIN persons pn ON pn.id = l.person_id
234
240
  WHERE ce.event_id IN (SELECT value FROM json_each(?)) AND ce.deleted_at IS NULL AND p.resource = 0
235
241
  UNION ALL
236
- SELECT 'meeting', mp.meeting_id, mp.display_name, mp.email, mp.role = 'host', l.person_id, pn.name
242
+ SELECT 'meeting', mp.meeting_id, mp.display_name, mp.email, mp.role = 'host', l.person_id, pn.name, NULL
237
243
  FROM meeting_participants mp LEFT JOIN identity_links l ON l.identity_id = mp.identity_id
238
244
  LEFT JOIN persons pn ON pn.id = l.person_id
239
245
  WHERE mp.meeting_id IN (SELECT value FROM json_each(?))
240
246
  UNION ALL
241
- SELECT 'event', cl.from_id, pe.name, NULL, 0, cl.to_id, pe.name FROM links cl JOIN persons pe ON pe.id = cl.to_id
247
+ SELECT 'event', cl.from_id, pe.name, NULL, 0, cl.to_id, pe.name, NULL FROM links cl JOIN persons pe ON pe.id = cl.to_id
242
248
  WHERE cl.from_type = 'event' AND cl.from_id IN (SELECT value FROM json_each(?)) AND cl.to_type = 'person'
243
249
  AND cl.kind = ${linkKind("related-to")} AND cl.role = '${COUNTERPART_ROLE}'`)
244
250
  .all(ids(eventIds), ids(meetingIds), ids(eventIds));
@@ -271,6 +277,9 @@ const hydrate = (database, page) => {
271
277
  via: "calendar",
272
278
  calendar: str(entry.calendar),
273
279
  ref: `event:${id}`,
280
+ pageUrl: str(entry.url),
281
+ ownResponse: str(entry.own_response),
282
+ conference: str(entry.conference),
274
283
  })),
275
284
  ...held.map((meeting) => ({
276
285
  provider: String(meeting.provider),
@@ -282,6 +291,9 @@ const hydrate = (database, page) => {
282
291
  accountId: Number(meeting.account_id),
283
292
  meetingId: Number(meeting.id),
284
293
  }),
294
+ pageUrl: null,
295
+ ownResponse: null,
296
+ conference: null,
285
297
  })),
286
298
  ].filter((source, index, all) => all.findIndex((other) => other.provider === source.provider &&
287
299
  other.account === source.account &&
@@ -302,6 +314,7 @@ const hydrate = (database, page) => {
302
314
  email: held?.email ?? email,
303
315
  person: ref === null ? null : { ref, name: str(person.person_name) },
304
316
  organizer: (held?.organizer ?? false) || Number(person.organizer) === 1,
317
+ response: held?.response ?? str(person.response),
305
318
  });
306
319
  }
307
320
  const linked = new Map();
@@ -348,6 +361,8 @@ const hydrate = (database, page) => {
348
361
  hasTranscript: held.some((meeting) => Number(meeting.has_transcript) === 1),
349
362
  hasSummary: held.some((meeting) => Number(meeting.has_summary) === 1),
350
363
  documents: [...linked.values()],
364
+ seriesId: num(event?.event_series_id),
365
+ recurrence: event?.event_series_id == null ? null : (series.get(Number(event.event_series_id)) ?? null),
351
366
  pendingFindings: batches.reduce((sum, { pending }) => sum + countOf(pending), 0),
352
367
  findings: batches.flatMap(({ id, status, cited, pending }) => {
353
368
  const findings = countOf(cited);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.664.0",
3
+ "version": "0.666.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",
@@ -42,6 +42,14 @@
42
42
  "types": "./dist/documents.d.ts",
43
43
  "default": "./dist/documents.js"
44
44
  },
45
+ "./documents/cli": {
46
+ "types": "./dist/cli/documents/index.d.ts",
47
+ "default": "./dist/cli/documents/index.js"
48
+ },
49
+ "./documents/testing": {
50
+ "types": "./dist/cli/documents/testing/index.d.ts",
51
+ "default": "./dist/cli/documents/testing/index.js"
52
+ },
45
53
  ".": {
46
54
  "types": "./dist/index.d.ts",
47
55
  "default": "./dist/index.js"