@wirecat/cli-core 0.609.0 → 0.611.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 +68 -0
- package/dist/cli/messenger/search-answers.js +12 -0
- package/dist/cli/search-left-out.d.ts +1 -0
- package/dist/cli/search-left-out.js +2 -0
- package/dist/domain/business.d.ts +3 -0
- package/dist/domain/business.js +2 -0
- package/dist/entities/hit.d.ts +13 -2
- package/dist/entities/hit.js +10 -2
- package/dist/entities/index.d.ts +7 -1
- package/dist/errors/reasons.js +4 -0
- package/dist/meetings/mcp/index.d.ts +15 -15
- package/dist/search/account-list.d.ts +3 -2
- package/dist/search/account-list.js +5 -4
- package/dist/services/link-scorers/chat-senders.d.ts +2 -1
- package/dist/services/link-scorers/chat-senders.js +13 -4
- package/dist/services/link-scorers/types.d.ts +1 -1
- package/dist/services/metadata.d.ts +1 -1
- package/dist/services/proposals/kinds/relationship.js +1 -0
- package/dist/services/proposals/registry.js +3 -1
- package/dist/services/proposals/types.d.ts +2 -0
- package/dist/services/search-all-business.d.ts +18 -0
- package/dist/services/search-all-business.js +38 -0
- package/dist/services/search-all-meetings.d.ts +1 -1
- package/dist/services/search-all-meetings.js +7 -2
- package/dist/services/search-all.d.ts +10 -6
- package/dist/services/search-all.js +26 -10
- package/dist/store/exports.d.ts +2 -0
- package/dist/store/exports.js +2 -0
- package/dist/store/index.d.ts +4 -1
- package/dist/store/index.js +2 -0
- package/dist/store/sqlite/business-search.d.ts +44 -0
- package/dist/store/sqlite/business-search.js +141 -0
- package/dist/store/sqlite/finance.d.ts +12 -0
- package/dist/store/sqlite/finance.js +38 -2
- package/dist/store/sqlite/involvement-queue.d.ts +2 -7
- package/dist/store/sqlite/involvement-queue.js +11 -14
- package/dist/store/sqlite/money-lines.d.ts +12 -1
- package/dist/store/sqlite/money-lines.js +50 -4
- package/dist/store/sqlite/orders.js +5 -25
- package/dist/store/sqlite/proposed-actions.d.ts +2 -0
- package/dist/store/sqlite/proposed-actions.js +4 -3
- package/dist/store/sqlite/records.d.ts +21 -0
- package/dist/store/sqlite/records.js +74 -13
- package/dist/store/sqlite/ref-summaries.d.ts +3 -1
- package/dist/store/sqlite/ref-summaries.js +4 -1
- package/dist/store/sqlite/reported-relations.d.ts +1 -0
- package/dist/store/sqlite/reported-relations.js +1 -1
- package/dist/store/store.d.ts +2 -0
- package/dist/store/store.js +4 -4
- package/dist/terminal/prompt.d.ts +4 -0
- package/dist/terminal/prompt.js +21 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,74 @@ 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
|
+
## Unreleased
|
|
9
|
+
|
|
10
|
+
## 0.611.0 — 08.11.2026
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **In `search all`, a hit only words found keeps its place next to the hits around it.** It takes the cosine of the
|
|
15
|
+
hit above it in its own source, so an exact word's second hit no longer sorts behind every hit meaning found.
|
|
16
|
+
- **cli-core accepts `@wirecat/cli-base` up to 0.85.x.** Its peer range stopped at `<0.83.0`, so a CLI could not take
|
|
17
|
+
cli-base 0.85.0's `hostFetch` and the `network.hosts` manifest next to cli-core. Nothing else changes for a caller.
|
|
18
|
+
|
|
19
|
+
## 0.610.0 — 08.11.2026
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **A scan's group senders can be found and decided together.** `chat-senders@3` names the chat and its size in its
|
|
24
|
+
reason ("wrote 40 messages in «Sales» (25 people) since 2026-08-10"), and its evidence leads with the chat's ref.
|
|
25
|
+
`ProposalFilter.via` keeps the proposals whose evidence holds a reference, and `store.proposedActions.list` takes
|
|
26
|
+
`evidence` to filter in the query, so `via` pages stored relationship proposals in full. A pending `chat-senders@2`
|
|
27
|
+
proposal takes the new reason and evidence on the next scan, under the same id.
|
|
28
|
+
- **`search all` has a `business` lane.** `searchAll` finds invoices, payments, orders, contracts, subscriptions,
|
|
29
|
+
products and wallets by the words of their numbers and names (an invoice's counterparty, a payment's payer or payee,
|
|
30
|
+
an order's shop and lines), each word where a word starts, folded in memory like the `crm` lane, with no index.
|
|
31
|
+
Each hit carries its `review` (`proposed` or `confirmed`). A row an import made (its `source` is
|
|
32
|
+
`import:<provider>`) carries `source_record` (`provider`, `account`, `external_id`): the oldest live record that
|
|
33
|
+
maps to it, else the oldest deleted one, which also decides its account; the owner's and agents' rows are
|
|
34
|
+
`business:internal`. `scope.business` and `--source` read the import accounts they name. Transactions, `custom:`
|
|
35
|
+
records and rejected rows are left out. `store.business.find` and `store.business.accounts` back it.
|
|
36
|
+
- **Permission key `business.list`** (or `business`): a profile that denies it leaves the `business` lane out of
|
|
37
|
+
`search all` and says so under `missing`, as `deals.list` does for deals (`deniedKinds`). memo reads the lane by
|
|
38
|
+
default once it takes this release; that key turns it off.
|
|
39
|
+
- **`store.finance.addInvoiceLine` and `removeInvoiceLine` change an invoice's lines, as `store.orders` does an
|
|
40
|
+
order's.** A `product` reference copies the product's name and price, and a later price change leaves the line as it
|
|
41
|
+
is. The owner changes any invoice's lines but a void, rejected or deleted one's; a bot only those of an invoice it
|
|
42
|
+
proposed that is still proposed (`finance.owner-only`). The total follows the lines, and the status follows the total
|
|
43
|
+
against what confirmed payments settled. Refused: removing the last line (`finance.line`), a position with no line
|
|
44
|
+
(`finance.no-line`), and lines totalling less than is paid (`finance.below-paid`).
|
|
45
|
+
- **`store.records.list` takes `entity`, `batch` and `deleted`, and `store.records.incoming` lists what points at a
|
|
46
|
+
record or an entity**, for a `records show` that shows relations both ways. `entity` is a ref and lists the records
|
|
47
|
+
mapped to it; `batch` is a `batch_id`; `deleted: true` lists only deleted records, `false` only live ones, and left
|
|
48
|
+
out lists both, as before. `incoming(key)` gives the live records whose relations resolve to that record;
|
|
49
|
+
`incoming({ entity })` those naming the entity by ref, from every account, and those resolved to a record mapped to
|
|
50
|
+
it. Each names its record's provider, account, type and id, with the role, `as` and `amount`.
|
|
51
|
+
|
|
52
|
+
### Changed — may break callers
|
|
53
|
+
|
|
54
|
+
- **`RESOURCES_SEARCHED` ends with `business`**, so `searchAll` and `searchAllWithMeetings` read it when `only` is
|
|
55
|
+
left out, and `SearchAllItem.kind` and the `hit` entity's `kind` take `invoice`, `payment`, `order`, `contract`,
|
|
56
|
+
`subscription`, `product` and `wallet`. A switch over hit kinds needs those branches; pass `only` to keep the old
|
|
57
|
+
lanes. The source tools' `search all` (`SOURCE_SEARCHED`) is unchanged.
|
|
58
|
+
- **`MessageStore.business` is a new required member**: a hand-made store object or test double needs it.
|
|
59
|
+
- **`SearchedResource`, `ResourceWithMeetings` and `SearchAllRequest.scope` take `business`**, and the strict `hit`
|
|
60
|
+
entity takes `review` and `source_record`; an exhaustive switch or a copy of the schema needs them.
|
|
61
|
+
|
|
62
|
+
### Fixed
|
|
63
|
+
|
|
64
|
+
- **A hidden prompt asks again when nothing arrived.** `readSecret` at a terminal took an empty Enter as the answer,
|
|
65
|
+
so a paste that never landed (Ctrl+V in a Linux terminal) failed at once with "no token was given", and the hidden
|
|
66
|
+
input showed nothing to tell it apart from a paste that worked. An empty hidden answer now prints "Nothing arrived.
|
|
67
|
+
To paste in a terminal, use Ctrl+Shift+V (or right-click → Paste)." (Cmd+V on macOS) and asks again, up to three
|
|
68
|
+
times, then fails with `validation_error`, reason `input.empty`. A piped empty answer still comes back empty at once,
|
|
69
|
+
an echoed prompt keeps its empty answer, and Ctrl-C still cancels at once.
|
|
70
|
+
|
|
71
|
+
- **A large CRM sync takes a third less time and a sixth of the memory** (#2682). Keeping the involvement index
|
|
72
|
+
current built a new SQL text for every item it recomputed, so SQLite prepared each one again and the process kept
|
|
73
|
+
them all. The item's id is now a bound parameter, one statement per kind of item. On the same synthetic data, the
|
|
74
|
+
20,000 sync peaks at 0.6 GB instead of 3.7 GB and takes 19 s instead of 30 s, its `--rescan` 13 s instead of 21 s.
|
|
75
|
+
|
|
8
76
|
## 0.609.0 — 08.11.2026
|
|
9
77
|
|
|
10
78
|
### Added
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hitFiles } from "../../domain/attachments.js";
|
|
2
|
+
import { BUSINESS_KINDS } from "../../domain/business.js";
|
|
2
3
|
import { formatLocator, parseLocator } from "../../domain/locator.js";
|
|
3
4
|
import { senderIsMe } from "../../domain/models.js";
|
|
4
5
|
import { chosenTextModel } from "../../embeddings/models.js";
|
|
@@ -279,6 +280,8 @@ export const messagesAnswer = (command, found, { limit, page, again }, query = "
|
|
|
279
280
|
*/
|
|
280
281
|
const DOCUMENT_HIT_UNTRUSTED = ["title", "excerpt"];
|
|
281
282
|
export const noteHitItem = (hit) => defined({ ...hit, untrusted: hit.kind === "document" ? DOCUMENT_HIT_UNTRUSTED : undefined });
|
|
283
|
+
// Numbers and names come from the other side's documents or an import.
|
|
284
|
+
const BUSINESS_UNTRUSTED = Object.fromEntries(BUSINESS_KINDS.map((kind) => [kind, ["title", "excerpt", "source_record.external_id"]]));
|
|
282
285
|
/** The text of each kind of `search all` hit that someone other than the owner may have written. */
|
|
283
286
|
const ALL_HIT_UNTRUSTED = {
|
|
284
287
|
message: ["title", "excerpt", "sender_name", "attachments.name"],
|
|
@@ -290,6 +293,7 @@ const ALL_HIT_UNTRUSTED = {
|
|
|
290
293
|
// A CRM's copy is typed by the CRM's users; the owner's own deal is his, but one rule keeps a hit's marking simple.
|
|
291
294
|
deal: ["title", "excerpt"],
|
|
292
295
|
lead: ["title", "excerpt"],
|
|
296
|
+
...BUSINESS_UNTRUSTED,
|
|
293
297
|
};
|
|
294
298
|
export const allHitItem = (item) => item.kind === "meeting"
|
|
295
299
|
? {
|
|
@@ -326,6 +330,14 @@ export const allHitItem = (item) => item.kind === "meeting"
|
|
|
326
330
|
sender_is_me: item.senderIsMe,
|
|
327
331
|
sender_ref: item.from?.ref,
|
|
328
332
|
found_by: item.foundBy,
|
|
333
|
+
review: item.review,
|
|
334
|
+
source_record: item.sourceRecord === undefined
|
|
335
|
+
? undefined
|
|
336
|
+
: {
|
|
337
|
+
provider: item.sourceRecord.provider,
|
|
338
|
+
account: item.sourceRecord.account,
|
|
339
|
+
external_id: item.sourceRecord.externalId,
|
|
340
|
+
},
|
|
329
341
|
attachments: item.attachments === undefined ? undefined : nonEmpty(item.attachments),
|
|
330
342
|
untrusted: ALL_HIT_UNTRUSTED[item.kind],
|
|
331
343
|
});
|
|
@@ -5,6 +5,7 @@ import { type PermissionKey } from "../sends/permissions.js";
|
|
|
5
5
|
declare const LIST_KEYS: {
|
|
6
6
|
readonly deal: "deals.list";
|
|
7
7
|
readonly lead: "leads.list";
|
|
8
|
+
readonly business: "business.list";
|
|
8
9
|
readonly messages: "messages.list";
|
|
9
10
|
readonly mail: "mail.list";
|
|
10
11
|
readonly notes: "notes.list";
|
|
@@ -5,6 +5,8 @@ import { settingsFor } from "./settings.js";
|
|
|
5
5
|
const LIST_KEYS = {
|
|
6
6
|
deal: "deals.list",
|
|
7
7
|
lead: "leads.list",
|
|
8
|
+
// No command lists business data across its types yet; the key is the lane's own, so a profile can turn it off.
|
|
9
|
+
business: "business.list",
|
|
8
10
|
messages: "messages.list",
|
|
9
11
|
mail: "mail.list",
|
|
10
12
|
notes: "notes.list",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type FinanceReview, type MoneyDirection } from "./finance.js";
|
|
2
2
|
export declare const CATALOG_KINDS: readonly ["product", "service"];
|
|
3
|
+
/** What the `business` lane of `search all` reads; transactions are too many to fold per query. */
|
|
4
|
+
export declare const BUSINESS_KINDS: readonly ["invoice", "payment", "order", "contract", "subscription", "product", "wallet"];
|
|
5
|
+
export type BusinessKind = (typeof BUSINESS_KINDS)[number];
|
|
3
6
|
export declare const CONTRACT_KINDS: readonly ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"];
|
|
4
7
|
export declare const CONTRACT_STATUSES: readonly ["draft", "active", "ended", "terminated"];
|
|
5
8
|
export declare const PERIOD_UNITS: readonly ["day", "week", "month", "year"];
|
package/dist/domain/business.js
CHANGED
|
@@ -2,6 +2,8 @@ import { CliError } from "@wirecat/cli-base";
|
|
|
2
2
|
import { dayMonth, notes } from "./finance.js";
|
|
3
3
|
import { moneyLabel } from "./money.js";
|
|
4
4
|
export const CATALOG_KINDS = ["product", "service"];
|
|
5
|
+
/** What the `business` lane of `search all` reads; transactions are too many to fold per query. */
|
|
6
|
+
export const BUSINESS_KINDS = ["invoice", "payment", "order", "contract", "subscription", "product", "wallet"];
|
|
5
7
|
export const CONTRACT_KINDS = ["sale", "purchase", "service", "lease", "employment", "nda", "license", "other"];
|
|
6
8
|
export const CONTRACT_STATUSES = ["draft", "active", "ended", "terminated"];
|
|
7
9
|
export const PERIOD_UNITS = ["day", "week", "month", "year"];
|
package/dist/entities/hit.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* One result of `search all`: a message, a mail, a note, a calendar event, a meeting passage, a deal, a lead, or an
|
|
4
|
+
* invoice, payment, order, contract, subscription, product or wallet.
|
|
5
|
+
*/
|
|
3
6
|
export declare const hit: v.StrictObjectSchema<{
|
|
4
|
-
readonly kind: v.PicklistSchema<["message", "mail", "note", "document", "event", "meeting", "deal", "lead"], undefined>;
|
|
7
|
+
readonly kind: v.PicklistSchema<["message", "mail", "note", "document", "event", "meeting", "deal", "lead", "invoice", "payment", "order", "contract", "subscription", "product", "wallet"], undefined>;
|
|
5
8
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
6
9
|
readonly provider: v.StringSchema<undefined>;
|
|
7
10
|
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -31,6 +34,14 @@ export declare const hit: v.StrictObjectSchema<{
|
|
|
31
34
|
readonly lines_total: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
32
35
|
/** A meeting passage's stored line, so two passages of one meeting stay apart; `search meetings` gives the same. */
|
|
33
36
|
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
|
|
37
|
+
/** A business hit's: `proposed` waits for the owner; a product or a wallet has no review and is `confirmed`. */
|
|
38
|
+
readonly review: v.OptionalSchema<v.PicklistSchema<["proposed", "confirmed"], undefined>, undefined>;
|
|
39
|
+
/** A business hit's record in the import that made it; absent for one the owner or an agent wrote. */
|
|
40
|
+
readonly source_record: v.OptionalSchema<v.StrictObjectSchema<{
|
|
41
|
+
readonly provider: v.StringSchema<undefined>;
|
|
42
|
+
readonly account: v.StringSchema<undefined>;
|
|
43
|
+
readonly external_id: v.StringSchema<undefined>;
|
|
44
|
+
}, undefined>, undefined>;
|
|
34
45
|
/** A message's files; absent when it has none. */
|
|
35
46
|
readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
36
47
|
readonly position: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
package/dist/entities/hit.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
+
import { BUSINESS_KINDS } from "../domain/business.js";
|
|
2
3
|
import { hitFile } from "./attachment.js";
|
|
3
4
|
import { count, reference, text, time, untrusted } from "./fields.js";
|
|
4
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* One result of `search all`: a message, a mail, a note, a calendar event, a meeting passage, a deal, a lead, or an
|
|
7
|
+
* invoice, payment, order, contract, subscription, product or wallet.
|
|
8
|
+
*/
|
|
5
9
|
export const hit = v.strictObject({
|
|
6
|
-
kind: v.picklist(["message", "mail", "note", "document", "event", "meeting", "deal", "lead"]),
|
|
10
|
+
kind: v.picklist(["message", "mail", "note", "document", "event", "meeting", "deal", "lead", ...BUSINESS_KINDS]),
|
|
7
11
|
ref: reference,
|
|
8
12
|
provider: text,
|
|
9
13
|
url: v.optional(text),
|
|
@@ -33,6 +37,10 @@ export const hit = v.strictObject({
|
|
|
33
37
|
lines_total: v.optional(count),
|
|
34
38
|
/** A meeting passage's stored line, so two passages of one meeting stay apart; `search meetings` gives the same. */
|
|
35
39
|
id: v.optional(v.pipe(v.string(), v.minLength(1))),
|
|
40
|
+
/** A business hit's: `proposed` waits for the owner; a product or a wallet has no review and is `confirmed`. */
|
|
41
|
+
review: v.optional(v.picklist(["proposed", "confirmed"])),
|
|
42
|
+
/** A business hit's record in the import that made it; absent for one the owner or an agent wrote. */
|
|
43
|
+
source_record: v.optional(v.strictObject({ provider: text, account: text, external_id: text })),
|
|
36
44
|
/** A message's files; absent when it has none. */
|
|
37
45
|
attachments: v.optional(v.array(hitFile)),
|
|
38
46
|
/** Absent on a note hit: the owner wrote it. */
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -4261,7 +4261,7 @@ export declare const ENTITIES: {
|
|
|
4261
4261
|
readonly untrusted: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
4262
4262
|
}, undefined>;
|
|
4263
4263
|
readonly hit: v.StrictObjectSchema<{
|
|
4264
|
-
readonly kind: v.PicklistSchema<["message", "mail", "note", "document", "event", "meeting", "deal", "lead"], undefined>;
|
|
4264
|
+
readonly kind: v.PicklistSchema<["message", "mail", "note", "document", "event", "meeting", "deal", "lead", "invoice", "payment", "order", "contract", "subscription", "product", "wallet"], undefined>;
|
|
4265
4265
|
readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
|
|
4266
4266
|
readonly provider: v.StringSchema<undefined>;
|
|
4267
4267
|
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -4280,6 +4280,12 @@ export declare const ENTITIES: {
|
|
|
4280
4280
|
readonly line: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
4281
4281
|
readonly lines_total: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
4282
4282
|
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
|
|
4283
|
+
readonly review: v.OptionalSchema<v.PicklistSchema<["proposed", "confirmed"], undefined>, undefined>;
|
|
4284
|
+
readonly source_record: v.OptionalSchema<v.StrictObjectSchema<{
|
|
4285
|
+
readonly provider: v.StringSchema<undefined>;
|
|
4286
|
+
readonly account: v.StringSchema<undefined>;
|
|
4287
|
+
readonly external_id: v.StringSchema<undefined>;
|
|
4288
|
+
}, undefined>, undefined>;
|
|
4283
4289
|
readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
4284
4290
|
readonly position: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
4285
4291
|
readonly kind: v.StringSchema<undefined>;
|
package/dist/errors/reasons.js
CHANGED
|
@@ -211,6 +211,7 @@ const OTHERS = [
|
|
|
211
211
|
validation("evidence.row-too-large", "one evidence row is over its size limit"),
|
|
212
212
|
validation("index.not-ready", "the search index is still being built"),
|
|
213
213
|
validation("input.closed", "the input closed before the answer"),
|
|
214
|
+
validation("input.empty", "a hidden prompt got an empty answer three times"),
|
|
214
215
|
validation("input.required", "the command needs an answer and cannot ask for one"),
|
|
215
216
|
validation("input.too-large", "the input is over its size limit"),
|
|
216
217
|
["meeting-project.stale", "configuration_error", "the meeting's project changed meanwhile"],
|
|
@@ -219,10 +220,13 @@ const OTHERS = [
|
|
|
219
220
|
validation("fact.payment-retired", "a payment is a payments row in store.finance, not a fact"),
|
|
220
221
|
validation("fact.revoke-correction", "an accepted correction cannot be revoked; its superseded fact stays"),
|
|
221
222
|
validation("finance.allocate", "the invoice or payment cannot take an allocation in its state"),
|
|
223
|
+
validation("finance.below-paid", "the invoice's lines would total less than is paid on it"),
|
|
222
224
|
validation("finance.currency", "the payment and the invoice are in different currencies; nothing is converted"),
|
|
223
225
|
validation("finance.field", "a field of the invoice or payment is not valid"),
|
|
224
226
|
validation("finance.line-amount", "an invoice line's amount is not its quantity times its unit price"),
|
|
227
|
+
validation("finance.line", "an invoice keeps at least one line: reject or void it instead"),
|
|
225
228
|
validation("finance.lines", "the invoice's lines are not valid"),
|
|
229
|
+
["finance.no-line", "not_found", "the invoice has no line at that position"],
|
|
226
230
|
["finance.not-allocated", "not_found", "the payment is not allocated to that invoice"],
|
|
227
231
|
validation("finance.over-invoice", "the allocation would settle more than the invoice's total"),
|
|
228
232
|
validation("finance.over-payment", "the allocation would use more than the payment's amount"),
|
|
@@ -38,6 +38,7 @@ export declare const meetingTools: ({
|
|
|
38
38
|
max_read_bytes?: undefined;
|
|
39
39
|
cursor?: undefined;
|
|
40
40
|
} | {
|
|
41
|
+
limit?: undefined;
|
|
41
42
|
event_id?: undefined;
|
|
42
43
|
series_id?: undefined;
|
|
43
44
|
page?: undefined;
|
|
@@ -53,11 +54,11 @@ export declare const meetingTools: ({
|
|
|
53
54
|
format?: undefined;
|
|
54
55
|
transcript_id?: undefined;
|
|
55
56
|
query?: undefined;
|
|
56
|
-
limit?: undefined;
|
|
57
57
|
scan_limit?: undefined;
|
|
58
58
|
max_read_bytes?: undefined;
|
|
59
59
|
cursor?: undefined;
|
|
60
60
|
} | {
|
|
61
|
+
limit?: undefined;
|
|
61
62
|
event_id?: undefined;
|
|
62
63
|
series_id?: undefined;
|
|
63
64
|
page?: undefined;
|
|
@@ -75,11 +76,11 @@ export declare const meetingTools: ({
|
|
|
75
76
|
format?: undefined;
|
|
76
77
|
transcript_id?: undefined;
|
|
77
78
|
query?: undefined;
|
|
78
|
-
limit?: undefined;
|
|
79
79
|
scan_limit?: undefined;
|
|
80
80
|
max_read_bytes?: undefined;
|
|
81
81
|
cursor?: undefined;
|
|
82
82
|
} | {
|
|
83
|
+
limit?: undefined;
|
|
83
84
|
event_id?: undefined;
|
|
84
85
|
series_id?: undefined;
|
|
85
86
|
page?: undefined;
|
|
@@ -101,7 +102,6 @@ export declare const meetingTools: ({
|
|
|
101
102
|
minimum: number;
|
|
102
103
|
};
|
|
103
104
|
query?: undefined;
|
|
104
|
-
limit?: undefined;
|
|
105
105
|
scan_limit?: undefined;
|
|
106
106
|
max_read_bytes?: undefined;
|
|
107
107
|
cursor?: undefined;
|
|
@@ -188,6 +188,7 @@ export declare const meetingTools: ({
|
|
|
188
188
|
max_read_bytes?: undefined;
|
|
189
189
|
cursor?: undefined;
|
|
190
190
|
} | {
|
|
191
|
+
limit?: undefined;
|
|
191
192
|
event_id?: undefined;
|
|
192
193
|
series_id?: undefined;
|
|
193
194
|
page?: undefined;
|
|
@@ -203,11 +204,11 @@ export declare const meetingTools: ({
|
|
|
203
204
|
format?: undefined;
|
|
204
205
|
transcript_id?: undefined;
|
|
205
206
|
query?: undefined;
|
|
206
|
-
limit?: undefined;
|
|
207
207
|
scan_limit?: undefined;
|
|
208
208
|
max_read_bytes?: undefined;
|
|
209
209
|
cursor?: undefined;
|
|
210
210
|
} | {
|
|
211
|
+
limit?: undefined;
|
|
211
212
|
event_id?: undefined;
|
|
212
213
|
series_id?: undefined;
|
|
213
214
|
page?: undefined;
|
|
@@ -225,11 +226,11 @@ export declare const meetingTools: ({
|
|
|
225
226
|
format?: undefined;
|
|
226
227
|
transcript_id?: undefined;
|
|
227
228
|
query?: undefined;
|
|
228
|
-
limit?: undefined;
|
|
229
229
|
scan_limit?: undefined;
|
|
230
230
|
max_read_bytes?: undefined;
|
|
231
231
|
cursor?: undefined;
|
|
232
232
|
} | {
|
|
233
|
+
limit?: undefined;
|
|
233
234
|
event_id?: undefined;
|
|
234
235
|
series_id?: undefined;
|
|
235
236
|
page?: undefined;
|
|
@@ -251,7 +252,6 @@ export declare const meetingTools: ({
|
|
|
251
252
|
minimum: number;
|
|
252
253
|
};
|
|
253
254
|
query?: undefined;
|
|
254
|
-
limit?: undefined;
|
|
255
255
|
scan_limit?: undefined;
|
|
256
256
|
max_read_bytes?: undefined;
|
|
257
257
|
cursor?: undefined;
|
|
@@ -338,6 +338,7 @@ export declare const meetingTools: ({
|
|
|
338
338
|
max_read_bytes?: undefined;
|
|
339
339
|
cursor?: undefined;
|
|
340
340
|
} | {
|
|
341
|
+
limit?: undefined;
|
|
341
342
|
event_id?: undefined;
|
|
342
343
|
series_id?: undefined;
|
|
343
344
|
page?: undefined;
|
|
@@ -353,11 +354,11 @@ export declare const meetingTools: ({
|
|
|
353
354
|
format?: undefined;
|
|
354
355
|
transcript_id?: undefined;
|
|
355
356
|
query?: undefined;
|
|
356
|
-
limit?: undefined;
|
|
357
357
|
scan_limit?: undefined;
|
|
358
358
|
max_read_bytes?: undefined;
|
|
359
359
|
cursor?: undefined;
|
|
360
360
|
} | {
|
|
361
|
+
limit?: undefined;
|
|
361
362
|
event_id?: undefined;
|
|
362
363
|
series_id?: undefined;
|
|
363
364
|
page?: undefined;
|
|
@@ -375,11 +376,11 @@ export declare const meetingTools: ({
|
|
|
375
376
|
format?: undefined;
|
|
376
377
|
transcript_id?: undefined;
|
|
377
378
|
query?: undefined;
|
|
378
|
-
limit?: undefined;
|
|
379
379
|
scan_limit?: undefined;
|
|
380
380
|
max_read_bytes?: undefined;
|
|
381
381
|
cursor?: undefined;
|
|
382
382
|
} | {
|
|
383
|
+
limit?: undefined;
|
|
383
384
|
event_id?: undefined;
|
|
384
385
|
series_id?: undefined;
|
|
385
386
|
page?: undefined;
|
|
@@ -401,7 +402,6 @@ export declare const meetingTools: ({
|
|
|
401
402
|
minimum: number;
|
|
402
403
|
};
|
|
403
404
|
query?: undefined;
|
|
404
|
-
limit?: undefined;
|
|
405
405
|
scan_limit?: undefined;
|
|
406
406
|
max_read_bytes?: undefined;
|
|
407
407
|
cursor?: undefined;
|
|
@@ -488,6 +488,7 @@ export declare const meetingTools: ({
|
|
|
488
488
|
max_read_bytes?: undefined;
|
|
489
489
|
cursor?: undefined;
|
|
490
490
|
} | {
|
|
491
|
+
limit?: undefined;
|
|
491
492
|
event_id?: undefined;
|
|
492
493
|
series_id?: undefined;
|
|
493
494
|
page?: undefined;
|
|
@@ -503,11 +504,11 @@ export declare const meetingTools: ({
|
|
|
503
504
|
format?: undefined;
|
|
504
505
|
transcript_id?: undefined;
|
|
505
506
|
query?: undefined;
|
|
506
|
-
limit?: undefined;
|
|
507
507
|
scan_limit?: undefined;
|
|
508
508
|
max_read_bytes?: undefined;
|
|
509
509
|
cursor?: undefined;
|
|
510
510
|
} | {
|
|
511
|
+
limit?: undefined;
|
|
511
512
|
event_id?: undefined;
|
|
512
513
|
series_id?: undefined;
|
|
513
514
|
page?: undefined;
|
|
@@ -525,11 +526,11 @@ export declare const meetingTools: ({
|
|
|
525
526
|
format?: undefined;
|
|
526
527
|
transcript_id?: undefined;
|
|
527
528
|
query?: undefined;
|
|
528
|
-
limit?: undefined;
|
|
529
529
|
scan_limit?: undefined;
|
|
530
530
|
max_read_bytes?: undefined;
|
|
531
531
|
cursor?: undefined;
|
|
532
532
|
} | {
|
|
533
|
+
limit?: undefined;
|
|
533
534
|
event_id?: undefined;
|
|
534
535
|
series_id?: undefined;
|
|
535
536
|
page?: undefined;
|
|
@@ -551,7 +552,6 @@ export declare const meetingTools: ({
|
|
|
551
552
|
minimum: number;
|
|
552
553
|
};
|
|
553
554
|
query?: undefined;
|
|
554
|
-
limit?: undefined;
|
|
555
555
|
scan_limit?: undefined;
|
|
556
556
|
max_read_bytes?: undefined;
|
|
557
557
|
cursor?: undefined;
|
|
@@ -638,6 +638,7 @@ export declare const meetingTools: ({
|
|
|
638
638
|
max_read_bytes?: undefined;
|
|
639
639
|
cursor?: undefined;
|
|
640
640
|
} | {
|
|
641
|
+
limit?: undefined;
|
|
641
642
|
event_id?: undefined;
|
|
642
643
|
series_id?: undefined;
|
|
643
644
|
page?: undefined;
|
|
@@ -653,11 +654,11 @@ export declare const meetingTools: ({
|
|
|
653
654
|
format?: undefined;
|
|
654
655
|
transcript_id?: undefined;
|
|
655
656
|
query?: undefined;
|
|
656
|
-
limit?: undefined;
|
|
657
657
|
scan_limit?: undefined;
|
|
658
658
|
max_read_bytes?: undefined;
|
|
659
659
|
cursor?: undefined;
|
|
660
660
|
} | {
|
|
661
|
+
limit?: undefined;
|
|
661
662
|
event_id?: undefined;
|
|
662
663
|
series_id?: undefined;
|
|
663
664
|
page?: undefined;
|
|
@@ -675,11 +676,11 @@ export declare const meetingTools: ({
|
|
|
675
676
|
format?: undefined;
|
|
676
677
|
transcript_id?: undefined;
|
|
677
678
|
query?: undefined;
|
|
678
|
-
limit?: undefined;
|
|
679
679
|
scan_limit?: undefined;
|
|
680
680
|
max_read_bytes?: undefined;
|
|
681
681
|
cursor?: undefined;
|
|
682
682
|
} | {
|
|
683
|
+
limit?: undefined;
|
|
683
684
|
event_id?: undefined;
|
|
684
685
|
series_id?: undefined;
|
|
685
686
|
page?: undefined;
|
|
@@ -701,7 +702,6 @@ export declare const meetingTools: ({
|
|
|
701
702
|
minimum: number;
|
|
702
703
|
};
|
|
703
704
|
query?: undefined;
|
|
704
|
-
limit?: undefined;
|
|
705
705
|
scan_limit?: undefined;
|
|
706
706
|
max_read_bytes?: undefined;
|
|
707
707
|
cursor?: undefined;
|
|
@@ -56,9 +56,10 @@ export interface SkippedSource {
|
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* The accounts of `kinds` the entries name, and each entry that names none of them with the reason. A search
|
|
59
|
-
* fails only when nothing fits: `what` names the search in that error.
|
|
59
|
+
* fails only when nothing fits: `what` names the search in that error. `alsoFits` takes an account no kind names,
|
|
60
|
+
* such as one a records import wrote business data into.
|
|
60
61
|
*/
|
|
61
|
-
export declare const fitting: (entries: readonly ListedEntry[], kinds: readonly Kind[], what: string, reasonOf?: (kind: Kind) => string) => {
|
|
62
|
+
export declare const fitting: (entries: readonly ListedEntry[], kinds: readonly Kind[], what: string, reasonOf?: (kind: Kind) => string, alsoFits?: (account: AccountKey) => boolean) => {
|
|
62
63
|
accounts: AccountKey[];
|
|
63
64
|
skipped: SkippedSource[];
|
|
64
65
|
};
|
|
@@ -218,18 +218,19 @@ const READS = {
|
|
|
218
218
|
};
|
|
219
219
|
/**
|
|
220
220
|
* The accounts of `kinds` the entries name, and each entry that names none of them with the reason. A search
|
|
221
|
-
* fails only when nothing fits: `what` names the search in that error.
|
|
221
|
+
* fails only when nothing fits: `what` names the search in that error. `alsoFits` takes an account no kind names,
|
|
222
|
+
* such as one a records import wrote business data into.
|
|
222
223
|
*/
|
|
223
|
-
export const fitting = (entries, kinds, what, reasonOf = (kind) => READS[kind]) => {
|
|
224
|
+
export const fitting = (entries, kinds, what, reasonOf = (kind) => READS[kind], alsoFits = () => false) => {
|
|
224
225
|
const chosen = new Map();
|
|
225
226
|
const skipped = [];
|
|
226
227
|
for (const { entry, accounts } of entries) {
|
|
227
|
-
const fits = accounts.filter((one) => kinds.some((kind) => listedHolds(one, kind)));
|
|
228
|
+
const fits = accounts.filter((one) => kinds.some((kind) => listedHolds(one, kind)) || alsoFits(one));
|
|
228
229
|
for (const { provider, account } of fits)
|
|
229
230
|
if (!chosen.has(keyOf({ provider, account })))
|
|
230
231
|
chosen.set(keyOf({ provider, account }), { provider, account });
|
|
231
232
|
const known = accounts.filter(({ kind }) => kind !== undefined);
|
|
232
|
-
const unknown = accounts.filter((
|
|
233
|
+
const unknown = accounts.filter((one) => one.kind === undefined && !alsoFits(one));
|
|
233
234
|
if (known.length)
|
|
234
235
|
for (const { provider, account } of unknown)
|
|
235
236
|
skipped.push({ source: `${provider}:${account}`, code: "not_found", reason: UNKNOWN_PROVIDER });
|
|
@@ -2,6 +2,7 @@ import type { LinkScorer } from "./types.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* A person who wrote 5 or more messages in the window in one of the project's confirmed chats, or any in a dialog or a
|
|
4
4
|
* group of 10 people or fewer, found by the sender's identity, never by the name a message shows. In a group of more
|
|
5
|
-
* than 30 people writing there says less.
|
|
5
|
+
* than 30 people writing there says less. The reason names the chat and its size, and the evidence leads with the chat,
|
|
6
|
+
* so the owner can find and decide one group's senders together (`memo review list via:<chat>`).
|
|
6
7
|
*/
|
|
7
8
|
export declare const chatSenders: LinkScorer;
|
|
@@ -6,14 +6,22 @@ const LARGE_GROUP = 30;
|
|
|
6
6
|
const SMALL_CHAT = 10;
|
|
7
7
|
const MIN_MESSAGES = 5;
|
|
8
8
|
const READ_LIMIT = 2000;
|
|
9
|
+
const TITLE_WIDTH = 60;
|
|
10
|
+
const named = (title, chat) => {
|
|
11
|
+
const flat = (title ?? "").replace(/\s+/gu, " ").trim();
|
|
12
|
+
if (!flat)
|
|
13
|
+
return chat;
|
|
14
|
+
return `«${flat.length > TITLE_WIDTH ? `${flat.slice(0, TITLE_WIDTH - 1)}…` : flat}»`;
|
|
15
|
+
};
|
|
9
16
|
/**
|
|
10
17
|
* A person who wrote 5 or more messages in the window in one of the project's confirmed chats, or any in a dialog or a
|
|
11
18
|
* group of 10 people or fewer, found by the sender's identity, never by the name a message shows. In a group of more
|
|
12
|
-
* than 30 people writing there says less.
|
|
19
|
+
* than 30 people writing there says less. The reason names the chat and its size, and the evidence leads with the chat,
|
|
20
|
+
* so the owner can find and decide one group's senders together (`memo review list via:<chat>`).
|
|
13
21
|
*/
|
|
14
22
|
export const chatSenders = {
|
|
15
23
|
id: "chat-senders",
|
|
16
|
-
version:
|
|
24
|
+
version: 3,
|
|
17
25
|
spreads: true,
|
|
18
26
|
candidates: async ({ store, project, confirmed, sources, since, owner, signal }) => {
|
|
19
27
|
if (!project)
|
|
@@ -37,6 +45,7 @@ export const chatSenders = {
|
|
|
37
45
|
}
|
|
38
46
|
const size = Math.max((await store.roster.members(key, reference.chat)).length, senders.size);
|
|
39
47
|
const weight = size > LARGE_GROUP ? LARGE_GROUP_WEIGHT : WEIGHT;
|
|
48
|
+
const where = named(await store.chats.chatTitle(key, reference.chat), chat);
|
|
40
49
|
for (const [id, { count, last }] of senders) {
|
|
41
50
|
if (size > SMALL_CHAT && count < MIN_MESSAGES)
|
|
42
51
|
continue;
|
|
@@ -48,8 +57,8 @@ export const chatSenders = {
|
|
|
48
57
|
to: project.ref,
|
|
49
58
|
kind: "member-of",
|
|
50
59
|
weight,
|
|
51
|
-
why:
|
|
52
|
-
evidence: [formatReference({ ...reference, type: "message", message: last })],
|
|
60
|
+
why: `wrote ${count} message${count === 1 ? "" : "s"} in ${where} (${size} people) since ${since.slice(0, 10)}`,
|
|
61
|
+
evidence: [chat, formatReference({ ...reference, type: "message", message: last })],
|
|
53
62
|
identity: contactRef(key.provider, id),
|
|
54
63
|
});
|
|
55
64
|
}
|
|
@@ -10,7 +10,7 @@ export interface LinkCandidate {
|
|
|
10
10
|
kind: "member-of" | "related-to";
|
|
11
11
|
/** 0..1. */
|
|
12
12
|
weight: number;
|
|
13
|
-
/** Ids and
|
|
13
|
+
/** Ids, counts and at most a chat's title, never message text. */
|
|
14
14
|
why: string;
|
|
15
15
|
evidence: string[];
|
|
16
16
|
/**
|
|
@@ -14,12 +14,12 @@ export declare const metadataService: (deps: ServiceDeps) => {
|
|
|
14
14
|
dryRun?: boolean;
|
|
15
15
|
}) => Promise<{
|
|
16
16
|
items: ({
|
|
17
|
+
error?: undefined;
|
|
17
18
|
chatId: string;
|
|
18
19
|
tags: import("../domain/channel-tags.js").ChannelTagMatch[];
|
|
19
20
|
algorithm: string;
|
|
20
21
|
fetchedAt: string | null;
|
|
21
22
|
source: string;
|
|
22
|
-
error?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
tags?: undefined;
|
|
25
25
|
algorithm?: undefined;
|
|
@@ -65,6 +65,7 @@ export const relationshipKind = (store) => {
|
|
|
65
65
|
kinds: ["relationship"],
|
|
66
66
|
...(status === undefined ? {} : { status }),
|
|
67
67
|
...pushed(filter),
|
|
68
|
+
...(filter.via === undefined ? {} : { evidence: filter.via }),
|
|
68
69
|
});
|
|
69
70
|
const links = (filter.status ?? "proposed") === "rejected" ? [] : await legacy();
|
|
70
71
|
return kept([...stored.map(storedRow), ...links.map(linkRow)], filter);
|
|
@@ -60,7 +60,9 @@ export const emptyProposalRegistry = (store) => {
|
|
|
60
60
|
throw new CliError("validation_error", "a proposal list takes a nonnegative offset");
|
|
61
61
|
const asked = filter.kinds === undefined ? kinds : kinds.filter((kind) => filter.kinds?.includes(kind.kind));
|
|
62
62
|
const wide = { ...filter, offset: 0, limit: filter.offset + filter.limit + 1 };
|
|
63
|
-
const rows = (await Promise.all(asked.map(async (kind) => (await kind.list(wide)).map((row) => marked(kind, row)))))
|
|
63
|
+
const rows = (await Promise.all(asked.map(async (kind) => (await kind.list(wide)).map((row) => marked(kind, row)))))
|
|
64
|
+
.flat()
|
|
65
|
+
.filter((row) => filter.via === undefined || row.evidence.includes(filter.via));
|
|
64
66
|
rows.sort((a, b) => b.createdAt.localeCompare(a.createdAt) || b.id.localeCompare(a.id));
|
|
65
67
|
const page = rows.slice(filter.offset, filter.offset + filter.limit + 1);
|
|
66
68
|
return { items: page.slice(0, filter.limit), hasMore: page.length > filter.limit };
|
|
@@ -38,6 +38,8 @@ export interface ProposalFilter {
|
|
|
38
38
|
bot: string;
|
|
39
39
|
};
|
|
40
40
|
status?: ProposalRow["status"] | "all";
|
|
41
|
+
/** A reference among the proposal's evidence, such as the chat a scan found a group's senders in. */
|
|
42
|
+
via?: string;
|
|
41
43
|
limit: number;
|
|
42
44
|
offset: number;
|
|
43
45
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AccountKey, type MessageStore } from "../store/store.js";
|
|
2
|
+
import type { SearchAllItem } from "./search-all.js";
|
|
3
|
+
/** The account a hit of the owner's own invoice, product or wallet names: no import made it. */
|
|
4
|
+
export declare const OWN_BUSINESS: AccountKey;
|
|
5
|
+
export declare const BUSINESS_WORDS_ONLY: string;
|
|
6
|
+
export interface BusinessLane {
|
|
7
|
+
items: SearchAllItem[];
|
|
8
|
+
hasMore: boolean;
|
|
9
|
+
/** Every account read. */
|
|
10
|
+
read: AccountKey[];
|
|
11
|
+
}
|
|
12
|
+
/** The `business` lane: numbers and names folded in memory, each hit titled as its ref reads everywhere else. */
|
|
13
|
+
export declare const searchBusiness: (store: MessageStore, { words, anyWord, window, accounts, }: {
|
|
14
|
+
words: string[];
|
|
15
|
+
anyWord: boolean;
|
|
16
|
+
window: number;
|
|
17
|
+
accounts: AccountKey[] | undefined;
|
|
18
|
+
}) => Promise<BusinessLane>;
|