@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.
@@ -0,0 +1,96 @@
1
+ import type { Address, Hex } from '@agenticprimitives/types';
2
+ /**
3
+ * Branded bytes32 — the keccak256 hash of a relationship-type name
4
+ * (e.g. `HAS_MEMBER`). Use the `RELATIONSHIP_TYPE` constants in
5
+ * `src/constants.ts` rather than constructing literals.
6
+ */
7
+ export type RelationshipType = Hex & {
8
+ readonly __brand: 'relationshipType';
9
+ };
10
+ /**
11
+ * Branded bytes32 — the keccak256 hash of a role name (e.g. `MEMBER`).
12
+ * Use the `ROLE` constants rather than constructing literals.
13
+ */
14
+ export type Role = Hex & {
15
+ readonly __brand: 'role';
16
+ };
17
+ /**
18
+ * Edge lifecycle. Spec § 4:
19
+ * PROPOSED → CONFIRMED → ACTIVE → REVOKED.
20
+ *
21
+ * - `PROPOSED` — one side has expressed intent. Has NO authority effect.
22
+ * - `CONFIRMED` — both sides have signed (or single-side for symmetric
23
+ * types). Authority effects in force.
24
+ * - `ACTIVE` — alias for CONFIRMED, set when contract-level activation
25
+ * conditions are met (e.g. timelock elapsed for governance edges).
26
+ * - `REVOKED` — terminated by either side. Authority effects removed.
27
+ *
28
+ * Numeric values match the on-chain enum (Phase 3 port).
29
+ */
30
+ export declare enum EdgeStatus {
31
+ /** Sentinel — never assigned to a real edge. Matches Solidity enum index 0. */
32
+ NONE = 0,
33
+ PROPOSED = 1,
34
+ CONFIRMED = 2,
35
+ ACTIVE = 3,
36
+ REVOKED = 4
37
+ }
38
+ /**
39
+ * The trust-fabric edge primitive. An edge is uniquely identified by
40
+ * `(subject, object, relationshipType)`; same triple → same `edgeId`.
41
+ * This invariant prevents duplicate edges and enables idempotent
42
+ * propose-edge writes.
43
+ */
44
+ export interface Edge {
45
+ /** Deterministic ID: `keccak256(subject || object || relationshipType)`. */
46
+ edgeId: Hex;
47
+ /** Subject Smart Agent (the "from" side). */
48
+ subject: Address;
49
+ /** Object Smart Agent (the "to" side). */
50
+ object: Address;
51
+ /** Hashed relationship type. */
52
+ relationshipType: RelationshipType;
53
+ /** Role bytes32 hashes attached to the subject side. */
54
+ subjectRoles: Role[];
55
+ /** Role bytes32 hashes attached to the object side. */
56
+ objectRoles: Role[];
57
+ /** Lifecycle status. */
58
+ status: EdgeStatus;
59
+ /** Optional metadata URI (off-chain JSON; same content-hash discipline as agent-profile). */
60
+ metadataUri?: string;
61
+ /** keccak256 of canonical metadata JSON (if `metadataUri` set). */
62
+ metadataHash?: Hex;
63
+ /** Unix-seconds timestamp the edge first entered PROPOSED. */
64
+ createdAt: number;
65
+ }
66
+ export interface ProposeEdgeInput {
67
+ subject: Address;
68
+ object: Address;
69
+ relationshipType: RelationshipType;
70
+ subjectRoles?: Role[];
71
+ objectRoles?: Role[];
72
+ metadataUri?: string;
73
+ metadataHash?: Hex;
74
+ }
75
+ export interface ConfirmEdgeInput {
76
+ edgeId: Hex;
77
+ /** Role set the confirming side attaches to its own side. */
78
+ selfRoles?: Role[];
79
+ }
80
+ export interface RevokeEdgeInput {
81
+ edgeId: Hex;
82
+ /** Optional revocation reason (off-chain — not enforced on-chain). */
83
+ reason?: string;
84
+ }
85
+ export interface SetRolesInput {
86
+ edgeId: Hex;
87
+ /** Set the subject-side role bag (the caller MUST be the subject). */
88
+ subjectRoles?: Role[];
89
+ /** Set the object-side role bag (the caller MUST be the object). */
90
+ objectRoles?: Role[];
91
+ }
92
+ export interface AgentRelationshipsClientOpts {
93
+ rpcUrl: string;
94
+ chainId: number;
95
+ }
96
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,GAAG;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I,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,GAAG,CAAC;IACZ,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,GAAG,CAAC;IACZ,sEAAsE;IACtE,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,oEAAoE;IACpE,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB"}
package/dist/types.js ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Edge lifecycle. Spec § 4:
3
+ * PROPOSED → CONFIRMED → ACTIVE → REVOKED.
4
+ *
5
+ * - `PROPOSED` — one side has expressed intent. Has NO authority effect.
6
+ * - `CONFIRMED` — both sides have signed (or single-side for symmetric
7
+ * types). Authority effects in force.
8
+ * - `ACTIVE` — alias for CONFIRMED, set when contract-level activation
9
+ * conditions are met (e.g. timelock elapsed for governance edges).
10
+ * - `REVOKED` — terminated by either side. Authority effects removed.
11
+ *
12
+ * Numeric values match the on-chain enum (Phase 3 port).
13
+ */
14
+ export var EdgeStatus;
15
+ (function (EdgeStatus) {
16
+ /** Sentinel — never assigned to a real edge. Matches Solidity enum index 0. */
17
+ EdgeStatus[EdgeStatus["NONE"] = 0] = "NONE";
18
+ EdgeStatus[EdgeStatus["PROPOSED"] = 1] = "PROPOSED";
19
+ EdgeStatus[EdgeStatus["CONFIRMED"] = 2] = "CONFIRMED";
20
+ EdgeStatus[EdgeStatus["ACTIVE"] = 3] = "ACTIVE";
21
+ EdgeStatus[EdgeStatus["REVOKED"] = 4] = "REVOKED";
22
+ })(EdgeStatus || (EdgeStatus = {}));
23
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAN,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,+EAA+E;IAC/E,2CAAQ,CAAA;IACR,mDAAY,CAAA;IACZ,qDAAa,CAAA;IACb,+CAAU,CAAA;IACV,iDAAW,CAAA;AACb,CAAC,EAPW,UAAU,KAAV,UAAU,QAOrB"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@agenticprimitives/agent-relationships",
3
+ "version": "0.1.0-alpha.2",
4
+ "description": "Agent relationships SDK: trust-fabric edge store (subject, object, relationshipType) with role taxonomy. Phase 1 ships edge-ID derivation + relationship-type constants + client skeleton; AgentRelationship.sol + RelationshipTypeRegistry.sol ports land in Phase 3. AgentAssertion + AgentRelationshipResolver deferred to v2.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
9
+ "directory": "packages/agent-relationships"
10
+ },
11
+ "homepage": "https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/agent-relationships",
12
+ "bugs": {
13
+ "url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./taxonomy": {
24
+ "types": "./dist/taxonomy.d.ts",
25
+ "import": "./dist/taxonomy.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "LICENSE",
30
+ "dist",
31
+ "spec.md",
32
+ "README.md"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsc -p tsconfig.build.json",
36
+ "typecheck": "tsc -p tsconfig.json --noEmit",
37
+ "test": "vitest run",
38
+ "test:watch": "vitest",
39
+ "clean": "rm -rf dist"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@agenticprimitives/agent-account": "workspace:*",
46
+ "@agenticprimitives/connect-auth": "workspace:*",
47
+ "@agenticprimitives/types": "workspace:*",
48
+ "viem": "^2.50.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/node": "^22.7.0",
52
+ "vitest": "^2.1.0"
53
+ },
54
+ "keywords": [
55
+ "agent",
56
+ "relationships",
57
+ "trust-fabric",
58
+ "edges",
59
+ "roles",
60
+ "agentic"
61
+ ]
62
+ }
package/spec.md ADDED
@@ -0,0 +1,13 @@
1
+ # @agenticprimitives/agent-relationships — spec
2
+
3
+ The full design lives in [`../../specs/216-agent-relationships.md`](../../specs/216-agent-relationships.md).
4
+
5
+ Architecture decisions:
6
+
7
+ - [ADR-0006](../../docs/architecture/decisions/0006-agent-naming-as-resolution-layer.md)
8
+ — why naming hierarchy is parent-pointer-based, NOT a
9
+ `NAMESPACE_CONTAINS` edge.
10
+ - [ADR-0007](../../docs/architecture/decisions/0007-agent-identity-stack-three-packages.md)
11
+ — why the identity stack is three packages, not one.
12
+
13
+ Do not edit a divergent copy here — edit the canonical spec.