@lemonriver/core 0.1.1 → 0.3.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.
Files changed (161) hide show
  1. package/dist/{build-f-fM2ZY4.js → build-Bqo69DWP.js} +1 -1
  2. package/dist/cli/bin.js +4 -4
  3. package/dist/{config-DO45GU3e.js → config-DJ5rkMMg.js} +3123 -523
  4. package/dist/{config-B6JaKJM4.d.ts → config-teo3kWz7.d.ts} +6 -2
  5. package/dist/{dev-CqS2xpgE.js → dev-B2FJD5bJ.js} +2 -2
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +4 -3
  8. package/dist/locale/index.d.ts +5 -2
  9. package/dist/locale/index.js +2 -2
  10. package/dist/{preview-BihgMlEl.js → preview-C93BOZL1.js} +1 -1
  11. package/dist/{types-BjW4glip.d.ts → types-DFK02XVv.d.ts} +120 -27
  12. package/dist/{update-C_R0ycVC.js → update-DsxZBtwv.js} +154 -90
  13. package/dist/vite/index.d.ts +1 -1
  14. package/dist/vite/index.js +1 -1
  15. package/dist/{zh-tw-Ci0jK8eg.js → zh-tw-DwTAZKa6.js} +1091 -104
  16. package/package.json +13 -6
  17. package/skills/apply-comments/SKILL.md +10 -6
  18. package/skills/create-slide/SKILL.md +2 -0
  19. package/skills/current-slide/SKILL.md +1 -0
  20. package/skills/slide-authoring/SKILL.md +31 -1
  21. package/src/agent/prompt.ts +141 -0
  22. package/src/agent/provider.ts +123 -0
  23. package/src/agent/types.ts +151 -0
  24. package/src/app/app.tsx +7 -18
  25. package/src/app/assets/open-slide.svg +39 -0
  26. package/src/app/components/agent/agent-dock.tsx +35 -0
  27. package/src/app/components/agent/agent-markdown.tsx +45 -0
  28. package/src/app/components/agent/agent-panel.tsx +695 -0
  29. package/src/app/components/agent/agent-presence.tsx +74 -0
  30. package/src/app/components/agent/composer.tsx +120 -0
  31. package/src/app/components/agent/connect-view.tsx +184 -0
  32. package/src/app/components/agent/history-view.tsx +136 -0
  33. package/src/app/components/agent/provider-logo.tsx +34 -0
  34. package/src/app/components/agent/transcript.tsx +620 -0
  35. package/src/app/components/asset-view.tsx +6 -6
  36. package/src/app/components/command/command-menu.tsx +2 -1
  37. package/src/app/components/command/slide-command-menu.tsx +10 -0
  38. package/src/app/components/icon-switcher-indicator.tsx +1 -1
  39. package/src/app/components/inspector/asset-picker-dialog.tsx +7 -5
  40. package/src/app/components/inspector/comment-layer.tsx +1012 -0
  41. package/src/app/components/inspector/image-crop-dialog.tsx +1 -5
  42. package/src/app/components/inspector/inspect-overlay.tsx +2 -39
  43. package/src/app/components/inspector/inspector-panel.tsx +12 -95
  44. package/src/app/components/inspector/inspector-provider.tsx +121 -47
  45. package/src/app/components/panel/editor-sidebar.tsx +85 -16
  46. package/src/app/components/panel/panel-shell.tsx +2 -2
  47. package/src/app/components/panel/resize-handle.tsx +129 -0
  48. package/src/app/components/player.tsx +0 -1
  49. package/src/app/components/preview-step-host.tsx +16 -0
  50. package/src/app/components/sidebar/sidebar-footer.tsx +1 -1
  51. package/src/app/components/sidebar/sidebar.tsx +4 -3
  52. package/src/app/components/style-panel/style-panel.tsx +3 -2
  53. package/src/app/components/themes/theme-detail.tsx +4 -2
  54. package/src/app/components/thumbnail-rail.tsx +77 -29
  55. package/src/app/favicon.ico +0 -0
  56. package/src/app/favicon.svg +39 -0
  57. package/src/app/index.html +2 -1
  58. package/src/app/lemonriver/agent/lemon.tsx +64 -0
  59. package/src/app/{components → lemonriver}/board/board-canvas.tsx +154 -23
  60. package/src/app/{routes/board.tsx → lemonriver/board/board-page.tsx} +63 -25
  61. package/src/app/{components → lemonriver}/board/board.css +51 -0
  62. package/src/app/{components → lemonriver}/board/layout.test.ts +53 -1
  63. package/src/app/{components → lemonriver}/board/layout.ts +51 -3
  64. package/src/app/lemonriver/board/model/cards.test.ts +239 -0
  65. package/src/app/lemonriver/board/model/cards.ts +234 -0
  66. package/src/app/lemonriver/board/model/structure.test.ts +101 -0
  67. package/src/app/lemonriver/board/model/structure.ts +82 -0
  68. package/src/app/lemonriver/board/page-node.tsx +481 -0
  69. package/src/app/lemonriver/board/use-board-cards.ts +210 -0
  70. package/src/app/{components → lemonriver}/board/use-board-columns.ts +7 -7
  71. package/src/app/{components → lemonriver}/board/use-page-order.ts +27 -15
  72. package/src/app/lemonriver/brand/app-icon.svg +44 -0
  73. package/src/app/lemonriver/brand/apple-touch-icon.png +0 -0
  74. package/src/app/lemonriver/brand/favicon-32.png +0 -0
  75. package/src/app/lemonriver/brand/mascot.tsx +59 -0
  76. package/src/app/lemonriver/brand/mascots/lemon-done.png +0 -0
  77. package/src/app/lemonriver/brand/mascots/lemon-idle.png +0 -0
  78. package/src/app/lemonriver/brand/mascots/lemon-needs-you.png +0 -0
  79. package/src/app/lemonriver/brand/mascots/lemon-thinking.png +0 -0
  80. package/src/app/lemonriver/brand/mascots/lemon-working.png +0 -0
  81. package/src/app/lemonriver/chrome/app-chrome.tsx +99 -0
  82. package/src/app/lemonriver/chrome/nav-row.tsx +34 -0
  83. package/src/app/lemonriver/chrome/not-found.tsx +34 -0
  84. package/src/app/lemonriver/chrome/sidebar-extras.tsx +57 -0
  85. package/src/app/lemonriver/chrome/use-slot.ts +23 -0
  86. package/src/app/lemonriver/features.test.ts +29 -0
  87. package/src/app/lemonriver/features.ts +26 -0
  88. package/src/app/lemonriver/feedback/export.ts +7 -0
  89. package/src/app/lemonriver/feedback/lemon-empty.tsx +54 -0
  90. package/src/app/lemonriver/feedback/offline-banner.tsx +41 -0
  91. package/src/app/lemonriver/feedback/pending-toast.test.ts +44 -0
  92. package/src/app/lemonriver/feedback/pending-toast.ts +39 -0
  93. package/src/app/lemonriver/feedback/toaster.tsx +34 -0
  94. package/src/app/lemonriver/feedback/upload.test.ts +26 -0
  95. package/src/app/lemonriver/feedback/upload.ts +19 -0
  96. package/src/app/lemonriver/home/brief-card.tsx +63 -0
  97. package/src/app/lemonriver/home/brief.test.ts +38 -0
  98. package/src/app/lemonriver/home/brief.ts +34 -0
  99. package/src/app/lemonriver/home/controls.tsx +93 -0
  100. package/src/app/lemonriver/home/deck-card.tsx +183 -0
  101. package/src/app/lemonriver/home/dialogs.tsx +292 -0
  102. package/src/app/lemonriver/home/home-page.tsx +335 -0
  103. package/src/app/lemonriver/home/sorting.test.ts +24 -0
  104. package/src/app/lemonriver/home/sorting.ts +59 -0
  105. package/src/app/lemonriver/home/time.test.ts +33 -0
  106. package/src/app/lemonriver/home/time.ts +33 -0
  107. package/src/app/lemonriver/home/use-deck-times.ts +27 -0
  108. package/src/app/lemonriver/home/use-delayed.ts +15 -0
  109. package/src/app/lemonriver/routes.test.tsx +37 -0
  110. package/src/app/lemonriver/routes.tsx +38 -0
  111. package/src/app/lemonriver/settings/settings-page.tsx +103 -0
  112. package/src/app/lemonriver/slide-extensions.tsx +73 -0
  113. package/src/app/lemonriver/text/all.ts +19 -0
  114. package/src/app/lemonriver/text/en.ts +106 -0
  115. package/src/app/lemonriver/text/es.ts +108 -0
  116. package/src/app/lemonriver/text/index.ts +9 -0
  117. package/src/app/lemonriver/text/ja.ts +106 -0
  118. package/src/app/lemonriver/text/text.test.ts +57 -0
  119. package/src/app/lemonriver/text/types.ts +111 -0
  120. package/src/app/lemonriver/text/zh-cn.ts +101 -0
  121. package/src/app/lemonriver/text/zh-tw.ts +101 -0
  122. package/src/app/lemonriver/theme/app.css +288 -0
  123. package/src/app/lemonriver/theme/controls.css +463 -0
  124. package/src/app/lemonriver/theme/index.css +3 -0
  125. package/src/app/lemonriver/theme/motion.ts +52 -0
  126. package/src/app/lemonriver/theme/pages.test.ts +66 -0
  127. package/src/app/lemonriver/theme/pages.ts +56 -0
  128. package/src/app/lemonriver/theme/theme-menu.tsx +64 -0
  129. package/src/app/lemonriver/theme/themes.test.ts +18 -0
  130. package/src/app/lemonriver/theme/themes.ts +16 -0
  131. package/src/app/lemonriver/theme/tokens.css +226 -0
  132. package/src/app/lemonriver/theme/use-theme.tsx +49 -0
  133. package/src/app/lemonriver/trash/api.test.ts +19 -0
  134. package/src/app/lemonriver/trash/api.ts +77 -0
  135. package/src/app/lemonriver/trash/trash-page.tsx +131 -0
  136. package/src/app/lib/agent/use-agent.ts +543 -0
  137. package/src/app/lib/inspector/freeze-motion.ts +61 -0
  138. package/src/app/lib/inspector/use-comments.ts +32 -3
  139. package/src/app/lib/locale-store.ts +6 -1
  140. package/src/app/lib/pptx/raster.ts +1 -1
  141. package/src/app/lib/print-ready.ts +9 -6
  142. package/src/app/lib/use-auto-grow.ts +15 -0
  143. package/src/app/lib/utils.ts +4 -0
  144. package/src/app/main.tsx +8 -1
  145. package/src/app/routes/home-shell.tsx +4 -2
  146. package/src/app/routes/home.tsx +43 -7
  147. package/src/app/routes/presenter.tsx +1 -16
  148. package/src/app/routes/preview.tsx +169 -0
  149. package/src/app/routes/slide.tsx +232 -188
  150. package/src/app/styles.css +235 -80
  151. package/src/editing/placeholder-id.ts +1 -0
  152. package/src/locale/en.ts +113 -26
  153. package/src/locale/es.ts +658 -0
  154. package/src/locale/index.ts +1 -0
  155. package/src/locale/ja.ts +106 -26
  156. package/src/locale/types.ts +119 -28
  157. package/src/locale/zh-cn.ts +106 -28
  158. package/src/locale/zh-tw.ts +106 -28
  159. package/src/app/assets/open-slide.png +0 -0
  160. package/src/app/components/board/page-node.tsx +0 -204
  161. package/src/app/components/inspector/comment-widget.tsx +0 -119
@@ -1,10 +1,13 @@
1
- import { t as Locale } from "./types-BjW4glip.js";
1
+ import { t as Locale } from "./types-DFK02XVv.js";
2
2
  //#region src/config.d.ts
3
3
  type LemonRiverBuildConfig = {
4
4
  showSlideBrowser?: boolean;
5
5
  showSlideUi?: boolean;
6
6
  allowHtmlDownload?: boolean;
7
7
  };
8
+ type LemonRiverAgentConfig = {
9
+ enabled?: boolean;
10
+ };
8
11
  type LemonRiverConfig = {
9
12
  base?: string;
10
13
  slidesDir?: string;
@@ -19,8 +22,9 @@ type LemonRiverConfig = {
19
22
  */
20
23
  locale?: Locale;
21
24
  build?: LemonRiverBuildConfig;
25
+ agent?: LemonRiverAgentConfig;
22
26
  };
23
27
  /** @deprecated Renamed to {@link LemonRiverConfig}; kept for config files written before the rename. */
24
28
  type OpenSlideConfig = LemonRiverConfig;
25
29
  //#endregion
26
- export { LemonRiverConfig as n, OpenSlideConfig as r, LemonRiverBuildConfig as t };
30
+ export { OpenSlideConfig as i, LemonRiverBuildConfig as n, LemonRiverConfig as r, LemonRiverAgentConfig as t };
@@ -1,6 +1,6 @@
1
- import { F as PKG_NAMES } from "./update-C_R0ycVC.js";
1
+ import { V as PKG_NAMES } from "./update-DsxZBtwv.js";
2
2
  import { a as printUrls, i as printShortcutsHint, n as formatError, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
3
- import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-DO45GU3e.js";
3
+ import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-DJ5rkMMg.js";
4
4
  import path from "node:path";
5
5
  import { existsSync } from "node:fs";
6
6
  import { fork } from "node:child_process";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as Plural, t as Locale } from "./types-BjW4glip.js";
2
- import { n as LemonRiverConfig, r as OpenSlideConfig, t as LemonRiverBuildConfig } from "./config-B6JaKJM4.js";
1
+ import { n as Plural, t as Locale } from "./types-DFK02XVv.js";
2
+ import { i as OpenSlideConfig, n as LemonRiverBuildConfig, r as LemonRiverConfig, t as LemonRiverAgentConfig } from "./config-teo3kWz7.js";
3
3
  import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
4
4
  //#region src/app/components/image-placeholder.d.ts
5
5
  type ImagePlaceholderProps = {
@@ -103,4 +103,4 @@ type InternalStepProps = StepProps & {
103
103
  };
104
104
  declare function Step({ children, duration, _revealed }: InternalStepProps): import("react").JSX.Element;
105
105
  //#endregion
106
- export { CANVAS_HEIGHT, CANVAS_WIDTH, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, ImagePlaceholder, type ImagePlaceholderProps, type LemonRiverBuildConfig, type LemonRiverConfig, type Locale, MorphElement, type MorphElementProps, type MorphTransition, type OpenSlideConfig, type Page, type Plural, type SlideMeta, type SlideModule, type SlideTransition, Step, type StepProps, Steps, type StepsProps, type TransitionPhase, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
106
+ export { CANVAS_HEIGHT, CANVAS_WIDTH, type DesignFonts, type DesignPalette, type DesignSystem, type DesignTypeScale, ImagePlaceholder, type ImagePlaceholderProps, type LemonRiverAgentConfig, type LemonRiverBuildConfig, type LemonRiverConfig, type Locale, MorphElement, type MorphElementProps, type MorphTransition, type OpenSlideConfig, type Page, type Plural, type SlideMeta, type SlideModule, type SlideTransition, Step, type StepProps, Steps, type StepsProps, type TransitionPhase, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as en, n as zhCN, r as ja, t as zhTW } from "./zh-tw-Ci0jK8eg.js";
1
+ import { a as en, i as es, n as zhCN, r as ja, t as zhTW } from "./zh-tw-DwTAZKa6.js";
2
2
  import { n as defaultDesign, r as designToCssVars, t as cssVarsToString } from "./design-Cpqx7SJs.js";
3
3
  import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { toast } from "sonner";
@@ -85,12 +85,13 @@ const LOCALES = {
85
85
  en,
86
86
  "zh-TW": zhTW,
87
87
  "zh-CN": zhCN,
88
- ja
88
+ ja,
89
+ es
89
90
  };
90
91
  const STORAGE_KEY = "open-slide:locale";
91
92
  const configLocale = config.locale;
92
93
  function isLocaleId(value) {
93
- return value === "en" || value === "zh-TW" || value === "zh-CN" || value === "ja";
94
+ return value === "en" || value === "zh-TW" || value === "zh-CN" || value === "ja" || value === "es";
94
95
  }
95
96
  function readStored() {
96
97
  try {
@@ -1,7 +1,10 @@
1
- import { n as Plural, t as Locale } from "../types-BjW4glip.js";
1
+ import { n as Plural, t as Locale } from "../types-DFK02XVv.js";
2
2
  //#region src/locale/en.d.ts
3
3
  declare const en: Locale;
4
4
  //#endregion
5
+ //#region src/locale/es.d.ts
6
+ declare const es: Locale;
7
+ //#endregion
5
8
  //#region src/locale/format.d.ts
6
9
  declare function format(template: string, vars: Record<string, string | number>): string;
7
10
  declare function plural(count: number, forms: Plural): string;
@@ -15,4 +18,4 @@ declare const zhCN: Locale;
15
18
  //#region src/locale/zh-tw.d.ts
16
19
  declare const zhTW: Locale;
17
20
  //#endregion
18
- export { type Locale, type Plural, en, format, ja, plural, zhCN, zhTW };
21
+ export { type Locale, type Plural, en, es, format, ja, plural, zhCN, zhTW };
@@ -1,4 +1,4 @@
1
- import { i as en, n as zhCN, r as ja, t as zhTW } from "../zh-tw-Ci0jK8eg.js";
1
+ import { a as en, i as es, n as zhCN, r as ja, t as zhTW } from "../zh-tw-DwTAZKa6.js";
2
2
  //#region src/locale/format.ts
3
3
  function format(template, vars) {
4
4
  return template.replace(/\{(\w+)\}/g, (m, key) => {
@@ -10,4 +10,4 @@ function plural(count, forms) {
10
10
  return count === 1 ? forms.one : forms.other;
11
11
  }
12
12
  //#endregion
13
- export { en, format, ja, plural, zhCN, zhTW };
13
+ export { en, es, format, ja, plural, zhCN, zhTW };
@@ -1,5 +1,5 @@
1
1
  import { a as printUrls, i as printShortcutsHint, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
2
- import { t as createViteConfig } from "./config-DO45GU3e.js";
2
+ import { t as createViteConfig } from "./config-DJ5rkMMg.js";
3
3
  import { mergeConfig, preview as preview$1 } from "vite";
4
4
  //#region src/cli/preview.ts
5
5
  async function preview(opts = {}) {
@@ -1,10 +1,14 @@
1
+ //#region src/agent/types.d.ts
2
+ declare const AGENT_EFFORTS: readonly ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
3
+ type AgentEffort = (typeof AGENT_EFFORTS)[number];
4
+ //#endregion
1
5
  //#region src/locale/types.d.ts
2
6
  type Plural = {
3
7
  one: string;
4
8
  other: string;
5
9
  };
6
10
  type Locale = {
7
- id: 'en' | 'zh-TW' | 'zh-CN' | 'ja';
11
+ id: 'en' | 'zh-TW' | 'zh-CN' | 'ja' | 'es';
8
12
  common: {
9
13
  cancel: string;
10
14
  save: string;
@@ -99,6 +103,7 @@ type Locale = {
99
103
  pickIcon: string;
100
104
  };
101
105
  slide: {
106
+ resizeSidePanel: string;
102
107
  home: string;
103
108
  backToHome: string;
104
109
  agentConnected: string;
@@ -283,20 +288,25 @@ type Locale = {
283
288
  cropFitCover: string;
284
289
  cropFitContain: string;
285
290
  cropApply: string;
286
- leaveComment: string;
291
+ commentMode: string;
287
292
  commentPlaceholder: string;
288
- commentShortcutHint: string;
289
- addComment: string;
293
+ commentPost: string;
290
294
  /** templates: "{count} unsaved change" / "{count} unsaved changes" */
291
295
  unsavedChanges: Plural;
292
296
  /** templates: "{count} comment" / "{count} comments" */
293
297
  commentsCount: Plural;
294
298
  /** template: "line {n}" */
295
299
  commentLineLabel: string;
296
- commentsEmpty: string;
300
+ commentRegionLabel: string;
301
+ commentEmptyHint: string;
297
302
  commentsApplyHintPrefix: string;
298
303
  commentsApplyHintSuffix: string;
299
304
  commentDeleteAria: string;
305
+ /** Prefix for the toast shown when a comment edit fails to write to disk. */
306
+ commentUpdateFailed: string;
307
+ /** Prefix for the toast shown when a comment fails to write to disk. */
308
+ commentAddFailed: string;
309
+ commentRegionNoTarget: string;
300
310
  /** Prefix for the toast shown when one or more buffered edits fail to write to disk. */
301
311
  saveFailed: string;
302
312
  decreaseFontSize: string;
@@ -466,28 +476,6 @@ type Locale = {
466
476
  /** template: "Scroll down to current page {n}" */
467
477
  scrollDownToCurrentPage: string;
468
478
  };
469
- board: {
470
- title: string;
471
- openBoard: string;
472
- backToDeck: string;
473
- hint: string;
474
- loading: string;
475
- /** template: "Part {n}" — columns in decks that declare no chapter pages. */
476
- columnFallback: string;
477
- moveToEnd: string;
478
- reorderFailed: string;
479
- zoomIn: string;
480
- zoomOut: string;
481
- fitView: string;
482
- saveFailed: string;
483
- renameColumn: string;
484
- columnTitlePlaceholder: string;
485
- addPage: string;
486
- notesPlaceholder: string;
487
- /** template: "Added a blank page at {n}" */
488
- toastInserted: string;
489
- insertFailed: string;
490
- };
491
479
  pdfToast: {
492
480
  title: string;
493
481
  /** template: "Processing page {current} of {total}" */
@@ -577,6 +565,111 @@ type Locale = {
577
565
  expandPromptAria: string;
578
566
  collapsePromptAria: string;
579
567
  };
568
+ agent: {
569
+ title: string;
570
+ beta: string;
571
+ betaTitle: string;
572
+ betaHint: string;
573
+ open: string;
574
+ openTitle: string;
575
+ close: string;
576
+ newSession: string;
577
+ sessions: string;
578
+ noSessions: string;
579
+ deleteSession: string;
580
+ historyThisDeck: string;
581
+ historyOtherDecks: string;
582
+ historyEmptyHint: string;
583
+ sessionRunning: string;
584
+ /** template: "Ask {provider} to create or edit slides…" */
585
+ composerPlaceholder: string;
586
+ send: string;
587
+ stop: string;
588
+ working: string;
589
+ /** template: "Page {n}" */
590
+ contextPage: string;
591
+ contextSelection: string;
592
+ /** plural, template: "{count} comments" */
593
+ pendingComments: Plural;
594
+ applyComments: string;
595
+ /** template: "Apply with {provider}" */
596
+ applyCommentsWith: string;
597
+ createDeck: string;
598
+ /** template: "Create a deck with {provider}" */
599
+ createDeckWith: string;
600
+ quickCreate: string;
601
+ quickCreateHint: string;
602
+ quickApply: string;
603
+ quickApplyHint: string;
604
+ quickTheme: string;
605
+ quickThemeHint: string;
606
+ quickEdit: string;
607
+ quickEditHint: string;
608
+ emptyTitle: string;
609
+ emptyHint: string;
610
+ questionSubmit: string;
611
+ questionOther: string;
612
+ questionOtherPlaceholder: string;
613
+ questionCancelled: string;
614
+ permissionTitle: string;
615
+ allow: string;
616
+ deny: string;
617
+ allowed: string;
618
+ denied: string;
619
+ autoApprove: string;
620
+ autoApproveHint: string;
621
+ resultDone: string;
622
+ resultStopped: string;
623
+ /** template: "{seconds}s" */
624
+ resultSeconds: string;
625
+ errorEyebrow: string;
626
+ statusLoading: string;
627
+ disabled: string;
628
+ connectTitle: string;
629
+ connectDescription: string;
630
+ connect: string;
631
+ connecting: string;
632
+ connected: string;
633
+ /** template: "Adds {pkg} to this workspace with {pm}." */
634
+ connectInstallHint: string;
635
+ /** template: "CLI found · v{version}" */
636
+ cliFound: string;
637
+ cliFoundNoVersion: string;
638
+ cliMissing: string;
639
+ /** template: "Install the {name} CLI and sign in once; the panel reuses its login." */
640
+ cliHint: string;
641
+ needCliTitle: string;
642
+ needCliDescription: string;
643
+ checkAgain: string;
644
+ retry: string;
645
+ /** template: "{name} connected" */
646
+ toastConnected: string;
647
+ /** template: "Could not install {pkg}" */
648
+ toastConnectFailed: string;
649
+ manageConnections: string;
650
+ backToChat: string;
651
+ toastSendFailed: string;
652
+ newDeckTitle: string;
653
+ newDeckHint: string;
654
+ newDeckPlaceholder: string;
655
+ toastCreateDeckFailed: string;
656
+ steps: Plural;
657
+ questionSkip: string;
658
+ copyMessage: string;
659
+ copied: string;
660
+ editMessage: string;
661
+ cancelEdit: string;
662
+ sendEdit: string;
663
+ editHint: string;
664
+ modelDefault: string;
665
+ reasoning: string;
666
+ effortAuto: string;
667
+ efforts: Record<AgentEffort, string>;
668
+ /** template: "{provider} is editing" */
669
+ presenceEditing: string;
670
+ presenceThinking: string;
671
+ presenceWaiting: string;
672
+ };
580
673
  };
581
674
  //#endregion
582
675
  export { Plural as n, Locale as t };
@@ -76,6 +76,10 @@ function validateMutationRequest(req, opts = {}) {
76
76
  };
77
77
  return { ok: true };
78
78
  }
79
+ function isLoopbackRequest(req) {
80
+ const address = req.socket.remoteAddress ?? "";
81
+ return address === "::1" || address.startsWith("127.") || address.startsWith("::ffff:127.");
82
+ }
79
83
  //#endregion
80
84
  //#region src/workspace-specifier.ts
81
85
  function readDeps(userCwd) {
@@ -122,6 +126,21 @@ function readFrameworkDependency(userCwd) {
122
126
  //#endregion
123
127
  //#region src/editing/slide-ops.ts
124
128
  const SLIDE_ID_RE = /^[a-z0-9_-]+$/i;
129
+ /**
130
+ * True when a directory under root already uses this id, including a
131
+ * different case. ext4 keeps `Cover` and `cover` as two folders; macOS
132
+ * and Windows usually collapse them. Listing names catches both.
133
+ */
134
+ async function slideIdTaken(root, slideId) {
135
+ let names;
136
+ try {
137
+ names = await fs.readdir(root);
138
+ } catch {
139
+ return false;
140
+ }
141
+ const want = slideId.toLowerCase();
142
+ return names.some((name) => name.toLowerCase() === want);
143
+ }
125
144
  function validateSlideName(v) {
126
145
  if (typeof v !== "string") return null;
127
146
  const trimmed = v.trim();
@@ -226,30 +245,25 @@ async function duplicateSlideDir(slidesRoot, slideId, desiredId) {
226
245
  error: "invalid newId"
227
246
  };
228
247
  newId = desiredId;
229
- const dstDir = path.resolve(root, newId);
230
- if (!dstDir.startsWith(root + path.sep)) return {
248
+ if (!path.resolve(root, newId).startsWith(root + path.sep)) return {
231
249
  ok: false,
232
250
  status: 400,
233
251
  error: "invalid newId"
234
252
  };
235
- try {
236
- await fs.access(dstDir);
237
- return {
238
- ok: false,
239
- status: 409,
240
- error: "slide already exists"
241
- };
242
- } catch {}
253
+ if (await slideIdTaken(root, newId)) return {
254
+ ok: false,
255
+ status: 409,
256
+ error: "slide already exists"
257
+ };
243
258
  } else {
244
259
  let suffix = 1;
245
260
  while (true) {
246
261
  newId = suffix === 1 ? `${slideId}-copy` : `${slideId}-copy-${suffix}`;
247
- try {
248
- await fs.access(path.resolve(root, newId));
262
+ if (await slideIdTaken(root, newId)) {
249
263
  suffix++;
250
- } catch {
251
- break;
264
+ continue;
252
265
  }
266
+ break;
253
267
  }
254
268
  }
255
269
  const dstDir = path.resolve(root, newId);
@@ -306,6 +320,107 @@ async function duplicateSlideDir(slidesRoot, slideId, desiredId) {
306
320
  };
307
321
  }
308
322
  }
323
+ const BLANK_SLIDE_TITLE = "Untitled";
324
+ function blankSlideSource(createdAt, specifier) {
325
+ const q = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
326
+ return `import type { Page, SlideMeta } from '${specifier}';
327
+
328
+ export const meta: SlideMeta = { title: ${q(BLANK_SLIDE_TITLE)}, createdAt: ${q(createdAt)} };
329
+
330
+ const Blank: Page = () => <div style={{ width: '100%', height: '100%', background: '#ffffff' }} />;
331
+
332
+ export default [Blank] satisfies Page[];
333
+ `;
334
+ }
335
+ async function createBlankSlideDir(slidesRoot, specifier = PKG_NAME) {
336
+ const root = path.resolve(slidesRoot);
337
+ await fs.mkdir(root, { recursive: true });
338
+ for (let suffix = 1; suffix < 1e3; suffix++) {
339
+ const slideId = suffix === 1 ? "untitled" : `untitled-${suffix}`;
340
+ if (await slideIdTaken(root, slideId)) continue;
341
+ const dir = path.join(root, slideId);
342
+ try {
343
+ await fs.mkdir(dir);
344
+ } catch (err) {
345
+ if (err.code === "EEXIST") continue;
346
+ return {
347
+ ok: false,
348
+ status: 500,
349
+ error: String(err.message ?? err)
350
+ };
351
+ }
352
+ const file = path.join(dir, "index.tsx");
353
+ await fs.writeFile(file, blankSlideSource((/* @__PURE__ */ new Date()).toISOString(), specifier), "utf8");
354
+ return {
355
+ ok: true,
356
+ slideId,
357
+ file
358
+ };
359
+ }
360
+ return {
361
+ ok: false,
362
+ status: 409,
363
+ error: "no free slide id"
364
+ };
365
+ }
366
+ function slugifyTitle(title) {
367
+ return title.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+/, "").slice(0, 48).replace(/-+$/, "");
368
+ }
369
+ async function renameSlideDir(slidesRoot, slideId, desiredId) {
370
+ if (!SLIDE_ID_RE.test(slideId) || !SLIDE_ID_RE.test(desiredId)) return {
371
+ ok: false,
372
+ status: 400,
373
+ error: "invalid slideId"
374
+ };
375
+ const root = path.resolve(slidesRoot);
376
+ const from = path.resolve(root, slideId);
377
+ if (!from.startsWith(root + path.sep)) return {
378
+ ok: false,
379
+ status: 400,
380
+ error: "invalid slideId"
381
+ };
382
+ try {
383
+ await fs.access(path.join(from, "index.tsx"));
384
+ } catch {
385
+ return {
386
+ ok: false,
387
+ status: 404,
388
+ error: "slide not found"
389
+ };
390
+ }
391
+ for (let suffix = 1; suffix < 1e3; suffix++) {
392
+ const candidate = suffix === 1 ? desiredId : `${desiredId}-${suffix}`;
393
+ if (candidate === slideId) return {
394
+ ok: false,
395
+ status: 409,
396
+ error: "slide id unchanged"
397
+ };
398
+ if (await slideIdTaken(root, candidate)) continue;
399
+ const to = path.join(root, candidate);
400
+ try {
401
+ await fs.rename(from, to);
402
+ } catch (err) {
403
+ const code = err.code;
404
+ if (code === "EEXIST" || code === "ENOTEMPTY") continue;
405
+ return {
406
+ ok: false,
407
+ status: 500,
408
+ error: String(err.message ?? err)
409
+ };
410
+ }
411
+ return {
412
+ ok: true,
413
+ slideId: candidate,
414
+ from,
415
+ to
416
+ };
417
+ }
418
+ return {
419
+ ok: false,
420
+ status: 409,
421
+ error: "no free slide id"
422
+ };
423
+ }
309
424
  function resolveSlideEntry(slidesRoot, slideId) {
310
425
  if (!SLIDE_ID_RE.test(slideId)) return null;
311
426
  const dir = path.resolve(slidesRoot, slideId);
@@ -398,8 +513,7 @@ function findDefaultExportArray(source) {
398
513
  return {
399
514
  elements,
400
515
  arrayStart,
401
- arrayEnd,
402
- statementStart: node.start
516
+ arrayEnd
403
517
  };
404
518
  }
405
519
  return null;
@@ -606,73 +720,6 @@ function chooseInsertSeparator(prefix, existingSeparators) {
606
720
  }
607
721
  return ", ";
608
722
  }
609
- /** Separator slots for an array that gained an element at `index`. */
610
- function separatorsAroundInsert(separators, index, count, insertSep) {
611
- const out = [];
612
- for (let i = 0; i < count - 1; i++) if (i === index) out.push(insertSep);
613
- else if (i === index - 1) out.push(separators[index - 1] ?? insertSep);
614
- else out.push(separators[i > index ? i - 1 : i] ?? insertSep);
615
- return out;
616
- }
617
- /** Rebuild `[...]` with `text` sitting at `index`, reusing the author's separators. */
618
- function insertIntoDefaultExportArray(source, found, index, text) {
619
- const { elements, arrayStart, arrayEnd } = found;
620
- const n = elements.length;
621
- const prefix = source.slice(arrayStart, elements[0].start);
622
- const suffix = source.slice(elements[n - 1].end, arrayEnd);
623
- const separators = [];
624
- for (let i = 0; i < n - 1; i++) separators.push(source.slice(elements[i].end, elements[i + 1].start));
625
- const texts = elements.map((el) => source.slice(el.start, el.end));
626
- texts.splice(index, 0, text);
627
- const insertSep = chooseInsertSeparator(prefix, separators);
628
- const seps = separatorsAroundInsert(separators, index, texts.length, insertSep);
629
- let rebuilt = prefix + texts[0];
630
- for (let i = 1; i < texts.length; i++) rebuilt += seps[i - 1] + texts[i];
631
- rebuilt += suffix;
632
- return source.slice(0, arrayStart) + rebuilt + source.slice(arrayEnd);
633
- }
634
- function chooseBlankPageName(source) {
635
- const used = new Set(source.match(/[A-Za-z_$][\w$]*/g) ?? []);
636
- for (let i = 1;; i++) {
637
- const name = `NewPage${i}`;
638
- if (!used.has(name)) return name;
639
- }
640
- }
641
- /**
642
- * Insert a brand-new blank page at `index`, declaring its component above the
643
- * default export and adding it to the array. Unlike duplication, nothing is
644
- * copied: the page is an empty full-bleed surface for the author to build on.
645
- *
646
- * Returns `null` when the default export isn't an array literal or `index` is
647
- * past the end of the deck.
648
- */
649
- function insertBlankPageInDefaultExportInSource(source, index) {
650
- const found = findDefaultExportArray(source);
651
- if (!found) return null;
652
- const n = found.elements.length;
653
- if (!Number.isInteger(index) || index < 0 || index > n) return null;
654
- const name = chooseBlankPageName(source);
655
- const withArray = insertIntoDefaultExportArray(source, found, index, name);
656
- const before = withArray.slice(0, found.statementStart);
657
- const gap = before.endsWith("\n\n") ? "" : before.endsWith("\n") ? "\n" : "\n\n";
658
- return before + `const ${name} = () => (\n <div style={{ width: '100%', height: '100%', background: '#ffffff' }} />\n);\n` + gap + withArray.slice(found.statementStart);
659
- }
660
- /**
661
- * Insert an empty note slot at `index` so `notes` stays aligned with the pages
662
- * after a page is inserted. Trailing empty slots are dropped again by
663
- * {@link rebuildNotesArray}, which is correct: an absent note is `undefined`.
664
- */
665
- function insertNotesElementInSource(source, index) {
666
- if (!Number.isInteger(index) || index < 0) return null;
667
- const found = findNotesArray(source);
668
- if (found === "invalid") return null;
669
- if (found === null) return source;
670
- const { arrayStart, arrayEnd, elementTexts } = found;
671
- if (index > elementTexts.length) return source;
672
- const next = elementTexts.slice();
673
- next.splice(index, 0, "undefined");
674
- return rebuildNotesArray(source, arrayStart, arrayEnd, next);
675
- }
676
723
  /**
677
724
  * Duplicate the element at `index` in `export default [...]`, inserting the
678
725
  * copy immediately after the original. Reuses an existing inter-element
@@ -798,13 +845,29 @@ function makeContext(opts) {
798
845
  globalAssetsRoot: path.resolve(userCwd, assetsDir),
799
846
  manifestPath: foldersManifestPath(slidesRoot),
800
847
  coreVersion: opts.coreVersion,
801
- frameworkSpecifier: declaredFrameworkSpecifier(userCwd)
848
+ frameworkSpecifier: declaredFrameworkSpecifier(userCwd),
849
+ agentEnabled: opts.agentEnabled
802
850
  };
803
851
  }
804
- async function readBody(req) {
852
+ var BodyTooLargeError = class extends Error {
853
+ constructor() {
854
+ super("request body too large");
855
+ this.name = "BodyTooLargeError";
856
+ }
857
+ };
858
+ async function readBody(req, limit = Number.POSITIVE_INFINITY) {
805
859
  return await new Promise((resolve, reject) => {
806
860
  const chunks = [];
807
- req.on("data", (c) => chunks.push(c));
861
+ let size = 0;
862
+ req.on("data", (c) => {
863
+ size += c.length;
864
+ if (size > limit) {
865
+ req.destroy();
866
+ reject(new BodyTooLargeError());
867
+ return;
868
+ }
869
+ chunks.push(c);
870
+ });
808
871
  req.on("end", () => {
809
872
  const raw = Buffer.concat(chunks).toString("utf8");
810
873
  if (!raw) return resolve({});
@@ -944,7 +1007,7 @@ async function localSyncCommand(cwd) {
944
1007
  function formatCommand(spec) {
945
1008
  return [spec.cmd, ...spec.args].join(" ");
946
1009
  }
947
- async function runCommand(spec, cwd) {
1010
+ async function runCommand(spec, cwd, timeoutMs = COMMAND_TIMEOUT_MS) {
948
1011
  await new Promise((resolve, reject) => {
949
1012
  const child = spawn(spec.cmd, spec.args, {
950
1013
  cwd,
@@ -954,13 +1017,14 @@ async function runCommand(spec, cwd) {
954
1017
  "ignore",
955
1018
  "ignore",
956
1019
  "pipe"
957
- ]
1020
+ ],
1021
+ windowsHide: true
958
1022
  });
959
1023
  let stderr = "";
960
1024
  const timer = setTimeout(() => {
961
1025
  child.kill();
962
1026
  reject(/* @__PURE__ */ new Error(`${formatCommand(spec)} timed out`));
963
- }, COMMAND_TIMEOUT_MS);
1027
+ }, timeoutMs);
964
1028
  child.stderr.on("data", (chunk) => {
965
1029
  stderr += chunk.toString("utf8");
966
1030
  if (stderr.length > 2e3) stderr = stderr.slice(-2e3);
@@ -1023,4 +1087,4 @@ function registerUpdateRoutes(server, ctx) {
1023
1087
  });
1024
1088
  }
1025
1089
  //#endregion
1026
- export { validateSlideName as A, removeNotesElementInSource as C, resolveSlideEntry as D, reorderNotesArrayInSource as E, PKG_NAMES as F, isFrameworkSpecifier as I, validateMutationRequest as M, BIN_NAME as N, rmSlideDir as O, CONFIG_FILES as P, insertNotesElementInSource as S, reorderDefaultExportPagesInSource as T, SLIDE_ID_RE as _, readBody as a, duplicateSlideDir as b, FOLDER_ID_RE as c, readManifest as d, validateIcon as f, shortId as g, writeManifest as h, makeContext as i, declaredFrameworkSpecifier as j, updateMetaTitleInSource as k, foldersManifestPath as l, validateReorder as m, registerUpdateRoutes as n, readSlideSource as o, validateName as p, json as r, resolveSlideEntryPath as s, detectPackageManager as t, newFolderId as u, duplicateNotesElementInSource as v, removePageFromDefaultExportInSource as w, insertBlankPageInDefaultExportInSource as x, duplicatePageInDefaultExportInSource as y };
1090
+ export { reorderNotesArrayInSource as A, CONFIG_FILES as B, duplicatePageInDefaultExportInSource as C, removePageFromDefaultExportInSource as D, removeNotesElementInSource as E, validateSlideName as F, isFrameworkSpecifier as H, declaredFrameworkSpecifier as I, isLoopbackRequest as L, rmSlideDir as M, slugifyTitle as N, renameSlideDir as O, updateMetaTitleInSource as P, validateMutationRequest as R, duplicateNotesElementInSource as S, readMetaTitleInSource as T, PKG_NAMES as V, writeManifest as _, json as a, SLIDE_ID_RE as b, readSlideSource as c, foldersManifestPath as d, newFolderId as f, validateReorder as g, validateName as h, BodyTooLargeError as i, resolveSlideEntry as j, reorderDefaultExportPagesInSource as k, resolveSlideEntryPath as l, validateIcon as m, registerUpdateRoutes as n, makeContext as o, readManifest as p, runCommand as r, readBody as s, detectPackageManager as t, FOLDER_ID_RE as u, shortId as v, duplicateSlideDir as w, createBlankSlideDir as x, BLANK_SLIDE_TITLE as y, BIN_NAME as z };
@@ -1,4 +1,4 @@
1
- import { n as LemonRiverConfig } from "../config-B6JaKJM4.js";
1
+ import { r as LemonRiverConfig } from "../config-teo3kWz7.js";
2
2
  import { InlineConfig } from "vite";
3
3
  //#region src/vite/config.d.ts
4
4
  type CreateViteConfigOptions = {
@@ -1,2 +1,2 @@
1
- import { t as createViteConfig } from "../config-DO45GU3e.js";
1
+ import { t as createViteConfig } from "../config-DJ5rkMMg.js";
2
2
  export { createViteConfig };