style(experimental): satisfy lint in the personalized pages block readers

Wraps two lines over the length limit and reads the regex group without a
non-null assertion.
This commit is contained in:
ZiyaZhang committed 2026-10-21 10:52:12 -07:00
1 parent 50be7d37c9
commit 09373c62aa
2 files changed
+7 -3

No files matched your search

@@ -17,10 +17,14 @@ function proposalFields(value: unknown): Omit<CreationRecommendation, 'callId'>
if (!record(value) || typeof value.title !== 'string' || value.title.trim() === '' || typeof value.brief !== 'string' || value.brief.trim() === ''
|| value.slot !== 'sidebar-right' && value.slot !== 'page' && value.slot !== 'sidebar-left'
|| value.initialContent !== undefined && typeof value.initialContent !== 'string') return undefined
return { title: value.title.trim(), brief: value.brief.trim(), slot: value.slot, ...value.initialContent === undefined ? {} : { initialContent: value.initialContent } }
return {
title: value.title.trim(), brief: value.brief.trim(), slot: value.slot,
...value.initialContent === undefined ? {} : { initialContent: value.initialContent },
}
}
/** Read a proposal from a logged event: the last valid `dsh-action` block of an assistant answer, or earlier sessions' tool result metadata.
/** Read a proposal from a logged event: the last valid `dsh-action` block of an assistant answer,
* or earlier sessions' tool result metadata.
* @param event - Persisted assistant message, native or PTC result.
* @returns validated creation proposal, if present.
*/
@@ -13,7 +13,7 @@ export function actionBlocksOf(text: string): unknown[] {
const objects: unknown[] = []
for (const match of text.matchAll(FENCE)) {
try {
const value: unknown = JSON.parse(match[1]!.trim())
const value: unknown = JSON.parse((match[1] as string).trim())
if (typeof value === 'object' && value !== null && !Array.isArray(value)) objects.push(value)
} catch {
// Malformed JSON inside a fence creates no proposal; the answer stays as written.