pi-compact-tools 0.5.0 → 0.5.6

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.
@@ -0,0 +1,39 @@
1
+ import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
2
+ import type { Component } from "@earendil-works/pi-tui";
3
+ import type { DurationIndicatorConfig } from "./compact-tools-core.ts";
4
+
5
+ export const SUPPORTED_TOOLS = ["read", "write", "edit", "bash", "powershell", "grep", "find", "ls"] as const;
6
+ export const SUPPORTED_TOOL_SET = new Set<string>(SUPPORTED_TOOLS);
7
+
8
+ export type CompactToolName = (typeof SUPPORTED_TOOLS)[number];
9
+ export type ShellToolName = "bash" | "powershell";
10
+ export type ToolArgs = Record<string, unknown>;
11
+ export type BuiltInDefinition = ToolDefinition<any, any, any>;
12
+
13
+ export interface CompactToolsConfig {
14
+ tools: CompactToolName[];
15
+ auto_compact: Record<CompactToolName, boolean>;
16
+ spinner: {
17
+ frames: string[];
18
+ intervalMs: number;
19
+ };
20
+ durationIndicators: DurationIndicatorConfig[];
21
+ }
22
+
23
+ export interface RowState {
24
+ expanded?: boolean;
25
+ hasResult?: boolean;
26
+ lastHostExpanded?: boolean;
27
+ configRevision?: object;
28
+ frame?: number;
29
+ startedAt?: number;
30
+ endedAt?: number;
31
+ timer?: ReturnType<typeof setInterval>;
32
+ originalResultComponent?: Component;
33
+ }
34
+
35
+ type BaseRenderContext = Parameters<NonNullable<BuiltInDefinition["renderCall"]>>[2];
36
+ export type RenderContext<TArgs = ToolArgs> = Omit<BaseRenderContext, "args" | "state"> & {
37
+ args: TArgs;
38
+ state: RowState;
39
+ };