pi-feats 0.1.1
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/LICENSE +21 -0
- package/README.md +508 -0
- package/extensions/README.md +27 -0
- package/extensions/api-server/PLAN.md +70 -0
- package/extensions/api-server/README.md +103 -0
- package/extensions/api-server/application-log-store.ts +21 -0
- package/extensions/api-server/application-runtime.ts +212 -0
- package/extensions/api-server/application-store.ts +30 -0
- package/extensions/api-server/index.ts +52 -0
- package/extensions/api-server/profile-store.ts +367 -0
- package/extensions/api-server/server.ts +863 -0
- package/extensions/cli-resources.ts +564 -0
- package/extensions/guardrails/index.ts +178 -0
- package/extensions/lib/application-handler-templates.ts +63 -0
- package/extensions/lib/profile-env.ts +61 -0
- package/extensions/lib/profile-sandbox.ts +197 -0
- package/extensions/lib/remote-hosts.ts +392 -0
- package/extensions/pi-console-webui/app/[section]/page.tsx +4 -0
- package/extensions/pi-console-webui/app/api/admin/config/[target]/route.ts +5 -0
- package/extensions/pi-console-webui/app/api/admin/services/[service]/restart/route.ts +5 -0
- package/extensions/pi-console-webui/app/api/auth/login/route.ts +9 -0
- package/extensions/pi-console-webui/app/api/auth/logout/route.ts +3 -0
- package/extensions/pi-console-webui/app/api/message/app/[slug]/route.ts +11 -0
- package/extensions/pi-console-webui/app/api/pi/[...path]/route.ts +31 -0
- package/extensions/pi-console-webui/app/applications/[slug]/page.tsx +2 -0
- package/extensions/pi-console-webui/app/globals.css +41 -0
- package/extensions/pi-console-webui/app/icon.svg +1 -0
- package/extensions/pi-console-webui/app/layout.tsx +5 -0
- package/extensions/pi-console-webui/app/login/page.tsx +11 -0
- package/extensions/pi-console-webui/app/page.tsx +2 -0
- package/extensions/pi-console-webui/app/terminal/page.tsx +4 -0
- package/extensions/pi-console-webui/components/admin-config-form.tsx +16 -0
- package/extensions/pi-console-webui/components/application-handler-editor.tsx +39 -0
- package/extensions/pi-console-webui/components/application-logs.tsx +38 -0
- package/extensions/pi-console-webui/components/application-mappings.tsx +28 -0
- package/extensions/pi-console-webui/components/application-sessions.tsx +11 -0
- package/extensions/pi-console-webui/components/application-settings.tsx +60 -0
- package/extensions/pi-console-webui/components/application-workspace.tsx +14 -0
- package/extensions/pi-console-webui/components/applications.tsx +15 -0
- package/extensions/pi-console-webui/components/chat-workspace.tsx +42 -0
- package/extensions/pi-console-webui/components/console-page.tsx +23 -0
- package/extensions/pi-console-webui/components/console-state.tsx +30 -0
- package/extensions/pi-console-webui/components/console.tsx +115 -0
- package/extensions/pi-console-webui/components/guardrails-panel.tsx +78 -0
- package/extensions/pi-console-webui/components/package-resources.tsx +13 -0
- package/extensions/pi-console-webui/components/pulse-resources.tsx +41 -0
- package/extensions/pi-console-webui/components/skill-resources.tsx +35 -0
- package/extensions/pi-console-webui/components/skill-source-document-preview.tsx +7 -0
- package/extensions/pi-console-webui/components/skill-source-import.tsx +7 -0
- package/extensions/pi-console-webui/components/skill-sources.tsx +12 -0
- package/extensions/pi-console-webui/components/terminal-client.tsx +39 -0
- package/extensions/pi-console-webui/components/toast.tsx +18 -0
- package/extensions/pi-console-webui/components/ui/button.tsx +4 -0
- package/extensions/pi-console-webui/components/ui/card.tsx +4 -0
- package/extensions/pi-console-webui/components/ui/input.tsx +4 -0
- package/extensions/pi-console-webui/components/ui/switch.tsx +6 -0
- package/extensions/pi-console-webui/components/ui/tabs.tsx +11 -0
- package/extensions/pi-console-webui/components.json +8 -0
- package/extensions/pi-console-webui/index.ts +33 -0
- package/extensions/pi-console-webui/lib/admin-config.ts +22 -0
- package/extensions/pi-console-webui/lib/auth.ts +21 -0
- package/extensions/pi-console-webui/lib/config.ts +15 -0
- package/extensions/pi-console-webui/lib/pi-api.ts +9 -0
- package/extensions/pi-console-webui/lib/utils.ts +3 -0
- package/extensions/pi-console-webui/next-env.d.ts +6 -0
- package/extensions/pi-console-webui/next.config.js +5 -0
- package/extensions/pi-console-webui/postcss.config.js +1 -0
- package/extensions/pi-console-webui/tailwind.config.ts +2 -0
- package/extensions/pi-console-webui/tsconfig.json +41 -0
- package/extensions/profiles.ts +439 -0
- package/extensions/pulse/index.ts +62 -0
- package/extensions/pulse/store.ts +105 -0
- package/extensions/sequential-workflow.ts +270 -0
- package/extensions/skill-sources/index.ts +4 -0
- package/extensions/skill-sources/store.ts +118 -0
- package/package.json +89 -0
- package/scripts/install-nono.sh +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Renne Jaskonis
|
|
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,508 @@
|
|
|
1
|
+
# Pi Feats
|
|
2
|
+
|
|
3
|
+
> Production-oriented extensions for [Mario Zechner's Pi Coding Agent](https://github.com/badlogic/pi-mono): profiles, Nono sandboxing, guardrails, HTTP/API access, scheduling, Skills, remote runtimes, and a WebUI.
|
|
4
|
+
|
|
5
|
+
`pi-feats` turns the lightweight, extensible Pi Coding Agent into an operational workspace without replacing Pi's native configuration model. It adds persistent profiles, a policy-controlled sandbox, HTTP and browser interfaces, application runtimes, scheduled work, Git-backed Skill discovery, and command-line administration.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Glossary](#glossary)
|
|
10
|
+
- [Features](#features)
|
|
11
|
+
- [Command cookbook](#command-cookbook)
|
|
12
|
+
- [Included extensions](#included-extensions)
|
|
13
|
+
- [Installation](#installation)
|
|
14
|
+
- [Development](#development)
|
|
15
|
+
- [Security](#security)
|
|
16
|
+
- [Package layout](#package-layout)
|
|
17
|
+
|
|
18
|
+
## Glossary
|
|
19
|
+
|
|
20
|
+
| Term | Meaning |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| **Profile** | An isolated Pi workspace with its own settings, credentials, model state, sessions, `SOUL.md`, and optional local Skills. Extensions and packages remain in the shared default runtime. |
|
|
23
|
+
| **Sandbox** | A Nono policy that constrains a named profile's process, filesystem, network, and credentials. |
|
|
24
|
+
| **Application** | An integration runtime that accepts external payloads, routes them into Pi sessions, and can return an integration-specific response. |
|
|
25
|
+
| **Handler** | TypeScript code owned by one Application. Inbound handlers normalize payloads; outbound handlers shape responses; transforms enrich or modify data. |
|
|
26
|
+
| **Identity Key mapping** | A rule that maps an external identity to an Application profile and session strategy. A single `*` mapping can be an explicit fallback. |
|
|
27
|
+
| **Handoff** | Private context retained when an Application rolls a conversation into a replacement session. |
|
|
28
|
+
| **Guardrail** | An ordered policy instruction executed at an input, tool, or output lifecycle stage. |
|
|
29
|
+
| **Shared Skill** | A Skill stored in the main Pi agent directory and selectively exposed to profiles. |
|
|
30
|
+
| **Profile Skill** | A Skill stored in one profile directory and unavailable to other profiles unless explicitly copied or imported. |
|
|
31
|
+
| **Skill Source** | A Git-backed staging catalog. Synchronizing it discovers Skills but does not activate them. |
|
|
32
|
+
| **Pulse** | A persistent scheduled prompt, reminder, cron job, one-time job, or heartbeat bound to a profile and session. |
|
|
33
|
+
| **Remote Host** | A registered SSH target that runs its own Pi command, profiles, packages, and resources. |
|
|
34
|
+
| **Pi Console WebUI** | The authenticated browser operations cockpit for the API Server, profiles, Applications, Skills, Pulses, logs, and terminal. |
|
|
35
|
+
|
|
36
|
+
## Why Pi Feats?
|
|
37
|
+
|
|
38
|
+
Pi Coding Agent intentionally keeps its core lightweight and extensible. Pi Feats is a distributable extension package for operational and server-side deployments that need capabilities such as:
|
|
39
|
+
|
|
40
|
+
- isolated Pi Agent profiles and policy-controlled Nono sandboxing;
|
|
41
|
+
- guardrails across input, tool, and output stages;
|
|
42
|
+
- an HTTP API and authenticated operations WebUI;
|
|
43
|
+
- scheduled agents, Git-backed Skill distribution, and remote Pi runtimes;
|
|
44
|
+
- application routing for multi-user and integration workloads.
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
### Profiles and sandboxing
|
|
49
|
+
|
|
50
|
+
- Create, delete, list, open, and resume named Pi profiles.
|
|
51
|
+
- Keep profile-scoped settings, credentials, model catalogs, sessions, `SOUL.md`, Skills, and environment variables under `~/.pi/agent/profiles/<profile>/`.
|
|
52
|
+
- Run named profiles through a [Nono](https://github.com/Anthropic/nono) policy while the default profile remains unsandboxed.
|
|
53
|
+
- Preserve native Pi state directly in the profile directory; profiles do not use a disposable credential runtime.
|
|
54
|
+
- Limit profile tools, shared Skills, and profile Skills through profile policy.
|
|
55
|
+
- Keep extensions and packages in the default runtime; named profiles load those shared resources read-only and never clone or install them.
|
|
56
|
+
- Load a profile-specific `SOUL.md` into every agent turn.
|
|
57
|
+
|
|
58
|
+
### Remote Hosts
|
|
59
|
+
|
|
60
|
+
Operate another Pi installation as if its CLI were local. `pi-feats` opens an SSH connection with a remote PTY, then forwards the requested arguments without attempting to resolve remote profiles, packages, models, Skills, or sessions locally. The remote Pi remains authoritative for its own state.
|
|
61
|
+
|
|
62
|
+
- Register host or Docker-container runtimes interactively, including the remote user, SSH authentication, runtime, container, and Pi agent directory.
|
|
63
|
+
- Store the remote agent directory explicitly, avoiding ambiguity between Pi's parent data directory and native `~/.pi/agent` directory.
|
|
64
|
+
- Validate SSH access and the remote Pi command during registration.
|
|
65
|
+
- Use every normal Pi command remotely, including profiles, Skills, resource management, sessions, packages, and an interactive shell.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Register, inspect, and remove a remote host
|
|
69
|
+
pi remote add production
|
|
70
|
+
pi remote list
|
|
71
|
+
pi remote delete production --force
|
|
72
|
+
|
|
73
|
+
# Start the remote default profile or a named profile
|
|
74
|
+
pi remote:production
|
|
75
|
+
pi remote:production profile support
|
|
76
|
+
|
|
77
|
+
# Forward ordinary Pi commands to the remote runtime
|
|
78
|
+
pi remote:production profile support skills list
|
|
79
|
+
pi remote:production profile support skills enable incident-response
|
|
80
|
+
pi remote:production profile support sessions list
|
|
81
|
+
pi remote:production packages list
|
|
82
|
+
|
|
83
|
+
# Open a shell in the selected remote host or container runtime
|
|
84
|
+
pi remote:production bash
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
This makes a central workstation useful for operating multiple Pi environments without copying their credentials or resource catalogs to the local machine.
|
|
88
|
+
|
|
89
|
+
### Applications and handlers
|
|
90
|
+
|
|
91
|
+
Applications are the integration boundary between Pi and external systems. Use one when a webhook, chat platform, business system, queue consumer, or custom service needs to turn inbound data into a durable Pi conversation and optionally return a response. An Application owns its routing and code; it does not depend structurally on an adapter.
|
|
92
|
+
|
|
93
|
+
- Create independent Applications with their own settings, identity-key mappings, active sessions, logs, rollover, and handoff state.
|
|
94
|
+
- Store each Application separately at:
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
~/.pi/agent/applications/<application-slug>/
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- Create an `inbound.ts` handler automatically with every new Application.
|
|
101
|
+
- Keep application handlers isolated per Application:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
handlers/inbound.ts
|
|
105
|
+
handlers/outbound.ts
|
|
106
|
+
handlers/transforms/<name>.ts
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- Normalize provider-specific payloads in an inbound handler, enrich or redact data through transforms, and shape integration responses in an outbound handler.
|
|
110
|
+
- Route each external identity to a profile and session strategy through explicit Identity Key mappings. Mappings may use automatic sessions or fixed prefixes; one `*` wildcard can serve as a deliberate fallback.
|
|
111
|
+
- Choose acknowledgement mode for asynchronous webhook-style work or result mode when an integration needs the completed response.
|
|
112
|
+
- Inspect active sessions, roll over a conversation, preserve private handoff context, test handlers with a JSON payload, and stream or clear application logs from the Console or API.
|
|
113
|
+
- Include an Evolution API adapter implementation while keeping Applications structurally independent from adapters.
|
|
114
|
+
|
|
115
|
+
Create and operate Applications from the **Applications** workspace in the Console, or automate them through the API:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Create an integration boundary
|
|
119
|
+
curl -X POST \
|
|
120
|
+
-H "Authorization: Bearer $PI_API_TOKEN" \
|
|
121
|
+
-H "Content-Type: application/json" \
|
|
122
|
+
-d '{"name":"Support Inbox","slug":"support-inbox","defaultProfile":"support","responseMode":"ack"}' \
|
|
123
|
+
http://127.0.0.1:8767/api/applications
|
|
124
|
+
|
|
125
|
+
# Inspect its generated handlers
|
|
126
|
+
curl -H "Authorization: Bearer $PI_API_TOKEN" \
|
|
127
|
+
http://127.0.0.1:8767/api/applications/support-inbox/handlers
|
|
128
|
+
|
|
129
|
+
# Deliver an integration payload to an enabled Application
|
|
130
|
+
curl -X POST \
|
|
131
|
+
-H "Content-Type: application/json" \
|
|
132
|
+
-d '{"message":"A customer needs help with an order."}' \
|
|
133
|
+
http://127.0.0.1:8767/api/message/app/support-inbox
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### API Server
|
|
137
|
+
|
|
138
|
+
The API Server is the automation and integration surface for Pi. It turns the same persistent profiles and sessions used in the terminal into an authenticated HTTP service, enabling WebUI administration, external applications, webhooks, and programmatic chat without inventing a second state model.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Start, inspect, restart, and stop the service
|
|
142
|
+
pi api start
|
|
143
|
+
pi api status
|
|
144
|
+
pi api restart
|
|
145
|
+
pi api stop
|
|
146
|
+
|
|
147
|
+
# Read the generated bearer token
|
|
148
|
+
export PI_API_TOKEN="$(jq -r '.apiToken' ~/.pi/agent/api-server.json)"
|
|
149
|
+
|
|
150
|
+
# Check service health
|
|
151
|
+
curl http://127.0.0.1:8767/api/health
|
|
152
|
+
|
|
153
|
+
# Send an authenticated message to a persistent session
|
|
154
|
+
curl \
|
|
155
|
+
-H "Authorization: Bearer $PI_API_TOKEN" \
|
|
156
|
+
-H "Content-Type: application/json" \
|
|
157
|
+
-d '{"message":"Summarize the current incident."}' \
|
|
158
|
+
http://127.0.0.1:8767/api/sessions/incident/chat
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
What the API exposes:
|
|
162
|
+
|
|
163
|
+
- Persistent chat and streaming chat sessions, including profile-specific sessions.
|
|
164
|
+
- Profile lifecycle, settings, `SOUL.md`, environment variables, Guardrails, tools, Skills, and sessions.
|
|
165
|
+
- Runtime-wide extension and package inventory and configuration.
|
|
166
|
+
- Pulse schedules and execution history.
|
|
167
|
+
- Git-backed Skill Sources, document preview, synchronization, and explicit profile imports.
|
|
168
|
+
- Applications, handler source files, transform tests, identity-key mappings, active sessions, rollover, handoff, and live logs.
|
|
169
|
+
- Secure terminal and application-log WebSocket tickets that expire quickly and are consumed once.
|
|
170
|
+
|
|
171
|
+
The service generates and stores its bearer token in `api-server.json`, supports host, port, CORS, and public-base-URL configuration, rejects concurrent work on the same session, and keeps process state and logs in the Pi agent directory.
|
|
172
|
+
|
|
173
|
+
### Pi Console WebUI and terminal
|
|
174
|
+
|
|
175
|
+
The Pi Console WebUI is an operations cockpit, not merely a settings page. It gives administrators a visual way to operate the same runtime exposed by the CLI and API: inspect activity, configure profiles, edit application handlers, manage schedules, examine logs, and open a real terminal when direct command-line access is needed.
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Start, inspect, restart, and stop the WebUI
|
|
179
|
+
pi console start
|
|
180
|
+
pi console status
|
|
181
|
+
pi console restart
|
|
182
|
+
pi console stop
|
|
183
|
+
|
|
184
|
+
# Default local address
|
|
185
|
+
# http://127.0.0.1:3030
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The console provides dedicated workspaces for:
|
|
189
|
+
|
|
190
|
+
- **Profiles:** settings, environment, `SOUL.md`, Guardrails, tools, Skills, and sessions. Extensions and packages are shown and managed as shared runtime resources.
|
|
191
|
+
- **Applications:** configuration, identity mappings, active sessions, handler editor, transform testing, rollover, handoff, and live logs.
|
|
192
|
+
- **Skill Sources:** source registration, Git synchronization, Skill preview, and deliberate import into a profile.
|
|
193
|
+
- **Pulse:** schedules, enablement, run history, and profile/session association.
|
|
194
|
+
- **Operations:** API Server and Console configuration, service controls, and resource visibility.
|
|
195
|
+
- **Terminal:** an authenticated browser terminal connected to a server-side PTY. A short-lived, single-use ticket protects the WebSocket; closing the browser session terminates its PTY.
|
|
196
|
+
|
|
197
|
+
The Console uses visible form labels, modal editing, explicit destructive-action confirmation, and temporary toast feedback so administrative changes remain understandable and deliberate.
|
|
198
|
+
|
|
199
|
+
### Guardrails
|
|
200
|
+
|
|
201
|
+
Guardrails apply model-driven policy at defined points in the Pi lifecycle. They can normalize unsafe input, block a risky tool action, inspect tool output, or ensure a final answer meets an operational or compliance requirement. Guardrail instructions are reusable Markdown documents, while each profile chooses which ordered rules are enabled.
|
|
202
|
+
|
|
203
|
+
- Define ordered Guardrails for the `input`, `pre_tool`, `post_tool`, and `output` stages.
|
|
204
|
+
- Use **transform** to rewrite content, **evaluate** to allow or deny it, and **reflect** to ask Pi to continue with corrective instructions.
|
|
205
|
+
- Apply profile-specific configuration from `guardrails.json`, with shared instruction documents stored in `~/.pi/agent/guardrails/`.
|
|
206
|
+
- Preserve ordering within a stage, allowing small focused policies to compose predictably.
|
|
207
|
+
- Manage rules from the Console or validate, inspect, enable, and disable them from the CLI.
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"guardrails": [
|
|
212
|
+
{
|
|
213
|
+
"name": "sensitive-output",
|
|
214
|
+
"stage": "output",
|
|
215
|
+
"mode": "evaluate",
|
|
216
|
+
"order": 10,
|
|
217
|
+
"file": "sensitive-output.md",
|
|
218
|
+
"enabled": true
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
pi guardrails list
|
|
226
|
+
pi guardrails validate
|
|
227
|
+
pi profile support guardrails disable sensitive-output
|
|
228
|
+
pi profile support guardrails enable sensitive-output
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Shared Skills, profile Skills, and Skill Sources
|
|
232
|
+
|
|
233
|
+
Skills remain explicit resources rather than hidden package behavior. A profile can use shared Skills from the main Pi agent directory, Skills stored only within that profile, or both. This lets teams provide a curated common capability set while letting a restricted profile expose only the instructions it needs.
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
~/.pi/agent/skills/<skill>/SKILL.md
|
|
237
|
+
~/.pi/agent/profiles/<profile>/skills/<skill>/SKILL.md
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
- **Shared Skills** are centrally maintained under `~/.pi/agent/skills/` and can be selectively exposed to each profile.
|
|
241
|
+
- **Profile Skills** live under `~/.pi/agent/profiles/<profile>/skills/` and remain isolated from other profiles.
|
|
242
|
+
- Profile policy controls whether shared and profile-local sources are available and can allow all Skills or a named allowlist.
|
|
243
|
+
- List and enable or disable Skills from the CLI and Console without editing settings by hand.
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Inspect the default or a selected profile
|
|
247
|
+
pi skills list
|
|
248
|
+
pi profile support skills list
|
|
249
|
+
|
|
250
|
+
# Control a profile-local or shared Skill according to profile policy
|
|
251
|
+
pi profile support skills enable incident-response
|
|
252
|
+
pi profile support skills disable experimental-tooling
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Skill Sources** are Git-backed catalogs, intentionally separated from active Skills. Synchronizing a source only downloads and indexes its available `SKILL.md` documents; it does not give new instructions to any profile. An administrator must preview a Skill and explicitly import it into the selected profile through the Console or API. This staging model prevents a repository update from silently changing agent behavior.
|
|
256
|
+
|
|
257
|
+
A Skill Source records its repository URL, branch, optional base path, and optional credentials. The Console provides the complete workflow: register source, synchronize it, browse and preview documents, import a selected Skill, or publish a local Skill to a writable source. Publishing copies the complete Skill directory, commits and pushes it, then synchronizes the catalog. Imported Skills retain their source-relative path; a same-name Skill at a different path is rejected rather than overwritten.
|
|
258
|
+
|
|
259
|
+
```text
|
|
260
|
+
POST /api/profiles/:profile/skills/from-source/:identifier/:name
|
|
261
|
+
POST /api/profiles/:profile/skills/:name/publish?source=shared|profile
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Publishing requires an enabled Skill Source with a write credential. Shared Skills can only be published through the default profile; profile-local Skills can only be published through their owning profile. An installed Skill can also be refreshed from its recorded source through:
|
|
265
|
+
|
|
266
|
+
```text
|
|
267
|
+
POST /api/profiles/:profile/skills/:name/sync?source=shared|profile
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Refreshing synchronizes the source and atomically replaces the complete installed Skill directory; local changes to that Skill are discarded.
|
|
271
|
+
|
|
272
|
+
### Pulse scheduling
|
|
273
|
+
|
|
274
|
+
- Create and manage persistent scheduled prompts, reminders, cron jobs, one-time jobs, and heartbeat jobs.
|
|
275
|
+
- Bind scheduled work to the active profile and conversation session.
|
|
276
|
+
- Persist schedules and execution history in SQLite with WAL support.
|
|
277
|
+
- Start and inspect the scheduler:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
pi pulse start
|
|
281
|
+
pi pulse status
|
|
282
|
+
pi pulse list
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### CLI resource management
|
|
286
|
+
|
|
287
|
+
- Inspect tools, Skills, extensions, sessions, packages, and profile resources from the terminal.
|
|
288
|
+
- Enable and disable resources without editing JSON by hand.
|
|
289
|
+
- Manage named profiles consistently with `pi profile <name> [pi arguments]`.
|
|
290
|
+
- Preserve profile session isolation while supporting session listing, opening, renaming, and resume workflows.
|
|
291
|
+
|
|
292
|
+
### Sequential Workflow
|
|
293
|
+
|
|
294
|
+
- Create persistent workflows made of strictly ordered **Action**, **Collect**, and **Evaluate** tasks.
|
|
295
|
+
- Prevent advancement until the current task result has been recorded and accepted.
|
|
296
|
+
- Persist workflow state in SQLite for auditable retries and continuation.
|
|
297
|
+
|
|
298
|
+
## Command cookbook
|
|
299
|
+
|
|
300
|
+
The following commands are the operational entry points added by `pi-feats`. Commands can target the default profile, a named local profile, or a remote host.
|
|
301
|
+
|
|
302
|
+
### Profiles
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Inspect and manage profiles
|
|
306
|
+
pi profile list
|
|
307
|
+
pi profile create support
|
|
308
|
+
pi profile delete support --force
|
|
309
|
+
|
|
310
|
+
# Start a profile interactively
|
|
311
|
+
pi profile support
|
|
312
|
+
|
|
313
|
+
# Run a normal Pi command inside a profile
|
|
314
|
+
pi profile support tools list
|
|
315
|
+
pi profile support skills list
|
|
316
|
+
pi profile support skills enable incident-response
|
|
317
|
+
pi profile support tools disable bash
|
|
318
|
+
pi profile support extensions list
|
|
319
|
+
pi profile support sessions list
|
|
320
|
+
pi profile support packages list
|
|
321
|
+
|
|
322
|
+
# Resume the latest session or open a specific one
|
|
323
|
+
pi profile resume support
|
|
324
|
+
pi profile open support <session-id>
|
|
325
|
+
# Equivalent profile-first forms, convenient after `sessions list`
|
|
326
|
+
pi profile support resume
|
|
327
|
+
pi profile support resume <session-id>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Resources, packages, and sessions
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
# Inspect default-profile resources
|
|
334
|
+
pi tools list
|
|
335
|
+
pi skills list
|
|
336
|
+
pi extensions list
|
|
337
|
+
pi packages list
|
|
338
|
+
pi sessions list
|
|
339
|
+
|
|
340
|
+
# Change resource availability and reload an active interactive Pi session
|
|
341
|
+
pi tools disable bash
|
|
342
|
+
pi tools enable bash
|
|
343
|
+
pi skills disable my-skill
|
|
344
|
+
pi skills enable my-skill
|
|
345
|
+
pi extensions disable my-extension
|
|
346
|
+
pi extensions enable my-extension
|
|
347
|
+
|
|
348
|
+
# Enable or disable an installed package for the selected profile
|
|
349
|
+
pi packages disable npm:some-package
|
|
350
|
+
pi packages enable npm:some-package
|
|
351
|
+
|
|
352
|
+
# Rename a saved session
|
|
353
|
+
pi sessions rename <session-id> "Incident investigation"
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Guardrails, Pulse, API, and Console
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# Validate and inspect Guardrails
|
|
360
|
+
pi guardrails list
|
|
361
|
+
pi guardrails validate
|
|
362
|
+
pi guardrails disable sensitive-output
|
|
363
|
+
pi guardrails enable sensitive-output
|
|
364
|
+
|
|
365
|
+
# Operate the persistent scheduler
|
|
366
|
+
pi pulse start
|
|
367
|
+
pi pulse status
|
|
368
|
+
pi pulse list
|
|
369
|
+
pi pulse disable daily-report
|
|
370
|
+
pi pulse enable daily-report
|
|
371
|
+
pi pulse stop
|
|
372
|
+
|
|
373
|
+
# Operate the HTTP API
|
|
374
|
+
pi api start
|
|
375
|
+
pi api status
|
|
376
|
+
pi api restart
|
|
377
|
+
pi api stop
|
|
378
|
+
|
|
379
|
+
# Operate the browser console
|
|
380
|
+
pi console start
|
|
381
|
+
pi console status
|
|
382
|
+
pi console restart
|
|
383
|
+
pi console stop
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Remote operation
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
# Register and inspect remote Pi installations
|
|
390
|
+
pi remote add production
|
|
391
|
+
pi remote list
|
|
392
|
+
|
|
393
|
+
# Use remote Pi exactly as a local Pi
|
|
394
|
+
pi remote:production profile support
|
|
395
|
+
pi remote:production profile support tools list
|
|
396
|
+
pi remote:production profile support skills list
|
|
397
|
+
pi remote:production profile support skills enable incident-response
|
|
398
|
+
pi remote:production profile support sessions list
|
|
399
|
+
pi remote:production packages list
|
|
400
|
+
pi remote:production bash
|
|
401
|
+
|
|
402
|
+
# Remove a remote registration and its locally stored password, if any
|
|
403
|
+
pi remote delete production --force
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
The `remote:<name>` form forwards the rest of the command to the selected remote host or container. It never reinterprets the remote profile or resources locally.
|
|
407
|
+
|
|
408
|
+
## Included extensions
|
|
409
|
+
|
|
410
|
+
| Extension | Responsibility |
|
|
411
|
+
| --- | --- |
|
|
412
|
+
| API Server | HTTP API, Applications, profile administration, sessions, logs, and terminal tickets. |
|
|
413
|
+
| CLI Resources | Resource, package, session, and profile commands. |
|
|
414
|
+
| Guardrails | Input, tool, and output policy stages. |
|
|
415
|
+
| Pi Console WebUI | Browser-based operations console and terminal client. |
|
|
416
|
+
| Profiles | Profile lifecycle, policy, sandbox, and remote routing. |
|
|
417
|
+
| Pulse | Persistent schedule and heartbeat execution. |
|
|
418
|
+
| Sequential Workflow | Ordered Action, Collect, and Evaluate workflows. |
|
|
419
|
+
| Skill Sources | Git-backed Skill source catalog and explicit imports. |
|
|
420
|
+
|
|
421
|
+
## Installation
|
|
422
|
+
|
|
423
|
+
Install the latest published package:
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
pi install npm:pi-feats
|
|
427
|
+
pi list
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Git installation remains available when you need the current default branch or an unreleased commit:
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
pi install git:github.com/rjaskonis/pi-feats
|
|
434
|
+
pi list
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
For local development:
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
pi install /absolute/path/to/pi-feats
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
Package operations follow normal Pi commands:
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
pi list
|
|
447
|
+
pi config
|
|
448
|
+
pi update --extensions
|
|
449
|
+
pi remove npm:pi-feats
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
Pi records installed packages in `~/.pi/agent/settings.json`. To pin a production installation, select an exact npm version or a Git ref:
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
pi install npm:pi-feats@<version>
|
|
456
|
+
pi install git:github.com/rjaskonis/pi-feats@<tag-or-commit>
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Pi does not advance a pinned version or Git ref during a generic package update.
|
|
460
|
+
|
|
461
|
+
## Development
|
|
462
|
+
|
|
463
|
+
Requirements:
|
|
464
|
+
|
|
465
|
+
- Node.js 22 or later
|
|
466
|
+
- A working Pi installation
|
|
467
|
+
- `curl` when Nono is not already installed
|
|
468
|
+
|
|
469
|
+
The package `postinstall` script installs Nono automatically when it is missing. Nono is required only for sandboxed Profiles. If a Profile operation still finds Nono unavailable, it asks for confirmation before downloading the official installer; non-interactive runs instead show the manual installation command.
|
|
470
|
+
|
|
471
|
+
Install dependencies and build the WebUI:
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
npm install
|
|
475
|
+
npm run build:web
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
The root `package.json` is the package manifest. Its `pi.extensions` field explicitly exports every extension; the package does not rely on directory auto-discovery.
|
|
479
|
+
|
|
480
|
+
## Security
|
|
481
|
+
|
|
482
|
+
This package executes code with the permissions of the Pi process. Review and pin the source before installing it in production.
|
|
483
|
+
|
|
484
|
+
- The API Server and Console use bearer-token authentication; do not expose them publicly without an appropriate reverse proxy, TLS, network policy, and restrictive CORS configuration.
|
|
485
|
+
- Remote Hosts use SSH. Configure host authentication outside of sandboxed profiles; profile sandboxes intentionally exclude the host SSH agent and private SSH credentials.
|
|
486
|
+
- Applications, handlers, extensions, and imported Skills are executable code or agent instructions. Treat them as trusted administrative resources.
|
|
487
|
+
- Skill Source synchronization is intentionally separated from import so a Git update cannot silently activate new Skills.
|
|
488
|
+
|
|
489
|
+
## Package layout
|
|
490
|
+
|
|
491
|
+
```text
|
|
492
|
+
pi-feats/
|
|
493
|
+
├── package.json # Pi package manifest and runtime dependencies
|
|
494
|
+
├── extensions/
|
|
495
|
+
│ ├── api-server/ # API, Applications, terminal, and profile services
|
|
496
|
+
│ ├── guardrails/ # Guardrail extension
|
|
497
|
+
│ ├── pi-console-webui/ # Next.js Console WebUI
|
|
498
|
+
│ ├── pulse/ # Scheduler and SQLite store
|
|
499
|
+
│ ├── skill-sources/ # Skill Source extension and store
|
|
500
|
+
│ ├── cli-resources.ts
|
|
501
|
+
│ ├── profiles.ts
|
|
502
|
+
│ └── sequential-workflow.ts
|
|
503
|
+
└── README.md
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
## License
|
|
507
|
+
|
|
508
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# pi-feats extensions
|
|
2
|
+
|
|
3
|
+
This directory contains the Pi extensions exported by the `pi-feats` package. They are loaded through the root `package.json` manifest; do not add these paths separately to `settings.json` after installing the package.
|
|
4
|
+
|
|
5
|
+
## Included extensions
|
|
6
|
+
|
|
7
|
+
| Extension | Location | Purpose |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| API Server | [`api-server/`](api-server/) | HTTP API, Applications runtime, application sessions, handlers, logs, and profile administration. |
|
|
10
|
+
| CLI Resources | [`cli-resources.ts`](cli-resources.ts) | CLI resource, session, package, and profile management. |
|
|
11
|
+
| Guardrails | [`guardrails/`](guardrails/) | Configurable input, tool, and output guardrails. |
|
|
12
|
+
| Pi Console WebUI | [`pi-console-webui/`](pi-console-webui/) | Browser-based operations console and terminal. |
|
|
13
|
+
| Profiles | [`profiles.ts`](profiles.ts) | Persistent profiles, sandbox policies, and remote command routing. |
|
|
14
|
+
| Pulse | [`pulse/`](pulse/) | Scheduled and persistent Pulse jobs. |
|
|
15
|
+
| Sequential Workflow | [`sequential-workflow.ts`](sequential-workflow.ts) | Strict Action, Collect, and Evaluate workflows. |
|
|
16
|
+
| Skill Sources | [`skill-sources/`](skill-sources/) | Git-backed Skill source synchronization and explicit imports. |
|
|
17
|
+
|
|
18
|
+
## Development
|
|
19
|
+
|
|
20
|
+
Dependencies are declared at the package root. From the repository root, run:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install
|
|
24
|
+
npm run build:web
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
See the root [README](../README.md) for installation instructions.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Plan: Pi HTTP API
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Provide a multi-session, multi-profile HTTP API through the pi SDK while reusing the CLI's persistent environment: settings, auth, models, extensions, tools, skills, prompts, context files, and session storage.
|
|
6
|
+
|
|
7
|
+
## Decisions
|
|
8
|
+
|
|
9
|
+
- Install as `~/.pi/agent/extensions/api-server/`.
|
|
10
|
+
- Use an extension entrypoint to control a standalone SDK worker.
|
|
11
|
+
- Commands: `pi api start`, `pi api stop`, and `pi api status`.
|
|
12
|
+
- Default listener: `0.0.0.0:8767`.
|
|
13
|
+
- Generate and persist `apiToken` in `api-server.json` when absent.
|
|
14
|
+
- Require `Authorization: Bearer <apiToken>` on all routes except `GET /api/health`.
|
|
15
|
+
- Enable CORS with origin `*` by default.
|
|
16
|
+
- `/chat` returns one complete JSON response.
|
|
17
|
+
- `/chat/stream` returns SSE events.
|
|
18
|
+
|
|
19
|
+
## API
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
GET /api/health
|
|
23
|
+
POST /api/sessions/{sessionId}/chat
|
|
24
|
+
POST /api/sessions/{sessionId}/chat/stream
|
|
25
|
+
POST /profile/{profileName}/api/sessions/{sessionId}/chat
|
|
26
|
+
POST /profile/{profileName}/api/sessions/{sessionId}/chat/stream
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The request body is:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{ "message": "Text sent to pi" }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Errors use:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{ "error": { "code": "SESSION_BUSY", "message": "The session is already processing a request." } }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Profiles and sessions
|
|
42
|
+
|
|
43
|
+
- `default` uses the standard CLI `agentDir` and session storage.
|
|
44
|
+
- Named profiles use the same `profiles/{profileName}` directories used by `profiles.ts`.
|
|
45
|
+
- Session files created through the API are opened by the CLI with the same session ID.
|
|
46
|
+
- The SDK uses `DefaultResourceLoader`, `SettingsManager`, `ModelRuntime`, and `SessionManager` against those same directories.
|
|
47
|
+
- Different sessions execute concurrently; a second request to an active session returns `409 SESSION_BUSY`.
|
|
48
|
+
- Profile bootstrap is serialized only while extensions load and capture profile-specific environment values. Agent execution remains concurrent.
|
|
49
|
+
|
|
50
|
+
## Security
|
|
51
|
+
|
|
52
|
+
- Use constant-time Bearer-token comparison.
|
|
53
|
+
- Never accept the token in a query string.
|
|
54
|
+
- Limit request bodies to 1 MiB.
|
|
55
|
+
- Do not expose stack traces, prompts, tokens, or full responses in standard logs.
|
|
56
|
+
- Implement CORS preflight through `OPTIONS`.
|
|
57
|
+
|
|
58
|
+
## Runtime lifecycle
|
|
59
|
+
|
|
60
|
+
`start` initializes configuration, starts the detached SDK worker, and stores PID metadata. `stop` terminates its process group. `status` reports worker PID, host, and port.
|
|
61
|
+
|
|
62
|
+
## Acceptance criteria
|
|
63
|
+
|
|
64
|
+
1. CLI commands start, stop, and report the server.
|
|
65
|
+
2. API configuration and token persist in the CLI `settings.json`.
|
|
66
|
+
3. Health is public; other routes require Bearer authentication.
|
|
67
|
+
4. Complete and SSE chat endpoints work.
|
|
68
|
+
5. API-created sessions are resumable by the CLI.
|
|
69
|
+
6. CLI-configured extensions, tools, skills, prompts, and context are available to API sessions.
|
|
70
|
+
7. Sessions and profiles remain isolated while different sessions run in parallel.
|