@newses/plugin-digest-summary 0.1.1 → 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.
@@ -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
- /** What an admin sets for the server: the API key, the model, and the monthly budgets. */
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
- /** What each user chooses: all their feeds, only some, or all but some. */
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 the monthly budgets. */
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
- /** What each user chooses: all their feeds, only some, or all but some. */
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.1.1",
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.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.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",