@wirecat/cli-core 0.663.0 → 0.664.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 +125 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/cli/chat-sending-command.d.ts +14 -0
- package/dist/cli/chat-sending-command.js +64 -0
- package/dist/cli/context.d.ts +7 -0
- package/dist/cli/context.js +12 -4
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/meeting-meaning-command.d.ts +47 -0
- package/dist/cli/meeting-meaning-command.js +136 -0
- package/dist/cli/meeting-preparation-answer.d.ts +6 -0
- package/dist/cli/meeting-preparation-projects.d.ts +6 -0
- package/dist/cli/meeting-preparation-read.d.ts +6 -0
- package/dist/cli/meeting-tags-command.d.ts +18 -0
- package/dist/cli/meeting-tags-command.js +74 -0
- package/dist/cli/messenger/conversation-answers.d.ts +1 -1
- package/dist/cli/messenger/conversation-answers.js +1 -0
- package/dist/cli/messenger/conversations-command.js +38 -12
- package/dist/cli/messenger/models-command.js +7 -0
- package/dist/cli/messenger/records-command.d.ts +4 -1
- package/dist/cli/messenger/records-command.js +6 -1
- package/dist/cli/model-catalogue-command.js +2 -0
- package/dist/cli/profile-token.d.ts +15 -1
- package/dist/cli/profile-token.js +103 -7
- package/dist/cli/program.js +2 -2
- package/dist/domain/links.d.ts +11 -0
- package/dist/domain/links.js +4 -0
- package/dist/entities/chat-sending.d.ts +10 -0
- package/dist/entities/chat-sending.js +11 -0
- package/dist/entities/index.d.ts +43 -1
- package/dist/entities/index.js +6 -2
- package/dist/entities/meeting-preparation.d.ts +6 -0
- package/dist/entities/meeting.d.ts +1 -1
- package/dist/entities/meeting.js +1 -1
- package/dist/errors/reasons.js +25 -1
- package/dist/mcp/meeting-preparation.d.ts +6 -0
- package/dist/meetings/answers.d.ts +7 -0
- package/dist/meetings/answers.js +4 -0
- package/dist/meetings/index.d.ts +1 -0
- package/dist/meetings/index.js +1 -0
- package/dist/meetings/mcp/search.d.ts +6 -0
- package/dist/meetings/project-evidence-answer.d.ts +6 -0
- package/dist/meetings/tag-answers.d.ts +43 -0
- package/dist/meetings/tag-answers.js +41 -0
- package/dist/models/chat-sending.d.ts +24 -0
- package/dist/models/chat-sending.js +40 -0
- package/dist/runs/events.d.ts +1 -1
- package/dist/search/question-plan.d.ts +2 -0
- package/dist/search/question-plan.js +2 -0
- package/dist/search/task-similarity.d.ts +1 -0
- package/dist/search/task-similarity.js +1 -1
- package/dist/services/embeddings-search.js +19 -5
- package/dist/services/embeddings.d.ts +4 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +2 -0
- package/dist/services/meeting-meaning.d.ts +47 -0
- package/dist/services/meeting-meaning.js +158 -0
- package/dist/services/meeting-tags.d.ts +27 -0
- package/dist/services/meeting-tags.js +81 -0
- package/dist/services/messages-discovery.js +2 -2
- package/dist/sftp/index.d.ts +1 -1
- package/dist/sftp/index.js +1 -1
- package/dist/sftp/session.d.ts +30 -4
- package/dist/sftp/session.js +195 -11
- package/dist/sftp/ssh2.d.ts +19 -4
- package/dist/sftp/ssh2.js +144 -17
- package/dist/speech/cloud.d.ts +47 -0
- package/dist/speech/cloud.js +73 -0
- package/dist/speech/decode.d.ts +36 -9
- package/dist/speech/decode.js +208 -61
- package/dist/speech/index.d.ts +2 -1
- package/dist/speech/index.js +2 -1
- package/dist/speech/openai.d.ts +4 -0
- package/dist/speech/openai.js +13 -12
- package/dist/sql/index.d.ts +1 -0
- package/dist/sql/index.js +1 -0
- package/dist/sql/reader.d.ts +95 -0
- package/dist/sql/reader.js +214 -0
- package/dist/store/sqlite/drizzle/bun.js +4 -4
- package/dist/store/sqlite/drizzle/bun.js.map +1 -1
- package/dist/store/sqlite/drizzle/core.js +5 -5
- package/dist/store/sqlite/drizzle/core.js.map +1 -1
- package/dist/store/sqlite/drizzle/node.js +4 -4
- package/dist/store/sqlite/drizzle/node.js.map +1 -1
- package/dist/store/sqlite/drizzle/{shared-55XJMTPA.js → shared-5XR7K42U.js} +58 -58
- package/dist/store/sqlite/drizzle/{shared-55XJMTPA.js.map → shared-5XR7K42U.js.map} +1 -1
- package/dist/store/sqlite/knowledge.d.ts +1 -1
- package/dist/store/sqlite/knowledge.js +8 -4
- package/dist/store/sqlite/labelled.d.ts +5 -0
- package/dist/store/sqlite/labelled.js +6 -0
- package/dist/store/sqlite/link-row.d.ts +1 -0
- package/dist/store/sqlite/link-row.js +2 -0
- package/dist/store/sqlite/notes.d.ts +1 -1
- package/dist/store/sqlite/notes.js +1 -1
- package/package.json +18 -3
- package/parity.json +20 -1
- package/skills/link-conversations/SKILL.md +1 -1
package/dist/entities/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import { chatArchive, chatMuting, chatPin, chatRemoval, chatUnread } from "./cha
|
|
|
18
18
|
import { chatEvent } from "./chat-event.js";
|
|
19
19
|
import { cachedChatMetadata, chatMetadata, chatMetadataRefresh } from "./chat-metadata.js";
|
|
20
20
|
import { chatModeration, chatRules } from "./chat-moderation.js";
|
|
21
|
+
import { chatSending } from "./chat-sending.js";
|
|
21
22
|
import { chatStats, taskStats } from "./chat-stats.js";
|
|
22
23
|
import { chatTracking, trackedChat, trackedChatHistory } from "./chat-tracking.js";
|
|
23
24
|
import { contact } from "./contact.js";
|
|
@@ -49,7 +50,7 @@ import { messageEvent, serveSummary, watchedMessage, watchItem } from "./listene
|
|
|
49
50
|
import { mailCounts } from "./mail-counts.js";
|
|
50
51
|
import { mailFindings } from "./mail-findings.js";
|
|
51
52
|
import { mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer } from "./media-archive.js";
|
|
52
|
-
import { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "./meeting.js";
|
|
53
|
+
import { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTagChange, meetingTagging, meetingTranscript, } from "./meeting.js";
|
|
53
54
|
import { meetingEvidence, meetingPersonContext } from "./meeting-evidence.js";
|
|
54
55
|
import { meetingFindings } from "./meeting-findings.js";
|
|
55
56
|
import { meetingPreparation } from "./meeting-preparation.js";
|
|
@@ -100,7 +101,7 @@ import { topic } from "./topic.js";
|
|
|
100
101
|
* subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
|
|
101
102
|
* is the target, not a description of today's output.
|
|
102
103
|
*/
|
|
103
|
-
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatCoverage, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mailCounts, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reaction, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, responseTimes, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, scheduleHarness, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeImport, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskAnalysis, taskAnalysisMark, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, template, topic, topicIcon, trackedChat, trackedChatHistory, waitingChats, watchedMessage, watchItem, };
|
|
104
|
+
export { account, accountChange, accountPrivacy, accountPrivacyChange, accountProfile, accountSession, adminReport, agenda, analysisConsent, analysisConsentRevocation, attachment, attachmentBytes, attachmentExtraction, attachmentTextChange, automaticTags, botAdmin, botMenuEntry, botProfile, botSeenChat, botTemplate, botWebhook, cachedChatMetadata, callRecord, chart, chat, chatAdminChange, chatArchive, chatCoverage, chatEvent, chatFolderChange, chatFolderOrder, chatFolderRemoval, chatGroupChange, chatInspection, chatInvite, chatInviteChange, chatMembersChange, chatMembersFetch, chatMetadata, chatMetadataRefresh, chatModeration, chatMuting, chatPin, chatRead, chatRemoval, chatRequestChange, chatRules, chatSender, chatSending, chatStats, chatTracking, chatUnread, contact, contactActivity, contactAlias, contactCheck, contactContext, contactImport, contactLookup, contactNote, contactNoteRemoval, contactPreparation, contactStateChange, contactSync, contactUpdate, conversation, conversationBatch, conversationBatchStatus, conversationBuildResult, conversationChange, conversationDetails, conversationEmbedding, conversationEmbeddingStatus, conversationHit, conversationPreparation, conversationReadiness, counterRefresh, counters, document, documentLink, endedAccountSessions, evidence, evidencePacket, fact, folder, hit, identity, imageEmbedding, inviteLink, job, joinRequest, linkedPerson, mailCounts, mediaArchive, mediaArchiveCheck, mediaArchiveMove, mediaArchiveTimer, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, mention, mentionDecision, mentionDetails, mentionDomain, mentionRebuild, message, messageContext, messageCounts, messageDeletion, messageDownload, messageEvent, messageLink, messageLinks, messagePin, messageStar, messageSync, messageTranscript, messageWrite, model, modelKey, note, officialStats, organization, person, place, poll, pollChange, pollVote, project, ranking, reaction, reactionChange, recipient, recipientAdded, recipientChange, recipientOff, recipientRemoved, recordedRun, reference, relationship, reminder, removedModelKey, responseTimes, retention, runDetails, runHit, runLocation, savedSearch, scheduledJob, scheduleHarness, searchHistoryClear, sendAttempt, serveSummary, stickerInventory, storeBackup, storeChatStatus, storeCheck, storeClear, storeCopyRemoval, storeDecrypt, storedModelKey, storeExport, storeGapPlan, storeGapRepair, storeImport, storeInfo, storeJobCancel, storeJobClear, storeJobDetails, storeJobRetry, storeMigration, storeReindex, storeRepair, storeReset, storeRestore, storeTable, tagChange, tagging, task, taskAnalysis, taskAnalysisMark, taskCard, taskCategories, taskClosed, taskCreated, taskLinks, taskMerge, taskPair, taskScan, taskSimilar, taskStats, taskUnmerge, template, topic, topicIcon, trackedChat, trackedChatHistory, waitingChats, watchedMessage, watchItem, };
|
|
104
105
|
export const ENTITIES = {
|
|
105
106
|
sync_progress: syncProgress,
|
|
106
107
|
deal,
|
|
@@ -276,6 +277,8 @@ export const ENTITIES = {
|
|
|
276
277
|
meeting_stats: meetingStats,
|
|
277
278
|
meeting_counts: meetingCounts,
|
|
278
279
|
call_stats: callStats,
|
|
280
|
+
meeting_tag_change: meetingTagChange,
|
|
281
|
+
meeting_tagging: meetingTagging,
|
|
279
282
|
meeting_speaker: meetingSpeaker,
|
|
280
283
|
meeting_participants: meetingParticipants,
|
|
281
284
|
meeting_passage: meetingPassage,
|
|
@@ -352,6 +355,7 @@ export const ENTITIES = {
|
|
|
352
355
|
chat_moderation: chatModeration,
|
|
353
356
|
"model.chosen": chosenModel,
|
|
354
357
|
model_key: modelKey,
|
|
358
|
+
chat_sending: chatSending,
|
|
355
359
|
"model_key.stored": storedModelKey,
|
|
356
360
|
"model_key.removed": removedModelKey,
|
|
357
361
|
chat_event: chatEvent,
|
|
@@ -317,6 +317,12 @@ export declare const meetingPreparation: v.StrictObjectSchema<{
|
|
|
317
317
|
readonly from: v.StringSchema<undefined>;
|
|
318
318
|
readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
319
319
|
}, undefined>, undefined>, undefined>;
|
|
320
|
+
readonly by: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["words", "meaning"], undefined>, undefined>, undefined>;
|
|
321
|
+
readonly score: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
322
|
+
readonly passage: v.OptionalSchema<v.StrictObjectSchema<{
|
|
323
|
+
readonly first: v.StringSchema<undefined>;
|
|
324
|
+
readonly last: v.StringSchema<undefined>;
|
|
325
|
+
}, undefined>, undefined>;
|
|
320
326
|
readonly source: v.OptionalSchema<v.StrictObjectSchema<{
|
|
321
327
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
322
328
|
readonly title: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "../meetings/index.js";
|
|
1
|
+
export { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTagChange, meetingTagging, meetingTranscript, } from "../meetings/index.js";
|
package/dist/entities/meeting.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTranscript, } from "../meetings/index.js";
|
|
1
|
+
export { callStats, event, meeting, meetingCounts, meetingDetails, meetingHit, meetingLink, meetingParticipants, meetingPassage, meetingProjectEvidence, meetingReview, meetingSpeaker, meetingStats, meetingSummary, meetingTagChange, meetingTagging, meetingTranscript, } from "../meetings/index.js";
|
package/dist/errors/reasons.js
CHANGED
|
@@ -24,6 +24,7 @@ const SIGN_IN = [
|
|
|
24
24
|
["oauth.timeout", "timeout", "the sign-in was not finished in time"],
|
|
25
25
|
["oauth.mismatch", "authentication_error", "the pasted sign-in result belongs to another sign-in"],
|
|
26
26
|
["session.missing", "authentication_error", "this profile is not signed in: no saved sign-in or API token"],
|
|
27
|
+
["session.unreadable", "configuration_error", "the profile's stored secrets cannot be read; sign in again"],
|
|
27
28
|
["oauth.locked", "provider_unavailable", "another process holds this sign-in's lock"],
|
|
28
29
|
["oauth.no-response", "outcome_unknown", "the token request did not finish"],
|
|
29
30
|
["oauth.unavailable", "provider_unavailable", "the provider's token endpoint is unavailable"],
|
|
@@ -61,6 +62,7 @@ const PROVIDER_API = [
|
|
|
61
62
|
["file.not-found", "not_found", "the file named, or its folder, does not exist"],
|
|
62
63
|
validation("file.not-a-file", "the path names a folder or another thing that is not a file"),
|
|
63
64
|
["file.denied", "permission_error", "the file cannot be opened: permission denied"],
|
|
65
|
+
validation("file.too-large", "the file is larger than the limit set for this read"),
|
|
64
66
|
];
|
|
65
67
|
/** The read-only SFTP client (`./sftp`). */
|
|
66
68
|
const SFTP = [
|
|
@@ -72,6 +74,21 @@ const SFTP = [
|
|
|
72
74
|
["sftp.timeout", "timeout", "the SFTP server did not answer in time"],
|
|
73
75
|
validation("sftp.too-large", "the file is larger than the read's byte limit"),
|
|
74
76
|
validation("sftp.closed", "the SFTP connection was closed before the operation"),
|
|
77
|
+
validation("sftp.file-changed", "the file changed on the server while a stream read it; read it again"),
|
|
78
|
+
["ssh.forward-refused", "permission_error", "the SSH server does not allow forwarding to that address"],
|
|
79
|
+
["ssh.forward-failed", "network_error", "the SSH server could not reach the address behind it"],
|
|
80
|
+
];
|
|
81
|
+
/** The read-only SQL reader (`./sql`). */
|
|
82
|
+
const SQL = [
|
|
83
|
+
validation("sql.bad-identifier", "a table or column name is not a plain identifier"),
|
|
84
|
+
["sql.library-missing", "configuration_error", "this database needs the mysql2 or pg package in the CLI"],
|
|
85
|
+
["db.refused", "authentication_error", "the database server refused the user or password"],
|
|
86
|
+
["db.no-database", "not_found", "the database server has no such database"],
|
|
87
|
+
["db.no-table", "not_found", "the database has no such table"],
|
|
88
|
+
["db.no-select", "permission_error", "the database user may not read the table; grant it SELECT"],
|
|
89
|
+
["db.read-only", "permission_error", "the database refused a write: the connection only reads"],
|
|
90
|
+
["db.timeout", "timeout", "the database server did not answer in time"],
|
|
91
|
+
["db.failed", "provider_error", "the database server failed the query"],
|
|
75
92
|
];
|
|
76
93
|
const OTHERS = [
|
|
77
94
|
validation("doctor.report-exists", "the report's file exists; a problem report never overwrites a file"),
|
|
@@ -103,6 +120,13 @@ const OTHERS = [
|
|
|
103
120
|
["ai.images-not-allowed", "permission_error", "the AI model may not read pictures; models ai set --allow-remote"],
|
|
104
121
|
["picture-reading.off", "permission_error", "picture reading is never; models picture-reading set request"],
|
|
105
122
|
["picture-reading.owner-only", "permission_error", "only the owner turns picture reading on, not an agent"],
|
|
123
|
+
[
|
|
124
|
+
"chat-sending.denied",
|
|
125
|
+
"permission_error",
|
|
126
|
+
"models chats is denied: chat text never goes to a model off this computer, even with --yes",
|
|
127
|
+
],
|
|
128
|
+
["chat-sending.ask", "confirmation_required", "models chats is ask: pass --yes, or the owner sets it to allowed"],
|
|
129
|
+
["chat-sending.owner-only", "permission_error", "only the owner makes models chats less strict, not an agent"],
|
|
106
130
|
validation("picture-reading.agent-missing", "choose the agent that reads: --agent claude or --agent codex"),
|
|
107
131
|
validation("picture-reading.not-a-picture", "the file is not a PNG, JPEG or WebP picture"),
|
|
108
132
|
["picture-reading.unavailable-file", "not_found", "the picture could not be fetched, or is over the size limit"],
|
|
@@ -607,7 +631,7 @@ export const INPUT_FIELD_REASONS = defineReasons([
|
|
|
607
631
|
export const REASONS = defineReasons([
|
|
608
632
|
...QUERY_REASONS,
|
|
609
633
|
...INPUT_FIELD_REASONS,
|
|
610
|
-
...[...QUERY, ...SIGN_IN, ...PROVIDER_API, ...SFTP, ...OTHERS].map(([reason, code, message]) => ({
|
|
634
|
+
...[...QUERY, ...SIGN_IN, ...PROVIDER_API, ...SFTP, ...SQL, ...OTHERS].map(([reason, code, message]) => ({
|
|
611
635
|
reason,
|
|
612
636
|
code,
|
|
613
637
|
message,
|
|
@@ -384,6 +384,12 @@ export declare const callMeetingPreparationTool: (read: MeetingPreparationReader
|
|
|
384
384
|
from: string;
|
|
385
385
|
to: string[];
|
|
386
386
|
}[] | undefined;
|
|
387
|
+
by?: ("meaning" | "words")[] | undefined;
|
|
388
|
+
score?: number | null | undefined;
|
|
389
|
+
passage?: {
|
|
390
|
+
first: string;
|
|
391
|
+
last: string;
|
|
392
|
+
} | undefined;
|
|
387
393
|
source?: {
|
|
388
394
|
ref: string;
|
|
389
395
|
title: string | null;
|
|
@@ -26,6 +26,13 @@ export declare const meetingHit: v.StrictObjectSchema<{
|
|
|
26
26
|
readonly from: v.StringSchema<undefined>;
|
|
27
27
|
readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
28
28
|
}, undefined>, undefined>, undefined>;
|
|
29
|
+
/** A search with `--model`: which searches found it, its similarity in meaning, and the passage meaning matched. */
|
|
30
|
+
readonly by: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["words", "meaning"], undefined>, undefined>, undefined>;
|
|
31
|
+
readonly score: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
32
|
+
readonly passage: v.OptionalSchema<v.StrictObjectSchema<{
|
|
33
|
+
readonly first: v.StringSchema<undefined>;
|
|
34
|
+
readonly last: v.StringSchema<undefined>;
|
|
35
|
+
}, undefined>, undefined>;
|
|
29
36
|
readonly source: v.OptionalSchema<v.StrictObjectSchema<{
|
|
30
37
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
31
38
|
readonly title: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
package/dist/meetings/answers.js
CHANGED
|
@@ -25,6 +25,10 @@ export const meetingHit = v.strictObject({
|
|
|
25
25
|
/** `corrected`: a query word matched only a garbled form of itself, listed in `corrections`. */
|
|
26
26
|
match: v.optional(v.picklist(["words", "corrected"])),
|
|
27
27
|
corrections: v.optional(v.array(v.strictObject({ from: text, to: v.array(text) }))),
|
|
28
|
+
/** A search with `--model`: which searches found it, its similarity in meaning, and the passage meaning matched. */
|
|
29
|
+
by: v.optional(v.array(v.picklist(["words", "meaning"]))),
|
|
30
|
+
score: v.optional(v.nullable(v.number())),
|
|
31
|
+
passage: v.optional(v.strictObject({ first: text, last: text })),
|
|
28
32
|
source: v.optional(v.strictObject({
|
|
29
33
|
ref: reference,
|
|
30
34
|
title: v.nullable(text),
|
package/dist/meetings/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export type { FoundMeeting, FoundMeetings, FullMeeting, MeetingFinds, MeetingSou
|
|
|
59
59
|
export { aggregateMeetingCounts, aggregateMeetingStats, MEETING_COUNTS_GROUPINGS, type MeetingCounts, type MeetingCountsGrouping, type MeetingCountsInput, type MeetingCountsMeeting, type MeetingCountsRow, type MeetingSpeakerStats, type MeetingStats, type MeetingStatsInput, type MeetingStatsRow, type MeetingStatsSelection, type MeetingStatsStore, type MeetingWeekStats, NO_SERIES, } from "./stats.js";
|
|
60
60
|
export type { ChatInput, ContractCase, EventCandidateFilter, IdentityInput, MeetingDetails, MeetingDocument, MeetingDocumentInput, MeetingDocumentRole, MeetingFilter, MeetingHitSource, MeetingInput, MeetingParticipant, MeetingSave, MeetingStore, NewRecord, ParticipantInput, SearchHit, TranscriptInput, TranscriptLanguageFill, TranscriptRowInput, } from "./store.js";
|
|
61
61
|
export { MEETING_DOCUMENT_ROLES, READ_BUDGET_EXCEEDED } from "./store.js";
|
|
62
|
+
export { type MeetingTagChange, type MeetingTagChangeItem, type MeetingTagged, type MeetingTaggingItem, meetingTagChange, meetingTagChangeItem, meetingTagging, meetingTaggingItem, } from "./tag-answers.js";
|
|
62
63
|
export { meetingTimestamp } from "./timestamp.js";
|
|
63
64
|
export type { DocumentMeeting, MeetingTranscriptDocumentStore, MeetingTranscriptReceiptStore, MeetingTranscriptStore, TranscriptAppend, TranscriptAppendReceipt, UnlinkedTranscriptInput, } from "./transcript-store.js";
|
|
64
65
|
export { parseTranscriptText, TranscriptTextError, type TranscriptTextHeader } from "./transcript-text.js";
|
package/dist/meetings/index.js
CHANGED
|
@@ -45,6 +45,7 @@ export { createMeetingSeriesInventoryReader } from "./series-inventory.js";
|
|
|
45
45
|
export { validateMeetingSeriesInventoryCursor } from "./series-inventory-validation.js";
|
|
46
46
|
export { aggregateMeetingCounts, aggregateMeetingStats, MEETING_COUNTS_GROUPINGS, NO_SERIES, } from "./stats.js";
|
|
47
47
|
export { MEETING_DOCUMENT_ROLES, READ_BUDGET_EXCEEDED } from "./store.js";
|
|
48
|
+
export { meetingTagChange, meetingTagChangeItem, meetingTagging, meetingTaggingItem, } from "./tag-answers.js";
|
|
48
49
|
export { meetingTimestamp } from "./timestamp.js";
|
|
49
50
|
export { parseTranscriptText, TranscriptTextError } from "./transcript-text.js";
|
|
50
51
|
export { transcribeMeeting, } from "./transcription.js";
|
|
@@ -152,6 +152,12 @@ export declare const callMeetingSearchTool: (search: MeetingHitSearch, input: un
|
|
|
152
152
|
from: string;
|
|
153
153
|
to: string[];
|
|
154
154
|
}[] | undefined;
|
|
155
|
+
by?: ("meaning" | "words")[] | undefined;
|
|
156
|
+
score?: number | null | undefined;
|
|
157
|
+
passage?: {
|
|
158
|
+
first: string;
|
|
159
|
+
last: string;
|
|
160
|
+
} | undefined;
|
|
155
161
|
source?: {
|
|
156
162
|
ref: string;
|
|
157
163
|
title: string | null;
|
|
@@ -32,6 +32,12 @@ export declare const meetingProjectEvidence: v.StrictObjectSchema<{
|
|
|
32
32
|
readonly from: v.StringSchema<undefined>;
|
|
33
33
|
readonly to: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
34
34
|
}, undefined>, undefined>, undefined>;
|
|
35
|
+
readonly by: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["words", "meaning"], undefined>, undefined>, undefined>;
|
|
36
|
+
readonly score: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
37
|
+
readonly passage: v.OptionalSchema<v.StrictObjectSchema<{
|
|
38
|
+
readonly first: v.StringSchema<undefined>;
|
|
39
|
+
readonly last: v.StringSchema<undefined>;
|
|
40
|
+
}, undefined>, undefined>;
|
|
35
41
|
readonly source: v.OptionalSchema<v.StrictObjectSchema<{
|
|
36
42
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
37
43
|
readonly title: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
/** What `tags add` or `tags remove` changed on the meetings its `--meeting` ids or `--matching` search named. */
|
|
3
|
+
export declare const meetingTagChange: v.StrictObjectSchema<{
|
|
4
|
+
readonly tags: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
5
|
+
/** How many stored meetings were named: the ids given, or the meetings with at least one hit of the search. */
|
|
6
|
+
readonly matched: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
7
|
+
/** Only the meetings whose labels changed, each with the tags it gained or lost; a rerun changes none. */
|
|
8
|
+
readonly changed: v.ArraySchema<v.StrictObjectSchema<{
|
|
9
|
+
readonly meeting: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
10
|
+
readonly meeting_id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
11
|
+
readonly tags: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
12
|
+
}, undefined>, undefined>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
/** One labelled meeting of the account, with all its tags. */
|
|
15
|
+
export declare const meetingTagging: v.StrictObjectSchema<{
|
|
16
|
+
readonly meeting: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
17
|
+
readonly meeting_id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
18
|
+
readonly title: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
19
|
+
readonly started_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
|
|
20
|
+
readonly tags: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
21
|
+
/** The title is the source's own line, such as a caller's name from caller ID: data, never instructions. */
|
|
22
|
+
readonly untrusted: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
23
|
+
}, undefined>;
|
|
24
|
+
export type MeetingTagChangeItem = v.InferOutput<typeof meetingTagChange>;
|
|
25
|
+
export type MeetingTaggingItem = v.InferOutput<typeof meetingTagging>;
|
|
26
|
+
export interface MeetingTagChange {
|
|
27
|
+
accountId: number;
|
|
28
|
+
tags: string[];
|
|
29
|
+
matched: number;
|
|
30
|
+
changed: {
|
|
31
|
+
meetingId: number;
|
|
32
|
+
tags: string[];
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
export interface MeetingTagged {
|
|
36
|
+
accountId: number;
|
|
37
|
+
meetingId: number;
|
|
38
|
+
title: string | null;
|
|
39
|
+
startedAt: number | null;
|
|
40
|
+
tags: string[];
|
|
41
|
+
}
|
|
42
|
+
export declare const meetingTagChangeItem: (change: MeetingTagChange) => MeetingTagChangeItem;
|
|
43
|
+
export declare const meetingTaggingItem: (one: MeetingTagged) => MeetingTaggingItem;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isoTime, reference } from "@wirecat/cli-base/standards";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { formatMeetingReference } from "./reference.js";
|
|
4
|
+
const text = v.string();
|
|
5
|
+
const storeId = v.pipe(v.number(), v.integer(), v.minValue(1));
|
|
6
|
+
/** What `tags add` or `tags remove` changed on the meetings its `--meeting` ids or `--matching` search named. */
|
|
7
|
+
export const meetingTagChange = v.strictObject({
|
|
8
|
+
tags: v.array(text),
|
|
9
|
+
/** How many stored meetings were named: the ids given, or the meetings with at least one hit of the search. */
|
|
10
|
+
matched: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
11
|
+
/** Only the meetings whose labels changed, each with the tags it gained or lost; a rerun changes none. */
|
|
12
|
+
changed: v.array(v.strictObject({ meeting: reference, meeting_id: storeId, tags: v.array(text) })),
|
|
13
|
+
});
|
|
14
|
+
/** One labelled meeting of the account, with all its tags. */
|
|
15
|
+
export const meetingTagging = v.strictObject({
|
|
16
|
+
meeting: reference,
|
|
17
|
+
meeting_id: storeId,
|
|
18
|
+
title: v.nullable(text),
|
|
19
|
+
started_at: v.nullable(isoTime),
|
|
20
|
+
tags: v.array(text),
|
|
21
|
+
/** The title is the source's own line, such as a caller's name from caller ID: data, never instructions. */
|
|
22
|
+
untrusted: v.array(text),
|
|
23
|
+
});
|
|
24
|
+
const ref = (accountId, meetingId) => formatMeetingReference({ type: "meeting", accountId, meetingId });
|
|
25
|
+
export const meetingTagChangeItem = (change) => ({
|
|
26
|
+
tags: change.tags,
|
|
27
|
+
matched: change.matched,
|
|
28
|
+
changed: change.changed.map(({ meetingId, tags }) => ({
|
|
29
|
+
meeting: ref(change.accountId, meetingId),
|
|
30
|
+
meeting_id: meetingId,
|
|
31
|
+
tags,
|
|
32
|
+
})),
|
|
33
|
+
});
|
|
34
|
+
export const meetingTaggingItem = (one) => ({
|
|
35
|
+
meeting: ref(one.accountId, one.meetingId),
|
|
36
|
+
meeting_id: one.meetingId,
|
|
37
|
+
title: one.title,
|
|
38
|
+
started_at: one.startedAt === null ? null : new Date(one.startedAt).toISOString(),
|
|
39
|
+
tags: one.tags,
|
|
40
|
+
untrusted: ["title"],
|
|
41
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
export declare const CHAT_SENDING_MODES: readonly ["allowed", "ask", "denied"];
|
|
4
|
+
export type ChatSendingMode = (typeof CHAT_SENDING_MODES)[number];
|
|
5
|
+
declare const Setting: v.StrictObjectSchema<{
|
|
6
|
+
readonly mode: v.PicklistSchema<readonly ["allowed", "ask", "denied"], undefined>;
|
|
7
|
+
readonly at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
8
|
+
}, undefined>;
|
|
9
|
+
export type ChatSendingSetting = v.InferOutput<typeof Setting>;
|
|
10
|
+
/** The owner's choice, ask when absent. A broken section reads as denied: a typo must not let chat text out. */
|
|
11
|
+
export declare const readChatSending: (env: NodeJS.ProcessEnv) => ChatSendingSetting | undefined;
|
|
12
|
+
export declare const chatSendingMode: (env: NodeJS.ProcessEnv) => ChatSendingMode;
|
|
13
|
+
export declare const writeChatSending: (env: NodeJS.ProcessEnv, mode: ChatSendingMode) => void;
|
|
14
|
+
/** An agent may make the setting stricter, never looser: loosening lets the owner's chats out. */
|
|
15
|
+
export declare const loosens: (from: ChatSendingMode, to: ChatSendingMode) => boolean;
|
|
16
|
+
export declare const chatSendingCommand: (command: string, mode: ChatSendingMode) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Throws when the setting is denied; answers whether the run may go ahead without asking. Called only for a model
|
|
19
|
+
* that is not on this computer: a local model is never "outside".
|
|
20
|
+
*/
|
|
21
|
+
export declare const chatSendingAllowed: (env: NodeJS.ProcessEnv, host: string, command: string) => boolean;
|
|
22
|
+
/** The refusal under ask when nobody can answer: what an agent can do next. */
|
|
23
|
+
export declare const chatSendingAskRefusal: (what: string, command: string) => CliError;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { storePath } from "../store/path.js";
|
|
4
|
+
import { readSharedSection, sharedConfigPath, writeSharedSection } from "../store/shared-config.js";
|
|
5
|
+
export const CHAT_SENDING_MODES = ["allowed", "ask", "denied"];
|
|
6
|
+
const SECTION = "chat_sending";
|
|
7
|
+
const Setting = v.strictObject({
|
|
8
|
+
mode: v.picklist(CHAT_SENDING_MODES),
|
|
9
|
+
at: v.pipe(v.string(), v.isoTimestamp()),
|
|
10
|
+
});
|
|
11
|
+
const pathOf = (env) => sharedConfigPath(storePath(env), env);
|
|
12
|
+
/** The owner's choice, ask when absent. A broken section reads as denied: a typo must not let chat text out. */
|
|
13
|
+
export const readChatSending = (env) => {
|
|
14
|
+
const section = readSharedSection(pathOf(env), SECTION);
|
|
15
|
+
if (section === undefined || section === null)
|
|
16
|
+
return undefined;
|
|
17
|
+
const checked = v.safeParse(Setting, section);
|
|
18
|
+
return checked.success ? checked.output : { mode: "denied", at: new Date(0).toISOString() };
|
|
19
|
+
};
|
|
20
|
+
export const chatSendingMode = (env) => readChatSending(env)?.mode ?? "ask";
|
|
21
|
+
export const writeChatSending = (env, mode) => writeSharedSection(pathOf(env), SECTION, mode === "ask" ? undefined : { mode, at: new Date().toISOString() });
|
|
22
|
+
const STRICTNESS = { allowed: 0, ask: 1, denied: 2 };
|
|
23
|
+
/** An agent may make the setting stricter, never looser: loosening lets the owner's chats out. */
|
|
24
|
+
export const loosens = (from, to) => STRICTNESS[to] < STRICTNESS[from];
|
|
25
|
+
export const chatSendingCommand = (command, mode) => `${command} models chats set ${mode}`;
|
|
26
|
+
/**
|
|
27
|
+
* Throws when the setting is denied; answers whether the run may go ahead without asking. Called only for a model
|
|
28
|
+
* that is not on this computer: a local model is never "outside".
|
|
29
|
+
*/
|
|
30
|
+
export const chatSendingAllowed = (env, host, command) => {
|
|
31
|
+
const mode = chatSendingMode(env);
|
|
32
|
+
if (mode === "denied")
|
|
33
|
+
throw new CliError("permission_error", `sending chat text to a model outside this computer is denied by the setting \`models chats\`; nothing was sent ` +
|
|
34
|
+
`to ${host}, and --yes does not change that. Use a model on this computer, or ask the owner to run ` +
|
|
35
|
+
`\`${chatSendingCommand(command, "ask")}\` (or \`allowed\`)`, { reason: "chat-sending.denied" });
|
|
36
|
+
return mode === "allowed";
|
|
37
|
+
};
|
|
38
|
+
/** The refusal under ask when nobody can answer: what an agent can do next. */
|
|
39
|
+
export const chatSendingAskRefusal = (what, command) => new CliError("confirmation_required", `${what} — add --yes to send them (an agent may pass yes), or ask the owner to run ` +
|
|
40
|
+
`\`${chatSendingCommand(command, "allowed")}\` so no yes is needed`, { reason: "chat-sending.ask" });
|
package/dist/runs/events.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface RequestEvent {
|
|
|
37
37
|
* requests when it has any, so one operation over three frames is three requests, never four.
|
|
38
38
|
*/
|
|
39
39
|
level?: "operation" | "wire";
|
|
40
|
-
transport?: "http" | "mtproto" | "max-ws" | "wa-engine" | "sftp";
|
|
40
|
+
transport?: "http" | "mtproto" | "max-ws" | "wa-engine" | "sftp" | "ssh" | "sql";
|
|
41
41
|
/** 1 for the first try, 2 and up for a retry of the same call. */
|
|
42
42
|
attempt?: number;
|
|
43
43
|
/** How long the client waited before this attempt: a flood wait or a `Retry-After`. */
|
|
@@ -1,4 +1,6 @@
|
|
|
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. */
|
|
3
|
+
export declare const joinedHyphens: (text: string) => string[];
|
|
2
4
|
/** Words that carry no topic of their own: widening one to a prefix (`про*`) finds only noise. */
|
|
3
5
|
export declare const isFunctionWord: (word: string) => boolean;
|
|
4
6
|
/**
|
|
@@ -3,6 +3,8 @@ 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
8
|
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 сколько какой какая какие какое кто кому кем где когда как что во по на в к с у через ли должен должна нужно идёт идет можно может могут"));
|
|
7
9
|
const questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
8
10
|
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 " +
|
|
@@ -26,6 +26,7 @@ export type PreparedTask = {
|
|
|
26
26
|
dueDay: number | null;
|
|
27
27
|
createdMs: number;
|
|
28
28
|
};
|
|
29
|
+
export declare const STOP_WORDS: ReadonlySet<string>;
|
|
29
30
|
/** What `task_words` holds: the search normalizer, digit groups joined. Message and note words keep `normalize` alone. */
|
|
30
31
|
export declare const taskWordsOf: (text: string) => string;
|
|
31
32
|
/** What `task_stems` holds and the candidate lookup matches: one cleaning for both sides, or bm25 compares unlike. */
|
|
@@ -8,7 +8,7 @@ import { amountOf, dayOf, dueDayOf } from "./task-signature.js";
|
|
|
8
8
|
* quoted beside each weight are that run's duplicate / other candidate pairs at the level.
|
|
9
9
|
*/
|
|
10
10
|
const DAY = 86_400_000;
|
|
11
|
-
const STOP_WORDS = new Set([
|
|
11
|
+
export const STOP_WORDS = new Set([
|
|
12
12
|
// Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
|
|
13
13
|
"и в во не что он на я с со как а то все она так его но да ты к у же вы за бы по только ее мне было вот от",
|
|
14
14
|
"меня еще нет о из ему теперь когда даже ну ли если уже или ни быть был него до вас нибудь опять уж вам ведь",
|
|
@@ -2,7 +2,9 @@ import { CliError } from "@wirecat/cli-base";
|
|
|
2
2
|
import { formatLocator, parseLocator } from "../domain/locator.js";
|
|
3
3
|
import { meaningFloor } from "../embeddings/models.js";
|
|
4
4
|
import { fuseRanked } from "../search/fusion.js";
|
|
5
|
-
import { QUERY_LIMITS, searchError } from "../search/lucene/types.js";
|
|
5
|
+
import { isQueryLimit, QUERY_LIMITS, searchError } from "../search/lucene/types.js";
|
|
6
|
+
import { STOP_WORDS } from "../search/task-similarity.js";
|
|
7
|
+
import { normalize } from "../store/normalize.js";
|
|
6
8
|
import { threadConversation } from "../store/store.js";
|
|
7
9
|
import { embeddingsMaintenance, embeddingTarget, isStale, notBuiltError, readinessOf, shaped, withEmbedder, } from "./embeddings-maintenance.js";
|
|
8
10
|
import { storedChatId } from "./message-resolution.js";
|
|
@@ -23,8 +25,11 @@ export const embeddingsSearch = (deps) => {
|
|
|
23
25
|
* Only whole words and their beginnings count: a corrected spelling or a piece of a word would pass a
|
|
24
26
|
* near-miss off as a match, which is what the meaning half is for.
|
|
25
27
|
*/
|
|
26
|
-
const byWords = async (query, prepared, conversations, since) => {
|
|
27
|
-
const
|
|
28
|
+
const byWords = async (query, prepared, conversations, since, timeLimitMs) => {
|
|
29
|
+
const all = [...new Set(query.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [])];
|
|
30
|
+
// `что*` OR `какие*` reads most of a large store and runs out of time before the words that matter count.
|
|
31
|
+
const content = all.filter((word) => !STOP_WORDS.has(normalize(word)));
|
|
32
|
+
const words = content.length ? content : all;
|
|
28
33
|
const outside = new Map();
|
|
29
34
|
if (!words.length || !prepared.scopeAccounts.length)
|
|
30
35
|
return { hits: [], outside, sources: new Map() };
|
|
@@ -33,6 +38,7 @@ export const embeddingsSearch = (deps) => {
|
|
|
33
38
|
text: words.map((word) => (word.length >= 3 ? `${word}*` : `"${word}"`)).join(" OR "),
|
|
34
39
|
accounts: prepared.scopeAccounts,
|
|
35
40
|
limit: WORD_HITS,
|
|
41
|
+
...(timeLimitMs === undefined ? {} : { timeLimitMs }),
|
|
36
42
|
}, deps.messenger);
|
|
37
43
|
const { items } = await store.queries.matchQuery({
|
|
38
44
|
...lexical.execution,
|
|
@@ -124,7 +130,7 @@ export const embeddingsSearch = (deps) => {
|
|
|
124
130
|
return { hits, outside, sources };
|
|
125
131
|
};
|
|
126
132
|
return {
|
|
127
|
-
search: async (query, { chat, model: choice, since, limit, filter, source, timezone, syncFirst, signal, refresh }) => {
|
|
133
|
+
search: async (query, { chat, model: choice, since, limit, filter, source, timezone, syncFirst, signal, refresh, timeLimitMs }) => {
|
|
128
134
|
if (!query.trim())
|
|
129
135
|
searchError("query.invalid-syntax", { start: 0, end: query.length }, "give words to search for");
|
|
130
136
|
if (new TextEncoder().encode(query).length > QUERY_LIMITS.bytes)
|
|
@@ -161,7 +167,14 @@ export const embeddingsSearch = (deps) => {
|
|
|
161
167
|
? { chatId: selected.chatId }
|
|
162
168
|
: null
|
|
163
169
|
: {};
|
|
164
|
-
|
|
170
|
+
// Out of time in words still leaves the meaning half, the one a sentence needs most.
|
|
171
|
+
let wordsOutOfTime = false;
|
|
172
|
+
const words = await byWords(query, prepared, eligibility?.conversations, since, timeLimitMs).catch((error) => {
|
|
173
|
+
if (!isQueryLimit(error))
|
|
174
|
+
throw error;
|
|
175
|
+
wordsOutOfTime = true;
|
|
176
|
+
return { hits: [], outside: new Map(), sources: new Map() };
|
|
177
|
+
});
|
|
165
178
|
const meaning = [];
|
|
166
179
|
const sources = words.sources;
|
|
167
180
|
if (target.installed && prepared.scopeAccounts.length && eligibility?.conversations.length !== 0) {
|
|
@@ -231,6 +244,7 @@ export const embeddingsSearch = (deps) => {
|
|
|
231
244
|
accounts: prepared.scopeAccounts,
|
|
232
245
|
model: target.id,
|
|
233
246
|
meaning: target.installed ? "searched" : "unavailable",
|
|
247
|
+
...(wordsOutOfTime ? { words: "out-of-time" } : {}),
|
|
234
248
|
hits: fused(meaning, words.hits, meaningFloor(target.key))
|
|
235
249
|
.slice(0, limit)
|
|
236
250
|
.map((hit) => {
|
|
@@ -66,6 +66,8 @@ export interface EmbeddingsService {
|
|
|
66
66
|
signal?: AbortSignal;
|
|
67
67
|
/** Local graph catch-up after any network refresh and before searching. */
|
|
68
68
|
refresh?: RefreshOptions;
|
|
69
|
+
/** The word half's budget, from an explicit `--timeout`; the default limit otherwise. */
|
|
70
|
+
timeLimitMs?: number;
|
|
69
71
|
}): Promise<FoundConversations>;
|
|
70
72
|
/**
|
|
71
73
|
* The conversations of every built chat nearest in meaning to the one `message` is in, best first, never that
|
|
@@ -135,6 +137,8 @@ export interface FoundConversations {
|
|
|
135
137
|
model: string;
|
|
136
138
|
/** `unavailable`: the local model is not downloaded, and only words were searched. */
|
|
137
139
|
meaning: "searched" | "unavailable";
|
|
140
|
+
/** `out-of-time`: the word half hit its time limit, so the hits are by meaning alone. */
|
|
141
|
+
words?: "out-of-time";
|
|
138
142
|
hits: FoundConversation[];
|
|
139
143
|
readiness: SearchReadiness;
|
|
140
144
|
/** Kept for callers of 0.141.0 and before; `readiness.wordsOnly` says more. */
|
package/dist/services/index.d.ts
CHANGED
|
@@ -93,11 +93,13 @@ export { inboxService } from "./inbox.js";
|
|
|
93
93
|
export { readMail } from "./mail-search.js";
|
|
94
94
|
export { type MeetingHitSearchRequest, refreshMeetingIndex, searchMeetingHits } from "./meeting-hit-search.js";
|
|
95
95
|
export { type MeetingLink, type MeetingLinksRequest, readMeetingLinks } from "./meeting-links.js";
|
|
96
|
+
export { type MeetingEmbeddingOptions, type MeetingMeaning, type MeetingMeaningApi, type MeetingMeaningSearchOptions, type MeetingModelOptions, meetingMeaning, validateMeetingEmbeddings, validateMeetingMeaningSearch, validateMeetingModel, } from "./meeting-meaning.js";
|
|
96
97
|
export { createMeetingProjectCandidateReader } from "./meeting-project-candidates.js";
|
|
97
98
|
export { readMeetingProjectDiscovery } from "./meeting-project-discovery.js";
|
|
98
99
|
export { type MeetingReviewRequest, readMeetingReview } from "./meeting-review.js";
|
|
99
100
|
export { type MeetingSearchesService, type MeetingSearchParams, meetingSearchesService, type SavedMeetingSearch, } from "./meeting-searches.js";
|
|
100
101
|
export { type MeetingCountsRequest, type MeetingStatsRequest, readMeetingCounts, readMeetingStats, } from "./meeting-stats.js";
|
|
102
|
+
export { type MeetingTags, type MeetingTagTarget, meetingTags } from "./meeting-tags.js";
|
|
101
103
|
export { chatIdIn, storedChatId } from "./message-resolution.js";
|
|
102
104
|
export type { AroundWindow, FoundMessage, ListWindow, MessagesService, MessageTarget, Pinned, Reacted, SearchFound, SearchQuery, SendRequest, Starred, } from "./messages.js";
|
|
103
105
|
export { DELETE_AT_ONCE, messagesService } from "./messages.js";
|
package/dist/services/index.js
CHANGED
|
@@ -68,11 +68,13 @@ export { inboxService } from "./inbox.js";
|
|
|
68
68
|
export { readMail } from "./mail-search.js";
|
|
69
69
|
export { refreshMeetingIndex, searchMeetingHits } from "./meeting-hit-search.js";
|
|
70
70
|
export { readMeetingLinks } from "./meeting-links.js";
|
|
71
|
+
export { meetingMeaning, validateMeetingEmbeddings, validateMeetingMeaningSearch, validateMeetingModel, } from "./meeting-meaning.js";
|
|
71
72
|
export { createMeetingProjectCandidateReader } from "./meeting-project-candidates.js";
|
|
72
73
|
export { readMeetingProjectDiscovery } from "./meeting-project-discovery.js";
|
|
73
74
|
export { readMeetingReview } from "./meeting-review.js";
|
|
74
75
|
export { meetingSearchesService, } from "./meeting-searches.js";
|
|
75
76
|
export { readMeetingCounts, readMeetingStats, } from "./meeting-stats.js";
|
|
77
|
+
export { meetingTags } from "./meeting-tags.js";
|
|
76
78
|
export { chatIdIn, storedChatId } from "./message-resolution.js";
|
|
77
79
|
export { DELETE_AT_ONCE, messagesService } from "./messages.js";
|
|
78
80
|
export { searchStore } from "./messages-archive-search.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { MeetingHitSearchRequest } from "../meetings/index.js";
|
|
2
|
+
import type { MessageStore } from "../store/store.js";
|
|
3
|
+
export interface MeetingModelOptions {
|
|
4
|
+
model: string;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
dims?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface MeetingMeaningSearchOptions extends MeetingModelOptions {
|
|
9
|
+
/** Split new transcripts and embed passages that have no vector first. */
|
|
10
|
+
buildMissing?: boolean;
|
|
11
|
+
limit?: number;
|
|
12
|
+
maxChunks?: number;
|
|
13
|
+
/** The meetings both searches read: the word search's own filters, names unresolved. */
|
|
14
|
+
selection?: Omit<MeetingHitSearchRequest, "accountId" | "limit" | "after" | "maxReadBytes" | "signal">;
|
|
15
|
+
/** The previous page's cursor. */
|
|
16
|
+
after?: string;
|
|
17
|
+
maxRows?: number;
|
|
18
|
+
maxTextBytes?: number;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
export interface MeetingEmbeddingOptions extends MeetingModelOptions {
|
|
22
|
+
limit?: number;
|
|
23
|
+
maxRows?: number;
|
|
24
|
+
maxTextBytes?: number;
|
|
25
|
+
yes?: boolean;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
type Combined = Awaited<ReturnType<typeof import("./meeting-combined.js").searchMeetingsCombined>>;
|
|
29
|
+
export interface MeetingMeaning {
|
|
30
|
+
search: (query: string, options: MeetingMeaningSearchOptions) => Promise<Combined>;
|
|
31
|
+
generate: (options: MeetingEmbeddingOptions) => Promise<Record<string, unknown>>;
|
|
32
|
+
}
|
|
33
|
+
export declare const validateMeetingModel: (options: MeetingModelOptions) => void;
|
|
34
|
+
export declare const validateMeetingMeaningSearch: (query: string, options: MeetingMeaningSearchOptions) => void;
|
|
35
|
+
export declare const validateMeetingEmbeddings: (options: MeetingEmbeddingOptions) => void;
|
|
36
|
+
export type MeetingMeaningApi = Pick<typeof import("./meeting-model.js"), "meetingEmbeddingModel" | "createMeetingRemoteModel" | "openMeetingEmbedder"> & Pick<typeof import("./meeting-combined.js"), "searchMeetingsCombined"> & Pick<typeof import("./meeting-semantic.js"), "proposeMeetingEmbedding" | "applyMeetingEmbedding">;
|
|
37
|
+
/**
|
|
38
|
+
* Search by meaning and the vectors it reads, over one account's stored meetings. A local model keeps the
|
|
39
|
+
* transcripts on this computer; `baseUrl` sends passages to that service and is only ever chosen by the caller.
|
|
40
|
+
*/
|
|
41
|
+
export declare const meetingMeaning: (store: Pick<MessageStore, "meetings" | "meetingVectors"> & {
|
|
42
|
+
knowledge?: MessageStore["knowledge"];
|
|
43
|
+
}, accountId: number, options?: {
|
|
44
|
+
env?: NodeJS.ProcessEnv;
|
|
45
|
+
load?: () => Promise<MeetingMeaningApi>;
|
|
46
|
+
}) => MeetingMeaning;
|
|
47
|
+
export {};
|