@replayio/app-building 1.4.0 → 1.6.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 +6 -6
- package/dist/container.js +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -183,15 +183,15 @@ Every POST body has this shape:
|
|
|
183
183
|
| Type | When | `data` fields |
|
|
184
184
|
|---|---|---|
|
|
185
185
|
| `container.started` | HTTP server is listening | `pushBranch`, `revision` |
|
|
186
|
-
| `container.idle` |
|
|
187
|
-
| `container.
|
|
188
|
-
| `container.
|
|
189
|
-
| `container.stopped` | State transitions to stopped | _(empty)_ |
|
|
186
|
+
| `container.idle` | Container is waiting for work | `pendingTasks`, `queueLength` |
|
|
187
|
+
| `container.stopping` | Container is shutting down | _(empty)_ |
|
|
188
|
+
| `container.stopped` | Container has stopped | _(empty)_ |
|
|
190
189
|
| `message.queued` | `POST /message` received | `messageId`, `prompt` |
|
|
190
|
+
| `message.started` | Message processing begins | `iteration`, `prompt` |
|
|
191
191
|
| `message.done` | Message processing complete | `messageId`, `cost_usd`, `duration_ms`, `num_turns` |
|
|
192
192
|
| `message.error` | Message processing failed | `messageId`, `error` |
|
|
193
|
-
| `task.started` | Task processing begins | `
|
|
194
|
-
| `task.done` | Task processing complete | `
|
|
193
|
+
| `task.started` | Task processing begins | `iteration`, `skill`, `subtasks` |
|
|
194
|
+
| `task.done` | Task processing complete | `skill`, `cost`, `totalCost`, `failed` |
|
|
195
195
|
| `log` | Each log line | `line` |
|
|
196
196
|
|
|
197
197
|
### Example
|
package/dist/container.js
CHANGED
|
@@ -4,6 +4,10 @@ import { resolve } from "path";
|
|
|
4
4
|
import { createMachine, waitForMachine, destroyMachine, listMachines } from "./fly";
|
|
5
5
|
import { getImageRef } from "./image-ref";
|
|
6
6
|
const IMAGE_NAME = "app-building";
|
|
7
|
+
function debugLog(...args) {
|
|
8
|
+
if (process.env.DEBUG)
|
|
9
|
+
console.log("[container]", ...args);
|
|
10
|
+
}
|
|
7
11
|
export function loadDotEnv(projectRoot) {
|
|
8
12
|
const envPath = resolve(projectRoot, ".env");
|
|
9
13
|
if (!existsSync(envPath)) {
|
|
@@ -90,6 +94,16 @@ function buildContainerEnv(repo, envVars, extra = {}) {
|
|
|
90
94
|
return env;
|
|
91
95
|
}
|
|
92
96
|
export async function startContainer(config, repo) {
|
|
97
|
+
debugLog("startContainer config:", {
|
|
98
|
+
projectRoot: config.projectRoot,
|
|
99
|
+
flyApp: config.flyApp,
|
|
100
|
+
imageRef: config.imageRef,
|
|
101
|
+
webhookUrl: config.webhookUrl,
|
|
102
|
+
detached: config.detached,
|
|
103
|
+
initialPrompt: config.initialPrompt ? `${config.initialPrompt.slice(0, 100)}...` : undefined,
|
|
104
|
+
envVarKeys: Object.keys(config.envVars),
|
|
105
|
+
});
|
|
106
|
+
debugLog("startContainer repo:", repo);
|
|
93
107
|
buildImage(config);
|
|
94
108
|
const uniqueId = Math.random().toString(36).slice(2, 8);
|
|
95
109
|
const containerName = `app-building-${uniqueId}`;
|
|
@@ -164,6 +178,16 @@ export async function startContainer(config, repo) {
|
|
|
164
178
|
return agentState;
|
|
165
179
|
}
|
|
166
180
|
export async function startRemoteContainer(config, repo) {
|
|
181
|
+
debugLog("startRemoteContainer config:", {
|
|
182
|
+
projectRoot: config.projectRoot,
|
|
183
|
+
flyApp: config.flyApp,
|
|
184
|
+
imageRef: config.imageRef,
|
|
185
|
+
webhookUrl: config.webhookUrl,
|
|
186
|
+
detached: config.detached,
|
|
187
|
+
initialPrompt: config.initialPrompt ? `${config.initialPrompt.slice(0, 100)}...` : undefined,
|
|
188
|
+
envVarKeys: Object.keys(config.envVars),
|
|
189
|
+
});
|
|
190
|
+
debugLog("startRemoteContainer repo:", repo);
|
|
167
191
|
if (!config.flyToken)
|
|
168
192
|
throw new Error("flyToken is required for remote containers");
|
|
169
193
|
if (!config.flyApp)
|