chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
@@ -25,6 +25,7 @@ function createSession(options: {
|
||||
compactionUsage?: AssistantUsage;
|
||||
toolUsage?: AssistantUsage;
|
||||
usingSubscription?: boolean;
|
||||
routedModel?: { model: { id: string }; thinkingLevel?: string };
|
||||
}): AgentSession {
|
||||
const usage = options.usage;
|
||||
const entries: Array<Record<string, unknown>> = [];
|
||||
@@ -75,10 +76,14 @@ function createSession(options: {
|
||||
},
|
||||
sessionManager: {
|
||||
getEntries: () => entries,
|
||||
getEntryCount: () => entries.length,
|
||||
getSessionId: () => "test-session",
|
||||
getLeafId: () => null,
|
||||
getSessionName: () => options.sessionName,
|
||||
getCwd: () => "/tmp/project",
|
||||
},
|
||||
getContextUsage: () => ({ contextWindow: 200_000, percent: 12.3 }),
|
||||
routedModel: options.routedModel,
|
||||
modelRuntime: {
|
||||
isUsingSubscription: () => options.usingSubscription ?? false,
|
||||
},
|
||||
@@ -152,6 +157,21 @@ describe("FooterComponent width handling", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("shows the physical model a virtual model routed to", () => {
|
||||
const session = createSession({
|
||||
sessionName: "",
|
||||
modelId: "auto",
|
||||
reasoning: true,
|
||||
thinkingLevel: "high",
|
||||
routedModel: { model: { id: "gpt-5.6-luna" }, thinkingLevel: "medium" },
|
||||
});
|
||||
const footer = new FooterComponent(session, createFooterData(1));
|
||||
|
||||
const statsLine = stripAnsi(footer.render(120)[1]);
|
||||
|
||||
expect(statsLine).toContain("auto \u2022 high \u2192 gpt-5.6-luna \u2022 medium");
|
||||
});
|
||||
|
||||
it("includes summary and tool result usage in the total cost", () => {
|
||||
const session = createSession({
|
||||
sessionName: "",
|
||||
@@ -190,6 +210,16 @@ describe("FooterComponent width handling", () => {
|
||||
expect(statsLine).toContain("$1.250");
|
||||
});
|
||||
|
||||
it("updates cached usage totals after an entry is appended", () => {
|
||||
const usage = { input: 10, output: 1, cacheRead: 0, cacheWrite: 0, cost: { total: 0.5 } };
|
||||
const session = createSession({ sessionName: "", usage });
|
||||
const footer = new FooterComponent(session, createFooterData(1));
|
||||
expect(stripAnsi(footer.render(120)[1])).toContain("$0.500");
|
||||
|
||||
session.sessionManager.getEntries().push({ type: "message", message: { role: "assistant", usage } } as never);
|
||||
expect(stripAnsi(footer.render(120)[1])).toContain("$1.000");
|
||||
});
|
||||
|
||||
it("shows the latest cache hit rate when cache usage is present", () => {
|
||||
const session = createSession({
|
||||
sessionName: "",
|
||||
|
||||
Reference in New Issue
Block a user