Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bridge-browser/src/content/dom_tool_activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class DomToolActivityController {
this.tracker.capture({
identity: options.identity,
payload: options.payload,
source: "dom",
turnId: this.getTurnId(options.messageElement),
});
}
Expand Down
2 changes: 2 additions & 0 deletions bridge-browser/src/content/network_tool_calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export class NetworkToolCallController {
this.options.toolActivityTracker.capture({
identity,
payload,
source: "network",
turnId: activityTurnId,
});
if (!this.options.requestRegistry.hasSeen(identity.requestKey)) {
Expand All @@ -144,6 +145,7 @@ export class NetworkToolCallController {
this.options.toolActivityTracker.captureProtocolError({
identity,
message: getErrorMessage(error),
source: "network",
turnId: activityTurnId,
});
return identity;
Expand Down
11 changes: 9 additions & 2 deletions bridge-browser/src/content/tool_activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export type ToolActivityStatus =
| "failed"
| "rejected";

export type ToolActivitySource = "dom" | "network";

export type ToolActivityDeliveryStatus =
| "pending"
| "waiting"
Expand All @@ -23,6 +25,7 @@ export interface ToolActivityItem {
message?: string;
purpose?: string;
requestKey: string;
source: ToolActivitySource;
startedAt?: number;
status: ToolActivityStatus;
toolName: string;
Expand All @@ -46,12 +49,14 @@ type ToolActivityListener = (snapshot: ToolActivitySnapshot) => void;
interface CaptureActivityOptions {
identity: ToolRequestIdentity;
payload: ToolExecutionPayload;
source: ToolActivitySource;
turnId: string;
}

interface CaptureProtocolErrorOptions {
identity: ToolRequestIdentity;
message: string;
source: ToolActivitySource;
turnId: string;
}

Expand Down Expand Up @@ -82,7 +87,7 @@ export class ToolActivityTracker {
}

public capture(options: CaptureActivityOptions): void {
const { identity, payload, turnId } = options;
const { identity, payload, source, turnId } = options;
if (this.items.has(identity.requestKey)) {return;}

const turn = this.ensureTurn(turnId);
Expand All @@ -91,6 +96,7 @@ export class ToolActivityTracker {
detail: getPayloadDetail(payload),
purpose: normalizeText(payload.purpose),
requestKey: identity.requestKey,
source,
status: "captured",
toolName: payload.name,
turnId,
Expand All @@ -99,7 +105,7 @@ export class ToolActivityTracker {
}

public captureProtocolError(options: CaptureProtocolErrorOptions): void {
const { identity, message, turnId } = options;
const { identity, message, source, turnId } = options;
if (this.items.has(identity.requestKey)) {return;}

const turn = this.ensureTurn(turnId);
Expand All @@ -108,6 +114,7 @@ export class ToolActivityTracker {
completedAt: Date.now(),
message,
requestKey: identity.requestKey,
source,
status: "failed",
toolName: "invalid_tool_call",
turnId,
Expand Down
8 changes: 7 additions & 1 deletion bridge-browser/src/content/tool_activity_overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,16 @@ function createActivityRow(item: ToolActivityItem): HTMLElement {
const name = document.createElement("span");
name.className = "tool-name";
name.textContent = item.toolName;
const source = document.createElement("span");
source.className = `source-badge ${item.source}`;
source.textContent = t(item.source === "network" ? "activity_source_network" : "activity_source_dom");
const toolIdentity = document.createElement("div");
toolIdentity.className = "tool-identity";
toolIdentity.append(name, source);
const status = document.createElement("span");
status.className = "status";
status.textContent = getItemStatusText(item);
top.append(name, status);
top.append(toolIdentity, status);
content.appendChild(top);

if (item.purpose) {content.appendChild(createTextLine("purpose", item.purpose));}
Expand Down
6 changes: 5 additions & 1 deletion bridge-browser/src/content/tool_activity_overlay_styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ export const TOOL_ACTIVITY_STYLE_TEXT = `
.row.failed .status-dot, .row.rejected .status-dot { background: #ef4444; }
.row-content { min-width: 0; flex: 1; }
.row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tool-name { overflow: hidden; color: #f3f4f6; font: 600 12px/1.4 "SFMono-Regular", Consolas, monospace;
.tool-identity { min-width: 0; display: flex; align-items: center; gap: 6px; }
.tool-name { min-width: 0; overflow: hidden; color: #f3f4f6; font: 600 12px/1.4 "SFMono-Regular", Consolas, monospace;
text-overflow: ellipsis; white-space: nowrap; }
.source-badge { flex: 0 0 auto; padding: 0 5px; border: 1px solid #555d69; border-radius: 999px;
color: #d1d5db; background: rgba(107, 114, 128, .16); font-size: 9px; font-weight: 650; line-height: 16px; }
.source-badge.network { border-color: #315d9e; color: #93c5fd; background: rgba(37, 99, 235, .18); }
.status { flex: 0 0 auto; color: #aeb5c2; font-size: 10px; }
.purpose, .detail, .message { overflow: hidden; margin-top: 3px; text-overflow: ellipsis; white-space: nowrap; }
.purpose { color: #c4c9d2; }
Expand Down
2 changes: 2 additions & 0 deletions bridge-browser/src/modules/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ const I18N_MESSAGES: Record<string, { en: string; zh: string }> = {
activity_hide_history: { en: "Hide history", zh: "隐藏历史" },
activity_no_history: { en: "No previous tool activity", zh: "暂无之前的工具活动" },
activity_drag: { en: "Drag tool activity window", zh: "拖动工具活动窗口" },
activity_source_dom: { en: "DOM", zh: "DOM" },
activity_source_network: { en: "Network", zh: "网络" },

hitl_title: { en: "Approval Required", zh: "请求执行工具" },
label_tool: { en: "Tool Name", zh: "工具名称" },
Expand Down
Loading
Loading