thepopebot 1.2.76-beta.13 → 1.2.76-beta.15
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/cli.js +1 -0
- package/lib/ai/index.js +12 -3
- package/lib/llm-providers.js +1 -0
- package/package.json +1 -1
- package/setup/lib/providers.mjs +2 -1
- package/templates/agent-job/CLAUDE.md.template +3 -1
- package/templates/agent-job/SYSTEM.md +2 -4
- package/templates/agents/CLAUDE.md.template +9 -14
- package/templates/docker-compose.custom.yml +1 -0
package/bin/cli.js
CHANGED
package/lib/ai/index.js
CHANGED
|
@@ -136,6 +136,9 @@ async function* chatStream(threadId, message, attachments = [], options = {}) {
|
|
|
136
136
|
const branch = options.branch;
|
|
137
137
|
const codeModeType = options.codeModeType || 'plan';
|
|
138
138
|
|
|
139
|
+
// Resolve workspace — for existing chats, read scope from DB (client may not resend it after refresh)
|
|
140
|
+
let resolvedScope = options.scope || null;
|
|
141
|
+
|
|
139
142
|
if (!existingChat) {
|
|
140
143
|
// Create workspace if not already provided
|
|
141
144
|
if (!workspaceId) {
|
|
@@ -143,7 +146,7 @@ async function* chatStream(threadId, message, attachments = [], options = {}) {
|
|
|
143
146
|
const workspace = createCodeWorkspace(options.userId || 'unknown', {
|
|
144
147
|
repo: repo,
|
|
145
148
|
branch: branch,
|
|
146
|
-
scope:
|
|
149
|
+
scope: resolvedScope,
|
|
147
150
|
});
|
|
148
151
|
workspaceId = workspace.id;
|
|
149
152
|
const { generateRandomName } = await import('../utils/random-name.js');
|
|
@@ -155,6 +158,12 @@ async function* chatStream(threadId, message, attachments = [], options = {}) {
|
|
|
155
158
|
linkChatToWorkspace(threadId, workspaceId);
|
|
156
159
|
} else {
|
|
157
160
|
workspaceId = workspaceId || existingChat.codeWorkspaceId;
|
|
161
|
+
// Read scope from workspace record — client may not resend after page refresh
|
|
162
|
+
if (!resolvedScope && workspaceId) {
|
|
163
|
+
const { getCodeWorkspaceById } = await import('../db/code-workspaces.js');
|
|
164
|
+
const ws = getCodeWorkspaceById(workspaceId);
|
|
165
|
+
if (ws?.scope) resolvedScope = ws.scope;
|
|
166
|
+
}
|
|
158
167
|
}
|
|
159
168
|
|
|
160
169
|
// ── SDK path: direct in-process SDK call (no LangGraph, no Docker) ──
|
|
@@ -205,7 +214,7 @@ async function* chatStream(threadId, message, attachments = [], options = {}) {
|
|
|
205
214
|
}
|
|
206
215
|
|
|
207
216
|
// 2. Resolve scope (working directory + skills)
|
|
208
|
-
const scope =
|
|
217
|
+
const scope = resolvedScope;
|
|
209
218
|
const chatMode = isCodeMode ? 'code' : 'agent';
|
|
210
219
|
const { workingDir, skillsDir } = resolveAgentScope(repoDir, scope);
|
|
211
220
|
|
|
@@ -335,7 +344,7 @@ async function* chatStream(threadId, message, attachments = [], options = {}) {
|
|
|
335
344
|
try {
|
|
336
345
|
const stream = await agent.stream(
|
|
337
346
|
{ messages: [new HumanMessage({ content: messageContent })] },
|
|
338
|
-
{ configurable: { thread_id: threadId, workspaceId, repo, branch, codeModeType, scope:
|
|
347
|
+
{ configurable: { thread_id: threadId, workspaceId, repo, branch, codeModeType, scope: resolvedScope, streamCallback }, streamMode: 'messages' }
|
|
339
348
|
);
|
|
340
349
|
|
|
341
350
|
const toolCallNames = {};
|
package/lib/llm-providers.js
CHANGED
|
@@ -17,6 +17,7 @@ export const BUILTIN_PROVIDERS = {
|
|
|
17
17
|
],
|
|
18
18
|
models: [
|
|
19
19
|
{ id: 'claude-sonnet-4-6', name: 'Claude Sonnet 4.6', default: true },
|
|
20
|
+
{ id: 'claude-opus-4-7', name: 'Claude Opus 4.7' },
|
|
20
21
|
{ id: 'claude-opus-4-6', name: 'Claude Opus 4.6' },
|
|
21
22
|
{ id: 'claude-haiku-4-5-20251001', name: 'Claude Haiku 4.5' },
|
|
22
23
|
{ id: 'claude-sonnet-4-20250514', name: 'Claude Sonnet 4' },
|
package/package.json
CHANGED
package/setup/lib/providers.mjs
CHANGED
|
@@ -14,7 +14,8 @@ export const PROVIDERS = {
|
|
|
14
14
|
builtin: true,
|
|
15
15
|
oauthSupported: true,
|
|
16
16
|
models: [
|
|
17
|
-
{ id: 'claude-opus-4-
|
|
17
|
+
{ id: 'claude-opus-4-7', name: 'Claude Opus 4.7', default: true },
|
|
18
|
+
{ id: 'claude-opus-4-6', name: 'Claude Opus 4.6' },
|
|
18
19
|
{ id: 'claude-sonnet-4-6', name: 'Claude Sonnet 4.6' },
|
|
19
20
|
{ id: 'claude-haiku-4-5-20251001', name: 'Claude Haiku 4.5' },
|
|
20
21
|
],
|
|
@@ -26,7 +26,9 @@ There are three action types:
|
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Optional:
|
|
29
|
+
Optional fields:
|
|
30
|
+
- `"scope"` (e.g. `"agents/my-agent"`) — routes the cron to a scoped agent. Its `SYSTEM.md`, skills directory, and working directory all switch to that subdirectory. See `agents/CLAUDE.md` for the full pattern.
|
|
31
|
+
- `"llm_provider"` and `"llm_model"` — override the default LLM for that job.
|
|
30
32
|
|
|
31
33
|
**`command`** — Runs a shell command on the event handler (working directory: project root).
|
|
32
34
|
|
|
@@ -7,11 +7,9 @@ You are an autonomous AI agent running inside a Docker container on thepopebot.
|
|
|
7
7
|
Your workspace is `/home/coding-agent/workspace` — a live git repository.
|
|
8
8
|
|
|
9
9
|
## Temporary Files
|
|
10
|
-
Use `/
|
|
10
|
+
Use `/tmp` for working files — downloads, screenshots, intermediate data, scripts, generated files. If a tool downloads a file, save it to `/tmp` and reference it directly.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Everything in the workspace is automatically committed and pushed when your job finishes. You do not control this. Be intentional about what you put here — **any file you create, move, or download into the workspace WILL be committed.**
|
|
12
|
+
Everything in the workspace `/home/coding-agent/workspace` is automatically committed and pushed when your job finishes. You do not control this. Be intentional about what you put here — **any file you create, move, or download into the workspace WILL be committed.**
|
|
15
13
|
|
|
16
14
|
## Directory Layout
|
|
17
15
|
|
|
@@ -12,6 +12,8 @@ agents/
|
|
|
12
12
|
|
|
13
13
|
`SYSTEM.md` is the agent's system prompt. Write it in markdown addressed to the agent (e.g. "You are a code reviewer...").
|
|
14
14
|
|
|
15
|
+
> **Important:** `agents/<name>/SYSTEM.md` **replaces** `agent-job/SYSTEM.md` when the agent is scoped — it doesn't extend it. Use `agent-job/SYSTEM.md` as a starting template and adapt it: keep the runtime environment notes, the `/tmp` scratch directive, and add the `{{skills}}` token if you want skill descriptions injected. Then add the agent's identity-specific instructions on top.
|
|
16
|
+
|
|
15
17
|
For agents with multiple complex tasks, add a `jobs/` subfolder:
|
|
16
18
|
|
|
17
19
|
```
|
|
@@ -25,29 +27,22 @@ agents/
|
|
|
25
27
|
|
|
26
28
|
## Scheduling
|
|
27
29
|
|
|
28
|
-
Add a cron entry in `agent-job/CRONS.json
|
|
30
|
+
Add a cron entry in `agent-job/CRONS.json` with a `scope` field pointing at the agent:
|
|
29
31
|
|
|
30
32
|
```json
|
|
31
33
|
{
|
|
32
|
-
"name": "my-agent-
|
|
33
|
-
"schedule": "0 9 * *
|
|
34
|
+
"name": "my-agent-weekly-report",
|
|
35
|
+
"schedule": "0 9 * * 1",
|
|
34
36
|
"type": "agent",
|
|
35
|
-
"
|
|
37
|
+
"scope": "agents/my-agent",
|
|
38
|
+
"job": "Follow the instructions in jobs/weekly-report.md",
|
|
36
39
|
"enabled": true
|
|
37
40
|
}
|
|
38
41
|
```
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
`scope` activates the agent's identity (`SYSTEM.md`), skills, and working directory — the cron runs as the scoped agent, not from the repo root. `job` is the task prompt the agent receives.
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
"name": "my-agent-report",
|
|
45
|
-
"schedule": "0 9 * * 1",
|
|
46
|
-
"type": "agent",
|
|
47
|
-
"job": "Read agents/my-agent/SYSTEM.md for context, then read agents/my-agent/prompts/weekly-report.md and complete that task.",
|
|
48
|
-
"enabled": true
|
|
49
|
-
}
|
|
50
|
-
```
|
|
45
|
+
For reusable tasks, write the prompt as markdown in `agents/<name>/jobs/<task>.md` and reference it from `job` — the agent's working directory is the scoped folder, so the relative path resolves. For one-off tasks, write the prompt inline.
|
|
51
46
|
|
|
52
47
|
## Removing an Agent
|
|
53
48
|
|