@hcflabs/pi-herdr-tools 1.8.0 → 1.9.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/README.md CHANGED
@@ -25,6 +25,8 @@ Configure `fast` in `/task-models`.
25
25
 
26
26
  ## Use
27
27
 
28
+ Use `/diagnostics` to read recent config reports and command recovery errors.
29
+
28
30
  Run `/clone-tab`; the original session stays active. Commands and prompts are for humans; tools are for agents.
29
31
 
30
32
  | Surface | Type | Purpose |
@@ -1,4 +1,5 @@
1
1
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { registerDiagnosticsCommand } from "@hcflabs/pi-config-store";
2
3
  import registerBtwExtension, { BTW_TASK } from "../internal/btw.ts";
3
4
  import herdrCloneExtension from "../internal/clone-tab.ts";
4
5
  import herdrCommandExtension from "../internal/command.ts";
@@ -9,6 +10,7 @@ import herdrRenameExtension, { RENAME_TASK } from "../internal/rename.ts";
9
10
  import { registerTaskModelsWarning } from "../internal/task-models.ts";
10
11
 
11
12
  export default async function herdrToolsExtension(pi: ExtensionAPI): Promise<void> {
13
+ registerDiagnosticsCommand(pi);
12
14
  registerTaskModelsWarning(pi, [RENAME_TASK, BTW_TASK, RECAP_TASK]);
13
15
  herdrRenameExtension(pi);
14
16
  idleRecapExtension(pi);
@@ -4,7 +4,7 @@ import { isAbsolute, join } from "node:path";
4
4
  import { setTimeout as delay } from "node:timers/promises";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
7
- import { createConfigStore, extensionConfigDir, field, formatConfigIssues, parsers, registerConfigReporting } from "@hcflabs/pi-config-store";
7
+ import { createConfigStore, extensionConfigDir, field, formatConfigIssues, parsers, recordDiagnostic, registerConfigReporting } from "@hcflabs/pi-config-store";
8
8
  import { awaitShellPrompt, createHerdrClient, hasHerdrErrorCode, herdrCommandFailure } from "@hcflabs/pi-herdr";
9
9
  import { scanProcessLease } from "@hcflabs/pi-process";
10
10
  import { isWithin, resolveRepoTarget } from "@hcflabs/pi-repo";
@@ -369,7 +369,7 @@ export default function herdrCommandExtension(pi: ExtensionAPI, options: { agent
369
369
  endActivity(job);
370
370
  throw new Error("herdr_command: the session ended during start. The pane was closed; no command was started.");
371
371
  }
372
- const ready = await awaitShellPrompt(herdr, paneId, { cwd }, undefined, true);
372
+ const ready = await awaitShellPrompt(herdr, paneId, { cwd }, undefined, true, true);
373
373
  if (ready) {
374
374
  await herdr.exec(["pane", "close", paneId], { cwd });
375
375
  jobs.delete(id);
@@ -420,18 +420,18 @@ export default function herdrCommandExtension(pi: ExtensionAPI, options: { agent
420
420
  if (ctx.hasUI) ctx.ui.notify(text, "warning");
421
421
  else process.stderr.write(`${text}\n`);
422
422
  } catch (error) {
423
- console.error(`herdr_command: job ${id} could not be restored: ${error instanceof Error ? error.message : String(error)} Evidence: ${directory}.`);
423
+ recordDiagnostic("pi-herdr-tools", "error", `herdr_command: job ${id} could not be restored: ${error instanceof Error ? error.message : String(error)} Evidence: ${directory}.`, ctx);
424
424
  }
425
425
  }
426
426
  });
427
427
 
428
- pi.on("session_shutdown", async () => {
428
+ pi.on("session_shutdown", async (_event, ctx) => {
429
429
  closed = true;
430
430
  // A job does not outlive its session. Unproved stops keep their evidence in the job directory.
431
431
  for (const job of jobs.values()) {
432
432
  if (job.stopped) continue;
433
433
  try { await stopJob(job); }
434
- catch (error) { console.error(`herdr_command: ${error instanceof Error ? error.message : String(error)} Evidence: ${job.directory}.`); }
434
+ catch (error) { recordDiagnostic("pi-herdr-tools", "error", `herdr_command: ${error instanceof Error ? error.message : String(error)} Evidence: ${job.directory}.`, ctx); }
435
435
  }
436
436
  jobs.clear();
437
437
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hcflabs/pi-herdr-tools",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
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",
@@ -19,8 +19,8 @@
19
19
  "typebox": "^1.3.15"
20
20
  },
21
21
  "dependencies": {
22
- "@hcflabs/pi-config-store": "^4.0.0",
23
- "@hcflabs/pi-herdr": "^0.6.0",
22
+ "@hcflabs/pi-config-store": "^4.2.0",
23
+ "@hcflabs/pi-herdr": "^0.7.0",
24
24
  "@hcflabs/pi-process": "^0.3.0",
25
25
  "@hcflabs/pi-repo": "^0.1.0",
26
26
  "@hcflabs/pi-task-models": "^9.0.0"