Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
9ba4cd4
1
Parent(s): 78f0201
fix: show activity status for approval-flow tools and revert chip override
Browse files- Call onToolRunning on tool_state_change with state 'running' so the
activity bar updates for approval-flow tools (hf_jobs, sandbox_create)
- Revert description override in ToolCallGroup status chip
frontend/src/components/Chat/ToolCallGroup.tsx
CHANGED
|
@@ -496,9 +496,7 @@ export default function ToolCallGroup({ tools, approveTools }: ToolCallGroupProp
|
|
| 496 |
const displayState = isPending && localDecision
|
| 497 |
? (localDecision.approved ? 'input-available' : 'output-denied')
|
| 498 |
: state;
|
| 499 |
-
const
|
| 500 |
-
const toolDescription = (tool.input as Record<string, unknown>)?.description as string | undefined;
|
| 501 |
-
const label = baseLabel ? (toolDescription || baseLabel) : null;
|
| 502 |
|
| 503 |
// Parse job metadata from hf_jobs output and store
|
| 504 |
const jobUrlFromStore = tool.toolName === 'hf_jobs' ? getJobUrl(tool.toolCallId) : undefined;
|
|
|
|
| 496 |
const displayState = isPending && localDecision
|
| 497 |
? (localDecision.approved ? 'input-available' : 'output-denied')
|
| 498 |
: state;
|
| 499 |
+
const label = statusLabel(displayState as ToolPartState);
|
|
|
|
|
|
|
| 500 |
|
| 501 |
// Parse job metadata from hf_jobs output and store
|
| 502 |
const jobUrlFromStore = tool.toolName === 'hf_jobs' ? getJobUrl(tool.toolCallId) : undefined;
|
frontend/src/lib/ws-chat-transport.ts
CHANGED
|
@@ -547,6 +547,7 @@ export class WebSocketChatTransport implements ChatTransport<UIMessage> {
|
|
| 547 |
case 'tool_state_change': {
|
| 548 |
const tcId = (event.data?.tool_call_id as string) || '';
|
| 549 |
const state = (event.data?.state as string) || '';
|
|
|
|
| 550 |
const jobUrl = (event.data?.jobUrl as string) || undefined;
|
| 551 |
|
| 552 |
if (tcId.startsWith('plan_tool')) break;
|
|
@@ -555,6 +556,10 @@ export class WebSocketChatTransport implements ChatTransport<UIMessage> {
|
|
| 555 |
useAgentStore.getState().setJobUrl(tcId, jobUrl);
|
| 556 |
}
|
| 557 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
if (this.streamController && (state === 'rejected' || state === 'abandoned')) {
|
| 559 |
this.enqueue({ type: 'tool-output-denied', toolCallId: tcId });
|
| 560 |
}
|
|
|
|
| 547 |
case 'tool_state_change': {
|
| 548 |
const tcId = (event.data?.tool_call_id as string) || '';
|
| 549 |
const state = (event.data?.state as string) || '';
|
| 550 |
+
const toolName = (event.data?.tool as string) || '';
|
| 551 |
const jobUrl = (event.data?.jobUrl as string) || undefined;
|
| 552 |
|
| 553 |
if (tcId.startsWith('plan_tool')) break;
|
|
|
|
| 556 |
useAgentStore.getState().setJobUrl(tcId, jobUrl);
|
| 557 |
}
|
| 558 |
|
| 559 |
+
if (state === 'running' && toolName) {
|
| 560 |
+
this.sideChannel.onToolRunning(toolName);
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
if (this.streamController && (state === 'rejected' || state === 'abandoned')) {
|
| 564 |
this.enqueue({ type: 'tool-output-denied', toolCallId: tcId });
|
| 565 |
}
|