@aliou/pi-processes 0.8.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliou/pi-processes",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -36,18 +36,18 @@
36
36
  "@aliou/pi-utils-settings": "^0.10.0",
37
37
  "@aliou/pi-utils-ui": "^0.1.0",
38
38
  "@aliou/sh": "^0.1.0",
39
- "@sinclair/typebox": "^0.34.41"
39
+ "typebox": "^1.0.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@mariozechner/pi-coding-agent": "0.65.0",
43
- "@mariozechner/pi-tui": "0.65.0"
42
+ "@mariozechner/pi-coding-agent": "0.69.0",
43
+ "@mariozechner/pi-tui": "0.69.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@aliou/biome-plugins": "^0.3.2",
47
47
  "@biomejs/biome": "^2.3.13",
48
48
  "@changesets/cli": "^2.27.11",
49
- "@mariozechner/pi-ai": "0.65.0",
50
- "@mariozechner/pi-coding-agent": "0.65.0",
49
+ "@mariozechner/pi-ai": "0.69.0",
50
+ "@mariozechner/pi-coding-agent": "0.69.0",
51
51
  "@types/node": "^25.0.10",
52
52
  "husky": "^9.1.7",
53
53
  "typescript": "^5.9.3",
@@ -19,7 +19,7 @@ export function setupProcessWidget(
19
19
  manager: ProcessManager,
20
20
  config: ResolvedProcessesConfig,
21
21
  ) {
22
- let latestContext: ExtensionContext | null = null;
22
+ let activeCtx: ExtensionContext | null = null;
23
23
  let logDockComponent: LogDockComponent | null = null;
24
24
  let logDockComponentTui: { requestRender(): void } | null = null;
25
25
 
@@ -30,30 +30,26 @@ export function setupProcessWidget(
30
30
  };
31
31
 
32
32
  function updateWidget() {
33
- if (!latestContext?.hasUI) return;
33
+ if (!activeCtx?.hasUI) return;
34
34
 
35
35
  if (!configLoader.getConfig().widget.showStatusWidget) {
36
- latestContext.ui.setWidget(STATUS_WIDGET_ID, undefined);
36
+ activeCtx.ui.setWidget(STATUS_WIDGET_ID, undefined);
37
37
  } else {
38
38
  const processes = manager.list();
39
39
  const maxWidth = process.stdout.columns || 120;
40
- const lines = renderStatusWidget(
41
- processes,
42
- latestContext.ui.theme,
43
- maxWidth,
44
- );
40
+ const lines = renderStatusWidget(processes, activeCtx.ui.theme, maxWidth);
45
41
 
46
42
  if (lines.length === 0) {
47
- latestContext.ui.setWidget(STATUS_WIDGET_ID, undefined);
43
+ activeCtx.ui.setWidget(STATUS_WIDGET_ID, undefined);
48
44
  } else {
49
- latestContext.ui.setWidget(STATUS_WIDGET_ID, lines, {
45
+ activeCtx.ui.setWidget(STATUS_WIDGET_ID, lines, {
50
46
  placement: "belowEditor",
51
47
  });
52
48
  }
53
49
  }
54
50
 
55
51
  if (dockState.visibility === "hidden") {
56
- latestContext.ui.setWidget(LOG_DOCK_WIDGET_ID, undefined);
52
+ activeCtx.ui.setWidget(LOG_DOCK_WIDGET_ID, undefined);
57
53
  if (logDockComponent) {
58
54
  logDockComponent.dispose();
59
55
  logDockComponent = null;
@@ -72,7 +68,7 @@ export function setupProcessWidget(
72
68
  dockHeight: height,
73
69
  });
74
70
  } else {
75
- const ctx = latestContext;
71
+ const ctx = activeCtx;
76
72
  ctx.ui.setWidget(
77
73
  LOG_DOCK_WIDGET_ID,
78
74
  (tui: { requestRender(): void }, theme: typeof ctx.ui.theme) => {
@@ -152,9 +148,20 @@ export function setupProcessWidget(
152
148
  logDockComponent = null;
153
149
  logDockComponentTui = null;
154
150
  }
155
- latestContext = ctx;
151
+ activeCtx = ctx;
156
152
  updateWidget();
157
153
  });
158
154
 
155
+ pi.on("session_shutdown", async (_event, ctx) => {
156
+ activeCtx = null;
157
+ if (logDockComponent) {
158
+ logDockComponent.dispose();
159
+ logDockComponent = null;
160
+ logDockComponentTui = null;
161
+ }
162
+ ctx.ui.setWidget(STATUS_WIDGET_ID, undefined);
163
+ ctx.ui.setWidget(LOG_DOCK_WIDGET_ID, undefined);
164
+ });
165
+
159
166
  return { update: updateWidget, dockActions };
160
167
  }
@@ -7,7 +7,7 @@ import type {
7
7
  ToolRenderResultOptions,
8
8
  } from "@mariozechner/pi-coding-agent";
9
9
  import { Text } from "@mariozechner/pi-tui";
10
- import { type Static, Type } from "@sinclair/typebox";
10
+ import { type Static, Type } from "typebox";
11
11
  import type { ProcessesDetails } from "../constants";
12
12
  import type { ProcessManager } from "../manager";
13
13
  import { executeAction, renderActionCall, renderActionResult } from "./actions";
@@ -75,16 +75,12 @@ const ProcessesParams = Type.Object({
75
75
  "Get a turn to react when process is killed by external signal (default: false). Note: killing via tool never triggers a turn.",
76
76
  }),
77
77
  ),
78
- ...(DEBUG_PREVIEW_ENABLED
79
- ? {
80
- preview: Type.Optional(
81
- StringEnum(["start", "list", "output", "logs", "error"] as const, {
82
- description:
83
- "For action=debug_preview only: which rendered result variant to preview (default: start)",
84
- }),
85
- ),
86
- }
87
- : {}),
78
+ preview: Type.Optional(
79
+ StringEnum(["start", "list", "output", "logs", "error"] as const, {
80
+ description:
81
+ "For action=debug_preview only: which rendered result variant to preview (default: start)",
82
+ }),
83
+ ),
88
84
  logWatches: Type.Optional(
89
85
  Type.Array(
90
86
  Type.Object(