mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
- codemode:Tool Search 常驻(alwaysEnabled)、权限 allow(嵌套调用仍逐个过权限门)、 tools.jsonc 登记使用规则;RTK 跳过 parentToolCallId 嵌套调用,避免丢失 bash structuredContent;Tool Search 目录过滤 hidden / codemode(script-only)exposure; 扩展加载测试加载 builtin:codemode 并断言其常驻激活 - 搜索 key 不再经命令行参数传递:search-auth.mjs 改为 --set-stdin(先读校验再加锁), configure.sh 交互输入经管道、非交互用 --<provider> - - CodeGraph 客户端监听子进程 stdin error,避免 EPIPE 未处理导致崩溃 - 移除 PI_TOOL_SEARCH/HERMES_MEMORY/RTK_CONFIG_PATH 环境变量入口,测试改用工厂 configPath 注入 - pi-subagents 固定 vitest / coverage-istanbul 4.1.10,修复 npm ls 版本冲突 - 补 pi-web-search / pi-worktree UPSTREAM.md 与 pi-minimal-footer AGENTS.md, files 白名单补齐并加测试;.codegraph/.gitignore 移出跟踪 - detect_kitty 优先识别官方安装目录 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
206 lines
5.0 KiB
TypeScript
206 lines
5.0 KiB
TypeScript
declare module "@earendil-works/pi-tui" {
|
|
export interface SettingItem {
|
|
id: string;
|
|
label: string;
|
|
description: string;
|
|
currentValue: string;
|
|
values: string[];
|
|
}
|
|
|
|
export interface AutocompleteItem {
|
|
value: string;
|
|
label: string;
|
|
description?: string;
|
|
}
|
|
|
|
export class Box {
|
|
constructor(...args: unknown[]);
|
|
addChild(child: unknown): void;
|
|
}
|
|
|
|
export class Container {
|
|
constructor(...args: unknown[]);
|
|
addChild(child: unknown): void;
|
|
render(width: number): string[];
|
|
invalidate(): void;
|
|
}
|
|
|
|
export class SettingsList {
|
|
constructor(...args: unknown[]);
|
|
render(width: number): string[];
|
|
invalidate(): void;
|
|
handleInput(data: string): void;
|
|
updateValue(id: string, value: string): void;
|
|
}
|
|
|
|
export class Spacer {
|
|
constructor(...args: unknown[]);
|
|
}
|
|
|
|
export class Text {
|
|
constructor(...args: unknown[]);
|
|
}
|
|
|
|
export function truncateToWidth(text: string, width: number, suffix?: string, pad?: boolean): string;
|
|
export function visibleWidth(text: string): number;
|
|
}
|
|
|
|
declare module "@earendil-works/pi-coding-agent" {
|
|
interface UiLike {
|
|
notify(message: string, level: "info" | "warning" | "error"): void;
|
|
custom<T>(
|
|
renderer: (
|
|
tui: { requestRender(): void },
|
|
theme: Theme,
|
|
keybindings: unknown,
|
|
done: () => void,
|
|
) => {
|
|
render(width: number): string[];
|
|
invalidate?(): void;
|
|
handleInput(data: string): void;
|
|
},
|
|
options?: Record<string, unknown>,
|
|
): Promise<T>;
|
|
}
|
|
|
|
export interface ExtensionContext {
|
|
hasUI: boolean;
|
|
cwd?: string;
|
|
ui: UiLike;
|
|
}
|
|
|
|
export interface ExtensionCommandContext extends ExtensionContext {}
|
|
|
|
export interface ToolResultEvent {
|
|
toolName: string;
|
|
input: Record<string, unknown>;
|
|
content: Array<Record<string, unknown>>;
|
|
details?: unknown;
|
|
parentToolCallId?: string;
|
|
}
|
|
|
|
export interface BashToolCallEvent {
|
|
toolName: "bash";
|
|
input: { command: string } & Record<string, unknown>;
|
|
}
|
|
|
|
type MaybePromise<T> = T | Promise<T>;
|
|
|
|
export interface Theme {
|
|
fg(color: string, text: string): string;
|
|
bold(text: string): string;
|
|
getFgAnsi?(name: string): string;
|
|
}
|
|
|
|
export function getAgentDir(): string;
|
|
export function getSettingsListTheme(): unknown;
|
|
|
|
export interface ExtensionAPI {
|
|
exec(
|
|
command: string,
|
|
args: string[],
|
|
options?: { timeout?: number },
|
|
): Promise<{ code: number; stdout: string; stderr: string }>;
|
|
|
|
on(
|
|
eventName: "tool_call",
|
|
handler: (
|
|
event: Record<string, unknown>,
|
|
ctx: ExtensionContext,
|
|
) => MaybePromise<Record<string, unknown> | void>,
|
|
): void;
|
|
|
|
on(
|
|
eventName: "tool_result",
|
|
handler: (
|
|
event: ToolResultEvent,
|
|
ctx: ExtensionContext,
|
|
) => MaybePromise<Record<string, unknown> | void>,
|
|
): void;
|
|
|
|
on(
|
|
eventName: "before_agent_start",
|
|
handler: (
|
|
event: {
|
|
systemPrompt: string;
|
|
systemPromptOptions?: { promptGuidelines?: string[] } & Record<string, unknown>;
|
|
},
|
|
ctx: ExtensionContext,
|
|
) => MaybePromise<{ systemPrompt: string } | Record<string, unknown> | void>,
|
|
): void;
|
|
|
|
on(
|
|
eventName: string,
|
|
handler: (event: Record<string, unknown>, ctx: ExtensionContext) => MaybePromise<Record<string, unknown> | void>,
|
|
): void;
|
|
|
|
registerCommand(
|
|
name: string,
|
|
definition: {
|
|
description: string;
|
|
getArgumentCompletions?: (argumentPrefix: string) => Array<{ value: string; label: string; description?: string }> | null;
|
|
handler: (args: string, ctx: ExtensionCommandContext) => MaybePromise<void>;
|
|
},
|
|
): void;
|
|
}
|
|
|
|
export function isToolCallEventType(
|
|
toolName: "bash",
|
|
event: Record<string, unknown>,
|
|
): event is BashToolCallEvent;
|
|
|
|
export function isToolCallEventType(
|
|
toolName: string,
|
|
event: Record<string, unknown>,
|
|
): boolean;
|
|
}
|
|
|
|
|
|
declare module "node:assert/strict" {
|
|
const assert: {
|
|
equal(actual: unknown, expected: unknown, message?: string): void;
|
|
deepEqual(actual: unknown, expected: unknown, message?: string): void;
|
|
ok(value: unknown, message?: string): void;
|
|
};
|
|
|
|
export default assert;
|
|
}
|
|
|
|
declare module "node:test" {
|
|
export const mock: {
|
|
module(specifier: string, options: { namedExports?: Record<string, unknown>; defaultExport?: unknown }): void;
|
|
};
|
|
}
|
|
|
|
declare module "bun:test" {
|
|
export const mock: {
|
|
module(specifier: string, factory: () => Record<string, unknown>): void;
|
|
};
|
|
}
|
|
|
|
declare const process: {
|
|
platform: string;
|
|
env: Record<string, string | undefined>;
|
|
cwd(): string;
|
|
};
|
|
|
|
declare module "node:os" {
|
|
export function homedir(): string;
|
|
}
|
|
|
|
declare module "node:path" {
|
|
export function join(...segments: string[]): string;
|
|
export function dirname(path: string): string;
|
|
export function resolve(...segments: string[]): string;
|
|
export const sep: string;
|
|
}
|
|
|
|
declare module "node:fs" {
|
|
export function existsSync(path: string): boolean;
|
|
export function mkdirSync(path: string, options?: { recursive?: boolean }): void;
|
|
export function readFileSync(path: string, encoding: "utf-8"): string;
|
|
export function renameSync(oldPath: string, newPath: string): void;
|
|
export function unlinkSync(path: string): void;
|
|
export function writeFileSync(path: string, data: string, encoding: "utf-8"): void;
|
|
}
|