@nklisch/pi-enhanced 0.2.0 → 0.2.2

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/node_modules/@nklisch/pi-background-tasks/CHANGELOG.md +7 -0
  3. package/node_modules/@nklisch/pi-background-tasks/extensions/background-tasks.test.ts +105 -0
  4. package/node_modules/@nklisch/pi-background-tasks/extensions/background-tasks.ts +131 -44
  5. package/node_modules/@nklisch/pi-background-tasks/package.json +1 -1
  6. package/node_modules/@nklisch/pi-background-tasks/skills/background-tasks/SKILL.md +6 -7
  7. package/node_modules/@nklisch/pi-clearance/native/clearance-core.win32-x64-msvc.node +0 -0
  8. package/node_modules/@nklisch/pi-clearance/package.json +1 -1
  9. package/node_modules/@nklisch/pi-clearance/src/config/config-command-writer.ts +34 -17
  10. package/node_modules/@nklisch/pi-clearance/src/index.ts +34 -3
  11. package/node_modules/@nklisch/pi-clearance/src/packs/package-registration.ts +63 -36
  12. package/node_modules/@nklisch/pi-clearance/src/runtime/allow-request-message.ts +40 -1
  13. package/node_modules/@nklisch/pi-clearance/src/runtime/command-registry.ts +22 -2
  14. package/node_modules/@nklisch/pi-clearance/src/runtime/command-transforms.ts +50 -29
  15. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/native-ui.ts +233 -49
  16. package/node_modules/@nklisch/pi-clearance/src/runtime/policy-cache.ts +19 -5
  17. package/node_modules/@nklisch/pi-conveniences/extensions/context-window-footer.ts +48 -13
  18. package/node_modules/@nklisch/pi-conveniences/package.json +1 -1
  19. package/node_modules/@nklisch/pi-fff-compat/extensions/fff-compat-search.ts +49 -42
  20. package/node_modules/@nklisch/pi-fff-compat/extensions/finder-lifecycle.ts +92 -0
  21. package/node_modules/@nklisch/pi-fff-compat/package.json +2 -2
  22. package/node_modules/@nklisch/pi-model-modes/package.json +1 -1
  23. package/node_modules/@nklisch/pi-model-modes/src/command-message.ts +30 -0
  24. package/node_modules/@nklisch/pi-model-modes/src/commands.ts +31 -15
  25. package/node_modules/@nklisch/pi-model-modes/src/style-command.ts +25 -14
  26. package/node_modules/@nklisch/pi-plugins/README.md +2 -2
  27. package/node_modules/@nklisch/pi-plugins/dist/application/subagent-hook-runtime.js +4 -1
  28. package/node_modules/@nklisch/pi-plugins/dist/application/subagent-hook-runtime.js.map +1 -1
  29. package/node_modules/@nklisch/pi-plugins/dist/composition/background-update-coordinator.js +12 -3
  30. package/node_modules/@nklisch/pi-plugins/dist/composition/background-update-coordinator.js.map +1 -1
  31. package/node_modules/@nklisch/pi-plugins/dist/infrastructure/process/command-runner.d.ts +1 -0
  32. package/node_modules/@nklisch/pi-plugins/dist/infrastructure/process/command-runner.js +19 -11
  33. package/node_modules/@nklisch/pi-plugins/dist/infrastructure/process/command-runner.js.map +1 -1
  34. package/node_modules/@nklisch/pi-plugins/dist/pi/hooks/pi-hook-decision-adapter.js +36 -7
  35. package/node_modules/@nklisch/pi-plugins/dist/pi/hooks/pi-hook-decision-adapter.js.map +1 -1
  36. package/node_modules/@nklisch/pi-plugins/dist/pi/manager/plugin-manager-component.js +14 -3
  37. package/node_modules/@nklisch/pi-plugins/dist/pi/manager/plugin-manager-component.js.map +1 -1
  38. package/node_modules/@nklisch/pi-plugins/dist/pi/manager/plugin-manager-session.js +153 -54
  39. package/node_modules/@nklisch/pi-plugins/dist/pi/manager/plugin-manager-session.js.map +1 -1
  40. package/node_modules/@nklisch/pi-plugins/dist/pi/plugin-manager-lifecycle.js +35 -8
  41. package/node_modules/@nklisch/pi-plugins/dist/pi/plugin-manager-lifecycle.js.map +1 -1
  42. package/node_modules/@nklisch/pi-plugins/dist/runtime/mcp/pi-mcp-adapter-package.js +1 -1
  43. package/node_modules/@nklisch/pi-plugins/dist/runtime/mcp/pi-mcp-adapter-runtime.js +1 -1
  44. package/node_modules/@nklisch/pi-plugins/dist/runtime/subagents/pi-subagents-package.js +1 -1
  45. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/CHANGELOG.md +7 -0
  46. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/package.json +1 -1
  47. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/custom-agents.ts +22 -17
  48. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/debug.ts +18 -0
  49. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/child-lifecycle.ts +22 -4
  50. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/concurrency-limiter.ts +32 -8
  51. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/create-subagent-session.ts +8 -7
  52. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/lifecycle-interceptor.ts +25 -6
  53. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/run-listeners.ts +6 -2
  54. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent-manager.ts +31 -16
  55. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent-session.ts +70 -32
  56. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent.ts +55 -50
  57. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/workspace-bracket.ts +6 -2
  58. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/record-observer.ts +37 -34
  59. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/subagent-events-observer.ts +15 -14
  60. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/foreground-runner.ts +31 -26
  61. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/agent-widget.ts +51 -26
  62. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/session-navigator.ts +100 -46
  63. package/node_modules/@nklisch/pi-plugins/package.json +3 -3
  64. package/package.json +4 -4
  65. package/test/verify-bundle.mjs +8 -0
@@ -38,6 +38,7 @@ import {
38
38
  visibleWidth,
39
39
  } from "@earendil-works/pi-tui";
40
40
  import type { AgentConfigLookup } from "#src/config/agent-types";
41
+ import { debugLog } from "#src/debug";
41
42
  import type { SessionMessage } from "#src/types";
42
43
  import { describeActivity, formatDuration, formatModelThinking, type Theme } from "#src/ui/display";
43
44
  import { fileSnapshotSource, listNavigableAgents, liveSource, type NavigableSubagent, type RunDisplayMetadata, type TranscriptSource } from "#src/ui/session-navigation";
@@ -160,57 +161,69 @@ export class TranscriptOverlay implements Component {
160
161
  this.done = done;
161
162
  this.cwd = cwd;
162
163
  this.markdownTheme = markdownTheme;
163
- this.content = this.rebuild();
164
- this.unsubscribe = source.subscribe(() => {
165
- if (this.closed) return;
164
+ try {
166
165
  this.content = this.rebuild();
167
- this.tui.requestRender();
168
- });
169
- if (run.completedAt() === undefined) {
170
- this.runtimeInterval = setInterval(() => {
171
- if (this.closed || this.run.completedAt() !== undefined) {
172
- this.clearRuntimeInterval();
173
- return;
174
- }
175
- this.tui.requestRender();
176
- }, 100);
166
+ } catch (error) {
167
+ debugLog("session navigator initial render", error);
168
+ this.content = new Container();
169
+ }
170
+ try {
171
+ this.unsubscribe = source.subscribe(() => this.refreshFromSource());
172
+ } catch (error) {
173
+ debugLog("session navigator subscribe", error);
174
+ }
175
+ if (this.isRunning()) {
176
+ this.runtimeInterval = setInterval(() => this.refreshRuntime(), 100);
177
177
  }
178
178
  }
179
179
 
180
180
  handleInput(data: string): void {
181
- if (matchesKey(data, "escape") || matchesKey(data, "q")) {
182
- this.closed = true;
183
- this.clearRuntimeInterval();
184
- this.done(undefined);
185
- return;
186
- }
181
+ try {
182
+ if (matchesKey(data, "escape") || matchesKey(data, "q")) {
183
+ this.closed = true;
184
+ this.clearRuntimeInterval();
185
+ this.done(undefined);
186
+ return;
187
+ }
187
188
 
188
- const totalLines = this.buildContentLines(this.innerWidth()).length;
189
- const viewportHeight = this.viewportHeight();
190
- const maxScroll = Math.max(0, totalLines - viewportHeight);
191
-
192
- if (matchesKey(data, "up") || matchesKey(data, "k")) {
193
- this.scrollOffset = Math.max(0, this.scrollOffset - 1);
194
- this.autoScroll = this.scrollOffset >= maxScroll;
195
- } else if (matchesKey(data, "down") || matchesKey(data, "j")) {
196
- this.scrollOffset = Math.min(maxScroll, this.scrollOffset + 1);
197
- this.autoScroll = this.scrollOffset >= maxScroll;
198
- } else if (matchesKey(data, "pageUp") || matchesKey(data, "shift+up")) {
199
- this.scrollOffset = Math.max(0, this.scrollOffset - viewportHeight);
200
- this.autoScroll = false;
201
- } else if (matchesKey(data, "pageDown") || matchesKey(data, "shift+down")) {
202
- this.scrollOffset = Math.min(maxScroll, this.scrollOffset + viewportHeight);
203
- this.autoScroll = this.scrollOffset >= maxScroll;
204
- } else if (matchesKey(data, "home")) {
205
- this.scrollOffset = 0;
206
- this.autoScroll = false;
207
- } else if (matchesKey(data, "end")) {
208
- this.scrollOffset = maxScroll;
209
- this.autoScroll = true;
189
+ const totalLines = this.buildContentLines(this.innerWidth()).length;
190
+ const viewportHeight = this.viewportHeight();
191
+ const maxScroll = Math.max(0, totalLines - viewportHeight);
192
+
193
+ if (matchesKey(data, "up") || matchesKey(data, "k")) {
194
+ this.scrollOffset = Math.max(0, this.scrollOffset - 1);
195
+ this.autoScroll = this.scrollOffset >= maxScroll;
196
+ } else if (matchesKey(data, "down") || matchesKey(data, "j")) {
197
+ this.scrollOffset = Math.min(maxScroll, this.scrollOffset + 1);
198
+ this.autoScroll = this.scrollOffset >= maxScroll;
199
+ } else if (matchesKey(data, "pageUp") || matchesKey(data, "shift+up")) {
200
+ this.scrollOffset = Math.max(0, this.scrollOffset - viewportHeight);
201
+ this.autoScroll = false;
202
+ } else if (matchesKey(data, "pageDown") || matchesKey(data, "shift+down")) {
203
+ this.scrollOffset = Math.min(maxScroll, this.scrollOffset + viewportHeight);
204
+ this.autoScroll = this.scrollOffset >= maxScroll;
205
+ } else if (matchesKey(data, "home")) {
206
+ this.scrollOffset = 0;
207
+ this.autoScroll = false;
208
+ } else if (matchesKey(data, "end")) {
209
+ this.scrollOffset = maxScroll;
210
+ this.autoScroll = true;
211
+ }
212
+ } catch (error) {
213
+ debugLog("session navigator input", error);
210
214
  }
211
215
  }
212
216
 
213
217
  render(width: number): string[] {
218
+ try {
219
+ return this.renderSafe(width);
220
+ } catch (error) {
221
+ debugLog("session navigator render", error);
222
+ return [];
223
+ }
224
+ }
225
+
226
+ private renderSafe(width: number): string[] {
214
227
  if (width < 6) return [];
215
228
  const th = this.theme;
216
229
  const innerW = width - 4;
@@ -252,22 +265,63 @@ export class TranscriptOverlay implements Component {
252
265
 
253
266
  // fallow-ignore-next-line unused-class-member
254
267
  invalidate(): void {
255
- this.content.invalidate();
268
+ try {
269
+ this.content.invalidate();
270
+ } catch (error) {
271
+ debugLog("session navigator invalidate", error);
272
+ }
256
273
  }
257
274
 
258
275
  dispose(): void {
259
276
  this.closed = true;
260
- if (this.unsubscribe) {
261
- this.unsubscribe();
262
- this.unsubscribe = undefined;
277
+ const unsubscribe = this.unsubscribe;
278
+ this.unsubscribe = undefined;
279
+ if (unsubscribe) {
280
+ try {
281
+ unsubscribe();
282
+ } catch (error) {
283
+ debugLog("session navigator unsubscribe", error);
284
+ }
263
285
  }
264
286
  this.clearRuntimeInterval();
265
287
  }
266
288
 
267
289
  // ---- Private ----
268
290
 
291
+ private refreshFromSource(): void {
292
+ if (this.closed) return;
293
+ try {
294
+ this.content = this.rebuild();
295
+ this.tui.requestRender();
296
+ } catch (error) {
297
+ debugLog("session navigator live refresh", error);
298
+ }
299
+ }
300
+
301
+ private refreshRuntime(): void {
302
+ try {
303
+ if (this.closed || !this.isRunning()) {
304
+ this.clearRuntimeInterval();
305
+ return;
306
+ }
307
+ this.tui.requestRender();
308
+ } catch (error) {
309
+ debugLog("session navigator runtime refresh", error);
310
+ this.clearRuntimeInterval();
311
+ }
312
+ }
313
+
314
+ private isRunning(): boolean {
315
+ try {
316
+ return this.run.completedAt() === undefined;
317
+ } catch (error) {
318
+ debugLog("session navigator runtime state", error);
319
+ return false;
320
+ }
321
+ }
322
+
269
323
  private clearRuntimeInterval(): void {
270
- if (this.runtimeInterval) {
324
+ if (this.runtimeInterval !== undefined) {
271
325
  clearInterval(this.runtimeInterval);
272
326
  this.runtimeInterval = undefined;
273
327
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nklisch/pi-plugins",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "private": false,
5
5
  "description": "Native marketplace and plugin lifecycle management for Pi, with Claude Code and Codex compatibility.",
6
6
  "license": "MIT",
@@ -67,8 +67,8 @@
67
67
  "@nklisch/pi-subagents"
68
68
  ],
69
69
  "dependencies": {
70
- "@nklisch/pi-mcp-adapter": "2.21.0-nklisch.0",
71
- "@nklisch/pi-subagents": "18.1.0-nklisch.1",
70
+ "@nklisch/pi-mcp-adapter": "2.21.0-nklisch.1",
71
+ "@nklisch/pi-subagents": "18.1.0-nklisch.2",
72
72
  "jiti": "2.7.0",
73
73
  "semver": "7.8.1",
74
74
  "smol-toml": "^1.7.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nklisch/pi-enhanced",
3
- "version": "0.2.0",
4
- "description": "Pi, enhanced \u2014 one install for nklisch's full harness: policy-gated command review, plugin marketplace, subagents, background tasks, research tools, search, model modes, and a curated UX set.",
3
+ "version": "0.2.2",
4
+ "description": "Pi, enhanced one install for nklisch's full harness: policy-gated command review, plugin marketplace, subagents, background tasks, research tools, search, model modes, and a curated UX set.",
5
5
  "author": {
6
6
  "name": "nklisch"
7
7
  },
@@ -29,7 +29,7 @@
29
29
  "pi": {
30
30
  "extensions": [
31
31
  "./node_modules/@nklisch/pi-conveniences/extensions",
32
- "./node_modules/@nklisch/pi-fff-compat/extensions",
32
+ "./node_modules/@nklisch/pi-fff-compat/extensions/fff-compat-search.ts",
33
33
  "./node_modules/@nklisch/pi-model-modes/extensions/index.ts",
34
34
  "./node_modules/@nklisch/pi-background-tasks/extensions/background-tasks.ts",
35
35
  "./node_modules/@nklisch/pi-plugins/dist/pi/production-subagents-extension.js",
@@ -70,7 +70,7 @@
70
70
  "@nklisch/pi-clearance": "^0",
71
71
  "@nklisch/pi-conveniences": "^0",
72
72
  "@nklisch/pi-fff-compat": "^0",
73
- "@nklisch/pi-mcp-adapter": "2.21.0-nklisch.0",
73
+ "@nklisch/pi-mcp-adapter": "2.21.0-nklisch.1",
74
74
  "@nklisch/pi-model-modes": "^0",
75
75
  "@nklisch/pi-plugins": "^0",
76
76
  "@sinclair/typebox": "^0.34.49",
@@ -34,6 +34,14 @@ const declared = [
34
34
  ].map((p) => p.replace(/^\.\//, ""));
35
35
 
36
36
  const failures = [];
37
+ const fffCompatEntrypoint = "./node_modules/@nklisch/pi-fff-compat/extensions/fff-compat-search.ts";
38
+ if (!manifest.pi.extensions.includes(fffCompatEntrypoint)) {
39
+ failures.push(`${fffCompatEntrypoint} (FFF compatibility extension entrypoint not declared)`);
40
+ }
41
+ if (manifest.pi.extensions.includes("./node_modules/@nklisch/pi-fff-compat/extensions")) {
42
+ failures.push("node_modules/@nklisch/pi-fff-compat/extensions (directory would load non-extension helpers)");
43
+ }
44
+
37
45
  for (const declaredPath of declared) {
38
46
  // A declared path may be a directory, a single file, or a SKILL.md path.
39
47
  // It is satisfied when the tarball contains the path itself or anything