@renxqoo/renx-code 0.0.1 → 0.0.3
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/README.md +12 -11
- package/dist/App.js +13 -13
- package/dist/agent/runtime/event-format.d.ts +1 -1
- package/dist/agent/runtime/runtime.d.ts +4 -4
- package/dist/agent/runtime/runtime.js +6 -6
- package/dist/agent/runtime/source-modules.d.ts +1 -1
- package/dist/agent/runtime/tool-call-buffer.d.ts +1 -1
- package/dist/agent/runtime/tool-confirmation.d.ts +1 -1
- package/dist/cli.js +6 -37
- package/dist/cli.js.map +1 -1
- package/dist/components/chat/assistant-reply.d.ts +1 -1
- package/dist/components/chat/assistant-reply.js +4 -4
- package/dist/components/chat/assistant-segment.d.ts +1 -1
- package/dist/components/chat/assistant-segment.js +3 -3
- package/dist/components/chat/assistant-tool-group.d.ts +1 -1
- package/dist/components/chat/assistant-tool-group.js +3 -3
- package/dist/components/chat/code-block.js +2 -2
- package/dist/components/chat/prompt-card.js +2 -2
- package/dist/components/chat/segment-groups.d.ts +1 -1
- package/dist/components/chat/turn-item.d.ts +1 -1
- package/dist/components/chat/turn-item.js +3 -3
- package/dist/components/conversation-panel.d.ts +1 -1
- package/dist/components/conversation-panel.js +2 -2
- package/dist/components/file-mention-menu.d.ts +1 -1
- package/dist/components/file-mention-menu.js +1 -1
- package/dist/components/file-picker-dialog.d.ts +1 -1
- package/dist/components/file-picker-dialog.js +1 -1
- package/dist/components/footer-hints.js +1 -1
- package/dist/components/model-picker-dialog.d.ts +1 -1
- package/dist/components/model-picker-dialog.js +1 -1
- package/dist/components/prompt.d.ts +2 -2
- package/dist/components/prompt.js +7 -7
- package/dist/components/slash-command-menu.d.ts +1 -1
- package/dist/components/slash-command-menu.js +1 -1
- package/dist/components/tool-confirm-dialog-content.d.ts +1 -1
- package/dist/components/tool-confirm-dialog-content.js +1 -1
- package/dist/components/tool-confirm-dialog.d.ts +1 -1
- package/dist/components/tool-confirm-dialog.js +2 -2
- package/dist/files/attachment-capabilities.d.ts +1 -1
- package/dist/files/attachment-content.d.ts +3 -3
- package/dist/files/attachment-content.js +1 -1
- package/dist/files/prompt-display.d.ts +1 -1
- package/dist/files/workspace-files.d.ts +1 -1
- package/dist/files/workspace-files.d.ts.map +1 -1
- package/dist/files/workspace-files.js +5 -7
- package/dist/files/workspace-files.js.map +1 -1
- package/dist/hooks/agent-event-handlers.d.ts +2 -2
- package/dist/hooks/agent-event-handlers.js +1 -1
- package/dist/hooks/turn-updater.d.ts +1 -1
- package/dist/hooks/use-agent-chat.d.ts +3 -3
- package/dist/hooks/use-agent-chat.js +9 -9
- package/dist/hooks/use-file-mention-menu.d.ts +1 -1
- package/dist/hooks/use-file-mention-menu.js +3 -3
- package/dist/hooks/use-file-picker.d.ts +1 -1
- package/dist/hooks/use-file-picker.js +1 -1
- package/dist/hooks/use-model-picker.d.ts +1 -1
- package/dist/hooks/use-model-picker.js +1 -1
- package/dist/hooks/use-slash-command-menu.d.ts +1 -1
- package/dist/hooks/use-slash-command-menu.js +1 -1
- package/dist/index.js +4 -37
- package/dist/index.js.map +1 -1
- package/dist/run-cli-app.d.ts +2 -0
- package/dist/run-cli-app.d.ts.map +1 -0
- package/dist/run-cli-app.js +41 -0
- package/dist/run-cli-app.js.map +1 -0
- package/dist/runtime/exit.js +1 -1
- package/dist/runtime/runtime-support.d.ts +4 -0
- package/dist/runtime/runtime-support.d.ts.map +1 -0
- package/dist/runtime/runtime-support.js +19 -0
- package/dist/runtime/runtime-support.js.map +1 -0
- package/dist/ui/opencode-markdown.d.ts +2 -2
- package/dist/ui/opencode-markdown.js +1 -1
- package/dist/ui/theme.d.ts +1 -1
- package/dist/ui/theme.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@renxqoo/renx-code)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://bun.sh/)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
[](https://react.dev/)
|
|
8
8
|
[](https://github.com/opentui/opentui)
|
|
@@ -26,11 +26,13 @@ Enterprise-grade AI coding assistant CLI tool with interactive terminal UI, buil
|
|
|
26
26
|
### Installation
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
#
|
|
30
|
-
|
|
29
|
+
# Run directly with Bun
|
|
30
|
+
bunx @renxqoo/renx-code
|
|
31
31
|
|
|
32
|
-
# Or
|
|
33
|
-
|
|
32
|
+
# Or install globally with Bun
|
|
33
|
+
bun install -g @renxqoo/renx-code
|
|
34
|
+
|
|
35
|
+
# npm install is not supported for running this CLI because OpenTUI currently depends on Bun runtime APIs.
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
### Basic Usage
|
|
@@ -39,21 +41,20 @@ npx @renxqoo/renx-code
|
|
|
39
41
|
# Start the interactive CLI
|
|
40
42
|
renx
|
|
41
43
|
|
|
42
|
-
# Or run directly with
|
|
43
|
-
|
|
44
|
+
# Or run directly with bunx
|
|
45
|
+
bunx @renxqoo/renx-code
|
|
44
46
|
```
|
|
45
47
|
|
|
46
48
|
## 📦 Installation
|
|
47
49
|
|
|
48
50
|
### Prerequisites
|
|
49
51
|
|
|
50
|
-
-
|
|
51
|
-
- npm, yarn, or pnpm
|
|
52
|
+
- Bun 1.1.0 or higher
|
|
52
53
|
|
|
53
54
|
### Global Installation
|
|
54
55
|
|
|
55
56
|
```bash
|
|
56
|
-
|
|
57
|
+
bun install -g @renxqoo/renx-code
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
### Local Installation
|
|
@@ -275,4 +276,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
275
276
|
|
|
276
277
|
---
|
|
277
278
|
|
|
278
|
-
**Note**: This is an enterprise-grade tool designed for professional developers. Please ensure you have appropriate API keys and permissions for the AI models you intend to use.
|
|
279
|
+
**Note**: This is an enterprise-grade tool designed for professional developers. Please ensure you have appropriate API keys and permissions for the AI models you intend to use.
|
package/dist/App.js
CHANGED
|
@@ -2,19 +2,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
|
2
2
|
import { TextAttributes } from '@opentui/core';
|
|
3
3
|
import { useKeyboard, useRenderer, useTerminalDimensions } from '@opentui/react';
|
|
4
4
|
import { useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { resolveSlashCommand } from './commands/slash-commands';
|
|
6
|
-
import { ConversationPanel } from './components/conversation-panel';
|
|
7
|
-
import { FilePickerDialog } from './components/file-picker-dialog';
|
|
8
|
-
import { ModelPickerDialog } from './components/model-picker-dialog';
|
|
9
|
-
import { Prompt } from './components/prompt';
|
|
10
|
-
import { ToolConfirmDialog } from './components/tool-confirm-dialog';
|
|
11
|
-
import { isMediaSelection } from './files/attachment-capabilities';
|
|
12
|
-
import { useAgentChat } from './hooks/use-agent-chat';
|
|
13
|
-
import { useFilePicker } from './hooks/use-file-picker';
|
|
14
|
-
import { useModelPicker } from './hooks/use-model-picker';
|
|
15
|
-
import { requestExit } from './runtime/exit';
|
|
16
|
-
import { copyTextToClipboard } from './runtime/clipboard';
|
|
17
|
-
import { uiTheme } from './ui/theme';
|
|
5
|
+
import { resolveSlashCommand } from './commands/slash-commands.js';
|
|
6
|
+
import { ConversationPanel } from './components/conversation-panel.js';
|
|
7
|
+
import { FilePickerDialog } from './components/file-picker-dialog.js';
|
|
8
|
+
import { ModelPickerDialog } from './components/model-picker-dialog.js';
|
|
9
|
+
import { Prompt } from './components/prompt.js';
|
|
10
|
+
import { ToolConfirmDialog } from './components/tool-confirm-dialog.js';
|
|
11
|
+
import { isMediaSelection } from './files/attachment-capabilities.js';
|
|
12
|
+
import { useAgentChat } from './hooks/use-agent-chat.js';
|
|
13
|
+
import { useFilePicker } from './hooks/use-file-picker.js';
|
|
14
|
+
import { useModelPicker } from './hooks/use-model-picker.js';
|
|
15
|
+
import { requestExit } from './runtime/exit.js';
|
|
16
|
+
import { copyTextToClipboard } from './runtime/clipboard.js';
|
|
17
|
+
import { uiTheme } from './ui/theme.js';
|
|
18
18
|
const appendFileTokens = (currentValue, files) => {
|
|
19
19
|
if (files.length === 0) {
|
|
20
20
|
return currentValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentLoopEvent, AgentStepEvent, AgentStopEvent, AgentToolConfirmEvent, AgentToolResultEvent, AgentToolStreamEvent, AgentToolUseEvent } from './types';
|
|
1
|
+
import type { AgentLoopEvent, AgentStepEvent, AgentStopEvent, AgentToolConfirmEvent, AgentToolResultEvent, AgentToolStreamEvent, AgentToolUseEvent } from './types.js';
|
|
2
2
|
export declare const formatToolConfirmEvent: (event: AgentToolConfirmEvent) => string;
|
|
3
3
|
export declare const formatToolUseEvent: (event: AgentToolUseEvent) => string;
|
|
4
4
|
export declare const formatToolUseEventCode: (event: AgentToolUseEvent) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AgentEventHandlers, AgentRunResult } from './types';
|
|
2
|
-
import type { AgentModelOption, AgentModelSwitchResult } from './model-types';
|
|
3
|
-
import type { AttachmentModelCapabilities } from '../../files/attachment-capabilities';
|
|
4
|
-
import type { MessageContent } from '../../types/message-content';
|
|
1
|
+
import type { AgentEventHandlers, AgentRunResult } from './types.js';
|
|
2
|
+
import type { AgentModelOption, AgentModelSwitchResult } from './model-types.js';
|
|
3
|
+
import type { AttachmentModelCapabilities } from '../../files/attachment-capabilities.js';
|
|
4
|
+
import type { MessageContent } from '../../types/message-content.js';
|
|
5
5
|
type RunAgentPromptOptions = {
|
|
6
6
|
abortSignal?: AbortSignal;
|
|
7
7
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { resolve as resolvePath } from 'node:path';
|
|
2
|
-
import { resolveToolConfirmDecision } from './tool-confirmation';
|
|
3
|
-
import { getSourceModules, resolveWorkspaceRoot, } from './source-modules';
|
|
4
|
-
import { ToolCallBuffer } from './tool-call-buffer';
|
|
5
|
-
import { buildSystemPrompt } from '../../agent/prompts/system';
|
|
6
|
-
import { resolveRenxDatabasePath, resolveRenxTaskDir } from '../../config/paths';
|
|
7
|
-
import { resolveAttachmentModelCapabilities } from '../../files/attachment-capabilities';
|
|
2
|
+
import { resolveToolConfirmDecision } from './tool-confirmation.js';
|
|
3
|
+
import { getSourceModules, resolveWorkspaceRoot, } from './source-modules.js';
|
|
4
|
+
import { ToolCallBuffer } from './tool-call-buffer.js';
|
|
5
|
+
import { buildSystemPrompt } from '../../agent/prompts/system.js';
|
|
6
|
+
import { resolveRenxDatabasePath, resolveRenxTaskDir } from '../../config/paths.js';
|
|
7
|
+
import { resolveAttachmentModelCapabilities } from '../../files/attachment-capabilities.js';
|
|
8
8
|
let runtimePromise = null;
|
|
9
9
|
let initializing = false;
|
|
10
10
|
const readPreferredModelIdFromEnv = () => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AgentEventHandlers, AgentToolConfirmDecision, AgentToolConfirmEvent } from './types';
|
|
1
|
+
import type { AgentEventHandlers, AgentToolConfirmDecision, AgentToolConfirmEvent } from './types.js';
|
|
2
2
|
export declare const resolveToolConfirmDecision: (event: AgentToolConfirmEvent, handlers: AgentEventHandlers) => Promise<AgentToolConfirmDecision>;
|
|
3
3
|
//# sourceMappingURL=tool-confirmation.d.ts.map
|
package/dist/cli.js
CHANGED
|
@@ -1,43 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { createCliRenderer } from '@opentui/core';
|
|
4
|
-
import { createRoot } from '@opentui/react';
|
|
5
|
-
import { App } from './App';
|
|
6
|
-
import { bindExitGuards, hardResetTerminal, initExitRuntime, registerTerminalBackgroundRestore, } from './runtime/exit';
|
|
7
|
-
import { probeTerminalColors, setTerminalWindowBackground, setTerminalWindowForeground, } from './runtime/terminal-theme';
|
|
8
|
-
import { applyMarkdownThemeMode } from './ui/opencode-markdown';
|
|
9
|
-
import { applyUiThemeMode, uiTheme } from './ui/theme';
|
|
2
|
+
import { ensureSupportedRuntime } from './runtime/runtime-support.js';
|
|
10
3
|
async function main() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
process.env.OPENTUI_FORCE_WCWIDTH ??= '1';
|
|
15
|
-
const terminalColors = await probeTerminalColors();
|
|
16
|
-
applyUiThemeMode(terminalColors.mode);
|
|
17
|
-
applyMarkdownThemeMode(terminalColors.mode, process.platform);
|
|
18
|
-
if (terminalColors.rawBackgroundColor &&
|
|
19
|
-
terminalColors.rawBackgroundColor.toLowerCase() !== uiTheme.bg.toLowerCase()) {
|
|
20
|
-
const originalBackground = terminalColors.rawBackgroundColor;
|
|
21
|
-
setTerminalWindowBackground(uiTheme.bg);
|
|
22
|
-
registerTerminalBackgroundRestore(() => {
|
|
23
|
-
setTerminalWindowBackground(originalBackground);
|
|
24
|
-
});
|
|
4
|
+
if (!ensureSupportedRuntime()) {
|
|
5
|
+
process.exitCode = 1;
|
|
6
|
+
return;
|
|
25
7
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const originalForeground = terminalColors.rawForegroundColor;
|
|
29
|
-
setTerminalWindowForeground(uiTheme.userPromptText);
|
|
30
|
-
registerTerminalBackgroundRestore(() => {
|
|
31
|
-
setTerminalWindowForeground(originalForeground);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const renderer = await createCliRenderer({
|
|
35
|
-
exitOnCtrlC: false,
|
|
36
|
-
onDestroy: hardResetTerminal,
|
|
37
|
-
backgroundColor: uiTheme.bg,
|
|
38
|
-
});
|
|
39
|
-
initExitRuntime(renderer);
|
|
40
|
-
createRoot(renderer).render(_jsx(App, {}));
|
|
8
|
+
const { runCliApp } = await import('./run-cli-app.js');
|
|
9
|
+
await runCliApp();
|
|
41
10
|
}
|
|
42
11
|
main().catch(console.error);
|
|
43
12
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;QAC9B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACvD,MAAM,SAAS,EAAE,CAAC;AACpB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import { uiTheme } from '../../ui/theme';
|
|
4
|
-
import { AssistantSegment } from './assistant-segment';
|
|
5
|
-
import { AssistantToolGroup } from './assistant-tool-group';
|
|
6
|
-
import { buildReplyRenderItems } from './segment-groups';
|
|
3
|
+
import { uiTheme } from '../../ui/theme.js';
|
|
4
|
+
import { AssistantSegment } from './assistant-segment.js';
|
|
5
|
+
import { AssistantToolGroup } from './assistant-tool-group.js';
|
|
6
|
+
import { buildReplyRenderItems } from './segment-groups.js';
|
|
7
7
|
const renderStatus = (status) => {
|
|
8
8
|
if (status === 'streaming') {
|
|
9
9
|
return 'streaming';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
-
import { opencodeMarkdownSyntax, opencodeSubtleMarkdownSyntax } from '../../ui/opencode-markdown';
|
|
3
|
-
import { uiTheme } from '../../ui/theme';
|
|
4
|
-
import { CodeBlock } from './code-block';
|
|
2
|
+
import { opencodeMarkdownSyntax, opencodeSubtleMarkdownSyntax } from '../../ui/opencode-markdown.js';
|
|
3
|
+
import { uiTheme } from '../../ui/theme.js';
|
|
4
|
+
import { CodeBlock } from './code-block.js';
|
|
5
5
|
const markdownTableOptions = {
|
|
6
6
|
widthMode: 'full',
|
|
7
7
|
wrapMode: 'word',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { uiTheme } from '../../ui/theme';
|
|
4
|
-
import { getToolDisplayIcon, getToolDisplayName } from '../tool-display-config';
|
|
5
|
-
import { CodeBlock } from './code-block';
|
|
3
|
+
import { uiTheme } from '../../ui/theme.js';
|
|
4
|
+
import { getToolDisplayIcon, getToolDisplayName } from '../tool-display-config.js';
|
|
5
|
+
import { CodeBlock } from './code-block.js';
|
|
6
6
|
const COLLAPSIBLE_OUTPUT_LINES = 16;
|
|
7
7
|
const COLLAPSIBLE_OUTPUT_LABELS = new Set(['output', 'error', 'result', 'details']);
|
|
8
8
|
const asObjectLike = (value) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
-
import { opencodeMarkdownSyntax } from '../../ui/opencode-markdown';
|
|
3
|
-
import { uiTheme } from '../../ui/theme';
|
|
2
|
+
import { opencodeMarkdownSyntax } from '../../ui/opencode-markdown.js';
|
|
3
|
+
import { uiTheme } from '../../ui/theme.js';
|
|
4
4
|
const FILETYPE_BY_EXTENSION = {
|
|
5
5
|
bash: 'bash',
|
|
6
6
|
cjs: 'javascript',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
-
import { isAudioSelection, isImageSelection, isVideoSelection, } from '../../files/attachment-capabilities';
|
|
3
|
-
import { uiTheme } from '../../ui/theme';
|
|
2
|
+
import { isAudioSelection, isImageSelection, isVideoSelection, } from '../../files/attachment-capabilities.js';
|
|
3
|
+
import { uiTheme } from '../../ui/theme.js';
|
|
4
4
|
const formatTime = (timestamp) => {
|
|
5
5
|
return new Date(timestamp).toLocaleTimeString('en-US', {
|
|
6
6
|
hour: '2-digit',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
-
import { uiTheme } from '../../ui/theme';
|
|
3
|
-
import { AssistantReply } from './assistant-reply';
|
|
4
|
-
import { PromptCard } from './prompt-card';
|
|
2
|
+
import { uiTheme } from '../../ui/theme.js';
|
|
3
|
+
import { AssistantReply } from './assistant-reply.js';
|
|
4
|
+
import { PromptCard } from './prompt-card.js';
|
|
5
5
|
const PendingReply = () => {
|
|
6
6
|
return (_jsxs("box", { flexDirection: "row", children: [_jsx("box", { width: 1, backgroundColor: uiTheme.divider }), _jsx("box", { flexGrow: 1, paddingLeft: 2, children: _jsxs("text", { attributes: uiTheme.typography.body, selectable: true, children: [_jsx("i", { fg: uiTheme.thinking, children: "Thinking:" }), _jsx("span", { fg: uiTheme.muted, children: " preparing response..." })] }) })] }));
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
-
import { uiTheme } from '../ui/theme';
|
|
3
|
-
import { TurnItem } from './chat/turn-item';
|
|
2
|
+
import { uiTheme } from '../ui/theme.js';
|
|
3
|
+
import { TurnItem } from './chat/turn-item.js';
|
|
4
4
|
export const ConversationPanel = ({ turns, isThinking }) => {
|
|
5
5
|
const pendingTurnId = turns.at(-1)?.id;
|
|
6
6
|
return (_jsx("scrollbox", { flexGrow: 1, scrollY: true, stickyScroll: true, stickyStart: "bottom", paddingX: uiTheme.layout.conversationPaddingX, paddingY: uiTheme.layout.conversationPaddingY, viewportOptions: { backgroundColor: uiTheme.bg }, contentOptions: { backgroundColor: uiTheme.bg }, marginBottom: 1, children: _jsx("box", { flexDirection: "column", gap: 0, paddingX: uiTheme.layout.conversationContentPaddingX, paddingY: uiTheme.layout.conversationContentPaddingY, backgroundColor: uiTheme.bg, children: turns.map((turn, index) => (_jsx(TurnItem, { turn: turn, index: index, isPending: isThinking && turn.id === pendingTurnId }, turn.id))) }) }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { TextAttributes } from '@opentui/core';
|
|
3
|
-
import { uiTheme } from '../ui/theme';
|
|
3
|
+
import { uiTheme } from '../ui/theme.js';
|
|
4
4
|
const selectedBackground = '#f4b183';
|
|
5
5
|
const selectedForeground = '#050608';
|
|
6
6
|
export const FileMentionMenu = ({ visible, loading, error, options, selectedIndex, }) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { TextAttributes } from '@opentui/core';
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
|
-
import { uiTheme } from '../ui/theme';
|
|
4
|
+
import { uiTheme } from '../ui/theme.js';
|
|
5
5
|
const selectedBackground = '#f4b183';
|
|
6
6
|
const selectedForeground = '#050608';
|
|
7
7
|
const formatSize = (size) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { TextAttributes } from '@opentui/core';
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
import { uiTheme } from '../ui/theme';
|
|
4
|
+
import { uiTheme } from '../ui/theme.js';
|
|
5
5
|
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
6
6
|
const SPINNER_INTERVAL_MS = 80;
|
|
7
7
|
export const FooterHints = ({ isThinking, contextUsagePercent }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KeyEvent } from '@opentui/core';
|
|
2
|
-
import type { AgentModelOption } from '../agent/runtime/model-types';
|
|
2
|
+
import type { AgentModelOption } from '../agent/runtime/model-types.js';
|
|
3
3
|
type ModelPickerDialogProps = {
|
|
4
4
|
visible: boolean;
|
|
5
5
|
viewportWidth: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { TextAttributes } from '@opentui/core';
|
|
3
3
|
import { useEffect, useMemo, useRef } from 'react';
|
|
4
|
-
import { uiTheme } from '../ui/theme';
|
|
4
|
+
import { uiTheme } from '../ui/theme.js';
|
|
5
5
|
const selectedBackground = '#f4b183';
|
|
6
6
|
const selectedForeground = '#050608';
|
|
7
7
|
const toProviderLabel = (provider) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SlashCommandDefinition } from '../commands/slash-commands';
|
|
2
|
-
import type { PromptFileSelection } from '../files/types';
|
|
1
|
+
import type { SlashCommandDefinition } from '../commands/slash-commands.js';
|
|
2
|
+
import type { PromptFileSelection } from '../files/types.js';
|
|
3
3
|
type PromptProps = {
|
|
4
4
|
isThinking: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import { FileMentionMenu } from './file-mention-menu';
|
|
4
|
-
import { FooterHints } from './footer-hints';
|
|
5
|
-
import { SlashCommandMenu } from './slash-command-menu';
|
|
6
|
-
import { isAudioSelection, isImageSelection, isVideoSelection, } from '../files/attachment-capabilities';
|
|
7
|
-
import { useFileMentionMenu } from '../hooks/use-file-mention-menu';
|
|
8
|
-
import { useSlashCommandMenu } from '../hooks/use-slash-command-menu';
|
|
9
|
-
import { uiTheme } from '../ui/theme';
|
|
3
|
+
import { FileMentionMenu } from './file-mention-menu.js';
|
|
4
|
+
import { FooterHints } from './footer-hints.js';
|
|
5
|
+
import { SlashCommandMenu } from './slash-command-menu.js';
|
|
6
|
+
import { isAudioSelection, isImageSelection, isVideoSelection, } from '../files/attachment-capabilities.js';
|
|
7
|
+
import { useFileMentionMenu } from '../hooks/use-file-mention-menu.js';
|
|
8
|
+
import { useSlashCommandMenu } from '../hooks/use-slash-command-menu.js';
|
|
9
|
+
import { uiTheme } from '../ui/theme.js';
|
|
10
10
|
export const Prompt = ({ isThinking, disabled = false, modelLabel, contextUsagePercent, value, selectedFiles, onAddSelectedFiles, onValueChange, onSlashCommandSelect, onSlashMenuVisibilityChange, onSubmit, }) => {
|
|
11
11
|
const textareaRef = useRef(null);
|
|
12
12
|
const mediaFiles = useMemo(() => selectedFiles.filter(file => isImageSelection(file) || isAudioSelection(file) || isVideoSelection(file)), [selectedFiles]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { TextAttributes } from '@opentui/core';
|
|
3
|
-
import { uiTheme } from '../ui/theme';
|
|
3
|
+
import { uiTheme } from '../ui/theme.js';
|
|
4
4
|
const selectedBackground = '#f4b183';
|
|
5
5
|
const selectedForeground = '#050608';
|
|
6
6
|
export const SlashCommandMenu = ({ visible, options, selectedIndex }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getToolHiddenArgumentKeys, getToolDisplayName } from './tool-display-config';
|
|
1
|
+
import { getToolHiddenArgumentKeys, getToolDisplayName } from './tool-display-config.js';
|
|
2
2
|
const asRecord = (value) => {
|
|
3
3
|
return value && typeof value === 'object' ? value : {};
|
|
4
4
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
2
|
import { TextAttributes } from '@opentui/core';
|
|
3
|
-
import { uiTheme } from '../ui/theme';
|
|
4
|
-
import { buildToolConfirmDialogContent } from './tool-confirm-dialog-content';
|
|
3
|
+
import { uiTheme } from '../ui/theme.js';
|
|
4
|
+
import { buildToolConfirmDialogContent } from './tool-confirm-dialog-content.js';
|
|
5
5
|
const selectedForeground = '#050608';
|
|
6
6
|
const renderButton = (label, selected) => {
|
|
7
7
|
return (_jsx("box", { paddingLeft: 1, paddingRight: 1, backgroundColor: selected ? uiTheme.accent : uiTheme.surface, border: ['top', 'bottom', 'left', 'right'], borderColor: selected ? uiTheme.accent : uiTheme.divider, children: _jsx("text", { fg: selected ? selectedForeground : uiTheme.text, attributes: TextAttributes.BOLD, children: label }) }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageContent } from '../types/message-content';
|
|
2
|
-
import type { PromptFileSelection } from './types';
|
|
3
|
-
import { type AttachmentModelCapabilities } from './attachment-capabilities';
|
|
1
|
+
import type { MessageContent } from '../types/message-content.js';
|
|
2
|
+
import type { PromptFileSelection } from './types.js';
|
|
3
|
+
import { type AttachmentModelCapabilities } from './attachment-capabilities.js';
|
|
4
4
|
export declare const buildPromptContent: (prompt: string, files: PromptFileSelection[], capabilities: AttachmentModelCapabilities) => Promise<MessageContent>;
|
|
5
5
|
//# sourceMappingURL=attachment-content.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { extname } from 'node:path';
|
|
3
|
-
import { isAudioSelection, isImageSelection, isVideoSelection, } from './attachment-capabilities';
|
|
3
|
+
import { isAudioSelection, isImageSelection, isVideoSelection, } from './attachment-capabilities.js';
|
|
4
4
|
const IMAGE_MIME_BY_EXTENSION = {
|
|
5
5
|
'.gif': 'image/gif',
|
|
6
6
|
'.jpeg': 'image/jpeg',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-files.d.ts","sourceRoot":"","sources":["../../src/files/workspace-files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace-files.d.ts","sourceRoot":"","sources":["../../src/files/workspace-files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAmDnD,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,mBAAmB,EAAE,CAKxE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { readdir } from 'node:fs/promises';
|
|
1
|
+
import { readdir, stat } from 'node:fs/promises';
|
|
2
2
|
import { join, relative } from 'node:path';
|
|
3
|
-
import { resolveWorkspaceRoot } from '../agent/runtime/source-modules';
|
|
3
|
+
import { resolveWorkspaceRoot } from '../agent/runtime/source-modules.js';
|
|
4
4
|
const IGNORED_DIR_NAMES = new Set([
|
|
5
5
|
'.git',
|
|
6
6
|
'node_modules',
|
|
@@ -28,16 +28,14 @@ const visitDirectory = async (root, directory, output) => {
|
|
|
28
28
|
if (!entry.isFile()) {
|
|
29
29
|
continue;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
.catch(() => undefined);
|
|
34
|
-
if (!stat || !stat.isFile()) {
|
|
31
|
+
const fileStat = await stat(absolutePath).catch(() => undefined);
|
|
32
|
+
if (!fileStat || !fileStat.isFile()) {
|
|
35
33
|
continue;
|
|
36
34
|
}
|
|
37
35
|
output.push({
|
|
38
36
|
relativePath: relative(root, absolutePath),
|
|
39
37
|
absolutePath,
|
|
40
|
-
size:
|
|
38
|
+
size: fileStat.size,
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-files.js","sourceRoot":"","sources":["../../src/files/workspace-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace-files.js","sourceRoot":"","sources":["../../src/files/workspace-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,MAAM;IACN,cAAc;IACd,MAAM;IACN,OAAO;IACP,UAAU;IACV,OAAO;IACP,QAAQ;CACT,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,CAAC,CAAsB,EAAE,CAAsB,EAAE,EAAE;IACtE,OAAO,CAAC,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,KAAK,EAC1B,IAAY,EACZ,SAAiB,EACjB,MAA6B,EACd,EAAE;IACjB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAElF,MAAM,aAAa,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtC,SAAS;YACX,CAAC;YACD,MAAM,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;YACjD,SAAS;QACX,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACpB,SAAS;QACX,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACjE,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YACpC,SAAS;QACX,CAAC;QAED,MAAM,CAAC,IAAI,CAAC;YACV,YAAY,EAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;YAC1C,YAAY;YACZ,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,IAAoC,EAAE;IAC3E,MAAM,aAAa,GAAG,oBAAoB,EAAE,CAAC;IAC7C,MAAM,KAAK,GAA0B,EAAE,CAAC;IACxC,MAAM,cAAc,CAAC,aAAa,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentEventHandlers } from '../agent/runtime/types';
|
|
2
|
-
import type { ReplySegmentType } from '../types/chat';
|
|
1
|
+
import type { AgentEventHandlers } from '../agent/runtime/types.js';
|
|
2
|
+
import type { ReplySegmentType } from '../types/chat.js';
|
|
3
3
|
type BuildAgentEventHandlersParams = {
|
|
4
4
|
turnId: number;
|
|
5
5
|
isCurrentRequest: () => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatLoopEvent, formatStepEvent, formatStopEvent, formatToolConfirmEvent, formatToolResultEvent, formatToolResultEventCode, formatToolStreamEvent, formatToolUseEvent, formatToolUseEventCode, } from '../agent/runtime/event-format';
|
|
1
|
+
import { formatLoopEvent, formatStepEvent, formatStopEvent, formatToolConfirmEvent, formatToolResultEvent, formatToolResultEventCode, formatToolStreamEvent, formatToolUseEvent, formatToolUseEventCode, } from '../agent/runtime/event-format.js';
|
|
2
2
|
const shouldShowEventLog = () => {
|
|
3
3
|
const value = process.env.AGENT_SHOW_EVENTS?.trim().toLowerCase();
|
|
4
4
|
return value === '1' || value === 'true' || value === 'yes' || value === 'on';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssistantReply, ChatTurn, ReplySegment, ReplySegmentType, ReplyStatus } from '../types/chat';
|
|
1
|
+
import type { AssistantReply, ChatTurn, ReplySegment, ReplySegmentType, ReplyStatus } from '../types/chat.js';
|
|
2
2
|
export declare const createStreamingReply: (modelLabel: string) => AssistantReply;
|
|
3
3
|
export declare const patchTurn: (turns: ChatTurn[], turnId: number, patch: (turn: ChatTurn) => ChatTurn) => ChatTurn[];
|
|
4
4
|
export declare const ensureSegment: (segments: ReplySegment[], segmentId: string, type: ReplySegmentType, data?: unknown) => ReplySegment[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentToolConfirmEvent } from '../agent/runtime/types';
|
|
2
|
-
import type { ChatTurn } from '../types/chat';
|
|
3
|
-
import type { PromptFileSelection } from '../files/types';
|
|
1
|
+
import type { AgentToolConfirmEvent } from '../agent/runtime/types.js';
|
|
2
|
+
import type { ChatTurn } from '../types/chat.js';
|
|
3
|
+
import type { PromptFileSelection } from '../files/types.js';
|
|
4
4
|
export type UseAgentChatResult = {
|
|
5
5
|
turns: ChatTurn[];
|
|
6
6
|
inputValue: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { resolveSlashCommand } from '../commands/slash-commands';
|
|
3
|
-
import { getAgentModelAttachmentCapabilities, getAgentModelLabel, runAgentPrompt, } from '../agent/runtime/runtime';
|
|
4
|
-
import { requestExit } from '../runtime/exit';
|
|
5
|
-
import { buildAgentEventHandlers } from './agent-event-handlers';
|
|
6
|
-
import { buildHelpSegments, buildUnsupportedSegments, extractErrorMessage, } from './chat-local-replies';
|
|
7
|
-
import { appendNoteLine, appendToSegment, createStreamingReply, orderReplySegments, patchTurn, setReplyStatus, } from './turn-updater';
|
|
8
|
-
import { DEFAULT_ATTACHMENT_MODEL_CAPABILITIES, } from '../files/attachment-capabilities';
|
|
9
|
-
import { buildPromptContent } from '../files/attachment-content';
|
|
10
|
-
import { buildPromptDisplay } from '../files/prompt-display';
|
|
2
|
+
import { resolveSlashCommand } from '../commands/slash-commands.js';
|
|
3
|
+
import { getAgentModelAttachmentCapabilities, getAgentModelLabel, runAgentPrompt, } from '../agent/runtime/runtime.js';
|
|
4
|
+
import { requestExit } from '../runtime/exit.js';
|
|
5
|
+
import { buildAgentEventHandlers } from './agent-event-handlers.js';
|
|
6
|
+
import { buildHelpSegments, buildUnsupportedSegments, extractErrorMessage, } from './chat-local-replies.js';
|
|
7
|
+
import { appendNoteLine, appendToSegment, createStreamingReply, orderReplySegments, patchTurn, setReplyStatus, } from './turn-updater.js';
|
|
8
|
+
import { DEFAULT_ATTACHMENT_MODEL_CAPABILITIES, } from '../files/attachment-capabilities.js';
|
|
9
|
+
import { buildPromptContent } from '../files/attachment-content.js';
|
|
10
|
+
import { buildPromptDisplay } from '../files/prompt-display.js';
|
|
11
11
|
const INITIAL_MODEL_LABEL = process.env.AGENT_MODEL?.trim() || '';
|
|
12
12
|
const normalizeTokenCount = (value) => {
|
|
13
13
|
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { KeyEvent, TextareaRenderable } from '@opentui/core';
|
|
2
2
|
import { type RefObject } from 'react';
|
|
3
|
-
import type { PromptFileSelection } from '../files/types';
|
|
3
|
+
import type { PromptFileSelection } from '../files/types.js';
|
|
4
4
|
type UseFileMentionMenuParams = {
|
|
5
5
|
value: string;
|
|
6
6
|
textareaRef: RefObject<TextareaRenderable | null>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { findTrailingFileMention } from '../files/file-mention-query';
|
|
3
|
-
import { isMediaSelection } from '../files/attachment-capabilities';
|
|
4
|
-
import { listWorkspaceFiles } from '../files/workspace-files';
|
|
2
|
+
import { findTrailingFileMention } from '../files/file-mention-query.js';
|
|
3
|
+
import { isMediaSelection } from '../files/attachment-capabilities.js';
|
|
4
|
+
import { listWorkspaceFiles } from '../files/workspace-files.js';
|
|
5
5
|
const normalize = (value) => value.trim().toLowerCase();
|
|
6
6
|
export const useFileMentionMenu = ({ value, textareaRef, selectedFiles, onFilesSelected, onValueChange, disabled = false, }) => {
|
|
7
7
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { listWorkspaceFiles } from '../files/workspace-files';
|
|
2
|
+
import { listWorkspaceFiles } from '../files/workspace-files.js';
|
|
3
3
|
const normalize = (value) => value.trim().toLowerCase();
|
|
4
4
|
export const useFilePicker = () => {
|
|
5
5
|
const [visible, setVisible] = useState(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { KeyEvent } from '@opentui/core';
|
|
2
|
-
import type { AgentModelOption } from '../agent/runtime/model-types';
|
|
2
|
+
import type { AgentModelOption } from '../agent/runtime/model-types.js';
|
|
3
3
|
type UseModelPickerParams = {
|
|
4
4
|
onModelChanged: (label: string) => void;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { listAgentModels, switchAgentModel } from '../agent/runtime/runtime';
|
|
2
|
+
import { listAgentModels, switchAgentModel } from '../agent/runtime/runtime.js';
|
|
3
3
|
const normalize = (value) => value.trim().toLowerCase();
|
|
4
4
|
export const useModelPicker = ({ onModelChanged }) => {
|
|
5
5
|
const [visible, setVisible] = useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { KeyEvent, TextareaRenderable } from '@opentui/core';
|
|
2
2
|
import { type RefObject } from 'react';
|
|
3
|
-
import { type SlashCommandDefinition } from '../commands/slash-commands';
|
|
3
|
+
import { type SlashCommandDefinition } from '../commands/slash-commands.js';
|
|
4
4
|
type UseSlashCommandMenuParams = {
|
|
5
5
|
value: string;
|
|
6
6
|
onValueChange: (value: string) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { filterSlashCommands } from '../commands/slash-commands';
|
|
2
|
+
import { filterSlashCommands } from '../commands/slash-commands.js';
|
|
3
3
|
const getSlashQuery = (value) => {
|
|
4
4
|
if (!/^\/[^\s]*$/.test(value)) {
|
|
5
5
|
return null;
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { bindExitGuards, hardResetTerminal, initExitRuntime, registerTerminalBackgroundRestore, } from './runtime/exit';
|
|
6
|
-
import { probeTerminalColors, setTerminalWindowBackground, setTerminalWindowForeground, } from './runtime/terminal-theme';
|
|
7
|
-
import { applyMarkdownThemeMode } from './ui/opencode-markdown';
|
|
8
|
-
import { applyUiThemeMode, uiTheme } from './ui/theme';
|
|
9
|
-
bindExitGuards();
|
|
10
|
-
// OpenTUI exposes OPENTUI_FORCE_WCWIDTH for terminals where CJK width handling
|
|
11
|
-
// is more accurate with wcwidth than the default Unicode capability probe.
|
|
12
|
-
process.env.OPENTUI_FORCE_WCWIDTH ??= '1';
|
|
13
|
-
const terminalColors = await probeTerminalColors();
|
|
14
|
-
applyUiThemeMode(terminalColors.mode);
|
|
15
|
-
applyMarkdownThemeMode(terminalColors.mode, process.platform);
|
|
16
|
-
if (terminalColors.rawBackgroundColor &&
|
|
17
|
-
terminalColors.rawBackgroundColor.toLowerCase() !== uiTheme.bg.toLowerCase()) {
|
|
18
|
-
const originalBackground = terminalColors.rawBackgroundColor;
|
|
19
|
-
setTerminalWindowBackground(uiTheme.bg);
|
|
20
|
-
registerTerminalBackgroundRestore(() => {
|
|
21
|
-
setTerminalWindowBackground(originalBackground);
|
|
22
|
-
});
|
|
1
|
+
import { ensureSupportedRuntime } from './runtime/runtime-support.js';
|
|
2
|
+
if (ensureSupportedRuntime()) {
|
|
3
|
+
const { runCliApp } = await import('./run-cli-app.js');
|
|
4
|
+
await runCliApp();
|
|
23
5
|
}
|
|
24
|
-
if (terminalColors.rawForegroundColor &&
|
|
25
|
-
terminalColors.rawForegroundColor.toLowerCase() !== uiTheme.userPromptText.toLowerCase()) {
|
|
26
|
-
const originalForeground = terminalColors.rawForegroundColor;
|
|
27
|
-
setTerminalWindowForeground(uiTheme.userPromptText);
|
|
28
|
-
registerTerminalBackgroundRestore(() => {
|
|
29
|
-
setTerminalWindowForeground(originalForeground);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
const renderer = await createCliRenderer({
|
|
33
|
-
exitOnCtrlC: false,
|
|
34
|
-
onDestroy: hardResetTerminal,
|
|
35
|
-
backgroundColor: uiTheme.bg,
|
|
36
|
-
});
|
|
37
|
-
initExitRuntime(renderer);
|
|
38
|
-
createRoot(renderer).render(_jsx(App, {}));
|
|
39
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,IAAI,sBAAsB,EAAE,EAAE,CAAC;IAC7B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACvD,MAAM,SAAS,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-cli-app.d.ts","sourceRoot":"","sources":["../src/run-cli-app.tsx"],"names":[],"mappings":"AAkBA,wBAAsB,SAAS,kBAsC9B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { createCliRenderer } from '@opentui/core';
|
|
3
|
+
import { createRoot } from '@opentui/react';
|
|
4
|
+
import { App } from './App.js';
|
|
5
|
+
import { bindExitGuards, hardResetTerminal, initExitRuntime, registerTerminalBackgroundRestore, } from './runtime/exit.js';
|
|
6
|
+
import { probeTerminalColors, setTerminalWindowBackground, setTerminalWindowForeground, } from './runtime/terminal-theme.js';
|
|
7
|
+
import { applyMarkdownThemeMode } from './ui/opencode-markdown.js';
|
|
8
|
+
import { applyUiThemeMode, uiTheme } from './ui/theme.js';
|
|
9
|
+
export async function runCliApp() {
|
|
10
|
+
bindExitGuards();
|
|
11
|
+
// OpenTUI exposes OPENTUI_FORCE_WCWIDTH for terminals where CJK width handling
|
|
12
|
+
// is more accurate with wcwidth than the default Unicode capability probe.
|
|
13
|
+
process.env.OPENTUI_FORCE_WCWIDTH ??= '1';
|
|
14
|
+
const terminalColors = await probeTerminalColors();
|
|
15
|
+
applyUiThemeMode(terminalColors.mode);
|
|
16
|
+
applyMarkdownThemeMode(terminalColors.mode, process.platform);
|
|
17
|
+
if (terminalColors.rawBackgroundColor &&
|
|
18
|
+
terminalColors.rawBackgroundColor.toLowerCase() !== uiTheme.bg.toLowerCase()) {
|
|
19
|
+
const originalBackground = terminalColors.rawBackgroundColor;
|
|
20
|
+
setTerminalWindowBackground(uiTheme.bg);
|
|
21
|
+
registerTerminalBackgroundRestore(() => {
|
|
22
|
+
setTerminalWindowBackground(originalBackground);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (terminalColors.rawForegroundColor &&
|
|
26
|
+
terminalColors.rawForegroundColor.toLowerCase() !== uiTheme.userPromptText.toLowerCase()) {
|
|
27
|
+
const originalForeground = terminalColors.rawForegroundColor;
|
|
28
|
+
setTerminalWindowForeground(uiTheme.userPromptText);
|
|
29
|
+
registerTerminalBackgroundRestore(() => {
|
|
30
|
+
setTerminalWindowForeground(originalForeground);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const renderer = await createCliRenderer({
|
|
34
|
+
exitOnCtrlC: false,
|
|
35
|
+
onDestroy: hardResetTerminal,
|
|
36
|
+
backgroundColor: uiTheme.bg,
|
|
37
|
+
});
|
|
38
|
+
initExitRuntime(renderer);
|
|
39
|
+
createRoot(renderer).render(_jsx(App, {}));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=run-cli-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-cli-app.js","sourceRoot":"","sources":["../src/run-cli-app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iCAAiC,GAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,cAAc,EAAE,CAAC;IACjB,+EAA+E;IAC/E,2EAA2E;IAC3E,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,GAAG,CAAC;IAC1C,MAAM,cAAc,GAAG,MAAM,mBAAmB,EAAE,CAAC;IACnD,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACtC,sBAAsB,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE9D,IACE,cAAc,CAAC,kBAAkB;QACjC,cAAc,CAAC,kBAAkB,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,EAC5E,CAAC;QACD,MAAM,kBAAkB,GAAG,cAAc,CAAC,kBAAkB,CAAC;QAC7D,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACxC,iCAAiC,CAAC,GAAG,EAAE;YACrC,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IACE,cAAc,CAAC,kBAAkB;QACjC,cAAc,CAAC,kBAAkB,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,EACxF,CAAC;QACD,MAAM,kBAAkB,GAAG,cAAc,CAAC,kBAAkB,CAAC;QAC7D,2BAA2B,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACpD,iCAAiC,CAAC,GAAG,EAAE;YACrC,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC;QACvC,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,iBAAiB;QAC5B,eAAe,EAAE,OAAO,CAAC,EAAE;KAC5B,CAAC,CAAC;IACH,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1B,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/runtime/exit.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-support.d.ts","sourceRoot":"","sources":["../../src/runtime/runtime-support.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,eAAoE,CAAC;AAE9F,eAAO,MAAM,4BAA4B,cAS3B,CAAC;AAEf,eAAO,MAAM,sBAAsB,eAOlC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const BUN_INSTALL_URL = 'https://bun.sh';
|
|
2
|
+
export const isBunRuntime = () => typeof Bun !== 'undefined' || Boolean(process.versions.bun);
|
|
3
|
+
export const getUnsupportedRuntimeMessage = () => [
|
|
4
|
+
'renx currently requires the Bun runtime because OpenTUI depends on Bun FFI APIs.',
|
|
5
|
+
'',
|
|
6
|
+
'Use one of these commands instead:',
|
|
7
|
+
' bunx @renxqoo/renx-code',
|
|
8
|
+
' bun install -g @renxqoo/renx-code',
|
|
9
|
+
'',
|
|
10
|
+
`Install Bun: ${BUN_INSTALL_URL}`,
|
|
11
|
+
].join('\n');
|
|
12
|
+
export const ensureSupportedRuntime = () => {
|
|
13
|
+
if (isBunRuntime()) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
console.error(getUnsupportedRuntimeMessage());
|
|
17
|
+
return false;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=runtime-support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-support.js","sourceRoot":"","sources":["../../src/runtime/runtime-support.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,OAAO,GAAG,KAAK,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE,CAC/C;IACE,kFAAkF;IAClF,EAAE;IACF,oCAAoC;IACpC,2BAA2B;IAC3B,qCAAqC;IACrC,EAAE;IACF,gBAAgB,eAAe,EAAE;CAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEf,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,IAAI,YAAY,EAAE,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SyntaxStyle } from '@opentui/core';
|
|
2
|
-
import { type MarkdownThemePlatform } from './open-code-theme';
|
|
3
|
-
import type { UiThemeMode } from './theme';
|
|
2
|
+
import { type MarkdownThemePlatform } from './open-code-theme.js';
|
|
3
|
+
import type { UiThemeMode } from './theme.js';
|
|
4
4
|
export declare let opencodeMarkdownSyntax: SyntaxStyle;
|
|
5
5
|
export declare let opencodeSubtleMarkdownSyntax: SyntaxStyle;
|
|
6
6
|
export declare const applyMarkdownThemeMode: (mode: UiThemeMode, platform?: MarkdownThemePlatform) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RGBA, SyntaxStyle } from '@opentui/core';
|
|
2
|
-
import { resolveOpenCodeTheme, } from './open-code-theme';
|
|
2
|
+
import { resolveOpenCodeTheme, } from './open-code-theme.js';
|
|
3
3
|
const getSyntaxRules = (theme, options) => {
|
|
4
4
|
const useItalic = options.platform !== 'darwin';
|
|
5
5
|
const useUnderline = options.platform !== 'darwin';
|
package/dist/ui/theme.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextAttributes } from '@opentui/core';
|
|
2
|
-
import { type OpenCodeThemeMode } from './open-code-theme';
|
|
2
|
+
import { type OpenCodeThemeMode } from './open-code-theme.js';
|
|
3
3
|
export type UiThemeMode = OpenCodeThemeMode;
|
|
4
4
|
type TextAttributeValue = (typeof TextAttributes)[keyof typeof TextAttributes];
|
|
5
5
|
export type UiTheme = {
|
package/dist/ui/theme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@renxqoo/renx-code",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Enterprise-grade AI coding assistant CLI tool with interactive terminal UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"dev": "bun run src/index.tsx",
|
|
27
27
|
"dev:watch": "bun run --watch src/index.tsx",
|
|
28
|
-
"build": "tsc -p tsconfig.build.json",
|
|
29
|
-
"build:cli": "
|
|
28
|
+
"build": "tsc -p tsconfig.build.json && node ./scripts/fix-esm-imports.mjs",
|
|
29
|
+
"build:cli": "npm run build && node -e \"require('fs').chmodSync('dist/cli.js', 0o755)\"",
|
|
30
30
|
"start": "node dist/index.js",
|
|
31
31
|
"test": "vitest",
|
|
32
32
|
"test:coverage": "vitest run --coverage",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"zod": "^4.3.6"
|
|
111
111
|
},
|
|
112
112
|
"engines": {
|
|
113
|
-
"
|
|
113
|
+
"bun": ">=1.1.0"
|
|
114
114
|
},
|
|
115
115
|
"lint-staged": {
|
|
116
116
|
"*.ts": [
|