@standardagents/builder 0.24.7 → 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/plugin.d.ts CHANGED
@@ -12,7 +12,7 @@ interface AgentPluginOptions {
12
12
  effectsDir?: string;
13
13
  /**
14
14
  * Additional provider packages to expose in the UI.
15
- * First-party providers (@standardagents/cerebras, @standardagents/openai, @standardagents/openrouter) are always included.
15
+ * First-party providers (@standardagents/anthropic, @standardagents/cerebras, @standardagents/novita, @standardagents/openai, @standardagents/openrouter) are always included.
16
16
  * @example ['my-custom-provider', '@company/custom-openai']
17
17
  */
18
18
  providers?: string[];
package/dist/plugin.js CHANGED
@@ -857,6 +857,12 @@ var FIRST_PARTY_PROVIDERS = [
857
857
  label: "Groq",
858
858
  envKeys: ["GROQ_API_KEY"]
859
859
  },
860
+ {
861
+ name: "novita",
862
+ package: "@standardagents/novita",
863
+ label: "Novita AI",
864
+ envKeys: ["NOVITA_API_KEY"]
865
+ },
860
866
  {
861
867
  name: "openai",
862
868
  package: "@standardagents/openai",
@@ -889,8 +895,9 @@ function packageToCustomProvider(pkg) {
889
895
  isCustom: true
890
896
  };
891
897
  }
892
- function buildInstalledProviderCatalog(customProviderPackages = []) {
893
- const providers = [...FIRST_PARTY_PROVIDERS];
898
+ function buildInstalledProviderCatalog(customProviderPackages = [], options = {}) {
899
+ const { isPackageInstalled } = options;
900
+ const providers = isPackageInstalled ? FIRST_PARTY_PROVIDERS.filter((provider) => isPackageInstalled(provider.package)) : [...FIRST_PARTY_PROVIDERS];
894
901
  const seen = new Set(providers.map((provider) => provider.name));
895
902
  for (const pkg of customProviderPackages) {
896
903
  const provider = packageToCustomProvider(pkg);
@@ -900,9 +907,9 @@ function buildInstalledProviderCatalog(customProviderPackages = []) {
900
907
  }
901
908
  return providers;
902
909
  }
903
- function buildProviderPackageMap(customProviderPackages = []) {
910
+ function buildProviderPackageMap(customProviderPackages = [], options = {}) {
904
911
  return Object.fromEntries(
905
- buildInstalledProviderCatalog(customProviderPackages).map((provider) => [
912
+ buildInstalledProviderCatalog(customProviderPackages, options).map((provider) => [
906
913
  provider.name,
907
914
  {
908
915
  name: provider.name,
@@ -7860,6 +7867,17 @@ var depsToExclude = [
7860
7867
  "fsevents",
7861
7868
  "typescript"
7862
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
+ ];
7863
7881
  var depsToInclude = [
7864
7882
  "zod",
7865
7883
  "zod/v3",
@@ -7876,7 +7894,11 @@ var depsToInclude = [
7876
7894
  "@standardagents/spec",
7877
7895
  // Incremental JSON reader used by the runtime to surface a tool's progress
7878
7896
  // argument from partial streamed tool-call arguments (tool_call_started).
7879
- "@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
7880
7902
  ];
7881
7903
  var packingDeps = [
7882
7904
  "rollup",
@@ -7901,6 +7923,13 @@ function createPluginViteConfig(pluginModuleUrl) {
7901
7923
  }
7902
7924
  },
7903
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,
7904
7933
  exclude: depsToExclude,
7905
7934
  include: depsToInclude.filter((dep) => dep !== "zod/v3" && dep !== "zod/v4" && dep !== "zod/v4/core")
7906
7935
  },
@@ -7991,6 +8020,7 @@ function createAgentBuilderCloudflarePlugins(options) {
7991
8020
  }
7992
8021
  function applyPluginEnvironmentConfig(config) {
7993
8022
  config.optimizeDeps = config.optimizeDeps || {};
8023
+ config.optimizeDeps.holdUntilCrawlEnd = true;
7994
8024
  config.optimizeDeps.exclude = [
7995
8025
  ...config.optimizeDeps.exclude || [],
7996
8026
  ...depsToExclude.filter((dep) => !config.optimizeDeps?.exclude?.includes(dep))
@@ -8025,8 +8055,20 @@ function agentbuilder(options = {}) {
8025
8055
  const effectsDir = options.effectsDir ? path8__default.resolve(process.cwd(), options.effectsDir) : path8__default.resolve(process.cwd(), "agents/effects");
8026
8056
  const outputDir = path8__default.resolve(process.cwd(), ".agents");
8027
8057
  const generatedWorkerEntry = path8__default.join(outputDir, "worker.ts");
8028
- const installedProviders = buildInstalledProviderCatalog(options.providers || []);
8029
- const installedProviderPackageMap = buildProviderPackageMap(options.providers || []);
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);
8030
8072
  const typeGenConfig = {
8031
8073
  modelsDir,
8032
8074
  promptsDir,