feat: expand companion platform, device controls, and memoir workflows
ci / verify (push) Canceled after 0s

Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
This commit is contained in:
Codex Local
2026-10-08 10:06:44 +08:00
parent 98fb2965d0
commit bf1233d5df
861 changed files with 94614 additions and 3209 deletions
+12 -1
View File
@@ -33,6 +33,15 @@ func SelectMemoryForContext(ctx context.Context, tx pgx.Tx, tenantID, subjectID,
// conversation creation transaction while retaining the SQL tenant, subject,
// consent and lifecycle boundaries below.
func SelectMemoryForContextVector(ctx context.Context, tx pgx.Tx, tenantID, subjectID, queryVector string, limit int) ([]Memory, error) {
return selectMemory(ctx, tx, tenantID, subjectID, queryVector, limit, false)
}
// RESPOND_ONLY and closed items can answer an explicit question, but cannot
// seed a proactive greeting or follow-up prompt.
func SelectMemoryForUserQueryVector(ctx context.Context, tx pgx.Tx, tenantID, subjectID, queryVector string, limit int) ([]Memory, error) {
return selectMemory(ctx, tx, tenantID, subjectID, queryVector, limit, true)
}
func selectMemory(ctx context.Context, tx pgx.Tx, tenantID, subjectID, queryVector string, limit int, responding bool) ([]Memory, error) {
if limit < 1 || limit > 10 {
return nil, fmt.Errorf("memory retrieval limit must be between 1 and 10")
}
@@ -48,6 +57,8 @@ func SelectMemoryForContextVector(ctx context.Context, tx pgx.Tx, tenantID, subj
WHERE mi.tenant_id=$1::uuid AND mi.subject_id=$2::uuid
AND mi.index_type='pgvector' AND mi.status='ACTIVE' AND mi.embedding IS NOT NULL
AND cm.status='ACTIVE' AND cm.current_version_id=mv.id
AND cm.proactive_policy<>'NEVER' AND ($5 OR cm.proactive_policy='ALLOWED')
AND ($5 OR cm.memory_type<>'OPEN_ITEM' OR cm.item_status='OPEN')
AND cm.sensitivity='normal'
AND (cm.valid_from IS NULL OR cm.valid_from<=now())
AND (cm.valid_to IS NULL OR cm.valid_to>now())
@@ -56,7 +67,7 @@ func SelectMemoryForContextVector(ctx context.Context, tx pgx.Tx, tenantID, subj
AND cr.consent_type='personalized_memory' AND cr.withdrawn_at IS NULL
AND (cr.expires_at IS NULL OR cr.expires_at>now()))
ORDER BY mi.embedding <=> $3::vector,mv.confirmed_at DESC,mv.id
LIMIT $4`, tenantID, subjectID, queryVector, limit)
LIMIT $4`, tenantID, subjectID, queryVector, limit, responding)
if err != nil {
return nil, fmt.Errorf("query eligible memory: %w", err)
}