@wirecat/cli-core 0.678.0 → 0.680.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 +69 -0
- package/dist/background/budget.d.ts +9 -0
- package/dist/background/budget.js +16 -0
- package/dist/calendar/cli/answers.d.ts +2 -0
- package/dist/calendar/cli/answers.js +7 -1
- package/dist/calendar/cli/index.js +3 -0
- package/dist/cli/documents/sync.d.ts +1 -1
- package/dist/cli/help/first-screen.d.ts +2 -10
- package/dist/cli/help/first-screen.js +2 -54
- package/dist/cli/setup-command.js +28 -10
- package/dist/cli/skill-refresh.js +4 -3
- package/dist/crm/index.d.ts +1 -0
- package/dist/crm/index.js +1 -0
- package/dist/documents/scope.d.ts +3 -3
- package/dist/documents/scope.js +8 -4
- package/dist/entities/business-context.js +4 -0
- package/dist/entities/recorded-meeting.d.ts +1 -0
- package/dist/entities/recorded-meeting.js +2 -0
- package/dist/mcp/app-server.js +4 -5
- package/dist/mcp/bot/server.js +4 -5
- package/dist/mcp/server.js +5 -6
- package/dist/ports/wirecat-tools.d.ts +12 -0
- package/dist/ports/wirecat-tools.js +81 -0
- package/dist/sends/upload.d.ts +4 -1
- package/dist/sends/upload.js +22 -8
- package/dist/services/communications.d.ts +35 -0
- package/dist/services/communications.js +52 -2
- package/dist/services/documents/plan.js +25 -6
- package/dist/services/documents/ports.d.ts +2 -0
- package/dist/services/documents/sync.js +3 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +1 -0
- package/dist/services/notes-search.d.ts +8 -0
- package/dist/services/notes-search.js +29 -1
- package/dist/services/person-meetings.d.ts +2 -0
- package/dist/services/person-meetings.js +16 -1
- package/dist/skills/validate.d.ts +2 -0
- package/dist/skills/validate.js +28 -5
- package/dist/store/sqlite/agent-links.js +2 -2
- package/dist/store/sqlite/event-search.d.ts +2 -0
- package/dist/store/sqlite/event-search.js +10 -0
- package/dist/store/sqlite/note-search.d.ts +2 -0
- package/dist/store/sqlite/note-search.js +10 -0
- package/dist/store/sqlite/person-match-scan.d.ts +5 -0
- package/dist/store/sqlite/person-match-scan.js +15 -8
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ import { IDENTITY_LINK_KIND, } from "../identity-links.js";
|
|
|
5
5
|
import { rejectedEvidence, sidesOf } from "./identity-link-rows.js";
|
|
6
6
|
import { openIdentityLink } from "./identity-proposals.js";
|
|
7
7
|
import { isOwner, mergePerson, recordOf, required, survivorOf } from "./person-links.js";
|
|
8
|
-
import { emailHolders, phoneHolders, phonePairJoins, sharedLine, } from "./person-match-scan.js";
|
|
8
|
+
import { emailHolders, oneHolderPerSource, phoneHolders, phonePairJoins, sharedLine, } from "./person-match-scan.js";
|
|
9
9
|
import { mergeId, merges } from "./person-merges.js";
|
|
10
10
|
import { resolvePersonLinks } from "./person-resolution.js";
|
|
11
11
|
import { separated } from "./person-separation.js";
|
|
@@ -24,7 +24,7 @@ const weaknessOf = (context, kind, value, holders, sides, others) => {
|
|
|
24
24
|
return "role-address";
|
|
25
25
|
if (sharedLine(context, holders))
|
|
26
26
|
return "company";
|
|
27
|
-
if (others > 0)
|
|
27
|
+
if (others > 0 && !oneHolderPerSource(holders))
|
|
28
28
|
return "shared";
|
|
29
29
|
if (kind === "phone" && !isMobilePhone(value))
|
|
30
30
|
return "landline";
|
|
@@ -53,6 +53,8 @@ export interface EventSearch {
|
|
|
53
53
|
after?: string;
|
|
54
54
|
limit: number;
|
|
55
55
|
}): Promise<EventChunkToEmbed[]>;
|
|
56
|
+
/** How many live events' pieces have no vector of `model` yet: what `chunksToEmbed` would still give, at most. */
|
|
57
|
+
chunksLeft(model: string): Promise<number>;
|
|
56
58
|
/** Whether any live event with a searchable copy in these accounts has a vector of `model`. */
|
|
57
59
|
embedded(model: string, options?: {
|
|
58
60
|
accountIds?: string[];
|
|
@@ -105,6 +105,16 @@ export const eventSearchOver = (context) => {
|
|
|
105
105
|
});
|
|
106
106
|
},
|
|
107
107
|
eventIndexState: async () => corpusIndexState(database, CORPORA.event),
|
|
108
|
+
chunksLeft: async (model) => {
|
|
109
|
+
drain();
|
|
110
|
+
const scope = live(undefined);
|
|
111
|
+
const row = database
|
|
112
|
+
.prepare(`SELECT count(DISTINCT k.content_hash) AS left FROM chunks k
|
|
113
|
+
WHERE 1${scope.sql}
|
|
114
|
+
AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)`)
|
|
115
|
+
.get(...scope.params, model);
|
|
116
|
+
return Number(row?.left ?? 0);
|
|
117
|
+
},
|
|
108
118
|
chunksToEmbed: async (model, { after, limit }) => {
|
|
109
119
|
drain();
|
|
110
120
|
const scope = live(undefined);
|
|
@@ -126,6 +126,8 @@ export interface NoteSearch extends DocumentPictureStore {
|
|
|
126
126
|
after?: string;
|
|
127
127
|
limit: number;
|
|
128
128
|
}): Promise<NoteChunkToEmbed[]>;
|
|
129
|
+
/** How many live chunks have no vector of `model` yet: what `chunksToEmbed` would still give, at most. */
|
|
130
|
+
chunksLeft(model: string): Promise<number>;
|
|
129
131
|
/** Whether any live chunk in this scope has a vector of `model`: none means meaning search has nothing to rank. */
|
|
130
132
|
embedded(model: string, options: {
|
|
131
133
|
folderIds?: string[];
|
|
@@ -401,6 +401,16 @@ export const noteSearchOver = (context) => {
|
|
|
401
401
|
await new Promise((resolve) => setImmediate(resolve));
|
|
402
402
|
}
|
|
403
403
|
},
|
|
404
|
+
chunksLeft: async (model) => {
|
|
405
|
+
drain();
|
|
406
|
+
const scope = live(undefined, undefined);
|
|
407
|
+
const row = database
|
|
408
|
+
.prepare(`SELECT count(DISTINCT k.content_hash) AS left FROM chunks k
|
|
409
|
+
WHERE 1${scope.sql}
|
|
410
|
+
AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)`)
|
|
411
|
+
.get(...scope.params, model);
|
|
412
|
+
return Number(row?.left ?? 0);
|
|
413
|
+
},
|
|
404
414
|
chunksToEmbed: async (model, { after, limit }) => {
|
|
405
415
|
drain();
|
|
406
416
|
const scope = live(undefined, undefined);
|
|
@@ -26,6 +26,11 @@ export declare const PROPOSAL_SCORE: {
|
|
|
26
26
|
* as a messenger's; it joins only on a mobile number, since an office's landline is everyone's who works there.
|
|
27
27
|
*/
|
|
28
28
|
export declare const phonePairJoins: (phone: string, holders: Holder[]) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* BUG-774: holders that each come from a different source are one human seen by each of them (their CRM card, their
|
|
31
|
+
* WhatsApp, their call), not people on one line, however many person rows they still are.
|
|
32
|
+
*/
|
|
33
|
+
export declare const oneHolderPerSource: (holders: Holder[]) => boolean;
|
|
29
34
|
export interface Holder {
|
|
30
35
|
identity: number;
|
|
31
36
|
provider: string;
|
|
@@ -19,7 +19,7 @@ export const RULE = { bot: "rule", kind: "rule" };
|
|
|
19
19
|
const MOST_SHARING = 6;
|
|
20
20
|
const CURSOR = "people.scan";
|
|
21
21
|
/** Raised when a rule changes what a pass finds in values nobody touched: the next pass then reads everything once. */
|
|
22
|
-
const RULES =
|
|
22
|
+
const RULES = 6;
|
|
23
23
|
/**
|
|
24
24
|
* NEED-2526: a shared mailbox says little alone, so its proposal is scored by what else the two people have in common.
|
|
25
25
|
* The owner's word (2026-11-11): `hr@` is often one person's, so it starts below `info@`.
|
|
@@ -49,6 +49,11 @@ export const PROPOSAL_SCORE = {
|
|
|
49
49
|
*/
|
|
50
50
|
export const phonePairJoins = (phone, holders) => holders.some(({ provider }) => BARE_INTERNATIONAL_PROVIDERS.includes(provider)) ||
|
|
51
51
|
(holders.some(({ externalId }) => externalId === `phone:${phone}`) && isMobilePhone(phone));
|
|
52
|
+
/**
|
|
53
|
+
* BUG-774: holders that each come from a different source are one human seen by each of them (their CRM card, their
|
|
54
|
+
* WhatsApp, their call), not people on one line, however many person rows they still are.
|
|
55
|
+
*/
|
|
56
|
+
export const oneHolderPerSource = (holders) => new Set(holders.map(({ list }) => list)).size === holders.length;
|
|
52
57
|
/** NEED-2446, safe option until the owner rules: an address more than two people have is shared, so it proposes. */
|
|
53
58
|
const addressGroupJoins = (people) => people <= 2;
|
|
54
59
|
/** A bot or a service account shares its number or address with whoever runs it; it is nobody's person. */
|
|
@@ -264,8 +269,9 @@ const tooMany = (pass, people, reason, signal) => {
|
|
|
264
269
|
};
|
|
265
270
|
const skipShared = (pass, people, signal) => pass.result.skipped.push({ persons: [...people.keys()].map(String), signal, reason: `identity.shared-${signal}` });
|
|
266
271
|
/**
|
|
267
|
-
* A number two people have joins them (NEED-2445)
|
|
268
|
-
* line does neither.
|
|
272
|
+
* A number two people have joins them (NEED-2445), and so does one each source has once (BUG-774); one that more
|
|
273
|
+
* share proposes. A company's line does neither. A proposal still open for the pair never keeps it from joining
|
|
274
|
+
* (BUG-775): the join settles it.
|
|
269
275
|
*/
|
|
270
276
|
const samePhone = (pass, phone, holders) => {
|
|
271
277
|
const people = peopleOf(pass.context, holders);
|
|
@@ -273,11 +279,12 @@ const samePhone = (pass, phone, holders) => {
|
|
|
273
279
|
return;
|
|
274
280
|
if (sharedLine(pass.context, holders))
|
|
275
281
|
return skipShared(pass, people, "phone");
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
282
|
+
if (!(people.size === 2 || oneHolderPerSource(holders)) || !phonePairJoins(phone, holders))
|
|
283
|
+
return proposeEachPair(pass, people, "phone");
|
|
284
|
+
const [first, ...rest] = [...people.keys()].sort((a, b) => a - b);
|
|
285
|
+
let into = first;
|
|
286
|
+
for (const from of rest)
|
|
287
|
+
into = join(pass, { from, into, identity: people.get(from), with: people.get(into) }, "phone");
|
|
281
288
|
};
|
|
282
289
|
const nameOf = ({ database }, person) => {
|
|
283
290
|
const name = database.prepare("SELECT name FROM persons WHERE id = ?").get(person)?.name;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.680.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",
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
"@types/pngjs": "6.0.5",
|
|
301
301
|
"@types/ssh2": "1.15.5",
|
|
302
302
|
"@vitest/coverage-v8": "^5.0.5",
|
|
303
|
-
"@wirecat/cli-base": "0.
|
|
303
|
+
"@wirecat/cli-base": "0.106.0",
|
|
304
304
|
"@wirecat/cli-core-legacy-tags": "npm:@wirecat/cli-core@0.414.0",
|
|
305
305
|
"ajv": "8.17.1",
|
|
306
306
|
"commander": "15.0.0",
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
},
|
|
325
325
|
"peerDependencies": {
|
|
326
326
|
"@napi-rs/canvas": ">=0.1.69 <2",
|
|
327
|
-
"@wirecat/cli-base": ">=0.
|
|
327
|
+
"@wirecat/cli-base": ">=0.106.0 <1.0.0",
|
|
328
328
|
"commander": ">=15",
|
|
329
329
|
"mysql2": "^3.24.6",
|
|
330
330
|
"pg": "^8.23.1",
|