@replayio/app-building 1.20.0 → 1.22.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 +14 -1
- package/dist/container.d.ts +2 -0
- package/dist/container.js +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ 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`, `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), `imageRef`, `webhookUrl`/`webhookSecret`, `taskWebhookUrl` (GET endpoint for external task queue), `detached`, `initialPrompt`, `localPort`, `absorbTasks`, `namePrefix` (default: `"app-building"`). |
|
|
84
84
|
| `RepoOptions` | Per-invocation git settings: `repoUrl`, `cloneBranch`, `pushBranch`. |
|
|
85
85
|
| `AgentState` | Returned by `startContainer`. Contains `type`, `containerName`, `port`, `baseUrl`, and Fly-specific fields for remote containers. |
|
|
86
86
|
| `ContainerRegistry` | Interface for container registry storage. Methods: `log`, `markStopped`, `clearStopped`, `getRecent`, `find`, `findAlive`. |
|
|
@@ -182,6 +182,19 @@ Set `config.absorbTasks = true` to have the container absorb task files from oth
|
|
|
182
182
|
at startup. This is off by default. When enabled, the container scans `tasks/` for task files
|
|
183
183
|
belonging to other containers, merges their tasks into its own queue, and deletes the foreign files.
|
|
184
184
|
|
|
185
|
+
### External task queue
|
|
186
|
+
|
|
187
|
+
Set `config.taskWebhookUrl` to a GET endpoint that returns tasks to process. When the
|
|
188
|
+
local task queue is empty, the container GETs this URL (with the same `Bearer` token from
|
|
189
|
+
`webhookSecret`) and expects a JSON response:
|
|
190
|
+
|
|
191
|
+
- `{ "tasks": [{ "skill": "...", "subtasks": [...], ... }, ...] }` — process these tasks
|
|
192
|
+
- `{}` or `{ "tasks": [] }` — no tasks available, go idle
|
|
193
|
+
|
|
194
|
+
The first task is processed immediately; any remaining tasks are added to the local queue.
|
|
195
|
+
Tasks support the same fields as local tasks: `skill`, `subtasks`, `app`, `command`,
|
|
196
|
+
`maxAttempts`, `timeoutMinutes`.
|
|
197
|
+
|
|
185
198
|
## Webhooks
|
|
186
199
|
|
|
187
200
|
Set `webhookUrl` on `ContainerConfig` to receive real-time notifications of container activity. The container POSTs JSON to that URL on key events (no retries; failures are logged to stderr). Set `webhookSecret` to include a `Bearer` token in the `Authorization` header for authenticating webhook requests.
|
package/dist/container.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface ContainerConfig {
|
|
|
19
19
|
imageRef?: string;
|
|
20
20
|
webhookUrl?: string;
|
|
21
21
|
webhookSecret?: string;
|
|
22
|
+
/** GET endpoint to fetch the next task when the local queue is empty. Uses webhookSecret for auth. */
|
|
23
|
+
taskWebhookUrl?: string;
|
|
22
24
|
/** Start the container in detached mode. It will exit after processing all messages and tasks. */
|
|
23
25
|
detached?: boolean;
|
|
24
26
|
/** Initial prompt to queue at container startup (before the HTTP server accepts external requests). */
|
package/dist/container.js
CHANGED
|
@@ -35,7 +35,7 @@ export function buildImage(config) {
|
|
|
35
35
|
if (!config.projectRoot)
|
|
36
36
|
throw new Error("projectRoot is required for local Docker operations");
|
|
37
37
|
console.log("Building Docker image...");
|
|
38
|
-
execFileSync("docker", ["build", "--network", "host", "-t", IMAGE_NAME, config.projectRoot], {
|
|
38
|
+
execFileSync("docker", ["build", "--platform", "linux/amd64", "--network", "host", "-t", IMAGE_NAME, config.projectRoot], {
|
|
39
39
|
stdio: "inherit",
|
|
40
40
|
timeout: 600000,
|
|
41
41
|
});
|
|
@@ -49,7 +49,7 @@ function ensureImageExists(projectRoot) {
|
|
|
49
49
|
}
|
|
50
50
|
catch {
|
|
51
51
|
console.log("Building Docker image...");
|
|
52
|
-
execFileSync("docker", ["build", "--network", "host", "-t", IMAGE_NAME, projectRoot], {
|
|
52
|
+
execFileSync("docker", ["build", "--platform", "linux/amd64", "--network", "host", "-t", IMAGE_NAME, projectRoot], {
|
|
53
53
|
stdio: "inherit",
|
|
54
54
|
timeout: 600000,
|
|
55
55
|
});
|
|
@@ -102,6 +102,8 @@ function buildExtraEnv(config, containerName) {
|
|
|
102
102
|
};
|
|
103
103
|
if (config.webhookUrl)
|
|
104
104
|
extra.WEBHOOK_URL = config.webhookUrl;
|
|
105
|
+
if (config.taskWebhookUrl)
|
|
106
|
+
extra.TASK_WEBHOOK_URL = config.taskWebhookUrl;
|
|
105
107
|
if (config.webhookSecret)
|
|
106
108
|
extra.WEBHOOK_SECRET = config.webhookSecret;
|
|
107
109
|
if (config.detached)
|
|
@@ -128,7 +130,7 @@ async function startLocalContainer(config, repo) {
|
|
|
128
130
|
const extra = buildExtraEnv(config, containerName);
|
|
129
131
|
extra.PORT = String(containerPort);
|
|
130
132
|
const containerEnv = buildContainerEnv(repo, config.infisical, extra);
|
|
131
|
-
const args = ["run", "-d", "--rm", "--name", containerName];
|
|
133
|
+
const args = ["run", "--platform", "linux/amd64", "-d", "--rm", "--name", containerName];
|
|
132
134
|
args.push("-p", `${hostPort}:${containerPort}`);
|
|
133
135
|
for (const [k, v] of Object.entries(containerEnv)) {
|
|
134
136
|
args.push("--env", `${k}=${v}`);
|
|
@@ -331,7 +333,7 @@ export function spawnTestContainer(config) {
|
|
|
331
333
|
ensureImageExists(config.projectRoot);
|
|
332
334
|
const uniqueId = Math.random().toString(36).slice(2, 8);
|
|
333
335
|
const containerName = `app-building-test-${uniqueId}`;
|
|
334
|
-
const args = ["run", "-it", "--rm", "--name", containerName];
|
|
336
|
+
const args = ["run", "--platform", "linux/amd64", "-it", "--rm", "--name", containerName];
|
|
335
337
|
args.push("-v", `${config.projectRoot}:/repo`);
|
|
336
338
|
args.push("-w", "/repo");
|
|
337
339
|
args.push("--network", "host");
|