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
+59
View File
@@ -0,0 +1,59 @@
package onboarding
import (
"context"
)
type VoiceRuntimeInput struct {
BootID string `json:"boot_id"`
}
// VoiceRuntime is independent of the short-lived provisioning screen. It
// exposes only this authenticated device's current, bound activation command.
// Registration is owned by the server; the device only acknowledges SDK initialization.
func (s *Service) VoiceRuntime(ctx context.Context, d Device, in VoiceRuntimeInput) (map[string]any, error) {
if !uuidV4(in.BootID) {
return nil, fail(400, "VALIDATION_FAILED", "启动编号不正确")
}
tx, e := s.pool.Begin(ctx)
if e != nil {
return nil, e
}
defer tx.Rollback(ctx)
current, e := readDevice(ctx, tx, d.ID, true)
if e != nil {
return nil, e
}
if !deviceAllowed(current) || current.BootID != in.BootID {
return nil, errState
}
var bound bool
if e = tx.QueryRow(ctx, `SELECT EXISTS(SELECT 1 FROM device_binding WHERE device_id=$1::uuid AND generation=$2 AND unbound_at IS NULL) OR EXISTS(SELECT 1 FROM device_account_binding WHERE device_id=$1::uuid AND generation=$2 AND released_at IS NULL)`, d.ID, current.Generation).Scan(&bound); e != nil {
return nil, e
}
if !bound {
return nil, fail(409, "DEVICE_UNBOUND", "请先绑定设备")
}
command, e := s.activationCommand(ctx, tx, current)
if e != nil {
return nil, e
}
st, e := s.state(ctx, tx, current)
if e != nil {
return nil, e
}
out := map[string]any{"state": st, "command": command, "call_contract": "CALL-MEMORY-1.1"}
if !s.options.LegacyDeviceRegistration {
fields, err := s.voiceFields(ctx, tx, current)
if err != nil {
return nil, err
}
for k, v := range fields {
out[k] = v
}
}
if e = tx.Commit(ctx); e != nil {
return nil, e
}
return out, nil
}