@noorm/marie-cli 0.1.0
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/JOY_ZONING.md +200 -0
- package/LICENSE.md +190 -0
- package/README.md +94 -0
- package/dist/cli-new/components/App.js +138 -0
- package/dist/cli-new/components/App.js.map +1 -0
- package/dist/cli-new/components/ApprovalDialog.js +31 -0
- package/dist/cli-new/components/ApprovalDialog.js.map +1 -0
- package/dist/cli-new/components/Banner.js +23 -0
- package/dist/cli-new/components/Banner.js.map +1 -0
- package/dist/cli-new/components/ChatArea.js +49 -0
- package/dist/cli-new/components/ChatArea.js.map +1 -0
- package/dist/cli-new/components/Header.js +20 -0
- package/dist/cli-new/components/Header.js.map +1 -0
- package/dist/cli-new/components/InputArea.js +97 -0
- package/dist/cli-new/components/InputArea.js.map +1 -0
- package/dist/cli-new/components/MessageBubble.js +114 -0
- package/dist/cli-new/components/MessageBubble.js.map +1 -0
- package/dist/cli-new/components/SessionSwitcher.js +46 -0
- package/dist/cli-new/components/SessionSwitcher.js.map +1 -0
- package/dist/cli-new/components/SetupWizard.js +283 -0
- package/dist/cli-new/components/SetupWizard.js.map +1 -0
- package/dist/cli-new/components/ToolCallDisplay.js +45 -0
- package/dist/cli-new/components/ToolCallDisplay.js.map +1 -0
- package/dist/cli-new/hooks/useGit.js +99 -0
- package/dist/cli-new/hooks/useGit.js.map +1 -0
- package/dist/cli-new/hooks/useMarie.js +249 -0
- package/dist/cli-new/hooks/useMarie.js.map +1 -0
- package/dist/cli-new/hooks/useSessions.js +75 -0
- package/dist/cli-new/hooks/useSessions.js.map +1 -0
- package/dist/cli-new/index.js +52 -0
- package/dist/cli-new/index.js.map +1 -0
- package/dist/cli-new/styles/theme.js +68 -0
- package/dist/cli-new/styles/theme.js.map +1 -0
- package/dist/cli-new/types/cli.js +2 -0
- package/dist/cli-new/types/cli.js.map +1 -0
- package/dist/extension.cjs +655 -0
- package/dist/monolith/adapters/CliMarieAdapter.js +72 -0
- package/dist/monolith/adapters/CliMarieAdapter.js.map +1 -0
- package/dist/monolith/adapters/VscodeMarieAdapter.js +81 -0
- package/dist/monolith/adapters/VscodeMarieAdapter.js.map +1 -0
- package/dist/monolith/cli/CliFileSystemPort.js +83 -0
- package/dist/monolith/cli/CliFileSystemPort.js.map +1 -0
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js +438 -0
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js.map +1 -0
- package/dist/monolith/cli/index.js +272 -0
- package/dist/monolith/cli/index.js.map +1 -0
- package/dist/monolith/cli/services/JoyAutomationServiceCLI.js +80 -0
- package/dist/monolith/cli/services/JoyAutomationServiceCLI.js.map +1 -0
- package/dist/monolith/cli/services/JoyServiceCLI.js +63 -0
- package/dist/monolith/cli/services/JoyServiceCLI.js.map +1 -0
- package/dist/monolith/cli/storage.js +119 -0
- package/dist/monolith/cli/storage.js.map +1 -0
- package/dist/monolith/domain/joy/JoyTools.js +513 -0
- package/dist/monolith/domain/joy/JoyTools.js.map +1 -0
- package/dist/monolith/domain/joy/RitualService.js +51 -0
- package/dist/monolith/domain/joy/RitualService.js.map +1 -0
- package/dist/monolith/domain/marie/MarieTypes.js +2 -0
- package/dist/monolith/domain/marie/MarieTypes.js.map +1 -0
- package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js +230 -0
- package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js.map +1 -0
- package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js +207 -0
- package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js.map +1 -0
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js +129 -0
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js.map +1 -0
- package/dist/monolith/infrastructure/ai/context/ContextManager.js +118 -0
- package/dist/monolith/infrastructure/ai/context/ContextManager.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/FileSystemPort.js +2 -0
- package/dist/monolith/infrastructure/ai/core/FileSystemPort.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/GhostPort.js +2 -0
- package/dist/monolith/infrastructure/ai/core/GhostPort.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieAscensionTypes.js +2 -0
- package/dist/monolith/infrastructure/ai/core/MarieAscensionTypes.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js +590 -0
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js +161 -0
- package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js +121 -0
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js +256 -0
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MariePulseService.js +67 -0
- package/dist/monolith/infrastructure/ai/core/MariePulseService.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieResponse.js +101 -0
- package/dist/monolith/infrastructure/ai/core/MarieResponse.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js +86 -0
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieSession.js +202 -0
- package/dist/monolith/infrastructure/ai/core/MarieSession.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js +58 -0
- package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolMender.js +127 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolMender.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js +548 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js +2 -0
- package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js +125 -0
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js +30 -0
- package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/AIProvider.js +2 -0
- package/dist/monolith/infrastructure/ai/providers/AIProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js +148 -0
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js +208 -0
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js +404 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js +283 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js.map +1 -0
- package/dist/monolith/infrastructure/config/ConfigService.js +398 -0
- package/dist/monolith/infrastructure/config/ConfigService.js.map +1 -0
- package/dist/monolith/infrastructure/services/MarieMemoryStore.js +140 -0
- package/dist/monolith/infrastructure/services/MarieMemoryStore.js.map +1 -0
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js +1568 -0
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js.map +1 -0
- package/dist/monolith/infrastructure/tools/PureStreamParser.js +147 -0
- package/dist/monolith/infrastructure/tools/PureStreamParser.js.map +1 -0
- package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js +223 -0
- package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js.map +1 -0
- package/dist/monolith/infrastructure/tools/ToolRegistry.js +29 -0
- package/dist/monolith/infrastructure/tools/ToolRegistry.js.map +1 -0
- package/dist/monolith/infrastructure/tools/ToolUtils.js +59 -0
- package/dist/monolith/infrastructure/tools/ToolUtils.js.map +1 -0
- package/dist/monolith/plumbing/analysis/CodeHealthService.js +146 -0
- package/dist/monolith/plumbing/analysis/CodeHealthService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/ComplexityService.js +43 -0
- package/dist/monolith/plumbing/analysis/ComplexityService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/DependencyService.js +51 -0
- package/dist/monolith/plumbing/analysis/DependencyService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/DiscoveryService.js +49 -0
- package/dist/monolith/plumbing/analysis/DiscoveryService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/JoyMapService.js +66 -0
- package/dist/monolith/plumbing/analysis/JoyMapService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/LintService.js +132 -0
- package/dist/monolith/plumbing/analysis/LintService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js +276 -0
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/QualityGuardrailService.js +119 -0
- package/dist/monolith/plumbing/analysis/QualityGuardrailService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/SurgicalMender.js +70 -0
- package/dist/monolith/plumbing/analysis/SurgicalMender.js.map +1 -0
- package/dist/monolith/plumbing/analysis/TestService.js +104 -0
- package/dist/monolith/plumbing/analysis/TestService.js.map +1 -0
- package/dist/monolith/plumbing/filesystem/FileService.js +406 -0
- package/dist/monolith/plumbing/filesystem/FileService.js.map +1 -0
- package/dist/monolith/plumbing/filesystem/PathResolver.js +26 -0
- package/dist/monolith/plumbing/filesystem/PathResolver.js.map +1 -0
- package/dist/monolith/plumbing/git/GitService.js +71 -0
- package/dist/monolith/plumbing/git/GitService.js.map +1 -0
- package/dist/monolith/plumbing/lsp/SymbolService.js +36 -0
- package/dist/monolith/plumbing/lsp/SymbolService.js.map +1 -0
- package/dist/monolith/plumbing/terminal/ProcessRegistry.js +31 -0
- package/dist/monolith/plumbing/terminal/ProcessRegistry.js.map +1 -0
- package/dist/monolith/plumbing/terminal/TerminalService.js +180 -0
- package/dist/monolith/plumbing/terminal/TerminalService.js.map +1 -0
- package/dist/monolith/plumbing/ui/DecorationService.js +54 -0
- package/dist/monolith/plumbing/ui/DecorationService.js.map +1 -0
- package/dist/monolith/plumbing/utils/ErrorUtils.js +11 -0
- package/dist/monolith/plumbing/utils/ErrorUtils.js.map +1 -0
- package/dist/monolith/plumbing/utils/JsonUtils.js +360 -0
- package/dist/monolith/plumbing/utils/JsonUtils.js.map +1 -0
- package/dist/monolith/plumbing/utils/PrefixTree.js +153 -0
- package/dist/monolith/plumbing/utils/PrefixTree.js.map +1 -0
- package/dist/monolith/plumbing/utils/RetryUtils.js +141 -0
- package/dist/monolith/plumbing/utils/RetryUtils.js.map +1 -0
- package/dist/monolith/plumbing/utils/StreamTagDetector.js +128 -0
- package/dist/monolith/plumbing/utils/StreamTagDetector.js.map +1 -0
- package/dist/monolith/plumbing/utils/StringUtils.js +97 -0
- package/dist/monolith/plumbing/utils/StringUtils.js.map +1 -0
- package/dist/monolith/plumbing/utils/TimeoutUtils.js +21 -0
- package/dist/monolith/plumbing/utils/TimeoutUtils.js.map +1 -0
- package/dist/monolith/runtime/MarieRuntime.js +354 -0
- package/dist/monolith/runtime/MarieRuntime.js.map +1 -0
- package/dist/monolith/runtime/RuntimeAdapterBase.js +59 -0
- package/dist/monolith/runtime/RuntimeAdapterBase.js.map +1 -0
- package/dist/monolith/runtime/providerFactory.js +11 -0
- package/dist/monolith/runtime/providerFactory.js.map +1 -0
- package/dist/monolith/runtime/types.js +2 -0
- package/dist/monolith/runtime/types.js.map +1 -0
- package/dist/monolith/services/HealthService.js +38 -0
- package/dist/monolith/services/HealthService.js.map +1 -0
- package/dist/monolith/services/JoyAutomationService.js +131 -0
- package/dist/monolith/services/JoyAutomationService.js.map +1 -0
- package/dist/monolith/services/JoyLogService.js +48 -0
- package/dist/monolith/services/JoyLogService.js.map +1 -0
- package/dist/monolith/services/JoyService.js +190 -0
- package/dist/monolith/services/JoyService.js.map +1 -0
- package/dist/monolith/services/MarieGhostService.js +168 -0
- package/dist/monolith/services/MarieGhostService.js.map +1 -0
- package/dist/monolith/services/MarieSCMProvider.js +41 -0
- package/dist/monolith/services/MarieSCMProvider.js.map +1 -0
- package/package.json +168 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useStdout } from "ink";
|
|
3
|
+
import { marieTheme } from "../styles/theme.js";
|
|
4
|
+
export const Banner = ({ show = true }) => {
|
|
5
|
+
const { stdout } = useStdout();
|
|
6
|
+
const width = stdout?.columns || 80;
|
|
7
|
+
if (!show)
|
|
8
|
+
return null;
|
|
9
|
+
// If screen is too small, use compact banner
|
|
10
|
+
if (width < 65) {
|
|
11
|
+
return _jsx(CompactBanner, {});
|
|
12
|
+
}
|
|
13
|
+
return (_jsx(Box, { flexDirection: "column", alignItems: "center", marginTop: 0, marginBottom: 0, children: _jsxs(Box, { flexDirection: "column", alignItems: "center", children: [_jsx(Text, { color: marieTheme.colors.primary, children: " ███╗ ███╗ █████╗ ██████╗ ██╗███████╗" }), _jsx(Text, { color: marieTheme.colors.primary, children: " ████╗ ████║██╔══██╗██╔══██╗██║██╔════╝" }), _jsx(Text, { color: marieTheme.colors.primary, children: " ██╔████╔██║███████║██████╔╝██║█████╗ " }), _jsx(Text, { color: marieTheme.colors.primary, children: " ██║╚██╔╝██║██╔══██║██╔══██╗██║██╔══╝ " }), _jsx(Text, { color: marieTheme.colors.primary, children: " ██║ ╚═╝ ██║██║ ██║██║ ██║██║███████╗" }), _jsx(Text, { color: marieTheme.colors.primary, children: " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚══════╝" }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: marieTheme.colors.secondary, children: "✦ AI Coding Assistant ✦ " }), _jsx(Text, { color: marieTheme.colors.muted, children: "v0.2.0 · Ready to help" })] })] }) }));
|
|
14
|
+
};
|
|
15
|
+
// Alternative compact banner for smaller screens
|
|
16
|
+
export const CompactBanner = () => {
|
|
17
|
+
return (_jsxs(Box, { flexDirection: "column", alignItems: "center", marginY: 0, children: [_jsx(Text, { color: marieTheme.colors.primary, bold: true, children: "╔══════════════════════════════════════════╗" }), _jsx(Text, { color: marieTheme.colors.primary, bold: true, children: "║ 🌸 Marie · AI Coding Assistant 🌸 ║" }), _jsx(Text, { color: marieTheme.colors.primary, bold: true, children: "╚══════════════════════════════════════════╝" })] }));
|
|
18
|
+
};
|
|
19
|
+
// Welcome banner with tips
|
|
20
|
+
export const WelcomeBanner = () => {
|
|
21
|
+
return (_jsxs(Box, { flexDirection: "column", alignItems: "center", marginTop: 0, marginBottom: 1, children: [_jsx(Banner, {}), _jsxs(Box, { flexDirection: "column", alignItems: "center", marginTop: 0, children: [_jsx(Text, { color: marieTheme.colors.secondary, children: " Welcome! Type your message to start coding with AI." }), _jsx(Text, { color: marieTheme.colors.muted, dimColor: true, children: " Tip: Use /help for commands, /config to change settings" })] })] }));
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=Banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/cli-new/components/Banner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,EAAE,EAAE;IAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC;IAEpC,IAAI,CAAC,IAAI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QAAQ,EAAC,OAAO,EAAE,CAAC,aACxD,KAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,kBACzC,8CAA8C,GAC1C,EACP,KAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,kBACzC,6CAA6C,GACzC,EACP,KAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,kBACzC,8CAA8C,GAC1C,IACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,2BAA2B;AAC3B,MAAM,CAAC,MAAM,aAAa,GAAa,GAAG,EAAE;IAC1C,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,aAC3E,KAAC,MAAM,KAAG,EACV,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,aAC1D,KAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,SAAS,YACrC,uDAAuD,GACnD,EACP,KAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,kBAC3C,2DAA2D,GACvD,IACH,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { Box, useStdout } from "ink";
|
|
4
|
+
import { MessageBubble } from "./MessageBubble.js";
|
|
5
|
+
const MAX_VISIBLE_MESSAGES = 50;
|
|
6
|
+
export const ChatArea = ({ messages, streamingState, }) => {
|
|
7
|
+
const { stdout } = useStdout();
|
|
8
|
+
const [dimensions, setDimensions] = useState({
|
|
9
|
+
rows: stdout.rows,
|
|
10
|
+
columns: stdout.columns,
|
|
11
|
+
});
|
|
12
|
+
const [stableTimestamp] = useState(() => Date.now());
|
|
13
|
+
// Handle terminal resize
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const handleResize = () => {
|
|
16
|
+
setDimensions({ rows: stdout.rows, columns: stdout.columns });
|
|
17
|
+
};
|
|
18
|
+
stdout.on("resize", handleResize);
|
|
19
|
+
return () => {
|
|
20
|
+
stdout.off("resize", handleResize);
|
|
21
|
+
};
|
|
22
|
+
}, [stdout]);
|
|
23
|
+
// Only show recent messages to prevent overflow
|
|
24
|
+
const visibleMessages = messages.length > MAX_VISIBLE_MESSAGES
|
|
25
|
+
? messages.slice(-MAX_VISIBLE_MESSAGES)
|
|
26
|
+
: messages;
|
|
27
|
+
// Calculate available height (reserve space for header, input, status)
|
|
28
|
+
const reservedHeight = 6;
|
|
29
|
+
const availableHeight = Math.max(5, dimensions.rows - reservedHeight);
|
|
30
|
+
return (_jsxs(Box, { flexDirection: "column", flexGrow: 1, overflow: "hidden", children: [messages.length > MAX_VISIBLE_MESSAGES && (_jsx(Box, { marginY: 0, paddingX: 1, children: _jsx(MessageBubble, { message: {
|
|
31
|
+
id: "scroll-notice",
|
|
32
|
+
role: "system",
|
|
33
|
+
content: `... ${messages.length - MAX_VISIBLE_MESSAGES} older messages hidden ...`,
|
|
34
|
+
timestamp: stableTimestamp,
|
|
35
|
+
} }) })), visibleMessages.map((message, index) => (_jsx(MessageBubble, { message: message, isStreaming: streamingState.isActive &&
|
|
36
|
+
index === visibleMessages.length - 1 &&
|
|
37
|
+
message.role === "assistant" }, message.id))), streamingState.isActive &&
|
|
38
|
+
(streamingState.content ||
|
|
39
|
+
(streamingState.toolCalls &&
|
|
40
|
+
streamingState.toolCalls.length > 0)) && (_jsx(MessageBubble, { message: {
|
|
41
|
+
id: "streaming",
|
|
42
|
+
role: "assistant",
|
|
43
|
+
content: streamingState.content,
|
|
44
|
+
timestamp: stableTimestamp,
|
|
45
|
+
isStreaming: true,
|
|
46
|
+
toolCalls: streamingState.toolCalls,
|
|
47
|
+
}, isStreaming: true }))] }));
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=ChatArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatArea.js","sourceRoot":"","sources":["../../../src/cli-new/components/ChatArea.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQnD,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAChD,QAAQ,EACR,cAAc,GACf,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC;QAC3C,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC;IAEH,MAAM,CAAC,eAAe,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAErD,yBAAyB;IACzB,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,aAAa,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC;QAEF,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAClC,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACrC,CAAC,CAAC;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AC,aAAa,IACZ,OAAO,EAAE;oBACP,EAAE,EAAE,WAAW;oBACf,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,cAAc,CAAC,OAAO;oBAC/B,SAAS,EAAE,eAAe;oBAC1B,WAAW,EAAE,IAAI;oBACjB,SAAS,EAAE,cAAc,CAAC,SAAS;iBACpC,EACD,WAAW,EAAE,IAAI,GACjB,CACH,IACC,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
import { marieTheme } from "../styles/theme.js";
|
|
4
|
+
function formatElapsed(ms) {
|
|
5
|
+
const totalSeconds = Math.floor(ms / 1000);
|
|
6
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
7
|
+
const seconds = totalSeconds % 60;
|
|
8
|
+
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
|
|
9
|
+
}
|
|
10
|
+
export const Header = ({ model, sessionTitle, gitStatus, isLoading, elapsedMs = 0, autonomyMode = "ascension", }) => {
|
|
11
|
+
const formatModelName = (m) => {
|
|
12
|
+
if (m.includes("claude"))
|
|
13
|
+
return "Claude";
|
|
14
|
+
if (m.includes("gpt"))
|
|
15
|
+
return "GPT";
|
|
16
|
+
return m;
|
|
17
|
+
};
|
|
18
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: marieTheme.colors.primary, paddingX: 1, marginBottom: 0, children: [_jsxs(Box, { justifyContent: "space-between", children: [_jsxs(Box, { children: [_jsxs(Text, { color: marieTheme.colors.primary, bold: true, children: [marieTheme.icons.assistant, " Marie"] }), _jsx(Text, { color: marieTheme.colors.muted, children: " v0.2.0" })] }), _jsxs(Box, { gap: 2, children: [isLoading && (_jsxs(Text, { color: marieTheme.colors.warning, children: [marieTheme.icons.spinner, " ", formatElapsed(elapsedMs)] })), _jsx(Text, { color: marieTheme.colors.secondary, children: formatModelName(model) }), _jsx(Text, { color: marieTheme.colors.muted, children: autonomyMode === "ascension" ? "ASC" : autonomyMode.toUpperCase() })] })] }), _jsxs(Box, { justifyContent: "space-between", marginTop: 0, children: [_jsx(Text, { color: marieTheme.colors.foreground, bold: true, children: sessionTitle }), gitStatus && (_jsxs(Box, { gap: 1, children: [_jsxs(Text, { color: marieTheme.colors.info, children: [marieTheme.icons.git, " ", gitStatus.branch] }), !gitStatus.isClean && (_jsxs(Text, { color: marieTheme.colors.warning, children: ["*", gitStatus.modified.length + gitStatus.staged.length] }))] }))] })] }));
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../src/cli-new/components/Header.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAYhD,SAAS,aAAa,CAAC,EAAU;IAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,YAAY,GAAG,EAAE,CAAC;IAClC,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,SAAS,EACT,SAAS,EACT,SAAS,GAAG,CAAC,EACb,YAAY,GAAG,WAAW,GAC3B,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,CAAC,CAAS,EAAE,EAAE;QACpC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ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S,IAAI,CACZ,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,aACT,MAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,aAChC,UAAU,CAAC,KAAK,CAAC,GAAG,OAAG,SAAS,CAAC,MAAM,IACnC,EACN,CAAC,SAAS,CAAC,OAAO,IAAI,CACrB,MAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,kBAClC,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,IAChD,CACR,IACG,CACP,IACG,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { Box, Text, useInput, useApp } from "ink";
|
|
4
|
+
import TextInput from "ink-text-input";
|
|
5
|
+
import { marieTheme } from "../styles/theme.js";
|
|
6
|
+
const COMMANDS = [
|
|
7
|
+
{
|
|
8
|
+
label: "Help",
|
|
9
|
+
value: "/help",
|
|
10
|
+
description: "Show available commands",
|
|
11
|
+
icon: "❓",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
label: "Clear",
|
|
15
|
+
value: "/clear",
|
|
16
|
+
description: "Clear the screen",
|
|
17
|
+
icon: "🧹",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: "New Session",
|
|
21
|
+
value: "/new",
|
|
22
|
+
description: "Create a new session",
|
|
23
|
+
icon: "🆕",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "Sessions",
|
|
27
|
+
value: "/sessions",
|
|
28
|
+
description: "Manage sessions",
|
|
29
|
+
icon: "📋",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "Checkpoint",
|
|
33
|
+
value: "/checkpoint",
|
|
34
|
+
description: "Create git checkpoint",
|
|
35
|
+
icon: "◈",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "Autonomy",
|
|
39
|
+
value: "/autonomy",
|
|
40
|
+
description: "Set agent autonomy mode",
|
|
41
|
+
icon: "🤖",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: "Undo",
|
|
45
|
+
value: "/undo",
|
|
46
|
+
description: "Rollback last changes",
|
|
47
|
+
icon: "↩️",
|
|
48
|
+
},
|
|
49
|
+
{ label: "Exit", value: "/exit", description: "Exit Marie", icon: "👋" },
|
|
50
|
+
];
|
|
51
|
+
export const InputArea = ({ onSubmit, isLoading, placeholder = "Type your message...", suggestions = [], }) => {
|
|
52
|
+
const [input, setInput] = useState("");
|
|
53
|
+
const [showCommands, setShowCommands] = useState(false);
|
|
54
|
+
const [selectedCommand, setSelectedCommand] = useState(0);
|
|
55
|
+
const { exit } = useApp();
|
|
56
|
+
const filteredCommands = input.startsWith("/")
|
|
57
|
+
? COMMANDS.filter((cmd) => cmd.value.startsWith(input.toLowerCase()))
|
|
58
|
+
: [];
|
|
59
|
+
useInput((char, key) => {
|
|
60
|
+
if (key.upArrow && showCommands) {
|
|
61
|
+
setSelectedCommand((prev) => Math.max(0, prev - 1));
|
|
62
|
+
}
|
|
63
|
+
else if (key.downArrow && showCommands) {
|
|
64
|
+
setSelectedCommand((prev) => Math.min(filteredCommands.length - 1, prev + 1));
|
|
65
|
+
}
|
|
66
|
+
else if (key.tab && showCommands && filteredCommands.length > 0) {
|
|
67
|
+
setInput(filteredCommands[selectedCommand].value + " ");
|
|
68
|
+
setShowCommands(false);
|
|
69
|
+
}
|
|
70
|
+
else if (key.return && !isLoading) {
|
|
71
|
+
if (showCommands && filteredCommands.length > 0) {
|
|
72
|
+
setInput(filteredCommands[selectedCommand].value + " ");
|
|
73
|
+
setShowCommands(false);
|
|
74
|
+
}
|
|
75
|
+
else if (input.trim()) {
|
|
76
|
+
onSubmit(input);
|
|
77
|
+
setInput("");
|
|
78
|
+
setShowCommands(false);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else if (key.escape) {
|
|
82
|
+
setShowCommands(false);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const handleChange = useCallback((value) => {
|
|
86
|
+
setInput(value);
|
|
87
|
+
setShowCommands(value.startsWith("/"));
|
|
88
|
+
setSelectedCommand(0);
|
|
89
|
+
}, []);
|
|
90
|
+
if (isLoading) {
|
|
91
|
+
return (_jsx(Box, { marginY: 0, children: _jsxs(Text, { color: marieTheme.colors.muted, children: [marieTheme.icons.spinner, " Marie is thinking... Press Ctrl+C to cancel"] }) }));
|
|
92
|
+
}
|
|
93
|
+
return (_jsxs(Box, { flexDirection: "column", marginY: 0, children: [_jsxs(Box, { children: [_jsxs(Text, { color: marieTheme.colors.primary, bold: true, children: [marieTheme.icons.user, " "] }), _jsx(TextInput, { value: input, onChange: handleChange, placeholder: placeholder, focus: true })] }), showCommands && filteredCommands.length > 0 && (_jsx(Box, { flexDirection: "column", marginTop: 0, marginLeft: 2, children: filteredCommands.map((cmd, index) => (_jsx(Box, { children: _jsxs(Text, { color: index === selectedCommand
|
|
94
|
+
? marieTheme.colors.primary
|
|
95
|
+
: marieTheme.colors.muted, children: [index === selectedCommand ? "▸ " : " ", cmd.icon, " ", cmd.value, " - ", cmd.description] }) }, cmd.value))) }))] }));
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=InputArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputArea.js","sourceRoot":"","sources":["../../../src/cli-new/components/InputArea.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;A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Aa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,YACpD,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CACpC,KAAC,GAAG,cACF,MAAC,IAAI,IACH,KAAK,EACH,KAAK,KAAK,eAAe;4BACvB,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;4BAC3B,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,aAG5B,KAAK,KAAK,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EACvC,GAAG,CAAC,IAAI,OAAG,GAAG,CAAC,KAAK,SAAK,GAAG,CAAC,WAAW,IACpC,IAVC,GAAG,CAAC,KAAK,CAWb,CACP,CAAC,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { Box, Text, useStdout } from "ink";
|
|
4
|
+
import { marieTheme } from "../styles/theme.js";
|
|
5
|
+
import { ToolCallDisplay } from "./ToolCallDisplay.js";
|
|
6
|
+
// Format timestamp to readable time
|
|
7
|
+
function formatTime(timestamp) {
|
|
8
|
+
const date = new Date(timestamp);
|
|
9
|
+
return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
10
|
+
}
|
|
11
|
+
// Wrap text to fit within max width
|
|
12
|
+
function wrapText(text, maxWidth) {
|
|
13
|
+
if (!text)
|
|
14
|
+
return [];
|
|
15
|
+
const lines = [];
|
|
16
|
+
const paragraphs = text.split("\n");
|
|
17
|
+
for (const paragraph of paragraphs) {
|
|
18
|
+
if (paragraph.length <= maxWidth) {
|
|
19
|
+
lines.push(paragraph);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
let currentLine = "";
|
|
23
|
+
const words = paragraph.split(" ");
|
|
24
|
+
for (const word of words) {
|
|
25
|
+
if ((currentLine + " " + word).trim().length <= maxWidth) {
|
|
26
|
+
currentLine = currentLine ? currentLine + " " + word : word;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (currentLine)
|
|
30
|
+
lines.push(currentLine);
|
|
31
|
+
if (word.length > maxWidth) {
|
|
32
|
+
for (let i = 0; i < word.length; i += maxWidth) {
|
|
33
|
+
lines.push(word.slice(i, i + maxWidth));
|
|
34
|
+
}
|
|
35
|
+
currentLine = "";
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
currentLine = word;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (currentLine)
|
|
43
|
+
lines.push(currentLine);
|
|
44
|
+
}
|
|
45
|
+
return lines;
|
|
46
|
+
}
|
|
47
|
+
// Truncate long messages
|
|
48
|
+
function truncateContent(content, maxLines = 50) {
|
|
49
|
+
const lines = content.split("\n");
|
|
50
|
+
if (lines.length <= maxLines) {
|
|
51
|
+
return { lines, wasTruncated: false };
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
lines: [
|
|
55
|
+
...lines.slice(0, maxLines),
|
|
56
|
+
"... (message truncated, use /expand to see full content)",
|
|
57
|
+
],
|
|
58
|
+
wasTruncated: true,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// Detect code blocks and format them
|
|
62
|
+
function formatContent(content) {
|
|
63
|
+
const parts = [];
|
|
64
|
+
const codeBlockRegex = /```(\w+)?\n([\s\S]*?)```/g;
|
|
65
|
+
let lastIndex = 0;
|
|
66
|
+
let match;
|
|
67
|
+
while ((match = codeBlockRegex.exec(content)) !== null) {
|
|
68
|
+
if (match.index > lastIndex) {
|
|
69
|
+
parts.push({
|
|
70
|
+
type: "text",
|
|
71
|
+
content: content.slice(lastIndex, match.index).trim(),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
parts.push({
|
|
75
|
+
type: "code",
|
|
76
|
+
language: match[1],
|
|
77
|
+
content: match[2].trim(),
|
|
78
|
+
});
|
|
79
|
+
lastIndex = match.index + match[0].length;
|
|
80
|
+
}
|
|
81
|
+
if (lastIndex < content.length) {
|
|
82
|
+
parts.push({
|
|
83
|
+
type: "text",
|
|
84
|
+
content: content.slice(lastIndex).trim(),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return parts.length > 0 ? parts : [{ type: "text", content }];
|
|
88
|
+
}
|
|
89
|
+
export const MessageBubble = ({ message, isStreaming, showTimestamp = true, }) => {
|
|
90
|
+
const { stdout } = useStdout();
|
|
91
|
+
const isUser = message.role === "user";
|
|
92
|
+
const isSystem = message.role === "system";
|
|
93
|
+
const maxWidth = Math.max(20, stdout.columns - 8);
|
|
94
|
+
const contentParts = useMemo(() => formatContent(message.content), [message.content]);
|
|
95
|
+
const timeStr = showTimestamp ? formatTime(message.timestamp) : "";
|
|
96
|
+
if (isSystem) {
|
|
97
|
+
const wrappedLines = wrapText(message.content, maxWidth);
|
|
98
|
+
return (_jsx(Box, { marginY: 0, paddingY: 0, justifyContent: "center", children: _jsxs(Box, { flexDirection: "column", children: [wrappedLines.map((line, i) => (_jsx(Text, { color: marieTheme.colors.error, italic: true, dimColor: true, children: line || " " }, i))), showTimestamp && (_jsx(Text, { color: marieTheme.colors.muted, dimColor: true, children: timeStr }))] }) }));
|
|
99
|
+
}
|
|
100
|
+
if (isUser) {
|
|
101
|
+
const wrappedLines = wrapText(message.content, maxWidth - 2);
|
|
102
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 0, marginBottom: 0, paddingX: 1, children: [_jsxs(Box, { children: [_jsxs(Text, { bold: true, color: marieTheme.colors.primary, children: [marieTheme.icons.user, " You"] }), showTimestamp && (_jsxs(Text, { color: marieTheme.colors.muted, dimColor: true, children: [" ", timeStr] })), _jsx(Text, { color: marieTheme.colors.primary, children: " \u203A " }), _jsx(Text, { color: marieTheme.colors.foreground, children: wrappedLines[0] || "" })] }), wrappedLines.slice(1).map((line, i) => (_jsx(Box, { marginLeft: 4, children: _jsx(Text, { color: marieTheme.colors.foreground, children: line || " " }) }, i)))] }));
|
|
103
|
+
}
|
|
104
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 0, marginBottom: 0, paddingX: 1, borderStyle: "round", borderColor: marieTheme.colors.secondary, children: [_jsxs(Box, { justifyContent: "space-between", children: [_jsxs(Box, { children: [_jsxs(Text, { bold: true, color: marieTheme.colors.success, children: [marieTheme.icons.assistant, " Marie"] }), isStreaming && (_jsxs(Text, { color: marieTheme.colors.muted, children: [" ", marieTheme.icons.spinner] }))] }), showTimestamp && (_jsx(Text, { color: marieTheme.colors.muted, dimColor: true, children: timeStr }))] }), _jsxs(Box, { flexDirection: "column", marginLeft: 0, children: [contentParts.map((part, partIndex) => {
|
|
105
|
+
if (part.type === "code") {
|
|
106
|
+
const codeLines = wrapText(part.content, maxWidth - 4);
|
|
107
|
+
return (_jsxs(Box, { flexDirection: "column", marginY: 1, paddingX: 1, borderStyle: "single", borderColor: marieTheme.colors.muted, children: [part.language && (_jsx(Text, { color: marieTheme.colors.info, dimColor: true, children: part.language })), codeLines.map((line, i) => (_jsx(Text, { color: marieTheme.colors.foreground, children: line || " " }, i)))] }, partIndex));
|
|
108
|
+
}
|
|
109
|
+
const textLines = wrapText(part.content, maxWidth - 2);
|
|
110
|
+
return textLines.map((line, i) => (_jsx(Text, { color: marieTheme.colors.foreground, children: line || " " }, `${partIndex}-${i}`)));
|
|
111
|
+
}), isStreaming && _jsx(Text, { color: marieTheme.colors.primary, children: "\u258A" })] }), message.toolCalls &&
|
|
112
|
+
message.toolCalls.map((tool) => (_jsx(ToolCallDisplay, { tool: tool }, tool.id)))] }));
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=MessageBubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBubble.js","sourceRoot":"","sources":["../../../src/cli-new/components/MessageBubble.tsx"],"names":[],"mappings":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,IAAI,IAAI,GAAG,IAHP,GAAG,SAAS,IAAI,CAAC,EAAE,CAInB,CACR,CAAC,CAAC;oBACL,CAAC,CAAC,EAED,WAAW,IAAI,KAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,uBAAU,IAC5D,EAEL,OAAO,CAAC,SAAS;gBAChB,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC9B,KAAC,eAAe,IAAe,IAAI,EAAE,IAAI,IAAnB,IAAI,CAAC,EAAE,CAAgB,CAC9C,CAAC,IACA,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
import SelectInput from "ink-select-input";
|
|
5
|
+
import { marieTheme } from "../styles/theme.js";
|
|
6
|
+
export const SessionSwitcher = ({ sessions, currentSessionId, onSelect, onCreate, onDelete, onRename, onTogglePin, onClose, }) => {
|
|
7
|
+
const [mode, setMode] = useState("list");
|
|
8
|
+
const [sessionToDelete, setSessionToDelete] = useState(null);
|
|
9
|
+
// Sort sessions: pinned first, then by last modified
|
|
10
|
+
const sortedSessions = [...sessions].sort((a, b) => {
|
|
11
|
+
if (a.isPinned && !b.isPinned)
|
|
12
|
+
return -1;
|
|
13
|
+
if (!a.isPinned && b.isPinned)
|
|
14
|
+
return 1;
|
|
15
|
+
return b.lastModified - a.lastModified;
|
|
16
|
+
});
|
|
17
|
+
const items = [
|
|
18
|
+
{ label: "➕ Create New Session", value: "__new__" },
|
|
19
|
+
...sortedSessions.map((s) => ({
|
|
20
|
+
label: `${s.isPinned ? "⭐ " : " "}${s.title}${s.id === currentSessionId ? " (current)" : ""}`,
|
|
21
|
+
value: s.id,
|
|
22
|
+
})),
|
|
23
|
+
];
|
|
24
|
+
useInput((input, key) => {
|
|
25
|
+
if (key.escape || (input === "q" && mode === "list")) {
|
|
26
|
+
onClose();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const handleSelect = (item) => {
|
|
30
|
+
if (item.value === "__new__") {
|
|
31
|
+
onCreate();
|
|
32
|
+
onClose();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
onSelect(item.value);
|
|
36
|
+
onClose();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
if (mode === "confirm-delete" && sessionToDelete) {
|
|
40
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: marieTheme.colors.error, paddingX: 1, children: [_jsx(Text, { color: marieTheme.colors.error, bold: true, children: "Delete session?" }), _jsx(Text, { color: marieTheme.colors.muted, children: "This action cannot be undone." }), _jsxs(Box, { marginTop: 0, gap: 2, children: [_jsx(Text, { color: marieTheme.colors.error, children: "y - Yes, delete" }), _jsx(Text, { color: marieTheme.colors.muted, children: "n - Cancel" })] })] }));
|
|
41
|
+
}
|
|
42
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: marieTheme.colors.primary, paddingX: 1, children: [_jsx(Box, { marginBottom: 0, children: _jsxs(Text, { color: marieTheme.colors.primary, bold: true, children: [marieTheme.icons.assistant, " Session Manager"] }) }), _jsx(Text, { color: marieTheme.colors.muted, dimColor: true, children: "\u2191\u2193 Navigate \u2022 Enter Select \u2022 D Delete \u2022 P Pin \u2022 R Rename \u2022 Q Quit" }), _jsx(Box, { marginTop: 0, children: _jsx(SelectInput, { items: items, onSelect: handleSelect, indicatorComponent: ({ isSelected }) => (_jsx(Text, { color: isSelected ? marieTheme.colors.primary : marieTheme.colors.muted, children: isSelected ? "▸ " : " " })), itemComponent: ({ isSelected, label }) => (_jsx(Text, { color: isSelected
|
|
43
|
+
? marieTheme.colors.foreground
|
|
44
|
+
: marieTheme.colors.muted, children: label })) }) })] }));
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=Sess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