@wirecat/cli-core 0.615.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 (89) hide show
  1. package/CHANGELOG.md +84 -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 +26 -4
  5. package/dist/background/report/render.js +56 -7
  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 +21 -19
  9. package/dist/background/report/stored-templates.js +20 -15
  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 +8 -1
  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 +10 -1
  34. package/dist/background/schedules.js +127 -30
  35. package/dist/cli/help/sections.js +1 -0
  36. package/dist/cli/schedule/schedule-command.js +3 -2
  37. package/dist/cli/templates-command.js +43 -20
  38. package/dist/domain/links.d.ts +1 -1
  39. package/dist/domain/links.js +1 -1
  40. package/dist/entities/fact.d.ts +4 -0
  41. package/dist/entities/fact.js +2 -1
  42. package/dist/entities/fields.d.ts +5 -0
  43. package/dist/entities/fields.js +3 -0
  44. package/dist/entities/index.d.ts +21 -1
  45. package/dist/entities/index.js +3 -1
  46. package/dist/entities/list-results.d.ts +4 -2
  47. package/dist/entities/list-results.js +4 -2
  48. package/dist/entities/memory.d.ts +4 -0
  49. package/dist/entities/memory.js +2 -1
  50. package/dist/entities/template.d.ts +11 -0
  51. package/dist/entities/template.js +12 -0
  52. package/dist/errors/reasons.js +6 -0
  53. package/dist/meetings/mcp/index.d.ts +15 -15
  54. package/dist/store/exports.d.ts +1 -0
  55. package/dist/store/exports.js +1 -0
  56. package/dist/store/index.d.ts +3 -2
  57. package/dist/store/index.js +1 -0
  58. package/dist/store/people.d.ts +7 -0
  59. package/dist/store/people.js +4 -0
  60. package/dist/store/source-review.d.ts +21 -0
  61. package/dist/store/sqlite/accounts.d.ts +3 -1
  62. package/dist/store/sqlite/accounts.js +10 -3
  63. package/dist/store/sqlite/added-sources.d.ts +16 -0
  64. package/dist/store/sqlite/added-sources.js +22 -0
  65. package/dist/store/sqlite/facts.js +3 -2
  66. package/dist/store/sqlite/imported-documents.js +3 -2
  67. package/dist/store/sqlite/knowledge.js +6 -4
  68. package/dist/store/sqlite/memories.js +5 -4
  69. package/dist/store/sqlite/mention-drain.js +9 -1
  70. package/dist/store/sqlite/merged-persons.d.ts +24 -0
  71. package/dist/store/sqlite/merged-persons.js +59 -0
  72. package/dist/store/sqlite/notes.js +5 -4
  73. package/dist/store/sqlite/person-links.d.ts +10 -1
  74. package/dist/store/sqlite/person-links.js +14 -6
  75. package/dist/store/sqlite/person-merges.d.ts +39 -0
  76. package/dist/store/sqlite/person-merges.js +136 -0
  77. package/dist/store/sqlite/person-preparation.js +11 -8
  78. package/dist/store/sqlite/person-resolution.js +2 -1
  79. package/dist/store/sqlite/person-scope.js +2 -1
  80. package/dist/store/sqlite/relation-list.js +3 -2
  81. package/dist/store/sqlite/reported-relations.js +6 -3
  82. package/dist/store/sqlite/source-review.d.ts +20 -1
  83. package/dist/store/sqlite/source-review.js +74 -3
  84. package/dist/store/sqlite/task-board.d.ts +6 -1
  85. package/dist/store/sqlite/task-board.js +22 -4
  86. package/dist/store/sqlite/work-tasks.js +8 -9
  87. package/dist/store/types.d.ts +2 -0
  88. package/package.json +2 -2
  89. package/parity.json +19 -0
@@ -1,18 +1,17 @@
1
- import { type ReportChannel } from "./render.js";
2
- import { type ReportKind } from "./schema.js";
3
- import { type ReportView } from "./view.js";
4
- /** What an owner's template renders. A key with no `kind` has storage and commands, but nothing renders it yet. */
1
+ import { type MessageKind } from "./messages.js";
2
+ import { type MessageView, type ReportChannel } from "./render.js";
3
+ /** What an owner's template renders: each key is one message kind. */
5
4
  export declare const TEMPLATE_KEYS: readonly [{
6
5
  readonly key: "report/morning-digest";
7
6
  readonly kind: "morning-digest";
8
7
  readonly about: "the morning digest";
9
8
  }, {
10
9
  readonly key: "report/weekly-gaps";
11
- readonly kind: null;
12
- readonly about: "the weekly list of what the digest could not check";
10
+ readonly kind: "weekly-gaps";
11
+ readonly about: "the weekly list of what the digest found on its own";
13
12
  }, {
14
13
  readonly key: "notice/schedule-failed";
15
- readonly kind: null;
14
+ readonly kind: "schedule-failed";
16
15
  readonly about: "the message sent when a scheduled run fails";
17
16
  }];
18
17
  export type TemplateKey = (typeof TEMPLATE_KEYS)[number]["key"];
@@ -22,20 +21,23 @@ export declare const templateKeyOf: (key: string) => {
22
21
  readonly about: "the morning digest";
23
22
  } | {
24
23
  readonly key: "report/weekly-gaps";
25
- readonly kind: null;
26
- readonly about: "the weekly list of what the digest could not check";
24
+ readonly kind: "weekly-gaps";
25
+ readonly about: "the weekly list of what the digest found on its own";
27
26
  } | {
28
27
  readonly key: "notice/schedule-failed";
29
- readonly kind: null;
28
+ readonly kind: "schedule-failed";
30
29
  readonly about: "the message sent when a scheduled run fails";
31
30
  } | undefined;
32
- export declare const reportKeyOf: (kind: ReportKind) => TemplateKey;
31
+ export declare const keyOfKind: (kind: MessageKind) => TemplateKey;
33
32
  /** The languages cli-core ships a template in for `kind`: a stored template in another one would never be used. */
34
- export declare const shippedLanguages: (kind: ReportKind) => string[];
35
- /** The synthetic report shipped beside the templates: every section, item type and health reason once. */
36
- export declare const sampleView: (kind: ReportKind, language: string, now: number) => ReportView;
37
- /** The newest `<run>.report.json` of `kind` the tool's schedules wrote, or undefined. */
38
- export declare const lastReport: (state: string, kind: ReportKind) => {
33
+ export declare const shippedLanguages: (kind: MessageKind) => string[];
34
+ /**
35
+ * The synthetic document shipped beside the templates (`<kind>.sample.json`): for the digest every section, item
36
+ * type and health reason once; for the others a week of gaps and one failed schedule.
37
+ */
38
+ export declare const sampleView: (kind: MessageKind, language: string, now: number) => MessageView;
39
+ /** The newest `<run>.report.json` of `kind` the tool's schedules wrote, or undefined; only the digest keeps one. */
40
+ export declare const lastReport: (state: string, kind: MessageKind) => {
39
41
  path: string;
40
42
  document: string;
41
43
  } | undefined;
@@ -50,7 +52,7 @@ export interface TemplateCheck {
50
52
  * report, when the tool has one, with the platform rules that run at send time. Any problem refuses the save.
51
53
  */
52
54
  export declare const checkTemplateSave: ({ kind, channel, language, body, state, now, }: {
53
- kind: ReportKind;
55
+ kind: MessageKind;
54
56
  channel: ReportChannel;
55
57
  language: string;
56
58
  body: string;
@@ -58,7 +60,7 @@ export declare const checkTemplateSave: ({ kind, channel, language, body, state,
58
60
  now: number;
59
61
  }) => Promise<TemplateCheck[]>;
60
62
  /** The view a preview renders: the last real report when there is one, else the sample. */
61
- export declare const previewView: (state: string, kind: ReportKind, language: string, now: number) => {
63
+ export declare const previewView: (state: string, kind: MessageKind, language: string, now: number) => {
62
64
  against: string;
63
- view: ReportView;
65
+ view: MessageView;
64
66
  };
@@ -3,17 +3,18 @@ import { join } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { linkFor } from "../../domain/links.js";
5
5
  import { schedulesDir } from "../schedules.js";
6
+ import { gapsView, noticeView, parseScheduleFailure, parseWeeklyGaps } from "./messages.js";
6
7
  import { checkTemplate, REPORT_CHANNELS } from "./render.js";
7
8
  import { parseReport } from "./schema.js";
8
9
  import { reportView } from "./view.js";
9
- /** What an owner's template renders. A key with no `kind` has storage and commands, but nothing renders it yet. */
10
+ /** What an owner's template renders: each key is one message kind. */
10
11
  export const TEMPLATE_KEYS = [
11
12
  { key: "report/morning-digest", kind: "morning-digest", about: "the morning digest" },
12
- { key: "report/weekly-gaps", kind: null, about: "the weekly list of what the digest could not check" },
13
- { key: "notice/schedule-failed", kind: null, about: "the message sent when a scheduled run fails" },
13
+ { key: "report/weekly-gaps", kind: "weekly-gaps", about: "the weekly list of what the digest found on its own" },
14
+ { key: "notice/schedule-failed", kind: "schedule-failed", about: "the message sent when a scheduled run fails" },
14
15
  ];
15
16
  export const templateKeyOf = (key) => TEMPLATE_KEYS.find((one) => one.key === key);
16
- export const reportKeyOf = (kind) => `report/${kind}`;
17
+ export const keyOfKind = (kind) => TEMPLATE_KEYS.find((one) => one.kind === kind).key;
17
18
  const TEMPLATES = fileURLToPath(new URL("./templates/", import.meta.url));
18
19
  /** The languages cli-core ships a template in for `kind`: a stored template in another one would never be used. */
19
20
  export const shippedLanguages = (kind) => [
@@ -21,28 +22,32 @@ export const shippedLanguages = (kind) => [
21
22
  .map((file) => file.match(new RegExp(`^${kind}\\.(?:${REPORT_CHANNELS.join("|")})\\.([a-z]{2})\\.liquid$`))?.[1])
22
23
  .filter((one) => one !== undefined)),
23
24
  ].sort();
24
- const viewOf = (document, language, now, timeZone) => {
25
+ const webLink = (ref) => linkFor(ref, { form: "web", env: {} });
26
+ const viewOf = (document, language, now) => {
25
27
  const parsed = parseReport(document);
26
28
  if (!parsed || "invalid" in parsed)
27
29
  return undefined;
28
- return reportView(parsed.report, {
29
- language,
30
- now,
31
- ...(timeZone ? { timeZone } : {}),
32
- linkOf: (ref) => linkFor(ref, { form: "web", env: {} }),
33
- });
30
+ return reportView(parsed.report, { language, now, linkOf: webLink });
34
31
  };
35
- /** The synthetic report shipped beside the templates: every section, item type and health reason once. */
32
+ /**
33
+ * The synthetic document shipped beside the templates (`<kind>.sample.json`): for the digest every section, item
34
+ * type and health reason once; for the others a week of gaps and one failed schedule.
35
+ */
36
36
  export const sampleView = (kind, language, now) => {
37
- const view = viewOf(readFileSync(join(TEMPLATES, `${kind}.sample.json`), "utf8"), language, now);
37
+ const json = readFileSync(join(TEMPLATES, `${kind}.sample.json`), "utf8");
38
+ if (kind === "weekly-gaps")
39
+ return gapsView(parseWeeklyGaps(json), { language, now, linkOf: webLink });
40
+ if (kind === "schedule-failed")
41
+ return noticeView(parseScheduleFailure(json), { language, now, linkOf: webLink });
42
+ const view = viewOf(json, language, now);
38
43
  if (!view)
39
44
  throw new Error(`the shipped ${kind} sample is not a report`);
40
45
  return view;
41
46
  };
42
- /** The newest `<run>.report.json` of `kind` the tool's schedules wrote, or undefined. */
47
+ /** The newest `<run>.report.json` of `kind` the tool's schedules wrote, or undefined; only the digest keeps one. */
43
48
  export const lastReport = (state, kind) => {
44
49
  const folder = schedulesDir(state);
45
- if (!existsSync(folder))
50
+ if (kind !== "morning-digest" || !existsSync(folder))
46
51
  return undefined;
47
52
  const files = readdirSync(folder).flatMap((name) => {
48
53
  const runs = join(folder, name, "runs");
@@ -84,6 +84,9 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
84
84
  {%- if group.link %}<a href="{{ group.link.url }}" style="color:#3b82c4">{{ words }}</a>{% else %}{{ words }}{% endif -%}
85
85
  {%- endfor -%}
86
86
  </p>{%- endif -%}
87
+ {%- if section.undated %}{{ nl }}<p style="margin:0 0 12px;{{ muted }}">no due date: {{ section.undated.count }}
88
+ {%- if section.undated.link %} · <a href="{{ section.undated.link.url }}" style="color:#3b82c4">open</a>{% endif -%}
89
+ </p>{%- endif -%}
87
90
  {%- endfor -%}
88
91
  {%- for source in health.items -%}
89
92
  {{ nl }}<p style="margin:20px 0 0;{{ muted }}">{{ health.emoji }} {{ source.source }}
@@ -84,6 +84,9 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
84
84
  {%- if group.link %}<a href="{{ group.link.url }}" style="color:#3b82c4">{{ words }}</a>{% else %}{{ words }}{% endif -%}
85
85
  {%- endfor -%}
86
86
  </p>{%- endif -%}
87
+ {%- if section.undated %}{{ nl }}<p style="margin:0 0 12px;{{ muted }}">без срока: {{ section.undated.count }}
88
+ {%- if section.undated.link %} · <a href="{{ section.undated.link.url }}" style="color:#3b82c4">открыть</a>{% endif -%}
89
+ </p>{%- endif -%}
87
90
  {%- endfor -%}
88
91
  {%- for source in health.items -%}
89
92
  {{ nl }}<p style="margin:20px 0 0;{{ muted }}">{{ health.emoji }} {{ source.source }}
@@ -146,5 +146,12 @@
146
146
  ],
147
147
  "counts": { "chats": 31, "mail": 12, "tasks": 17, "meetings": 1 }
148
148
  },
149
- "tasks": { "overdue": 5, "today": 3, "tomorrow": 2, "new": 4, "new_since": "2026-11-05T08:30:00+03:00" }
149
+ "tasks": {
150
+ "overdue": 5,
151
+ "today": 3,
152
+ "tomorrow": 2,
153
+ "new": 4,
154
+ "new_since": "2026-11-05T08:30:00+03:00",
155
+ "undated": 91
156
+ }
150
157
  }
@@ -82,6 +82,9 @@ Every string from the report is already escaped. Lines are written with {{ nl }}
82
82
  {%- if group.link %}<a href="{{ group.link.url }}">{{ words }}</a>{% else %}{{ words }}{% endif -%}
83
83
  {%- endfor -%}
84
84
  {%- endif -%}
85
+ {%- if section.undated %}{{ nl }}no due date: {{ section.undated.count }}
86
+ {%- if section.undated.link %} · <a href="{{ section.undated.link.url }}">open</a>{% endif -%}
87
+ {%- endif -%}
85
88
  {%- endfor -%}
86
89
  {%- if health.items.size > 0 %}{{ nl }}{% endif -%}
87
90
  {%- for source in health.items -%}
@@ -82,6 +82,9 @@ Every string from the report is already escaped. Lines are written with {{ nl }}
82
82
  {%- if group.link %}<a href="{{ group.link.url }}">{{ words }}</a>{% else %}{{ words }}{% endif -%}
83
83
  {%- endfor -%}
84
84
  {%- endif -%}
85
+ {%- if section.undated %}{{ nl }}без срока: {{ section.undated.count }}
86
+ {%- if section.undated.link %} · <a href="{{ section.undated.link.url }}">открыть</a>{% endif -%}
87
+ {%- endif -%}
85
88
  {%- endfor -%}
86
89
  {%- if health.items.size > 0 %}{{ nl }}{% endif -%}
87
90
  {%- for source in health.items -%}
@@ -81,6 +81,9 @@ Plain text: the terminal, latest.txt, the desktop notice, the email's plain part
81
81
  {%- if group.link %}{{ words }} {{ group.link.url }}{% else %}{{ words }}{% endif -%}
82
82
  {%- endfor -%}
83
83
  {%- endif -%}
84
+ {%- if section.undated %}{{ nl }}no due date: {{ section.undated.count }}
85
+ {%- if section.undated.link %} · open {{ section.undated.link.url }}{% endif -%}
86
+ {%- endif -%}
84
87
  {%- endfor -%}
85
88
  {%- if health.items.size > 0 %}{{ nl }}{% endif -%}
86
89
  {%- for source in health.items -%}
@@ -81,6 +81,9 @@ Plain text: the terminal, latest.txt, the desktop notice, the email's plain part
81
81
  {%- if group.link %}{{ words }} {{ group.link.url }}{% else %}{{ words }}{% endif -%}
82
82
  {%- endfor -%}
83
83
  {%- endif -%}
84
+ {%- if section.undated %}{{ nl }}без срока: {{ section.undated.count }}
85
+ {%- if section.undated.link %} · открыть {{ section.undated.link.url }}{% endif -%}
86
+ {%- endif -%}
84
87
  {%- endfor -%}
85
88
  {%- if health.items.size > 0 %}{{ nl }}{% endif -%}
86
89
  {%- for source in health.items -%}
@@ -0,0 +1,12 @@
1
+ {%- comment -%}
2
+ Email HTML with inline CSS: only div, p, b, i, a, br and span survive, with a style attribute and an href to a link
3
+ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (#3b82c4) read on white and on dark.
4
+ {%- endcomment -%}
5
+ {%- capture nl %}
6
+ {% endcapture -%}
7
+ <div style="max-width:600px;font-family:-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:15px">
8
+ {{- nl }}<p style="margin:0 0 8px;font-size:19px"><b>⚠️ {% if schedule == "morning-digest" %}The morning digest could not be built{% else %}The schedule “{{ tool }} {{ schedule }}” is failing{% endif %}</b></p>
9
+ {{- nl }}<p style="margin:0 0 4px">{% if failures > 1 %}Failing since {{ since.date }}{% if since.time %}, {{ since.time }}{% endif %} · {{ failures }} runs in a row{% else %}Failed {% if at.day == "today" %}today{% elsif at.day == "yesterday" %}yesterday{% else %}on {{ at.date }}{% endif %}{% if at.time %} at {{ at.time }}{% endif %}{% endif %}</p>
10
+ {{- nl }}<p style="margin:0 0 12px">Why: {% case cause %}{% when "locked" %}the keyring was locked; unlock the computer{% when "sign-in" %}the account needs a new sign-in{% when "network" %}the service could not be reached{% when "provider" %}the service answered with an error{% when "setup" %}something is wrong in the settings{% when "stopped" %}the run was stopped{% else %}the program ended with an error{% endcase %}</p>
11
+ {%- for link in links %}{{ nl }}<p style="margin:0"><a href="{{ link.url }}" style="color:#3b82c4">{{ link.label }}</a></p>{% endfor -%}
12
+ {{ nl }}</div>
@@ -0,0 +1,12 @@
1
+ {%- comment -%}
2
+ Email HTML with inline CSS: only div, p, b, i, a, br and span survive, with a style attribute and an href to a link
3
+ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (#3b82c4) read on white and on dark.
4
+ {%- endcomment -%}
5
+ {%- capture nl %}
6
+ {% endcapture -%}
7
+ <div style="max-width:600px;font-family:-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:15px">
8
+ {{- nl }}<p style="margin:0 0 8px;font-size:19px"><b>⚠️ {% if schedule == "morning-digest" %}Утренняя сводка не собралась{% else %}Расписание «{{ tool }} {{ schedule }}» не работает{% endif %}</b></p>
9
+ {{- nl }}<p style="margin:0 0 4px">{% if failures > 1 %}Не работает с {{ since.date }}{% if since.time %}, {{ since.time }}{% endif %} · {{ failures }} {% case plural %}{% when "one" %}запуск{% when "few" %}запуска{% else %}запусков{% endcase %} подряд{% else %}Сбой {% if at.day == "today" %}сегодня{% elsif at.day == "yesterday" %}вчера{% else %}{{ at.date }}{% endif %}{% if at.time %} в {{ at.time }}{% endif %}{% endif %}</p>
10
+ {{- nl }}<p style="margin:0 0 12px">Причина: {% case cause %}{% when "locked" %}хранилище паролей было заблокировано, разблокируйте компьютер{% when "sign-in" %}нужно заново войти в аккаунт{% when "network" %}нет связи с сервисом{% when "provider" %}сервис ответил ошибкой{% when "setup" %}ошибка в настройках{% when "stopped" %}запуск остановили{% else %}программа завершилась с ошибкой{% endcase %}</p>
11
+ {%- for link in links %}{{ nl }}<p style="margin:0"><a href="{{ link.url }}" style="color:#3b82c4">{{ link.label }}</a></p>{% endfor -%}
12
+ {{ nl }}</div>
@@ -0,0 +1,10 @@
1
+ {
2
+ "kind": "schedule-failed",
3
+ "tool": "memo",
4
+ "schedule": "morning-digest",
5
+ "at": "2026-11-06T08:31:00+03:00",
6
+ "since": "2026-11-05T08:31:00+03:00",
7
+ "failures": 2,
8
+ "cause": "sign-in",
9
+ "refs": ["sync:memo"]
10
+ }
@@ -0,0 +1,9 @@
1
+ {%- comment -%}
2
+ Telegram HTML: only <b>, <i> and <a href> survive, and an href only to a link of the view model.
3
+ {%- endcomment -%}
4
+ {%- capture nl %}
5
+ {% endcapture -%}
6
+ ⚠️ <b>{% if schedule == "morning-digest" %}The morning digest could not be built{% else %}The schedule “{{ tool }} {{ schedule }}” is failing{% endif %}</b>
7
+ {{- nl }}{% if failures > 1 %}Failing since {{ since.date }}{% if since.time %}, {{ since.time }}{% endif %} · {{ failures }} runs in a row{% else %}Failed {% if at.day == "today" %}today{% elsif at.day == "yesterday" %}yesterday{% else %}on {{ at.date }}{% endif %}{% if at.time %} at {{ at.time }}{% endif %}{% endif %}
8
+ {{- nl }}Why: {% case cause %}{% when "locked" %}the keyring was locked; unlock the computer{% when "sign-in" %}the account needs a new sign-in{% when "network" %}the service could not be reached{% when "provider" %}the service answered with an error{% when "setup" %}something is wrong in the settings{% when "stopped" %}the run was stopped{% else %}the program ended with an error{% endcase %}
9
+ {%- for link in links %}{{ nl }}<a href="{{ link.url }}">{{ link.label }}</a>{% endfor -%}
@@ -0,0 +1,9 @@
1
+ {%- comment -%}
2
+ Telegram HTML: only <b>, <i> and <a href> survive, and an href only to a link of the view model.
3
+ {%- endcomment -%}
4
+ {%- capture nl %}
5
+ {% endcapture -%}
6
+ ⚠️ <b>{% if schedule == "morning-digest" %}Утренняя сводка не собралась{% else %}Расписание «{{ tool }} {{ schedule }}» не работает{% endif %}</b>
7
+ {{- nl }}{% if failures > 1 %}Не работает с {{ since.date }}{% if since.time %}, {{ since.time }}{% endif %} · {{ failures }} {% case plural %}{% when "one" %}запуск{% when "few" %}запуска{% else %}запусков{% endcase %} подряд{% else %}Сбой {% if at.day == "today" %}сегодня{% elsif at.day == "yesterday" %}вчера{% else %}{{ at.date }}{% endif %}{% if at.time %} в {{ at.time }}{% endif %}{% endif %}
8
+ {{- nl }}Причина: {% case cause %}{% when "locked" %}хранилище паролей было заблокировано, разблокируйте компьютер{% when "sign-in" %}нужно заново войти в аккаунт{% when "network" %}нет связи с сервисом{% when "provider" %}сервис ответил ошибкой{% when "setup" %}ошибка в настройках{% when "stopped" %}запуск остановили{% else %}программа завершилась с ошибкой{% endcase %}
9
+ {%- for link in links %}{{ nl }}<a href="{{ link.url }}">{{ link.label }}</a>{% endfor -%}
@@ -0,0 +1,9 @@
1
+ {%- comment -%}
2
+ Plain text: the email's plain part and the terminal.
3
+ {%- endcomment -%}
4
+ {%- capture nl %}
5
+ {% endcapture -%}
6
+ ⚠️ {% if schedule == "morning-digest" %}The morning digest could not be built{% else %}The schedule “{{ tool }} {{ schedule }}” is failing{% endif %}
7
+ {{- nl }}{% if failures > 1 %}Failing since {{ since.date }}{% if since.time %}, {{ since.time }}{% endif %} · {{ failures }} runs in a row{% else %}Failed {% if at.day == "today" %}today{% elsif at.day == "yesterday" %}yesterday{% else %}on {{ at.date }}{% endif %}{% if at.time %} at {{ at.time }}{% endif %}{% endif %}
8
+ {{- nl }}Why: {% case cause %}{% when "locked" %}the keyring was locked; unlock the computer{% when "sign-in" %}the account needs a new sign-in{% when "network" %}the service could not be reached{% when "provider" %}the service answered with an error{% when "setup" %}something is wrong in the settings{% when "stopped" %}the run was stopped{% else %}the program ended with an error{% endcase %}
9
+ {%- for link in links %}{{ nl }}{{ link.label }}: {{ link.url }}{% endfor -%}
@@ -0,0 +1,9 @@
1
+ {%- comment -%}
2
+ Plain text: the email's plain part and the terminal.
3
+ {%- endcomment -%}
4
+ {%- capture nl %}
5
+ {% endcapture -%}
6
+ ⚠️ {% if schedule == "morning-digest" %}Утренняя сводка не собралась{% else %}Расписание «{{ tool }} {{ schedule }}» не работает{% endif %}
7
+ {{- nl }}{% if failures > 1 %}Не работает с {{ since.date }}{% if since.time %}, {{ since.time }}{% endif %} · {{ failures }} {% case plural %}{% when "one" %}запуск{% when "few" %}запуска{% else %}запусков{% endcase %} подряд{% else %}Сбой {% if at.day == "today" %}сегодня{% elsif at.day == "yesterday" %}вчера{% else %}{{ at.date }}{% endif %}{% if at.time %} в {{ at.time }}{% endif %}{% endif %}
8
+ {{- nl }}Причина: {% case cause %}{% when "locked" %}хранилище паролей было заблокировано, разблокируйте компьютер{% when "sign-in" %}нужно заново войти в аккаунт{% when "network" %}нет связи с сервисом{% when "provider" %}сервис ответил ошибкой{% when "setup" %}ошибка в настройках{% when "stopped" %}запуск остановили{% else %}программа завершилась с ошибкой{% endcase %}
9
+ {%- for link in links %}{{ nl }}{{ link.label }}: {{ link.url }}{% endfor -%}
@@ -0,0 +1,19 @@
1
+ {%- comment -%}
2
+ Email HTML with inline CSS: only div, p, b, i, a, br and span survive, with a style attribute and an href to a link
3
+ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (#3b82c4) read on white and on dark.
4
+ {%- endcomment -%}
5
+ {%- capture nl %}
6
+ {% endcapture -%}
7
+ {%- assign muted = "color:#8a8a8a;font-size:13px" -%}
8
+ <div style="max-width:600px;font-family:-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:15px">
9
+ {{- nl }}<p style="margin:0 0 4px;font-size:19px"><b>🔍 What the digest found on its own this week</b></p>
10
+ {{- nl }}<p style="margin:0 0 12px;{{ muted }}">Not in the day's selection · {{ runs }} {% if plural == "one" %}digest{% else %}digests{% endif %}, {{ from.date }} to {{ to.date }}</p>
11
+ {%- if items.size == 0 %}{{ nl }}<p style="margin:0 0 12px">Nothing was missed.</p>{% endif -%}
12
+ {%- for item in items -%}
13
+ {{ nl }}<p style="margin:0 0 10px">• {{ item.what }}<br><span style="{{ muted }}">
14
+ {%- if item.seen > 1 %}in {{ item.seen }} digests, last on {% endif %}{{ item.last.date }}
15
+ {%- for link in item.links %} · <a href="{{ link.url }}" style="color:#3b82c4">{{ link.label }}</a>{% endfor -%}
16
+ </span></p>
17
+ {%- endfor -%}
18
+ {%- if more > 0 %}{{ nl }}<p style="margin:0;{{ muted }}">{{ more }} more</p>{% endif -%}
19
+ {{ nl }}</div>
@@ -0,0 +1,19 @@
1
+ {%- comment -%}
2
+ Email HTML with inline CSS: only div, p, b, i, a, br and span survive, with a style attribute and an href to a link
3
+ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (#3b82c4) read on white and on dark.
4
+ {%- endcomment -%}
5
+ {%- capture nl %}
6
+ {% endcapture -%}
7
+ {%- assign muted = "color:#8a8a8a;font-size:13px" -%}
8
+ <div style="max-width:600px;font-family:-apple-system,Segoe UI,Roboto,Arial,sans-serif;font-size:15px">
9
+ {{- nl }}<p style="margin:0 0 4px;font-size:19px"><b>🔍 Что сводка нашла сама за неделю</b></p>
10
+ {{- nl }}<p style="margin:0 0 12px;{{ muted }}">Этого не было в подборке дня · {{ runs }} {% case plural %}{% when "one" %}сводка{% when "few" %}сводки{% else %}сводок{% endcase %} с {{ from.date }} по {{ to.date }}</p>
11
+ {%- if items.size == 0 %}{{ nl }}<p style="margin:0 0 12px">Пропусков не было.</p>{% endif -%}
12
+ {%- for item in items -%}
13
+ {{ nl }}<p style="margin:0 0 10px">• {{ item.what }}<br><span style="{{ muted }}">
14
+ {%- if item.seen > 1 %}в {{ item.seen }} {% if item.plural == "one" %}сводке{% else %}сводках{% endif %}, последний раз {% endif %}{{ item.last.date }}
15
+ {%- for link in item.links %} · <a href="{{ link.url }}" style="color:#3b82c4">{{ link.label }}</a>{% endfor -%}
16
+ </span></p>
17
+ {%- endfor -%}
18
+ {%- if more > 0 %}{{ nl }}<p style="margin:0;{{ muted }}">ещё {{ more }}</p>{% endif -%}
19
+ {{ nl }}</div>
@@ -0,0 +1,33 @@
1
+ {
2
+ "format": "wirecat.report/1",
3
+ "kind": "weekly-gaps",
4
+ "from": "2026-10-30T08:30:00+03:00",
5
+ "to": "2026-11-06T08:30:00+03:00",
6
+ "runs": 6,
7
+ "gaps": [
8
+ {
9
+ "what": "Анна Котова ждёт ответа в WhatsApp, а в подборке дня его не было",
10
+ "section": "owed",
11
+ "refs": ["chat:whatsapp/1001/4004"],
12
+ "seen": 4,
13
+ "first": "2026-11-01T08:31:00+03:00",
14
+ "last": "2026-11-06T08:31:00+03:00"
15
+ },
16
+ {
17
+ "what": "Счёт ООО «Вектор» нашёлся только поиском по почте",
18
+ "section": "mail",
19
+ "refs": ["msg:email/7"],
20
+ "seen": 2,
21
+ "first": "2026-11-03T08:31:00+03:00",
22
+ "last": "2026-11-05T08:31:00+03:00"
23
+ },
24
+ {
25
+ "what": "Встреча с подрядчиком в среду есть в календаре, но не в списке встреч",
26
+ "section": null,
27
+ "refs": [],
28
+ "seen": 1,
29
+ "first": "2026-11-04T08:31:00+03:00",
30
+ "last": "2026-11-04T08:31:00+03:00"
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,15 @@
1
+ {%- comment -%}
2
+ Telegram HTML: only <b>, <i> and <a href> survive, and an href only to a link of the view model.
3
+ Every string is already escaped. Lines are written with {{ nl }}; tags trim the source's own.
4
+ {%- endcomment -%}
5
+ {%- capture nl %}
6
+ {% endcapture -%}
7
+ 🔍 <b>What the digest found on its own this week</b>
8
+ {{- nl }}<i>Not in the day's selection · {{ runs }} {% if plural == "one" %}digest{% else %}digests{% endif %}, {{ from.date }} to {{ to.date }}</i>
9
+ {%- if items.size == 0 %}{{ nl }}{{ nl }}Nothing was missed.{% endif -%}
10
+ {%- for item in items -%}
11
+ {{ nl }}{{ nl }}• {{ item.what }}
12
+ {{- nl }}<i>{% if item.seen > 1 %}in {{ item.seen }} digests, last on {% endif %}{{ item.last.date }}</i>
13
+ {%- for link in item.links %} · <a href="{{ link.url }}">{{ link.label }}</a>{% endfor -%}
14
+ {%- endfor -%}
15
+ {%- if more > 0 %}{{ nl }}{{ nl }}{{ more }} more{% endif -%}
@@ -0,0 +1,15 @@
1
+ {%- comment -%}
2
+ Telegram HTML: only <b>, <i> and <a href> survive, and an href only to a link of the view model.
3
+ Every string is already escaped. Lines are written with {{ nl }}; tags trim the source's own.
4
+ {%- endcomment -%}
5
+ {%- capture nl %}
6
+ {% endcapture -%}
7
+ 🔍 <b>Что сводка нашла сама за неделю</b>
8
+ {{- nl }}<i>Этого не было в подборке дня · {{ runs }} {% case plural %}{% when "one" %}сводка{% when "few" %}сводки{% else %}сводок{% endcase %} с {{ from.date }} по {{ to.date }}</i>
9
+ {%- if items.size == 0 %}{{ nl }}{{ nl }}Пропусков не было.{% endif -%}
10
+ {%- for item in items -%}
11
+ {{ nl }}{{ nl }}• {{ item.what }}
12
+ {{- nl }}<i>{% if item.seen > 1 %}в {{ item.seen }} {% if item.plural == "one" %}сводке{% else %}сводках{% endif %}, последний раз {% endif %}{{ item.last.date }}</i>
13
+ {%- for link in item.links %} · <a href="{{ link.url }}">{{ link.label }}</a>{% endfor -%}
14
+ {%- endfor -%}
15
+ {%- if more > 0 %}{{ nl }}{{ nl }}ещё {{ more }}{% endif -%}
@@ -0,0 +1,14 @@
1
+ {%- comment -%}
2
+ Plain text: the email's plain part and the terminal. Line 2 of an item is indented by two spaces.
3
+ {%- endcomment -%}
4
+ {%- capture nl %}
5
+ {% endcapture -%}
6
+ 🔍 What the digest found on its own this week
7
+ {{- nl }}Not in the day's selection · {{ runs }} {% if plural == "one" %}digest{% else %}digests{% endif %}, {{ from.date }} to {{ to.date }}
8
+ {%- if items.size == 0 %}{{ nl }}{{ nl }}Nothing was missed.{% endif -%}
9
+ {%- for item in items -%}
10
+ {{ nl }}{{ nl }}• {{ item.what }}
11
+ {{- nl }} {% if item.seen > 1 %}in {{ item.seen }} digests, last on {% endif %}{{ item.last.date }}
12
+ {%- for link in item.links %} · {{ link.url }}{% endfor -%}
13
+ {%- endfor -%}
14
+ {%- if more > 0 %}{{ nl }}{{ nl }}{{ more }} more{% endif -%}
@@ -0,0 +1,14 @@
1
+ {%- comment -%}
2
+ Plain text: the email's plain part and the terminal. Line 2 of an item is indented by two spaces.
3
+ {%- endcomment -%}
4
+ {%- capture nl %}
5
+ {% endcapture -%}
6
+ 🔍 Что сводка нашла сама за неделю
7
+ {{- nl }}Этого не было в подборке дня · {{ runs }} {% case plural %}{% when "one" %}сводка{% when "few" %}сводки{% else %}сводок{% endcase %} с {{ from.date }} по {{ to.date }}
8
+ {%- if items.size == 0 %}{{ nl }}{{ nl }}Пропусков не было.{% endif -%}
9
+ {%- for item in items -%}
10
+ {{ nl }}{{ nl }}• {{ item.what }}
11
+ {{- nl }} {% if item.seen > 1 %}в {{ item.seen }} {% if item.plural == "one" %}сводке{% else %}сводках{% endif %}, последний раз {% endif %}{{ item.last.date }}
12
+ {%- for link in item.links %} · {{ link.url }}{% endfor -%}
13
+ {%- endfor -%}
14
+ {%- if more > 0 %}{{ nl }}{{ nl }}ещё {{ more }}{% endif -%}
@@ -54,6 +54,11 @@ export interface ViewSection {
54
54
  more: number;
55
55
  /** The task group links, on the section that holds the task items only; zero groups left out. */
56
56
  groups: ViewTaskGroup[];
57
+ /** The open tasks with no due date, a line after the groups on the same section; null when there are none. */
58
+ undated: {
59
+ count: number;
60
+ link: ViewLink | null;
61
+ } | null;
57
62
  }
58
63
  export interface ViewHealth {
59
64
  source: string;
@@ -166,10 +166,18 @@ export const reportView = (report, { language, now, timeZone, linkOf = () => nul
166
166
  items: items.slice(0, cap).map(itemOf),
167
167
  more: more + Math.max(items.length - cap, 0),
168
168
  groups: [],
169
+ undated: null,
169
170
  },
170
171
  ];
171
172
  });
172
173
  const groups = taskGroups(report.tasks, linkOf, words.open);
174
+ const undatedLink = linkOf("tasks:undated");
175
+ const undated = report.tasks?.undated
176
+ ? {
177
+ count: report.tasks.undated,
178
+ link: undatedLink === null ? null : { kind: "open", url: undatedLink, label: words.open },
179
+ }
180
+ : null;
173
181
  const holder = sections.find((section) => section.items.some((item) => item.type === "task")) ??
174
182
  sections.find((section) => section.kind === "today") ??
175
183
  sections.at(-1);
@@ -184,7 +192,7 @@ export const reportView = (report, { language, now, timeZone, linkOf = () => nul
184
192
  emoji: "☀️",
185
193
  date: momentFor(report.date, now, language, timeZone),
186
194
  summary: report.summary,
187
- sections: sections.map((section) => (section === holder ? { ...section, groups } : section)),
195
+ sections: sections.map((section) => (section === holder ? { ...section, groups, undated } : section)),
188
196
  health: {
189
197
  emoji: "🛠",
190
198
  items: stale.slice(0, SECTION_CAPS.health).map((entry) => ({
@@ -77,6 +77,8 @@ export interface LastRun {
77
77
  failures?: number;
78
78
  /** What the run cost, as the harness reported it; absent when it reports none. */
79
79
  costUsd?: number;
80
+ /** The SHA-256 of a mail-gated agent's input, so a timer can tell the next input is the same one. */
81
+ inputHash?: string;
80
82
  /** The last time the timer did not start it, and why; a run after it clears this. */
81
83
  skipped?: {
82
84
  at: string;
@@ -93,6 +95,7 @@ export declare const SKIP_REASONS: {
93
95
  readonly costDayCap: "cost.day-cap";
94
96
  readonly mailNone: "mail.none-new";
95
97
  readonly mailBelowThreshold: "mail.below-threshold";
98
+ readonly mailSameInput: "mail.same-input";
96
99
  };
97
100
  export type SkipReason = (typeof SKIP_REASONS)[keyof typeof SKIP_REASONS];
98
101
  /**
@@ -118,6 +121,7 @@ export declare const recordRun: (path: string, run: {
118
121
  reason?: string;
119
122
  errorCode?: string;
120
123
  costUsd?: number;
124
+ inputHash?: string;
121
125
  }) => LastRun;
122
126
  /** Notes on the last run that the timer left this one out, keeping that run's result. */
123
127
  export declare const recordSkip: (file: string, why: string, reason: SkipReason, at?: Date) => void;
@@ -175,7 +179,7 @@ export declare const CREDENTIALS_UNREACHABLE = "credentials.unreachable";
175
179
  * keyring, so a run that fails for that reason is tried again, a minute then up to 15 minutes apart, for up to
176
180
  * 12 hours. A schedule that repeats every few minutes is left to its next tick; a run by hand fails at once.
177
181
  */
178
- export declare const runSchedule: (app: AppIdentity, system: ServerSystem, env: NodeJS.ProcessEnv, file: string, { now, timer, signal, killAfterMs, untilUnlocked, wait, agentRuns, agentInput, ownerLanguage, reportTemplates, }?: {
182
+ export declare const runSchedule: (app: AppIdentity, system: ServerSystem, env: NodeJS.ProcessEnv, file: string, { now, timer, signal, killAfterMs, untilUnlocked, wait, agentRuns, agentInput, ownerLanguage, reportTemplates, skipRepeatedInput, }?: {
179
183
  now?: () => Date;
180
184
  timer?: Timer;
181
185
  signal?: AbortSignal;
@@ -189,4 +193,9 @@ export declare const runSchedule: (app: AppIdentity, system: ServerSystem, env:
189
193
  ownerLanguage?: (env: NodeJS.ProcessEnv) => Promise<string>;
190
194
  /** The owner's stored report templates; the shipped ones when the host gives none. */
191
195
  reportTemplates?: (env: NodeJS.ProcessEnv) => StoredTemplates;
196
+ /**
197
+ * Leave out a mail-gated agent whose input is the one its last run ended well on. The mark did not move, so the
198
+ * run would only meet the same input again and pay for it; new mail changes the input.
199
+ */
200
+ skipRepeatedInput?: boolean;
192
201
  }) => Promise<LastRun>;