@abacus-ai/cli 1.106.25007 → 2.0.0-canary.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/.oxlintrc.json +8 -0
- package/dist/index.mjs +12603 -0
- package/package.json +7 -39
- package/resources/abacus.ico +0 -0
- package/resources/entitlements.plist +9 -0
- package/src/__e2e__/README.md +196 -0
- package/src/__e2e__/agent-interactions.e2e.test.tsx +61 -0
- package/src/__e2e__/cli-commands.e2e.test.tsx +77 -0
- package/src/__e2e__/conversation-throttle.e2e.test.ts +453 -0
- package/src/__e2e__/conversation.e2e.test.tsx +56 -0
- package/src/__e2e__/diff-preview.e2e.test.tsx +3399 -0
- package/src/__e2e__/file-creation.e2e.test.tsx +149 -0
- package/src/__e2e__/helpers/test-helpers.ts +450 -0
- package/src/__e2e__/keyboard-navigation.e2e.test.tsx +34 -0
- package/src/__e2e__/llm-models.e2e.test.ts +402 -0
- package/src/__e2e__/mcp/mcp-callback-flow.e2e.test.tsx +71 -0
- package/src/__e2e__/mcp/mcp-full-app-ui.e2e.test.tsx +167 -0
- package/src/__e2e__/mcp/mcp-ui-rendering.e2e.test.tsx +185 -0
- package/src/__e2e__/repl.e2e.test.tsx +78 -0
- package/src/__e2e__/shell-compatibility.e2e.test.tsx +76 -0
- package/src/__e2e__/theme-mcp.e2e.test.tsx +98 -0
- package/src/__e2e__/tool-permissions.e2e.test.tsx +66 -0
- package/src/args.ts +22 -0
- package/src/components/__tests__/react-compiler.test.tsx +78 -0
- package/src/components/__tests__/status-indicator.test.tsx +403 -0
- package/src/components/composer/__tests__/bash-runner.test.tsx +263 -0
- package/src/components/composer/agent-mode-indicator.tsx +63 -0
- package/src/components/composer/bash-runner.tsx +54 -0
- package/src/components/composer/commands/default-commands.tsx +615 -0
- package/src/components/composer/commands/handler.tsx +59 -0
- package/src/components/composer/commands/picker.tsx +273 -0
- package/src/components/composer/commands/registry.ts +233 -0
- package/src/components/composer/commands/types.ts +33 -0
- package/src/components/composer/context.tsx +88 -0
- package/src/components/composer/file-mention-picker.tsx +83 -0
- package/src/components/composer/help.tsx +44 -0
- package/src/components/composer/index.tsx +1006 -0
- package/src/components/composer/mentions.ts +57 -0
- package/src/components/composer/message-queue.tsx +70 -0
- package/src/components/composer/mode-panel.tsx +35 -0
- package/src/components/composer/modes/__tests__/bash-handler.test.tsx +755 -0
- package/src/components/composer/modes/__tests__/bash-renderer.test.tsx +1108 -0
- package/src/components/composer/modes/bash-handler.tsx +132 -0
- package/src/components/composer/modes/bash-renderer.tsx +175 -0
- package/src/components/composer/modes/default-handlers.tsx +33 -0
- package/src/components/composer/modes/index.ts +41 -0
- package/src/components/composer/modes/types.ts +21 -0
- package/src/components/composer/persistent-shell.ts +283 -0
- package/src/components/composer/process.ts +65 -0
- package/src/components/composer/types.ts +9 -0
- package/src/components/composer/use-mention-search.ts +68 -0
- package/src/components/error-boundry.tsx +60 -0
- package/src/components/exit-message.tsx +29 -0
- package/src/components/expanded-view.tsx +74 -0
- package/src/components/file-completion.tsx +127 -0
- package/src/components/header.tsx +47 -0
- package/src/components/logo.tsx +37 -0
- package/src/components/segments.tsx +356 -0
- package/src/components/status-indicator.tsx +306 -0
- package/src/components/tool-group-summary.tsx +263 -0
- package/src/components/tool-permissions/ask-user-question-permission-ui.tsx +312 -0
- package/src/components/tool-permissions/diff-preview.tsx +355 -0
- package/src/components/tool-permissions/index.ts +5 -0
- package/src/components/tool-permissions/permission-options.tsx +375 -0
- package/src/components/tool-permissions/permission-preview-header.tsx +57 -0
- package/src/components/tool-permissions/tool-permission-ui.tsx +398 -0
- package/src/components/tools/agent/ask-user-question.tsx +101 -0
- package/src/components/tools/agent/enter-plan-mode.tsx +49 -0
- package/src/components/tools/agent/exit-plan-mode.tsx +75 -0
- package/src/components/tools/agent/handoff-to-main.tsx +27 -0
- package/src/components/tools/agent/subagent.tsx +37 -0
- package/src/components/tools/agent/todo-write.tsx +104 -0
- package/src/components/tools/browser/close-tab.tsx +58 -0
- package/src/components/tools/browser/computer.tsx +70 -0
- package/src/components/tools/browser/get-interactive-elements.tsx +54 -0
- package/src/components/tools/browser/get-tab-content.tsx +51 -0
- package/src/components/tools/browser/navigate-to.tsx +59 -0
- package/src/components/tools/browser/new-tab.tsx +60 -0
- package/src/components/tools/browser/perform-action.tsx +63 -0
- package/src/components/tools/browser/refresh-tab.tsx +43 -0
- package/src/components/tools/browser/switch-tab.tsx +58 -0
- package/src/components/tools/filesystem/delete-file.tsx +104 -0
- package/src/components/tools/filesystem/edit.tsx +220 -0
- package/src/components/tools/filesystem/list-dir.tsx +78 -0
- package/src/components/tools/filesystem/read-file.tsx +180 -0
- package/src/components/tools/filesystem/upload-image.tsx +76 -0
- package/src/components/tools/ide/ide-diagnostics.tsx +62 -0
- package/src/components/tools/index.ts +91 -0
- package/src/components/tools/mcp/mcp-tool.tsx +158 -0
- package/src/components/tools/search/fetch-url.tsx +73 -0
- package/src/components/tools/search/file-search.tsx +78 -0
- package/src/components/tools/search/grep.tsx +90 -0
- package/src/components/tools/search/semantic-search.tsx +66 -0
- package/src/components/tools/search/web-search.tsx +71 -0
- package/src/components/tools/shared/index.tsx +48 -0
- package/src/components/tools/shared/zod-coercion.ts +35 -0
- package/src/components/tools/terminal/bash-tool-output.tsx +174 -0
- package/src/components/tools/terminal/get-terminal-output.tsx +85 -0
- package/src/components/tools/terminal/run-in-terminal.tsx +106 -0
- package/src/components/tools/types.ts +16 -0
- package/src/components/tools.tsx +66 -0
- package/src/components/ui/__tests__/divider.test.tsx +61 -0
- package/src/components/ui/__tests__/gradient.test.tsx +125 -0
- package/src/components/ui/__tests__/input.test.tsx +166 -0
- package/src/components/ui/__tests__/select.test.tsx +273 -0
- package/src/components/ui/__tests__/shimmer.test.tsx +99 -0
- package/src/components/ui/blinking-indicator.tsx +25 -0
- package/src/components/ui/divider.tsx +162 -0
- package/src/components/ui/gradient.tsx +56 -0
- package/src/components/ui/input.tsx +228 -0
- package/src/components/ui/select.tsx +151 -0
- package/src/components/ui/shimmer.tsx +84 -0
- package/src/context/agent-mode.tsx +95 -0
- package/src/context/extension-file.tsx +136 -0
- package/src/context/network-activity.tsx +45 -0
- package/src/context/notification.tsx +62 -0
- package/src/context/shell-size.tsx +49 -0
- package/src/context/shell-title.tsx +38 -0
- package/src/entrypoints/print-mode.ts +312 -0
- package/src/entrypoints/repl.tsx +401 -0
- package/src/hooks/use-agent.ts +15 -0
- package/src/hooks/use-api-client.ts +1 -0
- package/src/hooks/use-available-height.ts +8 -0
- package/src/hooks/use-cleanup.ts +29 -0
- package/src/hooks/use-interrupt-manager.ts +242 -0
- package/src/hooks/use-models.ts +22 -0
- package/src/index.ts +217 -0
- package/src/lib/__tests__/ansi.test.ts +255 -0
- package/src/lib/__tests__/cli.test.ts +122 -0
- package/src/lib/__tests__/commands.test.ts +325 -0
- package/src/lib/__tests__/constants.test.ts +15 -0
- package/src/lib/__tests__/focusables.test.ts +25 -0
- package/src/lib/__tests__/fs.test.ts +231 -0
- package/src/lib/__tests__/markdown.test.tsx +348 -0
- package/src/lib/__tests__/mcpCommandHandler.test.ts +173 -0
- package/src/lib/__tests__/mcpManagement.test.ts +38 -0
- package/src/lib/__tests__/path-paste.test.ts +144 -0
- package/src/lib/__tests__/path.test.ts +300 -0
- package/src/lib/__tests__/queries.test.ts +39 -0
- package/src/lib/__tests__/standaloneMcpService.test.ts +71 -0
- package/src/lib/__tests__/text-buffer.test.ts +328 -0
- package/src/lib/__tests__/text-utils.test.ts +32 -0
- package/src/lib/__tests__/timing.test.ts +78 -0
- package/src/lib/__tests__/utils.test.ts +238 -0
- package/src/lib/__tests__/vim-buffer-actions.test.ts +154 -0
- package/src/lib/ansi.ts +150 -0
- package/src/lib/cli-push-server.ts +112 -0
- package/src/lib/cli.ts +44 -0
- package/src/lib/clipboard.ts +226 -0
- package/src/lib/command-utils.ts +93 -0
- package/src/lib/commands.ts +270 -0
- package/src/lib/constants.ts +3 -0
- package/src/lib/extension-connection.ts +181 -0
- package/src/lib/focusables.ts +7 -0
- package/src/lib/fs.ts +533 -0
- package/src/lib/markdown/code-block.tsx +63 -0
- package/src/lib/markdown/index.ts +4 -0
- package/src/lib/markdown/link.tsx +19 -0
- package/src/lib/markdown/markdown.tsx +372 -0
- package/src/lib/markdown/types.ts +15 -0
- package/src/lib/mcpCommandHandler.ts +121 -0
- package/src/lib/mcpManagement.ts +44 -0
- package/src/lib/path-paste.ts +185 -0
- package/src/lib/path.ts +179 -0
- package/src/lib/queries.ts +15 -0
- package/src/lib/standaloneMcpService.ts +688 -0
- package/src/lib/status-utils.ts +237 -0
- package/src/lib/test-utils.tsx +72 -0
- package/src/lib/text-buffer.ts +2415 -0
- package/src/lib/text-utils.ts +272 -0
- package/src/lib/timing.ts +63 -0
- package/src/lib/types.ts +295 -0
- package/src/lib/utils.ts +182 -0
- package/src/lib/vim-buffer-actions.ts +732 -0
- package/src/providers/agent.tsx +1075 -0
- package/src/providers/api-client.tsx +43 -0
- package/src/services/logger.ts +85 -0
- package/src/terminal/detection.ts +187 -0
- package/src/terminal/exit.ts +279 -0
- package/src/terminal/notification.ts +83 -0
- package/src/terminal/progress.ts +201 -0
- package/src/terminal/setup.ts +797 -0
- package/src/terminal/suspend.ts +58 -0
- package/src/terminal/types.ts +51 -0
- package/src/theme/context.tsx +57 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/themed.tsx +35 -0
- package/src/theme/themes.json +546 -0
- package/src/theme/types.ts +110 -0
- package/src/tools/types.ts +59 -0
- package/src/tools/utils/__tests__/zod-coercion.test.ts +33 -0
- package/src/tools/utils/tool-ui-components.tsx +631 -0
- package/src/tools/utils/zod-coercion.ts +35 -0
- package/tsconfig.json +11 -0
- package/tsconfig.node.json +29 -0
- package/tsconfig.test.json +27 -0
- package/tsdown.config.ts +17 -0
- package/vitest.config.ts +76 -0
- package/README.md +0 -28
- package/dist/index.js +0 -26
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const MENTION_CHAR = /[A-Za-z0-9_.~/\\-]/;
|
|
2
|
+
export const COMMAND_CHAR = /[A-Za-z0-9_./\\-]/;
|
|
3
|
+
|
|
4
|
+
export function getMentionAtCursor(
|
|
5
|
+
text: string,
|
|
6
|
+
cursor: [number, number],
|
|
7
|
+
): { query: string; startRow: number; startCol: number; endRow: number; endCol: number } | null {
|
|
8
|
+
const [row, col] = cursor;
|
|
9
|
+
const lines = text.split("\n");
|
|
10
|
+
const currentLine = lines[row] || "";
|
|
11
|
+
|
|
12
|
+
let atIndex = -1;
|
|
13
|
+
for (let i = Math.min(col, currentLine.length) - 1; i >= 0; i--) {
|
|
14
|
+
const ch = currentLine[i];
|
|
15
|
+
if (ch === "@") {
|
|
16
|
+
atIndex = i;
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
if (!MENTION_CHAR.test(ch)) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (atIndex === -1) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
if (atIndex > 0) {
|
|
27
|
+
const prev = currentLine[atIndex - 1];
|
|
28
|
+
if (prev && !/\s/.test(prev)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let endCol = atIndex + 1;
|
|
34
|
+
while (endCol < currentLine.length && MENTION_CHAR.test(currentLine[endCol])) {
|
|
35
|
+
endCol++;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const typedEnd = Math.min(col, endCol);
|
|
39
|
+
const query = currentLine.slice(atIndex + 1, typedEnd);
|
|
40
|
+
|
|
41
|
+
return { query, startRow: row, startCol: atIndex, endRow: row, endCol };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function buildMentionGrammar() {
|
|
45
|
+
const pathChars = `[A-Za-z0-9_.~/-]`;
|
|
46
|
+
const escapedSpace = `\\\\ `;
|
|
47
|
+
const quotedPath = `'[^']*'`;
|
|
48
|
+
const unquotedPath = `(?:${pathChars}|${escapedSpace})+`;
|
|
49
|
+
const mentionPattern = `(?:^|\\s)@(?:${quotedPath}|${unquotedPath})`;
|
|
50
|
+
const commandPattern = `^/[A-Za-z0-9_./\\-]+`;
|
|
51
|
+
const pastedPattern = `\\[Pasted text #\\d+ \\+\\d+ lines\\]`;
|
|
52
|
+
return [
|
|
53
|
+
{ regex: new RegExp(mentionPattern, "gm"), color: "cyanBright" },
|
|
54
|
+
{ regex: new RegExp(commandPattern, "gm"), color: "magentaBright" },
|
|
55
|
+
{ regex: new RegExp(pastedPattern, "g"), color: "yellowBright" },
|
|
56
|
+
];
|
|
57
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { View, Text } from "@codellm/jar";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
|
|
4
|
+
import { useShellSize } from "../../context/shell-size.tsx";
|
|
5
|
+
import { useComposerContext } from "./context.js";
|
|
6
|
+
|
|
7
|
+
function truncateMiddle(text: string, maxLength: number): string {
|
|
8
|
+
if (text.length <= maxLength) {
|
|
9
|
+
return text;
|
|
10
|
+
}
|
|
11
|
+
const halfLength = Math.floor((maxLength - 3) / 2);
|
|
12
|
+
return `${text.slice(0, halfLength)}...${text.slice(-halfLength)}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const QueueDivider = memo(() => (
|
|
16
|
+
<View
|
|
17
|
+
flexGrow={1}
|
|
18
|
+
// @ts-expect-error custom border style for dash character
|
|
19
|
+
borderStyle={{ bottom: "─" }}
|
|
20
|
+
borderBottom
|
|
21
|
+
borderTop={false}
|
|
22
|
+
borderLeft={false}
|
|
23
|
+
borderRight={false}
|
|
24
|
+
borderDimColor
|
|
25
|
+
/>
|
|
26
|
+
));
|
|
27
|
+
QueueDivider.displayName = "QueueDivider";
|
|
28
|
+
|
|
29
|
+
interface MessageQueueProps {
|
|
30
|
+
pathElement?: React.ReactNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const MessageQueue = memo(({ pathElement }: MessageQueueProps) => {
|
|
34
|
+
const { queuedMessages } = useComposerContext();
|
|
35
|
+
|
|
36
|
+
const { width: terminalWidth } = useShellSize();
|
|
37
|
+
|
|
38
|
+
if (queuedMessages.length === 0) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View flexDirection="row" flexWrap="wrap" justifyContent="space-between" alignItems="flex-end">
|
|
44
|
+
<View flexDirection="column">
|
|
45
|
+
<View flexDirection="row" alignItems="flex-end">
|
|
46
|
+
<Text dimColor>╭</Text>
|
|
47
|
+
<QueueDivider />
|
|
48
|
+
<Text dimColor> Queued ({queuedMessages.length}) </Text>
|
|
49
|
+
<QueueDivider />
|
|
50
|
+
<Text dimColor>╮</Text>
|
|
51
|
+
</View>
|
|
52
|
+
<View
|
|
53
|
+
borderStyle="round"
|
|
54
|
+
borderDimColor
|
|
55
|
+
borderTop={false}
|
|
56
|
+
borderBottom={false}
|
|
57
|
+
flexDirection="column"
|
|
58
|
+
>
|
|
59
|
+
{queuedMessages.map((msg, i) => (
|
|
60
|
+
<Text key={i} wrap="truncate">
|
|
61
|
+
<Text>{truncateMiddle(msg.trim(), Math.max(4, Math.floor(terminalWidth / 2)))}</Text>
|
|
62
|
+
</Text>
|
|
63
|
+
))}
|
|
64
|
+
</View>
|
|
65
|
+
</View>
|
|
66
|
+
{pathElement}
|
|
67
|
+
</View>
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
MessageQueue.displayName = "MessageQueue";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
|
|
3
|
+
import type { InterruptHints } from "../../hooks/use-interrupt-manager.js";
|
|
4
|
+
|
|
5
|
+
import { ModeHandler } from "./modes/types.js";
|
|
6
|
+
import { ComposerMode } from "./types.js";
|
|
7
|
+
|
|
8
|
+
interface ModePanelProps {
|
|
9
|
+
mode: ComposerMode;
|
|
10
|
+
prompt: string;
|
|
11
|
+
handler: ModeHandler | null;
|
|
12
|
+
onExitFilesMode: () => void;
|
|
13
|
+
hints?: InterruptHints;
|
|
14
|
+
availableHeight: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const ModePanel = memo(
|
|
18
|
+
({ mode: _mode, prompt, handler, onExitFilesMode, hints, availableHeight }: ModePanelProps) => {
|
|
19
|
+
if (handler) {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
{handler.render({
|
|
23
|
+
prompt,
|
|
24
|
+
onExit: onExitFilesMode,
|
|
25
|
+
hints,
|
|
26
|
+
availableHeight,
|
|
27
|
+
})}
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return null;
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
ModePanel.displayName = "ModePanel";
|