mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
chore: Pi 开发依赖跟随最新版并去掉测试里的固定版本号
- pi-hermes-memory / pi-notify / pi-permission-system / pi-subagents 的 @earendil-works/* devDependencies 改为 latest,pi-rtk-optimizer 放开 peer 范围;各子包锁文件刷新到 Pi 1.3.0,测试改为验证当前宿主 API。 - 新增 scripts/update-pi-devdeps.sh,统一刷新根与子包锁文件中的 Pi 版本。 - pi-subagents 适配 Pi 1.3:mention clone 改走 systemPromptOverride、 BOM frontmatter、e2e 读取规范化后的 system 消息与工具列表。 - 根测试不再写死 ssh2 / jiti / better-sqlite3 / context-mode 版本号, 改为精确版本格式与锁文件一致性断言;新增 latest 约束测试。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
ba164896d2
commit
b817d66a11
@@ -17,10 +17,14 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
// Hoisted: vi.mock's factory is lifted above the imports, so it cannot close
|
||||
// over ordinary top-level consts.
|
||||
const { buildSessionContext, createAgentSession, inMemory } = vi.hoisted(() => ({
|
||||
const { buildSessionContext, createAgentSession, inMemory, loaderOptions } = vi.hoisted(() => ({
|
||||
buildSessionContext: vi.fn(),
|
||||
createAgentSession: vi.fn(),
|
||||
inMemory: vi.fn(),
|
||||
// The clone's prompt reaches the session through the loader's
|
||||
// systemPromptOverride (Pi 1.3 made AgentState.systemPrompt read-only), so
|
||||
// capture what runMentionClone hands DefaultResourceLoader.
|
||||
loaderOptions: { current: undefined as Record<string, unknown> | undefined },
|
||||
}));
|
||||
|
||||
vi.mock("@earendil-works/pi-coding-agent", async () => {
|
||||
@@ -29,6 +33,12 @@ vi.mock("@earendil-works/pi-coding-agent", async () => {
|
||||
...actual,
|
||||
buildSessionContext,
|
||||
createAgentSession,
|
||||
DefaultResourceLoader: class extends actual.DefaultResourceLoader {
|
||||
constructor(options?: Record<string, unknown>) {
|
||||
loaderOptions.current = options;
|
||||
super(options);
|
||||
}
|
||||
},
|
||||
SessionManager: { ...actual.SessionManager, inMemory },
|
||||
};
|
||||
});
|
||||
@@ -44,6 +54,7 @@ const CONVERSATION = [
|
||||
|
||||
beforeEach(() => {
|
||||
createAgentSession.mockReset();
|
||||
loaderOptions.current = undefined;
|
||||
inMemory.mockReset();
|
||||
inMemory.mockReturnValue({ kind: "in-memory-session-manager" } as any);
|
||||
buildSessionContext.mockReset();
|
||||
@@ -104,6 +115,13 @@ function cloneSession(turn?: (tool: any) => Promise<void> | void) {
|
||||
dispose: vi.fn(),
|
||||
} as any;
|
||||
createAgentSession.mockImplementation(async (opts: any) => {
|
||||
// What the real wiring does: the loader's systemPromptOverride rewrites the
|
||||
// rebuilt base before the session's state gets it.
|
||||
const override = loaderOptions.current?.systemPromptOverride as
|
||||
| ((base: string | undefined) => string | undefined)
|
||||
| undefined;
|
||||
const overridden = override?.(session.agent.state.systemPrompt);
|
||||
if (overridden !== undefined) session.agent.state.systemPrompt = overridden;
|
||||
const tools = visibleTools(opts);
|
||||
session.prompt.mockImplementation(async () => {
|
||||
// No tool, no tool call: the model can only answer in prose.
|
||||
|
||||
Reference in New Issue
Block a user