Skip to content

InMemorySkillScriptGrantStore

Namespace AgentPrism · Assembly AgentPrism.Core.dll

A store that keeps script execution grants in process memory.

public sealed class InMemorySkillScriptGrantStore : ISkillScriptGrantStore

objectInMemorySkillScriptGrantStore

ISkillScriptGrantStore

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Use the persistent store from AgentPrism.PostgreSql in production. This implementation is for development and tests. Grants are lost when the process restarts, so no script runs by default.

public InMemorySkillScriptGrantStore()

FindActiveAsync(string, string, string, DateTimeOffset, CancellationToken)

Section titled “ FindActiveAsync(string, string, string, DateTimeOffset, CancellationToken)”

Finds the active grant for the given script.

public ValueTask<SkillScriptGrant?> FindActiveAsync(string tenantId, string skillName, string scriptName, DateTimeOffset instant, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

skillName string

The skill name.

scriptName string

The script name.

instant DateTimeOffset

The moment to check validity at.

cancellationToken CancellationToken

The cancellation token.

ValueTask<SkillScriptGrant?>

The script-specific grant first, or the skill-wide grant otherwise. null if no active grant exists.

GrantAsync(SkillScriptGrant, CancellationToken)

Section titled “ GrantAsync(SkillScriptGrant, CancellationToken)”

Grants access, or updates an existing grant.

public ValueTask<SkillScriptGrant> GrantAsync(SkillScriptGrant grant, CancellationToken cancellationToken = default)

grant SkillScriptGrant

The grant to save.

cancellationToken CancellationToken

The cancellation token.

ValueTask<SkillScriptGrant>

The grant with its identifier and timestamp assigned.

Lists all of a tenant’s grant records.

public ValueTask<IReadOnlyList<SkillScriptGrant>> ListAsync(string tenantId, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<SkillScriptGrant>>

All grants, including revoked and expired records.

RevokeAsync(string, string, string?, CancellationToken)

Section titled “ RevokeAsync(string, string, string?, CancellationToken)”

Revokes a grant.

public ValueTask<bool> RevokeAsync(string tenantId, string skillName, string? scriptName, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

skillName string

The skill name.

scriptName string?

The script name; null for the skill-wide grant.

cancellationToken CancellationToken

The cancellation token.

ValueTask<bool>

true if an active grant was revoked.