@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.
Files changed (223) hide show
  1. package/LICENSE +2 -6
  2. package/README.md +109 -2
  3. package/dist/analyzers/ast/index.d.ts +9 -0
  4. package/dist/analyzers/ast/index.js +10 -0
  5. package/dist/analyzers/ast/index.js.map +1 -0
  6. package/dist/analyzers/ast/node-helpers.d.ts +81 -0
  7. package/dist/analyzers/ast/node-helpers.js +128 -0
  8. package/dist/analyzers/ast/node-helpers.js.map +1 -0
  9. package/dist/analyzers/ast/parser.d.ts +59 -0
  10. package/dist/analyzers/ast/parser.js +293 -0
  11. package/dist/analyzers/ast/parser.js.map +1 -0
  12. package/dist/analyzers/ast/traverser.d.ts +67 -0
  13. package/dist/analyzers/ast/traverser.js +156 -0
  14. package/dist/analyzers/ast/traverser.js.map +1 -0
  15. package/dist/analyzers/ast/types.d.ts +107 -0
  16. package/dist/analyzers/ast/types.js +7 -0
  17. package/dist/analyzers/ast/types.js.map +1 -0
  18. package/dist/analyzers/best-practices/index.d.ts +10 -0
  19. package/dist/analyzers/best-practices/index.js +11 -0
  20. package/dist/analyzers/best-practices/index.js.map +1 -0
  21. package/dist/analyzers/code-smells/base-smell-detector.d.ts +30 -0
  22. package/dist/analyzers/code-smells/base-smell-detector.js +44 -0
  23. package/dist/analyzers/code-smells/base-smell-detector.js.map +1 -0
  24. package/dist/analyzers/code-smells/code-smell-analyzer.d.ts +30 -0
  25. package/dist/analyzers/code-smells/code-smell-analyzer.js +167 -0
  26. package/dist/analyzers/code-smells/code-smell-analyzer.js.map +1 -0
  27. package/dist/analyzers/code-smells/detectors/data-clumps-detector.d.ts +11 -0
  28. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js +66 -0
  29. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js.map +1 -0
  30. package/dist/analyzers/code-smells/detectors/dead-code-detector.d.ts +11 -0
  31. package/dist/analyzers/code-smells/detectors/dead-code-detector.js +53 -0
  32. package/dist/analyzers/code-smells/detectors/dead-code-detector.js.map +1 -0
  33. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.d.ts +11 -0
  34. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js +51 -0
  35. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js.map +1 -0
  36. package/dist/analyzers/code-smells/detectors/feature-envy-detector.d.ts +11 -0
  37. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js +64 -0
  38. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js.map +1 -0
  39. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.d.ts +11 -0
  40. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js +56 -0
  41. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js.map +1 -0
  42. package/dist/analyzers/code-smells/detectors/large-class-detector.d.ts +13 -0
  43. package/dist/analyzers/code-smells/detectors/large-class-detector.js +58 -0
  44. package/dist/analyzers/code-smells/detectors/large-class-detector.js.map +1 -0
  45. package/dist/analyzers/code-smells/detectors/long-method-detector.d.ts +12 -0
  46. package/dist/analyzers/code-smells/detectors/long-method-detector.js +52 -0
  47. package/dist/analyzers/code-smells/detectors/long-method-detector.js.map +1 -0
  48. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.d.ts +12 -0
  49. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js +50 -0
  50. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js.map +1 -0
  51. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.d.ts +12 -0
  52. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js +54 -0
  53. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js.map +1 -0
  54. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.d.ts +13 -0
  55. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js +71 -0
  56. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js.map +1 -0
  57. package/dist/analyzers/code-smells/index.d.ts +16 -0
  58. package/dist/analyzers/code-smells/index.js +19 -0
  59. package/dist/analyzers/code-smells/index.js.map +1 -0
  60. package/dist/analyzers/code-smells/types.d.ts +82 -0
  61. package/dist/analyzers/code-smells/types.js +30 -0
  62. package/dist/analyzers/code-smells/types.js.map +1 -0
  63. package/dist/analyzers/dependency/circular-detector.d.ts +17 -0
  64. package/dist/analyzers/dependency/circular-detector.js +71 -0
  65. package/dist/analyzers/dependency/circular-detector.js.map +1 -0
  66. package/dist/analyzers/dependency/coupling-calculator.d.ts +24 -0
  67. package/dist/analyzers/dependency/coupling-calculator.js +86 -0
  68. package/dist/analyzers/dependency/coupling-calculator.js.map +1 -0
  69. package/dist/analyzers/dependency/dependency-analyzer.d.ts +40 -0
  70. package/dist/analyzers/dependency/dependency-analyzer.js +214 -0
  71. package/dist/analyzers/dependency/dependency-analyzer.js.map +1 -0
  72. package/dist/analyzers/dependency/dependency-graph.d.ts +57 -0
  73. package/dist/analyzers/dependency/dependency-graph.js +186 -0
  74. package/dist/analyzers/dependency/dependency-graph.js.map +1 -0
  75. package/dist/analyzers/dependency/index.d.ts +8 -0
  76. package/dist/analyzers/dependency/index.js +8 -0
  77. package/dist/analyzers/dependency/index.js.map +1 -0
  78. package/dist/analyzers/dependency/types.d.ts +105 -0
  79. package/dist/analyzers/dependency/types.js +5 -0
  80. package/dist/analyzers/dependency/types.js.map +1 -0
  81. package/dist/analyzers/git/churn-calculator.d.ts +34 -0
  82. package/dist/analyzers/git/churn-calculator.js +214 -0
  83. package/dist/analyzers/git/churn-calculator.js.map +1 -0
  84. package/dist/analyzers/git/git-analyzer.d.ts +19 -0
  85. package/dist/analyzers/git/git-analyzer.js +71 -0
  86. package/dist/analyzers/git/git-analyzer.js.map +1 -0
  87. package/dist/analyzers/git/hotspot-detector.d.ts +34 -0
  88. package/dist/analyzers/git/hotspot-detector.js +170 -0
  89. package/dist/analyzers/git/hotspot-detector.js.map +1 -0
  90. package/dist/analyzers/git/index.d.ts +7 -0
  91. package/dist/analyzers/git/index.js +7 -0
  92. package/dist/analyzers/git/index.js.map +1 -0
  93. package/dist/analyzers/git/types.d.ts +88 -0
  94. package/dist/analyzers/git/types.js +5 -0
  95. package/dist/analyzers/git/types.js.map +1 -0
  96. package/dist/analyzers/metrics/halstead-calculator.d.ts +30 -0
  97. package/dist/analyzers/metrics/halstead-calculator.js +150 -0
  98. package/dist/analyzers/metrics/halstead-calculator.js.map +1 -0
  99. package/dist/analyzers/metrics/index.d.ts +9 -0
  100. package/dist/analyzers/metrics/index.js +9 -0
  101. package/dist/analyzers/metrics/index.js.map +1 -0
  102. package/dist/analyzers/metrics/maintainability-calculator.d.ts +17 -0
  103. package/dist/analyzers/metrics/maintainability-calculator.js +46 -0
  104. package/dist/analyzers/metrics/maintainability-calculator.js.map +1 -0
  105. package/dist/analyzers/metrics/metrics-analyzer.d.ts +32 -0
  106. package/dist/analyzers/metrics/metrics-analyzer.js +140 -0
  107. package/dist/analyzers/metrics/metrics-analyzer.js.map +1 -0
  108. package/dist/analyzers/metrics/types.d.ts +67 -0
  109. package/dist/analyzers/metrics/types.js +5 -0
  110. package/dist/analyzers/metrics/types.js.map +1 -0
  111. package/dist/analyzers/security/base-detector.d.ts +58 -0
  112. package/dist/analyzers/security/base-detector.js +104 -0
  113. package/dist/analyzers/security/base-detector.js.map +1 -0
  114. package/dist/analyzers/security/detectors/command-injection-detector.d.ts +12 -0
  115. package/dist/analyzers/security/detectors/command-injection-detector.js +84 -0
  116. package/dist/analyzers/security/detectors/command-injection-detector.js.map +1 -0
  117. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.d.ts +16 -0
  118. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js +140 -0
  119. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js.map +1 -0
  120. package/dist/analyzers/security/detectors/insecure-deserialization-detector.d.ts +12 -0
  121. package/dist/analyzers/security/detectors/insecure-deserialization-detector.js +109 -0
  122. package/dist/analyzers/security/detectors/insecure-deserialization-detector.js.map +1 -0
  123. package/dist/analyzers/security/detectors/insecure-random-detector.d.ts +12 -0
  124. package/dist/analyzers/security/detectors/insecure-random-detector.js +61 -0
  125. package/dist/analyzers/security/detectors/insecure-random-detector.js.map +1 -0
  126. package/dist/analyzers/security/detectors/path-traversal-detector.d.ts +12 -0
  127. package/dist/analyzers/security/detectors/path-traversal-detector.js +82 -0
  128. package/dist/analyzers/security/detectors/path-traversal-detector.js.map +1 -0
  129. package/dist/analyzers/security/detectors/sql-injection-detector.d.ts +12 -0
  130. package/dist/analyzers/security/detectors/sql-injection-detector.js +88 -0
  131. package/dist/analyzers/security/detectors/sql-injection-detector.js.map +1 -0
  132. package/dist/analyzers/security/detectors/weak-crypto-detector.d.ts +12 -0
  133. package/dist/analyzers/security/detectors/weak-crypto-detector.js +104 -0
  134. package/dist/analyzers/security/detectors/weak-crypto-detector.js.map +1 -0
  135. package/dist/analyzers/security/detectors/xss-detector.d.ts +12 -0
  136. package/dist/analyzers/security/detectors/xss-detector.js +90 -0
  137. package/dist/analyzers/security/detectors/xss-detector.js.map +1 -0
  138. package/dist/analyzers/security/index.d.ts +16 -0
  139. package/dist/analyzers/security/index.js +18 -0
  140. package/dist/analyzers/security/index.js.map +1 -0
  141. package/dist/analyzers/security/security-analyzer.d.ts +38 -0
  142. package/dist/analyzers/security/security-analyzer.js +215 -0
  143. package/dist/analyzers/security/security-analyzer.js.map +1 -0
  144. package/dist/analyzers/security/types.d.ts +95 -0
  145. package/dist/analyzers/security/types.js +7 -0
  146. package/dist/analyzers/security/types.js.map +1 -0
  147. package/dist/hooks/use-enhanced-input.d.ts +0 -1
  148. package/dist/hooks/use-enhanced-input.js.map +1 -1
  149. package/dist/index.js +0 -0
  150. package/dist/mcp/validation.js +12 -6
  151. package/dist/mcp/validation.js.map +1 -1
  152. package/dist/tools/analysis-tools.d.ts +73 -0
  153. package/dist/tools/analysis-tools.js +422 -0
  154. package/dist/tools/analysis-tools.js.map +1 -0
  155. package/dist/tools/bash.js +2 -1
  156. package/dist/tools/bash.js.map +1 -1
  157. package/dist/ui/components/toast-notification.js +0 -1
  158. package/dist/ui/components/toast-notification.js.map +1 -1
  159. package/dist/ui/components/welcome-panel.js +1 -1
  160. package/dist/ui/components/welcome-panel.js.map +1 -1
  161. package/dist/ui/hooks/use-input-history.d.ts +9 -0
  162. package/dist/ui/hooks/use-input-history.js +117 -0
  163. package/dist/ui/hooks/use-input-history.js.map +1 -0
  164. package/dist/utils/parallel-analyzer.js +30 -17
  165. package/dist/utils/parallel-analyzer.js.map +1 -1
  166. package/eslint.config.js +3 -0
  167. package/package.json +5 -5
  168. package/vitest.config.ts +1 -0
  169. package/.ax-cli/checkpoints/2025-11-20/checkpoint-11e9e0ba-c39d-4fd2-aa77-bc818811c921.json +0 -69
  170. package/.ax-cli/checkpoints/2025-11-20/checkpoint-2b260b98-b418-4c7c-9694-e2b94967e662.json +0 -24
  171. package/.ax-cli/checkpoints/2025-11-20/checkpoint-7e03601e-e8ab-4cd7-9841-a74b66adf78f.json +0 -69
  172. package/.ax-cli/checkpoints/2025-11-20/checkpoint-7f9c6562-771f-4fd0-adcf-9e7e9ac34ae8.json +0 -44
  173. package/.ax-cli/checkpoints/2025-11-20/checkpoint-e1ebe666-4c3a-4367-ba5c-27fe512a9c70.json +0 -24
  174. package/.ax-cli/checkpoints/2025-11-21/checkpoint-15743e7d-430c-4d76-b6fc-955d7a5c250c.json +0 -44
  175. package/.ax-cli/checkpoints/2025-11-21/checkpoint-25cf7679-0b3f-4988-83d7-704548fbba91.json +0 -69
  176. package/.ax-cli/checkpoints/2025-11-21/checkpoint-54aedbac-6db0-464e-8ebb-dbb3979e6dca.json +0 -24
  177. package/.ax-cli/checkpoints/2025-11-21/checkpoint-7658aed8-fe5d-4222-903f-1a7c63717ea7.json +0 -24
  178. package/.ax-cli/checkpoints/2025-11-21/checkpoint-c9c13497-40dc-4294-a327-6a5fc854eaa1.json +0 -69
  179. package/automatosx.config.json +0 -333
  180. package/config/messages.yaml +0 -75
  181. package/config/models.yaml +0 -66
  182. package/config/prompts.yaml +0 -156
  183. package/config/settings.yaml +0 -86
  184. package/dist/commands/weather.d.ts +0 -8
  185. package/dist/commands/weather.js +0 -160
  186. package/dist/commands/weather.js.map +0 -1
  187. package/dist/grok/client.d.ts +0 -144
  188. package/dist/grok/client.js +0 -237
  189. package/dist/grok/client.js.map +0 -1
  190. package/dist/grok/tools.d.ts +0 -8
  191. package/dist/grok/tools.js +0 -318
  192. package/dist/grok/tools.js.map +0 -1
  193. package/dist/grok/types.d.ts +0 -291
  194. package/dist/grok/types.js +0 -127
  195. package/dist/grok/types.js.map +0 -1
  196. package/dist/tools/morph-editor.d.ts +0 -36
  197. package/dist/tools/morph-editor.js +0 -308
  198. package/dist/tools/morph-editor.js.map +0 -1
  199. package/dist/ui/components/session-recovery.d.ts +0 -12
  200. package/dist/ui/components/session-recovery.js +0 -93
  201. package/dist/ui/components/session-recovery.js.map +0 -1
  202. package/dist/utils/model-config.d.ts +0 -28
  203. package/dist/utils/model-config.js +0 -43
  204. package/dist/utils/model-config.js.map +0 -1
  205. package/dist/utils/tool-helpers.d.ts +0 -25
  206. package/dist/utils/tool-helpers.js +0 -79
  207. package/dist/utils/tool-helpers.js.map +0 -1
  208. package/packages/schemas/dist/index.d.ts +0 -14
  209. package/packages/schemas/dist/index.d.ts.map +0 -1
  210. package/packages/schemas/dist/index.js +0 -19
  211. package/packages/schemas/dist/index.js.map +0 -1
  212. package/packages/schemas/dist/public/core/brand-types.d.ts +0 -308
  213. package/packages/schemas/dist/public/core/brand-types.d.ts.map +0 -1
  214. package/packages/schemas/dist/public/core/brand-types.js +0 -243
  215. package/packages/schemas/dist/public/core/brand-types.js.map +0 -1
  216. package/packages/schemas/dist/public/core/enums.d.ts +0 -227
  217. package/packages/schemas/dist/public/core/enums.d.ts.map +0 -1
  218. package/packages/schemas/dist/public/core/enums.js +0 -222
  219. package/packages/schemas/dist/public/core/enums.js.map +0 -1
  220. package/packages/schemas/dist/public/core/id-types.d.ts +0 -286
  221. package/packages/schemas/dist/public/core/id-types.d.ts.map +0 -1
  222. package/packages/schemas/dist/public/core/id-types.js +0 -136
  223. package/packages/schemas/dist/public/core/id-types.js.map +0 -1
@@ -1,291 +0,0 @@
1
- /**
2
- * GLM-4.6 API Type Definitions
3
- *
4
- * This file contains comprehensive type definitions for GLM-4.6 API features,
5
- * including advanced reasoning mode, configurable parameters, and enhanced
6
- * response structures.
7
- *
8
- * @see https://docs.z.ai/guides/llm/glm-4.6
9
- */
10
- import type { GrokTool, GrokToolCall, SearchOptions } from "./client.js";
11
- /**
12
- * Thinking/Reasoning configuration for GLM-4.6
13
- *
14
- * When enabled, the model will include reasoning_content in responses,
15
- * showing the step-by-step thought process before generating the final answer.
16
- *
17
- * @example
18
- * ```typescript
19
- * const thinking: ThinkingConfig = { type: "enabled" };
20
- * const response = await client.chat(messages, [], { thinking });
21
- * ```
22
- */
23
- export interface ThinkingConfig {
24
- /**
25
- * Enable or disable thinking mode
26
- * - "enabled": Include reasoning process in responses
27
- * - "disabled": Standard response without reasoning
28
- */
29
- type: "enabled" | "disabled";
30
- }
31
- /**
32
- * Comprehensive options for GLM-4.6 chat requests
33
- *
34
- * Consolidates all available parameters for chat completions,
35
- * providing type-safe configuration for GLM-4.6 features.
36
- */
37
- export interface ChatOptions {
38
- /**
39
- * Model identifier
40
- * @default "glm-4.6"
41
- * @example "glm-4.6", "grok-code-fast-1"
42
- */
43
- model?: string;
44
- /**
45
- * Temperature controls randomness in responses
46
- *
47
- * - Lower values (0.6): More focused and deterministic
48
- * - Higher values (1.0): More creative and diverse
49
- *
50
- * @default 0.7
51
- * @minimum 0.6
52
- * @maximum 1.0
53
- */
54
- temperature?: number;
55
- /**
56
- * Maximum number of tokens to generate
57
- *
58
- * GLM-4.6 supports up to 128,000 output tokens
59
- *
60
- * @default 8192
61
- * @maximum 128000
62
- */
63
- maxTokens?: number;
64
- /**
65
- * Enable/disable advanced reasoning mode
66
- *
67
- * When enabled, responses include reasoning_content showing
68
- * the model's step-by-step thought process.
69
- */
70
- thinking?: ThinkingConfig;
71
- /**
72
- * Search parameters for web-enabled queries
73
- */
74
- searchOptions?: SearchOptions;
75
- /**
76
- * Tools/functions available for the model to call
77
- */
78
- tools?: GrokTool[];
79
- /**
80
- * Enable streaming responses
81
- * @default false
82
- */
83
- stream?: boolean;
84
- }
85
- /**
86
- * GLM-4.6 enhanced response structure
87
- *
88
- * Extends the standard response with reasoning content and
89
- * enhanced usage metrics.
90
- */
91
- export interface GLM46Response {
92
- id: string;
93
- object: string;
94
- created: number;
95
- model: string;
96
- choices: Array<{
97
- index: number;
98
- message: {
99
- role: string;
100
- content: string | null;
101
- /**
102
- * Reasoning process (only present when thinking is enabled)
103
- * Contains the step-by-step thought process before the final answer
104
- */
105
- reasoning_content?: string;
106
- tool_calls?: GrokToolCall[];
107
- };
108
- finish_reason: string;
109
- }>;
110
- /**
111
- * Token usage statistics
112
- */
113
- usage?: {
114
- prompt_tokens: number;
115
- completion_tokens: number;
116
- total_tokens: number;
117
- /**
118
- * Tokens used for reasoning (only when thinking is enabled)
119
- */
120
- reasoning_tokens?: number;
121
- };
122
- }
123
- /**
124
- * GLM-4.6 streaming response chunk
125
- *
126
- * Individual chunks received during streaming responses,
127
- * including support for reasoning content.
128
- */
129
- export interface GLM46StreamChunk {
130
- id: string;
131
- object: string;
132
- created: number;
133
- model: string;
134
- choices: Array<{
135
- index: number;
136
- delta: {
137
- role?: string;
138
- /**
139
- * Incremental content from the final response
140
- */
141
- content?: string;
142
- /**
143
- * Incremental reasoning content (when thinking is enabled)
144
- * Shows the model's thought process as it develops
145
- */
146
- reasoning_content?: string;
147
- tool_calls?: Array<{
148
- index: number;
149
- id?: string;
150
- type?: "function";
151
- function?: {
152
- name?: string;
153
- arguments?: string;
154
- };
155
- }>;
156
- };
157
- finish_reason?: string | null;
158
- }>;
159
- }
160
- /**
161
- * Type guard to check if a response is a GLM-4.6 response
162
- */
163
- export declare function isGLM46Response(response: unknown): response is GLM46Response;
164
- /**
165
- * Type guard to check if a chunk has reasoning content
166
- */
167
- export declare function hasReasoningContent(chunk: GLM46StreamChunk): chunk is GLM46StreamChunk & {
168
- choices: Array<{
169
- delta: {
170
- reasoning_content: string;
171
- };
172
- }>;
173
- };
174
- /**
175
- * GLM-4.6 model configurations
176
- *
177
- * Defines capabilities and limits for supported models
178
- */
179
- export declare const GLM_MODELS: {
180
- readonly "glm-4.6": {
181
- readonly contextWindow: 200000;
182
- readonly maxOutputTokens: 128000;
183
- readonly supportsThinking: true;
184
- readonly defaultTemperature: 0.7;
185
- readonly temperatureRange: {
186
- readonly min: 0.6;
187
- readonly max: 1;
188
- };
189
- readonly tokenEfficiency: 1.3;
190
- };
191
- readonly "grok-code-fast-1": {
192
- readonly contextWindow: 128000;
193
- readonly maxOutputTokens: 4096;
194
- readonly supportsThinking: false;
195
- readonly defaultTemperature: 0.7;
196
- readonly temperatureRange: {
197
- readonly min: 0;
198
- readonly max: 2;
199
- };
200
- readonly tokenEfficiency: 1;
201
- };
202
- readonly "glm-4-air": {
203
- readonly contextWindow: 128000;
204
- readonly maxOutputTokens: 8192;
205
- readonly supportsThinking: false;
206
- readonly defaultTemperature: 0.7;
207
- readonly temperatureRange: {
208
- readonly min: 0.6;
209
- readonly max: 1;
210
- };
211
- readonly tokenEfficiency: 1.15;
212
- };
213
- readonly "glm-4-airx": {
214
- readonly contextWindow: 8192;
215
- readonly maxOutputTokens: 8192;
216
- readonly supportsThinking: false;
217
- readonly defaultTemperature: 0.7;
218
- readonly temperatureRange: {
219
- readonly min: 0.6;
220
- readonly max: 1;
221
- };
222
- readonly tokenEfficiency: 1.1;
223
- };
224
- };
225
- export type SupportedModel = keyof typeof GLM_MODELS;
226
- /**
227
- * Get model configuration by name
228
- */
229
- export declare function getModelConfig(model: string): {
230
- readonly contextWindow: 200000;
231
- readonly maxOutputTokens: 128000;
232
- readonly supportsThinking: true;
233
- readonly defaultTemperature: 0.7;
234
- readonly temperatureRange: {
235
- readonly min: 0.6;
236
- readonly max: 1;
237
- };
238
- readonly tokenEfficiency: 1.3;
239
- } | {
240
- readonly contextWindow: 128000;
241
- readonly maxOutputTokens: 4096;
242
- readonly supportsThinking: false;
243
- readonly defaultTemperature: 0.7;
244
- readonly temperatureRange: {
245
- readonly min: 0;
246
- readonly max: 2;
247
- };
248
- readonly tokenEfficiency: 1;
249
- } | {
250
- readonly contextWindow: 128000;
251
- readonly maxOutputTokens: 8192;
252
- readonly supportsThinking: false;
253
- readonly defaultTemperature: 0.7;
254
- readonly temperatureRange: {
255
- readonly min: 0.6;
256
- readonly max: 1;
257
- };
258
- readonly tokenEfficiency: 1.15;
259
- } | {
260
- readonly contextWindow: 8192;
261
- readonly maxOutputTokens: 8192;
262
- readonly supportsThinking: false;
263
- readonly defaultTemperature: 0.7;
264
- readonly temperatureRange: {
265
- readonly min: 0.6;
266
- readonly max: 1;
267
- };
268
- readonly tokenEfficiency: 1.1;
269
- };
270
- /**
271
- * Validate temperature for a given model
272
- *
273
- * @throws Error if temperature is out of valid range
274
- */
275
- export declare function validateTemperature(temperature: number, model: string): void;
276
- /**
277
- * Validate max tokens for a given model
278
- *
279
- * @throws Error if maxTokens exceeds model limit
280
- */
281
- export declare function validateMaxTokens(maxTokens: number, model: string): void;
282
- /**
283
- * Validate thinking configuration for a given model
284
- *
285
- * @throws Error if thinking is not supported by the model
286
- */
287
- export declare function validateThinking(thinking: ThinkingConfig | undefined, model: string): void;
288
- /**
289
- * Create default chat options with sensible defaults
290
- */
291
- export declare function createDefaultChatOptions(model?: string): Required<Omit<ChatOptions, 'thinking' | 'searchOptions' | 'tools'>>;
@@ -1,127 +0,0 @@
1
- /**
2
- * GLM-4.6 API Type Definitions
3
- *
4
- * This file contains comprehensive type definitions for GLM-4.6 API features,
5
- * including advanced reasoning mode, configurable parameters, and enhanced
6
- * response structures.
7
- *
8
- * @see https://docs.z.ai/guides/llm/glm-4.6
9
- */
10
- /**
11
- * Type guard to check if a response is a GLM-4.6 response
12
- */
13
- export function isGLM46Response(response) {
14
- return (typeof response === 'object' &&
15
- response !== null &&
16
- 'choices' in response &&
17
- Array.isArray(response.choices));
18
- }
19
- /**
20
- * Type guard to check if a chunk has reasoning content
21
- */
22
- export function hasReasoningContent(chunk) {
23
- return (chunk.choices.length > 0 &&
24
- typeof chunk.choices[0]?.delta?.reasoning_content === 'string' &&
25
- chunk.choices[0].delta.reasoning_content.length > 0);
26
- }
27
- /**
28
- * GLM-4.6 model configurations
29
- *
30
- * Defines capabilities and limits for supported models
31
- */
32
- export const GLM_MODELS = {
33
- "glm-4.6": {
34
- contextWindow: 200000, // 200K tokens
35
- maxOutputTokens: 128000, // 128K max output
36
- supportsThinking: true,
37
- defaultTemperature: 0.7,
38
- temperatureRange: { min: 0.6, max: 1.0 },
39
- tokenEfficiency: 1.3, // 30% more efficient
40
- },
41
- "grok-code-fast-1": {
42
- contextWindow: 128000, // 128K tokens
43
- maxOutputTokens: 4096,
44
- supportsThinking: false,
45
- defaultTemperature: 0.7,
46
- temperatureRange: { min: 0.0, max: 2.0 },
47
- tokenEfficiency: 1.0,
48
- },
49
- "glm-4-air": {
50
- contextWindow: 128000,
51
- maxOutputTokens: 8192,
52
- supportsThinking: false,
53
- defaultTemperature: 0.7,
54
- temperatureRange: { min: 0.6, max: 1.0 },
55
- tokenEfficiency: 1.15,
56
- },
57
- "glm-4-airx": {
58
- contextWindow: 8192,
59
- maxOutputTokens: 8192,
60
- supportsThinking: false,
61
- defaultTemperature: 0.7,
62
- temperatureRange: { min: 0.6, max: 1.0 },
63
- tokenEfficiency: 1.1,
64
- },
65
- };
66
- /**
67
- * Get model configuration by name
68
- */
69
- export function getModelConfig(model) {
70
- return GLM_MODELS[model] || GLM_MODELS["glm-4.6"];
71
- }
72
- /**
73
- * Validate temperature for a given model
74
- *
75
- * @throws Error if temperature is out of valid range
76
- */
77
- export function validateTemperature(temperature, model) {
78
- const config = getModelConfig(model);
79
- const { min, max } = config.temperatureRange;
80
- if (temperature < min || temperature > max) {
81
- throw new Error(`Temperature ${temperature} is out of range for model ${model}. ` +
82
- `Valid range: ${min} - ${max}`);
83
- }
84
- }
85
- /**
86
- * Validate max tokens for a given model
87
- *
88
- * @throws Error if maxTokens exceeds model limit
89
- */
90
- export function validateMaxTokens(maxTokens, model) {
91
- const config = getModelConfig(model);
92
- if (maxTokens > config.maxOutputTokens) {
93
- throw new Error(`Max tokens ${maxTokens} exceeds model limit for ${model}. ` +
94
- `Maximum: ${config.maxOutputTokens}`);
95
- }
96
- if (maxTokens < 1) {
97
- throw new Error(`Max tokens must be at least 1, got ${maxTokens}`);
98
- }
99
- }
100
- /**
101
- * Validate thinking configuration for a given model
102
- *
103
- * @throws Error if thinking is not supported by the model
104
- */
105
- export function validateThinking(thinking, model) {
106
- if (thinking && thinking.type === "enabled") {
107
- const config = getModelConfig(model);
108
- if (!config.supportsThinking) {
109
- throw new Error(`Thinking mode is not supported by model ${model}. ` +
110
- `Use glm-4.6 for thinking capabilities.`);
111
- }
112
- }
113
- }
114
- /**
115
- * Create default chat options with sensible defaults
116
- */
117
- export function createDefaultChatOptions(model) {
118
- const modelName = model || "glm-4.6";
119
- const config = getModelConfig(modelName);
120
- return {
121
- model: modelName,
122
- temperature: config.defaultTemperature,
123
- maxTokens: Math.min(8192, config.maxOutputTokens), // Conservative default
124
- stream: false,
125
- };
126
- }
127
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/grok/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmKH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAiB;IAC/C,OAAO,CACL,OAAO,QAAQ,KAAK,QAAQ;QAC5B,QAAQ,KAAK,IAAI;QACjB,SAAS,IAAI,QAAQ;QACrB,KAAK,CAAC,OAAO,CAAE,QAAgB,CAAC,OAAO,CAAC,CACzC,CAAC;AACJ,CAAC;AAED;;GAEG;AAC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AAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CACb,2CAA2C,KAAK,IAAI;gBACpD,wCAAwC,CACzC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,MAAM,SAAS,GAAG,KAAK,IAAI,SAAS,CAAC;IACrC,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAEzC,OAAO;QACL,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,MAAM,CAAC,kBAAkB;QACtC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,uBAAuB;QAC1E,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC"}
@@ -1,36 +0,0 @@
1
- import { ToolResult } from "../types/index.js";
2
- export declare class MorphEditorTool {
3
- private confirmationService;
4
- private morphApiKey;
5
- private morphBaseUrl;
6
- constructor(apiKey?: string);
7
- /**
8
- * Use this tool to make an edit to an existing file.
9
- *
10
- * This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
11
- * When writing the edit, you should specify each edit in sequence, with the special comment // ... existing code ... to represent unchanged code in between edited lines.
12
- *
13
- * For example:
14
- *
15
- * // ... existing code ...
16
- * FIRST_EDIT
17
- * // ... existing code ...
18
- * SECOND_EDIT
19
- * // ... existing code ...
20
- * THIRD_EDIT
21
- * // ... existing code ...
22
- *
23
- * You should still bias towards repeating as few lines of the original file as possible to convey the change.
24
- * But, each edit should contain sufficient context of unchanged lines around the code you're editing to resolve ambiguity.
25
- * DO NOT omit spans of pre-existing code (or comments) without using the // ... existing code ... comment to indicate its absence. If you omit the existing code comment, the model may inadvertently delete these lines.
26
- * If you plan on deleting a section, you must provide context before and after to delete it. If the initial code is ```code \n Block 1 \n Block 2 \n Block 3 \n code```, and you want to remove Block 2, you would output ```// ... existing code ... \n Block 1 \n Block 3 \n // ... existing code ...```.
27
- * Make sure it is clear what the edit should be, and where it should be applied.
28
- * Make edits to a file in a single edit_file call instead of multiple edit_file calls to the same file. The apply model can handle many distinct edits at once.
29
- */
30
- editFile(targetFile: string, instructions: string, codeEdit: string): Promise<ToolResult>;
31
- private callMorphApply;
32
- private generateDiff;
33
- view(filePath: string, viewRange?: [number, number]): Promise<ToolResult>;
34
- setApiKey(apiKey: string): void;
35
- getApiKey(): string;
36
- }