Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(web): source-card marker stays out of the model's history; browser check without the backend mock

purple80921563823b
diff --git a/src/api/agents/sub-agent.ts b/src/api/agents/sub-agent.ts
index 45a1338d..7f2b9df7 100644
--- a/src/api/agents/sub-agent.ts
+++ b/src/api/agents/sub-agent.ts
@@ -11,6 +11,7 @@
* filtering, the model has no syntactically valid path to recurse.
*/
+import { stripSourcesMarker } from '../../lib/web-evidence'
import { settleThinking } from '../../lib/thinking-stripper'
import { toolResultIsFailure } from '../../lib/tool-result-failure'
import { isRunStopped } from '../../lib/run-stop'
@@ -670,7 +671,7 @@ export async function defaultSubAgentRunner(
// fuer eine Fortsetzung im Store liegen kann, waere ein 4-MB-Protokoll
// aus einem file_read eine Zeile, die niemand mehr loswird.
content: clampTaskResult(
- r.result ?? gates.refusals.get(r.id) ?? r.error ?? '(no output)',
+ (r.result !== undefined ? stripSourcesMarker(r.result) : undefined) ?? gates.refusals.get(r.id) ?? r.error ?? '(no output)',
),
tool_call_id: turn.toolCalls[i]?.id,
})
diff --git a/src/api/mcp/__tests__/kein-argument-ungeprueft.test.ts b/src/api/mcp/__tests__/kein-argument-ungeprueft.test.ts
index 5dcebb5b..9764f0b3 100644
--- a/src/api/mcp/__tests__/kein-argument-ungeprueft.test.ts
+++ b/src/api/mcp/__tests__/kein-argument-ungeprueft.test.ts
@@ -126,7 +126,8 @@ describe('die Tabelle deckt den Katalog ab', () => {
})
describe('eine Anfrage ohne ihre Pflichtangabe geht gar nicht erst hinaus', () => {
- for (const [tool, voll] of Object.entries(PFLICHT)) {
+ // The LU browser is registered only inside the app on macOS and Windows.
+ for (const [tool, voll] of Object.entries(PFLICHT).filter(([t]) => !t.startsWith('browser_') || registry.getToolByName(t))) {
for (const fehlt of Object.keys(voll)) {
it(`${tool} ohne \`${fehlt}\``, async () => {
const args: Record<string, unknown> = { ...voll }
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.ts
index 04b7d862..f395ffe2 100644
--- a/src/hooks/useAgentChat.ts
+++ b/src/hooks/useAgentChat.ts
@@ -1,3 +1,4 @@
+import { stripSourcesMarker } from '../lib/web-evidence'
import { useRef, useState, useCallback, useEffect } from 'react'
import { frameFlush } from '../lib/frame-flush'
import { useRunActivityStore, toolProgressActivity, waitBeforeRetry, readingActivity, endFirstWait, hiddenThoughtArrived, waitForChatCard } from '../stores/runActivityStore'
@@ -3224,7 +3225,7 @@ export function useAgentChat() {
r.status === 'rejected'
? REJECTED_CALL_FOR_MODEL
: r.status === 'completed' || r.status === 'cached'
- ? (r.result ?? '')
+ ? stripSourcesMarker(r.result ?? '') // P-L: the source cards' marker is for the chat, not the model
: r.errorHint
? `${r.error ?? 'Tool failed'}, ${r.errorHint}`
: (r.error ?? 'Tool failed')
diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.ts
index 30021953..f3292cb9 100644
--- a/src/hooks/useCodex.ts
+++ b/src/hooks/useCodex.ts
@@ -1,3 +1,4 @@
+import { stripSourcesMarker } from '../lib/web-evidence'
import { NOT_IN_CODE_TAB } from '../lib/browser-tools'
import { useRef, useState, useCallback } from 'react'
import { markCannotThink } from '../lib/model-compatibility'
@@ -2534,7 +2535,7 @@ export function useCodex() {
const resultTextFor = (r: typeof results[number]): string => {
const text =
r.status === 'completed' || r.status === 'cached'
- ? (r.result ?? '')
+ ? stripSourcesMarker(r.result ?? '') // P-L: the source cards' marker is for the chat, not the model
: r.status === 'rejected'
? REJECTED_CALL_FOR_MODEL
: r.errorHint
diff --git a/src/lib/browser-tools.ts b/src/lib/browser-tools.ts
index abcbc2fe..a07badac 100644
--- a/src/lib/browser-tools.ts
+++ b/src/lib/browser-tools.ts
@@ -9,7 +9,8 @@
// every web text (lib/web-evidence.ts), and an address the model put together
// itself waits for the user's yes (lib/web-url-provenance.ts).
-import { backendCall, isTauri } from '../api/backend'
+import { backendCall } from '../api/backend'
+import { isTauri } from '../api/in-tauri'
import type { AgentRunContext } from '../api/agent-context'
import type { MCPToolDefinition, ToolArgs } from '../api/mcp/types'
import { hostPlatform } from './host-platform'