mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix test
This commit is contained in:
@@ -6,6 +6,13 @@ type RoleWrappedRecord = {
|
||||
meta?: unknown
|
||||
}
|
||||
|
||||
const VISIBLE_CLAUDE_SYSTEM_SUBTYPES = new Set([
|
||||
'api_error',
|
||||
'turn_duration',
|
||||
'microcompact_boundary',
|
||||
'compact_boundary'
|
||||
])
|
||||
|
||||
export function isRoleWrappedRecord(value: unknown): value is RoleWrappedRecord {
|
||||
if (!isObject(value)) return false
|
||||
return typeof value.role === 'string' && 'content' in value
|
||||
@@ -27,4 +34,16 @@ export function unwrapRoleWrappedRecordEnvelope(value: unknown): RoleWrappedReco
|
||||
return null
|
||||
}
|
||||
|
||||
export function isClaudeChatVisibleSystemSubtype(subtype: unknown): subtype is string {
|
||||
return typeof subtype === 'string' && VISIBLE_CLAUDE_SYSTEM_SUBTYPES.has(subtype)
|
||||
}
|
||||
|
||||
export function isClaudeChatVisibleMessage(message: { type: unknown; subtype?: unknown }): boolean {
|
||||
if (message.type !== 'system') {
|
||||
return true
|
||||
}
|
||||
|
||||
return isClaudeChatVisibleSystemSubtype(message.subtype)
|
||||
}
|
||||
|
||||
export type { RoleWrappedRecord }
|
||||
|
||||
Reference in New Issue
Block a user