@aep-foundation/agent 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # @aep-foundation/agent
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1](https://github.com/aep-foundation/aep-node/pull/1) [`3d4713e`](https://github.com/aep-foundation/aep-node/commit/3d4713e2a9cf85478a415192c7c0abc90c374073) Thanks [@nkavian](https://github.com/nkavian)! - Add the initial AEP Node SDK packages, framework adapters, and conformance helpers.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`3d4713e`](https://github.com/aep-foundation/aep-node/commit/3d4713e2a9cf85478a415192c7c0abc90c374073)]:
12
+ - @aep-foundation/core@0.1.0
13
+ - @aep-foundation/platform@0.1.0
14
+
15
+ ## 0.0.0
16
+
17
+ Initial development version.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AEP Foundation
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,104 @@
1
+ # @aep-foundation/agent
2
+
3
+ Agent-side workflows for AEP.
4
+
5
+ ## Responsibilities
6
+
7
+ - fetch and validate Service Inspect documents from Service URLs
8
+ - construct AEP command URLs from Inspect HTTP metadata
9
+ - execute Enroll, Status, Grant, and Revoke over the AEP HTTP binding
10
+ - create baseline AEP client assertions
11
+ - use one pluggable Agent identity provider for Service-scoped identity and signing
12
+ - store Agent identities and issued session credentials through user-provided stores
13
+ - choose among advertised grant types
14
+ - create protected-resource authentication headers
15
+
16
+ The Agent package owns AEP network behavior. Applications provide storage and
17
+ identity custody; they do not provide custom Inspect or command transports.
18
+ For production storage and tenancy guidance, see the repository
19
+ [Integration Guide](../../INTEGRATION.md).
20
+
21
+ ## High-Level API
22
+
23
+ ```ts
24
+ import {
25
+ createAepAgent,
26
+ createInMemorySessionCredentialStore,
27
+ createPlatformIdentityProvider
28
+ } from "@aep-foundation/agent";
29
+
30
+ const agent = createAepAgent({
31
+ credentialStore: createInMemorySessionCredentialStore(),
32
+ identityProvider: createPlatformIdentityProvider({
33
+ authorization: "Bearer platform-api-token",
34
+ platformUrl: "https://platform.example.com"
35
+ })
36
+ });
37
+
38
+ const session = agent.serviceSession({
39
+ serviceUrl: "https://api.example.com"
40
+ });
41
+
42
+ const inspect = await session.inspect();
43
+ const identity = await session.identity();
44
+
45
+ await session.enroll({
46
+ claims: {
47
+ "contact.email": "ops@example.com"
48
+ }
49
+ });
50
+
51
+ const status = await session.status();
52
+
53
+ const grant = await session.grant({
54
+ preferredGrantTypes: ["oauth-bearer", "api-key", "basic"],
55
+ requestedScopes: ["read"]
56
+ });
57
+
58
+ const headers = await session.authenticationHeaders();
59
+
60
+ await session.revoke({
61
+ credentialId: grant.body.credential_id
62
+ });
63
+ ```
64
+
65
+ `createAepAgent()` accepts exactly one `identityProvider`. Platform-hosted
66
+ `did:web` support is provided by `createPlatformIdentityProvider()`. Future
67
+ sovereign Agent support can implement the same `AgentIdentityProvider` interface
68
+ for local `did:key` or `did:jwk` custody without changing the Agent engine.
69
+
70
+ ## Storage Ports
71
+
72
+ The Agent engine can use application-provided stores:
73
+
74
+ - `AgentIdentityStore` persists the Service-scoped Agent identity.
75
+ - `AgentCredentialStore` persists issued session credentials.
76
+ - `AgentIdempotencyKeyProvider` creates command idempotency keys.
77
+ - `AgentInspectCache` caches validated Inspect documents.
78
+
79
+ In-memory implementations are provided for examples and tests.
80
+
81
+ Production applications should provide durable stores scoped to the current
82
+ principal. If one process hosts multiple Agent principals, create one Agent
83
+ instance per principal or include the principal in every store lookup key.
84
+
85
+ ## Low-Level Primitives
86
+
87
+ The package also exports low-level protocol primitives such as
88
+ `inspectService()`, `enrollService()`, `statusService()`, `grantService()`,
89
+ `revokeService()`, `discoverPlatform()`, `provisionPlatformIdentity()`, and
90
+ `createPlatformDelegatedSigner()`.
91
+
92
+ These functions still own their AEP HTTP behavior. They use the runtime
93
+ `fetch()` implementation, validate responses, and return typed AEP results.
94
+
95
+ `createJwtClientAssertionSigner()` is the built-in `jose` signer adapter for
96
+ PEM, JWK, `CryptoKey`, `KeyObject`, and raw key material supported by `jose`.
97
+
98
+ `credentialPresentationHeaders()` turns built-in credentials into HTTP headers
99
+ for OAuth Bearer, API-key, and HTTP Basic presentation.
100
+
101
+ `clientAssertionAuthenticationHeaders()` creates AEP JWT Authorization headers
102
+ for protected Service resources, and `protectedResourceAuthenticationHeaders()`
103
+ uses an issued built-in credential when one is available or falls back to AEP
104
+ JWT authentication.