mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-28 07:16:53 +05:00
feat(ipuaro): add context configuration
- Add ContextConfigSchema with systemPromptTokens, maxContextUsage, autoCompressAt, compressionMethod - Update ContextManager to read compression threshold from config - Update HandleMessage and useSession to pass context config - Add 40 unit tests (32 schema + 8 integration) - Coverage: 97.63% lines, 91.34% branches
This commit is contained in:
@@ -106,6 +106,16 @@ export const SessionConfigSchema = z.object({
|
||||
saveInputHistory: z.boolean().default(true),
|
||||
})
|
||||
|
||||
/**
|
||||
* Context configuration schema.
|
||||
*/
|
||||
export const ContextConfigSchema = z.object({
|
||||
systemPromptTokens: z.number().int().positive().default(2000),
|
||||
maxContextUsage: z.number().min(0).max(1).default(0.8),
|
||||
autoCompressAt: z.number().min(0).max(1).default(0.8),
|
||||
compressionMethod: z.enum(["llm-summary", "truncate"]).default("llm-summary"),
|
||||
})
|
||||
|
||||
/**
|
||||
* Full configuration schema.
|
||||
*/
|
||||
@@ -119,6 +129,7 @@ export const ConfigSchema = z.object({
|
||||
input: InputConfigSchema.default({}),
|
||||
display: DisplayConfigSchema.default({}),
|
||||
session: SessionConfigSchema.default({}),
|
||||
context: ContextConfigSchema.default({}),
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -134,6 +145,7 @@ export type EditConfig = z.infer<typeof EditConfigSchema>
|
||||
export type InputConfig = z.infer<typeof InputConfigSchema>
|
||||
export type DisplayConfig = z.infer<typeof DisplayConfigSchema>
|
||||
export type SessionConfig = z.infer<typeof SessionConfigSchema>
|
||||
export type ContextConfig = z.infer<typeof ContextConfigSchema>
|
||||
|
||||
/**
|
||||
* Default configuration.
|
||||
|
||||
Reference in New Issue
Block a user