@ilya-lesikov/pi-pi 0.1.0
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/3p/pi-ask-user/index.ts +1835 -0
- package/3p/pi-ask-user/package.json +50 -0
- package/3p/pi-ask-user/single-select-layout.ts +203 -0
- package/3p/pi-lsp/extensions/lsp/client.ts +542 -0
- package/3p/pi-lsp/extensions/lsp/config.ts +135 -0
- package/3p/pi-lsp/extensions/lsp/effects/command.ts +42 -0
- package/3p/pi-lsp/extensions/lsp/effects/filesystem.ts +50 -0
- package/3p/pi-lsp/extensions/lsp/effects/runtime.ts +21 -0
- package/3p/pi-lsp/extensions/lsp/errors.ts +113 -0
- package/3p/pi-lsp/extensions/lsp/formatting.ts +315 -0
- package/3p/pi-lsp/extensions/lsp/index.ts +231 -0
- package/3p/pi-lsp/extensions/lsp/protocol.ts +209 -0
- package/3p/pi-lsp/extensions/lsp/retry.ts +39 -0
- package/3p/pi-lsp/extensions/lsp/tools/programs.ts +293 -0
- package/3p/pi-lsp/extensions/lsp/tools.ts +89 -0
- package/3p/pi-lsp/extensions/lsp/types.ts +243 -0
- package/3p/pi-lsp/package.json +54 -0
- package/3p/pi-plannotator/AGENTS.md +583 -0
- package/3p/pi-plannotator/apps/pi-extension/README.md +228 -0
- package/3p/pi-plannotator/apps/pi-extension/assistant-message.ts +128 -0
- package/3p/pi-plannotator/apps/pi-extension/config.test.ts +166 -0
- package/3p/pi-plannotator/apps/pi-extension/config.ts +318 -0
- package/3p/pi-plannotator/apps/pi-extension/current-pi-session.ts +147 -0
- package/3p/pi-plannotator/apps/pi-extension/index.ts +1279 -0
- package/3p/pi-plannotator/apps/pi-extension/package.json +56 -0
- package/3p/pi-plannotator/apps/pi-extension/plannotator-browser.test.ts +13 -0
- package/3p/pi-plannotator/apps/pi-extension/plannotator-browser.ts +616 -0
- package/3p/pi-plannotator/apps/pi-extension/plannotator-events.ts +342 -0
- package/3p/pi-plannotator/apps/pi-extension/plannotator.json +12 -0
- package/3p/pi-plannotator/apps/pi-extension/server/agent-jobs.ts +515 -0
- package/3p/pi-plannotator/apps/pi-extension/server/ai-runtime.ts +169 -0
- package/3p/pi-plannotator/apps/pi-extension/server/annotations.ts +85 -0
- package/3p/pi-plannotator/apps/pi-extension/server/external-annotations.ts +189 -0
- package/3p/pi-plannotator/apps/pi-extension/server/handlers.ts +210 -0
- package/3p/pi-plannotator/apps/pi-extension/server/helpers.ts +78 -0
- package/3p/pi-plannotator/apps/pi-extension/server/ide.ts +46 -0
- package/3p/pi-plannotator/apps/pi-extension/server/integrations.ts +195 -0
- package/3p/pi-plannotator/apps/pi-extension/server/network.test.ts +158 -0
- package/3p/pi-plannotator/apps/pi-extension/server/network.ts +268 -0
- package/3p/pi-plannotator/apps/pi-extension/server/pr.ts +126 -0
- package/3p/pi-plannotator/apps/pi-extension/server/project.ts +64 -0
- package/3p/pi-plannotator/apps/pi-extension/server/reference.ts +362 -0
- package/3p/pi-plannotator/apps/pi-extension/server/serverAnnotate.ts +199 -0
- package/3p/pi-plannotator/apps/pi-extension/server/serverPlan.ts +505 -0
- package/3p/pi-plannotator/apps/pi-extension/server/serverReview.ts +1229 -0
- package/3p/pi-plannotator/apps/pi-extension/server/vcs.ts +121 -0
- package/3p/pi-plannotator/apps/pi-extension/server.test.ts +966 -0
- package/3p/pi-plannotator/apps/pi-extension/server.ts +44 -0
- package/3p/pi-plannotator/apps/pi-extension/tool-scope.test.ts +88 -0
- package/3p/pi-plannotator/apps/pi-extension/tool-scope.ts +39 -0
- package/3p/pi-plannotator/apps/pi-extension/tsconfig.json +16 -0
- package/3p/pi-plannotator/apps/pi-extension/vendor.sh +48 -0
- package/3p/pi-plannotator/package.json +53 -0
- package/3p/pi-plannotator/packages/ai/ai.test.ts +1407 -0
- package/3p/pi-plannotator/packages/ai/base-session.ts +94 -0
- package/3p/pi-plannotator/packages/ai/context.ts +250 -0
- package/3p/pi-plannotator/packages/ai/endpoints.ts +326 -0
- package/3p/pi-plannotator/packages/ai/index.ts +105 -0
- package/3p/pi-plannotator/packages/ai/package.json +21 -0
- package/3p/pi-plannotator/packages/ai/provider.ts +103 -0
- package/3p/pi-plannotator/packages/ai/providers/claude-agent-sdk.ts +447 -0
- package/3p/pi-plannotator/packages/ai/providers/codex-sdk.ts +430 -0
- package/3p/pi-plannotator/packages/ai/providers/command-path.ts +115 -0
- package/3p/pi-plannotator/packages/ai/providers/opencode-sdk.ts +546 -0
- package/3p/pi-plannotator/packages/ai/providers/pi-events.ts +110 -0
- package/3p/pi-plannotator/packages/ai/providers/pi-sdk-node.ts +425 -0
- package/3p/pi-plannotator/packages/ai/providers/pi-sdk.ts +469 -0
- package/3p/pi-plannotator/packages/ai/session-manager.ts +195 -0
- package/3p/pi-plannotator/packages/ai/tsconfig.json +15 -0
- package/3p/pi-plannotator/packages/ai/types.ts +379 -0
- package/3p/pi-plannotator/packages/server/agent-jobs.ts +538 -0
- package/3p/pi-plannotator/packages/server/agent-review-message.test.ts +135 -0
- package/3p/pi-plannotator/packages/server/agent-review-message.ts +243 -0
- package/3p/pi-plannotator/packages/server/ai-runtime.ts +108 -0
- package/3p/pi-plannotator/packages/server/annotate.ts +401 -0
- package/3p/pi-plannotator/packages/server/browser.test.ts +87 -0
- package/3p/pi-plannotator/packages/server/browser.ts +245 -0
- package/3p/pi-plannotator/packages/server/claude-review.ts +352 -0
- package/3p/pi-plannotator/packages/server/code-nav.ts +73 -0
- package/3p/pi-plannotator/packages/server/codex-review-schema.json +41 -0
- package/3p/pi-plannotator/packages/server/codex-review.ts +330 -0
- package/3p/pi-plannotator/packages/server/config.ts +8 -0
- package/3p/pi-plannotator/packages/server/draft.ts +1 -0
- package/3p/pi-plannotator/packages/server/editor-annotations.ts +76 -0
- package/3p/pi-plannotator/packages/server/external-annotations.test.ts +18 -0
- package/3p/pi-plannotator/packages/server/external-annotations.ts +207 -0
- package/3p/pi-plannotator/packages/server/git.ts +141 -0
- package/3p/pi-plannotator/packages/server/goal-setup.test.ts +55 -0
- package/3p/pi-plannotator/packages/server/goal-setup.ts +248 -0
- package/3p/pi-plannotator/packages/server/ide.ts +43 -0
- package/3p/pi-plannotator/packages/server/image.test.ts +63 -0
- package/3p/pi-plannotator/packages/server/image.ts +66 -0
- package/3p/pi-plannotator/packages/server/index.ts +648 -0
- package/3p/pi-plannotator/packages/server/integrations.test.ts +172 -0
- package/3p/pi-plannotator/packages/server/integrations.ts +214 -0
- package/3p/pi-plannotator/packages/server/jj.test.ts +69 -0
- package/3p/pi-plannotator/packages/server/jj.ts +86 -0
- package/3p/pi-plannotator/packages/server/p4.ts +417 -0
- package/3p/pi-plannotator/packages/server/package.json +40 -0
- package/3p/pi-plannotator/packages/server/path-utils.ts +18 -0
- package/3p/pi-plannotator/packages/server/pr.ts +146 -0
- package/3p/pi-plannotator/packages/server/project.test.ts +115 -0
- package/3p/pi-plannotator/packages/server/project.ts +45 -0
- package/3p/pi-plannotator/packages/server/reference-handlers.ts +404 -0
- package/3p/pi-plannotator/packages/server/remote.test.ts +150 -0
- package/3p/pi-plannotator/packages/server/remote.ts +74 -0
- package/3p/pi-plannotator/packages/server/repo.ts +80 -0
- package/3p/pi-plannotator/packages/server/resolve-file.test.ts +310 -0
- package/3p/pi-plannotator/packages/server/review-workspace.test.ts +1032 -0
- package/3p/pi-plannotator/packages/server/review-workspace.ts +48 -0
- package/3p/pi-plannotator/packages/server/review.ts +1318 -0
- package/3p/pi-plannotator/packages/server/sessions.ts +111 -0
- package/3p/pi-plannotator/packages/server/share-url.ts +53 -0
- package/3p/pi-plannotator/packages/server/shared-handlers.test.ts +43 -0
- package/3p/pi-plannotator/packages/server/shared-handlers.ts +177 -0
- package/3p/pi-plannotator/packages/server/storage.test.ts +176 -0
- package/3p/pi-plannotator/packages/server/storage.ts +17 -0
- package/3p/pi-plannotator/packages/server/tour/tour-review.test.ts +146 -0
- package/3p/pi-plannotator/packages/server/tour/tour-review.ts +604 -0
- package/3p/pi-plannotator/packages/server/tsconfig.json +15 -0
- package/3p/pi-plannotator/packages/server/vcs.test.ts +48 -0
- package/3p/pi-plannotator/packages/server/vcs.ts +80 -0
- package/3p/pi-plannotator/packages/shared/agent-jobs.ts +132 -0
- package/3p/pi-plannotator/packages/shared/agents.ts +53 -0
- package/3p/pi-plannotator/packages/shared/annotate-args.test.ts +386 -0
- package/3p/pi-plannotator/packages/shared/annotate-args.ts +107 -0
- package/3p/pi-plannotator/packages/shared/at-reference.test.ts +99 -0
- package/3p/pi-plannotator/packages/shared/at-reference.ts +52 -0
- package/3p/pi-plannotator/packages/shared/checklist.ts +52 -0
- package/3p/pi-plannotator/packages/shared/code-file.test.ts +112 -0
- package/3p/pi-plannotator/packages/shared/code-file.ts +41 -0
- package/3p/pi-plannotator/packages/shared/code-nav.test.ts +515 -0
- package/3p/pi-plannotator/packages/shared/code-nav.ts +436 -0
- package/3p/pi-plannotator/packages/shared/compress.ts +51 -0
- package/3p/pi-plannotator/packages/shared/config.ts +262 -0
- package/3p/pi-plannotator/packages/shared/crypto.test.ts +172 -0
- package/3p/pi-plannotator/packages/shared/crypto.ts +97 -0
- package/3p/pi-plannotator/packages/shared/data-dir.ts +42 -0
- package/3p/pi-plannotator/packages/shared/diff-paths.test.ts +30 -0
- package/3p/pi-plannotator/packages/shared/diff-paths.ts +137 -0
- package/3p/pi-plannotator/packages/shared/draft.ts +64 -0
- package/3p/pi-plannotator/packages/shared/external-annotation.ts +397 -0
- package/3p/pi-plannotator/packages/shared/extract-code-paths.test.ts +59 -0
- package/3p/pi-plannotator/packages/shared/extract-code-paths.ts +66 -0
- package/3p/pi-plannotator/packages/shared/favicon.ts +5 -0
- package/3p/pi-plannotator/packages/shared/feedback-templates.test.ts +65 -0
- package/3p/pi-plannotator/packages/shared/feedback-templates.ts +29 -0
- package/3p/pi-plannotator/packages/shared/goal-setup.test.ts +231 -0
- package/3p/pi-plannotator/packages/shared/goal-setup.ts +336 -0
- package/3p/pi-plannotator/packages/shared/html-to-markdown.test.ts +62 -0
- package/3p/pi-plannotator/packages/shared/html-to-markdown.ts +32 -0
- package/3p/pi-plannotator/packages/shared/improvement-hooks.test.ts +135 -0
- package/3p/pi-plannotator/packages/shared/improvement-hooks.ts +115 -0
- package/3p/pi-plannotator/packages/shared/integrations-common.ts +243 -0
- package/3p/pi-plannotator/packages/shared/jj-core.test.ts +236 -0
- package/3p/pi-plannotator/packages/shared/jj-core.ts +433 -0
- package/3p/pi-plannotator/packages/shared/package.json +55 -0
- package/3p/pi-plannotator/packages/shared/pfm-reminder.test.ts +88 -0
- package/3p/pi-plannotator/packages/shared/pfm-reminder.ts +80 -0
- package/3p/pi-plannotator/packages/shared/pr-github.ts +661 -0
- package/3p/pi-plannotator/packages/shared/pr-gitlab.test.ts +202 -0
- package/3p/pi-plannotator/packages/shared/pr-gitlab.ts +620 -0
- package/3p/pi-plannotator/packages/shared/pr-provider.test.ts +266 -0
- package/3p/pi-plannotator/packages/shared/pr-provider.ts +123 -0
- package/3p/pi-plannotator/packages/shared/pr-stack.test.ts +104 -0
- package/3p/pi-plannotator/packages/shared/pr-stack.ts +194 -0
- package/3p/pi-plannotator/packages/shared/pr-types.ts +326 -0
- package/3p/pi-plannotator/packages/shared/project.ts +71 -0
- package/3p/pi-plannotator/packages/shared/prompts-integration.test.ts +421 -0
- package/3p/pi-plannotator/packages/shared/prompts.test.ts +504 -0
- package/3p/pi-plannotator/packages/shared/prompts.ts +247 -0
- package/3p/pi-plannotator/packages/shared/reference-common.ts +87 -0
- package/3p/pi-plannotator/packages/shared/repo.ts +71 -0
- package/3p/pi-plannotator/packages/shared/resolve-file.test.ts +113 -0
- package/3p/pi-plannotator/packages/shared/resolve-file.ts +509 -0
- package/3p/pi-plannotator/packages/shared/review-args.test.ts +64 -0
- package/3p/pi-plannotator/packages/shared/review-args.ts +85 -0
- package/3p/pi-plannotator/packages/shared/review-core.test.ts +286 -0
- package/3p/pi-plannotator/packages/shared/review-core.ts +895 -0
- package/3p/pi-plannotator/packages/shared/review-workspace-node.ts +230 -0
- package/3p/pi-plannotator/packages/shared/review-workspace.ts +436 -0
- package/3p/pi-plannotator/packages/shared/semantic-diff-types.ts +76 -0
- package/3p/pi-plannotator/packages/shared/semantic-diff.test.ts +322 -0
- package/3p/pi-plannotator/packages/shared/semantic-diff.ts +520 -0
- package/3p/pi-plannotator/packages/shared/storage.ts +378 -0
- package/3p/pi-plannotator/packages/shared/tour.ts +61 -0
- package/3p/pi-plannotator/packages/shared/tsconfig.json +15 -0
- package/3p/pi-plannotator/packages/shared/types.ts +29 -0
- package/3p/pi-plannotator/packages/shared/url-to-markdown.test.ts +177 -0
- package/3p/pi-plannotator/packages/shared/url-to-markdown.ts +351 -0
- package/3p/pi-plannotator/packages/shared/vcs-core.test.ts +332 -0
- package/3p/pi-plannotator/packages/shared/vcs-core.ts +482 -0
- package/3p/pi-plannotator/packages/shared/worktree-pool.test.ts +162 -0
- package/3p/pi-plannotator/packages/shared/worktree-pool.ts +103 -0
- package/3p/pi-plannotator/packages/shared/worktree.ts +119 -0
- package/3p/pi-subagents/package.json +50 -0
- package/3p/pi-subagents/src/agent-manager.ts +413 -0
- package/3p/pi-subagents/src/agent-runner.ts +502 -0
- package/3p/pi-subagents/src/agent-types.ts +248 -0
- package/3p/pi-subagents/src/context.ts +58 -0
- package/3p/pi-subagents/src/cross-extension-rpc.ts +135 -0
- package/3p/pi-subagents/src/custom-agents.ts +137 -0
- package/3p/pi-subagents/src/default-agents.ts +144 -0
- package/3p/pi-subagents/src/env.ts +33 -0
- package/3p/pi-subagents/src/group-join.ts +141 -0
- package/3p/pi-subagents/src/index.ts +1811 -0
- package/3p/pi-subagents/src/invocation-config.ts +40 -0
- package/3p/pi-subagents/src/memory.ts +165 -0
- package/3p/pi-subagents/src/model-resolver.ts +81 -0
- package/3p/pi-subagents/src/output-file.ts +77 -0
- package/3p/pi-subagents/src/prompts.ts +85 -0
- package/3p/pi-subagents/src/skill-loader.ts +79 -0
- package/3p/pi-subagents/src/types.ts +111 -0
- package/3p/pi-subagents/src/ui/agent-widget.ts +496 -0
- package/3p/pi-subagents/src/ui/conversation-viewer.ts +250 -0
- package/3p/pi-subagents/src/worktree.ts +162 -0
- package/3p/pi-tasks/package.json +52 -0
- package/3p/pi-tasks/src/auto-clear.ts +91 -0
- package/3p/pi-tasks/src/index.ts +1150 -0
- package/3p/pi-tasks/src/process-tracker.ts +140 -0
- package/3p/pi-tasks/src/reminder-cadence.ts +90 -0
- package/3p/pi-tasks/src/task-store.ts +324 -0
- package/3p/pi-tasks/src/tasks-config.ts +27 -0
- package/3p/pi-tasks/src/types.ts +40 -0
- package/3p/pi-tasks/src/ui/settings-menu.ts +152 -0
- package/3p/pi-tasks/src/ui/task-widget.ts +296 -0
- package/AGENTS.md +28 -0
- package/LICENSE +201 -0
- package/extensions/orchestrator/agents/brainstorm-reviewer.ts +77 -0
- package/extensions/orchestrator/agents/code-reviewer.ts +89 -0
- package/extensions/orchestrator/agents/explore.ts +33 -0
- package/extensions/orchestrator/agents/librarian.ts +43 -0
- package/extensions/orchestrator/agents/plan-reviewer.ts +75 -0
- package/extensions/orchestrator/agents/planner.ts +61 -0
- package/extensions/orchestrator/agents/registry.ts +156 -0
- package/extensions/orchestrator/agents/task.ts +50 -0
- package/extensions/orchestrator/agents/tool-routing.ts +84 -0
- package/extensions/orchestrator/ast-search.ts +85 -0
- package/extensions/orchestrator/cbm.ts +330 -0
- package/extensions/orchestrator/command-handlers.test.ts +163 -0
- package/extensions/orchestrator/command-handlers.ts +116 -0
- package/extensions/orchestrator/commands.test.ts +81 -0
- package/extensions/orchestrator/commands.ts +75 -0
- package/extensions/orchestrator/config.test.ts +221 -0
- package/extensions/orchestrator/config.ts +230 -0
- package/extensions/orchestrator/context.test.ts +293 -0
- package/extensions/orchestrator/context.ts +206 -0
- package/extensions/orchestrator/event-handlers.test.ts +190 -0
- package/extensions/orchestrator/event-handlers.ts +1416 -0
- package/extensions/orchestrator/exa.ts +104 -0
- package/extensions/orchestrator/flant-infra.ts +486 -0
- package/extensions/orchestrator/index.ts +80 -0
- package/extensions/orchestrator/integration.test.ts +1214 -0
- package/extensions/orchestrator/orchestrator.test.ts +252 -0
- package/extensions/orchestrator/orchestrator.ts +538 -0
- package/extensions/orchestrator/phases/brainstorm.test.ts +15 -0
- package/extensions/orchestrator/phases/brainstorm.ts +273 -0
- package/extensions/orchestrator/phases/implementation.ts +40 -0
- package/extensions/orchestrator/phases/machine.test.ts +293 -0
- package/extensions/orchestrator/phases/machine.ts +209 -0
- package/extensions/orchestrator/phases/planning.ts +255 -0
- package/extensions/orchestrator/phases/review.ts +193 -0
- package/extensions/orchestrator/plannotator.ts +56 -0
- package/extensions/orchestrator/pp-menu.ts +866 -0
- package/extensions/orchestrator/state.test.ts +343 -0
- package/extensions/orchestrator/state.ts +237 -0
- package/extensions/orchestrator/validate-artifacts.test.ts +88 -0
- package/extensions/orchestrator/validate-artifacts.ts +272 -0
- package/extensions/orchestrator/vendor.d.ts +26 -0
- package/package.json +73 -0
- package/scripts/postinstall.sh +18 -0
|
@@ -0,0 +1,144 @@
|
|
|
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
|
+
|
|
7
|
+
import type { AgentConfig } from "./types.js";
|
|
8
|
+
|
|
9
|
+
const READ_ONLY_TOOLS = ["read", "bash", "grep", "find", "ls"];
|
|
10
|
+
|
|
11
|
+
export const DEFAULT_AGENTS: Map<string, AgentConfig> = new Map([
|
|
12
|
+
[
|
|
13
|
+
"general-purpose",
|
|
14
|
+
{
|
|
15
|
+
name: "general-purpose",
|
|
16
|
+
displayName: "Agent",
|
|
17
|
+
description: "General-purpose agent for complex, multi-step tasks",
|
|
18
|
+
// builtinToolNames omitted — means "all available tools" (resolved at lookup time)
|
|
19
|
+
extensions: true,
|
|
20
|
+
skills: true,
|
|
21
|
+
systemPrompt: "",
|
|
22
|
+
promptMode: "append",
|
|
23
|
+
inheritContext: false,
|
|
24
|
+
runInBackground: false,
|
|
25
|
+
isolated: false,
|
|
26
|
+
isDefault: true,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"Explore",
|
|
31
|
+
{
|
|
32
|
+
name: "Explore",
|
|
33
|
+
displayName: "Explore",
|
|
34
|
+
description: "Fast codebase exploration agent (read-only)",
|
|
35
|
+
builtinToolNames: READ_ONLY_TOOLS,
|
|
36
|
+
extensions: true,
|
|
37
|
+
skills: true,
|
|
38
|
+
model: "anthropic/claude-haiku-4-5-20251001",
|
|
39
|
+
systemPrompt: `# CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS
|
|
40
|
+
You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
|
|
41
|
+
Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools.
|
|
42
|
+
|
|
43
|
+
You are STRICTLY PROHIBITED from:
|
|
44
|
+
- Creating new files
|
|
45
|
+
- Modifying existing files
|
|
46
|
+
- Deleting files
|
|
47
|
+
- Moving or copying files
|
|
48
|
+
- Creating temporary files anywhere, including /tmp
|
|
49
|
+
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
50
|
+
- Running ANY commands that change system state
|
|
51
|
+
|
|
52
|
+
# Tool routing — pick the right tool for the question
|
|
53
|
+
|
|
54
|
+
Discovery (don't know where to look):
|
|
55
|
+
- cbm_search: natural-language search across all symbols (best first step)
|
|
56
|
+
- cbm_search_code: graph-augmented grep — finds text, deduplicates into containing functions
|
|
57
|
+
- grep: fast text/regex search for known strings
|
|
58
|
+
|
|
59
|
+
Structural patterns (find code shapes, not names):
|
|
60
|
+
- ast_search: AST-aware pattern matching (e.g. 'if err != nil { $$$ }', 'type $N interface { $$$ }')
|
|
61
|
+
|
|
62
|
+
File navigation:
|
|
63
|
+
- find: locate files by name/glob pattern
|
|
64
|
+
- read: read file contents
|
|
65
|
+
- ls: list directory contents
|
|
66
|
+
|
|
67
|
+
Use Bash ONLY for read-only operations: git status, git log, git diff.
|
|
68
|
+
Make independent tool calls in parallel for efficiency.
|
|
69
|
+
|
|
70
|
+
# Output
|
|
71
|
+
- Use absolute file paths in all references
|
|
72
|
+
- Do not use emojis
|
|
73
|
+
- Be thorough and precise`,
|
|
74
|
+
promptMode: "replace",
|
|
75
|
+
inheritContext: false,
|
|
76
|
+
runInBackground: false,
|
|
77
|
+
isolated: false,
|
|
78
|
+
isDefault: true,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
"Plan",
|
|
83
|
+
{
|
|
84
|
+
name: "Plan",
|
|
85
|
+
displayName: "Plan",
|
|
86
|
+
description: "Software architect for implementation planning (read-only)",
|
|
87
|
+
builtinToolNames: READ_ONLY_TOOLS,
|
|
88
|
+
extensions: true,
|
|
89
|
+
skills: true,
|
|
90
|
+
systemPrompt: `# CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS
|
|
91
|
+
You are a software architect and planning specialist.
|
|
92
|
+
Your role is EXCLUSIVELY to explore the codebase and design implementation plans.
|
|
93
|
+
You do NOT have access to file editing tools — attempting to edit files will fail.
|
|
94
|
+
|
|
95
|
+
You are STRICTLY PROHIBITED from:
|
|
96
|
+
- Creating new files
|
|
97
|
+
- Modifying existing files
|
|
98
|
+
- Deleting files
|
|
99
|
+
- Moving or copying files
|
|
100
|
+
- Creating temporary files anywhere, including /tmp
|
|
101
|
+
- Using redirect operators (>, >>, |) or heredocs to write to files
|
|
102
|
+
- Running ANY commands that change system state
|
|
103
|
+
|
|
104
|
+
# Tool routing — understand the codebase before planning
|
|
105
|
+
|
|
106
|
+
Architecture overview:
|
|
107
|
+
- cbm_search: natural-language search for relevant symbols
|
|
108
|
+
- cbm_search_code: graph-augmented grep — deduplicates into containing functions
|
|
109
|
+
|
|
110
|
+
Detailed understanding:
|
|
111
|
+
- grep: fast text/regex search for known strings
|
|
112
|
+
- read: read file contents
|
|
113
|
+
- find: locate files by name/glob pattern
|
|
114
|
+
|
|
115
|
+
Use Bash ONLY for read-only operations: git status, git log, git diff.
|
|
116
|
+
|
|
117
|
+
# Planning Process
|
|
118
|
+
1. Understand requirements
|
|
119
|
+
2. Explore thoroughly (search for patterns, understand architecture)
|
|
120
|
+
3. Design solution based on your assigned perspective
|
|
121
|
+
4. Detail the plan with step-by-step implementation strategy
|
|
122
|
+
|
|
123
|
+
# Requirements
|
|
124
|
+
- Consider trade-offs and architectural decisions
|
|
125
|
+
- Identify dependencies and sequencing
|
|
126
|
+
- Anticipate potential challenges
|
|
127
|
+
- Follow existing patterns where appropriate
|
|
128
|
+
|
|
129
|
+
# Output Format
|
|
130
|
+
- Use absolute file paths
|
|
131
|
+
- Do not use emojis
|
|
132
|
+
- End your response with:
|
|
133
|
+
|
|
134
|
+
### Critical Files for Implementation
|
|
135
|
+
List 3-5 files most critical for implementing this plan:
|
|
136
|
+
- /absolute/path/to/file.ts - [Brief reason]`,
|
|
137
|
+
promptMode: "replace",
|
|
138
|
+
inheritContext: false,
|
|
139
|
+
runInBackground: false,
|
|
140
|
+
isolated: false,
|
|
141
|
+
isDefault: true,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
]);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* env.ts — Detect environment info (git, platform) for subagent system prompts.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
import type { EnvInfo } from "./types.js";
|
|
7
|
+
|
|
8
|
+
export async function detectEnv(pi: ExtensionAPI, cwd: string): Promise<EnvInfo> {
|
|
9
|
+
let isGitRepo = false;
|
|
10
|
+
let branch = "";
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const result = await pi.exec("git", ["rev-parse", "--is-inside-work-tree"], { cwd, timeout: 5000 });
|
|
14
|
+
isGitRepo = result.code === 0 && result.stdout.trim() === "true";
|
|
15
|
+
} catch {
|
|
16
|
+
// Not a git repo or git not installed
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (isGitRepo) {
|
|
20
|
+
try {
|
|
21
|
+
const result = await pi.exec("git", ["branch", "--show-current"], { cwd, timeout: 5000 });
|
|
22
|
+
branch = result.code === 0 ? result.stdout.trim() : "unknown";
|
|
23
|
+
} catch {
|
|
24
|
+
branch = "unknown";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
isGitRepo,
|
|
30
|
+
branch,
|
|
31
|
+
platform: process.platform,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
|
|
9
|
+
import type { AgentRecord } from "./types.js";
|
|
10
|
+
|
|
11
|
+
export type DeliveryCallback = (records: AgentRecord[], partial: boolean) => void;
|
|
12
|
+
|
|
13
|
+
interface AgentGroup {
|
|
14
|
+
groupId: string;
|
|
15
|
+
agentIds: Set<string>;
|
|
16
|
+
completedRecords: Map<string, AgentRecord>;
|
|
17
|
+
timeoutHandle?: ReturnType<typeof setTimeout>;
|
|
18
|
+
delivered: boolean;
|
|
19
|
+
/** Shorter timeout for stragglers after a partial delivery. */
|
|
20
|
+
isStraggler: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Default timeout: 30s after first completion in a group. */
|
|
24
|
+
const DEFAULT_TIMEOUT = 30_000;
|
|
25
|
+
/** Straggler re-batch timeout: 15s. */
|
|
26
|
+
const STRAGGLER_TIMEOUT = 15_000;
|
|
27
|
+
|
|
28
|
+
export class GroupJoinManager {
|
|
29
|
+
private groups = new Map<string, AgentGroup>();
|
|
30
|
+
private agentToGroup = new Map<string, string>();
|
|
31
|
+
|
|
32
|
+
constructor(
|
|
33
|
+
private deliverCb: DeliveryCallback,
|
|
34
|
+
private groupTimeout = DEFAULT_TIMEOUT,
|
|
35
|
+
) {}
|
|
36
|
+
|
|
37
|
+
/** Register a group of agent IDs that should be joined. */
|
|
38
|
+
registerGroup(groupId: string, agentIds: string[]): void {
|
|
39
|
+
const group: AgentGroup = {
|
|
40
|
+
groupId,
|
|
41
|
+
agentIds: new Set(agentIds),
|
|
42
|
+
completedRecords: new Map(),
|
|
43
|
+
delivered: false,
|
|
44
|
+
isStraggler: false,
|
|
45
|
+
};
|
|
46
|
+
this.groups.set(groupId, group);
|
|
47
|
+
for (const id of agentIds) {
|
|
48
|
+
this.agentToGroup.set(id, groupId);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Called when an agent completes.
|
|
54
|
+
* Returns:
|
|
55
|
+
* - 'pass' — agent is not grouped, caller should send individual nudge
|
|
56
|
+
* - 'held' — result held, waiting for group completion
|
|
57
|
+
* - 'delivered' — this completion triggered the group notification
|
|
58
|
+
*/
|
|
59
|
+
onAgentComplete(record: AgentRecord): 'delivered' | 'held' | 'pass' {
|
|
60
|
+
const groupId = this.agentToGroup.get(record.id);
|
|
61
|
+
if (!groupId) return 'pass';
|
|
62
|
+
|
|
63
|
+
const group = this.groups.get(groupId);
|
|
64
|
+
if (!group || group.delivered) return 'pass';
|
|
65
|
+
|
|
66
|
+
group.completedRecords.set(record.id, record);
|
|
67
|
+
|
|
68
|
+
// All done — deliver immediately
|
|
69
|
+
if (group.completedRecords.size >= group.agentIds.size) {
|
|
70
|
+
this.deliver(group, false);
|
|
71
|
+
return 'delivered';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// First completion in this batch — start timeout
|
|
75
|
+
if (!group.timeoutHandle) {
|
|
76
|
+
const timeout = group.isStraggler ? STRAGGLER_TIMEOUT : this.groupTimeout;
|
|
77
|
+
group.timeoutHandle = setTimeout(() => {
|
|
78
|
+
this.onTimeout(group);
|
|
79
|
+
}, timeout);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return 'held';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private onTimeout(group: AgentGroup): void {
|
|
86
|
+
if (group.delivered) return;
|
|
87
|
+
group.timeoutHandle = undefined;
|
|
88
|
+
|
|
89
|
+
// Partial delivery — some agents still running
|
|
90
|
+
const remaining = new Set<string>();
|
|
91
|
+
for (const id of group.agentIds) {
|
|
92
|
+
if (!group.completedRecords.has(id)) remaining.add(id);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Clean up agentToGroup for delivered agents (they won't complete again)
|
|
96
|
+
for (const id of group.completedRecords.keys()) {
|
|
97
|
+
this.agentToGroup.delete(id);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Deliver what we have
|
|
101
|
+
this.deliverCb([...group.completedRecords.values()], true);
|
|
102
|
+
|
|
103
|
+
// Set up straggler group for remaining agents
|
|
104
|
+
group.completedRecords.clear();
|
|
105
|
+
group.agentIds = remaining;
|
|
106
|
+
group.isStraggler = true;
|
|
107
|
+
// Timeout will be started when the next straggler completes
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private deliver(group: AgentGroup, partial: boolean): void {
|
|
111
|
+
if (group.timeoutHandle) {
|
|
112
|
+
clearTimeout(group.timeoutHandle);
|
|
113
|
+
group.timeoutHandle = undefined;
|
|
114
|
+
}
|
|
115
|
+
group.delivered = true;
|
|
116
|
+
this.deliverCb([...group.completedRecords.values()], partial);
|
|
117
|
+
this.cleanupGroup(group.groupId);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private cleanupGroup(groupId: string): void {
|
|
121
|
+
const group = this.groups.get(groupId);
|
|
122
|
+
if (!group) return;
|
|
123
|
+
for (const id of group.agentIds) {
|
|
124
|
+
this.agentToGroup.delete(id);
|
|
125
|
+
}
|
|
126
|
+
this.groups.delete(groupId);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Check if an agent is in a group. */
|
|
130
|
+
isGrouped(agentId: string): boolean {
|
|
131
|
+
return this.agentToGroup.has(agentId);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
dispose(): void {
|
|
135
|
+
for (const group of this.groups.values()) {
|
|
136
|
+
if (group.timeoutHandle) clearTimeout(group.timeoutHandle);
|
|
137
|
+
}
|
|
138
|
+
this.groups.clear();
|
|
139
|
+
this.agentToGroup.clear();
|
|
140
|
+
}
|
|
141
|
+
}
|