@xynolog/react-ui 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/README.md +26 -46
  2. package/package.json +12 -9
  3. package/src/components/Button/Button.tsx +0 -188
  4. package/src/components/Button/__tests__/Button.test.tsx +0 -449
  5. package/src/components/CodeMirrorRenderer.tsx +0 -536
  6. package/src/components/DelegateProgress.tsx +0 -308
  7. package/src/components/ErrorBoundary.tsx +0 -174
  8. package/src/components/ItemFoundLog.tsx +0 -42
  9. package/src/components/LiveRegion.tsx +0 -261
  10. package/src/components/ProtectedErrorBoundary.tsx +0 -114
  11. package/src/components/ResizeHandle.tsx +0 -167
  12. package/src/components/ResourceTagsInline.tsx +0 -120
  13. package/src/components/SessionExpiryBanner.tsx +0 -74
  14. package/src/components/SessionTimer.tsx +0 -17
  15. package/src/components/StatusDisplay.tsx +0 -131
  16. package/src/components/Toast.tsx +0 -217
  17. package/src/components/Toolbar.tsx +0 -194
  18. package/src/components/UserMenuSkeleton.tsx +0 -13
  19. package/src/components/__tests__/DelegateProgress.denominator.test.tsx +0 -102
  20. package/src/components/__tests__/DelegateProgress.test.tsx +0 -649
  21. package/src/components/__tests__/ErrorBoundary.test.tsx +0 -565
  22. package/src/components/__tests__/LiveRegion.a11y.test.tsx +0 -258
  23. package/src/components/__tests__/LiveRegion.hooks.test.tsx +0 -140
  24. package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +0 -225
  25. package/src/components/__tests__/ResizeHandle.test.tsx +0 -159
  26. package/src/components/__tests__/ResourceTagsInline.test.tsx +0 -325
  27. package/src/components/__tests__/SessionExpiryBanner.test.tsx +0 -124
  28. package/src/components/__tests__/SessionTimer.test.tsx +0 -199
  29. package/src/components/__tests__/StatusDisplay.test.tsx +0 -179
  30. package/src/components/__tests__/Toast.test.tsx +0 -96
  31. package/src/components/__tests__/Toolbar.test.tsx +0 -111
  32. package/src/components/__tests__/UserMenuSkeleton.test.tsx +0 -182
  33. package/src/components/annotation/AnchoredTextNotice.tsx +0 -36
  34. package/src/components/annotation/AnnotateToolbar.tsx +0 -531
  35. package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +0 -127
  36. package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +0 -304
  37. package/src/components/annotation-popups/JsonLdView.tsx +0 -127
  38. package/src/components/annotation-popups/SharedPopupElements.tsx +0 -131
  39. package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +0 -432
  40. package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +0 -297
  41. package/src/components/branding/XynologBranding.tsx +0 -41
  42. package/src/components/branding/__tests__/XynologBranding.test.tsx +0 -383
  43. package/src/components/error-states/ResourceErrorState.tsx +0 -30
  44. package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +0 -102
  45. package/src/components/image-annotation/AnnotationOverlay.tsx +0 -307
  46. package/src/components/image-annotation/SvgDrawingCanvas.tsx +0 -514
  47. package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +0 -169
  48. package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +0 -83
  49. package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +0 -228
  50. package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +0 -204
  51. package/src/components/layout/LeftSidebar.tsx +0 -150
  52. package/src/components/layout/PageLayout.tsx +0 -49
  53. package/src/components/layout/SkipLinks.tsx +0 -36
  54. package/src/components/layout/UnifiedHeader.tsx +0 -151
  55. package/src/components/layout/__tests__/LeftSidebar.test.tsx +0 -426
  56. package/src/components/layout/__tests__/PageLayout.test.tsx +0 -311
  57. package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +0 -218
  58. package/src/components/layout/__tests__/UnifiedHeader.test.tsx +0 -555
  59. package/src/components/loading-states/ComposeLoadingState.tsx +0 -19
  60. package/src/components/loading-states/ResourceLoadingState.tsx +0 -13
  61. package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +0 -37
  62. package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +0 -31
  63. package/src/components/modals/ComposeStep.tsx +0 -245
  64. package/src/components/modals/ConfigureGatherStep.tsx +0 -110
  65. package/src/components/modals/ConfigureGenerationStep.tsx +0 -458
  66. package/src/components/modals/ConfigureSearchStep.tsx +0 -124
  67. package/src/components/modals/ContextSummary.tsx +0 -317
  68. package/src/components/modals/CorpusPane.tsx +0 -96
  69. package/src/components/modals/DiscardPrompt.tsx +0 -44
  70. package/src/components/modals/GatherContextStep.tsx +0 -480
  71. package/src/components/modals/KbIdentityConflictModal.tsx +0 -122
  72. package/src/components/modals/KeyboardShortcutsHelpModal.tsx +0 -238
  73. package/src/components/modals/PermissionDeniedModal.tsx +0 -207
  74. package/src/components/modals/ReferenceWizardModal.tsx +0 -656
  75. package/src/components/modals/ResourceGenerateModal.tsx +0 -457
  76. package/src/components/modals/SearchModal.tsx +0 -334
  77. package/src/components/modals/SearchResultsStep.tsx +0 -117
  78. package/src/components/modals/SessionEndedModal.tsx +0 -148
  79. package/src/components/modals/WizardFooter.tsx +0 -72
  80. package/src/components/modals/__tests__/ComposeStep.test.tsx +0 -187
  81. package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +0 -92
  82. package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +0 -574
  83. package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +0 -124
  84. package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +0 -702
  85. package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +0 -102
  86. package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +0 -115
  87. package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +0 -218
  88. package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +0 -936
  89. package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +0 -532
  90. package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +0 -95
  91. package/src/components/modals/__tests__/SearchModal.basic.test.tsx +0 -84
  92. package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +0 -162
  93. package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +0 -237
  94. package/src/components/modals/__tests__/SearchModal.translations.test.tsx +0 -91
  95. package/src/components/modals/__tests__/SearchResultsStep.test.tsx +0 -95
  96. package/src/components/modals/__tests__/SessionEndedModal.test.tsx +0 -171
  97. package/src/components/modals/__tests__/WizardFooter.test.tsx +0 -446
  98. package/src/components/modals/__tests__/search-modal-harness.ts +0 -82
  99. package/src/components/navigation/CollapsibleResourceNavigation.tsx +0 -364
  100. package/src/components/navigation/NavigationMenu.tsx +0 -66
  101. package/src/components/navigation/ObservableLink.tsx +0 -90
  102. package/src/components/navigation/SimpleNavigation.tsx +0 -169
  103. package/src/components/navigation/SortableResourceTab.tsx +0 -122
  104. package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +0 -302
  105. package/src/components/navigation/__tests__/NavigationMenu.test.tsx +0 -399
  106. package/src/components/navigation/__tests__/ObservableLink.test.tsx +0 -85
  107. package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +0 -193
  108. package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +0 -421
  109. package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +0 -10
  110. package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +0 -632
  111. package/src/components/pdf-annotation/PdfPageView.tsx +0 -527
  112. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +0 -295
  113. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +0 -166
  114. package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +0 -1719
  115. package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +0 -61
  116. package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +0 -110
  117. package/src/components/pdf-annotation/estimate-slot-height.ts +0 -31
  118. package/src/components/pdf-annotation/rects-for-page.ts +0 -50
  119. package/src/components/resource/AnnotateView.tsx +0 -373
  120. package/src/components/resource/AnnotationHistory.tsx +0 -169
  121. package/src/components/resource/BrowseView.tsx +0 -440
  122. package/src/components/resource/DownloadFileLink.tsx +0 -53
  123. package/src/components/resource/HistoryEvent.tsx +0 -186
  124. package/src/components/resource/ResourceViewer.tsx +0 -617
  125. package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +0 -482
  126. package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +0 -78
  127. package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +0 -147
  128. package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +0 -143
  129. package/src/components/resource/__tests__/AnnotationHistory.test.tsx +0 -257
  130. package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +0 -123
  131. package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +0 -76
  132. package/src/components/resource/__tests__/BrowseView.links.test.tsx +0 -84
  133. package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +0 -165
  134. package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +0 -200
  135. package/src/components/resource/__tests__/BrowseView.registry.test.tsx +0 -57
  136. package/src/components/resource/__tests__/BrowseView.test.tsx +0 -915
  137. package/src/components/resource/__tests__/HistoryEvent.test.tsx +0 -571
  138. package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +0 -103
  139. package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +0 -250
  140. package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +0 -262
  141. package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +0 -166
  142. package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +0 -112
  143. package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +0 -207
  144. package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +0 -274
  145. package/src/components/resource/__tests__/annotation-interactions.test.tsx +0 -116
  146. package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +0 -183
  147. package/src/components/resource/__tests__/browse-renderers.test.tsx +0 -47
  148. package/src/components/resource/__tests__/download-link.test.tsx +0 -171
  149. package/src/components/resource/__tests__/event-formatting.test.ts +0 -379
  150. package/src/components/resource/__tests__/inline-embedding.test.tsx +0 -133
  151. package/src/components/resource/__tests__/media-completeness.test.tsx +0 -144
  152. package/src/components/resource/annotate-renderers.tsx +0 -186
  153. package/src/components/resource/browse-renderers.tsx +0 -133
  154. package/src/components/resource/event-formatting.ts +0 -393
  155. package/src/components/resource/panels/AssessmentEntry.tsx +0 -127
  156. package/src/components/resource/panels/AssessmentPanel.tsx +0 -309
  157. package/src/components/resource/panels/CollaborationPanel.tsx +0 -228
  158. package/src/components/resource/panels/CommentEntry.tsx +0 -242
  159. package/src/components/resource/panels/CommentsPanel.tsx +0 -320
  160. package/src/components/resource/panels/DelegateSection.tsx +0 -282
  161. package/src/components/resource/panels/DelegateShell.tsx +0 -134
  162. package/src/components/resource/panels/HighlightEntry.tsx +0 -83
  163. package/src/components/resource/panels/HighlightPanel.tsx +0 -212
  164. package/src/components/resource/panels/JsonLdPanel.tsx +0 -119
  165. package/src/components/resource/panels/PanelHeader.tsx +0 -22
  166. package/src/components/resource/panels/ReferenceEntry.tsx +0 -232
  167. package/src/components/resource/panels/ReferencesPanel.tsx +0 -626
  168. package/src/components/resource/panels/ResourceInfoPanel.tsx +0 -433
  169. package/src/components/resource/panels/StatisticsPanel.tsx +0 -145
  170. package/src/components/resource/panels/TagEntry.tsx +0 -87
  171. package/src/components/resource/panels/TaggingPanel.tsx +0 -554
  172. package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +0 -384
  173. package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +0 -292
  174. package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +0 -685
  175. package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +0 -685
  176. package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +0 -750
  177. package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +0 -877
  178. package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +0 -623
  179. package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +0 -212
  180. package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +0 -236
  181. package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +0 -506
  182. package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +0 -132
  183. package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +0 -230
  184. package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +0 -54
  185. package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +0 -578
  186. package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +0 -193
  187. package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +0 -193
  188. package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +0 -1080
  189. package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +0 -812
  190. package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +0 -106
  191. package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +0 -329
  192. package/src/components/resource/panels/__tests__/TagEntry.test.tsx +0 -250
  193. package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +0 -772
  194. package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +0 -207
  195. package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +0 -89
  196. package/src/components/resource/panels/__tests__/agent-label.test.ts +0 -136
  197. package/src/components/resource/panels/agent-label.ts +0 -35
  198. package/src/components/settings/SettingsPanel.tsx +0 -251
  199. package/src/components/settings/__tests__/SettingsPanel.test.tsx +0 -260
  200. package/src/components/viewers/ImageViewer.tsx +0 -18
  201. package/src/components/viewers/__tests__/ImageViewer.test.tsx +0 -57
  202. package/src/components/viewers/index.ts +0 -1
  203. package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +0 -181
  204. package/src/features/auth/components/AuthErrorDisplay.tsx +0 -89
  205. package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +0 -387
  206. package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +0 -161
  207. package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +0 -183
  208. package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +0 -73
  209. package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +0 -422
  210. package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +0 -117
  211. package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +0 -481
  212. package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +0 -161
  213. package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +0 -600
  214. package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +0 -256
  215. package/src/features/resource-compose/components/ResourceComposePage.tsx +0 -809
  216. package/src/features/resource-compose/components/UploadProgressBar.tsx +0 -125
  217. package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +0 -195
  218. package/src/features/resource-compose/state/compose-page-state-unit.ts +0 -187
  219. package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +0 -338
  220. package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +0 -449
  221. package/src/features/resource-discovery/components/ResourceCard.tsx +0 -80
  222. package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +0 -330
  223. package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +0 -477
  224. package/src/features/resource-discovery/state/discover-state-unit.ts +0 -162
  225. package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +0 -260
  226. package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +0 -570
  227. package/src/features/resource-viewer/__tests__/generation-params.test.ts +0 -49
  228. package/src/features/resource-viewer/components/ResourceViewerPage.tsx +0 -1058
  229. package/src/features/resource-viewer/generation-params.ts +0 -23
  230. package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +0 -77
  231. package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +0 -38
  232. package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +0 -178
  233. package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +0 -505
  234. package/src/features/resource-viewer/state/resource-loader-state-unit.ts +0 -93
  235. package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +0 -156
@@ -1,458 +0,0 @@
1
- 'use client';
2
-
3
- import React, { useEffect } from 'react';
4
- import { WizardFooter } from './WizardFooter';
5
- import type {
6
- EngineWithLimits,
7
- GatheredContext,
8
- GenerationJobParams,
9
- SupportedMediaType,
10
- } from '@xynolog/core';
11
- import {
12
- LOCALES,
13
- GENERATABLE_MEDIA_TYPES,
14
- capabilitiesOf,
15
- proposeStoragePath,
16
- } from '@xynolog/core';
17
-
18
- /**
19
- * Bounds for the max-length control when no ceiling is known — the fallback
20
- * is a bounded field, never an unbounded one.
21
- */
22
- const MIN_MAX_TOKENS = 100;
23
- const DEFAULT_MAX_TOKENS_CEILING = 4000;
24
- /** The step's form values, owned by the wizard so Back cannot discard them. */
25
- export interface GenerationDraft {
26
- title: string;
27
- /**
28
- * The path FRAGMENT the user types beside the `file://` prefix — not a URI.
29
- * (`GenerationConfig.storageUri` is the assembled one; the names differ
30
- * because the things differ.)
31
- */
32
- storagePath: string;
33
- prompt: string;
34
- language: string;
35
- temperature: number;
36
- /** Text, not number: the field is user-editable and may be mid-edit or empty. */
37
- maxTokensText: string;
38
- /** The artifact's media type. Seeded `text/markdown` by both hosts. */
39
- outputMediaType: SupportedMediaType;
40
- }
41
-
42
- /**
43
- * What this form fills in. Named here, but TYPED by the SDK.
44
- *
45
- * `storageUri` is on this list rather than a local `storagePath: string`
46
- * because a second name for the same thing is tied to nothing and diverges.
47
- * Under the job's own name, the page forwards the submitted config by spread,
48
- * so no field-by-field copy can drop one.
49
- */
50
- type FormFilled =
51
- 'title' | 'storageUri' | 'language' | 'maxTokens' | 'outputMediaType';
52
-
53
- /**
54
- * The submitted payload: a `yield` job's own params (`GenerationJobParams`),
55
- * DERIVED rather than restated, the grounding context among them.
56
- *
57
- * A hand-written interface listing the same fields with independent types
58
- * would be a second copy of a shape the spec owns, and such a copy drifts:
59
- * every consumer re-maps it by hand and silently drops whatever the mapping
60
- * forgets. Deriving means a rename or retype in `GenerationJobParams` is a
61
- * compile error here instead of a quiet gap at the wire.
62
- *
63
- * NARROWED on purpose: the job also takes `task`, `structure` and `cite`,
64
- * which this form does not collect, and a payload type that advertised them
65
- * would promise more than the UI delivers. Surfacing one later is a one-word
66
- * edit to `FormFilled` plus its control — the door is unlocked, not open.
67
- *
68
- * `Required` because the form always fills these, even where the job lets
69
- * them be absent; `prompt` stays optional, because a blank instruction field
70
- * is omitted rather than sent empty.
71
- */
72
- export type GenerationConfig = Required<Pick<GenerationJobParams, FormFilled>> &
73
- // `temperature` is deliberately not Required: a model that rejects the
74
- // parameter gets neither the slider nor the field, so the submission
75
- // carries it only when the serving model accepts it.
76
- Pick<GenerationJobParams, 'prompt' | 'temperature' | 'context'>;
77
-
78
- /** The one place a format's required extension is read. */
79
- const extensionFor = (format: SupportedMediaType): string =>
80
- capabilitiesOf(format)?.extension ?? '';
81
-
82
- /**
83
- * A fresh draft, defined ONCE for both hosts: a literal per modal — magic
84
- * numbers included — would make every new field two edits and an opportunity
85
- * to seed only one of them.
86
- */
87
- export const freshGenerationDraft = (
88
- title: string,
89
- locale: string,
90
- ): GenerationDraft => ({
91
- title,
92
- storagePath: '',
93
- prompt: '',
94
- language: locale,
95
- temperature: 0.7,
96
- maxTokensText: '500',
97
- // Markdown is the DEFAULT, not an assumption — the worker would also
98
- // default to it, but a control must send what it shows.
99
- outputMediaType: 'text/markdown',
100
- });
101
-
102
- export interface ConfigureGenerationStepProps {
103
- context: GatheredContext;
104
- /** Echo of the gather step's hint — the thing being steered stays visible. */
105
- hintEcho?: { label: string; value: string };
106
- /** Owned by the wizard so Back is lossless. */
107
- config: GenerationDraft;
108
- onConfigChange: (config: GenerationDraft) => void;
109
- /** Absent in a single-stack host, which has no Back — the footer then renders no retreat. */
110
- onBack?: () => void;
111
- onGenerate: (config: GenerationConfig) => void;
112
- /**
113
- * Folder of the resource being generated FROM, so the artifact lands beside
114
- * its source. The page derives it; this component stays presentational,
115
- * exactly as it already receives the default title.
116
- */
117
- defaultFolder?: string;
118
- translations: {
119
- resourceTitle: string;
120
- resourceTitlePlaceholder: string;
121
- saveLocation: string;
122
- additionalInstructions: string;
123
- additionalInstructionsPlaceholder: string;
124
- language: string;
125
- languageHelp: string;
126
- creativity: string;
127
- creativityFocused: string;
128
- creativityCreative: string;
129
- maxLength: string;
130
- maxLengthHelp: string;
131
- /**
132
- * Shown INSTEAD of `maxLengthHelp` when the ceiling is known, so the bound
133
- * is legible rather than mysterious. Interpolates `{{maxOutputTokens}}`
134
- * and `{{model}}`.
135
- */
136
- maxLengthCeiling: string;
137
- /** Label for the output-format select. */
138
- outputFormat: string;
139
- /**
140
- * Shown when the Save location's extension contradicts the chosen format,
141
- * which the form REFUSES to submit (the worker is faithful and will write
142
- * a PDF to a `.md` path, so this is the only gate). Interpolates
143
- * `{{extension}}`.
144
- */
145
- formatExtensionMismatch: string;
146
- back?: string;
147
- generate: string;
148
- };
149
- /**
150
- * The engine used for `yield` jobs (from `useEngines`). When its
151
- * `limits` are known the max-length control is hard-bounded by the model's
152
- * output ceiling; absent — or present without `limits`, which is normal when
153
- * discovery could not answer right now — the control keeps its default
154
- * bounds and generation still submits.
155
- */
156
- generationEngine?: EngineWithLimits;
157
- }
158
-
159
- export function ConfigureGenerationStep({
160
- context,
161
- hintEcho,
162
- config,
163
- onConfigChange,
164
- onBack,
165
- onGenerate,
166
- defaultFolder = '',
167
- translations: t,
168
- generationEngine,
169
- }: ConfigureGenerationStepProps) {
170
- // CONTROLLED: Back unmounts the step, and local `useState`s would throw away
171
- // every typed instruction, the save path and both sliders with it.
172
- // `maxTokensText` stays TEXT rather than a number so the field can be cleared
173
- // mid-edit — `parseInt` on an empty field yields NaN, which React warns about
174
- // and which would travel into the job config.
175
- const {
176
- title,
177
- storagePath,
178
- prompt,
179
- language,
180
- temperature,
181
- maxTokensText,
182
- outputMediaType,
183
- } = config;
184
- const set = (patch: Partial<GenerationDraft>) =>
185
- onConfigChange({ ...config, ...patch });
186
-
187
- // The Save location starts filled and FOLLOWS the title and format until
188
- // the user takes it over. `pathTouched` is DERIVED rather than stored:
189
- // it is exactly "the field holds the user's own text", which makes clearing
190
- // the field un-touch it for free, keeps it reset-on-open and Back-safe
191
- // because `storagePath` already is, and leaves no second field to desync.
192
- const pathTouched = storagePath !== '';
193
- const proposedPath = proposeStoragePath(
194
- defaultFolder,
195
- title,
196
- outputMediaType,
197
- );
198
- const effectivePath = pathTouched ? storagePath : proposedPath;
199
-
200
- // The GUI is where a format/extension mismatch is caught, because it is
201
- // where the person who can fix it is standing. An EMPTY path is not a
202
- // mismatch: the field is `required`, so emptiness is already refused, and
203
- // telling an untouched form it is wrong is not a welcome. A PROPOSED path
204
- // always carries the format's extension, so this fires only on hand-edits.
205
- const requiredExtension = extensionFor(outputMediaType);
206
- const extensionMismatch =
207
- effectivePath !== '' &&
208
- !effectivePath.toLowerCase().endsWith(requiredExtension.toLowerCase());
209
-
210
- const ceiling =
211
- generationEngine?.limits?.maxOutputTokens ?? DEFAULT_MAX_TOKENS_CEILING;
212
-
213
- // claude-sonnet-5 refuses EVERY non-default temperature — the untouched 0.7
214
- // default included — so a rejecting model gets neither the control nor the
215
- // field, and no control silently does nothing. Only an explicit false hides
216
- // it: absent discovery means no claim, and the inference client suppresses
217
- // as the second line of defense either way.
218
- const temperatureAccepted =
219
- generationEngine?.limits?.acceptsTemperature !== false;
220
-
221
- /**
222
- * The value that will actually be submitted: always finite, always inside
223
- * the bounds, whatever the field currently shows.
224
- */
225
- const clamp = (n: number): number =>
226
- Math.min(
227
- Math.max(Number.isFinite(n) ? n : MIN_MAX_TOKENS, MIN_MAX_TOKENS),
228
- ceiling,
229
- );
230
-
231
- const submittedMaxTokens = clamp(parseInt(maxTokensText, 10));
232
-
233
- // Re-clamp whenever the ceiling changes — which INCLUDES its first arrival.
234
- // `browse.engines()` is asynchronous, so `generationEngine` is undefined on the
235
- // first render and lands later; clamping only in the `useState` initializer
236
- // would satisfy a mount-time test and do nothing in the running app.
237
- useEffect(() => {
238
- const n = parseInt(maxTokensText, 10);
239
- // An empty/mid-edit field is left alone; submission clamps it anyway.
240
- if (Number.isFinite(n) && n > ceiling)
241
- set({ maxTokensText: String(ceiling) });
242
- // `set` and the draft are intentionally out of the dep list: this reacts to the
243
- // CEILING arriving (browse.engines() is async), not to the user typing.
244
- // eslint-disable-next-line react-hooks/exhaustive-deps
245
- }, [ceiling]);
246
-
247
- const handleSubmit = (e: React.FormEvent) => {
248
- e.preventDefault();
249
- if (extensionMismatch) return;
250
- const trimmedPrompt = prompt.trim();
251
- onGenerate({
252
- title,
253
- storageUri: `file://${effectivePath}`,
254
- ...(trimmedPrompt ? { prompt: trimmedPrompt } : {}),
255
- language,
256
- ...(temperatureAccepted ? { temperature } : {}),
257
- maxTokens: submittedMaxTokens,
258
- outputMediaType,
259
- context,
260
- });
261
- };
262
-
263
- return (
264
- // No --scrollable: this form renders below the evidence display inside the
265
- // host's single step-scroll pane — an independent scroll region here
266
- // squeezes the parameters out of view.
267
- <form onSubmit={handleSubmit} className="xynolog-form">
268
- {hintEcho && (
269
- <p className="xynolog-wizard__hint-echo">
270
- {hintEcho.label}: {hintEcho.value}
271
- </p>
272
- )}
273
- {/* Resource Title */}
274
- <div className="xynolog-form__field">
275
- <label htmlFor="wizard-title" className="xynolog-form__label">
276
- {t.resourceTitle}
277
- </label>
278
- <input
279
- id="wizard-title"
280
- type="text"
281
- value={title}
282
- onChange={(e) => set({ title: e.target.value })}
283
- required
284
- className="xynolog-input"
285
- placeholder={t.resourceTitlePlaceholder}
286
- />
287
- </div>
288
-
289
- {/* Storage URI */}
290
- <div className="xynolog-form__field">
291
- <label htmlFor="wizard-storagePath" className="xynolog-form__label">
292
- {t.saveLocation}
293
- </label>
294
- <div className="xynolog-input-addon">
295
- <span className="xynolog-input-addon__prefix">file://</span>
296
- <input
297
- id="wizard-storagePath"
298
- type="text"
299
- value={effectivePath}
300
- onChange={(e) => set({ storagePath: e.target.value })}
301
- required
302
- aria-invalid={extensionMismatch}
303
- {...(extensionMismatch
304
- ? { 'aria-describedby': 'wizard-format-mismatch' }
305
- : {})}
306
- className="xynolog-input xynolog-input--addon"
307
- placeholder="generated/my-resource.md"
308
- />
309
- </div>
310
- {/* The reason sits with the field, not on the button: the message
311
- belongs where the fix is. */}
312
- {extensionMismatch && (
313
- <p
314
- id="wizard-format-mismatch"
315
- className="xynolog-form__error"
316
- role="alert"
317
- >
318
- {t.formatExtensionMismatch.replace(
319
- '{{extension}}',
320
- requiredExtension,
321
- )}
322
- </p>
323
- )}
324
- </div>
325
-
326
- {/* Output format — with the artifact's IDENTITY (title, location), not
327
- among the model knobs below. The options are DERIVED from the
328
- registry: promote a fourth row to `generatable` and it appears
329
- here, with no list to forget to update. */}
330
- <div className="xynolog-form__field">
331
- <label htmlFor="wizard-outputFormat" className="xynolog-form__label">
332
- {t.outputFormat}
333
- </label>
334
- <select
335
- id="wizard-outputFormat"
336
- value={outputMediaType}
337
- onChange={(e) =>
338
- set({ outputMediaType: e.target.value as SupportedMediaType })
339
- }
340
- className="xynolog-select"
341
- >
342
- {GENERATABLE_MEDIA_TYPES.map((format) => (
343
- <option key={format} value={format}>
344
- {capabilitiesOf(format)?.label ?? format}
345
- </option>
346
- ))}
347
- </select>
348
- </div>
349
-
350
- {/* Additional Instructions */}
351
- <div className="xynolog-form__field">
352
- <label htmlFor="wizard-prompt" className="xynolog-form__label">
353
- {t.additionalInstructions}
354
- </label>
355
- <textarea
356
- id="wizard-prompt"
357
- value={prompt}
358
- onChange={(e) => set({ prompt: e.target.value })}
359
- rows={2}
360
- className="xynolog-textarea"
361
- placeholder={t.additionalInstructionsPlaceholder}
362
- />
363
- </div>
364
-
365
- {/* Language / Creativity / Max Length — compact inline row */}
366
- <div className="xynolog-form__inline-row">
367
- <div className="xynolog-form__field xynolog-form__field--inline">
368
- <label htmlFor="wizard-language" className="xynolog-form__label">
369
- {t.language}
370
- </label>
371
- <select
372
- id="wizard-language"
373
- value={language}
374
- onChange={(e) => set({ language: e.target.value })}
375
- className="xynolog-select"
376
- >
377
- {LOCALES.map((lang) => (
378
- <option key={lang.code} value={lang.code}>
379
- {lang.nativeName}
380
- </option>
381
- ))}
382
- </select>
383
- </div>
384
-
385
- {temperatureAccepted && (
386
- <div className="xynolog-form__field xynolog-form__field--inline xynolog-form__field--slider">
387
- <label htmlFor="wizard-temperature" className="xynolog-form__label">
388
- {t.creativity} ({temperature.toFixed(1)})
389
- </label>
390
- <input
391
- id="wizard-temperature"
392
- type="range"
393
- min="0"
394
- max="1"
395
- step="0.1"
396
- value={temperature}
397
- onChange={(e) => set({ temperature: parseFloat(e.target.value) })}
398
- className="xynolog-slider"
399
- />
400
- <div className="xynolog-slider__labels xynolog-slider__labels--small">
401
- <span>{t.creativityFocused}</span>
402
- <span>{t.creativityCreative}</span>
403
- </div>
404
- </div>
405
- )}
406
-
407
- <div className="xynolog-form__field xynolog-form__field--inline xynolog-form__field--narrow xynolog-form__field--end">
408
- <label htmlFor="wizard-maxTokens" className="xynolog-form__label">
409
- {t.maxLength}
410
- </label>
411
- <input
412
- id="wizard-maxTokens"
413
- type="number"
414
- min={MIN_MAX_TOKENS}
415
- max={ceiling}
416
- step="100"
417
- value={maxTokensText}
418
- onChange={(e) => {
419
- const raw = e.target.value;
420
- // Empty is a legitimate transient state while retyping.
421
- if (raw === '') {
422
- set({ maxTokensText: '' });
423
- return;
424
- }
425
- const n = parseInt(raw, 10);
426
- if (!Number.isFinite(n)) return;
427
- // `max` alone does not stop a larger value being typed — it only
428
- // marks the field invalid. A value above the ceiling must not be
429
- // enterable at all, so the clamp lives here.
430
- set({ maxTokensText: String(Math.min(n, ceiling)) });
431
- }}
432
- className="xynolog-input"
433
- />
434
- </div>
435
- </div>
436
-
437
- {/* The bound, as a full sentence — which is why it lives UNDER the row,
438
- never inside the 5.5rem Max Length column: a sentence in that box
439
- wraps one word per line and its height taxes the whole flex row. */}
440
- <p className="xynolog-form__help xynolog-form__help--row">
441
- {generationEngine?.limits
442
- ? t.maxLengthCeiling
443
- .replace('{{maxOutputTokens}}', String(ceiling))
444
- .replace('{{model}}', generationEngine.engine.model)
445
- : t.maxLengthHelp}
446
- </p>
447
-
448
- <WizardFooter
449
- {...(onBack && t.back ? { backLabel: t.back, onBack } : {})}
450
- primary={{
451
- label: t.generate,
452
- type: 'submit',
453
- disabled: extensionMismatch,
454
- }}
455
- />
456
- </form>
457
- );
458
- }
@@ -1,124 +0,0 @@
1
- 'use client';
2
-
3
- import React from 'react';
4
- import { WizardFooter } from './WizardFooter';
5
-
6
- export interface SearchConfig {
7
- limit: number;
8
- useSemanticScoring: boolean;
9
- }
10
-
11
- export interface ConfigureSearchStepProps {
12
- /**
13
- * CONTROLLED. Stepping Back unmounts the component, so local `useState` would
14
- * silently discard what the user had chosen — a Back button that costs you
15
- * work is worse than no Back button, because it invites the press. The
16
- * wizard owns it for the modal's lifetime.
17
- */
18
- config: SearchConfig;
19
- /** Echo of the gather step's hint — the thing being steered stays visible. */
20
- hintEcho?: { label: string; value: string };
21
- onConfigChange: (config: SearchConfig) => void;
22
- isSearching?: boolean;
23
- /** A settled failure (emit refused, matcher error, timeout) — the spinner
24
- * must never outlive the request that fed it. */
25
- searchError?: string | null;
26
- onBack: () => void;
27
- onSearch: (config: SearchConfig) => void;
28
- translations: {
29
- maxResults: string;
30
- semanticScoring: string;
31
- semanticScoringHelp: string;
32
- back: string;
33
- search: string;
34
- searching: string;
35
- searchFailed: string;
36
- };
37
- }
38
-
39
- export function ConfigureSearchStep({
40
- config,
41
- hintEcho,
42
- onConfigChange,
43
- isSearching = false,
44
- searchError = null,
45
- onBack,
46
- onSearch,
47
- translations: t,
48
- }: ConfigureSearchStepProps) {
49
- const handleSubmit = (e: React.FormEvent) => {
50
- e.preventDefault();
51
- onSearch(config);
52
- };
53
-
54
- return (
55
- <form onSubmit={handleSubmit} className="xynolog-form">
56
- {hintEcho && (
57
- <p className="xynolog-wizard__hint-echo">
58
- {hintEcho.label}: {hintEcho.value}
59
- </p>
60
- )}
61
- {/* Max Results */}
62
- <div className="xynolog-form__field">
63
- <label htmlFor="wizard-limit" className="xynolog-form__label">
64
- {t.maxResults}
65
- </label>
66
- <select
67
- id="wizard-limit"
68
- value={config.limit}
69
- onChange={(e) =>
70
- onConfigChange({ ...config, limit: parseInt(e.target.value) })
71
- }
72
- className="xynolog-select"
73
- >
74
- <option value={1}>1</option>
75
- <option value={5}>5</option>
76
- <option value={10}>10</option>
77
- <option value={20}>20</option>
78
- </select>
79
- </div>
80
-
81
- {/* Semantic Scoring Toggle */}
82
- <div className="xynolog-form__field">
83
- <label className="xynolog-form__label xynolog-form__label--inline">
84
- <input
85
- type="checkbox"
86
- checked={config.useSemanticScoring}
87
- onChange={(e) =>
88
- onConfigChange({
89
- ...config,
90
- useSemanticScoring: e.target.checked,
91
- })
92
- }
93
- />
94
- {t.semanticScoring}
95
- </label>
96
- <p className="xynolog-form__help">{t.semanticScoringHelp}</p>
97
- </div>
98
-
99
- {searchError && (
100
- <div
101
- role="alert"
102
- style={{
103
- textAlign: 'center',
104
- padding: '0.5rem 0',
105
- color: 'var(--xynolog-color-red-600)',
106
- }}
107
- >
108
- {t.searchFailed}: {searchError}
109
- </div>
110
- )}
111
-
112
- <WizardFooter
113
- backLabel={t.back}
114
- onBack={onBack}
115
- primary={{
116
- label: t.search,
117
- pendingLabel: t.searching,
118
- pending: isSearching,
119
- type: 'submit',
120
- }}
121
- />
122
- </form>
123
- );
124
- }