feat: improve goal mode and Codex App resilience

This commit is contained in:
shiyue
2026-08-18 21:27:58 +08:00
parent 389690af64
commit 8fe31e0a5e
27 changed files with 631 additions and 24 deletions

View File

@@ -7979,11 +7979,13 @@
const isCrossConversation = !!meta.crossConversation;
const isCrossConversationReply = isCrossConversation && !!(meta.crossConversation.reply || meta.crossConversation.replyToRequestId);
const canCollapseCrossConversationReply = role === 'assistant' && isCrossConversationReply;
const isGoalMessage = role === 'user' && meta?.ccwebGoalCommand?.action === 'set';
const resolvedMessageId = meta?.messageId || meta?.id || createLocalId('user');
div.className = `msg ${role}${role === 'assistant' ? ' agent-' + currentAgent : ''}${isCrossConversation ? ' cross-conversation' : ''}${isCrossConversationReply ? ' cross-conversation-reply' : ''}`;
div.className = `msg ${role}${role === 'assistant' ? ' agent-' + currentAgent : ''}${isCrossConversation ? ' cross-conversation' : ''}${isCrossConversationReply ? ' cross-conversation-reply' : ''}${isGoalMessage ? ' goal-message' : ''}`;
if (role === 'user') {
div.id = `hapi-message-${resolvedMessageId}`;
div.dataset.messageId = resolvedMessageId;
if (isGoalMessage) div.dataset.goalMode = 'true';
}
if (role === 'system') {
@@ -8109,6 +8111,13 @@
}
if (role === 'user') {
if (isGoalMessage) {
const goalLabel = document.createElement('div');
goalLabel.className = 'goal-message-label';
goalLabel.textContent = '目标模式';
goalLabel.setAttribute('aria-label', '目标模式');
bubble.appendChild(goalLabel);
}
if (content) {
const textNode = document.createElement('div');
textNode.className = 'msg-text';

View File

@@ -24,7 +24,7 @@
document.documentElement.dataset.dividerTime = dividerTime;
})();
</script>
<link rel="stylesheet" href="style.css?v=20260805-usage-loading-inline">
<link rel="stylesheet" href="style.css?v=20260818-goal-mode-label">
<link rel="stylesheet" href="task-board.css?v=__CC_WEB_FRONTEND_ASSET_VERSION__">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
</head>

View File

@@ -2991,6 +2991,38 @@ html[data-theme='wasteland'] .advanced-search-panel {
border-bottom-right-radius: 4px;
padding-right: 42px;
}
.msg.user.goal-message .msg-bubble {
display: flex;
flex-direction: column;
align-items: stretch;
}
.goal-message-label {
display: inline-flex;
align-items: center;
align-self: flex-start;
gap: 5px;
max-width: 100%;
margin: -2px 0 7px;
padding: 2px 7px;
border: 1px solid rgba(255, 255, 255, 0.24);
border-radius: 5px;
background: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.86);
font-size: 11px;
font-weight: 700;
line-height: 1.35;
letter-spacing: 0;
white-space: nowrap;
}
.goal-message-label::before {
width: 6px;
height: 6px;
flex: 0 0 6px;
border-radius: 50%;
background: currentColor;
content: '';
opacity: 0.82;
}
.msg-mentions {
display: flex;
flex-wrap: wrap;
@@ -9508,6 +9540,12 @@ html[data-theme='wasteland'] .msg.user .msg-bubble {
box-shadow: inset 0 1px rgba(255, 230, 180, 0.03);
}
html[data-theme='wasteland'] .msg.user.goal-message .goal-message-label {
border-color: rgba(196, 154, 90, 0.42);
background: rgba(185, 139, 75, 0.14);
color: #e0bd7a;
}
html[data-theme='wasteland'] :is(.msg.assistant, .msg.cross-conversation, .msg.cross-conversation-reply, .msg.system) .msg-bubble {
background: rgba(5, 7, 7, 0.1);
border-color: rgba(185, 139, 75, 0.16);