@xenosystem/agent-cli 0.5.190 → 0.5.191

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 (864) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.js +2 -2
  3. package/dist/metafile-esm.json +1 -1
  4. package/dist/sdk-build-identity.json +4 -4
  5. package/node_modules/@xeno-corporation/account/LICENSE +39 -0
  6. package/node_modules/@xeno-corporation/account/README.md +266 -0
  7. package/node_modules/@xeno-corporation/account/dist/chunk-FELZILY4.mjs +60 -0
  8. package/node_modules/@xeno-corporation/account/dist/chunk-FELZILY4.mjs.map +1 -0
  9. package/node_modules/@xeno-corporation/account/dist/client-D7OSWGkE.d.mts +2337 -0
  10. package/node_modules/@xeno-corporation/account/dist/client-D7OSWGkE.d.ts +2337 -0
  11. package/node_modules/@xeno-corporation/account/dist/index.d.mts +110 -0
  12. package/node_modules/@xeno-corporation/account/dist/index.d.ts +110 -0
  13. package/node_modules/@xeno-corporation/account/dist/index.js +4116 -0
  14. package/node_modules/@xeno-corporation/account/dist/index.js.map +1 -0
  15. package/node_modules/@xeno-corporation/account/dist/index.mjs +3968 -0
  16. package/node_modules/@xeno-corporation/account/dist/index.mjs.map +1 -0
  17. package/node_modules/@xeno-corporation/account/dist/node.d.mts +109 -0
  18. package/node_modules/@xeno-corporation/account/dist/node.d.ts +109 -0
  19. package/node_modules/@xeno-corporation/account/dist/node.js +1453 -0
  20. package/node_modules/@xeno-corporation/account/dist/node.js.map +1 -0
  21. package/node_modules/@xeno-corporation/account/dist/node.mjs +1379 -0
  22. package/node_modules/@xeno-corporation/account/dist/node.mjs.map +1 -0
  23. package/node_modules/@xeno-corporation/account/package.json +62 -0
  24. package/node_modules/zod/LICENSE +21 -0
  25. package/node_modules/zod/README.md +218 -0
  26. package/node_modules/zod/compile.cjs +96 -0
  27. package/node_modules/zod/compile.d.cts +1 -0
  28. package/node_modules/zod/compile.d.ts +1 -0
  29. package/node_modules/zod/compile.js +52 -0
  30. package/node_modules/zod/index.cjs +52 -0
  31. package/node_modules/zod/index.d.cts +3 -0
  32. package/node_modules/zod/index.d.ts +3 -0
  33. package/node_modules/zod/index.js +7 -0
  34. package/node_modules/zod/locales/index.cjs +36 -0
  35. package/node_modules/zod/locales/index.d.cts +1 -0
  36. package/node_modules/zod/locales/index.d.ts +1 -0
  37. package/node_modules/zod/locales/index.js +1 -0
  38. package/node_modules/zod/locales/package.json +7 -0
  39. package/node_modules/zod/mini/index.cjs +51 -0
  40. package/node_modules/zod/mini/index.d.cts +3 -0
  41. package/node_modules/zod/mini/index.d.ts +3 -0
  42. package/node_modules/zod/mini/index.js +3 -0
  43. package/node_modules/zod/mini/package.json +7 -0
  44. package/node_modules/zod/package.json +147 -0
  45. package/node_modules/zod/src/compile.ts +56 -0
  46. package/node_modules/zod/src/index.ts +7 -0
  47. package/node_modules/zod/src/locales/index.ts +1 -0
  48. package/node_modules/zod/src/mini/index.ts +3 -0
  49. package/node_modules/zod/src/v3/ZodError.ts +340 -0
  50. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  51. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  52. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  53. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  54. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  55. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  56. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  57. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  58. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  59. package/node_modules/zod/src/v3/errors.ts +13 -0
  60. package/node_modules/zod/src/v3/external.ts +6 -0
  61. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  62. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  63. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  64. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  65. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  66. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  67. package/node_modules/zod/src/v3/index.ts +4 -0
  68. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  69. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  70. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  71. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  72. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  73. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  74. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  75. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  76. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  77. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  78. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  79. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  80. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  81. package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
  82. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  83. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  84. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  85. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  86. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  87. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  88. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  89. package/node_modules/zod/src/v3/tests/error.test.ts +586 -0
  90. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  91. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  92. package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
  93. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  94. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  95. package/node_modules/zod/src/v3/tests/intersection.test.ts +128 -0
  96. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  97. package/node_modules/zod/src/v3/tests/language-server.test.ts +206 -0
  98. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  99. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  100. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  101. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  102. package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
  103. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  104. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  105. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  106. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  107. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  108. package/node_modules/zod/src/v3/tests/object.test.ts +431 -0
  109. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  110. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  111. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  112. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  113. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  114. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  115. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  116. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  117. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  118. package/node_modules/zod/src/v3/tests/readonly.test.ts +114 -0
  119. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  120. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  121. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  122. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  123. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  124. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  125. package/node_modules/zod/src/v3/tests/string.test.ts +922 -0
  126. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  127. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  128. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  129. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  130. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  131. package/node_modules/zod/src/v3/types.ts +5138 -0
  132. package/node_modules/zod/src/v4/classic/checks.ts +33 -0
  133. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  134. package/node_modules/zod/src/v4/classic/compat.ts +78 -0
  135. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  136. package/node_modules/zod/src/v4/classic/errors.ts +97 -0
  137. package/node_modules/zod/src/v4/classic/external.ts +57 -0
  138. package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
  139. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  140. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  141. package/node_modules/zod/src/v4/classic/iso.ts +20 -0
  142. package/node_modules/zod/src/v4/classic/parse.ts +88 -0
  143. package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
  144. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  145. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
  146. package/node_modules/zod/src/v4/classic/tests/array.test.ts +291 -0
  147. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +402 -0
  148. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  149. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  150. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  151. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +89 -0
  152. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
  153. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +604 -0
  154. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  155. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
  156. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
  157. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  158. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
  159. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  160. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  161. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
  162. package/node_modules/zod/src/v4/classic/tests/date.test.ts +92 -0
  163. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +316 -0
  164. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  165. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  166. package/node_modules/zod/src/v4/classic/tests/default.test.ts +455 -0
  167. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  168. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  169. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
  170. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
  171. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +305 -0
  172. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +917 -0
  173. package/node_modules/zod/src/v4/classic/tests/error.test.ts +1108 -0
  174. package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
  175. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
  176. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  177. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
  178. package/node_modules/zod/src/v4/classic/tests/function.test.ts +391 -0
  179. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  180. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
  181. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
  182. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  183. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  184. package/node_modules/zod/src/v4/classic/tests/index.test.ts +958 -0
  185. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  186. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +127 -0
  187. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +334 -0
  188. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  189. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
  190. package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
  191. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +262 -0
  192. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +128 -0
  193. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
  194. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
  195. package/node_modules/zod/src/v4/classic/tests/map.test.ts +349 -0
  196. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  197. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  198. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
  199. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  200. package/node_modules/zod/src/v4/classic/tests/number.test.ts +401 -0
  201. package/node_modules/zod/src/v4/classic/tests/object.test.ts +1006 -0
  202. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  203. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +366 -0
  204. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +497 -0
  205. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
  206. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
  207. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +144 -0
  208. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
  209. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
  210. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  211. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  212. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  213. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  214. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +184 -0
  215. package/node_modules/zod/src/v4/classic/tests/record.test.ts +885 -0
  216. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +707 -0
  217. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  218. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +693 -0
  219. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
  220. package/node_modules/zod/src/v4/classic/tests/set.test.ts +196 -0
  221. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +153 -0
  222. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
  223. package/node_modules/zod/src/v4/classic/tests/string.test.ts +1440 -0
  224. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +124 -0
  225. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +812 -0
  226. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  227. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
  228. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
  229. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +511 -0
  230. package/node_modules/zod/src/v4/classic/tests/union.test.ts +310 -0
  231. package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
  232. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  233. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  234. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  235. package/node_modules/zod/src/v4/core/api.ts +1875 -0
  236. package/node_modules/zod/src/v4/core/checks.ts +1266 -0
  237. package/node_modules/zod/src/v4/core/compile.ts +2322 -0
  238. package/node_modules/zod/src/v4/core/core.ts +230 -0
  239. package/node_modules/zod/src/v4/core/doc.ts +52 -0
  240. package/node_modules/zod/src/v4/core/errors.ts +543 -0
  241. package/node_modules/zod/src/v4/core/index.ts +19 -0
  242. package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
  243. package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
  244. package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
  245. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  246. package/node_modules/zod/src/v4/core/parse.ts +309 -0
  247. package/node_modules/zod/src/v4/core/regexes.ts +217 -0
  248. package/node_modules/zod/src/v4/core/registries.ts +105 -0
  249. package/node_modules/zod/src/v4/core/schemas.ts +5226 -0
  250. package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
  251. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  252. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
  253. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  254. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  255. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  256. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  257. package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
  258. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  259. package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
  260. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  261. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  262. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
  263. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  264. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
  265. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
  266. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
  267. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
  268. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
  269. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  270. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  271. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  272. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  273. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  274. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
  275. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  276. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
  277. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  278. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  279. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  280. package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
  281. package/node_modules/zod/src/v4/core/util.ts +1293 -0
  282. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  283. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  284. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  285. package/node_modules/zod/src/v4/index.ts +4 -0
  286. package/node_modules/zod/src/v4/locales/ar.ts +120 -0
  287. package/node_modules/zod/src/v4/locales/az.ts +116 -0
  288. package/node_modules/zod/src/v4/locales/be.ts +188 -0
  289. package/node_modules/zod/src/v4/locales/bg.ts +133 -0
  290. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  291. package/node_modules/zod/src/v4/locales/ca.ts +121 -0
  292. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  293. package/node_modules/zod/src/v4/locales/cs.ts +123 -0
  294. package/node_modules/zod/src/v4/locales/da.ts +128 -0
  295. package/node_modules/zod/src/v4/locales/de.ts +121 -0
  296. package/node_modules/zod/src/v4/locales/el.ts +124 -0
  297. package/node_modules/zod/src/v4/locales/en.ts +136 -0
  298. package/node_modules/zod/src/v4/locales/eo.ts +123 -0
  299. package/node_modules/zod/src/v4/locales/es.ts +145 -0
  300. package/node_modules/zod/src/v4/locales/fa.ts +131 -0
  301. package/node_modules/zod/src/v4/locales/fi.ts +126 -0
  302. package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
  303. package/node_modules/zod/src/v4/locales/fr.ts +139 -0
  304. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  305. package/node_modules/zod/src/v4/locales/he.ts +253 -0
  306. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  307. package/node_modules/zod/src/v4/locales/hr.ts +135 -0
  308. package/node_modules/zod/src/v4/locales/hu.ts +122 -0
  309. package/node_modules/zod/src/v4/locales/hy.ts +175 -0
  310. package/node_modules/zod/src/v4/locales/id.ts +120 -0
  311. package/node_modules/zod/src/v4/locales/index.ts +63 -0
  312. package/node_modules/zod/src/v4/locales/is.ts +124 -0
  313. package/node_modules/zod/src/v4/locales/it.ts +121 -0
  314. package/node_modules/zod/src/v4/locales/ja.ts +119 -0
  315. package/node_modules/zod/src/v4/locales/ka.ts +128 -0
  316. package/node_modules/zod/src/v4/locales/kh.ts +7 -0
  317. package/node_modules/zod/src/v4/locales/km.ts +124 -0
  318. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  319. package/node_modules/zod/src/v4/locales/ko.ts +126 -0
  320. package/node_modules/zod/src/v4/locales/lt.ts +243 -0
  321. package/node_modules/zod/src/v4/locales/mk.ts +123 -0
  322. package/node_modules/zod/src/v4/locales/ms.ts +120 -0
  323. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  324. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  325. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  326. package/node_modules/zod/src/v4/locales/no.ts +121 -0
  327. package/node_modules/zod/src/v4/locales/ota.ts +122 -0
  328. package/node_modules/zod/src/v4/locales/pl.ts +123 -0
  329. package/node_modules/zod/src/v4/locales/ps.ts +131 -0
  330. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  331. package/node_modules/zod/src/v4/locales/pt.ts +159 -0
  332. package/node_modules/zod/src/v4/locales/ro.ts +132 -0
  333. package/node_modules/zod/src/v4/locales/ru.ts +188 -0
  334. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  335. package/node_modules/zod/src/v4/locales/sl.ts +123 -0
  336. package/node_modules/zod/src/v4/locales/sv.ts +124 -0
  337. package/node_modules/zod/src/v4/locales/ta.ts +123 -0
  338. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  339. package/node_modules/zod/src/v4/locales/th.ts +124 -0
  340. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  341. package/node_modules/zod/src/v4/locales/tr.ts +116 -0
  342. package/node_modules/zod/src/v4/locales/ua.ts +7 -0
  343. package/node_modules/zod/src/v4/locales/uk.ts +122 -0
  344. package/node_modules/zod/src/v4/locales/ur.ts +124 -0
  345. package/node_modules/zod/src/v4/locales/uz.ts +120 -0
  346. package/node_modules/zod/src/v4/locales/vi.ts +122 -0
  347. package/node_modules/zod/src/v4/locales/yo.ts +129 -0
  348. package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
  349. package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
  350. package/node_modules/zod/src/v4/mini/checks.ts +33 -0
  351. package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
  352. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  353. package/node_modules/zod/src/v4/mini/external.ts +52 -0
  354. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  355. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  356. package/node_modules/zod/src/v4/mini/iso.ts +66 -0
  357. package/node_modules/zod/src/v4/mini/parse.ts +16 -0
  358. package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
  359. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
  360. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +190 -0
  361. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
  362. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +158 -0
  363. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
  364. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +30 -0
  365. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  366. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  367. package/node_modules/zod/src/v4/mini/tests/error.test.ts +41 -0
  368. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +14 -0
  369. package/node_modules/zod/src/v4/mini/tests/index.test.ts +1146 -0
  370. package/node_modules/zod/src/v4/mini/tests/number.test.ts +109 -0
  371. package/node_modules/zod/src/v4/mini/tests/object.test.ts +292 -0
  372. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  373. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +341 -0
  374. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
  375. package/node_modules/zod/src/v4/mini/tests/string.test.ts +396 -0
  376. package/node_modules/zod/src/v4-mini/index.ts +3 -0
  377. package/node_modules/zod/v3/ZodError.cjs +167 -0
  378. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  379. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  380. package/node_modules/zod/v3/ZodError.js +143 -0
  381. package/node_modules/zod/v3/errors.cjs +36 -0
  382. package/node_modules/zod/v3/errors.d.cts +5 -0
  383. package/node_modules/zod/v3/errors.d.ts +5 -0
  384. package/node_modules/zod/v3/errors.js +9 -0
  385. package/node_modules/zod/v3/external.cjs +41 -0
  386. package/node_modules/zod/v3/external.d.cts +6 -0
  387. package/node_modules/zod/v3/external.d.ts +6 -0
  388. package/node_modules/zod/v3/external.js +6 -0
  389. package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
  390. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  391. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  392. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  393. package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
  394. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  395. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  396. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  397. package/node_modules/zod/v3/helpers/parseUtil.cjs +143 -0
  398. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  399. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  400. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  401. package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
  402. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  403. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  404. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  405. package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
  406. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  407. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  408. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  409. package/node_modules/zod/v3/helpers/util.cjs +156 -0
  410. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  411. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  412. package/node_modules/zod/v3/helpers/util.js +133 -0
  413. package/node_modules/zod/v3/index.cjs +52 -0
  414. package/node_modules/zod/v3/index.d.cts +4 -0
  415. package/node_modules/zod/v3/index.d.ts +4 -0
  416. package/node_modules/zod/v3/index.js +4 -0
  417. package/node_modules/zod/v3/locales/en.cjs +112 -0
  418. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  419. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  420. package/node_modules/zod/v3/locales/en.js +109 -0
  421. package/node_modules/zod/v3/package.json +7 -0
  422. package/node_modules/zod/v3/standard-schema.cjs +21 -0
  423. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  424. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  425. package/node_modules/zod/v3/standard-schema.js +1 -0
  426. package/node_modules/zod/v3/types.cjs +3798 -0
  427. package/node_modules/zod/v3/types.d.cts +1034 -0
  428. package/node_modules/zod/v3/types.d.ts +1034 -0
  429. package/node_modules/zod/v3/types.js +3697 -0
  430. package/node_modules/zod/v4/classic/checks.cjs +53 -0
  431. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  432. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  433. package/node_modules/zod/v4/classic/checks.js +1 -0
  434. package/node_modules/zod/v4/classic/coerce.cjs +66 -0
  435. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  436. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  437. package/node_modules/zod/v4/classic/coerce.js +17 -0
  438. package/node_modules/zod/v4/classic/compat.cjs +80 -0
  439. package/node_modules/zod/v4/classic/compat.d.cts +48 -0
  440. package/node_modules/zod/v4/classic/compat.d.ts +48 -0
  441. package/node_modules/zod/v4/classic/compat.js +31 -0
  442. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  443. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  444. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  445. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  446. package/node_modules/zod/v4/classic/errors.cjs +102 -0
  447. package/node_modules/zod/v4/classic/errors.d.cts +29 -0
  448. package/node_modules/zod/v4/classic/errors.d.ts +29 -0
  449. package/node_modules/zod/v4/classic/errors.js +57 -0
  450. package/node_modules/zod/v4/classic/external.cjs +97 -0
  451. package/node_modules/zod/v4/classic/external.d.cts +19 -0
  452. package/node_modules/zod/v4/classic/external.d.ts +19 -0
  453. package/node_modules/zod/v4/classic/external.js +17 -0
  454. package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
  455. package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
  456. package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
  457. package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
  458. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  459. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  460. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  461. package/node_modules/zod/v4/classic/in-out.js +36 -0
  462. package/node_modules/zod/v4/classic/index.cjs +52 -0
  463. package/node_modules/zod/v4/classic/index.d.cts +3 -0
  464. package/node_modules/zod/v4/classic/index.d.ts +3 -0
  465. package/node_modules/zod/v4/classic/index.js +4 -0
  466. package/node_modules/zod/v4/classic/iso.cjs +68 -0
  467. package/node_modules/zod/v4/classic/iso.d.cts +7 -0
  468. package/node_modules/zod/v4/classic/iso.d.ts +7 -0
  469. package/node_modules/zod/v4/classic/iso.js +15 -0
  470. package/node_modules/zod/v4/classic/package.json +7 -0
  471. package/node_modules/zod/v4/classic/parse.cjs +63 -0
  472. package/node_modules/zod/v4/classic/parse.d.cts +44 -0
  473. package/node_modules/zod/v4/classic/parse.d.ts +44 -0
  474. package/node_modules/zod/v4/classic/parse.js +16 -0
  475. package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
  476. package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
  477. package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
  478. package/node_modules/zod/v4/classic/schemas.js +1535 -0
  479. package/node_modules/zod/v4/core/api.cjs +1269 -0
  480. package/node_modules/zod/v4/core/api.d.cts +335 -0
  481. package/node_modules/zod/v4/core/api.d.ts +335 -0
  482. package/node_modules/zod/v4/core/api.js +1107 -0
  483. package/node_modules/zod/v4/core/checks.cjs +561 -0
  484. package/node_modules/zod/v4/core/checks.d.cts +294 -0
  485. package/node_modules/zod/v4/core/checks.d.ts +294 -0
  486. package/node_modules/zod/v4/core/checks.js +516 -0
  487. package/node_modules/zod/v4/core/compile.cjs +1916 -0
  488. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  489. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  490. package/node_modules/zod/v4/core/compile.js +1866 -0
  491. package/node_modules/zod/v4/core/core.cjs +167 -0
  492. package/node_modules/zod/v4/core/core.d.cts +82 -0
  493. package/node_modules/zod/v4/core/core.d.ts +82 -0
  494. package/node_modules/zod/v4/core/core.js +141 -0
  495. package/node_modules/zod/v4/core/doc.cjs +61 -0
  496. package/node_modules/zod/v4/core/doc.d.cts +16 -0
  497. package/node_modules/zod/v4/core/doc.d.ts +16 -0
  498. package/node_modules/zod/v4/core/doc.js +38 -0
  499. package/node_modules/zod/v4/core/errors.cjs +317 -0
  500. package/node_modules/zod/v4/core/errors.d.cts +225 -0
  501. package/node_modules/zod/v4/core/errors.d.ts +225 -0
  502. package/node_modules/zod/v4/core/errors.js +267 -0
  503. package/node_modules/zod/v4/core/index.cjs +70 -0
  504. package/node_modules/zod/v4/core/index.d.cts +19 -0
  505. package/node_modules/zod/v4/core/index.d.ts +19 -0
  506. package/node_modules/zod/v4/core/index.js +19 -0
  507. package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
  508. package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
  509. package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
  510. package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
  511. package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
  512. package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
  513. package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
  514. package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
  515. package/node_modules/zod/v4/core/json-schema.cjs +21 -0
  516. package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
  517. package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
  518. package/node_modules/zod/v4/core/json-schema.js +1 -0
  519. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  520. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  521. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  522. package/node_modules/zod/v4/core/memoizer.js +311 -0
  523. package/node_modules/zod/v4/core/package.json +7 -0
  524. package/node_modules/zod/v4/core/parse.cjs +233 -0
  525. package/node_modules/zod/v4/core/parse.d.cts +52 -0
  526. package/node_modules/zod/v4/core/parse.d.ts +52 -0
  527. package/node_modules/zod/v4/core/parse.js +175 -0
  528. package/node_modules/zod/v4/core/regexes.cjs +209 -0
  529. package/node_modules/zod/v4/core/regexes.d.cts +90 -0
  530. package/node_modules/zod/v4/core/regexes.d.ts +90 -0
  531. package/node_modules/zod/v4/core/regexes.js +156 -0
  532. package/node_modules/zod/v4/core/registries.cjs +75 -0
  533. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  534. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  535. package/node_modules/zod/v4/core/registries.js +51 -0
  536. package/node_modules/zod/v4/core/schemas.cjs +2699 -0
  537. package/node_modules/zod/v4/core/schemas.d.cts +1275 -0
  538. package/node_modules/zod/v4/core/schemas.d.ts +1275 -0
  539. package/node_modules/zod/v4/core/schemas.js +2636 -0
  540. package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
  541. package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
  542. package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
  543. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  544. package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
  545. package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
  546. package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
  547. package/node_modules/zod/v4/core/to-json-schema.js +651 -0
  548. package/node_modules/zod/v4/core/util.cjs +964 -0
  549. package/node_modules/zod/v4/core/util.d.cts +280 -0
  550. package/node_modules/zod/v4/core/util.d.ts +280 -0
  551. package/node_modules/zod/v4/core/util.js +873 -0
  552. package/node_modules/zod/v4/core/versions.cjs +27 -0
  553. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  554. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  555. package/node_modules/zod/v4/core/versions.js +5 -0
  556. package/node_modules/zod/v4/core/visit.cjs +214 -0
  557. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  558. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  559. package/node_modules/zod/v4/core/visit.js +169 -0
  560. package/node_modules/zod/v4/index.cjs +51 -0
  561. package/node_modules/zod/v4/index.d.cts +3 -0
  562. package/node_modules/zod/v4/index.d.ts +3 -0
  563. package/node_modules/zod/v4/index.js +4 -0
  564. package/node_modules/zod/v4/locales/ar.cjs +138 -0
  565. package/node_modules/zod/v4/locales/ar.d.cts +5 -0
  566. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  567. package/node_modules/zod/v4/locales/ar.js +111 -0
  568. package/node_modules/zod/v4/locales/az.cjs +137 -0
  569. package/node_modules/zod/v4/locales/az.d.cts +5 -0
  570. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  571. package/node_modules/zod/v4/locales/az.js +110 -0
  572. package/node_modules/zod/v4/locales/be.cjs +195 -0
  573. package/node_modules/zod/v4/locales/be.d.cts +5 -0
  574. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  575. package/node_modules/zod/v4/locales/be.js +168 -0
  576. package/node_modules/zod/v4/locales/bg.cjs +152 -0
  577. package/node_modules/zod/v4/locales/bg.d.cts +5 -0
  578. package/node_modules/zod/v4/locales/bg.d.ts +4 -0
  579. package/node_modules/zod/v4/locales/bg.js +125 -0
  580. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  581. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  582. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  583. package/node_modules/zod/v4/locales/bn.js +113 -0
  584. package/node_modules/zod/v4/locales/ca.cjs +139 -0
  585. package/node_modules/zod/v4/locales/ca.d.cts +5 -0
  586. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  587. package/node_modules/zod/v4/locales/ca.js +112 -0
  588. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  589. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  590. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  591. package/node_modules/zod/v4/locales/ckb.js +133 -0
  592. package/node_modules/zod/v4/locales/cs.cjs +143 -0
  593. package/node_modules/zod/v4/locales/cs.d.cts +5 -0
  594. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  595. package/node_modules/zod/v4/locales/cs.js +116 -0
  596. package/node_modules/zod/v4/locales/da.cjs +147 -0
  597. package/node_modules/zod/v4/locales/da.d.cts +5 -0
  598. package/node_modules/zod/v4/locales/da.d.ts +4 -0
  599. package/node_modules/zod/v4/locales/da.js +120 -0
  600. package/node_modules/zod/v4/locales/de.cjs +140 -0
  601. package/node_modules/zod/v4/locales/de.d.cts +5 -0
  602. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  603. package/node_modules/zod/v4/locales/de.js +113 -0
  604. package/node_modules/zod/v4/locales/el.cjs +139 -0
  605. package/node_modules/zod/v4/locales/el.d.cts +5 -0
  606. package/node_modules/zod/v4/locales/el.d.ts +4 -0
  607. package/node_modules/zod/v4/locales/el.js +112 -0
  608. package/node_modules/zod/v4/locales/en.cjs +152 -0
  609. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  610. package/node_modules/zod/v4/locales/en.d.ts +4 -0
  611. package/node_modules/zod/v4/locales/en.js +125 -0
  612. package/node_modules/zod/v4/locales/eo.cjs +141 -0
  613. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  614. package/node_modules/zod/v4/locales/eo.d.ts +4 -0
  615. package/node_modules/zod/v4/locales/eo.js +114 -0
  616. package/node_modules/zod/v4/locales/es.cjs +163 -0
  617. package/node_modules/zod/v4/locales/es.d.cts +5 -0
  618. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  619. package/node_modules/zod/v4/locales/es.js +136 -0
  620. package/node_modules/zod/v4/locales/fa.cjs +146 -0
  621. package/node_modules/zod/v4/locales/fa.d.cts +5 -0
  622. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  623. package/node_modules/zod/v4/locales/fa.js +119 -0
  624. package/node_modules/zod/v4/locales/fi.cjs +144 -0
  625. package/node_modules/zod/v4/locales/fi.d.cts +5 -0
  626. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  627. package/node_modules/zod/v4/locales/fi.js +117 -0
  628. package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
  629. package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
  630. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  631. package/node_modules/zod/v4/locales/fr-CA.js +112 -0
  632. package/node_modules/zod/v4/locales/fr.cjs +156 -0
  633. package/node_modules/zod/v4/locales/fr.d.cts +5 -0
  634. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  635. package/node_modules/zod/v4/locales/fr.js +129 -0
  636. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  637. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  638. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  639. package/node_modules/zod/v4/locales/gu.js +113 -0
  640. package/node_modules/zod/v4/locales/he.cjs +248 -0
  641. package/node_modules/zod/v4/locales/he.d.cts +5 -0
  642. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  643. package/node_modules/zod/v4/locales/he.js +221 -0
  644. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  645. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  646. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  647. package/node_modules/zod/v4/locales/hi.js +111 -0
  648. package/node_modules/zod/v4/locales/hr.cjs +153 -0
  649. package/node_modules/zod/v4/locales/hr.d.cts +5 -0
  650. package/node_modules/zod/v4/locales/hr.d.ts +4 -0
  651. package/node_modules/zod/v4/locales/hr.js +126 -0
  652. package/node_modules/zod/v4/locales/hu.cjs +140 -0
  653. package/node_modules/zod/v4/locales/hu.d.cts +5 -0
  654. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  655. package/node_modules/zod/v4/locales/hu.js +113 -0
  656. package/node_modules/zod/v4/locales/hy.cjs +185 -0
  657. package/node_modules/zod/v4/locales/hy.d.cts +5 -0
  658. package/node_modules/zod/v4/locales/hy.d.ts +4 -0
  659. package/node_modules/zod/v4/locales/hy.js +158 -0
  660. package/node_modules/zod/v4/locales/id.cjs +138 -0
  661. package/node_modules/zod/v4/locales/id.d.cts +5 -0
  662. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  663. package/node_modules/zod/v4/locales/id.js +111 -0
  664. package/node_modules/zod/v4/locales/index.cjs +152 -0
  665. package/node_modules/zod/v4/locales/index.d.cts +63 -0
  666. package/node_modules/zod/v4/locales/index.d.ts +63 -0
  667. package/node_modules/zod/v4/locales/index.js +63 -0
  668. package/node_modules/zod/v4/locales/is.cjs +141 -0
  669. package/node_modules/zod/v4/locales/is.d.cts +5 -0
  670. package/node_modules/zod/v4/locales/is.d.ts +4 -0
  671. package/node_modules/zod/v4/locales/is.js +114 -0
  672. package/node_modules/zod/v4/locales/it.cjs +140 -0
  673. package/node_modules/zod/v4/locales/it.d.cts +5 -0
  674. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  675. package/node_modules/zod/v4/locales/it.js +113 -0
  676. package/node_modules/zod/v4/locales/ja.cjs +139 -0
  677. package/node_modules/zod/v4/locales/ja.d.cts +5 -0
  678. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  679. package/node_modules/zod/v4/locales/ja.js +112 -0
  680. package/node_modules/zod/v4/locales/ka.cjs +144 -0
  681. package/node_modules/zod/v4/locales/ka.d.cts +5 -0
  682. package/node_modules/zod/v4/locales/ka.d.ts +4 -0
  683. package/node_modules/zod/v4/locales/ka.js +117 -0
  684. package/node_modules/zod/v4/locales/kh.cjs +12 -0
  685. package/node_modules/zod/v4/locales/kh.d.cts +5 -0
  686. package/node_modules/zod/v4/locales/kh.d.ts +5 -0
  687. package/node_modules/zod/v4/locales/kh.js +5 -0
  688. package/node_modules/zod/v4/locales/km.cjs +142 -0
  689. package/node_modules/zod/v4/locales/km.d.cts +5 -0
  690. package/node_modules/zod/v4/locales/km.d.ts +4 -0
  691. package/node_modules/zod/v4/locales/km.js +115 -0
  692. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  693. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  694. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  695. package/node_modules/zod/v4/locales/kn.js +116 -0
  696. package/node_modules/zod/v4/locales/ko.cjs +143 -0
  697. package/node_modules/zod/v4/locales/ko.d.cts +5 -0
  698. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  699. package/node_modules/zod/v4/locales/ko.js +116 -0
  700. package/node_modules/zod/v4/locales/lt.cjs +234 -0
  701. package/node_modules/zod/v4/locales/lt.d.cts +5 -0
  702. package/node_modules/zod/v4/locales/lt.d.ts +4 -0
  703. package/node_modules/zod/v4/locales/lt.js +207 -0
  704. package/node_modules/zod/v4/locales/mk.cjs +141 -0
  705. package/node_modules/zod/v4/locales/mk.d.cts +5 -0
  706. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  707. package/node_modules/zod/v4/locales/mk.js +114 -0
  708. package/node_modules/zod/v4/locales/ms.cjs +139 -0
  709. package/node_modules/zod/v4/locales/ms.d.cts +5 -0
  710. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  711. package/node_modules/zod/v4/locales/ms.js +112 -0
  712. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  713. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  714. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  715. package/node_modules/zod/v4/locales/ne.js +111 -0
  716. package/node_modules/zod/v4/locales/nl.cjs +142 -0
  717. package/node_modules/zod/v4/locales/nl.d.cts +5 -0
  718. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  719. package/node_modules/zod/v4/locales/nl.js +115 -0
  720. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  721. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  722. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  723. package/node_modules/zod/v4/locales/nn.js +113 -0
  724. package/node_modules/zod/v4/locales/no.cjs +140 -0
  725. package/node_modules/zod/v4/locales/no.d.cts +5 -0
  726. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  727. package/node_modules/zod/v4/locales/no.js +113 -0
  728. package/node_modules/zod/v4/locales/ota.cjs +141 -0
  729. package/node_modules/zod/v4/locales/ota.d.cts +5 -0
  730. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  731. package/node_modules/zod/v4/locales/ota.js +114 -0
  732. package/node_modules/zod/v4/locales/package.json +7 -0
  733. package/node_modules/zod/v4/locales/pl.cjs +141 -0
  734. package/node_modules/zod/v4/locales/pl.d.cts +5 -0
  735. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  736. package/node_modules/zod/v4/locales/pl.js +114 -0
  737. package/node_modules/zod/v4/locales/ps.cjs +146 -0
  738. package/node_modules/zod/v4/locales/ps.d.cts +5 -0
  739. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  740. package/node_modules/zod/v4/locales/ps.js +119 -0
  741. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  742. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  743. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  744. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  745. package/node_modules/zod/v4/locales/pt.cjs +169 -0
  746. package/node_modules/zod/v4/locales/pt.d.cts +5 -0
  747. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  748. package/node_modules/zod/v4/locales/pt.js +142 -0
  749. package/node_modules/zod/v4/locales/ro.cjs +149 -0
  750. package/node_modules/zod/v4/locales/ro.d.cts +5 -0
  751. package/node_modules/zod/v4/locales/ro.d.ts +4 -0
  752. package/node_modules/zod/v4/locales/ro.js +122 -0
  753. package/node_modules/zod/v4/locales/ru.cjs +195 -0
  754. package/node_modules/zod/v4/locales/ru.d.cts +5 -0
  755. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  756. package/node_modules/zod/v4/locales/ru.js +168 -0
  757. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  758. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  759. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  760. package/node_modules/zod/v4/locales/sk.js +116 -0
  761. package/node_modules/zod/v4/locales/sl.cjs +141 -0
  762. package/node_modules/zod/v4/locales/sl.d.cts +5 -0
  763. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  764. package/node_modules/zod/v4/locales/sl.js +114 -0
  765. package/node_modules/zod/v4/locales/sv.cjs +142 -0
  766. package/node_modules/zod/v4/locales/sv.d.cts +5 -0
  767. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  768. package/node_modules/zod/v4/locales/sv.js +115 -0
  769. package/node_modules/zod/v4/locales/ta.cjs +142 -0
  770. package/node_modules/zod/v4/locales/ta.d.cts +5 -0
  771. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  772. package/node_modules/zod/v4/locales/ta.js +115 -0
  773. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  774. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  775. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  776. package/node_modules/zod/v4/locales/tg.js +117 -0
  777. package/node_modules/zod/v4/locales/th.cjs +142 -0
  778. package/node_modules/zod/v4/locales/th.d.cts +5 -0
  779. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  780. package/node_modules/zod/v4/locales/th.js +115 -0
  781. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  782. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  783. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  784. package/node_modules/zod/v4/locales/tk.js +107 -0
  785. package/node_modules/zod/v4/locales/tr.cjs +137 -0
  786. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  787. package/node_modules/zod/v4/locales/tr.d.ts +4 -0
  788. package/node_modules/zod/v4/locales/tr.js +110 -0
  789. package/node_modules/zod/v4/locales/ua.cjs +12 -0
  790. package/node_modules/zod/v4/locales/ua.d.cts +5 -0
  791. package/node_modules/zod/v4/locales/ua.d.ts +5 -0
  792. package/node_modules/zod/v4/locales/ua.js +5 -0
  793. package/node_modules/zod/v4/locales/uk.cjs +140 -0
  794. package/node_modules/zod/v4/locales/uk.d.cts +5 -0
  795. package/node_modules/zod/v4/locales/uk.d.ts +4 -0
  796. package/node_modules/zod/v4/locales/uk.js +113 -0
  797. package/node_modules/zod/v4/locales/ur.cjs +142 -0
  798. package/node_modules/zod/v4/locales/ur.d.cts +5 -0
  799. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  800. package/node_modules/zod/v4/locales/ur.js +115 -0
  801. package/node_modules/zod/v4/locales/uz.cjs +140 -0
  802. package/node_modules/zod/v4/locales/uz.d.cts +5 -0
  803. package/node_modules/zod/v4/locales/uz.d.ts +4 -0
  804. package/node_modules/zod/v4/locales/uz.js +113 -0
  805. package/node_modules/zod/v4/locales/vi.cjs +140 -0
  806. package/node_modules/zod/v4/locales/vi.d.cts +5 -0
  807. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  808. package/node_modules/zod/v4/locales/vi.js +113 -0
  809. package/node_modules/zod/v4/locales/yo.cjs +139 -0
  810. package/node_modules/zod/v4/locales/yo.d.cts +5 -0
  811. package/node_modules/zod/v4/locales/yo.d.ts +4 -0
  812. package/node_modules/zod/v4/locales/yo.js +112 -0
  813. package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
  814. package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
  815. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  816. package/node_modules/zod/v4/locales/zh-CN.js +114 -0
  817. package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
  818. package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
  819. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  820. package/node_modules/zod/v4/locales/zh-TW.js +112 -0
  821. package/node_modules/zod/v4/mini/checks.cjs +54 -0
  822. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  823. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  824. package/node_modules/zod/v4/mini/checks.js +1 -0
  825. package/node_modules/zod/v4/mini/coerce.cjs +71 -0
  826. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  827. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  828. package/node_modules/zod/v4/mini/coerce.js +22 -0
  829. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  830. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  831. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  832. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  833. package/node_modules/zod/v4/mini/external.cjs +95 -0
  834. package/node_modules/zod/v4/mini/external.d.cts +16 -0
  835. package/node_modules/zod/v4/mini/external.d.ts +16 -0
  836. package/node_modules/zod/v4/mini/external.js +16 -0
  837. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  838. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  839. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  840. package/node_modules/zod/v4/mini/in-out.js +36 -0
  841. package/node_modules/zod/v4/mini/index.cjs +51 -0
  842. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  843. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  844. package/node_modules/zod/v4/mini/index.js +3 -0
  845. package/node_modules/zod/v4/mini/iso.cjs +83 -0
  846. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  847. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  848. package/node_modules/zod/v4/mini/iso.js +34 -0
  849. package/node_modules/zod/v4/mini/package.json +7 -0
  850. package/node_modules/zod/v4/mini/parse.cjs +37 -0
  851. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  852. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  853. package/node_modules/zod/v4/mini/parse.js +1 -0
  854. package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
  855. package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
  856. package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
  857. package/node_modules/zod/v4/mini/schemas.js +1002 -0
  858. package/node_modules/zod/v4/package.json +7 -0
  859. package/node_modules/zod/v4-mini/index.cjs +51 -0
  860. package/node_modules/zod/v4-mini/index.d.cts +3 -0
  861. package/node_modules/zod/v4-mini/index.d.ts +3 -0
  862. package/node_modules/zod/v4-mini/index.js +3 -0
  863. package/node_modules/zod/v4-mini/package.json +7 -0
  864. package/package.json +94 -94
@@ -0,0 +1,1379 @@
1
+ import {
2
+ AccountError,
3
+ __name,
4
+ normalizeDpopHtu
5
+ } from "./chunk-FELZILY4.mjs";
6
+
7
+ // src/node.ts
8
+ import crypto from "node:crypto";
9
+
10
+ // src/nativeSignIn.ts
11
+ import { timingSafeEqual } from "node:crypto";
12
+ import { createServer } from "node:http";
13
+ var activeClients = /* @__PURE__ */ new WeakSet();
14
+ var failure = /* @__PURE__ */ __name((message) => new AccountError({
15
+ code: "INVALID_TOKEN",
16
+ message,
17
+ retryable: false
18
+ }), "failure");
19
+ async function startNativeSignIn(client, options = {}) {
20
+ const timeoutMs = options.timeoutMs ?? 3e5;
21
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 6e5) throw failure("Invalid native sign-in deadline");
22
+ if (options.signal?.aborted) throw failure("Native sign-in cancelled");
23
+ if (activeClients.has(client)) throw failure("Native sign-in already active");
24
+ activeClients.add(client);
25
+ let phase = "waiting";
26
+ let expectedState;
27
+ let flow;
28
+ let redirectUri = "";
29
+ let timer;
30
+ let resolveCompletion;
31
+ let rejectCompletion;
32
+ const completion = new Promise((resolve, reject) => {
33
+ resolveCompletion = resolve;
34
+ rejectCompletion = reject;
35
+ });
36
+ void completion.catch(() => {
37
+ });
38
+ let closing;
39
+ const server = createServer({
40
+ maxHeaderSize: 8192
41
+ }, (request, response) => {
42
+ const reply = /* @__PURE__ */ __name((status, message) => {
43
+ response.writeHead(status, {
44
+ "content-type": "text/plain; charset=utf-8",
45
+ "cache-control": "no-store",
46
+ "content-security-policy": "default-src 'none'; frame-ancestors 'none'",
47
+ "referrer-policy": "no-referrer",
48
+ "x-content-type-options": "nosniff",
49
+ connection: "close"
50
+ });
51
+ response.end(message);
52
+ }, "reply");
53
+ const expected = new URL(redirectUri || "http://127.0.0.1/callback");
54
+ if (request.method !== "GET" || request.headers.host !== expected.host || request.headers.origin !== void 0 || request.headers["transfer-encoding"] !== void 0 || Number(request.headers["content-length"] ?? 0) !== 0 || !request.url || request.url.length > 8192 || !request.url.startsWith("/callback?")) {
55
+ reply(400, "Invalid sign-in callback.");
56
+ return;
57
+ }
58
+ const callback = new URL(request.url, expected.origin);
59
+ const states = callback.searchParams.getAll("state");
60
+ const codes = callback.searchParams.getAll("code");
61
+ const errors = callback.searchParams.getAll("error");
62
+ const sameState = states.length === 1 && expectedState !== void 0 && Buffer.byteLength(states[0]) === Buffer.byteLength(expectedState) && timingSafeEqual(Buffer.from(states[0]), Buffer.from(expectedState));
63
+ if (callback.pathname !== "/callback" || !sameState || !flow || phase !== "waiting" || !(codes.length === 1 && codes[0] && errors.length === 0 || errors.length === 1 && errors[0] && codes.length === 0)) {
64
+ reply(400, "Invalid or expired sign-in callback.");
65
+ return;
66
+ }
67
+ expectedState = void 0;
68
+ clearTimeout(timer);
69
+ options.signal?.removeEventListener("abort", abort);
70
+ if (errors.length) {
71
+ reply(200, "Sign-in was not completed. Return to the application.");
72
+ void finish(failure("Native sign-in was refused by the authorization service"));
73
+ return;
74
+ }
75
+ phase = "exchanging";
76
+ reply(200, "Authorization received. Return to the application to verify sign-in status.");
77
+ const selected = flow;
78
+ flow = void 0;
79
+ void stopListener();
80
+ void Promise.resolve().then(() => client.completeSignIn({
81
+ code: codes[0],
82
+ codeVerifier: selected.pkce.verifier,
83
+ expectedNonce: selected.nonce,
84
+ expectedScopes: options.scopes,
85
+ redirectUri
86
+ })).then(() => finish(), () => finish(failure("Native sign-in exchange or protected persistence failed; inspect account status before retrying")));
87
+ });
88
+ server.maxConnections = 16;
89
+ server.headersTimeout = 5e3;
90
+ server.requestTimeout = 5e3;
91
+ server.setTimeout(5e3);
92
+ server.on("timeout", (socket) => socket.destroy());
93
+ function stopListener() {
94
+ closing ??= new Promise((resolve) => {
95
+ server.close(() => resolve());
96
+ server.closeIdleConnections();
97
+ setImmediate(() => server.closeAllConnections());
98
+ });
99
+ return closing;
100
+ }
101
+ __name(stopListener, "stopListener");
102
+ async function finish(error) {
103
+ if (phase === "settled") return;
104
+ phase = "settled";
105
+ expectedState = void 0;
106
+ flow = void 0;
107
+ clearTimeout(timer);
108
+ options.signal?.removeEventListener("abort", abort);
109
+ await stopListener();
110
+ activeClients.delete(client);
111
+ if (error) rejectCompletion(error);
112
+ else resolveCompletion();
113
+ }
114
+ __name(finish, "finish");
115
+ function abort() {
116
+ if (phase === "waiting") void finish(failure("Native sign-in cancelled"));
117
+ }
118
+ __name(abort, "abort");
119
+ try {
120
+ await new Promise((resolve, reject) => {
121
+ server.once("error", reject);
122
+ server.listen(0, "127.0.0.1", () => {
123
+ server.removeListener("error", reject);
124
+ resolve();
125
+ });
126
+ });
127
+ server.on("error", () => {
128
+ if (phase === "waiting") void finish(failure("Native sign-in listener failed"));
129
+ });
130
+ redirectUri = `http://127.0.0.1:${server.address().port}/callback`;
131
+ flow = await client.beginSignIn({
132
+ redirectUri,
133
+ scopes: options.scopes
134
+ });
135
+ if (phase !== "waiting") throw failure("Native sign-in startup was interrupted");
136
+ expectedState = flow.state;
137
+ const authorization = new URL(flow.url);
138
+ if (authorization.protocol !== "https:" || authorization.username || authorization.password || !/^[A-Za-z0-9_-]{24,128}$/.test(expectedState) || authorization.searchParams.get("redirect_uri") !== redirectUri || authorization.searchParams.get("state") !== expectedState || authorization.searchParams.get("code_challenge_method") !== "S256") throw failure("Invalid native authorization request");
139
+ const expiresAt = new Date(Date.now() + timeoutMs);
140
+ timer = setTimeout(() => {
141
+ if (phase === "waiting") void finish(failure("Native sign-in expired"));
142
+ }, timeoutMs);
143
+ options.signal?.addEventListener("abort", abort, {
144
+ once: true
145
+ });
146
+ if (options.signal?.aborted) abort();
147
+ return {
148
+ authorizationUrl: flow?.url ?? authorization.toString(),
149
+ expiresAt,
150
+ completion,
151
+ state: /* @__PURE__ */ __name(() => phase, "state"),
152
+ cancel: /* @__PURE__ */ __name(() => {
153
+ if (phase !== "waiting") return false;
154
+ abort();
155
+ return true;
156
+ }, "cancel")
157
+ };
158
+ } catch {
159
+ await finish(failure("Native sign-in could not start"));
160
+ throw failure("Native sign-in could not start");
161
+ }
162
+ }
163
+ __name(startNativeSignIn, "startNativeSignIn");
164
+
165
+ // src/windows-host.ts
166
+ import { AsyncLocalStorage } from "node:async_hooks";
167
+ import { spawn } from "node:child_process";
168
+ import { createHash, createPublicKey, randomUUID, verify } from "node:crypto";
169
+ import { join } from "node:path";
170
+
171
+ // src/windows-host-helper.ts
172
+ var WINDOWS_ACCOUNT_HOST_HELPER = String.raw`
173
+ $ErrorActionPreference = 'Stop'
174
+ [Console]::InputEncoding = New-Object System.Text.UTF8Encoding($false, $true)
175
+ [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false, $true)
176
+ Add-Type -TypeDefinition @'
177
+ using System;
178
+ using System.Text;
179
+ using System.IO;
180
+ using System.Threading;
181
+ using System.Security.Cryptography;
182
+ using System.Security.AccessControl;
183
+ using System.Security.Principal;
184
+ using System.Runtime.InteropServices;
185
+ public static class XenoAccountWindowsHost {
186
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] struct Credential {
187
+ public uint Flags; public uint Type; public string TargetName; public string Comment;
188
+ public long LastWritten; public uint CredentialBlobSize; public IntPtr CredentialBlob;
189
+ public uint Persist; public uint AttributeCount; public IntPtr Attributes;
190
+ public string TargetAlias; public string UserName;
191
+ }
192
+ [DllImport("advapi32.dll", CharSet=CharSet.Unicode, SetLastError=true)] static extern bool CredReadW(string target, uint type, uint flags, out IntPtr credential);
193
+ [DllImport("advapi32.dll", CharSet=CharSet.Unicode, SetLastError=true)] static extern bool CredWriteW(ref Credential credential, uint flags);
194
+ [DllImport("advapi32.dll", CharSet=CharSet.Unicode, SetLastError=true)] static extern bool CredDeleteW(string target, uint type, uint flags);
195
+ [DllImport("advapi32.dll")] static extern void CredFree(IntPtr credential);
196
+ [DllImport("kernel32.dll", SetLastError=true)] static extern IntPtr OpenProcess(uint access, bool inherit, int pid);
197
+ [DllImport("kernel32.dll", SetLastError=true)] static extern bool GetProcessTimes(IntPtr process, out long creation, out long exit, out long kernel, out long user);
198
+ [DllImport("kernel32.dll")] static extern uint WaitForSingleObject(IntPtr process, uint milliseconds);
199
+ [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr handle);
200
+ [DllImport("kernel32.dll")] static extern IntPtr GetCurrentProcess();
201
+ [DllImport("ncrypt.dll", CharSet=CharSet.Unicode)] static extern int NCryptGetProperty(IntPtr handle, string name, byte[] output, int size, out int written, int flags);
202
+ static IntPtr parent;
203
+ static CngKey key;
204
+ static Mutex mutex;
205
+ static string lease, prefix, refreshKey, keyName;
206
+ static bool createdKey;
207
+ static volatile bool stopping;
208
+ static Thread monitor;
209
+ static readonly UTF8Encoding Utf8 = new UTF8Encoding(false, true);
210
+ static string Hash(string input) {
211
+ using (var h = SHA256.Create()) return BitConverter.ToString(h.ComputeHash(Utf8.GetBytes(input))).Replace("-", "").ToLowerInvariant();
212
+ }
213
+ static void ParentCurrent() {
214
+ long birth, exit, kernel, user, helperBirth;
215
+ if (parent == IntPtr.Zero || !GetProcessTimes(parent, out birth, out exit, out kernel, out user)
216
+ || !GetProcessTimes(GetCurrentProcess(), out helperBirth, out exit, out kernel, out user)
217
+ || birth >= helperBirth || WaitForSingleObject(parent, 0) != 258) throw new IOException("parent unavailable");
218
+ }
219
+ static void AssertLease(string input) {
220
+ ParentCurrent();
221
+ if (lease == null || input != lease) throw new IOException("exclusive lease required");
222
+ }
223
+ static string Target(string input, bool allowLegacyRead = false) {
224
+ if (input != refreshKey && input != refreshKey + "/pending" && !(allowLegacyRead && input == refreshKey + "-uncertain")) throw new IOException("foreign credential namespace");
225
+ return prefix + Hash(input);
226
+ }
227
+ static bool CredentialExists(string target) {
228
+ IntPtr pointer;
229
+ if (CredReadW(target, 1, 0, out pointer)) { CredFree(pointer); return true; }
230
+ if (Marshal.GetLastWin32Error() == 1168) return false;
231
+ throw new IOException("credential presence unavailable");
232
+ }
233
+ public static object Init(string clientId, string scope, int parentPid, bool create) {
234
+ if (key != null || parent != IntPtr.Zero || !System.Text.RegularExpressions.Regex.IsMatch(clientId, "^xeno-[a-z0-9][a-z0-9-]{0,63}$")
235
+ || !System.Text.RegularExpressions.Regex.IsMatch(scope, "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$")) throw new IOException("invalid host identity");
236
+ parent = OpenProcess(0x100000 | 0x1000, false, parentPid); ParentCurrent();
237
+ var observedParent = parent;
238
+ monitor = new Thread(() => {
239
+ while (!stopping) {
240
+ uint result = WaitForSingleObject(observedParent, 100);
241
+ if (!stopping && result != 258) Environment.Exit(75);
242
+ }
243
+ });
244
+ monitor.IsBackground = true; monitor.Start();
245
+ var identity = Hash("xeno/account/windows-host/1\0" + scope + "\0" + clientId);
246
+ prefix = "XENO.Account/" + identity + "/"; refreshKey = "xeno.account/" + clientId + "/refresh";
247
+ var owner = WindowsIdentity.GetCurrent().User;
248
+ var acl = new MutexSecurity(); acl.SetAccessRuleProtection(true, false); acl.SetOwner(owner);
249
+ acl.AddAccessRule(new MutexAccessRule(owner, MutexRights.FullControl, AccessControlType.Allow));
250
+ acl.AddAccessRule(new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null), MutexRights.FullControl, AccessControlType.Allow));
251
+ bool created;
252
+ mutex = new Mutex(false, "Global\\Xeno.Account." + Hash(owner.Value) + "." + identity, out created, acl);
253
+ var rules = mutex.GetAccessControl().GetAccessRules(true, true, typeof(SecurityIdentifier));
254
+ foreach (MutexAccessRule rule in rules) if (rule.AccessControlType == AccessControlType.Allow && rule.IdentityReference.Value != owner.Value
255
+ && rule.IdentityReference.Value != "S-1-5-18") throw new IOException("public mutex custody");
256
+ if (mutex.GetAccessControl().GetOwner(typeof(SecurityIdentifier)).Value != owner.Value) throw new IOException("foreign mutex owner");
257
+ keyName = "Xeno.Account." + identity;
258
+ var provider = new CngProvider("Microsoft Platform Crypto Provider");
259
+ bool held = false;
260
+ try {
261
+ try { held = mutex.WaitOne(5000); } catch (AbandonedMutexException) { held = true; throw new IOException("abandoned init"); }
262
+ if (!held) throw new IOException("init lock timeout"); ParentCurrent();
263
+ if (CngKey.Exists(keyName, provider)) key = CngKey.Open(keyName, provider);
264
+ else {
265
+ if (!create) throw new IOException("provisioned key required");
266
+ if (CredentialExists(Target(refreshKey)) || CredentialExists(Target(refreshKey + "/pending")))
267
+ throw new IOException("existing credential cannot change key");
268
+ var options = new CngKeyCreationParameters(); options.Provider = provider;
269
+ options.KeyUsage = CngKeyUsages.Signing; options.ExportPolicy = CngExportPolicies.None;
270
+ key = CngKey.Create(CngAlgorithm.ECDsaP256, keyName, options); createdKey = true;
271
+ }
272
+ if (key.Provider.Provider != "Microsoft Platform Crypto Provider" || key.ExportPolicy != CngExportPolicies.None
273
+ || key.IsMachineKey || key.AlgorithmGroup != CngAlgorithmGroup.ECDsa || key.KeyUsage != CngKeyUsages.Signing)
274
+ throw new IOException("key custody differs");
275
+ var implementation = new byte[4]; int implementationSize;
276
+ if (NCryptGetProperty(key.ProviderHandle.DangerousGetHandle(), "Impl Type", implementation, 4, out implementationSize, 0) != 0
277
+ || implementationSize != 4 || (BitConverter.ToInt32(implementation, 0) & 1) == 0) throw new IOException("hardware provider required");
278
+ var blob = key.Export(CngKeyBlobFormat.EccPublicBlob);
279
+ if (blob.Length != 72 || BitConverter.ToUInt32(blob, 0) != 0x31534345 || BitConverter.ToUInt32(blob, 4) != 32) throw new IOException("wrong P256 key");
280
+ ParentCurrent();
281
+ return new { publicBlob = Convert.ToBase64String(blob), provider = key.Provider.Provider,
282
+ exportPolicy = (int)key.ExportPolicy, hardwareImplementation = BitConverter.ToInt32(implementation, 0), createdKey = createdKey, keyName = keyName };
283
+ } finally { if (held) mutex.ReleaseMutex(); }
284
+ }
285
+ public static void Acquire(string input, int milliseconds) {
286
+ ParentCurrent(); if (lease != null || input == null || input.Length != 36 || milliseconds < 1 || milliseconds > 10000) throw new IOException("invalid lease");
287
+ bool held = false;
288
+ try {
289
+ try { held = mutex.WaitOne(milliseconds); } catch (AbandonedMutexException) { held = true; throw new IOException("abandoned lease"); }
290
+ if (!held) throw new IOException("lease timeout"); ParentCurrent(); lease = input;
291
+ } catch { if (held) mutex.ReleaseMutex(); throw; }
292
+ }
293
+ public static void Release(string input) {
294
+ AssertLease(input); lease = null; mutex.ReleaseMutex();
295
+ }
296
+ public static object Get(string input, string locked) {
297
+ AssertLease(locked); var target = Target(input, true); IntPtr pointer;
298
+ if (!CredReadW(target, 1, 0, out pointer)) {
299
+ if (Marshal.GetLastWin32Error() == 1168) return null;
300
+ throw new IOException("credential read unavailable");
301
+ }
302
+ byte[] bytes = null;
303
+ try {
304
+ var value = (Credential)Marshal.PtrToStructure(pointer, typeof(Credential));
305
+ if (value.Type != 1 || value.TargetName != target || value.Persist != 2 || value.CredentialBlobSize > 2560
306
+ || value.AttributeCount != 0) throw new IOException("credential profile differs");
307
+ bytes = new byte[value.CredentialBlobSize]; Marshal.Copy(value.CredentialBlob, bytes, 0, bytes.Length);
308
+ var result = Utf8.GetString(bytes); ParentCurrent(); return result;
309
+ } finally { if (bytes != null) Array.Clear(bytes, 0, bytes.Length); CredFree(pointer); }
310
+ }
311
+ public static void Set(string input, string text, string locked) {
312
+ AssertLease(locked); var target = Target(input); var bytes = Utf8.GetBytes(text);
313
+ if (bytes.Length > 2560) throw new IOException("credential bound");
314
+ IntPtr buffer = Marshal.AllocHGlobal(bytes.Length);
315
+ try {
316
+ Marshal.Copy(bytes, 0, buffer, bytes.Length);
317
+ var value = new Credential { Type = 1, TargetName = target, CredentialBlob = buffer,
318
+ CredentialBlobSize = (uint)bytes.Length, Persist = 2, UserName = "XENO Account" };
319
+ if (!CredWriteW(ref value, 0)) throw new IOException("credential write unavailable"); ParentCurrent();
320
+ } finally { for (int i=0;i<bytes.Length;i++) Marshal.WriteByte(buffer, i, 0); Marshal.FreeHGlobal(buffer); Array.Clear(bytes, 0, bytes.Length); }
321
+ }
322
+ public static void Delete(string input, string locked) {
323
+ AssertLease(locked); if (!CredDeleteW(Target(input), 1, 0) && Marshal.GetLastWin32Error() != 1168) throw new IOException("credential deletion unavailable"); ParentCurrent();
324
+ }
325
+ public static object Sign(string encoded) {
326
+ ParentCurrent(); var hash = Convert.FromBase64String(encoded); if (hash.Length != 32) throw new IOException("SHA256 bound");
327
+ using (var signer = new ECDsaCng(key)) {
328
+ var result = signer.SignHash(hash); if (result.Length != 64) throw new IOException("signature bound");
329
+ ParentCurrent(); return Convert.ToBase64String(result);
330
+ }
331
+ }
332
+ public static void Close(bool deleteCreated) {
333
+ bool cleanupHeld = false;
334
+ if (deleteCreated) {
335
+ if (!createdKey || lease != null) throw new IOException("original idle cleanup owner required");
336
+ try { cleanupHeld = mutex.WaitOne(5000); } catch (AbandonedMutexException) { mutex.ReleaseMutex(); throw new IOException("abandoned cleanup"); }
337
+ if (!cleanupHeld) throw new IOException("cleanup timeout");
338
+ try {
339
+ ParentCurrent();
340
+ if (CredentialExists(Target(refreshKey)) || CredentialExists(Target(refreshKey + "/pending"))) throw new IOException("qualification key cleanup requires empty vault");
341
+ } catch { mutex.ReleaseMutex(); throw; }
342
+ }
343
+ try {
344
+ stopping = true;
345
+ if (monitor != null) { if (!monitor.Join(1000)) throw new IOException("parent monitor did not stop"); monitor = null; }
346
+ if (lease != null) { mutex.ReleaseMutex(); lease = null; }
347
+ if (key != null) { if (deleteCreated) key.Delete(); key.Dispose(); key=null; }
348
+ if (mutex != null) { if (cleanupHeld) mutex.ReleaseMutex(); mutex.Dispose(); mutex=null; }
349
+ if (parent != IntPtr.Zero) { CloseHandle(parent); parent=IntPtr.Zero; }
350
+ } catch { Environment.Exit(76); }
351
+ }
352
+ }
353
+ '@
354
+ try {
355
+ while ($null -ne ($line = [Console]::ReadLine())) {
356
+ if ($line.Length -gt 50000) { break }
357
+ $request = $null
358
+ try {
359
+ $request = $line | ConvertFrom-Json
360
+ $value = $null
361
+ switch ($request.op) {
362
+ 'init' { $value = [XenoAccountWindowsHost]::Init($request.clientId, $request.namespace, [int]$request.parentPid, [bool]$request.createKey) }
363
+ 'acquire' { [XenoAccountWindowsHost]::Acquire($request.lease, [int]$request.waitMs) }
364
+ 'release' { [XenoAccountWindowsHost]::Release($request.lease) }
365
+ 'get' { $value = [XenoAccountWindowsHost]::Get($request.key, $request.lease) }
366
+ 'set' { [XenoAccountWindowsHost]::Set($request.key, $request.value, $request.lease) }
367
+ 'delete' { [XenoAccountWindowsHost]::Delete($request.key, $request.lease) }
368
+ 'sign' { $value = [XenoAccountWindowsHost]::Sign($request.hash) }
369
+ 'close' { [XenoAccountWindowsHost]::Close([bool]$request.deleteCreatedKey) }
370
+ default { throw 'unsupported request' }
371
+ }
372
+ [Console]::WriteLine((@{id=$request.id;ok=$true;value=$value} | ConvertTo-Json -Depth 4 -Compress))
373
+ if ($request.op -eq 'close') { break }
374
+ } catch {
375
+ [Console]::WriteLine((@{id=$request.id;ok=$false;code='WINDOWS_ACCOUNT_HOST_REFUSED'} | ConvertTo-Json -Compress))
376
+ if ($null -eq $request -or $request.op -eq 'init') { break }
377
+ }
378
+ }
379
+ } finally { [XenoAccountWindowsHost]::Close($false) }
380
+ `;
381
+
382
+ // src/windows-host.ts
383
+ var MAX_PIPE_BYTES = 65536;
384
+ function refused() {
385
+ return new AccountError({
386
+ code: "UNREACHABLE",
387
+ message: "Windows account host authority is unavailable",
388
+ retryable: false
389
+ });
390
+ }
391
+ __name(refused, "refused");
392
+ async function createWindowsAccountHost(options) {
393
+ if (process.platform !== "win32") throw refused();
394
+ const clientId = options.clientId, namespace = options.namespace ?? clientId;
395
+ const timeoutMs = options.timeoutMs ?? 15e3, waitMs = options.lockTimeoutMs ?? 5e3;
396
+ const transactionTimeoutMs = options.transactionTimeoutMs ?? timeoutMs;
397
+ if (typeof clientId !== "string" || typeof namespace !== "string" || !/^xeno-[a-z0-9][a-z0-9-]{0,63}$/.test(clientId) || !/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/.test(namespace) || !Number.isSafeInteger(timeoutMs) || timeoutMs < 1e3 || timeoutMs > 6e4 || !Number.isSafeInteger(waitMs) || waitMs < 1 || waitMs > 1e4 || timeoutMs <= waitMs || !Number.isSafeInteger(transactionTimeoutMs) || transactionTimeoutMs < 100 || transactionTimeoutMs > 6e4 || options.createKey !== void 0 && typeof options.createKey !== "boolean") throw refused();
398
+ const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT;
399
+ if (!systemRoot) throw refused();
400
+ const executable = join(systemRoot, "System32/WindowsPowerShell/v1.0/powershell.exe");
401
+ const child = spawn(executable, [
402
+ "-NoLogo",
403
+ "-NoProfile",
404
+ "-NonInteractive",
405
+ "-Command",
406
+ WINDOWS_ACCOUNT_HOST_HELPER
407
+ ], {
408
+ windowsHide: true,
409
+ stdio: [
410
+ "pipe",
411
+ "pipe",
412
+ "pipe"
413
+ ],
414
+ cwd: systemRoot,
415
+ env: {
416
+ SystemRoot: systemRoot,
417
+ WINDIR: systemRoot,
418
+ TEMP: process.env.TEMP,
419
+ TMP: process.env.TMP
420
+ }
421
+ });
422
+ const rpc = new WindowsHostRpc(child, timeoutMs);
423
+ let initialization;
424
+ try {
425
+ initialization = await rpc.request("init", {
426
+ clientId,
427
+ namespace,
428
+ parentPid: process.pid,
429
+ createKey: options.createKey === true
430
+ });
431
+ } catch {
432
+ await rpc.kill();
433
+ throw refused();
434
+ }
435
+ if (!initialization || typeof initialization !== "object") {
436
+ await rpc.kill();
437
+ throw refused();
438
+ }
439
+ const value = initialization;
440
+ const identity = createHash("sha256").update(`xeno/account/windows-host/1\0${namespace}\0${clientId}`).digest("hex");
441
+ if (value.provider !== "Microsoft Platform Crypto Provider" || value.exportPolicy !== 0 || !Number.isInteger(value.hardwareImplementation) || (Number(value.hardwareImplementation) & 1) === 0 || typeof value.createdKey !== "boolean" || value.keyName !== `Xeno.Account.${identity}` || typeof value.publicBlob !== "string") {
442
+ await rpc.kill();
443
+ throw refused();
444
+ }
445
+ const blob = Buffer.from(value.publicBlob, "base64");
446
+ if (blob.length !== 72 || blob.readUInt32LE(0) !== 827540293 || blob.readUInt32LE(4) !== 32) {
447
+ await rpc.kill();
448
+ throw refused();
449
+ }
450
+ const publicJwk = {
451
+ kty: "EC",
452
+ crv: "P-256",
453
+ x: blob.subarray(8, 40).toString("base64url"),
454
+ y: blob.subarray(40).toString("base64url")
455
+ };
456
+ const jkt = createHash("sha256").update(JSON.stringify({
457
+ crv: publicJwk.crv,
458
+ kty: publicJwk.kty,
459
+ x: publicJwk.x,
460
+ y: publicJwk.y
461
+ })).digest("base64url");
462
+ const publicKey = createPublicKey({
463
+ key: publicJwk,
464
+ format: "jwk"
465
+ });
466
+ const context = new AsyncLocalStorage();
467
+ let tail = Promise.resolve(), locks = 0, closed = false, closing = false;
468
+ const refreshKey = `xeno.account/${clientId}/refresh`;
469
+ const legacyUncertainKey = `${refreshKey}-uncertain`;
470
+ const current = /* @__PURE__ */ __name(() => {
471
+ if (closed || closing || rpc.failed) throw refused();
472
+ }, "current");
473
+ const validKey = /* @__PURE__ */ __name((key, allowLegacyRead = false) => {
474
+ current();
475
+ if (key !== refreshKey && key !== `${refreshKey}/pending` && !(allowLegacyRead && key === legacyUncertainKey)) throw refused();
476
+ }, "validKey");
477
+ const exclusive = /* @__PURE__ */ __name(async (key, work) => {
478
+ validKey(key);
479
+ if (context.getStore() || locks >= 64) throw refused();
480
+ locks++;
481
+ const prior = tail;
482
+ let release;
483
+ tail = new Promise((resolve) => {
484
+ release = resolve;
485
+ });
486
+ await prior;
487
+ const lease = {
488
+ id: randomUUID(),
489
+ active: true
490
+ };
491
+ let acquired = false;
492
+ try {
493
+ current();
494
+ await rpc.request("acquire", {
495
+ lease: lease.id,
496
+ waitMs
497
+ });
498
+ acquired = true;
499
+ let timer;
500
+ try {
501
+ return await Promise.race([
502
+ context.run(lease, work),
503
+ new Promise((_resolve, reject) => {
504
+ timer = setTimeout(() => {
505
+ lease.active = false;
506
+ void rpc.kill();
507
+ reject(refused());
508
+ }, transactionTimeoutMs);
509
+ })
510
+ ]);
511
+ } finally {
512
+ if (timer) clearTimeout(timer);
513
+ }
514
+ } finally {
515
+ lease.active = false;
516
+ try {
517
+ if (acquired && !rpc.failed) await rpc.request("release", {
518
+ lease: lease.id
519
+ });
520
+ } finally {
521
+ locks--;
522
+ release();
523
+ }
524
+ }
525
+ }, "exclusive");
526
+ const storageRequest = /* @__PURE__ */ __name(async (op, key, input = {}) => {
527
+ validKey(key, op === "get");
528
+ const lease = context.getStore();
529
+ if (lease) {
530
+ if (!lease.active) throw refused();
531
+ return rpc.request(op, {
532
+ ...input,
533
+ key,
534
+ lease: lease.id
535
+ });
536
+ }
537
+ return exclusive(refreshKey, () => storageRequest(op, key, input));
538
+ }, "storageRequest");
539
+ const store = {
540
+ withExclusive: exclusive,
541
+ async get(key) {
542
+ const result = await storageRequest("get", key);
543
+ if (result !== null && typeof result !== "string") throw refused();
544
+ return result;
545
+ },
546
+ async set(key, text) {
547
+ if (typeof text !== "string" || Buffer.byteLength(text, "utf8") > 2560) throw refused();
548
+ await storageRequest("set", key, {
549
+ value: text
550
+ });
551
+ },
552
+ async delete(key) {
553
+ await storageRequest("delete", key);
554
+ }
555
+ };
556
+ const dpopSigner = {
557
+ jkt,
558
+ async createProof(args) {
559
+ current();
560
+ if (!args || typeof args.method !== "string" || typeof args.url !== "string" || args.url.length > 8192 || args.accessToken !== void 0 && (typeof args.accessToken !== "string" || args.accessToken.length > 16384 || !/^[\x21-\x7e]+$/.test(args.accessToken)) || args.nonce !== void 0 && (typeof args.nonce !== "string" || args.nonce.length > 4096 || /[\r\n]/.test(args.nonce))) throw refused();
561
+ const method = args.method.toUpperCase();
562
+ let url;
563
+ try {
564
+ url = new URL(args.url);
565
+ } catch {
566
+ throw refused();
567
+ }
568
+ if (!/^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)$/.test(method) || url.username || url.password || url.protocol !== "https:") throw refused();
569
+ const header = {
570
+ alg: "ES256",
571
+ typ: "dpop+jwt",
572
+ jwk: publicJwk
573
+ };
574
+ const claims = {
575
+ jti: randomUUID(),
576
+ htm: method,
577
+ htu: normalizeDpopHtu(args.url),
578
+ iat: Math.floor(Date.now() / 1e3),
579
+ ...args.accessToken ? {
580
+ ath: createHash("sha256").update(args.accessToken).digest("base64url")
581
+ } : {},
582
+ ...args.nonce ? {
583
+ nonce: args.nonce
584
+ } : {}
585
+ };
586
+ const a = Buffer.from(JSON.stringify(header)).toString("base64url"), b = Buffer.from(JSON.stringify(claims)).toString("base64url");
587
+ const signingInput = Buffer.from(`${a}.${b}`);
588
+ const signature = await rpc.request("sign", {
589
+ hash: createHash("sha256").update(signingInput).digest("base64")
590
+ });
591
+ if (typeof signature !== "string") throw refused();
592
+ const bytes = Buffer.from(signature, "base64");
593
+ if (bytes.length !== 64 || !verify("sha256", signingInput, {
594
+ key: publicKey,
595
+ dsaEncoding: "ieee-p1363"
596
+ }, bytes)) throw refused();
597
+ current();
598
+ return `${a}.${b}.${bytes.toString("base64url")}`;
599
+ }
600
+ };
601
+ return {
602
+ store,
603
+ dpopSigner,
604
+ custody: {
605
+ kind: "windows-credential-manager+tpm",
606
+ hardwareBacked: true,
607
+ nonExportable: true,
608
+ createdKey: value.createdKey,
609
+ keyName: String(value.keyName)
610
+ },
611
+ async close(input = {}) {
612
+ if (closed) return;
613
+ if (closing || locks || rpc.activeRequests || input.deleteCreatedKey && !value.createdKey) throw refused();
614
+ closing = true;
615
+ try {
616
+ await rpc.request("close", {
617
+ deleteCreatedKey: input.deleteCreatedKey === true
618
+ });
619
+ closed = true;
620
+ } catch (error) {
621
+ if (rpc.failed) closed = true;
622
+ throw error;
623
+ } finally {
624
+ closing = false;
625
+ if (closed) await rpc.kill();
626
+ }
627
+ }
628
+ };
629
+ }
630
+ __name(createWindowsAccountHost, "createWindowsAccountHost");
631
+ var WindowsHostRpc = class WindowsHostRpc2 {
632
+ static {
633
+ __name(this, "WindowsHostRpc");
634
+ }
635
+ child;
636
+ timeoutMs;
637
+ exited;
638
+ failed = false;
639
+ pending = /* @__PURE__ */ new Map();
640
+ buffer = Buffer.alloc(0);
641
+ get activeRequests() {
642
+ return this.pending.size;
643
+ }
644
+ constructor(child, timeoutMs) {
645
+ this.child = child;
646
+ this.timeoutMs = timeoutMs;
647
+ this.exited = new Promise((resolve) => {
648
+ child.once("exit", () => {
649
+ this.fail();
650
+ resolve();
651
+ });
652
+ child.once("error", () => {
653
+ this.fail();
654
+ resolve();
655
+ });
656
+ });
657
+ child.stderr.resume();
658
+ child.stdout.on("data", (chunk) => {
659
+ this.buffer = Buffer.concat([
660
+ this.buffer,
661
+ chunk
662
+ ]);
663
+ if (this.buffer.byteLength > MAX_PIPE_BYTES) {
664
+ this.fail();
665
+ void this.kill();
666
+ return;
667
+ }
668
+ for (let newline; (newline = this.buffer.indexOf(10)) >= 0; ) {
669
+ const bytes = this.buffer.subarray(0, newline);
670
+ this.buffer = this.buffer.subarray(newline + 1);
671
+ let reply;
672
+ try {
673
+ reply = JSON.parse(new TextDecoder("utf-8", {
674
+ fatal: true
675
+ }).decode(bytes));
676
+ } catch {
677
+ this.fail();
678
+ void this.kill();
679
+ return;
680
+ }
681
+ const item = reply && this.pending.get(reply.id);
682
+ if (!item || typeof reply.ok !== "boolean") {
683
+ this.fail();
684
+ void this.kill();
685
+ return;
686
+ }
687
+ clearTimeout(item.timer);
688
+ this.pending.delete(reply.id);
689
+ if (reply.ok) item.resolve(reply.value);
690
+ else item.reject(refused());
691
+ }
692
+ });
693
+ for (const stream of [
694
+ child.stdin,
695
+ child.stdout,
696
+ child.stderr
697
+ ]) {
698
+ stream.on("error", () => {
699
+ this.fail();
700
+ void this.kill();
701
+ });
702
+ }
703
+ }
704
+ request(op, values = {}) {
705
+ if (this.failed || this.pending.size >= 128) return Promise.reject(refused());
706
+ const id = randomUUID(), line = JSON.stringify({
707
+ ...values,
708
+ id,
709
+ op
710
+ }) + "\n";
711
+ if (Buffer.byteLength(line) > MAX_PIPE_BYTES) return Promise.reject(refused());
712
+ return new Promise((resolve, reject) => {
713
+ const timer = setTimeout(() => {
714
+ this.fail();
715
+ void this.kill();
716
+ }, this.timeoutMs);
717
+ this.pending.set(id, {
718
+ resolve,
719
+ reject,
720
+ timer
721
+ });
722
+ try {
723
+ this.child.stdin.write(line);
724
+ } catch {
725
+ this.fail();
726
+ void this.kill();
727
+ }
728
+ });
729
+ }
730
+ fail() {
731
+ this.failed = true;
732
+ for (const item of this.pending.values()) {
733
+ clearTimeout(item.timer);
734
+ item.reject(refused());
735
+ }
736
+ this.pending.clear();
737
+ }
738
+ async kill() {
739
+ this.fail();
740
+ if (this.child.exitCode !== null || this.child.signalCode !== null) return;
741
+ this.child.stdin.end();
742
+ this.child.kill();
743
+ await this.exited;
744
+ }
745
+ };
746
+
747
+ // src/linux-host.ts
748
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
749
+ import { spawn as spawn2 } from "node:child_process";
750
+ import { createHash as createHash2, createPrivateKey, generateKeyPairSync, randomUUID as randomUUID2, sign } from "node:crypto";
751
+ import { closeSync, fsyncSync, linkSync, lstatSync, mkdirSync, openSync, readFileSync, renameSync, statSync, unlinkSync, writeSync } from "node:fs";
752
+ import { delimiter, isAbsolute, join as join2 } from "node:path";
753
+ import { hostname, tmpdir } from "node:os";
754
+ var VALUE_PREFIX = "xa1:";
755
+ var MAX_VALUE_BYTES = 2560;
756
+ var MAX_KEY_BYTES = 1024;
757
+ function refused2() {
758
+ return new AccountError({
759
+ code: "UNREACHABLE",
760
+ message: "Linux account host authority is unavailable",
761
+ retryable: false
762
+ });
763
+ }
764
+ __name(refused2, "refused");
765
+ async function createLinuxAccountHost(options) {
766
+ if (process.platform !== "linux") throw refused2();
767
+ const timeoutMs = options.timeoutMs ?? 15e3;
768
+ const tool = findSecretTool();
769
+ return openLinuxAccountHost(options, {
770
+ secretTool: tool ? secretToolRunner(tool, timeoutMs) : null,
771
+ lockDirectory: runtimeLockDirectory()
772
+ });
773
+ }
774
+ __name(createLinuxAccountHost, "createLinuxAccountHost");
775
+ async function openLinuxAccountHost(options, deps) {
776
+ const clientId = options.clientId, namespace = options.namespace ?? clientId;
777
+ const timeoutMs = options.timeoutMs ?? 15e3, waitMs = options.lockTimeoutMs ?? 5e3;
778
+ const transactionTimeoutMs = options.transactionTimeoutMs ?? timeoutMs;
779
+ if (typeof clientId !== "string" || typeof namespace !== "string" || !/^xeno-[a-z0-9][a-z0-9-]{0,63}$/.test(clientId) || !/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/.test(namespace) || !Number.isSafeInteger(timeoutMs) || timeoutMs < 1e3 || timeoutMs > 12e4 || !Number.isSafeInteger(waitMs) || waitMs < 1 || waitMs > 1e4 || !Number.isSafeInteger(transactionTimeoutMs) || transactionTimeoutMs < 100 || transactionTimeoutMs > 12e4 || options.createKey !== void 0 && typeof options.createKey !== "boolean") throw refused2();
780
+ const identity = createHash2("sha256").update(`xeno/account/linux-host/1\0${namespace}\0${clientId}`).digest("hex");
781
+ const keyName = `Xeno.Account.${identity}`;
782
+ const refreshKey = `xeno.account/${clientId}/refresh`;
783
+ const keyring = deps.secretTool ? new Keyring(deps.secretTool, identity, clientId) : null;
784
+ let custody, privateKey, publicJwk;
785
+ let persistent;
786
+ const stored = keyring ? await keyring.read("dpop-key").catch(() => void 0) : void 0;
787
+ if (typeof stored === "string") {
788
+ ({ privateKey, publicJwk } = parsePrivateJwk(stored));
789
+ persistent = true;
790
+ custody = {
791
+ kind: "linux-secret-service+software-key",
792
+ hardwareBacked: false,
793
+ nonExportable: false,
794
+ persistent: true,
795
+ createdKey: false,
796
+ keyName
797
+ };
798
+ } else {
799
+ if (options.createKey !== true) throw refused2();
800
+ const generated = generateKeyPairSync("ec", {
801
+ namedCurve: "P-256"
802
+ });
803
+ const jwk = JSON.stringify(generated.privateKey.export({
804
+ format: "jwk"
805
+ }));
806
+ ({ privateKey, publicJwk } = parsePrivateJwk(jwk));
807
+ if (keyring && stored === null && await keyring.works()) {
808
+ if (await keyring.read("refresh") !== null || await keyring.read("pending") !== null) throw refused2();
809
+ await keyring.write("dpop-key", jwk);
810
+ persistent = true;
811
+ custody = {
812
+ kind: "linux-secret-service+software-key",
813
+ hardwareBacked: false,
814
+ nonExportable: false,
815
+ persistent: true,
816
+ createdKey: true,
817
+ keyName
818
+ };
819
+ } else {
820
+ persistent = false;
821
+ custody = {
822
+ kind: "linux-session-memory+software-key",
823
+ hardwareBacked: false,
824
+ nonExportable: false,
825
+ persistent: false,
826
+ createdKey: true,
827
+ keyName
828
+ };
829
+ }
830
+ }
831
+ const jkt = createHash2("sha256").update(JSON.stringify({
832
+ crv: publicJwk.crv,
833
+ kty: publicJwk.kty,
834
+ x: publicJwk.x,
835
+ y: publicJwk.y
836
+ })).digest("base64url");
837
+ const memory = /* @__PURE__ */ new Map();
838
+ const lock = persistent ? new ProcessLock(deps.lockDirectory, identity) : null;
839
+ const context = new AsyncLocalStorage2();
840
+ let tail = Promise.resolve(), locks = 0, closed = false, closing = false, failed = false;
841
+ const current = /* @__PURE__ */ __name(() => {
842
+ if (closed || closing || failed) throw refused2();
843
+ }, "current");
844
+ const itemOf = /* @__PURE__ */ __name((key) => {
845
+ current();
846
+ if (key === refreshKey) return "refresh";
847
+ if (key === `${refreshKey}/pending`) return "pending";
848
+ throw refused2();
849
+ }, "itemOf");
850
+ const exclusive = /* @__PURE__ */ __name(async (key, work) => {
851
+ itemOf(key);
852
+ if (context.getStore() || locks >= 64) throw refused2();
853
+ locks++;
854
+ const prior = tail;
855
+ let release;
856
+ tail = new Promise((resolve) => {
857
+ release = resolve;
858
+ });
859
+ await prior;
860
+ const lease = {
861
+ id: randomUUID2(),
862
+ active: true
863
+ };
864
+ let acquired = false;
865
+ try {
866
+ current();
867
+ if (lock) {
868
+ await lock.acquire(waitMs);
869
+ acquired = true;
870
+ }
871
+ let timer;
872
+ try {
873
+ return await Promise.race([
874
+ context.run(lease, work),
875
+ new Promise((_resolve, reject) => {
876
+ timer = setTimeout(() => {
877
+ lease.active = false;
878
+ failed = true;
879
+ reject(refused2());
880
+ }, transactionTimeoutMs);
881
+ })
882
+ ]);
883
+ } finally {
884
+ if (timer) clearTimeout(timer);
885
+ }
886
+ } finally {
887
+ lease.active = false;
888
+ try {
889
+ if (acquired && lock && !lock.release()) failed = true;
890
+ } finally {
891
+ locks--;
892
+ release();
893
+ }
894
+ }
895
+ }, "exclusive");
896
+ const storage = /* @__PURE__ */ __name(async (key, operation) => {
897
+ const item = itemOf(key);
898
+ const lease = context.getStore();
899
+ if (lease) {
900
+ if (!lease.active) throw refused2();
901
+ try {
902
+ return await operation(item);
903
+ } catch {
904
+ if (persistent) failed = true;
905
+ throw refused2();
906
+ }
907
+ }
908
+ return exclusive(refreshKey, () => storage(key, operation));
909
+ }, "storage");
910
+ const store = {
911
+ withExclusive: exclusive,
912
+ async get(key) {
913
+ if (key === `${refreshKey}-uncertain`) {
914
+ current();
915
+ return null;
916
+ }
917
+ return storage(key, async (item) => {
918
+ if (!keyring || !persistent) return memory.get(item) ?? null;
919
+ const value = await keyring.read(item);
920
+ if (value !== null && typeof value !== "string") throw refused2();
921
+ return value;
922
+ });
923
+ },
924
+ async set(key, text) {
925
+ if (typeof text !== "string" || Buffer.byteLength(text, "utf8") > MAX_VALUE_BYTES) throw refused2();
926
+ await storage(key, async (item) => {
927
+ if (!keyring || !persistent) {
928
+ memory.set(item, text);
929
+ return;
930
+ }
931
+ await keyring.write(item, text);
932
+ });
933
+ },
934
+ async delete(key) {
935
+ await storage(key, async (item) => {
936
+ if (!keyring || !persistent) {
937
+ memory.delete(item);
938
+ return;
939
+ }
940
+ await keyring.remove(item);
941
+ });
942
+ }
943
+ };
944
+ const dpopSigner = {
945
+ jkt,
946
+ async createProof(args) {
947
+ current();
948
+ if (!args || typeof args.method !== "string" || typeof args.url !== "string" || args.url.length > 8192 || args.accessToken !== void 0 && (typeof args.accessToken !== "string" || args.accessToken.length > 16384 || !/^[\x21-\x7e]+$/.test(args.accessToken)) || args.nonce !== void 0 && (typeof args.nonce !== "string" || args.nonce.length > 4096 || /[\r\n]/.test(args.nonce))) throw refused2();
949
+ const method = args.method.toUpperCase();
950
+ let url;
951
+ try {
952
+ url = new URL(args.url);
953
+ } catch {
954
+ throw refused2();
955
+ }
956
+ if (!/^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)$/.test(method) || url.username || url.password || url.protocol !== "https:") throw refused2();
957
+ const header = {
958
+ alg: "ES256",
959
+ typ: "dpop+jwt",
960
+ jwk: publicJwk
961
+ };
962
+ const claims = {
963
+ jti: randomUUID2(),
964
+ htm: method,
965
+ htu: normalizeDpopHtu(args.url),
966
+ iat: Math.floor(Date.now() / 1e3),
967
+ ...args.accessToken ? {
968
+ ath: createHash2("sha256").update(args.accessToken).digest("base64url")
969
+ } : {},
970
+ ...args.nonce ? {
971
+ nonce: args.nonce
972
+ } : {}
973
+ };
974
+ const a = Buffer.from(JSON.stringify(header)).toString("base64url"), b = Buffer.from(JSON.stringify(claims)).toString("base64url");
975
+ const signature = sign("sha256", Buffer.from(`${a}.${b}`), {
976
+ key: privateKey,
977
+ dsaEncoding: "ieee-p1363"
978
+ });
979
+ if (signature.length !== 64) throw refused2();
980
+ return `${a}.${b}.${signature.toString("base64url")}`;
981
+ }
982
+ };
983
+ return {
984
+ store,
985
+ dpopSigner,
986
+ custody,
987
+ async close(input = {}) {
988
+ if (closed) return;
989
+ if (closing || locks || input.deleteCreatedKey && !custody.createdKey) throw refused2();
990
+ closing = true;
991
+ try {
992
+ if (input.deleteCreatedKey && keyring && persistent) await keyring.remove("dpop-key");
993
+ memory.clear();
994
+ closed = true;
995
+ } catch {
996
+ throw refused2();
997
+ } finally {
998
+ closing = false;
999
+ }
1000
+ }
1001
+ };
1002
+ }
1003
+ __name(openLinuxAccountHost, "openLinuxAccountHost");
1004
+ function parsePrivateJwk(text) {
1005
+ if (Buffer.byteLength(text, "utf8") > MAX_KEY_BYTES) throw refused2();
1006
+ let jwk;
1007
+ try {
1008
+ jwk = JSON.parse(text);
1009
+ } catch {
1010
+ throw refused2();
1011
+ }
1012
+ if (jwk.kty !== "EC" || jwk.crv !== "P-256" || typeof jwk.x !== "string" || typeof jwk.y !== "string" || typeof jwk.d !== "string") throw refused2();
1013
+ try {
1014
+ const privateKey = createPrivateKey({
1015
+ key: jwk,
1016
+ format: "jwk"
1017
+ });
1018
+ return {
1019
+ privateKey,
1020
+ publicJwk: {
1021
+ kty: "EC",
1022
+ crv: "P-256",
1023
+ x: jwk.x,
1024
+ y: jwk.y
1025
+ }
1026
+ };
1027
+ } catch {
1028
+ throw refused2();
1029
+ }
1030
+ }
1031
+ __name(parsePrivateJwk, "parsePrivateJwk");
1032
+ var Keyring = class Keyring2 {
1033
+ static {
1034
+ __name(this, "Keyring");
1035
+ }
1036
+ run;
1037
+ identity;
1038
+ clientId;
1039
+ constructor(run, identity, clientId) {
1040
+ this.run = run;
1041
+ this.identity = identity;
1042
+ this.clientId = clientId;
1043
+ }
1044
+ attributes(item) {
1045
+ return [
1046
+ "xeno-account",
1047
+ this.identity,
1048
+ "item",
1049
+ item
1050
+ ];
1051
+ }
1052
+ /** `null` = no such item; throws when the keyring itself did not answer. */
1053
+ async read(item) {
1054
+ const result = await this.run([
1055
+ "lookup",
1056
+ ...this.attributes(item)
1057
+ ]);
1058
+ if (result.code === 1 && !result.stdout && !result.stderr.trim()) return null;
1059
+ if (result.code !== 0) throw refused2();
1060
+ const raw = result.stdout.replace(/\n$/, "");
1061
+ if (!raw.startsWith(VALUE_PREFIX)) throw refused2();
1062
+ const bytes = Buffer.from(raw.slice(VALUE_PREFIX.length), "base64");
1063
+ try {
1064
+ return new TextDecoder("utf-8", {
1065
+ fatal: true
1066
+ }).decode(bytes);
1067
+ } catch {
1068
+ throw refused2();
1069
+ }
1070
+ }
1071
+ async write(item, value) {
1072
+ const encoded = VALUE_PREFIX + Buffer.from(value, "utf8").toString("base64");
1073
+ const result = await this.run([
1074
+ "store",
1075
+ `--label=XENO account ${this.clientId} (${item})`,
1076
+ ...this.attributes(item)
1077
+ ], encoded);
1078
+ if (result.code !== 0 || await this.read(item) !== value) throw refused2();
1079
+ }
1080
+ async remove(item) {
1081
+ await this.run([
1082
+ "clear",
1083
+ ...this.attributes(item)
1084
+ ]);
1085
+ if (await this.read(item) !== null) throw refused2();
1086
+ }
1087
+ /** Proves the keyring stores, returns and clears a value before anything is committed to it. */
1088
+ async works() {
1089
+ const probe = `probe-${randomUUID2()}`;
1090
+ try {
1091
+ await this.write("probe", probe);
1092
+ await this.remove("probe");
1093
+ return true;
1094
+ } catch {
1095
+ try {
1096
+ await this.run([
1097
+ "clear",
1098
+ ...this.attributes("probe")
1099
+ ]);
1100
+ } catch {
1101
+ }
1102
+ return false;
1103
+ }
1104
+ }
1105
+ };
1106
+ function findSecretTool() {
1107
+ for (const directory of (process.env.PATH ?? "").split(delimiter)) {
1108
+ if (!directory || !isAbsolute(directory)) continue;
1109
+ const candidate = join2(directory, "secret-tool");
1110
+ try {
1111
+ if (statSync(candidate).isFile()) return candidate;
1112
+ } catch {
1113
+ }
1114
+ }
1115
+ return null;
1116
+ }
1117
+ __name(findSecretTool, "findSecretTool");
1118
+ function secretToolRunner(executable, timeoutMs) {
1119
+ const allowed = [
1120
+ "PATH",
1121
+ "HOME",
1122
+ "USER",
1123
+ "LOGNAME",
1124
+ "DBUS_SESSION_BUS_ADDRESS",
1125
+ "XDG_RUNTIME_DIR",
1126
+ "DISPLAY",
1127
+ "WAYLAND_DISPLAY",
1128
+ "XAUTHORITY"
1129
+ ];
1130
+ const env = {
1131
+ LC_ALL: "C"
1132
+ };
1133
+ for (const name of allowed) {
1134
+ const value = process.env[name];
1135
+ if (value) env[name] = value;
1136
+ }
1137
+ return (args, input) => new Promise((resolve, reject) => {
1138
+ const child = spawn2(executable, args, {
1139
+ stdio: [
1140
+ "pipe",
1141
+ "pipe",
1142
+ "pipe"
1143
+ ],
1144
+ env,
1145
+ windowsHide: true
1146
+ });
1147
+ let stdout = "", stderr = "", settled = false;
1148
+ const finish = /* @__PURE__ */ __name((fn) => {
1149
+ if (!settled) {
1150
+ settled = true;
1151
+ clearTimeout(timer);
1152
+ fn();
1153
+ }
1154
+ }, "finish");
1155
+ const timer = setTimeout(() => {
1156
+ child.kill("SIGKILL");
1157
+ finish(() => reject(refused2()));
1158
+ }, timeoutMs);
1159
+ child.stdout.setEncoding("utf8").on("data", (chunk) => {
1160
+ stdout += chunk;
1161
+ if (stdout.length > 16384) {
1162
+ child.kill("SIGKILL");
1163
+ finish(() => reject(refused2()));
1164
+ }
1165
+ });
1166
+ child.stderr.setEncoding("utf8").on("data", (chunk) => {
1167
+ stderr += chunk;
1168
+ if (stderr.length > 16384) stderr = stderr.slice(-16384);
1169
+ });
1170
+ child.once("error", () => finish(() => reject(refused2())));
1171
+ child.once("close", (code) => finish(() => resolve({
1172
+ code,
1173
+ stdout,
1174
+ stderr
1175
+ })));
1176
+ child.stdin.on("error", () => {
1177
+ });
1178
+ child.stdin.end(input ?? "");
1179
+ });
1180
+ }
1181
+ __name(secretToolRunner, "secretToolRunner");
1182
+ function runtimeLockDirectory() {
1183
+ const uid = typeof process.getuid === "function" ? process.getuid() : -1;
1184
+ const runtime = process.env.XDG_RUNTIME_DIR;
1185
+ if (runtime && isAbsolute(runtime)) return join2(runtime, "xeno", "account");
1186
+ return join2(tmpdir(), `xeno-account-${uid}`);
1187
+ }
1188
+ __name(runtimeLockDirectory, "runtimeLockDirectory");
1189
+ function privateDirectory(path) {
1190
+ mkdirSync(path, {
1191
+ recursive: true,
1192
+ mode: 448
1193
+ });
1194
+ const stat = lstatSync(path);
1195
+ const uid = typeof process.getuid === "function" ? process.getuid() : void 0;
1196
+ if (!stat.isDirectory() || stat.isSymbolicLink() || uid !== void 0 && stat.uid !== uid || process.platform !== "win32" && (stat.mode & 63) !== 0) throw refused2();
1197
+ }
1198
+ __name(privateDirectory, "privateDirectory");
1199
+ function readBootId() {
1200
+ try {
1201
+ return readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim() || void 0;
1202
+ } catch {
1203
+ return void 0;
1204
+ }
1205
+ }
1206
+ __name(readBootId, "readBootId");
1207
+ function readStartTime(pid) {
1208
+ try {
1209
+ const stat = readFileSync(`/proc/${pid}/stat`, "utf8");
1210
+ return stat.slice(stat.lastIndexOf(")") + 2).split(" ")[19];
1211
+ } catch {
1212
+ return void 0;
1213
+ }
1214
+ }
1215
+ __name(readStartTime, "readStartTime");
1216
+ var ProcessLock = class ProcessLock2 {
1217
+ static {
1218
+ __name(this, "ProcessLock");
1219
+ }
1220
+ directory;
1221
+ path;
1222
+ token = null;
1223
+ constructor(directory, identity) {
1224
+ this.directory = directory;
1225
+ this.path = join2(directory, `${identity}.lock`);
1226
+ }
1227
+ async acquire(waitMs) {
1228
+ if (this.token) throw refused2();
1229
+ privateDirectory(this.directory);
1230
+ const deadline = Date.now() + waitMs;
1231
+ const token = randomUUID2();
1232
+ const record = {
1233
+ v: 1,
1234
+ token,
1235
+ pid: process.pid,
1236
+ host: hostname(),
1237
+ boot: readBootId(),
1238
+ start: readStartTime(process.pid)
1239
+ };
1240
+ for (; ; ) {
1241
+ try {
1242
+ const fd = openSync(this.path, "wx", 384);
1243
+ try {
1244
+ writeSync(fd, JSON.stringify(record));
1245
+ fsyncSync(fd);
1246
+ } finally {
1247
+ closeSync(fd);
1248
+ }
1249
+ this.token = token;
1250
+ return;
1251
+ } catch (error) {
1252
+ if (error.code !== "EEXIST") throw refused2();
1253
+ }
1254
+ this.breakIfGone();
1255
+ if (Date.now() >= deadline) throw refused2();
1256
+ await new Promise((resolve) => setTimeout(resolve, 25));
1257
+ }
1258
+ }
1259
+ /** False when this process no longer held the lock it took, so its transaction was not exclusive. */
1260
+ release() {
1261
+ const token = this.token;
1262
+ this.token = null;
1263
+ if (!token) return false;
1264
+ const holder = this.readHolder(this.path);
1265
+ if (holder?.token !== token) return false;
1266
+ try {
1267
+ unlinkSync(this.path);
1268
+ return true;
1269
+ } catch {
1270
+ return false;
1271
+ }
1272
+ }
1273
+ readHolder(path) {
1274
+ try {
1275
+ const value = JSON.parse(readFileSync(path, "utf8"));
1276
+ return value && value.v === 1 && typeof value.token === "string" && Number.isSafeInteger(value.pid) && typeof value.host === "string" ? value : null;
1277
+ } catch (error) {
1278
+ return error.code === "ENOENT" ? void 0 : null;
1279
+ }
1280
+ }
1281
+ gone(holder) {
1282
+ if (holder === null) {
1283
+ try {
1284
+ return Date.now() - statSync(this.path).mtimeMs > 3e4;
1285
+ } catch {
1286
+ return false;
1287
+ }
1288
+ }
1289
+ if (holder.host !== hostname()) return false;
1290
+ const boot = readBootId();
1291
+ if (boot && holder.boot && boot !== holder.boot) return true;
1292
+ try {
1293
+ process.kill(holder.pid, 0);
1294
+ } catch (error) {
1295
+ return error.code === "ESRCH";
1296
+ }
1297
+ const start = readStartTime(holder.pid);
1298
+ return Boolean(start && holder.start && start !== holder.start);
1299
+ }
1300
+ breakIfGone() {
1301
+ const holder = this.readHolder(this.path);
1302
+ if (holder === void 0 || !this.gone(holder)) return;
1303
+ const moved = `${this.path}.stale-${randomUUID2()}`;
1304
+ try {
1305
+ renameSync(this.path, moved);
1306
+ } catch {
1307
+ return;
1308
+ }
1309
+ const removed = this.readHolder(moved);
1310
+ if (holder !== null && removed?.token !== holder.token) {
1311
+ try {
1312
+ linkSync(moved, this.path);
1313
+ } catch {
1314
+ }
1315
+ }
1316
+ try {
1317
+ unlinkSync(moved);
1318
+ } catch {
1319
+ }
1320
+ }
1321
+ };
1322
+
1323
+ // src/node.ts
1324
+ function createNodeDpopSigner(input) {
1325
+ const parsed = typeof input === "string" ? JSON.parse(input) : input;
1326
+ if (parsed.kty !== "EC" || parsed.crv !== "P-256" || !parsed.x || !parsed.y || !parsed.d) {
1327
+ throw new Error("DPoP private JWK must be a P-256 EC key");
1328
+ }
1329
+ const privateJwk = parsed;
1330
+ const publicJwk = {
1331
+ kty: "EC",
1332
+ crv: "P-256",
1333
+ x: privateJwk.x,
1334
+ y: privateJwk.y
1335
+ };
1336
+ const jkt = crypto.createHash("sha256").update(JSON.stringify({
1337
+ crv: "P-256",
1338
+ kty: "EC",
1339
+ x: privateJwk.x,
1340
+ y: privateJwk.y
1341
+ })).digest("base64url");
1342
+ const key = crypto.createPrivateKey({
1343
+ key: privateJwk,
1344
+ format: "jwk"
1345
+ });
1346
+ return {
1347
+ jkt,
1348
+ async createProof(args) {
1349
+ const header = {
1350
+ alg: "ES256",
1351
+ typ: "dpop+jwt",
1352
+ jwk: publicJwk
1353
+ };
1354
+ const claims = {
1355
+ jti: crypto.randomUUID(),
1356
+ htm: args.method.toUpperCase(),
1357
+ htu: normalizeDpopHtu(args.url),
1358
+ iat: Math.floor(Date.now() / 1e3)
1359
+ };
1360
+ if (args.accessToken) claims.ath = crypto.createHash("sha256").update(args.accessToken).digest("base64url");
1361
+ if (args.nonce) claims.nonce = args.nonce;
1362
+ const a = Buffer.from(JSON.stringify(header)).toString("base64url");
1363
+ const b = Buffer.from(JSON.stringify(claims)).toString("base64url");
1364
+ const signature = crypto.sign("sha256", Buffer.from(`${a}.${b}`), {
1365
+ key,
1366
+ dsaEncoding: "ieee-p1363"
1367
+ }).toString("base64url");
1368
+ return `${a}.${b}.${signature}`;
1369
+ }
1370
+ };
1371
+ }
1372
+ __name(createNodeDpopSigner, "createNodeDpopSigner");
1373
+ export {
1374
+ createLinuxAccountHost,
1375
+ createNodeDpopSigner,
1376
+ createWindowsAccountHost,
1377
+ startNativeSignIn
1378
+ };
1379
+ //# sourceMappingURL=node.mjs.map