@narumitw/pi-herdr 0.2.0 → 0.3.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
@@ -30,12 +30,15 @@ Try from npm without installing permanently:
30
30
  pi -e npm:@narumitw/pi-herdr
31
31
  ```
32
32
 
33
- Load a local checkout from the repository root:
33
+ Build and load a local checkout from the repository root:
34
34
 
35
35
  ```bash
36
+ npm --workspace @narumitw/pi-herdr run build
36
37
  pi --no-extensions -e ./packages/pi-herdr
37
38
  ```
38
39
 
40
+ An unbuilt local checkout has no generated entrypoint and cannot be loaded by package directory.
41
+
39
42
  Pi extensions and skills run with your user permissions.
40
43
  Install only trusted packages, and review the source and bundled instructions before loading this package.
41
44
 
@@ -56,6 +59,13 @@ rm -rf ~/.agents/skills/herdr
56
59
 
57
60
  Run `/reload` or restart Pi after changing the installed resources.
58
61
 
62
+ ## 🧠 Skills
63
+
64
+ The bundled `herdr` skill loads version-matched operating guidance after an explicit Herdr request.
65
+ It treats panes created for background work as temporary and attempts to close them after collecting the required output.
66
+ Ask Pi explicitly to keep a pane open after the task when you want to inspect or use it later.
67
+ Automatic cleanup runs only when the installed Herdr guidance provides a conditional close that atomically confirms the recorded pane ownership and acceptable agent or shell state; otherwise Pi leaves the pane open and reports the limitation.
68
+
59
69
  ## 💬 Commands
60
70
 
61
71
  `/herdr` opens a menu to toggle the agent widget and view status or help, inspired by `/tool`.
@@ -166,6 +176,7 @@ Command recipes, approval handling, and other operating safety rules come from t
166
176
  - Integration requires a running compatible Herdr session and valid injected environment variables.
167
177
  - Model control requires an installed Herdr CLI that supports `herdr --skill`.
168
178
  - Socket failures are intentionally silent after the bounded retry.
179
+ - Skill cleanup tracking exists only in the active model context, so compaction, session replacement, `/reload`, or shutdown can leave temporary panes open.
169
180
  - The package does not install, start, update, or configure Herdr itself.
170
181
 
171
182
  ## 🗂️ Package layout
@@ -173,8 +184,10 @@ Command recipes, approval handling, and other operating safety rules come from t
173
184
  ```text
174
185
  packages/pi-herdr/
175
186
  ├── src/ # Authoritative implementation and helpers
176
- │ ├── index.ts # Thin Pi entrypoint
187
+ │ ├── index.ts # Thin repository entrypoint
177
188
  │ └── herdr-agent-state.ts # Herdr lifecycle integration
189
+ ├── dist/ # Generated TypeScript runtime loaded by Pi
190
+ ├── scripts/ # Deterministic runtime builder
178
191
  ├── skills/herdr/ # Published bootstrap for CLI-owned guidance
179
192
  └── test/ # Behavior and lifecycle coverage
180
193
  ```
@@ -0,0 +1,56 @@
1
+ // @generated by scripts/build-runtime.mjs; do not edit.
2
+ // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
+
4
+ // src/herdr-menu.ts
5
+ function createHerdrMenu(options) {
6
+ return {
7
+ start: "main",
8
+ screens: {
9
+ // One setting stays on the main menu, matching /tool rather than adding a submenu.
10
+ main: () => ({
11
+ kind: "actions",
12
+ title: "Herdr",
13
+ items: [
14
+ {
15
+ id: "widget",
16
+ label: `Agent widget: ${options.isEnabled() ? "On" : "Off"}`,
17
+ description: "Show or hide sibling agents above the editor",
18
+ action: "toggle"
19
+ },
20
+ { id: "status", label: "Status", to: "status" },
21
+ { id: "help", label: "Help", to: "help" },
22
+ { id: "close", label: "Close", close: true }
23
+ ],
24
+ hint: "close"
25
+ }),
26
+ status: () => ({
27
+ kind: "detail",
28
+ title: "Herdr Status",
29
+ lines: [
30
+ `Agent widget setting: ${options.isEnabled() ? "on" : "off"}`,
31
+ "The widget appears only in TUI mode with recognized sibling agents.",
32
+ "Lifecycle and metadata reporting are independent of this setting.",
33
+ `User settings file: ${options.settingsPath}`
34
+ ],
35
+ hint: "back"
36
+ }),
37
+ help: () => ({
38
+ kind: "detail",
39
+ title: "Herdr Help",
40
+ lines: [
41
+ "Toggle Agent widget from /herdr. Changes are saved immediately; closing does not undo them.",
42
+ "Manual pi-herdr.json changes apply after /reload or the next session start.",
43
+ "The widget defaults to on. Project overrides are not read."
44
+ ],
45
+ hint: "back"
46
+ })
47
+ },
48
+ actions: {
49
+ toggle: async ({ signal }) => await options.toggle(signal) ? { kind: "stay" } : { kind: "rejected" }
50
+ }
51
+ };
52
+ }
53
+ export {
54
+ createHerdrMenu
55
+ };
56
+ //# sourceMappingURL=herdr-menu-IUPFF5YK.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/herdr-menu.ts"],
4
+ "sourcesContent": ["import type { MenuDefinition } from \"@narumitw/pi-tui-kit\";\n\nexport function createHerdrMenu(options: {\n settingsPath: string;\n isEnabled(): boolean;\n toggle(signal: AbortSignal): Promise<boolean>;\n}): MenuDefinition<undefined, \"main\" | \"status\" | \"help\", \"toggle\"> {\n return {\n start: \"main\",\n screens: {\n // One setting stays on the main menu, matching /tool rather than adding a submenu.\n main: () => ({\n kind: \"actions\",\n title: \"Herdr\",\n items: [\n {\n id: \"widget\",\n label: `Agent widget: ${options.isEnabled() ? \"On\" : \"Off\"}`,\n description: \"Show or hide sibling agents above the editor\",\n action: \"toggle\",\n },\n { id: \"status\", label: \"Status\", to: \"status\" },\n { id: \"help\", label: \"Help\", to: \"help\" },\n { id: \"close\", label: \"Close\", close: true },\n ],\n hint: \"close\",\n }),\n status: () => ({\n kind: \"detail\",\n title: \"Herdr Status\",\n lines: [\n `Agent widget setting: ${options.isEnabled() ? \"on\" : \"off\"}`,\n \"The widget appears only in TUI mode with recognized sibling agents.\",\n \"Lifecycle and metadata reporting are independent of this setting.\",\n `User settings file: ${options.settingsPath}`,\n ],\n hint: \"back\",\n }),\n help: () => ({\n kind: \"detail\",\n title: \"Herdr Help\",\n lines: [\n \"Toggle Agent widget from /herdr. Changes are saved immediately; closing does not undo them.\",\n \"Manual pi-herdr.json changes apply after /reload or the next session start.\",\n \"The widget defaults to on. Project overrides are not read.\",\n ],\n hint: \"back\",\n }),\n },\n actions: {\n toggle: async ({ signal }) => ((await options.toggle(signal)) ? { kind: \"stay\" } : { kind: \"rejected\" }),\n },\n };\n}\n"],
5
+ "mappings": ";;;;AAEO,SAAS,gBAAgB,SAIoC;AAClE,SAAO;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA;AAAA,MAEP,MAAM,OAAO;AAAA,QACX,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO;AAAA,UACL;AAAA,YACE,IAAI;AAAA,YACJ,OAAO,iBAAiB,QAAQ,UAAU,IAAI,OAAO,KAAK;AAAA,YAC1D,aAAa;AAAA,YACb,QAAQ;AAAA,UACV;AAAA,UACA,EAAE,IAAI,UAAU,OAAO,UAAU,IAAI,SAAS;AAAA,UAC9C,EAAE,IAAI,QAAQ,OAAO,QAAQ,IAAI,OAAO;AAAA,UACxC,EAAE,IAAI,SAAS,OAAO,SAAS,OAAO,KAAK;AAAA,QAC7C;AAAA,QACA,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,OAAO;AAAA,QACb,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO;AAAA,UACL,yBAAyB,QAAQ,UAAU,IAAI,OAAO,KAAK;AAAA,UAC3D;AAAA,UACA;AAAA,UACA,uBAAuB,QAAQ,YAAY;AAAA,QAC7C;AAAA,QACA,MAAM;AAAA,MACR;AAAA,MACA,MAAM,OAAO;AAAA,QACX,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP,QAAQ,OAAO,EAAE,OAAO,MAAQ,MAAM,QAAQ,OAAO,MAAM,IAAK,EAAE,MAAM,OAAO,IAAI,EAAE,MAAM,WAAW;AAAA,IACxG;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }