pi-jar 0.1.2 → 0.1.4
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 +46 -16
- package/docs/DEVELOPMENT.md +4 -2
- package/docs/WORKFLOWS.md +7 -3
- package/extensions/index.ts +194 -71
- package/package.json +1 -1
- package/src/activity-view.ts +525 -0
- package/src/advisor.ts +9 -3
- package/src/changes.ts +35 -11
- package/src/child-baselines.ts +42 -0
- package/src/compact-tools.ts +58 -24
- package/src/composer.ts +69 -21
- package/src/delegate.ts +492 -51
- package/src/dialogs.ts +9 -5
- package/src/diff-view.ts +13 -1
- package/src/flame.ts +18 -5
- package/src/footer.ts +131 -26
- package/src/history-ui.ts +19 -12
- package/src/history.ts +3 -1
- package/src/icons.ts +57 -0
- package/src/model-roles.ts +62 -7
- package/src/panel.ts +5 -1
- package/src/plan.ts +1 -0
- package/src/prompt-search.ts +20 -10
- package/src/row-cache.ts +26 -0
- package/src/session-gallery.ts +8 -3
- package/src/session-ui.ts +112 -42
- package/src/settings-ui.ts +10 -11
- package/src/settings.ts +5 -1
- package/src/shells.ts +8 -84
- package/src/side-model.ts +45 -25
- package/src/split-view.ts +29 -12
- package/src/status.ts +2 -0
- package/src/task-tool.ts +140 -53
- package/src/tasks-ui.ts +15 -5
- package/src/tasks.ts +224 -38
- package/src/welcome.ts +47 -14
- package/src/working.ts +3 -1
package/README.md
CHANGED
|
@@ -22,12 +22,12 @@ The showcase is captured from a real pi-jar terminal session: the torch-style `
|
|
|
22
22
|
| **Advisor** | A second-opinion model: the agent calls `jar_advisor` for risky decisions or when stuck, `/advisor [focus]` asks on demand, and automatic gates consult it when the agent repeats the same tool call or keeps failing. |
|
|
23
23
|
| **Usage & context** | `/usage` shows session cost and tokens per model (advisor and commit calls included) and plan-limit bars with reset times; `/context` draws a grid of what fills the context window, with a per-file, per-skill and per-tool breakdown. |
|
|
24
24
|
| **Commit** | `/jar commit [note]` drafts a message for the staged changes with the `commit` role, lets you edit it, then commits (never pushes). |
|
|
25
|
-
| **Tasks & questions** | A Claude-style `jar_todo` checklist the agent maintains itself, and `jar_ask` structured questions with options, multi-select and free-form answers. |
|
|
26
|
-
| **Change review** | Every file the agent
|
|
27
|
-
| **Background shells** | `jar_shell` runs dev servers, watchers and long tests in the background; the agent is woken when a watch pattern matches or the process exits, so it never polls.
|
|
28
|
-
| **Subagents** | `jar_delegate` fans out up to four read-only (or opt-in editing) subagents in parallel on your model roles
|
|
25
|
+
| **Tasks & questions** | A Claude/omp-style `jar_todo` checklist with subtasks and per-task progress that the agent maintains itself, and `jar_ask` structured questions with options, multi-select and free-form answers. |
|
|
26
|
+
| **Change review** | Every file the agent or its editing subagents change is remembered as it was; `/diff` (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>D</kbd>) shows changed files (each counted once) next to a colored diff, with accept or revert per file or all at once. |
|
|
27
|
+
| **Background shells** | `jar_shell` runs dev servers, watchers and long tests in the background; the agent is woken when a watch pattern matches or the process exits, so it never polls. Running shells get a footer row; click it (or <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>A</kbd>) to tail or kill them. |
|
|
28
|
+
| **Subagents** | `jar_delegate` fans out up to four read-only (or opt-in editing) subagents in parallel on your model roles. Each gets a live footer row; click it to open its checklist and an omp-style collapsible transcript, steer it with a message, or stop it. The parent gets a detailed report (tools, files, tasks, failures) from each. |
|
|
29
29
|
| **Sessions & history** | Recent sessions (with their goal and plan) on the welcome card, one click from resuming; <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>H</kbd> searches earlier prompts; pasted images show as chips under the composer. |
|
|
30
|
-
| **Footer & themes** | Responsive footer (model, effort, session, cwd, context, RAM, cost, quota, goal, roles, branch) and seven dark themes. |
|
|
30
|
+
| **Footer & themes** | Responsive footer (model, effort, session, cwd, context, RAM, cost, quota, goal, roles, branch, live subagents and shells) with unicode, [Nerd Font](https://www.nerdfonts.com) or ascii icons, and seven dark themes. |
|
|
31
31
|
|
|
32
32
|
## Install
|
|
33
33
|
|
|
@@ -64,12 +64,12 @@ Pi only delivers mouse events in its **fullscreen** TUI mode. In regular mode th
|
|
|
64
64
|
| `/jar tasks [list\|add\|done\|open\|edit\|delete]` | Human view/editor for the agent's checklist. |
|
|
65
65
|
| `/jar history` | Read-only conversation timeline for the active branch. |
|
|
66
66
|
| `/diff` | Review, accept or revert the files the agent changed. |
|
|
67
|
-
| `/jar shells` |
|
|
67
|
+
| `/jar activity` · `/jar shells` | Subagents and background shells: live transcript/output, stop or kill. |
|
|
68
68
|
| `/jar resume [N]` | Resume recent session `N` from the welcome list, or pick one. |
|
|
69
|
-
| `/jar sessions [query]` · `/jar name <title>` | Search
|
|
69
|
+
| `/jar sessions [query]` · `/jar name <title>` | Search sessions with a details pane (prompt, messages, goal, plan) and switch; name the current one. |
|
|
70
70
|
| `/jar welcome` | Replay the welcome screen. |
|
|
71
71
|
| `/jar ask [question]` | Answer a question in a dialog and insert the answer into the editor. |
|
|
72
|
-
| `/jar accent [preset]` · `/jar footer` | Switch a loaded accent theme; toggle footer fields. |
|
|
72
|
+
| `/jar accent [preset]` · `/jar footer` · `/jar icons [unicode\|nerd\|ascii]` | Switch a loaded accent theme; toggle footer fields; pick the icon set. |
|
|
73
73
|
| `/jar composer on\|off` · `/jar animations on\|off` · `/jar ui on\|off` | Toggle the composer, motion, or all pi-jar UI. |
|
|
74
74
|
| `/jar quota on\|off` | Session-only, read-only quota lookups for supported OAuth providers. |
|
|
75
75
|
| `/jar hub` | Open an installed task or subagent manager command. |
|
|
@@ -78,6 +78,7 @@ Pi only delivers mouse events in its **fullscreen** TUI mode. In regular mode th
|
|
|
78
78
|
| Shortcut | Action |
|
|
79
79
|
| --- | --- |
|
|
80
80
|
| <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd> | Open pi-jar settings |
|
|
81
|
+
| <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>A</kbd> | Subagents and background shells (activity view) |
|
|
81
82
|
| <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>R</kbd> | Refresh the welcome (new message and flame), or show it again |
|
|
82
83
|
| <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd> | Toggle plan mode |
|
|
83
84
|
| <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>M</kbd> | Cycle model roles (`cycleOrder`) |
|
|
@@ -207,6 +208,26 @@ The advisor is a second model (the `advisor` role; the current model if unassign
|
|
|
207
208
|
- **Gates** — when the agent makes the same tool call three times within its last eight calls, the call is blocked and the advisor's review is returned instead; after three failing tool results in a row, the advice is steered into the running turn. At most two automatic consultations per prompt.
|
|
208
209
|
- Settings → Pi toggles the advisor and the gates. Advisor calls are counted in `/usage`. The footer and welcome show it as a working teammate while it thinks.
|
|
209
210
|
|
|
211
|
+
### Advisor fallback models
|
|
212
|
+
|
|
213
|
+
Configure an ordered fallback chain (the primary advisor remains configured with `/roles set advisor`):
|
|
214
|
+
|
|
215
|
+
```text
|
|
216
|
+
/roles fallback advisor openai/gpt-5:high @smol
|
|
217
|
+
/roles fallback advisor
|
|
218
|
+
/roles fallback advisor clear
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Add `--project` when saving or clearing to override the global chain for this project. Configuration is stored in `pi-jar-roles.json` alongside `roles`:
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
"fallbacks": { "advisor": ["openai/gpt-5:high", "@smol"] }
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
One-shot advisor calls (`jar_advisor`, `/advisor`, and stuck-work gates) try the primary first, then up to eight configured fallbacks on missing models, authentication/provider errors (including rate limits), or empty answers. Cancellation never starts another attempt. Aliases and per-model thinking levels are supported; duplicate model/effort pairs are skipped. Answers identify the successful model, returned attempts are counted in `/usage`, and exhaustion reports every failure. An empty project list disables inherited global fallbacks. No fallback is used unless explicitly configured; context is sent only to the models you choose. The same configuration works for other one-shot roles such as `commit`, but not interactive role activation or goal audit model switches.
|
|
228
|
+
|
|
229
|
+
This is a pi-jar enhancement: [pi-advisor](https://github.com/philipbrembeck/pi-advisor/) currently resolves one configured advisor model rather than a fallback chain.
|
|
230
|
+
|
|
210
231
|
## Usage and context
|
|
211
232
|
|
|
212
233
|
`/usage` and `/context` open one tabbed panel (<kbd>Tab</kbd> switches, <kbd>Esc</kbd> closes):
|
|
@@ -216,11 +237,18 @@ The advisor is a second model (the `advisor` role; the current model if unassign
|
|
|
216
237
|
|
|
217
238
|
## Tasks, questions and history
|
|
218
239
|
|
|
219
|
-
- **`jar_todo`** — a Claude-style task list the agent keeps for any multi-step request.
|
|
240
|
+
- **`jar_todo`** — a Claude/omp-style task list the agent keeps for any multi-step request. Prefer incremental `append` (new tasks only), `replace` (update one stable `id`), and `remove` (delete one task and its subtasks); IDs are returned for every task. Omitted replacement fields and subtasks stay intact. Legacy `write` (or `todos` without an action) still replaces the entire list, removing omitted tasks. Invalid updates leave the list unchanged. Each task is `pending`, `in_progress` (exactly one at a time) or `completed`, with an `activeForm` ("Running tests") that replaces the working spinner text while it runs. Tasks can have one level of **subtasks**: a parent's status follows its subtasks, its row shows `(done/total)`, and progress counts every subtask (and every task without subtasks). The live checklist above the composer shows `✔` struck-through done tasks, a bold `◼` current task and `☐` pending ones, with subtasks indented; a finished list stays until your next prompt. `/jar tasks` is your view/editor: `a` add, <kbd>Space</kbd>/<kbd>Enter</kbd> check, `e` edit, `d` delete, `f` filter.
|
|
241
|
+
```json
|
|
242
|
+
{ "action": "append", "todos": [{ "content": "Run tests", "status": "pending", "activeForm": "Running tests" }] }
|
|
243
|
+
{ "action": "replace", "id": "<returned-id>", "status": "in_progress" }
|
|
244
|
+
{ "action": "remove", "id": "<returned-id>" }
|
|
245
|
+
```
|
|
246
|
+
Use `parent` with `append` to add subtasks; `start`, `done`, `open`, `edit`, and `list` remain available (`add`/`delete` also remain supported).
|
|
220
247
|
- **`jar_ask`** — structured questions: numbered options with descriptions, single or multi-select, *Type your own answer* (multi-line, paste-friendly) and *Chat about this* to discuss before choosing.
|
|
221
|
-
- **`/diff`** — review what the agent changed since
|
|
222
|
-
- **`jar_shell`** — `start` (with optional `name`, `watch` regex and `notify`), `list`, `output`, `kill`. Output is ANSI-stripped and bounded (2000 lines). When a watch matches or the process ends, a visible message wakes the agent (queued if it is busy).
|
|
223
|
-
- **`jar_delegate`** — up to four subagents run in parallel as separate
|
|
248
|
+
- **`/diff`** — review what the agent (and its editing subagents) changed since the first edit to each file: files with `+/−` counts on the left, a numbered, colored diff on the right. `a` accept (keep, stop tracking), `r` then `y` revert (restore the original, or remove a file it created), `A`/`R` for all. The footer shows `± N files · /diff` while anything is unreviewed; each file counts once no matter who edited it. Only `edit`/`write` changes inside the project are tracked; shell-made changes are not.
|
|
249
|
+
- **`jar_shell`** — `start` (with optional `name`, `watch` regex and `notify`), `list`, `output`, `kill`. Output is ANSI-stripped and bounded (2000 lines). When a watch matches or the process ends, a visible message wakes the agent (queued if it is busy). Each running shell gets a footer row; the activity view (`/jar shells`, a click on the row) tails it live (`x` kill, `f` follow). All shells stop when the session ends.
|
|
250
|
+
- **`jar_delegate`** — up to four subagents run in parallel as separate Pi processes (RPC mode) with a fresh context, on a role (default `task`, then `default`, then the current model). They are read-only (`read`, `grep`, `find`, `ls`, plus `jar_todo`) unless `write: true`; subagents cannot delegate further; aborting the turn stops them. Each has a live footer row. When they finish, the parent gets a detailed report per subagent: outcome, duration, tool calls by name, files read and edited, its task checklist, failed calls, then its own Summary / Details / Verification / Open issues.
|
|
251
|
+
- **Activity view** — one split view (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>A</kbd>, `/jar activity`, or a click on a footer row) for subagents, background shells and other extensions' teammates: list on the left, live details on the right (auto-follows; scroll up to pause, `f` to follow again). For a subagent the details show its task, its own checklist with subtasks, and a transcript like omp's: each tool call and message is one collapsed line that expands on demand (`Tab` into it, `↑↓`, `Enter`, or click) to show arguments and output, while streaming text shows live. `s` opens a steering input: type a message and press `Enter` to redirect the running subagent. `x` stops just that one. Finished runs stay listed for review.
|
|
224
252
|
- **`/jar history`** — separate, read-only timeline of the active branch (paging, search, expandable details). Pi's native transcript is untouched.
|
|
225
253
|
- Pi's built-in read/shell/edit/write tool cards render compactly; the full output or diff stays one click or <kbd>Ctrl</kbd>+<kbd>O</kbd> away.
|
|
226
254
|
|
|
@@ -228,8 +256,8 @@ The advisor is a second model (the `advisor` role; the current model if unassign
|
|
|
228
256
|
|
|
229
257
|
`/jar settings` (or <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd>, or the welcome's Settings action) has three tabs:
|
|
230
258
|
|
|
231
|
-
- **Appearance** — accent, motion, rounded composer, Ember mascot, next-prompt suggestions, pi-jar UI.
|
|
232
|
-
- **Footer** — field visibility.
|
|
259
|
+
- **Appearance** — accent, motion, rounded composer, Ember mascot, next-prompt suggestions, pi-jar UI, icons (`unicode` default, `nerd` for a [Nerd Font](https://www.nerdfonts.com) terminal like omp's nerd preset, `ascii` for plain labels).
|
|
260
|
+
- **Footer** — field visibility. In fullscreen mode the session name (or `sessions` for an unnamed session) opens the session picker and each subagent/shell row opens the activity view. SoL-Pi's savings status is not repeated in the footer (it already notifies).
|
|
233
261
|
- **Pi** — mouse clicks (Pi fullscreen mode), copy on select, goal auto rounds, advisor, advisor gates.
|
|
234
262
|
|
|
235
263
|
pi-jar preferences are saved in `pi-jar-settings.json` in Pi's agent directory; the Pi tab writes Pi's own settings.
|
|
@@ -258,8 +286,10 @@ pi-jar/
|
|
|
258
286
|
│ ├── usage-view.ts /usage; context-view.ts is /context; panel.ts frames both
|
|
259
287
|
│ ├── split-view.ts shared two-pane frame
|
|
260
288
|
│ ├── changes.ts change tracker and line diff; diff-view.ts is /diff
|
|
261
|
-
│ ├── shells.ts background shells
|
|
262
|
-
│ ├── delegate.ts jar_delegate subagents
|
|
289
|
+
│ ├── shells.ts background shells and jar_shell
|
|
290
|
+
│ ├── delegate.ts jar_delegate subagents and their live registry
|
|
291
|
+
│ ├── activity-view.ts subagent/shell details view
|
|
292
|
+
│ ├── icons.ts unicode / nerd / ascii glyph sets
|
|
263
293
|
│ ├── attachments.ts image chips; prompt-search.ts is prompt history
|
|
264
294
|
│ ├── session-gallery.ts recent sessions for the welcome
|
|
265
295
|
│ ├── welcome.ts welcome layout and hit-testing
|
package/docs/DEVELOPMENT.md
CHANGED
|
@@ -56,11 +56,13 @@ Then check:
|
|
|
56
56
|
|
|
57
57
|
- the welcome at 24, 40, 80 and 120+ columns; <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>R</kbd> refresh; motion off (`/jar animations off`) freezes the flame;
|
|
58
58
|
- the composer: typing `/pl` shows autocomplete below the frame; long drafts grow before scrolling; Ember changes mood while dialogs are open;
|
|
59
|
-
- `/jar settings`: Tab through Appearance → Footer → Pi
|
|
59
|
+
- `/jar settings`: Tab through Appearance → Footer → Pi; cycle Unicode/Nerd Font/ASCII icons and toggle mouse mode in the temporary agent dir;
|
|
60
|
+
- `/jar sessions`: search, move between rows, inspect the selected prompt/goal/plan, then resume; the footer session name or `sessions` indicator opens the same picker;
|
|
61
|
+
- `/jar activity`: select a subagent or background shell, scroll its live transcript/output, pause and resume follow, `Tab` into a subagent's transcript and expand/collapse entries, steer it with `s`, and stop/kill only the selected run;
|
|
60
62
|
- `/roles`: the split manager, `n` new role, `a` alias, `s` scope;
|
|
61
63
|
- `/plan`: the status shows `◆ PLAN · read-only` and a directory appears under `$TMPDIR/pi-jar/plans/`.
|
|
62
64
|
|
|
63
|
-
For pointer interaction start with `--tui-mode fullscreen` (or enable **Pi → Mouse clicks** and restart). Check that welcome actions fire once per press, that clicking composer text moves the cursor, that clicking Ember pokes it, that plan-view headings and actions respond to clicks and the wheel, and that selecting text anywhere still copies it.
|
|
65
|
+
For pointer interaction start with `--tui-mode fullscreen` (or enable **Pi → Mouse clicks** and restart). Check that welcome actions fire once per press, that footer activity rows open their matching details, that the footer session indicator opens search, that clicking composer text moves the cursor, that clicking Ember pokes it, that plan-view headings and actions respond to clicks and the wheel, and that selecting text anywhere still copies it. In regular mode use `/jar activity` and `/jar sessions` instead.
|
|
64
66
|
|
|
65
67
|
With a logged-in model, run end to end:
|
|
66
68
|
|
package/docs/WORKFLOWS.md
CHANGED
|
@@ -114,6 +114,7 @@ Manual choices win: a model or effort you select yourself (model picker, cycling
|
|
|
114
114
|
- `/diff` (or <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>D</kbd>) compares the baseline with the file on disk using a line diff with 3 lines of context. Files that are back to their baseline drop out.
|
|
115
115
|
- **Accept** forgets the baseline. **Revert** writes the baseline back (or removes a file the agent created) after a second key press to confirm. Errors are reported and the file stays listed.
|
|
116
116
|
- Baselines live in memory for the session; changes made through `bash` or by you are not tracked.
|
|
117
|
+
- **Subagent edits** join the same review. An editing `jar_delegate` batch gets a private temporary directory (`PI_JAR_BASELINE_DIR`); pi-jar inside each subagent writes a file's baseline there right before the subagent's first edit to it. After each successful subagent `edit`/`write` the parent adopts that baseline, unless it already tracks the file (the older baseline wins), so every file is counted once in the footer and `/diff`. The directory is removed when the batch ends. A subagent without pi-jar loaded cannot record baselines, so its edits are listed in its report but not in `/diff`.
|
|
117
118
|
|
|
118
119
|
## Background shells
|
|
119
120
|
|
|
@@ -129,10 +130,13 @@ watch matches or process exits → pi-jar.shell message → agent wakes (o
|
|
|
129
130
|
|
|
130
131
|
## Subagents
|
|
131
132
|
|
|
132
|
-
- `jar_delegate` takes 1–4 tasks. Each runs `pi --mode
|
|
133
|
+
- `jar_delegate` takes 1–4 tasks. Each runs `pi --mode rpc --no-session [parent's -e/--extension/-ne flags] --model <role model> [--thinking <effort>] [--tools read,grep,find,ls,jar_todo]` in the project directory, with `PI_JAR_CHILD=1`, and receives the task as an RPC `prompt` (with instructions to track work in `jar_todo` and to report in Summary / Details / Verification / Open issues sections). Once the child emits `agent_settled`, stdin is closed and Pi exits in order. Dialogs a child opens are answered as cancelled so it never blocks.
|
|
133
134
|
- The model comes from the task's role (default `task`), falling back to `default` and then the current model.
|
|
134
|
-
- Progress (tools used, turns, cost) streams into the tool card; each running subagent is published as a teammate for the welcome TEAM row and footer, and cleared when it ends.
|
|
135
|
-
-
|
|
135
|
+
- Progress (current tool, streaming text, tools used, turns, cost) streams into the tool card; each running subagent is published as a teammate for the welcome TEAM row and footer, and cleared when it ends.
|
|
136
|
+
- The activity view keeps a structured transcript per subagent: every tool call (arguments, streamed and final output, duration, success) and each assistant message, plus steering messages; the newest 200 entries, each clipped to 4000 characters, and the text still streaming. Entries are collapsed to one line and rendered only when expanded (`Tab` into the transcript, `↑↓`, `Enter`, or a click on the entry). The subagent's own `jar_todo` checklist (with subtasks) is mirrored from its tool results. It all lives only in memory with the 8 most recent finished runs; the tool result saved in the session carries the reports, not the transcript.
|
|
137
|
+
- **Steering:** `s` in the activity view (or a click on the input row) opens an input; `Enter` sends the text as an RPC `steer` message, delivered after the subagent's current tool calls. Steering works while the subagent is running.
|
|
138
|
+
- **Report back:** for each subagent the parent reads its outcome and duration, turns, tool calls by name, files read and edited, its checklist with per-task progress, failed tool calls, and then the subagent's own report.
|
|
139
|
+
- Subagents time out after 20 minutes and stop when the turn is aborted; `x` in the activity view stops one without touching the rest of its batch (its report reads `failed: stopped`). In goal mode, `write: true` needs an open task.
|
|
136
140
|
|
|
137
141
|
## Sessions and prompt history
|
|
138
142
|
|