chatccc 0.2.254 → 0.2.255

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.
@@ -98,7 +98,9 @@ $env:DEEPCCC_STREAMING="true"
98
98
  `rawStreamLogs.enabled` 默认 `true`,通过 `DEEPCCC_RAW_STREAM_LOGS` 环境变量或配置 JSON 关闭。
99
99
  开启时,每次对话的原始流按 gzip JSONL 落到 `~/.deepccc/raw-stream-logs/`,供
100
100
  `session_search` 工具在会话被压缩后找回被压缩消息的精确原文(检索时设置
101
- `include_raw_logs=true`)。关闭后,压缩后的旧消息原文将无法找回。
101
+ `include_raw_logs=true`)。压缩后注入的恢复提示会携带当前会话 ID:优先用
102
+ `session_id` 限定只搜当前会话,未命中时可省略 `session_id` 做全库检索。
103
+ 关闭后,压缩后的旧消息原文将无法找回。
102
104
 
103
105
  ## 命令行交互
104
106
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepccc",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "A lightweight coding agent with OpenAI-compatible and Anthropic Messages API support.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -61,13 +61,16 @@ const SUMMARY_SYSTEM_PROMPT = [
61
61
  /**
62
62
  * 压缩后注入的恢复提示(lead-in,对齐业界 Codex 的 post-compaction lead-in 思路):
63
63
  * 只要会话发生过压缩(存在摘要),就在摘要后告知模型可用 session_search 找回原文。
64
- * 这样模型在后续每一轮都知道"较早消息已压缩、原文可检索",而不是把恢复完全
65
- * 外包给模型的自发判断。
64
+ * 提示动态携带当前会话 ID:模型可优先用 session_id 限定只搜当前会话,
65
+ * 未命中时也可省略 session_id 退化全库检索。这样模型在后续每一轮都知道
66
+ * "较早消息已压缩、原文可检索",而不是把恢复完全外包给模型的自发判断。
66
67
  */
67
- const COMPACTION_RECOVERY_HINT_ENABLED = [
68
- "[系统提示] 本会话较早的消息已压缩为摘要。",
69
- "如需找回被压缩消息的精确原文,可调用 session_search 工具检索本会话,并设置 include_raw_logs=true 以扫描本地 gzip 原始流日志。",
70
- ].join("\n");
68
+ function buildCompactionRecoveryHint(sessionId) {
69
+ return [
70
+ "[系统提示] 本会话较早的消息已压缩为摘要。当前会话 ID:" + sessionId + "。",
71
+ `如需找回被压缩消息的精确原文,优先调用 session_search 工具并设置 session_id="${sessionId}"(仅检索当前会话);若未命中,可省略 session_id 做全库检索(较慢)。检索时请设置 include_raw_logs=true 以扫描本地 gzip 原始流日志。`,
72
+ ].join("\n");
73
+ }
71
74
  const COMPACTION_RECOVERY_HINT_DISABLED = [
72
75
  "[系统提示] 本会话较早的消息已压缩为摘要,原始消息未保留(raw stream logs 已关闭)。",
73
76
  ].join("\n");
@@ -139,16 +142,18 @@ function addAnthropicToolJsonCompatibilityNote(messages) {
139
142
  }
140
143
  /**
141
144
  * 压缩后恢复提示注入:只要会话存在摘要(即发生过压缩),就在摘要消息后追加
142
- * 一条提示,告知模型可用 session_search(include_raw_logs=true)找回被压缩的原文。
143
- * 提示内容随 raw stream logs 开关动态切换,避免关闭日志时给出误导性承诺。
145
+ * 一条提示,告知模型可用 session_search 找回被压缩的原文。
146
+ * - raw stream logs 开启:提示携带当前会话 ID,优先 session_id 限定当前会话,
147
+ * 未命中时可省略 session_id 做全库检索;
148
+ * - raw stream logs 关闭:仅告知原文未保留,不给出误导性承诺。
144
149
  */
145
- function maybeAppendCompactionRecoveryHint(messages, summary, rawLogsEnabled) {
150
+ function maybeAppendCompactionRecoveryHint(messages, summary, rawLogsEnabled, sessionId) {
146
151
  if (!summary.trim())
147
152
  return messages;
148
153
  const summaryIndex = messages.findIndex((message) => message.role === "user" && message.content.startsWith("以下是更早的对话摘要"));
149
154
  if (summaryIndex < 0)
150
155
  return messages;
151
- const hint = rawLogsEnabled ? COMPACTION_RECOVERY_HINT_ENABLED : COMPACTION_RECOVERY_HINT_DISABLED;
156
+ const hint = rawLogsEnabled ? buildCompactionRecoveryHint(sessionId) : COMPACTION_RECOVERY_HINT_DISABLED;
152
157
  return messages.map((message, index) => (index === summaryIndex
153
158
  ? { ...message, content: `${message.content}\n\n${hint}` }
154
159
  : message));
@@ -333,7 +338,7 @@ export class ChatSession {
333
338
  const system = this.buildSystemPrompt(skills);
334
339
  this.systemPrompt = system;
335
340
  const contextMessages = this.context.buildModelMessages();
336
- const hintedMessages = maybeAppendCompactionRecoveryHint(contextMessages, this.context.summary, appConfig.rawStreamLogs.enabled);
341
+ const hintedMessages = maybeAppendCompactionRecoveryHint(contextMessages, this.context.summary, appConfig.rawStreamLogs.enabled, this.context.sessionId);
337
342
  const modelMessages = this.provider === "anthropic"
338
343
  ? addAnthropicToolJsonCompatibilityNote(hintedMessages)
339
344
  : hintedMessages;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatccc",
3
- "version": "0.2.254",
3
+ "version": "0.2.255",
4
4
  "description": "Feishu bot bridge for Claude Code",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",