veryfront 0.1.1237 → 0.1.1239

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 (493) hide show
  1. package/esm/cli/auth/login.d.ts +24 -2
  2. package/esm/cli/auth/login.d.ts.map +1 -1
  3. package/esm/cli/auth/login.js +444 -35
  4. package/esm/cli/commands/build/error-handler.d.ts.map +1 -1
  5. package/esm/cli/commands/build/error-handler.js +41 -3
  6. package/esm/cli/commands/build/handler.d.ts.map +1 -1
  7. package/esm/cli/commands/build/handler.js +1 -1
  8. package/esm/cli/commands/dev/command.d.ts.map +1 -1
  9. package/esm/cli/commands/dev/command.js +14 -1
  10. package/esm/cli/commands/dev/inference-status.d.ts +6 -0
  11. package/esm/cli/commands/dev/inference-status.d.ts.map +1 -1
  12. package/esm/cli/commands/dev/inference-status.js +14 -2
  13. package/esm/cli/commands/generate/command.d.ts.map +1 -1
  14. package/esm/cli/commands/generate/command.js +61 -0
  15. package/esm/cli/commands/init/init-command.d.ts.map +1 -1
  16. package/esm/cli/commands/init/init-command.js +23 -31
  17. package/esm/cli/commands/install/registry.d.ts.map +1 -1
  18. package/esm/cli/commands/install/registry.js +6 -9
  19. package/esm/cli/commands/login/command-help.d.ts.map +1 -1
  20. package/esm/cli/commands/login/command-help.js +3 -1
  21. package/esm/cli/commands/pull/command.d.ts +1 -0
  22. package/esm/cli/commands/pull/command.d.ts.map +1 -1
  23. package/esm/cli/commands/pull/command.js +49 -6
  24. package/esm/cli/commands/push/command-help.d.ts.map +1 -1
  25. package/esm/cli/commands/push/command-help.js +7 -0
  26. package/esm/cli/commands/push/command.d.ts +23 -12
  27. package/esm/cli/commands/push/command.d.ts.map +1 -1
  28. package/esm/cli/commands/push/command.js +461 -44
  29. package/esm/cli/commands/push/plan.d.ts +35 -0
  30. package/esm/cli/commands/push/plan.d.ts.map +1 -0
  31. package/esm/cli/commands/push/plan.js +96 -0
  32. package/esm/cli/commands/schedule/handler.d.ts +21 -2
  33. package/esm/cli/commands/schedule/handler.d.ts.map +1 -1
  34. package/esm/cli/commands/schedule/handler.js +74 -27
  35. package/esm/cli/commands/schema/command-help.js +1 -1
  36. package/esm/cli/commands/up/command.js +1 -1
  37. package/esm/cli/commands/webhook/handler.d.ts.map +1 -1
  38. package/esm/cli/commands/webhook/handler.js +3 -1
  39. package/esm/cli/router.d.ts.map +1 -1
  40. package/esm/cli/router.js +27 -5
  41. package/esm/cli/shared/args.d.ts +15 -1
  42. package/esm/cli/shared/args.d.ts.map +1 -1
  43. package/esm/cli/shared/args.js +56 -3
  44. package/esm/cli/shared/config.d.ts +11 -2
  45. package/esm/cli/shared/config.d.ts.map +1 -1
  46. package/esm/cli/shared/config.js +72 -27
  47. package/esm/cli/shared/project-creation.js +1 -1
  48. package/esm/cli/sync/state.d.ts +20 -0
  49. package/esm/cli/sync/state.d.ts.map +1 -0
  50. package/esm/cli/sync/state.js +193 -0
  51. package/esm/deno.js +2 -2
  52. package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.d.ts.map +1 -1
  53. package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.js +852 -21
  54. package/esm/extensions/ext-observability-sentry/src/policy.d.ts +2 -0
  55. package/esm/extensions/ext-observability-sentry/src/policy.d.ts.map +1 -1
  56. package/esm/extensions/ext-observability-sentry/src/policy.js +214 -3
  57. package/esm/src/agent/conversation/delegation-policy.d.ts +2 -0
  58. package/esm/src/agent/conversation/delegation-policy.d.ts.map +1 -1
  59. package/esm/src/agent/conversation/delegation-policy.js +13 -3
  60. package/esm/src/agent/conversation/hosted-terminal.d.ts.map +1 -1
  61. package/esm/src/agent/conversation/hosted-terminal.js +6 -2
  62. package/esm/src/agent/conversation/run-chunk-mirror.d.ts.map +1 -1
  63. package/esm/src/agent/conversation/run-chunk-mirror.js +14 -2
  64. package/esm/src/agent/factory.d.ts.map +1 -1
  65. package/esm/src/agent/factory.js +22 -11
  66. package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +2 -0
  67. package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -1
  68. package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +6 -1
  69. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts +2 -1
  70. package/esm/src/agent/hosted/child-fork-execution-runner.d.ts.map +1 -1
  71. package/esm/src/agent/hosted/child-fork-execution-runner.js +6 -3
  72. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts +12 -3
  73. package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -1
  74. package/esm/src/agent/hosted/child-fork-step-message-preparation.js +16 -3
  75. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts +1 -1
  76. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts.map +1 -1
  77. package/esm/src/agent/hosted/cloud-agent-chat-execution.js +3 -3
  78. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts +11 -0
  79. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts.map +1 -1
  80. package/esm/src/agent/hosted/cloud-agent-child-tools.js +2 -3
  81. package/esm/src/agent/hosted/cloud-agent-config.d.ts +1 -0
  82. package/esm/src/agent/hosted/cloud-agent-config.d.ts.map +1 -1
  83. package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts +16 -1
  84. package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts.map +1 -1
  85. package/esm/src/agent/hosted/cloud-runtime-system-messages.js +13 -3
  86. package/esm/src/agent/hosted/default-chat-runtime.d.ts +2 -1
  87. package/esm/src/agent/hosted/default-chat-runtime.d.ts.map +1 -1
  88. package/esm/src/agent/hosted/default-chat-runtime.js +18 -7
  89. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts +2 -1
  90. package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts.map +1 -1
  91. package/esm/src/agent/hosted/default-invoke-agent-tool.js +11 -3
  92. package/esm/src/agent/hosted/default-project-steering-refresh.d.ts +2 -1
  93. package/esm/src/agent/hosted/default-project-steering-refresh.d.ts.map +1 -1
  94. package/esm/src/agent/hosted/default-project-steering-refresh.js +4 -1
  95. package/esm/src/agent/hosted/runtime-state-resolver.d.ts +6 -4
  96. package/esm/src/agent/hosted/runtime-state-resolver.d.ts.map +1 -1
  97. package/esm/src/agent/hosted/runtime-state-resolver.js +8 -11
  98. package/esm/src/agent/index.d.ts +3 -3
  99. package/esm/src/agent/index.d.ts.map +1 -1
  100. package/esm/src/agent/project/agent-runtime.d.ts.map +1 -1
  101. package/esm/src/agent/project/agent-runtime.js +6 -3
  102. package/esm/src/agent/runtime/agent-definition.d.ts +68 -66
  103. package/esm/src/agent/runtime/agent-definition.d.ts.map +1 -1
  104. package/esm/src/agent/runtime/agent-definition.js +15 -2
  105. package/esm/src/agent/runtime/agent-invocation-contract.d.ts +2 -0
  106. package/esm/src/agent/runtime/agent-invocation-contract.d.ts.map +1 -1
  107. package/esm/src/agent/runtime/agent-markdown-adapter.js +1 -1
  108. package/esm/src/agent/runtime/agent-runtime-step.d.ts +11 -5
  109. package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -1
  110. package/esm/src/agent/runtime/agent-runtime-step.js +23 -6
  111. package/esm/src/agent/runtime/call-context.d.ts +42 -11
  112. package/esm/src/agent/runtime/call-context.d.ts.map +1 -1
  113. package/esm/src/agent/runtime/call-context.js +480 -42
  114. package/esm/src/agent/runtime/chat-stream-handler.d.ts +18 -0
  115. package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
  116. package/esm/src/agent/runtime/chat-stream-handler.js +38 -18
  117. package/esm/src/agent/runtime/effective-agent-system.d.ts +13 -4
  118. package/esm/src/agent/runtime/effective-agent-system.d.ts.map +1 -1
  119. package/esm/src/agent/runtime/effective-agent-system.js +29 -0
  120. package/esm/src/agent/runtime/index.d.ts +1 -0
  121. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  122. package/esm/src/agent/runtime/index.js +638 -53
  123. package/esm/src/agent/runtime/load-skill-tool.d.ts +33 -3
  124. package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
  125. package/esm/src/agent/runtime/load-skill-tool.js +152 -21
  126. package/esm/src/agent/runtime/model-resolution.d.ts +3 -0
  127. package/esm/src/agent/runtime/model-resolution.d.ts.map +1 -1
  128. package/esm/src/agent/runtime/model-resolution.js +14 -0
  129. package/esm/src/agent/runtime/model-transport.d.ts +1 -0
  130. package/esm/src/agent/runtime/model-transport.d.ts.map +1 -1
  131. package/esm/src/agent/runtime/model-transport.js +5 -2
  132. package/esm/src/agent/runtime/run-runtime-context.d.ts +4 -0
  133. package/esm/src/agent/runtime/run-runtime-context.d.ts.map +1 -1
  134. package/esm/src/agent/runtime/run-runtime-context.js +9 -3
  135. package/esm/src/agent/runtime/runtime-tool-config.d.ts +1 -0
  136. package/esm/src/agent/runtime/runtime-tool-config.d.ts.map +1 -1
  137. package/esm/src/agent/runtime/skill-prompt.d.ts +3 -0
  138. package/esm/src/agent/runtime/skill-prompt.d.ts.map +1 -1
  139. package/esm/src/agent/runtime/skill-prompt.js +113 -25
  140. package/esm/src/agent/runtime/streamed-assistant-message.d.ts +22 -2
  141. package/esm/src/agent/runtime/streamed-assistant-message.d.ts.map +1 -1
  142. package/esm/src/agent/runtime/streamed-assistant-message.js +26 -5
  143. package/esm/src/agent/runtime/tool-inventory.d.ts.map +1 -1
  144. package/esm/src/agent/runtime/tool-inventory.js +13 -9
  145. package/esm/src/agent/runtime/tool-result-continuation.d.ts +4 -2
  146. package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -1
  147. package/esm/src/agent/runtime/tool-result-continuation.js +24 -20
  148. package/esm/src/agent/schemas/agent.schema.d.ts +2 -2
  149. package/esm/src/agent/service/runtime.js +1 -1
  150. package/esm/src/agent/streaming/fork-runtime-stream.d.ts +5 -4
  151. package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
  152. package/esm/src/agent/types.d.ts +14 -1
  153. package/esm/src/agent/types.d.ts.map +1 -1
  154. package/esm/src/chat/chat-ui-message-helpers.d.ts.map +1 -1
  155. package/esm/src/chat/chat-ui-message-helpers.js +75 -16
  156. package/esm/src/config/loader.d.ts.map +1 -1
  157. package/esm/src/config/loader.js +37 -1
  158. package/esm/src/errors/catalog/build-errors.d.ts.map +1 -1
  159. package/esm/src/errors/catalog/build-errors.js +14 -0
  160. package/esm/src/errors/error-registry/build.d.ts +2 -0
  161. package/esm/src/errors/error-registry/build.d.ts.map +1 -1
  162. package/esm/src/errors/error-registry/build.js +8 -0
  163. package/esm/src/errors/error-registry/deploy.d.ts +4 -0
  164. package/esm/src/errors/error-registry/deploy.d.ts.map +1 -1
  165. package/esm/src/errors/error-registry/deploy.js +16 -0
  166. package/esm/src/errors/error-registry.d.ts +3 -0
  167. package/esm/src/errors/error-registry.d.ts.map +1 -1
  168. package/esm/src/errors/index.d.ts +2 -1
  169. package/esm/src/errors/index.d.ts.map +1 -1
  170. package/esm/src/errors/index.js +4 -3
  171. package/esm/src/errors/tenant-classification.d.ts +25 -0
  172. package/esm/src/errors/tenant-classification.d.ts.map +1 -0
  173. package/esm/src/errors/tenant-classification.js +61 -0
  174. package/esm/src/extensions/builtin-extensions.d.ts +10 -15
  175. package/esm/src/extensions/builtin-extensions.d.ts.map +1 -1
  176. package/esm/src/extensions/builtin-extensions.js +32 -26
  177. package/esm/src/extensions/deferred-extension.d.ts +4 -4
  178. package/esm/src/extensions/deferred-extension.js +4 -4
  179. package/esm/src/extensions/index.d.ts +1 -0
  180. package/esm/src/extensions/index.d.ts.map +1 -1
  181. package/esm/src/extensions/index.js +1 -0
  182. package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
  183. package/esm/src/integrations/_data.d.ts.map +1 -1
  184. package/esm/src/integrations/_data.js +6 -0
  185. package/esm/src/integrations/schema.d.ts +8 -0
  186. package/esm/src/integrations/schema.d.ts.map +1 -1
  187. package/esm/src/integrations/schema.js +3 -0
  188. package/esm/src/integrations/types.d.ts +2 -0
  189. package/esm/src/integrations/types.d.ts.map +1 -1
  190. package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
  191. package/esm/src/internal-agents/run-stream.js +35 -20
  192. package/esm/src/internal-agents/run-system-prompt.d.ts +7 -2
  193. package/esm/src/internal-agents/run-system-prompt.d.ts.map +1 -1
  194. package/esm/src/internal-agents/run-system-prompt.js +19 -13
  195. package/esm/src/internal-agents/schema.d.ts +2 -0
  196. package/esm/src/internal-agents/schema.d.ts.map +1 -1
  197. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  198. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +2 -18
  199. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts +11 -0
  200. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts.map +1 -1
  201. package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.js +53 -6
  202. package/esm/src/observability/application-error-contract.d.ts +4 -0
  203. package/esm/src/observability/application-error-contract.d.ts.map +1 -1
  204. package/esm/src/observability/application-errors.d.ts.map +1 -1
  205. package/esm/src/observability/application-errors.js +64 -3
  206. package/esm/src/platform/adapters/runtime/deno/http-server.d.ts.map +1 -1
  207. package/esm/src/platform/adapters/runtime/deno/http-server.js +2 -10
  208. package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts +14 -0
  209. package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts.map +1 -1
  210. package/esm/src/platform/adapters/runtime/shared/request-peer.js +82 -0
  211. package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
  212. package/esm/src/provider/runtime-loader/provider-http.d.ts +5 -1
  213. package/esm/src/provider/runtime-loader/provider-http.d.ts.map +1 -1
  214. package/esm/src/provider/runtime-loader/provider-http.js +55 -17
  215. package/esm/src/provider/shared/index.d.ts +1 -0
  216. package/esm/src/provider/shared/index.d.ts.map +1 -1
  217. package/esm/src/provider/shared/index.js +2 -0
  218. package/esm/src/provider/types.d.ts +1 -0
  219. package/esm/src/provider/types.d.ts.map +1 -1
  220. package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts +3 -0
  221. package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts.map +1 -0
  222. package/esm/src/react/components/ui/adapter/builtin/combobox.js +204 -0
  223. package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts +3 -0
  224. package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts.map +1 -0
  225. package/esm/src/react/components/ui/adapter/builtin/dialog.js +20 -0
  226. package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts +3 -0
  227. package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts.map +1 -0
  228. package/esm/src/react/components/ui/adapter/builtin/drawer.js +21 -0
  229. package/esm/src/react/components/ui/adapter/builtin/index.d.ts.map +1 -1
  230. package/esm/src/react/components/ui/adapter/builtin/index.js +10 -0
  231. package/esm/src/react/components/ui/adapter/builtin/popover.d.ts +3 -0
  232. package/esm/src/react/components/ui/adapter/builtin/popover.d.ts.map +1 -0
  233. package/esm/src/react/components/ui/adapter/builtin/popover.js +28 -0
  234. package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts +3 -0
  235. package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts.map +1 -0
  236. package/esm/src/react/components/ui/adapter/builtin/tabs.js +73 -0
  237. package/esm/src/react/components/ui/adapter/context.d.ts.map +1 -1
  238. package/esm/src/react/components/ui/adapter/context.js +10 -0
  239. package/esm/src/react/components/ui/adapter/contract.d.ts +212 -0
  240. package/esm/src/react/components/ui/adapter/contract.d.ts.map +1 -1
  241. package/esm/src/react/components/ui/adapter/token-scope.d.ts +24 -0
  242. package/esm/src/react/components/ui/adapter/token-scope.d.ts.map +1 -0
  243. package/esm/src/react/components/ui/adapter/token-scope.js +26 -0
  244. package/esm/src/react/components/ui/alert-dialog.d.ts +101 -0
  245. package/esm/src/react/components/ui/alert-dialog.d.ts.map +1 -0
  246. package/esm/src/react/components/ui/alert-dialog.js +181 -0
  247. package/esm/src/react/components/ui/aspect-ratio.d.ts +18 -0
  248. package/esm/src/react/components/ui/aspect-ratio.d.ts.map +1 -0
  249. package/esm/src/react/components/ui/aspect-ratio.js +13 -0
  250. package/esm/src/react/components/ui/autocomplete.d.ts +67 -0
  251. package/esm/src/react/components/ui/autocomplete.d.ts.map +1 -0
  252. package/esm/src/react/components/ui/autocomplete.js +59 -0
  253. package/esm/src/react/components/ui/breadcrumb.d.ts +86 -0
  254. package/esm/src/react/components/ui/breadcrumb.d.ts.map +1 -0
  255. package/esm/src/react/components/ui/breadcrumb.js +67 -0
  256. package/esm/src/react/components/ui/calendar.d.ts +40 -0
  257. package/esm/src/react/components/ui/calendar.d.ts.map +1 -0
  258. package/esm/src/react/components/ui/calendar.js +170 -0
  259. package/esm/src/react/components/ui/combobox.d.ts +74 -0
  260. package/esm/src/react/components/ui/combobox.d.ts.map +1 -0
  261. package/esm/src/react/components/ui/combobox.js +100 -0
  262. package/esm/src/react/components/ui/context-menu.d.ts +116 -0
  263. package/esm/src/react/components/ui/context-menu.d.ts.map +1 -0
  264. package/esm/src/react/components/ui/context-menu.js +168 -0
  265. package/esm/src/react/components/ui/date-picker.d.ts +69 -0
  266. package/esm/src/react/components/ui/date-picker.d.ts.map +1 -0
  267. package/esm/src/react/components/ui/date-picker.js +96 -0
  268. package/esm/src/react/components/ui/dialog.d.ts +41 -11
  269. package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
  270. package/esm/src/react/components/ui/dialog.js +47 -28
  271. package/esm/src/react/components/ui/drawer.d.ts +31 -8
  272. package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
  273. package/esm/src/react/components/ui/drawer.js +33 -22
  274. package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
  275. package/esm/src/react/components/ui/dropdown-menu.js +7 -75
  276. package/esm/src/react/components/ui/field.d.ts +70 -0
  277. package/esm/src/react/components/ui/field.d.ts.map +1 -0
  278. package/esm/src/react/components/ui/field.js +161 -0
  279. package/esm/src/react/components/ui/file-type.d.ts +9 -8
  280. package/esm/src/react/components/ui/file-type.d.ts.map +1 -1
  281. package/esm/src/react/components/ui/file-type.js +8 -8
  282. package/esm/src/react/components/ui/hover-card.d.ts +82 -0
  283. package/esm/src/react/components/ui/hover-card.d.ts.map +1 -0
  284. package/esm/src/react/components/ui/hover-card.js +140 -0
  285. package/esm/src/react/components/ui/index.d.ts +23 -2
  286. package/esm/src/react/components/ui/index.d.ts.map +1 -1
  287. package/esm/src/react/components/ui/index.js +21 -0
  288. package/esm/src/react/components/ui/input-otp.d.ts +37 -0
  289. package/esm/src/react/components/ui/input-otp.d.ts.map +1 -0
  290. package/esm/src/react/components/ui/input-otp.js +42 -0
  291. package/esm/src/react/components/ui/menu-keyboard.d.ts +8 -0
  292. package/esm/src/react/components/ui/menu-keyboard.d.ts.map +1 -0
  293. package/esm/src/react/components/ui/menu-keyboard.js +76 -0
  294. package/esm/src/react/components/ui/menubar.d.ts +98 -0
  295. package/esm/src/react/components/ui/menubar.d.ts.map +1 -0
  296. package/esm/src/react/components/ui/menubar.js +173 -0
  297. package/esm/src/react/components/ui/meter.d.ts +45 -0
  298. package/esm/src/react/components/ui/meter.d.ts.map +1 -0
  299. package/esm/src/react/components/ui/meter.js +59 -0
  300. package/esm/src/react/components/ui/modal-surface.d.ts +7 -1
  301. package/esm/src/react/components/ui/modal-surface.d.ts.map +1 -1
  302. package/esm/src/react/components/ui/modal-surface.js +23 -6
  303. package/esm/src/react/components/ui/navigation-menu.d.ts +101 -0
  304. package/esm/src/react/components/ui/navigation-menu.d.ts.map +1 -0
  305. package/esm/src/react/components/ui/navigation-menu.js +195 -0
  306. package/esm/src/react/components/ui/number-field.d.ts +46 -0
  307. package/esm/src/react/components/ui/number-field.d.ts.map +1 -0
  308. package/esm/src/react/components/ui/number-field.js +121 -0
  309. package/esm/src/react/components/ui/pagination.d.ts +77 -0
  310. package/esm/src/react/components/ui/pagination.d.ts.map +1 -0
  311. package/esm/src/react/components/ui/pagination.js +62 -0
  312. package/esm/src/react/components/ui/popover.d.ts +42 -13
  313. package/esm/src/react/components/ui/popover.d.ts.map +1 -1
  314. package/esm/src/react/components/ui/popover.js +25 -12
  315. package/esm/src/react/components/ui/scroll-area.d.ts +38 -0
  316. package/esm/src/react/components/ui/scroll-area.d.ts.map +1 -0
  317. package/esm/src/react/components/ui/scroll-area.js +35 -0
  318. package/esm/src/react/components/ui/separator.d.ts +20 -0
  319. package/esm/src/react/components/ui/separator.d.ts.map +1 -0
  320. package/esm/src/react/components/ui/separator.js +13 -0
  321. package/esm/src/react/components/ui/slider.d.ts +44 -0
  322. package/esm/src/react/components/ui/slider.d.ts.map +1 -0
  323. package/esm/src/react/components/ui/slider.js +46 -0
  324. package/esm/src/react/components/ui/status.d.ts +6 -5
  325. package/esm/src/react/components/ui/status.d.ts.map +1 -1
  326. package/esm/src/react/components/ui/status.js +4 -4
  327. package/esm/src/react/components/ui/tabs.d.ts +32 -9
  328. package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
  329. package/esm/src/react/components/ui/tabs.js +46 -22
  330. package/esm/src/react/components/ui/toggle.d.ts +26 -0
  331. package/esm/src/react/components/ui/toggle.d.ts.map +1 -0
  332. package/esm/src/react/components/ui/toggle.js +29 -0
  333. package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts +2 -1
  334. package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts.map +1 -1
  335. package/esm/src/react/components/ui/use-isomorphic-layout-effect.js +6 -3
  336. package/esm/src/rendering/chunk-optimizer/source-imports.d.ts.map +1 -1
  337. package/esm/src/rendering/chunk-optimizer/source-imports.js +4 -114
  338. package/esm/src/rendering/orchestrator/css-candidate-manifest.d.ts.map +1 -1
  339. package/esm/src/rendering/orchestrator/css-candidate-manifest.js +30 -1
  340. package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts +10 -0
  341. package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts.map +1 -1
  342. package/esm/src/rendering/orchestrator/module-loader/build-failure.js +50 -3
  343. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts +2 -0
  344. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -1
  345. package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +21 -6
  346. package/esm/src/rendering/orchestrator/module-loader/index.d.ts +2 -1
  347. package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
  348. package/esm/src/rendering/orchestrator/module-loader/index.js +190 -7
  349. package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +4 -0
  350. package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -1
  351. package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +374 -7
  352. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  353. package/esm/src/rendering/orchestrator/pipeline.js +12 -1
  354. package/esm/src/runs/runs-client.d.ts +2 -4
  355. package/esm/src/runs/runs-client.d.ts.map +1 -1
  356. package/esm/src/runs/schemas.d.ts +18 -8
  357. package/esm/src/runs/schemas.d.ts.map +1 -1
  358. package/esm/src/runs/schemas.js +26 -0
  359. package/esm/src/runtime/model-call-context.d.ts +6 -1
  360. package/esm/src/runtime/model-call-context.d.ts.map +1 -1
  361. package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
  362. package/esm/src/runtime/runtime-bridge.js +133 -15
  363. package/esm/src/schedule/factory.d.ts +8 -2
  364. package/esm/src/schedule/factory.d.ts.map +1 -1
  365. package/esm/src/schedule/factory.js +0 -8
  366. package/esm/src/schedule/index.d.ts +10 -1
  367. package/esm/src/schedule/index.d.ts.map +1 -1
  368. package/esm/src/schedule/index.js +9 -0
  369. package/esm/src/schedule/types.d.ts +30 -11
  370. package/esm/src/schedule/types.d.ts.map +1 -1
  371. package/esm/src/schedule/validation.d.ts +17 -0
  372. package/esm/src/schedule/validation.d.ts.map +1 -1
  373. package/esm/src/schedule/validation.js +93 -5
  374. package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
  375. package/esm/src/security/sandbox/worker-pool.js +6 -1
  376. package/esm/src/server/bootstrap.d.ts.map +1 -1
  377. package/esm/src/server/bootstrap.js +6 -0
  378. package/esm/src/server/dev-server/index.d.ts +1 -1
  379. package/esm/src/server/dev-server/index.d.ts.map +1 -1
  380. package/esm/src/server/dev-server/server.d.ts +7 -3
  381. package/esm/src/server/dev-server/server.d.ts.map +1 -1
  382. package/esm/src/server/dev-server/server.js +12 -3
  383. package/esm/src/server/dev-server/types.d.ts +7 -1
  384. package/esm/src/server/dev-server/types.d.ts.map +1 -1
  385. package/esm/src/server/dev-server.d.ts +1 -1
  386. package/esm/src/server/dev-server.d.ts.map +1 -1
  387. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  388. package/esm/src/server/handlers/dev/framework-candidates.generated.js +2509 -34
  389. package/esm/src/server/handlers/dev/projects/index.d.ts.map +1 -1
  390. package/esm/src/server/handlers/dev/projects/index.js +3 -0
  391. package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
  392. package/esm/src/server/handlers/request/agent-stream.handler.js +29 -24
  393. package/esm/src/server/index.d.ts +3 -3
  394. package/esm/src/server/index.d.ts.map +1 -1
  395. package/esm/src/server/index.js +10 -5
  396. package/esm/src/server/node-handler.d.ts.map +1 -1
  397. package/esm/src/server/node-handler.js +4 -1
  398. package/esm/src/server/production-server.d.ts.map +1 -1
  399. package/esm/src/server/production-server.js +2 -1
  400. package/esm/src/server/project-env/cache.d.ts +17 -0
  401. package/esm/src/server/project-env/cache.d.ts.map +1 -1
  402. package/esm/src/server/project-env/cache.js +78 -2
  403. package/esm/src/server/project-env/fetcher.d.ts.map +1 -1
  404. package/esm/src/server/project-env/fetcher.js +24 -14
  405. package/esm/src/server/project-env/index.d.ts +1 -1
  406. package/esm/src/server/project-env/index.d.ts.map +1 -1
  407. package/esm/src/server/project-env/index.js +1 -1
  408. package/esm/src/server/project-env/internal-authorization.d.ts +7 -0
  409. package/esm/src/server/project-env/internal-authorization.d.ts.map +1 -0
  410. package/esm/src/server/project-env/internal-authorization.js +32 -0
  411. package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
  412. package/esm/src/server/runtime-handler/index.js +1 -1
  413. package/esm/src/server/runtime-handler/projects-handler.d.ts +1 -1
  414. package/esm/src/server/runtime-handler/projects-handler.d.ts.map +1 -1
  415. package/esm/src/server/runtime-handler/projects-handler.js +4 -2
  416. package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
  417. package/esm/src/transforms/esm/http-bundler.js +6 -5
  418. package/esm/src/transforms/esm/http-cache-helpers.d.ts +11 -0
  419. package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
  420. package/esm/src/transforms/esm/http-cache-helpers.js +35 -0
  421. package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
  422. package/esm/src/transforms/esm/http-cache.js +16 -10
  423. package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
  424. package/esm/src/transforms/esm/specifier-resolver.js +87 -7
  425. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts +2 -0
  426. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts.map +1 -1
  427. package/esm/src/transforms/import-rewriter/strategies/alias-strategy.js +11 -6
  428. package/esm/src/transforms/md/compiler/md-compiler.d.ts.map +1 -1
  429. package/esm/src/transforms/md/compiler/md-compiler.js +12 -5
  430. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts +2 -0
  431. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts.map +1 -1
  432. package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +33 -1
  433. package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts.map +1 -1
  434. package/esm/src/transforms/mdx/compiler/mdx-compiler.js +46 -7
  435. package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
  436. package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +8 -2
  437. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts +1 -0
  438. package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
  439. package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +3 -0
  440. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts +4 -0
  441. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts.map +1 -1
  442. package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.js +44 -8
  443. package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts +2 -0
  444. package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts.map +1 -1
  445. package/esm/src/transforms/mdx/esm-module-loader/missing-module.js +4 -0
  446. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -1
  447. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +5 -1
  448. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts +2 -0
  449. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts.map +1 -1
  450. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.js +50 -11
  451. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts +24 -12
  452. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts.map +1 -1
  453. package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.js +201 -18
  454. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +5 -0
  455. package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
  456. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts +22 -2
  457. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts.map +1 -1
  458. package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.js +2080 -129
  459. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts +11 -1
  460. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts.map +1 -1
  461. package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.js +32 -15
  462. package/esm/src/transforms/pipeline/stages/compile.d.ts.map +1 -1
  463. package/esm/src/transforms/pipeline/stages/compile.js +44 -0
  464. package/esm/src/transforms/shared/specifier-suffix.d.ts +25 -0
  465. package/esm/src/transforms/shared/specifier-suffix.d.ts.map +1 -0
  466. package/esm/src/transforms/shared/specifier-suffix.js +43 -0
  467. package/esm/src/trigger/index.d.ts +2 -2
  468. package/esm/src/trigger/index.d.ts.map +1 -1
  469. package/esm/src/trigger/index.js +1 -1
  470. package/esm/src/trigger/local-runner.d.ts +2 -2
  471. package/esm/src/trigger/local-runner.d.ts.map +1 -1
  472. package/esm/src/trigger/local-runner.js +11 -4
  473. package/esm/src/trigger/target.d.ts +97 -5
  474. package/esm/src/trigger/target.d.ts.map +1 -1
  475. package/esm/src/trigger/target.js +175 -5
  476. package/esm/src/utils/version-constant.d.ts +1 -1
  477. package/esm/src/utils/version-constant.js +1 -1
  478. package/esm/src/webhook/types.d.ts +21 -6
  479. package/esm/src/webhook/types.d.ts.map +1 -1
  480. package/esm/src/webhook/validation.d.ts.map +1 -1
  481. package/esm/src/webhook/validation.js +27 -39
  482. package/esm/templates/index.d.ts +1 -1
  483. package/esm/templates/index.d.ts.map +1 -1
  484. package/esm/templates/loader.d.ts +6 -6
  485. package/esm/templates/loader.d.ts.map +1 -1
  486. package/esm/templates/loader.js +34 -18
  487. package/esm/templates/manifest.generated.d.ts +3 -0
  488. package/esm/templates/manifest.generated.d.ts.map +1 -0
  489. package/esm/templates/manifest.generated.js +2 -0
  490. package/package.json +8 -8
  491. package/esm/templates/manifest.d.ts +0 -664
  492. package/esm/templates/manifest.d.ts.map +0 -1
  493. package/esm/templates/manifest.js +0 -662
@@ -1,6 +1,17 @@
1
1
  import { type EnvironmentConfig } from "../../src/config/index.js";
2
2
  import { deleteToken, hasToken, readToken, saveToken } from "./token-store.js";
3
3
  import { type SpinnerController } from "../ui/progress.js";
4
+ /**
5
+ * Describe where an API-token credential actually came from.
6
+ *
7
+ * `.env` files in the working directory are loaded into the environment, so a
8
+ * token can arrive under `VERYFRONT_API_TOKEN` while that variable is unset in
9
+ * the developer's shell. Reporting only the variable name sends them to check
10
+ * something they can see is empty; naming the file ends the search. Identity is
11
+ * directory-dependent for every command that infers a project from config, so
12
+ * this is worth the extra clause.
13
+ */
14
+ export declare function formatEnvSourcePathForDisplay(file: string, currentCwd?: string): string;
4
15
  export type AuthMethod = "google" | "github" | "microsoft" | "token";
5
16
  export interface UserInfo {
6
17
  id: string;
@@ -14,7 +25,18 @@ export interface ApiKeyIdentity {
14
25
  export type AuthIdentity = UserInfo | ApiKeyIdentity;
15
26
  export interface CredentialValidationOptions {
16
27
  throwOnNetworkError?: boolean;
28
+ throwOnCredentialValidationUnavailable?: boolean;
29
+ /** Reuse a caller-owned cancellation or deadline across validation attempts. */
30
+ signal?: AbortSignal;
31
+ /**
32
+ * Abort the request after this many milliseconds. Callers that must stay
33
+ * responsive pass a deadline; omitting it keeps the previous unbounded
34
+ * behaviour for callers that are already the user's main action.
35
+ */
36
+ timeoutMs?: number;
17
37
  }
38
+ /** Test seam: shrink the preflight deadline so a stall is observable quickly. */
39
+ export declare function __setExistingSessionTimeoutForTests(ms?: number): void;
18
40
  export declare function createOAuthState(): string;
19
41
  export declare function createOAuthAuthorizationUrl(provider: "google" | "github" | "microsoft", callbackUrl: string, state: string, env?: EnvironmentConfig): string;
20
42
  export declare function validateToken(token: string, env?: EnvironmentConfig, options?: CredentialValidationOptions): Promise<UserInfo | null>;
@@ -22,8 +44,8 @@ export declare function isApiKeyToken(token: string): boolean;
22
44
  export declare function isApiKeyIdentity(identity: AuthIdentity): identity is ApiKeyIdentity;
23
45
  export declare function validateCredential(token: string, env?: EnvironmentConfig, options?: CredentialValidationOptions): Promise<AuthIdentity | null>;
24
46
  export declare function openOAuthLogin(authUrl: string, spinner: SpinnerController, opener?: (url: string) => Promise<void>): Promise<boolean>;
25
- export declare function login(method?: AuthMethod, env?: EnvironmentConfig): Promise<AuthIdentity | null>;
26
- export declare function ensureAuthenticated(env?: EnvironmentConfig): Promise<AuthIdentity | null>;
47
+ export declare function login(method?: AuthMethod, env?: EnvironmentConfig, projectDir?: string): Promise<AuthIdentity | null>;
48
+ export declare function ensureAuthenticated(env?: EnvironmentConfig, projectDir?: string): Promise<AuthIdentity | null>;
27
49
  export declare function logout(env?: EnvironmentConfig): Promise<void>;
28
50
  export declare function whoami(env?: EnvironmentConfig): Promise<AuthIdentity | null>;
29
51
  export { deleteToken, hasToken, readToken, saveToken };
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/login.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,WAAW,EAAoB,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKjG,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAW1E,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,IAAI,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,cAAc,CAAC;AAErD,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAaD,wBAAgB,gBAAgB,IAAI,MAAM,CAIzC;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,EAC3C,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,iBAA0C,GAC9C,MAAM,CAQR;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,iBAA0C,EAC/C,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAqB1B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,QAAQ,IAAI,cAAc,CAEnF;AAyBD,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,iBAA0C,EAC/C,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAU9B;AAgCD,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,iBAAiB,EAC1B,MAAM,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAe,GACnD,OAAO,CAAC,OAAO,CAAC,CAalB;AAwED,wBAAsB,KAAK,CACzB,MAAM,CAAC,EAAE,UAAU,EACnB,GAAG,GAAE,iBAA0C,GAC9C,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CA2E9B;AAED,wBAAsB,mBAAmB,CACvC,GAAG,GAAE,iBAA0C,GAC9C,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CA6B9B;AAED,wBAAsB,MAAM,CAAC,GAAG,GAAE,iBAA0C,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3F;AAyCD,wBAAsB,MAAM,CAC1B,GAAG,GAAE,iBAA0C,GAC9C,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAiC9B;AAED,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/cli/auth/login.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,WAAW,EAAoB,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKjG,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAoB1E;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,SAAQ,GAAG,MAAM,CAgBtF;AAWD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,IAAI,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,cAAc,CAAC;AAErD,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sCAAsC,CAAC,EAAE,OAAO,CAAC;IACjD,gFAAgF;IAChF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4GD,iFAAiF;AACjF,wBAAgB,mCAAmC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAErE;AAyBD,wBAAgB,gBAAgB,IAAI,MAAM,CAIzC;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,EAC3C,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,iBAA0C,GAC9C,MAAM,CAQR;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,iBAA0C,EAC/C,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA6D1B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,QAAQ,IAAI,cAAc,CAEnF;AA+CD,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,iBAA0C,EAC/C,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAU9B;AAgCD,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,iBAAiB,EAC1B,MAAM,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAe,GACnD,OAAO,CAAC,OAAO,CAAC,CAalB;AAwRD,wBAAsB,KAAK,CACzB,MAAM,CAAC,EAAE,UAAU,EACnB,GAAG,GAAE,iBAA0C,EAC/C,UAAU,GAAE,MAAc,GACzB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CA+F9B;AAED,wBAAsB,mBAAmB,CACvC,GAAG,GAAE,iBAA0C,EAC/C,UAAU,GAAE,MAAc,GACzB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAgD9B;AAID,wBAAsB,MAAM,CAAC,GAAG,GAAE,iBAA0C,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3F;AA2DD,wBAAsB,MAAM,CAC1B,GAAG,GAAE,iBAA0C,GAC9C,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAkC9B;AAED,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
@@ -9,8 +9,141 @@ import { brand, dim, error, warning } from "../ui/colors.js";
9
9
  import { createSpinner } from "../ui/progress.js";
10
10
  import { PromptInterruptedError, select } from "../utils/terminal-select.js";
11
11
  import { API_KEYS_URL, DEFAULT_CALLBACK_PORT, DEFAULT_LOGIN_TIMEOUT_MS, getApiUrl, } from "../shared/constants.js";
12
- import { createSuccessEnvelope, isJsonMode, outputJson } from "../shared/json-output.js";
12
+ import { resolveApiCredentialCandidatesForAuth } from "../shared/config.js";
13
+ import { createErrorEnvelope, createSuccessEnvelope, isJsonMode, outputJson, } from "../shared/json-output.js";
13
14
  import { isInteractive } from "../shared/interactive.js";
15
+ import { getEnvSource } from "../../src/utils/env-loader.js";
16
+ import { basename, isAbsolute, relative } from "../../src/platform/compat/path/index.js";
17
+ import { cwd, getEnv } from "../../src/platform/index.js";
18
+ /**
19
+ * Describe where an API-token credential actually came from.
20
+ *
21
+ * `.env` files in the working directory are loaded into the environment, so a
22
+ * token can arrive under `VERYFRONT_API_TOKEN` while that variable is unset in
23
+ * the developer's shell. Reporting only the variable name sends them to check
24
+ * something they can see is empty; naming the file ends the search. Identity is
25
+ * directory-dependent for every command that infers a project from config, so
26
+ * this is worth the extra clause.
27
+ */
28
+ export function formatEnvSourcePathForDisplay(file, currentCwd = cwd()) {
29
+ // Repo-relative only: AGENTS.md forbids local absolute paths in user-facing
30
+ // output. A file outside the working directory, including a Windows
31
+ // cross-drive result, degrades to its name rather than exposing the layout.
32
+ // A bare filename stays bare (`.env`); anything nested is prefixed so it
33
+ // reads unambiguously as a path (`./config/.env`). The test is for a
34
+ // separator rather than a leading ".", because a dot-*directory* also starts
35
+ // with one, so `.config/.env` would otherwise be the only nested path printed
36
+ // without the prefix.
37
+ const rel = relative(currentCwd, file);
38
+ const shown = rel === "." || rel.startsWith("..") || isAbsolute(rel)
39
+ ? basename(file)
40
+ : /[/\\]/.test(rel) && !rel.startsWith("./")
41
+ ? `./${rel}`
42
+ : rel;
43
+ return shown;
44
+ }
45
+ function describeApiTokenSource(token) {
46
+ const origin = getEnvSource("VERYFRONT_API_TOKEN");
47
+ if (origin.source !== "env-file" || getEnv("VERYFRONT_API_TOKEN") !== token) {
48
+ return "(via VERYFRONT_API_TOKEN)";
49
+ }
50
+ return `(via VERYFRONT_API_TOKEN from ${formatEnvSourcePathForDisplay(origin.file)})`;
51
+ }
52
+ /**
53
+ * How long the bare-`login` preflight will wait on a credential check.
54
+ *
55
+ * That check is best-effort: it exists only to say "already logged in" instead
56
+ * of prompting. A connection the API accepts but never answers would otherwise
57
+ * block sign-in forever, so the check is bounded and a timeout simply falls
58
+ * through to the normal flow.
59
+ */
60
+ const DEFAULT_EXISTING_SESSION_TIMEOUT_MS = 5_000;
61
+ let existingSessionTimeoutMs = DEFAULT_EXISTING_SESSION_TIMEOUT_MS;
62
+ function loginIdentityData(identity, source) {
63
+ const displayedSource = source === "env-file" ? "env" : source;
64
+ if (isApiKeyIdentity(identity)) {
65
+ return {
66
+ authenticated: true,
67
+ credential_type: "api_key",
68
+ source: displayedSource,
69
+ };
70
+ }
71
+ return { ...identity, source: displayedSource };
72
+ }
73
+ async function outputLoginAuthenticationRequiredJson() {
74
+ await outputJson(createErrorEnvelope("login", {
75
+ code: "AUTHENTICATION_ERROR",
76
+ slug: "authentication-required",
77
+ registrySlug: "authentication-required",
78
+ message: "Not logged in. Set VERYFRONT_API_TOKEN or run in interactive mode.",
79
+ }));
80
+ }
81
+ class CredentialValidationUnavailableError extends Error {
82
+ kind;
83
+ status;
84
+ name = "CredentialValidationUnavailableError";
85
+ constructor(kind, status) {
86
+ super("Could not validate existing login credentials");
87
+ this.kind = kind;
88
+ this.status = status;
89
+ }
90
+ }
91
+ function isCredentialTimeoutFailure(error) {
92
+ return error instanceof DOMException &&
93
+ (error.name === "AbortError" || error.name === "TimeoutError");
94
+ }
95
+ function isCredentialRejectionStatus(status) {
96
+ return status === 401 || status === 403;
97
+ }
98
+ function isUserInfo(value) {
99
+ if (value === null || typeof value !== "object")
100
+ return false;
101
+ const candidate = value;
102
+ return typeof candidate.id === "string" && candidate.id.trim() !== "" &&
103
+ typeof candidate.email === "string" && candidate.email.trim() !== "";
104
+ }
105
+ async function outputLoginExplicitMethodJson() {
106
+ await outputJson(createErrorEnvelope("login", {
107
+ code: "USAGE_ERROR",
108
+ slug: "invalid-arguments",
109
+ registrySlug: "invalid-argument",
110
+ message: "Explicit login methods are not supported with --json.",
111
+ }));
112
+ }
113
+ async function outputLoginValidationUnavailableJson(failure) {
114
+ if (failure.kind === "timeout") {
115
+ await outputJson(createErrorEnvelope("login", {
116
+ code: "TIMEOUT_ERROR",
117
+ slug: "timeout-error",
118
+ registrySlug: "timeout-error",
119
+ message: "Timed out while checking existing login credentials. Try again.",
120
+ }));
121
+ return;
122
+ }
123
+ if (failure.kind === "network") {
124
+ await outputJson(createErrorEnvelope("login", {
125
+ code: "NETWORK_ERROR",
126
+ slug: "network-error",
127
+ registrySlug: "network-error",
128
+ message: "Could not reach the Veryfront API while checking existing login credentials.",
129
+ }));
130
+ return;
131
+ }
132
+ await outputJson(createErrorEnvelope("login", {
133
+ code: "API_CLIENT_ERROR",
134
+ slug: "api-client-error",
135
+ registrySlug: "api-client-error",
136
+ message: "Veryfront API could not validate existing login credentials.",
137
+ context: failure.status ? { status: failure.status } : undefined,
138
+ }));
139
+ }
140
+ /** Test seam: shrink the preflight deadline so a stall is observable quickly. */
141
+ export function __setExistingSessionTimeoutForTests(ms) {
142
+ existingSessionTimeoutMs = ms ?? DEFAULT_EXISTING_SESSION_TIMEOUT_MS;
143
+ }
144
+ function requestSignal(options) {
145
+ return options.signal ?? (options.timeoutMs ? AbortSignal.timeout(options.timeoutMs) : undefined);
146
+ }
14
147
  const AUTH_OPTIONS = [
15
148
  { id: "google", label: "Google" },
16
149
  { id: "github", label: "GitHub" },
@@ -20,6 +153,12 @@ const AUTH_OPTIONS = [
20
153
  class NetworkError extends Error {
21
154
  name = "NetworkError";
22
155
  }
156
+ function isCredentialNetworkFailure(error) {
157
+ return error instanceof TypeError || isCredentialTimeoutFailure(error);
158
+ }
159
+ function throwNetworkError() {
160
+ throw new NetworkError("Could not reach the Veryfront API");
161
+ }
23
162
  export function createOAuthState() {
24
163
  const bytes = new Uint8Array(32);
25
164
  dntShim.crypto.getRandomValues(bytes);
@@ -39,18 +178,61 @@ export async function validateToken(token, env = getEnvironmentConfig(), options
39
178
  try {
40
179
  const response = await fetch(`${getApiUrl(env).replace(/\/$/, "")}/me`, {
41
180
  headers: { Authorization: `Bearer ${token}`, Accept: "application/json" },
181
+ signal: requestSignal(options),
42
182
  });
43
183
  if (!response.ok) {
44
184
  // Consume response body to prevent resource leak
45
185
  await response.body?.cancel();
186
+ if (options.throwOnCredentialValidationUnavailable &&
187
+ !isCredentialRejectionStatus(response.status)) {
188
+ throw new CredentialValidationUnavailableError("service", response.status);
189
+ }
190
+ if (options.throwOnNetworkError && response.status >= 500)
191
+ throwNetworkError();
192
+ return null;
193
+ }
194
+ try {
195
+ const userInfo = await response.json();
196
+ if (isUserInfo(userInfo))
197
+ return userInfo;
198
+ if (options.throwOnCredentialValidationUnavailable) {
199
+ throw new CredentialValidationUnavailableError("service", response.status);
200
+ }
46
201
  return null;
47
202
  }
48
- return (await response.json());
203
+ catch (error) {
204
+ if (options.throwOnCredentialValidationUnavailable) {
205
+ if (error instanceof CredentialValidationUnavailableError) {
206
+ throw error;
207
+ }
208
+ if (isCredentialTimeoutFailure(error)) {
209
+ throw new CredentialValidationUnavailableError("timeout");
210
+ }
211
+ if (error instanceof TypeError) {
212
+ throw new CredentialValidationUnavailableError("network");
213
+ }
214
+ throw new CredentialValidationUnavailableError("service", response.status);
215
+ }
216
+ throw error;
217
+ }
49
218
  }
50
219
  catch (e) {
51
- if (options.throwOnNetworkError && e instanceof TypeError) {
52
- throw new NetworkError("Could not reach the Veryfront API");
220
+ if (options.throwOnCredentialValidationUnavailable) {
221
+ if (e instanceof CredentialValidationUnavailableError) {
222
+ throw e;
223
+ }
224
+ if (isCredentialTimeoutFailure(e)) {
225
+ throw new CredentialValidationUnavailableError("timeout");
226
+ }
227
+ if (e instanceof TypeError) {
228
+ throw new CredentialValidationUnavailableError("network");
229
+ }
230
+ throw e;
53
231
  }
232
+ if (e instanceof NetworkError)
233
+ throw e;
234
+ if (options.throwOnNetworkError && isCredentialNetworkFailure(e))
235
+ throwNetworkError();
54
236
  return null;
55
237
  }
56
238
  }
@@ -68,14 +250,37 @@ async function validateApiKey(token, env = getEnvironmentConfig(), options = {})
68
250
  url.searchParams.set("limit", "1");
69
251
  const response = await fetch(url, {
70
252
  headers: { Authorization: `Bearer ${token}`, Accept: "application/json" },
253
+ signal: requestSignal(options),
71
254
  });
72
255
  await response.body?.cancel();
73
- return response.ok;
256
+ if (!response.ok) {
257
+ if (options.throwOnCredentialValidationUnavailable &&
258
+ !isCredentialRejectionStatus(response.status)) {
259
+ throw new CredentialValidationUnavailableError("service", response.status);
260
+ }
261
+ if (options.throwOnNetworkError && response.status >= 500)
262
+ throwNetworkError();
263
+ return false;
264
+ }
265
+ return true;
74
266
  }
75
267
  catch (e) {
76
- if (options.throwOnNetworkError && e instanceof TypeError) {
77
- throw new NetworkError("Could not reach the Veryfront API");
268
+ if (options.throwOnCredentialValidationUnavailable) {
269
+ if (e instanceof CredentialValidationUnavailableError) {
270
+ throw e;
271
+ }
272
+ if (isCredentialTimeoutFailure(e)) {
273
+ throw new CredentialValidationUnavailableError("timeout");
274
+ }
275
+ if (e instanceof TypeError) {
276
+ throw new CredentialValidationUnavailableError("network");
277
+ }
278
+ throw e;
78
279
  }
280
+ if (e instanceof NetworkError)
281
+ throw e;
282
+ if (options.throwOnNetworkError && isCredentialNetworkFailure(e))
283
+ throwNetworkError();
79
284
  return false;
80
285
  }
81
286
  }
@@ -186,7 +391,178 @@ async function loginWithToken() {
186
391
  }
187
392
  return token;
188
393
  }
189
- export async function login(method, env = getEnvironmentConfig()) {
394
+ function writeConfigFileSwitchingGuidance() {
395
+ console.log(" " +
396
+ dim("Remove or replace apiToken in veryfront.json before signing in with another method."));
397
+ }
398
+ function writeEnvironmentConfigFileSwitchingGuidance() {
399
+ console.log(" " +
400
+ dim("Remove or replace apiToken in veryfront.json after unsetting VERYFRONT_API_TOKEN."));
401
+ }
402
+ function writeAuthoritativeCredentialRejectedMessage(source, hasConfigToken) {
403
+ console.log();
404
+ if (source === "environment") {
405
+ console.log(" " + error("✗") + " VERYFRONT_API_TOKEN was rejected by the Veryfront API.");
406
+ console.log(" " +
407
+ dim("Unset VERYFRONT_API_TOKEN or replace the variable before signing in with another method."));
408
+ if (hasConfigToken)
409
+ writeEnvironmentConfigFileSwitchingGuidance();
410
+ return;
411
+ }
412
+ console.log(" " + error("✗") + " apiToken from veryfront.json was rejected by the Veryfront API.");
413
+ writeConfigFileSwitchingGuidance();
414
+ }
415
+ function credentialSourceForDisplay(source) {
416
+ return source === "environment" ? "VERYFRONT_API_TOKEN" : "apiToken from veryfront.json";
417
+ }
418
+ function writeAuthoritativeCredentialUnavailableMessage(source, failure, hasConfigToken) {
419
+ const credential = credentialSourceForDisplay(source);
420
+ console.log();
421
+ if (failure.kind === "timeout") {
422
+ console.log(" " + error("✗") + ` Timed out while checking ${credential} with the Veryfront API.`);
423
+ }
424
+ else if (failure.kind === "network") {
425
+ console.log(" " + error("✗") + ` Could not reach the Veryfront API while checking ${credential}.`);
426
+ }
427
+ else {
428
+ const status = failure.status ? ` (${failure.status})` : "";
429
+ console.log(" " + error("✗") + ` Veryfront API could not validate ${credential}${status}.`);
430
+ }
431
+ console.log(" " + dim("Try again before signing in with another method."));
432
+ if (source === "environment") {
433
+ console.log(" " + dim("Unset VERYFRONT_API_TOKEN before signing in with another method."));
434
+ if (hasConfigToken)
435
+ writeEnvironmentConfigFileSwitchingGuidance();
436
+ return;
437
+ }
438
+ writeConfigFileSwitchingGuidance();
439
+ }
440
+ /**
441
+ * Report an already-valid session, or null when there is nothing usable.
442
+ *
443
+ * Returns a sentinel when JSON or human output already explained why login
444
+ * must stop instead of falling through to lower-priority credentials or a new
445
+ * login that later commands will not use.
446
+ */
447
+ async function describeExistingSession(env, projectDir = cwd()) {
448
+ const candidates = await resolveApiCredentialCandidatesForAuth(env, projectDir);
449
+ if (candidates.length === 0)
450
+ return null;
451
+ const hasConfigToken = candidates.some((candidate) => candidate.apiTokenSource === "config-file");
452
+ let hasStoredToken = candidates.some((candidate) => candidate.apiTokenSource === "token-store");
453
+ const signal = AbortSignal.timeout(existingSessionTimeoutMs);
454
+ let unavailable = null;
455
+ for (const { apiToken, apiTokenSource, authoritative, validationEnv } of candidates) {
456
+ const source = apiTokenSource === "config-file"
457
+ ? "config-file"
458
+ : apiTokenSource === "token-store"
459
+ ? "stored"
460
+ : "environment";
461
+ let identity;
462
+ try {
463
+ // Bounded: this preflight only decides whether to say "already logged in"
464
+ // instead of prompting. An authoritative credential that cannot be
465
+ // checked must still stop, because later commands will resolve it ahead
466
+ // of any replacement login.
467
+ identity = await validateCredential(apiToken, validationEnv, {
468
+ signal,
469
+ throwOnCredentialValidationUnavailable: true,
470
+ });
471
+ }
472
+ catch (error) {
473
+ if (error instanceof CredentialValidationUnavailableError) {
474
+ unavailable ??= error;
475
+ if (authoritative || apiTokenSource === "token-store") {
476
+ if (!isJsonMode() && source !== "stored") {
477
+ writeAuthoritativeCredentialUnavailableMessage(source, error, hasConfigToken);
478
+ return "failure-output";
479
+ }
480
+ break;
481
+ }
482
+ continue;
483
+ }
484
+ throw error;
485
+ }
486
+ if (!identity) {
487
+ if (apiTokenSource === "token-store") {
488
+ await deleteToken(env);
489
+ hasStoredToken = false;
490
+ }
491
+ if (authoritative) {
492
+ if (!isJsonMode()) {
493
+ if (source !== "stored") {
494
+ writeAuthoritativeCredentialRejectedMessage(source, hasConfigToken);
495
+ return "failure-output";
496
+ }
497
+ }
498
+ break;
499
+ }
500
+ continue;
501
+ }
502
+ if (isJsonMode()) {
503
+ await outputJson(createSuccessEnvelope("login", loginIdentityData(identity, apiTokenSource)));
504
+ return identity;
505
+ }
506
+ console.log();
507
+ console.log(" ✓ " +
508
+ (isApiKeyIdentity(identity)
509
+ ? "Already authenticated with an API key"
510
+ : "Already logged in as " + brand(identity.email)));
511
+ // An environment credential is a valid session for every command, but this
512
+ // path stores nothing, and `login` implies it did. The variable is often set
513
+ // by a `.env` in the working directory the developer has forgotten about,
514
+ // the case `whoami` now names, so the session ends at the directory
515
+ // boundary. Say so rather than let them discover it elsewhere.
516
+ if (source === "environment") {
517
+ if (hasStoredToken) {
518
+ console.log(" " + dim("Using VERYFRONT_API_TOKEN; it takes precedence over a stored credential."));
519
+ console.log(" " +
520
+ dim("Unset VERYFRONT_API_TOKEN before attempting to use the stored credential, or replace the variable to switch tokens."));
521
+ }
522
+ else {
523
+ console.log(" " + dim("Using VERYFRONT_API_TOKEN; no stored login was created."));
524
+ console.log(" " +
525
+ dim("Unset VERYFRONT_API_TOKEN before using another login method, or replace the variable to switch tokens."));
526
+ }
527
+ if (hasConfigToken)
528
+ writeEnvironmentConfigFileSwitchingGuidance();
529
+ }
530
+ else if (source === "config-file") {
531
+ console.log(" " +
532
+ dim("Using apiToken from veryfront.json; it takes precedence over stored credentials."));
533
+ writeConfigFileSwitchingGuidance();
534
+ }
535
+ console.log(" " +
536
+ dim("Run 'veryfront login --token' (or --google, --github, --microsoft) to sign in again."));
537
+ return identity;
538
+ }
539
+ if (isJsonMode() && unavailable) {
540
+ await outputLoginValidationUnavailableJson(unavailable);
541
+ return "failure-output";
542
+ }
543
+ return null;
544
+ }
545
+ export async function login(method, env = getEnvironmentConfig(), projectDir = cwd()) {
546
+ if (isJsonMode() && method !== undefined) {
547
+ await outputLoginExplicitMethodJson();
548
+ return null;
549
+ }
550
+ // A bare `veryfront login` is the documented first step of the deploy
551
+ // journey, and an already-authenticated developer ran it only to be asked for
552
+ // a token they do not need. Report the session instead. An explicit method is
553
+ // intent to sign in again, so account switching still works — and a session
554
+ // that no longer validates falls through to the normal flow.
555
+ if (method === undefined) {
556
+ const existing = await describeExistingSession(env, projectDir);
557
+ if (existing === "failure-output")
558
+ return null;
559
+ if (existing)
560
+ return existing;
561
+ if (isJsonMode()) {
562
+ await outputLoginAuthenticationRequiredJson();
563
+ return null;
564
+ }
565
+ }
190
566
  if (!isInteractive() && (method === undefined || method === "token")) {
191
567
  cliLogger.error("Not logged in. Set VERYFRONT_API_TOKEN or run in interactive mode.");
192
568
  return null;
@@ -252,24 +628,38 @@ export async function login(method, env = getEnvironmentConfig()) {
252
628
  : " ✓ Logged in as " + brand(identity.email));
253
629
  return identity;
254
630
  }
255
- export async function ensureAuthenticated(env = getEnvironmentConfig()) {
631
+ export async function ensureAuthenticated(env = getEnvironmentConfig(), projectDir = cwd()) {
256
632
  const humanOutput = !isJsonMode();
257
- if (env.apiToken) {
258
- const credential = await validateCredential(env.apiToken, env);
633
+ const candidates = await resolveApiCredentialCandidatesForAuth(env, projectDir);
634
+ for (const candidate of candidates) {
635
+ let credential;
636
+ try {
637
+ credential = await validateCredential(candidate.apiToken, candidate.validationEnv, candidate.apiTokenSource === "token-store"
638
+ ? { throwOnCredentialValidationUnavailable: true }
639
+ : undefined);
640
+ }
641
+ catch (error) {
642
+ if (candidate.apiTokenSource === "token-store" &&
643
+ error instanceof CredentialValidationUnavailableError) {
644
+ return null;
645
+ }
646
+ throw error;
647
+ }
259
648
  if (credential)
260
649
  return credential;
261
- if (humanOutput) {
650
+ if (candidate.apiTokenSource === "env" && humanOutput) {
262
651
  console.log(" " + warning("Warning: VERYFRONT_API_TOKEN is invalid"));
263
652
  }
264
- }
265
- const storedToken = await readToken(env);
266
- if (storedToken) {
267
- const credential = await validateCredential(storedToken, env);
268
- if (credential)
269
- return credential;
270
- await deleteToken(env);
271
- if (humanOutput) {
272
- console.log(" " + warning("Session expired. Please log in again."));
653
+ if (candidate.apiTokenSource === "config-file" && humanOutput) {
654
+ console.log(" " + warning("Warning: apiToken from veryfront.json is invalid"));
655
+ }
656
+ if (candidate.authoritative)
657
+ return null;
658
+ if (candidate.apiTokenSource === "token-store") {
659
+ await deleteToken(env);
660
+ if (humanOutput) {
661
+ console.log(" " + warning("Session expired. Please log in again."));
662
+ }
273
663
  }
274
664
  }
275
665
  if (!humanOutput)
@@ -278,21 +668,37 @@ export async function ensureAuthenticated(env = getEnvironmentConfig()) {
278
668
  cliLogger.error("Not logged in. Set VERYFRONT_API_TOKEN or run in interactive mode.");
279
669
  return null;
280
670
  }
281
- return login(undefined, env);
671
+ return login(undefined, env, projectDir);
282
672
  }
673
+ const CREDENTIAL_VALIDATION_UNAVAILABLE = Symbol("credential-validation-unavailable");
283
674
  export async function logout(env = getEnvironmentConfig()) {
284
675
  await deleteToken(env);
285
676
  console.log();
286
677
  console.log(" ✓ Logged out");
287
678
  }
288
679
  async function reportCredential(token, source, env) {
289
- const credential = await validateCredential(token, env);
290
- if (!credential)
680
+ let credential;
681
+ try {
682
+ credential = await validateCredential(token, env, {
683
+ throwOnCredentialValidationUnavailable: true,
684
+ });
685
+ }
686
+ catch (error) {
687
+ if (error instanceof CredentialValidationUnavailableError) {
688
+ return CREDENTIAL_VALIDATION_UNAVAILABLE;
689
+ }
690
+ throw error;
691
+ }
692
+ if (!credential) {
693
+ if (source === "token-store")
694
+ await deleteToken(env);
291
695
  return null;
696
+ }
697
+ const displayedSource = source === "env-file" ? "env" : source;
292
698
  if (!isApiKeyIdentity(credential)) {
293
699
  const userInfo = credential;
294
700
  if (isJsonMode()) {
295
- await outputJson(createSuccessEnvelope("whoami", { ...userInfo, source }));
701
+ await outputJson(createSuccessEnvelope("whoami", { ...userInfo, source: displayedSource }));
296
702
  return userInfo;
297
703
  }
298
704
  console.log();
@@ -303,27 +709,30 @@ async function reportCredential(token, source, env) {
303
709
  await outputJson(createSuccessEnvelope("whoami", {
304
710
  authenticated: true,
305
711
  credential_type: "api_key",
306
- source,
712
+ source: displayedSource,
307
713
  }));
308
714
  return { authenticated: true, type: "apiKey" };
309
715
  }
310
716
  console.log();
311
717
  console.log(" ✓ Authenticated with an API key");
312
718
  }
313
- console.log(" " + dim(source === "env" ? "(via VERYFRONT_API_TOKEN)" : `Token stored at: ${getTokenLocation(env)}`));
719
+ console.log(" " + dim(source === "env" || source === "env-file"
720
+ ? describeApiTokenSource(token)
721
+ : source === "config-file"
722
+ ? "apiToken from veryfront.json"
723
+ : `Token stored at: ${getTokenLocation(env)}`));
314
724
  return credential;
315
725
  }
316
726
  export async function whoami(env = getEnvironmentConfig()) {
317
- if (env.apiToken) {
318
- const result = await reportCredential(env.apiToken, "env", env);
319
- if (result)
320
- return result;
321
- }
322
- const storedToken = await readToken(env);
323
- if (storedToken) {
324
- const result = await reportCredential(storedToken, "token-store", env);
727
+ const candidates = await resolveApiCredentialCandidatesForAuth(env);
728
+ for (const candidate of candidates) {
729
+ const result = await reportCredential(candidate.apiToken, candidate.apiTokenSource, candidate.validationEnv);
730
+ if (result === CREDENTIAL_VALIDATION_UNAVAILABLE)
731
+ break;
325
732
  if (result)
326
733
  return result;
734
+ if (candidate.authoritative)
735
+ break;
327
736
  }
328
737
  if (isJsonMode()) {
329
738
  await outputJson(createSuccessEnvelope("whoami", { authenticated: false }));
@@ -1 +1 @@
1
- {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/error-handler.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAgBtD"}
1
+ {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/error-handler.ts"],"names":[],"mappings":"AAqCA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAyBtD"}