@aporthq/aport-agent-guardrails 1.0.8

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 (237) hide show
  1. package/LICENSE +217 -0
  2. package/README.md +481 -0
  3. package/bin/agent-guardrails +133 -0
  4. package/bin/aport-create-passport.sh +444 -0
  5. package/bin/aport-cursor-hook.sh +90 -0
  6. package/bin/aport-guardrail-api.sh +108 -0
  7. package/bin/aport-guardrail-bash.sh +394 -0
  8. package/bin/aport-guardrail-v2.sh +5 -0
  9. package/bin/aport-guardrail.sh +5 -0
  10. package/bin/aport-resolve-paths.sh +71 -0
  11. package/bin/aport-status.sh +276 -0
  12. package/bin/frameworks/crewai.sh +49 -0
  13. package/bin/frameworks/cursor.sh +95 -0
  14. package/bin/frameworks/langchain.sh +48 -0
  15. package/bin/frameworks/n8n.sh +36 -0
  16. package/bin/frameworks/openclaw.sh +19 -0
  17. package/bin/lib/allowlist.sh +18 -0
  18. package/bin/lib/common.sh +28 -0
  19. package/bin/lib/config.sh +46 -0
  20. package/bin/lib/constants.sh +232 -0
  21. package/bin/lib/detect.sh +65 -0
  22. package/bin/lib/error.sh +269 -0
  23. package/bin/lib/passport.sh +19 -0
  24. package/bin/lib/templates/.gitkeep +1 -0
  25. package/bin/lib/templates/config.yaml +6 -0
  26. package/bin/lib/validation.sh +206 -0
  27. package/bin/openclaw +660 -0
  28. package/docs/ADDING_A_FRAMEWORK.md +87 -0
  29. package/docs/AGENTS.md.example +40 -0
  30. package/docs/CODE_REVIEW.md +192 -0
  31. package/docs/DEPLOYMENT_READINESS.md +81 -0
  32. package/docs/FAQ_SECURITY_SCANNERS.md +373 -0
  33. package/docs/FRAMEWORK_ROADMAP.md +41 -0
  34. package/docs/HOSTED_PASSPORT_SETUP.md +362 -0
  35. package/docs/IMPLEMENTING_YOUR_OWN_EVALUATOR.md +433 -0
  36. package/docs/OPENCLAW_COMPATIBILITY.md +73 -0
  37. package/docs/OPENCLAW_LOCAL_INTEGRATION.md +596 -0
  38. package/docs/OPENCLAW_TOOLS_AND_POLICIES.md +54 -0
  39. package/docs/QUICKSTART.md +470 -0
  40. package/docs/QUICKSTART_OPENCLAW_PLUGIN.md +470 -0
  41. package/docs/README.md +28 -0
  42. package/docs/RELEASE.md +87 -0
  43. package/docs/REPO_LAYOUT.md +47 -0
  44. package/docs/SKILLS_ECOSYSTEM_ANALYSIS_FEB17.md +1260 -0
  45. package/docs/TOOL_POLICY_MAPPING.md +46 -0
  46. package/docs/UPGRADE.md +46 -0
  47. package/docs/VERIFICATION_METHODS.md +97 -0
  48. package/docs/assets/README.md +8 -0
  49. package/docs/assets/porter.svg +54 -0
  50. package/docs/development/ERROR_CODES.md +616 -0
  51. package/docs/frameworks/GITHUB_ISSUE_PROPOSALS.md +1105 -0
  52. package/docs/frameworks/crewai.md +114 -0
  53. package/docs/frameworks/cursor.md +159 -0
  54. package/docs/frameworks/langchain.md +72 -0
  55. package/docs/frameworks/n8n.md +40 -0
  56. package/docs/frameworks/openclaw.md +40 -0
  57. package/docs/launch/ADD_APORT_AWESOME_LISTS_INSTRUCTIONS.md +146 -0
  58. package/docs/launch/ANNOUNCEMENT_GUIDE.md +266 -0
  59. package/docs/launch/AWESOME_REPOS.md +53 -0
  60. package/docs/launch/CURSOR_VSCODE_HOOKS_RESEARCH.md +77 -0
  61. package/docs/launch/DEMO_TERMINAL_OUTPUT.txt +48 -0
  62. package/docs/launch/DRY_AND_PLAN_CHECKLIST.md +47 -0
  63. package/docs/launch/EVIDENCE_README.md +61 -0
  64. package/docs/launch/EVIDENCE_TERMINAL_CAPTURE.txt +10 -0
  65. package/docs/launch/FRAMEWORK_SUPPORT_PLAN.md +1640 -0
  66. package/docs/launch/LAUNCH_READINESS_CHECKLIST.md +237 -0
  67. package/docs/launch/LAUNCH_STRATEGY_SUMMARY.md +464 -0
  68. package/docs/launch/OPENCLAW_FEEDBACK_AND_FIXES.md +85 -0
  69. package/docs/launch/POST_1_VALENTINE_IMPROVED.md +233 -0
  70. package/docs/launch/POST_2_GUARDRAIL_IMPROVED.md +369 -0
  71. package/docs/launch/PRE_LAUNCH_FIXES.md +766 -0
  72. package/docs/launch/QUICK_LAUNCH_CHECKLIST.md +400 -0
  73. package/docs/launch/READINESS_SUMMARY.md +262 -0
  74. package/docs/launch/README.md +68 -0
  75. package/docs/launch/USER_STORIES.md +327 -0
  76. package/docs/launch/scripts/add-aport-awesome-pr.sh +69 -0
  77. package/docs/operations/MONITORING.md +588 -0
  78. package/docs/reviews/2026-02-18-staff-review.md +268 -0
  79. package/extensions/openclaw-aport/README.md +415 -0
  80. package/extensions/openclaw-aport/index.js +625 -0
  81. package/extensions/openclaw-aport/openclaw-aport.js +7 -0
  82. package/extensions/openclaw-aport/openclaw.plugin.json +46 -0
  83. package/extensions/openclaw-aport/package.json +36 -0
  84. package/extensions/openclaw-aport/test.js +307 -0
  85. package/external/aport-policies/README.md +363 -0
  86. package/external/aport-policies/agent.session.create.v1/README.md +345 -0
  87. package/external/aport-policies/agent.session.create.v1/policy.json +162 -0
  88. package/external/aport-policies/agent.tool.register.v1/README.md +361 -0
  89. package/external/aport-policies/agent.tool.register.v1/policy.json +172 -0
  90. package/external/aport-policies/code.release.publish.v1/README.md +51 -0
  91. package/external/aport-policies/code.release.publish.v1/policy.json +121 -0
  92. package/external/aport-policies/code.repository.merge.v1/README.md +287 -0
  93. package/external/aport-policies/code.repository.merge.v1/express.example.js +332 -0
  94. package/external/aport-policies/code.repository.merge.v1/fastapi.example.py +370 -0
  95. package/external/aport-policies/code.repository.merge.v1/policy.json +162 -0
  96. package/external/aport-policies/data.export.create.v1/README.md +226 -0
  97. package/external/aport-policies/data.export.create.v1/express.example.js +172 -0
  98. package/external/aport-policies/data.export.create.v1/fastapi.example.py +165 -0
  99. package/external/aport-policies/data.export.create.v1/policy.json +133 -0
  100. package/external/aport-policies/data.report.ingest.v1/README.md +134 -0
  101. package/external/aport-policies/data.report.ingest.v1/express.example.js +105 -0
  102. package/external/aport-policies/data.report.ingest.v1/minimal-example.js +68 -0
  103. package/external/aport-policies/data.report.ingest.v1/policy.json +174 -0
  104. package/external/aport-policies/finance.crypto.trade.v1/README.md +146 -0
  105. package/external/aport-policies/finance.crypto.trade.v1/express.example.js +109 -0
  106. package/external/aport-policies/finance.crypto.trade.v1/minimal-example.js +65 -0
  107. package/external/aport-policies/finance.crypto.trade.v1/policy.json +176 -0
  108. package/external/aport-policies/finance.payment.charge.v1/README.md +326 -0
  109. package/external/aport-policies/finance.payment.charge.v1/express.example.js +250 -0
  110. package/external/aport-policies/finance.payment.charge.v1/fastapi.example.py +227 -0
  111. package/external/aport-policies/finance.payment.charge.v1/minimal-example.js +64 -0
  112. package/external/aport-policies/finance.payment.charge.v1/policy.json +224 -0
  113. package/external/aport-policies/finance.payment.charge.v1/tests/contexts.jsonl +12 -0
  114. package/external/aport-policies/finance.payment.charge.v1/tests/expected.jsonl +12 -0
  115. package/external/aport-policies/finance.payment.charge.v1/tests/passport.instance.json +42 -0
  116. package/external/aport-policies/finance.payment.charge.v1/tests/passport.template.json +40 -0
  117. package/external/aport-policies/finance.payment.charge.v1/tests/payments-charge-policy.test.js +817 -0
  118. package/external/aport-policies/finance.payment.charge.v1/tests/test_payments_charge_policy.py +486 -0
  119. package/external/aport-policies/finance.payment.payout.v1/README.md +78 -0
  120. package/external/aport-policies/finance.payment.payout.v1/policy.json +181 -0
  121. package/external/aport-policies/finance.payment.refund.v1/README.md +275 -0
  122. package/external/aport-policies/finance.payment.refund.v1/express.example.js +167 -0
  123. package/external/aport-policies/finance.payment.refund.v1/fastapi.example.py +136 -0
  124. package/external/aport-policies/finance.payment.refund.v1/minimal-example.js +183 -0
  125. package/external/aport-policies/finance.payment.refund.v1/policy.json +216 -0
  126. package/external/aport-policies/finance.payment.refund.v1/tests/refunds-policy.test.js +924 -0
  127. package/external/aport-policies/finance.payment.refund.v1/tests/test_refunds_policy.py +778 -0
  128. package/external/aport-policies/finance.transaction.execute.v1/README.md +309 -0
  129. package/external/aport-policies/finance.transaction.execute.v1/express.example.js +261 -0
  130. package/external/aport-policies/finance.transaction.execute.v1/fastapi.example.py +231 -0
  131. package/external/aport-policies/finance.transaction.execute.v1/minimal-example.js +78 -0
  132. package/external/aport-policies/finance.transaction.execute.v1/policy.json +189 -0
  133. package/external/aport-policies/finance.transaction.execute.v1/tests/contexts.jsonl +12 -0
  134. package/external/aport-policies/finance.transaction.execute.v1/tests/expected.jsonl +12 -0
  135. package/external/aport-policies/finance.transaction.execute.v1/tests/passport.instance.json +42 -0
  136. package/external/aport-policies/finance.transaction.execute.v1/tests/passport.template.json +42 -0
  137. package/external/aport-policies/finance.transaction.execute.v1/tests/test_transactions_policy.py +214 -0
  138. package/external/aport-policies/finance.transaction.execute.v1/tests/transactions-policy.test.js +306 -0
  139. package/external/aport-policies/governance.data.access.v1/README.md +292 -0
  140. package/external/aport-policies/governance.data.access.v1/express.example.js +321 -0
  141. package/external/aport-policies/governance.data.access.v1/fastapi.example.py +279 -0
  142. package/external/aport-policies/governance.data.access.v1/minimal-example.js +65 -0
  143. package/external/aport-policies/governance.data.access.v1/policy.json +208 -0
  144. package/external/aport-policies/governance.data.access.v1/tests/contexts.jsonl +12 -0
  145. package/external/aport-policies/governance.data.access.v1/tests/data-access-policy.test.js +308 -0
  146. package/external/aport-policies/governance.data.access.v1/tests/expected.jsonl +12 -0
  147. package/external/aport-policies/governance.data.access.v1/tests/passport.instance.json +56 -0
  148. package/external/aport-policies/governance.data.access.v1/tests/passport.template.json +56 -0
  149. package/external/aport-policies/governance.data.access.v1/tests/test_data_access_policy.py +214 -0
  150. package/external/aport-policies/legal.contract.review.v1/README.md +109 -0
  151. package/external/aport-policies/legal.contract.review.v1/policy.json +378 -0
  152. package/external/aport-policies/legal.contract.review.v1/tests/legal-contract-review-policy.test.js +609 -0
  153. package/external/aport-policies/legal.contract.review.v1/tests/passport.template.json +49 -0
  154. package/external/aport-policies/mcp.tool.execute.v1/README.md +301 -0
  155. package/external/aport-policies/mcp.tool.execute.v1/policy.json +141 -0
  156. package/external/aport-policies/messaging.message.send.v1/README.md +230 -0
  157. package/external/aport-policies/messaging.message.send.v1/express.example.js +183 -0
  158. package/external/aport-policies/messaging.message.send.v1/fastapi.example.py +193 -0
  159. package/external/aport-policies/messaging.message.send.v1/policy.json +144 -0
  160. package/external/aport-policies/policy-template.json +107 -0
  161. package/external/aport-policies/system.command.execute.v1/README.md +275 -0
  162. package/external/aport-policies/system.command.execute.v1/policy.json +146 -0
  163. package/external/aport-spec/CONTRIBUTING.md +273 -0
  164. package/external/aport-spec/LICENSE +21 -0
  165. package/external/aport-spec/README.md +168 -0
  166. package/external/aport-spec/conformance/README.md +294 -0
  167. package/external/aport-spec/conformance/cases/data.export.v1/contexts/allow_users.json +6 -0
  168. package/external/aport-spec/conformance/cases/data.export.v1/contexts/deny_pii.json +6 -0
  169. package/external/aport-spec/conformance/cases/data.export.v1/expected/allow_users.decision.json +19 -0
  170. package/external/aport-spec/conformance/cases/data.export.v1/expected/deny_pii.decision.json +19 -0
  171. package/external/aport-spec/conformance/cases/data.export.v1/passports/template.json +29 -0
  172. package/external/aport-spec/conformance/cases/payments.refunds.v1/contexts/allow_50usd.json +9 -0
  173. package/external/aport-spec/conformance/cases/payments.refunds.v1/contexts/deny_150usd.json +9 -0
  174. package/external/aport-spec/conformance/cases/payments.refunds.v1/contexts/deny_currency.json +9 -0
  175. package/external/aport-spec/conformance/cases/payments.refunds.v1/expected/allow_50usd.decision.json +19 -0
  176. package/external/aport-spec/conformance/cases/payments.refunds.v1/expected/deny_150usd.decision.json +19 -0
  177. package/external/aport-spec/conformance/cases/payments.refunds.v1/expected/deny_currency.decision.json +19 -0
  178. package/external/aport-spec/conformance/cases/payments.refunds.v1/passports/template.json +42 -0
  179. package/external/aport-spec/conformance/package.json +44 -0
  180. package/external/aport-spec/conformance/pnpm-lock.yaml +642 -0
  181. package/external/aport-spec/conformance/src/cases.ts +371 -0
  182. package/external/aport-spec/conformance/src/ed25519.ts +167 -0
  183. package/external/aport-spec/conformance/src/jcs.ts +85 -0
  184. package/external/aport-spec/conformance/src/runner.ts +533 -0
  185. package/external/aport-spec/conformance/src/validators.ts +185 -0
  186. package/external/aport-spec/conformance/test-runner.js +315 -0
  187. package/external/aport-spec/conformance/tsconfig.json +21 -0
  188. package/external/aport-spec/error-schema.json +192 -0
  189. package/external/aport-spec/index.json +12 -0
  190. package/external/aport-spec/integrations/clawmoat/README.md +12 -0
  191. package/external/aport-spec/integrations/shield/README.md +245 -0
  192. package/external/aport-spec/integrations/shield/adapters/index.js +116 -0
  193. package/external/aport-spec/integrations/shield/adapters/system-command-execute.js +133 -0
  194. package/external/aport-spec/integrations/shield/test/README.md +58 -0
  195. package/external/aport-spec/integrations/shield/test/shield.md +40 -0
  196. package/external/aport-spec/integrations/shield/test/test-shield-to-verify.js +274 -0
  197. package/external/aport-spec/metrics-schema.json +504 -0
  198. package/external/aport-spec/oap/CHANGELOG.md +54 -0
  199. package/external/aport-spec/oap/VERSION.md +40 -0
  200. package/external/aport-spec/oap/capability-registry.md +229 -0
  201. package/external/aport-spec/oap/conformance.md +257 -0
  202. package/external/aport-spec/oap/decision-schema.json +114 -0
  203. package/external/aport-spec/oap/examples/context.refund.usd.50.json +9 -0
  204. package/external/aport-spec/oap/examples/decision.allow.sample.json +20 -0
  205. package/external/aport-spec/oap/examples/decision.deny.sample.json +23 -0
  206. package/external/aport-spec/oap/examples/passport.instance.v1.json +50 -0
  207. package/external/aport-spec/oap/examples/passport.template.v1.json +71 -0
  208. package/external/aport-spec/oap/oap-spec.md +426 -0
  209. package/external/aport-spec/oap/passport-schema.json +396 -0
  210. package/external/aport-spec/oap/security.md +213 -0
  211. package/external/aport-spec/oap/vc/context-oap-v1.jsonld +137 -0
  212. package/external/aport-spec/oap/vc/examples/oap-decision-vc.json +37 -0
  213. package/external/aport-spec/oap/vc/examples/oap-passport-vc.json +68 -0
  214. package/external/aport-spec/oap/vc/tools/INTEGRATION.md +375 -0
  215. package/external/aport-spec/oap/vc/tools/README.md +278 -0
  216. package/external/aport-spec/oap/vc/tools/examples/decision-to-vc.js +66 -0
  217. package/external/aport-spec/oap/vc/tools/examples/passport-to-vc.js +83 -0
  218. package/external/aport-spec/oap/vc/tools/examples/vc-to-decision.js +77 -0
  219. package/external/aport-spec/oap/vc/tools/examples/vc-to-passport.js +94 -0
  220. package/external/aport-spec/oap/vc/tools/package.json +38 -0
  221. package/external/aport-spec/oap/vc/tools/pnpm-lock.yaml +472 -0
  222. package/external/aport-spec/oap/vc/tools/src/cli.ts +226 -0
  223. package/external/aport-spec/oap/vc/tools/src/crypto-utils.ts +427 -0
  224. package/external/aport-spec/oap/vc/tools/src/index.ts +653 -0
  225. package/external/aport-spec/oap/vc/tools/src/test.ts +148 -0
  226. package/external/aport-spec/oap/vc/tools/src/vp.ts +382 -0
  227. package/external/aport-spec/oap/vc/tools/test-simple.js +214 -0
  228. package/external/aport-spec/oap/vc/tools/tsconfig.json +19 -0
  229. package/external/aport-spec/oap/vc/vc-mapping.md +443 -0
  230. package/external/aport-spec/passport-schema.json +586 -0
  231. package/external/aport-spec/rate-limiting.md +136 -0
  232. package/external/aport-spec/transport-profile.md +325 -0
  233. package/external/aport-spec/webhook-spec.md +314 -0
  234. package/package.json +70 -0
  235. package/skills/aport-agent-guardrail/SKILL.md +314 -0
  236. package/src/evaluator.js +252 -0
  237. package/src/server/index.js +72 -0
@@ -0,0 +1,50 @@
1
+ {
2
+ "passport_id": "550e8400-e29b-41d4-a716-446655440001",
3
+ "kind": "instance",
4
+ "spec_version": "oap/1.0",
5
+ "parent_agent_id": "550e8400-e29b-41d4-a716-446655440000",
6
+ "owner_id": "org_87654321",
7
+ "owner_type": "org",
8
+ "assurance_level": "L3",
9
+ "status": "active",
10
+ "capabilities": [
11
+ {
12
+ "id": "finance.payment.refund",
13
+ "params": {
14
+ "max_amount": 1000,
15
+ "currency": "USD"
16
+ }
17
+ },
18
+ {
19
+ "id": "data.export"
20
+ }
21
+ ],
22
+ "limits": {
23
+ "finance.payment.refund": {
24
+ "currency_limits": {
25
+ "USD": {
26
+ "max_per_tx": 1000,
27
+ "daily_cap": 10000
28
+ }
29
+ },
30
+ "reason_codes": ["customer_request", "defective_product"],
31
+ "idempotency_required": true
32
+ },
33
+ "data.export": {
34
+ "max_rows": 50000,
35
+ "allow_pii": false,
36
+ "allowed_collections": ["orders", "products"]
37
+ }
38
+ },
39
+ "regions": ["US"],
40
+ "metadata": {
41
+ "tenant_id": "tenant_abc123",
42
+ "deployment_id": "deploy_xyz789",
43
+ "environment": "production",
44
+ "contact": "ops@tenant.com",
45
+ "webhook_url": "https://tenant.com/webhooks/oap"
46
+ },
47
+ "created_at": "2024-01-10T08:00:00Z",
48
+ "updated_at": "2024-01-15T14:20:00Z",
49
+ "version": "1.0.3"
50
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "passport_id": "550e8400-e29b-41d4-a716-446655440000",
3
+ "kind": "template",
4
+ "spec_version": "oap/1.0",
5
+ "owner_id": "org_12345678",
6
+ "owner_type": "org",
7
+ "assurance_level": "L2",
8
+ "status": "active",
9
+ "capabilities": [
10
+ {
11
+ "id": "finance.payment.refund",
12
+ "params": {
13
+ "max_amount": 5000,
14
+ "currency": "USD"
15
+ }
16
+ },
17
+ {
18
+ "id": "data.export"
19
+ },
20
+ {
21
+ "id": "repo.release.publish"
22
+ }
23
+ ],
24
+ "limits": {
25
+ "finance.payment.refund": {
26
+ "currency_limits": {
27
+ "USD": {
28
+ "max_per_tx": 5000,
29
+ "daily_cap": 50000
30
+ },
31
+ "EUR": {
32
+ "max_per_tx": 4500,
33
+ "daily_cap": 45000
34
+ },
35
+ "CAD": {
36
+ "max_per_tx": 6500,
37
+ "daily_cap": 65000
38
+ }
39
+ },
40
+ "reason_codes": [
41
+ "customer_request",
42
+ "defective_product",
43
+ "fraud",
44
+ "duplicate_charge"
45
+ ],
46
+ "idempotency_required": true
47
+ },
48
+ "data.export": {
49
+ "max_rows": 100000,
50
+ "allow_pii": false,
51
+ "allowed_collections": ["users", "orders", "products", "analytics"]
52
+ },
53
+ "repo.release.publish": {
54
+ "allowed_branches": ["main", "develop", "release/*"],
55
+ "max_releases_per_day": 10,
56
+ "require_signed_artifacts": true
57
+ }
58
+ },
59
+ "regions": ["US", "CA", "EU"],
60
+ "metadata": {
61
+ "name": "Customer Support AI",
62
+ "description": "AI agent for customer support operations",
63
+ "version": "1.0.0",
64
+ "contact": "support@example.com",
65
+ "homepage": "https://example.com/ai/support",
66
+ "repository": "https://github.com/example/support-ai"
67
+ },
68
+ "created_at": "2024-01-01T00:00:00Z",
69
+ "updated_at": "2024-01-15T10:30:00Z",
70
+ "version": "1.0.0"
71
+ }
@@ -0,0 +1,426 @@
1
+ # Open Agent Passport (OAP) v1.0 Specification
2
+
3
+ ## Abstract
4
+
5
+ The Open Agent Passport (OAP) specification defines a standardized format for AI agent identity, capabilities, and policy enforcement. This specification enables secure, verifiable, and interoperable agent authentication and authorization across platforms and organizations.
6
+
7
+ ## Status
8
+
9
+ This document is a working draft of the Open Agent Passport specification v1.0.
10
+
11
+ ## Table of Contents
12
+
13
+ 1. [Introduction](#introduction)
14
+ 2. [Core Objects](#core-objects)
15
+ 3. [Assurance Levels](#assurance-levels)
16
+ 4. [Decision Objects](#decision-objects)
17
+ 5. [Caching & TTL](#caching--ttl)
18
+ 6. [Canonicalization & Signing](#canonicalization--signing)
19
+ 7. [Errors](#errors)
20
+ 8. [Versioning](#versioning)
21
+ 9. [Security](#security)
22
+ 10. [Conformance](#conformance)
23
+
24
+ ## Introduction
25
+
26
+ The Open Agent Passport (OAP) specification provides a standardized way to:
27
+
28
+ - **Identify AI agents** with unique, verifiable credentials
29
+ - **Define capabilities** and operational limits
30
+ - **Enforce policies** through standardized decision objects
31
+ - **Ensure security** through cryptographic signatures and verification
32
+ - **Enable interoperability** across different platforms and organizations
33
+
34
+ ### Key Design Principles
35
+
36
+ - **Simplicity**: Core objects are minimal and focused
37
+ - **Security**: Cryptographic verification of all decisions
38
+ - **Interoperability**: Standardized formats for cross-platform compatibility
39
+ - **Extensibility**: Support for custom capabilities and policy packs
40
+ - **Performance**: Optimized for edge computing and high-throughput scenarios
41
+
42
+ ## Core Objects
43
+
44
+ ### Passport Objects
45
+
46
+ ### Passport (Template or Instance)
47
+
48
+ A passport represents either a template (canonical agent identity) or an instance (tenant-specific deployment).
49
+
50
+ #### Required Fields
51
+
52
+ - `passport_id` (UUID v4): Unique identifier for the passport
53
+ - `kind` (enum): Either "template" or "instance"
54
+ - `spec_version` (string): OAP specification version (e.g., "oap/1.0")
55
+ - `owner_id` (string): Unique identifier for the owner
56
+ - `owner_type` (enum): Either "org" or "user"
57
+ - `assurance_level` (enum): L0, L1, L2, L3, L4KYC, L4FIN
58
+ - `status` (enum): draft, active, suspended, or revoked
59
+ - `capabilities` (array): List of granted capabilities with optional parameters
60
+ - `limits` (object): Operational limits per capability
61
+ - `regions` (array): Authorized geographic regions
62
+ - `created_at` (ISO 8601): Creation timestamp
63
+ - `updated_at` (ISO 8601): Last update timestamp
64
+ - `version` (string): Semantic version number (e.g., "1.0.0")
65
+
66
+ #### Optional Fields
67
+
68
+ - `parent_agent_id` (UUID v4): Required for instances, references the template
69
+ - `metadata` (object): Additional metadata
70
+ - `did` (string): W3C Decentralized Identifier in did:web format (e.g., "did:web:api.aport.io:agents:ap_abc123")
71
+ - `expires_at` (ISO 8601): Expiration timestamp for ephemeral credentials
72
+ - `never_expires` (boolean): Explicit flag for perpetual credentials (default: true if expires_at not set)
73
+
74
+ #### Example
75
+
76
+ ```json
77
+ {
78
+ "passport_id": "550e8400-e29b-41d4-a716-446655440000",
79
+ "kind": "template",
80
+ "spec_version": "oap/1.0",
81
+ "owner_id": "org_12345678",
82
+ "owner_type": "org",
83
+ "assurance_level": "L2",
84
+ "status": "active",
85
+ "capabilities": [
86
+ {
87
+ "id": "finance.payment.refund",
88
+ "params": {
89
+ "max_amount": 5000,
90
+ "currency": "USD"
91
+ }
92
+ },
93
+ {
94
+ "id": "data.export"
95
+ }
96
+ ],
97
+ "limits": {
98
+ "finance.payment.refund": {
99
+ "currency_limits": {
100
+ "USD": {
101
+ "max_per_tx": 5000,
102
+ "daily_cap": 50000
103
+ }
104
+ },
105
+ "reason_codes": ["customer_request", "defective_product"],
106
+ "idempotency_required": true
107
+ }
108
+ },
109
+ "regions": ["US", "CA"],
110
+ "did": "did:web:api.aport.io:agents:ap_abc123",
111
+ "never_expires": true,
112
+ "created_at": "2024-01-01T00:00:00Z",
113
+ "updated_at": "2024-01-15T10:30:00Z",
114
+ "version": "1.0.0"
115
+ }
116
+ ```
117
+
118
+ ## Assurance Levels
119
+
120
+ Assurance levels indicate the verification strength of the passport owner's identity.
121
+
122
+ | Level | Name | Description | Requirements |
123
+ |-------|------|-------------|--------------|
124
+ | L0 | Self-Attested | Owner self-declares identity | Self-declaration |
125
+ | L1 | Email Verified | Email address verified | Valid email + confirmation |
126
+ | L2 | GitHub Verified | GitHub account verified | GitHub account + public profile |
127
+ | L3 | Domain Verified | Domain ownership verified | DNS TXT or /.well-known/oap.json |
128
+ | L4KYC | KYC/KYB Verified | Know Your Customer/Business verification completed | Government ID + business registration |
129
+ | L4FIN | Financial Data Verified | Financial data and banking information verified | Bank account verification + financial statements |
130
+
131
+ ## Decision Objects
132
+
133
+ ### Decision Structure
134
+
135
+ A decision object represents the result of policy evaluation for a specific action.
136
+
137
+ ### Required Fields
138
+
139
+ - `decision_id` (UUID v4): Unique identifier for the decision
140
+ - `policy_id` (string): Policy pack identifier (e.g., "finance.payment.refund.v1")
141
+ - `agent_id` (UUID v4): Agent that was evaluated
142
+ - `owner_id` (string): Owner ID from the passport
143
+ - `assurance_level` (enum): Assurance level from the passport
144
+ - `allow` (boolean): Whether the action is allowed
145
+ - `reasons` (array): Array of reason objects with code and message
146
+ - `created_at` (ISO 8601): When the decision was created
147
+ - `expires_in` (integer): Number of seconds until the decision expires
148
+ - `passport_digest` (string): SHA-256 hash of JCS-canonicalized passport
149
+ - `signature` (string): Ed25519 signature over decision payload
150
+ - `kid` (string): Key identifier for signature verification
151
+
152
+ ### Optional Fields
153
+
154
+ - `decision_token` (string): Compact JWT for sub-TTL caching
155
+
156
+ ### Example
157
+
158
+ ```json
159
+ {
160
+ "decision_id": "550e8400-e29b-41d4-a716-446655440002",
161
+ "policy_id": "finance.payment.refund.v1",
162
+ "agent_id": "550e8400-e29b-41d4-a716-446655440000",
163
+ "owner_id": "org_12345678",
164
+ "assurance_level": "L2",
165
+ "allow": true,
166
+ "reasons": [
167
+ {
168
+ "code": "oap.allowed",
169
+ "message": "Transaction within limits"
170
+ }
171
+ ],
172
+ "created_at": "2024-01-15T10:30:00Z",
173
+ "expires_in": 3600,
174
+ "passport_digest": "sha256:abcd1234efgh5678ijkl9012mnop3456qrst7890uvwx1234yzab5678cdef",
175
+ "signature": "ed25519:abcd1234efgh5678ijkl9012mnop3456qrst7890uvwx1234yzab5678cdef==",
176
+ "kid": "oap:registry:key-2025-01"
177
+ }
178
+ ```
179
+
180
+ ## Caching & TTL
181
+
182
+ ### Decision Caching
183
+
184
+ ### Decision Caching
185
+
186
+ Relying parties MAY cache allow decisions until `expires_at`.
187
+
188
+ ### Suspend/Revoke Semantics
189
+
190
+ When a passport is suspended or revoked:
191
+ - Validators MUST treat cached tokens as invalid after max 30 seconds
192
+ - Publishers MUST purge caches within 30 seconds
193
+ - Decision tokens MUST be invalidated globally
194
+
195
+ ## Canonicalization & Signing
196
+
197
+ ### JCS Canonicalization
198
+
199
+ ### JCS Canonicalization
200
+
201
+ All objects MUST be canonicalized using [RFC 8785 JCS](https://tools.ietf.org/html/rfc8785) before:
202
+ - Computing passport digests
203
+ - Creating signatures
204
+ - Verifying signatures
205
+
206
+ ### Ed25519 Signatures
207
+
208
+ - All decisions MUST be signed with Ed25519
209
+ - Signatures are computed over JCS-canonicalized decision payloads
210
+ - Key identifiers (kid) MUST be resolvable via `/.well-known/oap/keys.json`
211
+
212
+ ### Key Resolution
213
+
214
+ Keys are resolved using the following format:
215
+ - Registry keys: `oap:registry:<keyid>`
216
+ - Owner keys: `oap:owner:<domain>:<keyid>`
217
+
218
+ ## Errors
219
+
220
+ ### Normative Error Codes
221
+
222
+ ### Normative Error Codes
223
+
224
+ | Code | Description |
225
+ |------|-------------|
226
+ | `oap.invalid_context` | Context data is invalid or malformed |
227
+ | `oap.unknown_capability` | Capability is not recognized |
228
+ | `oap.limit_exceeded` | Operation exceeds configured limits |
229
+ | `oap.currency_unsupported` | Currency is not supported |
230
+ | `oap.region_blocked` | Operation not allowed in this region |
231
+ | `oap.assurance_insufficient` | Assurance level too low for operation |
232
+ | `oap.passport_suspended` | Passport is suspended or revoked |
233
+ | `oap.idempotency_conflict` | Idempotency key conflict |
234
+ | `oap.policy_error` | Policy evaluation error |
235
+
236
+ ## Versioning
237
+
238
+ ### Specification Versioning
239
+
240
+ ### Specification Versioning
241
+
242
+ - Uses SemVer: `oap/1.0`, `oap/1.1`, etc.
243
+ - Major versions may introduce breaking changes
244
+ - Minor versions add backward-compatible features
245
+
246
+ ### Policy Pack Versioning
247
+
248
+ - Policy packs are frozen by ID (e.g., `finance.payment.refund.v1`)
249
+ - Changes require new version (e.g., `finance.payment.refund.v2`)
250
+ - Old versions remain valid and supported
251
+
252
+ ### Policy Pack Schema
253
+
254
+ Policy packs define the evaluation logic for specific capabilities. Each policy pack MUST include the following fields:
255
+
256
+ #### Required Fields
257
+
258
+ - `id` (string): Unique policy pack identifier in the format `{domain}.{capability}.v{version}` (e.g., `finance.payment.refund.v1`)
259
+ - `name` (string): Human-readable policy name
260
+ - `description` (string): Detailed description of the policy's purpose and enforcement rules
261
+ - `version` (string): Semantic version (e.g., `1.0.0`)
262
+ - `status` (string): One of `active`, `deprecated`, `beta`
263
+ - `requires_capabilities` (array of strings): List of capability IDs required for this policy
264
+ - `min_assurance` (string): Minimum assurance level required (e.g., `L1`, `L2`, `L3`)
265
+
266
+ #### Optional Fields
267
+
268
+ - `evaluation_rules_version` (string): Version of the evaluation rules format (e.g., `1.0`). Defaults to `1.0` if not specified.
269
+ - `evaluation_rules` (array): Array of evaluation rule objects that define the policy logic. Each rule object MUST include:
270
+ - `name` (string): Unique identifier for this rule within the policy
271
+ - `type` (string): Rule type - either `expression` or `custom_validator`
272
+ - `deny_code` (string): OAP error code to return if rule fails (e.g., `oap.limit_exceeded`)
273
+ - `description` (string): Human-readable description of what this rule checks
274
+ - For `expression` type:
275
+ - `condition` (string): JavaScript expression that evaluates to boolean. Has access to `passport`, `context`, and `limits` scope objects. Uses safe expression evaluator with restricted grammar.
276
+ - For `custom_validator` type:
277
+ - `validator` (string): Name of the validator function from the custom validators registry
278
+ - Optional:
279
+ - `message` (string): Custom error message to return if rule fails
280
+
281
+ - `limits_required` (array of strings): List of limit keys that must be present in passport limits
282
+ - `required_fields` (array of strings): List of required context fields
283
+ - `optional_fields` (array of strings): List of optional context fields
284
+ - `enforcement` (object): Enforcement configuration flags
285
+ - `required_context` (object): JSON Schema for validating context data
286
+ - `cache` (object): Caching configuration with `default_ttl_seconds` and `suspend_invalidate_seconds`
287
+ - `mcp` (object): MCP-specific configuration flags
288
+ - `advice` (array of strings): Best practice recommendations for policy usage
289
+ - `deprecation` (object or null): Deprecation information if status is `deprecated`
290
+ - `created_at` (string): ISO 8601 timestamp of policy creation
291
+ - `updated_at` (string): ISO 8601 timestamp of last policy update
292
+
293
+ #### Evaluation Rules
294
+
295
+ Evaluation rules provide declarative policy logic without requiring manual code. Rules are evaluated in order, and the first failing rule causes policy denial.
296
+
297
+ **Expression Rules** use safe JavaScript expressions:
298
+ ```json
299
+ {
300
+ "name": "amount_within_limit",
301
+ "type": "expression",
302
+ "condition": "context.amount <= limits.payments.charge.max_per_tx",
303
+ "deny_code": "oap.limit_exceeded",
304
+ "description": "Transaction amount must not exceed limit"
305
+ }
306
+ ```
307
+
308
+ **Custom Validator Rules** reference pre-defined validator functions:
309
+ ```json
310
+ {
311
+ "name": "blocked_patterns",
312
+ "type": "custom_validator",
313
+ "validator": "validateBlockedPatterns",
314
+ "deny_code": "oap.blocked_pattern",
315
+ "description": "Command must not contain blocked patterns"
316
+ }
317
+ ```
318
+
319
+ Expression rules have access to:
320
+ - `passport` - The full passport object (agent_id, status, capabilities, limits, etc.)
321
+ - `context` - The action context provided in the verification request
322
+ - `limits` - Shorthand for `passport.limits`
323
+ - `helpers` - Safe helper methods (array/string operations, comparisons)
324
+
325
+ Expressions MUST NOT contain:
326
+ - `eval()`, `Function()`, or other code execution primitives
327
+ - `__proto__`, `prototype`, `constructor` (prototype pollution)
328
+ - Expressions longer than 1000 characters
329
+
330
+ Custom validators MUST be:
331
+ - Pure functions (no I/O, no side effects)
332
+ - Deterministic (same inputs always produce same outputs)
333
+ - Registered in the validator registry before evaluation
334
+
335
+ #### Example Policy Pack
336
+
337
+ ```json
338
+ {
339
+ "id": "system.command.execute.v1",
340
+ "name": "System Command Execution Policy",
341
+ "description": "Pre-action governance for shell command execution",
342
+ "version": "1.0.0",
343
+ "status": "active",
344
+ "requires_capabilities": ["system.command.execute"],
345
+ "min_assurance": "L2",
346
+ "evaluation_rules_version": "1.0",
347
+ "evaluation_rules": [
348
+ {
349
+ "name": "command_allowlist",
350
+ "type": "expression",
351
+ "condition": "limits.allowed_commands.includes(context.command)",
352
+ "deny_code": "oap.command_not_allowed",
353
+ "description": "Command must be in allowed list"
354
+ },
355
+ {
356
+ "name": "blocked_patterns",
357
+ "type": "custom_validator",
358
+ "validator": "validateBlockedPatterns",
359
+ "deny_code": "oap.blocked_pattern",
360
+ "description": "Command must not contain blocked patterns"
361
+ }
362
+ ],
363
+ "required_context": {
364
+ "type": "object",
365
+ "required": ["command"],
366
+ "properties": {
367
+ "command": {
368
+ "type": "string",
369
+ "description": "Command to execute"
370
+ }
371
+ }
372
+ },
373
+ "cache": {
374
+ "default_ttl_seconds": 60,
375
+ "suspend_invalidate_seconds": 30
376
+ }
377
+ }
378
+ ```
379
+
380
+ ## Security
381
+
382
+ ### Key Management
383
+
384
+ ### Key Management
385
+
386
+ - Ed25519 keys for all signatures
387
+ - Registry keys published at `https://api.yourdomain/.well-known/oap/keys.json`
388
+ - Owner keys MAY be published at their domain
389
+
390
+ ### Receipt Verification
391
+
392
+ - Decision receipts MUST be signed
393
+ - Relying parties SHOULD verify signatures where feasible
394
+ - Passport digests MUST match the evaluated passport
395
+
396
+ ### Suspend Semantics
397
+
398
+ - Status changes to suspended/revoked MUST invalidate decisions within ≤30s globally
399
+ - Cached decisions MUST be treated as invalid after suspend/revoke
400
+
401
+ ## Conformance
402
+
403
+ ### What Implementers Must Do
404
+
405
+ ### What Implementers Must Do
406
+
407
+ 1. **Validate passports** against `passport-schema.json` and semantic rules
408
+ 2. **Evaluate policy packs** deterministically with given context and limits
409
+ 3. **Produce decisions** matching `decision-schema.json` with correct reasons, digest, signature, and TTL
410
+ 4. **Verify receipts** (signature + kid resolution)
411
+ 5. **Respect suspend semantics** (cache TTL bounds)
412
+
413
+ ### Test Vectors
414
+
415
+ Conformance test cases are provided in the `/conformance` directory with:
416
+ - Passport examples
417
+ - Context data
418
+ - Expected decisions
419
+ - Signature verification tests
420
+
421
+ ## References
422
+
423
+ - [RFC 8785: JSON Canonicalization Scheme (JCS)](https://tools.ietf.org/html/rfc8785)
424
+ - [RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA)](https://tools.ietf.org/html/rfc8032)
425
+ - [W3C Verifiable Credentials Data Model](https://www.w3.org/TR/vc-data-model/)
426
+ - [JSON Schema Specification](https://json-schema.org/)