@wirecat/cli-core 0.612.0 → 0.614.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.
- package/CHANGELOG.md +55 -0
- package/dist/background/report/render.d.ts +10 -1
- package/dist/background/report/render.js +20 -7
- package/dist/background/report/schema.d.ts +37 -0
- package/dist/background/report/schema.js +98 -4
- package/dist/background/report/templates/morning-digest.email.en.liquid +49 -8
- package/dist/background/report/templates/morning-digest.email.ru.liquid +49 -8
- package/dist/background/report/templates/morning-digest.telegram.en.liquid +49 -9
- package/dist/background/report/templates/morning-digest.telegram.ru.liquid +49 -9
- package/dist/background/report/templates/morning-digest.text.en.liquid +49 -9
- package/dist/background/report/templates/morning-digest.text.ru.liquid +49 -9
- package/dist/background/report/view.d.ts +34 -3
- package/dist/background/report/view.js +59 -5
- package/dist/background/schedules.js +19 -3
- package/dist/calendar/mcp/index.d.ts +12 -12
- package/dist/cli/account-remove.d.ts +67 -0
- package/dist/cli/account-remove.js +285 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +1 -0
- package/dist/cli/messenger/account-command.js +6 -0
- package/dist/cli/messenger/context.d.ts +2 -0
- package/dist/cli/messenger/serve-relay.d.ts +1 -0
- package/dist/cli/profile-files.d.ts +7 -0
- package/dist/cli/profile-files.js +43 -0
- package/dist/domain/links.d.ts +72 -0
- package/dist/domain/links.js +139 -0
- package/dist/entities/account-change.d.ts +20 -0
- package/dist/entities/account-change.js +12 -1
- package/dist/entities/index.d.ts +20 -0
- package/dist/entities/index.js +2 -1
- package/dist/errors/reasons.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/services/metadata.d.ts +1 -1
- package/dist/store/accounts.d.ts +2 -0
- package/dist/store/accounts.js +2 -1
- package/dist/store/sqlite/account-groups.d.ts +1 -0
- package/dist/store/sqlite/account-groups.js +14 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
|
|
|
5
5
|
minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
|
|
6
6
|
shape of this file.
|
|
7
7
|
|
|
8
|
+
## 0.614.0 — 08.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`account remove`, built once for every tool.** `<tool> <profile> account remove --keep-data|--delete-data` signs
|
|
13
|
+
the profile out with the tool's own `signOut` hook, then forgets it here: its keyring entries, its
|
|
14
|
+
`state/accounts/<profile>.json`, the tool's own state files and its sections in the config file; other profiles stay.
|
|
15
|
+
`--delete-data` also purges the account from the shared store (`store.accounts.purge`) and deletes the tool's data
|
|
16
|
+
files; `--keep-data` leaves its messages in the store, still searchable, and says so under `kept`. It asks first, or
|
|
17
|
+
`--yes`; under `--json` without `--yes` it answers `confirmation_required`; `--dry-run` lists every entry, section and
|
|
18
|
+
file. It refuses while a serve or a sync holds the profile, a path outside the tool's own folders, and runs neither
|
|
19
|
+
over MCP nor under `<PREFIX>_READ_ONLY`. The answer is the entity `account_removal`; reasons `account-remove.*`.
|
|
20
|
+
A messenger opts in with `Messenger.accountRemoval`; any other CLI mounts `accountRemoveCommand(app, hooks)`
|
|
21
|
+
([guide](docs/dev/ACCOUNT-REMOVAL.md)). `store.accounts.forgetProfile` forgets which account a profile was.
|
|
22
|
+
It also removes what cli-core keeps for the profile, so no tool lists it: its flood, pace, recipients, moderation,
|
|
23
|
+
provider log, MCP HTTP tokens, replies state and rules, `--new` points and checkpoints, its serve unit (by its exact
|
|
24
|
+
name) and the schedules whose environment names it. The sends journal stays, under `kept`. A tool whose files live
|
|
25
|
+
outside its cli-core folders names them with the `ownFolders` hook; each must be absolute and inside the home folder
|
|
26
|
+
(`account-remove.folder-outside`).
|
|
27
|
+
|
|
8
28
|
## 0.612.0 — 08.11.2026
|
|
9
29
|
|
|
10
30
|
### Changed — may break callers
|
|
@@ -35,6 +55,41 @@ shape of this file.
|
|
|
35
55
|
|
|
36
56
|
## 0.611.0 — 08.11.2026
|
|
37
57
|
|
|
58
|
+
### Added
|
|
59
|
+
|
|
60
|
+
- **Deep links into WireCat Desktop.** `linkFor(ref, { form: "web" | "app" })` builds
|
|
61
|
+
`https://wirecat.dev/o#/v1/<kind>/<parts>` or `wirecat://open/v1/<kind>/<parts>`; `parseLink` reads either form or
|
|
62
|
+
the bare `/v1/…` path, and `formatLink` writes the path. Kinds: `msg/<provider>/<account>/<chat>/<message>`,
|
|
63
|
+
`chat/<provider>/<account>/<chat>` (an email thread too), `task/<id>`, `tasks/overdue|today|tomorrow`,
|
|
64
|
+
`tasks/new/<ISO time>`, `proposal/<review id>`, `digest/<date>`, `sync/<tool>[/<account>]`. Each part is
|
|
65
|
+
percent-encoded as one segment; another version, an unknown kind, a part too many or empty, more than 6 segments or a
|
|
66
|
+
path over 512 characters is not a link, and a query is ignored. A ref is a store reference (`msg:`, `chat:`,
|
|
67
|
+
`task:`) or, for the kinds that are no reference, the path with a colon after the kind (`proposal:fact%3A512`,
|
|
68
|
+
`tasks:overdue`, `sync:telegram/1001`). The shared config's `links` section sets `base` and `enabled`;
|
|
69
|
+
`WIRECAT_LINKS=off` turns links off for one run, and `linkFor` then answers `null`. A link only opens a screen.
|
|
70
|
+
`test/fixtures/links-v1.json` holds the cases Desktop and the bounce page check their own parsers against.
|
|
71
|
+
- **A report links its items, its task groups and its sync problems.** The renderer fills each item's `links` from its
|
|
72
|
+
`refs` ("открыть"), and a health entry's from its `sync:` ref ("исправить"): the web form for Telegram and mail, the
|
|
73
|
+
app form in `latest.txt`. Links an agent wrote are still dropped, and with links off the words stay without a link.
|
|
74
|
+
- **`wirecat.report/1` takes `scope`, `tasks` and named accounts in `health`.** `scope` (`from`, `to`, `sources[]` of
|
|
75
|
+
`kind` and `accounts`, `counts` of `chats`, `mail`, `tasks`, `meetings`) becomes the last line of all three
|
|
76
|
+
templates: "Просмотрено за 24 ч: Telegram, MAX, WhatsApp, почта (4 ящика) · 31 чат, 12 писем, 17 задач", zero
|
|
77
|
+
counts left out. `tasks` (`overdue`, `today`, `tomorrow`, `new`, `new_since`) becomes one line of `tasks/<filter>`
|
|
78
|
+
links after the section that holds the task items: "Все просроченные (5) · на сегодня (3) · на завтра (2) · новые
|
|
79
|
+
(4)", zero groups left out. A `health[]` entry takes `account`, `reason` (`sync-failed`, `no-schedule`, `quiet`) and
|
|
80
|
+
`since`: "🛠 Telegram (@owner): синхронизация падает с 6 ноября · исправить". An entry with a reason is shown
|
|
81
|
+
whatever its `stale_hours`; a document without the new fields reads as before.
|
|
82
|
+
- **A `task` item needs only its `topic`.** A task created since the last digest may have no due date; it shows no
|
|
83
|
+
deadline phrase, and its person goes on the first line: "📌 Договор с подрядчиком — Пётр Белов".
|
|
84
|
+
- **Each report run keeps its checked document** as `runs/<time>.report.json` beside the run's `.md`, with refs and
|
|
85
|
+
without `links` or `internal`, for Desktop to render.
|
|
86
|
+
|
|
87
|
+
### Changed — may break callers
|
|
88
|
+
|
|
89
|
+
- `PreparedReport` has `terminal` (plain text with app links, written to `latest.txt`) beside `text` (plain text with
|
|
90
|
+
web links, the email's body) and `document`. A quiet day with a sync problem says "Новых дел нет, но синхронизация
|
|
91
|
+
требует внимания." and lists the health lines below.
|
|
92
|
+
|
|
38
93
|
### Fixed
|
|
39
94
|
|
|
40
95
|
- **In `search all`, a hit only words found keeps its place next to the hits around it.** It takes the cosine of the
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type LinkConfig } from "../../domain/links.js";
|
|
1
2
|
import { type ReportView } from "./view.js";
|
|
2
3
|
export declare const REPORT_CHANNELS: readonly ["telegram", "email", "text"];
|
|
3
4
|
export type ReportChannel = (typeof REPORT_CHANNELS)[number];
|
|
@@ -42,7 +43,12 @@ export interface ReportRun {
|
|
|
42
43
|
}
|
|
43
44
|
export interface PreparedReport {
|
|
44
45
|
telegram: string;
|
|
46
|
+
/** Plain text with web links: the email's plain part. */
|
|
45
47
|
text: string;
|
|
48
|
+
/** Plain text with app links (`wirecat://`), which a desktop terminal opens: `latest.txt`. */
|
|
49
|
+
terminal: string;
|
|
50
|
+
/** The checked `wirecat.report/1` document as JSON, for `<run>.report.json`; absent for an invalid one. */
|
|
51
|
+
document?: string;
|
|
46
52
|
subject: string;
|
|
47
53
|
/** The desktop notice: the title line and the summary. */
|
|
48
54
|
notice: string;
|
|
@@ -53,9 +59,12 @@ export interface PreparedReport {
|
|
|
53
59
|
* A run's answer rendered for every route, or `undefined` when it is not a report. An invalid report becomes one
|
|
54
60
|
* line in the owner's language and is never shown raw.
|
|
55
61
|
*/
|
|
56
|
-
export declare const prepareReport: (answer: string, { language, now, timeZone, templates, }: {
|
|
62
|
+
export declare const prepareReport: (answer: string, { language, now, timeZone, templates, links, env, }: {
|
|
57
63
|
language: string;
|
|
58
64
|
now: number;
|
|
59
65
|
timeZone?: string;
|
|
60
66
|
templates?: Partial<Record<ReportChannel, string>>;
|
|
67
|
+
links?: LinkConfig;
|
|
68
|
+
/** Read for `WIRECAT_LINKS=off`. */
|
|
69
|
+
env?: NodeJS.ProcessEnv;
|
|
61
70
|
}) => Promise<PreparedReport | undefined>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { DEFAULT_LINK_CONFIG, linkFor } from "../../domain/links.js";
|
|
3
4
|
import { safeLiquid } from "../../render/liquid.js";
|
|
4
5
|
import { TELEGRAM_TEXT_CHARS } from "../deliver.js";
|
|
5
|
-
import { parseReport } from "./schema.js";
|
|
6
|
+
import { parseReport, reportDocument } from "./schema.js";
|
|
6
7
|
import { reportView } from "./view.js";
|
|
7
8
|
export const REPORT_CHANNELS = ["telegram", "email", "text"];
|
|
8
9
|
const DEFAULT_LANGUAGE = "en";
|
|
@@ -42,6 +43,7 @@ const ALLOWED = {
|
|
|
42
43
|
const linkUrls = (view) => new Set([
|
|
43
44
|
...view.links,
|
|
44
45
|
...view.sections.flatMap((section) => section.items.flatMap((item) => item.links)),
|
|
46
|
+
...view.sections.flatMap((section) => section.groups.flatMap((group) => (group.link ? [group.link] : []))),
|
|
45
47
|
...view.health.items.flatMap((item) => item.links),
|
|
46
48
|
].map((link) => link.url));
|
|
47
49
|
/**
|
|
@@ -169,7 +171,7 @@ const INVALID_LINES = {
|
|
|
169
171
|
* A run's answer rendered for every route, or `undefined` when it is not a report. An invalid report becomes one
|
|
170
172
|
* line in the owner's language and is never shown raw.
|
|
171
173
|
*/
|
|
172
|
-
export const prepareReport = async (answer, { language, now, timeZone, templates = {}, }) => {
|
|
174
|
+
export const prepareReport = async (answer, { language, now, timeZone, templates = {}, links = DEFAULT_LINK_CONFIG, env = process.env, }) => {
|
|
173
175
|
const parsed = parseReport(answer);
|
|
174
176
|
if (!parsed)
|
|
175
177
|
return undefined;
|
|
@@ -178,6 +180,7 @@ export const prepareReport = async (answer, { language, now, timeZone, templates
|
|
|
178
180
|
return {
|
|
179
181
|
telegram: escapeHtml(line),
|
|
180
182
|
text: line,
|
|
183
|
+
terminal: line,
|
|
181
184
|
subject: line,
|
|
182
185
|
notice: line,
|
|
183
186
|
invalid: true,
|
|
@@ -185,17 +188,27 @@ export const prepareReport = async (answer, { language, now, timeZone, templates
|
|
|
185
188
|
};
|
|
186
189
|
}
|
|
187
190
|
const shipped = existsSync(templateFile(parsed.report.kind, "telegram", language)) ? language : DEFAULT_LANGUAGE;
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
const viewFor = (form) => reportView(parsed.report, {
|
|
192
|
+
language: shipped,
|
|
193
|
+
now,
|
|
194
|
+
...(timeZone ? { timeZone } : {}),
|
|
195
|
+
linkOf: (ref) => linkFor(ref, { form, config: links, env }),
|
|
196
|
+
});
|
|
197
|
+
const web = viewFor("web");
|
|
198
|
+
const telegram = await renderReport(web, "telegram", templateOf(templates, "telegram"));
|
|
199
|
+
const text = await renderReport(web, "text", templateOf(templates, "text"));
|
|
200
|
+
const terminal = await renderReport(viewFor("app"), "text", templateOf(templates, "text"));
|
|
201
|
+
const renderings = [telegram, text, terminal];
|
|
191
202
|
const reasons = [
|
|
192
|
-
...(
|
|
193
|
-
...(
|
|
203
|
+
...(renderings.some((one) => one.templateFailed) ? [REPORT_REASONS.templateFailed] : []),
|
|
204
|
+
...(renderings.some((one) => one.templateTags > 0) ? [REPORT_REASONS.templateTags] : []),
|
|
194
205
|
];
|
|
195
206
|
const title = text.text.split("\n")[0] ?? "";
|
|
196
207
|
return {
|
|
197
208
|
telegram: telegram.text,
|
|
198
209
|
text: text.text,
|
|
210
|
+
terminal: terminal.text,
|
|
211
|
+
document: `${JSON.stringify(reportDocument(parsed.report), null, 2)}\n`,
|
|
199
212
|
subject: title,
|
|
200
213
|
notice: [title, parsed.report.summary].filter(Boolean).join("\n"),
|
|
201
214
|
invalid: false,
|
|
@@ -34,11 +34,41 @@ export interface ReportSection {
|
|
|
34
34
|
items: ReportItem[];
|
|
35
35
|
more: number;
|
|
36
36
|
}
|
|
37
|
+
export declare const HEALTH_REASONS: readonly ["sync-failed", "no-schedule", "quiet"];
|
|
38
|
+
export type HealthReason = (typeof HEALTH_REASONS)[number];
|
|
39
|
+
/** One account's sync problem. A document written before accounts were named has only `source` and `staleHours`. */
|
|
37
40
|
export interface HealthEntry {
|
|
38
41
|
source: string;
|
|
42
|
+
/** The account's name, username or address, never a raw id. */
|
|
43
|
+
account: string | null;
|
|
44
|
+
reason: HealthReason | null;
|
|
45
|
+
since: string | null;
|
|
39
46
|
staleHours: number;
|
|
40
47
|
refs: string[];
|
|
41
48
|
}
|
|
49
|
+
/** What the digest was built from: memo fills it from the agenda, not the agent. */
|
|
50
|
+
export interface ReportScope {
|
|
51
|
+
from: string;
|
|
52
|
+
to: string;
|
|
53
|
+
sources: {
|
|
54
|
+
kind: ChannelKind;
|
|
55
|
+
accounts: number;
|
|
56
|
+
}[];
|
|
57
|
+
counts: {
|
|
58
|
+
chats: number;
|
|
59
|
+
mail: number;
|
|
60
|
+
tasks: number;
|
|
61
|
+
meetings: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** The open task groups, each opened by a `tasks/<filter>` link; `new` counts what was created since `newSince`. */
|
|
65
|
+
export interface TaskCounts {
|
|
66
|
+
overdue: number;
|
|
67
|
+
today: number;
|
|
68
|
+
tomorrow: number;
|
|
69
|
+
new: number;
|
|
70
|
+
newSince: string | null;
|
|
71
|
+
}
|
|
42
72
|
/** A `wirecat.report/1` document as the renderers read it: checked, cut to its limits, with no `links` or `internal`. */
|
|
43
73
|
export interface Report {
|
|
44
74
|
kind: ReportKind;
|
|
@@ -46,12 +76,19 @@ export interface Report {
|
|
|
46
76
|
summary: string | null;
|
|
47
77
|
sections: ReportSection[];
|
|
48
78
|
health: HealthEntry[];
|
|
79
|
+
scope: ReportScope | null;
|
|
80
|
+
tasks: TaskCounts | null;
|
|
49
81
|
}
|
|
50
82
|
/** What a leak pattern removed from agent text: a store reference, backticks, a `--flag` or a snake_case word. */
|
|
51
83
|
export declare const withoutLeaks: (text: string) => {
|
|
52
84
|
text: string;
|
|
53
85
|
leaks: number;
|
|
54
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* The checked document in the `wirecat.report/1` shape it came in, for `<run>.report.json`: what the renderers kept,
|
|
89
|
+
* with refs (Desktop builds its own links from them) and without `links` or `internal`.
|
|
90
|
+
*/
|
|
91
|
+
export declare const reportDocument: (report: Report) => Record<string, unknown>;
|
|
55
92
|
export type ParsedReport = {
|
|
56
93
|
report: Report;
|
|
57
94
|
leaks: number;
|
|
@@ -4,11 +4,21 @@ export const REPORT_KINDS = ["morning-digest"];
|
|
|
4
4
|
export const SECTION_KINDS = ["today", "decisions", "money", "meetings", "projects", "mail"];
|
|
5
5
|
export const ITEM_TYPES = ["reply", "question", "task", "fact", "risk", "money", "decision", "meeting"];
|
|
6
6
|
export const CHANNEL_KINDS = ["telegram", "max", "whatsapp", "mail", "meeting", "task"];
|
|
7
|
-
const
|
|
7
|
+
export const HEALTH_REASONS = ["sync-failed", "no-schedule", "quiet"];
|
|
8
|
+
const TEXT_LIMITS = {
|
|
9
|
+
summary: 120,
|
|
10
|
+
who: 80,
|
|
11
|
+
topic: 60,
|
|
12
|
+
action: 120,
|
|
13
|
+
detail: 160,
|
|
14
|
+
quote: 100,
|
|
15
|
+
source: 40,
|
|
16
|
+
account: 60,
|
|
17
|
+
};
|
|
8
18
|
const REQUIRED = {
|
|
9
19
|
reply: ["who", "topic", "action", "since"],
|
|
10
20
|
question: ["who", "topic", "action"],
|
|
11
|
-
task: ["topic"
|
|
21
|
+
task: ["topic"],
|
|
12
22
|
fact: ["topic", "detail"],
|
|
13
23
|
risk: ["topic", "detail", "action"],
|
|
14
24
|
money: ["who", "topic", "amount"],
|
|
@@ -76,6 +86,54 @@ const amountOf = (value, at) => {
|
|
|
76
86
|
direction: oneOf(["in", "out"], value.direction, `${at}.direction`),
|
|
77
87
|
};
|
|
78
88
|
};
|
|
89
|
+
const wholeOr0 = (value, at) => (value === undefined || value === null ? 0 : whole(value, at));
|
|
90
|
+
const scopeOf = (value) => {
|
|
91
|
+
if (value === undefined || value === null)
|
|
92
|
+
return null;
|
|
93
|
+
if (!isObject(value))
|
|
94
|
+
throw new Invalid("scope");
|
|
95
|
+
const from = momentOf(value.from, "scope.from");
|
|
96
|
+
const to = momentOf(value.to, "scope.to");
|
|
97
|
+
if (from === null || to === null || Date.parse(to) < Date.parse(from))
|
|
98
|
+
throw new Invalid("scope.to");
|
|
99
|
+
const sources = value.sources === undefined || value.sources === null ? [] : value.sources;
|
|
100
|
+
if (!Array.isArray(sources))
|
|
101
|
+
throw new Invalid("scope.sources");
|
|
102
|
+
const counts = value.counts === undefined || value.counts === null ? {} : value.counts;
|
|
103
|
+
if (!isObject(counts))
|
|
104
|
+
throw new Invalid("scope.counts");
|
|
105
|
+
return {
|
|
106
|
+
from,
|
|
107
|
+
to,
|
|
108
|
+
sources: sources.map((source, s) => {
|
|
109
|
+
if (!isObject(source))
|
|
110
|
+
throw new Invalid(`scope.sources[${s}]`);
|
|
111
|
+
return {
|
|
112
|
+
kind: oneOf(CHANNEL_KINDS, source.kind, `scope.sources[${s}].kind`),
|
|
113
|
+
accounts: source.accounts === undefined ? 1 : whole(source.accounts, `scope.sources[${s}].accounts`),
|
|
114
|
+
};
|
|
115
|
+
}),
|
|
116
|
+
counts: {
|
|
117
|
+
chats: wholeOr0(counts.chats, "scope.counts.chats"),
|
|
118
|
+
mail: wholeOr0(counts.mail, "scope.counts.mail"),
|
|
119
|
+
tasks: wholeOr0(counts.tasks, "scope.counts.tasks"),
|
|
120
|
+
meetings: wholeOr0(counts.meetings, "scope.counts.meetings"),
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const tasksOf = (value) => {
|
|
125
|
+
if (value === undefined || value === null)
|
|
126
|
+
return null;
|
|
127
|
+
if (!isObject(value))
|
|
128
|
+
throw new Invalid("tasks");
|
|
129
|
+
return {
|
|
130
|
+
overdue: wholeOr0(value.overdue, "tasks.overdue"),
|
|
131
|
+
today: wholeOr0(value.today, "tasks.today"),
|
|
132
|
+
tomorrow: wholeOr0(value.tomorrow, "tasks.tomorrow"),
|
|
133
|
+
new: wholeOr0(value.new, "tasks.new"),
|
|
134
|
+
newSince: momentOf(value.new_since, "tasks.new_since"),
|
|
135
|
+
};
|
|
136
|
+
};
|
|
79
137
|
const cut = (text, limit) => (text.length <= limit ? text : `${text.slice(0, limit - 1).trimEnd()}…`);
|
|
80
138
|
/**
|
|
81
139
|
* Checks a parsed document and keeps what the renderers may show. Any agent string loses what `withoutLeaks` finds
|
|
@@ -151,17 +209,53 @@ const checked = (document) => {
|
|
|
151
209
|
sections,
|
|
152
210
|
health: health.map((entry, h) => {
|
|
153
211
|
const at = `health[${h}]`;
|
|
154
|
-
if (!isObject(entry)
|
|
212
|
+
if (!isObject(entry))
|
|
155
213
|
throw new Invalid(at);
|
|
214
|
+
const reason = entry.reason === undefined || entry.reason === null
|
|
215
|
+
? null
|
|
216
|
+
: oneOf(HEALTH_REASONS, entry.reason, `${at}.reason`);
|
|
217
|
+
// A named reason is the problem itself; the hours are only how stale an account without one is.
|
|
218
|
+
const hours = entry.stale_hours ?? (reason === null ? undefined : 0);
|
|
219
|
+
if (typeof hours !== "number" || !(hours >= 0))
|
|
220
|
+
throw new Invalid(`${at}.stale_hours`);
|
|
156
221
|
const source = text(entry.source, "source", `${at}.source`);
|
|
157
222
|
if (source === null)
|
|
158
223
|
throw new Invalid(`${at}.source`);
|
|
159
|
-
return {
|
|
224
|
+
return {
|
|
225
|
+
source,
|
|
226
|
+
account: text(entry.account, "account", `${at}.account`),
|
|
227
|
+
reason,
|
|
228
|
+
since: momentOf(entry.since, `${at}.since`),
|
|
229
|
+
staleHours: hours,
|
|
230
|
+
refs: refsOf(entry.refs, `${at}.refs`),
|
|
231
|
+
};
|
|
160
232
|
}),
|
|
233
|
+
scope: scopeOf(document.scope),
|
|
234
|
+
tasks: tasksOf(document.tasks),
|
|
161
235
|
},
|
|
162
236
|
leaks,
|
|
163
237
|
};
|
|
164
238
|
};
|
|
239
|
+
/**
|
|
240
|
+
* The checked document in the `wirecat.report/1` shape it came in, for `<run>.report.json`: what the renderers kept,
|
|
241
|
+
* with refs (Desktop builds its own links from them) and without `links` or `internal`.
|
|
242
|
+
*/
|
|
243
|
+
export const reportDocument = (report) => ({
|
|
244
|
+
format: REPORT_FORMAT,
|
|
245
|
+
kind: report.kind,
|
|
246
|
+
date: report.date,
|
|
247
|
+
summary: report.summary,
|
|
248
|
+
sections: report.sections,
|
|
249
|
+
health: report.health.map(({ staleHours, ...entry }) => ({ ...entry, stale_hours: staleHours })),
|
|
250
|
+
scope: report.scope,
|
|
251
|
+
tasks: report.tasks && {
|
|
252
|
+
overdue: report.tasks.overdue,
|
|
253
|
+
today: report.tasks.today,
|
|
254
|
+
tomorrow: report.tasks.tomorrow,
|
|
255
|
+
new: report.tasks.new,
|
|
256
|
+
new_since: report.tasks.newSince,
|
|
257
|
+
},
|
|
258
|
+
});
|
|
165
259
|
/**
|
|
166
260
|
* A run's answer as a report: one JSON object, bare or as the only fenced `json` block. Text that is neither is not a
|
|
167
261
|
* report (`undefined`) and keeps the Markdown path; a JSON answer that fails the check is `invalid`, with the path
|
|
@@ -12,7 +12,7 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
|
|
|
12
12
|
{%- if summary %}{{ nl }}<p style="margin:0 0 12px">{{ summary }}</p>{% endif -%}
|
|
13
13
|
{%- if quiet -%}
|
|
14
14
|
{{ nl }}<p style="margin:0 0 12px">
|
|
15
|
-
{%- if health.items.size > 0 %}Nothing new, but
|
|
15
|
+
{%- if health.items.size > 0 %}Nothing new, but sync needs attention.
|
|
16
16
|
{%- else %}A quiet morning: nothing urgent.{% endif %}</p>
|
|
17
17
|
{%- endif -%}
|
|
18
18
|
{%- for section in sections -%}
|
|
@@ -37,7 +37,7 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
|
|
|
37
37
|
{%- case item.type -%}
|
|
38
38
|
{%- when "reply" %}<b>{{ item.who }} · {{ item.topic }}</b> — {{ item.action }}
|
|
39
39
|
{%- when "question" %}<b>{{ item.who }}</b> asks: {{ item.action }}
|
|
40
|
-
{%- when "task" %}<b>{{ item.topic }}</b> — {{ due }}
|
|
40
|
+
{%- when "task" %}<b>{{ item.topic }}</b>{% if due != "" %} — {{ due }}{% elsif item.who %} — {{ item.who }}{% endif %}
|
|
41
41
|
{%- when "fact" %}<b>{{ item.topic }}</b>: {{ item.detail }}
|
|
42
42
|
{%- when "risk" %}<b>{{ item.topic }}</b>: {{ item.detail }} → {{ item.action }}
|
|
43
43
|
{%- when "money" %}<b>{{ item.amount.text }} · {{ item.who }} · {{ item.topic }}</b>{% if item.action %} — {{ item.action }}{% endif %}
|
|
@@ -55,7 +55,8 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
|
|
|
55
55
|
{%- if due != "" and "risk,money,decision" contains item.type %}{{ sep }}{{ due }}{% assign sep = " · " %}{% endif -%}
|
|
56
56
|
{%- if item.action and "task,meeting" contains item.type %}{{ sep }}{{ item.action }}{% assign sep = " · " %}{% endif -%}
|
|
57
57
|
{%- if item.detail and "task,money,meeting,decision" contains item.type %}{{ sep }}{{ item.detail }}{% assign sep = " · " %}{% endif -%}
|
|
58
|
-
{%- if item.who and "
|
|
58
|
+
{%- if item.who and "fact,risk,decision" contains item.type %}{{ sep }}{{ item.who }}{% assign sep = " · " %}{% endif -%}
|
|
59
|
+
{%- if item.who and item.type == "task" and due != "" %}{{ sep }}{{ item.who }}{% assign sep = " · " %}{% endif -%}
|
|
59
60
|
{%- if item.channel %}{{ sep }}
|
|
60
61
|
{%- case item.channel -%}
|
|
61
62
|
{%- when "telegram" %}Telegram{% when "max" %}MAX{% when "whatsapp" %}WhatsApp
|
|
@@ -69,11 +70,51 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
|
|
|
69
70
|
{%- if second != "" %}<br><span style="{{ muted }}">{{ second }}</span>{% endif %}</p>
|
|
70
71
|
{%- endfor -%}
|
|
71
72
|
{%- if section.more > 0 %}{{ nl }}<p style="margin:0 0 12px;{{ muted }}">{{ section.more }} more</p>{% endif -%}
|
|
73
|
+
{%- if section.groups.size > 0 %}{{ nl }}<p style="margin:0 0 12px;{{ muted }}">
|
|
74
|
+
{%- for group in section.groups -%}
|
|
75
|
+
{%- unless forloop.first %} · {% endunless -%}
|
|
76
|
+
{%- capture words -%}
|
|
77
|
+
{%- case group.filter -%}
|
|
78
|
+
{%- when "overdue" %}All overdue
|
|
79
|
+
{%- when "today" %}{% if forloop.first %}Due today{% else %}due today{% endif %}
|
|
80
|
+
{%- when "tomorrow" %}{% if forloop.first %}Due tomorrow{% else %}due tomorrow{% endif %}
|
|
81
|
+
{%- when "new" %}{% if forloop.first %}New{% else %}new{% endif %}
|
|
82
|
+
{%- endcase %} ({{ group.count }})
|
|
83
|
+
{%- endcapture -%}
|
|
84
|
+
{%- if group.link %}<a href="{{ group.link.url }}" style="color:#3b82c4">{{ words }}</a>{% else %}{{ words }}{% endif -%}
|
|
85
|
+
{%- endfor -%}
|
|
86
|
+
</p>{%- endif -%}
|
|
72
87
|
{%- endfor -%}
|
|
73
|
-
{%-
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
{%- for source in health.items -%}
|
|
89
|
+
{{ nl }}<p style="margin:20px 0 0;{{ muted }}">{{ health.emoji }} {{ source.source }}
|
|
90
|
+
{%- if source.account %} ({{ source.account }}){% endif -%}
|
|
91
|
+
{%- case source.reason -%}
|
|
92
|
+
{%- when "sync-failed" %}: sync failing{% if source.since %} since {{ source.since.date }}{% endif %}
|
|
93
|
+
{%- when "no-schedule" %}: no sync schedule
|
|
94
|
+
{%- when "quiet" %}: nothing new {% if source.since %}since {{ source.since.date }}{% else %}for {{ source.span }}{% endif %}
|
|
95
|
+
{%- else %} has not synced for {{ source.span }}
|
|
96
|
+
{%- endcase -%}
|
|
97
|
+
{%- for link in source.links %} · <a href="{{ link.url }}" style="color:#3b82c4">{{ link.label }}</a>{% endfor -%}</p>
|
|
98
|
+
{%- endfor -%}
|
|
99
|
+
{%- if scope -%}
|
|
100
|
+
{{ nl }}<p style="margin:20px 0 0;{{ muted }}">Viewed over {{ scope.window }}
|
|
101
|
+
{%- for source in scope.sources -%}
|
|
102
|
+
{%- if forloop.first %}: {% else %}, {% endif -%}
|
|
103
|
+
{%- case source.kind -%}
|
|
104
|
+
{%- when "telegram" %}Telegram{% when "max" %}MAX{% when "whatsapp" %}WhatsApp
|
|
105
|
+
{%- when "mail" %}mail{% when "meeting" %}meetings{% when "task" %}tasks
|
|
106
|
+
{%- endcase -%}
|
|
107
|
+
{%- if source.accounts > 1 %} ({{ source.accounts }} {% if source.kind == "mail" %}{% if source.plural == "one" %}mailbox{% else %}mailboxes{% endif %}{% else %}{% if source.plural == "one" %}account{% else %}accounts{% endif %}{% endif %}){% endif -%}
|
|
77
108
|
{%- endfor -%}
|
|
78
|
-
{%-
|
|
109
|
+
{%- for count in scope.counts -%}
|
|
110
|
+
{%- if forloop.first %} · {% else %}, {% endif -%}
|
|
111
|
+
{{ count.count }} {% case count.kind -%}
|
|
112
|
+
{%- when "chats" %}{% if count.plural == "one" %}chat{% else %}chats{% endif %}
|
|
113
|
+
{%- when "mail" %}{% if count.plural == "one" %}email{% else %}emails{% endif %}
|
|
114
|
+
{%- when "tasks" %}{% if count.plural == "one" %}task{% else %}tasks{% endif %}
|
|
115
|
+
{%- when "meetings" %}{% if count.plural == "one" %}meeting{% else %}meetings{% endif %}
|
|
116
|
+
{%- endcase -%}
|
|
117
|
+
{%- endfor -%}
|
|
118
|
+
</p>
|
|
119
|
+
{%- endif -%}
|
|
79
120
|
{{ nl }}</div>
|
|
@@ -12,7 +12,7 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
|
|
|
12
12
|
{%- if summary %}{{ nl }}<p style="margin:0 0 12px">{{ summary }}</p>{% endif -%}
|
|
13
13
|
{%- if quiet -%}
|
|
14
14
|
{{ nl }}<p style="margin:0 0 12px">
|
|
15
|
-
{%- if health.items.size > 0 %}Новых дел нет, но
|
|
15
|
+
{%- if health.items.size > 0 %}Новых дел нет, но синхронизация требует внимания.
|
|
16
16
|
{%- else %}Тихое утро: ничего срочного.{% endif %}</p>
|
|
17
17
|
{%- endif -%}
|
|
18
18
|
{%- for section in sections -%}
|
|
@@ -37,7 +37,7 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
|
|
|
37
37
|
{%- case item.type -%}
|
|
38
38
|
{%- when "reply" %}<b>{{ item.who }} · {{ item.topic }}</b> — {{ item.action }}
|
|
39
39
|
{%- when "question" %}<b>{{ item.who }}</b> спрашивает: {{ item.action }}
|
|
40
|
-
{%- when "task" %}<b>{{ item.topic }}</b> — {{ due }}
|
|
40
|
+
{%- when "task" %}<b>{{ item.topic }}</b>{% if due != "" %} — {{ due }}{% elsif item.who %} — {{ item.who }}{% endif %}
|
|
41
41
|
{%- when "fact" %}<b>{{ item.topic }}</b>: {{ item.detail }}
|
|
42
42
|
{%- when "risk" %}<b>{{ item.topic }}</b>: {{ item.detail }} → {{ item.action }}
|
|
43
43
|
{%- when "money" %}<b>{{ item.amount.text }} · {{ item.who }} · {{ item.topic }}</b>{% if item.action %} — {{ item.action }}{% endif %}
|
|
@@ -55,7 +55,8 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
|
|
|
55
55
|
{%- if due != "" and "risk,money,decision" contains item.type %}{{ sep }}{{ due }}{% assign sep = " · " %}{% endif -%}
|
|
56
56
|
{%- if item.action and "task,meeting" contains item.type %}{{ sep }}{{ item.action }}{% assign sep = " · " %}{% endif -%}
|
|
57
57
|
{%- if item.detail and "task,money,meeting,decision" contains item.type %}{{ sep }}{{ item.detail }}{% assign sep = " · " %}{% endif -%}
|
|
58
|
-
{%- if item.who and "
|
|
58
|
+
{%- if item.who and "fact,risk,decision" contains item.type %}{{ sep }}{{ item.who }}{% assign sep = " · " %}{% endif -%}
|
|
59
|
+
{%- if item.who and item.type == "task" and due != "" %}{{ sep }}{{ item.who }}{% assign sep = " · " %}{% endif -%}
|
|
59
60
|
{%- if item.channel %}{{ sep }}
|
|
60
61
|
{%- case item.channel -%}
|
|
61
62
|
{%- when "telegram" %}Telegram{% when "max" %}MAX{% when "whatsapp" %}WhatsApp
|
|
@@ -69,11 +70,51 @@ of the view model. No colour on the body: the grey (#8a8a8a) and the link blue (
|
|
|
69
70
|
{%- if second != "" %}<br><span style="{{ muted }}">{{ second }}</span>{% endif %}</p>
|
|
70
71
|
{%- endfor -%}
|
|
71
72
|
{%- if section.more > 0 %}{{ nl }}<p style="margin:0 0 12px;{{ muted }}">ещё {{ section.more }}</p>{% endif -%}
|
|
73
|
+
{%- if section.groups.size > 0 %}{{ nl }}<p style="margin:0 0 12px;{{ muted }}">
|
|
74
|
+
{%- for group in section.groups -%}
|
|
75
|
+
{%- unless forloop.first %} · {% endunless -%}
|
|
76
|
+
{%- capture words -%}
|
|
77
|
+
{%- case group.filter -%}
|
|
78
|
+
{%- when "overdue" %}Все просроченные
|
|
79
|
+
{%- when "today" %}{% if forloop.first %}На сегодня{% else %}на сегодня{% endif %}
|
|
80
|
+
{%- when "tomorrow" %}{% if forloop.first %}На завтра{% else %}на завтра{% endif %}
|
|
81
|
+
{%- when "new" %}{% if forloop.first %}Новые{% else %}новые{% endif %}
|
|
82
|
+
{%- endcase %} ({{ group.count }})
|
|
83
|
+
{%- endcapture -%}
|
|
84
|
+
{%- if group.link %}<a href="{{ group.link.url }}" style="color:#3b82c4">{{ words }}</a>{% else %}{{ words }}{% endif -%}
|
|
85
|
+
{%- endfor -%}
|
|
86
|
+
</p>{%- endif -%}
|
|
72
87
|
{%- endfor -%}
|
|
73
|
-
{%-
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
{%- for source in health.items -%}
|
|
89
|
+
{{ nl }}<p style="margin:20px 0 0;{{ muted }}">{{ health.emoji }} {{ source.source }}
|
|
90
|
+
{%- if source.account %} ({{ source.account }}){% endif -%}
|
|
91
|
+
{%- case source.reason -%}
|
|
92
|
+
{%- when "sync-failed" %}: синхронизация падает{% if source.since %} с {{ source.since.date }}{% endif %}
|
|
93
|
+
{%- when "no-schedule" %}: нет расписания синхронизации
|
|
94
|
+
{%- when "quiet" %}: ничего нового {% if source.since %}с {{ source.since.date }}{% else %}{{ source.span }}{% endif %}
|
|
95
|
+
{%- else %} не обновлялся {{ source.span }}
|
|
96
|
+
{%- endcase -%}
|
|
97
|
+
{%- for link in source.links %} · <a href="{{ link.url }}" style="color:#3b82c4">{{ link.label }}</a>{% endfor -%}</p>
|
|
98
|
+
{%- endfor -%}
|
|
99
|
+
{%- if scope -%}
|
|
100
|
+
{{ nl }}<p style="margin:20px 0 0;{{ muted }}">Просмотрено за {{ scope.window }}
|
|
101
|
+
{%- for source in scope.sources -%}
|
|
102
|
+
{%- if forloop.first %}: {% else %}, {% endif -%}
|
|
103
|
+
{%- case source.kind -%}
|
|
104
|
+
{%- when "telegram" %}Telegram{% when "max" %}MAX{% when "whatsapp" %}WhatsApp
|
|
105
|
+
{%- when "mail" %}почта{% when "meeting" %}встречи{% when "task" %}задачи
|
|
106
|
+
{%- endcase -%}
|
|
107
|
+
{%- if source.accounts > 1 %} ({{ source.accounts }} {% if source.kind == "mail" %}{% case source.plural %}{% when "one" %}ящик{% when "few" %}ящика{% else %}ящиков{% endcase %}{% else %}{% case source.plural %}{% when "one" %}аккаунт{% when "few" %}аккаунта{% else %}аккаунтов{% endcase %}{% endif %}){% endif -%}
|
|
77
108
|
{%- endfor -%}
|
|
78
|
-
{%-
|
|
109
|
+
{%- for count in scope.counts -%}
|
|
110
|
+
{%- if forloop.first %} · {% else %}, {% endif -%}
|
|
111
|
+
{{ count.count }} {% case count.kind -%}
|
|
112
|
+
{%- when "chats" %}{% case count.plural %}{% when "one" %}чат{% when "few" %}чата{% else %}чатов{% endcase %}
|
|
113
|
+
{%- when "mail" %}{% case count.plural %}{% when "one" %}письмо{% when "few" %}письма{% else %}писем{% endcase %}
|
|
114
|
+
{%- when "tasks" %}{% case count.plural %}{% when "one" %}задача{% when "few" %}задачи{% else %}задач{% endcase %}
|
|
115
|
+
{%- when "meetings" %}{% case count.plural %}{% when "one" %}встреча{% when "few" %}встречи{% else %}встреч{% endcase %}
|
|
116
|
+
{%- endcase -%}
|
|
117
|
+
{%- endfor -%}
|
|
118
|
+
</p>
|
|
119
|
+
{%- endif -%}
|
|
79
120
|
{{ nl }}</div>
|
|
@@ -10,7 +10,7 @@ Every string from the report is already escaped. Lines are written with {{ nl }}
|
|
|
10
10
|
{%- if summary %}{{ nl }}{{ summary }}{% endif -%}
|
|
11
11
|
{%- if quiet -%}
|
|
12
12
|
{{ nl }}{{ nl }}
|
|
13
|
-
{%- if health.items.size > 0 %}Nothing new, but
|
|
13
|
+
{%- if health.items.size > 0 %}Nothing new, but sync needs attention.
|
|
14
14
|
{%- else %}A quiet morning: nothing urgent.{% endif -%}
|
|
15
15
|
{%- endif -%}
|
|
16
16
|
{%- for section in sections -%}
|
|
@@ -35,7 +35,7 @@ Every string from the report is already escaped. Lines are written with {{ nl }}
|
|
|
35
35
|
{%- case item.type -%}
|
|
36
36
|
{%- when "reply" %}<b>{{ item.who }} · {{ item.topic }}</b> — {{ item.action }}
|
|
37
37
|
{%- when "question" %}<b>{{ item.who }}</b> asks: {{ item.action }}
|
|
38
|
-
{%- when "task" %}<b>{{ item.topic }}</b> — {{ due }}
|
|
38
|
+
{%- when "task" %}<b>{{ item.topic }}</b>{% if due != "" %} — {{ due }}{% elsif item.who %} — {{ item.who }}{% endif %}
|
|
39
39
|
{%- when "fact" %}<b>{{ item.topic }}</b>: {{ item.detail }}
|
|
40
40
|
{%- when "risk" %}<b>{{ item.topic }}</b>: {{ item.detail }} → {{ item.action }}
|
|
41
41
|
{%- when "money" %}<b>{{ item.amount.text }} · {{ item.who }} · {{ item.topic }}</b>{% if item.action %} — {{ item.action }}{% endif %}
|
|
@@ -53,7 +53,8 @@ Every string from the report is already escaped. Lines are written with {{ nl }}
|
|
|
53
53
|
{%- if due != "" and "risk,money,decision" contains item.type %}{{ sep }}{{ due }}{% assign sep = " · " %}{% endif -%}
|
|
54
54
|
{%- if item.action and "task,meeting" contains item.type %}{{ sep }}{{ item.action }}{% assign sep = " · " %}{% endif -%}
|
|
55
55
|
{%- if item.detail and "task,money,meeting,decision" contains item.type %}{{ sep }}{{ item.detail }}{% assign sep = " · " %}{% endif -%}
|
|
56
|
-
{%- if item.who and "
|
|
56
|
+
{%- if item.who and "fact,risk,decision" contains item.type %}{{ sep }}{{ item.who }}{% assign sep = " · " %}{% endif -%}
|
|
57
|
+
{%- if item.who and item.type == "task" and due != "" %}{{ sep }}{{ item.who }}{% assign sep = " · " %}{% endif -%}
|
|
57
58
|
{%- if item.channel %}{{ sep }}
|
|
58
59
|
{%- case item.channel -%}
|
|
59
60
|
{%- when "telegram" %}Telegram{% when "max" %}MAX{% when "whatsapp" %}WhatsApp
|
|
@@ -67,11 +68,50 @@ Every string from the report is already escaped. Lines are written with {{ nl }}
|
|
|
67
68
|
{%- if second != "" %}{{ nl }}{{ second }}{% endif -%}
|
|
68
69
|
{%- endfor -%}
|
|
69
70
|
{%- if section.more > 0 %}{{ nl }}{{ section.more }} more{% endif -%}
|
|
71
|
+
{%- if section.groups.size > 0 %}{{ nl }}
|
|
72
|
+
{%- for group in section.groups -%}
|
|
73
|
+
{%- unless forloop.first %} · {% endunless -%}
|
|
74
|
+
{%- capture words -%}
|
|
75
|
+
{%- case group.filter -%}
|
|
76
|
+
{%- when "overdue" %}All overdue
|
|
77
|
+
{%- when "today" %}{% if forloop.first %}Due today{% else %}due today{% endif %}
|
|
78
|
+
{%- when "tomorrow" %}{% if forloop.first %}Due tomorrow{% else %}due tomorrow{% endif %}
|
|
79
|
+
{%- when "new" %}{% if forloop.first %}New{% else %}new{% endif %}
|
|
80
|
+
{%- endcase %} ({{ group.count }})
|
|
81
|
+
{%- endcapture -%}
|
|
82
|
+
{%- if group.link %}<a href="{{ group.link.url }}">{{ words }}</a>{% else %}{{ words }}{% endif -%}
|
|
83
|
+
{%- endfor -%}
|
|
84
|
+
{%- endif -%}
|
|
70
85
|
{%- endfor -%}
|
|
71
|
-
{%-
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
|
|
75
|
-
|
|
86
|
+
{%- if health.items.size > 0 %}{{ nl }}{% endif -%}
|
|
87
|
+
{%- for source in health.items -%}
|
|
88
|
+
{{ nl }}{{ health.emoji }} {{ source.source }}
|
|
89
|
+
{%- if source.account %} ({{ source.account }}){% endif -%}
|
|
90
|
+
{%- case source.reason -%}
|
|
91
|
+
{%- when "sync-failed" %}: sync failing{% if source.since %} since {{ source.since.date }}{% endif %}
|
|
92
|
+
{%- when "no-schedule" %}: no sync schedule
|
|
93
|
+
{%- when "quiet" %}: nothing new {% if source.since %}since {{ source.since.date }}{% else %}for {{ source.span }}{% endif %}
|
|
94
|
+
{%- else %} has not synced for {{ source.span }}
|
|
95
|
+
{%- endcase -%}
|
|
96
|
+
{%- for link in source.links %} · <a href="{{ link.url }}">{{ link.label }}</a>{% endfor -%}
|
|
97
|
+
{%- endfor -%}
|
|
98
|
+
{%- if scope -%}
|
|
99
|
+
{{ nl }}{{ nl }}Viewed over {{ scope.window }}
|
|
100
|
+
{%- for source in scope.sources -%}
|
|
101
|
+
{%- if forloop.first %}: {% else %}, {% endif -%}
|
|
102
|
+
{%- case source.kind -%}
|
|
103
|
+
{%- when "telegram" %}Telegram{% when "max" %}MAX{% when "whatsapp" %}WhatsApp
|
|
104
|
+
{%- when "mail" %}mail{% when "meeting" %}meetings{% when "task" %}tasks
|
|
105
|
+
{%- endcase -%}
|
|
106
|
+
{%- if source.accounts > 1 %} ({{ source.accounts }} {% if source.kind == "mail" %}{% if source.plural == "one" %}mailbox{% else %}mailboxes{% endif %}{% else %}{% if source.plural == "one" %}account{% else %}accounts{% endif %}{% endif %}){% endif -%}
|
|
76
107
|
{%- endfor -%}
|
|
77
|
-
{%-
|
|
108
|
+
{%- for count in scope.counts -%}
|
|
109
|
+
{%- if forloop.first %} · {% else %}, {% endif -%}
|
|
110
|
+
{{ count.count }} {% case count.kind -%}
|
|
111
|
+
{%- when "chats" %}{% if count.plural == "one" %}chat{% else %}chats{% endif %}
|
|
112
|
+
{%- when "mail" %}{% if count.plural == "one" %}email{% else %}emails{% endif %}
|
|
113
|
+
{%- when "tasks" %}{% if count.plural == "one" %}task{% else %}tasks{% endif %}
|
|
114
|
+
{%- when "meetings" %}{% if count.plural == "one" %}meeting{% else %}meetings{% endif %}
|
|
115
|
+
{%- endcase -%}
|
|
116
|
+
{%- endfor -%}
|
|
117
|
+
{%- endif -%}
|