codemini-cli 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/commands/chat.js +1 -0
- package/src/commands/run.js +6 -2
- package/src/core/agent-loop.js +1 -1
- package/src/core/chat-runtime.js +546 -136
- package/src/core/config-store.js +30 -0
- package/src/core/memory-policy.js +27 -0
- package/src/core/memory-prompt.js +45 -0
- package/src/core/memory-store.js +181 -0
- package/src/core/paths.js +8 -0
- package/src/core/provider/anthropic.js +388 -0
- package/src/core/provider/index.js +37 -0
- package/src/core/tools.js +173 -0
- package/src/tui/chat-app.js +224 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codemini-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Coding CLI optimized for small-model workflows and Windows PowerShell",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@cursorless/tree-sitter-wasms": "^0.5.0",
|
|
50
|
+
"@anthropic-ai/sdk": "^0.82.0",
|
|
50
51
|
"ink": "^6.3.1",
|
|
51
52
|
"openai": "^6.33.0",
|
|
52
53
|
"react": "^19.0.0",
|
package/src/commands/chat.js
CHANGED
|
@@ -98,6 +98,7 @@ export async function handleChat(args) {
|
|
|
98
98
|
runtime,
|
|
99
99
|
sessionId: session.id,
|
|
100
100
|
model: parsed.model || config.model.name,
|
|
101
|
+
sdkProvider: config.sdk?.provider || 'openai-compatible',
|
|
101
102
|
language: config.ui?.language || 'zh',
|
|
102
103
|
shellName: config.shell?.default || 'powershell',
|
|
103
104
|
safeMode: config.policy?.safe_mode !== false,
|
package/src/commands/run.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { loadConfig } from '../core/config-store.js';
|
|
2
2
|
import { buildDefaultSystemPrompt } from '../core/default-system-prompt.js';
|
|
3
3
|
import { runAgentLoop } from '../core/agent-loop.js';
|
|
4
|
-
import { createChatCompletion } from '../core/provider/
|
|
4
|
+
import { createChatCompletion } from '../core/provider/index.js';
|
|
5
5
|
import { buildSystemPromptWithSoul } from '../core/soul.js';
|
|
6
6
|
import { getBuiltinTools } from '../core/tools.js';
|
|
7
|
+
import { buildMemorySnapshot } from '../core/memory-prompt.js';
|
|
7
8
|
|
|
8
9
|
function parseRunArgs(args) {
|
|
9
10
|
const parsed = {
|
|
@@ -39,7 +40,9 @@ export async function handleRun(args) {
|
|
|
39
40
|
workspaceRoot: process.cwd(),
|
|
40
41
|
config
|
|
41
42
|
});
|
|
42
|
-
const
|
|
43
|
+
const soulPrompt = await buildSystemPromptWithSoul(buildDefaultSystemPrompt(config), config);
|
|
44
|
+
const memorySnapshot = await buildMemorySnapshot({ config, workspaceRoot: process.cwd() }).catch(() => '');
|
|
45
|
+
const systemPrompt = [soulPrompt, memorySnapshot].filter(Boolean).join('\n\n');
|
|
43
46
|
|
|
44
47
|
const result = await runAgentLoop({
|
|
45
48
|
systemPrompt,
|
|
@@ -52,6 +55,7 @@ export async function handleRun(args) {
|
|
|
52
55
|
maxSteps: parsed.maxSteps,
|
|
53
56
|
requestCompletion: async ({ messages, tools, model }) =>
|
|
54
57
|
createChatCompletion({
|
|
58
|
+
sdkProvider: config.sdk?.provider,
|
|
55
59
|
baseUrl: config.gateway.base_url,
|
|
56
60
|
apiKey: config.gateway.api_key,
|
|
57
61
|
model,
|
package/src/core/agent-loop.js
CHANGED
|
@@ -691,7 +691,7 @@ export async function runAgentLoop({
|
|
|
691
691
|
const assistantText = completion.text || '';
|
|
692
692
|
lastAssistantText = assistantText || lastAssistantText;
|
|
693
693
|
|
|
694
|
-
const assistantMessage = { role: 'assistant', content: assistantText };
|
|
694
|
+
const assistantMessage = { role: 'assistant', content: completion?.content ?? assistantText };
|
|
695
695
|
if (toolCalls.length > 0) {
|
|
696
696
|
assistantMessage.tool_calls = toolCalls.map((tc) => ({
|
|
697
697
|
id: tc.id,
|