Skip to content

The agent that grows with you

fix(desktop): strip markdown delimiters from artifact paths

Raaj Kumarfdde5ee1ab79
diff --git a/apps/desktop/src/app/artifacts/artifact-utils.ts b/apps/desktop/src/app/artifacts/artifact-utils.ts
index d7a86e90c61..c86fcc672cc 100644
--- a/apps/desktop/src/app/artifacts/artifact-utils.ts
+++ b/apps/desktop/src/app/artifacts/artifact-utils.ts
@@ -114,7 +114,21 @@ function artifactSessionTitle(session: SessionInfo): string {
}
function normalizeValue(value: string): string {
- return value.trim().replace(/[),.;]+$/, '')
+ let trimmed = value.trim()
+
+ for (let i = 0; i < 3; i += 1) {
+ const quote = trimmed[0]
+
+ if (quote && quote === trimmed.at(-1) && ['"', "'", '`'].includes(quote)) {
+ trimmed = trimmed.slice(1, -1).trim()
+
+ continue
+ }
+
+ break
+ }
+
+ return trimmed.replace(/[`*]+$/g, '').replace(/[),.;]+$/, '')
}
// Chat renders file refs as `[label](#media:<encoded path>)`. Decode before
diff --git a/apps/desktop/src/app/artifacts/index.test.ts b/apps/desktop/src/app/artifacts/index.test.ts
index f6ef646c504..f07146ea4ea 100644
--- a/apps/desktop/src/app/artifacts/index.test.ts
+++ b/apps/desktop/src/app/artifacts/index.test.ts
@@ -48,6 +48,23 @@ describe('collectArtifactsForSession', () => {
})
})
+ it('strips Markdown code delimiters from discovered link artifacts', () => {
+ const artifacts = collectArtifactsForSession(makeSession(), [
+ {
+ content: 'Preview URL: `https://voice.qwickapps.com`',
+ role: 'assistant',
+ timestamp: 2000
+ }
+ ])
+
+ expect(artifacts).toHaveLength(1)
+ expect(artifacts[0]).toMatchObject({
+ href: 'https://voice.qwickapps.com',
+ kind: 'link',
+ value: 'https://voice.qwickapps.com'
+ })
+ })
+
it('does not index passive links and paths observed in tool output', () => {
const messages: SessionMessage[] = [
{
@@ -171,7 +188,7 @@ describe('collectArtifactsForSession', () => {
},
{
content: JSON.stringify({
- file_path: '/tmp/generated/voice.ogg',
+ file_path: '`/tmp/generated/transcript.md`',
media_tag: 'MEDIA:/tmp/generated/voice.ogg',
success: true
}),
@@ -186,7 +203,8 @@ describe('collectArtifactsForSession', () => {
'/tmp/generated/report.pdf',
'/tmp/generated/notes.md',
'https://cdn.example.com/generated/data.csv',
- '/tmp/generated/voice.ogg'
+ '/tmp/generated/voice.ogg',
+ '/tmp/generated/transcript.md'
])
})