@hcflabs/pi-herdr-tools 1.9.1 → 1.10.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/README.md CHANGED
@@ -60,6 +60,8 @@ Both commands require `HERDR_ENV=1` and `HERDR_PANE_ID`. Pane, session-path, and
60
60
 
61
61
  Clone tabs keep the current working directory. Worktree clones use the new checkout. Pi starts with `--session <absolute-clone-file>`; only successful launches change focus.
62
62
 
63
+ A tab or worktree creation returns before the new pane shell reads input. Each clone waits until the shell owns the foreground and draws its prompt. Only then does it start Pi. A shell that still runs startup files can lose the Enter key of a long command.
64
+
63
65
  Worktree creation uses `herdr worktree create --workspace <current-workspace> --no-focus`, or the repository's parent workspace when already in a linked worktree. Herdr creates missing branches from `HEAD`, with checkouts under `worktrees.directory` in grouped workspaces. Clones and handoffs use an extra unfocused tab if a layout plugin such as `herdr-plus` occupies the root pane.
64
66
 
65
67
  ### Worktree handoff
@@ -84,7 +86,7 @@ The tool never selects a child repository automatically. When `repo` is needed,
84
86
  | `prompt` | Self-contained task prompt. |
85
87
  | `repo` | Optional. A Git top-level directory, relative to the Pi working directory. `.` names the working directory. It must not contain `..` or resolve outside that directory. A subdirectory of a repository fails. |
86
88
 
87
- After validation, the tool runs `herdr worktree create --workspace <parent> --branch <branch> --base main --label <label> --no-focus`. With `repo`, it uses `--cwd <repository>` instead of `--workspace <parent>`. Herdr then opens the primary workspace of the repository, or creates it, and does not close it later. It starts Pi without session arguments. It submits `herdr agent prompt <agentName> <prompt> --wait --until working --timeout 30000`, with the prompt as one argument, not a shell command or file. The result includes workspace ID, tab, pane, branch, checkout path, agent name, and `repo` when set.
89
+ After validation, the tool runs `herdr worktree create --workspace <parent> --branch <branch> --base main --label <label> --no-focus`. With `repo`, it uses `--cwd <repository>` instead of `--workspace <parent>`. Herdr then opens the primary workspace of the repository, or creates it, and does not close it later. The tool waits until the new pane shell reads input, then starts Pi without session arguments. It submits `herdr agent prompt <agentName> <prompt> --wait --until working --timeout 30000`, with the prompt as one argument, not a shell command or file. The result includes workspace ID, tab, pane, branch, checkout path, agent name, and `repo` when set.
88
90
 
89
91
  ### Command panes
90
92
 
@@ -118,6 +120,8 @@ The side-thread model receives Main's fixed, compaction-aware context snapshot.
118
120
 
119
121
  Run `/btw merge Apply the smallest safe fix` after the answer. The merge request contains user and assistant text, without tool payloads. Pending delivery survives shutdown until consumption or 24-hour stale cleanup. Once idle and authenticated, Main appends the transcript without starting a turn, then submits the prompt.
120
122
 
123
+ `/btw` splits the pane, waits until the new pane shell reads input, and then starts Pi. A split returns before its shell is ready.
124
+
121
125
  ### Titles
122
126
 
123
127
  Automatic titles ignore extension-injected, empty, and image-only prompts. Expanded skill and prompt-template text starts background generation without delaying the reply. English, sentence-case display titles usually have two or three words; limits are four words and 20 characters.
package/internal/btw.ts CHANGED
@@ -672,6 +672,10 @@ export async function registerBtwExtension(
672
672
  pane: paneId,
673
673
  args: agentStartArgs,
674
674
  options: { timeout: 45_000 },
675
+ // `pane split` returns the pane before its shell reads input. Wait for
676
+ // the shell, so the launch command cannot be typed into a busy tty and
677
+ // be lost.
678
+ freshPane: true,
675
679
  shouldRetry: (candidate) => !candidate.killed && launchGeneration === sessionGeneration,
676
680
  });
677
681
  } catch (error) {
package/internal/recap.ts CHANGED
@@ -91,7 +91,7 @@ export default function idleRecapExtension(pi: ExtensionAPI): void {
91
91
 
92
92
  const recap = async (ctx: ExtensionContext) => {
93
93
  timer = undefined;
94
- const leaf = ctx.sessionManager.getLeafId();
94
+ const leaf = conversationLeaf(ctx.sessionManager);
95
95
  if (leaf === recappedLeaf || !idle(ctx)) return;
96
96
  const messages = buildSessionContext(ctx.sessionManager.getEntries(), leaf).messages;
97
97
  // buildMergeTranscript keeps only user and assistant turns; summaries carry the goal after compaction or branch navigation.
@@ -111,7 +111,7 @@ export default function idleRecapExtension(pi: ExtensionAPI): void {
111
111
  active = controller;
112
112
  try {
113
113
  const text = await generateRecap(prompt, ctx, controller.signal, reportTaskModels);
114
- if (active !== controller || !idle(ctx) || ctx.sessionManager.getLeafId() !== leaf) return;
114
+ if (active !== controller || !idle(ctx) || conversationLeaf(ctx.sessionManager) !== leaf) return;
115
115
  recappedLeaf = leaf;
116
116
  if (ctx.mode === "tui") {
117
117
  ctx.ui.setWidget(WIDGET_KEY, (_tui, theme) => ({
@@ -157,3 +157,10 @@ export default function idleRecapExtension(pi: ExtensionAPI): void {
157
157
  pi.on("session_tree", (_event, ctx) => cancel(ctx));
158
158
  pi.on("session_shutdown", (_event, ctx) => cancel(ctx));
159
159
  }
160
+
161
+ /** Leaf ID without trailing usage entries. Pi appends a usage entry for each cache warm. */
162
+ function conversationLeaf(sessionManager: ExtensionContext["sessionManager"]): string | null {
163
+ let entry = sessionManager.getLeafEntry();
164
+ while (entry?.type === "usage") entry = entry.parentId ? sessionManager.getEntry(entry.parentId) : undefined;
165
+ return entry?.id ?? null;
166
+ }
@@ -227,6 +227,12 @@ export async function launchPiAgent(
227
227
  pane,
228
228
  args: input.args,
229
229
  options: { cwd },
230
+ // Every caller passes a pane it just created: a new tab, a worktree root
231
+ // pane, or an extra tab. Herdr returns those IDs before the pane shell
232
+ // reads input, and shell startup files can still own the foreground. Wait
233
+ // for the shell, so the launch command cannot be typed into a busy tty and
234
+ // be lost.
235
+ freshPane: true,
230
236
  onPaneBusy: input.onPaneBusy
231
237
  ? async () => (pane = await input.onPaneBusy!())
232
238
  : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hcflabs/pi-herdr-tools",
3
- "version": "1.9.1",
3
+ "version": "1.10.1",
4
4
  "description": "Clone, hand off, name, and finish Pi conversations in Herdr, with mergeable side questions.",
5
5
  "keywords": ["pi-package", "pi", "herdr", "session", "clone", "side-thread", "title"],
6
6
  "type": "module",
@@ -13,9 +13,9 @@
13
13
  "pack:check": "npm pack --dry-run"
14
14
  },
15
15
  "peerDependencies": {
16
- "@earendil-works/pi-agent-core": "^1.3.0",
17
- "@earendil-works/pi-coding-agent": "^1.3.0",
18
- "@earendil-works/pi-tui": "^1.3.0",
16
+ "@earendil-works/pi-agent-core": "^1.6.0",
17
+ "@earendil-works/pi-coding-agent": "^1.6.0",
18
+ "@earendil-works/pi-tui": "^1.6.0",
19
19
  "typebox": "^1.3.15"
20
20
  },
21
21
  "dependencies": {
@@ -26,9 +26,9 @@
26
26
  "@hcflabs/pi-task-models": "^9.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@earendil-works/pi-agent-core": "1.3.0",
30
- "@earendil-works/pi-coding-agent": "1.3.0",
31
- "@earendil-works/pi-tui": "1.3.0"
29
+ "@earendil-works/pi-agent-core": "1.6.0",
30
+ "@earendil-works/pi-coding-agent": "1.6.0",
31
+ "@earendil-works/pi-tui": "1.6.0"
32
32
  },
33
33
  "repository": {
34
34
  "type": "git",