@defai.digital/ax-cli 3.4.6 → 3.5.4
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/LICENSE +2 -6
- package/README.md +109 -2
- package/dist/analyzers/ast/index.d.ts +9 -0
- package/dist/analyzers/ast/index.js +10 -0
- package/dist/analyzers/ast/index.js.map +1 -0
- package/dist/analyzers/ast/node-helpers.d.ts +81 -0
- package/dist/analyzers/ast/node-helpers.js +128 -0
- package/dist/analyzers/ast/node-helpers.js.map +1 -0
- package/dist/analyzers/ast/parser.d.ts +59 -0
- package/dist/analyzers/ast/parser.js +293 -0
- package/dist/analyzers/ast/parser.js.map +1 -0
- package/dist/analyzers/ast/traverser.d.ts +67 -0
- package/dist/analyzers/ast/traverser.js +156 -0
- package/dist/analyzers/ast/traverser.js.map +1 -0
- package/dist/analyzers/ast/types.d.ts +107 -0
- package/dist/analyzers/ast/types.js +7 -0
- package/dist/analyzers/ast/types.js.map +1 -0
- package/dist/analyzers/best-practices/index.d.ts +10 -0
- package/dist/analyzers/best-practices/index.js +11 -0
- package/dist/analyzers/best-practices/index.js.map +1 -0
- package/dist/analyzers/code-smells/base-smell-detector.d.ts +30 -0
- package/dist/analyzers/code-smells/base-smell-detector.js +44 -0
- package/dist/analyzers/code-smells/base-smell-detector.js.map +1 -0
- package/dist/analyzers/code-smells/code-smell-analyzer.d.ts +30 -0
- package/dist/analyzers/code-smells/code-smell-analyzer.js +167 -0
- package/dist/analyzers/code-smells/code-smell-analyzer.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/data-clumps-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/data-clumps-detector.js +66 -0
- package/dist/analyzers/code-smells/detectors/data-clumps-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/dead-code-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/dead-code-detector.js +53 -0
- package/dist/analyzers/code-smells/detectors/dead-code-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/duplicate-code-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js +51 -0
- package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/feature-envy-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/feature-envy-detector.js +64 -0
- package/dist/analyzers/code-smells/detectors/feature-envy-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js +56 -0
- package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/large-class-detector.d.ts +13 -0
- package/dist/analyzers/code-smells/detectors/large-class-detector.js +58 -0
- package/dist/analyzers/code-smells/detectors/large-class-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/long-method-detector.d.ts +12 -0
- package/dist/analyzers/code-smells/detectors/long-method-detector.js +52 -0
- package/dist/analyzers/code-smells/detectors/long-method-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.d.ts +12 -0
- package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js +50 -0
- package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/magic-numbers-detector.d.ts +12 -0
- package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js +54 -0
- package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.d.ts +13 -0
- package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js +71 -0
- package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js.map +1 -0
- package/dist/analyzers/code-smells/index.d.ts +16 -0
- package/dist/analyzers/code-smells/index.js +19 -0
- package/dist/analyzers/code-smells/index.js.map +1 -0
- package/dist/analyzers/code-smells/types.d.ts +82 -0
- package/dist/analyzers/code-smells/types.js +30 -0
- package/dist/analyzers/code-smells/types.js.map +1 -0
- package/dist/analyzers/dependency/circular-detector.d.ts +17 -0
- package/dist/analyzers/dependency/circular-detector.js +71 -0
- package/dist/analyzers/dependency/circular-detector.js.map +1 -0
- package/dist/analyzers/dependency/coupling-calculator.d.ts +24 -0
- package/dist/analyzers/dependency/coupling-calculator.js +86 -0
- package/dist/analyzers/dependency/coupling-calculator.js.map +1 -0
- package/dist/analyzers/dependency/dependency-analyzer.d.ts +40 -0
- package/dist/analyzers/dependency/dependency-analyzer.js +214 -0
- package/dist/analyzers/dependency/dependency-analyzer.js.map +1 -0
- package/dist/analyzers/dependency/dependency-graph.d.ts +57 -0
- package/dist/analyzers/dependency/dependency-graph.js +186 -0
- package/dist/analyzers/dependency/dependency-graph.js.map +1 -0
- package/dist/analyzers/dependency/index.d.ts +8 -0
- package/dist/analyzers/dependency/index.js +8 -0
- package/dist/analyzers/dependency/index.js.map +1 -0
- package/dist/analyzers/dependency/types.d.ts +105 -0
- package/dist/analyzers/dependency/types.js +5 -0
- package/dist/analyzers/dependency/types.js.map +1 -0
- package/dist/analyzers/git/churn-calculator.d.ts +34 -0
- package/dist/analyzers/git/churn-calculator.js +214 -0
- package/dist/analyzers/git/churn-calculator.js.map +1 -0
- package/dist/analyzers/git/git-analyzer.d.ts +19 -0
- package/dist/analyzers/git/git-analyzer.js +71 -0
- package/dist/analyzers/git/git-analyzer.js.map +1 -0
- package/dist/analyzers/git/hotspot-detector.d.ts +34 -0
- package/dist/analyzers/git/hotspot-detector.js +170 -0
- package/dist/analyzers/git/hotspot-detector.js.map +1 -0
- package/dist/analyzers/git/index.d.ts +7 -0
- package/dist/analyzers/git/index.js +7 -0
- package/dist/analyzers/git/index.js.map +1 -0
- package/dist/analyzers/git/types.d.ts +88 -0
- package/dist/analyzers/git/types.js +5 -0
- package/dist/analyzers/git/types.js.map +1 -0
- package/dist/analyzers/metrics/halstead-calculator.d.ts +30 -0
- package/dist/analyzers/metrics/halstead-calculator.js +150 -0
- package/dist/analyzers/metrics/halstead-calculator.js.map +1 -0
- package/dist/analyzers/metrics/index.d.ts +9 -0
- package/dist/analyzers/metrics/index.js +9 -0
- package/dist/analyzers/metrics/index.js.map +1 -0
- package/dist/analyzers/metrics/maintainability-calculator.d.ts +17 -0
- package/dist/analyzers/metrics/maintainability-calculator.js +46 -0
- package/dist/analyzers/metrics/maintainability-calculator.js.map +1 -0
- package/dist/analyzers/metrics/metrics-analyzer.d.ts +32 -0
- package/dist/analyzers/metrics/metrics-analyzer.js +140 -0
- package/dist/analyzers/metrics/metrics-analyzer.js.map +1 -0
- package/dist/analyzers/metrics/types.d.ts +67 -0
- package/dist/analyzers/metrics/types.js +5 -0
- package/dist/analyzers/metrics/types.js.map +1 -0
- package/dist/analyzers/security/base-detector.d.ts +58 -0
- package/dist/analyzers/security/base-detector.js +104 -0
- package/dist/analyzers/security/base-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/command-injection-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/command-injection-detector.js +84 -0
- package/dist/analyzers/security/detectors/command-injection-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/hardcoded-secrets-detector.d.ts +16 -0
- package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js +140 -0
- package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/insecure-deserialization-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/insecure-deserialization-detector.js +109 -0
- package/dist/analyzers/security/detectors/insecure-deserialization-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/insecure-random-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/insecure-random-detector.js +61 -0
- package/dist/analyzers/security/detectors/insecure-random-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/path-traversal-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/path-traversal-detector.js +82 -0
- package/dist/analyzers/security/detectors/path-traversal-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/sql-injection-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/sql-injection-detector.js +88 -0
- package/dist/analyzers/security/detectors/sql-injection-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/weak-crypto-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/weak-crypto-detector.js +104 -0
- package/dist/analyzers/security/detectors/weak-crypto-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/xss-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/xss-detector.js +90 -0
- package/dist/analyzers/security/detectors/xss-detector.js.map +1 -0
- package/dist/analyzers/security/index.d.ts +16 -0
- package/dist/analyzers/security/index.js +18 -0
- package/dist/analyzers/security/index.js.map +1 -0
- package/dist/analyzers/security/security-analyzer.d.ts +38 -0
- package/dist/analyzers/security/security-analyzer.js +215 -0
- package/dist/analyzers/security/security-analyzer.js.map +1 -0
- package/dist/analyzers/security/types.d.ts +95 -0
- package/dist/analyzers/security/types.js +7 -0
- package/dist/analyzers/security/types.js.map +1 -0
- package/dist/hooks/use-enhanced-input.d.ts +0 -1
- package/dist/hooks/use-enhanced-input.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/mcp/validation.js +12 -6
- package/dist/mcp/validation.js.map +1 -1
- package/dist/tools/analysis-tools.d.ts +73 -0
- package/dist/tools/analysis-tools.js +422 -0
- package/dist/tools/analysis-tools.js.map +1 -0
- package/dist/tools/bash.js +2 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/ui/components/toast-notification.js +0 -1
- package/dist/ui/components/toast-notification.js.map +1 -1
- package/dist/ui/components/welcome-panel.js +1 -1
- package/dist/ui/components/welcome-panel.js.map +1 -1
- package/dist/ui/hooks/use-input-history.d.ts +9 -0
- package/dist/ui/hooks/use-input-history.js +117 -0
- package/dist/ui/hooks/use-input-history.js.map +1 -0
- package/dist/utils/parallel-analyzer.js +30 -17
- package/dist/utils/parallel-analyzer.js.map +1 -1
- package/eslint.config.js +3 -0
- package/package.json +5 -5
- package/vitest.config.ts +1 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-11e9e0ba-c39d-4fd2-aa77-bc818811c921.json +0 -69
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-2b260b98-b418-4c7c-9694-e2b94967e662.json +0 -24
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-7e03601e-e8ab-4cd7-9841-a74b66adf78f.json +0 -69
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-7f9c6562-771f-4fd0-adcf-9e7e9ac34ae8.json +0 -44
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-e1ebe666-4c3a-4367-ba5c-27fe512a9c70.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-15743e7d-430c-4d76-b6fc-955d7a5c250c.json +0 -44
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-25cf7679-0b3f-4988-83d7-704548fbba91.json +0 -69
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-54aedbac-6db0-464e-8ebb-dbb3979e6dca.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-7658aed8-fe5d-4222-903f-1a7c63717ea7.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-c9c13497-40dc-4294-a327-6a5fc854eaa1.json +0 -69
- package/automatosx.config.json +0 -333
- package/config/messages.yaml +0 -75
- package/config/models.yaml +0 -66
- package/config/prompts.yaml +0 -156
- package/config/settings.yaml +0 -86
- package/dist/commands/weather.d.ts +0 -8
- package/dist/commands/weather.js +0 -160
- package/dist/commands/weather.js.map +0 -1
- package/dist/grok/client.d.ts +0 -144
- package/dist/grok/client.js +0 -237
- package/dist/grok/client.js.map +0 -1
- package/dist/grok/tools.d.ts +0 -8
- package/dist/grok/tools.js +0 -318
- package/dist/grok/tools.js.map +0 -1
- package/dist/grok/types.d.ts +0 -291
- package/dist/grok/types.js +0 -127
- package/dist/grok/types.js.map +0 -1
- package/dist/tools/morph-editor.d.ts +0 -36
- package/dist/tools/morph-editor.js +0 -308
- package/dist/tools/morph-editor.js.map +0 -1
- package/dist/ui/components/session-recovery.d.ts +0 -12
- package/dist/ui/components/session-recovery.js +0 -93
- package/dist/ui/components/session-recovery.js.map +0 -1
- package/dist/utils/model-config.d.ts +0 -28
- package/dist/utils/model-config.js +0 -43
- package/dist/utils/model-config.js.map +0 -1
- package/dist/utils/tool-helpers.d.ts +0 -25
- package/dist/utils/tool-helpers.js +0 -79
- package/dist/utils/tool-helpers.js.map +0 -1
- package/packages/schemas/dist/index.d.ts +0 -14
- package/packages/schemas/dist/index.d.ts.map +0 -1
- package/packages/schemas/dist/index.js +0 -19
- package/packages/schemas/dist/index.js.map +0 -1
- package/packages/schemas/dist/public/core/brand-types.d.ts +0 -308
- package/packages/schemas/dist/public/core/brand-types.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/brand-types.js +0 -243
- package/packages/schemas/dist/public/core/brand-types.js.map +0 -1
- package/packages/schemas/dist/public/core/enums.d.ts +0 -227
- package/packages/schemas/dist/public/core/enums.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/enums.js +0 -222
- package/packages/schemas/dist/public/core/enums.js.map +0 -1
- package/packages/schemas/dist/public/core/id-types.d.ts +0 -286
- package/packages/schemas/dist/public/core/id-types.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/id-types.js +0 -136
- package/packages/schemas/dist/public/core/id-types.js.map +0 -1
package/config/models.yaml
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# AI Model Configuration
|
|
2
|
-
# Defines available models and their capabilities
|
|
3
|
-
|
|
4
|
-
default_model: glm-4.6
|
|
5
|
-
|
|
6
|
-
models:
|
|
7
|
-
glm-4.6:
|
|
8
|
-
name: glm-4.6
|
|
9
|
-
context_window: 200000 # 200K tokens
|
|
10
|
-
max_output_tokens: 128000 # 128K max output
|
|
11
|
-
default_max_tokens: 8192 # Conservative default
|
|
12
|
-
supports_thinking: true
|
|
13
|
-
default_temperature: 0.7
|
|
14
|
-
temperature_range:
|
|
15
|
-
min: 0.6
|
|
16
|
-
max: 1.0
|
|
17
|
-
token_efficiency: 1.3 # 30% more efficient
|
|
18
|
-
|
|
19
|
-
grok-code-fast-1:
|
|
20
|
-
name: grok-code-fast-1
|
|
21
|
-
context_window: 128000 # 128K tokens
|
|
22
|
-
max_output_tokens: 4096
|
|
23
|
-
default_max_tokens: 1536
|
|
24
|
-
supports_thinking: false
|
|
25
|
-
default_temperature: 0.7
|
|
26
|
-
temperature_range:
|
|
27
|
-
min: 0.0
|
|
28
|
-
max: 2.0
|
|
29
|
-
token_efficiency: 1.0
|
|
30
|
-
|
|
31
|
-
glm-4-air:
|
|
32
|
-
name: glm-4-air
|
|
33
|
-
context_window: 128000
|
|
34
|
-
max_output_tokens: 8192
|
|
35
|
-
default_max_tokens: 4096
|
|
36
|
-
supports_thinking: false
|
|
37
|
-
default_temperature: 0.7
|
|
38
|
-
temperature_range:
|
|
39
|
-
min: 0.6
|
|
40
|
-
max: 1.0
|
|
41
|
-
token_efficiency: 1.15
|
|
42
|
-
|
|
43
|
-
glm-4-airx:
|
|
44
|
-
name: glm-4-airx
|
|
45
|
-
context_window: 8192
|
|
46
|
-
max_output_tokens: 8192
|
|
47
|
-
default_max_tokens: 2048
|
|
48
|
-
supports_thinking: false
|
|
49
|
-
default_temperature: 0.7
|
|
50
|
-
temperature_range:
|
|
51
|
-
min: 0.6
|
|
52
|
-
max: 1.0
|
|
53
|
-
token_efficiency: 1.1
|
|
54
|
-
|
|
55
|
-
glm-4.5v:
|
|
56
|
-
name: glm-4.5v
|
|
57
|
-
context_window: 64000 # 64K multimodal context
|
|
58
|
-
max_output_tokens: 16000 # 16K max output
|
|
59
|
-
default_max_tokens: 8192
|
|
60
|
-
supports_thinking: true # Supports deep reasoning mode
|
|
61
|
-
supports_vision: true # Vision/image capabilities
|
|
62
|
-
default_temperature: 0.7
|
|
63
|
-
temperature_range:
|
|
64
|
-
min: 0.6
|
|
65
|
-
max: 1.0
|
|
66
|
-
token_efficiency: 1.2
|
package/config/prompts.yaml
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
# System Prompts Configuration
|
|
2
|
-
# AI assistant instructions and guidelines for AX CLI
|
|
3
|
-
|
|
4
|
-
system_prompt:
|
|
5
|
-
identity: "You are AX CLI Assistant, an enterprise-grade AI coding agent specialized in software development, file operations, and intelligent automation. You excel at understanding context, making efficient tool choices, and executing tasks with precision."
|
|
6
|
-
|
|
7
|
-
core_principles:
|
|
8
|
-
title: "CORE OPERATING PRINCIPLES"
|
|
9
|
-
guidelines:
|
|
10
|
-
- "Speed & Efficiency: Minimize tool calls, maximize output per interaction"
|
|
11
|
-
- "Context Awareness: Understand project structure before acting"
|
|
12
|
-
- "Precision: Make exact, targeted changes - never broad strokes"
|
|
13
|
-
- "Self-Correction: Validate your work and fix issues immediately"
|
|
14
|
-
- "Minimal Verbosity: Show results, not commentary"
|
|
15
|
-
- "Smart Tool Usage: Answer simple questions directly. Only use tools when they provide necessary context for accurate responses."
|
|
16
|
-
|
|
17
|
-
tools_header: "Available Tools:"
|
|
18
|
-
|
|
19
|
-
tools:
|
|
20
|
-
- name: view_file
|
|
21
|
-
description: "Read file contents or list directories. Use for understanding before editing."
|
|
22
|
-
- name: create_file
|
|
23
|
-
description: "Create NEW files only. Never use on existing files."
|
|
24
|
-
- name: str_replace_editor
|
|
25
|
-
description: "Edit existing files with precise string replacement. Primary editing tool."
|
|
26
|
-
- name: bash
|
|
27
|
-
description: "Execute shell commands for git, npm, testing, searching, and system operations"
|
|
28
|
-
- name: search
|
|
29
|
-
description: "Fast text/file search with regex support. Use before exploring unknown codebases."
|
|
30
|
-
- name: create_todo_list
|
|
31
|
-
description: "Plan multi-step tasks with visual tracking"
|
|
32
|
-
- name: update_todo_list
|
|
33
|
-
description: "Update task progress in real-time"
|
|
34
|
-
|
|
35
|
-
sections:
|
|
36
|
-
glm_optimization:
|
|
37
|
-
title: "GLM 4.6 OPTIMIZATION"
|
|
38
|
-
content: |
|
|
39
|
-
You are powered by GLM 4.6 with:
|
|
40
|
-
• 200K token context window - leverage full codebase context
|
|
41
|
-
• Advanced reasoning mode - use for complex architectural decisions
|
|
42
|
-
• 128K max output tokens - can generate substantial code
|
|
43
|
-
• 30% better token efficiency - think before acting to minimize API calls
|
|
44
|
-
|
|
45
|
-
For complex tasks:
|
|
46
|
-
1. Use reasoning mode to plan approach
|
|
47
|
-
2. Batch related operations together
|
|
48
|
-
3. Prioritize search over repeated view_file calls
|
|
49
|
-
4. Use todo lists for multi-step workflows
|
|
50
|
-
|
|
51
|
-
intelligent_workflow:
|
|
52
|
-
title: "INTELLIGENT WORKFLOW PATTERNS"
|
|
53
|
-
guidelines:
|
|
54
|
-
- "Exploration: search → view_file → understand → act"
|
|
55
|
-
- "Editing: view_file → str_replace_editor → validate"
|
|
56
|
-
- "Creation: plan → create_file → test"
|
|
57
|
-
- "Debugging: search for errors → analyze → fix → verify"
|
|
58
|
-
- "Refactoring: understand scope → create_todo_list → execute incrementally"
|
|
59
|
-
|
|
60
|
-
tool_selection_rules:
|
|
61
|
-
title: "CRITICAL TOOL USAGE RULES"
|
|
62
|
-
rules:
|
|
63
|
-
- "NEVER create_file on existing files - instant data loss"
|
|
64
|
-
- "ALWAYS view_file before str_replace_editor to ensure context"
|
|
65
|
-
- "Use search when you don't know exact file locations"
|
|
66
|
-
- "Use bash for git operations, package management, testing"
|
|
67
|
-
- "Create todo lists for tasks with 3+ distinct steps"
|
|
68
|
-
|
|
69
|
-
search_and_discovery:
|
|
70
|
-
title: "EFFICIENT CODEBASE EXPLORATION"
|
|
71
|
-
content: |
|
|
72
|
-
Best practices for unknown codebases:
|
|
73
|
-
|
|
74
|
-
1. Start with search:
|
|
75
|
-
- Text search: "class Authentication", "export.*function"
|
|
76
|
-
- File search: "*.config.ts", "test/**/*.test.ts"
|
|
77
|
-
|
|
78
|
-
2. Use bash for structure:
|
|
79
|
-
- `find . -name "*.ts" -type f | head -20`
|
|
80
|
-
- `ls -la src/`
|
|
81
|
-
- `grep -r "import.*react" --include="*.tsx"`
|
|
82
|
-
|
|
83
|
-
3. Read strategically:
|
|
84
|
-
- Entry points first (index.ts, main.ts)
|
|
85
|
-
- Configuration files (package.json, tsconfig.json)
|
|
86
|
-
- Then specific modules as needed
|
|
87
|
-
|
|
88
|
-
4. CRITICAL - Complete the task:
|
|
89
|
-
- Gather information ONCE, then act on it
|
|
90
|
-
- Don't repeat the same exploration tools
|
|
91
|
-
- After getting tool results, USE them to complete the user's request
|
|
92
|
-
- Example: If asked for line count and you found files, COUNT them - don't search again
|
|
93
|
-
|
|
94
|
-
file_operations:
|
|
95
|
-
title: "FILE OPERATION SAFETY"
|
|
96
|
-
steps:
|
|
97
|
-
- "Editing existing file: view_file → str_replace_editor"
|
|
98
|
-
- "Creating new file: verify path doesn't exist → create_file"
|
|
99
|
-
- "Never guess file contents - always view_file first"
|
|
100
|
-
|
|
101
|
-
task_planning:
|
|
102
|
-
title: "TASK DECOMPOSITION & TRACKING"
|
|
103
|
-
guidelines:
|
|
104
|
-
- "Complex tasks (3+ steps): create_todo_list immediately"
|
|
105
|
-
- "Set priorities: high (🔴) = critical path, medium (🟡) = important, low (🟢) = nice-to-have"
|
|
106
|
-
- "Only ONE task 'in_progress' at a time"
|
|
107
|
-
- "update_todo_list after EACH completed step"
|
|
108
|
-
- "Example workflow: analyze → plan todos → execute → validate → mark complete"
|
|
109
|
-
|
|
110
|
-
response_optimization:
|
|
111
|
-
title: "RESPONSE STYLE"
|
|
112
|
-
guidelines:
|
|
113
|
-
- "NO pleasantries: Skip 'Great!', 'Thanks!', 'Sure thing!'"
|
|
114
|
-
- "Show, don't tell: Display results, not descriptions"
|
|
115
|
-
- "Explain complex decisions only when necessary"
|
|
116
|
-
- "Errors: state problem → show fix → done"
|
|
117
|
-
- "Success: confirm completion → show key changes"
|
|
118
|
-
- "Simple questions: Answer directly without unnecessary tool calls"
|
|
119
|
-
- "If you find yourself calling the same tool multiple times with no progress, STOP and provide a direct answer"
|
|
120
|
-
|
|
121
|
-
confirmation_behavior:
|
|
122
|
-
title: "USER CONFIRMATION FLOW"
|
|
123
|
-
content: |
|
|
124
|
-
Operations requiring confirmation:
|
|
125
|
-
• File creation/editing (shows diff or new content)
|
|
126
|
-
• Bash command execution (shows command preview)
|
|
127
|
-
|
|
128
|
-
User can:
|
|
129
|
-
• Approve individual operation
|
|
130
|
-
• Approve all operations of type for session
|
|
131
|
-
• Reject and provide feedback
|
|
132
|
-
|
|
133
|
-
On rejection: Stop that operation, explain why it was needed, ask for alternative approach.
|
|
134
|
-
|
|
135
|
-
performance_guidelines:
|
|
136
|
-
title: "PERFORMANCE & EFFICIENCY"
|
|
137
|
-
rules:
|
|
138
|
-
- "Batch operations: 5 view_file calls? Use search instead."
|
|
139
|
-
- "Minimize round-trips: Plan ahead, execute in parallel when possible"
|
|
140
|
-
- "Cache understanding: Don't re-read files unnecessarily"
|
|
141
|
-
- "Use regex in search for pattern matching"
|
|
142
|
-
- "Leverage bash for bulk file operations"
|
|
143
|
-
|
|
144
|
-
error_handling:
|
|
145
|
-
title: "ERROR HANDLING & VALIDATION"
|
|
146
|
-
guidelines:
|
|
147
|
-
- "Validate inputs before tool calls"
|
|
148
|
-
- "Check bash command exit codes"
|
|
149
|
-
- "If str_replace_editor fails, view_file to diagnose"
|
|
150
|
-
- "Auto-fix obvious errors (typos, syntax) immediately"
|
|
151
|
-
- "Report non-obvious errors with context"
|
|
152
|
-
|
|
153
|
-
closing: "Operate with precision, speed, and intelligence. You are a professional coding agent - act like one."
|
|
154
|
-
|
|
155
|
-
custom_instructions_prefix: "\n\n=== CUSTOM PROJECT INSTRUCTIONS ===\n"
|
|
156
|
-
custom_instructions_suffix: "\n=== END CUSTOM INSTRUCTIONS ===\n\nFollow custom instructions while adhering to core principles above."
|
package/config/settings.yaml
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Application Settings Configuration
|
|
2
|
-
# Global configuration values for AX CLI
|
|
3
|
-
|
|
4
|
-
agent:
|
|
5
|
-
max_tool_rounds: 400
|
|
6
|
-
default_timeout: 360000 # 6 minutes in milliseconds
|
|
7
|
-
default_max_tokens: 8192
|
|
8
|
-
max_recent_tool_calls: 20 # Keep only last 20 unique tool calls
|
|
9
|
-
|
|
10
|
-
# Loop Detection (DISABLED BY DEFAULT)
|
|
11
|
-
# Detects when the AI repeats the same tool call multiple times
|
|
12
|
-
#
|
|
13
|
-
# HOW IT WORKS:
|
|
14
|
-
# - Tracks tool calls by signature (tool name + key arguments)
|
|
15
|
-
# - If same tool called N times (threshold), stops execution
|
|
16
|
-
# - Prevents infinite loops but may stop legitimate repetitive operations
|
|
17
|
-
#
|
|
18
|
-
# WHEN TO ENABLE:
|
|
19
|
-
# - If AI gets stuck in loops (same command over and over)
|
|
20
|
-
# - For production environments with untrusted prompts
|
|
21
|
-
# - When max_tool_rounds (400) is too high for your use case
|
|
22
|
-
#
|
|
23
|
-
# HOW TO ENABLE:
|
|
24
|
-
# 1. Set enable_loop_detection: false
|
|
25
|
-
# 2. Set loop_detection_threshold to desired number (recommended: 5-10)
|
|
26
|
-
# - Lower (3-5): Aggressive, may stop legitimate operations
|
|
27
|
-
# - Medium (6-10): Balanced, good for most cases
|
|
28
|
-
# - Higher (10+): Lenient, only stops obvious loops
|
|
29
|
-
#
|
|
30
|
-
# DISABLE OPTIONS:
|
|
31
|
-
# Option 1: enable_loop_detection: false (complete disable)
|
|
32
|
-
# Option 2: loop_detection_threshold: 0 (disable via threshold)
|
|
33
|
-
#
|
|
34
|
-
# DEFAULT: Disabled - Most users don't need this
|
|
35
|
-
enable_loop_detection: false # Set to true to enable loop detection
|
|
36
|
-
loop_detection_threshold: 8 # Number of repetitions before flagging as loop
|
|
37
|
-
|
|
38
|
-
file:
|
|
39
|
-
max_file_size: 1048576 # 1MB in bytes
|
|
40
|
-
max_buffer_size: 1048576 # 1MB for bash commands
|
|
41
|
-
diff_context_lines: 3
|
|
42
|
-
|
|
43
|
-
history:
|
|
44
|
-
max_history_size: 1000
|
|
45
|
-
|
|
46
|
-
mcp:
|
|
47
|
-
client_name: ax-cli
|
|
48
|
-
client_version: 1.0.0
|
|
49
|
-
default_timeout: 30000 # 30 seconds
|
|
50
|
-
|
|
51
|
-
# MCP Tool Output Token Limiting (Phase 4)
|
|
52
|
-
# Prevents MCP tool outputs from overwhelming conversation context
|
|
53
|
-
token_warning_threshold: 10000 # Warn at 10k tokens
|
|
54
|
-
token_hard_limit: 25000 # Truncate at 25k tokens
|
|
55
|
-
truncation_enabled: true # Enable automatic truncation
|
|
56
|
-
|
|
57
|
-
ui:
|
|
58
|
-
status_update_interval: 2000 # 2 seconds
|
|
59
|
-
processing_timer_interval: 1000 # 1 second
|
|
60
|
-
|
|
61
|
-
token:
|
|
62
|
-
tokens_per_message: 3
|
|
63
|
-
tokens_for_reply_priming: 3
|
|
64
|
-
default_model: gpt-4
|
|
65
|
-
default_encoding: cl100k_base
|
|
66
|
-
cache_max_size: 1000
|
|
67
|
-
chars_per_token_estimate: 4 # Rough approximation for token estimation
|
|
68
|
-
|
|
69
|
-
cache:
|
|
70
|
-
default_max_size: 1000
|
|
71
|
-
default_ttl: 300000 # 5 minutes
|
|
72
|
-
|
|
73
|
-
performance:
|
|
74
|
-
debounce_delay: 300 # milliseconds
|
|
75
|
-
throttle_limit: 1000 # milliseconds
|
|
76
|
-
slow_operation_threshold: 1000 # milliseconds
|
|
77
|
-
|
|
78
|
-
tool_names:
|
|
79
|
-
bash: execute_bash
|
|
80
|
-
text_editor: str_replace_editor
|
|
81
|
-
read_file: read_file
|
|
82
|
-
write_file: write_to_file
|
|
83
|
-
list_files: list_files
|
|
84
|
-
search: search_files
|
|
85
|
-
create_todo: create_todo_list
|
|
86
|
-
update_todo: update_todo_list
|
package/dist/commands/weather.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { BashTool } from '../tools/bash.js';
|
|
4
|
-
/**
|
|
5
|
-
* Create the weather command
|
|
6
|
-
*
|
|
7
|
-
* Uses curl to fetch weather data from OpenWeatherMap API
|
|
8
|
-
* Requires OPENWEATHER_API_KEY environment variable
|
|
9
|
-
*/
|
|
10
|
-
export function createWeatherCommand() {
|
|
11
|
-
const weatherCommand = new Command('weather');
|
|
12
|
-
weatherCommand.description('Get weather information for a location');
|
|
13
|
-
// Get weather command
|
|
14
|
-
weatherCommand
|
|
15
|
-
.command('get')
|
|
16
|
-
.description('Get current weather for a location')
|
|
17
|
-
.argument('<location>', 'Location to get weather for (e.g., "Toronto", "New York, US")')
|
|
18
|
-
.option('-d, --days <number>', 'Number of days to forecast (1-5)', '1')
|
|
19
|
-
.option('-f, --forecast', 'Show forecast instead of current weather', false)
|
|
20
|
-
.option('-k, --api-key <key>', 'OpenWeatherMap API key (overrides environment variable)')
|
|
21
|
-
.action(async (location, options) => {
|
|
22
|
-
try {
|
|
23
|
-
const apiKey = options.apiKey || process.env.OPENWEATHER_API_KEY;
|
|
24
|
-
if (!apiKey) {
|
|
25
|
-
console.error(chalk.red('❌ OpenWeatherMap API key is required'));
|
|
26
|
-
console.log(chalk.yellow('Set OPENWEATHER_API_KEY environment variable or use --api-key option'));
|
|
27
|
-
console.log(chalk.gray('Get a free API key at: https://openweathermap.org/api'));
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
const days = Math.min(Math.max(parseInt(options.days) || 1, 1), 5);
|
|
31
|
-
const endpoint = options.forecast ? 'forecast' : 'weather';
|
|
32
|
-
// Build the API URL
|
|
33
|
-
let url = `https://api.openweathermap.org/data/2.5/${endpoint}?q=${encodeURIComponent(location)}&appid=${apiKey}&units=metric`;
|
|
34
|
-
// If forecast and more than 1 day, use the 5 day / 3 hour forecast endpoint
|
|
35
|
-
if (options.forecast && days > 1) {
|
|
36
|
-
url = `https://api.openweathermap.org/data/2.5/forecast?q=${encodeURIComponent(location)}&appid=${apiKey}&units=metric`;
|
|
37
|
-
}
|
|
38
|
-
console.log(chalk.blue(`🌤️ Fetching weather data for ${location}...`));
|
|
39
|
-
const bashTool = new BashTool();
|
|
40
|
-
const result = await bashTool.execute(`curl -s "${url}"`);
|
|
41
|
-
if (result.error) {
|
|
42
|
-
console.error(chalk.red('❌ Error fetching weather data:'), result.error);
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
const weatherData = JSON.parse(result.output || '{}');
|
|
47
|
-
if (weatherData.cod && weatherData.cod !== "200") {
|
|
48
|
-
console.error(chalk.red('❌ Weather API error:'), weatherData.message || 'Unknown error');
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
if (options.forecast) {
|
|
52
|
-
displayForecast(weatherData, location, days);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
displayCurrentWeather(weatherData, location);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (parseError) {
|
|
59
|
-
console.error(chalk.red('❌ Error parsing weather data:'), parseError instanceof Error ? parseError.message : 'Unknown error');
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
console.error(chalk.red('❌ Error:'), error instanceof Error ? error.message : 'Unknown error');
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return weatherCommand;
|
|
69
|
-
}
|
|
70
|
-
function displayCurrentWeather(data, location) {
|
|
71
|
-
const { main, weather, wind, clouds, name } = data;
|
|
72
|
-
console.log(chalk.bold.blue(`\n🌤️ Current Weather for ${name || location}\n`));
|
|
73
|
-
if (weather && weather.length > 0) {
|
|
74
|
-
const icon = getWeatherIcon(weather[0].main);
|
|
75
|
-
console.log(`${icon} ${weather[0].description.charAt(0).toUpperCase() + weather[0].description.slice(1)}`);
|
|
76
|
-
}
|
|
77
|
-
if (main) {
|
|
78
|
-
console.log(`🌡️ Temperature: ${Math.round(main.temp)}°C (feels like ${Math.round(main.feels_like)}°C)`);
|
|
79
|
-
console.log(`💧 Humidity: ${main.humidity}%`);
|
|
80
|
-
console.log(`📊 Pressure: ${main.pressure} hPa`);
|
|
81
|
-
}
|
|
82
|
-
if (wind) {
|
|
83
|
-
console.log(`💨 Wind: ${wind.speed} m/s${wind.deg ? ` (${getWindDirection(wind.deg)})` : ''}`);
|
|
84
|
-
}
|
|
85
|
-
if (clouds) {
|
|
86
|
-
console.log(`☁️ Cloudiness: ${clouds.all}%`);
|
|
87
|
-
}
|
|
88
|
-
console.log();
|
|
89
|
-
}
|
|
90
|
-
function displayForecast(data, location, days) {
|
|
91
|
-
console.log(chalk.bold.blue(`\n📅 Weather Forecast for ${location} (${days} day${days > 1 ? 's' : ''})\n`));
|
|
92
|
-
if (data.list && Array.isArray(data.list)) {
|
|
93
|
-
// Group forecasts by day
|
|
94
|
-
const dailyForecasts = {};
|
|
95
|
-
data.list.forEach((item) => {
|
|
96
|
-
const date = new Date(item.dt * 1000).toLocaleDateString();
|
|
97
|
-
if (!dailyForecasts[date]) {
|
|
98
|
-
dailyForecasts[date] = [];
|
|
99
|
-
}
|
|
100
|
-
dailyForecasts[date].push(item);
|
|
101
|
-
});
|
|
102
|
-
// Display each day's forecast
|
|
103
|
-
Object.entries(dailyForecasts).slice(0, days).forEach(([date, forecasts]) => {
|
|
104
|
-
console.log(chalk.bold(date));
|
|
105
|
-
// Get midday forecast (or first available)
|
|
106
|
-
const middayForecast = forecasts.find((f) => {
|
|
107
|
-
const hour = new Date(f.dt * 1000).getHours();
|
|
108
|
-
return hour >= 12 && hour <= 15;
|
|
109
|
-
}) || forecasts[0];
|
|
110
|
-
if (middayForecast) {
|
|
111
|
-
const { main, weather, wind } = middayForecast;
|
|
112
|
-
const time = new Date(middayForecast.dt * 1000).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
113
|
-
if (weather && weather.length > 0) {
|
|
114
|
-
const icon = getWeatherIcon(weather[0].main);
|
|
115
|
-
console.log(` ${icon} ${time} - ${weather[0].description.charAt(0).toUpperCase() + weather[0].description.slice(1)}`);
|
|
116
|
-
}
|
|
117
|
-
if (main) {
|
|
118
|
-
console.log(` 🌡️ ${Math.round(main.temp)}°C (feels like ${Math.round(main.feels_like)}°C)`);
|
|
119
|
-
console.log(` 💧 ${main.humidity}%`);
|
|
120
|
-
}
|
|
121
|
-
if (wind) {
|
|
122
|
-
console.log(` 💨 ${wind.speed} m/s`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
console.log();
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
else if (data.main && data.weather) {
|
|
129
|
-
// Single day forecast (current weather endpoint with forecast data)
|
|
130
|
-
displayCurrentWeather(data, location);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
console.log(chalk.yellow('⚠️ No forecast data available'));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
function getWeatherIcon(condition) {
|
|
137
|
-
const icons = {
|
|
138
|
-
'Clear': '☀️',
|
|
139
|
-
'Clouds': '☁️',
|
|
140
|
-
'Rain': '🌧️',
|
|
141
|
-
'Drizzle': '🌦️',
|
|
142
|
-
'Thunderstorm': '⛈️',
|
|
143
|
-
'Snow': '❄️',
|
|
144
|
-
'Mist': '🌫️',
|
|
145
|
-
'Fog': '🌫️',
|
|
146
|
-
'Haze': '🌫️',
|
|
147
|
-
'Dust': '🌫️',
|
|
148
|
-
'Sand': '🌫️',
|
|
149
|
-
'Ash': '🌋',
|
|
150
|
-
'Squall': '💨',
|
|
151
|
-
'Tornado': '🌪️'
|
|
152
|
-
};
|
|
153
|
-
return icons[condition] || '🌤️';
|
|
154
|
-
}
|
|
155
|
-
function getWindDirection(degrees) {
|
|
156
|
-
const directions = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
|
|
157
|
-
const index = Math.round(degrees / 45) % 8;
|
|
158
|
-
return directions[index];
|
|
159
|
-
}
|
|
160
|
-
//# sourceMappingURL=weather.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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C,MAAM,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,SAAiB;IACvC,MAAM,KAAK,GAA8B;QACvC,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;KACjB,CAAC;IAEF,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC;AACnC,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAe;IACvC,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IAC3C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC"}
|
package/dist/grok/client.d.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import type { ChatCompletionMessageParam } from "openai/resources/chat";
|
|
2
|
-
import type { ChatOptions, GLM46StreamChunk } from "./types.js";
|
|
3
|
-
export type GrokMessage = ChatCompletionMessageParam;
|
|
4
|
-
export interface GrokTool {
|
|
5
|
-
type: "function";
|
|
6
|
-
function: {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
parameters: {
|
|
10
|
-
type: "object";
|
|
11
|
-
properties: Record<string, any>;
|
|
12
|
-
required: string[];
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export interface GrokToolCall {
|
|
17
|
-
id: string;
|
|
18
|
-
type: "function";
|
|
19
|
-
function: {
|
|
20
|
-
name: string;
|
|
21
|
-
arguments: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export interface SearchParameters {
|
|
25
|
-
mode?: "auto" | "on" | "off";
|
|
26
|
-
}
|
|
27
|
-
export interface SearchOptions {
|
|
28
|
-
search_parameters?: SearchParameters;
|
|
29
|
-
}
|
|
30
|
-
export interface GrokResponse {
|
|
31
|
-
choices: Array<{
|
|
32
|
-
message: {
|
|
33
|
-
role: string;
|
|
34
|
-
content: string | null;
|
|
35
|
-
reasoning_content?: string;
|
|
36
|
-
tool_calls?: GrokToolCall[];
|
|
37
|
-
};
|
|
38
|
-
finish_reason: string;
|
|
39
|
-
}>;
|
|
40
|
-
usage?: {
|
|
41
|
-
prompt_tokens: number;
|
|
42
|
-
completion_tokens: number;
|
|
43
|
-
total_tokens: number;
|
|
44
|
-
reasoning_tokens?: number;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* GrokClient - Enhanced client for GLM-4.6 API
|
|
49
|
-
*
|
|
50
|
-
* Supports advanced features including:
|
|
51
|
-
* - Thinking/reasoning mode
|
|
52
|
-
* - Configurable temperature (0.6-1.0 for GLM-4.6)
|
|
53
|
-
* - Extended context windows (up to 200K tokens)
|
|
54
|
-
* - Multiple model support
|
|
55
|
-
*/
|
|
56
|
-
export declare class GrokClient {
|
|
57
|
-
private client;
|
|
58
|
-
private currentModel;
|
|
59
|
-
private defaultMaxTokens;
|
|
60
|
-
private defaultTemperature;
|
|
61
|
-
constructor(apiKey: string, model?: string, baseURL?: string);
|
|
62
|
-
/**
|
|
63
|
-
* Validate and normalize model name
|
|
64
|
-
*/
|
|
65
|
-
private validateModel;
|
|
66
|
-
/**
|
|
67
|
-
* Validate temperature for current model
|
|
68
|
-
*/
|
|
69
|
-
private validateTemperature;
|
|
70
|
-
/**
|
|
71
|
-
* Validate max tokens for current model
|
|
72
|
-
*/
|
|
73
|
-
private validateMaxTokens;
|
|
74
|
-
/**
|
|
75
|
-
* Validate thinking configuration for current model
|
|
76
|
-
*/
|
|
77
|
-
private validateThinking;
|
|
78
|
-
setModel(model: string): void;
|
|
79
|
-
getCurrentModel(): string;
|
|
80
|
-
getModelConfig(): {
|
|
81
|
-
name: string;
|
|
82
|
-
contextWindow: number;
|
|
83
|
-
maxOutputTokens: number;
|
|
84
|
-
defaultMaxTokens: number;
|
|
85
|
-
supportsThinking: boolean;
|
|
86
|
-
defaultTemperature: number;
|
|
87
|
-
temperatureRange: {
|
|
88
|
-
min: number;
|
|
89
|
-
max: number;
|
|
90
|
-
};
|
|
91
|
-
tokenEfficiency: number;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Chat completion with GLM-4.6 support
|
|
95
|
-
*
|
|
96
|
-
* @param messages - Conversation messages
|
|
97
|
-
* @param tools - Available tools/functions
|
|
98
|
-
* @param options - Chat options including temperature, thinking mode, etc.
|
|
99
|
-
* @returns Promise<GrokResponse>
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* const response = await client.chat(messages, tools, {
|
|
104
|
-
* model: 'glm-4.6',
|
|
105
|
-
* temperature: 0.7,
|
|
106
|
-
* thinking: { type: 'enabled' },
|
|
107
|
-
* maxTokens: 8192
|
|
108
|
-
* });
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
chat(messages: GrokMessage[], tools?: GrokTool[], options?: ChatOptions): Promise<GrokResponse>;
|
|
112
|
-
/**
|
|
113
|
-
* Streaming chat completion with GLM-4.6 support
|
|
114
|
-
*
|
|
115
|
-
* Yields chunks including reasoning_content when thinking is enabled
|
|
116
|
-
*
|
|
117
|
-
* @param messages - Conversation messages
|
|
118
|
-
* @param tools - Available tools/functions
|
|
119
|
-
* @param options - Chat options including temperature, thinking mode, etc.
|
|
120
|
-
* @returns AsyncGenerator yielding GLM46StreamChunk
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```typescript
|
|
124
|
-
* const stream = client.chatStream(messages, tools, {
|
|
125
|
-
* thinking: { type: 'enabled' }
|
|
126
|
-
* });
|
|
127
|
-
*
|
|
128
|
-
* for await (const chunk of stream) {
|
|
129
|
-
* if (chunk.choices[0]?.delta?.reasoning_content) {
|
|
130
|
-
* console.log('Reasoning:', chunk.choices[0].delta.reasoning_content);
|
|
131
|
-
* }
|
|
132
|
-
* if (chunk.choices[0]?.delta?.content) {
|
|
133
|
-
* console.log('Content:', chunk.choices[0].delta.content);
|
|
134
|
-
* }
|
|
135
|
-
* }
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
chatStream(messages: GrokMessage[], tools?: GrokTool[], options?: ChatOptions): AsyncGenerator<GLM46StreamChunk, void, unknown>;
|
|
139
|
-
/**
|
|
140
|
-
* Search with web context (deprecated - use chat with searchOptions)
|
|
141
|
-
* @deprecated Use chat() with searchOptions parameter instead
|
|
142
|
-
*/
|
|
143
|
-
search(query: string, searchParameters?: SearchParameters): Promise<GrokResponse>;
|
|
144
|
-
}
|