@boxes-dev/dvb-runtime 1.0.1113 → 1.0.1114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-init-guides/flow.md +8 -4
- package/dist/bin/dvb.mjs +405 -178
- package/dist/bin/dvbd.mjs +4 -4
- package/dist/product-docs/references/desktop-workbench.md +4 -4
- package/dist/product-docs/references/fork-workflows.md +4 -3
- package/dist/product-docs/references/getting-started.md +1 -1
- package/dist/product-docs/references/managed-environment-files.md +58 -0
- package/dist/product-docs/references/member-managed-files.md +28 -20
- package/dist/product-docs/references/mobile.md +6 -4
- package/dist/product-docs/references/onbox-agent-tools.md +170 -52
- package/dist/product-docs/references/ports-terminal-and-runtime.md +19 -8
- package/dist/product-docs/references/project-setup.md +9 -2
- package/dist/product-docs/references/team-template.md +3 -2
- package/dist/product-docs/references/template-box-environment.md +14 -12
- package/dist/product-docs/references/threads-and-agents.md +33 -15
- package/package.json +2 -2
package/dist/bin/dvb.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9cbc3858-b3e6-5f8d-9e71-d79a39e38e58")}catch(e){}}();
|
|
4
4
|
import { createRequire as __dvbCreateRequire } from "node:module";
|
|
5
5
|
import { dirname as __dvbDirname } from "node:path";
|
|
6
6
|
import { fileURLToPath as __dvbFileURLToPath } from "node:url";
|
|
@@ -35814,17 +35814,17 @@ function updateRateLimits(limits, { statusCode, headers }, now = safeDateNow())
|
|
|
35814
35814
|
for (const limit of rateLimitHeader.trim().split(",")) {
|
|
35815
35815
|
const [retryAfter, categories, , , namespaces] = limit.split(":", 5);
|
|
35816
35816
|
const headerDelay = parseInt(retryAfter, 10);
|
|
35817
|
-
const
|
|
35817
|
+
const delay7 = (!isNaN(headerDelay) ? headerDelay : 60) * 1e3;
|
|
35818
35818
|
if (!categories) {
|
|
35819
|
-
updatedRateLimits.all = now +
|
|
35819
|
+
updatedRateLimits.all = now + delay7;
|
|
35820
35820
|
} else {
|
|
35821
35821
|
for (const category of categories.split(";")) {
|
|
35822
35822
|
if (category === "metric_bucket") {
|
|
35823
35823
|
if (!namespaces || namespaces.split(";").includes("custom")) {
|
|
35824
|
-
updatedRateLimits[category] = now +
|
|
35824
|
+
updatedRateLimits[category] = now + delay7;
|
|
35825
35825
|
}
|
|
35826
35826
|
} else {
|
|
35827
|
-
updatedRateLimits[category] = now +
|
|
35827
|
+
updatedRateLimits[category] = now + delay7;
|
|
35828
35828
|
}
|
|
35829
35829
|
}
|
|
35830
35830
|
}
|
|
@@ -70565,9 +70565,9 @@ var init_sentry = __esm({
|
|
|
70565
70565
|
uncaughtExceptionMonitorInstalled = false;
|
|
70566
70566
|
currentDevboxSentryUser = null;
|
|
70567
70567
|
readBuildMetadata = () => {
|
|
70568
|
-
const rawPackageVersion = "1.0.
|
|
70569
|
-
const rawGitSha = "
|
|
70570
|
-
const rawSentryRelease = "boxes-dev-dvb@1.0.
|
|
70568
|
+
const rawPackageVersion = "1.0.1114";
|
|
70569
|
+
const rawGitSha = "8751be962096c774547e09b75191953bdb1ad8e5";
|
|
70570
|
+
const rawSentryRelease = "boxes-dev-dvb@1.0.1114+8751be962096c774547e09b75191953bdb1ad8e5";
|
|
70571
70571
|
const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
|
|
70572
70572
|
const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
|
|
70573
70573
|
const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
|
|
@@ -76240,7 +76240,7 @@ var init_packageVersion = __esm({
|
|
|
76240
76240
|
return path18.join(process.cwd(), "dvb");
|
|
76241
76241
|
};
|
|
76242
76242
|
readEmbeddedPackageVersion = () => {
|
|
76243
|
-
const raw = "1.0.
|
|
76243
|
+
const raw = "1.0.1114";
|
|
76244
76244
|
return trimVersion(raw);
|
|
76245
76245
|
};
|
|
76246
76246
|
readNearestPackageMetadata = (basePath) => {
|
|
@@ -85365,27 +85365,27 @@ var init_authentication_manager = __esm({
|
|
|
85365
85365
|
);
|
|
85366
85366
|
return;
|
|
85367
85367
|
}
|
|
85368
|
-
let
|
|
85368
|
+
let delay7 = Math.min(
|
|
85369
85369
|
MAXIMUM_REFRESH_DELAY,
|
|
85370
85370
|
(tokenValiditySeconds - this.refreshTokenLeewaySeconds) * 1e3
|
|
85371
85371
|
);
|
|
85372
|
-
if (
|
|
85372
|
+
if (delay7 <= 0) {
|
|
85373
85373
|
this.logger.warn(
|
|
85374
85374
|
`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${tokenValiditySeconds}s`
|
|
85375
85375
|
);
|
|
85376
|
-
|
|
85376
|
+
delay7 = 0;
|
|
85377
85377
|
}
|
|
85378
85378
|
const refetchTokenTimeoutId = setTimeout(() => {
|
|
85379
85379
|
this._logVerbose("running scheduled token refetch");
|
|
85380
85380
|
void this.refetchToken();
|
|
85381
|
-
},
|
|
85381
|
+
}, delay7);
|
|
85382
85382
|
this.setAuthState({
|
|
85383
85383
|
state: "waitingForScheduledRefetch",
|
|
85384
85384
|
refetchTokenTimeoutId,
|
|
85385
85385
|
config: this.authState.config
|
|
85386
85386
|
});
|
|
85387
85387
|
this._logVerbose(
|
|
85388
|
-
`scheduled preemptive auth token refetching in ${
|
|
85388
|
+
`scheduled preemptive auth token refetching in ${delay7}ms`
|
|
85389
85389
|
);
|
|
85390
85390
|
}
|
|
85391
85391
|
// Protects against simultaneous calls to `setConfig`
|
|
@@ -96439,14 +96439,14 @@ var init_ports2 = __esm({
|
|
|
96439
96439
|
return;
|
|
96440
96440
|
}
|
|
96441
96441
|
this.controlPlaneStateRetryAttempt += 1;
|
|
96442
|
-
const
|
|
96442
|
+
const delay7 = Math.min(
|
|
96443
96443
|
this.subscriptionRetryDelayMs * 2 ** (this.controlPlaneStateRetryAttempt - 1),
|
|
96444
96444
|
this.subscriptionRetryMaxDelayMs
|
|
96445
96445
|
);
|
|
96446
96446
|
this.controlPlaneStateRetryTimer = setTimeout(() => {
|
|
96447
96447
|
this.controlPlaneStateRetryTimer = null;
|
|
96448
96448
|
void this.ensureControlPlaneStateSubscription();
|
|
96449
|
-
},
|
|
96449
|
+
}, delay7);
|
|
96450
96450
|
this.controlPlaneStateRetryTimer.unref?.();
|
|
96451
96451
|
}
|
|
96452
96452
|
async ensureControlPlaneStateSubscription() {
|
|
@@ -96510,11 +96510,11 @@ var init_ports2 = __esm({
|
|
|
96510
96510
|
return;
|
|
96511
96511
|
}
|
|
96512
96512
|
const elapsed = Date.now() - this.disconnectedControlPlaneSince;
|
|
96513
|
-
const
|
|
96513
|
+
const delay7 = Math.max(0, this.subscriptionStaleDisconnectMs - elapsed);
|
|
96514
96514
|
this.staleDisconnectReconnectTimer = setTimeout(() => {
|
|
96515
96515
|
this.staleDisconnectReconnectTimer = null;
|
|
96516
96516
|
void this.maybeReconnectStaleControlPlaneSubscriptions();
|
|
96517
|
-
},
|
|
96517
|
+
}, delay7);
|
|
96518
96518
|
this.staleDisconnectReconnectTimer.unref?.();
|
|
96519
96519
|
}
|
|
96520
96520
|
async maybeReconnectStaleControlPlaneSubscriptions() {
|
|
@@ -97401,14 +97401,14 @@ var init_ports2 = __esm({
|
|
|
97401
97401
|
}
|
|
97402
97402
|
const attempt = (this.subscriptionRetryAttempts.get(box) ?? 0) + 1;
|
|
97403
97403
|
this.subscriptionRetryAttempts.set(box, attempt);
|
|
97404
|
-
const
|
|
97404
|
+
const delay7 = Math.min(
|
|
97405
97405
|
this.subscriptionRetryDelayMs * 2 ** (attempt - 1),
|
|
97406
97406
|
this.subscriptionRetryMaxDelayMs
|
|
97407
97407
|
);
|
|
97408
97408
|
const timer = setTimeout(() => {
|
|
97409
97409
|
this.subscriptionRetryTimers.delete(box);
|
|
97410
97410
|
void this.ensureSubscription(box);
|
|
97411
|
-
},
|
|
97411
|
+
}, delay7);
|
|
97412
97412
|
timer.unref?.();
|
|
97413
97413
|
this.subscriptionRetryTimers.set(box, timer);
|
|
97414
97414
|
}
|
|
@@ -97417,14 +97417,14 @@ var init_ports2 = __esm({
|
|
|
97417
97417
|
return;
|
|
97418
97418
|
}
|
|
97419
97419
|
this.knownBoxRetryAttempt += 1;
|
|
97420
|
-
const
|
|
97420
|
+
const delay7 = Math.min(
|
|
97421
97421
|
this.subscriptionRetryDelayMs * 2 ** (this.knownBoxRetryAttempt - 1),
|
|
97422
97422
|
this.subscriptionRetryMaxDelayMs
|
|
97423
97423
|
);
|
|
97424
97424
|
this.knownBoxRetryTimer = setTimeout(() => {
|
|
97425
97425
|
this.knownBoxRetryTimer = null;
|
|
97426
97426
|
void this.ensureKnownBoxSubscription();
|
|
97427
|
-
},
|
|
97427
|
+
}, delay7);
|
|
97428
97428
|
this.knownBoxRetryTimer.unref?.();
|
|
97429
97429
|
}
|
|
97430
97430
|
handleSubscriptionError(box, subscription) {
|
|
@@ -102883,30 +102883,30 @@ var init_dist7 = __esm({
|
|
|
102883
102883
|
const activeTicksCount = this.#getActiveTicksCount();
|
|
102884
102884
|
if (activeTicksCount >= this.#intervalCap) {
|
|
102885
102885
|
const oldestTick = this.#strictTicks[this.#strictTicksStartIndex];
|
|
102886
|
-
const
|
|
102887
|
-
this.#createIntervalTimeout(
|
|
102886
|
+
const delay7 = this.#interval - (now - oldestTick);
|
|
102887
|
+
this.#createIntervalTimeout(delay7);
|
|
102888
102888
|
return true;
|
|
102889
102889
|
}
|
|
102890
102890
|
return false;
|
|
102891
102891
|
}
|
|
102892
102892
|
if (this.#intervalId === void 0) {
|
|
102893
|
-
const
|
|
102894
|
-
if (
|
|
102893
|
+
const delay7 = this.#intervalEnd - now;
|
|
102894
|
+
if (delay7 < 0) {
|
|
102895
102895
|
this.#intervalCount = this.#carryoverIntervalCount ? this.#pending : 0;
|
|
102896
102896
|
} else {
|
|
102897
|
-
this.#createIntervalTimeout(
|
|
102897
|
+
this.#createIntervalTimeout(delay7);
|
|
102898
102898
|
return true;
|
|
102899
102899
|
}
|
|
102900
102900
|
}
|
|
102901
102901
|
return false;
|
|
102902
102902
|
}
|
|
102903
|
-
#createIntervalTimeout(
|
|
102903
|
+
#createIntervalTimeout(delay7) {
|
|
102904
102904
|
if (this.#timeoutId !== void 0) {
|
|
102905
102905
|
return;
|
|
102906
102906
|
}
|
|
102907
102907
|
this.#timeoutId = setTimeout(() => {
|
|
102908
102908
|
this.#onResumeInterval();
|
|
102909
|
-
},
|
|
102909
|
+
}, delay7);
|
|
102910
102910
|
}
|
|
102911
102911
|
#clearIntervalTimer() {
|
|
102912
102912
|
if (this.#intervalId) {
|
|
@@ -138981,8 +138981,8 @@ var init_connect2 = __esm({
|
|
|
138981
138981
|
pendingPortLogs.set(event.port, token);
|
|
138982
138982
|
const delays = [30, 60, 120, 200];
|
|
138983
138983
|
void (async () => {
|
|
138984
|
-
for (const
|
|
138985
|
-
await new Promise((resolve3) => setTimeout(resolve3,
|
|
138984
|
+
for (const delay7 of delays) {
|
|
138985
|
+
await new Promise((resolve3) => setTimeout(resolve3, delay7));
|
|
138986
138986
|
if (pendingPortLogs.get(event.port) !== token) {
|
|
138987
138987
|
return;
|
|
138988
138988
|
}
|
|
@@ -143735,7 +143735,8 @@ var init_onboxAgentPermissionRequestProtocol = __esm({
|
|
|
143735
143735
|
"edit-tailscale-integration",
|
|
143736
143736
|
"edit-google-cloud-integration",
|
|
143737
143737
|
"change-aws-profile",
|
|
143738
|
-
"enable-tailscale-integration"
|
|
143738
|
+
"enable-tailscale-integration",
|
|
143739
|
+
"change-team-membership"
|
|
143739
143740
|
];
|
|
143740
143741
|
ONBOX_AGENT_THREAD_GRANT_PERMISSIONS = [
|
|
143741
143742
|
"edit-template-box",
|
|
@@ -143748,7 +143749,8 @@ var init_onboxAgentPermissionRequestProtocol = __esm({
|
|
|
143748
143749
|
];
|
|
143749
143750
|
ONBOX_AGENT_EXACT_ACTION_PERMISSIONS = [
|
|
143750
143751
|
"change-aws-profile",
|
|
143751
|
-
"enable-tailscale-integration"
|
|
143752
|
+
"enable-tailscale-integration",
|
|
143753
|
+
"change-team-membership"
|
|
143752
143754
|
];
|
|
143753
143755
|
isOnboxAgentExactActionPermission = (permission) => ONBOX_AGENT_EXACT_ACTION_PERMISSIONS.includes(
|
|
143754
143756
|
permission
|
|
@@ -143768,7 +143770,7 @@ var init_onboxAgentPermissionRequestProtocol = __esm({
|
|
|
143768
143770
|
});
|
|
143769
143771
|
|
|
143770
143772
|
// ../../../../shared/onboxAgentPermissionRequestPresentation.ts
|
|
143771
|
-
var permissionQuestions, threadGrantScope, describeAwsAccess, presentAction, buildOnboxAgentPermissionRequestPresentation;
|
|
143773
|
+
var permissionQuestions, threadGrantScope, describeAwsAccess, teamRoleLabel, presentTeamMembershipChange, presentAction, buildOnboxAgentPermissionRequestPresentation;
|
|
143772
143774
|
var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
143773
143775
|
"../../../../shared/onboxAgentPermissionRequestPresentation.ts"() {
|
|
143774
143776
|
"use strict";
|
|
@@ -143790,25 +143792,26 @@ var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
|
143790
143792
|
"create-team-templates": "Allow agents to create Team Templates?",
|
|
143791
143793
|
"edit-devbox-lifecycle": "Allow agents to edit devbox lifecycle?",
|
|
143792
143794
|
"edit-template-maintenance": "Allow agents to edit template maintenance?",
|
|
143793
|
-
"update-thread-titles": "Allow agents to
|
|
143795
|
+
"update-thread-titles": "Allow agents to rename threads and devboxes?",
|
|
143794
143796
|
"move-devboxes-to-folders": "Allow agents to move devboxes to folders?",
|
|
143795
|
-
"create-devbox-folders": "Allow agents to create devbox folders?",
|
|
143797
|
+
"create-devbox-folders": "Allow agents to create and manage devbox folders?",
|
|
143796
143798
|
"edit-template-box": "Allow this thread to edit the Template box?",
|
|
143797
|
-
"edit-project-settings": "Allow this thread to edit
|
|
143798
|
-
"edit-team-template": "Allow this thread to edit
|
|
143799
|
+
"edit-project-settings": "Allow this thread to edit settings?",
|
|
143800
|
+
"edit-team-template": "Allow this thread to edit team settings?",
|
|
143799
143801
|
"edit-personal-environment": "Allow this thread to edit your environment variables?",
|
|
143800
143802
|
"edit-automations": "Allow this thread to edit your automations?",
|
|
143801
143803
|
"edit-tailscale-integration": "Allow this thread to change Tailscale auto-connect?",
|
|
143802
143804
|
"edit-google-cloud-integration": "Allow this thread to choose the Google Cloud project?",
|
|
143803
143805
|
"change-aws-profile": "Allow this thread to change an AWS profile?",
|
|
143804
|
-
"enable-tailscale-integration": "Allow this thread to enable Tailscale?"
|
|
143806
|
+
"enable-tailscale-integration": "Allow this thread to enable Tailscale?",
|
|
143807
|
+
"change-team-membership": "Allow this thread to change your team's members?"
|
|
143805
143808
|
};
|
|
143806
143809
|
threadGrantScope = (permission, teamTemplateName) => {
|
|
143807
143810
|
switch (permission) {
|
|
143808
143811
|
case "edit-template-box":
|
|
143809
|
-
return "For the next 3 hours, the agent in this thread will be able to run commands on this project's Template box, change project settings and environment variables, change your account
|
|
143812
|
+
return "For the next 3 hours, the agent in this thread will be able to run commands on this project's Template box, change project settings and environment variables, change your account preferences, and take snapshots that future devboxes will use. Agent permission defaults remain user-only.";
|
|
143810
143813
|
case "edit-project-settings":
|
|
143811
|
-
return "For the next 3 hours, the agent in this thread will be able to change settings and your environment and member-file values in this
|
|
143814
|
+
return "For the next 3 hours, the agent in this thread will be able to change this project's settings, Project URLs, and your environment and member-file values in it, and share this thread with your team. It will also be able to change your account preferences, such as notifications, idle sleep, Git identity, and agent replies. Agent permission defaults remain user-only.";
|
|
143812
143815
|
case "edit-personal-environment":
|
|
143813
143816
|
return "For the next 3 hours, the agent in this thread will be able to add, change, and remove your own environment variables in this project. Changes will reach all your devboxes in this project.";
|
|
143814
143817
|
case "edit-tailscale-integration":
|
|
@@ -143818,10 +143821,58 @@ var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
|
143818
143821
|
case "edit-automations":
|
|
143819
143822
|
return "For the next 3 hours, the agent in this thread will be able to create, change, pause, run, and delete your automations in this project. Each run will either start a new agent thread on a new devbox, without this conversation, or send the prompt to an existing thread, such as this one. Runs will use box-hours.";
|
|
143820
143823
|
case "edit-team-template":
|
|
143821
|
-
return
|
|
143824
|
+
return teamTemplateName === null ? "For the next 3 hours, the agent in this thread will be able to change your team's settings, such as its name, teammate thread access, idle sleep default, allowed domains, and static egress destinations, and change settings in this project and your account preferences. Membership changes will still need your approval each time. Agent permission defaults remain user-only." : `For the next 3 hours, the agent in this thread will be able to change your team's settings and edit the "${teamTemplateName}" Team Template, including its settings and environment variables, change settings in this project and your account preferences, and save new versions for your team. Membership changes will still need your approval each time. Agent permission defaults remain user-only.`;
|
|
143822
143825
|
}
|
|
143823
143826
|
};
|
|
143824
143827
|
describeAwsAccess = (choice) => `${choice.roleName} in ${choice.accountName} (${choice.accountId})`;
|
|
143828
|
+
teamRoleLabel = (role) => role === "admin" ? "Admin" : "Member";
|
|
143829
|
+
presentTeamMembershipChange = ({
|
|
143830
|
+
teamName,
|
|
143831
|
+
change
|
|
143832
|
+
}) => {
|
|
143833
|
+
const team = { label: "Team", value: teamName };
|
|
143834
|
+
switch (change.type) {
|
|
143835
|
+
case "invite":
|
|
143836
|
+
return {
|
|
143837
|
+
question: `Invite ${change.email} to ${teamName}?`,
|
|
143838
|
+
details: [
|
|
143839
|
+
team,
|
|
143840
|
+
{ label: "Email", value: change.email },
|
|
143841
|
+
{ label: "Role", value: teamRoleLabel(change.role) }
|
|
143842
|
+
],
|
|
143843
|
+
scope: change.role === "admin" ? "They'll get an email invite. If they accept, they'll join as an admin and be able to manage the team's members and settings." : "They'll get an email invite. If they accept, they'll join the team as a member.",
|
|
143844
|
+
allowLabel: "Send invite"
|
|
143845
|
+
};
|
|
143846
|
+
case "revoke_invite":
|
|
143847
|
+
return {
|
|
143848
|
+
question: `Revoke the invite for ${change.email}?`,
|
|
143849
|
+
details: [
|
|
143850
|
+
team,
|
|
143851
|
+
{ label: "Email", value: change.email },
|
|
143852
|
+
{ label: "Role", value: teamRoleLabel(change.role) }
|
|
143853
|
+
],
|
|
143854
|
+
scope: "Their invite link will stop working. You can invite them again later.",
|
|
143855
|
+
allowLabel: "Revoke invite"
|
|
143856
|
+
};
|
|
143857
|
+
case "set_role": {
|
|
143858
|
+
const name = change.memberName ?? change.memberEmail ?? "this teammate";
|
|
143859
|
+
return {
|
|
143860
|
+
question: change.toRole === "admin" ? `Make ${name} a team admin?` : `Change ${name} to a member?`,
|
|
143861
|
+
details: [
|
|
143862
|
+
team,
|
|
143863
|
+
{
|
|
143864
|
+
label: "Teammate",
|
|
143865
|
+
value: change.memberName && change.memberEmail ? `${change.memberName} (${change.memberEmail})` : name
|
|
143866
|
+
},
|
|
143867
|
+
{ label: "Current role", value: teamRoleLabel(change.fromRole) },
|
|
143868
|
+
{ label: "New role", value: teamRoleLabel(change.toRole) }
|
|
143869
|
+
],
|
|
143870
|
+
scope: change.toRole === "admin" ? "They'll be able to manage the team's members and settings." : "They'll no longer be able to manage the team's members and settings.",
|
|
143871
|
+
allowLabel: "Change role"
|
|
143872
|
+
};
|
|
143873
|
+
}
|
|
143874
|
+
}
|
|
143875
|
+
};
|
|
143825
143876
|
presentAction = (action) => {
|
|
143826
143877
|
const common = {
|
|
143827
143878
|
automationsSectionSentence: null,
|
|
@@ -143849,6 +143900,9 @@ var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
|
143849
143900
|
allowLabel: adding ? "Add AWS profile" : "Change AWS profile"
|
|
143850
143901
|
};
|
|
143851
143902
|
}
|
|
143903
|
+
if (action.kind === "team_membership") {
|
|
143904
|
+
return { ...common, ...presentTeamMembershipChange(action) };
|
|
143905
|
+
}
|
|
143852
143906
|
return {
|
|
143853
143907
|
...common,
|
|
143854
143908
|
question: `Enable Tailscale in ${action.projectAlias}?`,
|
|
@@ -215819,7 +215873,7 @@ function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, ex
|
|
|
215819
215873
|
for (const subscriber of animationSubscribersRef.current.values()) {
|
|
215820
215874
|
nextDueTime = Math.min(nextDueTime, subscriber.nextDueTime);
|
|
215821
215875
|
}
|
|
215822
|
-
const
|
|
215876
|
+
const delay7 = Math.max(0, nextDueTime - performance.now());
|
|
215823
215877
|
animationTimerRef.current = setTimeout(() => {
|
|
215824
215878
|
animationTimerRef.current = void 0;
|
|
215825
215879
|
const currentTime = performance.now();
|
|
@@ -215833,7 +215887,7 @@ function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, ex
|
|
|
215833
215887
|
subscriber.nextDueTime = subscriber.startTime + elapsedFrames * subscriber.interval;
|
|
215834
215888
|
}
|
|
215835
215889
|
scheduleAnimationTick();
|
|
215836
|
-
},
|
|
215890
|
+
}, delay7);
|
|
215837
215891
|
}, [clearAnimationTimer]);
|
|
215838
215892
|
const animationSubscribe = (0, import_react15.useCallback)((callback, interval) => {
|
|
215839
215893
|
const startTime = performance.now();
|
|
@@ -252445,6 +252499,7 @@ var init_progressReport = __esm({
|
|
|
252445
252499
|
detail: step.detail ?? null,
|
|
252446
252500
|
blockedSections: step.blockedSections ?? [],
|
|
252447
252501
|
uploadPercent: step.uploadPercent ?? null,
|
|
252502
|
+
...step.github ? { github: step.github } : {},
|
|
252448
252503
|
projectId: project.projectId,
|
|
252449
252504
|
alias: project.alias,
|
|
252450
252505
|
cliVersion: readCurrentPackageMetadata().version ?? null
|
|
@@ -263752,7 +263807,7 @@ var init_instanceType = __esm({
|
|
|
263752
263807
|
});
|
|
263753
263808
|
|
|
263754
263809
|
// src/devbox/agentInit/githubAccess.ts
|
|
263755
|
-
var resolveAgentInitGithubAccessPage, isRecord9, explainAgentInitGithubRenames, describeRenames, shellArgument, agentInitGithubRenamedOriginIssue, agentInitGithubRenamedDependencyIssue, githubIssue, githubInventoryFailureIssue, readAgentInitProjectLayoutRepos, manifestGithubAccess, buildAgentInitGithubManifestIssues, normalizeInventoryRepository, normalizeInventoryInstallation, matchAgentInitGithubRepositories, agentInitGithubBlockedIssue, resolveAgentInitGithubAccessDefault, resolveAgentInitManagedGithubAccess, configureAgentInitGithubAccess, resolveAgentInitGithubDependencies;
|
|
263810
|
+
var resolveAgentInitGithubAccessPage, isRecord9, explainAgentInitGithubRenames, describeRenames, shellArgument, agentInitGithubRenamedOriginIssue, agentInitGithubRenamedDependencyIssue, githubIssue, githubInventoryFailureIssue, agentInitGithubInventoryRetry, readAgentInitProjectLayoutRepos, manifestGithubAccess, buildAgentInitGithubManifestIssues, normalizeInventoryRepository, normalizeInventoryInstallation, matchAgentInitGithubRepositories, agentInitGithubBlockedIssue, resolveAgentInitGithubAccessDefault, resolveAgentInitManagedGithubAccess, configureAgentInitGithubAccess, resolveAgentInitGithubDependencies;
|
|
263756
263811
|
var init_githubAccess = __esm({
|
|
263757
263812
|
"src/devbox/agentInit/githubAccess.ts"() {
|
|
263758
263813
|
"use strict";
|
|
@@ -263874,6 +263929,32 @@ var init_githubAccess = __esm({
|
|
|
263874
263929
|
);
|
|
263875
263930
|
}
|
|
263876
263931
|
};
|
|
263932
|
+
agentInitGithubInventoryRetry = (inventoryResult) => {
|
|
263933
|
+
if (!isRecord9(inventoryResult) || inventoryResult["ok"] !== false) {
|
|
263934
|
+
return null;
|
|
263935
|
+
}
|
|
263936
|
+
const errorCode = inventoryResult["errorCode"];
|
|
263937
|
+
switch (errorCode) {
|
|
263938
|
+
case "authorization_upgrade_required":
|
|
263939
|
+
case "not_connected":
|
|
263940
|
+
case "reconnect_required":
|
|
263941
|
+
return "sign_in";
|
|
263942
|
+
case "rate_limited":
|
|
263943
|
+
case "github_access_changed":
|
|
263944
|
+
case "github_unavailable": {
|
|
263945
|
+
const retryAfterMs = inventoryResult["retryAfterMs"];
|
|
263946
|
+
return {
|
|
263947
|
+
message: githubInventoryFailureIssue({
|
|
263948
|
+
appInstallationUrl: null,
|
|
263949
|
+
errorCode
|
|
263950
|
+
}).message,
|
|
263951
|
+
retryAfterMs: typeof retryAfterMs === "number" ? retryAfterMs : null
|
|
263952
|
+
};
|
|
263953
|
+
}
|
|
263954
|
+
default:
|
|
263955
|
+
return null;
|
|
263956
|
+
}
|
|
263957
|
+
};
|
|
263877
263958
|
readAgentInitProjectLayoutRepos = ({
|
|
263878
263959
|
repo,
|
|
263879
263960
|
validation
|
|
@@ -265924,21 +266005,23 @@ var init_gitSsh = __esm({
|
|
|
265924
266005
|
}
|
|
265925
266006
|
});
|
|
265926
266007
|
|
|
265927
|
-
// src/devbox/commands/agentInit/
|
|
265928
|
-
|
|
265929
|
-
var
|
|
265930
|
-
|
|
266008
|
+
// src/devbox/commands/agentInit/githubConnect.ts
|
|
266009
|
+
import { setTimeout as delay3 } from "node:timers/promises";
|
|
266010
|
+
var SIGN_IN_POLL_MS, REPOSITORY_ACCESS_POLL_MS, GITHUB_CONNECT_WAIT_TIMEOUT_MS, SSH_ALTERNATIVE, startAgentInitGithubConnection, isGithubConnectionReady, readInstallUrl, evaluateGithubStep, openGithubPage, isTerminalWaitError, connectAgentInitGithub;
|
|
266011
|
+
var init_githubConnect = __esm({
|
|
266012
|
+
"src/devbox/commands/agentInit/githubConnect.ts"() {
|
|
265931
266013
|
"use strict";
|
|
265932
|
-
|
|
265933
|
-
init_parse6();
|
|
266014
|
+
init_devboxCore();
|
|
265934
266015
|
init_githubAccess();
|
|
265935
|
-
init_progressReport();
|
|
265936
266016
|
init_remoteSession();
|
|
265937
|
-
|
|
266017
|
+
init_auth();
|
|
266018
|
+
init_authErrors();
|
|
265938
266019
|
init_browser();
|
|
265939
|
-
|
|
265940
|
-
|
|
265941
|
-
|
|
266020
|
+
init_controlPlane();
|
|
266021
|
+
SIGN_IN_POLL_MS = 3e3;
|
|
266022
|
+
REPOSITORY_ACCESS_POLL_MS = 1e4;
|
|
266023
|
+
GITHUB_CONNECT_WAIT_TIMEOUT_MS = 20 * 60 * 1e3;
|
|
266024
|
+
SSH_ALTERNATIVE = " If the user can't get App access, stop this command, set `githubAccess: ssh`, and follow `dvb agent-init guide git-ssh`.";
|
|
265942
266025
|
startAgentInitGithubConnection = async ({
|
|
265943
266026
|
client,
|
|
265944
266027
|
openBrowserFn = openBrowser,
|
|
@@ -265960,57 +266043,10 @@ var init_github = __esm({
|
|
|
265960
266043
|
} else {
|
|
265961
266044
|
print("GitHub connection opened in your browser.");
|
|
265962
266045
|
}
|
|
265963
|
-
print(
|
|
265964
|
-
"After GitHub is connected, re-run `dvb agent-init check` to verify repository access."
|
|
265965
|
-
);
|
|
265966
266046
|
print(
|
|
265967
266047
|
"GitHub App access covers pull, push, pull requests, and limited CLI commands. For more GitHub CLI access, authorize optional personal access on the connection page or run `gh auth login` on a managed box."
|
|
265968
266048
|
);
|
|
265969
266049
|
};
|
|
265970
|
-
runAgentInitGithub = async (args) => {
|
|
265971
|
-
const action = args[0] === "cli" ? args[1] : null;
|
|
265972
|
-
const connect3 = args.length === 1 && args[0] === "connect";
|
|
265973
|
-
if (!connect3 && !(args.length === 2 && (action === "status" || action === "enable" || action === "disable"))) {
|
|
265974
|
-
throw usageError(["agent-init", "github"], GITHUB_USAGE);
|
|
265975
|
-
}
|
|
265976
|
-
const context34 = await createAgentInitServiceContext({ cwd: process.cwd() });
|
|
265977
|
-
if (!connect3) {
|
|
265978
|
-
await manageAgentInitGithubCliAccess({
|
|
265979
|
-
client: context34.controlPlaneClient,
|
|
265980
|
-
action
|
|
265981
|
-
});
|
|
265982
|
-
return;
|
|
265983
|
-
}
|
|
265984
|
-
let project = null;
|
|
265985
|
-
const outcome = await connectAgentInitGithub({
|
|
265986
|
-
client: context34.controlPlaneClient,
|
|
265987
|
-
loadProjectLayoutRepos: async () => {
|
|
265988
|
-
project = await resolveAgentInitProject({
|
|
265989
|
-
projectPath: process.cwd()
|
|
265990
|
-
});
|
|
265991
|
-
return readAgentInitProjectLayoutRepos(project);
|
|
265992
|
-
},
|
|
265993
|
-
loadGithubDependencies: async () => {
|
|
265994
|
-
if (!project) throw new Error("The project could not be resolved.");
|
|
265995
|
-
const text = await readManifestTextIfPresent(
|
|
265996
|
-
project.statePaths.manifestPath
|
|
265997
|
-
);
|
|
265998
|
-
if (text === null) return void 0;
|
|
265999
|
-
const parsed = parseAgentInitManifest(text);
|
|
266000
|
-
if (!parsed.ok)
|
|
266001
|
-
throw new Error(
|
|
266002
|
-
"Fix the setup manifest with `dvb agent-init check` before checking dependency access."
|
|
266003
|
-
);
|
|
266004
|
-
return parsed.manifest.version === 1 ? void 0 : parsed.manifest.githubDependencies;
|
|
266005
|
-
}
|
|
266006
|
-
});
|
|
266007
|
-
if (outcome !== null) {
|
|
266008
|
-
await reportAgentInitStepBestEffort({
|
|
266009
|
-
controlPlaneToken: context34.controlPlaneToken,
|
|
266010
|
-
step: { command: "github_connect", outcome, phase: null }
|
|
266011
|
-
});
|
|
266012
|
-
}
|
|
266013
|
-
};
|
|
266014
266050
|
isGithubConnectionReady = (connectionResult) => {
|
|
266015
266051
|
if (!connectionResult || typeof connectionResult !== "object") return false;
|
|
266016
266052
|
const connection = connectionResult.connection;
|
|
@@ -266018,19 +266054,6 @@ var init_github = __esm({
|
|
|
266018
266054
|
const fields = connection;
|
|
266019
266055
|
return fields["connectionStatus"] === "connected" && fields["tokenStatus"] === "valid" && fields["authorizationStatus"] === "current" && fields["credentialUpgradeStatus"] !== "update_available";
|
|
266020
266056
|
};
|
|
266021
|
-
findAgentInitGithubAccessIssue = async ({
|
|
266022
|
-
client,
|
|
266023
|
-
projectLayoutRepos
|
|
266024
|
-
}) => {
|
|
266025
|
-
const connectionResult = await client.getGithubConnection({});
|
|
266026
|
-
const resolution = resolveAgentInitManagedGithubAccess({
|
|
266027
|
-
connectionResult,
|
|
266028
|
-
inventoryResult: isGithubConnectionReady(connectionResult) ? await client.listGithubRepositories({}) : null,
|
|
266029
|
-
projectLayoutRepos,
|
|
266030
|
-
offerSshAlternative: true
|
|
266031
|
-
});
|
|
266032
|
-
return resolution.ok ? null : resolution.issue;
|
|
266033
|
-
};
|
|
266034
266057
|
readInstallUrl = (result) => {
|
|
266035
266058
|
if (!result || typeof result !== "object") return null;
|
|
266036
266059
|
const fields = result;
|
|
@@ -266041,29 +266064,25 @@ var init_github = __esm({
|
|
|
266041
266064
|
installUrl: typeof fields["installUrl"] === "string" ? fields["installUrl"] : null
|
|
266042
266065
|
};
|
|
266043
266066
|
};
|
|
266044
|
-
|
|
266067
|
+
evaluateGithubStep = async ({
|
|
266045
266068
|
client,
|
|
266046
|
-
|
|
266047
|
-
loadGithubDependencies,
|
|
266048
|
-
openBrowserFn = openBrowser,
|
|
266049
|
-
print = console.log
|
|
266069
|
+
loadRepositories
|
|
266050
266070
|
}) => {
|
|
266051
266071
|
const connectionResult = await client.getGithubConnection({});
|
|
266052
|
-
if (!isGithubConnectionReady(connectionResult)) {
|
|
266053
|
-
await startAgentInitGithubConnection({ client, openBrowserFn, print });
|
|
266054
|
-
return "waiting";
|
|
266055
|
-
}
|
|
266072
|
+
if (!isGithubConnectionReady(connectionResult)) return { kind: "sign_in" };
|
|
266056
266073
|
const inventoryResult = await client.listGithubRepositories({});
|
|
266057
|
-
const
|
|
266074
|
+
const inventoryRetry = agentInitGithubInventoryRetry(inventoryResult);
|
|
266075
|
+
if (inventoryRetry === "sign_in") return { kind: "sign_in" };
|
|
266076
|
+
if (inventoryRetry !== null) return { kind: "retry", ...inventoryRetry };
|
|
266077
|
+
const { projectLayoutRepos, githubDependencies } = await loadRepositories();
|
|
266058
266078
|
let resolution = resolveAgentInitManagedGithubAccess({
|
|
266059
266079
|
connectionResult,
|
|
266060
266080
|
inventoryResult,
|
|
266061
266081
|
projectLayoutRepos
|
|
266062
266082
|
});
|
|
266063
266083
|
let issueForRenames = (renames) => agentInitGithubRenamedOriginIssue({ projectLayoutRepos, renames });
|
|
266064
|
-
const githubDependencies = await loadGithubDependencies?.();
|
|
266065
266084
|
const rootRepositoryCount = resolution.ok ? resolution.repositories.length : 0;
|
|
266066
|
-
let sshAlternative =
|
|
266085
|
+
let sshAlternative = true;
|
|
266067
266086
|
if (resolution.ok && githubDependencies && githubDependencies.length > 0) {
|
|
266068
266087
|
resolution = resolveAgentInitGithubDependencies({
|
|
266069
266088
|
connectionResult,
|
|
@@ -266071,7 +266090,7 @@ var init_github = __esm({
|
|
|
266071
266090
|
repositories: githubDependencies
|
|
266072
266091
|
});
|
|
266073
266092
|
issueForRenames = agentInitGithubRenamedDependencyIssue;
|
|
266074
|
-
sshAlternative =
|
|
266093
|
+
sshAlternative = false;
|
|
266075
266094
|
}
|
|
266076
266095
|
if (!resolution.ok) {
|
|
266077
266096
|
resolution = await explainAgentInitGithubRenames({
|
|
@@ -266081,43 +266100,69 @@ var init_github = __esm({
|
|
|
266081
266100
|
});
|
|
266082
266101
|
}
|
|
266083
266102
|
if (resolution.ok) {
|
|
266084
|
-
|
|
266085
|
-
|
|
266086
|
-
|
|
266087
|
-
|
|
266103
|
+
return {
|
|
266104
|
+
kind: "ready",
|
|
266105
|
+
message: `GitHub is connected and boxes.dev can access ${rootRepositoryCount === 1 ? "this project's repository" : `all ${rootRepositoryCount} of this project's repositories`}${githubDependencies?.length ? ` and ${githubDependencies.length} dependency ${githubDependencies.length === 1 ? "repository" : "repositories"}` : ""}. Re-run \`dvb agent-init check\`.`
|
|
266106
|
+
};
|
|
266088
266107
|
}
|
|
266089
266108
|
if (!("missingAccess" in resolution)) {
|
|
266090
|
-
|
|
266091
|
-
print(resolution.issue.fix);
|
|
266092
|
-
return null;
|
|
266109
|
+
return { kind: "blocked", issue: resolution.issue };
|
|
266093
266110
|
}
|
|
266111
|
+
const ssh = sshAlternative ? SSH_ALTERNATIVE : "";
|
|
266094
266112
|
const page = resolveAgentInitGithubAccessPage(resolution.missingAccess);
|
|
266095
|
-
const
|
|
266096
|
-
|
|
266097
|
-
|
|
266113
|
+
const repositoryFullNames = resolution.missingAccess.repositoryFullNames;
|
|
266114
|
+
const repositories = repositoryFullNames.join(", ");
|
|
266115
|
+
const wait = (ownerLogin, url4) => ({
|
|
266116
|
+
step: "repository_access",
|
|
266117
|
+
ownerLogin,
|
|
266118
|
+
repositories: repositoryFullNames,
|
|
266119
|
+
url: url4,
|
|
266120
|
+
sshAlternative
|
|
266121
|
+
});
|
|
266098
266122
|
if (page.kind === "installation_settings") {
|
|
266099
|
-
|
|
266100
|
-
|
|
266101
|
-
|
|
266102
|
-
|
|
266103
|
-
|
|
266104
|
-
} else {
|
|
266105
|
-
const target = readInstallUrl(
|
|
266106
|
-
await client.getGithubInstallTarget({ ownerLogin: page.ownerLogin })
|
|
266107
|
-
);
|
|
266108
|
-
if (target?.ok && target.installUrl === null) {
|
|
266109
|
-
print(
|
|
266110
|
-
`${repositories} belongs to @${page.ownerLogin}'s personal account. Ask @${page.ownerLogin} to give boxes.dev access to it on GitHub.${sshAlternative}`
|
|
266111
|
-
);
|
|
266112
|
-
return null;
|
|
266113
|
-
}
|
|
266114
|
-
url3 = target?.ok ? target.installUrl : resolution.missingAccess.appInstallationUrl;
|
|
266115
|
-
instruction = target?.ok && target.accountType === "user" ? `Give boxes.dev access to ${repositories} on GitHub: keep "All repositories" selected, or choose repositories that include them. Then re-run \`dvb agent-init check\`.` : `Give boxes.dev access to ${repositories} on GitHub: choose @${page.ownerLogin}, then keep "All repositories" selected if GitHub offers it, or choose repositories that include them. If @${page.ownerLogin} requires an owner's approval, GitHub will send your request to an organization owner. If @${page.ownerLogin} isn't listed, ask an owner of @${page.ownerLogin} to give boxes.dev access. Then re-run \`dvb agent-init check\`.${sshAlternative}`;
|
|
266123
|
+
return {
|
|
266124
|
+
kind: "repository_access",
|
|
266125
|
+
wait: wait(page.ownerLogin, page.url),
|
|
266126
|
+
instruction: `Add ${repositories} to the boxes.dev GitHub App for @${page.ownerLogin}.${ssh}`
|
|
266127
|
+
};
|
|
266116
266128
|
}
|
|
266117
|
-
if (
|
|
266118
|
-
|
|
266119
|
-
return null
|
|
266129
|
+
if (page.kind === "install") {
|
|
266130
|
+
const instruction2 = `Give boxes.dev access to ${repositories} on GitHub for each account that owns them. An organization owner may need to approve the request.${ssh}`;
|
|
266131
|
+
return page.url === null ? {
|
|
266132
|
+
kind: "blocked",
|
|
266133
|
+
issue: { ...resolution.issue, fix: instruction2 }
|
|
266134
|
+
} : {
|
|
266135
|
+
kind: "repository_access",
|
|
266136
|
+
wait: wait(null, page.url),
|
|
266137
|
+
instruction: instruction2
|
|
266138
|
+
};
|
|
266120
266139
|
}
|
|
266140
|
+
const target = readInstallUrl(
|
|
266141
|
+
await client.getGithubInstallTarget({ ownerLogin: page.ownerLogin })
|
|
266142
|
+
);
|
|
266143
|
+
if (target?.ok && target.installUrl === null) {
|
|
266144
|
+
return {
|
|
266145
|
+
kind: "blocked",
|
|
266146
|
+
issue: {
|
|
266147
|
+
...resolution.issue,
|
|
266148
|
+
message: `${repositories} belongs to @${page.ownerLogin}'s personal account.`,
|
|
266149
|
+
fix: `Ask @${page.ownerLogin} to give boxes.dev access to it on GitHub.${ssh}`
|
|
266150
|
+
}
|
|
266151
|
+
};
|
|
266152
|
+
}
|
|
266153
|
+
const url3 = target?.ok ? target.installUrl : resolution.missingAccess.appInstallationUrl;
|
|
266154
|
+
const instruction = target?.ok && target.accountType === "user" ? `Give boxes.dev access to ${repositories} on GitHub: keep "All repositories" selected, or choose repositories that include them.` : `Give boxes.dev access to ${repositories} on GitHub: choose @${page.ownerLogin}, then keep "All repositories" selected if GitHub offers it, or choose repositories that include them. If @${page.ownerLogin} requires an owner's approval, GitHub will send your request to an organization owner. If @${page.ownerLogin} isn't listed, ask an owner of @${page.ownerLogin} to give boxes.dev access.${ssh}`;
|
|
266155
|
+
return url3 === null ? { kind: "blocked", issue: { ...resolution.issue, fix: instruction } } : {
|
|
266156
|
+
kind: "repository_access",
|
|
266157
|
+
wait: wait(page.ownerLogin, url3),
|
|
266158
|
+
instruction
|
|
266159
|
+
};
|
|
266160
|
+
};
|
|
266161
|
+
openGithubPage = ({
|
|
266162
|
+
openBrowserFn,
|
|
266163
|
+
print,
|
|
266164
|
+
url: url3
|
|
266165
|
+
}) => {
|
|
266121
266166
|
if (isRemoteSession()) {
|
|
266122
266167
|
print(
|
|
266123
266168
|
"Ask the user to open this link in their browser to continue on GitHub:"
|
|
@@ -266129,8 +266174,186 @@ var init_github = __esm({
|
|
|
266129
266174
|
print("The browser did not open. Continue on GitHub at:");
|
|
266130
266175
|
print(url3);
|
|
266131
266176
|
}
|
|
266132
|
-
|
|
266133
|
-
|
|
266177
|
+
};
|
|
266178
|
+
isTerminalWaitError = (error55) => error55 instanceof ControlPlaneLoginRequiredError || error55 instanceof UpgradeRequiredError || isControlPlaneAuthRefreshError(error55) && !isControlPlaneRequestUnavailableError(error55.cause);
|
|
266179
|
+
connectAgentInitGithub = async ({
|
|
266180
|
+
client,
|
|
266181
|
+
loadProjectLayoutRepos,
|
|
266182
|
+
loadGithubDependencies,
|
|
266183
|
+
openBrowserFn = openBrowser,
|
|
266184
|
+
print = console.log,
|
|
266185
|
+
report,
|
|
266186
|
+
sleep: sleep9 = (ms) => delay3(ms),
|
|
266187
|
+
now = Date.now,
|
|
266188
|
+
timeoutMs = GITHUB_CONNECT_WAIT_TIMEOUT_MS
|
|
266189
|
+
}) => {
|
|
266190
|
+
const loadRepositories = async () => ({
|
|
266191
|
+
projectLayoutRepos: await loadProjectLayoutRepos(),
|
|
266192
|
+
githubDependencies: await loadGithubDependencies?.()
|
|
266193
|
+
});
|
|
266194
|
+
let currentWait = null;
|
|
266195
|
+
let currentWaitKey = null;
|
|
266196
|
+
let changedAt = now();
|
|
266197
|
+
let lastRetryMessage = null;
|
|
266198
|
+
const stopWaiting = () => {
|
|
266199
|
+
print(
|
|
266200
|
+
`Stopped waiting after 20 minutes without progress on GitHub. Run \`dvb agent-init github connect\` again when the user is ready.${currentWait?.step === "repository_access" && currentWait.sshAlternative ? " If the user can't get App access, set `githubAccess: ssh` and follow `dvb agent-init guide git-ssh`." : ""}`
|
|
266201
|
+
);
|
|
266202
|
+
return "timed_out";
|
|
266203
|
+
};
|
|
266204
|
+
let step = await evaluateGithubStep({ client, loadRepositories });
|
|
266205
|
+
for (; ; ) {
|
|
266206
|
+
if (step.kind === "ready") {
|
|
266207
|
+
print(step.message);
|
|
266208
|
+
await report({ outcome: "ok" });
|
|
266209
|
+
return "ok";
|
|
266210
|
+
}
|
|
266211
|
+
if (step.kind === "blocked") {
|
|
266212
|
+
print(step.issue.message);
|
|
266213
|
+
print(step.issue.fix);
|
|
266214
|
+
await report({
|
|
266215
|
+
outcome: "blocked",
|
|
266216
|
+
detail: step.issue.message,
|
|
266217
|
+
blockedSections: [step.issue.location]
|
|
266218
|
+
});
|
|
266219
|
+
return "blocked";
|
|
266220
|
+
}
|
|
266221
|
+
let pollMs;
|
|
266222
|
+
if (step.kind === "retry") {
|
|
266223
|
+
pollMs = Math.max(REPOSITORY_ACCESS_POLL_MS, step.retryAfterMs ?? 0);
|
|
266224
|
+
if (step.message !== lastRetryMessage) {
|
|
266225
|
+
print(
|
|
266226
|
+
`${step.message} Checking again in ${String(Math.ceil(pollMs / 1e3))} seconds.`
|
|
266227
|
+
);
|
|
266228
|
+
lastRetryMessage = step.message;
|
|
266229
|
+
}
|
|
266230
|
+
} else {
|
|
266231
|
+
lastRetryMessage = null;
|
|
266232
|
+
const wait = step.kind === "sign_in" ? { step: "sign_in" } : step.wait;
|
|
266233
|
+
pollMs = step.kind === "sign_in" ? SIGN_IN_POLL_MS : REPOSITORY_ACCESS_POLL_MS;
|
|
266234
|
+
const waitKey = JSON.stringify(wait);
|
|
266235
|
+
if (waitKey !== currentWaitKey) {
|
|
266236
|
+
const newStep = currentWait?.step !== wait.step;
|
|
266237
|
+
if (step.kind === "sign_in") {
|
|
266238
|
+
if (newStep) {
|
|
266239
|
+
await startAgentInitGithubConnection({
|
|
266240
|
+
client,
|
|
266241
|
+
openBrowserFn,
|
|
266242
|
+
print
|
|
266243
|
+
});
|
|
266244
|
+
}
|
|
266245
|
+
} else {
|
|
266246
|
+
if (currentWait?.step === "sign_in") print("GitHub is connected.");
|
|
266247
|
+
if (newStep && step.wait.url !== null) {
|
|
266248
|
+
openGithubPage({ openBrowserFn, print, url: step.wait.url });
|
|
266249
|
+
}
|
|
266250
|
+
print(step.instruction);
|
|
266251
|
+
}
|
|
266252
|
+
if (currentWait === null) {
|
|
266253
|
+
print(
|
|
266254
|
+
"Waiting for the user to finish on GitHub. This command will exit when boxes.dev can access the project's repositories, or after 20 minutes without progress. Keep it running in the background."
|
|
266255
|
+
);
|
|
266256
|
+
}
|
|
266257
|
+
await report({ outcome: "waiting", github: wait });
|
|
266258
|
+
currentWait = wait;
|
|
266259
|
+
currentWaitKey = waitKey;
|
|
266260
|
+
changedAt = now();
|
|
266261
|
+
}
|
|
266262
|
+
}
|
|
266263
|
+
const remainingMs = timeoutMs - (now() - changedAt);
|
|
266264
|
+
if (remainingMs <= 0) return stopWaiting();
|
|
266265
|
+
await sleep9(Math.min(pollMs, remainingMs));
|
|
266266
|
+
if (step.kind === "retry" && pollMs >= remainingMs) return stopWaiting();
|
|
266267
|
+
try {
|
|
266268
|
+
step = await evaluateGithubStep({ client, loadRepositories });
|
|
266269
|
+
} catch (error55) {
|
|
266270
|
+
if (isTerminalWaitError(error55)) throw error55;
|
|
266271
|
+
step = {
|
|
266272
|
+
kind: "retry",
|
|
266273
|
+
message: `Couldn't check GitHub: ${(error55 instanceof Error ? error55.message : String(error55)).replace(/\.$/u, "")}.`,
|
|
266274
|
+
retryAfterMs: null
|
|
266275
|
+
};
|
|
266276
|
+
}
|
|
266277
|
+
}
|
|
266278
|
+
};
|
|
266279
|
+
}
|
|
266280
|
+
});
|
|
266281
|
+
|
|
266282
|
+
// src/devbox/commands/agentInit/github.ts
|
|
266283
|
+
var GITHUB_USAGE, runAgentInitGithub, findAgentInitGithubAccessIssue, manageAgentInitGithubCliAccess;
|
|
266284
|
+
var init_github = __esm({
|
|
266285
|
+
"src/devbox/commands/agentInit/github.ts"() {
|
|
266286
|
+
"use strict";
|
|
266287
|
+
init_commandCore();
|
|
266288
|
+
init_parse6();
|
|
266289
|
+
init_githubAccess();
|
|
266290
|
+
init_progressReport();
|
|
266291
|
+
init_service();
|
|
266292
|
+
init_errors4();
|
|
266293
|
+
init_values();
|
|
266294
|
+
init_githubConnect();
|
|
266295
|
+
GITHUB_USAGE = "Usage: dvb agent-init github connect | github cli <status|enable|disable>";
|
|
266296
|
+
runAgentInitGithub = async (args) => {
|
|
266297
|
+
const action = args[0] === "cli" ? args[1] : null;
|
|
266298
|
+
const connect3 = args.length === 1 && args[0] === "connect";
|
|
266299
|
+
if (!connect3 && !(args.length === 2 && (action === "status" || action === "enable" || action === "disable"))) {
|
|
266300
|
+
throw usageError(["agent-init", "github"], GITHUB_USAGE);
|
|
266301
|
+
}
|
|
266302
|
+
const context34 = await createAgentInitServiceContext({ cwd: process.cwd() });
|
|
266303
|
+
if (!connect3) {
|
|
266304
|
+
await manageAgentInitGithubCliAccess({
|
|
266305
|
+
client: context34.controlPlaneClient,
|
|
266306
|
+
action
|
|
266307
|
+
});
|
|
266308
|
+
return;
|
|
266309
|
+
}
|
|
266310
|
+
let project = null;
|
|
266311
|
+
const outcome = await connectAgentInitGithub({
|
|
266312
|
+
client: context34.controlPlaneClient,
|
|
266313
|
+
// Resolving the project calls boxes.dev, so do it once. The manifest's
|
|
266314
|
+
// dependencies are read again on every check.
|
|
266315
|
+
loadProjectLayoutRepos: async () => {
|
|
266316
|
+
project ??= await resolveAgentInitProject({
|
|
266317
|
+
projectPath: process.cwd()
|
|
266318
|
+
});
|
|
266319
|
+
return readAgentInitProjectLayoutRepos(project);
|
|
266320
|
+
},
|
|
266321
|
+
loadGithubDependencies: async () => {
|
|
266322
|
+
if (!project) throw new Error("The project could not be resolved.");
|
|
266323
|
+
const text = await readManifestTextIfPresent(
|
|
266324
|
+
project.statePaths.manifestPath
|
|
266325
|
+
);
|
|
266326
|
+
if (text === null) return void 0;
|
|
266327
|
+
const parsed = parseAgentInitManifest(text);
|
|
266328
|
+
if (!parsed.ok)
|
|
266329
|
+
throw new Error(
|
|
266330
|
+
"Fix the setup manifest with `dvb agent-init check` before checking dependency access."
|
|
266331
|
+
);
|
|
266332
|
+
return parsed.manifest.version === 1 ? void 0 : parsed.manifest.githubDependencies;
|
|
266333
|
+
},
|
|
266334
|
+
report: async (step) => {
|
|
266335
|
+
const controlPlaneToken = await context34.getControlPlaneToken().catch(() => null);
|
|
266336
|
+
if (controlPlaneToken === null) return;
|
|
266337
|
+
await reportAgentInitStepBestEffort({
|
|
266338
|
+
controlPlaneToken,
|
|
266339
|
+
step: { command: "github_connect", phase: null, ...step }
|
|
266340
|
+
});
|
|
266341
|
+
}
|
|
266342
|
+
});
|
|
266343
|
+
if (outcome === "timed_out") process.exitCode = 1;
|
|
266344
|
+
};
|
|
266345
|
+
findAgentInitGithubAccessIssue = async ({
|
|
266346
|
+
client,
|
|
266347
|
+
projectLayoutRepos
|
|
266348
|
+
}) => {
|
|
266349
|
+
const connectionResult = await client.getGithubConnection({});
|
|
266350
|
+
const resolution = resolveAgentInitManagedGithubAccess({
|
|
266351
|
+
connectionResult,
|
|
266352
|
+
inventoryResult: isGithubConnectionReady(connectionResult) ? await client.listGithubRepositories({}) : null,
|
|
266353
|
+
projectLayoutRepos,
|
|
266354
|
+
offerSshAlternative: true
|
|
266355
|
+
});
|
|
266356
|
+
return resolution.ok ? null : resolution.issue;
|
|
266134
266357
|
};
|
|
266135
266358
|
manageAgentInitGithubCliAccess = async ({
|
|
266136
266359
|
client,
|
|
@@ -272293,12 +272516,12 @@ var init_proxy2 = __esm({
|
|
|
272293
272516
|
});
|
|
272294
272517
|
|
|
272295
272518
|
// src/devbox/commands/init/codex/retry.ts
|
|
272296
|
-
var DEFAULT_CODEX_EXEC_MAX_ATTEMPTS,
|
|
272519
|
+
var DEFAULT_CODEX_EXEC_MAX_ATTEMPTS, delay4, computeCodexExecRetryDelayMs, RetryableCodexExecError;
|
|
272297
272520
|
var init_retry = __esm({
|
|
272298
272521
|
"src/devbox/commands/init/codex/retry.ts"() {
|
|
272299
272522
|
"use strict";
|
|
272300
272523
|
DEFAULT_CODEX_EXEC_MAX_ATTEMPTS = 3;
|
|
272301
|
-
|
|
272524
|
+
delay4 = async (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
272302
272525
|
computeCodexExecRetryDelayMs = (attempt) => {
|
|
272303
272526
|
const baseMs = 1e3;
|
|
272304
272527
|
const capMs = 8e3;
|
|
@@ -273623,7 +273846,7 @@ ${stdout}`;
|
|
|
273623
273846
|
sessionId: resumeThreadId,
|
|
273624
273847
|
reason: error55.message
|
|
273625
273848
|
});
|
|
273626
|
-
await
|
|
273849
|
+
await delay4(delayMs);
|
|
273627
273850
|
prompt = resumeThreadId ? "continue" : commandArgs.prompt;
|
|
273628
273851
|
}
|
|
273629
273852
|
}
|
|
@@ -275516,7 +275739,7 @@ ${execResult.stderr}`;
|
|
|
275516
275739
|
});
|
|
275517
275740
|
while (!artifacts.completionMessage && Date.now() < deadline) {
|
|
275518
275741
|
const remainingMs = deadline - Date.now();
|
|
275519
|
-
await
|
|
275742
|
+
await delay4(Math.min(Math.max(1, pollIntervalMs), remainingMs));
|
|
275520
275743
|
artifacts = await readRemoteCodexCompletionArtifacts({
|
|
275521
275744
|
client,
|
|
275522
275745
|
spriteAlias,
|
|
@@ -275680,7 +275903,7 @@ ${execResult.stderr}`;
|
|
|
275680
275903
|
});
|
|
275681
275904
|
while (!summary && Date.now() < deadline) {
|
|
275682
275905
|
const remainingMs = deadline - Date.now();
|
|
275683
|
-
await
|
|
275906
|
+
await delay4(Math.min(Math.max(1, pollIntervalMs), remainingMs));
|
|
275684
275907
|
summary = await readRemoteSetupTodoSummary({
|
|
275685
275908
|
client,
|
|
275686
275909
|
spriteAlias,
|
|
@@ -276286,7 +276509,7 @@ ${execResult.stderr}`;
|
|
|
276286
276509
|
await announceRunningThread(thread.id);
|
|
276287
276510
|
return;
|
|
276288
276511
|
}
|
|
276289
|
-
await
|
|
276512
|
+
await delay4(Math.max(1, completionArtifactsPollIntervalMs));
|
|
276290
276513
|
continue;
|
|
276291
276514
|
}
|
|
276292
276515
|
const endedSummary = await waitForCanonicalRemoteSetupSummary({
|
|
@@ -276353,7 +276576,7 @@ ${execResult.stderr}`;
|
|
|
276353
276576
|
reason: failure.error.message
|
|
276354
276577
|
})}`
|
|
276355
276578
|
);
|
|
276356
|
-
await
|
|
276579
|
+
await delay4(delayMs);
|
|
276357
276580
|
}
|
|
276358
276581
|
}
|
|
276359
276582
|
if (!lastMessage) {
|
|
@@ -277490,7 +277713,7 @@ codex login --boxes-dev-managed-auth-override`
|
|
|
277490
277713
|
reason: failure.error.message
|
|
277491
277714
|
})}`
|
|
277492
277715
|
);
|
|
277493
|
-
await
|
|
277716
|
+
await delay4(delayMs);
|
|
277494
277717
|
}
|
|
277495
277718
|
} finally {
|
|
277496
277719
|
if (proxyRoot) {
|
|
@@ -287189,7 +287412,7 @@ var init_gitSigningRemoteInstall = __esm({
|
|
|
287189
287412
|
|
|
287190
287413
|
// src/devbox/commands/init/setupScriptRemoteSetup.ts
|
|
287191
287414
|
import path95 from "node:path";
|
|
287192
|
-
var SETUP_SCRIPT_TIMEOUT_MS, SETUP_SCRIPT_VERIFICATION_TIMEOUT_MS, SETUP_SCRIPT_VERIFICATION_POLL_MS, buildSetupScriptEnvExports, buildRunSetupScript, buildVerificationScript, execRemoteBash2,
|
|
287415
|
+
var SETUP_SCRIPT_TIMEOUT_MS, SETUP_SCRIPT_VERIFICATION_TIMEOUT_MS, SETUP_SCRIPT_VERIFICATION_POLL_MS, buildSetupScriptEnvExports, buildRunSetupScript, buildVerificationScript, execRemoteBash2, delay5, runRemoteSetupScript;
|
|
287193
287416
|
var init_setupScriptRemoteSetup = __esm({
|
|
287194
287417
|
"src/devbox/commands/init/setupScriptRemoteSetup.ts"() {
|
|
287195
287418
|
"use strict";
|
|
@@ -287288,7 +287511,7 @@ var init_setupScriptRemoteSetup = __esm({
|
|
|
287288
287511
|
],
|
|
287289
287512
|
{ timeoutMs: SETUP_SCRIPT_TIMEOUT_MS }
|
|
287290
287513
|
);
|
|
287291
|
-
|
|
287514
|
+
delay5 = async (ms) => await new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
287292
287515
|
runRemoteSetupScript = async ({
|
|
287293
287516
|
client,
|
|
287294
287517
|
spriteAlias,
|
|
@@ -287301,7 +287524,7 @@ var init_setupScriptRemoteSetup = __esm({
|
|
|
287301
287524
|
status,
|
|
287302
287525
|
verificationTimeoutMs = SETUP_SCRIPT_VERIFICATION_TIMEOUT_MS,
|
|
287303
287526
|
verificationPollMs = SETUP_SCRIPT_VERIFICATION_POLL_MS,
|
|
287304
|
-
sleep: sleep9 =
|
|
287527
|
+
sleep: sleep9 = delay5
|
|
287305
287528
|
}) => {
|
|
287306
287529
|
status.stage(`Running setup script (${setupScript.scriptPath})`);
|
|
287307
287530
|
const setupResult = await execRemoteBash2({
|
|
@@ -291539,7 +291762,7 @@ var init_instanceTypeSelection = __esm({
|
|
|
291539
291762
|
// src/devbox/commands/init/index.ts
|
|
291540
291763
|
import path102 from "node:path";
|
|
291541
291764
|
import os38 from "node:os";
|
|
291542
|
-
var requireDaemonJsonOk, resolveInitStatus, mergeLocalPaths, buildRemoteInitPaths, shouldRetryManagedInitCompletionValidation, DEFAULT_INIT_STEP_RETRIES, MANAGED_INIT_COMPLETION_RETRIES, ALIAS_PATTERN4, RESERVED_ALIAS_PATTERN3, DEFAULT_COMPUTE_PROVIDER, CONVEX_DEPLOYMENT_HOST_SUFFIXES,
|
|
291765
|
+
var requireDaemonJsonOk, resolveInitStatus, mergeLocalPaths, buildRemoteInitPaths, shouldRetryManagedInitCompletionValidation, DEFAULT_INIT_STEP_RETRIES, MANAGED_INIT_COMPLETION_RETRIES, ALIAS_PATTERN4, RESERVED_ALIAS_PATTERN3, DEFAULT_COMPUTE_PROVIDER, CONVEX_DEPLOYMENT_HOST_SUFFIXES, delay6, normalizeAlias7, resolveComputeProvider, resolveConvexDeploymentFromUrl, normalizeConvexDeploymentCandidate, resolveManagedDaemonTarget, validateAlias, computeRetryDelayMs, retryInitStep, throwInitCanceled2, promptForIncompleteInitMode, buildDesktopInitResumeBlockedMessage, confirmDestroyExistingDevbox, normalizeMigrationIdentity, validateLegacyProjectMigration, runInit;
|
|
291543
291766
|
var init_init = __esm({
|
|
291544
291767
|
"src/devbox/commands/init/index.ts"() {
|
|
291545
291768
|
"use strict";
|
|
@@ -291644,7 +291867,7 @@ var init_init = __esm({
|
|
|
291644
291867
|
RESERVED_ALIAS_PATTERN3 = /^dvb-[a-f0-9]{12}-/;
|
|
291645
291868
|
DEFAULT_COMPUTE_PROVIDER = "e2b";
|
|
291646
291869
|
CONVEX_DEPLOYMENT_HOST_SUFFIXES = [".convex.cloud", ".convex.site"];
|
|
291647
|
-
|
|
291870
|
+
delay6 = async (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
291648
291871
|
normalizeAlias7 = (value) => value.trim().toLowerCase();
|
|
291649
291872
|
resolveComputeProvider = ({
|
|
291650
291873
|
requested,
|
|
@@ -291767,7 +291990,7 @@ var init_init = __esm({
|
|
|
291767
291990
|
errorCode: getErrorCode(error55),
|
|
291768
291991
|
...error55 instanceof RuntimeApiError ? { status: error55.status } : {}
|
|
291769
291992
|
});
|
|
291770
|
-
await
|
|
291993
|
+
await delay6(computeRetryDelayMs(retryIndex));
|
|
291771
291994
|
}
|
|
291772
291995
|
}
|
|
291773
291996
|
throw lastError instanceof Error ? lastError : new Error(`Init step failed: ${title}`);
|
|
@@ -294900,7 +295123,10 @@ var init_agentPermissionRequests = __esm({
|
|
|
294900
295123
|
json: readBooleanFlag(flags, "json")
|
|
294901
295124
|
};
|
|
294902
295125
|
};
|
|
294903
|
-
listPendingRequests = async (client) => await client.query(listPending, {
|
|
295126
|
+
listPendingRequests = async (client) => await client.query(listPending, {
|
|
295127
|
+
supportsIntegrationPermissions: true,
|
|
295128
|
+
supportsTeamMembershipActions: true
|
|
295129
|
+
});
|
|
294904
295130
|
findPendingRequest = async (client, requestId2) => {
|
|
294905
295131
|
const entries = await listPendingRequests(client);
|
|
294906
295132
|
const entry = entries.find(
|
|
@@ -294961,7 +295187,8 @@ var init_agentPermissionRequests = __esm({
|
|
|
294961
295187
|
requestId: entry.request.requestId,
|
|
294962
295188
|
decision,
|
|
294963
295189
|
scope,
|
|
294964
|
-
supportsIntegrationPermissions: true
|
|
295190
|
+
supportsIntegrationPermissions: true,
|
|
295191
|
+
supportsTeamMembershipActions: true
|
|
294965
295192
|
});
|
|
294966
295193
|
requireDecisionApplied(decision, response.status);
|
|
294967
295194
|
return { decision, scope, status: response.status, entry };
|
|
@@ -301612,4 +301839,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
301612
301839
|
*)
|
|
301613
301840
|
*/
|
|
301614
301841
|
|
|
301615
|
-
//# debugId=
|
|
301842
|
+
//# debugId=9cbc3858-b3e6-5f8d-9e71-d79a39e38e58
|