@standardagents/builder 0.25.0 → 0.25.1
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/dist/built-in-routes.js +6 -1
- package/dist/built-in-routes.js.map +1 -1
- package/dist/index.js +43 -7
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +43 -7
- package/dist/plugin.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -14614,8 +14614,9 @@ function packageToCustomProvider(pkg) {
|
|
|
14614
14614
|
isCustom: true
|
|
14615
14615
|
};
|
|
14616
14616
|
}
|
|
14617
|
-
function buildInstalledProviderCatalog(customProviderPackages = []) {
|
|
14618
|
-
const
|
|
14617
|
+
function buildInstalledProviderCatalog(customProviderPackages = [], options = {}) {
|
|
14618
|
+
const { isPackageInstalled } = options;
|
|
14619
|
+
const providers2 = isPackageInstalled ? FIRST_PARTY_PROVIDERS.filter((provider) => isPackageInstalled(provider.package)) : [...FIRST_PARTY_PROVIDERS];
|
|
14619
14620
|
const seen = new Set(providers2.map((provider) => provider.name));
|
|
14620
14621
|
for (const pkg of customProviderPackages) {
|
|
14621
14622
|
const provider = packageToCustomProvider(pkg);
|
|
@@ -14625,9 +14626,9 @@ function buildInstalledProviderCatalog(customProviderPackages = []) {
|
|
|
14625
14626
|
}
|
|
14626
14627
|
return providers2;
|
|
14627
14628
|
}
|
|
14628
|
-
function buildProviderPackageMap(customProviderPackages = []) {
|
|
14629
|
+
function buildProviderPackageMap(customProviderPackages = [], options = {}) {
|
|
14629
14630
|
return Object.fromEntries(
|
|
14630
|
-
buildInstalledProviderCatalog(customProviderPackages).map((provider) => [
|
|
14631
|
+
buildInstalledProviderCatalog(customProviderPackages, options).map((provider) => [
|
|
14631
14632
|
provider.name,
|
|
14632
14633
|
{
|
|
14633
14634
|
name: provider.name,
|
|
@@ -21589,6 +21590,17 @@ var depsToExclude = [
|
|
|
21589
21590
|
"fsevents",
|
|
21590
21591
|
"typescript"
|
|
21591
21592
|
];
|
|
21593
|
+
var firstPartyProviderPackages = [
|
|
21594
|
+
"@standardagents/anthropic",
|
|
21595
|
+
"@standardagents/cloudflare",
|
|
21596
|
+
"@standardagents/cerebras",
|
|
21597
|
+
"@standardagents/google",
|
|
21598
|
+
"@standardagents/groq",
|
|
21599
|
+
"@standardagents/novita",
|
|
21600
|
+
"@standardagents/openai",
|
|
21601
|
+
"@standardagents/openrouter",
|
|
21602
|
+
"@standardagents/xai"
|
|
21603
|
+
];
|
|
21592
21604
|
var depsToInclude = [
|
|
21593
21605
|
"zod",
|
|
21594
21606
|
"zod/v3",
|
|
@@ -21605,7 +21617,11 @@ var depsToInclude = [
|
|
|
21605
21617
|
"@standardagents/spec",
|
|
21606
21618
|
// Incremental JSON reader used by the runtime to surface a tool's progress
|
|
21607
21619
|
// argument from partial streamed tool-call arguments (tool_call_started).
|
|
21608
|
-
"@formkit/jsonreader"
|
|
21620
|
+
"@formkit/jsonreader",
|
|
21621
|
+
// Pre-bundle the provider packages themselves so their whole subtree (SDKs,
|
|
21622
|
+
// pricing tables) lands in the initial optimized bundle and nothing is
|
|
21623
|
+
// discovered lazily by workerd.
|
|
21624
|
+
...firstPartyProviderPackages
|
|
21609
21625
|
];
|
|
21610
21626
|
var packingDeps = [
|
|
21611
21627
|
"rollup",
|
|
@@ -21630,6 +21646,13 @@ function createPluginViteConfig(pluginModuleUrl) {
|
|
|
21630
21646
|
}
|
|
21631
21647
|
},
|
|
21632
21648
|
optimizeDeps: {
|
|
21649
|
+
// Hold the first optimized-deps result until the static import crawl
|
|
21650
|
+
// finishes on cold start, so a single pre-bundle version is committed
|
|
21651
|
+
// instead of an early partial bundle that a later discovery invalidates.
|
|
21652
|
+
// Combined with a complete `include` list, this eliminates the mid-flight
|
|
21653
|
+
// re-optimize that crashes the workerd environment on the very first
|
|
21654
|
+
// `npm run dev` ("There is a new version of the pre-bundle for X").
|
|
21655
|
+
holdUntilCrawlEnd: true,
|
|
21633
21656
|
exclude: depsToExclude,
|
|
21634
21657
|
include: depsToInclude.filter((dep) => dep !== "zod/v3" && dep !== "zod/v4" && dep !== "zod/v4/core")
|
|
21635
21658
|
},
|
|
@@ -21720,6 +21743,7 @@ function createAgentBuilderCloudflarePlugins(options) {
|
|
|
21720
21743
|
}
|
|
21721
21744
|
function applyPluginEnvironmentConfig(config) {
|
|
21722
21745
|
config.optimizeDeps = config.optimizeDeps || {};
|
|
21746
|
+
config.optimizeDeps.holdUntilCrawlEnd = true;
|
|
21723
21747
|
config.optimizeDeps.exclude = [
|
|
21724
21748
|
...config.optimizeDeps.exclude || [],
|
|
21725
21749
|
...depsToExclude.filter((dep) => !config.optimizeDeps?.exclude?.includes(dep))
|
|
@@ -21754,8 +21778,20 @@ function agentbuilder(options = {}) {
|
|
|
21754
21778
|
const effectsDir = options.effectsDir ? path8__default.resolve(process.cwd(), options.effectsDir) : path8__default.resolve(process.cwd(), "agents/effects");
|
|
21755
21779
|
const outputDir = path8__default.resolve(process.cwd(), ".agents");
|
|
21756
21780
|
const generatedWorkerEntry = path8__default.join(outputDir, "worker.ts");
|
|
21757
|
-
const
|
|
21758
|
-
|
|
21781
|
+
const isProviderPackageInstalled = (packageName) => {
|
|
21782
|
+
let dir = process.cwd();
|
|
21783
|
+
for (; ; ) {
|
|
21784
|
+
if (fs8__default.existsSync(path8__default.join(dir, "node_modules", packageName, "package.json"))) {
|
|
21785
|
+
return true;
|
|
21786
|
+
}
|
|
21787
|
+
const parent = path8__default.dirname(dir);
|
|
21788
|
+
if (parent === dir) return false;
|
|
21789
|
+
dir = parent;
|
|
21790
|
+
}
|
|
21791
|
+
};
|
|
21792
|
+
const catalogOptions = { isPackageInstalled: isProviderPackageInstalled };
|
|
21793
|
+
const installedProviders = buildInstalledProviderCatalog(options.providers || [], catalogOptions);
|
|
21794
|
+
const installedProviderPackageMap = buildProviderPackageMap(options.providers || [], catalogOptions);
|
|
21759
21795
|
const typeGenConfig = {
|
|
21760
21796
|
modelsDir,
|
|
21761
21797
|
promptsDir,
|