Class: default
Defined in: AgentStorage.ts:63
Main entry point for the Cleft SDK.
Coordinates all storage modules: wallet policy, checkpoint persistence, append-only logging, and ERC-8004 agent identity.
Use the public checkpoints and logs properties to interact with storage.
Do not call _store() or _retrieve() directly — they are private primitives
used internally by CheckpointStore and LogStore.
Properties
checkpoints
readonlycheckpoints:CheckpointStore
Defined in: AgentStorage.ts:71
Versioned world-state checkpoint store.
identity
readonlyidentity:AgentIdentity
Defined in: AgentStorage.ts:67
ERC-8004 identity — source of truth for latestPieceCid.
logs
readonlylogs:LogStore
Defined in: AgentStorage.ts:73
Append-only audit log store.
wallet
readonlywallet:AgentWallet
Defined in: AgentStorage.ts:69
Wallet policy wrapper — call assertSufficientFunds before expensive ops.
Methods
budget()
budget():
Promise<bigint>
Defined in: AgentStorage.ts:170
Returns the wallet balance in atto-USDFC.
Returns
Promise<bigint>
getLatestPieceCid()
getLatestPieceCid():
string
Defined in: AgentStorage.ts:203
Returns the latest checkpoint pieceCid, or null if no checkpoint exists.
Delegates to identity.getLatestPieceCid() — the chain is the source of truth.
Returns
string
health()
health():
Promise<HealthReport>
Defined in: AgentStorage.ts:177
Returns an operational health summary for checkpoints, logs, and wallet.
Returns
Promise<HealthReport>
create()
staticcreate(config):Promise<AgentStorage>
Defined in: AgentStorage.ts:93
Builds an AgentStorage instance from runtime config.
Initialisation order:
- Establish Synapse / Filecoin connection
- Bind
store/retrieveFilecoin primitives as injectable closures - Initialise
AgentWalletwith wallet policy - Initialise
AgentIdentity— registers on-chain (first run) or restoreslatestPieceCidfrom the ERC-8004 agent card (subsequent runs) - Initialise
CheckpointPolicy - Initialise
CheckpointStorewith injected closures, identity, and policy - Restore
latestPieceCidintoCheckpointStorefrom identity - Initialise
LogStorewith injected store closure
Parameters
config
SDK configuration.
Returns
Promise<AgentStorage>
A fully wired AgentStorage instance, ready to use.