Relax assemble runtimeContext report typing

This commit is contained in:
Codex 2026-03-21 04:38:54 +08:00
parent fd1057986d
commit 3dfc046d72

View File

@ -12,6 +12,12 @@ export type EmbeddedAssembleRuntimeContext = {
reservedContextTokensEstimate?: number;
};
type AssembleRuntimePromptReport = {
systemPrompt?: Pick<SessionSystemPromptReport["systemPrompt"], "chars"> | null;
skills?: Pick<SessionSystemPromptReport["skills"], "promptChars"> | null;
tools?: Pick<SessionSystemPromptReport["tools"], "listChars" | "schemaChars"> | null;
};
function normalizeChars(value: unknown): number {
if (!Number.isFinite(value) || Number(value) <= 0) {
return 0;
@ -29,7 +35,7 @@ function estimateTokensFromChars(chars: number): number {
export function buildEmbeddedAssembleRuntimeContext(params: {
systemPromptText?: string | null;
prompt?: string | null;
systemPromptReport?: Pick<SessionSystemPromptReport, "systemPrompt" | "skills" | "tools"> | null;
systemPromptReport?: AssembleRuntimePromptReport | null;
}): EmbeddedAssembleRuntimeContext {
const report = params.systemPromptReport ?? undefined;
const systemPromptChars = normalizeChars(