veryfront 0.1.1120 → 0.1.1122

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 (111) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/src/agent/input/human-input.d.ts.map +1 -1
  3. package/esm/src/agent/input/human-input.js +2 -6
  4. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  5. package/esm/src/agent/runtime/index.js +1 -0
  6. package/esm/src/agent/service/detached-run-tracker.d.ts.map +1 -1
  7. package/esm/src/agent/service/detached-run-tracker.js +1 -5
  8. package/esm/src/agent/service/registration.d.ts.map +1 -1
  9. package/esm/src/agent/service/registration.js +2 -6
  10. package/esm/src/build/bundler/code-splitter/manifest-builder.d.ts +4 -0
  11. package/esm/src/build/bundler/code-splitter/manifest-builder.d.ts.map +1 -1
  12. package/esm/src/build/bundler/code-splitter/manifest-builder.js +2 -5
  13. package/esm/src/build/production-build/local-release-assets.js +2 -2
  14. package/esm/src/discovery/transpiler.d.ts.map +1 -1
  15. package/esm/src/discovery/transpiler.js +4 -8
  16. package/esm/src/errors/error-handlers.d.ts +31 -3
  17. package/esm/src/errors/error-handlers.d.ts.map +1 -1
  18. package/esm/src/errors/error-handlers.js +33 -12
  19. package/esm/src/errors/index.d.ts +1 -1
  20. package/esm/src/errors/index.d.ts.map +1 -1
  21. package/esm/src/eval/agent-service/durable-run-canaries/runner.d.ts.map +1 -1
  22. package/esm/src/eval/agent-service/durable-run-canaries/runner.js +1 -5
  23. package/esm/src/eval/agent-service/live-evals/api-client.d.ts.map +1 -1
  24. package/esm/src/eval/agent-service/live-evals/api-client.js +3 -4
  25. package/esm/src/eval/provenance.d.ts.map +1 -1
  26. package/esm/src/eval/provenance.js +3 -13
  27. package/esm/src/eval/report.d.ts.map +1 -1
  28. package/esm/src/eval/report.js +2 -8
  29. package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
  30. package/esm/src/html/styles-builder/plugin-loader.js +2 -13
  31. package/esm/src/knowledge/index.d.ts.map +1 -1
  32. package/esm/src/knowledge/index.js +2 -5
  33. package/esm/src/metrics/index.d.ts.map +1 -1
  34. package/esm/src/metrics/index.js +2 -1
  35. package/esm/src/oauth/providers/base.d.ts.map +1 -1
  36. package/esm/src/oauth/providers/base.js +2 -6
  37. package/esm/src/platform/adapters/fs/github/github-api-client.d.ts +0 -1
  38. package/esm/src/platform/adapters/fs/github/github-api-client.d.ts.map +1 -1
  39. package/esm/src/platform/adapters/fs/github/github-api-client.js +36 -37
  40. package/esm/src/platform/adapters/fs/veryfront/retry.d.ts.map +1 -1
  41. package/esm/src/platform/adapters/fs/veryfront/retry.js +12 -14
  42. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.d.ts.map +1 -1
  43. package/esm/src/platform/adapters/veryfront-api-client/retry-handler.js +82 -86
  44. package/esm/src/proxy/logger.d.ts +2 -1
  45. package/esm/src/proxy/logger.d.ts.map +1 -1
  46. package/esm/src/proxy/logger.js +1 -112
  47. package/esm/src/proxy/routing-invalidation-redis.d.ts.map +1 -1
  48. package/esm/src/proxy/routing-invalidation-redis.js +2 -5
  49. package/esm/src/proxy/server-resolver.d.ts.map +1 -1
  50. package/esm/src/proxy/server-resolver.js +2 -1
  51. package/esm/src/release-assets/build-executor.js +5 -5
  52. package/esm/src/release-assets/index.d.ts +0 -1
  53. package/esm/src/release-assets/index.d.ts.map +1 -1
  54. package/esm/src/release-assets/index.js +0 -1
  55. package/esm/src/rendering/orchestrator/module-loader/cache.d.ts +9 -0
  56. package/esm/src/rendering/orchestrator/module-loader/cache.d.ts.map +1 -1
  57. package/esm/src/rendering/orchestrator/module-loader/cache.js +2 -11
  58. package/esm/src/routing/api/module-loader/esbuild-plugin.d.ts.map +1 -1
  59. package/esm/src/routing/api/module-loader/esbuild-plugin.js +2 -5
  60. package/esm/src/sandbox/lazy-sandbox.js +4 -4
  61. package/esm/src/security/http/auth.d.ts.map +1 -1
  62. package/esm/src/security/http/auth.js +1 -24
  63. package/esm/src/server/handlers/studio/bridge-modules.handler.d.ts.map +1 -1
  64. package/esm/src/server/handlers/studio/bridge-modules.handler.js +2 -5
  65. package/esm/src/server/project-env/fetcher.js +2 -2
  66. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
  67. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
  68. package/esm/src/server/services/rsc/orchestrators/stream-handler.js +1 -4
  69. package/esm/src/transforms/esm/transform-utils.d.ts.map +1 -1
  70. package/esm/src/transforms/esm/transform-utils.js +2 -1
  71. package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts.map +1 -1
  72. package/esm/src/transforms/mdx/compiler/import-rewriter.js +2 -1
  73. package/esm/src/transforms/pipeline/stages/resolve-imports.d.ts.map +1 -1
  74. package/esm/src/transforms/pipeline/stages/resolve-imports.js +3 -1
  75. package/esm/src/utils/base64url.d.ts +4 -3
  76. package/esm/src/utils/base64url.d.ts.map +1 -1
  77. package/esm/src/utils/base64url.js +30 -3
  78. package/esm/src/utils/hash-utils.d.ts +4 -1
  79. package/esm/src/utils/hash-utils.d.ts.map +1 -1
  80. package/esm/src/utils/hash-utils.js +9 -3
  81. package/esm/src/utils/index.d.ts +3 -1
  82. package/esm/src/utils/index.d.ts.map +1 -1
  83. package/esm/src/utils/index.js +3 -1
  84. package/esm/src/utils/sleep.d.ts +3 -0
  85. package/esm/src/utils/sleep.d.ts.map +1 -0
  86. package/esm/src/utils/sleep.js +18 -0
  87. package/esm/src/utils/version-constant.d.ts +1 -1
  88. package/esm/src/utils/version-constant.js +1 -1
  89. package/esm/src/workflow/claude-code/workspace-sync.d.ts.map +1 -1
  90. package/esm/src/workflow/claude-code/workspace-sync.js +3 -13
  91. package/esm/src/workflow/executor/dag/composite-node-execution.d.ts.map +1 -1
  92. package/esm/src/workflow/executor/dag/composite-node-execution.js +3 -24
  93. package/esm/src/workflow/executor/dag/loop-node-strategy.js +1 -1
  94. package/esm/src/workflow/executor/dag/utils.d.ts +0 -1
  95. package/esm/src/workflow/executor/dag/utils.d.ts.map +1 -1
  96. package/esm/src/workflow/executor/dag/utils.js +0 -17
  97. package/esm/src/workflow/executor/retry-policy.d.ts +13 -0
  98. package/esm/src/workflow/executor/retry-policy.d.ts.map +1 -0
  99. package/esm/src/workflow/executor/retry-policy.js +44 -0
  100. package/esm/src/workflow/executor/step-executor.d.ts +1 -11
  101. package/esm/src/workflow/executor/step-executor.d.ts.map +1 -1
  102. package/esm/src/workflow/executor/step-executor.js +6 -57
  103. package/esm/src/workflow/executor/workflow-executor.d.ts.map +1 -1
  104. package/esm/src/workflow/executor/workflow-executor.js +2 -3
  105. package/esm/src/workflow/worker/workflow-worker.d.ts +0 -4
  106. package/esm/src/workflow/worker/workflow-worker.d.ts.map +1 -1
  107. package/esm/src/workflow/worker/workflow-worker.js +2 -9
  108. package/package.json +5 -5
  109. package/esm/src/release-assets/hash.d.ts +0 -14
  110. package/esm/src/release-assets/hash.d.ts.map +0 -1
  111. package/esm/src/release-assets/hash.js +0 -22
@@ -1,6 +1,7 @@
1
1
  import * as dntShim from "../../_dnt.shims.js";
2
2
  import { getRedisModule } from "../platform/adapters/redis/modules.js";
3
3
  import { getEnv } from "../platform/compat/process.js";
4
+ import { base64urlEncodeBytes } from "../utils/index.js";
4
5
  const ROUTING_INVALIDATION_CHANNEL = "vf-proxy-routing-invalidations-v1";
5
6
  const ROUTING_INVALIDATION_ACK_PREFIX = `${ROUTING_INVALIDATION_CHANNEL}:ack:`;
6
7
  const DEFAULT_ACKNOWLEDGEMENT_TIMEOUT_MS = 1_500;
@@ -54,10 +55,6 @@ function signatureInput(domain, issuedAtMs, payload) {
54
55
  const encoded = new TextEncoder().encode(`${signatureDomainPrefix(domain)}\0${issuedAtMs}\0${payload}`);
55
56
  return encoded.buffer.slice(encoded.byteOffset, encoded.byteOffset + encoded.byteLength);
56
57
  }
57
- function base64UrlEncode(bytes) {
58
- const binary = Array.from(new Uint8Array(bytes), (byte) => String.fromCharCode(byte)).join("");
59
- return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/u, "");
60
- }
61
58
  function base64UrlDecode(value) {
62
59
  if (!/^[A-Za-z0-9_-]+$/u.test(value))
63
60
  return null;
@@ -73,7 +70,7 @@ async function createHmacKey(secret) {
73
70
  return dntShim.crypto.subtle.importKey("raw", new TextEncoder().encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["sign", "verify"]);
74
71
  }
75
72
  async function signPayload(key, domain, issuedAtMs, payload) {
76
- return base64UrlEncode(await dntShim.crypto.subtle.sign("HMAC", key, signatureInput(domain, issuedAtMs, payload)));
73
+ return base64urlEncodeBytes(new Uint8Array(await dntShim.crypto.subtle.sign("HMAC", key, signatureInput(domain, issuedAtMs, payload))));
77
74
  }
78
75
  async function verifyPayloadSignature(key, domain, issuedAtMs, payload, signature) {
79
76
  const signatureBytes = base64UrlDecode(signature);
@@ -1 +1 @@
1
- {"version":3,"file":"server-resolver.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/server-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA0BH,qBAAa,cAAc;IAMvB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IARpB,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,OAAO,CAAsD;IACrE,OAAO,CAAC,YAAY,CAA+C;gBAGzD,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAAe;IAQrC;;OAEG;IACG,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAwCxE,KAAK,IAAI,IAAI;IAQb;;;;OAIG;YACW,WAAW;IAmCzB,OAAO,CAAC,OAAO;CAMhB"}
1
+ {"version":3,"file":"server-resolver.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/server-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA2BH,qBAAa,cAAc;IAMvB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IARpB,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,OAAO,CAAsD;IACrE,OAAO,CAAC,YAAY,CAA+C;gBAGzD,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAAe;IAQrC;;OAEG;IACG,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAwCxE,KAAK,IAAI,IAAI;IAQb;;;;OAIG;YACW,WAAW;IAmCzB,OAAO,CAAC,OAAO;CAMhB"}
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import { proxyLogger } from "./logger.js";
11
11
  import { unrefTimer } from "../platform/compat/process.js";
12
+ import { encodeBase64 } from "../utils/index.js";
12
13
  const logger = proxyLogger.child({ module: "server-resolver" });
13
14
  /** Thrown when the API call fails (network error, non-OK status, parse error). */
14
15
  class ServerResolverError extends Error {
@@ -91,7 +92,7 @@ export class ServerResolver {
91
92
  const url = `${this.apiInternalUrl}/internal/environment-server?environmentId=${encodeURIComponent(environmentId)}`;
92
93
  const headers = { Accept: "application/json" };
93
94
  if (this.apiUser && this.apiPass) {
94
- headers.Authorization = `Basic ${btoa(`${this.apiUser}:${this.apiPass}`)}`;
95
+ headers.Authorization = `Basic ${encodeBase64(`${this.apiUser}:${this.apiPass}`)}`;
95
96
  }
96
97
  let response;
97
98
  try {
@@ -36,7 +36,7 @@ import { getEsbuildLoader } from "../utils/path-utils.js";
36
36
  import { extractCandidatesFromFiles } from "../html/styles-builder/candidate-extractor.js";
37
37
  import { validatePathSync } from "../security/path-validation.js";
38
38
  import { collectCssImportPaths, CSS_IMPORTING_SOURCE_EXTENSIONS, } from "../html/styles-builder/css-import-extraction.js";
39
- import { sha256HexBytes } from "./hash.js";
39
+ import { computeHashBytes } from "../utils/index.js";
40
40
  import { RELEASE_ASSET_BASE_PATH, RELEASE_ASSET_CONTENT_TYPES, RELEASE_ASSET_DEPENDENCY_IMPORT_MAP_ENV_FLAG, RELEASE_ASSET_MANIFEST_SCHEMA_VERSION, RELEASE_ASSET_MAX_SIZE_BYTES, RELEASE_ASSET_UPLOAD_CONCURRENCY, releaseAssetUrl, } from "./constants.js";
41
41
  import { routeForPage } from "./route-path.js";
42
42
  export { routeForPage } from "./route-path.js";
@@ -792,7 +792,7 @@ async function addPreparedJavaScriptAsset(logicalPath, code, uploadQueue, pendin
792
792
  const bytes = new TextEncoder().encode(code);
793
793
  if (bytes.byteLength > RELEASE_ASSET_MAX_SIZE_BYTES)
794
794
  return null;
795
- const contentHash = await sha256HexBytes(bytes);
795
+ const contentHash = await computeHashBytes(bytes);
796
796
  const entry = {
797
797
  logicalPath,
798
798
  contentHash,
@@ -1216,7 +1216,7 @@ async function runBuildInner(input, tempDir, client, transform) {
1216
1216
  });
1217
1217
  if (compiled && compiled.css) {
1218
1218
  const bytes = new TextEncoder().encode(compiled.css);
1219
- const contentHash = await sha256HexBytes(bytes);
1219
+ const contentHash = await computeHashBytes(bytes);
1220
1220
  css.push({
1221
1221
  contentHash,
1222
1222
  size: bytes.byteLength,
@@ -1288,7 +1288,7 @@ async function runBuildInner(input, tempDir, client, transform) {
1288
1288
  routes[route] = { modules: manifestedModules, css: cssHashes };
1289
1289
  }
1290
1290
  // 6. Assemble and PUT the manifest.
1291
- const sourceContentHash = await sha256HexBytes(new TextEncoder().encode([...sourceByPath.keys()].sort().join("\n")));
1291
+ const sourceContentHash = await computeHashBytes(new TextEncoder().encode([...sourceByPath.keys()].sort().join("\n")));
1292
1292
  const manifest = {
1293
1293
  schemaVersion: RELEASE_ASSET_MANIFEST_SCHEMA_VERSION,
1294
1294
  projectId: input.projectId,
@@ -1423,7 +1423,7 @@ async function releaseFileSetSignature(sourceByPath) {
1423
1423
  .sort(([left], [right]) => left.localeCompare(right))
1424
1424
  .map(([path, content]) => `${path}${separator}${content}`)
1425
1425
  .join(separator);
1426
- return await sha256HexBytes(new TextEncoder().encode(serialized));
1426
+ return await computeHashBytes(new TextEncoder().encode(serialized));
1427
1427
  }
1428
1428
  async function resolveReleaseConfigFromSourceFiles(sourceByPath, input, tempDir) {
1429
1429
  const releaseSignature = await releaseFileSetSignature(sourceByPath);
@@ -4,7 +4,6 @@
4
4
  * @module release-assets
5
5
  */
6
6
  export { contentTypeForExtension, isAllowedReleaseAssetContentType, isValidContentHash, RELEASE_ASSET_BASE_PATH, RELEASE_ASSET_CONTENT_TYPE_ALLOWLIST, RELEASE_ASSET_CONTENT_TYPES, RELEASE_ASSET_IMMUTABLE_MAX_AGE_SECONDS, RELEASE_ASSET_MANIFEST_ENV_FLAG, RELEASE_ASSET_MANIFEST_SCHEMA_VERSION, RELEASE_ASSET_MAX_SIZE_BYTES, RELEASE_ASSET_UPLOAD_CONCURRENCY, type ReleaseAssetContentType, type ReleaseAssetExtension, releaseAssetUrl, } from "./constants.js";
7
- export { sha256Hex, sha256HexBytes } from "./hash.js";
8
7
  export { getReleaseAssetManifestSchema, parseReleaseAssetManifest, type ReleaseAssetCssEntry, type ReleaseAssetEntry, type ReleaseAssetManifest, type ReleaseAssetManifestResponse, type ReleaseAssetManifestState, type ReleaseAssetRouteEntry, } from "./manifest-schema.js";
9
8
  export { clearReleaseAssetManifestCache, configureReleaseAssetManifestFetcher, getReadyManifestForRender, isReleaseAssetManifestEnabled, registerManifestFetcherForRelease, type ReleaseAssetManifestFetcher, unregisterManifestFetcherForRelease, } from "./manifest-cache.js";
10
9
  export { normalizeManifestModuleKey, resolveManifestModuleUrl, resolveManifestRoutePreloadUrls, } from "./html-consumption.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,kBAAkB,EAClB,uBAAuB,EACvB,oCAAoC,EACpC,2BAA2B,EAC3B,uCAAuC,EACvC,+BAA+B,EAC/B,qCAAqC,EACrC,4BAA4B,EAC5B,gCAAgC,EAChC,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,KAAK,2BAA2B,EAChC,mCAAmC,GACpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,uBAAuB,GACxB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,kBAAkB,EAClB,uBAAuB,EACvB,oCAAoC,EACpC,2BAA2B,EAC3B,uCAAuC,EACvC,+BAA+B,EAC/B,qCAAqC,EACrC,4BAA4B,EAC5B,gCAAgC,EAChC,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,8BAA8B,EAC9B,oCAAoC,EACpC,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,KAAK,2BAA2B,EAChC,mCAAmC,GACpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,uBAAuB,GACxB,MAAM,kBAAkB,CAAC"}
@@ -4,7 +4,6 @@
4
4
  * @module release-assets
5
5
  */
6
6
  export { contentTypeForExtension, isAllowedReleaseAssetContentType, isValidContentHash, RELEASE_ASSET_BASE_PATH, RELEASE_ASSET_CONTENT_TYPE_ALLOWLIST, RELEASE_ASSET_CONTENT_TYPES, RELEASE_ASSET_IMMUTABLE_MAX_AGE_SECONDS, RELEASE_ASSET_MANIFEST_ENV_FLAG, RELEASE_ASSET_MANIFEST_SCHEMA_VERSION, RELEASE_ASSET_MAX_SIZE_BYTES, RELEASE_ASSET_UPLOAD_CONCURRENCY, releaseAssetUrl, } from "./constants.js";
7
- export { sha256Hex, sha256HexBytes } from "./hash.js";
8
7
  export { getReleaseAssetManifestSchema, parseReleaseAssetManifest, } from "./manifest-schema.js";
9
8
  export { clearReleaseAssetManifestCache, configureReleaseAssetManifestFetcher, getReadyManifestForRender, isReleaseAssetManifestEnabled, registerManifestFetcherForRelease, unregisterManifestFetcherForRelease, } from "./manifest-cache.js";
10
9
  export { normalizeManifestModuleKey, resolveManifestModuleUrl, resolveManifestRoutePreloadUrls, } from "./html-consumption.js";
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Module Loader Cache Utilities
3
+ *
4
+ * Provides hash generation and cache factory functions.
5
+ * Module caches are now pod-level singletons (see src/cache/module-cache.ts)
6
+ * to ensure caches persist across requests within the same pod.
7
+ *
8
+ * @module rendering/orchestrator/module-loader/cache
9
+ */
1
10
  export { createEsmCache, createModuleCache } from "../../../cache/module-cache.js";
2
11
  export declare function generateHash(str: string): Promise<string>;
3
12
  //# sourceMappingURL=cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../../src/src/rendering/orchestrator/module-loader/cache.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAInF,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY/D"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../../src/src/rendering/orchestrator/module-loader/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnF,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE/D"}
@@ -7,17 +7,8 @@
7
7
  *
8
8
  * @module rendering/orchestrator/module-loader/cache
9
9
  */
10
- import * as dntShim from "../../../../_dnt.shims.js";
11
10
  export { createEsmCache, createModuleCache } from "../../../cache/module-cache.js";
12
- const HEX_CHARS = "0123456789abcdef";
11
+ import { computeHash } from "../../../utils/index.js";
13
12
  export async function generateHash(str) {
14
- const data = new TextEncoder().encode(str);
15
- const hashBuffer = await dntShim.crypto.subtle.digest("SHA-256", data);
16
- const bytes = new Uint8Array(hashBuffer);
17
- let hex = "";
18
- for (let i = 0; i < 8; i++) {
19
- const byte = bytes[i] ?? 0;
20
- hex += (HEX_CHARS[byte >> 4] ?? "0") + (HEX_CHARS[byte & 0xf] ?? "0");
21
- }
22
- return hex;
13
+ return (await computeHash(str)).slice(0, 16);
23
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild-plugin.d.ts","sourceRoot":"","sources":["../../../../../src/src/routing/api/module-loader/esbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,eAAe,EAErB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAW,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAQ5E,UAAU,iBAAiB;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA8GD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,EAAE,GAAG,MAAM,CA0R9E"}
1
+ {"version":3,"file":"esbuild-plugin.d.ts","sourceRoot":"","sources":["../../../../../src/src/routing/api/module-loader/esbuild-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAAW,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAQ5E,UAAU,iBAAiB;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA8GD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,EAAE,GAAG,MAAM,CAsR9E"}
@@ -1,4 +1,4 @@
1
- import { computeHash, computeIntegrity, createLockfileManager, HTTP_MODULE_FETCH_TIMEOUT_MS, HTTP_NETWORK_CONNECT_TIMEOUT, serverLogger, } from "../../../utils/index.js";
1
+ import { computeHash, computeIntegrity, createLockfileManager, HTTP_MODULE_FETCH_TIMEOUT_MS, HTTP_NETWORK_CONNECT_TIMEOUT, serverLogger, sleep, } from "../../../utils/index.js";
2
2
  import { createFileSystem } from "../../../platform/compat/fs.js";
3
3
  import * as pathHelper from "../../../platform/compat/path/index.js";
4
4
  import { isAllowedRemoteHost } from "./http-validator.js";
@@ -102,9 +102,6 @@ export function createHTTPPlugin(options) {
102
102
  function shouldRetryFetch(status) {
103
103
  return status === 429 || status >= 500 || status === HTTP_NETWORK_CONNECT_TIMEOUT;
104
104
  }
105
- function delay(ms) {
106
- return new Promise((resolve) => setTimeout(resolve, ms));
107
- }
108
105
  function describePersistenceError(error) {
109
106
  if (!(error instanceof Error))
110
107
  return typeof error;
@@ -146,7 +143,7 @@ export function createHTTPPlugin(options) {
146
143
  return response;
147
144
  }
148
145
  logger.warn(`[http] fetch attempt ${attempt} failed ${url} ${response.status}; retrying`);
149
- await delay(HTTP_MODULE_FETCH_RETRY_DELAY_MS * attempt);
146
+ await sleep(HTTP_MODULE_FETCH_RETRY_DELAY_MS * attempt);
150
147
  }
151
148
  return new Response("Remote module fetch failed", {
152
149
  status: HTTP_NETWORK_CONNECT_TIMEOUT,
@@ -1,6 +1,6 @@
1
1
  import { REQUEST_ERROR } from "../errors/index.js";
2
2
  import { getHostEnv } from "../platform/compat/process.js";
3
- import { logger } from "../utils/index.js";
3
+ import { logger, sleep } from "../utils/index.js";
4
4
  import { resolveSandboxApiUrl, resolveSandboxAuthToken } from "./config.js";
5
5
  import { readSandboxFileContent, sandboxSessionRoute } from "./proxy-routes.js";
6
6
  const DEFAULT_STARTUP_TIMEOUT_MS = 180_000;
@@ -458,7 +458,7 @@ export class LazySandbox {
458
458
  async waitForReadySession(sessionId) {
459
459
  const start = Date.now();
460
460
  while (Date.now() - start < this.startupTimeoutMs) {
461
- await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
461
+ await sleep(this.pollIntervalMs);
462
462
  const res = await this.fetchControl(`${this.apiUrl}/sandbox-sessions/${encodeURIComponent(sessionId)}`, {
463
463
  headers: this.authHeaders(),
464
464
  });
@@ -498,7 +498,7 @@ export class LazySandbox {
498
498
  catch (error) {
499
499
  lastFailure = error instanceof Error ? error.message : String(error);
500
500
  }
501
- await new Promise((resolve) => setTimeout(resolve, this.pollIntervalMs));
501
+ await sleep(this.pollIntervalMs);
502
502
  }
503
503
  throw REQUEST_ERROR.create({
504
504
  detail: `Sandbox data plane did not become ready: ${lastFailure}`,
@@ -640,7 +640,7 @@ export class LazySandbox {
640
640
  return fetchWithTimeout(url, this.controlRequestTimeoutMs, init);
641
641
  }
642
642
  waitForExecStartRetry() {
643
- return new Promise((resolve) => setTimeout(resolve, this.execStartRetryDelayMs));
643
+ return sleep(this.execStartRetryDelayMs);
644
644
  }
645
645
  async reprovisionAfterExecStartFailure() {
646
646
  const sessionId = this.sessionId;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/src/security/http/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,sBAAsB,CAAC;AAoC9B,qBAAa,WAAY,SAAQ,WAAW;IAC1C,QAAQ,EAAE,eAAe,CAIvB;IAEF,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,WAAW,CAAuB;IAE1C,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAcjE,OAAO,CAAC,cAAc;IAgCtB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,eAAe;CASxB"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/src/security/http/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,sBAAsB,CAAC;AAW9B,qBAAa,WAAY,SAAQ,WAAW;IAC1C,QAAQ,EAAE,eAAe,CAIvB;IAEF,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,WAAW,CAAuB;IAE1C,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAcjE,OAAO,CAAC,cAAc;IAgCtB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,eAAe;CASxB"}
@@ -1,31 +1,8 @@
1
1
  import * as dntShim from "../../../_dnt.shims.js";
2
2
  import { BaseHandler } from "./base-handler.js";
3
- import { createError, toError } from "../../errors/index.js";
3
+ import { encodeBase64 } from "../../utils/index.js";
4
4
  import { constantTimeEqual } from "../utils/constant-time.js";
5
5
  import { isProduction } from "../../platform/environment.js";
6
- function encodeBase64(value) {
7
- if (typeof globalThis.btoa === "function") {
8
- try {
9
- return globalThis.btoa(value);
10
- }
11
- catch (_) {
12
- /* expected: non-Latin1 string — fall back to TextEncoder */
13
- const bytes = new TextEncoder().encode(value);
14
- let binary = "";
15
- for (const byte of bytes)
16
- binary += String.fromCharCode(byte);
17
- return globalThis.btoa(binary);
18
- }
19
- }
20
- const bufferCtor = dntShim.dntGlobalThis.Buffer;
21
- if (bufferCtor)
22
- return bufferCtor.from(value, "utf8").toString("base64");
23
- throw toError(createError({
24
- type: "not_supported",
25
- message: "Base64 encoding is not supported in this runtime",
26
- feature: "Base64 encoding",
27
- }));
28
- }
29
6
  function sanitizeRealm(realm) {
30
7
  // deno-lint-ignore no-control-regex -- intentional: strips control chars and special chars from HTTP realm header
31
8
  return String(realm).replace(/[\x00-\x1f\x7f"\\]/g, "");
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-modules.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/studio/bridge-modules.handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,aAAa,CAAC;AA+DrB,qBAAa,0BAA2B,SAAQ,WAAW;IACzD,QAAQ,EAAE,eAAe,CAKvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAwCxE"}
1
+ {"version":3,"file":"bridge-modules.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/studio/bridge-modules.handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,aAAa,CAAC;AA4DrB,qBAAa,0BAA2B,SAAQ,WAAW;IACzD,QAAQ,EAAE,eAAe,CAKvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAwCxE"}
@@ -12,7 +12,7 @@ import * as dntShim from "../../../../_dnt.shims.js";
12
12
  import { BaseHandler } from "../../../security/index.js";
13
13
  import { HTTP_OK, PRIORITY_HIGH_DEV } from "../../../utils/constants/index.js";
14
14
  import { STUDIO_BRIDGE_BUNDLE } from "../../../studio/bridge/bridge-bundle.generated.js";
15
- import { serverLogger } from "../../../utils/index.js";
15
+ import { computeHash, serverLogger } from "../../../utils/index.js";
16
16
  const logger = serverLogger.component("studio-bridge-handler");
17
17
  /** Cached bundle output. */
18
18
  let bundleCache = null;
@@ -22,10 +22,7 @@ const BRIDGE_DIR = new URL("../../../studio/bridge/", globalThis[Symbol.for("imp
22
22
  * Compute a content hash for ETag.
23
23
  */
24
24
  async function computeEtag(content) {
25
- const data = new TextEncoder().encode(content);
26
- const hashBuffer = await dntShim.crypto.subtle.digest("SHA-256", data);
27
- const hashArray = Array.from(new Uint8Array(hashBuffer));
28
- return hashArray.slice(0, 16).map((b) => b.toString(16).padStart(2, "0")).join("");
25
+ return (await computeHash(content)).slice(0, 32);
29
26
  }
30
27
  /**
31
28
  * Bundle the bridge coordinator (and all its imports) into a single JS file.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @module server/project-env/fetcher
5
5
  */
6
- import { getBaseLogger } from "../../utils/index.js";
6
+ import { encodeBase64, getBaseLogger } from "../../utils/index.js";
7
7
  import { NETWORK_ERROR } from "../../errors/index.js";
8
8
  import { getHostEnv } from "../../platform/compat/process.js";
9
9
  const baseLogger = getBaseLogger("PROJECT-ENV");
@@ -16,7 +16,7 @@ function getInternalAuthorization() {
16
16
  const password = getHostEnv("VERYFRONT_API_INTERNAL_PASS");
17
17
  if (!username || !password)
18
18
  return undefined;
19
- return `Basic ${globalThis.btoa(`${username}:${password}`)}`;
19
+ return `Basic ${encodeBase64(`${username}:${password}`)}`;
20
20
  }
21
21
  async function fetchEnvironmentVariables(url, authorization, projectSlug, environmentId) {
22
22
  try {
@@ -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,MAC28+B,CAAC;AAE7++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,MACwx/B,CAAC;AAE1z/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 H(t){return vt(btoa(t))}var no=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 bt(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?bt(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 Lt={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},lo=Lt.CACHE;var uo={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),Ro=new R("PREFETCH",N),Eo=new R("HYDRATE",N),yo=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 wt(t,e){if(!e)return t;let r=t.includes("?")?"&":"?";return`${t}${r}v=${encodeURIComponent(e)}`}function Pt(t,e){return wt(`${Z}${H(t)}.js`,e)}function Ht(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?Pt(e,t.version):null}return Ht(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 Vt=o({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),Ft=o({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),kt=o({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),Gt=o({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),$t=o({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),Bt=o({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),Yt=o({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),jt=o({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),Wt=o({slug:"webhook-config-invalid",category:"CONFIG",status:400,title:"Invalid webhook configuration",suggestion:"Check webhook definition fields, target settings, and eventFilter conditions"}),qt=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"}),zt=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":Vt,"config-invalid":Ft,"config-parse-error":kt,"config-validation-error":Gt,"config-type-error":$t,"import-map-invalid":Bt,"cors-config-invalid":Yt,"config-validation-failed":jt,"webhook-config-invalid":Wt,"schedule-config-invalid":qt,"trigger-config-invalid":zt};var Jt=o({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),Xt=o({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),Kt=o({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),Zt=o({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),Qt=o({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),te=o({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),ee=o({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),re=o({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),rt={"build-failed":Jt,"bundle-error":Xt,"typescript-error":Kt,"mdx-compile-error":Zt,"asset-optimization-error":Qt,"ssg-generation-error":te,"sourcemap-error":ee,"compilation-error":re};var oe=o({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),ne=o({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),se=o({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),ie=o({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),ae=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"}),ce=o({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),le=o({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),ue=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"}),de=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"}),ge=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":oe,"render-error":ne,"component-error":se,"layout-not-found":ie,"page-not-found":ae,"api-error":ce,"middleware-error":le,"trigger-target-not-found":ue,"trigger-execution-failed":de,"trigger-not-supported":ge};var pe=o({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),fe=o({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),me=o({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),Re=o({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),Ee=o({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),ye=o({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),nt={"route-conflict":pe,"invalid-route-file":fe,"route-handler-invalid":me,"dynamic-route-error":Re,"route-params-error":Ee,"api-route-error":ye};var _e=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"}),he=o({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),Ce=o({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),Te=o({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),xe=o({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Ie=o({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),st={"module-not-found":_e,"import-resolution-error":he,"circular-dependency":Ce,"invalid-import":Te,"dependency-missing":xe,"version-mismatch":Ie};var Se=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"}),Oe=o({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),Ne=o({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),Ae=o({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),De=o({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),ve=o({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),be=o({slug:"semaphore-timeout",category:"SERVER",status:503,title:"Semaphore acquire timeout",suggestion:"Reduce concurrency or increase the semaphore acquire timeout"}),Me=o({slug:"circuit-breaker-open",category:"SERVER",status:503,title:"Circuit breaker is open",suggestion:"Wait for the breaker reset timeout before retrying"}),Le=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"}),we=o({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Pe=o({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),He=o({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),Ve=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"}),Fe=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":Se,"server-start-error":Oe,"cache-error":Ne,"file-watch-error":Ae,"request-error":De,"service-overloaded":ve,"semaphore-timeout":be,"circuit-breaker-open":Me,"cache-path-mismatch":Le,"network-error":Ue,"api-client-error":we,"token-storage-error":Pe,"cache-invariant-violation":He,"release-not-found":Ve,"fallback-exhausted":Fe};var ke=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"}),Ge=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"}),$e=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"}),Be=o({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),Ye=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"}),je=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":ke,"server-only-in-client":Ge,"client-only-in-server":$e,"invalid-use-client":Be,"invalid-use-server":Ye,"rsc-payload-error":je};var We=o({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),qe=o({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),ze=o({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),Je=o({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),Xe=o({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),ct={"hmr-error":We,"dev-server-error":qe,"fast-refresh-error":ze,"error-overlay-error":Je,"source-map-error":Xe};var Ke=o({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),Ze=o({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),Qe=o({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),tr=o({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),lt={"deployment-error":Ke,"platform-error":Ze,"env-var-missing":Qe,"production-build-required":tr};var er=o({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),rr=o({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),or=o({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),nr=o({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),sr=o({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),ir=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"}),ar=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":er,"agent-not-found":rr,"agent-timeout":or,"agent-intent-error":nr,"orchestration-error":sr,"cost-limit-exceeded":ir,"tool-id-conflict":ar};var cr=o({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),lr=o({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),ur=o({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),dr=o({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),gr=o({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),pr=o({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),fr=o({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),mr=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"}),Rr=o({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"}),dt={"unknown-error":cr,"permission-denied":lr,"file-not-found":ur,"resource-not-found":dr,"invalid-argument":gr,"timeout-error":pr,"initialization-error":fr,"not-supported":mr,"security-violation":G,"input-validation-failed":Rr};var mn={...et,...rt,...ot,...nt,...st,...it,...at,...ct,...lt,...ut,...dt};var Er=[{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 yr(){return Er.map(({source:t,flags:e,name:r})=>({pattern:new RegExp(t,e),name:r}))}function _r(){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 yr())if(!(r&&c==="inline script")&&(u.lastIndex=0,!!u.test(t)&&(s&&console.warn(`[Security] Suspicious ${c} detected in server HTML`),n||!_r())))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 hr(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"){hr(t,g);try{xr(t,g.id||"root")}catch(a){i.debug("[client-dom] hydration optional failed",a)}}}return n}function Cr(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,Cr(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 Tr(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 xr(t,e){let r=Tr(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 Ir=new Set(["server","client","html","fragment"]);function ft(t){if(!t)return[];try{let e=JSON.parse(t);return Or(e)?e.nodes:[]}catch{return[]}}async function B(t,e,r){return await Promise.all(t.map(n=>Sr(n,e,r)))}async function Sr(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 Or(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)||!Ir.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 Nr(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:Nr(e?.params),frontmatter:e?.frontmatter??{}})}catch(n){return i.debug("router provider wrap failed",n),t}}var Ar=100;function Dr(t,e){if(globalThis.__VF_CLIENT_MOD_CACHE??(globalThis.__VF_CLIENT_MOD_CACHE=new Map),globalThis.__VF_CLIENT_MOD_CACHE.size>=Ar){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 vr(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 br(t){return ft(t.dataset?.rscChildren)}async function Mr(){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=Lr(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{Dr(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 Lr(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 Mr()}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=vr(a),ht=br(a),Ct=await B(ht,{Fragment:c.Fragment,createElement(I,U,...S){return c.createElement(I,U,...S)}},async I=>{let U=e.modules.find(xt=>xt.id===I),S=e.components?.[I],W=U?.clientRef??(S?`${S}#default`:void 0);if(!W)return null;let w=Rt(W);if(!w)return null;let P=await Et(e,w,s);if(!P)return null;let q=P[w.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 wr(){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 Pr=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)||Pr.has(t.tagName.toUpperCase())}function Hr(t,e){return t.find(r=>r.tagName.toUpperCase()==="DIV"&&!!r.getAttribute("class")?.trim()&&!Y(r))??e}function Vr(t,e){return t===e}function Fr(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 kr(t,e,r=document){return!!e?.pagePath&&typeof t?.__veryfrontRenderPage=="function"&&!!r.getElementById("root")}function Gr(t,e){return e?.pagePath?!1:!!t.getElementById(C)}function $r(t=import.meta.url){try{return new URL(t,"http://veryfront.local").searchParams.get("hydrate")==="1"}catch{return!1}}function Br(t){return t==="rsc-module"}async function Yr(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 jr(t,e){try{let{React:r,ReactDOM:n}=await wr(),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=Hr(g,document.body),d=Vr(a,document.body)?Fr(g,document.body):a,f=await b(r.createElement(c,{}),E(document));return Br(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 Wr(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 qr(){try{let t=globalThis.window?.location.search??"",e=E(document);if($r()){await M();return}let r=e?.pagePath,n=A(e);if(r){if(kr(globalThis.window,e,document)){i.debug("Page renderer owns hydration");return}i.debug("Found page component in hydration data:",r),await jr(r,n)&&i.debug("Client component hydrated successfully");return}if(!Gr(document,e))return;if(await Yr(t)){await M();return}if(await Wr(t)){await M();return}await M()}catch(t){i.error("boot failed",t)}}if(typeof document<"u"){let t=()=>{qr()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{qr as boot,Hr as selectHydrationRoot,Gr as shouldAttemptRSCTransport,$r as shouldHydrateOnly,Br as shouldRenderPageComponent,kr as shouldUsePageRendererHydration,Vr 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{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';
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,4 +1,4 @@
1
- import { serverLogger } from "../../../../utils/index.js";
1
+ import { serverLogger, sleep } from "../../../../utils/index.js";
2
2
  const logger = serverLogger.component("rsc");
3
3
  const STREAM_DELAY_MS = 30;
4
4
  const FALLBACK_HTML = "<div>OK</div>";
@@ -63,9 +63,6 @@ export class StreamHandler {
63
63
  });
64
64
  }
65
65
  }
66
- function sleep(ms) {
67
- return new Promise((resolve) => setTimeout(resolve, ms)); // no cleanup needed: one-shot
68
- }
69
66
  function enqueueSlot(controller, encoder, slot) {
70
67
  controller.enqueue(encoder.encode(`${JSON.stringify(slot)}\n`));
71
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transform-utils.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/transform-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAGhE;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAExE;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AAaX,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD"}
1
+ {"version":3,"file":"transform-utils.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/transform-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAGhE;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAExE;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AAaX,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI1D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD"}