@replayio/app-building 1.21.0 → 1.23.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 +30 -3
- package/dist/container.d.ts +2 -0
- package/dist/container.js +2 -0
- 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,33 @@ 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
|
+
### Task structure
|
|
186
|
+
|
|
187
|
+
Each task in the queue (local or webhook) has the following fields:
|
|
188
|
+
|
|
189
|
+
| Field | Type | Required | Description |
|
|
190
|
+
|---|---|---|---|
|
|
191
|
+
| `id` | `string` | Auto-assigned | UUID for coordination. Auto-assigned by `add-task` if not provided. Included in `task.started`/`task.done` webhook events. |
|
|
192
|
+
| `skill` | `string` | Yes | Path to the skill file (e.g. `skills/tasks/build/writeApp.md`). |
|
|
193
|
+
| `subtasks` | `string[]` | Yes | List of subtask descriptions. |
|
|
194
|
+
| `app` | `string` | No | App name (directory under `apps/`). |
|
|
195
|
+
| `prompt` | `string` | No | Raw prompt for message-derived tasks (no skill file). |
|
|
196
|
+
| `command` | `string` | No | Custom command to run instead of the default `claude` CLI. |
|
|
197
|
+
| `maxAttempts` | `number` | No | Maximum attempts before giving up. Default: 5. |
|
|
198
|
+
| `timeoutMinutes` | `number` | No | Per-attempt time limit in minutes. Agent is killed if exceeded. |
|
|
199
|
+
|
|
200
|
+
### External task queue
|
|
201
|
+
|
|
202
|
+
Set `config.taskWebhookUrl` to a GET endpoint that returns tasks to process. When the
|
|
203
|
+
local task queue is empty, the container GETs this URL (with the same `Bearer` token from
|
|
204
|
+
`webhookSecret`) and expects a JSON response:
|
|
205
|
+
|
|
206
|
+
- `{ "tasks": [{ "skill": "...", "subtasks": [...], ... }, ...] }` — process these tasks
|
|
207
|
+
- `{}` or `{ "tasks": [] }` — no tasks available, go idle
|
|
208
|
+
|
|
209
|
+
The first task is processed immediately; any remaining tasks are added to the local queue.
|
|
210
|
+
Tasks use the same structure documented above.
|
|
211
|
+
|
|
185
212
|
## Webhooks
|
|
186
213
|
|
|
187
214
|
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.
|
|
@@ -218,8 +245,8 @@ Every POST body has this shape:
|
|
|
218
245
|
| `message.started` | Message processing begins | `iteration`, `prompt` |
|
|
219
246
|
| `message.done` | Message processing complete | `messageId`, `cost_usd`, `duration_ms`, `num_turns` |
|
|
220
247
|
| `message.error` | Message processing failed | `messageId`, `error` |
|
|
221
|
-
| `task.started` | Task processing begins | `iteration`, `skill`, `subtasks`, `prompt` |
|
|
222
|
-
| `task.done` | Task processing complete | `skill`, `subtasks`, `prompt`, `cost`, `totalCost`, `failed`, `pendingTasks`, `duration_ms` |
|
|
248
|
+
| `task.started` | Task processing begins | `id`, `iteration`, `skill`, `subtasks`, `prompt` |
|
|
249
|
+
| `task.done` | Task processing complete | `id`, `skill`, `subtasks`, `prompt`, `cost`, `totalCost`, `failed`, `pendingTasks`, `duration_ms` |
|
|
223
250
|
| `log` | Each log line | `line` |
|
|
224
251
|
|
|
225
252
|
### Example
|
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
|
@@ -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)
|