Relax assemble runtimeContext report typing
This commit is contained in:
parent
fd1057986d
commit
3dfc046d72
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user