@henryqw/pi-herdr-btw 1.1.6 → 1.1.8

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
@@ -46,7 +46,7 @@ Side pane gets static parent context and shares Main's working directory, so ena
46
46
 
47
47
  ## Config
48
48
 
49
- `~/.pi/agent/config/pi-herdr-btw.json`
49
+ Package-owned: `~/.pi/agent/config/pi-herdr-btw.json`
50
50
 
51
51
  ```json
52
52
  {
@@ -56,18 +56,12 @@ Side pane gets static parent context and shares Main's working directory, so ena
56
56
  }
57
57
  ```
58
58
 
59
- `/btw config` shows defaults. Set `auto-submit on|off`, `tools inherit|all|read-only|none`, or `split right|down`; `reset` removes config. Missing config uses defaults. Malformed config fails visibly and remains unchanged. Model routes live in `~/.pi/agent/config/pi-task-models.json`.
59
+ | Field | Required | Possible values | Default |
60
+ | --- | --- | --- | --- |
61
+ | `autoSubmit` | No | `true`, `false` — submit the draft question automatically instead of leaving it editable in the side pane | `false` |
62
+ | `tools` | No | `inherit` (parent's active tools), `all`, `read-only` (built-in read-only tools), `none` | `inherit` |
63
+ | `split` | No | `right`, `down` — side-pane placement | `right` |
60
64
 
61
- ## Remove
65
+ All fields are optional; unknown keys and non-object files are rejected. `/btw config show` prints effective values; `/btw config reset` removes the file. Missing config uses defaults; malformed config fails visibly and remains unchanged.
62
66
 
63
- ```bash
64
- pi remove npm:@henryqw/pi-herdr-btw
65
- ```
66
-
67
- ## Development
68
-
69
- ```bash
70
- npm test --workspace @henryqw/pi-herdr-btw
71
- npm run typecheck --workspace @henryqw/pi-herdr-btw
72
- npm run pack:check --workspace @henryqw/pi-herdr-btw
73
- ```
67
+ Shared: `~/.pi/agent/config/pi-task-models.json`, owned by `@henryqw/pi-task-models`. Task `pi-herdr-btw/btw` defaults to profile `fast`; side-thread routes resolve before pane launch.
package/extensions/btw.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext } from "@earendil-works/pi-coding-agent";
3
- import { createHerdrClient, hasHerdrErrorCode } from "@henryqw/pi-herdr";
3
+ import { createHerdrClient, hasHerdrErrorCode, startPiAgent } from "@henryqw/pi-herdr";
4
4
  import {
5
5
  resolveConfiguredTaskRoutes,
6
6
  type ResolvedTaskRoute,
@@ -53,8 +53,6 @@ const BTW_TASK = "pi-herdr-btw/btw";
53
53
  const CHILD_HEARTBEAT_INTERVAL_MS = 5 * 60 * 1_000;
54
54
  const LITERAL_DRAFT_PREFIX = "\u200b";
55
55
  const MERGE_POLL_INTERVAL_MS = 3_000;
56
- const AGENT_START_BUSY_RETRIES = 5;
57
- const AGENT_START_RETRY_DELAY_MS = 250;
58
56
 
59
57
  function childPayloadPathFromArgv(): string | undefined {
60
58
  const index = process.argv.indexOf(CHILD_PAYLOAD_ARG);
@@ -703,20 +701,16 @@ export async function registerBtwExtension(
703
701
  }
704
702
 
705
703
  // Step 2: adopt pi into the new pane; herdr waits for readiness.
706
- const agentStartArgs = buildAgentStartArgs(launchOptions, paneId);
704
+ const agentStartArgs = buildAgentStartArgs(launchOptions);
707
705
  let result;
708
706
  try {
709
- result = await herdr.exec(agentStartArgs, { timeout: 45_000 });
710
- for (let attempt = 1; attempt < AGENT_START_BUSY_RETRIES; attempt += 1) {
711
- if (
712
- launchGeneration !== sessionGeneration ||
713
- result.killed ||
714
- !hasHerdrErrorCode(result, "agent_pane_busy")
715
- ) break;
716
- await new Promise((resolve) => setTimeout(resolve, AGENT_START_RETRY_DELAY_MS));
717
- if (launchGeneration !== sessionGeneration) break;
718
- result = await herdr.exec(agentStartArgs, { timeout: 45_000 });
719
- }
707
+ result = await startPiAgent(herdr, {
708
+ name: launchOptions.paneName,
709
+ pane: paneId,
710
+ args: agentStartArgs,
711
+ options: { timeout: 45_000 },
712
+ shouldRetry: (candidate) => !candidate.killed && launchGeneration === sessionGeneration,
713
+ });
720
714
  } catch (error) {
721
715
  const message = error instanceof Error ? error.message : String(error);
722
716
  await reportKnownPaneFailure(`/btw failed: ${message.slice(0, 500)}`, paneId, payloadPath);
package/internal/core.ts CHANGED
@@ -335,20 +335,9 @@ export function isAgentStartReady(
335
335
  }
336
336
  }
337
337
 
338
- /**
339
- * Step 2 of the launch: start pi in the freshly split pane. Herdr prepends
340
- * the canonical executable for `--kind pi`, so only pi's own args follow `--`.
341
- */
342
- export function buildAgentStartArgs(options: HerdrLaunchOptions, paneId: string): string[] {
338
+ /** The child Pi arguments for the Herdr agent-start boundary. */
339
+ export function buildAgentStartArgs(options: HerdrLaunchOptions): string[] {
343
340
  return [
344
- "agent",
345
- "start",
346
- options.paneName,
347
- "--kind",
348
- "pi",
349
- "--pane",
350
- paneId,
351
- "--",
352
341
  "--no-session",
353
342
  "--model",
354
343
  options.model,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-herdr-btw",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Open and merge tool-enabled Pi side threads in Herdr panes.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -46,7 +46,7 @@
46
46
  ]
47
47
  },
48
48
  "dependencies": {
49
- "@henryqw/pi-herdr": "^0.3.0",
49
+ "@henryqw/pi-herdr": "^0.4.0",
50
50
  "@henryqw/pi-task-models": "^1.0.0",
51
51
  "proper-lockfile": "^4.1.2"
52
52
  },