chatccc 0.2.42 → 0.2.43

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/src/index.ts CHANGED
@@ -41,6 +41,7 @@ import {
41
41
  CLAUDE_EFFORT,
42
42
  CLAUDE_MODEL,
43
43
  GIT_TIMEOUT_MS,
44
+ ALLOW_INTERRUPT,
44
45
  reloadConfigFromDisk,
45
46
  anthropicConfigDisplay,
46
47
  LOCAL_RELAY_URL,
@@ -574,6 +575,7 @@ async function handleCommand(text: string, chatId: string, openId: string, msgTi
574
575
  const running = chatSessionMap.get(chatId);
575
576
  const isActive = running && !running.stopped;
576
577
  const statusText = [
578
+ `**群名:** ${status?.chatName || "—"}`,
577
579
  `**Session ID:** \`${status?.sessionId ?? sessionId}\``,
578
580
  `**工具:** ${toolLabel}`,
579
581
  `**状态:** ${isActive ? "🟢 运行中" : "⚪ 空闲"}`,
@@ -656,9 +658,7 @@ async function handleCommand(text: string, chatId: string, openId: string, msgTi
656
658
  }
657
659
 
658
660
  const descPrefix = sessionPrefixForTool(descriptionTool);
659
- const newName = isUntitledSessionChatName(chatInfo.name)
660
- ? sessionChatName("新会话", cwd)
661
- : chatInfo.name;
661
+ const newName = sessionChatName("新会话", cwd);
662
662
  await updateChatInfo(freshToken, chatId, newName, `${descPrefix} ${newSessionId}`);
663
663
  console.log(`[${ts()}] [FORGET] Group updated: name="${newName}" desc="${descPrefix} ${newSessionId}"`);
664
664
 
@@ -736,9 +736,7 @@ async function handleCommand(text: string, chatId: string, openId: string, msgTi
736
736
  }
737
737
 
738
738
  const descPrefix2 = sessionPrefixForTool(target.tool);
739
- const newName2 = isUntitledSessionChatName(chatInfo.name)
740
- ? sessionChatName("新会话", cwd2)
741
- : chatInfo.name;
739
+ const newName2 = sessionChatName("新会话", cwd2);
742
740
  await updateChatInfo(freshToken, chatId, newName2, `${descPrefix2} ${target.sessionId}`);
743
741
 
744
742
  sessionInfoMap.set(chatId, {
@@ -835,6 +833,18 @@ async function handleCommand(text: string, chatId: string, openId: string, msgTi
835
833
  console.log(`[${ts()}] [SKIP] Older message (${msgTimestamp} <= ${existing.msgTimestamp}), ignoring`);
836
834
  return;
837
835
  }
836
+
837
+ if (!ALLOW_INTERRUPT) {
838
+ logTrace(tid, "BLOCKED", { outcome: "interrupt_disabled", sessionId });
839
+ console.log(`[${ts()}] [BLOCKED] allowInterrupt=false, ignoring message during generation. Hint sent to user.`);
840
+ await sendCardReply(
841
+ freshToken, chatId, "生成中",
842
+ "AI 正在生成回复中,请先点击卡片上的「停止」按钮停止当前生成后,再发送新消息。",
843
+ "yellow"
844
+ );
845
+ return;
846
+ }
847
+
838
848
  existing.stopped = true;
839
849
  if (existing.spinnerTimer) { clearInterval(existing.spinnerTimer); existing.spinnerTimer = null; }
840
850
  existing.close();
package/src/session.ts CHANGED
@@ -739,6 +739,7 @@ export const UNKNOWN_MODEL_PLACEHOLDER = "—";
739
739
 
740
740
  export interface SessionStatus {
741
741
  sessionId: string;
742
+ chatName: string;
742
743
  running: boolean;
743
744
  turnCount: number;
744
745
  lastContextTokens: number;
@@ -785,8 +786,12 @@ export async function getSessionStatus(chatId: string): Promise<SessionStatus |
785
786
  const active = chatSessionMap.get(chatId);
786
787
  const { model, effort } = await resolveModelEffort(info.tool, info.sessionId);
787
788
 
789
+ const registry = await loadSessionRegistry();
790
+ const chatName = registry[chatId]?.chatName ?? "";
791
+
788
792
  return {
789
793
  sessionId: info.sessionId,
794
+ chatName,
790
795
  running: active !== undefined && !active.stopped,
791
796
  turnCount: info.turnCount,
792
797
  lastContextTokens: info.lastContextTokens,