@wirecat/cli-core 0.396.0 → 0.398.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 (102) hide show
  1. package/CHANGELOG.md +74 -1
  2. package/README.md +13 -9
  3. package/dist/background/daily-archive-timer.d.ts +40 -0
  4. package/dist/background/daily-archive-timer.js +181 -0
  5. package/dist/background/index.d.ts +2 -0
  6. package/dist/background/index.js +1 -0
  7. package/dist/cli/bot/admins.js +2 -2
  8. package/dist/cli/bot/command.js +2 -2
  9. package/dist/cli/bot/setup.js +3 -3
  10. package/dist/cli/commands-command.js +1 -1
  11. package/dist/cli/config-command.js +1 -1
  12. package/dist/cli/guide.js +0 -1
  13. package/dist/cli/help/command-help.d.ts +9 -2
  14. package/dist/cli/help/command-help.js +22 -4
  15. package/dist/cli/help/first-screen.js +3 -3
  16. package/dist/cli/messenger/account-command.js +3 -1
  17. package/dist/cli/messenger/account-sessions-command.js +3 -1
  18. package/dist/cli/messenger/admin-commands.js +1 -0
  19. package/dist/cli/messenger/admin-contacts-command.js +9 -3
  20. package/dist/cli/messenger/archive-commands.js +5 -3
  21. package/dist/cli/messenger/attachments-command.js +17 -7
  22. package/dist/cli/messenger/backfill-command.js +7 -3
  23. package/dist/cli/messenger/catch-up-answers.d.ts +2 -0
  24. package/dist/cli/messenger/catch-up-answers.js +5 -1
  25. package/dist/cli/messenger/chats-command.js +3 -1
  26. package/dist/cli/messenger/chats-members-command.js +4 -0
  27. package/dist/cli/messenger/chats-stats-command.js +1 -0
  28. package/dist/cli/messenger/chats-tracking-command.js +4 -1
  29. package/dist/cli/messenger/complete-command.js +6 -2
  30. package/dist/cli/messenger/contacts-command.js +11 -4
  31. package/dist/cli/messenger/context.d.ts +5 -0
  32. package/dist/cli/messenger/conversations-command.js +18 -1
  33. package/dist/cli/messenger/counters-command.js +1 -0
  34. package/dist/cli/messenger/doctor-command.js +2 -2
  35. package/dist/cli/messenger/download-command.js +1 -0
  36. package/dist/cli/messenger/flood-command.js +2 -1
  37. package/dist/cli/messenger/guard-commands.js +5 -4
  38. package/dist/cli/messenger/inbox.js +2 -0
  39. package/dist/cli/messenger/lacks.d.ts +7 -0
  40. package/dist/cli/messenger/lacks.js +18 -1
  41. package/dist/cli/messenger/mcp-command.js +6 -2
  42. package/dist/cli/messenger/media-archive-command.d.ts +3 -0
  43. package/dist/cli/messenger/media-archive-command.js +72 -0
  44. package/dist/cli/messenger/media-archive-move-command.d.ts +3 -0
  45. package/dist/cli/messenger/media-archive-move-command.js +39 -0
  46. package/dist/cli/messenger/media-archive-timer-command.d.ts +3 -0
  47. package/dist/cli/messenger/media-archive-timer-command.js +70 -0
  48. package/dist/cli/messenger/messages-command.js +2 -1
  49. package/dist/cli/messenger/messages-comments-command.js +1 -0
  50. package/dist/cli/messenger/messages-delete-command.js +1 -1
  51. package/dist/cli/messenger/messages-search-command.js +1 -0
  52. package/dist/cli/messenger/messages-stats-command.js +1 -0
  53. package/dist/cli/messenger/models-command.js +8 -2
  54. package/dist/cli/messenger/private-people-command.js +12 -10
  55. package/dist/cli/messenger/rankings-command.js +2 -0
  56. package/dist/cli/messenger/reactions-command.js +8 -2
  57. package/dist/cli/messenger/replies-command.js +1 -1
  58. package/dist/cli/messenger/retention-command.js +1 -0
  59. package/dist/cli/messenger/review.js +8 -2
  60. package/dist/cli/messenger/schedule-command.js +3 -3
  61. package/dist/cli/messenger/search-command.js +7 -3
  62. package/dist/cli/messenger/searches-command.js +24 -7
  63. package/dist/cli/messenger/serve-command.js +5 -1
  64. package/dist/cli/messenger/serve-relay.d.ts +1 -0
  65. package/dist/cli/messenger/server-command.js +17 -3
  66. package/dist/cli/messenger/store-maintenance-command.d.ts +1 -1
  67. package/dist/cli/messenger/store-maintenance-command.js +10 -3
  68. package/dist/cli/messenger/tags-command.js +6 -2
  69. package/dist/cli/messenger/tasks-command.js +10 -7
  70. package/dist/cli/messenger/transcribe-command.js +1 -0
  71. package/dist/cli/messenger/watch-command.js +6 -1
  72. package/dist/cli/runs/command.js +2 -3
  73. package/dist/cli/skill-command.js +1 -1
  74. package/dist/domain/models.d.ts +2 -0
  75. package/dist/entities/contact-read.d.ts +119 -0
  76. package/dist/entities/contact-read.js +50 -0
  77. package/dist/entities/index.d.ts +120 -1
  78. package/dist/entities/index.js +5 -1
  79. package/dist/meetings/mcp/index.d.ts +15 -15
  80. package/dist/parity/catalogue.js +1 -1
  81. package/dist/parity/manifest.d.ts +3 -1
  82. package/dist/parity/manifest.js +2 -0
  83. package/dist/parity/wording.js +2 -0
  84. package/dist/sends/permissions.js +7 -0
  85. package/dist/services/deps.d.ts +1 -1
  86. package/dist/services/deps.js +1 -1
  87. package/dist/services/inbox.js +5 -5
  88. package/dist/services/index.d.ts +5 -0
  89. package/dist/services/index.js +2 -0
  90. package/dist/services/media-archive-files.d.ts +10 -0
  91. package/dist/services/media-archive-files.js +110 -0
  92. package/dist/services/media-archive-locks.d.ts +6 -0
  93. package/dist/services/media-archive-locks.js +71 -0
  94. package/dist/services/media-archive-manifest.d.ts +29 -0
  95. package/dist/services/media-archive-manifest.js +116 -0
  96. package/dist/services/media-archive-move.d.ts +21 -0
  97. package/dist/services/media-archive-move.js +163 -0
  98. package/dist/services/media-archive.d.ts +34 -0
  99. package/dist/services/media-archive.js +165 -0
  100. package/dist/services/search-kind.js +1 -1
  101. package/package.json +2 -2
  102. package/parity.json +116 -193
@@ -10,6 +10,7 @@ import { chatEvent } from "./chat-event.js";
10
10
  import { chatStats, taskStats } from "./chat-stats.js";
11
11
  import { contact } from "./contact.js";
12
12
  import { contactNote } from "./contact-note.js";
13
+ import { contactLookup, contactProfile, contactSync } from "./contact-read.js";
13
14
  import { conversation } from "./conversation.js";
14
15
  import { counterRefresh, counters } from "./counters.js";
15
16
  import { document } from "./document.js";
@@ -47,7 +48,7 @@ import { topic } from "./topic.js";
47
48
  * subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
48
49
  * is the target, not a description of today's output.
49
50
  */
50
- export { account, accountSession, adminReport, agenda, attachment, chart, chat, chatEvent, chatStats, contact, contactNote, conversation, counterRefresh, counters, document, evidence, fact, folder, hit, identity, inviteLink, job, joinRequest, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, message, messageCounts, messageLink, model, note, officialStats, person, pollVote, ranking, reference, relationship, retention, savedSearch, tagging, task, taskStats, topic, };
51
+ export { account, accountSession, adminReport, agenda, attachment, chart, chat, chatEvent, chatStats, contact, contactLookup, contactNote, contactProfile, contactSync, conversation, counterRefresh, counters, document, evidence, fact, folder, hit, identity, inviteLink, job, joinRequest, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, message, messageCounts, messageLink, model, note, officialStats, person, pollVote, ranking, reference, relationship, retention, savedSearch, tagging, task, taskStats, topic, };
51
52
  export declare const ENTITIES: {
52
53
  readonly message: v.StrictObjectSchema<{
53
54
  readonly ref: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a reference such as `note:42`">]>;
@@ -1726,6 +1727,124 @@ export declare const ENTITIES: {
1726
1727
  readonly created_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
1727
1728
  readonly updated_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
1728
1729
  }, undefined>;
1730
+ readonly contact_lookup: v.StrictObjectSchema<{
1731
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1732
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1733
+ readonly username: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1734
+ }, undefined>;
1735
+ readonly contact_profile: v.StrictObjectSchema<{
1736
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1737
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1738
+ readonly usernames: v.ArraySchema<v.StringSchema<undefined>, undefined>;
1739
+ readonly bio: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1740
+ readonly birthday: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1741
+ readonly phone: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1742
+ readonly flags: Omit<v.StrictObjectSchema<{
1743
+ readonly bot: v.BooleanSchema<undefined>;
1744
+ readonly verified: v.BooleanSchema<undefined>;
1745
+ readonly premium: v.BooleanSchema<undefined>;
1746
+ readonly scam: v.BooleanSchema<undefined>;
1747
+ readonly fake: v.BooleanSchema<undefined>;
1748
+ readonly restricted: v.BooleanSchema<undefined>;
1749
+ readonly deleted: v.BooleanSchema<undefined>;
1750
+ readonly support: v.BooleanSchema<undefined>;
1751
+ }, undefined>, "entries" | "~run" | "~standard" | "~types"> & {
1752
+ readonly entries: {
1753
+ readonly bot: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1754
+ readonly verified: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1755
+ readonly premium: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1756
+ readonly scam: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1757
+ readonly fake: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1758
+ readonly restricted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1759
+ readonly deleted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1760
+ readonly support: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1761
+ };
1762
+ readonly "~standard": v.StandardProps<{
1763
+ bot?: boolean | undefined;
1764
+ verified?: boolean | undefined;
1765
+ premium?: boolean | undefined;
1766
+ scam?: boolean | undefined;
1767
+ fake?: boolean | undefined;
1768
+ restricted?: boolean | undefined;
1769
+ deleted?: boolean | undefined;
1770
+ support?: boolean | undefined;
1771
+ }, {
1772
+ bot?: boolean | undefined;
1773
+ verified?: boolean | undefined;
1774
+ premium?: boolean | undefined;
1775
+ scam?: boolean | undefined;
1776
+ fake?: boolean | undefined;
1777
+ restricted?: boolean | undefined;
1778
+ deleted?: boolean | undefined;
1779
+ support?: boolean | undefined;
1780
+ }>;
1781
+ readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
1782
+ bot?: boolean | undefined;
1783
+ verified?: boolean | undefined;
1784
+ premium?: boolean | undefined;
1785
+ scam?: boolean | undefined;
1786
+ fake?: boolean | undefined;
1787
+ restricted?: boolean | undefined;
1788
+ deleted?: boolean | undefined;
1789
+ support?: boolean | undefined;
1790
+ }, v.BooleanIssue | v.StrictObjectIssue>;
1791
+ readonly "~types"?: {
1792
+ readonly input: {
1793
+ bot?: boolean | undefined;
1794
+ verified?: boolean | undefined;
1795
+ premium?: boolean | undefined;
1796
+ scam?: boolean | undefined;
1797
+ fake?: boolean | undefined;
1798
+ restricted?: boolean | undefined;
1799
+ deleted?: boolean | undefined;
1800
+ support?: boolean | undefined;
1801
+ };
1802
+ readonly output: {
1803
+ bot?: boolean | undefined;
1804
+ verified?: boolean | undefined;
1805
+ premium?: boolean | undefined;
1806
+ scam?: boolean | undefined;
1807
+ fake?: boolean | undefined;
1808
+ restricted?: boolean | undefined;
1809
+ deleted?: boolean | undefined;
1810
+ support?: boolean | undefined;
1811
+ };
1812
+ readonly issue: v.BooleanIssue | v.StrictObjectIssue;
1813
+ } | undefined;
1814
+ };
1815
+ readonly seen: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1816
+ readonly contact: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1817
+ readonly mutual_contact: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1818
+ readonly common_chats_count: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
1819
+ readonly registered: v.OptionalSchema<v.NullableSchema<v.StrictObjectSchema<{
1820
+ readonly at: v.StringSchema<undefined>;
1821
+ readonly source: v.PicklistSchema<["telegram", "max", "estimate"], undefined>;
1822
+ readonly precision: v.PicklistSchema<["day", "month"], undefined>;
1823
+ }, undefined>, undefined>, undefined>;
1824
+ readonly has_photo: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
1825
+ readonly chats: v.ArraySchema<v.StrictObjectSchema<{
1826
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1827
+ readonly title: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1828
+ readonly kind: v.PicklistSchema<["dialog", "group", "channel", "saved", "unknown"], undefined>;
1829
+ readonly their_messages: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
1830
+ readonly first_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
1831
+ readonly last_at: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>, undefined>;
1832
+ readonly complete: v.BooleanSchema<undefined>;
1833
+ }, undefined>, undefined>;
1834
+ readonly aliases: v.ArraySchema<v.StrictObjectSchema<{
1835
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1836
+ readonly username: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1837
+ readonly link: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1838
+ readonly first_seen_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
1839
+ readonly last_seen_at: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, "an ISO 8601 time in UTC">, v.EndsWithAction<string, "Z", "an ISO 8601 time in UTC, ending in `Z`">]>;
1840
+ readonly source: v.PicklistSchema<["profile", "messages"], undefined>;
1841
+ }, undefined>, undefined>;
1842
+ }, undefined>;
1843
+ readonly contact_sync: v.StrictObjectSchema<{
1844
+ readonly added: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
1845
+ readonly changed: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
1846
+ readonly known: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
1847
+ }, undefined>;
1729
1848
  readonly account: v.StrictObjectSchema<{
1730
1849
  readonly provider: v.StringSchema<undefined>;
1731
1850
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
@@ -11,6 +11,7 @@ import { chatEvent } from "./chat-event.js";
11
11
  import { chatStats, taskStats } from "./chat-stats.js";
12
12
  import { contact } from "./contact.js";
13
13
  import { contactNote } from "./contact-note.js";
14
+ import { contactLookup, contactProfile, contactSync } from "./contact-read.js";
14
15
  import { conversation } from "./conversation.js";
15
16
  import { counterRefresh, counters } from "./counters.js";
16
17
  import { document } from "./document.js";
@@ -50,7 +51,7 @@ import { topic } from "./topic.js";
50
51
  * subset of its fields, never a renamed one. Commands move onto these one by one; until then, a schema
51
52
  * is the target, not a description of today's output.
52
53
  */
53
- export { account, accountSession, adminReport, agenda, attachment, chart, chat, chatEvent, chatStats, contact, contactNote, conversation, counterRefresh, counters, document, evidence, fact, folder, hit, identity, inviteLink, job, joinRequest, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, message, messageCounts, messageLink, model, note, officialStats, person, pollVote, ranking, reference, relationship, retention, savedSearch, tagging, task, taskStats, topic, };
54
+ export { account, accountSession, adminReport, agenda, attachment, chart, chat, chatEvent, chatStats, contact, contactLookup, contactNote, contactProfile, contactSync, conversation, counterRefresh, counters, document, evidence, fact, folder, hit, identity, inviteLink, job, joinRequest, meeting, meetingProjectCandidates, meetingSeriesInventory, member, memory, message, messageCounts, messageLink, model, note, officialStats, person, pollVote, ranking, reference, relationship, retention, savedSearch, tagging, task, taskStats, topic, };
54
55
  export const ENTITIES = {
55
56
  message,
56
57
  "message.hit": v.pick(message, [
@@ -85,6 +86,9 @@ export const ENTITIES = {
85
86
  identity,
86
87
  contact,
87
88
  contact_note: contactNote,
89
+ contact_lookup: contactLookup,
90
+ contact_profile: contactProfile,
91
+ contact_sync: contactSync,
88
92
  account,
89
93
  account_session: accountSession,
90
94
  note,
@@ -38,6 +38,7 @@ export declare const meetingTools: ({
38
38
  max_read_bytes?: undefined;
39
39
  cursor?: undefined;
40
40
  } | {
41
+ limit?: undefined;
41
42
  event_id?: undefined;
42
43
  series_id?: undefined;
43
44
  page?: undefined;
@@ -53,11 +54,11 @@ export declare const meetingTools: ({
53
54
  format?: undefined;
54
55
  transcript_id?: undefined;
55
56
  query?: undefined;
56
- limit?: undefined;
57
57
  scan_limit?: undefined;
58
58
  max_read_bytes?: undefined;
59
59
  cursor?: undefined;
60
60
  } | {
61
+ limit?: undefined;
61
62
  event_id?: undefined;
62
63
  series_id?: undefined;
63
64
  page?: undefined;
@@ -75,11 +76,11 @@ export declare const meetingTools: ({
75
76
  format?: undefined;
76
77
  transcript_id?: undefined;
77
78
  query?: undefined;
78
- limit?: undefined;
79
79
  scan_limit?: undefined;
80
80
  max_read_bytes?: undefined;
81
81
  cursor?: undefined;
82
82
  } | {
83
+ limit?: undefined;
83
84
  event_id?: undefined;
84
85
  series_id?: undefined;
85
86
  page?: undefined;
@@ -101,7 +102,6 @@ export declare const meetingTools: ({
101
102
  minimum: number;
102
103
  };
103
104
  query?: undefined;
104
- limit?: undefined;
105
105
  scan_limit?: undefined;
106
106
  max_read_bytes?: undefined;
107
107
  cursor?: undefined;
@@ -188,6 +188,7 @@ export declare const meetingTools: ({
188
188
  max_read_bytes?: undefined;
189
189
  cursor?: undefined;
190
190
  } | {
191
+ limit?: undefined;
191
192
  event_id?: undefined;
192
193
  series_id?: undefined;
193
194
  page?: undefined;
@@ -203,11 +204,11 @@ export declare const meetingTools: ({
203
204
  format?: undefined;
204
205
  transcript_id?: undefined;
205
206
  query?: undefined;
206
- limit?: undefined;
207
207
  scan_limit?: undefined;
208
208
  max_read_bytes?: undefined;
209
209
  cursor?: undefined;
210
210
  } | {
211
+ limit?: undefined;
211
212
  event_id?: undefined;
212
213
  series_id?: undefined;
213
214
  page?: undefined;
@@ -225,11 +226,11 @@ export declare const meetingTools: ({
225
226
  format?: undefined;
226
227
  transcript_id?: undefined;
227
228
  query?: undefined;
228
- limit?: undefined;
229
229
  scan_limit?: undefined;
230
230
  max_read_bytes?: undefined;
231
231
  cursor?: undefined;
232
232
  } | {
233
+ limit?: undefined;
233
234
  event_id?: undefined;
234
235
  series_id?: undefined;
235
236
  page?: undefined;
@@ -251,7 +252,6 @@ export declare const meetingTools: ({
251
252
  minimum: number;
252
253
  };
253
254
  query?: undefined;
254
- limit?: undefined;
255
255
  scan_limit?: undefined;
256
256
  max_read_bytes?: undefined;
257
257
  cursor?: undefined;
@@ -338,6 +338,7 @@ export declare const meetingTools: ({
338
338
  max_read_bytes?: undefined;
339
339
  cursor?: undefined;
340
340
  } | {
341
+ limit?: undefined;
341
342
  event_id?: undefined;
342
343
  series_id?: undefined;
343
344
  page?: undefined;
@@ -353,11 +354,11 @@ export declare const meetingTools: ({
353
354
  format?: undefined;
354
355
  transcript_id?: undefined;
355
356
  query?: undefined;
356
- limit?: undefined;
357
357
  scan_limit?: undefined;
358
358
  max_read_bytes?: undefined;
359
359
  cursor?: undefined;
360
360
  } | {
361
+ limit?: undefined;
361
362
  event_id?: undefined;
362
363
  series_id?: undefined;
363
364
  page?: undefined;
@@ -375,11 +376,11 @@ export declare const meetingTools: ({
375
376
  format?: undefined;
376
377
  transcript_id?: undefined;
377
378
  query?: undefined;
378
- limit?: undefined;
379
379
  scan_limit?: undefined;
380
380
  max_read_bytes?: undefined;
381
381
  cursor?: undefined;
382
382
  } | {
383
+ limit?: undefined;
383
384
  event_id?: undefined;
384
385
  series_id?: undefined;
385
386
  page?: undefined;
@@ -401,7 +402,6 @@ export declare const meetingTools: ({
401
402
  minimum: number;
402
403
  };
403
404
  query?: undefined;
404
- limit?: undefined;
405
405
  scan_limit?: undefined;
406
406
  max_read_bytes?: undefined;
407
407
  cursor?: undefined;
@@ -488,6 +488,7 @@ export declare const meetingTools: ({
488
488
  max_read_bytes?: undefined;
489
489
  cursor?: undefined;
490
490
  } | {
491
+ limit?: undefined;
491
492
  event_id?: undefined;
492
493
  series_id?: undefined;
493
494
  page?: undefined;
@@ -503,11 +504,11 @@ export declare const meetingTools: ({
503
504
  format?: undefined;
504
505
  transcript_id?: undefined;
505
506
  query?: undefined;
506
- limit?: undefined;
507
507
  scan_limit?: undefined;
508
508
  max_read_bytes?: undefined;
509
509
  cursor?: undefined;
510
510
  } | {
511
+ limit?: undefined;
511
512
  event_id?: undefined;
512
513
  series_id?: undefined;
513
514
  page?: undefined;
@@ -525,11 +526,11 @@ export declare const meetingTools: ({
525
526
  format?: undefined;
526
527
  transcript_id?: undefined;
527
528
  query?: undefined;
528
- limit?: undefined;
529
529
  scan_limit?: undefined;
530
530
  max_read_bytes?: undefined;
531
531
  cursor?: undefined;
532
532
  } | {
533
+ limit?: undefined;
533
534
  event_id?: undefined;
534
535
  series_id?: undefined;
535
536
  page?: undefined;
@@ -551,7 +552,6 @@ export declare const meetingTools: ({
551
552
  minimum: number;
552
553
  };
553
554
  query?: undefined;
554
- limit?: undefined;
555
555
  scan_limit?: undefined;
556
556
  max_read_bytes?: undefined;
557
557
  cursor?: undefined;
@@ -638,6 +638,7 @@ export declare const meetingTools: ({
638
638
  max_read_bytes?: undefined;
639
639
  cursor?: undefined;
640
640
  } | {
641
+ limit?: undefined;
641
642
  event_id?: undefined;
642
643
  series_id?: undefined;
643
644
  page?: undefined;
@@ -653,11 +654,11 @@ export declare const meetingTools: ({
653
654
  format?: undefined;
654
655
  transcript_id?: undefined;
655
656
  query?: undefined;
656
- limit?: undefined;
657
657
  scan_limit?: undefined;
658
658
  max_read_bytes?: undefined;
659
659
  cursor?: undefined;
660
660
  } | {
661
+ limit?: undefined;
661
662
  event_id?: undefined;
662
663
  series_id?: undefined;
663
664
  page?: undefined;
@@ -675,11 +676,11 @@ export declare const meetingTools: ({
675
676
  format?: undefined;
676
677
  transcript_id?: undefined;
677
678
  query?: undefined;
678
- limit?: undefined;
679
679
  scan_limit?: undefined;
680
680
  max_read_bytes?: undefined;
681
681
  cursor?: undefined;
682
682
  } | {
683
+ limit?: undefined;
683
684
  event_id?: undefined;
684
685
  series_id?: undefined;
685
686
  page?: undefined;
@@ -701,7 +702,6 @@ export declare const meetingTools: ({
701
702
  minimum: number;
702
703
  };
703
704
  query?: undefined;
704
- limit?: undefined;
705
705
  scan_limit?: undefined;
706
706
  max_read_bytes?: undefined;
707
707
  cursor?: undefined;
@@ -16,7 +16,7 @@ export const renderCatalogue = (manifest) => {
16
16
  add(name, `every command${where(entry)}`);
17
17
  for (const [path, row] of Object.entries(manifest.commands))
18
18
  for (const [name, entry] of Object.entries(row.options ?? {}))
19
- add(name, `\`${path}\`${where(entry)}`);
19
+ add(name, `\`${path}\`${where(entry)}${typeof entry !== "string" && entry.wording ? ` — ${cell(entry.wording)}` : ""}`);
20
20
  const rows = Object.entries(manifest.options).map(([name, option]) => {
21
21
  const meaning = option.note ? `${option.meaning}. **${option.note}**` : option.meaning;
22
22
  return `| \`${name}\` | ${option.value ? `\`${cell(option.value)}\`` : ""} | ${cell(meaning)} | ${option.default === undefined ? "" : `\`${cell(option.default)}\``} | ${(commands.get(name) ?? []).join(", ")} |`;
@@ -11,7 +11,9 @@ export interface Presence {
11
11
  planned?: Record<Cli, string>;
12
12
  }
13
13
  /** An option: `"all"` alone, or where it is and why not elsewhere. */
14
- export type Entry = "all" | Presence;
14
+ export type Entry = "all" | (Presence & {
15
+ wording?: string;
16
+ });
15
17
  export interface CommandRow extends Presence {
16
18
  /** On a planned row: it stands for every path below it, which then have no rows of their own. */
17
19
  subtree?: boolean;
@@ -18,6 +18,8 @@ const entryProblems = (clis, where, entry) => {
18
18
  const names = entry.in === "all" ? [] : Array.isArray(entry.in) ? entry.in : undefined;
19
19
  if (names === undefined)
20
20
  return [`${where}: "in" is neither "all" nor a list of CLIs`];
21
+ if ("wording" in entry && (typeof entry.wording !== "string" || entry.wording.trim() === ""))
22
+ problems.push(`${where}: a wording exception needs its reason`);
21
23
  const planned = Object.entries(entry.planned ?? {});
22
24
  for (const name of [...names, ...planned.map(([name]) => name)])
23
25
  if (!clis.includes(name))
@@ -49,6 +49,8 @@ export const wordingProblems = (manifest, programs) => {
49
49
  const sentences = clis.map((cli) => said.get(cli)?.get(where));
50
50
  if (sentences.every((sentence) => sentence === sentences[0]))
51
51
  return [];
52
+ if (typeof entry !== "string" && entry.wording && sentences.every((sentence) => sentence !== undefined))
53
+ return [];
52
54
  return [`${where}: ${clis.map((cli, index) => `${cli} says "${sentences[index]}"`).join(", ")}`];
53
55
  });
54
56
  };
@@ -271,6 +271,7 @@ const NAMED_WRITE_KEYS = [
271
271
  "stats.contacts.top.sync-first",
272
272
  "account.sessions.list",
273
273
  "attachments.extract",
274
+ "attachments.move",
274
275
  "attachments.text.set",
275
276
  "bot.callbacks.answer",
276
277
  "bot.chats.action",
@@ -388,6 +389,8 @@ export const readKeysForCommand = (path) => {
388
389
  const key = keyForCommand(path);
389
390
  if (!key)
390
391
  return [];
392
+ if (path[0] === "attachments" && path[1] === "download")
393
+ return [key, "messages", "chats"];
391
394
  if (path[0] === "attachments" && (path[1] === "extract" || path[1] === "show"))
392
395
  return [key, "messages"];
393
396
  if (path[0] === "store" && path[1] === "gaps" && path[2] === "repair")
@@ -430,6 +433,10 @@ export const keyForCommand = (path) => {
430
433
  // Picture models moved from `models image` (0.270.0); a model is housekeeping wherever it is listed.
431
434
  if (top === "images" && next === "models")
432
435
  return null;
436
+ if (top === "attachments" && (next === "check" || next === "jobs"))
437
+ return null;
438
+ if (top === "attachments" && next === "download")
439
+ return "messages";
433
440
  if (top === "store" && next !== undefined && STORE_MAINTENANCE.has(next))
434
441
  return null;
435
442
  // The agent's answers write only to the local store: their own key, so read-only messages can still link (phase 4 A10).
@@ -70,7 +70,7 @@ export declare const fromStore: (deps: Pick<ServiceDeps, "offline" | "reads">) =
70
70
  export declare const nothingStored: (messenger: MessengerTraits) => string;
71
71
  /** Where a store-mode messenger's history comes from, for what it cannot do. */
72
72
  export declare const PUSHED = "this messenger's history is read from the local store";
73
- export declare const OFFLINE = "--offline answers only from what is kept locally: `chats list|show`, `messages list|show|context` and `contacts list|show`";
73
+ export declare const OFFLINE = "--offline answers only from what is kept locally: `chats list|show`, `messages list|show|context`, `contacts list|show` and `review`";
74
74
  /** Over a connection that is already open — an MCP session holds one for minutes. */
75
75
  export declare const onlineDeps: (messenger: ServiceMessenger, adapter: MessengerAdapter, guard: SendGuard, where?: {
76
76
  profile?: string;
@@ -55,7 +55,7 @@ export const fromStore = (deps) => deps.offline || deps.reads === "store";
55
55
  export const nothingStored = (messenger) => `nothing stored for this chat yet — keep \`${typedCommand(messenger.app.command, "serve")}\` running`;
56
56
  /** Where a store-mode messenger's history comes from, for what it cannot do. */
57
57
  export const PUSHED = "this messenger's history is read from the local store";
58
- export const OFFLINE = "--offline answers only from what is kept locally: `chats list|show`, `messages list|show|context` and `contacts list|show`";
58
+ export const OFFLINE = "--offline answers only from what is kept locally: `chats list|show`, `messages list|show|context`, `contacts list|show` and `review`";
59
59
  /** Over a connection that is already open — an MCP session holds one for minutes. */
60
60
  export const onlineDeps = (messenger, adapter, guard, where = {}) => ({
61
61
  messenger,
@@ -234,7 +234,7 @@ export const reviewIn = async (adapter, { since, points, chat, kinds, all = fals
234
234
  };
235
235
  export const inboxService = (deps) => {
236
236
  const reader = async () => {
237
- if (deps.reads === "store")
237
+ if (deps.reads === "store" || deps.offline)
238
238
  return storeReader(deps, await deps.store(), await deps.account());
239
239
  const connection = await deps.connection();
240
240
  return {
@@ -256,9 +256,7 @@ export const inboxService = (deps) => {
256
256
  : newIn(from, { since, limit, all, ...only, ...(points === undefined ? {} : { points }) });
257
257
  },
258
258
  review: async (options) => {
259
- if (deps.offline && deps.reads !== "store") {
260
- throw new CliError("validation_error", "`review` asks the messenger what changed; with `--offline` nothing did");
261
- }
259
+ const synced = deps.offline && deps.reads !== "store";
262
260
  let tasks;
263
261
  const found = await reviewIn(await reader(), {
264
262
  ...options,
@@ -272,7 +270,9 @@ export const inboxService = (deps) => {
272
270
  });
273
271
  },
274
272
  });
275
- return tasks ? { ...found, tasks } : found;
273
+ // What was never synced may sit before `until`, so the next review must not start there.
274
+ const offline = synced ? { complete: false, offline: true } : {};
275
+ return { ...found, ...offline, ...(tasks ? { tasks } : {}) };
276
276
  },
277
277
  };
278
278
  };
@@ -2,6 +2,11 @@ import { type BotCheckService } from "../botcheck/service.js";
2
2
  export type { ContextEvidenceItem, ContextEvidencePage, ContextEvidenceReader, ContextEvidenceRequest, ContextIndex, ContextReadLimits, ContextReadUsage, ContextRecordReader, ContextSource, ScopedContextEvidenceReader, } from "./context-evidence.js";
3
3
  export { contextEvidenceFingerprint, createContextEvidenceReader } from "./context-evidence.js";
4
4
  export { excerpt } from "./excerpt.js";
5
+ export type { MediaArchiveOptions, MediaArchivePorts } from "./media-archive.js";
6
+ export { archiveMedia, checkMediaArchive } from "./media-archive.js";
7
+ export type { MediaArchiveEntry, MediaIdentity } from "./media-archive-manifest.js";
8
+ export type { MoveMediaArchiveOptions } from "./media-archive-move.js";
9
+ export { moveMediaArchive } from "./media-archive-move.js";
5
10
  export { type DownloadedModel, downloadImageModel, downloadTextModel, type ModelDownloadOptions, } from "./model-downloads.js";
6
11
  export type { ProjectEvidenceContext, ProjectEvidenceItem, ProjectGathering, ProjectGatheringPorts, ProjectGatheringStop, ProjectIndexCatchUp, ProjectSourceFetcher, } from "./project-gathering.js";
7
12
  export { gatherProjectEvidence } from "./project-gathering.js";
@@ -1,6 +1,8 @@
1
1
  import { botCheckService } from "../botcheck/service.js";
2
2
  export { contextEvidenceFingerprint, createContextEvidenceReader } from "./context-evidence.js";
3
3
  export { excerpt } from "./excerpt.js";
4
+ export { archiveMedia, checkMediaArchive } from "./media-archive.js";
5
+ export { moveMediaArchive } from "./media-archive-move.js";
4
6
  export { downloadImageModel, downloadTextModel, } from "./model-downloads.js";
5
7
  export { gatherProjectEvidence } from "./project-gathering.js";
6
8
  export { documentPassage, storedMessageNeighbours, storedNeighbours } from "./project-gathering-around.js";
@@ -0,0 +1,10 @@
1
+ import type { RemoteFile } from "../ports/messenger.js";
2
+ import { type MediaArchiveEntry, type MediaIdentity } from "./media-archive-manifest.js";
3
+ export declare const archiveMediaFile: (root: string, identity: MediaIdentity, kind: string, file: () => Promise<RemoteFile>, beforeWrite: () => Promise<void>, signal?: AbortSignal, metadata?: {
4
+ messageTime?: string;
5
+ mime?: string;
6
+ expected?: {
7
+ size: number;
8
+ sha256: string;
9
+ };
10
+ }) => Promise<MediaArchiveEntry>;
@@ -0,0 +1,110 @@
1
+ import { lstat } from "node:fs/promises";
2
+ import { CliError } from "@wirecat/cli-base";
3
+ import { NativeRecordingPartialStore, NativeRecordingPublication } from "../persistence/native/index.js";
4
+ import { commitMediaEntry, mediaKey, missingMediaFile, parseMediaEntry, } from "./media-archive-manifest.js";
5
+ const validator = '"media-completed-v1"';
6
+ const maximumFileBytes = 64 * 1024 * 1024 * 1024;
7
+ export const archiveMediaFile = async (root, identity, kind, file, beforeWrite, signal, metadata = {}) => {
8
+ const key = mediaKey(identity);
9
+ const locator = {
10
+ provider: identity.provider,
11
+ account: identity.account,
12
+ occurrenceId: mediaKey({ ...identity, position: 0 }),
13
+ assetId: key,
14
+ };
15
+ const storage = new NativeRecordingPartialStore(root, locator, {
16
+ prefix: ".media-partial-",
17
+ persistent: true,
18
+ maxBytes: maximumFileBytes,
19
+ signal,
20
+ });
21
+ const publication = new NativeRecordingPublication(root, locator, {
22
+ prefix: ".media-publication-",
23
+ filename: `${key}.bin`,
24
+ maxBytes: maximumFileBytes,
25
+ metadataLimit: 16384,
26
+ codec: {
27
+ encode: JSON.stringify,
28
+ decode: (value) => {
29
+ const one = parseMediaEntry(value);
30
+ if (mediaKey(one) !== key || one.kind !== kind)
31
+ throw new CliError("validation_error", "media recovery identity mismatch");
32
+ if (metadata.expected && (one.size !== metadata.expected.size || one.sha256 !== metadata.expected.sha256))
33
+ throw new CliError("validation_error", "media recovery checksum differs from the source");
34
+ if (metadata.expected && (one.messageTime !== metadata.messageTime || one.mime !== metadata.mime))
35
+ throw new CliError("validation_error", "media recovery metadata differs from the source");
36
+ return one;
37
+ },
38
+ },
39
+ evidence: (one) => ({ size: one.size, sha256: one.sha256, validator }),
40
+ signal,
41
+ });
42
+ const commit = async (one) => {
43
+ await beforeWrite();
44
+ await commitMediaEntry(root, one, beforeWrite);
45
+ };
46
+ let exists = false;
47
+ try {
48
+ await lstat(publication.finalPath);
49
+ exists = true;
50
+ }
51
+ catch (error) {
52
+ if (!missingMediaFile(error))
53
+ throw error;
54
+ }
55
+ const intent = await publication.read();
56
+ if (exists) {
57
+ await beforeWrite();
58
+ return publication.recover(storage.path, () => storage.load(locator), commit);
59
+ }
60
+ if (intent) {
61
+ const partial = await storage.load(locator);
62
+ if (!partial ||
63
+ partial.offset !== intent.size ||
64
+ partial.sha256 !== intent.sha256 ||
65
+ partial.validator !== validator)
66
+ throw new CliError("validation_error", "completed media recovery evidence is missing; choose a new destination");
67
+ await beforeWrite();
68
+ await publication.publish(storage.path, intent, () => commit(intent));
69
+ return intent;
70
+ }
71
+ const remote = await file();
72
+ if (remote.size !== undefined &&
73
+ (!Number.isSafeInteger(remote.size) || remote.size < 0 || remote.size > maximumFileBytes))
74
+ throw new CliError("validation_error", "invalid media download size");
75
+ await beforeWrite();
76
+ // No range validators are exposed by messenger streams. A cut download restarts; only finish writes a checkpoint.
77
+ const writer = await storage.open(locator, { validator, total: remote.size ?? null });
78
+ let proof;
79
+ try {
80
+ let received = 0;
81
+ for await (const chunk of remote.bytes()) {
82
+ await beforeWrite();
83
+ await writer.write(chunk);
84
+ received += chunk.length;
85
+ }
86
+ if (remote.size !== undefined && received !== remote.size)
87
+ throw new CliError("invalid_response", "media download ended with a different size");
88
+ proof = await writer.finish();
89
+ }
90
+ finally {
91
+ await writer.close();
92
+ }
93
+ if (metadata.expected && (proof.size !== metadata.expected.size || proof.sha256 !== metadata.expected.sha256))
94
+ throw new CliError("validation_error", "media source changed while copying; nothing was published");
95
+ const mime = (metadata.mime ?? remote.mime)?.split(";", 1)[0]?.trim().toLowerCase();
96
+ const entry = parseMediaEntry({
97
+ ...identity,
98
+ version: 1,
99
+ kind,
100
+ path: `${key}.bin`,
101
+ ...proof,
102
+ ...(metadata.messageTime ? { messageTime: metadata.messageTime } : {}),
103
+ ...(mime && mime.length <= 127 && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/.test(mime) ? { mime } : {}),
104
+ });
105
+ await beforeWrite();
106
+ await publication.write(entry);
107
+ await beforeWrite();
108
+ await publication.publish(storage.path, entry, () => commit(entry));
109
+ return entry;
110
+ };
@@ -0,0 +1,6 @@
1
+ /** Acquire in canonical path order, then recheck the graph before trusting relocation records. */
2
+ export declare const withMediaArchiveLocks: <T>(directory: string, signal: AbortSignal | undefined, run: (root: string, beforeWrite: () => Promise<void>) => Promise<T>, options?: {
3
+ create?: boolean;
4
+ additional?: readonly string[];
5
+ createAdditional?: boolean;
6
+ }) => Promise<T>;