@builder.io/ai-utils 0.25.4 → 0.26.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/package.json +1 -1
- package/src/codegen.d.ts +14 -20
- 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/events.d.ts +4 -0
- package/src/projects.d.ts +6 -3
package/package.json
CHANGED
package/src/codegen.d.ts
CHANGED
|
@@ -293,7 +293,7 @@ export interface UpdateSetupValueToolInput {
|
|
|
293
293
|
};
|
|
294
294
|
reason: string;
|
|
295
295
|
}
|
|
296
|
-
export type ExitState = "verified" | "
|
|
296
|
+
export type ExitState = "verified" | "no-frontend" | "empty-project" | "user-question" | "other" | "started";
|
|
297
297
|
export interface ExitToolInput {
|
|
298
298
|
state: ExitState;
|
|
299
299
|
summary: string;
|
|
@@ -353,6 +353,7 @@ export interface ProposedConfig {
|
|
|
353
353
|
devServer: {
|
|
354
354
|
value: string | undefined;
|
|
355
355
|
verified: boolean;
|
|
356
|
+
elapsed?: number;
|
|
356
357
|
};
|
|
357
358
|
validateCommand: {
|
|
358
359
|
value: string | undefined;
|
|
@@ -442,7 +443,7 @@ export interface VerifyDevServerToolInput {
|
|
|
442
443
|
appOrigin: string;
|
|
443
444
|
defaultOrigin?: string;
|
|
444
445
|
}
|
|
445
|
-
export interface
|
|
446
|
+
export interface VerifyValidateCommandToolInput {
|
|
446
447
|
command: string;
|
|
447
448
|
timeout?: number;
|
|
448
449
|
}
|
|
@@ -555,7 +556,7 @@ export interface CodeGenToolMap {
|
|
|
555
556
|
VerifySetupCommand: VerifySetupCommandToolInput;
|
|
556
557
|
VerifyDevCommand: VerifyDevCommandToolInput;
|
|
557
558
|
VerifyDevServer: VerifyDevServerToolInput;
|
|
558
|
-
|
|
559
|
+
VerifyValidateCommand: VerifyValidateCommandToolInput;
|
|
559
560
|
VerifyRuntimeDependency: VerifyRuntimeDependencyToolInput;
|
|
560
561
|
SetEnvVariable: SetEnvVariableToolInput;
|
|
561
562
|
}
|
|
@@ -974,6 +975,7 @@ export interface GenerateCompletionStepGit {
|
|
|
974
975
|
hasGeneratingPlaceholder: boolean;
|
|
975
976
|
remoteBranchExists: boolean;
|
|
976
977
|
remoteBranchHasChanges: boolean;
|
|
978
|
+
hasStagedChanges: boolean;
|
|
977
979
|
canPush: boolean;
|
|
978
980
|
canPull: boolean;
|
|
979
981
|
canSync: boolean;
|
|
@@ -1074,24 +1076,9 @@ export interface GenerateCompletionStepUpdateSetupValue {
|
|
|
1074
1076
|
};
|
|
1075
1077
|
reason: string;
|
|
1076
1078
|
}
|
|
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
1079
|
export type GenerateCompletionStep = {
|
|
1093
1080
|
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
|
|
1081
|
+
} & (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
1082
|
export interface ApplyActionsResult {
|
|
1096
1083
|
filePath: string;
|
|
1097
1084
|
addedLines: number;
|
|
@@ -1131,6 +1118,7 @@ export interface UserSourceAgent extends UserSourceBase {
|
|
|
1131
1118
|
source: "agent";
|
|
1132
1119
|
}
|
|
1133
1120
|
export type UserSource = UserSourceOther | UserSourceBuilder | UserSourceAgent;
|
|
1121
|
+
export type AutoPushMode = "force-push" | "merge-push" | "ff-push" | "safe-push" | "none";
|
|
1134
1122
|
export interface GenerateUserMessage {
|
|
1135
1123
|
idempotencyKey?: string;
|
|
1136
1124
|
user?: UserSource;
|
|
@@ -1151,7 +1139,7 @@ export interface GenerateUserMessage {
|
|
|
1151
1139
|
includeRelevantMemories?: boolean;
|
|
1152
1140
|
category?: CodeGenCategory;
|
|
1153
1141
|
metadata?: Record<string, any>;
|
|
1154
|
-
autoPush?:
|
|
1142
|
+
autoPush?: AutoPushMode;
|
|
1155
1143
|
syncChanges?: SyncChangesFromRemote;
|
|
1156
1144
|
enabledMCPs?: string[];
|
|
1157
1145
|
sessionMode?: SessionMode;
|
|
@@ -1530,6 +1518,7 @@ export interface FusionConfig {
|
|
|
1530
1518
|
setupCommand?: string;
|
|
1531
1519
|
validateCommand?: string;
|
|
1532
1520
|
fusionServerPort?: number;
|
|
1521
|
+
autoPush?: AutoPushMode;
|
|
1533
1522
|
lockFile?: {
|
|
1534
1523
|
filePath: string;
|
|
1535
1524
|
conflictBehavior: "replace" | "exit" | "kill";
|
|
@@ -1656,6 +1645,11 @@ export interface FusionConfig {
|
|
|
1656
1645
|
* Read from project settings, with fallback to organization/space settings.
|
|
1657
1646
|
*/
|
|
1658
1647
|
maxAgentCompletions?: number;
|
|
1648
|
+
/**
|
|
1649
|
+
* If true, skip all command security policy validation (e.g. allow curl, npx, etc without restrictions).
|
|
1650
|
+
* This is a dangerous setting that removes safety guardrails - equivalent to full shell access.
|
|
1651
|
+
*/
|
|
1652
|
+
skipCommandSecurity?: boolean;
|
|
1659
1653
|
/** @deprecated use devCommand */
|
|
1660
1654
|
command?: string;
|
|
1661
1655
|
}
|
|
@@ -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/events.d.ts
CHANGED
|
@@ -481,7 +481,11 @@ export declare const GitPrCreatedEvent: {
|
|
|
481
481
|
version: "1";
|
|
482
482
|
};
|
|
483
483
|
export type ClientDevtoolsSessionStartedEvent = FusionEventVariant<"client.devtools.session.started", {
|
|
484
|
+
sessionId?: string;
|
|
484
485
|
sessionType?: string;
|
|
486
|
+
projectId?: string;
|
|
487
|
+
branchName?: string;
|
|
488
|
+
branchId?: string;
|
|
485
489
|
platform?: string;
|
|
486
490
|
}, {}, 1>;
|
|
487
491
|
export declare const ClientDevtoolsSessionStartedEvent: {
|
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.
|
|
@@ -152,7 +152,7 @@ export type GitAuthErrorCode = "git-auth-failed" | "git-auth-failed-root-repo" |
|
|
|
152
152
|
/**
|
|
153
153
|
* Git provider types for diagnostics.
|
|
154
154
|
*/
|
|
155
|
-
export type GitDiagnosticsProvider = "github" | "bitbucket" | "gitlab" | "azure" | "unknown";
|
|
155
|
+
export type GitDiagnosticsProvider = "github" | "selfHostedGithub" | "bitbucket" | "gitlab" | "azure" | "unknown";
|
|
156
156
|
/**
|
|
157
157
|
* Detect git provider from a repository URL (HTTPS or SSH).
|
|
158
158
|
* Used by both error diagnostics and connectivity checks for consistent provider labeling.
|
|
@@ -213,9 +213,10 @@ export interface CleanupCompletedMessage extends BaseMessage {
|
|
|
213
213
|
* Messages sent by the container orchestrator.
|
|
214
214
|
*/
|
|
215
215
|
export type ProjectsChunkMessage = InitializingMessage | FetchingGithubTokenMessage | FetchingFusionKeyMessage | CheckingAppMessage | CleaningUpAppMessage | CreatingAppMessage | CheckingIPMessage | AllocatingIPMessage | CheckingMachineMessage | CheckingVolumeMessage | ForkingVolumeMessage | RetryingWithNewRegionMessage | WaitingBeforePollingMessage | PollingMachineStatusMessage | WarningStateMessage | PingMessage | DebugMessage | ErrorMessage | InfoMessage | WarningMessage | MachineStatusMessage | LogsMessage | ConfigStatusMessage | AppCreatedMessage | MachineCreatedMessage | IpAllocatedMessage | VolumeForkedMessage | ReadyMessage | ErrorStateMessage | CleanupCompletedMessage;
|
|
216
|
+
export type GitProvider = "github" | "selfHostedGithub" | "bitbucket" | "gitlab" | "azure";
|
|
216
217
|
export interface GitConfig {
|
|
217
218
|
url: string;
|
|
218
|
-
provider:
|
|
219
|
+
provider: GitProvider | "unknown";
|
|
219
220
|
token: string | undefined;
|
|
220
221
|
}
|
|
221
222
|
export type GitConfigs = Record<string, GitConfig>;
|
|
@@ -572,6 +573,7 @@ export interface Project {
|
|
|
572
573
|
validateCommand?: string;
|
|
573
574
|
proxyOrigin?: string;
|
|
574
575
|
proxyDefaultOrigin?: string;
|
|
576
|
+
defaultAutoPush?: AutoPushMode;
|
|
575
577
|
gitBranchNamingStrategy?: "ai-session" | "branch-name" | "custom";
|
|
576
578
|
setupDependencies?: SetupDependency[];
|
|
577
579
|
gitBranchNamingCustom?: string;
|
|
@@ -628,6 +630,7 @@ export interface Project {
|
|
|
628
630
|
postMergeMemories?: boolean;
|
|
629
631
|
commitInstructions?: string;
|
|
630
632
|
maxAgentCompletions?: number;
|
|
633
|
+
skipCommandSecurity?: boolean;
|
|
631
634
|
httpsServerKeyPath?: string;
|
|
632
635
|
httpsServerCertPath?: string;
|
|
633
636
|
httpsServerCaPath?: string;
|