@replayio/app-building 1.28.0 → 1.30.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 +11 -1
- package/dist/index.js +15 -19
- 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,6 +115,10 @@ 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;
|
|
@@ -186,4 +196,4 @@ interface Task {
|
|
|
186
196
|
*/
|
|
187
197
|
declare function findReadyTask(pendingTasks: Task[], completedTasks: Pick<Task, "id" | "parentTaskId">[]): Task | null;
|
|
188
198
|
|
|
189
|
-
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
|
{
|
|
@@ -133,10 +137,6 @@ async function destroyMachine(app, token, machineId, volumeId) {
|
|
|
133
137
|
});
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
|
-
async function listMachines(app, token) {
|
|
137
|
-
const res = await flyFetch(`/apps/${app}/machines`, token);
|
|
138
|
-
return await res.json();
|
|
139
|
-
}
|
|
140
140
|
async function listVolumes(app, token) {
|
|
141
141
|
const res = await flyFetch(`/apps/${app}/volumes`, token);
|
|
142
142
|
return await res.json();
|
|
@@ -336,19 +336,15 @@ async function startRemoteContainerImpl(config, repo) {
|
|
|
336
336
|
const machineName = `${prefix}-${uniqueId}`;
|
|
337
337
|
const extra = buildExtraEnv(config, machineName);
|
|
338
338
|
const containerEnv = buildContainerEnv(repo, config.infisical, extra);
|
|
339
|
-
const existing = await listMachines(config.flyApp, config.flyToken);
|
|
340
|
-
if (existing.length > 0) {
|
|
341
|
-
console.log(`${existing.length} existing machine(s) in ${config.flyApp}:`);
|
|
342
|
-
for (const m of existing) {
|
|
343
|
-
console.log(` ${m.id} (${m.name}) \u2014 ${m.state}`);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
339
|
console.log("Creating Fly machine (with volume)...");
|
|
347
340
|
let machineId = "";
|
|
348
341
|
let volumeId = "";
|
|
349
342
|
for (let attempt = 0; attempt < 5; attempt++) {
|
|
350
343
|
try {
|
|
351
|
-
const result = await createMachine(config.flyApp, config.flyToken, imageRef, containerEnv, machineName
|
|
344
|
+
const result = await createMachine(config.flyApp, config.flyToken, imageRef, containerEnv, machineName, {
|
|
345
|
+
guest: config.flyGuest,
|
|
346
|
+
volumeSizeGb: config.flyVolumeSizeGb
|
|
347
|
+
});
|
|
352
348
|
machineId = result.machineId;
|
|
353
349
|
volumeId = result.volumeId;
|
|
354
350
|
break;
|