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
+47
View File
@@ -0,0 +1,47 @@
package elderagent
import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"testing"
)
func TestProductBindingAndRetry(t *testing.T) {
bound := false
calls := 0
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Query().Get("Action") {
case "AibotQuery":
if bound {
fmt.Fprint(w, `{"Result":{"Bots":[{"Id":"bot-1","Bindings":[{"InstanceId":"instance","ProductKey":"product"}]}]}}`)
} else {
fmt.Fprint(w, `{"Result":{"Bots":[{"Id":"bot-1"}]}}`)
}
case "AibotBind":
var in map[string]any
json.NewDecoder(r.Body).Decode(&in)
b, ok := in["Binding"].(map[string]any)
if !ok || b["InstanceId"] != "instance" || b["ProductKey"] != "product" || in["Id"] != "bot-1" {
t.Error("incorrect AibotBind body")
}
calls++
bound = true
fmt.Fprint(w, `{"Result":{}}`)
default:
t.Error("unexpected action")
}
}))
defer server.Close()
client := NewClient("ak", "sk", "", server.URL, "").ForProduct("instance", "product")
for n := 0; n < 2; n++ {
if err := client.BindConfigured(context.Background(), "bot-1"); err != nil {
t.Fatal(err)
}
}
if calls != 1 {
t.Fatal("binding repeated", calls)
}
}