@orkg/scidquest 1.1.0 → 1.1.4

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 (62) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/pdf.worker.min.mjs +28 -0
  3. package/dist/components/AI/AIConfigurationButton.d.ts +3 -0
  4. package/dist/components/AI/AIConfigurationDialog.d.ts +7 -0
  5. package/dist/components/TemplateQuestionaire/AIAssistantButton.d.ts +33 -0
  6. package/dist/components/TemplateQuestionaire/BufferedTextField.d.ts +19 -0
  7. package/dist/components/TemplateQuestionaire/FieldRow.d.ts +8 -0
  8. package/dist/components/TemplateQuestionaire/ImportDialog.d.ts +12 -0
  9. package/dist/components/TemplateQuestionaire/InfoTooltip.d.ts +7 -0
  10. package/dist/components/TemplateQuestionaire/InlineValidationFeedback.d.ts +8 -0
  11. package/dist/components/TemplateQuestionaire/NodeWrapper.d.ts +8 -0
  12. package/dist/components/TemplateQuestionaire/QuestionnaireAIHistoryDialog.d.ts +15 -0
  13. package/dist/components/TemplateQuestionaire/Questions/GroupQuestion.d.ts +30 -0
  14. package/dist/components/TemplateQuestionaire/Questions/MultiSelectQuestion.d.ts +31 -0
  15. package/dist/components/TemplateQuestionaire/Questions/QuestionRenderer.d.ts +32 -0
  16. package/dist/components/TemplateQuestionaire/Questions/RepeatGroupQuestion.d.ts +30 -0
  17. package/dist/components/TemplateQuestionaire/Questions/RepeatTextQuestion.d.ts +31 -0
  18. package/dist/components/TemplateQuestionaire/Questions/SelectQuestion.d.ts +31 -0
  19. package/dist/components/TemplateQuestionaire/Questions/TextQuestion.d.ts +32 -0
  20. package/dist/components/TemplateQuestionaire/SectionAccordion.d.ts +42 -0
  21. package/dist/components/TemplateQuestionaire/SuggestionBox.d.ts +30 -0
  22. package/dist/components/TemplateQuestionaire/TopSummaryBar.d.ts +43 -0
  23. package/dist/components/TemplateQuestionaire/ValidationStatusButton.d.ts +33 -0
  24. package/dist/context/QuestionnaireAIContext.d.ts +48 -0
  25. package/dist/hooks/useSuggestionGenerator.d.ts +30 -0
  26. package/dist/lib/adapter.d.ts +3 -0
  27. package/dist/lib/components/PDFUpload.d.ts +10 -0
  28. package/dist/lib/components/PdfViewer.d.ts +27 -0
  29. package/dist/lib/components/ResearchQuestionnaireApp.d.ts +32 -0
  30. package/dist/lib/components/ResearchQuestionnaireFieldAiWrapper.d.ts +25 -0
  31. package/dist/lib/components/TemplateQuestionnaire.d.ts +27 -0
  32. package/dist/lib/context.d.ts +14 -0
  33. package/dist/lib/hooks/useSuggestionGenerator.d.ts +26 -0
  34. package/dist/lib/index.d.ts +25 -0
  35. package/dist/lib/questionnaire-template-helpers.d.ts +10 -0
  36. package/dist/lib/research-questionnaire-workspace.d.ts +33 -0
  37. package/dist/lib/types.d.ts +121 -0
  38. package/dist/lib/utils/createLLMServiceFromAIService.d.ts +3 -0
  39. package/dist/scidquest.es.js +6441 -64432
  40. package/dist/semanticChunker-CNi7GgV8.js +84 -0
  41. package/dist/services/aiService.d.ts +39 -0
  42. package/dist/services/backendAIService.d.ts +191 -0
  43. package/dist/store/hooks.d.ts +4 -0
  44. package/dist/store/slices/aiSlice.d.ts +21 -0
  45. package/dist/store/store.d.ts +9 -0
  46. package/dist/types/context.d.ts +39 -0
  47. package/dist/utils/contextGatherer.d.ts +39 -0
  48. package/dist/utils/fuzzyPdfMatcher.d.ts +15 -0
  49. package/dist/utils/pdf.d.ts +25 -0
  50. package/dist/utils/pdfWorker.d.ts +10 -0
  51. package/dist/utils/robustPdfMatcher.d.ts +22 -0
  52. package/dist/utils/semanticChunker.d.ts +27 -0
  53. package/dist/utils/simplePdfMatcher.d.ts +13 -0
  54. package/dist/utils/structuredPdfExtractor.d.ts +34 -0
  55. package/dist/utils/suggestions.d.ts +88 -0
  56. package/dist/utils/theme.d.ts +6 -0
  57. package/dist/utils/tokenEstimator.d.ts +32 -0
  58. package/dist/utils/tokenPdfMatcher.d.ts +14 -0
  59. package/dist/utils/unicodeNormalizer.d.ts +13 -0
  60. package/dist/utils/validationRules.d.ts +51 -0
  61. package/package.json +30 -8
  62. package/dist/semanticChunker-CEckDeUn.js +0 -102
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const AIConfigurationButton: React.FC;
3
+ export default AIConfigurationButton;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface AIConfigurationDialogProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ }
6
+ declare const AIConfigurationDialog: React.FC<AIConfigurationDialogProps>;
7
+ export default AIConfigurationDialog;
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { type AIVerificationResult } from '../../lib/types';
3
+ import { type Suggestion } from '../../utils/suggestions';
4
+ import { type StructuredDocument } from '../../utils/structuredPdfExtractor';
5
+ import type { ParentContext } from '../../types/context';
6
+ interface AIAssistantButtonProps {
7
+ questionId: string;
8
+ questionText: string;
9
+ questionType: 'text' | 'select' | 'multi_select' | 'repeat_text' | 'group';
10
+ questionOptions?: string[];
11
+ currentAnswer: string;
12
+ onSuggestionsGenerated: (suggestions: Suggestion[]) => void;
13
+ onVerificationComplete?: (result: AIVerificationResult) => void;
14
+ onError?: (error: string) => void;
15
+ disabled?: boolean;
16
+ pdfContent?: string;
17
+ structuredDocument?: StructuredDocument | null;
18
+ isProcessingPdf?: boolean;
19
+ context?: string;
20
+ hasSuggestions?: boolean;
21
+ parentContext?: ParentContext;
22
+ allAnswers?: Record<string, any>;
23
+ siblingQuestionIds?: string[];
24
+ questionDefinitions?: Record<string, any>;
25
+ allEntries?: any[];
26
+ currentEntryIndex?: number;
27
+ }
28
+ export interface AIAssistantButtonRef {
29
+ triggerSuggestion: () => Promise<void>;
30
+ triggerVerification: () => Promise<void>;
31
+ }
32
+ declare const AIAssistantButton: React.ForwardRefExoticComponent<AIAssistantButtonProps & React.RefAttributes<AIAssistantButtonRef>>;
33
+ export default AIAssistantButton;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { TextFieldProps } from '@mui/material/TextField';
3
+ type Props = {
4
+ value: string;
5
+ onCommit: (v: string) => void;
6
+ size?: 'small' | 'medium';
7
+ fullWidth?: boolean;
8
+ id?: string;
9
+ placeholder?: string;
10
+ debounceMs?: number;
11
+ commitOnBlurOnly?: boolean;
12
+ error?: boolean;
13
+ sx?: TextFieldProps['sx'];
14
+ 'aria-label'?: string;
15
+ 'aria-required'?: boolean;
16
+ 'aria-describedby'?: string;
17
+ };
18
+ declare const BufferedTextField: React.FC<Props>;
19
+ export default BufferedTextField;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ children: React.ReactNode;
4
+ label?: string;
5
+ desc?: string;
6
+ };
7
+ declare const FieldRow: React.FC<Props>;
8
+ export default FieldRow;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ interface ImportDialogProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ onConfirm: (mode: 'replace' | 'merge') => void;
6
+ fileName: string;
7
+ importData: Record<string, any> | null;
8
+ error: string | null;
9
+ isValidating: boolean;
10
+ }
11
+ declare const ImportDialog: React.FC<ImportDialogProps>;
12
+ export default ImportDialog;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ desc?: string;
4
+ label?: string;
5
+ };
6
+ declare const InfoTooltip: React.FC<Props>;
7
+ export default InfoTooltip;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface InlineValidationFeedbackProps {
3
+ error?: string | null;
4
+ warning?: string | null;
5
+ success?: string | null;
6
+ }
7
+ declare const InlineValidationFeedback: React.FC<InlineValidationFeedbackProps>;
8
+ export default InlineValidationFeedback;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ level?: number;
4
+ children?: React.ReactNode;
5
+ sx?: any;
6
+ };
7
+ declare const NodeWrapper: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
8
+ export default NodeWrapper;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ interface QuestionnaireAIHistoryDialogProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ currentQuestionId?: string;
6
+ }
7
+ export interface AIContextPreferences {
8
+ enableSearch: boolean;
9
+ categorizeBySection: boolean;
10
+ compactView: boolean;
11
+ defaultSortOrder: 'newest' | 'oldest' | 'relevance';
12
+ }
13
+ export type AIContextSection = 'Suggestions' | 'Verifications' | 'Applied Answers' | 'Other Context';
14
+ declare const QuestionnaireAIHistoryDialog: React.FC<QuestionnaireAIHistoryDialogProps>;
15
+ export default QuestionnaireAIHistoryDialog;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import type { AIVerificationResult } from '../../../services/backendAIService';
3
+ import type { StructuredDocument } from '../../../utils/structuredPdfExtractor';
4
+ import type { ParentContext } from '../../../types/context';
5
+ declare const GroupQuestion: React.FC<{
6
+ q: any;
7
+ value: any;
8
+ onChange: (v: any) => void;
9
+ idAttr?: string;
10
+ level?: number;
11
+ pdfContent?: string;
12
+ structuredDocument?: StructuredDocument | null;
13
+ onNavigateToPage?: (pageNumber: number) => void;
14
+ onHighlightsChange?: (highlights: Record<number, {
15
+ left: number;
16
+ top: number;
17
+ width: number;
18
+ height: number;
19
+ }[]>) => void;
20
+ pdfUrl?: string | null;
21
+ pageWidth?: number | null;
22
+ onAIVerificationComplete?: (result: AIVerificationResult) => void;
23
+ parentContext?: ParentContext;
24
+ allAnswers?: Record<string, any>;
25
+ siblingQuestionIds?: string[];
26
+ questionDefinitions?: Record<string, any>;
27
+ allEntries?: any[];
28
+ currentEntryIndex?: number;
29
+ }>;
30
+ export default GroupQuestion;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import type { AIVerificationResult } from '../../../services/backendAIService';
3
+ import type { StructuredDocument } from '../../../utils/structuredPdfExtractor';
4
+ import type { ParentContext } from '../../../types/context';
5
+ declare const MultiSelectQuestion: React.FC<{
6
+ q: any;
7
+ value: any;
8
+ onChange: (v: any) => void;
9
+ idAttr?: string;
10
+ level?: number;
11
+ pdfContent?: string;
12
+ structuredDocument?: StructuredDocument | null;
13
+ onNavigateToPage?: (pageNumber: number) => void;
14
+ onHighlightsChange?: (highlights: Record<number, {
15
+ left: number;
16
+ top: number;
17
+ width: number;
18
+ height: number;
19
+ }[]>) => void;
20
+ pdfUrl?: string | null;
21
+ pageWidth?: number | null;
22
+ questionRef?: (element: HTMLElement | null) => void;
23
+ onAIVerificationComplete?: (result: AIVerificationResult) => void;
24
+ parentContext?: ParentContext;
25
+ allAnswers?: Record<string, any>;
26
+ siblingQuestionIds?: string[];
27
+ questionDefinitions?: Record<string, any>;
28
+ allEntries?: any[];
29
+ currentEntryIndex?: number;
30
+ }>;
31
+ export default MultiSelectQuestion;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { AIVerificationResult } from '../../../services/backendAIService';
3
+ import type { StructuredDocument } from '../../../utils/structuredPdfExtractor';
4
+ import type { ParentContext } from '../../../types/context';
5
+ declare const QuestionRenderer: React.FC<{
6
+ q: any;
7
+ value: any;
8
+ onChange: (v: any) => void;
9
+ idAttr?: string;
10
+ level?: number;
11
+ pdfContent?: string;
12
+ structuredDocument?: StructuredDocument | null;
13
+ onNavigateToPage?: (pageNumber: number) => void;
14
+ onHighlightsChange?: (highlights: Record<number, {
15
+ left: number;
16
+ top: number;
17
+ width: number;
18
+ height: number;
19
+ }[]>) => void;
20
+ pdfUrl?: string | null;
21
+ pageWidth?: number | null;
22
+ validationError?: string | null;
23
+ questionRef?: (element: HTMLElement | null) => void;
24
+ onAIVerificationComplete?: (result: AIVerificationResult) => void;
25
+ parentContext?: ParentContext;
26
+ allAnswers?: Record<string, any>;
27
+ siblingQuestionIds?: string[];
28
+ questionDefinitions?: Record<string, any>;
29
+ allEntries?: any[];
30
+ currentEntryIndex?: number;
31
+ }>;
32
+ export default QuestionRenderer;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import type { AIVerificationResult } from '../../../services/backendAIService';
3
+ import type { StructuredDocument } from '../../../utils/structuredPdfExtractor';
4
+ import type { ParentContext } from '../../../types/context';
5
+ declare const RepeatGroupQuestion: React.FC<{
6
+ q: any;
7
+ value: any;
8
+ onChange: (v: any) => void;
9
+ idAttr?: string;
10
+ level?: number;
11
+ pdfContent?: string;
12
+ structuredDocument?: StructuredDocument | null;
13
+ onNavigateToPage?: (pageNumber: number) => void;
14
+ onHighlightsChange?: (highlights: Record<number, {
15
+ left: number;
16
+ top: number;
17
+ width: number;
18
+ height: number;
19
+ }[]>) => void;
20
+ pdfUrl?: string | null;
21
+ pageWidth?: number | null;
22
+ onAIVerificationComplete?: (result: AIVerificationResult) => void;
23
+ parentContext?: ParentContext;
24
+ allAnswers?: Record<string, any>;
25
+ siblingQuestionIds?: string[];
26
+ questionDefinitions?: Record<string, any>;
27
+ allEntries?: any[];
28
+ currentEntryIndex?: number;
29
+ }>;
30
+ export default RepeatGroupQuestion;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import type { AIVerificationResult } from '../../../services/backendAIService';
3
+ import type { StructuredDocument } from '../../../utils/structuredPdfExtractor';
4
+ import type { ParentContext } from '../../../types/context';
5
+ declare const RepeatTextQuestion: React.FC<{
6
+ q: any;
7
+ value: any;
8
+ onChange: (v: any) => void;
9
+ idAttr?: string;
10
+ level?: number;
11
+ pdfContent?: string;
12
+ structuredDocument?: StructuredDocument | null;
13
+ onNavigateToPage?: (pageNumber: number) => void;
14
+ onHighlightsChange?: (highlights: Record<number, {
15
+ left: number;
16
+ top: number;
17
+ width: number;
18
+ height: number;
19
+ }[]>) => void;
20
+ pdfUrl?: string | null;
21
+ pageWidth?: number | null;
22
+ questionRef?: (element: HTMLElement | null) => void;
23
+ onAIVerificationComplete?: (result: AIVerificationResult) => void;
24
+ parentContext?: ParentContext;
25
+ allAnswers?: Record<string, any>;
26
+ siblingQuestionIds?: string[];
27
+ questionDefinitions?: Record<string, any>;
28
+ allEntries?: any[];
29
+ currentEntryIndex?: number;
30
+ }>;
31
+ export default RepeatTextQuestion;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import type { AIVerificationResult } from '../../../services/backendAIService';
3
+ import type { StructuredDocument } from '../../../utils/structuredPdfExtractor';
4
+ import type { ParentContext } from '../../../types/context';
5
+ declare const SelectQuestion: React.FC<{
6
+ q: any;
7
+ value: any;
8
+ onChange: (v: any) => void;
9
+ idAttr?: string;
10
+ level?: number;
11
+ pdfContent?: string;
12
+ structuredDocument?: StructuredDocument | null;
13
+ onNavigateToPage?: (pageNumber: number) => void;
14
+ onHighlightsChange?: (highlights: Record<number, {
15
+ left: number;
16
+ top: number;
17
+ width: number;
18
+ height: number;
19
+ }[]>) => void;
20
+ pdfUrl?: string | null;
21
+ pageWidth?: number | null;
22
+ questionRef?: (element: HTMLElement | null) => void;
23
+ onAIVerificationComplete?: (result: AIVerificationResult) => void;
24
+ parentContext?: ParentContext;
25
+ allAnswers?: Record<string, any>;
26
+ siblingQuestionIds?: string[];
27
+ questionDefinitions?: Record<string, any>;
28
+ allEntries?: any[];
29
+ currentEntryIndex?: number;
30
+ }>;
31
+ export default SelectQuestion;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { AIVerificationResult } from '../../../services/backendAIService';
3
+ import type { StructuredDocument } from '../../../utils/structuredPdfExtractor';
4
+ import type { ParentContext } from '../../../types/context';
5
+ declare const TextQuestion: React.FC<{
6
+ q: any;
7
+ value: any;
8
+ onChange: (v: any) => void;
9
+ idAttr?: string;
10
+ level?: number;
11
+ pdfContent?: string;
12
+ structuredDocument?: StructuredDocument | null;
13
+ onNavigateToPage?: (pageNumber: number) => void;
14
+ onHighlightsChange?: (highlights: Record<number, {
15
+ left: number;
16
+ top: number;
17
+ width: number;
18
+ height: number;
19
+ }[]>) => void;
20
+ pdfUrl?: string | null;
21
+ pageWidth?: number | null;
22
+ validationError?: string | null;
23
+ questionRef?: (element: HTMLElement | null) => void;
24
+ onAIVerificationComplete?: (result: AIVerificationResult) => void;
25
+ parentContext?: ParentContext;
26
+ allAnswers?: Record<string, any>;
27
+ siblingQuestionIds?: string[];
28
+ questionDefinitions?: Record<string, any>;
29
+ allEntries?: any[];
30
+ currentEntryIndex?: number;
31
+ }>;
32
+ export default TextQuestion;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import type { StructuredDocument } from '../../utils/structuredPdfExtractor';
3
+ import type { ParentContext } from '../../types/context';
4
+ type Props = {
5
+ sec: any;
6
+ si: number;
7
+ answers: Record<string, any>;
8
+ expandedSection: string | null;
9
+ toggleSection: (s: string) => void;
10
+ computeSectionProgress: (s: any) => string;
11
+ addSectionEntry: (sec: any) => void;
12
+ removeSectionEntry: (sectionId: string, idx: number) => void;
13
+ setSingleAnswer: (qId: string, v: any) => void;
14
+ setSectionEntryValue: (secId: string, idx: number, qId: string, v: any) => void;
15
+ isManySection: (sec: any) => boolean;
16
+ setExpandedKey: (k: string, v: boolean) => void;
17
+ isExpandedKey: (k: string) => boolean;
18
+ pdfContent?: string;
19
+ structuredDocument?: StructuredDocument | null;
20
+ onNavigateToPage?: (pageNumber: number) => void;
21
+ onHighlightsChange?: (highlights: Record<number, {
22
+ left: number;
23
+ top: number;
24
+ width: number;
25
+ height: number;
26
+ }[]>) => void;
27
+ pdfUrl?: string | null;
28
+ pageWidth?: number | null;
29
+ invalidFieldCount?: number;
30
+ validationErrors?: Record<string, string>;
31
+ onRegisterQuestionRef?: (questionId: string, element: HTMLElement | null) => void;
32
+ onAIVerificationComplete?: (result: any) => void;
33
+ aiVerifications?: Record<string, any>;
34
+ parentContext?: ParentContext;
35
+ allAnswers?: Record<string, any>;
36
+ siblingQuestionIds?: string[];
37
+ questionDefinitions?: Record<string, any>;
38
+ allEntries?: any[];
39
+ currentEntryIndex?: number;
40
+ };
41
+ declare const SectionAccordion: React.FC<Props>;
42
+ export default SectionAccordion;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { type Suggestion, type FeedbackData } from '../../utils/suggestions';
3
+ interface SuggestionBoxProps {
4
+ suggestions: Suggestion[];
5
+ onApply: (suggestion: Suggestion) => void;
6
+ onClose: () => void;
7
+ onFeedback: (suggestionId: string, feedback: Omit<FeedbackData, 'suggestionId' | 'questionId' | 'timestamp' | 'userId'>) => void;
8
+ onNavigateToPage: (pageNumber: number) => void;
9
+ loading?: boolean;
10
+ error?: string | null;
11
+ onRetry?: () => void;
12
+ questionId: string;
13
+ questionText?: string;
14
+ isCollapsed?: boolean;
15
+ onToggleCollapse?: () => void;
16
+ onRegenerate?: () => void;
17
+ onHighlightsChange?: (highlights: Record<number, {
18
+ left: number;
19
+ top: number;
20
+ width: number;
21
+ height: number;
22
+ }[]>) => void;
23
+ pdfUrl?: string | null;
24
+ pageWidth?: number | null;
25
+ }
26
+ /**
27
+ * Displays AI-generated suggestions with evidence and interaction controls.
28
+ */
29
+ declare const SuggestionBox: React.FC<SuggestionBoxProps>;
30
+ export default SuggestionBox;
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { QuestionnaireTemplate } from '../../lib/types';
3
+ interface MissingField {
4
+ questionId: string;
5
+ questionLabel: string;
6
+ sectionId: string;
7
+ sectionTitle: string;
8
+ }
9
+ interface InvalidField {
10
+ questionId: string;
11
+ questionLabel: string;
12
+ errorMessage: string;
13
+ sectionId: string;
14
+ sectionTitle: string;
15
+ }
16
+ interface AIVerification {
17
+ questionId: string;
18
+ status: 'pending' | 'verified' | 'needs_improvement' | 'error';
19
+ feedback?: string;
20
+ suggestions?: string[];
21
+ confidence: number;
22
+ qualityScore?: number;
23
+ }
24
+ interface TopSummaryBarProps {
25
+ templateSpec: QuestionnaireTemplate;
26
+ requiredSummary: {
27
+ totalRequired: number;
28
+ answeredRequired: number;
29
+ perSection: any[];
30
+ };
31
+ exportAnswers: () => void;
32
+ importAnswers: () => void;
33
+ pdfExtractionError?: Error | null;
34
+ onRetryExtraction?: () => void;
35
+ missingFields?: MissingField[];
36
+ invalidFields?: InvalidField[];
37
+ aiVerificationStatus?: 'not_started' | 'in_progress' | 'complete';
38
+ aiVerifications?: Record<string, AIVerification>;
39
+ onRunAIVerification?: () => Promise<void>;
40
+ hideAIConfig?: boolean;
41
+ }
42
+ declare const TopSummaryBar: React.FC<TopSummaryBarProps>;
43
+ export default TopSummaryBar;
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ interface MissingField {
3
+ questionId: string;
4
+ questionLabel: string;
5
+ sectionId: string;
6
+ sectionTitle: string;
7
+ }
8
+ interface InvalidField {
9
+ questionId: string;
10
+ questionLabel: string;
11
+ errorMessage: string;
12
+ sectionId: string;
13
+ sectionTitle: string;
14
+ }
15
+ interface AIVerification {
16
+ questionId: string;
17
+ status: 'pending' | 'verified' | 'needs_improvement' | 'error';
18
+ feedback?: string;
19
+ suggestions?: string[];
20
+ confidence: number;
21
+ qualityScore?: number;
22
+ }
23
+ interface ValidationStatusButtonProps {
24
+ totalRequired: number;
25
+ answeredRequired: number;
26
+ missingFields?: MissingField[];
27
+ invalidFields?: InvalidField[];
28
+ aiVerificationStatus?: 'not_started' | 'in_progress' | 'complete';
29
+ aiVerifications?: Record<string, AIVerification>;
30
+ onRunAIVerification?: () => Promise<void>;
31
+ }
32
+ declare const ValidationStatusButton: React.FC<ValidationStatusButtonProps>;
33
+ export default ValidationStatusButton;
@@ -0,0 +1,48 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface QuestionnaireAIState {
3
+ history: QuestionnaireAIHistory[];
4
+ }
5
+ export interface QuestionnaireAIHistory {
6
+ id: string;
7
+ timestamp: number;
8
+ questionId: string;
9
+ questionText: string;
10
+ type: 'suggestion' | 'verification' | 'answer';
11
+ action: 'generated' | 'applied' | 'verified' | 'edited';
12
+ content: string;
13
+ prompt?: string;
14
+ previousContent?: string;
15
+ metadata?: {
16
+ originalSuggestionId?: string;
17
+ suggestionRank?: number;
18
+ confidence?: number;
19
+ evidence?: Array<{
20
+ pageNumber: number;
21
+ excerpt: string;
22
+ }>;
23
+ verificationStatus?: 'verified' | 'needs_improvement' | 'error';
24
+ feedback?: {
25
+ rating?: 'positive' | 'negative';
26
+ comment?: string;
27
+ };
28
+ };
29
+ }
30
+ interface QuestionnaireAIContextType {
31
+ state: QuestionnaireAIState;
32
+ addToHistory: (entry: Omit<QuestionnaireAIHistory, 'id' | 'timestamp'>) => string;
33
+ updateHistoryMetadata: (id: string, metadata: Partial<QuestionnaireAIHistory['metadata']>) => void;
34
+ getHistoryByQuestion: (questionId: string) => QuestionnaireAIHistory[];
35
+ getHistoryByType: (type: QuestionnaireAIHistory['type']) => QuestionnaireAIHistory[];
36
+ clearHistory: () => void;
37
+ clearHistoryForQuestion: (questionId: string) => void;
38
+ removeFromHistory: (id: string) => void;
39
+ removeMultipleFromHistory: (ids: string[]) => void;
40
+ resetState: () => void;
41
+ loadSavedState: (savedState: QuestionnaireAIState) => void;
42
+ }
43
+ export declare const QuestionnaireAIContext: React.Context<QuestionnaireAIContextType | undefined>;
44
+ export declare const QuestionnaireAIProvider: React.FC<{
45
+ children: ReactNode;
46
+ }>;
47
+ export declare const useQuestionnaireAI: () => QuestionnaireAIContextType;
48
+ export default useQuestionnaireAI;
@@ -0,0 +1,30 @@
1
+ import { type Suggestion } from '../utils/suggestions';
2
+ import type { ParentContext } from '../types/context';
3
+ import type { StructuredDocument } from '../utils/structuredPdfExtractor';
4
+ interface UseSuggestionGeneratorProps {
5
+ questionText: string;
6
+ questionType: string;
7
+ questionOptions?: string[];
8
+ pdfContent?: string;
9
+ questionId?: string;
10
+ parentContext?: ParentContext;
11
+ allAnswers?: Record<string, any>;
12
+ siblingQuestionIds?: string[];
13
+ questionDefinitions?: Record<string, any>;
14
+ allEntries?: any[];
15
+ currentEntryIndex?: number;
16
+ structuredDocument?: StructuredDocument | null;
17
+ }
18
+ interface UseSuggestionGeneratorReturn {
19
+ suggestions: Suggestion[];
20
+ /** Optional rationale / chain-of-thought returned with the last suggestion run. */
21
+ suggestionReasoning: string | null;
22
+ loading: boolean;
23
+ error: string | null;
24
+ rawError: unknown;
25
+ generateSuggestions: () => Promise<void>;
26
+ clearSuggestions: () => void;
27
+ clearSuggestionReasoning: () => void;
28
+ }
29
+ declare const useSuggestionGenerator: ({ questionText, questionType, questionOptions, pdfContent, questionId, parentContext, allAnswers, siblingQuestionIds, questionDefinitions, allEntries, currentEntryIndex, structuredDocument, }: UseSuggestionGeneratorProps) => UseSuggestionGeneratorReturn;
30
+ export default useSuggestionGenerator;
@@ -0,0 +1,3 @@
1
+ import type { LLMService } from './types';
2
+ import type { ScidQuestAdapter } from './types';
3
+ export declare function createScidQuestAdapter(llmService: LLMService): ScidQuestAdapter;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface PDFUploadProps {
3
+ maxSizeBytes?: number;
4
+ onFileSelected: (file: File) => void;
5
+ onFileRemoved?: () => void;
6
+ accept?: string;
7
+ disabled?: boolean;
8
+ sx?: any;
9
+ }
10
+ export declare const PDFUpload: React.FC<PDFUploadProps>;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import 'react-pdf/dist/Page/AnnotationLayer.css';
3
+ import 'react-pdf/dist/Page/TextLayer.css';
4
+ export interface PdfViewerProps {
5
+ refContainer: React.RefObject<HTMLDivElement>;
6
+ pdfUrl?: string | null;
7
+ pageWidth?: number | null;
8
+ registerCommands?: (cmds: {
9
+ goToPage: (p: number) => void;
10
+ }) => void;
11
+ onTextExtracted?: (text: string) => void;
12
+ onExtractionError?: (error: Error) => void;
13
+ highlights?: Record<number, Rect[]>;
14
+ pdfTextExtractor?: {
15
+ extractFullText: (url: string) => Promise<string>;
16
+ } | null;
17
+ /** Override pdf.js worker URL (defaults to bundled worker). */
18
+ pdfWorkerSrc?: string;
19
+ }
20
+ type Rect = {
21
+ left: number;
22
+ top: number;
23
+ width: number;
24
+ height: number;
25
+ };
26
+ export declare const PdfViewer: React.NamedExoticComponent<PdfViewerProps>;
27
+ export {};