项目文件夹

文件
heranran 71c7672545 feat: Skill Hub hardening with session usage tracking and egress governance (#163)
* 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>
2026-07-17 12:37:01 +08:00

37 行
1.2 KiB
Go

package utils
import "testing"
func TestFormatOpenClawSessionKey(t *testing.T) {
if got := FormatOpenClawSessionKey("agent:openclaw:main"); got != "main" {
t.Fatalf("expected main, got %q", got)
}
if got := FormatOpenClawSessionKey("agent:hermes:work"); got != "work" {
t.Fatalf("expected work, got %q", got)
}
if got := FormatOpenClawSessionKey("sess_trc_123"); got != "sess_trc_123" {
t.Fatalf("expected passthrough, got %q", got)
}
}
func TestNormalizeOpenClawSessionID(t *testing.T) {
if got := NormalizeOpenClawSessionID("main", "openclaw"); got != "agent:openclaw:main" {
t.Fatalf("expected agent:openclaw:main, got %q", got)
}
if got := NormalizeOpenClawSessionID("main", "hermes"); got != "agent:hermes:main" {
t.Fatalf("expected agent:hermes:main, got %q", got)
}
if got := NormalizeOpenClawSessionID("agent:openclaw:main", "openclaw"); got != "agent:openclaw:main" {
t.Fatalf("expected unchanged, got %q", got)
}
}
func TestIsTraceFallbackSessionID(t *testing.T) {
if !IsTraceFallbackSessionID("sess_trc_abc") {
t.Fatal("expected trace fallback session")
}
if IsTraceFallbackSessionID("agent:openclaw:main") {
t.Fatal("expected stable session")
}
}