339b7de700
CI / lint (push) Successful in 15s
CI / typecheck (push) Successful in 30s
CI / security (push) Successful in 24s
CI / quality (push) Successful in 16s
CI / integration_tests (push) Successful in 5m6s
CI / build (push) Successful in 15s
CI / unit_tests (push) Successful in 16m32s
CI / docker (push) Successful in 9s
CI / coverage (push) Has been cancelled
5.0 KiB
5.0 KiB
Resource Domain Model
A Resource is a registered entry in the Resource Registry representing a
physical or virtual asset that plans operate on. Resources are organized in
a DAG, linked to projects, and sandboxed during plan execution.
PhysVirt
| Value | Description |
|---|---|
physical |
Real, tangible resource (file, directory, git repository) |
virtual |
Derived or computed resource (git branch, tree entry) |
SandboxStrategy
| Value | Description |
|---|---|
git_worktree |
Isolate via Git worktree |
copy_on_write |
Isolate via filesystem copy |
transaction_rollback |
Isolate via database transaction rollback |
snapshot |
Isolate via snapshot/restore |
none |
No isolation |
ResourceCapabilities
Capability flags derived from the resource type:
| Field | Type | Default | Description |
|---|---|---|---|
readable |
bool |
True |
Whether the resource can be read |
writable |
bool |
True |
Whether the resource can be modified |
sandboxable |
bool |
True |
Whether the resource supports sandbox isolation |
checkpointable |
bool |
False |
Whether the resource supports checkpoint/rollback |
Resource Fields
| Field | Type | Default | Description |
|---|---|---|---|
resource_id |
str |
(required) | Unique ULID identifier (primary key) |
name |
str | None |
None |
Namespaced name (NULL for auto-discovered children) |
resource_type_name |
str |
(required) | Namespaced type name (e.g., git-checkout) |
classification |
PhysVirt |
(required) | Physical or virtual classification |
description |
str | None |
None |
Human-readable description |
properties |
dict[str, ...] |
{} |
Type-specific properties (stored as JSON) |
location |
str | None |
None |
Physical location (physical resources only) |
content_hash |
str | None |
None |
Content hash for equivalence tracking |
sandbox_strategy |
SandboxStrategy | None |
None |
Per-resource sandbox strategy override |
capabilities |
ResourceCapabilities |
ResourceCapabilities() |
Capability flags |
parents |
list[str] |
[] |
Parent resource_id list (DAG upward references) |
children |
list[str] |
[] |
Child resource_id list (DAG downward references) |
linked_projects |
list[str] |
[] |
Project names this resource is linked to |
created_at |
datetime |
datetime.now(UTC) |
Creation timestamp |
updated_at |
datetime |
datetime.now(UTC) |
Last modification timestamp |
Constraints:
resource_idmust match ULID format (^[0-9A-HJKMNP-TV-Z]{26}$)nameif provided must not be empty or whitespace-onlyresource_type_namemust not be emptylocationif provided must not be empty or whitespace-only
Properties
resource.is_physical-- True if classification isphysicalresource.is_virtual-- True if classification isvirtualresource.can_sandbox-- True if capabilities includesandboxableresource.can_checkpoint-- True if capabilities includecheckpointableresource.is_read_only-- True if capabilities do not includewritable
Methods
resource.with_updated_at()-- Return a frozen copy withupdated_atset to now (UTC)
Source Location
- Model:
src/cleveragents/domain/models/core/resource.py - Resource type model:
src/cleveragents/domain/models/core/resource_type.py
Related
- Resource Type Model -- Resource type schema definitions
- Database Schema -- Persistence layer