pi-better-harness 0.63.6 → 0.64.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/CHANGELOG.md +7 -0
- package/README.md +56 -41
- package/extensions/harness-instructions/index.ts +4 -1
- package/extensions/minimal-output/index.ts +5 -2
- package/extensions/recap/index.ts +5 -2
- package/extensions/settings/commands.ts +193 -0
- package/extensions/settings/copy.ts +2 -2
- package/extensions/settings/index.ts +79 -73
- package/extensions/settings/menu.ts +45 -48
- package/extensions/settings/page.ts +14 -8
- package/extensions/settings/registry.ts +4 -2
- package/extensions/supervisor/index.ts +4 -1
- package/extensions/task-context/dynamic-workflow-runtime.ts +1 -1
- package/extensions/task-context/index.ts +11 -8
- package/extensions/tool-call-guard/index.ts +2 -0
- package/lib/console-catalog.mjs +52 -7
- package/lib/console-ui.mjs +52 -2
- package/lib/prompt-tools.mjs +34 -13
- package/lib/prompt-tui.mjs +1 -1
- package/lib/prompt-ui.mjs +1 -1
- package/lib/prompt-web.mjs +9 -1
- package/lib/prompt.css +6 -0
- package/node_modules/pi-better-background-tasks/README.md +4 -4
- package/node_modules/pi-better-background-tasks/package.json +5 -3
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-arm64.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-x64.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-arm64.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-x64.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/win32-x64.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/scripts/private-runtime/format.mjs +18 -9
- package/node_modules/pi-better-background-tasks/runtime-client/src/daemon-owner.mjs +12 -1
- package/node_modules/pi-better-background-tasks/runtime-client/src/runtime/client.mjs +5 -15
- package/node_modules/pi-better-background-tasks/runtime-client/src/runtime/root.mjs +21 -2
- package/node_modules/pi-better-background-tasks/runtime-client/src/runtime/socket.mjs +1 -9
- package/node_modules/pi-better-background-tasks/runtime-client/src/runtime/windows-native.mjs +350 -0
- package/node_modules/pi-better-background-tasks/runtime-client/src/runtime/work-client.mjs +16 -2
- package/node_modules/pi-better-background-tasks/runtime-client/src/startup/artifact.mjs +6 -1
- package/node_modules/pi-better-background-tasks/runtime-client/src/startup/install.mjs +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/src/startup/stage-local.mjs +157 -0
- package/node_modules/pi-better-background-tasks/src/index.ts +2 -0
- package/node_modules/pi-better-background-tasks/src/managed-authority.ts +3 -2
- package/node_modules/pi-better-background-tasks/src/managed-client.ts +4 -2
- package/node_modules/pi-better-background-tasks/src/observed-waits.ts +3 -2
- package/node_modules/pi-better-background-tasks/src/output.ts +1 -1
- package/node_modules/pi-better-background-tasks/src/process-identity.ts +5 -3
- package/node_modules/pi-better-background-tasks/src/registry.ts +1 -1
- package/node_modules/pi-better-background-tasks/src/sandbox.ts +9 -9
- package/node_modules/pi-better-background-tasks/src/shared-harness-commands.ts +194 -0
- package/node_modules/pi-better-background-tasks/src/shared-harness-copy.ts +75 -0
- package/node_modules/pi-better-background-tasks/src/shared-harness-menu.ts +124 -0
- package/node_modules/pi-better-background-tasks/src/shared-harness-page.ts +145 -0
- package/node_modules/pi-better-background-tasks/src/shared-harness-registry.ts +49 -0
- package/node_modules/pi-better-background-tasks/src/shared-sandbox-core.ts +1 -1
- package/node_modules/pi-better-background-tasks/src/shared-windows-native.mjs +350 -0
- package/node_modules/pi-better-background-tasks/src/shared-work-client.mjs +16 -2
- package/node_modules/pi-better-background-tasks/src/supervisor/emit-runner.mjs +2 -1
- package/node_modules/pi-better-background-tasks/src/supervisor/generated/process-identity.mjs +6 -3
- package/node_modules/pi-better-background-tasks/src/supervisor/generated/runner.mjs +38 -9
- package/node_modules/pi-better-background-tasks/src/supervisor/generated/shared-windows-native.mjs +355 -0
- package/node_modules/pi-better-background-tasks/src/supervisor/runner.ts +32 -8
- package/node_modules/pi-better-background-tasks/src/supervisor/supervisor.ts +3 -1
- package/node_modules/pi-better-background-tasks/src/task-diagnostics.ts +1 -1
- package/node_modules/pi-better-background-tasks/src/work-observation.ts +2 -1
- package/node_modules/pi-better-goal/README.md +1 -1
- package/node_modules/pi-better-goal/package.json +1 -1
- package/node_modules/pi-better-goal/src/index.ts +12 -2
- package/node_modules/pi-better-goal/src/shared-harness-commands.ts +194 -0
- package/node_modules/pi-better-goal/src/shared-harness-copy.ts +75 -0
- package/node_modules/pi-better-goal/src/shared-harness-menu.ts +124 -0
- package/node_modules/pi-better-goal/src/shared-harness-page.ts +145 -0
- package/node_modules/pi-better-goal/src/shared-harness-registry.ts +49 -0
- package/node_modules/pi-better-sandbox/README.md +29 -29
- package/node_modules/pi-better-sandbox/commands.ts +27 -27
- package/node_modules/pi-better-sandbox/deny-rules.ts +5 -5
- package/node_modules/pi-better-sandbox/diagnostics-command.ts +1 -1
- package/node_modules/pi-better-sandbox/files.ts +1 -1
- package/node_modules/pi-better-sandbox/index.ts +8 -5
- package/node_modules/pi-better-sandbox/package.json +1 -1
- package/node_modules/pi-better-sandbox/policy.ts +1 -1
- package/node_modules/pi-better-sandbox/rules-page.ts +3 -3
- package/node_modules/pi-better-sandbox/shared-harness-commands.ts +194 -0
- package/node_modules/pi-better-sandbox/shared-harness-copy.ts +75 -0
- package/node_modules/pi-better-sandbox/shared-harness-menu.ts +124 -0
- package/node_modules/pi-better-sandbox/shared-harness-page.ts +145 -0
- package/node_modules/pi-better-sandbox/shared-harness-registry.ts +49 -0
- package/node_modules/pi-better-sandbox/shared-sandbox-core.ts +1 -1
- package/node_modules/pi-better-sandbox/shared-task-exec.ts +2 -2
- package/node_modules/pi-better-sandbox/shared-task-process-list.ts +1 -1
- package/node_modules/pi-better-sandbox/shell.ts +1 -1
- package/node_modules/pi-better-sandbox/state.ts +6 -6
- package/node_modules/pi-better-sandbox/status.ts +2 -2
- package/node_modules/pi-better-ssh/README.md +1 -1
- package/node_modules/pi-better-subagents/README.md +4 -4
- package/node_modules/pi-better-subagents/agent-commands.ts +11 -11
- package/node_modules/pi-better-subagents/agents-catalog-tool.ts +2 -2
- package/node_modules/pi-better-subagents/catalog-host-admission.ts +2 -1
- package/node_modules/pi-better-subagents/child-operations.ts +3 -2
- package/node_modules/pi-better-subagents/child-runtime.mjs +1 -0
- package/node_modules/pi-better-subagents/docs/agent-catalog-acceptance.md +2 -2
- package/node_modules/pi-better-subagents/docs/agent-catalog-lifecycle.md +2 -2
- package/node_modules/pi-better-subagents/docs/agent-catalog-operations.md +8 -8
- package/node_modules/pi-better-subagents/docs/agent-catalog.md +3 -3
- package/node_modules/pi-better-subagents/docs/agent-model-resolution.md +1 -1
- package/node_modules/pi-better-subagents/docs/usage.md +6 -6
- package/node_modules/pi-better-subagents/health.ts +3 -1
- package/node_modules/pi-better-subagents/index.ts +9 -6
- package/node_modules/pi-better-subagents/launch-abort.ts +2 -1
- package/node_modules/pi-better-subagents/managed-launch-client.ts +5 -4
- package/node_modules/pi-better-subagents/managed-launch-host.ts +3 -2
- package/node_modules/pi-better-subagents/managed-worker-bridge.ts +6 -4
- package/node_modules/pi-better-subagents/operation-bridge-types.ts +14 -4
- package/node_modules/pi-better-subagents/package.json +3 -3
- package/node_modules/pi-better-subagents/process-identity.mjs +2 -0
- package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-arm64.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-x64.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-arm64.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-x64.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/artifacts/win32-x64.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/scripts/private-runtime/format.mjs +18 -9
- package/node_modules/pi-better-subagents/runtime-client/src/daemon-owner.mjs +12 -1
- package/node_modules/pi-better-subagents/runtime-client/src/runtime/client.mjs +5 -15
- package/node_modules/pi-better-subagents/runtime-client/src/runtime/root.mjs +21 -2
- package/node_modules/pi-better-subagents/runtime-client/src/runtime/socket.mjs +1 -9
- package/node_modules/pi-better-subagents/runtime-client/src/runtime/windows-native.mjs +350 -0
- package/node_modules/pi-better-subagents/runtime-client/src/runtime/work-client.mjs +16 -2
- package/node_modules/pi-better-subagents/runtime-client/src/startup/artifact.mjs +6 -1
- package/node_modules/pi-better-subagents/runtime-client/src/startup/install.mjs +1 -1
- package/node_modules/pi-better-subagents/runtime-client/src/startup/stage-local.mjs +157 -0
- package/node_modules/pi-better-subagents/sandbox.ts +1 -1
- package/node_modules/pi-better-subagents/settings-page.ts +2 -2
- package/node_modules/pi-better-subagents/shared-catalog.ts +4 -4
- package/node_modules/pi-better-subagents/shared-harness-commands.ts +194 -0
- package/node_modules/pi-better-subagents/shared-harness-copy.ts +75 -0
- package/node_modules/pi-better-subagents/shared-harness-menu.ts +124 -0
- package/node_modules/pi-better-subagents/shared-harness-page.ts +145 -0
- package/node_modules/pi-better-subagents/shared-harness-registry.ts +49 -0
- package/node_modules/pi-better-subagents/shared-sandbox-core.ts +1 -1
- package/node_modules/pi-better-subagents/shared-task-exec.ts +2 -2
- package/node_modules/pi-better-subagents/shared-task-process-list.ts +1 -1
- package/node_modules/pi-better-subagents/shared-windows-native.d.mts +22 -0
- package/node_modules/pi-better-subagents/shared-windows-native.mjs +350 -0
- package/node_modules/pi-better-subagents/shared-work-client.d.mts +1 -0
- package/node_modules/pi-better-subagents/shared-work-client.mjs +16 -2
- package/node_modules/pi-better-subagents/spawn.ts +2 -1
- package/node_modules/pi-better-subagents/stop.ts +7 -2
- package/node_modules/pi-better-subagents/subagent-tools.ts +1 -1
- package/node_modules/pi-better-subagents/work-observation.ts +2 -2
- package/node_modules/pi-better-subagents/worker-operations-host.ts +16 -6
- package/node_modules/pi-better-subagents/worker-waits.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.64.0] - 2026-12-04
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Open the tabbed settings menu with `/harness-settings` or `/better-harness-settings`. The direct `/goal` and `/subagents` commands remain available. Other extension actions are under settings.
|
|
8
|
+
- With Web UI enabled, open the personal agent defaults editor or prompt editor from the first row of Agents or Prompts.
|
|
9
|
+
|
|
3
10
|
## [0.63.6] - 2026-12-03
|
|
4
11
|
|
|
5
12
|
### Fixed
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Use `pi-better-harness` when you want the full working set for Pi. It manages:
|
|
|
16
16
|
- `pi-better-goal` for explicit triggers, pause/resume, and background-aware continuation.
|
|
17
17
|
- Harness-owned Goal & Todo for session context and checklist progress. Saved work appears in the panel. Automatic Goal execution defaults to Off.
|
|
18
18
|
|
|
19
|
-
Both Harness install methods include the shared server for subagents and background tasks. Remote session commands are off by default. Set `PI_BETTER_SERVER_ENABLE_REMOTE=1` before starting Pi to enable `/remote` and `/detach`. The same variable enables the `pi-remote` CLI.
|
|
19
|
+
Both Harness install methods include the shared server for subagents and background tasks. Remote session commands are off by default. Set `PI_BETTER_SERVER_ENABLE_REMOTE=1` before starting Pi to enable `/harness-settings remote` and `/harness-settings detach`. The same variable enables the `pi-remote` CLI.
|
|
20
20
|
|
|
21
21
|
`pi-better-read-aloud` is intentionally not included yet.
|
|
22
22
|
|
|
@@ -36,7 +36,7 @@ reopened work, or bind a Goal when invoking `/skill:rush-issues` or
|
|
|
36
36
|
With it off, use `/goal resume` to start saved work manually.
|
|
37
37
|
|
|
38
38
|
The panel shows `goal saved` before execution starts and `goal active` with a
|
|
39
|
-
clock while it runs. Use `/todo` to reveal the panel and `/todo expand` to see
|
|
39
|
+
clock while it runs. Use `/harness-settings todo` to reveal the panel and `/harness-settings todo expand` to see
|
|
40
40
|
all steps. `get_todo` returns the full Goal and Todo, including acceptance criteria
|
|
41
41
|
and boundaries. Completing a step updates checklist progress. The Goal stays
|
|
42
42
|
open until its completion is recorded.
|
|
@@ -48,8 +48,8 @@ clients using the legacy `outcome` field remain supported.
|
|
|
48
48
|
|
|
49
49
|
Todo uses the same workflow view for a bound task plan and a dynamic workflow.
|
|
50
50
|
The task list and diagram start at equal widths. Drag their divider in fullscreen Pi
|
|
51
|
-
or enter `/todo split 3:2` to give the task list three fifths of the available width.
|
|
52
|
-
The session remembers the ratio across reloads. Use `/todo split 1:1` to restore equal columns.
|
|
51
|
+
or enter `/harness-settings todo split 3:2` to give the task list three fifths of the available width.
|
|
52
|
+
The session remembers the ratio across reloads. Use `/harness-settings todo split 1:1` to restore equal columns.
|
|
53
53
|
Below 36 terminal columns, the diagram follows the task list. Stage counts use the task symbols, so `Implement ●2` shows two tasks in progress. A pending stage shows `○`. In a mixed stage, `!1 ●2` shows one blocked task and two running.
|
|
54
54
|
|
|
55
55
|
Existing Plan session histories restore as Todo. Workflow task-plan files and
|
|
@@ -57,7 +57,7 @@ revision checks continue to govern workflow-owned plans. See the [usage guide](d
|
|
|
57
57
|
|
|
58
58
|
### Dynamic workflows
|
|
59
59
|
|
|
60
|
-
Run `/dynamic-workflow` to plan the current task once. In `/harness-settings`,
|
|
60
|
+
Run `/harness-settings dynamic-workflow` to plan the current task once. In `/harness-settings`,
|
|
61
61
|
**Automatic dynamic workflows (Beta)** defaults to **Off**. With **On**, Pi handles
|
|
62
62
|
simple requests directly and can plan a workflow for dependencies, role handoffs
|
|
63
63
|
or repeated review. Existing **Adaptive** settings are treated as **On**.
|
|
@@ -70,7 +70,7 @@ diagram as work progresses. The list uses full task titles. The diagram uses
|
|
|
70
70
|
short step or stage labels such as `Code review` and `UX review`.
|
|
71
71
|
Task icons distinguish ready (○), working (●), waiting (·), optional standby (–),
|
|
72
72
|
failed (×), and completed (✓) steps. In mouse-enabled Pi, click a task to highlight
|
|
73
|
-
its stage and inspect its latest result. Use `/todo expand` to show every task.
|
|
73
|
+
its stage and inspect its latest result. Use `/harness-settings todo expand` to show every task.
|
|
74
74
|
Independent tasks can run together. A join waits for each prerequisite's output.
|
|
75
75
|
If a reviewer requests changes, the revision opens and the revised artifact
|
|
76
76
|
returns to review. Delivery waits for approval of the current version.
|
|
@@ -87,9 +87,9 @@ default; turning it off removes ledger views and hints without deleting records.
|
|
|
87
87
|
The same `update_todo` / `get_todo` interface carries optional ledger payloads and
|
|
88
88
|
selectors for create, update, attach, detach, list, and read. Updates require the
|
|
89
89
|
current revision, preserve completed evidence and history, and never associate old
|
|
90
|
-
work with a new session automatically. Use `/ledger attach <id>` (or an explicit
|
|
91
|
-
`update_todo` ledger attach) to continue the same record; `/ledger list`,
|
|
92
|
-
`/ledger switch`, and `/ledger detach` manage the reference without copying it. A
|
|
90
|
+
work with a new session automatically. Use `/harness-settings ledger attach <id>` (or an explicit
|
|
91
|
+
`update_todo` ledger attach) to continue the same record; `/harness-settings ledger list`,
|
|
92
|
+
`/harness-settings ledger switch`, and `/harness-settings ledger detach` manage the reference without copying it. A
|
|
93
93
|
resumed session keeps its reference, a fresh session stays unassociated, and
|
|
94
94
|
bounded recovery reminders after compaction or resume are rebuilt from durable
|
|
95
95
|
state. Workflow-owned rows keep their canonical stage/status rendering; the
|
|
@@ -145,24 +145,24 @@ You keep launching Pi the way you always have:
|
|
|
145
145
|
pi
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
The foreground write sandbox starts inactive. Use `/sandbox on` for the current
|
|
149
|
-
session or `/sandbox default on` to persist opt-in across startup, new session,
|
|
148
|
+
The foreground write sandbox starts inactive. Use `/harness-settings sandbox on` for the current
|
|
149
|
+
session or `/harness-settings sandbox default on` to persist opt-in across startup, new session,
|
|
150
150
|
resume, fork, and reload. There is no launcher.
|
|
151
151
|
|
|
152
152
|
While it is on, Pi's built-in `bash`, `write`, and `edit` tools, your own `!` / `!!` commands, local background tasks, and subagents can write only under the directory you launched Pi from, minus the packaged deny paths (`.git/hooks`, `.env`, `.env.local`).
|
|
153
153
|
|
|
154
154
|
**Reads and network access are unrestricted** — this sandbox limits writes only. Writes are confined for those integrated first-party execution paths; Pi's own process, arbitrary `pi.exec` calls, and unrelated third-party extension code are **not** confined. Confinement is also **per surface**: each integrated surface denies its own control plane, not every other surface's, so with several first-party surfaces installed a confined process on one can still write another's control plane.
|
|
155
155
|
|
|
156
|
-
Sandbox state is human-only: `/sandbox`, `/sandbox on`, `/sandbox off`,
|
|
157
|
-
`/sandbox default on|off`, `/sandbox deny ...`, and `/sandbox rules` are slash
|
|
158
|
-
commands with no tool equivalent. `/sandbox off` and `/sandbox default off`
|
|
156
|
+
Sandbox state is human-only: `/harness-settings sandbox`, `/harness-settings sandbox on`, `/harness-settings sandbox off`,
|
|
157
|
+
`/harness-settings sandbox default on|off`, `/harness-settings sandbox deny ...`, and `/harness-settings sandbox rules` are slash
|
|
158
|
+
commands with no tool equivalent. `/harness-settings sandbox off` and `/harness-settings sandbox default off`
|
|
159
159
|
need interactive confirmation. Full policy: [pi-better-sandbox](https://github.com/1aboveio/pi-better-harness/tree/main/packages/pi-better-sandbox#readme).
|
|
160
160
|
|
|
161
161
|
## Minimal Tool Output
|
|
162
162
|
|
|
163
163
|
The bundled harness provides **Tool output** with **Normal** and **Compact** in
|
|
164
|
-
`/harness-settings`. `/tool-output minimal`, `/tool-output normal`, and
|
|
165
|
-
`/tool-output` (toggle) remain compatibility shortcuts to the same preference.
|
|
164
|
+
`/harness-settings`. `/harness-settings tool-output minimal`, `/harness-settings tool-output normal`, and
|
|
165
|
+
`/harness-settings tool-output` (toggle) remain compatibility shortcuts to the same preference.
|
|
166
166
|
Minimal mode folds each tool call into a single-line header, including running
|
|
167
167
|
calls. The tool-specific icon and tool name share a state color: accent while
|
|
168
168
|
running, muted when completed, and error-colored when failed. In fullscreen Pi, a soft highlight travels through the entire visible running tool name and its
|
|
@@ -193,7 +193,7 @@ tool icons sit centered in a three-column gutter. Click the disclosure again to
|
|
|
193
193
|
block; native expanded call/result clicks collapse individual details. Regular
|
|
194
194
|
terminals keep mouse input for terminal selection and scrollback; Ctrl+O expands
|
|
195
195
|
all original tool details in both modes and folds them again on the next toggle.
|
|
196
|
-
`/tool-output normal` restores ordinary rendering. Error result bodies are also
|
|
196
|
+
`/harness-settings tool-output normal` restores ordinary rendering. Error result bodies are also
|
|
197
197
|
hidden in minimal mode and remain available when expanded.
|
|
198
198
|
|
|
199
199
|
Minimal mode also covers Harness tools: Subagents, Background Tasks, Goal, Todo,
|
|
@@ -219,14 +219,24 @@ pi -e ./packages/pi-better-harness/extensions/minimal-output/index.ts
|
|
|
219
219
|
|
|
220
220
|
## Harness Settings
|
|
221
221
|
|
|
222
|
-
Open `/harness-settings`
|
|
223
|
-
|
|
224
|
-
page
|
|
225
|
-
row. Escape returns from a child page to the row that opened it.
|
|
222
|
+
Open `/harness-settings` or `/better-harness-settings` for the same menu.
|
|
223
|
+
Use ←/→ or Tab/Shift+Tab to switch tabs, ↑/↓ to select a row, and Enter or Space to open or change it.
|
|
224
|
+
Esc returns from a page to the row that opened it. The slash menu also offers `/goal` and `/subagents`.
|
|
226
225
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
226
|
+
| Tab | Settings and actions |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| Goals | Goal execution, Todo display and actions, project ledgers, workflow ownership and dynamic workflows |
|
|
229
|
+
| Agents | Subagent settings and history, agent catalog, sandbox permissions, protected paths and diagnostics |
|
|
230
|
+
| Background | Current activity, wait reviews and completion delivery |
|
|
231
|
+
| Display | Navigator layout, pinned panels, tool output and animation |
|
|
232
|
+
| Supervision | Supervisor mode, scenarios and recovery commitments |
|
|
233
|
+
| Prompts | Recaps, prompt editor, prompt experiments and native compaction |
|
|
234
|
+
| Remote | Connect to a host, pull a session or move it to a host |
|
|
235
|
+
| Audio | Read a reply or selected text aloud and stop playback |
|
|
236
|
+
|
|
237
|
+
The menu shows actions from loaded extensions. Remote appears when remote sessions are enabled.
|
|
238
|
+
Audio appears when `pi-better-read-aloud` is installed. For scripts and direct access, both settings
|
|
239
|
+
aliases accept an action and its arguments, for example `/harness-settings sandbox deny list`.
|
|
230
240
|
|
|
231
241
|
**Navigator layout** selects **Flat list** (the default) or **Tree**. Flatten keeps the Subagents
|
|
232
242
|
and Background Tasks groups and includes tasks launched by subagents. Tree puts
|
|
@@ -267,7 +277,7 @@ use after validation; global choices take precedence, and old files remain intac
|
|
|
267
277
|
Updates preserve Pi's own settings and other packages' choices. SSH profiles,
|
|
268
278
|
plans, run records, and role/agent definitions remain in their existing stores:
|
|
269
279
|
they are session data or reusable definitions, not global UI defaults.
|
|
270
|
-
In `/agents`, model and effort edits are session-local until Ctrl+S saves them
|
|
280
|
+
In `/harness-settings agents`, model and effort edits are session-local until Ctrl+S saves them
|
|
271
281
|
to the user or trusted project's `agents/settings.json`. Markdown definitions
|
|
272
282
|
remain unchanged, so bundled prompt updates keep applying. The Settings,
|
|
273
283
|
Instructions, and Files tabs keep configuration separate from prompts.
|
|
@@ -278,7 +288,7 @@ survive sessions and upgrades.
|
|
|
278
288
|
|
|
279
289
|
### OpenAI native compaction
|
|
280
290
|
|
|
281
|
-
Turn on **OpenAI native compaction** under **
|
|
291
|
+
Turn on **OpenAI native compaction** under **Prompts** in `/harness-settings` to use the provider’s native compressor for manual `/compact` and automatic compaction. The switch defaults to Off and applies to future compactions. It supports GPT models on OpenAI Responses and Codex Responses routes. If the standalone endpoint is unavailable, Harness tries the Responses compaction trigger. Routes without either capability use Pi’s summary.
|
|
282
292
|
|
|
283
293
|
Pi saves the complete compacted window in the session journal alongside the boundary of the recent messages it kept. Restarting before that write leaves the previous history available for retry. After the write, Pi can reopen the session and reuse the saved window. Switching to another route restores the original Pi history for that route.
|
|
284
294
|
|
|
@@ -340,9 +350,14 @@ precedence over automatic discovery.
|
|
|
340
350
|
The Web UI is off by default. Run `PI_HARNESS_WEB_UI=1 pi-better-harness web`
|
|
341
351
|
to inspect the local server, sessions and inventories. To open **Prompts → Edit**
|
|
342
352
|
directly, run `PI_HARNESS_WEB_UI=1 pi-better-harness instructions web`.
|
|
343
|
-
To
|
|
344
|
-
|
|
345
|
-
|
|
353
|
+
To open either editor from Pi, start `PI_HARNESS_WEB_UI=1 pi`, run
|
|
354
|
+
`/harness-settings` or `/better-harness-settings`, and press Enter on the
|
|
355
|
+
first row of **Agents** or **Prompts**. **Edit agent defaults** saves the
|
|
356
|
+
model and reasoning effort for a personal role or named agent. It uses
|
|
357
|
+
the models available to the current Pi session. **Edit prompt modules**
|
|
358
|
+
opens the prompt revision editor. The standalone web console opens the
|
|
359
|
+
catalog in view-only mode. All use the current Pi agent directory
|
|
360
|
+
(`PI_CODING_AGENT_DIR`). The CLI prints a
|
|
346
361
|
private loopback URL and opens the browser. Set `BROWSER=none` to print
|
|
347
362
|
the URL only. Stop the CLI to close the server.
|
|
348
363
|
|
|
@@ -375,7 +390,7 @@ the parent and active diffs before publishing. Manual publication and
|
|
|
375
390
|
rollback appear in activation history. Reload Pi to load the installed
|
|
376
391
|
revision. Off, saved-text and custom-file configurations retain their source.
|
|
377
392
|
|
|
378
|
-
To evaluate a complete session, run `/prompt-task-capture <manifest.json>`
|
|
393
|
+
To evaluate a complete session, run `/harness-settings prompt-task-capture <manifest.json>`
|
|
379
394
|
before the task. The manifest specifies the number of user turns, required
|
|
380
395
|
workspace files and expected final file contents. In **Replay → Evaluate
|
|
381
396
|
sessions**, review the recommended tasks from connected sessions and their
|
|
@@ -385,8 +400,8 @@ one, or when the reviewed manifest explicitly lists that turn in
|
|
|
385
400
|
`independentTurns`. The report includes each file check and the reason for
|
|
386
401
|
any unscored session.
|
|
387
402
|
|
|
388
|
-
To compare a candidate on one response, capture it with `/prompt-capture` or load
|
|
389
|
-
a reviewed suite with `/prompt-import`. The TUI can use its current session
|
|
403
|
+
To compare a candidate on one response, capture it with `/harness-settings prompt-capture` or load
|
|
404
|
+
a reviewed suite with `/harness-settings prompt-import`. The TUI can use its current session
|
|
390
405
|
directly. For browser replay, choose **Connect browser** in the TUI that owns
|
|
391
406
|
the capture or suite. The connection lasts until disconnect, reload or session
|
|
392
407
|
shutdown. Select a captured request or a suite and model
|
|
@@ -398,7 +413,7 @@ Enable the modular instructions and reload Pi. For existing overrides, remove
|
|
|
398
413
|
`instructionsPrompt` and `instructionsFile` from the global Harness settings
|
|
399
414
|
before syncing. Use a streaming `openai-completions` model for response replay.
|
|
400
415
|
|
|
401
|
-
1. Run `/prompt-capture`, then send the writing request you want to evaluate,
|
|
416
|
+
1. Run `/harness-settings prompt-capture`, then send the writing request you want to evaluate,
|
|
402
417
|
for example "Unit checks passed and deployment verification is pending. Can we close delivery?"
|
|
403
418
|
2. Ask the agent to list modules, read `bundled:verification`, and use
|
|
404
419
|
`prompt_edit` to create a `user:verification` module requiring the pending
|
|
@@ -420,13 +435,13 @@ The offline walkthrough runs with `node --test packages/pi-better-harness/test/h
|
|
|
420
435
|
|
|
421
436
|
### Replay a turn or task
|
|
422
437
|
|
|
423
|
-
After `/prompt-capture`, let the original turn finish. Ask for
|
|
438
|
+
After `/harness-settings prompt-capture`, let the original turn finish. Ask for
|
|
424
439
|
`prompt_turn_replay` with the case ID, candidate ID and generation budget
|
|
425
440
|
(1 through 64 per arm). Each requested tool must match the next recorded
|
|
426
441
|
name and arguments. The result includes the assistant actions, returned tool
|
|
427
442
|
data and the first divergence, cancellation or budget stop.
|
|
428
443
|
|
|
429
|
-
For a multi-turn file task, run `/prompt-task-capture task.json` from the Git
|
|
444
|
+
For a multi-turn file task, run `/harness-settings prompt-task-capture task.json` from the Git
|
|
430
445
|
repository root before sending the first task input. For example:
|
|
431
446
|
|
|
432
447
|
```json
|
|
@@ -455,17 +470,17 @@ question that needs a qualification. Each case has expected behavior, a
|
|
|
455
470
|
counterexample and a case-insensitive required/forbidden phrase rubric.
|
|
456
471
|
The report includes every response and its score or reason it could not be scored.
|
|
457
472
|
|
|
458
|
-
After a response replay, `/prompt-export path.json` opens its captured input
|
|
473
|
+
After a response replay, `/harness-settings prompt-export path.json` opens its captured input
|
|
459
474
|
for review and redaction. Add the rubric and examples before saving the new
|
|
460
|
-
file. In another session, `/prompt-import path.json` loads the reviewed suite.
|
|
475
|
+
file. In another session, `/harness-settings prompt-import path.json` loads the reviewed suite.
|
|
461
476
|
An empty import argument restores the bundled cases.
|
|
462
477
|
|
|
463
|
-
To use evaluated cases for an edit, enable `/prompt-learning on`. Ask the
|
|
478
|
+
To use evaluated cases for an edit, enable `/harness-settings prompt-learning on`. Ask the
|
|
464
479
|
agent to select two distinct baseline failures with the same failure category
|
|
465
480
|
and one passing counterexample. With `prompt_propose`, it supplies those IDs
|
|
466
481
|
and a user module edit. Inspect the before/after samples, then use
|
|
467
482
|
`prompt_judge_proposal` and `prompt_promote` or clear the pending proposal
|
|
468
|
-
with `/prompt-learning discard`. Learning is disabled in a fresh session.
|
|
483
|
+
with `/harness-settings prompt-learning discard`. Learning is disabled in a fresh session.
|
|
469
484
|
|
|
470
485
|
Run `node --test packages/pi-better-harness/test/prompt-experiments.test.mjs`
|
|
471
486
|
from the repository root for the offline turn, task and historical-case fixtures.
|
|
@@ -492,7 +507,7 @@ In `/harness-settings`, use **Supervisor scenarios** to choose which scenarios t
|
|
|
492
507
|
| Review Goal scope | A review of changed Todo steps against the latest user instruction and Goal. The owner chooses which steps to keep or prune. Use `supervisor_review` for an on-demand review. |
|
|
493
508
|
| Shared daemon fault diagnosis | A shared read-plane diagnosis with an owner-specific verification step when a runtime read fails and the daemon confirms degraded or rebuilding inventory. |
|
|
494
509
|
| Consolidate authorization requests | Owners in a trusted workspace can use `supervisor_request_decision` for the same proposal. The dialog shows the reference, operation, host, resource, side effect, workspace and validity period. Execution still needs the permissions normally required by the tool. |
|
|
495
|
-
| Follow up on recovery commitments | Use `supervisor_followup` to record the action, expected verification and actual tool results. Read progress with `/supervisor-followup`. Request one reminder with `/supervisor-followup remind <id> <minutes>`. |
|
|
510
|
+
| Follow up on recovery commitments | Use `supervisor_followup` to record the action, expected verification and actual tool results. Read progress with `/harness-settings supervisor-followup`. Request one reminder with `/harness-settings supervisor-followup remind <id> <minutes>`. |
|
|
496
511
|
|
|
497
512
|
## When To Use
|
|
498
513
|
|
|
@@ -504,7 +519,7 @@ Use the installer when you want every core extension with standalone package ide
|
|
|
504
519
|
|-------------|---------|
|
|
505
520
|
| Pi | Required |
|
|
506
521
|
| Recommended install | `npx pi-better-harness install` |
|
|
507
|
-
| Managed Subagents and Background Tasks | macOS and Linux on x64 or arm64.
|
|
522
|
+
| Managed Subagents and Background Tasks | macOS and Linux on x64 or arm64. The Windows x64 release candidate supports tasks that can run without kernel sandboxing. The published Harness 0.63.6 package predates Windows support. [Windows release status (#917)](https://github.com/1aboveio/pi-better-harness/issues/917) |
|
|
508
523
|
| Write sandbox on macOS | Seatbelt (`sandbox-exec`), ships with the OS |
|
|
509
524
|
| Write sandbox on Linux | Bubblewrap — install `bubblewrap` |
|
|
510
525
|
| Linked-worktree project context | A Pi host that applies `systemPromptOptions` after `before_agent_start` (Pi 1.x); older hosts keep the loaded prompt |
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withHarnessCommands } from "../settings/commands.ts";
|
|
1
2
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
3
|
import { installMinimalOutputHook, loadToolPrototype, loadCompactionPrototype, loadCustomMessagePrototype, type MinimalOutputHook } from "./hook.ts";
|
|
3
4
|
import type { SettingsControl } from "../settings/registry.ts";
|
|
@@ -5,7 +6,7 @@ import { readHarnessSetting, updateHarnessSetting } from "../shared-harness-sett
|
|
|
5
6
|
|
|
6
7
|
const ENTRY = "pi-better-harness-tool-output";
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
function minimalOutputExtension(pi: ExtensionAPI): void {
|
|
9
10
|
let hook: MinimalOutputHook | undefined;
|
|
10
11
|
let enabled = false;
|
|
11
12
|
let running = false;
|
|
@@ -151,7 +152,7 @@ export default function minimalOutputExtension(pi: ExtensionAPI): void {
|
|
|
151
152
|
handler: async (args, ctx) => {
|
|
152
153
|
const mode = args.trim().toLowerCase();
|
|
153
154
|
if (mode && mode !== "minimal" && mode !== "normal") {
|
|
154
|
-
ctx.ui.notify("Usage: /tool-output [minimal|normal]", "warning");
|
|
155
|
+
ctx.ui.notify("Usage: /harness-settings tool-output [minimal|normal]", "warning");
|
|
155
156
|
return;
|
|
156
157
|
}
|
|
157
158
|
try { await change((mode ? mode === "minimal" : !enabled) ? "Minimal" : "Normal", ctx); }
|
|
@@ -162,3 +163,5 @@ export default function minimalOutputExtension(pi: ExtensionAPI): void {
|
|
|
162
163
|
},
|
|
163
164
|
});
|
|
164
165
|
}
|
|
166
|
+
|
|
167
|
+
export default withHarnessCommands(minimalOutputExtension);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withHarnessCommands } from "../settings/commands.ts";
|
|
1
2
|
import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
3
|
import { reconstructGoalSnapshot } from "pi-better-goal/src/goal-state.ts";
|
|
3
4
|
import { sessionIdleEvent, type SessionIdleInspection } from "pi-better-goal/src/types.ts";
|
|
@@ -25,7 +26,7 @@ function preferences(value: unknown): Preferences {
|
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
function recapExtension(pi: ExtensionAPI): void {
|
|
29
30
|
let prefs: Preferences = {};
|
|
30
31
|
let run: AbortController | undefined;
|
|
31
32
|
let ended: { timestamp: number; aborted: boolean } | undefined;
|
|
@@ -92,7 +93,7 @@ export default function recapExtension(pi: ExtensionAPI): void {
|
|
|
92
93
|
id: "recap-prompt",
|
|
93
94
|
label: "Recap prompt",
|
|
94
95
|
description: "Edit instructions used only by the summary model.",
|
|
95
|
-
command: "/recap-prompt",
|
|
96
|
+
command: "/harness-settings recap-prompt",
|
|
96
97
|
open: editPrompt,
|
|
97
98
|
};
|
|
98
99
|
const register = () => {
|
|
@@ -196,3 +197,5 @@ export default function recapExtension(pi: ExtensionAPI): void {
|
|
|
196
197
|
unsubscribe = undefined;
|
|
197
198
|
});
|
|
198
199
|
}
|
|
200
|
+
|
|
201
|
+
export default withHarnessCommands(recapExtension);
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { MenuItem } from "./menu.ts";
|
|
3
|
+
|
|
4
|
+
type Command = Parameters<ExtensionAPI["registerCommand"]>[1];
|
|
5
|
+
type Operation = [label: string, args: string, input?: string];
|
|
6
|
+
type Feature = { name: string; tab: string; label: string; operations?: Operation[]; link?: string };
|
|
7
|
+
|
|
8
|
+
export const settingsNames = ["harness-settings", "better-harness-settings"] as const;
|
|
9
|
+
const features: Feature[] = [
|
|
10
|
+
{ name: "goal", tab: "Goals", label: "Goal execution settings", link: "goal", operations: [["Execution settings", "settings"]] },
|
|
11
|
+
{ name: "todo", tab: "Goals", label: "Current Todo", operations: [
|
|
12
|
+
["Show", "show"], ["Hide", "hide"], ["Expand", "expand"], ["Collapse", "collapse"],
|
|
13
|
+
["Automatic pinning", "pin auto"], ["Pin", "pin on"], ["Unpin", "pin off"], ["Resize split", "split", "Left:right ratio"], ["Clear Todo", "clear"],
|
|
14
|
+
] },
|
|
15
|
+
{ name: "ledger", tab: "Goals", label: "Project ledgers", operations: [
|
|
16
|
+
["List ledgers", "list"], ["Show attached ledger", "show"], ["Attach", "attach", "Ledger ID"],
|
|
17
|
+
["Switch", "switch", "Ledger ID"], ["Detach", "detach"],
|
|
18
|
+
] },
|
|
19
|
+
{ name: "workflow", tab: "Goals", label: "Skill workflow", operations: [["Inspect owner", ""], ["Clear ownership", "clear"]] },
|
|
20
|
+
{ name: "dynamic-workflow", tab: "Goals", label: "Start or continue dynamic workflow", operations: [
|
|
21
|
+
["Use current task", ""], ["Give instructions", "", "Workflow instructions"],
|
|
22
|
+
] },
|
|
23
|
+
{ name: "subagents", tab: "Agents", label: "Subagent settings", link: "subagents", operations: [["Open settings", "settings"]] },
|
|
24
|
+
{ name: "subagents", tab: "Agents", label: "Historical subagent waits", operations: [["Inspect historical waits", "history"]] },
|
|
25
|
+
{ name: "agents", tab: "Agents", label: "Agent catalog", link: "agents" },
|
|
26
|
+
{ name: "agents", tab: "Agents", label: "Manage agent definitions", operations: [
|
|
27
|
+
["List definitions", "list"], ["Inspect definition", "show", "Agent ID"], ["Create definition", "create"],
|
|
28
|
+
["Import from Codex", "import-codex"], ["Reload catalog", "reload"],
|
|
29
|
+
] },
|
|
30
|
+
{ name: "sandbox", tab: "Agents", label: "Sandbox settings", link: "sandbox" },
|
|
31
|
+
{ name: "sandbox", tab: "Agents", label: "Sandbox activation", operations: [
|
|
32
|
+
["Show status", "status"], ["Enable for session", "on"], ["Disable for session", "off"],
|
|
33
|
+
["Enable by default", "default on"], ["Disable by default", "default off"],
|
|
34
|
+
] },
|
|
35
|
+
{ name: "sandbox", tab: "Agents", label: "Sandbox rules and diagnostics", operations: [
|
|
36
|
+
["Protected paths", "rules"], ["List protected paths", "deny list"], ["Protect path", "deny add", "Path"],
|
|
37
|
+
["Remove protected path", "deny remove", "Path"], ["Restore packaged rules", "deny reset"],
|
|
38
|
+
["Diagnostics status", "diagnostics status"], ["Diagnostics summary", "diagnostics summary"],
|
|
39
|
+
["Enable diagnostics", "diagnostics on"], ["Disable diagnostics", "diagnostics off"], ["Export diagnostics", "diagnostics export"],
|
|
40
|
+
] },
|
|
41
|
+
{ name: "better-activity", tab: "Background", label: "Inspect current activity" },
|
|
42
|
+
{ name: "tool-output", tab: "Display", label: "Tool output", link: "tool-output", operations: [["Compact", "minimal"], ["Normal", "normal"]] },
|
|
43
|
+
{ name: "supervisor-followup", tab: "Supervision", label: "Recovery commitments", operations: [
|
|
44
|
+
["View commitments", ""], ["Schedule a reminder", "remind", "Commitment ID and minutes"],
|
|
45
|
+
] },
|
|
46
|
+
{ name: "recap-prompt", tab: "Prompts", label: "Recap prompt", link: "recap-prompt" },
|
|
47
|
+
{ name: "prompt-manager", tab: "Prompts", label: "Prompt manager", link: "prompt-manager" },
|
|
48
|
+
{ name: "prompt-capture", tab: "Prompts", label: "Capture next response" },
|
|
49
|
+
{ name: "prompt-task-capture", tab: "Prompts", label: "Capture task", operations: [["Capture", "", "Task manifest path"]] },
|
|
50
|
+
{ name: "prompt-import", tab: "Prompts", label: "Load evaluation cases", operations: [
|
|
51
|
+
["Load bundled cases", ""], ["Import reviewed suite", "", "Suite file path"],
|
|
52
|
+
] },
|
|
53
|
+
{ name: "prompt-export", tab: "Prompts", label: "Export reviewed replay", operations: [["Export", "", "New case file path"]] },
|
|
54
|
+
{ name: "prompt-learning", tab: "Prompts", label: "Case-based proposals", operations: [
|
|
55
|
+
["Enable for this session", "on"], ["Disable", "off"], ["Discard pending proposal", "discard"],
|
|
56
|
+
] },
|
|
57
|
+
{ name: "remote", tab: "Remote", label: "Remote sessions", operations: [
|
|
58
|
+
["Connect", "connect"], ["List hosts", "list"], ["Pull a session", "pull"],
|
|
59
|
+
] },
|
|
60
|
+
{ name: "detach", tab: "Remote", label: "Move session to host", operations: [["Move session", "", "SSH alias and optional destination flags"]] },
|
|
61
|
+
{ name: "read-aloud", tab: "Audio", label: "Read aloud", operations: [
|
|
62
|
+
["Read latest reply", ""], ["Read text", "", "Text to read"],
|
|
63
|
+
] },
|
|
64
|
+
{ name: "read-aloud-stop", tab: "Audio", label: "Stop playback" },
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
export interface HarnessAction extends MenuItem {
|
|
68
|
+
link?: string;
|
|
69
|
+
exitsMenu: boolean;
|
|
70
|
+
run(ctx: ExtensionCommandContext): Promise<boolean>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function menuActions(commands: Map<string, Command>): HarnessAction[] {
|
|
74
|
+
return features.flatMap(feature => {
|
|
75
|
+
const command = commands.get(feature.name);
|
|
76
|
+
if (!command) return [];
|
|
77
|
+
return [{
|
|
78
|
+
id: "action:" + feature.label, label: feature.label, kind: "page" as const, tab: feature.tab,
|
|
79
|
+
...(command.description && { description: command.description }), ...(feature.link && { link: feature.link }),
|
|
80
|
+
exitsMenu: ["remote", "detach", "dynamic-workflow"].includes(feature.name),
|
|
81
|
+
async run(ctx: ExtensionCommandContext) {
|
|
82
|
+
let args = "";
|
|
83
|
+
if (feature.operations) {
|
|
84
|
+
const choices = feature.operations;
|
|
85
|
+
let operation: Operation | undefined = choices[0];
|
|
86
|
+
if (choices.length > 1) {
|
|
87
|
+
const label = await ctx.ui.select(feature.label, choices.map(([label]) => label));
|
|
88
|
+
operation = choices.find(choice => choice[0] === label);
|
|
89
|
+
}
|
|
90
|
+
if (!operation) return false;
|
|
91
|
+
args = operation[1];
|
|
92
|
+
if (operation[2]) {
|
|
93
|
+
const text = (await ctx.ui.input(operation[2]))?.trim();
|
|
94
|
+
if (!text) return false;
|
|
95
|
+
args = [args, text].filter(Boolean).join(" ");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
await command.handler(args, ctx);
|
|
99
|
+
return true;
|
|
100
|
+
},
|
|
101
|
+
}];
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function availableActions(actions: HarnessAction[], links: { id: string }[], controls: { id: string }[]) {
|
|
106
|
+
const contributed = new Set([...links, ...controls].map(item => item.id));
|
|
107
|
+
return actions.filter(action => !action.link || !contributed.has(action.link));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
type MenuHost = {
|
|
111
|
+
commands: Map<string, Command>;
|
|
112
|
+
open?: (ctx: ExtensionCommandContext, actions: HarnessAction[]) => Promise<void>;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Pi may give each extension its own events facade. Discover the owner through
|
|
116
|
+
// the session event bus, including when standalone packages load before Harness.
|
|
117
|
+
export function harnessMenu(pi: ExtensionAPI): MenuHost {
|
|
118
|
+
let found: MenuHost | undefined;
|
|
119
|
+
const channel = "pi-better-harness:command-menu:host";
|
|
120
|
+
pi.events?.emit(channel, (host: MenuHost) => { found = host; });
|
|
121
|
+
if (found) return found;
|
|
122
|
+
const host: MenuHost = { commands: new Map() };
|
|
123
|
+
const stop = pi.events?.on(channel, receive => { if (typeof receive === "function") receive(host); });
|
|
124
|
+
if (typeof stop === "function") pi.on("session_shutdown", stop);
|
|
125
|
+
const entry: Command = {
|
|
126
|
+
description: "Open Harness settings and actions",
|
|
127
|
+
async getArgumentCompletions(prefix) {
|
|
128
|
+
const match = /^(\S+)\s+(.*)$/s.exec(prefix.trimStart());
|
|
129
|
+
if (match) {
|
|
130
|
+
const items = await host.commands.get(match[1]!)?.getArgumentCompletions?.(match[2]!);
|
|
131
|
+
return items?.map(item => ({ ...item, value: match[1] + " " + item.value })) ?? null;
|
|
132
|
+
}
|
|
133
|
+
const partial = prefix.trim();
|
|
134
|
+
// An exact suggestion would consume Enter in Pi instead of running the action.
|
|
135
|
+
if (host.commands.has(partial)) return null;
|
|
136
|
+
return [...host.commands.keys()].filter(name => name.startsWith(partial)).sort().map(name => ({ value: name, label: name }));
|
|
137
|
+
},
|
|
138
|
+
async handler(args, ctx) {
|
|
139
|
+
const input = args.trim();
|
|
140
|
+
if (input) {
|
|
141
|
+
const [name] = input.split(/\s+/, 1);
|
|
142
|
+
const command = host.commands.get(name!);
|
|
143
|
+
if (command) return command.handler(input.slice(name!.length).trimStart(), ctx);
|
|
144
|
+
ctx.ui.notify("Unknown Harness action: " + name, "warning");
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (ctx.mode !== "tui") { ctx.ui.notify("Harness settings requires the interactive TUI.", "warning"); return; }
|
|
148
|
+
const actions = menuActions(host.commands);
|
|
149
|
+
if (host.open) { await host.open(ctx, actions); return; }
|
|
150
|
+
// A standalone installation uses the same grouped controls as the full bundle.
|
|
151
|
+
const { chooseHarnessSetting } = await import("./page.ts");
|
|
152
|
+
const { createSettingsRegistry } = await import("./registry.ts");
|
|
153
|
+
const registry = createSettingsRegistry(pi);
|
|
154
|
+
let selected: string | undefined;
|
|
155
|
+
try {
|
|
156
|
+
while (true) {
|
|
157
|
+
registry.refresh();
|
|
158
|
+
const links = registry.list();
|
|
159
|
+
const controls = registry.controls();
|
|
160
|
+
const available = availableActions(actions, links, controls);
|
|
161
|
+
selected = await chooseHarnessSetting(ctx, links, selected, undefined, controls, undefined, available);
|
|
162
|
+
if (!selected) return;
|
|
163
|
+
try {
|
|
164
|
+
const action = available.find(item => item.id === selected);
|
|
165
|
+
if (action) {
|
|
166
|
+
if (await action.run(ctx) && action.exitsMenu) return;
|
|
167
|
+
} else {
|
|
168
|
+
await links.find(link => `link:${link.id}` === selected)?.open(ctx);
|
|
169
|
+
}
|
|
170
|
+
} catch (error) { ctx.ui.notify(error instanceof Error ? error.message : String(error), "error"); }
|
|
171
|
+
}
|
|
172
|
+
} finally { registry.dispose(); }
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
for (const name of settingsNames) pi.registerCommand(name, entry);
|
|
176
|
+
return host;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Preserve package tools and hooks. Only the package's own command registration is routed. */
|
|
180
|
+
export function withHarnessCommands<Args extends unknown[], Result>(install: (pi: ExtensionAPI, ...args: Args) => Result) {
|
|
181
|
+
return (pi: ExtensionAPI, ...args: Args): Result => {
|
|
182
|
+
if (!pi.registerCommand) return install(pi, ...args);
|
|
183
|
+
let host: MenuHost | undefined;
|
|
184
|
+
const api: ExtensionAPI = Object.create(pi);
|
|
185
|
+
api.registerCommand = (name, command) => {
|
|
186
|
+
host ??= harnessMenu(pi);
|
|
187
|
+
if (host.commands.has(name)) return;
|
|
188
|
+
if (name === "goal" || name === "subagents") pi.registerCommand(name, command);
|
|
189
|
+
host.commands.set(name, command);
|
|
190
|
+
};
|
|
191
|
+
return install(api, ...args);
|
|
192
|
+
};
|
|
193
|
+
}
|
|
@@ -19,7 +19,7 @@ export const controlCopy = new Map<string, SettingCopy>([
|
|
|
19
19
|
description: "Blocks recognized shell waits, such as watching CI or following logs. Pi gets a prompt to run them in the background so the session stays responsive.",
|
|
20
20
|
}],
|
|
21
21
|
["dynamic-workflow", {
|
|
22
|
-
description: "Let Pi plan a workflow for tasks with dependencies, handoffs or review. Use /dynamic-workflow to start one manually.",
|
|
22
|
+
description: "Let Pi plan a workflow for tasks with dependencies, handoffs or review. Use /harness-settings dynamic-workflow to start one manually.",
|
|
23
23
|
values: { on: "On", off: "Off" },
|
|
24
24
|
}],
|
|
25
25
|
["outcome-todo", {
|
|
@@ -28,7 +28,7 @@ export const controlCopy = new Map<string, SettingCopy>([
|
|
|
28
28
|
}],
|
|
29
29
|
["outcome-todo-ledger", {
|
|
30
30
|
label: "Project work ledger",
|
|
31
|
-
description: "Lets sessions attach a saved project checklist and carry its progress across sessions. Use /ledger to list or attach a ledger.",
|
|
31
|
+
description: "Lets sessions attach a saved project checklist and carry its progress across sessions. Use /harness-settings ledger to list or attach a ledger.",
|
|
32
32
|
}],
|
|
33
33
|
["outcome-todo-display", {
|
|
34
34
|
label: "Goal and Todo panel",
|