Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/agent-worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ small current/version namespace records and mirrors the current version to
`/workspace/<workspaceSlug>/uploads/` on the user's persistent Daytona volume before exposing it.
An exact replay is idempotent; uploading new bytes at the same path creates a retained version and
updates the working copy. First-run app scaffolding preserves the `uploads/` directory, and restored
template projects reuse their persistent dependency installation instead of rebuilding the
workspace. Project deletion removes the namespace during fenced workspace cleanup and the existing
resource-deletion prefix sweep removes every immutable object. Account deletion clears both through
the existing account state and R2 lifecycle phases.
template projects reuse a complete persistent dependency installation or repair an interrupted one
instead of rebuilding the workspace. Project deletion removes the namespace during fenced workspace
cleanup and the existing resource-deletion prefix sweep removes every immutable object. Account
deletion clears both through the existing account state and R2 lifecycle phases.

Run creation validates the gateway payload with the shared `CreateRunSchema` from
`packages/types` before selecting the run-scoped `AgentRun` Durable Object. The
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ export async function installAppBuilderDependencies(
dir: string,
mobile = false,
): Promise<void> {
const networkTimeoutMs = mobile ? 300_000 : 120_000;
const installTimeoutMs = mobile ? 300_000 : 120_000;
try {
await executeShellExec(
{
command: ["pnpm", "install", "--frozen-lockfile", "--offline"],
cwd: dir,
timeoutMs: 120_000,
timeoutMs: installTimeoutMs,
},
{ sandbox },
);
Expand All @@ -111,7 +111,7 @@ export async function installAppBuilderDependencies(
"4",
],
cwd: dir,
timeoutMs: networkTimeoutMs,
timeoutMs: installTimeoutMs,
},
{ sandbox },
);
Expand Down
13 changes: 11 additions & 2 deletions apps/agent-worker/src/durable-objects/agent-run-app-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ async function prepareTemplateWorkspace(
setRunStage(mobile ? "Preparing the Expo workspace." : "Preparing the Next.js workspace.");
if (!shouldBootstrap) {
setRunStage("Restoring the app workspace.");
if (!(await hasInstalledAppBuilderDependencies(sandbox, workspace.dir))) {
if (!(await hasInstalledAppBuilderDependencies(sandbox, workspace.dir, mobile))) {
await installAppBuilderDependencies(sandbox, logger, workspace.dir, mobile);
}
if (mobile) {
Expand Down Expand Up @@ -599,10 +599,19 @@ async function hasExistingAppBuilderWorkspace(
async function hasInstalledAppBuilderDependencies(
sandbox: ProjectSandboxStub,
dir: string,
mobile: boolean,
): Promise<boolean> {
const requiredPaths = mobile
? [
"node_modules/.pnpm",
"node_modules/@expo/metro-runtime",
"node_modules/react-dom",
"node_modules/react-native-web",
]
: ["node_modules/.pnpm", "node_modules/next", "node_modules/react", "node_modules/react-dom"];
const result = await executeShellTerminal(
{
command: `test -d ${dir}/node_modules/.pnpm`,
command: requiredPaths.map((path) => `test -d ${dir}/${path}`).join(" && "),
cwd: "/workspace",
timeoutMs: 10_000,
},
Expand Down