repositories / pi-ext
pi-ext
bugabingas pi extensions
owned by bugabinga
extensions/prune/src/types.ts
RawFile outline
- Message line 7
- role line 8
- content line 17
- toolName line 18
- toolCallId line 19
- isError line 20
- thinking line 21
- redacted line 22
- ContentPart line 25
- type line 26
- text line 27
- name line 28
- arguments line 29
- thinking line 30
- redacted line 31
- mimeType line 32
- BlockKind line 37
- Block line 44
- kind line 45
- text line 46
- sourceIndex line 47
- name line 48
- args line 49
- isError line 50
- ExtractOutput line 55
- goals line 56
- scopeChanges line 57
- files line 58
- context line 63
- preferences line 64
- transcript line 65
- TranscriptEntry line 68
- role line 69
- text line 70
- tool line 71
- cmd line 72
- ref line 73
- count line 74
- PruneOutput line 79
- summary line 80
- stats line 81
- PruneStats line 84
- messagesIn line 85
- messagesOut line 86
- reduction line 87
- elapsedMs line 88
- SearchScope line 93
- SearchInput line 95
- query line 96
- scope line 97
- limit line 98
- expand line 99
- SearchResult line 102
- index line 103
- entry line 104
- role line 105
- score line 106
- context line 107
- PruneSettings line 112
- overrideDefault line 113
- sectionLimit line 114
- transcriptLimit line 115
- toolCapPerTurn line 116
- debug line 117
/**
* prune — types
*/
// ─── Core Types ────────────────────────────────────────────────────────────────
export interface Message {
role:
| "user"
| "assistant"
| "tool"
| "toolResult"
| "bashExecution"
| "custom"
| "branchSummary"
| "compactionSummary";
content?: string | ContentPart[];
toolName?: string;
toolCallId?: string;
isError?: boolean;
thinking?: string;
redacted?: boolean;
}
export interface ContentPart {
type: "text" | "toolCall" | "thinking" | "image";
text?: string;
name?: string;
arguments?: Record<string, unknown>;
thinking?: string;
redacted?: boolean;
mimeType?: string;
}
// ─── Block Types ──────────────────────────────────────────────────────────────
export type BlockKind =
| "user"
| "assistant"
| "tool_call"
| "tool_result"
| "thinking";
export interface Block {
kind: BlockKind;
text: string;
sourceIndex: number;
name?: string;
args?: Record<string, unknown>;
isError?: boolean;
}
// ─── Extract Output ───────────────────────────────────────────────────────────
export interface ExtractOutput {
goals: string[];
scopeChanges: string[];
files: {
modified: Set<string>;
created: Set<string>;
read: Set<string>;
};
context: string[];
preferences: string[];
transcript: TranscriptEntry[];
}
export interface TranscriptEntry {
role: "user" | "assistant" | "error";
text: string;
tool?: string;
cmd?: string;
ref?: string;
count?: number;
}
// ─── Prune Output ────────────────────────────────────────────────────────────
export interface PruneOutput {
summary: string;
stats: PruneStats;
}
export interface PruneStats {
messagesIn: number;
messagesOut: number;
reduction: number;
elapsedMs: number;
}
// ─── Search Types ─────────────────────────────────────────────────────────────
export type SearchScope = "lineage" | "all";
export interface SearchInput {
query: string | RegExp;
scope?: SearchScope;
limit?: number;
expand?: number[];
}
export interface SearchResult {
index: number;
entry: Message;
role: "user" | "assistant" | "tool";
score: number;
context?: string;
}
// ─── Settings ────────────────────────────────────────────────────────────────
export interface PruneSettings {
overrideDefault?: boolean;
sectionLimit?: number;
transcriptLimit?: number;
toolCapPerTurn?: number;
debug?: boolean;
}