forked from mjakl/pi-subagent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshims.d.ts
More file actions
132 lines (122 loc) · 4.32 KB
/
Copy pathshims.d.ts
File metadata and controls
132 lines (122 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
declare module "@mariozechner/pi-ai" {
export interface ModelUsage {
input?: number;
output?: number;
cacheRead?: number;
cacheWrite?: number;
totalTokens?: number;
cost?: number;
contextTokens?: number;
}
export type Message = any;
export function createAssistantMessageEventStream(): any;
export function createProvider(options: any): any;
export function lazyStream(model: any, setup: () => Promise<any>): any;
export type AssistantMessageEventStream = any;
export type ProviderStreams = { stream: (...args: any[]) => any; streamSimple: (...args: any[]) => any };
// First-class faux provider primitives used by the synthetic resume provider.
export function createFauxCore(options: any): {
api: string;
provider: string;
models: any[];
stream: (...args: any[]) => any;
streamSimple: (...args: any[]) => any;
getModel: (id?: string) => any;
state: { callCount: number };
setResponses: (responses: any[]) => void;
appendResponses: (responses: any[]) => void;
getPendingResponseCount: () => number;
};
export function fauxAssistantMessage(content: any, options?: any): any;
export function fauxToolCall(name: string, args: any, options?: { id?: string }): any;
export function fauxText(text: string): any;
}
declare module "@mariozechner/pi-ai/api/openai-responses.lazy" {
export const openAIResponsesApi: () => any;
}
declare module "@mariozechner/pi-ai/api/openai-completions.lazy" {
export const openAICompletionsApi: () => any;
}
declare module "@mariozechner/pi-ai/api/azure-openai-responses.lazy" {
export const azureOpenAIResponsesApi: () => any;
}
declare module "@mariozechner/pi-ai/api/openai-codex-responses.lazy" {
export const openAICodexResponsesApi: () => any;
}
declare module "@mariozechner/pi-ai/api/anthropic-messages.lazy" {
export const anthropicMessagesApi: () => any;
}
declare module "@mariozechner/pi-ai/api/bedrock-converse-stream.lazy" {
export const bedrockConverseStreamApi: () => any;
}
declare module "@mariozechner/pi-ai/api/google-generative-ai.lazy" {
export const googleGenerativeAIApi: () => any;
}
declare module "@mariozechner/pi-ai/api/google-vertex.lazy" {
export const googleVertexApi: () => any;
}
declare module "@mariozechner/pi-ai/api/mistral-conversations.lazy" {
export const mistralConversationsApi: () => any;
}
declare module "@mariozechner/pi-ai/api/pi-messages.lazy" {
export const piMessagesApi: () => any;
}
declare module "@mariozechner/pi-agent-core" {
export interface AgentToolResult<TDetails = unknown> {
content: Array<{ type: string; text?: string }>;
details?: TDetails;
isError?: boolean;
}
}
declare module "@mariozechner/pi-coding-agent" {
export interface ExtensionContext {
cwd: string;
model?: any;
hasUI?: boolean;
ui?: any;
sessionManager: {
getEntries: () => any[];
getSessionDir: () => string | undefined;
getLeafId: () => string | undefined;
getBranch: (leafId: string) => any[] | undefined;
};
}
export interface ExtensionAPI {
registerFlag(name: string, config: any): void;
getFlag(name: string): unknown;
registerProvider(provider: any): void;
registerProvider(name: string, provider: any): void;
registerTool(tool: any): void;
addBeforeAgentStart(hook: (ctx: ExtensionContext) => unknown): void;
addBeforeRequest(hook: (event: any, ctx: any) => unknown): void;
addAfterMessage(hook: (event: any, ctx: any) => unknown): void;
setModel(model: any): Promise<boolean> | boolean;
[key: string]: any;
}
export function getAgentDir(): string;
export function parseFrontmatter<T extends Record<string, unknown>>(content: string): { frontmatter: T; body: string };
}
declare module "@mariozechner/pi-tui" {
export class Text {
constructor(text: string, x?: number, y?: number);
}
export class Spacer {
constructor(size?: number);
}
export class Container {
addChild(child: unknown): void;
}
export function truncateToWidth(text: string, width: number, ellipsis?: string): string;
export function visibleWidth(text: string): number;
}
declare module "express" {
export interface Request {
method: string;
path: string;
}
export interface Response {
statusCode: number;
on(event: "finish", listener: () => void): void;
}
export type NextFunction = () => void;
}