@agenticprimitives/types 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agentic Trust Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @agenticprimitives/types
2
+
3
+ Cross-cutting branded types and chain primitives shared across `@agenticprimitives/*` packages. Types-only; no runtime code.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @agenticprimitives/types
9
+ ```
10
+
11
+ ## Exports
12
+
13
+ ```ts
14
+ import type { Address, Hex, ChainId, BrandedId } from '@agenticprimitives/types';
15
+
16
+ type SessionId = BrandedId<'SessionId'>;
17
+ const chain: ChainId = 1 as ChainId;
18
+ const account: Address = '0x...';
19
+ ```
20
+
21
+ ## Status
22
+
23
+ Pre-alpha. Minimal by design. Adding a type here requires ≥2 consuming packages.
@@ -0,0 +1,116 @@
1
+ export type Address = `0x${string}`;
2
+ export type Hex = `0x${string}`;
3
+ export type ChainId = number & {
4
+ readonly __chainId: unique symbol;
5
+ };
6
+ export type BrandedId<T extends string> = string & {
7
+ readonly __brand: T;
8
+ };
9
+ /**
10
+ * The canonical identity of every agent IS its ERC-4337 Smart Agent
11
+ * address ([ADR-0010](../../docs/architecture/decisions/0010-smart-agent-canonical-identifier.md)).
12
+ * This alias names that role: a value typed `CanonicalAgentIdentity` is
13
+ * THE identity — never a name, profile, EOA, or passkey (those are
14
+ * facets that point AT it and rotate without changing it; see ADR-0011).
15
+ * It is a plain `Address`, so it composes with every viem/`Address` API
16
+ * without a cast — the name is the contract, the brand is doctrinal.
17
+ */
18
+ export type CanonicalAgentIdentity = Address;
19
+ /**
20
+ * Branded CAIP-10 account identifier — `<namespace>:<reference>:<address>`
21
+ * (e.g. `eip155:8453:0x…`, `hedera:mainnet:0.0.x`). Constructed only via
22
+ * `buildCaip10Address` (runtime helper in `@agenticprimitives/agent-profile`)
23
+ * so callers can't bypass the namespace allowlist (ADR-0008).
24
+ */
25
+ export type Caip10Address = string & {
26
+ readonly __brand: 'caip10';
27
+ };
28
+ /**
29
+ * Semantic alias of {@link Caip10Address} for the SSO-subject / directory-key
30
+ * role ([ADR-0016](../../docs/architecture/decisions/0016-canonical-agent-id-is-the-sso-subject.md)).
31
+ * One brand, one builder. Cross-chain by construction. Distinct from
32
+ * {@link CanonicalAgentIdentity} — that is the within-chain EVM `Address`
33
+ * handle; THIS is the chain-qualified portable identifier.
34
+ */
35
+ export type CanonicalAgentId = Caip10Address;
36
+ /** The three CAIP-10 parts; input to `agent-profile`'s `buildCaip10Address`. */
37
+ export interface Caip10Parts {
38
+ namespace: string;
39
+ reference: string;
40
+ address: string;
41
+ }
42
+ /** Assurance ladder, ordered low→high. Threads into SSO step-up (ADR-0017). */
43
+ export type Assurance = 'unverified' | 'asserted' | 'onchain-read' | 'onchain-confirmed';
44
+ /** Credential facet kinds that can authenticate a session. */
45
+ export type CredentialKind = 'passkey' | 'siwe-eoa' | 'hardware' | 'oidc';
46
+ /** What a credential is trusted for. login-grade ≠ custody-grade (ADR-0017). */
47
+ export type CredentialRole = 'login-grade' | 'custody-grade';
48
+ /** The credential that authenticated a session — a facet key, NOT the identity. */
49
+ export interface CredentialPrincipal {
50
+ kind: CredentialKind;
51
+ /** credentialId / EOA address / "iss#sub" — a facet key, not the identity. */
52
+ id: string;
53
+ assurance: Assurance;
54
+ /** Optional: whether this credential is custody-grade (step-up) or login-grade. */
55
+ role?: CredentialRole;
56
+ }
57
+ /**
58
+ * The cross-origin SSO token a relying site receives from the Connect
59
+ * broker (spec 224 §3). `sub` is the canonical subject; there is NO
60
+ * `owner` field (ADR-0016). `BrokerSession` (the broker's own same-origin
61
+ * session) is a different, connect-internal shape.
62
+ */
63
+ export interface AgentSession {
64
+ /** Canonical subject (CAIP-10). NEVER a name, NEVER a bare Address. */
65
+ sub: CanonicalAgentId;
66
+ /** The credential that authenticated this session. */
67
+ principal: CredentialPrincipal;
68
+ /** Effective assurance of the session (≤ `principal.assurance`). */
69
+ assurance: Assurance;
70
+ /** Relying-site `client_id` this token is bound to (exact-match). */
71
+ aud: string;
72
+ /** The Connect origin that issued it. */
73
+ iss: string;
74
+ /** Issued-at (epoch seconds). */
75
+ iat: number;
76
+ /** Expiry (epoch seconds). Short-lived. */
77
+ exp: number;
78
+ /** Replay id. */
79
+ jti: string;
80
+ /**
81
+ * Optional per-subject derivation rotation (Google custody; spec 235 §5b). Bumping it derives a
82
+ * fresh per-subject custodian → a fresh agent ("a new home from the same Google account"). The
83
+ * broker mints it; the custody gate reads it to derive the matching key. Absent / 0 for every
84
+ * non-rotated session. NOT an authority field — purely a derivation input.
85
+ */
86
+ rotation?: number;
87
+ }
88
+ /**
89
+ * Discriminator for the KIND of Smart Agent a name points to.
90
+ *
91
+ * Three kinds only. `treasury` is NOT an agent kind — it is a kind of SERVICE
92
+ * (`agentKind: 'service'` + a profile `serviceType` / `ProfileType: 'treasury'`
93
+ * subtype; specs 217/225 §6). Do not re-add it here.
94
+ */
95
+ export type AgentType = 'person' | 'org' | 'service';
96
+ /**
97
+ * Optional naming context other packages accept as injected
98
+ * parameter. Apps that don't use naming pass nothing; apps that do
99
+ * resolve names via @agenticprimitives/agent-naming and populate
100
+ * this shape before invoking downstream packages.
101
+ *
102
+ * Invariants every consumer MUST respect:
103
+ * - `agentName` is a DISPLAY field. Policy decisions / signature
104
+ * bindings MUST be derivable from address; name can never be
105
+ * the sole authority.
106
+ * - Missing fields are not a security failure — name is optional.
107
+ * - Consumers MUST NOT treat name as a stable identifier across
108
+ * transfers. The address is the stable identifier.
109
+ */
110
+ export interface NameContext {
111
+ /** Resolved name of the subject (e.g. 'alice.agent'). */
112
+ agentName?: string;
113
+ /** Discriminator for branching: person vs org vs service (treasury ⊂ service — not branched here). */
114
+ agentType?: AgentType;
115
+ }
116
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,EAAE,CAAC;AACpC,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAChC,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AACrE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC;AAE3E;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAQ7C;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAA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GAaG;AACH,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sGAAsG;IACtG,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // @agenticprimitives/types — cross-cutting branded primitives. Types-only.
2
+ export {};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@agenticprimitives/types",
3
+ "version": "0.1.0-alpha.2",
4
+ "description": "Cross-cutting branded types and chain primitives shared across @agenticprimitives/* packages.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "LICENSE",
16
+ "dist",
17
+ "spec.md",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.build.json",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit",
23
+ "test": "echo 'no tests yet' && exit 0",
24
+ "clean": "rm -rf dist"
25
+ },
26
+ "keywords": [
27
+ "types",
28
+ "agentic"
29
+ ],
30
+ "license": "MIT",
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }
package/spec.md ADDED
@@ -0,0 +1,5 @@
1
+ # @agenticprimitives/types — spec
2
+
3
+ This package is intentionally minimal; its rationale lives in [`../../specs/101-v0-package-proposal.md`](../../specs/101-v0-package-proposal.md) §2 (Package 7) and [`../../specs/100-package-boundary-doctrine.md`](../../specs/100-package-boundary-doctrine.md) §S3.
4
+
5
+ Do not edit a divergent copy here — edit the canonical proposal.