()
| 355 | * The gate check and config loading happen lazily when the hook runs. |
| 356 | */ |
| 357 | export function initSessionMemory(): void { |
| 358 | if (getIsRemoteMode()) return |
| 359 | // Session memory is used for compaction, so respect auto-compact settings |
| 360 | const autoCompactEnabled = isAutoCompactEnabled() |
| 361 | |
| 362 | // Log initialization state (ant-only to avoid noise in external logs) |
| 363 | if (process.env.USER_TYPE === 'ant') { |
| 364 | logEvent('tengu_session_memory_init', { |
| 365 | auto_compact_enabled: autoCompactEnabled, |
| 366 | }) |
| 367 | } |
| 368 | |
| 369 | if (!autoCompactEnabled) { |
| 370 | return |
| 371 | } |
| 372 | |
| 373 | // Register hook unconditionally - gate check happens lazily when hook runs |
| 374 | registerPostSamplingHook(extractSessionMemory) |
| 375 | } |
| 376 | |
| 377 | export type ManualExtractionResult = { |
| 378 | success: boolean |
no test coverage detected