@wirecat/cli-core 0.617.0 → 0.619.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 (306) hide show
  1. package/CHANGELOG.md +406 -1
  2. package/README.md +1 -1
  3. package/THIRD_PARTY_NOTICES +3 -0
  4. package/dist/background/backfill.d.ts +21 -0
  5. package/dist/background/backfill.js +41 -0
  6. package/dist/background/daily-archive-timer.d.ts +1 -1
  7. package/dist/background/deliver.d.ts +5 -2
  8. package/dist/background/deliver.js +30 -12
  9. package/dist/background/report/messages.js +4 -1
  10. package/dist/background/report/render.d.ts +3 -1
  11. package/dist/background/report/render.js +3 -1
  12. package/dist/background/report/view.js +4 -1
  13. package/dist/background/schedules.d.ts +17 -0
  14. package/dist/background/schedules.js +21 -8
  15. package/dist/calendar/cli/answers.d.ts +1 -0
  16. package/dist/calendar/cli/answers.js +6 -1
  17. package/dist/calendar/cli/index.js +2 -14
  18. package/dist/calendar/cli/people-link.d.ts +3 -0
  19. package/dist/calendar/cli/people-link.js +23 -0
  20. package/dist/calendar/index.d.ts +1 -1
  21. package/dist/calendar/index.js +1 -1
  22. package/dist/calendar/mcp/index.d.ts +12 -12
  23. package/dist/cli/base-stages-command.d.ts +22 -0
  24. package/dist/cli/base-stages-command.js +174 -0
  25. package/dist/cli/command-runs.d.ts +2 -0
  26. package/dist/cli/command-runs.js +3 -1
  27. package/dist/cli/config-command.js +6 -1
  28. package/dist/cli/context.d.ts +5 -0
  29. package/dist/cli/context.js +1 -0
  30. package/dist/cli/group-lock.d.ts +42 -0
  31. package/dist/cli/group-lock.js +130 -0
  32. package/dist/cli/index.d.ts +10 -4
  33. package/dist/cli/index.js +10 -4
  34. package/dist/cli/messenger/backfill-command.js +27 -15
  35. package/dist/cli/messenger/contacts-command.js +10 -3
  36. package/dist/cli/messenger/context.js +1 -0
  37. package/dist/cli/messenger/doctor-command.js +3 -1
  38. package/dist/cli/messenger/models-command.js +1 -1
  39. package/dist/cli/messenger/serve-command.js +24 -2
  40. package/dist/cli/messenger/serve-outdated.d.ts +22 -0
  41. package/dist/cli/messenger/serve-outdated.js +100 -0
  42. package/dist/cli/messenger/store-maintenance-command.d.ts +22 -2
  43. package/dist/cli/messenger/store-maintenance-command.js +9 -4
  44. package/dist/cli/model-catalogue-command.d.ts +3 -1
  45. package/dist/cli/model-catalogue-command.js +46 -2
  46. package/dist/cli/profile.d.ts +8 -0
  47. package/dist/cli/profile.js +25 -0
  48. package/dist/cli/program.js +2 -0
  49. package/dist/cli/runs/search-query.d.ts +1 -1
  50. package/dist/cli/runs/search-query.js +4 -0
  51. package/dist/cli/runs/search.d.ts +5 -1
  52. package/dist/cli/runs/search.js +12 -1
  53. package/dist/cli/schedule/schedule-command.d.ts +9 -0
  54. package/dist/cli/schedule/schedule-command.js +13 -0
  55. package/dist/cli/search-left-out.d.ts +6 -1
  56. package/dist/cli/search-left-out.js +9 -4
  57. package/dist/cli/settings.d.ts +8 -0
  58. package/dist/cli/settings.js +17 -2
  59. package/dist/cli/shared-command-exports.d.ts +16 -0
  60. package/dist/cli/store-recover.d.ts +3 -3
  61. package/dist/cli/store-recover.js +47 -23
  62. package/dist/cli/store-settings.d.ts +2 -0
  63. package/dist/cli/store-settings.js +37 -9
  64. package/dist/crm/cli/index.js +38 -6
  65. package/dist/crm/group-hint.d.ts +8 -0
  66. package/dist/crm/group-hint.js +13 -0
  67. package/dist/crm/source.d.ts +12 -1
  68. package/dist/crm/sync.d.ts +31 -2
  69. package/dist/crm/sync.js +110 -3
  70. package/dist/crm/testing/acme-scenario.d.ts +40 -0
  71. package/dist/crm/testing/acme-scenario.js +170 -0
  72. package/dist/crm/testing/index.d.ts +1 -0
  73. package/dist/crm/testing/index.js +1 -0
  74. package/dist/crm/testing/source-contract.js +12 -0
  75. package/dist/crm/testing/source.d.ts +2 -0
  76. package/dist/crm/testing/source.js +1 -0
  77. package/dist/domain/addresses.d.ts +13 -0
  78. package/dist/domain/addresses.js +63 -0
  79. package/dist/domain/categories.d.ts +3 -0
  80. package/dist/domain/categories.js +2 -0
  81. package/dist/domain/crm.d.ts +23 -0
  82. package/dist/domain/crm.js +7 -0
  83. package/dist/domain/links.d.ts +17 -4
  84. package/dist/domain/links.js +20 -7
  85. package/dist/domain/mentions.d.ts +2 -12
  86. package/dist/domain/mentions.js +2 -19
  87. package/dist/domain/orders.d.ts +8 -1
  88. package/dist/domain/orders.js +6 -2
  89. package/dist/domain/phones.d.ts +26 -0
  90. package/dist/domain/phones.js +48 -0
  91. package/dist/domain/record-types.d.ts +1 -1
  92. package/dist/domain/record-types.js +1 -0
  93. package/dist/domain/records.d.ts +5 -0
  94. package/dist/domain/ref-summaries.d.ts +39 -0
  95. package/dist/domain/ref-summaries.js +51 -3
  96. package/dist/domain/relations.d.ts +27 -2
  97. package/dist/domain/relations.js +37 -3
  98. package/dist/domain/vcard.d.ts +2 -2
  99. package/dist/domain/vcard.js +4 -10
  100. package/dist/embeddings/models.d.ts +11 -3
  101. package/dist/embeddings/models.js +28 -4
  102. package/dist/entities/business-context.d.ts +149 -0
  103. package/dist/entities/business-context.js +192 -0
  104. package/dist/entities/contact-activity.d.ts +2 -0
  105. package/dist/entities/contact-activity.js +7 -1
  106. package/dist/entities/contact-context.d.ts +157 -0
  107. package/dist/entities/contact-context.js +2 -0
  108. package/dist/entities/deal.d.ts +10 -0
  109. package/dist/entities/deal.js +2 -0
  110. package/dist/entities/index.d.ts +23 -3
  111. package/dist/entities/index.js +5 -0
  112. package/dist/entities/mention.d.ts +4 -3
  113. package/dist/entities/mention.js +2 -1
  114. package/dist/entities/message-transfer.d.ts +4 -2
  115. package/dist/entities/message-transfer.js +2 -2
  116. package/dist/entities/model.d.ts +2 -2
  117. package/dist/entities/model.js +1 -1
  118. package/dist/entities/relationship.d.ts +4 -0
  119. package/dist/entities/relationship.js +4 -0
  120. package/dist/errors/reasons.js +44 -4
  121. package/dist/fetch/page.js +2 -1
  122. package/dist/index.d.ts +4 -3
  123. package/dist/index.js +4 -3
  124. package/dist/meetings/context-store.d.ts +2 -0
  125. package/dist/meetings/findings-rules.d.ts +4 -0
  126. package/dist/meetings/findings-rules.js +5 -2
  127. package/dist/meetings/mcp/index.d.ts +15 -15
  128. package/dist/meetings/result-items.d.ts +1 -0
  129. package/dist/meetings/result-items.js +1 -0
  130. package/dist/models/index.js +22 -5
  131. package/dist/runs/events.d.ts +11 -1
  132. package/dist/runs/events.js +3 -1
  133. package/dist/runs/log-attributes.js +4 -0
  134. package/dist/runs/log-events.js +2 -0
  135. package/dist/runs/recording.d.ts +3 -0
  136. package/dist/runs/recording.js +36 -12
  137. package/dist/runs/run.d.ts +12 -3
  138. package/dist/runs/run.js +32 -13
  139. package/dist/search/account-list.d.ts +6 -0
  140. package/dist/search/account-list.js +9 -3
  141. package/dist/search/groups.d.ts +68 -0
  142. package/dist/search/groups.js +172 -0
  143. package/dist/services/account-groups.d.ts +28 -0
  144. package/dist/services/account-groups.js +89 -0
  145. package/dist/services/archive.d.ts +7 -1
  146. package/dist/services/archive.js +19 -3
  147. package/dist/services/business-context.d.ts +113 -0
  148. package/dist/services/business-context.js +156 -0
  149. package/dist/services/communications.d.ts +50 -0
  150. package/dist/services/communications.js +140 -0
  151. package/dist/services/deal-context.d.ts +90 -0
  152. package/dist/services/deal-context.js +131 -0
  153. package/dist/services/deps.d.ts +2 -0
  154. package/dist/services/enrichment.d.ts +7 -2
  155. package/dist/services/enrichment.js +46 -5
  156. package/dist/services/events-search.js +2 -1
  157. package/dist/services/group-guard.d.ts +28 -0
  158. package/dist/services/group-guard.js +131 -0
  159. package/dist/services/index.d.ts +15 -2
  160. package/dist/services/index.js +9 -2
  161. package/dist/services/ingest.d.ts +12 -0
  162. package/dist/services/ingest.js +4 -0
  163. package/dist/services/link-scorers/chat-senders.js +39 -29
  164. package/dist/services/link-scorers/member-chats.js +4 -3
  165. package/dist/services/link-scorers/member-dialog.js +5 -7
  166. package/dist/services/link-scorers/scan.js +17 -8
  167. package/dist/services/link-scorers/shared.d.ts +6 -2
  168. package/dist/services/link-scorers/shared.js +6 -2
  169. package/dist/services/link-scorers/types.d.ts +2 -0
  170. package/dist/services/meaning-model.d.ts +7 -0
  171. package/dist/services/meaning-model.js +20 -0
  172. package/dist/services/meeting-context.d.ts +6 -1
  173. package/dist/services/meeting-context.js +12 -5
  174. package/dist/services/message-resolution.js +2 -3
  175. package/dist/services/messages-meaning.js +4 -5
  176. package/dist/services/messages-search.d.ts +5 -1
  177. package/dist/services/messages-search.js +1 -1
  178. package/dist/services/model-downloads.d.ts +1 -1
  179. package/dist/services/model-downloads.js +6 -4
  180. package/dist/services/money-context.d.ts +73 -0
  181. package/dist/services/money-context.js +77 -0
  182. package/dist/services/notes-search.d.ts +4 -1
  183. package/dist/services/notes-search.js +19 -7
  184. package/dist/services/organization-context.d.ts +80 -0
  185. package/dist/services/organization-context.js +154 -0
  186. package/dist/services/people.d.ts +22 -6
  187. package/dist/services/people.js +38 -8
  188. package/dist/services/person-business.d.ts +43 -0
  189. package/dist/services/person-business.js +67 -0
  190. package/dist/services/person-context.d.ts +9 -1
  191. package/dist/services/person-context.js +5 -3
  192. package/dist/services/proposals/kinds/identity-link.d.ts +4 -0
  193. package/dist/services/proposals/kinds/identity-link.js +48 -0
  194. package/dist/services/proposals/kinds/orders.js +1 -1
  195. package/dist/services/proposals/registry.js +2 -0
  196. package/dist/services/search-kind.d.ts +12 -5
  197. package/dist/services/search-kind.js +49 -10
  198. package/dist/services/text-model-choice.js +1 -1
  199. package/dist/store/accounts.d.ts +18 -0
  200. package/dist/store/accounts.js +18 -3
  201. package/dist/store/damage.d.ts +43 -10
  202. package/dist/store/damage.js +119 -36
  203. package/dist/store/decisions.js +3 -1
  204. package/dist/store/evidence-findings.d.ts +14 -0
  205. package/dist/store/evidence-findings.js +2 -0
  206. package/dist/store/exports.d.ts +2 -1
  207. package/dist/store/identity-links.d.ts +92 -0
  208. package/dist/store/identity-links.js +6 -0
  209. package/dist/store/index.d.ts +11 -5
  210. package/dist/store/index.js +5 -2
  211. package/dist/store/journal.d.ts +10 -0
  212. package/dist/store/journal.js +33 -0
  213. package/dist/store/marks.d.ts +19 -1
  214. package/dist/store/marks.js +23 -1
  215. package/dist/store/migrations.d.ts +1 -1
  216. package/dist/store/migrations.js +35 -12
  217. package/dist/store/people.d.ts +22 -0
  218. package/dist/store/people.js +15 -1
  219. package/dist/store/recover.d.ts +34 -0
  220. package/dist/store/recover.js +188 -6
  221. package/dist/store/refill.d.ts +28 -0
  222. package/dist/store/refill.js +120 -0
  223. package/dist/store/sqlite/accounts.js +2 -0
  224. package/dist/store/sqlite/base-stages.d.ts +122 -0
  225. package/dist/store/sqlite/base-stages.js +443 -0
  226. package/dist/store/sqlite/base-suggest.d.ts +13 -0
  227. package/dist/store/sqlite/base-suggest.js +62 -0
  228. package/dist/store/sqlite/business-contracts.js +10 -1
  229. package/dist/store/sqlite/clients.d.ts +7 -3
  230. package/dist/store/sqlite/clients.js +11 -7
  231. package/dist/store/sqlite/crm-settings.d.ts +12 -2
  232. package/dist/store/sqlite/crm-settings.js +56 -13
  233. package/dist/store/sqlite/crm.d.ts +13 -1
  234. package/dist/store/sqlite/crm.js +20 -4
  235. package/dist/store/sqlite/deals.d.ts +33 -0
  236. package/dist/store/sqlite/deals.js +42 -4
  237. package/dist/store/sqlite/decision-requests.js +7 -3
  238. package/dist/store/sqlite/email-index.js +17 -15
  239. package/dist/store/sqlite/evidence-findings.js +29 -5
  240. package/dist/store/sqlite/findings-core.js +4 -2
  241. package/dist/store/sqlite/identity-link-rows.d.ts +50 -0
  242. package/dist/store/sqlite/identity-link-rows.js +146 -0
  243. package/dist/store/sqlite/identity-proposals.d.ts +53 -0
  244. package/dist/store/sqlite/identity-proposals.js +234 -0
  245. package/dist/store/sqlite/knowledge.js +5 -3
  246. package/dist/store/sqlite/link-kinds.d.ts +1 -0
  247. package/dist/store/sqlite/link-kinds.js +1 -0
  248. package/dist/store/sqlite/link-row.d.ts +6 -0
  249. package/dist/store/sqlite/link-row.js +35 -0
  250. package/dist/store/sqlite/link-source.d.ts +10 -0
  251. package/dist/store/sqlite/link-source.js +16 -0
  252. package/dist/store/sqlite/manifest.js +1 -0
  253. package/dist/store/sqlite/meeting-context-links.js +9 -6
  254. package/dist/store/sqlite/memories.js +9 -7
  255. package/dist/store/sqlite/mentions.d.ts +4 -1
  256. package/dist/store/sqlite/mentions.js +14 -9
  257. package/dist/store/sqlite/migrations.generated.js +8 -0
  258. package/dist/store/sqlite/note-index.js +9 -7
  259. package/dist/store/sqlite/notes.d.ts +2 -3
  260. package/dist/store/sqlite/notes.js +6 -29
  261. package/dist/store/sqlite/open-store.js +3 -0
  262. package/dist/store/sqlite/open.js +11 -2
  263. package/dist/store/sqlite/orders.d.ts +2 -0
  264. package/dist/store/sqlite/orders.js +9 -3
  265. package/dist/store/sqlite/organization-categories.d.ts +18 -0
  266. package/dist/store/sqlite/organization-categories.js +34 -0
  267. package/dist/store/sqlite/organizations.d.ts +5 -1
  268. package/dist/store/sqlite/organizations.js +14 -4
  269. package/dist/store/sqlite/person-links.d.ts +19 -4
  270. package/dist/store/sqlite/person-links.js +49 -11
  271. package/dist/store/sqlite/person-match-scan.d.ts +13 -0
  272. package/dist/store/sqlite/person-match-scan.js +251 -0
  273. package/dist/store/sqlite/person-matcher.d.ts +16 -0
  274. package/dist/store/sqlite/person-matcher.js +32 -0
  275. package/dist/store/sqlite/proposed-actions.js +6 -0
  276. package/dist/store/sqlite/record-matching.d.ts +2 -8
  277. package/dist/store/sqlite/record-matching.js +8 -40
  278. package/dist/store/sqlite/record-projectors-phone.js +2 -1
  279. package/dist/store/sqlite/record-relationships.d.ts +52 -0
  280. package/dist/store/sqlite/record-relationships.js +243 -0
  281. package/dist/store/sqlite/record-run.d.ts +5 -0
  282. package/dist/store/sqlite/record-run.js +62 -2
  283. package/dist/store/sqlite/record-writes.d.ts +1 -1
  284. package/dist/store/sqlite/record-writes.js +4 -2
  285. package/dist/store/sqlite/records.js +27 -2
  286. package/dist/store/sqlite/ref-accounts.d.ts +13 -0
  287. package/dist/store/sqlite/ref-accounts.js +117 -0
  288. package/dist/store/sqlite/ref-summaries.js +5 -1
  289. package/dist/store/sqlite/relation-list.d.ts +4 -1
  290. package/dist/store/sqlite/relation-list.js +20 -2
  291. package/dist/store/sqlite/relation-proposals.d.ts +18 -1
  292. package/dist/store/sqlite/relation-proposals.js +53 -11
  293. package/dist/store/sqlite/relation-roles.js +12 -6
  294. package/dist/store/sqlite/reported-relations.d.ts +11 -1
  295. package/dist/store/sqlite/reported-relations.js +59 -18
  296. package/dist/store/sqlite/schema.d.ts +32 -0
  297. package/dist/store/sqlite/schema.js +3 -0
  298. package/dist/store/sqlite/transaction.d.ts +13 -0
  299. package/dist/store/sqlite/transaction.js +33 -15
  300. package/dist/store/store.d.ts +3 -0
  301. package/dist/store/store.js +5 -0
  302. package/dist/store/write-events.d.ts +18 -0
  303. package/dist/store/write-events.js +88 -0
  304. package/package.json +3 -3
  305. package/parity.json +11 -4
  306. package/schemas/records-envelope.v1.schema.json +3 -0
@@ -95,6 +95,7 @@ export const RECORD_TYPES = {
95
95
  name: kept("The person's name"),
96
96
  email: kept("E-mail addresses, one or a list: an exact one links the record to the one person who has it"),
97
97
  phone: kept("Phone numbers, one or a list: an exact one, read to E.164, links like an e-mail"),
98
+ position: kept("The job title, kept beside each member-of as its position: never the role"),
98
99
  }),
99
100
  roles: { "member-of": { targets: ORGANIZATION, relationship: "member-of", kept: true } },
100
101
  },
@@ -53,6 +53,11 @@ export interface IngestError {
53
53
  code: string;
54
54
  message: string;
55
55
  key?: string;
56
+ /** The record an entry is about when it is not in this envelope: one of an earlier batch. */
57
+ record?: {
58
+ type: string;
59
+ externalId: string;
60
+ };
56
61
  }
57
62
  /** The v1 envelope as JSON Schema (Draft 2020-12); `schemas/records-envelope.v1.schema.json` is this, written out. */
58
63
  export declare const RECORDS_ENVELOPE_SCHEMA: {
@@ -1,3 +1,5 @@
1
+ import type { Profiles } from "../search/account-list.js";
2
+ import type { AccountKey } from "../store/types.js";
1
3
  import type { RefKindName } from "./references.js";
2
4
  export type RefState = "available" | "deleted" | "unavailable";
3
5
  /** A message or chat of the `email` provider is mail, so it reads as `email` and `email_thread`. */
@@ -27,6 +29,22 @@ export interface RefsStore {
27
29
  summaries(refs: readonly string[], options?: {
28
30
  excerpt?: boolean;
29
31
  }): Promise<Map<string, RefSummary>>;
32
+ /**
33
+ * The accounts the referenced thing belongs to: `[]` when no account brought it (the owner made it), `undefined`
34
+ * when the store holds nothing for the reference or it is not one.
35
+ */
36
+ accounts(ref: string): Promise<{
37
+ provider: string;
38
+ account: string;
39
+ }[] | undefined>;
40
+ /**
41
+ * Each part the thing belongs to, all of which a group must hold: a proposed action (`action:<id>`) is its own
42
+ * account and its target's; a suggested link (`link:<id>`) its two ends; anything else one part, as `accounts`.
43
+ */
44
+ ends(ref: string): Promise<{
45
+ provider: string;
46
+ account: string;
47
+ }[][] | undefined>;
30
48
  }
31
49
  /** The caller's answer to "which profile opens this": one signed in, or the choices and why there is not one. */
32
50
  export type ProfilesFor = (provider: string, account: string | null) => {
@@ -42,6 +60,27 @@ export interface RefOpen {
42
60
  why: string | null;
43
61
  }
44
62
  export declare const PROFILE_PLACEHOLDER = "<profile>";
63
+ export declare const profilesOn: (profiles: Profiles, app: string, key: AccountKey) => string[];
64
+ /** From the store's record, so it answers for any CLI that registered its provider, not only the messengers. */
65
+ export declare const storedProfilesFor: (profiles: Profiles) => ProfilesFor;
66
+ /**
67
+ * Which CLI changes a CRM copy on its server, and as which profile; `profile` is `null` unless exactly one fits.
68
+ * `account` is the row's: the write refuses a row of any other account than its profile's live one.
69
+ */
70
+ export interface WritesWith {
71
+ tool: string | null;
72
+ account: AccountKey;
73
+ profile: string | null;
74
+ profiles: string[];
75
+ why: string | null;
76
+ }
77
+ /**
78
+ * `null` for the owner's own row: memo itself writes it. `allowed` is the caller's profile or group lock: a profile it
79
+ * forbids is never named, and the one profile it leaves is the answer.
80
+ */
81
+ export declare const writesWithOf: (account: AccountKey | null, profilesFor: ProfilesFor, { allowed }?: {
82
+ allowed?: (tool: string, profile: string) => boolean;
83
+ }) => WritesWith | null;
45
84
  /** A title from someone else's text, as one line: a newline in it would break every row it is printed in. */
46
85
  export declare const oneLine: (text: string) => string;
47
86
  /**
@@ -1,6 +1,56 @@
1
1
  import { singleLine } from "@wirecat/cli-base";
2
2
  import { providerNamed } from "./providers.js";
3
3
  export const PROFILE_PLACEHOLDER = "<profile>";
4
+ const unregistered = (provider) => `no CLI has registered ${provider} in this store yet; run its CLI once`;
5
+ export const profilesOn = (profiles, app, key) => Object.entries(profiles[app] ?? {})
6
+ .filter(([, saved]) => saved.provider === key.provider && saved.account === key.account)
7
+ .map(([name]) => name);
8
+ /** From the store's record, so it answers for any CLI that registered its provider, not only the messengers. */
9
+ export const storedProfilesFor = (profiles) => (provider, account) => {
10
+ const tool = providerNamed(provider)?.command;
11
+ if (tool === undefined)
12
+ return { why: unregistered(provider), profiles: [] };
13
+ if (account === null)
14
+ return { why: `${provider} names no account here`, profiles: [] };
15
+ const named = profilesOn(profiles, tool, { provider, account });
16
+ if (named.length === 1)
17
+ return { profile: named[0] };
18
+ return {
19
+ why: named.length === 0
20
+ ? `no ${tool} profile has run on ${provider}:${account} here; run \`${tool} <profile>\` with it once`
21
+ : `${named.length} ${tool} profiles are on ${provider}:${account}: ${named.join(", ")}; the owner chooses one`,
22
+ profiles: named,
23
+ };
24
+ };
25
+ const keyText = (key) => `${key.provider}:${key.account}`;
26
+ /**
27
+ * `null` for the owner's own row: memo itself writes it. `allowed` is the caller's profile or group lock: a profile it
28
+ * forbids is never named, and the one profile it leaves is the answer.
29
+ */
30
+ export const writesWithOf = (account, profilesFor, { allowed } = {}) => {
31
+ if (account === null)
32
+ return null;
33
+ const tool = providerNamed(account.provider)?.command ?? null;
34
+ if (tool === null)
35
+ return { tool, account, profile: null, profiles: [], why: unregistered(account.provider) };
36
+ const asked = profilesFor(account.provider, account.account);
37
+ const named = "profile" in asked ? [asked.profile] : asked.profiles;
38
+ const kept = allowed ? named.filter((profile) => allowed(tool, profile)) : named;
39
+ if (kept.length === 1 && ("profile" in asked || allowed))
40
+ return { tool, account, profile: kept[0], profiles: kept, why: null };
41
+ if (kept.length === named.length && !("profile" in asked))
42
+ return { tool, account, profile: null, profiles: asked.profiles, why: asked.why };
43
+ return {
44
+ tool,
45
+ account,
46
+ profile: null,
47
+ profiles: kept,
48
+ why: kept.length === 0
49
+ ? `no ${tool} profile on ${keyText(account)} is allowed in this run`
50
+ : `${kept.length} ${tool} profiles allowed in this run are on ${keyText(account)}: ${kept.join(", ")}; ` +
51
+ "the owner chooses one",
52
+ };
53
+ };
4
54
  /** A title from someone else's text, as one line: a newline in it would break every row it is printed in. */
5
55
  export const oneLine = (text) => singleLine(text.replace(/\s+/g, " ").trim());
6
56
  /** Mail is a message and a chat to the provider registry: `opens` is keyed by the reference kind. */
@@ -28,9 +78,7 @@ export const openOf = (summary, ports) => {
28
78
  return {
29
79
  argv: null,
30
80
  profiles: [],
31
- why: summary.provider === null
32
- ? `nothing here opens a ${kind}`
33
- : `no CLI has registered ${summary.provider} in this store yet; run its CLI once`,
81
+ why: summary.provider === null ? `nothing here opens a ${kind}` : unregistered(summary.provider),
34
82
  };
35
83
  };
36
84
  const WORDS = {
@@ -1,7 +1,20 @@
1
1
  /** What a person is to an organization; who reports to whom is `reports-to`, and a job title is never a role. */
2
2
  export declare const ORGANIZATION_ROLES: readonly ["employee", "contractor", "founder", "owner", "manager", "adviser", "contact"];
3
3
  export declare const PROJECT_ROLES: readonly ["owner", "manager", "contributor", "client-contact", "approver"];
4
- type End = "person" | "organization" | "project" | "task" | "chat" | "email_thread" | "deal" | "lead";
4
+ /** A contract party's part; a party the list cannot name has none, never a catch-all `other`. */
5
+ export declare const CONTRACT_ROLES: readonly ["customer", "supplier", "signatory", "guarantor"];
6
+ /** How much the owner deals with a person on a project himself, not how active the person is; absent is unknown. */
7
+ export declare const ENGAGEMENT_LEVELS: readonly ["none", "low", "medium", "high"];
8
+ export type Engagement = (typeof ENGAGEMENT_LEVELS)[number];
9
+ export declare const isEngagement: (value: unknown) => value is Engagement;
10
+ /** Only a person's membership of a project takes an engagement level. */
11
+ export declare const checkEngagement: (kind: string, from: string, to: string, level: string) => Engagement;
12
+ export declare const engagementRank: (level: Engagement | null | undefined) => number;
13
+ /** A stable sort by `engagementRank`; links without a level keep their order among themselves. */
14
+ export declare const byEngagement: <T extends {
15
+ engagement?: Engagement | null;
16
+ }>(items: readonly T[]) => T[];
17
+ type End = "person" | "organization" | "project" | "task" | "chat" | "email_thread" | "deal" | "lead" | "contract";
5
18
  interface RelationSpec {
6
19
  from: readonly End[];
7
20
  to: readonly End[];
@@ -46,12 +59,13 @@ export declare const RELATIONS: {
46
59
  readonly symmetric: true;
47
60
  };
48
61
  readonly "related-to": {
49
- readonly from: readonly ["person", "organization", "project", "task", "deal", "lead"];
62
+ readonly from: readonly ["person", "organization", "project", "task", "deal", "lead", "contract"];
50
63
  readonly to: readonly ["person", "organization", "project", "task"];
51
64
  readonly roles: {
52
65
  readonly from: {
53
66
  readonly deal: readonly ["owner", "contact", "decision-maker", "influencer"];
54
67
  readonly lead: readonly ["owner", "contact", "decision-maker", "influencer"];
68
+ readonly contract: readonly ["customer", "supplier", "signatory", "guarantor"];
55
69
  };
56
70
  };
57
71
  };
@@ -70,6 +84,7 @@ export declare const ROLE_LISTS: {
70
84
  readonly organization: readonly ["employee", "contractor", "founder", "owner", "manager", "adviser", "contact"];
71
85
  readonly project: readonly ["owner", "manager", "contributor", "client-contact", "approver"];
72
86
  readonly deal: readonly ["owner", "contact", "decision-maker", "influencer"];
87
+ readonly contract: readonly ["customer", "supplier", "signatory", "guarantor"];
73
88
  };
74
89
  export type RoleList = keyof typeof ROLE_LISTS;
75
90
  /** Which list a relationship's role comes from, or `undefined` where a role is free text. */
@@ -107,8 +122,18 @@ export interface RelationshipColumns {
107
122
  deletedAt?: number;
108
123
  /** A job title beside it (`metadata.position`), never its role. */
109
124
  position?: string;
125
+ /** What the role means here, in the owner's words, beside a role from a list (`metadata.roleNote`). */
126
+ roleNote?: string;
127
+ /** A person's on a project (`metadata.engagement`). */
128
+ engagement?: Engagement;
110
129
  /** The source's link this owner link overrides (`metadata.overrides`). */
111
130
  overrides?: number;
131
+ /** The source's own words for it, off the role list (`metadata.source_role`), never its role. */
132
+ sourceRoles?: string[];
133
+ /** The source account that reported it, `<provider>:<account>`. */
134
+ account?: string;
135
+ /** How a source made the relationship when it stated none, such as `department-head`. */
136
+ derived?: string;
112
137
  }
113
138
  /** The owner's confirmation outlives a source that stopped reporting it; only its own end date ends it. */
114
139
  export declare const standingOf: (link: StandingFields, now: number) => Standing;
@@ -11,6 +11,31 @@ export const ORGANIZATION_ROLES = [
11
11
  "contact",
12
12
  ];
13
13
  export const PROJECT_ROLES = ["owner", "manager", "contributor", "client-contact", "approver"];
14
+ /** A contract party's part; a party the list cannot name has none, never a catch-all `other`. */
15
+ export const CONTRACT_ROLES = ["customer", "supplier", "signatory", "guarantor"];
16
+ /** How much the owner deals with a person on a project himself, not how active the person is; absent is unknown. */
17
+ export const ENGAGEMENT_LEVELS = ["none", "low", "medium", "high"];
18
+ export const isEngagement = (value) => typeof value === "string" && ENGAGEMENT_LEVELS.includes(value);
19
+ /** Only a person's membership of a project takes an engagement level. */
20
+ export const checkEngagement = (kind, from, to, level) => {
21
+ if (kind !== "member-of" || from !== "person" || to !== "project")
22
+ throw new CliError("validation_error", "an engagement level is set only on a person's member-of a project", {
23
+ reason: "relationship.engagement-ends",
24
+ });
25
+ if (!isEngagement(level))
26
+ throw new CliError("validation_error", `an engagement level is one of ${ENGAGEMENT_LEVELS.join(", ")}`, {
27
+ reason: "relationship.engagement-unknown",
28
+ });
29
+ return level;
30
+ };
31
+ /** Who the owner deals with most comes first: high, medium, unknown, low, none. */
32
+ const ENGAGEMENT_ORDER = { high: 0, medium: 1, unknown: 2, low: 3, none: 4 };
33
+ export const engagementRank = (level) => ENGAGEMENT_ORDER[level ?? "unknown"];
34
+ /** A stable sort by `engagementRank`; links without a level keep their order among themselves. */
35
+ export const byEngagement = (items) => items
36
+ .map((item, index) => ({ item, index }))
37
+ .sort((a, b) => engagementRank(a.item.engagement) - engagementRank(b.item.engagement) || a.index - b.index)
38
+ .map(({ item }) => item);
14
39
  /**
15
40
  * Every relationship `knowledge.relate` makes, its ends, its roles and how it reads backwards. An organization may
16
41
  * still be a member: owner data from before this list holds such links.
@@ -25,9 +50,9 @@ export const RELATIONS = {
25
50
  "customer-of": { from: ["person", "organization"], to: ["organization"], inverse: "supplier of" },
26
51
  "partner-of": { from: ["organization"], to: ["organization"], symmetric: true },
27
52
  "related-to": {
28
- from: ["person", "organization", "project", "task", "deal", "lead"],
53
+ from: ["person", "organization", "project", "task", "deal", "lead", "contract"],
29
54
  to: ["person", "organization", "project", "task"],
30
- roles: { from: { deal: DEAL_ROLES, lead: DEAL_ROLES } },
55
+ roles: { from: { deal: DEAL_ROLES, lead: DEAL_ROLES, contract: CONTRACT_ROLES } },
31
56
  },
32
57
  };
33
58
  export const RELATION_KINDS = Object.keys(RELATIONS);
@@ -35,12 +60,16 @@ const specOf = (kind) => Object.hasOwn(RELATIONS, kind) ? RELATIONS[kind] : unde
35
60
  export const isRelationKind = (kind) => specOf(kind) !== undefined;
36
61
  /** A chat or a mail thread is only ever a project's member: its reference names one account. */
37
62
  const memberOnly = (type) => type === "chat" || type === "email_thread";
63
+ /** A contract's parties are the people and organizations that signed it. */
64
+ const partyOnly = (from, to) => from === "contract" && to !== "person" && to !== "organization";
38
65
  export const checkEnds = (kind, from, to) => {
39
66
  const spec = specOf(kind);
40
67
  if (!spec)
41
68
  throw new CliError("validation_error", `a relationship's kind is one of ${RELATION_KINDS.join(", ")}`);
42
69
  if (memberOnly(from) && (kind !== "member-of" || to !== "project"))
43
70
  throw new CliError("validation_error", `a ${from === "chat" ? "chat" : "mail thread"} is related only as member-of a project`);
71
+ if (partyOnly(from, to))
72
+ throw new CliError("validation_error", "a contract is related only to a person or an organization");
44
73
  if (!spec.from.includes(from) || !spec.to.includes(to))
45
74
  throw new CliError("validation_error", `${kind} joins ${spec.from.join(", ")} to ${spec.to.join(", ")}, not ${from} to ${to}`);
46
75
  return spec;
@@ -56,7 +85,12 @@ export const rolesOf = (kind, from, to) => {
56
85
  return spec?.roles?.from?.[from] ?? spec?.roles?.to?.[to];
57
86
  };
58
87
  /** The role lists the owner may add to; each is a list the registry gives some relationship's ends. */
59
- export const ROLE_LISTS = { organization: ORGANIZATION_ROLES, project: PROJECT_ROLES, deal: DEAL_ROLES };
88
+ export const ROLE_LISTS = {
89
+ organization: ORGANIZATION_ROLES,
90
+ project: PROJECT_ROLES,
91
+ deal: DEAL_ROLES,
92
+ contract: CONTRACT_ROLES,
93
+ };
60
94
  /** Which list a relationship's role comes from, or `undefined` where a role is free text. */
61
95
  export const roleListOf = (kind, from, to) => {
62
96
  const roles = rolesOf(kind, from, to);
@@ -1,4 +1,4 @@
1
- import type { PhoneCountry } from "./phones.js";
1
+ import { type PhoneCountry } from "./phones.js";
2
2
  import type { RecordsEnvelope } from "./records.js";
3
3
  export interface VcardOptions {
4
4
  provider: string;
@@ -19,7 +19,7 @@ export declare const isVcard: (text: string) => boolean;
19
19
  * addresses, and one organization per `ORG` name the person is a member of. Nothing is guessed: a national number
20
20
  * is read only in `region`, and a card says nothing about a person it does not hold.
21
21
  */
22
- export declare const envelopeOfVcard: (text: string, { provider, account, batchId, region }: VcardOptions) => {
22
+ export declare const envelopeOfVcard: (text: string, { provider, account, batchId, region: given }: VcardOptions) => {
23
23
  envelope: RecordsEnvelope;
24
24
  issues: VcardIssue[];
25
25
  };
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import { typedPhone } from "./mentions.js";
2
+ import { e164Of } from "./phones.js";
3
3
  import { WORD_BODY } from "./record-types.js";
4
4
  const MAX_ID = 512;
5
5
  const AS_WORD = new RegExp(`^${WORD_BODY}$`);
@@ -108,14 +108,7 @@ const components = (value) => {
108
108
  };
109
109
  const textOf = (property, report) => components(decoded(property, report)).join(";").trim();
110
110
  /** E.164, or `undefined` when the number has no country of its own and none is given. */
111
- const e164 = (typed, region) => {
112
- const text = typed.replace(/^tel:/i, "").replace(/;.*$/, "").trim();
113
- const international = /^(\+|00)/.test(text);
114
- if (!international && region === undefined)
115
- return undefined;
116
- const value = typedPhone(text, region === undefined ? {} : { phoneCountries: [region] })?.value;
117
- return value?.startsWith("+") ? value : undefined;
118
- };
111
+ const e164 = (typed, region) => e164Of(typed.replace(/^tel:/i, "").replace(/;.*$/, "").trim(), region) ?? undefined;
119
112
  const foldedName = (name) => name.normalize("NFKC").toLowerCase().replace(/\s+/g, " ").trim();
120
113
  const hashed = (prefix, parts) => `${prefix}${createHash("sha256").update(parts.join("\n")).digest("hex").slice(0, 32)}`;
121
114
  const organizationId = (name) => {
@@ -174,7 +167,8 @@ const cardsOf = (text) => {
174
167
  * addresses, and one organization per `ORG` name the person is a member of. Nothing is guessed: a national number
175
168
  * is read only in `region`, and a card says nothing about a person it does not hold.
176
169
  */
177
- export const envelopeOfVcard = (text, { provider, account, batchId, region }) => {
170
+ export const envelopeOfVcard = (text, { provider, account, batchId, region: given }) => {
171
+ const region = given?.toLowerCase();
178
172
  const { cards, issues } = cardsOf(text);
179
173
  const people = [];
180
174
  const organizations = new Map();
@@ -15,8 +15,10 @@ export interface TextModel {
15
15
  custom?: boolean;
16
16
  languages: string;
17
17
  licence: string;
18
- /** A licence the user accepts before the model is downloaded, or nothing for an open one. */
18
+ /** The page of a licence with conditions of its own, or nothing for an open one. */
19
19
  terms?: string;
20
+ /** What the licence asks a copy to carry, written beside the model's files as NOTICE. */
21
+ notice?: string;
20
22
  dims: number;
21
23
  /** What the model was trained on; a longer text is cut. */
22
24
  maxTokens: number;
@@ -35,7 +37,9 @@ export interface TextModel {
35
37
  externalData?: string;
36
38
  }
37
39
  export declare const TEXT_MODELS: TextModel[];
38
- export declare const DEFAULT_TEXT_MODEL = "e5-small";
40
+ export declare const DEFAULT_TEXT_MODEL = "embeddinggemma";
41
+ /** The default until 8 Nov 2026: a machine that has it and not EmbeddingGemma keeps embedding and searching with it. */
42
+ export declare const PREVIOUS_DEFAULT_TEXT_MODEL = "e5-small";
39
43
  /** A model the owner adds: the same shape as a built-in one, so it is downloaded, checked and loaded the same way. */
40
44
  export declare const CustomTextModelShape: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
41
45
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "is not a model id: a-z, 0-9, . _ -">]>;
@@ -203,7 +207,11 @@ export declare const writeTextModelsSection: (section: TextModelsSection, env?:
203
207
  /** The models this version ships, then the owner's own. */
204
208
  export declare const textModels: (env?: NodeJS.ProcessEnv) => TextModel[];
205
209
  export declare const textModel: (id: string, env?: NodeJS.ProcessEnv) => TextModel;
206
- /** The model every embed and every search by meaning uses when none is named: the owner's `models use`, or e5-small. */
210
+ /**
211
+ * The model every embed and every search by meaning uses when none is named: the owner's `models set`, else
212
+ * EmbeddingGemma. A machine with only e5-small downloaded, the default before, keeps using it, so its search by meaning
213
+ * never stops for a model it lacks; once EmbeddingGemma is downloaded the next syncs embed with it.
214
+ */
207
215
  export declare const chosenTextModel: (env?: NodeJS.ProcessEnv) => {
208
216
  id: string;
209
217
  from: "chosen" | "default";
@@ -1,5 +1,8 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
1
3
  import { CliError } from "@wirecat/cli-base";
2
4
  import * as v from "valibot";
5
+ import { filesPresent, sharedModelsDirectory } from "../speech/install.js";
3
6
  import { storePath } from "../store/path.js";
4
7
  import { readSharedSection, sharedConfigPath, writeSharedSection } from "../store/shared-config.js";
5
8
  const huggingFace = (repository, commit) => (name) => `https://huggingface.co/${repository}/resolve/${commit}/${name}`;
@@ -48,9 +51,14 @@ export const TEXT_MODELS = [
48
51
  languages: "over 100 languages — the best of the two on chat, about seven times slower",
49
52
  licence: "Gemma Terms of Use",
50
53
  terms: "https://ai.google.dev/gemma/terms",
54
+ // Gemma Terms of Use §3.1: every copy carries this notice and the use restrictions of §3.2.
55
+ notice: "Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms. Its use is " +
56
+ "restricted by the Gemma Prohibited Use Policy: https://ai.google.dev/gemma/prohibited_use_policy",
51
57
  dims: 768,
52
58
  maxTokens: 2048,
53
- chunksPerSecond: 2,
59
+ // 2026-11-08, 1,200-character chunks, 8 threads on the Ryzen AI 9 HX 470: 8.3 chunks/s against e5-small's 52.7, so
60
+ // 5 on the scale e5-small's 31 sets. It was 2, which held a memo sync to 39 chunks.
61
+ chunksPerSecond: 5,
54
62
  pooling: "sentence_embedding",
55
63
  prefix: { query: "task: search result | query: ", passage: "title: none | text: " },
56
64
  onnx: "onnx/model_q4.onnx",
@@ -117,7 +125,9 @@ export const TEXT_MODELS = [
117
125
  ],
118
126
  },
119
127
  ];
120
- export const DEFAULT_TEXT_MODEL = "e5-small";
128
+ export const DEFAULT_TEXT_MODEL = "embeddinggemma";
129
+ /** The default until 8 Nov 2026: a machine that has it and not EmbeddingGemma keeps embedding and searching with it. */
130
+ export const PREVIOUS_DEFAULT_TEXT_MODEL = "e5-small";
121
131
  const SECTION = "text_models";
122
132
  const slug = v.pipe(v.string(), v.regex(/^[a-z0-9][a-z0-9._-]{0,62}$/, "is not a model id: a-z, 0-9, . _ -"));
123
133
  const words = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(300));
@@ -188,10 +198,24 @@ export const textModel = (id, env = process.env) => {
188
198
  }
189
199
  return found;
190
200
  };
191
- /** The model every embed and every search by meaning uses when none is named: the owner's `models use`, or e5-small. */
201
+ const downloaded = (id, env) => {
202
+ const model = TEXT_MODELS.find((one) => one.id === id);
203
+ const directory = sharedModelsDirectory("text", env);
204
+ return model !== undefined && filesPresent(model.files.map((file) => [file, join(directory, model.id, file.name)]));
205
+ };
206
+ /**
207
+ * The model every embed and every search by meaning uses when none is named: the owner's `models set`, else
208
+ * EmbeddingGemma. A machine with only e5-small downloaded, the default before, keeps using it, so its search by meaning
209
+ * never stops for a model it lacks; once EmbeddingGemma is downloaded the next syncs embed with it.
210
+ */
192
211
  export const chosenTextModel = (env = process.env) => {
193
212
  const use = readTextModelsSection(env).use;
194
- return use === undefined ? { id: DEFAULT_TEXT_MODEL, from: "default" } : { id: use, from: "chosen" };
213
+ if (use !== undefined)
214
+ return { id: use, from: "chosen" };
215
+ // The previous default's folder, not its files: a CLI may run it under its own pinned files.
216
+ const kept = !downloaded(DEFAULT_TEXT_MODEL, env) &&
217
+ existsSync(join(sharedModelsDirectory("text", env), PREVIOUS_DEFAULT_TEXT_MODEL));
218
+ return { id: kept ? PREVIOUS_DEFAULT_TEXT_MODEL : DEFAULT_TEXT_MODEL, from: "default" };
195
219
  };
196
220
  const mmarco = huggingFace("cross-encoder/mmarco-mMiniLMv2-L12-H384-v1", "1427fd652930e4ba29e8149678df786c240d8825");
197
221
  const bge = huggingFace("onnx-community/bge-reranker-v2-m3-ONNX", "6f5ff65298512715a1e669753bc754d2bc8f367b");
@@ -0,0 +1,149 @@
1
+ import * as v from "valibot";
2
+ /** What a person is in the owner's business: organizations, reporting lines, deals and projects, with standing. */
3
+ export declare const personBusiness: v.StrictObjectSchema<{
4
+ readonly organizations: v.StrictObjectSchema<{
5
+ readonly items: v.ArraySchema<v.StrictObjectSchema<{
6
+ readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
7
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
8
+ readonly roles: v.ArraySchema<v.StrictObjectSchema<{
9
+ /** `link:<id>`; absent for a proposal. */
10
+ readonly link: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
11
+ /** A `relationship` proposal waiting for the owner: its id, with `standing: proposed`. */
12
+ readonly proposal: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
13
+ readonly kind: v.PicklistSchema<("customer-of" | "member-of" | "partner-of" | "related-to" | "reports-to")[], undefined>;
14
+ readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
15
+ /** `reported`: a CRM account says so and nobody confirmed it; `ended`: it no longer holds. */
16
+ readonly standing: v.PicklistSchema<readonly ["confirmed", "reported", "proposed", "ended"], undefined>;
17
+ /** The source account that reported it, `<provider>:<account>`. */
18
+ readonly account: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
19
+ /** A job title the source gave; never a role. */
20
+ readonly position: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
21
+ /** How a source made it when it stated none, such as `department-head`. */
22
+ readonly derived: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
23
+ readonly starts_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
24
+ readonly ends_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
25
+ }, undefined>, undefined>;
26
+ readonly categories: v.ArraySchema<v.PicklistSchema<readonly ["client", "supplier", "partner", "employer"], undefined>, undefined>;
27
+ }, undefined>, undefined>;
28
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
29
+ readonly has_more: v.BooleanSchema<undefined>;
30
+ readonly next: v.NullableSchema<v.StringSchema<undefined>, undefined>;
31
+ }, undefined>;
32
+ readonly reports_to: v.StrictObjectSchema<{
33
+ readonly items: v.ArraySchema<v.StrictObjectSchema<{
34
+ readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
35
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
36
+ readonly roles: v.ArraySchema<v.StrictObjectSchema<{
37
+ /** `link:<id>`; absent for a proposal. */
38
+ readonly link: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
39
+ /** A `relationship` proposal waiting for the owner: its id, with `standing: proposed`. */
40
+ readonly proposal: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
41
+ readonly kind: v.PicklistSchema<("customer-of" | "member-of" | "partner-of" | "related-to" | "reports-to")[], undefined>;
42
+ readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
43
+ /** `reported`: a CRM account says so and nobody confirmed it; `ended`: it no longer holds. */
44
+ readonly standing: v.PicklistSchema<readonly ["confirmed", "reported", "proposed", "ended"], undefined>;
45
+ /** The source account that reported it, `<provider>:<account>`. */
46
+ readonly account: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
47
+ /** A job title the source gave; never a role. */
48
+ readonly position: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
49
+ /** How a source made it when it stated none, such as `department-head`. */
50
+ readonly derived: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
51
+ readonly starts_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
52
+ readonly ends_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
53
+ }, undefined>, undefined>;
54
+ }, undefined>, undefined>;
55
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
56
+ readonly has_more: v.BooleanSchema<undefined>;
57
+ readonly next: v.NullableSchema<v.StringSchema<undefined>, undefined>;
58
+ }, undefined>;
59
+ readonly direct_reports: v.StrictObjectSchema<{
60
+ readonly items: v.ArraySchema<v.StrictObjectSchema<{
61
+ readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
62
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
63
+ readonly roles: v.ArraySchema<v.StrictObjectSchema<{
64
+ /** `link:<id>`; absent for a proposal. */
65
+ readonly link: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
66
+ /** A `relationship` proposal waiting for the owner: its id, with `standing: proposed`. */
67
+ readonly proposal: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
68
+ readonly kind: v.PicklistSchema<("customer-of" | "member-of" | "partner-of" | "related-to" | "reports-to")[], undefined>;
69
+ readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
70
+ /** `reported`: a CRM account says so and nobody confirmed it; `ended`: it no longer holds. */
71
+ readonly standing: v.PicklistSchema<readonly ["confirmed", "reported", "proposed", "ended"], undefined>;
72
+ /** The source account that reported it, `<provider>:<account>`. */
73
+ readonly account: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
74
+ /** A job title the source gave; never a role. */
75
+ readonly position: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
76
+ /** How a source made it when it stated none, such as `department-head`. */
77
+ readonly derived: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
78
+ readonly starts_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
79
+ readonly ends_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
80
+ }, undefined>, undefined>;
81
+ }, undefined>, undefined>;
82
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
83
+ readonly has_more: v.BooleanSchema<undefined>;
84
+ readonly next: v.NullableSchema<v.StringSchema<undefined>, undefined>;
85
+ }, undefined>;
86
+ readonly deals: v.StrictObjectSchema<{
87
+ readonly items: v.ArraySchema<v.StrictObjectSchema<{
88
+ readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
89
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
90
+ readonly roles: v.ArraySchema<v.StrictObjectSchema<{
91
+ /** `link:<id>`; absent for a proposal. */
92
+ readonly link: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
93
+ /** A `relationship` proposal waiting for the owner: its id, with `standing: proposed`. */
94
+ readonly proposal: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
95
+ readonly kind: v.PicklistSchema<("customer-of" | "member-of" | "partner-of" | "related-to" | "reports-to")[], undefined>;
96
+ readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
97
+ /** `reported`: a CRM account says so and nobody confirmed it; `ended`: it no longer holds. */
98
+ readonly standing: v.PicklistSchema<readonly ["confirmed", "reported", "proposed", "ended"], undefined>;
99
+ /** The source account that reported it, `<provider>:<account>`. */
100
+ readonly account: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
101
+ /** A job title the source gave; never a role. */
102
+ readonly position: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
103
+ /** How a source made it when it stated none, such as `department-head`. */
104
+ readonly derived: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
105
+ readonly starts_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
106
+ readonly ends_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
107
+ }, undefined>, undefined>;
108
+ }, undefined>, undefined>;
109
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
110
+ readonly has_more: v.BooleanSchema<undefined>;
111
+ readonly next: v.NullableSchema<v.StringSchema<undefined>, undefined>;
112
+ }, undefined>;
113
+ readonly projects: v.StrictObjectSchema<{
114
+ readonly items: v.ArraySchema<v.StrictObjectSchema<{
115
+ readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
116
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
117
+ readonly roles: v.ArraySchema<v.StrictObjectSchema<{
118
+ /** `link:<id>`; absent for a proposal. */
119
+ readonly link: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>, undefined>;
120
+ /** A `relationship` proposal waiting for the owner: its id, with `standing: proposed`. */
121
+ readonly proposal: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
122
+ readonly kind: v.PicklistSchema<("customer-of" | "member-of" | "partner-of" | "related-to" | "reports-to")[], undefined>;
123
+ readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
124
+ /** `reported`: a CRM account says so and nobody confirmed it; `ended`: it no longer holds. */
125
+ readonly standing: v.PicklistSchema<readonly ["confirmed", "reported", "proposed", "ended"], undefined>;
126
+ /** The source account that reported it, `<provider>:<account>`. */
127
+ readonly account: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
128
+ /** A job title the source gave; never a role. */
129
+ readonly position: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
130
+ /** How a source made it when it stated none, such as `department-head`. */
131
+ readonly derived: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
132
+ readonly starts_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
133
+ readonly ends_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
134
+ }, undefined>, undefined>;
135
+ }, undefined>, undefined>;
136
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
137
+ readonly has_more: v.BooleanSchema<undefined>;
138
+ readonly next: v.NullableSchema<v.StringSchema<undefined>, undefined>;
139
+ }, undefined>;
140
+ readonly categories: v.ArraySchema<v.PicklistSchema<readonly ["client", "supplier", "partner", "employer"], undefined>, undefined>;
141
+ }, undefined>;
142
+ /** Any canonical person's context: every account in scope read, their business, and what was not read. */
143
+ export declare const personContext: v.GenericSchema;
144
+ /** One organization: people, customers, suppliers, partners, projects, open deals, money and how much is said. */
145
+ export declare const organizationContext: v.GenericSchema;
146
+ /** One deal or lead: the row, its stages, client, people, project, money and what its people said in its time. */
147
+ export declare const dealContext: v.GenericSchema;
148
+ /** A deal context's compact form, for a model's context. */
149
+ export declare const dealBrief: v.GenericSchema;