Skip to content

Commit cc18c1f

Browse files
committed
v0.7.9
- Optimized the display of Skills information - Added the replaceedit default editor - Optimized the loading display of sub-agents - Fixed the ambiguity bug of reranker model configuration between global and project - Fixed the issue where sub-agent Diffviewer did not display
1 parent b68e63d commit cc18c1f

11 files changed

Lines changed: 169 additions & 48 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ jobs:
5656
5757
### What's New
5858
59-
- Optimized the UI display effects of some components
60-
- Added model list deduplication
61-
- Added Markdown rendering to the Btw panel
62-
- Codebase added Rerank selection
63-
- Added retry mechanism for compression failure
59+
- Optimized the display of Skills information
60+
- Added the replaceedit default editor
61+
- Optimized the loading display of sub-agents
62+
- Fixed the ambiguity bug of reranker model configuration between global and project
63+
- Fixed the issue where sub-agent Diffviewer did not display
6464
6565
### Installation
6666
```bash

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "snow-ai",
3-
"version": "0.7.8",
3+
"version": "0.7.9",
44
"description": "Agentic coding in your terminal",
55
"license": "MIT",
66
"bin": {

source/mcp/filesystem.ts

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,15 +1478,9 @@ export class FilesystemMCPService {
14781478
const modifiedLines = [...beforeLines, ...replaceLines, ...afterLines];
14791479
const modifiedContent = modifiedLines.join('\n');
14801480

1481-
// Calculate replaced content for display (compress whitespace for readability)
1482-
1481+
// Calculate replaced content for display (raw text, no line-number prefix)
14831482
const replacedLines = lines.slice(startLine - 1, endLine);
1484-
const replacedContent = replacedLines
1485-
.map((line, idx) => {
1486-
const lineNum = startLine + idx;
1487-
return `${lineNum}${normalizeForDisplay(line)}`;
1488-
})
1489-
.join('\n');
1483+
const replacedContent = replacedLines.join('\n');
14901484

14911485
// Calculate context boundaries
14921486
const lineDifference = replaceLines.length - (endLine - startLine + 1);
@@ -1500,14 +1494,9 @@ export class FilesystemMCPService {
15001494
const contextStart = smartBoundaries.start;
15011495
const contextEnd = smartBoundaries.end;
15021496

1503-
// Extract old content for context (compress whitespace for readability)
1497+
// Extract old content for context (raw text for reliable diff rendering)
15041498
const oldContextLines = lines.slice(contextStart - 1, contextEnd);
1505-
const oldContent = oldContextLines
1506-
.map((line, idx) => {
1507-
const lineNum = contextStart + idx;
1508-
return `${lineNum}${normalizeForDisplay(line)}`;
1509-
})
1510-
.join('\n');
1499+
const oldContent = oldContextLines.join('\n');
15111500

15121501
// Write the modified content
15131502
if (isRemote) {
@@ -1558,16 +1547,30 @@ export class FilesystemMCPService {
15581547
}
15591548
}
15601549

1561-
// Extract new content for context (compress whitespace for readability)
1550+
// Extract new content for context (raw text for reliable diff rendering)
15621551
const newContextLines = finalLines.slice(
15631552
contextStart - 1,
15641553
finalContextEnd,
15651554
);
1566-
const newContextContent = newContextLines
1567-
.map((line, idx) => {
1568-
const lineNum = contextStart + idx;
1569-
return `${lineNum}${normalizeForDisplay(line)}`;
1570-
})
1555+
const newContextContent = newContextLines.join('\n');
1556+
1557+
// Provide a larger overflow window so UI can render a broader diff hunk
1558+
// and help models verify bracket/block closure with surrounding context.
1559+
const overflowPadding = Math.max(3, contextLines);
1560+
const completeOldStart = Math.max(1, contextStart - overflowPadding);
1561+
const completeOldEnd = Math.min(lines.length, contextEnd + overflowPadding);
1562+
const completeOldContent = lines
1563+
.slice(completeOldStart - 1, completeOldEnd)
1564+
.join('\n');
1565+
1566+
const finalLineDifference = finalLines.length - lines.length;
1567+
const completeNewStart = Math.max(1, completeOldStart);
1568+
const completeNewEnd = Math.min(
1569+
finalLines.length,
1570+
completeOldEnd + finalLineDifference,
1571+
);
1572+
const completeNewContent = finalLines
1573+
.slice(completeNewStart - 1, completeNewEnd)
15711574
.join('\n');
15721575

15731576
// Analyze code structure
@@ -1605,6 +1608,8 @@ export class FilesystemMCPService {
16051608
filePath, // Include file path for DiffViewer display on Resume/re-render
16061609
oldContent,
16071610
newContent: newContextContent,
1611+
completeOldContent,
1612+
completeNewContent,
16081613
replacedContent,
16091614
matchLocation: {startLine, endLine},
16101615
contextStartLine: contextStart,
@@ -2418,8 +2423,8 @@ export const mcpTools = [
24182423
{
24192424
name: 'filesystem-replaceedit',
24202425
description:
2421-
'OPTIONAL (off by default — enable in MCP panel): Fuzzy search-and-replace editing. ' +
2422-
'**WHEN**: Prefer `filesystem-edit` (hashline anchors) for normal workflow; use this only when you need to match raw text. ' +
2426+
'DEFAULT edit tool: Fuzzy search-and-replace editing. ' +
2427+
'**WHEN**: Prefer this for normal workflow and diff-friendly context display. Use `filesystem-edit` when you need strict hash-anchored safety checks. ' +
24232428
'**REMOTE SSH**: Supports ssh:// paths like other filesystem tools. ' +
24242429
'**INPUT**: `searchContent` must be raw source text — strip `lineNum:hash→` prefixes if you pasted from `filesystem-read`. ' +
24252430
'**BATCH**: `filePath` may be a string, string[] with top-level search/replace, or {path, searchContent, replaceContent, occurrence?}[]. ' +
@@ -2500,7 +2505,7 @@ export const mcpTools = [
25002505
{
25012506
name: 'filesystem-edit',
25022507
description:
2503-
'PREFERRED edit tool: Hash-anchored editing using content hashes from filesystem-read. ' +
2508+
'OPTIONAL strict edit tool: Hash-anchored editing using content hashes from filesystem-read. ' +
25042509
'Line format: "lineNum:hash→content" (e.g. "42:a3→code"). Use anchors "lineNum:hash" to reference lines — no text reproduction needed. ' +
25052510
'**OPERATIONS**: (1) replace — replaces startAnchor..endAnchor with content; ' +
25062511
'(2) insert_after — inserts content after startAnchor; ' +

source/ui/pages/SubAgentConfigScreen.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ export default function SubAgentConfigScreen({
114114
tools: [
115115
'filesystem-read',
116116
'filesystem-create',
117+
'filesystem-replaceedit',
117118
'filesystem-edit',
118-
],
119+
],
119120
},
120121
{
121122
name: t.subAgentConfig.aceTools,

source/utils/config/disabledMCPTools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface OptInMCPConfig {
2121
}
2222

2323
/** Tools that are off until explicitly enabled (Tab in MCP tools list writes opt-in file). */
24-
const DEFAULT_OPT_IN_DISABLED_KEYS = new Set<string>(['filesystem:replaceedit']);
24+
const DEFAULT_OPT_IN_DISABLED_KEYS = new Set<string>(['filesystem:edit']);
2525

2626
function getProjectConfigPath(): string {
2727
return path.join(process.cwd(), '.snow', CONFIG_FILE);

source/utils/config/subAgentConfig.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ const SUB_AGENTS_CONFIG_FILE = join(CONFIG_DIR, 'sub-agents.json');
2727

2828
/**
2929
* Built-in sub-agents (hardcoded, always available)
30+
* Build dynamically so tool enable/disable changes are reflected immediately.
3031
*/
31-
const BUILTIN_AGENTS: SubAgent[] = getAllBuiltinAgentDefinitions().map(def => ({
32-
...def,
33-
createdAt: '2024-01-01T00:00:00.000Z',
34-
updatedAt: '2024-01-01T00:00:00.000Z',
35-
builtin: true,
36-
}));
32+
function getBuiltinAgents(): SubAgent[] {
33+
return getAllBuiltinAgentDefinitions().map(def => ({
34+
...def,
35+
createdAt: '2024-01-01T00:00:00.000Z',
36+
updatedAt: '2024-01-01T00:00:00.000Z',
37+
builtin: true,
38+
}));
39+
}
3740

3841
function ensureConfigDirectory(): void {
3942
if (!existsSync(CONFIG_DIR)) {
@@ -72,9 +75,10 @@ export function getUserSubAgents(): SubAgent[] {
7275
export function getSubAgents(): SubAgent[] {
7376
const userAgents = getUserSubAgents();
7477
const userAgentIds = new Set(userAgents.map(a => a.id));
78+
const builtinAgents = getBuiltinAgents();
7579

7680
// 过滤掉已被用户覆盖的内置代理
77-
const effectiveBuiltinAgents = BUILTIN_AGENTS.filter(
81+
const effectiveBuiltinAgents = builtinAgents.filter(
7882
agent => !userAgentIds.has(agent.id),
7983
);
8084

source/utils/execution/mcpToolsManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ async function refreshToolsCache(): Promise<void> {
275275
}
276276
};
277277

278-
// Built-in filesystem (includes filesystem-replaceedit — off by default; enable in MCP panel: V on filesystem, Tab on replaceedit)
278+
// Built-in filesystem (filesystem-edit is opt-in; filesystem-replaceedit is enabled by default)
279279
addBuiltInService('filesystem', filesystemTools, 'filesystem');
280280

281281
// Add built-in terminal tools
@@ -1347,7 +1347,7 @@ export async function executeMCPTool(
13471347
);
13481348
break;
13491349
case 'replaceedit':
1350-
// Opt-in tool (default off): enable under MCP panel → filesystem → V → Tab on replaceedit
1350+
// Default-on tool (can be disabled in MCP panel)
13511351
if (!args.filePath) {
13521352
throw new Error(
13531353
`Missing required parameter 'filePath' for filesystem-replaceedit tool.\n` +

source/utils/execution/subagents/debugAgent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ Inserted log points:
196196
### Filesystem Tools (core work)
197197
- filesystem-read: Read file contents
198198
- filesystem-create: Create new files (write the logger helper function file in Phase 2)
199-
- filesystem-edit: Hash-anchored file editing (insert/replace/delete via anchors)
199+
- filesystem-replaceedit: Default edit tool for readable diff validation and closure checks
200+
- filesystem-edit: Optional strict hash-anchored editing (insert/replace/delete via anchors)
200201
201202
### Terminal Tools (auxiliary)
202203
- terminal-execute: Execute commands (check directory structure, etc.)
@@ -218,6 +219,7 @@ Inserted log points:
218219
tools: [
219220
'filesystem-read',
220221
'filesystem-create',
222+
'filesystem-replaceedit',
221223
'filesystem-edit',
222224
'terminal-execute',
223225
'ace-find_definition',

source/utils/execution/subagents/generalAgent.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ You are a versatile task execution agent with full tool access, capable of handl
8383
5. Never guess line numbers or code structure
8484
8585
### File Modification Strategy
86-
- USE filesystem-edit: Hash-anchored editing, no text reproduction needed, stale-read safe
86+
- USE filesystem-replaceedit by default: Better diff readability with overflow context for closure checks
87+
- USE filesystem-edit when you need strict hash-anchored stale-read safety
8788
- ALWAYS verify boundaries: Functions need full body, markup needs complete tags
8889
- BATCH operations: Modify 2+ files? Use batch mode in single call
8990
@@ -105,7 +106,8 @@ You are a versatile task execution agent with full tool access, capable of handl
105106
106107
### Filesystem Tools (Primary Work)
107108
- filesystem-read: Read files, use batch for multiple files
108-
- filesystem-edit: Hash-anchored editing (reference "lineNum:hash" anchors from read output)
109+
- filesystem-replaceedit: Default edit tool for search-replace workflow and readable diffs
110+
- filesystem-edit: Optional strict hash-anchored editing (reference "lineNum:hash" anchors from read output)
109111
- filesystem-create: Create new files with content
110112
111113
### Terminal Tools (Build and Test)
@@ -187,6 +189,7 @@ You are a versatile task execution agent with full tool access, capable of handl
187189
tools: [
188190
'filesystem-read',
189191
'filesystem-create',
192+
'filesystem-replaceedit',
190193
'filesystem-edit',
191194
'terminal-execute',
192195
'ace-find_definition',

0 commit comments

Comments
 (0)