@wirecat/cli-core 0.614.0 → 0.616.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 (106) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/dist/background/report/messages.d.ts +108 -0
  3. package/dist/background/report/messages.js +230 -0
  4. package/dist/background/report/render.d.ts +41 -5
  5. package/dist/background/report/render.js +115 -25
  6. package/dist/background/report/schema.d.ts +7 -1
  7. package/dist/background/report/schema.js +9 -3
  8. package/dist/background/report/stored-templates.d.ts +66 -0
  9. package/dist/background/report/stored-templates.js +85 -0
  10. package/dist/background/report/templates/morning-digest.email.en.liquid +3 -0
  11. package/dist/background/report/templates/morning-digest.email.ru.liquid +3 -0
  12. package/dist/background/report/templates/morning-digest.sample.json +157 -0
  13. package/dist/background/report/templates/morning-digest.telegram.en.liquid +3 -0
  14. package/dist/background/report/templates/morning-digest.telegram.ru.liquid +3 -0
  15. package/dist/background/report/templates/morning-digest.text.en.liquid +3 -0
  16. package/dist/background/report/templates/morning-digest.text.ru.liquid +3 -0
  17. package/dist/background/report/templates/schedule-failed.email.en.liquid +12 -0
  18. package/dist/background/report/templates/schedule-failed.email.ru.liquid +12 -0
  19. package/dist/background/report/templates/schedule-failed.sample.json +10 -0
  20. package/dist/background/report/templates/schedule-failed.telegram.en.liquid +9 -0
  21. package/dist/background/report/templates/schedule-failed.telegram.ru.liquid +9 -0
  22. package/dist/background/report/templates/schedule-failed.text.en.liquid +9 -0
  23. package/dist/background/report/templates/schedule-failed.text.ru.liquid +9 -0
  24. package/dist/background/report/templates/weekly-gaps.email.en.liquid +19 -0
  25. package/dist/background/report/templates/weekly-gaps.email.ru.liquid +19 -0
  26. package/dist/background/report/templates/weekly-gaps.sample.json +33 -0
  27. package/dist/background/report/templates/weekly-gaps.telegram.en.liquid +15 -0
  28. package/dist/background/report/templates/weekly-gaps.telegram.ru.liquid +15 -0
  29. package/dist/background/report/templates/weekly-gaps.text.en.liquid +14 -0
  30. package/dist/background/report/templates/weekly-gaps.text.ru.liquid +14 -0
  31. package/dist/background/report/view.d.ts +5 -0
  32. package/dist/background/report/view.js +9 -1
  33. package/dist/background/schedules.d.ts +13 -2
  34. package/dist/background/schedules.js +128 -30
  35. package/dist/cli/help/sections.js +1 -0
  36. package/dist/cli/index.d.ts +2 -1
  37. package/dist/cli/index.js +1 -1
  38. package/dist/cli/schedule/schedule-command.d.ts +2 -0
  39. package/dist/cli/schedule/schedule-command.js +21 -2
  40. package/dist/cli/shared-command-exports.d.ts +1 -0
  41. package/dist/cli/shared-command-exports.js +2 -0
  42. package/dist/cli/templates-command.d.ts +16 -0
  43. package/dist/cli/templates-command.js +266 -0
  44. package/dist/domain/links.d.ts +1 -1
  45. package/dist/domain/links.js +1 -1
  46. package/dist/entities/fact.d.ts +4 -0
  47. package/dist/entities/fact.js +2 -1
  48. package/dist/entities/fields.d.ts +5 -0
  49. package/dist/entities/fields.js +3 -0
  50. package/dist/entities/index.d.ts +21 -1
  51. package/dist/entities/index.js +3 -1
  52. package/dist/entities/list-results.d.ts +4 -2
  53. package/dist/entities/list-results.js +4 -2
  54. package/dist/entities/memory.d.ts +4 -0
  55. package/dist/entities/memory.js +2 -1
  56. package/dist/entities/template.d.ts +11 -0
  57. package/dist/entities/template.js +12 -0
  58. package/dist/errors/reasons.js +13 -0
  59. package/dist/meetings/mcp/index.d.ts +15 -15
  60. package/dist/services/metadata.d.ts +1 -1
  61. package/dist/store/exports.d.ts +2 -0
  62. package/dist/store/exports.js +2 -0
  63. package/dist/store/index.d.ts +4 -2
  64. package/dist/store/index.js +1 -0
  65. package/dist/store/people.d.ts +7 -0
  66. package/dist/store/people.js +4 -0
  67. package/dist/store/source-review.d.ts +21 -0
  68. package/dist/store/sqlite/accounts.d.ts +3 -1
  69. package/dist/store/sqlite/accounts.js +10 -3
  70. package/dist/store/sqlite/added-sources.d.ts +16 -0
  71. package/dist/store/sqlite/added-sources.js +22 -0
  72. package/dist/store/sqlite/facts.js +3 -2
  73. package/dist/store/sqlite/imported-documents.js +3 -2
  74. package/dist/store/sqlite/knowledge.js +6 -4
  75. package/dist/store/sqlite/manifest.js +1 -0
  76. package/dist/store/sqlite/memories.js +5 -4
  77. package/dist/store/sqlite/mention-drain.js +9 -1
  78. package/dist/store/sqlite/merged-persons.d.ts +24 -0
  79. package/dist/store/sqlite/merged-persons.js +59 -0
  80. package/dist/store/sqlite/migrations.generated.js +8 -0
  81. package/dist/store/sqlite/notes.js +5 -4
  82. package/dist/store/sqlite/person-links.d.ts +10 -1
  83. package/dist/store/sqlite/person-links.js +14 -6
  84. package/dist/store/sqlite/person-merges.d.ts +39 -0
  85. package/dist/store/sqlite/person-merges.js +136 -0
  86. package/dist/store/sqlite/person-preparation.js +11 -8
  87. package/dist/store/sqlite/person-resolution.js +2 -1
  88. package/dist/store/sqlite/person-scope.js +2 -1
  89. package/dist/store/sqlite/relation-list.js +3 -2
  90. package/dist/store/sqlite/reported-relations.js +6 -3
  91. package/dist/store/sqlite/schema/templates.d.ts +242 -0
  92. package/dist/store/sqlite/schema/templates.js +23 -0
  93. package/dist/store/sqlite/schema.d.ts +1 -0
  94. package/dist/store/sqlite/schema.js +1 -0
  95. package/dist/store/sqlite/source-review.d.ts +20 -1
  96. package/dist/store/sqlite/source-review.js +74 -3
  97. package/dist/store/sqlite/task-board.d.ts +6 -1
  98. package/dist/store/sqlite/task-board.js +22 -4
  99. package/dist/store/sqlite/templates.d.ts +38 -0
  100. package/dist/store/sqlite/templates.js +69 -0
  101. package/dist/store/sqlite/work-tasks.js +8 -9
  102. package/dist/store/store.d.ts +3 -0
  103. package/dist/store/store.js +5 -0
  104. package/dist/store/types.d.ts +2 -0
  105. package/package.json +4 -4
  106. package/parity.json +19 -0
@@ -5,11 +5,12 @@ import { TASK_TYPES, WORK_TASK_TYPES } from "../../domain/knowledge.js";
5
5
  import { checkedScore, isClosedState, legacyPriority, PRIORITY_LABELS, priorityBand, priorityLabel, TASK_STATES, } from "../../tasks/index.js";
6
6
  import { folded } from "./folded.js";
7
7
  import { authorActor } from "./memories.js";
8
+ import { idsOf } from "./merged-persons.js";
8
9
  import { CORPORA, drainCorpus } from "./note-index.js";
9
10
  import { requiredThing } from "./notes.js";
10
11
  import { queryFilter } from "./query-filter.js";
11
12
  import { stemmerCache } from "./stems.js";
12
- import { BOARD_SCOPE, boardOrder, dueGroups, projectTaskColumns, withoutField, } from "./task-board.js";
13
+ import { BOARD_SCOPE, boardOrder, dueGroups, mergedAssignees, projectTaskColumns, TASK_PEOPLE, withoutField, } from "./task-board.js";
13
14
  import { closeSuggestionOf, SUGGESTION_COLUMNS } from "./task-close.js";
14
15
  import { addComment, authorNamed, commentsOf } from "./task-comments.js";
15
16
  import { INBOX_KEY_LENGTH, inboxKey } from "./task-keys.js";
@@ -161,7 +162,7 @@ export const workTaskOperationsOver = (context) => {
161
162
  const boardWhere = (query, zone, at) => {
162
163
  if (query === undefined)
163
164
  return { sql: BOARD_SCOPE, params: [] };
164
- const where = queryFilter(query, projectTaskColumns(at, timezoneOf(zone)), {
165
+ const where = queryFilter(query, projectTaskColumns(at, timezoneOf(zone), database), {
165
166
  command: "tasks list",
166
167
  now: at,
167
168
  ...(zone ? { zone } : {}),
@@ -438,8 +439,9 @@ export const workTaskOperationsOver = (context) => {
438
439
  checkRevision(rowById(task), check.revision);
439
440
  const person = personOf(to);
440
441
  const held = database
441
- .prepare("SELECT 1 FROM task_assignments WHERE task_id = ? AND assignee_type = 'person' AND assignee_id = ? AND role = ?")
442
- .get(task, person, role);
442
+ .prepare("SELECT 1 FROM task_assignments WHERE task_id = ? AND assignee_type = 'person' " +
443
+ "AND assignee_id IN (SELECT value FROM json_each(?)) AND role = ?")
444
+ .get(task, idsOf(database, "person", person), role);
443
445
  if (held)
444
446
  return;
445
447
  const at = now();
@@ -622,11 +624,8 @@ export const workTaskOperationsOver = (context) => {
622
624
  };
623
625
  },
624
626
  taskPeople: async ({ limit = 500 } = {}) => database
625
- .prepare("SELECT p.id, p.name, p.owner, count(DISTINCT t.id) AS n FROM persons p " +
626
- "LEFT JOIN task_assignments a ON a.assignee_type = 'person' AND a.assignee_id = p.id " +
627
- "LEFT JOIN tasks t ON t.id = a.task_id AND t.deleted_at IS NULL " +
628
- "GROUP BY p.id ORDER BY p.owner DESC, n DESC, p.name IS NULL, p.name COLLATE NOCASE, p.id LIMIT ?")
629
- .all(Math.min(Math.max(limit, 1), 5000))
627
+ .prepare(`${TASK_PEOPLE}`)
628
+ .all(mergedAssignees(database), Math.min(Math.max(limit, 1), 5000))
630
629
  .map((row) => ({
631
630
  person: `person:${row.id}`,
632
631
  name: row.name == null ? null : String(row.name),
@@ -49,6 +49,7 @@ import { type RecordStore } from "./sqlite/records.js";
49
49
  import { type RelationsStore } from "./sqlite/reported-relations.js";
50
50
  import { type SubscriptionsStore } from "./sqlite/subscriptions.js";
51
51
  import { type StoreTaskStore } from "./sqlite/tasks.js";
52
+ import { type TemplateStore } from "./sqlite/templates.js";
52
53
  import { type WalletsStore } from "./sqlite/wallets.js";
53
54
  import { type SyncStore } from "./sync.js";
54
55
  import { type TagsStore } from "./tags.js";
@@ -135,6 +136,8 @@ export interface MessageStore {
135
136
  readonly relations: RelationsStore;
136
137
  /** The one-time keys behind the buttons of a message that asks the owner to decide a batch. */
137
138
  readonly decisionRequests: DecisionRequestStore;
139
+ /** The message templates the owner saved over the shipped ones, with every body a change replaced. */
140
+ readonly templates: TemplateStore;
138
141
  /** What each import said, by the source's identity; `ingest` (services) is the way in. */
139
142
  readonly records: RecordStore;
140
143
  /** What agents concluded: summaries, digests, facts, preferences, each with evidence and a scope. */
@@ -55,6 +55,7 @@ import { relationsStoreOver } from "./sqlite/reported-relations.js";
55
55
  import * as stems from "./sqlite/stems.js";
56
56
  import { subscriptionsStoreOver } from "./sqlite/subscriptions.js";
57
57
  import { taskStoreOver } from "./sqlite/tasks.js";
58
+ import { templateStoreOver } from "./sqlite/templates.js";
58
59
  import { walletsStoreOver } from "./sqlite/wallets.js";
59
60
  import { storeErrors } from "./store-errors.js";
60
61
  import { syncStoreOver } from "./sync.js";
@@ -135,6 +136,7 @@ const storeOver = (context) => {
135
136
  const crm = once(() => crmCopiesOver(context, accountPeopleOver(context)));
136
137
  const relations = once(() => relationsStoreOver(context));
137
138
  const decisionRequests = once(() => decisionRequestStoreOver(context));
139
+ const templates = once(() => templateStoreOver(context));
138
140
  const records = once(() => recordStoreOver(context));
139
141
  const memories = once(() => memoriesStoreOver(context));
140
142
  const proposedActions = once(() => proposedActionsStoreOver(context));
@@ -277,6 +279,9 @@ const storeOver = (context) => {
277
279
  get decisionRequests() {
278
280
  return decisionRequests();
279
281
  },
282
+ get templates() {
283
+ return templates();
284
+ },
280
285
  get records() {
281
286
  return records();
282
287
  },
@@ -67,6 +67,8 @@ export interface PersonRecord {
67
67
  uid: string;
68
68
  name: string | null;
69
69
  identities: LinkedIdentity[];
70
+ /** Set when the uid asked for was merged away: the uid of the person its identities are now, the same as `uid`. */
71
+ mergedInto?: string;
70
72
  }
71
73
  /** What a search of one account's messages takes, the account given apart. */
72
74
  export interface AccountMessageFilter {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.614.0",
3
+ "version": "0.616.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",
@@ -15,7 +15,7 @@
15
15
  "type": "module",
16
16
  "wirecat": {
17
17
  "store": {
18
- "speaks": 58,
18
+ "speaks": 59,
19
19
  "minCompatible": 56
20
20
  }
21
21
  },
@@ -278,7 +278,7 @@
278
278
  "@types/node": "^22.20.5",
279
279
  "@types/pngjs": "6.0.5",
280
280
  "@vitest/coverage-v8": "^5.0.5",
281
- "@wirecat/cli-base": "0.85.0",
281
+ "@wirecat/cli-base": "0.90.0",
282
282
  "@wirecat/cli-core-legacy-tags": "npm:@wirecat/cli-core@0.414.0",
283
283
  "ajv": "8.17.1",
284
284
  "commander": "15.0.0",
@@ -299,7 +299,7 @@
299
299
  },
300
300
  "peerDependencies": {
301
301
  "@napi-rs/canvas": ">=0.1.69 <2",
302
- "@wirecat/cli-base": ">=0.80.7 <0.86.0",
302
+ "@wirecat/cli-base": ">=0.80.7 <1.0.0",
303
303
  "commander": ">=15"
304
304
  },
305
305
  "bin": {
package/parity.json CHANGED
@@ -304,6 +304,9 @@
304
304
  "--defaults": {
305
305
  "meaning": "change what every profile gets, rather than this profile"
306
306
  },
307
+ "--delete-data": {
308
+ "meaning": "also delete the account's messages and files on this computer"
309
+ },
307
310
  "--deliver-to": {
308
311
  "value": "<route>",
309
312
  "meaning": "where a schedule's result also goes, when --notify-on says so: telegram-bot:<profile>/<chat>, email:<profile>/<address>; repeat it for more"
@@ -499,6 +502,9 @@
499
502
  "--jsonl": {
500
503
  "meaning": "machine-readable output: one JSON object per line, for streaming and jq"
501
504
  },
505
+ "--keep-data": {
506
+ "meaning": "keep the account's messages on this computer; search still finds them"
507
+ },
502
508
  "--kind": {
503
509
  "value": "<kind>",
504
510
  "meaning": "the kind of link to record; the command lists the supported task and evidence relations"
@@ -1293,6 +1299,19 @@
1293
1299
  "wa": "wa backlog: account privacy"
1294
1300
  }
1295
1301
  },
1302
+ "account remove": {
1303
+ "in": [],
1304
+ "options": {
1305
+ "--delete-data": "all",
1306
+ "--dry-run": "all",
1307
+ "--keep-data": "all"
1308
+ },
1309
+ "planned": {
1310
+ "max": "account remove: adopt Messenger.accountRemoval (WireCat Desktop removal)",
1311
+ "tg": "account remove: adopt Messenger.accountRemoval (WireCat Desktop removal)",
1312
+ "wa": "account remove: adopt Messenger.accountRemoval (WireCat Desktop removal)"
1313
+ }
1314
+ },
1296
1315
  "account sessions": {
1297
1316
  "in": "all"
1298
1317
  },