Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(chat): relabel agent-callback trigger chip to "From" (owner copy) (#974)

Call White7b96931a8cf9
diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsx
index 9850b48e6..2c5d70895 100644
--- a/ui/src/components/workbench/ChatPage.tsx
+++ b/ui/src/components/workbench/ChatPage.tsx
@@ -24,7 +24,7 @@ import {
resolveActivityLabel,
sortBackgroundActivities,
} from '../../lib/backgroundActivity';
-import { chatTriggerLink, isUnresolvedAgentCallback } from '../../lib/chatTrigger';
+import { chatTriggerLink, harnessChipLabelKey, isUnresolvedAgentCallback } from '../../lib/chatTrigger';
import { useFileDrop } from '../../lib/useFileDrop';
import { quoteText } from '../../lib/quoteText';
import { mergeById, insertMessageOrdered } from '../../lib/transcriptOrder';
@@ -3040,23 +3040,6 @@ const ThinkingBubble: React.FC<{ session: WorkbenchSession }> = ({ session }) =>
);
};
-// Maps a harness trigger kind (the ``author_name`` on a source='harness' row)
-// to a friendly provenance label. Distinguishes Task vs Watch per the spec; a
-// finer kind (webhook) gets its own label, anything else falls back.
-const harnessLabel = (kind: string | null | undefined, t: (k: string) => string): string => {
- switch (kind) {
- case 'watch':
- return t('chat.source.watch');
- case 'webhook':
- return t('chat.source.webhook');
- case 'scheduled':
- case 'task_run':
- return t('chat.source.scheduled');
- default:
- return t('chat.source.harness');
- }
-};
-
type MessageRowProps = {
message: WorkbenchMessage;
session: WorkbenchSession;
@@ -3236,11 +3219,11 @@ const MessageRow = memo(function MessageRow({ message, session, messageFontSize,
onClick={() => navigate(triggerLink.to)}
className="inline-flex items-center gap-1 text-[11px] font-medium text-cyan hover:underline"
>
- {harnessLabel(message.author_name, t)}
+ {t(harnessChipLabelKey(message))}
<ArrowUpRight className="size-3 shrink-0" />
</button>
) : (
- <span className="text-[11px] font-medium text-cyan">{harnessLabel(message.author_name, t)}</span>
+ <span className="text-[11px] font-medium text-cyan">{t(harnessChipLabelKey(message))}</span>
)}
{triggerLink?.kind === 'source' && (
// A9a: agent-callback shows the SOURCE session + links to its chat.
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 72697611a..5e6cfb05c 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -2568,7 +2568,8 @@
"scheduled": "Scheduled task",
"watch": "Watch",
"webhook": "Webhook",
- "harness": "Automated",
+ "harness": "From agent",
+ "from": "From",
"agentFallback": "agent"
},
"picker": {
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 5948888e0..5af30fb59 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -2568,7 +2568,8 @@
"scheduled": "定时任务",
"watch": "Watch 监听",
"webhook": "Webhook",
- "harness": "自动触发",
+ "harness": "来自 Agent",
+ "from": "来自",
"agentFallback": "智能体"
},
"picker": {
diff --git a/ui/src/lib/chatTrigger.test.ts b/ui/src/lib/chatTrigger.test.ts
index 283fc5bad..7aed91616 100644
--- a/ui/src/lib/chatTrigger.test.ts
+++ b/ui/src/lib/chatTrigger.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { chatTriggerLink, isUnresolvedAgentCallback } from './chatTrigger';
+import { chatTriggerLink, harnessChipLabelKey, isUnresolvedAgentCallback } from './chatTrigger';
type Msg = Parameters<typeof chatTriggerLink>[0];
const msg = (over: Partial<Msg>): Msg => ({
@@ -92,3 +92,27 @@ describe('isUnresolvedAgentCallback', () => {
expect(m({ source: 'agent' })).toBe(false);
});
});
+
+describe('harnessChipLabelKey (leading-label key by source presence)', () => {
+ const key = (over: Partial<Msg>) => harnessChipLabelKey(msg(over));
+
+ it('a resolved agent-callback uses the "From" PREFIX key (precedes the source title)', () => {
+ expect(key({ author_name: 'agent_run', source_session_id: 'ses_src_1234' })).toBe('chat.source.from');
+ // The prefix wins even for a watch-authored row that carries a source.
+ expect(key({ author_name: 'watch', source_session_id: 'ses_src' })).toBe('chat.source.from');
+ });
+
+ it('an unresolved agent-callback falls back to the self-contained "From agent" key', () => {
+ // Source deleted / not yet enriched → no dangling bare "From".
+ expect(key({ author_name: 'agent_run', source_session_id: null })).toBe('chat.source.harness');
+ expect(key({ author_name: null, source_session_id: null })).toBe('chat.source.harness');
+ });
+
+ it('task / watch / webhook keep their own self-contained labels (unchanged)', () => {
+ expect(key({ author_name: 'watch' })).toBe('chat.source.watch');
+ expect(key({ author_name: 'webhook' })).toBe('chat.source.webhook');
+ for (const author_name of ['scheduled', 'task_run', 'task']) {
+ expect(key({ author_name })).toBe('chat.source.scheduled');
+ }
+ });
+});
diff --git a/ui/src/lib/chatTrigger.ts b/ui/src/lib/chatTrigger.ts
index 93f272c70..95c80b8fa 100644
--- a/ui/src/lib/chatTrigger.ts
+++ b/ui/src/lib/chatTrigger.ts
@@ -78,3 +78,20 @@ export function chatTriggerLink(message: TriggerFields, agentFallback: string):
}
return null;
}
+
+// i18n key for a harness chip's leading label. Branches on source presence:
+// - a resolved agent callback (source_session_id set) uses the "From" PREFIX
+// (chat.source.from) that leads into the source-session link → "From · <title>↗".
+// - an unresolved one (source deleted, or a pre-enrichment live row) falls back to
+// the SELF-CONTAINED "From agent" (chat.source.harness) — still source semantics,
+// never the mechanism-flavored "Automated" that read as system-triggered.
+// - Task / Watch / Webhook keep their own self-contained labels.
+// Pure so the branch is unit-tested alongside chatTriggerLink.
+export function harnessChipLabelKey(message: TriggerFields): string {
+ if (message.source === 'harness' && message.source_session_id) return 'chat.source.from';
+ const kind = message.author_name;
+ if (kind === 'watch') return 'chat.source.watch';
+ if (kind === 'webhook') return 'chat.source.webhook';
+ if (TASK_KINDS.has(kind ?? '')) return 'chat.source.scheduled';
+ return 'chat.source.harness';
+}