@boxes-dev/dvb-runtime 1.0.1053 → 1.0.1054
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 +3 -1
- package/dist/agent-init-guides/recovery.md +22 -0
- package/dist/agent-init-guides/running.md +3 -0
- package/dist/bin/dvb.mjs +536 -205
- package/dist/bin/dvbd.mjs +4 -4
- package/dist/product-docs/references/automations.md +10 -0
- package/dist/product-docs/references/onbox-agent-tools.md +7 -1
- package/dist/product-docs/references/project-setup.md +16 -8
- package/dist/product-docs/references/remote-assistants.md +25 -8
- 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]="9c41cadc-e81c-5aa4-9937-e5ea56beec3a")}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.1054";
|
|
69706
|
+
const rawGitSha = "4a244bb28514548cb1ff7c63ae7ddd26e23079ad";
|
|
69707
|
+
const rawSentryRelease = "boxes-dev-dvb@1.0.1054+4a244bb28514548cb1ff7c63ae7ddd26e23079ad";
|
|
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.1054";
|
|
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, 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) => {
|
|
@@ -169577,8 +169651,8 @@ var require_react_development = __commonJS({
|
|
|
169577
169651
|
function enqueueTask(task) {
|
|
169578
169652
|
if (null === enqueueTaskImpl)
|
|
169579
169653
|
try {
|
|
169580
|
-
var
|
|
169581
|
-
enqueueTaskImpl = (module2 && module2[
|
|
169654
|
+
var requireString4 = ("require" + Math.random()).slice(0, 7);
|
|
169655
|
+
enqueueTaskImpl = (module2 && module2[requireString4]).call(
|
|
169582
169656
|
module2,
|
|
169583
169657
|
"timers"
|
|
169584
169658
|
).setImmediate;
|
|
@@ -228201,7 +228275,7 @@ var init_AgentViewApp = __esm({
|
|
|
228201
228275
|
|
|
228202
228276
|
// src/devbox/agentView/workspace/workspaceEnvironment.ts
|
|
228203
228277
|
import path36 from "node:path";
|
|
228204
|
-
var AGENT_WORKSPACE_ROLE_ENV, AGENT_WORKSPACE_CONFIG_ENV, TMUX_ID_PATTERN, CREDENTIAL_PATTERN,
|
|
228278
|
+
var AGENT_WORKSPACE_ROLE_ENV, AGENT_WORKSPACE_CONFIG_ENV, TMUX_ID_PATTERN, CREDENTIAL_PATTERN, requireString2, requireAbsolutePath, requireTmuxId, parseAgentWorkspaceConfig, readAgentWorkspaceRole, requireAgentWorkspaceConfigPath, buildAgentWorkspacePaneEnvironment;
|
|
228205
228279
|
var init_workspaceEnvironment = __esm({
|
|
228206
228280
|
"src/devbox/agentView/workspace/workspaceEnvironment.ts"() {
|
|
228207
228281
|
"use strict";
|
|
@@ -228209,21 +228283,21 @@ var init_workspaceEnvironment = __esm({
|
|
|
228209
228283
|
AGENT_WORKSPACE_CONFIG_ENV = "DVB_AGENT_WORKSPACE_CONFIG";
|
|
228210
228284
|
TMUX_ID_PATTERN = /^[$@%][0-9]+$/u;
|
|
228211
228285
|
CREDENTIAL_PATTERN = /^[A-Za-z0-9_-]{32,128}$/u;
|
|
228212
|
-
|
|
228286
|
+
requireString2 = (value, label, maximumLength = 4096) => {
|
|
228213
228287
|
if (typeof value !== "string" || value.length === 0 || value.length > maximumLength) {
|
|
228214
228288
|
throw new Error(`Invalid agent workspace ${label}.`);
|
|
228215
228289
|
}
|
|
228216
228290
|
return value;
|
|
228217
228291
|
};
|
|
228218
228292
|
requireAbsolutePath = (value, label) => {
|
|
228219
|
-
const parsed =
|
|
228293
|
+
const parsed = requireString2(value, label);
|
|
228220
228294
|
if (!path36.isAbsolute(parsed)) {
|
|
228221
228295
|
throw new Error(`Agent workspace ${label} must be an absolute path.`);
|
|
228222
228296
|
}
|
|
228223
228297
|
return parsed;
|
|
228224
228298
|
};
|
|
228225
228299
|
requireTmuxId = (value, label) => {
|
|
228226
|
-
const parsed =
|
|
228300
|
+
const parsed = requireString2(value, label, 32);
|
|
228227
228301
|
if (!TMUX_ID_PATTERN.test(parsed)) {
|
|
228228
228302
|
throw new Error(`Invalid agent workspace ${label}.`);
|
|
228229
228303
|
}
|
|
@@ -228237,7 +228311,7 @@ var init_workspaceEnvironment = __esm({
|
|
|
228237
228311
|
if (record3.version !== 1) {
|
|
228238
228312
|
throw new Error("Unsupported agent workspace configuration version.");
|
|
228239
228313
|
}
|
|
228240
|
-
const credential =
|
|
228314
|
+
const credential = requireString2(record3.credential, "credential", 128);
|
|
228241
228315
|
if (!CREDENTIAL_PATTERN.test(credential)) {
|
|
228242
228316
|
throw new Error("Invalid agent workspace credential.");
|
|
228243
228317
|
}
|
|
@@ -228263,7 +228337,7 @@ var init_workspaceEnvironment = __esm({
|
|
|
228263
228337
|
windowId: requireTmuxId(record3.windowId, "window id"),
|
|
228264
228338
|
sidebarPaneId: requireTmuxId(record3.sidebarPaneId, "sidebar pane id"),
|
|
228265
228339
|
detailPaneId: requireTmuxId(record3.detailPaneId, "detail pane id"),
|
|
228266
|
-
projectTitle:
|
|
228340
|
+
projectTitle: requireString2(record3.projectTitle, "project title", 160),
|
|
228267
228341
|
narrow: record3.narrow
|
|
228268
228342
|
};
|
|
228269
228343
|
};
|
|
@@ -228890,7 +228964,7 @@ var init_tmuxWorkspace = __esm({
|
|
|
228890
228964
|
});
|
|
228891
228965
|
|
|
228892
228966
|
// src/devbox/agentView/workspace/workspaceProtocol.ts
|
|
228893
|
-
var AGENT_WORKSPACE_PROTOCOL_VERSION, AGENT_WORKSPACE_MAX_MESSAGE_BYTES, requireRecord,
|
|
228967
|
+
var AGENT_WORKSPACE_PROTOCOL_VERSION, AGENT_WORKSPACE_MAX_MESSAGE_BYTES, requireRecord, requireString3, optionalString, requireBoolean, parseBoxLabel, parseResolvedTargetRole, parseConfirmation, parseEmptyConfirmation, parseAction, parseJsonLine, parseAgentWorkspaceClientMessage, parseAgentWorkspaceServerMessage, encodeAgentWorkspaceMessage;
|
|
228894
228968
|
var init_workspaceProtocol = __esm({
|
|
228895
228969
|
"src/devbox/agentView/workspace/workspaceProtocol.ts"() {
|
|
228896
228970
|
"use strict";
|
|
@@ -228902,13 +228976,13 @@ var init_workspaceProtocol = __esm({
|
|
|
228902
228976
|
}
|
|
228903
228977
|
return value;
|
|
228904
228978
|
};
|
|
228905
|
-
|
|
228979
|
+
requireString3 = (value, label, maximumLength = 16384) => {
|
|
228906
228980
|
if (typeof value !== "string" || value.length === 0 || value.length > maximumLength) {
|
|
228907
228981
|
throw new Error(`Invalid ${label}.`);
|
|
228908
228982
|
}
|
|
228909
228983
|
return value;
|
|
228910
228984
|
};
|
|
228911
|
-
optionalString = (value, label) => value === null ? null :
|
|
228985
|
+
optionalString = (value, label) => value === null ? null : requireString3(value, label);
|
|
228912
228986
|
requireBoolean = (value, label) => {
|
|
228913
228987
|
if (typeof value !== "boolean") {
|
|
228914
228988
|
throw new Error(`Invalid ${label}.`);
|
|
@@ -228937,8 +229011,8 @@ var init_workspaceProtocol = __esm({
|
|
|
228937
229011
|
throw new Error("Invalid Claude confirmation turn epoch.");
|
|
228938
229012
|
}
|
|
228939
229013
|
return {
|
|
228940
|
-
transitionId:
|
|
228941
|
-
expectedOwnerFingerprint:
|
|
229014
|
+
transitionId: requireString3(record3.transitionId, "transition id"),
|
|
229015
|
+
expectedOwnerFingerprint: requireString3(
|
|
228942
229016
|
record3.expectedOwnerFingerprint,
|
|
228943
229017
|
"owner fingerprint"
|
|
228944
229018
|
),
|
|
@@ -228955,7 +229029,7 @@ var init_workspaceProtocol = __esm({
|
|
|
228955
229029
|
}
|
|
228956
229030
|
const record3 = requireRecord(value, "empty Claude confirmation");
|
|
228957
229031
|
return {
|
|
228958
|
-
expectedAttachmentFingerprint:
|
|
229032
|
+
expectedAttachmentFingerprint: requireString3(
|
|
228959
229033
|
record3.expectedAttachmentFingerprint,
|
|
228960
229034
|
"attachment fingerprint"
|
|
228961
229035
|
)
|
|
@@ -228963,7 +229037,7 @@ var init_workspaceProtocol = __esm({
|
|
|
228963
229037
|
};
|
|
228964
229038
|
parseAction = (value) => {
|
|
228965
229039
|
const record3 = requireRecord(value, "workspace action");
|
|
228966
|
-
const kind =
|
|
229040
|
+
const kind = requireString3(record3.kind, "workspace action kind", 32);
|
|
228967
229041
|
if (kind === "shell") {
|
|
228968
229042
|
if (!Array.isArray(record3.args) || record3.args.length > 32) {
|
|
228969
229043
|
throw new Error("Invalid workspace shell arguments.");
|
|
@@ -228975,10 +229049,10 @@ var init_workspaceProtocol = __esm({
|
|
|
228975
229049
|
return {
|
|
228976
229050
|
kind,
|
|
228977
229051
|
args: record3.args.map(
|
|
228978
|
-
(argument) =>
|
|
229052
|
+
(argument) => requireString3(argument, "shell argument")
|
|
228979
229053
|
),
|
|
228980
229054
|
resolvedTarget: {
|
|
228981
|
-
alias:
|
|
229055
|
+
alias: requireString3(target.alias, "shell alias"),
|
|
228982
229056
|
computeProvider: "e2b",
|
|
228983
229057
|
instanceId: optionalString(target.instanceId, "shell instance id"),
|
|
228984
229058
|
...target.providerInstanceId === void 0 ? {} : {
|
|
@@ -228996,31 +229070,31 @@ var init_workspaceProtocol = __esm({
|
|
|
228996
229070
|
};
|
|
228997
229071
|
}
|
|
228998
229072
|
const common = {
|
|
228999
|
-
alias:
|
|
229073
|
+
alias: requireString3(record3.alias, "workspace alias"),
|
|
229000
229074
|
boxLabel: parseBoxLabel(record3.boxLabel),
|
|
229001
|
-
primaryInstanceId:
|
|
229075
|
+
primaryInstanceId: requireString3(
|
|
229002
229076
|
record3.primaryInstanceId,
|
|
229003
229077
|
"primary instance id"
|
|
229004
229078
|
),
|
|
229005
|
-
clientThreadId:
|
|
229079
|
+
clientThreadId: requireString3(record3.clientThreadId, "client thread id")
|
|
229006
229080
|
};
|
|
229007
229081
|
if (kind === "codex") {
|
|
229008
229082
|
return {
|
|
229009
229083
|
kind,
|
|
229010
229084
|
...common,
|
|
229011
|
-
threadId:
|
|
229012
|
-
sessionPath:
|
|
229085
|
+
threadId: requireString3(record3.threadId, "Codex thread id"),
|
|
229086
|
+
sessionPath: requireString3(record3.sessionPath, "Codex session path")
|
|
229013
229087
|
};
|
|
229014
229088
|
}
|
|
229015
229089
|
if (kind === "codex_empty") {
|
|
229016
229090
|
return {
|
|
229017
229091
|
kind,
|
|
229018
229092
|
...common,
|
|
229019
|
-
startupAttemptId:
|
|
229093
|
+
startupAttemptId: requireString3(
|
|
229020
229094
|
record3.startupAttemptId,
|
|
229021
229095
|
"Codex startup attempt id"
|
|
229022
229096
|
),
|
|
229023
|
-
targetExecutionInstanceId:
|
|
229097
|
+
targetExecutionInstanceId: requireString3(
|
|
229024
229098
|
record3.targetExecutionInstanceId,
|
|
229025
229099
|
"Codex execution instance id"
|
|
229026
229100
|
)
|
|
@@ -229034,8 +229108,8 @@ var init_workspaceProtocol = __esm({
|
|
|
229034
229108
|
kind,
|
|
229035
229109
|
...common,
|
|
229036
229110
|
backend: record3.backend,
|
|
229037
|
-
threadId:
|
|
229038
|
-
sessionPath:
|
|
229111
|
+
threadId: requireString3(record3.threadId, "Claude thread id"),
|
|
229112
|
+
sessionPath: requireString3(record3.sessionPath, "Claude session path"),
|
|
229039
229113
|
threadTitle: optionalString(record3.threadTitle, "Claude thread title"),
|
|
229040
229114
|
confirmation: parseConfirmation(record3.confirmation)
|
|
229041
229115
|
};
|
|
@@ -229044,20 +229118,20 @@ var init_workspaceProtocol = __esm({
|
|
|
229044
229118
|
return {
|
|
229045
229119
|
kind,
|
|
229046
229120
|
...common,
|
|
229047
|
-
startupAttemptId:
|
|
229121
|
+
startupAttemptId: requireString3(
|
|
229048
229122
|
record3.startupAttemptId,
|
|
229049
229123
|
"Claude startup attempt id"
|
|
229050
229124
|
),
|
|
229051
|
-
plannedClaudeSessionId:
|
|
229125
|
+
plannedClaudeSessionId: requireString3(
|
|
229052
229126
|
record3.plannedClaudeSessionId,
|
|
229053
229127
|
"planned Claude session id"
|
|
229054
229128
|
),
|
|
229055
|
-
targetExecutionInstanceId:
|
|
229129
|
+
targetExecutionInstanceId: requireString3(
|
|
229056
229130
|
record3.targetExecutionInstanceId,
|
|
229057
229131
|
"Claude execution instance id"
|
|
229058
229132
|
),
|
|
229059
229133
|
cwd: optionalString(record3.cwd, "Claude workdir"),
|
|
229060
|
-
terminalSessionId:
|
|
229134
|
+
terminalSessionId: requireString3(
|
|
229061
229135
|
record3.terminalSessionId,
|
|
229062
229136
|
"Claude terminal session id"
|
|
229063
229137
|
),
|
|
@@ -229085,11 +229159,11 @@ var init_workspaceProtocol = __esm({
|
|
|
229085
229159
|
if (record3.version !== AGENT_WORKSPACE_PROTOCOL_VERSION) {
|
|
229086
229160
|
throw new Error("Unsupported agent workspace protocol version.");
|
|
229087
229161
|
}
|
|
229088
|
-
const credential =
|
|
229162
|
+
const credential = requireString3(record3.credential, "workspace credential");
|
|
229089
229163
|
if (record3.type === "shutdown") {
|
|
229090
229164
|
return { version: 1, credential, type: "shutdown" };
|
|
229091
229165
|
}
|
|
229092
|
-
const actionId =
|
|
229166
|
+
const actionId = requireString3(record3.actionId, "workspace action id", 128);
|
|
229093
229167
|
if (record3.type === "ready_ack") {
|
|
229094
229168
|
return { version: 1, credential, type: "ready_ack", actionId };
|
|
229095
229169
|
}
|
|
@@ -229112,13 +229186,13 @@ var init_workspaceProtocol = __esm({
|
|
|
229112
229186
|
if (record3.type === "shutdown_ack") {
|
|
229113
229187
|
return { version: 1, type: "shutdown_ack" };
|
|
229114
229188
|
}
|
|
229115
|
-
const actionId = record3.actionId === null ? null :
|
|
229189
|
+
const actionId = record3.actionId === null ? null : requireString3(record3.actionId, "workspace response action id", 128);
|
|
229116
229190
|
if (record3.type === "error") {
|
|
229117
229191
|
return {
|
|
229118
229192
|
version: 1,
|
|
229119
229193
|
type: "error",
|
|
229120
229194
|
actionId,
|
|
229121
|
-
message:
|
|
229195
|
+
message: requireString3(record3.message, "workspace error")
|
|
229122
229196
|
};
|
|
229123
229197
|
}
|
|
229124
229198
|
if (actionId === null) {
|
|
@@ -229129,7 +229203,7 @@ var init_workspaceProtocol = __esm({
|
|
|
229129
229203
|
version: 1,
|
|
229130
229204
|
type: "stage",
|
|
229131
229205
|
actionId,
|
|
229132
|
-
message:
|
|
229206
|
+
message: requireString3(record3.message, "workspace stage")
|
|
229133
229207
|
};
|
|
229134
229208
|
}
|
|
229135
229209
|
if (record3.type === "ready") {
|
|
@@ -229137,7 +229211,7 @@ var init_workspaceProtocol = __esm({
|
|
|
229137
229211
|
}
|
|
229138
229212
|
if (record3.type === "result") {
|
|
229139
229213
|
const outcome = requireRecord(record3.outcome, "workspace outcome");
|
|
229140
|
-
|
|
229214
|
+
requireString3(outcome.kind, "workspace outcome kind", 64);
|
|
229141
229215
|
return {
|
|
229142
229216
|
version: 1,
|
|
229143
229217
|
type: "result",
|
|
@@ -233442,25 +233516,56 @@ cat ${shellEscape3(filePath)}`
|
|
|
233442
233516
|
}
|
|
233443
233517
|
});
|
|
233444
233518
|
|
|
233445
|
-
// src/devbox/agentInit/
|
|
233446
|
-
var
|
|
233447
|
-
var
|
|
233448
|
-
"src/devbox/agentInit/
|
|
233519
|
+
// src/devbox/agentInit/progressReport.ts
|
|
233520
|
+
var resolvedProject, recordAgentInitProgressProject, readFolderProjectId, resolveAgentInitReportProject, reportAgentInitStepBestEffort;
|
|
233521
|
+
var init_progressReport = __esm({
|
|
233522
|
+
"src/devbox/agentInit/progressReport.ts"() {
|
|
233449
233523
|
"use strict";
|
|
233524
|
+
init_devboxCore();
|
|
233450
233525
|
init_controlPlane();
|
|
233451
233526
|
init_logger3();
|
|
233452
|
-
|
|
233527
|
+
resolvedProject = null;
|
|
233528
|
+
recordAgentInitProgressProject = (project) => {
|
|
233529
|
+
resolvedProject = project;
|
|
233530
|
+
};
|
|
233531
|
+
readFolderProjectId = async (folder) => {
|
|
233532
|
+
const marker = await readProjectRootMarker(folder);
|
|
233533
|
+
if (marker) {
|
|
233534
|
+
return marker.projectId;
|
|
233535
|
+
}
|
|
233536
|
+
return await readGitRootProjectId(folder);
|
|
233537
|
+
};
|
|
233538
|
+
resolveAgentInitReportProject = async (folder) => {
|
|
233539
|
+
if (resolvedProject) {
|
|
233540
|
+
return resolvedProject;
|
|
233541
|
+
}
|
|
233542
|
+
return { projectId: await readFolderProjectId(folder), alias: null };
|
|
233543
|
+
};
|
|
233544
|
+
reportAgentInitStepBestEffort = async ({
|
|
233453
233545
|
controlPlaneToken,
|
|
233454
|
-
|
|
233455
|
-
report =
|
|
233546
|
+
folder = process.cwd(),
|
|
233547
|
+
report = reportAgentInitStep,
|
|
233548
|
+
step,
|
|
233456
233549
|
warn: warn3 = (event, fields) => logger2.warn(event, fields)
|
|
233457
233550
|
}) => {
|
|
233458
233551
|
try {
|
|
233459
|
-
await
|
|
233552
|
+
const project = await resolveAgentInitReportProject(folder);
|
|
233553
|
+
await report(controlPlaneToken, {
|
|
233554
|
+
command: step.command,
|
|
233555
|
+
outcome: step.outcome,
|
|
233556
|
+
phase: step.phase,
|
|
233557
|
+
detail: step.detail ?? null,
|
|
233558
|
+
blockedSections: step.blockedSections ?? [],
|
|
233559
|
+
uploadPercent: step.uploadPercent ?? null,
|
|
233560
|
+
projectId: project.projectId,
|
|
233561
|
+
alias: project.alias,
|
|
233562
|
+
cliVersion: readCurrentPackageMetadata().version ?? null
|
|
233563
|
+
});
|
|
233460
233564
|
return true;
|
|
233461
233565
|
} catch (error55) {
|
|
233462
|
-
warn3("
|
|
233463
|
-
|
|
233566
|
+
warn3("agent_init_progress_report_failed", {
|
|
233567
|
+
command: step.command,
|
|
233568
|
+
outcome: step.outcome,
|
|
233464
233569
|
error: error55 instanceof Error ? error55.message : String(error55)
|
|
233465
233570
|
});
|
|
233466
233571
|
return false;
|
|
@@ -233469,15 +233574,6 @@ var init_handoffProgress = __esm({
|
|
|
233469
233574
|
}
|
|
233470
233575
|
});
|
|
233471
233576
|
|
|
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
233577
|
// ../../../../shared/initPrep/src/devboxCore.mjs
|
|
233482
233578
|
var init_devboxCore2 = __esm({
|
|
233483
233579
|
"../../../../shared/initPrep/src/devboxCore.mjs"() {
|
|
@@ -249452,6 +249548,15 @@ var init_controlPlane2 = __esm({
|
|
|
249452
249548
|
}
|
|
249453
249549
|
});
|
|
249454
249550
|
|
|
249551
|
+
// src/devbox/agentInit/remoteSession.ts
|
|
249552
|
+
var isRemoteShellSession;
|
|
249553
|
+
var init_remoteSession = __esm({
|
|
249554
|
+
"src/devbox/agentInit/remoteSession.ts"() {
|
|
249555
|
+
"use strict";
|
|
249556
|
+
isRemoteShellSession = (env3 = process.env) => Boolean(env3["SSH_CONNECTION"] || env3["SSH_CLIENT"]);
|
|
249557
|
+
}
|
|
249558
|
+
});
|
|
249559
|
+
|
|
249455
249560
|
// src/devbox/agentInit/scanRunner.ts
|
|
249456
249561
|
var EXTERNAL_SCAN_EXECUTION_PATH, createExternalScanResultsRunner;
|
|
249457
249562
|
var init_scanRunner = __esm({
|
|
@@ -249606,6 +249711,69 @@ var init_service = __esm({
|
|
|
249606
249711
|
}
|
|
249607
249712
|
});
|
|
249608
249713
|
|
|
249714
|
+
// src/devbox/agentInit/failureReport.ts
|
|
249715
|
+
var readProgressCommand, readStoredToken, reportAgentInitFailure;
|
|
249716
|
+
var init_failureReport = __esm({
|
|
249717
|
+
"src/devbox/agentInit/failureReport.ts"() {
|
|
249718
|
+
"use strict";
|
|
249719
|
+
init_devboxCore();
|
|
249720
|
+
init_auth();
|
|
249721
|
+
init_billingActivationGate();
|
|
249722
|
+
init_errors4();
|
|
249723
|
+
init_progressReport();
|
|
249724
|
+
init_service();
|
|
249725
|
+
readProgressCommand = (args) => {
|
|
249726
|
+
const [subcommand, action] = args;
|
|
249727
|
+
switch (subcommand) {
|
|
249728
|
+
case "--login-code":
|
|
249729
|
+
case "login":
|
|
249730
|
+
return { command: "login", label: subcommand };
|
|
249731
|
+
case "accounts":
|
|
249732
|
+
case "start":
|
|
249733
|
+
case "check":
|
|
249734
|
+
case "run":
|
|
249735
|
+
case "destroy":
|
|
249736
|
+
return { command: subcommand, label: subcommand };
|
|
249737
|
+
case "github":
|
|
249738
|
+
return action === "connect" ? { command: "github_connect", label: "github connect" } : null;
|
|
249739
|
+
case "git-ssh":
|
|
249740
|
+
return { command: "git_ssh", label: `git-ssh ${action ?? ""}`.trim() };
|
|
249741
|
+
default:
|
|
249742
|
+
return null;
|
|
249743
|
+
}
|
|
249744
|
+
};
|
|
249745
|
+
readStoredToken = async () => await resolveStoredControlPlaneToken(await openAgentInitSecretStore());
|
|
249746
|
+
reportAgentInitFailure = async ({
|
|
249747
|
+
args,
|
|
249748
|
+
error: error55,
|
|
249749
|
+
printError = console.error,
|
|
249750
|
+
readToken = readStoredToken,
|
|
249751
|
+
report = reportAgentInitStepBestEffort
|
|
249752
|
+
}) => {
|
|
249753
|
+
const progress = readProgressCommand(args);
|
|
249754
|
+
if (progress === null || isCommandUsageError(error55) || error55 instanceof UpgradeRequiredError || isBillingActivationRequiredError(error55)) {
|
|
249755
|
+
return;
|
|
249756
|
+
}
|
|
249757
|
+
printError(
|
|
249758
|
+
`\`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.`
|
|
249759
|
+
);
|
|
249760
|
+
const token = await readToken().catch(() => null);
|
|
249761
|
+
if (token === null) {
|
|
249762
|
+
return;
|
|
249763
|
+
}
|
|
249764
|
+
await report({
|
|
249765
|
+
controlPlaneToken: token,
|
|
249766
|
+
step: {
|
|
249767
|
+
command: progress.command,
|
|
249768
|
+
outcome: "failed",
|
|
249769
|
+
phase: null,
|
|
249770
|
+
detail: error55 instanceof Error ? error55.message : String(error55)
|
|
249771
|
+
}
|
|
249772
|
+
});
|
|
249773
|
+
};
|
|
249774
|
+
}
|
|
249775
|
+
});
|
|
249776
|
+
|
|
249609
249777
|
// src/devbox/agentInit/signIn.ts
|
|
249610
249778
|
var LOGIN_CODE_REJECTION_TEXT, describeLoginCodeRejection, readViewerEmail, signInWithAgentInitLoginCode, runAgentInitLogin;
|
|
249611
249779
|
var init_signIn = __esm({
|
|
@@ -249615,7 +249783,7 @@ var init_signIn = __esm({
|
|
|
249615
249783
|
init_errors4();
|
|
249616
249784
|
init_controlPlane();
|
|
249617
249785
|
init_siteUrl();
|
|
249618
|
-
|
|
249786
|
+
init_progressReport();
|
|
249619
249787
|
init_remoteSession();
|
|
249620
249788
|
init_service();
|
|
249621
249789
|
LOGIN_CODE_REJECTION_TEXT = {
|
|
@@ -249648,9 +249816,9 @@ var init_signIn = __esm({
|
|
|
249648
249816
|
if (result.ok) {
|
|
249649
249817
|
const { token, refreshToken } = result.tokens;
|
|
249650
249818
|
await updateControlPlaneSession(store, token, refreshToken);
|
|
249651
|
-
await
|
|
249819
|
+
await reportAgentInitStepBestEffort({
|
|
249652
249820
|
controlPlaneToken: token,
|
|
249653
|
-
|
|
249821
|
+
step: { command: "login", outcome: "ok", phase: null }
|
|
249654
249822
|
});
|
|
249655
249823
|
const email5 = await readViewerEmail(token);
|
|
249656
249824
|
console.log(
|
|
@@ -249685,9 +249853,9 @@ var init_signIn = __esm({
|
|
|
249685
249853
|
const store = await openAgentInitSecretStore();
|
|
249686
249854
|
const tokens = await signInWithBrowser({}, "plain");
|
|
249687
249855
|
await updateControlPlaneSession(store, tokens.token, tokens.refreshToken);
|
|
249688
|
-
await
|
|
249856
|
+
await reportAgentInitStepBestEffort({
|
|
249689
249857
|
controlPlaneToken: tokens.token,
|
|
249690
|
-
|
|
249858
|
+
step: { command: "login", outcome: "ok", phase: null }
|
|
249691
249859
|
});
|
|
249692
249860
|
console.log("Run `dvb agent-init` to continue.");
|
|
249693
249861
|
};
|
|
@@ -249903,7 +250071,7 @@ import { createHash as createHash18, randomBytes as randomBytes14, randomUUID as
|
|
|
249903
250071
|
import http10 from "node:http";
|
|
249904
250072
|
import https3 from "node:https";
|
|
249905
250073
|
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,
|
|
250074
|
+
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
250075
|
var init_claudeSetupOauth = __esm({
|
|
249908
250076
|
"src/devbox/commands/claudeSetupOauth.ts"() {
|
|
249909
250077
|
"use strict";
|
|
@@ -249943,7 +250111,7 @@ var init_claudeSetupOauth = __esm({
|
|
|
249943
250111
|
}
|
|
249944
250112
|
return normalized;
|
|
249945
250113
|
};
|
|
249946
|
-
|
|
250114
|
+
requireNullableString2 = (value) => {
|
|
249947
250115
|
if (value === null || value === void 0) {
|
|
249948
250116
|
return null;
|
|
249949
250117
|
}
|
|
@@ -250301,15 +250469,15 @@ var init_claudeSetupOauth = __esm({
|
|
|
250301
250469
|
parsed.expires_in,
|
|
250302
250470
|
"expires_in"
|
|
250303
250471
|
);
|
|
250304
|
-
const scope =
|
|
250472
|
+
const scope = requireNullableString2(parsed.scope);
|
|
250305
250473
|
const account = isRecord7(parsed.account) ? parsed.account : null;
|
|
250306
250474
|
const organization = isRecord7(parsed.organization) ? parsed.organization : null;
|
|
250307
250475
|
return {
|
|
250308
250476
|
accessToken,
|
|
250309
|
-
accountUuid: account ?
|
|
250310
|
-
emailAddress: account ?
|
|
250477
|
+
accountUuid: account ? requireNullableString2(account.uuid) : null,
|
|
250478
|
+
emailAddress: account ? requireNullableString2(account.email_address) : null,
|
|
250311
250479
|
expiresInSeconds,
|
|
250312
|
-
organizationUuid: organization ?
|
|
250480
|
+
organizationUuid: organization ? requireNullableString2(organization.uuid) : null,
|
|
250313
250481
|
scope
|
|
250314
250482
|
};
|
|
250315
250483
|
};
|
|
@@ -250851,6 +251019,7 @@ var init_accounts = __esm({
|
|
|
250851
251019
|
init_accountsServer();
|
|
250852
251020
|
init_codexSignIn();
|
|
250853
251021
|
init_service();
|
|
251022
|
+
init_progressReport();
|
|
250854
251023
|
init_remoteSession();
|
|
250855
251024
|
init_auth();
|
|
250856
251025
|
init_browser();
|
|
@@ -250987,6 +251156,10 @@ var init_accounts = __esm({
|
|
|
250987
251156
|
console.log(
|
|
250988
251157
|
"When the user says they're done, run `dvb agent-init status` for the next step."
|
|
250989
251158
|
);
|
|
251159
|
+
await reportAgentInitStepBestEffort({
|
|
251160
|
+
controlPlaneToken,
|
|
251161
|
+
step: { command: "accounts", outcome: "waiting", phase: null }
|
|
251162
|
+
});
|
|
250990
251163
|
return;
|
|
250991
251164
|
}
|
|
250992
251165
|
const codexSignInAbort = new AbortController();
|
|
@@ -251026,6 +251199,10 @@ var init_accounts = __esm({
|
|
|
251026
251199
|
console.log(
|
|
251027
251200
|
"Waiting for the user to connect Codex or Claude Code and click Done. This can take several minutes."
|
|
251028
251201
|
);
|
|
251202
|
+
await reportAgentInitStepBestEffort({
|
|
251203
|
+
controlPlaneToken,
|
|
251204
|
+
step: { command: "accounts", outcome: "waiting", phase: null }
|
|
251205
|
+
});
|
|
251029
251206
|
const finishedBy = await Promise.race([
|
|
251030
251207
|
server.done.then(() => "done"),
|
|
251031
251208
|
server.idle.then(() => "idle")
|
|
@@ -251033,9 +251210,17 @@ var init_accounts = __esm({
|
|
|
251033
251210
|
codexSignInAbort.abort();
|
|
251034
251211
|
await server.close();
|
|
251035
251212
|
if (finishedBy === "idle" && !await handlers2.finishAccounts()) {
|
|
251036
|
-
|
|
251037
|
-
|
|
251038
|
-
|
|
251213
|
+
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.";
|
|
251214
|
+
console.log(message);
|
|
251215
|
+
await reportAgentInitStepBestEffort({
|
|
251216
|
+
controlPlaneToken,
|
|
251217
|
+
step: {
|
|
251218
|
+
command: "accounts",
|
|
251219
|
+
outcome: "failed",
|
|
251220
|
+
phase: null,
|
|
251221
|
+
detail: message
|
|
251222
|
+
}
|
|
251223
|
+
});
|
|
251039
251224
|
process.exitCode = 1;
|
|
251040
251225
|
return;
|
|
251041
251226
|
}
|
|
@@ -251043,6 +251228,10 @@ var init_accounts = __esm({
|
|
|
251043
251228
|
if (!agents) {
|
|
251044
251229
|
throw new Error("The coding agent choice was not saved.");
|
|
251045
251230
|
}
|
|
251231
|
+
await reportAgentInitStepBestEffort({
|
|
251232
|
+
controlPlaneToken,
|
|
251233
|
+
step: { command: "accounts", outcome: "ok", phase: null }
|
|
251234
|
+
});
|
|
251046
251235
|
console.log(`Connected to boxes.dev: ${describeConnectedAgents(agents)}.`);
|
|
251047
251236
|
console.log("Run `dvb agent-init status` for the next step.");
|
|
251048
251237
|
};
|
|
@@ -259957,11 +260146,16 @@ var init_commandCore = __esm({
|
|
|
259957
260146
|
init_service();
|
|
259958
260147
|
init_statePaths();
|
|
259959
260148
|
init_parse6();
|
|
260149
|
+
init_progressReport();
|
|
259960
260150
|
resolveAgentInitProject = async ({
|
|
259961
260151
|
alias = null,
|
|
260152
|
+
onSnapshot = null,
|
|
259962
260153
|
projectPath
|
|
259963
260154
|
}) => {
|
|
259964
|
-
const context34 = await createAgentInitServiceContext({
|
|
260155
|
+
const context34 = await createAgentInitServiceContext({
|
|
260156
|
+
cwd: projectPath,
|
|
260157
|
+
onSnapshot
|
|
260158
|
+
});
|
|
259965
260159
|
const preference = await fetchViewerCodingAgentPreference(
|
|
259966
260160
|
context34.controlPlaneToken
|
|
259967
260161
|
);
|
|
@@ -260013,6 +260207,10 @@ var init_commandCore = __esm({
|
|
|
260013
260207
|
throw new Error(`Project check failed: ${message}`);
|
|
260014
260208
|
}
|
|
260015
260209
|
const repo = validation.repo;
|
|
260210
|
+
recordAgentInitProgressProject({
|
|
260211
|
+
projectId: repo.projectId,
|
|
260212
|
+
alias: repo.alias
|
|
260213
|
+
});
|
|
260016
260214
|
if (selection.selectedRepoRelPaths || selection.selectedProjectRootEntryRelPaths) {
|
|
260017
260215
|
await context34.service.selectProjectLayout({ repo, ...selection });
|
|
260018
260216
|
}
|
|
@@ -261231,7 +261429,7 @@ var init_guidance = __esm({
|
|
|
261231
261429
|
});
|
|
261232
261430
|
|
|
261233
261431
|
// src/devbox/commands/agentInit/check.ts
|
|
261234
|
-
var isRecord11, buildAgentInitRegistryConflictIssue, buildAgentInitCodingAgentIssue, parseCheckArgs, buildAgentInitLaunchSummary, buildAgentInitRepoSshIssue, buildAgentInitDatabasePreflightIssues, runAgentInitCheck;
|
|
261432
|
+
var isRecord11, buildAgentInitRegistryConflictIssue, buildAgentInitCodingAgentIssue, parseCheckArgs, buildAgentInitLaunchSummary, buildAgentInitRepoSshIssue, summarizeAgentInitCheckIssues, buildAgentInitDatabasePreflightIssues, runAgentInitCheck;
|
|
261235
261433
|
var init_check2 = __esm({
|
|
261236
261434
|
"src/devbox/commands/agentInit/check.ts"() {
|
|
261237
261435
|
"use strict";
|
|
@@ -261244,7 +261442,7 @@ var init_check2 = __esm({
|
|
|
261244
261442
|
init_instanceType();
|
|
261245
261443
|
init_githubAccess();
|
|
261246
261444
|
init_codingAgents2();
|
|
261247
|
-
|
|
261445
|
+
init_progressReport();
|
|
261248
261446
|
init_sshAccess2();
|
|
261249
261447
|
init_guidance();
|
|
261250
261448
|
isRecord11 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -261436,6 +261634,16 @@ var init_check2 = __esm({
|
|
|
261436
261634
|
fix: "Run `dvb agent-init git-ssh verify`, then re-run `dvb agent-init check`."
|
|
261437
261635
|
};
|
|
261438
261636
|
};
|
|
261637
|
+
summarizeAgentInitCheckIssues = (issues) => {
|
|
261638
|
+
const errors = issues.filter((issue3) => issue3.level === "error");
|
|
261639
|
+
const first = errors[0];
|
|
261640
|
+
return {
|
|
261641
|
+
detail: first ? `${first.location}: ${first.message}` : null,
|
|
261642
|
+
blockedSections: [
|
|
261643
|
+
...new Set(errors.map((issue3) => issue3.location.split(/[.[]/u)[0] ?? ""))
|
|
261644
|
+
].filter((section) => section.length > 0)
|
|
261645
|
+
};
|
|
261646
|
+
};
|
|
261439
261647
|
buildAgentInitDatabasePreflightIssues = (result) => {
|
|
261440
261648
|
if (!isRecord11(result) || !Array.isArray(result["failures"])) {
|
|
261441
261649
|
return [
|
|
@@ -261621,12 +261829,15 @@ var init_check2 = __esm({
|
|
|
261621
261829
|
resolved.validation.project
|
|
261622
261830
|
);
|
|
261623
261831
|
summary?.push(...projectGuidance);
|
|
261624
|
-
|
|
261625
|
-
|
|
261626
|
-
|
|
261627
|
-
|
|
261628
|
-
|
|
261629
|
-
|
|
261832
|
+
await reportAgentInitStepBestEffort({
|
|
261833
|
+
controlPlaneToken: resolved.context.controlPlaneToken,
|
|
261834
|
+
step: result.ok ? { command: "check", outcome: "ok", phase: "ready_to_launch" } : {
|
|
261835
|
+
command: "check",
|
|
261836
|
+
outcome: "blocked",
|
|
261837
|
+
phase: "preparing",
|
|
261838
|
+
...summarizeAgentInitCheckIssues(result.issues)
|
|
261839
|
+
}
|
|
261840
|
+
});
|
|
261630
261841
|
if (json3) {
|
|
261631
261842
|
console.log(
|
|
261632
261843
|
JSON.stringify(
|
|
@@ -261678,16 +261889,16 @@ var init_check2 = __esm({
|
|
|
261678
261889
|
});
|
|
261679
261890
|
|
|
261680
261891
|
// src/devbox/commands/agentInit/detect.ts
|
|
261681
|
-
var DETECT_USAGE,
|
|
261892
|
+
var DETECT_USAGE, withSilencedConsole, formatBytes2, printUntrackedNode, runAgentInitDetect;
|
|
261682
261893
|
var init_detect = __esm({
|
|
261683
261894
|
"src/devbox/commands/agentInit/detect.ts"() {
|
|
261684
261895
|
"use strict";
|
|
261896
|
+
init_devboxCore();
|
|
261685
261897
|
init_initPrep();
|
|
261686
261898
|
init_args();
|
|
261687
261899
|
init_errors4();
|
|
261688
261900
|
init_commandCore();
|
|
261689
261901
|
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
261902
|
withSilencedConsole = async (fn) => {
|
|
261692
261903
|
const original = { info: console.info, log: console.log };
|
|
261693
261904
|
console.info = () => {
|
|
@@ -261702,7 +261913,7 @@ var init_detect = __esm({
|
|
|
261702
261913
|
}
|
|
261703
261914
|
};
|
|
261704
261915
|
formatBytes2 = (value) => {
|
|
261705
|
-
if (
|
|
261916
|
+
if (value === null) {
|
|
261706
261917
|
return "?";
|
|
261707
261918
|
}
|
|
261708
261919
|
if (value >= 1024 * 1024 * 1024) {
|
|
@@ -261717,21 +261928,17 @@ var init_detect = __esm({
|
|
|
261717
261928
|
return `${value}B`;
|
|
261718
261929
|
};
|
|
261719
261930
|
printUntrackedNode = (node2, depth) => {
|
|
261720
|
-
if (!isRecord12(node2)) {
|
|
261721
|
-
return;
|
|
261722
|
-
}
|
|
261723
261931
|
const indent = " ".repeat(depth);
|
|
261724
|
-
const kind = node2
|
|
261725
|
-
const
|
|
261726
|
-
|
|
261727
|
-
|
|
261728
|
-
|
|
261729
|
-
|
|
261730
|
-
|
|
261731
|
-
|
|
261732
|
-
|
|
261733
|
-
|
|
261734
|
-
}
|
|
261932
|
+
const kind = node2.kind === "directory" ? "/" : "";
|
|
261933
|
+
const auto = node2.autoExclude ? " [excluded by default]" : "";
|
|
261934
|
+
console.log(
|
|
261935
|
+
`${indent}${node2.path}${kind} (${formatBytes2(node2.sizeBytes)})${auto}`
|
|
261936
|
+
);
|
|
261937
|
+
for (const child of node2.children) {
|
|
261938
|
+
printUntrackedNode(child, depth + 1);
|
|
261939
|
+
}
|
|
261940
|
+
if (node2.childrenTruncated) {
|
|
261941
|
+
console.log(`${indent} ... (more entries not shown)`);
|
|
261735
261942
|
}
|
|
261736
261943
|
};
|
|
261737
261944
|
runAgentInitDetect = async (args) => {
|
|
@@ -261821,21 +262028,22 @@ var init_detect = __esm({
|
|
|
261821
262028
|
}
|
|
261822
262029
|
if (what === "untracked") {
|
|
261823
262030
|
const { context: context34, repo } = await resolveAgentInitProject({ projectPath });
|
|
261824
|
-
const tree =
|
|
262031
|
+
const tree = normalizeDesktopInitUntrackedFileTree(
|
|
262032
|
+
await context34.service.enumerateUntrackedFileTree({ repo })
|
|
262033
|
+
);
|
|
261825
262034
|
if (json3) {
|
|
261826
262035
|
console.log(JSON.stringify(tree, null, 2));
|
|
261827
262036
|
return;
|
|
261828
262037
|
}
|
|
261829
|
-
if (
|
|
261830
|
-
|
|
262038
|
+
if (tree.totalFileCount === 0) {
|
|
262039
|
+
console.log("No untracked files.");
|
|
262040
|
+
return;
|
|
261831
262041
|
}
|
|
261832
262042
|
console.log(
|
|
261833
|
-
`Untracked files (total: ${String(tree
|
|
262043
|
+
`Untracked files (total: ${String(tree.totalFileCount)}, size: ${formatBytes2(tree.totalSizeBytes)}):`
|
|
261834
262044
|
);
|
|
261835
|
-
|
|
261836
|
-
|
|
261837
|
-
printUntrackedNode(node2, 1);
|
|
261838
|
-
}
|
|
262045
|
+
for (const node2 of tree.roots) {
|
|
262046
|
+
printUntrackedNode(node2, 1);
|
|
261839
262047
|
}
|
|
261840
262048
|
console.log("");
|
|
261841
262049
|
console.log(
|
|
@@ -262011,13 +262219,13 @@ var init_desktopHandoff = __esm({
|
|
|
262011
262219
|
});
|
|
262012
262220
|
|
|
262013
262221
|
// src/devbox/agentInit/jobLoop.ts
|
|
262014
|
-
var
|
|
262222
|
+
var isRecord12, sleep6, NO_ACTIVE_JOB_MESSAGE, resolveActiveJobId, requireActiveJobId, readJobError, fetchJobProgress, runJobLoopUntilTerminal;
|
|
262015
262223
|
var init_jobLoop = __esm({
|
|
262016
262224
|
"src/devbox/agentInit/jobLoop.ts"() {
|
|
262017
262225
|
"use strict";
|
|
262018
262226
|
init_controlPlane();
|
|
262019
262227
|
init_desktopHandoff();
|
|
262020
|
-
|
|
262228
|
+
isRecord12 = (value) => typeof value === "object" && value !== null;
|
|
262021
262229
|
sleep6 = async (ms) => await new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
262022
262230
|
NO_ACTIVE_JOB_MESSAGE = "No active setup job was found for this project. Run `dvb agent-init run` to start one.";
|
|
262023
262231
|
resolveActiveJobId = async ({
|
|
@@ -262039,7 +262247,7 @@ var init_jobLoop = __esm({
|
|
|
262039
262247
|
};
|
|
262040
262248
|
readJobError = (job) => {
|
|
262041
262249
|
const error55 = job["error"] ?? job["latestError"];
|
|
262042
|
-
if (
|
|
262250
|
+
if (isRecord12(error55)) {
|
|
262043
262251
|
const message = error55["userMessage"] ?? error55["message"];
|
|
262044
262252
|
return typeof message === "string" ? message : null;
|
|
262045
262253
|
}
|
|
@@ -262061,7 +262269,7 @@ var init_jobLoop = __esm({
|
|
|
262061
262269
|
projectId: repo.projectId
|
|
262062
262270
|
}
|
|
262063
262271
|
);
|
|
262064
|
-
return
|
|
262272
|
+
return isRecord12(progress) ? progress : null;
|
|
262065
262273
|
};
|
|
262066
262274
|
runJobLoopUntilTerminal = async ({
|
|
262067
262275
|
context: context34,
|
|
@@ -262078,7 +262286,7 @@ var init_jobLoop = __esm({
|
|
|
262078
262286
|
let lastProvisionEventCount = 0;
|
|
262079
262287
|
for (; ; ) {
|
|
262080
262288
|
const progress = await fetchJobProgress({ context: context34, jobId, repo });
|
|
262081
|
-
const job = progress &&
|
|
262289
|
+
const job = progress && isRecord12(progress["job"]) ? progress["job"] : null;
|
|
262082
262290
|
if (!job) {
|
|
262083
262291
|
throw new Error(NO_ACTIVE_JOB_MESSAGE);
|
|
262084
262292
|
}
|
|
@@ -262088,7 +262296,7 @@ var init_jobLoop = __esm({
|
|
|
262088
262296
|
const provisionEvents = progress?.["provisionEvents"];
|
|
262089
262297
|
if (Array.isArray(provisionEvents)) {
|
|
262090
262298
|
for (const event of provisionEvents.slice(lastProvisionEventCount)) {
|
|
262091
|
-
if (
|
|
262299
|
+
if (isRecord12(event) && typeof event["message"] === "string") {
|
|
262092
262300
|
emit({ stage: "remote", message: event["message"] });
|
|
262093
262301
|
}
|
|
262094
262302
|
}
|
|
@@ -262098,7 +262306,7 @@ var init_jobLoop = __esm({
|
|
|
262098
262306
|
emit({ stage: "remote", message: `Setup phase: ${phase}` });
|
|
262099
262307
|
lastAnnouncedPhase = phase;
|
|
262100
262308
|
}
|
|
262101
|
-
if (phase === "awaiting_decrypt_key_envelope" &&
|
|
262309
|
+
if (phase === "awaiting_decrypt_key_envelope" && isRecord12(job["remoteDecryptPublicKey"]) && activeJobId && sentEnvelopeForJob !== activeJobId) {
|
|
262102
262310
|
emit({
|
|
262103
262311
|
stage: "remote",
|
|
262104
262312
|
message: "Sending the bundle decrypt key to the Template box."
|
|
@@ -262110,8 +262318,8 @@ var init_jobLoop = __esm({
|
|
|
262110
262318
|
sentEnvelopeForJob = activeJobId;
|
|
262111
262319
|
}
|
|
262112
262320
|
const uploadManifest = job["uploadManifest"];
|
|
262113
|
-
const encryption =
|
|
262114
|
-
if (
|
|
262321
|
+
const encryption = isRecord12(uploadManifest) ? uploadManifest["encryption"] : null;
|
|
262322
|
+
if (isRecord12(encryption) && encryption["keyEnvelopeStatus"] === "extracted" && activeJobId && cleanedExtractionForJob !== activeJobId) {
|
|
262115
262323
|
emit({
|
|
262116
262324
|
stage: "remote",
|
|
262117
262325
|
message: "Template box extracted the bundle; cleaning local staging."
|
|
@@ -262148,7 +262356,7 @@ var init_jobLoop = __esm({
|
|
|
262148
262356
|
});
|
|
262149
262357
|
|
|
262150
262358
|
// src/devbox/commands/agentInit/diagnostics.ts
|
|
262151
|
-
var
|
|
262359
|
+
var isRecord13, REDACTED_SNAPSHOT_KEYS, redact, runAgentInitDiagnostics;
|
|
262152
262360
|
var init_diagnostics = __esm({
|
|
262153
262361
|
"src/devbox/commands/agentInit/diagnostics.ts"() {
|
|
262154
262362
|
"use strict";
|
|
@@ -262158,7 +262366,7 @@ var init_diagnostics = __esm({
|
|
|
262158
262366
|
init_jobLoop();
|
|
262159
262367
|
init_parse6();
|
|
262160
262368
|
init_check();
|
|
262161
|
-
|
|
262369
|
+
isRecord13 = (value) => typeof value === "object" && value !== null;
|
|
262162
262370
|
REDACTED_SNAPSHOT_KEYS = /* @__PURE__ */ new Set([
|
|
262163
262371
|
"accessToken",
|
|
262164
262372
|
"accessTokenCiphertextBase64",
|
|
@@ -262176,7 +262384,7 @@ var init_diagnostics = __esm({
|
|
|
262176
262384
|
if (Array.isArray(value)) {
|
|
262177
262385
|
return value.map((entry, index) => redact(entry, `${keyPath}[${index}]`));
|
|
262178
262386
|
}
|
|
262179
|
-
if (
|
|
262387
|
+
if (isRecord13(value)) {
|
|
262180
262388
|
const out = {};
|
|
262181
262389
|
for (const [key, child] of Object.entries(value)) {
|
|
262182
262390
|
if (REDACTED_SNAPSHOT_KEYS.has(key)) {
|
|
@@ -262236,7 +262444,7 @@ var init_diagnostics = __esm({
|
|
|
262236
262444
|
});
|
|
262237
262445
|
|
|
262238
262446
|
// src/devbox/commands/agentInit/gitSsh.ts
|
|
262239
|
-
var GIT_SSH_USAGE,
|
|
262447
|
+
var GIT_SSH_USAGE, isRecord14, isGitSshVerified, renderGitSshState, printSshState, setupAndPrecheckGitSsh, runAgentInitGitSsh;
|
|
262240
262448
|
var init_gitSsh = __esm({
|
|
262241
262449
|
"src/devbox/commands/agentInit/gitSsh.ts"() {
|
|
262242
262450
|
"use strict";
|
|
@@ -262245,17 +262453,18 @@ var init_gitSsh = __esm({
|
|
|
262245
262453
|
init_commandCore();
|
|
262246
262454
|
init_parse6();
|
|
262247
262455
|
init_githubAccess();
|
|
262456
|
+
init_progressReport();
|
|
262248
262457
|
init_sshAccess2();
|
|
262249
262458
|
GIT_SSH_USAGE = "Usage: dvb agent-init git-ssh <setup|verify> [--project <path>] [--convert-origin]";
|
|
262250
|
-
|
|
262459
|
+
isRecord14 = (value) => typeof value === "object" && value !== null;
|
|
262251
262460
|
isGitSshVerified = (snapshot) => {
|
|
262252
262461
|
const setup = snapshot["repoSshSetup"];
|
|
262253
|
-
return
|
|
262462
|
+
return isRecord14(setup) && setup["localVerificationStatus"] === "verified";
|
|
262254
262463
|
};
|
|
262255
262464
|
renderGitSshState = (snapshot) => {
|
|
262256
262465
|
const setup = snapshot["repoSshSetup"];
|
|
262257
262466
|
const publicKey = snapshot["repoSshPublicKey"];
|
|
262258
|
-
if (!
|
|
262467
|
+
if (!isRecord14(setup)) {
|
|
262259
262468
|
return ["No Git SSH setup is recorded yet."];
|
|
262260
262469
|
}
|
|
262261
262470
|
const lines = [`Git SSH status: ${String(setup["status"])}`];
|
|
@@ -262264,7 +262473,7 @@ var init_gitSsh = __esm({
|
|
|
262264
262473
|
}
|
|
262265
262474
|
if (Array.isArray(setup["targets"])) {
|
|
262266
262475
|
for (const target of setup["targets"]) {
|
|
262267
|
-
if (
|
|
262476
|
+
if (isRecord14(target))
|
|
262268
262477
|
lines.push(
|
|
262269
262478
|
`Repository: ${String(target["relPath"])} (${String(target["host"])})`
|
|
262270
262479
|
);
|
|
@@ -262275,7 +262484,7 @@ var init_gitSsh = __esm({
|
|
|
262275
262484
|
`Local verification: ${String(setup["localVerificationStatus"])}`
|
|
262276
262485
|
);
|
|
262277
262486
|
}
|
|
262278
|
-
if (
|
|
262487
|
+
if (isRecord14(snapshot["latestError"]) && typeof snapshot["latestError"]["message"] === "string") {
|
|
262279
262488
|
lines.push(snapshot["latestError"]["message"]);
|
|
262280
262489
|
}
|
|
262281
262490
|
if (setup["localVerificationStatus"] !== "verified" && typeof publicKey === "string" && publicKey) {
|
|
@@ -262310,7 +262519,7 @@ var init_gitSsh = __esm({
|
|
|
262310
262519
|
precheck: true,
|
|
262311
262520
|
repo
|
|
262312
262521
|
});
|
|
262313
|
-
if (!
|
|
262522
|
+
if (!isRecord14(snapshot)) {
|
|
262314
262523
|
throw new Error("Git SSH setup returned an invalid state.");
|
|
262315
262524
|
}
|
|
262316
262525
|
return snapshot;
|
|
@@ -262361,12 +262570,21 @@ var init_gitSsh = __esm({
|
|
|
262361
262570
|
repositories
|
|
262362
262571
|
});
|
|
262363
262572
|
printSshState(snapshot);
|
|
262364
|
-
|
|
262573
|
+
const verified = isGitSshVerified(snapshot);
|
|
262574
|
+
if (verified) {
|
|
262365
262575
|
console.log("");
|
|
262366
262576
|
console.log(
|
|
262367
262577
|
"Git SSH access is already verified; no user action is needed."
|
|
262368
262578
|
);
|
|
262369
262579
|
}
|
|
262580
|
+
await reportAgentInitStepBestEffort({
|
|
262581
|
+
controlPlaneToken: context34.controlPlaneToken,
|
|
262582
|
+
step: {
|
|
262583
|
+
command: "git_ssh",
|
|
262584
|
+
outcome: verified ? "ok" : "waiting",
|
|
262585
|
+
phase: null
|
|
262586
|
+
}
|
|
262587
|
+
});
|
|
262370
262588
|
return;
|
|
262371
262589
|
}
|
|
262372
262590
|
await context34.service.setRepoSshSetup({ repo, repositories, enabled: true });
|
|
@@ -262374,12 +262592,16 @@ var init_gitSsh = __esm({
|
|
|
262374
262592
|
precheck: false,
|
|
262375
262593
|
repo
|
|
262376
262594
|
});
|
|
262377
|
-
if (
|
|
262595
|
+
if (isRecord14(result)) {
|
|
262378
262596
|
printSshState(result);
|
|
262379
262597
|
const setup = result["repoSshSetup"];
|
|
262380
|
-
if (
|
|
262598
|
+
if (isRecord14(setup) && setup["localVerificationStatus"] === "verified") {
|
|
262381
262599
|
console.log("");
|
|
262382
262600
|
console.log("Git SSH access verified.");
|
|
262601
|
+
await reportAgentInitStepBestEffort({
|
|
262602
|
+
controlPlaneToken: context34.controlPlaneToken,
|
|
262603
|
+
step: { command: "git_ssh", outcome: "ok", phase: null }
|
|
262604
|
+
});
|
|
262383
262605
|
return;
|
|
262384
262606
|
}
|
|
262385
262607
|
}
|
|
@@ -262397,6 +262619,7 @@ var init_github = __esm({
|
|
|
262397
262619
|
"use strict";
|
|
262398
262620
|
init_commandCore();
|
|
262399
262621
|
init_githubAccess();
|
|
262622
|
+
init_progressReport();
|
|
262400
262623
|
init_service();
|
|
262401
262624
|
init_browser();
|
|
262402
262625
|
init_errors4();
|
|
@@ -262438,7 +262661,7 @@ var init_github = __esm({
|
|
|
262438
262661
|
});
|
|
262439
262662
|
return;
|
|
262440
262663
|
}
|
|
262441
|
-
await connectAgentInitGithub({
|
|
262664
|
+
const outcome = await connectAgentInitGithub({
|
|
262442
262665
|
client: context34.controlPlaneClient,
|
|
262443
262666
|
loadProjectLayoutRepos: async () => {
|
|
262444
262667
|
const { repo, validation } = await resolveAgentInitProject({
|
|
@@ -262447,6 +262670,12 @@ var init_github = __esm({
|
|
|
262447
262670
|
return readAgentInitProjectLayoutRepos({ repo, validation });
|
|
262448
262671
|
}
|
|
262449
262672
|
});
|
|
262673
|
+
if (outcome !== null) {
|
|
262674
|
+
await reportAgentInitStepBestEffort({
|
|
262675
|
+
controlPlaneToken: context34.controlPlaneToken,
|
|
262676
|
+
step: { command: "github_connect", outcome, phase: null }
|
|
262677
|
+
});
|
|
262678
|
+
}
|
|
262450
262679
|
};
|
|
262451
262680
|
isGithubConnectionReady = (connectionResult) => {
|
|
262452
262681
|
if (!connectionResult || typeof connectionResult !== "object") return false;
|
|
@@ -262474,7 +262703,7 @@ var init_github = __esm({
|
|
|
262474
262703
|
const connectionResult = await client.getGithubConnection({});
|
|
262475
262704
|
if (!isGithubConnectionReady(connectionResult)) {
|
|
262476
262705
|
await startAgentInitGithubConnection({ client, openBrowserFn, print });
|
|
262477
|
-
return;
|
|
262706
|
+
return "waiting";
|
|
262478
262707
|
}
|
|
262479
262708
|
const resolution = resolveAgentInitManagedGithubAccess({
|
|
262480
262709
|
connectionResult,
|
|
@@ -262485,12 +262714,12 @@ var init_github = __esm({
|
|
|
262485
262714
|
print(
|
|
262486
262715
|
`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
262716
|
);
|
|
262488
|
-
return;
|
|
262717
|
+
return "ok";
|
|
262489
262718
|
}
|
|
262490
262719
|
if (!("missingAccess" in resolution)) {
|
|
262491
262720
|
print(resolution.issue.message);
|
|
262492
262721
|
print(resolution.issue.fix);
|
|
262493
|
-
return;
|
|
262722
|
+
return null;
|
|
262494
262723
|
}
|
|
262495
262724
|
const page = resolveAgentInitGithubAccessPage(resolution.missingAccess);
|
|
262496
262725
|
const repositories = resolution.missingAccess.repositoryFullNames.join(", ");
|
|
@@ -262510,14 +262739,14 @@ var init_github = __esm({
|
|
|
262510
262739
|
print(
|
|
262511
262740
|
`${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
262741
|
);
|
|
262513
|
-
return;
|
|
262742
|
+
return null;
|
|
262514
262743
|
}
|
|
262515
262744
|
url3 = target?.ok ? target.installUrl : resolution.missingAccess.appInstallationUrl;
|
|
262516
262745
|
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
262746
|
}
|
|
262518
262747
|
if (url3 === null) {
|
|
262519
262748
|
print(instruction);
|
|
262520
|
-
return;
|
|
262749
|
+
return null;
|
|
262521
262750
|
}
|
|
262522
262751
|
if (openBrowserFn(url3)) {
|
|
262523
262752
|
print("GitHub opened in your browser.");
|
|
@@ -262526,6 +262755,7 @@ var init_github = __esm({
|
|
|
262526
262755
|
print(url3);
|
|
262527
262756
|
}
|
|
262528
262757
|
print(instruction);
|
|
262758
|
+
return "waiting";
|
|
262529
262759
|
};
|
|
262530
262760
|
manageAgentInitGithubCliAccess = async ({
|
|
262531
262761
|
client,
|
|
@@ -262703,7 +262933,7 @@ var init_guide = __esm({
|
|
|
262703
262933
|
});
|
|
262704
262934
|
|
|
262705
262935
|
// src/devbox/commands/agentInit/openDesktop.ts
|
|
262706
|
-
var
|
|
262936
|
+
var isRecord15, parseOpenDesktopArgs, runAgentInitOpenDesktop;
|
|
262707
262937
|
var init_openDesktop = __esm({
|
|
262708
262938
|
"src/devbox/commands/agentInit/openDesktop.ts"() {
|
|
262709
262939
|
"use strict";
|
|
@@ -262714,7 +262944,7 @@ var init_openDesktop = __esm({
|
|
|
262714
262944
|
init_controlPlane();
|
|
262715
262945
|
init_siteUrl();
|
|
262716
262946
|
init_desktopApp();
|
|
262717
|
-
|
|
262947
|
+
isRecord15 = (value) => typeof value === "object" && value !== null;
|
|
262718
262948
|
parseOpenDesktopArgs = (args) => {
|
|
262719
262949
|
const { flags, positionals } = parseCommandArgs({
|
|
262720
262950
|
args,
|
|
@@ -262746,7 +262976,7 @@ var init_openDesktop = __esm({
|
|
|
262746
262976
|
}
|
|
262747
262977
|
const { context: context34, repo } = await resolveAgentInitProject({ projectPath });
|
|
262748
262978
|
const progress = await fetchJobProgress({ context: context34, jobId: null, repo });
|
|
262749
|
-
const job = progress &&
|
|
262979
|
+
const job = progress && isRecord15(progress["job"]) ? progress["job"] : null;
|
|
262750
262980
|
const setupThreadId = typeof job?.["setupThreadId"] === "string" && job["setupThreadId"] !== "" ? job["setupThreadId"] : null;
|
|
262751
262981
|
const clientThreadId = setupThreadId === null ? null : await upsertRemoteInitCodexThread(
|
|
262752
262982
|
context34.controlPlaneToken,
|
|
@@ -262771,7 +263001,7 @@ var init_openDesktop = __esm({
|
|
|
262771
263001
|
|
|
262772
263002
|
// src/devbox/commands/agentInit/recover.ts
|
|
262773
263003
|
import fs51 from "node:fs/promises";
|
|
262774
|
-
var
|
|
263004
|
+
var isRecord16, runAgentInitRetry, runAgentInitDestroy;
|
|
262775
263005
|
var init_recover = __esm({
|
|
262776
263006
|
"src/devbox/commands/agentInit/recover.ts"() {
|
|
262777
263007
|
"use strict";
|
|
@@ -262779,7 +263009,8 @@ var init_recover = __esm({
|
|
|
262779
263009
|
init_errors4();
|
|
262780
263010
|
init_commandCore();
|
|
262781
263011
|
init_jobLoop();
|
|
262782
|
-
|
|
263012
|
+
init_progressReport();
|
|
263013
|
+
isRecord16 = (value) => typeof value === "object" && value !== null;
|
|
262783
263014
|
runAgentInitRetry = async (args) => {
|
|
262784
263015
|
const { flags, positionals } = parseCommandArgs({
|
|
262785
263016
|
args,
|
|
@@ -262797,7 +263028,7 @@ var init_recover = __esm({
|
|
|
262797
263028
|
const projectPath = resolveProjectPathFlag(flags);
|
|
262798
263029
|
const { context: context34, repo } = await resolveAgentInitProject({ projectPath });
|
|
262799
263030
|
const progress = await fetchJobProgress({ context: context34, jobId: null, repo });
|
|
262800
|
-
const job = progress &&
|
|
263031
|
+
const job = progress && isRecord16(progress["job"]) ? progress["job"] : null;
|
|
262801
263032
|
if (!job || typeof job["jobId"] !== "string") {
|
|
262802
263033
|
throw new Error(
|
|
262803
263034
|
"No setup job found to retry. Run `dvb agent-init status` for the current state."
|
|
@@ -262872,6 +263103,10 @@ var init_recover = __esm({
|
|
|
262872
263103
|
} else {
|
|
262873
263104
|
console.log("Done. No manifest was present.");
|
|
262874
263105
|
}
|
|
263106
|
+
await reportAgentInitStepBestEffort({
|
|
263107
|
+
controlPlaneToken: context34.controlPlaneToken,
|
|
263108
|
+
step: { command: "destroy", outcome: "ok", phase: "preparing" }
|
|
263109
|
+
});
|
|
262875
263110
|
console.log(
|
|
262876
263111
|
"Re-run `dvb agent-init check` and `dvb agent-init run` to start over."
|
|
262877
263112
|
);
|
|
@@ -262882,7 +263117,7 @@ var init_recover = __esm({
|
|
|
262882
263117
|
// src/devbox/agentInit/driver.ts
|
|
262883
263118
|
import os27 from "node:os";
|
|
262884
263119
|
import path64 from "node:path";
|
|
262885
|
-
var readSnapshotRepoSshVerificationStatus,
|
|
263120
|
+
var readSnapshotRepoSshVerificationStatus, isRecord17, readSnapshotUploadStatus, readSnapshotBackendJob, readReviewState, resolveManifestForkStartupScriptRequest, approveAgentInitSetupReview, applyManifestToLocalPrep;
|
|
262886
263121
|
var init_driver = __esm({
|
|
262887
263122
|
"src/devbox/agentInit/driver.ts"() {
|
|
262888
263123
|
"use strict";
|
|
@@ -262901,21 +263136,21 @@ var init_driver = __esm({
|
|
|
262901
263136
|
const status = repoSshSetup.localVerificationStatus;
|
|
262902
263137
|
return typeof status === "string" ? status : null;
|
|
262903
263138
|
};
|
|
262904
|
-
|
|
263139
|
+
isRecord17 = (value) => typeof value === "object" && value !== null;
|
|
262905
263140
|
readSnapshotUploadStatus = (snapshot) => {
|
|
262906
263141
|
const upload = snapshot["upload"];
|
|
262907
|
-
if (
|
|
263142
|
+
if (isRecord17(upload) && typeof upload["status"] === "string") {
|
|
262908
263143
|
return upload["status"];
|
|
262909
263144
|
}
|
|
262910
263145
|
return null;
|
|
262911
263146
|
};
|
|
262912
263147
|
readSnapshotBackendJob = (snapshot) => {
|
|
262913
263148
|
const job = snapshot["backendJob"];
|
|
262914
|
-
return
|
|
263149
|
+
return isRecord17(job) ? job : null;
|
|
262915
263150
|
};
|
|
262916
263151
|
readReviewState = (snapshot) => {
|
|
262917
263152
|
const reviewState = snapshot["setupReviewState"];
|
|
262918
|
-
if (!
|
|
263153
|
+
if (!isRecord17(reviewState)) {
|
|
262919
263154
|
throw new Error(
|
|
262920
263155
|
"Setup review state is missing after applying manifest results."
|
|
262921
263156
|
);
|
|
@@ -262997,7 +263232,7 @@ var init_driver = __esm({
|
|
|
262997
263232
|
stage: "apply",
|
|
262998
263233
|
message: `Recording Git signing choice (${compiled.gitSigning.mode}).`
|
|
262999
263234
|
});
|
|
263000
|
-
if (compiled.githubAccess === "managed" && !
|
|
263235
|
+
if (compiled.githubAccess === "managed" && !isRecord17(repoSshSnapshot["managedGithubAccess"])) {
|
|
263001
263236
|
throw new Error(
|
|
263002
263237
|
"Automatic GitHub access is not ready. Re-run `dvb agent-init check`, then retry."
|
|
263003
263238
|
);
|
|
@@ -263020,8 +263255,8 @@ var init_driver = __esm({
|
|
|
263020
263255
|
const includeSet = new Set(compiled.agentConfigInclude);
|
|
263021
263256
|
const agentConfigItems = (() => {
|
|
263022
263257
|
const agentConfig = scanSnapshot["agentConfig"];
|
|
263023
|
-
if (
|
|
263024
|
-
return agentConfig["items"].filter(
|
|
263258
|
+
if (isRecord17(agentConfig) && Array.isArray(agentConfig["items"])) {
|
|
263259
|
+
return agentConfig["items"].filter(isRecord17);
|
|
263025
263260
|
}
|
|
263026
263261
|
return [];
|
|
263027
263262
|
})();
|
|
@@ -263110,7 +263345,7 @@ var init_driver = __esm({
|
|
|
263110
263345
|
untrackedExclusions
|
|
263111
263346
|
});
|
|
263112
263347
|
const bundleError = bundleSnapshot["latestError"];
|
|
263113
|
-
if (
|
|
263348
|
+
if (isRecord17(bundleError) && typeof bundleError["message"] === "string") {
|
|
263114
263349
|
throw new Error(`Bundle preparation failed: ${bundleError["message"]}`);
|
|
263115
263350
|
}
|
|
263116
263351
|
return { approvedReviewState, snapshot: bundleSnapshot };
|
|
@@ -263121,14 +263356,14 @@ var init_driver = __esm({
|
|
|
263121
263356
|
// src/devbox/agentInit/preparedBundleState.ts
|
|
263122
263357
|
import fs52 from "node:fs/promises";
|
|
263123
263358
|
import path65 from "node:path";
|
|
263124
|
-
var PREPARED_BUNDLE_STATE_VERSION,
|
|
263359
|
+
var PREPARED_BUNDLE_STATE_VERSION, isRecord18, readSnapshotPreparedBundleStagingRoot, readAgentInitPreparedBundleState, writeAgentInitPreparedBundleState, removeAgentInitPreparedBundleState, findReusableAgentInitPreparedBundle, prepareOrReuseAgentInitBundle;
|
|
263125
263360
|
var init_preparedBundleState = __esm({
|
|
263126
263361
|
"src/devbox/agentInit/preparedBundleState.ts"() {
|
|
263127
263362
|
"use strict";
|
|
263128
263363
|
PREPARED_BUNDLE_STATE_VERSION = 1;
|
|
263129
|
-
|
|
263364
|
+
isRecord18 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
263130
263365
|
readSnapshotPreparedBundleStagingRoot = (snapshot) => {
|
|
263131
|
-
if (!
|
|
263366
|
+
if (!isRecord18(snapshot) || !isRecord18(snapshot["bundle"])) {
|
|
263132
263367
|
return null;
|
|
263133
263368
|
}
|
|
263134
263369
|
const stagingRoot = snapshot["bundle"]["stagingRoot"];
|
|
@@ -263137,12 +263372,12 @@ var init_preparedBundleState = __esm({
|
|
|
263137
263372
|
readAgentInitPreparedBundleState = async (statePath) => {
|
|
263138
263373
|
try {
|
|
263139
263374
|
const parsed = JSON.parse(await fs52.readFile(statePath, "utf8"));
|
|
263140
|
-
if (
|
|
263375
|
+
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
263376
|
return parsed;
|
|
263142
263377
|
}
|
|
263143
263378
|
return null;
|
|
263144
263379
|
} catch (error55) {
|
|
263145
|
-
if (
|
|
263380
|
+
if (isRecord18(error55) && (error55["code"] === "ENOENT" || error55 instanceof SyntaxError)) {
|
|
263146
263381
|
return null;
|
|
263147
263382
|
}
|
|
263148
263383
|
throw error55;
|
|
@@ -263260,6 +263495,59 @@ var init_runInstanceType = __esm({
|
|
|
263260
263495
|
}
|
|
263261
263496
|
});
|
|
263262
263497
|
|
|
263498
|
+
// src/devbox/agentInit/uploadProgress.ts
|
|
263499
|
+
var UPLOAD_PROGRESS_STEP_PERCENT, createAgentInitUploadProgress;
|
|
263500
|
+
var init_uploadProgress = __esm({
|
|
263501
|
+
"src/devbox/agentInit/uploadProgress.ts"() {
|
|
263502
|
+
"use strict";
|
|
263503
|
+
UPLOAD_PROGRESS_STEP_PERCENT = 10;
|
|
263504
|
+
createAgentInitUploadProgress = ({
|
|
263505
|
+
print,
|
|
263506
|
+
report
|
|
263507
|
+
}) => {
|
|
263508
|
+
let lastStep = 0;
|
|
263509
|
+
let inFlight = null;
|
|
263510
|
+
let waiting = null;
|
|
263511
|
+
const send = (percent) => {
|
|
263512
|
+
inFlight = report(percent).then(() => {
|
|
263513
|
+
inFlight = null;
|
|
263514
|
+
if (waiting !== null) {
|
|
263515
|
+
const next = waiting;
|
|
263516
|
+
waiting = null;
|
|
263517
|
+
send(next);
|
|
263518
|
+
}
|
|
263519
|
+
});
|
|
263520
|
+
};
|
|
263521
|
+
return {
|
|
263522
|
+
onSnapshot: (snapshot) => {
|
|
263523
|
+
const percent = snapshot["progressPercent"];
|
|
263524
|
+
if (snapshot.phase !== "uploading_bundle" || typeof percent !== "number") {
|
|
263525
|
+
return;
|
|
263526
|
+
}
|
|
263527
|
+
const step = Math.floor(percent / UPLOAD_PROGRESS_STEP_PERCENT);
|
|
263528
|
+
if (step <= lastStep) {
|
|
263529
|
+
return;
|
|
263530
|
+
}
|
|
263531
|
+
lastStep = step;
|
|
263532
|
+
const stepPercent = Math.min(100, step * UPLOAD_PROGRESS_STEP_PERCENT);
|
|
263533
|
+
print(stepPercent);
|
|
263534
|
+
if (inFlight) {
|
|
263535
|
+
waiting = stepPercent;
|
|
263536
|
+
return;
|
|
263537
|
+
}
|
|
263538
|
+
send(stepPercent);
|
|
263539
|
+
},
|
|
263540
|
+
// Waits for the last report so it lands before the job takes over.
|
|
263541
|
+
flush: async () => {
|
|
263542
|
+
while (inFlight) {
|
|
263543
|
+
await inFlight;
|
|
263544
|
+
}
|
|
263545
|
+
}
|
|
263546
|
+
};
|
|
263547
|
+
};
|
|
263548
|
+
}
|
|
263549
|
+
});
|
|
263550
|
+
|
|
263263
263551
|
// src/devbox/commands/agentInit/run.ts
|
|
263264
263552
|
var parseRunArgs, emitLine, withSilencedConsole2, runAgentInitRun;
|
|
263265
263553
|
var init_run = __esm({
|
|
@@ -263279,7 +263567,8 @@ var init_run = __esm({
|
|
|
263279
263567
|
init_controlPlane();
|
|
263280
263568
|
init_instanceType();
|
|
263281
263569
|
init_runInstanceType();
|
|
263282
|
-
|
|
263570
|
+
init_progressReport();
|
|
263571
|
+
init_uploadProgress();
|
|
263283
263572
|
parseRunArgs = (args) => {
|
|
263284
263573
|
const { flags, positionals } = parseCommandArgs({
|
|
263285
263574
|
args,
|
|
@@ -263317,8 +263606,30 @@ var init_run = __esm({
|
|
|
263317
263606
|
};
|
|
263318
263607
|
runAgentInitRun = async (args) => {
|
|
263319
263608
|
const { projectPath } = parseRunArgs(args);
|
|
263320
|
-
|
|
263609
|
+
let reportContext = null;
|
|
263610
|
+
const uploadProgress = createAgentInitUploadProgress({
|
|
263611
|
+
print: (percent) => emitLine({ stage: "upload", message: `${String(percent)}% uploaded.` }),
|
|
263612
|
+
report: async (percent) => {
|
|
263613
|
+
if (!reportContext) {
|
|
263614
|
+
return;
|
|
263615
|
+
}
|
|
263616
|
+
await reportAgentInitStepBestEffort({
|
|
263617
|
+
controlPlaneToken: await reportContext.getControlPlaneToken(),
|
|
263618
|
+
step: {
|
|
263619
|
+
command: "run",
|
|
263620
|
+
outcome: "ok",
|
|
263621
|
+
phase: "launching",
|
|
263622
|
+
uploadPercent: percent
|
|
263623
|
+
}
|
|
263624
|
+
});
|
|
263625
|
+
}
|
|
263626
|
+
});
|
|
263627
|
+
const resolved = await resolveAgentInitProject({
|
|
263628
|
+
onSnapshot: uploadProgress.onSnapshot,
|
|
263629
|
+
projectPath
|
|
263630
|
+
});
|
|
263321
263631
|
const { context: context34, repo, selectedAgents, statePaths } = resolved;
|
|
263632
|
+
reportContext = context34;
|
|
263322
263633
|
const manifestText = await readManifestTextIfPresent(statePaths.manifestPath);
|
|
263323
263634
|
if (manifestText === null) {
|
|
263324
263635
|
throw new Error(
|
|
@@ -263367,9 +263678,9 @@ var init_run = __esm({
|
|
|
263367
263678
|
"The manifest project name was not the alias validated for this run. Re-run `dvb agent-init check` before launching."
|
|
263368
263679
|
);
|
|
263369
263680
|
}
|
|
263370
|
-
await
|
|
263681
|
+
await reportAgentInitStepBestEffort({
|
|
263371
263682
|
controlPlaneToken: context34.controlPlaneToken,
|
|
263372
|
-
phase: "launching"
|
|
263683
|
+
step: { command: "run", outcome: "ok", phase: "launching" }
|
|
263373
263684
|
});
|
|
263374
263685
|
emitLine({ stage: "local", message: "Initializing local setup state." });
|
|
263375
263686
|
const existingSnapshot = await context34.service.getSnapshot({
|
|
@@ -263472,6 +263783,7 @@ ${JSON.stringify(compiled.initialProjectConfiguration)}`
|
|
|
263472
263783
|
message: "Upload committed. Remote provisioning is starting."
|
|
263473
263784
|
});
|
|
263474
263785
|
}
|
|
263786
|
+
await uploadProgress.flush();
|
|
263475
263787
|
const outcome = await runJobLoopUntilTerminal({
|
|
263476
263788
|
context: context34,
|
|
263477
263789
|
emit: emitLine,
|
|
@@ -263804,8 +264116,9 @@ var init_start = __esm({
|
|
|
263804
264116
|
init_commandCore();
|
|
263805
264117
|
init_statePaths();
|
|
263806
264118
|
init_seed();
|
|
264119
|
+
init_check();
|
|
263807
264120
|
init_githubAccess();
|
|
263808
|
-
|
|
264121
|
+
init_progressReport();
|
|
263809
264122
|
init_guidance();
|
|
263810
264123
|
parseStartArgs = (args) => {
|
|
263811
264124
|
const { flags, positionals } = parseCommandArgs({
|
|
@@ -263949,9 +264262,18 @@ var init_start = __esm({
|
|
|
263949
264262
|
});
|
|
263950
264263
|
manifestSeeded = true;
|
|
263951
264264
|
}
|
|
263952
|
-
await
|
|
264265
|
+
const [manifestText, checkState] = await Promise.all([
|
|
264266
|
+
readManifestTextIfPresent(statePaths.manifestPath),
|
|
264267
|
+
readCheckState(statePaths.checkStatePath)
|
|
264268
|
+
]);
|
|
264269
|
+
const checkStillPasses = manifestText !== null && checkState?.ok === true && checkState.manifestHash === hashManifestText(manifestText);
|
|
264270
|
+
await reportAgentInitStepBestEffort({
|
|
263953
264271
|
controlPlaneToken: context34.controlPlaneToken,
|
|
263954
|
-
|
|
264272
|
+
step: {
|
|
264273
|
+
command: "start",
|
|
264274
|
+
outcome: "ok",
|
|
264275
|
+
phase: checkStillPasses ? "ready_to_launch" : "preparing"
|
|
264276
|
+
}
|
|
263955
264277
|
});
|
|
263956
264278
|
if (json3) {
|
|
263957
264279
|
console.log(
|
|
@@ -263999,7 +264321,7 @@ var init_start = __esm({
|
|
|
263999
264321
|
});
|
|
264000
264322
|
|
|
264001
264323
|
// src/devbox/commands/agentInit/status.ts
|
|
264002
|
-
var
|
|
264324
|
+
var isRecord19, buildAgentInitStatus, parseStatusArgs, runAgentInitStatus, runAgentInitWatch;
|
|
264003
264325
|
var init_status = __esm({
|
|
264004
264326
|
"src/devbox/commands/agentInit/status.ts"() {
|
|
264005
264327
|
"use strict";
|
|
@@ -264013,7 +264335,7 @@ var init_status = __esm({
|
|
|
264013
264335
|
init_check();
|
|
264014
264336
|
init_parse6();
|
|
264015
264337
|
init_guidance();
|
|
264016
|
-
|
|
264338
|
+
isRecord19 = (value) => typeof value === "object" && value !== null;
|
|
264017
264339
|
buildAgentInitStatus = async ({
|
|
264018
264340
|
projectPath
|
|
264019
264341
|
}) => {
|
|
@@ -264027,7 +264349,7 @@ var init_status = __esm({
|
|
|
264027
264349
|
const githubAccessMode = parsedManifest?.ok && parsedManifest.manifest.version !== 1 && parsedManifest.manifest.githubAccess !== null ? parsedManifest.manifest.githubAccess : null;
|
|
264028
264350
|
const localPrep = await context34.service.getSnapshot({ repo, selectedAgents });
|
|
264029
264351
|
const signingPublicKeys = readSigningPublicKeys(localPrep);
|
|
264030
|
-
const managedGithubAccess =
|
|
264352
|
+
const managedGithubAccess = isRecord19(localPrep) && isRecord19(localPrep["managedGithubAccess"]) ? localPrep["managedGithubAccess"] : null;
|
|
264031
264353
|
const managedRepositories = managedGithubAccess?.["repositories"];
|
|
264032
264354
|
const githubAccess = githubAccessMode ? {
|
|
264033
264355
|
mode: githubAccessMode,
|
|
@@ -264036,7 +264358,7 @@ var init_status = __esm({
|
|
|
264036
264358
|
let job = null;
|
|
264037
264359
|
try {
|
|
264038
264360
|
const progress = await fetchJobProgress({ context: context34, jobId: null, repo });
|
|
264039
|
-
job = progress &&
|
|
264361
|
+
job = progress && isRecord19(progress["job"]) ? progress["job"] : null;
|
|
264040
264362
|
} catch {
|
|
264041
264363
|
job = null;
|
|
264042
264364
|
}
|
|
@@ -264046,8 +264368,8 @@ var init_status = __esm({
|
|
|
264046
264368
|
const jobPhase = job && typeof job["phase"] === "string" ? job["phase"] : null;
|
|
264047
264369
|
const jobStatus = job && typeof job["status"] === "string" ? job["status"] : null;
|
|
264048
264370
|
const remotePreflight = validation["remotePreflight"];
|
|
264049
|
-
const registryProject =
|
|
264050
|
-
const registrySetupComplete =
|
|
264371
|
+
const registryProject = isRecord19(remotePreflight) ? remotePreflight["project"] : null;
|
|
264372
|
+
const registrySetupComplete = isRecord19(registryProject) && registryProject["initStatus"] === "complete" && (registryProject["projectFingerprint"] === repo.fingerprint || registryProject["projectFingerprint"] === null) || isRecord19(remotePreflight) && remotePreflight["jobPhase"] === "complete";
|
|
264051
264373
|
let phase;
|
|
264052
264374
|
let nextAction;
|
|
264053
264375
|
if (jobPhase === "complete" || job === null && registrySetupComplete) {
|
|
@@ -264083,7 +264405,7 @@ var init_status = __esm({
|
|
|
264083
264405
|
phase = "ready_to_run";
|
|
264084
264406
|
nextAction = "Check passed. With the user's explicit approval, launch with `dvb agent-init run`.";
|
|
264085
264407
|
}
|
|
264086
|
-
if (phase === "ready_to_run" &&
|
|
264408
|
+
if (phase === "ready_to_run" && isRecord19(localPrep) && localPrep["phase"] === "packaging_bundle") {
|
|
264087
264409
|
phase = "packaging_bundle";
|
|
264088
264410
|
}
|
|
264089
264411
|
return {
|
|
@@ -264168,12 +264490,13 @@ var init_status = __esm({
|
|
|
264168
264490
|
});
|
|
264169
264491
|
|
|
264170
264492
|
// src/devbox/commands/agentInit/index.ts
|
|
264171
|
-
var AGENT_INIT_USAGE, runAgentInitEntry, runAgentInit;
|
|
264493
|
+
var AGENT_INIT_USAGE, runAgentInitEntry, runAgentInit, dispatchAgentInit;
|
|
264172
264494
|
var init_agentInit = __esm({
|
|
264173
264495
|
"src/devbox/commands/agentInit/index.ts"() {
|
|
264174
264496
|
"use strict";
|
|
264175
264497
|
init_args();
|
|
264176
264498
|
init_errors4();
|
|
264499
|
+
init_failureReport();
|
|
264177
264500
|
init_signIn();
|
|
264178
264501
|
init_accounts();
|
|
264179
264502
|
init_check2();
|
|
@@ -264241,6 +264564,14 @@ var init_agentInit = __esm({
|
|
|
264241
264564
|
}
|
|
264242
264565
|
};
|
|
264243
264566
|
runAgentInit = async (args) => {
|
|
264567
|
+
try {
|
|
264568
|
+
await dispatchAgentInit(args);
|
|
264569
|
+
} catch (error55) {
|
|
264570
|
+
await reportAgentInitFailure({ args, error: error55 });
|
|
264571
|
+
throw error55;
|
|
264572
|
+
}
|
|
264573
|
+
};
|
|
264574
|
+
dispatchAgentInit = async (args) => {
|
|
264244
264575
|
const [subcommand, ...rest] = args;
|
|
264245
264576
|
if (!subcommand || subcommand.startsWith("--")) {
|
|
264246
264577
|
await runAgentInitEntry(args);
|
|
@@ -266078,18 +266409,18 @@ var init_dist11 = __esm({
|
|
|
266078
266409
|
});
|
|
266079
266410
|
|
|
266080
266411
|
// src/devbox/commands/init/codex/config.ts
|
|
266081
|
-
var DEVBOX_PROXY_PROVIDER_ID,
|
|
266412
|
+
var DEVBOX_PROXY_PROVIDER_ID, isRecord20, parseExistingConfig, normalizeTrustedPaths, normalizeRelayBaseUrl, ensureNoticeConfig, ensureTrustedProjects, ensureProxyProviderConfig, removeProxyProviderConfig, mergeCodexInitConfig;
|
|
266082
266413
|
var init_config2 = __esm({
|
|
266083
266414
|
"src/devbox/commands/init/codex/config.ts"() {
|
|
266084
266415
|
"use strict";
|
|
266085
266416
|
init_dist11();
|
|
266086
266417
|
DEVBOX_PROXY_PROVIDER_ID = "devbox-proxy";
|
|
266087
|
-
|
|
266418
|
+
isRecord20 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
266088
266419
|
parseExistingConfig = (content) => {
|
|
266089
266420
|
if (!content) return {};
|
|
266090
266421
|
try {
|
|
266091
266422
|
const parsed = parse7(content);
|
|
266092
|
-
return
|
|
266423
|
+
return isRecord20(parsed) ? { ...parsed } : {};
|
|
266093
266424
|
} catch {
|
|
266094
266425
|
return {};
|
|
266095
266426
|
}
|
|
@@ -266099,14 +266430,14 @@ var init_config2 = __esm({
|
|
|
266099
266430
|
];
|
|
266100
266431
|
normalizeRelayBaseUrl = (value) => value.trim().replace(/\/+$/, "");
|
|
266101
266432
|
ensureNoticeConfig = (config5) => {
|
|
266102
|
-
const notice =
|
|
266433
|
+
const notice = isRecord20(config5.notice) ? { ...config5.notice } : {};
|
|
266103
266434
|
notice.hide_full_access_warning = true;
|
|
266104
266435
|
config5.notice = notice;
|
|
266105
266436
|
};
|
|
266106
266437
|
ensureTrustedProjects = (config5, trustedPaths) => {
|
|
266107
|
-
const projects =
|
|
266438
|
+
const projects = isRecord20(config5.projects) ? { ...config5.projects } : {};
|
|
266108
266439
|
for (const trustedPath of normalizeTrustedPaths(trustedPaths)) {
|
|
266109
|
-
const existingProject =
|
|
266440
|
+
const existingProject = isRecord20(projects[trustedPath]) ? { ...projects[trustedPath] } : {};
|
|
266110
266441
|
existingProject.trust_level = "trusted";
|
|
266111
266442
|
projects[trustedPath] = existingProject;
|
|
266112
266443
|
}
|
|
@@ -266118,7 +266449,7 @@ var init_config2 = __esm({
|
|
|
266118
266449
|
throw new Error("Relay base URL is required for Codex proxy mode.");
|
|
266119
266450
|
}
|
|
266120
266451
|
config5.model_provider = DEVBOX_PROXY_PROVIDER_ID;
|
|
266121
|
-
const modelProviders =
|
|
266452
|
+
const modelProviders = isRecord20(config5.model_providers) ? { ...config5.model_providers } : {};
|
|
266122
266453
|
modelProviders[DEVBOX_PROXY_PROVIDER_ID] = {
|
|
266123
266454
|
name: "boxes.dev Proxy",
|
|
266124
266455
|
base_url: `${normalizedBase}/v1`,
|
|
@@ -266131,7 +266462,7 @@ var init_config2 = __esm({
|
|
|
266131
266462
|
if (config5.model_provider === DEVBOX_PROXY_PROVIDER_ID) {
|
|
266132
266463
|
delete config5.model_provider;
|
|
266133
266464
|
}
|
|
266134
|
-
if (!
|
|
266465
|
+
if (!isRecord20(config5.model_providers)) {
|
|
266135
266466
|
return;
|
|
266136
266467
|
}
|
|
266137
266468
|
const modelProviders = { ...config5.model_providers };
|
|
@@ -271107,7 +271438,7 @@ var init_artifacts = __esm({
|
|
|
271107
271438
|
import path75 from "node:path";
|
|
271108
271439
|
import { randomUUID as randomUUID30 } from "node:crypto";
|
|
271109
271440
|
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,
|
|
271441
|
+
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
271442
|
var init_codex2 = __esm({
|
|
271112
271443
|
"src/devbox/commands/init/codex/index.ts"() {
|
|
271113
271444
|
"use strict";
|
|
@@ -271719,16 +272050,16 @@ ${execResult.stderr}`;
|
|
|
271719
272050
|
});
|
|
271720
272051
|
return artifacts.completionMessage;
|
|
271721
272052
|
};
|
|
271722
|
-
|
|
272053
|
+
isRecord21 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
271723
272054
|
readNonEmptyString8 = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
271724
272055
|
readFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
271725
272056
|
readManagedCodexTurnInterruptOrigin = (value) => value === "user_stop" || value === "queued_follow_up_send_now" || value === "system_runtime_recovery" || value === "unknown" ? value : null;
|
|
271726
272057
|
parseManagedCodexThreadState = (response, requestType) => {
|
|
271727
|
-
const payload =
|
|
271728
|
-
const threadRecord = payload &&
|
|
272058
|
+
const payload = isRecord21(response.result) ? response.result : null;
|
|
272059
|
+
const threadRecord = payload && isRecord21(payload.thread) ? payload.thread : null;
|
|
271729
272060
|
const threadId2 = readNonEmptyString8(threadRecord?.id);
|
|
271730
272061
|
const updatedAt = readFiniteNumber(threadRecord?.updatedAt);
|
|
271731
|
-
const statusRecord = threadRecord &&
|
|
272062
|
+
const statusRecord = threadRecord && isRecord21(threadRecord.status) ? threadRecord.status : null;
|
|
271732
272063
|
const statusType = statusRecord?.type;
|
|
271733
272064
|
const activeFlags = statusRecord?.type === "active" && Array.isArray(statusRecord.activeFlags) ? statusRecord.activeFlags.filter(
|
|
271734
272065
|
(flag2) => flag2 === "waitingOnApproval" || flag2 === "waitingOnUserInput"
|
|
@@ -271736,7 +272067,7 @@ ${execResult.stderr}`;
|
|
|
271736
272067
|
const rawTurns = Array.isArray(threadRecord?.turns) ? threadRecord.turns : [];
|
|
271737
272068
|
const turns = [];
|
|
271738
272069
|
for (const value of rawTurns) {
|
|
271739
|
-
if (!
|
|
272070
|
+
if (!isRecord21(value)) {
|
|
271740
272071
|
throw new Error(
|
|
271741
272072
|
`Managed Codex ${requestType} returned an invalid turn payload.`
|
|
271742
272073
|
);
|
|
@@ -271751,7 +272082,7 @@ ${execResult.stderr}`;
|
|
|
271751
272082
|
}
|
|
271752
272083
|
const items = [];
|
|
271753
272084
|
for (const itemValue of rawItems) {
|
|
271754
|
-
if (!
|
|
272085
|
+
if (!isRecord21(itemValue)) {
|
|
271755
272086
|
throw new Error(
|
|
271756
272087
|
`Managed Codex ${requestType} returned an invalid thread item payload.`
|
|
271757
272088
|
);
|
|
@@ -278125,7 +278456,7 @@ ${sshResult.stderr}`.trim();
|
|
|
278125
278456
|
});
|
|
278126
278457
|
|
|
278127
278458
|
// src/devbox/commands/servicesToml.ts
|
|
278128
|
-
var splitShellCommand, normalizeSectionName,
|
|
278459
|
+
var splitShellCommand, normalizeSectionName, isRecord22, asString3, asStringArray, asNumber, parseServicesToml, formatSectionName, renderServiceBlock, mergeServicesToml;
|
|
278129
278460
|
var init_servicesToml = __esm({
|
|
278130
278461
|
"src/devbox/commands/servicesToml.ts"() {
|
|
278131
278462
|
"use strict";
|
|
@@ -278181,7 +278512,7 @@ var init_servicesToml = __esm({
|
|
|
278181
278512
|
}
|
|
278182
278513
|
return trimmed;
|
|
278183
278514
|
};
|
|
278184
|
-
|
|
278515
|
+
isRecord22 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
278185
278516
|
asString3 = (value) => typeof value === "string" ? value : null;
|
|
278186
278517
|
asStringArray = (value) => {
|
|
278187
278518
|
if (!Array.isArray(value)) return null;
|
|
@@ -278205,14 +278536,14 @@ var init_servicesToml = __esm({
|
|
|
278205
278536
|
};
|
|
278206
278537
|
parseServicesToml = (content) => {
|
|
278207
278538
|
const parsed = parse7(content);
|
|
278208
|
-
if (!
|
|
278539
|
+
if (!isRecord22(parsed)) return {};
|
|
278209
278540
|
const servicesRoot = parsed.services;
|
|
278210
|
-
if (!
|
|
278541
|
+
if (!isRecord22(servicesRoot)) return {};
|
|
278211
278542
|
const services = {};
|
|
278212
278543
|
for (const [rawName, value] of Object.entries(servicesRoot)) {
|
|
278213
278544
|
const name = String(rawName);
|
|
278214
278545
|
if (!name) continue;
|
|
278215
|
-
if (!
|
|
278546
|
+
if (!isRecord22(value)) continue;
|
|
278216
278547
|
const entry = { name };
|
|
278217
278548
|
const cmd = asString3(value.cmd);
|
|
278218
278549
|
if (cmd) entry.cmd = cmd;
|
|
@@ -280363,7 +280694,7 @@ var init_setup = __esm({
|
|
|
280363
280694
|
init_args();
|
|
280364
280695
|
init_errors4();
|
|
280365
280696
|
init_controlPlane();
|
|
280366
|
-
|
|
280697
|
+
init_progressReport();
|
|
280367
280698
|
init_daemonClient();
|
|
280368
280699
|
init_logger3();
|
|
280369
280700
|
init_billingActivationGate();
|
|
@@ -281024,9 +281355,9 @@ var init_setup = __esm({
|
|
|
281024
281355
|
};
|
|
281025
281356
|
await saveConfig(config5, configOptions);
|
|
281026
281357
|
if (controlPlaneToken) {
|
|
281027
|
-
await
|
|
281358
|
+
await reportAgentInitStepBestEffort({
|
|
281028
281359
|
controlPlaneToken,
|
|
281029
|
-
|
|
281360
|
+
step: { command: "login", outcome: "ok", phase: null }
|
|
281030
281361
|
});
|
|
281031
281362
|
}
|
|
281032
281363
|
status.stage("Starting local boxes.dev service");
|
|
@@ -285844,7 +286175,7 @@ var init_provider = __esm({
|
|
|
285844
286175
|
});
|
|
285845
286176
|
|
|
285846
286177
|
// src/devbox/commands/init/claudeAuthProbe.ts
|
|
285847
|
-
var REMOTE_MANAGED_CLAUDE_PATH, CLAUDE_AUTH_PROBE_TIMEOUT_MS, CLAUDE_AUTH_PROBE_PROMPT,
|
|
286178
|
+
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
286179
|
var init_claudeAuthProbe = __esm({
|
|
285849
286180
|
"src/devbox/commands/init/claudeAuthProbe.ts"() {
|
|
285850
286181
|
"use strict";
|
|
@@ -285852,13 +286183,13 @@ var init_claudeAuthProbe = __esm({
|
|
|
285852
286183
|
REMOTE_MANAGED_CLAUDE_PATH = "/usr/local/bin/claude";
|
|
285853
286184
|
CLAUDE_AUTH_PROBE_TIMEOUT_MS = 45e3;
|
|
285854
286185
|
CLAUDE_AUTH_PROBE_PROMPT = "Reply with exactly OK";
|
|
285855
|
-
|
|
286186
|
+
isRecord23 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
285856
286187
|
normalizeWhitespace = (value) => value.trim().replace(/\s+/g, " ");
|
|
285857
286188
|
readAssistantMessageText = (frame) => {
|
|
285858
|
-
const message =
|
|
286189
|
+
const message = isRecord23(frame.message) ? frame.message : null;
|
|
285859
286190
|
const content = Array.isArray(message?.content) ? message.content : [];
|
|
285860
286191
|
const text = content.map((entry) => {
|
|
285861
|
-
if (!
|
|
286192
|
+
if (!isRecord23(entry) || entry.type !== "text") {
|
|
285862
286193
|
return null;
|
|
285863
286194
|
}
|
|
285864
286195
|
return typeof entry.text === "string" ? entry.text.trim() : null;
|
|
@@ -285892,7 +286223,7 @@ var init_claudeAuthProbe = __esm({
|
|
|
285892
286223
|
} catch {
|
|
285893
286224
|
continue;
|
|
285894
286225
|
}
|
|
285895
|
-
if (!
|
|
286226
|
+
if (!isRecord23(parsed)) {
|
|
285896
286227
|
continue;
|
|
285897
286228
|
}
|
|
285898
286229
|
if (parsed.type === "assistant") {
|
|
@@ -296152,4 +296483,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
296152
296483
|
*)
|
|
296153
296484
|
*/
|
|
296154
296485
|
|
|
296155
|
-
//# debugId=
|
|
296486
|
+
//# debugId=9c41cadc-e81c-5aa4-9937-e5ea56beec3a
|