thepopebot 1.2.76-beta.34 → 1.2.76-beta.35

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.35",
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": {
@@ -30,6 +30,7 @@ Optional fields:
30
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
31
  - `"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
32
  - `"llm_model"` — override the model used within the selected coding agent (provider is implicit in the agent).
33
+ - `"user_id"` — attribute the job to a specific user. The completion DM (after PR merge) routes to that user's inbox. If omitted, the completion broadcasts to every admin subscribed to system messages.
33
34
 
34
35
  **`command`** — Runs a shell command on the event handler (working directory: project root).
35
36
 
@@ -38,16 +38,18 @@ 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`. `agent` accepts optional `scope`, `agent_backend`, `llm_model`, `user_id` overrides:
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", "job": "Process: {{body}}", "scope": "agents/triage", "agent_backend": "claude-code", "llm_model": "claude-sonnet-4-5-20250929", "user_id": "<uuid>" }
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
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/`.
50
50
 
51
+ `user_id` attributes the spawned job to a specific user — its completion DM routes to that user's inbox. Omit to broadcast the completion to subscribed admins.
52
+
51
53
  ### Template tokens (in `job` and `command` strings)
52
54
 
53
55
  `{{body}}`, `{{body.field}}`, `{{query}}`, `{{query.field}}`, `{{headers}}`, `{{headers.field}}`. Tokens are expanded when the trigger fires.
@@ -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));