@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,875 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { CliError, createRenderer, processStreams } from "@wirecat/cli-base";
3
+ import { assertSharedContracts, customizeSharedCommand } from "@wirecat/cli-base/commands";
4
+ import { skillCommand } from "@wirecat/cli-base/skill";
5
+ import { addContractInfo, commandWords, entityFields, environmentOf, groupAware, groupLockOf, guideCommand, installHelp, LISTING_ENTITIES, liftProfile, overrideSharedContract, provide, REF_KINDS, recordRuns, refKinds, runsCommand, skillCommand as sharedSkillCommand, } from "@wirecat/cli-core";
6
+ import { Command } from "commander";
7
+ import { actionsCommand } from "./actions/command.js";
8
+ import { agentsCommand } from "./agents/command.js";
9
+ import { answers, itemAnswer, trackAnswers, withStore } from "./answer.js";
10
+ import { askCommand } from "./answers/command.js";
11
+ import { APP } from "./app.js";
12
+ import { botsCommand } from "./bots/command.js";
13
+ import { loadConfig } from "./config.js";
14
+ import { configCommand } from "./config-command.js";
15
+ import { contextCommand } from "./context/command.js";
16
+ import { SHELL_OVERRIDES } from "./contract-overrides.js";
17
+ import { digestCommand } from "./digest/backfill.js";
18
+ import { digestAddendum, withBrief } from "./digest/brief.js";
19
+ import { commandsCommand, placeInSections } from "./discovery/command.js";
20
+ import { doctorCommand } from "./doctor/command.js";
21
+ import { documentsCommand } from "./documents/command.js";
22
+ import { domainListsCommands } from "./domain-lists/command.js";
23
+ import { eventsCommand } from "./events/command.js";
24
+ import { addExamples } from "./examples.js";
25
+ import { factsCommand } from "./facts/command.js";
26
+ import { recognisable } from "./failure.js";
27
+ import { financeCommands } from "./finance/command.js";
28
+ import { contractCommands } from "./finance/contracts-command.js";
29
+ import { dealCommands } from "./finance/deals-command.js";
30
+ import { orderCommands } from "./finance/orders-command.js";
31
+ import { productCommands } from "./finance/products-command.js";
32
+ import { subscriptionCommands } from "./finance/subscriptions-command.js";
33
+ import { transactionCommands } from "./finance/transactions-command.js";
34
+ import { walletCommands } from "./finance/wallets-command.js";
35
+ import { findingsCommand } from "./findings/command.js";
36
+ import { jsonFields } from "./json-fields.js";
37
+ import { knowledgeCommands } from "./knowledge/command.js";
38
+ import { reviewMailCommands } from "./mail/command.js";
39
+ import { messagesCommand } from "./mail/messages-command.js";
40
+ import { mcpCommand } from "./mcp/command.js";
41
+ import { meetingReadCommands } from "./meetings/command.js";
42
+ import { meetingListCommands } from "./meetings/list-command.js";
43
+ import { meetingPreparationCommand } from "./meetings/preparation-command.js";
44
+ import { memoriesCommand } from "./memories/command.js";
45
+ import { mentionsCommand } from "./mentions/command.js";
46
+ import { removeMemoSkills } from "./migrate/skill.js";
47
+ import { modelsCommand } from "./models/command.js";
48
+ import { peopleCommand } from "./people/command.js";
49
+ import { readOnlyAvailability, refuseWritesUnderLock } from "./read-only.js";
50
+ import { REASONS } from "./reasons.js";
51
+ import { recordsCommand } from "./records/import.js";
52
+ import { reviewCommand } from "./review/command.js";
53
+ import { autoCommand } from "./run/auto.js";
54
+ import { syncCommand } from "./run/import.js";
55
+ import { scheduleCommand } from "./schedule/command.js";
56
+ import { searchCommand } from "./search/command.js";
57
+ import { showCommand } from "./show/command.js";
58
+ import { memoListContext, scopeRunsToGroup } from "./store/group.js";
59
+ import { groupsCommand } from "./store/groups-command.js";
60
+ import { storeCommand } from "./store/info-command.js";
61
+ import { tagsCommand } from "./tags/command.js";
62
+ import { tasksCommand } from "./tasks/command.js";
63
+ import { templatesCommand } from "./templates/command.js";
64
+ import { provideTerminal } from "./terminal.js";
65
+ import { upgradeCommand } from "./update.js";
66
+ import { VERSION } from "./version.js";
67
+ import { vocabularyCommand } from "./vocabulary/command.js";
68
+ /** wcat's own answers, beyond cli-core's entities, so `--json=<field>` is checked against what each row holds. */
69
+ const OWN_ENTITIES = entityFields({
70
+ ...LISTING_ENTITIES,
71
+ person_note_links: ["person", "name", "files"],
72
+ added_source: [
73
+ "ref",
74
+ "created",
75
+ "duplicate_of",
76
+ "title",
77
+ "kind",
78
+ "mime",
79
+ "bytes",
80
+ "chars",
81
+ "truncated",
82
+ "extractor",
83
+ "read",
84
+ "url",
85
+ "kept",
86
+ "searchable",
87
+ "subjects",
88
+ ],
89
+ source_preview: ["url", "title", "site", "description", "excerpt", "kind", "mime", "read", "chars", "truncated"],
90
+ source_detail: [
91
+ "ref",
92
+ "title",
93
+ "added",
94
+ "kind",
95
+ "url",
96
+ "file_name",
97
+ "mime",
98
+ "bytes",
99
+ "kept",
100
+ "chars",
101
+ "text",
102
+ "text_truncated",
103
+ "created_at",
104
+ "updated_at",
105
+ "subjects",
106
+ "facts",
107
+ "memories",
108
+ "batches",
109
+ ],
110
+ source_mention: ["ref", "type", "name", "found_as"],
111
+ source_removal: ["ref", "removed", "copy_deleted", "facts", "memories"],
112
+ source_suggestion: [
113
+ "ref",
114
+ "reader",
115
+ "model",
116
+ "leaves_computer",
117
+ "reused",
118
+ "batch",
119
+ "fingerprint",
120
+ "status",
121
+ "owner_only",
122
+ "facts",
123
+ "dropped",
124
+ ],
125
+ source_reader: [
126
+ "id",
127
+ "title",
128
+ "provider",
129
+ "available",
130
+ "signed_in",
131
+ "version",
132
+ "model",
133
+ "models",
134
+ "needs_model",
135
+ "leaves_computer",
136
+ "reads_files",
137
+ "chosen",
138
+ "problem",
139
+ ],
140
+ source_reader_choice: ["reader", "model", "leaves_computer", "reads_files"],
141
+ project_annotation_snapshot: ["snapshot", "fingerprint", "coverage", "read_bytes", "records"],
142
+ project_annotation_export: [
143
+ "output_file",
144
+ "project",
145
+ "manifest_fingerprint",
146
+ "coverage",
147
+ "counts",
148
+ "read_bytes",
149
+ "records",
150
+ ],
151
+ project_annotation_transfer: [
152
+ "plan",
153
+ "descriptor_conflicts",
154
+ "namespace_conflicts",
155
+ "ready",
156
+ "fingerprint",
157
+ "read_bytes",
158
+ "records",
159
+ "project",
160
+ "mappings",
161
+ "counts",
162
+ ],
163
+ source_tag: [
164
+ "provider",
165
+ "account",
166
+ "tag",
167
+ "type",
168
+ "chat_id",
169
+ "chat_title",
170
+ "person_id",
171
+ "name",
172
+ "message_id",
173
+ "locator",
174
+ "task_id",
175
+ "sources",
176
+ "created_at",
177
+ "id",
178
+ "path",
179
+ "origin",
180
+ ],
181
+ vocabulary: ["entries", "fingerprint", "coverage"],
182
+ meeting_context: [
183
+ "schema_version",
184
+ "kind",
185
+ "source",
186
+ "target_ref",
187
+ "target_fingerprint",
188
+ "fingerprint",
189
+ "revision",
190
+ "limits",
191
+ "content_bytes",
192
+ "coverage",
193
+ "items",
194
+ ],
195
+ vocabulary_inspection: [
196
+ "source",
197
+ "survivor",
198
+ "vocabulary_fingerprint",
199
+ "preview_fingerprint",
200
+ "assignments",
201
+ "aliases",
202
+ "automatic_claims",
203
+ "links",
204
+ "coverage",
205
+ ],
206
+ proposed_action: [
207
+ "id",
208
+ "kind",
209
+ "account",
210
+ "target",
211
+ "payload",
212
+ "reason",
213
+ "status",
214
+ "proposed_by",
215
+ "decided_by",
216
+ "decided_at",
217
+ "executed_at",
218
+ "result",
219
+ "error",
220
+ "verdict",
221
+ "created_at",
222
+ "summary",
223
+ "project",
224
+ "project_name",
225
+ "fingerprint",
226
+ "subject",
227
+ "subject_name",
228
+ "verb",
229
+ "target_name",
230
+ "chat_name",
231
+ "text",
232
+ "counts",
233
+ "sources",
234
+ ],
235
+ agent_action: ["id", "actor", "tool", "tier", "target", "status", "error", "started_at", "finished_at"],
236
+ meeting_project: ["id", "meeting", "project", "confirmed", "provenance", "fingerprint"],
237
+ account_group: ["group", "members", "duplicates", "suggested"],
238
+ relationship_role: ["list", "id", "label", "built_in"],
239
+ person_context_memo: [
240
+ "messages",
241
+ "events",
242
+ "notes",
243
+ "your_notes",
244
+ "not_read",
245
+ "tasks",
246
+ "relationships",
247
+ "business",
248
+ "coverage",
249
+ "files",
250
+ "untrusted",
251
+ "proposals",
252
+ ],
253
+ organization_context_memo: [
254
+ "organization",
255
+ "categories",
256
+ "people",
257
+ "customers",
258
+ "suppliers",
259
+ "partners",
260
+ "projects",
261
+ "deals",
262
+ "money",
263
+ "communications",
264
+ "history",
265
+ "tasks",
266
+ "coverage",
267
+ "notes",
268
+ "tags",
269
+ "untrusted",
270
+ ],
271
+ order: [
272
+ "id",
273
+ "ref",
274
+ "title",
275
+ "customer",
276
+ "purpose",
277
+ "supplier",
278
+ "supplier_name",
279
+ "number",
280
+ "currency",
281
+ "total",
282
+ "status",
283
+ "order_date",
284
+ "fulfilled_date",
285
+ "invoice",
286
+ "payment",
287
+ "direction",
288
+ "contract",
289
+ "deal",
290
+ "lines",
291
+ "review",
292
+ "author",
293
+ "model",
294
+ "confirmed_by",
295
+ "source",
296
+ "reason",
297
+ "project",
298
+ "project_name",
299
+ "created_at",
300
+ "updated_at",
301
+ "evidence",
302
+ ],
303
+ invoice: [
304
+ "id",
305
+ "ref",
306
+ "title",
307
+ "direction",
308
+ "number",
309
+ "issuer",
310
+ "counterparty",
311
+ "currency",
312
+ "total",
313
+ "paid",
314
+ "open",
315
+ "issue_date",
316
+ "due_date",
317
+ "status",
318
+ "review",
319
+ "author",
320
+ "model",
321
+ "confirmed_by",
322
+ "source",
323
+ "reason",
324
+ "project",
325
+ "project_name",
326
+ "created_at",
327
+ "updated_at",
328
+ "evidence",
329
+ "lines",
330
+ "allocations",
331
+ ],
332
+ payment: [
333
+ "id",
334
+ "ref",
335
+ "title",
336
+ "direction",
337
+ "payer",
338
+ "payee",
339
+ "amount",
340
+ "currency",
341
+ "date",
342
+ "reference",
343
+ "allocated",
344
+ "unallocated",
345
+ "refund_of",
346
+ "subscription",
347
+ "evidence",
348
+ "review",
349
+ "author",
350
+ "model",
351
+ "confirmed_by",
352
+ "source",
353
+ "reason",
354
+ "project",
355
+ "project_name",
356
+ "created_at",
357
+ "updated_at",
358
+ "allocations",
359
+ ],
360
+ source_record: [
361
+ "provider",
362
+ "account",
363
+ "type",
364
+ "external_id",
365
+ "fields",
366
+ "revision",
367
+ "fingerprint",
368
+ "relations",
369
+ "incoming",
370
+ "entity",
371
+ "created_entity",
372
+ "flagged",
373
+ "batch_id",
374
+ "created_at",
375
+ "updated_at",
376
+ "deleted_at",
377
+ ],
378
+ import_receipt: [
379
+ "dry_run",
380
+ "source",
381
+ "created",
382
+ "updated",
383
+ "unchanged",
384
+ "deleted",
385
+ "refused",
386
+ "errors",
387
+ "by",
388
+ "files",
389
+ "skipped",
390
+ "cut",
391
+ ],
392
+ records_templates: ["types"],
393
+ records_template: ["type", "format", "columns", "text"],
394
+ organization_erasure: ["organization", "name", "erased", "identities", "deleted", "detached"],
395
+ person_erasure: ["person", "erased", "merged", "identities", "kept", "deleted", "detached"],
396
+ records_clear: ["account", "records"],
397
+ records_receipt: [
398
+ "dry_run",
399
+ "source",
400
+ "created",
401
+ "updated",
402
+ "unchanged",
403
+ "deleted",
404
+ "refused",
405
+ "proposed",
406
+ "waiting",
407
+ "flagged",
408
+ "unmatched",
409
+ "ignored",
410
+ "vcard",
411
+ "errors",
412
+ "truncated",
413
+ ],
414
+ product: [
415
+ "id",
416
+ "ref",
417
+ "title",
418
+ "kind",
419
+ "name",
420
+ "sku",
421
+ "supplier",
422
+ "unit",
423
+ "unit_price",
424
+ "currency",
425
+ "description",
426
+ "archived_date",
427
+ "author",
428
+ "model",
429
+ "source",
430
+ "created_at",
431
+ "updated_at",
432
+ ],
433
+ contract: [
434
+ "id",
435
+ "ref",
436
+ "title",
437
+ "name",
438
+ "number",
439
+ "kind",
440
+ "status",
441
+ "signed_date",
442
+ "effective_date",
443
+ "expiration_date",
444
+ "auto_renew",
445
+ "renewal",
446
+ "notice_days",
447
+ "notice_deadline",
448
+ "terms",
449
+ "value",
450
+ "currency",
451
+ "deal",
452
+ "review",
453
+ "author",
454
+ "model",
455
+ "confirmed_by",
456
+ "source",
457
+ "reason",
458
+ "evidence",
459
+ "project",
460
+ "project_name",
461
+ "created_at",
462
+ "updated_at",
463
+ ],
464
+ subscription: [
465
+ "id",
466
+ "ref",
467
+ "title",
468
+ "name",
469
+ "direction",
470
+ "supplier",
471
+ "customer",
472
+ "product",
473
+ "contract",
474
+ "status",
475
+ "interval",
476
+ "start_date",
477
+ "trial_end_date",
478
+ "next_renewal_date",
479
+ "cancelled_date",
480
+ "end_date",
481
+ "current_price",
482
+ "prices",
483
+ "review",
484
+ "author",
485
+ "model",
486
+ "confirmed_by",
487
+ "source",
488
+ "reason",
489
+ "evidence",
490
+ "project",
491
+ "project_name",
492
+ "created_at",
493
+ "updated_at",
494
+ ],
495
+ subscription_price: [
496
+ "id",
497
+ "ref",
498
+ "title",
499
+ "subscription",
500
+ "amount",
501
+ "currency",
502
+ "effective_from",
503
+ "review",
504
+ "author",
505
+ "reason",
506
+ "project",
507
+ "created_at",
508
+ ],
509
+ wallet: [
510
+ "id",
511
+ "ref",
512
+ "title",
513
+ "name",
514
+ "kind",
515
+ "currency",
516
+ "institution",
517
+ "number_hint",
518
+ "holder",
519
+ "opening_balance",
520
+ "opening_date",
521
+ "closed_date",
522
+ "balance",
523
+ "until",
524
+ "pending",
525
+ "source_says",
526
+ "author",
527
+ "model",
528
+ "source",
529
+ "created_at",
530
+ "updated_at",
531
+ ],
532
+ transaction: [
533
+ "id",
534
+ "ref",
535
+ "title",
536
+ "wallet",
537
+ "wallet_name",
538
+ "direction",
539
+ "amount",
540
+ "currency",
541
+ "status",
542
+ "statement_date",
543
+ "booked_date",
544
+ "description",
545
+ "counterparty_name",
546
+ "counterparty",
547
+ "reference",
548
+ "payment",
549
+ "splits",
550
+ "uncategorized",
551
+ "review",
552
+ "author",
553
+ "model",
554
+ "confirmed_by",
555
+ "source",
556
+ "reason",
557
+ "evidence",
558
+ "project",
559
+ "project_name",
560
+ "created_at",
561
+ "updated_at",
562
+ ],
563
+ records_match: ["linked", "created", "unmatched", "proposed", "errors", "truncated"],
564
+ payment_allocation: ["payment", "invoice", "amount", "currency", "created_at"],
565
+ });
566
+ /**
567
+ * The commands that keep to the run's account group (WC-ACCT-13): each reads only the group's accounts and its
568
+ * references are checked, so under WCAT_GROUP_LOCK these run and every other command is refused. Add a command only
569
+ * once its reads are scoped.
570
+ */
571
+ const GROUP_AWARE = [
572
+ "context",
573
+ "show",
574
+ "messages show",
575
+ "search all",
576
+ "search messages",
577
+ "search mail",
578
+ "search notes",
579
+ "search people",
580
+ "groups",
581
+ "tags add",
582
+ "tags remove",
583
+ "deals",
584
+ "leads",
585
+ "pipelines list",
586
+ "pipelines show",
587
+ "stages",
588
+ "organizations",
589
+ "people list",
590
+ "people check",
591
+ "people add",
592
+ "relationships list",
593
+ "relationships add",
594
+ "relationships update",
595
+ "relationships end",
596
+ "relationships remove",
597
+ "relationships confirm",
598
+ "relationships roles",
599
+ "mcp serve",
600
+ "memories",
601
+ "facts",
602
+ "actions",
603
+ "review",
604
+ "tasks",
605
+ "projects list",
606
+ "projects add",
607
+ "projects context",
608
+ "projects status",
609
+ "projects key-documents",
610
+ "stats projects show",
611
+ ];
612
+ const isSimpleKind = (name) => REF_KINDS.some(({ type }) => type === name);
613
+ /** What a `<ref>` or `<id>` argument names in each top-level group; ids of owner-only queues name no account. */
614
+ const REF_KINDS_OF = {
615
+ deals: { ref: "deal" },
616
+ leads: { ref: "lead" },
617
+ memories: { ref: "memory" },
618
+ facts: { ref: "fact" },
619
+ tasks: { id: "task", "other-task": "task" },
620
+ actions: { id: "action" },
621
+ review: { id: "proposal", ids: "proposal" },
622
+ };
623
+ /** Argument names that are ids of something cli-core's lock cannot map yet: such a command stays refused under it. */
624
+ const UNMAPPED_IDS = new Set(["id", "ids", "ref", "meeting-id"]);
625
+ const leaves = (command) => command.commands.length === 0 ? [command] : command.commands.flatMap(leaves);
626
+ const topOf = (command) => {
627
+ let at = command;
628
+ while (at.parent?.parent)
629
+ at = at.parent;
630
+ return at.name();
631
+ };
632
+ const markGroupAware = (program) => {
633
+ for (const path of GROUP_AWARE) {
634
+ let command = program;
635
+ for (const name of path.split(" "))
636
+ command = command?.commands.find((child) => child.name() === name);
637
+ if (!command)
638
+ throw new Error(`no command to mark group-aware: ${path}`);
639
+ groupAware(command);
640
+ // Every argument is declared: an id as what it names, free text as none, so a search word or an amount passes
641
+ // the lock while an id is checked. An id no reference maps stays undeclared, and the lock refuses its command.
642
+ for (const leaf of leaves(command)) {
643
+ const top = topOf(leaf);
644
+ const kinds = {};
645
+ let mapped = true;
646
+ for (const name of leaf.registeredArguments.map((argument) => argument.name())) {
647
+ const kind = REF_KINDS_OF[top]?.[name] ?? (isSimpleKind(name) ? name : undefined);
648
+ if (kind !== undefined)
649
+ kinds[name] = kind;
650
+ else if (UNMAPPED_IDS.has(name))
651
+ mapped = false;
652
+ }
653
+ if (mapped)
654
+ refKinds(leaf, kinds);
655
+ }
656
+ }
657
+ };
658
+ /** The parts of the skill an agent reads only when a task needs them; the primary SKILL.md is read every session. */
659
+ export const SKILL_TOPICS = [
660
+ "search",
661
+ "projects",
662
+ "meetings",
663
+ "mail",
664
+ "proposals",
665
+ "money",
666
+ "mcp",
667
+ "vocabulary",
668
+ ];
669
+ const FIRST_SCREEN = {
670
+ pitch: "your notes, mail and messages in one local store, linked to people; every answer cites its source.",
671
+ can: [
672
+ { command: "context <person>", does: "one person's messages, mail, notes and tasks" },
673
+ { command: 'search all "budget"', does: "messages, mail and notes ranked together" },
674
+ { command: 'answers create "…" --all', does: "evidence with sources, ready for your agent" },
675
+ { command: "tasks agenda", does: "overdue tasks, replies you owe and wait for" },
676
+ { command: "meetings prepare <series-id>", does: "a briefing with sources for a meeting" },
677
+ { command: "jobs start", does: "sync notes and embed new mail every 5 minutes" },
678
+ { command: "agents list", does: "every agent tool call, without its arguments" },
679
+ { command: "mcp", does: "search, people, memories and facts for any MCP agent" },
680
+ ],
681
+ profile: false,
682
+ start: "wcat sync",
683
+ };
684
+ export const createProgram = ({ streams: raw = processStreams, env: given = process.env, signal, terminal, keyring, group, stdin, system, } = {}) => {
685
+ // Every reader of the run's group reads WCAT_GROUP, so the first word is that, said shorter (WC-ACCT-13).
686
+ const env = group === undefined ? given : { ...given, WCAT_GROUP: group };
687
+ const fields = jsonFields(raw, OWN_ENTITIES);
688
+ const { streams } = fields;
689
+ const program = new Command("wcat")
690
+ .description("context about people across messengers, notes and mail")
691
+ .version(VERSION)
692
+ .option("--debug", "on failure, show the full error record: cause and stack");
693
+ refuseWritesUnderLock(program, env);
694
+ scopeRunsToGroup(program, env, group);
695
+ provideTerminal(program, terminal);
696
+ contextCommand(program, streams, env);
697
+ showCommand(program, streams, env);
698
+ documentsCommand(program, streams, env);
699
+ messagesCommand(program, streams, env);
700
+ peopleCommand(program, streams, env);
701
+ botsCommand(program, streams, env);
702
+ tagsCommand(program, streams, env);
703
+ tasksCommand(program, streams, env);
704
+ knowledgeCommands(program, streams, env);
705
+ vocabularyCommand(program, streams, env);
706
+ memoriesCommand(program, streams, env);
707
+ mentionsCommand(program, streams, env);
708
+ factsCommand(program, streams, env);
709
+ financeCommands(program, streams, env);
710
+ orderCommands(program, streams, env);
711
+ dealCommands(program, streams, env);
712
+ productCommands(program, streams, env);
713
+ contractCommands(program, streams, env);
714
+ subscriptionCommands(program, streams, env);
715
+ walletCommands(program, streams, env);
716
+ transactionCommands(program, streams, env);
717
+ recordsCommand(program, streams, env);
718
+ findingsCommand(program, streams, env);
719
+ meetingListCommands(program, streams, env);
720
+ actionsCommand(program, streams, env);
721
+ reviewCommand(program, streams, env);
722
+ reviewMailCommands(program, streams, env);
723
+ agentsCommand(program, streams, env);
724
+ mcpCommand(program, streams, env, createProgram);
725
+ modelsCommand(program, streams, env, keyring, stdin);
726
+ domainListsCommands(program, streams, env);
727
+ templatesCommand(program, streams, env);
728
+ searchCommand(program, streams, env);
729
+ meetingReadCommands(program, streams, env);
730
+ meetingPreparationCommand(program, streams, env);
731
+ eventsCommand(program, streams, env);
732
+ askCommand(program, streams, env);
733
+ syncCommand(program, streams, env, signal, keyring);
734
+ storeCommand(program, streams, env);
735
+ groupsCommand(program, streams, env);
736
+ autoCommand(program, streams, env);
737
+ configCommand(program, streams, env);
738
+ program.addCommand(doctorCommand());
739
+ program.addCommand(upgradeCommand(streams));
740
+ program.addCommand(scheduleCommand(env));
741
+ digestCommand(program, streams, env);
742
+ commandsCommand(program, streams);
743
+ const skill = customizeSharedCommand(sharedSkillCommand(APP, new URL("../skills/wcat/SKILL.md", import.meta.url)), "wcat installs its own stored-data instructions through its environment, prints the packaged skills (morning-digest with the owner's brief from the store after it), and takes --json on each skill command because it has no global one.", () => {
744
+ const out = answers(program, streams, env);
745
+ let brief;
746
+ const skill = skillCommand(APP, new URL("../skills/wcat/SKILL.md", import.meta.url), (command) => {
747
+ const json = command.opts().json === true;
748
+ const renderer = createRenderer({ format: json ? "json" : "pretty", color: false, streams });
749
+ // cli-base prints each answer bare; the { item, meta } envelope is ours, as in cli-core.
750
+ const result = (value) => {
751
+ const shown = value;
752
+ out.print(true, itemAnswer(shown.content === undefined
753
+ ? value
754
+ : { ...shown, content: withBrief(shown.content, brief?.brief, brief?.digest) }));
755
+ };
756
+ return {
757
+ renderer: json ? { ...renderer, result } : renderer,
758
+ streams: { ...streams, data: (text) => streams.data(withBrief(text, brief?.brief, brief?.digest)) },
759
+ env,
760
+ };
761
+ }, {
762
+ ...Object.fromEntries(SKILL_TOPICS.map((topic) => [topic, new URL(`../skills/wcat/topics/${topic}.md`, import.meta.url)])),
763
+ "mail-triage": new URL("../skills/mail-triage/SKILL.md", import.meta.url),
764
+ "morning-digest": new URL("../skills/morning-digest/SKILL.md", import.meta.url),
765
+ "task-triage": new URL("../skills/task-triage/SKILL.md", import.meta.url),
766
+ });
767
+ // wcat has no global --json, so each skill command takes its own, as guide does.
768
+ for (const command of skill.commands)
769
+ command.option("--json", "print JSON");
770
+ const show = skill.commands.find((command) => command.name() === "show");
771
+ // cli-base's show is synchronous, so the owner's brief is read before it runs.
772
+ show?.description(`${show.description()}; morning-digest ends with your brief from \`wcat digest brief\` when you wrote one`);
773
+ show?.hook("preAction", async (command) => {
774
+ brief = command.args[0] === "morning-digest" ? await digestAddendum(env) : undefined;
775
+ });
776
+ return skill;
777
+ }, SHELL_OVERRIDES.skill);
778
+ program.addCommand(skill);
779
+ // memo's skill folder is named cli-memo, so wcat's install leaves it beside its own unless it goes here.
780
+ skill.commands
781
+ .find((command) => command.name() === "install")
782
+ ?.hook("postAction", () => {
783
+ removeMemoSkills(env);
784
+ });
785
+ // tg and max have a global --json; wcat's is per command, so guide gets its own.
786
+ program.addCommand(overrideSharedContract(guideCommand(APP, { directory: fileURLToPath(new URL("../scenarios", import.meta.url)), profile: false }), "wcat's output flag is command-local because this provider does not use the messenger program shell.", (command) => {
787
+ command.option("--json", "print JSON");
788
+ }));
789
+ const runs = program.addCommand(runsCommand(APP)).commands.at(-1);
790
+ for (const one of runs?.commands ?? [])
791
+ overrideSharedContract(one, "wcat's output flag is command-local because this provider does not use the messenger program shell.", (command) => {
792
+ command.option("--json", "print JSON");
793
+ });
794
+ addExamples(program);
795
+ fields.install(program);
796
+ recordRuns(program, {
797
+ app: APP,
798
+ settings: () => {
799
+ const config = loadConfig(env);
800
+ return {
801
+ record: config.record,
802
+ keepRunsForDays: config.keep_runs_for_days,
803
+ keepSuccessfulRunsForDays: config.keep_successful_runs_for_days,
804
+ runsSizeLimitMb: config.runs_size_limit_mb,
805
+ recordInput: config.record_input,
806
+ };
807
+ },
808
+ recognise: recognisable,
809
+ env,
810
+ streams,
811
+ });
812
+ trackAnswers(program);
813
+ placeInSections(program);
814
+ markGroupAware(program);
815
+ installHelp(program, FIRST_SCREEN);
816
+ provide(program, {
817
+ ...environmentOf(program),
818
+ ...(system ? { system } : {}),
819
+ env,
820
+ discoveryAvailability: (info) => {
821
+ let command = program;
822
+ for (const word of info.path)
823
+ command = command?.commands.find((child) => child.name() === word);
824
+ return command ? readOnlyAvailability(command, env) : undefined;
825
+ },
826
+ });
827
+ addContractInfo(program, (value) => createRenderer({ format: "json", color: false, streams }).result(value), {
828
+ fields: OWN_ENTITIES,
829
+ errors: { reasons: REASONS },
830
+ });
831
+ assertSharedContracts(program);
832
+ return program;
833
+ };
834
+ /**
835
+ * `wcat work search all …`: a first word that is no command is an account group (WC-ACCT-13), lifted off before
836
+ * parsing, as `liftProfile` lifts a profile. A command must follow it; a word that is neither names the groups.
837
+ */
838
+ export const liftGroup = async (program, args, env) => {
839
+ const words = commandWords(program);
840
+ // wcat's root options (--debug, --version) take no value, so none can hide the first word.
841
+ const { profile: group, rest } = liftProfile([...args], words);
842
+ if (group === undefined)
843
+ return { rest };
844
+ const next = rest.find((arg) => !arg.startsWith("-"));
845
+ const groups = await withStore(env, async (store) => Object.keys((await memoListContext(store, env)).groups));
846
+ // `all`, every account, is no saved group but always a word.
847
+ const known = group === "all" || groups.includes(group);
848
+ // Under the lock another group is a permission_error, which the run's own check gives.
849
+ if ((known || groupLockOf(APP, env) !== undefined) && next !== undefined && words.has(next))
850
+ return { group, rest };
851
+ throw new CliError("validation_error", known
852
+ ? `"${group}" is a group, and a command follows it: wcat ${group} search all …`
853
+ : `"${group}": unknown command or group — groups here: ${groups.join(", ")}; wcat commands lists the commands`, { reason: "input.invalid", groups });
854
+ };
855
+ /**
856
+ * Commander settles `--help` for an unknown first word before any hook runs, so `"projects add" --help` —
857
+ * a shell loop over `"$c"` passes it whole — printed the root help. Checked on the words before parsing.
858
+ */
859
+ export const refuseJoinedPath = (program, args) => {
860
+ let command = program;
861
+ const path = [];
862
+ for (const arg of args) {
863
+ if (arg.startsWith("-"))
864
+ return;
865
+ const [first = "", ...rest] = arg.trim().split(/\s+/);
866
+ const next = command.commands.find((child) => child.name() === first || child.aliases().includes(first));
867
+ if (next === undefined)
868
+ return;
869
+ if (rest.length > 0)
870
+ throw new CliError("validation_error", `"${arg}" was given as one argument; run: ${[program.name(), ...path, first, ...rest].join(" ")}`);
871
+ path.push(first);
872
+ command = next;
873
+ }
874
+ };
875
+ //# sourceMappingURL=program.js.map