Compare commits
6 Commits
8d87068ba7
...
ff7108738e
| Author | SHA1 | Date | |
|---|---|---|---|
| ff7108738e | |||
| d5bf110b88 | |||
| 033bea236c | |||
| 59b81c4551 | |||
| a2a04b9529 | |||
| bd338f7ad4 |
@ -130,13 +130,14 @@ class WebTerminal(MainTerminal):
|
||||
logger.warning("忽略无效默认模型 %s: %s", preferred_model, exc)
|
||||
|
||||
preferred_mode = prefs.get("default_run_mode")
|
||||
preferred_permission_mode = None
|
||||
try:
|
||||
preferred_permission_mode = self.get_permission_mode()
|
||||
except Exception:
|
||||
preferred_permission_mode = None
|
||||
preferred_permission_mode = prefs.get("default_permission_mode") or None
|
||||
if preferred_permission_mode not in ("readonly", "approval", "auto_approval", "unrestricted"):
|
||||
try:
|
||||
preferred_permission_mode = self.get_permission_mode()
|
||||
except Exception:
|
||||
preferred_permission_mode = None
|
||||
if not isinstance(preferred_permission_mode, str) or not preferred_permission_mode.strip():
|
||||
preferred_permission_mode = prefs.get("default_permission_mode") or "unrestricted"
|
||||
preferred_permission_mode = "unrestricted"
|
||||
if isinstance(preferred_mode, str) and preferred_mode.lower() in {"fast", "thinking", "deep"}:
|
||||
try:
|
||||
self.set_run_mode(preferred_mode.lower())
|
||||
|
||||
@ -1699,10 +1699,25 @@ async def handle_task_with_sender(
|
||||
try:
|
||||
from .tasks import task_manager
|
||||
|
||||
pending_runtime_guidance_messages = task_manager.consume_runtime_guidance_messages(
|
||||
raw_items = task_manager.consume_runtime_guidance_for_injection(
|
||||
username=username,
|
||||
task_id=client_sid,
|
||||
)
|
||||
# 权限/审核方式变更通知在任务完成时不应该触发新一轮工作,
|
||||
# 只保留真正的引导消息(压缩续接等),丢弃权限/执行环境变更通知。
|
||||
runtime_skip_sources = {"权限变更", "执行环境变更", "notify"}
|
||||
for item in (raw_items or []):
|
||||
if isinstance(item, dict):
|
||||
src = str(item.get("source") or "").strip().lower()
|
||||
text = str(item.get("text") or "").strip()
|
||||
if src in runtime_skip_sources:
|
||||
continue
|
||||
if text:
|
||||
pending_runtime_guidance_messages.append(text)
|
||||
else:
|
||||
text = str(item or "").strip()
|
||||
if text:
|
||||
pending_runtime_guidance_messages.append(text)
|
||||
except Exception as exc:
|
||||
debug_log(f"[RuntimeGuidance] 读取剩余引导消息失败: {exc}")
|
||||
pending_runtime_guidance_messages = []
|
||||
|
||||
@ -482,6 +482,9 @@ def create_conversation(terminal: WebTerminal, workspace: UserWorkspace, usernam
|
||||
safe_run_mode = candidate if candidate in {"fast", "thinking", "deep"} else "fast"
|
||||
safe_thinking = bool(thinking_mode) if thinking_mode is not None else safe_run_mode != "fast"
|
||||
previous_cm_current = getattr(cm, "current_conversation_id", None)
|
||||
default_permission_mode = (prefs or {}).get("default_permission_mode")
|
||||
if default_permission_mode not in ("readonly", "approval", "auto_approval", "unrestricted"):
|
||||
default_permission_mode = None
|
||||
conversation_id = cm.create_conversation(
|
||||
project_path=str(workspace.project_path),
|
||||
thinking_mode=safe_thinking,
|
||||
@ -489,7 +492,7 @@ def create_conversation(terminal: WebTerminal, workspace: UserWorkspace, usernam
|
||||
initial_messages=[],
|
||||
model_key=(prefs or {}).get("default_model") or getattr(terminal, "model_key", None),
|
||||
metadata_overrides={
|
||||
"permission_mode": getattr(terminal, "get_permission_mode", lambda: "unrestricted")(),
|
||||
"permission_mode": default_permission_mode or getattr(terminal, "get_permission_mode", lambda: "unrestricted")(),
|
||||
"execution_mode": getattr(terminal, "get_execution_mode", lambda: "sandbox")(),
|
||||
},
|
||||
)
|
||||
|
||||
@ -140,7 +140,7 @@ def _run_project_git(project_path: Path, args: list[str]) -> tuple[bool, str]:
|
||||
return False, ""
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
[git_bin, "-C", str(project_path), *args],
|
||||
[git_bin, "-c", "core.quotePath=false", "-C", str(project_path), *args],
|
||||
cwd=str(project_path),
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
@ -159,7 +159,7 @@ def _run_project_git_raw(project_path: Path, args: list[str], timeout: int = 4)
|
||||
return False, ""
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
[git_bin, "-C", str(project_path), *args],
|
||||
[git_bin, "-c", "core.quotePath=false", "-C", str(project_path), *args],
|
||||
cwd=str(project_path),
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
|
||||
@ -305,6 +305,7 @@
|
||||
:current-context-tokens="currentContextTokens"
|
||||
:versioning-enabled="versioningEnabled"
|
||||
:runtime-queued-messages="runtimeQueuedMessages"
|
||||
:has-pending-runtime-guidance="runtimeGuidanceFallbackQueue.length > 0"
|
||||
:project-git-summary="projectGitSummary"
|
||||
:user-question-minimized="userQuestionMinimized"
|
||||
:pending-user-question-count="pendingUserQuestions.length"
|
||||
|
||||
@ -515,6 +515,7 @@ const props = defineProps<{
|
||||
goalModeArmed?: boolean;
|
||||
goalRunning?: boolean;
|
||||
goalProgress?: Record<string, any> | null;
|
||||
hasPendingRuntimeGuidance?: boolean;
|
||||
}>();
|
||||
|
||||
const inputStore = useInputStore();
|
||||
@ -598,6 +599,8 @@ const projectGitSummaryForRender = computed(() => {
|
||||
|
||||
const floatingStatusVisible = computed(() => {
|
||||
if (skillSlashMenuOpen.value || props.quickMenuOpen) return false;
|
||||
// 消息队列(预输入/引导消息)存在时隐藏git状态栏,与 / 菜单出现时逻辑相同
|
||||
if (runtimeQueuedMessagesForRender.value.length > 0 || props.hasPendingRuntimeGuidance) return false;
|
||||
return (
|
||||
!!projectGitSummaryForRender.value ||
|
||||
!!props.goalRunning ||
|
||||
|
||||
@ -257,6 +257,7 @@ const parseFinalMessage = (text: string) => {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.auto-approval-block__content {
|
||||
@ -265,6 +266,7 @@ const parseFinalMessage = (text: string) => {
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.auto-approval-block__final {
|
||||
@ -276,6 +278,7 @@ const parseFinalMessage = (text: string) => {
|
||||
.auto-approval-block__decision {
|
||||
font-weight: 700;
|
||||
margin-bottom: 4px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.auto-approval-block__decision--approved {
|
||||
@ -289,6 +292,7 @@ const parseFinalMessage = (text: string) => {
|
||||
.auto-approval-block__reason {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.tool-approval-panel.is-goal-approval-mode .auto-approval-block {
|
||||
|
||||
@ -1916,7 +1916,7 @@
|
||||
height: 100%;
|
||||
max-width: 92vw;
|
||||
background: var(--claude-panel);
|
||||
box-shadow: -10px 0 28px color-mix(in srgb, var(--text-primary) 22%, transparent);
|
||||
box-shadow: var(--shadow-strong);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -1994,6 +1994,7 @@
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 12px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.confirm-message {
|
||||
@ -2037,7 +2038,7 @@
|
||||
.confirm-button--primary {
|
||||
background: var(--claude-accent);
|
||||
border-color: var(--claude-accent-strong);
|
||||
color: var(--text-primary);
|
||||
color: var(--on-accent);
|
||||
}
|
||||
|
||||
.confirm-button--danger {
|
||||
|
||||
@ -605,6 +605,7 @@ body[data-theme='dark'] .git-change-file__open-icon {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
background: var(--theme-surface-muted);
|
||||
color: var(--text-primary);
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
}
|
||||
@ -616,6 +617,7 @@ body[data-theme='dark'] .git-change-file__open-icon {
|
||||
|
||||
.approval-diff {
|
||||
margin-top: 12px;
|
||||
color: var(--text-primary);
|
||||
font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
@ -648,12 +650,14 @@ body[data-theme='dark'] .git-change-file__open-icon {
|
||||
|
||||
.approval-kv strong {
|
||||
white-space: nowrap;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.approval-value {
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
word-break: break-word;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.approval-note {
|
||||
@ -665,16 +669,19 @@ body[data-theme='dark'] .git-change-file__open-icon {
|
||||
.approval-lines--old {
|
||||
background: color-mix(in srgb, var(--claude-warning) 18%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--claude-warning) 50%, transparent);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.approval-lines--new {
|
||||
background: color-mix(in srgb, var(--claude-success) 18%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--claude-success) 50%, transparent);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.approval-lines--cmd,
|
||||
.approval-lines--generic {
|
||||
background: var(--theme-surface-muted);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.tool-approval-panel .diff-line {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user