@gotgenes/pi-subagents 1.0.0 → 1.0.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.
Files changed (61) hide show
  1. package/AGENTS.md +4 -82
  2. package/CHANGELOG.md +29 -0
  3. package/README.md +18 -4
  4. package/docs/architecture/architecture.md +391 -0
  5. package/docs/decisions/0001-deferred-patches.md +13 -14
  6. package/docs/plans/0051-update-adr-0001-hard-fork.md +74 -0
  7. package/package.json +12 -17
  8. package/.markdownlint-cli2.yaml +0 -19
  9. package/.release-please-manifest.json +0 -3
  10. package/dist/agent-manager.d.ts +0 -108
  11. package/dist/agent-manager.js +0 -390
  12. package/dist/agent-runner.d.ts +0 -93
  13. package/dist/agent-runner.js +0 -428
  14. package/dist/agent-types.d.ts +0 -48
  15. package/dist/agent-types.js +0 -136
  16. package/dist/context.d.ts +0 -12
  17. package/dist/context.js +0 -56
  18. package/dist/cross-extension-rpc.d.ts +0 -46
  19. package/dist/cross-extension-rpc.js +0 -54
  20. package/dist/custom-agents.d.ts +0 -14
  21. package/dist/custom-agents.js +0 -127
  22. package/dist/default-agents.d.ts +0 -7
  23. package/dist/default-agents.js +0 -119
  24. package/dist/env.d.ts +0 -6
  25. package/dist/env.js +0 -28
  26. package/dist/group-join.d.ts +0 -32
  27. package/dist/group-join.js +0 -116
  28. package/dist/index.d.ts +0 -13
  29. package/dist/index.js +0 -1731
  30. package/dist/invocation-config.d.ts +0 -22
  31. package/dist/invocation-config.js +0 -15
  32. package/dist/memory.d.ts +0 -49
  33. package/dist/memory.js +0 -151
  34. package/dist/model-resolver.d.ts +0 -19
  35. package/dist/model-resolver.js +0 -62
  36. package/dist/output-file.d.ts +0 -24
  37. package/dist/output-file.js +0 -86
  38. package/dist/prompts.d.ts +0 -29
  39. package/dist/prompts.js +0 -72
  40. package/dist/schedule-store.d.ts +0 -36
  41. package/dist/schedule-store.js +0 -144
  42. package/dist/schedule.d.ts +0 -109
  43. package/dist/schedule.js +0 -338
  44. package/dist/settings.d.ts +0 -66
  45. package/dist/settings.js +0 -130
  46. package/dist/skill-loader.d.ts +0 -24
  47. package/dist/skill-loader.js +0 -93
  48. package/dist/types.d.ts +0 -164
  49. package/dist/types.js +0 -5
  50. package/dist/ui/agent-widget.d.ts +0 -134
  51. package/dist/ui/agent-widget.js +0 -451
  52. package/dist/ui/conversation-viewer.d.ts +0 -35
  53. package/dist/ui/conversation-viewer.js +0 -252
  54. package/dist/ui/schedule-menu.d.ts +0 -16
  55. package/dist/ui/schedule-menu.js +0 -95
  56. package/dist/usage.d.ts +0 -50
  57. package/dist/usage.js +0 -49
  58. package/dist/worktree.d.ts +0 -36
  59. package/dist/worktree.js +0 -139
  60. package/prek.toml +0 -24
  61. package/release-please-config.json +0 -22
@@ -1,136 +0,0 @@
1
- /**
2
- * agent-types.ts — Unified agent type registry.
3
- *
4
- * Merges embedded default agents with user-defined agents from .pi/agents/*.md.
5
- * User agents override defaults with the same name. Disabled agents are kept but excluded from spawning.
6
- */
7
- import { DEFAULT_AGENTS } from "./default-agents.js";
8
- /** All known built-in tool names. */
9
- export const BUILTIN_TOOL_NAMES = ["read", "bash", "edit", "write", "grep", "find", "ls"];
10
- /** Unified runtime registry of all agents (defaults + user-defined). */
11
- const agents = new Map();
12
- /**
13
- * Register agents into the unified registry.
14
- * Starts with DEFAULT_AGENTS, then overlays user agents (overrides defaults with same name).
15
- * Disabled agents (enabled === false) are kept in the registry but excluded from spawning.
16
- */
17
- export function registerAgents(userAgents) {
18
- agents.clear();
19
- // Start with defaults
20
- for (const [name, config] of DEFAULT_AGENTS) {
21
- agents.set(name, config);
22
- }
23
- // Overlay user agents (overrides defaults with same name)
24
- for (const [name, config] of userAgents) {
25
- agents.set(name, config);
26
- }
27
- }
28
- /** Case-insensitive key resolution. */
29
- function resolveKey(name) {
30
- if (agents.has(name))
31
- return name;
32
- const lower = name.toLowerCase();
33
- for (const key of agents.keys()) {
34
- if (key.toLowerCase() === lower)
35
- return key;
36
- }
37
- return undefined;
38
- }
39
- /** Resolve a type name case-insensitively. Returns the canonical key or undefined. */
40
- export function resolveType(name) {
41
- return resolveKey(name);
42
- }
43
- /** Get the agent config for a type (case-insensitive). */
44
- export function getAgentConfig(name) {
45
- const key = resolveKey(name);
46
- return key ? agents.get(key) : undefined;
47
- }
48
- /** Get all enabled type names (for spawning and tool descriptions). */
49
- export function getAvailableTypes() {
50
- return [...agents.entries()]
51
- .filter(([_, config]) => config.enabled !== false)
52
- .map(([name]) => name);
53
- }
54
- /** Get all type names including disabled (for UI listing). */
55
- export function getAllTypes() {
56
- return [...agents.keys()];
57
- }
58
- /** Get names of default agents currently in the registry. */
59
- export function getDefaultAgentNames() {
60
- return [...agents.entries()]
61
- .filter(([_, config]) => config.isDefault === true)
62
- .map(([name]) => name);
63
- }
64
- /** Get names of user-defined agents (non-defaults) currently in the registry. */
65
- export function getUserAgentNames() {
66
- return [...agents.entries()]
67
- .filter(([_, config]) => config.isDefault !== true)
68
- .map(([name]) => name);
69
- }
70
- /** Check if a type is valid and enabled (case-insensitive). */
71
- export function isValidType(type) {
72
- const key = resolveKey(type);
73
- if (!key)
74
- return false;
75
- return agents.get(key)?.enabled !== false;
76
- }
77
- /** Tool names required for memory management. */
78
- const MEMORY_TOOL_NAMES = ["read", "write", "edit"];
79
- /**
80
- * Get memory tool names (read/write/edit) not already in the provided set.
81
- */
82
- export function getMemoryToolNames(existingToolNames) {
83
- return MEMORY_TOOL_NAMES.filter(n => !existingToolNames.has(n));
84
- }
85
- /** Tool names needed for read-only memory access. */
86
- const READONLY_MEMORY_TOOL_NAMES = ["read"];
87
- /**
88
- * Get read-only memory tool names not already in the provided set.
89
- */
90
- export function getReadOnlyMemoryToolNames(existingToolNames) {
91
- return READONLY_MEMORY_TOOL_NAMES.filter(n => !existingToolNames.has(n));
92
- }
93
- /** Get built-in tool names for a type (case-insensitive). */
94
- export function getToolNamesForType(type) {
95
- const key = resolveKey(type);
96
- const raw = key ? agents.get(key) : undefined;
97
- const config = raw?.enabled !== false ? raw : undefined;
98
- const names = config?.builtinToolNames?.length ? config.builtinToolNames : [...BUILTIN_TOOL_NAMES];
99
- return names;
100
- }
101
- /** Get config for a type (case-insensitive, returns a SubagentTypeConfig-compatible object). Falls back to general-purpose. */
102
- export function getConfig(type) {
103
- const key = resolveKey(type);
104
- const config = key ? agents.get(key) : undefined;
105
- if (config && config.enabled !== false) {
106
- return {
107
- displayName: config.displayName ?? config.name,
108
- description: config.description,
109
- builtinToolNames: config.builtinToolNames ?? BUILTIN_TOOL_NAMES,
110
- extensions: config.extensions,
111
- skills: config.skills,
112
- promptMode: config.promptMode,
113
- };
114
- }
115
- // Fallback for unknown/disabled types — general-purpose config
116
- const gp = agents.get("general-purpose");
117
- if (gp && gp.enabled !== false) {
118
- return {
119
- displayName: gp.displayName ?? gp.name,
120
- description: gp.description,
121
- builtinToolNames: gp.builtinToolNames ?? BUILTIN_TOOL_NAMES,
122
- extensions: gp.extensions,
123
- skills: gp.skills,
124
- promptMode: gp.promptMode,
125
- };
126
- }
127
- // Absolute fallback (should never happen)
128
- return {
129
- displayName: "Agent",
130
- description: "General-purpose agent for complex, multi-step tasks",
131
- builtinToolNames: BUILTIN_TOOL_NAMES,
132
- extensions: true,
133
- skills: true,
134
- promptMode: "append",
135
- };
136
- }
package/dist/context.d.ts DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * context.ts — Extract parent conversation context for subagent inheritance.
3
- */
4
- import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
5
- /** Extract text from a message content block array. */
6
- export declare function extractText(content: unknown[]): string;
7
- /**
8
- * Build a text representation of the parent conversation context.
9
- * Used when inherit_context is true to give the subagent visibility
10
- * into what has been discussed/done so far.
11
- */
12
- export declare function buildParentContext(ctx: ExtensionContext): string;
package/dist/context.js DELETED
@@ -1,56 +0,0 @@
1
- /**
2
- * context.ts — Extract parent conversation context for subagent inheritance.
3
- */
4
- /** Extract text from a message content block array. */
5
- export function extractText(content) {
6
- return content
7
- .filter((c) => c.type === "text")
8
- .map((c) => c.text ?? "")
9
- .join("\n");
10
- }
11
- /**
12
- * Build a text representation of the parent conversation context.
13
- * Used when inherit_context is true to give the subagent visibility
14
- * into what has been discussed/done so far.
15
- */
16
- export function buildParentContext(ctx) {
17
- const entries = ctx.sessionManager.getBranch();
18
- if (!entries || entries.length === 0)
19
- return "";
20
- const parts = [];
21
- for (const entry of entries) {
22
- if (entry.type === "message") {
23
- const msg = entry.message;
24
- if (msg.role === "user") {
25
- const text = typeof msg.content === "string"
26
- ? msg.content
27
- : extractText(msg.content);
28
- if (text.trim())
29
- parts.push(`[User]: ${text.trim()}`);
30
- }
31
- else if (msg.role === "assistant") {
32
- const text = extractText(msg.content);
33
- if (text.trim())
34
- parts.push(`[Assistant]: ${text.trim()}`);
35
- }
36
- // Skip toolResult messages — too verbose for context
37
- }
38
- else if (entry.type === "compaction") {
39
- // Include compaction summaries — they're already condensed
40
- if (entry.summary) {
41
- parts.push(`[Summary]: ${entry.summary}`);
42
- }
43
- }
44
- }
45
- if (parts.length === 0)
46
- return "";
47
- return `# Parent Conversation Context
48
- The following is the conversation history from the parent session that spawned you.
49
- Use this context to understand what has been discussed and decided so far.
50
-
51
- ${parts.join("\n\n")}
52
-
53
- ---
54
- # Your Task (below)
55
- `;
56
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * Cross-extension RPC handlers for the subagents extension.
3
- *
4
- * Exposes ping, spawn, and stop RPCs over the pi.events event bus,
5
- * using per-request scoped reply channels.
6
- *
7
- * Reply envelope follows pi-mono convention:
8
- * success → { success: true, data?: T }
9
- * error → { success: false, error: string }
10
- */
11
- /** Minimal event bus interface needed by the RPC handlers. */
12
- export interface EventBus {
13
- on(event: string, handler: (data: unknown) => void): () => void;
14
- emit(event: string, data: unknown): void;
15
- }
16
- /** RPC reply envelope — matches pi-mono's RpcResponse shape. */
17
- export type RpcReply<T = void> = {
18
- success: true;
19
- data?: T;
20
- } | {
21
- success: false;
22
- error: string;
23
- };
24
- /** RPC protocol version — bumped when the envelope or method contracts change. */
25
- export declare const PROTOCOL_VERSION = 2;
26
- /** Minimal AgentManager interface needed by the spawn/stop RPCs. */
27
- export interface SpawnCapable {
28
- spawn(pi: unknown, ctx: unknown, type: string, prompt: string, options: any): string;
29
- abort(id: string): boolean;
30
- }
31
- export interface RpcDeps {
32
- events: EventBus;
33
- pi: unknown;
34
- getCtx: () => unknown | undefined;
35
- manager: SpawnCapable;
36
- }
37
- export interface RpcHandle {
38
- unsubPing: () => void;
39
- unsubSpawn: () => void;
40
- unsubStop: () => void;
41
- }
42
- /**
43
- * Register ping, spawn, and stop RPC handlers on the event bus.
44
- * Returns unsub functions for cleanup.
45
- */
46
- export declare function registerRpcHandlers(deps: RpcDeps): RpcHandle;
@@ -1,54 +0,0 @@
1
- /**
2
- * Cross-extension RPC handlers for the subagents extension.
3
- *
4
- * Exposes ping, spawn, and stop RPCs over the pi.events event bus,
5
- * using per-request scoped reply channels.
6
- *
7
- * Reply envelope follows pi-mono convention:
8
- * success → { success: true, data?: T }
9
- * error → { success: false, error: string }
10
- */
11
- /** RPC protocol version — bumped when the envelope or method contracts change. */
12
- export const PROTOCOL_VERSION = 2;
13
- /**
14
- * Wire a single RPC handler: listen on `channel`, run `fn(params)`,
15
- * emit the reply envelope on `channel:reply:${requestId}`.
16
- */
17
- function handleRpc(events, channel, fn) {
18
- return events.on(channel, async (raw) => {
19
- const params = raw;
20
- try {
21
- const data = await fn(params);
22
- const reply = { success: true };
23
- if (data !== undefined)
24
- reply.data = data;
25
- events.emit(`${channel}:reply:${params.requestId}`, reply);
26
- }
27
- catch (err) {
28
- events.emit(`${channel}:reply:${params.requestId}`, {
29
- success: false, error: err?.message ?? String(err),
30
- });
31
- }
32
- });
33
- }
34
- /**
35
- * Register ping, spawn, and stop RPC handlers on the event bus.
36
- * Returns unsub functions for cleanup.
37
- */
38
- export function registerRpcHandlers(deps) {
39
- const { events, pi, getCtx, manager } = deps;
40
- const unsubPing = handleRpc(events, "subagents:rpc:ping", () => {
41
- return { version: PROTOCOL_VERSION };
42
- });
43
- const unsubSpawn = handleRpc(events, "subagents:rpc:spawn", ({ type, prompt, options }) => {
44
- const ctx = getCtx();
45
- if (!ctx)
46
- throw new Error("No active session");
47
- return { id: manager.spawn(pi, ctx, type, prompt, options ?? {}) };
48
- });
49
- const unsubStop = handleRpc(events, "subagents:rpc:stop", ({ agentId }) => {
50
- if (!manager.abort(agentId))
51
- throw new Error("Agent not found");
52
- });
53
- return { unsubPing, unsubSpawn, unsubStop };
54
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * custom-agents.ts — Load user-defined agents from project (.pi/agents/) and global ($PI_CODING_AGENT_DIR/agents/, default ~/.pi/agent/agents/) locations.
3
- */
4
- import type { AgentConfig } from "./types.js";
5
- /**
6
- * Scan for custom agent .md files from multiple locations.
7
- * Discovery hierarchy (higher priority wins):
8
- * 1. Project: <cwd>/.pi/agents/*.md
9
- * 2. Global: $PI_CODING_AGENT_DIR/agents/*.md (default: ~/.pi/agent/agents/*.md)
10
- *
11
- * Project-level agents override global ones with the same name.
12
- * Any name is allowed — names matching defaults (e.g. "Explore") override them.
13
- */
14
- export declare function loadCustomAgents(cwd: string): Map<string, AgentConfig>;
@@ -1,127 +0,0 @@
1
- /**
2
- * custom-agents.ts — Load user-defined agents from project (.pi/agents/) and global ($PI_CODING_AGENT_DIR/agents/, default ~/.pi/agent/agents/) locations.
3
- */
4
- import { existsSync, readdirSync, readFileSync } from "node:fs";
5
- import { basename, join } from "node:path";
6
- import { getAgentDir, parseFrontmatter } from "@earendil-works/pi-coding-agent";
7
- import { BUILTIN_TOOL_NAMES } from "./agent-types.js";
8
- /**
9
- * Scan for custom agent .md files from multiple locations.
10
- * Discovery hierarchy (higher priority wins):
11
- * 1. Project: <cwd>/.pi/agents/*.md
12
- * 2. Global: $PI_CODING_AGENT_DIR/agents/*.md (default: ~/.pi/agent/agents/*.md)
13
- *
14
- * Project-level agents override global ones with the same name.
15
- * Any name is allowed — names matching defaults (e.g. "Explore") override them.
16
- */
17
- export function loadCustomAgents(cwd) {
18
- const globalDir = join(getAgentDir(), "agents");
19
- const projectDir = join(cwd, ".pi", "agents");
20
- const agents = new Map();
21
- loadFromDir(globalDir, agents, "global"); // lower priority
22
- loadFromDir(projectDir, agents, "project"); // higher priority (overwrites)
23
- return agents;
24
- }
25
- /** Load agent configs from a directory into the map. */
26
- function loadFromDir(dir, agents, source) {
27
- if (!existsSync(dir))
28
- return;
29
- let files;
30
- try {
31
- files = readdirSync(dir).filter(f => f.endsWith(".md"));
32
- }
33
- catch {
34
- return;
35
- }
36
- for (const file of files) {
37
- const name = basename(file, ".md");
38
- let content;
39
- try {
40
- content = readFileSync(join(dir, file), "utf-8");
41
- }
42
- catch {
43
- continue;
44
- }
45
- const { frontmatter: fm, body } = parseFrontmatter(content);
46
- agents.set(name, {
47
- name,
48
- displayName: str(fm.display_name),
49
- description: str(fm.description) ?? name,
50
- builtinToolNames: csvList(fm.tools, BUILTIN_TOOL_NAMES),
51
- disallowedTools: csvListOptional(fm.disallowed_tools),
52
- extensions: inheritField(fm.extensions ?? fm.inherit_extensions),
53
- skills: inheritField(fm.skills ?? fm.inherit_skills),
54
- model: str(fm.model),
55
- thinking: str(fm.thinking),
56
- maxTurns: nonNegativeInt(fm.max_turns),
57
- systemPrompt: body.trim(),
58
- promptMode: fm.prompt_mode === "append" ? "append" : "replace",
59
- inheritContext: fm.inherit_context != null ? fm.inherit_context === true : undefined,
60
- runInBackground: fm.run_in_background != null ? fm.run_in_background === true : undefined,
61
- isolated: fm.isolated != null ? fm.isolated === true : undefined,
62
- memory: parseMemory(fm.memory),
63
- isolation: fm.isolation === "worktree" ? "worktree" : undefined,
64
- enabled: fm.enabled !== false, // default true; explicitly false disables
65
- source,
66
- });
67
- }
68
- }
69
- // ---- Field parsers ----
70
- // All follow the same convention: omitted → default, "none"/empty → nothing, value → exact.
71
- /** Extract a string or undefined. */
72
- function str(val) {
73
- return typeof val === "string" ? val : undefined;
74
- }
75
- /** Extract a non-negative integer or undefined. 0 means unlimited for max_turns. */
76
- function nonNegativeInt(val) {
77
- return typeof val === "number" && val >= 0 ? val : undefined;
78
- }
79
- /**
80
- * Parse a raw CSV field value into items, or undefined if absent/empty/"none".
81
- */
82
- function parseCsvField(val) {
83
- if (val === undefined || val === null)
84
- return undefined;
85
- const s = String(val).trim();
86
- if (!s || s === "none")
87
- return undefined;
88
- const items = s.split(",").map(t => t.trim()).filter(Boolean);
89
- return items.length > 0 ? items : undefined;
90
- }
91
- /**
92
- * Parse a comma-separated list field with defaults.
93
- * omitted → defaults; "none"/empty → []; csv → listed items.
94
- */
95
- function csvList(val, defaults) {
96
- if (val === undefined || val === null)
97
- return defaults;
98
- return parseCsvField(val) ?? [];
99
- }
100
- /**
101
- * Parse an optional comma-separated list field.
102
- * omitted → undefined; "none"/empty → undefined; csv → listed items.
103
- */
104
- function csvListOptional(val) {
105
- return parseCsvField(val);
106
- }
107
- /**
108
- * Parse a memory scope field.
109
- * omitted → undefined; "user"/"project"/"local" → MemoryScope.
110
- */
111
- function parseMemory(val) {
112
- if (val === "user" || val === "project" || val === "local")
113
- return val;
114
- return undefined;
115
- }
116
- /**
117
- * Parse an inherit field (extensions, skills).
118
- * omitted/true → true (inherit all); false/"none"/empty → false; csv → listed names.
119
- */
120
- function inheritField(val) {
121
- if (val === undefined || val === null || val === true)
122
- return true;
123
- if (val === false || val === "none")
124
- return false;
125
- const items = csvList(val, []);
126
- return items.length > 0 ? items : false;
127
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * default-agents.ts — Embedded default agent configurations.
3
- *
4
- * These are always available but can be overridden by user .md files with the same name.
5
- */
6
- import type { AgentConfig } from "./types.js";
7
- export declare const DEFAULT_AGENTS: Map<string, AgentConfig>;
@@ -1,119 +0,0 @@
1
- /**
2
- * default-agents.ts — Embedded default agent configurations.
3
- *
4
- * These are always available but can be overridden by user .md files with the same name.
5
- */
6
- const READ_ONLY_TOOLS = ["read", "bash", "grep", "find", "ls"];
7
- export const DEFAULT_AGENTS = new Map([
8
- [
9
- "general-purpose",
10
- {
11
- name: "general-purpose",
12
- displayName: "Agent",
13
- description: "General-purpose agent for complex, multi-step tasks",
14
- // builtinToolNames omitted — means "all available tools" (resolved at lookup time)
15
- // inheritContext / runInBackground / isolated omitted — strategy fields, callers decide per-call.
16
- // Setting them to false would lock callsite intent (see resolveAgentInvocationConfig in invocation-config.ts).
17
- extensions: true,
18
- skills: true,
19
- systemPrompt: "",
20
- promptMode: "append",
21
- isDefault: true,
22
- },
23
- ],
24
- [
25
- "Explore",
26
- {
27
- name: "Explore",
28
- displayName: "Explore",
29
- description: "Fast codebase exploration agent (read-only)",
30
- builtinToolNames: READ_ONLY_TOOLS,
31
- extensions: true,
32
- skills: true,
33
- model: "anthropic/claude-haiku-4-5-20251001",
34
- systemPrompt: `# CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS
35
- You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
36
- Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools.
37
-
38
- You are STRICTLY PROHIBITED from:
39
- - Creating new files
40
- - Modifying existing files
41
- - Deleting files
42
- - Moving or copying files
43
- - Creating temporary files anywhere, including /tmp
44
- - Using redirect operators (>, >>, |) or heredocs to write to files
45
- - Running ANY commands that change system state
46
-
47
- Use Bash ONLY for read-only operations: ls, git status, git log, git diff, find, cat, head, tail.
48
-
49
- # Tool Usage
50
- - Use the find tool for file pattern matching (NOT the bash find command)
51
- - Use the grep tool for content search (NOT bash grep/rg command)
52
- - Use the read tool for reading files (NOT bash cat/head/tail)
53
- - Use Bash ONLY for read-only operations
54
- - Make independent tool calls in parallel for efficiency
55
- - Adapt search approach based on thoroughness level specified
56
-
57
- # Output
58
- - Use absolute file paths in all references
59
- - Report findings as regular messages
60
- - Do not use emojis
61
- - Be thorough and precise`,
62
- promptMode: "replace",
63
- isDefault: true,
64
- },
65
- ],
66
- [
67
- "Plan",
68
- {
69
- name: "Plan",
70
- displayName: "Plan",
71
- description: "Software architect for implementation planning (read-only)",
72
- builtinToolNames: READ_ONLY_TOOLS,
73
- extensions: true,
74
- skills: true,
75
- systemPrompt: `# CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS
76
- You are a software architect and planning specialist.
77
- Your role is EXCLUSIVELY to explore the codebase and design implementation plans.
78
- You do NOT have access to file editing tools — attempting to edit files will fail.
79
-
80
- You are STRICTLY PROHIBITED from:
81
- - Creating new files
82
- - Modifying existing files
83
- - Deleting files
84
- - Moving or copying files
85
- - Creating temporary files anywhere, including /tmp
86
- - Using redirect operators (>, >>, |) or heredocs to write to files
87
- - Running ANY commands that change system state
88
-
89
- # Planning Process
90
- 1. Understand requirements
91
- 2. Explore thoroughly (read files, find patterns, understand architecture)
92
- 3. Design solution based on your assigned perspective
93
- 4. Detail the plan with step-by-step implementation strategy
94
-
95
- # Requirements
96
- - Consider trade-offs and architectural decisions
97
- - Identify dependencies and sequencing
98
- - Anticipate potential challenges
99
- - Follow existing patterns where appropriate
100
-
101
- # Tool Usage
102
- - Use the find tool for file pattern matching (NOT the bash find command)
103
- - Use the grep tool for content search (NOT bash grep/rg command)
104
- - Use the read tool for reading files (NOT bash cat/head/tail)
105
- - Use Bash ONLY for read-only operations
106
-
107
- # Output Format
108
- - Use absolute file paths
109
- - Do not use emojis
110
- - End your response with:
111
-
112
- ### Critical Files for Implementation
113
- List 3-5 files most critical for implementing this plan:
114
- - /absolute/path/to/file.ts - [Brief reason]`,
115
- promptMode: "replace",
116
- isDefault: true,
117
- },
118
- ],
119
- ]);
package/dist/env.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * env.ts — Detect environment info (git, platform) for subagent system prompts.
3
- */
4
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
5
- import type { EnvInfo } from "./types.js";
6
- export declare function detectEnv(pi: ExtensionAPI, cwd: string): Promise<EnvInfo>;
package/dist/env.js DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * env.ts — Detect environment info (git, platform) for subagent system prompts.
3
- */
4
- export async function detectEnv(pi, cwd) {
5
- let isGitRepo = false;
6
- let branch = "";
7
- try {
8
- const result = await pi.exec("git", ["rev-parse", "--is-inside-work-tree"], { cwd, timeout: 5000 });
9
- isGitRepo = result.code === 0 && result.stdout.trim() === "true";
10
- }
11
- catch {
12
- // Not a git repo or git not installed
13
- }
14
- if (isGitRepo) {
15
- try {
16
- const result = await pi.exec("git", ["branch", "--show-current"], { cwd, timeout: 5000 });
17
- branch = result.code === 0 ? result.stdout.trim() : "unknown";
18
- }
19
- catch {
20
- branch = "unknown";
21
- }
22
- }
23
- return {
24
- isGitRepo,
25
- branch,
26
- platform: process.platform,
27
- };
28
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * group-join.ts — Manages grouped background agent completion notifications.
3
- *
4
- * Instead of each agent individually nudging the main agent on completion,
5
- * agents in a group are held until all complete (or a timeout fires),
6
- * then a single consolidated notification is sent.
7
- */
8
- import type { AgentRecord } from "./types.js";
9
- export type DeliveryCallback = (records: AgentRecord[], partial: boolean) => void;
10
- export declare class GroupJoinManager {
11
- private deliverCb;
12
- private groupTimeout;
13
- private groups;
14
- private agentToGroup;
15
- constructor(deliverCb: DeliveryCallback, groupTimeout?: number);
16
- /** Register a group of agent IDs that should be joined. */
17
- registerGroup(groupId: string, agentIds: string[]): void;
18
- /**
19
- * Called when an agent completes.
20
- * Returns:
21
- * - 'pass' — agent is not grouped, caller should send individual nudge
22
- * - 'held' — result held, waiting for group completion
23
- * - 'delivered' — this completion triggered the group notification
24
- */
25
- onAgentComplete(record: AgentRecord): 'delivered' | 'held' | 'pass';
26
- private onTimeout;
27
- private deliver;
28
- private cleanupGroup;
29
- /** Check if an agent is in a group. */
30
- isGrouped(agentId: string): boolean;
31
- dispose(): void;
32
- }