@wirecat/cli-memo 0.131.75 → 0.131.76

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 (186) hide show
  1. package/dist/actions/actions.d.ts +1 -0
  2. package/dist/actions/actions.d.ts.map +1 -1
  3. package/dist/actions/actions.js +3 -3
  4. package/dist/actions/actions.js.map +1 -1
  5. package/dist/actions/command.d.ts.map +1 -1
  6. package/dist/actions/command.js +3 -1
  7. package/dist/actions/command.js.map +1 -1
  8. package/dist/agents/command.d.ts.map +1 -1
  9. package/dist/agents/command.js +3 -2
  10. package/dist/agents/command.js.map +1 -1
  11. package/dist/agents/log.d.ts +1 -1
  12. package/dist/agents/log.d.ts.map +1 -1
  13. package/dist/agents/log.js +5 -4
  14. package/dist/agents/log.js.map +1 -1
  15. package/dist/bin/memo.js +2 -2
  16. package/dist/bin/memo.js.map +1 -1
  17. package/dist/bundle/{all-profiles-LUGN5BHP.js → all-profiles-CGQTLFDM.js} +5 -5
  18. package/dist/bundle/{anthropic-W7JXDZPL.js → anthropic-C744EPRR.js} +2 -2
  19. package/dist/bundle/{app-server-TRRARE66.js → app-server-LOH7WXAB.js} +36 -36
  20. package/dist/bundle/auto-R3ABUML7.js +89 -0
  21. package/dist/bundle/{bun-S3JZIN4S.js → bun-SQWZDSWT.js} +2 -2
  22. package/dist/bundle/{bun-sqlite-X3WQN3CV.js → bun-sqlite-YVBFXNWB.js} +2 -2
  23. package/dist/bundle/{chunk-ZISVFVQU.js → chunk-2KGYREGD.js} +363 -362
  24. package/dist/bundle/{chunk-SCYHDYLI.js → chunk-3NCRQMEN.js} +1 -1
  25. package/dist/bundle/{chunk-BDVM5652.js → chunk-3PLYUZAR.js} +1 -1
  26. package/dist/bundle/{chunk-YLYZNPAZ.js → chunk-42UNPXTC.js} +1 -1
  27. package/dist/bundle/{chunk-5CTOWPOL.js → chunk-47WS4BML.js} +4 -4
  28. package/dist/bundle/{chunk-7Y4HUYI3.js → chunk-4DTJF6E7.js} +5 -5
  29. package/dist/bundle/chunk-4IWOPJL4.js +185 -0
  30. package/dist/bundle/{chunk-E2PSOSTN.js → chunk-5AQIET5P.js} +1 -1
  31. package/dist/bundle/{chunk-RZS24U4N.js → chunk-5NY7U6CM.js} +8 -8
  32. package/dist/bundle/{chunk-VFKCZJFT.js → chunk-6RPLAGAL.js} +20 -20
  33. package/dist/bundle/{chunk-4KDORB7C.js → chunk-6YRVBXFH.js} +7 -7
  34. package/dist/bundle/{chunk-KDBAY5JZ.js → chunk-7OZEQIK7.js} +1 -1
  35. package/dist/bundle/{chunk-WZHCQ4VZ.js → chunk-7PSGKP3R.js} +6 -6
  36. package/dist/bundle/{chunk-VB4OLJHK.js → chunk-7XFJRX6F.js} +2 -2
  37. package/dist/bundle/{chunk-ZP2XI5DR.js → chunk-AI6PMW7L.js} +4 -4
  38. package/dist/bundle/{chunk-WKLF7CAM.js → chunk-AUCXJVUI.js} +29 -29
  39. package/dist/bundle/{chunk-UIAGASGP.js → chunk-C7OOLF5J.js} +5 -5
  40. package/dist/bundle/{chunk-NR633L2N.js → chunk-DDSKTPU7.js} +3 -3
  41. package/dist/bundle/{chunk-MPZBV5RL.js → chunk-DUON3SRD.js} +7 -7
  42. package/dist/bundle/{chunk-XQHOMQNZ.js → chunk-EVLOYNXC.js} +3 -3
  43. package/dist/bundle/{chunk-LPGE6ACC.js → chunk-FH753LZS.js} +1 -1
  44. package/dist/bundle/{chunk-JINEHQ2T.js → chunk-FUATAPSB.js} +93 -80
  45. package/dist/bundle/{chunk-6VMIMAZ2.js → chunk-GB64N6DP.js} +297 -294
  46. package/dist/bundle/{chunk-XQ3RZU3J.js → chunk-GBU4U55M.js} +1 -1
  47. package/dist/bundle/{chunk-XPSXVUZG.js → chunk-H3WELZYK.js} +2 -2
  48. package/dist/bundle/{chunk-6FTZ53TT.js → chunk-HAMGOLFU.js} +1 -1
  49. package/dist/bundle/{chunk-KYJBGCTC.js → chunk-KYLKZKQ7.js} +1 -1
  50. package/dist/bundle/{chunk-SJD4KTK2.js → chunk-LLBZDBPT.js} +2 -2
  51. package/dist/bundle/{chunk-W64FO6DD.js → chunk-MFQTOOHR.js} +397 -34
  52. package/dist/bundle/{chunk-5RLCKP5E.js → chunk-MODHP5VA.js} +12 -12
  53. package/dist/bundle/{chunk-LX3OSTBD.js → chunk-N2FIIVJV.js} +4 -4
  54. package/dist/bundle/{chunk-V7BDQIZS.js → chunk-NE3UIK5P.js} +2 -2
  55. package/dist/bundle/{chunk-ZTZLAGZA.js → chunk-NM4QMIOQ.js} +2 -2
  56. package/dist/bundle/{chunk-G45BLLDR.js → chunk-O3KNZVDZ.js} +2 -2
  57. package/dist/bundle/{chunk-XMHWGHID.js → chunk-ODCHYVTW.js} +173 -152
  58. package/dist/bundle/{chunk-6I4DOBSD.js → chunk-OEH5JUAL.js} +12 -12
  59. package/dist/bundle/{chunk-SIQDO5DN.js → chunk-OJU774SG.js} +3 -3
  60. package/dist/bundle/{chunk-ZL63GL3Y.js → chunk-PFNEOHCY.js} +2 -2
  61. package/dist/bundle/{chunk-C6MWOBEL.js → chunk-RLRKBPLJ.js} +15 -9
  62. package/dist/bundle/{chunk-346PWQJF.js → chunk-RTSRESGX.js} +5 -5
  63. package/dist/bundle/{chunk-KUFOM3SB.js → chunk-S54Z74G2.js} +1 -1
  64. package/dist/bundle/{chunk-UU3OAPGO.js → chunk-SF2OLWBU.js} +6 -6
  65. package/dist/bundle/{chunk-6AOPUQTC.js → chunk-TD4HM7XL.js} +1 -1
  66. package/dist/bundle/{chunk-GFVSZY4J.js → chunk-TGURQ4YH.js} +7 -1
  67. package/dist/bundle/{chunk-E74VWHZ2.js → chunk-TPWAXJUQ.js} +1 -1
  68. package/dist/bundle/{chunk-4QGUBKN5.js → chunk-TXVXEE7L.js} +4 -4
  69. package/dist/bundle/{chunk-FGMFJUHR.js → chunk-V6CRCAWN.js} +668 -367
  70. package/dist/bundle/{chunk-YB4KGUXY.js → chunk-VFJAGY3L.js} +2 -2
  71. package/dist/bundle/{chunk-YDTGYYOR.js → chunk-W5ARY4U2.js} +4 -4
  72. package/dist/bundle/{chunk-AOHT5FNX.js → chunk-XGPSFPLH.js} +45 -45
  73. package/dist/bundle/{chunk-QYJJBE56.js → chunk-Y7YXXWQI.js} +3 -3
  74. package/dist/bundle/{chunk-SIOPF2UG.js → chunk-YD7XTYEC.js} +5 -5
  75. package/dist/bundle/{chunk-OWUEEVF6.js → chunk-YNXQAB4X.js} +11 -10
  76. package/dist/bundle/{chunk-EWRHTZD3.js → chunk-YRJ2576I.js} +10 -10
  77. package/dist/bundle/{chunk-4XI7S3PO.js → chunk-YSOTOUHJ.js} +13 -13
  78. package/dist/bundle/{chunk-IQIM4UC7.js → chunk-YU7KZW5I.js} +4 -4
  79. package/dist/bundle/{chunk-ZXW5FPH2.js → chunk-Z3NRIW4M.js} +1 -1
  80. package/dist/bundle/{chunk-2QND7VJS.js → chunk-ZHAHSVQO.js} +5 -5
  81. package/dist/bundle/{chunk-QKWM4VK4.js → chunk-ZIA7AU7L.js} +2 -2
  82. package/dist/bundle/{command-contract-QQG343ZQ.js → command-contract-IEUSFI3B.js} +11 -11
  83. package/dist/bundle/{command-server-entry-XVUPTSSH.js → command-server-entry-472XWNSN.js} +66 -50
  84. package/dist/bundle/{decode-METZOSMG.js → decode-SFZ67QJN.js} +2 -2
  85. package/dist/bundle/{echarts-EBSP4VCK.js → echarts-3U34KH7O.js} +2 -2
  86. package/dist/bundle/{embed-GVVU7N7W.js → embed-ZEZXJ45Q.js} +3 -3
  87. package/dist/bundle/{embedder-6BZOYAXV.js → embedder-AASO2I4Z.js} +6 -6
  88. package/dist/bundle/{entry-TBOYUMWB.js → entry-7VHMR3LD.js} +5 -5
  89. package/dist/bundle/failure-DJSK3LGN.js +69 -0
  90. package/dist/bundle/{first-run-HQ4GA4EF.js → first-run-YL3TIUU3.js} +5 -5
  91. package/dist/bundle/{first-screen-6T65PQ37.js → first-screen-OQVOWRYM.js} +12 -12
  92. package/dist/bundle/{instructions-VDKK3Y5Z.js → instructions-HG2ZZ7AP.js} +1 -1
  93. package/dist/bundle/{mcp-DEY765VA.js → mcp-EUFDOVMI.js} +35 -35
  94. package/dist/bundle/memo.js +8 -8
  95. package/dist/bundle/{node-HWGZYNUX.js → node-7AQN6OTR.js} +2 -2
  96. package/dist/bundle/{node-sqlite-PSYENWGS.js → node-sqlite-55KMFPGI.js} +3 -3
  97. package/dist/bundle/{oauth-TQGMUJK2.js → oauth-S2GLD4PY.js} +4 -4
  98. package/dist/bundle/{open-KDDJDKCE.js → open-6R4UPST5.js} +2 -2
  99. package/dist/bundle/{openai-QPGCUM4T.js → openai-JK5GCSDK.js} +7 -7
  100. package/dist/bundle/{process-APNTXJJE.js → process-C7J3IT7Q.js} +1 -1
  101. package/dist/bundle/{program-OGDARQTX.js → program-KWI6M5IB.js} +354 -151
  102. package/dist/bundle/{prompt-BMBZCLGF.js → prompt-EEFKVWSA.js} +2 -2
  103. package/dist/bundle/{recognize-3SEY2MAR.js → recognize-STYHVWQ6.js} +1 -1
  104. package/dist/bundle/{remote-ODH54UXO.js → remote-6MXZXHYY.js} +4 -4
  105. package/dist/bundle/{rerank-JQHBNTUK.js → rerank-IMX2ONZG.js} +4 -4
  106. package/dist/bundle/{serve-C22ZONSM.js → serve-ZNN464BH.js} +6 -6
  107. package/dist/bundle/server-4CHUUMVI.js +48 -0
  108. package/dist/bundle/{server-ADPO4V4B.js → server-L6OS2MJ5.js} +53 -52
  109. package/dist/bundle/server-VCZCAQOB.js +62 -0
  110. package/dist/bundle/{state-M3VGXSV4.js → state-7MP4KKPG.js} +3 -3
  111. package/dist/bundle/{store-GSZAXU3A.js → store-EMAKEEYI.js} +9 -9
  112. package/dist/bundle/store-maintenance-command-LWN6OUFA.js +47 -0
  113. package/dist/bundle/update-I4X2UO6J.js +72 -0
  114. package/dist/digest/backfill.d.ts.map +1 -1
  115. package/dist/digest/backfill.js +2 -1
  116. package/dist/digest/backfill.js.map +1 -1
  117. package/dist/digest/digest-commands.d.ts.map +1 -1
  118. package/dist/digest/digest-commands.js +2 -1
  119. package/dist/digest/digest-commands.js.map +1 -1
  120. package/dist/doctor/command.d.ts.map +1 -1
  121. package/dist/doctor/command.js +2 -1
  122. package/dist/doctor/command.js.map +1 -1
  123. package/dist/examples.d.ts.map +1 -1
  124. package/dist/examples.js +13 -1
  125. package/dist/examples.js.map +1 -1
  126. package/dist/exit-code.d.ts +7 -0
  127. package/dist/exit-code.d.ts.map +1 -0
  128. package/dist/exit-code.js +19 -0
  129. package/dist/exit-code.js.map +1 -0
  130. package/dist/facts/command.d.ts.map +1 -1
  131. package/dist/facts/command.js +3 -2
  132. package/dist/facts/command.js.map +1 -1
  133. package/dist/facts/fact.d.ts +1 -1
  134. package/dist/facts/fact.d.ts.map +1 -1
  135. package/dist/facts/fact.js +3 -3
  136. package/dist/facts/fact.js.map +1 -1
  137. package/dist/mcp/catalogue.d.ts +3 -0
  138. package/dist/mcp/catalogue.d.ts.map +1 -1
  139. package/dist/mcp/catalogue.js +1 -0
  140. package/dist/mcp/catalogue.js.map +1 -1
  141. package/dist/memories/command.d.ts.map +1 -1
  142. package/dist/memories/command.js +3 -2
  143. package/dist/memories/command.js.map +1 -1
  144. package/dist/memories/memory.d.ts +1 -1
  145. package/dist/memories/memory.d.ts.map +1 -1
  146. package/dist/memories/memory.js +2 -2
  147. package/dist/memories/memory.js.map +1 -1
  148. package/dist/page.d.ts +14 -5
  149. package/dist/page.d.ts.map +1 -1
  150. package/dist/page.js +11 -5
  151. package/dist/page.js.map +1 -1
  152. package/dist/program.d.ts +3 -1
  153. package/dist/program.d.ts.map +1 -1
  154. package/dist/program.js +7 -1
  155. package/dist/program.js.map +1 -1
  156. package/dist/reasons.d.ts.map +1 -1
  157. package/dist/reasons.js +6 -0
  158. package/dist/reasons.js.map +1 -1
  159. package/dist/records/import.d.ts.map +1 -1
  160. package/dist/records/import.js +60 -5
  161. package/dist/records/import.js.map +1 -1
  162. package/dist/records/input.d.ts +6 -2
  163. package/dist/records/input.d.ts.map +1 -1
  164. package/dist/records/input.js +87 -3
  165. package/dist/records/input.js.map +1 -1
  166. package/dist/run/import.d.ts.map +1 -1
  167. package/dist/run/import.js +2 -1
  168. package/dist/run/import.js.map +1 -1
  169. package/dist/sources/command.d.ts.map +1 -1
  170. package/dist/sources/command.js +27 -2
  171. package/dist/sources/command.js.map +1 -1
  172. package/dist/sources/read.d.ts +13 -0
  173. package/dist/sources/read.d.ts.map +1 -1
  174. package/dist/sources/read.js +27 -1
  175. package/dist/sources/read.js.map +1 -1
  176. package/dist/version.d.ts +1 -1
  177. package/dist/version.js +1 -1
  178. package/package.json +2 -2
  179. package/dist/bundle/auto-AQAKW55Z.js +0 -89
  180. package/dist/bundle/chunk-XPCTY6XV.js +0 -116
  181. package/dist/bundle/failure-EKMEAYZH.js +0 -69
  182. package/dist/bundle/server-3UX245DY.js +0 -62
  183. package/dist/bundle/server-6G5XF3V5.js +0 -48
  184. package/dist/bundle/store-maintenance-command-QMTALGSQ.js +0 -47
  185. package/dist/bundle/update-HDJ23IV5.js +0 -72
  186. /package/dist/bundle/{chunk-IXSUVHW6.js → chunk-IKIYW7FW.js} +0 -0
@@ -6,18 +6,18 @@ import {
6
6
  autoState,
7
7
  lastAutoRun,
8
8
  recordAutoRun
9
- } from "./chunk-ZP2XI5DR.js";
9
+ } from "./chunk-AI6PMW7L.js";
10
10
  import {
11
11
  installer,
12
12
  latest,
13
13
  upgradeCommand
14
- } from "./chunk-2QND7VJS.js";
14
+ } from "./chunk-ZHAHSVQO.js";
15
15
  import {
16
16
  mcpOwnerAllowed,
17
17
  memoLevels,
18
18
  readOnlyAvailability,
19
19
  refuseWritesUnderLock
20
- } from "./chunk-346PWQJF.js";
20
+ } from "./chunk-RTSRESGX.js";
21
21
  import {
22
22
  answers,
23
23
  atDetail,
@@ -29,18 +29,21 @@ import {
29
29
  trackAnswers,
30
30
  wholeList,
31
31
  withStore
32
- } from "./chunk-7Y4HUYI3.js";
32
+ } from "./chunk-4DTJF6E7.js";
33
33
  import {
34
34
  ATTACHMENT_CHARS,
35
35
  DIALECTS,
36
36
  MEMO_SETTINGS,
37
37
  NOTE_EXTENSIONS,
38
38
  OWED_DAYS,
39
+ TABLE_RECORD_TYPES,
40
+ TableError,
39
41
  attachmentsText,
40
42
  bulkTriage,
41
43
  configPath,
42
44
  decisionPolicy,
43
45
  dialectOf,
46
+ envelopeOfCsv,
44
47
  grantedLevel,
45
48
  hitText,
46
49
  inspectConfig,
@@ -56,20 +59,22 @@ import {
56
59
  noteFiles,
57
60
  rawConfig,
58
61
  readMemoId,
62
+ recordColumns,
63
+ recordTemplate,
59
64
  scheduleLimits,
60
65
  searchMail,
61
66
  showMail,
62
67
  unsetConfigKey,
63
68
  updateConfig
64
- } from "./chunk-W64FO6DD.js";
69
+ } from "./chunk-MFQTOOHR.js";
65
70
  import "./chunk-QP3KNC5D.js";
66
- import "./chunk-YB4KGUXY.js";
67
- import "./chunk-4KDORB7C.js";
68
- import "./chunk-NR633L2N.js";
71
+ import "./chunk-VFJAGY3L.js";
72
+ import "./chunk-6YRVBXFH.js";
73
+ import "./chunk-DDSKTPU7.js";
69
74
  import {
70
75
  errorObject,
71
76
  recognisable
72
- } from "./chunk-5CTOWPOL.js";
77
+ } from "./chunk-47WS4BML.js";
73
78
  import {
74
79
  AGENT_INPUT_MAX_CHARS,
75
80
  DISCOVERY_DESCRIPTIONS,
@@ -137,34 +142,34 @@ import {
137
142
  thisMachine,
138
143
  withSqliteSidecars,
139
144
  writeSchedule
140
- } from "./chunk-FGMFJUHR.js";
141
- import "./chunk-E74VWHZ2.js";
145
+ } from "./chunk-V6CRCAWN.js";
146
+ import "./chunk-TPWAXJUQ.js";
142
147
  import "./chunk-KA5MDFLU.js";
143
- import "./chunk-BDVM5652.js";
148
+ import "./chunk-3PLYUZAR.js";
144
149
  import {
145
150
  allHitItem,
146
151
  coverageGaps,
147
152
  messageHitItem,
148
153
  noteHitItem,
149
154
  shownOf
150
- } from "./chunk-VFKCZJFT.js";
151
- import "./chunk-YLYZNPAZ.js";
155
+ } from "./chunk-6RPLAGAL.js";
156
+ import "./chunk-42UNPXTC.js";
152
157
  import {
153
158
  REASONS as REASONS2,
154
159
  SKILL_TARGETS,
155
160
  skillCommand,
156
161
  skillPath,
157
162
  skillVersion
158
- } from "./chunk-C6MWOBEL.js";
159
- import "./chunk-LX3OSTBD.js";
163
+ } from "./chunk-RLRKBPLJ.js";
164
+ import "./chunk-N2FIIVJV.js";
160
165
  import {
161
166
  recoveryNotes,
162
167
  storeInfo,
163
168
  storeRecoveryCheck,
164
169
  storeRecoveryRun,
165
170
  storeSummary
166
- } from "./chunk-AOHT5FNX.js";
167
- import "./chunk-4XI7S3PO.js";
171
+ } from "./chunk-XGPSFPLH.js";
172
+ import "./chunk-YSOTOUHJ.js";
168
173
  import {
169
174
  LIST_QUERY_GUIDE,
170
175
  RESOURCES_SEARCHED,
@@ -240,31 +245,31 @@ import {
240
245
  timeLimit,
241
246
  typedQuery,
242
247
  withQuery
243
- } from "./chunk-6VMIMAZ2.js";
248
+ } from "./chunk-GB64N6DP.js";
244
249
  import {
245
250
  readBoundedUtf8File,
246
251
  writeFileAtomic
247
- } from "./chunk-6I4DOBSD.js";
252
+ } from "./chunk-OEH5JUAL.js";
248
253
  import {
249
254
  releaseLock,
250
255
  servingProfiles,
251
256
  takeLock
252
- } from "./chunk-ZL63GL3Y.js";
253
- import "./chunk-ZTZLAGZA.js";
257
+ } from "./chunk-PFNEOHCY.js";
258
+ import "./chunk-NM4QMIOQ.js";
254
259
  import {
255
260
  commandsText,
256
261
  inSection,
257
262
  installHelp
258
- } from "./chunk-WZHCQ4VZ.js";
263
+ } from "./chunk-7PSGKP3R.js";
259
264
  import "./chunk-HTQTIKWP.js";
260
- import "./chunk-EWRHTZD3.js";
265
+ import "./chunk-YRJ2576I.js";
261
266
  import {
262
267
  isNewer
263
268
  } from "./chunk-KEBL3PY4.js";
264
269
  import "./chunk-OYKQX4H3.js";
265
- import "./chunk-OWUEEVF6.js";
266
- import "./chunk-XPSXVUZG.js";
267
- import "./chunk-E2PSOSTN.js";
270
+ import "./chunk-YNXQAB4X.js";
271
+ import "./chunk-H3WELZYK.js";
272
+ import "./chunk-5AQIET5P.js";
268
273
  import {
269
274
  EVIDENCE_FINDINGS_KIND,
270
275
  MAIL_FINDINGS_KIND,
@@ -304,11 +309,11 @@ import {
304
309
  refLabel,
305
310
  storedProfilesFor,
306
311
  writesWithOf
307
- } from "./chunk-ZISVFVQU.js";
308
- import "./chunk-MPZBV5RL.js";
309
- import "./chunk-XQ3RZU3J.js";
310
- import "./chunk-SJD4KTK2.js";
311
- import "./chunk-SIOPF2UG.js";
312
+ } from "./chunk-2KGYREGD.js";
313
+ import "./chunk-DUON3SRD.js";
314
+ import "./chunk-GBU4U55M.js";
315
+ import "./chunk-LLBZDBPT.js";
316
+ import "./chunk-YD7XTYEC.js";
312
317
  import {
313
318
  provideTerminal,
314
319
  terminalOf
@@ -318,15 +323,15 @@ import {
318
323
  REASONS,
319
324
  STORE_CLIENT,
320
325
  VERSION
321
- } from "./chunk-GFVSZY4J.js";
326
+ } from "./chunk-TGURQ4YH.js";
322
327
  import "./chunk-NT5IOEEK.js";
323
328
  import "./chunk-D72URWJE.js";
324
- import "./chunk-XPCTY6XV.js";
325
- import "./chunk-6FTZ53TT.js";
326
- import "./chunk-QYJJBE56.js";
327
- import "./chunk-UIAGASGP.js";
328
- import "./chunk-SCYHDYLI.js";
329
- import "./chunk-G45BLLDR.js";
329
+ import "./chunk-4IWOPJL4.js";
330
+ import "./chunk-HAMGOLFU.js";
331
+ import "./chunk-Y7YXXWQI.js";
332
+ import "./chunk-C7OOLF5J.js";
333
+ import "./chunk-3NCRQMEN.js";
334
+ import "./chunk-O3KNZVDZ.js";
330
335
  import {
331
336
  Command,
332
337
  DEFAULT_TEXT_MODEL,
@@ -366,11 +371,11 @@ import {
366
371
  snakeKeys,
367
372
  textModels,
368
373
  textModelsFile
369
- } from "./chunk-XMHWGHID.js";
370
- import "./chunk-UU3OAPGO.js";
371
- import "./chunk-6AOPUQTC.js";
372
- import "./chunk-XQHOMQNZ.js";
373
- import "./chunk-KUFOM3SB.js";
374
+ } from "./chunk-ODCHYVTW.js";
375
+ import "./chunk-SF2OLWBU.js";
376
+ import "./chunk-TD4HM7XL.js";
377
+ import "./chunk-EVLOYNXC.js";
378
+ import "./chunk-S54Z74G2.js";
374
379
  import {
375
380
  CATALOG_KINDS,
376
381
  CATEGORIES,
@@ -443,15 +448,15 @@ import {
443
448
  timezoneOf,
444
449
  validateQuery,
445
450
  walkQuery
446
- } from "./chunk-JINEHQ2T.js";
447
- import "./chunk-VB4OLJHK.js";
448
- import "./chunk-4QGUBKN5.js";
451
+ } from "./chunk-FUATAPSB.js";
452
+ import "./chunk-7XFJRX6F.js";
453
+ import "./chunk-TXVXEE7L.js";
449
454
  import {
450
455
  sharedModelsDirectory
451
- } from "./chunk-SIQDO5DN.js";
456
+ } from "./chunk-OJU774SG.js";
452
457
  import {
453
458
  storePath
454
- } from "./chunk-LPGE6ACC.js";
459
+ } from "./chunk-FH753LZS.js";
455
460
  import "./chunk-G5GW3FFJ.js";
456
461
  import {
457
462
  Credentials,
@@ -874,7 +879,7 @@ var readScope = /* @__PURE__ */ __name((command, help = ONE_ACCOUNT_HELP) => sou
874
879
  var writeScope = /* @__PURE__ */ __name((command, help) => writeOptions(command, help).option("--json", "print JSON; --json=id,title keeps only those fields"), "writeScope");
875
880
  var jsonOption = /* @__PURE__ */ __name((command, fields = "ref,title") => command.option("--json", `print JSON; --json=${fields} keeps only those fields`), "jsonOption");
876
881
 
877
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/sender-scores.js
882
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/sender-scores.js
878
883
  var SCORED = "mail_sender_scores";
879
884
  var DAY = 864e5;
880
885
  var RECENT = 2 * 365 * DAY;
@@ -890,7 +895,7 @@ var demotedSenders = /* @__PURE__ */ __name(async (store) => {
890
895
  return senders;
891
896
  }, "demotedSenders");
892
897
 
893
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/mail/sync.js
898
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/mail/sync.js
894
899
  var DAY2 = 864e5;
895
900
  var EDGE = 2 * DAY2;
896
901
 
@@ -1293,13 +1298,18 @@ var decideOne = /* @__PURE__ */ __name(async (store, env, id, decision) => {
1293
1298
  }, "decideOne");
1294
1299
 
1295
1300
  // dist/page.js
1296
- var pageOf = /* @__PURE__ */ __name(async (command, limit, read, { fallback = 100, cap = 500 } = {}) => {
1301
+ var pageOf = /* @__PURE__ */ __name(async (command, limit, read, { fallback = 100, cap = 500, page, args, shape = /* @__PURE__ */ __name((rows) => rows, "shape") } = {}) => {
1297
1302
  const wanted = Math.min(limit ?? fallback, cap);
1298
- const rows = await read(Math.min(wanted + 1, cap));
1303
+ const offset = ((page ?? 1) - 1) * wanted;
1304
+ const rows = await read(Math.min(wanted + 1, cap), offset);
1305
+ const full = rows.length === cap && wanted === cap;
1306
+ const more = rows.length > wanted || full && (page === void 0 || (await read(1, offset + cap)).length > 0);
1299
1307
  return listAnswer(command, {
1300
- items: rows.slice(0, wanted),
1308
+ items: await shape(rows.slice(0, wanted)),
1301
1309
  limit: wanted,
1302
- has_more: rows.length > wanted || rows.length === cap
1310
+ has_more: more,
1311
+ ...page === void 0 ? {} : { page },
1312
+ ...args === void 0 ? {} : { args }
1303
1313
  });
1304
1314
  }, "pageOf");
1305
1315
 
@@ -1461,8 +1471,8 @@ var actionItems = /* @__PURE__ */ __name(async (store, actions, { brief = false
1461
1471
  }, "actionItems");
1462
1472
  var listActions = /* @__PURE__ */ __name((store, query, limit, options = {}) => {
1463
1473
  const status = queryTerms(query, ACTION_QUERY, "actions list").get("status");
1464
- const { keep: keep2 = /* @__PURE__ */ __name(async (rows) => rows, "keep"), ...shown3 } = options;
1465
- return pageOf("actions list", limit, async (most) => actionItems(store, await keep2(await store.proposedActions.list({ limit: most, ...status === void 0 ? {} : { status } })), shown3));
1474
+ const { keep: keep2 = /* @__PURE__ */ __name(async (rows) => rows, "keep"), page, ...shown3 } = options;
1475
+ return pageOf("actions list", limit, (most, offset) => store.proposedActions.list({ limit: most, offset, ...status === void 0 ? {} : { status } }), { page, args: { query: typedQuery(query) }, shape: /* @__PURE__ */ __name(async (rows) => actionItems(store, await keep2(rows), shown3), "shape") });
1466
1476
  }, "listActions");
1467
1477
  var showAction = /* @__PURE__ */ __name(async (store, id) => (await actionItems(store, [await store.proposedActions.get(id)]))[0], "showAction");
1468
1478
  var BATCHES = {
@@ -1534,8 +1544,9 @@ var actionsCommand = /* @__PURE__ */ __name((program, streams, env) => {
1534
1544
  const key = await writeAccount(store, env, { account: account2 }, (text3) => streams.diagnostic(text3));
1535
1545
  return itemAnswer(await propose(store, env, { ...options, ...key, kind }, by));
1536
1546
  }));
1537
- withQuery(annotate(actions.command("list"), { effects: LOCAL_READ, output: { entity: "proposed_action" } }).description("proposed actions, newest first"), ACTION_QUERY).option("--limit <n>", "most actions, up to 500", positive, 100).option("--brief", "without each findings batch's cited sources").option("--json", "print JSON; --json=id,title keeps only those fields").action((words, options) => run(options.json, async (store) => stripped(store, env, await listActions(store, words, options.limit, {
1547
+ withQuery(annotate(actions.command("list"), { effects: LOCAL_READ, output: { entity: "proposed_action" } }).description("proposed actions, newest first"), ACTION_QUERY).option("--limit <n>", "most actions on a page, up to 500", positive, 100).option("--page <n>", "which page, from 1", positive, 1).option("--brief", "without each findings batch's cited sources").option("--json", "print JSON; --json=id,title keeps only those fields").action((words, options) => run(options.json, async (store) => stripped(store, env, await listActions(store, words, options.limit, {
1538
1548
  brief: options.brief === true,
1549
+ page: options.page,
1539
1550
  keep: /* @__PURE__ */ __name((rows) => actionsIn(store, env, rows), "keep")
1540
1551
  }))));
1541
1552
  annotate(actions.command("show"), { effects: LOCAL_READ }).description("one proposed action; a findings batch with its fingerprint and sources").argument("<id>", "the action's id, as actions list gives it").option("--json", "print JSON; --json=id,title keeps only those fields").action((id, options) => run(options.json, async (store) => {
@@ -1575,22 +1586,23 @@ var AGENT_LOG_QUERY = {
1575
1586
  termField("agent", "kw", "agent:tg-mcp", { relation: "the calls of this agent, as actor.name names it" })
1576
1587
  ]
1577
1588
  };
1578
- var listAgentActions = /* @__PURE__ */ __name((store, query, limit) => {
1589
+ var listAgentActions = /* @__PURE__ */ __name((store, query, limit, page) => {
1579
1590
  const terms2 = queryTerms(query, AGENT_LOG_QUERY, "agents list");
1580
1591
  const tool = terms2.get("tool");
1581
1592
  const agent = terms2.get("agent");
1582
- return pageOf("agents list", limit, (most) => store.agentActions.list({
1593
+ return pageOf("agents list", limit, (most, offset) => store.agentActions.list({
1583
1594
  ...tool === void 0 ? {} : { tool },
1584
1595
  ...agent === void 0 ? {} : { agent },
1585
- limit: most
1586
- }));
1596
+ limit: most,
1597
+ offset
1598
+ }), { page, args: { query: typedQuery(query) } });
1587
1599
  }, "listAgentActions");
1588
1600
 
1589
1601
  // dist/agents/command.js
1590
1602
  var agentsCommand = /* @__PURE__ */ __name((program, streams, env) => {
1591
1603
  const { run } = answers(program, streams, env);
1592
1604
  const agents = program.command("agents").description("what agents did through the MCP servers that share the store");
1593
- withQuery(annotate(agents.command("list"), { effects: LOCAL_READ, output: { entity: "agent_action" } }).summary("one row per tool call, newest first: agent, tool, outcome and times").description("one row per tool call, newest first: agent, tool, tier, outcome and times, never its arguments"), AGENT_LOG_QUERY).option("--limit <n>", "most rows, up to 500", positive, 100).option("--json", "print JSON; --json=id,title keeps only those fields").action((words, options) => run(options.json, (store) => listAgentActions(store, words, options.limit)));
1605
+ withQuery(annotate(agents.command("list"), { effects: LOCAL_READ, output: { entity: "agent_action" } }).summary("one row per tool call, newest first: agent, tool, outcome and times").description("one row per tool call, newest first: agent, tool, tier, outcome and times, never its arguments"), AGENT_LOG_QUERY).option("--limit <n>", "most rows on a page, up to 500", positive, 100).option("--page <n>", "which page, from 1", positive, 1).option("--json", "print JSON; --json=id,title keeps only those fields").action((words, options) => run(options.json, (store) => listAgentActions(store, words, options.limit, options.page)));
1594
1606
  }, "agentsCommand");
1595
1607
 
1596
1608
  // dist/refs.js
@@ -2328,7 +2340,7 @@ import { createHash } from "node:crypto";
2328
2340
  import { existsSync, readFileSync as readFileSync2, statSync } from "node:fs";
2329
2341
  import { basename, extname, relative, sep } from "node:path";
2330
2342
 
2331
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/services/documents/extraction.js
2343
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/services/documents/extraction.js
2332
2344
  var Proposal = object({
2333
2345
  kind: picklist(["summary", "digest", "fact", "preference"]),
2334
2346
  body: pipe(string(), trim(), minLength(1), maxLength(15e3)),
@@ -2336,13 +2348,13 @@ var Proposal = object({
2336
2348
  });
2337
2349
  var Proposals = object({ items: pipe(array(Proposal), maxLength(20)) });
2338
2350
 
2339
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/services/documents/mirrors.js
2351
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/services/documents/mirrors.js
2340
2352
  var ID = pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/));
2341
2353
 
2342
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/services/documents/sync.js
2354
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/services/documents/sync.js
2343
2355
  var MAX_PICTURE_BYTES = 25 * 1024 * 1024;
2344
2356
 
2345
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/fetch/addresses.js
2357
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/fetch/addresses.js
2346
2358
  import { isIP } from "node:net";
2347
2359
  var within3 = /* @__PURE__ */ __name((address, [prefix, bits]) => {
2348
2360
  for (let bit = 0; bit < bits; bit++) {
@@ -2413,7 +2425,7 @@ var isPublicAddress = /* @__PURE__ */ __name((address) => {
2413
2425
  return within3(bytes, [[32], 3]) && !V6_PRIVATE.some((prefix) => within3(bytes, prefix));
2414
2426
  }, "isPublicAddress");
2415
2427
 
2416
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/fetch/page.js
2428
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/fetch/page.js
2417
2429
  import { lookup as dnsLookup } from "node:dns/promises";
2418
2430
  import { request as httpRequest } from "node:http";
2419
2431
  import { request as httpsRequest } from "node:https";
@@ -4773,6 +4785,25 @@ var SHELL_OVERRIDES = { search, doctor, skill, mcp, commands, notes, meetings };
4773
4785
  import { existsSync as existsSync9, readdirSync as readdirSync5 } from "node:fs";
4774
4786
  import { join as join8 } from "node:path";
4775
4787
 
4788
+ // dist/exit-code.js
4789
+ var setters = /* @__PURE__ */ new WeakMap();
4790
+ var rootOf = /* @__PURE__ */ __name((command) => {
4791
+ let root = command;
4792
+ while (root.parent)
4793
+ root = root.parent;
4794
+ return root;
4795
+ }, "rootOf");
4796
+ var keepExitCode = /* @__PURE__ */ __name((program, set) => {
4797
+ setters.set(program, set);
4798
+ }, "keepExitCode");
4799
+ var setExitCode = /* @__PURE__ */ __name((command, code) => {
4800
+ const set = setters.get(rootOf(command));
4801
+ if (set)
4802
+ set(code);
4803
+ else
4804
+ process.exitCode = code;
4805
+ }, "setExitCode");
4806
+
4776
4807
  // dist/digest/brief.js
4777
4808
  import { spawnSync } from "node:child_process";
4778
4809
  import { existsSync as existsSync4, mkdtempSync, readFileSync as readFileSync5, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "node:fs";
@@ -6534,7 +6565,7 @@ var digestCommands = /* @__PURE__ */ __name((digest, print, env) => {
6534
6565
  return;
6535
6566
  }
6536
6567
  if (last.exitCode !== 0)
6537
- process.exitCode = 1;
6568
+ setExitCode(command, 1);
6538
6569
  print(given2.json, itemAnswer({ name: name2, ...last }), `${name2}: ${last.exitCode === 0 ? "built" : `failed (exit ${last.exitCode})`} \u2014 ${last.output}`);
6539
6570
  });
6540
6571
  for (const [verb, paused] of [
@@ -6667,7 +6698,7 @@ var digestCommand = /* @__PURE__ */ __name((program, streams, env) => {
6667
6698
  }
6668
6699
  const costUsd = cents(built.reduce((sum, one2) => sum + (one2.costUsd ?? 0), 0));
6669
6700
  if (built.some((one2) => one2.exitCode !== 0))
6670
- process.exitCode = 1;
6701
+ setExitCode(command, 1);
6671
6702
  print(given2.json, itemAnswer({ ...estimate, built, left, costUsd }), [
6672
6703
  ...built.map((one2) => `${one2.date}: ${one2.exitCode === 0 ? "built" : `failed (exit ${one2.exitCode})`}${one2.costUsd === null ? "" : `, ${usd(one2.costUsd)}`}`),
6673
6704
  ...skipped.length ? [`Skipped, a digest exists: ${skipped.join(", ")}.`] : [],
@@ -6916,7 +6947,7 @@ var doctorCommandDefinition = /* @__PURE__ */ __name((program, streams, env) =>
6916
6947
  for (const fix of fixes)
6917
6948
  streams.diagnostic(`to make it private: ${fix}`);
6918
6949
  if (diagnosis.problems.length > 0)
6919
- process.exitCode = 1;
6950
+ setExitCode(program, 1);
6920
6951
  });
6921
6952
  }, "doctorCommandDefinition");
6922
6953
  var doctorCommand = /* @__PURE__ */ __name((...args) => {
@@ -6929,7 +6960,7 @@ var doctorCommand = /* @__PURE__ */ __name((...args) => {
6929
6960
  }, SHELL_OVERRIDES.doctor);
6930
6961
  }, "doctorCommand");
6931
6962
 
6932
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/calendar/sync.js
6963
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/calendar/sync.js
6933
6964
  var DAY8 = 864e5;
6934
6965
  var SLOTS_EVERY = 7 * DAY8;
6935
6966
  var isWindow = /* @__PURE__ */ __name((value) => typeof value?.from === "number" && typeof value.to === "number", "isWindow");
@@ -7009,10 +7040,10 @@ var calendarStatus = /* @__PURE__ */ __name(async (store, accountId, { profile,
7009
7040
  return { items, page: 1, limit: Math.max(1, items.length), hasMore: false };
7010
7041
  }, "calendarStatus");
7011
7042
 
7012
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/calendar/feeds.js
7043
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/calendar/feeds.js
7013
7044
  var FEED_LIMITS = { maxBytes: 10 * 1024 * 1024, timeoutMs: 3e4, redirects: 5 };
7014
7045
 
7015
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/calendar/reads.js
7046
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/calendar/reads.js
7016
7047
  var LIST = "events list";
7017
7048
  var EVENT_TYPES = [
7018
7049
  "default",
@@ -7089,7 +7120,7 @@ var accountsMeta = /* @__PURE__ */ __name(async (store, accounts, skipped, now)
7089
7120
  };
7090
7121
  }, "accountsMeta");
7091
7122
 
7092
- // node_modules/.pnpm/@wirecat+cli-core@0.624.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_845871b12d72ec55150c07203d8cbfbb/node_modules/@wirecat/cli-core/dist/calendar/writer.js
7123
+ // node_modules/.pnpm/@wirecat+cli-core@0.627.0_@wirecat+cli-base@0.95.0_commander@15.0.0_esbuild@0.28.2_type_6a3445916b5ce0182fa072182fe8aa66/node_modules/@wirecat/cli-core/dist/calendar/writer.js
7093
7124
  var EVENTS_NOTIFY_KEY = "events.notify";
7094
7125
  var EVENTS_DELETE_SERIES_KEY = "events.delete.series";
7095
7126
  var EVENTS_REMIND_HOOK_KEY = "events.remind.hook";
@@ -7332,6 +7363,10 @@ var EXAMPLES = {
7332
7363
  "memo sources add https://example.org/release-notes --title 'Release notes' --json",
7333
7364
  "memo sources add - --title 'Call with Kai' --subject person:12"
7334
7365
  ],
7366
+ "sources preview": [
7367
+ "memo sources preview https://example.org/release-notes",
7368
+ "memo sources preview https://example.org/release-notes --json=title,excerpt"
7369
+ ],
7335
7370
  "sources suggest": [
7336
7371
  "memo sources suggest document:42",
7337
7372
  "memo sources suggest document:42 --subject person:12 --json",
@@ -7632,7 +7667,15 @@ var EXAMPLES = {
7632
7667
  "memo records import envelope.json --account rentals --json",
7633
7668
  "memo records import contacts.vcf --account phone:pixel --region gb"
7634
7669
  ],
7635
- "records check": ["memo records check - --account rentals"],
7670
+ "records check": [
7671
+ "memo records check - --account rentals",
7672
+ "memo records check invoices.csv --type invoice --account sheet:rentals"
7673
+ ],
7674
+ "records templates list": ["memo records templates list --json", "memo records templates list type:invoice"],
7675
+ "records templates show": [
7676
+ "memo records templates show invoice --locale ru",
7677
+ "memo records templates show invoice --format json --account sheet:rentals"
7678
+ ],
7636
7679
  "records list": [
7637
7680
  "memo records list waiting:true --account sheet:rentals",
7638
7681
  "memo records list type:organization --account sheet:rentals --json",
@@ -7920,7 +7963,7 @@ var memoryItem = /* @__PURE__ */ __name(({ body, ...memory }) => ({
7920
7963
  createdAt: memory.createdAt,
7921
7964
  updatedAt: memory.updatedAt
7922
7965
  }), "memoryItem");
7923
- var listMemories = /* @__PURE__ */ __name(async (store, query, limit) => {
7966
+ var listMemories = /* @__PURE__ */ __name(async (store, query, limit, page) => {
7924
7967
  const terms2 = queryTerms(query, MEMORY_QUERY, "memories list");
7925
7968
  const project = terms2.get("project");
7926
7969
  const filters = {
@@ -7930,7 +7973,7 @@ var listMemories = /* @__PURE__ */ __name(async (store, query, limit) => {
7930
7973
  ...terms2.has("subject") ? { subject: terms2.get("subject") } : {},
7931
7974
  ...project === void 0 ? {} : { project: await canonicalProject(store, project) }
7932
7975
  };
7933
- return pageOf("memories list", limit, async (most) => (await store.memories.list({ ...filters, limit: most })).map(memoryItem));
7976
+ return pageOf("memories list", limit, async (most, offset) => (await store.memories.list({ ...filters, limit: most, offset })).map(memoryItem), { page, args: { query: typedQuery(query) } });
7934
7977
  }, "listMemories");
7935
7978
  var SEARCH = { command: "search memories", guide: LIST_QUERY_GUIDE };
7936
7979
  var MEMORY_FIELDS = /* @__PURE__ */ new Set(["text", ...MEMORY_QUERY.fields.map(({ name: name2 }) => name2)]);
@@ -8055,7 +8098,7 @@ var memoriesCommand = /* @__PURE__ */ __name((program, streams, env) => {
8055
8098
  ...options.supersedes === void 0 ? {} : { supersedes: options.supersedes }
8056
8099
  }, await by).catch(explainQuote))));
8057
8100
  });
8058
- withQuery(annotate(memories.command("list"), { effects: LOCAL_READ }).description("memories, newest first"), MEMORY_QUERY).option("--limit <n>", "most memories, up to 500", positive, 100).option("--json", "print JSON; --json=id,title keeps only those fields").action((words, { json: json5, limit }) => run(json5, async (store) => stripped(store, env, await listMemories(store, words, limit))));
8101
+ withQuery(annotate(memories.command("list"), { effects: LOCAL_READ }).description("memories, newest first"), MEMORY_QUERY).option("--limit <n>", "most memories on a page, up to 500", positive, 100).option("--page <n>", "which page, from 1", positive, 1).option("--json", "print JSON; --json=id,title keeps only those fields").action((words, { json: json5, limit, page }) => run(json5, async (store) => stripped(store, env, await listMemories(store, words, limit, page))));
8059
8102
  annotate(memories.command("show"), { effects: LOCAL_READ, output: { entity: "memory" } }).description("one memory with its evidence").argument("<ref>", "memory:<id>").option("--sources", "read each piece of evidence back: who, when, a short excerpt, and whether it is gone").option("--json", "print JSON; --json=id,title keeps only those fields").action((ref, options) => run(options.json, async (store) => itemAnswer(await stripped(store, env, {
8060
8103
  ...memoryItem(await store.memories.get(ref)),
8061
8104
  ...options.sources ? await sourcesIn(store, env, await store.memories.sources(ref)) : {}
@@ -8127,7 +8170,7 @@ var factItem = /* @__PURE__ */ __name(({ type, statement, source, confirmedBy, .
8127
8170
  updated_at: fact.updatedAt,
8128
8171
  confirmed_by: confirmedBy
8129
8172
  }), "factItem");
8130
- var listFacts = /* @__PURE__ */ __name(async (store, query, limit) => {
8173
+ var listFacts = /* @__PURE__ */ __name(async (store, query, limit, page) => {
8131
8174
  const terms2 = queryTerms(query, FACT_QUERY, "facts list");
8132
8175
  const project = terms2.get("project");
8133
8176
  const filters = {
@@ -8136,7 +8179,7 @@ var listFacts = /* @__PURE__ */ __name(async (store, query, limit) => {
8136
8179
  ...project === void 0 ? {} : { project: await canonicalProject(store, project) },
8137
8180
  ...terms2.has("subject") ? { subject: terms2.get("subject") } : {}
8138
8181
  };
8139
- return pageOf("facts list", limit, async (most) => (await store.facts.list({ ...filters, limit: most })).map(factItem));
8182
+ return pageOf("facts list", limit, async (most, offset) => (await store.facts.list({ ...filters, limit: most, offset })).map(factItem), { page, args: { query: typedQuery(query) } });
8140
8183
  }, "listFacts");
8141
8184
 
8142
8185
  // dist/facts/facts.js
@@ -8177,7 +8220,7 @@ var factsCommand = /* @__PURE__ */ __name((program, streams, env) => {
8177
8220
  ...options.supersedes === void 0 ? {} : { supersedes: options.supersedes }
8178
8221
  }).catch(explainQuote))));
8179
8222
  });
8180
- withQuery(annotate(facts.command("list"), { effects: LOCAL_READ }).description("facts, latest first"), FACT_QUERY).option("--limit <n>", "most facts, up to 500", positive, 100).option("--json", "print JSON; --json=id,title keeps only those fields").action((words, { json: json5, limit }) => run(json5, async (store) => stripped(store, env, await listFacts(store, words, limit))));
8223
+ withQuery(annotate(facts.command("list"), { effects: LOCAL_READ }).description("facts, latest first"), FACT_QUERY).option("--limit <n>", "most facts on a page, up to 500", positive, 100).option("--page <n>", "which page, from 1", positive, 1).option("--json", "print JSON; --json=id,title keeps only those fields").action((words, { json: json5, limit, page }) => run(json5, async (store) => stripped(store, env, await listFacts(store, words, limit, page))));
8181
8224
  annotate(facts.command("show"), { effects: LOCAL_READ, output: { entity: "fact" } }).description("one fact with its evidence").argument("<ref>", "fact:<id>").option("--sources", "read each piece of evidence back: who, when, a short excerpt, and whether it is gone").option("--json", "print JSON; --json=id,title keeps only those fields").action((ref, options) => run(options.json, async (store) => itemAnswer(await stripped(store, env, {
8182
8225
  ...factItem(await store.facts.get(ref)),
8183
8226
  ...options.sources ? await sourcesIn(store, env, await store.facts.sources(ref)) : {}
@@ -10813,10 +10856,10 @@ var mcpCommandDefinition = /* @__PURE__ */ __name((program, streams, env, create
10813
10856
  }).summary("serve this profile's commands to an AI agent").description("serve memo commands over MCP on stdio or authenticated HTTP, limited by saved permissions").option("--permission <key=level>", "tighten one saved permission for this server; repeat for more keys", (value, previous = []) => [...previous, value]).option("--http", "serve on 127.0.0.1 behind an HTTPS tunnel with an owner access-code login").option("--port <port>", `local HTTP port (default ${DEFAULT_PORT}); requires --http`).option("--public-url <url>", "tunnel's HTTPS address without /mcp, or a path of it such as https://<name>.ts.net/memo; requires --http").action(async (options) => {
10814
10857
  if (!options.http && (options.port !== void 0 || options.publicUrl !== void 0))
10815
10858
  throw new CliError("validation_error", "--port and --public-url require --http");
10816
- const { createMemoServer } = await import("./server-ADPO4V4B.js");
10859
+ const { createMemoServer } = await import("./server-L6OS2MJ5.js");
10817
10860
  const build = /* @__PURE__ */ __name(() => createMemoServer(env, createProgram2, options.permission), "build");
10818
10861
  if (options.http) {
10819
- const { httpLockFile, mcpUrlOf, portOf, publicUrlOf, serveOverHttp } = await import("./mcp-DEY765VA.js");
10862
+ const { httpLockFile, mcpUrlOf, portOf, publicUrlOf, serveOverHttp } = await import("./mcp-EUFDOVMI.js");
10820
10863
  const publicUrl = publicUrlOf(options.publicUrl, {
10821
10864
  missing: "--http",
10822
10865
  reaches: "the browser apps reach memo",
@@ -10868,7 +10911,7 @@ var mcpCommandDefinition = /* @__PURE__ */ __name((program, streams, env, create
10868
10911
  });
10869
10912
  });
10870
10913
  annotate(mcp2.command("revoke"), { effects: LOCAL_WRITE, mcp: false, examples: ["memo mcp revoke --json"] }).summary("forget every login given to a browser app").description("forget every login `memo mcp serve --http` gave a browser app; each app must log in again").option("--json", "print JSON").action(async function() {
10871
- const { revokeAll } = await import("./mcp-DEY765VA.js");
10914
+ const { revokeAll } = await import("./mcp-EUFDOVMI.js");
10872
10915
  revokeAll(httpTokenFile(env));
10873
10916
  out.print(this.opts().json, itemAnswer({ revoked: true }));
10874
10917
  });
@@ -11961,7 +12004,66 @@ var peopleCommand = /* @__PURE__ */ __name((program, streams, env) => {
11961
12004
  }, "peopleCommand");
11962
12005
 
11963
12006
  // dist/records/input.js
11964
- import { open } from "node:fs/promises";
12007
+ import { open, readFile } from "node:fs/promises";
12008
+ import { basename as basename3 } from "node:path";
12009
+ import { text as streamText } from "node:stream/consumers";
12010
+
12011
+ // dist/records/mapping.js
12012
+ var RECORD_QUERY = {
12013
+ entity: "source_record",
12014
+ backend: "native",
12015
+ fields: [
12016
+ termField("type", "kw", "type:organization"),
12017
+ termField("waiting", "bool", "waiting:true"),
12018
+ termField("flagged", "bool", "flagged:true"),
12019
+ termField("unmatched", "bool", "unmatched:true"),
12020
+ termField("entity", "ref", 'entity:"organization:3"'),
12021
+ termField("batch", "kw", "batch:2026-11-07"),
12022
+ termField("deleted", "bool", "deleted:true")
12023
+ ]
12024
+ };
12025
+ var sourceOf5 = /* @__PURE__ */ __name((account2) => {
12026
+ const [provider = "", ...rest] = (account2 ?? "").trim().split(":");
12027
+ const name2 = rest.join(":");
12028
+ if (!provider || !name2)
12029
+ throw new CliError("validation_error", "name the source as --account <provider>:<account>, such as sheet:rentals", {
12030
+ param: "--account"
12031
+ });
12032
+ return { provider, account: name2 };
12033
+ }, "sourceOf");
12034
+ var recordOf = /* @__PURE__ */ __name((record2) => {
12035
+ const from = record2.startsWith("custom:") ? "custom:".length : 0;
12036
+ const at2 = record2.indexOf(":", from);
12037
+ if (at2 <= from || at2 === record2.length - 1)
12038
+ throw new CliError("validation_error", `${record2} is not <type>:<external_id>, such as organization:client or custom:quote:Q-7`, { param: "record" });
12039
+ return { type: record2.slice(0, at2), externalId: record2.slice(at2 + 1) };
12040
+ }, "recordOf");
12041
+ var RECORD_HELP = "<type>:<external_id> as the source names it, such as organization:client or custom:quote:Q-7";
12042
+ var ACCOUNT_HELP = "the source, <provider>:<account> as the envelope's source names it, such as sheet:rentals";
12043
+ var recordMappingCommands = /* @__PURE__ */ __name((records, program, streams, env) => {
12044
+ const { run } = answers(program, streams, env);
12045
+ withQuery(annotate(records.command("list"), { effects: LOCAL_READ }).description("a source's records, newest first; waiting:true lists those that wait for a record they name, unmatched:true the people, organizations and projects whose identifiers fit more than one of yours, entity: those mapped to one of your entries"), RECORD_QUERY).summary("a source's records; waiting:true lists what needs records link").option("--account <account>", ACCOUNT_HELP).option("--limit <n>", "most records, up to 500", positive, 100).option("--json", "print JSON; --json=type,external_id,entity keeps only those fields").action((words, given2) => run(given2.json, async (store) => {
12046
+ const source = sourceOf5(given2.account);
12047
+ const terms2 = queryTerms(words, RECORD_QUERY, "records list");
12048
+ const filter = {
12049
+ ...source,
12050
+ ...terms2.has("type") ? { type: terms2.get("type") } : {},
12051
+ ...terms2.get("waiting") === "true" ? { waiting: true } : {},
12052
+ ...terms2.get("flagged") === "true" ? { flagged: true } : {},
12053
+ ...terms2.get("unmatched") === "true" ? { unmatched: true } : {},
12054
+ ...terms2.has("entity") ? { entity: terms2.get("entity") } : {},
12055
+ ...terms2.has("batch") ? { batch: terms2.get("batch") } : {},
12056
+ ...terms2.has("deleted") ? { deleted: terms2.get("deleted") === "true" } : {}
12057
+ };
12058
+ return pageOf("records list", given2.limit, (most) => store.records.list({ ...filter, limit: most }));
12059
+ }));
12060
+ byOption(annotate(records.command("link"), { effects: LOCAL_WRITE, output: { entity: "source_record" } }).description("say which of your entries a source's record is (organization:client is organization:3); never done by name. Records that waited for it become proposals in memo review. Only you link; an agent is refused").summary("say which of your entries a source's record is").argument("<record>", RECORD_HELP).argument("<ref>", "your entry of the same type: person:<id>, organization:<id> or project:<id>").option("--account <account>", ACCOUNT_HELP).option("--json", "print JSON; --json=type,external_id,entity keeps only those fields")).action(async (record2, ref, given2, command) => {
12061
+ const by = await whoRuns(command, env, { asOwner: given2.asOwner, question: `link ${record2} to ${ref} as you?` });
12062
+ await run(given2.json, async (store) => itemAnswer(await store.records.map({ ...sourceOf5(given2.account), ...recordOf(record2) }, ref, by)));
12063
+ });
12064
+ }, "recordMappingCommands");
12065
+
12066
+ // dist/records/input.js
11965
12067
  var PHONE = "phone";
11966
12068
  var BOM = /^\uFEFF/;
11967
12069
  var errnoOf = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error ? String(error.code) : void 0, "errnoOf");
@@ -12011,7 +12113,9 @@ var deviceOf = /* @__PURE__ */ __name((given2) => {
12011
12113
  });
12012
12114
  return given2.slice(at2 + 1);
12013
12115
  }, "deviceOf");
12014
- var importRecords = /* @__PURE__ */ __name(async (store, { file, stdin, account: account2, dryRun, onIssue, region }) => {
12116
+ var importRecords = /* @__PURE__ */ __name(async (store, { file, stdin, account: account2, dryRun, onIssue, region, type }) => {
12117
+ if (type !== void 0 || file.toLowerCase().endsWith(".csv"))
12118
+ return importSheet(store, { file, stdin, account: account2, dryRun, onIssue, type });
12015
12119
  const iterator = (await linesOf(file, stdin))[Symbol.asyncIterator]();
12016
12120
  const before = [];
12017
12121
  let next = await iterator.next();
@@ -12071,61 +12175,77 @@ var importRecords = /* @__PURE__ */ __name(async (store, { file, stdin, account:
12071
12175
  const envelope = envelopeOfText(await whole2([first]));
12072
12176
  return ingest(store, envelope, { account: accountIn2(envelope, account2), dryRun, onIssue });
12073
12177
  }, "importRecords");
12074
-
12075
- // dist/records/mapping.js
12076
- var RECORD_QUERY = {
12077
- entity: "source_record",
12078
- backend: "native",
12079
- fields: [
12080
- termField("type", "kw", "type:organization"),
12081
- termField("waiting", "bool", "waiting:true"),
12082
- termField("flagged", "bool", "flagged:true"),
12083
- termField("unmatched", "bool", "unmatched:true"),
12084
- termField("entity", "ref", 'entity:"organization:3"'),
12085
- termField("batch", "kw", "batch:2026-11-07"),
12086
- termField("deleted", "bool", "deleted:true")
12087
- ]
12088
- };
12089
- var sourceOf5 = /* @__PURE__ */ __name((account2) => {
12090
- const [provider = "", ...rest] = (account2 ?? "").trim().split(":");
12091
- const name2 = rest.join(":");
12092
- if (!provider || !name2)
12093
- throw new CliError("validation_error", "name the source as --account <provider>:<account>, such as sheet:rentals", {
12094
- param: "--account"
12095
- });
12096
- return { provider, account: name2 };
12097
- }, "sourceOf");
12098
- var recordOf = /* @__PURE__ */ __name((record2) => {
12099
- const from = record2.startsWith("custom:") ? "custom:".length : 0;
12100
- const at2 = record2.indexOf(":", from);
12101
- if (at2 <= from || at2 === record2.length - 1)
12102
- throw new CliError("validation_error", `${record2} is not <type>:<external_id>, such as organization:client or custom:quote:Q-7`, { param: "record" });
12103
- return { type: record2.slice(0, at2), externalId: record2.slice(at2 + 1) };
12104
- }, "recordOf");
12105
- var RECORD_HELP = "<type>:<external_id> as the source names it, such as organization:client or custom:quote:Q-7";
12106
- var ACCOUNT_HELP = "the source, <provider>:<account> as the envelope's source names it, such as sheet:rentals";
12107
- var recordMappingCommands = /* @__PURE__ */ __name((records, program, streams, env) => {
12108
- const { run } = answers(program, streams, env);
12109
- withQuery(annotate(records.command("list"), { effects: LOCAL_READ }).description("a source's records, newest first; waiting:true lists those that wait for a record they name, unmatched:true the people, organizations and projects whose identifiers fit more than one of yours, entity: those mapped to one of your entries"), RECORD_QUERY).summary("a source's records; waiting:true lists what needs records link").option("--account <account>", ACCOUNT_HELP).option("--limit <n>", "most records, up to 500", positive, 100).option("--json", "print JSON; --json=type,external_id,entity keeps only those fields").action((words, given2) => run(given2.json, async (store) => {
12110
- const source = sourceOf5(given2.account);
12111
- const terms2 = queryTerms(words, RECORD_QUERY, "records list");
12112
- const filter = {
12113
- ...source,
12114
- ...terms2.has("type") ? { type: terms2.get("type") } : {},
12115
- ...terms2.get("waiting") === "true" ? { waiting: true } : {},
12116
- ...terms2.get("flagged") === "true" ? { flagged: true } : {},
12117
- ...terms2.get("unmatched") === "true" ? { unmatched: true } : {},
12118
- ...terms2.has("entity") ? { entity: terms2.get("entity") } : {},
12119
- ...terms2.has("batch") ? { batch: terms2.get("batch") } : {},
12120
- ...terms2.has("deleted") ? { deleted: terms2.get("deleted") === "true" } : {}
12121
- };
12122
- return pageOf("records list", given2.limit, (most) => store.records.list({ ...filter, limit: most }));
12123
- }));
12124
- byOption(annotate(records.command("link"), { effects: LOCAL_WRITE, output: { entity: "source_record" } }).description("say which of your entries a source's record is (organization:client is organization:3); never done by name. Records that waited for it become proposals in memo review. Only you link; an agent is refused").summary("say which of your entries a source's record is").argument("<record>", RECORD_HELP).argument("<ref>", "your entry of the same type: person:<id>, organization:<id> or project:<id>").option("--account <account>", ACCOUNT_HELP).option("--json", "print JSON; --json=type,external_id,entity keeps only those fields")).action(async (record2, ref, given2, command) => {
12125
- const by = await whoRuns(command, env, { asOwner: given2.asOwner, question: `link ${record2} to ${ref} as you?` });
12126
- await run(given2.json, async (store) => itemAnswer(await store.records.map({ ...sourceOf5(given2.account), ...recordOf(record2) }, ref, by)));
12178
+ var placed = /* @__PURE__ */ __name((items, placeOf) => items.map((item) => {
12179
+ const place = placeOf(item.pointer);
12180
+ return place ? { ...item, place } : item;
12181
+ }), "placed");
12182
+ var sheetText2 = /* @__PURE__ */ __name(async (file, stdin) => {
12183
+ if (file === "-")
12184
+ return streamText(stdin);
12185
+ try {
12186
+ return await readFile(file, "utf8");
12187
+ } catch (error) {
12188
+ if (errnoOf(error) === "ENOENT")
12189
+ throw new CliError("not_found", `no records file ${file}: give a file that exists, or - for stdin`, {
12190
+ reason: "records.file-missing",
12191
+ path: file
12192
+ });
12193
+ throw new CliError("validation_error", `the records file ${file} cannot be read`, {
12194
+ reason: "records.file-unreadable",
12195
+ path: file
12196
+ });
12197
+ }
12198
+ }, "sheetText");
12199
+ var placeText = /* @__PURE__ */ __name((place) => place ? `line ${place.line}${place.column ? `, column ${place.column}` : ""}` : "", "placeText");
12200
+ var refusedSheet = /* @__PURE__ */ __name((dryRun, source, errors) => ({
12201
+ dryRun,
12202
+ source,
12203
+ created: 0,
12204
+ updated: 0,
12205
+ unchanged: 0,
12206
+ deleted: 0,
12207
+ refused: errors.length,
12208
+ proposed: [],
12209
+ waiting: [],
12210
+ flagged: [],
12211
+ unmatched: [],
12212
+ ignored: [],
12213
+ relationships: { added: 0, kept: 0, restored: 0, withdrawn: 0, proposed: 0, skippedOwnerRejected: 0 },
12214
+ notices: [],
12215
+ errors,
12216
+ truncated: false
12217
+ }), "refusedSheet");
12218
+ var importSheet = /* @__PURE__ */ __name(async (store, { file, stdin, account: account2, dryRun, onIssue, type }) => {
12219
+ if (!type || !TABLE_RECORD_TYPES.includes(type))
12220
+ throw new CliError("validation_error", `a CSV sheet holds one type: --type ${TABLE_RECORD_TYPES.join("|")}`, {
12221
+ param: "--type"
12222
+ });
12223
+ const source = sourceOf5(account2);
12224
+ const batch = `${file === "-" ? "stdin" : basename3(file)}-${(/* @__PURE__ */ new Date()).toISOString()}`;
12225
+ let read;
12226
+ try {
12227
+ read = envelopeOfCsv(await sheetText2(file, stdin), { type, source: { ...source, batch_id: batch } });
12228
+ } catch (error) {
12229
+ if (!(error instanceof TableError))
12230
+ throw error;
12231
+ for (const one2 of error.errors)
12232
+ onIssue(one2);
12233
+ return refusedSheet(dryRun, { ...source, batchId: batch }, error.errors);
12234
+ }
12235
+ const receipt = await ingest(store, read.envelope, {
12236
+ account: source.account,
12237
+ dryRun,
12238
+ onIssue: /* @__PURE__ */ __name((issue) => onIssue({ ...issue, ...read.placeOf(issue.pointer) ? { place: read.placeOf(issue.pointer) } : {} }), "onIssue")
12127
12239
  });
12128
- }, "recordMappingCommands");
12240
+ return {
12241
+ ...receipt,
12242
+ waiting: placed(receipt.waiting, read.placeOf),
12243
+ flagged: placed(receipt.flagged, read.placeOf),
12244
+ unmatched: placed(receipt.unmatched, read.placeOf),
12245
+ ignored: placed(receipt.ignored, read.placeOf),
12246
+ errors: placed(receipt.errors, read.placeOf)
12247
+ };
12248
+ }, "importSheet");
12129
12249
 
12130
12250
  // dist/records/record-commands.js
12131
12251
  var INCOMING = 100;
@@ -12190,8 +12310,14 @@ var recordCommands = /* @__PURE__ */ __name((records, { run, print }, withStore2
12190
12310
 
12191
12311
  // dist/records/import.js
12192
12312
  var kindsOf = /* @__PURE__ */ __name((proposed) => [...new Set(proposed.map((ref) => ref.slice(0, ref.indexOf(":"))))], "kindsOf");
12313
+ var LOCALES = ["en", "ru", "es"];
12314
+ var TEMPLATES_QUERY = defineQuery({
12315
+ entity: "records_templates",
12316
+ backend: "native",
12317
+ fields: [termField("type", "kw", "type:invoice")]
12318
+ });
12193
12319
  var pointerOf = /* @__PURE__ */ __name((pointer) => pointer || "/", "pointerOf");
12194
- var refusedLine = /* @__PURE__ */ __name((one2) => `refused ${pointerOf(one2.pointer)} \xB7 ${one2.message} (${one2.code})`, "refusedLine");
12320
+ var refusedLine = /* @__PURE__ */ __name((one2) => `refused ${one2.place ? placeText(one2.place) : pointerOf(one2.pointer)} \xB7 ${one2.message} (${one2.code})`, "refusedLine");
12195
12321
  var receiptText = /* @__PURE__ */ __name((receipt) => [
12196
12322
  `${receipt.dryRun ? "would import" : "imported"} ${receipt.source?.batchId ?? "nothing"}: ${receipt.created} created, ${receipt.updated} updated, ${receipt.unchanged} unchanged, ${receipt.deleted} deleted, ${receipt.refused} refused`,
12197
12323
  ...receipt.proposed.length ? [
@@ -12210,7 +12336,7 @@ var recordsCommand = /* @__PURE__ */ __name((program, streams, env) => {
12210
12336
  const answered = answers(program, streams, env);
12211
12337
  const { print } = answered;
12212
12338
  const records = program.command("records").description("what a source said, kept per account; what it says about money waits for your review").summary("what a source said, kept per account");
12213
- const importing = /* @__PURE__ */ __name((command, dryRun) => command.argument("<file>", "a records envelope as JSON, JSONL (a header line, then a record per line, read as it streams) or a vCard address book (.vcf, into phone:<device>); - for stdin").option("--account <account>", "the source the envelope is for: <provider>:<account> (sheet:rentals) or its source.account alone; phone:<device> for a vCard file").option("--region <country>", "a vCard file's country for phone numbers without +, such as ru or gb; without it they are kept, not matched").option("--json", "print JSON; --json=created,errors keeps only those fields").action(async (file, given2) => {
12339
+ const importing = /* @__PURE__ */ __name((command, dryRun) => command.argument("<file>", "a records envelope as JSON, JSONL (a header line, then a record per line, read as it streams), a CSV sheet of one --type, or a vCard address book (.vcf, into phone:<device>); - for stdin").option("--type <type>", `the one type a CSV sheet holds: ${TABLE_RECORD_TYPES.join(", ")}`).option("--account <account>", "the source the envelope is for: <provider>:<account> (sheet:rentals) or its source.account alone; phone:<device> for a vCard file").option("--region <country>", "a vCard file's country for phone numbers without +, such as ru or gb; without it they are kept, not matched").option("--json", "print JSON; --json=created,errors keeps only those fields").action(async (file, given2) => {
12214
12340
  const account2 = given2.account?.trim();
12215
12341
  if (!account2)
12216
12342
  throw new CliError("validation_error", "name the source account the envelope is for: --account <account>", {
@@ -12223,7 +12349,8 @@ var recordsCommand = /* @__PURE__ */ __name((program, streams, env) => {
12223
12349
  dryRun: dryRun ?? given2.dryRun === true,
12224
12350
  onIssue: /* @__PURE__ */ __name((issue) => streams.diagnostic(`${refusedLine(issue)}
12225
12351
  `), "onIssue"),
12226
- ...given2.region === void 0 ? {} : { region: given2.region }
12352
+ ...given2.region === void 0 ? {} : { region: given2.region },
12353
+ ...given2.type === void 0 ? {} : { type: given2.type }
12227
12354
  }));
12228
12355
  const issues = receipt.errors.map((one2) => ({
12229
12356
  code: "validation_error",
@@ -12238,6 +12365,34 @@ var recordsCommand = /* @__PURE__ */ __name((program, streams, env) => {
12238
12365
  annotate(records.command("check"), { effects: LOCAL_WRITE, output: { entity: "records_receipt" } }).description(`what records import would do with the file, as its receipt, writing nothing; ${HOLDS_LOCK}`).summary("check a records file against the store; write nothing"),
12239
12366
  true
12240
12367
  );
12368
+ const templates = records.command("templates").description("files to fill for records import: a CSV header row or a JSON envelope, one type each").summary("files to fill for records import");
12369
+ withQuery(annotate(templates.command("list"), { effects: LOCAL_READ, output: { entity: "records_templates" } }), TEMPLATES_QUERY).description("the types a sheet can hold, and their columns: whether each is required, its shape and its values").summary("the types a sheet can hold, with their columns").option("--json", "print JSON; --json=types keeps only those fields").action((words, given2) => {
12370
+ const terms2 = nativeTerms(listQuery(typedQuery(words), TEMPLATES_QUERY, "records templates list"), "records templates list");
12371
+ const wanted = terms2.get("type")?.value;
12372
+ const types = TABLE_RECORD_TYPES.filter((one2) => wanted === void 0 || one2 === wanted).map((one2) => ({
12373
+ type: one2,
12374
+ columns: recordColumns(one2)
12375
+ }));
12376
+ return print(given2.json, itemAnswer({ types }), types.map((one2) => one2.type).join("\n"));
12377
+ });
12378
+ annotate(templates.command("show"), { effects: LOCAL_READ, output: { entity: "records_template" } }).description("the file to fill for one type: the CSV header row (with a byte-order mark, so Excel reads it as UTF-8) or a JSON envelope of one example record").summary("the CSV or JSON file to fill for one type").argument("<type>", `one of ${TABLE_RECORD_TYPES.join(", ")}`).option("--format <format>", "csv or json", "csv").option("--locale <code>", "the language of the Excel that opens it: en takes , and ru or es take ;", "en").option("--account <account>", "the source a JSON template names: <provider>:<account>, such as sheet:rentals").option("--json", "print JSON; --json=text keeps only those fields").action((type, given2) => {
12379
+ if (!TABLE_RECORD_TYPES.includes(type))
12380
+ throw new CliError("validation_error", `no template for ${type}: use one of ${TABLE_RECORD_TYPES.join(", ")}`, {
12381
+ param: "type"
12382
+ });
12383
+ if (given2.format !== "csv" && given2.format !== "json")
12384
+ throw new CliError("validation_error", "--format is csv or json", { param: "--format" });
12385
+ if (!LOCALES.includes(given2.locale))
12386
+ throw new CliError("validation_error", `--locale is one of ${LOCALES.join(", ")}`, { param: "--locale" });
12387
+ const source = given2.account === void 0 ? void 0 : sourceOf5(given2.account);
12388
+ const text3 = recordTemplate(type, given2.format, {
12389
+ separator: given2.locale === "en" ? "," : ";",
12390
+ ...source ? { source } : {}
12391
+ });
12392
+ if (given2.json)
12393
+ return print(true, itemAnswer({ type, format: given2.format, columns: recordColumns(type), text: text3 }));
12394
+ streams.data(text3);
12395
+ });
12241
12396
  recordMappingCommands(records, program, streams, env);
12242
12397
  recordCommands(records, answered, (work) => withStore(env, work));
12243
12398
  }, "recordsCommand");
@@ -12723,7 +12878,7 @@ var syncCommand = /* @__PURE__ */ __name((program, streams, env, signal, keyring
12723
12878
  recordAutoRun(env, startedAt, failedReason(run.failed));
12724
12879
  print(options.json, answer(), text2(run));
12725
12880
  if (run.failed.length > 0)
12726
- process.exitCode = 1;
12881
+ setExitCode(program, 1);
12727
12882
  }, "sync");
12728
12883
  }, "syncCommand");
12729
12884
 
@@ -13356,7 +13511,7 @@ ${note.text}`);
13356
13511
 
13357
13512
  // dist/sources/read.js
13358
13513
  import { readFileSync as readFileSync11, statSync as statSync5 } from "node:fs";
13359
- import { basename as basename3, extname as extname2 } from "node:path";
13514
+ import { basename as basename4, extname as extname2 } from "node:path";
13360
13515
  var SOURCE_TEXT_CHARS = 2e5;
13361
13516
  var URL_LIKE = /^[a-z][a-z0-9+.-]*:\/\//i;
13362
13517
  var isUrl = /* @__PURE__ */ __name((given2) => URL_LIKE.test(given2), "isUrl");
@@ -13433,7 +13588,12 @@ var firstLine2 = /* @__PURE__ */ __name((text3) => {
13433
13588
  const line3 = text3.trimStart().split("\n", 1)[0]?.trim() ?? "";
13434
13589
  return line3 ? line3.slice(0, 120) : null;
13435
13590
  }, "firstLine");
13436
- var titleIn = /* @__PURE__ */ __name((metadata) => typeof metadata?.title === "string" && metadata.title.trim() ? metadata.title.trim().slice(0, 500) : null, "titleIn");
13591
+ var metaText = /* @__PURE__ */ __name((metadata, key) => {
13592
+ const value = metadata?.[key];
13593
+ const first = (Array.isArray(value) ? value : [value]).find((v) => typeof v === "string" && v.trim());
13594
+ return first ? first.trim().slice(0, 500) : null;
13595
+ }, "metaText");
13596
+ var titleIn = /* @__PURE__ */ __name((metadata) => metaText(metadata, "title"), "titleIn");
13437
13597
  var readStdin = /* @__PURE__ */ __name(async (stdin) => {
13438
13598
  const chunks = [];
13439
13599
  let size = 0;
@@ -13464,9 +13624,9 @@ var readText = /* @__PURE__ */ __name(async (stdin, { maxChars }) => {
13464
13624
  title: firstLine2(text3)
13465
13625
  };
13466
13626
  }, "readText");
13467
- var readFile = /* @__PURE__ */ __name(async (path, { maxChars, load = importEngine }) => {
13627
+ var readFile2 = /* @__PURE__ */ __name(async (path, { maxChars, load = importEngine }) => {
13468
13628
  const stat = statSync5(path, { throwIfNoEntry: false });
13469
- const name2 = basename3(path);
13629
+ const name2 = basename4(path);
13470
13630
  if (!stat)
13471
13631
  throw new CliError("not_found", `no file ${path}`, { path });
13472
13632
  if (!stat.isFile())
@@ -13529,6 +13689,24 @@ var readPage2 = /* @__PURE__ */ __name(async (address, { maxChars, fetch: fetch2
13529
13689
  ...page.sections ? { sections: page.sections } : {}
13530
13690
  };
13531
13691
  }, "readPage");
13692
+ var EXCERPT_CHARS = 800;
13693
+ var previewOf = /* @__PURE__ */ __name((read) => {
13694
+ const flat = read.text.replace(/\s+/g, " ").trim();
13695
+ return {
13696
+ url: read.url ?? null,
13697
+ title: read.title,
13698
+ site: read.url ? new URL(read.url).hostname : null,
13699
+ description: metaText(read.metadata, "description"),
13700
+ // By code point, so an emoji at the cut is never split into half a character.
13701
+ excerpt: flat ? Array.from(flat).slice(0, EXCERPT_CHARS).join("") : null,
13702
+ kind: read.kind,
13703
+ mime: read.mime ?? null,
13704
+ read: read.read,
13705
+ // The store keeps the text trimmed, and sources add answers its length.
13706
+ chars: read.text.trim().length,
13707
+ truncated: read.truncated
13708
+ };
13709
+ }, "previewOf");
13532
13710
 
13533
13711
  // dist/sources/readers/keys.js
13534
13712
  var providerKeys = /* @__PURE__ */ __name(({ env, keyring }) => {
@@ -14182,7 +14360,7 @@ var sourcesCommand = /* @__PURE__ */ __name((program, streams, env, { fetch: fet
14182
14360
  const maxChars = options.maxChars ?? SOURCE_TEXT_CHARS;
14183
14361
  const who = await whoRuns(command, env, { asOwner: options.asOwner, question: "add this source as yours?" });
14184
14362
  const by = who === "owner" ? "owner" : { bot: who.bot, reason: options.reason?.trim() || "memo sources add" };
14185
- const read = await (kind === "text" ? readText(environmentOf(command).stdin ?? process.stdin, { maxChars }) : kind === "url" ? readPage2(given2, { maxChars, ...fetch2 ? { fetch: fetch2 } : {} }) : readFile(given2, { maxChars })).catch((error) => {
14363
+ const read = await (kind === "text" ? readText(environmentOf(command).stdin ?? process.stdin, { maxChars }) : kind === "url" ? readPage2(given2, { maxChars, ...fetch2 ? { fetch: fetch2 } : {} }) : readFile2(given2, { maxChars })).catch((error) => {
14186
14364
  throw withNextStep(error);
14187
14365
  });
14188
14366
  const content = {
@@ -14249,6 +14427,26 @@ var sourcesCommand = /* @__PURE__ */ __name((program, streams, env, { fetch: fet
14249
14427
  ...item.subjects.length ? [` about: ${item.subjects.join(", ")}`] : []
14250
14428
  ].join("\n"));
14251
14429
  });
14430
+ annotate(sources.command("preview"), { effects: REMOTE_READ, output: { entity: "source_preview" } }).summary("read a web page as sources add would, and keep nothing").description("read a web page as sources add would, with the same refusals, and say what would be kept; nothing is saved").argument("<url>", "an http(s) address").option("--json", "print JSON; --json=title,excerpt keeps only those fields").action(async (given2, options, command) => {
14431
+ if (isAgentServer2(command, env))
14432
+ throw new CliError("permission_error", "an agent over MCP cannot make memo fetch an address", {
14433
+ reason: "source.agent-fetch"
14434
+ });
14435
+ if (argumentKind(given2) !== "url")
14436
+ throw new CliError("validation_error", "give an http(s) address; a file is previewed by the app that picked it", {
14437
+ reason: "input.invalid"
14438
+ });
14439
+ const read = await readPage2(given2, { maxChars: SOURCE_TEXT_CHARS, ...fetch2 ? { fetch: fetch2 } : {} }).catch((error) => {
14440
+ throw withNextStep(error);
14441
+ });
14442
+ const item = previewOf(read);
14443
+ print(options.json, itemAnswer(item), [
14444
+ `${item.url} nothing saved`,
14445
+ ` ${item.title ?? ""} ${item.kind}${item.mime ? ` \xB7 ${item.mime}` : ""} \xB7 ${item.chars} characters${item.truncated ? " (only the first part would be kept)" : ""}`,
14446
+ ...item.description ? [` ${item.description}`] : [],
14447
+ ...item.excerpt ? [` \u201C${item.excerpt}\u201D`] : []
14448
+ ].join("\n"));
14449
+ });
14252
14450
  annotate(sources.command("show"), { effects: LOCAL_READ, output: { entity: "source_detail" } }).summary("one source: its text, what is kept, and what cites it").description("one source: its text, what is kept, what it is about, and the facts, memories and batches citing it").argument("<ref>", "document:<id>, as sources add answered").option("--bytes <bytes>", `most UTF-8 bytes of its text, up to ${MAX_TEXT_BYTES} (default ${TEXT_BYTES})`, between(1, MAX_TEXT_BYTES, "--bytes")).option("--json", "print JSON; --json=id,title keeps only those fields").action((reference2, options) => run(options.json, async (store) => {
14253
14451
  const ref = await documentRef2(store, reference2);
14254
14452
  const source = await store.notes.addedSource(ref);
@@ -14970,6 +15168,7 @@ var OWN_ENTITIES = entityFields({
14970
15168
  "searchable",
14971
15169
  "subjects"
14972
15170
  ],
15171
+ source_preview: ["url", "title", "site", "description", "excerpt", "kind", "mime", "read", "chars", "truncated"],
14973
15172
  source_detail: [
14974
15173
  "ref",
14975
15174
  "title",
@@ -15257,6 +15456,8 @@ var OWN_ENTITIES = entityFields({
15257
15456
  "updated_at",
15258
15457
  "deleted_at"
15259
15458
  ],
15459
+ records_templates: ["types"],
15460
+ records_template: ["type", "format", "columns", "text"],
15260
15461
  records_receipt: [
15261
15462
  "dry_run",
15262
15463
  "source",
@@ -15535,11 +15736,13 @@ var FIRST_SCREEN = {
15535
15736
  profile: false,
15536
15737
  start: "memo folders add <path>"
15537
15738
  };
15538
- var createProgram = /* @__PURE__ */ __name(({ streams: raw = processStreams, env: given2 = process.env, signal, terminal, keyring, fetchPage: fetchPage2, group, stdin, readerFetch, system } = {}) => {
15739
+ var createProgram = /* @__PURE__ */ __name(({ streams: raw = processStreams, env: given2 = process.env, signal, terminal, keyring, fetchPage: fetchPage2, group, stdin, readerFetch, system, setExitCode: setExitCode2 } = {}) => {
15539
15740
  const env = group === void 0 ? given2 : { ...given2, MEMO_GROUP: group };
15540
15741
  const fields = jsonFields(raw, OWN_ENTITIES);
15541
15742
  const { streams } = fields;
15542
15743
  const program = new Command("memo").description("context about people across messengers, notes and mail").version(VERSION).option("--debug", "on failure, show the full error record: cause and stack");
15744
+ if (setExitCode2)
15745
+ keepExitCode(program, setExitCode2);
15543
15746
  refuseWritesUnderLock(program, env);
15544
15747
  scopeRunsToGroup(program, env, group);
15545
15748
  provideTerminal(program, terminal);