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,95 @@
1
+ import { $ as DecisionSink, C as Policy, E as PolicyVocabulary, Zt as PermDock, at as LimitStore, ct as MembershipSource, ft as RelationSource, mr as Principal, pt as RoleSource, sn as PolicySource, tt as EntitlementSource, ur as Delegation, xt as SnapshotSource } from "../policy-CInmNGkM.js";
2
+ import { d as Permission } from "../permissions-B4apnahQ.js";
3
+ import { c as ApprovalRequest, f as ApprovalStore } from "../types-B8w5PFtS.js";
4
+ import { t as ToolMap } from "../types-CxquUByI.js";
5
+ //#region src/eve/create.d.ts
6
+ /** Structural `SessionAuthContext` from `eve`. */
7
+ type EvePrincipal = {
8
+ readonly principalId: string;
9
+ readonly principalType?: string;
10
+ readonly authenticator?: string;
11
+ readonly issuer?: string;
12
+ readonly subject?: string;
13
+ readonly attributes?: Readonly<Record<string, unknown>>;
14
+ };
15
+ /** Structural `ApprovalContext` from `eve/tools/approval`. */
16
+ type EveApprovalContext = {
17
+ readonly session?: {
18
+ readonly id?: string;
19
+ readonly auth?: {
20
+ readonly initiator?: EvePrincipal | null;
21
+ readonly current?: EvePrincipal | null;
22
+ };
23
+ };
24
+ readonly callId?: string;
25
+ readonly toolName: string;
26
+ readonly toolInput?: unknown;
27
+ };
28
+ /** Structural `ApprovalResponseContext` from `eve/tools/approval`. */
29
+ type EveResponseContext = {
30
+ readonly request: {
31
+ readonly callId: string;
32
+ readonly requestId?: string;
33
+ readonly toolName: string;
34
+ readonly toolInput?: unknown;
35
+ };
36
+ /** Who answered and how; eve settles the request only on `allowed`. */
37
+ readonly response: {
38
+ readonly decision: "approve" | "cancel";
39
+ readonly principal: EvePrincipal;
40
+ };
41
+ readonly session: {
42
+ readonly id: string;
43
+ readonly initiator: EvePrincipal | null;
44
+ };
45
+ };
46
+ /** What `subject`, `actor` and `tenant` receive. */
47
+ type EveContext = Pick<EveApprovalContext, "session" | "callId">;
48
+ type EveApprovers = {
49
+ readonly roles: readonly string[];
50
+ } | ((responder: EvePrincipal, request: ApprovalRequest) => boolean);
51
+ type EvePermDockOptions<TUser = unknown> = {
52
+ readonly subject?: (context: EveContext) => TUser | Promise<TUser>;
53
+ readonly actor?: (context: EveContext) => unknown;
54
+ readonly delegation?: (context: EveContext) => Delegation | undefined | Promise<Delegation | undefined>;
55
+ readonly tenant?: string | ((context: EveContext) => string | undefined | Promise<string | undefined>);
56
+ readonly tools: ToolMap;
57
+ readonly approvers?: EveApprovers;
58
+ readonly memberships?: MembershipSource | readonly MembershipSource[];
59
+ /** The object graph for relation grants that walk a parent chain; without it they deny. */
60
+ readonly relations?: RelationSource;
61
+ readonly entitlements?: EntitlementSource;
62
+ readonly customRoles?: RoleSource;
63
+ /** Hosted grants, read once per instance; see `PolicySource`. */
64
+ readonly policies?: PolicySource;
65
+ readonly store?: ApprovalStore;
66
+ readonly sink?: DecisionSink;
67
+ readonly limits?: LimitStore;
68
+ readonly snapshots?: SnapshotSource;
69
+ };
70
+ type EveRequestResult = "not-applicable" | "user-approval" | {
71
+ readonly type: "denied";
72
+ readonly reason: string;
73
+ };
74
+ type EveResponseResult = {
75
+ readonly status: "allowed";
76
+ } | {
77
+ readonly status: "rejected";
78
+ readonly reason: string;
79
+ };
80
+ /** An eve `ApprovalConfiguration`: pass it as a tool's `approval`. */
81
+ type EveApprovalPair = {
82
+ readonly request: (ctx: EveApprovalContext) => Promise<EveRequestResult>;
83
+ readonly response: (ctx: EveResponseContext) => Promise<EveResponseResult>;
84
+ };
85
+ type EvePermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
86
+ readonly approval: EveApprovalPair;
87
+ readonly approvalFor: (permission: Permission, data?: (input: unknown) => unknown) => EveApprovalPair;
88
+ readonly permdock: (ctx: EveContext) => Promise<PermDock<V>>;
89
+ };
90
+ export declare function rolesOf(principal: EvePrincipal | null | undefined): string[];
91
+ export declare function subjectFromSession(context: EveContext): unknown;
92
+ export declare function actorFromSession(context: EveContext): unknown;
93
+ export declare function createPermDock<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>, options: EvePermDockOptions<TUser>): EvePermDock<V>;
94
+ //#endregion
95
+ export type { EveApprovalContext, EveApprovalPair, EveApprovers, EveContext, EvePermDock, EvePermDockOptions, EvePrincipal, EveRequestResult, EveResponseContext, EveResponseResult };
@@ -0,0 +1,181 @@
1
+ import { t as compact } from "../compact-y6vfu2_f.js";
2
+ import { n as isApprovalError } from "../errors-m3u9TmDu.js";
3
+ import { o as resolveApproval, p as memoryApprovalStore } from "../helpers-DnSOrhB9.js";
4
+ import { n as createAgentKernel } from "../kernel-YOGCWNLf.js";
5
+ import { t as boundedMap } from "../lru-8q4WZjBV.js";
6
+ //#region src/eve/create.ts
7
+ const TOKENS_PER_PROCESS = 1e3;
8
+ function rolesOf(principal) {
9
+ const roles = principal?.attributes?.["roles"];
10
+ if (typeof roles === "string") return [roles];
11
+ if (!Array.isArray(roles)) return [];
12
+ return roles.filter((role) => typeof role === "string");
13
+ }
14
+ function subjectFromSession(context) {
15
+ const initiator = context.session?.auth?.initiator;
16
+ if (initiator === void 0 || initiator === null) return null;
17
+ return {
18
+ id: initiator.principalId,
19
+ roles: rolesOf(initiator)
20
+ };
21
+ }
22
+ function actorFromSession(context) {
23
+ const auth = context.session?.auth;
24
+ const initiator = auth?.initiator;
25
+ const current = auth?.current;
26
+ if (current !== void 0 && current !== null && initiator !== void 0 && initiator !== null && current.principalId !== initiator.principalId) return {
27
+ id: current.principalId,
28
+ kind: "eve"
29
+ };
30
+ return {
31
+ id: "eve:app",
32
+ kind: "eve"
33
+ };
34
+ }
35
+ function mapVerdict(verdict) {
36
+ if (verdict.outcome === "granted") return "not-applicable";
37
+ if (verdict.outcome === "approval-required") return "user-approval";
38
+ return {
39
+ type: "denied",
40
+ reason: verdict.reason
41
+ };
42
+ }
43
+ function mayApprove(approvers, responder, request) {
44
+ if (approvers === void 0) return true;
45
+ if (typeof approvers === "function") return approvers(responder, request);
46
+ const held = new Set(rolesOf(responder));
47
+ return approvers.roles.some((role) => held.has(role));
48
+ }
49
+ function callKey(sessionId, callId) {
50
+ return JSON.stringify([sessionId ?? null, callId]);
51
+ }
52
+ function createPermDock(policy, options) {
53
+ const store = options.store ?? memoryApprovalStore();
54
+ const tokensByCall = boundedMap(TOKENS_PER_PROCESS);
55
+ const kernel = createAgentKernel(policy, {
56
+ ...compact({
57
+ tenant: options.tenant,
58
+ delegation: options.delegation,
59
+ memberships: options.memberships,
60
+ relations: options.relations,
61
+ entitlements: options.entitlements,
62
+ customRoles: options.customRoles,
63
+ policies: options.policies,
64
+ sink: options.sink,
65
+ limits: options.limits,
66
+ snapshots: options.snapshots
67
+ }),
68
+ subject: options.subject ?? subjectFromSession,
69
+ actor: options.actor ?? actorFromSession,
70
+ tools: options.tools,
71
+ store,
72
+ adapter: "eve"
73
+ });
74
+ const approverOf = async (responder, sessionId) => {
75
+ try {
76
+ return (await kernel.instance({ session: {
77
+ id: sessionId,
78
+ auth: {
79
+ initiator: responder,
80
+ current: responder
81
+ }
82
+ } })).subject.principal ?? null;
83
+ } catch {
84
+ return null;
85
+ }
86
+ };
87
+ const pairFor = (bindingFor) => {
88
+ const request = async (ctx) => {
89
+ const binding = bindingFor(ctx.toolName);
90
+ const verdict = binding === void 0 ? await kernel.decideTool(ctx.toolName, ctx.toolInput, ctx) : await kernel.evaluate(binding, ctx.toolName, ctx.toolInput, ctx, { denyPending: true });
91
+ if (verdict.outcome === "approval-required" && ctx.callId !== void 0) tokensByCall.set(callKey(ctx.session?.id, ctx.callId), verdict.token);
92
+ return mapVerdict(verdict);
93
+ };
94
+ const tokenOf = (ctx) => {
95
+ const cached = tokensByCall.get(callKey(ctx.session.id, ctx.request.callId));
96
+ if (cached !== void 0) return Promise.resolve(cached);
97
+ const binding = bindingFor(ctx.request.toolName);
98
+ if (binding === void 0) return Promise.resolve(void 0);
99
+ const initiator = ctx.session.initiator;
100
+ return kernel.tokenFor(binding, ctx.request.toolInput, {
101
+ session: {
102
+ id: ctx.session.id,
103
+ auth: {
104
+ initiator,
105
+ current: initiator
106
+ }
107
+ },
108
+ callId: ctx.request.callId
109
+ });
110
+ };
111
+ const response = async (ctx) => {
112
+ const token = await tokenOf(ctx);
113
+ if (token === void 0) return {
114
+ status: "rejected",
115
+ reason: "approval-not-found"
116
+ };
117
+ let current;
118
+ try {
119
+ current = await store.get(token);
120
+ } catch {
121
+ current = null;
122
+ }
123
+ if (current === null) return {
124
+ status: "rejected",
125
+ reason: "approval-not-found"
126
+ };
127
+ const responder = ctx.response.principal;
128
+ if (current.subject.actor?.id === responder.principalId) return {
129
+ status: "rejected",
130
+ reason: "approver is the actor of this request"
131
+ };
132
+ if (!mayApprove(options.approvers, responder, current)) return {
133
+ status: "rejected",
134
+ reason: "approver is not eligible"
135
+ };
136
+ const approver = await approverOf(responder, ctx.session.id);
137
+ if (approver === null) return {
138
+ status: "rejected",
139
+ reason: "approver is not eligible"
140
+ };
141
+ try {
142
+ await resolveApproval(store, token, {
143
+ status: ctx.response.decision === "approve" ? "approved" : "rejected",
144
+ by: {
145
+ principal: approver,
146
+ context: {}
147
+ }
148
+ });
149
+ return { status: "allowed" };
150
+ } catch (error) {
151
+ if (isApprovalError(error)) return {
152
+ status: "rejected",
153
+ reason: error.message
154
+ };
155
+ return {
156
+ status: "rejected",
157
+ reason: "approval-not-found"
158
+ };
159
+ }
160
+ };
161
+ return {
162
+ request,
163
+ response
164
+ };
165
+ };
166
+ const approval = pairFor((toolName) => Object.hasOwn(options.tools, toolName) ? options.tools[toolName] : void 0);
167
+ const approvalFor = (permission, data) => {
168
+ const binding = compact({
169
+ permission,
170
+ data
171
+ });
172
+ return pairFor(() => binding);
173
+ };
174
+ return {
175
+ approval,
176
+ approvalFor,
177
+ permdock: (ctx) => kernel.instance(ctx)
178
+ };
179
+ }
180
+ //#endregion
181
+ export { actorFromSession, createPermDock, rolesOf, subjectFromSession };
@@ -0,0 +1,46 @@
1
+ import { $ as DecisionSink, C as Policy, E as PolicyVocabulary, Zt as PermDock, at as LimitStore, ct as MembershipSource, ft as RelationSource, mr as Principal, pt as RoleSource, sn as PolicySource, tt as EntitlementSource, xt as SnapshotSource } from "../policy-CInmNGkM.js";
2
+ import { d as Permission } from "../permissions-B4apnahQ.js";
3
+ import { f as ApprovalStore } from "../types-B8w5PFtS.js";
4
+ import { o as OtelWrap } from "../types-B9dmiiab.js";
5
+ import { r as PdpFactory } from "../types-BvBk1wgn.js";
6
+ import { g as discoverViaSignatureAgent, h as WebBotAuthVerifier, n as OpenApiHooks, o as TenantOption, r as ProtectOptions, u as InvalidSignatureError, y as verifyWebBotAuth } from "../create-BKF3dgFk.js";
7
+ import { a as toRequest, i as sendResponse } from "../http-DPuDaChb.js";
8
+ import { ErrorRequestHandler, Request, RequestHandler, Response, Router } from "express";
9
+ //#region src/express/create.d.ts
10
+ type ExpressPermDockOptions<TUser = unknown> = {
11
+ readonly subject: (req: Request) => TUser | Promise<TUser>;
12
+ readonly tenant?: TenantOption<Request>;
13
+ readonly memberships?: MembershipSource | readonly MembershipSource[];
14
+ /** The object graph for relation grants that walk a parent chain; without it they deny. */
15
+ readonly relations?: RelationSource;
16
+ readonly entitlements?: EntitlementSource;
17
+ readonly customRoles?: RoleSource;
18
+ /** Hosted grants, read once per instance; see `PolicySource`. */
19
+ readonly policies?: PolicySource;
20
+ readonly store?: ApprovalStore;
21
+ readonly sink?: DecisionSink;
22
+ readonly limits?: LimitStore;
23
+ /** `createPermDock` from `permdock/pdp`; `protect` then decides delegated permissions remotely. */
24
+ readonly pdp?: PdpFactory;
25
+ /** Accepted for adapter parity; not read by this adapter. */
26
+ readonly snapshots?: SnapshotSource;
27
+ /** `(permdock) => withOtel(permdock, options)` from `permdock/otel`. */
28
+ readonly otel?: OtelWrap;
29
+ /** `(request) => verifyWebBotAuth(request, options)`; a verified bot becomes the actor. */
30
+ readonly webBotAuth?: WebBotAuthVerifier;
31
+ };
32
+ type PermDockRequest<T = unknown, V extends PolicyVocabulary = PolicyVocabulary> = Request & {
33
+ permdock: PermDock<V>;
34
+ permdockData?: T;
35
+ };
36
+ type ExpressPermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
37
+ readonly permdock: () => RequestHandler;
38
+ readonly protect: (permission: Permission, loadData?: (req: Request) => unknown, protectOptions?: ProtectOptions) => RequestHandler;
39
+ readonly errorHandler: () => ErrorRequestHandler;
40
+ readonly permdockHandler: () => Router;
41
+ readonly withPermDock: (fn: (req: PermDockRequest<unknown, V>, res: Response) => unknown) => RequestHandler;
42
+ readonly openapi: OpenApiHooks;
43
+ };
44
+ export declare function createPermDock<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>, options: ExpressPermDockOptions<TUser>): ExpressPermDock<V>;
45
+ //#endregion
46
+ export { type ExpressPermDock, type ExpressPermDockOptions, InvalidSignatureError, type PermDockRequest, discoverViaSignatureAgent, sendResponse, toRequest, verifyWebBotAuth };
@@ -0,0 +1,108 @@
1
+ import { t as compact } from "../compact-y6vfu2_f.js";
2
+ import { i as discoverViaSignatureAgent, r as InvalidSignatureError, s as verifyWebBotAuth } from "../evaluations-DsAU9ppl.js";
3
+ import { r as tenantScope, t as createKernel } from "../create-CSkhDU9T.js";
4
+ import { t as problemFromError } from "../map-error-RJ3ZsUyA.js";
5
+ import { i as toRequest, r as sendResponse } from "../http-GgVApX1k.js";
6
+ import express from "express";
7
+ //#region src/express/create.ts
8
+ function run(work, next) {
9
+ work().catch(next);
10
+ }
11
+ const errorHandler = () => (err, _req, res, next) => {
12
+ const problem = problemFromError(err);
13
+ if (problem === void 0) {
14
+ next(err);
15
+ return;
16
+ }
17
+ run(async () => {
18
+ await sendResponse(res, problem);
19
+ }, next);
20
+ };
21
+ const withPermDock = (fn) => (req, res, next) => {
22
+ run(async () => {
23
+ await fn(req, res);
24
+ }, next);
25
+ };
26
+ /** Runs `use` on the Express request bound to `request`; `fallback` for a request this adapter never bound. */
27
+ function withBound(contexts, request, use, fallback) {
28
+ const req = contexts.get(request);
29
+ return req === void 0 ? fallback : use(req);
30
+ }
31
+ function createPermDock(policy, options) {
32
+ const contexts = /* @__PURE__ */ new WeakMap();
33
+ const bound = /* @__PURE__ */ new WeakMap();
34
+ const kernel = createKernel(policy, compact({
35
+ subject: (request) => withBound(contexts, request, options.subject, null),
36
+ memberships: options.memberships,
37
+ relations: options.relations,
38
+ entitlements: options.entitlements,
39
+ customRoles: options.customRoles,
40
+ policies: options.policies,
41
+ store: options.store,
42
+ sink: options.sink,
43
+ limits: options.limits,
44
+ pdp: options.pdp,
45
+ webBotAuth: options.webBotAuth,
46
+ adapter: "express",
47
+ wrap: options.otel
48
+ }));
49
+ const bind = (req) => {
50
+ const hit = bound.get(req);
51
+ if (hit !== void 0) return hit;
52
+ const request = toRequest(req);
53
+ bound.set(req, request);
54
+ contexts.set(request, req);
55
+ return request;
56
+ };
57
+ const scopeOf = (req) => tenantScope(options.tenant, req);
58
+ /** The decision endpoint reads the body a parser may have consumed since `bind`. */
59
+ const rebind = (req) => {
60
+ const request = toRequest(req);
61
+ contexts.set(request, req);
62
+ return request;
63
+ };
64
+ const permdock = () => (req, _res, next) => {
65
+ run(async () => {
66
+ req.permdock = await kernel.permdock(bind(req), await scopeOf(req));
67
+ next();
68
+ }, next);
69
+ };
70
+ const protect = (permission, loadData, protectOptions) => (req, res, next) => {
71
+ run(async () => {
72
+ const guard = await kernel.protect(permission, loadData === void 0 ? void 0 : () => loadData(req), protectOptions)(bind(req), await scopeOf(req));
73
+ if (!guard.ok) {
74
+ await sendResponse(res, guard.response);
75
+ return;
76
+ }
77
+ const scoped = req;
78
+ scoped.permdock = guard.permdock;
79
+ scoped.permdockData = guard.data;
80
+ next();
81
+ }, next);
82
+ };
83
+ const permdockHandler = () => {
84
+ const { POST, GET } = kernel.permdockHandler((request) => withBound(contexts, request, scopeOf, { tenant: void 0 }));
85
+ const router = express.Router({ mergeParams: true });
86
+ router.post("/", (req, res, next) => {
87
+ run(async () => {
88
+ await sendResponse(res, await POST(rebind(req)));
89
+ }, next);
90
+ });
91
+ router.get("/", (req, res, next) => {
92
+ run(async () => {
93
+ await sendResponse(res, await GET(bind(req)));
94
+ }, next);
95
+ });
96
+ return router;
97
+ };
98
+ return {
99
+ permdock,
100
+ protect,
101
+ errorHandler,
102
+ permdockHandler,
103
+ withPermDock,
104
+ openapi: kernel.openapi
105
+ };
106
+ }
107
+ //#endregion
108
+ export { InvalidSignatureError, createPermDock, discoverViaSignatureAgent, sendResponse, toRequest, verifyWebBotAuth };
@@ -0,0 +1,56 @@
1
+ import { $ as DecisionSink, C as Policy, E as PolicyVocabulary, Zt as PermDock, at as LimitStore, ct as MembershipSource, ft as RelationSource, mr as Principal, pt as RoleSource, sn as PolicySource, tt as EntitlementSource, xt as SnapshotSource } from "../policy-CInmNGkM.js";
2
+ import { d as Permission } from "../permissions-B4apnahQ.js";
3
+ import { f as ApprovalStore } from "../types-B8w5PFtS.js";
4
+ import { o as OtelWrap } from "../types-B9dmiiab.js";
5
+ import { r as PdpFactory } from "../types-BvBk1wgn.js";
6
+ import { g as discoverViaSignatureAgent, h as WebBotAuthVerifier, n as OpenApiHooks, o as TenantOption, r as ProtectOptions, u as InvalidSignatureError, y as verifyWebBotAuth } from "../create-BKF3dgFk.js";
7
+ import { FastifyPluginAsync, FastifyReply, FastifyRequest, FastifySchema, FastifyTypeProvider, FastifyTypeProviderDefault, RawRequestDefaultExpression, RawServerDefault, RouteGenericInterface } from "fastify";
8
+ //#region src/fastify/create.d.ts
9
+ type FastifyPermDockOptions<TUser = unknown> = {
10
+ readonly subject: (request: FastifyRequest) => TUser | Promise<TUser>;
11
+ readonly tenant?: TenantOption<FastifyRequest>;
12
+ readonly memberships?: MembershipSource | readonly MembershipSource[];
13
+ /** The object graph for relation grants that walk a parent chain; without it they deny. */
14
+ readonly relations?: RelationSource;
15
+ readonly entitlements?: EntitlementSource;
16
+ readonly customRoles?: RoleSource;
17
+ /** Hosted grants, read once per instance; see `PolicySource`. */
18
+ readonly policies?: PolicySource;
19
+ readonly store?: ApprovalStore;
20
+ readonly sink?: DecisionSink;
21
+ readonly limits?: LimitStore;
22
+ /** `createPermDock` from `permdock/pdp`; `protect` then decides delegated permissions remotely. */
23
+ readonly pdp?: PdpFactory;
24
+ /** Accepted for adapter parity; not read by this adapter. */
25
+ readonly snapshots?: SnapshotSource;
26
+ /** `(permdock) => withOtel(permdock, options)` from `permdock/otel`. */
27
+ readonly otel?: OtelWrap;
28
+ /** `(request) => verifyWebBotAuth(request, options)`; a verified bot becomes the actor. */
29
+ readonly webBotAuth?: WebBotAuthVerifier;
30
+ };
31
+ type PermDockRequest<Route extends RouteGenericInterface = RouteGenericInterface, V extends PolicyVocabulary = PolicyVocabulary> = FastifyRequest<Route> & {
32
+ permdock: PermDock<V>;
33
+ permdockData?: unknown;
34
+ };
35
+ /** A request typed by the route, its schema and the app's type provider. */
36
+ type ProtectRequest<Route extends RouteGenericInterface = RouteGenericInterface, Schema extends FastifySchema = FastifySchema, Provider extends FastifyTypeProvider = FastifyTypeProviderDefault> = FastifyRequest<Route, RawServerDefault, RawRequestDefaultExpression, Schema, Provider>;
37
+ /**
38
+ * Generic over the route, schema and type provider so a `preHandler` slot
39
+ * infers them: `loadData` sees the same typed `request.body` as the handler.
40
+ */
41
+ type FastifyProtect = <Route extends RouteGenericInterface = RouteGenericInterface, Schema extends FastifySchema = FastifySchema, Provider extends FastifyTypeProvider = FastifyTypeProviderDefault>(permission: Permission, loadData?: (request: ProtectRequest<Route, Schema, Provider>) => unknown, protectOptions?: ProtectOptions) => (request: ProtectRequest<Route, Schema, Provider>, reply: FastifyReply) => Promise<void>;
42
+ type FastifyPermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
43
+ readonly permdock: FastifyPluginAsync;
44
+ readonly protect: FastifyProtect;
45
+ readonly permdockHandler: FastifyPluginAsync;
46
+ /** Types `request.permdock` for a route registered after `permdock` or `protect`. */
47
+ readonly withPermDock: <Route extends RouteGenericInterface = RouteGenericInterface>(fn: (request: PermDockRequest<Route, V>, reply: FastifyReply) => unknown) => (request: FastifyRequest<Route>, reply: FastifyReply) => unknown;
48
+ readonly openapi: OpenApiHooks;
49
+ };
50
+ export declare function createPermDock<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>, options: FastifyPermDockOptions<TUser>): FastifyPermDock<V>;
51
+ //#endregion
52
+ //#region src/fastify/http.d.ts
53
+ export declare function toRequest(request: FastifyRequest): Request;
54
+ export declare function sendReply(reply: FastifyReply, response: Response): Promise<void>;
55
+ //#endregion
56
+ export { type FastifyPermDock, type FastifyPermDockOptions, type FastifyProtect, InvalidSignatureError, type PermDockRequest, discoverViaSignatureAgent, verifyWebBotAuth };
@@ -0,0 +1,141 @@
1
+ import { t as compact } from "../compact-y6vfu2_f.js";
2
+ import { i as discoverViaSignatureAgent, r as InvalidSignatureError, s as verifyWebBotAuth } from "../evaluations-DsAU9ppl.js";
3
+ import { r as tenantScope, t as createKernel } from "../create-CSkhDU9T.js";
4
+ import { t as problemFromError } from "../map-error-RJ3ZsUyA.js";
5
+ //#region src/fastify/http.ts
6
+ function toRequest(request) {
7
+ const host = headerValue(request.headers.host) ?? "localhost";
8
+ const url = `${request.protocol}://${host}${request.url}`;
9
+ const headers = new Headers();
10
+ for (const [key, value] of Object.entries(request.headers)) {
11
+ if (typeof value === "string") {
12
+ headers.set(key, value);
13
+ continue;
14
+ }
15
+ if (Array.isArray(value)) for (const item of value) headers.append(key, item);
16
+ }
17
+ const method = request.method;
18
+ if (method === "GET" || method === "HEAD") return new Request(url, {
19
+ method,
20
+ headers
21
+ });
22
+ const body = bodyOf(request, headers);
23
+ if (body === void 0) return new Request(url, {
24
+ method,
25
+ headers
26
+ });
27
+ return new Request(url, {
28
+ method,
29
+ headers,
30
+ body
31
+ });
32
+ }
33
+ function headerValue(value) {
34
+ if (typeof value === "string" && value.length > 0) return value;
35
+ if (Array.isArray(value) && typeof value[0] === "string") return value[0];
36
+ }
37
+ function bodyOf(request, headers) {
38
+ if (request.body === void 0) return;
39
+ if (typeof request.body === "string") return request.body;
40
+ if (!headers.has("content-type")) headers.set("content-type", "application/json");
41
+ return JSON.stringify(request.body);
42
+ }
43
+ async function sendReply(reply, response) {
44
+ reply.code(response.status);
45
+ for (const [key, value] of response.headers.entries()) reply.header(key, value);
46
+ await reply.send(await response.text());
47
+ }
48
+ //#endregion
49
+ //#region src/fastify/create.ts
50
+ const SKIP_OVERRIDE = Symbol.for("skip-override");
51
+ function breakEncapsulation(plugin) {
52
+ Object.defineProperty(plugin, SKIP_OVERRIDE, { value: true });
53
+ return plugin;
54
+ }
55
+ function decorate(request, instance, data) {
56
+ const scoped = request;
57
+ scoped.permdock = instance;
58
+ if (data !== void 0) scoped.permdockData = data;
59
+ }
60
+ function createPermDock(policy, options) {
61
+ const contexts = /* @__PURE__ */ new WeakMap();
62
+ const bound = /* @__PURE__ */ new WeakMap();
63
+ const kernel = createKernel(policy, compact({
64
+ subject: (request) => {
65
+ const req = contexts.get(request);
66
+ return req === void 0 ? null : options.subject(req);
67
+ },
68
+ memberships: options.memberships,
69
+ relations: options.relations,
70
+ entitlements: options.entitlements,
71
+ customRoles: options.customRoles,
72
+ policies: options.policies,
73
+ store: options.store,
74
+ sink: options.sink,
75
+ limits: options.limits,
76
+ pdp: options.pdp,
77
+ webBotAuth: options.webBotAuth,
78
+ adapter: "fastify",
79
+ wrap: options.otel
80
+ }));
81
+ const bind = (request) => {
82
+ const hit = bound.get(request);
83
+ if (hit !== void 0) return hit;
84
+ const next = toRequest(request);
85
+ bound.set(request, next);
86
+ contexts.set(next, request);
87
+ return next;
88
+ };
89
+ const scopeOf = (request) => tenantScope(options.tenant, request);
90
+ const permdock = breakEncapsulation((app) => {
91
+ app.decorateRequest("permdock", null);
92
+ app.decorateRequest("permdockData", null);
93
+ app.addHook("onRequest", async (request) => {
94
+ decorate(request, await kernel.permdock(bind(request), await scopeOf(request)));
95
+ });
96
+ const previous = app.errorHandler;
97
+ app.setErrorHandler(async function permdockErrors(err, request, reply) {
98
+ const problem = problemFromError(err);
99
+ if (problem === void 0) {
100
+ await previous.call(this, err, request, reply);
101
+ return;
102
+ }
103
+ await sendReply(reply, problem);
104
+ });
105
+ return Promise.resolve();
106
+ });
107
+ const protect = (permission, loadData, protectOptions) => async (request, reply) => {
108
+ const plain = request;
109
+ const guard = await kernel.protect(permission, loadData === void 0 ? void 0 : () => loadData(request), protectOptions)(bind(plain), await scopeOf(plain));
110
+ if (!guard.ok) {
111
+ await sendReply(reply, guard.response);
112
+ return;
113
+ }
114
+ decorate(plain, guard.permdock, guard.data);
115
+ };
116
+ const permdockHandler = (app) => {
117
+ const { POST, GET } = kernel.permdockHandler((request) => {
118
+ const req = contexts.get(request);
119
+ return req === void 0 ? { tenant: void 0 } : scopeOf(req);
120
+ });
121
+ app.post("/", async (request, reply) => {
122
+ const parsed = toRequest(request);
123
+ contexts.set(parsed, request);
124
+ await sendReply(reply, await POST(parsed));
125
+ });
126
+ app.get("/", async (request, reply) => {
127
+ await sendReply(reply, await GET(bind(request)));
128
+ });
129
+ return Promise.resolve();
130
+ };
131
+ const withPermDock = (fn) => (request, reply) => fn(request, reply);
132
+ return {
133
+ permdock,
134
+ protect,
135
+ permdockHandler,
136
+ withPermDock,
137
+ openapi: kernel.openapi
138
+ };
139
+ }
140
+ //#endregion
141
+ export { InvalidSignatureError, createPermDock, discoverViaSignatureAgent, sendReply, toRequest, verifyWebBotAuth };