@wirecat/cli-core 1.0.0 → 1.1.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 +89 -0
- package/THIRD_PARTY_NOTICES +43 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/cli/documents/words.d.ts +1 -1
- package/dist/cli/domain-lists-command.d.ts +16 -0
- package/dist/cli/domain-lists-command.js +88 -0
- package/dist/cli/index.d.ts +4 -3
- package/dist/cli/index.js +3 -2
- package/dist/cli/model-catalogue-command.d.ts +6 -0
- package/dist/cli/model-catalogue-command.js +1 -1
- package/dist/cli/oauth-session.d.ts +38 -4
- package/dist/cli/oauth-session.js +66 -22
- package/dist/cli/shared-command-exports.d.ts +2 -0
- package/dist/cli/shared-command-exports.js +3 -0
- package/dist/cli/token-session.d.ts +9 -0
- package/dist/cli/token-session.js +29 -2
- package/dist/domain/domain-lists.d.ts +86 -0
- package/dist/domain/domain-lists.js +110 -0
- package/dist/domain/free-mail-domains.generated.d.ts +1 -0
- package/dist/domain/free-mail-domains.generated.js +4 -0
- package/dist/domain/organization-sectors.d.ts +9 -3
- package/dist/domain/organization-sectors.generated.d.ts +1 -0
- package/dist/domain/organization-sectors.generated.js +1 -0
- package/dist/domain/organization-sectors.js +16 -3
- package/dist/domain/person-kinds.d.ts +6 -1
- package/dist/domain/person-kinds.js +5 -0
- package/dist/entities/domain-list.d.ts +27 -0
- package/dist/entities/domain-list.js +28 -0
- package/dist/entities/index.d.ts +20 -2
- package/dist/entities/index.js +3 -1
- package/dist/entities/knowledge-lists.d.ts +1 -1
- package/dist/errors/reasons.js +4 -2
- package/dist/mail/mail-types.d.ts +48 -0
- package/dist/mail/mail-types.js +218 -0
- package/dist/oauth/index.d.ts +1 -1
- package/dist/oauth/storage.d.ts +10 -2
- package/dist/oauth/storage.js +23 -9
- package/dist/services/domain-lists-download.d.ts +26 -0
- package/dist/services/domain-lists-download.js +155 -0
- package/dist/services/metadata.d.ts +1 -1
- package/dist/store/areas.d.ts +1 -1
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/people.d.ts +18 -9
- package/dist/store/people.js +8 -7
- package/dist/store/sqlite/accounts.js +3 -1
- package/dist/store/sqlite/domain-organizations.d.ts +7 -4
- package/dist/store/sqlite/domain-organizations.js +94 -36
- package/dist/store/sqlite/email-types.d.ts +79 -0
- package/dist/store/sqlite/email-types.js +261 -0
- package/dist/store/sqlite/emails.d.ts +11 -2
- package/dist/store/sqlite/emails.js +18 -7
- package/dist/store/sqlite/identities.d.ts +4 -1
- package/dist/store/sqlite/identities.js +11 -2
- package/dist/store/sqlite/identity-rekey.js +2 -0
- package/dist/store/sqlite/manifest.js +4 -0
- package/dist/store/sqlite/merged-persons.d.ts +3 -2
- package/dist/store/sqlite/merged-persons.js +5 -3
- package/dist/store/sqlite/migrations.generated.js +56 -0
- package/dist/store/sqlite/people-list.d.ts +1 -6
- package/dist/store/sqlite/people-list.js +38 -32
- package/dist/store/sqlite/person-links.js +13 -3
- package/dist/store/sqlite/person-match-scan.js +5 -2
- package/dist/store/sqlite/schema/sender-bots.d.ts +56 -0
- package/dist/store/sqlite/schema/sender-bots.js +9 -1
- package/dist/store/sqlite/schema.d.ts +49 -1
- package/dist/store/sqlite/schema.js +6 -1
- package/dist/store/sqlite/sender-bots.d.ts +80 -15
- package/dist/store/sqlite/sender-bots.js +378 -136
- package/dist/store/sqlite/sender-signals.d.ts +11 -4
- package/dist/store/sqlite/sender-signals.js +14 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,95 @@ 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.1.0 — 25.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`store.people.listBots` and `showBot`** read the sender bots: by name, by part of a name, address or username, or by
|
|
13
|
+
the organization they send for (`organization:<id>`). `showBot` adds every move to or from the bot. memo and Desktop
|
|
14
|
+
build their bots list on them.
|
|
15
|
+
- **The domain-list pack: more organizations get a sector, and the lists update without a release.**
|
|
16
|
+
`domainListsCommand` (experimental) gives a CLI `domain-lists update` and `domain-lists list`. `update` downloads the
|
|
17
|
+
newest pack from WireCat's GitHub release `domain-lists`, each file checked by sha256 the way `models download` checks
|
|
18
|
+
a model, and swaps the pack folder whole. The first pack holds UT1's sector and webmail lists (CC BY-SA 4.0, their
|
|
19
|
+
own files), the FDIC-insured US banks, UT1's malware and cryptojacking hosts, and Stop Forum Spam's toxic domains,
|
|
20
|
+
which each computer fetches from Stop Forum Spam itself because its terms forbid redistribution. Each source carries
|
|
21
|
+
its licence, credit and class: `commercial-ok`, or `non-commercial`, which WireCat may use and a paid service may
|
|
22
|
+
not; `--commercial-only` leaves those out. Sender domains are matched on this computer only, never sent anywhere.
|
|
23
|
+
Two sectors come from the pack, `gaming_gambling` and `adult`. UT1's webmail providers never make an organization.
|
|
24
|
+
Spam and malware lists never set a sector: the lookup reports them apart, for exact host names only, and nothing
|
|
25
|
+
reads them yet. `.github/workflows/domain-lists.yml` builds and publishes the pack weekly.
|
|
26
|
+
- **About 23,000 more free-mail providers are never an organization.** Built in from microlink's free-email-domains
|
|
27
|
+
(MIT), less the domains Wikidata calls an organization, such as `sky.com` or `orange.fr`, whose own bills come from
|
|
28
|
+
that domain. An organization already made on a domain that is now free mail stays.
|
|
29
|
+
- **Each email has a type of its own, apart from its sender (store version 76).** `Email.mailType` is one of
|
|
30
|
+
`auto_reply`, `security`, `calendar`, `travel`, `event_ticket`, `order`, `shipping`, `bill`, `social_notification`,
|
|
31
|
+
`discussion_list`, `newsletter`, `promotion`, `system_alert`, `account_notice`, `personal` or `other`, worked out
|
|
32
|
+
locally from the stored headers, recipients, attachment types, schema.org markup in a kept HTML body, the sender's bot
|
|
33
|
+
and its organization's sector, and whether the owner wrote to the sender. `Email.reach` (`direct`, `group`,
|
|
34
|
+
`broadcast`) is worked out per email too, and `Email.typeSignal` says what decided the type. They are kept on the
|
|
35
|
+
email and cleared by triggers when what decides them changes; a store's existing mail gets them in batches on the
|
|
36
|
+
first read that filters by them. The words are in the [glossary](docs/dev/GLOSSARY.md#mail-types).
|
|
37
|
+
- **`store.mail.emails` filters by `types` and `reaches`**, and **`store.mail.mailSenders`** lists the senders of
|
|
38
|
+
incoming mail with their mail counted by type and reach: a sender is listed when any of its mail passes the filter,
|
|
39
|
+
so a shop that sends receipts and sales shows under both. Both are experimental.
|
|
40
|
+
- **`oauthSessionCommand` takes the sign-ins a CLI kept before**, so zm and drive can move to it with nobody signing
|
|
41
|
+
in again. All new options are optional:
|
|
42
|
+
- `codec` is the entry's format (`zoomTokenCodec`, `driveSessionCodec`). The standard one stays the default.
|
|
43
|
+
- `legacyAccounts(env, profile)` names where older versions kept a profile's sign-in, as an account or as a service
|
|
44
|
+
and an account. The first read copies it to `oauth:<provider>:<profile>`. `session end` removes it too. A run with
|
|
45
|
+
moved folders only reads it.
|
|
46
|
+
- `startOptions` adds options to `session start`, such as a client or the scopes to ask. `preset` reads them from
|
|
47
|
+
`command.opts()`.
|
|
48
|
+
- `preset` may be async. In `session start` it also gets the sign-in steps, so it can ask for a missing client id
|
|
49
|
+
with `--answer-stdin`.
|
|
50
|
+
- `verify` may return `extra`, which the codec saves in the entry at sign-in (drive's `principal`).
|
|
51
|
+
- `afterSignIn(command, signedIn)` runs once the sign-in is kept. It gets the profile, the account and the client
|
|
52
|
+
the sign-in used, so a CLI can save that client beside it (WC-SECR-25).
|
|
53
|
+
- `profiles(env)` is the list `session list` names, for a CLI that keeps its profiles in its own config.
|
|
54
|
+
- **`session start --answer-stdin`** in every CLI built on `oauthSessionCommand`. With `--json` it asks for the
|
|
55
|
+
redirected address as a `needs` line when the browser does not come back to this computer.
|
|
56
|
+
- **`session status` gives `expires_at`**, when the access token runs out. A refresh moves it on.
|
|
57
|
+
- **`session list` rows have `state`**: `saved`, `missing` or `unknown`, in `oauthSessionCommand` and
|
|
58
|
+
`tokenSessionCommand`. When the keyring cannot be reached, or an entry cannot be read, the row is `signed_in: null`
|
|
59
|
+
and `state: "unknown"` and the list still answers. One warning names the cause, and `session status` says more.
|
|
60
|
+
- **`storageOf`, `timeLimit` and `withTimeLimit` are exported** from `@wirecat/cli-core/cli`, so CLIs stop keeping
|
|
61
|
+
copies of them.
|
|
62
|
+
- **`credentialStorage` reads an older entry under another service** (`legacyAccounts: [{ service, account }]`). It
|
|
63
|
+
copies an entry it found in the private file within the file, never into the keyring. `remove` removes the older
|
|
64
|
+
entries too, except in a run with moved folders, so the next read does not sign the profile in again.
|
|
65
|
+
|
|
66
|
+
### Changed — experimental
|
|
67
|
+
|
|
68
|
+
- **Bots are their own entity, apart from people (store version 75).** A sender bot (`sender-bot:<id>`) now holds its
|
|
69
|
+
identities itself, in `sender_bot_identities`: an identity belongs to one person or one bot, never both. Its messages
|
|
70
|
+
and mail keep pointing at the identity. A bot never appears in `people.list`, its counts, `people.similar` or
|
|
71
|
+
`people.ties`; `people list kind:automated` keeps the people a name or a bulk mailbox marks. The upgrade moves every
|
|
72
|
+
version 74 bot's identities off its person row. That row stays, hidden, so a move back gives its uid back, and its
|
|
73
|
+
`person:` ref still names the bot in a move. `minCompatible` stays 73: triggers keep a 1.0 build from giving a bot's
|
|
74
|
+
identity a person again, and the next list settles a bot such a build sorts.
|
|
75
|
+
- **`SenderBot` describes the bot itself**: its name, identities, organization, author, reason, counts, reach and
|
|
76
|
+
signals, and no longer `person`. `moveToPerson` gives each identity back to the person it came from unless `person` is
|
|
77
|
+
named. Both moves take `sender-bot:<id>`, `person:<uid>` or an identity.
|
|
78
|
+
- **`people.list` rows lose `bot`**, and `KindSignal` loses `owner-choice`: no listed row is a bot.
|
|
79
|
+
- **A sector from the rules is changed or removed when a newer list no longer gives it.** Rules mark their sector
|
|
80
|
+
`metadata.sector_by = 'rules'`; a sector with any other `sector_by` is the owner's and stays. When the built-in table
|
|
81
|
+
or the pack changes, the next kind pass works out every organization's sector again. An organization's `sector` can
|
|
82
|
+
now also be `gaming_gambling` or `adult`.
|
|
83
|
+
|
|
84
|
+
### Fixed
|
|
85
|
+
|
|
86
|
+
- **`tokenSessionCommand`'s `session list` no longer fails for every profile when one sign-in cannot be read**, from
|
|
87
|
+
a keyring this run cannot reach or a broken entry. That profile is `unknown` and the others are listed. WireCat
|
|
88
|
+
Desktop reads its profiles from this list.
|
|
89
|
+
- **A generated `api` command refuses an empty required argument before it sends anything.** `linear api issue-delete
|
|
90
|
+
--id "" --yes` used to send the request, and Linear's answer left the write unconfirmed (exit 14,
|
|
91
|
+
`outcome.unknown`). Now a required path, query or header parameter, or a required GraphQL variable from a flag
|
|
92
|
+
or from `--body`, that is empty or only spaces stops the command with exit 2 (`validation_error`, reason `input.invalid`),
|
|
93
|
+
naming the flag, and nothing is sent. An empty path parameter could otherwise reach another endpoint (`/posts/`).
|
|
94
|
+
`serviceApiWriter` refuses the same for code. A bot API's body field is still sent empty: Telegram's `setWebhook`
|
|
95
|
+
takes an empty `url` to remove the hook.
|
|
96
|
+
|
|
8
97
|
## 1.0.0 — 25.11.2026
|
|
9
98
|
|
|
10
99
|
### Added
|
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -806,3 +806,46 @@ restrictions (https://ai.google.dev/gemma/prohibited_use_policy).
|
|
|
806
806
|
The domain-to-sector table (src/domain/organization-sectors.generated.ts) is built from Wikidata
|
|
807
807
|
(https://www.wikidata.org), whose structured data is available under CC0 1.0
|
|
808
808
|
(https://creativecommons.org/publicdomain/zero/1.0/). The export date is in the file's header.
|
|
809
|
+
|
|
810
|
+
The order of the checks and two sender patterns in src/mail/mail-types.ts are ported from Zero's header classifier
|
|
811
|
+
(https://github.com/Mail-0/Zero, apps/server/src/lib/imap/categorize.ts at commit
|
|
812
|
+
4b642dfd9890a1fdcb1b98a177fe74ca3142c445), under the MIT License:
|
|
813
|
+
|
|
814
|
+
MIT License
|
|
815
|
+
|
|
816
|
+
Copyright (c) 2025 Zero Email
|
|
817
|
+
|
|
818
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
819
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
820
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
821
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
822
|
+
|
|
823
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
824
|
+
Software.
|
|
825
|
+
|
|
826
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
827
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
828
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
829
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
830
|
+
The free-mail provider list (src/domain/free-mail-domains.generated.ts) is derived from free-email-domains
|
|
831
|
+
(https://github.com/microlinkhq/free-email-domains), under the MIT License:
|
|
832
|
+
|
|
833
|
+
The MIT License (MIT)
|
|
834
|
+
|
|
835
|
+
Copyright © 2017 Microlink <hello@microlink.io> (microlink.io)
|
|
836
|
+
|
|
837
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
838
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
839
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
840
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
841
|
+
|
|
842
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
843
|
+
Software.
|
|
844
|
+
|
|
845
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
846
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
847
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
848
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
849
|
+
|
|
850
|
+
The domain-list pack that `domain-lists update` downloads is not part of this package. Each of its sources keeps its
|
|
851
|
+
own licence, credit and licence class, listed in the pack's manifest.json and by `domain-lists list`.
|
|
@@ -24,12 +24,12 @@ export interface DailyArchiveTimerInput {
|
|
|
24
24
|
}
|
|
25
25
|
export declare const dailyArchiveTimer: (input: DailyArchiveTimerInput) => DailyArchiveTimer;
|
|
26
26
|
export declare const manageDailyArchiveTimer: (plan: DailyArchiveTimer, action: "install" | "start" | "stop" | "status" | "uninstall", system: Pick<ServerSystem, "platform" | "run">, env: NodeJS.ProcessEnv, signal?: AbortSignal) => Promise<{
|
|
27
|
-
action?: undefined;
|
|
28
27
|
name: string;
|
|
29
28
|
installed: boolean;
|
|
30
29
|
active: boolean;
|
|
31
30
|
servicePath: string;
|
|
32
31
|
timerPath: string;
|
|
32
|
+
action?: undefined;
|
|
33
33
|
} | {
|
|
34
34
|
active?: undefined;
|
|
35
35
|
name: string;
|
|
@@ -58,8 +58,8 @@ export interface CopyAge {
|
|
|
58
58
|
}
|
|
59
59
|
export declare const ageOf: (lastSync: string | undefined, now?: number) => CopyAge;
|
|
60
60
|
export declare const staleCopy: (provider: string, lastSync: string | undefined, now?: number) => {
|
|
61
|
-
next?: undefined;
|
|
62
61
|
missing?: undefined;
|
|
62
|
+
next?: undefined;
|
|
63
63
|
meta?: undefined;
|
|
64
64
|
} | {
|
|
65
65
|
missing: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { AppIdentity } from "../ports/app.js";
|
|
3
|
+
import type { Fetch } from "../speech/install.js";
|
|
4
|
+
import { type Body } from "./envelope.js";
|
|
5
|
+
export interface DomainListsCommandOptions {
|
|
6
|
+
env: () => NodeJS.ProcessEnv;
|
|
7
|
+
output: (answer: Body, command: Command) => void;
|
|
8
|
+
diagnostic: (line: string) => void;
|
|
9
|
+
offline?: () => boolean;
|
|
10
|
+
fetch?: Fetch;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* `domain-lists`: the pack of bank, shop, news and spam lists matched against sender domains on this computer, kept
|
|
14
|
+
* apart from the package so it updates without a release. Downloaded like a model: whole, checked by sha256.
|
|
15
|
+
*/
|
|
16
|
+
export declare const domainListsCommand: (app: AppIdentity, options: DomainListsCommandOptions) => Command;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { domainListsDirectory, installedPack, listFile } from "../domain/domain-lists.js";
|
|
5
|
+
import { updateDomainLists } from "../services/domain-lists-download.js";
|
|
6
|
+
import { stepLines } from "../terminal/step-lines.js";
|
|
7
|
+
import { FETCH, LOCAL_READ, NO_EFFECTS } from "./effects.js";
|
|
8
|
+
import { listOf } from "./envelope.js";
|
|
9
|
+
import { downloadProgress } from "./model-catalogue-command.js";
|
|
10
|
+
const itemsOf = (pack, env) => pack === undefined
|
|
11
|
+
? []
|
|
12
|
+
: pack.sources.flatMap((source) => {
|
|
13
|
+
const file = pack.files[source.id];
|
|
14
|
+
if (file === undefined)
|
|
15
|
+
return [];
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
id: source.id,
|
|
19
|
+
title: source.title,
|
|
20
|
+
signal: source.signal,
|
|
21
|
+
class: source.class,
|
|
22
|
+
licence: source.licence,
|
|
23
|
+
licence_url: source.licence_url,
|
|
24
|
+
attribution: source.attribution,
|
|
25
|
+
homepage: source.homepage,
|
|
26
|
+
upstream: source.upstream === true,
|
|
27
|
+
lines: file.lines,
|
|
28
|
+
tags: source.tags ?? {},
|
|
29
|
+
version: pack.version,
|
|
30
|
+
installed_at: pack.installed_at,
|
|
31
|
+
sha256: file.sha256,
|
|
32
|
+
path: listFile(domainListsDirectory(env), source.id),
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* `domain-lists`: the pack of bank, shop, news and spam lists matched against sender domains on this computer, kept
|
|
38
|
+
* apart from the package so it updates without a release. Downloaded like a model: whole, checked by sha256.
|
|
39
|
+
*/
|
|
40
|
+
export const domainListsCommand = (app, options) => {
|
|
41
|
+
const lists = annotate(new Command("domain-lists"), { effects: NO_EFFECTS }).description("lists of bank, shop, news and spam domains that give organizations their sector, matched on this computer");
|
|
42
|
+
annotate(lists.command("list"), {
|
|
43
|
+
effects: LOCAL_READ,
|
|
44
|
+
output: { entity: "domain_list" },
|
|
45
|
+
examples: [`${app.command} domain-lists list`],
|
|
46
|
+
})
|
|
47
|
+
.description("the lists downloaded here, with their licence, licence class and size")
|
|
48
|
+
.option("--json", "print JSON")
|
|
49
|
+
.action(function () {
|
|
50
|
+
const env = options.env();
|
|
51
|
+
const items = itemsOf(installedPack(env), env);
|
|
52
|
+
if (items.length === 0)
|
|
53
|
+
options.diagnostic(`no domain lists yet: \`${app.command} domain-lists update\` downloads them`);
|
|
54
|
+
options.output(listOf("domain-lists list", { items, limit: Math.max(1, items.length), has_more: false }), this);
|
|
55
|
+
});
|
|
56
|
+
annotate(lists.command("update"), {
|
|
57
|
+
effects: FETCH,
|
|
58
|
+
output: { entity: "domain_list" },
|
|
59
|
+
examples: [`${app.command} domain-lists update`, `${app.command} domain-lists update --commercial-only`],
|
|
60
|
+
})
|
|
61
|
+
.description("download the newest pack from WireCat's GitHub release, each file checked by sha256; lists that may not be " +
|
|
62
|
+
"redistributed come whole from their own source. No sender is ever sent anywhere")
|
|
63
|
+
.option("--commercial-only", "leave out lists whose terms forbid commercial use, and remove those already here")
|
|
64
|
+
.option("--offline", "refuse a download that needs the network")
|
|
65
|
+
.option("--json", "print JSON")
|
|
66
|
+
.action(async function (given) {
|
|
67
|
+
if (options.offline?.() || this.optsWithGlobals().offline)
|
|
68
|
+
throw new CliError("permission_error", "updating the domain lists needs the network; --offline was requested", {
|
|
69
|
+
reason: "domain-lists.offline",
|
|
70
|
+
});
|
|
71
|
+
const env = options.env();
|
|
72
|
+
const bytes = downloadProgress(stepLines(options.diagnostic, Boolean(this.optsWithGlobals().json)), "domain-lists");
|
|
73
|
+
const done = await updateDomainLists({
|
|
74
|
+
env,
|
|
75
|
+
commercialOnly: given.commercialOnly === true,
|
|
76
|
+
progress: options.diagnostic,
|
|
77
|
+
bytes,
|
|
78
|
+
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
79
|
+
});
|
|
80
|
+
options.diagnostic(done.updated
|
|
81
|
+
? `domain lists ${done.pack.version} in place${done.previous ? ` (was ${done.previous})` : ""}; ` +
|
|
82
|
+
"organizations take their sectors from them the next time a sync sorts a new sender"
|
|
83
|
+
: `domain lists ${done.pack.version} are already the newest`);
|
|
84
|
+
const items = itemsOf(done.pack, env);
|
|
85
|
+
options.output(listOf("domain-lists update", { items, limit: Math.max(1, items.length), has_more: false }), this);
|
|
86
|
+
});
|
|
87
|
+
return lists;
|
|
88
|
+
};
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { syncProgress } from "../entities/store-records.js";
|
|
|
11
11
|
export { isCliFailure, isCommanderFailure, storeDamaged } from "../errors/failures.js";
|
|
12
12
|
export { type AppErrors, failureContext } from "../errors/reasons.js";
|
|
13
13
|
export { linkFetch } from "../http/link-fetch.js";
|
|
14
|
+
export { type TimeLimit, timeLimit, withTimeLimit } from "../http/time-limit.js";
|
|
14
15
|
export { mailFindingFieldsHelp } from "../mail/findings.js";
|
|
15
16
|
export { botInstructions } from "../mcp/bot/instructions.js";
|
|
16
17
|
export type { BotServerOptions, RunBotCommand } from "../mcp/bot/server.js";
|
|
@@ -142,7 +143,7 @@ export { type Saving, stored } from "./messenger/stored.js";
|
|
|
142
143
|
export { dateOrNone } from "./messenger/tasks-command.js";
|
|
143
144
|
export { MODEL_CATALOGUE_QUERY, type ModelCatalogueOptions } from "./model-catalogue-command.js";
|
|
144
145
|
export { writeNewFile } from "./new-file.js";
|
|
145
|
-
export { type OAuthEnvironment, type OAuthPreset, type OAuthPresetOptions, type OAuthSessionOptions, oauthFlowOf, oauthPreset, oauthSessionCommand, } from "./oauth-session.js";
|
|
146
|
+
export { type OAuthEnvironment, type OAuthPreset, type OAuthPresetOptions, type OAuthSessionOptions, type OAuthSignedIn, oauthFlowOf, oauthPreset, oauthSessionCommand, } from "./oauth-session.js";
|
|
146
147
|
export { pagingOf, positiveCount, window, withPaging } from "./paging.js";
|
|
147
148
|
export { notLocalPaths } from "./path-options.js";
|
|
148
149
|
export { type CommandPermissions, type ConditionalKey, commandPathKey, commandPermissions, knownBeside, knownPermissionKeys, type PermissionKeyOf, type PermissionKeySource, refuseUnknownPermissionKeys, unknownPermissionIssues, unknownPermissionKeys, } from "./permission-keys.js";
|
|
@@ -163,12 +164,12 @@ export { type DeclaredSetting, type SettingRow, settingRows, withSettingDefaults
|
|
|
163
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";
|
|
164
165
|
export { type PermissionAnswer, readSetupAnswers, type SetupAnswers, setupPermissionCeiling } from "./setup-answers.js";
|
|
165
166
|
export { AGENTS, type Agent, agentFor, screenFor } from "./setup-screen.js";
|
|
166
|
-
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, 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, 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
168
|
export { hasSharedContract, overrideSharedContract } from "./shared-contracts.js";
|
|
168
169
|
export { runnable, withSafety } from "./steps.js";
|
|
169
170
|
export { type StoreInfo, sharedStoreCommand, storeInfo, storeInfoCommand } from "./store-info.js";
|
|
170
171
|
export { type RecoveryCheck, type RecoveryRun, recoveryNotes, storeRecoverCommand, storeRecoveryCheck, storeRecoveryRun, } from "./store-recover.js";
|
|
171
172
|
export { changeStoreSetting, isStoreSetting, STORE_SETTINGS, storeSettings } from "./store-settings.js";
|
|
172
173
|
export type { TemplatesOptions } from "./templates-command.js";
|
|
173
|
-
export { type ManifestVerifyOptions, manifestVerify, signedInSite, type TokenSessionOptions, tokenSessionCommand, } from "./token-session.js";
|
|
174
|
+
export { type ManifestVerifyOptions, manifestVerify, signedInSite, storageOf, type TokenSessionOptions, tokenSessionCommand, } from "./token-session.js";
|
|
174
175
|
export { restartServers, type UpgradeContext } from "./upgrade-command.js";
|
package/dist/cli/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { syncProgress } from "../entities/store-records.js";
|
|
|
11
11
|
export { isCliFailure, isCommanderFailure, storeDamaged } from "../errors/failures.js";
|
|
12
12
|
export { failureContext } from "../errors/reasons.js";
|
|
13
13
|
export { linkFetch } from "../http/link-fetch.js";
|
|
14
|
+
export { timeLimit, withTimeLimit } from "../http/time-limit.js";
|
|
14
15
|
export { mailFindingFieldsHelp } from "../mail/findings.js";
|
|
15
16
|
export { botInstructions } from "../mcp/bot/instructions.js";
|
|
16
17
|
export { callMeetingPreparationTool, meetingPreparationTool } from "../mcp/meeting-preparation.js";
|
|
@@ -152,11 +153,11 @@ export { settingRows, withSettingDefaults } from "./setting-defaults.js";
|
|
|
152
153
|
export { count, first, flag, fromFile, NONE_NAMED, namedProfile, plain, settingsFor, } from "./settings.js";
|
|
153
154
|
export { readSetupAnswers, setupPermissionCeiling } from "./setup-answers.js";
|
|
154
155
|
export { AGENTS, agentFor, screenFor } from "./setup-screen.js";
|
|
155
|
-
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, 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, 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
157
|
export { hasSharedContract, overrideSharedContract } from "./shared-contracts.js";
|
|
157
158
|
export { runnable, withSafety } from "./steps.js";
|
|
158
159
|
export { sharedStoreCommand, storeInfo, storeInfoCommand } from "./store-info.js";
|
|
159
160
|
export { recoveryNotes, storeRecoverCommand, storeRecoveryCheck, storeRecoveryRun, } from "./store-recover.js";
|
|
160
161
|
export { changeStoreSetting, isStoreSetting, STORE_SETTINGS, storeSettings } from "./store-settings.js";
|
|
161
|
-
export { manifestVerify, signedInSite, tokenSessionCommand, } from "./token-session.js";
|
|
162
|
+
export { manifestVerify, signedInSite, storageOf, tokenSessionCommand, } from "./token-session.js";
|
|
162
163
|
export { restartServers } from "./upgrade-command.js";
|
|
@@ -3,6 +3,7 @@ import { Command } from "commander";
|
|
|
3
3
|
import { type TextModel } from "../embeddings/models.js";
|
|
4
4
|
import type { AppIdentity } from "../ports/app.js";
|
|
5
5
|
import { type TextModelSwitch } from "../services/text-model-choice.js";
|
|
6
|
+
import { stepLines } from "../terminal/step-lines.js";
|
|
6
7
|
import { type Body } from "./envelope.js";
|
|
7
8
|
/** @experimental */
|
|
8
9
|
export declare const MODEL_CATALOGUE_QUERY: import("@wirecat/cli-base/query").QueryRegistry;
|
|
@@ -26,6 +27,11 @@ export interface ModelCatalogueOptions {
|
|
|
26
27
|
}
|
|
27
28
|
/** Provider composition supplies I/O and supported kinds; parsing, receipts and download policy stay shared. */
|
|
28
29
|
export declare const modelCatalogueCommand: (app: AppIdentity, options: ModelCatalogueOptions) => Command;
|
|
30
|
+
/**
|
|
31
|
+
* `{"event":"progress","step":"download",…}` on stderr under --json, for a window to draw a bar by: at most every half
|
|
32
|
+
* second, but always the first line and the last.
|
|
33
|
+
*/
|
|
34
|
+
export declare const downloadProgress: (emit: ReturnType<typeof stepLines>, label: string) => (done: number, total: number) => void;
|
|
29
35
|
/** One text model as `models list`, `download`, `use` and `add` print it, in every CLI. */
|
|
30
36
|
export declare const textModelItem: (model: TextModel, env: NodeJS.ProcessEnv) => {
|
|
31
37
|
id: string;
|
|
@@ -205,7 +205,7 @@ const PROGRESS_EVERY_MS = 500;
|
|
|
205
205
|
* `{"event":"progress","step":"download",…}` on stderr under --json, for a window to draw a bar by: at most every half
|
|
206
206
|
* second, but always the first line and the last.
|
|
207
207
|
*/
|
|
208
|
-
const downloadProgress = (emit, label) => {
|
|
208
|
+
export const downloadProgress = (emit, label) => {
|
|
209
209
|
let last = Number.NEGATIVE_INFINITY;
|
|
210
210
|
return (done, total) => {
|
|
211
211
|
const now = Date.now();
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { OAuthFlow } from "@wirecat/cli-base/codegen/runtime";
|
|
2
|
-
import { Command } from "commander";
|
|
2
|
+
import { Command, type Option } from "commander";
|
|
3
3
|
import type { OAuthClient, OAuthProvider } from "../oauth/provider.js";
|
|
4
|
+
import { type LegacyAccount, type TokenCodec } from "../oauth/storage.js";
|
|
4
5
|
import type { AppIdentity } from "../ports/app.js";
|
|
5
6
|
import type { EventSink } from "../runs/events.js";
|
|
7
|
+
import { type SignInSteps } from "../terminal/sign-in-steps.js";
|
|
6
8
|
import { type BaseEnvironment } from "./context.js";
|
|
7
9
|
import type { ServiceApiManifest } from "./service-api-manifest.js";
|
|
8
10
|
import type { GlobalFlags, ResolveOptions, Settings } from "./settings.js";
|
|
@@ -44,6 +46,17 @@ export interface OAuthEnvironment extends BaseEnvironment {
|
|
|
44
46
|
/** Gets the command, so the entry opens nothing under `--json`, `--no-input`, CI or without a terminal. */
|
|
45
47
|
openBrowser?: (url: string, command?: Command) => Promise<void>;
|
|
46
48
|
}
|
|
49
|
+
/** What `afterSignIn` gets once the sign-in is kept. @experimental */
|
|
50
|
+
export interface OAuthSignedIn {
|
|
51
|
+
env: NodeJS.ProcessEnv;
|
|
52
|
+
profile: string;
|
|
53
|
+
/** `verify`'s `id` and `account`. */
|
|
54
|
+
id: string;
|
|
55
|
+
account: Readonly<Record<string, unknown>>;
|
|
56
|
+
/** The client the preset gave this sign-in, which its refreshes need. */
|
|
57
|
+
client: OAuthClient;
|
|
58
|
+
scopes: readonly string[];
|
|
59
|
+
}
|
|
47
60
|
/** @experimental */
|
|
48
61
|
export interface OAuthSessionOptions {
|
|
49
62
|
app: AppIdentity;
|
|
@@ -51,15 +64,36 @@ export interface OAuthSessionOptions {
|
|
|
51
64
|
/** The preset's `id` and `name`: `session list` and `status` read the sign-in without choosing a client. */
|
|
52
65
|
providerId: string;
|
|
53
66
|
service: string;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
/**
|
|
68
|
+
* From `oauthPreset`; the client is the CLI's own choice (a flag, a variable, the config, WireCat's app). It reads its
|
|
69
|
+
* `startOptions` from `command.opts()`. In `session start` it gets the sign-in's steps too, so with `--answer-stdin`
|
|
70
|
+
* it may ask for what it lacks, such as the client id.
|
|
71
|
+
*/
|
|
72
|
+
preset: (command: Command, steps?: SignInSteps) => OAuthPreset | Promise<OAuthPreset>;
|
|
73
|
+
/**
|
|
74
|
+
* Asks the service whose the access token is; `id` names the account, `account` is what start and status show.
|
|
75
|
+
* `extra` is saved in the entry by the codec at sign-in, such as drive's `principal`.
|
|
76
|
+
*/
|
|
57
77
|
verify: (command: Command, accessToken: string, events: EventSink) => Promise<{
|
|
58
78
|
id: string;
|
|
59
79
|
account: Readonly<Record<string, unknown>>;
|
|
80
|
+
extra?: Record<string, unknown>;
|
|
60
81
|
}>;
|
|
61
82
|
/** Runs before anything is saved; by default only remembers the account. A CLI that refuses a taken one throws. */
|
|
62
83
|
claim?: (env: NodeJS.ProcessEnv, profile: string, id: string) => void;
|
|
84
|
+
/** The entry's format; `standardCodec` by default. A CLI that kept its sign-ins before passes the format it wrote. */
|
|
85
|
+
codec?: TokenCodec;
|
|
86
|
+
/**
|
|
87
|
+
* Where older versions kept a profile's sign-in. Read when the profile's own entry is empty and copied to it, so
|
|
88
|
+
* nobody signs in again; `session end` removes them too. A run with moved folders only reads them.
|
|
89
|
+
*/
|
|
90
|
+
legacyAccounts?: (env: NodeJS.ProcessEnv, profile: string) => readonly LegacyAccount[];
|
|
91
|
+
/** More `session start` options, such as the client or the scopes to ask; `preset` reads them. */
|
|
92
|
+
startOptions?: readonly Option[];
|
|
93
|
+
/** Runs once the sign-in is kept, before the answer: the CLI saves what belongs beside it (WC-SECR-25). */
|
|
94
|
+
afterSignIn?: (command: Command, signedIn: OAuthSignedIn) => void | Promise<void>;
|
|
95
|
+
/** The profiles `session list` names; by default the configured ones and those signed in here before. */
|
|
96
|
+
profiles?: (env: NodeJS.ProcessEnv) => readonly string[];
|
|
63
97
|
}
|
|
64
98
|
/**
|
|
65
99
|
* `session start | status | end | list` for a service signed in in the browser (WC-SECR-22): PKCE on the loopback,
|