@builder.io/ai-utils 0.95.0 → 0.97.0

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.
@@ -0,0 +1,61 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { applyHostedBuildEnvDefaults, hasResolvableHostingBuildConfig, resolveHostedEnvDefaults, } from "./projects";
3
+ describe("applyHostedBuildEnvDefaults", () => {
4
+ it("disables recurring jobs when the build config sets no env", () => {
5
+ expect(applyHostedBuildEnvDefaults({ buildOutputDir: "dist" })).toEqual({
6
+ buildOutputDir: "dist",
7
+ environment: { AGENT_NATIVE_DISABLE_RECURRING_JOBS: "true" },
8
+ });
9
+ });
10
+ it("keeps the default alongside the project's own build env", () => {
11
+ const result = applyHostedBuildEnvDefaults({
12
+ environment: { NITRO_PRESET: "netlify" },
13
+ });
14
+ expect(result.environment).toEqual({
15
+ AGENT_NATIVE_DISABLE_RECURRING_JOBS: "true",
16
+ NITRO_PRESET: "netlify",
17
+ });
18
+ });
19
+ it("lets an explicit project value win so jobs can be opted back in", () => {
20
+ const result = applyHostedBuildEnvDefaults({
21
+ environment: { AGENT_NATIVE_DISABLE_RECURRING_JOBS: "false" },
22
+ });
23
+ expect(result.environment).toEqual({
24
+ AGENT_NATIVE_DISABLE_RECURRING_JOBS: "false",
25
+ });
26
+ });
27
+ it("lets a whitespace-padded project key win instead of duplicating the default", () => {
28
+ // Otherwise the build would read the canonical default key and silently
29
+ // ignore the project's padded one.
30
+ const result = applyHostedBuildEnvDefaults({
31
+ environment: {
32
+ " AGENT_NATIVE_DISABLE_RECURRING_JOBS ": "false",
33
+ " ": "dropped",
34
+ },
35
+ });
36
+ expect(result.environment).toEqual({
37
+ AGENT_NATIVE_DISABLE_RECURRING_JOBS: "false",
38
+ });
39
+ });
40
+ it("cannot make an unresolvable config look deployable", () => {
41
+ // Callers must gate first: applying the defaults makes any config resolvable.
42
+ expect(hasResolvableHostingBuildConfig({})).toBe(false);
43
+ expect(hasResolvableHostingBuildConfig(applyHostedBuildEnvDefaults({}))).toBe(true);
44
+ });
45
+ });
46
+ describe("resolveHostedEnvDefaults", () => {
47
+ it("reports what the build env resolved each default key to", () => {
48
+ expect(resolveHostedEnvDefaults(applyHostedBuildEnvDefaults({
49
+ environment: { AGENT_NATIVE_DISABLE_RECURRING_JOBS: "false" },
50
+ }).environment)).toEqual({ AGENT_NATIVE_DISABLE_RECURRING_JOBS: "false" });
51
+ });
52
+ it("normalizes keys and drops env the defaults don't own", () => {
53
+ expect(resolveHostedEnvDefaults({
54
+ " AGENT_NATIVE_DISABLE_RECURRING_JOBS ": "false",
55
+ NITRO_PRESET: "netlify",
56
+ })).toEqual({ AGENT_NATIVE_DISABLE_RECURRING_JOBS: "false" });
57
+ });
58
+ it("returns nothing for a missing env", () => {
59
+ expect(resolveHostedEnvDefaults(undefined)).toEqual({});
60
+ });
61
+ });
package/src/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./settings.js";
6
6
  export * from "./mapping.js";
7
7
  export * from "./common-schemas.js";
8
8
  export * from "./codegen.js";
9
+ export * from "./publish-agent.js";
9
10
  export * from "./codegen/investigation-context.js";
10
11
  export * from "./diff-hunks.js";
11
12
  export * from "./projects.js";
package/src/index.js CHANGED
@@ -6,6 +6,7 @@ export * from "./settings.js";
6
6
  export * from "./mapping.js";
7
7
  export * from "./common-schemas.js";
8
8
  export * from "./codegen.js";
9
+ export * from "./publish-agent.js";
9
10
  export * from "./codegen/investigation-context.js";
10
11
  export * from "./diff-hunks.js";
11
12
  export * from "./projects.js";
@@ -121,6 +121,7 @@ interface OrganizationSettings {
121
121
  /** Default single tenancy config ID for this space. References a document in the singleTenancyConfigurations collection.
122
122
  * Projects can override this with their own singleTenancyConfig setting. */
123
123
  defaultSingleTenancyConfig?: string;
124
+ aiFeatures?: boolean;
124
125
  controlModelAvailability?: boolean;
125
126
  allowedAiModels?: string[];
126
127
  autoModelOverride?: string;