veryfront 0.1.367 → 0.1.369
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/init/config-generator.d.ts.map +1 -1
- package/esm/cli/commands/init/config-generator.js +1 -0
- package/esm/cli/main.js +15 -0
- package/esm/deno.d.ts +3 -3
- package/esm/deno.js +5 -5
- package/esm/extensions/ext-esbuild/src/binary.d.ts +7 -0
- package/esm/extensions/ext-esbuild/src/binary.d.ts.map +1 -0
- package/esm/extensions/ext-esbuild/src/binary.js +143 -0
- package/esm/extensions/ext-esbuild/src/es-module-lexer.d.ts +17 -0
- package/esm/extensions/ext-esbuild/src/es-module-lexer.d.ts.map +1 -0
- package/esm/extensions/ext-esbuild/src/es-module-lexer.js +29 -0
- package/esm/extensions/ext-esbuild/src/esbuild-bundler.d.ts +20 -0
- package/esm/extensions/ext-esbuild/src/esbuild-bundler.d.ts.map +1 -0
- package/esm/extensions/ext-esbuild/src/esbuild-bundler.js +98 -0
- package/esm/extensions/ext-esbuild/src/index.d.ts +19 -0
- package/esm/extensions/ext-esbuild/src/index.d.ts.map +1 -0
- package/esm/extensions/ext-esbuild/src/index.js +40 -0
- package/esm/extensions/ext-esbuild/src/plugin-adapter.d.ts +14 -0
- package/esm/extensions/ext-esbuild/src/plugin-adapter.d.ts.map +1 -0
- package/esm/extensions/ext-esbuild/src/plugin-adapter.js +55 -0
- package/esm/extensions/ext-esbuild/src/runtime.d.ts +4 -0
- package/esm/extensions/ext-esbuild/src/runtime.d.ts.map +1 -0
- package/esm/extensions/ext-esbuild/src/runtime.js +43 -0
- package/esm/src/agent/conversation-bootstrap.d.ts +1 -1
- package/esm/src/agent/conversation-bootstrap.d.ts.map +1 -1
- package/esm/src/agent/conversation-bootstrap.js +1 -1
- package/esm/src/agent/conversation-root-run-context.d.ts +3 -3
- package/esm/src/agent/conversation-root-run-context.d.ts.map +1 -1
- package/esm/src/agent/conversation-root-run-context.js +3 -3
- package/esm/src/agent/durable.d.ts +1 -1
- package/esm/src/agent/durable.d.ts.map +1 -1
- package/esm/src/agent/durable.js +2 -2
- package/esm/src/agent/fork-runtime-stream.d.ts +11 -1
- package/esm/src/agent/fork-runtime-stream.d.ts.map +1 -1
- package/esm/src/agent/fork-runtime-stream.js +36 -0
- package/esm/src/agent/hosted-child-bootstrap.d.ts +1 -1
- package/esm/src/agent/hosted-child-bootstrap.d.ts.map +1 -1
- package/esm/src/agent/hosted-child-bootstrap.js +1 -1
- 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/build/bundler/code-splitter/build-context.d.ts +1 -1
- package/esm/src/build/bundler/code-splitter/build-context.d.ts.map +1 -1
- package/esm/src/build/bundler/code-splitter/build-context.js +1 -1
- package/esm/src/build/bundler/code-splitter/esbuild-plugin.d.ts +1 -1
- package/esm/src/build/bundler/code-splitter/esbuild-plugin.d.ts.map +1 -1
- package/esm/src/build/bundler/code-splitter/manifest-builder.d.ts +1 -1
- package/esm/src/build/bundler/code-splitter/manifest-builder.d.ts.map +1 -1
- package/esm/src/build/bundler/code-splitter/types.d.ts +1 -1
- package/esm/src/build/bundler/code-splitter/types.d.ts.map +1 -1
- package/esm/src/build/compiler/mdx-compiler/transpiler.js +1 -1
- package/esm/src/build/compiler/mdx-to-js.js +1 -1
- package/esm/src/build/embedded/preset.js +1 -1
- package/esm/src/build/production-build/client-runtime.js +1 -1
- package/esm/src/discovery/transpiler.js +1 -1
- package/esm/src/extensions/bundler.d.ts +28 -0
- package/esm/src/extensions/bundler.d.ts.map +1 -0
- package/esm/src/extensions/bundler.js +42 -0
- package/esm/src/extensions/interfaces/bundler.d.ts +162 -27
- package/esm/src/extensions/interfaces/bundler.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/index.d.ts +2 -1
- package/esm/src/extensions/interfaces/index.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/module-lexer.d.ts +45 -0
- package/esm/src/extensions/interfaces/module-lexer.d.ts.map +1 -0
- package/esm/src/extensions/interfaces/module-lexer.js +13 -0
- package/esm/src/extensions/loader.d.ts.map +1 -1
- package/esm/src/extensions/loader.js +7 -1
- package/esm/src/extensions/recommendations.d.ts.map +1 -1
- package/esm/src/extensions/recommendations.js +3 -0
- package/esm/src/platform/compat/esbuild.d.ts +20 -6
- package/esm/src/platform/compat/esbuild.d.ts.map +1 -1
- package/esm/src/platform/compat/esbuild.js +20 -137
- package/esm/src/rendering/script-page-handling.js +1 -1
- package/esm/src/routing/api/module-loader/esbuild-plugin.d.ts +1 -1
- package/esm/src/routing/api/module-loader/esbuild-plugin.d.ts.map +1 -1
- package/esm/src/routing/api/module-loader/loader.js +1 -1
- package/esm/src/server/bootstrap.d.ts.map +1 -1
- package/esm/src/server/bootstrap.js +22 -0
- package/esm/src/server/dev-server/middleware.js +1 -1
- package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts +1 -1
- package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts.map +1 -1
- package/esm/src/server/handlers/studio/bridge-modules.handler.js +1 -1
- package/esm/src/server/services/rsc/endpoints/script-handlers.js +1 -1
- package/esm/src/server/services/rsc/orchestrators/hydrator-handler.js +1 -1
- package/esm/src/server/shared/browser-module-bundler.js +1 -1
- package/esm/src/testing/bdd.d.ts +1 -0
- package/esm/src/testing/bdd.d.ts.map +1 -1
- package/esm/src/testing/bdd.js +1 -0
- package/esm/src/testing/init.js +7 -0
- package/esm/src/transforms/esm/http-bundler.d.ts +1 -1
- package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
- package/esm/src/transforms/esm/lexer.d.ts +2 -9
- package/esm/src/transforms/esm/lexer.d.ts.map +1 -1
- package/esm/src/transforms/esm/lexer.js +9 -10
- package/esm/src/transforms/esm/transform-utils.d.ts +1 -1
- package/esm/src/transforms/esm/transform-utils.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/parse-cache.d.ts +1 -1
- package/esm/src/transforms/import-rewriter/parse-cache.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/parse-cache.js +8 -7
- package/esm/src/transforms/mdx/esm-module-loader/import-transformer.js +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/transform.js +2 -2
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/cli/commands/init/config-generator.ts +1 -0
- package/src/cli/main.ts +14 -0
- package/src/deno.js +5 -5
- package/src/extensions/ext-esbuild/src/binary.ts +154 -0
- package/src/extensions/ext-esbuild/src/es-module-lexer.ts +34 -0
- package/src/extensions/ext-esbuild/src/esbuild-bundler.ts +122 -0
- package/src/extensions/ext-esbuild/src/index.ts +46 -0
- package/src/extensions/ext-esbuild/src/plugin-adapter.ts +66 -0
- package/src/extensions/ext-esbuild/src/runtime.ts +54 -0
- package/src/src/agent/conversation-bootstrap.ts +2 -2
- package/src/src/agent/conversation-root-run-context.ts +6 -6
- package/src/src/agent/durable.ts +3 -3
- package/src/src/agent/fork-runtime-stream.ts +61 -1
- package/src/src/agent/hosted-child-bootstrap.ts +2 -2
- package/src/src/agent/index.ts +2 -0
- package/src/src/build/bundler/code-splitter/build-context.ts +1 -1
- package/src/src/build/bundler/code-splitter/esbuild-plugin.ts +1 -1
- package/src/src/build/bundler/code-splitter/manifest-builder.ts +1 -1
- package/src/src/build/bundler/code-splitter/splitter.ts +1 -1
- package/src/src/build/bundler/code-splitter/types.ts +1 -1
- package/src/src/build/compiler/mdx-compiler/transpiler.ts +1 -1
- package/src/src/build/compiler/mdx-to-js.ts +1 -1
- package/src/src/build/embedded/preset.ts +1 -1
- package/src/src/build/production-build/client-runtime.ts +2 -2
- package/src/src/discovery/transpiler.ts +2 -2
- package/src/src/extensions/bundler.ts +85 -0
- package/src/src/extensions/interfaces/bundler.ts +189 -16
- package/src/src/extensions/interfaces/index.ts +16 -0
- package/src/src/extensions/interfaces/module-lexer.ts +46 -0
- package/src/src/extensions/loader.ts +6 -1
- package/src/src/extensions/recommendations.ts +3 -0
- package/src/src/platform/compat/esbuild.ts +48 -160
- package/src/src/rendering/script-page-handling.ts +1 -1
- package/src/src/routing/api/module-loader/esbuild-plugin.ts +1 -1
- package/src/src/routing/api/module-loader/loader.ts +2 -2
- package/src/src/server/bootstrap.ts +29 -0
- package/src/src/server/dev-server/middleware.ts +1 -1
- package/src/src/server/handlers/dev/files/esbuild-plugins.ts +1 -1
- package/src/src/server/handlers/studio/bridge-modules.handler.ts +1 -1
- package/src/src/server/services/rsc/endpoints/script-handlers.ts +4 -4
- package/src/src/server/services/rsc/orchestrators/hydrator-handler.ts +1 -1
- package/src/src/server/shared/browser-module-bundler.ts +1 -1
- package/src/src/testing/bdd.ts +1 -0
- package/src/src/testing/init.ts +9 -0
- package/src/src/transforms/esm/http-bundler.ts +1 -1
- package/src/src/transforms/esm/lexer.ts +13 -21
- package/src/src/transforms/esm/transform-utils.ts +1 -1
- package/src/src/transforms/import-rewriter/parse-cache.ts +10 -7
- package/src/src/transforms/mdx/esm-module-loader/import-transformer.ts +1 -1
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/transform.ts +2 -2
- package/src/src/utils/version-constant.ts +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* es-module-lexer-backed implementation of the {@link ModuleLexer} contract.
|
|
3
|
+
*
|
|
4
|
+
* es-module-lexer@2 exports `init` as a Promise in its ESM build but older
|
|
5
|
+
* typings expect a function. We tolerate both shapes (as the in-tree
|
|
6
|
+
* src/transforms/esm/lexer.ts did).
|
|
7
|
+
*
|
|
8
|
+
* @module extensions/ext-esbuild/es-module-lexer
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ImportSpecifier, ModuleLexer } from "../../../src/extensions/interfaces/index.js";
|
|
12
|
+
import { init, parse } from "es-module-lexer";
|
|
13
|
+
|
|
14
|
+
/** es-module-lexer-backed {@link ModuleLexer} implementation. */
|
|
15
|
+
export class EsModuleLexer implements ModuleLexer {
|
|
16
|
+
private initPromise: Promise<void> | null = null;
|
|
17
|
+
|
|
18
|
+
async init(): Promise<void> {
|
|
19
|
+
if (this.initPromise) {
|
|
20
|
+
await this.initPromise;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const anyInit = init as unknown;
|
|
24
|
+
this.initPromise = typeof anyInit === "function"
|
|
25
|
+
? (anyInit as () => Promise<void>)()
|
|
26
|
+
: (anyInit as Promise<void>);
|
|
27
|
+
await this.initPromise;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
parse(code: string): readonly ImportSpecifier[] {
|
|
31
|
+
const [imports] = parse(code);
|
|
32
|
+
return imports as readonly ImportSpecifier[];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* esbuild-backed implementation of the {@link Bundler} contract.
|
|
3
|
+
*
|
|
4
|
+
* Lazy-initializes the esbuild binary (including `deno compile` VFS
|
|
5
|
+
* extraction) on first use. All options pass through to esbuild unchanged
|
|
6
|
+
* because the {@link BundleOptions} shape was designed to be esbuild-compatible;
|
|
7
|
+
* the only translation is converting {@link BundlerPlugin}s into esbuild
|
|
8
|
+
* plugins via {@link toEsbuildPlugin}.
|
|
9
|
+
*
|
|
10
|
+
* @module extensions/ext-esbuild/esbuild-bundler
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
BuildContext,
|
|
15
|
+
BundleOptions,
|
|
16
|
+
BundleOutput,
|
|
17
|
+
Bundler,
|
|
18
|
+
BundleResult,
|
|
19
|
+
BundlerMessage,
|
|
20
|
+
Metafile,
|
|
21
|
+
TransformOptions,
|
|
22
|
+
TransformResult,
|
|
23
|
+
} from "../../../src/extensions/interfaces/index.js";
|
|
24
|
+
|
|
25
|
+
import { ensureEsbuildBinary } from "./binary.js";
|
|
26
|
+
import { toEsbuildPlugin } from "./plugin-adapter.js";
|
|
27
|
+
|
|
28
|
+
// deno-lint-ignore no-explicit-any
|
|
29
|
+
type EsbuildModule = any;
|
|
30
|
+
|
|
31
|
+
let esbuildModule: EsbuildModule | null = null;
|
|
32
|
+
|
|
33
|
+
async function getEsbuild(): Promise<EsbuildModule> {
|
|
34
|
+
await ensureEsbuildBinary();
|
|
35
|
+
if (esbuildModule) return esbuildModule;
|
|
36
|
+
esbuildModule = await import("esbuild");
|
|
37
|
+
return esbuildModule;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// deno-lint-ignore no-explicit-any
|
|
41
|
+
function toMessage(m: any): BundlerMessage {
|
|
42
|
+
return {
|
|
43
|
+
text: m.text,
|
|
44
|
+
location: m.location ?? null,
|
|
45
|
+
notes: m.notes,
|
|
46
|
+
pluginName: m.pluginName,
|
|
47
|
+
detail: m.detail,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// deno-lint-ignore no-explicit-any
|
|
52
|
+
function toMessages(ms: any[] | undefined): BundlerMessage[] {
|
|
53
|
+
return (ms ?? []).map(toMessage);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// deno-lint-ignore no-explicit-any
|
|
57
|
+
function toOutput(f: any): BundleOutput {
|
|
58
|
+
return {
|
|
59
|
+
path: f.path,
|
|
60
|
+
contents: f.contents,
|
|
61
|
+
text: f.text,
|
|
62
|
+
hash: f.hash,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function mapOptions(options: BundleOptions): Record<string, unknown> {
|
|
67
|
+
const { plugins, ...rest } = options;
|
|
68
|
+
const mapped: Record<string, unknown> = { ...rest };
|
|
69
|
+
if (plugins && plugins.length > 0) {
|
|
70
|
+
mapped.plugins = plugins.map(toEsbuildPlugin);
|
|
71
|
+
}
|
|
72
|
+
return mapped;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** esbuild-backed {@link Bundler} implementation. */
|
|
76
|
+
export class EsbuildBundler implements Bundler {
|
|
77
|
+
async bundle(options: BundleOptions): Promise<BundleResult> {
|
|
78
|
+
const esbuild = await getEsbuild();
|
|
79
|
+
const result = await esbuild.build(mapOptions(options));
|
|
80
|
+
return {
|
|
81
|
+
outputFiles: (result.outputFiles ?? []).map(toOutput),
|
|
82
|
+
warnings: toMessages(result.warnings),
|
|
83
|
+
errors: toMessages(result.errors),
|
|
84
|
+
metafile: result.metafile as Metafile | undefined,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async transform(options: TransformOptions): Promise<TransformResult> {
|
|
89
|
+
const esbuild = await getEsbuild();
|
|
90
|
+
const { code, ...rest } = options;
|
|
91
|
+
const result = await esbuild.transform(code, rest);
|
|
92
|
+
return {
|
|
93
|
+
code: result.code,
|
|
94
|
+
map: result.map,
|
|
95
|
+
warnings: toMessages(result.warnings).map((m) => m.text),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async context(options: BundleOptions): Promise<BuildContext> {
|
|
100
|
+
const esbuild = await getEsbuild();
|
|
101
|
+
const ctx = await esbuild.context(mapOptions(options));
|
|
102
|
+
return {
|
|
103
|
+
rebuild: async () => {
|
|
104
|
+
const result = await ctx.rebuild();
|
|
105
|
+
return {
|
|
106
|
+
outputFiles: (result.outputFiles ?? []).map(toOutput),
|
|
107
|
+
warnings: toMessages(result.warnings),
|
|
108
|
+
errors: toMessages(result.errors),
|
|
109
|
+
metafile: result.metafile as Metafile | undefined,
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
dispose: () => ctx.dispose(),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async stop(): Promise<void> {
|
|
117
|
+
const m = esbuildModule;
|
|
118
|
+
if (!m) return;
|
|
119
|
+
esbuildModule = null;
|
|
120
|
+
await m.stop();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ext-esbuild — Bundler + ModuleLexer contract implementations backed by
|
|
3
|
+
* esbuild and es-module-lexer.
|
|
4
|
+
*
|
|
5
|
+
* @module extensions/ext-esbuild
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ExtensionFactory } from "../../../src/extensions/index.js";
|
|
9
|
+
|
|
10
|
+
import { EsbuildBundler } from "./esbuild-bundler.js";
|
|
11
|
+
import { EsModuleLexer } from "./es-module-lexer.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Default export — the ext-esbuild extension factory.
|
|
15
|
+
*
|
|
16
|
+
* Registers both the `Bundler` (esbuild-backed) and `ModuleLexer`
|
|
17
|
+
* (es-module-lexer-backed) contracts.
|
|
18
|
+
*/
|
|
19
|
+
const extEsbuild: ExtensionFactory = () => {
|
|
20
|
+
const bundler = new EsbuildBundler();
|
|
21
|
+
const lexer = new EsModuleLexer();
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
name: "ext-esbuild",
|
|
25
|
+
version: "0.1.0",
|
|
26
|
+
capabilities: [
|
|
27
|
+
{ type: "contract", name: "Bundler" },
|
|
28
|
+
{ type: "contract", name: "ModuleLexer" },
|
|
29
|
+
],
|
|
30
|
+
setup(ctx) {
|
|
31
|
+
if (!ctx.get("Bundler")) {
|
|
32
|
+
ctx.provide("Bundler", bundler);
|
|
33
|
+
}
|
|
34
|
+
if (!ctx.get("ModuleLexer")) {
|
|
35
|
+
ctx.provide("ModuleLexer", lexer);
|
|
36
|
+
}
|
|
37
|
+
ctx.logger.info("[ext-esbuild] Bundler + ModuleLexer registered");
|
|
38
|
+
},
|
|
39
|
+
async teardown() {
|
|
40
|
+
await bundler.stop?.();
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default extEsbuild;
|
|
46
|
+
export { EsbuildBundler, EsModuleLexer };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin adapter — converts {@link BundlerPlugin} (the bundler-agnostic
|
|
3
|
+
* contract shape) into an esbuild `Plugin`. The contract's onResolve /
|
|
4
|
+
* onLoad shapes were deliberately designed to match esbuild's, so the
|
|
5
|
+
* translation is near-1:1; this module exists to isolate the esbuild
|
|
6
|
+
* import from the rest of the extension.
|
|
7
|
+
*
|
|
8
|
+
* @module extensions/ext-esbuild/plugin-adapter
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
BundlerPlugin,
|
|
13
|
+
BundlerPluginBuild,
|
|
14
|
+
OnLoadArgs,
|
|
15
|
+
OnLoadResult,
|
|
16
|
+
OnResolveArgs,
|
|
17
|
+
OnResolveResult,
|
|
18
|
+
} from "../../../src/extensions/interfaces/index.js";
|
|
19
|
+
// deno-lint-ignore no-explicit-any
|
|
20
|
+
type EsbuildPlugin = any;
|
|
21
|
+
|
|
22
|
+
export function toEsbuildPlugin(plugin: BundlerPlugin): EsbuildPlugin {
|
|
23
|
+
return {
|
|
24
|
+
name: plugin.name,
|
|
25
|
+
// deno-lint-ignore no-explicit-any
|
|
26
|
+
setup(build: any) {
|
|
27
|
+
const bridged: BundlerPluginBuild = {
|
|
28
|
+
onResolve(options, callback) {
|
|
29
|
+
// deno-lint-ignore no-explicit-any
|
|
30
|
+
build.onResolve(options, async (args: any) => {
|
|
31
|
+
const resolveArgs: OnResolveArgs = {
|
|
32
|
+
path: args.path,
|
|
33
|
+
importer: args.importer,
|
|
34
|
+
namespace: args.namespace,
|
|
35
|
+
resolveDir: args.resolveDir,
|
|
36
|
+
kind: args.kind,
|
|
37
|
+
pluginData: args.pluginData,
|
|
38
|
+
};
|
|
39
|
+
const result = await callback(resolveArgs);
|
|
40
|
+
if (result == null) return result ?? null;
|
|
41
|
+
return result as OnResolveResult;
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onLoad(options, callback) {
|
|
45
|
+
// deno-lint-ignore no-explicit-any
|
|
46
|
+
build.onLoad(options, async (args: any) => {
|
|
47
|
+
const loadArgs: OnLoadArgs = {
|
|
48
|
+
path: args.path,
|
|
49
|
+
namespace: args.namespace,
|
|
50
|
+
suffix: args.suffix,
|
|
51
|
+
pluginData: args.pluginData,
|
|
52
|
+
};
|
|
53
|
+
const result = await callback(loadArgs);
|
|
54
|
+
if (result == null) return result ?? null;
|
|
55
|
+
return result as OnLoadResult;
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
onDispose(callback) {
|
|
59
|
+
build.onDispose(callback);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
plugin.setup(bridged);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime detection — inlined from src/platform/compat/runtime.ts so the
|
|
3
|
+
* extension stays dependency-free on core.
|
|
4
|
+
*
|
|
5
|
+
* Only the bits needed by the esbuild binary extractor are included here.
|
|
6
|
+
*
|
|
7
|
+
* @module extensions/ext-esbuild/runtime
|
|
8
|
+
*/
|
|
9
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
type GlobalWithRuntime = typeof dntShim.dntGlobalThis & {
|
|
13
|
+
process?: { versions?: { node?: string; deno?: string } };
|
|
14
|
+
Bun?: unknown;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function hasRealDeno(): boolean {
|
|
18
|
+
return (
|
|
19
|
+
typeof dntShim.Deno !== "undefined" &&
|
|
20
|
+
typeof dntShim.Deno.version === "object" &&
|
|
21
|
+
typeof dntShim.Deno.build === "object" &&
|
|
22
|
+
typeof dntShim.Deno.build.os === "string"
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function hasBunGlobal(): boolean {
|
|
27
|
+
return (dntShim.dntGlobalThis as GlobalWithRuntime).Bun != null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function hasNodeProcess(): boolean {
|
|
31
|
+
const g = dntShim.dntGlobalThis as GlobalWithRuntime;
|
|
32
|
+
return g.process?.versions?.node != null && !g.process?.versions?.deno;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const isDeno: boolean = !hasNodeProcess() && !hasBunGlobal() && hasRealDeno();
|
|
36
|
+
|
|
37
|
+
function testDenoCompiledDetection(execPath: string): boolean {
|
|
38
|
+
if (!execPath) return false;
|
|
39
|
+
const binary = execPath.split(/[/\\]/).pop()?.toLowerCase();
|
|
40
|
+
if (!binary) return false;
|
|
41
|
+
return binary !== "deno" && binary !== "deno.exe";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isDenoCompiledBinary(): boolean {
|
|
45
|
+
if (!hasRealDeno()) return false;
|
|
46
|
+
try {
|
|
47
|
+
return testDenoCompiledDetection(dntShim.Deno.execPath());
|
|
48
|
+
} catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** True if running inside a `deno compile`'d binary (needs VFS extraction). */
|
|
54
|
+
export const isDenoCompiled: boolean = isDeno && isDenoCompiledBinary();
|
|
@@ -216,7 +216,7 @@ export async function bootstrapConversationAgentRun(input: {
|
|
|
216
216
|
handoffMessageBody: unknown;
|
|
217
217
|
runId?: string;
|
|
218
218
|
agentId: string;
|
|
219
|
-
|
|
219
|
+
implementationKind?: string | null;
|
|
220
220
|
projectId?: string | null;
|
|
221
221
|
branchId?: string | null;
|
|
222
222
|
}): Promise<BootstrapConversationAgentRunResult> {
|
|
@@ -247,7 +247,7 @@ export async function bootstrapConversationAgentRun(input: {
|
|
|
247
247
|
conversationId: conversation.id,
|
|
248
248
|
runId: input.runId,
|
|
249
249
|
agentId: input.agentId,
|
|
250
|
-
|
|
250
|
+
implementationKind: input.implementationKind,
|
|
251
251
|
projectId: effectiveProjectId,
|
|
252
252
|
branchId: input.branchId,
|
|
253
253
|
});
|
|
@@ -57,7 +57,7 @@ export async function startConversationRootRun(input: {
|
|
|
57
57
|
projectId?: string | null;
|
|
58
58
|
branchId?: string | null;
|
|
59
59
|
agentId: string;
|
|
60
|
-
|
|
60
|
+
implementationKind?: string | null;
|
|
61
61
|
providedRun?: ConversationRootRunDescriptor;
|
|
62
62
|
}): Promise<ConversationRunProjection | null> {
|
|
63
63
|
if (input.providedRun) {
|
|
@@ -82,7 +82,7 @@ export async function startConversationRootRun(input: {
|
|
|
82
82
|
projectId: input.projectId ?? null,
|
|
83
83
|
branchId: input.branchId,
|
|
84
84
|
agentId: input.agentId,
|
|
85
|
-
|
|
85
|
+
implementationKind: input.implementationKind,
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -93,7 +93,7 @@ export function createConversationRootRunStartAdapter(input: {
|
|
|
93
93
|
projectId?: string | null;
|
|
94
94
|
branchId?: string | null;
|
|
95
95
|
agentId: string;
|
|
96
|
-
|
|
96
|
+
implementationKind?: string | null;
|
|
97
97
|
providedRun?: ConversationRootRunDescriptor;
|
|
98
98
|
}): (input: { abortSignal: AbortSignal }) => Promise<{ run: ConversationRunProjection | null }> {
|
|
99
99
|
return async () => ({
|
|
@@ -104,7 +104,7 @@ export function createConversationRootRunStartAdapter(input: {
|
|
|
104
104
|
projectId: input.projectId,
|
|
105
105
|
branchId: input.branchId,
|
|
106
106
|
agentId: input.agentId,
|
|
107
|
-
|
|
107
|
+
implementationKind: input.implementationKind,
|
|
108
108
|
providedRun: input.providedRun,
|
|
109
109
|
}),
|
|
110
110
|
});
|
|
@@ -117,7 +117,7 @@ export async function prepareConversationRootRunContext(input: {
|
|
|
117
117
|
projectId?: string | null;
|
|
118
118
|
branchId?: string | null;
|
|
119
119
|
agentId: string;
|
|
120
|
-
|
|
120
|
+
implementationKind?: string | null;
|
|
121
121
|
providedRun?: ConversationRootRunDescriptor;
|
|
122
122
|
parentRunId?: string;
|
|
123
123
|
parentMessageId?: string;
|
|
@@ -130,7 +130,7 @@ export async function prepareConversationRootRunContext(input: {
|
|
|
130
130
|
projectId: input.projectId,
|
|
131
131
|
branchId: input.branchId,
|
|
132
132
|
agentId: input.agentId,
|
|
133
|
-
|
|
133
|
+
implementationKind: input.implementationKind,
|
|
134
134
|
providedRun: input.providedRun,
|
|
135
135
|
})({ abortSignal: new AbortController().signal });
|
|
136
136
|
|
package/src/src/agent/durable.ts
CHANGED
|
@@ -294,7 +294,7 @@ export interface CreateConversationAgentRunInput {
|
|
|
294
294
|
conversationId: string;
|
|
295
295
|
runId?: string;
|
|
296
296
|
agentId: string;
|
|
297
|
-
|
|
297
|
+
implementationKind?: string | null;
|
|
298
298
|
projectId?: string | null;
|
|
299
299
|
branchId?: string | null;
|
|
300
300
|
}
|
|
@@ -1257,11 +1257,11 @@ export async function createConversationAgentRun(
|
|
|
1257
1257
|
});
|
|
1258
1258
|
const runId = input.runId ?? `run_${dntShim.crypto.randomUUID()}`;
|
|
1259
1259
|
|
|
1260
|
-
const request = input.
|
|
1260
|
+
const request = input.implementationKind
|
|
1261
1261
|
? {
|
|
1262
1262
|
mode: "agent" as const,
|
|
1263
1263
|
agent_id: input.agentId,
|
|
1264
|
-
|
|
1264
|
+
implementation_kind: input.implementationKind,
|
|
1265
1265
|
initial_status: "pending" as const,
|
|
1266
1266
|
...(targets.sourceTargetKind ? { source_target_kind: targets.sourceTargetKind } : {}),
|
|
1267
1267
|
...(targets.runtimeTargetKind ? { runtime_target_kind: targets.runtimeTargetKind } : {}),
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
createToolsFromHostDefinitions,
|
|
4
|
+
type HostToolSet,
|
|
5
|
+
type Tool,
|
|
6
|
+
traceHostTools,
|
|
7
|
+
type TraceHostToolsOptions,
|
|
8
|
+
} from "../tool/index.js";
|
|
3
9
|
import { isRecord } from "../chat/conversation.js";
|
|
4
10
|
import { safeJsonParse } from "../chat/provider-errors.js";
|
|
5
11
|
import { runWithVeryfrontCloudContextAsync } from "../provider/veryfront-cloud/context.js";
|
|
@@ -14,6 +20,7 @@ import {
|
|
|
14
20
|
HOSTED_CHILD_STREAM_TIMEOUT_TOKEN,
|
|
15
21
|
resolveHostedChildPromiseWithTimeout,
|
|
16
22
|
} from "./hosted-child-stream-watchdog.js";
|
|
23
|
+
import { getForkRuntimeAllowedToolNames } from "./provider-native-tool-inventory.js";
|
|
17
24
|
import { AgentRuntime } from "./runtime/index.js";
|
|
18
25
|
import type { AgentResponse, Message as AgentMessage } from "./schemas/index.js";
|
|
19
26
|
|
|
@@ -201,6 +208,59 @@ export type StartAgentRuntimeForkInput = {
|
|
|
201
208
|
runStep?: AgentRuntimeForkStepRunner;
|
|
202
209
|
};
|
|
203
210
|
|
|
211
|
+
export type StartAgentRuntimeForkWithHostToolsInput =
|
|
212
|
+
& Omit<
|
|
213
|
+
StartAgentRuntimeForkInput,
|
|
214
|
+
"forkToolNames" | "model" | "runtimeTools"
|
|
215
|
+
>
|
|
216
|
+
& {
|
|
217
|
+
provider: string;
|
|
218
|
+
forkModel: string;
|
|
219
|
+
forkTools: HostToolSet;
|
|
220
|
+
traceTools?: TraceHostToolsOptions;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export function startAgentRuntimeForkWithHostTools(
|
|
224
|
+
input: StartAgentRuntimeForkWithHostToolsInput,
|
|
225
|
+
): {
|
|
226
|
+
streamResult: ForkRuntimeStreamResult;
|
|
227
|
+
forkToolNames: string[];
|
|
228
|
+
} {
|
|
229
|
+
const forkTools = input.traceTools
|
|
230
|
+
? traceHostTools(input.forkTools, input.traceTools)
|
|
231
|
+
: input.forkTools;
|
|
232
|
+
const runtimeTools = createToolsFromHostDefinitions(forkTools);
|
|
233
|
+
const forkToolNames = getForkRuntimeAllowedToolNames({
|
|
234
|
+
provider: input.provider,
|
|
235
|
+
forkModel: input.forkModel,
|
|
236
|
+
forkTools: input.forkTools,
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
streamResult: startAgentRuntimeFork({
|
|
241
|
+
apiUrl: input.apiUrl,
|
|
242
|
+
authToken: input.authToken,
|
|
243
|
+
projectId: input.projectId,
|
|
244
|
+
model: input.forkModel,
|
|
245
|
+
maxSteps: input.maxSteps,
|
|
246
|
+
prompt: input.prompt,
|
|
247
|
+
maxContinuationSteps: input.maxContinuationSteps,
|
|
248
|
+
abortSignal: input.abortSignal,
|
|
249
|
+
forkToolNames,
|
|
250
|
+
runtimeTools,
|
|
251
|
+
providerOptions: input.providerOptions,
|
|
252
|
+
buildInstructions: input.buildInstructions,
|
|
253
|
+
onBeforeStop: input.onBeforeStop,
|
|
254
|
+
initialMessages: input.initialMessages,
|
|
255
|
+
responseTimeoutMs: input.responseTimeoutMs,
|
|
256
|
+
logger: input.logger,
|
|
257
|
+
prepareStep: input.prepareStep,
|
|
258
|
+
runStep: input.runStep,
|
|
259
|
+
}),
|
|
260
|
+
forkToolNames,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
|
|
204
264
|
function createForkRuntimeDeferred<T>(): {
|
|
205
265
|
promise: Promise<T>;
|
|
206
266
|
resolve: (value: T | PromiseLike<T>) => void;
|
|
@@ -18,7 +18,7 @@ export interface BootstrapHostedChildRunInput extends HostedChildConversationBod
|
|
|
18
18
|
prompt: string;
|
|
19
19
|
runId?: string;
|
|
20
20
|
agentId: string;
|
|
21
|
-
|
|
21
|
+
implementationKind?: string | null;
|
|
22
22
|
branchId?: string | null;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -59,7 +59,7 @@ export async function bootstrapHostedChildRun(
|
|
|
59
59
|
},
|
|
60
60
|
runId: input.runId,
|
|
61
61
|
agentId: input.agentId,
|
|
62
|
-
|
|
62
|
+
implementationKind: input.implementationKind,
|
|
63
63
|
projectId: input.runProjectId ?? null,
|
|
64
64
|
branchId: input.branchId,
|
|
65
65
|
});
|
package/src/src/agent/index.ts
CHANGED
|
@@ -316,6 +316,8 @@ export {
|
|
|
316
316
|
shouldContinueForkRuntimeStep,
|
|
317
317
|
startAgentRuntimeFork,
|
|
318
318
|
type StartAgentRuntimeForkInput,
|
|
319
|
+
startAgentRuntimeForkWithHostTools,
|
|
320
|
+
type StartAgentRuntimeForkWithHostToolsInput,
|
|
319
321
|
} from "./fork-runtime-stream.js";
|
|
320
322
|
export {
|
|
321
323
|
executeHostedChildForkStream,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module code-splitter/build-context
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { type BuildContext, context } from "
|
|
6
|
+
import { type BuildContext, context } from "../../../extensions/bundler.js";
|
|
7
7
|
import { join } from "../../../platform/compat/path/index.js";
|
|
8
8
|
import { createFileSystem } from "../../../platform/compat/fs.js";
|
|
9
9
|
import { getReactImportMap, REACT_DEFAULT_VERSION } from "../../../utils/index.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getReactImportMap,
|
|
4
4
|
REACT_DEFAULT_VERSION,
|
|
5
5
|
} from "../../../utils/index.js";
|
|
6
|
-
import type { OnResolveArgs, Plugin, PluginBuild } from "
|
|
6
|
+
import type { OnResolveArgs, Plugin, PluginBuild } from "../../../extensions/bundler.js";
|
|
7
7
|
import { join } from "../../../platform/compat/path/index.js";
|
|
8
8
|
|
|
9
9
|
export function createSplitterPlugin(projectDir: string): Plugin {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
import type { Metafile } from "
|
|
8
|
+
import type { Metafile } from "../../../extensions/bundler.js";
|
|
9
9
|
import { join, relative } from "../../../platform/compat/path/index.js";
|
|
10
10
|
import { createFileSystem } from "../../../platform/compat/fs.js";
|
|
11
11
|
import type { ChunkInfo, ChunkManifest, MetafileOutput } from "./types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bundlerLogger as logger } from "../../../utils/index.js";
|
|
2
|
-
import type { Metafile } from "
|
|
2
|
+
import type { Metafile } from "../../../extensions/bundler.js";
|
|
3
3
|
import { ensureDir } from "../../../../deps/jsr.io/@std/fs/1.0.23/mod.js";
|
|
4
4
|
import { relative } from "../../../platform/compat/path/index.js";
|
|
5
5
|
import type { ChunkInfo, SplitOptions, SplitResult } from "./types.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compile as compileMdx } from "@mdx-js/mdx";
|
|
2
2
|
import { bundlerLogger as logger } from "../../utils/index.js";
|
|
3
|
-
import * as esbuild from "
|
|
3
|
+
import * as esbuild from "../../extensions/bundler.js";
|
|
4
4
|
import { extract } from "../../platform/compat/std/front-matter-yaml.js";
|
|
5
5
|
import type { RuntimeAdapter } from "../../platform/adapters/base.js";
|
|
6
6
|
import { createError, toError } from "../../errors/veryfront-error.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
2
|
import { bundlerLogger as logger } from "../../utils/index.js";
|
|
3
3
|
import { createError, toError } from "../../errors/veryfront-error.js";
|
|
4
|
-
import * as esbuild from "
|
|
4
|
+
import * as esbuild from "../../extensions/bundler.js";
|
|
5
5
|
import { join } from "../../platform/compat/path/index.js";
|
|
6
6
|
import { compileMDXToJS } from "../compiler/index.js";
|
|
7
7
|
import { runtime } from "../../platform/adapters/detect.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
resolve,
|
|
15
15
|
} from "../../platform/compat/path/index.js";
|
|
16
16
|
import { serverLogger as logger } from "../../utils/index.js";
|
|
17
|
-
import type { OnResolveArgs, Plugin } from "
|
|
17
|
+
import type { OnResolveArgs, Plugin } from "../../extensions/bundler.js";
|
|
18
18
|
import type { RuntimeAdapter } from "../../platform/adapters/base.js";
|
|
19
19
|
import { createError, toError } from "../../errors/veryfront-error.js";
|
|
20
20
|
import { createFileSystem } from "../../platform/compat/fs.js";
|
|
@@ -305,7 +305,7 @@ function createFsLoaderPlugin(): Plugin {
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
async function bundleClientEntry(entryRelative: string): Promise<string> {
|
|
308
|
-
const { build, stop } = await import("
|
|
308
|
+
const { build, stop } = await import("../../extensions/bundler.js");
|
|
309
309
|
const entryUrl = new URL(entryRelative, import.meta.url);
|
|
310
310
|
const shimUrl = new URL("../../rendering/client/browser-stubs/logger.ts", import.meta.url);
|
|
311
311
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as dntShim from "../../_dnt.shims.js";
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
import type { Plugin, PluginBuild } from "
|
|
10
|
+
import type { Plugin, PluginBuild } from "../extensions/bundler.js";
|
|
11
11
|
import { isDeno, isDenoCompiled } from "../platform/compat/runtime.js";
|
|
12
12
|
import { createFileSystem } from "../platform/compat/fs.js";
|
|
13
13
|
import * as pathHelper from "../platform/compat/path/index.js";
|
|
@@ -167,7 +167,7 @@ export async function importModule(
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
const loader = getEsbuildLoader(filePath);
|
|
170
|
-
const { build } = await import("
|
|
170
|
+
const { build } = await import("../extensions/bundler.js");
|
|
171
171
|
const fileDir = pathHelper.dirname(filePath);
|
|
172
172
|
|
|
173
173
|
// When using fsAdapter (VFS), bundle all relative imports via the plugin.
|