@madarco/agentbox 0.24.2 → 0.24.4
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/CHANGELOG.md +25 -0
- package/dist/{_cloud-attach-D5OC7DCC.js → _cloud-attach-ESCPOKG5.js} +5 -5
- package/dist/{chunk-DEDTPG2D.js → chunk-3MDYQROX.js} +5 -5
- package/dist/{chunk-SS6ZEKLL.js → chunk-4HPLS5HJ.js} +7 -4
- package/dist/chunk-4HPLS5HJ.js.map +1 -0
- package/dist/{chunk-3253DDXI.js → chunk-5JDOTQTM.js} +4 -4
- package/dist/{chunk-5KHEH47T.js → chunk-7DPDUZ7L.js} +2 -2
- package/dist/{chunk-24PXPJI3.js → chunk-CE3S7UDQ.js} +10 -10
- package/dist/{chunk-UIRBYL4G.js → chunk-H6A4BQMG.js} +9 -1
- package/dist/chunk-H6A4BQMG.js.map +1 -0
- package/dist/{chunk-WLHJZPFJ.js → chunk-LJMGHFLZ.js} +152 -3
- package/dist/chunk-LJMGHFLZ.js.map +1 -0
- package/dist/{chunk-5WF7PAH2.js → chunk-OSPM4Q5V.js} +3 -3
- package/dist/{chunk-QMA3DB5L.js → chunk-QHISF6O6.js} +3 -3
- package/dist/{chunk-LC4E2EIZ.js → chunk-RFRWS5CD.js} +2 -2
- package/dist/{dist-UWUTNRCK.js → dist-2N3XHMBQ.js} +6 -6
- package/dist/{dist-FWB3MIQ5.js → dist-3M53BF4E.js} +39 -58
- package/dist/dist-3M53BF4E.js.map +1 -0
- package/dist/{dist-TK3STVUP.js → dist-FGXCG4JY.js} +6 -6
- package/dist/{dist-T5MXBZGP.js → dist-HPPHBZTO.js} +2 -2
- package/dist/{dist-2JWYYJZR.js → dist-NOUPH5E6.js} +4 -4
- package/dist/{dist-3NFY6M53.js → dist-TRKHS6I7.js} +6 -6
- package/dist/{dist-72EYR5DW.js → dist-VFPT5TDH.js} +6 -6
- package/dist/index.js +35 -23
- package/dist/index.js.map +1 -1
- package/dist/{prepared-state-BUO75YLZ-RQRFFBJW.js → prepared-state-BUO75YLZ-46W2PAHH.js} +2 -2
- package/package.json +4 -4
- package/runtime/_shared/ctl.cjs +8 -0
- package/runtime/digitalocean/ctl.cjs +8 -0
- package/runtime/docker/packages/ctl/dist/bin.cjs +8 -0
- package/runtime/e2b/ctl.cjs +8 -0
- package/runtime/hetzner/ctl.cjs +8 -0
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
- package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0d1lmiq._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/_0760z6y._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/_0ro6vh6._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_0b_hsjl._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
- package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/1z4elhg8gyq98.js +1 -0
- package/runtime/hub/apps/hub/{auth-Q447765C.js → auth-HY5K55Y5.js} +2 -2
- package/runtime/hub/apps/hub/{auth-config-SIL635ZD.js → auth-config-MNW2XGKK.js} +2 -2
- package/runtime/hub/apps/hub/{chunk-OJAHNFNV.js → chunk-5KMJIVZC.js} +6 -3
- package/runtime/hub/apps/hub/{chunk-IRIK4DQF.js → chunk-DNR2YM2G.js} +2 -2
- package/runtime/hub/apps/hub/{chunk-3VE7AYVK.js → chunk-EY6HEDTK.js} +4 -4
- package/runtime/hub/apps/hub/{chunk-DZPQB2JZ.js → chunk-PROXBLRJ.js} +1 -1
- package/runtime/hub/apps/hub/{chunk-64WEKO34.js → chunk-TRUQCO4U.js} +8 -0
- package/runtime/hub/apps/hub/{dist-PWBKGUDG.js → dist-3DCKZYID.js} +4 -4
- package/runtime/hub/apps/hub/{dist-6AEQJL7W.js → dist-KV5ESR24.js} +4 -4
- package/runtime/hub/apps/hub/{dist-PRUR2E5L.js → dist-M73U3ZDH.js} +4 -4
- package/runtime/hub/apps/hub/{dist-GF5EBRNG.js → dist-NTKPAYA3.js} +1 -1
- package/runtime/hub/apps/hub/{dist-7GTRUGLC.js → dist-RSWTJWRN.js} +3 -3
- package/runtime/hub/apps/hub/{dist-HHHK5LRX.js → dist-SX2NXGI6.js} +177 -57
- package/runtime/hub/apps/hub/{dist-DLPVQMKD.js → dist-YCRESLWD.js} +4 -4
- package/runtime/hub/apps/hub/{hub-token-UITZEWVP.js → hub-token-QKQWV2I6.js} +2 -2
- package/runtime/hub/apps/hub/{prepared-state-BUO75YLZ-O4GZMDRF.js → prepared-state-BUO75YLZ-KR4YLKDC.js} +1 -1
- package/runtime/hub/apps/hub/server.js +15 -15
- package/runtime/relay/bin.cjs +8 -0
- package/runtime/vercel/ctl.cjs +8 -0
- package/dist/chunk-SS6ZEKLL.js.map +0 -1
- package/dist/chunk-UIRBYL4G.js.map +0 -1
- package/dist/chunk-WLHJZPFJ.js.map +0 -1
- package/dist/dist-FWB3MIQ5.js.map +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/380qcmusmigzz.js +0 -1
- /package/dist/{_cloud-attach-D5OC7DCC.js.map → _cloud-attach-ESCPOKG5.js.map} +0 -0
- /package/dist/{chunk-DEDTPG2D.js.map → chunk-3MDYQROX.js.map} +0 -0
- /package/dist/{chunk-3253DDXI.js.map → chunk-5JDOTQTM.js.map} +0 -0
- /package/dist/{chunk-5KHEH47T.js.map → chunk-7DPDUZ7L.js.map} +0 -0
- /package/dist/{chunk-24PXPJI3.js.map → chunk-CE3S7UDQ.js.map} +0 -0
- /package/dist/{chunk-5WF7PAH2.js.map → chunk-OSPM4Q5V.js.map} +0 -0
- /package/dist/{chunk-QMA3DB5L.js.map → chunk-QHISF6O6.js.map} +0 -0
- /package/dist/{chunk-LC4E2EIZ.js.map → chunk-RFRWS5CD.js.map} +0 -0
- /package/dist/{dist-UWUTNRCK.js.map → dist-2N3XHMBQ.js.map} +0 -0
- /package/dist/{dist-TK3STVUP.js.map → dist-FGXCG4JY.js.map} +0 -0
- /package/dist/{dist-2JWYYJZR.js.map → dist-HPPHBZTO.js.map} +0 -0
- /package/dist/{dist-3NFY6M53.js.map → dist-NOUPH5E6.js.map} +0 -0
- /package/dist/{dist-72EYR5DW.js.map → dist-TRKHS6I7.js.map} +0 -0
- /package/dist/{dist-T5MXBZGP.js.map → dist-VFPT5TDH.js.map} +0 -0
- /package/dist/{prepared-state-BUO75YLZ-RQRFFBJW.js.map → prepared-state-BUO75YLZ-46W2PAHH.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{qi16fW9z3QBAzMjpOdRMQ → bwxNg9k-GQFyi2ouG8Aeh}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{qi16fW9z3QBAzMjpOdRMQ → bwxNg9k-GQFyi2ouG8Aeh}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{qi16fW9z3QBAzMjpOdRMQ → bwxNg9k-GQFyi2ouG8Aeh}/_ssgManifest.js +0 -0
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
readBoxStatus,
|
|
23
23
|
registerBoxWithRelay,
|
|
24
24
|
syncClaudeCredentials
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-DNR2YM2G.js";
|
|
26
26
|
import {
|
|
27
27
|
AGENT_SYNC_SPECS,
|
|
28
28
|
BOX_DYNAMIC_SYNC_MANIFEST,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
stageOpencodeStateForUpload,
|
|
71
71
|
stageOpencodeStaticForUpload,
|
|
72
72
|
writeCredentialBackup
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-EY6HEDTK.js";
|
|
74
74
|
import {
|
|
75
75
|
execa
|
|
76
76
|
} from "./chunk-EFW34I43.js";
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
projectDirSegment,
|
|
81
81
|
require_dist,
|
|
82
82
|
sanitizeMnemonic
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-TRUQCO4U.js";
|
|
84
84
|
import {
|
|
85
85
|
__toESM
|
|
86
86
|
} from "./chunk-TZFWAJVB.js";
|
|
@@ -2241,6 +2241,8 @@ function createCloudProvider(backend, opts = {}) {
|
|
|
2241
2241
|
const location = typeof locationOpt === "string" && locationOpt.trim() !== "" ? locationOpt.trim() : void 0;
|
|
2242
2242
|
const inboundOpt = req.providerOptions?.["inbound"];
|
|
2243
2243
|
const inbound = typeof inboundOpt === "string" && inboundOpt.trim() !== "" ? inboundOpt.trim() : void 0;
|
|
2244
|
+
const projectOpt = req.providerOptions?.["project"];
|
|
2245
|
+
const project = typeof projectOpt === "string" && projectOpt.trim() !== "" ? projectOpt.trim() : void 0;
|
|
2244
2246
|
const relayToken = generateRelayToken();
|
|
2245
2247
|
const bridgeToken = generateRelayToken();
|
|
2246
2248
|
try {
|
|
@@ -2296,6 +2298,7 @@ function createCloudProvider(backend, opts = {}) {
|
|
|
2296
2298
|
resources,
|
|
2297
2299
|
size,
|
|
2298
2300
|
location,
|
|
2301
|
+
project,
|
|
2299
2302
|
inbound,
|
|
2300
2303
|
timeoutMs,
|
|
2301
2304
|
exposePorts: exposeServicePorts,
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
upstreamRef,
|
|
79
79
|
writeClaudeMergedRegistries,
|
|
80
80
|
writeCredentialBackup
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-EY6HEDTK.js";
|
|
82
82
|
import {
|
|
83
83
|
execa
|
|
84
84
|
} from "./chunk-EFW34I43.js";
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
require_dist,
|
|
93
93
|
sanitizeMnemonic,
|
|
94
94
|
setConfigValue
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-TRUQCO4U.js";
|
|
96
96
|
import {
|
|
97
97
|
__toESM
|
|
98
98
|
} from "./chunk-TZFWAJVB.js";
|
|
@@ -3673,7 +3673,7 @@ import { dirname as dirname7, resolve as resolve4 } from "path";
|
|
|
3673
3673
|
var DEFAULT_BOX_IMAGE = "agentbox/box:dev";
|
|
3674
3674
|
async function resolveClaudeInstallMode() {
|
|
3675
3675
|
try {
|
|
3676
|
-
const { loadEffectiveConfig } = await import("./dist-
|
|
3676
|
+
const { loadEffectiveConfig } = await import("./dist-NTKPAYA3.js");
|
|
3677
3677
|
const cfg = await loadEffectiveConfig(process.cwd());
|
|
3678
3678
|
return cfg.effective.box.claudeInstall;
|
|
3679
3679
|
} catch {
|
|
@@ -3787,7 +3787,7 @@ async function buildImage(opts = {}) {
|
|
|
3787
3787
|
return ref;
|
|
3788
3788
|
}
|
|
3789
3789
|
async function pullOrBuild(ref, fingerprint, opts = {}) {
|
|
3790
|
-
const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-
|
|
3790
|
+
const { writePreparedDockerState: writePreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-KR4YLKDC.js");
|
|
3791
3791
|
const registry = opts.registry ?? BOX_IMAGE_REGISTRY;
|
|
3792
3792
|
const allowPull = opts.allowPull !== false;
|
|
3793
3793
|
if (allowPull && registry && fingerprint) {
|
|
@@ -3814,7 +3814,7 @@ async function pullOrBuild(ref, fingerprint, opts = {}) {
|
|
|
3814
3814
|
return { source: "built" };
|
|
3815
3815
|
}
|
|
3816
3816
|
async function ensureImage(ref = DEFAULT_BOX_IMAGE, opts = {}) {
|
|
3817
|
-
const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-BUO75YLZ-
|
|
3817
|
+
const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2, preparedMatches: preparedMatches2 } = await import("./prepared-state-BUO75YLZ-KR4YLKDC.js");
|
|
3818
3818
|
const claudeInstall = opts.claudeInstall ?? await resolveClaudeInstallMode();
|
|
3819
3819
|
const rawFingerprint = await computeDockerContextFingerprint2({
|
|
3820
3820
|
contextDir: opts.contextDir
|
|
@@ -3864,7 +3864,7 @@ function classifyDockerBaseFreshness(input) {
|
|
|
3864
3864
|
return { state: "fresh" };
|
|
3865
3865
|
}
|
|
3866
3866
|
async function evaluateDockerBaseFreshness(opts = {}) {
|
|
3867
|
-
const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-
|
|
3867
|
+
const { computeDockerContextFingerprint: computeDockerContextFingerprint2, readPreparedDockerState: readPreparedDockerState2 } = await import("./prepared-state-BUO75YLZ-KR4YLKDC.js");
|
|
3868
3868
|
const ref = opts.ref ?? DEFAULT_BOX_IMAGE;
|
|
3869
3869
|
const imagePresent = await imageExists(ref);
|
|
3870
3870
|
if (!imagePresent) return { state: "unprepared" };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; import { fileURLToPath as __f } from 'node:url'; import { dirname as __d } from 'node:path'; const require = __cr(import.meta.url); const __filename = __f(import.meta.url); const __dirname = __d(__filename);
|
|
2
2
|
import {
|
|
3
3
|
STATE_DIR
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TRUQCO4U.js";
|
|
5
5
|
|
|
6
6
|
// lib/auth-config.ts
|
|
7
7
|
import { join } from "node:path";
|
|
@@ -7470,6 +7470,9 @@ var BUILT_IN_DEFAULTS = {
|
|
|
7470
7470
|
bundleDepth: void 0,
|
|
7471
7471
|
hetznerLocation: "nbg1",
|
|
7472
7472
|
digitaloceanRegion: "nyc3",
|
|
7473
|
+
// Empty = leave boxes in the account's default project (DigitalOcean's own
|
|
7474
|
+
// behavior). There is no sane default id to pick — it differs per account.
|
|
7475
|
+
digitaloceanProject: "",
|
|
7473
7476
|
vercelTimeoutMs: 27e5,
|
|
7474
7477
|
vercelNetworkPolicy: "",
|
|
7475
7478
|
e2bTimeoutMs: 27e5,
|
|
@@ -7720,6 +7723,11 @@ var KEY_REGISTRY = [
|
|
|
7720
7723
|
type: "string",
|
|
7721
7724
|
description: "DigitalOcean region new --provider digitalocean boxes are created in (e.g. `nyc3`, `nyc1`, `sfo3`, `ams3`, `fra1`). Default `nyc3`. Overridable per-create with `--location`. DigitalOcean-only; ignored by other providers."
|
|
7722
7725
|
},
|
|
7726
|
+
{
|
|
7727
|
+
key: "box.digitaloceanProject",
|
|
7728
|
+
type: "string",
|
|
7729
|
+
description: "DigitalOcean Project new --provider digitalocean boxes are placed in \u2014 a name or the project's UUID. Unset (the default) leaves boxes in the account's default project. Set it per repo via `agentbox.yaml`, or globally at `agentbox digitalocean login`. DigitalOcean-only; ignored by other providers."
|
|
7730
|
+
},
|
|
7723
7731
|
{
|
|
7724
7732
|
key: "box.vercelTimeoutMs",
|
|
7725
7733
|
type: "int",
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
} from "./chunk-OF242BLD.js";
|
|
14
14
|
import {
|
|
15
15
|
createCloudProvider
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-5KMJIVZC.js";
|
|
17
|
+
import "./chunk-DNR2YM2G.js";
|
|
18
18
|
import "./chunk-3LAHFDJF.js";
|
|
19
19
|
import {
|
|
20
20
|
DOCKER_CONTEXT_FILE_MAP,
|
|
@@ -28,9 +28,9 @@ import {
|
|
|
28
28
|
stageAllAgentStatic,
|
|
29
29
|
writeManagedSecrets,
|
|
30
30
|
writePreparedStateRaw
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-EY6HEDTK.js";
|
|
32
32
|
import "./chunk-EFW34I43.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-TRUQCO4U.js";
|
|
34
34
|
import "./chunk-TZFWAJVB.js";
|
|
35
35
|
|
|
36
36
|
// ../../packages/sandbox-daytona/dist/chunk-FNG2UBRZ.js
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
renderInnerCommand,
|
|
19
19
|
resolveCloudCheckpoint,
|
|
20
20
|
writeCloudCheckpointManifest
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-5KMJIVZC.js";
|
|
22
|
+
import "./chunk-DNR2YM2G.js";
|
|
23
23
|
import "./chunk-3LAHFDJF.js";
|
|
24
24
|
import {
|
|
25
25
|
UserFacingError,
|
|
@@ -34,9 +34,9 @@ import {
|
|
|
34
34
|
stageAllAgentStatic,
|
|
35
35
|
writeManagedSecrets,
|
|
36
36
|
writePreparedStateRaw
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-EY6HEDTK.js";
|
|
38
38
|
import "./chunk-EFW34I43.js";
|
|
39
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-TRUQCO4U.js";
|
|
40
40
|
import "./chunk-TZFWAJVB.js";
|
|
41
41
|
|
|
42
42
|
// ../../packages/sandbox-e2b/dist/chunk-WQRH5SXA.js
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
renderInnerCommand,
|
|
22
22
|
resolveCloudCheckpoint,
|
|
23
23
|
writeCloudCheckpointManifest
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-5KMJIVZC.js";
|
|
25
|
+
import "./chunk-DNR2YM2G.js";
|
|
26
26
|
import "./chunk-3LAHFDJF.js";
|
|
27
27
|
import {
|
|
28
28
|
UserFacingError,
|
|
@@ -39,11 +39,11 @@ import {
|
|
|
39
39
|
stageOpencodeStaticForUpload,
|
|
40
40
|
writeManagedSecrets,
|
|
41
41
|
writePreparedStateRaw
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-EY6HEDTK.js";
|
|
43
43
|
import {
|
|
44
44
|
execa
|
|
45
45
|
} from "./chunk-EFW34I43.js";
|
|
46
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-TRUQCO4U.js";
|
|
47
47
|
import "./chunk-TZFWAJVB.js";
|
|
48
48
|
|
|
49
49
|
// ../../packages/sandbox-vercel/dist/chunk-6SDDZRAG.js
|
|
@@ -225,7 +225,7 @@ import {
|
|
|
225
225
|
vscodeServerVolumeName,
|
|
226
226
|
waitForTmuxPaneContent,
|
|
227
227
|
warmUpClaudeCredentials
|
|
228
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-DNR2YM2G.js";
|
|
229
229
|
import "./chunk-3LAHFDJF.js";
|
|
230
230
|
import {
|
|
231
231
|
AmbiguousBoxError,
|
|
@@ -274,9 +274,9 @@ import {
|
|
|
274
274
|
stageDynamicSyncTarball,
|
|
275
275
|
tagImage,
|
|
276
276
|
writePreparedDockerState
|
|
277
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-EY6HEDTK.js";
|
|
278
278
|
import "./chunk-EFW34I43.js";
|
|
279
|
-
import "./chunk-
|
|
279
|
+
import "./chunk-TRUQCO4U.js";
|
|
280
280
|
import "./chunk-TZFWAJVB.js";
|
|
281
281
|
export {
|
|
282
282
|
AmbiguousBoxError,
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
$e,
|
|
4
4
|
BD,
|
|
5
5
|
L,
|
|
6
|
+
de,
|
|
6
7
|
fe,
|
|
7
8
|
me,
|
|
8
9
|
v,
|
|
@@ -12,11 +13,11 @@ import {
|
|
|
12
13
|
} from "./chunk-OF242BLD.js";
|
|
13
14
|
import {
|
|
14
15
|
createCloudProvider
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-5KMJIVZC.js";
|
|
16
17
|
import {
|
|
17
18
|
detectPortless,
|
|
18
19
|
portlessDoctorRow
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DNR2YM2G.js";
|
|
20
21
|
import "./chunk-3LAHFDJF.js";
|
|
21
22
|
import {
|
|
22
23
|
UserFacingError,
|
|
@@ -36,14 +37,18 @@ import {
|
|
|
36
37
|
stageCodexStaticForUpload,
|
|
37
38
|
stageOpencodeStaticForUpload,
|
|
38
39
|
writePreparedStateRaw
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-EY6HEDTK.js";
|
|
40
41
|
import {
|
|
41
42
|
execa
|
|
42
43
|
} from "./chunk-EFW34I43.js";
|
|
43
|
-
import
|
|
44
|
+
import {
|
|
45
|
+
loadEffectiveConfig,
|
|
46
|
+
setConfigValue,
|
|
47
|
+
unsetConfigValue
|
|
48
|
+
} from "./chunk-TRUQCO4U.js";
|
|
44
49
|
import "./chunk-TZFWAJVB.js";
|
|
45
50
|
|
|
46
|
-
// ../../packages/sandbox-digitalocean/dist/chunk-
|
|
51
|
+
// ../../packages/sandbox-digitalocean/dist/chunk-7SUT53X5.js
|
|
47
52
|
import { existsSync, readFileSync } from "fs";
|
|
48
53
|
import { homedir } from "os";
|
|
49
54
|
import { resolve } from "path";
|
|
@@ -236,6 +241,18 @@ function makeDigitalOceanClient(opts = {}) {
|
|
|
236
241
|
async listSizes() {
|
|
237
242
|
return paginate(withPerPage("/sizes"), "sizes");
|
|
238
243
|
},
|
|
244
|
+
async listProjects() {
|
|
245
|
+
return paginate(withPerPage("/projects"), "projects");
|
|
246
|
+
},
|
|
247
|
+
async getDefaultProject() {
|
|
248
|
+
const r = await req("GET", "/projects/default");
|
|
249
|
+
return r?.project ?? null;
|
|
250
|
+
},
|
|
251
|
+
async assignProjectResources(projectId, urns) {
|
|
252
|
+
await req("POST", `/projects/${encodeURIComponent(projectId)}/resources`, {
|
|
253
|
+
resources: urns
|
|
254
|
+
});
|
|
255
|
+
},
|
|
239
256
|
async createFirewall(reqBody) {
|
|
240
257
|
const r = await reqExpect("POST", "/firewalls", reqBody);
|
|
241
258
|
return r.firewall;
|
|
@@ -271,6 +288,81 @@ function makeDigitalOceanClient(opts = {}) {
|
|
|
271
288
|
}
|
|
272
289
|
};
|
|
273
290
|
}
|
|
291
|
+
function suggestSizes(catalog, limit = 6) {
|
|
292
|
+
return catalog.filter((s) => s.available).map((s) => s.slug).slice(0, limit);
|
|
293
|
+
}
|
|
294
|
+
function validateSizeChoice(choice, catalog, snapshot) {
|
|
295
|
+
const { size, region } = choice;
|
|
296
|
+
const plan = catalog.find((s) => s.slug === size);
|
|
297
|
+
if (!plan) {
|
|
298
|
+
const suggestions = suggestSizes(catalog);
|
|
299
|
+
const hint = suggestions.length > 0 ? ` Valid sizes include: ${suggestions.join(", ")}.` : "";
|
|
300
|
+
throw new UserFacingError(
|
|
301
|
+
`DigitalOcean size "${size}" does not exist.${hint}
|
|
302
|
+
Set one with \`--size <slug>\` or \`agentbox config set box.sizeDigitalocean <slug>\`.`
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
if (!plan.available) {
|
|
306
|
+
throw new UserFacingError(
|
|
307
|
+
`DigitalOcean size "${size}" is not currently available for new Droplets.
|
|
308
|
+
Pick an available size instead: ${suggestSizes(catalog).join(", ")}.`
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
if (snapshot && typeof snapshot.min_disk_size === "number" && plan.disk < snapshot.min_disk_size) {
|
|
312
|
+
throw new UserFacingError(
|
|
313
|
+
`DigitalOcean size "${size}" has a ${String(plan.disk)} GB disk, but the base snapshot needs at least ${String(snapshot.min_disk_size)} GB.
|
|
314
|
+
Choose a larger size (bigger plans have bigger disks).`
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
if (plan.regions.length > 0 && !plan.regions.includes(region)) {
|
|
318
|
+
throw new UserFacingError(
|
|
319
|
+
`DigitalOcean size "${size}" is not offered in region "${region}".
|
|
320
|
+
It is available in: ${plan.regions.join(", ")}.
|
|
321
|
+
Pick one with \`--location <slug>\` or \`agentbox config set box.digitaloceanRegion <slug>\`.`
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function resolveProjectChoice(project, projects) {
|
|
326
|
+
const wanted = project.trim();
|
|
327
|
+
if (wanted.length === 0) {
|
|
328
|
+
throw new UserFacingError("DigitalOcean project must not be empty.");
|
|
329
|
+
}
|
|
330
|
+
const byId = projects.find((p) => p.id === wanted);
|
|
331
|
+
if (byId) return byId.id;
|
|
332
|
+
const matches = projects.filter((p) => p.name.toLowerCase() === wanted.toLowerCase());
|
|
333
|
+
if (matches.length === 1) return matches[0].id;
|
|
334
|
+
if (matches.length > 1) {
|
|
335
|
+
throw new UserFacingError(
|
|
336
|
+
`DigitalOcean project name "${wanted}" is ambiguous \u2014 ${String(matches.length)} projects share it.
|
|
337
|
+
Use the id instead: ${matches.map((p) => p.id).join(", ")}.
|
|
338
|
+
Set it with \`agentbox config set box.digitaloceanProject <id>\`.`
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
const known = projects.map((p) => p.is_default ? `${p.name} (default)` : p.name).join(", ");
|
|
342
|
+
throw new UserFacingError(
|
|
343
|
+
`DigitalOcean project "${wanted}" not found on this account.
|
|
344
|
+
` + (known.length > 0 ? `Your projects: ${known}.
|
|
345
|
+
` : "This account has no projects.\n") + "Set it with `agentbox config set box.digitaloceanProject <name|id>`, or unset it to use the account default."
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
function mapDigitalOceanProvisionError(err, choice) {
|
|
349
|
+
if (!(err instanceof DigitalOceanApiError)) return err;
|
|
350
|
+
const { size, region } = choice;
|
|
351
|
+
const msg = err.message.toLowerCase();
|
|
352
|
+
if (msg.includes("droplet limit") || msg.includes("exceeded your droplet limit")) {
|
|
353
|
+
return new UserFacingError(
|
|
354
|
+
`DigitalOcean refused to create the Droplet: your account Droplet limit was exceeded (${err.message}).
|
|
355
|
+
New accounts start with a low Droplet limit. Request an increase in the DigitalOcean Console (Account \u2192 your team \u2192 Droplet limit), then retry.`
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
if (msg.includes("not available") || msg.includes("capacity") || msg.includes("sold out")) {
|
|
359
|
+
return new UserFacingError(
|
|
360
|
+
`DigitalOcean has no capacity for "${size}" in "${region}" right now (${err.message}).
|
|
361
|
+
Retry, or pick another region with \`--location <slug>\` (e.g. \`nyc1\`, \`sfo3\`, \`ams3\`, \`fra1\`) or \`agentbox config set box.digitaloceanRegion <slug>\`.`
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
return err;
|
|
365
|
+
}
|
|
274
366
|
function exitOnCancel(v2) {
|
|
275
367
|
if (BD(v2)) {
|
|
276
368
|
ve("Cancelled.");
|
|
@@ -306,6 +398,7 @@ async function ensureDigitalOceanCredentials(opts = {}) {
|
|
|
306
398
|
if (result.ok) {
|
|
307
399
|
persistCredentials(creds);
|
|
308
400
|
v.success(`DigitalOcean credentials saved to ${secretsPath()}`);
|
|
401
|
+
await promptForProject(creds);
|
|
309
402
|
fe("Setup complete.");
|
|
310
403
|
return;
|
|
311
404
|
}
|
|
@@ -324,6 +417,43 @@ async function ensureDigitalOceanCredentials(opts = {}) {
|
|
|
324
417
|
throw new Error(`DigitalOcean credentials rejected: ${result.message}`);
|
|
325
418
|
}
|
|
326
419
|
}
|
|
420
|
+
async function promptForProject(creds) {
|
|
421
|
+
let projects;
|
|
422
|
+
try {
|
|
423
|
+
const client2 = makeDigitalOceanClient({ token: creds.token, endpoint: creds.endpoint });
|
|
424
|
+
projects = await client2.listProjects();
|
|
425
|
+
} catch (err) {
|
|
426
|
+
v.warn(
|
|
427
|
+
`Could not list your DigitalOcean projects (${err instanceof Error ? err.message : String(err)}) \u2014 boxes will use the account's default project. Set it later with \`agentbox config set box.digitaloceanProject <name|id>\`.`
|
|
428
|
+
);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (projects.length < 2) return;
|
|
432
|
+
const current = (await loadEffectiveConfig(process.cwd())).effective.box.digitaloceanProject;
|
|
433
|
+
const choice = exitOnCancel(
|
|
434
|
+
await de({
|
|
435
|
+
message: "Which DigitalOcean project should new boxes go into?",
|
|
436
|
+
initialValue: current || SKIP_PROJECT,
|
|
437
|
+
options: [
|
|
438
|
+
...projects.map((p) => ({
|
|
439
|
+
value: p.id,
|
|
440
|
+
label: p.is_default ? `${p.name} (account default)` : p.name,
|
|
441
|
+
hint: p.id
|
|
442
|
+
})),
|
|
443
|
+
{ value: SKIP_PROJECT, label: "Skip \u2014 use the account's default project" }
|
|
444
|
+
]
|
|
445
|
+
})
|
|
446
|
+
);
|
|
447
|
+
if (choice === SKIP_PROJECT) {
|
|
448
|
+
if (current) await unsetConfigValue("global", "box.digitaloceanProject", process.cwd());
|
|
449
|
+
v.info("Boxes will go into your account's default DigitalOcean project.");
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
await setConfigValue("global", "box.digitaloceanProject", choice, process.cwd());
|
|
453
|
+
const picked = projects.find((p) => p.id === choice);
|
|
454
|
+
v.success(`New boxes will be created in the "${picked?.name ?? choice}" project.`);
|
|
455
|
+
}
|
|
456
|
+
var SKIP_PROJECT = "__skip__";
|
|
327
457
|
function hasUsableCredentials() {
|
|
328
458
|
return typeof process.env.DIGITALOCEAN_TOKEN === "string" && process.env.DIGITALOCEAN_TOKEN.length > 0;
|
|
329
459
|
}
|
|
@@ -408,6 +538,20 @@ async function setDigitalOceanCredentials(fields) {
|
|
|
408
538
|
};
|
|
409
539
|
}
|
|
410
540
|
persistCredentials(creds);
|
|
541
|
+
const project = (fields.project ?? "").trim();
|
|
542
|
+
if (project.length > 0) {
|
|
543
|
+
try {
|
|
544
|
+
const client2 = makeDigitalOceanClient({ token: creds.token, endpoint: creds.endpoint });
|
|
545
|
+
const projectId = resolveProjectChoice(project, await client2.listProjects());
|
|
546
|
+
await setConfigValue("global", "box.digitaloceanProject", projectId, process.cwd());
|
|
547
|
+
} catch (err) {
|
|
548
|
+
return {
|
|
549
|
+
ok: false,
|
|
550
|
+
error: err instanceof Error ? err.message : String(err),
|
|
551
|
+
status: { configured: true, label: "token (project not set)" }
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
}
|
|
411
555
|
const label = result.ok ? "token" : "token (unvalidated)";
|
|
412
556
|
return { ok: true, status: { configured: true, label } };
|
|
413
557
|
}
|
|
@@ -943,58 +1087,6 @@ async function pollUntil(label, check, opts = {}) {
|
|
|
943
1087
|
interval = Math.min(interval * 2, max);
|
|
944
1088
|
}
|
|
945
1089
|
}
|
|
946
|
-
function suggestSizes(catalog, limit = 6) {
|
|
947
|
-
return catalog.filter((s) => s.available).map((s) => s.slug).slice(0, limit);
|
|
948
|
-
}
|
|
949
|
-
function validateSizeChoice(choice, catalog, snapshot) {
|
|
950
|
-
const { size, region } = choice;
|
|
951
|
-
const plan = catalog.find((s) => s.slug === size);
|
|
952
|
-
if (!plan) {
|
|
953
|
-
const suggestions = suggestSizes(catalog);
|
|
954
|
-
const hint = suggestions.length > 0 ? ` Valid sizes include: ${suggestions.join(", ")}.` : "";
|
|
955
|
-
throw new UserFacingError(
|
|
956
|
-
`DigitalOcean size "${size}" does not exist.${hint}
|
|
957
|
-
Set one with \`--size <slug>\` or \`agentbox config set box.sizeDigitalocean <slug>\`.`
|
|
958
|
-
);
|
|
959
|
-
}
|
|
960
|
-
if (!plan.available) {
|
|
961
|
-
throw new UserFacingError(
|
|
962
|
-
`DigitalOcean size "${size}" is not currently available for new Droplets.
|
|
963
|
-
Pick an available size instead: ${suggestSizes(catalog).join(", ")}.`
|
|
964
|
-
);
|
|
965
|
-
}
|
|
966
|
-
if (snapshot && typeof snapshot.min_disk_size === "number" && plan.disk < snapshot.min_disk_size) {
|
|
967
|
-
throw new UserFacingError(
|
|
968
|
-
`DigitalOcean size "${size}" has a ${String(plan.disk)} GB disk, but the base snapshot needs at least ${String(snapshot.min_disk_size)} GB.
|
|
969
|
-
Choose a larger size (bigger plans have bigger disks).`
|
|
970
|
-
);
|
|
971
|
-
}
|
|
972
|
-
if (plan.regions.length > 0 && !plan.regions.includes(region)) {
|
|
973
|
-
throw new UserFacingError(
|
|
974
|
-
`DigitalOcean size "${size}" is not offered in region "${region}".
|
|
975
|
-
It is available in: ${plan.regions.join(", ")}.
|
|
976
|
-
Pick one with \`--location <slug>\` or \`agentbox config set box.digitaloceanRegion <slug>\`.`
|
|
977
|
-
);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
function mapDigitalOceanProvisionError(err, choice) {
|
|
981
|
-
if (!(err instanceof DigitalOceanApiError)) return err;
|
|
982
|
-
const { size, region } = choice;
|
|
983
|
-
const msg = err.message.toLowerCase();
|
|
984
|
-
if (msg.includes("droplet limit") || msg.includes("exceeded your droplet limit")) {
|
|
985
|
-
return new UserFacingError(
|
|
986
|
-
`DigitalOcean refused to create the Droplet: your account Droplet limit was exceeded (${err.message}).
|
|
987
|
-
New accounts start with a low Droplet limit. Request an increase in the DigitalOcean Console (Account \u2192 your team \u2192 Droplet limit), then retry.`
|
|
988
|
-
);
|
|
989
|
-
}
|
|
990
|
-
if (msg.includes("not available") || msg.includes("capacity") || msg.includes("sold out")) {
|
|
991
|
-
return new UserFacingError(
|
|
992
|
-
`DigitalOcean has no capacity for "${size}" in "${region}" right now (${err.message}).
|
|
993
|
-
Retry, or pick another region with \`--location <slug>\` (e.g. \`nyc1\`, \`sfo3\`, \`ams3\`, \`fra1\`) or \`agentbox config set box.digitaloceanRegion <slug>\`.`
|
|
994
|
-
);
|
|
995
|
-
}
|
|
996
|
-
return err;
|
|
997
|
-
}
|
|
998
1090
|
async function mintPrepareKey() {
|
|
999
1091
|
const root = resolve4(homedirOrCwd(), ".agentbox", "digitalocean", `prepare-${Date.now().toString(36)}`);
|
|
1000
1092
|
const key = await mintSshKey(root, `agentbox-prepare-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`);
|
|
@@ -1207,6 +1299,18 @@ async function prepareDigitalOcean(opts = {}) {
|
|
|
1207
1299
|
ipv6: false
|
|
1208
1300
|
});
|
|
1209
1301
|
dropletId = created.droplet.id;
|
|
1302
|
+
const wantedProject = (opts.project ?? (await loadEffectiveConfig(opts.hostWorkspace ?? process.cwd())).effective.box.digitaloceanProject).trim();
|
|
1303
|
+
if (wantedProject.length > 0) {
|
|
1304
|
+
try {
|
|
1305
|
+
const projectId = resolveProjectChoice(wantedProject, await client2.listProjects());
|
|
1306
|
+
await client2.assignProjectResources(projectId, [`do:droplet:${String(dropletId)}`]);
|
|
1307
|
+
progress(`bake droplet assigned to project ${wantedProject}`);
|
|
1308
|
+
} catch (assignErr) {
|
|
1309
|
+
progress(
|
|
1310
|
+
`WARN \u2014 could not assign the bake droplet to project ${wantedProject} (continuing): ${assignErr instanceof Error ? assignErr.message : String(assignErr)}`
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1210
1314
|
progress(`droplet ${String(dropletId)} created; waiting for it to boot`);
|
|
1211
1315
|
const droplet = await pollUntil(
|
|
1212
1316
|
`droplet ${String(dropletId)} active`,
|
|
@@ -1770,6 +1874,11 @@ var digitaloceanBackend = {
|
|
|
1770
1874
|
const sizeCatalog = await c.listSizes();
|
|
1771
1875
|
validateSizeChoice(choice, sizeCatalog, snapshotMeta);
|
|
1772
1876
|
const plan = sizeCatalog.find((s) => s.slug === size);
|
|
1877
|
+
const projectWanted = (req.project ?? "").trim();
|
|
1878
|
+
let projectId = null;
|
|
1879
|
+
if (projectWanted.length > 0) {
|
|
1880
|
+
projectId = resolveProjectChoice(projectWanted, await c.listProjects());
|
|
1881
|
+
}
|
|
1773
1882
|
const inboundPolicy = parseInboundSpec(req.inbound);
|
|
1774
1883
|
const egressOverride = req.env?.AGENTBOX_DIGITALOCEAN_FIREWALL_SOURCE ?? process.env.AGENTBOX_DIGITALOCEAN_FIREWALL_SOURCE;
|
|
1775
1884
|
const hostEgress = inboundPolicy.mode === "open" ? null : egressOverride ? normalizeSourceCidr(egressOverride) : `${await detectEgressIp({ onLog })}/32`;
|
|
@@ -1820,6 +1929,16 @@ var digitaloceanBackend = {
|
|
|
1820
1929
|
}
|
|
1821
1930
|
dropletId = created.droplet.id;
|
|
1822
1931
|
progress(`droplet ${String(dropletId)} created; waiting for it to boot`);
|
|
1932
|
+
if (projectId !== null) {
|
|
1933
|
+
try {
|
|
1934
|
+
await c.assignProjectResources(projectId, [`do:droplet:${String(dropletId)}`]);
|
|
1935
|
+
progress(`droplet ${String(dropletId)} assigned to project ${projectWanted}`);
|
|
1936
|
+
} catch (assignErr) {
|
|
1937
|
+
onLog(
|
|
1938
|
+
`digitalocean: WARN \u2014 could not assign droplet ${String(dropletId)} to project ${projectWanted} (continuing; it stays in the account's default project): ${assignErr instanceof Error ? assignErr.message : String(assignErr)}`
|
|
1939
|
+
);
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1823
1942
|
const droplet = await pollUntil(
|
|
1824
1943
|
`droplet ${String(dropletId)} active`,
|
|
1825
1944
|
async () => {
|
|
@@ -2195,6 +2314,7 @@ export {
|
|
|
2195
2314
|
providerModule,
|
|
2196
2315
|
readDigitalOceanCredStatus,
|
|
2197
2316
|
readPreparedState,
|
|
2317
|
+
resolveProjectChoice,
|
|
2198
2318
|
resolveRuntimeAssets,
|
|
2199
2319
|
scpDownload,
|
|
2200
2320
|
scpUpload,
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
} from "./chunk-OF242BLD.js";
|
|
13
13
|
import {
|
|
14
14
|
createCloudProvider
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5KMJIVZC.js";
|
|
16
16
|
import {
|
|
17
17
|
detectPortless,
|
|
18
18
|
portlessDoctorRow
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-DNR2YM2G.js";
|
|
20
20
|
import "./chunk-3LAHFDJF.js";
|
|
21
21
|
import {
|
|
22
22
|
UserFacingError,
|
|
@@ -37,11 +37,11 @@ import {
|
|
|
37
37
|
stageOpencodeStaticForUpload,
|
|
38
38
|
writeManagedSecrets,
|
|
39
39
|
writePreparedStateRaw
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-EY6HEDTK.js";
|
|
41
41
|
import {
|
|
42
42
|
execa
|
|
43
43
|
} from "./chunk-EFW34I43.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-TRUQCO4U.js";
|
|
45
45
|
import "./chunk-TZFWAJVB.js";
|
|
46
46
|
|
|
47
47
|
// ../../packages/sandbox-hetzner/dist/chunk-YIQFCUWT.js
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; import { fileURLToPath as __f } from 'node:url'; import { dirname as __d } from 'node:path'; const require = __cr(import.meta.url); const __filename = __f(import.meta.url); const __dirname = __d(__filename);
|
|
2
2
|
import {
|
|
3
3
|
AUTH_TOKEN_PATH
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-PROXBLRJ.js";
|
|
5
|
+
import "./chunk-TRUQCO4U.js";
|
|
6
6
|
import "./chunk-TZFWAJVB.js";
|
|
7
7
|
|
|
8
8
|
// lib/hub-token.ts
|