@travisennis/acai 0.0.6 → 0.0.7
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 +186 -17
- package/bin/acai-wrapper.js +26 -0
- package/dist/agent/index.d.ts +15 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +202 -174
- package/dist/api/exa/index.js +1 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +40 -7
- package/dist/commands/add-directory-command.d.ts +1 -1
- package/dist/commands/add-directory-command.d.ts.map +1 -1
- package/dist/commands/add-directory-command.js +1 -32
- package/dist/commands/application-log-command.d.ts +1 -1
- package/dist/commands/application-log-command.d.ts.map +1 -1
- package/dist/commands/application-log-command.js +2 -38
- package/dist/commands/clear-command.d.ts +1 -1
- package/dist/commands/clear-command.d.ts.map +1 -1
- package/dist/commands/clear-command.js +1 -5
- package/dist/commands/compact-command.d.ts.map +1 -1
- package/dist/commands/compact-command.js +0 -9
- package/dist/commands/context-command.d.ts +1 -1
- package/dist/commands/context-command.d.ts.map +1 -1
- package/dist/commands/context-command.js +13 -72
- package/dist/commands/copy-command.d.ts.map +1 -1
- package/dist/commands/copy-command.js +0 -19
- package/dist/commands/edit-command.d.ts +1 -1
- package/dist/commands/edit-command.d.ts.map +1 -1
- package/dist/commands/edit-command.js +3 -49
- package/dist/commands/edit-prompt-command.d.ts +1 -1
- package/dist/commands/edit-prompt-command.d.ts.map +1 -1
- package/dist/commands/edit-prompt-command.js +1 -26
- package/dist/commands/exit-command.d.ts +1 -4
- package/dist/commands/exit-command.d.ts.map +1 -1
- package/dist/commands/exit-command.js +2 -18
- package/dist/commands/files-command.d.ts +1 -1
- package/dist/commands/files-command.d.ts.map +1 -1
- package/dist/commands/files-command.js +1 -54
- package/dist/commands/generate-rules-command.d.ts +1 -1
- package/dist/commands/generate-rules-command.d.ts.map +1 -1
- package/dist/commands/generate-rules-command.js +18 -60
- package/dist/commands/handoff-command.d.ts.map +1 -1
- package/dist/commands/handoff-command.js +0 -11
- package/dist/commands/health-command.d.ts +1 -1
- package/dist/commands/health-command.d.ts.map +1 -1
- package/dist/commands/health-command.js +8 -103
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +6 -14
- package/dist/commands/history-command.d.ts +1 -1
- package/dist/commands/history-command.d.ts.map +1 -1
- package/dist/commands/history-command.js +30 -106
- package/dist/commands/init-command.d.ts +1 -1
- package/dist/commands/init-command.d.ts.map +1 -1
- package/dist/commands/init-command.js +4 -23
- package/dist/commands/last-log-command.d.ts +1 -1
- package/dist/commands/last-log-command.d.ts.map +1 -1
- package/dist/commands/last-log-command.js +1 -28
- package/dist/commands/list-directories-command.d.ts +1 -1
- package/dist/commands/list-directories-command.d.ts.map +1 -1
- package/dist/commands/list-directories-command.js +1 -14
- package/dist/commands/list-tools-command.d.ts.map +1 -1
- package/dist/commands/list-tools-command.js +55 -78
- package/dist/commands/manager.d.ts +1 -8
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +7 -42
- package/dist/commands/model-command.d.ts +0 -22
- package/dist/commands/model-command.d.ts.map +1 -1
- package/dist/commands/model-command.js +5 -126
- package/dist/commands/paste-command.d.ts +1 -1
- package/dist/commands/paste-command.d.ts.map +1 -1
- package/dist/commands/paste-command.js +1 -79
- package/dist/commands/pickup-command.d.ts.map +1 -1
- package/dist/commands/pickup-command.js +3 -55
- package/dist/commands/prompt-command.d.ts +19 -1
- package/dist/commands/prompt-command.d.ts.map +1 -1
- package/dist/commands/prompt-command.js +172 -194
- package/dist/commands/remove-directory-command.d.ts +1 -1
- package/dist/commands/remove-directory-command.d.ts.map +1 -1
- package/dist/commands/remove-directory-command.js +1 -33
- package/dist/commands/reset-command.d.ts +1 -1
- package/dist/commands/reset-command.d.ts.map +1 -1
- package/dist/commands/reset-command.js +3 -11
- package/dist/commands/rules-command.d.ts +1 -1
- package/dist/commands/rules-command.d.ts.map +1 -1
- package/dist/commands/rules-command.js +1 -63
- package/dist/commands/save-command.d.ts +1 -1
- package/dist/commands/save-command.d.ts.map +1 -1
- package/dist/commands/save-command.js +1 -8
- package/dist/commands/shell-command.d.ts.map +1 -1
- package/dist/commands/shell-command.js +1 -48
- package/dist/commands/types.d.ts +0 -3
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/usage-command.d.ts +1 -1
- package/dist/commands/usage-command.d.ts.map +1 -1
- package/dist/commands/usage-command.js +5 -16
- package/dist/config.d.ts +17 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +86 -53
- package/dist/execution/index.d.ts +17 -2
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +62 -20
- package/dist/formatting.d.ts +19 -0
- package/dist/formatting.d.ts.map +1 -1
- package/dist/formatting.js +54 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +212 -153
- package/dist/messages.d.ts +3 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +67 -3
- package/dist/models/anthropic-provider.d.ts.map +1 -1
- package/dist/models/anthropic-provider.js +0 -7
- package/dist/models/deepseek-provider.d.ts.map +1 -1
- package/dist/models/deepseek-provider.js +0 -2
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +0 -3
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +0 -1
- package/dist/models/openai-provider.d.ts.map +1 -1
- package/dist/models/openai-provider.js +0 -4
- package/dist/models/openrouter-provider.d.ts +10 -9
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +82 -88
- package/dist/models/providers.d.ts +4 -14
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/providers.js +1 -57
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -2
- package/dist/prompts.d.ts +9 -4
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +427 -99
- package/dist/repl/project-status-line.d.ts +1 -0
- package/dist/repl/project-status-line.d.ts.map +1 -1
- package/dist/repl/project-status-line.js +57 -27
- package/dist/repl-new.d.ts +0 -2
- package/dist/repl-new.d.ts.map +1 -1
- package/dist/repl-new.js +34 -54
- package/dist/skills.d.ts +20 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +192 -0
- package/dist/terminal/control.d.ts +55 -0
- package/dist/terminal/control.d.ts.map +1 -0
- package/dist/terminal/control.js +109 -0
- package/dist/terminal/default-theme.d.ts +1 -1
- package/dist/terminal/default-theme.d.ts.map +1 -1
- package/dist/terminal/default-theme.js +24 -28
- package/dist/terminal/formatting.d.ts +23 -25
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +35 -52
- package/dist/terminal/highlight/index.d.ts.map +1 -1
- package/dist/terminal/highlight/index.js +3 -6
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +2 -6
- package/dist/terminal/index.d.ts +2 -101
- package/dist/terminal/index.d.ts.map +1 -1
- package/dist/terminal/index.js +2 -464
- package/dist/terminal/markdown.js +7 -5
- package/dist/terminal/strip-ansi.js +4 -4
- package/dist/terminal/table/cell.d.ts +114 -0
- package/dist/terminal/table/cell.d.ts.map +1 -0
- package/dist/terminal/table/cell.js +407 -0
- package/dist/terminal/table/debug.d.ts +15 -0
- package/dist/terminal/table/debug.d.ts.map +1 -0
- package/dist/terminal/table/debug.js +32 -0
- package/dist/terminal/table/index.d.ts +3 -0
- package/dist/terminal/table/index.d.ts.map +1 -0
- package/dist/terminal/table/index.js +2 -0
- package/dist/terminal/table/layout-manager.d.ts +27 -0
- package/dist/terminal/table/layout-manager.d.ts.map +1 -0
- package/dist/terminal/table/layout-manager.js +257 -0
- package/dist/terminal/table/table.d.ts +9 -0
- package/dist/terminal/table/table.d.ts.map +1 -0
- package/dist/terminal/table/table.js +97 -0
- package/dist/terminal/table/utils.d.ts +63 -0
- package/dist/terminal/table/utils.d.ts.map +1 -0
- package/dist/terminal/table/utils.js +326 -0
- package/dist/tokens/threshold.d.ts +6 -21
- package/dist/tokens/threshold.d.ts.map +1 -1
- package/dist/tokens/threshold.js +13 -31
- package/dist/tools/advanced-edit-file.d.ts.map +1 -1
- package/dist/tools/advanced-edit-file.js +5 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/agent.js +19 -5
- package/dist/tools/bash.d.ts +3 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +204 -42
- package/dist/tools/batch.d.ts +34 -0
- package/dist/tools/batch.d.ts.map +1 -0
- package/dist/tools/batch.js +174 -0
- package/dist/tools/code-interpreter.d.ts.map +1 -1
- package/dist/tools/code-interpreter.js +25 -9
- package/dist/tools/delete-file.d.ts.map +1 -1
- package/dist/tools/delete-file.js +9 -2
- package/dist/tools/directory-tree.d.ts +0 -6
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +29 -18
- package/dist/tools/dynamic-tool-loader.d.ts +0 -4
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +2 -2
- package/dist/tools/edit-file.d.ts.map +1 -1
- package/dist/tools/edit-file.js +16 -3
- package/dist/tools/glob.d.ts.map +1 -1
- package/dist/tools/glob.js +24 -13
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +40 -25
- package/dist/tools/index.d.ts +17 -3
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +43 -1
- package/dist/tools/llm-edit-fixer.d.ts +0 -1
- package/dist/tools/llm-edit-fixer.d.ts.map +1 -1
- package/dist/tools/llm-edit-fixer.js +14 -28
- package/dist/tools/move-file.d.ts.map +1 -1
- package/dist/tools/move-file.js +8 -1
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +32 -23
- package/dist/tools/read-multiple-files.d.ts.map +1 -1
- package/dist/tools/read-multiple-files.js +102 -45
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/save-file.d.ts.map +1 -1
- package/dist/tools/save-file.js +20 -2
- package/dist/tools/think.d.ts.map +1 -1
- package/dist/tools/think.js +7 -1
- package/dist/tools/types.d.ts +5 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +1 -1
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +24 -9
- package/dist/tui/components/assistant-message.js +1 -1
- package/dist/tui/components/box.d.ts +20 -0
- package/dist/tui/components/box.d.ts.map +1 -0
- package/dist/tui/components/box.js +81 -0
- package/dist/tui/components/editor.d.ts +60 -5
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +577 -115
- package/dist/tui/components/footer.d.ts +0 -12
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +19 -7
- package/dist/tui/components/header.d.ts +21 -0
- package/dist/tui/components/header.d.ts.map +1 -0
- package/dist/tui/components/header.js +63 -0
- package/dist/tui/components/loader.d.ts +5 -1
- package/dist/tui/components/loader.d.ts.map +1 -1
- package/dist/tui/components/loader.js +2 -2
- package/dist/tui/components/markdown.d.ts +26 -23
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +107 -54
- package/dist/tui/components/modal.d.ts +0 -11
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +0 -29
- package/dist/tui/components/progress-bar.d.ts +19 -0
- package/dist/tui/components/progress-bar.d.ts.map +1 -0
- package/dist/tui/components/progress-bar.js +78 -0
- package/dist/tui/components/prompt-status.d.ts +2 -1
- package/dist/tui/components/prompt-status.d.ts.map +1 -1
- package/dist/tui/components/prompt-status.js +7 -2
- package/dist/tui/components/select-list.d.ts +27 -1
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +93 -29
- package/dist/tui/components/spacer.d.ts +1 -1
- package/dist/tui/components/spacer.d.ts.map +1 -1
- package/dist/tui/components/spacer.js +2 -2
- package/dist/tui/components/table.d.ts +27 -0
- package/dist/tui/components/table.d.ts.map +1 -0
- package/dist/tui/components/table.js +125 -0
- package/dist/tui/components/thinking-block.d.ts.map +1 -1
- package/dist/tui/components/thinking-block.js +4 -1
- package/dist/tui/components/tool-execution.d.ts +8 -4
- package/dist/tui/components/tool-execution.d.ts.map +1 -1
- package/dist/tui/components/tool-execution.js +88 -80
- package/dist/tui/components/user-message.d.ts.map +1 -1
- package/dist/tui/components/user-message.js +6 -4
- package/dist/tui/index.d.ts +9 -5
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +5 -1
- package/dist/tui/terminal.d.ts +2 -1
- package/dist/tui/terminal.d.ts.map +1 -1
- package/dist/tui/terminal.js +28 -38
- package/dist/tui/tui.d.ts +2 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +53 -33
- package/dist/tui/utils.d.ts +5 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +81 -1
- package/dist/{tools/bash-utils.d.ts → utils/bash.d.ts} +3 -3
- package/dist/utils/bash.d.ts.map +1 -0
- package/dist/{tools/bash-utils.js → utils/bash.js} +22 -11
- package/dist/utils/{filesystem.d.ts → filesystem/operations.d.ts} +1 -1
- package/dist/utils/filesystem/operations.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.d.ts → utils/filesystem/security.d.ts} +3 -2
- package/dist/utils/filesystem/security.d.ts.map +1 -0
- package/dist/{tools/filesystem-utils.js → utils/filesystem/security.js} +62 -4
- package/dist/utils/funcs.d.ts +6 -0
- package/dist/utils/funcs.d.ts.map +1 -0
- package/dist/utils/funcs.js +6 -0
- package/dist/{tools/git-utils.d.ts → utils/git.d.ts} +1 -1
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/{tools/git-utils.js → utils/git.js} +0 -6
- package/dist/utils/glob.js +1 -1
- package/dist/utils/{zod-utils.d.ts → zod.d.ts} +1 -1
- package/dist/utils/zod.d.ts.map +1 -0
- package/package.json +17 -17
- package/dist/agent/manual-loop.d.ts +0 -41
- package/dist/agent/manual-loop.d.ts.map +0 -1
- package/dist/agent/manual-loop.js +0 -278
- package/dist/repl/display-tool-messages.d.ts +0 -4
- package/dist/repl/display-tool-messages.d.ts.map +0 -1
- package/dist/repl/display-tool-messages.js +0 -58
- package/dist/repl/display-tool-use.d.ts +0 -14
- package/dist/repl/display-tool-use.d.ts.map +0 -1
- package/dist/repl/display-tool-use.js +0 -63
- package/dist/repl/get-prompt-header.d.ts +0 -8
- package/dist/repl/get-prompt-header.d.ts.map +0 -1
- package/dist/repl/get-prompt-header.js +0 -9
- package/dist/repl/prompt.d.ts +0 -21
- package/dist/repl/prompt.d.ts.map +0 -1
- package/dist/repl/prompt.js +0 -244
- package/dist/repl.d.ts +0 -29
- package/dist/repl.d.ts.map +0 -1
- package/dist/repl.js +0 -218
- package/dist/terminal/checkbox-prompt.d.ts +0 -36
- package/dist/terminal/checkbox-prompt.d.ts.map +0 -1
- package/dist/terminal/checkbox-prompt.js +0 -368
- package/dist/terminal/editor-prompt.d.ts +0 -10
- package/dist/terminal/editor-prompt.d.ts.map +0 -1
- package/dist/terminal/editor-prompt.js +0 -61
- package/dist/terminal/errors.d.ts +0 -19
- package/dist/terminal/errors.d.ts.map +0 -1
- package/dist/terminal/errors.js +0 -37
- package/dist/terminal/input-prompt.d.ts +0 -17
- package/dist/terminal/input-prompt.d.ts.map +0 -1
- package/dist/terminal/input-prompt.js +0 -181
- package/dist/terminal/search-prompt.d.ts +0 -20
- package/dist/terminal/search-prompt.d.ts.map +0 -1
- package/dist/terminal/search-prompt.js +0 -280
- package/dist/terminal/types.d.ts +0 -35
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/terminal/types.js +0 -1
- package/dist/tools/bash-utils.d.ts.map +0 -1
- package/dist/tools/filesystem-utils.d.ts.map +0 -1
- package/dist/tools/git-utils.d.ts.map +0 -1
- package/dist/utils/filesystem.d.ts.map +0 -1
- package/dist/utils/zod-utils.d.ts.map +0 -1
- /package/dist/utils/{filesystem.js → filesystem/operations.js} +0 -0
- /package/dist/utils/{zod-utils.js → zod.js} +0 -0
package/dist/repl/prompt.js
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import { readdir } from "node:fs/promises";
|
|
2
|
-
import { parse, relative, resolve, sep } from "node:path";
|
|
3
|
-
import { createInterface } from "node:readline/promises";
|
|
4
|
-
import Clipboard from "@crosscopy/clipboard";
|
|
5
|
-
import { asyncTry } from "@travisennis/stdlib/try";
|
|
6
|
-
import { logger } from "../logger.js";
|
|
7
|
-
const whitespaceRegex = /\s+/;
|
|
8
|
-
// Cache for directory listings to improve performance
|
|
9
|
-
class DirectoryCache {
|
|
10
|
-
cache = new Map();
|
|
11
|
-
ttl = 3000; // 3 seconds
|
|
12
|
-
async get(dir) {
|
|
13
|
-
const cached = this.cache.get(dir);
|
|
14
|
-
if (cached && Date.now() - cached.timestamp < this.ttl) {
|
|
15
|
-
return cached.entries;
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
set(dir, entries) {
|
|
20
|
-
this.cache.set(dir, { entries, timestamp: Date.now() });
|
|
21
|
-
}
|
|
22
|
-
clear() {
|
|
23
|
-
this.cache.clear();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const directoryCache = new DirectoryCache();
|
|
27
|
-
// Helper function to get directory entries with caching
|
|
28
|
-
async function getDirectoryEntries(dir) {
|
|
29
|
-
const cached = await directoryCache.get(dir);
|
|
30
|
-
if (cached) {
|
|
31
|
-
return cached;
|
|
32
|
-
}
|
|
33
|
-
const tryAttempt = await asyncTry(readdir(dir, { withFileTypes: true }));
|
|
34
|
-
if (tryAttempt.isFailure) {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
const entries = tryAttempt.unwrap();
|
|
38
|
-
directoryCache.set(dir, entries);
|
|
39
|
-
return entries;
|
|
40
|
-
}
|
|
41
|
-
// Helper function to get completions from a specific directory
|
|
42
|
-
async function getCompletionsFromDir(line, dir, workspace) {
|
|
43
|
-
try {
|
|
44
|
-
const words = line.split(" ");
|
|
45
|
-
let last = words.at(-1);
|
|
46
|
-
if (!last) {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
const isAt = last.startsWith("@");
|
|
50
|
-
if (isAt) {
|
|
51
|
-
last = last.slice(1);
|
|
52
|
-
}
|
|
53
|
-
let { dir: pathDir, base } = parse(last);
|
|
54
|
-
// If pathDir is empty, use current directory
|
|
55
|
-
if (!pathDir) {
|
|
56
|
-
pathDir = ".";
|
|
57
|
-
}
|
|
58
|
-
// Resolve the path relative to the current directory
|
|
59
|
-
const resolvedPath = resolve(dir, pathDir);
|
|
60
|
-
// Check if resolved path is within any allowed directory
|
|
61
|
-
const isWithinAllowed = workspace.allowedDirs.some((allowedDir) => resolvedPath.startsWith(allowedDir));
|
|
62
|
-
if (!isWithinAllowed) {
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
let dirEntries = await getDirectoryEntries(resolvedPath);
|
|
66
|
-
// If we couldn't read the directory, try current directory
|
|
67
|
-
if (dirEntries.length === 0 && pathDir !== ".") {
|
|
68
|
-
dirEntries = await getDirectoryEntries(dir);
|
|
69
|
-
pathDir = ".";
|
|
70
|
-
}
|
|
71
|
-
// For an exact match that is a directory, read the contents of the directory
|
|
72
|
-
if (dirEntries.find((entry) => entry.name === base && entry.isDirectory())) {
|
|
73
|
-
const newPath = pathDir === "/" || pathDir === sep
|
|
74
|
-
? `${pathDir}${base}`
|
|
75
|
-
: `${pathDir}/${base}`;
|
|
76
|
-
const newResolvedPath = resolve(dir, newPath);
|
|
77
|
-
dirEntries = await getDirectoryEntries(newResolvedPath);
|
|
78
|
-
base = "";
|
|
79
|
-
pathDir = newPath;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
dirEntries = dirEntries.filter((entry) => entry.name.startsWith(base));
|
|
83
|
-
}
|
|
84
|
-
const hits = dirEntries
|
|
85
|
-
.filter((entry) => entry.isFile() || entry.isDirectory())
|
|
86
|
-
.map((entry) => {
|
|
87
|
-
const prefix = pathDir === "."
|
|
88
|
-
? ""
|
|
89
|
-
: pathDir === sep || pathDir === "/"
|
|
90
|
-
? ""
|
|
91
|
-
: `${pathDir}/`;
|
|
92
|
-
const fullPath = `${prefix}${entry.name}${entry.isDirectory() && !entry.name.endsWith("/") ? "/" : ""}`;
|
|
93
|
-
// Convert to relative path from primary directory for display
|
|
94
|
-
const absolutePath = resolve(dir, fullPath);
|
|
95
|
-
const relativePath = relative(workspace.primaryDir, absolutePath);
|
|
96
|
-
return `${isAt ? "@" : ""}${relativePath.startsWith("..") ? relativePath : `./${relativePath}`}`;
|
|
97
|
-
});
|
|
98
|
-
return hits;
|
|
99
|
-
}
|
|
100
|
-
catch (_error) {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
async function fileSystemCompleter(line, workspace) {
|
|
105
|
-
try {
|
|
106
|
-
const words = line.split(" ");
|
|
107
|
-
let last = words.at(-1);
|
|
108
|
-
if (!last) {
|
|
109
|
-
return [[], line];
|
|
110
|
-
}
|
|
111
|
-
const isAt = last.startsWith("@");
|
|
112
|
-
if (isAt) {
|
|
113
|
-
last = last.slice(1);
|
|
114
|
-
}
|
|
115
|
-
// Search all directories in parallel
|
|
116
|
-
const completionPromises = workspace.allowedDirs.map((dir) => getCompletionsFromDir(line, dir, workspace));
|
|
117
|
-
const allResults = await Promise.all(completionPromises);
|
|
118
|
-
const flattenedResults = allResults.flat();
|
|
119
|
-
// Remove duplicates while preserving order
|
|
120
|
-
const uniqueResults = [...new Set(flattenedResults)];
|
|
121
|
-
return [uniqueResults, `${isAt ? "@" : ""}${last}`];
|
|
122
|
-
}
|
|
123
|
-
catch (_error) {
|
|
124
|
-
logger.error(_error);
|
|
125
|
-
return [[], line];
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
export class ReplPrompt {
|
|
129
|
-
// biome-ignore lint/suspicious/noExplicitAny: Keypress listener signature
|
|
130
|
-
keypressListener;
|
|
131
|
-
rl;
|
|
132
|
-
history;
|
|
133
|
-
maxHistory = 25;
|
|
134
|
-
pasteCounter = 0;
|
|
135
|
-
pasteStore = new Map();
|
|
136
|
-
constructor({ commands, history, workspace, }) {
|
|
137
|
-
this.history = history;
|
|
138
|
-
this.rl = createInterface({
|
|
139
|
-
input: process.stdin,
|
|
140
|
-
output: process.stdout,
|
|
141
|
-
history: this.history,
|
|
142
|
-
historySize: this.maxHistory,
|
|
143
|
-
completer: async (line) => {
|
|
144
|
-
const completions = commands.getCommands();
|
|
145
|
-
const words = line.trim().split(whitespaceRegex);
|
|
146
|
-
const firstWord = words[0] ?? "";
|
|
147
|
-
const rest = words.slice(1).join(" ") ?? "";
|
|
148
|
-
const matchingCommands = completions.filter((c) => c.startsWith(firstWord));
|
|
149
|
-
if (matchingCommands.length === 1 && rest !== "") {
|
|
150
|
-
// Single command matched, try to get subcommands
|
|
151
|
-
const subCompletions = await commands.getSubCommands(matchingCommands[0] ?? "");
|
|
152
|
-
const hits = subCompletions.filter((sc) => sc.startsWith(rest) || rest === "*");
|
|
153
|
-
if (hits.length > 0) {
|
|
154
|
-
return [hits.map((h) => `${firstWord} ${h}`), line];
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (matchingCommands.length > 0 &&
|
|
158
|
-
(words.length === 1 || line.endsWith(" "))) {
|
|
159
|
-
return [matchingCommands, line];
|
|
160
|
-
}
|
|
161
|
-
return fileSystemCompleter(line, workspace); // [completions, line];
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
if (process.stdin.isTTY) {
|
|
165
|
-
this.keypressListener = async (_str, key) => {
|
|
166
|
-
// if (this.rl.closed) {
|
|
167
|
-
// if (this.keypressListener) {
|
|
168
|
-
// process.stdin.off("keypress", this.keypressListener);
|
|
169
|
-
// this.keypressListener = undefined;
|
|
170
|
-
// }
|
|
171
|
-
// return;
|
|
172
|
-
// }
|
|
173
|
-
if (key?.ctrl && key.name === "v" && !key.meta && !key.shift) {
|
|
174
|
-
try {
|
|
175
|
-
const clipboardText = await Clipboard.getText();
|
|
176
|
-
if (clipboardText) {
|
|
177
|
-
const currentLine = this.rl.line;
|
|
178
|
-
const cursorPos = this.rl.cursor;
|
|
179
|
-
const beforeCursor = currentLine.substring(0, cursorPos);
|
|
180
|
-
const afterCursor = currentLine.substring(cursorPos);
|
|
181
|
-
let textToInsert;
|
|
182
|
-
// Smart paste: use placeholder for text > 50 characters
|
|
183
|
-
if (clipboardText.length > 50) {
|
|
184
|
-
this.pasteCounter++;
|
|
185
|
-
const pasteId = this.pasteCounter;
|
|
186
|
-
this.pasteStore.set(pasteId, clipboardText);
|
|
187
|
-
textToInsert = `[Paste #${pasteId}, ${clipboardText.length} characters]`;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
textToInsert = clipboardText;
|
|
191
|
-
}
|
|
192
|
-
const newLine = beforeCursor + textToInsert + afterCursor;
|
|
193
|
-
// biome-ignore lint/suspicious/noExplicitAny: Accessing internal readline method
|
|
194
|
-
this.rl.line = newLine;
|
|
195
|
-
// biome-ignore lint/suspicious/noExplicitAny: Accessing internal readline method
|
|
196
|
-
this.rl.cursor = cursorPos + textToInsert.length;
|
|
197
|
-
// biome-ignore lint/suspicious/noExplicitAny: Accessing internal readline method
|
|
198
|
-
this.rl._refreshLine();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
catch (error) {
|
|
202
|
-
logger.error(`Failed to paste from clipboard: ${error.message}`);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
process.stdin.on("keypress", this.keypressListener);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
async input() {
|
|
210
|
-
const input = await this.rl.question("> ");
|
|
211
|
-
// The readline interface automatically adds the input to the history.
|
|
212
|
-
// We need to handle two things:
|
|
213
|
-
// 1. Don't save empty lines.
|
|
214
|
-
// 2. Enforce max history size.
|
|
215
|
-
if (!input.trim()) {
|
|
216
|
-
// Last entry was this empty input, so remove it.
|
|
217
|
-
this.history.pop();
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
// A valid command was added. Trim history if needed.
|
|
221
|
-
while (this.history.length > this.maxHistory) {
|
|
222
|
-
this.history.shift();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return input;
|
|
226
|
-
}
|
|
227
|
-
getPasteStore() {
|
|
228
|
-
return new Map(this.pasteStore);
|
|
229
|
-
}
|
|
230
|
-
resetPasteStore() {
|
|
231
|
-
this.pasteCounter = 0;
|
|
232
|
-
this.pasteStore.clear();
|
|
233
|
-
}
|
|
234
|
-
close() {
|
|
235
|
-
if (this.keypressListener) {
|
|
236
|
-
process.stdin.off("keypress", this.keypressListener);
|
|
237
|
-
this.keypressListener = undefined;
|
|
238
|
-
}
|
|
239
|
-
this.rl.close();
|
|
240
|
-
}
|
|
241
|
-
[Symbol.dispose]() {
|
|
242
|
-
this.close();
|
|
243
|
-
}
|
|
244
|
-
}
|
package/dist/repl.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { CommandManager } from "./commands/manager.ts";
|
|
2
|
-
import type { WorkspaceContext } from "./index.ts";
|
|
3
|
-
import type { MessageHistory } from "./messages.ts";
|
|
4
|
-
import type { ModelManager } from "./models/manager.ts";
|
|
5
|
-
import type { PromptManager } from "./prompts/manager.ts";
|
|
6
|
-
import type { Terminal } from "./terminal/index.ts";
|
|
7
|
-
import type { TokenCounter } from "./tokens/counter.ts";
|
|
8
|
-
import type { TokenTracker } from "./tokens/tracker.ts";
|
|
9
|
-
interface ReplOptions {
|
|
10
|
-
messageHistory: MessageHistory;
|
|
11
|
-
promptManager: PromptManager;
|
|
12
|
-
modelManager: ModelManager;
|
|
13
|
-
tokenTracker: TokenTracker;
|
|
14
|
-
terminal: Terminal;
|
|
15
|
-
commands: CommandManager;
|
|
16
|
-
config: Record<PropertyKey, unknown>;
|
|
17
|
-
tokenCounter: TokenCounter;
|
|
18
|
-
showLastMessage: boolean;
|
|
19
|
-
promptHistory: string[];
|
|
20
|
-
workspace: WorkspaceContext;
|
|
21
|
-
}
|
|
22
|
-
export declare class Repl {
|
|
23
|
-
private options;
|
|
24
|
-
private showLastMessage;
|
|
25
|
-
constructor(options: ReplOptions);
|
|
26
|
-
run(): Promise<void>;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=repl.d.ts.map
|
package/dist/repl.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../source/repl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD,UAAU,WAAW;IACnB,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAED,qBAAa,IAAI;IACf,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,eAAe,CAAU;gBAErB,OAAO,EAAE,WAAW;IAK1B,GAAG;CA0PV"}
|
package/dist/repl.js
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { isRecord } from "@travisennis/stdlib/typeguards";
|
|
2
|
-
import { runManualLoop } from "./agent/manual-loop.js";
|
|
3
|
-
import { config as configManager } from "./config.js";
|
|
4
|
-
import { formatDuration } from "./formatting.js";
|
|
5
|
-
import { logger } from "./logger.js";
|
|
6
|
-
import { PromptError, processPrompt } from "./mentions.js";
|
|
7
|
-
import { systemPrompt } from "./prompts.js";
|
|
8
|
-
import { displayToolUse } from "./repl/display-tool-use.js";
|
|
9
|
-
import { getPromptHeader } from "./repl/get-prompt-header.js";
|
|
10
|
-
import { ReplPrompt } from "./repl/prompt.js";
|
|
11
|
-
import { toolCallRepair } from "./repl/tool-call-repair.js";
|
|
12
|
-
import style from "./terminal/style.js";
|
|
13
|
-
import { initAgents, initTools } from "./tools/index.js";
|
|
14
|
-
export class Repl {
|
|
15
|
-
options;
|
|
16
|
-
showLastMessage;
|
|
17
|
-
constructor(options) {
|
|
18
|
-
this.options = options;
|
|
19
|
-
this.showLastMessage = options.showLastMessage;
|
|
20
|
-
}
|
|
21
|
-
async run() {
|
|
22
|
-
const { config, promptManager, terminal, modelManager, tokenTracker, messageHistory, commands, tokenCounter, promptHistory, } = this.options;
|
|
23
|
-
logger.info(config, "Config:");
|
|
24
|
-
terminal.displayWelcome();
|
|
25
|
-
let currentContextWindow = 0;
|
|
26
|
-
messageHistory.on("clear-history", () => {
|
|
27
|
-
currentContextWindow = 0;
|
|
28
|
-
});
|
|
29
|
-
// Initialize tools once outside the loop - all models support tool calling
|
|
30
|
-
const coreTools = await initTools({
|
|
31
|
-
tokenCounter,
|
|
32
|
-
workspace: this.options.workspace,
|
|
33
|
-
modelManager,
|
|
34
|
-
tokenTracker,
|
|
35
|
-
});
|
|
36
|
-
const agentTools = await initAgents({
|
|
37
|
-
terminal,
|
|
38
|
-
modelManager,
|
|
39
|
-
tokenTracker,
|
|
40
|
-
tokenCounter,
|
|
41
|
-
workspace: this.options.workspace,
|
|
42
|
-
});
|
|
43
|
-
const completeToolDefs = {
|
|
44
|
-
...coreTools.toolDefs,
|
|
45
|
-
...agentTools.toolDefs,
|
|
46
|
-
};
|
|
47
|
-
const tools = {
|
|
48
|
-
toolDefs: completeToolDefs,
|
|
49
|
-
executors: new Map([...coreTools.executors, ...agentTools.executors]),
|
|
50
|
-
};
|
|
51
|
-
let currentAbortController = null;
|
|
52
|
-
// Handle Ctrl+C (SIGINT) as a fallback when not in raw mode
|
|
53
|
-
process.on("SIGINT", () => {
|
|
54
|
-
currentAbortController?.abort();
|
|
55
|
-
});
|
|
56
|
-
while (true) {
|
|
57
|
-
currentAbortController = new AbortController();
|
|
58
|
-
const { signal } = currentAbortController;
|
|
59
|
-
const langModel = modelManager.getModel("repl");
|
|
60
|
-
const modelConfig = modelManager.getModelMetadata("repl");
|
|
61
|
-
// agent header/status line
|
|
62
|
-
await getPromptHeader({
|
|
63
|
-
terminal,
|
|
64
|
-
modelId: langModel.modelId,
|
|
65
|
-
contextWindow: modelConfig.contextWindow,
|
|
66
|
-
currentContextWindow,
|
|
67
|
-
});
|
|
68
|
-
const projectConfig = await configManager.readProjectConfig();
|
|
69
|
-
// Display last message when continuing/resuming a conversation
|
|
70
|
-
if (this.showLastMessage) {
|
|
71
|
-
const lastMessage = messageHistory.getLastMessage();
|
|
72
|
-
if (lastMessage) {
|
|
73
|
-
terminal.lineBreak();
|
|
74
|
-
terminal.writeln(style.dim("Continuing conversation:"));
|
|
75
|
-
terminal.display(lastMessage);
|
|
76
|
-
terminal.lineBreak();
|
|
77
|
-
terminal.hr();
|
|
78
|
-
}
|
|
79
|
-
// don't show the last message after showing it once
|
|
80
|
-
this.showLastMessage = false;
|
|
81
|
-
}
|
|
82
|
-
if (!promptManager.isPending()) {
|
|
83
|
-
// For interactive input
|
|
84
|
-
const prompt = new ReplPrompt({
|
|
85
|
-
commands,
|
|
86
|
-
history: promptHistory,
|
|
87
|
-
workspace: this.options.workspace,
|
|
88
|
-
});
|
|
89
|
-
const userInput = await prompt.input();
|
|
90
|
-
const pasteStore = prompt.getPasteStore();
|
|
91
|
-
prompt.close();
|
|
92
|
-
prompt.resetPasteStore();
|
|
93
|
-
terminal.startProgress();
|
|
94
|
-
// see if the userInput contains a command
|
|
95
|
-
const commandResult = await commands.handle({ userInput });
|
|
96
|
-
if (commandResult.break) {
|
|
97
|
-
terminal.stopProgress();
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (commandResult.continue) {
|
|
101
|
-
terminal.stopProgress();
|
|
102
|
-
terminal.lineBreak();
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
if (!userInput.trim()) {
|
|
106
|
-
terminal.stopProgress();
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
// if there is no pending prompt then use the user's input. otherwise, the prompt was loaded from a command
|
|
110
|
-
if (!promptManager.isPending()) {
|
|
111
|
-
try {
|
|
112
|
-
const processedPrompt = await processPrompt(userInput, {
|
|
113
|
-
baseDir: process.cwd(),
|
|
114
|
-
model: modelConfig,
|
|
115
|
-
pasteStore,
|
|
116
|
-
});
|
|
117
|
-
for (const context of processedPrompt.context) {
|
|
118
|
-
promptManager.addContext(context);
|
|
119
|
-
}
|
|
120
|
-
promptManager.set(processedPrompt.message);
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
if (error instanceof PromptError) {
|
|
124
|
-
terminal.error(`Prompt processing failed: ${error.message}`);
|
|
125
|
-
if (error.cause &&
|
|
126
|
-
typeof error.cause === "object" &&
|
|
127
|
-
"command" in error.cause &&
|
|
128
|
-
typeof error.cause.command === "string") {
|
|
129
|
-
terminal.error(`Command: ${error.cause.command}`);
|
|
130
|
-
}
|
|
131
|
-
terminal.lineBreak();
|
|
132
|
-
terminal.stopProgress();
|
|
133
|
-
continue; // Continue the REPL loop
|
|
134
|
-
}
|
|
135
|
-
throw error; // Re-throw other errors
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
promptHistory.push(promptManager.get());
|
|
140
|
-
}
|
|
141
|
-
terminal.lineBreak();
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
terminal.startProgress();
|
|
145
|
-
}
|
|
146
|
-
const start = performance.now();
|
|
147
|
-
// flag to see if the user prompt has added context
|
|
148
|
-
const hasAddedContext = promptManager.hasContext();
|
|
149
|
-
if (hasAddedContext) {
|
|
150
|
-
const contextTokenCount = promptManager.getContextTokenCount();
|
|
151
|
-
terminal.info(`Context will be added to prompt. (${contextTokenCount} tokens)`);
|
|
152
|
-
terminal.lineBreak();
|
|
153
|
-
}
|
|
154
|
-
const userPrompt = promptManager.get();
|
|
155
|
-
const userMsg = promptManager.getUserMessage();
|
|
156
|
-
messageHistory.appendUserMessage(userMsg);
|
|
157
|
-
const finalSystemPrompt = await systemPrompt();
|
|
158
|
-
try {
|
|
159
|
-
const { toolDefs, executors } = tools;
|
|
160
|
-
const result = await runManualLoop({
|
|
161
|
-
modelManager,
|
|
162
|
-
terminal,
|
|
163
|
-
messageHistory,
|
|
164
|
-
systemPrompt: finalSystemPrompt,
|
|
165
|
-
input: userPrompt,
|
|
166
|
-
toolDefs,
|
|
167
|
-
executors,
|
|
168
|
-
maxIterations: projectConfig.loop.maxIterations,
|
|
169
|
-
abortSignal: signal,
|
|
170
|
-
toolCallRepair: toolCallRepair(modelManager),
|
|
171
|
-
});
|
|
172
|
-
const stop = performance.now();
|
|
173
|
-
terminal.hr();
|
|
174
|
-
// Notify if configured in project config (acai.json)
|
|
175
|
-
if (projectConfig.notify) {
|
|
176
|
-
terminal.alert();
|
|
177
|
-
}
|
|
178
|
-
// Create a more visual representation of steps/tool usage
|
|
179
|
-
displayToolUse(result, terminal);
|
|
180
|
-
// Show time spend on this prompt
|
|
181
|
-
terminal.writeln(style.dim(`Time: ${formatDuration(stop - start)}`));
|
|
182
|
-
const total = result.totalUsage;
|
|
183
|
-
const inputTokens = total.inputTokens;
|
|
184
|
-
const outputTokens = total.outputTokens;
|
|
185
|
-
const cachedInputTokens = total.cachedInputTokens;
|
|
186
|
-
const tokenSummary = `Tokens: ↑ ${inputTokens} (${cachedInputTokens}) ↓ ${outputTokens}`;
|
|
187
|
-
terminal.writeln(style.dim(tokenSummary));
|
|
188
|
-
const inputCost = modelConfig.costPerInputToken * inputTokens;
|
|
189
|
-
const outputCost = modelConfig.costPerOutputToken * outputTokens;
|
|
190
|
-
terminal.writeln(style.dim(`Cost: $${(inputCost + outputCost).toFixed(2)}`));
|
|
191
|
-
// Track aggregate usage across all steps when available
|
|
192
|
-
tokenTracker.trackUsage("repl", total);
|
|
193
|
-
// Derive current context window from final step usage
|
|
194
|
-
currentContextWindow = result.usage.totalTokens;
|
|
195
|
-
messageHistory.save();
|
|
196
|
-
terminal.hr();
|
|
197
|
-
terminal.lineBreak();
|
|
198
|
-
}
|
|
199
|
-
catch (e) {
|
|
200
|
-
if (isRecord(e) && isRecord(e["data"]) && "error" in e["data"]) {
|
|
201
|
-
terminal.error(e["data"]["error"].message);
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
terminal.error(e.message.length > 100
|
|
205
|
-
? `${e.message.slice(0, 100)}...`
|
|
206
|
-
: e.message);
|
|
207
|
-
}
|
|
208
|
-
terminal.lineBreak();
|
|
209
|
-
if (e instanceof Error) {
|
|
210
|
-
logger.error(e);
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
logger.error(JSON.stringify(e, null, 2));
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Standalone checkbox prompt (inquirer-like)
|
|
4
|
-
* - TypeScript version
|
|
5
|
-
*/
|
|
6
|
-
interface TerminalIo {
|
|
7
|
-
stdin: NodeJS.ReadStream;
|
|
8
|
-
stdout: NodeJS.WriteStream;
|
|
9
|
-
}
|
|
10
|
-
interface ChoiceObject<T = unknown> {
|
|
11
|
-
name: string;
|
|
12
|
-
value: T;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
checked?: boolean;
|
|
15
|
-
}
|
|
16
|
-
export type Choice<T = unknown> = string | ChoiceObject<T>;
|
|
17
|
-
export interface CheckboxOptions<T = unknown> {
|
|
18
|
-
message?: string;
|
|
19
|
-
choices: Choice<T>[];
|
|
20
|
-
initial?: number;
|
|
21
|
-
pageSize?: number;
|
|
22
|
-
loop?: boolean;
|
|
23
|
-
required?: boolean;
|
|
24
|
-
signal?: AbortSignal;
|
|
25
|
-
terminal?: TerminalIo;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Interactive checkbox prompt for selecting multiple options
|
|
29
|
-
* @param options Configuration options for the checkbox prompt
|
|
30
|
-
* @returns Promise resolving to array of selected values
|
|
31
|
-
* @throws {PromptCancelError} When user cancels with Ctrl+C
|
|
32
|
-
* @throws {PromptAbortError} When signal is aborted
|
|
33
|
-
*/
|
|
34
|
-
export declare function checkbox<T = unknown>({ message, choices, initial, pageSize, required, signal, terminal, }: CheckboxOptions<T>): Promise<T[]>;
|
|
35
|
-
export {};
|
|
36
|
-
//# sourceMappingURL=checkbox-prompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-prompt.d.ts","sourceRoot":"","sources":["../../source/terminal/checkbox-prompt.ts"],"names":[],"mappings":";AACA;;;GAGG;AAoCH,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC;CAC5B;AAED,UAAU,YAAY,CAAC,CAAC,GAAG,OAAO;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AACD,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAS3D,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB;AA4GD;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,EAC1C,OAAkB,EAClB,OAAO,EACP,OAAW,EACX,QAAY,EACZ,QAAgB,EAChB,MAAM,EACN,QAA2D,GAC5D,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAiQnC"}
|