pi-agent-flow 1.1.0 → 1.2.2
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 +158 -44
- package/agents/audit.md +19 -24
- package/agents/build.md +28 -49
- package/agents/craft.md +16 -24
- package/agents/debug.md +14 -23
- package/agents/ideas.md +16 -17
- package/agents/scout.md +15 -20
- package/package.json +4 -15
- package/{agents.ts → src/agents.ts} +10 -4
- package/src/ambient.d.ts +85 -0
- package/{batch.ts → src/batch.ts} +687 -121
- package/src/cli-args.ts +283 -0
- package/src/config.ts +310 -0
- package/{flow.ts → src/flow.ts} +93 -21
- package/{hooks.ts → src/hooks.ts} +6 -6
- package/{index.ts → src/index.ts} +522 -103
- package/{render-utils.ts → src/render-utils.ts} +2 -2
- package/{render.ts → src/render.ts} +54 -10
- package/src/runner-events.ts +692 -0
- package/src/structured-output.ts +97 -0
- package/{types.ts → src/types.ts} +100 -0
- package/config.ts +0 -102
- package/runner-cli.js +0 -254
- package/runner-events.js +0 -559
- /package/{web-tool.ts → src/web-tool.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-flow",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Flow-state delegation extension for Pi coding agent.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "index.ts",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"
|
|
9
|
-
"web-tool.ts",
|
|
10
|
-
"agents.ts",
|
|
11
|
-
"config.ts",
|
|
12
|
-
"flow.ts",
|
|
13
|
-
"hooks.ts",
|
|
14
|
-
"runner-cli.js",
|
|
15
|
-
"runner-events.js",
|
|
16
|
-
"render.ts",
|
|
17
|
-
"render-utils.ts",
|
|
18
|
-
"types.ts",
|
|
19
|
-
"batch.ts",
|
|
8
|
+
"src/",
|
|
20
9
|
"agents/",
|
|
21
10
|
"README.md"
|
|
22
11
|
],
|
|
23
12
|
"pi": {
|
|
24
13
|
"extensions": [
|
|
25
|
-
"./index.ts"
|
|
14
|
+
"./src/index.ts"
|
|
26
15
|
]
|
|
27
16
|
},
|
|
28
17
|
"keywords": [
|
|
@@ -72,19 +72,25 @@ function getUserFlowsDir(): string {
|
|
|
72
72
|
/** Get the bundled flows directory from the plugin's location. */
|
|
73
73
|
function getBundledFlowsDir(): string {
|
|
74
74
|
// Method 1: import.meta.url (ESM)
|
|
75
|
+
// When source lives in src/, agents/ is one level up at the package root.
|
|
75
76
|
try {
|
|
76
77
|
if (import.meta.url) {
|
|
77
78
|
const pluginDir = path.dirname(new URL(import.meta.url).pathname);
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
// Check same directory first, then parent (for src/ layout)
|
|
80
|
+
for (const base of [pluginDir, path.dirname(pluginDir)]) {
|
|
81
|
+
const dir = path.join(base, "agents");
|
|
82
|
+
if (fs.existsSync(dir)) return dir;
|
|
83
|
+
}
|
|
80
84
|
}
|
|
81
85
|
} catch {}
|
|
82
86
|
|
|
83
87
|
// Method 2: __dirname (CommonJS / jiti)
|
|
84
88
|
try {
|
|
85
89
|
if (typeof __dirname !== "undefined") {
|
|
86
|
-
const
|
|
87
|
-
|
|
90
|
+
for (const base of [__dirname, path.dirname(__dirname)]) {
|
|
91
|
+
const dir = path.join(base, "agents");
|
|
92
|
+
if (fs.existsSync(dir)) return dir;
|
|
93
|
+
}
|
|
88
94
|
}
|
|
89
95
|
} catch {}
|
|
90
96
|
|
package/src/ambient.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
registerTool(tool: {
|
|
10
|
+
name: string;
|
|
11
|
+
label: string;
|
|
12
|
+
description: string;
|
|
13
|
+
parameters: any;
|
|
14
|
+
execute: (...args: any[]) => Promise<any>;
|
|
15
|
+
renderCall?: (...args: any[]) => any;
|
|
16
|
+
renderResult?: (...args: any[]) => any;
|
|
17
|
+
}): void;
|
|
18
|
+
setActiveTools(tools: string[]): void;
|
|
19
|
+
}
|
|
20
|
+
export interface ExtensionContext {
|
|
21
|
+
cwd: string;
|
|
22
|
+
hasUI: boolean;
|
|
23
|
+
ui: { confirm: (title: string, body: string) => Promise<boolean> };
|
|
24
|
+
sessionManager: { getSessionDir(): string; getHeader(): unknown; getBranch(): unknown[] };
|
|
25
|
+
}
|
|
26
|
+
export function parseFrontmatter<T extends Record<string, unknown>>(content: string): { frontmatter: T; body: string };
|
|
27
|
+
export function getMarkdownTheme(): any;
|
|
28
|
+
export const DEFAULT_MAX_BYTES: number;
|
|
29
|
+
export const DEFAULT_MAX_LINES: number;
|
|
30
|
+
export function truncateHead(text: string, options: { maxBytes?: number; maxLines?: number }): { content: string };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare module "@mariozechner/pi-tui" {
|
|
34
|
+
export class Text {
|
|
35
|
+
constructor(text: string, width: number, height: number);
|
|
36
|
+
toString(): string;
|
|
37
|
+
}
|
|
38
|
+
export class TruncatedText {
|
|
39
|
+
constructor(text: string, paddingX?: number, paddingY?: number);
|
|
40
|
+
toString(): string;
|
|
41
|
+
}
|
|
42
|
+
export class Container {
|
|
43
|
+
children: any[];
|
|
44
|
+
addChild(child: any): void;
|
|
45
|
+
}
|
|
46
|
+
export class Markdown {
|
|
47
|
+
constructor(text: string, width: number, height: number, theme?: any);
|
|
48
|
+
}
|
|
49
|
+
export class Spacer {
|
|
50
|
+
constructor(height: number);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare module "@mariozechner/pi-agent-core" {
|
|
55
|
+
export interface AgentToolResult<T = any> {
|
|
56
|
+
content: any[];
|
|
57
|
+
details?: T;
|
|
58
|
+
isError?: boolean;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare module "@mariozechner/pi-ai" {
|
|
63
|
+
export interface Message {
|
|
64
|
+
role: string;
|
|
65
|
+
content: string | any[];
|
|
66
|
+
usage?: any;
|
|
67
|
+
model?: string;
|
|
68
|
+
stopReason?: string;
|
|
69
|
+
errorMessage?: string;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare module "@sinclair/typebox" {
|
|
74
|
+
export const Type: {
|
|
75
|
+
Object: (properties: Record<string, any>, options?: any) => any;
|
|
76
|
+
String: (options?: any) => any;
|
|
77
|
+
Number: (options?: any) => any;
|
|
78
|
+
Array: (items: any, options?: any) => any;
|
|
79
|
+
Optional: (schema: any) => any;
|
|
80
|
+
Boolean: (options?: any) => any;
|
|
81
|
+
Union: (variants: any[], options?: any) => any;
|
|
82
|
+
Literal: (value: string) => any;
|
|
83
|
+
};
|
|
84
|
+
export type Static<T> = any;
|
|
85
|
+
}
|