pi-session-cleanup 1.0.0 → 1.1.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.
@@ -2,6 +2,7 @@ declare namespace NodeJS {
2
2
  interface Process {
3
3
  env: Record<string, string | undefined>;
4
4
  platform: string;
5
+ exit(code?: number): never;
5
6
  stdout: {
6
7
  columns?: number;
7
8
  rows?: number;
@@ -10,6 +11,15 @@ declare namespace NodeJS {
10
11
  }
11
12
 
12
13
  declare const process: NodeJS.Process;
14
+ declare function setTimeout(handler: () => void, timeout?: number): { unref?(): void };
15
+ declare function clearTimeout(timeout: { unref?(): void }): void;
16
+ type Buffer = { length: number; toString(encoding?: string): string };
17
+ declare const Buffer: {
18
+ alloc(size: number): Buffer;
19
+ concat(chunks: Buffer[]): Buffer;
20
+ from(value: string): Buffer;
21
+ isBuffer(value: unknown): value is Buffer;
22
+ };
13
23
 
14
24
  declare module "node:assert/strict" {
15
25
  const assert: {
@@ -22,22 +32,29 @@ declare module "node:assert/strict" {
22
32
  }
23
33
 
24
34
  declare module "node:child_process" {
25
- export function spawnSync(
35
+ interface ChildProcessLike {
36
+ stderr?: {
37
+ on(event: "data", handler: (chunk: unknown) => void): void;
38
+ };
39
+ kill(): void;
40
+ on(event: "error", handler: (error: Error) => void): void;
41
+ on(event: "close", handler: (status: number | null) => void): void;
42
+ }
43
+
44
+ export function spawn(
26
45
  command: string,
27
46
  args?: readonly string[],
28
47
  options?: Record<string, unknown>,
29
- ): {
30
- status: number | null;
31
- stderr?: unknown;
32
- error?: Error;
33
- };
48
+ ): ChildProcessLike;
34
49
  }
35
50
 
36
51
  declare module "node:fs" {
52
+ export function appendFileSync(path: string, data: string, encoding: string): void;
37
53
  export function existsSync(path: string): boolean;
38
54
  export function mkdirSync(path: string, options?: { recursive?: boolean }): void;
39
55
  export function mkdtempSync(prefix: string): string;
40
56
  export function readFileSync(path: string, encoding: string): string;
57
+ export function readdirSync(path: string): string[];
41
58
  export function rmSync(path: string, options?: { recursive?: boolean; force?: boolean }): void;
42
59
  export function writeFileSync(path: string, data: string, encoding: string): void;
43
60
  }
@@ -56,6 +73,7 @@ declare module "node:path" {
56
73
  export function basename(path: string): string;
57
74
  export function dirname(path: string): string;
58
75
  export function join(...parts: string[]): string;
76
+ export function resolve(...parts: string[]): string;
59
77
  }
60
78
 
61
79
  declare module "node:test" {
@@ -71,7 +89,7 @@ declare module "node:url" {
71
89
  export function fileURLToPath(url: unknown): string;
72
90
  }
73
91
 
74
- declare module "@mariozechner/pi-tui" {
92
+ declare module "@earendil-works/pi-tui" {
75
93
  export interface Component {
76
94
  render(width: number): string[];
77
95
  handleInput(data: string): void;
@@ -88,8 +106,10 @@ declare module "@mariozechner/pi-tui" {
88
106
  export function visibleWidth(text: string): number;
89
107
  }
90
108
 
91
- declare module "@mariozechner/pi-coding-agent" {
92
- import type { Component } from "@mariozechner/pi-tui";
109
+ declare module "@earendil-works/pi-coding-agent" {
110
+ import type { Component } from "@earendil-works/pi-tui";
111
+
112
+ export function getAgentDir(): string;
93
113
 
94
114
  export interface SessionInfo {
95
115
  path: string;
@@ -107,6 +127,7 @@ declare module "@mariozechner/pi-coding-agent" {
107
127
  export class SessionManager {
108
128
  static list(cwd: string, sessionDir: string): Promise<SessionInfo[]>;
109
129
  static listAll(): Promise<SessionInfo[]>;
130
+ appendCustomEntry(customType: string, data?: unknown): string;
110
131
  getSessionId(): string;
111
132
  getSessionFile(): string | undefined;
112
133
  getCwd(): string;
@@ -141,6 +162,7 @@ declare module "@mariozechner/pi-coding-agent" {
141
162
  sessionManager: SessionManager;
142
163
  ui: ExtensionUIContext;
143
164
  getSystemPrompt(): string;
165
+ shutdown?(): Promise<void> | void;
144
166
  }
145
167
 
146
168
  export interface ExtensionCommandContext extends ExtensionContext {
@@ -163,6 +185,12 @@ declare module "@mariozechner/pi-coding-agent" {
163
185
  reason: "new" | "resume" | "fork" | "reload";
164
186
  }
165
187
 
188
+ export interface SessionShutdownEvent {
189
+ type: "session_shutdown";
190
+ reason?: "quit" | "reload" | "new" | "resume" | "fork";
191
+ targetSessionFile?: string;
192
+ }
193
+
166
194
  export interface ExtensionAPI {
167
195
  on(
168
196
  event: "resources_discover",
@@ -172,6 +200,10 @@ declare module "@mariozechner/pi-coding-agent" {
172
200
  event: "session_start",
173
201
  handler: (event: SessionStartEvent, ctx: ExtensionContext) => void | Promise<void>,
174
202
  ): void;
203
+ on(
204
+ event: "session_shutdown",
205
+ handler: (event: SessionShutdownEvent, ctx: ExtensionContext) => void | Promise<void>,
206
+ ): void;
175
207
 
176
208
  registerCommand(
177
209
  name: string,
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { SessionInfo } from "@mariozechner/pi-coding-agent";
1
+ import type { SessionInfo } from "@earendil-works/pi-coding-agent";
2
2
 
3
3
  export type SessionScope = "current" | "all";
4
4