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 CHANGED
@@ -651,6 +651,7 @@ const PROTECTED_PATHS = [
651
651
  '.kimi/',
652
652
  '.pi/',
653
653
  'skills/',
654
+ 'agents/',
654
655
  'node_modules/',
655
656
  ];
656
657
 
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: options.scope || null,
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 = options.scope || null;
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: options.scope || null, streamCallback }, streamMode: 'messages' }
347
+ { configurable: { thread_id: threadId, workspaceId, repo, branch, codeModeType, scope: resolvedScope, streamCallback }, streamMode: 'messages' }
339
348
  );
340
349
 
341
350
  const toolCallNames = {};
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thepopebot",
3
- "version": "1.2.76-beta.13",
3
+ "version": "1.2.76-beta.15",
4
4
  "type": "module",
5
5
  "description": "Create autonomous AI agents with a two-layer architecture: Next.js Event Handler + Docker Agent.",
6
6
  "bin": {
@@ -14,7 +14,8 @@ export const PROVIDERS = {
14
14
  builtin: true,
15
15
  oauthSupported: true,
16
16
  models: [
17
- { id: 'claude-opus-4-6', name: 'Claude Opus 4.6', default: true },
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: add `"llm_provider"` and `"llm_model"` to override the default LLM for that job.
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 `/home/coding-agent/workspace/.tmp/` for working files — downloads, screenshots, intermediate data, scripts, generated files. `/home/coding-agent/workspace/.tmp/` is gitignored and nothing there gets committed. If a tool downloads a file, save it to `/home/coding-agent/workspace/.tmp/` and reference it directly.
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
- **DO NOT USE** `/tmp` because that will leak and waste disk space from writing extra layers to the container.
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-daily",
33
- "schedule": "0 9 * * *",
34
+ "name": "my-agent-weekly-report",
35
+ "schedule": "0 9 * * 1",
34
36
  "type": "agent",
35
- "job": "Read agents/my-agent/SYSTEM.md and follow the instructions there.",
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
- For job-specific prompts, chain the reads:
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
- ```json
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
 
@@ -46,6 +46,7 @@ services:
46
46
  volumes:
47
47
  - .:/project
48
48
  - ./agent-job:/app/agent-job
49
+ - ./agents:/app/agents
49
50
  - ./event-handler:/app/event-handler
50
51
  - ./skills:/app/skills
51
52
  - ./.env:/app/.env