@xl0/pi-lovely-agents 0.1.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +184 -0
  4. package/extensions/lovely-agents/agent.ts +1374 -0
  5. package/extensions/lovely-agents/bash.ts +599 -0
  6. package/extensions/lovely-agents/child-session.ts +296 -0
  7. package/extensions/lovely-agents/config.ts +221 -0
  8. package/extensions/lovely-agents/coordinator.ts +506 -0
  9. package/extensions/lovely-agents/definitions.ts +380 -0
  10. package/extensions/lovely-agents/index.ts +400 -0
  11. package/extensions/lovely-agents/lifecycle.ts +251 -0
  12. package/extensions/lovely-agents/management.ts +638 -0
  13. package/extensions/lovely-agents/notifications.ts +220 -0
  14. package/extensions/lovely-agents/provider-limits.ts +13 -0
  15. package/extensions/lovely-agents/rendering.ts +90 -0
  16. package/extensions/lovely-agents/state.ts +1179 -0
  17. package/extensions/lovely-agents/task-panel.ts +192 -0
  18. package/extensions/lovely-agents/tools.ts +635 -0
  19. package/extensions/lovely-agents/updates.ts +45 -0
  20. package/node_modules/@xl0/pi-lovely-config/CHANGELOG.md +79 -0
  21. package/node_modules/@xl0/pi-lovely-config/LICENSE +21 -0
  22. package/node_modules/@xl0/pi-lovely-config/README.md +200 -0
  23. package/node_modules/@xl0/pi-lovely-config/package.json +59 -0
  24. package/node_modules/@xl0/pi-lovely-config/src/config.ts +399 -0
  25. package/node_modules/@xl0/pi-lovely-config/src/index.ts +3 -0
  26. package/node_modules/@xl0/pi-lovely-config/src/ui.ts +786 -0
  27. package/package.json +68 -0
  28. package/skills/agent/SKILL.md +21 -0
  29. package/skills/agent-creator/SKILL.md +35 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [0.1.0] - 2026-09-06
6
+
7
+ - Reusable Markdown agent definitions with model, thinking, tool, and context settings.
8
+ - Persistent Pi agents with background or foreground execution, Follow-ups, and live Steers.
9
+ - Background Bash with separate concurrency limits, stdin/EOF, and retained output.
10
+ - Shared task listing, output inspection, cancellation, and archival.
11
+ - Interactive task management through `/lovely-agents` and the below-editor task panel.
12
+ - Completion notifications, live output, conversation history, and system-prompt inspection.
13
+ - Provider-limit suspension and recovery, plus `/continue` after errors or aborted turns.
14
+ - User/project configuration, model selection, and optional `fast`, `smart`, and `workhorse` aliases.
15
+ - Concurrency and delegation limits, session ownership, and restart reconciliation.
16
+ - Private, Git-ignored task storage with full logs preserved after archival.
17
+ - Packaged `agent` and `agent-creator` skills for delegation and role authoring.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alexey Zaytsev <alexey.zaytsev@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # Lovely Agents
2
+
3
+ Give [Pi](https://github.com/earendil-works/pi) a second pair of eyes—or let it
4
+ run a build while you keep working.
5
+
6
+ Lovely Agents lets Pi delegate jobs to other agents, run Bash commands in the
7
+ background, and bring back results when they're ready. You can inspect the work,
8
+ redirect it, ask follow-up questions, or stop it.
9
+
10
+ Agents have their own conversations, but **share your checkout**. They're useful
11
+ for research, reviews, and separate pieces of work—not several agents editing
12
+ the same file. The included `agent` skill gives Pi guidance on when delegation
13
+ is worth the overhead.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pi install npm:@xl0/pi-lovely-agents
19
+ ```
20
+
21
+ See [Development](#development) to run a local checkout.
22
+
23
+ ## Create your first agent
24
+
25
+ An agent definition is a Markdown file that describes a job. Ask Pi to create
26
+ one with the included skill:
27
+
28
+ ```text
29
+ /skill:agent-creator Create a read-only reviewer for this project.
30
+ ```
31
+
32
+ Or create `.pi/agents/reviewer.md` yourself:
33
+
34
+ ```markdown
35
+ ---
36
+ name: reviewer
37
+ description: Review changes for bugs and missing edge cases
38
+ # model: smart # Optional: configure this alias before uncommenting
39
+ thinking: high
40
+ tools: [read, grep, find, ls]
41
+ exclude_agents_md: false
42
+ ---
43
+
44
+ Review the requested changes. Focus on concrete defects, not style preferences.
45
+ Explain each finding with a file location and why it matters.
46
+ ```
47
+
48
+ Then ask Pi:
49
+
50
+ > Ask reviewer to check the current changes. While it works, help me update the docs.
51
+
52
+ Pi starts the reviewer. For a short job, it may return the result directly;
53
+ longer work continues in the background and sends a notification when done.
54
+
55
+ Put definitions in `~/.pi/agent/agents/` to use them across projects. A trusted
56
+ project's definition takes precedence over a user definition with the same name.
57
+
58
+ ### Definition fields
59
+
60
+ The YAML between the `---` lines accepts these fields:
61
+
62
+ | Field | Required | Meaning |
63
+ | --- | --- | --- |
64
+ | `name` | Yes | The name you use to request this agent. 1–64 lowercase letters, digits, `_`, or `-`; start with a letter or digit. |
65
+ | `description` | Yes | A short explanation of when to use it. Nonblank, at most 500 UTF-8 bytes. |
66
+ | `model` | No | A `provider/model-id`, an unambiguous model ID, or a configured `fast`, `smart`, or `workhorse` alias. Omit to use the starting Pi session's model. |
67
+ | `thinking` | No | Effort level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. Omit to use the model alias's preset, or otherwise the starting session's level. Pi adjusts unsupported levels. |
68
+ | `tools` | No | Allowed tool names, as a YAML list or comma-separated string. Omit for normal tools and extensions; `[]` allows no tools. |
69
+ | `exclude_agents_md` | No | Set `true` to leave out discovered `AGENTS.md` and `CLAUDE.md` instructions. Defaults to `false`. |
70
+
71
+ The Markdown below the closing `---` is also required: it tells the agent how
72
+ to do its job and what to report. Keep reusable instructions here; give the
73
+ specific assignment when you ask Pi to start it.
74
+
75
+ Unknown fields, tool names, and models are rejected. Names must be unique
76
+ within each scope. You can request a different model or thinking level when
77
+ starting an agent; these fields are defaults, not locks.
78
+
79
+ The example restricts its reviewer to reading tools. Without a `tools` list,
80
+ agents get the normal tools and extensions; a role description is not a sandbox.
81
+
82
+ ## Watch and guide the work
83
+
84
+ Open **`/lovely-agents` → Tasks**, or press **Down with an empty editor** to focus
85
+ the task list below it.
86
+
87
+ - **Arrow keys** select a task; **Enter** opens its actions.
88
+ - **Live output** shows what it has produced so far.
89
+ - **Inputs / history** shows earlier requests and results.
90
+ - **Follow-up** adds another request after the agent's current work.
91
+ - **Steer** redirects work already in progress.
92
+ - **Stop** cancels the work but keeps its files. An agent can take a new request later.
93
+ - **Discard** stops and archives it, removing it from the list. It does not delete the files.
94
+ - **Esc** returns to the editor.
95
+
96
+ You can also ask Pi directly:
97
+
98
+ > Ask the reviewer to check the cancellation path too.
99
+
100
+ > Stop the build and show me its output.
101
+
102
+ Tool calls and notifications are compact by default. **Ctrl+O** expands their
103
+ full contents.
104
+
105
+ ## Background Bash
106
+
107
+ Ask Pi to run a long command in the background:
108
+
109
+ > Run `bun run build` in the background and tell me when it finishes.
110
+
111
+ The command appears alongside agent tasks. You can inspect its output or stop
112
+ it from the same menu. Normal, short Bash commands still work as before.
113
+
114
+ For a command that needs input, **Write stdin** sends exactly what you type;
115
+ include a newline if the command expects one. **Close stdin** sends EOF: “there
116
+ will be no more input.” This lets commands such as `cat` finish reading. It
117
+ doesn't kill the process, and you cannot reopen its input afterward.
118
+
119
+ A finished Bash command cannot be restarted as the same task—start a new one.
120
+ Background Bash currently supports Linux and macOS, not Windows.
121
+
122
+ ## Settings and models
123
+
124
+ Open **`/lovely-agents` → Configuration**. Settings can apply to all projects or
125
+ just this workspace; workspace settings win.
126
+
127
+ **Background agents** and **Background Bash** are both on by default. Turn off
128
+ Background agents if you want Pi to wait for agents to finish instead of leaving
129
+ work running. Turning either switch off does not stop tasks already accepted.
130
+
131
+ Agent work and Bash jobs have separate concurrency limits, both initially 4.
132
+ Extra work queues until a slot is free. Pi initially waits up to 30 seconds for
133
+ an agent result before leaving it in the background.
134
+
135
+ Under **Models**, choose additional models Pi may use for agents. You can also
136
+ configure these optional shortcuts:
137
+
138
+ | Alias | Suggested use |
139
+ | --- | --- |
140
+ | `fast` | Quick research and straightforward tasks |
141
+ | `smart` | Difficult reasoning and complex reviews |
142
+ | `workhorse` | Everyday coding and research |
143
+
144
+ Each shortcut has a model and thinking level. They start disabled until you pick
145
+ a model; choosing one also makes that model available without a separate Models
146
+ selection. Pi decides when to use each shortcut. Changing settings doesn't
147
+ switch the model of an existing agent.
148
+
149
+ ## Results, limits, and interruptions
150
+
151
+ Long results aren't lost. Pi's output-reading tool returns at most **2,000 lines
152
+ or 50 KiB** at a time, with a truncation notice and a file path when capped.
153
+ These are snapshots, not pages to assemble by repeatedly reading. Full agent
154
+ replies are in `history.md`; full Bash output is in `output.log`.
155
+
156
+ If Pi asks to wait for a result, the wait ends when the run finishes, pauses on
157
+ a provider limit, or reaches the requested timeout. A timeout returns the
158
+ latest output—it does not stop the task.
159
+
160
+ Tasks belong to the Pi conversation that started them. **`/reload` keeps work
161
+ running; quitting or switching conversations stops it.** After a crash, lost
162
+ work is marked interrupted rather than silently restarted. Agent conversations
163
+ can receive a new request; Bash commands must be started again.
164
+
165
+ Background agents pause on provider quota or rate limits. A successful request
166
+ using the affected model can resume them. If your main conversation ended with
167
+ an error or was aborted, **`/continue`** resumes it and eligible paused agents.
168
+
169
+ Task files live in `.pi/lovely-agents/` under your working directory and are
170
+ ignored by Git. They include conversation history and command output, so treat
171
+ them as potentially sensitive. Discarded tasks move to its `archive/` directory;
172
+ there is no automatic deletion.
173
+
174
+ ## Development
175
+
176
+ ```bash
177
+ bun install
178
+ pi -e .
179
+ ```
180
+
181
+ Run checks with `bun run check`.
182
+
183
+ See [CODE.md](CODE.md) for implementation details and [PLAN.md](PLAN.md) for the
184
+ design and remaining work.