thepopebot 1.2.76-beta.34 → 1.2.76-beta.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thepopebot",
3
- "version": "1.2.76-beta.34",
3
+ "version": "1.2.76-beta.36",
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": {
@@ -18,16 +18,20 @@ There are three action types:
18
18
 
19
19
  ```json
20
20
  {
21
- "name": "heartbeat",
22
- "schedule": "*/30 * * * *",
21
+ "name": "weekly-report",
22
+ "schedule": "0 9 * * 1",
23
23
  "type": "agent",
24
- "job": "Read agent-job/HEARTBEAT.md and complete the tasks described there.",
24
+ "scope": "agents/reporter",
25
+ "job": "Generate the weekly report and open a PR.",
26
+ "user_id": "57e959ab-d288-4623-8cda-829c995b7251",
25
27
  "enabled": false
26
28
  }
27
29
  ```
28
30
 
29
31
  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.
32
+
33
+ - **`"scope"`** *(recommended)* — e.g. `"agents/my-agent"`. Routes the cron to a **scoped agent** under `agents/<name>/`. Its `SYSTEM.md`, skills directory, and working directory all switch to that subdirectory. Scoping is technically optional (a cron without `scope` runs from the repo root using the default `agent-job/SYSTEM.md`), but in practice you almost always want a scoped agent so the job has a clearly-defined identity, prompt, and skill set. See `agents/CLAUDE.md` for the full pattern.
34
+ - **`"user_id"`** *(optional)* — sets the owner of the agent-job. Used by internal systems like `send-dm` to route the completion message; with no owner, the message goes to all admins. Set for personal crons; leave out for shared/system crons. Find user ids in Admin > Users.
31
35
  - `"agent_backend"` (e.g. `"claude-code"`, `"codex-cli"`, `"gemini-cli"`, `"pi"`, `"opencode"`, `"kimi-cli"`) — pick which coding agent runs the job, overriding the default set in Admin > Event Handler > Coding Agents.
32
36
  - `"llm_model"` — override the model used within the selected coding agent (provider is implicit in the agent).
33
37
 
@@ -38,15 +38,20 @@ JSON array of webhook trigger definitions. Loaded at server boot by `lib/trigger
38
38
 
39
39
  ### Action types
40
40
 
41
- Three types — `agent`, `command`, `webhook`. `agent` accepts optional `scope`, `agent_backend`, `llm_model` overrides:
41
+ Three types — `agent`, `command`, `webhook`:
42
42
 
43
43
  ```json
44
- { "type": "agent", "job": "Process: {{body}}", "scope": "agents/triage", "agent_backend": "claude-code", "llm_model": "claude-sonnet-4-5-20250929" }
44
+ { "type": "agent", "scope": "agents/triage", "job": "Process: {{body}}" }
45
45
  { "type": "command", "command": "echo 'webhook received: {{body}}' >> logs/webhook.log" }
46
46
  { "type": "webhook", "url": "https://example.com/hook", "method": "POST", "headers": {}, "vars": { "source": "github" } }
47
47
  ```
48
48
 
49
- `scope` resolves to a directory under `agents/` (see `agents/CLAUDE.md`). The agent runs with that directory as its working dir, picks up its `SYSTEM.md`, and uses the skills under `agents/<scope>/skills/` falling back to root `skills/`.
49
+ #### Optional fields on `agent` actions
50
+
51
+ - **`"scope"`** *(recommended)* — e.g. `"agents/triage"`. Routes the action to a **scoped agent** under `agents/<name>/`. Its `SYSTEM.md`, skills directory, and working directory all switch to that subdirectory. Scoping is technically optional (an action without `scope` runs from the repo root using the default `agent-job/SYSTEM.md`), but in practice you almost always want a scoped agent so each trigger has a clearly-defined identity, prompt, and skill set. See `agents/CLAUDE.md` for the full pattern.
52
+ - **`"user_id"`** *(optional)* — sets the owner of the agent-job. Used by internal systems like `send-dm` to route the completion message; with no owner, the message goes to all admins. Set for per-user integrations; leave out for shared/system triggers. Find user ids in Admin > Users.
53
+ - `"agent_backend"` (e.g. `"claude-code"`, `"codex-cli"`, `"gemini-cli"`, `"pi"`, `"opencode"`, `"kimi-cli"`) — pick which coding agent runs the action, overriding the default set in Admin > Event Handler > Coding Agents.
54
+ - `"llm_model"` — override the model used within the selected coding agent (provider is implicit in the agent).
50
55
 
51
56
  ### Template tokens (in `job` and `command` strings)
52
57
 
@@ -30,4 +30,5 @@ If the calling agent is running with a `SCOPE` env var set, `create` defaults th
30
30
 
31
31
  ## Notes
32
32
 
33
- - `AGENT_JOB_TOKEN` and `APP_URL` are injected automatically — no setup required.
33
+ - `AGENT_JOB_TOKEN`, `APP_URL`, and `USER_ID` are injected automatically — no setup required.
34
+ - The spawned job inherits `USER_ID` from the env if set, so it's attributed to the same originator as this chat/job.
@@ -59,6 +59,7 @@ if (subcommand === 'create') {
59
59
  if (opts.llm_model) body.llm_model = opts.llm_model;
60
60
  if (opts.agent_backend) body.agent_backend = opts.agent_backend;
61
61
  if (opts.scope) body.scope = opts.scope;
62
+ if (process.env.USER_ID) body.user_id = process.env.USER_ID;
62
63
 
63
64
  const json = await httpJson('POST', '/api/create-agent-job', body);
64
65
  console.log(JSON.stringify(json, null, 2));