Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

agent_registry_v2 state

Back to all declarations

MaxAgents

untyped bigint

Value

(100 <untyped> bigint)

MaxNameLen

untyped bigint

Value

(100 <untyped> bigint)

MaxDescLen

untyped bigint

Value

(1000 <untyped> bigint)

MaxCapsLen

untyped bigint

Value

(2000 <untyped> bigint)

MaxReviewLen

untyped bigint

Value

(500 <untyped> bigint)

ReviewRenderMax

untyped bigint

Value

(20 <untyped> bigint)

AdminAddress

untyped string

// samcrew-core-test1 multisig

Value

"g1x7k4628w93a7wzdhqc06atzx0v50rnshweuxu0"

MaxAgentsPerCreator

untyped bigint

Value

(10 <untyped> bigint)

MaxDepositorsPerAgent

untyped bigint

Value

(50 <untyped> bigint)

Agent

type

Value

agent_registry_v2.Agent

Review

type

Value

agent_registry_v2.Review

reviewers

*avl.Tree

// "agentId/addr" -> true (dedup: one review per agent per address)

Open
OID
0a156c…d400:44
reviewers details

Inspect pointer

credits

*avl.Tree

// "agentId/userAddr" -> int64 (prepaid credits in ugnot)

Open
OID
0a156c…d400:46
credits details

Inspect pointer

usage

*avl.Tree

// "agentId/userAddr" -> int64 (total calls)

Open
OID
0a156c…d400:48
usage details

Inspect pointer

earnings

*avl.Tree

// agentId -> int64 (accumulated creator earnings in ugnot)

Open
OID
0a156c…d400:50
earnings details

Inspect pointer

paused

bool

Value

false

Pause

func()

Pause blocks all state-mutating operations EXCEPT RefundCredits (users keep the right to reclaim their own deposits). Admin only. See the pause policy above.

Open
OID
0a156c…d400:13
Pause details

Inspect func

Unpause

func()

Unpause resumes normal operations. Admin only.

Open
OID
0a156c…d400:14
Unpause details

Inspect func

IsPaused

func() bool

IsPaused returns the current pause state.

Open
OID
0a156c…d400:15
IsPaused details

Inspect func

RegisterAgent

func(id string, name string, description string, category string, capabilities string, endpoint string, transport string, pricing string, version string, pricePerCall int64)

RegisterAgent registers a new agent in the registry.

Open
OID
0a156c…d400:16
RegisterAgent details

Inspect func

UpdateAgent

func(id string, description string, capabilities string, endpoint string, version string, pricing string, pricePerCall int64)

UpdateAgent allows the creator to update their agent.

Open
OID
0a156c…d400:17
UpdateAgent details

Inspect func

ReviewAgent

func(agentId string, rating int, comment string)

ReviewAgent adds a review for an agent. One review per address per agent.

Open
OID
0a156c…d400:18
ReviewAgent details

Inspect func

RemoveAgent

func(id string)

RemoveAgent removes an agent (admin or creator only). All outstanding credits are refunded to their depositors before removal.

Open
OID
0a156c…d400:19
RemoveAgent details

Inspect func

DepositCredits

func(agentId string)

DepositCredits deposits GNOT as prepaid credits for an agent. Send ugnot with the transaction to fund the credits.

Open
OID
0a156c…d400:20
DepositCredits details

Inspect func

UseCredit

func(agentId string, userAddr string) int64

UseCredit deducts one invocation credit. Only the agent creator or admin can call. Returns the remaining credits.

Open
OID
0a156c…d400:21
UseCredit details

Inspect func

GetCredits

func(agentId string, userAddr string) int64

GetCredits returns the credit balance for a user on an agent.

Open
OID
0a156c…d400:22
GetCredits details

Inspect func

GetUsage

func(agentId string, userAddr string) int64

GetUsage returns the total invocation count for a user on an agent.

Open
OID
0a156c…d400:23
GetUsage details

Inspect func

GetEarnings

func(agentId string) int64

GetEarnings returns accumulated earnings for an agent.

Open
OID
0a156c…d400:24
GetEarnings details

Inspect func

WithdrawEarnings

func(agentId string)

WithdrawEarnings allows the agent creator to withdraw accumulated usage fees. Earnings accumulate when UseCredit deducts from user credit balances.

Open
OID
0a156c…d400:25
WithdrawEarnings details

Inspect func

RefundCredits

func(agentId string)

RefundCredits refunds remaining credits to the caller.

Open
OID
0a156c…d400:26
RefundCredits details

Inspect func

renderAgent

func(id string) string
Open
OID
0a156c…d400:29
renderAgent details

Inspect func

formatRating

func(sum int64, count int64) string

formatRating formats a rating as "X.Y" using integer math (no float in ufmt).

Open
OID
0a156c…d400:31
formatRating details

Inspect func

truncAddr

func(addr .uverse.address) string
Open
OID
0a156c…d400:32
truncAddr details

Inspect func

isValidTransport

func(t string) bool
Open
OID
0a156c…d400:33
isValidTransport details

Inspect func

isValidPricing

func(p string) bool
Open
OID
0a156c…d400:34
isValidPricing details

Inspect func

sanitizeForRender

func(s string) string

sanitizeForRender strips markdown-sensitive characters from user-controlled strings before rendering in gnoweb to prevent injection attacks.

Open
OID
0a156c…d400:35
sanitizeForRender details

Inspect func

countAgentsByCreator

func(creator .uverse.address) int

countAgentsByCreator counts how many agents \`creator\` currently owns (B4 cap). Bounded by MaxAgents (global), so O(MaxAgents) worst case.

Open
OID
0a156c…d400:36
countAgentsByCreator details

Inspect func

countDepositors

func(agentId string) int

countDepositors counts the distinct credit entries for an agent (B4 cap). Bounded by MaxDepositorsPerAgent in steady state (the cap enforces its own bound), so the scan stays cheap.

Open
OID
0a156c…d400:37
countDepositors details

Inspect func

hasAnyCreditsEntry

func(agentId string) bool

hasAnyCreditsEntry returns true if ANY credit entry exists for the agent, even with zero balance. This prevents a price-lock bypass where the creator drains a user's balance to 0, then raises the price, then the user tops up. Zero-balance entries remain as markers until explicitly cleaned via RefundCredits (which removes the entry) or RemoveAgent.

Open
OID
0a156c…d400:38
hasAnyCreditsEntry details

Inspect func

isValidAgentID

func(id string) bool

isValidAgentID ensures the ID contains only safe characters (no "/" or other delimiters that would cause key collisions in the credits/usage AVL trees).

Open
OID
0a156c…d400:39
isValidAgentID details

Inspect func
MaxAgents : untyped bigint =(100 <untyped> bigint)
MaxNameLen : untyped bigint =(100 <untyped> bigint)
MaxDescLen : untyped bigint =(1000 <untyped> bigint)
MaxCapsLen : untyped bigint =(2000 <untyped> bigint)
MaxReviewLen : untyped bigint =(500 <untyped> bigint)
ReviewRenderMax : untyped bigint =(20 <untyped> bigint)
AdminAddress : untyped string ="g1x7k4628w93a7wzdhqc06atzx0v50rnshweuxu0"
MaxAgentsPerCreator : untyped bigint =(10 <untyped> bigint)
MaxDepositorsPerAgent : untyped bigint =(50 <untyped> bigint)
Agent : type =agent_registry_v2.Agent
Review : type =agent_registry_v2.Review
agents : *avl.Tree Inspect
reviews : *avl.Tree Inspect
reviewers : *avl.Tree Inspect
credits : *avl.Tree Inspect
usage : *avl.Tree Inspect
earnings : *avl.Tree Inspect
paused : bool =false
init.18 : func() Inspect
assertNotPaused : func() Inspect
Pause : func() Inspect
Unpause : func() Inspect
IsPaused : func() bool Inspect
RegisterAgent : func(id string, name string, description string, category string, capabilities string, endpoint string, transport string, pricing string, version string, pricePerCall int64) Inspect
UpdateAgent : func(id string, description string, capabilities string, endpoint string, version string, pricing string, pricePerCall int64) Inspect
ReviewAgent : func(agentId string, rating int, comment string) Inspect
RemoveAgent : func(id string) Inspect
DepositCredits : func(agentId string) Inspect
UseCredit : func(agentId string, userAddr string) int64 Inspect
GetCredits : func(agentId string, userAddr string) int64 Inspect
GetUsage : func(agentId string, userAddr string) int64 Inspect
GetEarnings : func(agentId string) int64 Inspect
WithdrawEarnings : func(agentId string) Inspect
RefundCredits : func(agentId string) Inspect
Render : func(path string) string Inspect
renderHome : func() string Inspect
renderAgent : func(id string) string Inspect
renderStats : func() string Inspect
formatRating : func(sum int64, count int64) string Inspect
truncAddr : func(addr .uverse.address) string Inspect
isValidTransport : func(t string) bool Inspect
isValidPricing : func(p string) bool Inspect
sanitizeForRender : func(s string) string Inspect
countAgentsByCreator : func(creator .uverse.address) int Inspect
countDepositors : func(agentId string) int Inspect
hasAnyCreditsEntry : func(agentId string) bool Inspect
isValidAgentID : func(id string) bool Inspect