@wirecat/cli-core 0.624.0 → 0.625.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 CHANGED
@@ -5,6 +5,26 @@ 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
+ ## 0.625.0 — 09.11.2026
9
+
10
+ ### Added
11
+
12
+ - **A records file can be a spreadsheet.** `recordColumns(type)` lists a type's columns: `external_id`, its flat
13
+ fields, one per role and one per key of its lists (`lines.amount`), each with whether it is required, its shape and
14
+ its values. `recordTemplate(type, "csv" | "json")` writes a file to fill: the CSV header with a byte-order mark, in
15
+ the separator asked for, or an envelope of one example record. `envelopeOfCsv(text, { type, source })` reads a sheet
16
+ of one type as an envelope: `;`, `,` or a tab, a byte-order mark, `10 000,50` and `09.11.2026` as Excel writes them
17
+ in Russian or Spanish, a role as the target's external id (`<type>:<external id>` where it takes several types), and
18
+ a row that repeats an external id as one more item of a list. `placeOf(pointer)` names the line and column a
19
+ receipt's pointer came from; a sheet it cannot read throws a `TableError` that names them too. SMS and calls have no
20
+ table: they come from a phone's own export.
21
+
22
+ ### Changed — may break callers
23
+
24
+ - **`people.list` has a `stranger` kind**: a named person with no tie to the owner, such as an author seen only in a
25
+ big group. `unsorted` now holds only people with nothing to show as a name. `kind: "stranger"` lists them, `all`
26
+ includes them, and `counts` counts them.
27
+
8
28
  ## 0.624.0 — 09.11.2026
9
29
 
10
30
  ### Added
@@ -1,5 +1,5 @@
1
1
  /** What a person in the store is, for a list that shows the useful ones and keeps the noise apart. */
2
- export declare const PERSON_KINDS: readonly ["person", "organization", "automated", "unsorted"];
2
+ export declare const PERSON_KINDS: readonly ["person", "organization", "automated", "stranger", "unsorted"];
3
3
  export type PersonKind = (typeof PERSON_KINDS)[number];
4
4
  /** What decided a kind, besides the ties that make someone a `person`. */
5
5
  export type KindSignal = "bot" | "no-reply" | "bulk-mail" | "bulk-never-replied" | "automated-name" | "organization" | "role-address" | "company-name" | "no-tie" | "no-name";
@@ -1,5 +1,5 @@
1
1
  /** What a person in the store is, for a list that shows the useful ones and keeps the noise apart. */
2
- export const PERSON_KINDS = ["person", "organization", "automated", "unsorted"];
2
+ export const PERSON_KINDS = ["person", "organization", "automated", "stranger", "unsorted"];
3
3
  const AUTOMATED_WORDS = new Set([
4
4
  "noreply",
5
5
  "notification",
@@ -0,0 +1,61 @@
1
+ import { type EnvelopeOptions, type EnvelopeSource, type IngestError, type RecordsEnvelope } from "./records.js";
2
+ /** The types a table can carry: an SMS and a call come from a phone's own export, never from a hand-made sheet. */
3
+ export declare const TABLE_RECORD_TYPES: readonly string[];
4
+ export type ColumnShape = "text" | "decimal" | "day" | "instant" | "currency" | "integer" | "boolean" | "list";
5
+ export interface TableColumn {
6
+ /** `external_id`, a field (`total`), a role (`counterparty`) or an item of a list (`lines.amount`). */
7
+ name: string;
8
+ kind: "id" | "field" | "role" | "item";
9
+ required: boolean;
10
+ shape: ColumnShape;
11
+ description: string;
12
+ values?: readonly string[];
13
+ /** A role's target types: one names the target's external id, several take `<type>:<external id>`. */
14
+ targets?: readonly string[];
15
+ /** Several values in the cell, split by `|`. */
16
+ many?: boolean;
17
+ }
18
+ /** Where a pointer into the envelope came from in the sheet: its line from 1 (the header is 1), and the column. */
19
+ export interface TablePlace {
20
+ line: number;
21
+ column?: string;
22
+ }
23
+ export interface TableEnvelope {
24
+ envelope: RecordsEnvelope;
25
+ /** The sheet's place of a receipt's or an error's pointer, by its longest known prefix. */
26
+ placeOf(pointer: string): TablePlace | undefined;
27
+ }
28
+ export declare class TableError extends Error {
29
+ readonly errors: (IngestError & {
30
+ place?: TablePlace;
31
+ })[];
32
+ constructor(errors: (IngestError & {
33
+ place?: TablePlace;
34
+ })[]);
35
+ }
36
+ /** A type's columns: the external id, its flat fields, one per role, then one per key of each list of items. */
37
+ export declare const recordColumns: (type: string) => TableColumn[];
38
+ /**
39
+ * A file to fill for a type. CSV is the header row alone, with a byte-order mark so Excel reads it as UTF-8; JSON is
40
+ * an envelope of one example record that names every field and role.
41
+ */
42
+ export declare const recordTemplate: (type: string, format: "csv" | "json", { source, separator }?: {
43
+ source?: Partial<EnvelopeSource>;
44
+ separator?: string;
45
+ }) => string;
46
+ /** RFC 4180 rows; a separator inside quotes, a doubled quote and a line break inside quotes are part of the cell. */
47
+ export declare const csvRows: (text: string, separator: string) => {
48
+ cells: string[];
49
+ line: number;
50
+ }[];
51
+ /** The header's separator: Excel saves `;` where the decimal mark is a comma, as in Russian or Spanish. */
52
+ export declare const csvSeparator: (header: string) => string;
53
+ /**
54
+ * Reads a sheet of one type as an envelope. A row whose `external_id` an earlier row had continues that record: its
55
+ * item columns (`lines.amount`) add one item to the list, as an invoice exported a line a row does.
56
+ */
57
+ export declare const envelopeOfCsv: (text: string, { type, source, options }: {
58
+ type: string;
59
+ source: EnvelopeSource;
60
+ options?: EnvelopeOptions;
61
+ }) => TableEnvelope;
@@ -0,0 +1,382 @@
1
+ import { RECORD_TYPES } from "./record-types.js";
2
+ import { pointerOf, RECORDS_SCHEMA_VERSION, } from "./records.js";
3
+ /** The types a table can carry: an SMS and a call come from a phone's own export, never from a hand-made sheet. */
4
+ export const TABLE_RECORD_TYPES = Object.keys(RECORD_TYPES).filter((type) => !RECORD_TYPES[type].importOnly);
5
+ export class TableError extends Error {
6
+ errors;
7
+ constructor(errors) {
8
+ super(errors.map((e) => e.message).join("; "));
9
+ this.errors = errors;
10
+ }
11
+ }
12
+ const LIST_SEPARATOR = "|";
13
+ const BOM = "";
14
+ const specOf = (type) => RECORD_TYPES[type];
15
+ const typesOf = (schema) => schema.type === undefined ? [] : typeof schema.type === "string" ? [schema.type] : [...schema.type];
16
+ const shapeOf = (schema) => {
17
+ const types = typesOf(schema);
18
+ if (types.includes("integer"))
19
+ return "integer";
20
+ if (types.includes("boolean"))
21
+ return "boolean";
22
+ if (types.includes("array"))
23
+ return "list";
24
+ if (schema.pattern?.includes("T[0-9]{2}"))
25
+ return "instant";
26
+ if (schema.pattern?.startsWith("^[0-9]{4}-"))
27
+ return "day";
28
+ if (schema.pattern?.includes("[A-Za-z]{3}"))
29
+ return "currency";
30
+ if (schema.pattern?.includes("(\\.[0-9]"))
31
+ return "decimal";
32
+ return "text";
33
+ };
34
+ const valuesOf = (schema) => schema.enum?.filter((v) => v !== null);
35
+ const flat = (schema) => {
36
+ const types = typesOf(schema);
37
+ return !types.includes("object") && !(types.includes("array") && schema.items?.type === "object");
38
+ };
39
+ const fieldColumn = (name, schema, required, kind) => {
40
+ const values = valuesOf(schema);
41
+ const shape = shapeOf(schema);
42
+ return {
43
+ name,
44
+ kind,
45
+ required,
46
+ shape,
47
+ description: schema.description ?? "",
48
+ ...(values ? { values } : {}),
49
+ ...(shape === "list" ? { many: true } : {}),
50
+ };
51
+ };
52
+ const roleColumn = (name, role) => ({
53
+ name,
54
+ kind: "role",
55
+ required: role.required === true,
56
+ shape: "text",
57
+ description: role.targets.length === 1
58
+ ? `The ${role.targets[0]}'s external id`
59
+ : `<type>:<external id>, the type one of ${role.targets.join(", ")}`,
60
+ targets: role.targets,
61
+ ...(role.many ? { many: true } : {}),
62
+ });
63
+ /** A type's columns: the external id, its flat fields, one per role, then one per key of each list of items. */
64
+ export const recordColumns = (type) => {
65
+ const spec = specOf(type);
66
+ if (!spec || spec.importOnly)
67
+ return [];
68
+ const fields = spec.fields.properties ?? {};
69
+ const required = spec.fields.required ?? [];
70
+ const lists = Object.entries(fields).filter(([, schema]) => !flat(schema));
71
+ return [
72
+ { name: "external_id", kind: "id", required: true, shape: "text", description: "Its id in your system" },
73
+ ...Object.entries(fields)
74
+ .filter(([, schema]) => flat(schema))
75
+ .map(([name, schema]) => fieldColumn(name, schema, required.includes(name), "field")),
76
+ ...Object.entries(spec.roles)
77
+ .filter(([, role]) => !role.linked)
78
+ .map(([name, role]) => roleColumn(name, role)),
79
+ ...lists.flatMap(([list, schema]) => {
80
+ const item = schema.items ?? {};
81
+ const own = item.required ?? [];
82
+ return Object.entries(item.properties ?? {}).map(([key, s]) => fieldColumn(`${list}.${key}`, s, required.includes(list) && own.includes(key), "item"));
83
+ }),
84
+ ];
85
+ };
86
+ const csvCell = (value, separator) => /["\r\n]/.test(value) || value.includes(separator) ? `"${value.replaceAll('"', '""')}"` : value;
87
+ const example = (column) => {
88
+ if (column.values?.[0])
89
+ return column.values[0];
90
+ switch (column.shape) {
91
+ case "decimal":
92
+ return "100.00";
93
+ case "day":
94
+ return "2026-01-31";
95
+ case "instant":
96
+ return "2026-01-31T09:00:00Z";
97
+ case "currency":
98
+ return "EUR";
99
+ case "integer":
100
+ return 1;
101
+ case "boolean":
102
+ return true;
103
+ case "list":
104
+ return ["…"];
105
+ default:
106
+ return column.description || "…";
107
+ }
108
+ };
109
+ const exampleRef = (column) => ({
110
+ role: column.name,
111
+ type: column.targets?.[0] ?? "",
112
+ external_id: `${column.targets?.[0] ?? "record"}-1`,
113
+ });
114
+ /**
115
+ * A file to fill for a type. CSV is the header row alone, with a byte-order mark so Excel reads it as UTF-8; JSON is
116
+ * an envelope of one example record that names every field and role.
117
+ */
118
+ export const recordTemplate = (type, format, { source, separator = "," } = {}) => {
119
+ const columns = recordColumns(type);
120
+ if (columns.length === 0)
121
+ throw new TableError([unknownType(type)]);
122
+ if (format === "csv")
123
+ return `${BOM}${columns.map((c) => csvCell(c.name, separator)).join(separator)}\r\n`;
124
+ const fields = {};
125
+ for (const c of columns.filter((c) => c.kind === "field"))
126
+ fields[c.name] = example(c);
127
+ for (const c of columns.filter((c) => c.kind === "item")) {
128
+ const [list = "", key = ""] = c.name.split(".");
129
+ fields[list] ??= [{}];
130
+ const [first] = fields[list];
131
+ if (first)
132
+ first[key] = example(c);
133
+ }
134
+ const envelope = {
135
+ schema_version: RECORDS_SCHEMA_VERSION,
136
+ source: {
137
+ provider: source?.provider ?? "sheet",
138
+ account: source?.account ?? "main",
139
+ batch_id: source?.batch_id ?? "first-import",
140
+ },
141
+ records: [
142
+ {
143
+ key: `${type}-1`,
144
+ type,
145
+ external_id: `${type}-1`,
146
+ operation: "upsert",
147
+ fields,
148
+ relations: columns.filter((c) => c.kind === "role").map(exampleRef),
149
+ },
150
+ ],
151
+ };
152
+ return `${JSON.stringify(envelope, null, 2)}\n`;
153
+ };
154
+ /** RFC 4180 rows; a separator inside quotes, a doubled quote and a line break inside quotes are part of the cell. */
155
+ export const csvRows = (text, separator) => {
156
+ const rows = [];
157
+ let cells = [];
158
+ let cell = "";
159
+ let quoted = false;
160
+ let line = 1;
161
+ let start = 1;
162
+ const end = () => {
163
+ cells.push(cell);
164
+ cell = "";
165
+ };
166
+ for (let i = 0; i < text.length; i++) {
167
+ const c = text[i];
168
+ if (quoted) {
169
+ if (c === '"' && text[i + 1] === '"') {
170
+ cell += '"';
171
+ i++;
172
+ }
173
+ else if (c === '"')
174
+ quoted = false;
175
+ else {
176
+ if (c === "\n")
177
+ line++;
178
+ cell += c;
179
+ }
180
+ }
181
+ else if (c === '"' && cell === "")
182
+ quoted = true;
183
+ else if (c === separator)
184
+ end();
185
+ else if (c === "\n" || c === "\r") {
186
+ if (c === "\r" && text[i + 1] === "\n")
187
+ i++;
188
+ end();
189
+ rows.push({ cells, line: start });
190
+ cells = [];
191
+ line++;
192
+ start = line;
193
+ }
194
+ else
195
+ cell += c;
196
+ }
197
+ if (cell !== "" || cells.length > 0) {
198
+ end();
199
+ rows.push({ cells, line: start });
200
+ }
201
+ return rows.filter((r) => r.cells.some((c) => c.trim() !== ""));
202
+ };
203
+ /** The header's separator: Excel saves `;` where the decimal mark is a comma, as in Russian or Spanish. */
204
+ export const csvSeparator = (header) => {
205
+ const count = (s) => header.split(s).length - 1;
206
+ return [";", "\t", ","].reduce((best, s) => (count(s) > count(best) ? s : best), ",");
207
+ };
208
+ const DAY_DOTTED = /^(\d{1,2})[./](\d{1,2})[./](\d{4})$/;
209
+ /** What a spreadsheet writes, as the envelope reads it; anything it cannot read is left for the envelope to refuse. */
210
+ const normalized = (column, raw) => {
211
+ const value = raw.trim();
212
+ switch (column.shape) {
213
+ case "decimal": {
214
+ const plain = value.replace(/[\s  ]/g, "");
215
+ return /^\d+,\d+$/.test(plain) ? plain.replace(",", ".") : plain;
216
+ }
217
+ case "day": {
218
+ const dotted = DAY_DOTTED.exec(value);
219
+ return dotted ? `${dotted[3]}-${dotted[2]?.padStart(2, "0")}-${dotted[1]?.padStart(2, "0")}` : value;
220
+ }
221
+ case "currency":
222
+ return value.toUpperCase();
223
+ case "integer":
224
+ return /^-?\d+$/.test(value) ? Number(value) : value;
225
+ case "boolean":
226
+ return /^(true|yes|1|да|sí|si)$/i.test(value) ? true : /^(false|no|0|нет)$/i.test(value) ? false : value;
227
+ case "list":
228
+ return value
229
+ .split(LIST_SEPARATOR)
230
+ .map((v) => v.trim())
231
+ .filter(Boolean);
232
+ default:
233
+ return column.many
234
+ ? value
235
+ .split(LIST_SEPARATOR)
236
+ .map((v) => v.trim())
237
+ .filter(Boolean)
238
+ : value;
239
+ }
240
+ };
241
+ const unknownType = (type) => ({
242
+ pointer: "",
243
+ code: "record.type",
244
+ message: `no table for ${type}: use one of ${TABLE_RECORD_TYPES.join(", ")}`,
245
+ });
246
+ const relationsOf = (column, raw) => {
247
+ const targets = column.targets ?? [];
248
+ const values = column.many ? raw.split(LIST_SEPARATOR) : [raw];
249
+ const out = [];
250
+ for (const value of values.map((v) => v.trim()).filter(Boolean)) {
251
+ const at = value.indexOf(":");
252
+ const named = at > 0 ? value.slice(0, at) : "";
253
+ if (targets.length === 1 && !targets.includes(named)) {
254
+ out.push({ role: column.name, type: targets[0], external_id: value });
255
+ continue;
256
+ }
257
+ if (!targets.includes(named) || at === value.length - 1)
258
+ return {
259
+ pointer: "",
260
+ code: "record.invalid",
261
+ message: `${column.name} takes <type>:<external id>, the type one of ${targets.join(", ")}: not ${value}`,
262
+ };
263
+ out.push({ role: column.name, type: named, external_id: value.slice(at + 1) });
264
+ }
265
+ return out;
266
+ };
267
+ /**
268
+ * Reads a sheet of one type as an envelope. A row whose `external_id` an earlier row had continues that record: its
269
+ * item columns (`lines.amount`) add one item to the list, as an invoice exported a line a row does.
270
+ */
271
+ export const envelopeOfCsv = (text, { type, source, options }) => {
272
+ const columns = recordColumns(type);
273
+ if (columns.length === 0)
274
+ throw new TableError([unknownType(type)]);
275
+ const body = text.startsWith(BOM) ? text.slice(1) : text;
276
+ const separator = csvSeparator(body.slice(0, body.search(/\r?\n|$/)));
277
+ const [head, ...rows] = csvRows(body, separator);
278
+ if (!head)
279
+ throw new TableError([{ pointer: "", code: "envelope.invalid", message: "the file has no header row" }]);
280
+ const byName = new Map(columns.map((c) => [c.name, c]));
281
+ const header = head.cells.map((name) => name.trim());
282
+ const unknown = header.filter((name) => name !== "" && !byName.has(name));
283
+ if (unknown.length > 0)
284
+ throw new TableError([
285
+ {
286
+ pointer: "",
287
+ code: "envelope.invalid",
288
+ message: `columns ${type} has no field for: ${unknown.join(", ")}. Download the ${type} template for the list`,
289
+ place: { line: 1, column: unknown[0] },
290
+ },
291
+ ]);
292
+ if (!header.includes("external_id"))
293
+ throw new TableError([
294
+ { pointer: "", code: "envelope.invalid", message: "the header has no external_id column", place: { line: 1 } },
295
+ ]);
296
+ const records = [];
297
+ const indexById = new Map();
298
+ const places = new Map();
299
+ const errors = [];
300
+ for (const row of rows) {
301
+ const cell = (name) => row.cells[header.indexOf(name)] ?? "";
302
+ const id = cell("external_id").trim();
303
+ if (!id) {
304
+ errors.push({
305
+ pointer: "",
306
+ code: "record.invalid",
307
+ message: "a row has no external_id",
308
+ place: { line: row.line, column: "external_id" },
309
+ });
310
+ continue;
311
+ }
312
+ const known = indexById.get(id);
313
+ const index = known ?? records.length;
314
+ const record = records[index] ?? {
315
+ key: `${type}:${id}`,
316
+ type,
317
+ external_id: id,
318
+ operation: "upsert",
319
+ fields: {},
320
+ relations: [],
321
+ };
322
+ if (known === undefined) {
323
+ records.push(record);
324
+ indexById.set(id, index);
325
+ places.set(pointerOf("records", index), { line: row.line });
326
+ }
327
+ const fields = record.fields;
328
+ const item = {};
329
+ let list = "";
330
+ header.forEach((name, i) => {
331
+ const column = byName.get(name);
332
+ const raw = row.cells[i] ?? "";
333
+ if (!column || column.kind === "id" || raw.trim() === "")
334
+ return;
335
+ const at = { line: row.line, column: name };
336
+ if (column.kind === "field") {
337
+ fields[name] = normalized(column, raw);
338
+ places.set(pointerOf("records", index, "fields", name), at);
339
+ }
340
+ else if (column.kind === "role") {
341
+ const relations = relationsOf(column, raw);
342
+ if (!Array.isArray(relations)) {
343
+ errors.push({ ...relations, pointer: pointerOf("records", index, "relations"), key: record.key, place: at });
344
+ return;
345
+ }
346
+ record.relations = [...(record.relations ?? []).filter((r) => r.role !== name), ...relations];
347
+ places.set(pointerOf("records", index, "relations"), at);
348
+ }
349
+ else {
350
+ const [of = "", key = ""] = name.split(".");
351
+ list = of;
352
+ item[key] = normalized(column, raw);
353
+ }
354
+ });
355
+ if (list) {
356
+ fields[list] ??= [];
357
+ const items = fields[list];
358
+ places.set(pointerOf("records", index, "fields", list, items.length), { line: row.line });
359
+ items.push(item);
360
+ }
361
+ }
362
+ if (errors.length > 0)
363
+ throw new TableError(errors);
364
+ const envelope = {
365
+ schema_version: RECORDS_SCHEMA_VERSION,
366
+ source,
367
+ ...(options ? { options } : {}),
368
+ records,
369
+ };
370
+ return {
371
+ envelope,
372
+ placeOf(pointer) {
373
+ const item = /^\/records\/\d+\/fields\/([^/]+)\/\d+\/([^/]+)/.exec(pointer);
374
+ for (let at = pointer; at !== ""; at = at.slice(0, at.lastIndexOf("/"))) {
375
+ const place = places.get(at);
376
+ if (place)
377
+ return item && !place.column ? { ...place, column: `${item[1]}.${item[2]}` } : place;
378
+ }
379
+ return undefined;
380
+ },
381
+ };
382
+ };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export type { RankingGraphEvidence, RankingGraphLink } from "./domain/rankings-g
22
22
  export type { RankingComponent, RankingInput, RankingMeasure, RankingOptions, RankingTarget, RankingWeights, ScorePreset, } from "./domain/rankings-options.js";
23
23
  export { rankingOptions } from "./domain/rankings-options.js";
24
24
  export { type EnvelopeOptions, type EnvelopeRecord, type EnvelopeSource, envelopeOfJsonl, envelopeOfText, type IngestError, RECORD_ENTITY_TYPES, RECORD_OPERATIONS, RECORDS_ENVELOPE_SCHEMA, RECORDS_SCHEMA_VERSION, type RecordEntityType, type RecordOperation, type RecordRelation, type RecordsEnvelope, } from "./domain/records.js";
25
+ export { type ColumnShape, envelopeOfCsv, recordColumns, recordTemplate, TABLE_RECORD_TYPES, type TableColumn, type TableEnvelope, TableError, type TablePlace, } from "./domain/records-table.js";
25
26
  export { canonicalReference, formatReference, looksLikeReference, parseReference, REF_KINDS, type Reference, type RefKindName, type RefKindSpec, } from "./domain/references.js";
26
27
  export { byEngagement, CONTRACT_ROLES, ENGAGEMENT_LEVELS, type Engagement, engagementRank, inverseOf, isUsable, ORGANIZATION_ROLES, PROJECT_ROLES, RELATION_KINDS, RELATIONS, type RelationKind, ROLE_LISTS, type RoleList, rolesOf, STANDINGS, type Standing, standingOf, usableLink, } from "./domain/relations.js";
27
28
  export { normalizeTag, TAG_TYPES, type TagType } from "./domain/tags.js";
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ export { countedPoll } from "./domain/polls.js";
17
17
  export { ADDED_ACCOUNT, ADDED_PROVIDER, CRM_OPENS, FOLDER_PROVIDERS, holdsKind, isFolderProvider, isKind, KINDS, kindIn, kindOf, kindsIn, PROVIDERS, providerNamed, providers, UNKNOWN_PROVIDER, useProviders, } from "./domain/providers.js";
18
18
  export { rankingOptions } from "./domain/rankings-options.js";
19
19
  export { envelopeOfJsonl, envelopeOfText, RECORD_ENTITY_TYPES, RECORD_OPERATIONS, RECORDS_ENVELOPE_SCHEMA, RECORDS_SCHEMA_VERSION, } from "./domain/records.js";
20
+ export { envelopeOfCsv, recordColumns, recordTemplate, TABLE_RECORD_TYPES, TableError, } from "./domain/records-table.js";
20
21
  export { canonicalReference, formatReference, looksLikeReference, parseReference, REF_KINDS, } from "./domain/references.js";
21
22
  export { byEngagement, CONTRACT_ROLES, ENGAGEMENT_LEVELS, engagementRank, inverseOf, isUsable, ORGANIZATION_ROLES, PROJECT_ROLES, RELATION_KINDS, RELATIONS, ROLE_LISTS, rolesOf, STANDINGS, standingOf, usableLink, } from "./domain/relations.js";
22
23
  export { normalizeTag, TAG_TYPES } from "./domain/tags.js";
@@ -14,12 +14,12 @@ export declare const metadataService: (deps: ServiceDeps) => {
14
14
  dryRun?: boolean;
15
15
  }) => Promise<{
16
16
  items: ({
17
- error?: undefined;
18
17
  chatId: string;
19
18
  tags: import("../domain/channel-tags.js").ChannelTagMatch[];
20
19
  algorithm: string;
21
20
  fetchedAt: string | null;
22
21
  source: string;
22
+ error?: undefined;
23
23
  } | {
24
24
  tags?: undefined;
25
25
  algorithm?: undefined;
@@ -106,7 +106,8 @@ export interface PeopleStore extends AccountPeople {
106
106
  /**
107
107
  * People of one kind with their shown name, contact, interactions and ties, a page at a time. `person` (the default)
108
108
  * is the owner, people added by hand, task assignees, and named people with a tie (a one-to-one chat, a small group,
109
- * mail the owner wrote, a meeting, a CRM, the address book); `automated`, `organization` and `unsorted` hold the rest.
109
+ * mail the owner wrote, a meeting, a CRM, the address book); `automated`, `organization`, `stranger` (a
110
+ * name, no tie) and `unsorted` (nothing to show as a name) hold the rest.
110
111
  */
111
112
  list(options: PeopleListOptions): Promise<PeopleList>;
112
113
  /** People whose names start like the typed one, the same name first: for a form that adds a person. */
@@ -117,7 +117,7 @@ const kindOf = (shown, facts, ties, mail) => {
117
117
  if (!isReadable(shown))
118
118
  return { kind: "unsorted", signals: ["no-name"] };
119
119
  if (ties.length === 0)
120
- return { kind: "unsorted", signals: ["no-tie"] };
120
+ return { kind: "stranger", signals: ["no-tie"] };
121
121
  return { kind: "person", signals: ties };
122
122
  };
123
123
  /** Each person with their kind, contact and counts; the last contact is added for the page alone. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.624.0",
3
+ "version": "0.625.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",