pi-session-cleanup 1.0.0 → 1.1.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/CHANGELOG.md +7 -0
- package/README.md +20 -2
- package/package.json +66 -66
- package/src/agent-target.ts +361 -0
- package/src/index.ts +11 -2
- package/src/session-agent.ts +25 -0
- package/src/session-entry.ts +23 -0
- package/src/session-nix-command.ts +270 -25
- package/src/session-quit-shutdown.ts +40 -0
- package/src/tui/agent-target-picker.ts +306 -0
- package/src/types-shims.d.ts +18 -0
package/src/types-shims.d.ts
CHANGED
|
@@ -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;
|
|
@@ -34,10 +35,12 @@ declare module "node:child_process" {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
declare module "node:fs" {
|
|
38
|
+
export function appendFileSync(path: string, data: string, encoding: string): void;
|
|
37
39
|
export function existsSync(path: string): boolean;
|
|
38
40
|
export function mkdirSync(path: string, options?: { recursive?: boolean }): void;
|
|
39
41
|
export function mkdtempSync(prefix: string): string;
|
|
40
42
|
export function readFileSync(path: string, encoding: string): string;
|
|
43
|
+
export function readdirSync(path: string): string[];
|
|
41
44
|
export function rmSync(path: string, options?: { recursive?: boolean; force?: boolean }): void;
|
|
42
45
|
export function writeFileSync(path: string, data: string, encoding: string): void;
|
|
43
46
|
}
|
|
@@ -56,6 +59,7 @@ declare module "node:path" {
|
|
|
56
59
|
export function basename(path: string): string;
|
|
57
60
|
export function dirname(path: string): string;
|
|
58
61
|
export function join(...parts: string[]): string;
|
|
62
|
+
export function resolve(...parts: string[]): string;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
declare module "node:test" {
|
|
@@ -91,6 +95,8 @@ declare module "@mariozechner/pi-tui" {
|
|
|
91
95
|
declare module "@mariozechner/pi-coding-agent" {
|
|
92
96
|
import type { Component } from "@mariozechner/pi-tui";
|
|
93
97
|
|
|
98
|
+
export function getAgentDir(): string;
|
|
99
|
+
|
|
94
100
|
export interface SessionInfo {
|
|
95
101
|
path: string;
|
|
96
102
|
id: string;
|
|
@@ -107,6 +113,7 @@ declare module "@mariozechner/pi-coding-agent" {
|
|
|
107
113
|
export class SessionManager {
|
|
108
114
|
static list(cwd: string, sessionDir: string): Promise<SessionInfo[]>;
|
|
109
115
|
static listAll(): Promise<SessionInfo[]>;
|
|
116
|
+
appendCustomEntry(customType: string, data?: unknown): string;
|
|
110
117
|
getSessionId(): string;
|
|
111
118
|
getSessionFile(): string | undefined;
|
|
112
119
|
getCwd(): string;
|
|
@@ -141,6 +148,7 @@ declare module "@mariozechner/pi-coding-agent" {
|
|
|
141
148
|
sessionManager: SessionManager;
|
|
142
149
|
ui: ExtensionUIContext;
|
|
143
150
|
getSystemPrompt(): string;
|
|
151
|
+
shutdown?(): Promise<void> | void;
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
export interface ExtensionCommandContext extends ExtensionContext {
|
|
@@ -163,6 +171,12 @@ declare module "@mariozechner/pi-coding-agent" {
|
|
|
163
171
|
reason: "new" | "resume" | "fork" | "reload";
|
|
164
172
|
}
|
|
165
173
|
|
|
174
|
+
export interface SessionShutdownEvent {
|
|
175
|
+
type: "session_shutdown";
|
|
176
|
+
reason?: "quit" | "reload" | "new" | "resume" | "fork";
|
|
177
|
+
targetSessionFile?: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
166
180
|
export interface ExtensionAPI {
|
|
167
181
|
on(
|
|
168
182
|
event: "resources_discover",
|
|
@@ -172,6 +186,10 @@ declare module "@mariozechner/pi-coding-agent" {
|
|
|
172
186
|
event: "session_start",
|
|
173
187
|
handler: (event: SessionStartEvent, ctx: ExtensionContext) => void | Promise<void>,
|
|
174
188
|
): void;
|
|
189
|
+
on(
|
|
190
|
+
event: "session_shutdown",
|
|
191
|
+
handler: (event: SessionShutdownEvent, ctx: ExtensionContext) => void | Promise<void>,
|
|
192
|
+
): void;
|
|
175
193
|
|
|
176
194
|
registerCommand(
|
|
177
195
|
name: string,
|