@wirecat/cli-core 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/cli/account-remove.d.ts +3 -0
  3. package/dist/cli/account-remove.js +1 -1
  4. package/dist/cli/documents/index.d.ts +2 -1
  5. package/dist/cli/documents/index.js +4 -1
  6. package/dist/cli/index.d.ts +2 -2
  7. package/dist/cli/index.js +2 -2
  8. package/dist/cli/messenger/conversation-answers.d.ts +2 -0
  9. package/dist/cli/messenger/message-answers.d.ts +2 -0
  10. package/dist/cli/messenger/message-items.js +2 -0
  11. package/dist/cli/messenger/message-writes.d.ts +4 -0
  12. package/dist/cli/messenger/search-answers.js +2 -0
  13. package/dist/cli/oauth-session.js +6 -3
  14. package/dist/cli/shared-command-exports.d.ts +2 -0
  15. package/dist/cli/shared-command-exports.js +3 -0
  16. package/dist/cli/token-session.d.ts +1 -4
  17. package/dist/cli/token-session.js +5 -1
  18. package/dist/domain/models.d.ts +5 -0
  19. package/dist/domain/person-kinds.d.ts +1 -1
  20. package/dist/entities/contact-context.d.ts +4 -0
  21. package/dist/entities/conversation-results.d.ts +4 -0
  22. package/dist/entities/evidence.d.ts +16 -0
  23. package/dist/entities/index.d.ts +36 -0
  24. package/dist/entities/listener.d.ts +8 -0
  25. package/dist/entities/message-change.d.ts +2 -0
  26. package/dist/entities/message-context.d.ts +6 -0
  27. package/dist/entities/message-write.d.ts +8 -0
  28. package/dist/entities/message.d.ts +4 -0
  29. package/dist/entities/message.js +4 -0
  30. package/dist/entities/store-records.d.ts +2 -0
  31. package/dist/errors/reasons.js +16 -0
  32. package/dist/mail/cli/index.js +1 -1
  33. package/dist/mail/headers.d.ts +2 -0
  34. package/dist/mail/headers.js +2 -1
  35. package/dist/mail/read.js +1 -0
  36. package/dist/mail/sort-rules.d.ts +58 -0
  37. package/dist/mail/sort-rules.js +79 -0
  38. package/dist/search/lucene/registry.js +24 -0
  39. package/dist/services/messages-search.js +1 -1
  40. package/dist/store/areas.d.ts +2 -0
  41. package/dist/store/areas.js +2 -0
  42. package/dist/store/public.d.ts +1 -1
  43. package/dist/store/public.js +1 -1
  44. package/dist/store/queries.js +9 -2
  45. package/dist/store/sqlite/email-types.d.ts +8 -0
  46. package/dist/store/sqlite/email-types.js +45 -10
  47. package/dist/store/sqlite/emails.d.ts +3 -0
  48. package/dist/store/sqlite/emails.js +14 -5
  49. package/dist/store/sqlite/lucene-fields.d.ts +6 -0
  50. package/dist/store/sqlite/lucene-fields.js +10 -0
  51. package/dist/store/sqlite/lucene.js +6 -0
  52. package/dist/store/sqlite/mail-sorting.d.ts +122 -0
  53. package/dist/store/sqlite/mail-sorting.js +482 -0
  54. package/dist/store/sqlite/manifest.js +2 -0
  55. package/dist/store/sqlite/migrations.generated.js +20 -0
  56. package/dist/store/sqlite/people-list.js +65 -16
  57. package/dist/store/sqlite/schema/mail-sorting.d.ts +384 -0
  58. package/dist/store/sqlite/schema/mail-sorting.js +31 -0
  59. package/dist/store/sqlite/schema.d.ts +17 -0
  60. package/dist/store/sqlite/schema.js +3 -0
  61. package/dist/store/sqlite/sender-bots.d.ts +10 -1
  62. package/dist/store/sqlite/sender-bots.js +47 -8
  63. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,61 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
5
5
  minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
6
6
  shape of this file.
7
7
 
8
+ ## 1.2.0 — 25.11.2026
9
+
10
+ ### Added
11
+
12
+ - **Mail sorting rules (store version 77).** `store.mail.sorting` keeps the owner's and the program's rules over mail:
13
+ `add` (with `dryRun`), `rules`, `remove`, `undo`, `reset` and `scopes`, all experimental. A rule names its scope,
14
+ one mail, a List-Id, a subject pattern, an address or a registrable domain, and says whether it sorts past mail too
15
+ (`applyTo: "all"`) or only mail dated from now on (`"new"`). The first scope that has a rule wins, in that order, then
16
+ the header classifier; within a scope the owner's rule beats the program's and the newest wins, and a domain rule may
17
+ beat the address rules (`overAddresses`). A rule sets the mail type, makes the sender a bot or a person through
18
+ `moveToBot` and `moveToPerson`, or files the sender under an organization. An email a rule typed has `typeSignal`
19
+ `rule:<id>`. A domain rule on a free-mail or throwaway domain is the owner's only and is set only with the `confirm`
20
+ of a dry run that shows how many addresses and emails it touches. Removing or undoing a rule types its mail again and
21
+ moves its senders back. Not the storage `store.mail.rules`.
22
+ - **`tokenSessionCommand`, `oauthSessionCommand` and `fileMirrorsCommand` are marked as cli-core's own commands**,
23
+ as `appDoctorCommand` is. `commands --json` gives them `origin: "cli-core"`, so the `reserved-shared-command` lint
24
+ rule (WC-CMD-34) stops warning on the CLIs that mount them. A CLI changes them only through their options: an
25
+ option, a description or an annotation added to the returned command afterwards stops the run with
26
+ `contract.unacknowledged-override`. No CLI does that today.
27
+ - **`accountRemoveCommand` takes `effects`.** A CLI whose removal reaches no service passes `LOCAL_WRITE` here,
28
+ instead of annotating the returned command. asterisk, beeline, notion and yandex-disk annotate it today, so
29
+ `accountRemoveCommand` stays unmarked until they pass `effects`.
30
+ - **Mail search filters by mail type and reach.** `type:` takes one of the [mail types](docs/dev/GLOSSARY.md#mail-types)
31
+ and `reach:` takes `direct`, `group` or `broadcast`, in the query itself, so a page is never short:
32
+ `memo search mail 'type:order OR type:bill'`, `memo search mail 'invoice -type:promotion reach:direct'`. A search
33
+ that names either field first types the mail the store has not typed yet, 5,000 emails per write; on 100,000
34
+ untyped emails the first such search after an upgrade takes seconds, later ones the usual milliseconds. A store
35
+ opened read-only works the missing types out in memory for that search. tg and max refuse both as mail fields.
36
+ - **Email hits show their type and reach**: `email.mail_type` and `email.reach` in `--json`, and both on the hit's
37
+ line in mail's text output. In the API they are `MailFields.mailType` and `MailFields.reach` (experimental).
38
+ - **`SENDER_BOT_PREFIX` is exported from `@wirecat/cli-core/store`, and `MAIL_TYPES`, `MailType`, `REACHES` and
39
+ `Reach` from `@wirecat/cli-core/store/areas`** (experimental), so a CLI no longer copies them.
40
+
41
+ ### Changed — experimental
42
+
43
+ - **A sender of a newsletter only is a bot, a human author too.** The owner's ruling of 25.11.2026, in place of the
44
+ earlier one that kept a human-written newsletter a person. A person all of whose mail came from a list (List-Id,
45
+ List-Unsubscribe, a one-click unsubscribe, a Feedback-ID, bulk `Precedence` or the bulk box), with no tie to the
46
+ owner, no messenger identity and no discussion list among their mail, moves to a bot with the reason
47
+ `newsletter-only` on the next people list; `kindSignals` names `newsletter-only`. Its mail stays typed `newsletter`:
48
+ a newsletter's bot is not a program for the mail types. A rule's newsletter bot goes back to a person once the owner
49
+ writes to it, as before, and also once a mail written to the owner alone (no list headers, at most a small group in
50
+ To and Cc) comes from it; the newsletter's own mail keeps reach `broadcast`. The owner's `moveToPerson` and
51
+ `moveToBot` and the sorting rules still win. The people list works out every kind again once after the upgrade.
52
+
53
+ ### Fixed
54
+
55
+ - **Parity checks the CLIs that moved to cli-core 1.0 again.** They are off the known-broken list now. Five stay on it
56
+ until 2026-12-02 because their main is still on 0.x: drive, gcal, bitrix24, wordpress and ydisk. cli-template is
57
+ back on it for #3365, which made the session commands cli-core's own: its MCP snapshot still lists them, and it
58
+ adopts that with the next release.
59
+ - **`oauthSessionCommand` signs in when the sign-in and the token share one host.** Zoom (`zoom.us`) and Google
60
+ (`oauth2.googleapis.com`) list one host for two of their addresses, and `session start` refused with
61
+ `configuration_error: "zoom.us" is listed twice`. Each host is now allowed once.
62
+
8
63
  ## 1.1.0 — 25.11.2026
9
64
 
10
65
  ### Added
@@ -1,4 +1,5 @@
1
1
  import { type CredentialsOptions, type KeyringStore } from "@wirecat/cli-base";
2
+ import type { Effects } from "@wirecat/cli-base/standards";
2
3
  import { Command } from "commander";
3
4
  import { type ServerSystem } from "../background/system.js";
4
5
  import { type Unit } from "../background/units.js";
@@ -75,6 +76,8 @@ export interface AccountRemoveOptions {
75
76
  resolveSettings?: (flags: GlobalFlags, options?: ResolveOptions) => Settings;
76
77
  /** The owner's own home; unset, the account's from the user database. A test names its sandbox. */
77
78
  ownerHome?: string;
79
+ /** A CLI whose removal reaches no service says so here (`LOCAL_WRITE`), not by annotating the command after. */
80
+ effects?: Effects;
78
81
  }
79
82
  /** Inside the tool's own folders and not one of them: a hook's mistake must not reach the home folder. */
80
83
  export declare const insideOwnFolders: (app: AppIdentity, env: NodeJS.ProcessEnv, extra: readonly string[]) => (path: string) => string;
@@ -114,7 +114,7 @@ const removeSections = (path, sections) => {
114
114
  * every entry, file and section it would remove.
115
115
  */
116
116
  export const accountRemoveCommand = (app, removal, options = {}) => logsInOrOut(annotate(new Command("remove"), {
117
- effects: REMOTE_WRITE,
117
+ effects: options.effects ?? REMOTE_WRITE,
118
118
  mcp: false,
119
119
  output: { entity: "account_removal" },
120
120
  examples: [
@@ -13,7 +13,7 @@ export { addDocumentCatalogCommands, CATALOG_FIELDS, type CatalogTree, type Cata
13
13
  export { addLocalDocumentCommands, type ImportedDocument, type LocalDocumentCommands } from "./documents.js";
14
14
  export { type FileConflictCommands, type FileConflictConnection, fileConflictsCommand } from "./file-conflicts.js";
15
15
  export { addFileEditCommands, type FileEditCommands } from "./file-edit.js";
16
- export { type FileMirrorCommands, type FileMirrorRemote, type FileMirrorWrite, fileMirrorsCommand, } from "./file-mirrors.js";
16
+ export type { FileMirrorCommands, FileMirrorRemote, FileMirrorWrite } from "./file-mirrors.js";
17
17
  export { addFileUpdateCommand, type FileUpdateCommands, type FileUpdatePort } from "./file-update.js";
18
18
  export { addDocumentFolderCommands, type DocumentFolderCommands } from "./folders.js";
19
19
  export { addDocumentHistoryCommands, DOCUMENT_HISTORY_SETTINGS, type DocumentHistoryCommands, type DocumentHistoryPort, keepVersionsForDays, } from "./history.js";
@@ -47,3 +47,4 @@ export declare const addDocumentCommands: <S>(program: Command, options: Documen
47
47
  export { claimDocumentAccount, DOCUMENT_SCAN_SETTINGS, type DocumentLibraryOptions, type DocumentLibraryTools, type DocumentSourceRun, type DocumentSyncOutcome, type DocumentSyncStep, type DocumentWarning, documentLibrary, documentLibraryCommands, documentProfile, } from "./library.js";
48
48
  export { type DocumentCall, type DocumentFileMap, type DocumentManifest, parseDocumentManifest, } from "./manifest/manifest.js";
49
49
  export { type DocumentManifestSourceOptions, type DocumentManifestTools, type DocumentSlots, documentSourceFromManifest, type ManifestDocumentSource, } from "./manifest/source.js";
50
+ export declare const fileMirrorsCommand: (helpers: import("./file-mirrors.js").FileMirrorCommands) => Command;
@@ -1,5 +1,8 @@
1
+ import { honoursDryRun } from "../dry-run-guard.js";
2
+ import { sharedCommand } from "../shared-contracts.js";
1
3
  import { addDocumentCatalogCommands } from "./catalog.js";
2
4
  import { addLocalDocumentCommands } from "./documents.js";
5
+ import { fileMirrorsCommand as fileMirrorsCommandDefinition } from "./file-mirrors.js";
3
6
  import { addDocumentFolderCommands } from "./folders.js";
4
7
  import { addDocumentHistoryCommands } from "./history.js";
5
8
  import { addDocumentKnowledgeCommands } from "./knowledge.js";
@@ -11,7 +14,6 @@ export { addDocumentCatalogCommands, CATALOG_FIELDS, catalogId, catalogOutput, c
11
14
  export { addLocalDocumentCommands } from "./documents.js";
12
15
  export { fileConflictsCommand } from "./file-conflicts.js";
13
16
  export { addFileEditCommands } from "./file-edit.js";
14
- export { fileMirrorsCommand, } from "./file-mirrors.js";
15
17
  export { addFileUpdateCommand } from "./file-update.js";
16
18
  export { addDocumentFolderCommands } from "./folders.js";
17
19
  export { addDocumentHistoryCommands, DOCUMENT_HISTORY_SETTINGS, keepVersionsForDays, } from "./history.js";
@@ -43,3 +45,4 @@ export const addDocumentCommands = (program, options) => {
43
45
  export { claimDocumentAccount, DOCUMENT_SCAN_SETTINGS, documentLibrary, documentLibraryCommands, documentProfile, } from "./library.js";
44
46
  export { parseDocumentManifest, } from "./manifest/manifest.js";
45
47
  export { documentSourceFromManifest, } from "./manifest/source.js";
48
+ export const fileMirrorsCommand = honoursDryRun(sharedCommand(fileMirrorsCommandDefinition));
@@ -143,7 +143,7 @@ export { type Saving, stored } from "./messenger/stored.js";
143
143
  export { dateOrNone } from "./messenger/tasks-command.js";
144
144
  export { MODEL_CATALOGUE_QUERY, type ModelCatalogueOptions } from "./model-catalogue-command.js";
145
145
  export { writeNewFile } from "./new-file.js";
146
- export { type OAuthEnvironment, type OAuthPreset, type OAuthPresetOptions, type OAuthSessionOptions, type OAuthSignedIn, oauthFlowOf, oauthPreset, oauthSessionCommand, } from "./oauth-session.js";
146
+ export { type OAuthEnvironment, type OAuthPreset, type OAuthPresetOptions, type OAuthSessionOptions, type OAuthSignedIn, oauthFlowOf, oauthPreset, } from "./oauth-session.js";
147
147
  export { pagingOf, positiveCount, window, withPaging } from "./paging.js";
148
148
  export { notLocalPaths } from "./path-options.js";
149
149
  export { type CommandPermissions, type ConditionalKey, commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, type PermissionKeyOf, type PermissionKeySource, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
@@ -164,7 +164,7 @@ export { type DeclaredSetting, type SettingRow, settingRows, withSettingDefaults
164
164
  export { type Config, type Configuration, count, first, flag, fromFile, type GlobalFlags, NONE_NAMED, namedProfile, type ProfileKind, plain, type ResolveOptions, type Settings, type SettingsExtension, type SettingsExtensionContext, type Source, settingsFor, } from "./settings.js";
165
165
  export { type PermissionAnswer, readSetupAnswers, type SetupAnswers, setupPermissionCeiling } from "./setup-answers.js";
166
166
  export { AGENTS, type Agent, agentFor, screenFor } from "./setup-screen.js";
167
- export { accountCommand, addMeetingBatchCommand, addMeetingPreparationCommand, addMeetingProjectCandidatesCommand, addMeetingSeriesInventoryCommand, addStoreMaintenanceCommands, appCompleteCommand, appDoctorCommand, appMcpCommand, attachmentsCommand, botAdminsCommand, botCommand, botMcpCommand, botMembersCommand, botMessagesCommand, callsCommand, chatsCommand, commandsCommand, completeCommand, configCommand, contactsCommand, conversationsCommand, deleteCommand, doctorCommand, domainListsCommand, editCommand, floodCommand, forwardCommand, generatedApiCommand, guideCommand, imagesCommand, inboxCommand, markReadCommand, mcpCommand, mentionsCommand, messagesCommand, messengerSessionCommands, metadataCommand, modelCatalogueCommand, modelsCommand, pinCommand, pollsCommand, projectsCommand, reactionsCommand, recipientsCommand, repliesCommand, reviewCommand, runsCommand, scheduleCommand, scheduleCommandFor, searchCommand, searchesCommand, sendCommand, sendsCommand, serveCommand, serverCommand, serviceApiCommand, setupCommand, skillCommand, starCommands, statsCommand, stickersCommand, storeCommand, tagsCommand, tasksCommand, tasksStatsCommand, templatesCommand, topicsCommand, unpinCommand, upgradeCommand, watchCommand, } from "./shared-command-exports.js";
167
+ export { accountCommand, addMeetingBatchCommand, addMeetingPreparationCommand, addMeetingProjectCandidatesCommand, addMeetingSeriesInventoryCommand, addStoreMaintenanceCommands, appCompleteCommand, appDoctorCommand, appMcpCommand, attachmentsCommand, botAdminsCommand, botCommand, botMcpCommand, botMembersCommand, botMessagesCommand, callsCommand, chatsCommand, commandsCommand, completeCommand, configCommand, contactsCommand, conversationsCommand, deleteCommand, doctorCommand, domainListsCommand, editCommand, floodCommand, forwardCommand, generatedApiCommand, guideCommand, imagesCommand, inboxCommand, markReadCommand, mcpCommand, mentionsCommand, messagesCommand, messengerSessionCommands, metadataCommand, modelCatalogueCommand, modelsCommand, oauthSessionCommand, pinCommand, pollsCommand, projectsCommand, reactionsCommand, recipientsCommand, repliesCommand, reviewCommand, runsCommand, scheduleCommand, scheduleCommandFor, searchCommand, searchesCommand, sendCommand, sendsCommand, serveCommand, serverCommand, serviceApiCommand, setupCommand, skillCommand, starCommands, statsCommand, stickersCommand, storeCommand, tagsCommand, tasksCommand, tasksStatsCommand, templatesCommand, topicsCommand, unpinCommand, upgradeCommand, watchCommand, } from "./shared-command-exports.js";
168
168
  export { hasSharedContract, overrideSharedContract } from "./shared-contracts.js";
169
169
  export { runnable, withSafety } from "./steps.js";
170
170
  export { type StoreInfo, sharedStoreCommand, storeInfo, storeInfoCommand } from "./store-info.js";
package/dist/cli/index.js CHANGED
@@ -132,7 +132,7 @@ export { stored } from "./messenger/stored.js";
132
132
  export { dateOrNone } from "./messenger/tasks-command.js";
133
133
  export { MODEL_CATALOGUE_QUERY } from "./model-catalogue-command.js";
134
134
  export { writeNewFile } from "./new-file.js";
135
- export { oauthFlowOf, oauthPreset, oauthSessionCommand, } from "./oauth-session.js";
135
+ export { oauthFlowOf, oauthPreset, } from "./oauth-session.js";
136
136
  export { pagingOf, positiveCount, window, withPaging } from "./paging.js";
137
137
  export { notLocalPaths } from "./path-options.js";
138
138
  export { commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
@@ -153,7 +153,7 @@ export { settingRows, withSettingDefaults } from "./setting-defaults.js";
153
153
  export { count, first, flag, fromFile, NONE_NAMED, namedProfile, plain, settingsFor, } from "./settings.js";
154
154
  export { readSetupAnswers, setupPermissionCeiling } from "./setup-answers.js";
155
155
  export { AGENTS, agentFor, screenFor } from "./setup-screen.js";
156
- export { accountCommand, addMeetingBatchCommand, addMeetingPreparationCommand, addMeetingProjectCandidatesCommand, addMeetingSeriesInventoryCommand, addStoreMaintenanceCommands, appCompleteCommand, appDoctorCommand, appMcpCommand, attachmentsCommand, botAdminsCommand, botCommand, botMcpCommand, botMembersCommand, botMessagesCommand, callsCommand, chatsCommand, commandsCommand, completeCommand, configCommand, contactsCommand, conversationsCommand, deleteCommand, doctorCommand, domainListsCommand, editCommand, floodCommand, forwardCommand, generatedApiCommand, guideCommand, imagesCommand, inboxCommand, markReadCommand, mcpCommand, mentionsCommand, messagesCommand, messengerSessionCommands, metadataCommand, modelCatalogueCommand, modelsCommand, pinCommand, pollsCommand, projectsCommand, reactionsCommand, recipientsCommand, repliesCommand, reviewCommand, runsCommand, scheduleCommand, scheduleCommandFor, searchCommand, searchesCommand, sendCommand, sendsCommand, serveCommand, serverCommand, serviceApiCommand, setupCommand, skillCommand, starCommands, statsCommand, stickersCommand, storeCommand, tagsCommand, tasksCommand, tasksStatsCommand, templatesCommand, topicsCommand, unpinCommand, upgradeCommand, watchCommand, } from "./shared-command-exports.js";
156
+ export { accountCommand, addMeetingBatchCommand, addMeetingPreparationCommand, addMeetingProjectCandidatesCommand, addMeetingSeriesInventoryCommand, addStoreMaintenanceCommands, appCompleteCommand, appDoctorCommand, appMcpCommand, attachmentsCommand, botAdminsCommand, botCommand, botMcpCommand, botMembersCommand, botMessagesCommand, callsCommand, chatsCommand, commandsCommand, completeCommand, configCommand, contactsCommand, conversationsCommand, deleteCommand, doctorCommand, domainListsCommand, editCommand, floodCommand, forwardCommand, generatedApiCommand, guideCommand, imagesCommand, inboxCommand, markReadCommand, mcpCommand, mentionsCommand, messagesCommand, messengerSessionCommands, metadataCommand, modelCatalogueCommand, modelsCommand, oauthSessionCommand, pinCommand, pollsCommand, projectsCommand, reactionsCommand, recipientsCommand, repliesCommand, reviewCommand, runsCommand, scheduleCommand, scheduleCommandFor, searchCommand, searchesCommand, sendCommand, sendsCommand, serveCommand, serverCommand, serviceApiCommand, setupCommand, skillCommand, starCommands, statsCommand, stickersCommand, storeCommand, tagsCommand, tasksCommand, tasksStatsCommand, templatesCommand, topicsCommand, unpinCommand, upgradeCommand, watchCommand, } from "./shared-command-exports.js";
157
157
  export { hasSharedContract, overrideSharedContract } from "./shared-contracts.js";
158
158
  export { runnable, withSafety } from "./steps.js";
159
159
  export { sharedStoreCommand, storeInfo, storeInfoCommand } from "./store-info.js";
@@ -243,6 +243,8 @@ export declare const conversationShown: (account: AccountKey, { summary, message
243
243
  thread: string;
244
244
  read: boolean | null;
245
245
  flagged: boolean | null;
246
+ mail_type?: string | undefined;
247
+ reach?: string | undefined;
246
248
  sender_score?: {
247
249
  score: number;
248
250
  signals: string[];
@@ -220,6 +220,8 @@ export declare const threadAnswer: ({ items, ...thread }: ThreadContext, reader:
220
220
  thread: string;
221
221
  read: boolean | null;
222
222
  flagged: boolean | null;
223
+ mail_type?: string | undefined;
224
+ reach?: string | undefined;
223
225
  sender_score?: {
224
226
  score: number;
225
227
  signals: string[];
@@ -85,6 +85,8 @@ export const messageItem = (message, reader) => {
85
85
  thread: message.email.thread,
86
86
  read: message.email.read,
87
87
  flagged: message.email.flagged,
88
+ mail_type: message.email.mailType,
89
+ reach: message.email.reach,
88
90
  sender_score: message.email.senderScore,
89
91
  },
90
92
  provider_metadata: message.providerMetadata,
@@ -224,6 +224,8 @@ export declare const writtenAnswer: ({ operationId, sendId, message, messages, s
224
224
  thread: string;
225
225
  read: boolean | null;
226
226
  flagged: boolean | null;
227
+ mail_type?: string | undefined;
228
+ reach?: string | undefined;
227
229
  sender_score?: {
228
230
  score: number;
229
231
  signals: string[];
@@ -453,6 +455,8 @@ export declare const writtenAnswer: ({ operationId, sendId, message, messages, s
453
455
  thread: string;
454
456
  read: boolean | null;
455
457
  flagged: boolean | null;
458
+ mail_type?: string | undefined;
459
+ reach?: string | undefined;
456
460
  sender_score?: {
457
461
  score: number;
458
462
  signals: string[];
@@ -73,6 +73,8 @@ export const messageHitItem = (hit, query = "") => {
73
73
  thread: hit.email.thread,
74
74
  read: hit.email.read,
75
75
  flagged: hit.email.flagged,
76
+ mail_type: hit.email.mailType,
77
+ reach: hit.email.reach,
76
78
  sender_score: hit.email.senderScore,
77
79
  }
78
80
  : undefined,
@@ -98,9 +98,12 @@ export const oauthSessionCommand = (options) => {
98
98
  // Only the provider's own sign-in hosts: a token request never reaches anything else.
99
99
  fetch: environment.fetch ??
100
100
  hostFetch({
101
- hosts: [provider.authorizeUrl, provider.tokenUrl, provider.revokeUrl]
102
- .filter((url) => url !== undefined)
103
- .map((url) => new URL(url).hostname),
101
+ // Providers often sign in and hand out tokens on one host; hostFetch refuses a host listed twice.
102
+ hosts: [
103
+ ...new Set([provider.authorizeUrl, provider.tokenUrl, provider.revokeUrl]
104
+ .filter((url) => url !== undefined)
105
+ .map((url) => new URL(url).hostname)),
106
+ ],
104
107
  }),
105
108
  signInCommand: `${app.command} ${profile} session start`,
106
109
  ...(environment.signal ? { signal: environment.signal } : {}),
@@ -573,6 +573,8 @@ export declare const botMcpCommand: (bot: import("./index.js").BotMessenger) =>
573
573
  /** @experimental */
574
574
  export declare const botMessagesCommand: (bot: import("./index.js").BotMessenger) => import("commander").Command;
575
575
  export declare const commandsCommand: (app: import("./entry.js").AppIdentity) => import("commander").Command;
576
+ /** @experimental */
577
+ export declare const oauthSessionCommand: (options: import("./oauth-session.js").OAuthSessionOptions) => import("commander").Command;
576
578
  export declare const configCommand: (app: import("./entry.js").AppIdentity, config: {
577
579
  resolveSettings: (flags?: import("./settings.js").GlobalFlags, options?: import("./settings.js").ResolveOptions) => import("./settings.js").Settings & object;
578
580
  configuredProfiles: (options?: import("./settings.js").ResolveOptions) => string[];
@@ -54,6 +54,7 @@ import { tagsCommand as tagsCommandDefinition } from "./messenger/tags-command.j
54
54
  import { tasksCommand as tasksCommandDefinition, tasksStatsCommand as tasksStatsCommandDefinition, } from "./messenger/tasks-command.js";
55
55
  import { topicsCommand as topicsCommandDefinition } from "./messenger/topics-command.js";
56
56
  import { watchCommand as watchCommandDefinition } from "./messenger/watch-command.js";
57
+ import { oauthSessionCommand as oauthSessionCommandDefinition } from "./oauth-session.js";
57
58
  import { runsCommand as runsCommandDefinition } from "./runs/command.js";
58
59
  import { scheduleCommandFor as scheduleCommandForDefinition } from "./schedule/schedule-command.js";
59
60
  import { serviceApiCommand as serviceApiCommandDefinition } from "./service-api.js";
@@ -79,6 +80,8 @@ export const botMcpCommand = sharedCommand(botMcpCommandDefinition);
79
80
  /** @experimental */
80
81
  export const botMessagesCommand = sharedCommand(botMessagesCommandDefinition);
81
82
  export const commandsCommand = sharedCommand(commandsCommandDefinition);
83
+ /** @experimental */
84
+ export const oauthSessionCommand = sharedCommand(oauthSessionCommandDefinition);
82
85
  export const configCommand = sharedCommand(configCommandDefinition);
83
86
  export const setupCommand = sharedCommand(setupCommandDefinition);
84
87
  export const guideCommand = sharedCommand(guideCommandDefinition);
@@ -84,10 +84,7 @@ export declare const unknownSignIn: (warn: (message: string) => void) => (profil
84
84
  readonly state: "unknown";
85
85
  };
86
86
  export declare const storageOf: (raw: string) => TokenStorage;
87
- /**
88
- * `session start | status | end | list` for a service signed in with one token (WC-ACCT-12): the token is asked hidden
89
- * or read from stdin, checked with the service, and only then kept in the keyring or a private file.
90
- */
87
+ /** cli-core's own command (WC-CMD-34): a CLI changes it only through its options. */
91
88
  export declare const tokenSessionCommand: (options: TokenSessionOptions) => Command;
92
89
  /**
93
90
  * The site this run's profile signed in to, as the `{ site }` server variable of `serviceApiCommand` (give it as is)
@@ -6,6 +6,7 @@ import { plainSetupText } from "../setup/plain.js";
6
6
  import { drawsHyperlinks, hyperlink } from "../terminal/hyperlink.js";
7
7
  import { readSecret } from "../terminal/prompt.js";
8
8
  import { baseContext, environmentOf, outputFor, secretInputOf } from "./context.js";
9
+ import { honoursDryRun } from "./dry-run-guard.js";
9
10
  import { refuseOffline } from "./early-refusal.js";
10
11
  import { FETCH, LOCAL_READ, LOCAL_WRITE, logsInOrOut, REMOTE_READ, refuseUnderReadOnly } from "./effects.js";
11
12
  import { itemOf, listOf, renderAnswer } from "./envelope.js";
@@ -14,6 +15,7 @@ import { commandWords, profileFree, refuseCommandName, rootOf } from "./profile.
14
15
  import { ProfileTokenStore } from "./profile-token.js";
15
16
  import { serviceApiCall } from "./service-api-call.js";
16
17
  import { siteValue } from "./service-api-manifest.js";
18
+ import { sharedCommand } from "./shared-contracts.js";
17
19
  /**
18
20
  * `verify` for `tokenSessionCommand` from a config's `auth.verify`: the one operation is sent with the token, a token the
19
21
  * answer does not call active is refused, and the account is the id and name the answer holds.
@@ -63,7 +65,7 @@ export const storageOf = (raw) => {
63
65
  * `session start | status | end | list` for a service signed in with one token (WC-ACCT-12): the token is asked hidden
64
66
  * or read from stdin, checked with the service, and only then kept in the keyring or a private file.
65
67
  */
66
- export const tokenSessionCommand = (options) => {
68
+ const tokenSessionCommandDefinition = (options) => {
67
69
  const { app, service } = options;
68
70
  const word = options.token ?? (options.login ? "password" : "API token");
69
71
  const contextOf = (command) => {
@@ -206,6 +208,8 @@ export const tokenSessionCommand = (options) => {
206
208
  .addCommand(end)
207
209
  .addCommand(list);
208
210
  };
211
+ /** cli-core's own command (WC-CMD-34): a CLI changes it only through its options. */
212
+ export const tokenSessionCommand = honoursDryRun(sharedCommand(tokenSessionCommandDefinition));
209
213
  const SITE = "site";
210
214
  /**
211
215
  * The account a profile keeps: on a service of the owner's own site, `<site>:<id>`, as bitrix24-cli keeps
@@ -1,3 +1,4 @@
1
+ import type { MailType, MailTypeOf } from "../mail/mail-types.js";
1
2
  import type { Upload } from "./attachments.js";
2
3
  import type { CounterObservation, CounterObservations } from "./counters.js";
3
4
  /**
@@ -421,6 +422,10 @@ export interface MailFields {
421
422
  thread: string;
422
423
  read: boolean | null;
423
424
  flagged: boolean | null;
425
+ /** What the email is, apart from its sender. @experimental */
426
+ mailType?: MailType;
427
+ /** How it reached the owner. @experimental */
428
+ reach?: MailTypeOf["reach"];
424
429
  /** How much the sender's mail looks like spam, a scam or a robot, and why; absent when the sender is not scored. */
425
430
  senderScore?: {
426
431
  score: number;
@@ -7,7 +7,7 @@ export declare const PERSON_KINDS: readonly ["person", "organization", "automate
7
7
  /** @experimental */
8
8
  export type PersonKind = (typeof PERSON_KINDS)[number];
9
9
  /** What decided a kind, besides the ties that make someone a `person`. @experimental */
10
- export type KindSignal = "test-data" | "bot" | "no-reply" | "notification-address" | "auto-submitted" | "null-return-path" | "bulk-mail" | "bulk-never-replied" | "automated-name" | "organization" | "role-address" | "company-name" | "no-tie" | "no-name";
10
+ export type KindSignal = "test-data" | "bot" | "no-reply" | "notification-address" | "auto-submitted" | "null-return-path" | "bulk-mail" | "bulk-never-replied" | "newsletter-only" | "automated-name" | "organization" | "role-address" | "company-name" | "no-tie" | "no-name";
11
11
  /**
12
12
  * A sender bot's reference, `sender-bot:<id>`: a program that writes to the owner, an entity apart from people.
13
13
  * `bot:` names the agents of the `bots` table. @experimental
@@ -501,6 +501,8 @@ export declare const contactMessages: v.StrictObjectSchema<{
501
501
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
502
502
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
503
503
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
504
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
505
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
504
506
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
505
507
  readonly score: v.NumberSchema<undefined>;
506
508
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -1301,6 +1303,8 @@ export declare const contactContext: v.UnionSchema<[v.StrictObjectSchema<{
1301
1303
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
1302
1304
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1303
1305
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1306
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1307
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1304
1308
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
1305
1309
  readonly score: v.NumberSchema<undefined>;
1306
1310
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -219,6 +219,8 @@ export declare const conversationDetails: v.UnionSchema<[v.StrictObjectSchema<{
219
219
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
220
220
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
221
221
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
222
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
223
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
222
224
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
223
225
  readonly score: v.NumberSchema<undefined>;
224
226
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -446,6 +448,8 @@ export declare const conversationDetails: v.UnionSchema<[v.StrictObjectSchema<{
446
448
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
447
449
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
448
450
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
451
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
452
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
449
453
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
450
454
  readonly score: v.NumberSchema<undefined>;
451
455
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -210,6 +210,8 @@ export declare const contribution: v.StrictObjectSchema<{
210
210
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
211
211
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
212
212
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
213
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
214
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
213
215
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
214
216
  readonly score: v.NumberSchema<undefined>;
215
217
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -437,6 +439,8 @@ export declare const contribution: v.StrictObjectSchema<{
437
439
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
438
440
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
439
441
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
442
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
443
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
440
444
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
441
445
  readonly score: v.NumberSchema<undefined>;
442
446
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -702,6 +706,8 @@ export declare const contribution: v.StrictObjectSchema<{
702
706
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
703
707
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
704
708
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
709
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
710
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
705
711
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
706
712
  readonly score: v.NumberSchema<undefined>;
707
713
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -929,6 +935,8 @@ export declare const contribution: v.StrictObjectSchema<{
929
935
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
930
936
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
931
937
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
938
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
939
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
932
940
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
933
941
  readonly score: v.NumberSchema<undefined>;
934
942
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -1230,6 +1238,8 @@ export declare const evidence: v.UnionSchema<[v.StrictObjectSchema<{
1230
1238
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
1231
1239
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1232
1240
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1241
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1242
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1233
1243
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
1234
1244
  readonly score: v.NumberSchema<undefined>;
1235
1245
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -1457,6 +1467,8 @@ export declare const evidence: v.UnionSchema<[v.StrictObjectSchema<{
1457
1467
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
1458
1468
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1459
1469
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1470
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1471
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1460
1472
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
1461
1473
  readonly score: v.NumberSchema<undefined>;
1462
1474
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -1722,6 +1734,8 @@ export declare const evidence: v.UnionSchema<[v.StrictObjectSchema<{
1722
1734
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
1723
1735
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1724
1736
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1737
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1738
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1725
1739
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
1726
1740
  readonly score: v.NumberSchema<undefined>;
1727
1741
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;
@@ -1949,6 +1963,8 @@ export declare const evidence: v.UnionSchema<[v.StrictObjectSchema<{
1949
1963
  readonly thread: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
1950
1964
  readonly read: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1951
1965
  readonly flagged: v.NullableSchema<v.BooleanSchema<undefined>, undefined>;
1966
+ readonly mail_type: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1967
+ readonly reach: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1952
1968
  readonly sender_score: v.OptionalSchema<v.StrictObjectSchema<{
1953
1969
  readonly score: v.NumberSchema<undefined>;
1954
1970
  readonly signals: v.ArraySchema<v.StringSchema<undefined>, undefined>;