@newses/plugin-digest-summary 0.1.0 → 0.2.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/README.md +35 -22
- package/dist/digest.d.ts +66 -16
- package/dist/digest.js +115 -48
- package/dist/index.d.ts +20 -3
- package/dist/index.js +27 -9
- package/dist/prompts.d.ts +95 -53
- package/dist/prompts.js +193 -67
- package/dist/settings.d.ts +62 -2
- package/dist/settings.js +38 -3
- package/package.json +3 -3
- package/dist/summaries.d.ts +0 -50
- package/dist/summaries.js +0 -147
package/dist/settings.d.ts
CHANGED
|
@@ -5,7 +5,42 @@ export declare const MODELS: readonly ["claude-opus-5-5", "claude-sonnet-5-5", "
|
|
|
5
5
|
export declare const EFFORTS: readonly ["low", "medium", "high"];
|
|
6
6
|
/** Which of a user's feeds the overview reads. */
|
|
7
7
|
export declare const FEED_CHOICES: readonly ["all", "only", "except"];
|
|
8
|
-
/**
|
|
8
|
+
/** How long the overview is. */
|
|
9
|
+
export declare const LENGTHS: readonly ["brief", "standard", "detailed"];
|
|
10
|
+
/** How each section's points are shown: as paragraphs, or as a bulleted list. */
|
|
11
|
+
export declare const STYLES: readonly ["paragraphs", "bullets"];
|
|
12
|
+
/** Characters of a user's own instructions, at most. */
|
|
13
|
+
export declare const INSTRUCTIONS_LENGTH = 1000;
|
|
14
|
+
/** The sections a user starts with: a name, and what goes in it. */
|
|
15
|
+
export declare const DEFAULT_SECTIONS: readonly [{
|
|
16
|
+
readonly name: "World";
|
|
17
|
+
readonly about: "International news, conflicts, and diplomacy";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "Politics";
|
|
20
|
+
readonly about: "Governments, elections, laws, and policy";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "Business";
|
|
23
|
+
readonly about: "Companies, markets, the economy, and work";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "Technology";
|
|
26
|
+
readonly about: "Computing, the internet, AI, gadgets, and the tech industry";
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "Science";
|
|
29
|
+
readonly about: "Research, space, the environment, and climate";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "Health";
|
|
32
|
+
readonly about: "Medicine, public health, and wellbeing";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "Sports";
|
|
35
|
+
readonly about: "Games, results, athletes, and leagues";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "Culture";
|
|
38
|
+
readonly about: "Arts, entertainment, books, games, and media";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "Other";
|
|
41
|
+
readonly about: "Notable stories that fit no other section";
|
|
42
|
+
}];
|
|
43
|
+
/** What an admin sets for the server: the API key, the model, the budgets, and what users may add. */
|
|
9
44
|
export declare const instanceSettings: z.ZodObject<{
|
|
10
45
|
apiKey: z.ZodString;
|
|
11
46
|
model: z.ZodDefault<z.ZodEnum<{
|
|
@@ -20,8 +55,17 @@ export declare const instanceSettings: z.ZodObject<{
|
|
|
20
55
|
}>>;
|
|
21
56
|
monthlyTokens: z.ZodDefault<z.ZodNumber>;
|
|
22
57
|
userMonthlyTokens: z.ZodDefault<z.ZodNumber>;
|
|
58
|
+
allowInstructions: z.ZodDefault<z.ZodBoolean>;
|
|
23
59
|
}, z.core.$strip>;
|
|
24
|
-
/**
|
|
60
|
+
/** A section of the overview, by name, with what goes in it. */
|
|
61
|
+
export declare const section: z.ZodObject<{
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
about: z.ZodDefault<z.ZodString>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
/**
|
|
66
|
+
* What each user chooses: all their feeds, only some, or all but some; the sections, the length
|
|
67
|
+
* and style, whether a lead opens it, and instructions of their own.
|
|
68
|
+
*/
|
|
25
69
|
export declare const userSettings: z.ZodObject<{
|
|
26
70
|
feedChoice: z.ZodDefault<z.ZodEnum<{
|
|
27
71
|
all: "all";
|
|
@@ -29,6 +73,22 @@ export declare const userSettings: z.ZodObject<{
|
|
|
29
73
|
except: "except";
|
|
30
74
|
}>>;
|
|
31
75
|
feeds: z.ZodDefault<z.ZodArray<z.ZodInt>>;
|
|
76
|
+
sections: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
about: z.ZodDefault<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>>>;
|
|
80
|
+
length: z.ZodDefault<z.ZodEnum<{
|
|
81
|
+
brief: "brief";
|
|
82
|
+
standard: "standard";
|
|
83
|
+
detailed: "detailed";
|
|
84
|
+
}>>;
|
|
85
|
+
style: z.ZodDefault<z.ZodEnum<{
|
|
86
|
+
paragraphs: "paragraphs";
|
|
87
|
+
bullets: "bullets";
|
|
88
|
+
}>>;
|
|
89
|
+
lead: z.ZodDefault<z.ZodBoolean>;
|
|
90
|
+
instructions: z.ZodDefault<z.ZodString>;
|
|
32
91
|
}, z.core.$strip>;
|
|
33
92
|
export type InstanceSettings = z.output<typeof instanceSettings>;
|
|
34
93
|
export type UserSettings = z.output<typeof userSettings>;
|
|
94
|
+
export type Section = z.output<typeof section>;
|
package/dist/settings.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feeds, secret } from '@newses/plugin-api';
|
|
1
|
+
import { DIGEST_LIMITS, feeds, multiline, secret } from '@newses/plugin-api';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
/** The models an admin can choose: the current Opus, Sonnet, and Haiku. */
|
|
4
4
|
export const MODELS = ['claude-opus-5-5', 'claude-sonnet-5-5', 'claude-haiku-5-5'];
|
|
@@ -6,17 +6,52 @@ export const MODELS = ['claude-opus-5-5', 'claude-sonnet-5-5', 'claude-haiku-5-5
|
|
|
6
6
|
export const EFFORTS = ['low', 'medium', 'high'];
|
|
7
7
|
/** Which of a user's feeds the overview reads. */
|
|
8
8
|
export const FEED_CHOICES = ['all', 'only', 'except'];
|
|
9
|
+
/** How long the overview is. */
|
|
10
|
+
export const LENGTHS = ['brief', 'standard', 'detailed'];
|
|
11
|
+
/** How each section's points are shown: as paragraphs, or as a bulleted list. */
|
|
12
|
+
export const STYLES = ['paragraphs', 'bullets'];
|
|
13
|
+
/** Characters of a user's own instructions, at most. */
|
|
14
|
+
export const INSTRUCTIONS_LENGTH = 1000;
|
|
15
|
+
/** The sections a user starts with: a name, and what goes in it. */
|
|
16
|
+
export const DEFAULT_SECTIONS = [
|
|
17
|
+
{ name: 'World', about: 'International news, conflicts, and diplomacy' },
|
|
18
|
+
{ name: 'Politics', about: 'Governments, elections, laws, and policy' },
|
|
19
|
+
{ name: 'Business', about: 'Companies, markets, the economy, and work' },
|
|
20
|
+
{ name: 'Technology', about: 'Computing, the internet, AI, gadgets, and the tech industry' },
|
|
21
|
+
{ name: 'Science', about: 'Research, space, the environment, and climate' },
|
|
22
|
+
{ name: 'Health', about: 'Medicine, public health, and wellbeing' },
|
|
23
|
+
{ name: 'Sports', about: 'Games, results, athletes, and leagues' },
|
|
24
|
+
{ name: 'Culture', about: 'Arts, entertainment, books, games, and media' },
|
|
25
|
+
{ name: 'Other', about: 'Notable stories that fit no other section' },
|
|
26
|
+
];
|
|
9
27
|
const tokens = z.number().int().min(0).max(1_000_000_000);
|
|
10
|
-
/** What an admin sets for the server: the API key, the model, and
|
|
28
|
+
/** What an admin sets for the server: the API key, the model, the budgets, and what users may add. */
|
|
11
29
|
export const instanceSettings = z.object({
|
|
12
30
|
apiKey: secret(),
|
|
13
31
|
model: z.enum(MODELS).default('claude-opus-5-5'),
|
|
14
32
|
effort: z.enum(EFFORTS).default('low'),
|
|
15
33
|
monthlyTokens: tokens.default(10_000_000),
|
|
16
34
|
userMonthlyTokens: tokens.default(1_000_000),
|
|
35
|
+
allowInstructions: z.boolean().default(true),
|
|
17
36
|
});
|
|
18
|
-
/**
|
|
37
|
+
/** A section of the overview, by name, with what goes in it. */
|
|
38
|
+
export const section = z.object({
|
|
39
|
+
name: z.string().trim().min(1).max(60),
|
|
40
|
+
about: z.string().trim().max(200).default(''),
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* What each user chooses: all their feeds, only some, or all but some; the sections, the length
|
|
44
|
+
* and style, whether a lead opens it, and instructions of their own.
|
|
45
|
+
*/
|
|
19
46
|
export const userSettings = z.object({
|
|
20
47
|
feedChoice: z.enum(FEED_CHOICES).default('all'),
|
|
21
48
|
feeds: feeds(),
|
|
49
|
+
sections: z
|
|
50
|
+
.array(section)
|
|
51
|
+
.max(DIGEST_LIMITS.sections)
|
|
52
|
+
.default(() => DEFAULT_SECTIONS.map((s) => ({ ...s }))),
|
|
53
|
+
length: z.enum(LENGTHS).default('standard'),
|
|
54
|
+
style: z.enum(STYLES).default('paragraphs'),
|
|
55
|
+
lead: z.boolean().default(true),
|
|
56
|
+
instructions: multiline().max(INSTRUCTIONS_LENGTH).default(''),
|
|
22
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newses/plugin-digest-summary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A Newses plugin that opens your email digest with an overview of the common themes of your unread articles, written by Claude",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"repository": {
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"prepack": "npm run build"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@newses/plugin-api": "^0.1.
|
|
41
|
+
"@newses/plugin-api": "^0.1.2",
|
|
42
42
|
"zod": "^4.6.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@eslint/js": "^10.0.1",
|
|
46
|
-
"@newses/plugin-api": "^0.1.
|
|
46
|
+
"@newses/plugin-api": "^0.1.2",
|
|
47
47
|
"@types/node": "^24.19.1",
|
|
48
48
|
"eslint": "^10.12.0",
|
|
49
49
|
"eslint-config-prettier": "^10.1.8",
|
package/dist/summaries.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type Anthropic from '@anthropic-ai/sdk';
|
|
2
|
-
import type { EventEntry, EventEntryWithText, PluginLogger, PluginStore } from '@newses/plugin-api';
|
|
3
|
-
import type { InstanceSettings } from './settings.js';
|
|
4
|
-
/** How long a summary is kept: past the oldest article a weekly digest lists. */
|
|
5
|
-
export declare const SUMMARY_TTL_SECONDS: number;
|
|
6
|
-
/** Output tokens a summary is counted at when its batch is sent, thinking included. */
|
|
7
|
-
export declare const SUMMARY_OUTPUT_ESTIMATE = 600;
|
|
8
|
-
/**
|
|
9
|
-
* Whether an entry may be sent to Anthropic: never from a feed with a login, whose articles are
|
|
10
|
-
* the user's own, and never a page published from outside any feed.
|
|
11
|
-
*/
|
|
12
|
-
export declare const sendable: (entry: EventEntry) => boolean;
|
|
13
|
-
/** What is kept for an entry's hash in a language: a summary, null for none, pending, or nothing. */
|
|
14
|
-
export declare function storedSummary(store: PluginStore, language: string, hash: string): Promise<{
|
|
15
|
-
summary: string | null;
|
|
16
|
-
} | 'pending' | undefined>;
|
|
17
|
-
/** Keeps a summary, or that an entry has none. */
|
|
18
|
-
export declare function keepSummary(store: PluginStore, language: string, hash: string, summary: string | null): Promise<void>;
|
|
19
|
-
/** The tokens a summary request is counted at before it runs: about 3 characters a token. */
|
|
20
|
-
export declare const estimateTokens: (prompt: string) => number;
|
|
21
|
-
/**
|
|
22
|
-
* Sends the entries not yet summarised in `language` as one Message Batch, as many as `allowance`
|
|
23
|
-
* tokens cover, and counts their estimate. Returns how many were sent and the tokens counted.
|
|
24
|
-
*/
|
|
25
|
-
export declare function submitBatch(options: {
|
|
26
|
-
client: Anthropic;
|
|
27
|
-
settings: InstanceSettings;
|
|
28
|
-
store: PluginStore;
|
|
29
|
-
entries: readonly EventEntryWithText[];
|
|
30
|
-
language: string;
|
|
31
|
-
allowance: number;
|
|
32
|
-
signal: AbortSignal;
|
|
33
|
-
}): Promise<{
|
|
34
|
-
sent: number;
|
|
35
|
-
tokens: number;
|
|
36
|
-
}>;
|
|
37
|
-
/**
|
|
38
|
-
* Keeps the summaries of batches that have ended, until `deadline` (ms since the epoch): a
|
|
39
|
-
* refused or unreadable answer as none, an errored or expired item as nothing, to be summarised
|
|
40
|
-
* in a digest instead. Corrects the instance's count from the batch's estimate to what it used.
|
|
41
|
-
* Returns how many batches it finished.
|
|
42
|
-
*/
|
|
43
|
-
export declare function collectBatches(options: {
|
|
44
|
-
client: Anthropic;
|
|
45
|
-
store: PluginStore;
|
|
46
|
-
logger: PluginLogger;
|
|
47
|
-
deadline: number;
|
|
48
|
-
signal: AbortSignal;
|
|
49
|
-
now: () => Date;
|
|
50
|
-
}): Promise<number>;
|
package/dist/summaries.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { NotFoundError } from '@anthropic-ai/sdk';
|
|
2
|
-
import { finalText } from './claude.js';
|
|
3
|
-
import { readSummary, SUMMARY_FORMAT, SUMMARY_SYSTEM, summaryPrompt } from './prompts.js';
|
|
4
|
-
import { count, tokensOf } from './usage.js';
|
|
5
|
-
/*
|
|
6
|
-
* Entries are shared: the same article reaches every user subscribed to its feed with the same
|
|
7
|
-
* content hash. So each is summarised once per hash and language, kept in the instance's storage:
|
|
8
|
-
*
|
|
9
|
-
* summary:<language>:<hash> { summary: string | null } when done (null: refused, or no answer
|
|
10
|
-
* worth keeping), or { batch: id } while a batch has it
|
|
11
|
-
* batch:<id> the batch's hashes in request order, its language, and the tokens
|
|
12
|
-
* counted for it when it was sent
|
|
13
|
-
*/
|
|
14
|
-
/** How long a summary is kept: past the oldest article a weekly digest lists. */
|
|
15
|
-
export const SUMMARY_TTL_SECONDS = 30 * 24 * 60 * 60;
|
|
16
|
-
/** How long an entry waits for its batch, which ends within 24 hours. */
|
|
17
|
-
const PENDING_TTL_SECONDS = 2 * 24 * 60 * 60;
|
|
18
|
-
/** Output tokens a summary is counted at when its batch is sent, thinking included. */
|
|
19
|
-
export const SUMMARY_OUTPUT_ESTIMATE = 600;
|
|
20
|
-
/** A summary's `max_tokens`, thinking included. */
|
|
21
|
-
const SUMMARY_MAX_TOKENS = 2000;
|
|
22
|
-
const summaryKey = (language, hash) => `summary:${language}:${hash}`;
|
|
23
|
-
const batchKey = (id) => `batch:${id}`;
|
|
24
|
-
/**
|
|
25
|
-
* Whether an entry may be sent to Anthropic: never from a feed with a login, whose articles are
|
|
26
|
-
* the user's own, and never a page published from outside any feed.
|
|
27
|
-
*/
|
|
28
|
-
export const sendable = (entry) => entry.feed !== null && !entry.feed.withLogin;
|
|
29
|
-
/** What is kept for an entry's hash in a language: a summary, null for none, pending, or nothing. */
|
|
30
|
-
export async function storedSummary(store, language, hash) {
|
|
31
|
-
const value = (await store.get(summaryKey(language, hash)));
|
|
32
|
-
if (!value)
|
|
33
|
-
return undefined;
|
|
34
|
-
return 'batch' in value ? 'pending' : { summary: value.summary };
|
|
35
|
-
}
|
|
36
|
-
/** Keeps a summary, or that an entry has none. */
|
|
37
|
-
export async function keepSummary(store, language, hash, summary) {
|
|
38
|
-
await store.set(summaryKey(language, hash), { summary }, {
|
|
39
|
-
ttlSeconds: SUMMARY_TTL_SECONDS,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/** The tokens a summary request is counted at before it runs: about 3 characters a token. */
|
|
43
|
-
export const estimateTokens = (prompt) => Math.ceil((SUMMARY_SYSTEM.length + prompt.length) / 3) + SUMMARY_OUTPUT_ESTIMATE;
|
|
44
|
-
/** A summary request, as a batch item. */
|
|
45
|
-
function summaryParams(settings, prompt) {
|
|
46
|
-
return {
|
|
47
|
-
model: settings.model,
|
|
48
|
-
max_tokens: SUMMARY_MAX_TOKENS,
|
|
49
|
-
output_config: { effort: settings.effort, format: SUMMARY_FORMAT },
|
|
50
|
-
// Unchanging and first, so the prompt cache can serve it.
|
|
51
|
-
system: [{ type: 'text', text: SUMMARY_SYSTEM, cache_control: { type: 'ephemeral' } }],
|
|
52
|
-
messages: [{ role: 'user', content: prompt }],
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Sends the entries not yet summarised in `language` as one Message Batch, as many as `allowance`
|
|
57
|
-
* tokens cover, and counts their estimate. Returns how many were sent and the tokens counted.
|
|
58
|
-
*/
|
|
59
|
-
export async function submitBatch(options) {
|
|
60
|
-
const { client, settings, store, language, signal } = options;
|
|
61
|
-
const unique = new Map();
|
|
62
|
-
for (const entry of options.entries)
|
|
63
|
-
if (sendable(entry) && !unique.has(entry.contentHash))
|
|
64
|
-
unique.set(entry.contentHash, entry);
|
|
65
|
-
const kept = await Promise.all([...unique.keys()].map((hash) => storedSummary(store, language, hash)));
|
|
66
|
-
const wanted = [...unique.values()].filter((_, index) => kept[index] === undefined);
|
|
67
|
-
const items = [];
|
|
68
|
-
let tokens = 0;
|
|
69
|
-
for (const entry of wanted) {
|
|
70
|
-
const prompt = summaryPrompt({ title: entry.title, feed: entry.feed?.title ?? '', text: entry.text }, language);
|
|
71
|
-
const estimate = estimateTokens(prompt);
|
|
72
|
-
if (tokens + estimate > options.allowance)
|
|
73
|
-
break;
|
|
74
|
-
tokens += estimate;
|
|
75
|
-
items.push({ hash: entry.contentHash, prompt });
|
|
76
|
-
}
|
|
77
|
-
if (items.length === 0)
|
|
78
|
-
return { sent: 0, tokens: 0 };
|
|
79
|
-
const batch = await client.messages.batches.create({
|
|
80
|
-
requests: items.map((item, index) => ({
|
|
81
|
-
custom_id: `s${String(index)}`,
|
|
82
|
-
params: summaryParams(settings, item.prompt),
|
|
83
|
-
})),
|
|
84
|
-
}, { signal });
|
|
85
|
-
const record = {
|
|
86
|
-
language,
|
|
87
|
-
hashes: items.map((item) => item.hash),
|
|
88
|
-
estimate: tokens,
|
|
89
|
-
};
|
|
90
|
-
await store.set(batchKey(batch.id), record, { ttlSeconds: 30 * 24 * 60 * 60 });
|
|
91
|
-
await Promise.all(items.map((item) => store.set(summaryKey(language, item.hash), { batch: batch.id }, {
|
|
92
|
-
ttlSeconds: PENDING_TTL_SECONDS,
|
|
93
|
-
})));
|
|
94
|
-
return { sent: items.length, tokens };
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Keeps the summaries of batches that have ended, until `deadline` (ms since the epoch): a
|
|
98
|
-
* refused or unreadable answer as none, an errored or expired item as nothing, to be summarised
|
|
99
|
-
* in a digest instead. Corrects the instance's count from the batch's estimate to what it used.
|
|
100
|
-
* Returns how many batches it finished.
|
|
101
|
-
*/
|
|
102
|
-
export async function collectBatches(options) {
|
|
103
|
-
const { client, store, logger, signal } = options;
|
|
104
|
-
let finished = 0;
|
|
105
|
-
for (const { key, value } of await store.list('batch:', { limit: 20 })) {
|
|
106
|
-
if (Date.now() >= options.deadline)
|
|
107
|
-
break;
|
|
108
|
-
const id = key.slice('batch:'.length);
|
|
109
|
-
const record = value;
|
|
110
|
-
try {
|
|
111
|
-
const batch = await client.messages.batches.retrieve(id, null, { signal });
|
|
112
|
-
if (batch.processing_status !== 'ended')
|
|
113
|
-
continue;
|
|
114
|
-
let used = 0;
|
|
115
|
-
const seen = new Set();
|
|
116
|
-
for await (const item of await client.messages.batches.results(id, undefined, { signal })) {
|
|
117
|
-
const hash = record.hashes[Number(item.custom_id.slice(1))];
|
|
118
|
-
if (hash === undefined)
|
|
119
|
-
continue;
|
|
120
|
-
seen.add(hash);
|
|
121
|
-
if (item.result.type !== 'succeeded') {
|
|
122
|
-
await store.delete(summaryKey(record.language, hash));
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
const message = item.result.message;
|
|
126
|
-
used += tokensOf(message.usage);
|
|
127
|
-
const summary = message.stop_reason === 'end_turn' ? readSummary(finalText(message.content)) : null;
|
|
128
|
-
await keepSummary(store, record.language, hash, summary);
|
|
129
|
-
}
|
|
130
|
-
for (const hash of record.hashes)
|
|
131
|
-
if (!seen.has(hash))
|
|
132
|
-
await store.delete(summaryKey(record.language, hash));
|
|
133
|
-
await count(store, used - record.estimate, options.now());
|
|
134
|
-
await store.delete(key);
|
|
135
|
-
finished += 1;
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
if (error instanceof NotFoundError) {
|
|
139
|
-
await store.delete(key);
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
logger.warn('could not collect a summary batch', { batch: id, error: String(error) });
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return finished;
|
|
147
|
-
}
|