@dyyz1993/pi-coding-agent 0.69.18 → 0.69.25
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/CHANGELOG.md +25 -0
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +12 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session.d.ts +15 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +216 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/client-channel.d.ts +61 -0
- package/dist/core/extensions/client-channel.d.ts.map +1 -0
- package/dist/core/extensions/client-channel.js +67 -0
- package/dist/core/extensions/client-channel.js.map +1 -0
- package/dist/core/extensions/index.d.ts +3 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -0
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +21 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +31 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +86 -34
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/include-resolver.d.ts +18 -0
- package/dist/core/include-resolver.d.ts.map +1 -0
- package/dist/core/include-resolver.js +304 -0
- package/dist/core/include-resolver.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +17 -4
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/session-manager.d.ts +8 -4
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +29 -6
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/storage.d.ts +24 -0
- package/dist/core/storage.d.ts.map +1 -0
- package/dist/core/storage.js +55 -0
- package/dist/core/storage.js.map +1 -0
- package/dist/core/tools/path-security.d.ts +15 -0
- package/dist/core/tools/path-security.d.ts.map +1 -0
- package/dist/core/tools/path-security.js +76 -0
- package/dist/core/tools/path-security.js.map +1 -0
- package/dist/core/tools/strip-markdown.d.ts +2 -0
- package/dist/core/tools/strip-markdown.d.ts.map +1 -0
- package/dist/core/tools/strip-markdown.js +8 -0
- package/dist/core/tools/strip-markdown.js.map +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +4 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +54 -12
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +2 -1
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +8 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client-types.d.ts +11 -0
- package/dist/modes/rpc/rpc-client-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-types.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +11 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +14 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +36 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +26 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +9 -5
- package/dist/rules-engine/cache.d.ts +0 -4
- package/dist/rules-engine/cache.d.ts.map +0 -1
- package/dist/rules-engine/cache.js +0 -32
- package/dist/rules-engine/cache.js.map +0 -1
- package/dist/rules-engine/config.d.ts +0 -8
- package/dist/rules-engine/config.d.ts.map +0 -1
- package/dist/rules-engine/config.js +0 -56
- package/dist/rules-engine/config.js.map +0 -1
- package/dist/rules-engine/index.d.ts +0 -10
- package/dist/rules-engine/index.d.ts.map +0 -1
- package/dist/rules-engine/index.js +0 -393
- package/dist/rules-engine/index.js.map +0 -1
- package/dist/rules-engine/injector.d.ts +0 -5
- package/dist/rules-engine/injector.d.ts.map +0 -1
- package/dist/rules-engine/injector.js +0 -57
- package/dist/rules-engine/injector.js.map +0 -1
- package/dist/rules-engine/loader.d.ts +0 -8
- package/dist/rules-engine/loader.d.ts.map +0 -1
- package/dist/rules-engine/loader.js +0 -190
- package/dist/rules-engine/loader.js.map +0 -1
- package/dist/rules-engine/matcher.d.ts +0 -3
- package/dist/rules-engine/matcher.d.ts.map +0 -1
- package/dist/rules-engine/matcher.js +0 -48
- package/dist/rules-engine/matcher.js.map +0 -1
- package/dist/rules-engine/types.d.ts +0 -150
- package/dist/rules-engine/types.d.ts.map +0 -1
- package/dist/rules-engine/types.js +0 -2
- package/dist/rules-engine/types.js.map +0 -1
- package/examples/extensions/auto-session-title.ts +0 -82
- package/examples/extensions/file-snapshot.ts +0 -417
- package/examples/extensions/subagent/README.md +0 -172
- package/examples/extensions/subagent/agents/planner.md +0 -37
- package/examples/extensions/subagent/agents/reviewer.md +0 -35
- package/examples/extensions/subagent/agents/scout.md +0 -50
- package/examples/extensions/subagent/agents/worker.md +0 -24
- package/examples/extensions/subagent/agents.ts +0 -126
- package/examples/extensions/subagent/index.ts +0 -987
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
- package/examples/extensions/subagent-v2/index.ts +0 -849
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: worker
|
|
3
|
-
description: General-purpose subagent with full capabilities, isolated context
|
|
4
|
-
model: claude-sonnet-4-5
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
You are a worker agent with full capabilities. You operate in an isolated context window to handle delegated tasks without polluting the main conversation.
|
|
8
|
-
|
|
9
|
-
Work autonomously to complete the assigned task. Use all available tools as needed.
|
|
10
|
-
|
|
11
|
-
Output format when finished:
|
|
12
|
-
|
|
13
|
-
## Completed
|
|
14
|
-
What was done.
|
|
15
|
-
|
|
16
|
-
## Files Changed
|
|
17
|
-
- `path/to/file.ts` - what changed
|
|
18
|
-
|
|
19
|
-
## Notes (if any)
|
|
20
|
-
Anything the main agent should know.
|
|
21
|
-
|
|
22
|
-
If handing off to another agent (e.g. reviewer), include:
|
|
23
|
-
- Exact file paths changed
|
|
24
|
-
- Key functions/types touched (short list)
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent discovery and configuration
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as fs from "node:fs";
|
|
6
|
-
import * as path from "node:path";
|
|
7
|
-
import { getAgentDir, parseFrontmatter } from "@dyyz1993/pi-coding-agent";
|
|
8
|
-
|
|
9
|
-
export type AgentScope = "user" | "project" | "both";
|
|
10
|
-
|
|
11
|
-
export interface AgentConfig {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
tools?: string[];
|
|
15
|
-
model?: string;
|
|
16
|
-
systemPrompt: string;
|
|
17
|
-
source: "user" | "project";
|
|
18
|
-
filePath: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface AgentDiscoveryResult {
|
|
22
|
-
agents: AgentConfig[];
|
|
23
|
-
projectAgentsDir: string | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function loadAgentsFromDir(dir: string, source: "user" | "project"): AgentConfig[] {
|
|
27
|
-
const agents: AgentConfig[] = [];
|
|
28
|
-
|
|
29
|
-
if (!fs.existsSync(dir)) {
|
|
30
|
-
return agents;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let entries: fs.Dirent[];
|
|
34
|
-
try {
|
|
35
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
36
|
-
} catch {
|
|
37
|
-
return agents;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
for (const entry of entries) {
|
|
41
|
-
if (!entry.name.endsWith(".md")) continue;
|
|
42
|
-
if (!entry.isFile() && !entry.isSymbolicLink()) continue;
|
|
43
|
-
|
|
44
|
-
const filePath = path.join(dir, entry.name);
|
|
45
|
-
let content: string;
|
|
46
|
-
try {
|
|
47
|
-
content = fs.readFileSync(filePath, "utf-8");
|
|
48
|
-
} catch {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const { frontmatter, body } = parseFrontmatter<Record<string, string>>(content);
|
|
53
|
-
|
|
54
|
-
if (!frontmatter.name || !frontmatter.description) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const tools = frontmatter.tools
|
|
59
|
-
?.split(",")
|
|
60
|
-
.map((t: string) => t.trim())
|
|
61
|
-
.filter(Boolean);
|
|
62
|
-
|
|
63
|
-
agents.push({
|
|
64
|
-
name: frontmatter.name,
|
|
65
|
-
description: frontmatter.description,
|
|
66
|
-
tools: tools && tools.length > 0 ? tools : undefined,
|
|
67
|
-
model: frontmatter.model,
|
|
68
|
-
systemPrompt: body,
|
|
69
|
-
source,
|
|
70
|
-
filePath,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return agents;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function isDirectory(p: string): boolean {
|
|
78
|
-
try {
|
|
79
|
-
return fs.statSync(p).isDirectory();
|
|
80
|
-
} catch {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function findNearestProjectAgentsDir(cwd: string): string | null {
|
|
86
|
-
let currentDir = cwd;
|
|
87
|
-
while (true) {
|
|
88
|
-
const candidate = path.join(currentDir, ".pi", "agents");
|
|
89
|
-
if (isDirectory(candidate)) return candidate;
|
|
90
|
-
|
|
91
|
-
const parentDir = path.dirname(currentDir);
|
|
92
|
-
if (parentDir === currentDir) return null;
|
|
93
|
-
currentDir = parentDir;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryResult {
|
|
98
|
-
const userDir = path.join(getAgentDir(), "agents");
|
|
99
|
-
const projectAgentsDir = findNearestProjectAgentsDir(cwd);
|
|
100
|
-
|
|
101
|
-
const userAgents = scope === "project" ? [] : loadAgentsFromDir(userDir, "user");
|
|
102
|
-
const projectAgents = scope === "user" || !projectAgentsDir ? [] : loadAgentsFromDir(projectAgentsDir, "project");
|
|
103
|
-
|
|
104
|
-
const agentMap = new Map<string, AgentConfig>();
|
|
105
|
-
|
|
106
|
-
if (scope === "both") {
|
|
107
|
-
for (const agent of userAgents) agentMap.set(agent.name, agent);
|
|
108
|
-
for (const agent of projectAgents) agentMap.set(agent.name, agent);
|
|
109
|
-
} else if (scope === "user") {
|
|
110
|
-
for (const agent of userAgents) agentMap.set(agent.name, agent);
|
|
111
|
-
} else {
|
|
112
|
-
for (const agent of projectAgents) agentMap.set(agent.name, agent);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return { agents: Array.from(agentMap.values()), projectAgentsDir };
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function formatAgentList(agents: AgentConfig[], maxItems: number): { text: string; remaining: number } {
|
|
119
|
-
if (agents.length === 0) return { text: "none", remaining: 0 };
|
|
120
|
-
const listed = agents.slice(0, maxItems);
|
|
121
|
-
const remaining = agents.length - listed.length;
|
|
122
|
-
return {
|
|
123
|
-
text: listed.map((a) => `${a.name} (${a.source}): ${a.description}`).join("; "),
|
|
124
|
-
remaining,
|
|
125
|
-
};
|
|
126
|
-
}
|