fix: normalize OpenAI token counting, add branch source tracking
pi-ai: - Fixed usage.input to exclude cached tokens for OpenAI providers - Previously input included cached tokens, causing double-counting - Now input + output + cacheRead + cacheWrite correctly gives total context coding-agent: - Session header now includes branchedFrom field for branched sessions - Updated compaction.md with refined implementation plan - Updated session.md with branchedFrom documentation
This commit is contained in:
@@ -20,6 +20,7 @@ export interface SessionHeader {
|
||||
provider: string;
|
||||
modelId: string;
|
||||
thinkingLevel: string;
|
||||
branchedFrom?: string; // Path to the session file this was branched from
|
||||
}
|
||||
|
||||
export interface SessionMessageEntry {
|
||||
@@ -430,6 +431,7 @@ export class SessionManager {
|
||||
provider: state.model.provider,
|
||||
modelId: state.model.id,
|
||||
thinkingLevel: state.thinkingLevel,
|
||||
branchedFrom: this.sessionFile,
|
||||
};
|
||||
appendFileSync(newSessionFile, JSON.stringify(entry) + "\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user