primitive-admin 1.2.0-alpha.8 → 1.3.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (563) hide show
  1. package/README.md +258 -186
  2. package/assets/skill/skills/primitive-platform/SKILL.md +103 -29
  3. package/dist/bin/primitive.js +15 -89
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +80 -17
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/agent-sessions.d.ts +129 -0
  8. package/dist/src/commands/agent-sessions.js +532 -20
  9. package/dist/src/commands/agent-sessions.js.map +1 -1
  10. package/dist/src/commands/analytics.js +207 -155
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps-children.d.ts +1 -1
  13. package/dist/src/commands/apps-children.js +56 -145
  14. package/dist/src/commands/apps-children.js.map +1 -1
  15. package/dist/src/commands/apps-transitions.d.ts +39 -0
  16. package/dist/src/commands/apps-transitions.js +198 -0
  17. package/dist/src/commands/apps-transitions.js.map +1 -0
  18. package/dist/src/commands/apps.d.ts +17 -0
  19. package/dist/src/commands/apps.js +108 -3
  20. package/dist/src/commands/apps.js.map +1 -1
  21. package/dist/src/commands/auth-sessions.js +2 -0
  22. package/dist/src/commands/auth-sessions.js.map +1 -1
  23. package/dist/src/commands/auth.js +138 -44
  24. package/dist/src/commands/auth.js.map +1 -1
  25. package/dist/src/commands/blob-buckets.js +2 -0
  26. package/dist/src/commands/blob-buckets.js.map +1 -1
  27. package/dist/src/commands/collections.js +318 -256
  28. package/dist/src/commands/collections.js.map +1 -1
  29. package/dist/src/commands/comparisons.js +2 -0
  30. package/dist/src/commands/comparisons.js.map +1 -1
  31. package/dist/src/commands/config.d.ts +2 -2
  32. package/dist/src/commands/config.js +59 -33
  33. package/dist/src/commands/config.js.map +1 -1
  34. package/dist/src/commands/connections.js +2 -0
  35. package/dist/src/commands/connections.js.map +1 -1
  36. package/dist/src/commands/database-type-configs.js +5 -3
  37. package/dist/src/commands/database-type-configs.js.map +1 -1
  38. package/dist/src/commands/database-types.js +13 -313
  39. package/dist/src/commands/database-types.js.map +1 -1
  40. package/dist/src/commands/databases.js +6 -4
  41. package/dist/src/commands/databases.js.map +1 -1
  42. package/dist/src/commands/db3-types.d.ts +15 -0
  43. package/dist/src/commands/db3-types.js +159 -0
  44. package/dist/src/commands/db3-types.js.map +1 -0
  45. package/dist/src/commands/db3.d.ts +24 -0
  46. package/dist/src/commands/db3.js +1444 -0
  47. package/dist/src/commands/db3.js.map +1 -0
  48. package/dist/src/commands/documents.d.ts +110 -10
  49. package/dist/src/commands/documents.js +1012 -748
  50. package/dist/src/commands/documents.js.map +1 -1
  51. package/dist/src/commands/email-templates.js +74 -0
  52. package/dist/src/commands/email-templates.js.map +1 -1
  53. package/dist/src/commands/env.js +8 -4
  54. package/dist/src/commands/env.js.map +1 -1
  55. package/dist/src/commands/function-trigger-commands.d.ts +28 -0
  56. package/dist/src/commands/function-trigger-commands.js +341 -0
  57. package/dist/src/commands/function-trigger-commands.js.map +1 -0
  58. package/dist/src/commands/functions.js +376 -30
  59. package/dist/src/commands/functions.js.map +1 -1
  60. package/dist/src/commands/groups.js +168 -50
  61. package/dist/src/commands/groups.js.map +1 -1
  62. package/dist/src/commands/guides.js +7 -5
  63. package/dist/src/commands/guides.js.map +1 -1
  64. package/dist/src/commands/hosting.d.ts +8 -0
  65. package/dist/src/commands/hosting.js +346 -0
  66. package/dist/src/commands/hosting.js.map +1 -0
  67. package/dist/src/commands/init.js +129 -38
  68. package/dist/src/commands/init.js.map +1 -1
  69. package/dist/src/commands/integrations.js +82 -53
  70. package/dist/src/commands/integrations.js.map +1 -1
  71. package/dist/src/commands/llm.js +9 -6
  72. package/dist/src/commands/llm.js.map +1 -1
  73. package/dist/src/commands/locks.d.ts +5 -3
  74. package/dist/src/commands/locks.js +19 -61
  75. package/dist/src/commands/locks.js.map +1 -1
  76. package/dist/src/commands/metadata-category-configs.d.ts +2 -2
  77. package/dist/src/commands/metadata-category-configs.js +4 -2
  78. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  79. package/dist/src/commands/metadata.js +41 -0
  80. package/dist/src/commands/metadata.js.map +1 -1
  81. package/dist/src/commands/prompts.js +75 -52
  82. package/dist/src/commands/prompts.js.map +1 -1
  83. package/dist/src/commands/rate-counters.d.ts +19 -0
  84. package/dist/src/commands/rate-counters.js +104 -0
  85. package/dist/src/commands/rate-counters.js.map +1 -0
  86. package/dist/src/commands/rule-sets.d.ts +1 -1
  87. package/dist/src/commands/rule-sets.js +2 -1
  88. package/dist/src/commands/rule-sets.js.map +1 -1
  89. package/dist/src/commands/schemas.d.ts +15 -0
  90. package/dist/src/commands/schemas.js +122 -0
  91. package/dist/src/commands/schemas.js.map +1 -0
  92. package/dist/src/commands/scripts.d.ts +9 -17
  93. package/dist/src/commands/scripts.js +24 -479
  94. package/dist/src/commands/scripts.js.map +1 -1
  95. package/dist/src/commands/secrets.js +47 -3
  96. package/dist/src/commands/secrets.js.map +1 -1
  97. package/dist/src/commands/sessions.js +2 -0
  98. package/dist/src/commands/sessions.js.map +1 -1
  99. package/dist/src/commands/settings.d.ts +12 -9
  100. package/dist/src/commands/settings.js +31 -79
  101. package/dist/src/commands/settings.js.map +1 -1
  102. package/dist/src/commands/skill.js +2 -0
  103. package/dist/src/commands/skill.js.map +1 -1
  104. package/dist/src/commands/sync-schemas.d.ts +202 -0
  105. package/dist/src/commands/sync-schemas.js +629 -0
  106. package/dist/src/commands/sync-schemas.js.map +1 -0
  107. package/dist/src/commands/sync-user-properties.d.ts +118 -0
  108. package/dist/src/commands/sync-user-properties.js +276 -0
  109. package/dist/src/commands/sync-user-properties.js.map +1 -0
  110. package/dist/src/commands/sync.d.ts +519 -554
  111. package/dist/src/commands/sync.js +3010 -4909
  112. package/dist/src/commands/sync.js.map +1 -1
  113. package/dist/src/commands/tokens.js +5 -3
  114. package/dist/src/commands/tokens.js.map +1 -1
  115. package/dist/src/commands/transitions.d.ts +54 -0
  116. package/dist/src/commands/transitions.js +418 -0
  117. package/dist/src/commands/transitions.js.map +1 -0
  118. package/dist/src/commands/usage.d.ts +18 -0
  119. package/dist/src/commands/usage.js +343 -0
  120. package/dist/src/commands/usage.js.map +1 -0
  121. package/dist/src/commands/user-properties.d.ts +14 -0
  122. package/dist/src/commands/user-properties.js +79 -0
  123. package/dist/src/commands/user-properties.js.map +1 -0
  124. package/dist/src/commands/users.js +911 -18
  125. package/dist/src/commands/users.js.map +1 -1
  126. package/dist/src/commands/vars.js +2 -0
  127. package/dist/src/commands/vars.js.map +1 -1
  128. package/dist/src/commands/waitlist.js +39 -4
  129. package/dist/src/commands/waitlist.js.map +1 -1
  130. package/dist/src/commands/workflows.d.ts +5 -83
  131. package/dist/src/commands/workflows.js +57 -2282
  132. package/dist/src/commands/workflows.js.map +1 -1
  133. package/dist/src/lib/analytics-query.d.ts +58 -0
  134. package/dist/src/lib/analytics-query.js +134 -0
  135. package/dist/src/lib/analytics-query.js.map +1 -0
  136. package/dist/src/lib/api-client.d.ts +1830 -429
  137. package/dist/src/lib/api-client.js +1025 -546
  138. package/dist/src/lib/api-client.js.map +1 -1
  139. package/dist/src/lib/app-settings-descriptor.d.ts +1 -1
  140. package/dist/src/lib/app-settings-descriptor.js +6 -0
  141. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  142. package/dist/src/lib/auth-fixtures.d.ts +44 -0
  143. package/dist/src/lib/auth-fixtures.js +61 -0
  144. package/dist/src/lib/auth-fixtures.js.map +1 -0
  145. package/dist/src/lib/auth-flow.d.ts +34 -1
  146. package/dist/src/lib/auth-flow.js +429 -13
  147. package/dist/src/lib/auth-flow.js.map +1 -1
  148. package/dist/src/lib/block-layout.d.ts +12 -23
  149. package/dist/src/lib/block-layout.js +26 -92
  150. package/dist/src/lib/block-layout.js.map +1 -1
  151. package/dist/src/lib/block-selector.d.ts +8 -14
  152. package/dist/src/lib/block-selector.js +8 -19
  153. package/dist/src/lib/block-selector.js.map +1 -1
  154. package/dist/src/lib/child-apps-local.d.ts +3 -47
  155. package/dist/src/lib/child-apps-local.js +11 -73
  156. package/dist/src/lib/child-apps-local.js.map +1 -1
  157. package/dist/src/lib/cli-manifest.d.ts +9 -0
  158. package/dist/src/lib/cli-manifest.js +10 -1
  159. package/dist/src/lib/cli-manifest.js.map +1 -1
  160. package/dist/src/lib/cli-version.d.ts +14 -0
  161. package/dist/src/lib/cli-version.js +38 -0
  162. package/dist/src/lib/cli-version.js.map +1 -0
  163. package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
  164. package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
  165. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
  166. package/dist/src/lib/collection-export.d.ts +76 -15
  167. package/dist/src/lib/collection-export.js +116 -23
  168. package/dist/src/lib/collection-export.js.map +1 -1
  169. package/dist/src/lib/collection-principal.d.ts +22 -0
  170. package/dist/src/lib/collection-principal.js +35 -0
  171. package/dist/src/lib/collection-principal.js.map +1 -0
  172. package/dist/src/lib/command-groups.d.ts +30 -0
  173. package/dist/src/lib/command-groups.js +109 -0
  174. package/dist/src/lib/command-groups.js.map +1 -0
  175. package/dist/src/lib/command-status.d.ts +147 -0
  176. package/dist/src/lib/command-status.js +266 -0
  177. package/dist/src/lib/command-status.js.map +1 -0
  178. package/dist/src/lib/config-object-descriptor.d.ts +9 -22
  179. package/dist/src/lib/config-object-descriptor.js +107 -276
  180. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  181. package/dist/src/lib/config-surface.d.ts +3 -7
  182. package/dist/src/lib/config-surface.js +9 -13
  183. package/dist/src/lib/config-surface.js.map +1 -1
  184. package/dist/src/lib/config-toml.d.ts +11 -2
  185. package/dist/src/lib/config-toml.js +25 -2
  186. package/dist/src/lib/config-toml.js.map +1 -1
  187. package/dist/src/lib/credentials-home.d.ts +7 -0
  188. package/dist/src/lib/credentials-home.js +45 -10
  189. package/dist/src/lib/credentials-home.js.map +1 -1
  190. package/dist/src/lib/credentials-lock.d.ts +14 -6
  191. package/dist/src/lib/credentials-lock.js +90 -10
  192. package/dist/src/lib/credentials-lock.js.map +1 -1
  193. package/dist/src/lib/credentials-store.d.ts +123 -70
  194. package/dist/src/lib/credentials-store.js +358 -113
  195. package/dist/src/lib/credentials-store.js.map +1 -1
  196. package/dist/src/lib/custodian.d.ts +8 -0
  197. package/dist/src/lib/custodian.js +18 -0
  198. package/dist/src/lib/custodian.js.map +1 -0
  199. package/dist/src/lib/data-input.d.ts +1 -1
  200. package/dist/src/lib/data-input.js +1 -1
  201. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
  202. package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
  203. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  204. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +38 -1
  205. package/dist/src/lib/db-codegen/dbTypeIR.js +29 -7
  206. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  207. package/dist/src/lib/db-type-records.d.ts +106 -0
  208. package/dist/src/lib/db-type-records.js +224 -0
  209. package/dist/src/lib/db-type-records.js.map +1 -0
  210. package/dist/src/lib/db3-export.d.ts +287 -0
  211. package/dist/src/lib/db3-export.js +647 -0
  212. package/dist/src/lib/db3-export.js.map +1 -0
  213. package/dist/src/lib/db3-index-output.d.ts +116 -0
  214. package/dist/src/lib/db3-index-output.js +223 -0
  215. package/dist/src/lib/db3-index-output.js.map +1 -0
  216. package/dist/src/lib/db3-type-models.d.ts +134 -0
  217. package/dist/src/lib/db3-type-models.js +452 -0
  218. package/dist/src/lib/db3-type-models.js.map +1 -0
  219. package/dist/src/lib/deprecation.d.ts +2 -2
  220. package/dist/src/lib/deprecation.js +2 -2
  221. package/dist/src/lib/document-ingest-artifact.d.ts +13 -0
  222. package/dist/src/lib/document-ingest-artifact.js +36 -6
  223. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  224. package/dist/src/lib/document-ingest-format2.d.ts +36 -0
  225. package/dist/src/lib/document-ingest-format2.js +78 -0
  226. package/dist/src/lib/document-ingest-format2.js.map +1 -0
  227. package/dist/src/lib/document-ingest-input.d.ts +9 -0
  228. package/dist/src/lib/document-ingest-input.js +28 -1
  229. package/dist/src/lib/document-ingest-input.js.map +1 -1
  230. package/dist/src/lib/document-ingest.d.ts +11 -1
  231. package/dist/src/lib/document-ingest.js +16 -0
  232. package/dist/src/lib/document-ingest.js.map +1 -1
  233. package/dist/src/lib/document-schema-rows.d.ts +42 -0
  234. package/dist/src/lib/document-schema-rows.js +53 -0
  235. package/dist/src/lib/document-schema-rows.js.map +1 -0
  236. package/dist/src/lib/experimental-apis.d.ts +36 -0
  237. package/dist/src/lib/experimental-apis.js +46 -0
  238. package/dist/src/lib/experimental-apis.js.map +1 -0
  239. package/dist/src/lib/file-attachment.d.ts +24 -0
  240. package/dist/src/lib/file-attachment.js +31 -0
  241. package/dist/src/lib/file-attachment.js.map +1 -0
  242. package/dist/src/lib/function-authorize-check.d.ts +142 -0
  243. package/dist/src/lib/function-authorize-check.js +311 -0
  244. package/dist/src/lib/function-authorize-check.js.map +1 -0
  245. package/dist/src/lib/function-authorize-view.d.ts +27 -0
  246. package/dist/src/lib/function-authorize-view.js +88 -0
  247. package/dist/src/lib/function-authorize-view.js.map +1 -0
  248. package/dist/src/lib/function-bundle.d.ts +27 -5
  249. package/dist/src/lib/function-bundle.js +142 -7
  250. package/dist/src/lib/function-bundle.js.map +1 -1
  251. package/dist/src/lib/function-collect.d.ts +90 -12
  252. package/dist/src/lib/function-collect.js +482 -12
  253. package/dist/src/lib/function-collect.js.map +1 -1
  254. package/dist/src/lib/function-db-types.d.ts +65 -11
  255. package/dist/src/lib/function-db-types.js +297 -157
  256. package/dist/src/lib/function-db-types.js.map +1 -1
  257. package/dist/src/lib/function-document-types.d.ts +19 -7
  258. package/dist/src/lib/function-document-types.js +24 -12
  259. package/dist/src/lib/function-document-types.js.map +1 -1
  260. package/dist/src/lib/function-lint.d.ts +57 -0
  261. package/dist/src/lib/function-lint.js +234 -0
  262. package/dist/src/lib/function-lint.js.map +1 -0
  263. package/dist/src/lib/function-log-row.js +21 -2
  264. package/dist/src/lib/function-log-row.js.map +1 -1
  265. package/dist/src/lib/function-run.d.ts +13 -21
  266. package/dist/src/lib/function-run.js +14 -27
  267. package/dist/src/lib/function-run.js.map +1 -1
  268. package/dist/src/lib/function-schema-codegen.d.ts +86 -22
  269. package/dist/src/lib/function-schema-codegen.js +194 -88
  270. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  271. package/dist/src/lib/function-schema-refs.d.ts +98 -0
  272. package/dist/src/lib/function-schema-refs.js +177 -0
  273. package/dist/src/lib/function-schema-refs.js.map +1 -0
  274. package/dist/src/lib/function-sync.d.ts +109 -6
  275. package/dist/src/lib/function-sync.js +179 -26
  276. package/dist/src/lib/function-sync.js.map +1 -1
  277. package/dist/src/lib/function-trigger-listing.d.ts +11 -6
  278. package/dist/src/lib/function-trigger-listing.js +32 -11
  279. package/dist/src/lib/function-trigger-listing.js.map +1 -1
  280. package/dist/src/lib/function-triggers.d.ts +15 -3
  281. package/dist/src/lib/function-triggers.js +72 -10
  282. package/dist/src/lib/function-triggers.js.map +1 -1
  283. package/dist/src/lib/function-typecheck.d.ts +52 -0
  284. package/dist/src/lib/function-typecheck.js +174 -54
  285. package/dist/src/lib/function-typecheck.js.map +1 -1
  286. package/dist/src/lib/function-versions.d.ts +2 -0
  287. package/dist/src/lib/function-versions.js +1 -0
  288. package/dist/src/lib/function-versions.js.map +1 -1
  289. package/dist/src/lib/generated-build-flags.d.ts +13 -0
  290. package/dist/src/lib/generated-build-flags.js +14 -0
  291. package/dist/src/lib/generated-build-flags.js.map +1 -0
  292. package/dist/src/lib/generated-command-status.d.ts +6 -0
  293. package/dist/src/lib/generated-command-status.js +469 -0
  294. package/dist/src/lib/generated-command-status.js.map +1 -0
  295. package/dist/src/lib/generated-config-surfaces.d.ts +586 -152
  296. package/dist/src/lib/generated-config-surfaces.js +1919 -1883
  297. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  298. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  299. package/dist/src/lib/generated-sdk-types.js +1 -1
  300. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  301. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  302. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  303. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  304. package/dist/src/lib/hosting-build.d.ts +97 -0
  305. package/dist/src/lib/hosting-build.js +204 -0
  306. package/dist/src/lib/hosting-build.js.map +1 -0
  307. package/dist/src/lib/hosting-client.d.ts +167 -0
  308. package/dist/src/lib/hosting-client.js +340 -0
  309. package/dist/src/lib/hosting-client.js.map +1 -0
  310. package/dist/src/lib/hosting-environments.d.ts +32 -0
  311. package/dist/src/lib/hosting-environments.js +74 -0
  312. package/dist/src/lib/hosting-environments.js.map +1 -0
  313. package/dist/src/lib/hosting-errors.d.ts +30 -0
  314. package/dist/src/lib/hosting-errors.js +43 -0
  315. package/dist/src/lib/hosting-errors.js.map +1 -0
  316. package/dist/src/lib/hosting-token.d.ts +46 -0
  317. package/dist/src/lib/hosting-token.js +60 -0
  318. package/dist/src/lib/hosting-token.js.map +1 -0
  319. package/dist/src/lib/hosting-wait.d.ts +42 -0
  320. package/dist/src/lib/hosting-wait.js +84 -0
  321. package/dist/src/lib/hosting-wait.js.map +1 -0
  322. package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
  323. package/dist/src/lib/hosting-wfp-upload.js +149 -0
  324. package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
  325. package/dist/src/lib/init-assets.d.ts +2 -6
  326. package/dist/src/lib/init-assets.js +11 -27
  327. package/dist/src/lib/init-assets.js.map +1 -1
  328. package/dist/src/lib/init-ios-links.d.ts +11 -7
  329. package/dist/src/lib/init-ios-links.js +28 -22
  330. package/dist/src/lib/init-ios-links.js.map +1 -1
  331. package/dist/src/lib/init-login-note.d.ts +13 -0
  332. package/dist/src/lib/init-login-note.js +22 -0
  333. package/dist/src/lib/init-login-note.js.map +1 -0
  334. package/dist/src/lib/init-schema.d.ts +15 -0
  335. package/dist/src/lib/init-schema.js +54 -0
  336. package/dist/src/lib/init-schema.js.map +1 -1
  337. package/dist/src/lib/integration-test-request.d.ts +54 -0
  338. package/dist/src/lib/integration-test-request.js +207 -0
  339. package/dist/src/lib/integration-test-request.js.map +1 -0
  340. package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
  341. package/dist/src/lib/invoker-shared-enums.js +98 -0
  342. package/dist/src/lib/invoker-shared-enums.js.map +1 -0
  343. package/dist/src/lib/json-value.d.ts +6 -0
  344. package/dist/src/lib/json-value.js +13 -0
  345. package/dist/src/lib/json-value.js.map +1 -0
  346. package/dist/src/lib/load-routes.d.ts +33 -0
  347. package/dist/src/lib/load-routes.js +35 -0
  348. package/dist/src/lib/load-routes.js.map +1 -0
  349. package/dist/src/lib/log-inspection.d.ts +23 -4
  350. package/dist/src/lib/log-inspection.js +14 -5
  351. package/dist/src/lib/log-inspection.js.map +1 -1
  352. package/dist/src/lib/login-exchange-check.d.ts +18 -0
  353. package/dist/src/lib/login-exchange-check.js +27 -0
  354. package/dist/src/lib/login-exchange-check.js.map +1 -0
  355. package/dist/src/lib/login-scope-lines.d.ts +17 -7
  356. package/dist/src/lib/login-scope-lines.js +33 -10
  357. package/dist/src/lib/login-scope-lines.js.map +1 -1
  358. package/dist/src/lib/metadata-report.d.ts +85 -0
  359. package/dist/src/lib/metadata-report.js +81 -0
  360. package/dist/src/lib/metadata-report.js.map +1 -0
  361. package/dist/src/lib/object-status-filter.d.ts +9 -1
  362. package/dist/src/lib/object-status-filter.js +9 -1
  363. package/dist/src/lib/object-status-filter.js.map +1 -1
  364. package/dist/src/lib/output.d.ts +1 -1
  365. package/dist/src/lib/output.js +3 -1
  366. package/dist/src/lib/output.js.map +1 -1
  367. package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
  368. package/dist/src/lib/pin-refusal-hint.js +35 -0
  369. package/dist/src/lib/pin-refusal-hint.js.map +1 -0
  370. package/dist/src/lib/platform-owned.js +5 -0
  371. package/dist/src/lib/platform-owned.js.map +1 -1
  372. package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
  373. package/dist/src/lib/primitive-declaration-names.js +22 -0
  374. package/dist/src/lib/primitive-declaration-names.js.map +1 -0
  375. package/dist/src/lib/primitive-declaration.d.ts +174 -0
  376. package/dist/src/lib/primitive-declaration.js +792 -0
  377. package/dist/src/lib/primitive-declaration.js.map +1 -0
  378. package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
  379. package/dist/src/lib/primitive-env-plugin.js +408 -0
  380. package/dist/src/lib/primitive-env-plugin.js.map +1 -0
  381. package/dist/src/lib/project-login-apps.d.ts +8 -0
  382. package/dist/src/lib/project-login-apps.js +27 -0
  383. package/dist/src/lib/project-login-apps.js.map +1 -0
  384. package/dist/src/lib/prompt-schema-codegen.d.ts +46 -15
  385. package/dist/src/lib/prompt-schema-codegen.js +142 -108
  386. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  387. package/dist/src/lib/prompt-schema-document.d.ts +35 -0
  388. package/dist/src/lib/prompt-schema-document.js +92 -0
  389. package/dist/src/lib/prompt-schema-document.js.map +1 -0
  390. package/dist/src/lib/prompt-schema-refs.d.ts +173 -0
  391. package/dist/src/lib/prompt-schema-refs.js +478 -0
  392. package/dist/src/lib/prompt-schema-refs.js.map +1 -0
  393. package/dist/src/lib/records-verbs.d.ts +79 -0
  394. package/dist/src/lib/records-verbs.js +45 -0
  395. package/dist/src/lib/records-verbs.js.map +1 -0
  396. package/dist/src/lib/register-commands.d.ts +36 -0
  397. package/dist/src/lib/register-commands.js +37 -0
  398. package/dist/src/lib/register-commands.js.map +1 -0
  399. package/dist/src/lib/retired-imports.d.ts +53 -0
  400. package/dist/src/lib/retired-imports.js +120 -0
  401. package/dist/src/lib/retired-imports.js.map +1 -0
  402. package/dist/src/lib/run-status.d.ts +1 -1
  403. package/dist/src/lib/run-status.generated.d.ts +2 -2
  404. package/dist/src/lib/run-status.generated.js +3 -1
  405. package/dist/src/lib/run-status.generated.js.map +1 -1
  406. package/dist/src/lib/run-status.js +1 -1
  407. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
  408. package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
  409. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
  410. package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
  411. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
  412. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
  413. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
  414. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
  415. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
  416. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +218 -0
  417. package/dist/src/lib/schema-codegen/generated-field-grammar.js +397 -0
  418. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
  419. package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
  420. package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
  421. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
  422. package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
  423. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
  424. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
  425. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +258 -0
  426. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
  427. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
  428. package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
  429. package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
  430. package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
  431. package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
  432. package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
  433. package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
  434. package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
  435. package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
  436. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
  437. package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
  438. package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
  439. package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
  440. package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
  441. package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
  442. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
  443. package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
  444. package/dist/src/lib/schema-codegen/naming.js +83 -0
  445. package/dist/src/lib/schema-codegen/naming.js.map +1 -0
  446. package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
  447. package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
  448. package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
  449. package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
  450. package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
  451. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
  452. package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
  453. package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
  454. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
  455. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +109 -0
  456. package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
  457. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
  458. package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
  459. package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
  460. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
  461. package/dist/src/lib/schema-family-index.d.ts +228 -0
  462. package/dist/src/lib/schema-family-index.js +813 -0
  463. package/dist/src/lib/schema-family-index.js.map +1 -0
  464. package/dist/src/lib/schema-pins.d.ts +82 -0
  465. package/dist/src/lib/schema-pins.js +198 -0
  466. package/dist/src/lib/schema-pins.js.map +1 -0
  467. package/dist/src/lib/schema-preview.d.ts +244 -0
  468. package/dist/src/lib/schema-preview.js +498 -0
  469. package/dist/src/lib/schema-preview.js.map +1 -0
  470. package/dist/src/lib/scope-request.d.ts +23 -11
  471. package/dist/src/lib/scope-request.js +69 -31
  472. package/dist/src/lib/scope-request.js.map +1 -1
  473. package/dist/src/lib/session-scope.d.ts +26 -0
  474. package/dist/src/lib/session-scope.js +58 -0
  475. package/dist/src/lib/session-scope.js.map +1 -0
  476. package/dist/src/lib/skill-installer.d.ts +2 -2
  477. package/dist/src/lib/skill-installer.js +2 -21
  478. package/dist/src/lib/skill-installer.js.map +1 -1
  479. package/dist/src/lib/step-run-table.d.ts +1 -2
  480. package/dist/src/lib/step-run-table.js +1 -2
  481. package/dist/src/lib/step-run-table.js.map +1 -1
  482. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +8 -3
  483. package/dist/src/lib/swift-codegen/agentGenerator.js +76 -22
  484. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  485. package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
  486. package/dist/src/lib/swift-codegen/banners.js +12 -0
  487. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  488. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
  489. package/dist/src/lib/swift-codegen/functionGenerator.js +169 -51
  490. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  491. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +33 -9
  492. package/dist/src/lib/swift-codegen/schemaToSwift.js +215 -179
  493. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  494. package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
  495. package/dist/src/lib/swift-codegen/sharedGenerator.js +165 -0
  496. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
  497. package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
  498. package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
  499. package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
  500. package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
  501. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
  502. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
  503. package/dist/src/lib/sync-resource-types.d.ts +117 -31
  504. package/dist/src/lib/sync-resource-types.js +197 -189
  505. package/dist/src/lib/sync-resource-types.js.map +1 -1
  506. package/dist/src/lib/sync-selectors.d.ts +7 -0
  507. package/dist/src/lib/sync-selectors.js +22 -2
  508. package/dist/src/lib/sync-selectors.js.map +1 -1
  509. package/dist/src/lib/template.d.ts +39 -3
  510. package/dist/src/lib/template.js +103 -14
  511. package/dist/src/lib/template.js.map +1 -1
  512. package/dist/src/lib/test-case-file-names.d.ts +3 -5
  513. package/dist/src/lib/test-case-file-names.js +3 -5
  514. package/dist/src/lib/test-case-file-names.js.map +1 -1
  515. package/dist/src/lib/test-runs.d.ts +45 -0
  516. package/dist/src/lib/test-runs.js +150 -0
  517. package/dist/src/lib/test-runs.js.map +1 -0
  518. package/dist/src/lib/test-users.d.ts +25 -0
  519. package/dist/src/lib/test-users.js +36 -0
  520. package/dist/src/lib/test-users.js.map +1 -0
  521. package/dist/src/lib/toml-database-config.d.ts +4 -2
  522. package/dist/src/lib/toml-database-config.js +11 -6
  523. package/dist/src/lib/toml-database-config.js.map +1 -1
  524. package/dist/src/lib/toml-scalar-edit.js +6 -4
  525. package/dist/src/lib/toml-scalar-edit.js.map +1 -1
  526. package/dist/src/lib/transition-warnings.d.ts +21 -0
  527. package/dist/src/lib/transition-warnings.js +49 -0
  528. package/dist/src/lib/transition-warnings.js.map +1 -0
  529. package/dist/src/lib/user-index.d.ts +80 -0
  530. package/dist/src/lib/user-index.js +166 -0
  531. package/dist/src/lib/user-index.js.map +1 -0
  532. package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
  533. package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
  534. package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
  535. package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
  536. package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
  537. package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
  538. package/dist/src/lib/user-walk.d.ts +31 -0
  539. package/dist/src/lib/user-walk.js +102 -0
  540. package/dist/src/lib/user-walk.js.map +1 -0
  541. package/dist/src/lib/webhook-capture.d.ts +43 -0
  542. package/dist/src/lib/webhook-capture.js +91 -0
  543. package/dist/src/lib/webhook-capture.js.map +1 -0
  544. package/dist/src/lib/webhook-deliver.d.ts +18 -20
  545. package/dist/src/lib/webhook-deliver.js +34 -89
  546. package/dist/src/lib/webhook-deliver.js.map +1 -1
  547. package/dist/src/lib/webhook-test-run.d.ts +32 -0
  548. package/dist/src/lib/webhook-test-run.js +108 -0
  549. package/dist/src/lib/webhook-test-run.js.map +1 -0
  550. package/dist/src/lib/worker-perf-format.d.ts +22 -0
  551. package/dist/src/lib/worker-perf-format.js +27 -0
  552. package/dist/src/lib/worker-perf-format.js.map +1 -0
  553. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  554. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  555. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  556. package/dist/src/types/index.d.ts +20 -65
  557. package/dist/src/validators.d.ts +7 -55
  558. package/dist/src/validators.js +7 -53
  559. package/dist/src/validators.js.map +1 -1
  560. package/dist/src/vite.d.ts +17 -0
  561. package/dist/src/vite.js +18 -0
  562. package/dist/src/vite.js.map +1 -0
  563. package/package.json +20 -9
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The fixture map `primitive functions authorize` resolves `@name` aliases
3
+ * from, and the two file names it reserves — #4732, project
4
+ * `function-authorize` phase 3.
5
+ *
6
+ * A committed environment keeps its map at `primitive/<env>/auth-fixtures.json`
7
+ * beside its configuration. A machine-local environment (a child app) shares
8
+ * its parent's tree but not its data, so its map is its own:
9
+ * `<name>.auth-fixtures.json` in the directory of its machine-local baseline,
10
+ * and — like the baseline — never the parent's file as a fallback.
11
+ *
12
+ * Neither file, nor a case file `functions/<key>.auth.json`, is ever
13
+ * uploaded: `config push` sends a function's TOML and the files its build
14
+ * read, and the bundler refuses a build that read one of these
15
+ * (`function-bundle.ts`), so a fixture can only reach the server through an
16
+ * import that is refused.
17
+ */
18
+ /** The committed environment's fixture file, in its tree. */
19
+ export declare const AUTH_FIXTURES_FILE = "auth-fixtures.json";
20
+ /** The suffix of a function's case file, `functions/<key>.auth.json`. */
21
+ export declare const AUTH_CASE_FILE_SUFFIX = ".auth.json";
22
+ /** Where the selected environment's fixture map lives. */
23
+ export declare function authFixturesPathFor(env: {
24
+ name: string;
25
+ tree: string;
26
+ local: boolean;
27
+ projectRoot: string;
28
+ }): string;
29
+ /**
30
+ * The fixture map at `path`: no fixtures when the file is absent, a refusal
31
+ * naming the file when it is not a JSON object.
32
+ */
33
+ export declare function readAuthFixtures(path: string): {
34
+ ok: true;
35
+ fixtures: Record<string, unknown>;
36
+ exists: boolean;
37
+ } | {
38
+ ok: false;
39
+ error: string;
40
+ };
41
+ /** Whether a tree-relative POSIX path is the tree's fixture file. */
42
+ export declare function isAuthFixturesPath(treeRelative: string): boolean;
43
+ /** Whether a tree-relative POSIX path is a case file, `functions/<key>.auth.json`. */
44
+ export declare function isAuthCaseFilePath(treeRelative: string): boolean;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The fixture map `primitive functions authorize` resolves `@name` aliases
3
+ * from, and the two file names it reserves — #4732, project
4
+ * `function-authorize` phase 3.
5
+ *
6
+ * A committed environment keeps its map at `primitive/<env>/auth-fixtures.json`
7
+ * beside its configuration. A machine-local environment (a child app) shares
8
+ * its parent's tree but not its data, so its map is its own:
9
+ * `<name>.auth-fixtures.json` in the directory of its machine-local baseline,
10
+ * and — like the baseline — never the parent's file as a fallback.
11
+ *
12
+ * Neither file, nor a case file `functions/<key>.auth.json`, is ever
13
+ * uploaded: `config push` sends a function's TOML and the files its build
14
+ * read, and the bundler refuses a build that read one of these
15
+ * (`function-bundle.ts`), so a fixture can only reach the server through an
16
+ * import that is refused.
17
+ */
18
+ import { existsSync, readFileSync } from "fs";
19
+ import { dirname, join } from "path";
20
+ import { PROJECT_TREE_DIR } from "./env-resolver-core.js";
21
+ import { localSyncStatePathFor } from "./sync-paths.js";
22
+ /** The committed environment's fixture file, in its tree. */
23
+ export const AUTH_FIXTURES_FILE = "auth-fixtures.json";
24
+ /** The suffix of a function's case file, `functions/<key>.auth.json`. */
25
+ export const AUTH_CASE_FILE_SUFFIX = ".auth.json";
26
+ /** Where the selected environment's fixture map lives. */
27
+ export function authFixturesPathFor(env) {
28
+ if (env.local) {
29
+ return join(dirname(localSyncStatePathFor(env.projectRoot, env.name)), `${env.name}.${AUTH_FIXTURES_FILE}`);
30
+ }
31
+ return join(env.projectRoot, PROJECT_TREE_DIR, env.tree, AUTH_FIXTURES_FILE);
32
+ }
33
+ /**
34
+ * The fixture map at `path`: no fixtures when the file is absent, a refusal
35
+ * naming the file when it is not a JSON object.
36
+ */
37
+ export function readAuthFixtures(path) {
38
+ if (!existsSync(path))
39
+ return { ok: true, fixtures: {}, exists: false };
40
+ let parsed;
41
+ try {
42
+ parsed = JSON.parse(readFileSync(path, "utf-8"));
43
+ }
44
+ catch (err) {
45
+ return { ok: false, error: `${path} is not valid JSON: ${err?.message || String(err)}` };
46
+ }
47
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
48
+ return { ok: false, error: `${path} must be a JSON object { "<name>": <value> }` };
49
+ }
50
+ return { ok: true, fixtures: parsed, exists: true };
51
+ }
52
+ /** Whether a tree-relative POSIX path is the tree's fixture file. */
53
+ export function isAuthFixturesPath(treeRelative) {
54
+ return treeRelative === AUTH_FIXTURES_FILE;
55
+ }
56
+ /** Whether a tree-relative POSIX path is a case file, `functions/<key>.auth.json`. */
57
+ export function isAuthCaseFilePath(treeRelative) {
58
+ const match = /^functions\/([^/]+)$/.exec(treeRelative);
59
+ return !!match && match[1].endsWith(AUTH_CASE_FILE_SUFFIX) && match[1].length > AUTH_CASE_FILE_SUFFIX.length;
60
+ }
61
+ //# sourceMappingURL=auth-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-fixtures.js","sourceRoot":"","sources":["../../../src/lib/auth-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAElD,0DAA0D;AAC1D,MAAM,UAAU,mBAAmB,CAAC,GAKnC;IACC,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,kBAAkB,EAAE,CAAC,CAAC;IAC9G,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,GAAG,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY;IAIZ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACxE,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,uBAAuB,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IAC3F,CAAC;IACD,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3E,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,8CAA8C,EAAE,CAAC;IACrF,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAiC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACjF,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,kBAAkB,CAAC,YAAoB;IACrD,OAAO,YAAY,KAAK,kBAAkB,CAAC;AAC7C,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,kBAAkB,CAAC,YAAoB;IACrD,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxD,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC;AAC/G,CAAC"}
@@ -28,7 +28,7 @@ interface AuthResult {
28
28
  }
29
29
  /** How a browser login runs. */
30
30
  export interface BrowserLoginOptions {
31
- /** A scoped request's `oauth-cli` query (#3889); absent for a plain login. */
31
+ /** The request's `oauth-cli` query (#3889, #4512); without one the server reads an all-apps login. */
32
32
  query?: Record<string, string>;
33
33
  /**
34
34
  * `X-Global-Admin-App-Id` for the code exchange: the partition the
@@ -44,5 +44,38 @@ export interface BrowserLoginOptions {
44
44
  * `PRIMITIVE_LOGIN_TIMEOUT_MS` shortens it (the test harness does).
45
45
  */
46
46
  export declare function loginTimeoutMs(env?: Record<string, string | undefined>): number;
47
+ /**
48
+ * Log in through the browser and answer the exchanged session. Runs the v2
49
+ * login when `PRIMITIVE_LOGIN_V2` is exactly `1`, and the current flow
50
+ * otherwise.
51
+ */
47
52
  export declare function browserLogin(serverUrl: string, options?: BrowserLoginOptions): Promise<AuthResult>;
53
+ /** How a v2 login ended, as the login app's finished page shows it. */
54
+ export type LoginOutcome = "signed-in" | "denied" | "failed";
55
+ /** A login's identity, as a stored login or an exchange names it. */
56
+ export interface LoginIdentity {
57
+ adminId?: string;
58
+ email?: string;
59
+ }
60
+ /** True when `PRIMITIVE_LOGIN_V2` is exactly `1`: browser logins then run the v2 flow. */
61
+ export declare function loginV2Selected(env?: Record<string, string | undefined>): boolean;
62
+ /**
63
+ * What to print when the server refuses to start a v2 login: the routes are
64
+ * not served there (401 or 404), the server's own message otherwise, and for
65
+ * the start limit also when to try again.
66
+ */
67
+ export declare function startRefusalMessage(status: number, body: unknown, retryAfter: string | null): string;
68
+ /** The login app's finished page for `outcome`, on the origin of the login URL. */
69
+ export declare function finishedPageUrl(loginUrl: string, outcome: LoginOutcome): string;
70
+ /** `value` when it is an http or https URL, which the CLI may open; null otherwise. */
71
+ export declare function openableLoginUrl(value: unknown): string | null;
72
+ /**
73
+ * The warning to print when a login signed in as another admin than the one
74
+ * already stored for this server, or null when there is none stored or it is
75
+ * the same admin. Admins are compared by id when both have one, else by email
76
+ * without regard to case.
77
+ */
78
+ export declare function differentAdminWarning(stored: LoginIdentity | null, signedIn: LoginIdentity, serverUrl: string): string[] | null;
79
+ /** `text` with control characters removed and capped at 500 characters, safe to print to a terminal. */
80
+ export declare function printableError(text: string): string;
48
81
  export {};
@@ -1,9 +1,19 @@
1
+ import { createHash, randomBytes, timingSafeEqual } from "crypto";
1
2
  import { createServer } from "http";
2
3
  import open from "open";
3
- import { saveCredentials } from "./config.js";
4
+ import { loadCredentials, saveCredentials } from "./config.js";
5
+ import { partitionFromEnvironment, sameServer } from "./credentials-store.js";
4
6
  import { fetchWithTLS } from "./fetch.js";
5
- import { error, info } from "./output.js";
7
+ import { error, info, warn } from "./output.js";
6
8
  const DEFAULT_CALLBACK_PORT = 9876;
9
+ /** The callback server listens on loopback only, so no other machine can reach it. */
10
+ const CALLBACK_HOST = "127.0.0.1";
11
+ /**
12
+ * The IPv6 loopback, held on the same port (#5925): the server redirects the
13
+ * browser to `localhost`, which a browser may resolve to `::1`, so the CLI
14
+ * keeps that address too rather than leave it to another local process.
15
+ */
16
+ const CALLBACK_HOST_IPV6 = "::1";
7
17
  const DEFAULT_LOGIN_TIMEOUT_MS = 5 * 60 * 1000;
8
18
  /**
9
19
  * How long a browser login waits for its callback: five minutes, unless
@@ -19,9 +29,17 @@ function callbackPort(env = process.env) {
19
29
  const raw = env.PRIMITIVE_LOGIN_PORT;
20
30
  return raw !== undefined && /^\d+$/.test(raw) ? Number(raw) : DEFAULT_CALLBACK_PORT;
21
31
  }
32
+ /**
33
+ * Log in through the browser and answer the exchanged session. Runs the v2
34
+ * login when `PRIMITIVE_LOGIN_V2` is exactly `1`, and the current flow
35
+ * otherwise.
36
+ */
22
37
  export async function browserLogin(serverUrl, options = {}) {
38
+ if (loginV2Selected())
39
+ return browserLoginV2(serverUrl, options);
23
40
  return new Promise((resolve) => {
24
41
  let server = null;
42
+ let server6 = null;
25
43
  let timeoutId = null;
26
44
  const sockets = new Set();
27
45
  const cleanup = () => {
@@ -38,9 +56,13 @@ export async function browserLogin(serverUrl, options = {}) {
38
56
  server.close();
39
57
  server = null;
40
58
  }
59
+ if (server6) {
60
+ server6.close();
61
+ server6 = null;
62
+ }
41
63
  };
42
- // Create local server to receive OAuth callback
43
- server = createServer(async (req, res) => {
64
+ // Answers the OAuth callback, on either loopback address
65
+ const handleRequest = async (req, res) => {
44
66
  const url = new URL(req.url || "/", "http://localhost");
45
67
  if (url.pathname === "/callback") {
46
68
  const code = url.searchParams.get("code");
@@ -121,14 +143,19 @@ export async function browserLogin(serverUrl, options = {}) {
121
143
  // For any other path, just return a simple message
122
144
  res.writeHead(200, { "Content-Type": "text/plain", "Connection": "close" });
123
145
  res.end("Waiting for OAuth callback...");
124
- });
146
+ };
125
147
  // Track connections so we can destroy them on cleanup
126
- server.on("connection", (socket) => {
127
- sockets.add(socket);
128
- socket.on("close", () => {
129
- sockets.delete(socket);
148
+ const trackConnections = (target) => {
149
+ target.on("connection", (socket) => {
150
+ sockets.add(socket);
151
+ socket.on("close", () => {
152
+ sockets.delete(socket);
153
+ });
130
154
  });
131
- });
155
+ };
156
+ // Create local server to receive OAuth callback
157
+ server = createServer(handleRequest);
158
+ trackConnections(server);
132
159
  const requestedPort = callbackPort();
133
160
  server.on("error", (err) => {
134
161
  if (err.code === "EADDRINUSE") {
@@ -140,13 +167,43 @@ export async function browserLogin(serverUrl, options = {}) {
140
167
  cleanup();
141
168
  resolve({ success: false, error: err.message });
142
169
  });
143
- server.listen(requestedPort, async () => {
170
+ server.listen(requestedPort, CALLBACK_HOST, async () => {
144
171
  const port = server?.address()?.port ?? requestedPort;
172
+ let ipv6;
173
+ try {
174
+ ipv6 = await listenIpv6Loopback(handleRequest, port);
175
+ }
176
+ catch (err) {
177
+ if (err.code === "EADDRINUSE") {
178
+ error(`Port ${port} is already in use on ${CALLBACK_HOST_IPV6}. Please close any other bao-admin login processes.`);
179
+ }
180
+ else {
181
+ error(`Failed to start local server: ${err.message}`);
182
+ }
183
+ cleanup();
184
+ resolve({ success: false, error: err.message });
185
+ return;
186
+ }
187
+ if (!server) {
188
+ // The login ended (timed out) while the IPv6 listener was starting.
189
+ ipv6?.close();
190
+ return;
191
+ }
192
+ if (ipv6) {
193
+ server6 = ipv6;
194
+ trackConnections(ipv6);
195
+ }
145
196
  info(`Starting OAuth flow...`);
146
197
  info(`Listening on port ${port} for callback...`);
147
198
  // Build the OAuth initiation URL
148
199
  const query = new URLSearchParams({ redirect_port: String(port), ...(options.query ?? {}) });
149
200
  const oauthUrl = `${serverUrl}/admin/api/oauth-cli?${query.toString()}`;
201
+ const refusal = await requestRefusal(oauthUrl);
202
+ if (refusal) {
203
+ cleanup();
204
+ resolve({ success: false, error: refusal });
205
+ return;
206
+ }
150
207
  if (process.env.PRIMITIVE_NO_BROWSER === "1") {
151
208
  info(`Open this URL in a browser to continue: ${oauthUrl}`);
152
209
  return;
@@ -174,6 +231,356 @@ export async function browserLogin(serverUrl, options = {}) {
174
231
  }, timeoutMs);
175
232
  });
176
233
  }
234
+ /**
235
+ * Listens on `[::1]:port` with `handler`, answering the server, or null when
236
+ * this machine has no IPv6 loopback (no browser can reach `::1` then, and no
237
+ * other process can take it). Rejects when `::1` cannot be held, such as when
238
+ * another process already listens there: its callback would go elsewhere.
239
+ */
240
+ function listenIpv6Loopback(handler, port) {
241
+ return new Promise((resolve, reject) => {
242
+ const ipv6 = createServer(handler);
243
+ let settled = false;
244
+ ipv6.on("error", (err) => {
245
+ if (settled) {
246
+ error(`Local IPv6 callback server error: ${err.message}`);
247
+ return;
248
+ }
249
+ settled = true;
250
+ if (err.code === "EADDRNOTAVAIL" || err.code === "EAFNOSUPPORT")
251
+ resolve(null);
252
+ else
253
+ reject(err);
254
+ });
255
+ ipv6.listen(port, CALLBACK_HOST_IPV6, () => {
256
+ settled = true;
257
+ resolve(ipv6);
258
+ });
259
+ });
260
+ }
261
+ /**
262
+ * The server's refusal of a CLI request, read before any browser opens
263
+ * (#4512): `oauth-cli` answers 400 naming what is wrong with the request (an
264
+ * unknown app id, too many pins), which a browser would show where the CLI
265
+ * never sees it. Null when the server would start the sign-in, or cannot be
266
+ * asked; the browser then shows whatever it answers.
267
+ */
268
+ async function requestRefusal(oauthUrl) {
269
+ try {
270
+ const response = await fetchWithTLS(oauthUrl, { redirect: "manual" });
271
+ if (response.status !== 400)
272
+ return null;
273
+ const body = (await response.json().catch(() => null));
274
+ return typeof body?.error === "string" && body.error ? body.error : "The server refused this login request.";
275
+ }
276
+ catch {
277
+ return null;
278
+ }
279
+ }
280
+ const LOGIN_NOT_SERVED_MESSAGE = "This server does not serve the v2 login. Unset PRIMITIVE_LOGIN_V2 to log in the current way.";
281
+ const PRINTABLE_ERROR_MAX = 500;
282
+ /** True when `PRIMITIVE_LOGIN_V2` is exactly `1`: browser logins then run the v2 flow. */
283
+ export function loginV2Selected(env = process.env) {
284
+ return env.PRIMITIVE_LOGIN_V2 === "1";
285
+ }
286
+ /**
287
+ * What to print when the server refuses to start a v2 login: the routes are
288
+ * not served there (401 or 404), the server's own message otherwise, and for
289
+ * the start limit also when to try again.
290
+ */
291
+ export function startRefusalMessage(status, body, retryAfter) {
292
+ if (status === 401 || status === 404)
293
+ return LOGIN_NOT_SERVED_MESSAGE;
294
+ const sent = body?.error;
295
+ const message = typeof sent === "string" && sent ? printableError(sent) : `Starting the login failed (HTTP ${status}).`;
296
+ if (status === 429 && retryAfter !== null && /^\d+$/.test(retryAfter.trim())) {
297
+ return `${message}\nTry again in ${retryAfter.trim()} seconds.`;
298
+ }
299
+ return message;
300
+ }
301
+ /** The login app's finished page for `outcome`, on the origin of the login URL. */
302
+ export function finishedPageUrl(loginUrl, outcome) {
303
+ return `${new URL(loginUrl).origin}/done?outcome=${outcome}`;
304
+ }
305
+ /** `value` when it is an http or https URL, which the CLI may open; null otherwise. */
306
+ export function openableLoginUrl(value) {
307
+ if (typeof value !== "string" || !value)
308
+ return null;
309
+ try {
310
+ const url = new URL(value);
311
+ return url.protocol === "http:" || url.protocol === "https:" ? value : null;
312
+ }
313
+ catch {
314
+ return null;
315
+ }
316
+ }
317
+ /**
318
+ * The warning to print when a login signed in as another admin than the one
319
+ * already stored for this server, or null when there is none stored or it is
320
+ * the same admin. Admins are compared by id when both have one, else by email
321
+ * without regard to case.
322
+ */
323
+ export function differentAdminWarning(stored, signedIn, serverUrl) {
324
+ if (!stored || (!stored.adminId && !stored.email))
325
+ return null;
326
+ const same = stored.adminId && signedIn.adminId
327
+ ? stored.adminId === signedIn.adminId
328
+ : (stored.email ?? "").toLowerCase() === (signedIn.email ?? "").toLowerCase();
329
+ if (same)
330
+ return null;
331
+ return [
332
+ `Signed in as ${signedIn.email || signedIn.adminId}, not ${stored.email || stored.adminId}, the login stored for ${serverUrl}.`,
333
+ "If you did not expect this, someone else may have opened your login link. Run `primitive auth sessions list` and revoke the session you do not recognise, then run `primitive login` again.",
334
+ ];
335
+ }
336
+ /** `text` with control characters removed and capped at 500 characters, safe to print to a terminal. */
337
+ export function printableError(text) {
338
+ // eslint-disable-next-line no-control-regex
339
+ return text.replace(/[\u0000-\u001f\u007f-\u009f]/g, "").slice(0, PRINTABLE_ERROR_MAX);
340
+ }
341
+ /** The login already stored for this server, read before a v2 login replaces it; never `PRIMITIVE_TOKEN`'s. */
342
+ function storedLoginOn(serverUrl) {
343
+ try {
344
+ const stored = loadCredentials();
345
+ return stored && stored.source !== "env" && stored.serverUrl && sameServer(stored.serverUrl, serverUrl)
346
+ ? stored
347
+ : null;
348
+ }
349
+ catch {
350
+ return null;
351
+ }
352
+ }
353
+ /** Constant-time comparison of a callback's `state` with the login's own. */
354
+ function sameState(given, expected) {
355
+ const a = Buffer.from(given);
356
+ const b = Buffer.from(expected);
357
+ return a.length === b.length && timingSafeEqual(a, b);
358
+ }
359
+ /** The server's message in a refusal body, else `fallback`. */
360
+ async function refusalText(response, fallback) {
361
+ const text = await response.text().catch(() => "");
362
+ try {
363
+ const parsed = JSON.parse(text);
364
+ const message = parsed?.error || parsed?.message;
365
+ return typeof message === "string" && message ? printableError(message) : fallback;
366
+ }
367
+ catch {
368
+ return fallback;
369
+ }
370
+ }
371
+ /**
372
+ * The v2 browser login: the CLI starts an attempt with a PKCE challenge and
373
+ * a `state`, prints the match code, opens the login app, and exchanges the
374
+ * one-time code its loopback callback receives with the verifier only it
375
+ * holds. The browser is then sent to the login app's finished page.
376
+ */
377
+ async function browserLoginV2(serverUrl, options) {
378
+ const stored = storedLoginOn(serverUrl);
379
+ const partition = options.partition ?? partitionFromEnvironment();
380
+ const state = randomBytes(32).toString("base64url");
381
+ const codeVerifier = randomBytes(32).toString("base64url");
382
+ const codeChallenge = createHash("sha256").update(codeVerifier).digest("base64url");
383
+ const headers = { "Content-Type": "application/json" };
384
+ if (partition)
385
+ headers["X-Global-Admin-App-Id"] = partition;
386
+ return new Promise((resolve) => {
387
+ let server = createServer((req, res) => {
388
+ // A stray request must never end the login, so nothing the handler
389
+ // throws may become an unhandled rejection (which exits the CLI).
390
+ handleCallback(req, res).catch(() => {
391
+ if (!res.headersSent)
392
+ plain(res, 400, "Bad request");
393
+ else
394
+ res.end();
395
+ });
396
+ });
397
+ let timeoutId = null;
398
+ const sockets = new Set();
399
+ let attemptId = null;
400
+ let loginUrl = null;
401
+ let accepted = false;
402
+ let settled = false;
403
+ const finish = (result) => {
404
+ if (settled)
405
+ return;
406
+ settled = true;
407
+ if (timeoutId)
408
+ clearTimeout(timeoutId);
409
+ timeoutId = null;
410
+ for (const socket of sockets)
411
+ socket.destroy();
412
+ sockets.clear();
413
+ server?.close();
414
+ server = null;
415
+ resolve(result);
416
+ };
417
+ const sendToFinishedPage = (res, outcome) => {
418
+ res.writeHead(302, {
419
+ Location: finishedPageUrl(loginUrl, outcome),
420
+ "Cache-Control": "no-store",
421
+ "Referrer-Policy": "no-referrer",
422
+ Connection: "close",
423
+ });
424
+ res.end();
425
+ };
426
+ const plain = (res, status, text) => {
427
+ res.writeHead(status, { "Content-Type": "text/plain", "Cache-Control": "no-store", Connection: "close" });
428
+ res.end(text);
429
+ };
430
+ const handleCallback = async (req, res) => {
431
+ let url;
432
+ try {
433
+ url = new URL(req.url || "/", `http://${CALLBACK_HOST}`);
434
+ }
435
+ catch {
436
+ // A request target that is not a path (e.g. `//`) is not this
437
+ // login's callback: refused and ignored, like a wrong `state`.
438
+ plain(res, 400, "Bad request");
439
+ return;
440
+ }
441
+ if (url.pathname !== "/callback" || req.method !== "GET") {
442
+ plain(res, 404, "Not found");
443
+ return;
444
+ }
445
+ const given = url.searchParams.get("state");
446
+ // A callback without this login's state is not this login's: ignored,
447
+ // so no other local page can end or complete it. One is accepted.
448
+ if (accepted || !loginUrl || !attemptId || !given || !sameState(given, state)) {
449
+ plain(res, 400, "This callback does not belong to the login in progress.");
450
+ return;
451
+ }
452
+ accepted = true;
453
+ const errorParam = url.searchParams.get("error");
454
+ if (errorParam) {
455
+ const denied = errorParam === "denied";
456
+ sendToFinishedPage(res, denied ? "denied" : "failed");
457
+ finish({ success: false, error: denied ? "The request was denied in the browser." : printableError(errorParam) });
458
+ return;
459
+ }
460
+ const code = url.searchParams.get("code");
461
+ if (!code) {
462
+ sendToFinishedPage(res, "failed");
463
+ finish({ success: false, error: "No authorization code received" });
464
+ return;
465
+ }
466
+ try {
467
+ const response = await fetchWithTLS(`${serverUrl}/admin/api/login/token`, {
468
+ method: "POST",
469
+ headers,
470
+ body: JSON.stringify({ attemptId, code, codeVerifier }),
471
+ });
472
+ if (!response.ok) {
473
+ const message = await refusalText(response, "Token exchange failed");
474
+ sendToFinishedPage(res, "failed");
475
+ finish({ success: false, error: message });
476
+ return;
477
+ }
478
+ const tokenData = (await response.json());
479
+ const credentials = {
480
+ serverUrl,
481
+ accessToken: tokenData.accessToken,
482
+ refreshToken: tokenData.refreshToken || "",
483
+ expiresAt: tokenData.expiresAt || new Date(Date.now() + 3600 * 1000).toISOString(),
484
+ adminId: tokenData.adminId || "",
485
+ email: tokenData.email || "",
486
+ role: tokenData.role || "admin",
487
+ name: tokenData.name,
488
+ globalAdminAppId: tokenData.globalAdminAppId,
489
+ };
490
+ if (options.save !== false)
491
+ saveCredentials(credentials);
492
+ const warning = differentAdminWarning(stored, tokenData, serverUrl);
493
+ if (warning)
494
+ for (const line of warning)
495
+ warn(line);
496
+ sendToFinishedPage(res, "signed-in");
497
+ finish({ success: true, credentials, exchange: tokenData });
498
+ }
499
+ catch (err) {
500
+ sendToFinishedPage(res, "failed");
501
+ finish({ success: false, error: printableError(err?.message || "Token exchange failed") });
502
+ }
503
+ };
504
+ server.on("connection", (socket) => {
505
+ sockets.add(socket);
506
+ socket.on("close", () => sockets.delete(socket));
507
+ });
508
+ const requestedPort = callbackPort();
509
+ server.on("error", (err) => {
510
+ if (err.code === "EADDRINUSE") {
511
+ error(`Port ${requestedPort} is already in use. Please close any other bao-admin login processes.`);
512
+ }
513
+ else {
514
+ error(`Failed to start local server: ${err.message}`);
515
+ }
516
+ finish({ success: false, error: err.message });
517
+ });
518
+ // The server redirects to the literal 127.0.0.1, so no other address is held.
519
+ server.listen(requestedPort, CALLBACK_HOST, async () => {
520
+ const port = server?.address()?.port ?? requestedPort;
521
+ info(`Listening on port ${port} for callback...`);
522
+ let response;
523
+ try {
524
+ response = await fetchWithTLS(`${serverUrl}/admin/api/login/start`, {
525
+ method: "POST",
526
+ headers,
527
+ body: JSON.stringify({
528
+ redirectPort: port,
529
+ state,
530
+ codeChallenge,
531
+ codeChallengeMethod: "S256",
532
+ request: options.query ?? {},
533
+ }),
534
+ });
535
+ }
536
+ catch (err) {
537
+ finish({
538
+ success: false,
539
+ error: `Could not reach ${serverUrl} to start the login: ${printableError(err?.message || String(err))}`,
540
+ });
541
+ return;
542
+ }
543
+ if (!response.ok) {
544
+ const body = await response.json().catch(() => null);
545
+ finish({ success: false, error: startRefusalMessage(response.status, body, response.headers.get("retry-after")) });
546
+ return;
547
+ }
548
+ const started = (await response.json().catch(() => null));
549
+ const openable = openableLoginUrl(started?.loginUrl);
550
+ if (!openable || typeof started?.attemptId !== "string" || typeof started?.matchCode !== "string") {
551
+ finish({ success: false, error: "The server's answer to the login start has no login URL this CLI can open." });
552
+ return;
553
+ }
554
+ if (settled)
555
+ return;
556
+ attemptId = started.attemptId;
557
+ loginUrl = openable;
558
+ info(`Match code: ${printableError(started.matchCode)}`);
559
+ info("Approve this login only if the browser shows the same code.");
560
+ if (process.env.PRIMITIVE_NO_BROWSER === "1") {
561
+ info(`Open this URL in a browser to continue: ${loginUrl}`);
562
+ return;
563
+ }
564
+ try {
565
+ const childProcess = await open(loginUrl, { wait: false });
566
+ childProcess.unref();
567
+ info(`Browser opened. Please complete authentication.`);
568
+ info(`If the browser didn't open, visit: ${loginUrl}`);
569
+ }
570
+ catch {
571
+ error(`Could not open browser automatically.`);
572
+ info(`Please visit: ${loginUrl}`);
573
+ }
574
+ });
575
+ const timeoutMs = loginTimeoutMs();
576
+ timeoutId = setTimeout(() => {
577
+ if (settled)
578
+ return;
579
+ error(`Login timed out after ${Math.round(timeoutMs / 1000)} seconds.`);
580
+ finish({ success: false, error: "Login timeout" });
581
+ }, timeoutMs);
582
+ });
583
+ }
177
584
  function parseJwt(token) {
178
585
  try {
179
586
  const parts = token.split(".");
@@ -187,6 +594,15 @@ function parseJwt(token) {
187
594
  return {};
188
595
  }
189
596
  }
597
+ /** `text` with the characters HTML gives meaning to replaced by entities. */
598
+ function escapeHtml(text) {
599
+ return text
600
+ .replace(/&/g, "&amp;")
601
+ .replace(/</g, "&lt;")
602
+ .replace(/>/g, "&gt;")
603
+ .replace(/"/g, "&quot;")
604
+ .replace(/'/g, "&#39;");
605
+ }
190
606
  function getSuccessHtml(email) {
191
607
  return `
192
608
  <!DOCTYPE html>
@@ -253,7 +669,7 @@ function getSuccessHtml(email) {
253
669
  <svg viewBox="0 0 24 24"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>
254
670
  </div>
255
671
  <h1>Login Successful!</h1>
256
- <p>You're now logged in as <span class="email">${email}</span></p>
672
+ <p>You're now logged in as <span class="email">${escapeHtml(email)}</span></p>
257
673
  <p class="close-note">You can close this window and return to the terminal.</p>
258
674
  </div>
259
675
  </body>
@@ -326,7 +742,7 @@ function getErrorHtml(errorMessage) {
326
742
  </div>
327
743
  <h1>Login Failed</h1>
328
744
  <p>There was a problem completing authentication.</p>
329
- <div class="error-message">${errorMessage}</div>
745
+ <div class="error-message">${escapeHtml(errorMessage)}</div>
330
746
  </div>
331
747
  </body>
332
748
  </html>