veryfront 0.1.79 → 0.1.80
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.map +1 -1
- package/esm/cli/commands/knowledge/command.js +2 -0
- package/esm/cli/commands/task/command.d.ts.map +1 -1
- package/esm/cli/commands/task/command.js +2 -0
- package/esm/cli/commands/workflow/command.d.ts.map +1 -1
- package/esm/cli/commands/workflow/command.js +2 -0
- package/esm/cli/utils/write-job-result.d.ts +2 -0
- package/esm/cli/utils/write-job-result.d.ts.map +1 -0
- package/esm/cli/utils/write-job-result.js +16 -0
- package/esm/deno.d.ts +3 -0
- package/esm/deno.js +5 -2
- package/esm/src/jobs/schemas.d.ts +45 -0
- package/esm/src/jobs/schemas.d.ts.map +1 -1
- package/esm/src/jobs/schemas.js +4 -0
- package/esm/src/rendering/script-page-handling.d.ts.map +1 -1
- package/esm/src/rendering/script-page-handling.js +1 -14
- package/esm/src/routing/api/module-loader/loader.d.ts.map +1 -1
- package/esm/src/routing/api/module-loader/loader.js +2 -57
- package/esm/src/transforms/npm-import-rewrites.d.ts +26 -0
- package/esm/src/transforms/npm-import-rewrites.d.ts.map +1 -0
- package/esm/src/transforms/npm-import-rewrites.js +97 -0
- package/package.json +1 -1
- package/src/cli/commands/knowledge/command.ts +3 -0
- package/src/cli/commands/task/command.ts +2 -0
- package/src/cli/commands/workflow/command.ts +2 -0
- package/src/cli/utils/write-job-result.ts +23 -0
- package/src/deno.js +5 -2
- package/src/src/jobs/schemas.ts +4 -0
- package/src/src/rendering/script-page-handling.ts +1 -16
- package/src/src/routing/api/module-loader/loader.ts +2 -58
- package/src/src/transforms/npm-import-rewrites.ts +115 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/knowledge/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKx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AAM,CAAA;KAAE,CAAC,CAAC;IAC1F,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,GACA,OAAO,CAAC,yBAAyB,EAAE,CAAC,CA6DtC;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAiGtE"}
|
|
@@ -9,6 +9,7 @@ import { downloadUploadToFile, listAllUploads } from "../uploads/command.js";
|
|
|
9
9
|
import { putRemoteFileFromLocal } from "../files/command.js";
|
|
10
10
|
import { knowledgeIngestPythonSource } from "./parser-source.js";
|
|
11
11
|
import { createJobUserLogger, serverLogger } from "../../../src/utils/index.js";
|
|
12
|
+
import { writeJobResultIfConfigured } from "../../utils/write-job-result.js";
|
|
12
13
|
const SUPPORTED_EXTENSIONS = new Set([
|
|
13
14
|
".pdf",
|
|
14
15
|
".csv",
|
|
@@ -477,6 +478,7 @@ export async function knowledgeCommand(args) {
|
|
|
477
478
|
progress_current: results.length,
|
|
478
479
|
progress_total: results.length,
|
|
479
480
|
});
|
|
481
|
+
await writeJobResultIfConfigured(results);
|
|
480
482
|
if (options.json) {
|
|
481
483
|
printJson(results);
|
|
482
484
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/task/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/task/command.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,WAAY,SAAQ,QAAQ;CAAG;AAEhD,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA6FrE"}
|
|
@@ -9,6 +9,7 @@ import { cliLogger } from "../../utils/index.js";
|
|
|
9
9
|
import { exitProcess } from "../../utils/index.js";
|
|
10
10
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
11
11
|
import { sanitizeJobOutputForLogging } from "../../utils/sanitize-job-output.js";
|
|
12
|
+
import { writeJobResultIfConfigured } from "../../utils/write-job-result.js";
|
|
12
13
|
export async function taskCommand(options) {
|
|
13
14
|
const { discoverTasks } = await import("../../../src/task/discovery.js");
|
|
14
15
|
const { runTask } = await import("../../../src/task/runner.js");
|
|
@@ -76,6 +77,7 @@ export async function taskCommand(options) {
|
|
|
76
77
|
if (result.success) {
|
|
77
78
|
cliLogger.info(`Task completed in ${result.durationMs}ms`);
|
|
78
79
|
if (result.result !== undefined) {
|
|
80
|
+
await writeJobResultIfConfigured(result.result);
|
|
79
81
|
cliLogger.info(`Result: ${JSON.stringify(sanitizeJobOutputForLogging(result.result), null, 2)}`);
|
|
80
82
|
}
|
|
81
83
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD,MAAM,WAAW,eAAgB,SAAQ,YAAY;CAAG;AA8DxD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmF7E"}
|
|
@@ -3,6 +3,7 @@ import { cliLogger } from "../../utils/index.js";
|
|
|
3
3
|
import { exitProcess } from "../../utils/index.js";
|
|
4
4
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
5
5
|
import { sanitizeJobOutputForLogging } from "../../utils/sanitize-job-output.js";
|
|
6
|
+
import { writeJobResultIfConfigured } from "../../utils/write-job-result.js";
|
|
6
7
|
import { getEnv } from "../../../src/platform/index.js";
|
|
7
8
|
const WORKFLOW_STATUS_POLL_INTERVAL_MS = 1_000;
|
|
8
9
|
async function createWorkflowClient(debug) {
|
|
@@ -27,6 +28,7 @@ async function waitForWorkflowExit(client, runId) {
|
|
|
27
28
|
if (run.status === "completed") {
|
|
28
29
|
cliLogger.info(`Workflow completed: ${runId}`);
|
|
29
30
|
if (run.output !== undefined) {
|
|
31
|
+
await writeJobResultIfConfigured(run.output);
|
|
30
32
|
cliLogger.info(`Result: ${JSON.stringify(sanitizeJobOutputForLogging(run.output), null, 2)}`);
|
|
31
33
|
}
|
|
32
34
|
return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-job-result.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/write-job-result.ts"],"names":[],"mappings":"AAWA,wBAAsB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAW9E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { dirname } from "../../src/platform/compat/path/index.js";
|
|
3
|
+
import { sanitizeJobOutputForLogging } from "./sanitize-job-output.js";
|
|
4
|
+
const JOB_RESULT_PATH_ENV = "VERYFRONT_JOB_RESULT_PATH";
|
|
5
|
+
function getJobResultPath() {
|
|
6
|
+
const value = dntShim.Deno.env.get(JOB_RESULT_PATH_ENV)?.trim();
|
|
7
|
+
return value ? value : null;
|
|
8
|
+
}
|
|
9
|
+
export async function writeJobResultIfConfigured(value) {
|
|
10
|
+
const resultPath = getJobResultPath();
|
|
11
|
+
if (!resultPath) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
await dntShim.Deno.mkdir(dirname(resultPath), { recursive: true });
|
|
15
|
+
await dntShim.Deno.writeTextFile(resultPath, JSON.stringify(sanitizeJobOutputForLogging(value), null, 2));
|
|
16
|
+
}
|
package/esm/deno.d.ts
CHANGED
|
@@ -241,6 +241,9 @@ declare namespace _default {
|
|
|
241
241
|
"@ai-sdk/openai": string;
|
|
242
242
|
"@ai-sdk/anthropic": string;
|
|
243
243
|
"@ai-sdk/google": string;
|
|
244
|
+
"@ai-sdk/mistral": string;
|
|
245
|
+
"@ai-sdk/provider": string;
|
|
246
|
+
"@ai-sdk/provider-utils": string;
|
|
244
247
|
tailwindcss: string;
|
|
245
248
|
"tailwindcss/plugin": string;
|
|
246
249
|
"tailwindcss/defaultTheme": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.80",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"exclude": [
|
|
@@ -251,12 +251,15 @@ export default {
|
|
|
251
251
|
"@ai-sdk/openai": "npm:@ai-sdk/openai@3.0.28",
|
|
252
252
|
"@ai-sdk/anthropic": "npm:@ai-sdk/anthropic@3.0.43",
|
|
253
253
|
"@ai-sdk/google": "npm:@ai-sdk/google@3.0.29",
|
|
254
|
+
"@ai-sdk/mistral": "npm:@ai-sdk/mistral@3.0.14",
|
|
255
|
+
"@ai-sdk/provider": "npm:@ai-sdk/provider@3.0.2",
|
|
256
|
+
"@ai-sdk/provider-utils": "npm:@ai-sdk/provider-utils@4.0.5",
|
|
254
257
|
"tailwindcss": "https://esm.sh/tailwindcss@4.1.8",
|
|
255
258
|
"tailwindcss/plugin": "https://esm.sh/tailwindcss@4.1.8/plugin",
|
|
256
259
|
"tailwindcss/defaultTheme": "https://esm.sh/tailwindcss@4.1.8/defaultTheme",
|
|
257
260
|
"tailwindcss/colors": "https://esm.sh/tailwindcss@4.1.8/colors",
|
|
258
261
|
"redis": "npm:redis@4.6.13",
|
|
259
|
-
"pg": "npm:pg",
|
|
262
|
+
"pg": "npm:pg@8.13.1",
|
|
260
263
|
"jose": "npm:jose@5.9.6",
|
|
261
264
|
"@opentelemetry/api": "npm:@opentelemetry/api@1",
|
|
262
265
|
"@opentelemetry/core": "npm:@opentelemetry/core@1",
|
|
@@ -108,6 +108,15 @@ export declare const JobResultSchema: z.ZodNullable<z.ZodDiscriminatedUnion<"kin
|
|
|
108
108
|
remotePath: string;
|
|
109
109
|
}[];
|
|
110
110
|
kind: "knowledge_ingest";
|
|
111
|
+
}>, z.ZodObject<{
|
|
112
|
+
kind: z.ZodLiteral<"value">;
|
|
113
|
+
value: z.ZodUnknown;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
kind: "value";
|
|
116
|
+
value?: unknown;
|
|
117
|
+
}, {
|
|
118
|
+
kind: "value";
|
|
119
|
+
value?: unknown;
|
|
111
120
|
}>, z.ZodObject<{
|
|
112
121
|
kind: z.ZodLiteral<"artifacts">;
|
|
113
122
|
artifacts: z.ZodArray<z.ZodUnknown, "many">;
|
|
@@ -193,6 +202,15 @@ export declare const JobSchema: z.ZodObject<{
|
|
|
193
202
|
remotePath: string;
|
|
194
203
|
}[];
|
|
195
204
|
kind: "knowledge_ingest";
|
|
205
|
+
}>, z.ZodObject<{
|
|
206
|
+
kind: z.ZodLiteral<"value">;
|
|
207
|
+
value: z.ZodUnknown;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
kind: "value";
|
|
210
|
+
value?: unknown;
|
|
211
|
+
}, {
|
|
212
|
+
kind: "value";
|
|
213
|
+
value?: unknown;
|
|
196
214
|
}>, z.ZodObject<{
|
|
197
215
|
kind: z.ZodLiteral<"artifacts">;
|
|
198
216
|
artifacts: z.ZodArray<z.ZodUnknown, "many">;
|
|
@@ -232,6 +250,9 @@ export declare const JobSchema: z.ZodObject<{
|
|
|
232
250
|
remotePath: string;
|
|
233
251
|
}[];
|
|
234
252
|
kind: "knowledge_ingest";
|
|
253
|
+
} | {
|
|
254
|
+
kind: "value";
|
|
255
|
+
value?: unknown;
|
|
235
256
|
} | {
|
|
236
257
|
kind: "artifacts";
|
|
237
258
|
artifacts: unknown[];
|
|
@@ -270,6 +291,9 @@ export declare const JobSchema: z.ZodObject<{
|
|
|
270
291
|
remotePath: string;
|
|
271
292
|
}[];
|
|
272
293
|
kind: "knowledge_ingest";
|
|
294
|
+
} | {
|
|
295
|
+
kind: "value";
|
|
296
|
+
value?: unknown;
|
|
273
297
|
} | {
|
|
274
298
|
kind: "artifacts";
|
|
275
299
|
artifacts: unknown[];
|
|
@@ -361,6 +385,15 @@ export declare const PaginatedJobsResponseSchema: z.ZodObject<{
|
|
|
361
385
|
remotePath: string;
|
|
362
386
|
}[];
|
|
363
387
|
kind: "knowledge_ingest";
|
|
388
|
+
}>, z.ZodObject<{
|
|
389
|
+
kind: z.ZodLiteral<"value">;
|
|
390
|
+
value: z.ZodUnknown;
|
|
391
|
+
}, "strip", z.ZodTypeAny, {
|
|
392
|
+
kind: "value";
|
|
393
|
+
value?: unknown;
|
|
394
|
+
}, {
|
|
395
|
+
kind: "value";
|
|
396
|
+
value?: unknown;
|
|
364
397
|
}>, z.ZodObject<{
|
|
365
398
|
kind: z.ZodLiteral<"artifacts">;
|
|
366
399
|
artifacts: z.ZodArray<z.ZodUnknown, "many">;
|
|
@@ -400,6 +433,9 @@ export declare const PaginatedJobsResponseSchema: z.ZodObject<{
|
|
|
400
433
|
remotePath: string;
|
|
401
434
|
}[];
|
|
402
435
|
kind: "knowledge_ingest";
|
|
436
|
+
} | {
|
|
437
|
+
kind: "value";
|
|
438
|
+
value?: unknown;
|
|
403
439
|
} | {
|
|
404
440
|
kind: "artifacts";
|
|
405
441
|
artifacts: unknown[];
|
|
@@ -438,6 +474,9 @@ export declare const PaginatedJobsResponseSchema: z.ZodObject<{
|
|
|
438
474
|
remotePath: string;
|
|
439
475
|
}[];
|
|
440
476
|
kind: "knowledge_ingest";
|
|
477
|
+
} | {
|
|
478
|
+
kind: "value";
|
|
479
|
+
value?: unknown;
|
|
441
480
|
} | {
|
|
442
481
|
kind: "artifacts";
|
|
443
482
|
artifacts: unknown[];
|
|
@@ -494,6 +533,9 @@ export declare const PaginatedJobsResponseSchema: z.ZodObject<{
|
|
|
494
533
|
remotePath: string;
|
|
495
534
|
}[];
|
|
496
535
|
kind: "knowledge_ingest";
|
|
536
|
+
} | {
|
|
537
|
+
kind: "value";
|
|
538
|
+
value?: unknown;
|
|
497
539
|
} | {
|
|
498
540
|
kind: "artifacts";
|
|
499
541
|
artifacts: unknown[];
|
|
@@ -540,6 +582,9 @@ export declare const PaginatedJobsResponseSchema: z.ZodObject<{
|
|
|
540
582
|
remotePath: string;
|
|
541
583
|
}[];
|
|
542
584
|
kind: "knowledge_ingest";
|
|
585
|
+
} | {
|
|
586
|
+
kind: "value";
|
|
587
|
+
value?: unknown;
|
|
543
588
|
} | {
|
|
544
589
|
kind: "artifacts";
|
|
545
590
|
artifacts: unknown[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/src/jobs/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe,wEAM1B,CAAC;AAEH,eAAO,MAAM,mBAAmB,6CAA2C,CAAC;AAE5E,eAAO,MAAM,6BAA6B,iDAA+C,CAAC;AAE1F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAKzB,CAAC;AAIH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU1C,CAAC;AAEH,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/src/jobs/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe,wEAM1B,CAAC;AAEH,eAAO,MAAM,mBAAmB,6CAA2C,CAAC;AAE5E,eAAO,MAAM,6BAA6B,iDAA+C,CAAC;AAE1F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAKzB,CAAC;AAIH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;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|
|
34
34
|
}),
|
|
35
|
+
z.object({
|
|
36
|
+
kind: z.literal("value"),
|
|
37
|
+
value: z.unknown(),
|
|
38
|
+
}),
|
|
35
39
|
z.object({
|
|
36
40
|
kind: z.literal("artifacts"),
|
|
37
41
|
artifacts: z.array(z.unknown()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-page-handling.d.ts","sourceRoot":"","sources":["../../../src/src/rendering/script-page-handling.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"script-page-handling.d.ts","sourceRoot":"","sources":["../../../src/src/rendering/script-page-handling.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EAGV,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAenE,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqHD,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,UAAU,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,YAAY,CAAC,CAiDvB"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as dntShim from "../../_dnt.shims.js";
|
|
8
8
|
import { DEFAULT_DASHBOARD_PORT, rendererLogger } from "../utils/index.js";
|
|
9
|
+
import { rewriteNpmImports } from "../transforms/npm-import-rewrites.js";
|
|
9
10
|
import { dirname, join } from "../platform/compat/path/index.js";
|
|
10
11
|
import { cwd } from "../platform/compat/process.js";
|
|
11
12
|
import { RENDER_ERROR } from "../errors/error-registry.js";
|
|
@@ -16,10 +17,6 @@ import { extractHTMLMetadata, injectHTMLContent, isFullHTMLDocument } from "../h
|
|
|
16
17
|
import { createFileSystem } from "../platform/compat/fs.js";
|
|
17
18
|
import { getEsbuildLoader } from "../utils/path-utils.js";
|
|
18
19
|
const logger = rendererLogger.component("script");
|
|
19
|
-
const NPM_REWRITES = [
|
|
20
|
-
{ pattern: /from\s+["']ai["']/g, replacement: 'from "npm:ai@latest"' },
|
|
21
|
-
{ pattern: /from\s+["']zod["']/g, replacement: 'from "npm:zod@latest"' },
|
|
22
|
-
];
|
|
23
20
|
const ESBUILD_EXTERNALS = [
|
|
24
21
|
"ai",
|
|
25
22
|
"ai/*",
|
|
@@ -208,16 +205,6 @@ async function readFileWithFallback(adapter, modulePath, normalizedPath) {
|
|
|
208
205
|
}
|
|
209
206
|
}
|
|
210
207
|
}
|
|
211
|
-
function rewriteNpmImports(code) {
|
|
212
|
-
const isDeno = typeof dntShim.dntGlobalThis.Deno !== "undefined";
|
|
213
|
-
if (!isDeno)
|
|
214
|
-
return code;
|
|
215
|
-
let result = code;
|
|
216
|
-
for (const { pattern, replacement } of NPM_REWRITES) {
|
|
217
|
-
result = result.replace(pattern, replacement);
|
|
218
|
-
}
|
|
219
|
-
return result;
|
|
220
|
-
}
|
|
221
208
|
async function transpileWithEsbuild(source, modulePath, resolveDir) {
|
|
222
209
|
const { build } = await import("esbuild");
|
|
223
210
|
const loader = getEsbuildLoader(modulePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/routing/api/module-loader/loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/routing/api/module-loader/loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAgL9D,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAejE;AAgBD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAyBtF"}
|
|
@@ -12,6 +12,7 @@ import { withSpan } from "../../../observability/tracing/otlp-setup.js";
|
|
|
12
12
|
import { isCompiledBinary } from "../../../utils/index.js";
|
|
13
13
|
import { wrapWithCurrentContext } from "../../../platform/adapters/fs/veryfront/multi-project-adapter.js";
|
|
14
14
|
import { isWithinDirectory } from "../../../security/path-validation.js";
|
|
15
|
+
import { rewriteNpmImports } from "../../../transforms/npm-import-rewrites.js";
|
|
15
16
|
const logger = serverLogger.component("api");
|
|
16
17
|
/**
|
|
17
18
|
* Validates that a module path is contained within the project directory.
|
|
@@ -633,63 +634,7 @@ async function rewriteExternalImports(code, projectDir, fs, userDeps = new Map()
|
|
|
633
634
|
}
|
|
634
635
|
}
|
|
635
636
|
if (isDeno) {
|
|
636
|
-
|
|
637
|
-
{ pattern: /from\s+["']ai["']/g, replacement: 'from "npm:ai@latest"' },
|
|
638
|
-
{
|
|
639
|
-
pattern: /from\s+["']@ai-sdk\/anthropic["']/g,
|
|
640
|
-
replacement: 'from "npm:@ai-sdk/anthropic@latest"',
|
|
641
|
-
},
|
|
642
|
-
{
|
|
643
|
-
pattern: /from\s+["']@ai-sdk\/openai["']/g,
|
|
644
|
-
replacement: 'from "npm:@ai-sdk/openai@latest"',
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
pattern: /from\s+["']@ai-sdk\/google["']/g,
|
|
648
|
-
replacement: 'from "npm:@ai-sdk/google@latest"',
|
|
649
|
-
},
|
|
650
|
-
{
|
|
651
|
-
pattern: /from\s+["']@ai-sdk\/mistral["']/g,
|
|
652
|
-
replacement: 'from "npm:@ai-sdk/mistral@latest"',
|
|
653
|
-
},
|
|
654
|
-
{
|
|
655
|
-
pattern: /from\s+["']@ai-sdk\/provider["']/g,
|
|
656
|
-
replacement: 'from "npm:@ai-sdk/provider@latest"',
|
|
657
|
-
},
|
|
658
|
-
{
|
|
659
|
-
pattern: /from\s+["']@ai-sdk\/provider-utils["']/g,
|
|
660
|
-
replacement: 'from "npm:@ai-sdk/provider-utils@latest"',
|
|
661
|
-
},
|
|
662
|
-
{ pattern: /from\s+["']zod["']/g, replacement: 'from "npm:zod@latest"' },
|
|
663
|
-
{ pattern: /import\s*\(\s*["']ai["']\s*\)/g, replacement: 'import("npm:ai@latest")' },
|
|
664
|
-
{
|
|
665
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/anthropic["']\s*\)/g,
|
|
666
|
-
replacement: 'import("npm:@ai-sdk/anthropic@latest")',
|
|
667
|
-
},
|
|
668
|
-
{
|
|
669
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/openai["']\s*\)/g,
|
|
670
|
-
replacement: 'import("npm:@ai-sdk/openai@latest")',
|
|
671
|
-
},
|
|
672
|
-
{
|
|
673
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/google["']\s*\)/g,
|
|
674
|
-
replacement: 'import("npm:@ai-sdk/google@latest")',
|
|
675
|
-
},
|
|
676
|
-
{
|
|
677
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/mistral["']\s*\)/g,
|
|
678
|
-
replacement: 'import("npm:@ai-sdk/mistral@latest")',
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/provider["']\s*\)/g,
|
|
682
|
-
replacement: 'import("npm:@ai-sdk/provider@latest")',
|
|
683
|
-
},
|
|
684
|
-
{
|
|
685
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/provider-utils["']\s*\)/g,
|
|
686
|
-
replacement: 'import("npm:@ai-sdk/provider-utils@latest")',
|
|
687
|
-
},
|
|
688
|
-
{ pattern: /import\s*\(\s*["']zod["']\s*\)/g, replacement: 'import("npm:zod@latest")' },
|
|
689
|
-
];
|
|
690
|
-
for (const { pattern, replacement } of rewrites) {
|
|
691
|
-
transformed = transformed.replace(pattern, replacement);
|
|
692
|
-
}
|
|
637
|
+
transformed = rewriteNpmImports(transformed);
|
|
693
638
|
// Rewrite bare Node.js built-in imports to node: prefix for Deno compatibility.
|
|
694
639
|
// npm packages often use require('fs') / from "fs" without the node: prefix.
|
|
695
640
|
for (const mod of NODE_BUILTINS) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bare specifiers that should be rewritten to their pinned npm: versions.
|
|
3
|
+
* Each must have a corresponding entry in deno.json's import map.
|
|
4
|
+
*/
|
|
5
|
+
declare const REWRITABLE_PACKAGES: readonly ["ai", "@ai-sdk/anthropic", "@ai-sdk/openai", "@ai-sdk/google", "@ai-sdk/mistral", "@ai-sdk/provider", "@ai-sdk/provider-utils", "zod"];
|
|
6
|
+
interface RewriteRule {
|
|
7
|
+
pattern: RegExp;
|
|
8
|
+
replacement: string;
|
|
9
|
+
}
|
|
10
|
+
declare function buildRules(importMap: Record<string, string>): RewriteRule[];
|
|
11
|
+
/**
|
|
12
|
+
* Returns rewrite rules derived from deno.json's import map.
|
|
13
|
+
* Rules are cached after first call.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getNpmRewriteRules(): RewriteRule[];
|
|
16
|
+
/**
|
|
17
|
+
* Apply npm import rewrites to source code.
|
|
18
|
+
* Rewrites bare specifiers to pinned npm: versions from deno.json.
|
|
19
|
+
* No-op on Node.js where bare specifiers resolve via node_modules.
|
|
20
|
+
*/
|
|
21
|
+
export declare function rewriteNpmImports(source: string): string;
|
|
22
|
+
/** Exported for testing */
|
|
23
|
+
export { buildRules, REWRITABLE_PACKAGES };
|
|
24
|
+
/** @internal Reset cached rules — only for testing */
|
|
25
|
+
export declare function _resetCache(): void;
|
|
26
|
+
//# sourceMappingURL=npm-import-rewrites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-import-rewrites.d.ts","sourceRoot":"","sources":["../../../src/src/transforms/npm-import-rewrites.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,QAAA,MAAM,mBAAmB,kJASf,CAAC;AAEX,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAQD,iBAAS,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,WAAW,EAAE,CAwBpE;AAcD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,EAAE,CAKlD;AAID;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED,2BAA2B;AAC3B,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,CAAC;AAE3C,sDAAsD;AACtD,wBAAgB,WAAW,IAAI,IAAI,CAElC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NPM Import Rewrites for Deno
|
|
3
|
+
*
|
|
4
|
+
* Generates regex rewrite rules from deno.json's import map so that bare
|
|
5
|
+
* specifiers in user code (e.g. `from "ai"`) are rewritten to pinned npm:
|
|
6
|
+
* specifiers (e.g. `from "npm:ai@6.0.33"`).
|
|
7
|
+
*
|
|
8
|
+
* Single source of truth: versions come from deno.json — no hardcoded strings.
|
|
9
|
+
*
|
|
10
|
+
* @module transforms/npm-import-rewrites
|
|
11
|
+
*/
|
|
12
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
13
|
+
import { cwd } from "../platform/compat/process.js";
|
|
14
|
+
import { join } from "../platform/compat/path/index.js";
|
|
15
|
+
/**
|
|
16
|
+
* Bare specifiers that should be rewritten to their pinned npm: versions.
|
|
17
|
+
* Each must have a corresponding entry in deno.json's import map.
|
|
18
|
+
*/
|
|
19
|
+
const REWRITABLE_PACKAGES = [
|
|
20
|
+
"ai",
|
|
21
|
+
"@ai-sdk/anthropic",
|
|
22
|
+
"@ai-sdk/openai",
|
|
23
|
+
"@ai-sdk/google",
|
|
24
|
+
"@ai-sdk/mistral",
|
|
25
|
+
"@ai-sdk/provider",
|
|
26
|
+
"@ai-sdk/provider-utils",
|
|
27
|
+
"zod",
|
|
28
|
+
];
|
|
29
|
+
let cachedRules;
|
|
30
|
+
function escapeForRegex(pkg) {
|
|
31
|
+
return pkg.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
32
|
+
}
|
|
33
|
+
function buildRules(importMap) {
|
|
34
|
+
const rules = [];
|
|
35
|
+
for (const pkg of REWRITABLE_PACKAGES) {
|
|
36
|
+
const mapped = importMap[pkg];
|
|
37
|
+
if (!mapped)
|
|
38
|
+
continue;
|
|
39
|
+
// deno.json values look like "npm:ai@6.0.33" — use as-is
|
|
40
|
+
const escaped = escapeForRegex(pkg);
|
|
41
|
+
// Static imports: from "ai"
|
|
42
|
+
rules.push({
|
|
43
|
+
pattern: new RegExp(`from\\s+["']${escaped}["']`, "g"),
|
|
44
|
+
replacement: `from "${mapped}"`,
|
|
45
|
+
});
|
|
46
|
+
// Dynamic imports: import("ai")
|
|
47
|
+
rules.push({
|
|
48
|
+
pattern: new RegExp(`import\\s*\\(\\s*["']${escaped}["']\\s*\\)`, "g"),
|
|
49
|
+
replacement: `import("${mapped}")`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return rules;
|
|
53
|
+
}
|
|
54
|
+
function loadImportMapSync() {
|
|
55
|
+
try {
|
|
56
|
+
const denoJsonPath = join(cwd(), "deno.json");
|
|
57
|
+
const content = dntShim.Deno.readTextFileSync(denoJsonPath);
|
|
58
|
+
const config = JSON.parse(content);
|
|
59
|
+
return config.imports ?? {};
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// deno.json may not exist (e.g. compiled binary running in user project dir)
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns rewrite rules derived from deno.json's import map.
|
|
68
|
+
* Rules are cached after first call.
|
|
69
|
+
*/
|
|
70
|
+
export function getNpmRewriteRules() {
|
|
71
|
+
if (cachedRules)
|
|
72
|
+
return cachedRules;
|
|
73
|
+
const importMap = loadImportMapSync();
|
|
74
|
+
cachedRules = buildRules(importMap);
|
|
75
|
+
return cachedRules;
|
|
76
|
+
}
|
|
77
|
+
const isDeno = typeof dntShim.dntGlobalThis.Deno !== "undefined";
|
|
78
|
+
/**
|
|
79
|
+
* Apply npm import rewrites to source code.
|
|
80
|
+
* Rewrites bare specifiers to pinned npm: versions from deno.json.
|
|
81
|
+
* No-op on Node.js where bare specifiers resolve via node_modules.
|
|
82
|
+
*/
|
|
83
|
+
export function rewriteNpmImports(source) {
|
|
84
|
+
if (!isDeno)
|
|
85
|
+
return source;
|
|
86
|
+
let result = source;
|
|
87
|
+
for (const { pattern, replacement } of getNpmRewriteRules()) {
|
|
88
|
+
result = result.replace(pattern, replacement);
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
/** Exported for testing */
|
|
93
|
+
export { buildRules, REWRITABLE_PACKAGES };
|
|
94
|
+
/** @internal Reset cached rules — only for testing */
|
|
95
|
+
export function _resetCache() {
|
|
96
|
+
cachedRules = undefined;
|
|
97
|
+
}
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import { downloadUploadToFile, listAllUploads, type UploadItem } from "../upload
|
|
|
10
10
|
import { putRemoteFileFromLocal } from "../files/command.js";
|
|
11
11
|
import { knowledgeIngestPythonSource } from "./parser-source.js";
|
|
12
12
|
import { createJobUserLogger, type Logger, serverLogger } from "../../../src/utils/index.js";
|
|
13
|
+
import { writeJobResultIfConfigured } from "../../utils/write-job-result.js";
|
|
13
14
|
|
|
14
15
|
const SUPPORTED_EXTENSIONS = new Set([
|
|
15
16
|
".pdf",
|
|
@@ -637,6 +638,8 @@ export async function knowledgeCommand(args: ParsedArgs): Promise<void> {
|
|
|
637
638
|
progress_total: results.length,
|
|
638
639
|
});
|
|
639
640
|
|
|
641
|
+
await writeJobResultIfConfigured(results);
|
|
642
|
+
|
|
640
643
|
if (options.json) {
|
|
641
644
|
printJson(results);
|
|
642
645
|
return;
|
|
@@ -11,6 +11,7 @@ import { cliLogger } from "../../utils/index.js";
|
|
|
11
11
|
import { exitProcess } from "../../utils/index.js";
|
|
12
12
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
13
13
|
import { sanitizeJobOutputForLogging } from "../../utils/sanitize-job-output.js";
|
|
14
|
+
import { writeJobResultIfConfigured } from "../../utils/write-job-result.js";
|
|
14
15
|
import type { TaskArgs } from "./handler.js";
|
|
15
16
|
|
|
16
17
|
export interface TaskOptions extends TaskArgs {}
|
|
@@ -96,6 +97,7 @@ export async function taskCommand(options: TaskOptions): Promise<void> {
|
|
|
96
97
|
if (result.success) {
|
|
97
98
|
cliLogger.info(`Task completed in ${result.durationMs}ms`);
|
|
98
99
|
if (result.result !== undefined) {
|
|
100
|
+
await writeJobResultIfConfigured(result.result);
|
|
99
101
|
cliLogger.info(
|
|
100
102
|
`Result: ${JSON.stringify(sanitizeJobOutputForLogging(result.result), null, 2)}`,
|
|
101
103
|
);
|
|
@@ -3,6 +3,7 @@ import { cliLogger } from "../../utils/index.js";
|
|
|
3
3
|
import { exitProcess } from "../../utils/index.js";
|
|
4
4
|
import { withProjectSourceContext } from "../../shared/project-source-context.js";
|
|
5
5
|
import { sanitizeJobOutputForLogging } from "../../utils/sanitize-job-output.js";
|
|
6
|
+
import { writeJobResultIfConfigured } from "../../utils/write-job-result.js";
|
|
6
7
|
import { getEnv } from "../../../src/platform/index.js";
|
|
7
8
|
import type { WorkflowArgs } from "./handler.js";
|
|
8
9
|
|
|
@@ -45,6 +46,7 @@ async function waitForWorkflowExit(
|
|
|
45
46
|
if (run.status === "completed") {
|
|
46
47
|
cliLogger.info(`Workflow completed: ${runId}`);
|
|
47
48
|
if (run.output !== undefined) {
|
|
49
|
+
await writeJobResultIfConfigured(run.output);
|
|
48
50
|
cliLogger.info(
|
|
49
51
|
`Result: ${JSON.stringify(sanitizeJobOutputForLogging(run.output), null, 2)}`,
|
|
50
52
|
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { dirname } from "../../src/platform/compat/path/index.js";
|
|
3
|
+
import { sanitizeJobOutputForLogging } from "./sanitize-job-output.js";
|
|
4
|
+
|
|
5
|
+
const JOB_RESULT_PATH_ENV = "VERYFRONT_JOB_RESULT_PATH";
|
|
6
|
+
|
|
7
|
+
function getJobResultPath(): string | null {
|
|
8
|
+
const value = dntShim.Deno.env.get(JOB_RESULT_PATH_ENV)?.trim();
|
|
9
|
+
return value ? value : null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function writeJobResultIfConfigured(value: unknown): Promise<void> {
|
|
13
|
+
const resultPath = getJobResultPath();
|
|
14
|
+
if (!resultPath) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
await dntShim.Deno.mkdir(dirname(resultPath), { recursive: true });
|
|
19
|
+
await dntShim.Deno.writeTextFile(
|
|
20
|
+
resultPath,
|
|
21
|
+
JSON.stringify(sanitizeJobOutputForLogging(value), null, 2),
|
|
22
|
+
);
|
|
23
|
+
}
|
package/src/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.80",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"exclude": [
|
|
@@ -251,12 +251,15 @@ export default {
|
|
|
251
251
|
"@ai-sdk/openai": "npm:@ai-sdk/openai@3.0.28",
|
|
252
252
|
"@ai-sdk/anthropic": "npm:@ai-sdk/anthropic@3.0.43",
|
|
253
253
|
"@ai-sdk/google": "npm:@ai-sdk/google@3.0.29",
|
|
254
|
+
"@ai-sdk/mistral": "npm:@ai-sdk/mistral@3.0.14",
|
|
255
|
+
"@ai-sdk/provider": "npm:@ai-sdk/provider@3.0.2",
|
|
256
|
+
"@ai-sdk/provider-utils": "npm:@ai-sdk/provider-utils@4.0.5",
|
|
254
257
|
"tailwindcss": "https://esm.sh/tailwindcss@4.1.8",
|
|
255
258
|
"tailwindcss/plugin": "https://esm.sh/tailwindcss@4.1.8/plugin",
|
|
256
259
|
"tailwindcss/defaultTheme": "https://esm.sh/tailwindcss@4.1.8/defaultTheme",
|
|
257
260
|
"tailwindcss/colors": "https://esm.sh/tailwindcss@4.1.8/colors",
|
|
258
261
|
"redis": "npm:redis@4.6.13",
|
|
259
|
-
"pg": "npm:pg",
|
|
262
|
+
"pg": "npm:pg@8.13.1",
|
|
260
263
|
"jose": "npm:jose@5.9.6",
|
|
261
264
|
"@opentelemetry/api": "npm:@opentelemetry/api@1",
|
|
262
265
|
"@opentelemetry/core": "npm:@opentelemetry/core@1",
|
package/src/src/jobs/schemas.ts
CHANGED
|
@@ -39,6 +39,10 @@ export const JobResultSchema = z
|
|
|
39
39
|
kind: z.literal("knowledge_ingest"),
|
|
40
40
|
files: z.array(KnowledgeIngestFileResultSchema),
|
|
41
41
|
}),
|
|
42
|
+
z.object({
|
|
43
|
+
kind: z.literal("value"),
|
|
44
|
+
value: z.unknown(),
|
|
45
|
+
}),
|
|
42
46
|
z.object({
|
|
43
47
|
kind: z.literal("artifacts"),
|
|
44
48
|
artifacts: z.array(z.unknown()),
|
|
@@ -8,6 +8,7 @@ import * as dntShim from "../../_dnt.shims.js";
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
import { DEFAULT_DASHBOARD_PORT, rendererLogger } from "../utils/index.js";
|
|
11
|
+
import { rewriteNpmImports } from "../transforms/npm-import-rewrites.js";
|
|
11
12
|
import { dirname, join } from "../platform/compat/path/index.js";
|
|
12
13
|
import { cwd } from "../platform/compat/process.js";
|
|
13
14
|
import { RENDER_ERROR } from "../errors/error-registry.js";
|
|
@@ -46,11 +47,6 @@ interface ScriptPageOptions {
|
|
|
46
47
|
nonce?: string;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
const NPM_REWRITES: ReadonlyArray<{ pattern: RegExp; replacement: string }> = [
|
|
50
|
-
{ pattern: /from\s+["']ai["']/g, replacement: 'from "npm:ai@latest"' },
|
|
51
|
-
{ pattern: /from\s+["']zod["']/g, replacement: 'from "npm:zod@latest"' },
|
|
52
|
-
];
|
|
53
|
-
|
|
54
50
|
const ESBUILD_EXTERNALS = [
|
|
55
51
|
"ai",
|
|
56
52
|
"ai/*",
|
|
@@ -313,17 +309,6 @@ async function readFileWithFallback(
|
|
|
313
309
|
}
|
|
314
310
|
}
|
|
315
311
|
|
|
316
|
-
function rewriteNpmImports(code: string): string {
|
|
317
|
-
const isDeno = typeof (dntShim.dntGlobalThis as { Deno?: unknown }).Deno !== "undefined";
|
|
318
|
-
if (!isDeno) return code;
|
|
319
|
-
|
|
320
|
-
let result = code;
|
|
321
|
-
for (const { pattern, replacement } of NPM_REWRITES) {
|
|
322
|
-
result = result.replace(pattern, replacement);
|
|
323
|
-
}
|
|
324
|
-
return result;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
312
|
async function transpileWithEsbuild(
|
|
328
313
|
source: string,
|
|
329
314
|
modulePath: string,
|
|
@@ -17,6 +17,7 @@ import { withSpan } from "../../../observability/tracing/otlp-setup.js";
|
|
|
17
17
|
import { isCompiledBinary } from "../../../utils/index.js";
|
|
18
18
|
import { wrapWithCurrentContext } from "../../../platform/adapters/fs/veryfront/multi-project-adapter.js";
|
|
19
19
|
import { isWithinDirectory } from "../../../security/path-validation.js";
|
|
20
|
+
import { rewriteNpmImports } from "../../../transforms/npm-import-rewrites.js";
|
|
20
21
|
|
|
21
22
|
const logger = serverLogger.component("api");
|
|
22
23
|
|
|
@@ -806,64 +807,7 @@ async function rewriteExternalImports(
|
|
|
806
807
|
}
|
|
807
808
|
|
|
808
809
|
if (isDeno) {
|
|
809
|
-
|
|
810
|
-
{ pattern: /from\s+["']ai["']/g, replacement: 'from "npm:ai@latest"' },
|
|
811
|
-
{
|
|
812
|
-
pattern: /from\s+["']@ai-sdk\/anthropic["']/g,
|
|
813
|
-
replacement: 'from "npm:@ai-sdk/anthropic@latest"',
|
|
814
|
-
},
|
|
815
|
-
{
|
|
816
|
-
pattern: /from\s+["']@ai-sdk\/openai["']/g,
|
|
817
|
-
replacement: 'from "npm:@ai-sdk/openai@latest"',
|
|
818
|
-
},
|
|
819
|
-
{
|
|
820
|
-
pattern: /from\s+["']@ai-sdk\/google["']/g,
|
|
821
|
-
replacement: 'from "npm:@ai-sdk/google@latest"',
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
pattern: /from\s+["']@ai-sdk\/mistral["']/g,
|
|
825
|
-
replacement: 'from "npm:@ai-sdk/mistral@latest"',
|
|
826
|
-
},
|
|
827
|
-
{
|
|
828
|
-
pattern: /from\s+["']@ai-sdk\/provider["']/g,
|
|
829
|
-
replacement: 'from "npm:@ai-sdk/provider@latest"',
|
|
830
|
-
},
|
|
831
|
-
{
|
|
832
|
-
pattern: /from\s+["']@ai-sdk\/provider-utils["']/g,
|
|
833
|
-
replacement: 'from "npm:@ai-sdk/provider-utils@latest"',
|
|
834
|
-
},
|
|
835
|
-
{ pattern: /from\s+["']zod["']/g, replacement: 'from "npm:zod@latest"' },
|
|
836
|
-
{ pattern: /import\s*\(\s*["']ai["']\s*\)/g, replacement: 'import("npm:ai@latest")' },
|
|
837
|
-
{
|
|
838
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/anthropic["']\s*\)/g,
|
|
839
|
-
replacement: 'import("npm:@ai-sdk/anthropic@latest")',
|
|
840
|
-
},
|
|
841
|
-
{
|
|
842
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/openai["']\s*\)/g,
|
|
843
|
-
replacement: 'import("npm:@ai-sdk/openai@latest")',
|
|
844
|
-
},
|
|
845
|
-
{
|
|
846
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/google["']\s*\)/g,
|
|
847
|
-
replacement: 'import("npm:@ai-sdk/google@latest")',
|
|
848
|
-
},
|
|
849
|
-
{
|
|
850
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/mistral["']\s*\)/g,
|
|
851
|
-
replacement: 'import("npm:@ai-sdk/mistral@latest")',
|
|
852
|
-
},
|
|
853
|
-
{
|
|
854
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/provider["']\s*\)/g,
|
|
855
|
-
replacement: 'import("npm:@ai-sdk/provider@latest")',
|
|
856
|
-
},
|
|
857
|
-
{
|
|
858
|
-
pattern: /import\s*\(\s*["']@ai-sdk\/provider-utils["']\s*\)/g,
|
|
859
|
-
replacement: 'import("npm:@ai-sdk/provider-utils@latest")',
|
|
860
|
-
},
|
|
861
|
-
{ pattern: /import\s*\(\s*["']zod["']\s*\)/g, replacement: 'import("npm:zod@latest")' },
|
|
862
|
-
];
|
|
863
|
-
|
|
864
|
-
for (const { pattern, replacement } of rewrites) {
|
|
865
|
-
transformed = transformed.replace(pattern, replacement);
|
|
866
|
-
}
|
|
810
|
+
transformed = rewriteNpmImports(transformed);
|
|
867
811
|
|
|
868
812
|
// Rewrite bare Node.js built-in imports to node: prefix for Deno compatibility.
|
|
869
813
|
// npm packages often use require('fs') / from "fs" without the node: prefix.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NPM Import Rewrites for Deno
|
|
3
|
+
*
|
|
4
|
+
* Generates regex rewrite rules from deno.json's import map so that bare
|
|
5
|
+
* specifiers in user code (e.g. `from "ai"`) are rewritten to pinned npm:
|
|
6
|
+
* specifiers (e.g. `from "npm:ai@6.0.33"`).
|
|
7
|
+
*
|
|
8
|
+
* Single source of truth: versions come from deno.json — no hardcoded strings.
|
|
9
|
+
*
|
|
10
|
+
* @module transforms/npm-import-rewrites
|
|
11
|
+
*/
|
|
12
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import { cwd } from "../platform/compat/process.js";
|
|
16
|
+
import { join } from "../platform/compat/path/index.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Bare specifiers that should be rewritten to their pinned npm: versions.
|
|
20
|
+
* Each must have a corresponding entry in deno.json's import map.
|
|
21
|
+
*/
|
|
22
|
+
const REWRITABLE_PACKAGES = [
|
|
23
|
+
"ai",
|
|
24
|
+
"@ai-sdk/anthropic",
|
|
25
|
+
"@ai-sdk/openai",
|
|
26
|
+
"@ai-sdk/google",
|
|
27
|
+
"@ai-sdk/mistral",
|
|
28
|
+
"@ai-sdk/provider",
|
|
29
|
+
"@ai-sdk/provider-utils",
|
|
30
|
+
"zod",
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
interface RewriteRule {
|
|
34
|
+
pattern: RegExp;
|
|
35
|
+
replacement: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let cachedRules: RewriteRule[] | undefined;
|
|
39
|
+
|
|
40
|
+
function escapeForRegex(pkg: string): string {
|
|
41
|
+
return pkg.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function buildRules(importMap: Record<string, string>): RewriteRule[] {
|
|
45
|
+
const rules: RewriteRule[] = [];
|
|
46
|
+
|
|
47
|
+
for (const pkg of REWRITABLE_PACKAGES) {
|
|
48
|
+
const mapped = importMap[pkg];
|
|
49
|
+
if (!mapped) continue;
|
|
50
|
+
|
|
51
|
+
// deno.json values look like "npm:ai@6.0.33" — use as-is
|
|
52
|
+
const escaped = escapeForRegex(pkg);
|
|
53
|
+
|
|
54
|
+
// Static imports: from "ai"
|
|
55
|
+
rules.push({
|
|
56
|
+
pattern: new RegExp(`from\\s+["']${escaped}["']`, "g"),
|
|
57
|
+
replacement: `from "${mapped}"`,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Dynamic imports: import("ai")
|
|
61
|
+
rules.push({
|
|
62
|
+
pattern: new RegExp(`import\\s*\\(\\s*["']${escaped}["']\\s*\\)`, "g"),
|
|
63
|
+
replacement: `import("${mapped}")`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return rules;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function loadImportMapSync(): Record<string, string> {
|
|
71
|
+
try {
|
|
72
|
+
const denoJsonPath = join(cwd(), "deno.json");
|
|
73
|
+
const content = dntShim.Deno.readTextFileSync(denoJsonPath);
|
|
74
|
+
const config = JSON.parse(content);
|
|
75
|
+
return config.imports ?? {};
|
|
76
|
+
} catch {
|
|
77
|
+
// deno.json may not exist (e.g. compiled binary running in user project dir)
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns rewrite rules derived from deno.json's import map.
|
|
84
|
+
* Rules are cached after first call.
|
|
85
|
+
*/
|
|
86
|
+
export function getNpmRewriteRules(): RewriteRule[] {
|
|
87
|
+
if (cachedRules) return cachedRules;
|
|
88
|
+
const importMap = loadImportMapSync();
|
|
89
|
+
cachedRules = buildRules(importMap);
|
|
90
|
+
return cachedRules;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const isDeno = typeof (dntShim.dntGlobalThis as { Deno?: unknown }).Deno !== "undefined";
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Apply npm import rewrites to source code.
|
|
97
|
+
* Rewrites bare specifiers to pinned npm: versions from deno.json.
|
|
98
|
+
* No-op on Node.js where bare specifiers resolve via node_modules.
|
|
99
|
+
*/
|
|
100
|
+
export function rewriteNpmImports(source: string): string {
|
|
101
|
+
if (!isDeno) return source;
|
|
102
|
+
let result = source;
|
|
103
|
+
for (const { pattern, replacement } of getNpmRewriteRules()) {
|
|
104
|
+
result = result.replace(pattern, replacement);
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Exported for testing */
|
|
110
|
+
export { buildRules, REWRITABLE_PACKAGES };
|
|
111
|
+
|
|
112
|
+
/** @internal Reset cached rules — only for testing */
|
|
113
|
+
export function _resetCache(): void {
|
|
114
|
+
cachedRules = undefined;
|
|
115
|
+
}
|