slotdeck 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +486 -2
- package/dist/deck/numbers.d.ts +14 -0
- package/dist/deck/numbers.js +48 -0
- package/dist/deck/numbers.js.map +1 -0
- package/dist/deck/spec.d.ts +73 -0
- package/dist/deck/spec.js +21 -0
- package/dist/deck/spec.js.map +1 -0
- package/dist/deck/validate.d.ts +49 -0
- package/dist/deck/validate.js +189 -0
- package/dist/deck/validate.js.map +1 -0
- package/dist/generate.d.ts +53 -0
- package/dist/generate.js +44 -0
- package/dist/generate.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/gemini.d.ts +39 -0
- package/dist/llm/gemini.js +147 -0
- package/dist/llm/gemini.js.map +1 -0
- package/dist/llm/provider.d.ts +38 -0
- package/dist/llm/provider.js +2 -0
- package/dist/llm/provider.js.map +1 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.js +31 -0
- package/dist/node.js.map +1 -0
- package/dist/plan/assets.d.ts +28 -0
- package/dist/plan/assets.js +80 -0
- package/dist/plan/assets.js.map +1 -0
- package/dist/plan/catalog.d.ts +106 -0
- package/dist/plan/catalog.js +302 -0
- package/dist/plan/catalog.js.map +1 -0
- package/dist/plan/edit.d.ts +31 -0
- package/dist/plan/edit.js +364 -0
- package/dist/plan/edit.js.map +1 -0
- package/dist/plan/plan.d.ts +106 -0
- package/dist/plan/plan.js +243 -0
- package/dist/plan/plan.js.map +1 -0
- package/dist/plan/write.d.ts +39 -0
- package/dist/plan/write.js +179 -0
- package/dist/plan/write.js.map +1 -0
- package/dist/pptx/package.d.ts +48 -0
- package/dist/pptx/package.js +202 -0
- package/dist/pptx/package.js.map +1 -0
- package/dist/pptx/presentation.d.ts +20 -0
- package/dist/pptx/presentation.js +31 -0
- package/dist/pptx/presentation.js.map +1 -0
- package/dist/pptx/xml.d.ts +23 -0
- package/dist/pptx/xml.js +67 -0
- package/dist/pptx/xml.js.map +1 -0
- package/dist/render/chart.d.ts +18 -0
- package/dist/render/chart.js +158 -0
- package/dist/render/chart.js.map +1 -0
- package/dist/render/extract.d.ts +11 -0
- package/dist/render/extract.js +65 -0
- package/dist/render/extract.js.map +1 -0
- package/dist/render/picture.d.ts +20 -0
- package/dist/render/picture.js +114 -0
- package/dist/render/picture.js.map +1 -0
- package/dist/render/render.d.ts +32 -0
- package/dist/render/render.js +247 -0
- package/dist/render/render.js.map +1 -0
- package/dist/render/repeat.d.ts +15 -0
- package/dist/render/repeat.js +118 -0
- package/dist/render/repeat.js.map +1 -0
- package/dist/render/table.d.ts +12 -0
- package/dist/render/table.js +84 -0
- package/dist/render/table.js.map +1 -0
- package/dist/render/text.d.ts +31 -0
- package/dist/render/text.js +210 -0
- package/dist/render/text.js.map +1 -0
- package/dist/store.d.ts +18 -0
- package/dist/store.js +23 -0
- package/dist/store.js.map +1 -0
- package/dist/template/change.d.ts +138 -0
- package/dist/template/change.js +406 -0
- package/dist/template/change.js.map +1 -0
- package/dist/template/check.d.ts +15 -0
- package/dist/template/check.js +97 -0
- package/dist/template/check.js.map +1 -0
- package/dist/template/draft.d.ts +47 -0
- package/dist/template/draft.js +276 -0
- package/dist/template/draft.js.map +1 -0
- package/dist/template/inspect.d.ts +53 -0
- package/dist/template/inspect.js +157 -0
- package/dist/template/inspect.js.map +1 -0
- package/dist/template/instruct.d.ts +26 -0
- package/dist/template/instruct.js +278 -0
- package/dist/template/instruct.js.map +1 -0
- package/dist/template/manifest.d.ts +226 -0
- package/dist/template/manifest.js +116 -0
- package/dist/template/manifest.js.map +1 -0
- package/dist/template/measure.d.ts +80 -0
- package/dist/template/measure.js +212 -0
- package/dist/template/measure.js.map +1 -0
- package/dist/template/sample.d.ts +17 -0
- package/dist/template/sample.js +96 -0
- package/dist/template/sample.js.map +1 -0
- package/dist/template/view.d.ts +46 -0
- package/dist/template/view.js +38 -0
- package/dist/template/view.js.map +1 -0
- package/dist/tools.d.ts +68 -0
- package/dist/tools.js +266 -0
- package/dist/tools.js.map +1 -0
- package/dist/util/image.d.ts +11 -0
- package/dist/util/image.js +58 -0
- package/dist/util/image.js.map +1 -0
- package/dist/util/png.d.ts +2 -0
- package/dist/util/png.js +50 -0
- package/dist/util/png.js.map +1 -0
- package/package.json +63 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function isImageRef(value) {
|
|
2
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) && typeof value.asset === 'string';
|
|
3
|
+
}
|
|
4
|
+
export function isTableValue(value) {
|
|
5
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
6
|
+
return false;
|
|
7
|
+
const table = value;
|
|
8
|
+
return Array.isArray(table.header) && Array.isArray(table.rows) && table.rows.every((row) => Array.isArray(row));
|
|
9
|
+
}
|
|
10
|
+
export function isChartValue(value) {
|
|
11
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
12
|
+
return false;
|
|
13
|
+
const chart = value;
|
|
14
|
+
return Array.isArray(chart.categories) && Array.isArray(chart.series);
|
|
15
|
+
}
|
|
16
|
+
/** Normalises a text value to paragraphs. */
|
|
17
|
+
export function toParagraphs(value) {
|
|
18
|
+
const parts = Array.isArray(value) ? value : [value];
|
|
19
|
+
return parts.flatMap((part) => part.split(/\r?\n/)).map((line) => line.trim());
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/deck/spec.ts"],"names":[],"mappings":"AAyEA,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAQ,KAAkB,CAAC,KAAK,KAAK,QAAQ,CAAC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Manifest } from '../template/manifest.ts';
|
|
2
|
+
import type { ChartValue, DeckSpec, ImageRef, SlideSpec, TableValue } from './spec.ts';
|
|
3
|
+
export type LayoutMode = 'strict' | 'adaptive';
|
|
4
|
+
export interface Issue {
|
|
5
|
+
severity: 'error' | 'warning';
|
|
6
|
+
/** 1-based slide number in the deck; absent for deck-level issues. */
|
|
7
|
+
slide?: number;
|
|
8
|
+
slot?: string;
|
|
9
|
+
message: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class DeckValidationError extends Error {
|
|
12
|
+
readonly issues: Issue[];
|
|
13
|
+
constructor(issues: Issue[]);
|
|
14
|
+
}
|
|
15
|
+
/** What the renderer should do with one slot on one slide. */
|
|
16
|
+
export type SlotAction = {
|
|
17
|
+
type: 'text';
|
|
18
|
+
paragraphs: string[];
|
|
19
|
+
} | {
|
|
20
|
+
type: 'image';
|
|
21
|
+
image: ImageRef;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'table';
|
|
24
|
+
table: TableValue;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'chart';
|
|
27
|
+
chart: ChartValue;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'remove';
|
|
30
|
+
} | {
|
|
31
|
+
type: 'keep';
|
|
32
|
+
};
|
|
33
|
+
export interface ValidateOptions {
|
|
34
|
+
layout?: LayoutMode;
|
|
35
|
+
/** Ids of the assets that will be available at render time. When given, image references are checked. */
|
|
36
|
+
assets?: Iterable<string>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Decides what happens to a slot, or reports why it cannot be filled.
|
|
40
|
+
* Shared by validation and rendering so they can never disagree.
|
|
41
|
+
* `source` is the deck slot name the value comes from (see `slotSources`).
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveSlot(slot: SlotDef, slide: SlideSpec, deck: DeckSpec, layout: LayoutMode, source?: string): {
|
|
44
|
+
action: SlotAction;
|
|
45
|
+
} | {
|
|
46
|
+
error: string;
|
|
47
|
+
};
|
|
48
|
+
/** Checks a deck against a manifest. Errors block rendering; warnings do not. */
|
|
49
|
+
export declare function validateDeck(manifest: TemplateManifest, deck: DeckSpec, options?: ValidateOptions): Issue[];
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { effectiveSlots, itemRange, slotSources, textBudget } from '../template/manifest.js';
|
|
2
|
+
import { isChartValue, isImageRef, isTableValue, toParagraphs } from './spec.js';
|
|
3
|
+
export class DeckValidationError extends Error {
|
|
4
|
+
issues;
|
|
5
|
+
constructor(issues) {
|
|
6
|
+
super(`Deck cannot be rendered:\n${issues
|
|
7
|
+
.map((issue) => ` - ${issue.slide ? `slide ${issue.slide}` : 'deck'}${issue.slot ? ` / ${issue.slot}` : ''}: ${issue.message}`)
|
|
8
|
+
.join('\n')}`);
|
|
9
|
+
this.name = 'DeckValidationError';
|
|
10
|
+
this.issues = issues;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Decides what happens to a slot, or reports why it cannot be filled.
|
|
15
|
+
* Shared by validation and rendering so they can never disagree.
|
|
16
|
+
* `source` is the deck slot name the value comes from (see `slotSources`).
|
|
17
|
+
*/
|
|
18
|
+
export function resolveSlot(slot, slide, deck, layout, source = slot.name) {
|
|
19
|
+
let value = slide.slots[source];
|
|
20
|
+
if (value === undefined && slot.kind === 'text' && slot.deckField) {
|
|
21
|
+
value = deck.fields?.[slot.deckField];
|
|
22
|
+
}
|
|
23
|
+
const policy = slot.empty ?? 'error';
|
|
24
|
+
if (value === null || value === undefined || (typeof value === 'string' && value.trim() === '')) {
|
|
25
|
+
const explicit = value === null;
|
|
26
|
+
if (policy === 'keep' && !explicit)
|
|
27
|
+
return { action: { type: 'keep' } };
|
|
28
|
+
if (policy === 'drop')
|
|
29
|
+
return { action: { type: 'remove' } };
|
|
30
|
+
if (policy === 'error')
|
|
31
|
+
return { error: 'this slot is required' };
|
|
32
|
+
if (layout !== 'adaptive')
|
|
33
|
+
return { error: "leaving this slot empty needs layout: 'adaptive'" };
|
|
34
|
+
return { action: { type: 'remove' } };
|
|
35
|
+
}
|
|
36
|
+
if (slot.kind === 'table') {
|
|
37
|
+
if (!isTableValue(value))
|
|
38
|
+
return { error: 'expected a table such as { "header": [...], "rows": [[...]] }' };
|
|
39
|
+
const header = value.header.map((cell) => String(cell ?? '').trim());
|
|
40
|
+
if (header.length === 0)
|
|
41
|
+
return { error: 'the table has no columns' };
|
|
42
|
+
const rows = value.rows.map((row) => row.map((cell) => String(cell ?? '').trim()));
|
|
43
|
+
const uneven = rows.findIndex((row) => row.length !== header.length);
|
|
44
|
+
if (uneven >= 0)
|
|
45
|
+
return { error: `row ${uneven + 1} has ${rows[uneven]?.length} cells; the table has ${header.length} columns` };
|
|
46
|
+
return { action: { type: 'table', table: { header, rows } } };
|
|
47
|
+
}
|
|
48
|
+
if (slot.kind === 'chart') {
|
|
49
|
+
if (!isChartValue(value)) {
|
|
50
|
+
return { error: 'expected a chart such as { "type": "column", "categories": [...], "series": [{ "name": "...", "values": [...] }] }' };
|
|
51
|
+
}
|
|
52
|
+
if (!['column', 'bar', 'line', 'pie'].includes(value.type))
|
|
53
|
+
return { error: `unknown chart type "${String(value.type)}"` };
|
|
54
|
+
const categories = value.categories.map((category) => String(category ?? '').trim());
|
|
55
|
+
if (categories.length === 0)
|
|
56
|
+
return { error: 'the chart has no categories' };
|
|
57
|
+
const series = value.series.map((entry) => ({
|
|
58
|
+
name: String(entry?.name ?? '').trim(),
|
|
59
|
+
values: (Array.isArray(entry?.values) ? entry.values : []).map(Number),
|
|
60
|
+
}));
|
|
61
|
+
if (series.length === 0)
|
|
62
|
+
return { error: 'the chart has no series' };
|
|
63
|
+
for (const entry of series) {
|
|
64
|
+
const label = entry.name ? `series "${entry.name}"` : 'a series';
|
|
65
|
+
if (entry.values.length !== categories.length) {
|
|
66
|
+
return { error: `${label} has ${entry.values.length} values; the chart has ${categories.length} categories` };
|
|
67
|
+
}
|
|
68
|
+
if (entry.values.some((number) => !Number.isFinite(number)))
|
|
69
|
+
return { error: `${label} has a value that is not a number` };
|
|
70
|
+
}
|
|
71
|
+
if (value.type === 'pie' && series.length > 1)
|
|
72
|
+
return { error: 'a pie chart takes exactly one series' };
|
|
73
|
+
const chart = { type: value.type, categories, series };
|
|
74
|
+
if (value.format === 'percent' || value.format === 'number')
|
|
75
|
+
chart.format = value.format;
|
|
76
|
+
return { action: { type: 'chart', chart } };
|
|
77
|
+
}
|
|
78
|
+
if (slot.kind === 'text') {
|
|
79
|
+
if (isImageRef(value) || isTableValue(value) || isChartValue(value))
|
|
80
|
+
return { error: 'expected text' };
|
|
81
|
+
const paragraphs = toParagraphs(value).filter((paragraph) => paragraph !== '');
|
|
82
|
+
if (paragraphs.length === 0)
|
|
83
|
+
return { error: 'this slot is required' };
|
|
84
|
+
return { action: { type: 'text', paragraphs } };
|
|
85
|
+
}
|
|
86
|
+
if (!isImageRef(value))
|
|
87
|
+
return { error: 'expected an image reference such as { "asset": "id" }' };
|
|
88
|
+
return { action: { type: 'image', image: value } };
|
|
89
|
+
}
|
|
90
|
+
/** Checks a deck against a manifest. Errors block rendering; warnings do not. */
|
|
91
|
+
export function validateDeck(manifest, deck, options = {}) {
|
|
92
|
+
const issues = [];
|
|
93
|
+
const layout = options.layout ?? 'strict';
|
|
94
|
+
const assets = options.assets ? new Set(options.assets) : undefined;
|
|
95
|
+
const patterns = new Map(manifest.patterns.map((pattern) => [pattern.id, pattern]));
|
|
96
|
+
const mirrored = (deck.direction ?? manifest.direction) !== manifest.direction;
|
|
97
|
+
if (!Array.isArray(deck.slides) || deck.slides.length === 0) {
|
|
98
|
+
issues.push({ severity: 'error', message: 'the deck has no slides' });
|
|
99
|
+
return issues;
|
|
100
|
+
}
|
|
101
|
+
deck.slides.forEach((slide, index) => {
|
|
102
|
+
const number = index + 1;
|
|
103
|
+
const pattern = patterns.get(slide.pattern);
|
|
104
|
+
if (!pattern) {
|
|
105
|
+
issues.push({
|
|
106
|
+
severity: 'error',
|
|
107
|
+
slide: number,
|
|
108
|
+
message: `unknown pattern "${slide.pattern}" (available: ${[...patterns.keys()].join(', ')})`,
|
|
109
|
+
});
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const range = itemRange(pattern);
|
|
113
|
+
if (slide.items !== undefined && !range) {
|
|
114
|
+
issues.push({ severity: 'warning', slide: number, message: `pattern "${pattern.id}" has a fixed number of items; "items" is ignored` });
|
|
115
|
+
}
|
|
116
|
+
if (range && slide.items !== undefined && (!Number.isInteger(slide.items) || slide.items < range.min || slide.items > range.max)) {
|
|
117
|
+
issues.push({
|
|
118
|
+
severity: 'error',
|
|
119
|
+
slide: number,
|
|
120
|
+
message: `pattern "${pattern.id}" takes ${range.min} to ${range.max} ${pattern.repeat?.item ?? 'item'}s, not ${slide.items}`,
|
|
121
|
+
});
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const slots = effectiveSlots(pattern, slide.items);
|
|
125
|
+
const known = new Set(slots.map((slot) => slot.name));
|
|
126
|
+
for (const name of Object.keys(slide.slots ?? {})) {
|
|
127
|
+
if (!known.has(name)) {
|
|
128
|
+
issues.push({ severity: 'warning', slide: number, slot: name, message: `pattern "${pattern.id}" has no such slot; ignored` });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const sources = slotSources(pattern, mirrored, slide.items);
|
|
132
|
+
for (const slot of slots) {
|
|
133
|
+
// Problems are reported under the name the deck used, which differs across a mirrored sequence.
|
|
134
|
+
const source = sources.get(slot.name) ?? slot.name;
|
|
135
|
+
const resolved = resolveSlot(slot, { ...slide, slots: slide.slots ?? {} }, deck, layout, source);
|
|
136
|
+
if ('error' in resolved) {
|
|
137
|
+
issues.push({ severity: 'error', slide: number, slot: source, message: resolved.error });
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const action = resolved.action;
|
|
141
|
+
if (action.type === 'text' && slot.kind === 'text') {
|
|
142
|
+
// Larger deck text leaves less room in the same box.
|
|
143
|
+
const budget = textBudget(slot, deck.textScale);
|
|
144
|
+
const chars = action.paragraphs.reduce((sum, paragraph) => sum + paragraph.length, 0);
|
|
145
|
+
if (budget.maxChars !== undefined && chars > budget.maxChars) {
|
|
146
|
+
issues.push({
|
|
147
|
+
severity: 'warning',
|
|
148
|
+
slide: number,
|
|
149
|
+
slot: source,
|
|
150
|
+
message: `text is ${chars} characters; the slot fits about ${budget.maxChars}`,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (budget.maxParagraphs !== undefined && action.paragraphs.length > budget.maxParagraphs) {
|
|
154
|
+
issues.push({
|
|
155
|
+
severity: 'warning',
|
|
156
|
+
slide: number,
|
|
157
|
+
slot: source,
|
|
158
|
+
message: `text has ${action.paragraphs.length} paragraphs; the slot fits ${budget.maxParagraphs}`,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (action.type === 'table' && slot.kind === 'table') {
|
|
163
|
+
const { header, rows } = action.table;
|
|
164
|
+
const warn = (message) => issues.push({ severity: 'warning', slide: number, slot: source, message });
|
|
165
|
+
if (slot.maxColumns !== undefined && header.length > slot.maxColumns)
|
|
166
|
+
warn(`the table has ${header.length} columns; the slot fits ${slot.maxColumns}`);
|
|
167
|
+
if (slot.maxRows !== undefined && rows.length > slot.maxRows)
|
|
168
|
+
warn(`the table has ${rows.length} rows; the slot fits ${slot.maxRows}`);
|
|
169
|
+
const longest = Math.max(0, ...[header, ...rows].flat().map((cell) => cell.length));
|
|
170
|
+
if (slot.maxCellChars !== undefined && longest > slot.maxCellChars)
|
|
171
|
+
warn(`a cell is ${longest} characters; cells fit about ${slot.maxCellChars}`);
|
|
172
|
+
}
|
|
173
|
+
if (action.type === 'chart' && slot.kind === 'chart') {
|
|
174
|
+
const { categories, series } = action.chart;
|
|
175
|
+
const warn = (message) => issues.push({ severity: 'warning', slide: number, slot: source, message });
|
|
176
|
+
if (slot.maxCategories !== undefined && categories.length > slot.maxCategories) {
|
|
177
|
+
warn(`the chart has ${categories.length} categories; the slot fits ${slot.maxCategories}`);
|
|
178
|
+
}
|
|
179
|
+
if (slot.maxSeries !== undefined && series.length > slot.maxSeries)
|
|
180
|
+
warn(`the chart has ${series.length} series; the slot fits ${slot.maxSeries}`);
|
|
181
|
+
}
|
|
182
|
+
if (action.type === 'image' && assets && !assets.has(action.image.asset)) {
|
|
183
|
+
issues.push({ severity: 'error', slide: number, slot: source, message: `asset "${action.image.asset}" was not provided` });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
return issues;
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/deck/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAajF,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,MAAM,CAAU;IAEzB,YAAY,MAAe;QACzB,KAAK,CACH,6BAA6B,MAAM;aAChC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aAC/H,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAiBD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,IAAa,EACb,KAAgB,EA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AI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS;oBAAE,IAAI,CAAC,iBAAiB,MAAM,CAAC,MAAM,0BAA0B,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YACrJ,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzE,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,MAAM,CAAC,KAAK,CAAC,KAAK,oBAAoB,EAAE,CAAC,CAAC;YAC7H,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Issue } from './deck/validate.ts';
|
|
2
|
+
import type { DeckSpec } from './deck/spec.ts';
|
|
3
|
+
import type { ImageProvider } from './llm/provider.ts';
|
|
4
|
+
import type { EditOptions } from './plan/edit.ts';
|
|
5
|
+
import type { Brief, OutlineEntry, PlanOptions, PlanProgress } from './plan/plan.ts';
|
|
6
|
+
import type { Template } from './render/render.ts';
|
|
7
|
+
export type GenerateProgress = PlanProgress | {
|
|
8
|
+
stage: 'images';
|
|
9
|
+
done: number;
|
|
10
|
+
total: number;
|
|
11
|
+
} | {
|
|
12
|
+
stage: 'render';
|
|
13
|
+
};
|
|
14
|
+
interface PictureOptions {
|
|
15
|
+
/** Generates photos. Without it, and without supplied photos, new slides are planned with no photos. */
|
|
16
|
+
images?: ImageProvider;
|
|
17
|
+
/** Generated pictures by asset id; reuse it across calls to avoid generating the same picture twice. */
|
|
18
|
+
cache?: Map<string, Uint8Array>;
|
|
19
|
+
/** How many pictures to generate at once. Defaults to 3. */
|
|
20
|
+
imageConcurrency?: number;
|
|
21
|
+
onProgress?: (event: GenerateProgress) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface GenerateOptions extends Omit<PlanOptions, 'onProgress'>, PictureOptions {
|
|
24
|
+
}
|
|
25
|
+
export interface GenerateResult {
|
|
26
|
+
pptx: Uint8Array;
|
|
27
|
+
/** The deck as JSON. Store it: it is what gets edited and re-rendered. */
|
|
28
|
+
deck: DeckSpec;
|
|
29
|
+
/** Every picture the deck uses, by asset id. */
|
|
30
|
+
assets: Record<string, Uint8Array>;
|
|
31
|
+
warnings: Issue[];
|
|
32
|
+
outline: OutlineEntry[];
|
|
33
|
+
}
|
|
34
|
+
export interface EditDeckOptions extends Omit<EditOptions, 'onProgress'>, PictureOptions {
|
|
35
|
+
}
|
|
36
|
+
export interface EditDeckResult {
|
|
37
|
+
pptx: Uint8Array;
|
|
38
|
+
deck: DeckSpec;
|
|
39
|
+
assets: Record<string, Uint8Array>;
|
|
40
|
+
warnings: Issue[];
|
|
41
|
+
/** One sentence from the model on what it changed. */
|
|
42
|
+
summary: string;
|
|
43
|
+
/** Slide numbers in the new deck that were written or rewritten. */
|
|
44
|
+
rewritten: number[];
|
|
45
|
+
}
|
|
46
|
+
/** Brief in, pptx out: plans the deck with the language model, gathers its pictures and renders it. */
|
|
47
|
+
export declare function generateDeck(template: Template, brief: Brief, options: GenerateOptions): Promise<GenerateResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Applies an instruction to an existing deck and renders the result. Pass the pictures of the
|
|
50
|
+
* earlier version in `cache` (see `extractAssets`) so unchanged photos are not generated again.
|
|
51
|
+
*/
|
|
52
|
+
export declare function editDeck(template: Template, deck: DeckSpec, instruction: string, options: EditDeckOptions): Promise<EditDeckResult>;
|
|
53
|
+
export {};
|
package/dist/generate.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { resolveAssets } from './plan/assets.js';
|
|
2
|
+
import { planEdit } from './plan/edit.js';
|
|
3
|
+
import { planDeck } from './plan/plan.js';
|
|
4
|
+
import { renderDeck } from './render/render.js';
|
|
5
|
+
function canMakePhotos(options) {
|
|
6
|
+
return !!options.images || (options.assets ?? []).some((asset) => asset.kind === 'photo');
|
|
7
|
+
}
|
|
8
|
+
async function picturesAndPptx(template, deck, options) {
|
|
9
|
+
const resolve = {};
|
|
10
|
+
if (options.images)
|
|
11
|
+
resolve.images = options.images;
|
|
12
|
+
if (options.icons)
|
|
13
|
+
resolve.icons = options.icons;
|
|
14
|
+
if (options.assets)
|
|
15
|
+
resolve.assets = options.assets;
|
|
16
|
+
if (options.cache)
|
|
17
|
+
resolve.cache = options.cache;
|
|
18
|
+
if (options.imageConcurrency)
|
|
19
|
+
resolve.concurrency = options.imageConcurrency;
|
|
20
|
+
if (options.onProgress)
|
|
21
|
+
resolve.onProgress = options.onProgress;
|
|
22
|
+
if (options.signal)
|
|
23
|
+
resolve.signal = options.signal;
|
|
24
|
+
const assets = await resolveAssets(template, deck, resolve);
|
|
25
|
+
options.onProgress?.({ stage: 'render' });
|
|
26
|
+
const rendered = renderDeck(template, deck, options.layout ? { assets, layout: options.layout } : { assets });
|
|
27
|
+
return { pptx: rendered.pptx, assets };
|
|
28
|
+
}
|
|
29
|
+
/** Brief in, pptx out: plans the deck with the language model, gathers its pictures and renders it. */
|
|
30
|
+
export async function generateDeck(template, brief, options) {
|
|
31
|
+
const plan = await planDeck(template, canMakePhotos(options) ? brief : { ...brief, imageDensity: 'none' }, options);
|
|
32
|
+
const output = await picturesAndPptx(template, plan.deck, options);
|
|
33
|
+
return { ...output, deck: plan.deck, warnings: plan.warnings, outline: plan.outline };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Applies an instruction to an existing deck and renders the result. Pass the pictures of the
|
|
37
|
+
* earlier version in `cache` (see `extractAssets`) so unchanged photos are not generated again.
|
|
38
|
+
*/
|
|
39
|
+
export async function editDeck(template, deck, instruction, options) {
|
|
40
|
+
const edit = await planEdit(template, deck, instruction, canMakePhotos(options) ? options : { ...options, imageDensity: 'none' });
|
|
41
|
+
const output = await picturesAndPptx(template, edit.deck, options);
|
|
42
|
+
return { ...output, deck: edit.deck, warnings: edit.warnings, summary: edit.summary, rewritten: edit.rewritten };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAwChD,SAAS,aAAa,CAAC,OAA8D;IACnF,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AAC5F,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,QAAkB,EAClB,IAAc,EACd,OAA6D;IAE7D,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACpD,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IACjD,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACpD,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IACjD,IAAI,OAAO,CAAC,gBAAgB;QAAE,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAC7E,IAAI,OAAO,CAA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mB,EAAE,OAAwB;IAC9G,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;IAClI,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;AACnH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export { editDeck, generateDeck } from './generate.ts';
|
|
2
|
+
export type { EditDeckOptions, EditDeckResult, GenerateOptions, GenerateProgress, GenerateResult } from './generate.ts';
|
|
3
|
+
export { TOOL_NAMES, presentationTools, storeKeys } from './tools.ts';
|
|
4
|
+
export type { PresentationTools, PresentationToolsOptions, ToolDefinition, ToolResult } from './tools.ts';
|
|
5
|
+
export { memoryStore } from './store.ts';
|
|
6
|
+
export type { BlobStore } from './store.ts';
|
|
7
|
+
export { PlanError, directionOf, editPlan, planDeck, planOutline, writeDeck } from './plan/plan.ts';
|
|
8
|
+
export type { Brief, DeckPlan, OutlineEntry, PlanOptions, PlanProgress, PlanResult } from './plan/plan.ts';
|
|
9
|
+
export { planEdit } from './plan/edit.ts';
|
|
10
|
+
export type { EditOptions, EditResult } from './plan/edit.ts';
|
|
11
|
+
export { resolveAssets } from './plan/assets.ts';
|
|
12
|
+
export type { ResolveOptions } from './plan/assets.ts';
|
|
13
|
+
export { extractAssets } from './render/extract.ts';
|
|
14
|
+
export type { AssetDef, IconDef, ImageDensity } from './plan/catalog.ts';
|
|
15
|
+
export { loadTemplate, renderDeck } from './render/render.ts';
|
|
16
|
+
export type { RenderOptions, RenderResult, Template } from './render/render.ts';
|
|
17
|
+
export type { ImageProvider, ImageRequest, JsonRequest, JsonSchema, LlmProvider } from './llm/provider.ts';
|
|
18
|
+
export { GEMINI_DEVELOPER_ENDPOINT, GeminiError, gemini, geminiImages, vertexEndpoint } from './llm/gemini.ts';
|
|
19
|
+
export type { GeminiImageOptions, GeminiOptions } from './llm/gemini.ts';
|
|
20
|
+
export { DeckValidationError, validateDeck } from './deck/validate.ts';
|
|
21
|
+
export type { Issue, LayoutMode, ValidateOptions } from './deck/validate.ts';
|
|
22
|
+
export type { ChartType, ChartValue, DeckSpec, ImageRef, SlideSpec, SlotValue, TableValue } from './deck/spec.ts';
|
|
23
|
+
export { isChartValue, isImageRef, isTableValue } from './deck/spec.ts';
|
|
24
|
+
export { draftManifest } from './template/draft.ts';
|
|
25
|
+
export type { DraftOptions, DraftResult, SlidePicture } from './template/draft.ts';
|
|
26
|
+
export { checkManifest } from './template/check.ts';
|
|
27
|
+
export type { ManifestIssue } from './template/check.ts';
|
|
28
|
+
export { sampleDeck } from './template/sample.ts';
|
|
29
|
+
export type { SampleOptions } from './template/sample.ts';
|
|
30
|
+
export { changeManifest, describeSlot } from './template/change.ts';
|
|
31
|
+
export type { ChangeResult, ManifestChange, SlotPatch } from './template/change.ts';
|
|
32
|
+
export { describeManifest, editManifest } from './template/instruct.ts';
|
|
33
|
+
export type { ManifestEditOptions, ManifestEditResult } from './template/instruct.ts';
|
|
34
|
+
export { studioView } from './template/view.ts';
|
|
35
|
+
export type { StudioShape, StudioSlide, StudioView } from './template/view.ts';
|
|
36
|
+
export { ROLES } from './template/measure.ts';
|
|
37
|
+
export type { Role } from './template/measure.ts';
|
|
38
|
+
export { inspectTemplate } from './template/inspect.ts';
|
|
39
|
+
export type { Box, ShapeInfo, ShapeKind, SlideInfo, TemplateInfo } from './template/inspect.ts';
|
|
40
|
+
export type { AlignPolicy, ChartSlotDef, Direction, EmptyPolicy, ImageKind, ImageSlotDef, PatternDef, RepeatDef, SlideBox, SlotDef, TableSlotDef, TableTextStyle, TemplateManifest, TextSize, TextSlotDef, } from './template/manifest.ts';
|
|
41
|
+
export { TEXT_SIZES } from './template/manifest.ts';
|
|
42
|
+
export { PptxPackage } from './pptx/package.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Brief in, pptx out; and an instruction applied to an existing deck.
|
|
2
|
+
export { editDeck, generateDeck } from './generate.js';
|
|
3
|
+
// Tools for a chat model: plan, change the plan, create, change the deck.
|
|
4
|
+
export { TOOL_NAMES, presentationTools, storeKeys } from './tools.js';
|
|
5
|
+
export { memoryStore } from './store.js';
|
|
6
|
+
// The steps of generateDeck, usable on their own.
|
|
7
|
+
export { PlanError, directionOf, editPlan, planDeck, planOutline, writeDeck } from './plan/plan.js';
|
|
8
|
+
export { planEdit } from './plan/edit.js';
|
|
9
|
+
export { resolveAssets } from './plan/assets.js';
|
|
10
|
+
export { extractAssets } from './render/extract.js';
|
|
11
|
+
export { loadTemplate, renderDeck } from './render/render.js';
|
|
12
|
+
export { GEMINI_DEVELOPER_ENDPOINT, GeminiError, gemini, geminiImages, vertexEndpoint } from './llm/gemini.js';
|
|
13
|
+
// Decks.
|
|
14
|
+
export { DeckValidationError, validateDeck } from './deck/validate.js';
|
|
15
|
+
export { isChartValue, isImageRef, isTableValue } from './deck/spec.js';
|
|
16
|
+
// Templates.
|
|
17
|
+
export { draftManifest } from './template/draft.js';
|
|
18
|
+
export { checkManifest } from './template/check.js';
|
|
19
|
+
export { sampleDeck } from './template/sample.js';
|
|
20
|
+
export { changeManifest, describeSlot } from './template/change.js';
|
|
21
|
+
export { describeManifest, editManifest } from './template/instruct.js';
|
|
22
|
+
export { studioView } from './template/view.js';
|
|
23
|
+
export { ROLES } from './template/measure.js';
|
|
24
|
+
export { inspectTemplate } from './template/inspect.js';
|
|
25
|
+
export { TEXT_SIZES } from './template/manifest.js';
|
|
26
|
+
export { PptxPackage } from './pptx/package.js';
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGvD,0EAA0E;AAC1E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,kDAAkD;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEpG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAK9D,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG/G,SAAS;AACT,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAExE,aAAa;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAmBxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ImageProvider, LlmProvider } from './provider.ts';
|
|
2
|
+
export declare const GEMINI_DEVELOPER_ENDPOINT = "https://generativelanguage.googleapis.com/v1/interactions";
|
|
3
|
+
/** Endpoint of the Interactions API on Vertex AI. Authenticate with a bearer token via `headers`. */
|
|
4
|
+
export declare function vertexEndpoint(project: string, location?: string): string;
|
|
5
|
+
type Headers = Record<string, string>;
|
|
6
|
+
interface GeminiConnection {
|
|
7
|
+
model: string;
|
|
8
|
+
/** Gemini Developer API key, sent as `x-goog-api-key`. */
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
/** Interactions endpoint. Defaults to the Developer API; use {@link vertexEndpoint} for Vertex AI. */
|
|
11
|
+
endpoint?: string;
|
|
12
|
+
/** Extra headers, or a function returning them, e.g. a fresh `Authorization: Bearer` token. */
|
|
13
|
+
headers?: Headers | (() => Headers | Promise<Headers>);
|
|
14
|
+
/** Custom fetch, for proxies and tests. */
|
|
15
|
+
fetch?: typeof fetch;
|
|
16
|
+
/** Gives up on a request that has not answered after this long. Defaults to 3 minutes; 0 waits for ever. */
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface GeminiOptions extends GeminiConnection {
|
|
20
|
+
thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high';
|
|
21
|
+
maxOutputTokens?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface GeminiImageOptions extends GeminiConnection {
|
|
24
|
+
/** Output size class. Defaults to `1K`. */
|
|
25
|
+
imageSize?: '512' | '1K' | '2K' | '4K';
|
|
26
|
+
/** Appended to every prompt, e.g. a house photo style. */
|
|
27
|
+
style?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class GeminiError extends Error {
|
|
30
|
+
readonly status: number | undefined;
|
|
31
|
+
constructor(message: string, status?: number);
|
|
32
|
+
}
|
|
33
|
+
/** A Gemini text model as an {@link LlmProvider}. */
|
|
34
|
+
export declare function gemini(options: GeminiOptions): LlmProvider;
|
|
35
|
+
/** The supported output ratio closest to the frame (compared on a log scale, so 2:1 and 1:2 are equally far from 1:1). */
|
|
36
|
+
export declare function nearestAspectRatio(ratio: number): string;
|
|
37
|
+
/** A Gemini image model as an {@link ImageProvider}. */
|
|
38
|
+
export declare function geminiImages(options: GeminiImageOptions): ImageProvider;
|
|
39
|
+
export {};
|