@csmedeiros/codemax 1.0.3 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -20
- package/launcher.js +28 -0
- package/package.json +15 -121
- package/LICENSE +0 -21
- package/dist/commands/cursorRules.d.ts +0 -15
- package/dist/commands/cursorRules.js +0 -118
- package/dist/commands/slashCommands.d.ts +0 -36
- package/dist/commands/slashCommands.js +0 -236
- package/dist/configuration/configManager.d.ts +0 -32
- package/dist/configuration/configManager.js +0 -71
- package/dist/configuration/modelContextWindows.d.ts +0 -3
- package/dist/configuration/modelContextWindows.js +0 -13
- package/dist/conversation/agentGraph.d.ts +0 -203
- package/dist/conversation/agentGraph.js +0 -433
- package/dist/conversation/agentTurn.d.ts +0 -40
- package/dist/conversation/agentTurn.js +0 -252
- package/dist/conversation/chatHistory.d.ts +0 -24
- package/dist/conversation/chatHistory.js +0 -251
- package/dist/conversation/compactionUtils.d.ts +0 -17
- package/dist/conversation/compactionUtils.js +0 -57
- package/dist/conversation/prompts/planPrompt.d.ts +0 -1
- package/dist/conversation/prompts/planPrompt.js +0 -12
- package/dist/conversation/prompts/systemPrompt.d.ts +0 -29
- package/dist/conversation/prompts/systemPrompt.js +0 -149
- package/dist/entry/cli.d.ts +0 -2
- package/dist/entry/cli.js +0 -24
- package/dist/observability/langfuseTracing.d.ts +0 -5
- package/dist/observability/langfuseTracing.js +0 -76
- package/dist/shared/types.d.ts +0 -25
- package/dist/shared/types.js +0 -1
- package/dist/terminal/app.d.ts +0 -2
- package/dist/terminal/app.js +0 -1236
- package/dist/terminal/components.d.ts +0 -18
- package/dist/terminal/components.js +0 -43
- package/dist/terminal/markdown.d.ts +0 -4
- package/dist/terminal/markdown.js +0 -47
- package/dist/terminal/screens/compactionSettings.d.ts +0 -6
- package/dist/terminal/screens/compactionSettings.js +0 -66
- package/dist/terminal/screens/modelSettings.d.ts +0 -10
- package/dist/terminal/screens/modelSettings.js +0 -76
- package/dist/terminal/textField.d.ts +0 -7
- package/dist/terminal/textField.js +0 -136
- package/dist/terminal/theme.d.ts +0 -23
- package/dist/terminal/theme.js +0 -23
- package/dist/tooling/mcpConfig.d.ts +0 -40
- package/dist/tooling/mcpConfig.js +0 -49
- package/dist/tooling/planControlChannel.d.ts +0 -2
- package/dist/tooling/planControlChannel.js +0 -21
- package/dist/tooling/toolConfig.d.ts +0 -42
- package/dist/tooling/toolConfig.js +0 -138
- package/dist/tooling/toolUiCallback.d.ts +0 -21
- package/dist/tooling/toolUiCallback.js +0 -268
- package/dist/tooling/tools.d.ts +0 -216
- package/dist/tooling/tools.js +0 -614
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
import dotenv from 'dotenv';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
// Try loading .env from core/ or from the project root for initial defaults
|
|
9
|
-
for (const envPath of [
|
|
10
|
-
path.resolve(__dirname, '../.env'),
|
|
11
|
-
path.resolve(__dirname, '../../.env'),
|
|
12
|
-
]) {
|
|
13
|
-
dotenv.config({ path: envPath });
|
|
14
|
-
}
|
|
15
|
-
const ConfigSchema = z.object({
|
|
16
|
-
modelName: z.string().default('zai-org/GLM-4.7'),
|
|
17
|
-
baseURL: z.string().default(process.env['DEEPINFRABASE_BASE_URL'] || ''),
|
|
18
|
-
apiKey: z.string().default(process.env['DEEPINFRABASE_API_KEY'] || ''),
|
|
19
|
-
renderMarkdown: z.boolean().default(true),
|
|
20
|
-
debugEvents: z
|
|
21
|
-
.boolean()
|
|
22
|
-
.default(process.env['CODEMAX_DEBUG_EVENTS'] === '1' ||
|
|
23
|
-
process.env['CODEMAX_DEBUG_EVENTS'] === 'true'),
|
|
24
|
-
recursionLimit: z
|
|
25
|
-
.number()
|
|
26
|
-
.int()
|
|
27
|
-
.positive()
|
|
28
|
-
.default(Number(process.env['CODEMAX_RECURSION_LIMIT'] ?? '150')),
|
|
29
|
-
compactionThreshold: z.number().min(0).max(1).default(0.5),
|
|
30
|
-
});
|
|
31
|
-
const configDir = path.join(os.homedir(), '.codemax');
|
|
32
|
-
const configPath = path.join(configDir, 'config.json');
|
|
33
|
-
let currentConfig;
|
|
34
|
-
export function loadConfig() {
|
|
35
|
-
try {
|
|
36
|
-
if (fs.existsSync(configPath)) {
|
|
37
|
-
const raw = fs.readFileSync(configPath, 'utf-8');
|
|
38
|
-
const parsed = JSON.parse(raw);
|
|
39
|
-
currentConfig = ConfigSchema.parse(parsed);
|
|
40
|
-
return currentConfig;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
console.error(`\n[CodeMax] Error reading or parsing config at ${configPath}. Reverting to defaults.\n`);
|
|
45
|
-
}
|
|
46
|
-
currentConfig = ConfigSchema.parse({});
|
|
47
|
-
saveConfig(currentConfig);
|
|
48
|
-
return currentConfig;
|
|
49
|
-
}
|
|
50
|
-
export function saveConfig(config) {
|
|
51
|
-
try {
|
|
52
|
-
const next = ConfigSchema.parse({ ...currentConfig, ...config });
|
|
53
|
-
if (!fs.existsSync(configDir)) {
|
|
54
|
-
fs.mkdirSync(configDir, { recursive: true });
|
|
55
|
-
}
|
|
56
|
-
fs.writeFileSync(configPath, JSON.stringify(next, null, 2), 'utf-8');
|
|
57
|
-
currentConfig = next;
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
console.error(`\n[CodeMax] Error saving config to ${configPath}\n`, e);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export function getConfig() {
|
|
64
|
-
if (!currentConfig) {
|
|
65
|
-
loadConfig();
|
|
66
|
-
}
|
|
67
|
-
return currentConfig;
|
|
68
|
-
}
|
|
69
|
-
export function updateConfig(config) {
|
|
70
|
-
saveConfig(config);
|
|
71
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const MODEL_CONTEXT_WINDOWS = {
|
|
2
|
-
'zai-org/GLM-4.7': 128000,
|
|
3
|
-
'zai-org/GLM-4.6': 200000,
|
|
4
|
-
'zai-org/GLM-4.5': 128000,
|
|
5
|
-
'deepseek-ai/DeepSeek-V3': 128000,
|
|
6
|
-
'deepseek-ai/DeepSeek-R1': 128000,
|
|
7
|
-
'meta-llama/Meta-Llama-3.1-405B-Instruct': 128000,
|
|
8
|
-
'Qwen/Qwen2.5-72B-Instruct': 32768,
|
|
9
|
-
};
|
|
10
|
-
export const DEFAULT_CONTEXT_WINDOW = 128000;
|
|
11
|
-
export function getContextWindow(modelName) {
|
|
12
|
-
return MODEL_CONTEXT_WINDOWS[modelName] ?? DEFAULT_CONTEXT_WINDOW;
|
|
13
|
-
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LangChain agent graph (StateGraph + tools).
|
|
3
|
-
*/
|
|
4
|
-
import { BaseMessage } from '@langchain/core/messages';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { ChatOpenAI } from '@langchain/openai';
|
|
7
|
-
import { estimateTokens, shouldCompactMessages, computeKeepStart } from './compactionUtils.js';
|
|
8
|
-
export { estimateTokens, shouldCompactMessages, computeKeepStart };
|
|
9
|
-
export declare const COMPACTION_SUMMARY_SENTINEL = "[COMPACTION_SUMMARY]";
|
|
10
|
-
declare let model: ChatOpenAI;
|
|
11
|
-
export declare function initModel(): void;
|
|
12
|
-
export declare function updateModelConfig(cfg: {
|
|
13
|
-
modelName?: string;
|
|
14
|
-
baseURL?: string;
|
|
15
|
-
apiKey?: string;
|
|
16
|
-
}): void;
|
|
17
|
-
export declare const ToolExecutionMode: z.ZodEnum<["auto", "ask", "edits", "plan"]>;
|
|
18
|
-
export type ToolExecutionMode = z.infer<typeof ToolExecutionMode>;
|
|
19
|
-
export declare const db: import('better-sqlite3').Database;
|
|
20
|
-
export { model };
|
|
21
|
-
export declare const agent: import("@langchain/langgraph").CompiledStateGraph<{
|
|
22
|
-
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
23
|
-
files: Record<string, string>;
|
|
24
|
-
toolExecutionMode: "auto" | "ask" | "edits" | "plan";
|
|
25
|
-
todos: {
|
|
26
|
-
status: "pending" | "in_progress" | "completed";
|
|
27
|
-
id: string;
|
|
28
|
-
task: string;
|
|
29
|
-
}[];
|
|
30
|
-
activeSkill: string | undefined;
|
|
31
|
-
forceCompact: boolean;
|
|
32
|
-
}, {
|
|
33
|
-
messages?: import("@langchain/langgraph").Messages | import("@langchain/langgraph").OverwriteValue<BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[]> | undefined;
|
|
34
|
-
files?: Record<string, string> | undefined;
|
|
35
|
-
toolExecutionMode?: "auto" | "ask" | "edits" | "plan" | undefined;
|
|
36
|
-
todos?: {
|
|
37
|
-
status: "pending" | "in_progress" | "completed";
|
|
38
|
-
id: string;
|
|
39
|
-
task: string;
|
|
40
|
-
}[] | undefined;
|
|
41
|
-
activeSkill?: string | undefined;
|
|
42
|
-
forceCompact?: boolean | undefined;
|
|
43
|
-
}, "tools" | "compactMessages" | "callModel" | "__start__", import("@langchain/langgraph/zod").InteropZodToStateDefinition<z.ZodObject<{
|
|
44
|
-
messages: import("@langchain/langgraph/zod").ReducedZodChannel<z.ZodType<BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[], z.ZodTypeDef, BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[]>, import("@langchain/core/utils/types").InteropZodType<import("@langchain/langgraph").Messages>>;
|
|
45
|
-
} & {
|
|
46
|
-
files: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
47
|
-
toolExecutionMode: z.ZodDefault<z.ZodEnum<["auto", "ask", "edits", "plan"]>>;
|
|
48
|
-
todos: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
49
|
-
id: z.ZodString;
|
|
50
|
-
task: z.ZodString;
|
|
51
|
-
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
|
|
52
|
-
}, "strip", z.ZodTypeAny, {
|
|
53
|
-
status: "pending" | "in_progress" | "completed";
|
|
54
|
-
id: string;
|
|
55
|
-
task: string;
|
|
56
|
-
}, {
|
|
57
|
-
status: "pending" | "in_progress" | "completed";
|
|
58
|
-
id: string;
|
|
59
|
-
task: string;
|
|
60
|
-
}>, "many">>;
|
|
61
|
-
activeSkill: z.ZodOptional<z.ZodString>;
|
|
62
|
-
forceCompact: z.ZodDefault<z.ZodBoolean>;
|
|
63
|
-
}, "strip", z.ZodTypeAny, {
|
|
64
|
-
files: Record<string, string>;
|
|
65
|
-
toolExecutionMode: "auto" | "ask" | "edits" | "plan";
|
|
66
|
-
todos: {
|
|
67
|
-
status: "pending" | "in_progress" | "completed";
|
|
68
|
-
id: string;
|
|
69
|
-
task: string;
|
|
70
|
-
}[];
|
|
71
|
-
forceCompact: boolean;
|
|
72
|
-
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
73
|
-
activeSkill?: string | undefined;
|
|
74
|
-
}, {
|
|
75
|
-
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
76
|
-
files?: Record<string, string> | undefined;
|
|
77
|
-
toolExecutionMode?: "auto" | "ask" | "edits" | "plan" | undefined;
|
|
78
|
-
todos?: {
|
|
79
|
-
status: "pending" | "in_progress" | "completed";
|
|
80
|
-
id: string;
|
|
81
|
-
task: string;
|
|
82
|
-
}[] | undefined;
|
|
83
|
-
activeSkill?: string | undefined;
|
|
84
|
-
forceCompact?: boolean | undefined;
|
|
85
|
-
}>, {
|
|
86
|
-
messages: import("@langchain/langgraph/zod").ReducedZodChannel<z.ZodType<BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[], z.ZodTypeDef, BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[]>, import("@langchain/core/utils/types").InteropZodType<import("@langchain/langgraph").Messages>>;
|
|
87
|
-
files: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
88
|
-
toolExecutionMode: z.ZodDefault<z.ZodEnum<["auto", "ask", "edits", "plan"]>>;
|
|
89
|
-
todos: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
90
|
-
id: z.ZodString;
|
|
91
|
-
task: z.ZodString;
|
|
92
|
-
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
|
|
93
|
-
}, "strip", z.ZodTypeAny, {
|
|
94
|
-
status: "pending" | "in_progress" | "completed";
|
|
95
|
-
id: string;
|
|
96
|
-
task: string;
|
|
97
|
-
}, {
|
|
98
|
-
status: "pending" | "in_progress" | "completed";
|
|
99
|
-
id: string;
|
|
100
|
-
task: string;
|
|
101
|
-
}>, "many">>;
|
|
102
|
-
activeSkill: z.ZodOptional<z.ZodString>;
|
|
103
|
-
forceCompact: z.ZodDefault<z.ZodBoolean>;
|
|
104
|
-
}>, import("@langchain/langgraph/zod").InteropZodToStateDefinition<z.ZodObject<{
|
|
105
|
-
messages: import("@langchain/langgraph/zod").ReducedZodChannel<z.ZodType<BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[], z.ZodTypeDef, BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[]>, import("@langchain/core/utils/types").InteropZodType<import("@langchain/langgraph").Messages>>;
|
|
106
|
-
} & {
|
|
107
|
-
files: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
108
|
-
toolExecutionMode: z.ZodDefault<z.ZodEnum<["auto", "ask", "edits", "plan"]>>;
|
|
109
|
-
todos: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
110
|
-
id: z.ZodString;
|
|
111
|
-
task: z.ZodString;
|
|
112
|
-
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
|
|
113
|
-
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
status: "pending" | "in_progress" | "completed";
|
|
115
|
-
id: string;
|
|
116
|
-
task: string;
|
|
117
|
-
}, {
|
|
118
|
-
status: "pending" | "in_progress" | "completed";
|
|
119
|
-
id: string;
|
|
120
|
-
task: string;
|
|
121
|
-
}>, "many">>;
|
|
122
|
-
activeSkill: z.ZodOptional<z.ZodString>;
|
|
123
|
-
forceCompact: z.ZodDefault<z.ZodBoolean>;
|
|
124
|
-
}, "strip", z.ZodTypeAny, {
|
|
125
|
-
files: Record<string, string>;
|
|
126
|
-
toolExecutionMode: "auto" | "ask" | "edits" | "plan";
|
|
127
|
-
todos: {
|
|
128
|
-
status: "pending" | "in_progress" | "completed";
|
|
129
|
-
id: string;
|
|
130
|
-
task: string;
|
|
131
|
-
}[];
|
|
132
|
-
forceCompact: boolean;
|
|
133
|
-
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
134
|
-
activeSkill?: string | undefined;
|
|
135
|
-
}, {
|
|
136
|
-
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
137
|
-
files?: Record<string, string> | undefined;
|
|
138
|
-
toolExecutionMode?: "auto" | "ask" | "edits" | "plan" | undefined;
|
|
139
|
-
todos?: {
|
|
140
|
-
status: "pending" | "in_progress" | "completed";
|
|
141
|
-
id: string;
|
|
142
|
-
task: string;
|
|
143
|
-
}[] | undefined;
|
|
144
|
-
activeSkill?: string | undefined;
|
|
145
|
-
forceCompact?: boolean | undefined;
|
|
146
|
-
}>, {
|
|
147
|
-
messages: import("@langchain/langgraph/zod").ReducedZodChannel<z.ZodType<BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[], z.ZodTypeDef, BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[]>, import("@langchain/core/utils/types").InteropZodType<import("@langchain/langgraph").Messages>>;
|
|
148
|
-
files: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
149
|
-
toolExecutionMode: z.ZodDefault<z.ZodEnum<["auto", "ask", "edits", "plan"]>>;
|
|
150
|
-
todos: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
151
|
-
id: z.ZodString;
|
|
152
|
-
task: z.ZodString;
|
|
153
|
-
status: z.ZodEnum<["pending", "in_progress", "completed"]>;
|
|
154
|
-
}, "strip", z.ZodTypeAny, {
|
|
155
|
-
status: "pending" | "in_progress" | "completed";
|
|
156
|
-
id: string;
|
|
157
|
-
task: string;
|
|
158
|
-
}, {
|
|
159
|
-
status: "pending" | "in_progress" | "completed";
|
|
160
|
-
id: string;
|
|
161
|
-
task: string;
|
|
162
|
-
}>, "many">>;
|
|
163
|
-
activeSkill: z.ZodOptional<z.ZodString>;
|
|
164
|
-
forceCompact: z.ZodDefault<z.ZodBoolean>;
|
|
165
|
-
}>, import("@langchain/langgraph").StateDefinition, {
|
|
166
|
-
callModel: Partial<{
|
|
167
|
-
files: Record<string, string>;
|
|
168
|
-
toolExecutionMode: "auto" | "ask" | "edits" | "plan";
|
|
169
|
-
todos: {
|
|
170
|
-
status: "pending" | "in_progress" | "completed";
|
|
171
|
-
id: string;
|
|
172
|
-
task: string;
|
|
173
|
-
}[];
|
|
174
|
-
forceCompact: boolean;
|
|
175
|
-
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
176
|
-
activeSkill?: string | undefined;
|
|
177
|
-
}>;
|
|
178
|
-
tools: Partial<{
|
|
179
|
-
files: Record<string, string>;
|
|
180
|
-
toolExecutionMode: "auto" | "ask" | "edits" | "plan";
|
|
181
|
-
todos: {
|
|
182
|
-
status: "pending" | "in_progress" | "completed";
|
|
183
|
-
id: string;
|
|
184
|
-
task: string;
|
|
185
|
-
}[];
|
|
186
|
-
forceCompact: boolean;
|
|
187
|
-
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
188
|
-
activeSkill?: string | undefined;
|
|
189
|
-
}>;
|
|
190
|
-
compactMessages: Partial<{
|
|
191
|
-
files: Record<string, string>;
|
|
192
|
-
toolExecutionMode: "auto" | "ask" | "edits" | "plan";
|
|
193
|
-
todos: {
|
|
194
|
-
status: "pending" | "in_progress" | "completed";
|
|
195
|
-
id: string;
|
|
196
|
-
task: string;
|
|
197
|
-
}[];
|
|
198
|
-
forceCompact: boolean;
|
|
199
|
-
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
200
|
-
activeSkill?: string | undefined;
|
|
201
|
-
}>;
|
|
202
|
-
}, unknown, unknown>;
|
|
203
|
-
export declare function triggerCompaction(threadId: string): Promise<void>;
|