@wirecat/cli-core 0.661.0 → 0.663.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 +109 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- 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/ai-model-command.js +3 -3
- package/dist/cli/call-stats-command.d.ts +18 -0
- package/dist/cli/call-stats-command.js +52 -0
- package/dist/cli/command-availability.d.ts +1 -1
- package/dist/cli/command-availability.js +4 -4
- package/dist/cli/contract-templates.js +2 -0
- package/dist/cli/dry-run-guard.js +7 -5
- package/dist/cli/early-refusal.d.ts +1 -1
- package/dist/cli/early-refusal.js +2 -2
- package/dist/cli/effects.d.ts +9 -2
- package/dist/cli/effects.js +16 -4
- package/dist/cli/envelope.d.ts +0 -5
- package/dist/cli/envelope.js +25 -0
- package/dist/cli/index.d.ts +3 -2
- package/dist/cli/index.js +3 -2
- package/dist/cli/meeting-batch.d.ts +2 -1
- package/dist/cli/meeting-batch.js +7 -5
- package/dist/cli/meeting-preparation-command.js +5 -5
- package/dist/cli/meeting-preparation-read.d.ts +5 -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/messenger/admin-moderation-command.js +2 -2
- package/dist/cli/messenger/admin-statistics-command.js +2 -2
- package/dist/cli/messenger/archive-commands.js +2 -2
- package/dist/cli/messenger/context.d.ts +2 -2
- package/dist/cli/messenger/context.js +5 -3
- 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/rankings-command.js +3 -3
- package/dist/cli/messenger/tags-command.js +7 -2
- package/dist/cli/messenger/tasks-command.js +4 -3
- package/dist/cli/paging.d.ts +10 -0
- package/dist/cli/paging.js +29 -0
- package/dist/cli/preview.js +3 -5
- 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/cli/shadowed-options.d.ts +7 -0
- package/dist/cli/shadowed-options.js +26 -0
- package/dist/crm/cli/index.js +4 -2
- 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/fields.d.ts +2 -2
- package/dist/entities/fields.js +2 -2
- package/dist/entities/index.d.ts +92 -1
- package/dist/entities/index.js +3 -2
- package/dist/entities/meeting.d.ts +1 -1
- package/dist/entities/meeting.js +1 -1
- package/dist/errors/reasons.js +0 -1
- package/dist/kit/sync-after-install.d.ts +10 -1
- package/dist/kit/sync-after-install.js +35 -11
- 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 +4 -4
- package/dist/mail/sync.js +1 -1
- 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/mcp/server.js +4 -4
- package/dist/mcp/tool.js +3 -3
- 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 +3 -0
- package/dist/meetings/index.js +3 -0
- package/dist/meetings/mcp/index.d.ts +21 -18
- package/dist/meetings/mcp/index.js +2 -4
- package/dist/meetings/mcp/search.d.ts +6 -1
- package/dist/meetings/mcp/search.js +3 -3
- 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/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/moderation/rules.d.ts +2 -0
- package/dist/moderation/rules.js +16 -2
- 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 +2 -0
- package/dist/search/question-plan.js +5 -0
- package/dist/search/service-query.d.ts +6 -1
- package/dist/search/service-query.js +9 -1
- package/dist/sends/guard.js +4 -20
- package/dist/sends/keyed-guard.d.ts +1 -1
- package/dist/sends/keyed-guard.js +2 -1
- package/dist/sends/permissions.d.ts +14 -0
- package/dist/sends/permissions.js +32 -0
- 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 +20 -4
- package/dist/services/events-search.js +2 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -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/messages-combined.js +15 -4
- 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/server-search.js +1 -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/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/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.js +19 -19
- 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 +2 -0
- package/dist/store/sqlite/notes.js +24 -13
- 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 +3 -3
- package/parity.json +2 -1
package/dist/cli/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ export { BOT_ACTIONS, type BotAction, type BotAdapter, type BotCallbacks, type B
|
|
|
67
67
|
export { botFiles, botsDirectory, ChatRegistry, registryProfiles, type SeenChat } from "./bot/registry.js";
|
|
68
68
|
export { BotTokenStore, type BotTokenStoreOptions } from "./bot/token.js";
|
|
69
69
|
export { PressLog, UpdatesCursor } from "./bot/updates.js";
|
|
70
|
+
export { addCallStatsCommand, type CallStatsCommandDeps, type CallStatsRead } from "./call-stats-command.js";
|
|
70
71
|
export type { CommandAvailability, DiscoveredCommand } from "./command-availability.js";
|
|
71
72
|
export { commandContract, type JsonSchema, SCHEMA_DIALECT } from "./command-contract.js";
|
|
72
73
|
export { type CommandRunOptions, type CommandRuns, commandRuns, type ProviderAnswer, type ProviderCall, providerEvent, providerRequest, type RunSettings, recordRuns, runSettings, type SavedRunSettings, } from "./command-runs.js";
|
|
@@ -85,7 +86,7 @@ export { DEFAULT_CONFIG, ensureDefaultConfig } from "./default-config.js";
|
|
|
85
86
|
export { DISCOVERY_DESCRIPTIONS } from "./discovery-descriptions.js";
|
|
86
87
|
export { type DoctorReportsSource, doctorReportsCommand } from "./doctor-reports-command.js";
|
|
87
88
|
export { refuseOffline } from "./early-refusal.js";
|
|
88
|
-
export { admittedUnderLock, changesAuthority, changesAuthorityAt, changesAuthorityNow, destroysNothing, FETCH, fetchesOnly, fetchesOnlyAt, grantsAuthority, isLogin, isOtherServiceCall, isProposal, isStoreChange, judgedEffects, judgedTargets, LOCAL_READ, LOCAL_WRITE, LOCKED_AUTHORITY_COMMANDS, logsInOrOut, NO_EFFECTS, narrowsUnderLock, ownerOnlyOption, PROPOSE_COMMANDS, previewFlag, proposesOnly, REMOTE_READ, REMOTE_WRITE, reachesOtherService, readsOverMcp, readsOverMcpAt, refuseUnderReadOnly, storeChangeRefusal, writesFileOnlyWith, writesNewFileOnlyWith, } from "./effects.js";
|
|
89
|
+
export { admittedUnderLock, changesAuthority, changesAuthorityAt, changesAuthorityNow, destroysNothing, FETCH, fetchesOnly, fetchesOnlyAt, grantsAuthority, isLogin, isOtherServiceCall, isProposal, isStoreChange, judgedEffects, judgedTargets, LOCAL_READ, LOCAL_WRITE, LOCKED_AUTHORITY_COMMANDS, logsInOrOut, NO_EFFECTS, narrowsUnderLock, ownerOnlyOption, PROPOSE_COMMANDS, previewFlag, proposesOnly, REMOTE_READ, REMOTE_WRITE, reachesOtherService, readsOverMcp, readsOverMcpAt, refuseUnderReadOnly, storeChangeRefusal, writesFileOnlyWith, writesNewFileOnlyWith, writesOwnerFiles, } from "./effects.js";
|
|
89
90
|
export { type CliEntry, type EntryContext, type EntryIo, openBrowser, startCli } from "./entry.js";
|
|
90
91
|
export { type AnswerOutput, answerSchema, type Body, type ItemBody, isBody, itemAnswer, itemOf, jsonlRecords, judgedAnswer, type ListBody, type ListInput, listOf, metaNow, printItem, renderAnswer, sealed, snakeKeys, snakeKeysKeeping, } from "./envelope.js";
|
|
91
92
|
export { withAbort } from "./execution.js";
|
|
@@ -132,7 +133,7 @@ export { type Saving, stored } from "./messenger/stored.js";
|
|
|
132
133
|
export { dateOrNone } from "./messenger/tasks-command.js";
|
|
133
134
|
export { MODEL_CATALOGUE_QUERY, type ModelCatalogueOptions } from "./model-catalogue-command.js";
|
|
134
135
|
export { writeNewFile } from "./new-file.js";
|
|
135
|
-
export { positiveCount, window, withPaging } from "./paging.js";
|
|
136
|
+
export { pagingOf, positiveCount, window, withPaging } from "./paging.js";
|
|
136
137
|
export { type CommandPermissions, type ConditionalKey, commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, type PermissionKeyOf, type PermissionKeySource, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
|
|
137
138
|
export { asFirstWord, commandWords, liftProfile, profileFree, refuseCommandName, rootOf, runGroup, takesProfile, usableProfileName, } from "./profile.js";
|
|
138
139
|
export { ProfileTokenStore, type ProfileTokenStoreOptions, type TokenStorage } from "./profile-token.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -60,6 +60,7 @@ export { BOT_ACTIONS, } from "./bot/port.js";
|
|
|
60
60
|
export { botFiles, botsDirectory, ChatRegistry, registryProfiles } from "./bot/registry.js";
|
|
61
61
|
export { BotTokenStore } from "./bot/token.js";
|
|
62
62
|
export { PressLog, UpdatesCursor } from "./bot/updates.js";
|
|
63
|
+
export { addCallStatsCommand } from "./call-stats-command.js";
|
|
63
64
|
export { commandContract, SCHEMA_DIALECT } from "./command-contract.js";
|
|
64
65
|
export { commandRuns, providerEvent, providerRequest, recordRuns, runSettings, } from "./command-runs.js";
|
|
65
66
|
export { CONTRACT } from "./commands-command.js";
|
|
@@ -76,7 +77,7 @@ export { DEFAULT_CONFIG, ensureDefaultConfig } from "./default-config.js";
|
|
|
76
77
|
export { DISCOVERY_DESCRIPTIONS } from "./discovery-descriptions.js";
|
|
77
78
|
export { doctorReportsCommand } from "./doctor-reports-command.js";
|
|
78
79
|
export { refuseOffline } from "./early-refusal.js";
|
|
79
|
-
export { admittedUnderLock, changesAuthority, changesAuthorityAt, changesAuthorityNow, destroysNothing, FETCH, fetchesOnly, fetchesOnlyAt, grantsAuthority, isLogin, isOtherServiceCall, isProposal, isStoreChange, judgedEffects, judgedTargets, LOCAL_READ, LOCAL_WRITE, LOCKED_AUTHORITY_COMMANDS, logsInOrOut, NO_EFFECTS, narrowsUnderLock, ownerOnlyOption, PROPOSE_COMMANDS, previewFlag, proposesOnly, REMOTE_READ, REMOTE_WRITE, reachesOtherService, readsOverMcp, readsOverMcpAt, refuseUnderReadOnly, storeChangeRefusal, writesFileOnlyWith, writesNewFileOnlyWith, } from "./effects.js";
|
|
80
|
+
export { admittedUnderLock, changesAuthority, changesAuthorityAt, changesAuthorityNow, destroysNothing, FETCH, fetchesOnly, fetchesOnlyAt, grantsAuthority, isLogin, isOtherServiceCall, isProposal, isStoreChange, judgedEffects, judgedTargets, LOCAL_READ, LOCAL_WRITE, LOCKED_AUTHORITY_COMMANDS, logsInOrOut, NO_EFFECTS, narrowsUnderLock, ownerOnlyOption, PROPOSE_COMMANDS, previewFlag, proposesOnly, REMOTE_READ, REMOTE_WRITE, reachesOtherService, readsOverMcp, readsOverMcpAt, refuseUnderReadOnly, storeChangeRefusal, writesFileOnlyWith, writesNewFileOnlyWith, writesOwnerFiles, } from "./effects.js";
|
|
80
81
|
export { openBrowser, startCli } from "./entry.js";
|
|
81
82
|
export { answerSchema, isBody, itemAnswer, itemOf, jsonlRecords, judgedAnswer, listOf, metaNow, printItem, renderAnswer, sealed, snakeKeys, snakeKeysKeeping, } from "./envelope.js";
|
|
82
83
|
export { withAbort } from "./execution.js";
|
|
@@ -121,7 +122,7 @@ export { stored } from "./messenger/stored.js";
|
|
|
121
122
|
export { dateOrNone } from "./messenger/tasks-command.js";
|
|
122
123
|
export { MODEL_CATALOGUE_QUERY } from "./model-catalogue-command.js";
|
|
123
124
|
export { writeNewFile } from "./new-file.js";
|
|
124
|
-
export { positiveCount, window, withPaging } from "./paging.js";
|
|
125
|
+
export { pagingOf, positiveCount, window, withPaging } from "./paging.js";
|
|
125
126
|
export { commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
|
|
126
127
|
export { asFirstWord, commandWords, liftProfile, profileFree, refuseCommandName, rootOf, runGroup, takesProfile, usableProfileName, } from "./profile.js";
|
|
127
128
|
export { ProfileTokenStore } from "./profile-token.js";
|
|
@@ -3,7 +3,8 @@ import { type Meta } from "@wirecat/cli-base/standards";
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { type MeetingBatchReader, type MeetingPassageOutputFormat } from "../meetings/index.js";
|
|
5
5
|
import { type Body } from "./envelope.js";
|
|
6
|
-
|
|
6
|
+
/** `limit` is a search's page without `--limit`: the profile's `defaults.limit`. */
|
|
7
|
+
export declare const prepareMeetingBatch: (input: string, reader: MeetingBatchReader, meta: () => Meta, limit: number) => import("@wirecat/cli-base").PreparedBatchRequest[];
|
|
7
8
|
export declare const formatMeetingBatch: (report: BatchReport, format: "text" | "markdown") => string;
|
|
8
9
|
export declare const addMeetingBatchCommand: (program: Command, deps: {
|
|
9
10
|
reader: MeetingBatchReader;
|
|
@@ -11,6 +11,7 @@ import { formatMeetingEvidenceText, formatMeetingPassage } from "../services/mee
|
|
|
11
11
|
import { answerEntity } from "./answer-entity.js";
|
|
12
12
|
import { destroysNothing } from "./effects.js";
|
|
13
13
|
import { answerSchema, itemOf, listOf } from "./envelope.js";
|
|
14
|
+
import { pagingOf } from "./paging.js";
|
|
14
15
|
const INDEX_BYTES = 4194304;
|
|
15
16
|
const parse = (command, args) => {
|
|
16
17
|
command
|
|
@@ -27,7 +28,7 @@ const parse = (command, args) => {
|
|
|
27
28
|
}
|
|
28
29
|
return command;
|
|
29
30
|
};
|
|
30
|
-
const handlers = (reader, meta) => {
|
|
31
|
+
const handlers = (reader, meta, limit) => {
|
|
31
32
|
let indexed;
|
|
32
33
|
return [
|
|
33
34
|
{
|
|
@@ -36,7 +37,7 @@ const handlers = (reader, meta) => {
|
|
|
36
37
|
const command = parse(createMeetingSearchCommand(new Command()), args);
|
|
37
38
|
const query = command.processedArgs[0];
|
|
38
39
|
const flags = command.opts();
|
|
39
|
-
const request = meetingHitSearchRequest(query, flags);
|
|
40
|
+
const request = meetingHitSearchRequest(query, flags, limit);
|
|
40
41
|
return {
|
|
41
42
|
run: async (ctx) => {
|
|
42
43
|
ctx.reserveReadBytes(request.maxReadBytes ?? 4194304);
|
|
@@ -50,7 +51,7 @@ const handlers = (reader, meta) => {
|
|
|
50
51
|
found.coverage = { ...found.coverage, indexing: "pending" };
|
|
51
52
|
const complete = found.coverage.indexing === "ready";
|
|
52
53
|
const answer = {
|
|
53
|
-
...meetingHitsList(found, request.limit
|
|
54
|
+
...meetingHitsList(found, request.limit, "search meetings", meetingSearchArguments(query, flags)),
|
|
54
55
|
meta: {
|
|
55
56
|
...meta(),
|
|
56
57
|
...meetingSearchMeta(flags),
|
|
@@ -99,7 +100,8 @@ const handlers = (reader, meta) => {
|
|
|
99
100
|
},
|
|
100
101
|
];
|
|
101
102
|
};
|
|
102
|
-
|
|
103
|
+
/** `limit` is a search's page without `--limit`: the profile's `defaults.limit`. */
|
|
104
|
+
export const prepareMeetingBatch = (input, reader, meta, limit) => prepareBatch(input, handlers(reader, meta, limit));
|
|
103
105
|
const textResult = (result, format) => {
|
|
104
106
|
const title = `${result.id}: ${result.command.join(" ")}`;
|
|
105
107
|
if (result.status !== "ok")
|
|
@@ -138,7 +140,7 @@ export const addMeetingBatchCommand = (program, deps) => {
|
|
|
138
140
|
if (fields && format !== "json")
|
|
139
141
|
throw new CliError("validation_error", "batch field selection requires JSON output");
|
|
140
142
|
const input = await deps.input(path, deps.signal());
|
|
141
|
-
const requests = prepareMeetingBatch(input, deps.reader, deps.meta);
|
|
143
|
+
const requests = prepareMeetingBatch(input, deps.reader, deps.meta, pagingOf(action).limit);
|
|
142
144
|
const report = await runBatch(requests, {
|
|
143
145
|
signal: deps.signal(),
|
|
144
146
|
maxReadBytes: options.maxReadBytes,
|
|
@@ -20,13 +20,13 @@ export const addMeetingPreparationCommand = (program, deps) => {
|
|
|
20
20
|
prepare
|
|
21
21
|
.option("--context-source <id=cursor>", "authorized communications selection ID, optionally ID=cursor; repeat", (value, previous) => [...previous, value], [])
|
|
22
22
|
.option("--context-query <words>", "literal words to find within the selected communications")
|
|
23
|
-
.option("--context-since-time <time>", "communications window start
|
|
24
|
-
.option("--context-before-time <time>", "exclusive communications end
|
|
23
|
+
.option("--context-since-time <time>", "communications window start, an ISO date or time or 7d ago (default fourteen days before end)")
|
|
24
|
+
.option("--context-before-time <time>", "exclusive communications end, an ISO date or time (default preparation start)");
|
|
25
25
|
return annotate(prepare
|
|
26
26
|
.option("--project <project>", "include unconfirmed word evidence for one existing project name, key or alias")
|
|
27
|
-
.option("--since-time <time>", "window start
|
|
28
|
-
.option("--before-time <time>", "exclusive window end
|
|
29
|
-
.option("--history-since-time <time>", "history start
|
|
27
|
+
.option("--since-time <time>", "window start, an ISO date or time, local without a zone (default now)")
|
|
28
|
+
.option("--before-time <time>", "exclusive window end, an ISO date or time; a date alone covers that day (default seven days after start)")
|
|
29
|
+
.option("--history-since-time <time>", "history start, an ISO date or time or 30d ago (default thirty days before start)")
|
|
30
30
|
.option("--meetings <n>", "prior occurrences and separate related-meeting limit, 1–20 (default 5)", integer)
|
|
31
31
|
.option("--cues <n>", "cues per occurrence, 1–100 (default 10)", integer)
|
|
32
32
|
.option("--context-limit <n>", "entries per context category, 1–100 (default 20)", integer)
|
|
@@ -15,13 +15,13 @@ export declare const meetingPreparationInput: v.StrictObjectSchema<{
|
|
|
15
15
|
cursor?: string | undefined;
|
|
16
16
|
}[], 8, undefined>]>;
|
|
17
17
|
readonly query: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 2048, undefined>]>;
|
|
18
|
-
readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
19
|
-
readonly before: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
18
|
+
readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
|
|
19
|
+
readonly before: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
|
|
20
20
|
}, undefined>, undefined>;
|
|
21
21
|
readonly project: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
22
|
-
readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
23
|
-
readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
24
|
-
readonly history_after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
22
|
+
readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
|
|
23
|
+
readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
|
|
24
|
+
readonly history_after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
|
|
25
25
|
readonly meetings: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1 | 4096, undefined>, v.MaxValueAction<number, 20 | 100 | 4194304, undefined>]>, undefined>;
|
|
26
26
|
readonly cues: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1 | 4096, undefined>, v.MaxValueAction<number, 20 | 100 | 4194304, undefined>]>, undefined>;
|
|
27
27
|
readonly context_limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1 | 4096, undefined>, v.MaxValueAction<number, 20 | 100 | 4194304, undefined>]>, undefined>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
import { communicationFields } from "../context/communication-selection.js";
|
|
4
|
-
import {
|
|
5
|
-
import { validateMeetingChange } from "../meetings/index.js";
|
|
4
|
+
import { typedTime } from "../entities/index.js";
|
|
6
5
|
import { MEETING_PREPARATION_LIMITS, validateMeetingPreparationRequest, } from "../services/index.js";
|
|
7
6
|
import { validatePreparationCommunications } from "../services/meeting-communications-selection.js";
|
|
7
|
+
import { momentOf } from "../services/moment.js";
|
|
8
8
|
import { meetingPreparationAnswer } from "./meeting-preparation-answer.js";
|
|
9
9
|
const bound = (name) => {
|
|
10
10
|
const { min, max } = MEETING_PREPARATION_LIMITS[name];
|
|
@@ -12,27 +12,19 @@ const bound = (name) => {
|
|
|
12
12
|
};
|
|
13
13
|
export const meetingPreparationInput = v.strictObject({
|
|
14
14
|
series_id: v.pipe(v.string(), v.minLength(1), v.maxLength(1000)),
|
|
15
|
-
communications: v.optional(v.strictObject({ ...communicationFields, after: v.optional(
|
|
15
|
+
communications: v.optional(v.strictObject({ ...communicationFields, after: v.optional(typedTime), before: v.optional(typedTime) })),
|
|
16
16
|
project: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(200))),
|
|
17
|
-
after: v.optional(
|
|
18
|
-
until: v.optional(
|
|
19
|
-
history_after: v.optional(
|
|
17
|
+
after: v.optional(typedTime),
|
|
18
|
+
until: v.optional(typedTime),
|
|
19
|
+
history_after: v.optional(typedTime),
|
|
20
20
|
meetings: bound("meetings"),
|
|
21
21
|
cues: bound("cues"),
|
|
22
22
|
context_limit: bound("contextLimit"),
|
|
23
23
|
max_read_bytes: bound("maxReadBytes"),
|
|
24
24
|
bytes: bound("bytes"),
|
|
25
25
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return fallback;
|
|
29
|
-
try {
|
|
30
|
-
return Date.parse(validateMeetingChange({ startTime: value }, false).startTime);
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
throw new CliError("validation_error", `${field} must be a valid ISO timestamp with a zone`);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
26
|
+
// A date alone ends a window at the end of that day and starts one at its start.
|
|
27
|
+
const instant = (value, fallback, field, now, end = false) => value === undefined ? fallback : momentOf(value, field, now, { end });
|
|
36
28
|
export const readMeetingPreparation = async (read, input, signal, now = Date.now()) => {
|
|
37
29
|
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
38
30
|
throw new CliError("validation_error", "meeting preparation arguments are required");
|
|
@@ -48,9 +40,9 @@ export const readMeetingPreparation = async (read, input, signal, now = Date.now
|
|
|
48
40
|
throw new CliError("validation_error", `invalid meeting preparation field: ${String(field)}`);
|
|
49
41
|
}
|
|
50
42
|
const args = parsed.output;
|
|
51
|
-
const after = instant(args.after, now, "after");
|
|
52
|
-
const until = instant(args.until, after + 7 * 86400000, "until");
|
|
53
|
-
const historyAfter = instant(args.history_after, after - 30 * 86400000, "history_after");
|
|
43
|
+
const after = instant(args.after, now, "after", now);
|
|
44
|
+
const until = instant(args.until, after + 7 * 86400000, "until", now, true);
|
|
45
|
+
const historyAfter = instant(args.history_after, after - 30 * 86400000, "history_after", now);
|
|
54
46
|
const request = validateMeetingPreparationRequest(args.series_id, {
|
|
55
47
|
...(args.project === undefined ? {} : { project: args.project }),
|
|
56
48
|
...(args.communications === undefined
|
|
@@ -58,8 +50,8 @@ export const readMeetingPreparation = async (read, input, signal, now = Date.now
|
|
|
58
50
|
: {
|
|
59
51
|
communications: {
|
|
60
52
|
...args.communications,
|
|
61
|
-
after: instant(args.communications.after, Math.max(0, instant(args.communications.before, after, "communications.before") - 14 * 86400000), "communications.after"),
|
|
62
|
-
before: instant(args.communications.before, after, "communications.before"),
|
|
53
|
+
after: instant(args.communications.after, Math.max(0, instant(args.communications.before, after, "communications.before", now, true) - 14 * 86400000), "communications.after", now),
|
|
54
|
+
before: instant(args.communications.before, after, "communications.before", now, true),
|
|
63
55
|
},
|
|
64
56
|
}),
|
|
65
57
|
after,
|
|
@@ -14,8 +14,8 @@ export const addMeetingSeriesInventoryCommand = (program, deps) => {
|
|
|
14
14
|
return annotate(meetings
|
|
15
15
|
.command("scheduled")
|
|
16
16
|
.description("discover candidate meeting series from one bounded provider page")
|
|
17
|
-
.option("--since-time <time>", "
|
|
18
|
-
.option("--before-time <time>", "exclusive
|
|
17
|
+
.option("--since-time <time>", "window start, an ISO date or time, local without a zone (default now)")
|
|
18
|
+
.option("--before-time <time>", "exclusive window end, an ISO date or time; a date alone covers that day (default seven days after start)")
|
|
19
19
|
.option("--limit <n>", "series candidates in one provider page, 1–100 (default 100)", integer)
|
|
20
20
|
.option("--max-read-bytes <bytes>", "normalized provider-page bytes, at most 1048576 (default 65536)", integer)
|
|
21
21
|
.option("--bytes <bytes>", "answer item UTF-8 JSON bytes, 2048–1048576 (default 65536)", integer)
|
|
@@ -2,8 +2,8 @@ import * as v from "valibot";
|
|
|
2
2
|
import { type MeetingSeriesInventoryRequest, type MeetingSeriesInventoryResult } from "../meetings/index.js";
|
|
3
3
|
export type MeetingSeriesInventoryReader = (request: MeetingSeriesInventoryRequest) => Promise<MeetingSeriesInventoryResult>;
|
|
4
4
|
export declare const meetingSeriesInventoryInput: v.StrictObjectSchema<{
|
|
5
|
-
readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
6
|
-
readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
5
|
+
readonly after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
|
|
6
|
+
readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 64, undefined>, v.DescriptionAction<string, "an ISO 8601 date or time, in the computer's zone without one; or 30m, 2h, 7d ago">]>, undefined>;
|
|
7
7
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
|
|
8
8
|
readonly max_read_bytes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
|
|
9
9
|
readonly bytes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>, undefined>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CliError } from "@wirecat/cli-base";
|
|
2
2
|
import * as v from "valibot";
|
|
3
|
-
import { meetingSeriesInventory,
|
|
4
|
-
import {
|
|
3
|
+
import { meetingSeriesInventory, typedTime } from "../entities/index.js";
|
|
4
|
+
import { validateMeetingSeriesInventoryCursor, } from "../meetings/index.js";
|
|
5
|
+
import { momentOf } from "../services/moment.js";
|
|
5
6
|
import { itemOf, metaNow, sealed, snakeKeys } from "./envelope.js";
|
|
6
7
|
const bounded = (min, max) => v.optional(v.pipe(v.number(), v.integer(), v.minValue(min), v.maxValue(max)));
|
|
7
8
|
export const meetingSeriesInventoryInput = v.strictObject({
|
|
8
|
-
after: v.optional(
|
|
9
|
-
until: v.optional(
|
|
9
|
+
after: v.optional(typedTime),
|
|
10
|
+
until: v.optional(typedTime),
|
|
10
11
|
limit: bounded(1, 100),
|
|
11
12
|
max_read_bytes: bounded(1, 1048576),
|
|
12
13
|
bytes: bounded(2048, 1048576),
|
|
@@ -20,16 +21,7 @@ const storedInstant = (value) => {
|
|
|
20
21
|
throw new CliError("invalid_response", "meeting inventory scheduled_start_at is invalid");
|
|
21
22
|
return new Date(value).toISOString();
|
|
22
23
|
};
|
|
23
|
-
const instant = (value, fallback, field) => {
|
|
24
|
-
if (value === undefined)
|
|
25
|
-
return fallback;
|
|
26
|
-
try {
|
|
27
|
-
return Date.parse(validateMeetingChange({ startTime: value }, false).startTime);
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
throw new CliError("validation_error", `invalid meeting inventory ${field}`);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
24
|
+
const instant = (value, fallback, field, now, end = false) => value === undefined ? fallback : momentOf(value, `meeting inventory ${field}`, now, { end });
|
|
33
25
|
export const boundMeetingSeriesInventoryItem = (item) => {
|
|
34
26
|
if (Buffer.byteLength(JSON.stringify(item), "utf8") > item.limits.bytes)
|
|
35
27
|
throw new CliError("validation_error", "meeting inventory bytes cannot fit the provider page; increase bytes or lower limit");
|
|
@@ -51,7 +43,7 @@ export const readMeetingSeriesInventory = async (read, input, signal, now = Date
|
|
|
51
43
|
const args = parsed.output;
|
|
52
44
|
if (args.cursor !== undefined)
|
|
53
45
|
validateMeetingSeriesInventoryCursor(args.cursor);
|
|
54
|
-
const after = instant(args.after, now, "after"), until = instant(args.until, after + 7 * 86400000, "until");
|
|
46
|
+
const after = instant(args.after, now, "after", now), until = instant(args.until, after + 7 * 86400000, "until", now, true);
|
|
55
47
|
if (!Number.isSafeInteger(after) || !Number.isSafeInteger(until) || after >= until || until - after > 366 * 86400000)
|
|
56
48
|
throw new CliError("validation_error", "meeting inventory after/until must form a finite window of at most 366 days");
|
|
57
49
|
signal?.throwIfAborted();
|
|
@@ -4,7 +4,7 @@ import { Command } from "commander";
|
|
|
4
4
|
import { describe, MAX_ACTIONS } from "../../moderation/check.js";
|
|
5
5
|
import { RULE_KEYS } from "../../moderation/rules.js";
|
|
6
6
|
import { dateWindow } from "../../services/moment.js";
|
|
7
|
-
import { grantsAuthority, LOCAL_READ, LOCAL_WRITE, REMOTE_WRITE } from "../effects.js";
|
|
7
|
+
import { grantsAuthority, LOCAL_READ, LOCAL_WRITE, ownerOnlyOption, REMOTE_WRITE } from "../effects.js";
|
|
8
8
|
import { itemOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
9
9
|
import { answerOf } from "./ask.js";
|
|
10
10
|
import { renderItem } from "./chat-answers.js";
|
|
@@ -48,7 +48,7 @@ export const moderateCommand = (messenger) => annotate(new Command("moderate"),
|
|
|
48
48
|
.argument("<chat>", messenger.chatArgument)
|
|
49
49
|
.option("--since-time <time>", "judge what came after this ISO 8601 time, or 2h / 1d ago; the saved point stays")
|
|
50
50
|
.option("--dry-run", "judge and plan; do nothing")
|
|
51
|
-
.
|
|
51
|
+
.addOption(ownerOnlyOption("--allow-dangerous", "yes to every action whose level in the group's rules is ask"))
|
|
52
52
|
.option("--max-actions <n>", `at most this many actions in one run; ${MAX_ACTIONS} if not given`)
|
|
53
53
|
.action(async function (chat) {
|
|
54
54
|
const context = messengerContext(this, messenger);
|
|
@@ -32,7 +32,7 @@ export const adminStatisticsCommand = (messenger, report) => {
|
|
|
32
32
|
command.option("--saved <name|id>", "run a saved report of this kind; typed report options replace stored options");
|
|
33
33
|
command
|
|
34
34
|
.option("--timezone <zone>", "the IANA timezone for calendar date boundaries")
|
|
35
|
-
.option("--limit <n>", "report rows, 1–100;
|
|
35
|
+
.option("--limit <n>", "report rows, 1–100; the configured limit if not given", positiveCount("--limit"));
|
|
36
36
|
if (report !== "discussion")
|
|
37
37
|
command.option("--answerer <person>", "stored name, alias, @username, ID or person:provider/account/id; ambiguous names require a choice; repeat for more", collect);
|
|
38
38
|
if (report !== "newcomers")
|
|
@@ -44,7 +44,7 @@ export const adminStatisticsCommand = (messenger, report) => {
|
|
|
44
44
|
const { answerer, ...options } = this.opts();
|
|
45
45
|
const found = await context.withServices((services) => services.adminStatistics.report(report, {
|
|
46
46
|
...options,
|
|
47
|
-
limit: options.limit ??
|
|
47
|
+
limit: options.limit ?? Math.min(context.settings.limit, 100),
|
|
48
48
|
...(answerer ? { answerers: answerer } : {}),
|
|
49
49
|
...(report === "newcomers" ? { chat: argument } : filters),
|
|
50
50
|
signal: environmentOf(this).commandSignal ?? environmentOf(this).signal,
|
|
@@ -10,7 +10,7 @@ import { seal } from "../../sealed.js";
|
|
|
10
10
|
import { CHAT_KINDS } from "../../services/chats.js";
|
|
11
11
|
import { kindsOf } from "../../services/inbox.js";
|
|
12
12
|
import { dateWindow } from "../../services/moment.js";
|
|
13
|
-
import { destroysNothing, LOCAL_READ, LOCAL_WRITE } from "../effects.js";
|
|
13
|
+
import { destroysNothing, LOCAL_READ, LOCAL_WRITE, ownerOnlyOption } from "../effects.js";
|
|
14
14
|
import { itemOf, listOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
15
15
|
import { commandAt, lineOf } from "../steps.js";
|
|
16
16
|
import { jobsCommand } from "./backfill-command.js";
|
|
@@ -123,7 +123,7 @@ const leftLines = (left) => {
|
|
|
123
123
|
const clearCommand = (messenger) => annotate(new Command("clear"), { output: { entity: "store_clear" }, effects: LOCAL_WRITE })
|
|
124
124
|
.description("delete from the store the chats this account has left, with their messages")
|
|
125
125
|
.option("--left", "the chats this account has left — the only thing this clears")
|
|
126
|
-
.
|
|
126
|
+
.addOption(ownerOnlyOption("--allow-dangerous", "yes, delete — it cannot be undone, and a chat you left cannot be fetched again"))
|
|
127
127
|
.option("--dry-run", "list the chats it would delete, and delete nothing")
|
|
128
128
|
.action(async function () {
|
|
129
129
|
const { left, allowDangerous, dryRun } = this.opts();
|
|
@@ -286,8 +286,8 @@ export declare const connectedFor: (command: Command, messenger: Pick<Messenger,
|
|
|
286
286
|
export declare const markedProfile: (messenger: Messenger, profile: string, env: NodeJS.ProcessEnv) => string;
|
|
287
287
|
/**
|
|
288
288
|
* A write to the local store alone. `deny` already stopped the command (`messengerContext`); `readonly`
|
|
289
|
-
* stops this write too
|
|
290
|
-
* writing unasked.
|
|
289
|
+
* stops this write too, unless it only fetches from the messenger (`fetchesUnder`). There is no
|
|
290
|
+
* question to put to the owner here, so `ask` refuses rather than writing unasked.
|
|
291
291
|
*/
|
|
292
292
|
export declare const refuseLocalWrite: (context: MessengerContext, command: string, permission: PermissionKey) => void;
|
|
293
293
|
export declare const messengerContext: (command: Command, messenger: Messenger, resolving?: Pick<ResolveOptions, "needsProfile">) => MessengerContext;
|
|
@@ -3,7 +3,7 @@ import { servingProfiles } from "../../background/lock.js";
|
|
|
3
3
|
import { FloodMemory, floodPathFor } from "../../sends/flood.js";
|
|
4
4
|
import { ceilingRefusal, guardFor } from "../../sends/guard.js";
|
|
5
5
|
import { DEFAULT_PACE, Pacer, pacePathFor } from "../../sends/pace.js";
|
|
6
|
-
import { CEILING_KEY, levelFor, readKeysForCommand } from "../../sends/permissions.js";
|
|
6
|
+
import { CEILING_KEY, fetchesUnder, levelFor, readKeysForCommand } from "../../sends/permissions.js";
|
|
7
7
|
import { RecipientList, recipientsPathFor } from "../../sends/recipients.js";
|
|
8
8
|
import { OFFLINE, servicesFor } from "../../services/index.js";
|
|
9
9
|
import { openStore } from "../../store/store.js";
|
|
@@ -344,14 +344,16 @@ const refuseDenied = (command, settings) => {
|
|
|
344
344
|
};
|
|
345
345
|
/**
|
|
346
346
|
* A write to the local store alone. `deny` already stopped the command (`messengerContext`); `readonly`
|
|
347
|
-
* stops this write too
|
|
348
|
-
* writing unasked.
|
|
347
|
+
* stops this write too, unless it only fetches from the messenger (`fetchesUnder`). There is no
|
|
348
|
+
* question to put to the owner here, so `ask` refuses rather than writing unasked.
|
|
349
349
|
*/
|
|
350
350
|
export const refuseLocalWrite = (context, command, permission) => {
|
|
351
351
|
const { settings } = context;
|
|
352
352
|
const { level, key } = levelFor(settings.permissions, permission);
|
|
353
353
|
if (level === "allow" || (level === "ask" && context.agent))
|
|
354
354
|
return;
|
|
355
|
+
if (fetchesUnder(level, permission))
|
|
356
|
+
return;
|
|
355
357
|
if (key === CEILING_KEY)
|
|
356
358
|
throw ceilingRefusal(permission, command);
|
|
357
359
|
throw new CliError(level === "ask" ? "confirmation_required" : "permission_error", `profile ${settings.profile} does not let ${permission} write (permissions.${key} is ${level}, from the ` +
|
|
@@ -21,7 +21,7 @@ export const countersCommand = (messenger) => {
|
|
|
21
21
|
.option("--timezone <zone>", "IANA timezone for query dates")
|
|
22
22
|
.option("--selection <json>", "pinned counter-targets selection from counters show; conflicts with query and scope")
|
|
23
23
|
.option("--counters <names>", "distinct views,reactions,comments fields; all three by default")
|
|
24
|
-
.option("--limit <n>", "messages, 1–100;
|
|
24
|
+
.option("--limit <n>", "messages, 1–100; the configured limit if not given", positiveCount("--limit"));
|
|
25
25
|
if (operation === "refresh")
|
|
26
26
|
command;
|
|
27
27
|
if (operation === "show")
|
|
@@ -41,7 +41,7 @@ export const countersCommand = (messenger) => {
|
|
|
41
41
|
refuseLocalWrite(context, messenger.app.command, "stats.messages.counters.sync");
|
|
42
42
|
const query = {
|
|
43
43
|
...options,
|
|
44
|
-
limit: options.limit ??
|
|
44
|
+
limit: options.limit ?? Math.min(context.settings.limit, 100),
|
|
45
45
|
...(words.length ? { text: words.join(" ") } : {}),
|
|
46
46
|
signal: environmentOf(this).commandSignal ?? environmentOf(this).signal,
|
|
47
47
|
};
|
|
@@ -3,7 +3,8 @@ import { annotate } from "@wirecat/cli-base/commands";
|
|
|
3
3
|
import { parseDuration } from "../../domain/duration.js";
|
|
4
4
|
import { refusedPlace } from "../../sends/upload.js";
|
|
5
5
|
import { FETCHING } from "../../services/archive.js";
|
|
6
|
-
import { archiveMedia, checkMediaArchive
|
|
6
|
+
import { archiveMedia, checkMediaArchive } from "../../services/media-archive.js";
|
|
7
|
+
import { momentOf } from "../../services/moment.js";
|
|
7
8
|
import { environmentOf, setExitCode } from "../context.js";
|
|
8
9
|
import { FETCH, LOCAL_READ } from "../effects.js";
|
|
9
10
|
import { itemOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
@@ -21,12 +22,12 @@ export const addMediaArchiveCommands = (archive, messenger) => {
|
|
|
21
22
|
.addHelpText("after", `\nMedia is saved only when you request a download; serve does not save these copies.\nTo disable an installed daily backup: ${messenger.app.command} <profile> attachments jobs stop <dir>.`)
|
|
22
23
|
.argument("<dir>", "archive directory; created if missing")
|
|
23
24
|
.option("--chat <chat>", `only this chat; repeat for more; ${messenger.chatArgument}`, (value, previous) => [...previous, value], [])
|
|
24
|
-
.option("--since-time <time>", "include messages from this ISO
|
|
25
|
+
.option("--since-time <time>", "include messages from this time: ISO 8601, a date, today, yesterday, or 2h, 7d ago")
|
|
25
26
|
.option("--pause <duration>", "pause between history pages", messenger.fetching?.pause ?? FETCHING.pause)
|
|
26
27
|
.action(async function (directory) {
|
|
27
28
|
const context = messengerContext(this, messenger);
|
|
28
29
|
const options = this.opts();
|
|
29
|
-
|
|
30
|
+
const sinceTime = options.sinceTime && new Date(momentOf(options.sinceTime, "--since-time")).toISOString();
|
|
30
31
|
const pauseMs = parseDuration(options.pause, "--pause");
|
|
31
32
|
if (context.settings.offline)
|
|
32
33
|
throw new CliError("validation_error", "archiving media needs online mode");
|
|
@@ -42,7 +43,7 @@ export const addMediaArchiveCommands = (archive, messenger) => {
|
|
|
42
43
|
const result = await context.withServices((services) => archiveMedia(services, {
|
|
43
44
|
directory,
|
|
44
45
|
chats: options.chat,
|
|
45
|
-
sinceTime:
|
|
46
|
+
...(sinceTime ? { sinceTime } : {}),
|
|
46
47
|
pauseMs,
|
|
47
48
|
signal,
|
|
48
49
|
pageSize: messenger.history === "store" ? 100 : (messenger.fetching ?? FETCHING).page,
|
|
@@ -17,7 +17,7 @@ export const addMediaArchiveMove = (attachments, messenger) => {
|
|
|
17
17
|
.description("move older images into another verified archive; remember their new locations")
|
|
18
18
|
.argument("<dir>", "source media archive directory")
|
|
19
19
|
.argument("<archive-dir>", "destination archive directory; created if needed")
|
|
20
|
-
.requiredOption("--before-time <time>", "move images whose message date is before this ISO
|
|
20
|
+
.requiredOption("--before-time <time>", "move images whose message date is before this time: ISO 8601, a date (its start), today, or 7d ago")
|
|
21
21
|
.option("--dry-run", "show counts and bytes without moving files or creating the destination")
|
|
22
22
|
.addHelpText("after", "\nCopies are verified at the destination before local image bytes are removed.\nSource manifests retain relocation records; checks follow them and downloads do not fetch them again.\nImages without a recorded message date are left in place and counted as undated.")
|
|
23
23
|
.action(async function (directory, archiveDirectory) {
|
|
@@ -5,7 +5,7 @@ import { annotate } from "@wirecat/cli-base/commands";
|
|
|
5
5
|
import { dailyArchiveTimer, manageDailyArchiveTimer, runArchiveTimerCommand, } from "../../background/daily-archive-timer.js";
|
|
6
6
|
import { thisMachine } from "../../background/system.js";
|
|
7
7
|
import { refusedPlace } from "../../sends/upload.js";
|
|
8
|
-
import {
|
|
8
|
+
import { momentOf } from "../../services/moment.js";
|
|
9
9
|
import { environmentOf } from "../context.js";
|
|
10
10
|
import { grantsAuthority, LOCAL_READ, LOCAL_WRITE } from "../effects.js";
|
|
11
11
|
import { itemOf, renderAnswer, snakeKeys } from "../envelope.js";
|
|
@@ -33,7 +33,7 @@ export const addMediaArchiveTimers = (attachments, messenger) => {
|
|
|
33
33
|
.option("--at <HH:mm>", "daily start time", "03:00")
|
|
34
34
|
.option("--timezone <zone>", "IANA time zone of the daily start time", "UTC")
|
|
35
35
|
.option("--chat <chat>", `only this chat; repeat for more; ${messenger.chatArgument}`, (value, previous) => [...previous, value], [])
|
|
36
|
-
.option("--since-time <time>", "include messages from this ISO
|
|
36
|
+
.option("--since-time <time>", "include messages from this time: ISO 8601, a date, today, yesterday, or 2h, 7d ago; fixed when installed");
|
|
37
37
|
command.action(async function (directory) {
|
|
38
38
|
const context = messengerContext(this, messenger);
|
|
39
39
|
const environment = environmentOf(this);
|
|
@@ -43,7 +43,8 @@ export const addMediaArchiveTimers = (attachments, messenger) => {
|
|
|
43
43
|
run: (args, env) => runArchiveTimerCommand(args, env, signal),
|
|
44
44
|
};
|
|
45
45
|
const options = this.opts();
|
|
46
|
-
|
|
46
|
+
// Fixed now: `2h` read again at every daily run would be a different start each night.
|
|
47
|
+
const sinceTime = options.sinceTime && new Date(momentOf(options.sinceTime, "--since-time")).toISOString();
|
|
47
48
|
if (action === "install" && refusedPlace(directory, messenger.app, context.env))
|
|
48
49
|
throw new CliError("validation_error", "the archive cannot write credential, application or message-store folders");
|
|
49
50
|
// Canonicalize existing destinations so a symlink alias addresses the same timer.
|
|
@@ -59,7 +60,7 @@ export const addMediaArchiveTimers = (attachments, messenger) => {
|
|
|
59
60
|
entry: system.entry,
|
|
60
61
|
env: context.env,
|
|
61
62
|
chats: options.chat,
|
|
62
|
-
sinceTime
|
|
63
|
+
sinceTime,
|
|
63
64
|
at: options.at,
|
|
64
65
|
timeZone: options.timezone,
|
|
65
66
|
});
|
|
@@ -28,13 +28,13 @@ export const metadataCommand = (messenger) => {
|
|
|
28
28
|
.description("fetch group and channel descriptions again and cache them")
|
|
29
29
|
.option("--chat <chat>", "stored group/channel; repeat for several", (value, previous) => [...previous, value], [])
|
|
30
30
|
.option("--only-missing", "only chats with no metadata yet; without --chat, every stored group/channel")
|
|
31
|
-
.option("--limit <n>", "process at most 1–500 chats", positiveCount("--limit")
|
|
31
|
+
.option("--limit <n>", "process at most 1–500 chats; the configured limit if not given", positiveCount("--limit"))
|
|
32
32
|
.action(async function () {
|
|
33
33
|
const context = messengerContext(this, messenger);
|
|
34
34
|
refuseLocalWrite(context, messenger.app.command, "metadata.sync");
|
|
35
35
|
const options = this.opts();
|
|
36
|
-
const limit =
|
|
37
|
-
if (
|
|
36
|
+
const limit = options.limit ?? Math.min(context.settings.limit, 500);
|
|
37
|
+
if (limit > 500)
|
|
38
38
|
throw new CliError("validation_error", "--limit takes 1–500");
|
|
39
39
|
if (options.chat.length === 0 && !options.onlyMissing)
|
|
40
40
|
throw new CliError("validation_error", "name a chat with --chat, or give --only-missing");
|
|
@@ -90,24 +90,24 @@ export const rankingEvidenceCommand = (messenger, target) => annotate(new Comman
|
|
|
90
90
|
: "the exact native person id from the ranking row")
|
|
91
91
|
.requiredOption("--selection <json>", "the resolved ranking selection returned in drilldown", selectionOf)
|
|
92
92
|
.requiredOption("--component <name>", "the exposed ranking component")
|
|
93
|
-
.option("--limit <n>", "evidence rows, 1–100;
|
|
93
|
+
.option("--limit <n>", "evidence rows, 1–100; the configured limit if not given", positiveCount("--limit"))
|
|
94
94
|
.option("--cursor <cursor>", "continue the same component and stored-evidence fingerprint")
|
|
95
95
|
.action(async function (reference) {
|
|
96
96
|
const context = messengerContext(this, messenger);
|
|
97
97
|
const options = this.opts();
|
|
98
98
|
if (isRetentionSelection(options.selection))
|
|
99
99
|
assertRetentionEvidenceRead(context.settings.permissions);
|
|
100
|
+
const limit = options.limit ?? Math.min(context.settings.limit, 100);
|
|
100
101
|
const found = await context.withServices((services) => (isRetentionSelection(options.selection)
|
|
101
102
|
? services.retention
|
|
102
103
|
: isAdminSelection(options.selection)
|
|
103
104
|
? services.adminStatistics
|
|
104
105
|
: services.rankings).evidence(target, reference, options.selection, {
|
|
105
106
|
component: options.component,
|
|
106
|
-
limit
|
|
107
|
+
limit,
|
|
107
108
|
...(options.cursor ? { cursor: options.cursor } : {}),
|
|
108
109
|
signal: environmentOf(this).commandSignal ?? environmentOf(this).signal,
|
|
109
110
|
}));
|
|
110
|
-
const limit = options.limit ?? 20;
|
|
111
111
|
const body = evidenceAnswer(`stats ${target} evidence`, found, {
|
|
112
112
|
[target === "messages" ? "message" : "person"]: reference,
|
|
113
113
|
selection: JSON.stringify(options.selection),
|
|
@@ -39,7 +39,7 @@ export const tagsCommand = (messenger) => {
|
|
|
39
39
|
}))
|
|
40
40
|
.description("derive local group/channel tags from cached metadata using keyword rules")
|
|
41
41
|
.option("--chat <chat>", "a stored group/channel; repeat to select several", (value, previous) => [...previous, value], [])
|
|
42
|
-
.option("--limit <n>", "process at most 1–500 chats", positiveCount("--limit")
|
|
42
|
+
.option("--limit <n>", "process at most 1–500 chats; the configured limit if not given", positiveCount("--limit"))
|
|
43
43
|
.option("--sync-first", "read current descriptions from the messenger before classifying")
|
|
44
44
|
.option("--dry-run", "preview cached classification without changing the store")
|
|
45
45
|
.action(async function () {
|
|
@@ -47,7 +47,12 @@ export const tagsCommand = (messenger) => {
|
|
|
47
47
|
const { chat, limit, syncFirst, dryRun } = this.opts();
|
|
48
48
|
if (!dryRun)
|
|
49
49
|
refuseLocalWrite(context, messenger.app.command, "tags.rebuild");
|
|
50
|
-
const done = await context.withServices((services) => services.metadata.auto({
|
|
50
|
+
const done = await context.withServices((services) => services.metadata.auto({
|
|
51
|
+
chats: chat,
|
|
52
|
+
limit: limit ?? Math.min(context.settings.limit, 500),
|
|
53
|
+
refresh: syncFirst,
|
|
54
|
+
dryRun,
|
|
55
|
+
}));
|
|
51
56
|
renderAnswer(this, context, itemOf(snakeKeys(done)));
|
|
52
57
|
});
|
|
53
58
|
targetOptions(annotate(tags.command("add"), {
|