@wirecat/cli-core 0.398.0 → 0.400.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 +106 -0
- package/dist/analysis/consents.d.ts +11 -6
- package/dist/analysis/consents.js +5 -2
- package/dist/cli/analysis-choice.d.ts +1 -0
- package/dist/cli/analysis-choice.js +3 -0
- package/dist/cli/bot/admins.js +14 -4
- package/dist/cli/bot/command.js +38 -16
- package/dist/cli/bot/examples.d.ts +3 -0
- package/dist/cli/bot/examples.js +2 -0
- package/dist/cli/bot/mcp.js +6 -2
- package/dist/cli/bot/messages.js +17 -6
- package/dist/cli/bot/moderation.js +16 -4
- package/dist/cli/bot/people.js +16 -4
- package/dist/cli/bot/setup.js +27 -8
- package/dist/cli/bot/watch.js +7 -1
- package/dist/cli/config-command.js +20 -1
- package/dist/cli/context.d.ts +2 -0
- package/dist/cli/context.js +1 -1
- package/dist/cli/effects.d.ts +4 -1
- package/dist/cli/effects.js +10 -2
- package/dist/cli/embedding-choice.d.ts +2 -1
- package/dist/cli/embedding-choice.js +4 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/json-fields.js +12 -1
- package/dist/cli/messenger/account-command.js +15 -6
- package/dist/cli/messenger/account-profile-query.d.ts +2 -0
- package/dist/cli/messenger/account-profile-query.js +13 -0
- package/dist/cli/messenger/account-sessions-command.js +1 -0
- package/dist/cli/messenger/admin-commands.js +30 -21
- package/dist/cli/messenger/admin-contacts-command.js +6 -3
- package/dist/cli/messenger/admin-folders-command.js +5 -5
- package/dist/cli/messenger/admin-moderation-command.js +4 -4
- package/dist/cli/messenger/admin-statistics-command.js +6 -14
- package/dist/cli/messenger/analysis-consents-query.d.ts +5 -0
- package/dist/cli/messenger/analysis-consents-query.js +20 -0
- package/dist/cli/messenger/archive-commands.js +3 -3
- package/dist/cli/messenger/attachments-command.js +3 -0
- package/dist/cli/messenger/backfill-command.js +5 -4
- package/dist/cli/messenger/catch-up-answers.d.ts +2 -1
- package/dist/cli/messenger/catch-up-answers.js +6 -2
- package/dist/cli/messenger/chat-queries.d.ts +1 -0
- package/dist/cli/messenger/chat-queries.js +12 -2
- package/dist/cli/messenger/chats-command.js +2 -2
- package/dist/cli/messenger/chats-documents-command.js +7 -5
- package/dist/cli/messenger/chats-members-command.js +7 -3
- package/dist/cli/messenger/chats-read-command.js +1 -1
- package/dist/cli/messenger/chats-stats-command.js +1 -1
- package/dist/cli/messenger/chats-tracking-command.js +14 -6
- package/dist/cli/messenger/contacts-command.js +11 -7
- package/dist/cli/messenger/context.d.ts +2 -0
- package/dist/cli/messenger/conversations-command.js +47 -29
- package/dist/cli/messenger/doctor-command.js +5 -1
- package/dist/cli/messenger/document-links-query.d.ts +2 -0
- package/dist/cli/messenger/document-links-query.js +9 -0
- package/dist/cli/messenger/download-command.js +1 -0
- package/dist/cli/messenger/flood-command.d.ts +2 -2
- package/dist/cli/messenger/flood-command.js +3 -3
- package/dist/cli/messenger/gaps-command.js +2 -2
- package/dist/cli/messenger/guard-commands.js +35 -13
- package/dist/cli/messenger/hearing-command.d.ts +1 -1
- package/dist/cli/messenger/hearing-command.js +1 -1
- package/dist/cli/messenger/images-command.js +1 -0
- package/dist/cli/messenger/inbox.js +6 -4
- package/dist/cli/messenger/media-archive-command.js +2 -0
- package/dist/cli/messenger/media-archive-move-command.js +1 -0
- package/dist/cli/messenger/media-archive-timer-command.js +1 -1
- package/dist/cli/messenger/mentions-command.js +15 -2
- package/dist/cli/messenger/messages-command.js +2 -0
- package/dist/cli/messenger/messages-delete-command.js +1 -0
- package/dist/cli/messenger/messages-edit-command.js +1 -0
- package/dist/cli/messenger/messages-evidence-command.js +3 -1
- package/dist/cli/messenger/messages-forward-command.js +1 -0
- package/dist/cli/messenger/messages-pin-command.js +3 -0
- package/dist/cli/messenger/messages-send-command.js +1 -0
- package/dist/cli/messenger/messages-stats-command.js +1 -1
- package/dist/cli/messenger/metadata-command.js +7 -2
- package/dist/cli/messenger/models-command.js +10 -2
- package/dist/cli/messenger/polls-command.js +4 -0
- package/dist/cli/messenger/private-people-command.js +8 -6
- package/dist/cli/messenger/rankings-command.js +6 -11
- package/dist/cli/messenger/reactions-command.js +2 -0
- package/dist/cli/messenger/recipients-query.d.ts +5 -0
- package/dist/cli/messenger/recipients-query.js +18 -0
- package/dist/cli/messenger/records-command.js +13 -6
- package/dist/cli/messenger/replies-edit-command.d.ts +1 -1
- package/dist/cli/messenger/replies-edit-command.js +13 -5
- package/dist/cli/messenger/retention-command.js +1 -1
- package/dist/cli/messenger/review.js +6 -4
- package/dist/cli/messenger/search-command.js +3 -1
- package/dist/cli/messenger/searches-command.js +6 -2
- package/dist/cli/messenger/sends-query.d.ts +5 -0
- package/dist/cli/messenger/sends-query.js +33 -0
- package/dist/cli/messenger/serve-command.js +1 -0
- package/dist/cli/messenger/serve-relay.d.ts +1 -0
- package/dist/cli/messenger/statistics-query.d.ts +14 -0
- package/dist/cli/messenger/statistics-query.js +143 -0
- package/dist/cli/messenger/stats-command.js +6 -6
- package/dist/cli/messenger/store-maintenance-command.d.ts +1 -1
- package/dist/cli/messenger/store-maintenance-command.js +10 -10
- package/dist/cli/messenger/tags-command.js +18 -6
- package/dist/cli/messenger/tasks-command.js +47 -8
- package/dist/cli/messenger/transcribe-command.js +2 -1
- package/dist/cli/messenger/watch-answers.d.ts +6 -0
- package/dist/cli/messenger/watch-answers.js +69 -0
- package/dist/cli/messenger/watch-command.d.ts +1 -1
- package/dist/cli/messenger/watch-command.js +56 -7
- package/dist/cli/program.js +5 -1
- package/dist/cli/runs/command.js +25 -38
- package/dist/cli/runs/query.d.ts +5 -0
- package/dist/cli/runs/query.js +32 -0
- package/dist/cli/runs/search-command.d.ts +4 -0
- package/dist/cli/runs/search-command.js +27 -0
- package/dist/cli/runs/search-query.d.ts +4 -0
- package/dist/cli/runs/search-query.js +50 -0
- package/dist/cli/runs/search.d.ts +2 -1
- package/dist/cli/runs/search.js +6 -6
- package/dist/domain/attachments.js +9 -1
- package/dist/domain/rankings-options.js +3 -3
- package/dist/entities/account-change.d.ts +89 -0
- package/dist/entities/account-change.js +20 -0
- package/dist/entities/account-profile.d.ts +7 -0
- package/dist/entities/account-profile.js +8 -0
- package/dist/entities/analysis-consent.d.ts +9 -0
- package/dist/entities/analysis-consent.js +4 -0
- package/dist/entities/attachment-results.d.ts +96 -0
- package/dist/entities/attachment-results.js +31 -0
- package/dist/entities/batch-result.d.ts +27 -0
- package/dist/entities/batch-result.js +18 -0
- package/dist/entities/chat-admin.d.ts +234 -0
- package/dist/entities/chat-admin.js +84 -0
- package/dist/entities/chat-change.d.ts +25 -0
- package/dist/entities/chat-change.js +11 -0
- package/dist/entities/chat-metadata.d.ts +34 -0
- package/dist/entities/chat-metadata.js +15 -0
- package/dist/entities/chat-moderation.d.ts +44 -0
- package/dist/entities/chat-moderation.js +37 -0
- package/dist/entities/chat-tracking.d.ts +26 -0
- package/dist/entities/chat-tracking.js +23 -0
- package/dist/entities/contact-activity.d.ts +52 -0
- package/dist/entities/contact-activity.js +42 -0
- package/dist/entities/contact-context.d.ts +1568 -0
- package/dist/entities/contact-context.js +191 -0
- package/dist/entities/contact-write.d.ts +22 -0
- package/dist/entities/contact-write.js +6 -0
- package/dist/entities/conversation-preparation.d.ts +63 -0
- package/dist/entities/conversation-preparation.js +23 -0
- package/dist/entities/conversation-results.d.ts +567 -0
- package/dist/entities/conversation-results.js +94 -0
- package/dist/entities/document-link.d.ts +13 -0
- package/dist/entities/document-link.js +11 -0
- package/dist/entities/extraction-report.d.ts +95 -0
- package/dist/entities/extraction-report.js +34 -0
- package/dist/entities/image-embedding.d.ts +9 -0
- package/dist/entities/image-embedding.js +10 -0
- package/dist/entities/index.d.ts +8006 -1928
- package/dist/entities/index.js +174 -3
- package/dist/entities/listener.d.ts +2150 -0
- package/dist/entities/listener.js +46 -0
- package/dist/entities/media-archive.d.ts +43 -0
- package/dist/entities/media-archive.js +32 -0
- package/dist/entities/meeting-task-proposal.d.ts +14 -0
- package/dist/entities/meeting-task-proposal.js +19 -0
- package/dist/entities/meeting.d.ts +1 -1
- package/dist/entities/meeting.js +1 -1
- package/dist/entities/mention.d.ts +63 -0
- package/dist/entities/mention.js +44 -0
- package/dist/entities/message-change.d.ts +19 -0
- package/dist/entities/message-change.js +6 -0
- package/dist/entities/message-context.d.ts +617 -0
- package/dist/entities/message-context.js +20 -0
- package/dist/entities/message-read.d.ts +73 -0
- package/dist/entities/message-read.js +58 -0
- package/dist/entities/message-transfer.d.ts +379 -0
- package/dist/entities/message-transfer.js +83 -0
- package/dist/entities/message-write.d.ts +191 -0
- package/dist/entities/message-write.js +8 -0
- package/dist/entities/model-key.d.ts +14 -0
- package/dist/entities/model-key.js +10 -0
- package/dist/entities/poll.d.ts +40 -0
- package/dist/entities/poll.js +16 -0
- package/dist/entities/private-contact.d.ts +10 -0
- package/dist/entities/private-contact.js +4 -0
- package/dist/entities/reaction-change.d.ts +7 -0
- package/dist/entities/reaction-change.js +8 -0
- package/dist/entities/recipient.d.ts +29 -0
- package/dist/entities/recipient.js +11 -0
- package/dist/entities/recorded-run.d.ts +103 -0
- package/dist/entities/recorded-run.js +44 -0
- package/dist/entities/saved-search.d.ts +4 -0
- package/dist/entities/saved-search.js +2 -0
- package/dist/entities/send-attempt.d.ts +31 -0
- package/dist/entities/send-attempt.js +29 -0
- package/dist/entities/store-maintenance.d.ts +319 -0
- package/dist/entities/store-maintenance.js +145 -0
- package/dist/entities/store-records.d.ts +442 -0
- package/dist/entities/store-records.js +99 -0
- package/dist/entities/tag-change.d.ts +74 -0
- package/dist/entities/tag-change.js +31 -0
- package/dist/entities/task-pair.d.ts +31 -0
- package/dist/entities/task-pair.js +23 -0
- package/dist/entities/task-results.d.ts +524 -0
- package/dist/entities/task-results.js +142 -0
- package/dist/errors/reasons.js +1 -0
- package/dist/mcp/agent.d.ts +3 -1
- package/dist/mcp/agent.js +9 -6
- package/dist/mcp/bot/server.d.ts +2 -0
- package/dist/mcp/bot/server.js +1 -0
- package/dist/mcp/prompts.js +8 -2
- package/dist/mcp/server.js +3 -1
- package/dist/mcp/tools/attachments.js +1 -0
- package/dist/meetings/cli/index.js +1 -1
- package/dist/meetings/cli/passage.js +1 -0
- package/dist/meetings/index.d.ts +2 -1
- package/dist/meetings/index.js +1 -0
- package/dist/meetings/links.d.ts +16 -0
- package/dist/meetings/mcp/index.d.ts +15 -15
- package/dist/meetings/read-answers.d.ts +167 -0
- package/dist/meetings/read-answers.js +183 -0
- package/dist/runs/run.d.ts +10 -2
- package/dist/runs/run.js +11 -3
- package/dist/sends/journal.d.ts +8 -1
- package/dist/sends/journal.js +9 -2
- package/dist/sends/permissions.d.ts +5 -1
- package/dist/sends/permissions.js +11 -1
- package/dist/sends/recipients.d.ts +8 -0
- package/dist/sends/recipients.js +9 -0
- package/dist/services/admin-statistics.js +3 -3
- package/dist/services/chat-documents.d.ts +1 -0
- package/dist/services/chat-documents.js +9 -3
- package/dist/services/chats.d.ts +1 -1
- package/dist/services/chats.js +5 -2
- package/dist/services/meeting-links.d.ts +2 -17
- package/dist/store/exports.d.ts +1 -1
- package/dist/store/exports.js +1 -1
- package/dist/store/messages.d.ts +3 -1
- package/dist/store/messages.js +2 -2
- package/dist/store/roster.d.ts +4 -1
- package/dist/store/roster.js +2 -2
- package/dist/store/sqlite/chats.d.ts +12 -0
- package/dist/store/sqlite/chats.js +1 -0
- package/dist/store/sqlite/document-links.d.ts +1 -1
- package/dist/store/sqlite/document-links.js +5 -5
- package/dist/store/sqlite/involvements.js +2 -1
- package/dist/store/sqlite/roster.d.ts +2 -1
- package/dist/store/sqlite/roster.js +3 -2
- package/package.json +3 -3
- package/parity.json +76 -108
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
import type { MeetingChatLinesInput, MeetingHitSearchRequest } from "../meetings/index.js";
|
|
1
|
+
import type { MeetingChatLinesInput, MeetingHitSearchRequest, MeetingLink } from "../meetings/index.js";
|
|
2
2
|
import type { MessageStore } from "../store/store.js";
|
|
3
|
+
export type { MeetingLink };
|
|
3
4
|
export type MeetingLinksRequest = Omit<MeetingHitSearchRequest, "limit" | "after" | "maxReadBytes"> & Pick<MeetingChatLinesInput, "maxMessages">;
|
|
4
|
-
/** One link as the meetings' chat holds it: where and how often it was shared. */
|
|
5
|
-
export interface MeetingLink {
|
|
6
|
-
url: string;
|
|
7
|
-
domain: string | null;
|
|
8
|
-
/** The Google Docs, Sheets, Slides, Forms or Drive file it names. */
|
|
9
|
-
documentId: string | null;
|
|
10
|
-
count: number;
|
|
11
|
-
firstAt: number;
|
|
12
|
-
lastAt: number;
|
|
13
|
-
senders: string[];
|
|
14
|
-
meetings: {
|
|
15
|
-
meetingId: number;
|
|
16
|
-
accountId: number;
|
|
17
|
-
title: string | null;
|
|
18
|
-
}[];
|
|
19
|
-
}
|
|
20
5
|
/** Links shared in the chat of the selected meetings, most shared first; found when read, not stored. */
|
|
21
6
|
export declare const readMeetingLinks: (store: Pick<MessageStore, "meetings"> & {
|
|
22
7
|
knowledge?: MessageStore["knowledge"];
|
package/dist/store/exports.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type { AdminStoreRequest, AdminStoreResult } from "./sqlite/admin-statist
|
|
|
17
17
|
export { type AttachmentTextEntry, type AttachmentView, attachmentColumns, type FileAttachment, resetAttachmentWords, type TextOrigin, } from "./sqlite/attachment-texts.js";
|
|
18
18
|
export { pendingNormalization } from "./sqlite/backfill.js";
|
|
19
19
|
export type { ChatRekey, ChatRekeys } from "./sqlite/chat-rekey.js";
|
|
20
|
-
export { CHAT_COLUMNS, titlePart } from "./sqlite/chats.js";
|
|
20
|
+
export { CHAT_COLUMNS, TRACKED_CHAT_COLUMNS, titlePart } from "./sqlite/chats.js";
|
|
21
21
|
export { CHAT_LIST_KEY, type ChatCompleteness, fetchedKey, historyStartKey } from "./sqlite/completeness.js";
|
|
22
22
|
export { CONVERSATION_COLUMNS } from "./sqlite/conversations.js";
|
|
23
23
|
export type { CounterTarget } from "./sqlite/counters.js";
|
package/dist/store/exports.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { accountGroupsOf } from "./sqlite/account-groups.js";
|
|
2
2
|
export { attachmentColumns, resetAttachmentWords, } from "./sqlite/attachment-texts.js";
|
|
3
3
|
export { pendingNormalization } from "./sqlite/backfill.js";
|
|
4
|
-
export { CHAT_COLUMNS, titlePart } from "./sqlite/chats.js";
|
|
4
|
+
export { CHAT_COLUMNS, TRACKED_CHAT_COLUMNS, titlePart } from "./sqlite/chats.js";
|
|
5
5
|
export { CHAT_LIST_KEY, fetchedKey, historyStartKey } from "./sqlite/completeness.js";
|
|
6
6
|
export { CONVERSATION_COLUMNS } from "./sqlite/conversations.js";
|
|
7
7
|
export { messageOfEmail, threadConversation } from "./sqlite/emails.js";
|
package/dist/store/messages.d.ts
CHANGED
|
@@ -128,7 +128,9 @@ export interface AccountMessages {
|
|
|
128
128
|
/** Keeps a finished transcript; an empty one is not kept, so the message is heard again. */
|
|
129
129
|
keepTranscript(key: AccountKey, chatId: Id, messageId: Id, text: string, source: string): Promise<void>;
|
|
130
130
|
/** The chat's messages that may hold a Google document link, newest first, with the documents linked from each. */
|
|
131
|
-
documentLinkMessages(key: AccountKey, chatId: Id
|
|
131
|
+
documentLinkMessages(key: AccountKey, chatId: Id, options?: {
|
|
132
|
+
messageId?: Id;
|
|
133
|
+
}): Promise<DocumentLinkMessage[]>;
|
|
132
134
|
/** Messages of the account that name this person, newest first. */
|
|
133
135
|
mentioning(key: AccountKey, person: {
|
|
134
136
|
id: Id;
|
package/dist/store/messages.js
CHANGED
|
@@ -123,9 +123,9 @@ export const accountMessagesOver = (context) => {
|
|
|
123
123
|
return;
|
|
124
124
|
write(database, () => transcripts.keepTranscript(context, chatPkFor(accountPk(key), chatId), messageId, text, source));
|
|
125
125
|
},
|
|
126
|
-
documentLinkMessages: async (key, chatId) => {
|
|
126
|
+
documentLinkMessages: async (key, chatId, { messageId } = {}) => {
|
|
127
127
|
const chatKey = chatKeyOf(key, chatId);
|
|
128
|
-
return chatKey === undefined ? [] : documentLinkMessages(context, chatKey);
|
|
128
|
+
return chatKey === undefined ? [] : documentLinkMessages(context, chatKey, messageId);
|
|
129
129
|
},
|
|
130
130
|
mentioning: async (key, person, limit) => {
|
|
131
131
|
const accountKey = findAccountPk(key);
|
package/dist/store/roster.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ChatEvent, Id, Member } from "../domain/models.js";
|
|
2
2
|
import type { RetentionOptions } from "../domain/retention.js";
|
|
3
3
|
import type { StoreContext } from "./sqlite/open.js";
|
|
4
|
+
import type { Where } from "./sqlite/query-filter.js";
|
|
4
5
|
import { type RetentionResult } from "./sqlite/retention.js";
|
|
5
6
|
import type { MemberCount, MemberStay, ProfileRevision, RosterChange, RosterRead, TrackedChat } from "./sqlite/roster.js";
|
|
6
7
|
import type { AccountKey } from "./types.js";
|
|
@@ -35,7 +36,9 @@ export interface RosterStore {
|
|
|
35
36
|
}): Promise<ChatEvent[]>;
|
|
36
37
|
/** Starts or stops `serve`'s daily fetch of the chat's members; history already kept stays. */
|
|
37
38
|
trackMembers(key: AccountKey, chatId: Id, tracked: boolean): Promise<void>;
|
|
38
|
-
trackedChats(key: AccountKey
|
|
39
|
+
trackedChats(key: AccountKey, options?: {
|
|
40
|
+
where?: Where;
|
|
41
|
+
}): Promise<TrackedChat[]>;
|
|
39
42
|
retention(key: AccountKey, chatId: Id, options: RetentionOptions, evidence?: {
|
|
40
43
|
cohort: string;
|
|
41
44
|
cursor?: string;
|
package/dist/store/roster.js
CHANGED
|
@@ -52,9 +52,9 @@ export const rosterStoreOver = (context) => {
|
|
|
52
52
|
}));
|
|
53
53
|
},
|
|
54
54
|
trackMembers: async (key, chatId, tracked) => write(database, () => roster.setTracked(context, chatPkFor(accountPk(key), chatId), tracked)),
|
|
55
|
-
trackedChats: async (key) => {
|
|
55
|
+
trackedChats: async (key, { where } = {}) => {
|
|
56
56
|
const accountKey = findAccountPk(key);
|
|
57
|
-
return accountKey === undefined ? [] : roster.trackedChats(context, accountKey);
|
|
57
|
+
return accountKey === undefined ? [] : roster.trackedChats(context, accountKey, where);
|
|
58
58
|
},
|
|
59
59
|
retention: async (key, chatId, options, evidence) => {
|
|
60
60
|
const accountKey = findAccountPk(key);
|
|
@@ -94,6 +94,18 @@ export declare const CHAT_COLUMNS: {
|
|
|
94
94
|
readonly sql: "chats.participants_count";
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
|
+
export declare const TRACKED_CHAT_COLUMNS: {
|
|
98
|
+
readonly chat_id: {
|
|
99
|
+
readonly type: "kw";
|
|
100
|
+
readonly sql: "chats.external_id";
|
|
101
|
+
};
|
|
102
|
+
readonly title: {
|
|
103
|
+
readonly where: (node: import("@wirecat/cli-base/query").Predicate) => {
|
|
104
|
+
sql: string;
|
|
105
|
+
params: string[];
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
97
109
|
/** `title:*book*` and `title:book` ask the same: the title holds "book". */
|
|
98
110
|
export declare const titlePart: (value: string) => string;
|
|
99
111
|
export declare const listChats: ({ orm, now }: StoreContext, accountKey: number, { limit, offset, ...filter }: {
|
|
@@ -340,6 +340,7 @@ export const CHAT_COLUMNS = {
|
|
|
340
340
|
last_message_at: { type: "time", sql: "chats.last_message_at" },
|
|
341
341
|
participants_count: { type: "num", sql: "chats.participants_count" },
|
|
342
342
|
};
|
|
343
|
+
export const TRACKED_CHAT_COLUMNS = { chat_id: CHAT_COLUMNS.id, title: CHAT_COLUMNS.title };
|
|
343
344
|
/** `title:*book*` and `title:book` ask the same: the title holds "book". */
|
|
344
345
|
export const titlePart = (value) => value.replace(/^\*+|\*+$/g, "").trim();
|
|
345
346
|
export const listChats = ({ orm, now }, accountKey, { limit, offset = 0, ...filter }) => {
|
|
@@ -14,4 +14,4 @@ export interface DocumentLinkMessage {
|
|
|
14
14
|
}[];
|
|
15
15
|
}
|
|
16
16
|
/** Newest first. Read from the text, so an edit that removed a link drops it whatever link rows remain. */
|
|
17
|
-
export declare const documentLinkMessages: ({ database }: StoreContext, chatKey: number) => DocumentLinkMessage[];
|
|
17
|
+
export declare const documentLinkMessages: ({ database }: StoreContext, chatKey: number, messageId?: Id) => DocumentLinkMessage[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { linkKind } from "./link-kinds.js";
|
|
2
2
|
/** Newest first. Read from the text, so an edit that removed a link drops it whatever link rows remain. */
|
|
3
|
-
export const documentLinkMessages = ({ database }, chatKey) => {
|
|
4
|
-
const
|
|
5
|
-
.prepare("SELECT m.id, m.external_id, m.text, m.sent_at, m.sender_name, " +
|
|
3
|
+
export const documentLinkMessages = ({ database }, chatKey, messageId) => {
|
|
4
|
+
const read = database.prepare("SELECT m.id, m.external_id, m.text, m.sent_at, m.sender_name, " +
|
|
6
5
|
"coalesce(m.sender_chat_external_id, i.external_id) AS sender_id FROM messages m " +
|
|
7
6
|
"LEFT JOIN identities i ON i.id = m.sender_identity_id " +
|
|
8
7
|
"WHERE m.chat_id = ? AND m.deleted_at IS NULL AND (m.text LIKE '%google.com%' OR m.text LIKE '%forms.gle%') " +
|
|
9
|
-
"
|
|
10
|
-
.
|
|
8
|
+
(messageId === undefined ? "" : "AND m.external_id = ? ") +
|
|
9
|
+
"ORDER BY m.sent_at DESC, m.id DESC");
|
|
10
|
+
const rows = messageId === undefined ? read.all(chatKey) : read.all(chatKey, messageId);
|
|
11
11
|
const linked = database.prepare("SELECT json_extract(d.front_matter, '$.fileId') AS file_id, d.title FROM links l " +
|
|
12
12
|
"JOIN documents d ON d.id = l.to_id AND d.deleted_at IS NULL " +
|
|
13
13
|
`WHERE l.from_type = 'message' AND l.from_id = ? AND l.to_type = 'document' AND l.kind = ${linkKind("links-to")}`);
|
|
@@ -33,7 +33,8 @@ export const involvementStoreOver = ({ database, now }) => ({
|
|
|
33
33
|
const account = only === undefined ? [] : [only.provider, only.account];
|
|
34
34
|
return database
|
|
35
35
|
.prepare(`SELECT i.*, a.provider, a.external_id AS account, c.external_id AS chat, m.external_id AS message
|
|
36
|
-
FROM involvements i LEFT JOIN
|
|
36
|
+
FROM involvements i LEFT JOIN projects pr ON pr.id=i.project_id
|
|
37
|
+
LEFT JOIN accounts a ON a.id=coalesce(i.account_id,pr.account_id)
|
|
37
38
|
LEFT JOIN messages m ON i.subject_type='message' AND m.id=i.subject_id
|
|
38
39
|
LEFT JOIN chats c ON c.id=CASE WHEN i.subject_type='chat' THEN i.subject_id ELSE m.chat_id END
|
|
39
40
|
WHERE i.person_id=? ${filters.map(([sql]) => sql).join(" ")}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GroupMember, Id, Provider } from "../../domain/models.js";
|
|
2
2
|
import type { StoreContext } from "./open.js";
|
|
3
|
+
import { type Where } from "./query-filter.js";
|
|
3
4
|
export interface RosterRead {
|
|
4
5
|
observation?: {
|
|
5
6
|
observedAt: string;
|
|
@@ -58,4 +59,4 @@ export declare const memberCountsOf: ({ orm }: StoreContext, chatKey: number, si
|
|
|
58
59
|
/** Profiles of the chat's members, every revision, oldest first. */
|
|
59
60
|
export declare const profileRevisionsOf: ({ orm }: StoreContext, chatKey: number, since?: number) => ProfileRevision[];
|
|
60
61
|
export declare const setTracked: ({ orm, now }: StoreContext, chatKey: number, tracked: boolean) => void;
|
|
61
|
-
export declare const trackedChats: (context: StoreContext, accountKey: number) => TrackedChat[];
|
|
62
|
+
export declare const trackedChats: (context: StoreContext, accountKey: number, where?: Where) => TrackedChat[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { and, asc, eq, gte, inArray, isNotNull, isNull, or, sql } from "./drizzle/core.js";
|
|
3
3
|
import { identityPk, seenIdentity } from "./identities.js";
|
|
4
|
+
import { bound } from "./query-filter.js";
|
|
4
5
|
import { chatMembers, chats, identities, identityRevisions, memberCounts, memberStays } from "./schema.js";
|
|
5
6
|
const iso = (ms) => (ms === null ? null : new Date(ms).toISOString());
|
|
6
7
|
const marksOf = ({ isBot, flagged, deleted, hasPhoto }) => ({
|
|
@@ -191,10 +192,10 @@ export const setTracked = ({ orm, now }, chatKey, tracked) => {
|
|
|
191
192
|
.where(eq(chats.id, chatKey))
|
|
192
193
|
.run();
|
|
193
194
|
};
|
|
194
|
-
export const trackedChats = (context, accountKey) => context.orm
|
|
195
|
+
export const trackedChats = (context, accountKey, where) => context.orm
|
|
195
196
|
.select({ pk: chats.id, chatId: chats.externalId, title: chats.title, trackedAt: chats.membersTrackedAt })
|
|
196
197
|
.from(chats)
|
|
197
|
-
.where(and(eq(chats.accountId, accountKey), isNotNull(chats.membersTrackedAt)))
|
|
198
|
+
.where(and(eq(chats.accountId, accountKey), isNotNull(chats.membersTrackedAt), where ? bound(where) : undefined))
|
|
198
199
|
.orderBy(asc(chats.membersTrackedAt))
|
|
199
200
|
.all()
|
|
200
201
|
.map(({ pk, chatId, title, trackedAt }) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.400.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",
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
"@types/node": "^22.20.4",
|
|
208
208
|
"@types/pngjs": "6.0.5",
|
|
209
209
|
"@vitest/coverage-v8": "^5.0.2",
|
|
210
|
-
"@wirecat/cli-base": "0.50.
|
|
210
|
+
"@wirecat/cli-base": "0.50.2",
|
|
211
211
|
"commander": "15.0.0",
|
|
212
212
|
"cspell": "10.3.6",
|
|
213
213
|
"drizzle-kit": "1.0.0-rc.4",
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
},
|
|
228
228
|
"peerDependencies": {
|
|
229
229
|
"@napi-rs/canvas": ">=0.1.69 <2",
|
|
230
|
-
"@wirecat/cli-base": ">=0.50.
|
|
230
|
+
"@wirecat/cli-base": ">=0.50.2 <0.51.0",
|
|
231
231
|
"commander": ">=15"
|
|
232
232
|
},
|
|
233
233
|
"bin": {
|