feat: sync deployed v1.0.0-rc.38-custom.42

Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
cneicy committed 2026-09-26 04:49:11 +08:00
1 parent aa6c3f50f4
commit ceddfd3d6b
828 files changed
+122253 -13702

No files matched your search

+53 -1
View File
@@ -209,6 +209,57 @@ func normalizeLegacyRejectReason(values map[string]json.RawMessage) bool {
return true
}
// Expose only the provider's model declaration and a bounded reason to the
// log owner. The full attempt trail remains under admin_info.
func projectResponseModelRejection(values map[string]json.RawMessage) bool {
var code string
if err := common.Unmarshal(values["error_code"], &code); err != nil || code != "response_model_rejected" {
return false
}
var admin struct {
RequestDetails struct {
ModelGuard struct {
Attempts []struct {
Expected string `json:"expected_model"`
Returned string `json:"returned_model"`
Reason string `json:"reason"`
} `json:"attempts"`
} `json:"model_guard"`
} `json:"request_details"`
}
if err := common.Unmarshal(values[logOtherAdminInfoKey], &admin); err != nil || len(admin.RequestDetails.ModelGuard.Attempts) == 0 {
return false
}
attempts := admin.RequestDetails.ModelGuard.Attempts
last := attempts[len(attempts)-1]
reason := last.Reason
if reason != "confirmation_timeout" && reason != "missing_model" && reason != "confirmation_buffer_limit" && reason != "model_mismatch" {
return false
}
result, err := common.Marshal(reason)
if err != nil {
return false
}
values["model_guard_result"] = result
for i := len(attempts) - 1; i >= 0; i-- {
entry := attempts[i]
if entry.Returned == "" || entry.Expected == "" {
continue
}
observation, err := common.Marshal(map[string]any{
"requested_model": entry.Expected,
"upstream_model": entry.Expected,
"returned_model": entry.Returned,
"mismatch": entry.Returned != entry.Expected,
})
if err == nil {
values["response_model"] = observation
}
break
}
return true
}
// formatLogOtherJSON applies the role projection while keeping untouched JSON
// values as RawMessage. This preserves integers larger than JavaScript's safe
// range instead of round-tripping them through float64.
@@ -226,6 +277,7 @@ func formatLogOtherJSON(value string, visibility logOtherVisibility) string {
}
changed := false
changed = projectResponseModelRejection(values)
if visibility == logOtherVisibilityUser {
for _, key := range []string{logOtherAdminInfoKey, logOtherRootInfoKey, logOtherAuditInfoKey} {
if _, exists := values[key]; exists {
@@ -240,7 +292,7 @@ func formatLogOtherJSON(value string, visibility logOtherVisibility) string {
}
}
} else {
changed = normalizeLegacyRejectReason(values)
changed = normalizeLegacyRejectReason(values) || changed
if visibility == logOtherVisibilityAdmin {
if _, exists := values[logOtherRootInfoKey]; exists {
delete(values, logOtherRootInfoKey)