permdock 0.18.0 → 0.19.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 (311) hide show
  1. package/dist/a2a/index.d.ts +4 -4
  2. package/dist/a2a/index.js +6 -6
  3. package/dist/{adoption-scan-CxExBYSJ.js → adoption-scan-C_VQ-J2f.js} +1 -1
  4. package/dist/agent/index.d.ts +2 -2
  5. package/dist/agent/index.js +1 -1
  6. package/dist/ai-sdk/index.d.ts +3 -3
  7. package/dist/ai-sdk/index.js +4 -4
  8. package/dist/{approval-normalize-CUjgSsOl.js → approval-normalize-hlfO9BJv.js} +8 -1
  9. package/dist/{approval-policies-oNnckT12.d.ts → approval-policies-CYqdqAob.d.ts} +1 -1
  10. package/dist/{approval-prompt-Bg7gDSqd.d.ts → approval-prompt-BxYbwOAU.d.ts} +1 -1
  11. package/dist/approvals/index.d.ts +4 -4
  12. package/dist/approvals/index.js +3 -3
  13. package/dist/{approvals-DGId_hgJ.js → approvals-CuXILe52.js} +9 -6
  14. package/dist/{arazzo--riLuGY0.js → arazzo-4vfaXj0U.js} +2 -2
  15. package/dist/{arazzo-CEDbb-uM.js → arazzo-Dc969CA2.js} +1 -1
  16. package/dist/astro/index.d.ts +4 -4
  17. package/dist/astro/index.js +2 -2
  18. package/dist/{audience-B4YR9UpV.js → audience-GCXRRAeZ.js} +1 -1
  19. package/dist/authzen/index.d.ts +5 -5
  20. package/dist/authzen/index.js +3 -3
  21. package/dist/{automation-Bfa_wD1h.d.ts → automation-BJiJT_Xr.d.ts} +1 -1
  22. package/dist/better-auth/index.d.ts +1 -1
  23. package/dist/better-auth/index.js +1 -1
  24. package/dist/better-supabase/index.d.ts +20 -17
  25. package/dist/better-supabase/index.js +10 -10
  26. package/dist/{better-supabase-BJtQ-kNf.js → better-supabase-ayun1IKE.js} +38 -4
  27. package/dist/{bind-B4pMH9bm.js → bind-BnKPWRrE.js} +4 -4
  28. package/dist/{bind-DR6ku3A9.d.ts → bind-SpRxR213.d.ts} +7 -7
  29. package/dist/{body-CJQwYVa8.js → body-C9JbIoqb.js} +1 -1
  30. package/dist/{build-instance-BFMFQdE_.js → build-instance-DrIbZVnm.js} +1 -1
  31. package/dist/{capability-BZ_veK9o.d.ts → capability-Ci2S8Cdu.d.ts} +1 -1
  32. package/dist/{casbin-bKC1FpEx.js → casbin-C1TQqWkK.js} +1 -1
  33. package/dist/{casbin-DCQHkkyj.js → casbin-ChbpgfNR.js} +1 -1
  34. package/dist/catalog/index.d.ts +5 -5
  35. package/dist/catalog/index.js +5 -5
  36. package/dist/catalog-BTPySmbp.js +1 -0
  37. package/dist/{catalog-zzNuR3sY.js → catalog-DjDc87R2.js} +1 -1
  38. package/dist/{catalog-doc-C4DGfJCO.js → catalog-doc-nrgfbh8I.js} +2 -1
  39. package/dist/{catalog-D1fw8qif.js → catalog-s0waIrfY.js} +2 -2
  40. package/dist/{challenge-B2O2OLEk.js → challenge-D57I5G1k.js} +1 -1
  41. package/dist/chat/index.d.ts +1 -1
  42. package/dist/chat/index.js +2 -2
  43. package/dist/chat-sdk/index.d.ts +3 -3
  44. package/dist/claude-agent/index.d.ts +3 -3
  45. package/dist/claude-agent/index.js +2 -2
  46. package/dist/clerk/index.d.ts +2 -2
  47. package/dist/cli/bin.js +1 -1
  48. package/dist/cli/index.d.ts +5 -5
  49. package/dist/cli/index.js +3 -3
  50. package/dist/{client-CH7vzSAY.d.ts → client-JK504UCq.d.ts} +15 -2
  51. package/dist/cloud/index.d.ts +8 -8
  52. package/dist/cloud/index.js +2 -2
  53. package/dist/{cloud-C0vXBmLG.js → cloud-Dgj4FiEG.js} +2 -2
  54. package/dist/{codemod-C-L0w-u7.js → codemod-DN_fBt43.js} +2 -2
  55. package/dist/{codemod-eYI1FbeJ.js → codemod-WWxwgM77.js} +1 -1
  56. package/dist/{collect-CU85z6Ta.js → collect-DMQ6Sxr6.js} +2 -2
  57. package/dist/{collect-D878zLDP.js → collect-DN_x7hvV.js} +1 -1
  58. package/dist/collect-eSTXOZDC.js +1 -0
  59. package/dist/compile/index.d.ts +1 -1
  60. package/dist/{compile-DBm0ub4p.d.ts → compile-RaRUQhmD.d.ts} +2 -2
  61. package/dist/{completion-Dauc6pVT.js → completion-DnmUvCw0.js} +1 -1
  62. package/dist/{config-DWp2PucY.js → config-CmuEoob8.js} +1 -1
  63. package/dist/{config-COHmivz9.js → config-D2oXUwos.js} +8 -5
  64. package/dist/{config-report-DKpFm5ID.js → config-report-BVm8Dhbj.js} +2 -2
  65. package/dist/{config-shape-tsxHx71E.js → config-shape-D9paLhEX.js} +5 -1
  66. package/dist/{connection-B72dg5Q2.js → connection-QFsv-kbh.js} +1 -1
  67. package/dist/{context-DeammvFl.js → context-YhyXyqBI.js} +3 -2
  68. package/dist/convex/index.d.ts +4 -4
  69. package/dist/convex/index.js +3 -3
  70. package/dist/{core-D87h2kpR.d.ts → core-DNRWXyj4.d.ts} +2 -2
  71. package/dist/{core-B8sLve3z.js → core-ZIWZBi6-.js} +5 -5
  72. package/dist/{create-BzwjZuRS.d.ts → create-0B_bjJc-.d.ts} +7 -7
  73. package/dist/{create-BrQXL-Wt.d.ts → create-BECB6fns.d.ts} +6 -6
  74. package/dist/{create-C-tm3KIF.js → create-CAZyXZFC.js} +4 -4
  75. package/dist/{create-3A7J9KRR.js → create-CegYmYHu.js} +69 -29
  76. package/dist/{create-CtoT1lIQ.d.ts → create-DJ_5REgN.d.ts} +4 -4
  77. package/dist/decide-set-DXEPepY1.js +100 -0
  78. package/dist/{delegation-input-FTxMK3ji.js → delegation-input-DcXhiMkf.js} +1 -1
  79. package/dist/delivery/index.d.ts +4 -4
  80. package/dist/delivery/index.js +1 -1
  81. package/dist/{denied-text-DlIxt8fh.d.ts → denied-text-CF-2h8Vz.d.ts} +1 -1
  82. package/dist/{describe-BKtC_8PG.d.ts → describe-DyN-HX6o.d.ts} +1 -1
  83. package/dist/{diff-BnNHqtHj.js → diff-BOU7sSnv.js} +4 -4
  84. package/dist/{diff-CBCzOTWM.js → diff-BrmvcPXk.js} +1 -1
  85. package/dist/{doctor-CkYKCuX7.js → doctor-BhhNMkU8.js} +242 -65
  86. package/dist/{doctor-xUpR5rXg.js → doctor-CL1OigyD.js} +15 -5
  87. package/dist/drizzle/index.d.ts +3 -3
  88. package/dist/elysia/index.d.ts +4 -4
  89. package/dist/elysia/index.js +4 -4
  90. package/dist/{errors-TpzkEKgJ.d.ts → errors-POWcCXy7.d.ts} +1 -1
  91. package/dist/{errors-B6R_lg2a.js → errors-ynga1EQy.js} +1 -1
  92. package/dist/{evaluate-Czbj7thS.js → evaluate-CrKkjgXS.js} +2 -2
  93. package/dist/{evaluations-CisTTURl.d.ts → evaluations--rkKhMqY.d.ts} +3 -3
  94. package/dist/{evaluations-h3KoJAPa.js → evaluations-CNMVJVD6.js} +3 -3
  95. package/dist/eve/index.d.ts +4 -4
  96. package/dist/eve/index.js +3 -3
  97. package/dist/express/index.d.ts +4 -4
  98. package/dist/express/index.js +3 -3
  99. package/dist/fastify/index.d.ts +4 -4
  100. package/dist/fastify/index.js +3 -3
  101. package/dist/{fetch-adapter-DH-NJPbL.js → fetch-adapter-Bm1iZolz.js} +3 -3
  102. package/dist/{fetch-adapter-BdmfnbJM.d.ts → fetch-adapter-Bq4AB3W2.d.ts} +2 -2
  103. package/dist/{fields-CrjL6A49.js → fields-COvJbUva.js} +1 -1
  104. package/dist/{from-snapshot-DMlSSo9b.js → from-snapshot-DHnb8Fh4.js} +2 -2
  105. package/dist/{gen-mf-MRwVr.js → gen-D0NqzeOP.js} +2 -2
  106. package/dist/{gen-BEIN-DRM.js → gen-DonXr9Hg.js} +1 -1
  107. package/dist/h3/index.d.ts +4 -4
  108. package/dist/h3/index.js +3 -3
  109. package/dist/{helpers-DmqGy63f.js → helpers-D-MXwkOF.js} +28 -4
  110. package/dist/hono/index.d.ts +4 -4
  111. package/dist/hono/index.js +5 -5
  112. package/dist/{hosted-BFNXwcjd.d.ts → hosted-H1xp5Dfw.d.ts} +1 -1
  113. package/dist/{hosted-waouw2V-.js → hosted-iOGBI_ER.js} +4 -3
  114. package/dist/{import-C1XXpG_m.js → import-C8ffNykt.js} +2 -2
  115. package/dist/{import-DObwEota.js → import-DNaFHm53.js} +1 -1
  116. package/dist/{index-CVGio3cH.d.ts → index-B9-ZXNa-.d.ts} +4 -4
  117. package/dist/{index-BhnOOnp9.d.ts → index-C2pmTzFx.d.ts} +2 -2
  118. package/dist/{index-Dfv9Toct.d.ts → index-C5Tfpjex.d.ts} +1 -1
  119. package/dist/{index-CdUTE6qd.d.ts → index-Cm6mHTZ-.d.ts} +16 -10
  120. package/dist/{index-rFp6X_QP.d.ts → index-DLlWORcK.d.ts} +5 -5
  121. package/dist/{index-CdMOd-GY.d.ts → index-DZnpRB0q.d.ts} +24 -6
  122. package/dist/index.d.ts +17 -17
  123. package/dist/index.js +15 -15
  124. package/dist/{init-DS3PEsCG.js → init-4aRjat-S.js} +3 -3
  125. package/dist/{init-CNJ8lLjo.js → init-QfBfkrGu.js} +1 -1
  126. package/dist/{instance-options-2sFGSdsf.d.ts → instance-options-D6hyIKJF.d.ts} +1 -1
  127. package/dist/{instance-snapshot-BWa71my8.js → instance-snapshot-DXxcizAb.js} +3 -3
  128. package/dist/jwt/index.d.ts +4 -4
  129. package/dist/{kernel-30Z2zM_d.js → kernel-B2UCK36Z.js} +7 -7
  130. package/dist/kysely/index.d.ts +3 -3
  131. package/dist/{login-DUVzBLh7.js → login-Cg1la2yJ.js} +3 -3
  132. package/dist/{login-BgK5Jloo.js → login-lPtJIjbO.js} +1 -1
  133. package/dist/{manifest-wclLWBVH.js → manifest-CDhdXgf6.js} +38 -37
  134. package/dist/{map-error-BH16Ah8P.js → map-error-EOhahOVA.js} +3 -3
  135. package/dist/mcp/index.d.ts +57 -17
  136. package/dist/mcp/index.js +199 -53
  137. package/dist/{module-values-B8tNIxdd.js → module-values-BYuNtdK5.js} +1 -1
  138. package/dist/nest/index.d.ts +4 -4
  139. package/dist/nest/index.js +5 -5
  140. package/dist/next/index.d.ts +12 -12
  141. package/dist/next/index.js +8 -8
  142. package/dist/next/plugin.d.ts +1 -1
  143. package/dist/next/plugin.js +1 -1
  144. package/dist/node/index.d.ts +4 -4
  145. package/dist/node/index.js +2 -2
  146. package/dist/openai/index.d.ts +4 -4
  147. package/dist/openai/index.js +3 -3
  148. package/dist/openapi/index.d.ts +2 -2
  149. package/dist/{openapi-C4gFqeRz.js → openapi-C3BIVLTd.js} +2 -2
  150. package/dist/{openapi-zMEB9qxn.js → openapi-Cr0B3p2h.js} +2 -2
  151. package/dist/orpc/index.d.ts +21 -17
  152. package/dist/orpc/index.js +18 -11
  153. package/dist/otel/index.d.ts +3 -3
  154. package/dist/{output-BFWLER4r.js → output-DYq_o2dM.js} +1 -1
  155. package/dist/{ownership-D-mIt-w0.js → ownership-CrmMERZv.js} +1 -1
  156. package/dist/{parse-UTC-sDrt.js → parse-CXTT7hBq.js} +1 -1
  157. package/dist/{parse-local-manifest-DvjTQNuO.d.ts → parse-local-manifest-CQjRmzrw.d.ts} +1 -1
  158. package/dist/{parse-local-manifest-CxcSMQgl.js → parse-local-manifest-Ce2N-Opr.js} +1 -1
  159. package/dist/pdp/index.d.ts +3 -3
  160. package/dist/pdp/index.js +2 -2
  161. package/dist/{permdock-ffY4CMd9.d.ts → permdock-B45vPQb4.d.ts} +4 -4
  162. package/dist/{permdock-D-_WrdKu.js → permdock-DeOfonuG.js} +6 -6
  163. package/dist/{permissions-B3ggI88M.js → permissions-Rk9_Gm04.js} +1 -1
  164. package/dist/{policy-cV_wwPb8.js → policy-DTmkP72P.js} +2 -2
  165. package/dist/{policy-from-catalog-B68hGC0S.js → policy-from-catalog-Cljh_B5H.js} +6 -6
  166. package/dist/{policy-BtKSApSt.d.ts → policy-re2Oag8s.d.ts} +1 -1
  167. package/dist/{policy-types-D-GwfQTc.d.ts → policy-types-Ky7P23CP.d.ts} +24 -2
  168. package/dist/{postgrest-D84p5dbA.d.ts → postgrest-pwxeaeOW.d.ts} +1 -1
  169. package/dist/powersync-B96MUB_Q.js +1 -0
  170. package/dist/{powersync-9PYOE1wt.js → powersync-BoqBik-G.js} +77 -38
  171. package/dist/{powersync-DStC_g0B.js → powersync-PKC4yT62.js} +2 -2
  172. package/dist/prisma/index.d.ts +2 -2
  173. package/dist/{problem-BVLHFK33.js → problem-BWP1l86g.js} +8 -7
  174. package/dist/{protected-action-B40tU3yP.js → protected-action-CD1HXwQK.js} +2 -2
  175. package/dist/{protected-action-Ds_EUY8B.d.ts → protected-action-DHPqBLhz.d.ts} +5 -5
  176. package/dist/{provider-OtnIiFWm.d.ts → provider-C-CbGEii.d.ts} +1 -1
  177. package/dist/{provider-CY4TSSJo.js → provider-qESIf_C0.js} +5 -2
  178. package/dist/{provider-store-BQP_pp8s.js → provider-store-BTHGJH9j.js} +3 -2
  179. package/dist/pull-BjdsS9x1.js +1 -0
  180. package/dist/{pull-DLP4I1Kl.js → pull-FG0Tf8aF.js} +3 -3
  181. package/dist/{push-BSb8j1EW.js → push-CI5G7lRS.js} +3 -3
  182. package/dist/{pushed-policy-Ck3FZcoy.d.ts → pushed-policy-B94r9DlN.d.ts} +1 -1
  183. package/dist/{pushed-policy-BecMsTtM.js → pushed-policy-DftSiyD3.js} +1 -1
  184. package/dist/react/index.d.ts +6 -6
  185. package/dist/react/index.js +3 -3
  186. package/dist/react/provider-client.d.ts +1 -1
  187. package/dist/react/provider-client.js +1 -1
  188. package/dist/react-native/index.d.ts +28 -14
  189. package/dist/react-native/index.js +57 -37
  190. package/dist/{replay-E5X9E1lC.d.ts → replay-BqmXcP7x.d.ts} +1 -1
  191. package/dist/{request-context-DM6_jY1n.js → request-context-uvaevbBu.js} +1 -1
  192. package/dist/resend/index.d.ts +4 -4
  193. package/dist/resend/index.js +2 -2
  194. package/dist/{resolve-names-CBl4r4_r.js → resolve-names-Dg8560iu.js} +2 -2
  195. package/dist/{rls-DGBL-jDY.js → rls-CJbWbxXv.js} +19 -13
  196. package/dist/{rls-pAHGYgTb.js → rls-DJSczevJ.js} +1 -1
  197. package/dist/{role-builder-CMW4wWzn.js → role-builder-C_2kWB_x.js} +1 -1
  198. package/dist/rpc-D7cDHIVE.d.ts +22 -0
  199. package/dist/{rpc-KwX_Jcxz.js → rpc-m5hPklf-.js} +16 -6
  200. package/dist/run-4m-TyVTD.js +1 -0
  201. package/dist/{run-B7lv3NuK.js → run-BigMDvGR.js} +3 -3
  202. package/dist/{run-ticket-DPaD27_r.d.ts → run-ticket-DRA3POCY.d.ts} +2 -2
  203. package/dist/{saas-B8H1MsQ3.js → saas-BHeoBqbW.js} +4 -4
  204. package/dist/{scan-0r3OZqqK.js → scan-BKLwCSVV.js} +1 -1
  205. package/dist/{schema-CuX70xgH.js → schema-BlnU_TzE.js} +4 -0
  206. package/dist/{schema-B_9tXrbG.js → schema-CLuBlCCr.js} +1 -1
  207. package/dist/scim/index.d.ts +1 -1
  208. package/dist/server/index.d.ts +10 -10
  209. package/dist/server/index.js +5 -5
  210. package/dist/{server-types-3OnXjZ2D.d.ts → server-types-CwpJe664.d.ts} +31 -13
  211. package/dist/{sink-ogbVkyeo.d.ts → sink-7Lrch8dn.d.ts} +2 -2
  212. package/dist/{skills-B4MPRxQd.js → skills-CyD_3eoi.js} +1 -1
  213. package/dist/{skills-C9sTD70r.js → skills-D42EyC8G.js} +1 -1
  214. package/dist/{snapshot-DN_8J27z.js → snapshot-DHPih65J.js} +2 -1
  215. package/dist/{snapshot-cache-B4YvlGG_.d.ts → snapshot-cache-B9weL8NE.d.ts} +1 -1
  216. package/dist/solid/index.d.ts +5 -5
  217. package/dist/solid/index.js +3 -2
  218. package/dist/solid-start/index.d.ts +4 -4
  219. package/dist/solid-start/index.js +3 -3
  220. package/dist/{sources-xdQShLDU.d.ts → sources-4d3fl7cq.d.ts} +1 -1
  221. package/dist/{src-Brzq_0in.js → src-HDDf9Eum.js} +28 -13
  222. package/dist/ssf/index.d.ts +3 -3
  223. package/dist/ssf/index.js +2 -2
  224. package/dist/{standard-webhooks-BfPaZ6T1.d.ts → standard-webhooks-BGi8pUwo.d.ts} +2 -2
  225. package/dist/{store-DmVqy74I.js → store-CSOsXd5s.js} +8 -6
  226. package/dist/{store-DYeB-_U3.d.ts → store-CjJaZI_g.d.ts} +31 -4
  227. package/dist/{store-options--zWn48PK.js → store-options-CDvoX52-.js} +31 -8
  228. package/dist/{stores-EPul_8MN.d.ts → stores-Cam6GGAV.d.ts} +5 -5
  229. package/dist/{stores-BYFopOm1.js → stores-PpYVQ5yF.js} +1 -1
  230. package/dist/{stream-CDvF0sJm.js → stream-DQ3rbO3J.js} +1 -1
  231. package/dist/supabase/client.d.ts +1 -1
  232. package/dist/supabase/client.js +32 -4
  233. package/dist/supabase/index.d.ts +10 -5
  234. package/dist/supabase/index.js +1 -1
  235. package/dist/supabase/middleware.d.ts +5 -5
  236. package/dist/supabase/middleware.js +5 -5
  237. package/dist/{supabase-BiViJpQ4.js → supabase-CVZuytCC.js} +2 -2
  238. package/dist/{supabase-CogTyJH2.js → supabase-DBuZK2pP.js} +2 -2
  239. package/dist/supabase-hook-2M-EpoRp.js +1 -0
  240. package/dist/{supabase-hook-DX38Hj8h.js → supabase-hook-Btk56XD6.js} +151 -55
  241. package/dist/{supautils-BGf6zRvM.js → supautils-lwXmXPP_.js} +7 -7
  242. package/dist/svelte/index.d.ts +5 -5
  243. package/dist/svelte/index.js +3 -3
  244. package/dist/svelte/runtime.d.ts +3 -3
  245. package/dist/svelte/runtime.js +1 -1
  246. package/dist/svelte/source.d.ts +5 -5
  247. package/dist/svelte/source.js +2 -2
  248. package/dist/sveltekit/index.d.ts +4 -4
  249. package/dist/sveltekit/index.js +2 -2
  250. package/dist/{tables-BfOk0ymL.js → tables-B72q9UFD.js} +1 -1
  251. package/dist/tanstack-start/index.d.ts +4 -4
  252. package/dist/tanstack-start/index.js +2 -2
  253. package/dist/terminal/index.d.ts +5 -5
  254. package/dist/terminal/index.js +4 -4
  255. package/dist/testing/core.d.ts +1 -1
  256. package/dist/testing/core.js +1 -1
  257. package/dist/testing/fixtures/index.d.ts +1 -1
  258. package/dist/testing/fixtures/index.js +1 -1
  259. package/dist/testing/index.d.ts +23 -23
  260. package/dist/testing/index.js +22 -22
  261. package/dist/testing/saas/index.d.ts +3 -3
  262. package/dist/testing/saas/index.js +2 -2
  263. package/dist/testing/saas/permissions.js +1 -1
  264. package/dist/trpc/index.d.ts +15 -8
  265. package/dist/trpc/index.js +23 -19
  266. package/dist/{type-helpers-i1EJ3Eb1.d.ts → type-helpers-CDxxNswo.d.ts} +1 -1
  267. package/dist/{types-CqcsNCaN.d.ts → types--HfnkawU.d.ts} +13 -1
  268. package/dist/{types-NYoj8JBm.d.ts → types-7Vlz1Wi2.d.ts} +1 -0
  269. package/dist/{types-B8qUkGja.d.ts → types-BVn1w_0o.d.ts} +2 -2
  270. package/dist/{types-DmbfLu2p.d.ts → types-BlYPxJDR.d.ts} +9 -4
  271. package/dist/{types-D19MK4t-.d.ts → types-Bwdumeos.d.ts} +3 -3
  272. package/dist/{types-3Y8UpFkF.d.ts → types-BwuNGQRm.d.ts} +68 -4
  273. package/dist/{types-D-JO7lh8.d.ts → types-CChFKY10.d.ts} +5 -5
  274. package/dist/{types-CDVXR6YD.d.ts → types-Do4yihST.d.ts} +1 -1
  275. package/dist/{types-CCEeSCMB.d.ts → types-Do8qBcRO.d.ts} +3 -3
  276. package/dist/{types-o1vu6Ks3.d.ts → types-OLSfBLa5.d.ts} +4 -4
  277. package/dist/{types-DGf_cpKF.d.ts → types-g0Vk9k2c.d.ts} +2 -2
  278. package/dist/{types-Ck1KOfug.d.ts → types-oaqeYKQu.d.ts} +2 -2
  279. package/dist/unplugin/index.d.ts +1 -1
  280. package/dist/unplugin/index.js +1 -1
  281. package/dist/{usage-DYtRVkcN.js → usage-BLhhEPcZ.js} +1 -1
  282. package/dist/{usage-DC0UKe6C.js → usage-C-wta3rx.js} +4 -4
  283. package/dist/usage-Csc_ZRd0.js +1 -0
  284. package/dist/{validation-error-Dx8PipbO.d.ts → validation-error-AhCHeeff.d.ts} +1 -1
  285. package/dist/{verify-Bpj0hauG.js → verify-CaaZlnP5.js} +78 -57
  286. package/dist/{version-cache-DzNKWiI6.d.ts → version-cache-Ddvrfn1R.d.ts} +1 -1
  287. package/dist/vue/index.d.ts +5 -5
  288. package/dist/vue/index.js +2 -2
  289. package/dist/{waiter-NK_UuZbb.d.ts → waiter-CROiWRIP.d.ts} +2 -2
  290. package/dist/watch-CS69ftMP.js +1 -0
  291. package/dist/{watch-CBHADqBH.js → watch-Dz2LNM1R.js} +2 -2
  292. package/dist/webmcp/index.d.ts +1 -1
  293. package/dist/{where-scope-BKrqUDVk.js → where-scope-BAyOsPQW.js} +1 -1
  294. package/dist/{who-can-KhVWMxtf.js → who-can-jPfTABf-.js} +1 -1
  295. package/dist/workflow/index.d.ts +3 -3
  296. package/dist/workflow/index.js +2 -2
  297. package/dist/workflow-sdk/index.d.ts +4 -4
  298. package/dist/{wrap-BHGA-SMM.d.ts → wrap-C-4o-Dpy.d.ts} +2 -2
  299. package/package.json +1 -1
  300. package/schemas/catalog-v1.json +8 -0
  301. package/skills/permdock-agents/references/runtimes.md +2 -2
  302. package/skills/permdock-wire/references/adapters.md +1 -1
  303. package/dist/catalog-Caqhbdix.js +0 -1
  304. package/dist/collect-KCtOigxx.js +0 -1
  305. package/dist/powersync-xNRlC4jN.js +0 -1
  306. package/dist/pull-UBjDnf4b.js +0 -1
  307. package/dist/run-UPbacxPg.js +0 -1
  308. package/dist/stream-W2RuUYly.d.ts +0 -13
  309. package/dist/supabase-hook-BN46IrVI.js +0 -1
  310. package/dist/usage-Cl5eb-e1.js +0 -1
  311. package/dist/watch-OYwAPCzx.js +0 -1
@@ -5,43 +5,45 @@ import { u as isPrincipalRelation } from "./resource-relations-8-pCScBO.js";
5
5
  import { t as canonicalJson } from "./canonical-json-DwilZ1iB.js";
6
6
  import { c as rootScope, d as scopeList, o as normalizeMemberships, s as resolveScope } from "./scopes-BSdYaGHs.js";
7
7
  import { o as flattenGrantee } from "./grantee-Dke-9rd1.js";
8
- import { u as separationConflicts } from "./policy-cV_wwPb8.js";
9
- import { T as validateCustomRole } from "./evaluate-Czbj7thS.js";
8
+ import { u as separationConflicts } from "./policy-DTmkP72P.js";
9
+ import { T as validateCustomRole } from "./evaluate-CrKkjgXS.js";
10
10
  import { s as parseCredential } from "./credential-B3Hj4puZ.js";
11
- import { a as describeError } from "./errors-BhRkoNS7.js";
11
+ import { a as describeError, i as configError } from "./errors-BhRkoNS7.js";
12
12
  import { t as policyRowConditionKeys } from "./row-conditions-BAGHOmVq.js";
13
13
  import { a as rel, n as doctorSrcPath, o as sqlFiles, r as listSourceFiles } from "./files-BSjrtIHw.js";
14
14
  import { i as DOCTOR_REPORT_SCHEMA } from "./version-DMQ0dnN5.js";
15
- import { c as jsonSchemaOf, i as catalogOAuthScopes } from "./catalog-doc-C4DGfJCO.js";
15
+ import { c as jsonSchemaOf, i as catalogOAuthScopes } from "./catalog-doc-nrgfbh8I.js";
16
16
  import { a as loadModule, i as loadConfiguredPolicy, n as asPolicy, s as pickNamed } from "./load-BaEamml-.js";
17
17
  import { t as catalogPath } from "./catalog-path-CnI0XTFK.js";
18
- import { r as runCollect } from "./collect-D878zLDP.js";
18
+ import { r as runCollect } from "./collect-DN_x7hvV.js";
19
19
  import { n as supabaseTenantClaim } from "./budget-BBCPDOGP.js";
20
- import { a as filesOf, i as betterSupabaseTenantClaim, n as betterSupabaseConfig, o as nodeFiles, r as betterSupabaseDefaults, s as readJson, t as betterSupabaseAuthzVersions } from "./better-supabase-BJtQ-kNf.js";
20
+ import { a as workspaceDirs, c as readJson, i as betterSupabaseTenantClaim, n as betterSupabaseConfig, o as filesOf, r as betterSupabaseDefaults, s as nodeFiles, t as betterSupabaseAuthzVersions } from "./better-supabase-ayun1IKE.js";
21
21
  import { i as qualifySqlTable, s as quoteSqlLiteral } from "./sql-0WjxIp9g.js";
22
22
  import { a as scopeMembershipTable } from "./compile-B_oJqmIg.js";
23
23
  import { d as keptKeys, r as PERMDOCK_SCHEMA } from "./sources-C4vkzZJV.js";
24
- import { t as parseCatalog } from "./parse-UTC-sDrt.js";
24
+ import { t as parseCatalog } from "./parse-CXTT7hBq.js";
25
25
  import { n as activeTenantMismatch } from "./active-tenant-DVee32-T.js";
26
26
  import "./markers-BeHZ4x9Q.js";
27
27
  import { t as didYouMean } from "./args-iafbHiXn.js";
28
- import { t as DOCS_BASE } from "./manifest-wclLWBVH.js";
28
+ import { t as DOCS_BASE } from "./manifest-CDhdXgf6.js";
29
29
  import { t as createStyle } from "./style-Ds11Hmk4.js";
30
- import { a as nonEmptyOr, r as findingOf } from "./output-BFWLER4r.js";
31
- import { i as runSkillsInstall } from "./skills-B4MPRxQd.js";
30
+ import { a as nonEmptyOr, r as findingOf } from "./output-DYq_o2dM.js";
31
+ import { i as runSkillsInstall } from "./skills-CyD_3eoi.js";
32
32
  import { n as MIGRATION_DIRS, t as DEFAULT_SENSITIVE_ACTIONS } from "./constants-DcJABbLW.js";
33
33
  import { l as partPath } from "./output-files-CM0BnH05.js";
34
- import { _ as readSupabaseConfig, a as supabaseHookManifest, c as activeSource, d as resolveSchemas, g as pd074, h as pd045, l as pd039, m as attrsPlan, n as hookOut, v as supabaseConfig } from "./supabase-hook-DX38Hj8h.js";
35
- import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-BfOk0ymL.js";
36
- import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-D-mIt-w0.js";
34
+ import { n as pgConnector } from "./pg-Ddxsd5ZB.js";
35
+ import { _ as readSupabaseConfig, a as supabaseHookManifest, c as activeSource, d as resolveSchemas, g as pd074, h as pd045, l as pd039, m as attrsPlan, n as hookOut, v as supabaseConfig } from "./supabase-hook-Btk56XD6.js";
36
+ import { O as quoteIdent, t as CUSTOM_ROLES } from "./shared-DyYVEjKC.js";
37
+ import { G as byKey, Q as graphSqlName, n as tableNameOf, o as graphPlan, r as tableNames } from "./tables-B72q9UFD.js";
38
+ import { a as guardedTables, p as contextRefs, r as unsatisfiedKinds, t as ownershipRules } from "./ownership-CrmMERZv.js";
37
39
  import { t as membershipSourcesOf } from "./sources-qoIJQrJv.js";
38
40
  import { i as group, n as membershipColumns, o as sqlStatements, r as tableKey } from "./deciding-columns-NB4wcyBf.js";
39
- import { t as FIELD_VIEWS } from "./fields-CrjL6A49.js";
40
- import { t as resolveNames } from "./resolve-names-CBl4r4_r.js";
41
- import { a as pd010, c as pd014, d as pd038, f as pd041, i as pd008, l as pd015, n as pd001, o as pd011, p as pd057, r as pd007, s as pd013, t as runUsage, u as pd036 } from "./usage-DC0UKe6C.js";
42
- import { d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies } from "./verify-Bpj0hauG.js";
43
- import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-9PYOE1wt.js";
44
- import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-BGf6zRvM.js";
41
+ import { t as FIELD_VIEWS } from "./fields-COvJbUva.js";
42
+ import { t as resolveNames } from "./resolve-names-Dg8560iu.js";
43
+ import { S as splitIgnored, d as rowConditionMessage, f as commandFor, m as tableFor, p as compileGrants, s as ROW_CONDITION_FIX, u as helperTablePolicies, x as parseIgnores } from "./verify-CaaZlnP5.js";
44
+ import { a as pd010, c as pd014, d as pd038, f as pd041, i as pd008, l as pd015, n as pd001, o as pd011, p as pd057, r as pd007, s as pd013, t as runUsage, u as pd036 } from "./usage-C-wta3rx.js";
45
+ import { a as streamOf, i as scopeSourcesOf, r as staleFiles, t as powersyncFiles } from "./powersync-BoqBik-G.js";
46
+ import { a as buildContext, n as generateOptions, r as isRefusal, s as inheritTargets, t as supautilsRejections } from "./supautils-lwXmXPP_.js";
45
47
  import { n as legacyHelperNames, r as retirePlan, t as legacyHelperCalls } from "./retire-B2xffQgY.js";
46
48
  import { basename, dirname, join, resolve } from "node:path";
47
49
  import { pathToFileURL } from "node:url";
@@ -68,6 +70,7 @@ function loadProject(input) {
68
70
  files,
69
71
  now: input.now,
70
72
  io: input.io,
73
+ ...input.database === void 0 ? {} : { database: input.database },
71
74
  sources: () => {
72
75
  sources ??= listSourceFiles(cwd, doctorSrcPath(config)).map((file) => ({
73
76
  file: rel(cwd, file),
@@ -201,6 +204,52 @@ async function pd064(input) {
201
204
  }));
202
205
  }
203
206
  //#endregion
207
+ //#region src/cli/doctor/baseline.ts
208
+ const LOCATION = /^([^\s:]+\.[A-Za-z0-9]+):(\d+)\b/u;
209
+ /**
210
+ * The finding's target: the one its check set, else the `file:line` its message
211
+ * opens with, else the message's first word when it is a path or a key, else
212
+ * `project`.
213
+ */
214
+ function targetOf(finding) {
215
+ if (finding.target !== void 0) return finding.target;
216
+ const match = LOCATION.exec(finding.message);
217
+ if (match?.[0] !== void 0) return match[0];
218
+ const first = finding.message.split(/\s+/u)[0] ?? "";
219
+ return /[./]/u.test(first) ? first : "project";
220
+ }
221
+ function reported(finding) {
222
+ const target = targetOf(finding);
223
+ return {
224
+ ...finding,
225
+ target,
226
+ id: `${finding.code}:${target}`
227
+ };
228
+ }
229
+ /**
230
+ * Splits `findings` by `doctor.ignore` and `--ignore`. An entry that matches no
231
+ * finding comes back as an `ignore-stale` warning so the baseline can shrink.
232
+ */
233
+ function applyDoctorIgnores(findings, config, flags) {
234
+ const ignores = parseIgnores(config.doctor?.ignore, "doctor.ignore", flags);
235
+ const split = splitIgnored(findings, (item) => item.id, ignores);
236
+ const stale = split.stale.filter((entry) => entry.reason !== "--ignore").map((entry) => reported({
237
+ code: "ignore-stale",
238
+ severity: "warning",
239
+ target: entry.id,
240
+ message: `ignore entry ${entry.id} matches no finding`,
241
+ fix: "remove it from doctor.ignore"
242
+ }));
243
+ return {
244
+ findings: [...split.kept, ...stale],
245
+ ignored: split.ignored.map((entry) => ({
246
+ id: entry.id,
247
+ reason: entry.reason,
248
+ message: entry.item.message
249
+ }))
250
+ };
251
+ }
252
+ //#endregion
204
253
  //#region src/cli/doctor/better-supabase.ts
205
254
  function activeTenantOf(config) {
206
255
  const blocks = config["blocks"];
@@ -786,6 +835,77 @@ async function pd025(input) {
786
835
  return findings;
787
836
  }
788
837
  //#endregion
838
+ //#region src/cli/doctor/hook-role.ts
839
+ /** A user id no account has: the hook still reads every table it reads. */
840
+ const NOBODY = "00000000-0000-0000-0000-000000000000";
841
+ function eventsOf(project) {
842
+ const nobody = {
843
+ label: "a user with no rows",
844
+ event: {
845
+ user_id: NOBODY,
846
+ claims: {
847
+ sub: NOBODY,
848
+ role: "authenticated",
849
+ aud: "authenticated"
850
+ }
851
+ }
852
+ };
853
+ const fixture = project.config.doctor?.claims;
854
+ if (fixture === void 0) return [nobody];
855
+ let samples;
856
+ try {
857
+ samples = JSON.parse(project.files.read(resolve(project.cwd, fixture)));
858
+ } catch {
859
+ return [nobody];
860
+ }
861
+ if (!Array.isArray(samples)) return [nobody];
862
+ return [nobody, ...samples.flatMap((sample, index) => {
863
+ const sub = isRecord(sample) ? sample["sub"] : void 0;
864
+ return typeof sub === "string" && sub !== "" ? [{
865
+ label: `sample ${String(index)} in ${fixture}`,
866
+ event: {
867
+ user_id: sub,
868
+ claims: sample
869
+ }
870
+ }] : [];
871
+ })];
872
+ }
873
+ /**
874
+ * PD085: `custom_access_token_hook` fails when `supabase_auth_admin` calls it,
875
+ * as GoTrue does at every sign-in and refresh. Runs only with `--db-url-stdin`,
876
+ * inside a transaction it rolls back.
877
+ */
878
+ async function pd085(project) {
879
+ const { database } = project;
880
+ const hook = project.config.supabase?.hook;
881
+ if (database === void 0 || hook === void 0) return [];
882
+ const schema = hook.schema ?? project.config.rls?.schema ?? "permdock";
883
+ const fn = `${quoteIdent(schema)}.custom_access_token_hook`;
884
+ const client = await database.connect(database.url);
885
+ const findings = [];
886
+ try {
887
+ for (const { label, event } of eventsOf(project)) {
888
+ await client.query("begin", []);
889
+ try {
890
+ await client.query("set local role supabase_auth_admin", []);
891
+ await client.query(`select ${fn}($1::jsonb) as event`, [JSON.stringify(event)]);
892
+ } catch (error) {
893
+ findings.push({
894
+ code: "PD085",
895
+ severity: "error",
896
+ message: `${schema}.custom_access_token_hook fails as supabase_auth_admin for ${label} (${describeError(error)}), so that sign-in gets no token`,
897
+ fix: hook.security === "definer" ? "apply the hook migration as the owner of the tables it reads, and grant supabase_auth_admin usage on its schema and execute on the hook" : "apply the hook migration's grants and read policies, or set supabase.hook.security to 'definer' so the hook reads with its owner's rights"
898
+ });
899
+ } finally {
900
+ await client.query("rollback", []);
901
+ }
902
+ }
903
+ } finally {
904
+ await client.end();
905
+ }
906
+ return findings;
907
+ }
908
+ //#endregion
789
909
  //#region src/cli/doctor/next.ts
790
910
  const ROUTE_GLOBS = ["**/api/permdock/route.{ts,tsx,js,jsx,mjs}"];
791
911
  const ENDPOINT = /\bendpoint\s*(?::|=)\s*\{?\s*['"`]/u;
@@ -901,9 +1021,11 @@ function isPermDockSpecifier(value) {
901
1021
  /**
902
1022
  * The calls to `postgrestSources`, `memoryVersionCache` and `instanceCache`
903
1023
  * imported from PermDock that sit inside a function body, except the right side
904
- * of a `??=`, which builds the object once.
1024
+ * of a `??=` or `||=`, the assignment guarded by `if (!x)` on the same name,
1025
+ * and the arguments of a call to a cache helper named in `doctor.cacheHelpers`:
1026
+ * each builds the object once.
905
1027
  */
906
- function callsInFunctions(source) {
1028
+ function callsInFunctions(source, cacheHelpers) {
907
1029
  const { program } = parseSync(source.file, source.text);
908
1030
  const names = /* @__PURE__ */ new Map();
909
1031
  const namespaces = /* @__PURE__ */ new Set();
@@ -932,14 +1054,32 @@ function callsInFunctions(source) {
932
1054
  ArrowFunctionExpression: enter,
933
1055
  "ArrowFunctionExpression:exit": exit,
934
1056
  AssignmentExpression(node) {
935
- if (node.operator === "??=") lazy.push({
1057
+ if (node.operator === "??=" || node.operator === "||=") lazy.push({
936
1058
  start: node.right.start,
937
1059
  end: node.right.end
938
1060
  });
939
1061
  },
1062
+ IfStatement(node) {
1063
+ const { test } = node;
1064
+ if (test.type !== "UnaryExpression" || test.operator !== "!" || test.argument.type !== "Identifier") return;
1065
+ const guarded = test.argument.name;
1066
+ const body = node.consequent.type === "BlockStatement" ? node.consequent.body : [node.consequent];
1067
+ for (const statement of body) if (statement.type === "ExpressionStatement" && statement.expression.type === "AssignmentExpression" && statement.expression.operator === "=" && statement.expression.left.type === "Identifier" && statement.expression.left.name === guarded) {
1068
+ const { right } = statement.expression;
1069
+ lazy.push({
1070
+ start: right.start,
1071
+ end: right.end
1072
+ });
1073
+ }
1074
+ },
940
1075
  CallExpression(node) {
941
- if (depth === 0) return;
942
1076
  const { callee } = node;
1077
+ const helper = callee.type === "Identifier" ? callee.name : callee.type === "MemberExpression" && callee.property.type === "Identifier" ? callee.property.name : void 0;
1078
+ if (helper !== void 0 && cacheHelpers.has(helper)) for (const argument of node.arguments) lazy.push({
1079
+ start: argument.start,
1080
+ end: argument.end
1081
+ });
1082
+ if (depth === 0) return;
943
1083
  let factory;
944
1084
  if (callee.type === "Identifier") factory = names.get(callee.name);
945
1085
  else if (callee.type === "MemberExpression" && callee.object.type === "Identifier" && namespaces.has(callee.object.name) && callee.property.type === "Identifier" && Object.hasOwn(SHARED_FACTORIES, callee.property.name)) factory = callee.property.name;
@@ -951,17 +1091,18 @@ function callsInFunctions(source) {
951
1091
  }).visit(program);
952
1092
  return found.filter(({ call }) => !lazy.some((range) => call.start >= range.start && call.end <= range.end));
953
1093
  }
954
- function findings(sources, code) {
1094
+ function findings(sources, code, cacheHelpers) {
955
1095
  const out = [];
956
1096
  for (const source of sources) {
957
1097
  if (!source.text.includes("permdock")) continue;
958
- for (const { call, factory } of callsInFunctions(source)) {
1098
+ for (const { call, factory } of callsInFunctions(source, cacheHelpers)) {
959
1099
  if (SHARED_FACTORIES[factory] !== code) continue;
960
1100
  const line = source.text.slice(0, call.start).split("\n").length;
961
1101
  const { what, fix } = FACTORY_MESSAGES[factory] ?? MESSAGES[code];
962
1102
  out.push({
963
1103
  code,
964
1104
  severity: "warning",
1105
+ target: `${source.file}:${String(line)}`,
965
1106
  message: `${source.file}:${String(line)} creates ${factory}() inside a function, ${what}`,
966
1107
  fix
967
1108
  });
@@ -973,21 +1114,36 @@ function findings(sources, code) {
973
1114
  * PD080: `postgrestSources`, `memoryVersionCache` or `claimsFirst` created per
974
1115
  * call.
975
1116
  */
976
- function pd080(sources) {
977
- return findings(sources, "PD080");
1117
+ function pd080(sources, cacheHelpers = []) {
1118
+ return findings(sources, "PD080", new Set(cacheHelpers));
978
1119
  }
979
1120
  /** PD081: `instanceCache` created per call. */
980
- function pd081(sources) {
981
- return findings(sources, "PD081");
1121
+ function pd081(sources, cacheHelpers = []) {
1122
+ return findings(sources, "PD081", new Set(cacheHelpers));
982
1123
  }
983
1124
  //#endregion
984
1125
  //#region src/cli/doctor/policy.ts
1126
+ /** `doctor.waivers`, checked; PD017 is the only code a waiver names. */
1127
+ function waiversOf(input) {
1128
+ const entries = input.config.doctor?.waivers ?? [];
1129
+ if (!Array.isArray(entries)) throw configError("PermDock CLI: doctor.waivers must be a list of { code, key, reason }");
1130
+ return entries.map((entry, index) => {
1131
+ if (!isRecord(entry) || entry["code"] !== "PD017" || typeof entry["key"] !== "string" || entry["key"] === "" || typeof entry["reason"] !== "string" || entry["reason"].trim() === "") throw configError(`PermDock CLI: doctor.waivers[${String(index)}] needs code "PD017", a permission key and a non-empty reason`);
1132
+ return {
1133
+ key: entry["key"],
1134
+ reason: entry["reason"]
1135
+ };
1136
+ });
1137
+ }
985
1138
  async function pd017(input) {
986
1139
  if (input.config.policy === void 0) return [];
987
1140
  const policy = await policyOf(input);
988
1141
  if (policy === void 0) return [];
989
1142
  const sensitive = new Set(input.config.doctor?.sensitiveActions ?? DEFAULT_SENSITIVE_ACTIONS);
990
1143
  const denied = new Set(policy.grants.filter((grant) => grant.effect === "deny").map((grant) => grant.permission.key));
1144
+ const waivers = waiversOf(input);
1145
+ const waived = new Set(waivers.map((waiver) => waiver.key));
1146
+ const matched = /* @__PURE__ */ new Set();
991
1147
  const findings = [];
992
1148
  const seen = /* @__PURE__ */ new Set();
993
1149
  for (const grant of policy.grants) {
@@ -997,13 +1153,25 @@ async function pd017(input) {
997
1153
  if (denied.has(grant.permission.key)) continue;
998
1154
  if (seen.has(grant.permission.key)) continue;
999
1155
  seen.add(grant.permission.key);
1156
+ if (waived.has(grant.permission.key)) {
1157
+ matched.add(grant.permission.key);
1158
+ continue;
1159
+ }
1000
1160
  findings.push({
1001
1161
  code: "PD017",
1002
1162
  severity: "warning",
1163
+ target: grant.permission.key,
1003
1164
  message: `${grant.permission.key} is a sensitive verb without approval`,
1004
- fix: "add approval: { by } on the allow, or a deny on the same leaf"
1165
+ fix: "add approval: { by } on the allow, or a deny on the same leaf, or waive it in doctor.waivers with a reason"
1005
1166
  });
1006
1167
  }
1168
+ for (const waiver of waivers) if (!matched.has(waiver.key)) findings.push({
1169
+ code: "PD017",
1170
+ severity: "warning",
1171
+ target: `waiver:${waiver.key}`,
1172
+ message: `doctor.waivers entry for ${waiver.key} matches no sensitive allow without approval`,
1173
+ fix: "remove the entry from doctor.waivers"
1174
+ });
1007
1175
  return findings;
1008
1176
  }
1009
1177
  async function pd024(input) {
@@ -1017,6 +1185,7 @@ async function pd024(input) {
1017
1185
  findings.push({
1018
1186
  code: "PD024",
1019
1187
  severity: "warning",
1188
+ target: `${grant.permission.key}${grant.role === null ? "" : `@${grant.role}`}`,
1020
1189
  message: `${grant.permission.key}${grant.role === null ? "" : ` (role ${grant.role})`} sets approval.mode: 'confirm', so the requester can approve their own request`,
1021
1190
  fix: "remove mode: 'confirm' unless the requester confirming their own call (an agent asking its user) is the intent"
1022
1191
  });
@@ -1242,33 +1411,6 @@ async function pd084(input) {
1242
1411
  //#endregion
1243
1412
  //#region src/cli/doctor/project.ts
1244
1413
  /**
1245
- * The directories from `cwd` up to the workspace root: the first one with a
1246
- * `pnpm-workspace.yaml`, a `package.json` that declares `workspaces`, or a
1247
- * `.git`. Skills are often installed once at a monorepo's root.
1248
- */
1249
- function workspaceDirs(files, cwd) {
1250
- const dirs = [];
1251
- let dir = resolve(cwd);
1252
- for (;;) {
1253
- dirs.push(dir);
1254
- if (isWorkspaceRoot(files, dir)) return dirs;
1255
- const parent = dirname(dir);
1256
- if (parent === dir) return [resolve(cwd)];
1257
- dir = parent;
1258
- }
1259
- }
1260
- function isWorkspaceRoot(files, dir) {
1261
- if (files.exists(join(dir, "pnpm-workspace.yaml")) || files.exists(join(dir, ".git"))) return true;
1262
- const manifest = join(dir, "package.json");
1263
- if (!files.exists(manifest)) return false;
1264
- try {
1265
- const parsed = readJson(files, manifest);
1266
- return parsed !== null && typeof parsed === "object" && Object.hasOwn(parsed, "workspaces");
1267
- } catch {
1268
- return false;
1269
- }
1270
- }
1271
- /**
1272
1414
  * Whether `dir` holds a skills lock: PermDock's own, or the `skills` CLI's
1273
1415
  * naming the `permdock` skill.
1274
1416
  */
@@ -1817,6 +1959,21 @@ async function pd071(input) {
1817
1959
  fix: `map it on purpose in rls.actions: ${verb}: "insert", "update", "delete" or "none"`
1818
1960
  }));
1819
1961
  }
1962
+ const NAME_GUARD_TRIGGER = new RegExp(String.raw`create\s+(?:or\s+replace\s+)?(?:constraint\s+)?trigger\s+"?${CUSTOM_ROLES.nameGuard}"?`, "iu");
1963
+ /**
1964
+ * Whether a declarative schema file, migration or generated SQL file creates
1965
+ * the `permdock_custom_role_name_guard` trigger.
1966
+ */
1967
+ function hasNameGuard(input) {
1968
+ const files = filesOf(input);
1969
+ const out = input.config.rls?.out;
1970
+ const entries = [
1971
+ "supabase/schemas",
1972
+ ...input.config.doctor?.migrations ?? MIGRATION_DIRS,
1973
+ ...out === void 0 ? [] : [out]
1974
+ ];
1975
+ return sqlFiles(input.cwd, entries).some((file) => NAME_GUARD_TRIGGER.test(files.read(file)));
1976
+ }
1820
1977
  /**
1821
1978
  * PD072: a membership source reads role keys through the table of custom roles
1822
1979
  * (`rls.customRoleWrites.roles`), which tenants write.
@@ -1825,11 +1982,14 @@ function pd072(input) {
1825
1982
  const roles = input.config.rls?.customRoleWrites?.roles;
1826
1983
  if (roles?.tenant === void 0) return [];
1827
1984
  const target = qualifySqlTable(roles.table);
1828
- return membershipSourcesOf(input.config).filter((source) => source.sql.throughs.some((through) => through.table === target)).map((source) => ({
1985
+ const sources = membershipSourcesOf(input.config).filter((source) => source.sql.throughs.some((through) => through.table === target));
1986
+ if (sources.length === 0 || hasNameGuard(input)) return [];
1987
+ return sources.map((source) => ({
1829
1988
  code: "PD072",
1989
+ target: `${target}:${source.sql.table}`,
1830
1990
  severity: "warning",
1831
1991
  message: `the ${source.sql.table} membership source reads role keys through ${target}, whose tenant rows tenants write: a tenant row named like a declared role must not grant it`,
1832
- fix: `keep the permdock_custom_role_name_guard trigger on ${target} (rls generate emits it with customRoleWrites.roles) and generate with this config, so helpers read a tenant row named like a declared role as no role`
1992
+ fix: `keep the permdock_custom_role_name_guard trigger on ${target} (rls generate emits it with customRoleWrites.roles) and generate with this config, so helpers read a tenant row named like a declared role as no role; doctor reads supabase/schemas, the migrations and rls.out for it`
1833
1993
  }));
1834
1994
  }
1835
1995
  /** PD073: a role's `for` lists kinds no membership source of its scope can hold. */
@@ -2525,12 +2685,12 @@ const DOCTOR_CHECKS = [
2525
2685
  {
2526
2686
  code: "PD080",
2527
2687
  groups: ["caching"],
2528
- run: (project) => pd080(project.sources())
2688
+ run: (project) => pd080(project.sources(), project.config.doctor?.cacheHelpers)
2529
2689
  },
2530
2690
  {
2531
2691
  code: "PD081",
2532
2692
  groups: ["caching"],
2533
- run: (project) => pd081(project.sources())
2693
+ run: (project) => pd081(project.sources(), project.config.doctor?.cacheHelpers)
2534
2694
  },
2535
2695
  {
2536
2696
  code: "PD082",
@@ -2837,6 +2997,12 @@ const DOCTOR_CHECKS = [
2837
2997
  when: (config) => config.rls?.migrate?.tables !== void 0,
2838
2998
  run: (project) => pd066(project.cwd, project.config, project.files)
2839
2999
  },
3000
+ {
3001
+ code: "PD085",
3002
+ groups: ["supabase", "hook"],
3003
+ when: (config) => config.supabase?.hook !== void 0,
3004
+ run: pd085
3005
+ },
2840
3006
  {
2841
3007
  code: "PD058",
2842
3008
  groups: ["powersync"],
@@ -2894,19 +3060,27 @@ async function runDoctor(input) {
2894
3060
  });
2895
3061
  fixed.push(`catalog: ${collected.message.trim()}`);
2896
3062
  }
2897
- const project = loadProject(input);
3063
+ const project = loadProject({
3064
+ ...input,
3065
+ ...input.db === void 0 ? {} : { database: {
3066
+ url: input.db,
3067
+ connect: input.connect ?? pgConnector("permdock doctor", input.cwd)
3068
+ } }
3069
+ });
2898
3070
  const selected = (check) => wanted.size === 0 || wanted.has(check.code.toLowerCase()) || check.groups.some((group) => wanted.has(group));
2899
- const findings = [];
3071
+ const collected = [];
2900
3072
  for (const check of DOCTOR_CHECKS) {
2901
3073
  if (check.when !== void 0 && !check.when(input.config)) continue;
2902
- if (selected(check)) findings.push(...await check.run(project));
3074
+ if (selected(check)) collected.push(...await check.run(project));
2903
3075
  }
3076
+ const { findings, ignored } = applyDoctorIgnores(collected.map(reported), input.config, input.ignore ?? []);
2904
3077
  const errors = findings.filter((item) => item.severity === "error").length;
2905
3078
  const warnings = findings.filter((item) => item.severity === "warning").length;
2906
3079
  const report = {
2907
3080
  $schema: DOCTOR_REPORT_SCHEMA,
2908
3081
  fixed,
2909
3082
  findings,
3083
+ ignored,
2910
3084
  errors,
2911
3085
  warnings
2912
3086
  };
@@ -2929,6 +3103,7 @@ async function pd059(project) {
2929
3103
  return [{
2930
3104
  code: "PD059",
2931
3105
  severity: "error",
3106
+ target: load.path,
2932
3107
  message: `policy module ${load.path} did not load (${load.message}), so doctor skipped every check that reads the policy`,
2933
3108
  fix: "fix the module so it exports policy from definePolicy, or point policy in permdock.config.ts at the module that does"
2934
3109
  }];
@@ -2941,6 +3116,7 @@ async function pd060(project) {
2941
3116
  return ((await project.collected()).scan?.unparsed ?? []).map((item) => ({
2942
3117
  code: "PD060",
2943
3118
  severity: "warning",
3119
+ target: `${item.file}:${String(item.line)}`,
2944
3120
  message: `${item.file}:${String(item.line)} does not parse (${item.message}), so the catalog and usage report miss the permissions it references`,
2945
3121
  fix: "fix the syntax error, or exclude the file from collect.srcPath"
2946
3122
  }));
@@ -2968,8 +3144,9 @@ function formatDoctor(report, color) {
2968
3144
  for (const finding of report.findings) {
2969
3145
  const mark = markOf(finding.severity, style);
2970
3146
  lines.push(` ${mark} ${style.paint("bold", finding.code)} ${finding.message}`);
2971
- lines.push(` ${style.paint("dim", `fix: ${finding.fix}`)}`);
3147
+ lines.push(` ${style.paint("dim", `fix: ${finding.fix} [${finding.id}]`)}`);
2972
3148
  }
3149
+ for (const item of report.ignored) lines.push(` ${style.paint("dim", `ignored ${item.id}: ${item.reason}`)}`);
2973
3150
  if (report.findings.length === 0) lines.push(" no findings");
2974
3151
  lines.push("");
2975
3152
  const notes = report.findings.filter((finding) => finding.severity === "info").length;
@@ -1,5 +1,5 @@
1
1
  import { t as defineLeaf } from "./command-L8EstFNm.js";
2
- import { a as failOnFlag } from "./flags-BlmpmXoY.js";
2
+ import { a as failOnFlag, n as dbUrl, r as dbUrlFlags } from "./flags-BlmpmXoY.js";
3
3
  import { n as ask, t as CANCELLED } from "./prompt-BYc6drYW.js";
4
4
  //#region src/cli/commands/doctor.ts
5
5
  const doctor = defineLeaf({
@@ -10,33 +10,43 @@ const doctor = defineLeaf({
10
10
  description: "Check codes or groups to run",
11
11
  valueHint: "code",
12
12
  async complete() {
13
- const { DOCTOR_CHECKS } = await import("./doctor-CkYKCuX7.js");
13
+ const { DOCTOR_CHECKS } = await import("./doctor-BhhNMkU8.js");
14
14
  return [.../* @__PURE__ */ new Set([...DOCTOR_CHECKS.map(({ code }) => code), ...DOCTOR_CHECKS.flatMap(({ groups }) => groups)])];
15
15
  }
16
16
  },
17
+ ignore: {
18
+ type: "string",
19
+ repeatable: true,
20
+ description: "Finding ids to accept for this run, as code:target",
21
+ valueHint: "id"
22
+ },
17
23
  fix: {
18
24
  type: "boolean",
19
25
  description: "Apply safe fixes: install skills, regenerate the catalog"
20
26
  },
21
- ...failOnFlag
27
+ ...failOnFlag,
28
+ ...dbUrlFlags
22
29
  },
23
30
  async run(ctx, { flags }) {
31
+ const db = await dbUrl(ctx, flags);
24
32
  let fix = flags.fix;
25
33
  if (fix && ctx.interactive && !ctx.yes) {
26
34
  const answer = await ask(`Install the Agent Skills and regenerate the catalog in ${ctx.cwd}?`);
27
35
  if (answer === void 0) return CANCELLED;
28
36
  fix = answer;
29
37
  }
30
- return (await import("./doctor-CkYKCuX7.js")).runDoctor({
38
+ return (await import("./doctor-BhhNMkU8.js")).runDoctor({
31
39
  cwd: ctx.cwd,
32
40
  config: ctx.config,
33
41
  only: flags.only,
42
+ ignore: flags.ignore,
34
43
  json: ctx.json,
35
44
  fix,
36
45
  strict: flags["fail-on"] === "warning",
37
46
  color: ctx.color,
38
47
  now: ctx.now,
39
- io: ctx.io
48
+ io: ctx.io,
49
+ ...db === void 0 ? {} : { db }
40
50
  });
41
51
  }
42
52
  });
@@ -1,7 +1,7 @@
1
- import { Kt as Instant, wr as Condition, yr as Subject } from "../policy-types-D-GwfQTc.js";
2
- import { f as WhereResult } from "../permdock-ffY4CMd9.js";
1
+ import { Er as Condition, qt as Instant, xr as Subject } from "../policy-types-Ky7P23CP.js";
2
+ import { f as WhereResult } from "../permdock-B45vPQb4.js";
3
3
  import { r as RelationsMapping } from "../graph-sql-BwFC4Qjs.js";
4
- import { s as MembershipsMapping } from "../compile-DBm0ub4p.js";
4
+ import { s as MembershipsMapping } from "../compile-RaRUQhmD.js";
5
5
  import { n as RowCheck, t as WithSubjectOptions } from "../subject-settings-vNW8qmUH.js";
6
6
  import { SQL, Table } from "drizzle-orm";
7
7
  //#region src/drizzle/types.d.ts
@@ -1,9 +1,9 @@
1
- import { E as Policy, M as PolicyVocabulary, _r as Principal } from "../policy-types-D-GwfQTc.js";
1
+ import { D as Policy, N as PolicyVocabulary, yr as Principal } from "../policy-types-Ky7P23CP.js";
2
2
  import { u as Permission } from "../permission-types-CAY-GU7e.js";
3
- import { a as PermDock } from "../permdock-ffY4CMd9.js";
3
+ import { a as PermDock } from "../permdock-B45vPQb4.js";
4
4
  import { n as RevocationFeed } from "../revocations-BaUXHM1N.js";
5
- import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-3OnXjZ2D.js";
6
- import { t as ServerAdapterOptions } from "../bind-DR6ku3A9.js";
5
+ import { D as ConnectionOptions, T as Connection, f as InvalidSignatureError, i as OpenApiHooks, o as ProtectOptions, v as discoverViaSignatureAgent, x as webBotAuthVerifier } from "../server-types-CwpJe664.js";
6
+ import { t as ServerAdapterOptions } from "../bind-SpRxR213.js";
7
7
  import { Elysia } from "elysia";
8
8
  //#region src/elysia/create.d.ts
9
9
  type ElysiaRequestContext = {
@@ -1,8 +1,8 @@
1
1
  import { a as parsedBody, r as hasCredentials } from "../http-DKLXrFGk.js";
2
- import { l as InvalidSignatureError, p as webBotAuthVerifier, u as discoverViaSignatureAgent } from "../evaluations-h3KoJAPa.js";
3
- import { t as problemFromError } from "../map-error-BH16Ah8P.js";
4
- import { a as socketConnection, i as decorate, r as bindKernel } from "../bind-B4pMH9bm.js";
5
- import { a as onRevoked, n as closeReason, t as POLICY_VIOLATION } from "../stream-CDvF0sJm.js";
2
+ import { l as InvalidSignatureError, p as webBotAuthVerifier, u as discoverViaSignatureAgent } from "../evaluations-CNMVJVD6.js";
3
+ import { t as problemFromError } from "../map-error-EOhahOVA.js";
4
+ import { a as socketConnection, i as decorate, r as bindKernel } from "../bind-BnKPWRrE.js";
5
+ import { a as onRevoked, n as closeReason, t as POLICY_VIOLATION } from "../stream-DQ3rbO3J.js";
6
6
  import { Elysia } from "elysia";
7
7
  //#region src/elysia/create.ts
8
8
  function createPermDock(policy, options) {
@@ -1,4 +1,4 @@
1
- import { _n as WireDenial, qn as Decision, yr as Subject } from "./policy-types-D-GwfQTc.js";
1
+ import { Yn as Decision, xr as Subject, yn as WireDenial } from "./policy-types-Ky7P23CP.js";
2
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
  //#region src/core/problem-details.d.ts
4
4
  type Disclosure = "hide" | "reveal";
@@ -34,7 +34,7 @@ var PermDockDeniedError = class extends Error {
34
34
  toProblemDetails(options) {
35
35
  return problemDetails(compact({
36
36
  decision: this.decision,
37
- detail: this.message,
37
+ detail: deniedMessage(this.permission, void 0, this.decision.denials, this.decision.alternatives.map((leaf) => leaf.key), false),
38
38
  instance: options?.instance,
39
39
  permission: this.permission,
40
40
  scope: this.scope,
@@ -1,7 +1,7 @@
1
1
  import { a as sole, n as isReadonlyArray, t as compact } from "./compact-CAf557ZB.js";
2
2
  import { n as freezeDeep } from "./freeze-jjan0lCv.js";
3
3
  import { n as isForbiddenKey } from "./paths-CUvURzHp.js";
4
- import { n as role, t as normalizeAssurance } from "./role-builder-CMW4wWzn.js";
4
+ import { n as role, t as normalizeAssurance } from "./role-builder-C_2kWB_x.js";
5
5
  import { n as PermDockValidationError } from "./validation-error-CYg2kJEw.js";
6
6
  import { t as wireDenials } from "./wire-denial-C7PaVYEM.js";
7
7
  import { o as sameId } from "./expiry-6XByK0dm.js";
@@ -17,7 +17,7 @@ import { a as authenticated, g as isRole, i as assurance, m as findRole, o as fl
17
17
  import { a as grantCoversField, i as wireValidity, t as isActive } from "./validity-Buc7w8E9.js";
18
18
  import { o as resourceRoleCondition } from "./grantee-conditions-DX4K_gGI.js";
19
19
  import { c as nowSeconds, i as matchScopedMembership, l as partitionsOf, n as inTeam, p as scopeField, r as isMembershipExpired } from "./tenancy-DvOHHk3-.js";
20
- import { i as grantList, n as declaredRoleNames, s as levelCondition } from "./policy-cV_wwPb8.js";
20
+ import { i as grantList, n as declaredRoleNames, s as levelCondition } from "./policy-DTmkP72P.js";
21
21
  import { t as requiresApproval } from "./approval-required-TzNB9oQA.js";
22
22
  import { i as rootMembershipId } from "./subject-C7RddW0G.js";
23
23
  import { a as versionOf, i as tokenPayload, n as decisionToken } from "./token-DaMnIU9O.js";
@@ -1,6 +1,6 @@
1
- import { E as Policy } from "./policy-types-D-GwfQTc.js";
2
- import { a as PermDock } from "./permdock-ffY4CMd9.js";
3
- import { m as ApprovalStore } from "./types-CqcsNCaN.js";
1
+ import { D as Policy } from "./policy-types-Ky7P23CP.js";
2
+ import { a as PermDock } from "./permdock-B45vPQb4.js";
3
+ import { m as ApprovalStore } from "./types--HfnkawU.js";
4
4
  //#region src/server/evaluations.d.ts
5
5
  /** AuthZEN 1.0 section 7.1.2.1 `options.evaluations_semantic` values. */
6
6
  declare const EVALUATIONS_SEMANTICS: readonly ["execute_all", "deny_on_first_deny", "permit_on_first_permit"];