@wirecat/cli-core 1.0.0-rc.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 +186 -0
- package/THIRD_PARTY_NOTICES +47 -0
- package/dist/cli/account-rename.js +1 -1
- package/dist/cli/bot/api-input.d.ts +5 -0
- package/dist/cli/bot/api-input.js +6 -1
- package/dist/cli/bot/api.js +7 -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/service-api.js +3 -1
- 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/crm/manifest/map.d.ts +5 -2
- package/dist/crm/manifest/map.js +14 -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 +16 -0
- package/dist/domain/organization-sectors.generated.d.ts +12 -0
- package/dist/domain/organization-sectors.generated.js +15 -0
- package/dist/domain/organization-sectors.js +22 -0
- package/dist/domain/person-kinds.d.ts +5 -0
- 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 -1
- package/dist/entities/index.js +3 -1
- package/dist/entities/knowledge-lists.d.ts +1 -0
- package/dist/entities/knowledge-lists.js +2 -0
- package/dist/errors/reasons.js +14 -3
- package/dist/mail/mail-types.d.ts +48 -0
- package/dist/mail/mail-types.js +218 -0
- package/dist/mail/score.d.ts +2 -0
- package/dist/mail/score.js +9 -2
- 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/search-all-rank.d.ts +44 -0
- package/dist/services/search-all-rank.js +112 -0
- package/dist/services/search-all-tracker.d.ts +58 -0
- package/dist/services/search-all-tracker.js +155 -0
- package/dist/services/search-all.d.ts +1 -8
- package/dist/services/search-all.js +18 -199
- package/dist/services/tracker-meaning.js +1 -1
- package/dist/store/areas.d.ts +1 -0
- package/dist/store/index.d.ts +2 -1
- package/dist/store/index.js +1 -1
- package/dist/store/people.d.ts +30 -0
- package/dist/store/people.js +16 -1
- package/dist/store/sqlite/accounts.js +3 -1
- package/dist/store/sqlite/domain-organizations.d.ts +36 -0
- package/dist/store/sqlite/domain-organizations.js +288 -0
- 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/knowledge.d.ts +2 -9
- package/dist/store/sqlite/manifest.js +6 -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 +77 -0
- package/dist/store/sqlite/organizations.d.ts +12 -1
- package/dist/store/sqlite/organizations.js +9 -1
- package/dist/store/sqlite/people-list.js +69 -11
- package/dist/store/sqlite/person-links.js +13 -3
- package/dist/store/sqlite/person-match-scan.js +14 -1
- package/dist/store/sqlite/schema/sender-bots.d.ts +344 -0
- package/dist/store/sqlite/schema/sender-bots.js +30 -0
- package/dist/store/sqlite/schema.d.ts +49 -0
- package/dist/store/sqlite/schema.js +7 -0
- package/dist/store/sqlite/sender-bots.d.ts +108 -0
- package/dist/store/sqlite/sender-bots.js +431 -0
- package/dist/store/sqlite/sender-signals.d.ts +13 -3
- package/dist/store/sqlite/sender-signals.js +17 -13
- package/dist/store/sqlite/tracker.d.ts +11 -9
- package/dist/store/sqlite/tracker.js +27 -12
- package/dist/store/sqlite/work-tasks.js +2 -0
- package/dist/tracker/cli/index.d.ts +1 -1
- package/dist/tracker/cli/index.js +83 -24
- package/dist/tracker/sync.js +43 -20
- package/dist/tracker/writes.d.ts +28 -0
- package/dist/tracker/writes.js +141 -19
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,192 @@ 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
|
+
|
|
97
|
+
## 1.0.0 — 25.11.2026
|
|
98
|
+
|
|
99
|
+
### Added
|
|
100
|
+
|
|
101
|
+
- **Sender bots, apart from people (store version 74).** A program that writes to the owner becomes a `sender_bots`
|
|
102
|
+
row. That covers a no-reply or alert address, a messenger bot, and a service's signed automatic mail. A bot is never
|
|
103
|
+
proposed as the same person and never offered by `people.similar`. It has no ties, and `tasks.assign` refuses it
|
|
104
|
+
with `sender-bot.assignee`. The owner's `store.people.moveToBot` and `moveToPerson` move a person, a bot or one
|
|
105
|
+
identity for its whole history. The owner's choice wins over the rules, and every move is logged in
|
|
106
|
+
`sender_bot_moves`. See [ARCHITECTURE.md, "Sender bots"](docs/dev/ARCHITECTURE.md) and
|
|
107
|
+
[schema.md](docs/storage/schema.md#sender_bots).
|
|
108
|
+
- **A page of people reads its List-Ids through an index** (`emails_by_list_id`). It no longer reads the List-Id of
|
|
109
|
+
every stored email.
|
|
110
|
+
- **An organization says what it does: `Organization.sector`.** An organization holding a company mail domain gets
|
|
111
|
+
`bank`, `airline`, `shop`, `news`, `government`, `telecom`, `social`, `delivery` or `financial` from a table of
|
|
112
|
+
domains built into the package from Wikidata (CC0), so no sender is looked up online. It is stored in the
|
|
113
|
+
organization's `metadata.sector`; free mail and sending platforms never give one. The first list after the
|
|
114
|
+
upgrade sets it for the organizations already stored
|
|
115
|
+
([ARCHITECTURE](docs/dev/ARCHITECTURE.md#entities-and-source-records)).
|
|
116
|
+
- **Organizations from mail domains.** A sender bot or a shared mailbox at a company domain joins that domain's
|
|
117
|
+
organization when people are listed: the one already holding an address there, else a new one, named by the sender
|
|
118
|
+
when the name is a company's, else by the domain. Subdomains count as their registrable domain. A human writing
|
|
119
|
+
from that domain gets a `member-of` link to it and is never merged. Free mail, throwaway mail and sending platforms
|
|
120
|
+
(newsletter hosts and mail services) make no organization. The owner's word holds: a membership the owner removed,
|
|
121
|
+
an organization the owner erased and a bot the owner moved to a person are not grouped again. See
|
|
122
|
+
[ARCHITECTURE.md, "Organizations from mail domains"](docs/dev/ARCHITECTURE.md).
|
|
123
|
+
- **`issues search` finds issues, projects and comments by meaning too**, once `sync --embed` built their vectors, and
|
|
124
|
+
ranks them as the `tracker` lane of `search all` does: the same lane, now `searchTracker` in
|
|
125
|
+
`src/services/search-all-tracker.ts`. A question finds what holds some of its words. Each hit has `found_by`;
|
|
126
|
+
searched by words only, the answer says why in `missing` (`field: found_by`) with a `sync --embed` step
|
|
127
|
+
([TRACKER.md](docs/dev/TRACKER.md#commands)). The linear rivals benchmark found 7 of 27 with this command and 27
|
|
128
|
+
of 27 with memo's `search all` over the same copy
|
|
129
|
+
([cli-testing](https://github.com/WireCatLabs/cli-testing/blob/main/performance/tracker/linear-rivals/README.md)).
|
|
130
|
+
- **A label, state, user, team or project made after the last sync is found for a write.** A deleted one is not. `issues create` and
|
|
131
|
+
`issues update` look a name the copy lacks up in one `changes` call from that kind's last sync cursor, and keep the
|
|
132
|
+
row in the copy; with no cursor, or more changes than one page, the refusal says it is not in the copy and to run
|
|
133
|
+
sync. A name no row has is refused with the nearest names as `candidates`, each with its team.
|
|
134
|
+
- **`store.tracker.save` and `removeUnlisted` take sync state to save in the same transaction**: `save(key, kind,
|
|
135
|
+
records, now, state?)` and `removeUnlisted(..., { state })`, as `mail.saveThreads` takes its states. `syncTracker`
|
|
136
|
+
saves a page's cursor this way, so a wrapper around `store.tracker` must pass `state` on. A dry run of
|
|
137
|
+
`removeUnlisted` now only reads
|
|
138
|
+
([TRACKER.md](docs/dev/TRACKER.md#synctrackersource-store-account-options)).
|
|
139
|
+
|
|
140
|
+
### Changed — may break callers
|
|
141
|
+
|
|
142
|
+
- **`account rename` refuses an unreadable config file with `config.unreadable`, not `account-rename.config`.** The
|
|
143
|
+
family audit found one failure, "the config file cannot be read", under two names: this one and mail-cli's
|
|
144
|
+
`mail.config-unreadable`. `config.unreadable` is the one name for it, and mail-cli raises it too.
|
|
145
|
+
|
|
146
|
+
### Changed — experimental
|
|
147
|
+
|
|
148
|
+
- **`people.list` rows have `bot`**: `sender-bot:<id>` for a sender bot, else `null`. A bot is still listed as
|
|
149
|
+
`automated` under its `person:<uid>` ref, so `people list kind:automated` and `people show` keep working. A bot's
|
|
150
|
+
`ties` are empty.
|
|
151
|
+
- **`KindSignal` gains `owner-choice`**: the signal of a bot the owner made when nothing else marks it.
|
|
152
|
+
- **`KIND_RULES` goes to 7.** The first list after the upgrade works out every kind again and moves the programs it
|
|
153
|
+
finds.
|
|
154
|
+
- **`KIND_RULES` goes to 8.** The first list after the upgrade works out every kind again and groups the senders it
|
|
155
|
+
finds under their organizations. A shared mailbox an organization now holds gains the `organization` kind signal.
|
|
156
|
+
The tracker commands are not in the stable API; these may still break a caller that relied on the old answers.
|
|
157
|
+
|
|
158
|
+
- **A quoted argument to `issues search` is words in any order, not a phrase.** `issues search "invoice currency"`
|
|
159
|
+
now matches as `issues search invoice currency` does, as its help says. Quote marks inside the query
|
|
160
|
+
(`'"invoice currency"'`) still match a phrase, as in `search all`. A query naming a field (`from:`) is refused.
|
|
161
|
+
- **An `issues list` filter value the copy holds no row of is refused** (`validation_error`, `tracker.reference`)
|
|
162
|
+
instead of answering no issues. A caller that passed an id of a row not yet synced gets the error and runs sync.
|
|
163
|
+
|
|
164
|
+
### Fixed
|
|
165
|
+
|
|
166
|
+
- **A question in `search all` no longer finds deals, leads, tracker items or business records by its function
|
|
167
|
+
words.** A question is searched by any of its words, so «что с логотипом?» also found a deal titled «Что мы
|
|
168
|
+
обещали», and «кто ругался что мы…» put a note ranked by «что» first. The CRM, tracker and business lanes now
|
|
169
|
+
leave out words like «что», «кто», «мы», "the", the same list the message search uses; a question made only of
|
|
170
|
+
them is searched as typed.
|
|
171
|
+
- **A CRM's own address field is copied.** A typed entry of type `location` (Attio) was skipped, so the field never
|
|
172
|
+
reached the store. It is now one line of the parts present, street to country, and a search finds the record by its
|
|
173
|
+
city. See [CRM.md](docs/dev/CRM.md).
|
|
174
|
+
- **A tracker's `sync --embed` offers to run again while chunks are left without vectors.** One run embeds at most
|
|
175
|
+
600 chunks; past that it answered `left: true` and no next step, so an agent stopped with part of the issues,
|
|
176
|
+
projects and comments missing from `search all` by meaning. It now adds a `tracker.sync` step with `embed: true`
|
|
177
|
+
and the count left, as a CRM CLI's `sync --embed` does.
|
|
178
|
+
- **`issues list` filters by name.** `label:Bug`, `state:"In Progress"`, `assignee:"Ada Owner"`, `team:ENG`,
|
|
179
|
+
`project:"Billing revamp"` and `sprint:12` match a name in any letter case, or the id as before; a name several
|
|
180
|
+
rows have (every team's "In Progress") matches each. An unknown name is `tracker.reference` with the nearest names
|
|
181
|
+
in `candidates`, no longer an empty list. `TrackerFilter`'s `assignee`, `project`, `state`, `label` and `sprint`
|
|
182
|
+
take several ids too.
|
|
183
|
+
- **Scoring mail senders no longer rebuilds the throwaway-domain list for each sender.** The spam score
|
|
184
|
+
(`scoreGroup`) and the organizations from mail domains now share one set built on first use
|
|
185
|
+
(`isDisposableDomain`). Scoring 20,000 senders took about 7 s and now takes about 0.2 s.
|
|
186
|
+
- **A tracker sync commits half as often** (#3336). Each page of changes is saved with the cursor after it in one
|
|
187
|
+
transaction, the end of an id pass with its marks, and the end of the run in one more. Each commit waits for the
|
|
188
|
+
disk: the strict fake's 8 kinds of 3 rows went from 79 commits to 38 (median 354 → 214 ms on a busy disk), 2,000
|
|
189
|
+
issues from 101 to 53
|
|
190
|
+
([sync-writes](https://github.com/WireCatLabs/cli-testing/tree/main/performance/tracker/sync-writes)). What is
|
|
191
|
+
stored is the same. A page is now saved with its cursor or not at all; before, a crash between the two read the
|
|
192
|
+
page again.
|
|
193
|
+
|
|
8
194
|
## 1.0.0-rc.0 — 25.11.2026
|
|
9
195
|
|
|
10
196
|
### Added
|
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -802,3 +802,50 @@ SPDX-License-Identifier: Unicode-3.0
|
|
|
802
802
|
|
|
803
803
|
EmbeddingGemma (Google) is used under the Gemma Terms of Use, https://ai.google.dev/gemma/terms, including its use
|
|
804
804
|
restrictions (https://ai.google.dev/gemma/prohibited_use_policy).
|
|
805
|
+
|
|
806
|
+
The domain-to-sector table (src/domain/organization-sectors.generated.ts) is built from Wikidata
|
|
807
|
+
(https://www.wikidata.org), whose structured data is available under CC0 1.0
|
|
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`.
|
|
@@ -147,7 +147,7 @@ export const accountRenameCommand = (app, renaming, options = {}) => annotate(ne
|
|
|
147
147
|
const read = readConfigFile(settings.configPath);
|
|
148
148
|
if ("issue" in read)
|
|
149
149
|
throw new CliError("configuration_error", `${settings.configPath} cannot be read — fix it first`, {
|
|
150
|
-
reason: "
|
|
150
|
+
reason: "config.unreadable",
|
|
151
151
|
});
|
|
152
152
|
const sections = [["profiles"], ["personal", "profiles"]].filter((path) => at(read.raw, [...path, profile]) !== undefined);
|
|
153
153
|
const storeHere = existsSync(storePath(env));
|
|
@@ -16,6 +16,11 @@ export declare const checkApiBody: (operation: ManifestOperation, text: string |
|
|
|
16
16
|
export declare const parseApiJson: (text: string) => unknown;
|
|
17
17
|
export declare const apiJson: (value: unknown) => string;
|
|
18
18
|
export declare const apiPlainJson: (value: unknown) => unknown;
|
|
19
|
+
/**
|
|
20
|
+
* An empty or all-space text in a required argument or parameter: the service may read it as no id at all, and an empty
|
|
21
|
+
* path segment can reach another endpoint, so it is refused before anything is sent.
|
|
22
|
+
*/
|
|
23
|
+
export declare const isBlank: (value: unknown) => boolean;
|
|
19
24
|
/**
|
|
20
25
|
* A GraphQL operation's variables: the body's (`--body`, all of them as one object) with each flag over it, read by
|
|
21
26
|
* the variable's schema. A name the operation does not declare, or a required one left out, is refused unsent.
|
|
@@ -119,6 +119,11 @@ const finite = (key, value) => {
|
|
|
119
119
|
};
|
|
120
120
|
export const apiJson = (value) => stringify(value, finite) ?? "null";
|
|
121
121
|
export const apiPlainJson = (value) => JSON.parse(stringify(value, (key, inner) => isLosslessNumber(inner) && !isSafeNumber(inner.value) ? inner.toString() : finite(key, inner)) ?? "null");
|
|
122
|
+
/**
|
|
123
|
+
* An empty or all-space text in a required argument or parameter: the service may read it as no id at all, and an empty
|
|
124
|
+
* path segment can reach another endpoint, so it is refused before anything is sent.
|
|
125
|
+
*/
|
|
126
|
+
export const isBlank = (value) => typeof value === "string" && value.trim() === "";
|
|
122
127
|
/** A JSON object with no lossless number at its top: what a GraphQL body of variables must be. */
|
|
123
128
|
const isVariables = (value) => value !== null && typeof value === "object" && !Array.isArray(value) && !isLosslessNumber(value);
|
|
124
129
|
/**
|
|
@@ -145,7 +150,7 @@ export const graphqlVariables = (operation, body, fields) => {
|
|
|
145
150
|
sent: false,
|
|
146
151
|
});
|
|
147
152
|
const missing = Object.entries(binding.variables)
|
|
148
|
-
.filter(([name, type]) => type.endsWith("!") && variables[name] == null)
|
|
153
|
+
.filter(([name, type]) => type.endsWith("!") && (variables[name] == null || isBlank(variables[name])))
|
|
149
154
|
.map(([name]) => `--${apiFlagOf(name)}`);
|
|
150
155
|
if (missing.length > 0)
|
|
151
156
|
throw new CliError("validation_error", `${operation.command} needs ${missing.join(", ")}`, { sent: false });
|
package/dist/cli/bot/api.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Command, Option } from "commander";
|
|
|
4
4
|
import { secretInput } from "../../runs/run-context.js";
|
|
5
5
|
import { NO_EFFECTS, REMOTE_READ, REMOTE_WRITE } from "../effects.js";
|
|
6
6
|
import { API_UNTRUSTED, marksUntrusted } from "../untrusted-marks.js";
|
|
7
|
-
import { apiFlagOf, apiJson, apiOptionKey, graphqlVariables, readApiBody, readApiBytes, sendsBytes, } from "./api-input.js";
|
|
7
|
+
import { apiFlagOf, apiJson, apiOptionKey, graphqlVariables, isBlank, readApiBody, readApiBytes, sendsBytes, } from "./api-input.js";
|
|
8
8
|
/**
|
|
9
9
|
* The words after `api`: `contacts-list` in the group `contacts` is `contacts list`, `move-page` in `pages` keeps its
|
|
10
10
|
* name, and an operation without a group stays `api <command>`. The same rule as cli-base's `apiCommandPath`; `group`
|
|
@@ -82,6 +82,12 @@ export const generatedApiCommand = (api) => {
|
|
|
82
82
|
const raw = options[apiOptionKey(parameter.name)];
|
|
83
83
|
if (raw === undefined)
|
|
84
84
|
continue;
|
|
85
|
+
// A body field may be empty on purpose (Telegram's setWebhook url removes the hook); GraphQL's are checked as
|
|
86
|
+
// variables.
|
|
87
|
+
if (parameter.required && parameter.in !== "body" && isBlank(raw))
|
|
88
|
+
throw new CliError("validation_error", `--${apiFlagOf(parameter.name)} of ${operation.command} is empty`, {
|
|
89
|
+
sent: false,
|
|
90
|
+
});
|
|
85
91
|
if (parameter.in !== "body") {
|
|
86
92
|
const problem = api.checkParameter(parameter.name, parameter.schema, raw);
|
|
87
93
|
if (problem)
|
|
@@ -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,
|