@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/plugin.js
CHANGED
|
@@ -895,8 +895,9 @@ function packageToCustomProvider(pkg) {
|
|
|
895
895
|
isCustom: true
|
|
896
896
|
};
|
|
897
897
|
}
|
|
898
|
-
function buildInstalledProviderCatalog(customProviderPackages = []) {
|
|
899
|
-
const
|
|
898
|
+
function buildInstalledProviderCatalog(customProviderPackages = [], options = {}) {
|
|
899
|
+
const { isPackageInstalled } = options;
|
|
900
|
+
const providers = isPackageInstalled ? FIRST_PARTY_PROVIDERS.filter((provider) => isPackageInstalled(provider.package)) : [...FIRST_PARTY_PROVIDERS];
|
|
900
901
|
const seen = new Set(providers.map((provider) => provider.name));
|
|
901
902
|
for (const pkg of customProviderPackages) {
|
|
902
903
|
const provider = packageToCustomProvider(pkg);
|
|
@@ -906,9 +907,9 @@ function buildInstalledProviderCatalog(customProviderPackages = []) {
|
|
|
906
907
|
}
|
|
907
908
|
return providers;
|
|
908
909
|
}
|
|
909
|
-
function buildProviderPackageMap(customProviderPackages = []) {
|
|
910
|
+
function buildProviderPackageMap(customProviderPackages = [], options = {}) {
|
|
910
911
|
return Object.fromEntries(
|
|
911
|
-
buildInstalledProviderCatalog(customProviderPackages).map((provider) => [
|
|
912
|
+
buildInstalledProviderCatalog(customProviderPackages, options).map((provider) => [
|
|
912
913
|
provider.name,
|
|
913
914
|
{
|
|
914
915
|
name: provider.name,
|
|
@@ -7866,6 +7867,17 @@ var depsToExclude = [
|
|
|
7866
7867
|
"fsevents",
|
|
7867
7868
|
"typescript"
|
|
7868
7869
|
];
|
|
7870
|
+
var firstPartyProviderPackages = [
|
|
7871
|
+
"@standardagents/anthropic",
|
|
7872
|
+
"@standardagents/cloudflare",
|
|
7873
|
+
"@standardagents/cerebras",
|
|
7874
|
+
"@standardagents/google",
|
|
7875
|
+
"@standardagents/groq",
|
|
7876
|
+
"@standardagents/novita",
|
|
7877
|
+
"@standardagents/openai",
|
|
7878
|
+
"@standardagents/openrouter",
|
|
7879
|
+
"@standardagents/xai"
|
|
7880
|
+
];
|
|
7869
7881
|
var depsToInclude = [
|
|
7870
7882
|
"zod",
|
|
7871
7883
|
"zod/v3",
|
|
@@ -7882,7 +7894,11 @@ var depsToInclude = [
|
|
|
7882
7894
|
"@standardagents/spec",
|
|
7883
7895
|
// Incremental JSON reader used by the runtime to surface a tool's progress
|
|
7884
7896
|
// argument from partial streamed tool-call arguments (tool_call_started).
|
|
7885
|
-
"@formkit/jsonreader"
|
|
7897
|
+
"@formkit/jsonreader",
|
|
7898
|
+
// Pre-bundle the provider packages themselves so their whole subtree (SDKs,
|
|
7899
|
+
// pricing tables) lands in the initial optimized bundle and nothing is
|
|
7900
|
+
// discovered lazily by workerd.
|
|
7901
|
+
...firstPartyProviderPackages
|
|
7886
7902
|
];
|
|
7887
7903
|
var packingDeps = [
|
|
7888
7904
|
"rollup",
|
|
@@ -7907,6 +7923,13 @@ function createPluginViteConfig(pluginModuleUrl) {
|
|
|
7907
7923
|
}
|
|
7908
7924
|
},
|
|
7909
7925
|
optimizeDeps: {
|
|
7926
|
+
// Hold the first optimized-deps result until the static import crawl
|
|
7927
|
+
// finishes on cold start, so a single pre-bundle version is committed
|
|
7928
|
+
// instead of an early partial bundle that a later discovery invalidates.
|
|
7929
|
+
// Combined with a complete `include` list, this eliminates the mid-flight
|
|
7930
|
+
// re-optimize that crashes the workerd environment on the very first
|
|
7931
|
+
// `npm run dev` ("There is a new version of the pre-bundle for X").
|
|
7932
|
+
holdUntilCrawlEnd: true,
|
|
7910
7933
|
exclude: depsToExclude,
|
|
7911
7934
|
include: depsToInclude.filter((dep) => dep !== "zod/v3" && dep !== "zod/v4" && dep !== "zod/v4/core")
|
|
7912
7935
|
},
|
|
@@ -7997,6 +8020,7 @@ function createAgentBuilderCloudflarePlugins(options) {
|
|
|
7997
8020
|
}
|
|
7998
8021
|
function applyPluginEnvironmentConfig(config) {
|
|
7999
8022
|
config.optimizeDeps = config.optimizeDeps || {};
|
|
8023
|
+
config.optimizeDeps.holdUntilCrawlEnd = true;
|
|
8000
8024
|
config.optimizeDeps.exclude = [
|
|
8001
8025
|
...config.optimizeDeps.exclude || [],
|
|
8002
8026
|
...depsToExclude.filter((dep) => !config.optimizeDeps?.exclude?.includes(dep))
|
|
@@ -8031,8 +8055,20 @@ function agentbuilder(options = {}) {
|
|
|
8031
8055
|
const effectsDir = options.effectsDir ? path8__default.resolve(process.cwd(), options.effectsDir) : path8__default.resolve(process.cwd(), "agents/effects");
|
|
8032
8056
|
const outputDir = path8__default.resolve(process.cwd(), ".agents");
|
|
8033
8057
|
const generatedWorkerEntry = path8__default.join(outputDir, "worker.ts");
|
|
8034
|
-
const
|
|
8035
|
-
|
|
8058
|
+
const isProviderPackageInstalled = (packageName) => {
|
|
8059
|
+
let dir = process.cwd();
|
|
8060
|
+
for (; ; ) {
|
|
8061
|
+
if (fs8__default.existsSync(path8__default.join(dir, "node_modules", packageName, "package.json"))) {
|
|
8062
|
+
return true;
|
|
8063
|
+
}
|
|
8064
|
+
const parent = path8__default.dirname(dir);
|
|
8065
|
+
if (parent === dir) return false;
|
|
8066
|
+
dir = parent;
|
|
8067
|
+
}
|
|
8068
|
+
};
|
|
8069
|
+
const catalogOptions = { isPackageInstalled: isProviderPackageInstalled };
|
|
8070
|
+
const installedProviders = buildInstalledProviderCatalog(options.providers || [], catalogOptions);
|
|
8071
|
+
const installedProviderPackageMap = buildProviderPackageMap(options.providers || [], catalogOptions);
|
|
8036
8072
|
const typeGenConfig = {
|
|
8037
8073
|
modelsDir,
|
|
8038
8074
|
promptsDir,
|