@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.
Files changed (230) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +399 -2
  3. package/THIRD_PARTY_NOTICES +2 -0
  4. package/contracts/wirecat.json +4612 -0
  5. package/dist/actions/actions.js +269 -0
  6. package/dist/actions/command.js +102 -0
  7. package/dist/agents/command.js +17 -0
  8. package/dist/agents/log.js +23 -0
  9. package/dist/answer.js +100 -0
  10. package/dist/answers/command.js +128 -0
  11. package/dist/app.js +15 -0
  12. package/dist/author.js +109 -0
  13. package/dist/bin/wcat-wirecat.js +40 -0
  14. package/dist/bots/command.js +175 -0
  15. package/dist/bundle/auto-O24ISPOI.js +43 -0
  16. package/dist/bundle/chunk-2A3YPENI.js +31 -0
  17. package/dist/bundle/chunk-6BDIFKF5.js +222 -0
  18. package/dist/bundle/chunk-7O7XM37N.js +2 -0
  19. package/dist/bundle/chunk-AYHZY24E.js +120 -0
  20. package/dist/bundle/chunk-CKBTMZUX.js +72 -0
  21. package/dist/bundle/chunk-FGXUH3XL.js +416 -0
  22. package/dist/bundle/chunk-I5JQBRRC.js +807 -0
  23. package/dist/bundle/chunk-RKVAWMZT.js +38 -0
  24. package/dist/bundle/chunk-SCDNOUUR.js +395 -0
  25. package/dist/bundle/chunk-T7TG4JKR.js +312 -0
  26. package/dist/bundle/chunk-XBUCXQKT.js +51 -0
  27. package/dist/bundle/entry-EW5A7FYV.js +64 -0
  28. package/dist/bundle/failure-HMELJ3K5.js +19 -0
  29. package/dist/bundle/from-memo-F7NTUXAR.js +314 -0
  30. package/dist/bundle/program-7XWGFN4H.js +14994 -0
  31. package/dist/bundle/server-T7RVBNRW.js +303 -0
  32. package/dist/bundle/update-JZDS7B6L.js +22 -0
  33. package/dist/bundle/wcat-wirecat.js +83 -0
  34. package/dist/config-command.js +39 -0
  35. package/dist/config-issues.js +15 -0
  36. package/dist/config.js +187 -0
  37. package/dist/context/command.js +162 -0
  38. package/dist/context/context.js +197 -0
  39. package/dist/contract-overrides/commands.js +81 -0
  40. package/dist/contract-overrides/mcp.js +241 -0
  41. package/dist/contract-overrides/meetings.js +344 -0
  42. package/dist/contract-overrides/search.js +508 -0
  43. package/dist/contract-overrides/skill.js +85 -0
  44. package/dist/contract-overrides.js +7 -0
  45. package/dist/digest/backfill.js +175 -0
  46. package/dist/digest/brief.js +189 -0
  47. package/dist/digest/catch-up-record.js +30 -0
  48. package/dist/digest/catch-up.js +86 -0
  49. package/dist/digest/command.js +110 -0
  50. package/dist/digest/digest-commands.js +327 -0
  51. package/dist/digest/digest.js +560 -0
  52. package/dist/digest/digests.js +213 -0
  53. package/dist/digest/history.js +202 -0
  54. package/dist/digest/input.js +30 -0
  55. package/dist/digest/known.js +28 -0
  56. package/dist/digest/sources.js +155 -0
  57. package/dist/digest/sync-health.js +158 -0
  58. package/dist/digest/task-proposals.js +67 -0
  59. package/dist/digest/tasks.js +145 -0
  60. package/dist/digest/text.js +49 -0
  61. package/dist/discovery/command.js +107 -0
  62. package/dist/doctor/command.js +167 -0
  63. package/dist/documents/command.js +107 -0
  64. package/dist/domain-lists/command.js +13 -0
  65. package/dist/events/command.js +35 -0
  66. package/dist/events/events.js +196 -0
  67. package/dist/examples.js +609 -0
  68. package/dist/facts/command.js +100 -0
  69. package/dist/facts/fact.js +54 -0
  70. package/dist/facts/facts.js +15 -0
  71. package/dist/failure.js +58 -0
  72. package/dist/finance/command.js +121 -0
  73. package/dist/finance/contracts-command.js +109 -0
  74. package/dist/finance/deal-text.js +34 -0
  75. package/dist/finance/deals-command.js +346 -0
  76. package/dist/finance/finance.js +129 -0
  77. package/dist/finance/lines-command.js +70 -0
  78. package/dist/finance/orders-command.js +94 -0
  79. package/dist/finance/products-command.js +98 -0
  80. package/dist/finance/subscriptions-command.js +152 -0
  81. package/dist/finance/transactions-command.js +136 -0
  82. package/dist/finance/wallets-command.js +105 -0
  83. package/dist/finance/written.js +36 -0
  84. package/dist/findings/command.js +102 -0
  85. package/dist/findings-input.js +23 -0
  86. package/dist/identity.js +20 -0
  87. package/dist/install/postinstall.js +47 -0
  88. package/dist/json-fields.js +48 -0
  89. package/dist/knowledge/business-text.js +19 -0
  90. package/dist/knowledge/command.js +435 -0
  91. package/dist/knowledge/document-context.js +33 -0
  92. package/dist/knowledge/key-documents.js +120 -0
  93. package/dist/knowledge/list-queries.js +20 -0
  94. package/dist/knowledge/meeting-projects-command.js +61 -0
  95. package/dist/knowledge/messenger-sync.js +253 -0
  96. package/dist/knowledge/money-text.js +16 -0
  97. package/dist/knowledge/notes-about.js +81 -0
  98. package/dist/knowledge/organization-delete-command.js +44 -0
  99. package/dist/knowledge/organization-text.js +27 -0
  100. package/dist/knowledge/project-actions-command.js +130 -0
  101. package/dist/knowledge/project-actions.js +104 -0
  102. package/dist/knowledge/project-activity-command.js +70 -0
  103. package/dist/knowledge/project-context.js +101 -0
  104. package/dist/knowledge/project-findings.js +41 -0
  105. package/dist/knowledge/project-gather-command.js +100 -0
  106. package/dist/knowledge/project-status-command.js +129 -0
  107. package/dist/knowledge/project-transfer-command.js +58 -0
  108. package/dist/knowledge/project-transfer.js +107 -0
  109. package/dist/knowledge/relationships-scan.js +116 -0
  110. package/dist/knowledge/relationships.js +115 -0
  111. package/dist/knowledge/roles-command.js +67 -0
  112. package/dist/mail/command.js +20 -0
  113. package/dist/mail/findings-command.js +143 -0
  114. package/dist/mail/findings-duplicates.js +159 -0
  115. package/dist/mail/messages-command.js +77 -0
  116. package/dist/mail/review-command.js +59 -0
  117. package/dist/mail/subscriptions-command.js +84 -0
  118. package/dist/mcp/catalogue.js +159 -0
  119. package/dist/mcp/command.js +125 -0
  120. package/dist/mcp/granted.js +18 -0
  121. package/dist/mcp/permissions.js +61 -0
  122. package/dist/mcp/server.js +128 -0
  123. package/dist/meetings/command.js +31 -0
  124. package/dist/meetings/list-command.js +59 -0
  125. package/dist/meetings/preparation-command.js +42 -0
  126. package/dist/meetings/preparation-text.js +44 -0
  127. package/dist/meetings/preparation.js +50 -0
  128. package/dist/meetings/read.js +32 -0
  129. package/dist/memories/command.js +105 -0
  130. package/dist/memories/memories.js +17 -0
  131. package/dist/memories/memory.js +89 -0
  132. package/dist/memories/sources.js +111 -0
  133. package/dist/mentions/command.js +91 -0
  134. package/dist/migrate/check.js +48 -0
  135. package/dist/migrate/from-memo.js +345 -0
  136. package/dist/migrate/skill.js +35 -0
  137. package/dist/models/command.js +19 -0
  138. package/dist/options.js +35 -0
  139. package/dist/output.js +17 -0
  140. package/dist/page.js +14 -0
  141. package/dist/people/command.js +144 -0
  142. package/dist/people/delete-command.js +53 -0
  143. package/dist/people/doubts-command.js +81 -0
  144. package/dist/people/identities-command.js +188 -0
  145. package/dist/people/identity.js +42 -0
  146. package/dist/people/owner.js +14 -0
  147. package/dist/people/proposal-rows.js +70 -0
  148. package/dist/people/proposals-command.js +248 -0
  149. package/dist/people/review-context.js +108 -0
  150. package/dist/people/subject.js +19 -0
  151. package/dist/program.js +875 -0
  152. package/dist/read-only.js +51 -0
  153. package/dist/reasons.js +368 -0
  154. package/dist/records/import.js +135 -0
  155. package/dist/records/input.js +210 -0
  156. package/dist/records/mapping.js +80 -0
  157. package/dist/records/record-commands.js +125 -0
  158. package/dist/records/sources.js +73 -0
  159. package/dist/refs.js +28 -0
  160. package/dist/review/command.js +171 -0
  161. package/dist/review/kinds.js +44 -0
  162. package/dist/review/review.js +299 -0
  163. package/dist/review/status.js +93 -0
  164. package/dist/rows.js +219 -0
  165. package/dist/run/auto.js +237 -0
  166. package/dist/run/entry.js +62 -0
  167. package/dist/run/files.js +51 -0
  168. package/dist/run/import.js +253 -0
  169. package/dist/run/lock.js +20 -0
  170. package/dist/save-help.js +3 -0
  171. package/dist/schedule/command.js +58 -0
  172. package/dist/schedule/mail-triage-input.js +152 -0
  173. package/dist/schedule/task-triage-input.js +152 -0
  174. package/dist/search/answers.js +176 -0
  175. package/dist/search/command.js +257 -0
  176. package/dist/search/denied.js +9 -0
  177. package/dist/search/embed.js +126 -0
  178. package/dist/search/hits.js +4 -0
  179. package/dist/search/lane-gates.js +76 -0
  180. package/dist/search/notes-text.js +18 -0
  181. package/dist/search/people.js +88 -0
  182. package/dist/search/search.js +306 -0
  183. package/dist/show/command.js +179 -0
  184. package/dist/store/crm-viewer.js +102 -0
  185. package/dist/store/group.js +112 -0
  186. package/dist/store/groups-command.js +136 -0
  187. package/dist/store/guard.js +94 -0
  188. package/dist/store/held.js +21 -0
  189. package/dist/store/info-command.js +37 -0
  190. package/dist/store/scope.js +53 -0
  191. package/dist/store/source-list.js +222 -0
  192. package/dist/store/source-target.js +28 -0
  193. package/dist/tags/command.js +176 -0
  194. package/dist/tasks/command.js +174 -0
  195. package/dist/tasks/context.js +74 -0
  196. package/dist/tasks/list.js +199 -0
  197. package/dist/tasks/proposal-duplicates.js +70 -0
  198. package/dist/tasks/relations-command.js +28 -0
  199. package/dist/tasks/shared.js +105 -0
  200. package/dist/tasks/tasks.js +197 -0
  201. package/dist/templates/command.js +18 -0
  202. package/dist/terminal.js +23 -0
  203. package/dist/update.js +35 -0
  204. package/dist/version.js +2 -0
  205. package/dist/vocabulary/command.js +103 -0
  206. package/dist/vocabulary/inspect.js +23 -0
  207. package/dist/vocabulary/inspection.js +18 -0
  208. package/dist/vocabulary/list.js +18 -0
  209. package/dist/vocabulary/project.js +19 -0
  210. package/dist/wcat.js +3 -0
  211. package/install/postinstall.mjs +9 -0
  212. package/package.json +89 -4
  213. package/scenarios/decision-trail.md +21 -0
  214. package/scenarios/person-brief.md +35 -0
  215. package/scenarios/prepare-meeting.md +17 -0
  216. package/scenarios/project-state.md +26 -0
  217. package/scenarios/set-up.md +18 -0
  218. package/scenarios/start-the-day.md +19 -0
  219. package/skills/mail-triage/SKILL.md +208 -0
  220. package/skills/morning-digest/SKILL.md +147 -0
  221. package/skills/task-triage/SKILL.md +79 -0
  222. package/skills/wcat/SKILL.md +65 -0
  223. package/skills/wcat/topics/mail.md +32 -0
  224. package/skills/wcat/topics/mcp.md +22 -0
  225. package/skills/wcat/topics/meetings.md +37 -0
  226. package/skills/wcat/topics/money.md +52 -0
  227. package/skills/wcat/topics/projects.md +54 -0
  228. package/skills/wcat/topics/proposals.md +113 -0
  229. package/skills/wcat/topics/search.md +85 -0
  230. 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