# SkillScriptGrant

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.skillscriptgrant/
> Summary: SkillScriptGrant: The record carrying permission to execute a skill script.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

The record carrying permission to execute a skill script.

```csharp
public sealed record SkillScriptGrant : IEquatable<SkillScriptGrant>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.skillscriptgrant/">SkillScriptGrant</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;SkillScriptGrant&gt;</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

Script execution is a deliberate exception to Tracon's "tools are
defined only in code" rule. The grant record is this exception's gate: a
script with no grant record does not run, even with a whitelisted interpreter.

If [SkillScriptGrant.ScriptName](/api/tracon.skillscriptgrant/#Tracon_SkillScriptGrant_ScriptName) is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), the grant covers
*all* of the skill's scripts.

A grant for a stored or code-defined skill pins the content it was given for
([SkillScriptGrant.ContentHash](/api/tracon.skillscriptgrant/#Tracon_SkillScriptGrant_ContentHash)): a script whose content changes afterwards does not
run until it is granted again. A script on disk is not pinned.

## Constructors

### <a id="Tracon_SkillScriptGrant__ctor"></a> SkillScriptGrant\(\)

```csharp
public SkillScriptGrant()
```

## Properties

### <a id="Tracon_SkillScriptGrant_ContentHash"></a> ContentHash

The content the grant authorizes: the script's content hash when a script
name is set, the fingerprint of the whole script set when it is not.

```csharp
public string? ContentHash { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

#### Remarks

The values are [AgentSkillScriptDefinition.ContentHash](/api/tracon.agentskillscriptdefinition/#Tracon_AgentSkillScriptDefinition_ContentHash) and
[AgentSkillDefinition.ScriptSetHash](/api/tracon.agentskilldefinition/#Tracon_AgentSkillDefinition_ScriptSetHash).

[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) means the grant pins nothing, so it authorizes scripts
read from disk only: a stored or code-defined script is refused under it.
A grant written before content pinning existed carries [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null)
and has to be given again. A store implementation must keep this value.

### <a id="Tracon_SkillScriptGrant_ExpiresAt"></a> ExpiresAt

The moment the grant expires. Never expires if [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

```csharp
public DateTimeOffset? ExpiresAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)?

### <a id="Tracon_SkillScriptGrant_GrantedAt"></a> GrantedAt

The moment the grant was given (UTC).

```csharp
public DateTimeOffset GrantedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

### <a id="Tracon_SkillScriptGrant_GrantedBy"></a> GrantedBy

The actor who gave the grant.

```csharp
public string? GrantedBy { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_SkillScriptGrant_Id"></a> Id

The grant record identifier. A time-ordered UUID (v7).

```csharp
public Guid Id { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)

### <a id="Tracon_SkillScriptGrant_RevokedAt"></a> RevokedAt

The moment the grant was revoked. Active if [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

```csharp
public DateTimeOffset? RevokedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)?

### <a id="Tracon_SkillScriptGrant_ScriptName"></a> ScriptName

The name of the script granted. If [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), all of the
skill's scripts are covered.

```csharp
public string? ScriptName { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_SkillScriptGrant_SkillName"></a> SkillName

The name of the skill granted.

```csharp
public required string SkillName { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_SkillScriptGrant_TenantId"></a> TenantId

The tenant the grant belongs to.

```csharp
public required string TenantId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### <a id="Tracon_SkillScriptGrant_Equals_System_Object_"></a> Equals\(object?\)

```csharp
public override bool Equals(object? obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SkillScriptGrant_Equals_Tracon_SkillScriptGrant_"></a> Equals\(SkillScriptGrant?\)

```csharp
public bool Equals(SkillScriptGrant? other)
```

#### Parameters

`other` [SkillScriptGrant](/api/tracon.skillscriptgrant/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SkillScriptGrant_GetHashCode"></a> GetHashCode\(\)

```csharp
public override int GetHashCode()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_SkillScriptGrant_IsActiveAt_System_DateTimeOffset_"></a> IsActiveAt\(DateTimeOffset\)

Reports whether the grant is active at the given moment.

```csharp
public bool IsActiveAt(DateTimeOffset instant)
```

#### Parameters

`instant` [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

The evaluation moment.

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

[true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the grant is active.

#### Remarks

An expired grant is **automatically** invalid; the record
is not expected to be deleted. Removing the row is retention's concern.

### <a id="Tracon_SkillScriptGrant_ToString"></a> ToString\(\)

```csharp
public override string ToString()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Operators

### <a id="Tracon_SkillScriptGrant_op_Equality_Tracon_SkillScriptGrant_Tracon_SkillScriptGrant_"></a> operator ==\(SkillScriptGrant?, SkillScriptGrant?\)

```csharp
public static bool operator ==(SkillScriptGrant? left, SkillScriptGrant? right)
```

#### Parameters

`left` [SkillScriptGrant](/api/tracon.skillscriptgrant/)?

`right` [SkillScriptGrant](/api/tracon.skillscriptgrant/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SkillScriptGrant_op_Inequality_Tracon_SkillScriptGrant_Tracon_SkillScriptGrant_"></a> operator \!=\(SkillScriptGrant?, SkillScriptGrant?\)

```csharp
public static bool operator !=(SkillScriptGrant? left, SkillScriptGrant? right)
```

#### Parameters

`left` [SkillScriptGrant](/api/tracon.skillscriptgrant/)?

`right` [SkillScriptGrant](/api/tracon.skillscriptgrant/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)
