@replayio/app-building 1.3.0 → 1.4.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 CHANGED
@@ -33,15 +33,12 @@ const config: ContainerConfig = {
33
33
  flyApp: envVars.FLY_APP_NAME,
34
34
  };
35
35
 
36
- // Start a remote container (detached — will exit after processing all work)
36
+ // Start a detached container with an initial prompt it will process and exit when done
37
37
  config.detached = true;
38
+ config.initialPrompt = "Build the app";
38
39
  const repo: RepoOptions = { repoUrl: "https://github.com/...", cloneBranch: "main", pushBranch: "main" };
39
40
  const state = await startRemoteContainer(config, repo);
40
41
 
41
- // Send a prompt — the container will process it and exit when done
42
- const httpOpts = httpOptsFor(state);
43
- const { id } = await httpPost(`${state.baseUrl}/message`, { prompt: "Build the app" }, httpOpts);
44
-
45
42
  // Check status
46
43
  const status = await httpGet(`${state.baseUrl}/status`, httpOpts);
47
44
 
@@ -58,7 +55,7 @@ await stopRemoteContainer(config, state);
58
55
 
59
56
  | Export | Description |
60
57
  |---|---|
61
- | `ContainerConfig` | Interface bundling all external state: optional `projectRoot` (only needed for local Docker operations), `envVars`, `registry`, optional `flyToken`/`flyApp`/`imageRef`/`webhookUrl`/`detached`. See [Webhooks](#webhooks) and [Container lifecycle](#container-lifecycle) below. |
58
+ | `ContainerConfig` | Interface bundling all external state: optional `projectRoot` (only needed for local Docker operations), `envVars`, `registry`, optional `flyToken`/`flyApp`/`imageRef`/`webhookUrl`/`detached`/`initialPrompt`. See [Webhooks](#webhooks) and [Container lifecycle](#container-lifecycle) below. |
62
59
  | `RepoOptions` | Per-invocation git settings: `repoUrl`, `cloneBranch`, `pushBranch`. |
63
60
  | `ContainerRegistry` | Interface for container registry storage. Methods: `log`, `markStopped`, `clearStopped`, `getRecent`, `find`, `findAlive`. |
64
61
  | `FileContainerRegistry` | Built-in file-backed implementation of `ContainerRegistry`, backed by a `.jsonl` file. |
@@ -144,9 +141,10 @@ Each container runs an HTTP server that accepts the following requests:
144
141
  A container stays running and accepts messages until it receives a **detach** or **stop** signal:
145
142
 
146
143
  - **Detached at startup** (`config.detached = true`): Set `detached` on `ContainerConfig` to start
147
- the container in detached mode. The container processes its initial message and any queued tasks,
148
- then exits cleanly. This is the preferred way to run fire-and-forget jobs — no race between
149
- container startup and a subsequent `POST /detach`.
144
+ the container in detached mode. Use `config.initialPrompt` to provide a prompt that is queued
145
+ before the HTTP server starts accepting requests. The container processes the initial prompt
146
+ and any queued tasks, then exits cleanly. This is the preferred way to run fire-and-forget
147
+ jobs — no race between container startup and a subsequent `POST /message` or `POST /detach`.
150
148
  - **Detach** (`POST /detach`): Signal a running container to exit once all in-flight and queued
151
149
  work is done. In the CLI, interactive mode (`npm run agent -- -i`) sends `/detach` automatically
152
150
  when the user disconnects (Ctrl+C/D).
@@ -17,6 +17,8 @@ export interface ContainerConfig {
17
17
  webhookUrl?: string;
18
18
  /** Start the container in detached mode. It will exit after processing all messages and tasks. */
19
19
  detached?: boolean;
20
+ /** Initial prompt to queue at container startup (before the HTTP server accepts external requests). */
21
+ initialPrompt?: string;
20
22
  }
21
23
  export interface RepoOptions {
22
24
  repoUrl: string;
package/dist/container.js CHANGED
@@ -102,6 +102,8 @@ export async function startContainer(config, repo) {
102
102
  extra.WEBHOOK_URL = config.webhookUrl;
103
103
  if (config.detached)
104
104
  extra.DETACHED = "1";
105
+ if (config.initialPrompt)
106
+ extra.INITIAL_PROMPT = config.initialPrompt;
105
107
  const containerEnv = buildContainerEnv(repo, config.envVars, extra);
106
108
  // Build docker run args
107
109
  const args = ["run", "-d", "--rm", "--name", containerName];
@@ -178,6 +180,8 @@ export async function startRemoteContainer(config, repo) {
178
180
  remoteExtra.WEBHOOK_URL = config.webhookUrl;
179
181
  if (config.detached)
180
182
  remoteExtra.DETACHED = "1";
183
+ if (config.initialPrompt)
184
+ remoteExtra.INITIAL_PROMPT = config.initialPrompt;
181
185
  const containerEnv = buildContainerEnv(repo, config.envVars, remoteExtra);
182
186
  // Log existing machines (but don't destroy — multiple containers may run concurrently)
183
187
  const existing = await listMachines(config.flyApp, config.flyToken);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replayio/app-building",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Library for managing agentic app-building containers",
5
5
  "type": "module",
6
6
  "exports": {