veryfront 0.1.74 → 0.1.75
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/commands/knowledge/command.d.ts +2 -0
- package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command.js +64 -1
- package/esm/deno.d.ts +2 -0
- package/esm/deno.js +3 -1
- package/esm/src/data/data-fetcher.d.ts +11 -1
- package/esm/src/data/data-fetcher.d.ts.map +1 -1
- package/esm/src/data/data-fetcher.js +5 -2
- package/esm/src/data/index.d.ts +1 -1
- package/esm/src/data/index.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.d.ts +14 -1
- package/esm/src/data/server-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.js +49 -3
- package/esm/src/rendering/orchestrator/lifecycle.d.ts +4 -0
- package/esm/src/rendering/orchestrator/lifecycle.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/lifecycle.js +8 -0
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +6 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts +26 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.js +77 -1
- package/esm/src/routing/api/handler.d.ts.map +1 -1
- package/esm/src/routing/api/handler.js +6 -2
- package/esm/src/routing/api/route-executor.d.ts +8 -2
- package/esm/src/routing/api/route-executor.d.ts.map +1 -1
- package/esm/src/routing/api/route-executor.js +131 -3
- package/esm/src/security/deno-permissions.d.ts +6 -0
- package/esm/src/security/deno-permissions.d.ts.map +1 -1
- package/esm/src/security/deno-permissions.js +10 -0
- package/esm/src/security/sandbox/project-worker.d.ts +61 -0
- package/esm/src/security/sandbox/project-worker.d.ts.map +1 -0
- package/esm/src/security/sandbox/project-worker.js +318 -0
- package/esm/src/security/sandbox/worker-permissions.d.ts +30 -0
- package/esm/src/security/sandbox/worker-permissions.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-permissions.js +60 -0
- package/esm/src/security/sandbox/worker-pool.d.ts +87 -0
- package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-pool.js +356 -0
- package/esm/src/security/sandbox/worker-types.d.ts +165 -0
- package/esm/src/security/sandbox/worker-types.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-types.js +17 -0
- package/esm/src/server/project-env/storage.d.ts +6 -0
- package/esm/src/server/project-env/storage.d.ts.map +1 -1
- package/esm/src/server/project-env/storage.js +8 -0
- package/esm/src/server/runtime-handler/project-isolation.d.ts +5 -0
- package/esm/src/server/runtime-handler/project-isolation.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/project-isolation.js +44 -0
- package/esm/src/server/shared/renderer/memory/pressure.d.ts +7 -0
- package/esm/src/server/shared/renderer/memory/pressure.d.ts.map +1 -1
- package/esm/src/server/shared/renderer/memory/pressure.js +7 -0
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts +4 -4
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.js +15 -15
- package/esm/src/utils/index.d.ts +10 -1
- package/esm/src/utils/index.d.ts.map +1 -1
- package/esm/src/utils/index.js +9 -1
- package/esm/src/utils/logger/index.d.ts +1 -1
- package/esm/src/utils/logger/index.d.ts.map +1 -1
- package/esm/src/utils/logger/index.js +1 -1
- package/esm/src/utils/logger/logger.d.ts +14 -0
- package/esm/src/utils/logger/logger.d.ts.map +1 -1
- package/esm/src/utils/logger/logger.js +17 -0
- package/esm/src/workflow/claude-code/tool.d.ts +5 -5
- package/package.json +4 -1
- package/src/cli/commands/knowledge/command.ts +76 -1
- package/src/deno.js +3 -1
- package/src/src/data/data-fetcher.ts +18 -2
- package/src/src/data/index.ts +1 -1
- package/src/src/data/server-data-fetcher.ts +78 -3
- package/src/src/rendering/orchestrator/lifecycle.ts +11 -0
- package/src/src/rendering/orchestrator/pipeline.ts +7 -2
- package/src/src/rendering/orchestrator/ssr-orchestrator.ts +119 -0
- package/src/src/routing/api/handler.ts +16 -3
- package/src/src/routing/api/route-executor.ts +222 -1
- package/src/src/security/deno-permissions.ts +11 -0
- package/src/src/security/sandbox/project-worker.ts +416 -0
- package/src/src/security/sandbox/worker-permissions.ts +74 -0
- package/src/src/security/sandbox/worker-pool.ts +451 -0
- package/src/src/security/sandbox/worker-types.ts +209 -0
- package/src/src/server/project-env/storage.ts +9 -0
- package/src/src/server/runtime-handler/project-isolation.ts +53 -0
- package/src/src/server/shared/renderer/memory/pressure.ts +8 -0
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.ts +18 -12
- package/src/src/utils/index.ts +11 -0
- package/src/src/utils/logger/index.ts +1 -0
- package/src/src/utils/logger/logger.ts +34 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Isolation Types
|
|
3
|
+
*
|
|
4
|
+
* Shared type definitions for the worker isolation system.
|
|
5
|
+
* Used by both the main process and worker script.
|
|
6
|
+
*
|
|
7
|
+
* @module security/sandbox/worker-types
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_WORKER_POOL_CONFIG = {
|
|
10
|
+
maxPoolSize: 20,
|
|
11
|
+
idleTimeoutMs: 300_000,
|
|
12
|
+
requestTimeoutMs: 30_000,
|
|
13
|
+
healthCheckIntervalMs: 30_000,
|
|
14
|
+
maxRequestsPerWorker: 1_000,
|
|
15
|
+
maxWorkerAgeMs: 600_000,
|
|
16
|
+
memoryBudgetMb: 64,
|
|
17
|
+
};
|
|
@@ -14,4 +14,10 @@ export declare function getProjectEnv(key: string): string | undefined;
|
|
|
14
14
|
* to prevent remote projects from reading host-level secrets.
|
|
15
15
|
*/
|
|
16
16
|
export declare function isProjectEnvActive(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get a snapshot of the current project env overlay.
|
|
19
|
+
* Returns undefined if no overlay is active.
|
|
20
|
+
* Used to forward env vars to isolated workers in proxy mode.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getProjectEnvSnapshot(): Record<string, string> | undefined;
|
|
17
23
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/storage.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEjF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C"}
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/src/server/project-env/storage.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAEjF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAE1E"}
|
|
@@ -31,6 +31,14 @@ export function getProjectEnv(key) {
|
|
|
31
31
|
export function isProjectEnvActive() {
|
|
32
32
|
return projectEnvStorage.getStore() !== undefined;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Get a snapshot of the current project env overlay.
|
|
36
|
+
* Returns undefined if no overlay is active.
|
|
37
|
+
* Used to forward env vars to isolated workers in proxy mode.
|
|
38
|
+
*/
|
|
39
|
+
export function getProjectEnvSnapshot() {
|
|
40
|
+
return projectEnvStorage.getStore();
|
|
41
|
+
}
|
|
34
42
|
// Register on globalThis so process.ts can access without circular imports.
|
|
35
43
|
// process.ts is low-level (platform/compat), project-env is high-level (server/).
|
|
36
44
|
dntShim.dntGlobalThis.__vfProjectEnvGetter = getProjectEnv;
|
|
@@ -19,6 +19,11 @@ export declare class ProjectIsolationManager {
|
|
|
19
19
|
checkRequest(projectSlug: string | undefined): IsolationCheckResult;
|
|
20
20
|
startRequest(projectSlug: string | undefined): void;
|
|
21
21
|
completeRequest(projectSlug: string | undefined, timedOut: boolean): void;
|
|
22
|
+
/**
|
|
23
|
+
* Record a worker crash for a project. This counts as a failure
|
|
24
|
+
* toward the circuit breaker threshold and evicts the worker.
|
|
25
|
+
*/
|
|
26
|
+
recordWorkerCrash(projectSlug: string | undefined): void;
|
|
22
27
|
getStats(): Record<string, {
|
|
23
28
|
inFlight: number;
|
|
24
29
|
recentFailures: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-isolation.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/project-isolation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project-isolation.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/project-isolation.ts"],"names":[],"mappings":"AAUA,UAAU,sBAAsB;IAC9B,uBAAuB,EAAE,MAAM,CAAC;IAChC,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB;AAUD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AASD,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,eAAe,CAAqD;gBAEhE,MAAM,GAAE,OAAO,CAAC,sBAAsB,CAAM;IAKxD,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,gBAAgB;IAgBxB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,oBAAoB;IAsCnE,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAQnD,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IA4BzE;;;OAGG;IACH,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAoCxD,QAAQ,IAAI,MAAM,CAChB,MAAM,EACN;QACE,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,OAAO,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;KACvB,CACF;IAyBD,QAAQ,IAAI,IAAI;CAajB;AAED,eAAO,MAAM,gBAAgB,yBAI3B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
2
|
import { serverLogger } from "../../utils/index.js";
|
|
3
3
|
import { getEnvNumber, unrefTimer } from "../../platform/compat/process.js";
|
|
4
|
+
import { getWorkerPool, isWorkerIsolationEnabled, } from "../../security/sandbox/worker-pool.js";
|
|
4
5
|
const logger = serverLogger.component("project-isolation");
|
|
5
6
|
const DEFAULT_CONFIG = {
|
|
6
7
|
maxConcurrentPerProject: 20,
|
|
@@ -106,6 +107,40 @@ export class ProjectIsolationManager {
|
|
|
106
107
|
resetAfterMs: this.config.circuitResetTimeMs,
|
|
107
108
|
});
|
|
108
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Record a worker crash for a project. This counts as a failure
|
|
112
|
+
* toward the circuit breaker threshold and evicts the worker.
|
|
113
|
+
*/
|
|
114
|
+
recordWorkerCrash(projectSlug) {
|
|
115
|
+
if (!projectSlug)
|
|
116
|
+
return;
|
|
117
|
+
const state = this.getOrCreateState(projectSlug);
|
|
118
|
+
const now = Date.now();
|
|
119
|
+
state.failures.push(now);
|
|
120
|
+
state.failures = state.failures.filter((t) => now - t < this.config.failureWindowMs);
|
|
121
|
+
logger.warn("Worker crash recorded", {
|
|
122
|
+
projectSlug,
|
|
123
|
+
recentFailures: state.failures.length,
|
|
124
|
+
});
|
|
125
|
+
// Evict the crashed worker from the pool
|
|
126
|
+
if (isWorkerIsolationEnabled()) {
|
|
127
|
+
try {
|
|
128
|
+
getWorkerPool().evictWorker(projectSlug);
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// Pool may not be initialized
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (state.failures.length < this.config.circuitBreakerThreshold)
|
|
135
|
+
return;
|
|
136
|
+
state.circuitOpenedAt = now;
|
|
137
|
+
logger.error("Circuit opened due to worker crashes", {
|
|
138
|
+
projectSlug,
|
|
139
|
+
recentFailures: state.failures.length,
|
|
140
|
+
threshold: this.config.circuitBreakerThreshold,
|
|
141
|
+
resetAfterMs: this.config.circuitResetTimeMs,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
109
144
|
getStats() {
|
|
110
145
|
const stats = {};
|
|
111
146
|
for (const [slug, state] of this.projects.entries()) {
|
|
@@ -123,6 +158,15 @@ export class ProjectIsolationManager {
|
|
|
123
158
|
if (this.cleanupInterval)
|
|
124
159
|
clearInterval(this.cleanupInterval);
|
|
125
160
|
this.projects.clear();
|
|
161
|
+
// Shut down the worker pool if isolation is enabled
|
|
162
|
+
if (isWorkerIsolationEnabled()) {
|
|
163
|
+
try {
|
|
164
|
+
getWorkerPool().shutdown();
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// Pool may not be initialized
|
|
168
|
+
}
|
|
169
|
+
}
|
|
126
170
|
}
|
|
127
171
|
}
|
|
128
172
|
export const projectIsolation = new ProjectIsolationManager({
|
|
@@ -13,5 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @module server/shared/renderer/memory/pressure
|
|
15
15
|
*/
|
|
16
|
+
type MemoryPressureLevel = "normal" | "warning" | "high" | "critical";
|
|
16
17
|
export declare function shouldRejectDueToMemory(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get current memory pressure level for use by the worker pool
|
|
20
|
+
* to decide whether to evict idle workers.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getMemoryPressureLevel(): MemoryPressureLevel;
|
|
23
|
+
export {};
|
|
17
24
|
//# sourceMappingURL=pressure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressure.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/shared/renderer/memory/pressure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"pressure.d.ts","sourceRoot":"","sources":["../../../../../../src/src/server/shared/renderer/memory/pressure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH,KAAK,mBAAmB,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AA+BtE,wBAAgB,uBAAuB,IAAI,OAAO,CAMjD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,mBAAmB,CAE5D"}
|
|
@@ -51,3 +51,10 @@ export function shouldRejectDueToMemory() {
|
|
|
51
51
|
rendererLog.warn("Rejecting request - memory critical", { heapUsedPercent });
|
|
52
52
|
return true;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Get current memory pressure level for use by the worker pool
|
|
56
|
+
* to decide whether to evict idle workers.
|
|
57
|
+
*/
|
|
58
|
+
export function getMemoryPressureLevel() {
|
|
59
|
+
return getMemoryPressure().level;
|
|
60
|
+
}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* framework source files on disk.
|
|
6
6
|
*/
|
|
7
7
|
import { createFileSystem } from "../../../../platform/compat/fs.js";
|
|
8
|
-
export declare function tryReadWithExtensions(fs: ReturnType<typeof createFileSystem>, basePath: string): Promise<{
|
|
8
|
+
export declare function tryReadWithExtensions(fs: ReturnType<typeof createFileSystem>, basePath: string, existsFn?: (path: string) => Promise<boolean>): Promise<{
|
|
9
9
|
sourcePath: string;
|
|
10
10
|
content: string;
|
|
11
11
|
} | null>;
|
|
12
12
|
/**
|
|
13
13
|
* Resolve a /_vf_modules/ path to the actual framework source file.
|
|
14
14
|
*/
|
|
15
|
-
export declare function resolveFrameworkFile(vfModulePath: string, fs: ReturnType<typeof createFileSystem>): Promise<{
|
|
15
|
+
export declare function resolveFrameworkFile(vfModulePath: string, fs: ReturnType<typeof createFileSystem>, existsFn?: (path: string) => Promise<boolean>): Promise<{
|
|
16
16
|
sourcePath: string;
|
|
17
17
|
content: string;
|
|
18
18
|
} | null>;
|
|
@@ -24,7 +24,7 @@ export declare function resolveFrameworkFile(vfModulePath: string, fs: ReturnTyp
|
|
|
24
24
|
* then falls back to regular src/. This matches resolveFrameworkFile's behavior
|
|
25
25
|
* and ensures consistent path resolution for cycle detection.
|
|
26
26
|
*/
|
|
27
|
-
export declare function resolveVeryfrontSourcePath(specifier: string): Promise<string | null>;
|
|
27
|
+
export declare function resolveVeryfrontSourcePath(specifier: string, existsFn?: (path: string) => Promise<boolean>): Promise<string | null>;
|
|
28
28
|
/**
|
|
29
29
|
* Resolve a relative import path to an absolute framework source path.
|
|
30
30
|
* Given sourcePath=/foo/bar/index.ts and specifier=./Head.tsx, returns /foo/bar/Head.tsx
|
|
@@ -32,5 +32,5 @@ export declare function resolveVeryfrontSourcePath(specifier: string): Promise<s
|
|
|
32
32
|
* Handles both regular source files (.tsx, .ts) and embedded sources (.tsx.src, .ts.src)
|
|
33
33
|
* for compiled binaries.
|
|
34
34
|
*/
|
|
35
|
-
export declare function resolveRelativeFrameworkImport(specifier: string, fromSourcePath: string, _fs: ReturnType<typeof createFileSystem>): Promise<string | null>;
|
|
35
|
+
export declare function resolveRelativeFrameworkImport(specifier: string, fromSourcePath: string, _fs: ReturnType<typeof createFileSystem>, existsFn?: (path: string) => Promise<boolean>): Promise<string | null>;
|
|
36
36
|
//# sourceMappingURL=path-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-resolver.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAU,MAAM,mCAAmC,CAAC;AAY7E,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EACvC,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"path-resolver.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAU,MAAM,mCAAmC,CAAC;AAY7E,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAU,GACpD,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAmBzD;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EACvC,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAU,GACpD,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CA6DzD;AAED;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAC9C,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAU,GACpD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkExB;AAED;;;;;;GAMG;AACH,wBAAsB,8BAA8B,CAClD,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EACxC,QAAQ,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAU,GACpD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiExB"}
|
|
@@ -9,7 +9,7 @@ import { join } from "../../../../platform/compat/path/index.js";
|
|
|
9
9
|
import { rendererLogger as logger } from "../../../../utils/index.js";
|
|
10
10
|
import { resolveInternalModuleTarget } from "../../../veryfront-module-urls.js";
|
|
11
11
|
import { EMBEDDED_SRC_DIR, EXTENSIONS, FRAMEWORK_LOOKUPS, FRAMEWORK_ROOT, LOG_PREFIX, } from "./constants.js";
|
|
12
|
-
export async function tryReadWithExtensions(fs, basePath) {
|
|
12
|
+
export async function tryReadWithExtensions(fs, basePath, existsFn = exists) {
|
|
13
13
|
// Try all extensions, including .src versions for embedded sources
|
|
14
14
|
const allExtensions = [
|
|
15
15
|
...EXTENSIONS.map((ext) => ext + ".src"), // Embedded sources (.tsx.src, .ts.src, etc.)
|
|
@@ -18,7 +18,7 @@ export async function tryReadWithExtensions(fs, basePath) {
|
|
|
18
18
|
for (const ext of allExtensions) {
|
|
19
19
|
const sourcePath = basePath + ext;
|
|
20
20
|
try {
|
|
21
|
-
if (await
|
|
21
|
+
if (await existsFn(sourcePath)) {
|
|
22
22
|
const content = await fs.readTextFile(sourcePath);
|
|
23
23
|
return { sourcePath, content };
|
|
24
24
|
}
|
|
@@ -32,7 +32,7 @@ export async function tryReadWithExtensions(fs, basePath) {
|
|
|
32
32
|
/**
|
|
33
33
|
* Resolve a /_vf_modules/ path to the actual framework source file.
|
|
34
34
|
*/
|
|
35
|
-
export async function resolveFrameworkFile(vfModulePath, fs) {
|
|
35
|
+
export async function resolveFrameworkFile(vfModulePath, fs, existsFn = exists) {
|
|
36
36
|
const pathWithoutPrefix = vfModulePath
|
|
37
37
|
.replace(/^\/_vf_modules\//, "")
|
|
38
38
|
.replace(/\?.*$/, "")
|
|
@@ -58,7 +58,7 @@ export async function resolveFrameworkFile(vfModulePath, fs) {
|
|
|
58
58
|
relativePath,
|
|
59
59
|
fullPath: pathWithPrefixDir,
|
|
60
60
|
});
|
|
61
|
-
const withPrefix = await tryReadWithExtensions(fs, pathWithPrefixDir);
|
|
61
|
+
const withPrefix = await tryReadWithExtensions(fs, pathWithPrefixDir, existsFn);
|
|
62
62
|
if (withPrefix) {
|
|
63
63
|
logger.debug(`${LOG_PREFIX} Found with prefix`, { sourcePath: withPrefix.sourcePath });
|
|
64
64
|
return withPrefix;
|
|
@@ -71,7 +71,7 @@ export async function resolveFrameworkFile(vfModulePath, fs) {
|
|
|
71
71
|
relativePath,
|
|
72
72
|
fullPath: pathWithoutPrefixDir,
|
|
73
73
|
});
|
|
74
|
-
const withoutPrefix = await tryReadWithExtensions(fs, pathWithoutPrefixDir);
|
|
74
|
+
const withoutPrefix = await tryReadWithExtensions(fs, pathWithoutPrefixDir, existsFn);
|
|
75
75
|
if (withoutPrefix) {
|
|
76
76
|
logger.debug(`${LOG_PREFIX} Found without prefix`, { sourcePath: withoutPrefix.sourcePath });
|
|
77
77
|
return withoutPrefix;
|
|
@@ -93,7 +93,7 @@ export async function resolveFrameworkFile(vfModulePath, fs) {
|
|
|
93
93
|
* then falls back to regular src/. This matches resolveFrameworkFile's behavior
|
|
94
94
|
* and ensures consistent path resolution for cycle detection.
|
|
95
95
|
*/
|
|
96
|
-
export async function resolveVeryfrontSourcePath(specifier) {
|
|
96
|
+
export async function resolveVeryfrontSourcePath(specifier, existsFn = exists) {
|
|
97
97
|
if (!specifier.startsWith("#veryfront/"))
|
|
98
98
|
return null;
|
|
99
99
|
const mappedTarget = resolveInternalModuleTarget(specifier);
|
|
@@ -115,7 +115,7 @@ export async function resolveVeryfrontSourcePath(specifier) {
|
|
|
115
115
|
// Try exact path with .src suffix first (for embedded sources)
|
|
116
116
|
try {
|
|
117
117
|
const srcPath = basePath + ".src";
|
|
118
|
-
if (await
|
|
118
|
+
if (await existsFn(srcPath))
|
|
119
119
|
return srcPath;
|
|
120
120
|
}
|
|
121
121
|
catch (_) {
|
|
@@ -123,7 +123,7 @@ export async function resolveVeryfrontSourcePath(specifier) {
|
|
|
123
123
|
}
|
|
124
124
|
// Try exact path
|
|
125
125
|
try {
|
|
126
|
-
if (await
|
|
126
|
+
if (await existsFn(basePath))
|
|
127
127
|
return basePath;
|
|
128
128
|
}
|
|
129
129
|
catch (_) {
|
|
@@ -140,7 +140,7 @@ export async function resolveVeryfrontSourcePath(specifier) {
|
|
|
140
140
|
for (const ext of allExtensions) {
|
|
141
141
|
const pathWithExt = basePath + ext;
|
|
142
142
|
try {
|
|
143
|
-
if (await
|
|
143
|
+
if (await existsFn(pathWithExt))
|
|
144
144
|
return pathWithExt;
|
|
145
145
|
}
|
|
146
146
|
catch (_) {
|
|
@@ -151,7 +151,7 @@ export async function resolveVeryfrontSourcePath(specifier) {
|
|
|
151
151
|
for (const ext of allExtensions) {
|
|
152
152
|
const indexPath = join(basePath, "index" + ext);
|
|
153
153
|
try {
|
|
154
|
-
if (await
|
|
154
|
+
if (await existsFn(indexPath))
|
|
155
155
|
return indexPath;
|
|
156
156
|
}
|
|
157
157
|
catch (_) {
|
|
@@ -168,7 +168,7 @@ export async function resolveVeryfrontSourcePath(specifier) {
|
|
|
168
168
|
* Handles both regular source files (.tsx, .ts) and embedded sources (.tsx.src, .ts.src)
|
|
169
169
|
* for compiled binaries.
|
|
170
170
|
*/
|
|
171
|
-
export async function resolveRelativeFrameworkImport(specifier, fromSourcePath, _fs) {
|
|
171
|
+
export async function resolveRelativeFrameworkImport(specifier, fromSourcePath, _fs, existsFn = exists) {
|
|
172
172
|
const fromDir = fromSourcePath.substring(0, fromSourcePath.lastIndexOf("/"));
|
|
173
173
|
const parts = fromDir.split("/").filter(Boolean);
|
|
174
174
|
const importParts = specifier.split("/").filter(Boolean);
|
|
@@ -188,7 +188,7 @@ export async function resolveRelativeFrameworkImport(specifier, fromSourcePath,
|
|
|
188
188
|
if (/\.(tsx?|jsx?|mjs)$/.test(specifier)) {
|
|
189
189
|
// Try exact path first
|
|
190
190
|
try {
|
|
191
|
-
if (await
|
|
191
|
+
if (await existsFn(basePath))
|
|
192
192
|
return basePath;
|
|
193
193
|
}
|
|
194
194
|
catch (_) {
|
|
@@ -197,7 +197,7 @@ export async function resolveRelativeFrameworkImport(specifier, fromSourcePath,
|
|
|
197
197
|
// Try with .src suffix for embedded sources
|
|
198
198
|
try {
|
|
199
199
|
const srcPath = basePath + ".src";
|
|
200
|
-
if (await
|
|
200
|
+
if (await existsFn(srcPath))
|
|
201
201
|
return srcPath;
|
|
202
202
|
}
|
|
203
203
|
catch (_) {
|
|
@@ -214,7 +214,7 @@ export async function resolveRelativeFrameworkImport(specifier, fromSourcePath,
|
|
|
214
214
|
for (const ext of allExtensions) {
|
|
215
215
|
const pathWithExt = basePath + ext;
|
|
216
216
|
try {
|
|
217
|
-
if (await
|
|
217
|
+
if (await existsFn(pathWithExt))
|
|
218
218
|
return pathWithExt;
|
|
219
219
|
}
|
|
220
220
|
catch (_) {
|
|
@@ -225,7 +225,7 @@ export async function resolveRelativeFrameworkImport(specifier, fromSourcePath,
|
|
|
225
225
|
for (const ext of allExtensions) {
|
|
226
226
|
const indexPath = join(basePath, "index" + ext);
|
|
227
227
|
try {
|
|
228
|
-
if (await
|
|
228
|
+
if (await existsFn(indexPath))
|
|
229
229
|
return indexPath;
|
|
230
230
|
}
|
|
231
231
|
catch (_) {
|
package/esm/src/utils/index.d.ts
CHANGED
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
* (breakpoints, timeouts, HTTP codes), hashing, memoization, and feature flags.
|
|
4
4
|
*
|
|
5
5
|
* @module utils
|
|
6
|
+
*
|
|
7
|
+
* @example Structured logging
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { serverLogger } from "veryfront/utils";
|
|
10
|
+
*
|
|
11
|
+
* serverLogger.info("Booting server", { project_id: "proj_123" });
|
|
12
|
+
* ```
|
|
6
13
|
*/
|
|
14
|
+
import "../../_dnt.polyfills.js";
|
|
7
15
|
export { type GlobalWithBun, type GlobalWithDeno, type GlobalWithProcess, hasBunRuntime, hasDenoRuntime, hasNodeProcess, } from "./runtime-guards.js";
|
|
8
|
-
export { agentLogger, bundlerLogger, logger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger/index.js";
|
|
16
|
+
export { agentLogger, bundlerLogger, createJobUserLogger, logger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger/index.js";
|
|
17
|
+
export type { Logger } from "./logger/index.js";
|
|
9
18
|
export { BREAKPOINT_LG, BREAKPOINT_MD, BREAKPOINT_SM, BREAKPOINT_XL, BYTES_PER_KB, DEFAULT_ALLOWED_CDN_HOSTS, DEFAULT_BUILD_CONCURRENCY, DEFAULT_DASHBOARD_PORT, DEFAULT_LRU_MAX_ENTRIES, DEV_SERVER_ENDPOINTS, FORBIDDEN_PATH_PATTERNS, getDenoStdNodeBase, getReactImportMap, HASH_SEED_DJB2, HASH_SEED_FNV1A, HMR_CLIENT_RELOAD_DELAY_MS, HMR_CLOSE_MESSAGE_TOO_LARGE, HMR_CLOSE_NORMAL, HMR_CLOSE_RATE_LIMIT, HMR_MAX_MESSAGE_SIZE_BYTES, HMR_MAX_MESSAGES_PER_MINUTE, HMR_RATE_LIMIT_WINDOW_MS, HTTP_BAD_REQUEST, HTTP_CONTENT_TYPE_IMAGE_GIF, HTTP_CONTENT_TYPE_IMAGE_ICO, HTTP_CONTENT_TYPE_IMAGE_JPEG, HTTP_CONTENT_TYPE_IMAGE_PNG, HTTP_CONTENT_TYPE_IMAGE_SVG, HTTP_CONTENT_TYPE_IMAGE_WEBP, HTTP_CONTENT_TYPES, HTTP_MODULE_FETCH_TIMEOUT_MS, HTTP_NETWORK_CONNECT_TIMEOUT, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_OK, HTTP_REDIRECT_FOUND, HTTP_SERVER_ERROR, HTTP_STATUS_CLIENT_ERROR_MIN, HTTP_STATUS_REDIRECT_MIN, HTTP_STATUS_SERVER_ERROR_MIN, HTTP_STATUS_SUCCESS_MIN, HTTP_UNAVAILABLE, IMAGE_OPTIMIZATION, MAX_BATCH_SIZE, MAX_PATH_LENGTH, MAX_PATH_TRAVERSAL_DEPTH, MS_PER_SECOND, PREFETCH_DEFAULT_DELAY_MS, PREFETCH_DEFAULT_TIMEOUT_MS, PREFETCH_MAX_SIZE_BYTES, REACT_DEFAULT_VERSION, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, RSC_MANIFEST_CACHE_TTL_MS, TSX_LAYOUT_MAX_ENTRIES, Z_INDEX_DEV_INDICATOR, Z_INDEX_ERROR_OVERLAY, } from "./constants/index.js";
|
|
10
19
|
export { VERSION } from "./version.js";
|
|
11
20
|
export { type BundleCode as HashBundleCode, computeCodeHash, computeHash, fnv1aHash, shortHash, simpleHash, } from "./hash-utils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/utils/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,yBAAyB,CAAC;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jC,eAAe,EACf,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3F,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEpG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
package/esm/src/utils/index.js
CHANGED
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
* (breakpoints, timeouts, HTTP codes), hashing, memoization, and feature flags.
|
|
4
4
|
*
|
|
5
5
|
* @module utils
|
|
6
|
+
*
|
|
7
|
+
* @example Structured logging
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { serverLogger } from "veryfront/utils";
|
|
10
|
+
*
|
|
11
|
+
* serverLogger.info("Booting server", { project_id: "proj_123" });
|
|
12
|
+
* ```
|
|
6
13
|
*/
|
|
14
|
+
import "../../_dnt.polyfills.js";
|
|
7
15
|
export { hasBunRuntime, hasDenoRuntime, hasNodeProcess, } from "./runtime-guards.js";
|
|
8
|
-
export { agentLogger, bundlerLogger, logger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger/index.js";
|
|
16
|
+
export { agentLogger, bundlerLogger, createJobUserLogger, logger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger/index.js";
|
|
9
17
|
export { BREAKPOINT_LG, BREAKPOINT_MD, BREAKPOINT_SM, BREAKPOINT_XL, BYTES_PER_KB, DEFAULT_ALLOWED_CDN_HOSTS, DEFAULT_BUILD_CONCURRENCY, DEFAULT_DASHBOARD_PORT, DEFAULT_LRU_MAX_ENTRIES, DEV_SERVER_ENDPOINTS, FORBIDDEN_PATH_PATTERNS, getDenoStdNodeBase, getReactImportMap, HASH_SEED_DJB2, HASH_SEED_FNV1A, HMR_CLIENT_RELOAD_DELAY_MS, HMR_CLOSE_MESSAGE_TOO_LARGE, HMR_CLOSE_NORMAL, HMR_CLOSE_RATE_LIMIT, HMR_MAX_MESSAGE_SIZE_BYTES, HMR_MAX_MESSAGES_PER_MINUTE, HMR_RATE_LIMIT_WINDOW_MS, HTTP_BAD_REQUEST, HTTP_CONTENT_TYPE_IMAGE_GIF, HTTP_CONTENT_TYPE_IMAGE_ICO, HTTP_CONTENT_TYPE_IMAGE_JPEG, HTTP_CONTENT_TYPE_IMAGE_PNG, HTTP_CONTENT_TYPE_IMAGE_SVG, HTTP_CONTENT_TYPE_IMAGE_WEBP, HTTP_CONTENT_TYPES, HTTP_MODULE_FETCH_TIMEOUT_MS, HTTP_NETWORK_CONNECT_TIMEOUT, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_OK, HTTP_REDIRECT_FOUND, HTTP_SERVER_ERROR, HTTP_STATUS_CLIENT_ERROR_MIN, HTTP_STATUS_REDIRECT_MIN, HTTP_STATUS_SERVER_ERROR_MIN, HTTP_STATUS_SUCCESS_MIN, HTTP_UNAVAILABLE, IMAGE_OPTIMIZATION, MAX_BATCH_SIZE, MAX_PATH_LENGTH, MAX_PATH_TRAVERSAL_DEPTH, MS_PER_SECOND, PREFETCH_DEFAULT_DELAY_MS, PREFETCH_DEFAULT_TIMEOUT_MS, PREFETCH_MAX_SIZE_BYTES, REACT_DEFAULT_VERSION, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, RSC_MANIFEST_CACHE_TTL_MS, TSX_LAYOUT_MAX_ENTRIES, Z_INDEX_DEV_INDICATOR, Z_INDEX_ERROR_OVERLAY, } from "./constants/index.js";
|
|
10
18
|
export { VERSION } from "./version.js";
|
|
11
19
|
export { computeCodeHash, computeHash, fnv1aHash, shortHash, simpleHash, } from "./hash-utils.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module utils/logger
|
|
5
5
|
*/
|
|
6
|
-
export { __registerRequestContextGetter, __registerTraceContextGetter, __resetLoggerConfigForTests, __resetTraceContextGetterForTests, agentLogger, bundlerLogger, cliLogger, createRequestLogger, getBaseLogger, getDefaultLevel, type LogEntry, type LogFormat, type Logger, logger, LogLevel, proxyLogger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger.js";
|
|
6
|
+
export { __registerRequestContextGetter, __registerTraceContextGetter, __resetLoggerConfigForTests, __resetTraceContextGetterForTests, agentLogger, bundlerLogger, cliLogger, createJobUserLogger, createRequestLogger, getBaseLogger, getDefaultLevel, type LogEntry, type LogFormat, type Logger, logger, LogLevel, proxyLogger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger.js";
|
|
7
7
|
export { ANSI, colorize, formatContextText, formatErrorText, formatTimestamp, formatValue, isRecord, LEVEL_COLORS, LEVEL_GLYPHS, type LogLevelName, normalizeText, padTag, PREFIX_WIDTH, type SerializedError, serializeError, TAG_WIDTH, truncateText, } from "./core.js";
|
|
8
8
|
export { getRequestContext, getRequestLogger, type RequestContext, requestContextStore, runWithRequestContext, runWithRequestContextAsync, } from "./request-context.js";
|
|
9
9
|
export { type LogComponent, LogComponents } from "./components.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,2BAA2B,EAC3B,iCAAiC,EACjC,WAAW,EACX,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,MAAM,EACX,MAAM,EACN,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,KAAK,YAAY,EACjB,aAAa,EACb,MAAM,EACN,YAAY,EACZ,KAAK,eAAe,EACpB,cAAc,EACd,SAAS,EACT,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,cAAc,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,2BAA2B,EAC3B,iCAAiC,EACjC,WAAW,EACX,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,MAAM,EACX,MAAM,EACN,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,KAAK,YAAY,EACjB,aAAa,EACb,MAAM,EACN,YAAY,EACZ,KAAK,eAAe,EACpB,cAAc,EACd,SAAS,EACT,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,cAAc,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module utils/logger
|
|
5
5
|
*/
|
|
6
|
-
export { __registerRequestContextGetter, __registerTraceContextGetter, __resetLoggerConfigForTests, __resetTraceContextGetterForTests, agentLogger, bundlerLogger, cliLogger, createRequestLogger, getBaseLogger, getDefaultLevel, logger, LogLevel, proxyLogger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger.js";
|
|
6
|
+
export { __registerRequestContextGetter, __registerTraceContextGetter, __resetLoggerConfigForTests, __resetTraceContextGetterForTests, agentLogger, bundlerLogger, cliLogger, createJobUserLogger, createRequestLogger, getBaseLogger, getDefaultLevel, logger, LogLevel, proxyLogger, refreshLoggerConfig, rendererLogger, serverLogger, } from "./logger.js";
|
|
7
7
|
export { ANSI, colorize, formatContextText, formatErrorText, formatTimestamp, formatValue, isRecord, LEVEL_COLORS, LEVEL_GLYPHS, normalizeText, padTag, PREFIX_WIDTH, serializeError, TAG_WIDTH, truncateText, } from "./core.js";
|
|
8
8
|
export { getRequestContext, getRequestLogger, requestContextStore, runWithRequestContext, runWithRequestContextAsync, } from "./request-context.js";
|
|
9
9
|
export { LogComponents } from "./components.js";
|
|
@@ -37,6 +37,12 @@ export interface LogEntry {
|
|
|
37
37
|
release_id?: string;
|
|
38
38
|
branch_id?: string;
|
|
39
39
|
branch_name?: string;
|
|
40
|
+
job_id?: string;
|
|
41
|
+
batch_id?: string;
|
|
42
|
+
job_target?: string;
|
|
43
|
+
task?: string;
|
|
44
|
+
event_kind?: string;
|
|
45
|
+
user_visible?: string;
|
|
40
46
|
/** @deprecated Use `duration_ms` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */
|
|
41
47
|
durationMs?: number;
|
|
42
48
|
duration_ms?: number;
|
|
@@ -135,5 +141,13 @@ export declare function createRequestLogger(baseLogger: Logger, requestContext:
|
|
|
135
141
|
traceId?: string;
|
|
136
142
|
projectSlug?: string;
|
|
137
143
|
}): Logger;
|
|
144
|
+
export declare function createJobUserLogger(baseLogger: Logger, jobContext: {
|
|
145
|
+
projectId: string;
|
|
146
|
+
jobId: string;
|
|
147
|
+
task: string;
|
|
148
|
+
batchId?: string | null;
|
|
149
|
+
jobTarget?: string | null;
|
|
150
|
+
eventKind?: string;
|
|
151
|
+
}): Logger;
|
|
138
152
|
export {};
|
|
139
153
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/logger/logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAOL,KAAK,YAAY,EAEjB,KAAK,eAAe,EAErB,MAAM,WAAW,CAAC;AAEnB,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,KAAK,CAAC,EAAE,eAAe,CAAC;IAExB,kJAAkJ;IAClJ,SAAS,CA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AC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE;IACV,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,MAAM,CAUR"}
|
|
@@ -195,6 +195,12 @@ class ConsoleLogger {
|
|
|
195
195
|
extractToEntryField(entry, mergedContext, "release_id", (v) => String(v));
|
|
196
196
|
extractToEntryField(entry, mergedContext, "branch_id", (v) => String(v));
|
|
197
197
|
extractToEntryField(entry, mergedContext, "branch_name", (v) => String(v));
|
|
198
|
+
extractToEntryField(entry, mergedContext, "job_id", (v) => String(v));
|
|
199
|
+
extractToEntryField(entry, mergedContext, "batch_id", (v) => String(v));
|
|
200
|
+
extractToEntryField(entry, mergedContext, "job_target", (v) => String(v));
|
|
201
|
+
extractToEntryField(entry, mergedContext, "task", (v) => String(v));
|
|
202
|
+
extractToEntryField(entry, mergedContext, "event_kind", (v) => String(v));
|
|
203
|
+
extractToEntryField(entry, mergedContext, "user_visible", (v) => String(v));
|
|
198
204
|
extractToEntryField(entry, mergedContext, "duration_ms", (v) => Number(v));
|
|
199
205
|
// Emit snake_case aliases for camelCase fields (transition period)
|
|
200
206
|
if (entry.requestId && !entry.request_id)
|
|
@@ -408,3 +414,14 @@ export function getBaseLogger(prefix, options) {
|
|
|
408
414
|
export function createRequestLogger(baseLogger, requestContext) {
|
|
409
415
|
return baseLogger.child(requestContext);
|
|
410
416
|
}
|
|
417
|
+
export function createJobUserLogger(baseLogger, jobContext) {
|
|
418
|
+
return baseLogger.child({
|
|
419
|
+
project_id: jobContext.projectId,
|
|
420
|
+
job_id: jobContext.jobId,
|
|
421
|
+
...(jobContext.batchId ? { batch_id: jobContext.batchId } : {}),
|
|
422
|
+
...(jobContext.jobTarget ? { job_target: jobContext.jobTarget } : {}),
|
|
423
|
+
task: jobContext.task,
|
|
424
|
+
event_kind: jobContext.eventKind ?? "job_user_log",
|
|
425
|
+
user_visible: "true",
|
|
426
|
+
});
|
|
427
|
+
}
|
|
@@ -21,8 +21,8 @@ declare const claudeCodeInputSchema: z.ZodObject<{
|
|
|
21
21
|
/** Additional context */
|
|
22
22
|
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
23
23
|
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
mode: "code" | "custom" | "analysis";
|
|
25
24
|
task: string;
|
|
25
|
+
mode: "code" | "custom" | "analysis";
|
|
26
26
|
maxTurns: number;
|
|
27
27
|
context?: Record<string, unknown> | undefined;
|
|
28
28
|
files?: string[] | undefined;
|
|
@@ -72,32 +72,32 @@ export declare function createClaudeCodeTool(options?: {
|
|
|
72
72
|
*/
|
|
73
73
|
/** Code review tool (analysis mode, read-only) */
|
|
74
74
|
export declare const codeReviewTool: Tool<{
|
|
75
|
-
mode: "code" | "custom" | "analysis";
|
|
76
75
|
task: string;
|
|
76
|
+
mode: "code" | "custom" | "analysis";
|
|
77
77
|
maxTurns: number;
|
|
78
78
|
context?: Record<string, unknown> | undefined;
|
|
79
79
|
files?: string[] | undefined;
|
|
80
80
|
}, ClaudeCodeResult>;
|
|
81
81
|
/** Bug fix tool (code mode) */
|
|
82
82
|
export declare const bugFixTool: Tool<{
|
|
83
|
-
mode: "code" | "custom" | "analysis";
|
|
84
83
|
task: string;
|
|
84
|
+
mode: "code" | "custom" | "analysis";
|
|
85
85
|
maxTurns: number;
|
|
86
86
|
context?: Record<string, unknown> | undefined;
|
|
87
87
|
files?: string[] | undefined;
|
|
88
88
|
}, ClaudeCodeResult>;
|
|
89
89
|
/** Refactoring tool (code mode) */
|
|
90
90
|
export declare const refactorTool: Tool<{
|
|
91
|
-
mode: "code" | "custom" | "analysis";
|
|
92
91
|
task: string;
|
|
92
|
+
mode: "code" | "custom" | "analysis";
|
|
93
93
|
maxTurns: number;
|
|
94
94
|
context?: Record<string, unknown> | undefined;
|
|
95
95
|
files?: string[] | undefined;
|
|
96
96
|
}, ClaudeCodeResult>;
|
|
97
97
|
/** Documentation tool (code mode) */
|
|
98
98
|
export declare const docsTool: Tool<{
|
|
99
|
-
mode: "code" | "custom" | "analysis";
|
|
100
99
|
task: string;
|
|
100
|
+
mode: "code" | "custom" | "analysis";
|
|
101
101
|
maxTurns: number;
|
|
102
102
|
context?: Record<string, unknown> | undefined;
|
|
103
103
|
files?: string[] | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -82,6 +82,9 @@
|
|
|
82
82
|
"./middleware": {
|
|
83
83
|
"import": "./esm/src/middleware/index.js"
|
|
84
84
|
},
|
|
85
|
+
"./utils": {
|
|
86
|
+
"import": "./esm/src/utils/index.js"
|
|
87
|
+
},
|
|
85
88
|
"./oauth": {
|
|
86
89
|
"import": "./esm/src/oauth/index.js"
|
|
87
90
|
},
|