veryfront 0.1.1122 → 0.1.1124

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 (205) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/extensions/ext-llm-openai/src/openai-responses-request-builder.d.ts.map +1 -1
  3. package/esm/extensions/ext-llm-openai/src/openai-responses-request-builder.js +5 -0
  4. package/esm/src/agent/hosted/child-lifecycle.d.ts.map +1 -1
  5. package/esm/src/agent/hosted/child-lifecycle.js +1 -12
  6. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts +38 -0
  7. package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts.map +1 -0
  8. package/esm/src/agent/hosted/cloud-agent-chat-execution.js +349 -0
  9. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts +80 -0
  10. package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts.map +1 -0
  11. package/esm/src/agent/hosted/cloud-agent-child-tools.js +280 -0
  12. package/esm/src/agent/hosted/cloud-agent-config.d.ts +69 -0
  13. package/esm/src/agent/hosted/cloud-agent-config.d.ts.map +1 -0
  14. package/esm/src/agent/hosted/cloud-agent-config.js +129 -0
  15. package/esm/src/agent/hosted/cloud-agent-paths.d.ts +42 -0
  16. package/esm/src/agent/hosted/cloud-agent-paths.d.ts.map +1 -0
  17. package/esm/src/agent/hosted/cloud-agent-paths.js +117 -0
  18. package/esm/src/agent/hosted/cloud-agent-provider-bootstrap.d.ts +49 -0
  19. package/esm/src/agent/hosted/cloud-agent-provider-bootstrap.d.ts.map +1 -0
  20. package/esm/src/agent/hosted/cloud-agent-provider-bootstrap.js +96 -0
  21. package/esm/src/agent/hosted/durable-child-fork-execution.d.ts.map +1 -1
  22. package/esm/src/agent/hosted/durable-child-fork-execution.js +1 -12
  23. package/esm/src/agent/hosted/runtime-request-config.js +2 -2
  24. package/esm/src/agent/hosted/stream-finalization.d.ts.map +1 -1
  25. package/esm/src/agent/hosted/stream-finalization.js +2 -26
  26. package/esm/src/agent/hosted/veryfront-cloud-agent-service.d.ts +11 -93
  27. package/esm/src/agent/hosted/veryfront-cloud-agent-service.d.ts.map +1 -1
  28. package/esm/src/agent/hosted/veryfront-cloud-agent-service.js +8 -901
  29. package/esm/src/agent/project/agent-runtime.d.ts.map +1 -1
  30. package/esm/src/agent/project/agent-runtime.js +3 -0
  31. package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
  32. package/esm/src/agent/runtime/chat-stream-handler.js +1 -28
  33. package/esm/src/agent/streaming/stream-outcome.d.ts +30 -0
  34. package/esm/src/agent/streaming/stream-outcome.d.ts.map +1 -0
  35. package/esm/src/agent/streaming/stream-outcome.js +62 -0
  36. package/esm/src/agent/types.d.ts +3 -0
  37. package/esm/src/agent/types.d.ts.map +1 -1
  38. package/esm/src/chat/message-prep.d.ts.map +1 -1
  39. package/esm/src/chat/message-prep.js +3 -6
  40. package/esm/src/chat/provider-errors.d.ts +3 -10
  41. package/esm/src/chat/provider-errors.d.ts.map +1 -1
  42. package/esm/src/chat/provider-errors.js +2 -9
  43. package/esm/src/embedding/veryfront-cloud/rag-store.d.ts.map +1 -1
  44. package/esm/src/embedding/veryfront-cloud/rag-store.js +5 -2
  45. package/esm/src/eval/studio.d.ts +1 -1
  46. package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
  47. package/esm/src/html/styles-builder/plugin-loader.js +4 -2
  48. package/esm/src/modules/server/classify.d.ts +54 -0
  49. package/esm/src/modules/server/classify.d.ts.map +1 -0
  50. package/esm/src/modules/server/classify.js +50 -0
  51. package/esm/src/modules/server/fs-probe.d.ts +14 -0
  52. package/esm/src/modules/server/fs-probe.d.ts.map +1 -0
  53. package/esm/src/modules/server/fs-probe.js +17 -0
  54. package/esm/src/modules/server/module-batch-handler.d.ts.map +1 -1
  55. package/esm/src/modules/server/module-batch-handler.js +31 -45
  56. package/esm/src/modules/server/module-server.d.ts.map +1 -1
  57. package/esm/src/modules/server/module-server.js +77 -93
  58. package/esm/src/modules/server/module-transform.d.ts +73 -0
  59. package/esm/src/modules/server/module-transform.d.ts.map +1 -0
  60. package/esm/src/modules/server/module-transform.js +64 -0
  61. package/esm/src/modules/server/ssr-import-rewriter.d.ts +1 -1
  62. package/esm/src/modules/server/ssr-import-rewriter.d.ts.map +1 -1
  63. package/esm/src/observability/error-collector.d.ts.map +1 -1
  64. package/esm/src/observability/error-collector.js +4 -11
  65. package/esm/src/observability/log-buffer.d.ts.map +1 -1
  66. package/esm/src/observability/log-buffer.js +4 -11
  67. package/esm/src/observability/request-profiler.d.ts +4 -0
  68. package/esm/src/observability/request-profiler.d.ts.map +1 -1
  69. package/esm/src/observability/request-profiler.js +9 -4
  70. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts +3 -3
  71. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
  72. package/esm/src/platform/adapters/veryfront-api-client/operations.js +4 -4
  73. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.d.ts +4 -15
  74. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.d.ts.map +1 -1
  75. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.js +6 -110
  76. package/esm/src/platform/adapters/veryfront-api-transport.d.ts +40 -0
  77. package/esm/src/platform/adapters/veryfront-api-transport.d.ts.map +1 -0
  78. package/esm/src/platform/adapters/veryfront-api-transport.js +142 -0
  79. package/esm/src/provider/runtime-loader/provider-http.d.ts.map +1 -1
  80. package/esm/src/provider/runtime-loader/provider-http.js +5 -1
  81. package/esm/src/proxy/server-timing.d.ts.map +1 -1
  82. package/esm/src/proxy/server-timing.js +2 -14
  83. package/esm/src/react/components/chat/agent-card.d.ts +2 -3
  84. package/esm/src/react/components/chat/agent-card.d.ts.map +1 -1
  85. package/esm/src/react/components/chat/agent-card.js +3 -12
  86. package/esm/src/react/components/chat/agent-picker-context.d.ts +2 -3
  87. package/esm/src/react/components/chat/agent-picker-context.d.ts.map +1 -1
  88. package/esm/src/react/components/chat/agent-picker-context.js +3 -13
  89. package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts +2 -6
  90. package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts.map +1 -1
  91. package/esm/src/react/components/chat/chat/components/attachment-pill.js +3 -15
  92. package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts +2 -12
  93. package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts.map +1 -1
  94. package/esm/src/react/components/chat/chat/components/attachments-panel.js +3 -21
  95. package/esm/src/react/components/chat/chat/components/branch-picker.d.ts.map +1 -1
  96. package/esm/src/react/components/chat/chat/components/branch-picker.js +2 -11
  97. package/esm/src/react/components/chat/chat/components/inline-citation.d.ts.map +1 -1
  98. package/esm/src/react/components/chat/chat/components/inline-citation.js +2 -11
  99. package/esm/src/react/components/chat/chat/components/message-actions.d.ts.map +1 -1
  100. package/esm/src/react/components/chat/chat/components/message-actions.js +2 -11
  101. package/esm/src/react/components/chat/chat/components/message-feedback.d.ts.map +1 -1
  102. package/esm/src/react/components/chat/chat/components/message-feedback.js +2 -11
  103. package/esm/src/react/components/chat/chat/components/reasoning.d.ts +2 -3
  104. package/esm/src/react/components/chat/chat/components/reasoning.d.ts.map +1 -1
  105. package/esm/src/react/components/chat/chat/components/reasoning.js +3 -12
  106. package/esm/src/react/components/chat/chat/components/sidebar.d.ts +2 -3
  107. package/esm/src/react/components/chat/chat/components/sidebar.d.ts.map +1 -1
  108. package/esm/src/react/components/chat/chat/components/sidebar.js +4 -22
  109. package/esm/src/react/components/chat/chat/components/sources.d.ts +2 -3
  110. package/esm/src/react/components/chat/chat/components/sources.d.ts.map +1 -1
  111. package/esm/src/react/components/chat/chat/components/sources.js +3 -12
  112. package/esm/src/react/components/chat/chat/components/step-indicator.d.ts +2 -6
  113. package/esm/src/react/components/chat/chat/components/step-indicator.d.ts.map +1 -1
  114. package/esm/src/react/components/chat/chat/components/step-indicator.js +3 -15
  115. package/esm/src/react/components/chat/chat/components/tool-ui.d.ts +2 -3
  116. package/esm/src/react/components/chat/chat/components/tool-ui.d.ts.map +1 -1
  117. package/esm/src/react/components/chat/chat/components/tool-ui.js +3 -12
  118. package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts.map +1 -1
  119. package/esm/src/react/components/chat/chat/composition/chat-message-list.js +2 -11
  120. package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts +2 -2
  121. package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts.map +1 -1
  122. package/esm/src/react/components/chat/chat/contexts/chat-context.js +3 -12
  123. package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts +2 -2
  124. package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts.map +1 -1
  125. package/esm/src/react/components/chat/chat/contexts/composer-context.js +3 -12
  126. package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts +2 -2
  127. package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts.map +1 -1
  128. package/esm/src/react/components/chat/chat/contexts/conversations-context.js +3 -12
  129. package/esm/src/react/components/chat/chat/contexts/message-context.d.ts +2 -2
  130. package/esm/src/react/components/chat/chat/contexts/message-context.d.ts.map +1 -1
  131. package/esm/src/react/components/chat/chat/contexts/message-context.js +3 -12
  132. package/esm/src/react/components/chat/chat-actions.d.ts +2 -6
  133. package/esm/src/react/components/chat/chat-actions.d.ts.map +1 -1
  134. package/esm/src/react/components/chat/chat-actions.js +3 -15
  135. package/esm/src/react/components/chat/model-selector.d.ts +2 -6
  136. package/esm/src/react/components/chat/model-selector.d.ts.map +1 -1
  137. package/esm/src/react/components/chat/model-selector.js +3 -15
  138. package/esm/src/react/components/create-strict-context.d.ts +44 -0
  139. package/esm/src/react/components/create-strict-context.d.ts.map +1 -0
  140. package/esm/src/react/components/create-strict-context.js +56 -0
  141. package/esm/src/react/components/ui/anchored-surface.d.ts +44 -0
  142. package/esm/src/react/components/ui/anchored-surface.d.ts.map +1 -0
  143. package/esm/src/react/components/ui/anchored-surface.js +58 -0
  144. package/esm/src/react/components/ui/app-shell.d.ts +2 -2
  145. package/esm/src/react/components/ui/app-shell.d.ts.map +1 -1
  146. package/esm/src/react/components/ui/app-shell.js +3 -7
  147. package/esm/src/react/components/ui/collapsible.d.ts.map +1 -1
  148. package/esm/src/react/components/ui/collapsible.js +3 -9
  149. package/esm/src/react/components/ui/color-mode.d.ts +2 -2
  150. package/esm/src/react/components/ui/color-mode.d.ts.map +1 -1
  151. package/esm/src/react/components/ui/color-mode.js +3 -11
  152. package/esm/src/react/components/ui/command.d.ts.map +1 -1
  153. package/esm/src/react/components/ui/command.js +2 -7
  154. package/esm/src/react/components/ui/dialog.d.ts +4 -7
  155. package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
  156. package/esm/src/react/components/ui/dialog.js +13 -59
  157. package/esm/src/react/components/ui/disclosure.d.ts +12 -0
  158. package/esm/src/react/components/ui/disclosure.d.ts.map +1 -0
  159. package/esm/src/react/components/ui/disclosure.js +22 -0
  160. package/esm/src/react/components/ui/drawer.d.ts +5 -7
  161. package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
  162. package/esm/src/react/components/ui/drawer.js +13 -57
  163. package/esm/src/react/components/ui/dropdown-menu.d.ts +4 -7
  164. package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
  165. package/esm/src/react/components/ui/dropdown-menu.js +12 -31
  166. package/esm/src/react/components/ui/modal-surface.d.ts +43 -0
  167. package/esm/src/react/components/ui/modal-surface.d.ts.map +1 -0
  168. package/esm/src/react/components/ui/modal-surface.js +83 -0
  169. package/esm/src/react/components/ui/popover.d.ts +4 -7
  170. package/esm/src/react/components/ui/popover.d.ts.map +1 -1
  171. package/esm/src/react/components/ui/popover.js +11 -31
  172. package/esm/src/react/components/ui/select.d.ts.map +1 -1
  173. package/esm/src/react/components/ui/select.js +2 -7
  174. package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
  175. package/esm/src/react/components/ui/tabs.js +3 -4
  176. package/esm/src/runs/schemas.d.ts +9 -9
  177. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  178. package/esm/src/server/handlers/dev/framework-candidates.generated.js +253 -154
  179. package/esm/src/server/reload-notifier.d.ts +0 -1
  180. package/esm/src/server/reload-notifier.d.ts.map +1 -1
  181. package/esm/src/server/reload-notifier.js +7 -25
  182. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
  183. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
  184. package/esm/src/utils/base64url.d.ts +9 -1
  185. package/esm/src/utils/base64url.d.ts.map +1 -1
  186. package/esm/src/utils/base64url.js +25 -11
  187. package/esm/src/utils/index.d.ts +3 -1
  188. package/esm/src/utils/index.d.ts.map +1 -1
  189. package/esm/src/utils/index.js +3 -1
  190. package/esm/src/utils/json.d.ts +19 -0
  191. package/esm/src/utils/json.d.ts.map +1 -0
  192. package/esm/src/utils/json.js +17 -0
  193. package/esm/src/utils/logger/redact.d.ts.map +1 -1
  194. package/esm/src/utils/logger/redact.js +7 -3
  195. package/esm/src/utils/subscriber-set.d.ts +19 -0
  196. package/esm/src/utils/subscriber-set.d.ts.map +1 -0
  197. package/esm/src/utils/subscriber-set.js +38 -0
  198. package/esm/src/utils/version-constant.d.ts +1 -1
  199. package/esm/src/utils/version-constant.js +1 -1
  200. package/esm/src/workflow/backends/redis/index.d.ts.map +1 -1
  201. package/esm/src/workflow/backends/redis/index.js +6 -7
  202. package/esm/src/workflow/claude-code/websocket-publisher.d.ts.map +1 -1
  203. package/esm/src/workflow/claude-code/websocket-publisher.js +8 -15
  204. package/esm/src/workflow/schemas/workflow.schema.d.ts +4 -4
  205. package/package.json +5 -5
@@ -24,7 +24,6 @@ declare class ReloadNotifierImpl {
24
24
  private notifyInvalidateListeners;
25
25
  private notifyListeners;
26
26
  getListenerCount(): number;
27
- getInvalidateListenerCount(): number;
28
27
  getMetrics(): {
29
28
  triggerCalls: number;
30
29
  broadcastsSent: number;
@@ -1 +1 @@
1
- {"version":3,"file":"reload-notifier.d.ts","sourceRoot":"","sources":["../../../src/src/server/reload-notifier.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,KAAK,cAAc,GAAG,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;AACrF,KAAK,kBAAkB,GAAG,MAAM,IAAI,CAAC;AACrC,KAAK,kBAAkB,GAAG,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;AAIjE,cAAM,kBAAkB;IACtB,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,mBAAmB,CAAiC;IAC5D,OAAO,CAAC,aAAa,CAA8C;IACnE,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,OAAO,CAIb;IAEF,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI;IAK/C,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAK7D,aAAa,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAyC1E,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,eAAe;IAkBvB,gBAAgB,IAAI,MAAM;IAI1B,0BAA0B,IAAI,MAAM;IAIpC,UAAU,IAAI;QACZ,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,yBAAyB,EAAE,MAAM,CAAC;KACnC;IAQD,KAAK,IAAI,IAAI;CAiBd;AAED,8BAA8B;AAC9B,eAAO,MAAM,cAAc,oBAA2B,CAAC"}
1
+ {"version":3,"file":"reload-notifier.d.ts","sourceRoot":"","sources":["../../../src/src/server/reload-notifier.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,KAAK,cAAc,GAAG,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;AACrF,KAAK,kBAAkB,GAAG,MAAM,IAAI,CAAC;AACrC,KAAK,kBAAkB,GAAG,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAAC;AAIjE,cAAM,kBAAkB;IACtB,OAAO,CAAC,SAAS,CAEf;IACF,OAAO,CAAC,mBAAmB,CAEzB;IACF,OAAO,CAAC,aAAa,CAA8C;IACnE,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,OAAO,CAIb;IAEF,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,IAAI;IAI/C,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAI7D,aAAa,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAyC1E,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,eAAe;IAYvB,gBAAgB,IAAI,MAAM;IAI1B,UAAU,IAAI;QACZ,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,yBAAyB,EAAE,MAAM,CAAC;KACnC;IAQD,KAAK,IAAI,IAAI;CAiBd;AAED,8BAA8B;AAC9B,eAAO,MAAM,cAAc,oBAA2B,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { serverLogger } from "../utils/index.js";
2
+ import { createSubscriberSet } from "../utils/subscriber-set.js";
2
3
  const logger = serverLogger.component("reload-notifier");
3
4
  const DEBOUNCE_MS = 300;
4
5
  class ReloadNotifierImpl {
5
- listeners = new Set();
6
- invalidateListeners = new Set();
6
+ listeners = createSubscriberSet((error) => logger.error("Listener error:", error));
7
+ invalidateListeners = createSubscriberSet((error) => logger.error("Invalidate listener error:", error));
7
8
  debounceTimer = null;
8
9
  pendingChangedPaths = new Set();
9
10
  pendingProject;
@@ -13,12 +14,10 @@ class ReloadNotifierImpl {
13
14
  lastTriggerTime: 0,
14
15
  };
15
16
  subscribe(listener) {
16
- this.listeners.add(listener);
17
- return () => this.listeners.delete(listener);
17
+ return this.listeners.subscribe(listener);
18
18
  }
19
19
  subscribeInvalidate(listener) {
20
- this.invalidateListeners.add(listener);
21
- return () => this.invalidateListeners.delete(listener);
20
+ return this.invalidateListeners.subscribe(listener);
22
21
  }
23
22
  triggerReload(changedPaths, project) {
24
23
  this.metrics.triggerCalls++;
@@ -57,14 +56,7 @@ class ReloadNotifierImpl {
57
56
  logger.debug("Notifying invalidate listeners", {
58
57
  count: this.invalidateListeners.size,
59
58
  });
60
- for (const listener of this.invalidateListeners) {
61
- try {
62
- listener();
63
- }
64
- catch (error) {
65
- logger.error("Invalidate listener error:", error);
66
- }
67
- }
59
+ this.invalidateListeners.notify();
68
60
  }
69
61
  notifyListeners(changedPaths, project) {
70
62
  this.metrics.broadcastsSent++;
@@ -73,21 +65,11 @@ class ReloadNotifierImpl {
73
65
  changedPaths,
74
66
  project,
75
67
  });
76
- for (const listener of this.listeners) {
77
- try {
78
- listener(changedPaths, project);
79
- }
80
- catch (error) {
81
- logger.error("Listener error:", error);
82
- }
83
- }
68
+ this.listeners.notify(changedPaths, project);
84
69
  }
85
70
  getListenerCount() {
86
71
  return this.listeners.size;
87
72
  }
88
- getInvalidateListenerCount() {
89
- return this.invalidateListeners.size;
90
- }
91
73
  getMetrics() {
92
74
  return {
93
75
  ...this.metrics,
@@ -1 +1 @@
1
- {"version":3,"file":"rsc-bundles.generated.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,kBAAkB,EAAE,MACwx/B,CAAC;AAE1z/B,eAAO,MAAM,iBAAiB,EAAE,MAC+nqB,CAAC"}
1
+ {"version":3,"file":"rsc-bundles.generated.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,kBAAkB,EAAE,MAC49/B,CAAC;AAE9//B,eAAO,MAAM,iBAAiB,EAAE,MAC+nqB,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * Do not edit manually — run `deno task generate` to regenerate.
6
6
  * @module
7
7
  */
8
- export const CLIENT_BOOT_BUNDLE = 'var It=Object.defineProperty;var St=(t,e,r)=>e in t?It(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>St(t,typeof e!="symbol"?e+"":e,r);var Ot="3.2.3";function Nt(t,e,r,n){let s=[];if(n?.external?.length&&s.push(`external=${n.external.join(",")}`),s.push(`target=${n?.target??"es2022"}`),n?.deps){let a=Object.entries(n.deps).map(([d,f])=>`${d}@${f}`).join(",");s.push(`deps=${a}`)}let u=e?`@${e}`:"",c=r??"",g=s.length?`?${s.join("&")}`:"";return`https://esm.sh/${t}${u}${c}${g}`}function m(t,e,r,n=!1){return Nt(t,e,r,{external:n?["react"]:void 0,deps:{csstype:Ot}})}var Dt="19.2.4",_=Dt;function z(t=_){return{react:m("react",t),"react-dom":m("react-dom",t,void 0,!0),"react-dom/client":m("react-dom",t,"/client",!0),"react-dom/server":m("react-dom",t,"/server",!0),"react/jsx-runtime":m("react",t,"/jsx-runtime",!0),"react/jsx-dev-runtime":m("react",t,"/jsx-dev-runtime",!0)}}function J(t=_){return z(t).react}function X(t=_){return z(t)["react-dom/client"]}function vt(t){return t.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function bt(t){if(typeof globalThis.btoa=="function")try{return globalThis.btoa(t)}catch{let n=new TextEncoder().encode(t),s="";for(let u of n)s+=String.fromCharCode(u);return globalThis.btoa(s)}let e=globalThis.Buffer;if(e)return e.from(t,"utf8").toString("base64");throw new Error("Base64 encoding is not supported in this runtime")}function H(t){return vt(bt(t))}var so=Object.freeze({react:"","react-dom":"","react-dom/client":"","react-dom/server":"","react/jsx-runtime":"","react/jsx-dev-runtime":""});function O(t,e){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t))return!0;for(let r of Object.keys(e))if(r.endsWith("/")&&t.startsWith(r))return!0;return!1}function Mt(t){try{return JSON.parse(t)?.imports??{}}catch(e){return console.warn("Failed to parse import map JSON; treating as empty",{errorName:e instanceof Error?e.name:typeof e,inputLength:t.length}),{}}}function V(t=document){let e=t.querySelector(\'script[type="importmap"]\');return e?.textContent?Mt(e.textContent):{}}var l="/_veryfront",F={RSC:`${l}/rsc/`,FS:`${l}/fs/`,MODULES:`${l}/modules/`,PAGES:`${l}/pages/`,DATA:`${l}/data/`,LIB:`${l}/lib/`,CHUNKS:`${l}/chunks/`,CLIENT:`${l}/client/`},K={HMR_RUNTIME:`${l}/hmr-runtime.js`,HMR:`${l}/hmr.js`,ERROR_OVERLAY:`${l}/error-overlay.js`,DEV_LOADER:`${l}/dev-loader.js`,CLIENT_LOG:`${l}/log`,CLIENT_JS:`${l}/client.js`,ROUTER_JS:`${l}/router.js`,PREFETCH_JS:`${l}/prefetch.js`,MANIFEST_JSON:`${l}/manifest.json`,APP_JS:`${l}/app.js`,RSC_CLIENT:`${l}/rsc/client.js`,RSC_MANIFEST:`${l}/rsc/manifest`,RSC_STREAM:`${l}/rsc/stream`,RSC_PAYLOAD:`${l}/rsc/payload`,RSC_RENDER:`${l}/rsc/render`,RSC_PAGE:`${l}/rsc/page`,RSC_MODULE:`${l}/rsc/module`,RSC_DOM:`${l}/rsc/dom.js`,LIB_CHAT_REACT:`${l}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${l}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${l}/lib/chat/primitives.js`};var wt={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},uo=wt.CACHE;var go={HMR_RUNTIME:K.HMR_RUNTIME,ERROR_OVERLAY:K.ERROR_OVERLAY};var h=F.RSC,Z=F.FS,Q="veryfront-hydration-data",C="rsc-root";var R=class{constructor(e,r){p(this,"prefix",e);p(this,"level",r)}log(e,r,n,...s){this.level>e||r?.(n,...s)}debug(e,...r){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${e}`,...r)}info(e,...r){this.log(1,console.log,`[${this.prefix}] ${e}`,...r)}warn(e,...r){this.log(2,console.warn,`[${this.prefix}] WARN: ${e}`,...r)}error(e,...r){this.log(3,console.error,`[${this.prefix}] ERROR: ${e}`,...r)}};function Ut(){if(typeof window>"u")return 2;let t=globalThis;return t.__VERYFRONT_DEV__||t.__RSC_DEV__?t.__VERYFRONT_DEBUG__||t.__RSC_DEBUG__?0:1:2}var N=Ut(),i=new R("RSC",N),Eo=new R("PREFETCH",N),yo=new R("HYDRATE",N),_o=new R("VERYFRONT",N);function E(t=document){try{let e=t.getElementById(Q);return e?JSON.parse(e.textContent||"{}"):null}catch(e){return i.debug("hydration data parse failed",e),null}}function A(t){return t?.clientModuleStrategy?t.clientModuleStrategy:t?.dev?"fs":"rsc-module"}function Pt(t,e){if(!e)return t;let r=t.includes("?")?"&":"?";return`${t}${r}v=${encodeURIComponent(e)}`}function Ht(t,e){return Pt(`${Z}${H(t)}.js`,e)}function Vt(t,e){let r=e?`&v=${encodeURIComponent(e)}`:"";return`${h}module?rel=${encodeURIComponent(t)}${r}`}function D(t){if(t.strategy==="fs"){let e=t.absPath??t.rel;return e?Ht(e,t.version):null}return Vt(t.rel,t.version)}function v(t=document,e=_){let r=V(t);return{react:O("react",r)?"react":J(e),reactDomClient:O("react-dom/client",r)?"react-dom/client":X(e)}}function tt(t=document){let e=V(t);return O("veryfront/router",e)?"veryfront/router":null}function o(t){return{...t,create(e){return new k(e?.message||e?.detail||t.title,{slug:t.slug,category:t.category,status:e?.status??t.status,title:t.title,suggestion:t.suggestion,detail:e?.detail,cause:e?.cause,instance:e?.instance,context:e?.context})}}}var k=class extends Error{constructor(r,n){super(r);p(this,"slug");p(this,"category");p(this,"status");p(this,"title");p(this,"suggestion");p(this,"detail");p(this,"cause");p(this,"instance");p(this,"context");this.name="VeryfrontError",this.slug=n.slug,this.category=n.category,this.status=n.status,this.title=n.title,this.suggestion=n.suggestion,this.detail=n.detail,this.cause=n.cause,this.instance=n.instance,this.context=n.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var Ft=o({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),kt=o({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),Gt=o({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),$t=o({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),Bt=o({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),Yt=o({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),jt=o({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),Wt=o({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),qt=o({slug:"webhook-config-invalid",category:"CONFIG",status:400,title:"Invalid webhook configuration",suggestion:"Check webhook definition fields, target settings, and eventFilter conditions"}),zt=o({slug:"schedule-config-invalid",category:"CONFIG",status:400,title:"Invalid schedule configuration",suggestion:"Check schedule definition fields, cron expression, target settings, and positive-integer limits"}),Jt=o({slug:"trigger-config-invalid",category:"CONFIG",status:400,title:"Invalid trigger configuration",suggestion:"Check trigger ID format (lowercase, alphanumeric, dots/slashes/hyphens) and ensure all input values are JSON-serializable"}),et={"config-not-found":Ft,"config-invalid":kt,"config-parse-error":Gt,"config-validation-error":$t,"config-type-error":Bt,"import-map-invalid":Yt,"cors-config-invalid":jt,"config-validation-failed":Wt,"webhook-config-invalid":qt,"schedule-config-invalid":zt,"trigger-config-invalid":Jt};var Xt=o({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),Kt=o({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),Zt=o({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),Qt=o({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),te=o({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),ee=o({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),re=o({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),oe=o({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),rt={"build-failed":Xt,"bundle-error":Kt,"typescript-error":Zt,"mdx-compile-error":Qt,"asset-optimization-error":te,"ssg-generation-error":ee,"sourcemap-error":re,"compilation-error":oe};var ne=o({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),se=o({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),ie=o({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),ae=o({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),ce=o({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),le=o({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),ue=o({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),de=o({slug:"trigger-target-not-found",category:"RUNTIME",status:404,title:"Trigger target not found",suggestion:"Ensure the referenced task or workflow ID is registered in the project"}),ge=o({slug:"trigger-execution-failed",category:"RUNTIME",status:500,title:"Trigger target execution failed",suggestion:"Check the task or workflow for errors and review the trigger input"}),pe=o({slug:"trigger-not-supported",category:"RUNTIME",status:501,title:"Trigger target type not supported in local runtime",suggestion:"Use a workflow or task target for local trigger runs; agent targets require the Cloud runtime"}),ot={"hydration-mismatch":ne,"render-error":se,"component-error":ie,"layout-not-found":ae,"page-not-found":ce,"api-error":le,"middleware-error":ue,"trigger-target-not-found":de,"trigger-execution-failed":ge,"trigger-not-supported":pe};var fe=o({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),me=o({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),Re=o({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),Ee=o({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),ye=o({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),_e=o({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),nt={"route-conflict":fe,"invalid-route-file":me,"route-handler-invalid":Re,"dynamic-route-error":Ee,"route-params-error":ye,"api-route-error":_e};var he=o({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),Ce=o({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),Te=o({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),xe=o({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Ie=o({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Se=o({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),st={"module-not-found":he,"import-resolution-error":Ce,"circular-dependency":Te,"invalid-import":xe,"dependency-missing":Ie,"version-mismatch":Se};var Oe=o({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),Ne=o({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),Ae=o({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),De=o({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),ve=o({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),be=o({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),Me=o({slug:"semaphore-timeout",category:"SERVER",status:503,title:"Semaphore acquire timeout",suggestion:"Reduce concurrency or increase the semaphore acquire timeout"}),Le=o({slug:"circuit-breaker-open",category:"SERVER",status:503,title:"Circuit breaker is open",suggestion:"Wait for the breaker reset timeout before retrying"}),we=o({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),Ue=o({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),Pe=o({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),He=o({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),Ve=o({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),Fe=o({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),ke=o({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),it={"port-in-use":Oe,"server-start-error":Ne,"cache-error":Ae,"file-watch-error":De,"request-error":ve,"service-overloaded":be,"semaphore-timeout":Me,"circuit-breaker-open":Le,"cache-path-mismatch":we,"network-error":Ue,"api-client-error":Pe,"token-storage-error":He,"cache-invariant-violation":Ve,"release-not-found":Fe,"fallback-exhausted":ke};var Ge=o({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),$e=o({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),Be=o({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),Ye=o({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),je=o({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),We=o({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),at={"client-boundary-violation":Ge,"server-only-in-client":$e,"client-only-in-server":Be,"invalid-use-client":Ye,"invalid-use-server":je,"rsc-payload-error":We};var qe=o({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),ze=o({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),Je=o({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),Xe=o({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),Ke=o({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),ct={"hmr-error":qe,"dev-server-error":ze,"fast-refresh-error":Je,"error-overlay-error":Xe,"source-map-error":Ke};var Ze=o({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),Qe=o({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),tr=o({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),er=o({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),lt={"deployment-error":Ze,"platform-error":Qe,"env-var-missing":tr,"production-build-required":er};var rr=o({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),or=o({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),nr=o({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),sr=o({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),ir=o({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),ar=o({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),cr=o({slug:"tool-id-conflict",category:"AGENT",status:409,title:"Tool ID conflict",suggestion:"Use a unique tool ID or rename one of the conflicting tools"}),ut={"agent-error":rr,"agent-not-found":or,"agent-timeout":nr,"agent-intent-error":sr,"orchestration-error":ir,"cost-limit-exceeded":ar,"tool-id-conflict":cr};var lr=o({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),ur=o({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),dr=o({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),gr=o({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),pr=o({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),fr=o({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),mr=o({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),Rr=o({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),G=o({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),Er=o({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"}),dt={"unknown-error":lr,"permission-denied":ur,"file-not-found":dr,"resource-not-found":gr,"invalid-argument":pr,"timeout-error":fr,"initialization-error":mr,"not-supported":Rr,"security-violation":G,"input-validation-failed":Er};var Rn={...et,...rt,...ot,...nt,...st,...it,...at,...ct,...lt,...ut,...dt};var yr=[{source:String.raw`<script[^>]*>[\\s\\S]*?<\\/script>`,flags:"gi",name:"inline script"},{source:String.raw`javascript:`,flags:"gi",name:"javascript: URL"},{source:String.raw`\\bon\\w+\\s*=`,flags:"gi",name:"event handler attribute"},{source:String.raw`data:\\s*text\\/html`,flags:"gi",name:"data: HTML URL"}];function _r(){return yr.map(({source:t,flags:e,name:r})=>({pattern:new RegExp(t,e),name:r}))}function hr(){let t=globalThis;return t.__VERYFRONT_DEV__===!0||t.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function T(t,e={}){let{allowInlineScripts:r=!1,strict:n=!1,warn:s=!0}=e;for(let{pattern:u,name:c}of _r())if(!(r&&c==="inline script")&&(u.lastIndex=0,!!u.test(t)&&(s&&console.warn(`[Security] Suspicious ${c} detected in server HTML`),n||!hr())))throw G.create({detail:`Potentially unsafe HTML: ${c} detected`});return t}function x(t,e){let r=e==="root"?C:`rsc-slot-${e}`,n=t.getElementById(r);if(n)return n;let s=t.createElement("div");return s.id=r,t.body.appendChild(s),s}function Cr(t,e){if(e.type!=="slot")return;let r=x(t,e.id);r.innerHTML=T(String(e.html??""))}function gt(t,e){let r=e.split(`\n`),n=r.pop()??"";for(let s of r){let u=s.trim();if(!u)continue;let c;try{c=JSON.parse(u)}catch(a){i.debug("[client-dom] malformed NDJSON line",{line:u,error:a instanceof Error?a.message:String(a)});continue}if(!c||typeof c!="object")continue;let g=c;if(g.type==="slot"){Cr(t,g);try{Ir(t,g.id||"root")}catch(a){i.debug("[client-dom] hydration optional failed",a)}}}return n}function Tr(t){return new Promise((e,r)=>{let n=()=>r(new DOMException("aborted","AbortError"));if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0})})}async function pt(t,e=document,r){let n="body"in t?t:null,s=n?.body??t;if(!s)return;let u=s.getReader(),c=new TextDecoder,g="",a=!1;try{for(;;){if(r?.aborted)throw new DOMException("aborted","AbortError");let d=u.read(),{done:f,value:y}=r?await Promise.race([d,Tr(r)]):await d;if(f){a=!0;break}g+=c.decode(y,{stream:!0}),g=gt(e,g)}g&&gt(e,`${g}\n`)}catch(d){throw d instanceof Error&&d.name==="AbortError"||i.debug("[client-dom] consumeNdjsonStream error",d),d}finally{try{await u.cancel()}catch(d){a||i.debug("[client-dom] reader.cancel failed",d)}try{u.releaseLock()}catch(d){i.debug("[client-dom] reader.releaseLock failed",d)}if(typeof s.cancel=="function")try{await s.cancel()}catch(d){i.debug("[client-dom] stream.cancel failed",d)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(d){i.debug("[client-dom] response.body.cancel failed",d)}}}function xr(t,e){let r=x(t,e),n=[],s=u=>{let c=u;c.dataset?.clientRef&&n.push(c);for(let g of u.children)s(g)};return s(r),n}function Ir(t,e){let r=xr(t,e);for(let n of r){let s=n.dataset?.clientRef;s&&(n.dataset.hydrated="true",i.debug("[client-dom] marked for hydration",s))}}var Sr=new Set(["server","client","html","fragment"]);function ft(t){if(!t)return[];try{let e=JSON.parse(t);return Nr(e)?e.nodes:[]}catch{return[]}}async function B(t,e,r){return await Promise.all(t.map(n=>Or(n,e,r)))}async function Or(t,e,r){if(t.type==="html")return t.text??t.html??"";let n=await B(t.children??[],e,r);if(t.type==="fragment"||t.type==="server"&&!t.component)return e.createElement(e.Fragment,{},...n);if(t.type==="server")return e.createElement(t.component,t.props??{},...n);let s=await r(t.component);return s?e.createElement(s,t.props??{},...n):null}function Nr(t){return!$(t)||t.version!==1||!Array.isArray(t.nodes)?!1:t.nodes.every(e=>mt(e,0))}function mt(t,e){return e>100||!$(t)||!Sr.has(t.type)||t.type==="html"&&typeof t.html!="string"&&typeof t.text!="string"||t.type==="client"&&typeof t.component!="string"||t.type==="server"&&t.component!==void 0&&typeof t.component!="string"||t.props!==void 0&&!$(t.props)?!1:t.children===void 0?!0:Array.isArray(t.children)&&t.children.every(r=>mt(r,e+1))}function $(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ar(t){if(!t)return{};let e={};for(let[r,n]of Object.entries(t))e[r]=Array.isArray(n)?n.join("/"):n;return e}async function b(t,e,r=document){try{let n=tt(r);if(!n)return t;let u=(await import(n)).wrapForHydration;return typeof u!="function"?t:u(t,{params:Ar(e?.params),frontmatter:e?.frontmatter??{}})}catch(n){return i.debug("router provider wrap failed",n),t}}var Dr=100;function vr(t,e){if(globalThis.__VF_CLIENT_MOD_CACHE??(globalThis.__VF_CLIENT_MOD_CACHE=new Map),globalThis.__VF_CLIENT_MOD_CACHE.size>=Dr){let r=globalThis.__VF_CLIENT_MOD_CACHE.keys().next().value;r&&globalThis.__VF_CLIENT_MOD_CACHE.delete(r)}globalThis.__VF_CLIENT_MOD_CACHE.set(t,e)}function Rt(t){let e=t.match(/^\\/app\\/(.+)#([\\w$.-]+)$/);if(e)return{rel:`/${e[1]||""}`,exportName:e[2]||"default"};let r=t.match(/^(\\/_veryfront\\/[^#]+)#([\\w$.-]+)$/);return r?{moduleUrl:r[1],exportName:r[2]||"default"}:(i.debug("hydrate: unrecognised client ref format, skipping",{ref:t}),null)}function br(t){let e=t.dataset?.rscProps;if(!e)return{};try{let r=JSON.parse(e);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch(r){return i.debug("hydrate: invalid client boundary props, using empty props",r),{}}}function Mr(t){return ft(t.dataset?.rscChildren)}async function Lr(){try{let t=await fetch("/_veryfront/rsc/manifest");return t.ok?await t.json():null}catch{return null}}async function Et(t,e,r){let n=wr(t,e,r),s=e.moduleUrl??e.rel;if(!s)return null;let u=`${s}#${t.hash??""}`;try{let c=globalThis.__VF_CLIENT_MOD_CACHE?.get(u);if(c)return c}catch(c){i.debug("hydrate: cache get failed",c)}if(!n)return null;try{let c=await import(n);try{vr(u,c)}catch(g){i.debug("hydrate: cache set failed",g)}return c}catch(c){return i.debug("hydrate: failed to import module",{moduleUrl:n,error:c}),null}}function wr(t,e,r){if(e.moduleUrl)return e.moduleUrl;if(!e.rel)return null;let n=t.graphIds?.client.find(s=>s.rel===e.rel)?.path;return D({strategy:r,rel:e.rel,absPath:n,version:t.hash})}function Ur(t){let e=Array.from(t.querySelectorAll("[data-client-ref]")),r=new Set(e);return e.filter(n=>{let s=n.parentElement;for(;s;){if(r.has(s))return!1;s=s.parentElement}return!0})}async function yt(t=document){let e=null;try{e=await Lr()}catch(a){i.debug("hydrate: fetch manifest failed",a)}if(!e){i.debug("hydrate: no manifest");return}let r=Ur(t);try{let a=globalThis.__VF_MANIFEST_HASH;if(!r.some(f=>f.dataset?.hydrated!=="true")&&a&&e.hash&&a===e.hash)return}catch(a){i.debug("hydrate: hmr hash read failed",a)}if(r.length===0){try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(a){i.debug("hydrate: set hash failed",a)}return}let n=E(t),s=A(n);try{if(globalThis.__VF_TEST_MODE__){globalThis.__VF_HYDRATE_CALLED=!0,globalThis.__VF_MANIFEST_HASH=e.hash??"";return}}catch(a){i.debug("hydrate: test mode flags failed",a)}let u=v(t,n?.reactVersion),[{default:c},{createRoot:g}]=await Promise.all([import(u.react),import(u.reactDomClient)]);for(let a of r){let d=a.dataset?.clientRef??"";if(!d||a.dataset?.hydrated==="true")continue;let f=Rt(d);if(!f)continue;let y=await Et(e,f,s);if(!y)continue;let j=y[f.exportName]??y.default;if(typeof j=="function")try{let L=g(a),_t=br(a),ht=Mr(a),Ct=await B(ht,{Fragment:c.Fragment,createElement(I,w,...S){return c.createElement(I,w,...S)}},async I=>{let w=e.modules.find(xt=>xt.id===I),S=e.components?.[I],W=w?.clientRef??(S?`${S}#default`:void 0);if(!W)return null;let U=Rt(W);if(!U)return null;let P=await Et(e,U,s);if(!P)return null;let q=P[U.exportName]??P.default;return typeof q=="function"?q:null}),Tt=await b(c.createElement(j,_t,...Ct),n,t);L.render(Tt),a.dataset.hydrated="true"}catch(L){i.warn("hydrate: render failed",L)}}try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(a){i.debug("hydrate: set hash failed (post)",a)}}async function Pr(){let t=E(document),e=v(document,t?.reactVersion),[r,n]=await Promise.all([import(e.react),import(e.reactDomClient)]);return{React:r,ReactDOM:n}}var Hr=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function Y(t){let e=t.getAttribute("style")??"";return t.hasAttribute("data-veryfront-head")||t.hasAttribute("hidden")||/(?:^|;)\\s*display\\s*:\\s*none(?:\\s*;|$)/i.test(e)||Hr.has(t.tagName.toUpperCase())}function Vr(t,e){return t.find(r=>r.tagName.toUpperCase()==="DIV"&&!!r.getAttribute("class")?.trim()&&!Y(r))??e}function Fr(t,e){return t===e}function kr(t,e){let r=document.createElement("div");r.setAttribute("data-veryfront-hydration-root","page");let n=t.find(s=>!Y(s));n?.parentNode===e?e.insertBefore(r,n):e.appendChild(r);for(let s of t)!Y(s)&&s.parentNode===e&&r.appendChild(s);return r}function Gr(t,e,r=document){return!!e?.pagePath&&typeof t?.__veryfrontRenderPage=="function"&&!!r.getElementById("root")}function $r(t,e){return e?.pagePath?!1:!!t.getElementById(C)}function Br(t=import.meta.url){try{return new URL(t,"http://veryfront.local").searchParams.get("hydrate")==="1"}catch{return!1}}function Yr(t){return t==="rsc-module"}async function jr(t){try{let e=await fetch(h+"stream"+t);if(!e.ok||!e.body)return!1;let r=new AbortController;return addEventListener("pagehide",()=>r.abort(),{once:!0}),await pt(e,document,r.signal),!0}catch(e){return i.debug("tryStream failed",e),!1}}async function M(){try{await yt(document)}catch(t){i.debug("hydration failed",t)}}async function Wr(t,e){try{let{React:r,ReactDOM:n}=await Pr(),s=D({strategy:e,rel:t});if(!s)return!1;i.debug("Loading component from:",s);let c=(await import(s)).default;if(typeof c!="function")return i.debug("Page component is not a function"),!1;let g=Array.from(document.body.children),a=Vr(g,document.body),d=Fr(a,document.body)?kr(g,document.body):a,f=await b(r.createElement(c,{}),E(document));return Yr(e)?n.createRoot(d).render(f):n.hydrateRoot(d,f,{identifierPrefix:"vf",onRecoverableError:()=>{}}),i.debug("Page component hydrated successfully"),!0}catch(r){return i.error("Page hydration failed",r),!1}}async function qr(t){try{let e=await fetch(h+"payload"+t);if(!e.ok)return!1;let r=await e.json();if(r?.slots){for(let[n,s]of Object.entries(r.slots))x(document,n).innerHTML=T(String(s||""));return!0}return x(document,C).innerHTML=T(String(r?.html||"")),!0}catch(e){return i.debug("payload fetch failed",e),!1}}async function zr(){try{let t=globalThis.window?.location.search??"",e=E(document);if(Br()){await M();return}let r=e?.pagePath,n=A(e);if(r){if(Gr(globalThis.window,e,document)){i.debug("Page renderer owns hydration");return}i.debug("Found page component in hydration data:",r),await Wr(r,n)&&i.debug("Client component hydrated successfully");return}if(!$r(document,e))return;if(await jr(t)){await M();return}if(await qr(t)){await M();return}await M()}catch(t){i.error("boot failed",t)}}if(typeof document<"u"){let t=()=>{zr()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{zr as boot,Vr as selectHydrationRoot,$r as shouldAttemptRSCTransport,Br as shouldHydrateOnly,Yr as shouldRenderPageComponent,Gr as shouldUsePageRendererHydration,Fr as shouldWrapPageHydrationRoot};\n';
8
+ export const CLIENT_BOOT_BUNDLE = 'var It=Object.defineProperty;var St=(t,e,r)=>e in t?It(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>St(t,typeof e!="symbol"?e+"":e,r);var Ot="3.2.3";function Nt(t,e,r,n){let s=[];if(n?.external?.length&&s.push(`external=${n.external.join(",")}`),s.push(`target=${n?.target??"es2022"}`),n?.deps){let a=Object.entries(n.deps).map(([d,f])=>`${d}@${f}`).join(",");s.push(`deps=${a}`)}let u=e?`@${e}`:"",c=r??"",g=s.length?`?${s.join("&")}`:"";return`https://esm.sh/${t}${u}${c}${g}`}function m(t,e,r,n=!1){return Nt(t,e,r,{external:n?["react"]:void 0,deps:{csstype:Ot}})}var Dt="19.2.4",_=Dt;function z(t=_){return{react:m("react",t),"react-dom":m("react-dom",t,void 0,!0),"react-dom/client":m("react-dom",t,"/client",!0),"react-dom/server":m("react-dom",t,"/server",!0),"react/jsx-runtime":m("react",t,"/jsx-runtime",!0),"react/jsx-dev-runtime":m("react",t,"/jsx-dev-runtime",!0)}}function J(t=_){return z(t).react}function X(t=_){return z(t)["react-dom/client"]}function vt(t){return t.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function bt(t){if(typeof globalThis.btoa=="function")try{return globalThis.btoa(t)}catch{return Mt(new TextEncoder().encode(t))}let e=globalThis.Buffer;if(e)return e.from(t,"utf8").toString("base64");throw new Error("Base64 encoding is not supported in this runtime")}function Mt(t){let e=globalThis.Buffer;if(e)return e.from(t).toString("base64");if(typeof globalThis.btoa=="function"){let r="";for(let n of t)r+=String.fromCharCode(n);return globalThis.btoa(r)}throw new Error("Base64 encoding is not supported in this runtime")}function H(t){return vt(bt(t))}var io=Object.freeze({react:"","react-dom":"","react-dom/client":"","react-dom/server":"","react/jsx-runtime":"","react/jsx-dev-runtime":""});function O(t,e){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t))return!0;for(let r of Object.keys(e))if(r.endsWith("/")&&t.startsWith(r))return!0;return!1}function Lt(t){try{return JSON.parse(t)?.imports??{}}catch(e){return console.warn("Failed to parse import map JSON; treating as empty",{errorName:e instanceof Error?e.name:typeof e,inputLength:t.length}),{}}}function V(t=document){let e=t.querySelector(\'script[type="importmap"]\');return e?.textContent?Lt(e.textContent):{}}var l="/_veryfront",F={RSC:`${l}/rsc/`,FS:`${l}/fs/`,MODULES:`${l}/modules/`,PAGES:`${l}/pages/`,DATA:`${l}/data/`,LIB:`${l}/lib/`,CHUNKS:`${l}/chunks/`,CLIENT:`${l}/client/`},K={HMR_RUNTIME:`${l}/hmr-runtime.js`,HMR:`${l}/hmr.js`,ERROR_OVERLAY:`${l}/error-overlay.js`,DEV_LOADER:`${l}/dev-loader.js`,CLIENT_LOG:`${l}/log`,CLIENT_JS:`${l}/client.js`,ROUTER_JS:`${l}/router.js`,PREFETCH_JS:`${l}/prefetch.js`,MANIFEST_JSON:`${l}/manifest.json`,APP_JS:`${l}/app.js`,RSC_CLIENT:`${l}/rsc/client.js`,RSC_MANIFEST:`${l}/rsc/manifest`,RSC_STREAM:`${l}/rsc/stream`,RSC_PAYLOAD:`${l}/rsc/payload`,RSC_RENDER:`${l}/rsc/render`,RSC_PAGE:`${l}/rsc/page`,RSC_MODULE:`${l}/rsc/module`,RSC_DOM:`${l}/rsc/dom.js`,LIB_CHAT_REACT:`${l}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${l}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${l}/lib/chat/primitives.js`};var Ut={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},go=Ut.CACHE;var po={HMR_RUNTIME:K.HMR_RUNTIME,ERROR_OVERLAY:K.ERROR_OVERLAY};var h=F.RSC,Z=F.FS,Q="veryfront-hydration-data",C="rsc-root";var R=class{constructor(e,r){p(this,"prefix",e);p(this,"level",r)}log(e,r,n,...s){this.level>e||r?.(n,...s)}debug(e,...r){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${e}`,...r)}info(e,...r){this.log(1,console.log,`[${this.prefix}] ${e}`,...r)}warn(e,...r){this.log(2,console.warn,`[${this.prefix}] WARN: ${e}`,...r)}error(e,...r){this.log(3,console.error,`[${this.prefix}] ERROR: ${e}`,...r)}};function Pt(){if(typeof window>"u")return 2;let t=globalThis;return t.__VERYFRONT_DEV__||t.__RSC_DEV__?t.__VERYFRONT_DEBUG__||t.__RSC_DEBUG__?0:1:2}var N=Pt(),i=new R("RSC",N),yo=new R("PREFETCH",N),_o=new R("HYDRATE",N),ho=new R("VERYFRONT",N);function E(t=document){try{let e=t.getElementById(Q);return e?JSON.parse(e.textContent||"{}"):null}catch(e){return i.debug("hydration data parse failed",e),null}}function A(t){return t?.clientModuleStrategy?t.clientModuleStrategy:t?.dev?"fs":"rsc-module"}function Ht(t,e){if(!e)return t;let r=t.includes("?")?"&":"?";return`${t}${r}v=${encodeURIComponent(e)}`}function Vt(t,e){return Ht(`${Z}${H(t)}.js`,e)}function Ft(t,e){let r=e?`&v=${encodeURIComponent(e)}`:"";return`${h}module?rel=${encodeURIComponent(t)}${r}`}function D(t){if(t.strategy==="fs"){let e=t.absPath??t.rel;return e?Vt(e,t.version):null}return Ft(t.rel,t.version)}function v(t=document,e=_){let r=V(t);return{react:O("react",r)?"react":J(e),reactDomClient:O("react-dom/client",r)?"react-dom/client":X(e)}}function tt(t=document){let e=V(t);return O("veryfront/router",e)?"veryfront/router":null}function o(t){return{...t,create(e){return new k(e?.message||e?.detail||t.title,{slug:t.slug,category:t.category,status:e?.status??t.status,title:t.title,suggestion:t.suggestion,detail:e?.detail,cause:e?.cause,instance:e?.instance,context:e?.context})}}}var k=class extends Error{constructor(r,n){super(r);p(this,"slug");p(this,"category");p(this,"status");p(this,"title");p(this,"suggestion");p(this,"detail");p(this,"cause");p(this,"instance");p(this,"context");this.name="VeryfrontError",this.slug=n.slug,this.category=n.category,this.status=n.status,this.title=n.title,this.suggestion=n.suggestion,this.detail=n.detail,this.cause=n.cause,this.instance=n.instance,this.context=n.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var kt=o({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),Gt=o({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),$t=o({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),Bt=o({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),Yt=o({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),jt=o({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),Wt=o({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),qt=o({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),zt=o({slug:"webhook-config-invalid",category:"CONFIG",status:400,title:"Invalid webhook configuration",suggestion:"Check webhook definition fields, target settings, and eventFilter conditions"}),Jt=o({slug:"schedule-config-invalid",category:"CONFIG",status:400,title:"Invalid schedule configuration",suggestion:"Check schedule definition fields, cron expression, target settings, and positive-integer limits"}),Xt=o({slug:"trigger-config-invalid",category:"CONFIG",status:400,title:"Invalid trigger configuration",suggestion:"Check trigger ID format (lowercase, alphanumeric, dots/slashes/hyphens) and ensure all input values are JSON-serializable"}),et={"config-not-found":kt,"config-invalid":Gt,"config-parse-error":$t,"config-validation-error":Bt,"config-type-error":Yt,"import-map-invalid":jt,"cors-config-invalid":Wt,"config-validation-failed":qt,"webhook-config-invalid":zt,"schedule-config-invalid":Jt,"trigger-config-invalid":Xt};var Kt=o({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),Zt=o({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),Qt=o({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),te=o({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),ee=o({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),re=o({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),oe=o({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),ne=o({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),rt={"build-failed":Kt,"bundle-error":Zt,"typescript-error":Qt,"mdx-compile-error":te,"asset-optimization-error":ee,"ssg-generation-error":re,"sourcemap-error":oe,"compilation-error":ne};var se=o({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),ie=o({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),ae=o({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),ce=o({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),le=o({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),ue=o({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),de=o({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),ge=o({slug:"trigger-target-not-found",category:"RUNTIME",status:404,title:"Trigger target not found",suggestion:"Ensure the referenced task or workflow ID is registered in the project"}),pe=o({slug:"trigger-execution-failed",category:"RUNTIME",status:500,title:"Trigger target execution failed",suggestion:"Check the task or workflow for errors and review the trigger input"}),fe=o({slug:"trigger-not-supported",category:"RUNTIME",status:501,title:"Trigger target type not supported in local runtime",suggestion:"Use a workflow or task target for local trigger runs; agent targets require the Cloud runtime"}),ot={"hydration-mismatch":se,"render-error":ie,"component-error":ae,"layout-not-found":ce,"page-not-found":le,"api-error":ue,"middleware-error":de,"trigger-target-not-found":ge,"trigger-execution-failed":pe,"trigger-not-supported":fe};var me=o({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),Re=o({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),Ee=o({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),ye=o({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),_e=o({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),he=o({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),nt={"route-conflict":me,"invalid-route-file":Re,"route-handler-invalid":Ee,"dynamic-route-error":ye,"route-params-error":_e,"api-route-error":he};var Ce=o({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),Te=o({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),xe=o({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),Ie=o({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Se=o({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Oe=o({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),st={"module-not-found":Ce,"import-resolution-error":Te,"circular-dependency":xe,"invalid-import":Ie,"dependency-missing":Se,"version-mismatch":Oe};var Ne=o({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),Ae=o({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),De=o({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),ve=o({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),be=o({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),Me=o({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),Le=o({slug:"semaphore-timeout",category:"SERVER",status:503,title:"Semaphore acquire timeout",suggestion:"Reduce concurrency or increase the semaphore acquire timeout"}),we=o({slug:"circuit-breaker-open",category:"SERVER",status:503,title:"Circuit breaker is open",suggestion:"Wait for the breaker reset timeout before retrying"}),Ue=o({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),Pe=o({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),He=o({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Ve=o({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),Fe=o({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),ke=o({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),Ge=o({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),it={"port-in-use":Ne,"server-start-error":Ae,"cache-error":De,"file-watch-error":ve,"request-error":be,"service-overloaded":Me,"semaphore-timeout":Le,"circuit-breaker-open":we,"cache-path-mismatch":Ue,"network-error":Pe,"api-client-error":He,"token-storage-error":Ve,"cache-invariant-violation":Fe,"release-not-found":ke,"fallback-exhausted":Ge};var $e=o({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),Be=o({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),Ye=o({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),je=o({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),We=o({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),qe=o({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),at={"client-boundary-violation":$e,"server-only-in-client":Be,"client-only-in-server":Ye,"invalid-use-client":je,"invalid-use-server":We,"rsc-payload-error":qe};var ze=o({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),Je=o({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),Xe=o({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),Ke=o({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),Ze=o({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),ct={"hmr-error":ze,"dev-server-error":Je,"fast-refresh-error":Xe,"error-overlay-error":Ke,"source-map-error":Ze};var Qe=o({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),tr=o({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),er=o({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),rr=o({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),lt={"deployment-error":Qe,"platform-error":tr,"env-var-missing":er,"production-build-required":rr};var or=o({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),nr=o({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),sr=o({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),ir=o({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),ar=o({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),cr=o({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),lr=o({slug:"tool-id-conflict",category:"AGENT",status:409,title:"Tool ID conflict",suggestion:"Use a unique tool ID or rename one of the conflicting tools"}),ut={"agent-error":or,"agent-not-found":nr,"agent-timeout":sr,"agent-intent-error":ir,"orchestration-error":ar,"cost-limit-exceeded":cr,"tool-id-conflict":lr};var ur=o({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),dr=o({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),gr=o({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),pr=o({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),fr=o({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),mr=o({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),Rr=o({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),Er=o({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),G=o({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),yr=o({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"}),dt={"unknown-error":ur,"permission-denied":dr,"file-not-found":gr,"resource-not-found":pr,"invalid-argument":fr,"timeout-error":mr,"initialization-error":Rr,"not-supported":Er,"security-violation":G,"input-validation-failed":yr};var En={...et,...rt,...ot,...nt,...st,...it,...at,...ct,...lt,...ut,...dt};var _r=[{source:String.raw`<script[^>]*>[\\s\\S]*?<\\/script>`,flags:"gi",name:"inline script"},{source:String.raw`javascript:`,flags:"gi",name:"javascript: URL"},{source:String.raw`\\bon\\w+\\s*=`,flags:"gi",name:"event handler attribute"},{source:String.raw`data:\\s*text\\/html`,flags:"gi",name:"data: HTML URL"}];function hr(){return _r.map(({source:t,flags:e,name:r})=>({pattern:new RegExp(t,e),name:r}))}function Cr(){let t=globalThis;return t.__VERYFRONT_DEV__===!0||t.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function T(t,e={}){let{allowInlineScripts:r=!1,strict:n=!1,warn:s=!0}=e;for(let{pattern:u,name:c}of hr())if(!(r&&c==="inline script")&&(u.lastIndex=0,!!u.test(t)&&(s&&console.warn(`[Security] Suspicious ${c} detected in server HTML`),n||!Cr())))throw G.create({detail:`Potentially unsafe HTML: ${c} detected`});return t}function x(t,e){let r=e==="root"?C:`rsc-slot-${e}`,n=t.getElementById(r);if(n)return n;let s=t.createElement("div");return s.id=r,t.body.appendChild(s),s}function Tr(t,e){if(e.type!=="slot")return;let r=x(t,e.id);r.innerHTML=T(String(e.html??""))}function gt(t,e){let r=e.split(`\n`),n=r.pop()??"";for(let s of r){let u=s.trim();if(!u)continue;let c;try{c=JSON.parse(u)}catch(a){i.debug("[client-dom] malformed NDJSON line",{line:u,error:a instanceof Error?a.message:String(a)});continue}if(!c||typeof c!="object")continue;let g=c;if(g.type==="slot"){Tr(t,g);try{Sr(t,g.id||"root")}catch(a){i.debug("[client-dom] hydration optional failed",a)}}}return n}function xr(t){return new Promise((e,r)=>{let n=()=>r(new DOMException("aborted","AbortError"));if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0})})}async function pt(t,e=document,r){let n="body"in t?t:null,s=n?.body??t;if(!s)return;let u=s.getReader(),c=new TextDecoder,g="",a=!1;try{for(;;){if(r?.aborted)throw new DOMException("aborted","AbortError");let d=u.read(),{done:f,value:y}=r?await Promise.race([d,xr(r)]):await d;if(f){a=!0;break}g+=c.decode(y,{stream:!0}),g=gt(e,g)}g&&gt(e,`${g}\n`)}catch(d){throw d instanceof Error&&d.name==="AbortError"||i.debug("[client-dom] consumeNdjsonStream error",d),d}finally{try{await u.cancel()}catch(d){a||i.debug("[client-dom] reader.cancel failed",d)}try{u.releaseLock()}catch(d){i.debug("[client-dom] reader.releaseLock failed",d)}if(typeof s.cancel=="function")try{await s.cancel()}catch(d){i.debug("[client-dom] stream.cancel failed",d)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(d){i.debug("[client-dom] response.body.cancel failed",d)}}}function Ir(t,e){let r=x(t,e),n=[],s=u=>{let c=u;c.dataset?.clientRef&&n.push(c);for(let g of u.children)s(g)};return s(r),n}function Sr(t,e){let r=Ir(t,e);for(let n of r){let s=n.dataset?.clientRef;s&&(n.dataset.hydrated="true",i.debug("[client-dom] marked for hydration",s))}}var Or=new Set(["server","client","html","fragment"]);function ft(t){if(!t)return[];try{let e=JSON.parse(t);return Ar(e)?e.nodes:[]}catch{return[]}}async function B(t,e,r){return await Promise.all(t.map(n=>Nr(n,e,r)))}async function Nr(t,e,r){if(t.type==="html")return t.text??t.html??"";let n=await B(t.children??[],e,r);if(t.type==="fragment"||t.type==="server"&&!t.component)return e.createElement(e.Fragment,{},...n);if(t.type==="server")return e.createElement(t.component,t.props??{},...n);let s=await r(t.component);return s?e.createElement(s,t.props??{},...n):null}function Ar(t){return!$(t)||t.version!==1||!Array.isArray(t.nodes)?!1:t.nodes.every(e=>mt(e,0))}function mt(t,e){return e>100||!$(t)||!Or.has(t.type)||t.type==="html"&&typeof t.html!="string"&&typeof t.text!="string"||t.type==="client"&&typeof t.component!="string"||t.type==="server"&&t.component!==void 0&&typeof t.component!="string"||t.props!==void 0&&!$(t.props)?!1:t.children===void 0?!0:Array.isArray(t.children)&&t.children.every(r=>mt(r,e+1))}function $(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Dr(t){if(!t)return{};let e={};for(let[r,n]of Object.entries(t))e[r]=Array.isArray(n)?n.join("/"):n;return e}async function b(t,e,r=document){try{let n=tt(r);if(!n)return t;let u=(await import(n)).wrapForHydration;return typeof u!="function"?t:u(t,{params:Dr(e?.params),frontmatter:e?.frontmatter??{}})}catch(n){return i.debug("router provider wrap failed",n),t}}var vr=100;function br(t,e){if(globalThis.__VF_CLIENT_MOD_CACHE??(globalThis.__VF_CLIENT_MOD_CACHE=new Map),globalThis.__VF_CLIENT_MOD_CACHE.size>=vr){let r=globalThis.__VF_CLIENT_MOD_CACHE.keys().next().value;r&&globalThis.__VF_CLIENT_MOD_CACHE.delete(r)}globalThis.__VF_CLIENT_MOD_CACHE.set(t,e)}function Rt(t){let e=t.match(/^\\/app\\/(.+)#([\\w$.-]+)$/);if(e)return{rel:`/${e[1]||""}`,exportName:e[2]||"default"};let r=t.match(/^(\\/_veryfront\\/[^#]+)#([\\w$.-]+)$/);return r?{moduleUrl:r[1],exportName:r[2]||"default"}:(i.debug("hydrate: unrecognised client ref format, skipping",{ref:t}),null)}function Mr(t){let e=t.dataset?.rscProps;if(!e)return{};try{let r=JSON.parse(e);return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}catch(r){return i.debug("hydrate: invalid client boundary props, using empty props",r),{}}}function Lr(t){return ft(t.dataset?.rscChildren)}async function wr(){try{let t=await fetch("/_veryfront/rsc/manifest");return t.ok?await t.json():null}catch{return null}}async function Et(t,e,r){let n=Ur(t,e,r),s=e.moduleUrl??e.rel;if(!s)return null;let u=`${s}#${t.hash??""}`;try{let c=globalThis.__VF_CLIENT_MOD_CACHE?.get(u);if(c)return c}catch(c){i.debug("hydrate: cache get failed",c)}if(!n)return null;try{let c=await import(n);try{br(u,c)}catch(g){i.debug("hydrate: cache set failed",g)}return c}catch(c){return i.debug("hydrate: failed to import module",{moduleUrl:n,error:c}),null}}function Ur(t,e,r){if(e.moduleUrl)return e.moduleUrl;if(!e.rel)return null;let n=t.graphIds?.client.find(s=>s.rel===e.rel)?.path;return D({strategy:r,rel:e.rel,absPath:n,version:t.hash})}function Pr(t){let e=Array.from(t.querySelectorAll("[data-client-ref]")),r=new Set(e);return e.filter(n=>{let s=n.parentElement;for(;s;){if(r.has(s))return!1;s=s.parentElement}return!0})}async function yt(t=document){let e=null;try{e=await wr()}catch(a){i.debug("hydrate: fetch manifest failed",a)}if(!e){i.debug("hydrate: no manifest");return}let r=Pr(t);try{let a=globalThis.__VF_MANIFEST_HASH;if(!r.some(f=>f.dataset?.hydrated!=="true")&&a&&e.hash&&a===e.hash)return}catch(a){i.debug("hydrate: hmr hash read failed",a)}if(r.length===0){try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(a){i.debug("hydrate: set hash failed",a)}return}let n=E(t),s=A(n);try{if(globalThis.__VF_TEST_MODE__){globalThis.__VF_HYDRATE_CALLED=!0,globalThis.__VF_MANIFEST_HASH=e.hash??"";return}}catch(a){i.debug("hydrate: test mode flags failed",a)}let u=v(t,n?.reactVersion),[{default:c},{createRoot:g}]=await Promise.all([import(u.react),import(u.reactDomClient)]);for(let a of r){let d=a.dataset?.clientRef??"";if(!d||a.dataset?.hydrated==="true")continue;let f=Rt(d);if(!f)continue;let y=await Et(e,f,s);if(!y)continue;let j=y[f.exportName]??y.default;if(typeof j=="function")try{let L=g(a),_t=Mr(a),ht=Lr(a),Ct=await B(ht,{Fragment:c.Fragment,createElement(I,w,...S){return c.createElement(I,w,...S)}},async I=>{let w=e.modules.find(xt=>xt.id===I),S=e.components?.[I],W=w?.clientRef??(S?`${S}#default`:void 0);if(!W)return null;let U=Rt(W);if(!U)return null;let P=await Et(e,U,s);if(!P)return null;let q=P[U.exportName]??P.default;return typeof q=="function"?q:null}),Tt=await b(c.createElement(j,_t,...Ct),n,t);L.render(Tt),a.dataset.hydrated="true"}catch(L){i.warn("hydrate: render failed",L)}}try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(a){i.debug("hydrate: set hash failed (post)",a)}}async function Hr(){let t=E(document),e=v(document,t?.reactVersion),[r,n]=await Promise.all([import(e.react),import(e.reactDomClient)]);return{React:r,ReactDOM:n}}var Vr=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function Y(t){let e=t.getAttribute("style")??"";return t.hasAttribute("data-veryfront-head")||t.hasAttribute("hidden")||/(?:^|;)\\s*display\\s*:\\s*none(?:\\s*;|$)/i.test(e)||Vr.has(t.tagName.toUpperCase())}function Fr(t,e){return t.find(r=>r.tagName.toUpperCase()==="DIV"&&!!r.getAttribute("class")?.trim()&&!Y(r))??e}function kr(t,e){return t===e}function Gr(t,e){let r=document.createElement("div");r.setAttribute("data-veryfront-hydration-root","page");let n=t.find(s=>!Y(s));n?.parentNode===e?e.insertBefore(r,n):e.appendChild(r);for(let s of t)!Y(s)&&s.parentNode===e&&r.appendChild(s);return r}function $r(t,e,r=document){return!!e?.pagePath&&typeof t?.__veryfrontRenderPage=="function"&&!!r.getElementById("root")}function Br(t,e){return e?.pagePath?!1:!!t.getElementById(C)}function Yr(t=import.meta.url){try{return new URL(t,"http://veryfront.local").searchParams.get("hydrate")==="1"}catch{return!1}}function jr(t){return t==="rsc-module"}async function Wr(t){try{let e=await fetch(h+"stream"+t);if(!e.ok||!e.body)return!1;let r=new AbortController;return addEventListener("pagehide",()=>r.abort(),{once:!0}),await pt(e,document,r.signal),!0}catch(e){return i.debug("tryStream failed",e),!1}}async function M(){try{await yt(document)}catch(t){i.debug("hydration failed",t)}}async function qr(t,e){try{let{React:r,ReactDOM:n}=await Hr(),s=D({strategy:e,rel:t});if(!s)return!1;i.debug("Loading component from:",s);let c=(await import(s)).default;if(typeof c!="function")return i.debug("Page component is not a function"),!1;let g=Array.from(document.body.children),a=Fr(g,document.body),d=kr(a,document.body)?Gr(g,document.body):a,f=await b(r.createElement(c,{}),E(document));return jr(e)?n.createRoot(d).render(f):n.hydrateRoot(d,f,{identifierPrefix:"vf",onRecoverableError:()=>{}}),i.debug("Page component hydrated successfully"),!0}catch(r){return i.error("Page hydration failed",r),!1}}async function zr(t){try{let e=await fetch(h+"payload"+t);if(!e.ok)return!1;let r=await e.json();if(r?.slots){for(let[n,s]of Object.entries(r.slots))x(document,n).innerHTML=T(String(s||""));return!0}return x(document,C).innerHTML=T(String(r?.html||"")),!0}catch(e){return i.debug("payload fetch failed",e),!1}}async function Jr(){try{let t=globalThis.window?.location.search??"",e=E(document);if(Yr()){await M();return}let r=e?.pagePath,n=A(e);if(r){if($r(globalThis.window,e,document)){i.debug("Page renderer owns hydration");return}i.debug("Found page component in hydration data:",r),await qr(r,n)&&i.debug("Client component hydrated successfully");return}if(!Br(document,e))return;if(await Wr(t)){await M();return}if(await zr(t)){await M();return}await M()}catch(t){i.error("boot failed",t)}}if(typeof document<"u"){let t=()=>{Jr()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{Jr as boot,Fr as selectHydrationRoot,Br as shouldAttemptRSCTransport,Yr as shouldHydrateOnly,jr as shouldRenderPageComponent,$r as shouldUsePageRendererHydration,kr as shouldWrapPageHydrationRoot};\n';
9
9
  export const CLIENT_DOM_BUNDLE = 'var V=Object.defineProperty;var k=(r,t,o)=>t in r?V(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var l=(r,t,o)=>k(r,typeof t!="symbol"?t+"":t,o);function e(r){return{...r,create(t){return new f(t?.message||t?.detail||r.title,{slug:r.slug,category:r.category,status:t?.status??r.status,title:r.title,suggestion:r.suggestion,detail:t?.detail,cause:t?.cause,instance:t?.instance,context:t?.context})}}}var f=class extends Error{constructor(o,n){super(o);l(this,"slug");l(this,"category");l(this,"status");l(this,"title");l(this,"suggestion");l(this,"detail");l(this,"cause");l(this,"instance");l(this,"context");this.name="VeryfrontError",this.slug=n.slug,this.category=n.category,this.status=n.status,this.title=n.title,this.suggestion=n.suggestion,this.detail=n.detail,this.cause=n.cause,this.instance=n.instance,this.context=n.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var w=e({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),F=e({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),H=e({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),Y=e({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),B=e({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),$=e({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),j=e({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),q=e({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),z=e({slug:"webhook-config-invalid",category:"CONFIG",status:400,title:"Invalid webhook configuration",suggestion:"Check webhook definition fields, target settings, and eventFilter conditions"}),W=e({slug:"schedule-config-invalid",category:"CONFIG",status:400,title:"Invalid schedule configuration",suggestion:"Check schedule definition fields, cron expression, target settings, and positive-integer limits"}),J=e({slug:"trigger-config-invalid",category:"CONFIG",status:400,title:"Invalid trigger configuration",suggestion:"Check trigger ID format (lowercase, alphanumeric, dots/slashes/hyphens) and ensure all input values are JSON-serializable"}),y={"config-not-found":w,"config-invalid":F,"config-parse-error":H,"config-validation-error":Y,"config-type-error":B,"import-map-invalid":$,"cors-config-invalid":j,"config-validation-failed":q,"webhook-config-invalid":z,"schedule-config-invalid":W,"trigger-config-invalid":J};var X=e({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),K=e({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),Z=e({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),Q=e({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),ee=e({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),te=e({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),re=e({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),oe=e({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),I={"build-failed":X,"bundle-error":K,"typescript-error":Z,"mdx-compile-error":Q,"asset-optimization-error":ee,"ssg-generation-error":te,"sourcemap-error":re,"compilation-error":oe};var ne=e({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),se=e({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),ie=e({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),ae=e({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),ce=e({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),ue=e({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),le=e({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),ge=e({slug:"trigger-target-not-found",category:"RUNTIME",status:404,title:"Trigger target not found",suggestion:"Ensure the referenced task or workflow ID is registered in the project"}),pe=e({slug:"trigger-execution-failed",category:"RUNTIME",status:500,title:"Trigger target execution failed",suggestion:"Check the task or workflow for errors and review the trigger input"}),de=e({slug:"trigger-not-supported",category:"RUNTIME",status:501,title:"Trigger target type not supported in local runtime",suggestion:"Use a workflow or task target for local trigger runs; agent targets require the Cloud runtime"}),O={"hydration-mismatch":ne,"render-error":se,"component-error":ie,"layout-not-found":ae,"page-not-found":ce,"api-error":ue,"middleware-error":le,"trigger-target-not-found":ge,"trigger-execution-failed":pe,"trigger-not-supported":de};var Ee=e({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),Re=e({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),fe=e({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),me=e({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),_e=e({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),ye=e({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),T={"route-conflict":Ee,"invalid-route-file":Re,"route-handler-invalid":fe,"dynamic-route-error":me,"route-params-error":_e,"api-route-error":ye};var Ie=e({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),Oe=e({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),Te=e({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),he=e({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),xe=e({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Se=e({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),h={"module-not-found":Ie,"import-resolution-error":Oe,"circular-dependency":Te,"invalid-import":he,"dependency-missing":xe,"version-mismatch":Se};var Ne=e({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),ve=e({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),Ce=e({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),Ae=e({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),De=e({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),Le=e({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),Ue=e({slug:"semaphore-timeout",category:"SERVER",status:503,title:"Semaphore acquire timeout",suggestion:"Reduce concurrency or increase the semaphore acquire timeout"}),be=e({slug:"circuit-breaker-open",category:"SERVER",status:503,title:"Circuit breaker is open",suggestion:"Wait for the breaker reset timeout before retrying"}),Me=e({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),Ge=e({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),Pe=e({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Ve=e({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),ke=e({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),we=e({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),Fe=e({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),x={"port-in-use":Ne,"server-start-error":ve,"cache-error":Ce,"file-watch-error":Ae,"request-error":De,"service-overloaded":Le,"semaphore-timeout":Ue,"circuit-breaker-open":be,"cache-path-mismatch":Me,"network-error":Ge,"api-client-error":Pe,"token-storage-error":Ve,"cache-invariant-violation":ke,"release-not-found":we,"fallback-exhausted":Fe};var He=e({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),Ye=e({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),Be=e({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),$e=e({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),je=e({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),qe=e({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),S={"client-boundary-violation":He,"server-only-in-client":Ye,"client-only-in-server":Be,"invalid-use-client":$e,"invalid-use-server":je,"rsc-payload-error":qe};var ze=e({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),We=e({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),Je=e({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),Xe=e({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),Ke=e({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),N={"hmr-error":ze,"dev-server-error":We,"fast-refresh-error":Je,"error-overlay-error":Xe,"source-map-error":Ke};var Ze=e({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),Qe=e({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),et=e({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),tt=e({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),v={"deployment-error":Ze,"platform-error":Qe,"env-var-missing":et,"production-build-required":tt};var rt=e({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),ot=e({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),nt=e({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),st=e({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),it=e({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),at=e({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),ct=e({slug:"tool-id-conflict",category:"AGENT",status:409,title:"Tool ID conflict",suggestion:"Use a unique tool ID or rename one of the conflicting tools"}),C={"agent-error":rt,"agent-not-found":ot,"agent-timeout":nt,"agent-intent-error":st,"orchestration-error":it,"cost-limit-exceeded":at,"tool-id-conflict":ct};var ut=e({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),lt=e({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),gt=e({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),pt=e({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),dt=e({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),Et=e({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),Rt=e({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),ft=e({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),m=e({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),mt=e({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"}),A={"unknown-error":ut,"permission-denied":lt,"file-not-found":gt,"resource-not-found":pt,"invalid-argument":dt,"timeout-error":Et,"initialization-error":Rt,"not-supported":ft,"security-violation":m,"input-validation-failed":mt};var fr={...y,...I,...O,...T,...h,...x,...S,...N,...v,...C,...A};var _t=[{source:String.raw`<script[^>]*>[\\s\\S]*?<\\/script>`,flags:"gi",name:"inline script"},{source:String.raw`javascript:`,flags:"gi",name:"javascript: URL"},{source:String.raw`\\bon\\w+\\s*=`,flags:"gi",name:"event handler attribute"},{source:String.raw`data:\\s*text\\/html`,flags:"gi",name:"data: HTML URL"}];function yt(){return _t.map(({source:r,flags:t,name:o})=>({pattern:new RegExp(r,t),name:o}))}function It(){let r=globalThis;return r.__VERYFRONT_DEV__===!0||r.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function D(r,t={}){let{allowInlineScripts:o=!1,strict:n=!1,warn:i=!0}=t;for(let{pattern:c,name:u}of yt())if(!(o&&u==="inline script")&&(c.lastIndex=0,!!c.test(r)&&(i&&console.warn(`[Security] Suspicious ${u} detected in server HTML`),n||!It())))throw m.create({detail:`Potentially unsafe HTML: ${u} detected`});return r}var E=class{constructor(t,o){l(this,"prefix",t);l(this,"level",o)}log(t,o,n,...i){this.level>t||o?.(n,...i)}debug(t,...o){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${t}`,...o)}info(t,...o){this.log(1,console.log,`[${this.prefix}] ${t}`,...o)}warn(t,...o){this.log(2,console.warn,`[${this.prefix}] WARN: ${t}`,...o)}error(t,...o){this.log(3,console.error,`[${this.prefix}] ERROR: ${t}`,...o)}};function Ot(){if(typeof window>"u")return 2;let r=globalThis;return r.__VERYFRONT_DEV__||r.__RSC_DEV__?r.__VERYFRONT_DEBUG__||r.__RSC_DEBUG__?0:1:2}var R=Ot(),p=new E("RSC",R),br=new E("PREFETCH",R),Mr=new E("HYDRATE",R),Gr=new E("VERYFRONT",R);var s="/_veryfront",_={RSC:`${s}/rsc/`,FS:`${s}/fs/`,MODULES:`${s}/modules/`,PAGES:`${s}/pages/`,DATA:`${s}/data/`,LIB:`${s}/lib/`,CHUNKS:`${s}/chunks/`,CLIENT:`${s}/client/`},L={HMR_RUNTIME:`${s}/hmr-runtime.js`,HMR:`${s}/hmr.js`,ERROR_OVERLAY:`${s}/error-overlay.js`,DEV_LOADER:`${s}/dev-loader.js`,CLIENT_LOG:`${s}/log`,CLIENT_JS:`${s}/client.js`,ROUTER_JS:`${s}/router.js`,PREFETCH_JS:`${s}/prefetch.js`,MANIFEST_JSON:`${s}/manifest.json`,APP_JS:`${s}/app.js`,RSC_CLIENT:`${s}/rsc/client.js`,RSC_MANIFEST:`${s}/rsc/manifest`,RSC_STREAM:`${s}/rsc/stream`,RSC_PAYLOAD:`${s}/rsc/payload`,RSC_RENDER:`${s}/rsc/render`,RSC_PAGE:`${s}/rsc/page`,RSC_MODULE:`${s}/rsc/module`,RSC_DOM:`${s}/rsc/dom.js`,LIB_CHAT_REACT:`${s}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${s}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${s}/lib/chat/primitives.js`};var ht={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},Hr=ht.CACHE;var Yr={HMR_RUNTIME:L.HMR_RUNTIME,ERROR_OVERLAY:L.ERROR_OVERLAY};var qr=_.RSC,zr=_.FS;var U="rsc-root";function M(r,t){let o=t==="root"?U:`rsc-slot-${t}`,n=r.getElementById(o);if(n)return n;let i=r.createElement("div");return i.id=o,r.body.appendChild(i),i}function xt(r,t){if(t.type!=="slot")return;let o=M(r,t.id);o.innerHTML=D(String(t.html??""))}function b(r,t){let o=t.split(`\n`),n=o.pop()??"";for(let i of o){let c=i.trim();if(!c)continue;let u;try{u=JSON.parse(c)}catch(d){p.debug("[client-dom] malformed NDJSON line",{line:c,error:d instanceof Error?d.message:String(d)});continue}if(!u||typeof u!="object")continue;let g=u;if(g.type==="slot"){xt(r,g);try{vt(r,g.id||"root")}catch(d){p.debug("[client-dom] hydration optional failed",d)}}}return n}function St(r){return new Promise((t,o)=>{let n=()=>o(new DOMException("aborted","AbortError"));if(r.aborted){n();return}r.addEventListener("abort",n,{once:!0})})}async function Zr(r,t=document,o){let n="body"in r?r:null,i=n?.body??r;if(!i)return;let c=i.getReader(),u=new TextDecoder,g="",d=!1;try{for(;;){if(o?.aborted)throw new DOMException("aborted","AbortError");let a=c.read(),{done:G,value:P}=o?await Promise.race([a,St(o)]):await a;if(G){d=!0;break}g+=u.decode(P,{stream:!0}),g=b(t,g)}g&&b(t,`${g}\n`)}catch(a){throw a instanceof Error&&a.name==="AbortError"||p.debug("[client-dom] consumeNdjsonStream error",a),a}finally{try{await c.cancel()}catch(a){d||p.debug("[client-dom] reader.cancel failed",a)}try{c.releaseLock()}catch(a){p.debug("[client-dom] reader.releaseLock failed",a)}if(typeof i.cancel=="function")try{await i.cancel()}catch(a){p.debug("[client-dom] stream.cancel failed",a)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(a){p.debug("[client-dom] response.body.cancel failed",a)}}}function Nt(r,t){let o=M(r,t),n=[],i=c=>{let u=c;u.dataset?.clientRef&&n.push(u);for(let g of c.children)i(g)};return i(o),n}function vt(r,t){let o=Nt(r,t);for(let n of o){let i=n.dataset?.clientRef;i&&(n.dataset.hydrated="true",p.debug("[client-dom] marked for hydration",i))}}export{Zr as consumeNdjsonStream,M as getContainer};\n';
@@ -1,5 +1,13 @@
1
- /** Encode a UTF-8 string as standard base64 (handles non-Latin1 input). */
1
+ /**
2
+ * Encode a string as standard base64. Latin-1 input (all code points <= 0xFF)
3
+ * is encoded with btoa's binary-string semantics; input outside Latin-1 falls
4
+ * back to UTF-8 bytes. Callers that need guaranteed UTF-8 bytes regardless of
5
+ * input (e.g. data: URLs decoded as UTF-8) should use
6
+ * `encodeBase64Bytes(new TextEncoder().encode(value))` instead.
7
+ */
2
8
  export declare function encodeBase64(value: string): string;
9
+ /** Encode raw bytes as standard base64. */
10
+ export declare function encodeBase64Bytes(bytes: Uint8Array): string;
3
11
  /** Encode a string as unpadded base64url. */
4
12
  export declare function base64urlEncode(input: string): string;
5
13
  /** Encode raw bytes as unpadded base64url. */
@@ -1 +1 @@
1
- {"version":3,"file":"base64url.d.ts","sourceRoot":"","sources":["../../../src/src/utils/base64url.ts"],"names":[],"mappings":"AAYA,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAkBlD;AAED,6CAA6C;AAC7C,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,8CAA8C;AAC9C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAI9D"}
1
+ {"version":3,"file":"base64url.d.ts","sourceRoot":"","sources":["../../../src/src/utils/base64url.ts"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAelD;AAED,2CAA2C;AAC3C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAa3D;AAED,6CAA6C;AAC7C,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,8CAA8C;AAC9C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE9D"}
@@ -5,19 +5,21 @@ import * as dntShim from "../../_dnt.shims.js";
5
5
  function toBase64Url(b64) {
6
6
  return b64.replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
7
7
  }
8
- /** Encode a UTF-8 string as standard base64 (handles non-Latin1 input). */
8
+ /**
9
+ * Encode a string as standard base64. Latin-1 input (all code points <= 0xFF)
10
+ * is encoded with btoa's binary-string semantics; input outside Latin-1 falls
11
+ * back to UTF-8 bytes. Callers that need guaranteed UTF-8 bytes regardless of
12
+ * input (e.g. data: URLs decoded as UTF-8) should use
13
+ * `encodeBase64Bytes(new TextEncoder().encode(value))` instead.
14
+ */
9
15
  export function encodeBase64(value) {
10
16
  if (typeof globalThis.btoa === "function") {
11
17
  try {
12
18
  return globalThis.btoa(value);
13
19
  }
14
20
  catch (_) {
15
- /* expected: non-Latin1 string — fall back to TextEncoder */
16
- const bytes = new TextEncoder().encode(value);
17
- let binary = "";
18
- for (const byte of bytes)
19
- binary += String.fromCharCode(byte);
20
- return globalThis.btoa(binary);
21
+ /* expected: non-Latin1 string — fall back to UTF-8 bytes */
22
+ return encodeBase64Bytes(new TextEncoder().encode(value));
21
23
  }
22
24
  }
23
25
  const bufferCtor = dntShim.dntGlobalThis.Buffer;
@@ -26,14 +28,26 @@ export function encodeBase64(value) {
26
28
  // This file ships in client bundles — keep it dependency-free (no error registry).
27
29
  throw new Error("Base64 encoding is not supported in this runtime");
28
30
  }
31
+ /** Encode raw bytes as standard base64. */
32
+ export function encodeBase64Bytes(bytes) {
33
+ // Prefer Buffer where available (Node): avoids building a large intermediate
34
+ // binary string, which is slower and can hit maximum-string-size limits.
35
+ const bufferCtor = dntShim.dntGlobalThis.Buffer;
36
+ if (bufferCtor)
37
+ return bufferCtor.from(bytes).toString("base64");
38
+ if (typeof globalThis.btoa === "function") {
39
+ let binary = "";
40
+ for (const byte of bytes)
41
+ binary += String.fromCharCode(byte);
42
+ return globalThis.btoa(binary);
43
+ }
44
+ throw new Error("Base64 encoding is not supported in this runtime");
45
+ }
29
46
  /** Encode a string as unpadded base64url. */
30
47
  export function base64urlEncode(input) {
31
48
  return toBase64Url(encodeBase64(input));
32
49
  }
33
50
  /** Encode raw bytes as unpadded base64url. */
34
51
  export function base64urlEncodeBytes(bytes) {
35
- let binary = "";
36
- for (const byte of bytes)
37
- binary += String.fromCharCode(byte);
38
- return toBase64Url(btoa(binary));
52
+ return toBase64Url(encodeBase64Bytes(bytes));
39
53
  }
@@ -18,8 +18,9 @@ export { redactSensitive, sanitizeUrlCredentials, sanitizeUrlForSpan } from "./l
18
18
  export { BREAKPOINT_LG, BREAKPOINT_MD, BREAKPOINT_SM, BREAKPOINT_XL, BYTES_PER_KB, DEFAULT_ALLOWED_CDN_HOSTS, DEFAULT_BUILD_CONCURRENCY, DEFAULT_DASHBOARD_PORT, DEFAULT_LRU_MAX_ENTRIES, DEV_SERVER_ENDPOINTS, FORBIDDEN_PATH_PATTERNS, getDenoStdNodeBase, getReactImportMap, HASH_SEED_DJB2, HASH_SEED_FNV1A, HMR_CLIENT_RELOAD_DELAY_MS, HMR_CLOSE_MESSAGE_TOO_LARGE, HMR_CLOSE_NORMAL, HMR_CLOSE_RATE_LIMIT, HMR_MAX_MESSAGE_SIZE_BYTES, HMR_MAX_MESSAGES_PER_MINUTE, HMR_RATE_LIMIT_WINDOW_MS, HTTP_BAD_REQUEST, HTTP_CONTENT_TYPE_IMAGE_GIF, HTTP_CONTENT_TYPE_IMAGE_ICO, HTTP_CONTENT_TYPE_IMAGE_JPEG, HTTP_CONTENT_TYPE_IMAGE_PNG, HTTP_CONTENT_TYPE_IMAGE_SVG, HTTP_CONTENT_TYPE_IMAGE_WEBP, HTTP_CONTENT_TYPES, HTTP_MODULE_FETCH_TIMEOUT_MS, HTTP_NETWORK_CONNECT_TIMEOUT, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_OK, HTTP_REDIRECT_FOUND, HTTP_SERVER_ERROR, HTTP_STATUS_CLIENT_ERROR_MIN, HTTP_STATUS_REDIRECT_MIN, HTTP_STATUS_SERVER_ERROR_MIN, HTTP_STATUS_SUCCESS_MIN, HTTP_UNAVAILABLE, IMAGE_OPTIMIZATION, MAX_BATCH_SIZE, MAX_PATH_LENGTH, MAX_PATH_TRAVERSAL_DEPTH, MS_PER_SECOND, PREFETCH_DEFAULT_DELAY_MS, PREFETCH_DEFAULT_TIMEOUT_MS, PREFETCH_MAX_SIZE_BYTES, REACT_DEFAULT_VERSION, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, RSC_MANIFEST_CACHE_TTL_MS, TSX_LAYOUT_MAX_ENTRIES, TSX_LAYOUT_PER_PROJECT_MAX_ENTRIES, Z_INDEX_DEV_INDICATOR, Z_INDEX_ERROR_OVERLAY, } from "./constants/index.js";
19
19
  export { VERSION } from "./version.js";
20
20
  export { type BundleCode as HashBundleCode, computeCodeHash, computeHash, computeHashBytes, fnv1aHash, shortHash, simpleHash, } from "./hash-utils.js";
21
- export { base64urlEncode, base64urlEncodeBytes, encodeBase64 } from "./base64url.js";
21
+ export { base64urlEncode, base64urlEncodeBytes, encodeBase64, encodeBase64Bytes, } from "./base64url.js";
22
22
  export { sleep } from "./sleep.js";
23
+ export { createSubscriberSet, type SubscriberSet } from "./subscriber-set.js";
23
24
  export { MemoCache, memoize, memoizeAsync, simpleHash as memoizeHash } from "./memoize.js";
24
25
  export { normalizePath } from "./path-utils.js";
25
26
  export { type BundleCode, type BundleMetadata, getBundleManifestStore } from "./bundle-manifest.js";
@@ -28,4 +29,5 @@ export { isCompiledBinary } from "./platform.js";
28
29
  export { computeIntegrity, createLockfileManager, type LockfileManager, } from "./import-lockfile.js";
29
30
  export { endRequest, isEnabled, startRequest, startTimer, timeAsync } from "./perf-timer.js";
30
31
  export { parallelMap } from "./parallel.js";
32
+ export { safeJsonParse, type SafeJsonParseResult } from "./json.js";
31
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,aAAa,EACb,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,IAAI,0BAA0B,EAC1D,WAAW,EACX,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEjG,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,2BAA2B,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,gBAAgB,EAChB,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,kBAAkB,EAClB,4BAA4B,EAC5B,4BAA4B,EAC5B,cAAc,EACd,oBAAoB,EACpB,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,kCAAkC,EAClC,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EACL,KAAK,UAAU,IAAI,cAAc,EACjC,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAErF,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3F,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEpG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,aAAa,EACb,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,IAAI,0BAA0B,EAC1D,WAAW,EACX,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEjG,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,2BAA2B,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,gBAAgB,EAChB,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC5B,kBAAkB,EAClB,4BAA4B,EAC5B,4BAA4B,EAC5B,cAAc,EACd,oBAAoB,EACpB,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,kCAAkC,EAClC,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EACL,KAAK,UAAU,IAAI,cAAc,EACjC,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3F,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEpG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
@@ -18,8 +18,9 @@ export { redactSensitive, sanitizeUrlCredentials, sanitizeUrlForSpan } from "./l
18
18
  export { BREAKPOINT_LG, BREAKPOINT_MD, BREAKPOINT_SM, BREAKPOINT_XL, BYTES_PER_KB, DEFAULT_ALLOWED_CDN_HOSTS, DEFAULT_BUILD_CONCURRENCY, DEFAULT_DASHBOARD_PORT, DEFAULT_LRU_MAX_ENTRIES, DEV_SERVER_ENDPOINTS, FORBIDDEN_PATH_PATTERNS, getDenoStdNodeBase, getReactImportMap, HASH_SEED_DJB2, HASH_SEED_FNV1A, HMR_CLIENT_RELOAD_DELAY_MS, HMR_CLOSE_MESSAGE_TOO_LARGE, HMR_CLOSE_NORMAL, HMR_CLOSE_RATE_LIMIT, HMR_MAX_MESSAGE_SIZE_BYTES, HMR_MAX_MESSAGES_PER_MINUTE, HMR_RATE_LIMIT_WINDOW_MS, HTTP_BAD_REQUEST, HTTP_CONTENT_TYPE_IMAGE_GIF, HTTP_CONTENT_TYPE_IMAGE_ICO, HTTP_CONTENT_TYPE_IMAGE_JPEG, HTTP_CONTENT_TYPE_IMAGE_PNG, HTTP_CONTENT_TYPE_IMAGE_SVG, HTTP_CONTENT_TYPE_IMAGE_WEBP, HTTP_CONTENT_TYPES, HTTP_MODULE_FETCH_TIMEOUT_MS, HTTP_NETWORK_CONNECT_TIMEOUT, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_OK, HTTP_REDIRECT_FOUND, HTTP_SERVER_ERROR, HTTP_STATUS_CLIENT_ERROR_MIN, HTTP_STATUS_REDIRECT_MIN, HTTP_STATUS_SERVER_ERROR_MIN, HTTP_STATUS_SUCCESS_MIN, HTTP_UNAVAILABLE, IMAGE_OPTIMIZATION, MAX_BATCH_SIZE, MAX_PATH_LENGTH, MAX_PATH_TRAVERSAL_DEPTH, MS_PER_SECOND, PREFETCH_DEFAULT_DELAY_MS, PREFETCH_DEFAULT_TIMEOUT_MS, PREFETCH_MAX_SIZE_BYTES, REACT_DEFAULT_VERSION, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, RSC_MANIFEST_CACHE_TTL_MS, TSX_LAYOUT_MAX_ENTRIES, TSX_LAYOUT_PER_PROJECT_MAX_ENTRIES, Z_INDEX_DEV_INDICATOR, Z_INDEX_ERROR_OVERLAY, } from "./constants/index.js";
19
19
  export { VERSION } from "./version.js";
20
20
  export { computeCodeHash, computeHash, computeHashBytes, fnv1aHash, shortHash, simpleHash, } from "./hash-utils.js";
21
- export { base64urlEncode, base64urlEncodeBytes, encodeBase64 } from "./base64url.js";
21
+ export { base64urlEncode, base64urlEncodeBytes, encodeBase64, encodeBase64Bytes, } from "./base64url.js";
22
22
  export { sleep } from "./sleep.js";
23
+ export { createSubscriberSet } from "./subscriber-set.js";
23
24
  export { MemoCache, memoize, memoizeAsync, simpleHash as memoizeHash } from "./memoize.js";
24
25
  export { normalizePath } from "./path-utils.js";
25
26
  export { getBundleManifestStore } from "./bundle-manifest.js";
@@ -28,3 +29,4 @@ export { isCompiledBinary } from "./platform.js";
28
29
  export { computeIntegrity, createLockfileManager, } from "./import-lockfile.js";
29
30
  export { endRequest, isEnabled, startRequest, startTimer, timeAsync } from "./perf-timer.js";
30
31
  export { parallelMap } from "./parallel.js";
32
+ export { safeJsonParse } from "./json.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Safe JSON parse utilities, dependency-free.
3
+ *
4
+ * @module utils/json
5
+ */
6
+ /** Tagged-union result of {@link safeJsonParse}; narrow via the `ok` discriminant. */
7
+ export type SafeJsonParseResult<T = unknown> = {
8
+ ok: true;
9
+ value: T;
10
+ } | {
11
+ ok: false;
12
+ error: Error;
13
+ };
14
+ /**
15
+ * Parse `value` as JSON without throwing; failures return `{ ok: false, error }`
16
+ * so callers handle them without a surrounding try/catch.
17
+ */
18
+ export declare function safeJsonParse<T = unknown>(value: string): SafeJsonParseResult<T>;
19
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/src/utils/json.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sFAAsF;AACtF,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IACvC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACtB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEhC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAMhF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Safe JSON parse utilities, dependency-free.
3
+ *
4
+ * @module utils/json
5
+ */
6
+ /**
7
+ * Parse `value` as JSON without throwing; failures return `{ ok: false, error }`
8
+ * so callers handle them without a surrounding try/catch.
9
+ */
10
+ export function safeJsonParse(value) {
11
+ try {
12
+ return { ok: true, value: JSON.parse(value) };
13
+ }
14
+ catch (error) {
15
+ return { ok: false, error: error instanceof Error ? error : new Error(String(error)) };
16
+ }
17
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,6DAA6D;AAC7D,eAAO,MAAM,QAAQ,eAAe,CAAC;AA8CrC;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAcnD;AA6ED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAEhD;AA2BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA4B5D;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgBxD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,CAAC,SAAS;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,EAC5D,KAAK,EAAE,CAAC,GAAG,CAAC,CAMb"}
1
+ {"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,6DAA6D;AAC7D,eAAO,MAAM,QAAQ,eAAe,CAAC;AAmDrC;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAcnD;AA6ED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAEhD;AA6BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAyB5D;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgBxD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,CAAC,SAAS;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,EAC5D,KAAK,EAAE,CAAC,GAAG,CAAC,CAMb"}
@@ -19,6 +19,10 @@
19
19
  import { isRecord } from "./core.js";
20
20
  /** Replacement value substituted for any sensitive field. */
21
21
  export const REDACTED = "[REDACTED]";
22
+ /** Strip all non-alphanumeric characters and lowercase, used for key normalization. */
23
+ function normalizeToAlphanumeric(s) {
24
+ return s.toLowerCase().replace(/[^a-z0-9]/g, "");
25
+ }
22
26
  /**
23
27
  * Normalized substrings that mark a key as sensitive. Matching is done against
24
28
  * a lowercased, non-alphanumeric-stripped form of the key, so `API-Key`,
@@ -72,7 +76,7 @@ export function isSensitiveKey(key) {
72
76
  const cached = sensitiveKeyCache.get(key);
73
77
  if (cached !== undefined)
74
78
  return cached;
75
- const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
79
+ const normalized = normalizeToAlphanumeric(key);
76
80
  const sensitive = SENSITIVE_KEY_PATTERNS.some((pattern) => normalized.includes(pattern));
77
81
  if (sensitiveKeyCache.size >= SENSITIVE_KEY_CACHE_MAX_SIZE) {
78
82
  const oldestKey = sensitiveKeyCache.keys().next().value;
@@ -191,6 +195,7 @@ const SENSITIVE_URL_PARAMS = [
191
195
  "signature",
192
196
  "auth",
193
197
  ];
198
+ const NORMALIZED_SENSITIVE_URL_PARAMS = new Set(SENSITIVE_URL_PARAMS.map(normalizeToAlphanumeric));
194
199
  const URL_USERINFO_RE = /(\b[a-z][a-z0-9+.-]*:\/\/)([^/?#@\s]+)@/gi;
195
200
  /**
196
201
  * Strip credentials from URL-shaped strings so they can be safely emitted in
@@ -222,8 +227,7 @@ export function sanitizeUrlCredentials(input) {
222
227
  // 2) sensitive query/fragment params: `key=value` → `key=[REDACTED]`.
223
228
  // Match `?key=`, `&key=`, `;key=` separators and stop at the next delimiter.
224
229
  out = out.replace(/([?&;])([a-z0-9_.\-]+)=([^&#;\s]*)/gi, (match, sep, key, _val) => {
225
- const normalized = key.toLowerCase().replace(/[^a-z0-9]/g, "");
226
- const sensitive = SENSITIVE_URL_PARAMS.some((p) => normalized === p.replace(/[^a-z0-9]/g, ""));
230
+ const sensitive = NORMALIZED_SENSITIVE_URL_PARAMS.has(normalizeToAlphanumeric(key));
227
231
  return sensitive ? `${sep}${key}=${REDACTED}` : match;
228
232
  });
229
233
  return out;
@@ -0,0 +1,19 @@
1
+ /** Listener registry returned by {@link createSubscriberSet}. */
2
+ export interface SubscriberSet<Args extends unknown[] = []> {
3
+ /** Register a listener; returns its unsubscribe function. */
4
+ subscribe(listener: (...args: Args) => void): () => void;
5
+ /** Invoke every listener; a throwing listener never stops the others. */
6
+ notify(...args: Args): void;
7
+ /** Number of registered listeners. */
8
+ readonly size: number;
9
+ /** Remove all listeners. */
10
+ clear(): void;
11
+ }
12
+ /**
13
+ * Create a subscriber set: the canonical subscribe/notify observable used
14
+ * across modules. Notification iterates a snapshot, so a listener that
15
+ * unsubscribes (itself or others) mid-notify is safe, and listener errors are
16
+ * isolated (routed to `onListenerError` when provided, otherwise swallowed).
17
+ */
18
+ export declare function createSubscriberSet<Args extends unknown[] = []>(onListenerError?: (error: unknown) => void): SubscriberSet<Args>;
19
+ //# sourceMappingURL=subscriber-set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriber-set.d.ts","sourceRoot":"","sources":["../../../src/src/utils/subscriber-set.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,WAAW,aAAa,CAAC,IAAI,SAAS,OAAO,EAAE,GAAG,EAAE;IACxD,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACzD,yEAAyE;IACzE,MAAM,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,SAAS,OAAO,EAAE,GAAG,EAAE,EAC7D,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACzC,aAAa,CAAC,IAAI,CAAC,CA8BrB"}