yuan-lab-llm--clawmanager
71c7672545
* feat(skill-hub): add Skill Hub catalog, publish flow, and lite materialize pipeline Introduce Skill Hub for browsing, importing, publishing, and installing skills, with lite instance package materialization and runtime sync support. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(skill-hub): remove token-governance hooks from Skill Hub PR Strip validateManagedRuntimeEnvironmentOverrides, network lock policy sync, and egress proxy audit wiring that belong to the upcoming token-usage work, so the Skill Hub branch compiles independently. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(skill-hub): update migration number in materialize docs Co-authored-by: Cursor <cursoragent@cursor.com> * fix(skill-hub): make RuntimeAgentClient test stub and hub tests compile-safe Add ResyncInstanceSkills to the runtime pool handler fake client, and harden skill hub payload helpers/tests against nil storage/instance repos so go test passes. Co-authored-by: Cursor <cursoragent@cursor.com> * feat: add Skill Hub hardening with session usage tracking and egress governance Unify Skill Hub runtime sync improvements with session-token observability, egress network policy, and admin/instance usage reporting for reopenable PR. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(skill-hub): repair CI tests and nested skill install * fix(ci): restore release deployment configuration --------- Co-authored-by: heshengran <heshengran@ieisystem.com> Co-authored-by: Cursor <cursoragent@cursor.com>
44 行
1.3 KiB
Go
44 行
1.3 KiB
Go
package utils
|
|
|
|
import "strings"
|
|
|
|
// FormatOpenClawSessionKey extracts the display session key from a stored session ID.
|
|
func FormatOpenClawSessionKey(sessionID string) string {
|
|
sessionID = strings.TrimSpace(sessionID)
|
|
for _, prefix := range []string{"agent:openclaw:", "agent:hermes:"} {
|
|
if strings.HasPrefix(sessionID, prefix) {
|
|
return strings.TrimPrefix(sessionID, prefix)
|
|
}
|
|
}
|
|
if strings.HasPrefix(sessionID, "agent:") {
|
|
parts := strings.SplitN(sessionID, ":", 3)
|
|
if len(parts) == 3 && strings.TrimSpace(parts[2]) != "" {
|
|
return parts[2]
|
|
}
|
|
}
|
|
return sessionID
|
|
}
|
|
|
|
// NormalizeOpenClawSessionID maps a runtime session key to the canonical stored session ID.
|
|
func NormalizeOpenClawSessionID(sessionKey string, runtimeType string) string {
|
|
sessionKey = strings.TrimSpace(sessionKey)
|
|
if sessionKey == "" {
|
|
return sessionKey
|
|
}
|
|
if strings.HasPrefix(sessionKey, "agent:") {
|
|
return sessionKey
|
|
}
|
|
switch strings.ToLower(strings.TrimSpace(runtimeType)) {
|
|
case "hermes":
|
|
return "agent:hermes:" + sessionKey
|
|
default:
|
|
return "agent:openclaw:" + sessionKey
|
|
}
|
|
}
|
|
|
|
// IsTraceFallbackSessionID reports whether a session ID was generated per trace.
|
|
func IsTraceFallbackSessionID(sessionID string) bool {
|
|
sessionID = strings.TrimSpace(sessionID)
|
|
return strings.HasPrefix(sessionID, "sess_")
|
|
}
|