thepopebot 1.2.76-beta.25 → 1.2.76-beta.26
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/bin/docker-build.js +80 -53
- package/bin/sync.js +18 -1
- package/package.json +1 -1
- package/templates/skills/agent-job-tools/SKILL.md +1 -1
package/bin/docker-build.js
CHANGED
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Build all Docker images locally
|
|
4
|
+
* Build all Docker images locally.
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
|
-
* npm run docker:build # build
|
|
8
|
-
* npm run docker:build -- --image event-handler # build one
|
|
7
|
+
* npm run docker:build # build everything
|
|
8
|
+
* npm run docker:build -- --image event-handler # build one (deps built first)
|
|
9
9
|
*
|
|
10
10
|
* Reads the version from package.json and tags each image as:
|
|
11
11
|
* stephengpope/thepopebot:{image}-{version}
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Image hierarchy:
|
|
14
|
+
*
|
|
15
|
+
* thepopebot-base ← Ubuntu + Node + locale + Chromium + playwright + user
|
|
16
|
+
* ├── coding-agent-base ← + tmux, ttyd, scripts, entrypoint
|
|
17
|
+
* │ ├── coding-agent-claude-code ← + per-agent CLI
|
|
18
|
+
* │ ├── coding-agent-pi-coding-agent
|
|
19
|
+
* │ └── ... (one per agent)
|
|
20
|
+
* └── event-handler ← + pm2, gosu, Next.js, server.js
|
|
21
|
+
*
|
|
22
|
+
* Build order:
|
|
23
|
+
* 1. thepopebot-base
|
|
24
|
+
* 2. coding-agent-base + event-handler in parallel
|
|
25
|
+
* 3. all coding-agent variants in parallel
|
|
26
|
+
*
|
|
27
|
+
* Base images are tagged both versioned and unversioned (no version) so child
|
|
28
|
+
* Dockerfiles can `FROM thepopebot-base` / `FROM coding-agent-base` without a
|
|
29
|
+
* build-arg for local development.
|
|
17
30
|
*/
|
|
18
31
|
|
|
19
32
|
import { spawn } from 'child_process';
|
|
@@ -28,14 +41,21 @@ const pkg = JSON.parse(readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
|
28
41
|
const VERSION = pkg.version;
|
|
29
42
|
const REPO = 'stephengpope/thepopebot';
|
|
30
43
|
|
|
31
|
-
//
|
|
32
|
-
const
|
|
44
|
+
// Built first — everything depends on this.
|
|
45
|
+
const THEPOPEBOT_BASE = {
|
|
46
|
+
name: 'thepopebot-base',
|
|
47
|
+
context: 'docker/base',
|
|
48
|
+
dockerfile: 'docker/base/Dockerfile',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Built second — depends on thepopebot-base.
|
|
52
|
+
const CODING_AGENT_BASE = {
|
|
33
53
|
name: 'coding-agent-base',
|
|
34
54
|
context: 'docker/coding-agent',
|
|
35
55
|
dockerfile: 'docker/coding-agent/Dockerfile',
|
|
36
56
|
};
|
|
37
57
|
|
|
38
|
-
//
|
|
58
|
+
// Built third — depend on coding-agent-base.
|
|
39
59
|
const CODING_AGENTS = [
|
|
40
60
|
{
|
|
41
61
|
name: 'coding-agent-claude-code',
|
|
@@ -69,16 +89,14 @@ const CODING_AGENTS = [
|
|
|
69
89
|
},
|
|
70
90
|
];
|
|
71
91
|
|
|
72
|
-
//
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
];
|
|
92
|
+
// Built second — depends on thepopebot-base. Built in parallel with coding-agent-base.
|
|
93
|
+
const EVENT_HANDLER = {
|
|
94
|
+
name: 'event-handler',
|
|
95
|
+
context: '.',
|
|
96
|
+
dockerfile: 'docker/event-handler/Dockerfile',
|
|
97
|
+
};
|
|
80
98
|
|
|
81
|
-
const ALL_IMAGES = [
|
|
99
|
+
const ALL_IMAGES = [THEPOPEBOT_BASE, CODING_AGENT_BASE, ...CODING_AGENTS, EVENT_HANDLER];
|
|
82
100
|
|
|
83
101
|
// Parse --image flag
|
|
84
102
|
const filterArg = process.argv.find((_, i, a) => a[i - 1] === '--image');
|
|
@@ -101,11 +119,14 @@ function buildImage(img) {
|
|
|
101
119
|
console.log(` ${label} building — ${tag}`);
|
|
102
120
|
|
|
103
121
|
return new Promise((resolve, reject) => {
|
|
104
|
-
// Tag base image as both versioned and unversioned (agent Dockerfiles use FROM coding-agent-base)
|
|
105
122
|
const args = ['build', '-t', tag, '-f', dockerfile];
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
|
|
124
|
+
// Base images get an unversioned tag too so child Dockerfiles can
|
|
125
|
+
// `FROM thepopebot-base` / `FROM coding-agent-base` without a build-arg.
|
|
126
|
+
if (img.name === 'thepopebot-base' || img.name === 'coding-agent-base') {
|
|
127
|
+
args.push('-t', img.name);
|
|
108
128
|
}
|
|
129
|
+
|
|
109
130
|
args.push(context);
|
|
110
131
|
|
|
111
132
|
const proc = spawn(
|
|
@@ -172,50 +193,56 @@ function buildImage(img) {
|
|
|
172
193
|
});
|
|
173
194
|
}
|
|
174
195
|
|
|
175
|
-
// Build logic: base first, then agents + others in parallel
|
|
176
196
|
async function run() {
|
|
177
197
|
if (filterArg) {
|
|
178
|
-
// Single image build
|
|
179
|
-
if (filterArg ===
|
|
198
|
+
// Single image build — build dependency chain too.
|
|
199
|
+
if (filterArg === THEPOPEBOT_BASE.name) {
|
|
180
200
|
console.log(`Building 1 image — version ${VERSION}\n`);
|
|
181
|
-
await buildImage(
|
|
182
|
-
} else {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
201
|
+
await buildImage(THEPOPEBOT_BASE);
|
|
202
|
+
} else if (filterArg === CODING_AGENT_BASE.name) {
|
|
203
|
+
console.log(`Building 2 images — version ${VERSION}\n`);
|
|
204
|
+
await buildImage(THEPOPEBOT_BASE);
|
|
205
|
+
await buildImage(CODING_AGENT_BASE);
|
|
206
|
+
} else if (filterArg === EVENT_HANDLER.name) {
|
|
207
|
+
console.log(`Building 2 images — version ${VERSION}\n`);
|
|
208
|
+
await buildImage(THEPOPEBOT_BASE);
|
|
209
|
+
await buildImage(EVENT_HANDLER);
|
|
210
|
+
} else if (CODING_AGENTS.some(img => img.name === filterArg)) {
|
|
211
|
+
console.log(`Building 3 images — version ${VERSION}\n`);
|
|
212
|
+
await buildImage(THEPOPEBOT_BASE);
|
|
213
|
+
await buildImage(CODING_AGENT_BASE);
|
|
214
|
+
const agent = CODING_AGENTS.find(img => img.name === filterArg);
|
|
215
|
+
await buildImage(agent);
|
|
195
216
|
}
|
|
196
|
-
console.log('\
|
|
217
|
+
console.log('\ndone.');
|
|
197
218
|
return;
|
|
198
219
|
}
|
|
199
220
|
|
|
200
|
-
// Full build: base
|
|
221
|
+
// Full build: thepopebot-base → (coding-agent-base + event-handler in parallel) → variants
|
|
201
222
|
const totalCount = ALL_IMAGES.length;
|
|
202
|
-
console.log(`Building ${totalCount} images
|
|
223
|
+
console.log(`Building ${totalCount} images — version ${VERSION}\n`);
|
|
203
224
|
|
|
204
|
-
// Step 1:
|
|
205
|
-
await buildImage(
|
|
225
|
+
// Step 1: thepopebot-base
|
|
226
|
+
await buildImage(THEPOPEBOT_BASE);
|
|
206
227
|
|
|
207
|
-
// Step 2:
|
|
208
|
-
const
|
|
209
|
-
const
|
|
228
|
+
// Step 2: coding-agent-base and event-handler in parallel (both extend thepopebot-base)
|
|
229
|
+
const tier2 = await Promise.allSettled([CODING_AGENT_BASE, EVENT_HANDLER].map(buildImage));
|
|
230
|
+
const tier2Failed = tier2.filter(r => r.status === 'rejected');
|
|
231
|
+
if (tier2Failed.length > 0) {
|
|
232
|
+
console.error(`Tier 2 failed: ${tier2Failed.map(r => r.reason.message).join(', ')}`);
|
|
233
|
+
process.exit(1);
|
|
234
|
+
}
|
|
210
235
|
|
|
211
|
-
|
|
212
|
-
const
|
|
236
|
+
// Step 3: all coding-agent variants in parallel
|
|
237
|
+
const tier3 = await Promise.allSettled(CODING_AGENTS.map(buildImage));
|
|
238
|
+
const tier3Failed = tier3.filter(r => r.status === 'rejected');
|
|
239
|
+
const tier3Succeeded = tier3.filter(r => r.status === 'fulfilled');
|
|
213
240
|
|
|
214
|
-
|
|
215
|
-
console.log(`\n${
|
|
241
|
+
const succeededCount = 1 + 2 + tier3Succeeded.length;
|
|
242
|
+
console.log(`\n${succeededCount}/${totalCount} images built successfully.`);
|
|
216
243
|
|
|
217
|
-
if (
|
|
218
|
-
console.error(`${
|
|
244
|
+
if (tier3Failed.length > 0) {
|
|
245
|
+
console.error(`${tier3Failed.length} failed: ${tier3Failed.map(r => r.reason.message).join(', ')}`);
|
|
219
246
|
process.exit(1);
|
|
220
247
|
}
|
|
221
248
|
}
|
package/bin/sync.js
CHANGED
|
@@ -248,6 +248,19 @@ function mirrorTemplates(projectPath) {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Build thepopebot-base locally so the event-handler Dockerfile's
|
|
253
|
+
* `FROM ${BASE_IMAGE}` (default: thepopebot-base) resolves. Cached layers
|
|
254
|
+
* make this near-instant when nothing in docker/base changed.
|
|
255
|
+
*/
|
|
256
|
+
function buildBaseImage() {
|
|
257
|
+
console.log('\n Building thepopebot-base image...');
|
|
258
|
+
const baseContext = path.join(PACKAGE_DIR, 'docker', 'base');
|
|
259
|
+
execSync(`docker build -t thepopebot-base -f ${path.join(baseContext, 'Dockerfile')} ${baseContext}`, {
|
|
260
|
+
stdio: 'inherit',
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
251
264
|
function buildDockerImage(projectPath) {
|
|
252
265
|
console.log('\n Building Docker event handler image...');
|
|
253
266
|
|
|
@@ -431,7 +444,11 @@ export async function sync(projectPath) {
|
|
|
431
444
|
console.log('\n Installing package on host...');
|
|
432
445
|
execSync(`npm install --no-save ${tarballDest}`, { stdio: 'inherit', cwd: projectPath });
|
|
433
446
|
|
|
434
|
-
// 5. Build
|
|
447
|
+
// 5. Build thepopebot-base (event-handler Dockerfile FROMs it).
|
|
448
|
+
// Cached layers — fast unless docker/base/Dockerfile changed.
|
|
449
|
+
buildBaseImage();
|
|
450
|
+
|
|
451
|
+
// 6. Build event-handler image with patched Dockerfile (includes Next.js build)
|
|
435
452
|
buildDockerImage(projectPath);
|
|
436
453
|
|
|
437
454
|
// 6. Restart container with new image
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-job-tools
|
|
3
|
-
description: Use when you need to access agent secrets, API keys, or create and manage background jobs. Supports listing keys
|
|
3
|
+
description: Use when you need to access agent secrets, API keys, or create and manage background jobs. Supports listing api keys, OAuth credentials (auto-refreshed). Also handles requests to "create a background job," "spawn a job," or "kick off an agent job."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## Usage
|