@wirecat/wirecat 0.0.0-stage → 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/LICENSE +204 -0
- package/README.md +399 -2
- package/THIRD_PARTY_NOTICES +2 -0
- package/contracts/wirecat.json +4612 -0
- package/dist/actions/actions.js +269 -0
- package/dist/actions/command.js +102 -0
- package/dist/agents/command.js +17 -0
- package/dist/agents/log.js +23 -0
- package/dist/answer.js +100 -0
- package/dist/answers/command.js +128 -0
- package/dist/app.js +15 -0
- package/dist/author.js +109 -0
- package/dist/bin/wcat-wirecat.js +40 -0
- package/dist/bots/command.js +175 -0
- package/dist/bundle/auto-O24ISPOI.js +43 -0
- package/dist/bundle/chunk-2A3YPENI.js +31 -0
- package/dist/bundle/chunk-6BDIFKF5.js +222 -0
- package/dist/bundle/chunk-7O7XM37N.js +2 -0
- package/dist/bundle/chunk-AYHZY24E.js +120 -0
- package/dist/bundle/chunk-CKBTMZUX.js +72 -0
- package/dist/bundle/chunk-FGXUH3XL.js +416 -0
- package/dist/bundle/chunk-I5JQBRRC.js +807 -0
- package/dist/bundle/chunk-RKVAWMZT.js +38 -0
- package/dist/bundle/chunk-SCDNOUUR.js +395 -0
- package/dist/bundle/chunk-T7TG4JKR.js +312 -0
- package/dist/bundle/chunk-XBUCXQKT.js +51 -0
- package/dist/bundle/entry-EW5A7FYV.js +64 -0
- package/dist/bundle/failure-HMELJ3K5.js +19 -0
- package/dist/bundle/from-memo-F7NTUXAR.js +314 -0
- package/dist/bundle/program-7XWGFN4H.js +14994 -0
- package/dist/bundle/server-T7RVBNRW.js +303 -0
- package/dist/bundle/update-JZDS7B6L.js +22 -0
- package/dist/bundle/wcat-wirecat.js +83 -0
- package/dist/config-command.js +39 -0
- package/dist/config-issues.js +15 -0
- package/dist/config.js +187 -0
- package/dist/context/command.js +162 -0
- package/dist/context/context.js +197 -0
- package/dist/contract-overrides/commands.js +81 -0
- package/dist/contract-overrides/mcp.js +241 -0
- package/dist/contract-overrides/meetings.js +344 -0
- package/dist/contract-overrides/search.js +508 -0
- package/dist/contract-overrides/skill.js +85 -0
- package/dist/contract-overrides.js +7 -0
- package/dist/digest/backfill.js +175 -0
- package/dist/digest/brief.js +189 -0
- package/dist/digest/catch-up-record.js +30 -0
- package/dist/digest/catch-up.js +86 -0
- package/dist/digest/command.js +110 -0
- package/dist/digest/digest-commands.js +327 -0
- package/dist/digest/digest.js +560 -0
- package/dist/digest/digests.js +213 -0
- package/dist/digest/history.js +202 -0
- package/dist/digest/input.js +30 -0
- package/dist/digest/known.js +28 -0
- package/dist/digest/sources.js +155 -0
- package/dist/digest/sync-health.js +158 -0
- package/dist/digest/task-proposals.js +67 -0
- package/dist/digest/tasks.js +145 -0
- package/dist/digest/text.js +49 -0
- package/dist/discovery/command.js +107 -0
- package/dist/doctor/command.js +167 -0
- package/dist/documents/command.js +107 -0
- package/dist/domain-lists/command.js +13 -0
- package/dist/events/command.js +35 -0
- package/dist/events/events.js +196 -0
- package/dist/examples.js +609 -0
- package/dist/facts/command.js +100 -0
- package/dist/facts/fact.js +54 -0
- package/dist/facts/facts.js +15 -0
- package/dist/failure.js +58 -0
- package/dist/finance/command.js +121 -0
- package/dist/finance/contracts-command.js +109 -0
- package/dist/finance/deal-text.js +34 -0
- package/dist/finance/deals-command.js +346 -0
- package/dist/finance/finance.js +129 -0
- package/dist/finance/lines-command.js +70 -0
- package/dist/finance/orders-command.js +94 -0
- package/dist/finance/products-command.js +98 -0
- package/dist/finance/subscriptions-command.js +152 -0
- package/dist/finance/transactions-command.js +136 -0
- package/dist/finance/wallets-command.js +105 -0
- package/dist/finance/written.js +36 -0
- package/dist/findings/command.js +102 -0
- package/dist/findings-input.js +23 -0
- package/dist/identity.js +20 -0
- package/dist/install/postinstall.js +47 -0
- package/dist/json-fields.js +48 -0
- package/dist/knowledge/business-text.js +19 -0
- package/dist/knowledge/command.js +435 -0
- package/dist/knowledge/document-context.js +33 -0
- package/dist/knowledge/key-documents.js +120 -0
- package/dist/knowledge/list-queries.js +20 -0
- package/dist/knowledge/meeting-projects-command.js +61 -0
- package/dist/knowledge/messenger-sync.js +253 -0
- package/dist/knowledge/money-text.js +16 -0
- package/dist/knowledge/notes-about.js +81 -0
- package/dist/knowledge/organization-delete-command.js +44 -0
- package/dist/knowledge/organization-text.js +27 -0
- package/dist/knowledge/project-actions-command.js +130 -0
- package/dist/knowledge/project-actions.js +104 -0
- package/dist/knowledge/project-activity-command.js +70 -0
- package/dist/knowledge/project-context.js +101 -0
- package/dist/knowledge/project-findings.js +41 -0
- package/dist/knowledge/project-gather-command.js +100 -0
- package/dist/knowledge/project-status-command.js +129 -0
- package/dist/knowledge/project-transfer-command.js +58 -0
- package/dist/knowledge/project-transfer.js +107 -0
- package/dist/knowledge/relationships-scan.js +116 -0
- package/dist/knowledge/relationships.js +115 -0
- package/dist/knowledge/roles-command.js +67 -0
- package/dist/mail/command.js +20 -0
- package/dist/mail/findings-command.js +143 -0
- package/dist/mail/findings-duplicates.js +159 -0
- package/dist/mail/messages-command.js +77 -0
- package/dist/mail/review-command.js +59 -0
- package/dist/mail/subscriptions-command.js +84 -0
- package/dist/mcp/catalogue.js +159 -0
- package/dist/mcp/command.js +125 -0
- package/dist/mcp/granted.js +18 -0
- package/dist/mcp/permissions.js +61 -0
- package/dist/mcp/server.js +128 -0
- package/dist/meetings/command.js +31 -0
- package/dist/meetings/list-command.js +59 -0
- package/dist/meetings/preparation-command.js +42 -0
- package/dist/meetings/preparation-text.js +44 -0
- package/dist/meetings/preparation.js +50 -0
- package/dist/meetings/read.js +32 -0
- package/dist/memories/command.js +105 -0
- package/dist/memories/memories.js +17 -0
- package/dist/memories/memory.js +89 -0
- package/dist/memories/sources.js +111 -0
- package/dist/mentions/command.js +91 -0
- package/dist/migrate/check.js +48 -0
- package/dist/migrate/from-memo.js +345 -0
- package/dist/migrate/skill.js +35 -0
- package/dist/models/command.js +19 -0
- package/dist/options.js +35 -0
- package/dist/output.js +17 -0
- package/dist/page.js +14 -0
- package/dist/people/command.js +144 -0
- package/dist/people/delete-command.js +53 -0
- package/dist/people/doubts-command.js +81 -0
- package/dist/people/identities-command.js +188 -0
- package/dist/people/identity.js +42 -0
- package/dist/people/owner.js +14 -0
- package/dist/people/proposal-rows.js +70 -0
- package/dist/people/proposals-command.js +248 -0
- package/dist/people/review-context.js +108 -0
- package/dist/people/subject.js +19 -0
- package/dist/program.js +875 -0
- package/dist/read-only.js +51 -0
- package/dist/reasons.js +368 -0
- package/dist/records/import.js +135 -0
- package/dist/records/input.js +210 -0
- package/dist/records/mapping.js +80 -0
- package/dist/records/record-commands.js +125 -0
- package/dist/records/sources.js +73 -0
- package/dist/refs.js +28 -0
- package/dist/review/command.js +171 -0
- package/dist/review/kinds.js +44 -0
- package/dist/review/review.js +299 -0
- package/dist/review/status.js +93 -0
- package/dist/rows.js +219 -0
- package/dist/run/auto.js +237 -0
- package/dist/run/entry.js +62 -0
- package/dist/run/files.js +51 -0
- package/dist/run/import.js +253 -0
- package/dist/run/lock.js +20 -0
- package/dist/save-help.js +3 -0
- package/dist/schedule/command.js +58 -0
- package/dist/schedule/mail-triage-input.js +152 -0
- package/dist/schedule/task-triage-input.js +152 -0
- package/dist/search/answers.js +176 -0
- package/dist/search/command.js +257 -0
- package/dist/search/denied.js +9 -0
- package/dist/search/embed.js +126 -0
- package/dist/search/hits.js +4 -0
- package/dist/search/lane-gates.js +76 -0
- package/dist/search/notes-text.js +18 -0
- package/dist/search/people.js +88 -0
- package/dist/search/search.js +306 -0
- package/dist/show/command.js +179 -0
- package/dist/store/crm-viewer.js +102 -0
- package/dist/store/group.js +112 -0
- package/dist/store/groups-command.js +136 -0
- package/dist/store/guard.js +94 -0
- package/dist/store/held.js +21 -0
- package/dist/store/info-command.js +37 -0
- package/dist/store/scope.js +53 -0
- package/dist/store/source-list.js +222 -0
- package/dist/store/source-target.js +28 -0
- package/dist/tags/command.js +176 -0
- package/dist/tasks/command.js +174 -0
- package/dist/tasks/context.js +74 -0
- package/dist/tasks/list.js +199 -0
- package/dist/tasks/proposal-duplicates.js +70 -0
- package/dist/tasks/relations-command.js +28 -0
- package/dist/tasks/shared.js +105 -0
- package/dist/tasks/tasks.js +197 -0
- package/dist/templates/command.js +18 -0
- package/dist/terminal.js +23 -0
- package/dist/update.js +35 -0
- package/dist/version.js +2 -0
- package/dist/vocabulary/command.js +103 -0
- package/dist/vocabulary/inspect.js +23 -0
- package/dist/vocabulary/inspection.js +18 -0
- package/dist/vocabulary/list.js +18 -0
- package/dist/vocabulary/project.js +19 -0
- package/dist/wcat.js +3 -0
- package/install/postinstall.mjs +9 -0
- package/package.json +89 -4
- package/scenarios/decision-trail.md +21 -0
- package/scenarios/person-brief.md +35 -0
- package/scenarios/prepare-meeting.md +17 -0
- package/scenarios/project-state.md +26 -0
- package/scenarios/set-up.md +18 -0
- package/scenarios/start-the-day.md +19 -0
- package/skills/mail-triage/SKILL.md +208 -0
- package/skills/morning-digest/SKILL.md +147 -0
- package/skills/task-triage/SKILL.md +79 -0
- package/skills/wcat/SKILL.md +65 -0
- package/skills/wcat/topics/mail.md +32 -0
- package/skills/wcat/topics/mcp.md +22 -0
- package/skills/wcat/topics/meetings.md +37 -0
- package/skills/wcat/topics/money.md +52 -0
- package/skills/wcat/topics/projects.md +54 -0
- package/skills/wcat/topics/proposals.md +113 -0
- package/skills/wcat/topics/search.md +85 -0
- package/skills/wcat/topics/vocabulary.md +8 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { canonicalPersonContext, } from "@wirecat/cli-core";
|
|
2
|
+
import { crmViewingAll } from "../store/crm-viewer.js";
|
|
3
|
+
import { groupScopeOf } from "../store/group.js";
|
|
4
|
+
const SIZE = { brief: { last: 2, business: 3, text: 120 }, full: { last: 6, business: 10, text: 400 } };
|
|
5
|
+
const WEAK_WORDS = {
|
|
6
|
+
landline: "the number is a landline, anyone's at that office",
|
|
7
|
+
shared: "more people have it",
|
|
8
|
+
company: "it is a company's line or mailbox",
|
|
9
|
+
"role-address": "it is a role address such as info@",
|
|
10
|
+
"no-reply": "it is a no-reply address",
|
|
11
|
+
"one-source": "only one source gives it",
|
|
12
|
+
"not-own-number": "only a CRM or a card gives the number, which is someone's word",
|
|
13
|
+
"nothing-shared": "they share no phone or address: a name or the agent's word alone",
|
|
14
|
+
owner: "one of them is you",
|
|
15
|
+
rejected: "you turned this pair down before",
|
|
16
|
+
"propose-only": "agent_merges is propose",
|
|
17
|
+
};
|
|
18
|
+
/** Why a match is not strong enough for an agent to merge, in words. */
|
|
19
|
+
export const weakText = (evidence) => {
|
|
20
|
+
const [fact] = evidence.facts;
|
|
21
|
+
const why = WEAK_WORDS[evidence.weak ?? ""] ?? evidence.weak ?? "not strong";
|
|
22
|
+
return fact && evidence.weak !== "nothing-shared" ? `${fact.kind} ${fact.value}: ${why}` : why;
|
|
23
|
+
};
|
|
24
|
+
export const strongText = (evidence) => {
|
|
25
|
+
const fact = evidence.facts.find(({ strong }) => strong);
|
|
26
|
+
return fact ? `${fact.kind} ${fact.value} (${fact.holders.flat().join(", ")})` : "strong evidence";
|
|
27
|
+
};
|
|
28
|
+
/** A side of a match as the owner compares it: who they are, where from, the last contact, and their business. */
|
|
29
|
+
export const sideOf = async (store, env, person, detail, deniedKinds) => {
|
|
30
|
+
const size = SIZE[detail];
|
|
31
|
+
const scope = await groupScopeOf(store, env);
|
|
32
|
+
const context = await canonicalPersonContext(store, person, {
|
|
33
|
+
messages: size.last,
|
|
34
|
+
limit: size.business,
|
|
35
|
+
deniedKinds,
|
|
36
|
+
viewing: await crmViewingAll(store),
|
|
37
|
+
...(scope === undefined ? {} : { accounts: scope.accounts }),
|
|
38
|
+
});
|
|
39
|
+
const record = context.person;
|
|
40
|
+
const cut = (text) => (text === null ? null : text.replace(/\s+/g, " ").trim().slice(0, size.text));
|
|
41
|
+
const messages = [...context.recent.direct, ...context.recent.groups].map((message) => ({
|
|
42
|
+
at: message.timestamp,
|
|
43
|
+
kind: "message",
|
|
44
|
+
source: message.provider,
|
|
45
|
+
chat: message.chatTitle,
|
|
46
|
+
from_me: message.outgoing,
|
|
47
|
+
text: cut(message.text),
|
|
48
|
+
ref: message.locator,
|
|
49
|
+
}));
|
|
50
|
+
const meetings = context.meetings.map((meeting) => ({
|
|
51
|
+
at: meeting.startedAt,
|
|
52
|
+
kind: meeting.call ? "call" : "meeting",
|
|
53
|
+
source: meeting.account.provider,
|
|
54
|
+
chat: null,
|
|
55
|
+
from_me: null,
|
|
56
|
+
text: cut(meeting.title),
|
|
57
|
+
ref: meeting.ref,
|
|
58
|
+
}));
|
|
59
|
+
const last = [...messages, ...meetings]
|
|
60
|
+
.filter((one) => one.at !== null)
|
|
61
|
+
.sort((a, b) => b.at.localeCompare(a.at))
|
|
62
|
+
.slice(0, size.last);
|
|
63
|
+
const names = (items) => items.map(({ name, ref }) => name ?? ref);
|
|
64
|
+
return {
|
|
65
|
+
person: `person:${record.uid}`,
|
|
66
|
+
name: record.name,
|
|
67
|
+
display_name: record.displayName ?? null,
|
|
68
|
+
identities: record.identities.map((identity) => ({
|
|
69
|
+
identity: `${identity.provider}:${identity.id}`,
|
|
70
|
+
source: identity.provider,
|
|
71
|
+
name: identity.name,
|
|
72
|
+
...(detail === "full"
|
|
73
|
+
? {
|
|
74
|
+
username: identity.username,
|
|
75
|
+
phones: identity.phones ?? [],
|
|
76
|
+
emails: identity.emails ?? [],
|
|
77
|
+
accounts: identity.seenIn.map(({ account }) => account),
|
|
78
|
+
}
|
|
79
|
+
: {}),
|
|
80
|
+
})),
|
|
81
|
+
last,
|
|
82
|
+
organizations: names(context.business.organizations.items),
|
|
83
|
+
deals: names(context.business.deals.items),
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/** An agent's merge as the owner reviews it, with the move that undoes it. */
|
|
87
|
+
export const agentMergeAnswer = (merge) => ({
|
|
88
|
+
id: merge.id,
|
|
89
|
+
kind: "agent_merge",
|
|
90
|
+
person: `person:${merge.to}`,
|
|
91
|
+
from: `person:${merge.from}`,
|
|
92
|
+
identities: merge.identities.map(({ provider, id, name }) => ({ identity: `${provider}:${id}`, name })),
|
|
93
|
+
by: merge.agent?.bot ?? merge.by,
|
|
94
|
+
run: merge.agent?.run ?? null,
|
|
95
|
+
reason: merge.agent?.reason ?? null,
|
|
96
|
+
evidence: merge.agent?.evidence ?? null,
|
|
97
|
+
proposal: merge.agent?.proposal ?? null,
|
|
98
|
+
at: merge.at,
|
|
99
|
+
undo: `wcat people unmerge ${merge.id}`,
|
|
100
|
+
});
|
|
101
|
+
export const sideLines = (side) => [
|
|
102
|
+
` ${side.person} ${side.display_name ?? side.name ?? ""}`.trimEnd(),
|
|
103
|
+
` ${side.identities.map(({ identity, name }) => (name ? `${identity} (${name})` : identity)).join(", ")}`,
|
|
104
|
+
...side.last.map((one) => ` ${one.at?.slice(0, 16).replace("T", " ")} ${one.source} ${one.kind}: ${one.text ?? ""}`),
|
|
105
|
+
...(side.organizations.length ? [` organizations: ${side.organizations.join(", ")}`] : []),
|
|
106
|
+
...(side.deals.length ? [` deals: ${side.deals.join(", ")}`] : []),
|
|
107
|
+
];
|
|
108
|
+
//# sourceMappingURL=review-context.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { formatReference, looksLikeReference } from "@wirecat/cli-core";
|
|
2
|
+
import { identityOf } from "./identity.js";
|
|
3
|
+
import { withOwner } from "./owner.js";
|
|
4
|
+
/** A typed reference as written, or `<messenger>:<name or id>` turned into the person behind it. */
|
|
5
|
+
export const subjectOf = async (store, text) => {
|
|
6
|
+
const typed = (await withOwner(store, text)).trim();
|
|
7
|
+
if (typed.startsWith("person:")) {
|
|
8
|
+
const person = await store.people.personByUid(typed.slice("person:".length));
|
|
9
|
+
return person === undefined ? { ref: typed } : { ref: typed, person };
|
|
10
|
+
}
|
|
11
|
+
if (looksLikeReference(typed))
|
|
12
|
+
return { ref: typed };
|
|
13
|
+
const identity = await identityOf(store, text);
|
|
14
|
+
const person = await store.people.personOf(identity);
|
|
15
|
+
return person === undefined
|
|
16
|
+
? { ref: formatReference({ type: "contact", provider: identity.provider, id: identity.id }) }
|
|
17
|
+
: { ref: `person:${person.uid}`, person };
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=subject.js.map
|