@iaforged/context-code 1.2.9 → 1.2.10
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 +119 -119
- package/context-bootstrap.js +26 -26
- package/dist/src/QueryEngine.js +394 -327
- package/dist/src/bridge/bridgeUI.js +1 -1
- package/dist/src/buddy/prompt.js +4 -4
- package/dist/src/cli/handlers/auth.js +126 -9
- package/dist/src/cli/print.js +35 -1
- package/dist/src/commands/agent/agent.js +28 -2
- package/dist/src/commands/agent/agentStore.js +8 -1
- package/dist/src/commands/agent/index.js +1 -1
- package/dist/src/commands/bridge-kick.js +9 -9
- package/dist/src/commands/commit.js +34 -34
- package/dist/src/commands/init-verifiers.js +3 -3
- package/dist/src/commands/init.js +88 -88
- package/dist/src/commands/insights.js +787 -787
- package/dist/src/commands/install.js +19 -19
- package/dist/src/commands/login/login.js +21 -12
- package/dist/src/commands/logout/logout.js +9 -0
- package/dist/src/commands/model/model.js +9 -4
- package/dist/src/commands/orchestrate/SwarmUI.js +50 -0
- package/dist/src/commands/orchestrate/index.js +2 -2
- package/dist/src/commands/orchestrate/orchestrate.js +708 -12
- package/dist/src/commands/pr_comments/index.js +33 -33
- package/dist/src/commands/profile/index.js +1 -1
- package/dist/src/commands/profile/profile.js +52 -3
- package/dist/src/commands/provider/index.js +1 -1
- package/dist/src/commands/provider/provider.js +117 -45
- package/dist/src/commands/resumen/index.js +9 -0
- package/dist/src/commands/resumen/resumen.js +29 -0
- package/dist/src/commands/security-review.js +190 -190
- package/dist/src/commands/swarm-auto/index.js +9 -0
- package/dist/src/commands/swarm-auto/swarmAuto.js +111 -0
- package/dist/src/commands/swarm-init/index.js +9 -0
- package/dist/src/commands/swarm-init/swarmInit.js +72 -0
- package/dist/src/commands/team/team.js +39 -6
- package/dist/src/commands.js +14 -0
- package/dist/src/components/LogoV2/CondensedLogo.js +2 -2
- package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +3 -3
- package/dist/src/components/agents/agentFileUtils.js +6 -6
- package/dist/src/components/permissions/hooks.js +5 -5
- package/dist/src/constants/outputStyles.js +83 -83
- package/dist/src/core/agents/blueprints.js +58 -0
- package/dist/src/core/agents/cliAdapter.js +61 -0
- package/dist/src/core/agents/registry.js +93 -0
- package/dist/src/core/agents/runtime.js +4 -0
- package/dist/src/core/agents/runtime.smoke.js +42 -0
- package/dist/src/core/agents/swarm.smoke.js +48 -0
- package/dist/src/core/agents/swarmTools.js +38 -0
- package/dist/src/core/auth/index.js +2 -0
- package/dist/src/core/auth/loginCliAdapter.js +24 -0
- package/dist/src/core/auth/loginCore.js +67 -0
- package/dist/src/core/auth/logoutCliAdapter.js +34 -0
- package/dist/src/core/auth/logoutCore.js +52 -0
- package/dist/src/core/auth/preflight.smoke.js +151 -0
- package/dist/src/core/index.js +21 -0
- package/dist/src/core/mcp/blueprints.js +27 -0
- package/dist/src/core/mcp/common.js +14 -0
- package/dist/src/core/mcp/runtime.js +67 -0
- package/dist/src/core/mcp/runtime.smoke.js +50 -0
- package/dist/src/core/mcp/swarmClient.js +40 -0
- package/dist/src/core/mcp/swarmSetup.js +43 -0
- package/dist/src/core/providers/cliAdapter.js +39 -0
- package/dist/src/core/providers/contracts.js +1 -0
- package/dist/src/core/providers/index.js +3 -0
- package/dist/src/core/providers/llmCore.js +123 -0
- package/dist/src/core/providers/providerCore.js +141 -0
- package/dist/src/core/providers/providerModelCompatibility.js +98 -0
- package/dist/src/core/providers/providerParitySmoke.js +83 -0
- package/dist/src/core/providers/providerProfileModelSmoke.js +80 -0
- package/dist/src/core/query/contracts.js +1 -0
- package/dist/src/core/query/runtime.js +117 -0
- package/dist/src/core/query/runtime.smoke.js +39 -0
- package/dist/src/core/query/timelineThinking.smoke.js +25 -0
- package/dist/src/core/query/wiring.smoke.js +76 -0
- package/dist/src/core/skills/cliAdapter.js +38 -0
- package/dist/src/core/skills/index.js +52 -0
- package/dist/src/core/skills/runtime.smoke.js +53 -0
- package/dist/src/core/tasks/runtime.js +205 -0
- package/dist/src/core/tasks/runtime.smoke.js +63 -0
- package/dist/src/core/tasks/sdkAdapter.js +4 -0
- package/dist/src/core/tools/contracts.js +3 -0
- package/dist/src/core/tools/fileResolution.js +112 -0
- package/dist/src/core/tools/fileResolution.smoke.js +33 -0
- package/dist/src/core/tools/filesCore.js +51 -0
- package/dist/src/core/tools/filesCore.smoke.js +108 -0
- package/dist/src/core/tools/gitCore.js +20 -0
- package/dist/src/core/tools/imageParity.smoke.js +36 -0
- package/dist/src/core/tools/notebookParity.smoke.js +68 -0
- package/dist/src/core/tools/registry.js +22 -0
- package/dist/src/core/tools/runtime.smoke.js +32 -0
- package/dist/src/core/tools/shellCore.js +60 -0
- package/dist/src/core/types/agentContext.js +9 -0
- package/dist/src/core/types/auth.js +3 -0
- package/dist/src/core/types/command.js +13 -0
- package/dist/src/core/types/provider.js +3 -0
- package/dist/src/core/types/sdkEvent.js +10 -0
- package/dist/src/core/types/swarm.js +1 -0
- package/dist/src/cost-tracker.js +3 -3
- package/dist/src/hooks/useAwaySummary.js +22 -9
- package/dist/src/main.js +32 -2
- package/dist/src/screens/REPL.js +9 -0
- package/dist/src/services/AgentSummary/agentSummary.js +10 -10
- package/dist/src/services/autoDream/autoDream.js +5 -5
- package/dist/src/services/autoDream/consolidationPrompt.js +49 -49
- package/dist/src/services/compact/prompt.js +238 -238
- package/dist/src/services/limits/sessionCounter.js +17 -17
- package/dist/src/services/mcp/client.js +27 -1
- package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +39 -20
- package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +65 -58
- package/dist/src/skills/bundled/loop.js +57 -57
- package/dist/src/skills/bundled/remember.js +53 -53
- package/dist/src/skills/bundled/simplify.js +49 -49
- package/dist/src/skills/bundled/skillify.js +2 -2
- package/dist/src/state/onChangeAppState.js +6 -0
- package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +5 -5
- package/dist/src/tasks/LocalMainSessionTask.js +5 -5
- package/dist/src/tasks/LocalShellTask/LocalShellTask.js +13 -13
- package/dist/src/tools/AgentTool/forkSubagent.js +25 -25
- package/dist/src/tools/AskUserQuestionTool/prompt.js +29 -29
- package/dist/src/tools/BashTool/BashTool.js +27 -2
- package/dist/src/tools/BriefTool/prompt.js +14 -14
- package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +12 -12
- package/dist/src/tools/EnterPlanModeTool/prompt.js +140 -140
- package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +18 -18
- package/dist/src/tools/ExitPlanModeTool/prompt.js +23 -23
- package/dist/src/tools/ExitWorktreeTool/prompt.js +29 -29
- package/dist/src/tools/FileEditTool/prompt.js +7 -7
- package/dist/src/tools/FileReadTool/FileReadTool.js +18 -1
- package/dist/src/tools/FileWriteTool/prompt.js +6 -6
- package/dist/src/tools/GlobTool/prompt.js +4 -4
- package/dist/src/tools/GrepTool/prompt.js +10 -10
- package/dist/src/tools/LSPTool/prompt.js +18 -18
- package/dist/src/tools/ListMcpResourcesTool/prompt.js +15 -15
- package/dist/src/tools/PowerShellTool/PowerShellTool.js +25 -2
- package/dist/src/tools/ReadMcpResourceTool/prompt.js +13 -13
- package/dist/src/tools/SendMessageTool/prompt.js +36 -36
- package/dist/src/tools/SkillTool/prompt.js +21 -21
- package/dist/src/tools/SleepTool/prompt.js +10 -10
- package/dist/src/tools/TaskCreateTool/prompt.js +41 -41
- package/dist/src/tools/TaskGetTool/prompt.js +21 -21
- package/dist/src/tools/TaskListTool/prompt.js +30 -30
- package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +8 -8
- package/dist/src/tools/TaskStopTool/prompt.js +5 -5
- package/dist/src/tools/TaskUpdateTool/prompt.js +74 -74
- package/dist/src/tools/TodoWriteTool/prompt.js +178 -178
- package/dist/src/tools/ToolSearchTool/prompt.js +9 -9
- package/dist/src/tools/WebFetchTool/WebFetchTool.js +9 -9
- package/dist/src/tools/WebFetchTool/prompt.js +31 -31
- package/dist/src/tools/WebSearchTool/prompt.js +26 -26
- package/dist/src/utils/agentContext.js +2 -0
- package/dist/src/utils/agenticSessionSearch.js +38 -38
- package/dist/src/utils/config.js +2 -0
- package/dist/src/utils/genericProcessUtils.js +21 -21
- package/dist/src/utils/heapDumpService.js +4 -4
- package/dist/src/utils/mcpValidation.js +2 -2
- package/dist/src/utils/model/modelStrings.js +1 -1
- package/dist/src/utils/model/providers.js +5 -0
- package/dist/src/utils/orchestration/store/providerAgentStore.js +22 -22
- package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +10 -10
- package/dist/src/utils/orchestration/store/runStore.js +68 -68
- package/dist/src/utils/orchestration/store/teamStore.js +28 -28
- package/dist/src/utils/permissions/permissionExplainer.js +6 -6
- package/dist/src/utils/permissions/permissionsDb.js +43 -43
- package/dist/src/utils/sdkEventQueue.js +2 -0
- package/dist/src/utils/secureStorage/sqliteStorage.js +12 -12
- package/dist/src/utils/standardMcp/common.js +15 -0
- package/dist/src/utils/standardMcp/setup.js +52 -0
- package/dist/src/utils/swarm/teammatePromptAddendum.js +10 -10
- package/dist/src/utils/task/framework.js +6 -6
- package/package.json +1 -1
- package/dist/src/commands/usage/index.js +0 -7
- package/dist/src/commands/usage/usage.js +0 -5
|
@@ -4,59 +4,59 @@ export function registerRememberSkill() {
|
|
|
4
4
|
if (process.env.USER_TYPE !== 'ant') {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
const SKILL_PROMPT = `# Memory Review
|
|
8
|
-
|
|
9
|
-
## Goal
|
|
10
|
-
Review the user's memory landscape and produce a clear report of proposed changes, grouped by action type. Do NOT apply changes — present proposals for user approval.
|
|
11
|
-
|
|
12
|
-
## Steps
|
|
13
|
-
|
|
14
|
-
### 1. Gather all memory layers
|
|
15
|
-
Read CLAUDE.md and CLAUDE.local.md from the project root (if they exist). Your auto-memory content is already in your system prompt — review it there. Note which team memory sections exist, if any.
|
|
16
|
-
|
|
17
|
-
**Success criteria**: You have the contents of all memory layers and can compare them.
|
|
18
|
-
|
|
19
|
-
### 2. Classify each auto-memory entry
|
|
20
|
-
For each substantive entry in auto-memory, determine the best destination:
|
|
21
|
-
|
|
22
|
-
| Destination | What belongs there | Examples |
|
|
23
|
-
|---|---|---|
|
|
24
|
-
| **CLAUDE.md** | Project conventions and instructions for Claude that all contributors should follow | "use bun not npm", "API routes use kebab-case", "test command is bun test", "prefer functional style" |
|
|
25
|
-
| **CLAUDE.local.md** | Personal instructions for Claude specific to this user, not applicable to other contributors | "I prefer concise responses", "always explain trade-offs", "don't auto-commit", "run tests before committing" |
|
|
26
|
-
| **Team memory** | Org-wide knowledge that applies across repositories (only if team memory is configured) | "deploy PRs go through #deploy-queue", "staging is at staging.internal", "platform team owns infra" |
|
|
27
|
-
| **Stay in auto-memory** | Working notes, temporary context, or entries that don't clearly fit elsewhere | Session-specific observations, uncertain patterns |
|
|
28
|
-
|
|
29
|
-
**Important distinctions:**
|
|
30
|
-
- CLAUDE.md and CLAUDE.local.md contain instructions for Claude, not user preferences for external tools (editor theme, IDE keybindings, etc. don't belong in either)
|
|
31
|
-
- Workflow practices (PR conventions, merge strategies, branch naming) are ambiguous — ask the user whether they're personal or team-wide
|
|
32
|
-
- When unsure, ask rather than guess
|
|
33
|
-
|
|
34
|
-
**Success criteria**: Each entry has a proposed destination or is flagged as ambiguous.
|
|
35
|
-
|
|
36
|
-
### 3. Identify cleanup opportunities
|
|
37
|
-
Scan across all layers for:
|
|
38
|
-
- **Duplicates**: Auto-memory entries already captured in CLAUDE.md or CLAUDE.local.md → propose removing from auto-memory
|
|
39
|
-
- **Outdated**: CLAUDE.md or CLAUDE.local.md entries contradicted by newer auto-memory entries → propose updating the older layer
|
|
40
|
-
- **Conflicts**: Contradictions between any two layers → propose resolution, noting which is more recent
|
|
41
|
-
|
|
42
|
-
**Success criteria**: All cross-layer issues identified.
|
|
43
|
-
|
|
44
|
-
### 4. Present the report
|
|
45
|
-
Output a structured report grouped by action type:
|
|
46
|
-
1. **Promotions** — entries to move, with destination and rationale
|
|
47
|
-
2. **Cleanup** — duplicates, outdated entries, conflicts to resolve
|
|
48
|
-
3. **Ambiguous** — entries where you need the user's input on destination
|
|
49
|
-
4. **No action needed** — brief note on entries that should stay put
|
|
50
|
-
|
|
51
|
-
If auto-memory is empty, say so and offer to review CLAUDE.md for cleanup.
|
|
52
|
-
|
|
53
|
-
**Success criteria**: User can review and approve/reject each proposal individually.
|
|
54
|
-
|
|
55
|
-
## Rules
|
|
56
|
-
- Present ALL proposals before making any changes
|
|
57
|
-
- Do NOT modify files without explicit user approval
|
|
58
|
-
- Do NOT create new files unless the target doesn't exist yet
|
|
59
|
-
- Ask about ambiguous entries — don't guess
|
|
7
|
+
const SKILL_PROMPT = `# Memory Review
|
|
8
|
+
|
|
9
|
+
## Goal
|
|
10
|
+
Review the user's memory landscape and produce a clear report of proposed changes, grouped by action type. Do NOT apply changes — present proposals for user approval.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
### 1. Gather all memory layers
|
|
15
|
+
Read CLAUDE.md and CLAUDE.local.md from the project root (if they exist). Your auto-memory content is already in your system prompt — review it there. Note which team memory sections exist, if any.
|
|
16
|
+
|
|
17
|
+
**Success criteria**: You have the contents of all memory layers and can compare them.
|
|
18
|
+
|
|
19
|
+
### 2. Classify each auto-memory entry
|
|
20
|
+
For each substantive entry in auto-memory, determine the best destination:
|
|
21
|
+
|
|
22
|
+
| Destination | What belongs there | Examples |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| **CLAUDE.md** | Project conventions and instructions for Claude that all contributors should follow | "use bun not npm", "API routes use kebab-case", "test command is bun test", "prefer functional style" |
|
|
25
|
+
| **CLAUDE.local.md** | Personal instructions for Claude specific to this user, not applicable to other contributors | "I prefer concise responses", "always explain trade-offs", "don't auto-commit", "run tests before committing" |
|
|
26
|
+
| **Team memory** | Org-wide knowledge that applies across repositories (only if team memory is configured) | "deploy PRs go through #deploy-queue", "staging is at staging.internal", "platform team owns infra" |
|
|
27
|
+
| **Stay in auto-memory** | Working notes, temporary context, or entries that don't clearly fit elsewhere | Session-specific observations, uncertain patterns |
|
|
28
|
+
|
|
29
|
+
**Important distinctions:**
|
|
30
|
+
- CLAUDE.md and CLAUDE.local.md contain instructions for Claude, not user preferences for external tools (editor theme, IDE keybindings, etc. don't belong in either)
|
|
31
|
+
- Workflow practices (PR conventions, merge strategies, branch naming) are ambiguous — ask the user whether they're personal or team-wide
|
|
32
|
+
- When unsure, ask rather than guess
|
|
33
|
+
|
|
34
|
+
**Success criteria**: Each entry has a proposed destination or is flagged as ambiguous.
|
|
35
|
+
|
|
36
|
+
### 3. Identify cleanup opportunities
|
|
37
|
+
Scan across all layers for:
|
|
38
|
+
- **Duplicates**: Auto-memory entries already captured in CLAUDE.md or CLAUDE.local.md → propose removing from auto-memory
|
|
39
|
+
- **Outdated**: CLAUDE.md or CLAUDE.local.md entries contradicted by newer auto-memory entries → propose updating the older layer
|
|
40
|
+
- **Conflicts**: Contradictions between any two layers → propose resolution, noting which is more recent
|
|
41
|
+
|
|
42
|
+
**Success criteria**: All cross-layer issues identified.
|
|
43
|
+
|
|
44
|
+
### 4. Present the report
|
|
45
|
+
Output a structured report grouped by action type:
|
|
46
|
+
1. **Promotions** — entries to move, with destination and rationale
|
|
47
|
+
2. **Cleanup** — duplicates, outdated entries, conflicts to resolve
|
|
48
|
+
3. **Ambiguous** — entries where you need the user's input on destination
|
|
49
|
+
4. **No action needed** — brief note on entries that should stay put
|
|
50
|
+
|
|
51
|
+
If auto-memory is empty, say so and offer to review CLAUDE.md for cleanup.
|
|
52
|
+
|
|
53
|
+
**Success criteria**: User can review and approve/reject each proposal individually.
|
|
54
|
+
|
|
55
|
+
## Rules
|
|
56
|
+
- Present ALL proposals before making any changes
|
|
57
|
+
- Do NOT modify files without explicit user approval
|
|
58
|
+
- Do NOT create new files unless the target doesn't exist yet
|
|
59
|
+
- Ask about ambiguous entries — don't guess
|
|
60
60
|
`;
|
|
61
61
|
registerBundledSkill({
|
|
62
62
|
name: 'remember',
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
import { AGENT_TOOL_NAME } from '../../tools/AgentTool/constants.js';
|
|
2
2
|
import { registerBundledSkill } from '../bundledSkills.js';
|
|
3
|
-
const SIMPLIFY_PROMPT = `# Simplify: Code Review and Cleanup
|
|
4
|
-
|
|
5
|
-
Review all changed files for reuse, quality, and efficiency. Fix any issues found.
|
|
6
|
-
|
|
7
|
-
## Phase 1: Identify Changes
|
|
8
|
-
|
|
9
|
-
Run \`git diff\` (or \`git diff HEAD\` if there are staged changes) to see what changed. If there are no git changes, review the most recently modified files that the user mentioned or that you edited earlier in this conversation.
|
|
10
|
-
|
|
11
|
-
## Phase 2: Launch Three Review Agents in Parallel
|
|
12
|
-
|
|
13
|
-
Use the ${AGENT_TOOL_NAME} tool to launch all three agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
|
|
14
|
-
|
|
15
|
-
### Agent 1: Code Reuse Review
|
|
16
|
-
|
|
17
|
-
For each change:
|
|
18
|
-
|
|
19
|
-
1. **Search for existing utilities and helpers** that could replace newly written code. Look for similar patterns elsewhere in the codebase — common locations are utility directories, shared modules, and files adjacent to the changed ones.
|
|
20
|
-
2. **Flag any new function that duplicates existing functionality.** Suggest the existing function to use instead.
|
|
21
|
-
3. **Flag any inline logic that could use an existing utility** — hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns are common candidates.
|
|
22
|
-
|
|
23
|
-
### Agent 2: Code Quality Review
|
|
24
|
-
|
|
25
|
-
Review the same changes for hacky patterns:
|
|
26
|
-
|
|
27
|
-
1. **Redundant state**: state that duplicates existing state, cached values that could be derived, observers/effects that could be direct calls
|
|
28
|
-
2. **Parameter sprawl**: adding new parameters to a function instead of generalizing or restructuring existing ones
|
|
29
|
-
3. **Copy-paste with slight variation**: near-duplicate code blocks that should be unified with a shared abstraction
|
|
30
|
-
4. **Leaky abstractions**: exposing internal details that should be encapsulated, or breaking existing abstraction boundaries
|
|
31
|
-
5. **Stringly-typed code**: using raw strings where constants, enums (string unions), or branded types already exist in the codebase
|
|
32
|
-
6. **Unnecessary JSX nesting**: wrapper Boxes/elements that add no layout value — check if inner component props (flexShrink, alignItems, etc.) already provide the needed behavior
|
|
33
|
-
7. **Unnecessary comments**: comments explaining WHAT the code does (well-named identifiers already do that), narrating the change, or referencing the task/caller — delete; keep only non-obvious WHY (hidden constraints, subtle invariants, workarounds)
|
|
34
|
-
|
|
35
|
-
### Agent 3: Efficiency Review
|
|
36
|
-
|
|
37
|
-
Review the same changes for efficiency:
|
|
38
|
-
|
|
39
|
-
1. **Unnecessary work**: redundant computations, repeated file reads, duplicate network/API calls, N+1 patterns
|
|
40
|
-
2. **Missed concurrency**: independent operations run sequentially when they could run in parallel
|
|
41
|
-
3. **Hot-path bloat**: new blocking work added to startup or per-request/per-render hot paths
|
|
42
|
-
4. **Recurring no-op updates**: state/store updates inside polling loops, intervals, or event handlers that fire unconditionally — add a change-detection guard so downstream consumers aren't notified when nothing changed. Also: if a wrapper function takes an updater/reducer callback, verify it honors same-reference returns (or whatever the "no change" signal is) — otherwise callers' early-return no-ops are silently defeated
|
|
43
|
-
5. **Unnecessary existence checks**: pre-checking file/resource existence before operating (TOCTOU anti-pattern) — operate directly and handle the error
|
|
44
|
-
6. **Memory**: unbounded data structures, missing cleanup, event listener leaks
|
|
45
|
-
7. **Overly broad operations**: reading entire files when only a portion is needed, loading all items when filtering for one
|
|
46
|
-
|
|
47
|
-
## Phase 3: Fix Issues
|
|
48
|
-
|
|
49
|
-
Wait for all three agents to complete. Aggregate their findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on — do not argue with the finding, just skip it.
|
|
50
|
-
|
|
51
|
-
When done, briefly summarize what was fixed (or confirm the code was already clean).
|
|
3
|
+
const SIMPLIFY_PROMPT = `# Simplify: Code Review and Cleanup
|
|
4
|
+
|
|
5
|
+
Review all changed files for reuse, quality, and efficiency. Fix any issues found.
|
|
6
|
+
|
|
7
|
+
## Phase 1: Identify Changes
|
|
8
|
+
|
|
9
|
+
Run \`git diff\` (or \`git diff HEAD\` if there are staged changes) to see what changed. If there are no git changes, review the most recently modified files that the user mentioned or that you edited earlier in this conversation.
|
|
10
|
+
|
|
11
|
+
## Phase 2: Launch Three Review Agents in Parallel
|
|
12
|
+
|
|
13
|
+
Use the ${AGENT_TOOL_NAME} tool to launch all three agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
|
|
14
|
+
|
|
15
|
+
### Agent 1: Code Reuse Review
|
|
16
|
+
|
|
17
|
+
For each change:
|
|
18
|
+
|
|
19
|
+
1. **Search for existing utilities and helpers** that could replace newly written code. Look for similar patterns elsewhere in the codebase — common locations are utility directories, shared modules, and files adjacent to the changed ones.
|
|
20
|
+
2. **Flag any new function that duplicates existing functionality.** Suggest the existing function to use instead.
|
|
21
|
+
3. **Flag any inline logic that could use an existing utility** — hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns are common candidates.
|
|
22
|
+
|
|
23
|
+
### Agent 2: Code Quality Review
|
|
24
|
+
|
|
25
|
+
Review the same changes for hacky patterns:
|
|
26
|
+
|
|
27
|
+
1. **Redundant state**: state that duplicates existing state, cached values that could be derived, observers/effects that could be direct calls
|
|
28
|
+
2. **Parameter sprawl**: adding new parameters to a function instead of generalizing or restructuring existing ones
|
|
29
|
+
3. **Copy-paste with slight variation**: near-duplicate code blocks that should be unified with a shared abstraction
|
|
30
|
+
4. **Leaky abstractions**: exposing internal details that should be encapsulated, or breaking existing abstraction boundaries
|
|
31
|
+
5. **Stringly-typed code**: using raw strings where constants, enums (string unions), or branded types already exist in the codebase
|
|
32
|
+
6. **Unnecessary JSX nesting**: wrapper Boxes/elements that add no layout value — check if inner component props (flexShrink, alignItems, etc.) already provide the needed behavior
|
|
33
|
+
7. **Unnecessary comments**: comments explaining WHAT the code does (well-named identifiers already do that), narrating the change, or referencing the task/caller — delete; keep only non-obvious WHY (hidden constraints, subtle invariants, workarounds)
|
|
34
|
+
|
|
35
|
+
### Agent 3: Efficiency Review
|
|
36
|
+
|
|
37
|
+
Review the same changes for efficiency:
|
|
38
|
+
|
|
39
|
+
1. **Unnecessary work**: redundant computations, repeated file reads, duplicate network/API calls, N+1 patterns
|
|
40
|
+
2. **Missed concurrency**: independent operations run sequentially when they could run in parallel
|
|
41
|
+
3. **Hot-path bloat**: new blocking work added to startup or per-request/per-render hot paths
|
|
42
|
+
4. **Recurring no-op updates**: state/store updates inside polling loops, intervals, or event handlers that fire unconditionally — add a change-detection guard so downstream consumers aren't notified when nothing changed. Also: if a wrapper function takes an updater/reducer callback, verify it honors same-reference returns (or whatever the "no change" signal is) — otherwise callers' early-return no-ops are silently defeated
|
|
43
|
+
5. **Unnecessary existence checks**: pre-checking file/resource existence before operating (TOCTOU anti-pattern) — operate directly and handle the error
|
|
44
|
+
6. **Memory**: unbounded data structures, missing cleanup, event listener leaks
|
|
45
|
+
7. **Overly broad operations**: reading entire files when only a portion is needed, loading all items when filtering for one
|
|
46
|
+
|
|
47
|
+
## Phase 3: Fix Issues
|
|
48
|
+
|
|
49
|
+
Wait for all three agents to complete. Aggregate their findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on — do not argue with the finding, just skip it.
|
|
50
|
+
|
|
51
|
+
When done, briefly summarize what was fixed (or confirm the code was already clean).
|
|
52
52
|
`;
|
|
53
53
|
export function registerSimplifySkill() {
|
|
54
54
|
registerBundledSkill({
|
|
@@ -61,8 +61,8 @@ You will use the AskUserQuestion to understand what the user wants to automate.
|
|
|
61
61
|
- If you think the skill will require arguments, suggest arguments based on what you observed. Make sure you understand what someone would need to provide.
|
|
62
62
|
- If it's not clear, ask if this skill should run inline (in the current conversation) or forked (as a sub-agent with its own context). Forked is better for self-contained tasks that don't need mid-process user input; inline is better when the user wants to steer mid-process.
|
|
63
63
|
- Ask where the skill should be saved. Suggest a default based on context (repo-specific workflows → repo, cross-repo personal workflows → user). Options:
|
|
64
|
-
- **This repo** (\`.context/skills/<name>/SKILL.md\`) — for workflows specific to this project
|
|
65
|
-
- **Personal** (\`~/.context/skills/<name>/SKILL.md\`) — follows you across all repos
|
|
64
|
+
- **This repo** (\`.context/skills/<name>/SKILL.md\`) — for workflows specific to this project
|
|
65
|
+
- **Personal** (\`~/.context/skills/<name>/SKILL.md\`) — follows you across all repos
|
|
66
66
|
|
|
67
67
|
**Round 3: Breaking down each step**
|
|
68
68
|
For each major step, if it's not glaringly obvious, ask:
|
|
@@ -129,4 +129,10 @@ export function onChangeAppState({ newState, oldState, }) {
|
|
|
129
129
|
logError(toError(error));
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
+
// orchestrationActivity — notify session metadata changed so SDK/Desktop see it.
|
|
133
|
+
if (newState.orchestrationActivity !== oldState.orchestrationActivity) {
|
|
134
|
+
notifySessionMetadataChanged({
|
|
135
|
+
orchestration_activity: newState.orchestrationActivity ?? null,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
132
138
|
}
|
|
@@ -145,11 +145,11 @@ export function enqueueAgentNotification({ taskId, description, status, error, s
|
|
|
145
145
|
const resultSection = finalMessage ? `\n<result>${finalMessage}</result>` : '';
|
|
146
146
|
const usageSection = usage ? `\n<usage><total_tokens>${usage.totalTokens}</total_tokens><tool_uses>${usage.toolUses}</tool_uses><duration_ms>${usage.durationMs}</duration_ms></usage>` : '';
|
|
147
147
|
const worktreeSection = worktreePath ? `\n<${WORKTREE_TAG}><${WORKTREE_PATH_TAG}>${worktreePath}</${WORKTREE_PATH_TAG}>${worktreeBranch ? `<${WORKTREE_BRANCH_TAG}>${worktreeBranch}</${WORKTREE_BRANCH_TAG}>` : ''}</${WORKTREE_TAG}>` : '';
|
|
148
|
-
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
149
|
-
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
150
|
-
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
151
|
-
<${STATUS_TAG}>${status}</${STATUS_TAG}>
|
|
152
|
-
<${SUMMARY_TAG}>${summary}</${SUMMARY_TAG}>${resultSection}${usageSection}${worktreeSection}
|
|
148
|
+
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
149
|
+
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
150
|
+
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
151
|
+
<${STATUS_TAG}>${status}</${STATUS_TAG}>
|
|
152
|
+
<${SUMMARY_TAG}>${summary}</${SUMMARY_TAG}>${resultSection}${usageSection}${worktreeSection}
|
|
153
153
|
</${TASK_NOTIFICATION_TAG}>`;
|
|
154
154
|
enqueuePendingNotification({
|
|
155
155
|
value: message,
|
|
@@ -169,11 +169,11 @@ function enqueueMainSessionNotification(taskId, description, status, setAppState
|
|
|
169
169
|
? `\n<${TOOL_USE_ID_TAG}>${toolUseId}</${TOOL_USE_ID_TAG}>`
|
|
170
170
|
: '';
|
|
171
171
|
const outputPath = getTaskOutputPath(taskId);
|
|
172
|
-
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
173
|
-
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
174
|
-
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
175
|
-
<${STATUS_TAG}>${status}</${STATUS_TAG}>
|
|
176
|
-
<${SUMMARY_TAG}>${summary}</${SUMMARY_TAG}>
|
|
172
|
+
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
173
|
+
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
174
|
+
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
175
|
+
<${STATUS_TAG}>${status}</${STATUS_TAG}>
|
|
176
|
+
<${SUMMARY_TAG}>${summary}</${SUMMARY_TAG}>
|
|
177
177
|
</${TASK_NOTIFICATION_TAG}>`;
|
|
178
178
|
enqueuePendingNotification({ value: message, mode: 'task-notification' });
|
|
179
179
|
}
|
|
@@ -71,14 +71,14 @@ function startStallWatchdog(taskId, description, kind, toolUseId, agentId) {
|
|
|
71
71
|
// signal and an unknown value falls through to 'completed',
|
|
72
72
|
// falsely closing the task for SDK consumers. Statusless
|
|
73
73
|
// notifications are skipped by the SDK emitter (progress ping).
|
|
74
|
-
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
75
|
-
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
76
|
-
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
77
|
-
<${SUMMARY_TAG}>${escapeXml(summary)}</${SUMMARY_TAG}>
|
|
78
|
-
</${TASK_NOTIFICATION_TAG}>
|
|
79
|
-
Last output:
|
|
80
|
-
${content.trimEnd()}
|
|
81
|
-
|
|
74
|
+
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
75
|
+
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
76
|
+
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
77
|
+
<${SUMMARY_TAG}>${escapeXml(summary)}</${SUMMARY_TAG}>
|
|
78
|
+
</${TASK_NOTIFICATION_TAG}>
|
|
79
|
+
Last output:
|
|
80
|
+
${content.trimEnd()}
|
|
81
|
+
|
|
82
82
|
The command is likely blocked on an interactive prompt. Kill this task and re-run with piped input (e.g., \`echo y | command\`) or a non-interactive flag if one exists.`;
|
|
83
83
|
enqueuePendingNotification({
|
|
84
84
|
value: message,
|
|
@@ -151,11 +151,11 @@ function enqueueShellNotification(taskId, description, status, exitCode, setAppS
|
|
|
151
151
|
}
|
|
152
152
|
const outputPath = getTaskOutputPath(taskId);
|
|
153
153
|
const toolUseIdLine = toolUseId ? `\n<${TOOL_USE_ID_TAG}>${toolUseId}</${TOOL_USE_ID_TAG}>` : '';
|
|
154
|
-
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
155
|
-
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
156
|
-
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
157
|
-
<${STATUS_TAG}>${status}</${STATUS_TAG}>
|
|
158
|
-
<${SUMMARY_TAG}>${escapeXml(summary)}</${SUMMARY_TAG}>
|
|
154
|
+
const message = `<${TASK_NOTIFICATION_TAG}>
|
|
155
|
+
<${TASK_ID_TAG}>${taskId}</${TASK_ID_TAG}>${toolUseIdLine}
|
|
156
|
+
<${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
|
|
157
|
+
<${STATUS_TAG}>${status}</${STATUS_TAG}>
|
|
158
|
+
<${SUMMARY_TAG}>${escapeXml(summary)}</${SUMMARY_TAG}>
|
|
159
159
|
</${TASK_NOTIFICATION_TAG}>`;
|
|
160
160
|
enqueuePendingNotification({
|
|
161
161
|
value: message,
|
|
@@ -140,31 +140,31 @@ export function buildForkedMessages(directive, assistantMessage) {
|
|
|
140
140
|
return [fullAssistantMessage, toolResultMessage];
|
|
141
141
|
}
|
|
142
142
|
export function buildChildMessage(directive) {
|
|
143
|
-
return `<${FORK_BOILERPLATE_TAG}>
|
|
144
|
-
STOP. READ THIS FIRST.
|
|
145
|
-
|
|
146
|
-
You are a forked worker process. You are NOT the main agent.
|
|
147
|
-
|
|
148
|
-
RULES (non-negotiable):
|
|
149
|
-
1. Your system prompt says "default to forking." IGNORE IT \u2014 that's for the parent. You ARE the fork. Do NOT spawn sub-agents; execute directly.
|
|
150
|
-
2. Do NOT converse, ask questions, or suggest next steps
|
|
151
|
-
3. Do NOT editorialize or add meta-commentary
|
|
152
|
-
4. USE your tools directly: Bash, Read, Write, etc.
|
|
153
|
-
5. If you modify files, commit your changes before reporting. Include the commit hash in your report.
|
|
154
|
-
6. Do NOT emit text between tool calls. Use tools silently, then report once at the end.
|
|
155
|
-
7. Stay strictly within your directive's scope. If you discover related systems outside your scope, mention them in one sentence at most — other workers cover those areas.
|
|
156
|
-
8. Keep your report under 500 words unless the directive specifies otherwise. Be factual and concise.
|
|
157
|
-
9. Your response MUST begin with "Scope:". No preamble, no thinking-out-loud.
|
|
158
|
-
10. REPORT structured facts, then stop
|
|
159
|
-
|
|
160
|
-
Output format (plain text labels, not markdown headers):
|
|
161
|
-
Scope: <echo back your assigned scope in one sentence>
|
|
162
|
-
Result: <the answer or key findings, limited to the scope above>
|
|
163
|
-
Key files: <relevant file paths — include for research tasks>
|
|
164
|
-
Files changed: <list with commit hash — include only if you modified files>
|
|
165
|
-
Issues: <list — include only if there are issues to flag>
|
|
166
|
-
</${FORK_BOILERPLATE_TAG}>
|
|
167
|
-
|
|
143
|
+
return `<${FORK_BOILERPLATE_TAG}>
|
|
144
|
+
STOP. READ THIS FIRST.
|
|
145
|
+
|
|
146
|
+
You are a forked worker process. You are NOT the main agent.
|
|
147
|
+
|
|
148
|
+
RULES (non-negotiable):
|
|
149
|
+
1. Your system prompt says "default to forking." IGNORE IT \u2014 that's for the parent. You ARE the fork. Do NOT spawn sub-agents; execute directly.
|
|
150
|
+
2. Do NOT converse, ask questions, or suggest next steps
|
|
151
|
+
3. Do NOT editorialize or add meta-commentary
|
|
152
|
+
4. USE your tools directly: Bash, Read, Write, etc.
|
|
153
|
+
5. If you modify files, commit your changes before reporting. Include the commit hash in your report.
|
|
154
|
+
6. Do NOT emit text between tool calls. Use tools silently, then report once at the end.
|
|
155
|
+
7. Stay strictly within your directive's scope. If you discover related systems outside your scope, mention them in one sentence at most — other workers cover those areas.
|
|
156
|
+
8. Keep your report under 500 words unless the directive specifies otherwise. Be factual and concise.
|
|
157
|
+
9. Your response MUST begin with "Scope:". No preamble, no thinking-out-loud.
|
|
158
|
+
10. REPORT structured facts, then stop
|
|
159
|
+
|
|
160
|
+
Output format (plain text labels, not markdown headers):
|
|
161
|
+
Scope: <echo back your assigned scope in one sentence>
|
|
162
|
+
Result: <the answer or key findings, limited to the scope above>
|
|
163
|
+
Key files: <relevant file paths — include for research tasks>
|
|
164
|
+
Files changed: <list with commit hash — include only if you modified files>
|
|
165
|
+
Issues: <list — include only if there are issues to flag>
|
|
166
|
+
</${FORK_BOILERPLATE_TAG}>
|
|
167
|
+
|
|
168
168
|
${FORK_DIRECTIVE_PREFIX}${directive}`;
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
@@ -3,36 +3,36 @@ export const ASK_USER_QUESTION_TOOL_NAME = 'AskUserQuestion';
|
|
|
3
3
|
export const ASK_USER_QUESTION_TOOL_CHIP_WIDTH = 12;
|
|
4
4
|
export const DESCRIPTION = 'Asks the user multiple choice questions to gather information, clarify ambiguity, understand preferences, make decisions or offer them choices.';
|
|
5
5
|
export const PREVIEW_FEATURE_PROMPT = {
|
|
6
|
-
markdown: `
|
|
7
|
-
Preview feature:
|
|
8
|
-
Use the optional \`preview\` field on options when presenting concrete artifacts that users need to visually compare:
|
|
9
|
-
- ASCII mockups of UI layouts or components
|
|
10
|
-
- Code snippets showing different implementations
|
|
11
|
-
- Diagram variations
|
|
12
|
-
- Configuration examples
|
|
13
|
-
|
|
14
|
-
Preview content is rendered as markdown in a monospace box. Multi-line text with newlines is supported. When any option has a preview, the UI switches to a side-by-side layout with a vertical option list on the left and preview on the right. Do not use previews for simple preference questions where labels and descriptions suffice. Note: previews are only supported for single-select questions (not multiSelect).
|
|
6
|
+
markdown: `
|
|
7
|
+
Preview feature:
|
|
8
|
+
Use the optional \`preview\` field on options when presenting concrete artifacts that users need to visually compare:
|
|
9
|
+
- ASCII mockups of UI layouts or components
|
|
10
|
+
- Code snippets showing different implementations
|
|
11
|
+
- Diagram variations
|
|
12
|
+
- Configuration examples
|
|
13
|
+
|
|
14
|
+
Preview content is rendered as markdown in a monospace box. Multi-line text with newlines is supported. When any option has a preview, the UI switches to a side-by-side layout with a vertical option list on the left and preview on the right. Do not use previews for simple preference questions where labels and descriptions suffice. Note: previews are only supported for single-select questions (not multiSelect).
|
|
15
15
|
`,
|
|
16
|
-
html: `
|
|
17
|
-
Preview feature:
|
|
18
|
-
Use the optional \`preview\` field on options when presenting concrete artifacts that users need to visually compare:
|
|
19
|
-
- HTML mockups of UI layouts or components
|
|
20
|
-
- Formatted code snippets showing different implementations
|
|
21
|
-
- Visual comparisons or diagrams
|
|
22
|
-
|
|
23
|
-
Preview content must be a self-contained HTML fragment (no <html>/<body> wrapper, no <script> or <style> tags — use inline style attributes instead). Do not use previews for simple preference questions where labels and descriptions suffice. Note: previews are only supported for single-select questions (not multiSelect).
|
|
16
|
+
html: `
|
|
17
|
+
Preview feature:
|
|
18
|
+
Use the optional \`preview\` field on options when presenting concrete artifacts that users need to visually compare:
|
|
19
|
+
- HTML mockups of UI layouts or components
|
|
20
|
+
- Formatted code snippets showing different implementations
|
|
21
|
+
- Visual comparisons or diagrams
|
|
22
|
+
|
|
23
|
+
Preview content must be a self-contained HTML fragment (no <html>/<body> wrapper, no <script> or <style> tags — use inline style attributes instead). Do not use previews for simple preference questions where labels and descriptions suffice. Note: previews are only supported for single-select questions (not multiSelect).
|
|
24
24
|
`,
|
|
25
25
|
};
|
|
26
|
-
export const ASK_USER_QUESTION_TOOL_PROMPT = `Use this tool when you need to ask the user questions during execution. This allows you to:
|
|
27
|
-
1. Gather user preferences or requirements
|
|
28
|
-
2. Clarify ambiguous instructions
|
|
29
|
-
3. Get decisions on implementation choices as you work
|
|
30
|
-
4. Offer choices to the user about what direction to take.
|
|
31
|
-
|
|
32
|
-
Usage notes:
|
|
33
|
-
- Users will always be able to select "Other" to provide custom text input
|
|
34
|
-
- Use multiSelect: true to allow multiple answers to be selected for a question
|
|
35
|
-
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
|
|
36
|
-
|
|
37
|
-
Plan mode note: In plan mode, use this tool to clarify requirements or choose between approaches BEFORE finalizing your plan. Do NOT use this tool to ask "Is my plan ready?" or "Should I proceed?" - use ${EXIT_PLAN_MODE_TOOL_NAME} for plan approval. IMPORTANT: Do not reference "the plan" in your questions (e.g., "Do you have feedback about the plan?", "Does the plan look good?") because the user cannot see the plan in the UI until you call ${EXIT_PLAN_MODE_TOOL_NAME}. If you need plan approval, use ${EXIT_PLAN_MODE_TOOL_NAME} instead.
|
|
26
|
+
export const ASK_USER_QUESTION_TOOL_PROMPT = `Use this tool when you need to ask the user questions during execution. This allows you to:
|
|
27
|
+
1. Gather user preferences or requirements
|
|
28
|
+
2. Clarify ambiguous instructions
|
|
29
|
+
3. Get decisions on implementation choices as you work
|
|
30
|
+
4. Offer choices to the user about what direction to take.
|
|
31
|
+
|
|
32
|
+
Usage notes:
|
|
33
|
+
- Users will always be able to select "Other" to provide custom text input
|
|
34
|
+
- Use multiSelect: true to allow multiple answers to be selected for a question
|
|
35
|
+
- If you recommend a specific option, make that the first option in the list and add "(Recommended)" at the end of the label
|
|
36
|
+
|
|
37
|
+
Plan mode note: In plan mode, use this tool to clarify requirements or choose between approaches BEFORE finalizing your plan. Do NOT use this tool to ask "Is my plan ready?" or "Should I proceed?" - use ${EXIT_PLAN_MODE_TOOL_NAME} for plan approval. IMPORTANT: Do not reference "the plan" in your questions (e.g., "Do you have feedback about the plan?", "Does the plan look good?") because the user cannot see the plan in the UI until you call ${EXIT_PLAN_MODE_TOOL_NAME}. If you need plan approval, use ${EXIT_PLAN_MODE_TOOL_NAME} instead.
|
|
38
38
|
`;
|
|
@@ -3,6 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { copyFile, stat as fsStat, truncate as fsTruncate, link } from 'fs/promises';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
import { getKairosActive } from '../../bootstrap/state.js';
|
|
6
|
+
import { isCoreToolsEnabled } from '../../core/tools/contracts.js';
|
|
7
|
+
import { startCoreShellCommand } from '../../core/tools/shellCore.js';
|
|
6
8
|
import { TOOL_SUMMARY_MAX_LENGTH } from '../../constants/toolLimits.js';
|
|
7
9
|
import { logEvent } from '../../services/analytics/index.js';
|
|
8
10
|
import { notifyVscodeFileUpdated } from '../../services/mcp/vscodeSdkMcp.js';
|
|
@@ -759,7 +761,30 @@ async function* runShellCommand({ input, abortController, setAppState, setToolJS
|
|
|
759
761
|
// Only enable for commands that are allowed to be auto-backgrounded
|
|
760
762
|
// and when background tasks are not disabled
|
|
761
763
|
const shouldAutoBackground = !isBackgroundTasksDisabled && isAutobackgroundingAllowed(command);
|
|
762
|
-
const shellCommand = await
|
|
764
|
+
const shellCommand = await (isCoreToolsEnabled() ? startCoreShellCommand({
|
|
765
|
+
command,
|
|
766
|
+
timeoutMs,
|
|
767
|
+
shellType: 'bash',
|
|
768
|
+
execOptions: {
|
|
769
|
+
onProgress(lastLines, allLines, totalLines, totalBytes, isIncomplete) {
|
|
770
|
+
lastProgressOutput = lastLines;
|
|
771
|
+
fullOutput = allLines;
|
|
772
|
+
lastTotalLines = totalLines;
|
|
773
|
+
lastTotalBytes = isIncomplete ? totalBytes : 0;
|
|
774
|
+
// Wake the generator so it yields the new progress data
|
|
775
|
+
const resolve = resolveProgress;
|
|
776
|
+
if (resolve) {
|
|
777
|
+
resolveProgress = null;
|
|
778
|
+
resolve();
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
preventCwdChanges,
|
|
782
|
+
shouldUseSandbox: shouldUseSandbox(input),
|
|
783
|
+
shouldAutoBackground
|
|
784
|
+
}
|
|
785
|
+
}, {
|
|
786
|
+
abortSignal: abortController.signal
|
|
787
|
+
}) : exec(command, abortController.signal, 'bash', {
|
|
763
788
|
timeout: timeoutMs,
|
|
764
789
|
onProgress(lastLines, allLines, totalLines, totalBytes, isIncomplete) {
|
|
765
790
|
lastProgressOutput = lastLines;
|
|
@@ -776,7 +801,7 @@ async function* runShellCommand({ input, abortController, setAppState, setToolJS
|
|
|
776
801
|
preventCwdChanges,
|
|
777
802
|
shouldUseSandbox: shouldUseSandbox(input),
|
|
778
803
|
shouldAutoBackground
|
|
779
|
-
});
|
|
804
|
+
}));
|
|
780
805
|
// Start the command execution
|
|
781
806
|
const resultPromise = shellCommand.result;
|
|
782
807
|
// Helper to spawn a background task and return its ID
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export const BRIEF_TOOL_NAME = 'SendUserMessage';
|
|
2
2
|
export const LEGACY_BRIEF_TOOL_NAME = 'Brief';
|
|
3
3
|
export const DESCRIPTION = 'Send a message to the user';
|
|
4
|
-
export const BRIEF_TOOL_PROMPT = `Send a message the user will read. Text outside this tool is visible in the detail view, but most won't open it — the answer lives here.
|
|
5
|
-
|
|
6
|
-
\`message\` supports markdown. \`attachments\` takes file paths (absolute or cwd-relative) for images, diffs, logs.
|
|
7
|
-
|
|
4
|
+
export const BRIEF_TOOL_PROMPT = `Send a message the user will read. Text outside this tool is visible in the detail view, but most won't open it — the answer lives here.
|
|
5
|
+
|
|
6
|
+
\`message\` supports markdown. \`attachments\` takes file paths (absolute or cwd-relative) for images, diffs, logs.
|
|
7
|
+
|
|
8
8
|
\`status\` labels intent: 'normal' when replying to what they just asked; 'proactive' when you're initiating — a scheduled task finished, a blocker surfaced during background work, you need input on something they haven't asked about. Set it honestly; downstream routing uses it.`;
|
|
9
|
-
export const BRIEF_PROACTIVE_SECTION = `## Talking to the user
|
|
10
|
-
|
|
11
|
-
${BRIEF_TOOL_NAME} is where your replies go. Text outside it is visible if the user expands the detail view, but most won't — assume unread. Anything you want them to actually see goes through ${BRIEF_TOOL_NAME}. The failure mode: the real answer lives in plain text while ${BRIEF_TOOL_NAME} just says "done!" — they see "done!" and miss everything.
|
|
12
|
-
|
|
13
|
-
So: every time the user says something, the reply they actually read comes through ${BRIEF_TOOL_NAME}. Even for "hi". Even for "thanks".
|
|
14
|
-
|
|
15
|
-
If you can answer right away, send the answer. If you need to go look — run a command, read files, check something — ack first in one line ("On it — checking the test output"), then work, then send the result. Without the ack they're staring at a spinner.
|
|
16
|
-
|
|
17
|
-
For longer work: ack → work → result. Between those, send a checkpoint when something useful happened — a decision you made, a surprise you hit, a phase boundary. Skip the filler ("running tests...") — a checkpoint earns its place by carrying information.
|
|
18
|
-
|
|
9
|
+
export const BRIEF_PROACTIVE_SECTION = `## Talking to the user
|
|
10
|
+
|
|
11
|
+
${BRIEF_TOOL_NAME} is where your replies go. Text outside it is visible if the user expands the detail view, but most won't — assume unread. Anything you want them to actually see goes through ${BRIEF_TOOL_NAME}. The failure mode: the real answer lives in plain text while ${BRIEF_TOOL_NAME} just says "done!" — they see "done!" and miss everything.
|
|
12
|
+
|
|
13
|
+
So: every time the user says something, the reply they actually read comes through ${BRIEF_TOOL_NAME}. Even for "hi". Even for "thanks".
|
|
14
|
+
|
|
15
|
+
If you can answer right away, send the answer. If you need to go look — run a command, read files, check something — ack first in one line ("On it — checking the test output"), then work, then send the result. Without the ack they're staring at a spinner.
|
|
16
|
+
|
|
17
|
+
For longer work: ack → work → result. Between those, send a checkpoint when something useful happened — a decision you made, a surprise you hit, a phase boundary. Skip the filler ("running tests...") — a checkpoint earns its place by carrying information.
|
|
18
|
+
|
|
19
19
|
Keep messages tight — the decision, the file:line, the PR number. Second person always ("your config"), never third.`;
|
|
@@ -75,19 +75,19 @@ export const EnterPlanModeTool = buildTool({
|
|
|
75
75
|
},
|
|
76
76
|
mapToolResultToToolResultBlockParam({ message }, toolUseID) {
|
|
77
77
|
const instructions = isPlanModeInterviewPhaseEnabled()
|
|
78
|
-
? `${message}
|
|
79
|
-
|
|
78
|
+
? `${message}
|
|
79
|
+
|
|
80
80
|
DO NOT write or edit any files except the plan file. Detailed workflow instructions will follow.`
|
|
81
|
-
: `${message}
|
|
82
|
-
|
|
83
|
-
In plan mode, you should:
|
|
84
|
-
1. Thoroughly explore the codebase to understand existing patterns
|
|
85
|
-
2. Identify similar features and architectural approaches
|
|
86
|
-
3. Consider multiple approaches and their trade-offs
|
|
87
|
-
4. Use AskUserQuestion if you need to clarify the approach
|
|
88
|
-
5. Design a concrete implementation strategy
|
|
89
|
-
6. When ready, use ExitPlanMode to present your plan for approval
|
|
90
|
-
|
|
81
|
+
: `${message}
|
|
82
|
+
|
|
83
|
+
In plan mode, you should:
|
|
84
|
+
1. Thoroughly explore the codebase to understand existing patterns
|
|
85
|
+
2. Identify similar features and architectural approaches
|
|
86
|
+
3. Consider multiple approaches and their trade-offs
|
|
87
|
+
4. Use AskUserQuestion if you need to clarify the approach
|
|
88
|
+
5. Design a concrete implementation strategy
|
|
89
|
+
6. When ready, use ExitPlanMode to present your plan for approval
|
|
90
|
+
|
|
91
91
|
Remember: DO NOT write or edit any files yet. This is a read-only exploration and planning phase.`;
|
|
92
92
|
return {
|
|
93
93
|
type: 'tool_result',
|