permdock 0.0.0 → 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.
Files changed (290) hide show
  1. package/README.md +268 -1
  2. package/dist/a2a/index.d.ts +178 -0
  3. package/dist/a2a/index.js +271 -0
  4. package/dist/ai-sdk/index.d.ts +74 -0
  5. package/dist/ai-sdk/index.js +137 -0
  6. package/dist/approval-required-TzNB9oQA.js +6 -0
  7. package/dist/approvals/index.d.ts +3 -0
  8. package/dist/approvals/index.js +4 -0
  9. package/dist/approvals-DaxY-Bdg.js +218 -0
  10. package/dist/approvers-aH0PJkmf.js +20 -0
  11. package/dist/arazzo-CTeVuXr5.js +70 -0
  12. package/dist/arazzo-aoTkqYsJ.js +54 -0
  13. package/dist/authzen/index.d.ts +48 -0
  14. package/dist/authzen/index.js +336 -0
  15. package/dist/better-auth/index.d.ts +92 -0
  16. package/dist/better-auth/index.js +324 -0
  17. package/dist/budget-JqcRqyhK.d.ts +11 -0
  18. package/dist/budget-NbEtbJC_.js +11 -0
  19. package/dist/capability-B68OFnZx.js +171 -0
  20. package/dist/capability-BDG_nkxt.d.ts +99 -0
  21. package/dist/catalog/index.d.ts +12 -0
  22. package/dist/catalog/index.js +2 -0
  23. package/dist/catalog-B0E6bggc.js +48 -0
  24. package/dist/catalog-H-vFGwWK.js +55 -0
  25. package/dist/catalog-doc-BSo_Q_-6.js +298 -0
  26. package/dist/catalog-idsHc0vo.js +2 -0
  27. package/dist/catalog-path-CnI0XTFK.js +12 -0
  28. package/dist/claude-agent/index.d.ts +81 -0
  29. package/dist/claude-agent/index.js +83 -0
  30. package/dist/clerk/index.d.ts +56 -0
  31. package/dist/clerk/index.js +280 -0
  32. package/dist/cli/bin.d.ts +1 -0
  33. package/dist/cli/bin.js +20 -0
  34. package/dist/cli/index.d.ts +46 -0
  35. package/dist/cli/index.js +5 -0
  36. package/dist/cloud/index.d.ts +91 -0
  37. package/dist/cloud/index.js +390 -0
  38. package/dist/cloud-BNQTrmrr.js +50 -0
  39. package/dist/cloud-Cuxr6Czw.js +117 -0
  40. package/dist/collect-B7_TIfmg.js +49 -0
  41. package/dist/collect-O-tOtbnk.js +350 -0
  42. package/dist/collect-fRPAQIWb.js +2 -0
  43. package/dist/commands-BMh_Etm2.js +93 -0
  44. package/dist/compact-y6vfu2_f.js +19 -0
  45. package/dist/compare-pfyVnBjE.js +12 -0
  46. package/dist/compile-CQbvyIBr.d.ts +30 -0
  47. package/dist/compile-D22iwvuV.js +558 -0
  48. package/dist/config-BPYmjTOp.js +26 -0
  49. package/dist/connection-JvqwHODC.js +194 -0
  50. package/dist/context-CKEAabd7.js +73 -0
  51. package/dist/context-gtAwAILx.js +6 -0
  52. package/dist/convex/index.d.ts +40 -0
  53. package/dist/convex/index.js +55 -0
  54. package/dist/create-BKF3dgFk.d.ts +162 -0
  55. package/dist/create-CSkhDU9T.js +222 -0
  56. package/dist/credential-B_rkUNlY.js +326 -0
  57. package/dist/credentials-BgRX3WEg.js +268 -0
  58. package/dist/describe-Bt1YD5uS.js +99 -0
  59. package/dist/describe-DernyItf.d.ts +37 -0
  60. package/dist/diff-BUzf5Poi.js +48 -0
  61. package/dist/diff-x5Il8LVa.js +418 -0
  62. package/dist/digest-B3kc_PgQ.d.ts +19 -0
  63. package/dist/digest-BI-6aa6d.js +27 -0
  64. package/dist/doctor-BGle8Gqi.js +1314 -0
  65. package/dist/doctor-Bqo6FwUa.js +53 -0
  66. package/dist/drizzle/index.d.ts +72 -0
  67. package/dist/drizzle/index.js +160 -0
  68. package/dist/duration-xK2jGFVc.js +25 -0
  69. package/dist/elysia/index.d.ts +71 -0
  70. package/dist/elysia/index.js +103 -0
  71. package/dist/errors-DSMnAVNa.js +43 -0
  72. package/dist/errors-DbZ1YOnb.d.ts +138 -0
  73. package/dist/errors-Iy71s7Oj.js +177 -0
  74. package/dist/errors-m3u9TmDu.js +27 -0
  75. package/dist/evaluations-DsAU9ppl.js +479 -0
  76. package/dist/eve/index.d.ts +95 -0
  77. package/dist/eve/index.js +181 -0
  78. package/dist/express/index.d.ts +46 -0
  79. package/dist/express/index.js +108 -0
  80. package/dist/fastify/index.d.ts +56 -0
  81. package/dist/fastify/index.js +141 -0
  82. package/dist/files-B_wAGYmt.js +121 -0
  83. package/dist/fixtures-Cvaw0gDG.js +64 -0
  84. package/dist/freeze-y1_jQL4v.js +31 -0
  85. package/dist/from-snapshot-BMGnhmgv.js +552 -0
  86. package/dist/generate-CH7ThJ14.js +173 -0
  87. package/dist/grantee-Bv04_Vzf.js +521 -0
  88. package/dist/headers-B5RRv3Xm.js +6 -0
  89. package/dist/headers-C8SHQccD.d.ts +6 -0
  90. package/dist/helpers-DnSOrhB9.js +682 -0
  91. package/dist/hono/index.d.ts +70 -0
  92. package/dist/hono/index.js +131 -0
  93. package/dist/hosted-BwKQ1BTA.js +265 -0
  94. package/dist/http-DPuDaChb.d.ts +13 -0
  95. package/dist/http-GgVApX1k.js +111 -0
  96. package/dist/index-CltcQ4Bf.d.ts +138 -0
  97. package/dist/index-LF_hS-yn.d.ts +177 -0
  98. package/dist/index-fG6NSXlc.d.ts +9 -0
  99. package/dist/index-xIxJLwOQ.d.ts +415 -0
  100. package/dist/index.d.ts +11 -0
  101. package/dist/index.js +21 -0
  102. package/dist/jwt/index.d.ts +87 -0
  103. package/dist/jwt/index.js +571 -0
  104. package/dist/kernel-YOGCWNLf.js +211 -0
  105. package/dist/kysely/index.d.ts +77 -0
  106. package/dist/kysely/index.js +129 -0
  107. package/dist/load-BZ24CpZP.js +69 -0
  108. package/dist/load-QOOm1z70.js +2 -0
  109. package/dist/load-jose-BL6LH4bL.js +11 -0
  110. package/dist/lru-8q4WZjBV.js +28 -0
  111. package/dist/manifest-DDQbC6K0.d.ts +118 -0
  112. package/dist/map-DowSO96j.js +158 -0
  113. package/dist/map-claims-B_6I1Rn-.js +360 -0
  114. package/dist/map-error-RJ3ZsUyA.js +16 -0
  115. package/dist/markers-B0hYLvMD.js +60 -0
  116. package/dist/may-use-CnFEjVEp.js +37 -0
  117. package/dist/mcp/index.d.ts +127 -0
  118. package/dist/mcp/index.js +563 -0
  119. package/dist/nest/index.d.ts +80 -0
  120. package/dist/nest/index.js +270 -0
  121. package/dist/next/client.d.ts +24 -0
  122. package/dist/next/client.js +31 -0
  123. package/dist/next/index.d.ts +110 -0
  124. package/dist/next/index.js +195 -0
  125. package/dist/next/plugin.d.ts +14 -0
  126. package/dist/next/plugin.js +2 -0
  127. package/dist/node/index.d.ts +43 -0
  128. package/dist/node/index.js +66 -0
  129. package/dist/openai/index.d.ts +71 -0
  130. package/dist/openai/index.js +105 -0
  131. package/dist/openapi/index.d.ts +93 -0
  132. package/dist/openapi/index.js +3 -0
  133. package/dist/openapi-CwePaF7C.js +164 -0
  134. package/dist/openapi-DWD0Uc_4.js +250 -0
  135. package/dist/openapi-DcqM8nU7.js +306 -0
  136. package/dist/openapi-import-BWRUNNeW.js +5959 -0
  137. package/dist/openapi-schema-D8j_T9tO.js +6902 -0
  138. package/dist/orpc/index.d.ts +64 -0
  139. package/dist/orpc/index.js +188 -0
  140. package/dist/otel/index.d.ts +13 -0
  141. package/dist/otel/index.js +202 -0
  142. package/dist/package-root-zGkxO3oN.js +30 -0
  143. package/dist/parse-DPfIvFMU.js +135 -0
  144. package/dist/pdp/index.d.ts +22 -0
  145. package/dist/pdp/index.js +795 -0
  146. package/dist/peer-BOr_kJE1.js +31 -0
  147. package/dist/permdock-yoZ7EjxX.js +2956 -0
  148. package/dist/permissions-B4apnahQ.d.ts +185 -0
  149. package/dist/permissions-B8vCg_bI.d.ts +52 -0
  150. package/dist/permissions-CofRqesP.js +142 -0
  151. package/dist/permissions-DC7GROPA.js +600 -0
  152. package/dist/pg-4GJWDUxG.js +953 -0
  153. package/dist/pins-CqE1jZuF.js +12 -0
  154. package/dist/plugin-4gr7IxFJ.js +65 -0
  155. package/dist/policy-ANp36PnI.js +971 -0
  156. package/dist/policy-CInmNGkM.d.ts +1959 -0
  157. package/dist/policy-Cq2fB8Q5.d.ts +20 -0
  158. package/dist/prisma/index.d.ts +135 -0
  159. package/dist/prisma/index.js +430 -0
  160. package/dist/problem-Cgp9-KZA.js +226 -0
  161. package/dist/prompt-CXYhLfsS.js +32 -0
  162. package/dist/protected-B4K3BKoX.js +138 -0
  163. package/dist/protected-BuPAycJT.d.ts +26 -0
  164. package/dist/protected-wY7nXhY9.d.ts +23 -0
  165. package/dist/provider-_wx46HpB.js +48 -0
  166. package/dist/provider-wTAUda2v.d.ts +6 -0
  167. package/dist/react/index.d.ts +6 -0
  168. package/dist/react/index.js +6 -0
  169. package/dist/react/provider-client.d.ts +2 -0
  170. package/dist/react/provider-client.js +3 -0
  171. package/dist/react-native/index.d.ts +42 -0
  172. package/dist/react-native/index.js +174 -0
  173. package/dist/refs-ChLSxbST.js +90 -0
  174. package/dist/relations-r4soIFZB.js +426 -0
  175. package/dist/revocations-Cy06JNx2.d.ts +21 -0
  176. package/dist/rls-BOFU3chG.js +233 -0
  177. package/dist/rls-CJVja9Ww.js +2119 -0
  178. package/dist/rls-graph-DxQ39PJj.js +371 -0
  179. package/dist/rls-helpers-BxRuif0l.js +1346 -0
  180. package/dist/rls-import-CXV6LBlS.js +942 -0
  181. package/dist/rls-migrate-DrFPbf8p.js +366 -0
  182. package/dist/row-check-BajTgQZ-.d.ts +43 -0
  183. package/dist/run-CJ6UvS3a.js +155 -0
  184. package/dist/runtime-DP9ttFh1.js +27 -0
  185. package/dist/saas-BRrZzJkM.js +1193 -0
  186. package/dist/schema-P8yoma__.js +296 -0
  187. package/dist/scim/index.d.ts +2 -0
  188. package/dist/scim/index.js +2 -0
  189. package/dist/scim-9NFa0XVZ.js +1445 -0
  190. package/dist/scopes-cKVp_WTw.js +212 -0
  191. package/dist/server/index.d.ts +123 -0
  192. package/dist/server/index.js +8 -0
  193. package/dist/sha256-BO0swRXL.js +150 -0
  194. package/dist/sink-Bd9PSyfq.js +141 -0
  195. package/dist/sink-Cfr9-7YC.d.ts +104 -0
  196. package/dist/skills-C_lpV4Jx.js +50 -0
  197. package/dist/skills-Dx3QLnMY.js +110 -0
  198. package/dist/snapshot-DE8dE_hz.js +1051 -0
  199. package/dist/solid/index.d.ts +63 -0
  200. package/dist/solid/index.js +197 -0
  201. package/dist/source-DoBBYJi2.js +6 -0
  202. package/dist/sources-DOpW5Ila.d.ts +347 -0
  203. package/dist/sources-DVHM3Mwq.js +284 -0
  204. package/dist/sql-Bll1d7y0.js +22 -0
  205. package/dist/src-CTNT-PBW.js +430 -0
  206. package/dist/ssf/index.d.ts +3 -0
  207. package/dist/ssf/index.js +622 -0
  208. package/dist/store-Bq90395i.d.ts +27 -0
  209. package/dist/store-C6hFW6ta.js +508 -0
  210. package/dist/stores-CkG2HrSg.js +140 -0
  211. package/dist/stores-CvOnu_2T.d.ts +41 -0
  212. package/dist/stream-BhMfZOwr.d.ts +12 -0
  213. package/dist/stream-Q_xlB6Ko.js +52 -0
  214. package/dist/style-CTm1AXDT.js +22 -0
  215. package/dist/subject-C6dLxqHU.js +24 -0
  216. package/dist/subject-settings-xt7V845g.js +82 -0
  217. package/dist/supabase/index.d.ts +67 -0
  218. package/dist/supabase/index.js +4 -0
  219. package/dist/supabase/middleware.d.ts +77 -0
  220. package/dist/supabase/middleware.js +68 -0
  221. package/dist/supabase-D8UlBA7Z.js +83 -0
  222. package/dist/supabase-DTxGtYdi.js +796 -0
  223. package/dist/supabase-hook-DW-xP4hU.js +2 -0
  224. package/dist/supabase-hook-D_OqGb_V.js +1528 -0
  225. package/dist/svelte/Protected.svelte +34 -0
  226. package/dist/svelte/index.d.ts +10 -0
  227. package/dist/svelte/index.js +53 -0
  228. package/dist/svelte/runtime.d.ts +6 -0
  229. package/dist/svelte/runtime.js +3 -0
  230. package/dist/svelte/source.d.ts +10 -0
  231. package/dist/svelte/source.js +8 -0
  232. package/dist/terminal/index.d.ts +171 -0
  233. package/dist/terminal/index.js +821 -0
  234. package/dist/testing/index.d.ts +656 -0
  235. package/dist/testing/index.js +3208 -0
  236. package/dist/testing/saas/index.d.ts +194 -0
  237. package/dist/testing/saas/index.js +3 -0
  238. package/dist/testing/saas/permissions.d.ts +2 -0
  239. package/dist/testing/saas/permissions.js +2 -0
  240. package/dist/text-diff-BdkkYSbi.js +15 -0
  241. package/dist/thenable-okc2xDsj.js +10 -0
  242. package/dist/timeout-D51niuQP.js +8 -0
  243. package/dist/trpc/index.d.ts +80 -0
  244. package/dist/trpc/index.js +205 -0
  245. package/dist/types-B8w5PFtS.d.ts +141 -0
  246. package/dist/types-B9dmiiab.d.ts +66 -0
  247. package/dist/types-BBK-exvJ.d.ts +177 -0
  248. package/dist/types-BvBk1wgn.d.ts +118 -0
  249. package/dist/types-CxquUByI.d.ts +9 -0
  250. package/dist/types-D6Z6-rKJ.d.ts +312 -0
  251. package/dist/types-DbWdEfcm.d.ts +87 -0
  252. package/dist/types-bva3i4Gf.d.ts +98 -0
  253. package/dist/types-i4BAOvdb.d.ts +97 -0
  254. package/dist/unplugin/index.d.ts +7 -0
  255. package/dist/unplugin/index.js +30 -0
  256. package/dist/usage-1ozMubLY.js +42 -0
  257. package/dist/usage-CUnK6Ou9.js +530 -0
  258. package/dist/usage-PyEor6GA.js +2 -0
  259. package/dist/validity-D0uRmJKJ.js +224 -0
  260. package/dist/verifier-B90agnhl.js +461 -0
  261. package/dist/version-CnSh33Fj.js +16 -0
  262. package/dist/vocabulary-Dk0fs-Jk.d.ts +56 -0
  263. package/dist/vue/index.d.ts +57 -0
  264. package/dist/vue/index.js +203 -0
  265. package/dist/webmcp/index.d.ts +75 -0
  266. package/dist/webmcp/index.js +313 -0
  267. package/package.json +423 -4
  268. package/rulesets/permdock.yaml +29 -0
  269. package/schemas/catalog-v1.json +507 -0
  270. package/schemas/openapi/oas-3.1.json +1298 -0
  271. package/schemas/openapi/oas-3.2.json +1516 -0
  272. package/schemas/openapi/overlay-1.1.json +79 -0
  273. package/schemas/supabase-claims-v1.json +139 -0
  274. package/schemas/supabase-manifest-v1.json +217 -0
  275. package/skills/permdock/SKILL.md +66 -0
  276. package/skills/permdock-agents/SKILL.md +77 -0
  277. package/skills/permdock-agents/references/runtimes.md +211 -0
  278. package/skills/permdock-approvals/SKILL.md +80 -0
  279. package/skills/permdock-approvals/references/stores-and-resume.md +83 -0
  280. package/skills/permdock-audit/SKILL.md +67 -0
  281. package/skills/permdock-credentials/SKILL.md +55 -0
  282. package/skills/permdock-credentials/references/tokens-keys-links.md +127 -0
  283. package/skills/permdock-data/SKILL.md +57 -0
  284. package/skills/permdock-data/references/queries-and-rls.md +54 -0
  285. package/skills/permdock-data/references/relationships.md +65 -0
  286. package/skills/permdock-tenancy/SKILL.md +77 -0
  287. package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +83 -0
  288. package/skills/permdock-wire/SKILL.md +116 -0
  289. package/skills/permdock-wire/references/adapters.md +480 -0
  290. package/skills/permdock-wire/references/policy-options.md +43 -0
@@ -0,0 +1,79 @@
1
+ {
2
+ "$id": "https://spec.openapis.org/overlay/1.1/schema/2026-04-01",
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "description": "The description of Overlay v1.1.x documents",
5
+ "type": "object",
6
+ "properties": {
7
+ "overlay": {
8
+ "type": "string",
9
+ "pattern": "^1\\.1\\.\\d+$"
10
+ },
11
+ "info": {
12
+ "$ref": "#/$defs/info-object"
13
+ },
14
+ "extends": {
15
+ "type": "string",
16
+ "format": "uri-reference"
17
+ },
18
+ "actions": {
19
+ "type": "array",
20
+ "minItems": 1,
21
+ "uniqueItems": true,
22
+ "items": {
23
+ "$ref": "#/$defs/action-object"
24
+ }
25
+ }
26
+ },
27
+ "required": ["overlay", "info", "actions"],
28
+ "$ref": "#/$defs/specification-extensions",
29
+ "unevaluatedProperties": false,
30
+ "$defs": {
31
+ "info-object": {
32
+ "type": "object",
33
+ "properties": {
34
+ "title": {
35
+ "type": "string"
36
+ },
37
+ "version": {
38
+ "type": "string"
39
+ },
40
+ "description": {
41
+ "type": "string"
42
+ }
43
+ },
44
+ "required": ["title", "version"],
45
+ "$ref": "#/$defs/specification-extensions",
46
+ "unevaluatedProperties": false
47
+ },
48
+ "action-object": {
49
+ "type": "object",
50
+ "properties": {
51
+ "target": {
52
+ "type": "string",
53
+ "pattern": "^\\$"
54
+ },
55
+ "description": {
56
+ "type": "string"
57
+ },
58
+ "update": {
59
+ "type": ["string", "boolean", "object", "array", "number", "null"]
60
+ },
61
+ "copy": {
62
+ "type": "string"
63
+ },
64
+ "remove": {
65
+ "type": "boolean",
66
+ "default": false
67
+ }
68
+ },
69
+ "required": ["target"],
70
+ "$ref": "#/$defs/specification-extensions",
71
+ "unevaluatedProperties": false
72
+ },
73
+ "specification-extensions": {
74
+ "patternProperties": {
75
+ "^x-": true
76
+ }
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,139 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://permdock.dev/schemas/supabase-claims-v1.json",
4
+ "title": "PermDock claims in a Supabase access token",
5
+ "description": "The claims the permdock supabase hook writes and the SQL helpers and subjectFromSupabase read, plus the OAuth claims subjectFromSupabase maps to the actor and delegation. Other claims pass through. Each hook claim may also sit under app_metadata. supabaseClaims() in permdock/supabase validates the same shape; tenant_id is the default rls.tenantClaim.",
6
+ "type": "object",
7
+ "allOf": [{ "$ref": "#/$defs/permdockClaims" }],
8
+ "properties": {
9
+ "client_id": {
10
+ "description": "The OAuth client of a third-party app; becomes actor.id when there is no act claim.",
11
+ "type": "string"
12
+ },
13
+ "scope": {
14
+ "description": "OAuth scopes, space-separated or as a list; becomes delegation.scopes.",
15
+ "anyOf": [
16
+ { "type": "string" },
17
+ { "type": "array", "items": { "type": "string" } }
18
+ ]
19
+ },
20
+ "act": { "$ref": "#/$defs/act" },
21
+ "app_metadata": {
22
+ "type": "object",
23
+ "allOf": [{ "$ref": "#/$defs/permdockClaims" }]
24
+ }
25
+ },
26
+ "$defs": {
27
+ "permdockClaims": {
28
+ "type": "object",
29
+ "properties": {
30
+ "user_role": {
31
+ "description": "Global roles: one name, a list, or null for none.",
32
+ "anyOf": [
33
+ { "type": "string" },
34
+ { "type": "array", "items": { "type": "string" } },
35
+ { "type": "null" }
36
+ ]
37
+ },
38
+ "roles": {
39
+ "type": "array",
40
+ "items": { "type": "string" }
41
+ },
42
+ "memberships": {
43
+ "type": "array",
44
+ "items": { "$ref": "#/$defs/membership" }
45
+ },
46
+ "memberships_truncated": {
47
+ "description": "true when the size budget cut memberships or attrs.",
48
+ "type": "boolean"
49
+ },
50
+ "tenant_id": {
51
+ "description": "The active tenant (the default rls.tenantClaim): the canonical text of one instance of the first scope.",
52
+ "type": "string"
53
+ },
54
+ "attrs": {
55
+ "description": "Allow-listed server-owned attributes, read as principal.claims.attrs.<key>.",
56
+ "type": "object"
57
+ },
58
+ "authz_ver": {
59
+ "description": "The principal's authorization version.",
60
+ "type": "integer"
61
+ }
62
+ }
63
+ },
64
+ "act": {
65
+ "description": "RFC 8693 actor chain: the outermost sub is the current actor, each nested act a prior one. The outermost kind names the actor: none is an OAuth client or agent, support a support session (needs session_id), impersonation an admin acting as the user.",
66
+ "type": "object",
67
+ "required": ["sub"],
68
+ "properties": {
69
+ "sub": { "type": "string", "minLength": 1 },
70
+ "kind": { "enum": ["support", "impersonation"] },
71
+ "session_id": { "type": "string", "minLength": 1 },
72
+ "read_only": { "type": "boolean" },
73
+ "reason": { "type": "string" },
74
+ "act": { "$ref": "#/$defs/act" }
75
+ },
76
+ "if": {
77
+ "required": ["kind"],
78
+ "properties": { "kind": { "const": "support" } }
79
+ },
80
+ "then": { "required": ["session_id"] }
81
+ },
82
+ "membership": {
83
+ "type": "object",
84
+ "required": ["roles"],
85
+ "properties": {
86
+ "scope": { "type": "string" },
87
+ "id": {
88
+ "description": "Canonical text of the scope instance id (uuid::text for a uuid column); compared exactly, never lower-cased.",
89
+ "type": "string"
90
+ },
91
+ "within": {
92
+ "description": "The id of every ancestor scope instance, by scope name.",
93
+ "type": "object",
94
+ "additionalProperties": { "type": "string" }
95
+ },
96
+ "on": {
97
+ "type": "object",
98
+ "required": ["resource", "id"],
99
+ "properties": {
100
+ "resource": { "type": "string" },
101
+ "id": { "type": "string" }
102
+ }
103
+ },
104
+ "tenant": { "type": "string" },
105
+ "team": { "type": "string" },
106
+ "roles": {
107
+ "type": "array",
108
+ "minItems": 1,
109
+ "items": { "type": "string" }
110
+ },
111
+ "via": { "type": "string" },
112
+ "expiresAt": {
113
+ "description": "Seconds since the epoch.",
114
+ "type": "number"
115
+ },
116
+ "grantedBy": { "type": "string" },
117
+ "reason": { "type": "string" },
118
+ "member": {
119
+ "description": "The subgroup a membership source's group fills.",
120
+ "type": "object",
121
+ "required": ["group"],
122
+ "properties": { "group": { "type": "string", "minLength": 1 } }
123
+ },
124
+ "managedBy": { "const": "idp" },
125
+ "entitlements": { "type": "array", "items": { "type": "string" } },
126
+ "grants": {
127
+ "description": "Custom roles in compact form, read by the helpers in jwt mode.",
128
+ "type": "object"
129
+ }
130
+ },
131
+ "anyOf": [
132
+ { "required": ["scope", "id"] },
133
+ { "required": ["tenant"] },
134
+ { "required": ["team"] },
135
+ { "required": ["on"] }
136
+ ]
137
+ }
138
+ }
139
+ }
@@ -0,0 +1,217 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://permdock.dev/schemas/supabase-manifest-v1.json",
4
+ "title": "PermDock Supabase hook manifest v1",
5
+ "description": "What `permdock supabase inspect --json` prints and `--out` writes: the generated hook, the SQL helpers, the claims, the membership sources and the columns that decide them. Fields are only added within v1.",
6
+ "type": "object",
7
+ "required": [
8
+ "$schema",
9
+ "version",
10
+ "hook",
11
+ "helpers",
12
+ "tenantClaim",
13
+ "budget",
14
+ "claims",
15
+ "authzVersion",
16
+ "memberships",
17
+ "rls",
18
+ "decidingColumns",
19
+ "markers"
20
+ ],
21
+ "properties": {
22
+ "$schema": {
23
+ "const": "https://permdock.dev/schemas/supabase-manifest-v1.json"
24
+ },
25
+ "version": { "const": 1 },
26
+ "hook": {
27
+ "type": "object",
28
+ "required": ["schema", "function", "out"],
29
+ "properties": {
30
+ "schema": { "$ref": "#/$defs/identifier" },
31
+ "function": { "const": "custom_access_token_hook" },
32
+ "out": { "type": "string" }
33
+ }
34
+ },
35
+ "helpers": {
36
+ "type": "object",
37
+ "required": ["schema", "functions"],
38
+ "properties": {
39
+ "schema": { "$ref": "#/$defs/identifier" },
40
+ "functions": {
41
+ "type": "array",
42
+ "items": { "$ref": "#/$defs/helperName" }
43
+ }
44
+ }
45
+ },
46
+ "tenantClaim": { "$ref": "#/$defs/identifier" },
47
+ "budget": {
48
+ "type": "object",
49
+ "required": ["bytes", "measure"],
50
+ "properties": {
51
+ "bytes": { "type": "integer", "minimum": 1 },
52
+ "measure": { "type": "string" }
53
+ }
54
+ },
55
+ "claims": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "object",
59
+ "required": ["name", "source", "budget"],
60
+ "properties": {
61
+ "name": { "$ref": "#/$defs/identifier" },
62
+ "source": {
63
+ "type": "string",
64
+ "pattern": "^(permdock|[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*)$"
65
+ },
66
+ "budget": { "type": "boolean" }
67
+ }
68
+ }
69
+ },
70
+ "authzVersion": { "type": "boolean" },
71
+ "authzVersionBump": {
72
+ "type": "object",
73
+ "required": ["schema", "function", "args"],
74
+ "properties": {
75
+ "schema": { "$ref": "#/$defs/identifier" },
76
+ "function": { "const": "permdock_bump_authz_version_for" },
77
+ "args": { "const": "p_users uuid[]" }
78
+ }
79
+ },
80
+ "memberships": {
81
+ "type": "array",
82
+ "items": { "$ref": "#/$defs/membership" }
83
+ },
84
+ "rls": {
85
+ "type": "object",
86
+ "required": [
87
+ "schema",
88
+ "mode",
89
+ "tenantClaim",
90
+ "scopes",
91
+ "helpers",
92
+ "memberships"
93
+ ],
94
+ "properties": {
95
+ "schema": { "$ref": "#/$defs/identifier" },
96
+ "mode": { "enum": ["jwt", "database"] },
97
+ "tenantClaim": { "$ref": "#/$defs/identifier" },
98
+ "scopes": {
99
+ "type": "array",
100
+ "items": {
101
+ "type": "object",
102
+ "required": ["name", "type"],
103
+ "properties": {
104
+ "name": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
105
+ "type": { "type": "string" },
106
+ "within": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" }
107
+ }
108
+ }
109
+ },
110
+ "helpers": {
111
+ "type": "array",
112
+ "items": {
113
+ "type": "object",
114
+ "required": ["name", "args", "returns", "execute"],
115
+ "properties": {
116
+ "name": { "$ref": "#/$defs/helperName" },
117
+ "args": { "type": "string" },
118
+ "returns": { "type": "string" },
119
+ "execute": {
120
+ "type": "array",
121
+ "items": {
122
+ "enum": ["anon", "authenticated", "supabase_auth_admin"]
123
+ }
124
+ }
125
+ }
126
+ }
127
+ },
128
+ "memberships": {
129
+ "type": "array",
130
+ "items": { "$ref": "#/$defs/membership" }
131
+ }
132
+ }
133
+ },
134
+ "decidingColumns": {
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string",
138
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*$"
139
+ }
140
+ },
141
+ "markers": {
142
+ "type": "object",
143
+ "required": ["hook", "grants"],
144
+ "properties": {
145
+ "hook": { "const": "v1" },
146
+ "grants": { "const": "v1" }
147
+ }
148
+ }
149
+ },
150
+ "$defs": {
151
+ "membership": {
152
+ "type": "object",
153
+ "required": ["table", "user", "scope", "id", "role", "columns"],
154
+ "properties": {
155
+ "table": {
156
+ "type": "string",
157
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*\\.[A-Za-z_][A-Za-z0-9_]*$"
158
+ },
159
+ "user": { "$ref": "#/$defs/column" },
160
+ "scope": { "$ref": "#/$defs/value" },
161
+ "id": { "$ref": "#/$defs/column" },
162
+ "role": { "$ref": "#/$defs/value" },
163
+ "within": {
164
+ "oneOf": [
165
+ { "$ref": "#/$defs/column" },
166
+ {
167
+ "type": "object",
168
+ "required": ["columns"],
169
+ "additionalProperties": false,
170
+ "properties": {
171
+ "columns": {
172
+ "type": "object",
173
+ "additionalProperties": { "$ref": "#/$defs/identifier" }
174
+ }
175
+ }
176
+ }
177
+ ]
178
+ },
179
+ "via": { "$ref": "#/$defs/value" },
180
+ "expiresAt": { "$ref": "#/$defs/column" },
181
+ "columns": {
182
+ "type": "array",
183
+ "items": { "$ref": "#/$defs/identifier" }
184
+ }
185
+ }
186
+ },
187
+ "identifier": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
188
+ "helperName": {
189
+ "type": "string",
190
+ "pattern": "^(permdock_has|permitted_[a-z][a-z0-9_]*_ids|member_[a-z][a-z0-9_]*_ids(_for)?)$"
191
+ },
192
+ "column": {
193
+ "type": "object",
194
+ "required": ["column"],
195
+ "additionalProperties": false,
196
+ "properties": { "column": { "$ref": "#/$defs/identifier" } }
197
+ },
198
+ "value": {
199
+ "oneOf": [
200
+ { "$ref": "#/$defs/column" },
201
+ {
202
+ "type": "object",
203
+ "required": ["value"],
204
+ "additionalProperties": false,
205
+ "properties": {
206
+ "value": {
207
+ "oneOf": [
208
+ { "type": "string" },
209
+ { "type": "array", "items": { "type": "string" } }
210
+ ]
211
+ }
212
+ }
213
+ }
214
+ ]
215
+ }
216
+ }
217
+ }
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: permdock
3
+ description: Explains how PermDock decides and routes to the right PermDock skill. Use first for any work with permdock, typed permissions, roles or access control in a TypeScript app, when a check is denied and the reason is unclear, when reading a Decision, denial reason or doctor code, when looking up current PermDock identifiers through the docs MCP, or when choosing between the permdock-wire, permdock-audit, permdock-agents, permdock-approvals, permdock-tenancy, permdock-data and permdock-credentials skills.
4
+ license: MIT
5
+ metadata:
6
+ author: ScaleDockHQ
7
+ homepage: https://permdock.dev/docs/for-ai-agents
8
+ repository: https://github.com/ScaleDockHQ/permdock
9
+ ---
10
+
11
+ # PermDock
12
+
13
+ PermDock is typed permissions for TypeScript apps, APIs, databases and AI agents. Permissions are defined once, decided in process, compiled to queries and RLS, and serialised to client snapshots ([for AI agents](https://permdock.dev/docs/for-ai-agents)). This skill holds the model every other PermDock skill assumes, and says which one to load.
14
+
15
+ ## Inputs (find out before starting)
16
+
17
+ - Whether the app already has `permissions.ts`, `policy.ts` and a `createPermDock` factory file. None means start with `permdock-wire`.
18
+ - The task: set up, review, or one area (agents, approvals, tenants, queries and RLS, tokens and keys).
19
+ - Whether the `permdock` binary runs in the repo (`pnpm exec permdock doctor`).
20
+
21
+ ## Invariants
22
+
23
+ 1. **Fail-closed.** Anything unknown, invalid or thrown denies. `can()` never throws. A `Decision` is only `granted`, `denied` or `approval-required`.
24
+ 2. **Deny overrides allow.** Allows OR together; any matching `deny` wins.
25
+ 3. **References, not strings.** Pass `permissions.post.update`; strings appear only as `.key` / `.scope` on the wire, in catalogs and in audit.
26
+ 4. **Authentication is upstream.** Core never verifies a token. The subject comes from a `subjectFrom*` resolver or the server session, never from a request body, an unsigned header, a CLI flag or model output.
27
+ 5. **Server and client stay apart.** `policy.ts` and `createPermDock` never reach a client entry (doctor PD001); clients read snapshots, and a client check is a hint the server repeats.
28
+ 6. **Portable first.** Conditions that the in-memory evaluator, `where()` and RLS all understand beat closures.
29
+ 7. **The Cloud is optional.** No decision waits on PermDock Cloud; every hosted feature is an interface with an in-process default.
30
+
31
+ ## Workflow
32
+
33
+ 1. **Pick the skill.** Install the one the task needs with `npx skills add ScaleDockHQ/PermDock --skill <name>` (or all of them with `npx skills add ScaleDockHQ/PermDock`, or `pnpm exec permdock skills install` to match the installed package version):
34
+
35
+ | Task | Skill |
36
+ | ------------------------------------------------------- | ---------------------- |
37
+ | Add PermDock, first guard, limits, plans, CLI checks | `permdock-wire` |
38
+ | Review an app or a pull request | `permdock-audit` |
39
+ | Agent tool calls, actors, delegation, A2A, WebMCP | `permdock-agents` |
40
+ | Human approval, approvers, quorum, resume | `permdock-approvals` |
41
+ | Named scopes, memberships, ownership, custom roles | `permdock-tenancy` |
42
+ | ORM queries, generated RLS, relationship graphs, parity | `permdock-data` |
43
+ | Access tokens, API keys, service accounts, share links | `permdock-credentials` |
44
+
45
+ ✓ The skill for the task is loaded, and `permdock-wire` has run first if the app has no factory file.
46
+
47
+ 2. **Look identifiers up, never guess them.** Read the owning page through the docs MCP (`https://permdock.dev/mcp`, tools `search`, `list_pages` and `get_page`), or append `.md` to any `https://permdock.dev/docs/...` URL. Every public name follows the [naming convention](https://permdock.dev/docs/getting-started/naming).
48
+ ✓ Each identifier written into the app appears on a docs page or in `node_modules/permdock`.
49
+ 3. **Read a decision.** `decide()` returns `{ outcome, denials: [{ reason, ... }], alternatives }`. `reason` is one of the closed list on [decisions](https://permdock.dev/docs/concepts/decisions); `alternatives` are permissions on the same resource the subject does hold. HTTP adapters answer RFC 9457 Problem Details ([errors](https://permdock.dev/docs/concepts/errors)); for the format, defer to the `problem-details` spec skill (`npx skills add ScaleDockHQ/scaledock-skills --skill problem-details`).
50
+ ✓ Each denial the user asked about is named by its reason.
51
+ 4. **Explain an unexpected denial.** Run `permdock.explain(permission, data)` in a test or a script. `trace.denies[0]` is the deny that won (give denies a `name` so it reads as a rule), `trace.allows` the allows it overrode, `trace.skipped` the grants passed over and why ([explain](https://permdock.dev/docs/concepts/decisions#explain)). The trace never reaches the decision log. To preview a plan before acting, `simulate([[permission, data], ...])` returns every decision.
52
+ ✓ The cause is a named grant, condition or missing input, not a guess.
53
+ 5. **Check the project.** Run `pnpm exec permdock doctor` (`--json` for machine output). Each finding has a stable `PD0xx` code and a one-line fix ([doctor](https://permdock.dev/docs/cli/doctor)); the topic skills name the codes for their area.
54
+ ✓ `permdock doctor` reports no error.
55
+
56
+ ## Verify before done
57
+
58
+ - [ ] No identifier was written from memory; each one is on a docs page or in the package.
59
+ - [ ] Nothing reads a subject, tenant, membership or approval token from model output, a request body or an unsigned header.
60
+ - [ ] `policy.ts` is imported only from server code.
61
+ - [ ] The topic skill used for the task has its Verify list passing.
62
+
63
+ ## Reference index
64
+
65
+ - Skills: `permdock-wire`, `permdock-audit`, `permdock-agents`, `permdock-approvals`, `permdock-tenancy`, `permdock-data`, `permdock-credentials`, all from `npx skills add ScaleDockHQ/PermDock --skill <name>`.
66
+ - Docs: [for AI agents](https://permdock.dev/docs/for-ai-agents), [naming](https://permdock.dev/docs/getting-started/naming), [policies](https://permdock.dev/docs/concepts/policies), [decisions](https://permdock.dev/docs/concepts/decisions), [threat model](https://permdock.dev/docs/security/threat-model), [doctor](https://permdock.dev/docs/cli/doctor), `https://permdock.dev/llms.txt`.
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: permdock-agents
3
+ description: Guards AI agent tool calls with PermDock subjects, actors and delegation. Use when wiring tool maps in permdock/ai-sdk, permdock/claude-agent, permdock/openai, permdock/eve or permdock/mcp, separating the user (principal) from the agent (actor), declaring a delegation option or policy delegations, publishing an A2A Agent Card with permdock/a2a, registering WebMCP tools with permdock/webmcp, verifying Web Bot Auth signers as actors, or when agent calls are denied with no-delegation or not-delegated.
4
+ license: MIT
5
+ metadata:
6
+ author: ScaleDockHQ
7
+ homepage: https://permdock.dev/docs/security/delegation
8
+ repository: https://github.com/ScaleDockHQ/permdock
9
+ ---
10
+
11
+ # PermDock agents
12
+
13
+ An agent call has a principal (the user whose grants are evaluated), an actor (the agent making the call) and a delegation (what the user handed over). The decision is the principal's grants intersected with the delegation ([delegation](https://permdock.dev/docs/security/delegation)). Set up `permissions.ts`, `policy.ts` and the factory first with the `permdock-wire` skill (`npx skills add ScaleDockHQ/PermDock --skill permdock-wire`).
14
+
15
+ ## Inputs (find out, or ask before starting)
16
+
17
+ - Runtimes in use: AI SDK, Claude Agent SDK, OpenAI Agents SDK, Eve, an MCP server, an A2A agent, WebMCP tools in a web page, signed bot traffic over HTTP.
18
+ - Where the principal comes from: the host session, a verified token, the runtime's session (Eve).
19
+ - Where the actor id comes from: runtime context, `authInfo.clientId`, an Agent Card, a request signature.
20
+ - What the user delegates, per call (scopes, `authorizationDetails`, GNAP `access`) or as standing policy ("members let the Eve agent read and update posts").
21
+ - Which tools are destructive or move money.
22
+
23
+ ## Invariants
24
+
25
+ 1. Subject and actor come from the host session or verified transport auth, never from tool arguments, a task body, a header the client sets, or model output.
26
+ 2. An actor with no delegation is denied every check with `no-delegation`. Delegate explicit scopes, never the principal's whole role.
27
+ 3. Delegation only narrows. A policy delegation is a ceiling, a token delegation on the same call must also cover the permission, and a `deny` or an `approval` still applies.
28
+ 4. One permission per tool. An instance action loads its row through `data` from parsed arguments; a collection permission (`list`, `create`) on a handler that reads `args.id` is a bug.
29
+ 5. Tool lists are hints. `capabilityMiddleware`, `guardTools`, MCP list filtering, the A2A extended card, `mayUse` and WebMCP registration hide tools; the server adapter still decides each call.
30
+ 6. A failed Web Bot Auth signature throws `InvalidSignatureError`; it never becomes an anonymous actor.
31
+ 7. Protocol rules come from the spec skills (`npx skills add ScaleDockHQ/scaledock-skills --skill <name>`): `mcp-authorization` for MCP auth, `a2a` for Agent Cards, `webmcp` for page tools, `web-bot-auth` for signatures, `owasp-agentic` for the threat checklist.
32
+
33
+ ## Workflow
34
+
35
+ 1. **Name the three parts per surface.** Write down the principal source, the actor source and the delegation source for each runtime from the Inputs. The adapter table on [delegation](https://permdock.dev/docs/security/delegation#how-adapters-fill-actor-and-delegation) shows what each adapter fills itself (MCP and A2A read token scopes; in-process runtimes take a `delegation` option).
36
+ ✓ Every surface has all three, and none reads from model-controlled input.
37
+ 2. **Map the tools.** Use the runtime's `createPermDock` with `subject`, `actor` and a `tools` map, and pass the returned hook to the runtime. -> [references/runtimes.md](references/runtimes.md)
38
+ ✓ Every tool the agent can call has a `permission`, and every instance permission has a `data` loader that parses its arguments.
39
+ 3. **Delegate.** Per call, return `{ scopes: [permissions.post.update.scope] }` (or `authorizationDetails`) from the `delegation` option. As standing policy, declare it once on the policy:
40
+
41
+ ```ts
42
+ definePolicy(permissions, {
43
+ roles: [member],
44
+ delegations: [
45
+ {
46
+ from: roles.member,
47
+ to: actor("eve"),
48
+ permissions: [permissions.post.read, permissions.post.update],
49
+ },
50
+ ],
51
+ subject,
52
+ });
53
+ ```
54
+
55
+ `from` takes a role, `authenticated()`, a plan or `assurance()`. `to` is an actor kind, or `{ kind, id }` for one agent. A permission outside the ceiling is denied with `not-delegated`.
56
+ ✓ The agent is granted a delegated tool, and denied with `not-delegated` or `no-delegation` for anything else.
57
+
58
+ 4. **Gate destructive tools.** Put `approval: { by }` on each destructive or money-moving grant and pass a `store` to the adapter. Follow the `permdock-approvals` skill (`npx skills add ScaleDockHQ/PermDock --skill permdock-approvals`).
59
+ ✓ A destructive tool returns the runtime's approval outcome instead of running.
60
+ 5. **Wire the agent-facing surfaces.** A2A: serve `agentCard()` publicly, `extendedAgentCard(auth)` behind auth, and `protectSkill` on the task endpoint. WebMCP: `registerTools` from a snapshot, with the server re-checking. Web Bot Auth: `webBotAuth: (request) => verifyWebBotAuth(request, { verify: true, keys })` on the HTTP adapter. -> [references/runtimes.md](references/runtimes.md)
61
+ ✓ Each surface passes the Verify list of its spec skill.
62
+ 6. **Test.** Add scenario tests with `permdock/testing` for one delegated grant, one `not-delegated` denial and one approval per destructive tool ([scenario testing](https://permdock.dev/docs/guides/scenario-testing)). Then review with the `permdock-audit` skill, which reports ASI02 and ASI03 per adapter.
63
+ ✓ The tests pass and the audit has no blocker.
64
+
65
+ ## Verify before done
66
+
67
+ - [ ] No `subject`, `actor`, tenant or approval token is read from tool arguments, a task body or model output.
68
+ - [ ] Every in-process agent adapter sets `delegation`, or a policy `delegations` entry covers its actor kind.
69
+ - [ ] Every instance tool has a `data` loader; no collection permission guards a handler that reads one row.
70
+ - [ ] MCP servers set `resource` to their own URL; Claude Agent `mcp__` tools come only from `mcpSources`.
71
+ - [ ] WebMCP and capability filtering are backed by a server-side check on the same permission.
72
+ - [ ] Every destructive tool returns `approval-required`, and the `permdock-approvals` Verify list passes.
73
+
74
+ ## Reference index
75
+
76
+ - [references/runtimes.md](references/runtimes.md): factory shapes and outcome mapping for AI SDK, Claude Agent SDK, Eve, OpenAI Agents SDK, MCP, A2A, WebMCP, Web Bot Auth and `permdock/terminal`.
77
+ - Docs: [delegation](https://permdock.dev/docs/security/delegation), [subject](https://permdock.dev/docs/concepts/subject), [OWASP Agentic mapping](https://permdock.dev/docs/security/owasp-agentic), adapter pages under `https://permdock.dev/docs/adapters/<name>`.