minimal-agent 0.18.13 → 0.18.15

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.
Files changed (181) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -3
  3. package/plugins/workflow-runner/src/runtime/context.js +1 -1
  4. package/plugins/workflow-runner/src/runtime/context.ts +1 -1
  5. package/plugins/workflow-runner/test/embeddedExecution.test.ts +2 -5
  6. package/plugins/workflow-runner/test/execLifetime.test.ts +15 -2
  7. package/skills/ssh-remote-dev/SKILL.md +61 -0
  8. package/skills/ssh-remote-dev/agents/openai.yaml +4 -0
  9. package/src/advisor/README.md +62 -24
  10. package/src/advisor/advisorNudge.js +199 -0
  11. package/src/advisor/advisorNudge.ts +232 -0
  12. package/src/advisor/deliveryReview.js +35 -12
  13. package/src/advisor/deliveryReview.ts +35 -11
  14. package/src/advisor/presentation.js +7 -10
  15. package/src/advisor/presentation.ts +10 -13
  16. package/src/advisor/reviewContext.js +22 -58
  17. package/src/advisor/reviewContext.ts +24 -67
  18. package/src/cli/configMenu.js +17 -128
  19. package/src/cli/configMenu.tsx +17 -193
  20. package/src/cli/print.js +2 -0
  21. package/src/cli/print.ts +2 -0
  22. package/src/cli/streamJson.js +2 -0
  23. package/src/cli/streamJson.ts +2 -0
  24. package/src/cli/wizards/advisorWizard.js +9 -7
  25. package/src/cli/wizards/advisorWizard.tsx +9 -7
  26. package/src/cli/wizards/contextAdvisorWizard.js +9 -7
  27. package/src/cli/wizards/contextAdvisorWizard.tsx +9 -7
  28. package/src/cli/wizards/providerPresets.js +55 -18
  29. package/src/cli/wizards/providerPresets.ts +72 -19
  30. package/src/cli/wizards/providerWizard.js +51 -10
  31. package/src/cli/wizards/providerWizard.tsx +59 -9
  32. package/src/config/configDefaults.js +1 -1
  33. package/src/config/configDefaults.ts +1 -1
  34. package/src/config/configDiagnostics.js +1 -21
  35. package/src/config/configDiagnostics.ts +3 -23
  36. package/src/config/configFile.js +11 -4
  37. package/src/config/configFile.ts +27 -7
  38. package/src/config/configManagement.js +1 -0
  39. package/src/config/configManagement.ts +2 -0
  40. package/src/config/configService.js +12 -8
  41. package/src/config/configService.ts +16 -11
  42. package/src/config/numericLimits.js +0 -4
  43. package/src/config/numericLimits.ts +0 -4
  44. package/src/config/reasoningEffort.js +16 -0
  45. package/src/config/reasoningEffort.ts +18 -0
  46. package/src/context/budgetPlan.js +1 -1
  47. package/src/context/budgetPlan.ts +1 -1
  48. package/src/context/optimizeConversation.js +1 -1
  49. package/src/context/optimizeConversation.ts +1 -1
  50. package/src/harness/stallGuard.js +8 -13
  51. package/src/harness/stallGuard.ts +8 -12
  52. package/src/llm/client.js +64 -17
  53. package/src/llm/client.ts +62 -7
  54. package/src/llm/providers/anthropicFormat.js +3 -1
  55. package/src/llm/providers/anthropicFormat.ts +4 -1
  56. package/src/llm/providers/openaiFormat.js +14 -3
  57. package/src/llm/providers/openaiFormat.ts +17 -3
  58. package/src/llm/providers/responsesFormat.js +277 -0
  59. package/src/llm/providers/responsesFormat.ts +308 -0
  60. package/src/loop/README.md +18 -3
  61. package/src/loop/liveDiagramGate.js +63 -0
  62. package/src/loop/liveDiagramGate.ts +61 -0
  63. package/src/loop/messages.js +12 -0
  64. package/src/loop/messages.ts +13 -0
  65. package/src/loop/options.ts +7 -2
  66. package/src/loop/toolBatch.js +0 -1
  67. package/src/loop/toolBatch.ts +0 -1
  68. package/src/loop/toolExecutor.js +11 -46
  69. package/src/loop/toolExecutor.ts +12 -55
  70. package/src/loop/toolPresentation.js +2 -13
  71. package/src/loop/toolPresentation.ts +2 -13
  72. package/src/loop/toolSemantics.js +3 -4
  73. package/src/loop/toolSemantics.ts +4 -6
  74. package/src/loop.js +222 -214
  75. package/src/loop.ts +226 -232
  76. package/src/memory/dependencies.js +11 -3
  77. package/src/memory/dependencies.ts +11 -3
  78. package/src/memory/episodicMemory.js +59 -18
  79. package/src/memory/episodicMemory.ts +58 -18
  80. package/src/memory/experienceStore.js +4 -3
  81. package/src/memory/experienceStore.ts +4 -3
  82. package/src/memory/factCandidates.js +53 -1
  83. package/src/memory/factCandidates.ts +54 -1
  84. package/src/memory/factLearning.js +2 -2
  85. package/src/memory/factLearning.ts +2 -2
  86. package/src/memory/jobPolicy.js +24 -5
  87. package/src/memory/jobPolicy.ts +25 -5
  88. package/src/memory/learning.js +2 -2
  89. package/src/memory/learning.ts +2 -2
  90. package/src/memory/learningModel.js +7 -0
  91. package/src/memory/learningModel.ts +7 -0
  92. package/src/memory/managementService.js +8 -7
  93. package/src/memory/managementService.ts +16 -8
  94. package/src/memory/memoryService.js +104 -33
  95. package/src/memory/memoryService.ts +132 -28
  96. package/src/memory/projectKnowledge.js +39 -3
  97. package/src/memory/projectKnowledge.ts +45 -3
  98. package/src/memory/recallQuery.js +56 -0
  99. package/src/memory/recallQuery.ts +58 -0
  100. package/src/memory/retrieval.js +39 -10
  101. package/src/memory/retrieval.ts +46 -11
  102. package/src/memory/turnJournal.js +75 -10
  103. package/src/memory/turnJournal.ts +66 -10
  104. package/src/memory/types.ts +7 -1
  105. package/src/prompts/delegation.js +2 -1
  106. package/src/prompts/delegation.ts +3 -1
  107. package/src/prompts/policyRegistry.js +9 -12
  108. package/src/prompts/policyRegistry.ts +9 -12
  109. package/src/prompts/promptAssembly.js +6 -5
  110. package/src/prompts/promptAssembly.ts +8 -6
  111. package/src/prompts/visualPresentation.js +39 -10
  112. package/src/prompts/visualPresentation.ts +38 -9
  113. package/src/runtime/answerPreparation.js +1 -1
  114. package/src/runtime/answerPreparation.ts +1 -1
  115. package/src/runtime/commandCatalog.js +1 -0
  116. package/src/runtime/commandCatalog.ts +9 -0
  117. package/src/runtime/fileLock.js +19 -3
  118. package/src/runtime/fileLock.ts +19 -3
  119. package/src/runtime/invocationPolicy.js +1 -1
  120. package/src/runtime/invocationPolicy.ts +1 -1
  121. package/src/runtime/outputContract.js +0 -4
  122. package/src/runtime/outputContract.ts +0 -7
  123. package/src/session/runAgentTurn.js +3 -0
  124. package/src/session/runAgentTurn.ts +3 -0
  125. package/src/team/onlineToolContract.js +0 -1
  126. package/src/team/onlineToolContract.ts +0 -1
  127. package/src/tools/advisor/advisor.js +207 -365
  128. package/src/tools/advisor/advisor.ts +211 -383
  129. package/src/tools/agent/agentTypes.js +0 -1
  130. package/src/tools/agent/agentTypes.ts +0 -1
  131. package/src/tools/agent/coordinator.js +4 -1
  132. package/src/tools/agent/coordinator.ts +4 -1
  133. package/src/tools/bash/semantics.js +4 -5
  134. package/src/tools/bash/semantics.ts +4 -5
  135. package/src/tools/capabilities.js +2 -3
  136. package/src/tools/capabilities.ts +2 -4
  137. package/src/tools/index.js +0 -16
  138. package/src/tools/index.ts +0 -16
  139. package/src/tools/memory/maintenance.js +8 -9
  140. package/src/tools/memory/maintenance.ts +13 -11
  141. package/src/tools/memory/memory.js +5 -1
  142. package/src/tools/memory/memory.ts +5 -0
  143. package/src/tools/optimizeConversation/README.md +4 -6
  144. package/src/tools/toolPromptGuides.js +2 -9
  145. package/src/tools/toolPromptGuides.ts +2 -9
  146. package/src/types.ts +28 -105
  147. package/src/ui/App.js +22 -1
  148. package/src/ui/App.tsx +26 -1
  149. package/src/ui/MessageList.js +8 -44
  150. package/src/ui/MessageList.tsx +3 -81
  151. package/src/ui/effortCommand.js +19 -0
  152. package/src/ui/effortCommand.ts +36 -0
  153. package/src/ui/hooks/useChat.js +2 -0
  154. package/src/ui/hooks/useChat.ts +2 -0
  155. package/src/ui/toolProgress.js +1 -1
  156. package/src/ui/toolProgress.ts +1 -1
  157. package/src/web/protocol.ts +10 -3
  158. package/src/advisor/advisorCoordinator.js +0 -734
  159. package/src/advisor/advisorCoordinator.ts +0 -825
  160. package/src/cli/wizards/sshHostWizard.js +0 -156
  161. package/src/cli/wizards/sshHostWizard.tsx +0 -214
  162. package/src/context/sshHosts.js +0 -290
  163. package/src/context/sshHosts.ts +0 -312
  164. package/src/loop/publication.js +0 -94
  165. package/src/loop/publication.ts +0 -124
  166. package/src/runtime/finalAnswer.js +0 -9
  167. package/src/runtime/finalAnswer.ts +0 -13
  168. package/src/tools/advisor/advisorDecision.js +0 -79
  169. package/src/tools/advisor/advisorDecision.ts +0 -92
  170. package/src/tools/ssh/ssh.js +0 -152
  171. package/src/tools/ssh/ssh.ts +0 -167
  172. package/src/tools/ssh/sshAvailability.js +0 -35
  173. package/src/tools/ssh/sshAvailability.ts +0 -39
  174. package/src/tools/ssh/sshClient.js +0 -177
  175. package/src/tools/ssh/sshClient.ts +0 -189
  176. package/src/tools/ssh/sshDownload.js +0 -77
  177. package/src/tools/ssh/sshDownload.ts +0 -92
  178. package/src/tools/ssh/sshHostsTool.js +0 -36
  179. package/src/tools/ssh/sshHostsTool.ts +0 -48
  180. package/src/tools/ssh/sshUpload.js +0 -72
  181. package/src/tools/ssh/sshUpload.ts +0 -85
package/src/types.ts CHANGED
@@ -178,7 +178,7 @@ export type Message = (
178
178
  role: 'assistant';
179
179
  /** Persisted UI semantics; not a provider instruction or a success claim. */
180
180
  presentation?: 'progress' | 'final';
181
- /** Host-only review boundary for a delivered text answer; never model authority. */
181
+ /** @deprecated Legacy sessions only (the retired review cycle); no longer written. Stripped before any provider request. */
182
182
  advisorTaskVersion?: number;
183
183
  /** 当 tool_calls 非空时 content 通常为 null(OpenAI 协议) */
184
184
  content: string | null;
@@ -214,13 +214,13 @@ export type Message = (
214
214
  display_metadata?: ToolResultMetadata;
215
215
  /** 本地压缩策略;发送 Provider 前会剥离。 */
216
216
  tool_result_policy?: ToolResultPolicy;
217
- /** Host-only effect needed to restore the current review cycle. */
217
+ /** @deprecated Legacy sessions only; no longer written. Stripped before any provider request. */
218
218
  advisorMutatesWorkspace?: boolean;
219
219
  timestamp?: number;
220
220
  }
221
221
  ) & {
222
- /** Host-only bounded review transitions, including graceful degradation. */
223
- advisorCheckpoints?: AdvisorCheckpointMetadata[];
222
+ /** @deprecated Legacy sessions only (the retired review checkpoints); no longer written. Stripped before any provider request. */
223
+ advisorCheckpoints?: unknown[];
224
224
  /** Host-only cold history. Persist with Session; strip before any provider request. */
225
225
  advisorHistory?: { version: 1; messages: Message[] };
226
226
  /** Host-only: a deferred call never produced an execution observation. */
@@ -376,51 +376,6 @@ export interface ProcessExecutionMetadata {
376
376
  exitCode?: number | null;
377
377
  }
378
378
 
379
- export type AdvisorCheckpoint =
380
- | 'pre-execution'
381
- | 'stalled'
382
- | 'high-risk'
383
- | 'pre-delivery';
384
-
385
- export interface AdvisorVersions {
386
- taskVersion: number;
387
- workVersion: number;
388
- evidenceVersion: number;
389
- }
390
-
391
- export interface AdvisorCheckpointMetadata extends AdvisorVersions {
392
- kind: 'advisor_checkpoint';
393
- checkpoint: AdvisorCheckpoint;
394
- checkpointKey: string;
395
- status: 'required' | 'attempted-unavailable';
396
- }
397
-
398
- export interface AdvisorConsultationMetadata extends AdvisorVersions {
399
- kind: 'advisor_consultation';
400
- /** Host-recorded trigger, distinct from who emitted the tool call. Absent in old history. */
401
- triggerSource?: 'checkpoint' | 'model';
402
- triggerReason?: string;
403
- consultationId: string;
404
- checkpoint: AdvisorCheckpoint;
405
- checkpointKey: string;
406
- status: 'completed' | 'failed';
407
- }
408
-
409
- export interface AdvisorDecisionMetadata extends AdvisorVersions {
410
- kind: 'advisor_decision';
411
- consultationId: string;
412
- checkpoint: AdvisorCheckpoint;
413
- checkpointKey: string;
414
- decision: 'accept' | 'partial' | 'reject';
415
- rationale: string;
416
- acceptedPoints: string[];
417
- rejectedPoints: string[];
418
- verificationPlan: string[];
419
- evidenceRefs?: string[];
420
- /** Referenced evidence is not proof of correctness; pending never means approved. */
421
- verificationStatus?: 'evidence_linked' | 'pending';
422
- }
423
-
424
379
  /** Agent 子任务的结构化阶段进度;仅供宿主展示,不写入会话历史或发送给 LLM。 */
425
380
  export interface SubagentProgress {
426
381
  kind: 'subagent';
@@ -468,9 +423,6 @@ export type ToolResultMetadata =
468
423
  | FileDiscoveryMetadata
469
424
  | ResultManifestMetadata
470
425
  | ProcessExecutionMetadata
471
- | AdvisorCheckpointMetadata
472
- | AdvisorConsultationMetadata
473
- | AdvisorDecisionMetadata
474
426
  | BrowserDownloadMetadata;
475
427
 
476
428
  /**
@@ -576,8 +528,6 @@ export type ToolResult = { problem?: ToolProblemOutcome; observation?: ReadObser
576
528
  * 避免按工具名写特判分支。
577
529
  */
578
530
  export interface ToolCallContext {
579
- /** Run-local host initialization shared with Advisor; never a model argument. */
580
- advisorConsultation?: AdvisorConsultationMetadata;
581
531
  /** Shared per-model-response read allowance; reservations happen before IO. */
582
532
  reserveReadChars?: (requested?: number) => number;
583
533
  /** Host presentation only; cannot grant tools to a delegated agent. */
@@ -609,10 +559,11 @@ export interface ToolCallContext {
609
559
  advisorCalls?: { used: number };
610
560
  /** 区分主模型自动咨询与用户显式 /advisor ask。 */
611
561
  advisorInvocation?: 'agent' | 'manual';
612
- /** Advisor 协调器运行时桥;只存在于主循环,不暴露给模型或持久化。 */
613
- advisorRuntime?: AdvisorRuntimeBridge;
614
- /** Live host context used by the main request, not tool-provided instructions. */
615
- advisorReviewContext?: () => import('./advisor/reviewContext.js').AdvisorReviewContext;
562
+ /**
563
+ * 项目约束与记忆(它们不在对话历史里),作为"背景"附给顾问;宿主在主循环里提供,
564
+ * 不是工具参数,也不是给顾问的指令。
565
+ */
566
+ advisorBackground?: () => string;
616
567
  /**
617
568
  * 主循环使用的 provider —— Agent 等「工具内部再起子查询」的派生工具用它
618
569
  * 跑嵌套 runQuery(子 agent 与主 agent 同一模型,不另配凭据)。
@@ -696,45 +647,6 @@ export interface ToolCallContext {
696
647
  };
697
648
  }
698
649
 
699
- export interface AdvisorContextPacket {
700
- failureAttempts?: string[];
701
- deliveryDraft?: string;
702
- decisionVerification?: Pick<AdvisorDecisionMetadata, 'consultationId' | 'verificationStatus' | 'evidenceRefs' | 'verificationPlan' | 'decision' | 'rationale' | 'acceptedPoints' | 'rejectedPoints'>;
703
- objective: string;
704
- currentRequest: string;
705
- checkpoint: AdvisorCheckpoint;
706
- versions: AdvisorVersions;
707
- changedFiles: string[];
708
- evidence: string[];
709
- /** Packet excerpts are a selection, not proof the reviewer saw every stored result. */
710
- evidenceCoverage?: { available: number; included: number; omitted: number; excerpts: true };
711
- previousAdvice?: string;
712
- actionsAfterPreviousAdvice: string[];
713
- openQuestions: string[];
714
- }
715
-
716
- export type AdvisorReason = 'uncertainty' | 'plan_review' | 'delivery_review' | 'stalled' | 'user_dissatisfaction' | 'evidence_conflict';
717
-
718
- export interface AdvisorRuntimeBridge {
719
- /** Latest advice available for the main Agent's optional decision record. */
720
- readonly pendingConsultationId: string | undefined;
721
- beginConsultation(reason?: AdvisorReason): AdvisorConsultationMetadata;
722
- finishConsultation(
723
- metadata: AdvisorConsultationMetadata,
724
- ok: boolean,
725
- ): AdvisorConsultationMetadata;
726
- recordDecision(input: {
727
- consultationId: string;
728
- decision: 'accept' | 'partial' | 'reject';
729
- rationale: string;
730
- acceptedPoints?: string[];
731
- rejectedPoints?: string[];
732
- verificationPlan?: string[];
733
- evidenceRefs?: string[];
734
- }): ToolResult;
735
- contextPacket(note?: string): AdvisorContextPacket;
736
- }
737
-
738
650
  export type ToolCategory =
739
651
  | 'files'
740
652
  | 'shell'
@@ -901,10 +813,11 @@ interface ProviderCommon {
901
813
  maxTokens?: number;
902
814
 
903
815
  /**
904
- * 请求协议格式:'openai'(Chat Completions,默认)| 'anthropic'(Messages API)。
816
+ * 请求协议格式:'openai'(Chat Completions,默认)| 'openai-responses'(OpenAI Responses API)
817
+ * | 'anthropic'(Messages API)。
905
818
  * 缺省当 'openai'——兼容旧版只产出 OpenAI 格式对象的 env 自举路径。见 client.ts。
906
819
  */
907
- apiFormat?: 'openai' | 'anthropic';
820
+ apiFormat?: 'openai' | 'openai-responses' | 'anthropic';
908
821
 
909
822
  /**
910
823
  * 该模型是否支持识图(多模态视觉)。resolveProvider 从所选 ModelConfig 归一成真布尔
@@ -917,6 +830,12 @@ interface ProviderCommon {
917
830
  supportsJsonSchema?: boolean;
918
831
  /** Explicitly request provider reasoning when the endpoint supports it. */
919
832
  reasoning?: boolean;
833
+ /**
834
+ * 推理强度。openai-responses 发 `reasoning.effort`,openai(Chat Completions) 发
835
+ * `reasoning_effort`(OpenRouter 发 `reasoning.effort`)。缺省不发送,沿用服务端默认。
836
+ * 模型不认该档位时 client.ts 去掉参数重发一次,不让对话 400。
837
+ */
838
+ reasoningEffort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
920
839
  promptCache?: PromptCacheConfig;
921
840
 
922
841
  /**
@@ -1142,8 +1061,9 @@ export type LlmStreamEvent =
1142
1061
  * 工作过程显示阶段标签(UI 的 LiveArea 据此选择文字 / 决定是否隐藏整面板)。
1143
1062
  *
1144
1063
  * idle —— 当前没有任何工作(隐藏 LiveArea)
1145
- * thinking —— 正在准备候选答案或等待工具调用,候选正文不公开
1146
- * streaming —— 内部检查结束后,最终表达请求的真实正文流
1064
+ * thinking —— 等待首个 token、工具调用或仍可能被检查退回的私有候选
1065
+ * streaming —— 最终回答正在显示:没有检查能再拦下时边生成边实时输出;
1066
+ * 否则通过全部检查后原样一次发布
1147
1067
  * tool_executing —— 至少一个工具在跑(并行时栈式显示多个)
1148
1068
  * compacting —— 正在跑自动 / reactive / 手动压缩
1149
1069
  */
@@ -1220,7 +1140,10 @@ export interface TurnResourceUsage {
1220
1140
  }
1221
1141
 
1222
1142
  export type LoopEvent =
1223
- /** 文本流(同 LlmStreamEvent.text_delta) */
1143
+ /**
1144
+ * 对用户可见的回答正文。没有任何检查能再拦下本次回答时逐段实时发出(含工具轮的
1145
+ * 过程说明);否则候选保持私有,通过全部检查后原样一次发出。已发出的正文不会被撤回。
1146
+ */
1224
1147
  | { type: 'text'; delta: string }
1225
1148
  /**
1226
1149
  * 用户消息刚 push 进 history(loop 入口)。
@@ -1242,16 +1165,16 @@ export type LoopEvent =
1242
1165
  }
1243
1166
  /**
1244
1167
  * 内部候选正文尚不能交付,需要进入检查或补全阶段。
1245
- * 新内核候选正文不广播;textLength=0,仅表示准备/复核阶段变化。
1168
+ * 只退回从未广播的私有候选,已实时显示的正文不会被退回;textLength=0,仅表示准备/复核阶段变化。
1246
1169
  * textLength>0 仅供旧事件兼容,不应作为正常展示路径。
1247
1170
  */
1248
1171
  | {
1249
1172
  type: 'assistant_draft_discarded';
1250
1173
  reason:
1251
1174
  | 'formal_delivery'
1252
- | 'advisor_checkpoint'
1253
1175
  | 'empty_response'
1254
- | 'interactive_question';
1176
+ | 'interactive_question'
1177
+ | 'diagram_preparation';
1255
1178
  textLength: number;
1256
1179
  }
1257
1180
  /**
package/src/ui/App.js CHANGED
@@ -33,6 +33,7 @@ import { InputBox } from './InputBox.js';
33
33
  import { LiveArea } from './LiveArea.js';
34
34
  import { MessageList } from './MessageList.js';
35
35
  import { ModelPicker } from './ModelPicker.js';
36
+ import { effortChoicesText, parseEffortCommand } from './effortCommand.js';
36
37
  import { QueuedMessagesBanner } from './QueuedMessagesBanner.js';
37
38
  import { SessionPicker } from './SessionPicker.js';
38
39
  import { StatusLine } from './StatusLine.js';
@@ -58,6 +59,8 @@ const CLEAR_SCREEN = '\x1b[2J\x1b[H';
58
59
  function formatProviderName(apiFormat) {
59
60
  if (apiFormat === 'anthropic')
60
61
  return 'Anthropic';
62
+ if (apiFormat === 'openai-responses')
63
+ return 'OpenAI Responses';
61
64
  if (apiFormat === 'openai')
62
65
  return 'OpenAI兼容';
63
66
  return apiFormat;
@@ -801,6 +804,24 @@ export function App({ provider, initialHistory }) {
801
804
  return;
802
805
  }
803
806
  }
807
+ // /effort [档位|auto] —— 只改当前 Session 的推理强度(不写回配置,与 /model 同语义)。
808
+ const effortCommand = parseEffortCommand(trimmed);
809
+ if (effortCommand.matched) {
810
+ const current = chat.getCurrentProvider();
811
+ if (effortCommand.action === 'show') {
812
+ chat.ephemeralLine(`[/effort] 当前 ${current.model} 的推理强度:${current.reasoningEffort ?? '未设置(服务端默认)'}\n` +
813
+ ` 用法:/effort <${effortChoicesText()}>;各模型接受的档位不同,不被接受时会自动去掉该参数并告警。`);
814
+ }
815
+ else if (effortCommand.action === 'invalid') {
816
+ chat.ephemeralLine(`[/effort] 不认识 "${effortCommand.input}",可选:${effortChoicesText()}`);
817
+ }
818
+ else {
819
+ const { reasoningEffort: _previous, ...rest } = current;
820
+ chat.setProvider(effortCommand.effort ? { ...rest, reasoningEffort: effortCommand.effort } : rest);
821
+ chat.ephemeralLine(`[/effort] 当前 Session 的推理强度已设为 ${effortCommand.effort ?? '未设置(服务端默认)'},下一轮对话生效。`);
822
+ }
823
+ return;
824
+ }
804
825
  const modelArgMatch = /^\/model(?:\s+(.+))?$/.exec(trimmed);
805
826
  if (modelArgMatch) {
806
827
  const arg = modelArgMatch[1]?.trim();
@@ -977,7 +998,7 @@ export function App({ provider, initialHistory }) {
977
998
  if (!drafts.current.has(draftKey))
978
999
  drafts.current.set(draftKey, { current: { text: '', cursor: 0 } });
979
1000
  const advisorLabel = !advisorStatus.configured ? '未配置' : !advisorStatus.enabled ? '已关闭' : advisorStatus.mode === 'manual' ? '仅手动' : '自动启用';
980
- const bannerText = `minimal-agent · ${currentProvider.name}/${currentProvider.model} · /model 切模型 · /computer 控制桌面 · /copy 复制回复 · /paste-image 添加图片 · /new 清空 · /compact 压缩 · Ctrl+C 中断`;
1001
+ const bannerText = `minimal-agent · ${currentProvider.name}/${currentProvider.model} · /model 切模型 · /effort 思考强度 · /computer 控制桌面 · /copy 复制回复 · /paste-image 添加图片 · /new 清空 · /compact 压缩 · Ctrl+C 中断`;
981
1002
  return (_jsxs(Box, { flexDirection: "column", children: [_jsx(MessageList, { history: chat.history, compactGeneration: chat.compactGeneration, bannerText: `${bannerText} · 顾问:${advisorLabel}(/advisor status)`, terminalRows: terminalRows }), _jsxs(Box, { flexDirection: "column", width: Math.max(1, terminalCols - 1), children: [!configMenuOpen && !baseModelPicker && !advisorModelPicker && !workspacePicker && !sessionPicker && !chat.pendingAsk && _jsx(LiveArea, { progressStage: chat.progressStage, reasoningPreview: chat.reasoningPreview, streamingText: chat.streamingText, runningTools: chat.runningTools, pluginProgress: chat.pluginProgress, transientError: chat.transientError, progressNotice: chat.progressNotice, terminalCols: terminalCols, terminalRows: terminalRows, reservedRows: chromeRows + 3 }), _jsxs(Box, { flexDirection: "column", ref: chromeRef, children: [_jsx(QueuedMessagesBanner, { items: chat.queuedItems }), chat.pendingComputerIntervention && (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.warning, paddingX: 1, marginBottom: 1, children: [_jsxs(Text, { color: theme.warning, children: ["\u9700\u8981\u4EBA\u5DE5\u64CD\u4F5C\uFF1A", chat.pendingComputerIntervention.sanitizedSummary] }), _jsx(Text, { dimColor: true, children: "\u8BF7\u76F4\u63A5\u5728\u76EE\u6807\u5E94\u7528\u4E2D\u5904\u7406\uFF1B\u654F\u611F\u5185\u5BB9\u4E0D\u4F1A\u8FDB\u5165\u7EC8\u7AEF\u6216\u6A21\u578B\u3002\u5B8C\u6210\u540E\u8F93\u5165 /computer resume\uFF0C\u53D6\u6D88\u8F93\u5165 /computer cancel\u3002" })] })), chat.error && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: theme.error, wrap: "truncate-end", children: ["\u26A0 ", terminalText(chat.error)] }) })), chat.interrupted && (_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { color: theme.warning, children: "\u26A1 \u64CD\u4F5C\u88AB\u7528\u6237\u4E2D\u65AD\uFF0C\u7B49\u5F85\u65B0\u7684\u4EFB\u52A1\u8F93\u5165..." }), _jsxs(Text, { dimColor: true, children: [' ', "\u8C03\u6574\u4E0A\u4E00\u6B21\u8BA1\u5212\uFF1A\u76F4\u63A5\u8BF4\u8C03\u6574\u5185\u5BB9 / \u91CD\u65B0\u8DD1 /workflow plan \u76EE\u6807 / \u65B0\u4EFB\u52A1\u76F4\u63A5\u8BF4"] })] })), configMenuOpen ? (_jsx(ConfigMenu, { mode: "reconfigure", onDone: () => setConfigMenuOpen(false) })) : baseModelPicker ? (_jsx(ModelPicker, { models: baseModelPicker.models, currentModelId: baseModelPicker.currentId, title: "\u9009\u62E9\u57FA\u5EA7\u6A21\u578B", onSelect: handleBaseModelSelect, onCancel: () => setBaseModelPicker(null) })) : advisorModelPicker ? (_jsx(ModelPicker, { models: advisorModelPicker.models, currentModelId: advisorModelPicker.currentId, title: "\u9009\u62E9\u987E\u95EE\u6A21\u578B", nullOptionLabel: "\u25CB \u4E0D\u4F7F\u7528\u987E\u95EE\u6A21\u578B", onSelect: handleAdvisorModelSelect, onCancel: () => setAdvisorModelPicker(null) })) : workspacePicker ? (_jsx(WorkspacePicker, { workspaces: workspacePicker, currentPath: getWorkingDir(), currentSessionId: chat.activeSessionId, onSelect: handleWorkspaceSelect, onCancel: () => setWorkspacePicker(null) })) : sessionPicker ? (_jsx(SessionPicker, { sessions: sessionPicker, activeSessionId: chat.activeSessionId, onSelect: handleSessionSelect, onCreate: handleSessionCreate, onCancel: () => setSessionPicker(null) })) : chat.pendingAsk ? (_jsx(AskQuestion, { questions: chat.pendingAsk, source: chat.pendingAskSource, queuedCount: chat.pendingAskQueueCount, onAnswer: chat.answerAsk, onCancel: chat.cancelAsk })) : (
982
1003
  /* handleSubmit 包装做 slash 命令拦截,非命令透传 chat.submit */
983
1004
  _jsx(InputBox, { draft: drafts.current.get(draftKey), onHeight: setInputRows, onSubmit: handleSubmit, disabled: chat.isLoading && !chat.pendingComputerIntervention, onAbort: chat.abort, onClear: handleClear, onCompact: chat.compactNow, onWorkspaces: openWorkspacePicker }, draftKey)), _jsx(StatusLine, { provider: currentProvider, history: chat.history, pluginProgress: chat.pluginProgress, contextUsage: chat.contextUsage })] })] })] }));
package/src/ui/App.tsx CHANGED
@@ -56,6 +56,7 @@ import { InputBox } from './InputBox.js';
56
56
  import { LiveArea } from './LiveArea.js';
57
57
  import { MessageList } from './MessageList.js';
58
58
  import { ModelPicker } from './ModelPicker.js';
59
+ import { effortChoicesText, parseEffortCommand } from './effortCommand.js';
59
60
  import type { PickerModel } from './ModelPicker.js';
60
61
  import { QueuedMessagesBanner } from './QueuedMessagesBanner.js';
61
62
  import { SessionPicker } from './SessionPicker.js';
@@ -87,6 +88,7 @@ const CLEAR_SCREEN = '\x1b[2J\x1b[H';
87
88
 
88
89
  function formatProviderName(apiFormat: string): string {
89
90
  if (apiFormat === 'anthropic') return 'Anthropic';
91
+ if (apiFormat === 'openai-responses') return 'OpenAI Responses';
90
92
  if (apiFormat === 'openai') return 'OpenAI兼容';
91
93
  return apiFormat;
92
94
  }
@@ -1012,6 +1014,29 @@ export function App({ provider, initialHistory }: Props): JSX.Element {
1012
1014
  }
1013
1015
  }
1014
1016
 
1017
+ // /effort [档位|auto] —— 只改当前 Session 的推理强度(不写回配置,与 /model 同语义)。
1018
+ const effortCommand = parseEffortCommand(trimmed);
1019
+ if (effortCommand.matched) {
1020
+ const current = chat.getCurrentProvider();
1021
+ if (effortCommand.action === 'show') {
1022
+ chat.ephemeralLine(
1023
+ `[/effort] 当前 ${current.model} 的推理强度:${current.reasoningEffort ?? '未设置(服务端默认)'}\n` +
1024
+ ` 用法:/effort <${effortChoicesText()}>;各模型接受的档位不同,不被接受时会自动去掉该参数并告警。`,
1025
+ );
1026
+ } else if (effortCommand.action === 'invalid') {
1027
+ chat.ephemeralLine(`[/effort] 不认识 "${effortCommand.input}",可选:${effortChoicesText()}`);
1028
+ } else {
1029
+ const { reasoningEffort: _previous, ...rest } = current;
1030
+ chat.setProvider(
1031
+ effortCommand.effort ? { ...rest, reasoningEffort: effortCommand.effort } : rest,
1032
+ );
1033
+ chat.ephemeralLine(
1034
+ `[/effort] 当前 Session 的推理强度已设为 ${effortCommand.effort ?? '未设置(服务端默认)'},下一轮对话生效。`,
1035
+ );
1036
+ }
1037
+ return;
1038
+ }
1039
+
1015
1040
  const modelArgMatch = /^\/model(?:\s+(.+))?$/.exec(trimmed);
1016
1041
  if (modelArgMatch) {
1017
1042
  const arg = modelArgMatch[1]?.trim();
@@ -1231,7 +1256,7 @@ export function App({ provider, initialHistory }: Props): JSX.Element {
1231
1256
  const draftKey = `${getWorkingDir()}\0${chat.activeSessionId}`;
1232
1257
  if (!drafts.current.has(draftKey)) drafts.current.set(draftKey, { current: { text: '', cursor: 0 } });
1233
1258
  const advisorLabel = !advisorStatus.configured ? '未配置' : !advisorStatus.enabled ? '已关闭' : advisorStatus.mode === 'manual' ? '仅手动' : '自动启用';
1234
- const bannerText = `minimal-agent · ${currentProvider.name}/${currentProvider.model} · /model 切模型 · /computer 控制桌面 · /copy 复制回复 · /paste-image 添加图片 · /new 清空 · /compact 压缩 · Ctrl+C 中断`;
1259
+ const bannerText = `minimal-agent · ${currentProvider.name}/${currentProvider.model} · /model 切模型 · /effort 思考强度 · /computer 控制桌面 · /copy 复制回复 · /paste-image 添加图片 · /new 清空 · /compact 压缩 · Ctrl+C 中断`;
1235
1260
 
1236
1261
  return (
1237
1262
  <Box flexDirection="column">
@@ -35,7 +35,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
35
35
  import React from 'react';
36
36
  import { Box, Static, Text } from 'ink';
37
37
  import { conciseToolDescription } from './toolProgress.js';
38
- import { advisorOpinionText, advisorDecisionLabel, advisorEvidenceLabel } from '../advisor/presentation.js';
38
+ import { advisorOpinionText } from '../advisor/presentation.js';
39
39
  import { contentToDisplayText, contentToPlainText } from '../multimodal.js';
40
40
  import { splitThinkBlocks } from '../utils/stripThink.js';
41
41
  import { figures } from './figures.js';
@@ -104,16 +104,6 @@ export function buildToolCallIndex(history) {
104
104
  }
105
105
  return map;
106
106
  }
107
- /** 按 consultationId 关联持久化决定,供历史重载时在顾问卡片下恢复展示。 */
108
- export function buildAdvisorDecisionIndex(history) {
109
- const decisions = new Map();
110
- for (const message of history) {
111
- if (message.role !== 'tool' || message.display_metadata?.kind !== 'advisor_decision')
112
- continue;
113
- decisions.set(message.display_metadata.consultationId, message.display_metadata);
114
- }
115
- return decisions;
116
- }
117
107
  /**
118
108
  * 从 Agent 子任务报告的统计尾巴(agent.ts 固定格式
119
109
  * 「(子任务「x」[type]:N 轮 · M 次工具调用,K 次失败)」)解析统计数。
@@ -218,7 +208,6 @@ export const MessageList = React.memo(function MessageList({ history, compactGen
218
208
  const items = React.useMemo(() => {
219
209
  const turnMetas = summarizeTurn(history);
220
210
  const toolIndex = buildToolCallIndex(history);
221
- const advisorDecisions = buildAdvisorDecisionIndex(history);
222
211
  return [
223
212
  ...(bannerText
224
213
  ? [
@@ -234,10 +223,6 @@ export const MessageList = React.memo(function MessageList({ history, compactGen
234
223
  msg: m,
235
224
  turnMeta: turnMetas[idx],
236
225
  toolMeta: m.role === 'tool' ? (toolIndex.get(m.tool_call_id) ?? null) : null,
237
- advisorDecision: m.role === 'tool'
238
- && m.display_metadata?.kind === 'advisor_consultation'
239
- ? (advisorDecisions.get(m.display_metadata.consultationId) ?? null)
240
- : null,
241
226
  // 纯派生 key:有 id 用 id,没有就用 idx 兜底。绝不在 render 期 mutate 消息对象
242
227
  // (<Static> 已 commit 的行永不重绘,key 仅在 append 对账时用,idx 已足够稳定)。
243
228
  key: m.id ?? `message-${idx}`,
@@ -250,7 +235,7 @@ export const MessageList = React.memo(function MessageList({ history, compactGen
250
235
  if (item.kind === 'banner') {
251
236
  return _jsx(BannerRow, { text: item.text }, item.key);
252
237
  }
253
- return (_jsx(MessageRow, { message: item.msg, turnMeta: item.turnMeta, toolMeta: item.toolMeta, advisorDecision: item.advisorDecision, foldReasoning: foldReasoning }, item.key));
238
+ return (_jsx(MessageRow, { message: item.msg, turnMeta: item.turnMeta, toolMeta: item.toolMeta, foldReasoning: foldReasoning }, item.key));
254
239
  } }, compactGeneration));
255
240
  });
256
241
  function BannerRow({ text }) {
@@ -278,7 +263,7 @@ function formatToolHead(meta, shortId, statsTail) {
278
263
  .trim();
279
264
  return `[文件 · ${action}${target ? ` ${target}` : ''} · #${shortId}]${statsTail}`;
280
265
  }
281
- function MessageRow({ message, turnMeta, toolMeta, advisorDecision, foldReasoning, }) {
266
+ function MessageRow({ message, turnMeta, toolMeta, foldReasoning, }) {
282
267
  switch (message.role) {
283
268
  case 'system': {
284
269
  // v2.x:ephemeral system message 是 UI 临时提示(slash 命令输出等),
@@ -345,19 +330,10 @@ function MessageRow({ message, turnMeta, toolMeta, advisorDecision, foldReasonin
345
330
  const lines = terminalText(message.content).split('\n');
346
331
  // 顾问意见给更高的预览上限,并用默认亮色而非 dim 灰 —— 它是另一个模型说的话,
347
332
  // 不该和 grep 输出一样被视觉降级(见 MAX_ADVISOR_PREVIEW_LINES)。
348
- const advisorMeta = message.display_metadata?.kind === 'advisor_consultation'
349
- ? message.display_metadata
350
- : null;
351
- const decisionMeta = message.display_metadata?.kind === 'advisor_decision'
352
- ? message.display_metadata
353
- : null;
354
333
  const inferredToolName = toolMeta?.toolName
355
- ?? (advisorMeta ? 'Advisor' : null)
356
- ?? (decisionMeta ? 'AdvisorDecision' : null)
357
334
  ?? (message.display_metadata?.kind === 'result_manifest' ? 'PresentResult' : null)
358
335
  ?? (message.display_metadata?.kind === 'agent' ? 'Agent' : undefined);
359
336
  const isAdvisor = inferredToolName === 'Advisor';
360
- const isAdvisorDecision = inferredToolName === 'AdvisorDecision';
361
337
  if (isAdvisor)
362
338
  lines.splice(0, lines.length, ...terminalText(advisorOpinionText(message.content)).split('\n'));
363
339
  const visibility = toolHistoryVisibility(inferredToolName, message.content);
@@ -365,9 +341,6 @@ function MessageRow({ message, turnMeta, toolMeta, advisorDecision, foldReasonin
365
341
  const previewLines = lines.slice(0, previewCap);
366
342
  const hidden = Math.max(0, lines.length - previewCap);
367
343
  const shortId = message.tool_call_id.slice(-8);
368
- if (message.display_metadata?.kind === 'advisor_checkpoint') {
369
- return _jsx(Box, { marginBottom: 1, paddingLeft: 2, children: _jsx(Text, { color: theme.subtle, wrap: "end", children: `已暂缓 · 顾问检查点 · 操作尚未执行(/show ${shortId} 查看详情,复核进展见后续记录)` }) });
370
- }
371
344
  // 头行升级:有 toolMeta(发起方反查命中)显示人话描述;Agent 子任务
372
345
  // 再解析统计尾巴显示 ✓ N 轮 · M 次工具。无 meta(历史重载等)兜底旧格式。
373
346
  const stats = inferredToolName === 'Agent' ? agentResultStats(message.content) : null;
@@ -377,25 +350,16 @@ function MessageRow({ message, turnMeta, toolMeta, advisorDecision, foldReasonin
377
350
  // 顾问头行单独成文并去掉 dim:friendlyToolDescription 没有 Advisor 分支,
378
351
  // 走兜底会显示成一串参数预览,看不出这是「第二个模型的独立意见」。
379
352
  const headText = isAdvisor
380
- ? `[顾问意见 · ${advisorMeta?.checkpoint ?? 'manual'} · #${shortId}]`
381
- : isAdvisorDecision
382
- ? `[顾问意见处理 · ${decisionMeta?.decision ?? 'unknown'} · #${shortId}]`
383
- : toolMeta
384
- ? formatToolHead(toolMeta, shortId, statsTail)
385
- : `[tool result · #${shortId}]`;
353
+ ? `[顾问意见 · #${shortId}]`
354
+ : toolMeta
355
+ ? formatToolHead(toolMeta, shortId, statsTail)
356
+ : `[tool result · #${shortId}]`;
386
357
  if (visibility === 'hidden')
387
358
  return null;
388
- if (isAdvisorDecision) {
389
- return _jsx(Box, { marginBottom: 1, paddingLeft: 2, children: _jsxs(Text, { color: theme.subtle, wrap: "end", children: [decisionMeta
390
- ? `顾问意见已处理 · ${advisorDecisionLabel(decisionMeta.decision)} · ${advisorEvidenceLabel(decisionMeta.verificationStatus)}`
391
- : '顾问意见登记未完成 · 可重试', `(/show ${shortId} 查看详情)`] }) });
392
- }
393
359
  if (visibility === 'compact') {
394
360
  return (_jsx(Box, { marginBottom: 1, paddingLeft: 2, children: _jsx(Text, { color: theme.subtle, dimColor: true, wrap: "end", children: terminalText(headText) }) }));
395
361
  }
396
- return (_jsx(Box, { marginBottom: 1, paddingLeft: 2, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.subtle, ...(isAdvisor ? {} : { dimColor: true }), wrap: "end", children: terminalText(headText) }), advisorMeta && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.subtle, wrap: "end", children: terminalText(advisorMeta.status === 'completed'
397
- ? '顾问意见已返回,尚不代表事实核验通过'
398
- : '顾问咨询未完成,已降级继续') }), advisorMeta.status === 'completed' && !advisorDecision && (_jsx(Text, { color: theme.subtle, wrap: "end", children: "\u987E\u95EE\u610F\u89C1\u5DF2\u8FD4\u56DE\uFF1B\u4E3B Agent \u7684\u6838\u9A8C\u4E0E\u91C7\u7EB3\u7ED3\u8BBA\u89C1\u540E\u7EED\u8BB0\u5F55\u3002" })), advisorDecision && (_jsx(Text, { color: theme.subtle, wrap: "end", children: terminalText(`${advisorDecision.decision} · ${advisorDecision.rationale}`) })), advisorDecision?.verificationPlan.map((item) => (_jsx(Text, { color: theme.subtle, wrap: "end", children: terminalText(`验证:${item}`) }, `advisor-card-verify-${item}`)))] })), decisionMeta && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.subtle, wrap: "end", children: terminalText(`关联咨询 ${decisionMeta.consultationId} · ${decisionMeta.rationale}`) }), decisionMeta.verificationPlan.map((item) => (_jsx(Text, { color: theme.subtle, wrap: "end", children: terminalText(`验证:${item}`) }, `advisor-verify-${item}`)))] })), previewLines.map((line, i) => (_jsx(Text, { ...(isAdvisor ? {} : { color: theme.subtle }), wrap: "end", children: line.length > 0 ? line : ' ' }, `p-${i}`))), hidden > 0 && (_jsx(Text, { color: theme.subtle, dimColor: true, children: `... ${figures.fold} 完整 ${lines.length} 行(输入 /show ${shortId} 查看)` }))] }) }));
362
+ return (_jsx(Box, { marginBottom: 1, paddingLeft: 2, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.subtle, ...(isAdvisor ? {} : { dimColor: true }), wrap: "end", children: terminalText(headText) }), previewLines.map((line, i) => (_jsx(Text, { ...(isAdvisor ? {} : { color: theme.subtle }), wrap: "end", children: line.length > 0 ? line : ' ' }, `p-${i}`))), hidden > 0 && (_jsx(Text, { color: theme.subtle, dimColor: true, children: `... ${figures.fold} 完整 ${lines.length} 行(输入 /show ${shortId} 查看)` }))] }) }));
399
363
  }
400
364
  }
401
365
  }
@@ -36,9 +36,9 @@ import React from 'react';
36
36
  import { Box, Static, Text } from 'ink';
37
37
 
38
38
  import { conciseToolDescription } from './toolProgress.js';
39
- import { advisorOpinionText, advisorDecisionLabel, advisorEvidenceLabel } from '../advisor/presentation.js';
39
+ import { advisorOpinionText } from '../advisor/presentation.js';
40
40
  import { contentToDisplayText, contentToPlainText } from '../multimodal.js';
41
- import type { AdvisorDecisionMetadata, Message } from '../types.js';
41
+ import type { Message } from '../types.js';
42
42
  import { splitThinkBlocks } from '../utils/stripThink.js';
43
43
  import { figures } from './figures.js';
44
44
  import { terminalText } from './terminalText.js';
@@ -72,7 +72,6 @@ type StaticItem =
72
72
  turnMeta: TurnMeta | null;
73
73
  /** tool 消息的发起方人话描述(buildToolCallIndex 反查);其余消息 null */
74
74
  toolMeta: ToolCallMeta | null;
75
- advisorDecision: AdvisorDecisionMetadata | null;
76
75
  key: string;
77
76
  };
78
77
 
@@ -167,18 +166,6 @@ export function buildToolCallIndex(history: Message[]): Map<string, ToolCallMeta
167
166
  return map;
168
167
  }
169
168
 
170
- /** 按 consultationId 关联持久化决定,供历史重载时在顾问卡片下恢复展示。 */
171
- export function buildAdvisorDecisionIndex(
172
- history: Message[],
173
- ): Map<string, AdvisorDecisionMetadata> {
174
- const decisions = new Map<string, AdvisorDecisionMetadata>();
175
- for (const message of history) {
176
- if (message.role !== 'tool' || message.display_metadata?.kind !== 'advisor_decision') continue;
177
- decisions.set(message.display_metadata.consultationId, message.display_metadata);
178
- }
179
- return decisions;
180
- }
181
-
182
169
  /**
183
170
  * 从 Agent 子任务报告的统计尾巴(agent.ts 固定格式
184
171
  * 「(子任务「x」[type]:N 轮 · M 次工具调用,K 次失败)」)解析统计数。
@@ -302,7 +289,6 @@ export const MessageList = React.memo(function MessageList({
302
289
  const items: StaticItem[] = React.useMemo(() => {
303
290
  const turnMetas = summarizeTurn(history);
304
291
  const toolIndex = buildToolCallIndex(history);
305
- const advisorDecisions = buildAdvisorDecisionIndex(history);
306
292
  return [
307
293
  ...(bannerText
308
294
  ? [
@@ -318,10 +304,6 @@ export const MessageList = React.memo(function MessageList({
318
304
  msg: m,
319
305
  turnMeta: turnMetas[idx],
320
306
  toolMeta: m.role === 'tool' ? (toolIndex.get(m.tool_call_id) ?? null) : null,
321
- advisorDecision: m.role === 'tool'
322
- && m.display_metadata?.kind === 'advisor_consultation'
323
- ? (advisorDecisions.get(m.display_metadata.consultationId) ?? null)
324
- : null,
325
307
  // 纯派生 key:有 id 用 id,没有就用 idx 兜底。绝不在 render 期 mutate 消息对象
326
308
  // (<Static> 已 commit 的行永不重绘,key 仅在 append 对账时用,idx 已足够稳定)。
327
309
  key: m.id ?? `message-${idx}`,
@@ -345,7 +327,6 @@ export const MessageList = React.memo(function MessageList({
345
327
  message={item.msg}
346
328
  turnMeta={item.turnMeta}
347
329
  toolMeta={item.toolMeta}
348
- advisorDecision={item.advisorDecision}
349
330
  foldReasoning={foldReasoning}
350
331
  />
351
332
  );
@@ -391,13 +372,11 @@ function MessageRow({
391
372
  message,
392
373
  turnMeta,
393
374
  toolMeta,
394
- advisorDecision,
395
375
  foldReasoning,
396
376
  }: {
397
377
  message: Message;
398
378
  turnMeta: TurnMeta | null;
399
379
  toolMeta?: ToolCallMeta | null;
400
- advisorDecision?: AdvisorDecisionMetadata | null;
401
380
  foldReasoning: boolean;
402
381
  }): JSX.Element | null {
403
382
  switch (message.role) {
@@ -553,30 +532,16 @@ function MessageRow({
553
532
  const lines = terminalText(message.content).split('\n');
554
533
  // 顾问意见给更高的预览上限,并用默认亮色而非 dim 灰 —— 它是另一个模型说的话,
555
534
  // 不该和 grep 输出一样被视觉降级(见 MAX_ADVISOR_PREVIEW_LINES)。
556
- const advisorMeta = message.display_metadata?.kind === 'advisor_consultation'
557
- ? message.display_metadata
558
- : null;
559
- const decisionMeta = message.display_metadata?.kind === 'advisor_decision'
560
- ? message.display_metadata
561
- : null;
562
535
  const inferredToolName = toolMeta?.toolName
563
- ?? (advisorMeta ? 'Advisor' : null)
564
- ?? (decisionMeta ? 'AdvisorDecision' : null)
565
536
  ?? (message.display_metadata?.kind === 'result_manifest' ? 'PresentResult' : null)
566
537
  ?? (message.display_metadata?.kind === 'agent' ? 'Agent' : undefined);
567
538
  const isAdvisor = inferredToolName === 'Advisor';
568
- const isAdvisorDecision = inferredToolName === 'AdvisorDecision';
569
539
  if (isAdvisor) lines.splice(0, lines.length, ...terminalText(advisorOpinionText(message.content)).split('\n'));
570
540
  const visibility = toolHistoryVisibility(inferredToolName, message.content);
571
541
  const previewCap = toolPreviewCap(inferredToolName);
572
542
  const previewLines = lines.slice(0, previewCap);
573
543
  const hidden = Math.max(0, lines.length - previewCap);
574
544
  const shortId = message.tool_call_id.slice(-8);
575
- if (message.display_metadata?.kind === 'advisor_checkpoint') {
576
- return <Box marginBottom={1} paddingLeft={2}><Text color={theme.subtle} wrap="end">
577
- {`已暂缓 · 顾问检查点 · 操作尚未执行(/show ${shortId} 查看详情,复核进展见后续记录)`}
578
- </Text></Box>;
579
- }
580
545
  // 头行升级:有 toolMeta(发起方反查命中)显示人话描述;Agent 子任务
581
546
  // 再解析统计尾巴显示 ✓ N 轮 · M 次工具。无 meta(历史重载等)兜底旧格式。
582
547
  const stats =
@@ -587,20 +552,11 @@ function MessageRow({
587
552
  // 顾问头行单独成文并去掉 dim:friendlyToolDescription 没有 Advisor 分支,
588
553
  // 走兜底会显示成一串参数预览,看不出这是「第二个模型的独立意见」。
589
554
  const headText = isAdvisor
590
- ? `[顾问意见 · ${advisorMeta?.checkpoint ?? 'manual'} · #${shortId}]`
591
- : isAdvisorDecision
592
- ? `[顾问意见处理 · ${decisionMeta?.decision ?? 'unknown'} · #${shortId}]`
555
+ ? `[顾问意见 · #${shortId}]`
593
556
  : toolMeta
594
557
  ? formatToolHead(toolMeta, shortId, statsTail)
595
558
  : `[tool result · #${shortId}]`;
596
559
  if (visibility === 'hidden') return null;
597
- if (isAdvisorDecision) {
598
- return <Box marginBottom={1} paddingLeft={2}><Text color={theme.subtle} wrap="end">
599
- {decisionMeta
600
- ? `顾问意见已处理 · ${advisorDecisionLabel(decisionMeta.decision)} · ${advisorEvidenceLabel(decisionMeta.verificationStatus)}`
601
- : '顾问意见登记未完成 · 可重试'}{`(/show ${shortId} 查看详情)`}
602
- </Text></Box>;
603
- }
604
560
  if (visibility === 'compact') {
605
561
  return (
606
562
  <Box marginBottom={1} paddingLeft={2}>
@@ -616,40 +572,6 @@ function MessageRow({
616
572
  <Text color={theme.subtle} {...(isAdvisor ? {} : { dimColor: true })} wrap="end">
617
573
  {terminalText(headText)}
618
574
  </Text>
619
- {advisorMeta && (
620
- <Box flexDirection="column">
621
- <Text color={theme.subtle} wrap="end">
622
- {terminalText(advisorMeta.status === 'completed'
623
- ? '顾问意见已返回,尚不代表事实核验通过'
624
- : '顾问咨询未完成,已降级继续')}
625
- </Text>
626
- {advisorMeta.status === 'completed' && !advisorDecision && (
627
- <Text color={theme.subtle} wrap="end">顾问意见已返回;主 Agent 的核验与采纳结论见后续记录。</Text>
628
- )}
629
- {advisorDecision && (
630
- <Text color={theme.subtle} wrap="end">
631
- {terminalText(`${advisorDecision.decision} · ${advisorDecision.rationale}`)}
632
- </Text>
633
- )}
634
- {advisorDecision?.verificationPlan.map((item) => (
635
- <Text key={`advisor-card-verify-${item}`} color={theme.subtle} wrap="end">
636
- {terminalText(`验证:${item}`)}
637
- </Text>
638
- ))}
639
- </Box>
640
- )}
641
- {decisionMeta && (
642
- <Box flexDirection="column">
643
- <Text color={theme.subtle} wrap="end">
644
- {terminalText(`关联咨询 ${decisionMeta.consultationId} · ${decisionMeta.rationale}`)}
645
- </Text>
646
- {decisionMeta.verificationPlan.map((item) => (
647
- <Text key={`advisor-verify-${item}`} color={theme.subtle} wrap="end">
648
- {terminalText(`验证:${item}`)}
649
- </Text>
650
- ))}
651
- </Box>
652
- )}
653
575
  {/* 逐行 wrap='end':整段默认 wrap 会注入真实换行,从预览复制会被硬断行 */}
654
576
  {previewLines.map((line, i) => (
655
577
  <Text key={`p-${i}`} {...(isAdvisor ? {} : { color: theme.subtle })} wrap="end">