Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Show Assistant model reasoning activity

rcourtmance4dc88ab774
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 619ff121a3..5cf170adc6 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -369,8 +369,11 @@ runtime cost control, and shared AI transport surfaces.
Assistant stream events must pass through `chat.StreamEvent.ClientSafe()`;
provider `thinking` chunks are runtime-only and may be retained internally
for model continuity, but they are dropped before the browser/API boundary.
- Neutral progress comes from the active stream state, workflow status, or
- governed tool/question/approval events, not from a reasoning body. Pulse tool
+ The agentic stream may translate the first private provider reasoning delta
+ before visible output into a neutral `model_thinking` workflow status so the
+ drawer shows live activity without exposing chain-of-thought. Neutral
+ progress comes from the active stream state, workflow status, or governed
+ tool/question/approval events, not from a reasoning body. Pulse tool
invocations must surface only through governed `tool_start` / `tool_end`,
approval, or question blocks; if a provider emits `pulse_*` / `patrol_*`
calls, DSML, XML/function-call envelopes, or JSON tool-call shapes as text
diff --git a/internal/ai/chat/agentic.go b/internal/ai/chat/agentic.go
index 79ea0e8510..3207a9ee6e 100644
--- a/internal/ai/chat/agentic.go
+++ b/internal/ai/chat/agentic.go
@@ -800,6 +800,7 @@ func (a *AgenticLoop) executeWithTools(ctx context.Context, sessionID string, me
var toolCalls []providers.ToolCall
var suppressLeakedToolContent bool
var pendingVisibleContent string
+ var emittedThinkingWorkflow bool
visibleToolStarts := make(map[string]bool)
suppressedToolStarts := make(map[string]bool)
emitToolStartIfNeeded := func(tc providers.ToolCall) {
@@ -858,6 +859,10 @@ func (a *AgenticLoop) executeWithTools(ctx context.Context, sessionID string, me
case "thinking":
if data, ok := event.Data.(providers.ThinkingEvent); ok {
thinkingBuilder.WriteString(data.Text)
+ if !emittedThinkingWorkflow && !attemptEmittedVisibleEvents {
+ emitWorkflowState(callback, "model_thinking", "Model is reasoning before responding.", sessionFSMState(a.sessionFSM), "")
+ emittedThinkingWorkflow = true
+ }
}
case "tool_start":
diff --git a/internal/ai/chat/agentic_test.go b/internal/ai/chat/agentic_test.go
index 6d401c5e43..756c5f15fb 100644
--- a/internal/ai/chat/agentic_test.go
+++ b/internal/ai/chat/agentic_test.go
@@ -150,8 +150,13 @@ func TestAgenticLoop(t *testing.T) {
assert.NotEqual(t, "thinking", event.Type)
assert.NotContains(t, string(event.Data), "private provider reasoning")
}
- require.Len(t, events, 1)
- assert.Equal(t, "content", events[0].Type)
+ require.Len(t, events, 2)
+ assert.Equal(t, "workflow_state", events[0].Type)
+ var workflowState WorkflowStateData
+ require.NoError(t, json.Unmarshal(events[0].Data, &workflowState))
+ assert.Equal(t, "model_thinking", workflowState.Phase)
+ assert.Equal(t, "Model is reasoning before responding.", workflowState.Message)
+ assert.Equal(t, "content", events[1].Type)
})
t.Run("Execute with Tool Call", func(t *testing.T) {