@involvex/super-agent-cli 0.0.39
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/.grok/settings.json +3 -0
- package/.prettierignore +11 -0
- package/.super-agent/settings.json +23 -0
- package/LICENSE +21 -0
- package/README.md +366 -0
- package/assets/splash.png +0 -0
- package/dist/agent/grok-agent.d.ts +54 -0
- package/dist/agent/grok-agent.js +638 -0
- package/dist/agent/grok-agent.js.map +1 -0
- package/dist/agent/index.d.ts +14 -0
- package/dist/agent/index.js +139 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/super-agent.d.ts +54 -0
- package/dist/agent/super-agent.js +638 -0
- package/dist/agent/super-agent.js.map +1 -0
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/mcp.js +247 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/core/client.d.ts +49 -0
- package/dist/core/client.js +81 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/tools.d.ts +8 -0
- package/dist/core/tools.js +351 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/grok/client.d.ts +49 -0
- package/dist/grok/client.js +81 -0
- package/dist/grok/client.js.map +1 -0
- package/dist/grok/tools.d.ts +8 -0
- package/dist/grok/tools.js +351 -0
- package/dist/grok/tools.js.map +1 -0
- package/dist/hooks/use-enhanced-input.d.ts +37 -0
- package/dist/hooks/use-enhanced-input.js +228 -0
- package/dist/hooks/use-enhanced-input.js.map +1 -0
- package/dist/hooks/use-input-handler.d.ts +34 -0
- package/dist/hooks/use-input-handler.js +607 -0
- package/dist/hooks/use-input-handler.js.map +1 -0
- package/dist/hooks/use-input-history.d.ts +9 -0
- package/dist/hooks/use-input-history.js +62 -0
- package/dist/hooks/use-input-history.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6591 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +29 -0
- package/dist/mcp/client.js +127 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/config.d.ts +13 -0
- package/dist/mcp/config.js +45 -0
- package/dist/mcp/config.js.map +1 -0
- package/dist/mcp/transports.d.ts +51 -0
- package/dist/mcp/transports.js +229 -0
- package/dist/mcp/transports.js.map +1 -0
- package/dist/tools/bash.d.ts +10 -0
- package/dist/tools/bash.js +76 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/confirmation-tool.d.ts +16 -0
- package/dist/tools/confirmation-tool.js +77 -0
- package/dist/tools/confirmation-tool.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/morph-editor.d.ts +36 -0
- package/dist/tools/morph-editor.js +324 -0
- package/dist/tools/morph-editor.js.map +1 -0
- package/dist/tools/search.d.ts +69 -0
- package/dist/tools/search.js +307 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/text-editor.d.ts +26 -0
- package/dist/tools/text-editor.js +583 -0
- package/dist/tools/text-editor.js.map +1 -0
- package/dist/tools/todo-tool.d.ts +20 -0
- package/dist/tools/todo-tool.js +134 -0
- package/dist/tools/todo-tool.js.map +1 -0
- package/dist/types/index.d.ts +30 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/app.d.ts +6 -0
- package/dist/ui/app.js +76 -0
- package/dist/ui/app.js.map +1 -0
- package/dist/ui/components/api-key-input.d.ts +6 -0
- package/dist/ui/components/api-key-input.js +70 -0
- package/dist/ui/components/api-key-input.js.map +1 -0
- package/dist/ui/components/chat-history.d.ts +7 -0
- package/dist/ui/components/chat-history.js +136 -0
- package/dist/ui/components/chat-history.js.map +1 -0
- package/dist/ui/components/chat-input.d.ts +8 -0
- package/dist/ui/components/chat-input.js +47 -0
- package/dist/ui/components/chat-input.js.map +1 -0
- package/dist/ui/components/chat-interface.d.ts +7 -0
- package/dist/ui/components/chat-interface.js +213 -0
- package/dist/ui/components/chat-interface.js.map +1 -0
- package/dist/ui/components/command-suggestions.d.ts +16 -0
- package/dist/ui/components/command-suggestions.js +18 -0
- package/dist/ui/components/command-suggestions.js.map +1 -0
- package/dist/ui/components/confirmation-dialog.d.ts +10 -0
- package/dist/ui/components/confirmation-dialog.js +70 -0
- package/dist/ui/components/confirmation-dialog.js.map +1 -0
- package/dist/ui/components/diff-renderer.d.ts +13 -0
- package/dist/ui/components/diff-renderer.js +200 -0
- package/dist/ui/components/diff-renderer.js.map +1 -0
- package/dist/ui/components/loading-spinner.d.ts +7 -0
- package/dist/ui/components/loading-spinner.js +52 -0
- package/dist/ui/components/loading-spinner.js.map +1 -0
- package/dist/ui/components/mcp-status.d.ts +4 -0
- package/dist/ui/components/mcp-status.js +37 -0
- package/dist/ui/components/mcp-status.js.map +1 -0
- package/dist/ui/components/model-selection.d.ts +11 -0
- package/dist/ui/components/model-selection.js +9 -0
- package/dist/ui/components/model-selection.js.map +1 -0
- package/dist/ui/shared/max-sized-box.d.ts +8 -0
- package/dist/ui/shared/max-sized-box.js +6 -0
- package/dist/ui/shared/max-sized-box.js.map +1 -0
- package/dist/ui/utils/code-colorizer.d.ts +2 -0
- package/dist/ui/utils/code-colorizer.js +7 -0
- package/dist/ui/utils/code-colorizer.js.map +1 -0
- package/dist/ui/utils/colors.d.ts +14 -0
- package/dist/ui/utils/colors.js +15 -0
- package/dist/ui/utils/colors.js.map +1 -0
- package/dist/ui/utils/markdown-renderer.d.ts +3 -0
- package/dist/ui/utils/markdown-renderer.js +23 -0
- package/dist/ui/utils/markdown-renderer.js.map +1 -0
- package/dist/utils/confirmation-service.d.ts +33 -0
- package/dist/utils/confirmation-service.js +110 -0
- package/dist/utils/confirmation-service.js.map +1 -0
- package/dist/utils/custom-instructions.d.ts +1 -0
- package/dist/utils/custom-instructions.js +23 -0
- package/dist/utils/custom-instructions.js.map +1 -0
- package/dist/utils/model-config.d.ts +28 -0
- package/dist/utils/model-config.js +42 -0
- package/dist/utils/model-config.js.map +1 -0
- package/dist/utils/settings-manager.d.ts +99 -0
- package/dist/utils/settings-manager.js +286 -0
- package/dist/utils/settings-manager.js.map +1 -0
- package/dist/utils/settings.d.ts +1 -0
- package/dist/utils/settings.js +4 -0
- package/dist/utils/settings.js.map +1 -0
- package/dist/utils/text-utils.d.ts +80 -0
- package/dist/utils/text-utils.js +191 -0
- package/dist/utils/text-utils.js.map +1 -0
- package/dist/utils/token-counter.d.ts +33 -0
- package/dist/utils/token-counter.js +79 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/eslint.config.mjs +33 -0
- package/package.json +87 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { get_encoding, encoding_for_model } from "tiktoken";
|
|
2
|
+
export class TokenCounter {
|
|
3
|
+
encoder;
|
|
4
|
+
constructor(model = "gpt-4") {
|
|
5
|
+
try {
|
|
6
|
+
// Try to get encoding for specific model
|
|
7
|
+
this.encoder = encoding_for_model(model);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
// Fallback to cl100k_base (used by GPT-4 and most modern models)
|
|
11
|
+
this.encoder = get_encoding("cl100k_base");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Count tokens in a string
|
|
16
|
+
*/
|
|
17
|
+
countTokens(text) {
|
|
18
|
+
if (!text) {
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
return this.encoder.encode(text).length;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Count tokens in messages array (for chat completions)
|
|
25
|
+
*/
|
|
26
|
+
countMessageTokens(messages) {
|
|
27
|
+
let totalTokens = 0;
|
|
28
|
+
for (const message of messages) {
|
|
29
|
+
// Every message follows <|start|>{role/name}\n{content}<|end|\>\n
|
|
30
|
+
totalTokens += 3; // Base tokens per message
|
|
31
|
+
if (message.content && typeof message.content === "string") {
|
|
32
|
+
totalTokens += this.countTokens(message.content);
|
|
33
|
+
}
|
|
34
|
+
if (message.role) {
|
|
35
|
+
totalTokens += this.countTokens(message.role);
|
|
36
|
+
}
|
|
37
|
+
// Add extra tokens for tool calls if present
|
|
38
|
+
if (message.tool_calls) {
|
|
39
|
+
totalTokens += this.countTokens(JSON.stringify(message.tool_calls));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
totalTokens += 3; // Every reply is primed with <|start|>assistant<|message|>
|
|
43
|
+
return totalTokens;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Estimate tokens for streaming content
|
|
47
|
+
* This is an approximation since we don't have the full response yet
|
|
48
|
+
*/
|
|
49
|
+
estimateStreamingTokens(accumulatedContent) {
|
|
50
|
+
return this.countTokens(accumulatedContent);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Clean up resources
|
|
54
|
+
*/
|
|
55
|
+
dispose() {
|
|
56
|
+
this.encoder.free();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Format token count for display (e.g., 1.2k for 1200)
|
|
61
|
+
*/
|
|
62
|
+
export function formatTokenCount(count) {
|
|
63
|
+
if (count <= 999) {
|
|
64
|
+
return count.toString();
|
|
65
|
+
}
|
|
66
|
+
if (count < 1_000_000) {
|
|
67
|
+
const k = count / 1000;
|
|
68
|
+
return k % 1 === 0 ? `${k}k` : `${k.toFixed(1)}k`;
|
|
69
|
+
}
|
|
70
|
+
const m = count / 1_000_000;
|
|
71
|
+
return m % 1 === 0 ? `${m}m` : `${m.toFixed(1)}m`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a token counter instance
|
|
75
|
+
*/
|
|
76
|
+
export function createTokenCounter(model) {
|
|
77
|
+
return new TokenCounter(model);
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=token-counter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-counter.js","sourceRoot":"","sources":["../../src/utils/token-counter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAY,MAAM,UAAU,C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AAC;IAED;;;OAGG;IACH,uBAAuB,CAAC,kBAA0B;QAChD,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,GAAG,KAAK,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import typescriptEslint from "typescript-eslint";
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
files: ["**/*.ts"],
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
plugins: {
|
|
9
|
+
"@typescript-eslint": typescriptEslint.plugin,
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
languageOptions: {
|
|
13
|
+
parser: typescriptEslint.parser,
|
|
14
|
+
ecmaVersion: 2022,
|
|
15
|
+
sourceType: "module",
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
rules: {
|
|
19
|
+
"@typescript-eslint/naming-convention": [
|
|
20
|
+
"warn",
|
|
21
|
+
{
|
|
22
|
+
selector: "import",
|
|
23
|
+
format: ["camelCase", "PascalCase"],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
curly: "warn",
|
|
28
|
+
eqeqeq: "warn",
|
|
29
|
+
"no-throw-literal": "warn",
|
|
30
|
+
semi: "warn",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@involvex/super-agent-cli",
|
|
3
|
+
"version": "0.0.39",
|
|
4
|
+
"description": "An open-source AI agent that brings the power of Super Agent directly into your terminal.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"agent",
|
|
8
|
+
"text-editor",
|
|
9
|
+
"ai"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/involvex/super-agent-cli.git"
|
|
14
|
+
},
|
|
15
|
+
"funding": "https://github.com/sponsors/involvex",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "InvolveX",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"bin": {
|
|
27
|
+
"super-agent": "dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"prebuild": "bun run format && bun run lint:fix && bun run typecheck",
|
|
31
|
+
"build": "bun build src/index.ts --outdir ./dist --target node --packages external --format esm",
|
|
32
|
+
"build:bun": "bun build src/index.ts --outdir ./dist --target node --packages external --format esm",
|
|
33
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
34
|
+
"dev": "bun run --watch src/index.ts",
|
|
35
|
+
"dev:node": "tsx src/index.ts",
|
|
36
|
+
"format": "prettier --write .",
|
|
37
|
+
"format:check": "prettier --check .",
|
|
38
|
+
"install:bun": "bun install",
|
|
39
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
40
|
+
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
|
41
|
+
"start": "node dist/index.js",
|
|
42
|
+
"start:bun": "bun run dist/index.js",
|
|
43
|
+
"typecheck": "tsc --noEmit"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@google/generative-ai": "^0.24.1",
|
|
47
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
48
|
+
"axios": "^1.13.4",
|
|
49
|
+
"cfonts": "^3.3.1",
|
|
50
|
+
"chalk": "^5.6.2",
|
|
51
|
+
"commander": "^14.0.2",
|
|
52
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
53
|
+
"dotenv": "^17.2.3",
|
|
54
|
+
"enquirer": "^2.4.1",
|
|
55
|
+
"fs-extra": "^11.3.3",
|
|
56
|
+
"ink": "^6.6.0",
|
|
57
|
+
"marked": "^17.0.1",
|
|
58
|
+
"marked-terminal": "^7.3.0",
|
|
59
|
+
"mime": "^4.1.0",
|
|
60
|
+
"openai": "^6.17.0",
|
|
61
|
+
"react": "^19.2.4",
|
|
62
|
+
"ripgrep-node": "^1.0.0",
|
|
63
|
+
"tiktoken": "^1.0.22"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/fs-extra": "^11.0.4",
|
|
67
|
+
"@types/node": "^25.1.0",
|
|
68
|
+
"@types/react": "18.3.3",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
70
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
71
|
+
"eslint": "^9.39.2",
|
|
72
|
+
"prettier": "^3.8.1",
|
|
73
|
+
"prettier-plugin-organize-imports": "^4.3.0",
|
|
74
|
+
"prettier-plugin-packagejson": "^3.0.0",
|
|
75
|
+
"prettier-plugin-sort-imports": "^1.8.9",
|
|
76
|
+
"tsx": "^4.21.0",
|
|
77
|
+
"typescript": "^5.9.3",
|
|
78
|
+
"typescript-eslint": "^8.54.0"
|
|
79
|
+
},
|
|
80
|
+
"engines": {
|
|
81
|
+
"node": ">=18.0.0"
|
|
82
|
+
},
|
|
83
|
+
"preferGlobal": true,
|
|
84
|
+
"sponsor": {
|
|
85
|
+
"url": "https://github.com/sponsors/involvex"
|
|
86
|
+
}
|
|
87
|
+
}
|