pi-agent-flow 1.8.1 → 1.8.3
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/README.md +4 -30
- package/agents/audit.md +1 -2
- package/agents/build.md +1 -0
- package/agents/craft.md +12 -8
- package/agents/debug.md +2 -2
- package/agents/ideas.md +1 -0
- package/agents/scout.md +1 -0
- package/dist/agents.d.ts +41 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +283 -0
- package/dist/agents.js.map +1 -0
- package/dist/batch/batch-bash.d.ts +87 -0
- package/dist/batch/batch-bash.d.ts.map +1 -0
- package/dist/batch/batch-bash.js +369 -0
- package/dist/batch/batch-bash.js.map +1 -0
- package/dist/batch/constants.d.ts +100 -0
- package/dist/batch/constants.d.ts.map +1 -0
- package/dist/batch/constants.js +15 -0
- package/dist/batch/constants.js.map +1 -0
- package/dist/batch/execute.d.ts +21 -0
- package/dist/batch/execute.d.ts.map +1 -0
- package/dist/batch/execute.js +440 -0
- package/dist/batch/execute.js.map +1 -0
- package/dist/batch/fuzzy-edit.d.ts +29 -0
- package/dist/batch/fuzzy-edit.d.ts.map +1 -0
- package/dist/batch/fuzzy-edit.js +257 -0
- package/dist/batch/fuzzy-edit.js.map +1 -0
- package/dist/batch/index.d.ts +85 -0
- package/dist/batch/index.d.ts.map +1 -0
- package/dist/batch/index.js +422 -0
- package/dist/batch/index.js.map +1 -0
- package/dist/batch/render.d.ts +14 -0
- package/dist/batch/render.d.ts.map +1 -0
- package/dist/batch/render.js +74 -0
- package/dist/batch/render.js.map +1 -0
- package/dist/batch/symbols.d.ts +9 -0
- package/dist/batch/symbols.d.ts.map +1 -0
- package/dist/batch/symbols.js +310 -0
- package/dist/batch/symbols.js.map +1 -0
- package/dist/batch.d.ts +12 -0
- package/dist/batch.d.ts.map +1 -0
- package/dist/batch.js +11 -0
- package/dist/batch.js.map +1 -0
- package/dist/cli-args.d.ts +27 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +265 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/config.d.ts +58 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +296 -0
- package/dist/config.js.map +1 -0
- package/dist/depth.d.ts +25 -0
- package/dist/depth.d.ts.map +1 -0
- package/dist/depth.js +160 -0
- package/dist/depth.js.map +1 -0
- package/dist/executor.d.ts +87 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +295 -0
- package/dist/executor.js.map +1 -0
- package/dist/flow-prompt.d.ts +23 -0
- package/dist/flow-prompt.d.ts.map +1 -0
- package/dist/flow-prompt.js +99 -0
- package/dist/flow-prompt.js.map +1 -0
- package/dist/flow.d.ts +76 -0
- package/dist/flow.d.ts.map +1 -0
- package/dist/flow.js +704 -0
- package/dist/flow.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +327 -0
- package/dist/index.js.map +1 -0
- package/dist/reasoning-strip.d.ts +26 -0
- package/dist/reasoning-strip.d.ts.map +1 -0
- package/dist/reasoning-strip.js +58 -0
- package/dist/reasoning-strip.js.map +1 -0
- package/dist/render-utils.d.ts +42 -0
- package/dist/render-utils.d.ts.map +1 -0
- package/dist/render-utils.js +182 -0
- package/dist/render-utils.js.map +1 -0
- package/dist/render.d.ts +24 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +409 -0
- package/dist/render.js.map +1 -0
- package/dist/runner-events.d.ts +59 -0
- package/dist/runner-events.d.ts.map +1 -0
- package/dist/runner-events.js +539 -0
- package/dist/runner-events.js.map +1 -0
- package/dist/session-mode.d.ts +10 -0
- package/dist/session-mode.d.ts.map +1 -0
- package/dist/session-mode.js +25 -0
- package/dist/session-mode.js.map +1 -0
- package/dist/settings-resolver.d.ts +28 -0
- package/dist/settings-resolver.d.ts.map +1 -0
- package/dist/settings-resolver.js +148 -0
- package/dist/settings-resolver.js.map +1 -0
- package/dist/sliding-prompt.d.ts +40 -0
- package/dist/sliding-prompt.d.ts.map +1 -0
- package/dist/sliding-prompt.js +121 -0
- package/dist/sliding-prompt.js.map +1 -0
- package/dist/snapshot.d.ts +29 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +199 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/structured-output.d.ts +36 -0
- package/dist/structured-output.d.ts.map +1 -0
- package/dist/structured-output.js +244 -0
- package/dist/structured-output.js.map +1 -0
- package/dist/timed-bash.d.ts +45 -0
- package/dist/timed-bash.d.ts.map +1 -0
- package/dist/timed-bash.js +219 -0
- package/dist/timed-bash.js.map +1 -0
- package/dist/tool-utils.d.ts +20 -0
- package/dist/tool-utils.d.ts.map +1 -0
- package/dist/tool-utils.js +38 -0
- package/dist/tool-utils.js.map +1 -0
- package/dist/transitions.d.ts +39 -0
- package/dist/transitions.d.ts.map +1 -0
- package/dist/transitions.js +59 -0
- package/dist/transitions.js.map +1 -0
- package/dist/types.d.ts +207 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +143 -0
- package/dist/types.js.map +1 -0
- package/dist/web-tool.d.ts +35 -0
- package/dist/web-tool.d.ts.map +1 -0
- package/dist/web-tool.js +545 -0
- package/dist/web-tool.js.map +1 -0
- package/package.json +7 -5
- package/src/agents.ts +0 -299
- package/src/ambient.d.ts +0 -107
- package/src/batch/batch-bash.ts +0 -443
- package/src/batch/constants.ts +0 -128
- package/src/batch/execute.ts +0 -551
- package/src/batch/fuzzy-edit.ts +0 -323
- package/src/batch/index.ts +0 -494
- package/src/batch/render.ts +0 -81
- package/src/batch/symbols.ts +0 -341
- package/src/batch.ts +0 -28
- package/src/cli-args.ts +0 -315
- package/src/config.ts +0 -391
- package/src/executor.ts +0 -445
- package/src/flow.ts +0 -834
- package/src/hooks.ts +0 -294
- package/src/index.ts +0 -1132
- package/src/render-utils.ts +0 -205
- package/src/render.ts +0 -524
- package/src/runner-events.ts +0 -692
- package/src/session-mode.ts +0 -33
- package/src/sliding-prompt.ts +0 -144
- package/src/structured-output.ts +0 -195
- package/src/timed-bash.ts +0 -270
- package/src/transitions.ts +0 -86
- package/src/types.ts +0 -386
- package/src/web-tool.ts +0 -663
package/src/agents.ts
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flow discovery and configuration.
|
|
3
|
-
*
|
|
4
|
-
* Flows are Markdown files with YAML frontmatter that define name, description,
|
|
5
|
-
* optional model/tools, and a system prompt body.
|
|
6
|
-
*
|
|
7
|
-
* Lookup locations:
|
|
8
|
-
* - User flows: ~/.pi/agent/agents/*.md by default, or
|
|
9
|
-
* $PI_CODING_AGENT_DIR/agents/*.md when the env var is set
|
|
10
|
-
* - Project flows: .pi/agents/*.md (walks up from cwd)
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { parseFrontmatter } from "@mariozechner/pi-coding-agent";
|
|
14
|
-
import * as fs from "node:fs";
|
|
15
|
-
import * as os from "node:os";
|
|
16
|
-
import * as path from "node:path";
|
|
17
|
-
|
|
18
|
-
export type FlowScope = "user" | "project" | "both" | "bundled" | "all";
|
|
19
|
-
|
|
20
|
-
export type FlowTier = "lite" | "flash" | "full";
|
|
21
|
-
|
|
22
|
-
export interface FlowConfig {
|
|
23
|
-
name: string;
|
|
24
|
-
description: string;
|
|
25
|
-
tools?: string[];
|
|
26
|
-
model?: string;
|
|
27
|
-
thinking?: string;
|
|
28
|
-
maxDepth?: number;
|
|
29
|
-
inheritContext?: boolean;
|
|
30
|
-
tier?: FlowTier;
|
|
31
|
-
systemPrompt: string;
|
|
32
|
-
source: "user" | "project" | "bundled";
|
|
33
|
-
filePath: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface FlowDiscoveryResult {
|
|
37
|
-
flows: FlowConfig[];
|
|
38
|
-
projectFlowsDir: string | null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** Determine the model tier for a given flow name. */
|
|
42
|
-
export function getFlowTier(flowName: string): FlowTier {
|
|
43
|
-
const normalized = flowName.toLowerCase().trim();
|
|
44
|
-
switch (normalized) {
|
|
45
|
-
case "scout":
|
|
46
|
-
case "debug":
|
|
47
|
-
return "lite";
|
|
48
|
-
case "build":
|
|
49
|
-
case "audit":
|
|
50
|
-
return "flash";
|
|
51
|
-
case "ideas":
|
|
52
|
-
case "craft":
|
|
53
|
-
return "full";
|
|
54
|
-
default:
|
|
55
|
-
return "flash";
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** Return the bundled flow names associated with a given tier. */
|
|
60
|
-
export function getTierFlowNames(tier: FlowTier): string[] {
|
|
61
|
-
switch (tier) {
|
|
62
|
-
case "lite":
|
|
63
|
-
return ["scout", "debug"];
|
|
64
|
-
case "flash":
|
|
65
|
-
return ["build", "audit"];
|
|
66
|
-
case "full":
|
|
67
|
-
return ["ideas", "craft"];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// ---------------------------------------------------------------------------
|
|
72
|
-
// Internal helpers
|
|
73
|
-
// ---------------------------------------------------------------------------
|
|
74
|
-
|
|
75
|
-
function isDirectory(p: string): boolean {
|
|
76
|
-
try { return fs.statSync(p).isDirectory(); } catch { return false; }
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function getUserFlowsDir(): string {
|
|
80
|
-
const configDir = process.env["PI_CODING_AGENT_DIR"]?.trim() || path.join(os.homedir(), ".pi", "agent");
|
|
81
|
-
return path.join(configDir, "agents");
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** Get the bundled flows directory from the plugin's location. */
|
|
85
|
-
function getBundledFlowsDir(): string {
|
|
86
|
-
// Method 1: import.meta.url (ESM)
|
|
87
|
-
// When source lives in src/, agents/ is one level up at the package root.
|
|
88
|
-
try {
|
|
89
|
-
if (import.meta.url) {
|
|
90
|
-
const pluginDir = path.dirname(new URL(import.meta.url).pathname);
|
|
91
|
-
// Check same directory first, then parent (for src/ layout)
|
|
92
|
-
for (const base of [pluginDir, path.dirname(pluginDir)]) {
|
|
93
|
-
const dir = path.join(base, "agents");
|
|
94
|
-
if (fs.existsSync(dir)) return dir;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
} catch {}
|
|
98
|
-
|
|
99
|
-
// Method 2: __dirname (CommonJS / jiti)
|
|
100
|
-
try {
|
|
101
|
-
if (typeof __dirname !== "undefined") {
|
|
102
|
-
for (const base of [__dirname, path.dirname(__dirname)]) {
|
|
103
|
-
const dir = path.join(base, "agents");
|
|
104
|
-
if (fs.existsSync(dir)) return dir;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
} catch {}
|
|
108
|
-
|
|
109
|
-
// Method 3: Find from require.resolve
|
|
110
|
-
try {
|
|
111
|
-
const resolved = require.resolve("pi-agent-flow/package.json");
|
|
112
|
-
const dir = path.join(path.dirname(resolved), "agents");
|
|
113
|
-
if (fs.existsSync(dir)) return dir;
|
|
114
|
-
} catch {}
|
|
115
|
-
|
|
116
|
-
// Fallback: cwd
|
|
117
|
-
return path.join(process.cwd(), "agents");
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** Walk up from `cwd` looking for a `.pi/agents` directory. */
|
|
121
|
-
function findNearestProjectFlowsDir(cwd: string): string | null {
|
|
122
|
-
let dir = cwd;
|
|
123
|
-
while (true) {
|
|
124
|
-
const candidate = path.join(dir, ".pi", "agents");
|
|
125
|
-
if (isDirectory(candidate)) return candidate;
|
|
126
|
-
const parent = path.dirname(dir);
|
|
127
|
-
if (parent === dir) return null;
|
|
128
|
-
dir = parent;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** Parse a single flow markdown file into a FlowConfig. Returns null on skip. */
|
|
133
|
-
function parseFlowFile(filePath: string, source: "user" | "project" | "bundled"): FlowConfig | null {
|
|
134
|
-
let content: string;
|
|
135
|
-
try { content = fs.readFileSync(filePath, "utf-8"); } catch { return null; }
|
|
136
|
-
|
|
137
|
-
let parsed: { frontmatter: Record<string, unknown>; body: string };
|
|
138
|
-
try {
|
|
139
|
-
parsed = parseFrontmatter<Record<string, unknown>>(content);
|
|
140
|
-
} catch (err) {
|
|
141
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
142
|
-
console.warn(`[pi-agent-flow] Skipping invalid flow file "${filePath}": ${message}`);
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const frontmatter = parsed.frontmatter ?? {};
|
|
147
|
-
const body = parsed.body ?? "";
|
|
148
|
-
|
|
149
|
-
const name = typeof frontmatter.name === "string" ? frontmatter.name.trim().toLowerCase() : "";
|
|
150
|
-
const description = typeof frontmatter.description === "string" ? frontmatter.description.trim() : "";
|
|
151
|
-
if (!name || !description) {
|
|
152
|
-
if (!name) console.warn(`[pi-agent-flow] Skipping flow file "${filePath}": missing or empty 'name' field.`);
|
|
153
|
-
if (!description) console.warn(`[pi-agent-flow] Skipping flow file "${filePath}": missing or empty 'description' field.`);
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Warn about unknown frontmatter keys
|
|
158
|
-
const knownKeys = new Set([
|
|
159
|
-
"name", "description", "tools", "model", "thinking",
|
|
160
|
-
"maxDepth", "inheritContext", "tier",
|
|
161
|
-
]);
|
|
162
|
-
for (const key of Object.keys(frontmatter)) {
|
|
163
|
-
if (!knownKeys.has(key)) {
|
|
164
|
-
console.warn(`[pi-agent-flow] Unknown frontmatter key "${key}" in "${filePath}". This field will be ignored.`);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
let tools: string[] | undefined;
|
|
169
|
-
if (typeof frontmatter.tools === "string") {
|
|
170
|
-
const parsedTools = frontmatter.tools
|
|
171
|
-
.split(",")
|
|
172
|
-
.map((t) => t.trim())
|
|
173
|
-
.filter(Boolean);
|
|
174
|
-
if (parsedTools.length > 0) tools = parsedTools;
|
|
175
|
-
} else if (Array.isArray(frontmatter.tools)) {
|
|
176
|
-
const parsedTools = frontmatter.tools
|
|
177
|
-
.filter((t): t is string => typeof t === "string")
|
|
178
|
-
.map((t) => t.trim())
|
|
179
|
-
.filter(Boolean);
|
|
180
|
-
if (parsedTools.length > 0) tools = parsedTools;
|
|
181
|
-
} else if (frontmatter.tools !== undefined) {
|
|
182
|
-
console.warn(
|
|
183
|
-
`[pi-agent-flow] Ignoring invalid tools field in "${filePath}". Expected a comma-separated string or string array.`,
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
let maxDepth: number | undefined;
|
|
188
|
-
if (typeof frontmatter.maxDepth === "number") {
|
|
189
|
-
maxDepth = frontmatter.maxDepth;
|
|
190
|
-
} else if (typeof frontmatter.maxDepth === "string") {
|
|
191
|
-
const parsed = Number(frontmatter.maxDepth);
|
|
192
|
-
if (Number.isFinite(parsed) && parsed >= 0) maxDepth = parsed;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
let inheritContext: boolean | undefined;
|
|
196
|
-
if (typeof frontmatter.inheritContext === "boolean") {
|
|
197
|
-
inheritContext = frontmatter.inheritContext;
|
|
198
|
-
} else if (typeof frontmatter.inheritContext === "string") {
|
|
199
|
-
const normalized = frontmatter.inheritContext.trim().toLowerCase();
|
|
200
|
-
if (normalized === "true" || normalized === "yes" || normalized === "1") {
|
|
201
|
-
inheritContext = true;
|
|
202
|
-
} else if (normalized === "false" || normalized === "no" || normalized === "0") {
|
|
203
|
-
inheritContext = false;
|
|
204
|
-
} else {
|
|
205
|
-
console.warn(
|
|
206
|
-
`[pi-agent-flow] Ignoring invalid inheritContext value "${frontmatter.inheritContext}" in "${filePath}". Expected true/false.`,
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
} else if (frontmatter.inheritContext !== undefined) {
|
|
210
|
-
console.warn(
|
|
211
|
-
`[pi-agent-flow] Ignoring invalid inheritContext field in "${filePath}". Expected boolean or string.`,
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Tier: prefer explicit frontmatter, fall back to name-based inference
|
|
216
|
-
let tier: FlowTier | undefined;
|
|
217
|
-
if (typeof frontmatter.tier === "string") {
|
|
218
|
-
const normalized = frontmatter.tier.trim().toLowerCase();
|
|
219
|
-
if (normalized === "lite" || normalized === "flash" || normalized === "full") {
|
|
220
|
-
tier = normalized;
|
|
221
|
-
} else {
|
|
222
|
-
console.warn(`[pi-agent-flow] Ignoring invalid tier "${frontmatter.tier}" in "${filePath}". Expected lite, flash, or full.`);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return {
|
|
227
|
-
name,
|
|
228
|
-
description,
|
|
229
|
-
tools,
|
|
230
|
-
model: typeof frontmatter.model === "string" ? frontmatter.model : undefined,
|
|
231
|
-
thinking: typeof frontmatter.thinking === "string" ? frontmatter.thinking : undefined,
|
|
232
|
-
maxDepth,
|
|
233
|
-
inheritContext,
|
|
234
|
-
tier: tier ?? getFlowTier(name),
|
|
235
|
-
systemPrompt: body,
|
|
236
|
-
source,
|
|
237
|
-
filePath,
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/** Load all flow definitions from a directory. */
|
|
242
|
-
function loadFlowsFromDir(dir: string, source: "user" | "project" | "bundled"): FlowConfig[] {
|
|
243
|
-
if (!fs.existsSync(dir)) return [];
|
|
244
|
-
|
|
245
|
-
let entries: fs.Dirent[];
|
|
246
|
-
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return []; }
|
|
247
|
-
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
248
|
-
|
|
249
|
-
const flows: FlowConfig[] = [];
|
|
250
|
-
for (const entry of entries) {
|
|
251
|
-
if (!entry.name.endsWith(".md")) continue;
|
|
252
|
-
if (!entry.isFile() && !entry.isSymbolicLink()) continue;
|
|
253
|
-
|
|
254
|
-
const flow = parseFlowFile(path.join(dir, entry.name), source);
|
|
255
|
-
if (flow) flows.push(flow);
|
|
256
|
-
}
|
|
257
|
-
return flows;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function mergeFlows(...groups: FlowConfig[][]): FlowConfig[] {
|
|
261
|
-
const flowMap = new Map<string, FlowConfig>();
|
|
262
|
-
for (const group of groups) {
|
|
263
|
-
for (const flow of group) flowMap.set(flow.name.toLowerCase(), flow);
|
|
264
|
-
}
|
|
265
|
-
return Array.from(flowMap.values());
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// ---------------------------------------------------------------------------
|
|
269
|
-
// Public API
|
|
270
|
-
// ---------------------------------------------------------------------------
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Discover all available flows according to the requested scope.
|
|
274
|
-
*
|
|
275
|
-
* Precedence is: bundled < user < project.
|
|
276
|
-
*/
|
|
277
|
-
export function discoverFlows(cwd: string, scope: FlowScope): FlowDiscoveryResult {
|
|
278
|
-
const bundledFlowsDir = getBundledFlowsDir();
|
|
279
|
-
const userFlowsDir = getUserFlowsDir();
|
|
280
|
-
const projectFlowsDir = findNearestProjectFlowsDir(cwd);
|
|
281
|
-
|
|
282
|
-
const bundledFlows = scope === "user" || scope === "project" ? [] : loadFlowsFromDir(bundledFlowsDir, "bundled");
|
|
283
|
-
const userFlows = scope === "project" || scope === "bundled" ? [] : loadFlowsFromDir(userFlowsDir, "user");
|
|
284
|
-
const projectFlows = scope === "user" || scope === "bundled" || !projectFlowsDir ? [] : loadFlowsFromDir(projectFlowsDir, "project");
|
|
285
|
-
|
|
286
|
-
if (scope === "bundled") {
|
|
287
|
-
return { flows: bundledFlows, projectFlowsDir };
|
|
288
|
-
}
|
|
289
|
-
if (scope === "user") {
|
|
290
|
-
return { flows: mergeFlows(bundledFlows, userFlows), projectFlowsDir };
|
|
291
|
-
}
|
|
292
|
-
if (scope === "project") {
|
|
293
|
-
return { flows: mergeFlows(projectFlows), projectFlowsDir };
|
|
294
|
-
}
|
|
295
|
-
return {
|
|
296
|
-
flows: mergeFlows(bundledFlows, userFlows, projectFlows),
|
|
297
|
-
projectFlowsDir,
|
|
298
|
-
};
|
|
299
|
-
}
|
package/src/ambient.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/** Minimal ambient declarations for peer dependencies */
|
|
2
|
-
|
|
3
|
-
declare module "@mariozechner/pi-coding-agent" {
|
|
4
|
-
export interface ExtensionAPI {
|
|
5
|
-
registerFlag(name: string, config: { description: string; type: string }): void;
|
|
6
|
-
getFlag(name: string): unknown;
|
|
7
|
-
getActiveTools(): string[];
|
|
8
|
-
on(event: string, callback: (...args: any[]) => any): void;
|
|
9
|
-
emit(event: string, ...args: any[]): void;
|
|
10
|
-
registerTool(tool: {
|
|
11
|
-
name: string;
|
|
12
|
-
label: string;
|
|
13
|
-
description: string;
|
|
14
|
-
parameters: any;
|
|
15
|
-
execute: (...args: any[]) => Promise<any>;
|
|
16
|
-
renderCall?: (...args: any[]) => any;
|
|
17
|
-
renderResult?: (...args: any[]) => any;
|
|
18
|
-
}): void;
|
|
19
|
-
setActiveTools(tools: string[]): void;
|
|
20
|
-
}
|
|
21
|
-
export interface ExtensionContext {
|
|
22
|
-
cwd: string;
|
|
23
|
-
hasUI: boolean;
|
|
24
|
-
ui: { confirm: (title: string, body: string) => Promise<boolean> };
|
|
25
|
-
sessionManager: { getSessionDir(): string; getHeader(): unknown; getBranch(): unknown[] };
|
|
26
|
-
}
|
|
27
|
-
export function parseFrontmatter<T extends Record<string, unknown>>(content: string): { frontmatter: T; body: string };
|
|
28
|
-
export function getMarkdownTheme(): any;
|
|
29
|
-
export const DEFAULT_MAX_BYTES: number;
|
|
30
|
-
export const DEFAULT_MAX_LINES: number;
|
|
31
|
-
export function truncateHead(text: string, options: { maxBytes?: number; maxLines?: number }): { content: string };
|
|
32
|
-
export function createBashToolDefinition(
|
|
33
|
-
cwd: string,
|
|
34
|
-
options?: {
|
|
35
|
-
shellPath?: string;
|
|
36
|
-
commandPrefix?: string;
|
|
37
|
-
operations?: any;
|
|
38
|
-
spawnHook?: any;
|
|
39
|
-
},
|
|
40
|
-
): {
|
|
41
|
-
name: string;
|
|
42
|
-
label: string;
|
|
43
|
-
description: string;
|
|
44
|
-
parameters: any;
|
|
45
|
-
execute: (...args: any[]) => Promise<any>;
|
|
46
|
-
renderCall?: (...args: any[]) => any;
|
|
47
|
-
renderResult?: (...args: any[]) => any;
|
|
48
|
-
};
|
|
49
|
-
/** Test-only exports provided by tests/__mocks__/pi-coding-agent.ts. */
|
|
50
|
-
export const bashToolExecuteCalls: any[][];
|
|
51
|
-
export function __setBashToolExecuteImpl(fn: (...args: any[]) => Promise<any>): void;
|
|
52
|
-
export function __resetBashToolMock(): void;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
declare module "@mariozechner/pi-tui" {
|
|
56
|
-
export class Text {
|
|
57
|
-
constructor(text: string, width: number, height: number);
|
|
58
|
-
toString(): string;
|
|
59
|
-
}
|
|
60
|
-
export class TruncatedText {
|
|
61
|
-
constructor(text: string, paddingX?: number, paddingY?: number);
|
|
62
|
-
toString(): string;
|
|
63
|
-
}
|
|
64
|
-
export class Container {
|
|
65
|
-
children: any[];
|
|
66
|
-
addChild(child: any): void;
|
|
67
|
-
}
|
|
68
|
-
export class Markdown {
|
|
69
|
-
constructor(text: string, width: number, height: number, theme?: any);
|
|
70
|
-
}
|
|
71
|
-
export class Spacer {
|
|
72
|
-
constructor(height: number);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
declare module "@mariozechner/pi-agent-core" {
|
|
77
|
-
export interface AgentToolResult<T = any> {
|
|
78
|
-
content: any[];
|
|
79
|
-
details?: T;
|
|
80
|
-
isError?: boolean;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
declare module "@mariozechner/pi-ai" {
|
|
85
|
-
export interface Message {
|
|
86
|
-
role: string;
|
|
87
|
-
content: string | any[];
|
|
88
|
-
usage?: any;
|
|
89
|
-
model?: string;
|
|
90
|
-
stopReason?: string;
|
|
91
|
-
errorMessage?: string;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
declare module "@sinclair/typebox" {
|
|
96
|
-
export const Type: {
|
|
97
|
-
Object: (properties: Record<string, any>, options?: any) => any;
|
|
98
|
-
String: (options?: any) => any;
|
|
99
|
-
Number: (options?: any) => any;
|
|
100
|
-
Array: (items: any, options?: any) => any;
|
|
101
|
-
Optional: (schema: any) => any;
|
|
102
|
-
Boolean: (options?: any) => any;
|
|
103
|
-
Union: (variants: any[], options?: any) => any;
|
|
104
|
-
Literal: (value: string) => any;
|
|
105
|
-
};
|
|
106
|
-
export type Static<T> = any;
|
|
107
|
-
}
|