deepccc 0.1.13 → 0.1.14
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/dist/index.d.ts +13 -0
- package/dist/index.js +41 -16
- package/os-prompts/darwin.md +8 -0
- package/os-prompts/linux.md +8 -0
- package/os-prompts/win32.md +9 -0
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,19 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type PermissionMode, type PermissionResolver } from "./permissions.js";
|
|
7
7
|
export declare const DEFAULT_COMPACTION_TIMEOUT_MS: number;
|
|
8
|
+
/**
|
|
9
|
+
* 各操作系统特有的命令行指引(文本资产,维护在 os-prompts/ 目录,而非硬编码):
|
|
10
|
+
*
|
|
11
|
+
* - 内置文件:包内 os-prompts/<platform>.md(win32/darwin/linux),随 npm 包分发;
|
|
12
|
+
* - 用户覆盖:~/.deepccc/prompts/<platform>.md 存在时完全替代内置内容(可自定义)。
|
|
13
|
+
*
|
|
14
|
+
* 文件内容自带标题(如 "## Windows Command-Line Notes"),读取后 trim 直接作为
|
|
15
|
+
* 一个段落注入固定规则区(项目指令之前)。未知平台或文件缺失时返回空字符串。
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadPlatformCommandPrompt(platform?: string, dirs?: {
|
|
18
|
+
builtinDir?: string;
|
|
19
|
+
userDir?: string;
|
|
20
|
+
}): string;
|
|
8
21
|
export interface ChatSessionConfig {
|
|
9
22
|
/** OpenAI-compatible service base URL. Defaults to DEEPCCC_BASE_URL/config. */
|
|
10
23
|
baseURL?: string;
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
7
7
|
import { generateText, isLoopFinished, stepCountIs, streamText } from "ai";
|
|
8
|
-
import { readFileSync } from "node:fs";
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
9
10
|
import { join } from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
10
12
|
import { config as appConfig, RAW_STREAM_LOGS_DIR } from "./config.js";
|
|
11
13
|
import { createRawStreamLog, } from "./raw-stream-log.js";
|
|
12
14
|
import { buildPersistedAssistantMessage, buildSummaryPrompt, BuiltinContextManager, defaultBuiltinSessionId, } from "./context.js";
|
|
@@ -97,22 +99,45 @@ function buildRuntimeWorkspacePrompt(cwd) {
|
|
|
97
99
|
].join("\n");
|
|
98
100
|
}
|
|
99
101
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
102
|
+
* 各操作系统特有的命令行指引(文本资产,维护在 os-prompts/ 目录,而非硬编码):
|
|
103
|
+
*
|
|
104
|
+
* - 内置文件:包内 os-prompts/<platform>.md(win32/darwin/linux),随 npm 包分发;
|
|
105
|
+
* - 用户覆盖:~/.deepccc/prompts/<platform>.md 存在时完全替代内置内容(可自定义)。
|
|
106
|
+
*
|
|
107
|
+
* 文件内容自带标题(如 "## Windows Command-Line Notes"),读取后 trim 直接作为
|
|
108
|
+
* 一个段落注入固定规则区(项目指令之前)。未知平台或文件缺失时返回空字符串。
|
|
103
109
|
*/
|
|
104
|
-
function
|
|
105
|
-
|
|
110
|
+
export function loadPlatformCommandPrompt(platform = process.platform, dirs = {}) {
|
|
111
|
+
const filename = platform === "win32" ? "win32.md" :
|
|
112
|
+
platform === "darwin" ? "darwin.md" :
|
|
113
|
+
platform === "linux" ? "linux.md" :
|
|
114
|
+
null;
|
|
115
|
+
if (!filename)
|
|
106
116
|
return "";
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
// import.meta.url 定位包根:chatccc 源码运行时指向 deepccc-agent/os-prompts/,
|
|
118
|
+
// deepccc dist 运行时指向包根 os-prompts/(dist/index.js 的 ../os-prompts/)。
|
|
119
|
+
const builtinDir = dirs.builtinDir ?? fileURLToPath(new URL("../os-prompts/", import.meta.url));
|
|
120
|
+
const userDir = dirs.userDir ?? join(homedir(), ".deepccc", "prompts");
|
|
121
|
+
// 用户覆盖优先;读取失败时静默回退内置,内置也失败则返回空。
|
|
122
|
+
const userFile = join(userDir, filename);
|
|
123
|
+
if (existsSync(userFile)) {
|
|
124
|
+
try {
|
|
125
|
+
return readFileSync(userFile, "utf-8").trim();
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// fall through to builtin
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const builtinFile = join(builtinDir, filename);
|
|
132
|
+
if (existsSync(builtinFile)) {
|
|
133
|
+
try {
|
|
134
|
+
return readFileSync(builtinFile, "utf-8").trim();
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return "";
|
|
116
141
|
}
|
|
117
142
|
function normalizeMaxSteps(value) {
|
|
118
143
|
if (value === undefined)
|
|
@@ -175,7 +200,7 @@ export class ChatSession {
|
|
|
175
200
|
*/
|
|
176
201
|
buildSystemPrompt(skills) {
|
|
177
202
|
const systemContent = [SYSTEM_PROMPT];
|
|
178
|
-
const platformPrompt =
|
|
203
|
+
const platformPrompt = loadPlatformCommandPrompt();
|
|
179
204
|
if (platformPrompt) {
|
|
180
205
|
systemContent.push("", platformPrompt);
|
|
181
206
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## macOS Command-Line Notes
|
|
2
|
+
|
|
3
|
+
You are running on macOS. run_command executes through zsh, a POSIX shell. Quoting follows standard POSIX conventions (the same habits you already know from bash):
|
|
4
|
+
|
|
5
|
+
- Double quotes are stripped and group an argument containing spaces: `echo "hello world"` prints `hello world`.
|
|
6
|
+
- Single quotes are literal quoting characters: `'a b'` is a single argument `a b`.
|
|
7
|
+
- Backticks and `$(...)` perform command substitution; quote them if you need literal text.
|
|
8
|
+
- Paths use `/` separators and `~` expands to the home directory.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## Linux Command-Line Notes
|
|
2
|
+
|
|
3
|
+
You are running on Linux. run_command executes through a POSIX shell (bash/sh). Quoting follows standard POSIX conventions (the same habits you already know from bash):
|
|
4
|
+
|
|
5
|
+
- Double quotes are stripped and group an argument containing spaces: `echo "hello world"` prints `hello world`.
|
|
6
|
+
- Single quotes are literal quoting characters: `'a b'` is a single argument `a b`.
|
|
7
|
+
- Backticks and `$(...)` perform command substitution; quote them if you need literal text.
|
|
8
|
+
- Paths use `/` separators and `~` expands to the home directory.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## Windows Command-Line Notes
|
|
2
|
+
|
|
3
|
+
You are running on Windows. run_command executes through cmd.exe, not bash. cmd quoting differs from bash and breaks common habits:
|
|
4
|
+
|
|
5
|
+
- Double quotes are NOT stripped: `echo "hello world"` prints `"hello world"` (quotes included), and `"a b" "c"` passes the literal arguments `"a b"` and `"c"` (quotes included) to the program.
|
|
6
|
+
- Single quotes are NOT quoting characters in cmd.exe: `'a b'` is parsed as two arguments (`'a` and `b'`).
|
|
7
|
+
- Multi-line or quote-heavy inline scripts (python -c "...\n...", ssh host "bash -c '...'") frequently break under cmd quoting; write the script to a temporary file and execute that file instead.
|
|
8
|
+
- PowerShell-only syntax (Get-Item, 2>$null, Select-Object) is unavailable; the shell is cmd.exe unless you explicitly invoke powershell.
|
|
9
|
+
- To pass an argument containing spaces, use double quotes and expect the quotes to reach the program literally; when the target accepts file input, prefer writing the value to a file.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepccc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "A lightweight DeepSeek-optimized coding agent with OpenAI-compatible model support.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"dist/",
|
|
35
35
|
"bin/",
|
|
36
36
|
"docs/",
|
|
37
|
+
"os-prompts/",
|
|
37
38
|
"package.json",
|
|
38
39
|
"README.md",
|
|
39
40
|
"LICENSE"
|