@agenticprimitives/agent-relationships 0.1.0-alpha.2
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/LICENSE +21 -0
- package/README.md +170 -0
- package/dist/abis.d.ts +543 -0
- package/dist/abis.d.ts.map +1 -0
- package/dist/abis.js +197 -0
- package/dist/abis.js.map +1 -0
- package/dist/calls.d.ts +77 -0
- package/dist/calls.d.ts.map +1 -0
- package/dist/calls.js +119 -0
- package/dist/calls.js.map +1 -0
- package/dist/client.d.ts +96 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +227 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +50 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +55 -0
- package/dist/constants.js.map +1 -0
- package/dist/edge-id.d.ts +15 -0
- package/dist/edge-id.d.ts.map +1 -0
- package/dist/edge-id.js +34 -0
- package/dist/edge-id.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +30 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/taxonomy.d.ts +35 -0
- package/dist/taxonomy.d.ts.map +1 -0
- package/dist/taxonomy.js +65 -0
- package/dist/taxonomy.js.map +1 -0
- package/dist/types.d.ts +96 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -0
- package/package.json +62 -0
- package/spec.md +13 -0
package/dist/abis.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// Relationships-contract ABIs — source of truth:
|
|
2
|
+
// packages/contracts/src/relationships/*.sol (spec 216 / RL Phase 3).
|
|
3
|
+
// Hand-typed against `forge inspect` output. Phase 3 lands the
|
|
4
|
+
// contracts on chain; SDK clients wire up reads/writes against these
|
|
5
|
+
// in Phase 4.
|
|
6
|
+
export const agentRelationshipAbi = [
|
|
7
|
+
// ─── Errors ─────────────────────────────────────────────────────
|
|
8
|
+
{ type: 'error', name: 'InvalidEdge', inputs: [] },
|
|
9
|
+
{ type: 'error', name: 'EdgeAlreadyExists', inputs: [] },
|
|
10
|
+
{ type: 'error', name: 'EdgeNotFound', inputs: [] },
|
|
11
|
+
{ type: 'error', name: 'RoleAlreadyExists', inputs: [] },
|
|
12
|
+
{ type: 'error', name: 'RoleNotFound', inputs: [] },
|
|
13
|
+
{ type: 'error', name: 'NotAuthorized', inputs: [] },
|
|
14
|
+
{ type: 'error', name: 'InvalidTransition', inputs: [] },
|
|
15
|
+
// ─── Events ─────────────────────────────────────────────────────
|
|
16
|
+
{
|
|
17
|
+
type: 'event', name: 'EdgeProposed',
|
|
18
|
+
inputs: [
|
|
19
|
+
{ name: 'edgeId', type: 'bytes32', indexed: true },
|
|
20
|
+
{ name: 'subject', type: 'address', indexed: true },
|
|
21
|
+
{ name: 'object_', type: 'address', indexed: true },
|
|
22
|
+
{ name: 'relationshipType', type: 'bytes32', indexed: false },
|
|
23
|
+
{ name: 'createdBy', type: 'address', indexed: false },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'event', name: 'EdgeConfirmed',
|
|
28
|
+
inputs: [{ name: 'edgeId', type: 'bytes32', indexed: true }, { name: 'confirmedBy', type: 'address', indexed: true }],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'event', name: 'EdgeActivated',
|
|
32
|
+
inputs: [{ name: 'edgeId', type: 'bytes32', indexed: true }, { name: 'activatedBy', type: 'address', indexed: true }],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'event', name: 'EdgeRevoked',
|
|
36
|
+
inputs: [{ name: 'edgeId', type: 'bytes32', indexed: true }, { name: 'revokedBy', type: 'address', indexed: true }],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'event', name: 'RoleAdded',
|
|
40
|
+
inputs: [
|
|
41
|
+
{ name: 'edgeId', type: 'bytes32', indexed: true },
|
|
42
|
+
{ name: 'role', type: 'bytes32', indexed: true },
|
|
43
|
+
{ name: 'updater', type: 'address', indexed: true },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'event', name: 'RoleRemoved',
|
|
48
|
+
inputs: [
|
|
49
|
+
{ name: 'edgeId', type: 'bytes32', indexed: true },
|
|
50
|
+
{ name: 'role', type: 'bytes32', indexed: true },
|
|
51
|
+
{ name: 'updater', type: 'address', indexed: true },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'event', name: 'EdgeMetadataUpdated',
|
|
56
|
+
inputs: [
|
|
57
|
+
{ name: 'edgeId', type: 'bytes32', indexed: true },
|
|
58
|
+
{ name: 'metadataURI', type: 'string', indexed: false },
|
|
59
|
+
{ name: 'metadataHash', type: 'bytes32', indexed: false },
|
|
60
|
+
{ name: 'updater', type: 'address', indexed: true },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
// ─── Edge-ID derivation ─────────────────────────────────────────
|
|
64
|
+
{
|
|
65
|
+
type: 'function', name: 'computeEdgeId', stateMutability: 'pure',
|
|
66
|
+
inputs: [
|
|
67
|
+
{ name: 'subject', type: 'address' },
|
|
68
|
+
{ name: 'object_', type: 'address' },
|
|
69
|
+
{ name: 'relationshipType', type: 'bytes32' },
|
|
70
|
+
], outputs: [{ type: 'bytes32' }],
|
|
71
|
+
},
|
|
72
|
+
// ─── Writes ─────────────────────────────────────────────────────
|
|
73
|
+
{
|
|
74
|
+
type: 'function', name: 'proposeEdge', stateMutability: 'nonpayable',
|
|
75
|
+
inputs: [
|
|
76
|
+
{ name: 'subject', type: 'address' },
|
|
77
|
+
{ name: 'object_', type: 'address' },
|
|
78
|
+
{ name: 'relationshipType', type: 'bytes32' },
|
|
79
|
+
{ name: 'initialRoles', type: 'bytes32[]' },
|
|
80
|
+
{ name: 'metadataURI', type: 'string' },
|
|
81
|
+
{ name: 'metadataHash', type: 'bytes32' },
|
|
82
|
+
],
|
|
83
|
+
outputs: [{ name: 'edgeId', type: 'bytes32' }],
|
|
84
|
+
},
|
|
85
|
+
{ type: 'function', name: 'confirmEdge', stateMutability: 'nonpayable',
|
|
86
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }], outputs: [] },
|
|
87
|
+
{ type: 'function', name: 'activateEdge', stateMutability: 'nonpayable',
|
|
88
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }], outputs: [] },
|
|
89
|
+
{ type: 'function', name: 'revokeEdge', stateMutability: 'nonpayable',
|
|
90
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }], outputs: [] },
|
|
91
|
+
{ type: 'function', name: 'addRole', stateMutability: 'nonpayable',
|
|
92
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }, { name: 'role', type: 'bytes32' }], outputs: [] },
|
|
93
|
+
{ type: 'function', name: 'removeRole', stateMutability: 'nonpayable',
|
|
94
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }, { name: 'role', type: 'bytes32' }], outputs: [] },
|
|
95
|
+
{
|
|
96
|
+
type: 'function', name: 'setMetadata', stateMutability: 'nonpayable',
|
|
97
|
+
inputs: [
|
|
98
|
+
{ name: 'edgeId', type: 'bytes32' },
|
|
99
|
+
{ name: 'metadataURI', type: 'string' },
|
|
100
|
+
{ name: 'metadataHash', type: 'bytes32' },
|
|
101
|
+
], outputs: [],
|
|
102
|
+
},
|
|
103
|
+
// ─── Reads ──────────────────────────────────────────────────────
|
|
104
|
+
{
|
|
105
|
+
type: 'function', name: 'getEdge', stateMutability: 'view',
|
|
106
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }],
|
|
107
|
+
outputs: [{
|
|
108
|
+
type: 'tuple',
|
|
109
|
+
components: [
|
|
110
|
+
{ name: 'edgeId', type: 'bytes32' },
|
|
111
|
+
{ name: 'subject', type: 'address' },
|
|
112
|
+
{ name: 'object_', type: 'address' },
|
|
113
|
+
{ name: 'relationshipType', type: 'bytes32' },
|
|
114
|
+
{ name: 'status', type: 'uint8' },
|
|
115
|
+
{ name: 'createdBy', type: 'address' },
|
|
116
|
+
{ name: 'createdAt', type: 'uint64' },
|
|
117
|
+
{ name: 'updatedAt', type: 'uint64' },
|
|
118
|
+
{ name: 'metadataURI', type: 'string' },
|
|
119
|
+
{ name: 'metadataHash', type: 'bytes32' },
|
|
120
|
+
],
|
|
121
|
+
}],
|
|
122
|
+
},
|
|
123
|
+
{ type: 'function', name: 'getRoles', stateMutability: 'view',
|
|
124
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }], outputs: [{ type: 'bytes32[]' }] },
|
|
125
|
+
{ type: 'function', name: 'hasRole', stateMutability: 'view',
|
|
126
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }, { name: 'role', type: 'bytes32' }], outputs: [{ type: 'bool' }] },
|
|
127
|
+
{ type: 'function', name: 'getEdgesBySubject', stateMutability: 'view',
|
|
128
|
+
inputs: [{ name: 'subject', type: 'address' }], outputs: [{ type: 'bytes32[]' }] },
|
|
129
|
+
{ type: 'function', name: 'getEdgesByObject', stateMutability: 'view',
|
|
130
|
+
inputs: [{ name: 'object_', type: 'address' }], outputs: [{ type: 'bytes32[]' }] },
|
|
131
|
+
{
|
|
132
|
+
type: 'function', name: 'getEdgeByTriple', stateMutability: 'view',
|
|
133
|
+
inputs: [
|
|
134
|
+
{ name: 'subject', type: 'address' },
|
|
135
|
+
{ name: 'object_', type: 'address' },
|
|
136
|
+
{ name: 'relationshipType', type: 'bytes32' },
|
|
137
|
+
], outputs: [{ type: 'bytes32' }],
|
|
138
|
+
},
|
|
139
|
+
{ type: 'function', name: 'edgeExists', stateMutability: 'view',
|
|
140
|
+
inputs: [{ name: 'edgeId', type: 'bytes32' }], outputs: [{ type: 'bool' }] },
|
|
141
|
+
];
|
|
142
|
+
export const relationshipTypeRegistryAbi = [
|
|
143
|
+
{ type: 'error', name: 'NotGovernor', inputs: [] },
|
|
144
|
+
{ type: 'error', name: 'TypeExists', inputs: [] },
|
|
145
|
+
{ type: 'error', name: 'TypeNotFound', inputs: [] },
|
|
146
|
+
{ type: 'error', name: 'ZeroGovernor', inputs: [] },
|
|
147
|
+
{
|
|
148
|
+
type: 'event', name: 'TypeRegistered',
|
|
149
|
+
inputs: [
|
|
150
|
+
{ name: 'relationshipType', type: 'bytes32', indexed: true },
|
|
151
|
+
{ name: 'label', type: 'string', indexed: false },
|
|
152
|
+
{ name: 'isHierarchical', type: 'bool', indexed: false },
|
|
153
|
+
{ name: 'isTransitive', type: 'bool', indexed: false },
|
|
154
|
+
{ name: 'isSymmetric', type: 'bool', indexed: false },
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
{ type: 'function', name: 'governor', stateMutability: 'view', inputs: [], outputs: [{ type: 'address' }] },
|
|
158
|
+
{
|
|
159
|
+
type: 'function', name: 'registerType', stateMutability: 'nonpayable',
|
|
160
|
+
inputs: [
|
|
161
|
+
{ name: 'relationshipType', type: 'bytes32' },
|
|
162
|
+
{ name: 'label', type: 'string' },
|
|
163
|
+
{ name: 'hierarchical', type: 'bool' },
|
|
164
|
+
{ name: 'transitive', type: 'bool' },
|
|
165
|
+
{ name: 'symmetric', type: 'bool' },
|
|
166
|
+
], outputs: [],
|
|
167
|
+
},
|
|
168
|
+
{ type: 'function', name: 'isRegistered', stateMutability: 'view',
|
|
169
|
+
inputs: [{ name: 'relationshipType', type: 'bytes32' }], outputs: [{ type: 'bool' }] },
|
|
170
|
+
{ type: 'function', name: 'isActive', stateMutability: 'view',
|
|
171
|
+
inputs: [{ name: 'relationshipType', type: 'bytes32' }], outputs: [{ type: 'bool' }] },
|
|
172
|
+
{ type: 'function', name: 'isHierarchical', stateMutability: 'view',
|
|
173
|
+
inputs: [{ name: 'relationshipType', type: 'bytes32' }], outputs: [{ type: 'bool' }] },
|
|
174
|
+
{ type: 'function', name: 'isTransitive', stateMutability: 'view',
|
|
175
|
+
inputs: [{ name: 'relationshipType', type: 'bytes32' }], outputs: [{ type: 'bool' }] },
|
|
176
|
+
{ type: 'function', name: 'isSymmetric', stateMutability: 'view',
|
|
177
|
+
inputs: [{ name: 'relationshipType', type: 'bytes32' }], outputs: [{ type: 'bool' }] },
|
|
178
|
+
{
|
|
179
|
+
type: 'function', name: 'getTypeSemantics', stateMutability: 'view',
|
|
180
|
+
inputs: [{ name: 'relationshipType', type: 'bytes32' }],
|
|
181
|
+
outputs: [{
|
|
182
|
+
type: 'tuple',
|
|
183
|
+
components: [
|
|
184
|
+
{ name: 'relationshipType', type: 'bytes32' },
|
|
185
|
+
{ name: 'label', type: 'string' },
|
|
186
|
+
{ name: 'isHierarchical', type: 'bool' },
|
|
187
|
+
{ name: 'isTransitive', type: 'bool' },
|
|
188
|
+
{ name: 'isSymmetric', type: 'bool' },
|
|
189
|
+
{ name: 'active', type: 'bool' },
|
|
190
|
+
{ name: 'registeredAt', type: 'uint256' },
|
|
191
|
+
],
|
|
192
|
+
}],
|
|
193
|
+
},
|
|
194
|
+
{ type: 'function', name: 'typeCount', stateMutability: 'view', inputs: [], outputs: [{ type: 'uint256' }] },
|
|
195
|
+
{ type: 'function', name: 'getAllTypeIds', stateMutability: 'view', inputs: [], outputs: [{ type: 'bytes32[]' }] },
|
|
196
|
+
];
|
|
197
|
+
//# sourceMappingURL=abis.js.map
|
package/dist/abis.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abis.js","sourceRoot":"","sources":["../src/abis.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,sEAAsE;AACtE,+DAA+D;AAC/D,qEAAqE;AACrE,cAAc;AAEd,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,mEAAmE;IACnE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE;IAClD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,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AE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE;IAC5G,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE;CAC1G,CAAC"}
|
package/dist/calls.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure encoded call builders for AgentRelationship writes
|
|
3
|
+
* (RL Phase 4).
|
|
4
|
+
*
|
|
5
|
+
* Subpath: `@agenticprimitives/agent-relationships/calls`.
|
|
6
|
+
*
|
|
7
|
+
* Each builder returns a `ContractCall` (`{ to, value, data }`) so
|
|
8
|
+
* callers can submit via any path — direct walletClient.sendTransaction
|
|
9
|
+
* (see AgentRelationshipsClient), AgentAccount.execute, CustodyPolicy
|
|
10
|
+
* ceremony, ERC-4337 UserOp, etc.
|
|
11
|
+
*
|
|
12
|
+
* The package boundary (spec 216 § 3) forbids importing custody /
|
|
13
|
+
* delegation / mcp-runtime here — these builders stay pure encode-only.
|
|
14
|
+
*/
|
|
15
|
+
import type { Address, Hex } from '@agenticprimitives/types';
|
|
16
|
+
import type { RelationshipType, Role } from './types';
|
|
17
|
+
/** Minimal call-shape: the standard `{ to, value, data }` triple. */
|
|
18
|
+
export interface ContractCall {
|
|
19
|
+
to: Address;
|
|
20
|
+
value: bigint;
|
|
21
|
+
data: Hex;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build a call to propose a new edge. The caller MUST be the subject
|
|
25
|
+
* (msg.sender == subject on chain).
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildProposeEdgeCall(args: {
|
|
28
|
+
relationships: Address;
|
|
29
|
+
subject: Address;
|
|
30
|
+
object: Address;
|
|
31
|
+
relationshipType: RelationshipType;
|
|
32
|
+
initialRoles?: Role[];
|
|
33
|
+
metadataURI?: string;
|
|
34
|
+
metadataHash?: Hex;
|
|
35
|
+
}): ContractCall;
|
|
36
|
+
/**
|
|
37
|
+
* Build a call to confirm a PROPOSED edge. The caller MUST be the
|
|
38
|
+
* object side.
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildConfirmEdgeCall(args: {
|
|
41
|
+
relationships: Address;
|
|
42
|
+
edgeId: Hex;
|
|
43
|
+
}): ContractCall;
|
|
44
|
+
/**
|
|
45
|
+
* Build a call to activate a CONFIRMED edge. Either party may activate.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildActivateEdgeCall(args: {
|
|
48
|
+
relationships: Address;
|
|
49
|
+
edgeId: Hex;
|
|
50
|
+
}): ContractCall;
|
|
51
|
+
/**
|
|
52
|
+
* Build a call to revoke an edge. Either party may revoke unilaterally.
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildRevokeEdgeCall(args: {
|
|
55
|
+
relationships: Address;
|
|
56
|
+
edgeId: Hex;
|
|
57
|
+
}): ContractCall;
|
|
58
|
+
/** Build a call to add a role to an existing edge. */
|
|
59
|
+
export declare function buildAddRoleCall(args: {
|
|
60
|
+
relationships: Address;
|
|
61
|
+
edgeId: Hex;
|
|
62
|
+
role: Role;
|
|
63
|
+
}): ContractCall;
|
|
64
|
+
/** Build a call to remove a role from an existing edge. */
|
|
65
|
+
export declare function buildRemoveRoleCall(args: {
|
|
66
|
+
relationships: Address;
|
|
67
|
+
edgeId: Hex;
|
|
68
|
+
role: Role;
|
|
69
|
+
}): ContractCall;
|
|
70
|
+
/** Build a call to set / update an edge's off-chain metadata anchor. */
|
|
71
|
+
export declare function buildSetMetadataCall(args: {
|
|
72
|
+
relationships: Address;
|
|
73
|
+
edgeId: Hex;
|
|
74
|
+
metadataURI: string;
|
|
75
|
+
metadataHash: Hex;
|
|
76
|
+
}): ContractCall;
|
|
77
|
+
//# sourceMappingURL=calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../src/calls.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BAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;CACZ,GAAG,YAAY,CAUf;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;CACnB,GAAG,YAAY,CAUf"}
|
package/dist/calls.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure encoded call builders for AgentRelationship writes
|
|
3
|
+
* (RL Phase 4).
|
|
4
|
+
*
|
|
5
|
+
* Subpath: `@agenticprimitives/agent-relationships/calls`.
|
|
6
|
+
*
|
|
7
|
+
* Each builder returns a `ContractCall` (`{ to, value, data }`) so
|
|
8
|
+
* callers can submit via any path — direct walletClient.sendTransaction
|
|
9
|
+
* (see AgentRelationshipsClient), AgentAccount.execute, CustodyPolicy
|
|
10
|
+
* ceremony, ERC-4337 UserOp, etc.
|
|
11
|
+
*
|
|
12
|
+
* The package boundary (spec 216 § 3) forbids importing custody /
|
|
13
|
+
* delegation / mcp-runtime here — these builders stay pure encode-only.
|
|
14
|
+
*/
|
|
15
|
+
import { encodeFunctionData } from 'viem';
|
|
16
|
+
import { agentRelationshipAbi } from './abis';
|
|
17
|
+
const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
18
|
+
/**
|
|
19
|
+
* Build a call to propose a new edge. The caller MUST be the subject
|
|
20
|
+
* (msg.sender == subject on chain).
|
|
21
|
+
*/
|
|
22
|
+
export function buildProposeEdgeCall(args) {
|
|
23
|
+
return {
|
|
24
|
+
to: args.relationships,
|
|
25
|
+
value: 0n,
|
|
26
|
+
data: encodeFunctionData({
|
|
27
|
+
abi: agentRelationshipAbi,
|
|
28
|
+
functionName: 'proposeEdge',
|
|
29
|
+
args: [
|
|
30
|
+
args.subject,
|
|
31
|
+
args.object,
|
|
32
|
+
args.relationshipType,
|
|
33
|
+
(args.initialRoles ?? []),
|
|
34
|
+
args.metadataURI ?? '',
|
|
35
|
+
args.metadataHash ?? ZERO_BYTES32,
|
|
36
|
+
],
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build a call to confirm a PROPOSED edge. The caller MUST be the
|
|
42
|
+
* object side.
|
|
43
|
+
*/
|
|
44
|
+
export function buildConfirmEdgeCall(args) {
|
|
45
|
+
return {
|
|
46
|
+
to: args.relationships,
|
|
47
|
+
value: 0n,
|
|
48
|
+
data: encodeFunctionData({
|
|
49
|
+
abi: agentRelationshipAbi,
|
|
50
|
+
functionName: 'confirmEdge',
|
|
51
|
+
args: [args.edgeId],
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build a call to activate a CONFIRMED edge. Either party may activate.
|
|
57
|
+
*/
|
|
58
|
+
export function buildActivateEdgeCall(args) {
|
|
59
|
+
return {
|
|
60
|
+
to: args.relationships,
|
|
61
|
+
value: 0n,
|
|
62
|
+
data: encodeFunctionData({
|
|
63
|
+
abi: agentRelationshipAbi,
|
|
64
|
+
functionName: 'activateEdge',
|
|
65
|
+
args: [args.edgeId],
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Build a call to revoke an edge. Either party may revoke unilaterally.
|
|
71
|
+
*/
|
|
72
|
+
export function buildRevokeEdgeCall(args) {
|
|
73
|
+
return {
|
|
74
|
+
to: args.relationships,
|
|
75
|
+
value: 0n,
|
|
76
|
+
data: encodeFunctionData({
|
|
77
|
+
abi: agentRelationshipAbi,
|
|
78
|
+
functionName: 'revokeEdge',
|
|
79
|
+
args: [args.edgeId],
|
|
80
|
+
}),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** Build a call to add a role to an existing edge. */
|
|
84
|
+
export function buildAddRoleCall(args) {
|
|
85
|
+
return {
|
|
86
|
+
to: args.relationships,
|
|
87
|
+
value: 0n,
|
|
88
|
+
data: encodeFunctionData({
|
|
89
|
+
abi: agentRelationshipAbi,
|
|
90
|
+
functionName: 'addRole',
|
|
91
|
+
args: [args.edgeId, args.role],
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Build a call to remove a role from an existing edge. */
|
|
96
|
+
export function buildRemoveRoleCall(args) {
|
|
97
|
+
return {
|
|
98
|
+
to: args.relationships,
|
|
99
|
+
value: 0n,
|
|
100
|
+
data: encodeFunctionData({
|
|
101
|
+
abi: agentRelationshipAbi,
|
|
102
|
+
functionName: 'removeRole',
|
|
103
|
+
args: [args.edgeId, args.role],
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Build a call to set / update an edge's off-chain metadata anchor. */
|
|
108
|
+
export function buildSetMetadataCall(args) {
|
|
109
|
+
return {
|
|
110
|
+
to: args.relationships,
|
|
111
|
+
value: 0n,
|
|
112
|
+
data: encodeFunctionData({
|
|
113
|
+
abi: agentRelationshipAbi,
|
|
114
|
+
functionName: 'setMetadata',
|
|
115
|
+
args: [args.edgeId, args.metadataURI, args.metadataHash],
|
|
116
|
+
}),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=calls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.js","sourceRoot":"","sources":["../src/calls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAU9C,MAAM,YAAY,GAAG,oEAA2E,CAAC;AAEjG;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,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C,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;AACJ,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,gBAAgB,CAAC,IAIhC;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,aAAa;QACtB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,oBAAoB;YACzB,YAAY,EAAE,SAAS;YACvB,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;SAC/B,CAAC;KACH,CAAC;AACJ,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,mBAAmB,CAAC,IAInC;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,aAAa;QACtB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,oBAAoB;YACzB,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;SAC/B,CAAC;KACH,CAAC;AACJ,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,oBAAoB,CAAC,IAKpC;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,aAAa;QACtB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,kBAAkB,CAAC;YACvB,GAAG,EAAE,oBAAoB;YACzB,YAAY,EAAE,aAAa;YAC3B,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC;SACzD,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { type Address, type Hex, type WalletClient } from 'viem';
|
|
2
|
+
import { computeEdgeId } from './edge-id';
|
|
3
|
+
import type { AgentRelationshipsClientOpts, ConfirmEdgeInput, Edge, ProposeEdgeInput, RelationshipType, RevokeEdgeInput, SetRolesInput } from './types';
|
|
4
|
+
import { EdgeStatus } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Optional per-call submission context. When provided, the write
|
|
7
|
+
* method submits the encoded call via `walletClient.sendTransaction`.
|
|
8
|
+
* Callers who want to compose into AgentAccount.execute / CustodyPolicy
|
|
9
|
+
* ceremonies / ERC-4337 UserOps should use the pure builders in
|
|
10
|
+
* `./calls` directly.
|
|
11
|
+
*/
|
|
12
|
+
export interface WriteContext {
|
|
13
|
+
walletClient: WalletClient;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Read + write client for the agent-relationships trust fabric.
|
|
17
|
+
*
|
|
18
|
+
* Phase 2 lands the read paths (`getEdge`, `listEdgesFor`,
|
|
19
|
+
* `getEdgesByObject`) against the live AgentRelationship contract.
|
|
20
|
+
* Writes still throw `R Phase 4` — proposeEdge / confirmEdge /
|
|
21
|
+
* revokeEdge need ERC-1271 auth through the actor's CustodyPolicy.
|
|
22
|
+
*
|
|
23
|
+
* Configuration: `opts.relationships` MUST be the deployed
|
|
24
|
+
* AgentRelationship contract address (recorded in
|
|
25
|
+
* packages/contracts/deployments-<network>.json).
|
|
26
|
+
*/
|
|
27
|
+
export interface AgentRelationshipsClientOptsLive extends AgentRelationshipsClientOpts {
|
|
28
|
+
relationships: Address;
|
|
29
|
+
}
|
|
30
|
+
export declare class AgentRelationshipsClient {
|
|
31
|
+
readonly opts: AgentRelationshipsClientOptsLive;
|
|
32
|
+
private readonly publicClient;
|
|
33
|
+
private readonly relationships;
|
|
34
|
+
constructor(opts: AgentRelationshipsClientOptsLive);
|
|
35
|
+
/** Fetch a single edge by ID. Returns `null` when no such edge. */
|
|
36
|
+
getEdge(edgeId: Hex): Promise<Edge | null>;
|
|
37
|
+
/**
|
|
38
|
+
* List edges where `subject` appears on the subject side. Optional
|
|
39
|
+
* client-side filter by `relationshipType` and/or `status`.
|
|
40
|
+
*
|
|
41
|
+
* Order is contract-insertion order. Each edge is fetched in
|
|
42
|
+
* parallel via getEdge.
|
|
43
|
+
*/
|
|
44
|
+
listEdgesFor(subject: Address, filter?: {
|
|
45
|
+
relationshipType?: RelationshipType;
|
|
46
|
+
status?: EdgeStatus;
|
|
47
|
+
}): Promise<Edge[]>;
|
|
48
|
+
/** Same as `listEdgesFor` but on the object side. */
|
|
49
|
+
listEdgesPointingAt(object: Address, filter?: {
|
|
50
|
+
relationshipType?: RelationshipType;
|
|
51
|
+
status?: EdgeStatus;
|
|
52
|
+
}): Promise<Edge[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Propose a new edge. The walletClient's account MUST equal
|
|
55
|
+
* `input.subject` — the contract enforces `msg.sender == subject`.
|
|
56
|
+
* Returns the propose tx hash. The edgeId can be computed
|
|
57
|
+
* off-chain via `computeEdgeId(subject, object, relationshipType)`
|
|
58
|
+
* (matches the on-chain `keccak256(abi.encodePacked(...))`
|
|
59
|
+
* derivation).
|
|
60
|
+
*
|
|
61
|
+
* For PSA-controlled proposals (subject is a Smart Agent gated by
|
|
62
|
+
* CustodyPolicy), use `buildProposeEdgeCall` directly and compose
|
|
63
|
+
* into your AgentAccount.execute / CustodyPolicy ceremony.
|
|
64
|
+
*/
|
|
65
|
+
proposeEdge(input: ProposeEdgeInput, ctx: WriteContext): Promise<Hex>;
|
|
66
|
+
/**
|
|
67
|
+
* Confirm a PROPOSED edge. The walletClient's account MUST equal
|
|
68
|
+
* the object side (msg.sender == object on chain).
|
|
69
|
+
*/
|
|
70
|
+
confirmEdge(input: ConfirmEdgeInput, ctx: WriteContext): Promise<Hex>;
|
|
71
|
+
/**
|
|
72
|
+
* Revoke an edge. Either party may revoke unilaterally (contract
|
|
73
|
+
* checks `msg.sender == subject || msg.sender == object`).
|
|
74
|
+
*/
|
|
75
|
+
revokeEdge(input: RevokeEdgeInput, ctx: WriteContext): Promise<Hex>;
|
|
76
|
+
/**
|
|
77
|
+
* Add / remove roles on an existing edge. Either party may modify
|
|
78
|
+
* the edge's role bag.
|
|
79
|
+
*
|
|
80
|
+
* Note: the on-chain `Edge` has a single role bag (no subject/object
|
|
81
|
+
* separation in storage); `SetRolesInput.subjectRoles` +
|
|
82
|
+
* `objectRoles` are coalesced into the same bag. The current set
|
|
83
|
+
* is computed via `getRoles(edgeId)` and the diff is submitted as
|
|
84
|
+
* N add / remove txs.
|
|
85
|
+
*/
|
|
86
|
+
setRoles(input: SetRolesInput, ctx: WriteContext): Promise<Hex[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Submit a single ContractCall via the bound walletClient. Uses
|
|
89
|
+
* explicit nonce fetch + retry on "replacement underpriced" to
|
|
90
|
+
* tolerate Base Sepolia's read-after-write lag.
|
|
91
|
+
*/
|
|
92
|
+
private _submit;
|
|
93
|
+
}
|
|
94
|
+
/** Re-export for callers that want to compute edge IDs off-chain. */
|
|
95
|
+
export { computeEdgeId };
|
|
96
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,OAAO,EAAE,KAAK,GAAG,EAAqB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAS9G,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EACV,4BAA4B,EAC5B,gBAAgB,EAChB,IAAI,EACJ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAKD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gCAAiC,SAAQ,4BAA4B;IACpF,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,qBAAa,wBAAwB;IAIvB,QAAQ,CAAC,IAAI,EAAE,gCAAgC;IAH3D,OAAO,CAAC,QAAQ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