@wirecat/cli-core 0.662.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 +213 -0
- package/dist/calendar/cli/bodies.js +2 -1
- package/dist/calendar/cli/index.js +13 -10
- package/dist/calendar/mcp/index.d.ts +3 -1
- package/dist/calendar/mcp/index.js +4 -4
- package/dist/cli/call-stats-command.d.ts +18 -0
- package/dist/cli/call-stats-command.js +52 -0
- 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/contract-templates.js +2 -0
- package/dist/cli/envelope.d.ts +0 -5
- package/dist/cli/envelope.js +25 -0
- package/dist/cli/index.d.ts +4 -1
- package/dist/cli/index.js +4 -1
- package/dist/cli/meeting-batch.d.ts +2 -1
- package/dist/cli/meeting-batch.js +7 -5
- 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-command.js +5 -5
- package/dist/cli/meeting-preparation-projects.d.ts +6 -0
- package/dist/cli/meeting-preparation-read.d.ts +11 -5
- package/dist/cli/meeting-preparation-read.js +13 -21
- package/dist/cli/meeting-series-inventory-command.js +2 -2
- package/dist/cli/meeting-series-inventory-read.d.ts +2 -2
- package/dist/cli/meeting-series-inventory-read.js +7 -15
- package/dist/cli/meeting-tags-command.d.ts +18 -0
- package/dist/cli/meeting-tags-command.js +74 -0
- package/dist/cli/messenger/admin-statistics-command.js +2 -2
- 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/counters-command.js +2 -2
- package/dist/cli/messenger/media-archive-command.js +5 -4
- package/dist/cli/messenger/media-archive-move-command.js +1 -1
- package/dist/cli/messenger/media-archive-timer-command.js +5 -4
- package/dist/cli/messenger/metadata-command.js +3 -3
- package/dist/cli/messenger/models-command.js +7 -0
- package/dist/cli/messenger/rankings-command.js +3 -3
- package/dist/cli/messenger/records-command.d.ts +4 -1
- package/dist/cli/messenger/records-command.js +6 -1
- package/dist/cli/messenger/tags-command.js +7 -2
- package/dist/cli/messenger/tasks-command.js +2 -2
- package/dist/cli/model-catalogue-command.js +2 -0
- package/dist/cli/paging.d.ts +10 -0
- package/dist/cli/paging.js +29 -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/cli/runs/command.js +6 -4
- package/dist/cli/runs/search-command.js +9 -5
- package/dist/cli/schedule/schedule-command.js +1 -5
- package/dist/domain/links.d.ts +11 -0
- package/dist/domain/links.js +4 -0
- package/dist/domain/moment.d.ts +29 -0
- package/dist/domain/moment.js +58 -0
- package/dist/domain/providers.d.ts +6 -4
- package/dist/domain/providers.js +10 -5
- package/dist/domain/send-time.d.ts +3 -4
- package/dist/domain/send-time.js +10 -24
- package/dist/entities/chat-sending.d.ts +10 -0
- package/dist/entities/chat-sending.js +11 -0
- package/dist/entities/fields.d.ts +2 -2
- package/dist/entities/fields.js +2 -2
- package/dist/entities/index.d.ts +135 -2
- package/dist/entities/index.js +8 -3
- 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 -2
- package/dist/mail/cli/index.js +4 -2
- package/dist/mail/facts.d.ts +5 -2
- package/dist/mail/facts.js +6 -3
- package/dist/mail/index.d.ts +1 -1
- package/dist/mail/meeting-notes.js +1 -1
- package/dist/mail/probe.d.ts +5 -2
- package/dist/mail/probe.js +9 -5
- package/dist/mail/server-search.js +1 -1
- package/dist/mail/sync.js +1 -1
- package/dist/mcp/meeting-preparation.d.ts +6 -0
- package/dist/mcp/meeting-preparation.js +1 -1
- package/dist/mcp/meeting-series-inventory.js +1 -1
- package/dist/mcp/prompts.js +6 -9
- package/dist/meetings/answers.d.ts +7 -0
- package/dist/meetings/answers.js +4 -0
- package/dist/meetings/call-answers.d.ts +106 -0
- package/dist/meetings/call-answers.js +171 -0
- package/dist/meetings/call-stats.d.ts +121 -0
- package/dist/meetings/call-stats.js +211 -0
- package/dist/meetings/calls.d.ts +76 -0
- package/dist/meetings/calls.js +78 -0
- package/dist/meetings/cli/index.d.ts +8 -0
- package/dist/meetings/cli/index.js +10 -22
- package/dist/meetings/cli/search.d.ts +9 -2
- package/dist/meetings/cli/search.js +16 -26
- package/dist/meetings/index.d.ts +4 -0
- package/dist/meetings/index.js +4 -0
- package/dist/meetings/mcp/index.d.ts +6 -3
- package/dist/meetings/mcp/index.js +2 -4
- package/dist/meetings/mcp/search.d.ts +12 -1
- package/dist/meetings/mcp/search.js +3 -3
- package/dist/meetings/project-evidence-answer.d.ts +6 -0
- package/dist/meetings/read-through.d.ts +2 -1
- package/dist/meetings/read-through.js +10 -1
- package/dist/meetings/stats.d.ts +3 -0
- package/dist/meetings/stats.js +3 -3
- package/dist/meetings/tag-answers.d.ts +43 -0
- package/dist/meetings/tag-answers.js +41 -0
- package/dist/meetings/testing/index.d.ts +1 -0
- package/dist/meetings/testing/index.js +1 -0
- package/dist/meetings/testing/paging.d.ts +6 -0
- package/dist/meetings/testing/paging.js +5 -0
- package/dist/models/chat-sending.d.ts +24 -0
- package/dist/models/chat-sending.js +40 -0
- package/dist/moderation/rules.d.ts +2 -0
- package/dist/moderation/rules.js +16 -2
- package/dist/runs/events.d.ts +1 -1
- package/dist/search/fusion.d.ts +17 -0
- package/dist/search/fusion.js +17 -0
- package/dist/search/lucene/resolved.d.ts +2 -0
- package/dist/search/question-plan.d.ts +4 -0
- package/dist/search/question-plan.js +7 -0
- package/dist/search/service-query.d.ts +6 -1
- package/dist/search/service-query.js +9 -1
- package/dist/search/task-similarity.d.ts +1 -0
- package/dist/search/task-similarity.js +1 -1
- package/dist/services/agenda-mail.js +2 -1
- package/dist/services/agenda.js +5 -3
- package/dist/services/attachments.js +4 -2
- package/dist/services/call-stats.d.ts +17 -0
- package/dist/services/call-stats.js +41 -0
- package/dist/services/chats.js +4 -2
- package/dist/services/conversations.js +4 -2
- package/dist/services/deps.d.ts +1 -1
- package/dist/services/document-source.d.ts +1 -1
- package/dist/services/document-source.js +4 -3
- package/dist/services/documents/ingestion.js +11 -40
- package/dist/services/documents/plan.d.ts +1 -1
- package/dist/services/documents/plan.js +30 -17
- package/dist/services/documents/ports.d.ts +5 -0
- package/dist/services/documents/sync.js +1 -1
- package/dist/services/embeddings-search.js +39 -9
- package/dist/services/embeddings.d.ts +4 -0
- package/dist/services/events-search.js +2 -1
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.js +3 -0
- package/dist/services/mail-search.d.ts +1 -1
- package/dist/services/mail-search.js +10 -11
- package/dist/services/media-archive-move.js +2 -4
- package/dist/services/media-archive.d.ts +0 -1
- package/dist/services/media-archive.js +2 -12
- package/dist/services/meeting-combined.js +1 -1
- 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-combined.js +15 -4
- package/dist/services/messages-discovery.js +2 -2
- package/dist/services/moderation.js +10 -2
- package/dist/services/moment.d.ts +4 -10
- package/dist/services/moment.js +16 -44
- package/dist/services/notes-search.d.ts +0 -2
- package/dist/services/notes-search.js +1 -2
- package/dist/services/search-all.js +2 -1
- package/dist/services/tags.js +4 -2
- package/dist/services/task-stats.js +2 -2
- package/dist/services/tasks.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/accounts.js +2 -1
- package/dist/store/sqlite/account-purge.d.ts +3 -0
- package/dist/store/sqlite/account-purge.js +143 -0
- package/dist/store/sqlite/accounts.d.ts +0 -2
- package/dist/store/sqlite/accounts.js +2 -134
- package/dist/store/sqlite/calendar.d.ts +1 -0
- package/dist/store/sqlite/calendar.js +5 -5
- package/dist/store/sqlite/catalog.js +2 -16
- package/dist/store/sqlite/chats.js +2 -1
- package/dist/store/sqlite/context-document-source.d.ts +3 -3
- package/dist/store/sqlite/context-document-source.js +9 -7
- package/dist/store/sqlite/context-evidence.js +9 -3
- package/dist/store/sqlite/document-listing.js +2 -1
- 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/events.js +2 -1
- package/dist/store/sqlite/file-note.d.ts +6 -0
- package/dist/store/sqlite/file-note.js +15 -0
- package/dist/store/sqlite/files.d.ts +3 -2
- package/dist/store/sqlite/files.js +5 -3
- package/dist/store/sqlite/identities.js +2 -1
- package/dist/store/sqlite/imported-documents.js +2 -2
- package/dist/store/sqlite/knowledge.d.ts +1 -1
- package/dist/store/sqlite/knowledge.js +27 -23
- 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/lucene-fields.js +8 -12
- package/dist/store/sqlite/mail-rules.js +2 -1
- package/dist/store/sqlite/meeting-calls.d.ts +4 -0
- package/dist/store/sqlite/meeting-calls.js +66 -0
- package/dist/store/sqlite/meetings.d.ts +2 -2
- package/dist/store/sqlite/meetings.js +4 -1
- package/dist/store/sqlite/mention-sources.js +2 -1
- package/dist/store/sqlite/mentions.js +2 -2
- package/dist/store/sqlite/messages.js +6 -1
- package/dist/store/sqlite/note-search.js +8 -11
- package/dist/store/sqlite/notes.d.ts +3 -1
- package/dist/store/sqlite/notes.js +25 -14
- package/dist/store/sqlite/organizations.js +2 -2
- package/dist/store/sqlite/people-list.js +3 -3
- package/dist/store/sqlite/query-filter.d.ts +3 -3
- package/dist/store/sqlite/query-filter.js +3 -3
- package/dist/store/sqlite/reads.d.ts +4 -4
- package/dist/store/sqlite/reads.js +4 -4
- package/dist/store/sqlite/search.js +11 -7
- package/dist/store/sqlite/test-accounts.js +1 -1
- package/dist/store/sqlite/trigram-match.d.ts +9 -0
- package/dist/store/sqlite/trigram-match.js +28 -0
- package/dist/store/sqlite/work-tasks.js +1 -1
- package/package.json +18 -3
- package/parity.json +20 -1
- package/skills/link-conversations/SKILL.md +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
const bounded = (value, maximum) => value === undefined || (Number.isSafeInteger(value) && value > 0 && value <= maximum);
|
|
3
|
+
export const validateMeetingModel = (options) => {
|
|
4
|
+
if (typeof options.model !== "string" || !options.model.trim() || options.model.length > 1000)
|
|
5
|
+
throw new CliError("validation_error", "select an explicit embedding model");
|
|
6
|
+
if (options.baseUrl === undefined) {
|
|
7
|
+
if (options.dims !== undefined)
|
|
8
|
+
throw new CliError("validation_error", "dimensions require an explicit remote base URL");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let url;
|
|
12
|
+
try {
|
|
13
|
+
url = new URL(options.baseUrl);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
throw new CliError("validation_error", "embedding base URL must be an HTTP or HTTPS URL");
|
|
17
|
+
}
|
|
18
|
+
if (!["http:", "https:"].includes(url.protocol) ||
|
|
19
|
+
url.username ||
|
|
20
|
+
url.password ||
|
|
21
|
+
url.search ||
|
|
22
|
+
url.hash ||
|
|
23
|
+
!/^[\w./:-]{1,200}$/.test(options.model) ||
|
|
24
|
+
options.dims === undefined ||
|
|
25
|
+
!bounded(options.dims, 8192))
|
|
26
|
+
throw new CliError("validation_error", "remote embeddings require an HTTP base URL without credentials and explicit dimensions");
|
|
27
|
+
};
|
|
28
|
+
export const validateMeetingMeaningSearch = (query, options) => {
|
|
29
|
+
validateMeetingModel(options);
|
|
30
|
+
if (typeof query !== "string" ||
|
|
31
|
+
!query.trim() ||
|
|
32
|
+
Buffer.byteLength(query, "utf8") > 65536 ||
|
|
33
|
+
!bounded(options.limit, 1000) ||
|
|
34
|
+
!bounded(options.maxChunks, 100000) ||
|
|
35
|
+
!bounded(options.maxRows, 100000) ||
|
|
36
|
+
!bounded(options.maxTextBytes, 64 * 1024 * 1024))
|
|
37
|
+
throw new CliError("validation_error", "meeting semantic search requires a nonempty bounded query and positive limits");
|
|
38
|
+
};
|
|
39
|
+
export const validateMeetingEmbeddings = (options) => {
|
|
40
|
+
validateMeetingModel(options);
|
|
41
|
+
if (!bounded(options.limit, 1000) ||
|
|
42
|
+
!bounded(options.maxRows, 100000) ||
|
|
43
|
+
!bounded(options.maxTextBytes, 64 * 1024 * 1024))
|
|
44
|
+
throw new CliError("validation_error", "meeting embedding generation requires valid bounded limits");
|
|
45
|
+
};
|
|
46
|
+
// The embedding runtime is heavy; a command that never asks for meaning never loads it.
|
|
47
|
+
const loadApi = async () => {
|
|
48
|
+
const [model, combined, semantic] = await Promise.all([
|
|
49
|
+
import("./meeting-model.js"),
|
|
50
|
+
import("./meeting-combined.js"),
|
|
51
|
+
import("./meeting-semantic.js"),
|
|
52
|
+
]);
|
|
53
|
+
return { ...model, ...combined, ...semantic };
|
|
54
|
+
};
|
|
55
|
+
const checkCancelled = (signal) => {
|
|
56
|
+
if (!signal?.aborted)
|
|
57
|
+
return;
|
|
58
|
+
if (signal.reason instanceof CliError)
|
|
59
|
+
throw signal.reason;
|
|
60
|
+
const timedOut = signal.reason instanceof Error && signal.reason.name === "TimeoutError";
|
|
61
|
+
throw new CliError(timedOut ? "timeout" : "cancelled", timedOut ? "command timed out" : "command cancelled");
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Search by meaning and the vectors it reads, over one account's stored meetings. A local model keeps the
|
|
65
|
+
* transcripts on this computer; `baseUrl` sends passages to that service and is only ever chosen by the caller.
|
|
66
|
+
*/
|
|
67
|
+
export const meetingMeaning = (store, accountId, options = {}) => {
|
|
68
|
+
if (!Number.isSafeInteger(accountId) || accountId < 1)
|
|
69
|
+
throw new CliError("validation_error", "meeting vectors require a selected positive account ID");
|
|
70
|
+
const load = options.load ?? loadApi;
|
|
71
|
+
const choice = (api, input) => input.baseUrl === undefined
|
|
72
|
+
? input.model
|
|
73
|
+
: { remote: api.createMeetingRemoteModel({ model: input.model, baseUrl: input.baseUrl, dims: input.dims }) };
|
|
74
|
+
const budget = (input) => ({
|
|
75
|
+
maxRows: input.maxRows,
|
|
76
|
+
maxTextBytes: input.maxTextBytes,
|
|
77
|
+
signal: input.signal,
|
|
78
|
+
});
|
|
79
|
+
// rebuild has no "new transcripts only" mode, so every pass splits every current transcript again; only
|
|
80
|
+
// passages without a vector for this model reach the embedder.
|
|
81
|
+
const splitAll = async (input) => {
|
|
82
|
+
let afterTranscriptId;
|
|
83
|
+
let pages = 0;
|
|
84
|
+
for (;;) {
|
|
85
|
+
checkCancelled(input.signal);
|
|
86
|
+
const page = await store.meetingVectors.rebuild({ accountId, limit: 1000, afterTranscriptId, ...budget(input) });
|
|
87
|
+
pages += 1;
|
|
88
|
+
if (!page.hasMore || page.nextTranscriptId === undefined)
|
|
89
|
+
return { pages };
|
|
90
|
+
afterTranscriptId = page.nextTranscriptId;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const buildMissing = async (api, embedder, input) => {
|
|
94
|
+
await splitAll(input);
|
|
95
|
+
let afterHash;
|
|
96
|
+
for (;;) {
|
|
97
|
+
checkCancelled(input.signal);
|
|
98
|
+
const batch = await api.applyMeetingEmbedding(store.meetingVectors, accountId, embedder, {
|
|
99
|
+
afterHash,
|
|
100
|
+
...budget(input),
|
|
101
|
+
});
|
|
102
|
+
if (!batch.hasMore || batch.nextHash === undefined)
|
|
103
|
+
return;
|
|
104
|
+
afterHash = batch.nextHash;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
search: async (query, input) => {
|
|
109
|
+
validateMeetingMeaningSearch(query, input);
|
|
110
|
+
checkCancelled(input.signal);
|
|
111
|
+
const api = await load();
|
|
112
|
+
checkCancelled(input.signal);
|
|
113
|
+
const embedder = await api.openMeetingEmbedder(choice(api, input), { env: options.env, signal: input.signal });
|
|
114
|
+
try {
|
|
115
|
+
if (input.buildMissing)
|
|
116
|
+
await buildMissing(api, embedder, input);
|
|
117
|
+
return await api.searchMeetingsCombined(store, embedder, query, {
|
|
118
|
+
...input.selection,
|
|
119
|
+
accountId,
|
|
120
|
+
...(input.limit === undefined ? {} : { limit: input.limit }),
|
|
121
|
+
...(input.after === undefined ? {} : { after: input.after }),
|
|
122
|
+
...(input.maxChunks === undefined ? {} : { maxChunks: input.maxChunks }),
|
|
123
|
+
...(input.maxRows === undefined ? {} : { maxRows: input.maxRows }),
|
|
124
|
+
...(input.maxTextBytes === undefined ? {} : { maxTextBytes: input.maxTextBytes }),
|
|
125
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
await embedder.close();
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
generate: async (input) => {
|
|
133
|
+
validateMeetingEmbeddings(input);
|
|
134
|
+
checkCancelled(input.signal);
|
|
135
|
+
const api = await load();
|
|
136
|
+
checkCancelled(input.signal);
|
|
137
|
+
const selected = choice(api, input);
|
|
138
|
+
const descriptor = api.meetingEmbeddingModel(selected, options.env);
|
|
139
|
+
if (input.yes !== true)
|
|
140
|
+
return api.proposeMeetingEmbedding(store.meetingVectors, accountId, descriptor, { signal: input.signal });
|
|
141
|
+
const embedder = await api.openMeetingEmbedder(selected, { env: options.env, signal: input.signal });
|
|
142
|
+
try {
|
|
143
|
+
checkCancelled(input.signal);
|
|
144
|
+
// Passages that already have a vector are never offered again, so the next run takes the next batch.
|
|
145
|
+
const rebuild = await splitAll(input);
|
|
146
|
+
checkCancelled(input.signal);
|
|
147
|
+
const result = await api.applyMeetingEmbedding(store.meetingVectors, accountId, embedder, {
|
|
148
|
+
maxChunks: input.limit,
|
|
149
|
+
...budget(input),
|
|
150
|
+
});
|
|
151
|
+
return { ...result, applied: true, model: descriptor, rebuild };
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
await embedder.close();
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { MeetingTagChange, MeetingTagged } from "../meetings/index.js";
|
|
2
|
+
import type { MessageStore } from "../store/store.js";
|
|
3
|
+
/** The meetings a tag change acts on: these store ids, or every meeting with a hit of a `search meetings` query. */
|
|
4
|
+
export type MeetingTagTarget = {
|
|
5
|
+
meetings: number[];
|
|
6
|
+
} | {
|
|
7
|
+
matching: string;
|
|
8
|
+
};
|
|
9
|
+
export interface MeetingTags {
|
|
10
|
+
add(target: MeetingTagTarget, tags: string[], signal?: AbortSignal): Promise<MeetingTagChange>;
|
|
11
|
+
remove(target: MeetingTagTarget, tags: string[], signal?: AbortSignal): Promise<MeetingTagChange>;
|
|
12
|
+
list(request: {
|
|
13
|
+
tag?: string;
|
|
14
|
+
limit: number;
|
|
15
|
+
offset: number;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
items: MeetingTagged[];
|
|
18
|
+
hasMore: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
type Store = Pick<MessageStore, "meetings" | "knowledge">;
|
|
22
|
+
/**
|
|
23
|
+
* The owner's labels on one account's meetings, kept in the store's taggings like every other tag, so `--tag` and
|
|
24
|
+
* `tag:` in `search meetings` select them. A mark stays when a new transcript no longer says the words.
|
|
25
|
+
*/
|
|
26
|
+
export declare const meetingTags: (store: Store, accountId: number) => MeetingTags;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { normalizeTag } from "../domain/tags.js";
|
|
3
|
+
import { searchMeetingHits } from "./meeting-hit-search.js";
|
|
4
|
+
const keyOf = async (store, accountId) => {
|
|
5
|
+
const owner = await store.meetings.account(accountId);
|
|
6
|
+
if (!owner)
|
|
7
|
+
throw new CliError("not_found", `meeting account ${accountId} is not in the store`);
|
|
8
|
+
return { provider: owner.provider, account: owner.account };
|
|
9
|
+
};
|
|
10
|
+
const tagsOf = (given) => {
|
|
11
|
+
if (given.length === 0)
|
|
12
|
+
throw new CliError("validation_error", "name at least one tag");
|
|
13
|
+
return [...new Set(given.map(normalizeTag))];
|
|
14
|
+
};
|
|
15
|
+
/** Every page of the search, so a word said in a thousand calls marks all of them; hits come one per line. */
|
|
16
|
+
const matchedMeetings = async (store, accountId, query, signal) => {
|
|
17
|
+
const found = new Set();
|
|
18
|
+
let after;
|
|
19
|
+
for (;;) {
|
|
20
|
+
const page = await searchMeetingHits(store, query, {
|
|
21
|
+
accountId,
|
|
22
|
+
limit: 1000,
|
|
23
|
+
...(after === undefined ? {} : { after }),
|
|
24
|
+
...(signal ? { signal } : {}),
|
|
25
|
+
});
|
|
26
|
+
for (const hit of page.items)
|
|
27
|
+
found.add(hit.meetingId);
|
|
28
|
+
if (!page.hasMore || page.nextCursor === null)
|
|
29
|
+
return [...found];
|
|
30
|
+
after = page.nextCursor;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const meetingsOf = async (store, accountId, target, signal) => {
|
|
34
|
+
if ("matching" in target)
|
|
35
|
+
return matchedMeetings(store, accountId, target.matching, signal);
|
|
36
|
+
const ids = [...new Set(target.meetings)];
|
|
37
|
+
// A meeting of another account is not found, as if it were not stored.
|
|
38
|
+
for (const meetingId of ids)
|
|
39
|
+
await store.meetings.meetingMetadata({ accountId, meetingId, ...(signal ? { signal } : {}) });
|
|
40
|
+
return ids;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The owner's labels on one account's meetings, kept in the store's taggings like every other tag, so `--tag` and
|
|
44
|
+
* `tag:` in `search meetings` select them. A mark stays when a new transcript no longer says the words.
|
|
45
|
+
*/
|
|
46
|
+
export const meetingTags = (store, accountId) => {
|
|
47
|
+
const change = (operation) => async (target, given, signal) => {
|
|
48
|
+
const tags = tagsOf(given);
|
|
49
|
+
const key = await keyOf(store, accountId);
|
|
50
|
+
const meetings = await meetingsOf(store, accountId, target, signal);
|
|
51
|
+
const changed = [];
|
|
52
|
+
for (const meetingId of meetings) {
|
|
53
|
+
signal?.throwIfAborted();
|
|
54
|
+
const done = await store.knowledge[operation](key, { type: "meeting", id: String(meetingId) }, tags);
|
|
55
|
+
if (done.length > 0)
|
|
56
|
+
changed.push({ meetingId, tags: done });
|
|
57
|
+
}
|
|
58
|
+
return { accountId, tags, matched: meetings.length, changed };
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
add: change("addTags"),
|
|
62
|
+
remove: change("removeTags"),
|
|
63
|
+
list: async ({ tag, limit, offset }) => {
|
|
64
|
+
const key = await keyOf(store, accountId);
|
|
65
|
+
const found = await store.knowledge.labelled(key, {
|
|
66
|
+
type: "meeting",
|
|
67
|
+
...(tag === undefined ? {} : { tag: normalizeTag(tag) }),
|
|
68
|
+
limit,
|
|
69
|
+
offset,
|
|
70
|
+
});
|
|
71
|
+
const items = [];
|
|
72
|
+
for (const { target, tags } of found.items) {
|
|
73
|
+
if (target.type !== "meeting")
|
|
74
|
+
continue;
|
|
75
|
+
const meeting = await store.meetings.meetingMetadata({ accountId, meetingId: Number(target.id) });
|
|
76
|
+
items.push({ accountId, meetingId: meeting.id, title: meeting.title, startedAt: meeting.startedAt, tags });
|
|
77
|
+
}
|
|
78
|
+
return { items, hasMore: found.hasMore };
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -5,6 +5,7 @@ import { correctWords } from "../search/correct.js";
|
|
|
5
5
|
import { PRESET_VERSION } from "../search/lucene/presets.js";
|
|
6
6
|
import { FIELD_VERSION } from "../search/lucene/registry.js";
|
|
7
7
|
import { exhausted, outOfTime, QUERY_LIMITS } from "../search/lucene/types.js";
|
|
8
|
+
import { isFunctionWord } from "../search/question-plan.js";
|
|
8
9
|
import { normalize } from "../store/normalize.js";
|
|
9
10
|
import { withExcerpt } from "./excerpt.js";
|
|
10
11
|
import { coverageOf, prepareLucene } from "./messages-search.js";
|
|
@@ -53,6 +54,16 @@ export const searchCombined = async (store, account, request, messenger = {}, op
|
|
|
53
54
|
: new Map();
|
|
54
55
|
check();
|
|
55
56
|
const bySpan = new Map(eligible.map((leaf) => [leaf.span.start, leaf]));
|
|
57
|
+
const widenable = (node) => node.kind === "predicate" &&
|
|
58
|
+
bySpan.has(node.span.start) &&
|
|
59
|
+
[...normalize(node.value)].length >= 3 &&
|
|
60
|
+
!isFunctionWord(normalize(node.value));
|
|
61
|
+
const beginning = (node) => ({
|
|
62
|
+
...node,
|
|
63
|
+
operator: "wildcard",
|
|
64
|
+
value: `${normalize(node.value)}*`,
|
|
65
|
+
widened: true,
|
|
66
|
+
});
|
|
56
67
|
const transform = (node, source, exact = false) => {
|
|
57
68
|
if (node.kind === "boolean")
|
|
58
69
|
return {
|
|
@@ -63,8 +74,8 @@ export const searchCombined = async (store, account, request, messenger = {}, op
|
|
|
63
74
|
return { ...node, field: "exact" };
|
|
64
75
|
if (!bySpan.has(node.span.start))
|
|
65
76
|
return node;
|
|
66
|
-
if (source === "beginnings" &&
|
|
67
|
-
return
|
|
77
|
+
if (source === "beginnings" && widenable(node))
|
|
78
|
+
return beginning(node);
|
|
68
79
|
if (source !== "corrected")
|
|
69
80
|
return node;
|
|
70
81
|
const fixes = corrections.get(normalize(node.value));
|
|
@@ -98,8 +109,8 @@ export const searchCombined = async (store, account, request, messenger = {}, op
|
|
|
98
109
|
const fixedPrefixRoot = transform(execution.root, "corrected");
|
|
99
110
|
const correctedBeginnings = (node) => node.kind === "boolean"
|
|
100
111
|
? { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: correctedBeginnings(clause.node) })) }
|
|
101
|
-
:
|
|
102
|
-
? { ...node, field: "exact"
|
|
112
|
+
: widenable(node)
|
|
113
|
+
? { ...beginning(node), field: "exact" }
|
|
103
114
|
: node;
|
|
104
115
|
const fixedPrefix = corrections.size
|
|
105
116
|
? await read(correctedBeginnings(fixedPrefixRoot), depth)
|
|
@@ -4,7 +4,7 @@ import { parseLocator } from "../domain/locator.js";
|
|
|
4
4
|
import { fieldsOfQuery, meaningWords } from "../search/lucene/meaning-parts.js";
|
|
5
5
|
import { validateFields } from "../search/lucene/registry.js";
|
|
6
6
|
import { exhausted, MESSAGE_PARSING, outOfTime, QUERY_LIMITS } from "../search/lucene/types.js";
|
|
7
|
-
import { anyOfTerms, lookupTerms, planQuestion, questionText, words } from "../search/question-plan.js";
|
|
7
|
+
import { anyOfTerms, joinedHyphens, lookupTerms, planQuestion, questionText, words } from "../search/question-plan.js";
|
|
8
8
|
import { searchCombined } from "./messages-combined.js";
|
|
9
9
|
import { prepareLucene, searchLucene } from "./messages-search.js";
|
|
10
10
|
/** How many of the messages nearest in meaning join the fusion: the benchmark's pool (performance/search/evidence-pipeline). */
|
|
@@ -71,7 +71,7 @@ export const searchDiscovery = async (store, account, asked, messenger = {}, mea
|
|
|
71
71
|
const question = root === undefined ? text : meaningWords(root);
|
|
72
72
|
if (!question)
|
|
73
73
|
return searchLucene(store, account, request, messenger);
|
|
74
|
-
const terms = root === undefined ? lookupTerms(plan) :
|
|
74
|
+
const terms = [...new Set([...(root === undefined ? lookupTerms(plan) : words(question)), ...joinedHyphens(text)])];
|
|
75
75
|
if (!terms.length)
|
|
76
76
|
return searchLucene(store, account, request, messenger);
|
|
77
77
|
if (terms.length > 64)
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { gather, MAX_ACTIONS } from "../moderation/check.js";
|
|
3
|
-
import { defaultRules, ModerationRules, moderationPathFor } from "../moderation/rules.js";
|
|
3
|
+
import { defaultRules, ModerationRules, moderationPathFor, moderationProfiles, } from "../moderation/rules.js";
|
|
4
4
|
import { moderateWith } from "../moderation/run.js";
|
|
5
5
|
import { capability } from "../ports/messenger.js";
|
|
6
6
|
import { guardedWrite } from "../sends/guarded.js";
|
|
7
7
|
import { newOperationId } from "../sends/send-id.js";
|
|
8
8
|
export const moderationService = (deps) => {
|
|
9
|
-
|
|
9
|
+
// Checked at first use, not here: every service is built for every command, most of them without a profile.
|
|
10
|
+
const file = () => {
|
|
11
|
+
const env = deps.env ?? process.env;
|
|
12
|
+
if (deps.profile === undefined) {
|
|
13
|
+
const choices = moderationProfiles(deps.messenger.app, env);
|
|
14
|
+
throw new CliError("validation_error", `name a profile: moderation rules are kept per profile — ${choices.length ? `profiles here: ${choices.join(", ")}` : "there is none on this computer yet"}`, { profiles: choices });
|
|
15
|
+
}
|
|
16
|
+
return new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile, env));
|
|
17
|
+
};
|
|
10
18
|
const group = async (chat) => {
|
|
11
19
|
if (deps.offline)
|
|
12
20
|
throw new CliError("validation_error", "a group's rules are kept by its id, which the messenger gives");
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { type MomentZone } from "../domain/moment.js";
|
|
1
|
+
import { aheadOf, type MomentZone } from "../domain/moment.js";
|
|
2
2
|
export type { MomentZone };
|
|
3
|
-
|
|
4
|
-
export declare const isMoment: (reference: string) => boolean;
|
|
3
|
+
export { aheadOf };
|
|
5
4
|
/**
|
|
6
|
-
* `--since` as a moment
|
|
7
|
-
*
|
|
5
|
+
* `--since` as a moment, in the shared time grammar (`readMoment`). Unlike max-cli, never a message id — a MAX id
|
|
6
|
+
* carries its time, and a Telegram id is only a counter within one chat.
|
|
8
7
|
*/
|
|
9
8
|
export declare const momentOf: (reference: string, flag?: string, now?: number, at?: MomentZone) => number;
|
|
10
|
-
/**
|
|
11
|
-
* A time ahead, for a due date or the next check: ISO 8601, or `30m`, `2h`, `3d` from now. `none`
|
|
12
|
-
* is not a time; a caller that clears a date checks for it first.
|
|
13
|
-
*/
|
|
14
|
-
export declare const aheadOf: (reference: string, flag: string, now?: number, at?: MomentZone) => number;
|
|
15
9
|
export interface DateWindow {
|
|
16
10
|
since?: number;
|
|
17
11
|
until?: number;
|
package/dist/services/moment.js
CHANGED
|
@@ -1,54 +1,26 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import { timezoneOf } from "@wirecat/cli-base/query";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return AGO.test(wanted) || DATE.test(wanted);
|
|
3
|
+
import { aheadOf, readMoment } from "../domain/moment.js";
|
|
4
|
+
export { aheadOf };
|
|
5
|
+
const read = (reference, flag, now, at) => {
|
|
6
|
+
const found = readMoment(reference, flag, { ...at, now });
|
|
7
|
+
if (found === undefined)
|
|
8
|
+
throw new CliError("validation_error", `${flag} takes an ISO 8601 time, today, yesterday, or 30m, 2h, 1d ago — not "${reference.trim()}"`);
|
|
9
|
+
return found;
|
|
11
10
|
};
|
|
12
11
|
/**
|
|
13
|
-
* `--since` as a moment
|
|
14
|
-
*
|
|
12
|
+
* `--since` as a moment, in the shared time grammar (`readMoment`). Unlike max-cli, never a message id — a MAX id
|
|
13
|
+
* carries its time, and a Telegram id is only a counter within one chat.
|
|
15
14
|
*/
|
|
16
|
-
export const momentOf = (reference, flag = "--since", now = Date.now(), at = {}) =>
|
|
17
|
-
const wanted = reference.trim();
|
|
18
|
-
const [, amount, unit] = AGO.exec(wanted) ?? [];
|
|
19
|
-
// By shape: `Date.parse("12345")` is the year 12345, so a message id would pass as a date.
|
|
20
|
-
const time = amount && unit
|
|
21
|
-
? now - Number(amount) * (AGO_MS[unit] ?? 0)
|
|
22
|
-
: DATE.test(wanted)
|
|
23
|
-
? calendarMoment(wanted, flag, at)
|
|
24
|
-
: Number.NaN;
|
|
25
|
-
if (Number.isNaN(time)) {
|
|
26
|
-
throw new CliError("validation_error", `${flag} takes an ISO 8601 time or 30m, 2h, 1d ago — not "${wanted}"`);
|
|
27
|
-
}
|
|
28
|
-
return time;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* A time ahead, for a due date or the next check: ISO 8601, or `30m`, `2h`, `3d` from now. `none`
|
|
32
|
-
* is not a time; a caller that clears a date checks for it first.
|
|
33
|
-
*/
|
|
34
|
-
export const aheadOf = (reference, flag, now = Date.now(), at = {}) => {
|
|
35
|
-
const wanted = reference.trim();
|
|
36
|
-
const [, amount, unit] = AGO.exec(wanted) ?? [];
|
|
37
|
-
const time = amount && unit
|
|
38
|
-
? now + Number(amount) * (AGO_MS[unit] ?? 0)
|
|
39
|
-
: DATE.test(wanted)
|
|
40
|
-
? calendarMoment(wanted, flag, at)
|
|
41
|
-
: Number.NaN;
|
|
42
|
-
if (Number.isNaN(time)) {
|
|
43
|
-
throw new CliError("validation_error", `${flag} takes an ISO 8601 time or 30m, 2h, 3d from now — not "${wanted}"`);
|
|
44
|
-
}
|
|
45
|
-
return time;
|
|
46
|
-
};
|
|
15
|
+
export const momentOf = (reference, flag = "--since", now = Date.now(), at = {}) => read(reference, flag, now, at).time;
|
|
47
16
|
/** `--since-time` and `--until-time` together, as the filter and the `meta` an answer reports it by. */
|
|
48
17
|
export const dateWindow = ({ sinceTime, untilTime, zone, now = Date.now(), names = ["--since-time", "--until-time"], }) => {
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
18
|
+
const at = zone === undefined ? {} : { zone };
|
|
19
|
+
const lower = sinceTime === undefined ? undefined : read(sinceTime, names[0], now, at);
|
|
20
|
+
const upper = untilTime === undefined ? undefined : read(untilTime, names[1], now, { ...at, end: true });
|
|
21
|
+
const since = lower?.time;
|
|
22
|
+
const until = upper?.time;
|
|
23
|
+
const readInZone = lower?.local === true || upper?.local === true;
|
|
52
24
|
const window = {
|
|
53
25
|
...(since === undefined ? {} : { since: new Date(since).toISOString() }),
|
|
54
26
|
...(until === undefined ? {} : { until: new Date(until).toISOString() }),
|
|
@@ -179,8 +179,6 @@ export interface NotesQuery {
|
|
|
179
179
|
/** An open picture embedder, for tests and callers that keep one; opened and closed here when absent. */
|
|
180
180
|
pictureEmbedder?: PictureEmbedder;
|
|
181
181
|
}
|
|
182
|
-
/** Reciprocal rank fusion's usual constant, as conversations use. */
|
|
183
|
-
export declare const RRF_K = 60;
|
|
184
182
|
/**
|
|
185
183
|
* A `source:` every hit must match, and the query without it. The meaning half and the picture lane cannot read a
|
|
186
184
|
* field, so they get the source and the rest of the words; the words half still compiles the field itself.
|
|
@@ -6,6 +6,7 @@ import { defaultThreads, isTextModelInstalled, openEmbedder, textModelsDirectory
|
|
|
6
6
|
import { chosenTextModel, meaningFloor, textModel, vectorModelKey } from "../embeddings/models.js";
|
|
7
7
|
import { DEFAULT_IMAGE_MODEL, imageModel } from "../images/picture/models.js";
|
|
8
8
|
import { entriesOfList, fitting, sourceOf } from "../search/account-list.js";
|
|
9
|
+
import { RRF_K } from "../search/fusion.js";
|
|
9
10
|
import { OWNER_NOTES } from "../search/groups.js";
|
|
10
11
|
import { fieldsOfQuery as fieldsOf, meaningWords } from "../search/lucene/meaning-parts.js";
|
|
11
12
|
import { plainQuery } from "../search/lucene/plain.js";
|
|
@@ -201,8 +202,6 @@ const MAX_LINE = 200;
|
|
|
201
202
|
const MAX_NOTES_OFFSET = 1000;
|
|
202
203
|
/** How deep each half is read before the two are merged. */
|
|
203
204
|
const CANDIDATES = 50;
|
|
204
|
-
/** Reciprocal rank fusion's usual constant, as conversations use. */
|
|
205
|
-
export const RRF_K = 60;
|
|
206
205
|
const firstLine = (text, query) => {
|
|
207
206
|
const words = query
|
|
208
207
|
.toLowerCase()
|
|
@@ -8,6 +8,7 @@ import { runEmbedders } from "../embeddings/embed.js";
|
|
|
8
8
|
import { chosenTextModel } from "../embeddings/models.js";
|
|
9
9
|
import { formatMeetingReference } from "../meetings/index.js";
|
|
10
10
|
import { entriesOfList, fitting, listedHolds } from "../search/account-list.js";
|
|
11
|
+
import { RRF_K } from "../search/fusion.js";
|
|
11
12
|
import { plainQuery } from "../search/lucene/plain.js";
|
|
12
13
|
import { MESSAGE_PARSING, SEARCH_QUERY } from "../search/lucene/types.js";
|
|
13
14
|
import { questionPeriod } from "../search/question-period.js";
|
|
@@ -16,7 +17,7 @@ import { calendarAccounts, searchEvents } from "./events-search.js";
|
|
|
16
17
|
import { excerpt } from "./excerpt.js";
|
|
17
18
|
import { MAX_SEARCH_OFFSET, searchStore } from "./messages-archive-search.js";
|
|
18
19
|
import { nearEligible } from "./messages-discovery.js";
|
|
19
|
-
import { importAccounts, notesScopeOf,
|
|
20
|
+
import { importAccounts, notesScopeOf, searchNotes } from "./notes-search.js";
|
|
20
21
|
import { BUSINESS_WORDS_ONLY, searchBusiness } from "./search-all-business.js";
|
|
21
22
|
import { meetingLane } from "./search-all-meetings.js";
|
|
22
23
|
import { HARDER_CANDIDATES, reorderHarder } from "./search-harder.js";
|
package/dist/services/tags.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
|
-
import { queryFieldsOf } from "@wirecat/cli-base/query";
|
|
2
|
+
import { queryFieldsOf, timezoneOf } from "@wirecat/cli-base/query";
|
|
3
3
|
import { formatLocator, isLocator, parseLocator } from "../domain/locator.js";
|
|
4
4
|
import { formatReference } from "../domain/references.js";
|
|
5
5
|
import { normalizeTag } from "../domain/tags.js";
|
|
@@ -93,7 +93,9 @@ export const tagsService = (deps) => {
|
|
|
93
93
|
return { target: viewOf(account, target), removed, unchanged: tags.filter((tag) => !removed.includes(tag)) };
|
|
94
94
|
}),
|
|
95
95
|
list: ({ query, limit, offset }) => inStore(async (store, account) => {
|
|
96
|
-
const where = query
|
|
96
|
+
const where = query
|
|
97
|
+
? queryFilter(query, TAGGING_COLUMNS, { command: "tags list", zone: timezoneOf() })
|
|
98
|
+
: undefined;
|
|
97
99
|
const rows = await store.tags.tags(account, {
|
|
98
100
|
...(where ? { where } : {}),
|
|
99
101
|
window: { limit: limit + 1, offset },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
|
-
import { walkQuery } from "@wirecat/cli-base/query";
|
|
2
|
+
import { timezoneOf, walkQuery } from "@wirecat/cli-base/query";
|
|
3
3
|
import { parseMeetingReference } from "../meetings/index.js";
|
|
4
4
|
import { withoutField } from "../store/index.js";
|
|
5
5
|
import { queryFilter } from "../store/store.js";
|
|
@@ -59,7 +59,7 @@ export const taskStatsOf = async (store, accounts, { by = "chat", query, timezon
|
|
|
59
59
|
...(kind === undefined ? [] : [{ sql: "t.type = ?", params: [kind] }]),
|
|
60
60
|
...(by === "meeting" ? [{ sql: "t.source_kind = 'meeting'", params: [] }] : []),
|
|
61
61
|
];
|
|
62
|
-
const options = { command: "stats tasks show", now,
|
|
62
|
+
const options = { command: "stats tasks show", now, zone: timezoneOf(timezone) };
|
|
63
63
|
const where = (ast, more = []) => and([...fixed, ...more, ...(ast ? [queryFilter(ast, read, options)] : [])]);
|
|
64
64
|
// Project tasks belong to no account: one board read, whatever the accounts.
|
|
65
65
|
const scopes = by === "project"
|
package/dist/services/tasks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CliError, isCliError, singleLine } from "@wirecat/cli-base";
|
|
2
|
-
import { OPERATORS_BY_TYPE, queryFieldsOf, walkQuery } from "@wirecat/cli-base/query";
|
|
2
|
+
import { OPERATORS_BY_TYPE, queryFieldsOf, timezoneOf, walkQuery, } from "@wirecat/cli-base/query";
|
|
3
3
|
import { isLocator, parseLocator } from "../domain/locator.js";
|
|
4
4
|
import { formatReference } from "../domain/references.js";
|
|
5
5
|
import { task as taskEntity } from "../entities/task.js";
|
|
@@ -230,7 +230,7 @@ export const tasksService = (deps, categories) => {
|
|
|
230
230
|
return {
|
|
231
231
|
list: ({ query, limit, offset, previews }) => inStore(async (store, account) => {
|
|
232
232
|
const where = query
|
|
233
|
-
? queryFilter(query, await queryColumns(store, account, query), { command: "tasks list" })
|
|
233
|
+
? queryFilter(query, await queryColumns(store, account, query), { command: "tasks list", zone: timezoneOf() })
|
|
234
234
|
: undefined;
|
|
235
235
|
const rows = await store.tasks.query(taskAccount(account), where, { limit: limit + 1, offset });
|
|
236
236
|
const shown = rows.slice(0, limit);
|
package/dist/sftp/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type HostKey, openSftp, SFTP_CONNECT_TIMEOUT_MS, SFTP_OPERATION_TIMEOUT_MS, SFTP_RETRY, type SftpAuth, type SftpClient, type SftpEntry, type SftpKind, type SftpOptions, type SftpReadOptions, type SftpTarget, sftpHostKey, } from "./session.js";
|
|
1
|
+
export { type HostKey, openSftp, openSshTunnel, SFTP_CONNECT_TIMEOUT_MS, SFTP_OPERATION_TIMEOUT_MS, SFTP_RETRY, type SftpAuth, type SftpClient, type SftpEntry, type SftpKind, type SftpOptions, type SftpReadOptions, type SftpStreamOptions, type SftpTarget, type SshTunnel, type SshTunnelOptions, sftpHostKey, } from "./session.js";
|
package/dist/sftp/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { openSftp, SFTP_CONNECT_TIMEOUT_MS, SFTP_OPERATION_TIMEOUT_MS, SFTP_RETRY, sftpHostKey, } from "./session.js";
|
|
1
|
+
export { openSftp, openSshTunnel, SFTP_CONNECT_TIMEOUT_MS, SFTP_OPERATION_TIMEOUT_MS, SFTP_RETRY, sftpHostKey, } from "./session.js";
|
package/dist/sftp/session.d.ts
CHANGED
|
@@ -36,11 +36,21 @@ export interface SftpReadOptions {
|
|
|
36
36
|
/** A larger file is refused before its first byte is read, and a file that grows past it while read is too. */
|
|
37
37
|
maxBytes: number;
|
|
38
38
|
}
|
|
39
|
+
export interface SftpStreamOptions {
|
|
40
|
+
/** A larger file is refused before its first byte is read, and one that grows past it while read is too. */
|
|
41
|
+
maxBytes?: number;
|
|
42
|
+
}
|
|
39
43
|
export interface SftpClient {
|
|
40
44
|
/** The entries of a folder, without `.` and `..`. */
|
|
41
45
|
list(path: string): Promise<SftpEntry[]>;
|
|
42
46
|
stat(path: string): Promise<SftpEntry>;
|
|
43
47
|
readFile(path: string, options: SftpReadOptions): Promise<Uint8Array>;
|
|
48
|
+
/**
|
|
49
|
+
* The file in order, piece by piece, with about a megabyte read ahead: a file of gigabytes is never held whole.
|
|
50
|
+
* A connection that breaks halfway is opened again and the read goes on where it stopped, once the bytes just
|
|
51
|
+
* before that point are the same; a file replaced meanwhile is refused (`sftp.file-changed`).
|
|
52
|
+
*/
|
|
53
|
+
readStream(path: string, options?: SftpStreamOptions): AsyncIterable<Uint8Array>;
|
|
44
54
|
close(): Promise<void>;
|
|
45
55
|
}
|
|
46
56
|
export type { HostKey, SftpEntry, SftpKind } from "./ssh2.js";
|
|
@@ -53,9 +63,25 @@ export declare const SFTP_RETRY: RetryConfig;
|
|
|
53
63
|
* the key exchange and sends no credential.
|
|
54
64
|
*/
|
|
55
65
|
export declare const sftpHostKey: (target: SftpTarget) => Promise<HostKey>;
|
|
66
|
+
export declare const openSftp: (input: SftpOptions) => Promise<SftpClient>;
|
|
67
|
+
export interface SshTunnelOptions extends SftpTarget {
|
|
68
|
+
username: string;
|
|
69
|
+
auth: SftpAuth;
|
|
70
|
+
/** The SSH server's fingerprint the owner confirmed, as for SFTP: `sftpHostKey` shows it. */
|
|
71
|
+
hostKey: string;
|
|
72
|
+
}
|
|
73
|
+
export interface SshTunnel {
|
|
74
|
+
/**
|
|
75
|
+
* A new connection to `host:port` as the SSH server sees it (`127.0.0.1:3306` is the server's own MySQL), shaped
|
|
76
|
+
* as a socket: hand it to a database driver's `stream` option, or to `openSqlReader`'s `socket`.
|
|
77
|
+
*/
|
|
78
|
+
connect(host: string, port: number): Promise<Duplex>;
|
|
79
|
+
close(): Promise<void>;
|
|
80
|
+
}
|
|
56
81
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
82
|
+
* An SSH connection that only forwards, for a database that listens only on its own server (a FreePBX CDR database):
|
|
83
|
+
* `ssh -L` without a port on this computer, so no other program here can reach the database through it. The host key
|
|
84
|
+
* must match the pinned fingerprint before a credential is sent. Each forward is a request in the run's events (host
|
|
85
|
+
* only, never the address forwarded to) and is tried again on a transient failure over a fresh connection.
|
|
60
86
|
*/
|
|
61
|
-
export declare const
|
|
87
|
+
export declare const openSshTunnel: (input: SshTunnelOptions) => Promise<SshTunnel>;
|