chatccc 0.2.114 → 0.2.115

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 CHANGED
@@ -305,7 +305,7 @@ Codex 的默认模型和推理强度可继续由 `~/.codex/config.toml` 管理
305
305
  | `/newh` | 重置当前会话,保留工作目录 |
306
306
  | `/model` | 查看或切换当前会话的模型 |
307
307
  | `/stop` | 停止当前回复 |
308
- | `/status` | 查看当前会话状态 |
308
+ | `/state` | 查看当前会话状态 |
309
309
  | `/cd` | 查看或设置当前会话工作目录 |
310
310
  | `/sessions` | 查看所有会话状态 |
311
311
  | `/git <子命令>` | 在当前会话工作目录执行 `git ...` 并回传输出 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chatccc",
3
- "version": "0.2.114",
3
+ "version": "0.2.115",
4
4
  "description": "Feishu bot bridge for Claude Code",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -32,7 +32,7 @@ describe("cardJsonToPlainText", () => {
32
32
 
33
33
  expect(text).toContain("# 生成中...");
34
34
  expect(text).toContain("stream body");
35
- expect(text).toContain("/status");
35
+ expect(text).toContain("/state");
36
36
  expect(text).toContain("/stop");
37
37
  });
38
38
 
@@ -107,7 +107,7 @@ describe("buildProgressCard", () => {
107
107
  const parsed = JSON.parse(card);
108
108
  const buttons = parsed.body.elements.filter((e: any) => e.tag === "button");
109
109
  expect(buttons).toHaveLength(2);
110
- expect(buttons[0].text.content).toBe("查看状态(/status)");
110
+ expect(buttons[0].text.content).toBe("查看状态(/state)");
111
111
  expect(buttons[1].text.content).toBe("停止生成(/stop)");
112
112
  });
113
113
 
@@ -369,7 +369,7 @@ describe("createClaudeAdapter", () => {
369
369
  // -------------------------------------------------------------------------
370
370
  // getSessionInfo 行为契约
371
371
  // - cwd 决定 /git 是否可用
372
- // - model 用于 /status、/sessions 显示
372
+ // - model 用于 /state、/sessions 显示
373
373
  // -------------------------------------------------------------------------
374
374
 
375
375
  it("getSessionInfo: store 中无该 sessionId 时只返回 sessionId", async () => {
@@ -296,7 +296,7 @@ describe("createCursorAdapter", () => {
296
296
  // -------------------------------------------------------------------------
297
297
  // getSessionInfo 行为契约
298
298
  // - cwd 决定 /git 是否可用
299
- // - model 决定 /status、/sessions 显示的是否是 Cursor 真实模型
299
+ // - model 决定 /state、/sessions 显示的是否是 Cursor 真实模型
300
300
  // -------------------------------------------------------------------------
301
301
 
302
302
  it("getSessionInfo: store 中无该 sessionId 时只返回 sessionId(cwd / model 都 undefined,让上层走错误分支)", async () => {
@@ -316,7 +316,7 @@ describe("createCursorAdapter", () => {
316
316
  expect(info?.model).toBeUndefined();
317
317
  });
318
318
 
319
- it("getSessionInfo: store 同时有 cwd + model 时一并返回(这是 /status 显示真实模型的关键)", async () => {
319
+ it("getSessionInfo: store 同时有 cwd + model 时一并返回(这是 /state 显示真实模型的关键)", async () => {
320
320
  const store = createInMemoryMetaStore({
321
321
  "sid-known": { cwd: "F:/proj/Foo", model: "Composer 2 Fast" },
322
322
  });
@@ -1,7 +1,7 @@
1
1
  // =============================================================================
2
2
  // cursor-session-meta-store.test.ts — sessionId→{cwd,model} 持久化的护栏单测
3
3
  // =============================================================================
4
- // 行为契约(与 cursor-adapter.getSessionInfo 配合,决定 /git、/status、/sessions
4
+ // 行为契约(与 cursor-adapter.getSessionInfo 配合,决定 /git、/state、/sessions
5
5
  // 在 Cursor 会话上是否显示正确):
6
6
  // - 文件不存在 / 损坏 / 非法 schema 时 get 返回 undefined,不抛异常
7
7
  // - set 部分合并:只覆盖非空字段,已有字段保持不变
@@ -160,7 +160,7 @@ function mockSessionInfo(chatId: string, overrides: Partial<{
160
160
 
161
161
  /**
162
162
  * 简易 mock adapter:getSessionInfo 返回固定 SessionInfo,其他方法不实现
163
- * (仅 /status、/sessions 路径会触发 getSessionInfo,无需完整接口)。
163
+ * (仅 /state、/sessions 路径会触发 getSessionInfo,无需完整接口)。
164
164
  */
165
165
  function mockAdapter(getInfo: (sid: string) => SessionInfo | undefined): ToolAdapter {
166
166
  return {
@@ -597,7 +597,7 @@ describe("getSessionStatus", () => {
597
597
  });
598
598
 
599
599
  // -------------------------------------------------------------------------
600
- // model/effort 来源:按 tool 分支(核心契约——决定 /status 显示是否真实)
600
+ // model/effort 来源:按 tool 分支(核心契约——决定 /state 显示是否真实)
601
601
  // -------------------------------------------------------------------------
602
602
 
603
603
  it("Claude 会话:effort 非 null(始终显示该行);model 来自全局配置", async () => {
@@ -643,7 +643,7 @@ describe("getSessionStatus", () => {
643
643
  expect(status!.model).toBe(UNKNOWN_MODEL_PLACEHOLDER);
644
644
  });
645
645
 
646
- it("Cursor 会话:adapter.getSessionInfo 抛错时降级为占位符(不阻塞 /status)", async () => {
646
+ it("Cursor 会话:adapter.getSessionInfo 抛错时降级为占位符(不阻塞 /state)", async () => {
647
647
  mockSessionInfo("chat-cursor", { sessionId: "sid-cur", tool: "cursor" });
648
648
  _setAdapterForToolForTest(
649
649
  "cursor",
@@ -101,7 +101,7 @@ export interface CreateSessionResult {
101
101
  }
102
102
 
103
103
  // ---------------------------------------------------------------------------
104
- // SessionInfo — 会话元数据(/status、/cd 等命令使用)
104
+ // SessionInfo — 会话元数据(/state、/cd 等命令使用)
105
105
  // ---------------------------------------------------------------------------
106
106
 
107
107
  export interface SessionInfo {
@@ -113,7 +113,7 @@ export interface SessionInfo {
113
113
  * 会话实际使用的模型展示名(如 Cursor 的 `Composer 2 Fast`)。
114
114
  * - Cursor adapter:从 cursor-agent system/init 事件学习并持久化到 store
115
115
  * - Claude adapter:留空(model 由 ChatCCC 配置 `CLAUDE_MODEL` 决定,不从 SDK 取)
116
- * 上层 /status、/sessions 渲染时按 tool 决定显示哪一来源。
116
+ * 上层 /state、/sessions 渲染时按 tool 决定显示哪一来源。
117
117
  */
118
118
  model?: string;
119
119
  }
@@ -5,7 +5,7 @@
5
5
  // 内部已持久化)。Cursor CLI 没有等价机制,因此 ChatCCC 必须自己维护一份
6
6
  // sessionId → { cwd, model } 映射,否则:
7
7
  // 1. /git、/cd 等需要"会话真实工作目录"的命令将在 Cursor 会话上 100% 失败
8
- // 2. /status、/sessions 显示的"模型"只能硬塞 ChatCCC 的 ANTHROPIC 环境变量,
8
+ // 2. /state、/sessions 显示的"模型"只能硬塞 ChatCCC 的 ANTHROPIC 环境变量,
9
9
  // 与 Cursor 实际跑的 Composer 2 Fast 等真实模型无关
10
10
  //
11
11
  // 存储:
package/src/cards.ts CHANGED
@@ -89,7 +89,7 @@ export function buildProgressCard(
89
89
  elements.push({ tag: "hr" });
90
90
  elements.push({
91
91
  tag: "button",
92
- text: { tag: "plain_text", content: "查看状态(/status)" },
92
+ text: { tag: "plain_text", content: "查看状态(/state)" },
93
93
  type: "default",
94
94
  value: { action: "status" },
95
95
  element_id: "action_status",
package/src/index.ts CHANGED
@@ -287,7 +287,7 @@ function parseCardAction(data: unknown): CardActionResult | null {
287
287
  }
288
288
  if (!cmd) return null;
289
289
 
290
- const CMD_MAP: Record<string, string> = { stop: "/stop", cancel: "/cancel", new: "/new", "new claude": "/new claude", "new cursor": "/new cursor", "new codex": "/new codex", restart: "/restart", status: "/status", cd: "/cd", sessions: "/sessions", newh: "/newh" };
290
+ const CMD_MAP: Record<string, string> = { stop: "/stop", cancel: "/cancel", new: "/new", "new claude": "/new claude", "new cursor": "/new cursor", "new codex": "/new codex", restart: "/restart", status: "/state", cd: "/cd", sessions: "/sessions", newh: "/newh" };
291
291
  let text = CMD_MAP[cmd] ?? "";
292
292
  if (cmd === "cd" && typeof action.value === "object" && action.value !== null) {
293
293
  const path = (action.value as Record<string, string>).path;
@@ -739,8 +739,8 @@ export async function handleCommand(
739
739
  return;
740
740
  }
741
741
 
742
- if (textLower === "/status") {
743
- logTrace(tid, "BRANCH", { cmd: "/status" });
742
+ if (textLower === "/state") {
743
+ logTrace(tid, "BRANCH", { cmd: "/state" });
744
744
  const status = await getSessionStatus(chatId);
745
745
  const isActive = isSessionRunning(sessionId);
746
746
  const statusText = [
package/src/session.ts CHANGED
@@ -1549,7 +1549,7 @@ export function stopSession(sessionId: string): boolean {
1549
1549
  }
1550
1550
 
1551
1551
  // ---------------------------------------------------------------------------
1552
- // Session status query (供 /status、/sessions 命令使用)
1552
+ // Session status query (供 /state、/sessions 命令使用)
1553
1553
  // ---------------------------------------------------------------------------
1554
1554
  //
1555
1555
  // model / effort 的来源策略(按 tool 区分,避免硬塞 ChatCCC 全局配置导致显示
@@ -1590,7 +1590,7 @@ async function resolveModelEffort(
1590
1590
  const info = await adapter.getSessionInfo(sessionId);
1591
1591
  if (info?.model) model = info.model;
1592
1592
  } catch {
1593
- // adapter 异常时降级为占位符(不阻塞 /status 卡片)
1593
+ // adapter 异常时降级为占位符(不阻塞 /state 卡片)
1594
1594
  }
1595
1595
  return { model, effort: null };
1596
1596
  }