@boxes-dev/dvb 1.0.63 → 1.0.65
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/bin/dvb.cjs +311 -68
- package/dist/bin/dvb.cjs.map +1 -1
- package/dist/bin/dvbd.cjs +5 -5
- package/dist/devbox/commands/init/codex/index.d.ts +3 -2
- package/dist/devbox/commands/init/codex/index.d.ts.map +1 -1
- package/dist/devbox/commands/init/codex/index.js +84 -24
- package/dist/devbox/commands/init/codex/index.js.map +1 -1
- package/dist/devbox/commands/init/codex/prompts.d.ts +1 -1
- package/dist/devbox/commands/init/codex/prompts.d.ts.map +1 -1
- package/dist/devbox/commands/init/codex/prompts.js +1 -1
- package/dist/devbox/commands/init/codex/prompts.js.map +1 -1
- package/dist/devbox/commands/init/codex/remote.d.ts +5 -2
- package/dist/devbox/commands/init/codex/remote.d.ts.map +1 -1
- package/dist/devbox/commands/init/codex/remote.js +4 -3
- package/dist/devbox/commands/init/codex/remote.js.map +1 -1
- package/dist/devbox/commands/init/finalizeFlow.d.ts.map +1 -1
- package/dist/devbox/commands/init/finalizeFlow.js +2 -1
- package/dist/devbox/commands/init/finalizeFlow.js.map +1 -1
- package/dist/devbox/commands/provider/modalLifecycle.d.ts.map +1 -1
- package/dist/devbox/commands/provider/modalLifecycle.js +169 -2
- package/dist/devbox/commands/provider/modalLifecycle.js.map +1 -1
- package/dist/prompts/remote-apply-modal.md +98 -0
- package/package.json +1 -1
package/dist/bin/dvb.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
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]="c3ed3072-4c93-5461-97f3-5f404303f107")}catch(e){}}();
|
|
4
4
|
|
|
5
5
|
var __create = Object.create;
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
@@ -88683,8 +88683,8 @@ var init_otel = __esm({
|
|
|
88683
88683
|
return trimmed && trimmed.length > 0 ? trimmed : void 0;
|
|
88684
88684
|
};
|
|
88685
88685
|
readBuildMetadata = () => {
|
|
88686
|
-
const rawPackageVersion = "1.0.
|
|
88687
|
-
const rawGitSha = "
|
|
88686
|
+
const rawPackageVersion = "1.0.65";
|
|
88687
|
+
const rawGitSha = "38e55fd1bc87f0994f09522d4e932ccef8b98c10";
|
|
88688
88688
|
const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
|
|
88689
88689
|
const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
|
|
88690
88690
|
return { packageVersion, gitSha };
|
|
@@ -120672,9 +120672,9 @@ var init_sentry = __esm({
|
|
|
120672
120672
|
sentryEnabled = false;
|
|
120673
120673
|
uncaughtExceptionMonitorInstalled = false;
|
|
120674
120674
|
readBuildMetadata2 = () => {
|
|
120675
|
-
const rawPackageVersion = "1.0.
|
|
120676
|
-
const rawGitSha = "
|
|
120677
|
-
const rawSentryRelease = "boxes-dev-dvb@1.0.
|
|
120675
|
+
const rawPackageVersion = "1.0.65";
|
|
120676
|
+
const rawGitSha = "38e55fd1bc87f0994f09522d4e932ccef8b98c10";
|
|
120677
|
+
const rawSentryRelease = "boxes-dev-dvb@1.0.65+38e55fd1bc87f0994f09522d4e932ccef8b98c10";
|
|
120678
120678
|
const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
|
|
120679
120679
|
const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
|
|
120680
120680
|
const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
|
|
@@ -130499,7 +130499,7 @@ var init_simple_client_node = __esm({
|
|
|
130499
130499
|
var http6 = __require("http");
|
|
130500
130500
|
var net5 = __require("net");
|
|
130501
130501
|
var tls2 = __require("tls");
|
|
130502
|
-
var { randomBytes, createHash:
|
|
130502
|
+
var { randomBytes, createHash: createHash5 } = __require("crypto");
|
|
130503
130503
|
var { Duplex, Readable: Readable2 } = __require("stream");
|
|
130504
130504
|
var { URL: URL2 } = __require("url");
|
|
130505
130505
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -131156,7 +131156,7 @@ var init_simple_client_node = __esm({
|
|
|
131156
131156
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
131157
131157
|
return;
|
|
131158
131158
|
}
|
|
131159
|
-
const digest =
|
|
131159
|
+
const digest = createHash5("sha1").update(key + GUID).digest("base64");
|
|
131160
131160
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
131161
131161
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
131162
131162
|
return;
|
|
@@ -131421,7 +131421,7 @@ var init_simple_client_node = __esm({
|
|
|
131421
131421
|
var EventEmitter = __require("events");
|
|
131422
131422
|
var http6 = __require("http");
|
|
131423
131423
|
var { Duplex } = __require("stream");
|
|
131424
|
-
var { createHash:
|
|
131424
|
+
var { createHash: createHash5 } = __require("crypto");
|
|
131425
131425
|
var extension = require_extension();
|
|
131426
131426
|
var PerMessageDeflate = require_permessage_deflate();
|
|
131427
131427
|
var subprotocol = require_subprotocol();
|
|
@@ -131716,7 +131716,7 @@ var init_simple_client_node = __esm({
|
|
|
131716
131716
|
);
|
|
131717
131717
|
}
|
|
131718
131718
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
131719
|
-
const digest =
|
|
131719
|
+
const digest = createHash5("sha1").update(key + GUID).digest("base64");
|
|
131720
131720
|
const headers = [
|
|
131721
131721
|
"HTTP/1.1 101 Switching Protocols",
|
|
131722
131722
|
"Upgrade: websocket",
|
|
@@ -198554,16 +198554,18 @@ var init_modalRuntime = __esm({
|
|
|
198554
198554
|
});
|
|
198555
198555
|
|
|
198556
198556
|
// src/devbox/commands/provider/modalLifecycle.ts
|
|
198557
|
-
var DEFAULT_APP_NAME, DEFAULT_MODAL_DEVBOX_IMAGE, DEFAULT_TIMEOUT_MS, SANDBOX_LIST_PAGE_LIMIT, MODAL_DAEMON_WRAPPER_PATH, MODAL_DAEMON_SUPERVISOR_ENTRYPOINT, FINISHED_STATUS_LABELS, trimEnv2, decodeJwtExpMs, createSafeModalAuthTokenManager, installSafeModalAuthTokenManager, parsePositiveInt, resolveRegions, resolveAppName, resolveModalSandboxTimeoutMs, isNotFoundError, isModalAlreadyExistsError, trimToNull, resolveControlPlaneToken, hasContextModalCredentialPair, shouldUseControlPlaneFallback, withModalClient, resolveModalApp, listSandboxesRaw, formatSandboxStatus, isRunningSandbox, resolveImageFromTag, provisionModalSandbox, findModalSandbox, terminateModalSandboxesByAlias;
|
|
198557
|
+
var import_node_crypto9, DEFAULT_APP_NAME, DEFAULT_MODAL_DEVBOX_IMAGE, DEFAULT_TIMEOUT_MS, IMAGE_TAG_RESOLUTION_CACHE_TTL_MS, SANDBOX_LIST_PAGE_LIMIT, MODAL_DAEMON_WRAPPER_PATH, MODAL_DAEMON_SUPERVISOR_ENTRYPOINT, FINISHED_STATUS_LABELS, REGISTRY_MANIFEST_ACCEPT_HEADER, resolvedImageTagCache, trimEnv2, parseRegistryImageTag, parseWwwAuthenticateBearer, fetchRegistryToken, resolveLatestImageTagToDigest, resolveImageTagForBuild, decodeJwtExpMs, createSafeModalAuthTokenManager, installSafeModalAuthTokenManager, parsePositiveInt, resolveRegions, resolveAppName, resolveModalSandboxTimeoutMs, isNotFoundError, isModalAlreadyExistsError, trimToNull, resolveControlPlaneToken, hasContextModalCredentialPair, shouldUseControlPlaneFallback, withModalClient, resolveModalApp, listSandboxesRaw, formatSandboxStatus, isRunningSandbox, resolveImageFromTag, provisionModalSandbox, findModalSandbox, terminateModalSandboxesByAlias;
|
|
198558
198558
|
var init_modalLifecycle = __esm({
|
|
198559
198559
|
"src/devbox/commands/provider/modalLifecycle.ts"() {
|
|
198560
198560
|
"use strict";
|
|
198561
198561
|
init_src();
|
|
198562
|
+
import_node_crypto9 = require("node:crypto");
|
|
198562
198563
|
init_dist5();
|
|
198563
198564
|
init_controlPlane();
|
|
198564
198565
|
DEFAULT_APP_NAME = "sandbox-modal-smoke";
|
|
198565
198566
|
DEFAULT_MODAL_DEVBOX_IMAGE = "public.ecr.aws/d8m4p4w9/modal-devbox:latest";
|
|
198566
198567
|
DEFAULT_TIMEOUT_MS = 24 * 60 * 60 * 1e3;
|
|
198568
|
+
IMAGE_TAG_RESOLUTION_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
198567
198569
|
SANDBOX_LIST_PAGE_LIMIT = 100;
|
|
198568
198570
|
MODAL_DAEMON_WRAPPER_PATH = "/home/sprite/.devbox/daemon/run-daemon.sh";
|
|
198569
198571
|
MODAL_DAEMON_SUPERVISOR_ENTRYPOINT = [
|
|
@@ -198590,7 +198592,178 @@ var init_modalLifecycle = __esm({
|
|
|
198590
198592
|
6: "internal_failure",
|
|
198591
198593
|
7: "idle_timeout"
|
|
198592
198594
|
};
|
|
198595
|
+
REGISTRY_MANIFEST_ACCEPT_HEADER = [
|
|
198596
|
+
"application/vnd.oci.image.index.v1+json",
|
|
198597
|
+
"application/vnd.oci.image.manifest.v1+json",
|
|
198598
|
+
"application/vnd.docker.distribution.manifest.list.v2+json",
|
|
198599
|
+
"application/vnd.docker.distribution.manifest.v2+json"
|
|
198600
|
+
].join(", ");
|
|
198601
|
+
resolvedImageTagCache = /* @__PURE__ */ new Map();
|
|
198593
198602
|
trimEnv2 = (value) => value?.trim() ?? "";
|
|
198603
|
+
parseRegistryImageTag = (imageTag) => {
|
|
198604
|
+
const trimmed = imageTag.trim();
|
|
198605
|
+
if (!trimmed || trimmed.includes("@")) {
|
|
198606
|
+
return null;
|
|
198607
|
+
}
|
|
198608
|
+
const lastSlashIndex = trimmed.lastIndexOf("/");
|
|
198609
|
+
const lastColonIndex = trimmed.lastIndexOf(":");
|
|
198610
|
+
if (lastColonIndex <= lastSlashIndex) {
|
|
198611
|
+
return null;
|
|
198612
|
+
}
|
|
198613
|
+
const repositoryWithHost = trimmed.slice(0, lastColonIndex);
|
|
198614
|
+
const tag = trimmed.slice(lastColonIndex + 1).trim();
|
|
198615
|
+
if (!repositoryWithHost || !tag) {
|
|
198616
|
+
return null;
|
|
198617
|
+
}
|
|
198618
|
+
const firstSlashIndex = repositoryWithHost.indexOf("/");
|
|
198619
|
+
if (firstSlashIndex <= 0) {
|
|
198620
|
+
return null;
|
|
198621
|
+
}
|
|
198622
|
+
const registryHost = repositoryWithHost.slice(0, firstSlashIndex);
|
|
198623
|
+
const repository = repositoryWithHost.slice(firstSlashIndex + 1);
|
|
198624
|
+
if (!repository) {
|
|
198625
|
+
return null;
|
|
198626
|
+
}
|
|
198627
|
+
const hasExplicitRegistryHost = registryHost.includes(".") || registryHost.includes(":") || registryHost === "localhost";
|
|
198628
|
+
if (!hasExplicitRegistryHost) {
|
|
198629
|
+
return null;
|
|
198630
|
+
}
|
|
198631
|
+
return {
|
|
198632
|
+
registryHost,
|
|
198633
|
+
repository,
|
|
198634
|
+
tag,
|
|
198635
|
+
repositoryWithHost
|
|
198636
|
+
};
|
|
198637
|
+
};
|
|
198638
|
+
parseWwwAuthenticateBearer = (headerValue) => {
|
|
198639
|
+
const trimmed = headerValue.trim();
|
|
198640
|
+
if (!trimmed.toLowerCase().startsWith("bearer ")) {
|
|
198641
|
+
return null;
|
|
198642
|
+
}
|
|
198643
|
+
const attributes = /* @__PURE__ */ new Map();
|
|
198644
|
+
for (const match2 of trimmed.slice("bearer ".length).matchAll(/([A-Za-z0-9_-]+)="([^"]*)"/g)) {
|
|
198645
|
+
const [, key, value] = match2;
|
|
198646
|
+
if (!key) {
|
|
198647
|
+
continue;
|
|
198648
|
+
}
|
|
198649
|
+
attributes.set(key.toLowerCase(), value ?? "");
|
|
198650
|
+
}
|
|
198651
|
+
const realm = attributes.get("realm");
|
|
198652
|
+
const service = attributes.get("service");
|
|
198653
|
+
const scope = attributes.get("scope");
|
|
198654
|
+
if (!realm || !service) {
|
|
198655
|
+
return null;
|
|
198656
|
+
}
|
|
198657
|
+
return {
|
|
198658
|
+
realm,
|
|
198659
|
+
service,
|
|
198660
|
+
scope: scope || null
|
|
198661
|
+
};
|
|
198662
|
+
};
|
|
198663
|
+
fetchRegistryToken = async ({
|
|
198664
|
+
realm,
|
|
198665
|
+
service,
|
|
198666
|
+
scope
|
|
198667
|
+
}) => {
|
|
198668
|
+
const tokenUrl = new URL(realm);
|
|
198669
|
+
tokenUrl.searchParams.set("service", service);
|
|
198670
|
+
if (scope) {
|
|
198671
|
+
tokenUrl.searchParams.set("scope", scope);
|
|
198672
|
+
}
|
|
198673
|
+
const response = await fetch(tokenUrl.toString());
|
|
198674
|
+
if (!response.ok) {
|
|
198675
|
+
throw new Error(
|
|
198676
|
+
`Container registry auth token request failed (${response.status}).`
|
|
198677
|
+
);
|
|
198678
|
+
}
|
|
198679
|
+
const payload = await response.json();
|
|
198680
|
+
const token = typeof payload.token === "string" ? payload.token.trim() : typeof payload.access_token === "string" ? payload.access_token.trim() : "";
|
|
198681
|
+
if (!token) {
|
|
198682
|
+
throw new Error("Container registry auth token response was empty.");
|
|
198683
|
+
}
|
|
198684
|
+
return token;
|
|
198685
|
+
};
|
|
198686
|
+
resolveLatestImageTagToDigest = async (parsed) => {
|
|
198687
|
+
const manifestUrl = `https://${parsed.registryHost}/v2/${parsed.repository}/manifests/${encodeURIComponent(parsed.tag)}`;
|
|
198688
|
+
const fetchManifest = async ({
|
|
198689
|
+
method,
|
|
198690
|
+
token: token2
|
|
198691
|
+
}) => {
|
|
198692
|
+
const headers = {
|
|
198693
|
+
Accept: REGISTRY_MANIFEST_ACCEPT_HEADER
|
|
198694
|
+
};
|
|
198695
|
+
if (token2) {
|
|
198696
|
+
headers.Authorization = `Bearer ${token2}`;
|
|
198697
|
+
}
|
|
198698
|
+
return await fetch(manifestUrl, {
|
|
198699
|
+
headers,
|
|
198700
|
+
method
|
|
198701
|
+
});
|
|
198702
|
+
};
|
|
198703
|
+
let token = null;
|
|
198704
|
+
let headResponse = await fetchManifest({ method: "HEAD" });
|
|
198705
|
+
if (headResponse.status === 401) {
|
|
198706
|
+
const authHeader = headResponse.headers.get("www-authenticate") ?? "";
|
|
198707
|
+
const challenge = parseWwwAuthenticateBearer(authHeader);
|
|
198708
|
+
if (!challenge) {
|
|
198709
|
+
throw new Error(
|
|
198710
|
+
`Container registry auth challenge missing or invalid for ${parsed.repositoryWithHost}:${parsed.tag}.`
|
|
198711
|
+
);
|
|
198712
|
+
}
|
|
198713
|
+
token = await fetchRegistryToken(challenge);
|
|
198714
|
+
headResponse = await fetchManifest({
|
|
198715
|
+
method: "HEAD",
|
|
198716
|
+
token
|
|
198717
|
+
});
|
|
198718
|
+
}
|
|
198719
|
+
if (!headResponse.ok) {
|
|
198720
|
+
throw new Error(
|
|
198721
|
+
`Container registry manifest lookup failed for ${parsed.repositoryWithHost}:${parsed.tag} (${headResponse.status}).`
|
|
198722
|
+
);
|
|
198723
|
+
}
|
|
198724
|
+
const headDigest = headResponse.headers.get("docker-content-digest")?.trim();
|
|
198725
|
+
if (headDigest) {
|
|
198726
|
+
return `${parsed.repositoryWithHost}@${headDigest}`;
|
|
198727
|
+
}
|
|
198728
|
+
const getResponse = await fetchManifest(
|
|
198729
|
+
token ? {
|
|
198730
|
+
method: "GET",
|
|
198731
|
+
token
|
|
198732
|
+
} : {
|
|
198733
|
+
method: "GET"
|
|
198734
|
+
}
|
|
198735
|
+
);
|
|
198736
|
+
if (!getResponse.ok) {
|
|
198737
|
+
throw new Error(
|
|
198738
|
+
`Container registry manifest body lookup failed for ${parsed.repositoryWithHost}:${parsed.tag} (${getResponse.status}).`
|
|
198739
|
+
);
|
|
198740
|
+
}
|
|
198741
|
+
const headerDigest = getResponse.headers.get("docker-content-digest")?.trim();
|
|
198742
|
+
if (headerDigest) {
|
|
198743
|
+
return `${parsed.repositoryWithHost}@${headerDigest}`;
|
|
198744
|
+
}
|
|
198745
|
+
const manifestBytes = Buffer.from(await getResponse.arrayBuffer());
|
|
198746
|
+
const bodyDigest = `sha256:${(0, import_node_crypto9.createHash)("sha256").update(manifestBytes).digest("hex")}`;
|
|
198747
|
+
return `${parsed.repositoryWithHost}@${bodyDigest}`;
|
|
198748
|
+
};
|
|
198749
|
+
resolveImageTagForBuild = async (imageTag) => {
|
|
198750
|
+
const parsed = parseRegistryImageTag(imageTag);
|
|
198751
|
+
if (!parsed || parsed.tag !== "latest") {
|
|
198752
|
+
return imageTag;
|
|
198753
|
+
}
|
|
198754
|
+
const cacheKey = `${parsed.repositoryWithHost}:${parsed.tag}`;
|
|
198755
|
+
const now = Date.now();
|
|
198756
|
+
const cached = resolvedImageTagCache.get(cacheKey);
|
|
198757
|
+
if (cached && cached.expiresAt > now) {
|
|
198758
|
+
return cached.value;
|
|
198759
|
+
}
|
|
198760
|
+
const resolved = await resolveLatestImageTagToDigest(parsed);
|
|
198761
|
+
resolvedImageTagCache.set(cacheKey, {
|
|
198762
|
+
value: resolved,
|
|
198763
|
+
expiresAt: now + IMAGE_TAG_RESOLUTION_CACHE_TTL_MS
|
|
198764
|
+
});
|
|
198765
|
+
return resolved;
|
|
198766
|
+
};
|
|
198594
198767
|
decodeJwtExpMs = (token) => {
|
|
198595
198768
|
const segments = token.split(".");
|
|
198596
198769
|
if (segments.length < 2) return null;
|
|
@@ -198781,6 +198954,7 @@ var init_modalLifecycle = __esm({
|
|
|
198781
198954
|
const appName = resolveAppName();
|
|
198782
198955
|
const envImageTag = trimEnv2(process.env.MODAL_SANDBOX_IMAGE);
|
|
198783
198956
|
const imageTag = envImageTag || DEFAULT_MODAL_DEVBOX_IMAGE;
|
|
198957
|
+
const resolvedImageTag = await resolveImageTagForBuild(imageTag);
|
|
198784
198958
|
const timeoutMs = resolveModalSandboxTimeoutMs();
|
|
198785
198959
|
const timeoutSecs = Math.max(1, Math.floor(timeoutMs / 1e3));
|
|
198786
198960
|
const regions = resolveRegions();
|
|
@@ -198793,7 +198967,7 @@ var init_modalLifecycle = __esm({
|
|
|
198793
198967
|
const image = await resolveImageFromTag(modal, tag);
|
|
198794
198968
|
return await image.build({ appId: app.appId });
|
|
198795
198969
|
};
|
|
198796
|
-
const builtImage = await buildImage(
|
|
198970
|
+
const builtImage = await buildImage(resolvedImageTag);
|
|
198797
198971
|
const createResponse = await modal.cpClient.sandboxCreate({
|
|
198798
198972
|
appId: app.appId,
|
|
198799
198973
|
definition: {
|
|
@@ -198809,7 +198983,7 @@ var init_modalLifecycle = __esm({
|
|
|
198809
198983
|
sandboxId: createResponse.sandboxId,
|
|
198810
198984
|
appId: app.appId,
|
|
198811
198985
|
appName,
|
|
198812
|
-
imageTag,
|
|
198986
|
+
imageTag: resolvedImageTag,
|
|
198813
198987
|
timeoutMs,
|
|
198814
198988
|
memorySnapshotEnabled: false,
|
|
198815
198989
|
regions
|
|
@@ -199597,12 +199771,12 @@ var init_sessionUtils = __esm({
|
|
|
199597
199771
|
});
|
|
199598
199772
|
|
|
199599
199773
|
// src/devbox/commands/connect.ts
|
|
199600
|
-
var import_node_child_process4,
|
|
199774
|
+
var import_node_child_process4, import_node_crypto10, import_node_os9, import_node_path16, import_node_readline3, import_promises13, resolveInitialSessionId, shouldAttachToExistingSession, resolveSessionSpecifierFromExplicitTarget, isAttachReplacedCloseCode, shouldCancelConnectOnSigint, DEFAULT_TTY_COLS, DEFAULT_TTY_ROWS, TERMINAL_INPUT_MODE_RESET, resetTerminalInputModes, openBrowser2, warnSetupStatus, resolveTtyEnv, formatEnvExports, parseEnvSize, readStreamSize, resolveTtySize, resolveSessionEnv, parseReachabilityState, runCommand, checkReachability, watchReachabilityWithScutil, watchReachabilityWithNotifyutil, waitForNetworkOnline, parseConnectArgs, parseConnectTarget, isSessionNotFoundError, SESSION_NAME_TOKEN_KEY, encodeSessionNameToken, decodeSessionNameToken, extractSessionNameFromCommand, SESSION_LOG_FLUSH_BYTES, SESSION_LOG_EOF_MARKER, createRemoteSessionLogSink, CONNECT_SHELL_CANDIDATES, resolveConnectShell, confirmNewSession, promptRenameSession, HEARTBEAT_INTERVAL_MS, HEARTBEAT_TIMEOUT_MS, INPUT_PROBE_TIMEOUT_MS, STREAM_STALL_PROBE_MISS_THRESHOLD, CONNECT_OPEN_TIMEOUT_MS, WS_OPEN_STATE, streamExecSession, runConnect;
|
|
199601
199775
|
var init_connect2 = __esm({
|
|
199602
199776
|
"src/devbox/commands/connect.ts"() {
|
|
199603
199777
|
"use strict";
|
|
199604
199778
|
import_node_child_process4 = require("node:child_process");
|
|
199605
|
-
|
|
199779
|
+
import_node_crypto10 = require("node:crypto");
|
|
199606
199780
|
import_node_os9 = __toESM(require("node:os"), 1);
|
|
199607
199781
|
import_node_path16 = require("node:path");
|
|
199608
199782
|
import_node_readline3 = require("node:readline");
|
|
@@ -201025,7 +201199,7 @@ var init_connect2 = __esm({
|
|
|
201025
201199
|
const weztermPane = process.env.WEZTERM_PANE?.trim() || "";
|
|
201026
201200
|
const weztermSocket = process.env.WEZTERM_UNIX_SOCKET?.trim() || "";
|
|
201027
201201
|
const weztermSessionId = weztermPane ? `wezterm:${weztermPane}${weztermSocket ? `:${(0, import_node_path16.basename)(weztermSocket)}` : ""}` : "";
|
|
201028
|
-
const terminalSessionId = process.env.DEVBOX_TERM_SESSION_ID?.trim() || weztermSessionId || process.env.TERM_SESSION_ID?.trim() || process.env.ITERM_SESSION_ID?.trim() || `dvb-${(0,
|
|
201202
|
+
const terminalSessionId = process.env.DEVBOX_TERM_SESSION_ID?.trim() || weztermSessionId || process.env.TERM_SESSION_ID?.trim() || process.env.ITERM_SESSION_ID?.trim() || `dvb-${(0, import_node_crypto10.randomUUID)()}`;
|
|
201029
201203
|
const logPath = shouldLog2 && sessionName ? buildSessionLogPath(sessionName) : null;
|
|
201030
201204
|
const modalSessionLogPath = computeProvider === "modal" ? logPath : null;
|
|
201031
201205
|
const sessionLogSink = logPath && computeProvider !== "modal" ? createRemoteSessionLogSink(client2, spriteAlias, logPath) : null;
|
|
@@ -202744,11 +202918,11 @@ var init_session3 = __esm({
|
|
|
202744
202918
|
});
|
|
202745
202919
|
|
|
202746
202920
|
// src/devbox/commands/init/repo.ts
|
|
202747
|
-
var
|
|
202921
|
+
var import_node_crypto11, import_node_child_process5, import_node_path20, buildSpawnEnv, runCommand2, runCommandRaw, findRepoRoot, readRepoOrigin, readLocalGitConfigValue, writeLocalGitConfigValue, ensureRepoProjectId, resolveGitCommonDir, readHeadState, readNullSeparatedPaths, readWorktreeState, confirmCopyWorktree, readGlobalGitConfigFiles, mapGlobalGitConfigDestinations;
|
|
202748
202922
|
var init_repo2 = __esm({
|
|
202749
202923
|
"src/devbox/commands/init/repo.ts"() {
|
|
202750
202924
|
"use strict";
|
|
202751
|
-
|
|
202925
|
+
import_node_crypto11 = require("node:crypto");
|
|
202752
202926
|
import_node_child_process5 = require("node:child_process");
|
|
202753
202927
|
import_node_path20 = __toESM(require("node:path"), 1);
|
|
202754
202928
|
init_dist3();
|
|
@@ -202835,7 +203009,7 @@ var init_repo2 = __esm({
|
|
|
202835
203009
|
const key = "devbox.projectId";
|
|
202836
203010
|
const existing = await readLocalGitConfigValue(repoRoot, key);
|
|
202837
203011
|
if (existing) return existing;
|
|
202838
|
-
const created = (0,
|
|
203012
|
+
const created = (0, import_node_crypto11.randomUUID)();
|
|
202839
203013
|
await writeLocalGitConfigValue(repoRoot, key, created);
|
|
202840
203014
|
return created;
|
|
202841
203015
|
};
|
|
@@ -203009,11 +203183,11 @@ var init_config2 = __esm({
|
|
|
203009
203183
|
});
|
|
203010
203184
|
|
|
203011
203185
|
// src/devbox/commands/init/remote.ts
|
|
203012
|
-
var
|
|
203186
|
+
var import_node_crypto12, DAEMON_DIR, DAEMON_TARBALL, DAEMON_BUNDLE_DIR, DAEMON_ENTRY, DAEMON_WRAPPER, DAEMON_SERVICE_NAME, DAEMON_CONFIG_FILE, MODAL_DAEMON_HEALTH_PORT, DEFAULT_DAEMON_BASE_URL, DEFAULT_HEARTBEAT_MS, BOOTSTRAP_EXEC_TIMEOUT_MS, BOOTSTRAP_EXEC_HANDSHAKE_TIMEOUT_MS, BASHRC_PATH, ZSHRC_PATH, CODEX_CONFIG_DIR, CODEX_CONFIG_PATH, BASIC_ALIASES_MARKER, LEGACY_BASH_TRAP, SAFE_BASH_TRAP, BASH_HISTORY_BLOCK, ZSH_HISTORY_BLOCK, HISTORY_BLOCK_PATTERN, BASH_HISTORY_LINE_PATTERN, ZSH_HISTORY_LINE_PATTERN, logger8, truncateTail, shellQuote3, expandHome2, execWithLog, writeRemoteFile, readRemoteFile, ensureTrailingNewline, upsertHistoryBlock, patchBashrcContent, patchZshrcContent, bootstrapDevbox, buildWeztermMuxConfig, buildWeztermMuxRunner, patchRemoteRcFile, patchBashrc, patchZshrc, ensureRemoteCodexConfig, stageRemoteSetupArtifacts, resolveDaemonUrl, fetchDaemonBinary, buildDaemonConfig, buildDaemonWrapperScript, isSameArgs, ensureSpriteDaemonService, installWeztermMux, ensureWeztermMuxService, hasWeztermMuxBinary, isWeztermMuxHealthy, installSpriteDaemon;
|
|
203013
203187
|
var init_remote = __esm({
|
|
203014
203188
|
"src/devbox/commands/init/remote.ts"() {
|
|
203015
203189
|
"use strict";
|
|
203016
|
-
|
|
203190
|
+
import_node_crypto12 = require("node:crypto");
|
|
203017
203191
|
init_src();
|
|
203018
203192
|
init_weztermMux();
|
|
203019
203193
|
init_config2();
|
|
@@ -203070,7 +203244,7 @@ var init_remote = __esm({
|
|
|
203070
203244
|
return value;
|
|
203071
203245
|
};
|
|
203072
203246
|
execWithLog = async (client2, spriteAlias, script, stage, options) => {
|
|
203073
|
-
const requestId = (0,
|
|
203247
|
+
const requestId = (0, import_node_crypto12.randomUUID)();
|
|
203074
203248
|
const startedAt2 = Date.now();
|
|
203075
203249
|
logger8.info("sprites_request", {
|
|
203076
203250
|
requestId,
|
|
@@ -203104,7 +203278,7 @@ var init_remote = __esm({
|
|
|
203104
203278
|
return result;
|
|
203105
203279
|
};
|
|
203106
203280
|
writeRemoteFile = async (client2, spriteAlias, path37, content, stage) => {
|
|
203107
|
-
const requestId = (0,
|
|
203281
|
+
const requestId = (0, import_node_crypto12.randomUUID)();
|
|
203108
203282
|
logger8.info("sprites_request", {
|
|
203109
203283
|
requestId,
|
|
203110
203284
|
method: "writeFile",
|
|
@@ -203124,7 +203298,7 @@ var init_remote = __esm({
|
|
|
203124
203298
|
});
|
|
203125
203299
|
};
|
|
203126
203300
|
readRemoteFile = async (client2, spriteAlias, path37, stage) => {
|
|
203127
|
-
const requestId = (0,
|
|
203301
|
+
const requestId = (0, import_node_crypto12.randomUUID)();
|
|
203128
203302
|
logger8.info("sprites_request", {
|
|
203129
203303
|
requestId,
|
|
203130
203304
|
method: "readFile",
|
|
@@ -204671,7 +204845,7 @@ var init_prompts = __esm({
|
|
|
204671
204845
|
});
|
|
204672
204846
|
|
|
204673
204847
|
// src/devbox/commands/init/codex/remote.ts
|
|
204674
|
-
var import_node_child_process8, stripAnsi2, extractBoldText, extractAuthUrl, extractLocalPort, isRelayForbidden, isRelayMissingOpenAiProxyConfiguration, buildEntrypointsBlock, renderRemoteApplyPromptFromTemplate, renderRemoteApplyPrompt, openBrowser3, ensureRemoteCodexInstalled, isRemoteCodexLoggedIn, runRemoteCodexLogin, runRemoteCodexExec;
|
|
204848
|
+
var import_node_child_process8, stripAnsi2, extractBoldText, extractAuthUrl, extractLocalPort, isRelayForbidden, isRelayMissingOpenAiProxyConfiguration, buildEntrypointsBlock, resolveRemoteApplyTemplateName, renderRemoteApplyPromptFromTemplate, renderRemoteApplyPrompt, openBrowser3, ensureRemoteCodexInstalled, isRemoteCodexLoggedIn, runRemoteCodexLogin, runRemoteCodexExec;
|
|
204675
204849
|
var init_remote2 = __esm({
|
|
204676
204850
|
"src/devbox/commands/init/codex/remote.ts"() {
|
|
204677
204851
|
"use strict";
|
|
@@ -204716,6 +204890,7 @@ var init_remote2 = __esm({
|
|
|
204716
204890
|
];
|
|
204717
204891
|
return lines.join("\n");
|
|
204718
204892
|
};
|
|
204893
|
+
resolveRemoteApplyTemplateName = (computeProvider) => computeProvider === "modal" ? "remote-apply-modal.md" : "remote-apply.md";
|
|
204719
204894
|
renderRemoteApplyPromptFromTemplate = ({
|
|
204720
204895
|
template,
|
|
204721
204896
|
setupPath,
|
|
@@ -204732,9 +204907,12 @@ var init_remote2 = __esm({
|
|
|
204732
204907
|
setupPath,
|
|
204733
204908
|
artifactsBundle,
|
|
204734
204909
|
artifactsManifest,
|
|
204735
|
-
entrypoints
|
|
204910
|
+
entrypoints,
|
|
204911
|
+
computeProvider
|
|
204736
204912
|
}) => {
|
|
204737
|
-
const template = await readPromptTemplate(
|
|
204913
|
+
const template = await readPromptTemplate(
|
|
204914
|
+
resolveRemoteApplyTemplateName(computeProvider)
|
|
204915
|
+
);
|
|
204738
204916
|
return renderRemoteApplyPromptFromTemplate({
|
|
204739
204917
|
template,
|
|
204740
204918
|
setupPath,
|
|
@@ -206338,11 +206516,11 @@ ${usageText}`;
|
|
|
206338
206516
|
});
|
|
206339
206517
|
|
|
206340
206518
|
// src/devbox/commands/init/codex/artifacts.ts
|
|
206341
|
-
var
|
|
206519
|
+
var import_node_crypto13, import_node_fs10, import_promises23, import_node_path26, import_node_os13, macCopyfileDisabledEnv, SETUP_ARTIFACT_PART_SIZE_BYTES, SETUP_ARTIFACT_PARTS_DIRNAME, SETUP_ARTIFACT_PARTS_DESCRIPTOR_FILENAME, isWithinRepo, normalizeExternalPath, expandHomePath, buildArtifactEntry, buildEntries, copyArtifact, sha256File, readSetupArtifactsPartsDescriptor, createSetupArtifacts;
|
|
206342
206520
|
var init_artifacts = __esm({
|
|
206343
206521
|
"src/devbox/commands/init/codex/artifacts.ts"() {
|
|
206344
206522
|
"use strict";
|
|
206345
|
-
|
|
206523
|
+
import_node_crypto13 = require("node:crypto");
|
|
206346
206524
|
import_node_fs10 = require("node:fs");
|
|
206347
206525
|
import_promises23 = __toESM(require("node:fs/promises"), 1);
|
|
206348
206526
|
import_node_path26 = __toESM(require("node:path"), 1);
|
|
@@ -206452,7 +206630,7 @@ var init_artifacts = __esm({
|
|
|
206452
206630
|
await import_promises23.default.cp(entry.sourcePath, destPath, { recursive: false });
|
|
206453
206631
|
};
|
|
206454
206632
|
sha256File = async (filePath) => await new Promise((resolve2, reject) => {
|
|
206455
|
-
const hash = (0,
|
|
206633
|
+
const hash = (0, import_node_crypto13.createHash)("sha256");
|
|
206456
206634
|
const stream = (0, import_node_fs10.createReadStream)(filePath);
|
|
206457
206635
|
stream.on("data", (chunk) => hash.update(chunk));
|
|
206458
206636
|
stream.on("error", reject);
|
|
@@ -206855,12 +207033,12 @@ var init_progress = __esm({
|
|
|
206855
207033
|
});
|
|
206856
207034
|
|
|
206857
207035
|
// src/devbox/commands/init/codex/index.ts
|
|
206858
|
-
var import_node_path27,
|
|
207036
|
+
var import_node_path27, import_node_crypto14, import_promises24, import_node_os14, CODEX_REQUEST_URL_REGEX2, extractRequestUrl2, isLoopbackRelayUrl2, resolveLocalCodexAuthPathCandidates, readLocalCodexAuthCache, syncLocalCodexAuthCacheToSprite, uploadSetupPlan, runRemoteCodexSetup;
|
|
206859
207037
|
var init_codex = __esm({
|
|
206860
207038
|
"src/devbox/commands/init/codex/index.ts"() {
|
|
206861
207039
|
"use strict";
|
|
206862
207040
|
import_node_path27 = __toESM(require("node:path"), 1);
|
|
206863
|
-
|
|
207041
|
+
import_node_crypto14 = require("node:crypto");
|
|
206864
207042
|
import_promises24 = __toESM(require("node:fs/promises"), 1);
|
|
206865
207043
|
import_node_os14 = require("node:os");
|
|
206866
207044
|
init_dist3();
|
|
@@ -206875,17 +207053,40 @@ var init_codex = __esm({
|
|
|
206875
207053
|
init_proxy2();
|
|
206876
207054
|
init_artifacts();
|
|
206877
207055
|
init_progress();
|
|
206878
|
-
|
|
206879
|
-
|
|
206880
|
-
|
|
207056
|
+
CODEX_REQUEST_URL_REGEX2 = /error sending request for url \(([^)]+)\)/i;
|
|
207057
|
+
extractRequestUrl2 = (value) => {
|
|
207058
|
+
const match2 = value.match(CODEX_REQUEST_URL_REGEX2);
|
|
207059
|
+
const url = match2?.[1]?.trim();
|
|
207060
|
+
return url && url.length > 0 ? url : null;
|
|
206881
207061
|
};
|
|
206882
|
-
|
|
206883
|
-
const authPath = import_node_path27.default.join(resolveLocalCodexRoot(), "auth.json");
|
|
207062
|
+
isLoopbackRelayUrl2 = (requestUrl) => {
|
|
206884
207063
|
try {
|
|
206885
|
-
|
|
207064
|
+
const url = new URL(requestUrl);
|
|
207065
|
+
return url.hostname === "127.0.0.1" || url.hostname === "localhost" || url.hostname === "::1";
|
|
206886
207066
|
} catch {
|
|
206887
|
-
return
|
|
207067
|
+
return false;
|
|
207068
|
+
}
|
|
207069
|
+
};
|
|
207070
|
+
resolveLocalCodexAuthPathCandidates = () => {
|
|
207071
|
+
const configured = (process.env.CODEX_HOME ?? "").trim();
|
|
207072
|
+
const defaultRoot = import_node_path27.default.join((0, import_node_os14.homedir)(), ".codex");
|
|
207073
|
+
const candidates = [import_node_path27.default.join(defaultRoot, "auth.json")];
|
|
207074
|
+
if (configured) {
|
|
207075
|
+
const configuredPath = import_node_path27.default.join(configured, "auth.json");
|
|
207076
|
+
if (!candidates.includes(configuredPath)) {
|
|
207077
|
+
candidates.unshift(configuredPath);
|
|
207078
|
+
}
|
|
206888
207079
|
}
|
|
207080
|
+
return candidates;
|
|
207081
|
+
};
|
|
207082
|
+
readLocalCodexAuthCache = async () => {
|
|
207083
|
+
for (const authPath of resolveLocalCodexAuthPathCandidates()) {
|
|
207084
|
+
try {
|
|
207085
|
+
return await import_promises24.default.readFile(authPath);
|
|
207086
|
+
} catch {
|
|
207087
|
+
}
|
|
207088
|
+
}
|
|
207089
|
+
return null;
|
|
206889
207090
|
};
|
|
206890
207091
|
syncLocalCodexAuthCacheToSprite = async ({
|
|
206891
207092
|
client: client2,
|
|
@@ -207101,7 +207302,7 @@ var init_codex = __esm({
|
|
|
207101
207302
|
}
|
|
207102
207303
|
if (splitArtifacts && remoteArtifactsBundlePath) {
|
|
207103
207304
|
status.stage("Assembling artifacts on remote");
|
|
207104
|
-
const assembledTmpPath = `${remoteArtifactsBundlePath}.tmp-assemble-${(0,
|
|
207305
|
+
const assembledTmpPath = `${remoteArtifactsBundlePath}.tmp-assemble-${(0, import_node_crypto14.randomUUID)()}`;
|
|
207105
207306
|
const assembleScript = [
|
|
207106
207307
|
"set -euo pipefail",
|
|
207107
207308
|
`bundle=${shellQuote3(remoteArtifactsBundlePath)}`,
|
|
@@ -207173,6 +207374,7 @@ var init_codex = __esm({
|
|
|
207173
207374
|
runRemoteCodexSetup = async ({
|
|
207174
207375
|
client: client2,
|
|
207175
207376
|
spriteAlias,
|
|
207377
|
+
computeProvider,
|
|
207176
207378
|
expandedWorkdir,
|
|
207177
207379
|
remoteSetupPath,
|
|
207178
207380
|
remoteArtifactsBundlePath,
|
|
@@ -207185,18 +207387,13 @@ var init_codex = __esm({
|
|
|
207185
207387
|
emitCodexOutput = true
|
|
207186
207388
|
}) => {
|
|
207187
207389
|
if (!proxyOptions) {
|
|
207390
|
+
await syncLocalCodexAuthCacheToSprite({
|
|
207391
|
+
client: client2,
|
|
207392
|
+
spriteAlias,
|
|
207393
|
+
status
|
|
207394
|
+
});
|
|
207188
207395
|
status.stage("Check Codex login");
|
|
207189
|
-
|
|
207190
|
-
if (!loggedIn) {
|
|
207191
|
-
const synced = await syncLocalCodexAuthCacheToSprite({
|
|
207192
|
-
client: client2,
|
|
207193
|
-
spriteAlias,
|
|
207194
|
-
status
|
|
207195
|
-
});
|
|
207196
|
-
if (synced) {
|
|
207197
|
-
loggedIn = await isRemoteCodexLoggedIn(client2, spriteAlias);
|
|
207198
|
-
}
|
|
207199
|
-
}
|
|
207396
|
+
const loggedIn = await isRemoteCodexLoggedIn(client2, spriteAlias);
|
|
207200
207397
|
if (!loggedIn) {
|
|
207201
207398
|
await requireDaemonFeatures(socketInfo.socketPath, ["ports"]);
|
|
207202
207399
|
status.stage("Waiting for Codex login");
|
|
@@ -207300,10 +207497,11 @@ codex login`
|
|
|
207300
207497
|
setupPath: remoteSetupPath,
|
|
207301
207498
|
artifactsBundle: remoteArtifactsBundlePath,
|
|
207302
207499
|
artifactsManifest: remoteArtifactsManifestPath,
|
|
207303
|
-
entrypoints
|
|
207500
|
+
entrypoints,
|
|
207501
|
+
computeProvider
|
|
207304
207502
|
});
|
|
207305
207503
|
const codexLastMessagePath = "/home/sprite/.devbox/codex-setup-output.txt";
|
|
207306
|
-
const proxyRoot = proxyOptions ? `/home/sprite/.devbox/tmp/codex-proxy-${(0,
|
|
207504
|
+
const proxyRoot = proxyOptions ? `/home/sprite/.devbox/tmp/codex-proxy-${(0, import_node_crypto14.randomUUID)()}` : null;
|
|
207307
207505
|
const proxyTokenPath = proxyRoot ? `${proxyRoot}/devbox-token` : null;
|
|
207308
207506
|
const proxyCodexHome = proxyRoot ? `${proxyRoot}/codex-home` : null;
|
|
207309
207507
|
const proxyConfigPath = proxyCodexHome ? `${proxyCodexHome}/config.toml` : null;
|
|
@@ -207454,15 +207652,59 @@ codex login`
|
|
|
207454
207652
|
};
|
|
207455
207653
|
writeCodexOutput(process.stdout, execResult?.stdout, "stdout");
|
|
207456
207654
|
writeCodexOutput(process.stderr, execResult?.stderr, "stderr");
|
|
207457
|
-
|
|
207655
|
+
let lastMessage = "";
|
|
207656
|
+
let lastMessageReadError = null;
|
|
207458
207657
|
try {
|
|
207459
207658
|
const bytes = await client2.readFile(spriteAlias, {
|
|
207460
207659
|
path: codexLastMessagePath
|
|
207461
207660
|
});
|
|
207462
|
-
|
|
207463
|
-
|
|
207661
|
+
lastMessage = Buffer.from(bytes).toString("utf8").trim();
|
|
207662
|
+
} catch (error2) {
|
|
207663
|
+
lastMessageReadError = error2 instanceof Error ? error2 : new Error(String(error2));
|
|
207664
|
+
}
|
|
207665
|
+
if (!lastMessage) {
|
|
207666
|
+
const combinedOutputRaw = `${execResult?.stdout ?? ""}
|
|
207667
|
+
${execResult?.stderr ?? ""}`;
|
|
207668
|
+
const combinedOutput = combinedOutputRaw.toLowerCase();
|
|
207669
|
+
if (combinedOutput.includes("401 unauthorized")) {
|
|
207670
|
+
throw new Error(
|
|
207671
|
+
"codex exec failed: remote Codex auth returned 401 unauthorized. Re-run `dvb setup --codex-auth byo` (or ensure proxy auth is configured), then retry with `dvb init --resume`."
|
|
207672
|
+
);
|
|
207673
|
+
}
|
|
207674
|
+
if (combinedOutput.includes("stream disconnected before completion")) {
|
|
207675
|
+
const requestUrl = extractRequestUrl2(combinedOutputRaw);
|
|
207676
|
+
if (requestUrl && isLoopbackRelayUrl2(requestUrl)) {
|
|
207677
|
+
throw new Error(
|
|
207678
|
+
`codex exec failed: local relay is unreachable at ${requestUrl}. Set a reachable remote relay URL (for example \`DEVBOX_REMOTE_RELAY_BASE_URL=https://relay.boxes.dev\`), run \`dvb setup\`, then retry with \`dvb init --resume\`.`
|
|
207679
|
+
);
|
|
207680
|
+
}
|
|
207681
|
+
const requestTarget = requestUrl ?? "relay /v1/responses endpoint";
|
|
207682
|
+
throw new Error(
|
|
207683
|
+
`codex exec failed: proxy stream disconnected before completion while calling ${requestTarget}. Ensure relay connectivity from the remote devbox, then retry with \`dvb init --resume\`.`
|
|
207684
|
+
);
|
|
207685
|
+
}
|
|
207686
|
+
if (combinedOutput.includes("no last agent message")) {
|
|
207687
|
+
throw new Error(
|
|
207688
|
+
"codex exec failed: Codex returned no final response. Setup was not applied; retry with `dvb init --resume`."
|
|
207689
|
+
);
|
|
207690
|
+
}
|
|
207691
|
+
if (lastMessageReadError) {
|
|
207692
|
+
throw new Error(
|
|
207693
|
+
"codex exec failed: missing Codex final output file. Setup may not have run; retry with `dvb init --resume`."
|
|
207694
|
+
);
|
|
207695
|
+
}
|
|
207696
|
+
throw new Error(
|
|
207697
|
+
"codex exec failed: empty Codex final response. Setup was not applied; retry with `dvb init --resume`."
|
|
207698
|
+
);
|
|
207699
|
+
}
|
|
207700
|
+
if (!emitCodexOutput) return;
|
|
207701
|
+
try {
|
|
207702
|
+
const stdoutText = execResult?.stdout ?? "";
|
|
207703
|
+
const stdoutHasAssistantTurn = /\nassistant(\n|$)/i.test(stdoutText);
|
|
207704
|
+
const shouldPrintLastMessage = !printedCodexStdout || !stdoutHasAssistantTurn || !stdoutText.includes(lastMessage);
|
|
207705
|
+
if (shouldPrintLastMessage) {
|
|
207464
207706
|
status.stop();
|
|
207465
|
-
process.stdout.write(`${
|
|
207707
|
+
process.stdout.write(`${lastMessage}
|
|
207466
207708
|
`);
|
|
207467
207709
|
}
|
|
207468
207710
|
} catch {
|
|
@@ -208915,11 +209157,11 @@ var init_provisionFlow = __esm({
|
|
|
208915
209157
|
});
|
|
208916
209158
|
|
|
208917
209159
|
// src/devbox/commands/init/ssh.ts
|
|
208918
|
-
var
|
|
209160
|
+
var import_node_crypto15, import_node_child_process10, logger9, SSH_IDENTITY_FILE, SSH_ED25519_PUBLIC_KEY_PATTERN, stripGitSuffix2, buildSshUrl, buildSettingsUrl, parseScpLike, parseGitRemote, execRemote, extractEd25519PublicKey, readRemoteOrigin, setRemoteOrigin, ensureSshKey, ensureSshConfig, verifySshAuth, openBrowser4, runClipboardCommand, copyToClipboard;
|
|
208919
209161
|
var init_ssh = __esm({
|
|
208920
209162
|
"src/devbox/commands/init/ssh.ts"() {
|
|
208921
209163
|
"use strict";
|
|
208922
|
-
|
|
209164
|
+
import_node_crypto15 = require("node:crypto");
|
|
208923
209165
|
import_node_child_process10 = require("node:child_process");
|
|
208924
209166
|
init_src();
|
|
208925
209167
|
init_remote();
|
|
@@ -209001,7 +209243,7 @@ var init_ssh = __esm({
|
|
|
209001
209243
|
return null;
|
|
209002
209244
|
};
|
|
209003
209245
|
execRemote = async (client2, spriteAlias, script, stage) => {
|
|
209004
|
-
const requestId = (0,
|
|
209246
|
+
const requestId = (0, import_node_crypto15.randomUUID)();
|
|
209005
209247
|
logger9.info("sprites_request", {
|
|
209006
209248
|
requestId,
|
|
209007
209249
|
method: "exec",
|
|
@@ -209873,7 +210115,7 @@ var init_finalizeFlow = __esm({
|
|
|
209873
210115
|
} else {
|
|
209874
210116
|
R2.warn("Could not copy the SSH key automatically.");
|
|
209875
210117
|
}
|
|
209876
|
-
const openBrowserPromptMessage = copied ? `
|
|
210118
|
+
const openBrowserPromptMessage = copied ? `SSH key copied to clipboard; click "Add SSH key". Open ${remoteInfo.host} SSH key page in your browser?` : `Open ${remoteInfo.host} SSH key page in your browser?`;
|
|
209877
210119
|
const shouldOpen = await promptBeforeOpenBrowser({
|
|
209878
210120
|
url: remoteInfo.settingsUrl,
|
|
209879
210121
|
title: `${remoteInfo.host} SSH key page`,
|
|
@@ -210096,6 +210338,7 @@ var init_finalizeFlow = __esm({
|
|
|
210096
210338
|
await runRemoteCodexSetup({
|
|
210097
210339
|
client: client2,
|
|
210098
210340
|
spriteAlias,
|
|
210341
|
+
computeProvider,
|
|
210099
210342
|
expandedWorkdir,
|
|
210100
210343
|
remoteSetupPath,
|
|
210101
210344
|
remoteArtifactsBundlePath,
|
|
@@ -215626,11 +215869,11 @@ var init_qr = __esm({
|
|
|
215626
215869
|
});
|
|
215627
215870
|
|
|
215628
215871
|
// src/devbox/commands/setup.ts
|
|
215629
|
-
var
|
|
215872
|
+
var import_node_crypto16, trim, normalizeOrgSlug, extractOrgFromSpriteToken, parseCodexAuthMode, parseSpriteAuthMode, resolveSpriteAuthMode, normalizeSiteUrl, resolveSiteUrl, MOBILE_DOWNLOAD_LINK, parseSetupArgs, splitQrLines, printMobileDownloadQr, printFirstSetupCompleteMessage, normalizeUrlForCompare, resolveHostForCompare, resolveCliName3, formatSpritesApiError, probeSpritesAccess, runSetup;
|
|
215630
215873
|
var init_setup = __esm({
|
|
215631
215874
|
"src/devbox/commands/setup.ts"() {
|
|
215632
215875
|
"use strict";
|
|
215633
|
-
|
|
215876
|
+
import_node_crypto16 = require("node:crypto");
|
|
215634
215877
|
init_src();
|
|
215635
215878
|
init_src();
|
|
215636
215879
|
init_auth();
|
|
@@ -215853,7 +216096,7 @@ var init_setup = __esm({
|
|
|
215853
216096
|
return lines.join("\n");
|
|
215854
216097
|
};
|
|
215855
216098
|
probeSpritesAccess = async (relayBaseUrl, token) => {
|
|
215856
|
-
const requestId = (0,
|
|
216099
|
+
const requestId = (0, import_node_crypto16.randomUUID)();
|
|
215857
216100
|
const url = new URL("/v1/sprites", relayBaseUrl);
|
|
215858
216101
|
url.searchParams.set("max_results", "1");
|
|
215859
216102
|
logger7.info("sprites_request", {
|
|
@@ -216458,11 +216701,11 @@ var init_whoami = __esm({
|
|
|
216458
216701
|
});
|
|
216459
216702
|
|
|
216460
216703
|
// src/devbox/commands/wezterm.ts
|
|
216461
|
-
var
|
|
216704
|
+
var import_node_crypto17, import_node_child_process12, import_promises32, import_node_os23, import_node_path37, import_promises33, logger10, WEZTERM_APP_PATH, WEZTERM_BIN_PATH, WEZTERM_BIN_DIR, WEZTERM_INSTALL_URL, WEZTERM_PATH_EXPORT, WEZTERM_HEALTH_POLL_INTERVAL_MS, WEZTERM_HEALTH_POLL_TIMEOUT_MS, WEZTERM_PROXY_BASE_ENV, WEZTERM_PROXY_LOG_NAME, WEZTERM_USAGE, parseWeztermArgs, resolveSpriteAlias2, initWeztermClient, waitForWeztermMuxHealthy, ensureWeztermMuxReady, runWeztermProxy, runCommand6, promptYesNo2, fileExists, hasWeztermOnPath, resolveShellProfilePath, ensureWeztermOnPath, ensureWeztermInstalled, expandPath, resolveDefaultConfigPath, escapeRegExp2, resolveCliName4, resolveDvbCommand, formatLuaArgs, resolveWeztermProxyEnv, buildProxyCommand, buildDomainBlock, canAppendToConfig, countReturns, applyReturnTableTransform, insertBlock, runWeztermSetup, startWeztermDomain, runWezterm;
|
|
216462
216705
|
var init_wezterm = __esm({
|
|
216463
216706
|
"src/devbox/commands/wezterm.ts"() {
|
|
216464
216707
|
"use strict";
|
|
216465
|
-
|
|
216708
|
+
import_node_crypto17 = require("node:crypto");
|
|
216466
216709
|
import_node_child_process12 = require("node:child_process");
|
|
216467
216710
|
import_promises32 = __toESM(require("node:fs/promises"), 1);
|
|
216468
216711
|
import_node_os23 = __toESM(require("node:os"), 1);
|
|
@@ -216673,7 +216916,7 @@ var init_wezterm = __esm({
|
|
|
216673
216916
|
await writeProxyLog(
|
|
216674
216917
|
`proxy_ready box=${spriteAlias} setup=${skipSetup ? "skip" : "full"}`
|
|
216675
216918
|
);
|
|
216676
|
-
const requestId = (0,
|
|
216919
|
+
const requestId = (0, import_node_crypto17.randomUUID)();
|
|
216677
216920
|
const proxyPath = `/v1/sprites/${spriteAlias}/proxy`;
|
|
216678
216921
|
logger10.info("sprites_request", {
|
|
216679
216922
|
requestId,
|
|
@@ -217754,4 +217997,4 @@ smol-toml/dist/index.js:
|
|
|
217754
217997
|
*/
|
|
217755
217998
|
//# sourceMappingURL=dvb.cjs.map
|
|
217756
217999
|
|
|
217757
|
-
//# debugId=
|
|
218000
|
+
//# debugId=c3ed3072-4c93-5461-97f3-5f404303f107
|