@boxes-dev/dvb 1.0.64 → 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 +104 -35
- 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/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;
|
|
@@ -204845,7 +204845,7 @@ var init_prompts = __esm({
|
|
|
204845
204845
|
});
|
|
204846
204846
|
|
|
204847
204847
|
// src/devbox/commands/init/codex/remote.ts
|
|
204848
|
-
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;
|
|
204849
204849
|
var init_remote2 = __esm({
|
|
204850
204850
|
"src/devbox/commands/init/codex/remote.ts"() {
|
|
204851
204851
|
"use strict";
|
|
@@ -204890,6 +204890,7 @@ var init_remote2 = __esm({
|
|
|
204890
204890
|
];
|
|
204891
204891
|
return lines.join("\n");
|
|
204892
204892
|
};
|
|
204893
|
+
resolveRemoteApplyTemplateName = (computeProvider) => computeProvider === "modal" ? "remote-apply-modal.md" : "remote-apply.md";
|
|
204893
204894
|
renderRemoteApplyPromptFromTemplate = ({
|
|
204894
204895
|
template,
|
|
204895
204896
|
setupPath,
|
|
@@ -204906,9 +204907,12 @@ var init_remote2 = __esm({
|
|
|
204906
204907
|
setupPath,
|
|
204907
204908
|
artifactsBundle,
|
|
204908
204909
|
artifactsManifest,
|
|
204909
|
-
entrypoints
|
|
204910
|
+
entrypoints,
|
|
204911
|
+
computeProvider
|
|
204910
204912
|
}) => {
|
|
204911
|
-
const template = await readPromptTemplate(
|
|
204913
|
+
const template = await readPromptTemplate(
|
|
204914
|
+
resolveRemoteApplyTemplateName(computeProvider)
|
|
204915
|
+
);
|
|
204912
204916
|
return renderRemoteApplyPromptFromTemplate({
|
|
204913
204917
|
template,
|
|
204914
204918
|
setupPath,
|
|
@@ -207029,7 +207033,7 @@ var init_progress = __esm({
|
|
|
207029
207033
|
});
|
|
207030
207034
|
|
|
207031
207035
|
// src/devbox/commands/init/codex/index.ts
|
|
207032
|
-
var import_node_path27, import_node_crypto14, import_promises24, import_node_os14,
|
|
207036
|
+
var import_node_path27, import_node_crypto14, import_promises24, import_node_os14, CODEX_REQUEST_URL_REGEX2, extractRequestUrl2, isLoopbackRelayUrl2, resolveLocalCodexAuthPathCandidates, readLocalCodexAuthCache, syncLocalCodexAuthCacheToSprite, uploadSetupPlan, runRemoteCodexSetup;
|
|
207033
207037
|
var init_codex = __esm({
|
|
207034
207038
|
"src/devbox/commands/init/codex/index.ts"() {
|
|
207035
207039
|
"use strict";
|
|
@@ -207049,17 +207053,40 @@ var init_codex = __esm({
|
|
|
207049
207053
|
init_proxy2();
|
|
207050
207054
|
init_artifacts();
|
|
207051
207055
|
init_progress();
|
|
207052
|
-
|
|
207053
|
-
|
|
207054
|
-
|
|
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;
|
|
207055
207061
|
};
|
|
207056
|
-
|
|
207057
|
-
const authPath = import_node_path27.default.join(resolveLocalCodexRoot(), "auth.json");
|
|
207062
|
+
isLoopbackRelayUrl2 = (requestUrl) => {
|
|
207058
207063
|
try {
|
|
207059
|
-
|
|
207064
|
+
const url = new URL(requestUrl);
|
|
207065
|
+
return url.hostname === "127.0.0.1" || url.hostname === "localhost" || url.hostname === "::1";
|
|
207060
207066
|
} catch {
|
|
207061
|
-
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
|
+
}
|
|
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
|
+
}
|
|
207062
207088
|
}
|
|
207089
|
+
return null;
|
|
207063
207090
|
};
|
|
207064
207091
|
syncLocalCodexAuthCacheToSprite = async ({
|
|
207065
207092
|
client: client2,
|
|
@@ -207347,6 +207374,7 @@ var init_codex = __esm({
|
|
|
207347
207374
|
runRemoteCodexSetup = async ({
|
|
207348
207375
|
client: client2,
|
|
207349
207376
|
spriteAlias,
|
|
207377
|
+
computeProvider,
|
|
207350
207378
|
expandedWorkdir,
|
|
207351
207379
|
remoteSetupPath,
|
|
207352
207380
|
remoteArtifactsBundlePath,
|
|
@@ -207359,18 +207387,13 @@ var init_codex = __esm({
|
|
|
207359
207387
|
emitCodexOutput = true
|
|
207360
207388
|
}) => {
|
|
207361
207389
|
if (!proxyOptions) {
|
|
207390
|
+
await syncLocalCodexAuthCacheToSprite({
|
|
207391
|
+
client: client2,
|
|
207392
|
+
spriteAlias,
|
|
207393
|
+
status
|
|
207394
|
+
});
|
|
207362
207395
|
status.stage("Check Codex login");
|
|
207363
|
-
|
|
207364
|
-
if (!loggedIn) {
|
|
207365
|
-
const synced = await syncLocalCodexAuthCacheToSprite({
|
|
207366
|
-
client: client2,
|
|
207367
|
-
spriteAlias,
|
|
207368
|
-
status
|
|
207369
|
-
});
|
|
207370
|
-
if (synced) {
|
|
207371
|
-
loggedIn = await isRemoteCodexLoggedIn(client2, spriteAlias);
|
|
207372
|
-
}
|
|
207373
|
-
}
|
|
207396
|
+
const loggedIn = await isRemoteCodexLoggedIn(client2, spriteAlias);
|
|
207374
207397
|
if (!loggedIn) {
|
|
207375
207398
|
await requireDaemonFeatures(socketInfo.socketPath, ["ports"]);
|
|
207376
207399
|
status.stage("Waiting for Codex login");
|
|
@@ -207474,7 +207497,8 @@ codex login`
|
|
|
207474
207497
|
setupPath: remoteSetupPath,
|
|
207475
207498
|
artifactsBundle: remoteArtifactsBundlePath,
|
|
207476
207499
|
artifactsManifest: remoteArtifactsManifestPath,
|
|
207477
|
-
entrypoints
|
|
207500
|
+
entrypoints,
|
|
207501
|
+
computeProvider
|
|
207478
207502
|
});
|
|
207479
207503
|
const codexLastMessagePath = "/home/sprite/.devbox/codex-setup-output.txt";
|
|
207480
207504
|
const proxyRoot = proxyOptions ? `/home/sprite/.devbox/tmp/codex-proxy-${(0, import_node_crypto14.randomUUID)()}` : null;
|
|
@@ -207628,15 +207652,59 @@ codex login`
|
|
|
207628
207652
|
};
|
|
207629
207653
|
writeCodexOutput(process.stdout, execResult?.stdout, "stdout");
|
|
207630
207654
|
writeCodexOutput(process.stderr, execResult?.stderr, "stderr");
|
|
207631
|
-
|
|
207655
|
+
let lastMessage = "";
|
|
207656
|
+
let lastMessageReadError = null;
|
|
207632
207657
|
try {
|
|
207633
207658
|
const bytes = await client2.readFile(spriteAlias, {
|
|
207634
207659
|
path: codexLastMessagePath
|
|
207635
207660
|
});
|
|
207636
|
-
|
|
207637
|
-
|
|
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) {
|
|
207638
207706
|
status.stop();
|
|
207639
|
-
process.stdout.write(`${
|
|
207707
|
+
process.stdout.write(`${lastMessage}
|
|
207640
207708
|
`);
|
|
207641
207709
|
}
|
|
207642
207710
|
} catch {
|
|
@@ -210047,7 +210115,7 @@ var init_finalizeFlow = __esm({
|
|
|
210047
210115
|
} else {
|
|
210048
210116
|
R2.warn("Could not copy the SSH key automatically.");
|
|
210049
210117
|
}
|
|
210050
|
-
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?`;
|
|
210051
210119
|
const shouldOpen = await promptBeforeOpenBrowser({
|
|
210052
210120
|
url: remoteInfo.settingsUrl,
|
|
210053
210121
|
title: `${remoteInfo.host} SSH key page`,
|
|
@@ -210270,6 +210338,7 @@ var init_finalizeFlow = __esm({
|
|
|
210270
210338
|
await runRemoteCodexSetup({
|
|
210271
210339
|
client: client2,
|
|
210272
210340
|
spriteAlias,
|
|
210341
|
+
computeProvider,
|
|
210273
210342
|
expandedWorkdir,
|
|
210274
210343
|
remoteSetupPath,
|
|
210275
210344
|
remoteArtifactsBundlePath,
|
|
@@ -217928,4 +217997,4 @@ smol-toml/dist/index.js:
|
|
|
217928
217997
|
*/
|
|
217929
217998
|
//# sourceMappingURL=dvb.cjs.map
|
|
217930
217999
|
|
|
217931
|
-
//# debugId=
|
|
218000
|
+
//# debugId=c3ed3072-4c93-5461-97f3-5f404303f107
|