@agenticprimitives/contracts 1.0.0-alpha.5 → 1.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUDIT.md +119 -27
- package/README.md +47 -12
- package/deployments-base-sepolia.json +52 -1
- package/deployments-faithchain.json +103 -0
- package/deployments-hopechain.json +78 -0
- package/deployments-paymaster-anvil.json +1 -0
- package/deployments-registries-base-sepolia.json +1 -0
- package/deployments-registries-hopechain.json +1 -0
- package/dist/abi/AccountBootstrap.json +99 -0
- package/dist/abi/AgentAccount.json +461 -67
- package/dist/abi/AgentAccountFactory.json +309 -0
- package/dist/abi/AgentNameAttributeResolver.json +212 -0
- package/dist/abi/AgentNameRegistry.json +544 -0
- package/dist/abi/AgentNameUniversalResolver.json +222 -0
- package/dist/abi/AgentProfileResolver.json +236 -0
- package/dist/abi/AgentRegistryBase.json +1003 -0
- package/dist/abi/AgentRelationship.json +405 -0
- package/dist/abi/AgenticGovernance.json +155 -0
- package/dist/abi/AgreementRegistry.json +203 -5
- package/dist/abi/AllowedMethodsEnforcer.json +193 -0
- package/dist/abi/AllowedTargetsEnforcer.json +193 -0
- package/dist/abi/ApprovedHashRegistry.json +267 -2
- package/dist/abi/AttestationRegistry.json +242 -0
- package/dist/abi/AttributeStorage.json +24 -0
- package/dist/abi/CallDataHashEnforcer.json +193 -0
- package/dist/abi/CustodyPolicy.json +422 -55
- package/dist/abi/DelegationManager.json +292 -0
- package/dist/abi/DigestBindingEnforcer.json +541 -0
- package/dist/abi/Eip7702.json +13 -0
- package/dist/abi/EstateProjectionRegistry.json +599 -0
- package/dist/abi/Generation5Bridge.json +355 -0
- package/dist/abi/GeoFeatureRegistry.json +235 -0
- package/dist/abi/IAgentAccountFactoryView.json +26 -0
- package/dist/abi/IAgentAccountGovernanceTimelockView.json +15 -0
- package/dist/abi/IApprovedHashRegistryWrite.json +35 -0
- package/dist/abi/ICustodyEpochView.json +28 -0
- package/dist/abi/ICustodyPolicyAccountModuleView.json +31 -0
- package/dist/abi/ICustodyPolicyFactoryView.json +13 -0
- package/dist/abi/ICustodyPolicyPasskeyView.json +50 -0
- package/dist/abi/IDelegationManager.json +18 -0
- package/dist/abi/IGeneration4Reads.json +143 -0
- package/dist/abi/IGeneration5Account.json +33 -0
- package/dist/abi/IGeneration5Voucher.json +26 -0
- package/dist/abi/IMoveAccountView.json +57 -0
- package/dist/abi/IMoveCustodyView.json +169 -0
- package/dist/abi/IMoveFactoryView.json +41 -0
- package/dist/abi/IPaymentReceiptRegistry.json +50 -0
- package/dist/abi/IRedemptionContext.json +15 -0
- package/dist/abi/IRegistryMembershipPolicy.json +70 -0
- package/dist/abi/ITimelockVeto.json +93 -0
- package/dist/abi/ITreasurySpendPolicyAccountView.json +44 -0
- package/dist/abi/IUpgradeVoucherView.json +26 -0
- package/dist/abi/MockUSDC.json +621 -0
- package/dist/abi/OntologyTermRegistry.json +268 -0
- package/dist/abi/PayloadClassesEnforcer.json +310 -0
- package/dist/abi/PaymentEnforcer.json +639 -0
- package/dist/abi/PaymentEscrow.json +501 -0
- package/dist/abi/PaymentReceiptRegistry.json +388 -0
- package/dist/abi/PermissionlessSubregistry.json +353 -0
- package/dist/abi/PricedSubregistry.json +1141 -0
- package/dist/abi/QuorumEnforcer.json +209 -0
- package/dist/abi/ReceiptAnchorRegistry.json +346 -0
- package/dist/abi/RelationshipTypeRegistry.json +268 -0
- package/dist/abi/ShapeRegistry.json +268 -0
- package/dist/abi/SignatureVerifier.json +196 -0
- package/dist/abi/SkillDefinitionRegistry.json +235 -0
- package/dist/abi/SmartAgentPaymaster.json +445 -1
- package/dist/abi/StableProxyGoverned.json +190 -0
- package/dist/abi/StableProxyGovernedOneShot.json +172 -0
- package/dist/abi/TimestampEnforcer.json +193 -0
- package/dist/abi/TreasurySpendPolicy.json +667 -0
- package/dist/abi/UpgradeVoucher.json +328 -0
- package/dist/abi/ValueEnforcer.json +193 -0
- package/dist/abi/index.d.ts +35 -0
- package/dist/abi/index.js +35 -0
- package/dist/deployments/base-sepolia.d.ts +11 -0
- package/dist/deployments/base-sepolia.js +51 -28
- package/dist/deployments/faithchain.d.ts +77 -0
- package/dist/deployments/faithchain.js +107 -0
- package/dist/deployments/hopechain.d.ts +68 -0
- package/dist/deployments/hopechain.js +82 -0
- package/dist/deployments/index.d.ts +7 -2
- package/dist/deployments/index.js +15 -0
- package/dist/deployments/paymaster-anvil.d.ts +11 -0
- package/dist/deployments/paymaster-anvil.js +9 -0
- package/dist/deployments/registries-base-sepolia.d.ts +10 -0
- package/dist/deployments/registries-base-sepolia.js +8 -0
- package/dist/deployments/registries-hopechain.d.ts +10 -0
- package/dist/deployments/registries-hopechain.js +8 -0
- package/package.json +37 -7
- package/src/AccountBootstrap.sol +38 -0
- package/src/AgentAccount.sol +1091 -134
- package/src/AgentAccountFactory.sol +198 -21
- package/src/ApprovedHashRegistry.sol +134 -10
- package/src/IAgentAccount.sol +37 -0
- package/src/SmartAgentPaymaster.sol +275 -22
- package/src/UniversalSignatureValidator.sol +7 -0
- package/src/UpgradeVoucher.sol +87 -0
- package/src/agency/DelegationManager.sol +299 -76
- package/src/agency/ICaveatEnforcer.sol +10 -0
- package/src/agency/IDelegationManager.sol +37 -5
- package/src/agreement/AgreementRegistry.sol +105 -35
- package/src/attestation/AttestationRegistry.sol +220 -40
- package/src/custody/CustodyPolicy.sol +588 -70
- package/src/custody/TreasurySpendPolicy.sol +338 -0
- package/src/enforcers/AllowedMethodsEnforcer.sol +13 -2
- package/src/enforcers/AllowedTargetsEnforcer.sol +13 -2
- package/src/enforcers/CallDataHashEnforcer.sol +7 -1
- package/src/enforcers/DigestBindingEnforcer.sol +182 -0
- package/src/enforcers/PayloadClassesEnforcer.sol +36 -0
- package/src/enforcers/PaymentEnforcer.sol +291 -0
- package/src/enforcers/QuorumEnforcer.sol +24 -3
- package/src/enforcers/TimestampEnforcer.sol +7 -1
- package/src/enforcers/ValueEnforcer.sol +13 -2
- package/src/geo/GeoFeatureRegistry.sol +67 -22
- package/src/governance/AgenticGovernance.sol +187 -4
- package/src/governance/GovernanceManaged.sol +2 -0
- package/src/governance/StableProxyGoverned.sol +79 -0
- package/src/governance/StableProxyGovernedOneShot.sol +93 -0
- package/src/identity/AgentProfilePredicates.sol +23 -0
- package/src/identity/AgentProfileResolver.sol +22 -2
- package/src/libraries/Eip7702.sol +36 -0
- package/src/libraries/SignatureSlotRecovery.sol +28 -7
- package/src/libraries/SignatureVerifier.sol +52 -0
- package/src/libraries/WebAuthnLib.sol +16 -0
- package/src/migration/Generation5Bridge.sol +364 -0
- package/src/mocks/MockUSDC.sol +152 -0
- package/src/naming/AgentNameAttributeResolver.sol +29 -4
- package/src/naming/AgentNamePredicates.sol +89 -0
- package/src/naming/AgentNameRegistry.sol +324 -20
- package/src/naming/AgentNameUniversalResolver.sol +35 -2
- package/src/naming/PermissionlessSubregistry.sol +82 -25
- package/src/naming/PricedSubregistry.sol +293 -0
- package/src/ontology/AttributeStorage.sol +93 -80
- package/src/ontology/OntologyTermRegistry.sol +58 -2
- package/src/ontology/ShapeRegistry.sol +58 -2
- package/src/payments/PaymentEscrow.sol +187 -0
- package/src/payments/PaymentReceiptRegistry.sol +100 -0
- package/src/provenance/ReceiptAnchorRegistry.sol +67 -0
- package/src/registry/AgentRegistryBase.sol +372 -0
- package/src/registry/EstateProjectionRegistry.sol +177 -0
- package/src/registry/IRegistryMembershipPolicy.sol +30 -0
- package/src/relationships/AgentRelationship.sol +129 -8
- package/src/relationships/RelationshipTypeRegistry.sol +58 -2
- package/src/skills/SkillDefinitionRegistry.sol +61 -17
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
|
+
import "../governance/StableProxyGoverned.sol";
|
|
4
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @title SkillDefinitionRegistry
|
|
@@ -35,7 +37,13 @@ pragma solidity ^0.8.28;
|
|
|
35
37
|
* Ported from smart-agent `SkillDefinitionRegistry`; diverges per spec 251 (AP
|
|
36
38
|
* auth model, C-box-anchored kinds, no `.skill` name binding in v1).
|
|
37
39
|
*/
|
|
38
|
-
contract SkillDefinitionRegistry {
|
|
40
|
+
contract SkillDefinitionRegistry is StableProxyGoverned {
|
|
41
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
42
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
43
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
44
|
+
/// the proxy and nothing else.
|
|
45
|
+
constructor() initializer {}
|
|
46
|
+
|
|
39
47
|
// ─── C-box skill-kind codelist (keccak of the cbox vocabulary URIs) ──
|
|
40
48
|
// Concept URIs are declared in packages/ontology cbox/skill-vocabulary.ttl
|
|
41
49
|
// (scheme aps:skillKind); the lockstep gate asserts these equal keccak of
|
|
@@ -52,6 +60,8 @@ contract SkillDefinitionRegistry {
|
|
|
52
60
|
error SkillNotFound();
|
|
53
61
|
error EmptyMetadata();
|
|
54
62
|
error EmptyId();
|
|
63
|
+
/// @notice REG-15 — `setValidity` may only end a version's window earlier.
|
|
64
|
+
error ValidityNotNarrowed();
|
|
55
65
|
|
|
56
66
|
// ─── Storage ────────────────────────────────────────────────────────
|
|
57
67
|
struct SkillRecord {
|
|
@@ -106,6 +116,7 @@ contract SkillDefinitionRegistry {
|
|
|
106
116
|
if (p.skillId == bytes32(0)) revert EmptyId();
|
|
107
117
|
if (bytes(p.metadataURI).length == 0) revert EmptyMetadata();
|
|
108
118
|
// SDR-02 — only the steward SA, acting through its own execute() path.
|
|
119
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
109
120
|
if (msg.sender != p.stewardAccount) revert NotSteward();
|
|
110
121
|
|
|
111
122
|
uint64 prevVer = latestVersion[p.skillId];
|
|
@@ -116,24 +127,30 @@ contract SkillDefinitionRegistry {
|
|
|
116
127
|
|
|
117
128
|
version = prevVer + 1;
|
|
118
129
|
bytes32 predecessorRoot = prevVer == 0 ? bytes32(0) : _records[p.skillId][prevVer].ontologyMerkleRoot;
|
|
119
|
-
|
|
120
|
-
_records[p.skillId][version] = SkillRecord({
|
|
121
|
-
skillId: p.skillId,
|
|
122
|
-
version: version,
|
|
123
|
-
stewardAccount: p.stewardAccount,
|
|
124
|
-
skillKind: p.skillKind,
|
|
125
|
-
conceptHash: p.conceptHash,
|
|
126
|
-
ontologyMerkleRoot: p.ontologyMerkleRoot,
|
|
127
|
-
predecessorRoot: predecessorRoot,
|
|
128
|
-
metadataURI: p.metadataURI,
|
|
129
|
-
validAfter: p.validAfter,
|
|
130
|
-
validUntil: p.validUntil,
|
|
131
|
-
active: true,
|
|
132
|
-
registeredAt: uint64(block.timestamp)
|
|
133
|
-
});
|
|
134
130
|
latestVersion[p.skillId] = version;
|
|
135
131
|
if (prevVer == 0) _allSkills.push(p.skillId);
|
|
132
|
+
// The heavy record write + event live in a helper so `publish`'s own stack stays shallow.
|
|
133
|
+
_storeAndEmit(p, version, predecessorRoot);
|
|
134
|
+
}
|
|
136
135
|
|
|
136
|
+
/// @dev Writes the record FIELD-BY-FIELD to storage (no in-memory struct literal) and emits.
|
|
137
|
+
/// Behaviour is identical to the prior `_records[...] = SkillRecord({...})` literal; the split
|
|
138
|
+
/// exists only to keep `publish` within solc's stack under `forge coverage --ir-minimum`
|
|
139
|
+
/// instrumentation (the memory struct literal + a dynamic `string` overflowed it by one slot).
|
|
140
|
+
function _storeAndEmit(PublishInput calldata p, uint64 version, bytes32 predecessorRoot) internal {
|
|
141
|
+
SkillRecord storage r = _records[p.skillId][version];
|
|
142
|
+
r.skillId = p.skillId;
|
|
143
|
+
r.version = version;
|
|
144
|
+
r.stewardAccount = p.stewardAccount;
|
|
145
|
+
r.skillKind = p.skillKind;
|
|
146
|
+
r.conceptHash = p.conceptHash;
|
|
147
|
+
r.ontologyMerkleRoot = p.ontologyMerkleRoot;
|
|
148
|
+
r.predecessorRoot = predecessorRoot;
|
|
149
|
+
r.metadataURI = p.metadataURI;
|
|
150
|
+
r.validAfter = p.validAfter;
|
|
151
|
+
r.validUntil = p.validUntil;
|
|
152
|
+
r.active = true;
|
|
153
|
+
r.registeredAt = uint64(block.timestamp);
|
|
137
154
|
emit SkillPublished(p.skillId, version, p.stewardAccount, p.skillKind, p.conceptHash, p.ontologyMerkleRoot, predecessorRoot, p.metadataURI);
|
|
138
155
|
}
|
|
139
156
|
|
|
@@ -142,6 +159,7 @@ contract SkillDefinitionRegistry {
|
|
|
142
159
|
uint64 v = latestVersion[skillId];
|
|
143
160
|
if (v == 0) revert SkillNotFound();
|
|
144
161
|
SkillRecord storage r = _records[skillId][v];
|
|
162
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
145
163
|
if (msg.sender != r.stewardAccount) revert NotSteward();
|
|
146
164
|
r.active = false;
|
|
147
165
|
emit SkillDeactivated(skillId, v);
|
|
@@ -151,8 +169,14 @@ contract SkillDefinitionRegistry {
|
|
|
151
169
|
function setValidity(bytes32 skillId, uint64 version, uint64 validAfter, uint64 validUntil) external {
|
|
152
170
|
SkillRecord storage r = _records[skillId][version];
|
|
153
171
|
if (r.version == 0) revert SkillNotFound();
|
|
172
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
154
173
|
if (msg.sender != r.stewardAccount) revert NotSteward();
|
|
155
|
-
|
|
174
|
+
// REG-15: a published version's window can be ENDED, never rewritten. `validAfter` is fixed at
|
|
175
|
+
// publish; `validUntil` may be set (0 → a time) or moved earlier, not extended or cleared — a
|
|
176
|
+
// credential that pinned this version must not find its window widened after the fact. To extend,
|
|
177
|
+
// publish a new version.
|
|
178
|
+
if (validAfter != r.validAfter) revert ValidityNotNarrowed();
|
|
179
|
+
if (validUntil == 0 || (r.validUntil != 0 && validUntil > r.validUntil)) revert ValidityNotNarrowed();
|
|
156
180
|
r.validUntil = validUntil;
|
|
157
181
|
emit SkillValidityChanged(skillId, version, validAfter, validUntil);
|
|
158
182
|
}
|
|
@@ -160,6 +184,8 @@ contract SkillDefinitionRegistry {
|
|
|
160
184
|
// ─── Views ──────────────────────────────────────────────────────────
|
|
161
185
|
function getSkill(bytes32 skillId, uint64 version) external view returns (SkillRecord memory) {
|
|
162
186
|
SkillRecord memory r = _records[skillId][version];
|
|
187
|
+
// Zero-default existence check (versions are 1-based) — benign.
|
|
188
|
+
// slither-disable-next-line incorrect-equality
|
|
163
189
|
if (r.version == 0) revert SkillNotFound();
|
|
164
190
|
return r;
|
|
165
191
|
}
|
|
@@ -178,4 +204,22 @@ contract SkillDefinitionRegistry {
|
|
|
178
204
|
function allSkills() external view returns (bytes32[] memory) {
|
|
179
205
|
return _allSkills;
|
|
180
206
|
}
|
|
207
|
+
|
|
208
|
+
function skillCount() external view returns (uint256) {
|
|
209
|
+
return _allSkills.length;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/// @notice REG-12 — a bounded window of the id index: `limit` ids from `offset` (fewer at the end).
|
|
213
|
+
/// `allSkills()` is unbounded (anyone may publish a new id) and is kept for small deployments.
|
|
214
|
+
function allSkillsPage(uint256 offset, uint256 limit) external view returns (bytes32[] memory page) {
|
|
215
|
+
uint256 n = _allSkills.length;
|
|
216
|
+
if (offset >= n) return new bytes32[](0);
|
|
217
|
+
uint256 end = offset + limit;
|
|
218
|
+
if (end > n) end = n;
|
|
219
|
+
page = new bytes32[](end - offset);
|
|
220
|
+
for (uint256 i = offset; i < end; i++) page[i - offset] = _allSkills[i];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
224
|
+
uint256[47] private __gap;
|
|
181
225
|
}
|