chore: initial commit of ai site platform

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-07-31 10:31:17 +08:00
commit 4ca82fb58a
203 changed files with 45745 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package agentcap
import "testing"
func TestSealOpenModulePath(t *testing.T) {
secret := "test-secret"
token, filePath, err := SealModulePath(secret, 1, 42, "settlement")
if err != nil {
t.Fatal(err)
}
if filePath != "m/"+token {
t.Fatalf("filePath=%s", filePath)
}
claim, err := OpenModulePath(secret, token)
if err != nil {
t.Fatal(err)
}
if claim.TenantID != 1 || claim.OwnerID != 42 || claim.Slug != "settlement" {
t.Fatalf("%+v", claim)
}
claim2, err := OpenModulePath(secret, filePath)
if err != nil {
t.Fatal(err)
}
if claim2.Slug != "settlement" {
t.Fatalf("%+v", claim2)
}
}