@nocturnium/svelte-ide 1.0.0-rc.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 -0
- package/README.md +251 -0
- package/dist/components/agents/AgentActivityPanel.svelte +565 -0
- package/dist/components/agents/AgentActivityPanel.svelte.d.ts +24 -0
- package/dist/components/agents/AgentAvatar.svelte +417 -0
- package/dist/components/agents/AgentAvatar.svelte.d.ts +23 -0
- package/dist/components/agents/AgentCursor.svelte +224 -0
- package/dist/components/agents/AgentCursor.svelte.d.ts +35 -0
- package/dist/components/agents/AgentPresenceBar.svelte +261 -0
- package/dist/components/agents/AgentPresenceBar.svelte.d.ts +20 -0
- package/dist/components/agents/index.d.ts +4 -0
- package/dist/components/agents/index.js +5 -0
- package/dist/components/ai/AIConversationList.svelte +524 -0
- package/dist/components/ai/AIConversationList.svelte.d.ts +17 -0
- package/dist/components/ai/AIEditPreview.svelte +132 -0
- package/dist/components/ai/AIEditPreview.svelte.d.ts +8 -0
- package/dist/components/ai/AIInlineEdit.svelte +155 -0
- package/dist/components/ai/AIInlineEdit.svelte.d.ts +10 -0
- package/dist/components/ai/AIMessage.svelte +239 -0
- package/dist/components/ai/AIMessage.svelte.d.ts +13 -0
- package/dist/components/ai/AIMessageActions.svelte +176 -0
- package/dist/components/ai/AIMessageActions.svelte.d.ts +12 -0
- package/dist/components/ai/AIMessageContent.svelte +355 -0
- package/dist/components/ai/AIMessageContent.svelte.d.ts +7 -0
- package/dist/components/ai/AIPanel.svelte +561 -0
- package/dist/components/ai/AIPanel.svelte.d.ts +7 -0
- package/dist/components/ai/AISuggestionWidget.svelte +132 -0
- package/dist/components/ai/AISuggestionWidget.svelte.d.ts +10 -0
- package/dist/components/ai/AIToolCallDisplay.svelte +317 -0
- package/dist/components/ai/AIToolCallDisplay.svelte.d.ts +12 -0
- package/dist/components/ai/index.d.ts +9 -0
- package/dist/components/ai/index.js +10 -0
- package/dist/components/core/Avatar.svelte +110 -0
- package/dist/components/core/Avatar.svelte.d.ts +12 -0
- package/dist/components/core/Badge.svelte +98 -0
- package/dist/components/core/Badge.svelte.d.ts +11 -0
- package/dist/components/core/Button.svelte +175 -0
- package/dist/components/core/Button.svelte.d.ts +18 -0
- package/dist/components/core/ConnectionStatus.svelte +294 -0
- package/dist/components/core/ConnectionStatus.svelte.d.ts +20 -0
- package/dist/components/core/ContextMenu.svelte +176 -0
- package/dist/components/core/ContextMenu.svelte.d.ts +19 -0
- package/dist/components/core/ErrorBoundary.svelte +277 -0
- package/dist/components/core/ErrorBoundary.svelte.d.ts +23 -0
- package/dist/components/core/Icon.svelte +107 -0
- package/dist/components/core/Icon.svelte.d.ts +8 -0
- package/dist/components/core/Input.svelte +138 -0
- package/dist/components/core/Input.svelte.d.ts +20 -0
- package/dist/components/core/Kbd.svelte +34 -0
- package/dist/components/core/Kbd.svelte.d.ts +7 -0
- package/dist/components/core/ResizeHandle.svelte +200 -0
- package/dist/components/core/ResizeHandle.svelte.d.ts +23 -0
- package/dist/components/core/Spinner.svelte +35 -0
- package/dist/components/core/Spinner.svelte.d.ts +7 -0
- package/dist/components/core/Textarea.svelte +112 -0
- package/dist/components/core/Textarea.svelte.d.ts +18 -0
- package/dist/components/core/Tooltip.svelte +103 -0
- package/dist/components/core/Tooltip.svelte.d.ts +11 -0
- package/dist/components/core/index.d.ts +13 -0
- package/dist/components/core/index.js +14 -0
- package/dist/components/editor/AIFocusLayer.svelte +430 -0
- package/dist/components/editor/AIFocusLayer.svelte.d.ts +32 -0
- package/dist/components/editor/Breadcrumbs.svelte +435 -0
- package/dist/components/editor/Breadcrumbs.svelte.d.ts +33 -0
- package/dist/components/editor/BreakpointLayer.svelte +642 -0
- package/dist/components/editor/BreakpointLayer.svelte.d.ts +20 -0
- package/dist/components/editor/CognitiveLoadMeter.svelte +324 -0
- package/dist/components/editor/CognitiveLoadMeter.svelte.d.ts +18 -0
- package/dist/components/editor/CollaborativeEditor.svelte +218 -0
- package/dist/components/editor/CollaborativeEditor.svelte.d.ts +32 -0
- package/dist/components/editor/CommandPalette.svelte +434 -0
- package/dist/components/editor/CommandPalette.svelte.d.ts +11 -0
- package/dist/components/editor/ComplexityLayer.svelte +293 -0
- package/dist/components/editor/ComplexityLayer.svelte.d.ts +23 -0
- package/dist/components/editor/ConflictZoneLayer.svelte +441 -0
- package/dist/components/editor/ConflictZoneLayer.svelte.d.ts +25 -0
- package/dist/components/editor/ContextLens.svelte +262 -0
- package/dist/components/editor/ContextLens.svelte.d.ts +27 -0
- package/dist/components/editor/CustomEditor.svelte +1242 -0
- package/dist/components/editor/CustomEditor.svelte.d.ts +37 -0
- package/dist/components/editor/DebugConsole.svelte +646 -0
- package/dist/components/editor/DebugConsole.svelte.d.ts +41 -0
- package/dist/components/editor/EchoCursorLayer.svelte +363 -0
- package/dist/components/editor/EchoCursorLayer.svelte.d.ts +24 -0
- package/dist/components/editor/Editor.svelte +61 -0
- package/dist/components/editor/Editor.svelte.d.ts +22 -0
- package/dist/components/editor/EditorGutter.svelte +119 -0
- package/dist/components/editor/EditorGutter.svelte.d.ts +19 -0
- package/dist/components/editor/EditorLines.svelte +182 -0
- package/dist/components/editor/EditorLines.svelte.d.ts +43 -0
- package/dist/components/editor/EditorPane.svelte +134 -0
- package/dist/components/editor/EditorPane.svelte.d.ts +9 -0
- package/dist/components/editor/EditorSelections.svelte +186 -0
- package/dist/components/editor/EditorSelections.svelte.d.ts +25 -0
- package/dist/components/editor/EditorTabs.svelte +170 -0
- package/dist/components/editor/EditorTabs.svelte.d.ts +12 -0
- package/dist/components/editor/FileExplorer.svelte +811 -0
- package/dist/components/editor/FileExplorer.svelte.d.ts +67 -0
- package/dist/components/editor/FileIcon.svelte +110 -0
- package/dist/components/editor/FileIcon.svelte.d.ts +10 -0
- package/dist/components/editor/FindReplace.svelte +448 -0
- package/dist/components/editor/FindReplace.svelte.d.ts +40 -0
- package/dist/components/editor/GhostBracketLayer.svelte +391 -0
- package/dist/components/editor/GhostBracketLayer.svelte.d.ts +24 -0
- package/dist/components/editor/GitBlameLayer.svelte +436 -0
- package/dist/components/editor/GitBlameLayer.svelte.d.ts +18 -0
- package/dist/components/editor/InlineDiagnosticsLayer.svelte +540 -0
- package/dist/components/editor/InlineDiagnosticsLayer.svelte.d.ts +35 -0
- package/dist/components/editor/InlineDiffLayer.svelte +337 -0
- package/dist/components/editor/InlineDiffLayer.svelte.d.ts +31 -0
- package/dist/components/editor/MinimalEditor.svelte +75 -0
- package/dist/components/editor/MinimalEditor.svelte.d.ts +6 -0
- package/dist/components/editor/MinimalEditor2.svelte +84 -0
- package/dist/components/editor/MinimalEditor2.svelte.d.ts +6 -0
- package/dist/components/editor/Minimap.svelte +327 -0
- package/dist/components/editor/Minimap.svelte.d.ts +34 -0
- package/dist/components/editor/PluginPreviewSandbox.svelte +793 -0
- package/dist/components/editor/PluginPreviewSandbox.svelte.d.ts +49 -0
- package/dist/components/editor/ProblemsPanel.svelte +628 -0
- package/dist/components/editor/ProblemsPanel.svelte.d.ts +25 -0
- package/dist/components/editor/QuickActionsMenu.svelte +403 -0
- package/dist/components/editor/QuickActionsMenu.svelte.d.ts +18 -0
- package/dist/components/editor/SnippetPalette.svelte +530 -0
- package/dist/components/editor/SnippetPalette.svelte.d.ts +16 -0
- package/dist/components/editor/StructureMap.svelte +431 -0
- package/dist/components/editor/StructureMap.svelte.d.ts +37 -0
- package/dist/components/editor/SymbolOutline.svelte +722 -0
- package/dist/components/editor/SymbolOutline.svelte.d.ts +44 -0
- package/dist/components/editor/TimelineScrubber.svelte +470 -0
- package/dist/components/editor/TimelineScrubber.svelte.d.ts +40 -0
- package/dist/components/editor/TokenRenderer.svelte +69 -0
- package/dist/components/editor/TokenRenderer.svelte.d.ts +15 -0
- package/dist/components/editor/constants.d.ts +32 -0
- package/dist/components/editor/constants.js +36 -0
- package/dist/components/editor/core/ai-awareness.d.ts +176 -0
- package/dist/components/editor/core/ai-awareness.js +210 -0
- package/dist/components/editor/core/bracket-healer.d.ts +189 -0
- package/dist/components/editor/core/bracket-healer.js +406 -0
- package/dist/components/editor/core/breakpoints.d.ts +203 -0
- package/dist/components/editor/core/breakpoints.js +414 -0
- package/dist/components/editor/core/commands.d.ts +108 -0
- package/dist/components/editor/core/commands.js +246 -0
- package/dist/components/editor/core/complexity-analyzer.d.ts +123 -0
- package/dist/components/editor/core/complexity-analyzer.js +376 -0
- package/dist/components/editor/core/conflict-predictor.d.ts +135 -0
- package/dist/components/editor/core/conflict-predictor.js +316 -0
- package/dist/components/editor/core/crdt-binding.d.ts +118 -0
- package/dist/components/editor/core/crdt-binding.js +286 -0
- package/dist/components/editor/core/diagnostics.d.ts +210 -0
- package/dist/components/editor/core/diagnostics.js +335 -0
- package/dist/components/editor/core/echo-cursor.d.ts +201 -0
- package/dist/components/editor/core/echo-cursor.js +267 -0
- package/dist/components/editor/core/folding.d.ts +124 -0
- package/dist/components/editor/core/folding.js +672 -0
- package/dist/components/editor/core/ghost-pair.d.ts +122 -0
- package/dist/components/editor/core/ghost-pair.js +221 -0
- package/dist/components/editor/core/git-blame.d.ts +170 -0
- package/dist/components/editor/core/git-blame.js +324 -0
- package/dist/components/editor/core/index.d.ts +26 -0
- package/dist/components/editor/core/index.js +24 -0
- package/dist/components/editor/core/keybindings.d.ts +79 -0
- package/dist/components/editor/core/keybindings.js +357 -0
- package/dist/components/editor/core/multi-cursor.d.ts +196 -0
- package/dist/components/editor/core/multi-cursor.js +521 -0
- package/dist/components/editor/core/navigation.d.ts +107 -0
- package/dist/components/editor/core/navigation.js +408 -0
- package/dist/components/editor/core/quick-actions.d.ts +189 -0
- package/dist/components/editor/core/quick-actions.js +427 -0
- package/dist/components/editor/core/search.d.ts +88 -0
- package/dist/components/editor/core/search.js +192 -0
- package/dist/components/editor/core/semantic-analyzer.d.ts +77 -0
- package/dist/components/editor/core/semantic-analyzer.js +424 -0
- package/dist/components/editor/core/snippet-manager.d.ts +202 -0
- package/dist/components/editor/core/snippet-manager.js +565 -0
- package/dist/components/editor/core/state.d.ts +367 -0
- package/dist/components/editor/core/state.js +900 -0
- package/dist/components/editor/core/timeline.d.ts +204 -0
- package/dist/components/editor/core/timeline.js +349 -0
- package/dist/components/editor/editor-find.d.ts +56 -0
- package/dist/components/editor/editor-find.js +148 -0
- package/dist/components/editor/editor-input.d.ts +77 -0
- package/dist/components/editor/editor-input.js +445 -0
- package/dist/components/editor/editor-multicursor.d.ts +21 -0
- package/dist/components/editor/editor-multicursor.js +196 -0
- package/dist/components/editor/editor-scroll.d.ts +14 -0
- package/dist/components/editor/editor-scroll.js +34 -0
- package/dist/components/editor/index.d.ts +15 -0
- package/dist/components/editor/index.js +21 -0
- package/dist/components/editor/languages.d.ts +62 -0
- package/dist/components/editor/languages.js +285 -0
- package/dist/components/editor/theme.d.ts +88 -0
- package/dist/components/editor/theme.js +139 -0
- package/dist/components/editor/tokenizer/base.d.ts +40 -0
- package/dist/components/editor/tokenizer/base.js +203 -0
- package/dist/components/editor/tokenizer/index.d.ts +56 -0
- package/dist/components/editor/tokenizer/index.js +215 -0
- package/dist/components/editor/tokenizer/languages/css.d.ts +17 -0
- package/dist/components/editor/tokenizer/languages/css.js +194 -0
- package/dist/components/editor/tokenizer/languages/go.d.ts +17 -0
- package/dist/components/editor/tokenizer/languages/go.js +220 -0
- package/dist/components/editor/tokenizer/languages/html.d.ts +24 -0
- package/dist/components/editor/tokenizer/languages/html.js +145 -0
- package/dist/components/editor/tokenizer/languages/javascript.d.ts +56 -0
- package/dist/components/editor/tokenizer/languages/javascript.js +452 -0
- package/dist/components/editor/tokenizer/languages/json.d.ts +12 -0
- package/dist/components/editor/tokenizer/languages/json.js +91 -0
- package/dist/components/editor/tokenizer/languages/markdown.d.ts +16 -0
- package/dist/components/editor/tokenizer/languages/markdown.js +156 -0
- package/dist/components/editor/tokenizer/languages/python.d.ts +20 -0
- package/dist/components/editor/tokenizer/languages/python.js +227 -0
- package/dist/components/editor/tokenizer/languages/svelte.d.ts +40 -0
- package/dist/components/editor/tokenizer/languages/svelte.js +326 -0
- package/dist/components/editor/tokenizer/types.d.ts +86 -0
- package/dist/components/editor/tokenizer/types.js +4 -0
- package/dist/components/layout/IDELayout.svelte +274 -0
- package/dist/components/layout/IDELayout.svelte.d.ts +29 -0
- package/dist/components/layout/StatusBar.svelte +511 -0
- package/dist/components/layout/StatusBar.svelte.d.ts +47 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.js +3 -0
- package/dist/components/lsp/AutocompleteWidget.svelte +364 -0
- package/dist/components/lsp/AutocompleteWidget.svelte.d.ts +33 -0
- package/dist/components/lsp/DiagnosticMarker.svelte +166 -0
- package/dist/components/lsp/DiagnosticMarker.svelte.d.ts +19 -0
- package/dist/components/lsp/DiagnosticsPanel.svelte +388 -0
- package/dist/components/lsp/DiagnosticsPanel.svelte.d.ts +21 -0
- package/dist/components/lsp/HoverTooltip.svelte +274 -0
- package/dist/components/lsp/HoverTooltip.svelte.d.ts +24 -0
- package/dist/components/lsp/LSPEditor.svelte +486 -0
- package/dist/components/lsp/LSPEditor.svelte.d.ts +39 -0
- package/dist/components/lsp/SignatureHelpWidget.svelte +216 -0
- package/dist/components/lsp/SignatureHelpWidget.svelte.d.ts +22 -0
- package/dist/components/lsp/index.d.ts +6 -0
- package/dist/components/lsp/index.js +7 -0
- package/dist/components/plugins/PluginCard.svelte +153 -0
- package/dist/components/plugins/PluginCard.svelte.d.ts +19 -0
- package/dist/components/plugins/PluginPanel.svelte +280 -0
- package/dist/components/plugins/PluginPanel.svelte.d.ts +8 -0
- package/dist/components/plugins/PluginProposalForm.svelte +250 -0
- package/dist/components/plugins/PluginProposalForm.svelte.d.ts +6 -0
- package/dist/components/plugins/PluginStatusBadge.svelte +14 -0
- package/dist/components/plugins/PluginStatusBadge.svelte.d.ts +8 -0
- package/dist/components/plugins/index.d.ts +4 -0
- package/dist/components/plugins/index.js +5 -0
- package/dist/components/vfs/LockConflictDialog.svelte +705 -0
- package/dist/components/vfs/LockConflictDialog.svelte.d.ts +21 -0
- package/dist/components/vfs/LockIndicator.svelte +194 -0
- package/dist/components/vfs/LockIndicator.svelte.d.ts +29 -0
- package/dist/components/vfs/LockOverlay.svelte +344 -0
- package/dist/components/vfs/LockOverlay.svelte.d.ts +17 -0
- package/dist/components/vfs/VersionConflictDialog.svelte +549 -0
- package/dist/components/vfs/VersionConflictDialog.svelte.d.ts +24 -0
- package/dist/components/vfs/index.d.ts +4 -0
- package/dist/components/vfs/index.js +5 -0
- package/dist/crdt/awareness.d.ts +42 -0
- package/dist/crdt/awareness.js +109 -0
- package/dist/crdt/document.d.ts +101 -0
- package/dist/crdt/document.js +187 -0
- package/dist/crdt/index.d.ts +9 -0
- package/dist/crdt/index.js +8 -0
- package/dist/crdt/provider.d.ts +85 -0
- package/dist/crdt/provider.js +150 -0
- package/dist/crdt/types.d.ts +61 -0
- package/dist/crdt/types.js +4 -0
- package/dist/crdt/undo.d.ts +34 -0
- package/dist/crdt/undo.js +70 -0
- package/dist/index.d.ts +277 -0
- package/dist/index.js +280 -0
- package/dist/plugins/index.d.ts +103 -0
- package/dist/plugins/index.js +153 -0
- package/dist/services/error-handling.d.ts +95 -0
- package/dist/services/error-handling.js +413 -0
- package/dist/services/ide-integration.d.ts +83 -0
- package/dist/services/ide-integration.js +367 -0
- package/dist/services/lsp-client.d.ts +69 -0
- package/dist/services/lsp-client.js +667 -0
- package/dist/services/mock-ai.d.ts +37 -0
- package/dist/services/mock-ai.js +318 -0
- package/dist/services/optimistic.d.ts +141 -0
- package/dist/services/optimistic.js +367 -0
- package/dist/services/vfs-client.d.ts +81 -0
- package/dist/services/vfs-client.js +348 -0
- package/dist/stores/agents.svelte.d.ts +85 -0
- package/dist/stores/agents.svelte.js +459 -0
- package/dist/stores/ai-persistence.svelte.d.ts +76 -0
- package/dist/stores/ai-persistence.svelte.js +334 -0
- package/dist/stores/ai.svelte.d.ts +140 -0
- package/dist/stores/ai.svelte.js +383 -0
- package/dist/stores/collaboration.svelte.d.ts +164 -0
- package/dist/stores/collaboration.svelte.js +334 -0
- package/dist/stores/editor.svelte.d.ts +131 -0
- package/dist/stores/editor.svelte.js +250 -0
- package/dist/stores/index.d.ts +10 -0
- package/dist/stores/index.js +29 -0
- package/dist/stores/layout.svelte.d.ts +171 -0
- package/dist/stores/layout.svelte.js +351 -0
- package/dist/stores/plugin.svelte.d.ts +121 -0
- package/dist/stores/plugin.svelte.js +410 -0
- package/dist/stores/vfs.svelte.d.ts +123 -0
- package/dist/stores/vfs.svelte.js +680 -0
- package/dist/styles/theme.css +623 -0
- package/dist/types/agents.d.ts +127 -0
- package/dist/types/agents.js +5 -0
- package/dist/types/ai.d.ts +137 -0
- package/dist/types/ai.js +4 -0
- package/dist/types/crdt.d.ts +222 -0
- package/dist/types/crdt.js +5 -0
- package/dist/types/editor.d.ts +52 -0
- package/dist/types/editor.js +18 -0
- package/dist/types/events.d.ts +133 -0
- package/dist/types/events.js +4 -0
- package/dist/types/filesystem.d.ts +77 -0
- package/dist/types/filesystem.js +4 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +12 -0
- package/dist/types/lsp.d.ts +691 -0
- package/dist/types/lsp.js +108 -0
- package/dist/types/plugin.d.ts +239 -0
- package/dist/types/plugin.js +5 -0
- package/dist/types/vfs.d.ts +191 -0
- package/dist/types/vfs.js +18 -0
- package/dist/utils/format.d.ts +55 -0
- package/dist/utils/format.js +152 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/keybindings.d.ts +33 -0
- package/dist/utils/keybindings.js +171 -0
- package/dist/utils/language.d.ts +27 -0
- package/dist/utils/language.js +222 -0
- package/package.json +178 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Awareness System
|
|
3
|
+
*
|
|
4
|
+
* Tracks AI agent focus, attention, and activity within the editor.
|
|
5
|
+
* Enables "Ghost Pair" visualization - showing developers where
|
|
6
|
+
* AI agents are "looking" and what they're considering.
|
|
7
|
+
*
|
|
8
|
+
* Based on CRDT awareness patterns for real-time collaboration.
|
|
9
|
+
*/
|
|
10
|
+
import type { Position, Selection } from './state';
|
|
11
|
+
/**
|
|
12
|
+
* Types of AI attention/activity
|
|
13
|
+
*/
|
|
14
|
+
export type AIAttentionType = 'reading' | 'thinking' | 'writing' | 'reviewing' | 'waiting';
|
|
15
|
+
/**
|
|
16
|
+
* AI focus region - where the AI is paying attention
|
|
17
|
+
*/
|
|
18
|
+
export interface AIFocusRegion {
|
|
19
|
+
/** Start line (0-based) */
|
|
20
|
+
startLine: number;
|
|
21
|
+
/** End line (0-based) */
|
|
22
|
+
endLine: number;
|
|
23
|
+
/** Start column (0-based, optional for line-based focus) */
|
|
24
|
+
startColumn?: number;
|
|
25
|
+
/** End column (0-based, optional for line-based focus) */
|
|
26
|
+
endColumn?: number;
|
|
27
|
+
/** Attention intensity (0-1, used for glow effects) */
|
|
28
|
+
intensity: number;
|
|
29
|
+
/** Type of attention */
|
|
30
|
+
type: AIAttentionType;
|
|
31
|
+
/** Optional label for the region */
|
|
32
|
+
label?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* AI cursor position - the AI's "virtual cursor"
|
|
36
|
+
*/
|
|
37
|
+
export interface AICursor {
|
|
38
|
+
/** Current position */
|
|
39
|
+
position: Position;
|
|
40
|
+
/** Optional selection range */
|
|
41
|
+
selection?: Selection;
|
|
42
|
+
/** Cursor color (hex) */
|
|
43
|
+
color: string;
|
|
44
|
+
/** Whether cursor is visible */
|
|
45
|
+
visible: boolean;
|
|
46
|
+
/** Animation state */
|
|
47
|
+
animation: 'idle' | 'moving' | 'typing' | 'thinking';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* AI agent awareness state
|
|
51
|
+
*/
|
|
52
|
+
export interface AIAwareness {
|
|
53
|
+
/** Unique agent ID */
|
|
54
|
+
agentId: string;
|
|
55
|
+
/** Agent display name */
|
|
56
|
+
agentName: string;
|
|
57
|
+
/** Agent color for visualization */
|
|
58
|
+
color: string;
|
|
59
|
+
/** Current attention type */
|
|
60
|
+
attentionType: AIAttentionType;
|
|
61
|
+
/** AI cursor position */
|
|
62
|
+
cursor: AICursor | null;
|
|
63
|
+
/** Regions the AI is focused on */
|
|
64
|
+
focusRegions: AIFocusRegion[];
|
|
65
|
+
/** Current activity description */
|
|
66
|
+
activity: string;
|
|
67
|
+
/** Confidence level (0-1) for current action */
|
|
68
|
+
confidence: number;
|
|
69
|
+
/** Timestamp of last update */
|
|
70
|
+
lastUpdate: number;
|
|
71
|
+
/** Whether the agent is actively engaged with this file */
|
|
72
|
+
isActive: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Event types for AI awareness changes
|
|
76
|
+
*/
|
|
77
|
+
export type AIAwarenessEventType = 'cursor-move' | 'focus-change' | 'attention-change' | 'activity-change' | 'agent-join' | 'agent-leave';
|
|
78
|
+
/**
|
|
79
|
+
* AI awareness event
|
|
80
|
+
*/
|
|
81
|
+
export interface AIAwarenessEvent {
|
|
82
|
+
type: AIAwarenessEventType;
|
|
83
|
+
agentId: string;
|
|
84
|
+
timestamp: number;
|
|
85
|
+
data?: unknown;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Callback type for awareness changes
|
|
89
|
+
*/
|
|
90
|
+
export type AIAwarenessCallback = (agents: Map<string, AIAwareness>) => void;
|
|
91
|
+
/**
|
|
92
|
+
* AI Awareness Manager
|
|
93
|
+
*
|
|
94
|
+
* Manages AI agent presence and focus within the editor.
|
|
95
|
+
* Supports multiple concurrent AI agents.
|
|
96
|
+
*/
|
|
97
|
+
export declare class AIAwarenessManager {
|
|
98
|
+
private agents;
|
|
99
|
+
private listeners;
|
|
100
|
+
private eventHistory;
|
|
101
|
+
private maxHistorySize;
|
|
102
|
+
/**
|
|
103
|
+
* Register or update an AI agent
|
|
104
|
+
*/
|
|
105
|
+
setAgent(awareness: AIAwareness): void;
|
|
106
|
+
/**
|
|
107
|
+
* Remove an AI agent
|
|
108
|
+
*/
|
|
109
|
+
removeAgent(agentId: string): void;
|
|
110
|
+
/**
|
|
111
|
+
* Update AI cursor position
|
|
112
|
+
*/
|
|
113
|
+
updateCursor(agentId: string, cursor: AICursor): void;
|
|
114
|
+
/**
|
|
115
|
+
* Update AI focus regions
|
|
116
|
+
*/
|
|
117
|
+
updateFocusRegions(agentId: string, regions: AIFocusRegion[]): void;
|
|
118
|
+
/**
|
|
119
|
+
* Update AI attention type
|
|
120
|
+
*/
|
|
121
|
+
updateAttention(agentId: string, type: AIAttentionType, activity?: string): void;
|
|
122
|
+
/**
|
|
123
|
+
* Get all active AI agents
|
|
124
|
+
*/
|
|
125
|
+
getAgents(): Map<string, AIAwareness>;
|
|
126
|
+
/**
|
|
127
|
+
* Get a specific agent
|
|
128
|
+
*/
|
|
129
|
+
getAgent(agentId: string): AIAwareness | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Get active agents (updated within last 30 seconds)
|
|
132
|
+
*/
|
|
133
|
+
getActiveAgents(): AIAwareness[];
|
|
134
|
+
/**
|
|
135
|
+
* Subscribe to awareness changes
|
|
136
|
+
*/
|
|
137
|
+
onChange(callback: AIAwarenessCallback): () => void;
|
|
138
|
+
/**
|
|
139
|
+
* Get recent events
|
|
140
|
+
*/
|
|
141
|
+
getRecentEvents(count?: number): AIAwarenessEvent[];
|
|
142
|
+
/**
|
|
143
|
+
* Clear all agents
|
|
144
|
+
*/
|
|
145
|
+
clear(): void;
|
|
146
|
+
/**
|
|
147
|
+
* Record an event
|
|
148
|
+
*/
|
|
149
|
+
private recordEvent;
|
|
150
|
+
/**
|
|
151
|
+
* Notify all listeners
|
|
152
|
+
*/
|
|
153
|
+
private notifyListeners;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Default AI agent colors
|
|
157
|
+
*/
|
|
158
|
+
export declare const AI_AGENT_COLORS: {
|
|
159
|
+
claude: string;
|
|
160
|
+
assistant: string;
|
|
161
|
+
copilot: string;
|
|
162
|
+
default: string;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Get color for AI agent
|
|
166
|
+
*/
|
|
167
|
+
export declare function getAgentColor(agentName: string): string;
|
|
168
|
+
/**
|
|
169
|
+
* Create a new AI awareness state
|
|
170
|
+
*/
|
|
171
|
+
export declare function createAIAwareness(agentId: string, agentName: string, options?: Partial<Omit<AIAwareness, 'agentId' | 'agentName'>>): AIAwareness;
|
|
172
|
+
export declare function getAIAwarenessManager(): AIAwarenessManager;
|
|
173
|
+
/**
|
|
174
|
+
* Create a new manager instance
|
|
175
|
+
*/
|
|
176
|
+
export declare function createAIAwarenessManager(): AIAwarenessManager;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Awareness System
|
|
3
|
+
*
|
|
4
|
+
* Tracks AI agent focus, attention, and activity within the editor.
|
|
5
|
+
* Enables "Ghost Pair" visualization - showing developers where
|
|
6
|
+
* AI agents are "looking" and what they're considering.
|
|
7
|
+
*
|
|
8
|
+
* Based on CRDT awareness patterns for real-time collaboration.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* AI Awareness Manager
|
|
12
|
+
*
|
|
13
|
+
* Manages AI agent presence and focus within the editor.
|
|
14
|
+
* Supports multiple concurrent AI agents.
|
|
15
|
+
*/
|
|
16
|
+
export class AIAwarenessManager {
|
|
17
|
+
agents = new Map();
|
|
18
|
+
listeners = new Set();
|
|
19
|
+
eventHistory = [];
|
|
20
|
+
maxHistorySize = 100;
|
|
21
|
+
/**
|
|
22
|
+
* Register or update an AI agent
|
|
23
|
+
*/
|
|
24
|
+
setAgent(awareness) {
|
|
25
|
+
const existing = this.agents.get(awareness.agentId);
|
|
26
|
+
this.agents.set(awareness.agentId, {
|
|
27
|
+
...awareness,
|
|
28
|
+
lastUpdate: Date.now()
|
|
29
|
+
});
|
|
30
|
+
const eventType = existing ? 'activity-change' : 'agent-join';
|
|
31
|
+
this.recordEvent(eventType, awareness.agentId);
|
|
32
|
+
this.notifyListeners();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Remove an AI agent
|
|
36
|
+
*/
|
|
37
|
+
removeAgent(agentId) {
|
|
38
|
+
if (this.agents.has(agentId)) {
|
|
39
|
+
this.agents.delete(agentId);
|
|
40
|
+
this.recordEvent('agent-leave', agentId);
|
|
41
|
+
this.notifyListeners();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Update AI cursor position
|
|
46
|
+
*/
|
|
47
|
+
updateCursor(agentId, cursor) {
|
|
48
|
+
const agent = this.agents.get(agentId);
|
|
49
|
+
if (agent) {
|
|
50
|
+
agent.cursor = cursor;
|
|
51
|
+
agent.lastUpdate = Date.now();
|
|
52
|
+
this.recordEvent('cursor-move', agentId, { position: cursor.position });
|
|
53
|
+
this.notifyListeners();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Update AI focus regions
|
|
58
|
+
*/
|
|
59
|
+
updateFocusRegions(agentId, regions) {
|
|
60
|
+
const agent = this.agents.get(agentId);
|
|
61
|
+
if (agent) {
|
|
62
|
+
agent.focusRegions = regions;
|
|
63
|
+
agent.lastUpdate = Date.now();
|
|
64
|
+
this.recordEvent('focus-change', agentId, { regionCount: regions.length });
|
|
65
|
+
this.notifyListeners();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Update AI attention type
|
|
70
|
+
*/
|
|
71
|
+
updateAttention(agentId, type, activity) {
|
|
72
|
+
const agent = this.agents.get(agentId);
|
|
73
|
+
if (agent) {
|
|
74
|
+
agent.attentionType = type;
|
|
75
|
+
if (activity !== undefined) {
|
|
76
|
+
agent.activity = activity;
|
|
77
|
+
}
|
|
78
|
+
agent.lastUpdate = Date.now();
|
|
79
|
+
this.recordEvent('attention-change', agentId, { type, activity });
|
|
80
|
+
this.notifyListeners();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get all active AI agents
|
|
85
|
+
*/
|
|
86
|
+
getAgents() {
|
|
87
|
+
return new Map(this.agents);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get a specific agent
|
|
91
|
+
*/
|
|
92
|
+
getAgent(agentId) {
|
|
93
|
+
return this.agents.get(agentId);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get active agents (updated within last 30 seconds)
|
|
97
|
+
*/
|
|
98
|
+
getActiveAgents() {
|
|
99
|
+
const now = Date.now();
|
|
100
|
+
const staleThreshold = 30000; // 30 seconds
|
|
101
|
+
return Array.from(this.agents.values()).filter((agent) => agent.isActive && now - agent.lastUpdate < staleThreshold);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Subscribe to awareness changes
|
|
105
|
+
*/
|
|
106
|
+
onChange(callback) {
|
|
107
|
+
this.listeners.add(callback);
|
|
108
|
+
return () => {
|
|
109
|
+
this.listeners.delete(callback);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get recent events
|
|
114
|
+
*/
|
|
115
|
+
getRecentEvents(count = 10) {
|
|
116
|
+
return this.eventHistory.slice(-count);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Clear all agents
|
|
120
|
+
*/
|
|
121
|
+
clear() {
|
|
122
|
+
this.agents.clear();
|
|
123
|
+
this.eventHistory = [];
|
|
124
|
+
this.notifyListeners();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Record an event
|
|
128
|
+
*/
|
|
129
|
+
recordEvent(type, agentId, data) {
|
|
130
|
+
this.eventHistory.push({
|
|
131
|
+
type,
|
|
132
|
+
agentId,
|
|
133
|
+
timestamp: Date.now(),
|
|
134
|
+
data
|
|
135
|
+
});
|
|
136
|
+
// Trim history
|
|
137
|
+
if (this.eventHistory.length > this.maxHistorySize) {
|
|
138
|
+
this.eventHistory = this.eventHistory.slice(-this.maxHistorySize);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Notify all listeners
|
|
143
|
+
*/
|
|
144
|
+
notifyListeners() {
|
|
145
|
+
const snapshot = this.getAgents();
|
|
146
|
+
for (const callback of this.listeners) {
|
|
147
|
+
try {
|
|
148
|
+
callback(snapshot);
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error('[AIAwarenessManager] Listener error:', error);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Default AI agent colors
|
|
158
|
+
*/
|
|
159
|
+
export const AI_AGENT_COLORS = {
|
|
160
|
+
claude: '#8B5CF6', // Purple (Anthropic brand)
|
|
161
|
+
assistant: '#3B82F6', // Blue
|
|
162
|
+
copilot: '#22C55E', // Green
|
|
163
|
+
default: '#F59E0B' // Amber
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Get color for AI agent
|
|
167
|
+
*/
|
|
168
|
+
export function getAgentColor(agentName) {
|
|
169
|
+
const normalized = agentName.toLowerCase();
|
|
170
|
+
if (normalized.includes('claude'))
|
|
171
|
+
return AI_AGENT_COLORS.claude;
|
|
172
|
+
if (normalized.includes('copilot'))
|
|
173
|
+
return AI_AGENT_COLORS.copilot;
|
|
174
|
+
if (normalized.includes('assistant'))
|
|
175
|
+
return AI_AGENT_COLORS.assistant;
|
|
176
|
+
return AI_AGENT_COLORS.default;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Create a new AI awareness state
|
|
180
|
+
*/
|
|
181
|
+
export function createAIAwareness(agentId, agentName, options = {}) {
|
|
182
|
+
return {
|
|
183
|
+
agentId,
|
|
184
|
+
agentName,
|
|
185
|
+
color: options.color ?? getAgentColor(agentName),
|
|
186
|
+
attentionType: options.attentionType ?? 'reading',
|
|
187
|
+
cursor: options.cursor ?? null,
|
|
188
|
+
focusRegions: options.focusRegions ?? [],
|
|
189
|
+
activity: options.activity ?? '',
|
|
190
|
+
confidence: options.confidence ?? 0.5,
|
|
191
|
+
lastUpdate: Date.now(),
|
|
192
|
+
isActive: options.isActive ?? true
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Singleton instance
|
|
197
|
+
*/
|
|
198
|
+
let defaultManager = null;
|
|
199
|
+
export function getAIAwarenessManager() {
|
|
200
|
+
if (!defaultManager) {
|
|
201
|
+
defaultManager = new AIAwarenessManager();
|
|
202
|
+
}
|
|
203
|
+
return defaultManager;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Create a new manager instance
|
|
207
|
+
*/
|
|
208
|
+
export function createAIAwarenessManager() {
|
|
209
|
+
return new AIAwarenessManager();
|
|
210
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bracket Healer
|
|
3
|
+
*
|
|
4
|
+
* Intelligent bracket completion and morphing system.
|
|
5
|
+
* Detects mismatched brackets and suggests "ghost brackets"
|
|
6
|
+
* to heal document structure.
|
|
7
|
+
*/
|
|
8
|
+
import type { Position } from './state';
|
|
9
|
+
/**
|
|
10
|
+
* Bracket pair definition
|
|
11
|
+
*/
|
|
12
|
+
export interface BracketPair {
|
|
13
|
+
open: string;
|
|
14
|
+
close: string;
|
|
15
|
+
/** Language-specific (e.g., JSX angle brackets) */
|
|
16
|
+
language?: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Bracket match result
|
|
20
|
+
*/
|
|
21
|
+
export interface BracketMatch {
|
|
22
|
+
/** Opening bracket position */
|
|
23
|
+
openPos: Position;
|
|
24
|
+
/** Closing bracket position (null if unmatched) */
|
|
25
|
+
closePos: Position | null;
|
|
26
|
+
/** Bracket type */
|
|
27
|
+
type: BracketPair;
|
|
28
|
+
/** Whether this pair is complete */
|
|
29
|
+
isComplete: boolean;
|
|
30
|
+
/** Nesting depth */
|
|
31
|
+
depth: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Ghost bracket suggestion
|
|
35
|
+
*/
|
|
36
|
+
export interface GhostBracket {
|
|
37
|
+
/** Unique ID */
|
|
38
|
+
id: string;
|
|
39
|
+
/** Position where ghost should appear */
|
|
40
|
+
position: Position;
|
|
41
|
+
/** Character to insert */
|
|
42
|
+
character: string;
|
|
43
|
+
/** Type: 'open' or 'close' */
|
|
44
|
+
type: 'open' | 'close';
|
|
45
|
+
/** Matching bracket position */
|
|
46
|
+
matchPosition: Position;
|
|
47
|
+
/** Confidence score (0-1) */
|
|
48
|
+
confidence: number;
|
|
49
|
+
/** Suggested fix reason */
|
|
50
|
+
reason: string;
|
|
51
|
+
/** Whether user dismissed this suggestion */
|
|
52
|
+
dismissed: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Bracket mismatch diagnostic
|
|
56
|
+
*/
|
|
57
|
+
export interface BracketMismatch {
|
|
58
|
+
/** Position of the problematic bracket */
|
|
59
|
+
position: Position;
|
|
60
|
+
/** The bracket character */
|
|
61
|
+
character: string;
|
|
62
|
+
/** Expected bracket (if mismatched) */
|
|
63
|
+
expected?: string;
|
|
64
|
+
/** Type of issue */
|
|
65
|
+
issue: 'unclosed' | 'unexpected' | 'mismatched';
|
|
66
|
+
/** Severity */
|
|
67
|
+
severity: 'error' | 'warning' | 'info';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Bracket healer state
|
|
71
|
+
*/
|
|
72
|
+
export interface BracketHealerState {
|
|
73
|
+
/** All bracket matches */
|
|
74
|
+
matches: BracketMatch[];
|
|
75
|
+
/** Ghost bracket suggestions */
|
|
76
|
+
ghosts: GhostBracket[];
|
|
77
|
+
/** Mismatch diagnostics */
|
|
78
|
+
mismatches: BracketMismatch[];
|
|
79
|
+
/** Whether healing is enabled */
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Bracket healer configuration
|
|
84
|
+
*/
|
|
85
|
+
export interface BracketHealerConfig {
|
|
86
|
+
/** Bracket pairs to match */
|
|
87
|
+
pairs: BracketPair[];
|
|
88
|
+
/** Minimum confidence to show ghost */
|
|
89
|
+
minConfidence: number;
|
|
90
|
+
/** Maximum ghost suggestions */
|
|
91
|
+
maxGhosts: number;
|
|
92
|
+
/** Debounce time for analysis */
|
|
93
|
+
debounceMs: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Bracket Healer Manager
|
|
97
|
+
*/
|
|
98
|
+
export declare class BracketHealer {
|
|
99
|
+
private config;
|
|
100
|
+
private state;
|
|
101
|
+
private language;
|
|
102
|
+
private debounceTimer;
|
|
103
|
+
private listeners;
|
|
104
|
+
constructor(config?: Partial<BracketHealerConfig>);
|
|
105
|
+
/**
|
|
106
|
+
* Set current language
|
|
107
|
+
*/
|
|
108
|
+
setLanguage(language: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Enable/disable healing
|
|
111
|
+
*/
|
|
112
|
+
setEnabled(enabled: boolean): void;
|
|
113
|
+
/**
|
|
114
|
+
* Analyze document content
|
|
115
|
+
*/
|
|
116
|
+
analyze(content: string): void;
|
|
117
|
+
/**
|
|
118
|
+
* Analyze immediately (no debounce)
|
|
119
|
+
*/
|
|
120
|
+
analyzeImmediate(content: string): void;
|
|
121
|
+
/**
|
|
122
|
+
* Perform bracket analysis
|
|
123
|
+
*/
|
|
124
|
+
private performAnalysis;
|
|
125
|
+
/**
|
|
126
|
+
* Extract all brackets from content
|
|
127
|
+
*/
|
|
128
|
+
private extractBrackets;
|
|
129
|
+
/**
|
|
130
|
+
* Get bracket pairs active for current language
|
|
131
|
+
*/
|
|
132
|
+
private getActivePairs;
|
|
133
|
+
/**
|
|
134
|
+
* Match brackets and find mismatches
|
|
135
|
+
*/
|
|
136
|
+
private matchBrackets;
|
|
137
|
+
/**
|
|
138
|
+
* Generate ghost bracket suggestions
|
|
139
|
+
*/
|
|
140
|
+
private generateGhosts;
|
|
141
|
+
/**
|
|
142
|
+
* Suggest where to place a closing bracket
|
|
143
|
+
*/
|
|
144
|
+
private suggestClosingBracket;
|
|
145
|
+
/**
|
|
146
|
+
* Get line indentation level
|
|
147
|
+
*/
|
|
148
|
+
private getIndentation;
|
|
149
|
+
/**
|
|
150
|
+
* Accept a ghost bracket suggestion
|
|
151
|
+
*/
|
|
152
|
+
acceptGhost(id: string): GhostBracket | null;
|
|
153
|
+
/**
|
|
154
|
+
* Dismiss a ghost bracket suggestion
|
|
155
|
+
*/
|
|
156
|
+
dismissGhost(id: string): void;
|
|
157
|
+
/**
|
|
158
|
+
* Get current state
|
|
159
|
+
*/
|
|
160
|
+
getState(): BracketHealerState;
|
|
161
|
+
/**
|
|
162
|
+
* Get ghost brackets (non-dismissed only)
|
|
163
|
+
*/
|
|
164
|
+
getActiveGhosts(): GhostBracket[];
|
|
165
|
+
/**
|
|
166
|
+
* Get mismatches
|
|
167
|
+
*/
|
|
168
|
+
getMismatches(): BracketMismatch[];
|
|
169
|
+
/**
|
|
170
|
+
* Find matching bracket for position
|
|
171
|
+
*/
|
|
172
|
+
findMatchingBracket(position: Position): Position | null;
|
|
173
|
+
/**
|
|
174
|
+
* Subscribe to state changes
|
|
175
|
+
*/
|
|
176
|
+
subscribe(listener: (state: BracketHealerState) => void): () => void;
|
|
177
|
+
/**
|
|
178
|
+
* Notify listeners
|
|
179
|
+
*/
|
|
180
|
+
private notify;
|
|
181
|
+
/**
|
|
182
|
+
* Destroy and cleanup
|
|
183
|
+
*/
|
|
184
|
+
destroy(): void;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Create a bracket healer instance
|
|
188
|
+
*/
|
|
189
|
+
export declare function createBracketHealer(config?: Partial<BracketHealerConfig>): BracketHealer;
|