Skip to content

Commit 614aeb3

Browse files
committed
feat: add model availability feature and update event handling
- Added new ModelAvailability page component with lazy loading - Updated navigation to include model availability section - Extended ToolConfirmationOutcome enum with new "ProceedAlwaysAndSave" option - Updated documentation in ApprovalModeSystem to reflect new approval option - Modified InteractionLoop to account for 17 event types instead of 14 - Updated UI documentation to show 17 event types in stream events chart
1 parent b93f2c2 commit 614aeb3

6 files changed

Lines changed: 611 additions & 4 deletions

File tree

src/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ const HookSystem = lazy(() => import('./pages/HookSystem').then(m => ({ default:
131131
const PolicyEngine = lazy(() => import('./pages/PolicyEngine').then(m => ({ default: m.PolicyEngine })));
132132
const MessageBus = lazy(() => import('./pages/MessageBus').then(m => ({ default: m.MessageBus })));
133133
const ModelRouting = lazy(() => import('./pages/ModelRouting').then(m => ({ default: m.ModelRouting })));
134+
const ModelAvailability = lazy(() => import('./pages/ModelAvailability').then(m => ({ default: m.ModelAvailability })));
134135
const AgentFramework = lazy(() => import('./pages/AgentFramework').then(m => ({ default: m.AgentFramework })));
135136
const ContentFormatConversion = lazy(() => import('./pages/ContentFormatConversion').then(m => ({ default: m.ContentFormatConversion })));
136137
const CommandExecutionContext = lazy(() => import('./pages/CommandExecutionContext').then(m => ({ default: m.CommandExecutionContext })));
@@ -344,6 +345,8 @@ function App() {
344345
return <MessageBus />;
345346
case 'model-routing':
346347
return <ModelRouting />;
348+
case 'model-availability':
349+
return <ModelAvailability />;
347350
case 'approval-mode':
348351
return <ApprovalModeSystem />;
349352
case 'trusted-folders':

src/nav.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const navGroups: NavGroup[] = [
114114
{ id: 'policy-engine', label: 'Policy 策略引擎', highlight: true },
115115
{ id: 'message-bus', label: '消息总线', highlight: true },
116116
{ id: 'model-routing', label: '模型路由', highlight: true },
117+
{ id: 'model-availability', label: '模型可用性', highlight: true },
117118
],
118119
},
119120
{

src/pages/ApprovalModeSystem.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,11 @@ export type WaitingToolCall = {
207207
outcome?: ToolConfirmationOutcome;
208208
};
209209
210-
// 确认结果类型 - 来自 packages/core/src/tools/tools.ts:575
210+
// 确认结果类型 - 来自 packages/core/src/tools/tools.ts:721
211211
export enum ToolConfirmationOutcome {
212212
ProceedOnce = 'proceed_once', // 批准一次
213213
ProceedAlways = 'proceed_always', // 总是批准此工具
214+
ProceedAlwaysAndSave = 'proceed_always_and_save', // 批准并保存到配置
214215
ProceedAlwaysServer = 'proceed_always_server', // 总是批准此 MCP 服务器
215216
ProceedAlwaysTool = 'proceed_always_tool', // 总是批准此工具类型
216217
ModifyWithEditor = 'modify_with_editor', // 用外部编辑器修改后批准
@@ -621,6 +622,10 @@ export interface PolicyRule {
621622
<td className="p-2"><code className="text-green-300">ProceedAlways</code></td>
622623
<td className="p-2">总是批准此工具(加入 allowedTools)</td>
623624
</tr>
625+
<tr className="border-b border-gray-700/50">
626+
<td className="p-2"><code className="text-emerald-300">ProceedAlwaysAndSave</code></td>
627+
<td className="p-2">批准并保存到 TOML 配置文件</td>
628+
</tr>
624629
<tr className="border-b border-gray-700/50">
625630
<td className="p-2"><code className="text-blue-300">ProceedAlwaysServer</code></td>
626631
<td className="p-2">总是批准此 MCP 服务器的所有工具</td>

src/pages/InteractionLoop.tsx

Lines changed: 18 additions & 3 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> - 处理 14 种事件类型</div>
416+
<div>:702 - <span className="text-[var(--amber)]">流事件处理循环</span> - 处理 17 种事件类型</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">14 种事件类型 (GeminiEventType)</h5>
460+
<h5 className="text-[var(--text-primary)] font-semibold font-mono mb-2">17 种事件类型 (GeminiEventType)</h5>
461461
<div className="overflow-x-auto">
462462
<table className="w-full text-sm">
463463
<thead>
@@ -533,11 +533,26 @@ const request = await prepareRequest(userParts, ideContextDelta);
533533
<td className="py-2 px-3">引用来源</td>
534534
<td className="py-2 px-3">附加到响应</td>
535535
</tr>
536-
<tr>
536+
<tr className="border-b border-[var(--border-subtle)]/50">
537537
<td className="py-2 px-3 font-mono text-[var(--text-muted)]">Retry</td>
538538
<td className="py-2 px-3">重试请求</td>
539539
<td className="py-2 px-3">重新发送 API 请求</td>
540540
</tr>
541+
<tr className="border-b border-[var(--border-subtle)]/50">
542+
<td className="py-2 px-3 font-mono text-[var(--amber)]">ContextWindowWillOverflow</td>
543+
<td className="py-2 px-3">上下文窗口即将溢出</td>
544+
<td className="py-2 px-3">触发压缩或提示用户</td>
545+
</tr>
546+
<tr className="border-b border-[var(--border-subtle)]/50">
547+
<td className="py-2 px-3 font-mono text-red-400">InvalidStream</td>
548+
<td className="py-2 px-3">无效流数据</td>
549+
<td className="py-2 px-3">流解析失败处理</td>
550+
</tr>
551+
<tr>
552+
<td className="py-2 px-3 font-mono text-[var(--cyber-blue)]">ModelInfo</td>
553+
<td className="py-2 px-3">模型信息</td>
554+
<td className="py-2 px-3">返回当前使用的模型信息</td>
555+
</tr>
541556
</tbody>
542557
</table>
543558
</div>

0 commit comments

Comments
 (0)