@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
@@ -0,0 +1,40 @@
1
+ import type { AccountKey, MessageStore } from "../store/store.js";
2
+ import type { SearchFound, SearchQuery } from "./messages.js";
3
+ import type { MeaningLane } from "./messages-discovery.js";
4
+ import { type SearchAllFound, type SearchAllMessenger, type SearchAllRequest, type SearchedResource } from "./search-all.js";
5
+ /** @deprecated use `SearchedResource` — removed once zoom-cli moves (zoom-cli#344) */
6
+ export type ResourceWithMeetings = SearchedResource;
7
+ /** @deprecated meetings are paged by `offset` — removed once zoom-cli moves (zoom-cli#344) */
8
+ export interface MeetingSearchCursor {
9
+ accountId: number;
10
+ query: string;
11
+ meetingOffset: number;
12
+ hitOffset: number;
13
+ }
14
+ /** @deprecated use `SearchAllRequest` — removed once zoom-cli moves (zoom-cli#344) */
15
+ export interface SearchAllIncludingMeetingsRequest extends SearchAllRequest {
16
+ /** Read only this meeting account, as `scope.meetings`. */
17
+ meetingAccount?: AccountKey;
18
+ /** Ignored: every meeting of an account is read through its search index. */
19
+ maxMeetings?: number | "all";
20
+ /** Ignored: the next page is `offset`. */
21
+ meetingCursor?: MeetingSearchCursor;
22
+ }
23
+ /** @deprecated use `MeetingAccountCoverage` — removed once zoom-cli moves (zoom-cli#344) */
24
+ export interface MeetingSearchCoverage {
25
+ accountId: number;
26
+ by: "word-prefixes";
27
+ meetingsScanned: number;
28
+ complete: boolean;
29
+ nextCursor?: MeetingSearchCursor;
30
+ }
31
+ /**
32
+ * @deprecated use `SearchAllFound` — removed once zoom-cli moves (zoom-cli#344). `meetings` is never set: the index
33
+ * has no bounded scan to report.
34
+ */
35
+ export interface SearchAllIncludingMeetingsFound extends Omit<SearchAllFound, "hasMore" | "meetings"> {
36
+ hasMore: boolean | null;
37
+ meetings?: MeetingSearchCoverage;
38
+ }
39
+ /** @deprecated use `searchAll` with `scope.meetings` — removed once zoom-cli moves (zoom-cli#344) */
40
+ export declare const searchAllIncludingMeetings: (store: MessageStore, account: AccountKey, { meetingAccount, maxMeetings: _maxMeetings, meetingCursor: _meetingCursor, ...request }: SearchAllIncludingMeetingsRequest, messenger?: SearchAllMessenger, searchMessages?: (query: SearchQuery) => Promise<SearchFound>, meaning?: MeaningLane) => Promise<SearchAllIncludingMeetingsFound>;
@@ -0,0 +1,10 @@
1
+ import { searchAll, } from "./search-all.js";
2
+ /** @deprecated use `searchAll` with `scope.meetings` — removed once zoom-cli moves (zoom-cli#344) */
3
+ export const searchAllIncludingMeetings = async (store, account, { meetingAccount, maxMeetings: _maxMeetings, meetingCursor: _meetingCursor, ...request }, messenger = {}, searchMessages, meaning) => {
4
+ const { meetings: _meetings, ...found } = await searchAll(store, account, {
5
+ ...request,
6
+ ...(meetingAccount === undefined ? {} : { scope: { ...request.scope, meetings: [meetingAccount] } }),
7
+ ...(request.only?.includes("meetings") ? { meetingsAsked: true } : {}),
8
+ }, messenger, searchMessages, meaning);
9
+ return found;
10
+ };
@@ -1,10 +1,6 @@
1
- import type { SearchHit } from "../meetings/index.js";
2
- import type { AccountKey, MessageStore } from "../store/store.js";
3
- import type { SearchFound, SearchQuery } from "./messages.js";
4
- import type { MeaningLane } from "./messages-discovery.js";
5
- import { type SearchAllFound, type SearchAllItem, type SearchAllMessenger, type SearchAllRequest, type Skipped } from "./search-all.js";
6
- export declare const RESOURCES_SEARCHED_WITH_MEETINGS: readonly ["messages", "mail", "notes", "events", "crm", "business", "meetings"];
7
- export type ResourceWithMeetings = (typeof RESOURCES_SEARCHED_WITH_MEETINGS)[number];
1
+ import { type SearchHit } from "../meetings/index.js";
2
+ import type { AccountKey, MessageStore, StoredAccount } from "../store/store.js";
3
+ import type { Skipped } from "./search-all.js";
8
4
  export interface MeetingSearchItem {
9
5
  kind: "meeting";
10
6
  /** `meeting:<account id>/<meeting id>`, the reference memo's notes, facts and memories cite as evidence. */
@@ -14,9 +10,11 @@ export interface MeetingSearchItem {
14
10
  accountId: number;
15
11
  title: string | null;
16
12
  timestamp: string | null;
13
+ /** About 240 characters around the match. */
17
14
  text: string;
18
15
  meetingId: number;
19
- scope: SearchHit["scope"];
16
+ /** `title`: the meeting's title holds the words; `id` is then the meeting's. */
17
+ scope: SearchHit["scope"] | "title";
20
18
  id: number;
21
19
  startMs: number | null;
22
20
  /** A transcript hit's cue, `meeting:<account>/<meeting>/<transcript>/<cue>`, which `meetings passage` opens. */
@@ -25,51 +23,51 @@ export interface MeetingSearchItem {
25
23
  language?: string | null;
26
24
  line?: number;
27
25
  linesTotal?: number;
26
+ foundBy: ("title" | "words")[];
27
+ /** `corrected`: a query word matched only a spelling speech recognition may have garbled, listed in `corrections`. */
28
+ match?: "corrected";
29
+ corrections?: {
30
+ from: string;
31
+ to: string[];
32
+ }[];
28
33
  }
29
- export interface MeetingSearchCursor {
30
- accountId: number;
31
- /** The supported query's words, bound to the selected account. */
32
- query: string;
33
- meetingOffset: number;
34
- hitOffset: number;
35
- }
36
- export interface SearchAllIncludingMeetingsRequest extends Omit<SearchAllRequest, "only"> {
37
- only?: readonly ResourceWithMeetings[];
38
- /** Defaults to the caller's selected account; other meeting accounts are explicit. */
39
- meetingAccount?: AccountKey;
40
- /**
41
- * Candidate meetings visited, newest first, not hit rows allocated by the store. Defaults to 100; `all` visits
42
- * every one. Meetings have no search index yet, so each visit is two queries.
43
- */
44
- maxMeetings?: number | "all";
45
- /** Source continuation only: requires only: ["meetings"]. Offsets are not a snapshot. */
46
- meetingCursor?: MeetingSearchCursor;
47
- }
48
- export interface MeetingSearchCoverage {
49
- accountId: number;
50
- by: "word-prefixes";
51
- meetingsScanned: number;
52
- complete: boolean;
53
- nextCursor?: MeetingSearchCursor;
34
+ /** What one meeting account's index could answer. */
35
+ export interface MeetingAccountCoverage {
36
+ provider: string;
37
+ account: string;
38
+ /** `pending`: passages saved since the index was last built are not found yet; `search meetings` builds it. */
39
+ indexing: "ready" | "pending";
40
+ hasMore: boolean;
54
41
  }
55
- export interface SearchAllIncludingMeetingsFound extends Omit<SearchAllFound, "items" | "searched" | "skipped" | "hasMore"> {
56
- items: (SearchAllItem | MeetingSearchItem)[];
57
- /** null means a bounded meeting scan did not prove whether another match exists. */
58
- hasMore: boolean | null;
59
- searched: ResourceWithMeetings[];
60
- skipped: Skipped<ResourceWithMeetings>[];
61
- meetings?: MeetingSearchCoverage;
42
+ export interface MeetingLaneRequest {
43
+ /** The query as `search all` reads it: fields meetings lack are refused, not read as words. */
44
+ text: string;
45
+ exact?: boolean;
46
+ /** `text` is a question's words, any of which finds a passage; a title must hold every one. */
47
+ question?: boolean;
48
+ timezone?: string;
49
+ /** How many hits the merged page needs from this lane. */
50
+ window: number;
51
+ /** The meeting accounts `--source` chose; absent, every one in `scopes`. */
52
+ accounts?: AccountKey[];
53
+ /** The scopes whose meeting accounts are read; absent, the scope of the caller's stored account only. */
54
+ scopes?: readonly StoredAccount["scope"][];
55
+ /** Meetings were asked for by name (`--only meetings`): having none to read is then a skip, not silence. */
56
+ asked?: boolean;
57
+ signal?: AbortSignal;
62
58
  }
63
- /** Opt-in fusion of the existing unified ranking and one explicitly scoped meeting archive. */
64
- export declare const searchAllIncludingMeetings: (store: MessageStore, account: AccountKey, request: SearchAllIncludingMeetingsRequest, messenger?: SearchAllMessenger, searchMessages?: (query: SearchQuery) => Promise<SearchFound>, meaning?: MeaningLane) => Promise<SearchAllIncludingMeetingsFound>;
65
- export interface SearchAllWithMeetingsRequest extends Omit<SearchAllIncludingMeetingsRequest, "meetingAccount"> {
66
- /**
67
- * `--source`: each kind reads the accounts the list names of it and a kind it names none of is skipped.
68
- * Meetings are read only when it names a meeting account; without it they are skipped.
69
- */
70
- source?: string;
59
+ export interface MeetingLaneFound {
60
+ items: MeetingSearchItem[];
61
+ hasMore: boolean;
62
+ read: StoredAccount[];
63
+ skipped: Skipped<"meetings">[];
64
+ coverage: MeetingAccountCoverage[];
71
65
  }
72
- /** Meetings have no index to search every account at once, so they are read only when named. */
73
- export declare const MEETINGS_UNNAMED = "meetings are searched only when --source names a meeting account, zoom or meetings";
74
- /** `search all`: every kind but meetings, unless `--source` names a meeting account. */
75
- export declare const searchAllWithMeetings: (store: MessageStore, account: AccountKey, request: SearchAllWithMeetingsRequest, messenger?: SearchAllMessenger, searchMessages?: (query: SearchQuery) => Promise<SearchFound>, meaning?: MeaningLane) => Promise<SearchAllIncludingMeetingsFound>;
66
+ /** More passages of one meeting would crowd out every other source. */
67
+ export declare const MOST_HITS_PER_MEETING = 3;
68
+ /**
69
+ * Meetings for `search all`, from each meeting account's search index: never refreshed here, since search all only
70
+ * reads. A query meetings cannot answer is refused before any account is read; a failure of one account is that
71
+ * account's skip, and the others still answer.
72
+ */
73
+ export declare const meetingLane: (store: MessageStore, caller: AccountKey, request: MeetingLaneRequest) => Promise<MeetingLaneFound>;