@edgehero/pi-dispatch-admin 0.3.0 → 0.4.0
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/README.md +23 -36
- package/dist/index.mjs +30187 -19889
- package/package.json +1 -1
- package/skills/operate-pi-dispatch/SKILL.md +13 -0
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/banner.png?v=0.5.0" alt="pi-dispatch
|
|
2
|
+
<img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/banner.png?v=0.5.0" alt="pi-dispatch: run the pi coding agent as a self-hosted service" width="880">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
# pi-dispatch
|
|
5
|
+
# pi-dispatch: run the pi coding agent as a self-hosted service
|
|
6
6
|
|
|
7
|
-
**[pi](https://github.com/earendil-works/pi) is a superb coding agent
|
|
7
|
+
**[pi](https://github.com/earendil-works/pi) is a superb coding agent, but it has no job queue, no spend limit, and, by its own README, no permission system.** pi-dispatch adds exactly those, so you can run pi unattended and safely: on a cron schedule, on your repo's issues and PRs, or straight from the CLI. Every job runs in an isolated container, with spend bounded before a single token is spent.
|
|
8
8
|
|
|
9
|
-
> This npm package
|
|
9
|
+
> This npm package, **`@edgehero/pi-dispatch-admin`**, is the **operator console** (a pi extension). The service itself is `@edgehero/pi-dispatch` (worker + CLI) and `@edgehero/pi-dispatch-receiver` (the webhook edge); the [main repo](https://github.com/edgehero/pi-dispatch) has the container image, docs, and SECURITY.md.
|
|
10
10
|
|
|
11
11
|
## How it works
|
|
12
12
|
|
|
13
|
-
Every trigger produces the same job, through the same path
|
|
13
|
+
Every trigger produces the same job, through the same path: one queue, one container, one budget.
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
CLI · cron · GitHub issue / PR
|
|
17
17
|
│ enqueue
|
|
18
18
|
▼
|
|
19
|
-
Valkey + BullMQ durable queue
|
|
19
|
+
Valkey + BullMQ durable queue: survives reboots, absorbs bursts
|
|
20
20
|
│
|
|
21
21
|
▼
|
|
22
|
-
under the daily cap +
|
|
22
|
+
under the daily cap + if not: refused here, before any spend
|
|
23
23
|
per-job turn budget?
|
|
24
24
|
│ yes
|
|
25
25
|
▼
|
|
@@ -30,53 +30,40 @@ Every trigger produces the same job, through the same path — one queue, one co
|
|
|
30
30
|
pi + your .pi/skills edits your code in place, opens a PR, comments back
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
- **Spend is bounded before tokens.** A per-job turn budget plus daily / weekly / monthly caps, checked *before* a container starts. A runaway or a junk trigger costs you a refusal, not a surprise bill.
|
|
35
|
-
- **Three triggers, one job.** A CLI command, a cron schedule, or a GitHub issue/PR — same queue, same box, same budget. Cron is the unattended one: recurring work on your own hardware, in an image you control — one per deployment, or one per trigger.
|
|
36
|
-
- **Your image, your tools.** Bake a project's toolchain into the Dockerfile; it ships **Playwright + Chromium**, so a flow can build a frontend, screenshot it, and iterate on the rendered result.
|
|
33
|
+
The container is the boundary (pi's missing permission system, enforced by Docker). Spend is checked before a container starts, so a runaway or a junk trigger costs a refusal, not a surprise bill. The job image is yours to shape, per deployment or per trigger, and it ships Playwright and Chromium so a flow can build a frontend, screenshot it, and iterate on the render.
|
|
37
34
|
|
|
38
|
-
## The console
|
|
35
|
+
## The console: `/dispatch`
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
One command puts a live TUI over the whole deployment:
|
|
41
38
|
|
|
42
39
|
<p align="center">
|
|
43
40
|
<img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/dispatch-dashboard.png?v=0.5.0" alt="The /dispatch panel: status, spend meters, triggers, runs, and settings" width="820">
|
|
44
41
|
</p>
|
|
45
42
|
|
|
46
|
-
- **Status
|
|
47
|
-
- **Costs, analyzed honestly.**
|
|
43
|
+
- **Status and spend.** Queue and worker state, day/week/month spend meters, a daily token counter, and a run-history table with per-job tokens and cost.
|
|
44
|
+
- **Costs, analyzed honestly.** The COSTS view (`c`) shows spend per flow, model and day, what each declared subscription actually saves against API rates, and a what-if that re-prices a flow under another model. Every dollar carries its class: a plan-covered run never renders as $0.00, and an estimate is always marked as one.
|
|
48
45
|
|
|
49
46
|
<p align="center">
|
|
50
|
-
<img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/costs-view.png?v=0.5.0" alt="The COSTS view: per-plan verdicts against API rates, a daily spend sparkline, per-flow spend with API
|
|
47
|
+
<img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/costs-view.png?v=0.5.0" alt="The COSTS view: per-plan verdicts against API rates, a daily spend sparkline, per-flow spend with API equivalents, and subscription amortization" width="820">
|
|
51
48
|
</p>
|
|
52
|
-
|
|
53
|
-
- **
|
|
54
|
-
- **
|
|
55
|
-
- **
|
|
56
|
-
- **AI-operable, with a human gate.** Model-callable tools let an agent change limits and manage triggers and pause windows — but **every write pops an operator confirmation the model can't answer**, and is refused when no operator is present. The bundled `operate-pi-dispatch` **skill** teaches the agent to use those gates.
|
|
49
|
+
|
|
50
|
+
- **Triggers, editable live.** cron, label, comment and pull_request triggers with colored drill-ins showing what fires each one, what it runs, and its trust model. Added, edited and deleted without a restart. Triggers that run third-party code or a custom image are badged; opting in or out of either stays an edit to the reviewed `triggers.json`, which neither the console nor a model-callable tool will make for you.
|
|
51
|
+
- **Quiet hours.** Scheduled pause windows per folder or repo: defer runs between certain times, timezone-aware, and resume automatically. Deferred, never dropped, at zero budget cost.
|
|
52
|
+
- **AI-operable, with a human gate.** Model-callable tools let an agent change limits and manage triggers and pause windows, but every write pops an operator confirmation the model cannot answer, and refuses when no operator is present. The bundled `operate-pi-dispatch` skill teaches the agent those gates.
|
|
57
53
|
- **Logs stay put.** Raw container output renders only in the overlay viewer, never into model context.
|
|
58
54
|
|
|
59
|
-
## Install
|
|
55
|
+
## Install
|
|
60
56
|
|
|
61
57
|
```bash
|
|
62
|
-
pi install npm:@edgehero/pi-dispatch-admin
|
|
58
|
+
pi install npm:@edgehero/pi-dispatch-admin # then, in pi: /dispatch
|
|
63
59
|
```
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## Get the whole thing
|
|
61
|
+
**No deployment yet? The console builds one.** When `/dispatch` finds nothing, it offers `/dispatch setup`: pick a folder, consent to an npm install of the pinned runtime, watch `pi-dispatch up` run its own prompts, optionally install the worker as a service, and land in the panel. Every step asks first and can be declined; nothing is written into your repo and no credential passes through a dialog.
|
|
68
62
|
|
|
69
|
-
The
|
|
63
|
+
Already have a deployment? The panel finds it through the deployment pointer setup writes, or through the same env vars your worker uses (`VALKEY_URL`, `PI_LOGS_DIR`, `PI_SETTINGS_FILE`, `PI_TRIGGERS_FILE`, `PI_PAUSE_WINDOWS_FILE`, `PI_SUBSCRIPTIONS_FILE`). Your env always wins.
|
|
70
64
|
|
|
71
|
-
|
|
72
|
-
mkdir my-dispatch && cd my-dispatch
|
|
73
|
-
npx @edgehero/pi-dispatch up # consented setup pass: job image, Valkey, config scaffold, preflight
|
|
74
|
-
npx @edgehero/pi-dispatch worker # drain the queue (its own terminal, or `service install`)
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
(`@edgehero/pi-dispatch` is the worker + CLI; `@edgehero/pi-dispatch-receiver` is the webhook edge for
|
|
78
|
-
forge triggers.) The container image, docs, specs, and SECURITY.md live in the main repo. **Start there:**
|
|
65
|
+
## Get the whole thing
|
|
79
66
|
|
|
80
67
|
### → **https://github.com/edgehero/pi-dispatch**
|
|
81
68
|
|
|
82
|
-
MIT, self-hosted. Read [`SECURITY.md`](https://github.com/edgehero/pi-dispatch/blob/main/SECURITY.md) before you rely on it
|
|
69
|
+
MIT, self-hosted. Read [`SECURITY.md`](https://github.com/edgehero/pi-dispatch/blob/main/SECURITY.md) before you rely on it; it states plainly what is and is not defended. Short version: the trust model is a GitHub Action's, so whoever can merge to your default branch can instruct the agent.
|