@drawnagency/primitives 0.1.111 → 0.1.112

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.
Files changed (185) hide show
  1. package/dist/{chunk-3GAG6ZXB.js → chunk-3SZNUCXI.js} +8 -4
  2. package/dist/chunk-4I5OO5UB.js +785 -0
  3. package/dist/{chunk-ALMEC3XN.js → chunk-5KNXTMUC.js} +22 -18
  4. package/dist/{chunk-OUYB2GCW.js → chunk-BR4MIPTM.js} +1 -57
  5. package/dist/chunk-CXZ5YJG4.js +85 -0
  6. package/dist/{chunk-RA5IOFPY.js → chunk-DNY72JZN.js} +16 -38
  7. package/dist/{chunk-7MI3HCOF.js → chunk-EPWBPIV6.js} +10 -6
  8. package/dist/chunk-FV7JQRCN.js +94 -0
  9. package/dist/{chunk-UVIYI4J6.js → chunk-HSXMOS5Q.js} +15 -2
  10. package/dist/chunk-IIDKW7AV.js +41 -0
  11. package/dist/chunk-IINIZBQB.js +204 -0
  12. package/dist/chunk-MM7KZS5C.js +30 -0
  13. package/dist/{chunk-VCCNKTFD.js → chunk-OGGZ5AXT.js} +3 -31
  14. package/dist/{chunk-XQMDWXD6.js → chunk-P3ZNCHW7.js} +1 -1
  15. package/dist/chunk-QQ3S3P5P.js +38 -0
  16. package/dist/{chunk-ELQ4C677.js → chunk-TALRVOGO.js} +9 -44
  17. package/dist/chunk-VAYZJKVR.js +209 -0
  18. package/dist/{chunk-OTDA6KWL.js → chunk-VLPELTPI.js} +1 -1
  19. package/dist/{chunk-7WQJ57XG.js → chunk-VT3PYGVW.js} +68 -260
  20. package/dist/chunk-WUJ3XNFI.js +62 -0
  21. package/dist/{chunk-NXGIHSL5.js → chunk-Z2LO4PSQ.js} +11 -91
  22. package/dist/collab/rebase.js +1 -1
  23. package/dist/components/chat/ChatComposer.d.ts +25 -0
  24. package/dist/components/chat/ChatComposer.d.ts.map +1 -0
  25. package/dist/components/chat/ChatPanel.d.ts +5 -4
  26. package/dist/components/chat/ChatPanel.d.ts.map +1 -1
  27. package/dist/components/chat/markdown.d.ts +14 -0
  28. package/dist/components/chat/markdown.d.ts.map +1 -0
  29. package/dist/components/editor/index.js +16 -11
  30. package/dist/components/primitives/EditablePlainText.d.ts.map +1 -1
  31. package/dist/components/primitives/index.js +15 -10
  32. package/dist/components/sections/brand-guide.js +11 -9
  33. package/dist/components/sections/register-schemas.js +19 -14
  34. package/dist/components/sections/register.js +19 -14
  35. package/dist/components/shell/AudienceChips.d.ts +10 -0
  36. package/dist/components/shell/AudienceChips.d.ts.map +1 -0
  37. package/dist/components/shell/EditorShell.d.ts.map +1 -1
  38. package/dist/components/shell/SiteSettingsChatbot.d.ts.map +1 -1
  39. package/dist/components/shell/SiteSettingsDecks.d.ts +13 -0
  40. package/dist/components/shell/SiteSettingsDecks.d.ts.map +1 -0
  41. package/dist/components/shell/SiteSettingsModal.d.ts.map +1 -1
  42. package/dist/deck/DeckComponentView.d.ts +13 -0
  43. package/dist/deck/DeckComponentView.d.ts.map +1 -0
  44. package/dist/deck/DeckPlayer.d.ts +26 -0
  45. package/dist/deck/DeckPlayer.d.ts.map +1 -0
  46. package/dist/deck/DeckSlideView.d.ts +17 -0
  47. package/dist/deck/DeckSlideView.d.ts.map +1 -0
  48. package/dist/deck/DeckStage.d.ts +16 -0
  49. package/dist/deck/DeckStage.d.ts.map +1 -0
  50. package/dist/deck/components/DeckImage.d.ts +14 -0
  51. package/dist/deck/components/DeckImage.d.ts.map +1 -0
  52. package/dist/deck/components/DeckImageGrid.d.ts +27 -0
  53. package/dist/deck/components/DeckImageGrid.d.ts.map +1 -0
  54. package/dist/deck/components/DeckRichText.d.ts +22 -0
  55. package/dist/deck/components/DeckRichText.d.ts.map +1 -0
  56. package/dist/deck/components/DeckVideo.d.ts +15 -0
  57. package/dist/deck/components/DeckVideo.d.ts.map +1 -0
  58. package/dist/deck/editing.d.ts +50 -0
  59. package/dist/deck/editing.d.ts.map +1 -0
  60. package/dist/deck/flip.d.ts +11 -0
  61. package/dist/deck/flip.d.ts.map +1 -0
  62. package/dist/deck/index.d.ts +24 -0
  63. package/dist/deck/index.d.ts.map +1 -0
  64. package/dist/deck/index.js +53 -0
  65. package/dist/deck/layouts/CenteredTextLayout.d.ts +12 -0
  66. package/dist/deck/layouts/CenteredTextLayout.d.ts.map +1 -0
  67. package/dist/deck/layouts/ColumnSplitLayout.d.ts +14 -0
  68. package/dist/deck/layouts/ColumnSplitLayout.d.ts.map +1 -0
  69. package/dist/deck/layouts/FullBleedImageLayout.d.ts +14 -0
  70. package/dist/deck/layouts/FullBleedImageLayout.d.ts.map +1 -0
  71. package/dist/deck/media.d.ts +33 -0
  72. package/dist/deck/media.d.ts.map +1 -0
  73. package/dist/deck/tokens.d.ts +22 -0
  74. package/dist/deck/tokens.d.ts.map +1 -0
  75. package/dist/deck/useStageScale.d.ts +10 -0
  76. package/dist/deck/useStageScale.d.ts.map +1 -0
  77. package/dist/deck-builder/DeckBuilderApp.d.ts +30 -0
  78. package/dist/deck-builder/DeckBuilderApp.d.ts.map +1 -0
  79. package/dist/deck-builder/DeckBuilderTopBar.d.ts +24 -0
  80. package/dist/deck-builder/DeckBuilderTopBar.d.ts.map +1 -0
  81. package/dist/deck-builder/DeckChatPanel.d.ts +45 -0
  82. package/dist/deck-builder/DeckChatPanel.d.ts.map +1 -0
  83. package/dist/deck-builder/DeckEditor.d.ts +37 -0
  84. package/dist/deck-builder/DeckEditor.d.ts.map +1 -0
  85. package/dist/deck-builder/DeckLibrary.d.ts +22 -0
  86. package/dist/deck-builder/DeckLibrary.d.ts.map +1 -0
  87. package/dist/deck-builder/DeckSlideSurface.d.ts +31 -0
  88. package/dist/deck-builder/DeckSlideSurface.d.ts.map +1 -0
  89. package/dist/deck-builder/deck-api.d.ts +76 -0
  90. package/dist/deck-builder/deck-api.d.ts.map +1 -0
  91. package/dist/deck-builder/deck-chat-client.d.ts +44 -0
  92. package/dist/deck-builder/deck-chat-client.d.ts.map +1 -0
  93. package/dist/deck-builder/deck-chat-history.d.ts +10 -0
  94. package/dist/deck-builder/deck-chat-history.d.ts.map +1 -0
  95. package/dist/deck-builder/index.d.ts +13 -0
  96. package/dist/deck-builder/index.d.ts.map +1 -0
  97. package/dist/deck-builder/index.js +1505 -0
  98. package/dist/deck-builder/starter-deck.d.ts +23 -0
  99. package/dist/deck-builder/starter-deck.d.ts.map +1 -0
  100. package/dist/deck-builder/types.d.ts +29 -0
  101. package/dist/deck-builder/types.d.ts.map +1 -0
  102. package/dist/deck-builder/useSortableSlide.d.ts +29 -0
  103. package/dist/deck-builder/useSortableSlide.d.ts.map +1 -0
  104. package/dist/index.js +70 -63
  105. package/dist/lib/deck-access.d.ts +86 -0
  106. package/dist/lib/deck-access.d.ts.map +1 -0
  107. package/dist/lib/deck-access.js +58 -0
  108. package/dist/lib/deck-dexie.d.ts +88 -0
  109. package/dist/lib/deck-dexie.d.ts.map +1 -0
  110. package/dist/lib/deck-dexie.js +22 -0
  111. package/dist/lib/deck-edit.d.ts +67 -0
  112. package/dist/lib/deck-edit.d.ts.map +1 -0
  113. package/dist/lib/deck-media-assets.d.ts +27 -0
  114. package/dist/lib/deck-media-assets.d.ts.map +1 -0
  115. package/dist/lib/deck-media-assets.js +25 -0
  116. package/dist/lib/deck-media-refs.d.ts +35 -0
  117. package/dist/lib/deck-media-refs.d.ts.map +1 -0
  118. package/dist/lib/deck-media-refs.js +36 -0
  119. package/dist/lib/deck-tool.d.ts +25 -0
  120. package/dist/lib/deck-tool.d.ts.map +1 -0
  121. package/dist/lib/deck-tool.js +58 -0
  122. package/dist/lib/index-ops.js +2 -2
  123. package/dist/lib/index.js +17 -12
  124. package/dist/lib/nav.d.ts.map +1 -1
  125. package/dist/media/index.js +3 -3
  126. package/dist/schemas/deck-meta.d.ts +85 -0
  127. package/dist/schemas/deck-meta.d.ts.map +1 -0
  128. package/dist/schemas/deck-meta.js +64 -0
  129. package/dist/schemas/deck.d.ts +954 -0
  130. package/dist/schemas/deck.d.ts.map +1 -0
  131. package/dist/schemas/deck.js +65 -0
  132. package/dist/schemas/index.js +39 -37
  133. package/dist/schemas/site-config.d.ts +13 -1
  134. package/dist/schemas/site-config.d.ts.map +1 -1
  135. package/package.json +37 -1
  136. package/src/components/chat/ChatComposer.tsx +100 -0
  137. package/src/components/chat/ChatPanel.tsx +20 -69
  138. package/src/components/chat/markdown.ts +32 -0
  139. package/src/components/primitives/EditablePlainText.tsx +11 -1
  140. package/src/components/shell/AudienceChips.tsx +30 -0
  141. package/src/components/shell/EditorShell.tsx +12 -0
  142. package/src/components/shell/SiteSettingsChatbot.tsx +1 -18
  143. package/src/components/shell/SiteSettingsDecks.tsx +41 -0
  144. package/src/components/shell/SiteSettingsModal.tsx +11 -0
  145. package/src/deck/DeckComponentView.tsx +28 -0
  146. package/src/deck/DeckPlayer.tsx +166 -0
  147. package/src/deck/DeckSlideView.tsx +38 -0
  148. package/src/deck/DeckStage.tsx +39 -0
  149. package/src/deck/components/DeckImage.tsx +38 -0
  150. package/src/deck/components/DeckImageGrid.tsx +254 -0
  151. package/src/deck/components/DeckRichText.tsx +111 -0
  152. package/src/deck/components/DeckVideo.tsx +81 -0
  153. package/src/deck/editing.tsx +201 -0
  154. package/src/deck/flip.ts +70 -0
  155. package/src/deck/index.ts +30 -0
  156. package/src/deck/layouts/CenteredTextLayout.tsx +29 -0
  157. package/src/deck/layouts/ColumnSplitLayout.tsx +69 -0
  158. package/src/deck/layouts/FullBleedImageLayout.tsx +58 -0
  159. package/src/deck/media.tsx +46 -0
  160. package/src/deck/tokens.ts +57 -0
  161. package/src/deck/useStageScale.ts +44 -0
  162. package/src/deck-builder/DeckBuilderApp.tsx +572 -0
  163. package/src/deck-builder/DeckBuilderTopBar.tsx +62 -0
  164. package/src/deck-builder/DeckChatPanel.tsx +334 -0
  165. package/src/deck-builder/DeckEditor.tsx +258 -0
  166. package/src/deck-builder/DeckLibrary.tsx +195 -0
  167. package/src/deck-builder/DeckSlideSurface.tsx +55 -0
  168. package/src/deck-builder/deck-api.ts +177 -0
  169. package/src/deck-builder/deck-chat-client.ts +129 -0
  170. package/src/deck-builder/deck-chat-history.ts +62 -0
  171. package/src/deck-builder/index.ts +12 -0
  172. package/src/deck-builder/starter-deck.ts +86 -0
  173. package/src/deck-builder/types.ts +24 -0
  174. package/src/deck-builder/useSortableSlide.ts +102 -0
  175. package/src/lib/deck-access.ts +132 -0
  176. package/src/lib/deck-dexie.ts +190 -0
  177. package/src/lib/deck-edit.ts +196 -0
  178. package/src/lib/deck-media-assets.ts +57 -0
  179. package/src/lib/deck-media-refs.ts +67 -0
  180. package/src/lib/deck-tool.ts +95 -0
  181. package/src/lib/nav.ts +21 -1
  182. package/src/schemas/deck-meta.ts +88 -0
  183. package/src/schemas/deck.ts +478 -0
  184. package/src/schemas/index.ts +4 -0
  185. package/src/schemas/site-config.ts +24 -1
@@ -0,0 +1,25 @@
1
+ import "../chunk-JSBRDJBE.js";
2
+
3
+ // src/lib/deck-media-assets.ts
4
+ function deckMediaAssets(manifest, sizes, provider, allowIds) {
5
+ const assets = {};
6
+ for (const [id, item] of Object.entries(manifest.images)) {
7
+ if (item.hidden) continue;
8
+ if (allowIds && !allowIds.has(id)) continue;
9
+ const resolved = provider.resolve(item, sizes);
10
+ if (!resolved) continue;
11
+ assets[id] = {
12
+ src: resolved.src,
13
+ alt: item.alt,
14
+ // The manifest always knows the intrinsic size, and supplying it is what
15
+ // lets the image grid reserve aspect-correct space before a byte loads.
16
+ width: resolved.width,
17
+ height: resolved.height,
18
+ ...resolved.tag === "video" && resolved.poster ? { poster: resolved.poster } : {}
19
+ };
20
+ }
21
+ return assets;
22
+ }
23
+ export {
24
+ deckMediaAssets
25
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Every portal media reference a deck makes, extracted from RAW deck JSON.
3
+ *
4
+ * Publish-time GC builds its keep-set from the site's manifests and deletes
5
+ * every other bucket object (ADR 0002's "GC must learn the decks branch"), so a
6
+ * deck referencing an asset the editor later removed from portal content would
7
+ * otherwise have its media deleted underneath it.
8
+ *
9
+ * Deliberately untyped and structural rather than a walk over `Deck`: the media
10
+ * reference union lands with the image/grid components (#31), and this has to
11
+ * work the day it does without a second change here. It matches the union's
12
+ * discriminator shape — `{ kind: "portal", id: string }` — wherever it appears
13
+ * in the tree, at any depth, in any component. Staying schema-free is also what
14
+ * keeps this module off the deck-schema carrier list (tests/deck/viewer-isolation).
15
+ */
16
+ /** One reference, with the path an author (or a model) can act on. */
17
+ export interface DeckMediaRefSite {
18
+ /** `slides[2].layout.media` — the ref object's own path, not its `id` field. */
19
+ path: string;
20
+ id: string;
21
+ }
22
+ export declare function deckMediaRefSites(deck: unknown): DeckMediaRefSite[];
23
+ export declare function deckMediaIds(deck: unknown): Set<string>;
24
+ /**
25
+ * Media references the catalog does not contain — the server-side half of media
26
+ * grounding (#35).
27
+ *
28
+ * The deck schema constrains a media id's CHARSET; only the catalog can say
29
+ * whether an id exists, so membership is checked here rather than in the schema
30
+ * (which is also read by the runtime, where no catalog is in hand). One line per
31
+ * offending reference, in the same `path: message` shape `formatDeckIssues`
32
+ * produces, so the authoring loop can hand both lists back in one tool_result.
33
+ */
34
+ export declare function deckUnknownMediaIssues(deck: unknown, catalogIds: ReadonlySet<string>): string[];
35
+ //# sourceMappingURL=deck-media-refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deck-media-refs.d.ts","sourceRoot":"","sources":["../../src/lib/deck-media-refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAgBnE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAEvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAO/F"}
@@ -0,0 +1,36 @@
1
+ import "../chunk-JSBRDJBE.js";
2
+
3
+ // src/lib/deck-media-refs.ts
4
+ function step(path, key) {
5
+ return path === "" ? key : `${path}.${key}`;
6
+ }
7
+ function deckMediaRefSites(deck) {
8
+ const sites = [];
9
+ const visit = (node, path) => {
10
+ if (Array.isArray(node)) {
11
+ node.forEach((item, i) => visit(item, `${path}[${i}]`));
12
+ return;
13
+ }
14
+ if (typeof node !== "object" || node === null) return;
15
+ const record = node;
16
+ if (record.kind === "portal" && typeof record.id === "string" && record.id !== "") {
17
+ sites.push({ path, id: record.id });
18
+ }
19
+ for (const [key, value] of Object.entries(record)) visit(value, step(path, key));
20
+ };
21
+ visit(deck, "");
22
+ return sites;
23
+ }
24
+ function deckMediaIds(deck) {
25
+ return new Set(deckMediaRefSites(deck).map((site) => site.id));
26
+ }
27
+ function deckUnknownMediaIssues(deck, catalogIds) {
28
+ return deckMediaRefSites(deck).filter((site) => !catalogIds.has(site.id)).map(
29
+ (site) => `${step(site.path, "id")}: "${site.id}" is not in the portal media catalog \u2014 use only the ids listed under "Media catalog", copied exactly.`
30
+ );
31
+ }
32
+ export {
33
+ deckMediaIds,
34
+ deckMediaRefSites,
35
+ deckUnknownMediaIssues
36
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The `update_deck` tool the deck-chat loop hands the model (#35, ADR 0001).
3
+ *
4
+ * The input schema is DERIVED from `DeckSchema` rather than written out, so the
5
+ * contract cannot drift from what the server will actually accept: every
6
+ * `.describe()` in the deck schema IS the LLM's documentation, and a field
7
+ * added there reaches the model on the next request with no second edit here.
8
+ *
9
+ * Emitted INLINE (zod's default `reused: "inline"`), not with `$defs`/`$ref`.
10
+ * The ref form is less than half the bytes, but names every shared node
11
+ * `__schema7`, which puts the layout and component descriptions an indirection
12
+ * away from the slot that uses them. The tool block sits in the cached prefix
13
+ * (tools precede `system`, and the corpus block carries the cache breakpoint),
14
+ * so the size is paid once per conversation while the legibility is paid on
15
+ * every turn.
16
+ */
17
+ export declare const UPDATE_DECK_TOOL_NAME = "update_deck";
18
+ export interface DeckToolDefinition {
19
+ name: string;
20
+ description: string;
21
+ /** JSON Schema; the tool's input IS the whole deck. */
22
+ input_schema: Record<string, unknown>;
23
+ }
24
+ export declare function updateDeckTool(): DeckToolDefinition;
25
+ //# sourceMappingURL=deck-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deck-tool.d.ts","sourceRoot":"","sources":["../../src/lib/deck-tool.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AA8CD,wBAAgB,cAAc,IAAI,kBAAkB,CAenD"}
@@ -0,0 +1,58 @@
1
+ import {
2
+ DECK_COMPONENT_TYPES,
3
+ DECK_LAYOUT_TYPES,
4
+ DECK_MAX_SLIDES,
5
+ DECK_SCHEMA_VERSION,
6
+ DeckSchema
7
+ } from "../chunk-VAYZJKVR.js";
8
+ import "../chunk-JSBRDJBE.js";
9
+
10
+ // src/lib/deck-tool.ts
11
+ import { z } from "zod";
12
+ var UPDATE_DECK_TOOL_NAME = "update_deck";
13
+ var VOCABULARY = [
14
+ `Layouts (a slide uses exactly one, and \`type\` must be one of these ${DECK_LAYOUT_TYPES.length}): ${DECK_LAYOUT_TYPES.map((t) => `\`${t}\``).join(", ")}.`,
15
+ "- `centeredText` \u2014 a title card. Slot: `content` (one Component). Optional `background`: `base` or `brand`.",
16
+ "- `fullBleedImage` \u2014 the image IS the slide. Takes `media` directly, plus an optional `overlay` panel whose `content` must be a `richText` Component. It has no other slots.",
17
+ "- `columnSplit` \u2014 two slots, `left` and `right`, each one Component, at a `ratio` of `1-2` or `2-1`.",
18
+ "",
19
+ `Components (what fills a Layout slot; \`type\` must be one of these ${DECK_COMPONENT_TYPES.length}): ${DECK_COMPONENT_TYPES.map((t) => `\`${t}\``).join(", ")}.`,
20
+ "- `richText` \u2014 kicker / heading / subheading / paragraphs / bullets. Text only; no media.",
21
+ "- `image` \u2014 one `media` reference and an optional caption.",
22
+ "- `imageGrid` \u2014 two to twelve `items`, each with its own `media`.",
23
+ "- `video` \u2014 one `media` reference.",
24
+ "",
25
+ "There is nothing else. A `type` outside those lists is rejected, and so is a slot a Layout does not have \u2014 do not invent `body`, `columns`, `slots` or `children`."
26
+ ].join("\n");
27
+ var DESCRIPTION = [
28
+ "Replace the ENTIRE deck with a new version. This is how every change to the deck is made \u2014 adding a slide, rewriting a line, reordering, or building the deck from nothing.",
29
+ "",
30
+ VOCABULARY,
31
+ "",
32
+ "Rules:",
33
+ "- Emit the COMPLETE deck every time, including slides you are not changing. There is no patch or partial form: whatever you send becomes the deck, and anything you leave out is deleted.",
34
+ `- Keep \`id\` exactly as it is in the current deck, and keep \`schemaVersion\` at ${DECK_SCHEMA_VERSION}.`,
35
+ "- Reuse a slide's existing `id` when that slide survives the edit, so revisions stay diffable. Give a genuinely new slide a new lowercase-hyphen id that no other slide uses.",
36
+ "- Every `media` reference must be a portal media id copied exactly from the Media catalog in your instructions. Never invent one, and never use a filename, path or URL.",
37
+ `- At most ${DECK_MAX_SLIDES} slides.`,
38
+ "",
39
+ "Say what you changed in your reply text; do not restate the deck JSON there."
40
+ ].join("\n");
41
+ function updateDeckTool() {
42
+ const schema = z.toJSONSchema(DeckSchema, {
43
+ // `io: "input"` is what makes fields with defaults optional — under
44
+ // "output" the model would be told `background` is required. `unrepresentable
45
+ // : "any"` is for the superRefines (duplicate slide ids, the "a richText
46
+ // needs some content" rule); they are enforced server-side by parseDeck,
47
+ // and their messages are what a failed turn gets handed back.
48
+ target: "draft-2020-12",
49
+ io: "input",
50
+ unrepresentable: "any"
51
+ });
52
+ delete schema.$schema;
53
+ return { name: UPDATE_DECK_TOOL_NAME, description: DESCRIPTION, input_schema: schema };
54
+ }
55
+ export {
56
+ UPDATE_DECK_TOOL_NAME,
57
+ updateDeckTool
58
+ };
@@ -11,13 +11,13 @@ import {
11
11
  setGroupStartCollapsed,
12
12
  slugifyPageSlug,
13
13
  uniquePageSlug
14
- } from "../chunk-OTDA6KWL.js";
14
+ } from "../chunk-VLPELTPI.js";
15
15
  import {
16
16
  IndexSchema,
17
17
  PageStatusSchema,
18
18
  RESERVED_SLUGS,
19
19
  SLUG_RE
20
- } from "../chunk-UVIYI4J6.js";
20
+ } from "../chunk-HSXMOS5Q.js";
21
21
  import "../chunk-4TZJZU2T.js";
22
22
  import "../chunk-GGXZZ77Z.js";
23
23
  import "../chunk-JSBRDJBE.js";
package/dist/lib/index.js CHANGED
@@ -5,7 +5,6 @@ import {
5
5
  contrastColor,
6
6
  contrastRatio,
7
7
  deriveContrast,
8
- formatTimestamp,
9
8
  gridColsClass,
10
9
  loadSiteContent,
11
10
  loadStaticSiteContent,
@@ -18,8 +17,11 @@ import {
18
17
  safeRedirect,
19
18
  suggestAccessibleOn,
20
19
  wcagLevel
21
- } from "../chunk-VCCNKTFD.js";
20
+ } from "../chunk-OGGZ5AXT.js";
22
21
  import "../chunk-FRVO75DK.js";
22
+ import {
23
+ formatTimestamp
24
+ } from "../chunk-MM7KZS5C.js";
23
25
  import {
24
26
  curatedIcons,
25
27
  getIcon
@@ -31,18 +33,17 @@ import {
31
33
  navChangeEvent
32
34
  } from "../chunk-4RNF2DRG.js";
33
35
  import {
34
- ensureSanitizer,
35
36
  generateNavLinks,
36
- sanitizeHtml,
37
37
  toSectionId
38
- } from "../chunk-RA5IOFPY.js";
38
+ } from "../chunk-DNY72JZN.js";
39
+ import "../chunk-CXZ5YJG4.js";
40
+ import {
41
+ ensureSanitizer,
42
+ sanitizeHtml
43
+ } from "../chunk-QQ3S3P5P.js";
39
44
  import {
40
45
  cn
41
46
  } from "../chunk-7EOSDFS3.js";
42
- import "../chunk-S2L3BPLS.js";
43
- import {
44
- env
45
- } from "../chunk-WKZ7OENC.js";
46
47
  import {
47
48
  audiencePasses,
48
49
  groupDisplayLabel,
@@ -50,9 +51,15 @@ import {
50
51
  navEntries,
51
52
  pagesInNavOrder,
52
53
  reconcileNav
53
- } from "../chunk-OTDA6KWL.js";
54
+ } from "../chunk-VLPELTPI.js";
55
+ import "../chunk-S2L3BPLS.js";
56
+ import {
57
+ env
58
+ } from "../chunk-WKZ7OENC.js";
54
59
  import "../chunk-REDDTTGJ.js";
55
60
  import "../chunk-DMCGN5AS.js";
61
+ import "../chunk-HSXMOS5Q.js";
62
+ import "../chunk-4TZJZU2T.js";
56
63
  import {
57
64
  clearRegistry,
58
65
  createRegistry,
@@ -64,8 +71,6 @@ import {
64
71
  registerSchema,
65
72
  registerSection
66
73
  } from "../chunk-FTPETWXE.js";
67
- import "../chunk-UVIYI4J6.js";
68
- import "../chunk-4TZJZU2T.js";
69
74
  import "../chunk-GGXZZ77Z.js";
70
75
  import "../chunk-NSCT3AMV.js";
71
76
  import "../chunk-JSBRDJBE.js";
@@ -1 +1 @@
1
- {"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../src/lib/nav.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAG9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;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,15 @@ import {
18
18
  resolveMedia,
19
19
  sanitizeMediaName,
20
20
  setMediaProvider
21
- } from "../chunk-XQMDWXD6.js";
22
- import "../chunk-OTDA6KWL.js";
21
+ } from "../chunk-P3ZNCHW7.js";
22
+ import "../chunk-VLPELTPI.js";
23
23
  import {
24
24
  ImageManifestSchema,
25
25
  MediaConfigSchema,
26
26
  MediaFolderSchema,
27
27
  MediaItemSchema,
28
28
  VariantSchema
29
- } from "../chunk-UVIYI4J6.js";
29
+ } from "../chunk-HSXMOS5Q.js";
30
30
  import "../chunk-4TZJZU2T.js";
31
31
  import "../chunk-GGXZZ77Z.js";
32
32
  import "../chunk-JSBRDJBE.js";
@@ -0,0 +1,85 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * `decks/{deckId}/meta.json` — the sidecar beside a published deck on the
4
+ * Decks Branch (ADR 0002). It carries everything a listing needs, so the list
5
+ * route never reads a single `deck.json`.
6
+ *
7
+ * Ownership is dual-identity from day one (feasibility decision 9): a viewer
8
+ * credential, an editor session, or — on env-mode standalone portals, which
9
+ * have no named credentials — the audience alone. Retrofitting that later
10
+ * would mean rewriting every deck's meta.
11
+ */
12
+ /** Bumped when the sidecar's shape changes in a way old readers can't parse. */
13
+ export declare const DECK_META_SCHEMA_VERSION = 1;
14
+ /**
15
+ * Who owns a deck. `viewer` is the normal case (ownership is credential-keyed);
16
+ * `editor` covers a deck an agency editor built; `audience` is the env-mode
17
+ * standalone degradation, where a shared per-audience password means there is
18
+ * no person to attribute to.
19
+ */
20
+ export declare const DeckOwnerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ kind: z.ZodLiteral<"viewer">;
22
+ username: z.ZodString;
23
+ audience: z.ZodString;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ kind: z.ZodLiteral<"editor">;
26
+ userId: z.ZodString;
27
+ }, z.core.$strip>, z.ZodObject<{
28
+ kind: z.ZodLiteral<"audience">;
29
+ audience: z.ZodString;
30
+ }, z.core.$strip>], "kind">;
31
+ /**
32
+ * Deliberately a LOOSE object: grants and the Public Link token land in later
33
+ * tickets (#36/#37), and a portal running an older package version must not
34
+ * silently strip fields it doesn't know when it rewrites this file. This is the
35
+ * same failure mode the nav sidecar exists to avoid — with unknown keys
36
+ * preserved, an old writer round-trips them instead of deleting them.
37
+ */
38
+ export declare const DeckMetaSchema: z.ZodObject<{
39
+ schemaVersion: z.ZodLiteral<1>;
40
+ id: z.ZodString;
41
+ /** Mirrors deck.title so a listing needs no deck body. */
42
+ title: z.ZodString;
43
+ /** Mirrors deck.slides.length, for the same reason. */
44
+ slideCount: z.ZodNumber;
45
+ owner: z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ kind: z.ZodLiteral<"viewer">;
47
+ username: z.ZodString;
48
+ audience: z.ZodString;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ kind: z.ZodLiteral<"editor">;
51
+ userId: z.ZodString;
52
+ }, z.core.$strip>, z.ZodObject<{
53
+ kind: z.ZodLiteral<"audience">;
54
+ audience: z.ZodString;
55
+ }, z.core.$strip>], "kind">;
56
+ createdAt: z.ZodISODateTime;
57
+ updatedAt: z.ZodISODateTime;
58
+ /**
59
+ * Bucket hashes this deck's media resolved to when it was published, and the
60
+ * whole reason publish-time GC can protect them (ADR 0002).
61
+ *
62
+ * A deck references media by MANIFEST ID, and an id is only resolvable to a
63
+ * bucket hash while the manifest still carries the entry — which is exactly
64
+ * what stops being true in the case the keep-set exists for: the editor
65
+ * removes the media from the library, the entry goes, and the object then
66
+ * looks unreferenced to every reader. Resolving at publish time and recording
67
+ * the answer here is what survives that. Absent when the deck references no
68
+ * bucket-backed media, which is every deck until the media components land.
69
+ */
70
+ assetHashes: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
+ }, z.core.$loose>;
72
+ export type DeckOwner = z.infer<typeof DeckOwnerSchema>;
73
+ export type DeckMeta = z.infer<typeof DeckMetaSchema>;
74
+ export type DeckMetaParseResult = {
75
+ ok: true;
76
+ meta: DeckMeta;
77
+ } | {
78
+ ok: false;
79
+ errors: string[];
80
+ };
81
+ /** Parse an untrusted meta sidecar, reporting every problem at once. */
82
+ export declare function parseDeckMeta(input: unknown): DeckMetaParseResult;
83
+ /** Pretty-printed with a trailing newline, matching every other repo-stored JSON. */
84
+ export declare function serializeDeckMeta(meta: DeckMeta): string;
85
+ //# sourceMappingURL=deck-meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deck-meta.d.ts","sourceRoot":"","sources":["../../src/schemas/deck-meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;GASG;AAEH,gFAAgF;AAChF,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;2BAgB1B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;IAGzB,0DAA0D;;IAE1D,uDAAuD;;;;;;;;;;;;;;;IAKvD;;;;;;;;;;;OAWG;;iBAEH,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEjG,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAGjE;AAED,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAExD"}
@@ -0,0 +1,64 @@
1
+ import {
2
+ DeckIdSchema,
3
+ formatDeckIssues
4
+ } from "../chunk-VAYZJKVR.js";
5
+ import "../chunk-JSBRDJBE.js";
6
+
7
+ // src/schemas/deck-meta.ts
8
+ import { z } from "zod";
9
+ var DECK_META_SCHEMA_VERSION = 1;
10
+ var DeckOwnerSchema = z.discriminatedUnion("kind", [
11
+ z.object({
12
+ kind: z.literal("viewer"),
13
+ /** The `viewer_credentials` username — the person-level key. */
14
+ username: z.string().min(1).max(200),
15
+ /** The audience that credential signed in as, for editor-side context. */
16
+ audience: z.string().min(1).max(200)
17
+ }),
18
+ z.object({
19
+ kind: z.literal("editor"),
20
+ userId: z.string().min(1).max(200)
21
+ }),
22
+ z.object({
23
+ kind: z.literal("audience"),
24
+ audience: z.string().min(1).max(200)
25
+ })
26
+ ]);
27
+ var DeckMetaSchema = z.looseObject({
28
+ schemaVersion: z.literal(DECK_META_SCHEMA_VERSION),
29
+ id: DeckIdSchema,
30
+ /** Mirrors deck.title so a listing needs no deck body. */
31
+ title: z.string().min(1).max(120),
32
+ /** Mirrors deck.slides.length, for the same reason. */
33
+ slideCount: z.number().int().min(1),
34
+ owner: DeckOwnerSchema,
35
+ createdAt: z.iso.datetime(),
36
+ updatedAt: z.iso.datetime(),
37
+ /**
38
+ * Bucket hashes this deck's media resolved to when it was published, and the
39
+ * whole reason publish-time GC can protect them (ADR 0002).
40
+ *
41
+ * A deck references media by MANIFEST ID, and an id is only resolvable to a
42
+ * bucket hash while the manifest still carries the entry — which is exactly
43
+ * what stops being true in the case the keep-set exists for: the editor
44
+ * removes the media from the library, the entry goes, and the object then
45
+ * looks unreferenced to every reader. Resolving at publish time and recording
46
+ * the answer here is what survives that. Absent when the deck references no
47
+ * bucket-backed media, which is every deck until the media components land.
48
+ */
49
+ assetHashes: z.array(z.string().min(1)).optional()
50
+ });
51
+ function parseDeckMeta(input) {
52
+ const result = DeckMetaSchema.safeParse(input);
53
+ return result.success ? { ok: true, meta: result.data } : { ok: false, errors: formatDeckIssues(result.error) };
54
+ }
55
+ function serializeDeckMeta(meta) {
56
+ return JSON.stringify(meta, null, 2) + "\n";
57
+ }
58
+ export {
59
+ DECK_META_SCHEMA_VERSION,
60
+ DeckMetaSchema,
61
+ DeckOwnerSchema,
62
+ parseDeckMeta,
63
+ serializeDeckMeta
64
+ };