@aporthq/aport-agent-guardrails 1.0.19 → 1.0.21

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.
Files changed (42) hide show
  1. package/README.md +16 -15
  2. package/bin/agent-guardrails +57 -17
  3. package/bin/aport-create-passport.sh +1 -1
  4. package/bin/aport-guardrail-api.sh +8 -35
  5. package/bin/aport-guardrail-bash.sh +18 -53
  6. package/bin/aport-resolve-paths.sh +2 -2
  7. package/bin/frameworks/generic.sh +59 -3
  8. package/bin/frameworks/next-steps.d/crewai-native.txt +21 -0
  9. package/bin/frameworks/next-steps.d/crewai.txt +7 -2
  10. package/bin/lib/error.sh +3 -3
  11. package/bin/lib/runtime-manifest.txt +17 -0
  12. package/bin/lib/runtime.sh +81 -0
  13. package/bin/lib/tool-mapping.sh +52 -0
  14. package/bin/lib/validation.sh +25 -15
  15. package/docs/FRAMEWORK_ROADMAP.md +1 -1
  16. package/docs/PROVIDER.md +90 -0
  17. package/docs/RELEASE.md +3 -3
  18. package/docs/development/ERROR_CODES.md +3 -3
  19. package/docs/frameworks/crewai.md +102 -68
  20. package/docs/frameworks/deerflow.md +1 -1
  21. package/docs/frameworks/openclaw.md +51 -22
  22. package/extensions/openclaw-aport/CHANGELOG.md +5 -1
  23. package/extensions/openclaw-aport/openclaw.plugin.json +1 -1
  24. package/extensions/openclaw-aport/package-lock.json +2 -2
  25. package/extensions/openclaw-aport/package.json +1 -1
  26. package/external/aport-spec/LICENSE +1 -1
  27. package/external/aport-spec/README.md +1 -0
  28. package/external/aport-spec/conformance/src/ed25519.ts +1 -1
  29. package/external/aport-spec/oap/CHANGELOG.md +1 -1
  30. package/external/aport-spec/oap/conformance.md +2 -2
  31. package/external/aport-spec/oap/oap-spec.md +2 -2
  32. package/external/aport-spec/oap/security.md +4 -4
  33. package/external/aport-spec/oap/vc/examples/oap-decision-vc.json +1 -1
  34. package/external/aport-spec/oap/vc/examples/oap-passport-vc.json +1 -1
  35. package/external/aport-spec/oap/vc/tools/examples/vc-to-decision.js +1 -1
  36. package/external/aport-spec/oap/vc/tools/examples/vc-to-passport.js +1 -1
  37. package/external/aport-spec/oap/vc/tools/src/index.ts +2 -2
  38. package/external/aport-spec/oap/vc/tools/test-simple.js +2 -2
  39. package/external/aport-spec/oap/vc/vc-mapping.md +4 -4
  40. package/external/aport-spec/oap/well-known-schema.json +85 -0
  41. package/external/aport-spec/well-known.md +203 -0
  42. package/package.json +3 -2
@@ -0,0 +1,203 @@
1
+ # OAP Service Discovery via `.well-known/oap/`
2
+
3
+ **Specification:** OAP v1.0
4
+ **Status:** Draft
5
+ **Last Updated:** 2026-03-26
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ The `.well-known/oap/` URI provides a standard discovery mechanism for the Open Agent Passport (OAP) authorization layer. Any HTTP server that supports OAP-based pre-action authorization MAY expose this endpoint to allow agent frameworks, orchestration platforms, and relying parties to automatically discover its OAP configuration without prior out-of-band setup.
12
+
13
+ This specification follows the conventions established by RFC 8615 (Well-Known URIs) and mirrors the discovery patterns used by:
14
+ - OAuth 2.0 Authorization Server Metadata ([RFC 8414](https://www.rfc-editor.org/rfc/rfc8414))
15
+ - OpenID Connect Discovery 1.0
16
+ - DIF Well-Known DID Configuration ([DIF](https://identity.foundation/.well-known/resources/did-configuration/))
17
+
18
+ ---
19
+
20
+ ## Discovery Request
21
+
22
+ A client wishing to discover OAP support for a domain sends:
23
+
24
+ ```http
25
+ GET /.well-known/oap/ HTTP/1.1
26
+ Host: example.com
27
+ Accept: application/json
28
+ ```
29
+
30
+ Servers MUST accept requests both with and without a trailing slash (`/.well-known/oap` and `/.well-known/oap/`). Servers MAY redirect one form to the other using HTTP 301, but MUST NOT return 404 for either form.
31
+
32
+ ---
33
+
34
+ ## Discovery Response
35
+
36
+ A server that supports OAP MUST respond with HTTP 200 and a JSON body conforming to the schema defined in [`well-known-schema.json`](./oap/well-known-schema.json).
37
+
38
+ ### Example Response
39
+
40
+ ```json
41
+ {
42
+ "oap_version": "1.0",
43
+ "authorization_endpoint": "https://api.example.com/api/verify/{agent_id}",
44
+ "passport_endpoint": "https://api.example.com/api/passports/{agent_id}",
45
+ "policy_endpoint": "https://api.example.com/api/policies/{policy_name}",
46
+ "decision_endpoint": "https://api.example.com/api/verify/decisions/get/{decision_id}",
47
+ "jwks_uri": "https://api.example.com/.well-known/oap/jwks.json",
48
+ "supported_capabilities": [
49
+ "finance.payment.refund",
50
+ "finance.payment.charge",
51
+ "data.export.create",
52
+ "messaging.message.send"
53
+ ],
54
+ "supported_assurance_levels": ["L0", "L1", "L2", "L3", "L4KYC", "L4FIN"],
55
+ "spec_uri": "https://github.com/aporthq/aport-spec/blob/main/oap/oap-spec.md",
56
+ "contact": "security@example.com"
57
+ }
58
+ ```
59
+
60
+ ### Response Field Reference
61
+
62
+ | Field | Type | Required | Description |
63
+ |-------|------|----------|-------------|
64
+ | `oap_version` | string | **REQUIRED** | OAP specification version implemented (e.g., `"1.0"`). |
65
+ | `authorization_endpoint` | URI template | **REQUIRED** | Passport verification endpoint. Accepts `GET` with an `{agent_id}` path parameter. Returns the passport with capabilities and assurance level. Equivalent to the OAP "evaluate" flow entry point. |
66
+ | `passport_endpoint` | URI template | **REQUIRED** | Endpoint for retrieving and managing OAP passports. |
67
+ | `policy_endpoint` | URI template | **REQUIRED** | Endpoint for retrieving policy packs by name. Accepts `{policy_name}` in dot-separated format (e.g., `finance.payment.refund.v1`). |
68
+ | `decision_endpoint` | URI template | RECOMMENDED | Endpoint for retrieving individual authorization decisions by `{decision_id}`. |
69
+ | `jwks_uri` | URI | RECOMMENDED | JWKS endpoint (RFC 7517) for verifying OAP decision and VC signatures. MUST point to `/.well-known/oap/jwks.json` on the same domain or a domain controlled by the same organization. |
70
+ | `supported_capabilities` | array of string | RECOMMENDED | Dot-separated capability identifiers this server can enforce (see [Capability Registry](./oap/capability-registry.md)). Format: `category.subcategory.action` (e.g., `finance.payment.refund`). |
71
+ | `supported_assurance_levels` | array of enum | RECOMMENDED | Assurance levels the issuer can credential and enforce. Valid values: `L0` (self-attested), `L1` (email verified), `L2` (GitHub verified), `L3` (domain verified), `L4KYC` (KYC/KYB verified), `L4FIN` (financial data verified). |
72
+ | `agent_manifest_endpoint` | URI | OPTIONAL | Public agent registry scoped to this domain. |
73
+ | `spec_uri` | URI | OPTIONAL | Link to the OAP specification document. |
74
+ | `contact` | string | OPTIONAL | Security or operations contact (email or URL). |
75
+
76
+ ### Field Naming Conventions
77
+
78
+ - Endpoint fields that accept path parameters use the `_endpoint` suffix and URI template syntax (`{param}`).
79
+ - The `jwks_uri` field follows the naming convention established by OpenID Connect Discovery (section 3) and OAuth 2.0 Authorization Server Metadata (RFC 8414, section 2).
80
+
81
+ ---
82
+
83
+ ## Sub-paths
84
+
85
+ Servers MAY serve additional resources under `.well-known/oap/`:
86
+
87
+ | Path | Content-Type | Purpose |
88
+ |------|-------------|---------|
89
+ | `/.well-known/oap/` | `application/json` | Discovery document (this spec) |
90
+ | `/.well-known/oap/jwks.json` | `application/json` | Domain-scoped JWKS (RFC 7517) for signature verification |
91
+ | `/.well-known/oap/agents/` | `application/json` | Domain-scoped agent manifest |
92
+
93
+ The `jwks_uri` field in the discovery document and the `/.well-known/oap/jwks.json` sub-path MUST resolve to the same key set. Servers SHOULD NOT serve keys at other paths to avoid ambiguity.
94
+
95
+ ---
96
+
97
+ ## Error Responses
98
+
99
+ If a server does not implement OAP, it SHOULD return HTTP 404.
100
+
101
+ Servers that wish to explicitly signal non-support MAY return HTTP 404 with:
102
+
103
+ ```json
104
+ {
105
+ "error": "oap_not_supported",
106
+ "error_description": "This server does not implement OAP authorization."
107
+ }
108
+ ```
109
+
110
+ Servers that are temporarily unavailable SHOULD return HTTP 503.
111
+
112
+ ---
113
+
114
+ ## Security Considerations
115
+
116
+ 1. **TLS required.** The `/.well-known/oap/` endpoint MUST be served over HTTPS. HTTP is not acceptable for production deployments — discovery over plaintext exposes the authorization endpoint to MITM substitution.
117
+
118
+ 2. **Validate the response.** Clients MUST validate that all URI values in the discovery document use HTTPS and belong to the expected domain or a trusted subdomain before using them.
119
+
120
+ 3. **No sensitive data in discovery.** The discovery document MUST NOT contain credentials, private keys, or tenant-specific sensitive data.
121
+
122
+ 4. **Cache with care.** Clients MAY cache discovery responses but SHOULD respect `Cache-Control` headers and re-fetch on authorization failures. Stale discovery responses can silently route traffic to outdated endpoints.
123
+
124
+ 5. **Endpoint ownership.** All endpoint URIs SHOULD be hosted on the same domain as `/.well-known/oap/` or on a domain explicitly controlled by the same organization. Clients SHOULD reject endpoints that point to unrelated domains.
125
+
126
+ ---
127
+
128
+ ## Use Cases
129
+
130
+ ### 1. Agent Framework Auto-Configuration
131
+
132
+ An agent framework (e.g., LangChain, CrewAI) integrating OAP enforcement discovers the authorization endpoint by resolving `/.well-known/oap/` on the target API's domain. No developer configuration required.
133
+
134
+ ```typescript
135
+ // Auto-discovery in an OAP-aware agent framework
136
+ const oap = await fetch(`https://${targetDomain}/.well-known/oap/`)
137
+ .then(r => r.json());
138
+
139
+ // Verify agent passport before action
140
+ const passport = await fetch(
141
+ oap.authorization_endpoint.replace('{agent_id}', agentId)
142
+ ).then(r => r.json());
143
+
144
+ if (passport.status === 'active') {
145
+ // Agent is verified — proceed with action
146
+ }
147
+ ```
148
+
149
+ ### 2. Relying Party Verification
150
+
151
+ A merchant or API gateway verifying an agent's OAP credential resolves the agent's issuer domain's `/.well-known/oap/` endpoint to obtain the JWKS for signature verification — the same pattern used in JWT issuer discovery.
152
+
153
+ ```typescript
154
+ // Fetch issuer's JWKS for signature verification
155
+ const oap = await fetch(`https://${issuerDomain}/.well-known/oap/`).then(r => r.json());
156
+ const jwks = await fetch(oap.jwks_uri).then(r => r.json());
157
+ const verified = verifyDecisionSignature(decision, jwks);
158
+ ```
159
+
160
+ ### 3. Multi-Agent Delegation
161
+
162
+ In a multi-agent pipeline, a sub-agent discovering the orchestrator's OAP endpoint to check delegation scope resolves `/.well-known/oap/` on the orchestrator's domain.
163
+
164
+ ---
165
+
166
+ ## IANA Considerations
167
+
168
+ A Well-Known URI registration for `oap` is planned per [RFC 8615 section 5](https://www.rfc-editor.org/rfc/rfc8615#section-5):
169
+
170
+ - **URI Suffix:** `oap`
171
+ - **Change Controller:** APort / LiftRails Inc.
172
+ - **Specification Document:** This document and [oap-spec.md](./oap/oap-spec.md)
173
+ - **Status:** Planned
174
+
175
+ Registration will be submitted once this specification reaches a stable draft.
176
+
177
+ ---
178
+
179
+ ## Conformance
180
+
181
+ An implementation is conformant with this specification if:
182
+
183
+ 1. It responds to `GET /.well-known/oap/` over HTTPS with HTTP 200.
184
+ 2. It accepts requests both with and without a trailing slash.
185
+ 3. The response `Content-Type` is `application/json`.
186
+ 4. The response body contains at minimum: `oap_version`, `authorization_endpoint`, `passport_endpoint`, `policy_endpoint`.
187
+ 5. All URI values in the response use HTTPS.
188
+ 6. Capability identifiers in `supported_capabilities` use dot-separated format matching the [Capability Registry](./oap/capability-registry.md).
189
+ 7. If `jwks_uri` is present, it resolves to a valid JWK Set (RFC 7517) containing Ed25519 public keys.
190
+
191
+ ---
192
+
193
+ ## Related Specifications
194
+
195
+ - [OAP Specification v1.0](./oap/oap-spec.md)
196
+ - [Passport Schema](./oap/passport-schema.json)
197
+ - [Decision Schema](./oap/decision-schema.json)
198
+ - [Capability Registry](./oap/capability-registry.md)
199
+ - [Security Model](./oap/security.md)
200
+ - RFC 7517 — JSON Web Key (JWK)
201
+ - RFC 8615 — Well-Known Uniform Resource Identifiers
202
+ - RFC 8414 — OAuth 2.0 Authorization Server Metadata
203
+ - OpenID Connect Discovery 1.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aporthq/aport-agent-guardrails",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Policy enforcement guardrails for OpenClaw-compatible agent frameworks",
5
5
  "workspaces": [
6
6
  "packages/*",
@@ -20,8 +20,9 @@
20
20
  "sync-submodules": "git submodule update --init --recursive",
21
21
  "sync-submodules:latest": "git submodule update --init --remote --recursive",
22
22
  "changeset": "changeset",
23
- "version": "changeset version && node scripts/sync-version.mjs",
23
+ "version": "CI=1 changeset version && node scripts/sync-version.mjs",
24
24
  "sync-version": "node scripts/sync-version.mjs",
25
+ "prepush:check": "bash scripts/pre-push-check.sh",
25
26
  "build": "npm run build:core && npm run build --workspaces --if-present",
26
27
  "build:core": "npm run build -w @aporthq/aport-agent-guardrails-core",
27
28
  "release:version": "npm run version",