@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.
- package/package.json +1 -1
- package/src/codegen/investigation-context.d.ts +24 -1
- package/src/codegen/investigation-context.js +127 -15
- package/src/codegen.d.ts +125 -4
- package/src/codegen.js +43 -1
- package/src/design-systems.js +1 -1
- package/src/editor-ai.d.ts +3 -1
- package/src/editor-ai.js +5 -0
- package/src/events.d.ts +19 -1
- package/src/hosted-env-defaults.test.d.ts +1 -0
- package/src/hosted-env-defaults.test.js +61 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/organization.d.ts +1 -0
- package/src/projects.d.ts +434 -66
- package/src/projects.js +226 -1
- package/src/projects.test.js +106 -1
- package/src/publish-agent.d.ts +149 -0
- package/src/publish-agent.js +88 -0
- package/src/repo-indexing.d.ts +2 -0
|
@@ -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";
|
package/src/organization.d.ts
CHANGED
|
@@ -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;
|