Merge pull request #214 from multica-ai/codex/chat-context-window-indicator
feat(chat): add context window usage indicator
This commit is contained in:
commit
fc8a813120
12 changed files with 284 additions and 23 deletions
|
|
@ -553,6 +553,20 @@ export class AsyncAgent {
|
|||
return this.agent.getProviderInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get persisted session metadata.
|
||||
*/
|
||||
getSessionMeta(): import("./session/types.js").SessionMeta | undefined {
|
||||
return this.agent.getSessionMeta();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get effective context window token limit for this session.
|
||||
*/
|
||||
getContextWindowTokens(): number {
|
||||
return this.agent.getContextWindowTokens();
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to a different provider and/or model.
|
||||
* This updates the agent's model without recreating the session.
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import {
|
|||
getDefaultModel,
|
||||
} from "./providers/index.js";
|
||||
import { SessionManager } from "./session/session-manager.js";
|
||||
import type { SessionMeta } from "./session/types.js";
|
||||
import { ProfileManager } from "./profile/index.js";
|
||||
import { SkillManager } from "./skills/index.js";
|
||||
import { credentialManager, getCredentialsPath } from "./credentials.js";
|
||||
|
|
@ -1199,6 +1200,20 @@ export class Agent {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get persisted session metadata.
|
||||
*/
|
||||
getSessionMeta(): SessionMeta | undefined {
|
||||
return this.session.getMeta();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get effective context window token limit for this session.
|
||||
*/
|
||||
getContextWindowTokens(): number {
|
||||
return this.session.getMeta()?.contextWindowTokens ?? this.session.getContextWindowTokens();
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to a different provider and/or model.
|
||||
* This updates the agent's model without recreating the session.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue