(
db: Database,
sessionId: string,
directory: string,
modelKey?: string,
config?: Record<string, unknown>,
liveSessionState?: LiveSessionState,
injectionBudgetTokens?: number,
)
| 492 | } |
| 493 | |
| 494 | export function buildStatusDetail( |
| 495 | db: Database, |
| 496 | sessionId: string, |
| 497 | directory: string, |
| 498 | modelKey?: string, |
| 499 | config?: Record<string, unknown>, |
| 500 | liveSessionState?: LiveSessionState, |
| 501 | injectionBudgetTokens?: number, |
| 502 | ): StatusDetail { |
| 503 | const base = buildSidebarSnapshot( |
| 504 | db, |
| 505 | sessionId, |
| 506 | directory, |
| 507 | liveSessionState, |
| 508 | injectionBudgetTokens, |
| 509 | config, |
| 510 | ); |
| 511 | const detail: StatusDetail = { |
| 512 | ...base, |
| 513 | tagCounter: 0, |
| 514 | activeTags: 0, |
| 515 | droppedTags: 0, |
| 516 | totalTags: 0, |
| 517 | activeBytes: 0, |
| 518 | lastResponseTime: 0, |
| 519 | lastNudgeTokens: 0, |
| 520 | lastTransformError: null, |
| 521 | isSubagent: false, |
| 522 | pendingOps: [], |
| 523 | contextLimit: 0, |
| 524 | cacheTtlMs: 0, |
| 525 | cacheRemainingMs: 0, |
| 526 | cacheExpired: false, |
| 527 | executeThreshold: 65, |
| 528 | executeThresholdMode: "percentage", |
| 529 | protectedTagCount: 20, |
| 530 | historyBudgetPercentage: 0.15, |
| 531 | historyBlockTokens: 0, |
| 532 | compressionBudget: null, |
| 533 | compressionUsage: null, |
| 534 | toastDurationMs: 5000, |
| 535 | }; |
| 536 | |
| 537 | try { |
| 538 | const meta = db |
| 539 | .prepare<[string], Record<string, unknown>>( |
| 540 | "SELECT * FROM session_meta WHERE session_id = ?", |
| 541 | ) |
| 542 | .get(sessionId); |
| 543 | if (meta) { |
| 544 | detail.tagCounter = Number(meta.counter ?? 0); |
| 545 | detail.lastResponseTime = Number(meta.last_response_time ?? 0); |
| 546 | detail.lastNudgeTokens = Number(meta.last_nudge_tokens ?? 0); |
| 547 | detail.lastTransformError = meta.last_transform_error |
| 548 | ? String(meta.last_transform_error) |
| 549 | : null; |
| 550 | detail.isSubagent = Boolean(meta.is_subagent); |
| 551 | } |
no test coverage detected