@builder.io/ai-utils 0.25.4 → 0.26.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.d.ts +5 -17
- package/src/connectivity/checks/http-check.d.ts +2 -1
- package/src/connectivity/checks/http-check.js +2 -2
- package/src/connectivity/node.d.ts +1 -1
- package/src/connectivity/run-checks.js +4 -4
- package/src/connectivity/types.d.ts +11 -0
- package/src/projects.d.ts +2 -1
package/package.json
CHANGED
package/src/codegen.d.ts
CHANGED
|
@@ -974,6 +974,7 @@ export interface GenerateCompletionStepGit {
|
|
|
974
974
|
hasGeneratingPlaceholder: boolean;
|
|
975
975
|
remoteBranchExists: boolean;
|
|
976
976
|
remoteBranchHasChanges: boolean;
|
|
977
|
+
hasStagedChanges: boolean;
|
|
977
978
|
canPush: boolean;
|
|
978
979
|
canPull: boolean;
|
|
979
980
|
canSync: boolean;
|
|
@@ -1074,24 +1075,9 @@ export interface GenerateCompletionStepUpdateSetupValue {
|
|
|
1074
1075
|
};
|
|
1075
1076
|
reason: string;
|
|
1076
1077
|
}
|
|
1077
|
-
export interface GenerateCompletionStepExit {
|
|
1078
|
-
type: "exit";
|
|
1079
|
-
state: ExitState;
|
|
1080
|
-
summary: string;
|
|
1081
|
-
questions: Array<{
|
|
1082
|
-
question: string;
|
|
1083
|
-
context: string;
|
|
1084
|
-
header?: string;
|
|
1085
|
-
options?: Array<{
|
|
1086
|
-
label: string;
|
|
1087
|
-
description: string;
|
|
1088
|
-
}>;
|
|
1089
|
-
multiSelect?: boolean;
|
|
1090
|
-
}>;
|
|
1091
|
-
}
|
|
1092
1078
|
export type GenerateCompletionStep = {
|
|
1093
1079
|
timestamp?: number;
|
|
1094
|
-
} & (GenerateCompletionStepPlanning | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue
|
|
1080
|
+
} & (GenerateCompletionStepPlanning | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepBuilderAction | GenerateCompletionStepToolResult | GenerateCompletionStepFusionConfigPatch | GenerateCompletionStepToolCallRequest | GenerateCodeEventMCPStatus | GenerateCodeEventMCPAuthRequired | GenerateCompletionStepDevServerState | GenerateCompletionStepAgent | GenerateCompletionStepBatch | GenerateCompletionStepTerminals | GenerateCompletionStepMetadata | GenerateCompletionStepMessageQueue | GenerateCompletionStepProposeConfig | GenerateCompletionStepUpdateSetupValue);
|
|
1095
1081
|
export interface ApplyActionsResult {
|
|
1096
1082
|
filePath: string;
|
|
1097
1083
|
addedLines: number;
|
|
@@ -1131,6 +1117,7 @@ export interface UserSourceAgent extends UserSourceBase {
|
|
|
1131
1117
|
source: "agent";
|
|
1132
1118
|
}
|
|
1133
1119
|
export type UserSource = UserSourceOther | UserSourceBuilder | UserSourceAgent;
|
|
1120
|
+
export type AutoPushMode = "force-push" | "merge-push" | "ff-push" | "safe-push" | "none";
|
|
1134
1121
|
export interface GenerateUserMessage {
|
|
1135
1122
|
idempotencyKey?: string;
|
|
1136
1123
|
user?: UserSource;
|
|
@@ -1151,7 +1138,7 @@ export interface GenerateUserMessage {
|
|
|
1151
1138
|
includeRelevantMemories?: boolean;
|
|
1152
1139
|
category?: CodeGenCategory;
|
|
1153
1140
|
metadata?: Record<string, any>;
|
|
1154
|
-
autoPush?:
|
|
1141
|
+
autoPush?: AutoPushMode;
|
|
1155
1142
|
syncChanges?: SyncChangesFromRemote;
|
|
1156
1143
|
enabledMCPs?: string[];
|
|
1157
1144
|
sessionMode?: SessionMode;
|
|
@@ -1530,6 +1517,7 @@ export interface FusionConfig {
|
|
|
1530
1517
|
setupCommand?: string;
|
|
1531
1518
|
validateCommand?: string;
|
|
1532
1519
|
fusionServerPort?: number;
|
|
1520
|
+
autoPush?: AutoPushMode;
|
|
1533
1521
|
lockFile?: {
|
|
1534
1522
|
filePath: string;
|
|
1535
1523
|
conflictBehavior: "replace" | "exit" | "kill";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { CheckResult, Source, TestId } from "../types.js";
|
|
1
|
+
import type { CheckResult, Source, TestId, ConnectivityFetchFn } from "../types.js";
|
|
2
2
|
export interface HttpCheckOptions {
|
|
3
3
|
target: string;
|
|
4
4
|
source: Source;
|
|
5
5
|
testId: TestId;
|
|
6
6
|
timeout?: number;
|
|
7
|
+
fetchFn?: ConnectivityFetchFn;
|
|
7
8
|
}
|
|
8
9
|
export declare function httpCheck(options: HttpCheckOptions): Promise<CheckResult>;
|
|
@@ -2,12 +2,12 @@ import { mapHttpStatusToErrorCode, mapFetchErrorToConnectivityCode, } from "../e
|
|
|
2
2
|
const DEFAULT_TIMEOUT_MS = 30000;
|
|
3
3
|
const LATENCY_THRESHOLD_MS = 5000;
|
|
4
4
|
export async function httpCheck(options) {
|
|
5
|
-
const { target, source, testId, timeout = DEFAULT_TIMEOUT_MS } = options;
|
|
5
|
+
const { target, source, testId, timeout = DEFAULT_TIMEOUT_MS, fetchFn = fetch, } = options;
|
|
6
6
|
const startTime = Date.now();
|
|
7
7
|
const controller = new AbortController();
|
|
8
8
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
9
9
|
try {
|
|
10
|
-
const response = await
|
|
10
|
+
const response = await fetchFn(target, {
|
|
11
11
|
method: "HEAD",
|
|
12
12
|
signal: controller.signal,
|
|
13
13
|
redirect: "follow",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Source, TestId, Test, RunChecksInput, ProgressEvent, CheckResult, CheckReport, ConnectivityErrorCode, CheckType, Recommendation, LikelyCause, ConnectivityStatus, AnalysisResult, AnalyzeConnectivityInput, } from "./types.js";
|
|
1
|
+
export type { Source, TestId, Test, RunChecksInput, ProgressEvent, CheckResult, CheckReport, ConnectivityErrorCode, CheckType, Recommendation, LikelyCause, ConnectivityStatus, AnalysisResult, AnalyzeConnectivityInput, ConnectivityFetchFn, } from "./types.js";
|
|
2
2
|
export { runChecks } from "./run-checks.js";
|
|
3
3
|
export { mapNodeErrorToConnectivityCode, mapHttpStatusToErrorCode, mapFetchErrorToConnectivityCode, connectivityErrorCodeToLikelyCause, mapConnectivityErrorMessage, SELF_SIGNED_CERT_ERRORS, CERT_EXPIRED_ERRORS, CERT_NOT_YET_VALID_ERRORS, CERT_INVALID_ERRORS, CERT_HOSTNAME_MISMATCH_ERRORS, SSL_PROTOCOL_ERRORS, SSL_HANDSHAKE_ERRORS, NETWORK_UNREACHABLE_ERRORS, TIMEOUT_ERRORS, PROXY_ERRORS, DNS_ERRORS, } from "./error-codes.js";
|
|
4
4
|
export { BUILDER_TARGETS, DEFAULT_PORTS, resolveTarget, extractHostname, extractPort, } from "./targets.js";
|
|
@@ -6,7 +6,7 @@ import { tcpCheck } from "./checks/tcp-check.js";
|
|
|
6
6
|
import { tlsCheck } from "./checks/tls-check.js";
|
|
7
7
|
import { sshCheck } from "./checks/ssh-check.js";
|
|
8
8
|
export async function runChecks(input) {
|
|
9
|
-
const { tests, gitHost, onProgress } = input;
|
|
9
|
+
const { tests, gitHost, onProgress, fetchFn } = input;
|
|
10
10
|
const results = [];
|
|
11
11
|
const total = tests.length;
|
|
12
12
|
for (let index = 0; index < tests.length; index++) {
|
|
@@ -17,7 +17,7 @@ export async function runChecks(input) {
|
|
|
17
17
|
index,
|
|
18
18
|
total,
|
|
19
19
|
});
|
|
20
|
-
const result = await runSingleCheck(test, gitHost);
|
|
20
|
+
const result = await runSingleCheck(test, gitHost, fetchFn);
|
|
21
21
|
results.push(result);
|
|
22
22
|
emitProgress(onProgress, {
|
|
23
23
|
type: "test:complete",
|
|
@@ -36,7 +36,7 @@ export async function runChecks(input) {
|
|
|
36
36
|
results,
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
async function runSingleCheck(test, gitHost) {
|
|
39
|
+
async function runSingleCheck(test, gitHost, fetchFn) {
|
|
40
40
|
const { source, testId } = test;
|
|
41
41
|
const checkType = getCheckTypeForTestId(testId);
|
|
42
42
|
if (!isCheckAvailable(checkType)) {
|
|
@@ -80,7 +80,7 @@ async function runSingleCheck(test, gitHost) {
|
|
|
80
80
|
}
|
|
81
81
|
switch (checkType) {
|
|
82
82
|
case "http":
|
|
83
|
-
return httpCheck({ target, source, testId });
|
|
83
|
+
return httpCheck({ target, source, testId, fetchFn });
|
|
84
84
|
case "dns":
|
|
85
85
|
return dnsCheck({
|
|
86
86
|
hostname: extractHostname(target),
|
|
@@ -4,10 +4,21 @@ export interface Test {
|
|
|
4
4
|
source: Source;
|
|
5
5
|
testId: TestId;
|
|
6
6
|
}
|
|
7
|
+
export type ConnectivityFetchFn = (input: string | URL, init?: {
|
|
8
|
+
method?: string;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
redirect?: "follow" | "error" | "manual";
|
|
11
|
+
}) => Promise<Pick<Response, "ok" | "status" | "statusText">>;
|
|
7
12
|
export interface RunChecksInput {
|
|
8
13
|
tests: Test[];
|
|
9
14
|
gitHost?: string;
|
|
10
15
|
onProgress?: (event: ProgressEvent) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Use this to pass a proxy-aware fetch function. Typically
|
|
18
|
+
* only necessary when running connectivity checks from Node
|
|
19
|
+
* environments.
|
|
20
|
+
*/
|
|
21
|
+
fetchFn?: ConnectivityFetchFn;
|
|
11
22
|
}
|
|
12
23
|
export type ProgressEvent = {
|
|
13
24
|
type: "test:start";
|
package/src/projects.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConnectivityErrorCode, CheckType, LikelyCause } from "./connectivity/types.js";
|
|
2
|
-
import type { FileOverride, EnvironmentVariable, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot } from "./codegen";
|
|
2
|
+
import type { FileOverride, EnvironmentVariable, LaunchServerState, LaunchServerStatus, BranchBackup, CommitMode, CustomInstruction, CustomAgentDefinition, GitSnapshot, AutoPushMode } from "./codegen";
|
|
3
3
|
import type { FallbackTokensPrivate } from "./organization";
|
|
4
4
|
/**
|
|
5
5
|
* Temporary type for date fields during migration.
|
|
@@ -572,6 +572,7 @@ export interface Project {
|
|
|
572
572
|
validateCommand?: string;
|
|
573
573
|
proxyOrigin?: string;
|
|
574
574
|
proxyDefaultOrigin?: string;
|
|
575
|
+
defaultAutoPush?: AutoPushMode;
|
|
575
576
|
gitBranchNamingStrategy?: "ai-session" | "branch-name" | "custom";
|
|
576
577
|
setupDependencies?: SetupDependency[];
|
|
577
578
|
gitBranchNamingCustom?: string;
|