veryfront 0.1.246 → 0.1.248
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.
- package/esm/cli/mcp/tools/project-tools.d.ts +1 -1
- package/esm/cli/mcp/tools/scaffold-tools.d.ts +2 -2
- package/esm/cli/shared/server-startup.d.ts.map +1 -1
- package/esm/cli/shared/server-startup.js +8 -0
- package/esm/deno.d.ts +0 -9
- package/esm/deno.js +5 -12
- package/esm/src/agent/durable.d.ts +67 -0
- package/esm/src/agent/durable.d.ts.map +1 -1
- package/esm/src/agent/durable.js +134 -0
- package/esm/src/agent/index.d.ts +1 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +1 -1
- package/esm/src/embedding/upload-loader.d.ts +2 -2
- package/esm/src/embedding/upload-loader.d.ts.map +1 -1
- package/esm/src/embedding/upload-loader.js +11 -48
- package/esm/src/errors/middleware/cli-error-boundary.js +1 -1
- package/esm/src/errors/middleware/http-error-boundary.js +1 -1
- package/esm/src/errors/tracing.d.ts +3 -3
- package/esm/src/errors/tracing.d.ts.map +1 -1
- package/esm/src/errors/tracing.js +3 -3
- package/esm/src/extensions/interfaces/index.d.ts +2 -2
- package/esm/src/extensions/interfaces/index.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/node-compat.d.ts +68 -10
- package/esm/src/extensions/interfaces/node-compat.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/tracing-exporter.d.ts +35 -1
- package/esm/src/extensions/interfaces/tracing-exporter.d.ts.map +1 -1
- package/esm/src/integrations/schema.d.ts +10 -10
- package/esm/src/mcp/index.d.ts +7 -2
- package/esm/src/mcp/index.d.ts.map +1 -1
- package/esm/src/mcp/index.js +7 -2
- package/esm/src/mcp/schemas/index.d.ts +1 -1
- package/esm/src/mcp/schemas/index.d.ts.map +1 -1
- package/esm/src/mcp/schemas/index.js +1 -1
- package/esm/src/mcp/schemas/mcp.schema.d.ts +13 -7
- package/esm/src/mcp/schemas/mcp.schema.d.ts.map +1 -1
- package/esm/src/mcp/schemas/mcp.schema.js +17 -7
- package/esm/src/mcp/server.d.ts +13 -0
- package/esm/src/mcp/server.d.ts.map +1 -1
- package/esm/src/mcp/server.js +43 -6
- package/esm/src/observability/auto-instrument/http-instrumentation.js +1 -1
- package/esm/src/observability/auto-instrument/react-instrumentation.js +1 -1
- package/esm/src/observability/instruments/build-instruments.d.ts +1 -1
- package/esm/src/observability/instruments/build-instruments.d.ts.map +1 -1
- package/esm/src/observability/instruments/cache-instruments.d.ts +1 -1
- package/esm/src/observability/instruments/cache-instruments.d.ts.map +1 -1
- package/esm/src/observability/instruments/data-instruments.d.ts +1 -1
- package/esm/src/observability/instruments/data-instruments.d.ts.map +1 -1
- package/esm/src/observability/instruments/error-instruments.d.ts +1 -1
- package/esm/src/observability/instruments/error-instruments.d.ts.map +1 -1
- package/esm/src/observability/instruments/http-instruments.d.ts +1 -1
- package/esm/src/observability/instruments/http-instruments.d.ts.map +1 -1
- package/esm/src/observability/instruments/instruments-factory.d.ts +1 -1
- package/esm/src/observability/instruments/instruments-factory.d.ts.map +1 -1
- package/esm/src/observability/instruments/memory-instruments.d.ts +1 -1
- package/esm/src/observability/instruments/memory-instruments.d.ts.map +1 -1
- package/esm/src/observability/instruments/render-instruments.d.ts +1 -1
- package/esm/src/observability/instruments/render-instruments.d.ts.map +1 -1
- package/esm/src/observability/instruments/rsc-instruments.d.ts +1 -1
- package/esm/src/observability/instruments/rsc-instruments.d.ts.map +1 -1
- package/esm/src/observability/metrics/manager.d.ts.map +1 -1
- package/esm/src/observability/metrics/manager.js +10 -2
- package/esm/src/observability/metrics/types.d.ts +1 -1
- package/esm/src/observability/metrics/types.d.ts.map +1 -1
- package/esm/src/observability/simple-metrics/otel-instruments.d.ts.map +1 -1
- package/esm/src/observability/simple-metrics/otel-instruments.js +7 -2
- package/esm/src/observability/simple-metrics/types.d.ts +1 -1
- package/esm/src/observability/simple-metrics/types.d.ts.map +1 -1
- package/esm/src/observability/tracing/api-shim.d.ts +177 -0
- package/esm/src/observability/tracing/api-shim.d.ts.map +1 -0
- package/esm/src/observability/tracing/api-shim.js +234 -0
- package/esm/src/observability/tracing/manager.d.ts.map +1 -1
- package/esm/src/observability/tracing/manager.js +29 -4
- package/esm/src/observability/tracing/otlp-setup.d.ts +12 -8
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
- package/esm/src/observability/tracing/otlp-setup.js +59 -136
- package/esm/src/observability/tracing/types.d.ts +1 -1
- package/esm/src/observability/tracing/types.d.ts.map +1 -1
- package/esm/src/platform/compat/kv/factory.d.ts.map +1 -1
- package/esm/src/platform/compat/kv/factory.js +15 -6
- package/esm/src/platform/compat/opaque-deps.d.ts +6 -5
- package/esm/src/platform/compat/opaque-deps.d.ts.map +1 -1
- package/esm/src/platform/compat/opaque-deps.js +13 -37
- package/esm/src/proxy/tracing.d.ts +7 -2
- package/esm/src/proxy/tracing.d.ts.map +1 -1
- package/esm/src/proxy/tracing.js +31 -96
- package/esm/src/rendering/rsc/client-module-strategy.d.ts.map +1 -1
- package/esm/src/rendering/rsc/client-module-strategy.js +9 -1
- package/esm/src/server/bootstrap.d.ts.map +1 -1
- package/esm/src/server/bootstrap.js +27 -1
- package/esm/src/server/context/request-context.d.ts.map +1 -1
- package/esm/src/server/context/request-context.js +7 -4
- package/esm/src/server/dev-server/middleware.js +1 -1
- package/esm/src/server/handlers/dev/files/dev-file.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/files/dev-file.handler.js +4 -14
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +4 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/claude-code/workspace-sync.d.ts +17 -2
- package/esm/src/workflow/claude-code/workspace-sync.d.ts.map +1 -1
- package/esm/src/workflow/claude-code/workspace-sync.js +106 -19
- package/esm/src/workflow/schemas/workflow.schema.d.ts +3 -3
- package/package.json +1 -9
- package/src/cli/shared/server-startup.ts +8 -0
- package/src/deno.js +5 -12
- package/src/src/agent/durable.ts +237 -0
- package/src/src/agent/index.ts +4 -0
- package/src/src/cache/backends/factory.ts +1 -1
- package/src/src/cache/backends/redis.ts +1 -1
- package/src/src/cache/keys/utils.ts +1 -1
- package/src/src/cache/registry.ts +1 -1
- package/src/src/data/static-paths-fetcher.ts +1 -1
- package/src/src/embedding/upload-loader.ts +14 -63
- package/src/src/errors/middleware/cli-error-boundary.ts +1 -1
- package/src/src/errors/middleware/http-error-boundary.ts +1 -1
- package/src/src/errors/tracing.ts +4 -4
- package/src/src/extensions/interfaces/index.ts +7 -2
- package/src/src/extensions/interfaces/node-compat.ts +74 -10
- package/src/src/extensions/interfaces/tracing-exporter.ts +36 -1
- package/src/src/mcp/index.ts +7 -2
- package/src/src/mcp/schemas/index.ts +1 -0
- package/src/src/mcp/schemas/mcp.schema.ts +20 -7
- package/src/src/mcp/server.ts +60 -6
- package/src/src/observability/auto-instrument/http-instrumentation.ts +1 -1
- package/src/src/observability/auto-instrument/react-instrumentation.ts +1 -1
- package/src/src/observability/auto-instrument/wrappers.ts +1 -1
- package/src/src/observability/instruments/build-instruments.ts +1 -1
- package/src/src/observability/instruments/cache-instruments.ts +6 -1
- package/src/src/observability/instruments/data-instruments.ts +1 -1
- package/src/src/observability/instruments/error-instruments.ts +1 -1
- package/src/src/observability/instruments/http-instruments.ts +6 -1
- package/src/src/observability/instruments/instruments-factory.ts +1 -1
- package/src/src/observability/instruments/memory-instruments.ts +5 -1
- package/src/src/observability/instruments/render-instruments.ts +1 -1
- package/src/src/observability/instruments/rsc-instruments.ts +1 -1
- package/src/src/observability/metrics/manager.ts +11 -3
- package/src/src/observability/metrics/types.ts +7 -1
- package/src/src/observability/simple-metrics/otel-instruments.ts +7 -2
- package/src/src/observability/simple-metrics/types.ts +1 -1
- package/src/src/observability/tracing/api-shim.ts +409 -0
- package/src/src/observability/tracing/manager.ts +29 -4
- package/src/src/observability/tracing/otlp-setup.ts +76 -168
- package/src/src/observability/tracing/types.ts +1 -1
- package/src/src/platform/compat/kv/factory.ts +18 -7
- package/src/src/platform/compat/opaque-deps.ts +16 -44
- package/src/src/proxy/tracing.ts +43 -117
- package/src/src/rendering/rsc/client-module-strategy.ts +9 -1
- package/src/src/server/bootstrap.ts +38 -1
- package/src/src/server/context/request-context.ts +10 -7
- package/src/src/server/dev-server/middleware.ts +1 -1
- package/src/src/server/handlers/dev/files/dev-file.handler.ts +4 -22
- package/src/src/server/services/rendering/ssr.service.ts +4 -1
- package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +1 -1
- package/src/src/utils/version-constant.ts +1 -1
- package/src/src/workflow/claude-code/workspace-sync.ts +109 -20
- package/esm/src/utils/logger/trace-bridge.d.ts +0 -11
- package/esm/src/utils/logger/trace-bridge.d.ts.map +0 -1
- package/esm/src/utils/logger/trace-bridge.js +0 -12
- package/src/src/utils/logger/trace-bridge.ts +0 -14
package/esm/src/proxy/tracing.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/****
|
|
2
2
|
* OpenTelemetry OTLP tracing for proxy.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Uses the core api-shim for in-process tracing; when ext-opentelemetry
|
|
5
|
+
* is loaded, the shim delegates to the real SDK provider.
|
|
6
|
+
*
|
|
7
|
+
* Env: OTEL_TRACES_ENABLED, OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
8
|
+
* OTEL_EXPORTER_OTLP_HEADERS
|
|
4
9
|
*/
|
|
10
|
+
import { context as shimContext, defaultTextMapGetter, defaultTextMapSetter, propagation as shimPropagation, SpanKind, SpanStatusCode, trace as shimTrace, } from "../observability/tracing/api-shim.js";
|
|
5
11
|
import { getEnv } from "./env.js";
|
|
6
12
|
import { proxyLogger } from "./logger.js";
|
|
7
|
-
import { PROXY_RUNTIME_VERSION } from "./version.js";
|
|
8
13
|
let initialized = false;
|
|
9
|
-
let tracerProvider = null;
|
|
10
14
|
let tracer = null;
|
|
11
15
|
function parseHeaders(headerString) {
|
|
12
16
|
if (!headerString)
|
|
@@ -20,21 +24,6 @@ function parseHeaders(headerString) {
|
|
|
20
24
|
}
|
|
21
25
|
return headers;
|
|
22
26
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Parse OTEL_RESOURCE_ATTRIBUTES env var (key=value,key2=value2 format).
|
|
25
|
-
*/
|
|
26
|
-
function parseResourceAttributes(attrString) {
|
|
27
|
-
if (!attrString)
|
|
28
|
-
return {};
|
|
29
|
-
const attrs = {};
|
|
30
|
-
for (const part of attrString.split(",")) {
|
|
31
|
-
const [key, ...valueParts] = part.split("=");
|
|
32
|
-
if (key && valueParts.length > 0) {
|
|
33
|
-
attrs[key.trim()] = valueParts.join("=").trim();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return attrs;
|
|
37
|
-
}
|
|
38
27
|
function getConfig() {
|
|
39
28
|
return {
|
|
40
29
|
enabled: getEnv("OTEL_TRACES_ENABLED") === "true",
|
|
@@ -43,14 +32,6 @@ function getConfig() {
|
|
|
43
32
|
headers: parseHeaders(getEnv("OTEL_EXPORTER_OTLP_HEADERS")),
|
|
44
33
|
};
|
|
45
34
|
}
|
|
46
|
-
let traceApi = null;
|
|
47
|
-
let propagationApi = null;
|
|
48
|
-
async function loadApis() {
|
|
49
|
-
if (traceApi)
|
|
50
|
-
return;
|
|
51
|
-
traceApi = await import("@opentelemetry/api");
|
|
52
|
-
propagationApi = await import("@opentelemetry/core");
|
|
53
|
-
}
|
|
54
35
|
export async function initializeOTLPWithApis() {
|
|
55
36
|
if (initialized)
|
|
56
37
|
return;
|
|
@@ -65,31 +46,11 @@ export async function initializeOTLPWithApis() {
|
|
|
65
46
|
return;
|
|
66
47
|
}
|
|
67
48
|
try {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } = await import("@opentelemetry/semantic-conventions");
|
|
73
|
-
const resourceAttrs = parseResourceAttributes(getEnv("OTEL_RESOURCE_ATTRIBUTES"));
|
|
74
|
-
const resource = resourceFromAttributes({
|
|
75
|
-
[ATTR_SERVICE_NAME]: config.serviceName,
|
|
76
|
-
[ATTR_SERVICE_VERSION]: PROXY_RUNTIME_VERSION,
|
|
77
|
-
...resourceAttrs,
|
|
78
|
-
});
|
|
79
|
-
const exporter = new OTLPTraceExporter({
|
|
80
|
-
url: `${config.endpoint}/v1/traces`,
|
|
81
|
-
headers: config.headers,
|
|
82
|
-
});
|
|
83
|
-
const provider = new BasicTracerProvider({
|
|
84
|
-
resource,
|
|
85
|
-
spanProcessors: [new BatchSpanProcessor(exporter)],
|
|
86
|
-
});
|
|
87
|
-
// In OTel SDK v2, provider.register() is removed.
|
|
88
|
-
trace.setGlobalTracerProvider(provider);
|
|
89
|
-
tracerProvider = provider;
|
|
90
|
-
tracer = trace.getTracer(config.serviceName);
|
|
49
|
+
// The shim's provider is wired by ext-opentelemetry via bootstrap.ts.
|
|
50
|
+
// We simply get a tracer from the shim — it delegates to the real SDK
|
|
51
|
+
// when the extension is active, otherwise returns the no-op tracer.
|
|
52
|
+
tracer = shimTrace.getTracer(config.serviceName);
|
|
91
53
|
initialized = true;
|
|
92
|
-
await loadApis();
|
|
93
54
|
proxyLogger.info("[otel] Initialized", {
|
|
94
55
|
serviceName: config.serviceName,
|
|
95
56
|
endpoint: config.endpoint,
|
|
@@ -101,76 +62,50 @@ export async function initializeOTLPWithApis() {
|
|
|
101
62
|
}
|
|
102
63
|
}
|
|
103
64
|
export async function shutdownOTLP() {
|
|
104
|
-
|
|
105
|
-
return;
|
|
106
|
-
try {
|
|
107
|
-
await tracerProvider.shutdown();
|
|
108
|
-
proxyLogger.info("[otel] Shutdown complete");
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
proxyLogger.error("[otel] Shutdown error", error);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function getPropagator() {
|
|
115
|
-
if (!propagationApi)
|
|
116
|
-
return null;
|
|
117
|
-
return new propagationApi.W3CTraceContextPropagator();
|
|
65
|
+
proxyLogger.info("[otel] Shutdown complete");
|
|
118
66
|
}
|
|
119
67
|
export function extractContext(headers) {
|
|
120
|
-
if (!traceApi)
|
|
121
|
-
return undefined;
|
|
122
|
-
const propagator = getPropagator();
|
|
123
|
-
if (!propagator)
|
|
124
|
-
return undefined;
|
|
125
68
|
const carrier = {};
|
|
126
69
|
headers.forEach((v, k) => {
|
|
127
70
|
carrier[k.toLowerCase()] = v;
|
|
128
71
|
});
|
|
129
|
-
|
|
72
|
+
const extracted = shimPropagation.extract(shimContext.active(), carrier, defaultTextMapGetter);
|
|
73
|
+
return extracted;
|
|
130
74
|
}
|
|
131
75
|
export function injectContext(headers) {
|
|
132
|
-
if (!traceApi)
|
|
133
|
-
return;
|
|
134
|
-
const propagator = getPropagator();
|
|
135
|
-
if (!propagator)
|
|
136
|
-
return;
|
|
137
76
|
const carrier = {};
|
|
138
|
-
|
|
77
|
+
shimPropagation.inject(shimContext.active(), carrier, defaultTextMapSetter);
|
|
139
78
|
for (const [k, v] of Object.entries(carrier)) {
|
|
140
79
|
headers.set(k, v);
|
|
141
80
|
}
|
|
142
81
|
}
|
|
143
82
|
export function startServerSpan(method, path, parentContext) {
|
|
144
|
-
if (!
|
|
83
|
+
if (!tracer)
|
|
145
84
|
return null;
|
|
146
|
-
const ctx = parentContext ??
|
|
147
|
-
const span = tracer.startSpan(`${method} ${path}`, { kind:
|
|
148
|
-
return { span, context:
|
|
85
|
+
const ctx = parentContext ?? shimContext.active();
|
|
86
|
+
const span = tracer.startSpan(`${method} ${path}`, { kind: SpanKind.SERVER }, ctx);
|
|
87
|
+
return { span, context: shimTrace.setSpan(ctx, span) };
|
|
149
88
|
}
|
|
150
89
|
export function endSpan(span, statusCode, error) {
|
|
151
|
-
if (!span
|
|
90
|
+
if (!span)
|
|
152
91
|
return;
|
|
153
92
|
span.setAttribute("http.status_code", statusCode);
|
|
154
93
|
if (error) {
|
|
155
|
-
span.setStatus({ code:
|
|
94
|
+
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
156
95
|
span.recordException(error);
|
|
157
96
|
span.end();
|
|
158
97
|
return;
|
|
159
98
|
}
|
|
160
99
|
if (statusCode >= 400) {
|
|
161
|
-
span.setStatus({ code:
|
|
100
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
162
101
|
}
|
|
163
102
|
span.end();
|
|
164
103
|
}
|
|
165
104
|
export function withContext(spanContext, fn) {
|
|
166
|
-
|
|
167
|
-
return fn();
|
|
168
|
-
return traceApi.context.with(spanContext, fn);
|
|
105
|
+
return shimContext.with(spanContext, fn);
|
|
169
106
|
}
|
|
170
107
|
function getActiveSpanContext() {
|
|
171
|
-
|
|
172
|
-
return null;
|
|
173
|
-
const activeSpan = traceApi.trace.getSpan(traceApi.context.active());
|
|
108
|
+
const activeSpan = shimTrace.getActiveSpan?.();
|
|
174
109
|
return activeSpan ? activeSpan.spanContext() : null;
|
|
175
110
|
}
|
|
176
111
|
export function getTraceContext() {
|
|
@@ -193,19 +128,19 @@ export const ProxySpanNames = {
|
|
|
193
128
|
* If tracing is disabled, executes the function directly.
|
|
194
129
|
*/
|
|
195
130
|
export async function withSpan(name, fn, attributes) {
|
|
196
|
-
if (!
|
|
131
|
+
if (!tracer)
|
|
197
132
|
return await fn();
|
|
198
|
-
const parentContext =
|
|
199
|
-
const span = tracer.startSpan(name, { kind:
|
|
200
|
-
const spanContext =
|
|
133
|
+
const parentContext = shimContext.active();
|
|
134
|
+
const span = tracer.startSpan(name, { kind: SpanKind.INTERNAL, attributes }, parentContext);
|
|
135
|
+
const spanContext = shimTrace.setSpan(parentContext, span);
|
|
201
136
|
try {
|
|
202
|
-
const result = await
|
|
203
|
-
span.setStatus({ code:
|
|
137
|
+
const result = await shimContext.with(spanContext, fn);
|
|
138
|
+
span.setStatus({ code: SpanStatusCode.OK });
|
|
204
139
|
return result;
|
|
205
140
|
}
|
|
206
141
|
catch (error) {
|
|
207
142
|
span.setStatus({
|
|
208
|
-
code:
|
|
143
|
+
code: SpanStatusCode.ERROR,
|
|
209
144
|
message: error instanceof Error ? error.message : String(error),
|
|
210
145
|
});
|
|
211
146
|
if (error instanceof Error)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-module-strategy.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/rsc/client-module-strategy.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,YAAY,CAAC;AAEvD,MAAM,WAAW,2BAA2B;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;CACxC;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,2BAA2B,GACnC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"client-module-strategy.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/rsc/client-module-strategy.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,YAAY,CAAC;AAEvD,MAAM,WAAW,2BAA2B;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;CACxC;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,2BAA2B,GACnC,oBAAoB,CAUtB;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,GAAE,QAAmB,GACvB,0BAA0B,GAAG,IAAI,CASnC;AAED,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,0BAA0B,GAAG,IAAI,GAC/C,oBAAoB,CAMtB;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAGvE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI,CAOnF;AAED,wBAAgB,iCAAiC,CAC/C,GAAG,GAAE,QAAmB,EACxB,OAAO,GAAE,MAA8B,GACtC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAS3C"}
|
|
@@ -3,7 +3,15 @@ import { base64urlEncode } from "../../utils/base64url.js";
|
|
|
3
3
|
import { getDocumentImportMapImports, importMapOwnsSpecifier, } from "../../utils/import-map.js";
|
|
4
4
|
import { FS_PATH_PREFIX, HYDRATION_DATA_ID, RSC_PATH_PREFIX } from "./constants.js";
|
|
5
5
|
export function determineClientModuleStrategy(options) {
|
|
6
|
-
|
|
6
|
+
// Only emit the `fs` strategy when the server is backed by a real on-disk
|
|
7
|
+
// project (server-trusted `isLocalProject` signal). The `/_veryfront/fs/`
|
|
8
|
+
// handler that serves those modules was narrowed to local projects only
|
|
9
|
+
// under VULN-SRV-1/2: honoring a client-reachable `environment === "preview"`
|
|
10
|
+
// here would advertise a dev-only endpoint that returns 404 in preview pods
|
|
11
|
+
// and — more importantly — mixes the preview-mode signal (environment) with
|
|
12
|
+
// the local-filesystem signal (isLocalProject). Preview pods serve the same
|
|
13
|
+
// compiled client modules as production, via the RSC module endpoint.
|
|
14
|
+
return options.isLocalProject ? "fs" : "rsc-module";
|
|
7
15
|
}
|
|
8
16
|
export function readHydrationData(doc = document) {
|
|
9
17
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/src/server/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../src/src/server/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,KAAK,eAAe,EAAqC,MAAM,wBAAwB,CAAC;AAiCjG,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,OAAO,EAAE,cAAc,CAAC;IAExB,2BAA2B;IAC3B,MAAM,EAAE,eAAe,CAAC;IAExB,wCAAwC;IACxC,cAAc,EAAE,OAAO,CAAC;IAExB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,eAAe,EAAE,eAAe,CAAC;IAEjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AA2CD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,EAC3C,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GAClC,OAAO,CAAC,eAAe,CAAC,CAO1B;AAkDD,wBAAsB,SAAS,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CA4I1B;AAED,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CAa1B;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC,CAyB1B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clearConfigCache, getConfig } from "../config/index.js";
|
|
2
|
-
import { orchestrateExtensions } from "../extensions/index.js";
|
|
2
|
+
import { orchestrateExtensions, tryResolve } from "../extensions/index.js";
|
|
3
|
+
import { setGlobalActiveSpanAccessor, setGlobalMetricsAPI, setGlobalTracerProvider, } from "../observability/tracing/api-shim.js";
|
|
3
4
|
import { getEnvironmentConfig, refreshEnvironmentConfig, } from "../config/environment-config.js";
|
|
4
5
|
import { getErrorMessage } from "../errors/veryfront-error.js";
|
|
5
6
|
import { INVALID_ARGUMENT } from "../errors/index.js";
|
|
@@ -15,6 +16,28 @@ import { clearDomainCache } from "./utils/domain-lookup.js";
|
|
|
15
16
|
const bootstrapLog = logger.component("bootstrap");
|
|
16
17
|
const bootstrapDevLog = logger.component("bootstrap-dev");
|
|
17
18
|
const bootstrapProdLog = logger.component("bootstrap-prod");
|
|
19
|
+
/**
|
|
20
|
+
* Wire the `TracingExporter` contract (if registered) into the core shim.
|
|
21
|
+
* Must be called after `orchestrateExtensions()` completes.
|
|
22
|
+
*/
|
|
23
|
+
function wireTracingShim() {
|
|
24
|
+
const tracing = tryResolve("TracingExporter");
|
|
25
|
+
if (tracing) {
|
|
26
|
+
setGlobalTracerProvider(tracing.getProvider());
|
|
27
|
+
const metricsApi = tracing.getMetricsAPI();
|
|
28
|
+
if (metricsApi) {
|
|
29
|
+
setGlobalMetricsAPI(metricsApi);
|
|
30
|
+
}
|
|
31
|
+
const traceApi = tracing.getTraceAPI?.();
|
|
32
|
+
if (traceApi) {
|
|
33
|
+
setGlobalActiveSpanAccessor(traceApi);
|
|
34
|
+
}
|
|
35
|
+
bootstrapLog.debug("[bootstrap] TracingExporter wired into shim");
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
bootstrapLog.debug("[bootstrap] no TracingExporter extension — using no-op tracer");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
18
41
|
function combineDispose(extensionLoader, fsDispose) {
|
|
19
42
|
return async () => {
|
|
20
43
|
try {
|
|
@@ -108,6 +131,7 @@ export async function bootstrap(projectDir, adapter) {
|
|
|
108
131
|
config,
|
|
109
132
|
logger: bootstrapLog,
|
|
110
133
|
});
|
|
134
|
+
wireTracingShim();
|
|
111
135
|
return {
|
|
112
136
|
adapter,
|
|
113
137
|
config,
|
|
@@ -138,6 +162,7 @@ export async function bootstrap(projectDir, adapter) {
|
|
|
138
162
|
config,
|
|
139
163
|
logger: bootstrapLog,
|
|
140
164
|
});
|
|
165
|
+
wireTracingShim();
|
|
141
166
|
return {
|
|
142
167
|
adapter,
|
|
143
168
|
config,
|
|
@@ -191,6 +216,7 @@ export async function bootstrap(projectDir, adapter) {
|
|
|
191
216
|
config,
|
|
192
217
|
logger: bootstrapLog,
|
|
193
218
|
}), fsDispose);
|
|
219
|
+
wireTracingShim();
|
|
194
220
|
return {
|
|
195
221
|
adapter: enhancedAdapter,
|
|
196
222
|
config,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../../../src/src/server/context/request-context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../../../src/src/server/context/request-context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAwBjE;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,cAAc,EACnB,cAAc,CAAC,EAAE,OAAO,GACvB,MAAM,GAAG,YAAY,GAAG,WAAW,CAIrC;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,CAExF;AAED,wBAAgB,uBAAuB,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,CAG/F"}
|
|
@@ -5,10 +5,13 @@ export function createRequestContext(req) {
|
|
|
5
5
|
const effectiveHost = getEffectiveRequestHost(req);
|
|
6
6
|
const parsed = parseProjectDomain(effectiveHost);
|
|
7
7
|
const headerProjectSlug = req.headers.get("x-project-slug")?.trim() || undefined;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
// Mode derives from server-trusted signals only. The `x-environment` header
|
|
9
|
+
// is client-controlled and must NOT be able to flip a production request
|
|
10
|
+
// into preview mode (VULN-SRV-1 / VULN-SRV-2). Preview is determined by the
|
|
11
|
+
// HTTP Host / X-Forwarded-Host — those are terminated at the edge proxy and
|
|
12
|
+
// are the same signal used for routing, so they're the correct source of
|
|
13
|
+
// truth.
|
|
14
|
+
const mode = parsed.environment === "preview" || effectiveHost.includes(".preview.")
|
|
12
15
|
? "preview"
|
|
13
16
|
: "production";
|
|
14
17
|
return {
|
|
@@ -174,7 +174,7 @@ export async function setupMiddleware(pipeline, config, requestHandler, projectD
|
|
|
174
174
|
}
|
|
175
175
|
async function enrichSpanWithRequestInfo(method, pathname, requestId) {
|
|
176
176
|
try {
|
|
177
|
-
const { trace } = await import("
|
|
177
|
+
const { trace } = await import("../../observability/tracing/api-shim.js");
|
|
178
178
|
const span = trace.getActiveSpan();
|
|
179
179
|
if (!span)
|
|
180
180
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-file.handler.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/files/dev-file.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"dev-file.handler.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/handlers/dev/files/dev-file.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,aAAa,EACd,MAAM,gBAAgB,CAAC;AAUxB,qBAAa,cAAe,SAAQ,WAAW;IAC7C,QAAQ,EAAE,eAAe,CAOvB;IAEI,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;YAyBzD,iBAAiB;IAmC/B,OAAO,CAAC,iBAAiB;CAM1B"}
|
|
@@ -3,34 +3,24 @@ import { validateDevFilePath } from "./path-validator.js";
|
|
|
3
3
|
import { bundleDevFile } from "./esbuild-bundler.js";
|
|
4
4
|
import { HTTP_INTERNAL_SERVER_ERROR, HTTP_NOT_FOUND, PRIORITY_MEDIUM_DEV_FILES, } from "../../../../utils/constants/index.js";
|
|
5
5
|
import { isExtendedFSAdapter } from "../../../../platform/adapters/fs/wrapper.js";
|
|
6
|
-
import { getHostEnv } from "../../../../platform/compat/process.js";
|
|
7
6
|
export class DevFileHandler extends BaseHandler {
|
|
8
7
|
metadata = {
|
|
9
8
|
name: "DevFileHandler",
|
|
10
9
|
priority: PRIORITY_MEDIUM_DEV_FILES,
|
|
11
10
|
patterns: [{ pattern: "/_veryfront/fs/", prefix: true, method: "GET" }],
|
|
12
|
-
|
|
11
|
+
// Strictly local-only: exposes project source tree (VULN-SRV-1 / VULN-SRV-2).
|
|
12
|
+
// Preview mode (even host-derived) must not unlock this surface.
|
|
13
|
+
enabled: (ctx) => !!ctx.isLocalProject,
|
|
13
14
|
};
|
|
14
15
|
async handle(req, ctx) {
|
|
15
16
|
const { pathname } = new URL(req.url);
|
|
16
|
-
|
|
17
|
-
if (!ctx.isLocalProject && !isPreviewMode)
|
|
17
|
+
if (!ctx.isLocalProject)
|
|
18
18
|
return this.continue();
|
|
19
19
|
if (req.method !== "GET" || !pathname.startsWith("/_veryfront/fs/")) {
|
|
20
20
|
return this.continue();
|
|
21
21
|
}
|
|
22
22
|
const fsAdapter = ctx.adapter.fs;
|
|
23
23
|
const isExtended = isExtendedFSAdapter(fsAdapter);
|
|
24
|
-
if (!ctx.isLocalProject && ctx.projectSlug && isExtended && fsAdapter.isMultiProjectMode()) {
|
|
25
|
-
const effectiveToken = ctx.proxyToken || getHostEnv("VERYFRONT_API_TOKEN") || "";
|
|
26
|
-
const branch = ctx.parsedDomain?.branch ?? null;
|
|
27
|
-
return await fsAdapter.runWithContext(ctx.projectSlug, effectiveToken, () => this.handleWithContext(req, pathname, ctx), ctx.projectId, {
|
|
28
|
-
productionMode: false,
|
|
29
|
-
releaseId: ctx.releaseId,
|
|
30
|
-
branch,
|
|
31
|
-
environmentName: ctx.environmentName,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
24
|
if (isExtended && fsAdapter.isContextualMode()) {
|
|
35
25
|
try {
|
|
36
26
|
if (ctx.proxyToken)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr.service.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/services/rendering/ssr.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,kCAAkC,CAAC;AAsB1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAItE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5D;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB,IAAI,YAAY,CAAC;IACpC,UAAU,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACrF,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;CAC3D;AAUD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,UAAU,GAAG,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,CAAC;IACjF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAqBD,qBAAa,UAAW,YAAW,cAAc;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAA0B;IACrD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;gBAExC,OAAO,CAAC,EAAE;QACpB,SAAS,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QACpC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC;IAKD,mBAAmB,IAAI,YAAY;IAW7B,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAI1D,UAAU,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IA2G1F,OAAO,CAAC,iBAAiB;
|
|
1
|
+
{"version":3,"file":"ssr.service.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/services/rendering/ssr.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,kCAAkC,CAAC;AAsB1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAItE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5D;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB,IAAI,YAAY,CAAC;IACpC,UAAU,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACrF,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;CAC3D;AAUD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,UAAU,GAAG,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,CAAC;IACjF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAqBD,qBAAa,UAAW,YAAW,cAAc;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAA0B;IACrD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;gBAExC,OAAO,CAAC,EAAE;QACpB,SAAS,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QACpC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC;IAKD,mBAAmB,IAAI,YAAY;IAW7B,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAI1D,UAAU,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IA2G1F,OAAO,CAAC,iBAAiB;IAyHzB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;CAS1D"}
|
|
@@ -129,7 +129,10 @@ export class SSRService {
|
|
|
129
129
|
}
|
|
130
130
|
handleRenderError(error, ctx, slug, request, nonce) {
|
|
131
131
|
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
132
|
-
|
|
132
|
+
// Dev-only overlay (full stack, absolute paths, line numbers) must never
|
|
133
|
+
// be exposed outside a local project — including remote preview, which is
|
|
134
|
+
// internet-reachable. See VULN-SRV-1 / VULN-SRV-2.
|
|
135
|
+
const isDev = Boolean(ctx.isLocalProject);
|
|
133
136
|
if (error instanceof VeryfrontError && error.slug === "file-not-found") {
|
|
134
137
|
logger.debug("Page not found", { slug, error: errorObj.message });
|
|
135
138
|
return {
|
|
@@ -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 B=Object.defineProperty;var Y=(t,e,o)=>e in t?B(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var d=(t,e,o)=>Y(t,typeof e!="symbol"?e+"":e,o);var W="3.2.3";function q(t,e,o,n){let s=[];if(n?.external?.length&&s.push(`external=${n.external.join(",")}`),s.push(`target=${n?.target??"es2022"}`),n?.deps){let g=Object.entries(n.deps).map(([a,h])=>`${a}@${h}`).join(",");s.push(`deps=${g}`)}let c=e?`@${e}`:"",l=o??"",u=s.length?`?${s.join("&")}`:"";return`https://esm.sh/${t}${c}${l}${u}`}function R(t,e,o,n=!1){return q(t,e,o,{external:n?["react"]:void 0,deps:{csstype:W}})}var X="19.1.1",f=X;function N(t=f){return{react:R("react",t),"react-dom":R("react-dom",t,void 0,!0),"react-dom/client":R("react-dom",t,"/client",!0),"react-dom/server":R("react-dom",t,"/server",!0),"react/jsx-runtime":R("react",t,"/jsx-runtime",!0),"react/jsx-dev-runtime":R("react",t,"/jsx-dev-runtime",!0)}}function A(t=f){return N(t).react}function D(t=f){return N(t)["react-dom/client"]}function J(t){return t.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function v(t){return J(btoa(t))}var Nt=Object.freeze({react:"","react-dom":"","react-dom/client":"","react-dom/server":"","react/jsx-runtime":"","react/jsx-dev-runtime":""});function S(t,e){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t))return!0;for(let o of Object.keys(e))if(o.endsWith("/")&&t.startsWith(o))return!0;return!1}function K(t){try{return JSON.parse(t)?.imports??{}}catch{return{}}}function L(t=document){let e=t.querySelector(\'script[type="importmap"]\');return e?.textContent?K(e.textContent):{}}var i="/_veryfront",I={RSC:`${i}/rsc/`,FS:`${i}/fs/`,MODULES:`${i}/modules/`,PAGES:`${i}/pages/`,DATA:`${i}/data/`,LIB:`${i}/lib/`,CHUNKS:`${i}/chunks/`,CLIENT:`${i}/client/`},b={HMR_RUNTIME:`${i}/hmr-runtime.js`,HMR:`${i}/hmr.js`,HYDRATE:`${i}/hydrate.js`,ERROR_OVERLAY:`${i}/error-overlay.js`,DEV_LOADER:`${i}/dev-loader.js`,CLIENT_LOG:`${i}/log`,CLIENT_JS:`${i}/client.js`,ROUTER_JS:`${i}/router.js`,PREFETCH_JS:`${i}/prefetch.js`,MANIFEST_JSON:`${i}/manifest.json`,APP_JS:`${i}/app.js`,RSC_CLIENT:`${i}/rsc/client.js`,RSC_MANIFEST:`${i}/rsc/manifest`,RSC_STREAM:`${i}/rsc/stream`,RSC_PAYLOAD:`${i}/rsc/payload`,RSC_RENDER:`${i}/rsc/render`,RSC_PAGE:`${i}/rsc/page`,RSC_MODULE:`${i}/rsc/module`,RSC_DOM:`${i}/rsc/dom.js`,RSC_HYDRATOR:`${i}/rsc/hydrator.js`,RSC_HYDRATE_CLIENT:`${i}/rsc/hydrate-client.js`,LIB_CHAT_REACT:`${i}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${i}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${i}/lib/chat/primitives.js`};var Q={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},bt=Q.CACHE;var Mt={HMR_RUNTIME:b.HMR_RUNTIME,ERROR_OVERLAY:b.ERROR_OVERLAY};var m=I.RSC,M=I.FS,U="veryfront-hydration-data",y="rsc-root";function P(t=document){try{let e=t.getElementById(U);return e?JSON.parse(e.textContent||"{}"):null}catch(e){return console.debug?.("[RSC] hydration data parse failed",e),null}}function V(t){return t?.clientModuleStrategy?t.clientModuleStrategy:t?.dev?"fs":"rsc-module"}function tt(t){return`${M}${v(t)}.js`}function et(t,e){let o=e?`&v=${encodeURIComponent(e)}`:"";return`${m}module?rel=${encodeURIComponent(t)}${o}`}function w(t){if(t.strategy==="fs"){let e=t.absPath??t.rel;return e?tt(e):null}return et(t.rel,t.version)}function F(t=document,e=f){let o=L(t);return{react:S("react",o)?"react":A(e),reactDomClient:S("react-dom/client",o)?"react-dom/client":D(e)}}function r(t){return{...t,create(e){return new C(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 C=class extends Error{constructor(o,n){super(o);d(this,"slug");d(this,"category");d(this,"status");d(this,"title");d(this,"suggestion");d(this,"detail");d(this,"cause");d(this,"instance");d(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 Zt=r({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),Qt=r({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),te=r({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),ee=r({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),re=r({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),oe=r({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),ne=r({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),se=r({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),ie=r({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),ae=r({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),ce=r({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),ue=r({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),le=r({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),ge=r({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),de=r({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),pe=r({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),Re=r({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),me=r({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),Ee=r({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),fe=r({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),ye=r({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),_e=r({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),Oe=r({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),xe=r({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),he=r({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),Se=r({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),Ie=r({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),Ce=r({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),Te=r({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),Ne=r({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"}),Ae=r({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),De=r({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),ve=r({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Le=r({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),be=r({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),Me=r({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"}),Ue=r({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),Pe=r({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),Ve=r({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),we=r({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),Fe=r({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),He=r({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),$e=r({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),ke=r({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Ge=r({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),je=r({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),Be=r({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),Ye=r({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),We=r({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"}),qe=r({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"}),ze=r({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"}),Xe=r({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),Je=r({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"}),Ke=r({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),Ze=r({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),Qe=r({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),tr=r({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),er=r({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),rr=r({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),or=r({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),nr=r({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),sr=r({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),ir=r({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),ar=r({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),cr=r({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),ur=r({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),lr=r({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),gr=r({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),dr=r({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),pr=r({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),Rr=r({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),mr=r({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),Er=r({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),fr=r({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),yr=r({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),_r=r({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),Or=r({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),H=r({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),xr=r({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"});var rt=[{pattern:/<script[^>]*>[\\s\\S]*?<\\/script>/gi,name:"inline script"},{pattern:/javascript:/gi,name:"javascript: URL"},{pattern:/\\bon\\w+\\s*=/gi,name:"event handler attribute"},{pattern:/data:\\s*text\\/html/gi,name:"data: HTML URL"}];function ot(){let t=globalThis;return t.__VERYFRONT_DEV__===!0||t.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function _(t,e={}){let{strict:o=!1,warn:n=!0}=e;for(let{pattern:s,name:c}of rt)if(s.lastIndex=0,!!s.test(t)&&(n&&console.warn(`[Security] Suspicious ${c} detected in server HTML`),o||!ot()))throw H.create({detail:`Potentially unsafe HTML: ${c} detected`});return t}var E=class{constructor(e,o){this.prefix=e;this.level=o}log(e,o,n,...s){this.level>e||o?.(n,...s)}debug(e,...o){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${e}`,...o)}info(e,...o){this.log(1,console.log,`[${this.prefix}] ${e}`,...o)}warn(e,...o){this.log(2,console.warn,`[${this.prefix}] WARN: ${e}`,...o)}error(e,...o){this.log(3,console.error,`[${this.prefix}] ERROR: ${e}`,...o)}};function nt(){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 x=nt(),p=new E("RSC",x),Nr=new E("PREFETCH",x),Ar=new E("HYDRATE",x),Dr=new E("VERYFRONT",x);function O(t,e){let o=e==="root"?y:`rsc-slot-${e}`,n=t.getElementById(o);if(n)return n;let s=t.createElement("div");return s.id=o,t.body.appendChild(s),s}function st(t,e){if(e.type!=="slot")return;let o=O(t,e.id);o.innerHTML=_(String(e.html??""))}function $(t,e){let o=e.split(`\n`),n=o.pop()??"";for(let s of o){let c=s.trim();if(!c)continue;let l;try{l=JSON.parse(c)}catch(g){p.debug("[client-dom] malformed NDJSON line",{line:c,error:g instanceof Error?g.message:String(g)});continue}if(!l||typeof l!="object")continue;let u=l;if(u.type==="slot"){st(t,u);try{ct(t,u.id||"root")}catch(g){p.debug("[client-dom] hydration optional failed",g)}}}return n}function it(t){return new Promise((e,o)=>{let n=()=>o(new DOMException("aborted","AbortError"));if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0})})}async function k(t,e=document,o){let n="body"in t?t:null,s=n?.body??t;if(!s)return;let c=s.getReader(),l=new TextDecoder,u="",g=!1;try{for(;;){if(o?.aborted)throw new DOMException("aborted","AbortError");let a=c.read(),{done:h,value:j}=o?await Promise.race([a,it(o)]):await a;if(h){g=!0;break}u+=l.decode(j,{stream:!0}),u=$(e,u)}u&&$(e,`${u}\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){g||p.debug("[client-dom] reader.cancel failed",a)}try{c.releaseLock()}catch(a){p.debug("[client-dom] reader.releaseLock failed",a)}if(typeof s.cancel=="function")try{await s.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 at(t,e){let o=O(t,e),n=[],s=c=>{let l=c;l.dataset?.clientRef&&n.push(l);for(let u of c.children)s(u)};return s(o),n}function ct(t,e){let o=at(t,e);for(let n of o){let s=n.dataset?.clientRef;s&&(n.dataset.hydrated="true",p.debug("[client-dom] marked for hydration",s))}}async function ut(){let t=F(document),[e,o]=await Promise.all([import(t.react),import(t.reactDomClient)]);return{React:e,ReactDOM:o}}var lt=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function G(t){let e=t.getAttribute("style")??"";return t.hasAttribute("data-veryfront-head")||t.hasAttribute("hidden")||/(?:^|;)\\s*display\\s*:\\s*none(?:\\s*;|$)/i.test(e)||lt.has(t.tagName.toUpperCase())}function gt(t,e){return t.find(o=>o.tagName.toUpperCase()==="DIV"&&!!o.getAttribute("class")?.trim()&&!G(o))??t.find(o=>!G(o))??e}function dt(t,e){return e?.pagePath?!1:!!t.getElementById(y)}async function pt(t){try{let e=await fetch(m+"stream"+t);if(!e.ok||!e.body)return!1;let o=new AbortController;return addEventListener("pagehide",()=>o.abort(),{once:!0}),await k(e,document,o.signal),!0}catch(e){return console.debug?.("[RSC] tryStream failed",e),!1}}async function T(){try{(await import(m+"hydrate.js")).bootHydration?.()}catch(t){console.debug?.("[RSC] hydrate import failed",t)}}async function Rt(t,e){try{let{React:o,ReactDOM:n}=await ut(),s=w({strategy:e,rel:t});if(!s)return!1;console.debug?.("[RSC] Loading component from:",s);let l=(await import(s)).default;if(typeof l!="function")return console.debug?.("[RSC] Page component is not a function"),!1;let u=gt(Array.from(document.body.children),document.body);return n.hydrateRoot(u,o.createElement(l,{}),{identifierPrefix:"vf",onRecoverableError:()=>{}}),console.debug?.("[RSC] Page component hydrated successfully"),!0}catch(o){return console.error("[RSC] Page hydration failed",o),!1}}async function mt(t){try{let e=await fetch(m+"payload"+t);if(!e.ok)return!1;let o=await e.json();if(o?.slots){for(let[n,s]of Object.entries(o.slots))O(document,n).innerHTML=_(String(s||""));return!0}return O(document,y).innerHTML=_(String(o?.html||"")),!0}catch(e){return console.debug?.("[RSC] payload fetch failed",e),!1}}async function Et(){try{let t=globalThis.window?.location.search??"",e=P(document),o=e?.pagePath,n=V(e);if(o){console.debug?.("[RSC] Found page component in hydration data:",o),await Rt(o,n)&&console.debug?.("[RSC] Client component hydrated successfully");return}if(!dt(document,e))return;if(await pt(t)){await T();return}if(await mt(t)){await T();return}await T()}catch(t){console.error("[RSC] boot failed",t)}}if(typeof document<"u"){let t=()=>{Et()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{Et as boot,gt as selectHydrationRoot,dt as shouldAttemptRSCTransport};\n';
|
|
8
|
+
export const CLIENT_BOOT_BUNDLE = 'var B=Object.defineProperty;var Y=(t,e,o)=>e in t?B(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var d=(t,e,o)=>Y(t,typeof e!="symbol"?e+"":e,o);var W="3.2.3";function q(t,e,o,n){let s=[];if(n?.external?.length&&s.push(`external=${n.external.join(",")}`),s.push(`target=${n?.target??"es2022"}`),n?.deps){let g=Object.entries(n.deps).map(([a,h])=>`${a}@${h}`).join(",");s.push(`deps=${g}`)}let c=e?`@${e}`:"",l=o??"",u=s.length?`?${s.join("&")}`:"";return`https://esm.sh/${t}${c}${l}${u}`}function R(t,e,o,n=!1){return q(t,e,o,{external:n?["react"]:void 0,deps:{csstype:W}})}var X="19.1.1",f=X;function N(t=f){return{react:R("react",t),"react-dom":R("react-dom",t,void 0,!0),"react-dom/client":R("react-dom",t,"/client",!0),"react-dom/server":R("react-dom",t,"/server",!0),"react/jsx-runtime":R("react",t,"/jsx-runtime",!0),"react/jsx-dev-runtime":R("react",t,"/jsx-dev-runtime",!0)}}function A(t=f){return N(t).react}function D(t=f){return N(t)["react-dom/client"]}function J(t){return t.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function v(t){return J(btoa(t))}var Nt=Object.freeze({react:"","react-dom":"","react-dom/client":"","react-dom/server":"","react/jsx-runtime":"","react/jsx-dev-runtime":""});function S(t,e){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t))return!0;for(let o of Object.keys(e))if(o.endsWith("/")&&t.startsWith(o))return!0;return!1}function K(t){try{return JSON.parse(t)?.imports??{}}catch{return{}}}function L(t=document){let e=t.querySelector(\'script[type="importmap"]\');return e?.textContent?K(e.textContent):{}}var i="/_veryfront",I={RSC:`${i}/rsc/`,FS:`${i}/fs/`,MODULES:`${i}/modules/`,PAGES:`${i}/pages/`,DATA:`${i}/data/`,LIB:`${i}/lib/`,CHUNKS:`${i}/chunks/`,CLIENT:`${i}/client/`},b={HMR_RUNTIME:`${i}/hmr-runtime.js`,HMR:`${i}/hmr.js`,HYDRATE:`${i}/hydrate.js`,ERROR_OVERLAY:`${i}/error-overlay.js`,DEV_LOADER:`${i}/dev-loader.js`,CLIENT_LOG:`${i}/log`,CLIENT_JS:`${i}/client.js`,ROUTER_JS:`${i}/router.js`,PREFETCH_JS:`${i}/prefetch.js`,MANIFEST_JSON:`${i}/manifest.json`,APP_JS:`${i}/app.js`,RSC_CLIENT:`${i}/rsc/client.js`,RSC_MANIFEST:`${i}/rsc/manifest`,RSC_STREAM:`${i}/rsc/stream`,RSC_PAYLOAD:`${i}/rsc/payload`,RSC_RENDER:`${i}/rsc/render`,RSC_PAGE:`${i}/rsc/page`,RSC_MODULE:`${i}/rsc/module`,RSC_DOM:`${i}/rsc/dom.js`,RSC_HYDRATOR:`${i}/rsc/hydrator.js`,RSC_HYDRATE_CLIENT:`${i}/rsc/hydrate-client.js`,LIB_CHAT_REACT:`${i}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${i}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${i}/lib/chat/primitives.js`};var Q={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},bt=Q.CACHE;var Mt={HMR_RUNTIME:b.HMR_RUNTIME,ERROR_OVERLAY:b.ERROR_OVERLAY};var E=I.RSC,M=I.FS,U="veryfront-hydration-data",y="rsc-root";function P(t=document){try{let e=t.getElementById(U);return e?JSON.parse(e.textContent||"{}"):null}catch(e){return console.debug?.("[RSC] hydration data parse failed",e),null}}function V(t){return t?.clientModuleStrategy?t.clientModuleStrategy:t?.dev?"fs":"rsc-module"}function tt(t){return`${M}${v(t)}.js`}function et(t,e){let o=e?`&v=${encodeURIComponent(e)}`:"";return`${E}module?rel=${encodeURIComponent(t)}${o}`}function w(t){if(t.strategy==="fs"){let e=t.absPath??t.rel;return e?tt(e):null}return et(t.rel,t.version)}function F(t=document,e=f){let o=L(t);return{react:S("react",o)?"react":A(e),reactDomClient:S("react-dom/client",o)?"react-dom/client":D(e)}}function r(t){return{...t,create(e){return new C(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 C=class extends Error{constructor(o,n){super(o);d(this,"slug");d(this,"category");d(this,"status");d(this,"title");d(this,"suggestion");d(this,"detail");d(this,"cause");d(this,"instance");d(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 Zt=r({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),Qt=r({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),te=r({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),ee=r({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),re=r({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),oe=r({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),ne=r({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),se=r({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),ie=r({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),ae=r({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),ce=r({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),ue=r({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),le=r({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),ge=r({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),de=r({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),pe=r({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),Re=r({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),Ee=r({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),me=r({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),fe=r({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),ye=r({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),_e=r({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),Oe=r({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),xe=r({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),he=r({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),Se=r({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),Ie=r({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),Ce=r({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),Te=r({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),Ne=r({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"}),Ae=r({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),De=r({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),ve=r({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Le=r({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),be=r({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),Me=r({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"}),Ue=r({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),Pe=r({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),Ve=r({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),we=r({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),Fe=r({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),He=r({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),$e=r({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),ke=r({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Ge=r({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),je=r({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),Be=r({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),Ye=r({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),We=r({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"}),qe=r({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"}),ze=r({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"}),Xe=r({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),Je=r({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"}),Ke=r({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),Ze=r({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),Qe=r({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),tr=r({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),er=r({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),rr=r({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),or=r({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),nr=r({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),sr=r({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),ir=r({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),ar=r({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),cr=r({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),ur=r({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),lr=r({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),gr=r({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),dr=r({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),pr=r({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),Rr=r({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),Er=r({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),mr=r({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),fr=r({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),yr=r({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),_r=r({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),Or=r({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),H=r({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),xr=r({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"});var rt=[{pattern:/<script[^>]*>[\\s\\S]*?<\\/script>/gi,name:"inline script"},{pattern:/javascript:/gi,name:"javascript: URL"},{pattern:/\\bon\\w+\\s*=/gi,name:"event handler attribute"},{pattern:/data:\\s*text\\/html/gi,name:"data: HTML URL"}];function ot(){let t=globalThis;return t.__VERYFRONT_DEV__===!0||t.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function _(t,e={}){let{strict:o=!1,warn:n=!0}=e;for(let{pattern:s,name:c}of rt)if(s.lastIndex=0,!!s.test(t)&&(n&&console.warn(`[Security] Suspicious ${c} detected in server HTML`),o||!ot()))throw H.create({detail:`Potentially unsafe HTML: ${c} detected`});return t}var m=class{constructor(e,o){this.prefix=e;this.level=o}log(e,o,n,...s){this.level>e||o?.(n,...s)}debug(e,...o){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${e}`,...o)}info(e,...o){this.log(1,console.log,`[${this.prefix}] ${e}`,...o)}warn(e,...o){this.log(2,console.warn,`[${this.prefix}] WARN: ${e}`,...o)}error(e,...o){this.log(3,console.error,`[${this.prefix}] ERROR: ${e}`,...o)}};function nt(){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 x=nt(),p=new m("RSC",x),Nr=new m("PREFETCH",x),Ar=new m("HYDRATE",x),Dr=new m("VERYFRONT",x);function O(t,e){let o=e==="root"?y:`rsc-slot-${e}`,n=t.getElementById(o);if(n)return n;let s=t.createElement("div");return s.id=o,t.body.appendChild(s),s}function st(t,e){if(e.type!=="slot")return;let o=O(t,e.id);o.innerHTML=_(String(e.html??""))}function $(t,e){let o=e.split(`\n`),n=o.pop()??"";for(let s of o){let c=s.trim();if(!c)continue;let l;try{l=JSON.parse(c)}catch(g){p.debug("[client-dom] malformed NDJSON line",{line:c,error:g instanceof Error?g.message:String(g)});continue}if(!l||typeof l!="object")continue;let u=l;if(u.type==="slot"){st(t,u);try{ct(t,u.id||"root")}catch(g){p.debug("[client-dom] hydration optional failed",g)}}}return n}function it(t){return new Promise((e,o)=>{let n=()=>o(new DOMException("aborted","AbortError"));if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0})})}async function k(t,e=document,o){let n="body"in t?t:null,s=n?.body??t;if(!s)return;let c=s.getReader(),l=new TextDecoder,u="",g=!1;try{for(;;){if(o?.aborted)throw new DOMException("aborted","AbortError");let a=c.read(),{done:h,value:j}=o?await Promise.race([a,it(o)]):await a;if(h){g=!0;break}u+=l.decode(j,{stream:!0}),u=$(e,u)}u&&$(e,`${u}\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){g||p.debug("[client-dom] reader.cancel failed",a)}try{c.releaseLock()}catch(a){p.debug("[client-dom] reader.releaseLock failed",a)}if(typeof s.cancel=="function")try{await s.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 at(t,e){let o=O(t,e),n=[],s=c=>{let l=c;l.dataset?.clientRef&&n.push(l);for(let u of c.children)s(u)};return s(o),n}function ct(t,e){let o=at(t,e);for(let n of o){let s=n.dataset?.clientRef;s&&(n.dataset.hydrated="true",p.debug("[client-dom] marked for hydration",s))}}async function ut(){let t=F(document),[e,o]=await Promise.all([import(t.react),import(t.reactDomClient)]);return{React:e,ReactDOM:o}}var lt=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function G(t){let e=t.getAttribute("style")??"";return t.hasAttribute("data-veryfront-head")||t.hasAttribute("hidden")||/(?:^|;)\\s*display\\s*:\\s*none(?:\\s*;|$)/i.test(e)||lt.has(t.tagName.toUpperCase())}function gt(t,e){return t.find(o=>o.tagName.toUpperCase()==="DIV"&&!!o.getAttribute("class")?.trim()&&!G(o))??t.find(o=>!G(o))??e}function dt(t,e){return e?.pagePath?!1:!!t.getElementById(y)}async function pt(t){try{let e=await fetch(E+"stream"+t);if(!e.ok||!e.body)return!1;let o=new AbortController;return addEventListener("pagehide",()=>o.abort(),{once:!0}),await k(e,document,o.signal),!0}catch(e){return console.debug?.("[RSC] tryStream failed",e),!1}}async function T(){try{(await import(E+"hydrate.js")).bootHydration?.()}catch(t){console.debug?.("[RSC] hydrate import failed",t)}}async function Rt(t,e){try{let{React:o,ReactDOM:n}=await ut(),s=w({strategy:e,rel:t});if(!s)return!1;console.debug?.("[RSC] Loading component from:",s);let l=(await import(s)).default;if(typeof l!="function")return console.debug?.("[RSC] Page component is not a function"),!1;let u=gt(Array.from(document.body.children),document.body);return n.hydrateRoot(u,o.createElement(l,{}),{identifierPrefix:"vf",onRecoverableError:()=>{}}),console.debug?.("[RSC] Page component hydrated successfully"),!0}catch(o){return console.error("[RSC] Page hydration failed",o),!1}}async function Et(t){try{let e=await fetch(E+"payload"+t);if(!e.ok)return!1;let o=await e.json();if(o?.slots){for(let[n,s]of Object.entries(o.slots))O(document,n).innerHTML=_(String(s||""));return!0}return O(document,y).innerHTML=_(String(o?.html||"")),!0}catch(e){return console.debug?.("[RSC] payload fetch failed",e),!1}}async function mt(){try{let t=globalThis.window?.location.search??"",e=P(document),o=e?.pagePath,n=V(e);if(o){console.debug?.("[RSC] Found page component in hydration data:",o),await Rt(o,n)&&console.debug?.("[RSC] Client component hydrated successfully");return}if(!dt(document,e))return;if(await pt(t)){await T();return}if(await Et(t)){await T();return}await T()}catch(t){console.error("[RSC] boot failed",t)}}if(typeof document<"u"){let t=()=>{mt()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{mt as boot,gt as selectHydrationRoot,dt as shouldAttemptRSCTransport};\n';
|
|
9
9
|
export const CLIENT_DOM_BUNDLE = 'var N=Object.defineProperty;var A=(r,t,o)=>t in r?N(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var u=(r,t,o)=>A(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);u(this,"slug");u(this,"category");u(this,"status");u(this,"title");u(this,"suggestion");u(this,"detail");u(this,"cause");u(this,"instance");u(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 z=e({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),W=e({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),X=e({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),J=e({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),K=e({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),Z=e({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),Q=e({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),ee=e({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),te=e({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),re=e({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),oe=e({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),se=e({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),ne=e({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),ie=e({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),ae=e({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),ce=e({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),le=e({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),ue=e({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),ge=e({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),de=e({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),pe=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"}),Ee=e({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),Re=e({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),fe=e({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),ye=e({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),me=e({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),_e=e({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),Oe=e({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),Te=e({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),he=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"}),Ie=e({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),ve=e({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),xe=e({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Ne=e({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Ae=e({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),Ce=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"}),Se=e({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),De=e({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),Le=e({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),Ue=e({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),be=e({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),Me=e({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),Pe=e({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),Ve=e({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Fe=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"}),Ge=e({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),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"}),$e=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"}),Ye=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.)"}),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"}),Xe=e({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),Je=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"}),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"}),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"}),st=e({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),nt=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:"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"}),ut=e({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),gt=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"}),pt=e({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),Et=e({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),Rt=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"}),ft=e({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"});var C=[{pattern:/<script[^>]*>[\\s\\S]*?<\\/script>/gi,name:"inline script"},{pattern:/javascript:/gi,name:"javascript: URL"},{pattern:/\\bon\\w+\\s*=/gi,name:"event handler attribute"},{pattern:/data:\\s*text\\/html/gi,name:"data: HTML URL"}];function S(){let r=globalThis;return r.__VERYFRONT_DEV__===!0||r.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function _(r,t={}){let{strict:o=!1,warn:n=!0}=t;for(let{pattern:i,name:c}of C)if(i.lastIndex=0,!!i.test(r)&&(n&&console.warn(`[Security] Suspicious ${c} detected in server HTML`),o||!S()))throw m.create({detail:`Potentially unsafe HTML: ${c} detected`});return r}var E=class{constructor(t,o){this.prefix=t;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 D(){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=D(),d=new E("RSC",R),ht=new E("PREFETCH",R),It=new E("HYDRATE",R),vt=new E("VERYFRONT",R);var s="/_veryfront",y={RSC:`${s}/rsc/`,FS:`${s}/fs/`,MODULES:`${s}/modules/`,PAGES:`${s}/pages/`,DATA:`${s}/data/`,LIB:`${s}/lib/`,CHUNKS:`${s}/chunks/`,CLIENT:`${s}/client/`},O={HMR_RUNTIME:`${s}/hmr-runtime.js`,HMR:`${s}/hmr.js`,HYDRATE:`${s}/hydrate.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`,RSC_HYDRATOR:`${s}/rsc/hydrator.js`,RSC_HYDRATE_CLIENT:`${s}/rsc/hydrate-client.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 U={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},St=U.CACHE;var Dt={HMR_RUNTIME:O.HMR_RUNTIME,ERROR_OVERLAY:O.ERROR_OVERLAY};var Mt=y.RSC,Pt=y.FS;var T="rsc-root";function I(r,t){let o=t==="root"?T:`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 b(r,t){if(t.type!=="slot")return;let o=I(r,t.id);o.innerHTML=_(String(t.html??""))}function h(r,t){let o=t.split(`\n`),n=o.pop()??"";for(let i of o){let c=i.trim();if(!c)continue;let g;try{g=JSON.parse(c)}catch(p){d.debug("[client-dom] malformed NDJSON line",{line:c,error:p instanceof Error?p.message:String(p)});continue}if(!g||typeof g!="object")continue;let l=g;if(l.type==="slot"){b(r,l);try{V(r,l.id||"root")}catch(p){d.debug("[client-dom] hydration optional failed",p)}}}return n}function M(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 Gt(r,t=document,o){let n="body"in r?r:null,i=n?.body??r;if(!i)return;let c=i.getReader(),g=new TextDecoder,l="",p=!1;try{for(;;){if(o?.aborted)throw new DOMException("aborted","AbortError");let a=c.read(),{done:v,value:x}=o?await Promise.race([a,M(o)]):await a;if(v){p=!0;break}l+=g.decode(x,{stream:!0}),l=h(t,l)}l&&h(t,`${l}\n`)}catch(a){throw a instanceof Error&&a.name==="AbortError"||d.debug("[client-dom] consumeNdjsonStream error",a),a}finally{try{await c.cancel()}catch(a){p||d.debug("[client-dom] reader.cancel failed",a)}try{c.releaseLock()}catch(a){d.debug("[client-dom] reader.releaseLock failed",a)}if(typeof i.cancel=="function")try{await i.cancel()}catch(a){d.debug("[client-dom] stream.cancel failed",a)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(a){d.debug("[client-dom] response.body.cancel failed",a)}}}function P(r,t){let o=I(r,t),n=[],i=c=>{let g=c;g.dataset?.clientRef&&n.push(g);for(let l of c.children)i(l)};return i(o),n}function V(r,t){let o=P(r,t);for(let n of o){let i=n.dataset?.clientRef;i&&(n.dataset.hydrated="true",d.debug("[client-dom] marked for hydration",i))}}export{Gt as consumeNdjsonStream,I as getContainer};\n';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.248";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|