@defai.digital/ax-cli 3.4.5 → 3.5.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.
Files changed (211) hide show
  1. package/LICENSE +2 -6
  2. package/README.md +91 -3
  3. package/dist/analyzers/ast/parser.d.ts +59 -0
  4. package/dist/analyzers/ast/parser.js +293 -0
  5. package/dist/analyzers/ast/parser.js.map +1 -0
  6. package/dist/analyzers/ast/types.d.ts +107 -0
  7. package/dist/analyzers/ast/types.js +7 -0
  8. package/dist/analyzers/ast/types.js.map +1 -0
  9. package/dist/analyzers/code-smells/base-smell-detector.d.ts +30 -0
  10. package/dist/analyzers/code-smells/base-smell-detector.js +44 -0
  11. package/dist/analyzers/code-smells/base-smell-detector.js.map +1 -0
  12. package/dist/analyzers/code-smells/code-smell-analyzer.d.ts +30 -0
  13. package/dist/analyzers/code-smells/code-smell-analyzer.js +167 -0
  14. package/dist/analyzers/code-smells/code-smell-analyzer.js.map +1 -0
  15. package/dist/analyzers/code-smells/detectors/data-clumps-detector.d.ts +11 -0
  16. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js +66 -0
  17. package/dist/analyzers/code-smells/detectors/data-clumps-detector.js.map +1 -0
  18. package/dist/analyzers/code-smells/detectors/dead-code-detector.d.ts +11 -0
  19. package/dist/analyzers/code-smells/detectors/dead-code-detector.js +53 -0
  20. package/dist/analyzers/code-smells/detectors/dead-code-detector.js.map +1 -0
  21. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.d.ts +11 -0
  22. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js +51 -0
  23. package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js.map +1 -0
  24. package/dist/analyzers/code-smells/detectors/feature-envy-detector.d.ts +11 -0
  25. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js +64 -0
  26. package/dist/analyzers/code-smells/detectors/feature-envy-detector.js.map +1 -0
  27. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.d.ts +11 -0
  28. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js +56 -0
  29. package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js.map +1 -0
  30. package/dist/analyzers/code-smells/detectors/large-class-detector.d.ts +13 -0
  31. package/dist/analyzers/code-smells/detectors/large-class-detector.js +58 -0
  32. package/dist/analyzers/code-smells/detectors/large-class-detector.js.map +1 -0
  33. package/dist/analyzers/code-smells/detectors/long-method-detector.d.ts +12 -0
  34. package/dist/analyzers/code-smells/detectors/long-method-detector.js +52 -0
  35. package/dist/analyzers/code-smells/detectors/long-method-detector.js.map +1 -0
  36. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.d.ts +12 -0
  37. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js +50 -0
  38. package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js.map +1 -0
  39. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.d.ts +12 -0
  40. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js +54 -0
  41. package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js.map +1 -0
  42. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.d.ts +13 -0
  43. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js +71 -0
  44. package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js.map +1 -0
  45. package/dist/analyzers/code-smells/index.d.ts +16 -0
  46. package/dist/analyzers/code-smells/index.js +19 -0
  47. package/dist/analyzers/code-smells/index.js.map +1 -0
  48. package/dist/analyzers/code-smells/types.d.ts +82 -0
  49. package/dist/analyzers/code-smells/types.js +30 -0
  50. package/dist/analyzers/code-smells/types.js.map +1 -0
  51. package/dist/analyzers/dependency/circular-detector.d.ts +17 -0
  52. package/dist/analyzers/dependency/circular-detector.js +71 -0
  53. package/dist/analyzers/dependency/circular-detector.js.map +1 -0
  54. package/dist/analyzers/dependency/coupling-calculator.d.ts +24 -0
  55. package/dist/analyzers/dependency/coupling-calculator.js +86 -0
  56. package/dist/analyzers/dependency/coupling-calculator.js.map +1 -0
  57. package/dist/analyzers/dependency/dependency-analyzer.d.ts +40 -0
  58. package/dist/analyzers/dependency/dependency-analyzer.js +214 -0
  59. package/dist/analyzers/dependency/dependency-analyzer.js.map +1 -0
  60. package/dist/analyzers/dependency/dependency-graph.d.ts +57 -0
  61. package/dist/analyzers/dependency/dependency-graph.js +186 -0
  62. package/dist/analyzers/dependency/dependency-graph.js.map +1 -0
  63. package/dist/analyzers/dependency/index.d.ts +8 -0
  64. package/dist/analyzers/dependency/index.js +8 -0
  65. package/dist/analyzers/dependency/index.js.map +1 -0
  66. package/dist/analyzers/dependency/types.d.ts +105 -0
  67. package/dist/analyzers/dependency/types.js +5 -0
  68. package/dist/analyzers/dependency/types.js.map +1 -0
  69. package/dist/analyzers/git/churn-calculator.d.ts +34 -0
  70. package/dist/analyzers/git/churn-calculator.js +214 -0
  71. package/dist/analyzers/git/churn-calculator.js.map +1 -0
  72. package/dist/analyzers/git/git-analyzer.d.ts +19 -0
  73. package/dist/analyzers/git/git-analyzer.js +71 -0
  74. package/dist/analyzers/git/git-analyzer.js.map +1 -0
  75. package/dist/analyzers/git/hotspot-detector.d.ts +34 -0
  76. package/dist/analyzers/git/hotspot-detector.js +170 -0
  77. package/dist/analyzers/git/hotspot-detector.js.map +1 -0
  78. package/dist/analyzers/git/index.d.ts +7 -0
  79. package/dist/analyzers/git/index.js +7 -0
  80. package/dist/analyzers/git/index.js.map +1 -0
  81. package/dist/analyzers/git/types.d.ts +88 -0
  82. package/dist/analyzers/git/types.js +5 -0
  83. package/dist/analyzers/git/types.js.map +1 -0
  84. package/dist/analyzers/metrics/halstead-calculator.d.ts +30 -0
  85. package/dist/analyzers/metrics/halstead-calculator.js +150 -0
  86. package/dist/analyzers/metrics/halstead-calculator.js.map +1 -0
  87. package/dist/analyzers/metrics/index.d.ts +9 -0
  88. package/dist/analyzers/metrics/index.js +9 -0
  89. package/dist/analyzers/metrics/index.js.map +1 -0
  90. package/dist/analyzers/metrics/maintainability-calculator.d.ts +17 -0
  91. package/dist/analyzers/metrics/maintainability-calculator.js +46 -0
  92. package/dist/analyzers/metrics/maintainability-calculator.js.map +1 -0
  93. package/dist/analyzers/metrics/metrics-analyzer.d.ts +32 -0
  94. package/dist/analyzers/metrics/metrics-analyzer.js +140 -0
  95. package/dist/analyzers/metrics/metrics-analyzer.js.map +1 -0
  96. package/dist/analyzers/metrics/types.d.ts +67 -0
  97. package/dist/analyzers/metrics/types.js +5 -0
  98. package/dist/analyzers/metrics/types.js.map +1 -0
  99. package/dist/analyzers/security/base-detector.d.ts +58 -0
  100. package/dist/analyzers/security/base-detector.js +104 -0
  101. package/dist/analyzers/security/base-detector.js.map +1 -0
  102. package/dist/analyzers/security/detectors/command-injection-detector.d.ts +12 -0
  103. package/dist/analyzers/security/detectors/command-injection-detector.js +84 -0
  104. package/dist/analyzers/security/detectors/command-injection-detector.js.map +1 -0
  105. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.d.ts +16 -0
  106. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js +140 -0
  107. package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js.map +1 -0
  108. package/dist/analyzers/security/detectors/insecure-deserialization-detector.d.ts +12 -0
  109. package/dist/analyzers/security/detectors/insecure-deserialization-detector.js +109 -0
  110. package/dist/analyzers/security/detectors/insecure-deserialization-detector.js.map +1 -0
  111. package/dist/analyzers/security/detectors/insecure-random-detector.d.ts +12 -0
  112. package/dist/analyzers/security/detectors/insecure-random-detector.js +61 -0
  113. package/dist/analyzers/security/detectors/insecure-random-detector.js.map +1 -0
  114. package/dist/analyzers/security/detectors/path-traversal-detector.d.ts +12 -0
  115. package/dist/analyzers/security/detectors/path-traversal-detector.js +82 -0
  116. package/dist/analyzers/security/detectors/path-traversal-detector.js.map +1 -0
  117. package/dist/analyzers/security/detectors/sql-injection-detector.d.ts +12 -0
  118. package/dist/analyzers/security/detectors/sql-injection-detector.js +88 -0
  119. package/dist/analyzers/security/detectors/sql-injection-detector.js.map +1 -0
  120. package/dist/analyzers/security/detectors/weak-crypto-detector.d.ts +12 -0
  121. package/dist/analyzers/security/detectors/weak-crypto-detector.js +104 -0
  122. package/dist/analyzers/security/detectors/weak-crypto-detector.js.map +1 -0
  123. package/dist/analyzers/security/detectors/xss-detector.d.ts +12 -0
  124. package/dist/analyzers/security/detectors/xss-detector.js +90 -0
  125. package/dist/analyzers/security/detectors/xss-detector.js.map +1 -0
  126. package/dist/analyzers/security/index.d.ts +16 -0
  127. package/dist/analyzers/security/index.js +18 -0
  128. package/dist/analyzers/security/index.js.map +1 -0
  129. package/dist/analyzers/security/security-analyzer.d.ts +38 -0
  130. package/dist/analyzers/security/security-analyzer.js +215 -0
  131. package/dist/analyzers/security/security-analyzer.js.map +1 -0
  132. package/dist/analyzers/security/types.d.ts +95 -0
  133. package/dist/analyzers/security/types.js +7 -0
  134. package/dist/analyzers/security/types.js.map +1 -0
  135. package/dist/commands/memory.js +1 -1
  136. package/dist/commands/memory.js.map +1 -1
  137. package/dist/commands/setup.js +6 -1
  138. package/dist/commands/setup.js.map +1 -1
  139. package/dist/hooks/use-enhanced-input.d.ts +0 -1
  140. package/dist/hooks/use-enhanced-input.js.map +1 -1
  141. package/dist/mcp/health.js +4 -2
  142. package/dist/mcp/health.js.map +1 -1
  143. package/dist/mcp/validation.js +12 -6
  144. package/dist/mcp/validation.js.map +1 -1
  145. package/dist/tools/analysis-tools.d.ts +73 -0
  146. package/dist/tools/analysis-tools.js +422 -0
  147. package/dist/tools/analysis-tools.js.map +1 -0
  148. package/dist/tools/bash.js +2 -1
  149. package/dist/tools/bash.js.map +1 -1
  150. package/dist/ui/components/chat-history.js +1 -1
  151. package/dist/ui/components/chat-history.js.map +1 -1
  152. package/dist/ui/components/chat-interface.js +3 -2
  153. package/dist/ui/components/chat-interface.js.map +1 -1
  154. package/dist/ui/components/confirmation-dialog.js +1 -1
  155. package/dist/ui/components/confirmation-dialog.js.map +1 -1
  156. package/dist/ui/components/welcome-panel.js +1 -1
  157. package/dist/ui/components/welcome-panel.js.map +1 -1
  158. package/dist/ui/hooks/use-chat-reducer.d.ts +61 -0
  159. package/dist/ui/hooks/use-chat-reducer.js +118 -0
  160. package/dist/ui/hooks/use-chat-reducer.js.map +1 -0
  161. package/dist/ui/hooks/use-enhanced-input.d.ts +40 -0
  162. package/dist/ui/hooks/use-enhanced-input.js +254 -0
  163. package/dist/ui/hooks/use-enhanced-input.js.map +1 -0
  164. package/dist/ui/hooks/use-input-handler.d.ts +46 -0
  165. package/dist/ui/hooks/use-input-handler.js +1434 -0
  166. package/dist/ui/hooks/use-input-handler.js.map +1 -0
  167. package/dist/ui/hooks/use-input-history.d.ts +9 -0
  168. package/dist/ui/hooks/use-input-history.js +117 -0
  169. package/dist/ui/hooks/use-input-history.js.map +1 -0
  170. package/dist/utils/config-loader.js +3 -3
  171. package/dist/utils/config-loader.js.map +1 -1
  172. package/dist/utils/parallel-analyzer.js +7 -11
  173. package/dist/utils/parallel-analyzer.js.map +1 -1
  174. package/dist/utils/paste-collapse.d.ts +46 -0
  175. package/dist/utils/paste-collapse.js +77 -0
  176. package/dist/utils/paste-collapse.js.map +1 -0
  177. package/dist/utils/settings-manager.js +16 -2
  178. package/dist/utils/settings-manager.js.map +1 -1
  179. package/dist/utils/streaming-analyzer.js +9 -21
  180. package/dist/utils/streaming-analyzer.js.map +1 -1
  181. package/package.json +5 -5
  182. package/vitest.config.ts +1 -0
  183. package/dist/commands/weather.d.ts +0 -8
  184. package/dist/commands/weather.js +0 -160
  185. package/dist/commands/weather.js.map +0 -1
  186. package/dist/grok/client.d.ts +0 -144
  187. package/dist/grok/client.js +0 -237
  188. package/dist/grok/client.js.map +0 -1
  189. package/dist/grok/tools.d.ts +0 -8
  190. package/dist/grok/tools.js +0 -318
  191. package/dist/grok/tools.js.map +0 -1
  192. package/dist/grok/types.d.ts +0 -291
  193. package/dist/grok/types.js +0 -127
  194. package/dist/grok/types.js.map +0 -1
  195. package/dist/tools/morph-editor.d.ts +0 -36
  196. package/dist/tools/morph-editor.js +0 -308
  197. package/dist/tools/morph-editor.js.map +0 -1
  198. package/dist/ui/components/session-recovery.d.ts +0 -12
  199. package/dist/ui/components/session-recovery.js +0 -93
  200. package/dist/ui/components/session-recovery.js.map +0 -1
  201. package/dist/utils/model-config.d.ts +0 -28
  202. package/dist/utils/model-config.js +0 -43
  203. package/dist/utils/model-config.js.map +0 -1
  204. package/dist/utils/tool-helpers.d.ts +0 -25
  205. package/dist/utils/tool-helpers.js +0 -79
  206. package/dist/utils/tool-helpers.js.map +0 -1
  207. /package/{automatosx.config.json → ax.config.json} +0 -0
  208. /package/{config → config-defaults}/messages.yaml +0 -0
  209. /package/{config → config-defaults}/models.yaml +0 -0
  210. /package/{config → config-defaults}/prompts.yaml +0 -0
  211. /package/{config → config-defaults}/settings.yaml +0 -0
@@ -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;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAuB;IAIvB,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QACxB,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,KAAK,QAAQ;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CACpD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,SAAS,EAAE;QACT,aAAa,EAAE,MAAM,EAAO,cAAc;QAC1C,eAAe,EAAE,MAAM,EAAK,kBAAkB;QAC9C,gBAAgB,EAAE,IAAI;QACtB,kBAAkB,EAAE,GAAG;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;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
- }
@@ -1,308 +0,0 @@
1
- import * as fs from "fs-extra";
2
- import * as path from "path";
3
- import axios from "axios";
4
- import { ConfirmationService } from "../utils/confirmation-service.js";
5
- export class MorphEditorTool {
6
- confirmationService = ConfirmationService.getInstance();
7
- morphApiKey;
8
- morphBaseUrl = "https://api.morphllm.com/v1";
9
- constructor(apiKey) {
10
- this.morphApiKey = apiKey || process.env.MORPH_API_KEY || "";
11
- if (!this.morphApiKey) {
12
- console.warn("MORPH_API_KEY not found. Morph editor functionality will be limited.");
13
- }
14
- }
15
- /**
16
- * Use this tool to make an edit to an existing file.
17
- *
18
- * 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.
19
- * 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.
20
- *
21
- * For example:
22
- *
23
- * // ... existing code ...
24
- * FIRST_EDIT
25
- * // ... existing code ...
26
- * SECOND_EDIT
27
- * // ... existing code ...
28
- * THIRD_EDIT
29
- * // ... existing code ...
30
- *
31
- * You should still bias towards repeating as few lines of the original file as possible to convey the change.
32
- * But, each edit should contain sufficient context of unchanged lines around the code you're editing to resolve ambiguity.
33
- * 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.
34
- * 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 ...```.
35
- * Make sure it is clear what the edit should be, and where it should be applied.
36
- * 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.
37
- */
38
- async editFile(targetFile, instructions, codeEdit) {
39
- try {
40
- const resolvedPath = path.resolve(targetFile);
41
- if (!(await fs.pathExists(resolvedPath))) {
42
- return {
43
- success: false,
44
- error: `File not found: ${targetFile}`,
45
- };
46
- }
47
- if (!this.morphApiKey) {
48
- return {
49
- success: false,
50
- error: "MORPH_API_KEY not configured. Please set your Morph API key.",
51
- };
52
- }
53
- // Read the initial code
54
- const initialCode = await fs.readFile(resolvedPath, "utf-8");
55
- // Check user confirmation before proceeding
56
- const sessionFlags = this.confirmationService.getSessionFlags();
57
- if (!sessionFlags.fileOperations && !sessionFlags.allOperations) {
58
- const confirmationResult = await this.confirmationService.requestConfirmation({
59
- operation: "Edit file with Morph Fast Apply",
60
- filename: targetFile,
61
- showVSCodeOpen: false,
62
- content: `Instructions: ${instructions}\n\nEdit:\n${codeEdit}`,
63
- }, "file");
64
- if (!confirmationResult.confirmed) {
65
- return {
66
- success: false,
67
- error: confirmationResult.feedback || "File edit cancelled by user",
68
- };
69
- }
70
- }
71
- // Call Morph Fast Apply API
72
- const mergedCode = await this.callMorphApply(instructions, initialCode, codeEdit);
73
- // Write the merged code back to file
74
- await fs.writeFile(resolvedPath, mergedCode, "utf-8");
75
- // Generate diff for display
76
- const oldLines = initialCode.split("\n");
77
- const newLines = mergedCode.split("\n");
78
- const diff = this.generateDiff(oldLines, newLines, targetFile);
79
- return {
80
- success: true,
81
- output: diff,
82
- };
83
- }
84
- catch (error) {
85
- return {
86
- success: false,
87
- error: `Error editing ${targetFile} with Morph: ${error.message}`,
88
- };
89
- }
90
- }
91
- async callMorphApply(instructions, initialCode, editSnippet) {
92
- try {
93
- const response = await axios.post(`${this.morphBaseUrl}/chat/completions`, {
94
- model: "morph-v3-large",
95
- messages: [
96
- {
97
- role: "user",
98
- content: `<instruction>${instructions}</instruction>\n<code>${initialCode}</code>\n<update>${editSnippet}</update>`,
99
- },
100
- ],
101
- }, {
102
- headers: {
103
- "Authorization": `Bearer ${this.morphApiKey}`,
104
- "Content-Type": "application/json",
105
- },
106
- });
107
- if (!response.data.choices || !response.data.choices[0] || !response.data.choices[0].message) {
108
- throw new Error("Invalid response format from Morph API");
109
- }
110
- return response.data.choices[0].message.content;
111
- }
112
- catch (error) {
113
- if (error.response) {
114
- throw new Error(`Morph API error (${error.response.status}): ${error.response.data}`);
115
- }
116
- throw error;
117
- }
118
- }
119
- generateDiff(oldLines, newLines, filePath) {
120
- const CONTEXT_LINES = 3;
121
- const changes = [];
122
- let i = 0, j = 0;
123
- while (i < oldLines.length || j < newLines.length) {
124
- while (i < oldLines.length && j < newLines.length && oldLines[i] === newLines[j]) {
125
- i++;
126
- j++;
127
- }
128
- if (i < oldLines.length || j < newLines.length) {
129
- const changeStart = { old: i, new: j };
130
- let oldEnd = i;
131
- let newEnd = j;
132
- while (oldEnd < oldLines.length || newEnd < newLines.length) {
133
- let matchFound = false;
134
- let matchLength = 0;
135
- for (let k = 0; k < Math.min(2, oldLines.length - oldEnd, newLines.length - newEnd); k++) {
136
- if (oldEnd + k < oldLines.length &&
137
- newEnd + k < newLines.length &&
138
- oldLines[oldEnd + k] === newLines[newEnd + k]) {
139
- matchLength++;
140
- }
141
- else {
142
- break;
143
- }
144
- }
145
- if (matchLength >= 2 || (oldEnd >= oldLines.length && newEnd >= newLines.length)) {
146
- matchFound = true;
147
- }
148
- if (matchFound) {
149
- break;
150
- }
151
- if (oldEnd < oldLines.length)
152
- oldEnd++;
153
- if (newEnd < newLines.length)
154
- newEnd++;
155
- }
156
- changes.push({
157
- oldStart: changeStart.old,
158
- oldEnd: oldEnd,
159
- newStart: changeStart.new,
160
- newEnd: newEnd
161
- });
162
- i = oldEnd;
163
- j = newEnd;
164
- }
165
- }
166
- const hunks = [];
167
- let accumulatedOffset = 0;
168
- for (let changeIdx = 0; changeIdx < changes.length; changeIdx++) {
169
- const change = changes[changeIdx];
170
- let contextStart = Math.max(0, change.oldStart - CONTEXT_LINES);
171
- let contextEnd = Math.min(oldLines.length, change.oldEnd + CONTEXT_LINES);
172
- if (hunks.length > 0) {
173
- const lastHunk = hunks[hunks.length - 1];
174
- const lastHunkEnd = lastHunk.oldStart + lastHunk.oldCount;
175
- if (lastHunkEnd >= contextStart) {
176
- const oldHunkEnd = lastHunk.oldStart + lastHunk.oldCount;
177
- const newContextEnd = Math.min(oldLines.length, change.oldEnd + CONTEXT_LINES);
178
- for (let idx = oldHunkEnd; idx < change.oldStart; idx++) {
179
- lastHunk.lines.push({ type: ' ', content: oldLines[idx] });
180
- }
181
- for (let idx = change.oldStart; idx < change.oldEnd; idx++) {
182
- lastHunk.lines.push({ type: '-', content: oldLines[idx] });
183
- }
184
- for (let idx = change.newStart; idx < change.newEnd; idx++) {
185
- lastHunk.lines.push({ type: '+', content: newLines[idx] });
186
- }
187
- for (let idx = change.oldEnd; idx < newContextEnd && idx < oldLines.length; idx++) {
188
- lastHunk.lines.push({ type: ' ', content: oldLines[idx] });
189
- }
190
- lastHunk.oldCount = newContextEnd - lastHunk.oldStart;
191
- lastHunk.newCount = lastHunk.oldCount + (change.newEnd - change.newStart) - (change.oldEnd - change.oldStart);
192
- continue;
193
- }
194
- }
195
- const hunk = {
196
- oldStart: contextStart + 1,
197
- oldCount: contextEnd - contextStart,
198
- newStart: contextStart + 1 + accumulatedOffset,
199
- newCount: contextEnd - contextStart + (change.newEnd - change.newStart) - (change.oldEnd - change.oldStart),
200
- lines: []
201
- };
202
- for (let idx = contextStart; idx < change.oldStart; idx++) {
203
- hunk.lines.push({ type: ' ', content: oldLines[idx] });
204
- }
205
- for (let idx = change.oldStart; idx < change.oldEnd; idx++) {
206
- hunk.lines.push({ type: '-', content: oldLines[idx] });
207
- }
208
- for (let idx = change.newStart; idx < change.newEnd; idx++) {
209
- hunk.lines.push({ type: '+', content: newLines[idx] });
210
- }
211
- for (let idx = change.oldEnd; idx < contextEnd && idx < oldLines.length; idx++) {
212
- hunk.lines.push({ type: ' ', content: oldLines[idx] });
213
- }
214
- hunks.push(hunk);
215
- accumulatedOffset += (change.newEnd - change.newStart) - (change.oldEnd - change.oldStart);
216
- }
217
- let addedLines = 0;
218
- let removedLines = 0;
219
- for (const hunk of hunks) {
220
- for (const line of hunk.lines) {
221
- if (line.type === '+')
222
- addedLines++;
223
- if (line.type === '-')
224
- removedLines++;
225
- }
226
- }
227
- let summary = `Updated ${filePath} with Morph Fast Apply`;
228
- if (addedLines > 0 && removedLines > 0) {
229
- summary += ` - ${addedLines} addition${addedLines !== 1 ? "s" : ""} and ${removedLines} removal${removedLines !== 1 ? "s" : ""}`;
230
- }
231
- else if (addedLines > 0) {
232
- summary += ` - ${addedLines} addition${addedLines !== 1 ? "s" : ""}`;
233
- }
234
- else if (removedLines > 0) {
235
- summary += ` - ${removedLines} removal${removedLines !== 1 ? "s" : ""}`;
236
- }
237
- else if (changes.length === 0) {
238
- return `No changes applied to ${filePath}`;
239
- }
240
- let diff = summary + "\n";
241
- diff += `--- a/${filePath}\n`;
242
- diff += `+++ b/${filePath}\n`;
243
- for (const hunk of hunks) {
244
- diff += `@@ -${hunk.oldStart},${hunk.oldCount} +${hunk.newStart},${hunk.newCount} @@\n`;
245
- for (const line of hunk.lines) {
246
- diff += `${line.type}${line.content}\n`;
247
- }
248
- }
249
- return diff.trim();
250
- }
251
- async view(filePath, viewRange) {
252
- try {
253
- const resolvedPath = path.resolve(filePath);
254
- if (await fs.pathExists(resolvedPath)) {
255
- const stats = await fs.stat(resolvedPath);
256
- if (stats.isDirectory()) {
257
- const files = await fs.readdir(resolvedPath);
258
- return {
259
- success: true,
260
- output: `Directory contents of ${filePath}:\n${files.join("\n")}`,
261
- };
262
- }
263
- const content = await fs.readFile(resolvedPath, "utf-8");
264
- const lines = content.split("\n");
265
- if (viewRange) {
266
- const [start, end] = viewRange;
267
- const selectedLines = lines.slice(start - 1, end);
268
- const numberedLines = selectedLines
269
- .map((line, idx) => `${start + idx}: ${line}`)
270
- .join("\n");
271
- return {
272
- success: true,
273
- output: `Lines ${start}-${end} of ${filePath}:\n${numberedLines}`,
274
- };
275
- }
276
- const totalLines = lines.length;
277
- const displayLines = totalLines > 10 ? lines.slice(0, 10) : lines;
278
- const numberedLines = displayLines
279
- .map((line, idx) => `${idx + 1}: ${line}`)
280
- .join("\n");
281
- const additionalLinesMessage = totalLines > 10 ? `\n... +${totalLines - 10} lines` : "";
282
- return {
283
- success: true,
284
- output: `Contents of ${filePath}:\n${numberedLines}${additionalLinesMessage}`,
285
- };
286
- }
287
- else {
288
- return {
289
- success: false,
290
- error: `File or directory not found: ${filePath}`,
291
- };
292
- }
293
- }
294
- catch (error) {
295
- return {
296
- success: false,
297
- error: `Error viewing ${filePath}: ${error.message}`,
298
- };
299
- }
300
- }
301
- setApiKey(apiKey) {
302
- this.morphApiKey = apiKey;
303
- }
304
- getApiKey() {
305
- return this.morphApiKey;
306
- }
307
- }
308
- //# sourceMappingURL=morph-editor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"morph-editor.js","sourceRoot":"","sources":["../../src/tools/morph-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,MAAM,OAAO,eAAe;IAClB,mBAAmB,GAAG,mBAAmB,CAAC,WAAW,EAAE,CAAC;IACxD,WAAW,CAAS;IACpB,YAAY,GAAW,6BAA6B,CAAC;IAE7D,YAAY,MAAe;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC;QAC7D,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,OAAO,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,QAAQ,CACZ,UAAkB,EAClB,YAAoB,EACpB,QAAgB;QAEhB,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAE9C,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;gBACzC,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,mBAAmB,UAAU,EAAE;iBACvC,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,OAAO;oBACL,OAAO,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CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Session Recovery Component
3
- * Shows a prompt when a previous session is detected
4
- */
5
- import React from "react";
6
- interface SessionRecoveryProps {
7
- onResume: () => void;
8
- onNewSession: () => void;
9
- onViewHistory: () => void;
10
- }
11
- export declare function SessionRecovery({ onResume, onNewSession, onViewHistory, }: SessionRecoveryProps): React.JSX.Element | null;
12
- export default SessionRecovery;
@@ -1,93 +0,0 @@
1
- /**
2
- * Session Recovery Component
3
- * Shows a prompt when a previous session is detected
4
- */
5
- import React, { useState, useEffect } from "react";
6
- import { Box, Text, useInput } from "ink";
7
- import { getHistoryManager } from "../../utils/history-manager.js";
8
- function formatTimeAgo(date) {
9
- const now = new Date();
10
- const diffMs = now.getTime() - date.getTime();
11
- const diffMins = Math.floor(diffMs / 60000);
12
- const diffHours = Math.floor(diffMins / 60);
13
- const diffDays = Math.floor(diffHours / 24);
14
- if (diffMins < 1)
15
- return "just now";
16
- if (diffMins < 60)
17
- return `${diffMins}m ago`;
18
- if (diffHours < 24)
19
- return `${diffHours}h ago`;
20
- return `${diffDays}d ago`;
21
- }
22
- export function SessionRecovery({ onResume, onNewSession, onViewHistory, }) {
23
- const [selectedOption, setSelectedOption] = useState(0);
24
- const [sessionInfo, setSessionInfo] = useState(null);
25
- const options = [
26
- { key: "r", label: "Resume", description: "Continue previous session", action: onResume },
27
- { key: "n", label: "New", description: "Start fresh session", action: onNewSession },
28
- { key: "v", label: "View", description: "View history before deciding", action: onViewHistory },
29
- ];
30
- useEffect(() => {
31
- // Load session info
32
- const historyManager = getHistoryManager();
33
- const history = historyManager.loadHistory();
34
- if (history.length > 0) {
35
- const lastEntry = history[history.length - 1];
36
- setSessionInfo({
37
- messageCount: history.length,
38
- lastActive: new Date(lastEntry.timestamp),
39
- hasHistory: true,
40
- });
41
- }
42
- }, []);
43
- useInput((input, key) => {
44
- if (key.upArrow || (key.shift && key.tab)) {
45
- setSelectedOption((prev) => (prev > 0 ? prev - 1 : options.length - 1));
46
- return;
47
- }
48
- if (key.downArrow || key.tab) {
49
- setSelectedOption((prev) => (prev + 1) % options.length);
50
- return;
51
- }
52
- if (key.return) {
53
- options[selectedOption].action();
54
- return;
55
- }
56
- // Quick select by key
57
- const matchingOption = options.findIndex((opt) => opt.key.toLowerCase() === input.toLowerCase());
58
- if (matchingOption !== -1) {
59
- options[matchingOption].action();
60
- }
61
- });
62
- if (!sessionInfo?.hasHistory) {
63
- // No previous session, auto-continue to new session
64
- useEffect(() => {
65
- onNewSession();
66
- }, []);
67
- return null;
68
- }
69
- return (React.createElement(Box, { flexDirection: "column", paddingX: 2, paddingY: 1 },
70
- React.createElement(Box, { borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1, flexDirection: "column" },
71
- React.createElement(Box, { marginBottom: 1 },
72
- React.createElement(Text, { color: "cyan", bold: true }, "\u23EA Previous Session Detected")),
73
- React.createElement(Box, { flexDirection: "column", marginBottom: 1 },
74
- React.createElement(Box, null,
75
- React.createElement(Text, { color: "gray" }, "Last active: "),
76
- React.createElement(Text, { color: "white" }, formatTimeAgo(sessionInfo.lastActive))),
77
- React.createElement(Box, null,
78
- React.createElement(Text, { color: "gray" }, "Messages: "),
79
- React.createElement(Text, { color: "white" }, sessionInfo.messageCount))),
80
- React.createElement(Box, { flexDirection: "column", marginTop: 1 }, options.map((option, index) => (React.createElement(Box, { key: option.key, paddingLeft: 1 },
81
- React.createElement(Text, { color: selectedOption === index ? "black" : "white", backgroundColor: selectedOption === index ? "cyan" : undefined, bold: selectedOption === index },
82
- "[",
83
- option.key.toUpperCase(),
84
- "] ",
85
- option.label),
86
- React.createElement(Text, { color: "gray" },
87
- " - ",
88
- option.description))))),
89
- React.createElement(Box, { marginTop: 1 },
90
- React.createElement(Text, { color: "gray", dimColor: true }, "\u2191\u2193 navigate \u2022 Enter select \u2022 or press R/N/V")))));
91
- }
92
- export default SessionRecovery;
93
- //# sourceMappingURL=session-recovery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"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oBACvC,oBAAC,IAAI,IAAC,KAAK,EAAC,OAAO,IAAE,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC,CAAQ,CAC9D;gBACN,oBAAC,GAAG;oBACF,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,iBAAkB;oBACpC,oBAAC,IAAI,IAAC,KAAK,EAAC,OAAO,IAAE,WAAW,CAAC,YAAY,CAAQ,CACjD,CACF;YAGN,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,IACrC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9B,oBAAC,GAAG,IAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC;gBAClC,oBAAC,IAAI,IACH,KAAK,EAAE,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACnD,eAAe,EAAE,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC9D,IAAI,EAAE,cAAc,KAAK,KAAK;;oBAE5B,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE;;oBAAI,MAAM,CAAC,KAAK,CACrC;gBACP,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM;;oBAAK,MAAM,CAAC,WAAW,CAAQ,CAC7C,CACP,CAAC,CACE;YAGN,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;gBACf,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,QAAQ,4EAEpB,CACH,CACF,CACF,CACP,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC"}
@@ -1,28 +0,0 @@
1
- import { UserSettings, ProjectSettings } from './settings-manager.js';
2
- export interface ModelOption {
3
- model: string;
4
- }
5
- export type ModelConfig = string;
6
- export { UserSettings, ProjectSettings };
7
- /**
8
- * Get the effective current model
9
- * Priority: project current model > user default model > system default
10
- */
11
- export declare function getCurrentModel(): string;
12
- /**
13
- * Load model configuration
14
- * Priority: user-settings.json models > default hardcoded
15
- */
16
- export declare function loadModelConfig(): ModelOption[];
17
- /**
18
- * Get default models list
19
- */
20
- export declare function getDefaultModels(): string[];
21
- /**
22
- * Update the current model in project settings
23
- */
24
- export declare function updateCurrentModel(modelName: string): void;
25
- /**
26
- * Update the user's default model preference
27
- */
28
- export declare function updateDefaultModel(modelName: string): void;