feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes
This commit is contained in:
parent
01ef3293cf
commit
66b6b45ba9
399 changed files with 17828 additions and 11330 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { isRecord, isUuid } from '@d3ro/core/guards'
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||
import { SUPABASE_URL } from '@d3ro/core/supabase-config'
|
||||
import {
|
||||
|
|
@ -147,7 +148,6 @@ export interface ActionExecutionOutcome {
|
|||
historyRecorded: boolean
|
||||
}
|
||||
|
||||
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
|
||||
const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
||||
const MAX_INPUT_CHARS = 4_000
|
||||
const MAX_RATIONALE_CHARS = 300
|
||||
|
|
@ -171,9 +171,6 @@ Do not invent missing IDs. Use unknown when required data is absent.`
|
|||
let historySequence = 0
|
||||
let historyQueue: Promise<void> = Promise.resolve()
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
||||
}
|
||||
|
||||
function normalizeBoundedString(value: unknown, max: number): string | null {
|
||||
if (typeof value !== 'string') return null
|
||||
|
|
@ -227,7 +224,7 @@ export function parseActionJson(text: string): ParsedMobileAction {
|
|||
const content = normalizeBoundedString(value.args.content, MAX_MEMO_CHARS)
|
||||
if (
|
||||
meetingId === null
|
||||
|| !UUID_PATTERN.test(meetingId)
|
||||
|| !isUuid(meetingId)
|
||||
|| content === null
|
||||
|| !hasOnlyKeys(value.args, ['meeting_id', 'content'])
|
||||
) {
|
||||
|
|
@ -246,7 +243,7 @@ export function parseActionJson(text: string): ParsedMobileAction {
|
|||
const role = value.args.role === undefined ? 'member' : value.args.role
|
||||
if (
|
||||
teamId === null
|
||||
|| !UUID_PATTERN.test(teamId)
|
||||
|| !isUuid(teamId)
|
||||
|| email === null
|
||||
|| !EMAIL_PATTERN.test(email)
|
||||
|| (role !== 'admin' && role !== 'member')
|
||||
|
|
@ -344,7 +341,7 @@ export async function parseActionCommand(
|
|||
)
|
||||
}
|
||||
const generationId = response.headers?.get('X-D3RO-Generation-Id')?.trim() ?? ''
|
||||
if (!UUID_PATTERN.test(generationId)) {
|
||||
if (!isUuid(generationId)) {
|
||||
throw new ActionServiceError('INVALID_RESPONSE', true)
|
||||
}
|
||||
const snapshot = extractLlmText(body)
|
||||
|
|
@ -367,7 +364,7 @@ export async function parseActionCommand(
|
|||
}
|
||||
|
||||
function actionHistoryKey(userId: string): string {
|
||||
if (!UUID_PATTERN.test(userId)) throw new ActionServiceError('AUTH_REQUIRED', false, 401)
|
||||
if (!isUuid(userId)) throw new ActionServiceError('AUTH_REQUIRED', false, 401)
|
||||
return `${HISTORY_KEY_PREFIX}.${userId}`
|
||||
}
|
||||
|
||||
|
|
@ -598,7 +595,7 @@ async function performAllowedAction(options: ExecuteActionOptions): Promise<Acti
|
|||
export async function executeConfirmedAction(
|
||||
options: ExecuteActionOptions,
|
||||
): Promise<ActionExecutionOutcome> {
|
||||
if (!UUID_PATTERN.test(options.userId) || options.accessToken.trim().length === 0) {
|
||||
if (!isUuid(options.userId) || options.accessToken.trim().length === 0) {
|
||||
throw new ActionServiceError('AUTH_REQUIRED', false, 401)
|
||||
}
|
||||
const input = normalizeActionInput(options.input)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue