@autumnsgrove/groveengine 0.7.0 → 0.8.5

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 (230) hide show
  1. package/dist/components/OnboardingChecklist.svelte +2 -2
  2. package/dist/components/WispButton.svelte +83 -0
  3. package/dist/components/WispButton.svelte.d.ts +49 -0
  4. package/dist/components/WispPanel.svelte +1093 -0
  5. package/dist/components/WispPanel.svelte.d.ts +49 -0
  6. package/dist/components/custom/TableOfContents.svelte +12 -1
  7. package/dist/components/quota/UpgradePrompt.svelte +1 -0
  8. package/dist/config/wisp.d.ts +145 -0
  9. package/dist/config/wisp.js +175 -0
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.js +3 -0
  12. package/dist/server/inference-client.d.ts +139 -0
  13. package/dist/server/inference-client.js +294 -0
  14. package/dist/ui/components/content/RoadmapPreview.svelte +91 -0
  15. package/dist/ui/components/content/RoadmapPreview.svelte.d.ts +36 -0
  16. package/dist/ui/components/content/index.d.ts +1 -0
  17. package/dist/ui/components/content/index.js +1 -0
  18. package/dist/ui/components/nature/Logo.svelte +260 -0
  19. package/dist/ui/components/nature/Logo.svelte.d.ts +14 -0
  20. package/dist/ui/components/nature/botanical/Acorn.svelte +48 -0
  21. package/dist/ui/components/nature/botanical/Acorn.svelte.d.ts +8 -0
  22. package/dist/ui/components/nature/botanical/Berry.svelte +67 -0
  23. package/dist/ui/components/nature/botanical/Berry.svelte.d.ts +8 -0
  24. package/dist/ui/components/nature/botanical/DandelionPuff.svelte +98 -0
  25. package/dist/ui/components/nature/botanical/DandelionPuff.svelte.d.ts +8 -0
  26. package/dist/ui/components/nature/botanical/FallingLeavesLayer.svelte +170 -0
  27. package/dist/ui/components/nature/botanical/FallingLeavesLayer.svelte.d.ts +35 -0
  28. package/dist/ui/components/nature/botanical/FallingPetalsLayer.svelte +174 -0
  29. package/dist/ui/components/nature/botanical/FallingPetalsLayer.svelte.d.ts +25 -0
  30. package/dist/ui/components/nature/botanical/Leaf.svelte +77 -0
  31. package/dist/ui/components/nature/botanical/Leaf.svelte.d.ts +10 -0
  32. package/dist/ui/components/nature/botanical/LeafFalling.svelte +186 -0
  33. package/dist/ui/components/nature/botanical/LeafFalling.svelte.d.ts +22 -0
  34. package/dist/ui/components/nature/botanical/PetalFalling.svelte +266 -0
  35. package/dist/ui/components/nature/botanical/PetalFalling.svelte.d.ts +25 -0
  36. package/dist/ui/components/nature/botanical/PineCone.svelte +61 -0
  37. package/dist/ui/components/nature/botanical/PineCone.svelte.d.ts +7 -0
  38. package/dist/ui/components/nature/botanical/Vine.svelte +102 -0
  39. package/dist/ui/components/nature/botanical/Vine.svelte.d.ts +11 -0
  40. package/dist/ui/components/nature/botanical/index.d.ts +10 -0
  41. package/dist/ui/components/nature/botanical/index.js +11 -0
  42. package/dist/ui/components/nature/creatures/Bee.svelte +78 -0
  43. package/dist/ui/components/nature/creatures/Bee.svelte.d.ts +9 -0
  44. package/dist/ui/components/nature/creatures/Bird.svelte +94 -0
  45. package/dist/ui/components/nature/creatures/Bird.svelte.d.ts +11 -0
  46. package/dist/ui/components/nature/creatures/BirdFlying.svelte +83 -0
  47. package/dist/ui/components/nature/creatures/BirdFlying.svelte.d.ts +9 -0
  48. package/dist/ui/components/nature/creatures/Bluebird.svelte +95 -0
  49. package/dist/ui/components/nature/creatures/Bluebird.svelte.d.ts +12 -0
  50. package/dist/ui/components/nature/creatures/Butterfly.svelte +87 -0
  51. package/dist/ui/components/nature/creatures/Butterfly.svelte.d.ts +9 -0
  52. package/dist/ui/components/nature/creatures/Cardinal.svelte +95 -0
  53. package/dist/ui/components/nature/creatures/Cardinal.svelte.d.ts +12 -0
  54. package/dist/ui/components/nature/creatures/Chickadee.svelte +97 -0
  55. package/dist/ui/components/nature/creatures/Chickadee.svelte.d.ts +12 -0
  56. package/dist/ui/components/nature/creatures/Deer.svelte +95 -0
  57. package/dist/ui/components/nature/creatures/Deer.svelte.d.ts +9 -0
  58. package/dist/ui/components/nature/creatures/Firefly.svelte +111 -0
  59. package/dist/ui/components/nature/creatures/Firefly.svelte.d.ts +10 -0
  60. package/dist/ui/components/nature/creatures/Owl.svelte +91 -0
  61. package/dist/ui/components/nature/creatures/Owl.svelte.d.ts +9 -0
  62. package/dist/ui/components/nature/creatures/Rabbit.svelte +90 -0
  63. package/dist/ui/components/nature/creatures/Rabbit.svelte.d.ts +9 -0
  64. package/dist/ui/components/nature/creatures/Robin.svelte +98 -0
  65. package/dist/ui/components/nature/creatures/Robin.svelte.d.ts +12 -0
  66. package/dist/ui/components/nature/creatures/Squirrel.svelte +97 -0
  67. package/dist/ui/components/nature/creatures/Squirrel.svelte.d.ts +9 -0
  68. package/dist/ui/components/nature/creatures/index.d.ts +13 -0
  69. package/dist/ui/components/nature/creatures/index.js +14 -0
  70. package/dist/ui/components/nature/ground/Bush.svelte +57 -0
  71. package/dist/ui/components/nature/ground/Bush.svelte.d.ts +10 -0
  72. package/dist/ui/components/nature/ground/Crocus.svelte +83 -0
  73. package/dist/ui/components/nature/ground/Crocus.svelte.d.ts +12 -0
  74. package/dist/ui/components/nature/ground/Daffodil.svelte +75 -0
  75. package/dist/ui/components/nature/ground/Daffodil.svelte.d.ts +11 -0
  76. package/dist/ui/components/nature/ground/Fern.svelte +72 -0
  77. package/dist/ui/components/nature/ground/Fern.svelte.d.ts +10 -0
  78. package/dist/ui/components/nature/ground/FlowerWild.svelte +60 -0
  79. package/dist/ui/components/nature/ground/FlowerWild.svelte.d.ts +10 -0
  80. package/dist/ui/components/nature/ground/GrassTuft.svelte +49 -0
  81. package/dist/ui/components/nature/ground/GrassTuft.svelte.d.ts +10 -0
  82. package/dist/ui/components/nature/ground/Log.svelte +42 -0
  83. package/dist/ui/components/nature/ground/Log.svelte.d.ts +7 -0
  84. package/dist/ui/components/nature/ground/Mushroom.svelte +48 -0
  85. package/dist/ui/components/nature/ground/Mushroom.svelte.d.ts +9 -0
  86. package/dist/ui/components/nature/ground/MushroomCluster.svelte +41 -0
  87. package/dist/ui/components/nature/ground/MushroomCluster.svelte.d.ts +8 -0
  88. package/dist/ui/components/nature/ground/Rock.svelte +59 -0
  89. package/dist/ui/components/nature/ground/Rock.svelte.d.ts +8 -0
  90. package/dist/ui/components/nature/ground/Stump.svelte +44 -0
  91. package/dist/ui/components/nature/ground/Stump.svelte.d.ts +8 -0
  92. package/dist/ui/components/nature/ground/Tulip.svelte +79 -0
  93. package/dist/ui/components/nature/ground/Tulip.svelte.d.ts +11 -0
  94. package/dist/ui/components/nature/ground/index.d.ts +12 -0
  95. package/dist/ui/components/nature/ground/index.js +13 -0
  96. package/dist/ui/components/nature/index.d.ts +28 -0
  97. package/dist/ui/components/nature/index.js +38 -0
  98. package/dist/ui/components/nature/palette.d.ts +602 -0
  99. package/dist/ui/components/nature/palette.js +472 -0
  100. package/dist/ui/components/nature/sky/Cloud.svelte +122 -0
  101. package/dist/ui/components/nature/sky/Cloud.svelte.d.ts +11 -0
  102. package/dist/ui/components/nature/sky/CloudWispy.svelte +79 -0
  103. package/dist/ui/components/nature/sky/CloudWispy.svelte.d.ts +9 -0
  104. package/dist/ui/components/nature/sky/Moon.svelte +60 -0
  105. package/dist/ui/components/nature/sky/Moon.svelte.d.ts +9 -0
  106. package/dist/ui/components/nature/sky/Rainbow.svelte +101 -0
  107. package/dist/ui/components/nature/sky/Rainbow.svelte.d.ts +8 -0
  108. package/dist/ui/components/nature/sky/Star.svelte +84 -0
  109. package/dist/ui/components/nature/sky/Star.svelte.d.ts +10 -0
  110. package/dist/ui/components/nature/sky/StarCluster.svelte +85 -0
  111. package/dist/ui/components/nature/sky/StarCluster.svelte.d.ts +9 -0
  112. package/dist/ui/components/nature/sky/StarShooting.svelte +90 -0
  113. package/dist/ui/components/nature/sky/StarShooting.svelte.d.ts +9 -0
  114. package/dist/ui/components/nature/sky/Sun.svelte +70 -0
  115. package/dist/ui/components/nature/sky/Sun.svelte.d.ts +9 -0
  116. package/dist/ui/components/nature/sky/index.d.ts +8 -0
  117. package/dist/ui/components/nature/sky/index.js +9 -0
  118. package/dist/ui/components/nature/structural/Birdhouse.svelte +53 -0
  119. package/dist/ui/components/nature/structural/Birdhouse.svelte.d.ts +8 -0
  120. package/dist/ui/components/nature/structural/Bridge.svelte +65 -0
  121. package/dist/ui/components/nature/structural/Bridge.svelte.d.ts +7 -0
  122. package/dist/ui/components/nature/structural/FencePost.svelte +54 -0
  123. package/dist/ui/components/nature/structural/FencePost.svelte.d.ts +8 -0
  124. package/dist/ui/components/nature/structural/GardenGate.svelte +70 -0
  125. package/dist/ui/components/nature/structural/GardenGate.svelte.d.ts +8 -0
  126. package/dist/ui/components/nature/structural/Lantern.svelte +113 -0
  127. package/dist/ui/components/nature/structural/Lantern.svelte.d.ts +10 -0
  128. package/dist/ui/components/nature/structural/Lattice.svelte +89 -0
  129. package/dist/ui/components/nature/structural/Lattice.svelte.d.ts +8 -0
  130. package/dist/ui/components/nature/structural/LatticeWithVine.svelte +89 -0
  131. package/dist/ui/components/nature/structural/LatticeWithVine.svelte.d.ts +11 -0
  132. package/dist/ui/components/nature/structural/StonePath.svelte +48 -0
  133. package/dist/ui/components/nature/structural/StonePath.svelte.d.ts +7 -0
  134. package/dist/ui/components/nature/structural/index.d.ts +8 -0
  135. package/dist/ui/components/nature/structural/index.js +9 -0
  136. package/dist/ui/components/nature/trees/TreeAspen.svelte +163 -0
  137. package/dist/ui/components/nature/trees/TreeAspen.svelte.d.ts +11 -0
  138. package/dist/ui/components/nature/trees/TreeBirch.svelte +186 -0
  139. package/dist/ui/components/nature/trees/TreeBirch.svelte.d.ts +11 -0
  140. package/dist/ui/components/nature/trees/TreeCherry.svelte +108 -0
  141. package/dist/ui/components/nature/trees/TreeCherry.svelte.d.ts +11 -0
  142. package/dist/ui/components/nature/trees/TreePine.svelte +79 -0
  143. package/dist/ui/components/nature/trees/TreePine.svelte.d.ts +11 -0
  144. package/dist/ui/components/nature/trees/index.d.ts +4 -0
  145. package/dist/ui/components/nature/trees/index.js +5 -0
  146. package/dist/ui/components/nature/water/LilyPad.svelte +99 -0
  147. package/dist/ui/components/nature/water/LilyPad.svelte.d.ts +10 -0
  148. package/dist/ui/components/nature/water/Pond.svelte +104 -0
  149. package/dist/ui/components/nature/water/Pond.svelte.d.ts +8 -0
  150. package/dist/ui/components/nature/water/Reeds.svelte +85 -0
  151. package/dist/ui/components/nature/water/Reeds.svelte.d.ts +11 -0
  152. package/dist/ui/components/nature/water/Stream.svelte +98 -0
  153. package/dist/ui/components/nature/water/Stream.svelte.d.ts +8 -0
  154. package/dist/ui/components/nature/water/index.d.ts +4 -0
  155. package/dist/ui/components/nature/water/index.js +5 -0
  156. package/dist/ui/components/nature/weather/SnowfallLayer.svelte +175 -0
  157. package/dist/ui/components/nature/weather/SnowfallLayer.svelte.d.ts +25 -0
  158. package/dist/ui/components/nature/weather/Snowflake.svelte +99 -0
  159. package/dist/ui/components/nature/weather/Snowflake.svelte.d.ts +11 -0
  160. package/dist/ui/components/nature/weather/SnowflakeFalling.svelte +162 -0
  161. package/dist/ui/components/nature/weather/SnowflakeFalling.svelte.d.ts +23 -0
  162. package/dist/ui/components/nature/weather/index.d.ts +3 -0
  163. package/dist/ui/components/nature/weather/index.js +4 -0
  164. package/dist/ui/components/primitives/textarea/textarea.svelte +1 -1
  165. package/dist/ui/components/typography/Alagard.svelte +17 -0
  166. package/dist/ui/components/typography/Alagard.svelte.d.ts +10 -0
  167. package/dist/ui/components/typography/Atkinson.svelte +17 -0
  168. package/dist/ui/components/typography/Atkinson.svelte.d.ts +10 -0
  169. package/dist/ui/components/typography/BodoniModa.svelte +17 -0
  170. package/dist/ui/components/typography/BodoniModa.svelte.d.ts +10 -0
  171. package/dist/ui/components/typography/Calistoga.svelte +17 -0
  172. package/dist/ui/components/typography/Calistoga.svelte.d.ts +10 -0
  173. package/dist/ui/components/typography/Caveat.svelte +17 -0
  174. package/dist/ui/components/typography/Caveat.svelte.d.ts +10 -0
  175. package/dist/ui/components/typography/Cormorant.svelte +17 -0
  176. package/dist/ui/components/typography/Cormorant.svelte.d.ts +10 -0
  177. package/dist/ui/components/typography/Cozette.svelte +17 -0
  178. package/dist/ui/components/typography/Cozette.svelte.d.ts +10 -0
  179. package/dist/ui/components/typography/EBGaramond.svelte +17 -0
  180. package/dist/ui/components/typography/EBGaramond.svelte.d.ts +10 -0
  181. package/dist/ui/components/typography/FontProvider.svelte +98 -0
  182. package/dist/ui/components/typography/FontProvider.svelte.d.ts +17 -0
  183. package/dist/ui/components/typography/Fraunces.svelte +17 -0
  184. package/dist/ui/components/typography/Fraunces.svelte.d.ts +10 -0
  185. package/dist/ui/components/typography/IBMPlexMono.svelte +17 -0
  186. package/dist/ui/components/typography/IBMPlexMono.svelte.d.ts +10 -0
  187. package/dist/ui/components/typography/InstrumentSans.svelte +17 -0
  188. package/dist/ui/components/typography/InstrumentSans.svelte.d.ts +10 -0
  189. package/dist/ui/components/typography/Lexend.svelte +17 -0
  190. package/dist/ui/components/typography/Lexend.svelte.d.ts +10 -0
  191. package/dist/ui/components/typography/Lora.svelte +17 -0
  192. package/dist/ui/components/typography/Lora.svelte.d.ts +10 -0
  193. package/dist/ui/components/typography/Luciole.svelte +17 -0
  194. package/dist/ui/components/typography/Luciole.svelte.d.ts +10 -0
  195. package/dist/ui/components/typography/Manrope.svelte +17 -0
  196. package/dist/ui/components/typography/Manrope.svelte.d.ts +10 -0
  197. package/dist/ui/components/typography/Merriweather.svelte +17 -0
  198. package/dist/ui/components/typography/Merriweather.svelte.d.ts +10 -0
  199. package/dist/ui/components/typography/Nunito.svelte +17 -0
  200. package/dist/ui/components/typography/Nunito.svelte.d.ts +10 -0
  201. package/dist/ui/components/typography/OpenDyslexic.svelte +17 -0
  202. package/dist/ui/components/typography/OpenDyslexic.svelte.d.ts +10 -0
  203. package/dist/ui/components/typography/PlusJakartaSans.svelte +17 -0
  204. package/dist/ui/components/typography/PlusJakartaSans.svelte.d.ts +10 -0
  205. package/dist/ui/components/typography/Quicksand.svelte +17 -0
  206. package/dist/ui/components/typography/Quicksand.svelte.d.ts +10 -0
  207. package/dist/ui/components/typography/README.md +153 -0
  208. package/dist/ui/components/typography/index.d.ts +23 -0
  209. package/dist/ui/components/typography/index.js +42 -0
  210. package/dist/ui/components/ui/GlassCarousel.svelte +446 -0
  211. package/dist/ui/components/ui/GlassCarousel.svelte.d.ts +57 -0
  212. package/dist/ui/components/ui/GlassConfirmDialog.svelte +2 -1
  213. package/dist/ui/components/ui/GlassLogo.svelte +423 -0
  214. package/dist/ui/components/ui/GlassLogo.svelte.d.ts +23 -0
  215. package/dist/ui/components/ui/GlassNavbar.svelte +120 -0
  216. package/dist/ui/components/ui/GlassNavbar.svelte.d.ts +42 -0
  217. package/dist/ui/components/ui/GlassOverlay.svelte +1 -1
  218. package/dist/ui/components/ui/Logo.svelte +47 -52
  219. package/dist/ui/components/ui/Logo.svelte.d.ts +4 -3
  220. package/dist/ui/components/ui/index.d.ts +3 -0
  221. package/dist/ui/components/ui/index.js +3 -0
  222. package/dist/ui/index.d.ts +1 -0
  223. package/dist/ui/index.js +2 -0
  224. package/dist/ui/styles/grove.css +15 -1
  225. package/dist/ui/vineyard/index.d.ts +9 -0
  226. package/dist/ui/vineyard/index.js +8 -0
  227. package/dist/utils/csrf.js +5 -2
  228. package/dist/utils/readability.d.ts +89 -0
  229. package/dist/utils/readability.js +204 -0
  230. package/package.json +27 -1
@@ -0,0 +1,49 @@
1
+ export default WispPanel;
2
+ type WispPanel = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const WispPanel: import("svelte").Component<{
7
+ /**
8
+ * - Content to analyze
9
+ */
10
+ content: string;
11
+ /**
12
+ * - Whether Wisp is enabled
13
+ */
14
+ enabled: boolean;
15
+ /**
16
+ * - Optional post title for context
17
+ */
18
+ postTitle: string;
19
+ /**
20
+ * - Optional post slug for logging
21
+ */
22
+ postSlug: string;
23
+ /**
24
+ * - Callback when user applies a fix
25
+ */
26
+ onApplyFix: (original: string, suggestion: string) => void;
27
+ }, {}, "">;
28
+ type Props = {
29
+ /**
30
+ * - Content to analyze
31
+ */
32
+ content: string;
33
+ /**
34
+ * - Whether Wisp is enabled
35
+ */
36
+ enabled: boolean;
37
+ /**
38
+ * - Optional post title for context
39
+ */
40
+ postTitle: string;
41
+ /**
42
+ * - Optional post slug for logging
43
+ */
44
+ postSlug: string;
45
+ /**
46
+ * - Callback when user applies a fix
47
+ */
48
+ onApplyFix: (original: string, suggestion: string) => void;
49
+ };
@@ -41,9 +41,20 @@
41
41
  function scrollToHeader(id) {
42
42
  const element = document.getElementById(id);
43
43
  if (element) {
44
- element.scrollIntoView({ behavior: 'smooth', block: 'start' });
44
+ // Calculate offset for sticky headers
45
+ const offset = 80; // Account for any fixed headers
46
+ const elementPosition = element.getBoundingClientRect().top + window.pageYOffset;
47
+ const offsetPosition = elementPosition - offset;
48
+
49
+ window.scrollTo({
50
+ top: offsetPosition,
51
+ behavior: 'smooth'
52
+ });
53
+
45
54
  // Update URL hash without jumping
46
55
  history.pushState(null, '', `#${id}`);
56
+ } else {
57
+ console.warn(`TableOfContents: Header element not found for ID: ${id}`);
47
58
  }
48
59
  }
49
60
  </script>
@@ -187,6 +187,7 @@
187
187
  aria-modal="true"
188
188
  aria-labelledby="upgrade-title"
189
189
  aria-describedby="upgrade-description"
190
+ tabindex="0"
190
191
  >
191
192
  <!-- Header -->
192
193
  <div class="text-center mb-6">
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Calculate cost for token usage
3
+ * @param {string} model - Model key
4
+ * @param {number} inputTokens - Number of input tokens
5
+ * @param {number} outputTokens - Number of output tokens
6
+ * @returns {number} Cost in USD (rounded to 6 decimal places to avoid floating point errors)
7
+ */
8
+ export function calculateCost(model: string, inputTokens: number, outputTokens: number): number;
9
+ /**
10
+ * Get the model ID for a provider
11
+ * @param {string} provider - Provider key
12
+ * @param {string} model - Model key
13
+ * @returns {string|null} Full model ID or null if not found
14
+ */
15
+ export function getModelId(provider: string, model: string): string | null;
16
+ /**
17
+ * Get provider configuration
18
+ * @param {string} provider - Provider key
19
+ * @returns {object|null} Provider config or null
20
+ */
21
+ export function getProvider(provider: string): object | null;
22
+ /**
23
+ * Get max tokens for an action and mode
24
+ * @param {'grammar'|'tone'|'readability'} action
25
+ * @param {'quick'|'thorough'} mode
26
+ * @returns {number}
27
+ */
28
+ export function getMaxTokens(action: "grammar" | "tone" | "readability", mode?: "quick" | "thorough"): number;
29
+ export namespace PROVIDERS {
30
+ namespace fireworks {
31
+ let name: string;
32
+ let baseUrl: string;
33
+ let role: string;
34
+ let zdr: boolean;
35
+ let models: {
36
+ 'deepseek-v3.2': string;
37
+ 'kimi-k2': string;
38
+ 'llama-3.1-70b': string;
39
+ };
40
+ }
41
+ namespace cerebras {
42
+ let name_1: string;
43
+ export { name_1 as name };
44
+ let baseUrl_1: string;
45
+ export { baseUrl_1 as baseUrl };
46
+ let role_1: string;
47
+ export { role_1 as role };
48
+ let zdr_1: boolean;
49
+ export { zdr_1 as zdr };
50
+ let models_1: {
51
+ 'llama-3.3-70b': string;
52
+ 'gpt-oss-120b': string;
53
+ };
54
+ export { models_1 as models };
55
+ }
56
+ namespace groq {
57
+ let name_2: string;
58
+ export { name_2 as name };
59
+ let baseUrl_2: string;
60
+ export { baseUrl_2 as baseUrl };
61
+ let role_2: string;
62
+ export { role_2 as role };
63
+ let zdr_2: boolean;
64
+ export { zdr_2 as zdr };
65
+ let models_2: {
66
+ 'llama-3.3-70b': string;
67
+ };
68
+ export { models_2 as models };
69
+ }
70
+ }
71
+ /**
72
+ * Model fallback cascade
73
+ * Try in order until one succeeds
74
+ */
75
+ export const MODEL_FALLBACK_CASCADE: {
76
+ provider: string;
77
+ model: string;
78
+ }[];
79
+ export const MODEL_PRICING: {
80
+ 'deepseek-v3.2': {
81
+ input: number;
82
+ output: number;
83
+ };
84
+ 'kimi-k2': {
85
+ input: number;
86
+ output: number;
87
+ };
88
+ 'llama-3.1-70b': {
89
+ input: number;
90
+ output: number;
91
+ };
92
+ 'llama-3.3-70b': {
93
+ input: number;
94
+ output: number;
95
+ };
96
+ 'gpt-oss-120b': {
97
+ input: number;
98
+ output: number;
99
+ };
100
+ };
101
+ /** Maximum content length for analysis (characters) */
102
+ export const MAX_CONTENT_LENGTH: 50000;
103
+ export namespace MAX_OUTPUT_TOKENS {
104
+ namespace grammar {
105
+ let quick: number;
106
+ let thorough: number;
107
+ }
108
+ namespace tone {
109
+ let quick_1: number;
110
+ export { quick_1 as quick };
111
+ let thorough_1: number;
112
+ export { thorough_1 as thorough };
113
+ }
114
+ let readability: number;
115
+ }
116
+ export namespace RATE_LIMIT {
117
+ let maxRequestsPerHour: number;
118
+ let windowSeconds: number;
119
+ }
120
+ export namespace COST_CAP {
121
+ let enabled: boolean;
122
+ let maxCostUSD: number;
123
+ let warningThreshold: number;
124
+ }
125
+ export namespace PROMPT_MODES {
126
+ export namespace quick_2 {
127
+ let name_3: string;
128
+ export { name_3 as name };
129
+ export let description: string;
130
+ export let temperature: number;
131
+ export let maxOutputMultiplier: number;
132
+ }
133
+ export { quick_2 as quick };
134
+ export namespace thorough_2 {
135
+ let name_4: string;
136
+ export { name_4 as name };
137
+ let description_1: string;
138
+ export { description_1 as description };
139
+ let temperature_1: number;
140
+ export { temperature_1 as temperature };
141
+ let maxOutputMultiplier_1: number;
142
+ export { maxOutputMultiplier_1 as maxOutputMultiplier };
143
+ }
144
+ export { thorough_2 as thorough };
145
+ }
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Wisp - Grove Writing Assistant Configuration
3
+ *
4
+ * Model configuration, provider settings, and pricing for the Wisp writing assistant.
5
+ * Uses privacy-first providers with Zero Data Retention (ZDR).
6
+ *
7
+ * @see docs/specs/writing-assistant-unified-spec.md
8
+ */
9
+
10
+ // ============================================================================
11
+ // Provider Configuration
12
+ // ============================================================================
13
+
14
+ /**
15
+ * Approved inference providers with ZDR support
16
+ * Order determines fallback priority
17
+ */
18
+ export const PROVIDERS = {
19
+ fireworks: {
20
+ name: 'Fireworks AI',
21
+ baseUrl: 'https://api.fireworks.ai/inference/v1',
22
+ role: 'primary',
23
+ zdr: true, // Zero Data Retention default for open models
24
+ models: {
25
+ 'deepseek-v3.2': 'accounts/fireworks/models/deepseek-v3p2',
26
+ 'kimi-k2': 'accounts/fireworks/models/kimi-k2-instruct-0905',
27
+ 'llama-3.1-70b': 'accounts/fireworks/models/llama-v3p1-70b-instruct'
28
+ }
29
+ },
30
+ cerebras: {
31
+ name: 'Cerebras',
32
+ baseUrl: 'https://api.cerebras.ai/v1',
33
+ role: 'backup',
34
+ zdr: true, // US-based, zero retention
35
+ models: {
36
+ 'llama-3.3-70b': 'llama-3.3-70b',
37
+ 'gpt-oss-120b': 'gpt-oss-120b'
38
+ }
39
+ },
40
+ groq: {
41
+ name: 'Groq',
42
+ baseUrl: 'https://api.groq.com/openai/v1',
43
+ role: 'tertiary',
44
+ zdr: true, // Explicit ZDR toggle
45
+ models: {
46
+ 'llama-3.3-70b': 'llama-3.3-70b-versatile'
47
+ }
48
+ }
49
+ };
50
+
51
+ /**
52
+ * Model fallback cascade
53
+ * Try in order until one succeeds
54
+ */
55
+ export const MODEL_FALLBACK_CASCADE = [
56
+ { provider: 'fireworks', model: 'deepseek-v3.2' },
57
+ { provider: 'fireworks', model: 'kimi-k2' },
58
+ { provider: 'fireworks', model: 'llama-3.1-70b' },
59
+ { provider: 'cerebras', model: 'llama-3.3-70b' },
60
+ { provider: 'groq', model: 'llama-3.3-70b' }
61
+ ];
62
+
63
+ // ============================================================================
64
+ // Pricing (per million tokens)
65
+ // ============================================================================
66
+
67
+ export const MODEL_PRICING = {
68
+ 'deepseek-v3.2': { input: 0.56, output: 1.68 },
69
+ 'kimi-k2': { input: 0.60, output: 2.50 },
70
+ 'llama-3.1-70b': { input: 0.90, output: 0.90 },
71
+ 'llama-3.3-70b': { input: 0.59, output: 0.79 },
72
+ 'gpt-oss-120b': { input: 0.25, output: 0.69 }
73
+ };
74
+
75
+ // ============================================================================
76
+ // Limits & Thresholds
77
+ // ============================================================================
78
+
79
+ /** Maximum content length for analysis (characters) */
80
+ export const MAX_CONTENT_LENGTH = 50000;
81
+
82
+ /** Max output tokens by analysis type and mode */
83
+ export const MAX_OUTPUT_TOKENS = {
84
+ grammar: { quick: 1024, thorough: 2048 },
85
+ tone: { quick: 512, thorough: 1024 },
86
+ readability: 0 // No AI call needed
87
+ };
88
+
89
+ /**
90
+ * Rate limiting (burst protection)
91
+ * Note: Cost cap is the true monthly limit (~1000 requests at current pricing).
92
+ * Hourly limit prevents abuse bursts, not total monthly usage.
93
+ */
94
+ export const RATE_LIMIT = {
95
+ maxRequestsPerHour: 10,
96
+ windowSeconds: 3600
97
+ };
98
+
99
+ /** Monthly cost cap per user (the true usage limit) */
100
+ export const COST_CAP = {
101
+ enabled: true,
102
+ maxCostUSD: 5.0,
103
+ warningThreshold: 0.8 // Warn at 80%
104
+ };
105
+
106
+ // ============================================================================
107
+ // Prompt Modes
108
+ // ============================================================================
109
+
110
+ /**
111
+ * Prompt modes control analysis depth without changing models
112
+ */
113
+ export const PROMPT_MODES = {
114
+ quick: {
115
+ name: 'Quick',
116
+ description: 'Fast essential checks',
117
+ temperature: 0.1,
118
+ maxOutputMultiplier: 1
119
+ },
120
+ thorough: {
121
+ name: 'Thorough',
122
+ description: 'Comprehensive analysis',
123
+ temperature: 0.2,
124
+ maxOutputMultiplier: 2
125
+ }
126
+ };
127
+
128
+ // ============================================================================
129
+ // Helper Functions
130
+ // ============================================================================
131
+
132
+ /**
133
+ * Calculate cost for token usage
134
+ * @param {string} model - Model key
135
+ * @param {number} inputTokens - Number of input tokens
136
+ * @param {number} outputTokens - Number of output tokens
137
+ * @returns {number} Cost in USD (rounded to 6 decimal places to avoid floating point errors)
138
+ */
139
+ export function calculateCost(model, inputTokens, outputTokens) {
140
+ const pricing = MODEL_PRICING[model] || MODEL_PRICING['deepseek-v3.2'];
141
+ const cost = (inputTokens * pricing.input + outputTokens * pricing.output) / 1_000_000;
142
+ // Round to 6 decimal places to avoid floating point precision issues
143
+ return Math.round(cost * 1_000_000) / 1_000_000;
144
+ }
145
+
146
+ /**
147
+ * Get the model ID for a provider
148
+ * @param {string} provider - Provider key
149
+ * @param {string} model - Model key
150
+ * @returns {string|null} Full model ID or null if not found
151
+ */
152
+ export function getModelId(provider, model) {
153
+ return PROVIDERS[provider]?.models[model] || null;
154
+ }
155
+
156
+ /**
157
+ * Get provider configuration
158
+ * @param {string} provider - Provider key
159
+ * @returns {object|null} Provider config or null
160
+ */
161
+ export function getProvider(provider) {
162
+ return PROVIDERS[provider] || null;
163
+ }
164
+
165
+ /**
166
+ * Get max tokens for an action and mode
167
+ * @param {'grammar'|'tone'|'readability'} action
168
+ * @param {'quick'|'thorough'} mode
169
+ * @returns {number}
170
+ */
171
+ export function getMaxTokens(action, mode = 'quick') {
172
+ const tokens = MAX_OUTPUT_TOKENS[action];
173
+ if (typeof tokens === 'number') return tokens;
174
+ return tokens?.[mode] || 1024;
175
+ }
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ export { default as MobileTOC } from './components/custom/MobileTOC.svelte';
6
6
  export { default as CollapsibleSection } from './components/custom/CollapsibleSection.svelte';
7
7
  export { default as MarkdownEditor } from './components/admin/MarkdownEditor.svelte';
8
8
  export { default as GutterManager } from './components/admin/GutterManager.svelte';
9
+ export { default as WispPanel } from './components/WispPanel.svelte';
10
+ export { default as WispButton } from './components/WispButton.svelte';
9
11
  export { QuotaWidget, QuotaWarning, UpgradePrompt } from './components/quota/index';
10
12
  export { default as ImageGallery } from './ui/components/gallery/ImageGallery.svelte';
11
13
  export { default as Lightbox } from './ui/components/gallery/Lightbox.svelte';
package/dist/index.js CHANGED
@@ -9,6 +9,9 @@ export { default as CollapsibleSection } from './components/custom/CollapsibleSe
9
9
  // Admin components
10
10
  export { default as MarkdownEditor } from './components/admin/MarkdownEditor.svelte';
11
11
  export { default as GutterManager } from './components/admin/GutterManager.svelte';
12
+ // Wisp - Writing Assistant
13
+ export { default as WispPanel } from './components/WispPanel.svelte';
14
+ export { default as WispButton } from './components/WispButton.svelte';
12
15
  // Quota components
13
16
  export { QuotaWidget, QuotaWarning, UpgradePrompt } from './components/quota/index';
14
17
  // Gallery components (from UI module)
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Call an inference API with automatic fallback
3
+ *
4
+ * @param {InferenceRequest} request - The inference request
5
+ * @param {Object} secrets - API keys object
6
+ * @param {string} [secrets.FIREWORKS_API_KEY] - Fireworks AI key
7
+ * @param {string} [secrets.CEREBRAS_API_KEY] - Cerebras key
8
+ * @param {string} [secrets.GROQ_API_KEY] - Groq key
9
+ * @returns {Promise<InferenceResponse>}
10
+ * @throws {InferenceClientError}
11
+ */
12
+ export function callInference(request: InferenceRequest, secrets: {
13
+ FIREWORKS_API_KEY?: string | undefined;
14
+ CEREBRAS_API_KEY?: string | undefined;
15
+ GROQ_API_KEY?: string | undefined;
16
+ }): Promise<InferenceResponse>;
17
+ /**
18
+ * Wrap user content with security markers to prevent prompt injection
19
+ *
20
+ * @param {string} content - User content to analyze
21
+ * @param {string} taskDescription - Description of the analysis task
22
+ * @returns {string} Secured prompt with content
23
+ */
24
+ export function secureUserContent(content: string, taskDescription: string): string;
25
+ /**
26
+ * Smart truncation for long content
27
+ * Captures beginning, end, and samples from middle
28
+ *
29
+ * @param {string} content - Content to truncate
30
+ * @param {number} [maxChars=20000] - Maximum characters
31
+ * @returns {string} Truncated content
32
+ */
33
+ export function smartTruncate(content: string, maxChars?: number): string;
34
+ /**
35
+ * @typedef {Object} InferenceRequest
36
+ * @property {string} prompt - The prompt to send
37
+ * @property {'quick'|'thorough'} [mode='quick'] - Analysis mode
38
+ * @property {number} [maxTokens=1024] - Max output tokens
39
+ * @property {number} [temperature=0.1] - Temperature for generation
40
+ * @property {string} [preferredProvider] - Preferred provider (optional)
41
+ * @property {string} [preferredModel] - Preferred model (optional)
42
+ */
43
+ /**
44
+ * @typedef {Object} InferenceResponse
45
+ * @property {string} content - The generated content
46
+ * @property {Object} usage - Token usage
47
+ * @property {number} usage.input - Input tokens
48
+ * @property {number} usage.output - Output tokens
49
+ * @property {string} model - Model used
50
+ * @property {string} provider - Provider used
51
+ */
52
+ /**
53
+ * @typedef {Object} InferenceError
54
+ * @property {string} code - Error code
55
+ * @property {string} message - Error message
56
+ * @property {string} [provider] - Provider that failed
57
+ */
58
+ export class InferenceClientError extends Error {
59
+ /**
60
+ * @param {string} message
61
+ * @param {string} code
62
+ * @param {string} [provider]
63
+ * @param {unknown} [cause]
64
+ */
65
+ constructor(message: string, code: string, provider?: string, cause?: unknown);
66
+ code: string;
67
+ provider: string | undefined;
68
+ cause: unknown;
69
+ }
70
+ /**
71
+ * Strip markdown formatting for cleaner analysis
72
+ * Re-exported from readability.js for consistency
73
+ *
74
+ * @param {string} content - Markdown content
75
+ * @returns {string} Plain text content
76
+ */
77
+ export const stripMarkdown: typeof stripMarkdownForAnalysis;
78
+ export type InferenceRequest = {
79
+ /**
80
+ * - The prompt to send
81
+ */
82
+ prompt: string;
83
+ /**
84
+ * - Analysis mode
85
+ */
86
+ mode?: "quick" | "thorough" | undefined;
87
+ /**
88
+ * - Max output tokens
89
+ */
90
+ maxTokens?: number | undefined;
91
+ /**
92
+ * - Temperature for generation
93
+ */
94
+ temperature?: number | undefined;
95
+ /**
96
+ * - Preferred provider (optional)
97
+ */
98
+ preferredProvider?: string | undefined;
99
+ /**
100
+ * - Preferred model (optional)
101
+ */
102
+ preferredModel?: string | undefined;
103
+ };
104
+ export type InferenceResponse = {
105
+ /**
106
+ * - The generated content
107
+ */
108
+ content: string;
109
+ /**
110
+ * - Token usage
111
+ */
112
+ usage: {
113
+ input: number;
114
+ output: number;
115
+ };
116
+ /**
117
+ * - Model used
118
+ */
119
+ model: string;
120
+ /**
121
+ * - Provider used
122
+ */
123
+ provider: string;
124
+ };
125
+ export type InferenceError = {
126
+ /**
127
+ * - Error code
128
+ */
129
+ code: string;
130
+ /**
131
+ * - Error message
132
+ */
133
+ message: string;
134
+ /**
135
+ * - Provider that failed
136
+ */
137
+ provider?: string | undefined;
138
+ };
139
+ import { stripMarkdownForAnalysis } from '../utils/readability.js';