Skip to content

Commit b93f2c2

Browse files
committed
feat: update approval mode system with new tool kinds and event types
- Updated tool kind count from 6 to 9 (Read/Edit/Delete/Move/Search/Execute/Think/Fetch/Other) - Added PLAN approval mode to documentation - Expanded auto-approval category to include Think and Other kinds - Updated confirmation category to include Delete, Move, and Execute kinds - Changed stream event type count from 16 to 14 - Updated tool kind documentation to reflect 9 types instead of 3 - Adjusted quick summary display from 6 to 9 tools in approval mode
1 parent 77f88ab commit b93f2c2

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/pages/ApprovalModeSystem.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function QuickSummary({ isExpanded, onToggle }: { isExpanded: boolean; onToggle:
4747
<div className="text-xs text-[var(--text-muted)]">审批模式</div>
4848
</div>
4949
<div className="bg-[var(--bg-card)] rounded-lg p-3 text-center border border-[var(--border-subtle)]">
50-
<div className="text-2xl font-bold text-[var(--terminal-green)]">6</div>
50+
<div className="text-2xl font-bold text-[var(--terminal-green)]">9</div>
5151
<div className="text-xs text-[var(--text-muted)]">工具 Kind</div>
5252
</div>
5353
<div className="bg-[var(--bg-card)] rounded-lg p-3 text-center border border-[var(--border-subtle)]">
@@ -338,8 +338,8 @@ export interface PolicyRule {
338338
<div>
339339
<h4 className="text-cyan-400 font-semibold mb-2">输入参数</h4>
340340
<ul className="text-gray-300 list-disc list-inside space-y-1 ml-4">
341-
<li><strong>当前 ApprovalMode</strong>:DEFAULT / AUTO_EDIT / YOLO</li>
342-
<li><strong>工具 Kind 类型</strong>:Read / Search / Fetch / Edit / Delete / Execute</li>
341+
<li><strong>当前 ApprovalMode</strong>PLAN / DEFAULT / AUTO_EDIT / YOLO</li>
342+
<li><strong>工具 Kind 类型</strong>:Read / Edit / Delete / Move / Search / Execute / Think / Fetch / Other(共 9 种)</li>
343343
<li><strong>allowedTools 白名单</strong>:配置文件中定义的自动批准工具列表</li>
344344
<li><strong>文件夹信任状态</strong>:isTrustedFolder() 返回值</li>
345345
</ul>
@@ -576,7 +576,7 @@ export interface PolicyRule {
576576
<h4 className="text-cyan-400 font-semibold mb-2">工具 Kind 分类</h4>
577577
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
578578
<div className="bg-gray-800/50 rounded-lg p-4">
579-
<h5 className="font-semibold text-green-400 mb-2">自动批准类 (Kind: Read/Search/Fetch)</h5>
579+
<h5 className="font-semibold text-green-400 mb-2">自动批准类 (Kind: Read/Search/Fetch/Think/Other)</h5>
580580
<ul className="text-sm text-gray-300 space-y-1">
581581
<li><code className="text-cyan-300">read_file</code> - 读取文件</li>
582582
<li><code className="text-cyan-300">read_many_files</code> - 批量读取</li>
@@ -589,7 +589,7 @@ export interface PolicyRule {
589589
</div>
590590

591591
<div className="bg-gray-800/50 rounded-lg p-4">
592-
<h5 className="font-semibold text-yellow-400 mb-2">需确认类 (Kind: Edit/Execute)</h5>
592+
<h5 className="font-semibold text-yellow-400 mb-2">需确认类 (Kind: Edit/Delete/Move/Execute)</h5>
593593
<ul className="text-sm text-gray-300 space-y-1">
594594
<li><code className="text-orange-300">write_file</code> - 写入文件</li>
595595
<li><code className="text-orange-300">edit</code> - 编辑文件</li>

src/pages/CoreCode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ abstract class BaseDeclarativeTool<TParams, TResult> {
545545
readonly name: string; // 工具名称,如 "read_file"
546546
readonly description: string; // 描述,告诉 AI 这个工具做什么
547547
readonly parameters: Schema; // JSON Schema 参数定义
548-
readonly kind: Kind; // 类型:Read, Write, Execute
548+
readonly kind: Kind; // 9 种类型:Read/Edit/Delete/Move/Search/Execute/Think/Fetch/Other
549549
550550
// 验证参数(子类实现)
551551
protected abstract validateToolParamValues(

src/pages/InteractionLoop.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ const request = await prepareRequest(userParts, ideContextDelta);
413413
<div className="text-[var(--cyber-blue)] font-bold">packages/cli/src/ui/hooks/useGeminiStream.ts</div>
414414
<div className="pl-4 space-y-1 text-[var(--text-muted)]">
415415
<div>:786 - <span className="text-[var(--amber)]">submitQuery()</span> - 主循环入口</div>
416-
<div>:702 - <span className="text-[var(--amber)]">流事件处理循环</span> - 处理 16 种事件类型</div>
416+
<div>:702 - <span className="text-[var(--amber)]">流事件处理循环</span> - 处理 14 种事件类型</div>
417417
<div>:994 - <span className="text-[var(--amber)]">handleCompletedTools()</span> - Continuation 触发</div>
418418
<div>:488 - <span className="text-[var(--amber)]">getIdeContextDelta()</span> - IDE 上下文增量</div>
419419
</div>
@@ -457,7 +457,7 @@ const request = await prepareRequest(userParts, ideContextDelta);
457457
<MermaidDiagram chart={streamEventsChart} title="流事件处理流程" />
458458

459459
<div className="mt-4">
460-
<h5 className="text-[var(--text-primary)] font-semibold font-mono mb-2">16 种事件类型 (GeminiEventType)</h5>
460+
<h5 className="text-[var(--text-primary)] font-semibold font-mono mb-2">14 种事件类型 (GeminiEventType)</h5>
461461
<div className="overflow-x-auto">
462462
<table className="w-full text-sm">
463463
<thead>

src/pages/ToolReference.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,9 +1127,9 @@ export const ALL_BUILTIN_TOOL_NAMES = [...] as const; // 13 个内置工具`}
11271127
<div className="bg-gradient-to-r from-[var(--terminal-green)]/10 to-[var(--cyber-blue)]/10 rounded-lg p-5 border border-[var(--terminal-green)]/30">
11281128
<h4 className="text-[var(--terminal-green)] font-bold font-mono mb-3">Kind 分类驱动权限</h4>
11291129
<p className="text-[var(--text-secondary)] text-sm leading-relaxed">
1130-
工具按 Kind(Read、Search、Edit、Execute、Think)分类,而非按功能分类。
1130+
工具按 Kind(Read、Edit、Delete、Move、Search、Execute、Think、Fetch、Other,共 9 种)分类,而非按功能分类。
11311131
这种设计让审批系统可以基于操作类型而非工具名称做决策:
1132-
只读操作自动放行,修改操作需要确认。这既保证了安全性,又不影响使用体验
1132+
只读操作(Read/Search/Fetch/Think)自动放行,修改操作(Edit/Delete/Move/Execute)需要确认
11331133
</p>
11341134
</div>
11351135

0 commit comments

Comments
 (0)