@replayio/app-building 1.27.0 → 1.29.0
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/README.md +2 -1
- package/dist/index.d.ts +14 -3
- package/dist/index.js +28 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,7 +80,8 @@ The agent can also run `list-secrets` to see which secrets are available, and `s
|
|
|
80
80
|
|
|
81
81
|
| Export | Description |
|
|
82
82
|
|---|---|
|
|
83
|
-
| `ContainerConfig` | `infisical` (required `InfisicalConfig`), optional `projectRoot` (local Docker only), `registry`, `flyToken`/`flyApp` (set both for remote Fly.io), `imageRef`, `webhookUrl`/`webhookSecret`, `taskWebhookUrl` (GET endpoint for external task queue), `addTaskWebhookUrl` (POST endpoint for tasks added by `add-task` script), `detached`, `initialPrompt`, `localPort`, `absorbTasks`, `namePrefix` (default: `"app-building"`). |
|
|
83
|
+
| `ContainerConfig` | `infisical` (required `InfisicalConfig`), optional `projectRoot` (local Docker only), `registry`, `flyToken`/`flyApp` (set both for remote Fly.io), `flyGuest` (override Fly Machine guest sizing; default: 16 performance CPUs / 32 GiB), `flyVolumeSizeGb` (override Fly Volume size in GiB; default: 50), `imageRef`, `webhookUrl`/`webhookSecret`, `taskWebhookUrl` (GET endpoint for external task queue), `addTaskWebhookUrl` (POST endpoint for tasks added by `add-task` script), `detached`, `initialPrompt`, `localPort`, `absorbTasks`, `namePrefix` (default: `"app-building"`). |
|
|
84
|
+
| `FlyGuest` | Fly Machine guest spec: `cpu_kind` (`"shared"` \| `"performance"`), `cpus`, `memory_mb`. |
|
|
84
85
|
| `RepoOptions` | Per-invocation git settings: `repoUrl`, `cloneBranch`, `pushBranch`. |
|
|
85
86
|
| `AgentState` | Returned by `startContainer`. Contains `type`, `containerName`, `port`, `baseUrl`, and Fly-specific fields for remote containers. |
|
|
86
87
|
| `ContainerRegistry` | Interface for container registry storage. Methods: `log`, `markStopped`, `clearStopped`, `getRecent`, `find`, `findAlive`. |
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,12 @@ declare function createBranchSecret(config: InfisicalConfig, branch: string, nam
|
|
|
74
74
|
*/
|
|
75
75
|
declare function getInfisicalConfig(envVars: Record<string, string>): Promise<InfisicalConfig>;
|
|
76
76
|
|
|
77
|
+
interface FlyGuest {
|
|
78
|
+
cpu_kind: "shared" | "performance";
|
|
79
|
+
cpus: number;
|
|
80
|
+
memory_mb: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
77
83
|
interface AgentState {
|
|
78
84
|
type: "local" | "remote";
|
|
79
85
|
containerName: string;
|
|
@@ -109,11 +115,16 @@ interface ContainerConfig {
|
|
|
109
115
|
namePrefix?: string;
|
|
110
116
|
/** Agent command override (e.g. "codex", "gemini"). Default: "claude". */
|
|
111
117
|
agentCommand?: string;
|
|
118
|
+
/** Override the Fly Machine guest sizing. Default: 16 performance CPUs, 32 GiB memory. */
|
|
119
|
+
flyGuest?: FlyGuest;
|
|
120
|
+
/** Override the Fly Volume size in GiB. Default: 50. */
|
|
121
|
+
flyVolumeSizeGb?: number;
|
|
112
122
|
}
|
|
113
123
|
interface RepoOptions {
|
|
114
124
|
repoUrl: string;
|
|
115
125
|
cloneBranch: string;
|
|
116
|
-
|
|
126
|
+
/** If omitted, the container clones the repo but never commits or pushes. */
|
|
127
|
+
pushBranch?: string;
|
|
117
128
|
}
|
|
118
129
|
declare function loadDotEnv(projectRoot: string): Record<string, string>;
|
|
119
130
|
declare function buildImage(config: ContainerConfig): void;
|
|
@@ -121,7 +132,7 @@ declare function buildImage(config: ContainerConfig): void;
|
|
|
121
132
|
* Start a container (local Docker or remote Fly.io based on config).
|
|
122
133
|
* If flyToken and flyApp are set, starts remotely; otherwise locally.
|
|
123
134
|
*/
|
|
124
|
-
declare function startContainer(config: ContainerConfig, repo: RepoOptions): Promise<AgentState>;
|
|
135
|
+
declare function startContainer(config: ContainerConfig, repo: RepoOptions | null): Promise<AgentState>;
|
|
125
136
|
/**
|
|
126
137
|
* Stop a container by its state or registry entry.
|
|
127
138
|
*/
|
|
@@ -185,4 +196,4 @@ interface Task {
|
|
|
185
196
|
*/
|
|
186
197
|
declare function findReadyTask(pendingTasks: Task[], completedTasks: Pick<Task, "id" | "parentTaskId">[]): Task | null;
|
|
187
198
|
|
|
188
|
-
export { type AgentState, type ContainerConfig, type ContainerRegistry, FileContainerRegistry, type HttpOptions, type InfisicalConfig, type RegistryEntry, type RepoOptions, type Task, buildImage, createBranchSecret, fetchBranchSecrets, fetchGlobalSecrets, fetchInfisicalSecrets, findReadyTask, getImageRef, getInfisicalConfig, httpGet, httpOptsFor, httpPost, infisicalLogin, loadDotEnv, probeAlive, spawnTestContainer, startContainer, stopContainer };
|
|
199
|
+
export { type AgentState, type ContainerConfig, type ContainerRegistry, FileContainerRegistry, type FlyGuest, type HttpOptions, type InfisicalConfig, type RegistryEntry, type RepoOptions, type Task, buildImage, createBranchSecret, fetchBranchSecrets, fetchGlobalSecrets, fetchInfisicalSecrets, findReadyTask, getImageRef, getInfisicalConfig, httpGet, httpOptsFor, httpPost, infisicalLogin, loadDotEnv, probeAlive, spawnTestContainer, startContainer, stopContainer };
|
package/dist/index.js
CHANGED
|
@@ -39,13 +39,21 @@ async function deleteVolume(app, token, volumeId) {
|
|
|
39
39
|
method: "DELETE"
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
var DEFAULT_GUEST = {
|
|
43
|
+
cpu_kind: "performance",
|
|
44
|
+
cpus: 16,
|
|
45
|
+
memory_mb: 32768
|
|
46
|
+
};
|
|
47
|
+
var DEFAULT_VOLUME_SIZE_GB = 50;
|
|
48
|
+
async function createMachine(app, token, image, env, name, options = {}) {
|
|
49
|
+
const guest = options.guest ?? DEFAULT_GUEST;
|
|
50
|
+
const volumeSizeGb = options.volumeSizeGb ?? DEFAULT_VOLUME_SIZE_GB;
|
|
43
51
|
const volumeName = `repo_${name.replace(/-/g, "_")}`.slice(0, 30);
|
|
44
52
|
const regions = ["dfw", "iad", "ord", "sjc"];
|
|
45
53
|
let cleanupDone;
|
|
46
54
|
for (const region of regions) {
|
|
47
55
|
console.log(`Creating machine in region ${region}...`);
|
|
48
|
-
const volumeId = await createVolume(app, token, volumeName, region,
|
|
56
|
+
const volumeId = await createVolume(app, token, volumeName, region, volumeSizeGb);
|
|
49
57
|
if (!cleanupDone) {
|
|
50
58
|
cleanupDone = listVolumes(app, token).then((vols) => Promise.all(
|
|
51
59
|
vols.map(async ({ id, attached_machine_id }) => {
|
|
@@ -67,11 +75,7 @@ async function createMachine(app, token, image, env, name) {
|
|
|
67
75
|
env,
|
|
68
76
|
auto_destroy: true,
|
|
69
77
|
restart: { policy: "on-failure", max_retries: 3 },
|
|
70
|
-
guest
|
|
71
|
-
cpu_kind: "performance",
|
|
72
|
-
cpus: 16,
|
|
73
|
-
memory_mb: 32768
|
|
74
|
-
},
|
|
78
|
+
guest,
|
|
75
79
|
mounts: [{ volume: volumeId, path: "/repo" }],
|
|
76
80
|
services: [
|
|
77
81
|
{
|
|
@@ -215,19 +219,25 @@ function findFreePort() {
|
|
|
215
219
|
}
|
|
216
220
|
function buildContainerEnv(repo, infisical, extra = {}) {
|
|
217
221
|
const env = {
|
|
218
|
-
REPO_URL: repo.repoUrl,
|
|
219
|
-
CLONE_BRANCH: repo.cloneBranch,
|
|
220
|
-
PUSH_BRANCH: repo.pushBranch,
|
|
221
|
-
GIT_AUTHOR_NAME: "App Builder",
|
|
222
|
-
GIT_AUTHOR_EMAIL: "app-builder@localhost",
|
|
223
|
-
GIT_COMMITTER_NAME: "App Builder",
|
|
224
|
-
GIT_COMMITTER_EMAIL: "app-builder@localhost",
|
|
225
222
|
PLAYWRIGHT_BROWSERS_PATH: "/opt/playwright",
|
|
226
223
|
INFISICAL_TOKEN: infisical.token,
|
|
227
224
|
INFISICAL_PROJECT_ID: infisical.projectId,
|
|
228
225
|
INFISICAL_ENVIRONMENT: infisical.environment,
|
|
229
226
|
...extra
|
|
230
227
|
};
|
|
228
|
+
if (repo) {
|
|
229
|
+
env.REPO_URL = repo.repoUrl;
|
|
230
|
+
env.CLONE_BRANCH = repo.cloneBranch;
|
|
231
|
+
if (repo.pushBranch) {
|
|
232
|
+
env.PUSH_BRANCH = repo.pushBranch;
|
|
233
|
+
env.GIT_AUTHOR_NAME = "App Builder";
|
|
234
|
+
env.GIT_AUTHOR_EMAIL = "app-builder@localhost";
|
|
235
|
+
env.GIT_COMMITTER_NAME = "App Builder";
|
|
236
|
+
env.GIT_COMMITTER_EMAIL = "app-builder@localhost";
|
|
237
|
+
}
|
|
238
|
+
} else {
|
|
239
|
+
env.NO_REPO = "1";
|
|
240
|
+
}
|
|
231
241
|
if (process.env.DEBUG) {
|
|
232
242
|
env.DEBUG = process.env.DEBUG;
|
|
233
243
|
}
|
|
@@ -342,7 +352,10 @@ async function startRemoteContainerImpl(config, repo) {
|
|
|
342
352
|
let volumeId = "";
|
|
343
353
|
for (let attempt = 0; attempt < 5; attempt++) {
|
|
344
354
|
try {
|
|
345
|
-
const result = await createMachine(config.flyApp, config.flyToken, imageRef, containerEnv, machineName
|
|
355
|
+
const result = await createMachine(config.flyApp, config.flyToken, imageRef, containerEnv, machineName, {
|
|
356
|
+
guest: config.flyGuest,
|
|
357
|
+
volumeSizeGb: config.flyVolumeSizeGb
|
|
358
|
+
});
|
|
346
359
|
machineId = result.machineId;
|
|
347
360
|
volumeId = result.volumeId;
|
|
348
361
|
break;
|