@almadar/ui 1.0.34 → 2.0.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.
- package/LICENSE +21 -72
- package/dist/components/atoms/Avatar.d.ts +58 -0
- package/dist/components/atoms/Badge.d.ts +8 -0
- package/dist/components/atoms/Box.d.ts +57 -0
- package/dist/components/atoms/Button.d.ts +24 -0
- package/dist/components/atoms/Card.d.ts +18 -0
- package/dist/components/atoms/Center.d.ts +33 -0
- package/dist/components/atoms/Checkbox.d.ts +5 -0
- package/dist/components/atoms/ConditionalWrapper.d.ts +68 -0
- package/dist/components/atoms/Divider.d.ts +29 -0
- package/dist/components/atoms/Icon.d.ts +38 -0
- package/dist/components/atoms/Input.d.ts +26 -0
- package/dist/components/atoms/Label.d.ts +5 -0
- package/dist/components/atoms/LawReferenceTooltip.d.ts +48 -0
- package/dist/components/atoms/Overlay.d.ts +16 -0
- package/dist/components/atoms/ProgressBar.d.ts +63 -0
- package/dist/components/atoms/Radio.d.ts +26 -0
- package/dist/components/atoms/Select.d.ts +12 -0
- package/dist/components/atoms/Spacer.d.ts +25 -0
- package/dist/components/atoms/Spinner.d.ts +6 -0
- package/dist/components/atoms/Stack.d.ts +64 -0
- package/dist/components/atoms/Switch.d.ts +12 -0
- package/dist/components/atoms/TextHighlight.d.ts +53 -0
- package/dist/components/atoms/Textarea.d.ts +5 -0
- package/dist/components/atoms/ThemeSelector.d.ts +21 -0
- package/dist/components/atoms/ThemeToggle.d.ts +33 -0
- package/dist/components/atoms/Typography.d.ts +57 -0
- package/dist/components/atoms/game/ControlButton.d.ts +31 -0
- package/dist/components/atoms/game/HealthBar.d.ts +18 -0
- package/dist/components/atoms/game/ScoreDisplay.d.ts +21 -0
- package/dist/components/atoms/game/Sprite.d.ts +63 -0
- package/dist/components/atoms/game/StateIndicator.d.ts +31 -0
- package/dist/components/atoms/game/index.d.ts +12 -0
- package/dist/components/atoms/index.d.ts +27 -0
- package/dist/components/index.css +11 -9
- package/dist/components/index.d.ts +6 -6951
- package/dist/components/index.js +5 -5
- package/dist/components/molecules/Accordion.d.ts +67 -0
- package/dist/components/molecules/Alert.d.ts +24 -0
- package/dist/components/molecules/Breadcrumb.d.ts +55 -0
- package/dist/components/molecules/ButtonGroup.d.ts +67 -0
- package/dist/components/molecules/Card.d.ts +44 -0
- package/dist/components/molecules/Container.d.ts +30 -0
- package/dist/components/molecules/Drawer.d.ts +46 -0
- package/dist/components/molecules/EmptyState.d.ts +25 -0
- package/dist/components/molecules/ErrorBoundary.d.ts +55 -0
- package/dist/components/molecules/ErrorState.d.ts +13 -0
- package/dist/components/molecules/FilterGroup.d.ts +54 -0
- package/dist/components/molecules/Flex.d.ts +43 -0
- package/dist/components/molecules/FloatingActionButton.d.ts +69 -0
- package/dist/components/molecules/FormField.d.ts +16 -0
- package/dist/components/molecules/FormSectionHeader.d.ts +30 -0
- package/dist/components/molecules/Grid.d.ts +54 -0
- package/dist/components/molecules/InputGroup.d.ts +24 -0
- package/dist/components/molecules/LoadingState.d.ts +7 -0
- package/dist/components/molecules/Menu.d.ts +40 -0
- package/dist/components/molecules/Modal.d.ts +26 -0
- package/dist/components/molecules/Pagination.d.ts +66 -0
- package/dist/components/molecules/Popover.d.ts +39 -0
- package/dist/components/molecules/QuizBlock.d.ts +20 -0
- package/dist/components/molecules/RelationSelect.d.ts +48 -0
- package/dist/components/molecules/RepeatableFormSection.d.ts +58 -0
- package/dist/components/molecules/ScaledDiagram.d.ts +20 -0
- package/dist/components/molecules/SearchInput.d.ts +60 -0
- package/dist/components/molecules/SidePanel.d.ts +47 -0
- package/dist/components/molecules/SimpleGrid.d.ts +27 -0
- package/dist/components/molecules/Skeleton.d.ts +35 -0
- package/dist/components/molecules/Tabs.d.ts +45 -0
- package/dist/components/molecules/Toast.d.ts +35 -0
- package/dist/components/molecules/Tooltip.d.ts +25 -0
- package/dist/components/molecules/ViolationAlert.d.ts +49 -0
- package/dist/components/molecules/WizardNavigation.d.ts +51 -0
- package/dist/components/molecules/WizardProgress.d.ts +42 -0
- package/dist/components/molecules/game/StatBadge.d.ts +27 -0
- package/dist/components/molecules/index.d.ts +38 -0
- package/dist/components/molecules/markdown/CodeBlock.d.ts +25 -0
- package/dist/components/molecules/markdown/MarkdownContent.d.ts +26 -0
- package/dist/components/organisms/CardGrid.d.ts +72 -0
- package/dist/components/organisms/Chart.d.ts +59 -0
- package/dist/components/organisms/CodeViewer.d.ts +67 -0
- package/dist/components/organisms/ComponentPatterns.d.ts +441 -0
- package/dist/components/organisms/ConfirmDialog.d.ts +50 -0
- package/dist/components/organisms/ContentRenderer.d.ts +23 -0
- package/dist/components/organisms/CustomPattern.d.ts +104 -0
- package/dist/components/organisms/DataTable.d.ts +63 -0
- package/dist/components/organisms/DetailPanel.d.ts +71 -0
- package/dist/components/organisms/DocumentViewer.d.ts +60 -0
- package/dist/components/organisms/DrawerSlot.d.ts +39 -0
- package/dist/components/organisms/Form.d.ts +203 -0
- package/dist/components/organisms/FormSection.d.ts +59 -0
- package/dist/components/organisms/GraphCanvas.d.ts +69 -0
- package/dist/components/organisms/Header.d.ts +110 -0
- package/dist/components/organisms/JazariStateMachine.d.ts +60 -0
- package/dist/components/organisms/LayoutPatterns.d.ts +181 -0
- package/dist/components/organisms/List.d.ts +76 -0
- package/dist/components/organisms/MasterDetail.d.ts +43 -0
- package/dist/components/organisms/MediaGallery.d.ts +66 -0
- package/dist/components/organisms/Meter.d.ts +58 -0
- package/dist/components/organisms/ModalSlot.d.ts +35 -0
- package/dist/components/organisms/Navigation.d.ts +68 -0
- package/dist/components/organisms/OrbitalVisualization.d.ts +48 -0
- package/dist/components/organisms/PageHeader.d.ts +59 -0
- package/dist/components/organisms/Section.d.ts +44 -0
- package/dist/components/organisms/Sidebar.d.ts +65 -0
- package/dist/components/organisms/SignaturePad.d.ts +44 -0
- package/dist/components/organisms/Split.d.ts +42 -0
- package/dist/components/organisms/StatCard.d.ts +66 -0
- package/dist/components/organisms/StateMachineView.d.ts +36 -0
- package/dist/components/organisms/Table.d.ts +99 -0
- package/dist/components/organisms/Timeline.d.ts +58 -0
- package/dist/components/organisms/ToastSlot.d.ts +38 -0
- package/dist/components/organisms/UISlotRenderer.d.ts +112 -0
- package/dist/components/organisms/WizardContainer.d.ts +160 -0
- package/dist/components/organisms/book/BookChapterView.d.ts +17 -0
- package/dist/components/organisms/book/BookCoverPage.d.ts +19 -0
- package/dist/components/organisms/book/BookNavBar.d.ts +18 -0
- package/dist/components/organisms/book/BookTableOfContents.d.ts +18 -0
- package/dist/components/organisms/book/BookViewer.d.ts +28 -0
- package/dist/components/organisms/book/index.d.ts +7 -0
- package/dist/components/organisms/book/types.d.ts +77 -0
- package/dist/components/organisms/game/BattleBoard.d.ts +167 -0
- package/dist/components/organisms/game/CanvasEffect.d.ts +68 -0
- package/dist/components/organisms/game/CastleBoard.d.ts +85 -0
- package/dist/components/organisms/game/DialogueBox.d.ts +73 -0
- package/dist/components/organisms/game/GameAudioProvider.d.ts +47 -0
- package/dist/components/organisms/game/GameAudioToggle.d.ts +28 -0
- package/dist/components/organisms/game/GameHud.d.ts +40 -0
- package/dist/components/organisms/game/GameMenu.d.ts +43 -0
- package/dist/components/organisms/game/GameOverScreen.d.ts +56 -0
- package/dist/components/organisms/game/InventoryPanel.d.ts +67 -0
- package/dist/components/organisms/game/IsometricCanvas.d.ts +123 -0
- package/dist/components/organisms/game/TraitSlot.d.ts +86 -0
- package/dist/components/organisms/game/TraitStateViewer.d.ts +53 -0
- package/dist/components/organisms/game/UncontrolledBattleBoard.d.ts +26 -0
- package/dist/components/organisms/game/WorldMapBoard.d.ts +147 -0
- package/dist/components/organisms/game/editor/editorUtils.d.ts +109 -0
- package/dist/components/organisms/game/editor/index.d.ts +9 -0
- package/dist/components/organisms/game/hooks/useBattleState.d.ts +35 -0
- package/dist/components/organisms/game/hooks/useCamera.d.ts +41 -0
- package/dist/components/organisms/game/hooks/useGameAudio.d.ts +47 -0
- package/dist/components/organisms/game/hooks/useImageCache.d.ts +16 -0
- package/dist/components/organisms/game/hooks/usePhysics2D.d.ts +45 -0
- package/dist/components/organisms/game/hooks/useSpriteAnimations.d.ts +43 -0
- package/dist/components/organisms/game/index.d.ts +36 -0
- package/dist/components/organisms/game/managers/PhysicsManager.d.ts +103 -0
- package/dist/components/organisms/game/types/effects.d.ts +253 -0
- package/dist/{isometric-ynNHVPZx.d.ts → components/organisms/game/types/isometric.d.ts} +4 -6
- package/dist/components/organisms/game/types/spriteAnimation.d.ts +73 -0
- package/dist/components/organisms/game/utils/canvasEffects.d.ts +50 -0
- package/dist/components/organisms/game/utils/combatPresets.d.ts +15 -0
- package/dist/components/organisms/game/utils/isometric.d.ts +61 -0
- package/dist/components/organisms/game/utils/spriteAnimation.d.ts +57 -0
- package/dist/components/organisms/game/utils/spriteSheetConstants.d.ts +16 -0
- package/dist/components/organisms/index.d.ts +37 -0
- package/dist/components/organisms/layout/DashboardGrid.d.ts +34 -0
- package/dist/components/organisms/layout/MasterDetail.d.ts +32 -0
- package/dist/components/organisms/layout/SplitPane.d.ts +34 -0
- package/dist/components/organisms/layout/TabbedContainer.d.ts +42 -0
- package/dist/components/organisms/layout/index.d.ts +9 -0
- package/dist/components/organisms/types.d.ts +65 -0
- package/dist/components/templates/AuthLayout.d.ts +14 -0
- package/dist/components/templates/BattleTemplate.d.ts +25 -0
- package/dist/components/templates/CastleTemplate.d.ts +23 -0
- package/dist/components/templates/CounterTemplate.d.ts +44 -0
- package/dist/components/templates/DashboardLayout.d.ts +32 -0
- package/dist/components/templates/GameShell.d.ts +33 -0
- package/dist/components/templates/GameTemplate.d.ts +36 -0
- package/dist/components/templates/GenericAppTemplate.d.ts +30 -0
- package/dist/components/templates/WorldMapTemplate.d.ts +29 -0
- package/dist/components/templates/index.d.ts +10 -0
- package/dist/components/templates/types.d.ts +17 -0
- package/dist/context/DesignThemeContext.d.ts +21 -0
- package/dist/{ThemeContext-D9xUORq5.d.ts → context/ThemeContext.d.ts} +15 -16
- package/dist/context/UISlotContext.d.ts +75 -0
- package/dist/context/UserContext.d.ts +111 -0
- package/dist/context/index.d.ts +6 -206
- package/dist/{event-bus-types-CjJduURa.d.ts → hooks/event-bus-types.d.ts} +4 -6
- package/dist/hooks/index.d.ts +24 -1090
- package/dist/hooks/useAgentChat.d.ts +104 -0
- package/dist/hooks/useAuthContext.d.ts +25 -0
- package/dist/hooks/useCompile.d.ts +22 -0
- package/dist/hooks/useDeepAgentGeneration.d.ts +46 -0
- package/dist/hooks/useEntities.d.ts +52 -0
- package/dist/hooks/useEntityData.d.ts +155 -0
- package/dist/hooks/useEntityMutations.d.ts +80 -0
- package/dist/hooks/useEventBus.d.ts +96 -0
- package/dist/hooks/useExtensions.d.ts +32 -0
- package/dist/hooks/useFileEditor.d.ts +32 -0
- package/dist/hooks/useFileSystem.d.ts +40 -0
- package/dist/hooks/useGitHub.d.ts +58 -0
- package/dist/hooks/useOrbitalHistory.d.ts +39 -0
- package/dist/hooks/useOrbitalMutations.d.ts +95 -0
- package/dist/hooks/usePreview.d.ts +57 -0
- package/dist/hooks/useQuerySingleton.d.ts +78 -0
- package/dist/hooks/useResolvedEntity.d.ts +32 -0
- package/dist/hooks/useTranslate.d.ts +35 -0
- package/dist/hooks/useUIEvents.d.ts +35 -0
- package/dist/{useUISlots-D0mttBSP.d.ts → hooks/useUISlots.d.ts} +8 -9
- package/dist/hooks/useValidation.d.ts +46 -0
- package/dist/lib/api-client.d.ts +42 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/debug.d.ts +43 -0
- package/dist/lib/debugRegistry.d.ts +29 -0
- package/dist/lib/debugUtils.d.ts +27 -0
- package/dist/lib/entityDebug.d.ts +38 -0
- package/dist/lib/getNestedValue.d.ts +33 -0
- package/dist/lib/guardRegistry.d.ts +32 -0
- package/dist/lib/index.d.ts +17 -426
- package/dist/lib/jazari/svg-paths.d.ts +61 -0
- package/dist/lib/parseContentSegments.d.ts +41 -0
- package/dist/lib/tickRegistry.d.ts +40 -0
- package/dist/lib/traitRegistry.d.ts +34 -0
- package/dist/lib/verificationRegistry.d.ts +107 -0
- package/dist/{cn-BoBXsxuX.d.ts → lib/visualizer/index.d.ts} +18 -69
- package/dist/locales/index.d.ts +5 -7
- package/dist/providers/EventBusProvider.d.ts +60 -0
- package/dist/providers/FetchedDataProvider.d.ts +105 -0
- package/dist/providers/OfflineModeProvider.d.ts +79 -0
- package/dist/providers/OrbitalProvider.d.ts +101 -0
- package/dist/providers/SelectionProvider.d.ts +81 -0
- package/dist/providers/VerificationProvider.d.ts +63 -0
- package/dist/providers/index.css +11 -9
- package/dist/providers/index.d.ts +16 -464
- package/dist/providers/index.js +3 -3
- package/dist/renderer/client-effect-executor.d.ts +68 -0
- package/dist/renderer/data-resolver.d.ts +68 -0
- package/dist/renderer/index.d.ts +22 -519
- package/dist/renderer/index.js +1 -1
- package/dist/renderer/init.d.ts +14 -0
- package/dist/renderer/navigation.d.ts +142 -0
- package/dist/{offline-executor-CHr4uAhf.d.ts → renderer/offline-executor.d.ts} +9 -172
- package/dist/renderer/pattern-resolver.d.ts +91 -0
- package/dist/renderer/slot-definitions.d.ts +45 -0
- package/dist/renderer/types.d.ts +160 -0
- package/dist/renderer/useClientEffects.d.ts +88 -0
- package/dist/stores/entityStore.d.ts +99 -0
- package/dist/stores/filtering.d.ts +51 -0
- package/dist/stores/index.d.ts +4 -148
- package/package.json +12 -10
- package/dist/components/organisms/game/three/index.d.ts +0 -1162
- package/dist/{chunk-FZJ73RDM.js → chunk-RIZ76XRF.js} +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { DeepAgentInterrupt } from './useDeepAgentGeneration';
|
|
2
|
+
export interface ChatMessage {
|
|
3
|
+
id: string;
|
|
4
|
+
role: 'user' | 'assistant' | 'system';
|
|
5
|
+
content: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
}
|
|
8
|
+
export type AvatarRole = 'user' | 'assistant' | 'system';
|
|
9
|
+
export type FileOperation = 'ls' | 'read_file' | 'write_file' | 'edit_file';
|
|
10
|
+
export type Activity = {
|
|
11
|
+
type: 'message';
|
|
12
|
+
role: AvatarRole;
|
|
13
|
+
content: string;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
isStreaming?: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
type: 'tool_call';
|
|
18
|
+
tool: string;
|
|
19
|
+
args: Record<string, unknown>;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
isExecuting?: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'tool_result';
|
|
24
|
+
tool: string;
|
|
25
|
+
result: unknown;
|
|
26
|
+
success: boolean;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'file_operation';
|
|
30
|
+
operation: FileOperation;
|
|
31
|
+
path: string;
|
|
32
|
+
success?: boolean;
|
|
33
|
+
timestamp: number;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'schema_diff';
|
|
36
|
+
filePath: string;
|
|
37
|
+
hunks: DiffHunk[];
|
|
38
|
+
timestamp: number;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'error';
|
|
41
|
+
message: string;
|
|
42
|
+
code?: string;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
};
|
|
45
|
+
export interface TodoActivity {
|
|
46
|
+
type: 'thinking' | 'tool_call' | 'tool_result' | 'code_change';
|
|
47
|
+
content: string;
|
|
48
|
+
timestamp: number;
|
|
49
|
+
tool?: string;
|
|
50
|
+
success?: boolean;
|
|
51
|
+
filePath?: string;
|
|
52
|
+
diff?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface Todo {
|
|
55
|
+
id: string;
|
|
56
|
+
task: string;
|
|
57
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
58
|
+
latestActivity?: TodoActivity;
|
|
59
|
+
activityHistory?: TodoActivity[];
|
|
60
|
+
}
|
|
61
|
+
export interface DiffHunk {
|
|
62
|
+
oldStart: number;
|
|
63
|
+
oldLines: number;
|
|
64
|
+
newStart: number;
|
|
65
|
+
newLines: number;
|
|
66
|
+
lines: Array<{
|
|
67
|
+
type: 'add' | 'remove' | 'context';
|
|
68
|
+
content: string;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
export interface SchemaDiff {
|
|
72
|
+
id: string;
|
|
73
|
+
filePath: string;
|
|
74
|
+
hunks: DiffHunk[];
|
|
75
|
+
timestamp: number;
|
|
76
|
+
addedLines: number;
|
|
77
|
+
removedLines: number;
|
|
78
|
+
}
|
|
79
|
+
export type AgentStatus = 'idle' | 'running' | 'complete' | 'error' | 'interrupted';
|
|
80
|
+
export interface UseAgentChatOptions {
|
|
81
|
+
appId?: string;
|
|
82
|
+
onComplete?: (schema?: unknown) => void;
|
|
83
|
+
onSchemaChange?: (diff?: unknown) => void;
|
|
84
|
+
onError?: (error: Error | string) => void;
|
|
85
|
+
}
|
|
86
|
+
export interface UseAgentChatResult {
|
|
87
|
+
messages: ChatMessage[];
|
|
88
|
+
status: AgentStatus;
|
|
89
|
+
activities: Activity[];
|
|
90
|
+
todos: Todo[];
|
|
91
|
+
schemaDiffs: SchemaDiff[];
|
|
92
|
+
isLoading: boolean;
|
|
93
|
+
error: string | null;
|
|
94
|
+
threadId: string | null;
|
|
95
|
+
interrupt: DeepAgentInterrupt | null;
|
|
96
|
+
sendMessage: (content: string) => Promise<void>;
|
|
97
|
+
startGeneration: (skill: string | string[], prompt: string, options?: Record<string, unknown>) => Promise<void>;
|
|
98
|
+
continueConversation: (message: string | string[]) => Promise<void>;
|
|
99
|
+
resumeWithDecision: (decisions: unknown[]) => Promise<void>;
|
|
100
|
+
cancel: () => void;
|
|
101
|
+
clearMessages: () => void;
|
|
102
|
+
clearHistory: () => void;
|
|
103
|
+
}
|
|
104
|
+
export declare function useAgentChat(options?: UseAgentChatOptions): UseAgentChatResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Context Hook Stub
|
|
3
|
+
*
|
|
4
|
+
* Provides a placeholder auth context for the design system.
|
|
5
|
+
* Applications should provide their own AuthContext provider
|
|
6
|
+
* that implements this interface.
|
|
7
|
+
*/
|
|
8
|
+
export interface AuthUser {
|
|
9
|
+
uid: string;
|
|
10
|
+
email: string | null;
|
|
11
|
+
displayName: string | null;
|
|
12
|
+
photoURL: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface AuthContextValue {
|
|
15
|
+
user: AuthUser | null;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
signIn?: () => Promise<void>;
|
|
18
|
+
signOut?: () => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Stub hook that returns empty auth context.
|
|
22
|
+
* Applications should wrap their app with an AuthProvider
|
|
23
|
+
* that supplies real auth state.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAuthContext(): AuthContextValue;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SchemaLike {
|
|
2
|
+
name: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
export type CompileStage = 'idle' | 'compiling' | 'done' | 'error';
|
|
7
|
+
export interface CompileResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
files?: Array<{
|
|
10
|
+
path: string;
|
|
11
|
+
content: string;
|
|
12
|
+
}>;
|
|
13
|
+
errors?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface UseCompileResult {
|
|
16
|
+
isCompiling: boolean;
|
|
17
|
+
stage: CompileStage;
|
|
18
|
+
lastResult: CompileResult | null;
|
|
19
|
+
error: string | null;
|
|
20
|
+
compileSchema: (schema: SchemaLike) => Promise<CompileResult | null>;
|
|
21
|
+
}
|
|
22
|
+
export declare function useCompile(): UseCompileResult;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { OrbitalSchema } from '@almadar/core';
|
|
2
|
+
export interface DeepAgentActionRequest {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
tool: string;
|
|
6
|
+
args: Record<string, unknown>;
|
|
7
|
+
description?: string;
|
|
8
|
+
allowedDecisions: ('approve' | 'edit' | 'reject')[];
|
|
9
|
+
status: 'pending' | 'approved' | 'rejected' | 'edited';
|
|
10
|
+
}
|
|
11
|
+
export interface DeepAgentInterrupt {
|
|
12
|
+
id: string;
|
|
13
|
+
type: 'tool_calls' | 'confirmation' | 'error';
|
|
14
|
+
message?: string;
|
|
15
|
+
actionRequests: DeepAgentActionRequest[];
|
|
16
|
+
timestamp: number;
|
|
17
|
+
threadId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface GenerationRequest {
|
|
20
|
+
id: string;
|
|
21
|
+
prompt: string;
|
|
22
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
23
|
+
result?: OrbitalSchema;
|
|
24
|
+
error?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface GenerationProgress {
|
|
27
|
+
stage: string;
|
|
28
|
+
percent: number;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
export interface UseDeepAgentGenerationResult {
|
|
32
|
+
requests: GenerationRequest[];
|
|
33
|
+
currentRequest: GenerationRequest | null;
|
|
34
|
+
isGenerating: boolean;
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
isComplete: boolean;
|
|
37
|
+
progress: GenerationProgress;
|
|
38
|
+
error: string | null;
|
|
39
|
+
interrupt: DeepAgentInterrupt | null;
|
|
40
|
+
generate: (prompt: string) => Promise<OrbitalSchema | null>;
|
|
41
|
+
startGeneration: (skill: string, prompt: string, options?: Record<string, unknown>) => Promise<void>;
|
|
42
|
+
cancelGeneration: () => void;
|
|
43
|
+
clearRequests: () => void;
|
|
44
|
+
submitInterruptDecisions: (decisions: unknown[]) => void;
|
|
45
|
+
}
|
|
46
|
+
export declare function useDeepAgentGeneration(): UseDeepAgentGenerationResult;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getEntity, getByType, getAllEntities, getSingleton, spawnEntity, updateEntity, updateSingleton, removeEntity, clearEntities } from '../stores/entityStore';
|
|
2
|
+
import type { Entity } from '../stores/entityStore';
|
|
3
|
+
export type { Entity };
|
|
4
|
+
/**
|
|
5
|
+
* Hook to access all entities
|
|
6
|
+
*/
|
|
7
|
+
export declare function useEntities(): {
|
|
8
|
+
entities: Map<string, Entity>;
|
|
9
|
+
getEntity: typeof getEntity;
|
|
10
|
+
getByType: typeof getByType;
|
|
11
|
+
getAllEntities: typeof getAllEntities;
|
|
12
|
+
getSingleton: typeof getSingleton;
|
|
13
|
+
spawnEntity: typeof spawnEntity;
|
|
14
|
+
updateEntity: typeof updateEntity;
|
|
15
|
+
updateSingleton: typeof updateSingleton;
|
|
16
|
+
removeEntity: typeof removeEntity;
|
|
17
|
+
clearEntities: typeof clearEntities;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Hook to access a specific entity by ID
|
|
21
|
+
*/
|
|
22
|
+
export declare function useEntity(id: string): Entity | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Hook to access entities of a specific type
|
|
25
|
+
*/
|
|
26
|
+
export declare function useEntitiesByType(type: string): Entity[];
|
|
27
|
+
/**
|
|
28
|
+
* Hook to access a singleton entity by type
|
|
29
|
+
*/
|
|
30
|
+
export declare function useSingletonEntity<T extends Entity = Entity>(type: string): T | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Hook for Player entity (convenience)
|
|
33
|
+
*/
|
|
34
|
+
export declare function usePlayer(): {
|
|
35
|
+
player: Entity | undefined;
|
|
36
|
+
updatePlayer: (updates: Partial<Entity>) => void;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Hook for Physics entity (convenience)
|
|
40
|
+
*/
|
|
41
|
+
export declare function usePhysics(): {
|
|
42
|
+
physics: Entity | undefined;
|
|
43
|
+
updatePhysics: (updates: Partial<Entity>) => void;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Hook for Input entity (convenience)
|
|
47
|
+
*/
|
|
48
|
+
export declare function useInput(): {
|
|
49
|
+
input: Entity | undefined;
|
|
50
|
+
updateInput: (updates: Partial<Entity>) => void;
|
|
51
|
+
};
|
|
52
|
+
export { spawnEntity, updateEntity, updateSingleton, removeEntity, clearEntities, getEntity, getByType, getAllEntities, getSingleton, };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export interface EntityDataAdapter {
|
|
4
|
+
/** Get all records for an entity */
|
|
5
|
+
getData: (entity: string) => Record<string, unknown>[];
|
|
6
|
+
/** Get a single record by entity name and ID */
|
|
7
|
+
getById: (entity: string, id: string) => Record<string, unknown> | undefined;
|
|
8
|
+
/** Whether data is currently loading */
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
/** Current error */
|
|
11
|
+
error: string | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Provider that bridges a host app's data source to useEntityList/useEntity hooks.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // In builder runtime
|
|
19
|
+
* const fetchedData = useFetchedData();
|
|
20
|
+
* const adapter = {
|
|
21
|
+
* getData: fetchedData.getData,
|
|
22
|
+
* getById: fetchedData.getById,
|
|
23
|
+
* isLoading: fetchedData.loading,
|
|
24
|
+
* error: fetchedData.error,
|
|
25
|
+
* };
|
|
26
|
+
* <EntityDataProvider adapter={adapter}>
|
|
27
|
+
* {children}
|
|
28
|
+
* </EntityDataProvider>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function EntityDataProvider({ adapter, children, }: {
|
|
32
|
+
adapter: EntityDataAdapter;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}): React.FunctionComponentElement<React.ProviderProps<EntityDataAdapter | null>>;
|
|
35
|
+
/**
|
|
36
|
+
* Access the entity data adapter (null if no provider).
|
|
37
|
+
*/
|
|
38
|
+
export declare function useEntityDataAdapter(): EntityDataAdapter | null;
|
|
39
|
+
export declare const entityDataKeys: {
|
|
40
|
+
all: readonly ["entities"];
|
|
41
|
+
lists: () => readonly ["entities", "list"];
|
|
42
|
+
list: (entity: string, filters?: Record<string, unknown>) => readonly ["entities", "list", string, Record<string, unknown> | undefined];
|
|
43
|
+
details: () => readonly ["entities", "detail"];
|
|
44
|
+
detail: (entity: string, id: string) => readonly ["entities", "detail", string, string];
|
|
45
|
+
};
|
|
46
|
+
export type EntityDataRecord = Record<string, unknown>;
|
|
47
|
+
export interface UseEntityListOptions {
|
|
48
|
+
/** Skip fetching */
|
|
49
|
+
skip?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface UseEntityListResult<T = Record<string, unknown>> {
|
|
52
|
+
data: T[];
|
|
53
|
+
isLoading: boolean;
|
|
54
|
+
error: Error | null;
|
|
55
|
+
refetch: () => void;
|
|
56
|
+
}
|
|
57
|
+
export interface UseEntityDetailResult<T = Record<string, unknown>> {
|
|
58
|
+
data: T | null;
|
|
59
|
+
isLoading: boolean;
|
|
60
|
+
error: Error | null;
|
|
61
|
+
refetch: () => void;
|
|
62
|
+
}
|
|
63
|
+
export interface PaginationParams {
|
|
64
|
+
page: number;
|
|
65
|
+
pageSize: number;
|
|
66
|
+
search?: string;
|
|
67
|
+
sortBy?: string;
|
|
68
|
+
sortDirection?: "asc" | "desc";
|
|
69
|
+
filters?: Record<string, unknown>;
|
|
70
|
+
}
|
|
71
|
+
export interface UsePaginatedEntityListResult<T = Record<string, unknown>> {
|
|
72
|
+
data: T[];
|
|
73
|
+
isLoading: boolean;
|
|
74
|
+
error: Error | null;
|
|
75
|
+
totalCount: number;
|
|
76
|
+
totalPages: number;
|
|
77
|
+
hasNextPage: boolean;
|
|
78
|
+
hasPreviousPage: boolean;
|
|
79
|
+
refetch: () => void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Hook for fetching entity list data.
|
|
83
|
+
* Uses EntityDataContext if available, otherwise falls back to stub.
|
|
84
|
+
*/
|
|
85
|
+
export declare function useEntityList<T = Record<string, unknown>>(entity: string | undefined, options?: UseEntityListOptions): UseEntityListResult<T>;
|
|
86
|
+
/**
|
|
87
|
+
* Hook for fetching a single entity by ID.
|
|
88
|
+
* Uses EntityDataContext if available, otherwise falls back to stub.
|
|
89
|
+
*/
|
|
90
|
+
export declare function useEntity<T = Record<string, unknown>>(entity: string | undefined, id: string | undefined): {
|
|
91
|
+
data: T | null;
|
|
92
|
+
isLoading: boolean;
|
|
93
|
+
error: Error | null;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Hook for fetching entity detail by ID (alias for useEntity with refetch).
|
|
97
|
+
* Uses EntityDataContext if available, otherwise falls back to stub.
|
|
98
|
+
*/
|
|
99
|
+
export declare function useEntityDetail<T = Record<string, unknown>>(entity: string | undefined, id: string | undefined): UseEntityDetailResult<T>;
|
|
100
|
+
/**
|
|
101
|
+
* Hook for fetching paginated entity list data.
|
|
102
|
+
* Uses EntityDataContext if available (client-side pagination), otherwise falls back to stub.
|
|
103
|
+
*/
|
|
104
|
+
export declare function usePaginatedEntityList<T = Record<string, unknown>>(entity: string | undefined, params: PaginationParams, options?: UseEntityListOptions): UsePaginatedEntityListResult<T>;
|
|
105
|
+
/**
|
|
106
|
+
* Suspense-compatible hook for fetching entity list data.
|
|
107
|
+
*
|
|
108
|
+
* Instead of returning `isLoading`/`error`, this hook **suspends** (throws a Promise)
|
|
109
|
+
* when data is not ready. Use inside a `<Suspense>` boundary.
|
|
110
|
+
*
|
|
111
|
+
* Falls back to the adapter when available; otherwise suspends briefly for stub data.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx
|
|
115
|
+
* <Suspense fallback={<Skeleton variant="table" />}>
|
|
116
|
+
* <ErrorBoundary>
|
|
117
|
+
* <TaskList entity="Task" />
|
|
118
|
+
* </ErrorBoundary>
|
|
119
|
+
* </Suspense>
|
|
120
|
+
*
|
|
121
|
+
* function TaskList({ entity }: { entity: string }) {
|
|
122
|
+
* const { data } = useEntityListSuspense<Task>(entity);
|
|
123
|
+
* // No loading check needed — Suspense handles it
|
|
124
|
+
* return <DataTable data={data} ... />;
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare function useEntityListSuspense<T = Record<string, unknown>>(entity: string): {
|
|
129
|
+
data: T[];
|
|
130
|
+
refetch: () => void;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Suspense-compatible hook for fetching a single entity by ID.
|
|
134
|
+
*
|
|
135
|
+
* Suspends when data is not ready. Use inside a `<Suspense>` boundary.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```tsx
|
|
139
|
+
* <Suspense fallback={<Skeleton variant="form" />}>
|
|
140
|
+
* <ErrorBoundary>
|
|
141
|
+
* <TaskDetail entity="Task" id={taskId} />
|
|
142
|
+
* </ErrorBoundary>
|
|
143
|
+
* </Suspense>
|
|
144
|
+
*
|
|
145
|
+
* function TaskDetail({ entity, id }: { entity: string; id: string }) {
|
|
146
|
+
* const { data } = useEntitySuspense<Task>(entity, id);
|
|
147
|
+
* return <DetailPanel data={data} ... />;
|
|
148
|
+
* }
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export declare function useEntitySuspense<T = Record<string, unknown>>(entity: string, id: string): {
|
|
152
|
+
data: T | null;
|
|
153
|
+
refetch: () => void;
|
|
154
|
+
};
|
|
155
|
+
export default useEntityList;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useEntityMutations - Entity CRUD mutation hooks
|
|
3
|
+
*
|
|
4
|
+
* Provides create, update, and delete mutations for entities.
|
|
5
|
+
* Used by trait hooks for persist_data effects.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated For new code, prefer useOrbitalMutations which sends mutations
|
|
8
|
+
* through the orbital events route. This ensures all mutations go through
|
|
9
|
+
* trait state machines and enforce guards/effects.
|
|
10
|
+
*
|
|
11
|
+
* Migration:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Old (deprecated):
|
|
14
|
+
* const { createEntity } = useEntityMutations('Task');
|
|
15
|
+
*
|
|
16
|
+
* // New (recommended):
|
|
17
|
+
* const { createEntity } = useOrbitalMutations('Task', 'TaskManager');
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @see useOrbitalMutations
|
|
21
|
+
*/
|
|
22
|
+
import { type OrbitalEventResponse } from './useOrbitalMutations';
|
|
23
|
+
export interface EntityMutationResult {
|
|
24
|
+
id: string;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook for creating entities
|
|
29
|
+
*/
|
|
30
|
+
export declare function useCreateEntity(entityName: string): import("@tanstack/react-query").UseMutationResult<EntityMutationResult, Error, Record<string, unknown>, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Hook for updating entities
|
|
33
|
+
*/
|
|
34
|
+
export declare function useUpdateEntity(entityName: string): import("@tanstack/react-query").UseMutationResult<EntityMutationResult, Error, {
|
|
35
|
+
id: string;
|
|
36
|
+
data: Record<string, unknown>;
|
|
37
|
+
}, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Hook for deleting entities
|
|
40
|
+
*/
|
|
41
|
+
export declare function useDeleteEntity(entityName: string): import("@tanstack/react-query").UseMutationResult<{
|
|
42
|
+
id: string;
|
|
43
|
+
}, Error, string, unknown>;
|
|
44
|
+
export interface UseEntityMutationsOptions {
|
|
45
|
+
/**
|
|
46
|
+
* If provided, mutations go through orbital events route instead of direct CRUD.
|
|
47
|
+
* This is the recommended approach for Phase 7+ compliance.
|
|
48
|
+
*/
|
|
49
|
+
orbitalName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Custom event names when using orbital-based mutations
|
|
52
|
+
*/
|
|
53
|
+
events?: {
|
|
54
|
+
create?: string;
|
|
55
|
+
update?: string;
|
|
56
|
+
delete?: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Combined hook that provides all entity mutations
|
|
61
|
+
* Used by trait hooks for persist_data effects
|
|
62
|
+
*
|
|
63
|
+
* @param entityName - The entity type name
|
|
64
|
+
* @param options - Optional configuration including orbital-based mutations
|
|
65
|
+
*
|
|
66
|
+
* @deprecated For new code, prefer useOrbitalMutations directly
|
|
67
|
+
*/
|
|
68
|
+
export declare function useEntityMutations(entityName: string, options?: UseEntityMutationsOptions): {
|
|
69
|
+
createEntity: (entityOrData: string | Record<string, unknown>, data?: Record<string, unknown>) => Promise<OrbitalEventResponse | EntityMutationResult | undefined>;
|
|
70
|
+
updateEntity: (id: string | undefined, data: Record<string, unknown>) => Promise<OrbitalEventResponse | EntityMutationResult | undefined>;
|
|
71
|
+
deleteEntity: (id: string | undefined) => Promise<OrbitalEventResponse | {
|
|
72
|
+
id: string;
|
|
73
|
+
} | undefined>;
|
|
74
|
+
isCreating: boolean;
|
|
75
|
+
isUpdating: boolean;
|
|
76
|
+
isDeleting: boolean;
|
|
77
|
+
createError: Error | null;
|
|
78
|
+
updateError: Error | null;
|
|
79
|
+
deleteError: Error | null;
|
|
80
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { KFlowEvent, EventListener, Unsubscribe, EventBusContextType } from './event-bus-types';
|
|
2
|
+
export type { KFlowEvent, EventListener, Unsubscribe, EventBusContextType };
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
__kflowEventBus?: EventBusContextType | null;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Global event bus reference for bridging between packages.
|
|
10
|
+
*
|
|
11
|
+
* Uses window-level global to enable cross-package communication.
|
|
12
|
+
* This allows @almadar/ui components to emit events to the same bus
|
|
13
|
+
* that the consuming app's trait state machine listens to.
|
|
14
|
+
*
|
|
15
|
+
* When the EventBusProvider mounts, it sets window.__kflowEventBus.
|
|
16
|
+
* Components in any package can then use this shared event bus.
|
|
17
|
+
*
|
|
18
|
+
* SSR Safety: All window access is guarded by `typeof window !== 'undefined'`.
|
|
19
|
+
* React Compiler Safety: The global bus reference is set once at provider mount
|
|
20
|
+
* and is stable — no render-path side effects. In practice, the React context
|
|
21
|
+
* path (priority 1) is used in real apps; the window global (priority 2) is
|
|
22
|
+
* only reached when no EventBusProvider is in the tree (e.g., Storybook).
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Set the global event bus reference.
|
|
26
|
+
* Called by EventBusProvider when it mounts.
|
|
27
|
+
*
|
|
28
|
+
* @param bus - The event bus context to set as global, or null to clear
|
|
29
|
+
*/
|
|
30
|
+
export declare function setGlobalEventBus(bus: EventBusContextType | null): void;
|
|
31
|
+
/**
|
|
32
|
+
* Get the global event bus reference.
|
|
33
|
+
*
|
|
34
|
+
* @returns The global event bus if set, null otherwise
|
|
35
|
+
*/
|
|
36
|
+
export declare function getGlobalEventBus(): EventBusContextType | null;
|
|
37
|
+
/**
|
|
38
|
+
* Hook for accessing the event bus.
|
|
39
|
+
*
|
|
40
|
+
* Uses EventBusProvider context if available, otherwise falls back to
|
|
41
|
+
* a simple in-memory event bus (for design system / Storybook).
|
|
42
|
+
*
|
|
43
|
+
* @returns Event bus instance with emit, on, once, and hasListeners methods
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* const eventBus = useEventBus();
|
|
48
|
+
*
|
|
49
|
+
* // Emit an event
|
|
50
|
+
* eventBus.emit('UI:CLICK', { id: '123' });
|
|
51
|
+
*
|
|
52
|
+
* // Subscribe to an event
|
|
53
|
+
* useEffect(() => {
|
|
54
|
+
* return eventBus.on('UI:CLICK', (event) => {
|
|
55
|
+
* console.log('Clicked:', event.payload);
|
|
56
|
+
* });
|
|
57
|
+
* }, []);
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function useEventBus(): EventBusContextType;
|
|
61
|
+
/**
|
|
62
|
+
* Hook for subscribing to a specific event.
|
|
63
|
+
* Automatically cleans up subscription on unmount.
|
|
64
|
+
*
|
|
65
|
+
* @param event - Event name to subscribe to
|
|
66
|
+
* @param handler - Event handler function
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* useEventListener('UI:CLICK', (event) => {
|
|
71
|
+
* console.log('Clicked:', event.payload);
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function useEventListener(event: string, handler: EventListener): void;
|
|
76
|
+
/**
|
|
77
|
+
* Alias for useEventListener for backward compatibility
|
|
78
|
+
*/
|
|
79
|
+
export declare const useEventSubscription: typeof useEventListener;
|
|
80
|
+
/**
|
|
81
|
+
* Hook for emitting events.
|
|
82
|
+
* Returns a memoized emit function.
|
|
83
|
+
*
|
|
84
|
+
* @returns Function to emit events
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* const emit = useEmitEvent();
|
|
89
|
+
*
|
|
90
|
+
* const handleClick = () => {
|
|
91
|
+
* emit('UI:CLICK', { id: '123' });
|
|
92
|
+
* };
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function useEmitEvent(): (type: string, payload?: Record<string, unknown>) => void;
|
|
96
|
+
export default useEventBus;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface Extension {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
loaded: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ExtensionEntry {
|
|
8
|
+
file: string;
|
|
9
|
+
language?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ExtensionManifest {
|
|
12
|
+
languages: Record<string, {
|
|
13
|
+
extensions: string[];
|
|
14
|
+
icon?: string;
|
|
15
|
+
color?: string;
|
|
16
|
+
}>;
|
|
17
|
+
extensions: ExtensionEntry[];
|
|
18
|
+
}
|
|
19
|
+
export interface UseExtensionsOptions {
|
|
20
|
+
appId: string;
|
|
21
|
+
loadOnMount?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface UseExtensionsResult {
|
|
24
|
+
extensions: Extension[];
|
|
25
|
+
manifest: ExtensionManifest;
|
|
26
|
+
isLoading: boolean;
|
|
27
|
+
error: string | null;
|
|
28
|
+
loadExtension: (extensionId: string) => Promise<void>;
|
|
29
|
+
loadExtensions: () => Promise<void>;
|
|
30
|
+
getExtensionForFile: (filename: string) => Extension | null;
|
|
31
|
+
}
|
|
32
|
+
export declare function useExtensions(options: UseExtensionsOptions): UseExtensionsResult;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { UseExtensionsResult } from './useExtensions';
|
|
2
|
+
import type { UseFileSystemResult } from './useFileSystem';
|
|
3
|
+
import type { OrbitalSchema } from '@almadar/core';
|
|
4
|
+
export interface OpenFile {
|
|
5
|
+
path: string;
|
|
6
|
+
content: string;
|
|
7
|
+
isDirty: boolean;
|
|
8
|
+
language?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UseFileEditorOptions {
|
|
11
|
+
extensions: UseExtensionsResult;
|
|
12
|
+
fileSystem: UseFileSystemResult;
|
|
13
|
+
onSchemaUpdate?: (schema: OrbitalSchema) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface FileEditResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
action?: 'updated_schema' | 'converted_extension' | 'saved_extension' | 'saved';
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface UseFileEditorResult {
|
|
21
|
+
openFiles: OpenFile[];
|
|
22
|
+
activeFile: OpenFile | null;
|
|
23
|
+
isSaving: boolean;
|
|
24
|
+
openFile: (path: string) => Promise<void>;
|
|
25
|
+
closeFile: (path: string) => void;
|
|
26
|
+
setActiveFile: (path: string) => void;
|
|
27
|
+
updateFileContent: (path: string, content: string) => void;
|
|
28
|
+
handleFileEdit: (path: string, content: string) => Promise<FileEditResult>;
|
|
29
|
+
saveFile: (path: string) => Promise<void>;
|
|
30
|
+
saveAllFiles: () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export declare function useFileEditor(options: UseFileEditorOptions): UseFileEditorResult;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface FileNode {
|
|
2
|
+
path: string;
|
|
3
|
+
name: string;
|
|
4
|
+
type: 'file' | 'directory';
|
|
5
|
+
children?: FileNode[];
|
|
6
|
+
}
|
|
7
|
+
export type FileSystemStatus = 'idle' | 'booting' | 'ready' | 'running' | 'error';
|
|
8
|
+
export interface FileSystemFile {
|
|
9
|
+
path: string;
|
|
10
|
+
content: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SelectedFile {
|
|
13
|
+
path: string;
|
|
14
|
+
content: string;
|
|
15
|
+
language?: string;
|
|
16
|
+
isDirty?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface UseFileSystemResult {
|
|
19
|
+
status: FileSystemStatus;
|
|
20
|
+
error: string | null;
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
files: FileNode[];
|
|
23
|
+
selectedFile: SelectedFile | null;
|
|
24
|
+
selectedPath: string | null;
|
|
25
|
+
previewUrl: string | null;
|
|
26
|
+
boot: () => Promise<void>;
|
|
27
|
+
mountFiles: (files: FileSystemFile[] | Record<string, unknown>) => Promise<void>;
|
|
28
|
+
readFile: (path: string) => Promise<string>;
|
|
29
|
+
writeFile: (path: string, content: string) => Promise<void>;
|
|
30
|
+
selectFile: (path: string) => Promise<void>;
|
|
31
|
+
updateContent: (pathOrContent: string, content?: string) => void;
|
|
32
|
+
updateSelectedContent: (content: string) => void;
|
|
33
|
+
refreshTree: () => Promise<void>;
|
|
34
|
+
runCommand: (command: string) => Promise<{
|
|
35
|
+
exitCode: number;
|
|
36
|
+
output: string;
|
|
37
|
+
}>;
|
|
38
|
+
startDevServer: () => Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
export declare function useFileSystem(): UseFileSystemResult;
|