openalmanac 0.2.0 → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openalmanac",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "OpenAlmanac — pull, edit, and push articles to the open knowledge base",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,2 +0,0 @@
1
- import { FastMCP } from "fastmcp";
2
- export declare function registerReadTools(server: FastMCP): void;
@@ -1,65 +0,0 @@
1
- import { z } from "zod";
2
- import { request } from "../auth.js";
3
- export function registerReadTools(server) {
4
- server.addTool({
5
- name: "search_articles",
6
- description: "Search existing OpenAlmanac articles. Use this to check if an article already exists before creating one. No authentication needed.",
7
- parameters: z.object({
8
- query: z.string().describe("Search terms"),
9
- limit: z.number().default(10).describe("Max results (1-100, default 10)"),
10
- page: z.number().default(1).describe("Page number, 1-indexed (default 1)"),
11
- }),
12
- async execute({ query, limit, page }) {
13
- const resp = await request("GET", "/api/search", {
14
- params: { query, limit, page },
15
- });
16
- return JSON.stringify(await resp.json(), null, 2);
17
- },
18
- });
19
- server.addTool({
20
- name: "list_articles",
21
- description: "Browse all OpenAlmanac articles. No authentication needed.",
22
- parameters: z.object({
23
- sort: z
24
- .string()
25
- .default("recent")
26
- .describe("Sort order — 'recent' or 'title' (default 'recent')"),
27
- limit: z.number().default(50).describe("Max results (1-200, default 50)"),
28
- offset: z.number().default(0).describe("Pagination offset (default 0)"),
29
- }),
30
- async execute({ sort, limit, offset }) {
31
- const resp = await request("GET", "/api/articles", {
32
- params: { sort, limit, offset },
33
- });
34
- return JSON.stringify(await resp.json(), null, 2);
35
- },
36
- });
37
- server.addTool({
38
- name: "get_article",
39
- description: "Get a single OpenAlmanac article by its slug. No authentication needed.",
40
- parameters: z.object({
41
- slug: z.string().describe("Article identifier (kebab-case, e.g. 'machine-learning')"),
42
- format: z
43
- .string()
44
- .default("json")
45
- .describe("'json' for full article with metadata, 'md' for raw markdown with YAML frontmatter"),
46
- }),
47
- async execute({ slug, format }) {
48
- try {
49
- const resp = await request("GET", `/api/articles/${slug}`, {
50
- params: { format },
51
- });
52
- if (format === "md") {
53
- return await resp.text();
54
- }
55
- return JSON.stringify(await resp.json(), null, 2);
56
- }
57
- catch (e) {
58
- if (e instanceof Error && e.message.includes("404")) {
59
- throw new Error(`Article '${slug}' not found. Use search_articles to find the correct slug.`);
60
- }
61
- throw e;
62
- }
63
- },
64
- });
65
- }
@@ -1,2 +0,0 @@
1
- import { FastMCP } from "fastmcp";
2
- export declare function registerWriteTools(server: FastMCP): void;
@@ -1,105 +0,0 @@
1
- import { z } from "zod";
2
- import { request } from "../auth.js";
3
- import { Source, Infobox } from "../types.js";
4
- export function registerWriteTools(server) {
5
- server.addTool({
6
- name: "create_article",
7
- description: "Create a new article. Search existing articles first to avoid duplicates. " +
8
- "Research your topic with search_web and read_webpage before writing.\n\n" +
9
- "Every substantive paragraph in content_md must have at least one [N] citation " +
10
- "marker (1-indexed). Markers must be sequential with no gaps. Every source must " +
11
- "be referenced and every reference must have a source. Requires API key.",
12
- parameters: z.object({
13
- slug: z
14
- .string()
15
- .describe("Unique kebab-case identifier (e.g. 'machine-learning'). Pattern: ^[a-z0-9]+(-[a-z0-9]+)*$"),
16
- title: z.string().describe("Article title (max 500 chars)"),
17
- content_md: z.string().describe("Markdown body with [1], [2] etc. citation markers"),
18
- sources: z
19
- .array(Source)
20
- .describe("List of sources — each citation [N] maps to sources[N-1]"),
21
- summary: z.string().default("").describe("Brief summary of the article"),
22
- category: z.string().default("uncategorized").describe("Category name"),
23
- tags: z.array(z.string()).default([]).describe("List of tags"),
24
- infobox: Infobox.nullable()
25
- .optional()
26
- .describe("Structured metadata sidebar. Include image_url in header when possible."),
27
- relationships: z
28
- .array(z.string())
29
- .default([])
30
- .describe("Slugs of related articles"),
31
- }),
32
- async execute({ slug, title, content_md, sources, summary, category, tags, infobox, relationships }) {
33
- const body = {
34
- article_id: slug,
35
- title,
36
- content: content_md,
37
- summary,
38
- category,
39
- tags,
40
- sources,
41
- relationships,
42
- };
43
- if (infobox) {
44
- body.infobox = infobox;
45
- }
46
- try {
47
- const resp = await request("POST", "/api/articles", { auth: true, json: body });
48
- return JSON.stringify(await resp.json(), null, 2);
49
- }
50
- catch (e) {
51
- if (e instanceof Error && e.message.includes("409")) {
52
- throw new Error(`Article '${slug}' already exists. Use update_article to modify it.`);
53
- }
54
- throw e;
55
- }
56
- },
57
- });
58
- server.addTool({
59
- name: "update_article",
60
- description: "Update an existing article. Only provided fields are changed — omitted fields " +
61
- "stay as-is. If content_md is updated, sources should also be updated to keep " +
62
- "citations valid. Requires API key.",
63
- parameters: z.object({
64
- slug: z.string().describe("Article identifier to update"),
65
- change_summary: z.string().default("Updated article").describe("Description of what changed"),
66
- title: z.string().optional().describe("New title"),
67
- content_md: z.string().optional().describe("New markdown content with [N] citations"),
68
- summary: z.string().optional().describe("New summary"),
69
- category: z.string().optional().describe("New category"),
70
- tags: z.array(z.string()).optional().describe("New tags list"),
71
- sources: z.array(Source).optional().describe("New sources list"),
72
- infobox: Infobox.nullable().optional().describe("New infobox metadata"),
73
- relationships: z.array(z.string()).optional().describe("New related article slugs"),
74
- }),
75
- async execute({ slug, change_summary, title, content_md, summary, category, tags, sources, infobox, relationships }) {
76
- const body = { change_summary };
77
- if (title !== undefined)
78
- body.title = title;
79
- if (content_md !== undefined)
80
- body.content = content_md;
81
- if (summary !== undefined)
82
- body.summary = summary;
83
- if (category !== undefined)
84
- body.category = category;
85
- if (tags !== undefined)
86
- body.tags = tags;
87
- if (sources !== undefined)
88
- body.sources = sources;
89
- if (infobox !== undefined)
90
- body.infobox = infobox;
91
- if (relationships !== undefined)
92
- body.relationships = relationships;
93
- try {
94
- const resp = await request("PUT", `/api/articles/${slug}`, { auth: true, json: body });
95
- return JSON.stringify(await resp.json(), null, 2);
96
- }
97
- catch (e) {
98
- if (e instanceof Error && e.message.includes("404")) {
99
- throw new Error(`Article '${slug}' not found. Use search_articles to find the correct slug.`);
100
- }
101
- throw e;
102
- }
103
- },
104
- });
105
- }
package/dist/types.d.ts DELETED
@@ -1,953 +0,0 @@
1
- import { z } from "zod";
2
- export declare const Source: z.ZodObject<{
3
- url: z.ZodString;
4
- title: z.ZodString;
5
- accessed_date: z.ZodString;
6
- }, "strip", z.ZodTypeAny, {
7
- url: string;
8
- title: string;
9
- accessed_date: string;
10
- }, {
11
- url: string;
12
- title: string;
13
- accessed_date: string;
14
- }>;
15
- export declare const InfoboxDetail: z.ZodObject<{
16
- key: z.ZodString;
17
- value: z.ZodString;
18
- }, "strip", z.ZodTypeAny, {
19
- value: string;
20
- key: string;
21
- }, {
22
- value: string;
23
- key: string;
24
- }>;
25
- export declare const InfoboxHeader: z.ZodObject<{
26
- image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
- subtitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
- details: z.ZodDefault<z.ZodArray<z.ZodObject<{
29
- key: z.ZodString;
30
- value: z.ZodString;
31
- }, "strip", z.ZodTypeAny, {
32
- value: string;
33
- key: string;
34
- }, {
35
- value: string;
36
- key: string;
37
- }>, "many">>;
38
- links: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
39
- }, "strip", z.ZodTypeAny, {
40
- details: {
41
- value: string;
42
- key: string;
43
- }[];
44
- links: string[];
45
- image_url?: string | null | undefined;
46
- subtitle?: string | null | undefined;
47
- }, {
48
- image_url?: string | null | undefined;
49
- subtitle?: string | null | undefined;
50
- details?: {
51
- value: string;
52
- key: string;
53
- }[] | undefined;
54
- links?: string[] | undefined;
55
- }>;
56
- export declare const TimelineItem: z.ZodObject<{
57
- primary: z.ZodString;
58
- secondary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
- period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
- location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
- description: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
62
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
- }, "strip", z.ZodTypeAny, {
64
- primary: string;
65
- link?: string | null | undefined;
66
- secondary?: string | null | undefined;
67
- period?: string | null | undefined;
68
- location?: string | null | undefined;
69
- description?: string[] | null | undefined;
70
- }, {
71
- primary: string;
72
- link?: string | null | undefined;
73
- secondary?: string | null | undefined;
74
- period?: string | null | undefined;
75
- location?: string | null | undefined;
76
- description?: string[] | null | undefined;
77
- }>;
78
- export declare const ListItem: z.ZodObject<{
79
- title: z.ZodString;
80
- subtitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
- year: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
- description: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
83
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
- }, "strip", z.ZodTypeAny, {
85
- title: string;
86
- link?: string | null | undefined;
87
- subtitle?: string | null | undefined;
88
- description?: string[] | null | undefined;
89
- year?: string | null | undefined;
90
- }, {
91
- title: string;
92
- link?: string | null | undefined;
93
- subtitle?: string | null | undefined;
94
- description?: string[] | null | undefined;
95
- year?: string | null | undefined;
96
- }>;
97
- export declare const GridItem: z.ZodObject<{
98
- title: z.ZodString;
99
- image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
- year: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
- type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
- }, "strip", z.ZodTypeAny, {
105
- title: string;
106
- link?: string | null | undefined;
107
- type?: string | null | undefined;
108
- image_url?: string | null | undefined;
109
- description?: string | null | undefined;
110
- year?: string | null | undefined;
111
- }, {
112
- title: string;
113
- link?: string | null | undefined;
114
- type?: string | null | undefined;
115
- image_url?: string | null | undefined;
116
- description?: string | null | undefined;
117
- year?: string | null | undefined;
118
- }>;
119
- export declare const TableItems: z.ZodObject<{
120
- headers: z.ZodArray<z.ZodString, "many">;
121
- rows: z.ZodArray<z.ZodObject<{
122
- cells: z.ZodArray<z.ZodString, "many">;
123
- }, "strip", z.ZodTypeAny, {
124
- cells: string[];
125
- }, {
126
- cells: string[];
127
- }>, "many">;
128
- }, "strip", z.ZodTypeAny, {
129
- headers: string[];
130
- rows: {
131
- cells: string[];
132
- }[];
133
- }, {
134
- headers: string[];
135
- rows: {
136
- cells: string[];
137
- }[];
138
- }>;
139
- export declare const TimelineSection: z.ZodObject<{
140
- type: z.ZodLiteral<"timeline">;
141
- title: z.ZodString;
142
- items: z.ZodArray<z.ZodObject<{
143
- primary: z.ZodString;
144
- secondary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
- period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
- location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
147
- description: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
148
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
149
- }, "strip", z.ZodTypeAny, {
150
- primary: string;
151
- link?: string | null | undefined;
152
- secondary?: string | null | undefined;
153
- period?: string | null | undefined;
154
- location?: string | null | undefined;
155
- description?: string[] | null | undefined;
156
- }, {
157
- primary: string;
158
- link?: string | null | undefined;
159
- secondary?: string | null | undefined;
160
- period?: string | null | undefined;
161
- location?: string | null | undefined;
162
- description?: string[] | null | undefined;
163
- }>, "many">;
164
- }, "strip", z.ZodTypeAny, {
165
- type: "timeline";
166
- title: string;
167
- items: {
168
- primary: string;
169
- link?: string | null | undefined;
170
- secondary?: string | null | undefined;
171
- period?: string | null | undefined;
172
- location?: string | null | undefined;
173
- description?: string[] | null | undefined;
174
- }[];
175
- }, {
176
- type: "timeline";
177
- title: string;
178
- items: {
179
- primary: string;
180
- link?: string | null | undefined;
181
- secondary?: string | null | undefined;
182
- period?: string | null | undefined;
183
- location?: string | null | undefined;
184
- description?: string[] | null | undefined;
185
- }[];
186
- }>;
187
- export declare const ListSection: z.ZodObject<{
188
- type: z.ZodLiteral<"list">;
189
- title: z.ZodString;
190
- items: z.ZodArray<z.ZodObject<{
191
- title: z.ZodString;
192
- subtitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
- year: z.ZodOptional<z.ZodNullable<z.ZodString>>;
194
- description: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
195
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
- }, "strip", z.ZodTypeAny, {
197
- title: string;
198
- link?: string | null | undefined;
199
- subtitle?: string | null | undefined;
200
- description?: string[] | null | undefined;
201
- year?: string | null | undefined;
202
- }, {
203
- title: string;
204
- link?: string | null | undefined;
205
- subtitle?: string | null | undefined;
206
- description?: string[] | null | undefined;
207
- year?: string | null | undefined;
208
- }>, "many">;
209
- }, "strip", z.ZodTypeAny, {
210
- type: "list";
211
- title: string;
212
- items: {
213
- title: string;
214
- link?: string | null | undefined;
215
- subtitle?: string | null | undefined;
216
- description?: string[] | null | undefined;
217
- year?: string | null | undefined;
218
- }[];
219
- }, {
220
- type: "list";
221
- title: string;
222
- items: {
223
- title: string;
224
- link?: string | null | undefined;
225
- subtitle?: string | null | undefined;
226
- description?: string[] | null | undefined;
227
- year?: string | null | undefined;
228
- }[];
229
- }>;
230
- export declare const TagsSection: z.ZodObject<{
231
- type: z.ZodLiteral<"tags">;
232
- title: z.ZodString;
233
- items: z.ZodArray<z.ZodString, "many">;
234
- }, "strip", z.ZodTypeAny, {
235
- type: "tags";
236
- title: string;
237
- items: string[];
238
- }, {
239
- type: "tags";
240
- title: string;
241
- items: string[];
242
- }>;
243
- export declare const GridSection: z.ZodObject<{
244
- type: z.ZodLiteral<"grid">;
245
- title: z.ZodString;
246
- items: z.ZodArray<z.ZodObject<{
247
- title: z.ZodString;
248
- image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
249
- year: z.ZodOptional<z.ZodNullable<z.ZodString>>;
250
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
251
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
252
- type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
253
- }, "strip", z.ZodTypeAny, {
254
- title: string;
255
- link?: string | null | undefined;
256
- type?: string | null | undefined;
257
- image_url?: string | null | undefined;
258
- description?: string | null | undefined;
259
- year?: string | null | undefined;
260
- }, {
261
- title: string;
262
- link?: string | null | undefined;
263
- type?: string | null | undefined;
264
- image_url?: string | null | undefined;
265
- description?: string | null | undefined;
266
- year?: string | null | undefined;
267
- }>, "many">;
268
- }, "strip", z.ZodTypeAny, {
269
- type: "grid";
270
- title: string;
271
- items: {
272
- title: string;
273
- link?: string | null | undefined;
274
- type?: string | null | undefined;
275
- image_url?: string | null | undefined;
276
- description?: string | null | undefined;
277
- year?: string | null | undefined;
278
- }[];
279
- }, {
280
- type: "grid";
281
- title: string;
282
- items: {
283
- title: string;
284
- link?: string | null | undefined;
285
- type?: string | null | undefined;
286
- image_url?: string | null | undefined;
287
- description?: string | null | undefined;
288
- year?: string | null | undefined;
289
- }[];
290
- }>;
291
- export declare const TableSection: z.ZodObject<{
292
- type: z.ZodLiteral<"table">;
293
- title: z.ZodString;
294
- items: z.ZodObject<{
295
- headers: z.ZodArray<z.ZodString, "many">;
296
- rows: z.ZodArray<z.ZodObject<{
297
- cells: z.ZodArray<z.ZodString, "many">;
298
- }, "strip", z.ZodTypeAny, {
299
- cells: string[];
300
- }, {
301
- cells: string[];
302
- }>, "many">;
303
- }, "strip", z.ZodTypeAny, {
304
- headers: string[];
305
- rows: {
306
- cells: string[];
307
- }[];
308
- }, {
309
- headers: string[];
310
- rows: {
311
- cells: string[];
312
- }[];
313
- }>;
314
- }, "strip", z.ZodTypeAny, {
315
- type: "table";
316
- title: string;
317
- items: {
318
- headers: string[];
319
- rows: {
320
- cells: string[];
321
- }[];
322
- };
323
- }, {
324
- type: "table";
325
- title: string;
326
- items: {
327
- headers: string[];
328
- rows: {
329
- cells: string[];
330
- }[];
331
- };
332
- }>;
333
- export declare const KeyValueSection: z.ZodObject<{
334
- type: z.ZodLiteral<"key_value">;
335
- title: z.ZodString;
336
- items: z.ZodArray<z.ZodObject<{
337
- key: z.ZodString;
338
- value: z.ZodString;
339
- }, "strip", z.ZodTypeAny, {
340
- value: string;
341
- key: string;
342
- }, {
343
- value: string;
344
- key: string;
345
- }>, "many">;
346
- }, "strip", z.ZodTypeAny, {
347
- type: "key_value";
348
- title: string;
349
- items: {
350
- value: string;
351
- key: string;
352
- }[];
353
- }, {
354
- type: "key_value";
355
- title: string;
356
- items: {
357
- value: string;
358
- key: string;
359
- }[];
360
- }>;
361
- export declare const InfoboxSection: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
362
- type: z.ZodLiteral<"timeline">;
363
- title: z.ZodString;
364
- items: z.ZodArray<z.ZodObject<{
365
- primary: z.ZodString;
366
- secondary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
367
- period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
368
- location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
369
- description: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
370
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
371
- }, "strip", z.ZodTypeAny, {
372
- primary: string;
373
- link?: string | null | undefined;
374
- secondary?: string | null | undefined;
375
- period?: string | null | undefined;
376
- location?: string | null | undefined;
377
- description?: string[] | null | undefined;
378
- }, {
379
- primary: string;
380
- link?: string | null | undefined;
381
- secondary?: string | null | undefined;
382
- period?: string | null | undefined;
383
- location?: string | null | undefined;
384
- description?: string[] | null | undefined;
385
- }>, "many">;
386
- }, "strip", z.ZodTypeAny, {
387
- type: "timeline";
388
- title: string;
389
- items: {
390
- primary: string;
391
- link?: string | null | undefined;
392
- secondary?: string | null | undefined;
393
- period?: string | null | undefined;
394
- location?: string | null | undefined;
395
- description?: string[] | null | undefined;
396
- }[];
397
- }, {
398
- type: "timeline";
399
- title: string;
400
- items: {
401
- primary: string;
402
- link?: string | null | undefined;
403
- secondary?: string | null | undefined;
404
- period?: string | null | undefined;
405
- location?: string | null | undefined;
406
- description?: string[] | null | undefined;
407
- }[];
408
- }>, z.ZodObject<{
409
- type: z.ZodLiteral<"list">;
410
- title: z.ZodString;
411
- items: z.ZodArray<z.ZodObject<{
412
- title: z.ZodString;
413
- subtitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
414
- year: z.ZodOptional<z.ZodNullable<z.ZodString>>;
415
- description: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
416
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
417
- }, "strip", z.ZodTypeAny, {
418
- title: string;
419
- link?: string | null | undefined;
420
- subtitle?: string | null | undefined;
421
- description?: string[] | null | undefined;
422
- year?: string | null | undefined;
423
- }, {
424
- title: string;
425
- link?: string | null | undefined;
426
- subtitle?: string | null | undefined;
427
- description?: string[] | null | undefined;
428
- year?: string | null | undefined;
429
- }>, "many">;
430
- }, "strip", z.ZodTypeAny, {
431
- type: "list";
432
- title: string;
433
- items: {
434
- title: string;
435
- link?: string | null | undefined;
436
- subtitle?: string | null | undefined;
437
- description?: string[] | null | undefined;
438
- year?: string | null | undefined;
439
- }[];
440
- }, {
441
- type: "list";
442
- title: string;
443
- items: {
444
- title: string;
445
- link?: string | null | undefined;
446
- subtitle?: string | null | undefined;
447
- description?: string[] | null | undefined;
448
- year?: string | null | undefined;
449
- }[];
450
- }>, z.ZodObject<{
451
- type: z.ZodLiteral<"tags">;
452
- title: z.ZodString;
453
- items: z.ZodArray<z.ZodString, "many">;
454
- }, "strip", z.ZodTypeAny, {
455
- type: "tags";
456
- title: string;
457
- items: string[];
458
- }, {
459
- type: "tags";
460
- title: string;
461
- items: string[];
462
- }>, z.ZodObject<{
463
- type: z.ZodLiteral<"grid">;
464
- title: z.ZodString;
465
- items: z.ZodArray<z.ZodObject<{
466
- title: z.ZodString;
467
- image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
468
- year: z.ZodOptional<z.ZodNullable<z.ZodString>>;
469
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
470
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
471
- type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
472
- }, "strip", z.ZodTypeAny, {
473
- title: string;
474
- link?: string | null | undefined;
475
- type?: string | null | undefined;
476
- image_url?: string | null | undefined;
477
- description?: string | null | undefined;
478
- year?: string | null | undefined;
479
- }, {
480
- title: string;
481
- link?: string | null | undefined;
482
- type?: string | null | undefined;
483
- image_url?: string | null | undefined;
484
- description?: string | null | undefined;
485
- year?: string | null | undefined;
486
- }>, "many">;
487
- }, "strip", z.ZodTypeAny, {
488
- type: "grid";
489
- title: string;
490
- items: {
491
- title: string;
492
- link?: string | null | undefined;
493
- type?: string | null | undefined;
494
- image_url?: string | null | undefined;
495
- description?: string | null | undefined;
496
- year?: string | null | undefined;
497
- }[];
498
- }, {
499
- type: "grid";
500
- title: string;
501
- items: {
502
- title: string;
503
- link?: string | null | undefined;
504
- type?: string | null | undefined;
505
- image_url?: string | null | undefined;
506
- description?: string | null | undefined;
507
- year?: string | null | undefined;
508
- }[];
509
- }>, z.ZodObject<{
510
- type: z.ZodLiteral<"table">;
511
- title: z.ZodString;
512
- items: z.ZodObject<{
513
- headers: z.ZodArray<z.ZodString, "many">;
514
- rows: z.ZodArray<z.ZodObject<{
515
- cells: z.ZodArray<z.ZodString, "many">;
516
- }, "strip", z.ZodTypeAny, {
517
- cells: string[];
518
- }, {
519
- cells: string[];
520
- }>, "many">;
521
- }, "strip", z.ZodTypeAny, {
522
- headers: string[];
523
- rows: {
524
- cells: string[];
525
- }[];
526
- }, {
527
- headers: string[];
528
- rows: {
529
- cells: string[];
530
- }[];
531
- }>;
532
- }, "strip", z.ZodTypeAny, {
533
- type: "table";
534
- title: string;
535
- items: {
536
- headers: string[];
537
- rows: {
538
- cells: string[];
539
- }[];
540
- };
541
- }, {
542
- type: "table";
543
- title: string;
544
- items: {
545
- headers: string[];
546
- rows: {
547
- cells: string[];
548
- }[];
549
- };
550
- }>, z.ZodObject<{
551
- type: z.ZodLiteral<"key_value">;
552
- title: z.ZodString;
553
- items: z.ZodArray<z.ZodObject<{
554
- key: z.ZodString;
555
- value: z.ZodString;
556
- }, "strip", z.ZodTypeAny, {
557
- value: string;
558
- key: string;
559
- }, {
560
- value: string;
561
- key: string;
562
- }>, "many">;
563
- }, "strip", z.ZodTypeAny, {
564
- type: "key_value";
565
- title: string;
566
- items: {
567
- value: string;
568
- key: string;
569
- }[];
570
- }, {
571
- type: "key_value";
572
- title: string;
573
- items: {
574
- value: string;
575
- key: string;
576
- }[];
577
- }>]>;
578
- export declare const Infobox: z.ZodObject<{
579
- header: z.ZodObject<{
580
- image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
581
- subtitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
582
- details: z.ZodDefault<z.ZodArray<z.ZodObject<{
583
- key: z.ZodString;
584
- value: z.ZodString;
585
- }, "strip", z.ZodTypeAny, {
586
- value: string;
587
- key: string;
588
- }, {
589
- value: string;
590
- key: string;
591
- }>, "many">>;
592
- links: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
593
- }, "strip", z.ZodTypeAny, {
594
- details: {
595
- value: string;
596
- key: string;
597
- }[];
598
- links: string[];
599
- image_url?: string | null | undefined;
600
- subtitle?: string | null | undefined;
601
- }, {
602
- image_url?: string | null | undefined;
603
- subtitle?: string | null | undefined;
604
- details?: {
605
- value: string;
606
- key: string;
607
- }[] | undefined;
608
- links?: string[] | undefined;
609
- }>;
610
- sections: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
611
- type: z.ZodLiteral<"timeline">;
612
- title: z.ZodString;
613
- items: z.ZodArray<z.ZodObject<{
614
- primary: z.ZodString;
615
- secondary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
616
- period: z.ZodOptional<z.ZodNullable<z.ZodString>>;
617
- location: z.ZodOptional<z.ZodNullable<z.ZodString>>;
618
- description: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
619
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
620
- }, "strip", z.ZodTypeAny, {
621
- primary: string;
622
- link?: string | null | undefined;
623
- secondary?: string | null | undefined;
624
- period?: string | null | undefined;
625
- location?: string | null | undefined;
626
- description?: string[] | null | undefined;
627
- }, {
628
- primary: string;
629
- link?: string | null | undefined;
630
- secondary?: string | null | undefined;
631
- period?: string | null | undefined;
632
- location?: string | null | undefined;
633
- description?: string[] | null | undefined;
634
- }>, "many">;
635
- }, "strip", z.ZodTypeAny, {
636
- type: "timeline";
637
- title: string;
638
- items: {
639
- primary: string;
640
- link?: string | null | undefined;
641
- secondary?: string | null | undefined;
642
- period?: string | null | undefined;
643
- location?: string | null | undefined;
644
- description?: string[] | null | undefined;
645
- }[];
646
- }, {
647
- type: "timeline";
648
- title: string;
649
- items: {
650
- primary: string;
651
- link?: string | null | undefined;
652
- secondary?: string | null | undefined;
653
- period?: string | null | undefined;
654
- location?: string | null | undefined;
655
- description?: string[] | null | undefined;
656
- }[];
657
- }>, z.ZodObject<{
658
- type: z.ZodLiteral<"list">;
659
- title: z.ZodString;
660
- items: z.ZodArray<z.ZodObject<{
661
- title: z.ZodString;
662
- subtitle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
663
- year: z.ZodOptional<z.ZodNullable<z.ZodString>>;
664
- description: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
665
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
666
- }, "strip", z.ZodTypeAny, {
667
- title: string;
668
- link?: string | null | undefined;
669
- subtitle?: string | null | undefined;
670
- description?: string[] | null | undefined;
671
- year?: string | null | undefined;
672
- }, {
673
- title: string;
674
- link?: string | null | undefined;
675
- subtitle?: string | null | undefined;
676
- description?: string[] | null | undefined;
677
- year?: string | null | undefined;
678
- }>, "many">;
679
- }, "strip", z.ZodTypeAny, {
680
- type: "list";
681
- title: string;
682
- items: {
683
- title: string;
684
- link?: string | null | undefined;
685
- subtitle?: string | null | undefined;
686
- description?: string[] | null | undefined;
687
- year?: string | null | undefined;
688
- }[];
689
- }, {
690
- type: "list";
691
- title: string;
692
- items: {
693
- title: string;
694
- link?: string | null | undefined;
695
- subtitle?: string | null | undefined;
696
- description?: string[] | null | undefined;
697
- year?: string | null | undefined;
698
- }[];
699
- }>, z.ZodObject<{
700
- type: z.ZodLiteral<"tags">;
701
- title: z.ZodString;
702
- items: z.ZodArray<z.ZodString, "many">;
703
- }, "strip", z.ZodTypeAny, {
704
- type: "tags";
705
- title: string;
706
- items: string[];
707
- }, {
708
- type: "tags";
709
- title: string;
710
- items: string[];
711
- }>, z.ZodObject<{
712
- type: z.ZodLiteral<"grid">;
713
- title: z.ZodString;
714
- items: z.ZodArray<z.ZodObject<{
715
- title: z.ZodString;
716
- image_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
717
- year: z.ZodOptional<z.ZodNullable<z.ZodString>>;
718
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
719
- link: z.ZodOptional<z.ZodNullable<z.ZodString>>;
720
- type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
721
- }, "strip", z.ZodTypeAny, {
722
- title: string;
723
- link?: string | null | undefined;
724
- type?: string | null | undefined;
725
- image_url?: string | null | undefined;
726
- description?: string | null | undefined;
727
- year?: string | null | undefined;
728
- }, {
729
- title: string;
730
- link?: string | null | undefined;
731
- type?: string | null | undefined;
732
- image_url?: string | null | undefined;
733
- description?: string | null | undefined;
734
- year?: string | null | undefined;
735
- }>, "many">;
736
- }, "strip", z.ZodTypeAny, {
737
- type: "grid";
738
- title: string;
739
- items: {
740
- title: string;
741
- link?: string | null | undefined;
742
- type?: string | null | undefined;
743
- image_url?: string | null | undefined;
744
- description?: string | null | undefined;
745
- year?: string | null | undefined;
746
- }[];
747
- }, {
748
- type: "grid";
749
- title: string;
750
- items: {
751
- title: string;
752
- link?: string | null | undefined;
753
- type?: string | null | undefined;
754
- image_url?: string | null | undefined;
755
- description?: string | null | undefined;
756
- year?: string | null | undefined;
757
- }[];
758
- }>, z.ZodObject<{
759
- type: z.ZodLiteral<"table">;
760
- title: z.ZodString;
761
- items: z.ZodObject<{
762
- headers: z.ZodArray<z.ZodString, "many">;
763
- rows: z.ZodArray<z.ZodObject<{
764
- cells: z.ZodArray<z.ZodString, "many">;
765
- }, "strip", z.ZodTypeAny, {
766
- cells: string[];
767
- }, {
768
- cells: string[];
769
- }>, "many">;
770
- }, "strip", z.ZodTypeAny, {
771
- headers: string[];
772
- rows: {
773
- cells: string[];
774
- }[];
775
- }, {
776
- headers: string[];
777
- rows: {
778
- cells: string[];
779
- }[];
780
- }>;
781
- }, "strip", z.ZodTypeAny, {
782
- type: "table";
783
- title: string;
784
- items: {
785
- headers: string[];
786
- rows: {
787
- cells: string[];
788
- }[];
789
- };
790
- }, {
791
- type: "table";
792
- title: string;
793
- items: {
794
- headers: string[];
795
- rows: {
796
- cells: string[];
797
- }[];
798
- };
799
- }>, z.ZodObject<{
800
- type: z.ZodLiteral<"key_value">;
801
- title: z.ZodString;
802
- items: z.ZodArray<z.ZodObject<{
803
- key: z.ZodString;
804
- value: z.ZodString;
805
- }, "strip", z.ZodTypeAny, {
806
- value: string;
807
- key: string;
808
- }, {
809
- value: string;
810
- key: string;
811
- }>, "many">;
812
- }, "strip", z.ZodTypeAny, {
813
- type: "key_value";
814
- title: string;
815
- items: {
816
- value: string;
817
- key: string;
818
- }[];
819
- }, {
820
- type: "key_value";
821
- title: string;
822
- items: {
823
- value: string;
824
- key: string;
825
- }[];
826
- }>]>, "many">>;
827
- }, "strip", z.ZodTypeAny, {
828
- header: {
829
- details: {
830
- value: string;
831
- key: string;
832
- }[];
833
- links: string[];
834
- image_url?: string | null | undefined;
835
- subtitle?: string | null | undefined;
836
- };
837
- sections: ({
838
- type: "timeline";
839
- title: string;
840
- items: {
841
- primary: string;
842
- link?: string | null | undefined;
843
- secondary?: string | null | undefined;
844
- period?: string | null | undefined;
845
- location?: string | null | undefined;
846
- description?: string[] | null | undefined;
847
- }[];
848
- } | {
849
- type: "list";
850
- title: string;
851
- items: {
852
- title: string;
853
- link?: string | null | undefined;
854
- subtitle?: string | null | undefined;
855
- description?: string[] | null | undefined;
856
- year?: string | null | undefined;
857
- }[];
858
- } | {
859
- type: "tags";
860
- title: string;
861
- items: string[];
862
- } | {
863
- type: "grid";
864
- title: string;
865
- items: {
866
- title: string;
867
- link?: string | null | undefined;
868
- type?: string | null | undefined;
869
- image_url?: string | null | undefined;
870
- description?: string | null | undefined;
871
- year?: string | null | undefined;
872
- }[];
873
- } | {
874
- type: "table";
875
- title: string;
876
- items: {
877
- headers: string[];
878
- rows: {
879
- cells: string[];
880
- }[];
881
- };
882
- } | {
883
- type: "key_value";
884
- title: string;
885
- items: {
886
- value: string;
887
- key: string;
888
- }[];
889
- })[];
890
- }, {
891
- header: {
892
- image_url?: string | null | undefined;
893
- subtitle?: string | null | undefined;
894
- details?: {
895
- value: string;
896
- key: string;
897
- }[] | undefined;
898
- links?: string[] | undefined;
899
- };
900
- sections?: ({
901
- type: "timeline";
902
- title: string;
903
- items: {
904
- primary: string;
905
- link?: string | null | undefined;
906
- secondary?: string | null | undefined;
907
- period?: string | null | undefined;
908
- location?: string | null | undefined;
909
- description?: string[] | null | undefined;
910
- }[];
911
- } | {
912
- type: "list";
913
- title: string;
914
- items: {
915
- title: string;
916
- link?: string | null | undefined;
917
- subtitle?: string | null | undefined;
918
- description?: string[] | null | undefined;
919
- year?: string | null | undefined;
920
- }[];
921
- } | {
922
- type: "tags";
923
- title: string;
924
- items: string[];
925
- } | {
926
- type: "grid";
927
- title: string;
928
- items: {
929
- title: string;
930
- link?: string | null | undefined;
931
- type?: string | null | undefined;
932
- image_url?: string | null | undefined;
933
- description?: string | null | undefined;
934
- year?: string | null | undefined;
935
- }[];
936
- } | {
937
- type: "table";
938
- title: string;
939
- items: {
940
- headers: string[];
941
- rows: {
942
- cells: string[];
943
- }[];
944
- };
945
- } | {
946
- type: "key_value";
947
- title: string;
948
- items: {
949
- value: string;
950
- key: string;
951
- }[];
952
- })[] | undefined;
953
- }>;
package/dist/types.js DELETED
@@ -1,91 +0,0 @@
1
- import { z } from "zod";
2
- export const Source = z.object({
3
- url: z.string().describe("Source URL (must start with http:// or https://)"),
4
- title: z.string().describe("Source title"),
5
- accessed_date: z.string().describe("Date accessed in YYYY-MM-DD format"),
6
- });
7
- export const InfoboxDetail = z.object({
8
- key: z.string(),
9
- value: z.string(),
10
- });
11
- export const InfoboxHeader = z.object({
12
- image_url: z.string().nullable().optional().describe("URL to a representative image"),
13
- subtitle: z
14
- .string()
15
- .nullable()
16
- .optional()
17
- .describe("Short tagline, e.g. 'Mathematician & Computer Scientist'"),
18
- details: z.array(InfoboxDetail).default([]).describe("Key-value pairs for quick facts"),
19
- links: z.array(z.string()).default([]).describe("External reference URLs"),
20
- });
21
- export const TimelineItem = z.object({
22
- primary: z.string().describe("Main event description (required)"),
23
- secondary: z.string().nullable().optional(),
24
- period: z.string().nullable().optional().describe("Time period, e.g. '1936'"),
25
- location: z.string().nullable().optional(),
26
- description: z.array(z.string()).nullable().optional().describe("List of detail strings"),
27
- link: z.string().nullable().optional(),
28
- });
29
- export const ListItem = z.object({
30
- title: z.string().describe("Item title (required)"),
31
- subtitle: z.string().nullable().optional(),
32
- year: z.string().nullable().optional(),
33
- description: z.array(z.string()).nullable().optional().describe("List of detail strings"),
34
- link: z.string().nullable().optional(),
35
- });
36
- export const GridItem = z.object({
37
- title: z.string().describe("Item title (required)"),
38
- image_url: z.string().nullable().optional(),
39
- year: z.string().nullable().optional(),
40
- description: z.string().nullable().optional().describe("Plain string (not a list)"),
41
- link: z.string().nullable().optional(),
42
- type: z.string().nullable().optional(),
43
- });
44
- export const TableItems = z.object({
45
- headers: z.array(z.string()).describe("Column headers (non-empty)"),
46
- rows: z
47
- .array(z.object({ cells: z.array(z.string()) }))
48
- .describe("List of {cells: [str]} dicts matching headers"),
49
- });
50
- export const TimelineSection = z.object({
51
- type: z.literal("timeline"),
52
- title: z.string(),
53
- items: z.array(TimelineItem),
54
- });
55
- export const ListSection = z.object({
56
- type: z.literal("list"),
57
- title: z.string(),
58
- items: z.array(ListItem),
59
- });
60
- export const TagsSection = z.object({
61
- type: z.literal("tags"),
62
- title: z.string(),
63
- items: z.array(z.string()).describe("Flat list of tag strings"),
64
- });
65
- export const GridSection = z.object({
66
- type: z.literal("grid"),
67
- title: z.string(),
68
- items: z.array(GridItem),
69
- });
70
- export const TableSection = z.object({
71
- type: z.literal("table"),
72
- title: z.string(),
73
- items: TableItems,
74
- });
75
- export const KeyValueSection = z.object({
76
- type: z.literal("key_value"),
77
- title: z.string(),
78
- items: z.array(InfoboxDetail),
79
- });
80
- export const InfoboxSection = z.discriminatedUnion("type", [
81
- TimelineSection,
82
- ListSection,
83
- TagsSection,
84
- GridSection,
85
- TableSection,
86
- KeyValueSection,
87
- ]);
88
- export const Infobox = z.object({
89
- header: InfoboxHeader,
90
- sections: z.array(InfoboxSection).default([]),
91
- });