@defai.digital/ax-cli 0.1.1 → 0.2.2
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 +24 -16
- package/automatosx.config.json +333 -0
- package/dist/agent/grok-agent.d.ts +7 -1
- package/dist/agent/grok-agent.js +22 -9
- package/dist/agent/grok-agent.js.map +1 -1
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/constants.d.ts +67 -1
- package/dist/constants.js +57 -1
- package/dist/constants.js.map +1 -1
- package/dist/grok/client.d.ts +133 -2
- package/dist/grok/client.js +173 -16
- package/dist/grok/client.js.map +1 -1
- package/dist/grok/types.d.ts +291 -0
- package/dist/grok/types.js +127 -0
- package/dist/grok/types.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/config.d.ts +1 -1
- package/dist/mcp/config.js +28 -5
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/transports.d.ts +6 -3
- package/dist/mcp/transports.js +18 -12
- package/dist/mcp/transports.js.map +1 -1
- package/dist/schemas/api-schemas.d.ts +569 -0
- package/dist/schemas/api-schemas.js +117 -0
- package/dist/schemas/api-schemas.js.map +1 -0
- package/dist/schemas/confirmation-schemas.d.ts +60 -0
- package/dist/schemas/confirmation-schemas.js +41 -0
- package/dist/schemas/confirmation-schemas.js.map +1 -0
- package/dist/schemas/index-unified.d.ts +12 -0
- package/dist/schemas/index-unified.js +17 -0
- package/dist/schemas/index-unified.js.map +1 -0
- package/dist/schemas/index.d.ts +8 -8
- package/dist/schemas/index.js +5 -4
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/mcp-schemas.d.ts +171 -0
- package/dist/schemas/mcp-schemas.js +77 -0
- package/dist/schemas/mcp-schemas.js.map +1 -0
- package/dist/schemas/tool-schemas.d.ts +2 -2
- package/dist/tools/search.js +2 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/text-editor.js +6 -0
- package/dist/tools/text-editor.js.map +1 -1
- package/dist/ui/components/api-key-input.js +2 -2
- package/dist/ui/components/api-key-input.js.map +1 -1
- package/dist/ui/components/chat-history.js +2 -0
- package/dist/ui/components/chat-history.js.map +1 -1
- package/dist/ui/components/chat-interface.js +31 -1
- package/dist/ui/components/chat-interface.js.map +1 -1
- package/dist/ui/components/mcp-status.js +1 -1
- package/dist/ui/components/mcp-status.js.map +1 -1
- package/dist/ui/components/reasoning-display.d.ts +109 -0
- package/dist/ui/components/reasoning-display.js +110 -0
- package/dist/ui/components/reasoning-display.js.map +1 -0
- package/dist/ui/shared/max-sized-box.js +1 -1
- package/dist/ui/shared/max-sized-box.js.map +1 -1
- package/dist/utils/cache.d.ts +75 -0
- package/dist/utils/cache.js +137 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/confirmation-service.js +2 -2
- package/dist/utils/confirmation-service.js.map +1 -1
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +23 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/path-validator.d.ts +30 -0
- package/dist/utils/path-validator.js +67 -0
- package/dist/utils/path-validator.js.map +1 -0
- package/dist/utils/performance.d.ts +72 -0
- package/dist/utils/performance.js +114 -0
- package/dist/utils/performance.js.map +1 -0
- package/dist/utils/settings-manager.js +2 -2
- package/dist/utils/settings-manager.js.map +1 -1
- package/dist/utils/token-counter.d.ts +8 -1
- package/dist/utils/token-counter.js +11 -10
- package/dist/utils/token-counter.js.map +1 -1
- package/eslint.config.js +60 -0
- package/package.json +6 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { get_encoding, encoding_for_model } from 'tiktoken';
|
|
2
2
|
import { TOKEN_CONFIG } from '../constants.js';
|
|
3
|
+
import { LRUCache } from './cache.js';
|
|
3
4
|
export class TokenCounter {
|
|
4
5
|
encoder;
|
|
5
|
-
cache
|
|
6
|
-
static MAX_CACHE_SIZE = 1000;
|
|
6
|
+
cache;
|
|
7
7
|
constructor(model = TOKEN_CONFIG.DEFAULT_MODEL) {
|
|
8
8
|
try {
|
|
9
9
|
// Try to get encoding for specific model
|
|
@@ -13,6 +13,8 @@ export class TokenCounter {
|
|
|
13
13
|
// Fallback to cl100k_base (used by GPT-4 and most modern models)
|
|
14
14
|
this.encoder = get_encoding(TOKEN_CONFIG.DEFAULT_ENCODING);
|
|
15
15
|
}
|
|
16
|
+
// Initialize cache with configured limit
|
|
17
|
+
this.cache = new LRUCache({ maxSize: TOKEN_CONFIG.CACHE_MAX_SIZE });
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Count tokens in a string with LRU caching for performance
|
|
@@ -27,14 +29,7 @@ export class TokenCounter {
|
|
|
27
29
|
}
|
|
28
30
|
// Count tokens
|
|
29
31
|
const count = this.encoder.encode(text).length;
|
|
30
|
-
// Add to cache
|
|
31
|
-
if (this.cache.size >= TokenCounter.MAX_CACHE_SIZE) {
|
|
32
|
-
// Remove oldest entry (first one)
|
|
33
|
-
const firstKey = this.cache.keys().next().value;
|
|
34
|
-
if (firstKey) {
|
|
35
|
-
this.cache.delete(firstKey);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
32
|
+
// Add to cache (LRU eviction handled automatically)
|
|
38
33
|
this.cache.set(text, count);
|
|
39
34
|
return count;
|
|
40
35
|
}
|
|
@@ -74,6 +69,12 @@ export class TokenCounter {
|
|
|
74
69
|
this.cache.clear();
|
|
75
70
|
this.encoder.free();
|
|
76
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Get cache statistics
|
|
74
|
+
*/
|
|
75
|
+
getCacheStats() {
|
|
76
|
+
return this.cache.stats();
|
|
77
|
+
}
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
80
|
* Format token count for display (e.g., 1.2k for 1200)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-counter.js","sourceRoot":"","sources":["../../src/utils/token-counter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAY,M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AC1B,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"}
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
2
|
+
import tsparser from '@typescript-eslint/parser';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
ignores: [
|
|
7
|
+
'dist/**',
|
|
8
|
+
'node_modules/**',
|
|
9
|
+
'coverage/**',
|
|
10
|
+
'*.config.js',
|
|
11
|
+
'*.config.ts',
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
files: ['src/**/*.ts', 'src/**/*.tsx'],
|
|
16
|
+
languageOptions: {
|
|
17
|
+
parser: tsparser,
|
|
18
|
+
parserOptions: {
|
|
19
|
+
ecmaVersion: 'latest',
|
|
20
|
+
sourceType: 'module',
|
|
21
|
+
project: './tsconfig.json',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
plugins: {
|
|
25
|
+
'@typescript-eslint': tseslint,
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'@typescript-eslint/no-unused-vars': ['warn', {
|
|
29
|
+
argsIgnorePattern: '^_',
|
|
30
|
+
varsIgnorePattern: '^_',
|
|
31
|
+
}],
|
|
32
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
33
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
34
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
35
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
36
|
+
'no-console': 'off',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
files: ['tests/**/*.ts', 'tests/**/*.tsx'],
|
|
41
|
+
languageOptions: {
|
|
42
|
+
parser: tsparser,
|
|
43
|
+
parserOptions: {
|
|
44
|
+
ecmaVersion: 'latest',
|
|
45
|
+
sourceType: 'module',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
plugins: {
|
|
49
|
+
'@typescript-eslint': tseslint,
|
|
50
|
+
},
|
|
51
|
+
rules: {
|
|
52
|
+
'@typescript-eslint/no-unused-vars': ['warn', {
|
|
53
|
+
argsIgnorePattern: '^_',
|
|
54
|
+
varsIgnorePattern: '^_',
|
|
55
|
+
}],
|
|
56
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
57
|
+
'no-console': 'off',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
];
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defai.digital/ax-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "Enterprise-Class AI Command Line Interface - Primary support for GLM (General Language Model) with multi-provider AI orchestration powered by AutomatosX.",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"workspaces": [
|
|
7
|
+
"packages/*"
|
|
8
|
+
],
|
|
6
9
|
"main": "dist/index.js",
|
|
7
10
|
"exports": {
|
|
8
11
|
".": {
|
|
@@ -39,6 +42,7 @@
|
|
|
39
42
|
"author": "Your Name",
|
|
40
43
|
"license": "MIT",
|
|
41
44
|
"dependencies": {
|
|
45
|
+
"@ax-cli/schemas": "workspace:*",
|
|
42
46
|
"@modelcontextprotocol/sdk": "^1.17.0",
|
|
43
47
|
"axios": "^1.7.0",
|
|
44
48
|
"cfonts": "^3.3.0",
|