Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(tools): allow pi session history filter

Zhao Dengfengbebdc4eba4c9
diff --git a/packages/lizi-mcps/src/__tests__/listSessionsTool.test.ts b/packages/lizi-mcps/src/__tests__/listSessionsTool.test.ts
index 96a106464a..a56114327d 100644
--- a/packages/lizi-mcps/src/__tests__/listSessionsTool.test.ts
+++ b/packages/lizi-mcps/src/__tests__/listSessionsTool.test.ts
@@ -63,6 +63,24 @@ function historyWithSessions(): XdtHelperHistoryDeps {
};
}
+describe("list_sessions agent_kind", () => {
+ it("passes the pi filter through registry validation to the host", async () => {
+ const history = historyWithSessions();
+ const registry = new XdtHelperToolRegistry();
+ registerListSessionsTool(registry, { history });
+
+ expect(registry.get("list_sessions")?.description).toContain(
+ "agent_kind: cc(Claude Code) | codex | pi",
+ );
+ const result = await registry.call("list_sessions", { agent_kind: "pi" });
+
+ expect(parse(result)).toMatchObject({ ok: true });
+ expect(history.listSessions).toHaveBeenCalledWith(
+ expect.objectContaining({ agentKind: "pi" }),
+ );
+ });
+});
+
describe("list_sessions queuedCount", () => {
it("adds live queuedCount values for the returned page", async () => {
const sessionQueue: SessionQueueDeps = {
diff --git a/packages/lizi-mcps/src/xdt-helper/list_sessions.ts b/packages/lizi-mcps/src/xdt-helper/list_sessions.ts
index 87e16eeae6..43121af459 100644
--- a/packages/lizi-mcps/src/xdt-helper/list_sessions.ts
+++ b/packages/lizi-mcps/src/xdt-helper/list_sessions.ts
@@ -35,7 +35,7 @@ const DESCRIPTION = [
'【过滤参数】所有参数可任意组合, 不传 = 不过滤:',
' - workdir: 精确匹配 sessions.workingDir',
' - from / to: ISO 8601 时间窗 (from 含, to 不含), 按 time_field 过滤(默认创建时间,activity 为最近活动)',
- ' - agent_kind: cc(Claude Code) | codex',
+ ' - agent_kind: cc(Claude Code) | codex | pi',
' - include_deleted: 默认 false (排除 status=deleted)',
'',
'【输出】messageCount 已过滤被 rewind 软删的消息, 是用户可见的真实条数。',
@@ -78,9 +78,9 @@ export function registerListSessionsTool(
.optional()
.describe('ISO 8601 时间字符串(不含), 过滤所选 time_field < to。'),
agent_kind: z
- .enum(['cc', 'codex'])
+ .enum(['cc', 'codex', 'pi'])
.optional()
- .describe('过滤 agent 类型, 不传 = 两者都返。'),
+ .describe('过滤 agent 类型, 不传 = 全部返回。'),
include_deleted: z
.boolean()
.default(false)