@edgehero/pi-dispatch-admin 2.0.0 → 3.0.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 CHANGED
@@ -10,9 +10,11 @@ without giving it the keys to your machine.**
10
10
  [pi](https://github.com/earendil-works/pi) is an open source coding agent that you normally run in a
11
11
  terminal. It has no job queue, no spend limit and, by its own README, no permission system. pi-dispatch
12
12
  adds exactly those, so pi can run unattended: on a cron schedule, on your repo's issues and PRs, or from
13
- the command line. Every job runs in its own container. Spend is checked before a single token is spent,
14
- for the whole deployment and per repo or folder. Everything the agent did, and what it cost, is recorded,
15
- graphed and priced.
13
+ the command line. Every job runs in its own container. Spend is checked before a single token is spent:
14
+ job counts and a daily token count for the whole deployment, job counts per repo, folder or project, and
15
+ dollars per day, week or month for the deployment and per repo, folder, project or model, plus an optional
16
+ dollar cap per job. Everything the agent did, and what it cost, is
17
+ recorded, graphed and priced.
16
18
 
17
19
  On a forge you stay in control at both ends. A job starts only when someone with write access to the repo
18
20
  asks for one, with a label, an `@pi` comment or a review. What comes back is a pull request that you
@@ -37,8 +39,10 @@ Every trigger produces the same job, through the same path: one queue, one conta
37
39
  │
38
40
  ▼
39
41
  under the day, week and if not: refused here, before any spend
40
- month caps, the scoped
41
- limits and the turn budget?
42
+ month caps (jobs, tokens,
43
+ dollars), the scoped limits,
44
+ the project's share of the
45
+ envelope and the turn budget?
42
46
  │ yes
43
47
  ▼
44
48
  one container per job Docker or Podman, removed after the job: all
@@ -58,6 +62,12 @@ container runtime guarantees is declared in
58
62
  [`docs/backends.md`](https://github.com/edgehero/pi-dispatch/blob/main/docs/backends.md), and
59
63
  `pi-dispatch doctor --live` reads it back from real containers.
60
64
 
65
+ **Where it runs.** On any Linux server or VM you control, or your own Mac or Windows machine with Docker
66
+ Desktop: the worker is a long running process beside a container runtime on the same host. Serverless
67
+ platforms, hosted sandbox services and a container daemon on another machine are not supported. pi-dispatch
68
+ itself needs no AI key; the provider key is for pi inside each job. The details are in the
69
+ [main README](https://github.com/edgehero/pi-dispatch#where-it-can-run).
70
+
61
71
  Spend is checked before a container starts, so a runaway or a junk trigger costs a refusal, not a bill.
62
72
  The job image ships Playwright and Chromium, so a flow can build a frontend, screenshot it and iterate.
63
73
 
@@ -119,20 +129,21 @@ Four things to know before you build on it:
119
129
  One command puts a live terminal view over the whole deployment:
120
130
 
121
131
  <p align="center">
122
- <img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/dispatch-dashboard.png?v=2.0.0" alt="The /dispatch panel: status, spend meters, triggers, pause windows, scoped limits, held and failed jobs, runs, and settings" width="820">
132
+ <img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/dispatch-dashboard.png?v=2026-10-05" alt="The /dispatch panel: status, spend meters, dollar windows, triggers with a portfolio trigger, pause windows, scoped limits with their dollar caps, held and failed jobs, runs with their projects, and settings" width="820">
123
133
  </p>
124
134
 
125
135
  - **Status and spend.** Queue and worker state, day, week and month spend meters, a daily token counter,
126
136
  and the run history with tokens and cost per job. `Enter` on a run opens its full record, `x` on a
127
- running job cancels it after asking, and `b` reopens a finished run's workspace.
137
+ running job cancels it after asking, and `b` on an opened run reopens its workspace.
128
138
  - **Insights, the one analytics page.** Press `i` (or type `/dispatch insights`) and one self contained
129
139
  page opens in your browser. It shows the budget dials, plan verdicts against API rates, daily,
130
- cumulative and per flow spend charts, breakdowns by flow, trigger, model and repo, and the trigger and
131
- flow topology with spend on each trigger. A plan covered run never shows as $0.00, and an estimate is
140
+ cumulative and per flow spend charts, five breakdowns (by flow, trigger, model, repo and project), the
141
+ budget split with each project's share, spend and floor and the split's history, and the trigger and flow
142
+ topology with spend on each trigger. A plan covered run never shows as $0.00, and an estimate is
132
143
  always marked as one ([`docs/insights.md`](https://github.com/edgehero/pi-dispatch/blob/main/docs/insights.md)).
133
144
 
134
145
  <p align="center">
135
- <img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/insights-view.png?v=2.0.0" alt="The insights page: KPI tiles, budget dials, a plan verdict, spend charts, the four breakdowns, and the topology with spend badges" width="820">
146
+ <img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/insights-view.png?v=2026-10-05" alt="The insights page: KPI tiles, budget dials, the budget split, a plan verdict, spend charts, the five breakdowns, and the topology with spend badges" width="820">
136
147
  </p>
137
148
 
138
149
  - **Triggers, editable live.** Add, edit and delete triggers without a restart. Drill-ins show what
@@ -140,13 +151,39 @@ One command puts a live terminal view over the whole deployment:
140
151
  stays in the list, matches nothing, and is re-armed when you delete its `on.disarmed` mark from the file.
141
152
  Triggers that run third party code or a custom image carry a badge. Turning either on or off stays an
142
153
  edit to the reviewed `triggers.json`, which neither the console nor a model callable tool makes for you.
154
+ A portfolio manager's cron trigger carries `[portfolio]`: its jobs write the budget split.
143
155
  - **Quiet hours.** Pause windows per folder or repo, timezone aware. A paused job waits, never drops, and
144
156
  costs nothing.
145
- - **Scoped limits.** Job caps per repo or folder (day, week, month), refused before any spend, plus a
146
- ceiling on how many run at once, enforced by making jobs wait. Local jobs also have a fixed guard with
157
+ - **Scoped limits.** Job caps per repo, folder or project (day, week, month), refused before any spend, plus a
158
+ ceiling on how many run at once, enforced by making jobs wait. Dollar caps per day, week or month for a
159
+ repo, a folder, a model (`model:<provider>/<id>`) or a project (`project:<id>`). Write a repo with its
160
+ forge (`github:acme/web`) to limit it on that forge only. Local jobs also have a fixed guard with
147
161
  no switch: one job per folder at a time (it lives in the worker process, and one worker per container
148
162
  daemon is the supported shape), because two agents editing one working tree race each other with no
149
163
  gate and no undo.
164
+ - **Dollar windows.** With dollar caps set, the panel shows each window's spend and holds against its cap,
165
+ and what the run records settled ([`docs/costs.md`](https://github.com/edgehero/pi-dispatch/blob/main/docs/costs.md)).
166
+ - **Projects.** `j` shows each project with its members and this month's spend, and `Enter` on one filters
167
+ the runs list. `dispatch_projects` lists them, and `dispatch_project_add`, `dispatch_project_edit` and
168
+ `dispatch_project_delete` change `projects.json` behind your confirm
169
+ ([`docs/projects.md`](https://github.com/edgehero/pi-dispatch/blob/main/docs/projects.md)).
170
+ - **The budget split.** With an allocation envelope (a dollar total per window and a floor per project), `b`
171
+ in the list shows each project's share and spend, the applied plan with the reasons it gave, and the history.
172
+ `r` on a history row reverts to it after a yes or no. `dispatch_priorities_set` sets a plan of weights with
173
+ no confirm, because it can only move money inside the envelope; `dispatch_envelope_set` changes the envelope
174
+ behind your confirm; `dispatch_allocations` reads the split. pi's own `write` and `edit` tools are blocked on
175
+ the envelope, `projects.json`, `scoped-limits.json`, `triggers.json` and the settings file
176
+ ([`docs/allocation.md`](https://github.com/edgehero/pi-dispatch/blob/main/docs/allocation.md)).
177
+ `/dispatch priorities` shows the split as text, and `/dispatch priorities set shop=3 platform=1` sets a
178
+ plan. A run's detail names the plan a portfolio run wrote and the dollars it settled.
179
+
180
+ <p align="center">
181
+ <img src="https://raw.githubusercontent.com/edgehero/pi-dispatch/main/docs/images/dispatch-allocation.png?v=2026-10-05" alt="The panel's budget split view: the weekly envelope, each project's floor, weight, share and spend, the headroom, the applied plan clamped by the step with its reasons, and the history across two hosts with a revert" width="820">
182
+ </p>
183
+
184
+ - **The portfolio manager.** A weekly flow you own reads the budget and writes a plan of weights. The
185
+ worker applies it inside the envelope, bounds each move and logs it, so you can revert it
186
+ ([`docs/portfolio-manager.md`](https://github.com/edgehero/pi-dispatch/blob/main/docs/portfolio-manager.md)).
150
187
  - **Held and failed jobs.** A trigger with `run.waitFor` holds its job in the queue, unstarted and
151
188
  unbilled, until a time passes or your check script exits 0. The panel shows a **held** section while
152
189
  anything waits (the target, the condition and how long), and a **failed** section for jobs the queue
@@ -199,7 +236,8 @@ setup appears when there is nothing, never over an outage.
199
236
 
200
237
  **Already have a deployment?** The panel finds it through the deployment pointer, or through the same env
201
238
  vars your worker uses (`VALKEY_URL`, `PI_LOGS_DIR`, `PI_SETTINGS_FILE`, `PI_TRIGGERS_FILE`,
202
- `PI_PAUSE_WINDOWS_FILE`, `PI_SUBSCRIPTIONS_FILE`). Your env always wins. What your env does not set comes
239
+ `PI_PAUSE_WINDOWS_FILE`, `PI_SCOPED_LIMITS_FILE`, `PI_SUBSCRIPTIONS_FILE`, `PI_PROJECTS_FILE`,
240
+ `PI_ENVELOPE_FILE`). Your env always wins. What your env does not set comes
203
241
  from the deployment's own `.env`, by the same rule `pi-dispatch doctor` uses: only the pointer's
204
242
  deployment folder (never a `.env` in the folder pi started in, which any repository could ship), and only
205
243
  when that file is yours and nobody else can write it. A key your env sets differently is named once as a