@agenticprimitives/contracts 1.0.0-alpha.48 → 1.0.0-alpha.49
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 +36 -4
- package/dist/abi/AccountBootstrap.json +99 -0
- package/dist/abi/AgentAccount.json +95 -56
- package/dist/abi/AgentAccountFactory.json +189 -0
- package/dist/abi/AgentNameAttributeResolver.json +188 -0
- package/dist/abi/AgentNameRegistry.json +170 -0
- package/dist/abi/AgentNameUniversalResolver.json +188 -0
- package/dist/abi/AgentProfileResolver.json +188 -0
- package/dist/abi/AgentRegistryBase.json +193 -0
- package/dist/abi/AgentRelationship.json +193 -0
- package/dist/abi/AgenticGovernance.json +123 -0
- package/dist/abi/AgreementRegistry.json +193 -0
- package/dist/abi/AllowedMethodsEnforcer.json +193 -0
- package/dist/abi/AllowedTargetsEnforcer.json +193 -0
- package/dist/abi/ApprovedHashRegistry.json +220 -0
- package/dist/abi/AttestationRegistry.json +193 -0
- package/dist/abi/CallDataHashEnforcer.json +193 -0
- package/dist/abi/CustodyPolicy.json +195 -80
- package/dist/abi/DelegationManager.json +185 -0
- package/dist/abi/DigestBindingEnforcer.json +188 -0
- package/dist/abi/Eip7702.json +13 -0
- package/dist/abi/EstateProjectionRegistry.json +193 -0
- package/dist/abi/Generation5Bridge.json +355 -0
- package/dist/abi/GeoFeatureRegistry.json +193 -0
- package/dist/abi/ICustodyEpochView.json +28 -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/ITimelockVeto.json +93 -0
- package/dist/abi/OntologyTermRegistry.json +211 -0
- package/dist/abi/PayloadClassesEnforcer.json +193 -0
- package/dist/abi/PaymentEnforcer.json +188 -0
- package/dist/abi/PaymentEscrow.json +177 -0
- package/dist/abi/PaymentReceiptRegistry.json +206 -0
- package/dist/abi/PermissionlessSubregistry.json +188 -0
- package/dist/abi/PricedSubregistry.json +215 -0
- package/dist/abi/QuorumEnforcer.json +193 -0
- package/dist/abi/ReceiptAnchorRegistry.json +193 -0
- package/dist/abi/RelationshipTypeRegistry.json +211 -0
- package/dist/abi/ShapeRegistry.json +211 -0
- package/dist/abi/SignatureVerifier.json +196 -0
- package/dist/abi/SkillDefinitionRegistry.json +193 -0
- package/dist/abi/SmartAgentPaymaster.json +236 -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 +193 -0
- package/dist/abi/UpgradeVoucher.json +156 -4
- package/dist/abi/ValueEnforcer.json +193 -0
- package/dist/abi/index.d.ts +14 -0
- package/dist/abi/index.js +14 -0
- package/package.json +1 -1
- package/src/AccountBootstrap.sol +38 -0
- package/src/AgentAccount.sol +149 -41
- package/src/AgentAccountFactory.sol +52 -13
- package/src/ApprovedHashRegistry.sol +98 -9
- package/src/SmartAgentPaymaster.sol +96 -12
- package/src/UniversalSignatureValidator.sol +7 -0
- package/src/UpgradeVoucher.sol +16 -3
- package/src/agency/DelegationManager.sol +106 -32
- package/src/agency/IDelegationManager.sol +28 -0
- package/src/agreement/AgreementRegistry.sol +16 -15
- package/src/attestation/AttestationRegistry.sol +39 -16
- package/src/custody/CustodyPolicy.sol +36 -35
- package/src/custody/TreasurySpendPolicy.sol +10 -1
- package/src/enforcers/AllowedMethodsEnforcer.sol +7 -1
- package/src/enforcers/AllowedTargetsEnforcer.sol +7 -1
- package/src/enforcers/CallDataHashEnforcer.sol +7 -1
- package/src/enforcers/DigestBindingEnforcer.sol +5 -2
- package/src/enforcers/PayloadClassesEnforcer.sol +7 -1
- package/src/enforcers/PaymentEnforcer.sol +5 -2
- package/src/enforcers/QuorumEnforcer.sol +7 -1
- package/src/enforcers/TimestampEnforcer.sol +7 -1
- package/src/enforcers/ValueEnforcer.sol +7 -1
- package/src/geo/GeoFeatureRegistry.sol +15 -1
- package/src/governance/AgenticGovernance.sol +145 -0
- package/src/governance/GovernanceManaged.sol +2 -0
- package/src/governance/StableProxyGoverned.sol +79 -0
- package/src/governance/StableProxyGovernedOneShot.sol +93 -0
- package/src/identity/AgentProfileResolver.sol +11 -2
- package/src/libraries/Eip7702.sol +36 -0
- package/src/libraries/SignatureSlotRecovery.sol +4 -0
- package/src/libraries/SignatureVerifier.sol +52 -0
- package/src/libraries/WebAuthnLib.sol +3 -0
- package/src/migration/Generation5Bridge.sol +364 -0
- package/src/naming/AgentNameAttributeResolver.sol +12 -2
- package/src/naming/AgentNameRegistry.sol +84 -10
- package/src/naming/AgentNameUniversalResolver.sol +9 -2
- package/src/naming/PermissionlessSubregistry.sol +13 -2
- package/src/naming/PricedSubregistry.sol +59 -3
- package/src/ontology/OntologyTermRegistry.sol +30 -2
- package/src/ontology/ShapeRegistry.sol +30 -2
- package/src/payments/PaymentEscrow.sol +16 -1
- package/src/payments/PaymentReceiptRegistry.sol +28 -3
- package/src/provenance/ReceiptAnchorRegistry.sol +13 -1
- package/src/registry/AgentRegistryBase.sol +21 -1
- package/src/registry/EstateProjectionRegistry.sol +15 -1
- package/src/relationships/AgentRelationship.sol +17 -1
- package/src/relationships/RelationshipTypeRegistry.sol +30 -2
- package/src/skills/SkillDefinitionRegistry.sol +15 -1
|
@@ -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 AgentRelationship
|
|
@@ -41,7 +43,13 @@ pragma solidity ^0.8.28;
|
|
|
41
43
|
// Disabling Slither's `incorrect-equality` at the contract scope
|
|
42
44
|
// keeps these inline reads idiomatic.
|
|
43
45
|
// slither-disable-start incorrect-equality
|
|
44
|
-
contract AgentRelationship {
|
|
46
|
+
contract AgentRelationship is StableProxyGoverned {
|
|
47
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
48
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
49
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
50
|
+
/// the proxy and nothing else.
|
|
51
|
+
constructor() initializer {}
|
|
52
|
+
|
|
45
53
|
enum EdgeStatus {
|
|
46
54
|
NONE, // 0 — never set (sentinel)
|
|
47
55
|
PROPOSED, // 1
|
|
@@ -155,6 +163,7 @@ contract AgentRelationship {
|
|
|
155
163
|
) external returns (bytes32 edgeId) {
|
|
156
164
|
if (subject == address(0) || object_ == address(0)) revert InvalidEdge();
|
|
157
165
|
if (subject == object_) revert InvalidEdge();
|
|
166
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
158
167
|
if (msg.sender != subject) revert NotAuthorized();
|
|
159
168
|
edgeId = computeEdgeId(subject, object_, relationshipType);
|
|
160
169
|
bool reproposal = false;
|
|
@@ -213,6 +222,7 @@ contract AgentRelationship {
|
|
|
213
222
|
Edge storage e = _edges[edgeId];
|
|
214
223
|
if (e.createdAt == 0) revert EdgeNotFound();
|
|
215
224
|
if (e.status != EdgeStatus.PROPOSED) revert InvalidTransition();
|
|
225
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
216
226
|
if (msg.sender != e.object_) revert NotAuthorized();
|
|
217
227
|
e.status = EdgeStatus.CONFIRMED;
|
|
218
228
|
e.updatedAt = uint64(block.timestamp);
|
|
@@ -228,6 +238,7 @@ contract AgentRelationship {
|
|
|
228
238
|
Edge storage e = _edges[edgeId];
|
|
229
239
|
if (e.createdAt == 0) revert EdgeNotFound();
|
|
230
240
|
if (e.status != EdgeStatus.CONFIRMED) revert InvalidTransition();
|
|
241
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
231
242
|
if (msg.sender != e.subject && msg.sender != e.object_) revert NotAuthorized();
|
|
232
243
|
e.status = EdgeStatus.ACTIVE;
|
|
233
244
|
e.updatedAt = uint64(block.timestamp);
|
|
@@ -265,6 +276,7 @@ contract AgentRelationship {
|
|
|
265
276
|
function addRole(bytes32 edgeId, bytes32 role) external {
|
|
266
277
|
Edge storage e = _edges[edgeId];
|
|
267
278
|
if (e.createdAt == 0) revert EdgeNotFound();
|
|
279
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
268
280
|
if (msg.sender != e.subject && msg.sender != e.object_) revert NotAuthorized();
|
|
269
281
|
if (e.status == EdgeStatus.REVOKED) revert InvalidTransition();
|
|
270
282
|
if (_hasRole[edgeId][role]) revert RoleAlreadyExists();
|
|
@@ -321,6 +333,7 @@ contract AgentRelationship {
|
|
|
321
333
|
function setMetadata(bytes32 edgeId, string calldata metadataURI, bytes32 metadataHash) external {
|
|
322
334
|
Edge storage e = _edges[edgeId];
|
|
323
335
|
if (e.createdAt == 0) revert EdgeNotFound();
|
|
336
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
324
337
|
if (msg.sender != e.subject && msg.sender != e.object_) revert NotAuthorized();
|
|
325
338
|
if (e.status == EdgeStatus.REVOKED) revert InvalidTransition();
|
|
326
339
|
if (e.status == EdgeStatus.PROPOSED && msg.sender != e.subject) revert NotAuthorized();
|
|
@@ -398,5 +411,8 @@ contract AgentRelationship {
|
|
|
398
411
|
}
|
|
399
412
|
}
|
|
400
413
|
}
|
|
414
|
+
|
|
415
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
416
|
+
uint256[42] private __gap;
|
|
401
417
|
}
|
|
402
418
|
// slither-disable-end incorrect-equality
|
|
@@ -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 RelationshipTypeRegistry
|
|
@@ -20,7 +22,7 @@ pragma solidity ^0.8.28;
|
|
|
20
22
|
* (`packages/contracts/src/RelationshipTypeRegistry.sol`, 138 LOC) —
|
|
21
23
|
* structurally identical with constructor zero-governor guard.
|
|
22
24
|
*/
|
|
23
|
-
contract RelationshipTypeRegistry {
|
|
25
|
+
contract RelationshipTypeRegistry is StableProxyGoverned {
|
|
24
26
|
struct TypeSemantics {
|
|
25
27
|
bytes32 relationshipType;
|
|
26
28
|
string label;
|
|
@@ -45,13 +47,35 @@ contract RelationshipTypeRegistry {
|
|
|
45
47
|
error TypeExists();
|
|
46
48
|
error TypeNotFound();
|
|
47
49
|
error ZeroGovernor();
|
|
50
|
+
/// @dev Spec 447 — `initialize(address)` alone would leave the governor unset.
|
|
51
|
+
error GovernorRequired();
|
|
48
52
|
|
|
49
53
|
modifier onlyGovernor() {
|
|
54
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
50
55
|
if (msg.sender != governor) revert NotGovernor();
|
|
51
56
|
_;
|
|
52
57
|
}
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
/// @notice A DIRECT deployment: `governor_` runs the registry, and there is no upgrade governance (the code is
|
|
60
|
+
/// frozen, as before). Spec 447 — behind a stable proxy, `initialize(governance_, governor_)` instead.
|
|
61
|
+
constructor(address governor_) initializer {
|
|
62
|
+
_initGovernor(governor_);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// @notice Spec 447 — the proxy's initializer: `governance_` is the upgrade authority (only); `governor_` runs
|
|
66
|
+
/// the registry, exactly as the constructor's argument does. Once per proxy; never on the implementation.
|
|
67
|
+
function initialize(address governance_, address governor_) external initializer {
|
|
68
|
+
_initializeGovernance(governance_);
|
|
69
|
+
_initGovernor(governor_);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// @dev Spec 447 — the one-argument path would leave `governor` unset (a registry nobody can run), so it is
|
|
73
|
+
/// refused: `initialize(governance_, governor_)` is this contract's only initializer.
|
|
74
|
+
function initialize(address) external pure override {
|
|
75
|
+
revert GovernorRequired();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function _initGovernor(address governor_) private {
|
|
55
79
|
if (governor_ == address(0)) revert ZeroGovernor();
|
|
56
80
|
governor = governor_;
|
|
57
81
|
}
|
|
@@ -84,6 +108,7 @@ contract RelationshipTypeRegistry {
|
|
|
84
108
|
|
|
85
109
|
/// @notice Take the governor role. Only the proposed successor.
|
|
86
110
|
function acceptGovernor() external {
|
|
111
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
87
112
|
if (msg.sender != pendingGovernor || msg.sender == address(0)) revert NotPendingGovernor();
|
|
88
113
|
emit GovernorTransferred(governor, msg.sender);
|
|
89
114
|
governor = msg.sender;
|
|
@@ -168,4 +193,7 @@ contract RelationshipTypeRegistry {
|
|
|
168
193
|
function getAllTypeIds() external view returns (bytes32[] memory) {
|
|
169
194
|
return _typeIds;
|
|
170
195
|
}
|
|
196
|
+
|
|
197
|
+
/// @dev Spec 447 — storage gap: the registry may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
198
|
+
uint256[46] private __gap;
|
|
171
199
|
}
|
|
@@ -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
|
|
@@ -108,6 +116,7 @@ contract SkillDefinitionRegistry {
|
|
|
108
116
|
if (p.skillId == bytes32(0)) revert EmptyId();
|
|
109
117
|
if (bytes(p.metadataURI).length == 0) revert EmptyMetadata();
|
|
110
118
|
// SDR-02 — only the steward SA, acting through its own execute() path.
|
|
119
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
111
120
|
if (msg.sender != p.stewardAccount) revert NotSteward();
|
|
112
121
|
|
|
113
122
|
uint64 prevVer = latestVersion[p.skillId];
|
|
@@ -150,6 +159,7 @@ contract SkillDefinitionRegistry {
|
|
|
150
159
|
uint64 v = latestVersion[skillId];
|
|
151
160
|
if (v == 0) revert SkillNotFound();
|
|
152
161
|
SkillRecord storage r = _records[skillId][v];
|
|
162
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
153
163
|
if (msg.sender != r.stewardAccount) revert NotSteward();
|
|
154
164
|
r.active = false;
|
|
155
165
|
emit SkillDeactivated(skillId, v);
|
|
@@ -159,6 +169,7 @@ contract SkillDefinitionRegistry {
|
|
|
159
169
|
function setValidity(bytes32 skillId, uint64 version, uint64 validAfter, uint64 validUntil) external {
|
|
160
170
|
SkillRecord storage r = _records[skillId][version];
|
|
161
171
|
if (r.version == 0) revert SkillNotFound();
|
|
172
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
162
173
|
if (msg.sender != r.stewardAccount) revert NotSteward();
|
|
163
174
|
// REG-15: a published version's window can be ENDED, never rewritten. `validAfter` is fixed at
|
|
164
175
|
// publish; `validUntil` may be set (0 → a time) or moved earlier, not extended or cleared — a
|
|
@@ -208,4 +219,7 @@ contract SkillDefinitionRegistry {
|
|
|
208
219
|
page = new bytes32[](end - offset);
|
|
209
220
|
for (uint256 i = offset; i < end; i++) page[i - offset] = _allSkills[i];
|
|
210
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;
|
|
211
225
|
}
|