@boxes-dev/dvb-runtime 1.0.1053 → 1.0.1055
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/agent-init-guides/flow.md +8 -4
- package/dist/agent-init-guides/recovery.md +22 -0
- package/dist/agent-init-guides/running.md +3 -0
- package/dist/bin/dvb.mjs +694 -291
- package/dist/bin/dvbd.mjs +4 -4
- package/dist/product-docs/references/automations.md +10 -0
- package/dist/product-docs/references/billing-and-limits.md +2 -1
- package/dist/product-docs/references/onbox-agent-tools.md +7 -1
- package/dist/product-docs/references/project-setup.md +22 -12
- package/dist/product-docs/references/remote-assistants.md +25 -8
- package/dist/product-docs/references/troubleshooting.md +9 -0
- package/package.json +2 -2
package/dist/bin/dvb.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7953d21a-e340-5f5c-923a-10cac5e75ade")}catch(e){}}();
|
|
4
4
|
import { createRequire as __dvbCreateRequire } from "node:module";
|
|
5
5
|
import { dirname as __dvbDirname } from "node:path";
|
|
6
6
|
import { fileURLToPath as __dvbFileURLToPath } from "node:url";
|
|
@@ -69702,9 +69702,9 @@ var init_sentry = __esm({
|
|
|
69702
69702
|
uncaughtExceptionMonitorInstalled = false;
|
|
69703
69703
|
currentDevboxSentryUser = null;
|
|
69704
69704
|
readBuildMetadata = () => {
|
|
69705
|
-
const rawPackageVersion = "1.0.
|
|
69706
|
-
const rawGitSha = "
|
|
69707
|
-
const rawSentryRelease = "boxes-dev-dvb@1.0.
|
|
69705
|
+
const rawPackageVersion = "1.0.1055";
|
|
69706
|
+
const rawGitSha = "f79c13a9c9d8ec1a57505f400122d23ec18b0a9c";
|
|
69707
|
+
const rawSentryRelease = "boxes-dev-dvb@1.0.1055+f79c13a9c9d8ec1a57505f400122d23ec18b0a9c";
|
|
69708
69708
|
const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
|
|
69709
69709
|
const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
|
|
69710
69710
|
const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
|
|
@@ -73713,7 +73713,7 @@ var init_managedCodexVersions = __esm({
|
|
|
73713
73713
|
});
|
|
73714
73714
|
|
|
73715
73715
|
// ../../../../shared/devboxCore/dist/desktopInitContracts.js
|
|
73716
|
-
var DESKTOP_INIT_CONTRACT_VERSION, DESKTOP_INIT_BUNDLE_CONTENT_TYPE, DESKTOP_INIT_BUNDLE_COMPRESSION, DESKTOP_INIT_BUNDLE_ENCRYPTION, DESKTOP_INIT_UPLOAD_URL_TTL_SECONDS, DESKTOP_INIT_DOWNLOAD_URL_TTL_SECONDS, DESKTOP_INIT_MAX_UNCOMPRESSED_BUNDLE_BYTES, DESKTOP_INIT_MAX_COMBINED_BUNDLE_BYTES, DESKTOP_INIT_SHELL_ENV_CAPTURE_TIMEOUT_MS, DESKTOP_INIT_SHELL_ENV_CAPTURE_MAX_BYTES, DESKTOP_INIT_PHASES, DESKTOP_INIT_JOB_STATUSES, DESKTOP_INIT_SCAN_CATEGORIES, DEFAULT_DESKTOP_INIT_SCAN_FOCUS, DESKTOP_LOCAL_CODEX_SCAN_TRANSPORT_INTERRUPTED_ERROR_CODE, DESKTOP_LOCAL_CODEX_SCAN_STOPPED_ERROR_CODE, DESKTOP_INIT_SETUP_REVIEW_SECTIONS, DESKTOP_INIT_WORKFLOW_STEPS, DESKTOP_INIT_VIEWER_FUNCTIONS, PHASE_SET, JOB_STATUS_SET, WORKFLOW_OWNED_PHASES, isDesktopInitPhase, isDesktopInitWorkflowOwnedPhase, DESKTOP_INIT_UNTRACKED_TREE_VERSION, DESKTOP_INIT_DIRTY_PAYLOAD_VERSION, DESKTOP_INIT_AGENT_WORKTREE_DIR_PATHS, buildDesktopInitAgentWorktreeDisplayPath, DESKTOP_INIT_UNTRACKED_TREE_MAX_CHILDREN_PER_DIR, DESKTOP_INIT_UNTRACKED_HEAVY_COUNT_THRESHOLD, DESKTOP_INIT_UNTRACKED_AUTO_EXCLUDE_DIR_NAMES, DESKTOP_INIT_UNTRACKED_BUILD_OUTPUT_DIR_NAMES, DESKTOP_INIT_UNTRACKED_AUTO_EXCLUDE_DIR_NAME_SET, DESKTOP_INIT_UNTRACKED_BUILD_OUTPUT_DIR_NAME_SET, normalizeDesktopInitUntrackedExclusionEntry, normalizeDesktopInitUntrackedDisplayPath, classifyDesktopInitUntrackedDirectory, computeDefaultDesktopInitUntrackedExclusions, createDesktopInitUntrackedExclusionMatcher, resolveDesktopInitAgentWorktreeSelectionDisposition, evaluateDesktopInitBundleSize, formatDesktopInitLockHolder, resolveDesktopInitResumeDecision, resolveDesktopInitRegistryConflict, isRecord2, normalizeDesktopInitBundleUntrackedExclusions;
|
|
73716
|
+
var DESKTOP_INIT_CONTRACT_VERSION, DESKTOP_INIT_BUNDLE_CONTENT_TYPE, DESKTOP_INIT_BUNDLE_COMPRESSION, DESKTOP_INIT_BUNDLE_ENCRYPTION, DESKTOP_INIT_UPLOAD_URL_TTL_SECONDS, DESKTOP_INIT_DOWNLOAD_URL_TTL_SECONDS, DESKTOP_INIT_MAX_UNCOMPRESSED_BUNDLE_BYTES, DESKTOP_INIT_MAX_COMBINED_BUNDLE_BYTES, DESKTOP_INIT_SHELL_ENV_CAPTURE_TIMEOUT_MS, DESKTOP_INIT_SHELL_ENV_CAPTURE_MAX_BYTES, DESKTOP_INIT_PHASES, DESKTOP_INIT_JOB_STATUSES, DESKTOP_INIT_SCAN_CATEGORIES, DEFAULT_DESKTOP_INIT_SCAN_FOCUS, DESKTOP_LOCAL_CODEX_SCAN_TRANSPORT_INTERRUPTED_ERROR_CODE, DESKTOP_LOCAL_CODEX_SCAN_STOPPED_ERROR_CODE, DESKTOP_INIT_SETUP_REVIEW_SECTIONS, DESKTOP_INIT_WORKFLOW_STEPS, DESKTOP_INIT_VIEWER_FUNCTIONS, PHASE_SET, JOB_STATUS_SET, WORKFLOW_OWNED_PHASES, isDesktopInitPhase, isDesktopInitWorkflowOwnedPhase, DESKTOP_INIT_UNTRACKED_TREE_VERSION, DESKTOP_INIT_DIRTY_PAYLOAD_VERSION, DESKTOP_INIT_AGENT_WORKTREE_DIR_PATHS, buildDesktopInitAgentWorktreeDisplayPath, DESKTOP_INIT_UNTRACKED_TREE_MAX_CHILDREN_PER_DIR, DESKTOP_INIT_UNTRACKED_HEAVY_COUNT_THRESHOLD, DESKTOP_INIT_UNTRACKED_AUTO_EXCLUDE_DIR_NAMES, DESKTOP_INIT_UNTRACKED_BUILD_OUTPUT_DIR_NAMES, DESKTOP_INIT_UNTRACKED_AUTO_EXCLUDE_DIR_NAME_SET, DESKTOP_INIT_UNTRACKED_BUILD_OUTPUT_DIR_NAME_SET, normalizeDesktopInitUntrackedExclusionEntry, normalizeDesktopInitUntrackedDisplayPath, classifyDesktopInitUntrackedDirectory, computeDefaultDesktopInitUntrackedExclusions, createDesktopInitUntrackedExclusionMatcher, resolveDesktopInitAgentWorktreeSelectionDisposition, evaluateDesktopInitBundleSize, formatDesktopInitLockHolder, resolveDesktopInitResumeDecision, resolveDesktopInitRegistryConflict, isRecord2, requireString, requireNullableString, requireNonNegativeNumber, normalizeDesktopInitBundleUntrackedExclusions, requireNullableNonNegativeNumber, parseUntrackedTreeNode, normalizeDesktopInitUntrackedFileTree;
|
|
73717
73717
|
var init_desktopInitContracts = __esm({
|
|
73718
73718
|
"../../../../shared/devboxCore/dist/desktopInitContracts.js"() {
|
|
73719
73719
|
"use strict";
|
|
@@ -74057,6 +74057,30 @@ var init_desktopInitContracts = __esm({
|
|
|
74057
74057
|
return { kind: "none" };
|
|
74058
74058
|
};
|
|
74059
74059
|
isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
74060
|
+
requireString = (record3, field) => {
|
|
74061
|
+
const value = record3[field];
|
|
74062
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
74063
|
+
throw new Error(`Desktop init bundle manifest requires ${field}.`);
|
|
74064
|
+
}
|
|
74065
|
+
return value;
|
|
74066
|
+
};
|
|
74067
|
+
requireNullableString = (record3, field) => {
|
|
74068
|
+
const value = record3[field];
|
|
74069
|
+
if (value === null) {
|
|
74070
|
+
return null;
|
|
74071
|
+
}
|
|
74072
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
74073
|
+
throw new Error(`Desktop init bundle manifest requires ${field} to be a string or null.`);
|
|
74074
|
+
}
|
|
74075
|
+
return value;
|
|
74076
|
+
};
|
|
74077
|
+
requireNonNegativeNumber = (record3, field) => {
|
|
74078
|
+
const value = record3[field];
|
|
74079
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
74080
|
+
throw new Error(`Desktop init bundle manifest requires non-negative ${field}.`);
|
|
74081
|
+
}
|
|
74082
|
+
return value;
|
|
74083
|
+
};
|
|
74060
74084
|
normalizeDesktopInitBundleUntrackedExclusions = (value) => {
|
|
74061
74085
|
if (value === null || value === void 0) {
|
|
74062
74086
|
return { version: DESKTOP_INIT_UNTRACKED_TREE_VERSION, excludedPaths: [] };
|
|
@@ -74083,6 +74107,56 @@ var init_desktopInitContracts = __esm({
|
|
|
74083
74107
|
excludedPaths: [...cleaned].sort()
|
|
74084
74108
|
};
|
|
74085
74109
|
};
|
|
74110
|
+
requireNullableNonNegativeNumber = (record3, field) => {
|
|
74111
|
+
const value = record3[field];
|
|
74112
|
+
if (value === null) {
|
|
74113
|
+
return null;
|
|
74114
|
+
}
|
|
74115
|
+
return requireNonNegativeNumber(record3, field);
|
|
74116
|
+
};
|
|
74117
|
+
parseUntrackedTreeNode = (value) => {
|
|
74118
|
+
if (!isRecord2(value)) {
|
|
74119
|
+
throw new Error("Desktop init untracked tree node must be an object.");
|
|
74120
|
+
}
|
|
74121
|
+
const kind = requireString(value, "kind");
|
|
74122
|
+
if (kind !== "directory" && kind !== "file") {
|
|
74123
|
+
throw new Error("Desktop init untracked tree node kind is invalid.");
|
|
74124
|
+
}
|
|
74125
|
+
const rawChildren = value.children;
|
|
74126
|
+
if (!Array.isArray(rawChildren)) {
|
|
74127
|
+
throw new Error("Desktop init untracked tree node requires children.");
|
|
74128
|
+
}
|
|
74129
|
+
return {
|
|
74130
|
+
path: requireString(value, "path"),
|
|
74131
|
+
label: requireString(value, "label"),
|
|
74132
|
+
kind,
|
|
74133
|
+
descendantFileCount: requireNonNegativeNumber(value, "descendantFileCount"),
|
|
74134
|
+
sizeBytes: requireNullableNonNegativeNumber(value, "sizeBytes"),
|
|
74135
|
+
sizeApproximate: value.sizeApproximate === true,
|
|
74136
|
+
heavy: value.heavy === true,
|
|
74137
|
+
autoExclude: value.autoExclude === true,
|
|
74138
|
+
heavyReason: requireNullableString(value, "heavyReason"),
|
|
74139
|
+
childrenTruncated: value.childrenTruncated === true,
|
|
74140
|
+
children: rawChildren.map(parseUntrackedTreeNode)
|
|
74141
|
+
};
|
|
74142
|
+
};
|
|
74143
|
+
normalizeDesktopInitUntrackedFileTree = (value) => {
|
|
74144
|
+
if (!isRecord2(value)) {
|
|
74145
|
+
throw new Error("Desktop init untracked file tree must be an object.");
|
|
74146
|
+
}
|
|
74147
|
+
const rawRoots = value.roots;
|
|
74148
|
+
if (!Array.isArray(rawRoots)) {
|
|
74149
|
+
throw new Error("Desktop init untracked file tree requires roots.");
|
|
74150
|
+
}
|
|
74151
|
+
return {
|
|
74152
|
+
version: DESKTOP_INIT_UNTRACKED_TREE_VERSION,
|
|
74153
|
+
totalFileCount: requireNonNegativeNumber(value, "totalFileCount"),
|
|
74154
|
+
totalSizeBytes: requireNullableNonNegativeNumber(value, "totalSizeBytes"),
|
|
74155
|
+
sizeApproximate: value.sizeApproximate === true,
|
|
74156
|
+
roots: rawRoots.map(parseUntrackedTreeNode),
|
|
74157
|
+
defaultExclusions: normalizeDesktopInitBundleUntrackedExclusions(value.defaultExclusions)
|
|
74158
|
+
};
|
|
74159
|
+
};
|
|
74086
74160
|
}
|
|
74087
74161
|
});
|
|
74088
74162
|
|
|
@@ -75007,7 +75081,7 @@ var init_packageVersion = __esm({
|
|
|
75007
75081
|
return path18.join(process.cwd(), "dvb");
|
|
75008
75082
|
};
|
|
75009
75083
|
readEmbeddedPackageVersion = () => {
|
|
75010
|
-
const raw = "1.0.
|
|
75084
|
+
const raw = "1.0.1055";
|
|
75011
75085
|
return trimVersion(raw);
|
|
75012
75086
|
};
|
|
75013
75087
|
readNearestPackageMetadata = (basePath) => {
|
|
@@ -90019,7 +90093,7 @@ var init_index_node2 = __esm({
|
|
|
90019
90093
|
// src/devbox/controlPlane.ts
|
|
90020
90094
|
import http7 from "node:http";
|
|
90021
90095
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
90022
|
-
var MANAGED_DAEMON_NOT_READY_CODE, CONVEX_INFLIGHT_ACTION_DISCONNECTED_MESSAGE, CONTROL_PLANE_ACTION_RETRY_MAX_ATTEMPTS, CONTROL_PLANE_ACTION_RETRY_BASE_DELAY_MS, MANAGED_DAEMON_RECOVERY_WAKING_TIMEOUT_MS, CONTROL_PLANE_CHECKPOINT_RECOVERY_MAX_ATTEMPTS, CONTROL_PLANE_CHECKPOINT_RECOVERY_POLL_MS, ManagedDaemonNotReadyError, isManagedDaemonNotReadyError, isManagedDaemonSleepingError, sleep2, isRetryableTransientConvexActionError, buildTransientConvexActionRetryMessage, announceTransientConvexActionRetry, retryTransientConvexAction, normalizeStringRecord, E2B_DEVBOX_ALIAS_EXISTS_CODE, isRecord3, maybeMapE2bProvisionControlPlaneError, mapE2bProvisionControlPlaneError, LOGIN_CODE_REJECTIONS, resolveControlPlaneUrl, resolveConvexUrl, escapeHtml2, CALLBACK_LOGO_MARK, CALLBACK_FULL_LOGO, renderCallbackPage, CONTROL_PLANE_REQUEST_UNAVAILABLE_CODE, ControlPlaneRequestUnavailableError, isControlPlaneRequestUnavailableError, requestJson, ControlPlaneRequestError, isControlPlaneAuthRejectionError, isControlPlaneSessionRefreshRejectionError, startCallbackServer, getControlPlaneUrl, getConvexUrl, createDefaultBrowserSignInDeps, signInWithBrowser, claudeTokenGet, claudeTokenSet, claudeTokenClear, agentAuthCredentialsList, fetchAgentCredentialRows, codexAuthCacheGet, codexAuthCacheSet, codexAuthCacheClear, claudeTokenReportRuntimeAuthFailureForViewer, claudeTokenReportRuntimeValidatedForViewer, e2bTokenResolvedGet, userSettingsGet, userSettingsSet, projectInstanceTypeOptionsGet, e2bDevboxRemove, e2bDevboxGet, e2bDevboxStatusesList, e2bDevboxDestroy, e2bDevboxProvision, e2bDevboxPause, e2bDevboxEnsureActive, e2bDevboxKeepAlive, e2bDevboxReset, e2bDevboxIssueBootstrapConnectInfo, e2bDevboxBootstrapDaemon, managedDevboxIssueDaemonConnectInfo, managedDaemonRecoverForInstance, managedDaemonControlGrantIssueForViewer, managedDevboxCreateCheckpoint, managedDevboxListRemoteStates, clientThreadsListForPrimaryInstance, threadTitleGenerationStatesListForPrimaryInstance, spriteDaemonSessionsList, clientThreadsUpsertRemoteInitCodexThread, clientThreadsDiscardRemoteInitCodexThread, projectInitJobsGetActiveForProject,
|
|
90096
|
+
var MANAGED_DAEMON_NOT_READY_CODE, CONVEX_INFLIGHT_ACTION_DISCONNECTED_MESSAGE, CONTROL_PLANE_ACTION_RETRY_MAX_ATTEMPTS, CONTROL_PLANE_ACTION_RETRY_BASE_DELAY_MS, MANAGED_DAEMON_RECOVERY_WAKING_TIMEOUT_MS, CONTROL_PLANE_CHECKPOINT_RECOVERY_MAX_ATTEMPTS, CONTROL_PLANE_CHECKPOINT_RECOVERY_POLL_MS, ManagedDaemonNotReadyError, isManagedDaemonNotReadyError, isManagedDaemonSleepingError, sleep2, isRetryableTransientConvexActionError, buildTransientConvexActionRetryMessage, announceTransientConvexActionRetry, retryTransientConvexAction, normalizeStringRecord, E2B_DEVBOX_ALIAS_EXISTS_CODE, isRecord3, maybeMapE2bProvisionControlPlaneError, mapE2bProvisionControlPlaneError, LOGIN_CODE_REJECTIONS, resolveControlPlaneUrl, resolveConvexUrl, escapeHtml2, CALLBACK_LOGO_MARK, CALLBACK_FULL_LOGO, renderCallbackPage, CONTROL_PLANE_REQUEST_UNAVAILABLE_CODE, ControlPlaneRequestUnavailableError, isControlPlaneRequestUnavailableError, requestJson, ControlPlaneRequestError, isControlPlaneAuthRejectionError, isControlPlaneSessionRefreshRejectionError, startCallbackServer, getControlPlaneUrl, getConvexUrl, createDefaultBrowserSignInDeps, signInWithBrowser, claudeTokenGet, claudeTokenSet, claudeTokenClear, agentAuthCredentialsList, fetchAgentCredentialRows, codexAuthCacheGet, codexAuthCacheSet, codexAuthCacheClear, claudeTokenReportRuntimeAuthFailureForViewer, claudeTokenReportRuntimeValidatedForViewer, e2bTokenResolvedGet, userSettingsGet, userSettingsSet, projectInstanceTypeOptionsGet, e2bDevboxRemove, e2bDevboxGet, e2bDevboxStatusesList, e2bDevboxDestroy, e2bDevboxProvision, e2bDevboxPause, e2bDevboxEnsureActive, e2bDevboxKeepAlive, e2bDevboxReset, e2bDevboxIssueBootstrapConnectInfo, e2bDevboxBootstrapDaemon, managedDevboxIssueDaemonConnectInfo, managedDaemonRecoverForInstance, managedDaemonControlGrantIssueForViewer, managedDevboxCreateCheckpoint, managedDevboxListRemoteStates, clientThreadsListForPrimaryInstance, threadTitleGenerationStatesListForPrimaryInstance, spriteDaemonSessionsList, clientThreadsUpsertRemoteInitCodexThread, clientThreadsDiscardRemoteInitCodexThread, projectInitJobsGetActiveForProject, agentInitProgressReportCliStep, instancesList, helloViewerGet, billingSummaryGet, convexBrowserModulePromise, loadConvexBrowserModule, buildConvexClientOptions, configureAuthenticatedConvexClient, createAuthenticatedConvexClient, withConvexClient, resolveInstanceIdForAlias, resolveManagedDaemonControlTargetWithClient, issueManagedDaemonControlGrantWithClient, resolveSpriteInstanceId, fetchClaudeTokenStatus, fetchResolvedE2bCredentials, fetchViewerIdentity, BILLING_ACTIVATION_STATES, readBillingActivationBoolean, parseBillingActivationDecision, parseBillingActivationSummary, fetchTeamBillingActivationForViewer, fetchActiveDesktopInitJobForProject, reportAgentInitStep, fetchViewerCodingAgentPreference, fetchProjectInstanceTypeOptionsForViewer, storeViewerCodingAgentPreference, storeClaudeCodeOauthToken, clearClaudeCodeOauthToken, reportClaudeRuntimeAuthFailureForViewer, reportClaudeRuntimeValidatedForViewer, fetchCodexAuthCacheStatus, storeCodexAuthCache, clearCodexAuthCache, normalizeE2bDevboxRecord, fetchE2bDevboxLifecycle, listE2bDevboxStatuses, destroyE2bDevbox, provisionE2bDevbox, pauseE2bDevbox, ensureE2bDevboxActive, keepAliveE2bDevbox, resetE2bDevbox, bootstrapE2bDaemon, throwManagedDaemonNotReady, normalizeOptionalString2, normalizeAliasForLookup, validateManagedDaemonRecoveryResponse, normalizeManagedCheckpointResponse, buildRecoveredManagedCheckpointResponse, readManagedCheckpointRecoveryState, recoverManagedCheckpointAfterDisconnect, buildManagedDaemonConnectInfoResponseSummary, buildManagedDaemonConnectInfoUnexpectedMessage, buildManagedDaemonConnectInfoSleepingMessage, buildManagedDaemonConnectInfoWakingMessage, readWakingRetryAfterMs, logManagedDaemonConnectInfoResponse, fetchManagedDaemonConnectInfoWithAction, requestManagedDaemonConnectInfo, fetchManagedDaemonConnectInfo, recoverManagedDaemonForInit, recoverManagedDaemonControlTargetWithClient, fetchE2bBootstrapConnectInfo, createManagedCheckpoint, listManagedRemoteStates, listViewerInstances, listSpriteDaemonSessions, upsertRemoteInitCodexThread, discardRemoteInitCodexThread, signOutControlPlane, refreshControlPlaneSession, readLoginCodeRejection, exchangeLoginCode, createCliInitResponsesRelayTokenForViewer;
|
|
90023
90097
|
var init_controlPlane = __esm({
|
|
90024
90098
|
"src/devbox/controlPlane.ts"() {
|
|
90025
90099
|
"use strict";
|
|
@@ -90639,7 +90713,7 @@ var init_controlPlane = __esm({
|
|
|
90639
90713
|
clientThreadsUpsertRemoteInitCodexThread = makeFunctionReference("clientThreads:upsertRemoteInitCodexThreadForPrimaryInstance");
|
|
90640
90714
|
clientThreadsDiscardRemoteInitCodexThread = makeFunctionReference("clientThreads:discardRemoteInitCodexThreadForPrimaryInstance");
|
|
90641
90715
|
projectInitJobsGetActiveForProject = makeFunctionReference("projectInitJobs:getActiveForProjectForViewer");
|
|
90642
|
-
|
|
90716
|
+
agentInitProgressReportCliStep = makeFunctionReference("agentInitProgress:reportCliStepForViewer");
|
|
90643
90717
|
instancesList = makeFunctionReference("instances:listForViewer");
|
|
90644
90718
|
helloViewerGet = makeFunctionReference("hello:getViewer");
|
|
90645
90719
|
billingSummaryGet = makeFunctionReference("billingStripe:getTeamBillingSummaryForViewer");
|
|
@@ -90842,9 +90916,9 @@ var init_controlPlane = __esm({
|
|
|
90842
90916
|
});
|
|
90843
90917
|
});
|
|
90844
90918
|
};
|
|
90845
|
-
|
|
90919
|
+
reportAgentInitStep = async (token, request2) => {
|
|
90846
90920
|
await withConvexClient(token, async (client) => {
|
|
90847
|
-
await client.mutation(
|
|
90921
|
+
await client.mutation(agentInitProgressReportCliStep, request2);
|
|
90848
90922
|
});
|
|
90849
90923
|
};
|
|
90850
90924
|
fetchViewerCodingAgentPreference = async (token) => {
|
|
@@ -91411,6 +91485,15 @@ var init_controlPlane = __esm({
|
|
|
91411
91485
|
detail ? `Detail: ${detail}` : null
|
|
91412
91486
|
].filter((part) => part !== null).join(" ");
|
|
91413
91487
|
};
|
|
91488
|
+
buildManagedDaemonConnectInfoWakingMessage = (summary) => {
|
|
91489
|
+
const alias = summary.responseAlias ?? summary.requestedAlias;
|
|
91490
|
+
const detail = summary.detail ?? summary.error ?? summary.message;
|
|
91491
|
+
return [
|
|
91492
|
+
`Machine "${alias}" is still waking up. Retry in a moment.`,
|
|
91493
|
+
detail ? `Detail: ${detail}` : null
|
|
91494
|
+
].filter((part) => part !== null).join(" ");
|
|
91495
|
+
};
|
|
91496
|
+
readWakingRetryAfterMs = (response) => typeof response?.retryAfterMs === "number" && Number.isFinite(response.retryAfterMs) ? Math.max(0, Math.round(response.retryAfterMs)) : null;
|
|
91414
91497
|
logManagedDaemonConnectInfoResponse = (event, summary) => {
|
|
91415
91498
|
logger2.warn(event, {
|
|
91416
91499
|
requestedAlias: summary.requestedAlias,
|
|
@@ -91432,11 +91515,22 @@ var init_controlPlane = __esm({
|
|
|
91432
91515
|
});
|
|
91433
91516
|
};
|
|
91434
91517
|
fetchManagedDaemonConnectInfoWithAction = async (runAction, alias, intent, allowWake) => {
|
|
91435
|
-
const
|
|
91518
|
+
const requestConnectInfo = async () => await retryTransientConvexAction({
|
|
91436
91519
|
actionName: "devboxes:issueManagedDaemonConnectInfoForViewer",
|
|
91437
91520
|
onRetry: announceTransientConvexActionRetry,
|
|
91438
91521
|
run: runAction
|
|
91439
91522
|
});
|
|
91523
|
+
const wakingDeadline = Date.now() + MANAGED_DAEMON_RECOVERY_WAKING_TIMEOUT_MS;
|
|
91524
|
+
let response = await requestConnectInfo();
|
|
91525
|
+
while (response?.ok === true && response.provider === "e2b" && response.status === "waking" && readWakingRetryAfterMs(response) !== null && Date.now() < wakingDeadline) {
|
|
91526
|
+
await sleep2(
|
|
91527
|
+
Math.min(
|
|
91528
|
+
readWakingRetryAfterMs(response) ?? 0,
|
|
91529
|
+
Math.max(0, wakingDeadline - Date.now())
|
|
91530
|
+
)
|
|
91531
|
+
);
|
|
91532
|
+
response = await requestConnectInfo();
|
|
91533
|
+
}
|
|
91440
91534
|
if (response?.ok === false && response.code === MANAGED_DAEMON_NOT_READY_CODE) {
|
|
91441
91535
|
throwManagedDaemonNotReady(response, alias);
|
|
91442
91536
|
}
|
|
@@ -91465,6 +91559,18 @@ var init_controlPlane = __esm({
|
|
|
91465
91559
|
...summary.detail ? { detail: summary.detail } : {}
|
|
91466
91560
|
});
|
|
91467
91561
|
}
|
|
91562
|
+
if (provider === "e2b" && summary.ok === true && summary.status === "waking") {
|
|
91563
|
+
const retryAfterMs = readWakingRetryAfterMs(response);
|
|
91564
|
+
throw new ManagedDaemonNotReadyError({
|
|
91565
|
+
provider: "e2b",
|
|
91566
|
+
alias: resolvedAlias || alias,
|
|
91567
|
+
state: "pending",
|
|
91568
|
+
lifecycleStatus: "waking",
|
|
91569
|
+
message: buildManagedDaemonConnectInfoWakingMessage(summary),
|
|
91570
|
+
...summary.detail ? { detail: summary.detail } : {},
|
|
91571
|
+
...retryAfterMs !== null ? { retryAfterMs } : {}
|
|
91572
|
+
});
|
|
91573
|
+
}
|
|
91468
91574
|
if (summary.ok !== true || provider !== "e2b" || !resolvedAlias || !sandboxId || !url3 || !connectToken) {
|
|
91469
91575
|
logManagedDaemonConnectInfoResponse(
|
|
91470
91576
|
"managed_daemon_connect_info_unexpected",
|
|
@@ -91642,9 +91748,12 @@ var init_controlPlane = __esm({
|
|
|
91642
91748
|
return response.filter((entry) => entry && typeof entry === "object").map((entry) => entry);
|
|
91643
91749
|
});
|
|
91644
91750
|
};
|
|
91645
|
-
listViewerInstances = async (token
|
|
91751
|
+
listViewerInstances = async (token, { includeHiddenForks } = {
|
|
91752
|
+
includeHiddenForks: false
|
|
91753
|
+
}) => {
|
|
91646
91754
|
return await withConvexClient(token, async (client) => {
|
|
91647
91755
|
const entries = await client.query(instancesList, {
|
|
91756
|
+
includeHiddenForks,
|
|
91648
91757
|
includeDaemonHeartbeat: false
|
|
91649
91758
|
});
|
|
91650
91759
|
const result = [];
|
|
@@ -138872,14 +138981,14 @@ var init_cp = __esm({
|
|
|
138872
138981
|
init_devboxCore();
|
|
138873
138982
|
init_daemonClient();
|
|
138874
138983
|
init_logger3();
|
|
138875
|
-
|
|
138984
|
+
init_controlPlane();
|
|
138876
138985
|
init_commandProvider();
|
|
138986
|
+
init_e2bCommandContext();
|
|
138877
138987
|
init_progress();
|
|
138878
138988
|
init_args();
|
|
138879
138989
|
init_errors4();
|
|
138880
138990
|
init_runtimeClient();
|
|
138881
138991
|
init_projectWorkdir();
|
|
138882
|
-
init_accountScope2();
|
|
138883
138992
|
COPY_USAGE = [
|
|
138884
138993
|
"Usage:",
|
|
138885
138994
|
" dvb cp <src> <box>:<dest> [--json]",
|
|
@@ -138951,26 +139060,19 @@ var init_cp = __esm({
|
|
|
138951
139060
|
};
|
|
138952
139061
|
};
|
|
138953
139062
|
resolveCopyProviderTarget = async (targetBox) => {
|
|
138954
|
-
|
|
138955
|
-
|
|
138956
|
-
|
|
138957
|
-
|
|
138958
|
-
logger2.warn("cp_provider_lookup_failed", {
|
|
138959
|
-
box: targetBox,
|
|
138960
|
-
error: String(error55)
|
|
138961
|
-
});
|
|
138962
|
-
}
|
|
138963
|
-
const homeDir2 = process.env.HOME ?? os12.homedir();
|
|
138964
|
-
const { accountScope } = await resolveCliAccountScopeFromLocalAuth({
|
|
138965
|
-
cwd: process.cwd(),
|
|
138966
|
-
homeDir: homeDir2
|
|
138967
|
-
});
|
|
138968
|
-
return await resolveCommandComputeProvider({
|
|
138969
|
-
accountScope,
|
|
138970
|
-
box: targetBox,
|
|
138971
|
-
boxes: providerLookupBoxes,
|
|
138972
|
-
homeDir: homeDir2
|
|
139063
|
+
const target = targetBox.trim();
|
|
139064
|
+
const { controlPlaneToken } = await resolveE2bCommandContext();
|
|
139065
|
+
const instances2 = await listViewerInstances(controlPlaneToken, {
|
|
139066
|
+
includeHiddenForks: true
|
|
138973
139067
|
});
|
|
139068
|
+
const match = instances2.find((entry) => entry.instanceId === target) ?? instances2.find((entry) => entry.alias === target) ?? instances2.find((entry) => entry.providerInstanceId === target);
|
|
139069
|
+
if (!match) {
|
|
139070
|
+
throw new Error(`No machine named "${target}" found.`);
|
|
139071
|
+
}
|
|
139072
|
+
return {
|
|
139073
|
+
alias: match.alias,
|
|
139074
|
+
computeProvider: match.provider
|
|
139075
|
+
};
|
|
138974
139076
|
};
|
|
138975
139077
|
shouldAppendSourceBasename = (rawPath) => rawPath.length === 0 || rawPath === "." || rawPath === "./" || rawPath.endsWith("/");
|
|
138976
139078
|
resolveRemoteHomeDir = async ({
|
|
@@ -169577,8 +169679,8 @@ var require_react_development = __commonJS({
|
|
|
169577
169679
|
function enqueueTask(task) {
|
|
169578
169680
|
if (null === enqueueTaskImpl)
|
|
169579
169681
|
try {
|
|
169580
|
-
var
|
|
169581
|
-
enqueueTaskImpl = (module2 && module2[
|
|
169682
|
+
var requireString4 = ("require" + Math.random()).slice(0, 7);
|
|
169683
|
+
enqueueTaskImpl = (module2 && module2[requireString4]).call(
|
|
169582
169684
|
module2,
|
|
169583
169685
|
"timers"
|
|
169584
169686
|
).setImmediate;
|
|
@@ -228201,7 +228303,7 @@ var init_AgentViewApp = __esm({
|
|
|
228201
228303
|
|
|
228202
228304
|
// src/devbox/agentView/workspace/workspaceEnvironment.ts
|
|
228203
228305
|
import path36 from "node:path";
|
|
228204
|
-
var AGENT_WORKSPACE_ROLE_ENV, AGENT_WORKSPACE_CONFIG_ENV, TMUX_ID_PATTERN, CREDENTIAL_PATTERN,
|
|
228306
|
+
var AGENT_WORKSPACE_ROLE_ENV, AGENT_WORKSPACE_CONFIG_ENV, TMUX_ID_PATTERN, CREDENTIAL_PATTERN, requireString2, requireAbsolutePath, requireTmuxId, parseAgentWorkspaceConfig, readAgentWorkspaceRole, requireAgentWorkspaceConfigPath, buildAgentWorkspacePaneEnvironment;
|
|
228205
228307
|
var init_workspaceEnvironment = __esm({
|
|
228206
228308
|
"src/devbox/agentView/workspace/workspaceEnvironment.ts"() {
|
|
228207
228309
|
"use strict";
|
|
@@ -228209,21 +228311,21 @@ var init_workspaceEnvironment = __esm({
|
|
|
228209
228311
|
AGENT_WORKSPACE_CONFIG_ENV = "DVB_AGENT_WORKSPACE_CONFIG";
|
|
228210
228312
|
TMUX_ID_PATTERN = /^[$@%][0-9]+$/u;
|
|
228211
228313
|
CREDENTIAL_PATTERN = /^[A-Za-z0-9_-]{32,128}$/u;
|
|
228212
|
-
|
|
228314
|
+
requireString2 = (value, label, maximumLength = 4096) => {
|
|
228213
228315
|
if (typeof value !== "string" || value.length === 0 || value.length > maximumLength) {
|
|
228214
228316
|
throw new Error(`Invalid agent workspace ${label}.`);
|
|
228215
228317
|
}
|
|
228216
228318
|
return value;
|
|
228217
228319
|
};
|
|
228218
228320
|
requireAbsolutePath = (value, label) => {
|
|
228219
|
-
const parsed =
|
|
228321
|
+
const parsed = requireString2(value, label);
|
|
228220
228322
|
if (!path36.isAbsolute(parsed)) {
|
|
228221
228323
|
throw new Error(`Agent workspace ${label} must be an absolute path.`);
|
|
228222
228324
|
}
|
|
228223
228325
|
return parsed;
|
|
228224
228326
|
};
|
|
228225
228327
|
requireTmuxId = (value, label) => {
|
|
228226
|
-
const parsed =
|
|
228328
|
+
const parsed = requireString2(value, label, 32);
|
|
228227
228329
|
if (!TMUX_ID_PATTERN.test(parsed)) {
|
|
228228
228330
|
throw new Error(`Invalid agent workspace ${label}.`);
|
|
228229
228331
|
}
|
|
@@ -228237,7 +228339,7 @@ var init_workspaceEnvironment = __esm({
|
|
|
228237
228339
|
if (record3.version !== 1) {
|
|
228238
228340
|
throw new Error("Unsupported agent workspace configuration version.");
|
|
228239
228341
|
}
|
|
228240
|
-
const credential =
|
|
228342
|
+
const credential = requireString2(record3.credential, "credential", 128);
|
|
228241
228343
|
if (!CREDENTIAL_PATTERN.test(credential)) {
|
|
228242
228344
|
throw new Error("Invalid agent workspace credential.");
|
|
228243
228345
|
}
|
|
@@ -228263,7 +228365,7 @@ var init_workspaceEnvironment = __esm({
|
|
|
228263
228365
|
windowId: requireTmuxId(record3.windowId, "window id"),
|
|
228264
228366
|
sidebarPaneId: requireTmuxId(record3.sidebarPaneId, "sidebar pane id"),
|
|
228265
228367
|
detailPaneId: requireTmuxId(record3.detailPaneId, "detail pane id"),
|
|
228266
|
-
projectTitle:
|
|
228368
|
+
projectTitle: requireString2(record3.projectTitle, "project title", 160),
|
|
228267
228369
|
narrow: record3.narrow
|
|
228268
228370
|
};
|
|
228269
228371
|
};
|
|
@@ -228890,7 +228992,7 @@ var init_tmuxWorkspace = __esm({
|
|
|
228890
228992
|
});
|
|
228891
228993
|
|
|
228892
228994
|
// src/devbox/agentView/workspace/workspaceProtocol.ts
|
|
228893
|
-
var AGENT_WORKSPACE_PROTOCOL_VERSION, AGENT_WORKSPACE_MAX_MESSAGE_BYTES, requireRecord,
|
|
228995
|
+
var AGENT_WORKSPACE_PROTOCOL_VERSION, AGENT_WORKSPACE_MAX_MESSAGE_BYTES, requireRecord, requireString3, optionalString, requireBoolean, parseBoxLabel, parseResolvedTargetRole, parseConfirmation, parseEmptyConfirmation, parseAction, parseJsonLine, parseAgentWorkspaceClientMessage, parseAgentWorkspaceServerMessage, encodeAgentWorkspaceMessage;
|
|
228894
228996
|
var init_workspaceProtocol = __esm({
|
|
228895
228997
|
"src/devbox/agentView/workspace/workspaceProtocol.ts"() {
|
|
228896
228998
|
"use strict";
|
|
@@ -228902,13 +229004,13 @@ var init_workspaceProtocol = __esm({
|
|
|
228902
229004
|
}
|
|
228903
229005
|
return value;
|
|
228904
229006
|
};
|
|
228905
|
-
|
|
229007
|
+
requireString3 = (value, label, maximumLength = 16384) => {
|
|
228906
229008
|
if (typeof value !== "string" || value.length === 0 || value.length > maximumLength) {
|
|
228907
229009
|
throw new Error(`Invalid ${label}.`);
|
|
228908
229010
|
}
|
|
228909
229011
|
return value;
|
|
228910
229012
|
};
|
|
228911
|
-
optionalString = (value, label) => value === null ? null :
|
|
229013
|
+
optionalString = (value, label) => value === null ? null : requireString3(value, label);
|
|
228912
229014
|
requireBoolean = (value, label) => {
|
|
228913
229015
|
if (typeof value !== "boolean") {
|
|
228914
229016
|
throw new Error(`Invalid ${label}.`);
|
|
@@ -228937,8 +229039,8 @@ var init_workspaceProtocol = __esm({
|
|
|
228937
229039
|
throw new Error("Invalid Claude confirmation turn epoch.");
|
|
228938
229040
|
}
|
|
228939
229041
|
return {
|
|
228940
|
-
transitionId:
|
|
228941
|
-
expectedOwnerFingerprint:
|
|
229042
|
+
transitionId: requireString3(record3.transitionId, "transition id"),
|
|
229043
|
+
expectedOwnerFingerprint: requireString3(
|
|
228942
229044
|
record3.expectedOwnerFingerprint,
|
|
228943
229045
|
"owner fingerprint"
|
|
228944
229046
|
),
|
|
@@ -228955,7 +229057,7 @@ var init_workspaceProtocol = __esm({
|
|
|
228955
229057
|
}
|
|
228956
229058
|
const record3 = requireRecord(value, "empty Claude confirmation");
|
|
228957
229059
|
return {
|
|
228958
|
-
expectedAttachmentFingerprint:
|
|
229060
|
+
expectedAttachmentFingerprint: requireString3(
|
|
228959
229061
|
record3.expectedAttachmentFingerprint,
|
|
228960
229062
|
"attachment fingerprint"
|
|
228961
229063
|
)
|
|
@@ -228963,7 +229065,7 @@ var init_workspaceProtocol = __esm({
|
|
|
228963
229065
|
};
|
|
228964
229066
|
parseAction = (value) => {
|
|
228965
229067
|
const record3 = requireRecord(value, "workspace action");
|
|
228966
|
-
const kind =
|
|
229068
|
+
const kind = requireString3(record3.kind, "workspace action kind", 32);
|
|
228967
229069
|
if (kind === "shell") {
|
|
228968
229070
|
if (!Array.isArray(record3.args) || record3.args.length > 32) {
|
|
228969
229071
|
throw new Error("Invalid workspace shell arguments.");
|
|
@@ -228975,10 +229077,10 @@ var init_workspaceProtocol = __esm({
|
|
|
228975
229077
|
return {
|
|
228976
229078
|
kind,
|
|
228977
229079
|
args: record3.args.map(
|
|
228978
|
-
(argument) =>
|
|
229080
|
+
(argument) => requireString3(argument, "shell argument")
|
|
228979
229081
|
),
|
|
228980
229082
|
resolvedTarget: {
|
|
228981
|
-
alias:
|
|
229083
|
+
alias: requireString3(target.alias, "shell alias"),
|
|
228982
229084
|
computeProvider: "e2b",
|
|
228983
229085
|
instanceId: optionalString(target.instanceId, "shell instance id"),
|
|
228984
229086
|
...target.providerInstanceId === void 0 ? {} : {
|
|
@@ -228996,31 +229098,31 @@ var init_workspaceProtocol = __esm({
|
|
|
228996
229098
|
};
|
|
228997
229099
|
}
|
|
228998
229100
|
const common = {
|
|
228999
|
-
alias:
|
|
229101
|
+
alias: requireString3(record3.alias, "workspace alias"),
|
|
229000
229102
|
boxLabel: parseBoxLabel(record3.boxLabel),
|
|
229001
|
-
primaryInstanceId:
|
|
229103
|
+
primaryInstanceId: requireString3(
|
|
229002
229104
|
record3.primaryInstanceId,
|
|
229003
229105
|
"primary instance id"
|
|
229004
229106
|
),
|
|
229005
|
-
clientThreadId:
|
|
229107
|
+
clientThreadId: requireString3(record3.clientThreadId, "client thread id")
|
|
229006
229108
|
};
|
|
229007
229109
|
if (kind === "codex") {
|
|
229008
229110
|
return {
|
|
229009
229111
|
kind,
|
|
229010
229112
|
...common,
|
|
229011
|
-
threadId:
|
|
229012
|
-
sessionPath:
|
|
229113
|
+
threadId: requireString3(record3.threadId, "Codex thread id"),
|
|
229114
|
+
sessionPath: requireString3(record3.sessionPath, "Codex session path")
|
|
229013
229115
|
};
|
|
229014
229116
|
}
|
|
229015
229117
|
if (kind === "codex_empty") {
|
|
229016
229118
|
return {
|
|
229017
229119
|
kind,
|
|
229018
229120
|
...common,
|
|
229019
|
-
startupAttemptId:
|
|
229121
|
+
startupAttemptId: requireString3(
|
|
229020
229122
|
record3.startupAttemptId,
|
|
229021
229123
|
"Codex startup attempt id"
|
|
229022
229124
|
),
|
|
229023
|
-
targetExecutionInstanceId:
|
|
229125
|
+
targetExecutionInstanceId: requireString3(
|
|
229024
229126
|
record3.targetExecutionInstanceId,
|
|
229025
229127
|
"Codex execution instance id"
|
|
229026
229128
|
)
|
|
@@ -229034,8 +229136,8 @@ var init_workspaceProtocol = __esm({
|
|
|
229034
229136
|
kind,
|
|
229035
229137
|
...common,
|
|
229036
229138
|
backend: record3.backend,
|
|
229037
|
-
threadId:
|
|
229038
|
-
sessionPath:
|
|
229139
|
+
threadId: requireString3(record3.threadId, "Claude thread id"),
|
|
229140
|
+
sessionPath: requireString3(record3.sessionPath, "Claude session path"),
|
|
229039
229141
|
threadTitle: optionalString(record3.threadTitle, "Claude thread title"),
|
|
229040
229142
|
confirmation: parseConfirmation(record3.confirmation)
|
|
229041
229143
|
};
|
|
@@ -229044,20 +229146,20 @@ var init_workspaceProtocol = __esm({
|
|
|
229044
229146
|
return {
|
|
229045
229147
|
kind,
|
|
229046
229148
|
...common,
|
|
229047
|
-
startupAttemptId:
|
|
229149
|
+
startupAttemptId: requireString3(
|
|
229048
229150
|
record3.startupAttemptId,
|
|
229049
229151
|
"Claude startup attempt id"
|
|
229050
229152
|
),
|
|
229051
|
-
plannedClaudeSessionId:
|
|
229153
|
+
plannedClaudeSessionId: requireString3(
|
|
229052
229154
|
record3.plannedClaudeSessionId,
|
|
229053
229155
|
"planned Claude session id"
|
|
229054
229156
|
),
|
|
229055
|
-
targetExecutionInstanceId:
|
|
229157
|
+
targetExecutionInstanceId: requireString3(
|
|
229056
229158
|
record3.targetExecutionInstanceId,
|
|
229057
229159
|
"Claude execution instance id"
|
|
229058
229160
|
),
|
|
229059
229161
|
cwd: optionalString(record3.cwd, "Claude workdir"),
|
|
229060
|
-
terminalSessionId:
|
|
229162
|
+
terminalSessionId: requireString3(
|
|
229061
229163
|
record3.terminalSessionId,
|
|
229062
229164
|
"Claude terminal session id"
|
|
229063
229165
|
),
|
|
@@ -229085,11 +229187,11 @@ var init_workspaceProtocol = __esm({
|
|
|
229085
229187
|
if (record3.version !== AGENT_WORKSPACE_PROTOCOL_VERSION) {
|
|
229086
229188
|
throw new Error("Unsupported agent workspace protocol version.");
|
|
229087
229189
|
}
|
|
229088
|
-
const credential =
|
|
229190
|
+
const credential = requireString3(record3.credential, "workspace credential");
|
|
229089
229191
|
if (record3.type === "shutdown") {
|
|
229090
229192
|
return { version: 1, credential, type: "shutdown" };
|
|
229091
229193
|
}
|
|
229092
|
-
const actionId =
|
|
229194
|
+
const actionId = requireString3(record3.actionId, "workspace action id", 128);
|
|
229093
229195
|
if (record3.type === "ready_ack") {
|
|
229094
229196
|
return { version: 1, credential, type: "ready_ack", actionId };
|
|
229095
229197
|
}
|
|
@@ -229112,13 +229214,13 @@ var init_workspaceProtocol = __esm({
|
|
|
229112
229214
|
if (record3.type === "shutdown_ack") {
|
|
229113
229215
|
return { version: 1, type: "shutdown_ack" };
|
|
229114
229216
|
}
|
|
229115
|
-
const actionId = record3.actionId === null ? null :
|
|
229217
|
+
const actionId = record3.actionId === null ? null : requireString3(record3.actionId, "workspace response action id", 128);
|
|
229116
229218
|
if (record3.type === "error") {
|
|
229117
229219
|
return {
|
|
229118
229220
|
version: 1,
|
|
229119
229221
|
type: "error",
|
|
229120
229222
|
actionId,
|
|
229121
|
-
message:
|
|
229223
|
+
message: requireString3(record3.message, "workspace error")
|
|
229122
229224
|
};
|
|
229123
229225
|
}
|
|
229124
229226
|
if (actionId === null) {
|
|
@@ -229129,7 +229231,7 @@ var init_workspaceProtocol = __esm({
|
|
|
229129
229231
|
version: 1,
|
|
229130
229232
|
type: "stage",
|
|
229131
229233
|
actionId,
|
|
229132
|
-
message:
|
|
229234
|
+
message: requireString3(record3.message, "workspace stage")
|
|
229133
229235
|
};
|
|
229134
229236
|
}
|
|
229135
229237
|
if (record3.type === "ready") {
|
|
@@ -229137,7 +229239,7 @@ var init_workspaceProtocol = __esm({
|
|
|
229137
229239
|
}
|
|
229138
229240
|
if (record3.type === "result") {
|
|
229139
229241
|
const outcome = requireRecord(record3.outcome, "workspace outcome");
|
|
229140
|
-
|
|
229242
|
+
requireString3(outcome.kind, "workspace outcome kind", 64);
|
|
229141
229243
|
return {
|
|
229142
229244
|
version: 1,
|
|
229143
229245
|
type: "result",
|
|
@@ -233442,25 +233544,56 @@ cat ${shellEscape3(filePath)}`
|
|
|
233442
233544
|
}
|
|
233443
233545
|
});
|
|
233444
233546
|
|
|
233445
|
-
// src/devbox/agentInit/
|
|
233446
|
-
var
|
|
233447
|
-
var
|
|
233448
|
-
"src/devbox/agentInit/
|
|
233547
|
+
// src/devbox/agentInit/progressReport.ts
|
|
233548
|
+
var resolvedProject, recordAgentInitProgressProject, readFolderProjectId, resolveAgentInitReportProject, reportAgentInitStepBestEffort;
|
|
233549
|
+
var init_progressReport = __esm({
|
|
233550
|
+
"src/devbox/agentInit/progressReport.ts"() {
|
|
233449
233551
|
"use strict";
|
|
233552
|
+
init_devboxCore();
|
|
233450
233553
|
init_controlPlane();
|
|
233451
233554
|
init_logger3();
|
|
233452
|
-
|
|
233555
|
+
resolvedProject = null;
|
|
233556
|
+
recordAgentInitProgressProject = (project) => {
|
|
233557
|
+
resolvedProject = project;
|
|
233558
|
+
};
|
|
233559
|
+
readFolderProjectId = async (folder) => {
|
|
233560
|
+
const marker = await readProjectRootMarker(folder);
|
|
233561
|
+
if (marker) {
|
|
233562
|
+
return marker.projectId;
|
|
233563
|
+
}
|
|
233564
|
+
return await readGitRootProjectId(folder);
|
|
233565
|
+
};
|
|
233566
|
+
resolveAgentInitReportProject = async (folder) => {
|
|
233567
|
+
if (resolvedProject) {
|
|
233568
|
+
return resolvedProject;
|
|
233569
|
+
}
|
|
233570
|
+
return { projectId: await readFolderProjectId(folder), alias: null };
|
|
233571
|
+
};
|
|
233572
|
+
reportAgentInitStepBestEffort = async ({
|
|
233453
233573
|
controlPlaneToken,
|
|
233454
|
-
|
|
233455
|
-
report =
|
|
233574
|
+
folder = process.cwd(),
|
|
233575
|
+
report = reportAgentInitStep,
|
|
233576
|
+
step,
|
|
233456
233577
|
warn: warn3 = (event, fields) => logger2.warn(event, fields)
|
|
233457
233578
|
}) => {
|
|
233458
233579
|
try {
|
|
233459
|
-
await
|
|
233580
|
+
const project = await resolveAgentInitReportProject(folder);
|
|
233581
|
+
await report(controlPlaneToken, {
|
|
233582
|
+
command: step.command,
|
|
233583
|
+
outcome: step.outcome,
|
|
233584
|
+
phase: step.phase,
|
|
233585
|
+
detail: step.detail ?? null,
|
|
233586
|
+
blockedSections: step.blockedSections ?? [],
|
|
233587
|
+
uploadPercent: step.uploadPercent ?? null,
|
|
233588
|
+
projectId: project.projectId,
|
|
233589
|
+
alias: project.alias,
|
|
233590
|
+
cliVersion: readCurrentPackageMetadata().version ?? null
|
|
233591
|
+
});
|
|
233460
233592
|
return true;
|
|
233461
233593
|
} catch (error55) {
|
|
233462
|
-
warn3("
|
|
233463
|
-
|
|
233594
|
+
warn3("agent_init_progress_report_failed", {
|
|
233595
|
+
command: step.command,
|
|
233596
|
+
outcome: step.outcome,
|
|
233464
233597
|
error: error55 instanceof Error ? error55.message : String(error55)
|
|
233465
233598
|
});
|
|
233466
233599
|
return false;
|
|
@@ -233469,15 +233602,6 @@ var init_handoffProgress = __esm({
|
|
|
233469
233602
|
}
|
|
233470
233603
|
});
|
|
233471
233604
|
|
|
233472
|
-
// src/devbox/agentInit/remoteSession.ts
|
|
233473
|
-
var isRemoteShellSession;
|
|
233474
|
-
var init_remoteSession = __esm({
|
|
233475
|
-
"src/devbox/agentInit/remoteSession.ts"() {
|
|
233476
|
-
"use strict";
|
|
233477
|
-
isRemoteShellSession = (env3 = process.env) => Boolean(env3["SSH_CONNECTION"] || env3["SSH_CLIENT"]);
|
|
233478
|
-
}
|
|
233479
|
-
});
|
|
233480
|
-
|
|
233481
233605
|
// ../../../../shared/initPrep/src/devboxCore.mjs
|
|
233482
233606
|
var init_devboxCore2 = __esm({
|
|
233483
233607
|
"../../../../shared/initPrep/src/devboxCore.mjs"() {
|
|
@@ -249452,6 +249576,15 @@ var init_controlPlane2 = __esm({
|
|
|
249452
249576
|
}
|
|
249453
249577
|
});
|
|
249454
249578
|
|
|
249579
|
+
// src/devbox/agentInit/remoteSession.ts
|
|
249580
|
+
var isRemoteShellSession;
|
|
249581
|
+
var init_remoteSession = __esm({
|
|
249582
|
+
"src/devbox/agentInit/remoteSession.ts"() {
|
|
249583
|
+
"use strict";
|
|
249584
|
+
isRemoteShellSession = (env3 = process.env) => Boolean(env3["SSH_CONNECTION"] || env3["SSH_CLIENT"]);
|
|
249585
|
+
}
|
|
249586
|
+
});
|
|
249587
|
+
|
|
249455
249588
|
// src/devbox/agentInit/scanRunner.ts
|
|
249456
249589
|
var EXTERNAL_SCAN_EXECUTION_PATH, createExternalScanResultsRunner;
|
|
249457
249590
|
var init_scanRunner = __esm({
|
|
@@ -249606,6 +249739,69 @@ var init_service = __esm({
|
|
|
249606
249739
|
}
|
|
249607
249740
|
});
|
|
249608
249741
|
|
|
249742
|
+
// src/devbox/agentInit/failureReport.ts
|
|
249743
|
+
var readProgressCommand, readStoredToken, reportAgentInitFailure;
|
|
249744
|
+
var init_failureReport = __esm({
|
|
249745
|
+
"src/devbox/agentInit/failureReport.ts"() {
|
|
249746
|
+
"use strict";
|
|
249747
|
+
init_devboxCore();
|
|
249748
|
+
init_auth();
|
|
249749
|
+
init_billingActivationGate();
|
|
249750
|
+
init_errors4();
|
|
249751
|
+
init_progressReport();
|
|
249752
|
+
init_service();
|
|
249753
|
+
readProgressCommand = (args) => {
|
|
249754
|
+
const [subcommand, action] = args;
|
|
249755
|
+
switch (subcommand) {
|
|
249756
|
+
case "--login-code":
|
|
249757
|
+
case "login":
|
|
249758
|
+
return { command: "login", label: subcommand };
|
|
249759
|
+
case "accounts":
|
|
249760
|
+
case "start":
|
|
249761
|
+
case "check":
|
|
249762
|
+
case "run":
|
|
249763
|
+
case "destroy":
|
|
249764
|
+
return { command: subcommand, label: subcommand };
|
|
249765
|
+
case "github":
|
|
249766
|
+
return action === "connect" ? { command: "github_connect", label: "github connect" } : null;
|
|
249767
|
+
case "git-ssh":
|
|
249768
|
+
return { command: "git_ssh", label: `git-ssh ${action ?? ""}`.trim() };
|
|
249769
|
+
default:
|
|
249770
|
+
return null;
|
|
249771
|
+
}
|
|
249772
|
+
};
|
|
249773
|
+
readStoredToken = async () => await resolveStoredControlPlaneToken(await openAgentInitSecretStore());
|
|
249774
|
+
reportAgentInitFailure = async ({
|
|
249775
|
+
args,
|
|
249776
|
+
error: error55,
|
|
249777
|
+
printError = console.error,
|
|
249778
|
+
readToken = readStoredToken,
|
|
249779
|
+
report = reportAgentInitStepBestEffort
|
|
249780
|
+
}) => {
|
|
249781
|
+
const progress = readProgressCommand(args);
|
|
249782
|
+
if (progress === null || isCommandUsageError(error55) || error55 instanceof UpgradeRequiredError || isBillingActivationRequiredError(error55)) {
|
|
249783
|
+
return;
|
|
249784
|
+
}
|
|
249785
|
+
printError(
|
|
249786
|
+
`\`dvb agent-init ${progress.label}\` failed. If the error below looks like a boxes.dev bug, report it with \`dvb report-bug --stdin\`. \`dvb agent-init guide recovery\` explains what to include.`
|
|
249787
|
+
);
|
|
249788
|
+
const token = await readToken().catch(() => null);
|
|
249789
|
+
if (token === null) {
|
|
249790
|
+
return;
|
|
249791
|
+
}
|
|
249792
|
+
await report({
|
|
249793
|
+
controlPlaneToken: token,
|
|
249794
|
+
step: {
|
|
249795
|
+
command: progress.command,
|
|
249796
|
+
outcome: "failed",
|
|
249797
|
+
phase: null,
|
|
249798
|
+
detail: error55 instanceof Error ? error55.message : String(error55)
|
|
249799
|
+
}
|
|
249800
|
+
});
|
|
249801
|
+
};
|
|
249802
|
+
}
|
|
249803
|
+
});
|
|
249804
|
+
|
|
249609
249805
|
// src/devbox/agentInit/signIn.ts
|
|
249610
249806
|
var LOGIN_CODE_REJECTION_TEXT, describeLoginCodeRejection, readViewerEmail, signInWithAgentInitLoginCode, runAgentInitLogin;
|
|
249611
249807
|
var init_signIn = __esm({
|
|
@@ -249615,7 +249811,7 @@ var init_signIn = __esm({
|
|
|
249615
249811
|
init_errors4();
|
|
249616
249812
|
init_controlPlane();
|
|
249617
249813
|
init_siteUrl();
|
|
249618
|
-
|
|
249814
|
+
init_progressReport();
|
|
249619
249815
|
init_remoteSession();
|
|
249620
249816
|
init_service();
|
|
249621
249817
|
LOGIN_CODE_REJECTION_TEXT = {
|
|
@@ -249648,9 +249844,9 @@ var init_signIn = __esm({
|
|
|
249648
249844
|
if (result.ok) {
|
|
249649
249845
|
const { token, refreshToken } = result.tokens;
|
|
249650
249846
|
await updateControlPlaneSession(store, token, refreshToken);
|
|
249651
|
-
await
|
|
249847
|
+
await reportAgentInitStepBestEffort({
|
|
249652
249848
|
controlPlaneToken: token,
|
|
249653
|
-
|
|
249849
|
+
step: { command: "login", outcome: "ok", phase: null }
|
|
249654
249850
|
});
|
|
249655
249851
|
const email5 = await readViewerEmail(token);
|
|
249656
249852
|
console.log(
|
|
@@ -249685,9 +249881,9 @@ var init_signIn = __esm({
|
|
|
249685
249881
|
const store = await openAgentInitSecretStore();
|
|
249686
249882
|
const tokens = await signInWithBrowser({}, "plain");
|
|
249687
249883
|
await updateControlPlaneSession(store, tokens.token, tokens.refreshToken);
|
|
249688
|
-
await
|
|
249884
|
+
await reportAgentInitStepBestEffort({
|
|
249689
249885
|
controlPlaneToken: tokens.token,
|
|
249690
|
-
|
|
249886
|
+
step: { command: "login", outcome: "ok", phase: null }
|
|
249691
249887
|
});
|
|
249692
249888
|
console.log("Run `dvb agent-init` to continue.");
|
|
249693
249889
|
};
|
|
@@ -249903,7 +250099,7 @@ import { createHash as createHash18, randomBytes as randomBytes14, randomUUID as
|
|
|
249903
250099
|
import http10 from "node:http";
|
|
249904
250100
|
import https3 from "node:https";
|
|
249905
250101
|
import { brotliDecompressSync, gunzipSync, inflateSync } from "node:zlib";
|
|
249906
|
-
var CLAUDE_SETUP_CALLBACK_HOST, CLAUDE_SETUP_CALLBACK_PATH, CLAUDE_SETUP_AUTOMATIC_CALLBACK_TIMEOUT_MS, CLAUDE_SETUP_REQUEST_TIMEOUT_MS, CLAUDE_SETUP_ERROR_BODY_PREVIEW_CHARS, isRecord7, asString2, getHeaderValue, collapseWhitespace, summarizeTextPreview, requireNonEmptyString,
|
|
250102
|
+
var CLAUDE_SETUP_CALLBACK_HOST, CLAUDE_SETUP_CALLBACK_PATH, CLAUDE_SETUP_AUTOMATIC_CALLBACK_TIMEOUT_MS, CLAUDE_SETUP_REQUEST_TIMEOUT_MS, CLAUDE_SETUP_ERROR_BODY_PREVIEW_CHARS, isRecord7, asString2, getHeaderValue, collapseWhitespace, summarizeTextPreview, requireNonEmptyString, requireNullableString2, requirePositiveInteger, base64UrlEncode, generateClaudeSetupCodeVerifier, generateClaudeSetupCodeChallenge, generateClaudeSetupState, buildClaudeSetupAuthorizeUrls, parseClaudeManualOauthCode, createDeferred2, startClaudeSetupCallbackServer, decodeResponseBody, buildExplicitJsonRequestHeaders, sendClaudeSetupJsonRequest, exchangeClaudeSetupOauthCode, prepareClaudeSetupAuthorizeUrls, collectClaudeSetupManualInput, launchClaudeSetupBrowserFlow, launchClaudeSetupManualCodeFlow;
|
|
249907
250103
|
var init_claudeSetupOauth = __esm({
|
|
249908
250104
|
"src/devbox/commands/claudeSetupOauth.ts"() {
|
|
249909
250105
|
"use strict";
|
|
@@ -249943,7 +250139,7 @@ var init_claudeSetupOauth = __esm({
|
|
|
249943
250139
|
}
|
|
249944
250140
|
return normalized;
|
|
249945
250141
|
};
|
|
249946
|
-
|
|
250142
|
+
requireNullableString2 = (value) => {
|
|
249947
250143
|
if (value === null || value === void 0) {
|
|
249948
250144
|
return null;
|
|
249949
250145
|
}
|
|
@@ -250301,15 +250497,15 @@ var init_claudeSetupOauth = __esm({
|
|
|
250301
250497
|
parsed.expires_in,
|
|
250302
250498
|
"expires_in"
|
|
250303
250499
|
);
|
|
250304
|
-
const scope =
|
|
250500
|
+
const scope = requireNullableString2(parsed.scope);
|
|
250305
250501
|
const account = isRecord7(parsed.account) ? parsed.account : null;
|
|
250306
250502
|
const organization = isRecord7(parsed.organization) ? parsed.organization : null;
|
|
250307
250503
|
return {
|
|
250308
250504
|
accessToken,
|
|
250309
|
-
accountUuid: account ?
|
|
250310
|
-
emailAddress: account ?
|
|
250505
|
+
accountUuid: account ? requireNullableString2(account.uuid) : null,
|
|
250506
|
+
emailAddress: account ? requireNullableString2(account.email_address) : null,
|
|
250311
250507
|
expiresInSeconds,
|
|
250312
|
-
organizationUuid: organization ?
|
|
250508
|
+
organizationUuid: organization ? requireNullableString2(organization.uuid) : null,
|
|
250313
250509
|
scope
|
|
250314
250510
|
};
|
|
250315
250511
|
};
|
|
@@ -250851,6 +251047,7 @@ var init_accounts = __esm({
|
|
|
250851
251047
|
init_accountsServer();
|
|
250852
251048
|
init_codexSignIn();
|
|
250853
251049
|
init_service();
|
|
251050
|
+
init_progressReport();
|
|
250854
251051
|
init_remoteSession();
|
|
250855
251052
|
init_auth();
|
|
250856
251053
|
init_browser();
|
|
@@ -250987,6 +251184,10 @@ var init_accounts = __esm({
|
|
|
250987
251184
|
console.log(
|
|
250988
251185
|
"When the user says they're done, run `dvb agent-init status` for the next step."
|
|
250989
251186
|
);
|
|
251187
|
+
await reportAgentInitStepBestEffort({
|
|
251188
|
+
controlPlaneToken,
|
|
251189
|
+
step: { command: "accounts", outcome: "waiting", phase: null }
|
|
251190
|
+
});
|
|
250990
251191
|
return;
|
|
250991
251192
|
}
|
|
250992
251193
|
const codexSignInAbort = new AbortController();
|
|
@@ -251026,6 +251227,10 @@ var init_accounts = __esm({
|
|
|
251026
251227
|
console.log(
|
|
251027
251228
|
"Waiting for the user to connect Codex or Claude Code and click Done. This can take several minutes."
|
|
251028
251229
|
);
|
|
251230
|
+
await reportAgentInitStepBestEffort({
|
|
251231
|
+
controlPlaneToken,
|
|
251232
|
+
step: { command: "accounts", outcome: "waiting", phase: null }
|
|
251233
|
+
});
|
|
251029
251234
|
const finishedBy = await Promise.race([
|
|
251030
251235
|
server.done.then(() => "done"),
|
|
251031
251236
|
server.idle.then(() => "idle")
|
|
@@ -251033,9 +251238,17 @@ var init_accounts = __esm({
|
|
|
251033
251238
|
codexSignInAbort.abort();
|
|
251034
251239
|
await server.close();
|
|
251035
251240
|
if (finishedBy === "idle" && !await handlers2.finishAccounts()) {
|
|
251036
|
-
|
|
251037
|
-
|
|
251038
|
-
|
|
251241
|
+
const message = "Stopped waiting after 20 minutes without activity, and no coding agent is connected yet. Run `dvb agent-init accounts` again when the user is ready.";
|
|
251242
|
+
console.log(message);
|
|
251243
|
+
await reportAgentInitStepBestEffort({
|
|
251244
|
+
controlPlaneToken,
|
|
251245
|
+
step: {
|
|
251246
|
+
command: "accounts",
|
|
251247
|
+
outcome: "failed",
|
|
251248
|
+
phase: null,
|
|
251249
|
+
detail: message
|
|
251250
|
+
}
|
|
251251
|
+
});
|
|
251039
251252
|
process.exitCode = 1;
|
|
251040
251253
|
return;
|
|
251041
251254
|
}
|
|
@@ -251043,6 +251256,10 @@ var init_accounts = __esm({
|
|
|
251043
251256
|
if (!agents) {
|
|
251044
251257
|
throw new Error("The coding agent choice was not saved.");
|
|
251045
251258
|
}
|
|
251259
|
+
await reportAgentInitStepBestEffort({
|
|
251260
|
+
controlPlaneToken,
|
|
251261
|
+
step: { command: "accounts", outcome: "ok", phase: null }
|
|
251262
|
+
});
|
|
251046
251263
|
console.log(`Connected to boxes.dev: ${describeConnectedAgents(agents)}.`);
|
|
251047
251264
|
console.log("Run `dvb agent-init status` for the next step.");
|
|
251048
251265
|
};
|
|
@@ -259957,11 +260174,16 @@ var init_commandCore = __esm({
|
|
|
259957
260174
|
init_service();
|
|
259958
260175
|
init_statePaths();
|
|
259959
260176
|
init_parse6();
|
|
260177
|
+
init_progressReport();
|
|
259960
260178
|
resolveAgentInitProject = async ({
|
|
259961
260179
|
alias = null,
|
|
260180
|
+
onSnapshot = null,
|
|
259962
260181
|
projectPath
|
|
259963
260182
|
}) => {
|
|
259964
|
-
const context34 = await createAgentInitServiceContext({
|
|
260183
|
+
const context34 = await createAgentInitServiceContext({
|
|
260184
|
+
cwd: projectPath,
|
|
260185
|
+
onSnapshot
|
|
260186
|
+
});
|
|
259965
260187
|
const preference = await fetchViewerCodingAgentPreference(
|
|
259966
260188
|
context34.controlPlaneToken
|
|
259967
260189
|
);
|
|
@@ -260013,6 +260235,10 @@ var init_commandCore = __esm({
|
|
|
260013
260235
|
throw new Error(`Project check failed: ${message}`);
|
|
260014
260236
|
}
|
|
260015
260237
|
const repo = validation.repo;
|
|
260238
|
+
recordAgentInitProgressProject({
|
|
260239
|
+
projectId: repo.projectId,
|
|
260240
|
+
alias: repo.alias
|
|
260241
|
+
});
|
|
260016
260242
|
if (selection.selectedRepoRelPaths || selection.selectedProjectRootEntryRelPaths) {
|
|
260017
260243
|
await context34.service.selectProjectLayout({ repo, ...selection });
|
|
260018
260244
|
}
|
|
@@ -261231,7 +261457,7 @@ var init_guidance = __esm({
|
|
|
261231
261457
|
});
|
|
261232
261458
|
|
|
261233
261459
|
// src/devbox/commands/agentInit/check.ts
|
|
261234
|
-
var isRecord11, buildAgentInitRegistryConflictIssue, buildAgentInitCodingAgentIssue, parseCheckArgs, buildAgentInitLaunchSummary, buildAgentInitRepoSshIssue, buildAgentInitDatabasePreflightIssues, runAgentInitCheck;
|
|
261460
|
+
var isRecord11, buildAgentInitRegistryConflictIssue, buildAgentInitCodingAgentIssue, parseCheckArgs, buildAgentInitLaunchSummary, buildAgentInitRepoSshIssue, summarizeAgentInitCheckIssues, buildAgentInitDatabasePreflightIssues, runAgentInitCheck;
|
|
261235
261461
|
var init_check2 = __esm({
|
|
261236
261462
|
"src/devbox/commands/agentInit/check.ts"() {
|
|
261237
261463
|
"use strict";
|
|
@@ -261244,7 +261470,7 @@ var init_check2 = __esm({
|
|
|
261244
261470
|
init_instanceType();
|
|
261245
261471
|
init_githubAccess();
|
|
261246
261472
|
init_codingAgents2();
|
|
261247
|
-
|
|
261473
|
+
init_progressReport();
|
|
261248
261474
|
init_sshAccess2();
|
|
261249
261475
|
init_guidance();
|
|
261250
261476
|
isRecord11 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -261436,6 +261662,16 @@ var init_check2 = __esm({
|
|
|
261436
261662
|
fix: "Run `dvb agent-init git-ssh verify`, then re-run `dvb agent-init check`."
|
|
261437
261663
|
};
|
|
261438
261664
|
};
|
|
261665
|
+
summarizeAgentInitCheckIssues = (issues) => {
|
|
261666
|
+
const errors = issues.filter((issue3) => issue3.level === "error");
|
|
261667
|
+
const first = errors[0];
|
|
261668
|
+
return {
|
|
261669
|
+
detail: first ? `${first.location}: ${first.message}` : null,
|
|
261670
|
+
blockedSections: [
|
|
261671
|
+
...new Set(errors.map((issue3) => issue3.location.split(/[.[]/u)[0] ?? ""))
|
|
261672
|
+
].filter((section) => section.length > 0)
|
|
261673
|
+
};
|
|
261674
|
+
};
|
|
261439
261675
|
buildAgentInitDatabasePreflightIssues = (result) => {
|
|
261440
261676
|
if (!isRecord11(result) || !Array.isArray(result["failures"])) {
|
|
261441
261677
|
return [
|
|
@@ -261621,12 +261857,15 @@ var init_check2 = __esm({
|
|
|
261621
261857
|
resolved.validation.project
|
|
261622
261858
|
);
|
|
261623
261859
|
summary?.push(...projectGuidance);
|
|
261624
|
-
|
|
261625
|
-
|
|
261626
|
-
|
|
261627
|
-
|
|
261628
|
-
|
|
261629
|
-
|
|
261860
|
+
await reportAgentInitStepBestEffort({
|
|
261861
|
+
controlPlaneToken: resolved.context.controlPlaneToken,
|
|
261862
|
+
step: result.ok ? { command: "check", outcome: "ok", phase: "ready_to_launch" } : {
|
|
261863
|
+
command: "check",
|
|
261864
|
+
outcome: "blocked",
|
|
261865
|
+
phase: "preparing",
|
|
261866
|
+
...summarizeAgentInitCheckIssues(result.issues)
|
|
261867
|
+
}
|
|
261868
|
+
});
|
|
261630
261869
|
if (json3) {
|
|
261631
261870
|
console.log(
|
|
261632
261871
|
JSON.stringify(
|
|
@@ -261678,16 +261917,16 @@ var init_check2 = __esm({
|
|
|
261678
261917
|
});
|
|
261679
261918
|
|
|
261680
261919
|
// src/devbox/commands/agentInit/detect.ts
|
|
261681
|
-
var DETECT_USAGE,
|
|
261920
|
+
var DETECT_USAGE, withSilencedConsole, formatBytes2, printUntrackedNode, runAgentInitDetect;
|
|
261682
261921
|
var init_detect = __esm({
|
|
261683
261922
|
"src/devbox/commands/agentInit/detect.ts"() {
|
|
261684
261923
|
"use strict";
|
|
261924
|
+
init_devboxCore();
|
|
261685
261925
|
init_initPrep();
|
|
261686
261926
|
init_args();
|
|
261687
261927
|
init_errors4();
|
|
261688
261928
|
init_commandCore();
|
|
261689
261929
|
DETECT_USAGE = "Usage: dvb agent-init detect <agent-config|agent-threads|untracked> [--project <path>] [--json] [--all (agent-threads only)]";
|
|
261690
|
-
isRecord12 = (value) => typeof value === "object" && value !== null;
|
|
261691
261930
|
withSilencedConsole = async (fn) => {
|
|
261692
261931
|
const original = { info: console.info, log: console.log };
|
|
261693
261932
|
console.info = () => {
|
|
@@ -261702,7 +261941,7 @@ var init_detect = __esm({
|
|
|
261702
261941
|
}
|
|
261703
261942
|
};
|
|
261704
261943
|
formatBytes2 = (value) => {
|
|
261705
|
-
if (
|
|
261944
|
+
if (value === null) {
|
|
261706
261945
|
return "?";
|
|
261707
261946
|
}
|
|
261708
261947
|
if (value >= 1024 * 1024 * 1024) {
|
|
@@ -261717,21 +261956,17 @@ var init_detect = __esm({
|
|
|
261717
261956
|
return `${value}B`;
|
|
261718
261957
|
};
|
|
261719
261958
|
printUntrackedNode = (node2, depth) => {
|
|
261720
|
-
if (!isRecord12(node2)) {
|
|
261721
|
-
return;
|
|
261722
|
-
}
|
|
261723
261959
|
const indent = " ".repeat(depth);
|
|
261724
|
-
const kind = node2
|
|
261725
|
-
const
|
|
261726
|
-
|
|
261727
|
-
|
|
261728
|
-
|
|
261729
|
-
|
|
261730
|
-
|
|
261731
|
-
|
|
261732
|
-
|
|
261733
|
-
|
|
261734
|
-
}
|
|
261960
|
+
const kind = node2.kind === "directory" ? "/" : "";
|
|
261961
|
+
const auto = node2.autoExclude ? " [excluded by default]" : "";
|
|
261962
|
+
console.log(
|
|
261963
|
+
`${indent}${node2.path}${kind} (${formatBytes2(node2.sizeBytes)})${auto}`
|
|
261964
|
+
);
|
|
261965
|
+
for (const child of node2.children) {
|
|
261966
|
+
printUntrackedNode(child, depth + 1);
|
|
261967
|
+
}
|
|
261968
|
+
if (node2.childrenTruncated) {
|
|
261969
|
+
console.log(`${indent} ... (more entries not shown)`);
|
|
261735
261970
|
}
|
|
261736
261971
|
};
|
|
261737
261972
|
runAgentInitDetect = async (args) => {
|
|
@@ -261821,21 +262056,22 @@ var init_detect = __esm({
|
|
|
261821
262056
|
}
|
|
261822
262057
|
if (what === "untracked") {
|
|
261823
262058
|
const { context: context34, repo } = await resolveAgentInitProject({ projectPath });
|
|
261824
|
-
const tree =
|
|
262059
|
+
const tree = normalizeDesktopInitUntrackedFileTree(
|
|
262060
|
+
await context34.service.enumerateUntrackedFileTree({ repo })
|
|
262061
|
+
);
|
|
261825
262062
|
if (json3) {
|
|
261826
262063
|
console.log(JSON.stringify(tree, null, 2));
|
|
261827
262064
|
return;
|
|
261828
262065
|
}
|
|
261829
|
-
if (
|
|
261830
|
-
|
|
262066
|
+
if (tree.totalFileCount === 0) {
|
|
262067
|
+
console.log("No untracked files.");
|
|
262068
|
+
return;
|
|
261831
262069
|
}
|
|
261832
262070
|
console.log(
|
|
261833
|
-
`Untracked files (total: ${String(tree
|
|
262071
|
+
`Untracked files (total: ${String(tree.totalFileCount)}, size: ${formatBytes2(tree.totalSizeBytes)}):`
|
|
261834
262072
|
);
|
|
261835
|
-
|
|
261836
|
-
|
|
261837
|
-
printUntrackedNode(node2, 1);
|
|
261838
|
-
}
|
|
262073
|
+
for (const node2 of tree.roots) {
|
|
262074
|
+
printUntrackedNode(node2, 1);
|
|
261839
262075
|
}
|
|
261840
262076
|
console.log("");
|
|
261841
262077
|
console.log(
|
|
@@ -261857,7 +262093,7 @@ import { constants as fsConstants3 } from "node:fs";
|
|
|
261857
262093
|
import { access as access3 } from "node:fs/promises";
|
|
261858
262094
|
import os26 from "node:os";
|
|
261859
262095
|
import path62 from "node:path";
|
|
261860
|
-
var trim12, createDesktopThreadQueryValue, DESKTOP_APP_BUNDLE_NAME, DESKTOP_APP_TARGET_PATH, resolveDesktopAppInstallPaths, pathExists7, findInstalledDesktopAppPath, buildDesktopAppWorkbenchUrl, buildDesktopAppOpenArgs, openDesktopApp;
|
|
262096
|
+
var trim12, createDesktopThreadQueryValue, DESKTOP_APP_BUNDLE_NAME, DESKTOP_APP_TARGET_PATH, resolveDesktopAppInstallPaths, pathExists7, findInstalledDesktopAppPath, setDesktopAppSelection, buildDesktopAppWorkbenchUrl, buildDesktopAppLink, buildDesktopAppOpenArgs, runOpen, openDesktopApp, openDesktopAppLink;
|
|
261861
262097
|
var init_desktopApp = __esm({
|
|
261862
262098
|
"src/devbox/commands/desktopApp.ts"() {
|
|
261863
262099
|
"use strict";
|
|
@@ -261896,11 +262132,7 @@ var init_desktopApp = __esm({
|
|
|
261896
262132
|
}
|
|
261897
262133
|
return null;
|
|
261898
262134
|
};
|
|
261899
|
-
|
|
261900
|
-
alias,
|
|
261901
|
-
clientThreadId
|
|
261902
|
-
}) => {
|
|
261903
|
-
const url3 = new URL("/desktop", resolveSiteUrl());
|
|
262135
|
+
setDesktopAppSelection = (url3, { alias, clientThreadId }) => {
|
|
261904
262136
|
url3.searchParams.set("box", trim12(alias));
|
|
261905
262137
|
const trimmedThreadId = trim12(clientThreadId ?? "");
|
|
261906
262138
|
if (trimmedThreadId) {
|
|
@@ -261911,6 +262143,8 @@ var init_desktopApp = __esm({
|
|
|
261911
262143
|
}
|
|
261912
262144
|
return url3.toString();
|
|
261913
262145
|
};
|
|
262146
|
+
buildDesktopAppWorkbenchUrl = (selection) => setDesktopAppSelection(new URL("/desktop", resolveSiteUrl()), selection);
|
|
262147
|
+
buildDesktopAppLink = (selection) => setDesktopAppSelection(new URL("boxesdesktop://desktop"), selection);
|
|
261914
262148
|
buildDesktopAppOpenArgs = ({
|
|
261915
262149
|
appPath,
|
|
261916
262150
|
startUrl
|
|
@@ -261921,38 +262155,38 @@ var init_desktopApp = __esm({
|
|
|
261921
262155
|
}
|
|
261922
262156
|
return ["-a", appPath, "--args", "--start-url", trimmedStartUrl];
|
|
261923
262157
|
};
|
|
261924
|
-
|
|
261925
|
-
appPath,
|
|
261926
|
-
startUrl,
|
|
261927
|
-
spawnImpl = spawn19
|
|
261928
|
-
}) => {
|
|
262158
|
+
runOpen = (args, spawnImpl) => {
|
|
261929
262159
|
try {
|
|
261930
|
-
const child = spawnImpl(
|
|
261931
|
-
|
|
261932
|
-
|
|
261933
|
-
|
|
261934
|
-
startUrl
|
|
261935
|
-
}),
|
|
261936
|
-
{
|
|
261937
|
-
detached: true,
|
|
261938
|
-
stdio: "ignore"
|
|
261939
|
-
}
|
|
261940
|
-
);
|
|
262160
|
+
const child = spawnImpl("open", args, {
|
|
262161
|
+
detached: true,
|
|
262162
|
+
stdio: "ignore"
|
|
262163
|
+
});
|
|
261941
262164
|
child.unref();
|
|
261942
262165
|
return true;
|
|
261943
262166
|
} catch {
|
|
261944
262167
|
return false;
|
|
261945
262168
|
}
|
|
261946
262169
|
};
|
|
262170
|
+
openDesktopApp = ({
|
|
262171
|
+
appPath,
|
|
262172
|
+
startUrl,
|
|
262173
|
+
spawnImpl = spawn19
|
|
262174
|
+
}) => runOpen(buildDesktopAppOpenArgs({ appPath, startUrl }), spawnImpl);
|
|
262175
|
+
openDesktopAppLink = ({
|
|
262176
|
+
appPath,
|
|
262177
|
+
link: link2,
|
|
262178
|
+
spawnImpl = spawn19
|
|
262179
|
+
}) => runOpen(["-a", appPath, link2], spawnImpl);
|
|
261947
262180
|
}
|
|
261948
262181
|
});
|
|
261949
262182
|
|
|
261950
262183
|
// src/devbox/agentInit/desktopHandoff.ts
|
|
261951
|
-
var resolveDesktopHandoff, detectDesktopHandoff, buildSetupThreadHandoffMessage, detectSetupThreadHandoffMessage, buildCompletedSetupOptions;
|
|
262184
|
+
var resolveDesktopHandoff, detectDesktopHandoff, buildSetupThreadHandoffMessage, detectSetupThreadHandoffMessage, buildTerminalAndMobileOptions, buildCompletedSetupOptions, readSetupThreadId, openSetupInDesktopApp, reportCompletedSetup;
|
|
261952
262185
|
var init_desktopHandoff = __esm({
|
|
261953
262186
|
"src/devbox/agentInit/desktopHandoff.ts"() {
|
|
261954
262187
|
"use strict";
|
|
261955
262188
|
init_desktopApp();
|
|
262189
|
+
init_controlPlane();
|
|
261956
262190
|
init_siteUrl();
|
|
261957
262191
|
init_remoteSession();
|
|
261958
262192
|
resolveDesktopHandoff = ({
|
|
@@ -261972,7 +262206,7 @@ var init_desktopHandoff = __esm({
|
|
|
261972
262206
|
const started = "The setup thread has started on the Template box, and this command will keep running.";
|
|
261973
262207
|
switch (handoff) {
|
|
261974
262208
|
case "open_mac_app":
|
|
261975
|
-
return `${started} Offer to open it in the boxes.dev Mac app. If the user agrees, run \`dvb agent-init open-desktop
|
|
262209
|
+
return `${started} Offer to open it in the boxes.dev Mac app. If the user agrees, run \`dvb agent-init open-desktop\`. When setup finishes, this command will open the app on the setup thread.`;
|
|
261976
262210
|
case "download_mac_app":
|
|
261977
262211
|
return `${started} Tell the user they can follow it in the boxes.dev Mac app and give them the download link: ${siteUrl}/mac`;
|
|
261978
262212
|
case "mobile_app":
|
|
@@ -261983,41 +262217,109 @@ var init_desktopHandoff = __esm({
|
|
|
261983
262217
|
await detectDesktopHandoff(),
|
|
261984
262218
|
resolveSiteUrl()
|
|
261985
262219
|
);
|
|
262220
|
+
buildTerminalAndMobileOptions = ({
|
|
262221
|
+
alias,
|
|
262222
|
+
siteUrl
|
|
262223
|
+
}) => [
|
|
262224
|
+
`work with its coding agents from a terminal: \`dvb agents ${alias}\` (add \`--workspace\` to keep the thread list beside the open agent; this needs tmux 3.3 or newer)`,
|
|
262225
|
+
`use it from the boxes.dev mobile app: ${siteUrl}/m`
|
|
262226
|
+
];
|
|
261986
262227
|
buildCompletedSetupOptions = ({
|
|
261987
262228
|
alias,
|
|
261988
262229
|
handoff,
|
|
261989
262230
|
siteUrl
|
|
261990
262231
|
}) => {
|
|
261991
|
-
const
|
|
261992
|
-
const mobile = `use it from the boxes.dev mobile app: ${siteUrl}/m`;
|
|
262232
|
+
const otherOptions = buildTerminalAndMobileOptions({ alias, siteUrl });
|
|
261993
262233
|
switch (handoff) {
|
|
261994
262234
|
case "open_mac_app":
|
|
261995
262235
|
return [
|
|
261996
262236
|
"open it in the boxes.dev Mac app (run `dvb agent-init open-desktop`)",
|
|
261997
|
-
|
|
261998
|
-
mobile
|
|
262237
|
+
...otherOptions
|
|
261999
262238
|
];
|
|
262000
262239
|
case "download_mac_app":
|
|
262001
262240
|
return [
|
|
262002
262241
|
`open it in the boxes.dev Mac app, which they can download from ${siteUrl}/mac`,
|
|
262003
|
-
|
|
262004
|
-
mobile
|
|
262242
|
+
...otherOptions
|
|
262005
262243
|
];
|
|
262006
262244
|
case "mobile_app":
|
|
262007
|
-
return
|
|
262245
|
+
return otherOptions;
|
|
262246
|
+
}
|
|
262247
|
+
};
|
|
262248
|
+
readSetupThreadId = (job) => typeof job?.["setupThreadId"] === "string" && job["setupThreadId"] !== "" ? job["setupThreadId"] : null;
|
|
262249
|
+
openSetupInDesktopApp = async ({
|
|
262250
|
+
appPath,
|
|
262251
|
+
context: context34,
|
|
262252
|
+
repo,
|
|
262253
|
+
setupThreadId
|
|
262254
|
+
}) => {
|
|
262255
|
+
const clientThreadId = setupThreadId === null ? null : await upsertRemoteInitCodexThread(
|
|
262256
|
+
await context34.getControlPlaneToken(),
|
|
262257
|
+
repo.alias,
|
|
262258
|
+
setupThreadId
|
|
262259
|
+
);
|
|
262260
|
+
const link2 = buildDesktopAppLink({ alias: repo.alias, clientThreadId });
|
|
262261
|
+
if (!openDesktopAppLink({ appPath, link: link2 })) {
|
|
262262
|
+
throw new Error(
|
|
262263
|
+
`Couldn't open the boxes.dev Mac app. Ask the user to open it from ${appPath}.`
|
|
262264
|
+
);
|
|
262265
|
+
}
|
|
262266
|
+
console.log(
|
|
262267
|
+
setupThreadId === null ? `Opened the boxes.dev Mac app on ${repo.alias}.` : `Opened the boxes.dev Mac app on the setup thread for ${repo.alias}.`
|
|
262268
|
+
);
|
|
262269
|
+
};
|
|
262270
|
+
reportCompletedSetup = async ({
|
|
262271
|
+
context: context34,
|
|
262272
|
+
job,
|
|
262273
|
+
repo
|
|
262274
|
+
}) => {
|
|
262275
|
+
console.log("");
|
|
262276
|
+
console.log(`Template box setup is complete: ${repo.alias}`);
|
|
262277
|
+
console.log("");
|
|
262278
|
+
const siteUrl = resolveSiteUrl();
|
|
262279
|
+
const appPath = await findInstalledDesktopAppPath();
|
|
262280
|
+
const handoff = resolveDesktopHandoff({
|
|
262281
|
+
installedAppPath: appPath,
|
|
262282
|
+
platform: process.platform,
|
|
262283
|
+
remote: isRemoteShellSession()
|
|
262284
|
+
});
|
|
262285
|
+
if (handoff === "open_mac_app" && appPath !== null) {
|
|
262286
|
+
await openSetupInDesktopApp({
|
|
262287
|
+
appPath,
|
|
262288
|
+
context: context34,
|
|
262289
|
+
repo,
|
|
262290
|
+
setupThreadId: readSetupThreadId(job)
|
|
262291
|
+
});
|
|
262292
|
+
console.log(
|
|
262293
|
+
"Tell the user their Template box is ready and the setup thread is open in the boxes.dev Mac app. They can also:"
|
|
262294
|
+
);
|
|
262295
|
+
for (const option of buildTerminalAndMobileOptions({
|
|
262296
|
+
alias: repo.alias,
|
|
262297
|
+
siteUrl
|
|
262298
|
+
})) {
|
|
262299
|
+
console.log(` - ${option}`);
|
|
262300
|
+
}
|
|
262301
|
+
return;
|
|
262302
|
+
}
|
|
262303
|
+
console.log("Tell the user their Template box is ready. They can:");
|
|
262304
|
+
for (const option of buildCompletedSetupOptions({
|
|
262305
|
+
alias: repo.alias,
|
|
262306
|
+
handoff,
|
|
262307
|
+
siteUrl
|
|
262308
|
+
})) {
|
|
262309
|
+
console.log(` - ${option}`);
|
|
262008
262310
|
}
|
|
262009
262311
|
};
|
|
262010
262312
|
}
|
|
262011
262313
|
});
|
|
262012
262314
|
|
|
262013
262315
|
// src/devbox/agentInit/jobLoop.ts
|
|
262014
|
-
var
|
|
262316
|
+
var isRecord12, sleep6, NO_ACTIVE_JOB_MESSAGE, resolveActiveJobId, requireActiveJobId, readJobError, fetchJobProgress, runJobLoopUntilTerminal;
|
|
262015
262317
|
var init_jobLoop = __esm({
|
|
262016
262318
|
"src/devbox/agentInit/jobLoop.ts"() {
|
|
262017
262319
|
"use strict";
|
|
262018
262320
|
init_controlPlane();
|
|
262019
262321
|
init_desktopHandoff();
|
|
262020
|
-
|
|
262322
|
+
isRecord12 = (value) => typeof value === "object" && value !== null;
|
|
262021
262323
|
sleep6 = async (ms) => await new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
262022
262324
|
NO_ACTIVE_JOB_MESSAGE = "No active setup job was found for this project. Run `dvb agent-init run` to start one.";
|
|
262023
262325
|
resolveActiveJobId = async ({
|
|
@@ -262039,7 +262341,7 @@ var init_jobLoop = __esm({
|
|
|
262039
262341
|
};
|
|
262040
262342
|
readJobError = (job) => {
|
|
262041
262343
|
const error55 = job["error"] ?? job["latestError"];
|
|
262042
|
-
if (
|
|
262344
|
+
if (isRecord12(error55)) {
|
|
262043
262345
|
const message = error55["userMessage"] ?? error55["message"];
|
|
262044
262346
|
return typeof message === "string" ? message : null;
|
|
262045
262347
|
}
|
|
@@ -262061,7 +262363,7 @@ var init_jobLoop = __esm({
|
|
|
262061
262363
|
projectId: repo.projectId
|
|
262062
262364
|
}
|
|
262063
262365
|
);
|
|
262064
|
-
return
|
|
262366
|
+
return isRecord12(progress) ? progress : null;
|
|
262065
262367
|
};
|
|
262066
262368
|
runJobLoopUntilTerminal = async ({
|
|
262067
262369
|
context: context34,
|
|
@@ -262078,7 +262380,7 @@ var init_jobLoop = __esm({
|
|
|
262078
262380
|
let lastProvisionEventCount = 0;
|
|
262079
262381
|
for (; ; ) {
|
|
262080
262382
|
const progress = await fetchJobProgress({ context: context34, jobId, repo });
|
|
262081
|
-
const job = progress &&
|
|
262383
|
+
const job = progress && isRecord12(progress["job"]) ? progress["job"] : null;
|
|
262082
262384
|
if (!job) {
|
|
262083
262385
|
throw new Error(NO_ACTIVE_JOB_MESSAGE);
|
|
262084
262386
|
}
|
|
@@ -262088,7 +262390,7 @@ var init_jobLoop = __esm({
|
|
|
262088
262390
|
const provisionEvents = progress?.["provisionEvents"];
|
|
262089
262391
|
if (Array.isArray(provisionEvents)) {
|
|
262090
262392
|
for (const event of provisionEvents.slice(lastProvisionEventCount)) {
|
|
262091
|
-
if (
|
|
262393
|
+
if (isRecord12(event) && typeof event["message"] === "string") {
|
|
262092
262394
|
emit({ stage: "remote", message: event["message"] });
|
|
262093
262395
|
}
|
|
262094
262396
|
}
|
|
@@ -262098,7 +262400,7 @@ var init_jobLoop = __esm({
|
|
|
262098
262400
|
emit({ stage: "remote", message: `Setup phase: ${phase}` });
|
|
262099
262401
|
lastAnnouncedPhase = phase;
|
|
262100
262402
|
}
|
|
262101
|
-
if (phase === "awaiting_decrypt_key_envelope" &&
|
|
262403
|
+
if (phase === "awaiting_decrypt_key_envelope" && isRecord12(job["remoteDecryptPublicKey"]) && activeJobId && sentEnvelopeForJob !== activeJobId) {
|
|
262102
262404
|
emit({
|
|
262103
262405
|
stage: "remote",
|
|
262104
262406
|
message: "Sending the bundle decrypt key to the Template box."
|
|
@@ -262110,8 +262412,8 @@ var init_jobLoop = __esm({
|
|
|
262110
262412
|
sentEnvelopeForJob = activeJobId;
|
|
262111
262413
|
}
|
|
262112
262414
|
const uploadManifest = job["uploadManifest"];
|
|
262113
|
-
const encryption =
|
|
262114
|
-
if (
|
|
262415
|
+
const encryption = isRecord12(uploadManifest) ? uploadManifest["encryption"] : null;
|
|
262416
|
+
if (isRecord12(encryption) && encryption["keyEnvelopeStatus"] === "extracted" && activeJobId && cleanedExtractionForJob !== activeJobId) {
|
|
262115
262417
|
emit({
|
|
262116
262418
|
stage: "remote",
|
|
262117
262419
|
message: "Template box extracted the bundle; cleaning local staging."
|
|
@@ -262148,7 +262450,7 @@ var init_jobLoop = __esm({
|
|
|
262148
262450
|
});
|
|
262149
262451
|
|
|
262150
262452
|
// src/devbox/commands/agentInit/diagnostics.ts
|
|
262151
|
-
var
|
|
262453
|
+
var isRecord13, REDACTED_SNAPSHOT_KEYS, redact, runAgentInitDiagnostics;
|
|
262152
262454
|
var init_diagnostics = __esm({
|
|
262153
262455
|
"src/devbox/commands/agentInit/diagnostics.ts"() {
|
|
262154
262456
|
"use strict";
|
|
@@ -262158,7 +262460,7 @@ var init_diagnostics = __esm({
|
|
|
262158
262460
|
init_jobLoop();
|
|
262159
262461
|
init_parse6();
|
|
262160
262462
|
init_check();
|
|
262161
|
-
|
|
262463
|
+
isRecord13 = (value) => typeof value === "object" && value !== null;
|
|
262162
262464
|
REDACTED_SNAPSHOT_KEYS = /* @__PURE__ */ new Set([
|
|
262163
262465
|
"accessToken",
|
|
262164
262466
|
"accessTokenCiphertextBase64",
|
|
@@ -262176,7 +262478,7 @@ var init_diagnostics = __esm({
|
|
|
262176
262478
|
if (Array.isArray(value)) {
|
|
262177
262479
|
return value.map((entry, index) => redact(entry, `${keyPath}[${index}]`));
|
|
262178
262480
|
}
|
|
262179
|
-
if (
|
|
262481
|
+
if (isRecord13(value)) {
|
|
262180
262482
|
const out = {};
|
|
262181
262483
|
for (const [key, child] of Object.entries(value)) {
|
|
262182
262484
|
if (REDACTED_SNAPSHOT_KEYS.has(key)) {
|
|
@@ -262236,7 +262538,7 @@ var init_diagnostics = __esm({
|
|
|
262236
262538
|
});
|
|
262237
262539
|
|
|
262238
262540
|
// src/devbox/commands/agentInit/gitSsh.ts
|
|
262239
|
-
var GIT_SSH_USAGE,
|
|
262541
|
+
var GIT_SSH_USAGE, isRecord14, isGitSshVerified, renderGitSshState, printSshState, setupAndPrecheckGitSsh, runAgentInitGitSsh;
|
|
262240
262542
|
var init_gitSsh = __esm({
|
|
262241
262543
|
"src/devbox/commands/agentInit/gitSsh.ts"() {
|
|
262242
262544
|
"use strict";
|
|
@@ -262245,17 +262547,18 @@ var init_gitSsh = __esm({
|
|
|
262245
262547
|
init_commandCore();
|
|
262246
262548
|
init_parse6();
|
|
262247
262549
|
init_githubAccess();
|
|
262550
|
+
init_progressReport();
|
|
262248
262551
|
init_sshAccess2();
|
|
262249
262552
|
GIT_SSH_USAGE = "Usage: dvb agent-init git-ssh <setup|verify> [--project <path>] [--convert-origin]";
|
|
262250
|
-
|
|
262553
|
+
isRecord14 = (value) => typeof value === "object" && value !== null;
|
|
262251
262554
|
isGitSshVerified = (snapshot) => {
|
|
262252
262555
|
const setup = snapshot["repoSshSetup"];
|
|
262253
|
-
return
|
|
262556
|
+
return isRecord14(setup) && setup["localVerificationStatus"] === "verified";
|
|
262254
262557
|
};
|
|
262255
262558
|
renderGitSshState = (snapshot) => {
|
|
262256
262559
|
const setup = snapshot["repoSshSetup"];
|
|
262257
262560
|
const publicKey = snapshot["repoSshPublicKey"];
|
|
262258
|
-
if (!
|
|
262561
|
+
if (!isRecord14(setup)) {
|
|
262259
262562
|
return ["No Git SSH setup is recorded yet."];
|
|
262260
262563
|
}
|
|
262261
262564
|
const lines = [`Git SSH status: ${String(setup["status"])}`];
|
|
@@ -262264,7 +262567,7 @@ var init_gitSsh = __esm({
|
|
|
262264
262567
|
}
|
|
262265
262568
|
if (Array.isArray(setup["targets"])) {
|
|
262266
262569
|
for (const target of setup["targets"]) {
|
|
262267
|
-
if (
|
|
262570
|
+
if (isRecord14(target))
|
|
262268
262571
|
lines.push(
|
|
262269
262572
|
`Repository: ${String(target["relPath"])} (${String(target["host"])})`
|
|
262270
262573
|
);
|
|
@@ -262275,7 +262578,7 @@ var init_gitSsh = __esm({
|
|
|
262275
262578
|
`Local verification: ${String(setup["localVerificationStatus"])}`
|
|
262276
262579
|
);
|
|
262277
262580
|
}
|
|
262278
|
-
if (
|
|
262581
|
+
if (isRecord14(snapshot["latestError"]) && typeof snapshot["latestError"]["message"] === "string") {
|
|
262279
262582
|
lines.push(snapshot["latestError"]["message"]);
|
|
262280
262583
|
}
|
|
262281
262584
|
if (setup["localVerificationStatus"] !== "verified" && typeof publicKey === "string" && publicKey) {
|
|
@@ -262310,7 +262613,7 @@ var init_gitSsh = __esm({
|
|
|
262310
262613
|
precheck: true,
|
|
262311
262614
|
repo
|
|
262312
262615
|
});
|
|
262313
|
-
if (!
|
|
262616
|
+
if (!isRecord14(snapshot)) {
|
|
262314
262617
|
throw new Error("Git SSH setup returned an invalid state.");
|
|
262315
262618
|
}
|
|
262316
262619
|
return snapshot;
|
|
@@ -262361,12 +262664,21 @@ var init_gitSsh = __esm({
|
|
|
262361
262664
|
repositories
|
|
262362
262665
|
});
|
|
262363
262666
|
printSshState(snapshot);
|
|
262364
|
-
|
|
262667
|
+
const verified = isGitSshVerified(snapshot);
|
|
262668
|
+
if (verified) {
|
|
262365
262669
|
console.log("");
|
|
262366
262670
|
console.log(
|
|
262367
262671
|
"Git SSH access is already verified; no user action is needed."
|
|
262368
262672
|
);
|
|
262369
262673
|
}
|
|
262674
|
+
await reportAgentInitStepBestEffort({
|
|
262675
|
+
controlPlaneToken: context34.controlPlaneToken,
|
|
262676
|
+
step: {
|
|
262677
|
+
command: "git_ssh",
|
|
262678
|
+
outcome: verified ? "ok" : "waiting",
|
|
262679
|
+
phase: null
|
|
262680
|
+
}
|
|
262681
|
+
});
|
|
262370
262682
|
return;
|
|
262371
262683
|
}
|
|
262372
262684
|
await context34.service.setRepoSshSetup({ repo, repositories, enabled: true });
|
|
@@ -262374,12 +262686,16 @@ var init_gitSsh = __esm({
|
|
|
262374
262686
|
precheck: false,
|
|
262375
262687
|
repo
|
|
262376
262688
|
});
|
|
262377
|
-
if (
|
|
262689
|
+
if (isRecord14(result)) {
|
|
262378
262690
|
printSshState(result);
|
|
262379
262691
|
const setup = result["repoSshSetup"];
|
|
262380
|
-
if (
|
|
262692
|
+
if (isRecord14(setup) && setup["localVerificationStatus"] === "verified") {
|
|
262381
262693
|
console.log("");
|
|
262382
262694
|
console.log("Git SSH access verified.");
|
|
262695
|
+
await reportAgentInitStepBestEffort({
|
|
262696
|
+
controlPlaneToken: context34.controlPlaneToken,
|
|
262697
|
+
step: { command: "git_ssh", outcome: "ok", phase: null }
|
|
262698
|
+
});
|
|
262383
262699
|
return;
|
|
262384
262700
|
}
|
|
262385
262701
|
}
|
|
@@ -262397,6 +262713,7 @@ var init_github = __esm({
|
|
|
262397
262713
|
"use strict";
|
|
262398
262714
|
init_commandCore();
|
|
262399
262715
|
init_githubAccess();
|
|
262716
|
+
init_progressReport();
|
|
262400
262717
|
init_service();
|
|
262401
262718
|
init_browser();
|
|
262402
262719
|
init_errors4();
|
|
@@ -262438,7 +262755,7 @@ var init_github = __esm({
|
|
|
262438
262755
|
});
|
|
262439
262756
|
return;
|
|
262440
262757
|
}
|
|
262441
|
-
await connectAgentInitGithub({
|
|
262758
|
+
const outcome = await connectAgentInitGithub({
|
|
262442
262759
|
client: context34.controlPlaneClient,
|
|
262443
262760
|
loadProjectLayoutRepos: async () => {
|
|
262444
262761
|
const { repo, validation } = await resolveAgentInitProject({
|
|
@@ -262447,6 +262764,12 @@ var init_github = __esm({
|
|
|
262447
262764
|
return readAgentInitProjectLayoutRepos({ repo, validation });
|
|
262448
262765
|
}
|
|
262449
262766
|
});
|
|
262767
|
+
if (outcome !== null) {
|
|
262768
|
+
await reportAgentInitStepBestEffort({
|
|
262769
|
+
controlPlaneToken: context34.controlPlaneToken,
|
|
262770
|
+
step: { command: "github_connect", outcome, phase: null }
|
|
262771
|
+
});
|
|
262772
|
+
}
|
|
262450
262773
|
};
|
|
262451
262774
|
isGithubConnectionReady = (connectionResult) => {
|
|
262452
262775
|
if (!connectionResult || typeof connectionResult !== "object") return false;
|
|
@@ -262474,7 +262797,7 @@ var init_github = __esm({
|
|
|
262474
262797
|
const connectionResult = await client.getGithubConnection({});
|
|
262475
262798
|
if (!isGithubConnectionReady(connectionResult)) {
|
|
262476
262799
|
await startAgentInitGithubConnection({ client, openBrowserFn, print });
|
|
262477
|
-
return;
|
|
262800
|
+
return "waiting";
|
|
262478
262801
|
}
|
|
262479
262802
|
const resolution = resolveAgentInitManagedGithubAccess({
|
|
262480
262803
|
connectionResult,
|
|
@@ -262485,12 +262808,12 @@ var init_github = __esm({
|
|
|
262485
262808
|
print(
|
|
262486
262809
|
`GitHub is connected and boxes.dev can access ${resolution.repositories.length === 1 ? "this project's repository" : `all ${resolution.repositories.length} of this project's repositories`}. Re-run \`dvb agent-init check\`.`
|
|
262487
262810
|
);
|
|
262488
|
-
return;
|
|
262811
|
+
return "ok";
|
|
262489
262812
|
}
|
|
262490
262813
|
if (!("missingAccess" in resolution)) {
|
|
262491
262814
|
print(resolution.issue.message);
|
|
262492
262815
|
print(resolution.issue.fix);
|
|
262493
|
-
return;
|
|
262816
|
+
return null;
|
|
262494
262817
|
}
|
|
262495
262818
|
const page = resolveAgentInitGithubAccessPage(resolution.missingAccess);
|
|
262496
262819
|
const repositories = resolution.missingAccess.repositoryFullNames.join(", ");
|
|
@@ -262510,14 +262833,14 @@ var init_github = __esm({
|
|
|
262510
262833
|
print(
|
|
262511
262834
|
`${repositories} belongs to @${page.ownerLogin}'s personal account. Ask @${page.ownerLogin} to give boxes.dev access to it on GitHub, or use \`githubAccess: ssh\`.`
|
|
262512
262835
|
);
|
|
262513
|
-
return;
|
|
262836
|
+
return null;
|
|
262514
262837
|
}
|
|
262515
262838
|
url3 = target?.ok ? target.installUrl : resolution.missingAccess.appInstallationUrl;
|
|
262516
262839
|
instruction = target?.ok && target.accountType === "user" ? `Give boxes.dev access to ${repositories} on GitHub: keep "All repositories" selected, or choose repositories that include them. Then re-run \`dvb agent-init check\`.` : `Give boxes.dev access to ${repositories} on GitHub: choose @${page.ownerLogin}, then keep "All repositories" selected or choose repositories that include them. If @${page.ownerLogin} requires an owner's approval, GitHub will send your request to an organization owner. If @${page.ownerLogin} isn't listed, ask an owner of @${page.ownerLogin} to give boxes.dev access. Then re-run \`dvb agent-init check\`.`;
|
|
262517
262840
|
}
|
|
262518
262841
|
if (url3 === null) {
|
|
262519
262842
|
print(instruction);
|
|
262520
|
-
return;
|
|
262843
|
+
return null;
|
|
262521
262844
|
}
|
|
262522
262845
|
if (openBrowserFn(url3)) {
|
|
262523
262846
|
print("GitHub opened in your browser.");
|
|
@@ -262526,6 +262849,7 @@ var init_github = __esm({
|
|
|
262526
262849
|
print(url3);
|
|
262527
262850
|
}
|
|
262528
262851
|
print(instruction);
|
|
262852
|
+
return "waiting";
|
|
262529
262853
|
};
|
|
262530
262854
|
manageAgentInitGithubCliAccess = async ({
|
|
262531
262855
|
client,
|
|
@@ -262703,18 +263027,18 @@ var init_guide = __esm({
|
|
|
262703
263027
|
});
|
|
262704
263028
|
|
|
262705
263029
|
// src/devbox/commands/agentInit/openDesktop.ts
|
|
262706
|
-
var
|
|
263030
|
+
var isRecord15, parseOpenDesktopArgs, runAgentInitOpenDesktop;
|
|
262707
263031
|
var init_openDesktop = __esm({
|
|
262708
263032
|
"src/devbox/commands/agentInit/openDesktop.ts"() {
|
|
262709
263033
|
"use strict";
|
|
262710
263034
|
init_args();
|
|
262711
263035
|
init_errors4();
|
|
262712
263036
|
init_commandCore();
|
|
263037
|
+
init_desktopHandoff();
|
|
262713
263038
|
init_jobLoop();
|
|
262714
|
-
init_controlPlane();
|
|
262715
263039
|
init_siteUrl();
|
|
262716
263040
|
init_desktopApp();
|
|
262717
|
-
|
|
263041
|
+
isRecord15 = (value) => typeof value === "object" && value !== null;
|
|
262718
263042
|
parseOpenDesktopArgs = (args) => {
|
|
262719
263043
|
const { flags, positionals } = parseCommandArgs({
|
|
262720
263044
|
args,
|
|
@@ -262746,32 +263070,20 @@ var init_openDesktop = __esm({
|
|
|
262746
263070
|
}
|
|
262747
263071
|
const { context: context34, repo } = await resolveAgentInitProject({ projectPath });
|
|
262748
263072
|
const progress = await fetchJobProgress({ context: context34, jobId: null, repo });
|
|
262749
|
-
const job = progress &&
|
|
262750
|
-
|
|
262751
|
-
|
|
262752
|
-
context34
|
|
262753
|
-
repo
|
|
262754
|
-
setupThreadId
|
|
262755
|
-
);
|
|
262756
|
-
const startUrl = buildDesktopAppWorkbenchUrl({
|
|
262757
|
-
alias: repo.alias,
|
|
262758
|
-
clientThreadId
|
|
263073
|
+
const job = progress && isRecord15(progress["job"]) ? progress["job"] : null;
|
|
263074
|
+
await openSetupInDesktopApp({
|
|
263075
|
+
appPath,
|
|
263076
|
+
context: context34,
|
|
263077
|
+
repo,
|
|
263078
|
+
setupThreadId: readSetupThreadId(job)
|
|
262759
263079
|
});
|
|
262760
|
-
if (!openDesktopApp({ appPath, startUrl })) {
|
|
262761
|
-
throw new Error(
|
|
262762
|
-
`Couldn't open the boxes.dev Mac app. Ask the user to open it from ${appPath}.`
|
|
262763
|
-
);
|
|
262764
|
-
}
|
|
262765
|
-
console.log(
|
|
262766
|
-
setupThreadId === null ? `Opened the boxes.dev Mac app on ${repo.alias}.` : `Opened the boxes.dev Mac app on the setup thread for ${repo.alias}.`
|
|
262767
|
-
);
|
|
262768
263080
|
};
|
|
262769
263081
|
}
|
|
262770
263082
|
});
|
|
262771
263083
|
|
|
262772
263084
|
// src/devbox/commands/agentInit/recover.ts
|
|
262773
263085
|
import fs51 from "node:fs/promises";
|
|
262774
|
-
var
|
|
263086
|
+
var isRecord16, runAgentInitRetry, runAgentInitDestroy;
|
|
262775
263087
|
var init_recover = __esm({
|
|
262776
263088
|
"src/devbox/commands/agentInit/recover.ts"() {
|
|
262777
263089
|
"use strict";
|
|
@@ -262779,7 +263091,9 @@ var init_recover = __esm({
|
|
|
262779
263091
|
init_errors4();
|
|
262780
263092
|
init_commandCore();
|
|
262781
263093
|
init_jobLoop();
|
|
262782
|
-
|
|
263094
|
+
init_progressReport();
|
|
263095
|
+
init_desktopHandoff();
|
|
263096
|
+
isRecord16 = (value) => typeof value === "object" && value !== null;
|
|
262783
263097
|
runAgentInitRetry = async (args) => {
|
|
262784
263098
|
const { flags, positionals } = parseCommandArgs({
|
|
262785
263099
|
args,
|
|
@@ -262797,7 +263111,7 @@ var init_recover = __esm({
|
|
|
262797
263111
|
const projectPath = resolveProjectPathFlag(flags);
|
|
262798
263112
|
const { context: context34, repo } = await resolveAgentInitProject({ projectPath });
|
|
262799
263113
|
const progress = await fetchJobProgress({ context: context34, jobId: null, repo });
|
|
262800
|
-
const job = progress &&
|
|
263114
|
+
const job = progress && isRecord16(progress["job"]) ? progress["job"] : null;
|
|
262801
263115
|
if (!job || typeof job["jobId"] !== "string") {
|
|
262802
263116
|
throw new Error(
|
|
262803
263117
|
"No setup job found to retry. Run `dvb agent-init status` for the current state."
|
|
@@ -262816,7 +263130,7 @@ var init_recover = __esm({
|
|
|
262816
263130
|
repo
|
|
262817
263131
|
});
|
|
262818
263132
|
if (outcome.kind === "complete") {
|
|
262819
|
-
|
|
263133
|
+
await reportCompletedSetup({ context: context34, job: outcome.job, repo });
|
|
262820
263134
|
return;
|
|
262821
263135
|
}
|
|
262822
263136
|
if (outcome.kind === "failed_recoverable") {
|
|
@@ -262872,6 +263186,10 @@ var init_recover = __esm({
|
|
|
262872
263186
|
} else {
|
|
262873
263187
|
console.log("Done. No manifest was present.");
|
|
262874
263188
|
}
|
|
263189
|
+
await reportAgentInitStepBestEffort({
|
|
263190
|
+
controlPlaneToken: context34.controlPlaneToken,
|
|
263191
|
+
step: { command: "destroy", outcome: "ok", phase: "preparing" }
|
|
263192
|
+
});
|
|
262875
263193
|
console.log(
|
|
262876
263194
|
"Re-run `dvb agent-init check` and `dvb agent-init run` to start over."
|
|
262877
263195
|
);
|
|
@@ -262882,7 +263200,7 @@ var init_recover = __esm({
|
|
|
262882
263200
|
// src/devbox/agentInit/driver.ts
|
|
262883
263201
|
import os27 from "node:os";
|
|
262884
263202
|
import path64 from "node:path";
|
|
262885
|
-
var readSnapshotRepoSshVerificationStatus,
|
|
263203
|
+
var readSnapshotRepoSshVerificationStatus, isRecord17, readSnapshotUploadStatus, readSnapshotBackendJob, readReviewState, resolveManifestForkStartupScriptRequest, approveAgentInitSetupReview, applyManifestToLocalPrep;
|
|
262886
263204
|
var init_driver = __esm({
|
|
262887
263205
|
"src/devbox/agentInit/driver.ts"() {
|
|
262888
263206
|
"use strict";
|
|
@@ -262901,21 +263219,21 @@ var init_driver = __esm({
|
|
|
262901
263219
|
const status = repoSshSetup.localVerificationStatus;
|
|
262902
263220
|
return typeof status === "string" ? status : null;
|
|
262903
263221
|
};
|
|
262904
|
-
|
|
263222
|
+
isRecord17 = (value) => typeof value === "object" && value !== null;
|
|
262905
263223
|
readSnapshotUploadStatus = (snapshot) => {
|
|
262906
263224
|
const upload = snapshot["upload"];
|
|
262907
|
-
if (
|
|
263225
|
+
if (isRecord17(upload) && typeof upload["status"] === "string") {
|
|
262908
263226
|
return upload["status"];
|
|
262909
263227
|
}
|
|
262910
263228
|
return null;
|
|
262911
263229
|
};
|
|
262912
263230
|
readSnapshotBackendJob = (snapshot) => {
|
|
262913
263231
|
const job = snapshot["backendJob"];
|
|
262914
|
-
return
|
|
263232
|
+
return isRecord17(job) ? job : null;
|
|
262915
263233
|
};
|
|
262916
263234
|
readReviewState = (snapshot) => {
|
|
262917
263235
|
const reviewState = snapshot["setupReviewState"];
|
|
262918
|
-
if (!
|
|
263236
|
+
if (!isRecord17(reviewState)) {
|
|
262919
263237
|
throw new Error(
|
|
262920
263238
|
"Setup review state is missing after applying manifest results."
|
|
262921
263239
|
);
|
|
@@ -262997,7 +263315,7 @@ var init_driver = __esm({
|
|
|
262997
263315
|
stage: "apply",
|
|
262998
263316
|
message: `Recording Git signing choice (${compiled.gitSigning.mode}).`
|
|
262999
263317
|
});
|
|
263000
|
-
if (compiled.githubAccess === "managed" && !
|
|
263318
|
+
if (compiled.githubAccess === "managed" && !isRecord17(repoSshSnapshot["managedGithubAccess"])) {
|
|
263001
263319
|
throw new Error(
|
|
263002
263320
|
"Automatic GitHub access is not ready. Re-run `dvb agent-init check`, then retry."
|
|
263003
263321
|
);
|
|
@@ -263020,8 +263338,8 @@ var init_driver = __esm({
|
|
|
263020
263338
|
const includeSet = new Set(compiled.agentConfigInclude);
|
|
263021
263339
|
const agentConfigItems = (() => {
|
|
263022
263340
|
const agentConfig = scanSnapshot["agentConfig"];
|
|
263023
|
-
if (
|
|
263024
|
-
return agentConfig["items"].filter(
|
|
263341
|
+
if (isRecord17(agentConfig) && Array.isArray(agentConfig["items"])) {
|
|
263342
|
+
return agentConfig["items"].filter(isRecord17);
|
|
263025
263343
|
}
|
|
263026
263344
|
return [];
|
|
263027
263345
|
})();
|
|
@@ -263110,7 +263428,7 @@ var init_driver = __esm({
|
|
|
263110
263428
|
untrackedExclusions
|
|
263111
263429
|
});
|
|
263112
263430
|
const bundleError = bundleSnapshot["latestError"];
|
|
263113
|
-
if (
|
|
263431
|
+
if (isRecord17(bundleError) && typeof bundleError["message"] === "string") {
|
|
263114
263432
|
throw new Error(`Bundle preparation failed: ${bundleError["message"]}`);
|
|
263115
263433
|
}
|
|
263116
263434
|
return { approvedReviewState, snapshot: bundleSnapshot };
|
|
@@ -263121,14 +263439,14 @@ var init_driver = __esm({
|
|
|
263121
263439
|
// src/devbox/agentInit/preparedBundleState.ts
|
|
263122
263440
|
import fs52 from "node:fs/promises";
|
|
263123
263441
|
import path65 from "node:path";
|
|
263124
|
-
var PREPARED_BUNDLE_STATE_VERSION,
|
|
263442
|
+
var PREPARED_BUNDLE_STATE_VERSION, isRecord18, readSnapshotPreparedBundleStagingRoot, readAgentInitPreparedBundleState, writeAgentInitPreparedBundleState, removeAgentInitPreparedBundleState, findReusableAgentInitPreparedBundle, prepareOrReuseAgentInitBundle;
|
|
263125
263443
|
var init_preparedBundleState = __esm({
|
|
263126
263444
|
"src/devbox/agentInit/preparedBundleState.ts"() {
|
|
263127
263445
|
"use strict";
|
|
263128
263446
|
PREPARED_BUNDLE_STATE_VERSION = 1;
|
|
263129
|
-
|
|
263447
|
+
isRecord18 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
263130
263448
|
readSnapshotPreparedBundleStagingRoot = (snapshot) => {
|
|
263131
|
-
if (!
|
|
263449
|
+
if (!isRecord18(snapshot) || !isRecord18(snapshot["bundle"])) {
|
|
263132
263450
|
return null;
|
|
263133
263451
|
}
|
|
263134
263452
|
const stagingRoot = snapshot["bundle"]["stagingRoot"];
|
|
@@ -263137,12 +263455,12 @@ var init_preparedBundleState = __esm({
|
|
|
263137
263455
|
readAgentInitPreparedBundleState = async (statePath) => {
|
|
263138
263456
|
try {
|
|
263139
263457
|
const parsed = JSON.parse(await fs52.readFile(statePath, "utf8"));
|
|
263140
|
-
if (
|
|
263458
|
+
if (isRecord18(parsed) && parsed["version"] === PREPARED_BUNDLE_STATE_VERSION && typeof parsed["manifestHash"] === "string" && typeof parsed["preparedAt"] === "string" && typeof parsed["stagingRoot"] === "string" && path65.isAbsolute(parsed["stagingRoot"])) {
|
|
263141
263459
|
return parsed;
|
|
263142
263460
|
}
|
|
263143
263461
|
return null;
|
|
263144
263462
|
} catch (error55) {
|
|
263145
|
-
if (
|
|
263463
|
+
if (isRecord18(error55) && (error55["code"] === "ENOENT" || error55 instanceof SyntaxError)) {
|
|
263146
263464
|
return null;
|
|
263147
263465
|
}
|
|
263148
263466
|
throw error55;
|
|
@@ -263260,6 +263578,59 @@ var init_runInstanceType = __esm({
|
|
|
263260
263578
|
}
|
|
263261
263579
|
});
|
|
263262
263580
|
|
|
263581
|
+
// src/devbox/agentInit/uploadProgress.ts
|
|
263582
|
+
var UPLOAD_PROGRESS_STEP_PERCENT, createAgentInitUploadProgress;
|
|
263583
|
+
var init_uploadProgress = __esm({
|
|
263584
|
+
"src/devbox/agentInit/uploadProgress.ts"() {
|
|
263585
|
+
"use strict";
|
|
263586
|
+
UPLOAD_PROGRESS_STEP_PERCENT = 10;
|
|
263587
|
+
createAgentInitUploadProgress = ({
|
|
263588
|
+
print,
|
|
263589
|
+
report
|
|
263590
|
+
}) => {
|
|
263591
|
+
let lastStep = 0;
|
|
263592
|
+
let inFlight = null;
|
|
263593
|
+
let waiting = null;
|
|
263594
|
+
const send = (percent) => {
|
|
263595
|
+
inFlight = report(percent).then(() => {
|
|
263596
|
+
inFlight = null;
|
|
263597
|
+
if (waiting !== null) {
|
|
263598
|
+
const next = waiting;
|
|
263599
|
+
waiting = null;
|
|
263600
|
+
send(next);
|
|
263601
|
+
}
|
|
263602
|
+
});
|
|
263603
|
+
};
|
|
263604
|
+
return {
|
|
263605
|
+
onSnapshot: (snapshot) => {
|
|
263606
|
+
const percent = snapshot["progressPercent"];
|
|
263607
|
+
if (snapshot.phase !== "uploading_bundle" || typeof percent !== "number") {
|
|
263608
|
+
return;
|
|
263609
|
+
}
|
|
263610
|
+
const step = Math.floor(percent / UPLOAD_PROGRESS_STEP_PERCENT);
|
|
263611
|
+
if (step <= lastStep) {
|
|
263612
|
+
return;
|
|
263613
|
+
}
|
|
263614
|
+
lastStep = step;
|
|
263615
|
+
const stepPercent = Math.min(100, step * UPLOAD_PROGRESS_STEP_PERCENT);
|
|
263616
|
+
print(stepPercent);
|
|
263617
|
+
if (inFlight) {
|
|
263618
|
+
waiting = stepPercent;
|
|
263619
|
+
return;
|
|
263620
|
+
}
|
|
263621
|
+
send(stepPercent);
|
|
263622
|
+
},
|
|
263623
|
+
// Waits for the last report so it lands before the job takes over.
|
|
263624
|
+
flush: async () => {
|
|
263625
|
+
while (inFlight) {
|
|
263626
|
+
await inFlight;
|
|
263627
|
+
}
|
|
263628
|
+
}
|
|
263629
|
+
};
|
|
263630
|
+
};
|
|
263631
|
+
}
|
|
263632
|
+
});
|
|
263633
|
+
|
|
263263
263634
|
// src/devbox/commands/agentInit/run.ts
|
|
263264
263635
|
var parseRunArgs, emitLine, withSilencedConsole2, runAgentInitRun;
|
|
263265
263636
|
var init_run = __esm({
|
|
@@ -263271,7 +263642,6 @@ var init_run = __esm({
|
|
|
263271
263642
|
init_driver();
|
|
263272
263643
|
init_desktopHandoff();
|
|
263273
263644
|
init_jobLoop();
|
|
263274
|
-
init_siteUrl();
|
|
263275
263645
|
init_check();
|
|
263276
263646
|
init_compile();
|
|
263277
263647
|
init_githubAccess();
|
|
@@ -263279,7 +263649,8 @@ var init_run = __esm({
|
|
|
263279
263649
|
init_controlPlane();
|
|
263280
263650
|
init_instanceType();
|
|
263281
263651
|
init_runInstanceType();
|
|
263282
|
-
|
|
263652
|
+
init_progressReport();
|
|
263653
|
+
init_uploadProgress();
|
|
263283
263654
|
parseRunArgs = (args) => {
|
|
263284
263655
|
const { flags, positionals } = parseCommandArgs({
|
|
263285
263656
|
args,
|
|
@@ -263317,8 +263688,30 @@ var init_run = __esm({
|
|
|
263317
263688
|
};
|
|
263318
263689
|
runAgentInitRun = async (args) => {
|
|
263319
263690
|
const { projectPath } = parseRunArgs(args);
|
|
263320
|
-
|
|
263691
|
+
let reportContext = null;
|
|
263692
|
+
const uploadProgress = createAgentInitUploadProgress({
|
|
263693
|
+
print: (percent) => emitLine({ stage: "upload", message: `${String(percent)}% uploaded.` }),
|
|
263694
|
+
report: async (percent) => {
|
|
263695
|
+
if (!reportContext) {
|
|
263696
|
+
return;
|
|
263697
|
+
}
|
|
263698
|
+
await reportAgentInitStepBestEffort({
|
|
263699
|
+
controlPlaneToken: await reportContext.getControlPlaneToken(),
|
|
263700
|
+
step: {
|
|
263701
|
+
command: "run",
|
|
263702
|
+
outcome: "ok",
|
|
263703
|
+
phase: "launching",
|
|
263704
|
+
uploadPercent: percent
|
|
263705
|
+
}
|
|
263706
|
+
});
|
|
263707
|
+
}
|
|
263708
|
+
});
|
|
263709
|
+
const resolved = await resolveAgentInitProject({
|
|
263710
|
+
onSnapshot: uploadProgress.onSnapshot,
|
|
263711
|
+
projectPath
|
|
263712
|
+
});
|
|
263321
263713
|
const { context: context34, repo, selectedAgents, statePaths } = resolved;
|
|
263714
|
+
reportContext = context34;
|
|
263322
263715
|
const manifestText = await readManifestTextIfPresent(statePaths.manifestPath);
|
|
263323
263716
|
if (manifestText === null) {
|
|
263324
263717
|
throw new Error(
|
|
@@ -263367,9 +263760,9 @@ var init_run = __esm({
|
|
|
263367
263760
|
"The manifest project name was not the alias validated for this run. Re-run `dvb agent-init check` before launching."
|
|
263368
263761
|
);
|
|
263369
263762
|
}
|
|
263370
|
-
await
|
|
263763
|
+
await reportAgentInitStepBestEffort({
|
|
263371
263764
|
controlPlaneToken: context34.controlPlaneToken,
|
|
263372
|
-
phase: "launching"
|
|
263765
|
+
step: { command: "run", outcome: "ok", phase: "launching" }
|
|
263373
263766
|
});
|
|
263374
263767
|
emitLine({ stage: "local", message: "Initializing local setup state." });
|
|
263375
263768
|
const existingSnapshot = await context34.service.getSnapshot({
|
|
@@ -263472,6 +263865,7 @@ ${JSON.stringify(compiled.initialProjectConfiguration)}`
|
|
|
263472
263865
|
message: "Upload committed. Remote provisioning is starting."
|
|
263473
263866
|
});
|
|
263474
263867
|
}
|
|
263868
|
+
await uploadProgress.flush();
|
|
263475
263869
|
const outcome = await runJobLoopUntilTerminal({
|
|
263476
263870
|
context: context34,
|
|
263477
263871
|
emit: emitLine,
|
|
@@ -263479,17 +263873,7 @@ ${JSON.stringify(compiled.initialProjectConfiguration)}`
|
|
|
263479
263873
|
repo
|
|
263480
263874
|
});
|
|
263481
263875
|
if (outcome.kind === "complete") {
|
|
263482
|
-
|
|
263483
|
-
console.log(`Template box setup is complete: ${repo.alias}`);
|
|
263484
|
-
console.log("");
|
|
263485
|
-
console.log("Tell the user their Template box is ready. They can:");
|
|
263486
|
-
for (const option of buildCompletedSetupOptions({
|
|
263487
|
-
alias: repo.alias,
|
|
263488
|
-
handoff: await detectDesktopHandoff(),
|
|
263489
|
-
siteUrl: resolveSiteUrl()
|
|
263490
|
-
})) {
|
|
263491
|
-
console.log(` - ${option}`);
|
|
263492
|
-
}
|
|
263876
|
+
await reportCompletedSetup({ context: context34, job: outcome.job, repo });
|
|
263493
263877
|
return;
|
|
263494
263878
|
}
|
|
263495
263879
|
if (outcome.kind === "failed_recoverable") {
|
|
@@ -263804,8 +264188,9 @@ var init_start = __esm({
|
|
|
263804
264188
|
init_commandCore();
|
|
263805
264189
|
init_statePaths();
|
|
263806
264190
|
init_seed();
|
|
264191
|
+
init_check();
|
|
263807
264192
|
init_githubAccess();
|
|
263808
|
-
|
|
264193
|
+
init_progressReport();
|
|
263809
264194
|
init_guidance();
|
|
263810
264195
|
parseStartArgs = (args) => {
|
|
263811
264196
|
const { flags, positionals } = parseCommandArgs({
|
|
@@ -263949,9 +264334,18 @@ var init_start = __esm({
|
|
|
263949
264334
|
});
|
|
263950
264335
|
manifestSeeded = true;
|
|
263951
264336
|
}
|
|
263952
|
-
await
|
|
264337
|
+
const [manifestText, checkState] = await Promise.all([
|
|
264338
|
+
readManifestTextIfPresent(statePaths.manifestPath),
|
|
264339
|
+
readCheckState(statePaths.checkStatePath)
|
|
264340
|
+
]);
|
|
264341
|
+
const checkStillPasses = manifestText !== null && checkState?.ok === true && checkState.manifestHash === hashManifestText(manifestText);
|
|
264342
|
+
await reportAgentInitStepBestEffort({
|
|
263953
264343
|
controlPlaneToken: context34.controlPlaneToken,
|
|
263954
|
-
|
|
264344
|
+
step: {
|
|
264345
|
+
command: "start",
|
|
264346
|
+
outcome: "ok",
|
|
264347
|
+
phase: checkStillPasses ? "ready_to_launch" : "preparing"
|
|
264348
|
+
}
|
|
263955
264349
|
});
|
|
263956
264350
|
if (json3) {
|
|
263957
264351
|
console.log(
|
|
@@ -263999,7 +264393,7 @@ var init_start = __esm({
|
|
|
263999
264393
|
});
|
|
264000
264394
|
|
|
264001
264395
|
// src/devbox/commands/agentInit/status.ts
|
|
264002
|
-
var
|
|
264396
|
+
var isRecord19, buildAgentInitStatus, parseStatusArgs, runAgentInitStatus, runAgentInitWatch;
|
|
264003
264397
|
var init_status = __esm({
|
|
264004
264398
|
"src/devbox/commands/agentInit/status.ts"() {
|
|
264005
264399
|
"use strict";
|
|
@@ -264013,7 +264407,7 @@ var init_status = __esm({
|
|
|
264013
264407
|
init_check();
|
|
264014
264408
|
init_parse6();
|
|
264015
264409
|
init_guidance();
|
|
264016
|
-
|
|
264410
|
+
isRecord19 = (value) => typeof value === "object" && value !== null;
|
|
264017
264411
|
buildAgentInitStatus = async ({
|
|
264018
264412
|
projectPath
|
|
264019
264413
|
}) => {
|
|
@@ -264027,7 +264421,7 @@ var init_status = __esm({
|
|
|
264027
264421
|
const githubAccessMode = parsedManifest?.ok && parsedManifest.manifest.version !== 1 && parsedManifest.manifest.githubAccess !== null ? parsedManifest.manifest.githubAccess : null;
|
|
264028
264422
|
const localPrep = await context34.service.getSnapshot({ repo, selectedAgents });
|
|
264029
264423
|
const signingPublicKeys = readSigningPublicKeys(localPrep);
|
|
264030
|
-
const managedGithubAccess =
|
|
264424
|
+
const managedGithubAccess = isRecord19(localPrep) && isRecord19(localPrep["managedGithubAccess"]) ? localPrep["managedGithubAccess"] : null;
|
|
264031
264425
|
const managedRepositories = managedGithubAccess?.["repositories"];
|
|
264032
264426
|
const githubAccess = githubAccessMode ? {
|
|
264033
264427
|
mode: githubAccessMode,
|
|
@@ -264036,7 +264430,7 @@ var init_status = __esm({
|
|
|
264036
264430
|
let job = null;
|
|
264037
264431
|
try {
|
|
264038
264432
|
const progress = await fetchJobProgress({ context: context34, jobId: null, repo });
|
|
264039
|
-
job = progress &&
|
|
264433
|
+
job = progress && isRecord19(progress["job"]) ? progress["job"] : null;
|
|
264040
264434
|
} catch {
|
|
264041
264435
|
job = null;
|
|
264042
264436
|
}
|
|
@@ -264046,8 +264440,8 @@ var init_status = __esm({
|
|
|
264046
264440
|
const jobPhase = job && typeof job["phase"] === "string" ? job["phase"] : null;
|
|
264047
264441
|
const jobStatus = job && typeof job["status"] === "string" ? job["status"] : null;
|
|
264048
264442
|
const remotePreflight = validation["remotePreflight"];
|
|
264049
|
-
const registryProject =
|
|
264050
|
-
const registrySetupComplete =
|
|
264443
|
+
const registryProject = isRecord19(remotePreflight) ? remotePreflight["project"] : null;
|
|
264444
|
+
const registrySetupComplete = isRecord19(registryProject) && registryProject["initStatus"] === "complete" && (registryProject["projectFingerprint"] === repo.fingerprint || registryProject["projectFingerprint"] === null) || isRecord19(remotePreflight) && remotePreflight["jobPhase"] === "complete";
|
|
264051
264445
|
let phase;
|
|
264052
264446
|
let nextAction;
|
|
264053
264447
|
if (jobPhase === "complete" || job === null && registrySetupComplete) {
|
|
@@ -264083,7 +264477,7 @@ var init_status = __esm({
|
|
|
264083
264477
|
phase = "ready_to_run";
|
|
264084
264478
|
nextAction = "Check passed. With the user's explicit approval, launch with `dvb agent-init run`.";
|
|
264085
264479
|
}
|
|
264086
|
-
if (phase === "ready_to_run" &&
|
|
264480
|
+
if (phase === "ready_to_run" && isRecord19(localPrep) && localPrep["phase"] === "packaging_bundle") {
|
|
264087
264481
|
phase = "packaging_bundle";
|
|
264088
264482
|
}
|
|
264089
264483
|
return {
|
|
@@ -264154,7 +264548,7 @@ var init_status = __esm({
|
|
|
264154
264548
|
repo
|
|
264155
264549
|
});
|
|
264156
264550
|
if (outcome.kind === "complete") {
|
|
264157
|
-
|
|
264551
|
+
await reportCompletedSetup({ context: context34, job: outcome.job, repo });
|
|
264158
264552
|
return;
|
|
264159
264553
|
}
|
|
264160
264554
|
if (outcome.kind === "failed_recoverable") {
|
|
@@ -264168,12 +264562,13 @@ var init_status = __esm({
|
|
|
264168
264562
|
});
|
|
264169
264563
|
|
|
264170
264564
|
// src/devbox/commands/agentInit/index.ts
|
|
264171
|
-
var AGENT_INIT_USAGE, runAgentInitEntry, runAgentInit;
|
|
264565
|
+
var AGENT_INIT_USAGE, runAgentInitEntry, runAgentInit, dispatchAgentInit;
|
|
264172
264566
|
var init_agentInit = __esm({
|
|
264173
264567
|
"src/devbox/commands/agentInit/index.ts"() {
|
|
264174
264568
|
"use strict";
|
|
264175
264569
|
init_args();
|
|
264176
264570
|
init_errors4();
|
|
264571
|
+
init_failureReport();
|
|
264177
264572
|
init_signIn();
|
|
264178
264573
|
init_accounts();
|
|
264179
264574
|
init_check2();
|
|
@@ -264241,6 +264636,14 @@ var init_agentInit = __esm({
|
|
|
264241
264636
|
}
|
|
264242
264637
|
};
|
|
264243
264638
|
runAgentInit = async (args) => {
|
|
264639
|
+
try {
|
|
264640
|
+
await dispatchAgentInit(args);
|
|
264641
|
+
} catch (error55) {
|
|
264642
|
+
await reportAgentInitFailure({ args, error: error55 });
|
|
264643
|
+
throw error55;
|
|
264644
|
+
}
|
|
264645
|
+
};
|
|
264646
|
+
dispatchAgentInit = async (args) => {
|
|
264244
264647
|
const [subcommand, ...rest] = args;
|
|
264245
264648
|
if (!subcommand || subcommand.startsWith("--")) {
|
|
264246
264649
|
await runAgentInitEntry(args);
|
|
@@ -266078,18 +266481,18 @@ var init_dist11 = __esm({
|
|
|
266078
266481
|
});
|
|
266079
266482
|
|
|
266080
266483
|
// src/devbox/commands/init/codex/config.ts
|
|
266081
|
-
var DEVBOX_PROXY_PROVIDER_ID,
|
|
266484
|
+
var DEVBOX_PROXY_PROVIDER_ID, isRecord20, parseExistingConfig, normalizeTrustedPaths, normalizeRelayBaseUrl, ensureNoticeConfig, ensureTrustedProjects, ensureProxyProviderConfig, removeProxyProviderConfig, mergeCodexInitConfig;
|
|
266082
266485
|
var init_config2 = __esm({
|
|
266083
266486
|
"src/devbox/commands/init/codex/config.ts"() {
|
|
266084
266487
|
"use strict";
|
|
266085
266488
|
init_dist11();
|
|
266086
266489
|
DEVBOX_PROXY_PROVIDER_ID = "devbox-proxy";
|
|
266087
|
-
|
|
266490
|
+
isRecord20 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
266088
266491
|
parseExistingConfig = (content) => {
|
|
266089
266492
|
if (!content) return {};
|
|
266090
266493
|
try {
|
|
266091
266494
|
const parsed = parse7(content);
|
|
266092
|
-
return
|
|
266495
|
+
return isRecord20(parsed) ? { ...parsed } : {};
|
|
266093
266496
|
} catch {
|
|
266094
266497
|
return {};
|
|
266095
266498
|
}
|
|
@@ -266099,14 +266502,14 @@ var init_config2 = __esm({
|
|
|
266099
266502
|
];
|
|
266100
266503
|
normalizeRelayBaseUrl = (value) => value.trim().replace(/\/+$/, "");
|
|
266101
266504
|
ensureNoticeConfig = (config5) => {
|
|
266102
|
-
const notice =
|
|
266505
|
+
const notice = isRecord20(config5.notice) ? { ...config5.notice } : {};
|
|
266103
266506
|
notice.hide_full_access_warning = true;
|
|
266104
266507
|
config5.notice = notice;
|
|
266105
266508
|
};
|
|
266106
266509
|
ensureTrustedProjects = (config5, trustedPaths) => {
|
|
266107
|
-
const projects =
|
|
266510
|
+
const projects = isRecord20(config5.projects) ? { ...config5.projects } : {};
|
|
266108
266511
|
for (const trustedPath of normalizeTrustedPaths(trustedPaths)) {
|
|
266109
|
-
const existingProject =
|
|
266512
|
+
const existingProject = isRecord20(projects[trustedPath]) ? { ...projects[trustedPath] } : {};
|
|
266110
266513
|
existingProject.trust_level = "trusted";
|
|
266111
266514
|
projects[trustedPath] = existingProject;
|
|
266112
266515
|
}
|
|
@@ -266118,7 +266521,7 @@ var init_config2 = __esm({
|
|
|
266118
266521
|
throw new Error("Relay base URL is required for Codex proxy mode.");
|
|
266119
266522
|
}
|
|
266120
266523
|
config5.model_provider = DEVBOX_PROXY_PROVIDER_ID;
|
|
266121
|
-
const modelProviders =
|
|
266524
|
+
const modelProviders = isRecord20(config5.model_providers) ? { ...config5.model_providers } : {};
|
|
266122
266525
|
modelProviders[DEVBOX_PROXY_PROVIDER_ID] = {
|
|
266123
266526
|
name: "boxes.dev Proxy",
|
|
266124
266527
|
base_url: `${normalizedBase}/v1`,
|
|
@@ -266131,7 +266534,7 @@ var init_config2 = __esm({
|
|
|
266131
266534
|
if (config5.model_provider === DEVBOX_PROXY_PROVIDER_ID) {
|
|
266132
266535
|
delete config5.model_provider;
|
|
266133
266536
|
}
|
|
266134
|
-
if (!
|
|
266537
|
+
if (!isRecord20(config5.model_providers)) {
|
|
266135
266538
|
return;
|
|
266136
266539
|
}
|
|
266137
266540
|
const modelProviders = { ...config5.model_providers };
|
|
@@ -271107,7 +271510,7 @@ var init_artifacts = __esm({
|
|
|
271107
271510
|
import path75 from "node:path";
|
|
271108
271511
|
import { randomUUID as randomUUID30 } from "node:crypto";
|
|
271109
271512
|
import fs61 from "node:fs/promises";
|
|
271110
|
-
var CODEX_REQUEST_URL_REGEX2, CODEX_STREAM_DISCONNECT_DETAIL_REGEX, CODEX_SESSION_ID_REGEX, REMOTE_RELAY_FORBIDDEN_REGEX, REMOTE_RELAY_MISSING_OPENAI_CONFIG_REGEX, REMOTE_CODEX_AUTH_STRONG_SUBSTRINGS, REMOTE_CODEX_AUTH_AMBIGUOUS_SUBSTRINGS, REMOTE_CODEX_STALE_RESUME_SUBSTRINGS, CODEX_APPLY_ARTIFACT_GRACE_MS, CODEX_APPLY_FINAL_RECOVERY_GRACE_MS, CODEX_APPLY_ARTIFACT_POLL_INTERVAL_MS, CODEX_AUTH_PROBE_TIMEOUT_MS, CODEX_AUTH_PROBE_PROMPT, CODEX_AUTH_PROBE_REASONING_EFFORT, MANAGED_REMOTE_INIT_PROXY_SESSION_KEY, buildRemoteDatabaseDumpPromptPaths, extractRequestUrl2, extractStreamDisconnectDetail, extractCodexSessionId, stripAnsi3, splitNonEmptyOutputLines, summarizeCodexOutputDetail, summarizeCodexFailureDetail, isRelayForbidden2, isRelayMissingOpenAiProxyConfiguration2, isResponsesRequestUrl, lineLooksLikeRemoteCodexAuthFailure, isRemoteCodexAuthFailure, buildRemoteCodexAuthProbeScript, buildRemoteCodexAuthProbeUnexpectedFailureReason, classifyRemoteCodexAuthProbeOutput, probeRemoteCodexAuth, formatCodexRetryProgress2, ManagedCodexControlRequestError, ManagedCodexSetupStateError, isRemoteCodexStaleResumeFailure, classifyRemoteCodexSetupFailure, isLoopbackRelayUrl2, readLocalCodexAuthCache, readRemoteUtf8FileIfExists, trimRemoteTextValue, readRemoteSetupTodoSummary, readRemoteCodexLastMessage, resolveRemoteCodexCompletionMessage, readRemoteCodexCompletionArtifacts, waitForRemoteCodexCompletionArtifacts, hasRemoteExecSession, writeCanonicalSetupTodo, recoverRemoteCodexCompletionArtifacts,
|
|
271513
|
+
var CODEX_REQUEST_URL_REGEX2, CODEX_STREAM_DISCONNECT_DETAIL_REGEX, CODEX_SESSION_ID_REGEX, REMOTE_RELAY_FORBIDDEN_REGEX, REMOTE_RELAY_MISSING_OPENAI_CONFIG_REGEX, REMOTE_CODEX_AUTH_STRONG_SUBSTRINGS, REMOTE_CODEX_AUTH_AMBIGUOUS_SUBSTRINGS, REMOTE_CODEX_STALE_RESUME_SUBSTRINGS, CODEX_APPLY_ARTIFACT_GRACE_MS, CODEX_APPLY_FINAL_RECOVERY_GRACE_MS, CODEX_APPLY_ARTIFACT_POLL_INTERVAL_MS, CODEX_AUTH_PROBE_TIMEOUT_MS, CODEX_AUTH_PROBE_PROMPT, CODEX_AUTH_PROBE_REASONING_EFFORT, MANAGED_REMOTE_INIT_PROXY_SESSION_KEY, buildRemoteDatabaseDumpPromptPaths, extractRequestUrl2, extractStreamDisconnectDetail, extractCodexSessionId, stripAnsi3, splitNonEmptyOutputLines, summarizeCodexOutputDetail, summarizeCodexFailureDetail, isRelayForbidden2, isRelayMissingOpenAiProxyConfiguration2, isResponsesRequestUrl, lineLooksLikeRemoteCodexAuthFailure, isRemoteCodexAuthFailure, buildRemoteCodexAuthProbeScript, buildRemoteCodexAuthProbeUnexpectedFailureReason, classifyRemoteCodexAuthProbeOutput, probeRemoteCodexAuth, formatCodexRetryProgress2, ManagedCodexControlRequestError, ManagedCodexSetupStateError, isRemoteCodexStaleResumeFailure, classifyRemoteCodexSetupFailure, isLoopbackRelayUrl2, readLocalCodexAuthCache, readRemoteUtf8FileIfExists, trimRemoteTextValue, readRemoteSetupTodoSummary, readRemoteCodexLastMessage, resolveRemoteCodexCompletionMessage, readRemoteCodexCompletionArtifacts, waitForRemoteCodexCompletionArtifacts, hasRemoteExecSession, writeCanonicalSetupTodo, recoverRemoteCodexCompletionArtifacts, isRecord21, readNonEmptyString8, readFiniteNumber, readManagedCodexTurnInterruptOrigin, parseManagedCodexThreadState, waitForCanonicalRemoteSetupSummary, hasManagedCodexActiveTurn, classifyManagedCodexSetupTerminalState, buildManagedCodexSetupInterruptedMessage, throwIfManagedCodexSetupPausedByInterruption, buildManagedCodexSetupResumePrompt, normalizeStatusPreview, findLastNonEmptyString, extractManagedCodexProgressMessage, extractManagedCodexLastAssistantMessage, buildManagedCodexMissingCompletionDetail, classifyManagedCodexSetupError, runManagedCodexControlRequest, prepareManagedRemoteCodexProxySession, runManagedDaemonRemoteCodexSetup, syncLocalCodexAuthCacheToSprite, syncRemoteCodexAuthToManagedLocalCache, defaultRemoteCodexLoginDeps, defaultRemoteCodexHandoffAuthDeps, ensureRemoteCodexLoginForManagedSetup, ensureRemoteCodexAuthForInitHandoff, uploadSetupPlan, runRemoteCodexSetup;
|
|
271111
271514
|
var init_codex2 = __esm({
|
|
271112
271515
|
"src/devbox/commands/init/codex/index.ts"() {
|
|
271113
271516
|
"use strict";
|
|
@@ -271719,16 +272122,16 @@ ${execResult.stderr}`;
|
|
|
271719
272122
|
});
|
|
271720
272123
|
return artifacts.completionMessage;
|
|
271721
272124
|
};
|
|
271722
|
-
|
|
272125
|
+
isRecord21 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
271723
272126
|
readNonEmptyString8 = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
271724
272127
|
readFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
271725
272128
|
readManagedCodexTurnInterruptOrigin = (value) => value === "user_stop" || value === "queued_follow_up_send_now" || value === "system_runtime_recovery" || value === "unknown" ? value : null;
|
|
271726
272129
|
parseManagedCodexThreadState = (response, requestType) => {
|
|
271727
|
-
const payload =
|
|
271728
|
-
const threadRecord = payload &&
|
|
272130
|
+
const payload = isRecord21(response.result) ? response.result : null;
|
|
272131
|
+
const threadRecord = payload && isRecord21(payload.thread) ? payload.thread : null;
|
|
271729
272132
|
const threadId2 = readNonEmptyString8(threadRecord?.id);
|
|
271730
272133
|
const updatedAt = readFiniteNumber(threadRecord?.updatedAt);
|
|
271731
|
-
const statusRecord = threadRecord &&
|
|
272134
|
+
const statusRecord = threadRecord && isRecord21(threadRecord.status) ? threadRecord.status : null;
|
|
271732
272135
|
const statusType = statusRecord?.type;
|
|
271733
272136
|
const activeFlags = statusRecord?.type === "active" && Array.isArray(statusRecord.activeFlags) ? statusRecord.activeFlags.filter(
|
|
271734
272137
|
(flag2) => flag2 === "waitingOnApproval" || flag2 === "waitingOnUserInput"
|
|
@@ -271736,7 +272139,7 @@ ${execResult.stderr}`;
|
|
|
271736
272139
|
const rawTurns = Array.isArray(threadRecord?.turns) ? threadRecord.turns : [];
|
|
271737
272140
|
const turns = [];
|
|
271738
272141
|
for (const value of rawTurns) {
|
|
271739
|
-
if (!
|
|
272142
|
+
if (!isRecord21(value)) {
|
|
271740
272143
|
throw new Error(
|
|
271741
272144
|
`Managed Codex ${requestType} returned an invalid turn payload.`
|
|
271742
272145
|
);
|
|
@@ -271751,7 +272154,7 @@ ${execResult.stderr}`;
|
|
|
271751
272154
|
}
|
|
271752
272155
|
const items = [];
|
|
271753
272156
|
for (const itemValue of rawItems) {
|
|
271754
|
-
if (!
|
|
272157
|
+
if (!isRecord21(itemValue)) {
|
|
271755
272158
|
throw new Error(
|
|
271756
272159
|
`Managed Codex ${requestType} returned an invalid thread item payload.`
|
|
271757
272160
|
);
|
|
@@ -278125,7 +278528,7 @@ ${sshResult.stderr}`.trim();
|
|
|
278125
278528
|
});
|
|
278126
278529
|
|
|
278127
278530
|
// src/devbox/commands/servicesToml.ts
|
|
278128
|
-
var splitShellCommand, normalizeSectionName,
|
|
278531
|
+
var splitShellCommand, normalizeSectionName, isRecord22, asString3, asStringArray, asNumber, parseServicesToml, formatSectionName, renderServiceBlock, mergeServicesToml;
|
|
278129
278532
|
var init_servicesToml = __esm({
|
|
278130
278533
|
"src/devbox/commands/servicesToml.ts"() {
|
|
278131
278534
|
"use strict";
|
|
@@ -278181,7 +278584,7 @@ var init_servicesToml = __esm({
|
|
|
278181
278584
|
}
|
|
278182
278585
|
return trimmed;
|
|
278183
278586
|
};
|
|
278184
|
-
|
|
278587
|
+
isRecord22 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
278185
278588
|
asString3 = (value) => typeof value === "string" ? value : null;
|
|
278186
278589
|
asStringArray = (value) => {
|
|
278187
278590
|
if (!Array.isArray(value)) return null;
|
|
@@ -278205,14 +278608,14 @@ var init_servicesToml = __esm({
|
|
|
278205
278608
|
};
|
|
278206
278609
|
parseServicesToml = (content) => {
|
|
278207
278610
|
const parsed = parse7(content);
|
|
278208
|
-
if (!
|
|
278611
|
+
if (!isRecord22(parsed)) return {};
|
|
278209
278612
|
const servicesRoot = parsed.services;
|
|
278210
|
-
if (!
|
|
278613
|
+
if (!isRecord22(servicesRoot)) return {};
|
|
278211
278614
|
const services = {};
|
|
278212
278615
|
for (const [rawName, value] of Object.entries(servicesRoot)) {
|
|
278213
278616
|
const name = String(rawName);
|
|
278214
278617
|
if (!name) continue;
|
|
278215
|
-
if (!
|
|
278618
|
+
if (!isRecord22(value)) continue;
|
|
278216
278619
|
const entry = { name };
|
|
278217
278620
|
const cmd = asString3(value.cmd);
|
|
278218
278621
|
if (cmd) entry.cmd = cmd;
|
|
@@ -280363,7 +280766,7 @@ var init_setup = __esm({
|
|
|
280363
280766
|
init_args();
|
|
280364
280767
|
init_errors4();
|
|
280365
280768
|
init_controlPlane();
|
|
280366
|
-
|
|
280769
|
+
init_progressReport();
|
|
280367
280770
|
init_daemonClient();
|
|
280368
280771
|
init_logger3();
|
|
280369
280772
|
init_billingActivationGate();
|
|
@@ -281024,9 +281427,9 @@ var init_setup = __esm({
|
|
|
281024
281427
|
};
|
|
281025
281428
|
await saveConfig(config5, configOptions);
|
|
281026
281429
|
if (controlPlaneToken) {
|
|
281027
|
-
await
|
|
281430
|
+
await reportAgentInitStepBestEffort({
|
|
281028
281431
|
controlPlaneToken,
|
|
281029
|
-
|
|
281432
|
+
step: { command: "login", outcome: "ok", phase: null }
|
|
281030
281433
|
});
|
|
281031
281434
|
}
|
|
281032
281435
|
status.stage("Starting local boxes.dev service");
|
|
@@ -285844,7 +286247,7 @@ var init_provider = __esm({
|
|
|
285844
286247
|
});
|
|
285845
286248
|
|
|
285846
286249
|
// src/devbox/commands/init/claudeAuthProbe.ts
|
|
285847
|
-
var REMOTE_MANAGED_CLAUDE_PATH, CLAUDE_AUTH_PROBE_TIMEOUT_MS, CLAUDE_AUTH_PROBE_PROMPT,
|
|
286250
|
+
var REMOTE_MANAGED_CLAUDE_PATH, CLAUDE_AUTH_PROBE_TIMEOUT_MS, CLAUDE_AUTH_PROBE_PROMPT, isRecord23, normalizeWhitespace, readAssistantMessageText, buildClaudeRemoteProbeUnexpectedFailureReason, classifyClaudeRemoteAuthProbeOutput, buildClaudeRemoteAuthProbeScript, buildWriteManagedClaudeTokenToRemoteScript, runRemoteBash, probeRemoteClaudeAuth, writeManagedClaudeTokenToRemoteCache;
|
|
285848
286251
|
var init_claudeAuthProbe = __esm({
|
|
285849
286252
|
"src/devbox/commands/init/claudeAuthProbe.ts"() {
|
|
285850
286253
|
"use strict";
|
|
@@ -285852,13 +286255,13 @@ var init_claudeAuthProbe = __esm({
|
|
|
285852
286255
|
REMOTE_MANAGED_CLAUDE_PATH = "/usr/local/bin/claude";
|
|
285853
286256
|
CLAUDE_AUTH_PROBE_TIMEOUT_MS = 45e3;
|
|
285854
286257
|
CLAUDE_AUTH_PROBE_PROMPT = "Reply with exactly OK";
|
|
285855
|
-
|
|
286258
|
+
isRecord23 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
285856
286259
|
normalizeWhitespace = (value) => value.trim().replace(/\s+/g, " ");
|
|
285857
286260
|
readAssistantMessageText = (frame) => {
|
|
285858
|
-
const message =
|
|
286261
|
+
const message = isRecord23(frame.message) ? frame.message : null;
|
|
285859
286262
|
const content = Array.isArray(message?.content) ? message.content : [];
|
|
285860
286263
|
const text = content.map((entry) => {
|
|
285861
|
-
if (!
|
|
286264
|
+
if (!isRecord23(entry) || entry.type !== "text") {
|
|
285862
286265
|
return null;
|
|
285863
286266
|
}
|
|
285864
286267
|
return typeof entry.text === "string" ? entry.text.trim() : null;
|
|
@@ -285892,7 +286295,7 @@ var init_claudeAuthProbe = __esm({
|
|
|
285892
286295
|
} catch {
|
|
285893
286296
|
continue;
|
|
285894
286297
|
}
|
|
285895
|
-
if (!
|
|
286298
|
+
if (!isRecord23(parsed)) {
|
|
285896
286299
|
continue;
|
|
285897
286300
|
}
|
|
285898
286301
|
if (parsed.type === "assistant") {
|
|
@@ -296152,4 +296555,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
296152
296555
|
*)
|
|
296153
296556
|
*/
|
|
296154
296557
|
|
|
296155
|
-
//# debugId=
|
|
296558
|
+
//# debugId=7953d21a-e340-5f5c-923a-10cac5e75ade
|